@chobantonov/jsonforms-extended-spec 0.4.0 → 1.0.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/docs/spec.md CHANGED
@@ -222,6 +222,14 @@ Three consequences follow, and each has been got wrong:
222
222
  resolves within its own construct; a duplicate *within* one construct is a
223
223
  configuration error and MUST be diagnosed rather than resolved by position.
224
224
 
225
+ ### 2.2 `slot` assigns placement in the immediate parent
226
+
227
+ `slot` is an optional, nonempty, case-sensitive string field on an element,
228
+ independent of its `name`, label and options. It assigns that child to a named
229
+ destination supported by its immediate parent. Omission uses the parent's normal
230
+ placement. Group destinations and fallback behavior are defined in [§8.1](#81-group).
231
+ This field does not rename a Template or change structural Slot lookup.
232
+
225
233
  ## 3. Runtime context and the action contract
226
234
 
227
235
  A reference web context:
@@ -791,31 +799,67 @@ does not look like a mistake.
791
799
  An ordinary Group presents related controls as a labelled section. Its default
792
800
  visual treatment belongs to the renderer family and requires no variant.
793
801
 
794
- Groups may also declare optional structural regions. `cover` is one
795
- UI-schema element displayed as prominent media in the card; `header` is
796
- an array of authored elements in the heading area; `footer` is an array of
797
- elements displayed after the body, including actions or other content. These are
798
- top-level fields, not `options`, and use ordinary renderer dispatch with the
799
- Group's schema, data path, enabled state and renderer registry. An empty region
800
- renders nothing. `elements` remains the body. A renderer family chooses the
801
- native component and styling for each region; none of these fields requires a
802
- Card component or a particular pixel arrangement.
803
-
804
- When `header` is present, its authored elements provide the heading; renderers
805
- prefer them over `label` and do not repeat the Group label. Without a header,
806
- `label` remains the title and accessible name. A header may contain two `Label`
807
- elements for a title and supporting text; renderers give the second a smaller,
808
- muted treatment. When the header contains a `Label`, the first such Label's
809
- resolved text is the Group's accessible name, including after a locale change;
810
- otherwise the Group label remains the accessible name. For a collapsible Group,
811
- the existing status and chevron stay
812
- at the far right of the heading row. The cover and one heading area remain
813
- visible when collapsed. Only the body and footer hide. Keep authored
814
- interactive content in `header` outside the disclosure trigger. Footer content
815
- remains outside the trigger too. Group visibility hides all regions;
816
- enabled/read-only behavior and rule visibility apply to dispatched children as
817
- usual. Region children do not become body descendants for the Group's
818
- data-presence or validation indicators; only `elements` define that aggregate.
802
+ All Group children are authored in `elements`. A direct child may declare the
803
+ optional top-level `slot` field: `"cover"` places it before the heading,
804
+ `"header"` supplies the authored heading, and `"footer"` places it after the
805
+ body. Children not selected for a region form the body in authored relative
806
+ order, including children without `slot`. Group
807
+ orders the regions as cover, heading, body and footer regardless of their
808
+ positions in `elements`. There is no Group-level `slots` mapping or activation
809
+ switch. With no slot assignments, the Group is an ordinary body-only Group.
810
+
811
+ Each region uses the **first direct child in authored `elements` order** whose
812
+ `slot` exactly matches that region. Later children with the same slot name remain
813
+ in the body, as if their `slot` were omitted. Unrecognized slot names likewise
814
+ use ordinary body placement. These are valid fallback cases, not configuration
815
+ errors; no child is discarded or rendered twice. Body fallback children follow
816
+ ordinary body collapse, data-presence and validation-indicator behavior.
817
+
818
+ Authors SHOULD assign only one child to each recognized slot. To intentionally
819
+ compose multiple elements in a region, put them in one ordinary layout assigned
820
+ to that slot. Group does not automatically combine repeated assignments.
821
+
822
+ `slot` is placement metadata read by the immediate parent, independent of `name`.
823
+ For example, a Template can have `name: "partner-summary"` and `slot: "header"`:
824
+ its name still selects the registered template. A child named `header` without a
825
+ `slot` remains body content. Nested assignments do not fill an ancestor Group's
826
+ regions. Other parent constructs define their own slot support; parents without
827
+ such support retain ordinary child placement.
828
+ `slot` is not `options.slot`, a styling part, or a structural `Slot` element.
829
+
830
+ Dispatch every region child through the normal registry with the Group's schema,
831
+ data path and enabled state. Generic child traversal uses `elements` for all
832
+ regions. Determine placement and occurrence identity from authored children
833
+ before conditional or rule filtering. Hiding or conditionally omitting the first
834
+ matching child does not promote a later match from the body. A hidden region
835
+ stays assigned and never falls into the body; filtering must not remount surviving body editors. An empty
836
+ region renders nothing. Renderer families choose native components and styling;
837
+ slot assignments require neither a Card component nor identical pixels.
838
+ The former Group-level `cover`, `header` and `footer` child fields are no longer
839
+ part of this contract; migrate their content into slotted `elements` children.
840
+ Open authoring schemas may preserve those unknown keys without validating their
841
+ contents or implying support.
842
+
843
+ An authored header supplies the heading instead of repeating the Group label.
844
+ When no header content is visible, use `label` as the visible title and accessible
845
+ name. For the header child's own Label, or Labels within its authored layout
846
+ children, the first visible Label in depth-first authored order supplies the
847
+ resolved accessible name. Do not search Control details, registered Template
848
+ expansions or other independent content contexts for a title; when no eligible
849
+ Label exists, use the Group label as the accessible name. Resolve effective Label
850
+ text and recompute after locale, dynamic-text or visibility changes. A header
851
+ layout may contain a title Label followed by a supporting Label; renderers SHOULD
852
+ give the supporting Label a smaller, muted treatment.
853
+
854
+ For a collapsible Group, the existing status and chevron stay at the far right of
855
+ the heading row. The cover and one heading area remain visible when collapsed;
856
+ only the body and footer hide. Keep authored interactive header and footer content
857
+ outside the disclosure trigger. Group visibility hides every region. Enabled,
858
+ read-only and rule behavior apply to dispatched children as usual. Group data-presence
859
+ and validation indicators aggregate only the body children and their
860
+ descendants, including duplicate/unknown-slot fallback children and excluding
861
+ children selected for regions, even though all children are stored
862
+ in `elements`. This presentation boundary does not change document validation.
819
863
 
820
864
  For Groups that declare regions, keep the authored content in one card frame.
821
865
  In a collapsible presentation, the cover and one heading area stay inside the
@@ -835,13 +879,19 @@ their card library's sections where available, or its documented composition pat
835
879
  {
836
880
  "type": "Group",
837
881
  "options": { "collapsible": true, "collapsed": true },
838
- "cover": { "type": "ImageView", "src": "/hotel.jpg", "alt": "Hotel courtyard", "options": { "width": "100%" } },
839
- "header": [
840
- { "type": "Label", "text": "Hospitality partner" },
841
- { "type": "Label", "text": "Verified member since 2018" }
842
- ],
843
- "elements": [{ "type": "Control", "scope": "#/properties/name" }],
844
- "footer": [{ "type": "Button", "label": "View partnership", "action": "viewPartner" }]
882
+ "elements": [
883
+ { "type": "ImageView", "slot": "cover", "src": "/hotel.jpg", "alt": "Hotel courtyard", "options": { "width": "100%" } },
884
+ {
885
+ "type": "VerticalLayout",
886
+ "slot": "header",
887
+ "elements": [
888
+ { "type": "Label", "text": "Hospitality partner" },
889
+ { "type": "Label", "text": "Verified member since 2018" }
890
+ ]
891
+ },
892
+ { "type": "Control", "scope": "#/properties/name" },
893
+ { "type": "Button", "slot": "footer", "label": "View partnership", "action": "viewPartner" }
894
+ ]
845
895
  }
846
896
  ```
847
897
 
@@ -852,13 +902,13 @@ name control and footer button.
852
902
  `ImageView` retains its URL policy and alternative-text rules (§13.1); `Button`
853
903
  retains the action, disabled and pending rules (§14). Authors can place any
854
904
  supported UI-schema element in a region, but should keep editable fields in
855
- `elements` so collapse and section indicators have predictable meaning.
905
+ unslotted body children so collapse and section indicators have predictable meaning.
856
906
 
857
907
  | Option | Default | Behaviour |
858
908
  | --- | --- | --- |
859
909
  | `collapsible` | `false` | Enables an accessible disclosure control |
860
910
  | `collapsed` | `false` | Initializes expansion and synchronizes it when the effective boolean changes. Ignored unless `collapsible` is true |
861
- | `showDataIndicator` | `false` | Shows a data-presence indicator when at least one bound descendant contains data |
911
+ | `showDataIndicator` | `false` | Shows a data-presence indicator when at least one bound body descendant contains data |
862
912
  | `showValidationIndicator` | `false` | Shows an aggregated descendant-error indicator. See §8.3 |
863
913
 
864
914
  ```json
package/docs/todo.md CHANGED
@@ -74,7 +74,7 @@ separate from the experimental descriptor schema and adapter tests.
74
74
  environment snapshots and reevaluation when input namespaces change.
75
75
  - Resolution before renderer/cell selection, parent-consumed metadata, and
76
76
  nested/detail occurrences.
77
- - Group `cover`, `header`, and `footer` children resolve through dynamic
77
+ - Group children with `slot: "cover"`, `slot: "header"`, and `slot: "footer"` resolve through dynamic
78
78
  dispatch. Verify region updates, the effective header Label's accessible
79
79
  name, and preservation of the mounted body editor.
80
80
  - Immediate draft discard on editor replacement, scope-change editing sessions,
@@ -97,7 +97,10 @@ the inner.
97
97
  ## Cover, header and footer
98
98
 
99
99
  The **Card regions** tab in `uischema.json` demonstrates the optional structural
100
- regions. A self-contained courtyard photograph fills the 800px-wide card cover.
100
+ regions through direct `elements` children with `slot: "cover"`,
101
+ `slot: "header"` and `slot: "footer"`. The header uses a VerticalLayout; the
102
+ footer uses a HorizontalLayout for its labels and actions. No Group-level
103
+ `slots` mapping is needed, and unslotted children form the body. A self-contained courtyard photograph fills the 800px-wide card cover.
101
104
  Two authored header Labels provide the title and smaller supporting text. The
102
105
  footer follows the body with space on both sides of its divider.
103
106
  The group starts
@@ -110,6 +113,28 @@ buttons use ordinary action dispatch and enabled/read-only behavior. The two
110
113
  buttons select English or Bulgarian through the demo host's `setLocale` action.
111
114
  The card's width limit comes from its parent VerticalLayout item constraint.
112
115
 
116
+ ### Repeated and unknown slot names
117
+
118
+ Author one child per region, wrapping several items in a layout when needed.
119
+ If a region is assigned more than once, its first authored child fills it and
120
+ later matches stay in the body. An unknown name also stays in the body:
121
+
122
+ ```json
123
+ {
124
+ "type": "Group",
125
+ "elements": [
126
+ { "type": "Label", "slot": "header", "text": "Heading" },
127
+ { "type": "Label", "slot": "header", "text": "Body first" },
128
+ { "type": "Label", "slot": "bottom", "text": "Body second" },
129
+ { "type": "Label", "text": "Body third" }
130
+ ]
131
+ }
132
+ ```
133
+
134
+ This produces one heading and three body elements, each rendered once. Hiding
135
+ the first header does not move the second Label out of the body. These are
136
+ portable acceptance expectations; renderer adapters must verify them.
137
+
113
138
  ## Not covered: `collapsed` driven from data
114
139
 
115
140
  §8's worked example binds `collapsed` through `$dynamic`: