|
| 1 | +--- |
| 2 | +'@object-ui/types': minor |
| 3 | +'@object-ui/components': minor |
| 4 | +'@object-ui/core': minor |
| 5 | +--- |
| 6 | + |
| 7 | +The `gap` of a `stack`, a `flex` and a `grid` node is one of the steps its renderer maps. |
| 8 | +Any other number is refused at validation, with the set named (objectui#11474). |
| 9 | + |
| 10 | +| node | accepted `gap` steps | default | |
| 11 | +|---|---|---| |
| 12 | +| `stack` | 0, 1, 2, 3, 4, 5, 6, 8, 10 | 2 | |
| 13 | +| `flex` | 0, 1, 2, 3, 4, 5, 6, 7, 8 | 2 | |
| 14 | +| `grid` | 0, 1, 2, 3, 4, 5, 6, 8, 10, 12 | 4 | |
| 15 | + |
| 16 | +**Breaking for a `stack`, `flex` or `grid` that carries any other `gap` number.** The key |
| 17 | +was declared as any number, and the `flex` and `grid` descriptions advertised "Tailwind |
| 18 | +scale 0-8". But each renderer has one gap class per step and nothing for the rest: |
| 19 | +`{ "type": "stack", "gap": 7 }` and `{ "type": "flex", "properties": { "gap": 9 } }` parsed |
| 20 | +clean and rendered with no gap class at all, not even the default, because the default |
| 21 | +applies only when the key is absent. A `grid` built a gap class at runtime for such a |
| 22 | +number, and no compiled stylesheet defines a class built that way, so it rendered with no |
| 23 | +gap either. |
| 24 | + |
| 25 | +- `@object-ui/types`: `StackSchema.gap`, `FlexLayoutProps.gap` (which `FlexSchema` and the |
| 26 | + authored `flex` bag share) and `GridSchema.gap` are literal unions of the steps above on |
| 27 | + the TypeScript face, so `tsc` refuses any other number. The zod mirrors refuse one at the |
| 28 | + key (`invalid_value`, with the steps in the issue), with a message that lists the set. For |
| 29 | + `flex` that is `properties.gap`, and the flat spelling stays refused by name. |
| 30 | + `safeValidateSchema` (what `objectui validate` runs) and the strict authoring face both |
| 31 | + give that refusal. A `gap` that is not a number at all is now reported as `invalid_value` |
| 32 | + rather than `invalid_type`. |
| 33 | +- `@object-ui/components`: the `gap` input of the `stack`, `flex` and `grid` registrations |
| 34 | + changes from `type: 'number'` to a closed `enum` of the same steps, in the object form the |
| 35 | + `container` registration's `padding` already uses. In the SDUI manifest, `validateTree` |
| 36 | + now answers an unlisted number with `invalid-enum`. The renderers are unchanged: they do |
| 37 | + not round or clamp, and an absent key still renders the default step. |
| 38 | +- `@object-ui/core`: `GridBuilder.gap()` and `FlexBuilder.gap()` take the declared steps |
| 39 | + instead of any number. |
| 40 | + |
| 41 | +Migration: replace the number with the step you meant from that node's set. `0` means no |
| 42 | +gap. |
0 commit comments