MCPcopy
hub / github.com/thesysdev/openui / evaluateElementInline

Function evaluateElementInline

packages/lang-core/src/runtime/evaluator.ts:255–269  ·  view source on GitHub ↗

* Evaluate an ElementNode's props with schema awareness. Used by evaluate() * when schema context is available and a Comp produces an ElementNode that * needs its own props evaluated with reactive schema detection.

(
  el: ElementNode,
  context: EvaluationContext,
  schemaCtx: SchemaContext,
)

Source from the content-addressed store, hash-verified

253 * needs its own props evaluated with reactive schema detection.
254 */
255function evaluateElementInline(
256 el: ElementNode,
257 context: EvaluationContext,
258 schemaCtx: SchemaContext,
259): ElementNode {
260 if (el.hasDynamicProps === false) return el;
261 const def = schemaCtx.library.components[el.typeName];
262 const evaluated: Record<string, unknown> = {};
263
264 for (const [key, value] of Object.entries(el.props)) {
265 const propSchema = def?.props?.shape?.[key];
266 evaluated[key] = evaluatePropInline(value, context, schemaCtx, propSchema);
267 }
268 return { ...el, props: evaluated };
269}
270
271/**
272 * Evaluate a single prop value with schema awareness.

Callers 3

evaluateFunction · 0.85
evaluatePropInlineFunction · 0.85
evaluateLazyBuiltinFunction · 0.85

Calls 1

evaluatePropInlineFunction · 0.85

Tested by

no test coverage detected