Skip to content

Commit 550c524

Browse files
committed
fixes
1 parent 87c92ae commit 550c524

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/core/src/props.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ import { evaluateVisibility, type VisibilityContext } from "./visibility";
2424
* - `{ $cond, $then, $else }` conditionally picks a value
2525
* - `{ $computed: string, args?: Record<string, PropExpression> }` calls a
2626
* registered function with resolved args and returns the result
27-
* - `{ $template: string }` interpolates `${/path}` references in the
28-
* string with values from the state model
27+
* - `{ $template: string }` interpolates `${/path}` and `${field}`
28+
* references. Absolute paths (`${/path}`) resolve against the state
29+
* model. Bare names (`${field}`) resolve against the current repeat
30+
* item first, then fall back to the state model at `/<field>`.
2931
* - Any other value is a literal (passthrough)
3032
*/
3133
export type PropExpression<T = unknown> =

packages/core/src/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,10 +943,10 @@ Note: state patches appear right after the elements that use them, so the UI fil
943943
);
944944
lines.push("");
945945
lines.push(
946-
'4. Template: `{ "$template": "Hello, ${/name}!" }` - interpolates `${/path}` references in the string with values from the state model.',
946+
'4. Template: `{ "$template": "Hello, ${/name}!" }` - interpolates references in the string. Absolute paths like `${/path}` resolve against the state model. Bare names like `${field}` resolve against the current repeat item first, then fall back to the state model at `/<field>`.',
947947
);
948948
lines.push(
949-
' Example: `"label": { "$template": "Items: ${/cart/count} | Total: ${/cart/total}" }` renders "Items: 3 | Total: 42.00" when /cart/count is 3 and /cart/total is 42.00.',
949+
' Example: `"label": { "$template": "Items: ${/cart/count} | Total: ${/cart/total}" }` renders "Items: 3 | Total: 42.00" when /cart/count is 3 and /cart/total is 42.00. Inside a repeat, `{ "$template": "${name} - ${email}" }` reads name and email from each item.',
950950
);
951951
lines.push("");
952952

0 commit comments

Comments
 (0)