MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / applyVariableToProps

Function applyVariableToProps

packages/extension/utils/variable-output.ts:246–265  ·  view source on GitHub ↗
(
  style: Record<string, string>,
  props: readonly string[],
  id: string,
  context: VariableProjectionContext,
  format: VariableFormatter,
  readers: FigmaLookupReaders
)

Source from the content-addressed store, hash-verified

244}
245
246function applyVariableToProps(
247 style: Record<string, string>,
248 props: readonly string[],
249 id: string,
250 context: VariableProjectionContext,
251 format: VariableFormatter,
252 readers: FigmaLookupReaders
253): void {
254 if (!props.some((prop) => prop in style)) return
255
256 const variable = resolveContextVariable(id, context, readers)
257 if (!variable) return
258 const value = format(variable)
259 if (!value) return
260
261 props.forEach((prop) => {
262 if (!(prop in style)) return
263 style[prop] = value
264 })
265}
266
267function resolveContextVariable(
268 id: string,

Callers 2

applyBoundFieldsFunction · 0.85
applyTextFieldsFunction · 0.85

Calls 1

resolveContextVariableFunction · 0.85

Tested by

no test coverage detected