@chobantonov/jsonforms-extended-spec 0.4.0 → 1.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.
@@ -0,0 +1,231 @@
1
+ {
2
+ "section": "9.3a",
3
+ "description": "Portable CEL text-helper vectors. For utf16CodeUnits, construct scope.value from those UTF-16 code units before evaluation. Numeric reference values preserve CEL integer precision. Execute cases in each host.",
4
+ "cases": [
5
+ {
6
+ "id": "reserved-delimiters",
7
+ "expression": "encodeUriComponent(value)",
8
+ "scope": {
9
+ "value": "a/b?x=1&y=#frag"
10
+ },
11
+ "expected": "a%2Fb%3Fx%3D1%26y%3D%23frag"
12
+ },
13
+ {
14
+ "id": "unicode-and-space",
15
+ "expression": "encodeUriComponent(value)",
16
+ "scope": {
17
+ "value": "Име 😀"
18
+ },
19
+ "expected": "%D0%98%D0%BC%D0%B5%20%F0%9F%98%80"
20
+ },
21
+ {
22
+ "id": "literal-percent",
23
+ "expression": "encodeUriComponent(value)",
24
+ "scope": {
25
+ "value": "a%2Fb"
26
+ },
27
+ "expected": "a%252Fb"
28
+ },
29
+ {
30
+ "id": "unescaped-component-characters",
31
+ "expression": "encodeUriComponent(value)",
32
+ "scope": {
33
+ "value": "a(b)!*'~-_."
34
+ },
35
+ "expected": "a(b)!*'~-_."
36
+ },
37
+ {
38
+ "id": "unbalanced-markup-delimiters",
39
+ "expression": "encodeUriComponent(value)",
40
+ "scope": {
41
+ "value": "a)b('"
42
+ },
43
+ "expected": "a)b('"
44
+ },
45
+ {
46
+ "id": "empty-string",
47
+ "expression": "encodeUriComponent(value)",
48
+ "scope": {
49
+ "value": ""
50
+ },
51
+ "expected": ""
52
+ },
53
+ {
54
+ "id": "explicit-numeric-conversion",
55
+ "expression": "encodeUriComponent(string(value))",
56
+ "scope": {
57
+ "value": 42
58
+ },
59
+ "expected": "42"
60
+ },
61
+ {
62
+ "id": "numeric-input-is-not-coerced",
63
+ "expression": "encodeUriComponent(value)",
64
+ "scope": {
65
+ "value": 42
66
+ },
67
+ "expectError": true
68
+ },
69
+ {
70
+ "id": "null-input-is-not-coerced",
71
+ "expression": "encodeUriComponent(value)",
72
+ "scope": {
73
+ "value": null
74
+ },
75
+ "expectError": true
76
+ },
77
+ {
78
+ "id": "unpaired-surrogate",
79
+ "expression": "encodeUriComponent(value)",
80
+ "scope": {
81
+ "value": ""
82
+ },
83
+ "expectError": true,
84
+ "utf16CodeUnits": [
85
+ 55296
86
+ ]
87
+ }
88
+ ],
89
+ "numericCases": [
90
+ {
91
+ "id": "int-fixed-fraction",
92
+ "expression": "number(1234, 2)",
93
+ "scope": {},
94
+ "format": "number",
95
+ "precision": 2,
96
+ "numericType": "int",
97
+ "referenceValue": "1234"
98
+ },
99
+ {
100
+ "id": "double-fixed-fraction",
101
+ "expression": "number(value, 2)",
102
+ "scope": {
103
+ "value": 1234.5
104
+ },
105
+ "format": "number",
106
+ "precision": 2,
107
+ "numericType": "double",
108
+ "referenceValue": "1234.5"
109
+ },
110
+ {
111
+ "id": "int-computation-fixed-fraction",
112
+ "expression": "number(size(values), 2)",
113
+ "scope": {
114
+ "values": [
115
+ "a",
116
+ "b"
117
+ ]
118
+ },
119
+ "format": "number",
120
+ "precision": 2,
121
+ "numericType": "int",
122
+ "referenceValue": "2"
123
+ },
124
+ {
125
+ "id": "int64-fixed-fraction",
126
+ "expression": "number(9007199254740993, 2)",
127
+ "scope": {},
128
+ "format": "number",
129
+ "precision": 2,
130
+ "numericType": "int",
131
+ "referenceValue": "9007199254740993"
132
+ },
133
+ {
134
+ "id": "int-percent",
135
+ "expression": "percent(1)",
136
+ "scope": {},
137
+ "format": "percent",
138
+ "numericType": "int",
139
+ "referenceValue": "1"
140
+ },
141
+ {
142
+ "id": "double-percent",
143
+ "expression": "percent(value)",
144
+ "scope": {
145
+ "value": 0.25
146
+ },
147
+ "format": "percent",
148
+ "numericType": "double",
149
+ "referenceValue": "0.25"
150
+ },
151
+ {
152
+ "id": "int-computation-percent",
153
+ "expression": "percent(size(values))",
154
+ "scope": {
155
+ "values": [
156
+ "a",
157
+ "b"
158
+ ]
159
+ },
160
+ "format": "percent",
161
+ "numericType": "int",
162
+ "referenceValue": "2"
163
+ },
164
+ {
165
+ "id": "int64-currency",
166
+ "expression": "currency(9007199254740993, \"EUR\")",
167
+ "scope": {},
168
+ "format": "currency",
169
+ "currency": "EUR",
170
+ "numericType": "int",
171
+ "referenceValue": "9007199254740993"
172
+ },
173
+ {
174
+ "id": "int-number",
175
+ "expression": "number(1234)",
176
+ "scope": {},
177
+ "format": "number",
178
+ "numericType": "int",
179
+ "referenceValue": "1234"
180
+ },
181
+ {
182
+ "id": "double-currency",
183
+ "expression": "currency(value, \"EUR\")",
184
+ "scope": {
185
+ "value": 0.25
186
+ },
187
+ "format": "currency",
188
+ "currency": "EUR",
189
+ "numericType": "double",
190
+ "referenceValue": "0.25"
191
+ },
192
+ {
193
+ "id": "double-literal-fixed-fraction",
194
+ "expression": "number(1234.0, 2)",
195
+ "scope": {},
196
+ "format": "number",
197
+ "precision": 2,
198
+ "numericType": "double",
199
+ "referenceValue": "1234"
200
+ },
201
+ {
202
+ "id": "double-literal-percent",
203
+ "expression": "percent(1.0)",
204
+ "scope": {},
205
+ "format": "percent",
206
+ "numericType": "double",
207
+ "referenceValue": "1"
208
+ }
209
+ ],
210
+ "timestampCases": [
211
+ {
212
+ "function": "date",
213
+ "style": {
214
+ "dateStyle": "medium"
215
+ }
216
+ },
217
+ {
218
+ "function": "time",
219
+ "style": {
220
+ "timeStyle": "short"
221
+ }
222
+ },
223
+ {
224
+ "function": "dateTime",
225
+ "style": {
226
+ "dateStyle": "medium",
227
+ "timeStyle": "short"
228
+ }
229
+ }
230
+ ]
231
+ }
@@ -85,7 +85,9 @@ Retained inactive properties are reserved from the additional-property editor.
85
85
 
86
86
  Moving controls among groups, columns and categories must not change conditional
87
87
  semantics or introduce frames. Preserve layout options, regions, rules, order and
88
- empty authored containers. A Group's header, footer and cover belong to the same
88
+ empty authored containers. Group regions are direct children in `elements`
89
+ assigned through `slot`; preserve their assignments before filtering. A Group's
90
+ header, footer and cover belong to the same
89
91
  object boundary as its body: field bindings use the projection and inactive
90
92
  branch-only bindings are omitted, including a directly bound cover Control.
91
93
  Layouts inside regions inherit the owner's decision; filtering still stops at
@@ -186,7 +188,9 @@ repository. The dated source audit below has its own narrower evidence boundary.
186
188
  Inspection of the Svelte checkout at `d7ae9954` found object-Control conditional
187
189
  projection, but did not establish direct-layout entry support. Its discovery
188
190
  helper rescans conditional/reference/allOf structure; its layout filter recreates
189
- containers and traverses `elements`, without filtering Group regions. Portable
191
+ containers and traverses `elements`, without filtering the separate Group region
192
+ fields used at that revision. This audit predates the child `slot` contract and
193
+ does not establish support for it. Portable
190
194
  layout and region child keys use positions, so conditional removal before a
191
195
  retained editor presents the same identity risk described in the pitfalls.
192
196
  The object-detail path passes its projected schema onward; whole-value editor
@@ -117,7 +117,9 @@ Use `options.conditionalFields: true` on an object Control or an object-context
117
117
  layout entry (VerticalLayout, HorizontalLayout, Group, Categorization, TemplateLayout, Template or Slot), or use
118
118
  `config.jsonformsExtended.conditionalFields` as the default. Local false opts out.
119
119
  The entry owns the projection for descendant layouts and Categories at that
120
- object boundary; their local options are ignored in either direction. Filter
120
+ object boundary; their local options are ignored in either direction. Traverse every Group child through `elements`; partition direct-child `slot`
121
+ assignments for placement before filtering. Indicator traversal visits bound Controls
122
+ across all `elements`, regardless of slot; presentation-only children do not count. Filter
121
123
  Group regions as well as bodies, and retain empty authored containers and
122
124
  existing layout slots. Whole-value editors retain the original schema; object
123
125
  field editors may reuse the projection. Nested object and array-item boundaries
@@ -217,3 +219,80 @@ can otherwise reintroduce aliases. Distinguish known inactive slots from unknown
217
219
  names, retain genuine diagnostics, and forward the projection through registered
218
220
  layouts. Execute conditional-template-* acceptance vectors and see the associated
219
221
  pitfall for focus/selection and DOM staging requirements.
222
+
223
+ ## No-op commits still complete their pending lifetime
224
+
225
+ A delivered edit matching the current model may produce no data change. Settle
226
+ its pending contribution and notify validity consumers without waiting for a
227
+ model echo. Preserve newer queued drafts and independent validation. Verify
228
+ both timer and explicit-flush delivery, including edits after a model update.
229
+ See [pending validity](implementation-pitfalls.md#pending-validity-is-observable-without-a-data-change).
230
+
231
+ ## Optional manual custom element registration
232
+
233
+ Hosts may provide an explicit registration entry alongside their automatic
234
+ browser entry. Importing the manual entry must leave the default tag undefined;
235
+ only calling its registration function defines the requested tag. Give every
236
+ alias a distinct constructor, including when multiple tags use the same renderer.
237
+ Keep both entry points in the browser/package acceptance checks: shared chunks
238
+ must not pull automatic registration into the manual import.
239
+
240
+ When registration accepts property defaults, snapshot mutable records and arrays
241
+ at definition and isolate them between instances. Preserve callback, capability
242
+ symbol, and opaque service identities. Instance inputs override defaults;
243
+ attribute removal and an `undefined` property restore the configured fallback.
244
+ Explicit `false`, `null`, and empty strings retain their normal property meaning.
245
+ Defaults apply to whole properties, without silently merging nested configuration.
246
+ Preserve properties assigned before upgrade, attributes, events, slots, and
247
+ renderer styles. Do not write host attributes or children in the custom element
248
+ constructor; apply defaults through internal state or property accessors.
249
+
250
+ Document repeated-definition behavior. An idempotent API can return the existing
251
+ constructor with its original defaults; it must not silently replace the existing
252
+ tag's definition or modify instances registered earlier. The optional
253
+ `manual-custom-element-registration` vector describes these acceptance checks;
254
+ it does not require every host to expose a registration API or standardize its
255
+ JavaScript function name.
256
+
257
+ ## CEL helpers in browser and native hosts
258
+
259
+ Register the portable helper signatures in the text-expression environment;
260
+ JavaScript's globals are not automatically CEL functions. Keep component encoding
261
+ locale-independent, preserve UTF-8 and literal percent semantics, and let malformed
262
+ UTF-16 use the existing expression-error path. Continue escaping substituted
263
+ values before Markdown parsing and applying URL policy to resolved link targets.
264
+ Test punctuation that component encoding intentionally leaves unchanged, including
265
+ parentheses and apostrophes. Compare date-time output with a controlled viewer time
266
+ zone and the active form locale; equal offset-bearing instants must agree.
267
+ The `cel-helpers.json` cases and behavior vectors describe adapter acceptance;
268
+ record executable renderer tests separately from these declarative cases.
269
+
270
+ HTML/JavaScript acceptance runners can load the same JSON artifact after release:
271
+
272
+ ```js
273
+ const vectors = await fetch('/spec/conformance/cel-helpers.json').then(response => response.json());
274
+ ```
275
+
276
+ For a case carrying `utf16CodeUnits`, construct `scope.value` from those code
277
+ units before evaluating its CEL expression. This represents malformed UTF-16
278
+ without requiring a JSON loader to accept an unpaired surrogate escape. The
279
+ spec package exports this artifact at
280
+ `@chobantonov/jsonforms-extended-spec/conformance/cel-helpers.json`.
281
+
282
+ ## Reuse CEL registration without merging evaluator policies
283
+
284
+ Register numeric formatters for both `int` and `double`: integer literals and
285
+ `size()` results are not the same CEL type as JSON data numbers. Retain integer
286
+ precision through formatting. A host `Date` is classified as a CEL timestamp;
287
+ accepting it in a parser is insufficient without registering that overload.
288
+ Use one temporal registration table so the string and timestamp variants follow
289
+ the same locale and viewer-zone behavior.
290
+
291
+ A fresh environment factory may accept host-owned evaluator options and limits.
292
+ Keep caller caches and per-form translator bindings isolated. If sharing such a
293
+ factory between common and optional extended evaluators, place the implementation
294
+ below both packages; do not introduce a common-to-extended dependency. Localized
295
+ helpers in a dependency-tracked evaluator also require locale-aware cache and
296
+ invalidation rules. A display serializer is not a replacement for the dynamic
297
+ UI's typed JSON-result policy. Structured JSON joining and epoch-millisecond
298
+ interpretation remain separate capabilities, without implicit adoption here.
@@ -278,18 +278,23 @@ A remembered oneOf selection must not leave a phantom branch editor after the bo
278
278
 
279
279
  ## Group regions share one collapsible card
280
280
 
281
- `cover`, `header` and `footer` are structural children of Group, rendered
282
- through the normal registry in the current schema and data context. An authored
283
- `header` takes precedence over `label` for the visible title. Two
281
+ Group regions are direct `elements` children with `slot: "cover"`,
282
+ `slot: "header"` or `slot: "footer"`, rendered through the normal registry in the current schema and data context. An authored
283
+ header child takes precedence over `label` for the visible title. Two
284
284
  Label elements can supply a title and smaller supporting text. Keep all regions
285
285
  inside one card frame. Keep the cover and heading visible when collapsed; hide
286
- the body and footer. The first header Label supplies the Group's resolved
287
- accessible name; use the Group label when no header Label exists. Recompute
286
+ the body and footer. The first visible Label in the header child or its authored
287
+ layout subtree supplies the Group's resolved accessible name; use the Group label when none
288
+ exists. Do not search Control details or registered Template expansions. Recompute
288
289
  that name when locale or effective dynamic header text changes. Resolving a
289
290
  dynamic Label only at child dispatch leaves the parent's name stale. Keep
290
291
  authored interactive content outside the disclosure trigger: nesting a Button
291
292
  inside it makes keyboard and pointer behavior
292
- ambiguous. Data and validation indicators aggregate only through `elements`. Acceptance:
293
+ ambiguous. Data and validation indicators aggregate bindings across every
294
+ resolved child in `elements`, including header, cover and footer fields. Labels
295
+ and images do not count merely because they display content. Do not reuse the
296
+ body-placement partition to collect indicator bindings. Ordinary rule-hidden
297
+ Controls still participate; conditionally omitted bindings do not. Acceptance:
293
298
  mount the Card regions tab in `examples/group-layout/uischema.json` closed,
294
299
  open it, activate a footer button without changing expansion, close it, then hide
295
300
  the Group. Verify region visibility, action dispatch and unchanged data at each step.
@@ -303,6 +308,26 @@ footer child fill a full-width slot obscures its relationship to the title
303
308
  and each other. Verify row alignment and responsive wrapping in a wide and a
304
309
  narrow host, as well as the disclosure and action independence above.
305
310
 
311
+ ### Placement metadata is independent of element identity
312
+
313
+ Do not use `name` to select Group regions: a Template's name already selects its
314
+ registered content. Keep all children in `elements`, and read only a direct
315
+ child's `slot`. A nested `slot: "header"` must not fill an ancestor's header.
316
+ Use one layout child for several region elements. Select the first authored
317
+ match for each recognized region; later matches and unknown slot names remain
318
+ in the body, in authored order, with ordinary body indicators and collapse
319
+ behavior. Do not combine repeated assignments or drop fallback children. There is no Group `slots` map to enable placement. Compute placement from
320
+ authored children before filtering; an invisible header must not become body
321
+ content or promote a later match out of the body, and its disappearance must not
322
+ reset a retained body editor.
323
+
324
+ **Acceptance:** Place a Template named `partner-summary` in the header using
325
+ `slot`, and an unslotted child named `header` in the body. Verify independent
326
+ registry lookup and placement. Repeat with reordered children, a nested Group,
327
+ unknown and duplicate assignments (rendered once in the body), and a first-match
328
+ header disappearing and returning without promoting its duplicate.
329
+ These are proposed adapter acceptance cases, not executed renderer tests.
330
+
306
331
  ## Equivalent composition feedback
307
332
 
308
333
  Document validation may report the same missing property through multiple alternatives, and local active-branch validation may report it again. Present equivalent errors once: compare instance path, keyword, parameters and message, rather than schema location alone. Preserve different constraint parameters, messages and targets. Deduplication of displayed branch feedback must not alter document validation or its emitted errors.
@@ -1132,6 +1157,21 @@ commands must resolve committable edits before reading current data, and retain
1132
1157
  unresolved/staged drafts for explicit Apply/Cancel. Clear, cancellation, rebinding,
1133
1158
  external replacement and disposal invalidate superseded work.
1134
1159
 
1160
+ A no-op commit can finish without any new data prop or change event. Do not
1161
+ clear pending edits exclusively in a model-feedback effect: typing `xy` and
1162
+ reverting to stored `x` before delivery must settle that edit when the timer or
1163
+ an explicit flush runs. Compare with the current model, not the last attempted
1164
+ write. Preserve newer drafts while an earlier write is being acknowledged and
1165
+ keep independent validation or unresolved drafts pending. This does not require
1166
+ all adapters to publish identical intermediate queue states.
1167
+
1168
+ **Acceptance:** Start with valid stored `x`, type `xy` then `x` in one debounce
1169
+ window, and deliver by both timer and explicit flush. If the edit contributes to
1170
+ pending validity, it must stop doing so without a data event. Repeat after a
1171
+ model change and with a newer draft awaiting feedback. The proposed behavior
1172
+ vector requires renderer execution; fixture validation alone does not prove it.
1173
+
1174
+
1135
1175
  Avoid rescanning every mounted editor on each field render. Maintain per-editor
1136
1176
  pending state and update aggregates only when a contributor changes. Verify both
1137
1177
  correctness and notification cost; a form-wide subscription alone does not prove
@@ -1192,3 +1232,35 @@ resolution instead of stripping options at the integration boundary; lowercase
1192
1232
  `readonly` wins when both boolean spellings are present at the same source.
1193
1233
  Keep JSON Schema `readOnly`, canonical UI/config `readonly`, and inherited
1194
1234
  compatibility support distinct in documentation and tests.
1235
+
1236
+ ## Manual registration must stay separate from automatic registration
1237
+
1238
+ An exported registration function is insufficient if importing its module still
1239
+ registers the default tag through a component import or a shared chunk. Exercise
1240
+ the actual emitted manual entry in a fresh browser registry. Each alias also
1241
+ needs its own custom element constructor; browsers reject registering the same
1242
+ constructor twice. Registration defaults must not overwrite pre-upgrade instance
1243
+ properties or leak mutable data/configuration between instances. Clone plain
1244
+ records and arrays while retaining callbacks, capability symbols, and service
1245
+ instances. Verify removing an override restores its fallback, and that custom
1246
+ tags still deliver the same events, slots, and styles as the automatic entry.
1247
+
1248
+ ## URL component encoding does not replace markup escaping
1249
+
1250
+ An identifier containing `/`, `?`, `&` or `#` changes a URL's structure when
1251
+ interpolated raw. Encode the identifier as one component, then retain the existing
1252
+ markup escaping and URL-policy stages. `encodeURIComponent` intentionally leaves
1253
+ parentheses and apostrophes unchanged, and re-encodes an existing percent escape.
1254
+ Encoding a whole URL would also encode its structural delimiters. Date-time
1255
+ formatting has a separate environment dependency: the viewer's time zone as well
1256
+ as the form locale must be fixed for reproducible comparisons between hosts.
1257
+
1258
+ ## CEL overloads follow value types, not how numbers look
1259
+
1260
+ A literal `1`, `size(items)`, and JSON data containing `1` can reach different
1261
+ CEL overloads. Implement both integer and double variants of numeric formatters,
1262
+ including fixed-fraction `number` and `percent`. Converting an integer to a
1263
+ JavaScript number first can lose digits. Similarly, a JavaScript `Date` reaches
1264
+ a timestamp overload, not a string overload; an `instanceof Date` branch alone
1265
+ does not make it callable. Preserve cache isolation and evaluation limits when
1266
+ factoring function registration into a reusable environment builder.