@chobantonov/jsonforms-extended-spec 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +126 -2
- package/conformance/authoring.json +2169 -0
- package/conformance/behavior.json +731 -0
- package/conformance/config-consumption.json +1531 -0
- package/conformance/expected-invalid.json +20 -0
- package/docs/audit.md +150 -0
- package/docs/conditional-fields.md +80 -0
- package/docs/draft-07-visual-support.md +43 -0
- package/docs/external-resources-proposal.md +536 -0
- package/docs/implementation-guide.md +180 -0
- package/docs/implementation-pitfalls.md +802 -0
- package/docs/implementation-web-typescript.md +41 -0
- package/docs/renderer-and-demo.md +1347 -0
- package/docs/renderer-selection.md +99 -0
- package/docs/spec.md +8321 -0
- package/docs/todo.md +149 -0
- package/examples/README.md +121 -0
- package/examples/additional-errors/README.md +169 -0
- package/examples/additional-errors/config.json +3 -0
- package/examples/additional-errors/data.json +11 -0
- package/examples/additional-errors/schema.json +56 -0
- package/examples/additional-errors/translations.json +64 -0
- package/examples/additional-errors/uischema.json +158 -0
- package/examples/additional-items-pagination/README.md +8 -0
- package/examples/additional-items-pagination/config.json +10 -0
- package/examples/additional-items-pagination/data.json +22 -0
- package/examples/additional-items-pagination/schema.json +30 -0
- package/examples/additional-items-pagination/translations.json +16 -0
- package/examples/additional-items-pagination/uischema.json +39 -0
- package/examples/additional-properties/README.md +188 -0
- package/examples/additional-properties/config.json +5 -0
- package/examples/additional-properties/data.json +31 -0
- package/examples/additional-properties/schema.json +78 -0
- package/examples/additional-properties/translations.json +80 -0
- package/examples/additional-properties/uischema.json +104 -0
- package/examples/ag-grid/README.md +62 -0
- package/examples/ag-grid/config.json +14 -0
- package/examples/ag-grid/data.json +124 -0
- package/examples/ag-grid/schema.json +48 -0
- package/examples/ag-grid/translations.json +58 -0
- package/examples/ag-grid/uischema.json +671 -0
- package/examples/array-choices/README.md +150 -0
- package/examples/array-choices/config.json +4 -0
- package/examples/array-choices/data.json +10 -0
- package/examples/array-choices/schema.json +68 -0
- package/examples/array-choices/translations.json +64 -0
- package/examples/array-choices/uischema.json +97 -0
- package/examples/array-controls/README.md +237 -0
- package/examples/array-controls/config.json +4 -0
- package/examples/array-controls/data.json +147 -0
- package/examples/array-controls/schema.json +374 -0
- package/examples/array-controls/translations.json +186 -0
- package/examples/array-controls/uischema.json +685 -0
- package/examples/array-detail-modes/README.md +11 -0
- package/examples/array-detail-modes/data.json +38 -0
- package/examples/array-detail-modes/schema.json +89 -0
- package/examples/array-detail-modes/translations.json +36 -0
- package/examples/array-detail-modes/uischema.json +73 -0
- package/examples/array-detail-modes/uischemas.d.mts +2 -0
- package/examples/array-detail-modes/uischemas.json +15 -0
- package/examples/boolean-controls/README.md +109 -0
- package/examples/boolean-controls/config.json +3 -0
- package/examples/boolean-controls/data.json +27 -0
- package/examples/boolean-controls/schema.json +98 -0
- package/examples/boolean-controls/translations.json +94 -0
- package/examples/boolean-controls/uischema.json +126 -0
- package/examples/button-actions/README.md +259 -0
- package/examples/button-actions/config.json +7 -0
- package/examples/button-actions/data.json +5 -0
- package/examples/button-actions/host.mjs +14 -0
- package/examples/button-actions/schema.json +20 -0
- package/examples/button-actions/translations.json +60 -0
- package/examples/button-actions/uischema.json +179 -0
- package/examples/catalog.json +634 -0
- package/examples/categorization/README.md +132 -0
- package/examples/categorization/config.json +7 -0
- package/examples/categorization/data.json +8 -0
- package/examples/categorization/schema.json +29 -0
- package/examples/categorization/translations.json +72 -0
- package/examples/categorization/uischema.json +288 -0
- package/examples/choice-controls/README.md +136 -0
- package/examples/choice-controls/config.json +10 -0
- package/examples/choice-controls/data.json +61 -0
- package/examples/choice-controls/schema.json +406 -0
- package/examples/choice-controls/translations.json +154 -0
- package/examples/choice-controls/uischema.json +575 -0
- package/examples/choice-controls/uischemas.d.mts +2 -0
- package/examples/choice-controls/uischemas.json +16 -0
- package/examples/code-editor/README.md +74 -0
- package/examples/code-editor/data.json +8 -0
- package/examples/code-editor/schema.json +28 -0
- package/examples/code-editor/translations.json +20 -0
- package/examples/code-editor/uischema.json +77 -0
- package/examples/collection-pagination/README.md +5 -0
- package/examples/collection-pagination/config.json +1 -0
- package/examples/collection-pagination/data.json +64 -0
- package/examples/collection-pagination/schema.json +23 -0
- package/examples/collection-pagination/translations.json +14 -0
- package/examples/collection-pagination/uischema.json +14 -0
- package/examples/color-control/README.md +151 -0
- package/examples/color-control/config.json +7 -0
- package/examples/color-control/data.json +11 -0
- package/examples/color-control/schema.json +61 -0
- package/examples/color-control/translations.json +76 -0
- package/examples/color-control/uischema.json +106 -0
- package/examples/combinators/README.md +223 -0
- package/examples/combinators/config.json +9 -0
- package/examples/combinators/data.json +23 -0
- package/examples/combinators/schema.json +232 -0
- package/examples/combinators/translations.json +178 -0
- package/examples/combinators/uischema.json +158 -0
- package/examples/conditional-fields/README.md +19 -0
- package/examples/conditional-fields/config.json +5 -0
- package/examples/conditional-fields/data.json +7 -0
- package/examples/conditional-fields/schema.json +59 -0
- package/examples/conditional-fields/translations.json +30 -0
- package/examples/conditional-fields/uischema.json +71 -0
- package/examples/container-validation-indicator/README.md +187 -0
- package/examples/container-validation-indicator/config.json +9 -0
- package/examples/container-validation-indicator/data.json +68 -0
- package/examples/container-validation-indicator/schema.json +222 -0
- package/examples/container-validation-indicator/translations.json +120 -0
- package/examples/container-validation-indicator/uischema.json +98 -0
- package/examples/cron-control/README.md +155 -0
- package/examples/cron-control/data.json +15 -0
- package/examples/cron-control/schema.json +72 -0
- package/examples/cron-control/translations.json +80 -0
- package/examples/cron-control/uischema.json +91 -0
- package/examples/destructive-confirmation/README.md +210 -0
- package/examples/destructive-confirmation/config.json +17 -0
- package/examples/destructive-confirmation/data.json +86 -0
- package/examples/destructive-confirmation/schema.json +204 -0
- package/examples/destructive-confirmation/translations.json +112 -0
- package/examples/destructive-confirmation/uischema.json +105 -0
- package/examples/draft-07-metaschema/README.md +11 -0
- package/examples/draft-07-metaschema/config.json +3 -0
- package/examples/draft-07-metaschema/data.json +25 -0
- package/examples/draft-07-metaschema/schema.json +172 -0
- package/examples/draft-07-metaschema/translations.json +10 -0
- package/examples/draft-07-metaschema/uischema.json +14 -0
- package/examples/dynamic-playground/README.md +95 -0
- package/examples/dynamic-playground/config.json +8 -0
- package/examples/dynamic-playground/configuration.json +152 -0
- package/examples/dynamic-playground/data.json +15 -0
- package/examples/dynamic-playground/dynamic-uischema.json +379 -0
- package/examples/dynamic-playground/host.mjs +37 -0
- package/examples/dynamic-playground/schema.json +48 -0
- package/examples/dynamic-playground/translations.json +76 -0
- package/examples/dynamic-playground/uischema.json +36 -0
- package/examples/editor-details/README.md +10 -0
- package/examples/editor-details/data.json +18 -0
- package/examples/editor-details/schema.json +49 -0
- package/examples/editor-details/translations.json +28 -0
- package/examples/editor-details/uischema.json +53 -0
- package/examples/editor-details/uischemas.d.mts +2 -0
- package/examples/editor-details/uischemas.json +14 -0
- package/examples/file-control/README.md +108 -0
- package/examples/file-control/data.json +28 -0
- package/examples/file-control/schema.json +89 -0
- package/examples/file-control/translations.json +46 -0
- package/examples/file-control/uischema.json +152 -0
- package/examples/group-layout/README.md +149 -0
- package/examples/group-layout/config.json +10 -0
- package/examples/group-layout/data.json +9 -0
- package/examples/group-layout/schema.json +51 -0
- package/examples/group-layout/translations.json +62 -0
- package/examples/group-layout/uischema.json +249 -0
- package/examples/index.d.ts +17 -0
- package/examples/index.js +69 -0
- package/examples/input-adornments/README.md +68 -0
- package/examples/input-adornments/data.json +41 -0
- package/examples/input-adornments/schema.json +207 -0
- package/examples/input-adornments/translations.json +106 -0
- package/examples/input-adornments/uischema.json +695 -0
- package/examples/job-application/README.md +23 -0
- package/examples/job-application/config.json +10 -0
- package/examples/job-application/data.json +68 -0
- package/examples/job-application/schema.json +196 -0
- package/examples/job-application/translations.json +388 -0
- package/examples/job-application/uischema.json +218 -0
- package/examples/job-application/uischemas.json +153 -0
- package/examples/json-editor/README.md +28 -0
- package/examples/json-editor/schema.json +1 -0
- package/examples/json-editor/translations.json +10 -0
- package/examples/json-editor/uischema.json +16 -0
- package/examples/json-inference/README.md +33 -0
- package/examples/json-inference/translations.json +10 -0
- package/examples/json-inference/uischema.json +16 -0
- package/examples/kitchen-sink/README.md +86 -0
- package/examples/kitchen-sink/config.json +14 -0
- package/examples/kitchen-sink/data.json +263 -0
- package/examples/kitchen-sink/invalid-data.json +263 -0
- package/examples/kitchen-sink/schema.json +515 -0
- package/examples/kitchen-sink/translations.json +270 -0
- package/examples/kitchen-sink/uischema.json +722 -0
- package/examples/label-interpolation/README.md +200 -0
- package/examples/label-interpolation/config.json +8 -0
- package/examples/label-interpolation/data.json +13 -0
- package/examples/label-interpolation/schema.json +64 -0
- package/examples/label-interpolation/translations.json +94 -0
- package/examples/label-interpolation/uischema.json +375 -0
- package/examples/layout-sizing/README.md +162 -0
- package/examples/layout-sizing/config.json +10 -0
- package/examples/layout-sizing/data.json +14 -0
- package/examples/layout-sizing/schema.json +58 -0
- package/examples/layout-sizing/translations.json +42 -0
- package/examples/layout-sizing/uischema.json +558 -0
- package/examples/markup-label/README.md +109 -0
- package/examples/markup-label/config.json +16 -0
- package/examples/markup-label/data.json +5 -0
- package/examples/markup-label/schema.json +24 -0
- package/examples/markup-label/translations.json +40 -0
- package/examples/markup-label/uischema.json +149 -0
- package/examples/mixed-control/README.md +164 -0
- package/examples/mixed-control/config.json +11 -0
- package/examples/mixed-control/data.json +70 -0
- package/examples/mixed-control/schema.json +221 -0
- package/examples/mixed-control/translations.json +158 -0
- package/examples/mixed-control/uischema.json +211 -0
- package/examples/null-control/README.md +111 -0
- package/examples/null-control/config.json +4 -0
- package/examples/null-control/data.json +6 -0
- package/examples/null-control/schema.json +36 -0
- package/examples/null-control/translations.json +42 -0
- package/examples/null-control/uischema.json +56 -0
- package/examples/numeric-controls/README.md +94 -0
- package/examples/numeric-controls/config.json +4 -0
- package/examples/numeric-controls/data.json +8 -0
- package/examples/numeric-controls/schema.json +52 -0
- package/examples/numeric-controls/translations.json +56 -0
- package/examples/numeric-controls/uischema.json +77 -0
- package/examples/object-control/README.md +220 -0
- package/examples/object-control/config.json +4 -0
- package/examples/object-control/data.json +62 -0
- package/examples/object-control/schema.json +252 -0
- package/examples/object-control/translations.json +160 -0
- package/examples/object-control/uischema.json +275 -0
- package/examples/object-control/uischemas.d.mts +2 -0
- package/examples/object-control/uischemas.json +59 -0
- package/examples/password-control/README.md +119 -0
- package/examples/password-control/config.json +3 -0
- package/examples/password-control/data.json +18 -0
- package/examples/password-control/schema.json +65 -0
- package/examples/password-control/translations.json +64 -0
- package/examples/password-control/uischema.json +94 -0
- package/examples/pre-touch-errors/README.md +176 -0
- package/examples/pre-touch-errors/config.json +4 -0
- package/examples/pre-touch-errors/data.json +5 -0
- package/examples/pre-touch-errors/schema.json +56 -0
- package/examples/pre-touch-errors/translations.json +68 -0
- package/examples/pre-touch-errors/uischema.json +85 -0
- package/examples/presentation/README.md +148 -0
- package/examples/presentation/config.json +9 -0
- package/examples/presentation/data.json +6 -0
- package/examples/presentation/schema.json +21 -0
- package/examples/presentation/translations.json +64 -0
- package/examples/presentation/uischema.json +210 -0
- package/examples/property-pagination/README.md +5 -0
- package/examples/property-pagination/config.json +1 -0
- package/examples/property-pagination/data.json +17 -0
- package/examples/property-pagination/schema.json +14 -0
- package/examples/property-pagination/translations.json +10 -0
- package/examples/property-pagination/uischema.json +24 -0
- package/examples/recursive-tree/README.md +49 -0
- package/examples/recursive-tree/config.json +1 -0
- package/examples/recursive-tree/data.json +40 -0
- package/examples/recursive-tree/schema.json +89 -0
- package/examples/recursive-tree/translations.json +42 -0
- package/examples/recursive-tree/uischema.json +84 -0
- package/examples/recursive-tree/uischemas.d.mts +2 -0
- package/examples/recursive-tree/uischemas.json +51 -0
- package/examples/split-layout/README.md +123 -0
- package/examples/split-layout/config.json +3 -0
- package/examples/split-layout/data.json +13 -0
- package/examples/split-layout/schema.json +50 -0
- package/examples/split-layout/translations.json +50 -0
- package/examples/split-layout/uischema.json +204 -0
- package/examples/string-controls/README.md +159 -0
- package/examples/string-controls/config.json +5 -0
- package/examples/string-controls/data.json +13 -0
- package/examples/string-controls/schema.json +70 -0
- package/examples/string-controls/translations.json +76 -0
- package/examples/string-controls/uischema.json +148 -0
- package/examples/table-row-details/README.md +69 -0
- package/examples/table-row-details/config.json +7 -0
- package/examples/table-row-details/data.json +280 -0
- package/examples/table-row-details/schema.json +61 -0
- package/examples/table-row-details/translations.json +56 -0
- package/examples/table-row-details/uischema.json +1303 -0
- package/examples/template-layout/README.md +250 -0
- package/examples/template-layout/config.json +9 -0
- package/examples/template-layout/data.json +20 -0
- package/examples/template-layout/host.mjs +13 -0
- package/examples/template-layout/schema.json +48 -0
- package/examples/template-layout/translations.json +70 -0
- package/examples/template-layout/uischema.json +177 -0
- package/examples/template-slots/README.md +19 -0
- package/examples/template-slots/data.json +4 -0
- package/examples/template-slots/schema.json +11 -0
- package/examples/template-slots/translations.json +26 -0
- package/examples/template-slots/uischema.json +47 -0
- package/examples/template-slots/uischemas.d.mts +2 -0
- package/examples/template-slots/uischemas.json +56 -0
- package/examples/temporal-controls/README.md +325 -0
- package/examples/temporal-controls/data.json +44 -0
- package/examples/temporal-controls/schema.json +208 -0
- package/examples/temporal-controls/translations.json +156 -0
- package/examples/temporal-controls/uischema.json +297 -0
- package/examples/tree-max-depth/README.md +5 -0
- package/examples/tree-max-depth/config.json +3 -0
- package/examples/tree-max-depth/data.json +31 -0
- package/examples/tree-max-depth/schema.json +258 -0
- package/examples/tree-max-depth/translations.json +42 -0
- package/examples/tree-max-depth/uischema.json +16 -0
- package/examples/tree-max-depth/uischemas.d.mts +2 -0
- package/examples/tree-max-depth/uischemas.json +50 -0
- package/examples/tuple-control/README.md +335 -0
- package/examples/tuple-control/config.json +4 -0
- package/examples/tuple-control/data.json +61 -0
- package/examples/tuple-control/schema.json +218 -0
- package/examples/tuple-control/translations.json +142 -0
- package/examples/tuple-control/uischema.json +128 -0
- package/examples/tuple-control/uischemas.d.mts +2 -0
- package/examples/tuple-control/uischemas.json +125 -0
- package/examples/validator-profile/README.md +197 -0
- package/examples/validator-profile/config.json +9 -0
- package/examples/validator-profile/data.json +16 -0
- package/examples/validator-profile/schema.json +139 -0
- package/examples/validator-profile/translations.json +34 -0
- package/examples/validator-profile/uischema.json +59 -0
- package/package.json +83 -3
- package/provenance.json +140 -0
- package/schemas/README.md +77 -0
- package/schemas/example.schema.json +37 -0
- package/schemas/jsonforms-config.schema.json +427 -0
- package/schemas/jsonforms-dynamic-uischema.schema.json +220 -0
- package/schemas/jsonforms-extended-config.schema.json +327 -0
- package/schemas/jsonforms-extended-uischema.schema.json +1923 -0
- package/schemas/jsonforms-rule.schema.json +104 -0
- package/schemas/jsonforms-uischema.schema.json +1421 -0
- package/typescript/README.md +540 -0
- package/typescript/lib/authoring/cssLength.d.ts +33 -0
- package/typescript/lib/authoring/cssLength.js +25 -0
- package/typescript/lib/authoring/dynamic.d.ts +73 -0
- package/typescript/lib/authoring/dynamic.js +8 -0
- package/typescript/lib/authoring/forSchema.d.ts +376 -0
- package/typescript/lib/authoring/forSchema.js +84 -0
- package/typescript/lib/authoring/schemaTypes.d.ts +111 -0
- package/typescript/lib/authoring/schemaTypes.js +15 -0
- package/typescript/lib/index.d.ts +4 -0
- package/typescript/lib/index.js +20 -0
- package/typescript/package.json +1 -0
- package/typescript/src/authoring/cssLength.ts +79 -0
- package/typescript/src/authoring/dynamic.ts +96 -0
- package/typescript/src/authoring/forSchema.ts +419 -0
- package/typescript/src/authoring/schemaTypes.ts +143 -0
- package/typescript/src/index.ts +4 -0
- package/typescript/test/schemaContract.test.ts +626 -0
- package/typescript/test/tsconfig.json +10 -0
- package/typescript/test/typedAuthoring.test.ts +140 -0
- package/typescript/test/typedAuthoringCoverage.test.ts +145 -0
- package/typescript/test/typedAuthoringCssLength.test.ts +81 -0
- package/typescript/test/typedAuthoringNames.test.ts +90 -0
- package/typescript/test/typedDynamic.test.ts +88 -0
- package/typescript/tsconfig.json +15 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Example: label interpolation
|
|
2
|
+
|
|
3
|
+
**Example ID:** `label-interpolation`\
|
|
4
|
+
**Demo entry:** **Spec: Label interpolation** (`#spec-label-interpolation`)\
|
|
5
|
+
**Domain:** a subscription billing summary\
|
|
6
|
+
**Specs covered:**
|
|
7
|
+
|
|
8
|
+
- [Internationalizable text and interpolation](../../docs/spec.md#9-internationalizable-text)
|
|
9
|
+
- [Markdown policy](../../docs/spec.md#9-internationalizable-text)
|
|
10
|
+
- [Template grammar](../../docs/spec.md#9-internationalizable-text)
|
|
11
|
+
- [CEL as the one expression language](../../docs/spec.md#9-internationalizable-text)
|
|
12
|
+
|
|
13
|
+
`options.interpolate: true` evaluates the `{…}` placeholders in a label's
|
|
14
|
+
text. `options.markup: "markdown"` parses the result. They are independent,
|
|
15
|
+
and the interesting part is what happens when both are on.
|
|
16
|
+
|
|
17
|
+
## Files
|
|
18
|
+
|
|
19
|
+
| File | Role |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `schema.json` | A subscription, including two properties with JavaScript-flavoured names. |
|
|
22
|
+
| `uischema.json` | A `Categorization`: one tab per feature, then one for incorrect usage. Every tab carries the editors for what it shows. |
|
|
23
|
+
| `data.json` | `displayName` contains Markdown, `promoCode` is deliberately **absent**, `constructor` is an ordinary string. |
|
|
24
|
+
| `config.json` | `dynamicValues.enabled: true`, without which a parameter cannot read `data.*`. |
|
|
25
|
+
| `translations.json` | English and Bulgarian, including `plan.*` keys that `translate()` looks up. |
|
|
26
|
+
|
|
27
|
+
## The tabs
|
|
28
|
+
|
|
29
|
+
Organised per feature, and **the correct-usage tabs carry no diagnostics at
|
|
30
|
+
all** — so "is everything working" is answered by looking rather than by
|
|
31
|
+
reading each message to decide whether it was expected. Every failure lives on
|
|
32
|
+
the last tab.
|
|
33
|
+
|
|
34
|
+
Each tab has the editors for the fields it uses, so the text can be watched
|
|
35
|
+
changing rather than taken on trust.
|
|
36
|
+
|
|
37
|
+
| Tab | Shows |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| **Interpolation** | static parameters, data through a parameter, a plural, absent data, a literal brace |
|
|
40
|
+
| **Markdown** | Markdown with no interpolation |
|
|
41
|
+
| **Both together** | a value inside the author's own markup, and a value that *contains* markup |
|
|
42
|
+
| **Locale and translation** | `translate()`, `date()`, `currency()`, `number()`, and a value left unformatted |
|
|
43
|
+
| **Interpolation off** | what the same text does without the option |
|
|
44
|
+
| **JavaScript names** | a property called `constructor`, and one called `toString` |
|
|
45
|
+
| **Incorrect usage** | the five things that are reported, and why |
|
|
46
|
+
|
|
47
|
+
## Two scopes, and why the catalog never names a data path
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"type": "Label",
|
|
52
|
+
"text": "You are subscribed to {product}.",
|
|
53
|
+
"options": {
|
|
54
|
+
"interpolate": true,
|
|
55
|
+
"textParams": { "product": "{data.customerName}" }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The **text** may name only the declared parameters. The **parameter's value**
|
|
61
|
+
is where the data is read. So a translator receives
|
|
62
|
+
`You are subscribed to {product}.` and never has to know, or preserve, a path
|
|
63
|
+
into the schema.
|
|
64
|
+
|
|
65
|
+
That is the whole reason for the split. A catalog full of
|
|
66
|
+
`{data.customerName}` is coupled to the schema: rename the field and every
|
|
67
|
+
translation in every language breaks at once.
|
|
68
|
+
|
|
69
|
+
The **Incorrect usage** tab proves the restriction is real — one label writes
|
|
70
|
+
`{data.customerName}` straight into its text and renders nothing there, with a
|
|
71
|
+
diagnostic, however open the gate is.
|
|
72
|
+
|
|
73
|
+
A single `{` opens a placeholder; `{{` is a literal brace — §11.4's grammar,
|
|
74
|
+
**inverted from Mustache**.
|
|
75
|
+
|
|
76
|
+
## `interpolate` governs the whole feature
|
|
77
|
+
|
|
78
|
+
The **Interpolation off** tab is the control case. The same braces, with no
|
|
79
|
+
`interpolate`, are just characters: nothing is resolved, declared parameters
|
|
80
|
+
are inert, and — importantly — **nothing is reported**, because nothing was
|
|
81
|
+
asked for.
|
|
82
|
+
|
|
83
|
+
## Expressions stay in the text, so plurals stay in the catalog
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
Your plan includes {seats} {seats == 1 ? "seat" : "seats"}.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The text evaluates expressions over the **parameters**. If it were bare
|
|
90
|
+
substitution the plural would have to move into the UI schema, where only the
|
|
91
|
+
authoring language could reach it. Here each catalog entry writes its own
|
|
92
|
+
test, and the Bulgarian one says `{seats == 1 ? "място" : "места"}`.
|
|
93
|
+
|
|
94
|
+
**This is the cost of an expression language over a message format.** A
|
|
95
|
+
ternary suits languages that split at one; a language with more plural
|
|
96
|
+
categories needs a branch per category.
|
|
97
|
+
|
|
98
|
+
## A locale decides more than the words
|
|
99
|
+
|
|
100
|
+
`{currency(amount, "EUR")}`, `{date(renewal)}` and `{number(price, 2)}` render
|
|
101
|
+
per language from the *same* catalog string:
|
|
102
|
+
|
|
103
|
+
| | English | Bulgarian |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| `currency(amount, "EUR")` | `€148.50` | `148,50 €` |
|
|
106
|
+
| `date(renewal)` | `Oct 1, 2026` | `1.10.2026 г.` |
|
|
107
|
+
|
|
108
|
+
Formatting is **functions you call**, not something applied to every number —
|
|
109
|
+
an implicit rule cannot tell a price from an order number, which is why
|
|
110
|
+
`Reference 2026` stays `2026` rather than becoming `2,026`.
|
|
111
|
+
|
|
112
|
+
The Bulgarian renewal string is phrased with a colon and no trailing period,
|
|
113
|
+
because a Bulgarian medium date already ends in `г.`. Punctuation belongs to
|
|
114
|
+
the catalog entry.
|
|
115
|
+
|
|
116
|
+
## `translate()` turns a value into a word
|
|
117
|
+
|
|
118
|
+
`data.plan` is `"Team"` in every language — a key, not a word. The parameter
|
|
119
|
+
looks it up:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
"textParams": { "plan": "{translate(\"plan.\" + data.plan)}" }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
and the catalog string says only `{plan}`.
|
|
126
|
+
|
|
127
|
+
**It belongs in the parameter, not in the text**, and that follows from a
|
|
128
|
+
general test: *does the expression's shape differ by language?* A plural does,
|
|
129
|
+
so it lives in the catalog. A `translate`, `currency` or `date` call does not —
|
|
130
|
+
it is identical in every language, so putting it in the text means every
|
|
131
|
+
translator must reproduce it, and one who drops the `translate(...)` wrapper
|
|
132
|
+
silently renders `Team` instead of `Екип`.
|
|
133
|
+
|
|
134
|
+
**`translate` is registered into the evaluator, and could not have arrived any
|
|
135
|
+
other way.** A function placed in `context` is not callable, not even
|
|
136
|
+
readable — measured. That is what stops a host widening what an expression can
|
|
137
|
+
do by putting a callback in the data.
|
|
138
|
+
|
|
139
|
+
## JavaScript names are ordinary JSON keys
|
|
140
|
+
|
|
141
|
+
`constructor` is a legal property name, and the evaluator cannot read a plain
|
|
142
|
+
object that has one: its type check is `switch (v.constructor)`, which a data
|
|
143
|
+
key of that name shadows, so it rejects the **whole object** and every sibling
|
|
144
|
+
field with it.
|
|
145
|
+
|
|
146
|
+
The evaluation is retried with the objects rebuilt as maps, whose entries
|
|
147
|
+
cannot shadow `.constructor`. The retry runs only after that specific failure,
|
|
148
|
+
so ordinary data is never walked or converted. `__proto__`, `toString`,
|
|
149
|
+
`valueOf` and `hasOwnProperty` need no repair at all.
|
|
150
|
+
|
|
151
|
+
## Both together, and the order that matters
|
|
152
|
+
|
|
153
|
+
The pipeline is **resolve parameters → substitute into the text → escape →
|
|
154
|
+
parse**.
|
|
155
|
+
|
|
156
|
+
The summary label puts a value *inside* the author's markup, so the `**` still
|
|
157
|
+
makes bold. The account-holder label is the other half: `displayName` is
|
|
158
|
+
`Ana **Petrova**` in the data and renders with its asterisks showing.
|
|
159
|
+
|
|
160
|
+
**A value cannot become markup.** Substituted values are escaped before
|
|
161
|
+
parsing — and only the values, never the surrounding text, or the author's own
|
|
162
|
+
`**` would die with them. Edit the field to `# not a heading` and it stays
|
|
163
|
+
text.
|
|
164
|
+
|
|
165
|
+
URLs get a second line of defence: a destination failing the URL policy (§12)
|
|
166
|
+
is refused whether or not escaping caught it.
|
|
167
|
+
|
|
168
|
+
## What is reported, and what is not
|
|
169
|
+
|
|
170
|
+
**Absent data is not an authoring error.** `promoCode` is not in the record —
|
|
171
|
+
the normal state of a form being filled in — so it renders as nothing and says
|
|
172
|
+
nothing. Reporting it would put a developer-facing message beside half the
|
|
173
|
+
labels of every fresh form, which is how people learn to ignore diagnostics.
|
|
174
|
+
|
|
175
|
+
What stays an error is anything wrong *however* the form is filled in, and the
|
|
176
|
+
**Incorrect usage** tab has one of each:
|
|
177
|
+
|
|
178
|
+
| Label | Reported |
|
|
179
|
+
| --- | --- |
|
|
180
|
+
| a data path in the text | `Unknown variable: data` |
|
|
181
|
+
| a parameter never declared | `Unknown variable: customer` |
|
|
182
|
+
| a function that does not exist | `no matching overload for 'shout'` |
|
|
183
|
+
| a namespace that does not exist | `Unknown variable: nowhere` |
|
|
184
|
+
| a parameter named `locale` | `textParams.locale is a reserved name` |
|
|
185
|
+
|
|
186
|
+
Each keeps the rest of its sentence — a label is content, and content is worth
|
|
187
|
+
showing even when part of it is missing.
|
|
188
|
+
|
|
189
|
+
## The gate
|
|
190
|
+
|
|
191
|
+
`data`, `item`, `config` and `context` are reachable **from a parameter's
|
|
192
|
+
value** only when `jsonformsExtended.dynamicValues.enabled` is true — §12's
|
|
193
|
+
gate, which defaults **closed**. The text never sees those namespaces, gate or
|
|
194
|
+
no gate.
|
|
195
|
+
|
|
196
|
+
## Standalone host setup
|
|
197
|
+
|
|
198
|
+
Load the JSON assets listed in [the catalog](../catalog.json) into a host
|
|
199
|
+
with the relevant renderer capabilities. No framework registration module is
|
|
200
|
+
required by this package.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"customerName": "Northwind Books",
|
|
3
|
+
"displayName": "Ana **Petrova**",
|
|
4
|
+
"plan": "Team",
|
|
5
|
+
"seats": 3,
|
|
6
|
+
"amountDue": 148.5,
|
|
7
|
+
"autoRenew": true,
|
|
8
|
+
"renewalDate": "2026-10-01",
|
|
9
|
+
"seatPrice": 49.5,
|
|
10
|
+
"reference": 2026,
|
|
11
|
+
"constructor": "a perfectly ordinary value",
|
|
12
|
+
"toString": "also ordinary"
|
|
13
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"customerName": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"title": "Account name"
|
|
7
|
+
},
|
|
8
|
+
"displayName": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"title": "Account holder"
|
|
11
|
+
},
|
|
12
|
+
"plan": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"title": "Plan",
|
|
15
|
+
"enum": [
|
|
16
|
+
"Starter",
|
|
17
|
+
"Team",
|
|
18
|
+
"Enterprise"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"seats": {
|
|
22
|
+
"type": "integer",
|
|
23
|
+
"title": "Seats",
|
|
24
|
+
"minimum": 1
|
|
25
|
+
},
|
|
26
|
+
"amountDue": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"title": "Amount due"
|
|
29
|
+
},
|
|
30
|
+
"autoRenew": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"title": "Renew automatically"
|
|
33
|
+
},
|
|
34
|
+
"renewalDate": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"format": "date",
|
|
37
|
+
"title": "Renews on"
|
|
38
|
+
},
|
|
39
|
+
"seatPrice": {
|
|
40
|
+
"type": "number",
|
|
41
|
+
"title": "Seat price"
|
|
42
|
+
},
|
|
43
|
+
"reference": {
|
|
44
|
+
"type": "integer",
|
|
45
|
+
"title": "Reference"
|
|
46
|
+
},
|
|
47
|
+
"promoCode": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"title": "Promotional code"
|
|
50
|
+
},
|
|
51
|
+
"constructor": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"title": "Constructor (a legal property name)"
|
|
54
|
+
},
|
|
55
|
+
"toString": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"title": "toString (a legal property name)"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"required": [
|
|
61
|
+
"customerName",
|
|
62
|
+
"seats"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"product.text": "You are subscribed to {product}.",
|
|
4
|
+
"seats.text": "Your plan includes {seats} {seats == 1 ? \"seat\" : \"seats\"}.",
|
|
5
|
+
"promo.text": "Promotional code: {code}",
|
|
6
|
+
"literal.text": "Write {{seats}} to show a placeholder without resolving it.",
|
|
7
|
+
"renewal.text": "Invoices are issued on the **first working day** of each month. See the [billing terms](https://example.com/billing).",
|
|
8
|
+
"summary.text": "**{account}** is on the {plan} plan, and the next invoice is {amount}.",
|
|
9
|
+
"holder.text": "Account holder: {holder}",
|
|
10
|
+
"planName.text": "Your plan is {plan}.",
|
|
11
|
+
"renews.text": "It renews on {renewal}.",
|
|
12
|
+
"price.text": "Seat price {price}, or {beforeTax} before tax.",
|
|
13
|
+
"reference.text": "Reference {ref} is not a quantity, so it is not formatted.",
|
|
14
|
+
"offPlain.text": "Without interpolate, {product} and {data.customerName} are just characters.",
|
|
15
|
+
"offParams.text": "Declared parameters are inert too: {product}.",
|
|
16
|
+
"ctor.text": "A property called constructor: \"{ctor}\".",
|
|
17
|
+
"ctorSibling.text": "Its siblings are still readable: \"{account}\".",
|
|
18
|
+
"tostring.text": "And a property called toString: \"{ts}\".",
|
|
19
|
+
"direct.text": "A data path in the text: \"{data.customerName}\".",
|
|
20
|
+
"undeclared.text": "A parameter that was never declared: \"{customer}\".",
|
|
21
|
+
"unknownFn.text": "A function that does not exist: \"{shout(account)}\".",
|
|
22
|
+
"badNamespace.text": "A namespace that does not exist: \"{who}\".",
|
|
23
|
+
"reserved.text": "A parameter named after a reserved name: \"{locale}\".",
|
|
24
|
+
"plan.Starter": "Starter",
|
|
25
|
+
"plan.Team": "Team",
|
|
26
|
+
"plan.Enterprise": "Enterprise",
|
|
27
|
+
"error.required": "This field is required.",
|
|
28
|
+
"customerName.label": "Account name",
|
|
29
|
+
"displayName.label": "Account holder",
|
|
30
|
+
"plan.label": "Plan",
|
|
31
|
+
"seats.label": "Seats",
|
|
32
|
+
"amountDue.label": "Amount due",
|
|
33
|
+
"autoRenew.label": "Renew automatically",
|
|
34
|
+
"renewalDate.label": "Renews on",
|
|
35
|
+
"seatPrice.label": "Seat price",
|
|
36
|
+
"reference.label": "Reference",
|
|
37
|
+
"promoCode.label": "Promotional code",
|
|
38
|
+
"constructor.label": "Constructor (a legal property name)",
|
|
39
|
+
"toString.label": "toString (a legal property name)",
|
|
40
|
+
"Interpolation": "Interpolation",
|
|
41
|
+
"Markdown": "Markdown",
|
|
42
|
+
"Both together": "Both together",
|
|
43
|
+
"Locale and translation": "Locale and translation",
|
|
44
|
+
"Interpolation off": "Interpolation off",
|
|
45
|
+
"JavaScript names": "JavaScript names",
|
|
46
|
+
"Incorrect usage": "Incorrect usage"
|
|
47
|
+
},
|
|
48
|
+
"bg": {
|
|
49
|
+
"product.text": "Абонирани сте за {product}.",
|
|
50
|
+
"seats.text": "Планът ви включва {seats} {seats == 1 ? \"място\" : \"места\"}.",
|
|
51
|
+
"promo.text": "Промоционален код: {code}",
|
|
52
|
+
"literal.text": "Напишете {{seats}}, за да покажете заместител, без да се изчислява.",
|
|
53
|
+
"renewal.text": "Фактурите се издават на **първия работен ден** от месеца. Вижте [условията за плащане](https://example.com/billing).",
|
|
54
|
+
"summary.text": "**{account}** е на план {plan}, а следващата фактура е {amount}.",
|
|
55
|
+
"holder.text": "Титуляр на акаунта: {holder}",
|
|
56
|
+
"planName.text": "Вашият план е {plan}.",
|
|
57
|
+
"renews.text": "Дата на подновяване: {renewal}",
|
|
58
|
+
"price.text": "Цена на място {price}, или {beforeTax} без данък.",
|
|
59
|
+
"reference.text": "Номер {ref} не е количество, затова не се форматира.",
|
|
60
|
+
"offPlain.text": "Без interpolate {product} и {data.customerName} са просто знаци.",
|
|
61
|
+
"offParams.text": "Декларираните параметри също не се използват: {product}.",
|
|
62
|
+
"ctor.text": "Свойство с име constructor: „{ctor}“.",
|
|
63
|
+
"ctorSibling.text": "Съседните свойства се четат нормално: „{account}“.",
|
|
64
|
+
"tostring.text": "И свойство с име toString: „{ts}“.",
|
|
65
|
+
"direct.text": "Път до данни в текста: „{data.customerName}“.",
|
|
66
|
+
"undeclared.text": "Недеклариран параметър: „{customer}“.",
|
|
67
|
+
"unknownFn.text": "Несъществуваща функция: „{shout(account)}“.",
|
|
68
|
+
"badNamespace.text": "Несъществуващо пространство от имена: „{who}“.",
|
|
69
|
+
"reserved.text": "Параметър със запазено име: „{locale}“.",
|
|
70
|
+
"plan.Starter": "Начален",
|
|
71
|
+
"plan.Team": "Екип",
|
|
72
|
+
"plan.Enterprise": "Корпоративен",
|
|
73
|
+
"error.required": "Полето е задължително.",
|
|
74
|
+
"customerName.label": "Име на акаунта",
|
|
75
|
+
"displayName.label": "Титуляр на акаунта",
|
|
76
|
+
"plan.label": "План",
|
|
77
|
+
"seats.label": "Места",
|
|
78
|
+
"amountDue.label": "Дължима сума",
|
|
79
|
+
"autoRenew.label": "Автоматично подновяване",
|
|
80
|
+
"renewalDate.label": "Дата на подновяване",
|
|
81
|
+
"seatPrice.label": "Цена на място",
|
|
82
|
+
"reference.label": "Номер",
|
|
83
|
+
"promoCode.label": "Промоционален код",
|
|
84
|
+
"constructor.label": "Constructor (допустимо име на свойство)",
|
|
85
|
+
"toString.label": "toString (допустимо име на свойство)",
|
|
86
|
+
"Interpolation": "Заместване в текста",
|
|
87
|
+
"Markdown": "Markdown",
|
|
88
|
+
"Both together": "Двете заедно",
|
|
89
|
+
"Locale and translation": "Език и превод",
|
|
90
|
+
"Interpolation off": "Без заместване",
|
|
91
|
+
"JavaScript names": "JavaScript имена",
|
|
92
|
+
"Incorrect usage": "Неправилна употреба"
|
|
93
|
+
}
|
|
94
|
+
}
|