@pwfabric/runtime 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/dist/binding/expression.js +4 -1
- package/dist/binding/expression.js.map +1 -1
- package/dist/connectors/types.d.ts +4 -2
- package/dist/connectors/types.js +4 -2
- package/dist/connectors/types.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/render/DataBoundSurfaceRenderer.d.ts +10 -0
- package/dist/render/DataBoundSurfaceRenderer.js +45 -11
- package/dist/render/DataBoundSurfaceRenderer.js.map +1 -1
- package/dist/render/data-binding-types.d.ts +13 -2
- package/dist/render/data-binding-types.js.map +1 -1
- package/dist/render/index.d.ts +3 -1
- package/dist/render/index.js +2 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/links.d.ts +50 -0
- package/dist/render/links.js +78 -0
- package/dist/render/links.js.map +1 -0
- package/dist/render/resolve-expressions.d.ts +22 -1
- package/dist/render/resolve-expressions.js +65 -5
- package/dist/render/resolve-expressions.js.map +1 -1
- package/dist/render/scoped-css.d.ts +8 -1
- package/dist/render/scoped-css.js +16 -0
- package/dist/render/scoped-css.js.map +1 -1
- package/dist/surface/expression.js +0 -1
- package/dist/surface/expression.js.map +1 -1
- package/dist/surface/output.js +1 -1
- package/dist/surface/output.js.map +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -3,7 +3,7 @@ Business Source License 1.1
|
|
|
3
3
|
Parameters
|
|
4
4
|
|
|
5
5
|
Licensor: PhiMajor Solutions
|
|
6
|
-
Licensed Work: @pwfabric/runtime 1.0
|
|
6
|
+
Licensed Work: @pwfabric/runtime 2.1.0
|
|
7
7
|
The Licensed Work is (c) 2026 PhiMajor Solutions.
|
|
8
8
|
Additional Use Grant: You may make production use of the Licensed Work,
|
|
9
9
|
including building applications with it and hosting
|
|
@@ -12,7 +12,7 @@ Additional Use Grant: You may make production use of the Licensed Work,
|
|
|
12
12
|
to third parties as a hosted or managed service where
|
|
13
13
|
the service gives them substantially the functionality
|
|
14
14
|
of the Licensed Work.
|
|
15
|
-
Change Date: 2030-
|
|
15
|
+
Change Date: 2030-11-17
|
|
16
16
|
Change License: Apache License, Version 2.0
|
|
17
17
|
|
|
18
18
|
For information about alternative licensing arrangements for the Licensed
|
|
@@ -695,7 +695,10 @@ export const DEFAULT_BINDING_HELPERS = {
|
|
|
695
695
|
return out;
|
|
696
696
|
},
|
|
697
697
|
// Array helpers
|
|
698
|
-
|
|
698
|
+
// A list or a string has a length; anything else — a source that has not
|
|
699
|
+
// answered (`undefined`), `null`, a number — has none, and `String(v).length`
|
|
700
|
+
// counted the letters of "undefined" (9) or "null" (4) instead.
|
|
701
|
+
length: (v) => (Array.isArray(v) || typeof v === 'string' ? v.length : 0),
|
|
699
702
|
first: (arr) => (Array.isArray(arr) ? arr[0] : undefined),
|
|
700
703
|
last: (arr) => (Array.isArray(arr) ? arr[arr.length - 1] : undefined),
|
|
701
704
|
join: (arr, sep) => Array.isArray(arr) ? arr.join(String(sep ?? ',')) : String(arr),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../src/binding/expression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkEH,+DAA+D;AAC/D,kBAAkB;AAClB,+DAA+D;AAE/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe,EAAE,GAAW;IACvD,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IAC3F,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,GAAY,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G,OAAO,CAAC,OAAO,EAAE;aAC5C,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["/**\n * Expression Evaluator for Data Binding\n *\n * Enhanced expression evaluation for data binding in surfaces\n *\n * This module extends the base expression evaluator with:\n * - Arithmetic operations (+, -, *, /, %)\n * - Data/state/params context separation\n * - Dependency extraction for reactive updates\n * - Safe null-coalescing operators\n *\n * @module @pwfabric/runtime/binding/expression\n */\n\n// ============================================================\n// EXPRESSION CONTEXT\n// ============================================================\n\n/**\n * Context for expression evaluation in data binding\n */\nexport interface BindingExpressionContext {\n /** Data from data sources */\n readonly data: Record<string, unknown>\n /** State from state stores */\n readonly state: Record<string, unknown>\n /** URL/route parameters */\n readonly params: Record<string, unknown>\n /** Custom helper functions */\n readonly helpers?: Record<string, (...args: unknown[]) => unknown>\n}\n\n/**\n * Result of expression evaluation\n */\nexport type ExpressionEvalResult<T = unknown> =\n | { readonly success: true; readonly value: T }\n | { readonly success: false; readonly error: string }\n\n// ============================================================\n// EXPRESSION EVALUATOR INTERFACE\n// ============================================================\n\n/**\n * Expression evaluator interface for data binding\n */\nexport interface ExpressionEvaluator {\n /**\n * Evaluate an expression in the given context\n */\n evaluate(expression: string, context: BindingExpressionContext): unknown\n\n /**\n * Check if a value is an expression (contains {{...}})\n */\n isExpression(value: unknown): boolean\n\n /**\n * Extract dependencies from an expression for reactive updates\n */\n extractDependencies(expression: string): ExpressionDependency[]\n\n /**\n * Interpolate expressions in a template string\n */\n interpolate(template: string, context: BindingExpressionContext): string\n}\n\n/**\n * Dependency extracted from an expression\n */\nexport interface ExpressionDependency {\n /** The source of the dependency */\n readonly source: 'data' | 'state' | 'params'\n /** The path within the source */\n readonly path: string\n}\n\n// ============================================================\n// PATH RESOLUTION\n// ============================================================\n\n/**\n * Read one named property off a value, stepping into a list of one record.\n *\n * A LIST SOURCE ALWAYS BINDS AS A LIST (DataBoundSurfaceRenderer): a `rest`,\n * `entity` or `graphql` source answering with ONE object is bound as `[obj]`,\n * so `{{src[0].field}}` and `{{src.length}}` behave the same whatever the\n * endpoint returned. But a detail page is authored as `{{product.title}}`, and\n * a property read on an array finds nothing — such a page would render blank\n * (`{{rows.name}}` → empty while `{{rows[0].name}}` → \"banana\").\n *\n * So: when the value is an array of EXACTLY ONE element and the array itself\n * does not carry the key (not `length`, not an index, not an array method),\n * the read continues into that one element. A list of two or more is a list —\n * its `.title` stays undefined, as it always was. Both evaluators (this one\n * and surface/expression) read properties through here, so a path means the\n * same thing in a binding and in a block prop.\n */\nexport function readProperty(target: unknown, key: string): unknown {\n if (target === null || target === undefined || typeof target !== 'object') return undefined\n if (Array.isArray(target) && target.length === 1 && !(key in target)) {\n const only: unknown = target[0]\n return only !== null && typeof only === 'object'\n ? (only as Record<string, unknown>)[key]\n : undefined\n }\n return (target as Record<string, unknown>)[key]\n}\n\n/**\n * Resolve a dotted path in an object, handling nested properties and array indices\n *\n * @example\n * resolvePath({ user: { name: 'John' } }, 'user.name') // 'John'\n * resolvePath({ items: ['a', 'b'] }, 'items[0]') // 'a'\n * resolvePath({ users: [{ name: 'John' }] }, 'users[0].name') // 'John'\n */\nexport function resolvePath(obj: unknown, path: string): unknown {\n if (!path || typeof obj !== 'object' || obj === null) {\n return undefined\n }\n\n const parts = parsePath(path)\n let current: unknown = obj\n\n for (const part of parts) {\n if (current === null || current === undefined) {\n return undefined\n }\n\n if (part.type === 'property') {\n if (typeof current === 'object') {\n current = readProperty(current, part.key)\n } else {\n return undefined\n }\n } else if (part.type === 'index') {\n if (Array.isArray(current)) {\n current = current[part.index]\n } else {\n return undefined\n }\n }\n }\n\n return current\n}\n\n/**\n * Parsed path segment\n */\ntype PathSegment = { type: 'property'; key: string } | { type: 'index'; index: number }\n\n/**\n * Parse a path string into segments\n */\nfunction parsePath(path: string): PathSegment[] {\n const segments: PathSegment[] = []\n // Match property names and array indices: foo, [0], foo[0], foo.bar[1].baz\n //\n // A HYPHEN is a name CHARACTER. With `\\w+` it would be a boundary, and since\n // source ids are hyphenated, `hero-stats.0.text` would split into FOUR\n // segments (`hero`,`stats`,`0`,`text`) instead of three and never resolve.\n // The sibling resolver (surface/expression.ts) accepts hyphenated ids too:\n // its path regex is `/^[\\w\\-.[\\]]+$/`.\n const regex = /([\\w-]+)|\\[(\\d+)\\]/g\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(path)) !== null) {\n if (match[1] !== undefined) {\n // Property name\n segments.push({ type: 'property', key: match[1] })\n } else if (match[2] !== undefined) {\n // Array index\n segments.push({ type: 'index', index: parseInt(match[2], 10) })\n }\n }\n\n return segments\n}\n\n// ============================================================\n// EXPRESSION PARSER — ONE GRAMMAR FOR BOTH EVALUATORS\n// ============================================================\n//\n// This token parser (bindings, computed values) also serves\n// surface/expression.ts (every block prop and every `visibleWhen`). A separate\n// regex/`split` evaluator there would drift in the ways that matter most to\n// generated apps:\n//\n// - the surface one had no parentheses, no arithmetic, no method calls — an\n// expression it could not read came back as the raw `{{…}}` string, which\n// a `visibleWhen` then counted as TRUE, so the block always showed;\n// - it split helper arguments on every comma, so `join(xs, ', ')` joined\n// with `\"\"`.\n//\n// Now there is one tokenizer, one parser producing an AST, and one evaluator.\n// What differs between the two callers is only how a NAME resolves (see\n// `NameResolver`) and two lexical options kept for backward compatibility.\n//\n// STRICT BY DESIGN. An unknown character, an unterminated string, a trailing\n// token or a call to something that is not a helper is an ERROR, not a partial\n// value. The previous parser skipped unknown characters and ignored whatever\n// followed the first complete expression (`5-3` evaluated to 5) — a silent\n// wrong answer is the failure class this exists to end. Callers decide what an\n// error means: a block prop keeps its raw template, a `visibleWhen` hides.\n//\n// `&&`, `||`, `??` and `?:` SHORT-CIRCUIT, because evaluation walks the AST:\n// `isEmpty(x) || x.length > 3` never evaluates the right side when the left\n// already decided.\n\ntype TokenType =\n | 'number'\n | 'string'\n | 'literal'\n | 'identifier'\n | 'operator'\n | 'paren'\n | 'bracket'\n | 'dot'\n | 'comma'\n | 'question'\n | 'colon'\n\ninterface Token {\n type: TokenType\n value: unknown\n raw: string\n}\n\n/** Lexical options — the only grammar differences between the two callers. */\nexport interface ExpressionSyntaxOptions {\n /**\n * `hero-stats-data.0.text` is ONE name. Surface data-source ids are\n * hyphenated, and the surface evaluator always read them as paths, so in\n * that mode a `-` between two name characters with no space around it is\n * part of the name. Subtraction needs spaces there: `a - b`.\n */\n readonly hyphenNames?: boolean\n /** The binding evaluator has always read the literal `undefined` as `null`. */\n readonly undefinedAsNull?: boolean\n}\n\nconst MULTI_OPS = ['===', '!==', '>=', '<=', '==', '!=', '&&', '||', '??'] as const\nconst SINGLE_OPS = new Set(['+', '-', '*', '/', '%', '>', '<', '!'])\n\n/** A token after which a `-` is binary minus, not the sign of a number. */\nfunction endsValue(t: Token | undefined): boolean {\n if (!t) return false\n if (t.type === 'number' || t.type === 'string' || t.type === 'literal' || t.type === 'identifier') return true\n return (t.type === 'paren' && t.value === ')') || (t.type === 'bracket' && t.value === ']')\n}\n\nfunction tokenize(expr: string, opts: ExpressionSyntaxOptions): Token[] {\n const tokens: Token[] = []\n let i = 0\n const nameChar = /[\\w$]/\n\n const readName = (allowLeadingDigit: boolean): string => {\n let name = ''\n while (i < expr.length) {\n const c = expr.charAt(i)\n if (nameChar.test(c)) {\n name += c\n i++\n continue\n }\n // a hyphen joins two name characters (`hero-stats`) in hyphenNames mode\n if (\n opts.hyphenNames &&\n c === '-' &&\n name.length > 0 &&\n /[\\w$]/.test(expr.charAt(i + 1))\n ) {\n name += c\n i++\n continue\n }\n break\n }\n if (!allowLeadingDigit && /^\\d/.test(name)) throw new Error(`Unexpected number in name '${name}'`)\n return name\n }\n\n while (i < expr.length) {\n const ch = expr.charAt(i)\n if (/\\s/.test(ch)) {\n i++\n continue\n }\n const prev = tokens[tokens.length - 1]\n\n // A property name after a dot: digits (`items.0`) and keywords\n // (`item.default`, `row.null`) are names here, never literals.\n if (prev?.type === 'dot' && /[\\w$]/.test(ch)) {\n const name = readName(true)\n tokens.push({ type: 'identifier', value: name, raw: name })\n continue\n }\n\n if (ch === \"'\" || ch === '\"') {\n const quote = ch\n let value = ''\n i++\n let closed = false\n while (i < expr.length) {\n const c = expr.charAt(i)\n if (c === quote) {\n closed = true\n break\n }\n if (c === '\\\\' && i + 1 < expr.length) {\n i++\n const e = expr.charAt(i)\n value += e === 'n' ? '\\n' : e === 't' ? '\\t' : e\n } else {\n value += c\n }\n i++\n }\n if (!closed) throw new Error('Unterminated string literal')\n i++\n tokens.push({ type: 'string', value, raw: `${quote}${value}${quote}` })\n continue\n }\n\n // Numbers. A leading `-` is a sign only where a value cannot end —\n // `5-3` is subtraction, `-3` and `a * -3` are negative literals.\n if (/\\d/.test(ch) || (ch === '-' && /\\d/.test(expr.charAt(i + 1)) && !endsValue(prev))) {\n let num = ''\n if (ch === '-') {\n num = '-'\n i++\n }\n while (i < expr.length && /\\d/.test(expr.charAt(i))) num += expr.charAt(i++)\n if (expr.charAt(i) === '.' && /\\d/.test(expr.charAt(i + 1))) {\n num += expr.charAt(i++)\n while (i < expr.length && /\\d/.test(expr.charAt(i))) num += expr.charAt(i++)\n }\n tokens.push({ type: 'number', value: parseFloat(num), raw: num })\n continue\n }\n\n if (/[a-zA-Z_$]/.test(ch)) {\n const name = readName(false)\n if (name === 'true') tokens.push({ type: 'literal', value: true, raw: name })\n else if (name === 'false') tokens.push({ type: 'literal', value: false, raw: name })\n else if (name === 'null') tokens.push({ type: 'literal', value: null, raw: name })\n else if (name === 'undefined')\n tokens.push({ type: 'literal', value: opts.undefinedAsNull ? null : undefined, raw: name })\n else tokens.push({ type: 'identifier', value: name, raw: name })\n continue\n }\n\n const multi = MULTI_OPS.find((op) => expr.startsWith(op, i))\n if (multi) {\n tokens.push({ type: 'operator', value: multi, raw: multi })\n i += multi.length\n continue\n }\n\n if (SINGLE_OPS.has(ch)) tokens.push({ type: 'operator', value: ch, raw: ch })\n else if (ch === '(' || ch === ')') tokens.push({ type: 'paren', value: ch, raw: ch })\n else if (ch === '[' || ch === ']') tokens.push({ type: 'bracket', value: ch, raw: ch })\n else if (ch === '.') tokens.push({ type: 'dot', value: ch, raw: ch })\n else if (ch === ',') tokens.push({ type: 'comma', value: ch, raw: ch })\n else if (ch === '?') tokens.push({ type: 'question', value: ch, raw: ch })\n else if (ch === ':') tokens.push({ type: 'colon', value: ch, raw: ch })\n else throw new Error(`Unexpected character '${ch}' at ${i}`)\n i++\n }\n\n return tokens\n}\n\n// ---- AST ----------------------------------------------------------------\n\ntype Node =\n | { readonly k: 'lit'; readonly v: unknown }\n | { readonly k: 'name'; readonly name: string }\n | { readonly k: 'member'; readonly obj: Node; readonly prop: string }\n | { readonly k: 'index'; readonly obj: Node; readonly index: Node }\n | { readonly k: 'call'; readonly name: string; readonly args: readonly Node[] }\n | { readonly k: 'method'; readonly obj: Node; readonly name: string; readonly args: readonly Node[] }\n | { readonly k: 'unary'; readonly op: string; readonly arg: Node }\n | { readonly k: 'binary'; readonly op: string; readonly l: Node; readonly r: Node }\n | { readonly k: 'cond'; readonly test: Node; readonly then: Node; readonly else: Node }\n | { readonly k: 'array'; readonly items: readonly Node[] }\n\nconst BINARY_LEVELS: readonly (readonly string[])[] = [\n ['||'],\n ['&&'],\n ['??'],\n ['===', '!==', '==', '!='],\n ['>', '<', '>=', '<='],\n ['+', '-'],\n ['*', '/', '%'],\n]\n\nfunction parse(tokens: readonly Token[]): Node {\n let pos = 0\n const peek = (): Token | undefined => tokens[pos]\n const is = (type: TokenType, value?: unknown): boolean => {\n const t = tokens[pos]\n return t !== undefined && t.type === type && (value === undefined || t.value === value)\n }\n const expect = (type: TokenType, value: unknown, what: string): void => {\n if (!is(type, value)) throw new Error(`Expected ${what}`)\n pos++\n }\n\n const parseArgs = (close: string, closeType: TokenType): Node[] => {\n const args: Node[] = []\n if (is(closeType, close)) {\n pos++\n return args\n }\n for (;;) {\n args.push(parseTernary())\n if (is('comma')) {\n pos++\n continue\n }\n expect(closeType, close, `'${close}'`)\n return args\n }\n }\n\n function parseTernary(): Node {\n const test = parseBinary(0)\n if (!is('question')) return test\n pos++\n const then = parseTernary()\n expect('colon', ':', \"':' in ternary expression\")\n return { k: 'cond', test, then, else: parseTernary() }\n }\n\n function parseBinary(level: number): Node {\n const ops = BINARY_LEVELS[level]\n if (!ops) return parseUnary()\n let left = parseBinary(level + 1)\n for (;;) {\n const t = peek()\n if (!t || t.type !== 'operator' || !ops.includes(t.value as string)) return left\n pos++\n left = { k: 'binary', op: t.value as string, l: left, r: parseBinary(level + 1) }\n }\n }\n\n function parseUnary(): Node {\n if (is('operator', '!') || is('operator', '-') || is('operator', '+')) {\n const op = (tokens[pos++] as Token).value as string\n return { k: 'unary', op, arg: parseUnary() }\n }\n return parsePostfix()\n }\n\n function parsePostfix(): Node {\n let node = parsePrimary()\n for (;;) {\n if (is('dot')) {\n pos++\n const t = peek()\n if (!t || t.type !== 'identifier') throw new Error('Expected property name after .')\n pos++\n const name = t.value as string\n if (is('paren', '(')) {\n pos++\n node = { k: 'method', obj: node, name, args: parseArgs(')', 'paren') }\n } else {\n node = { k: 'member', obj: node, prop: name }\n }\n } else if (is('bracket', '[')) {\n pos++\n const index = parseTernary()\n expect('bracket', ']', \"']'\")\n node = { k: 'index', obj: node, index }\n } else if (is('paren', '(')) {\n throw new Error('Only helpers and safe methods can be called')\n } else {\n return node\n }\n }\n }\n\n function parsePrimary(): Node {\n const t = peek()\n if (!t) throw new Error('Unexpected end of expression')\n if (t.type === 'number' || t.type === 'string' || t.type === 'literal') {\n pos++\n return { k: 'lit', v: t.value }\n }\n if (t.type === 'identifier') {\n pos++\n const name = t.value as string\n if (is('paren', '(')) {\n pos++\n return { k: 'call', name, args: parseArgs(')', 'paren') }\n }\n return { k: 'name', name }\n }\n if (is('paren', '(')) {\n pos++\n const inner = parseTernary()\n expect('paren', ')', \"')'\")\n return inner\n }\n if (is('bracket', '[')) {\n pos++\n return { k: 'array', items: parseArgs(']', 'bracket') }\n }\n throw new Error(`Unexpected token '${t.raw}'`)\n }\n\n const root = parseTernary()\n if (pos < tokens.length) throw new Error(`Unexpected token '${(tokens[pos] as Token).raw}'`)\n return root\n}\n\n/**\n * Parse once, evaluate many times. Block props are re-resolved on every state\n * change, and the same few hundred template strings come through each time.\n */\nconst AST_CACHE_LIMIT = 2000\nconst astCache = new Map<string, Node | Error>()\n\nfunction parseCached(expr: string, opts: ExpressionSyntaxOptions): Node {\n const key = `${opts.hyphenNames ? 'h' : '-'}${opts.undefinedAsNull ? 'n' : '-'}${expr}`\n let hit = astCache.get(key)\n if (hit === undefined) {\n try {\n hit = parse(tokenize(expr, opts))\n } catch (e) {\n hit = e instanceof Error ? e : new Error(String(e))\n }\n if (astCache.size >= AST_CACHE_LIMIT) astCache.clear()\n astCache.set(key, hit)\n }\n if (hit instanceof Error) throw hit\n return hit\n}\n\n// ---- evaluation ---------------------------------------------------------\n\n/**\n * How a bare name and a call resolve. The grammar is shared; the scope is the\n * caller's: bindings see `data` / `state` / `params`, block props see the\n * surface's expression data (`state`, source ids, `item`, `__errors`, …).\n */\nexport interface NameResolver {\n /** The value of a bare name. */\n lookup(name: string): unknown\n /** The helper a call names, or undefined when there is none. */\n helper(name: string): ((...args: unknown[]) => unknown) | undefined\n}\n\n/**\n * Methods that may be called on a value. Pure, allocation-bounded, and\n * nothing that reaches a constructor, a prototype or a function: a template\n * is authored by a model and rendered in a visitor's browser.\n */\nconst STRING_METHODS = new Set([\n 'toLowerCase', 'toUpperCase', 'trim', 'trimStart', 'trimEnd', 'includes', 'startsWith', 'endsWith',\n 'indexOf', 'lastIndexOf', 'slice', 'substring', 'padStart', 'padEnd', 'split', 'replace',\n 'replaceAll', 'charAt', 'at', 'concat', 'repeat', 'toString', 'localeCompare',\n])\nconst ARRAY_METHODS = new Set(['includes', 'indexOf', 'lastIndexOf', 'join', 'slice', 'at', 'concat'])\nconst NUMBER_METHODS = new Set(['toFixed', 'toPrecision', 'toString', 'toLocaleString'])\n\nfunction callMethod(target: unknown, name: string, args: unknown[]): unknown {\n if (target === null || target === undefined) return undefined\n let allowed = false\n if (typeof target === 'string') allowed = STRING_METHODS.has(name)\n else if (Array.isArray(target)) allowed = ARRAY_METHODS.has(name)\n else if (typeof target === 'number') allowed = NUMBER_METHODS.has(name)\n if (!allowed) throw new Error(`Method '${name}' is not supported`)\n // A `repeat`/`padStart` count from data must not allocate without bound.\n if ((name === 'repeat' || name === 'padStart' || name === 'padEnd') && Number(args[0]) > 10_000) {\n throw new Error(`Method '${name}' argument too large`)\n }\n const fn = (target as unknown as Record<string, unknown>)[name] as (...a: unknown[]) => unknown\n return fn.apply(target, args)\n}\n\nfunction readMember(target: unknown, prop: string): unknown {\n if (typeof target === 'string') return prop === 'length' ? target.length : undefined\n if (target !== null && target !== undefined && typeof target === 'object') return readProperty(target, prop)\n return undefined\n}\n\nfunction evalNode(node: Node, scope: NameResolver): unknown {\n switch (node.k) {\n case 'lit':\n return node.v\n case 'name':\n return scope.lookup(node.name)\n case 'member':\n return readMember(evalNode(node.obj, scope), node.prop)\n case 'index': {\n const target = evalNode(node.obj, scope)\n const index = evalNode(node.index, scope)\n if (target === null || target === undefined) return undefined\n if (Array.isArray(target)) return target[index as number]\n if (typeof target === 'object') return (target as Record<string, unknown>)[String(index)]\n return undefined\n }\n case 'call': {\n const fn = scope.helper(node.name)\n if (typeof fn !== 'function') throw new Error(`Unknown helper: ${node.name}`)\n return fn(...node.args.map((a) => evalNode(a, scope)))\n }\n case 'method':\n return callMethod(\n evalNode(node.obj, scope),\n node.name,\n node.args.map((a) => evalNode(a, scope))\n )\n case 'unary': {\n const v = evalNode(node.arg, scope)\n if (node.op === '!') return !v\n if (node.op === '-') return -(v as number)\n return +(v as number)\n }\n case 'cond':\n return evalNode(node.test, scope) ? evalNode(node.then, scope) : evalNode(node.else, scope)\n case 'array':\n return node.items.map((n) => evalNode(n, scope))\n case 'binary': {\n // short-circuiting operators first — the right side may never run\n if (node.op === '&&') {\n const l = evalNode(node.l, scope)\n return l ? evalNode(node.r, scope) : l\n }\n if (node.op === '||') {\n const l = evalNode(node.l, scope)\n return l ? l : evalNode(node.r, scope)\n }\n if (node.op === '??') {\n const l = evalNode(node.l, scope)\n return l ?? evalNode(node.r, scope)\n }\n const l = evalNode(node.l, scope)\n const r = evalNode(node.r, scope)\n switch (node.op) {\n case '===': return l === r\n case '!==': return l !== r\n case '==': return l == r\n case '!=': return l != r\n case '>': return (l as number) > (r as number)\n case '<': return (l as number) < (r as number)\n case '>=': return (l as number) >= (r as number)\n case '<=': return (l as number) <= (r as number)\n case '+':\n return typeof l === 'string' || typeof r === 'string'\n ? String(l) + String(r)\n : (l as number) + (r as number)\n case '-': return (l as number) - (r as number)\n case '*': return (l as number) * (r as number)\n case '/': return (l as number) / (r as number)\n case '%': return (l as number) % (r as number)\n }\n throw new Error(`Unknown operator ${node.op}`)\n }\n }\n}\n\n/**\n * Evaluate one expression (the text between `{{` and `}}`) against a scope.\n * Throws on a syntax error, an unknown helper or an unsupported method — the\n * two public evaluators turn that into `{ success: false }`.\n */\nexport function evaluateWithScope(\n expression: string,\n scope: NameResolver,\n opts: ExpressionSyntaxOptions = {}\n): unknown {\n const trimmed = expression.trim()\n if (!trimmed) return undefined\n return evalNode(parseCached(trimmed, opts), scope)\n}\n\n// ============================================================\n// EXPRESSION EVALUATOR IMPLEMENTATION\n// ============================================================\n\n/**\n * Evaluate an expression with full context support\n */\nexport function evaluateExpression(\n expression: string,\n context: BindingExpressionContext\n): ExpressionEvalResult {\n try {\n const helpers = context.helpers\n const scope: NameResolver = {\n lookup(name) {\n if (name === 'data') return context.data\n if (name === 'state') return context.state\n if (name === 'params') return context.params\n // A helper named bare (without a call) has always resolved to the\n // function itself here; kept.\n if (helpers && Object.prototype.hasOwnProperty.call(helpers, name)) return helpers[name]\n // Shorthand access. Priority: params > state > data (most specific first)\n if (name in context.params) return context.params[name]\n if (name in context.state) return context.state[name]\n if (name in context.data) return context.data[name]\n return undefined\n },\n helper: (name) => (helpers && Object.prototype.hasOwnProperty.call(helpers, name) ? helpers[name] : undefined),\n }\n return { success: true, value: evaluateWithScope(expression, scope, { undefinedAsNull: true }) }\n } catch (e) {\n return { success: false, error: `Expression error: ${e}` }\n }\n}\n\n// ============================================================\n// DEPENDENCY EXTRACTION\n// ============================================================\n\n/**\n * Extract dependencies from an expression for reactive updates\n */\nexport function extractDependencies(expression: string): ExpressionDependency[] {\n const dependencies: ExpressionDependency[] = []\n const seen = new Set<string>()\n\n // Match patterns like: data.foo.bar, state.count, params.id\n // Also match shorthand: foo.bar (when referring to data/state/params root)\n const patterns = [\n /\\bdata\\.(\\w+(?:\\.\\w+|\\[\\d+\\])*)/g,\n /\\bstate\\.(\\w+(?:\\.\\w+|\\[\\d+\\])*)/g,\n /\\bparams\\.(\\w+(?:\\.\\w+|\\[\\d+\\])*)/g,\n ]\n\n const sources: readonly ('data' | 'state' | 'params')[] = ['data', 'state', 'params']\n\n for (let i = 0; i < patterns.length; i++) {\n const pattern = patterns[i]\n const source = sources[i]\n if (!pattern || !source) continue\n\n let match: RegExpExecArray | null\n\n while ((match = pattern.exec(expression)) !== null) {\n const path = match[1]\n if (path === undefined) continue\n const key = `${source}.${path}`\n if (!seen.has(key)) {\n seen.add(key)\n dependencies.push({ source, path })\n }\n }\n }\n\n return dependencies\n}\n\n// ============================================================\n// INTERPOLATION\n// ============================================================\n\n/**\n * Check if a value contains expression syntax\n */\nexport function isExpression(value: unknown): boolean {\n if (typeof value !== 'string') return false\n return /\\{\\{.+?\\}\\}/.test(value)\n}\n\n/**\n * Interpolate expressions within a template string\n *\n * @example\n * interpolate('Hello, {{user.name}}!', context) // 'Hello, John!'\n * interpolate('Total: {{price * quantity}}', context) // 'Total: 100'\n */\nexport function interpolate(template: string, context: BindingExpressionContext): string {\n const pattern = /\\{\\{(.+?)\\}\\}/g\n return template.replace(pattern, (_, expr: string) => {\n const result = evaluateExpression(expr.trim(), context)\n if (result.success) {\n return String(result.value ?? '')\n }\n return ''\n })\n}\n\n// ============================================================\n// DEFAULT HELPERS\n// ============================================================\n\n/**\n * Default helper functions for expressions\n */\nexport const DEFAULT_BINDING_HELPERS: Record<string, (...args: unknown[]) => unknown> = {\n // String helpers\n upper: (s: unknown) => String(s).toUpperCase(),\n lower: (s: unknown) => String(s).toLowerCase(),\n trim: (s: unknown) => String(s).trim(),\n capitalize: (s: unknown) => {\n const str = String(s)\n return str.charAt(0).toUpperCase() + str.slice(1)\n },\n concat: (...args: unknown[]) => args.map(String).join(''),\n\n // Number helpers\n round: (n: unknown, decimals?: unknown) => {\n const num = Number(n)\n const d = Number(decimals ?? 0)\n return Math.round(num * Math.pow(10, d)) / Math.pow(10, d)\n },\n floor: (n: unknown) => Math.floor(Number(n)),\n ceil: (n: unknown) => Math.ceil(Number(n)),\n abs: (n: unknown) => Math.abs(Number(n)),\n min: (...args: unknown[]) => Math.min(...args.map(Number)),\n max: (...args: unknown[]) => Math.max(...args.map(Number)),\n /**\n * How many pages `total` rows fill at `size` per page — `ceil(total / size)`,\n * but SAFE: a missing, non-numeric, zero or negative total or size gives 0,\n * never `NaN` or `Infinity` (the envelope is absent until the first fetch\n * lands). Pair with `__meta.<source>.total` on a `returns` source:\n * `{{pages(__meta.products.total, 20)}}`. Wrap in `max(1, …)` for a pager\n * that should read \"1 / 1\" on an empty list.\n */\n pages: (total: unknown, size: unknown) => {\n const t = Number(total)\n const s = Number(size)\n if (!Number.isFinite(t) || !Number.isFinite(s) || t <= 0 || s <= 0) return 0\n return Math.ceil(t / s)\n },\n\n // Aggregate helpers — one data source, several KPI figures. Without these a\n // KPI strip needed one source (one fetch) per number. Filtering stays the\n // data layer's job (EntityQuery.filter); these only fold what is already\n // fetched.\n sumBy: (items: unknown, field?: unknown) => {\n if (!Array.isArray(items)) return 0\n const f = field === undefined ? undefined : String(field)\n return items.reduce<number>((acc, it) => {\n const v = f === undefined ? it : (it as Record<string, unknown> | null)?.[f]\n const n = Number(v)\n return Number.isFinite(n) ? acc + n : acc\n }, 0)\n },\n groupCount: (items: unknown, field: unknown) => {\n const out: Record<string, number> = {}\n if (!Array.isArray(items)) return out\n const f = String(field)\n for (const it of items) {\n const v = (it as Record<string, unknown> | null)?.[f]\n const key = v === null || v === undefined || v === '' ? 'unknown' : String(v)\n out[key] = (out[key] ?? 0) + 1\n }\n return out\n },\n\n // Array helpers\n length: (arr: unknown) => (Array.isArray(arr) ? arr.length : String(arr).length),\n first: (arr: unknown) => (Array.isArray(arr) ? arr[0] : undefined),\n last: (arr: unknown) => (Array.isArray(arr) ? arr[arr.length - 1] : undefined),\n join: (arr: unknown, sep?: unknown) =>\n Array.isArray(arr) ? arr.join(String(sep ?? ',')) : String(arr),\n includes: (arr: unknown, item: unknown) =>\n Array.isArray(arr) ? arr.includes(item) : String(arr).includes(String(item)),\n slice: (arr: unknown, start?: unknown, end?: unknown) => {\n if (Array.isArray(arr)) {\n return arr.slice(\n start !== undefined ? Number(start) : undefined,\n end !== undefined ? Number(end) : undefined\n )\n }\n return String(arr).slice(\n start !== undefined ? Number(start) : undefined,\n end !== undefined ? Number(end) : undefined\n )\n },\n\n // Type checks\n isEmpty: (v: unknown) =>\n v === null ||\n v === undefined ||\n v === '' ||\n (Array.isArray(v) && v.length === 0) ||\n (typeof v === 'object' && Object.keys(v).length === 0),\n isNotEmpty: (v: unknown) =>\n v !== null && v !== undefined && v !== '' && !(Array.isArray(v) && v.length === 0),\n isArray: (v: unknown) => Array.isArray(v),\n isString: (v: unknown) => typeof v === 'string',\n isNumber: (v: unknown) => typeof v === 'number' && !isNaN(v),\n isBoolean: (v: unknown) => typeof v === 'boolean',\n isNull: (v: unknown) => v === null || v === undefined,\n\n // Object helpers\n keys: (obj: unknown) => (typeof obj === 'object' && obj !== null ? Object.keys(obj) : []),\n values: (obj: unknown) => (typeof obj === 'object' && obj !== null ? Object.values(obj) : []),\n\n // Formatting helpers\n json: (v: unknown) => JSON.stringify(v),\n /**\n * Today's date in the visitor's time zone, as `YYYY-MM-DD`.\n * The shape date fields are stored in, so it compares as a string:\n * `{{event.date >= today()}}` for \"upcoming\", `today(-7)` for a week ago.\n * The optional argument shifts by whole days. Before this an \"upcoming\"\n * filter had nothing to compare against and a page hard-coded a date.\n */\n today: (offsetDays?: unknown) => {\n const d = new Date()\n const shift = Number(offsetDays ?? 0)\n if (Number.isFinite(shift) && shift !== 0) d.setDate(d.getDate() + Math.trunc(shift))\n const mm = String(d.getMonth() + 1).padStart(2, '0')\n const dd = String(d.getDate()).padStart(2, '0')\n return `${d.getFullYear()}-${mm}-${dd}`\n },\n date: (v: unknown) => new Date(v as string | number).toLocaleDateString(),\n time: (v: unknown) => new Date(v as string | number).toLocaleTimeString(),\n datetime: (v: unknown) => new Date(v as string | number).toLocaleString(),\n currency: (v: unknown, currency?: unknown, locale?: unknown) => {\n const num = Number(v)\n return new Intl.NumberFormat(String(locale ?? 'en-US'), {\n style: 'currency',\n currency: String(currency ?? 'USD'),\n }).format(num)\n },\n percent: (v: unknown, decimals?: unknown) => {\n const num = Number(v)\n const d = Number(decimals ?? 0)\n return `${(num * 100).toFixed(d)}%`\n },\n}\n\n// ============================================================\n// EXPRESSION EVALUATOR FACTORY\n// ============================================================\n\n/**\n * Create an expression evaluator with context and helpers\n */\nexport function createExpressionEvaluator(\n additionalHelpers?: Record<string, (...args: unknown[]) => unknown>\n): ExpressionEvaluator {\n const helpers = { ...DEFAULT_BINDING_HELPERS, ...additionalHelpers }\n\n return {\n evaluate(expression: string, context: BindingExpressionContext): unknown {\n const result = evaluateExpression(expression, {\n ...context,\n helpers: { ...helpers, ...context.helpers },\n })\n if (result.success) {\n return result.value\n }\n throw new Error(result.error)\n },\n\n isExpression,\n\n extractDependencies,\n\n interpolate(template: string, context: BindingExpressionContext): string {\n return interpolate(template, {\n ...context,\n helpers: { ...helpers, ...context.helpers },\n })\n },\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../src/binding/expression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkEH,+DAA+D;AAC/D,kBAAkB;AAClB,+DAA+D;AAE/D;;;;;;;;;;;;;;;;GAgBG;AACH,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O,EAAE;aAC5C,CAAC,CAAA;YACF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,MAAM,CAAC,KAAK,CAAA;YACrB,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC/B,CAAC;QAED,YAAY;QAEZ,mBAAmB;QAEnB,WAAW,CAAC,QAAgB,EAAE,OAAiC;YAC7D,OAAO,WAAW,CAAC,QAAQ,EAAE;gBAC3B,GAAG,OAAO;gBACV,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE;aAC5C,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["/**\n * Expression Evaluator for Data Binding\n *\n * Enhanced expression evaluation for data binding in surfaces\n *\n * This module extends the base expression evaluator with:\n * - Arithmetic operations (+, -, *, /, %)\n * - Data/state/params context separation\n * - Dependency extraction for reactive updates\n * - Safe null-coalescing operators\n *\n * @module @pwfabric/runtime/binding/expression\n */\n\n// ============================================================\n// EXPRESSION CONTEXT\n// ============================================================\n\n/**\n * Context for expression evaluation in data binding\n */\nexport interface BindingExpressionContext {\n /** Data from data sources */\n readonly data: Record<string, unknown>\n /** State from state stores */\n readonly state: Record<string, unknown>\n /** URL/route parameters */\n readonly params: Record<string, unknown>\n /** Custom helper functions */\n readonly helpers?: Record<string, (...args: unknown[]) => unknown>\n}\n\n/**\n * Result of expression evaluation\n */\nexport type ExpressionEvalResult<T = unknown> =\n | { readonly success: true; readonly value: T }\n | { readonly success: false; readonly error: string }\n\n// ============================================================\n// EXPRESSION EVALUATOR INTERFACE\n// ============================================================\n\n/**\n * Expression evaluator interface for data binding\n */\nexport interface ExpressionEvaluator {\n /**\n * Evaluate an expression in the given context\n */\n evaluate(expression: string, context: BindingExpressionContext): unknown\n\n /**\n * Check if a value is an expression (contains {{...}})\n */\n isExpression(value: unknown): boolean\n\n /**\n * Extract dependencies from an expression for reactive updates\n */\n extractDependencies(expression: string): ExpressionDependency[]\n\n /**\n * Interpolate expressions in a template string\n */\n interpolate(template: string, context: BindingExpressionContext): string\n}\n\n/**\n * Dependency extracted from an expression\n */\nexport interface ExpressionDependency {\n /** The source of the dependency */\n readonly source: 'data' | 'state' | 'params'\n /** The path within the source */\n readonly path: string\n}\n\n// ============================================================\n// PATH RESOLUTION\n// ============================================================\n\n/**\n * Read one named property off a value, stepping into a list of one record.\n *\n * A LIST SOURCE ALWAYS BINDS AS A LIST (DataBoundSurfaceRenderer): a `rest`,\n * `entity` or `graphql` source answering with ONE object is bound as `[obj]`,\n * so `{{src[0].field}}` and `{{src.length}}` behave the same whatever the\n * endpoint returned. But a detail page is authored as `{{product.title}}`, and\n * a property read on an array finds nothing — such a page would render blank\n * (`{{rows.name}}` → empty while `{{rows[0].name}}` → \"banana\").\n *\n * So: when the value is an array of EXACTLY ONE element and the array itself\n * does not carry the key (not `length`, not an index, not an array method),\n * the read continues into that one element. A list of two or more is a list —\n * its `.title` stays undefined, as it always was. Both evaluators (this one\n * and surface/expression) read properties through here, so a path means the\n * same thing in a binding and in a block prop.\n */\nexport function readProperty(target: unknown, key: string): unknown {\n if (target === null || target === undefined || typeof target !== 'object') return undefined\n if (Array.isArray(target) && target.length === 1 && !(key in target)) {\n const only: unknown = target[0]\n return only !== null && typeof only === 'object'\n ? (only as Record<string, unknown>)[key]\n : undefined\n }\n return (target as Record<string, unknown>)[key]\n}\n\n/**\n * Resolve a dotted path in an object, handling nested properties and array indices\n *\n * @example\n * resolvePath({ user: { name: 'John' } }, 'user.name') // 'John'\n * resolvePath({ items: ['a', 'b'] }, 'items[0]') // 'a'\n * resolvePath({ users: [{ name: 'John' }] }, 'users[0].name') // 'John'\n */\nexport function resolvePath(obj: unknown, path: string): unknown {\n if (!path || typeof obj !== 'object' || obj === null) {\n return undefined\n }\n\n const parts = parsePath(path)\n let current: unknown = obj\n\n for (const part of parts) {\n if (current === null || current === undefined) {\n return undefined\n }\n\n if (part.type === 'property') {\n if (typeof current === 'object') {\n current = readProperty(current, part.key)\n } else {\n return undefined\n }\n } else if (part.type === 'index') {\n if (Array.isArray(current)) {\n current = current[part.index]\n } else {\n return undefined\n }\n }\n }\n\n return current\n}\n\n/**\n * Parsed path segment\n */\ntype PathSegment = { type: 'property'; key: string } | { type: 'index'; index: number }\n\n/**\n * Parse a path string into segments\n */\nfunction parsePath(path: string): PathSegment[] {\n const segments: PathSegment[] = []\n // Match property names and array indices: foo, [0], foo[0], foo.bar[1].baz\n //\n // A HYPHEN is a name CHARACTER. With `\\w+` it would be a boundary, and since\n // source ids are hyphenated, `hero-stats.0.text` would split into FOUR\n // segments (`hero`,`stats`,`0`,`text`) instead of three and never resolve.\n // The sibling resolver (surface/expression.ts) accepts hyphenated ids too:\n // its path regex is `/^[\\w\\-.[\\]]+$/`.\n const regex = /([\\w-]+)|\\[(\\d+)\\]/g\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(path)) !== null) {\n if (match[1] !== undefined) {\n // Property name\n segments.push({ type: 'property', key: match[1] })\n } else if (match[2] !== undefined) {\n // Array index\n segments.push({ type: 'index', index: parseInt(match[2], 10) })\n }\n }\n\n return segments\n}\n\n// ============================================================\n// EXPRESSION PARSER — ONE GRAMMAR FOR BOTH EVALUATORS\n// ============================================================\n//\n// This token parser (bindings, computed values) also serves\n// surface/expression.ts (every block prop and every `visibleWhen`). A separate\n// regex/`split` evaluator there would drift in the ways that matter most to\n// generated apps:\n//\n// - the surface one had no parentheses, no arithmetic, no method calls — an\n// expression it could not read came back as the raw `{{…}}` string, which\n// a `visibleWhen` then counted as TRUE, so the block always showed;\n// - it split helper arguments on every comma, so `join(xs, ', ')` joined\n// with `\"\"`.\n//\n// Now there is one tokenizer, one parser producing an AST, and one evaluator.\n// What differs between the two callers is only how a NAME resolves (see\n// `NameResolver`) and two lexical options kept for backward compatibility.\n//\n// STRICT BY DESIGN. An unknown character, an unterminated string, a trailing\n// token or a call to something that is not a helper is an ERROR, not a partial\n// value. The previous parser skipped unknown characters and ignored whatever\n// followed the first complete expression (`5-3` evaluated to 5) — a silent\n// wrong answer is the failure class this exists to end. Callers decide what an\n// error means: a block prop keeps its raw template, a `visibleWhen` hides.\n//\n// `&&`, `||`, `??` and `?:` SHORT-CIRCUIT, because evaluation walks the AST:\n// `isEmpty(x) || x.length > 3` never evaluates the right side when the left\n// already decided.\n\ntype TokenType =\n | 'number'\n | 'string'\n | 'literal'\n | 'identifier'\n | 'operator'\n | 'paren'\n | 'bracket'\n | 'dot'\n | 'comma'\n | 'question'\n | 'colon'\n\ninterface Token {\n type: TokenType\n value: unknown\n raw: string\n}\n\n/** Lexical options — the only grammar differences between the two callers. */\nexport interface ExpressionSyntaxOptions {\n /**\n * `hero-stats-data.0.text` is ONE name. Surface data-source ids are\n * hyphenated, and the surface evaluator always read them as paths, so in\n * that mode a `-` between two name characters with no space around it is\n * part of the name. Subtraction needs spaces there: `a - b`.\n */\n readonly hyphenNames?: boolean\n /** The binding evaluator has always read the literal `undefined` as `null`. */\n readonly undefinedAsNull?: boolean\n}\n\nconst MULTI_OPS = ['===', '!==', '>=', '<=', '==', '!=', '&&', '||', '??'] as const\nconst SINGLE_OPS = new Set(['+', '-', '*', '/', '%', '>', '<', '!'])\n\n/** A token after which a `-` is binary minus, not the sign of a number. */\nfunction endsValue(t: Token | undefined): boolean {\n if (!t) return false\n if (t.type === 'number' || t.type === 'string' || t.type === 'literal' || t.type === 'identifier') return true\n return (t.type === 'paren' && t.value === ')') || (t.type === 'bracket' && t.value === ']')\n}\n\nfunction tokenize(expr: string, opts: ExpressionSyntaxOptions): Token[] {\n const tokens: Token[] = []\n let i = 0\n const nameChar = /[\\w$]/\n\n const readName = (allowLeadingDigit: boolean): string => {\n let name = ''\n while (i < expr.length) {\n const c = expr.charAt(i)\n if (nameChar.test(c)) {\n name += c\n i++\n continue\n }\n // a hyphen joins two name characters (`hero-stats`) in hyphenNames mode\n if (\n opts.hyphenNames &&\n c === '-' &&\n name.length > 0 &&\n /[\\w$]/.test(expr.charAt(i + 1))\n ) {\n name += c\n i++\n continue\n }\n break\n }\n if (!allowLeadingDigit && /^\\d/.test(name)) throw new Error(`Unexpected number in name '${name}'`)\n return name\n }\n\n while (i < expr.length) {\n const ch = expr.charAt(i)\n if (/\\s/.test(ch)) {\n i++\n continue\n }\n const prev = tokens[tokens.length - 1]\n\n // A property name after a dot: digits (`items.0`) and keywords\n // (`item.default`, `row.null`) are names here, never literals.\n if (prev?.type === 'dot' && /[\\w$]/.test(ch)) {\n const name = readName(true)\n tokens.push({ type: 'identifier', value: name, raw: name })\n continue\n }\n\n if (ch === \"'\" || ch === '\"') {\n const quote = ch\n let value = ''\n i++\n let closed = false\n while (i < expr.length) {\n const c = expr.charAt(i)\n if (c === quote) {\n closed = true\n break\n }\n if (c === '\\\\' && i + 1 < expr.length) {\n i++\n const e = expr.charAt(i)\n value += e === 'n' ? '\\n' : e === 't' ? '\\t' : e\n } else {\n value += c\n }\n i++\n }\n if (!closed) throw new Error('Unterminated string literal')\n i++\n tokens.push({ type: 'string', value, raw: `${quote}${value}${quote}` })\n continue\n }\n\n // Numbers. A leading `-` is a sign only where a value cannot end —\n // `5-3` is subtraction, `-3` and `a * -3` are negative literals.\n if (/\\d/.test(ch) || (ch === '-' && /\\d/.test(expr.charAt(i + 1)) && !endsValue(prev))) {\n let num = ''\n if (ch === '-') {\n num = '-'\n i++\n }\n while (i < expr.length && /\\d/.test(expr.charAt(i))) num += expr.charAt(i++)\n if (expr.charAt(i) === '.' && /\\d/.test(expr.charAt(i + 1))) {\n num += expr.charAt(i++)\n while (i < expr.length && /\\d/.test(expr.charAt(i))) num += expr.charAt(i++)\n }\n tokens.push({ type: 'number', value: parseFloat(num), raw: num })\n continue\n }\n\n if (/[a-zA-Z_$]/.test(ch)) {\n const name = readName(false)\n if (name === 'true') tokens.push({ type: 'literal', value: true, raw: name })\n else if (name === 'false') tokens.push({ type: 'literal', value: false, raw: name })\n else if (name === 'null') tokens.push({ type: 'literal', value: null, raw: name })\n else if (name === 'undefined')\n tokens.push({ type: 'literal', value: opts.undefinedAsNull ? null : undefined, raw: name })\n else tokens.push({ type: 'identifier', value: name, raw: name })\n continue\n }\n\n const multi = MULTI_OPS.find((op) => expr.startsWith(op, i))\n if (multi) {\n tokens.push({ type: 'operator', value: multi, raw: multi })\n i += multi.length\n continue\n }\n\n if (SINGLE_OPS.has(ch)) tokens.push({ type: 'operator', value: ch, raw: ch })\n else if (ch === '(' || ch === ')') tokens.push({ type: 'paren', value: ch, raw: ch })\n else if (ch === '[' || ch === ']') tokens.push({ type: 'bracket', value: ch, raw: ch })\n else if (ch === '.') tokens.push({ type: 'dot', value: ch, raw: ch })\n else if (ch === ',') tokens.push({ type: 'comma', value: ch, raw: ch })\n else if (ch === '?') tokens.push({ type: 'question', value: ch, raw: ch })\n else if (ch === ':') tokens.push({ type: 'colon', value: ch, raw: ch })\n else throw new Error(`Unexpected character '${ch}' at ${i}`)\n i++\n }\n\n return tokens\n}\n\n// ---- AST ----------------------------------------------------------------\n\ntype Node =\n | { readonly k: 'lit'; readonly v: unknown }\n | { readonly k: 'name'; readonly name: string }\n | { readonly k: 'member'; readonly obj: Node; readonly prop: string }\n | { readonly k: 'index'; readonly obj: Node; readonly index: Node }\n | { readonly k: 'call'; readonly name: string; readonly args: readonly Node[] }\n | { readonly k: 'method'; readonly obj: Node; readonly name: string; readonly args: readonly Node[] }\n | { readonly k: 'unary'; readonly op: string; readonly arg: Node }\n | { readonly k: 'binary'; readonly op: string; readonly l: Node; readonly r: Node }\n | { readonly k: 'cond'; readonly test: Node; readonly then: Node; readonly else: Node }\n | { readonly k: 'array'; readonly items: readonly Node[] }\n\nconst BINARY_LEVELS: readonly (readonly string[])[] = [\n ['||'],\n ['&&'],\n ['??'],\n ['===', '!==', '==', '!='],\n ['>', '<', '>=', '<='],\n ['+', '-'],\n ['*', '/', '%'],\n]\n\nfunction parse(tokens: readonly Token[]): Node {\n let pos = 0\n const peek = (): Token | undefined => tokens[pos]\n const is = (type: TokenType, value?: unknown): boolean => {\n const t = tokens[pos]\n return t !== undefined && t.type === type && (value === undefined || t.value === value)\n }\n const expect = (type: TokenType, value: unknown, what: string): void => {\n if (!is(type, value)) throw new Error(`Expected ${what}`)\n pos++\n }\n\n const parseArgs = (close: string, closeType: TokenType): Node[] => {\n const args: Node[] = []\n if (is(closeType, close)) {\n pos++\n return args\n }\n for (;;) {\n args.push(parseTernary())\n if (is('comma')) {\n pos++\n continue\n }\n expect(closeType, close, `'${close}'`)\n return args\n }\n }\n\n function parseTernary(): Node {\n const test = parseBinary(0)\n if (!is('question')) return test\n pos++\n const then = parseTernary()\n expect('colon', ':', \"':' in ternary expression\")\n return { k: 'cond', test, then, else: parseTernary() }\n }\n\n function parseBinary(level: number): Node {\n const ops = BINARY_LEVELS[level]\n if (!ops) return parseUnary()\n let left = parseBinary(level + 1)\n for (;;) {\n const t = peek()\n if (!t || t.type !== 'operator' || !ops.includes(t.value as string)) return left\n pos++\n left = { k: 'binary', op: t.value as string, l: left, r: parseBinary(level + 1) }\n }\n }\n\n function parseUnary(): Node {\n if (is('operator', '!') || is('operator', '-') || is('operator', '+')) {\n const op = (tokens[pos++] as Token).value as string\n return { k: 'unary', op, arg: parseUnary() }\n }\n return parsePostfix()\n }\n\n function parsePostfix(): Node {\n let node = parsePrimary()\n for (;;) {\n if (is('dot')) {\n pos++\n const t = peek()\n if (!t || t.type !== 'identifier') throw new Error('Expected property name after .')\n pos++\n const name = t.value as string\n if (is('paren', '(')) {\n pos++\n node = { k: 'method', obj: node, name, args: parseArgs(')', 'paren') }\n } else {\n node = { k: 'member', obj: node, prop: name }\n }\n } else if (is('bracket', '[')) {\n pos++\n const index = parseTernary()\n expect('bracket', ']', \"']'\")\n node = { k: 'index', obj: node, index }\n } else if (is('paren', '(')) {\n throw new Error('Only helpers and safe methods can be called')\n } else {\n return node\n }\n }\n }\n\n function parsePrimary(): Node {\n const t = peek()\n if (!t) throw new Error('Unexpected end of expression')\n if (t.type === 'number' || t.type === 'string' || t.type === 'literal') {\n pos++\n return { k: 'lit', v: t.value }\n }\n if (t.type === 'identifier') {\n pos++\n const name = t.value as string\n if (is('paren', '(')) {\n pos++\n return { k: 'call', name, args: parseArgs(')', 'paren') }\n }\n return { k: 'name', name }\n }\n if (is('paren', '(')) {\n pos++\n const inner = parseTernary()\n expect('paren', ')', \"')'\")\n return inner\n }\n if (is('bracket', '[')) {\n pos++\n return { k: 'array', items: parseArgs(']', 'bracket') }\n }\n throw new Error(`Unexpected token '${t.raw}'`)\n }\n\n const root = parseTernary()\n if (pos < tokens.length) throw new Error(`Unexpected token '${(tokens[pos] as Token).raw}'`)\n return root\n}\n\n/**\n * Parse once, evaluate many times. Block props are re-resolved on every state\n * change, and the same few hundred template strings come through each time.\n */\nconst AST_CACHE_LIMIT = 2000\nconst astCache = new Map<string, Node | Error>()\n\nfunction parseCached(expr: string, opts: ExpressionSyntaxOptions): Node {\n const key = `${opts.hyphenNames ? 'h' : '-'}${opts.undefinedAsNull ? 'n' : '-'}${expr}`\n let hit = astCache.get(key)\n if (hit === undefined) {\n try {\n hit = parse(tokenize(expr, opts))\n } catch (e) {\n hit = e instanceof Error ? e : new Error(String(e))\n }\n if (astCache.size >= AST_CACHE_LIMIT) astCache.clear()\n astCache.set(key, hit)\n }\n if (hit instanceof Error) throw hit\n return hit\n}\n\n// ---- evaluation ---------------------------------------------------------\n\n/**\n * How a bare name and a call resolve. The grammar is shared; the scope is the\n * caller's: bindings see `data` / `state` / `params`, block props see the\n * surface's expression data (`state`, source ids, `item`, `__errors`, …).\n */\nexport interface NameResolver {\n /** The value of a bare name. */\n lookup(name: string): unknown\n /** The helper a call names, or undefined when there is none. */\n helper(name: string): ((...args: unknown[]) => unknown) | undefined\n}\n\n/**\n * Methods that may be called on a value. Pure, allocation-bounded, and\n * nothing that reaches a constructor, a prototype or a function: a template\n * is authored by a model and rendered in a visitor's browser.\n */\nconst STRING_METHODS = new Set([\n 'toLowerCase', 'toUpperCase', 'trim', 'trimStart', 'trimEnd', 'includes', 'startsWith', 'endsWith',\n 'indexOf', 'lastIndexOf', 'slice', 'substring', 'padStart', 'padEnd', 'split', 'replace',\n 'replaceAll', 'charAt', 'at', 'concat', 'repeat', 'toString', 'localeCompare',\n])\nconst ARRAY_METHODS = new Set(['includes', 'indexOf', 'lastIndexOf', 'join', 'slice', 'at', 'concat'])\nconst NUMBER_METHODS = new Set(['toFixed', 'toPrecision', 'toString', 'toLocaleString'])\n\nfunction callMethod(target: unknown, name: string, args: unknown[]): unknown {\n if (target === null || target === undefined) return undefined\n let allowed = false\n if (typeof target === 'string') allowed = STRING_METHODS.has(name)\n else if (Array.isArray(target)) allowed = ARRAY_METHODS.has(name)\n else if (typeof target === 'number') allowed = NUMBER_METHODS.has(name)\n if (!allowed) throw new Error(`Method '${name}' is not supported`)\n // A `repeat`/`padStart` count from data must not allocate without bound.\n if ((name === 'repeat' || name === 'padStart' || name === 'padEnd') && Number(args[0]) > 10_000) {\n throw new Error(`Method '${name}' argument too large`)\n }\n const fn = (target as unknown as Record<string, unknown>)[name] as (...a: unknown[]) => unknown\n return fn.apply(target, args)\n}\n\nfunction readMember(target: unknown, prop: string): unknown {\n if (typeof target === 'string') return prop === 'length' ? target.length : undefined\n if (target !== null && target !== undefined && typeof target === 'object') return readProperty(target, prop)\n return undefined\n}\n\nfunction evalNode(node: Node, scope: NameResolver): unknown {\n switch (node.k) {\n case 'lit':\n return node.v\n case 'name':\n return scope.lookup(node.name)\n case 'member':\n return readMember(evalNode(node.obj, scope), node.prop)\n case 'index': {\n const target = evalNode(node.obj, scope)\n const index = evalNode(node.index, scope)\n if (target === null || target === undefined) return undefined\n if (Array.isArray(target)) return target[index as number]\n if (typeof target === 'object') return (target as Record<string, unknown>)[String(index)]\n return undefined\n }\n case 'call': {\n const fn = scope.helper(node.name)\n if (typeof fn !== 'function') throw new Error(`Unknown helper: ${node.name}`)\n return fn(...node.args.map((a) => evalNode(a, scope)))\n }\n case 'method':\n return callMethod(\n evalNode(node.obj, scope),\n node.name,\n node.args.map((a) => evalNode(a, scope))\n )\n case 'unary': {\n const v = evalNode(node.arg, scope)\n if (node.op === '!') return !v\n if (node.op === '-') return -(v as number)\n return +(v as number)\n }\n case 'cond':\n return evalNode(node.test, scope) ? evalNode(node.then, scope) : evalNode(node.else, scope)\n case 'array':\n return node.items.map((n) => evalNode(n, scope))\n case 'binary': {\n // short-circuiting operators first — the right side may never run\n if (node.op === '&&') {\n const l = evalNode(node.l, scope)\n return l ? evalNode(node.r, scope) : l\n }\n if (node.op === '||') {\n const l = evalNode(node.l, scope)\n return l ? l : evalNode(node.r, scope)\n }\n if (node.op === '??') {\n const l = evalNode(node.l, scope)\n return l ?? evalNode(node.r, scope)\n }\n const l = evalNode(node.l, scope)\n const r = evalNode(node.r, scope)\n switch (node.op) {\n case '===': return l === r\n case '!==': return l !== r\n case '==': return l == r\n case '!=': return l != r\n case '>': return (l as number) > (r as number)\n case '<': return (l as number) < (r as number)\n case '>=': return (l as number) >= (r as number)\n case '<=': return (l as number) <= (r as number)\n case '+':\n return typeof l === 'string' || typeof r === 'string'\n ? String(l) + String(r)\n : (l as number) + (r as number)\n case '-': return (l as number) - (r as number)\n case '*': return (l as number) * (r as number)\n case '/': return (l as number) / (r as number)\n case '%': return (l as number) % (r as number)\n }\n throw new Error(`Unknown operator ${node.op}`)\n }\n }\n}\n\n/**\n * Evaluate one expression (the text between `{{` and `}}`) against a scope.\n * Throws on a syntax error, an unknown helper or an unsupported method — the\n * two public evaluators turn that into `{ success: false }`.\n */\nexport function evaluateWithScope(\n expression: string,\n scope: NameResolver,\n opts: ExpressionSyntaxOptions = {}\n): unknown {\n const trimmed = expression.trim()\n if (!trimmed) return undefined\n return evalNode(parseCached(trimmed, opts), scope)\n}\n\n// ============================================================\n// EXPRESSION EVALUATOR IMPLEMENTATION\n// ============================================================\n\n/**\n * Evaluate an expression with full context support\n */\nexport function evaluateExpression(\n expression: string,\n context: BindingExpressionContext\n): ExpressionEvalResult {\n try {\n const helpers = context.helpers\n const scope: NameResolver = {\n lookup(name) {\n if (name === 'data') return context.data\n if (name === 'state') return context.state\n if (name === 'params') return context.params\n // A helper named bare (without a call) has always resolved to the\n // function itself here; kept.\n if (helpers && Object.prototype.hasOwnProperty.call(helpers, name)) return helpers[name]\n // Shorthand access. Priority: params > state > data (most specific first)\n if (name in context.params) return context.params[name]\n if (name in context.state) return context.state[name]\n if (name in context.data) return context.data[name]\n return undefined\n },\n helper: (name) => (helpers && Object.prototype.hasOwnProperty.call(helpers, name) ? helpers[name] : undefined),\n }\n return { success: true, value: evaluateWithScope(expression, scope, { undefinedAsNull: true }) }\n } catch (e) {\n return { success: false, error: `Expression error: ${e}` }\n }\n}\n\n// ============================================================\n// DEPENDENCY EXTRACTION\n// ============================================================\n\n/**\n * Extract dependencies from an expression for reactive updates\n */\nexport function extractDependencies(expression: string): ExpressionDependency[] {\n const dependencies: ExpressionDependency[] = []\n const seen = new Set<string>()\n\n // Match patterns like: data.foo.bar, state.count, params.id\n // Also match shorthand: foo.bar (when referring to data/state/params root)\n const patterns = [\n /\\bdata\\.(\\w+(?:\\.\\w+|\\[\\d+\\])*)/g,\n /\\bstate\\.(\\w+(?:\\.\\w+|\\[\\d+\\])*)/g,\n /\\bparams\\.(\\w+(?:\\.\\w+|\\[\\d+\\])*)/g,\n ]\n\n const sources: readonly ('data' | 'state' | 'params')[] = ['data', 'state', 'params']\n\n for (let i = 0; i < patterns.length; i++) {\n const pattern = patterns[i]\n const source = sources[i]\n if (!pattern || !source) continue\n\n let match: RegExpExecArray | null\n\n while ((match = pattern.exec(expression)) !== null) {\n const path = match[1]\n if (path === undefined) continue\n const key = `${source}.${path}`\n if (!seen.has(key)) {\n seen.add(key)\n dependencies.push({ source, path })\n }\n }\n }\n\n return dependencies\n}\n\n// ============================================================\n// INTERPOLATION\n// ============================================================\n\n/**\n * Check if a value contains expression syntax\n */\nexport function isExpression(value: unknown): boolean {\n if (typeof value !== 'string') return false\n return /\\{\\{.+?\\}\\}/.test(value)\n}\n\n/**\n * Interpolate expressions within a template string\n *\n * @example\n * interpolate('Hello, {{user.name}}!', context) // 'Hello, John!'\n * interpolate('Total: {{price * quantity}}', context) // 'Total: 100'\n */\nexport function interpolate(template: string, context: BindingExpressionContext): string {\n const pattern = /\\{\\{(.+?)\\}\\}/g\n return template.replace(pattern, (_, expr: string) => {\n const result = evaluateExpression(expr.trim(), context)\n if (result.success) {\n return String(result.value ?? '')\n }\n return ''\n })\n}\n\n// ============================================================\n// DEFAULT HELPERS\n// ============================================================\n\n/**\n * Default helper functions for expressions\n */\nexport const DEFAULT_BINDING_HELPERS: Record<string, (...args: unknown[]) => unknown> = {\n // String helpers\n upper: (s: unknown) => String(s).toUpperCase(),\n lower: (s: unknown) => String(s).toLowerCase(),\n trim: (s: unknown) => String(s).trim(),\n capitalize: (s: unknown) => {\n const str = String(s)\n return str.charAt(0).toUpperCase() + str.slice(1)\n },\n concat: (...args: unknown[]) => args.map(String).join(''),\n\n // Number helpers\n round: (n: unknown, decimals?: unknown) => {\n const num = Number(n)\n const d = Number(decimals ?? 0)\n return Math.round(num * Math.pow(10, d)) / Math.pow(10, d)\n },\n floor: (n: unknown) => Math.floor(Number(n)),\n ceil: (n: unknown) => Math.ceil(Number(n)),\n abs: (n: unknown) => Math.abs(Number(n)),\n min: (...args: unknown[]) => Math.min(...args.map(Number)),\n max: (...args: unknown[]) => Math.max(...args.map(Number)),\n /**\n * How many pages `total` rows fill at `size` per page — `ceil(total / size)`,\n * but SAFE: a missing, non-numeric, zero or negative total or size gives 0,\n * never `NaN` or `Infinity` (the envelope is absent until the first fetch\n * lands). Pair with `__meta.<source>.total` on a `returns` source:\n * `{{pages(__meta.products.total, 20)}}`. Wrap in `max(1, …)` for a pager\n * that should read \"1 / 1\" on an empty list.\n */\n pages: (total: unknown, size: unknown) => {\n const t = Number(total)\n const s = Number(size)\n if (!Number.isFinite(t) || !Number.isFinite(s) || t <= 0 || s <= 0) return 0\n return Math.ceil(t / s)\n },\n\n // Aggregate helpers — one data source, several KPI figures. Without these a\n // KPI strip needed one source (one fetch) per number. Filtering stays the\n // data layer's job (EntityQuery.filter); these only fold what is already\n // fetched.\n sumBy: (items: unknown, field?: unknown) => {\n if (!Array.isArray(items)) return 0\n const f = field === undefined ? undefined : String(field)\n return items.reduce<number>((acc, it) => {\n const v = f === undefined ? it : (it as Record<string, unknown> | null)?.[f]\n const n = Number(v)\n return Number.isFinite(n) ? acc + n : acc\n }, 0)\n },\n groupCount: (items: unknown, field: unknown) => {\n const out: Record<string, number> = {}\n if (!Array.isArray(items)) return out\n const f = String(field)\n for (const it of items) {\n const v = (it as Record<string, unknown> | null)?.[f]\n const key = v === null || v === undefined || v === '' ? 'unknown' : String(v)\n out[key] = (out[key] ?? 0) + 1\n }\n return out\n },\n\n // Array helpers\n // A list or a string has a length; anything else — a source that has not\n // answered (`undefined`), `null`, a number — has none, and `String(v).length`\n // counted the letters of \"undefined\" (9) or \"null\" (4) instead.\n length: (v: unknown) => (Array.isArray(v) || typeof v === 'string' ? v.length : 0),\n first: (arr: unknown) => (Array.isArray(arr) ? arr[0] : undefined),\n last: (arr: unknown) => (Array.isArray(arr) ? arr[arr.length - 1] : undefined),\n join: (arr: unknown, sep?: unknown) =>\n Array.isArray(arr) ? arr.join(String(sep ?? ',')) : String(arr),\n includes: (arr: unknown, item: unknown) =>\n Array.isArray(arr) ? arr.includes(item) : String(arr).includes(String(item)),\n slice: (arr: unknown, start?: unknown, end?: unknown) => {\n if (Array.isArray(arr)) {\n return arr.slice(\n start !== undefined ? Number(start) : undefined,\n end !== undefined ? Number(end) : undefined\n )\n }\n return String(arr).slice(\n start !== undefined ? Number(start) : undefined,\n end !== undefined ? Number(end) : undefined\n )\n },\n\n // Type checks\n isEmpty: (v: unknown) =>\n v === null ||\n v === undefined ||\n v === '' ||\n (Array.isArray(v) && v.length === 0) ||\n (typeof v === 'object' && Object.keys(v).length === 0),\n isNotEmpty: (v: unknown) =>\n v !== null && v !== undefined && v !== '' && !(Array.isArray(v) && v.length === 0),\n isArray: (v: unknown) => Array.isArray(v),\n isString: (v: unknown) => typeof v === 'string',\n isNumber: (v: unknown) => typeof v === 'number' && !isNaN(v),\n isBoolean: (v: unknown) => typeof v === 'boolean',\n isNull: (v: unknown) => v === null || v === undefined,\n\n // Object helpers\n keys: (obj: unknown) => (typeof obj === 'object' && obj !== null ? Object.keys(obj) : []),\n values: (obj: unknown) => (typeof obj === 'object' && obj !== null ? Object.values(obj) : []),\n\n // Formatting helpers\n json: (v: unknown) => JSON.stringify(v),\n /**\n * Today's date in the visitor's time zone, as `YYYY-MM-DD`.\n * The shape date fields are stored in, so it compares as a string:\n * `{{event.date >= today()}}` for \"upcoming\", `today(-7)` for a week ago.\n * The optional argument shifts by whole days. Before this an \"upcoming\"\n * filter had nothing to compare against and a page hard-coded a date.\n */\n today: (offsetDays?: unknown) => {\n const d = new Date()\n const shift = Number(offsetDays ?? 0)\n if (Number.isFinite(shift) && shift !== 0) d.setDate(d.getDate() + Math.trunc(shift))\n const mm = String(d.getMonth() + 1).padStart(2, '0')\n const dd = String(d.getDate()).padStart(2, '0')\n return `${d.getFullYear()}-${mm}-${dd}`\n },\n date: (v: unknown) => new Date(v as string | number).toLocaleDateString(),\n time: (v: unknown) => new Date(v as string | number).toLocaleTimeString(),\n datetime: (v: unknown) => new Date(v as string | number).toLocaleString(),\n currency: (v: unknown, currency?: unknown, locale?: unknown) => {\n const num = Number(v)\n return new Intl.NumberFormat(String(locale ?? 'en-US'), {\n style: 'currency',\n currency: String(currency ?? 'USD'),\n }).format(num)\n },\n percent: (v: unknown, decimals?: unknown) => {\n const num = Number(v)\n const d = Number(decimals ?? 0)\n return `${(num * 100).toFixed(d)}%`\n },\n}\n\n// ============================================================\n// EXPRESSION EVALUATOR FACTORY\n// ============================================================\n\n/**\n * Create an expression evaluator with context and helpers\n */\nexport function createExpressionEvaluator(\n additionalHelpers?: Record<string, (...args: unknown[]) => unknown>\n): ExpressionEvaluator {\n const helpers = { ...DEFAULT_BINDING_HELPERS, ...additionalHelpers }\n\n return {\n evaluate(expression: string, context: BindingExpressionContext): unknown {\n const result = evaluateExpression(expression, {\n ...context,\n helpers: { ...helpers, ...context.helpers },\n })\n if (result.success) {\n return result.value\n }\n throw new Error(result.error)\n },\n\n isExpression,\n\n extractDependencies,\n\n interpolate(template: string, context: BindingExpressionContext): string {\n return interpolate(template, {\n ...context,\n helpers: { ...helpers, ...context.helpers },\n })\n },\n }\n}\n"]}
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* connector:'graph-lists'}` routes through a `ConnectorEngineRegistry`:
|
|
9
9
|
* when a loaded engine is registered under that connection name the read
|
|
10
10
|
* goes through it (constructed with the world connection's config);
|
|
11
|
-
* absent engine/config keeps today's behavior (
|
|
12
|
-
* empty + `__errors` context), never a crash.
|
|
11
|
+
* absent engine/config keeps today's behavior (the host's entity facade
|
|
12
|
+
* or honest empty / `fallback` + `__errors` context), never a crash. A
|
|
13
|
+
* source with no `connector` is the app's own records; no connection is
|
|
14
|
+
* implied for it.
|
|
13
15
|
* 2. engine-bridge path — pack blocks get their connections/config from the
|
|
14
16
|
* runtime-provided connections context (`SurfaceConnectionsContext`).
|
|
15
17
|
* On the platform the value comes from the project's connections doc +
|
package/dist/connectors/types.js
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* connector:'graph-lists'}` routes through a `ConnectorEngineRegistry`:
|
|
9
9
|
* when a loaded engine is registered under that connection name the read
|
|
10
10
|
* goes through it (constructed with the world connection's config);
|
|
11
|
-
* absent engine/config keeps today's behavior (
|
|
12
|
-
* empty + `__errors` context), never a crash.
|
|
11
|
+
* absent engine/config keeps today's behavior (the host's entity facade
|
|
12
|
+
* or honest empty / `fallback` + `__errors` context), never a crash. A
|
|
13
|
+
* source with no `connector` is the app's own records; no connection is
|
|
14
|
+
* implied for it.
|
|
13
15
|
* 2. engine-bridge path — pack blocks get their connections/config from the
|
|
14
16
|
* runtime-provided connections context (`SurfaceConnectionsContext`).
|
|
15
17
|
* On the platform the value comes from the project's connections doc +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/connectors/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/connectors/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG","sourcesContent":["/**\n * Connector Engine Types\n *\n * Platform-side vocabulary for CONNECTOR/PROVIDER atom engines. Two\n * consumption paths, ONE engine source:\n *\n * 1. dataSource path — a surface dataSource `{kind:'entity', entityType,\n * connector:'graph-lists'}` routes through a `ConnectorEngineRegistry`:\n * when a loaded engine is registered under that connection name the read\n * goes through it (constructed with the world connection's config);\n * absent engine/config keeps today's behavior (the host's entity facade\n * or honest empty / `fallback` + `__errors` context), never a crash. A\n * source with no `connector` is the app's own records; no connection is\n * implied for it.\n * 2. engine-bridge path — pack blocks get their connections/config from the\n * runtime-provided connections context (`SurfaceConnectionsContext`).\n * On the platform the value comes from the project's connections doc +\n * world connector rows; in the runner the existing `connections.json`\n * path is unchanged. Single dialect — the source differs, the shape\n * doesn't (mirrors the runner's `PwappConnection`).\n *\n * @module @pwfabric/runtime/connectors/types\n */\n\nimport type { EntityAggregate, EntityTypeId, EntityQuery } from '../entity/types.js'\nimport type { ConnectorAggregateResult, ConnectorQueryResult } from '../entity/connector.js'\n\n// ============================================================\n// ENGINE DESCRIPTOR (what the loader consumes)\n// ============================================================\n\n/**\n * Atom kinds that ship a connector engine bundle. `connector` = dynamic\n * data engine (e.g. graph-lists); `provider` = fixed-enum provider motor\n * facet (e.g. the single Graph motor behind graph-mail/graph-users/…).\n */\nexport type ConnectorEngineKind = 'connector' | 'provider'\n\n/**\n * Descriptor for a loadable connector-engine atom bundle. Mirrors\n * `DynamicBlockDescriptor` with the AtomRef `bundleUrl`\n * vocabulary: the publish pipeline uploads the ESM bundle and stamps its\n * SHA-256 — integrity is verified BEFORE evaluation (security boundary,\n * same law as block bundles).\n */\nexport interface ConnectorEngineDescriptor {\n /** Atom id of the engine (e.g. 'graph-lists', 'microsoft-graph-motor'). */\n readonly id: string\n readonly kind: ConnectorEngineKind\n /** CDN URL of the ESM bundle produced by the publish pipeline. */\n readonly bundleUrl: string\n /** SHA-256 of the bundle bytes (bare hex or SRI `sha256-<base64>`). */\n readonly integrity: string\n readonly version?: string\n}\n\n// ============================================================\n// ENGINE MODULE CONVENTION (what a bundle exports)\n// ============================================================\n\n/**\n * Per-call access-token supplier handed to an engine at construction —\n * exactly the signature the existing engines already take\n * (GraphListConnector / createGraphConnector). Re-invoked on every request\n * so token rotation is transparent. Resolving to `null` means\n * unauthenticated — engines degrade honestly (anon/empty), they do not\n * throw at construction time.\n */\nexport type ConnectorAccessTokenHook = () => Promise<string | null>\n\n/**\n * Factory a connector-engine bundle must export. The wrapper convention\n * (mirror of the block bundle's `Component` + `definition`) is a stable\n * `createConnector` named export; `default` is accepted as fallback.\n */\nexport type ConnectorEngineFactory = (\n getAccessToken: ConnectorAccessTokenHook,\n config: Readonly<Record<string, unknown>>\n) => unknown\n\n/** Module shape of an evaluated connector-engine bundle. */\nexport interface ConnectorEngineModule {\n readonly createConnector?: ConnectorEngineFactory\n readonly default?: ConnectorEngineFactory\n}\n\n/**\n * Minimal read contract every constructed engine must satisfy — the surface\n * dataSource path only lists records. Engines that additionally implement\n * the full `EntityConnector` interface can be registered into an\n * `EntityFacade` (`facade.connectors.register(engine)`) for the write path.\n */\nexport interface ConnectorEngine {\n readonly name?: string\n query(entityType: EntityTypeId, query: EntityQuery): Promise<ConnectorQueryResult>\n /** Optional: an engine that can count server-side; absent = list and reduce. */\n aggregate?(entityType: EntityTypeId, aggregate: EntityAggregate): Promise<ConnectorAggregateResult>\n}\n\n// ============================================================\n// CONNECTION BINDING (registry configuration unit)\n// ============================================================\n\n/**\n * One configured connection: a connector engine bound to this world with\n * per-connection config. `connection` is the connection NAME the surface\n * dialect references (`dataSources[].connector`); `descriptor` says which\n * engine bundle serves it; `config` is the world connection's config\n * (never credential values — auth law).\n */\nexport interface ConnectorConnectionBinding {\n readonly connection: string\n readonly descriptor: ConnectorEngineDescriptor\n readonly config?: Readonly<Record<string, unknown>>\n /** Auth binding BY NAME — resolved by the token resolver. */\n readonly authProviderRef?: string\n}\n\n/**\n * Injectable token resolver — the registry derives each engine's\n * `ConnectorAccessTokenHook` from this. By default the\n * resolver answers `null` (engines behave as unauthenticated); a host plugs\n * the AuthRegistry in through `setAccessTokenResolver` without another\n * core change.\n */\nexport type ConnectorAccessTokenResolver = (\n binding: ConnectorConnectionBinding\n) => Promise<string | null>\n\n// ============================================================\n// REGISTRY (name → engine instance)\n// ============================================================\n\n/** Lifecycle state of a connection's engine inside the registry. */\nexport type ConnectorEngineStatus =\n | { readonly state: 'unregistered' }\n | { readonly state: 'pending' }\n | { readonly state: 'ready' }\n | { readonly state: 'failed'; readonly reason: string }\n\n/**\n * Registry of connection name → constructed engine instance. Distinct from\n * the entity system's `ConnectorRegistry`, which manages\n * `EntityConnector` instances INSIDE one facade — this registry owns\n * loading + constructing engines from atom bundles, world-wide.\n */\nexport interface ConnectorEngineRegistry {\n /** Declare the world's connections (replaces the current set). */\n configure(bindings: readonly ConnectorConnectionBinding[]): void\n\n /** Register an already-constructed engine directly (host/in-process). */\n register(connection: string, engine: ConnectorEngine): void\n\n /**\n * Resolve the engine for a connection name — loads the bundle and\n * constructs the engine on first use, then answers from cache. NEVER\n * throws: a failed load/construction marks the entry `failed` (with\n * reason) and resolves `null` so consumers degrade honestly.\n */\n resolve(connection: string): Promise<ConnectorEngine | null>\n\n /** Current lifecycle state of a connection (sync, for honest UI/errors). */\n getStatus(connection: string): ConnectorEngineStatus\n\n /** Swap the token resolver (the auth-registry seam). Existing constructed\n * engines keep their hook — it closes over the resolver reference, so a\n * swap takes effect on the next token request, not the next construction. */\n setAccessTokenResolver(resolver: ConnectorAccessTokenResolver): void\n\n /** Configured/registered connection names. */\n list(): readonly string[]\n\n /** Drop all bindings, instances, and failure states. */\n clear(): void\n}\n\n// ============================================================\n// SURFACE CONNECTIONS CONTEXT VALUE (single dialect)\n// ============================================================\n\n/**\n * One connection as blocks/the renderer see it. Shape-compatible with the\n * runner's `PwappConnection` (`connections.json` entry) — single dialect,\n * different source (platform: project connections doc + world connector\n * rows; runner: connections.json).\n */\nexport interface SurfaceConnection {\n readonly name: string\n /** Connector engine (atom) id serving this connection. */\n readonly connector?: string\n readonly config?: Readonly<Record<string, unknown>>\n /** World row status when known (e.g. 'active' | 'pending'). */\n readonly status?: string\n readonly authProviderRef?: string\n}\n\n/**\n * Value carried by `SurfaceConnectionsContext` and the renderer's\n * `connections` prop. `engines` may be null when the host provides the\n * connections doc for bridge blocks but no loaded engines (yet).\n */\nexport interface SurfaceConnectionsValue {\n readonly connections: readonly SurfaceConnection[]\n readonly engines: ConnectorEngineRegistry | null\n /**\n * the same live token the engine registry is constructed\n * with, reachable by the data path.\n *\n * The registry already closes over a resolver, but it keeps it private, so a\n * `rest` data source sitting beside an engine-backed one had no route to the\n * identity the app was already signed in with. Exposed here, both paths draw\n * on one bridge instead of the REST half having none.\n */\n readonly getAccessToken?: ConnectorAccessTokenResolver\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type { DynamicBlockWrapperProps, DynamicArtifactContextValue, DynamicArti
|
|
|
33
33
|
export { BlockModuleLoader, DynamicBlockWrapper, DynamicArtifactProvider, preloadDynamicBlocks, useDynamicBlocks, useDynamicStarters, } from './render/index.js';
|
|
34
34
|
export { BlockErrorBoundary } from './render/index.js';
|
|
35
35
|
export { dataSourceCacheKey } from './render/index.js';
|
|
36
|
-
export type { SurfaceDataCache } from './render/index.js';
|
|
36
|
+
export type { SurfaceDataCache, LinkHref } from './render/index.js';
|
|
37
37
|
export { createSurfaceEventBus } from './render/index.js';
|
|
38
38
|
export { SurfaceEventContext } from './render/index.js';
|
|
39
39
|
export { useSurfaceEvents } from './render/index.js';
|
|
@@ -42,9 +42,10 @@ export { BehaviorSurfaceProvider } from './render/index.js';
|
|
|
42
42
|
export { SurfaceIdContext } from './render/index.js';
|
|
43
43
|
export { useSurfaceId } from './render/index.js';
|
|
44
44
|
export type { ShellSelectionStore, ShellSelectionOptions, ShellSelectionProviderProps, } from './render/index.js';
|
|
45
|
+
export type { LiteralProps } from './render/index.js';
|
|
45
46
|
export { ShellSelectionContext, ShellSelectionProvider, createShellSelectionStore, useShellSelection, } from './render/index.js';
|
|
46
47
|
export { DefaultImageAdapter, NextImageAdapter } from './adapters/index.js';
|
|
47
|
-
export { SurfaceRenderer as BlockSurfaceRenderer, BlockRenderer, getBlockIds, findBlockById, updateBlockById, DataBoundSurfaceRenderer, surfaceNeedsDataBinding, blockActionsOf, resolveEndpoint, resolveBlockExpressions, resolveString, surfaceThemeToCSS, } from './render/index.js';
|
|
48
|
+
export { SurfaceRenderer as BlockSurfaceRenderer, BlockRenderer, getBlockIds, findBlockById, updateBlockById, DataBoundSurfaceRenderer, surfaceNeedsDataBinding, blockActionsOf, resolveEndpoint, resolveBlockExpressions, literalPropsOf, resolveString, isHrefKey, isLinkMember, isExpressionLink, surfaceThemeToCSS, } from './render/index.js';
|
|
48
49
|
export * from './capability/index.js';
|
|
49
50
|
export * from './data/index.js';
|
|
50
51
|
export * from './routing/index.js';
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,7 @@ export { useSurfaceId } from './render/index.js';
|
|
|
58
58
|
export { ShellSelectionContext, ShellSelectionProvider, createShellSelectionStore, useShellSelection, } from './render/index.js';
|
|
59
59
|
// Image Adapters
|
|
60
60
|
export { DefaultImageAdapter, NextImageAdapter } from './adapters/index.js';
|
|
61
|
-
export { SurfaceRenderer as BlockSurfaceRenderer, BlockRenderer, getBlockIds, findBlockById, updateBlockById, DataBoundSurfaceRenderer, surfaceNeedsDataBinding, blockActionsOf, resolveEndpoint, resolveBlockExpressions, resolveString, surfaceThemeToCSS, } from './render/index.js';
|
|
61
|
+
export { SurfaceRenderer as BlockSurfaceRenderer, BlockRenderer, getBlockIds, findBlockById, updateBlockById, DataBoundSurfaceRenderer, surfaceNeedsDataBinding, blockActionsOf, resolveEndpoint, resolveBlockExpressions, literalPropsOf, resolveString, isHrefKey, isLinkMember, isExpressionLink, surfaceThemeToCSS, } from './render/index.js';
|
|
62
62
|
// legacy first-party `*Block` component re-exports +
|
|
63
63
|
// `defaultBlockComponents` map retired. Production rendering loads
|
|
64
64
|
// components from CDN bundles via `BlockModuleLoader`; the static
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,sCAAsC;AACtC,cAAc,qBAAqB,CAAA;AAEnC,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAExD,sBAAsB;AACtB,OAAO,EAA2B,0BAA0B,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnG,qBAAqB;AACrB,OAAO,EAEL,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,gBAAgB,CAAA;AAEvB,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE9E,oBAAoB;AACpB,OAAO,EAEL,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,cAAc,GAEf,MAAM,wBAAwB,CAAA;AAE/B,8CAA8C;AAC9C,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAE7B,6BAA6B;AAC7B,cAAc,oBAAoB,CAAA;AAElC,wBAAwB;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAEhC,qEAAqE;AACrE,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAE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EACb,iBAAiB,GAClB,MAAM,mBAAmB,CAAA;AAC1B,qDAAqD;AACrD,mEAAmE;AACnE,kEAAkE;AAClE,wDAAwD;AAExD,4DAA4D;AAC5D,cAAc,uBAAuB,CAAA;AAErC,mDAAmD;AACnD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAkB/B,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAA;AAIxB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtE,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,SAAS,GACV,MAAM,iBAAiB,CAAA;AAExB,wCAAwC;AACxC,OAAO,EACL,iBAAiB,GAOlB,MAAM,8BAA8B,CAAA;AAErC,yEAAyE;AACzE,+CAA+C;AAC/C,EAAE;AACF,wFAAwF;AACxF,8EAA8E;AAC9E,kDAAkD;AAElD,qDAAqD;AACrD,iEAAiE;AACjE,kEAAkE;AAClE,yEAAyE;AACzE,6DAA6D;AAC7D,sEAAsE;AACtE,sEAAsE;AACtE,qCAAqC","sourcesContent":["/**\n * @pwfabric/runtime\n *\n * Runtime and execution engine for the PWFabric platform.\n *\n * Runtime spine implementation\n * Surface rendering pipeline, layout system, primitives\n * Binding engine, auth, cache, graph resolver\n *\n * @module @pwfabric/runtime\n */\n\n// Re-export contracts for convenience\nexport * from '@pwfabric/contracts'\n\n// Fabric kernel\nexport { FabricKernel, createFabric } from './kernel.js'\n\n// Capability registry\nexport { type CapabilityRegistry, InMemoryCapabilityRegistry, createRegistry } from './registry.js'\n\n// Contract validator\nexport {\n type ContractValidator,\n RuntimeContractValidator,\n createValidator,\n isValidationSuccess,\n isValidationFailure,\n formatValidationErrors,\n} from './validator.js'\n\n// Event bus\nexport { InMemoryEventBus, createEventBus, createFabricEvent } from './bus.js'\n\n// Execution context\nexport {\n type InvocationHandler,\n RuntimeExecutionContext,\n ConsoleExecutionLogger,\n NoOpExecutionLogger,\n createExecutionContext,\n generateTraceId,\n generateSpanId,\n type CreateExecutionContextOptions,\n} from './execution-context.js'\n\n// Legacy exports (for backward compatibility)\nexport * from './context.js'\nexport * from './executor.js'\n\n// Surface rendering pipeline\nexport * from './surface/index.js'\n\n// Binding, cache, graph\nexport * from './binding/index.js'\nexport * from './cache/index.js'\nexport * from './graph/index.js'\n\n// Auth is intentionally NOT part of the default export: it holds the\n// MSAL/API-key providers, and pulling them into the default barrel would make\n// every consumer of `.` — including `@pwfabric/embed`'s browser-facing IIFE\n// build — carry them along. Available explicitly via `@pwfabric/runtime/auth`.\n\n// State and forms capabilities\nexport * from './state/index.js'\nexport * from './forms/index.js'\n\n// Entity system\nexport * from './entity/index.js'\n\n// Connector engine loading + registry (platform-side\n// execution of CONNECTOR/PROVIDER atom engines)\nexport * from './connectors/index.js'\nexport { SurfaceConnectionsContext, useSurfaceConnections } from './render/index.js'\n\n// Surface renderer (avoiding duplicates with surface/index.js)\nexport type {\n BlockComponentProps,\n BlockComponent,\n BlockComponentRegistry,\n CapabilityProvider,\n BlockContext,\n SurfaceEventType,\n SurfaceEvent,\n SurfaceRendererProps,\n BlockRendererProps,\n RenderableSurface,\n CapabilityType,\n ImageAdapter,\n ImageAdapterProps,\n SurfaceDataSourceKind,\n SurfaceDataSourceDefinition,\n SurfaceActionType,\n SurfaceAction,\n BlockActionProp,\n DataBoundSurface,\n DataBoundSurfaceRendererProps,\n} from './render/index.js'\n\n// Capability Gate (Entitlement enforcement)\nexport type {\n EntitlementContextValue,\n EntitlementProviderProps,\n GatedBlockPlaceholderProps,\n} from './render/index.js'\nexport { EntitlementProvider, useEntitlements, GatedBlockPlaceholder } from './render/index.js'\n\n// Dynamic Artifact Loading\nexport type {\n DynamicBlockWrapperProps,\n DynamicArtifactContextValue,\n DynamicArtifactProviderProps,\n} from './render/index.js'\nexport {\n BlockModuleLoader,\n DynamicBlockWrapper,\n DynamicArtifactProvider,\n preloadDynamicBlocks,\n useDynamicBlocks,\n useDynamicStarters,\n} from './render/index.js'\n\n// Block Error Boundary (crash isolation)\nexport { BlockErrorBoundary } from './render/index.js'\nexport { dataSourceCacheKey } from './render/index.js'\nexport type { SurfaceDataCache } from './render/index.js'\n\n// Surface event protocol\nexport { createSurfaceEventBus } from './render/index.js'\nexport { SurfaceEventContext } from './render/index.js'\nexport { useSurfaceEvents } from './render/index.js'\n\n// BehaviorSurfaceProvider — runtime surface wiring\nexport type { BehaviorSurfaceProviderProps } from './render/index.js'\nexport { BehaviorSurfaceProvider } from './render/index.js'\nexport { SurfaceIdContext } from './render/index.js'\nexport { useSurfaceId } from './render/index.js'\n\n// Shell × body: SPLIT shell selection (URL-projected), and the shell/body\n// classification the renderer lays out by.\nexport type {\n ShellSelectionStore,\n ShellSelectionOptions,\n ShellSelectionProviderProps,\n} from './render/index.js'\nexport {\n ShellSelectionContext,\n ShellSelectionProvider,\n createShellSelectionStore,\n useShellSelection,\n} from './render/index.js'\n\n// Image Adapters\nexport { DefaultImageAdapter, NextImageAdapter } from './adapters/index.js'\nexport {\n SurfaceRenderer as BlockSurfaceRenderer,\n BlockRenderer,\n getBlockIds,\n findBlockById,\n updateBlockById,\n DataBoundSurfaceRenderer,\n surfaceNeedsDataBinding,\n blockActionsOf,\n resolveEndpoint,\n resolveBlockExpressions,\n resolveString,\n surfaceThemeToCSS,\n} from './render/index.js'\n// legacy first-party `*Block` component re-exports +\n// `defaultBlockComponents` map retired. Production rendering loads\n// components from CDN bundles via `BlockModuleLoader`; the static\n// component registry no longer ships from this package.\n\n// Capability system (definitions, type mapping, validation)\nexport * from './capability/index.js'\n\n// Data, routing, SEO, analytics, i18n capabilities\nexport * from './data/index.js'\nexport * from './routing/index.js'\nexport * from './seo/index.js'\nexport * from './analytics/index.js'\nexport * from './i18n/index.js'\n\n// Performance monitoring module\nexport type {\n WebVitalName,\n WebVitalRating,\n WebVitalMetric,\n WebVitalCallback,\n WebVitalsReport,\n RenderMetrics,\n RenderTimerConfig,\n PerformanceBudget,\n BudgetViolation,\n BudgetCheckResult,\n ReportDestination,\n ReporterConfig,\n PerformanceReport,\n} from './perf/index.js'\nexport {\n WebVitalsCollector,\n createWebVitalsCollector,\n rateMetric,\n RenderTimer,\n createRenderTimer,\n DEFAULT_BUDGET,\n BudgetChecker,\n createBudgetChecker,\n PerformanceReporter,\n createPerformanceReporter,\n} from './perf/index.js'\n\n// Accessibility (a11y) module\nexport type { AnnouncementLevel, LiveRegionConfig } from './a11y/index.js'\nexport { LiveRegionAnnouncer, createAnnouncer } from './a11y/index.js'\nexport type { FocusTrapConfig } from './a11y/index.js'\nexport {\n FocusTrapManager,\n FocusRestorer,\n createSkipLink,\n createFocusTrap,\n createFocusRestorer,\n} from './a11y/index.js'\nexport type { ArrowDirection, KeyboardNavConfig } from './a11y/index.js'\nexport {\n KeyboardNavigationManager,\n RovingTabIndex,\n createKeyboardNav,\n createRovingTabIndex,\n} from './a11y/index.js'\nexport type { ContrastResult } from './a11y/index.js'\nexport {\n hexToRgb,\n relativeLuminance,\n contrastRatio,\n checkContrast,\n meetsWCAG,\n} from './a11y/index.js'\n\n// tenant-scoped pack atom registry hook\nexport {\n useInstalledAtoms,\n type InstalledAtomDescriptor,\n type InstalledAtomKind,\n type InstalledAtomsState,\n type InstalledAtomsFetcher,\n type AtomManifestPayload,\n type AtomBlockDefinitionMetadata,\n} from './hooks/useInstalledAtoms.js'\n\n// The engine names no tenant: a host's tenant model (plan, entitlements,\n// storage, installations) belongs to the host.\n//\n// What the engine offers is the mechanism without the vocabulary: `EntitlementProvider`\n// and `useEntitlements` in ./render/capability-gate.tsx still enforce a claim\n// set, typed structurally as `EntitlementClaims`.\n\n// canonical home for block infrastructure (registry,\n// composition rules, rule engine, contexts, hooks, default block\n// components, schemas, 45 first-party block defs). Subpath import\n// `@pwfabric/runtime/blocks` is the recommended consumer entry; the root\n// re-exports above (SurfaceEventContext / useSurfaceEvents /\n// SurfaceIdContext / useSurfaceId / defaultBlockComponents / 21 block\n// components) now resolve via `runtime/render/*` → `runtime/blocks/*`\n// preserving React-context identity.\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,sCAAsC;AACtC,cAAc,qBAAqB,CAAA;AAEnC,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAExD,sBAAsB;AACtB,OAAO,EAA2B,0BAA0B,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnG,qBAAqB;AACrB,OAAO,EAEL,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,gBAAgB,CAAA;AAEvB,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE9E,oBAAoB;AACpB,OAAO,EAEL,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,cAAc,GAEf,MAAM,wBAAwB,CAAA;AAE/B,8CAA8C;AAC9C,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAE7B,6BAA6B;AAC7B,cAAc,oBAAoB,CAAA;AAElC,wBAAwB;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CA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esContent":["/**\n * @pwfabric/runtime\n *\n * Runtime and execution engine for the PWFabric platform.\n *\n * Runtime spine implementation\n * Surface rendering pipeline, layout system, primitives\n * Binding engine, auth, cache, graph resolver\n *\n * @module @pwfabric/runtime\n */\n\n// Re-export contracts for convenience\nexport * from '@pwfabric/contracts'\n\n// Fabric kernel\nexport { FabricKernel, createFabric } from './kernel.js'\n\n// Capability registry\nexport { type CapabilityRegistry, InMemoryCapabilityRegistry, createRegistry } from './registry.js'\n\n// Contract validator\nexport {\n type ContractValidator,\n RuntimeContractValidator,\n createValidator,\n isValidationSuccess,\n isValidationFailure,\n formatValidationErrors,\n} from './validator.js'\n\n// Event bus\nexport { InMemoryEventBus, createEventBus, createFabricEvent } from './bus.js'\n\n// Execution context\nexport {\n type InvocationHandler,\n RuntimeExecutionContext,\n ConsoleExecutionLogger,\n NoOpExecutionLogger,\n createExecutionContext,\n generateTraceId,\n generateSpanId,\n type CreateExecutionContextOptions,\n} from './execution-context.js'\n\n// Legacy exports (for backward compatibility)\nexport * from './context.js'\nexport * from './executor.js'\n\n// Surface rendering pipeline\nexport * from './surface/index.js'\n\n// Binding, cache, graph\nexport * from './binding/index.js'\nexport * from './cache/index.js'\nexport * from './graph/index.js'\n\n// Auth is intentionally NOT part of the default export: it holds the\n// MSAL/API-key providers, and pulling them into the default barrel would make\n// every consumer of `.` — including `@pwfabric/embed`'s browser-facing IIFE\n// build — carry them along. Available explicitly via `@pwfabric/runtime/auth`.\n\n// State and forms capabilities\nexport * from './state/index.js'\nexport * from './forms/index.js'\n\n// Entity system\nexport * from './entity/index.js'\n\n// Connector engine loading + registry (platform-side\n// execution of CONNECTOR/PROVIDER atom engines)\nexport * from './connectors/index.js'\nexport { SurfaceConnectionsContext, useSurfaceConnections } from './render/index.js'\n\n// Surface renderer (avoiding duplicates with surface/index.js)\nexport type {\n BlockComponentProps,\n BlockComponent,\n BlockComponentRegistry,\n CapabilityProvider,\n BlockContext,\n SurfaceEventType,\n SurfaceEvent,\n SurfaceRendererProps,\n BlockRendererProps,\n RenderableSurface,\n CapabilityType,\n ImageAdapter,\n ImageAdapterProps,\n SurfaceDataSourceKind,\n SurfaceDataSourceDefinition,\n SurfaceActionType,\n SurfaceAction,\n BlockActionProp,\n DataBoundSurface,\n DataBoundSurfaceRendererProps,\n} from './render/index.js'\n\n// Capability Gate (Entitlement enforcement)\nexport type {\n EntitlementContextValue,\n EntitlementProviderProps,\n GatedBlockPlaceholderProps,\n} from './render/index.js'\nexport { EntitlementProvider, useEntitlements, GatedBlockPlaceholder } from './render/index.js'\n\n// Dynamic Artifact Loading\nexport type {\n DynamicBlockWrapperProps,\n DynamicArtifactContextValue,\n DynamicArtifactProviderProps,\n} from './render/index.js'\nexport {\n BlockModuleLoader,\n DynamicBlockWrapper,\n DynamicArtifactProvider,\n preloadDynamicBlocks,\n useDynamicBlocks,\n useDynamicStarters,\n} from './render/index.js'\n\n// Block Error Boundary (crash isolation)\nexport { BlockErrorBoundary } from './render/index.js'\nexport { dataSourceCacheKey } from './render/index.js'\nexport type { SurfaceDataCache, LinkHref } from './render/index.js'\n\n// Surface event protocol\nexport { createSurfaceEventBus } from './render/index.js'\nexport { SurfaceEventContext } from './render/index.js'\nexport { useSurfaceEvents } from './render/index.js'\n\n// BehaviorSurfaceProvider — runtime surface wiring\nexport type { BehaviorSurfaceProviderProps } from './render/index.js'\nexport { BehaviorSurfaceProvider } from './render/index.js'\nexport { SurfaceIdContext } from './render/index.js'\nexport { useSurfaceId } from './render/index.js'\n\n// Shell × body: SPLIT shell selection (URL-projected), and the shell/body\n// classification the renderer lays out by.\nexport type {\n ShellSelectionStore,\n ShellSelectionOptions,\n ShellSelectionProviderProps,\n} from './render/index.js'\nexport type { LiteralProps } from './render/index.js'\nexport {\n ShellSelectionContext,\n ShellSelectionProvider,\n createShellSelectionStore,\n useShellSelection,\n} from './render/index.js'\n\n// Image Adapters\nexport { DefaultImageAdapter, NextImageAdapter } from './adapters/index.js'\nexport {\n SurfaceRenderer as BlockSurfaceRenderer,\n BlockRenderer,\n getBlockIds,\n findBlockById,\n updateBlockById,\n DataBoundSurfaceRenderer,\n surfaceNeedsDataBinding,\n blockActionsOf,\n resolveEndpoint,\n resolveBlockExpressions,\n literalPropsOf,\n resolveString,\n isHrefKey,\n isLinkMember,\n isExpressionLink,\n surfaceThemeToCSS,\n} from './render/index.js'\n// legacy first-party `*Block` component re-exports +\n// `defaultBlockComponents` map retired. Production rendering loads\n// components from CDN bundles via `BlockModuleLoader`; the static\n// component registry no longer ships from this package.\n\n// Capability system (definitions, type mapping, validation)\nexport * from './capability/index.js'\n\n// Data, routing, SEO, analytics, i18n capabilities\nexport * from './data/index.js'\nexport * from './routing/index.js'\nexport * from './seo/index.js'\nexport * from './analytics/index.js'\nexport * from './i18n/index.js'\n\n// Performance monitoring module\nexport type {\n WebVitalName,\n WebVitalRating,\n WebVitalMetric,\n WebVitalCallback,\n WebVitalsReport,\n RenderMetrics,\n RenderTimerConfig,\n PerformanceBudget,\n BudgetViolation,\n BudgetCheckResult,\n ReportDestination,\n ReporterConfig,\n PerformanceReport,\n} from './perf/index.js'\nexport {\n WebVitalsCollector,\n createWebVitalsCollector,\n rateMetric,\n RenderTimer,\n createRenderTimer,\n DEFAULT_BUDGET,\n BudgetChecker,\n createBudgetChecker,\n PerformanceReporter,\n createPerformanceReporter,\n} from './perf/index.js'\n\n// Accessibility (a11y) module\nexport type { AnnouncementLevel, LiveRegionConfig } from './a11y/index.js'\nexport { LiveRegionAnnouncer, createAnnouncer } from './a11y/index.js'\nexport type { FocusTrapConfig } from './a11y/index.js'\nexport {\n FocusTrapManager,\n FocusRestorer,\n createSkipLink,\n createFocusTrap,\n createFocusRestorer,\n} from './a11y/index.js'\nexport type { ArrowDirection, KeyboardNavConfig } from './a11y/index.js'\nexport {\n KeyboardNavigationManager,\n RovingTabIndex,\n createKeyboardNav,\n createRovingTabIndex,\n} from './a11y/index.js'\nexport type { ContrastResult } from './a11y/index.js'\nexport {\n hexToRgb,\n relativeLuminance,\n contrastRatio,\n checkContrast,\n meetsWCAG,\n} from './a11y/index.js'\n\n// tenant-scoped pack atom registry hook\nexport {\n useInstalledAtoms,\n type InstalledAtomDescriptor,\n type InstalledAtomKind,\n type InstalledAtomsState,\n type InstalledAtomsFetcher,\n type AtomManifestPayload,\n type AtomBlockDefinitionMetadata,\n} from './hooks/useInstalledAtoms.js'\n\n// The engine names no tenant: a host's tenant model (plan, entitlements,\n// storage, installations) belongs to the host.\n//\n// What the engine offers is the mechanism without the vocabulary: `EntitlementProvider`\n// and `useEntitlements` in ./render/capability-gate.tsx still enforce a claim\n// set, typed structurally as `EntitlementClaims`.\n\n// canonical home for block infrastructure (registry,\n// composition rules, rule engine, contexts, hooks, default block\n// components, schemas, 45 first-party block defs). Subpath import\n// `@pwfabric/runtime/blocks` is the recommended consumer entry; the root\n// re-exports above (SurfaceEventContext / useSurfaceEvents /\n// SurfaceIdContext / useSurfaceId / defaultBlockComponents / 21 block\n// components) now resolve via `runtime/render/*` → `runtime/blocks/*`\n// preserving React-context identity.\n"]}
|
|
@@ -58,6 +58,16 @@ export declare function surfaceNeedsDataBinding(surface: {
|
|
|
58
58
|
* - Otherwise → return trimmed lowercased (best-effort; won't match well-formed events)
|
|
59
59
|
*/
|
|
60
60
|
export declare function canonicalizeEventType(raw: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Whether a behavior aimed at `targetBlockId` hears an event from `blockId`.
|
|
63
|
+
*
|
|
64
|
+
* A block inside a `repeat` is drawn once per row, each copy with the id
|
|
65
|
+
* `<id>--<index>` (`<id>--<outer>--<inner>` in a nested repeat) — the id the
|
|
66
|
+
* event carries. The receipt can only name the TEMPLATE id; matching it
|
|
67
|
+
* exactly meant a behavior aimed at a repeated block never fired. The
|
|
68
|
+
* template id names every copy; a copy id still names that one copy.
|
|
69
|
+
*/
|
|
70
|
+
export declare function behaviorTargets(targetBlockId: string, blockId: string): boolean;
|
|
61
71
|
export declare function isSurfaceAction(value: unknown): value is SurfaceAction;
|
|
62
72
|
/**
|
|
63
73
|
* Guard the `navigate` action against XSS: only http(s) absolute URLs and
|