@object-ui/layout 17.3.0 → 17.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,428 @@
1
1
  # @object-ui/layout
2
2
 
3
+ ## 17.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bb68488: Stop declaring 14 symbols under names `@objectstack/spec` owns at `17.0.0-rc.6`
8
+ (objectui#4167, objectstack#4115).
9
+
10
+ The rc.6 bump published nine names this repo already declared locally, on top of
11
+ four that predate it — `check:spec-symbols` reported all thirteen at once, and a
12
+ fourteenth (`GlobalFilterSchema`) appeared during the bump itself. Each was
13
+ triaged on its own rather than blanket-renamed, because the right answer differs
14
+ per symbol: five bind to the spec, three are renamed because the spec's
15
+ same-named export means something else, five arrive by derivation, and one is a
16
+ declared dialect with a written reason.
17
+
18
+ **Breaking for importers of `@object-ui/react`, `@object-ui/app-shell` and
19
+ `@object-ui/types`** — three exported names changed, because the spec exports the
20
+ same name for a _different_ thing:
21
+
22
+ | package | was | now | what the spec's same-named export actually is |
23
+ | :-------------------- | :----------------- | :----------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |
24
+ | `react` / `app-shell` | `MetadataState` | `MetadataCacheState` | a metadata item's LIFECYCLE state — `'draft' \| 'active' \| 'deprecated' \| 'archived'` (`MetadataStateSchema`, `@objectstack/spec/system`) |
25
+ | `react` / `app-shell` | `resolveI18nLabel` | `resolveKeyedI18nLabel` | a resolver for the INLINE per-locale map (`{ en: 'Owner', 'zh-CN': '负责人' }`) against a BCP-47 locale |
26
+ | `types` | `DateRangePreset` | `FilterBuilderDateRangePreset` | the thirteen HISTORICAL dashboard filter-bar presets; this one is the filter-builder set, which adds eight FUTURE windows the dashboard schema rejects |
27
+
28
+ `resolveI18nLabel` is the one where the collision had already started costing
29
+ something. rc.6 widened `I18nLabel` from `string` to
30
+ `string | Record< string, string >`, so the same authored value now reaches
31
+ either resolver — and each answers wrongly, silently, for the other's input: the
32
+ keyed one returns `undefined` for `{ en: 'Owner' }` (no `key`, no
33
+ `defaultValue`), and the spec's reads `key` / `defaultValue` / `params` as locale
34
+ tags. The rc.6 bump PR met this and aliased the spec's import as
35
+ `resolveInlineI18nLabel` in five files, with hand-written comments at two of
36
+ them. That is a review convention, which is what objectstack#4115 exists to
37
+ replace with a rule — so `Keyed` is now the counterpart of that `Inline`, and the
38
+ name says which vocabulary it resolves at every call site.
39
+
40
+ **Eleven keep their names and are now imported or derived from the spec** instead
41
+ of re-declared: `DATE_RANGE_PRESETS`, `NavigationMode`, `AddressValue`,
42
+ `BreakpointColumnMap`, `BreakpointOrderMap`, `KanbanConfig`, `CalendarConfig`,
43
+ `GanttConfig`, plus the three renamed above at their new names.
44
+
45
+ **Four of the copies were losing information, not just duplicating it.**
46
+
47
+ - **`GanttConfig` declared six keys and called itself canonical; rc.6's
48
+ `GanttConfigSchema` declares seventeen.** The eleven it never mentioned —
49
+ `parentField`, `typeField`, `baselineStartField`, `baselineEndField`,
50
+ `groupByField`, `resourceView`, `assigneeField`, `effortField`, `capacity`,
51
+ `quickFilters`, `autoZoomToFilter` — are all read by
52
+ `plugin-gantt/src/ObjectGantt.tsx`, through a local `GanttConfigEx`
53
+ intersection that existed only because this type did not carry them. It now
54
+ derives from the spec, with `timeSegments` (shift segmentation) as the one
55
+ genuinely local extension; the schema is `$loose` upstream, so that key is
56
+ legal metadata rather than a second dialect.
57
+ - **`GanttConfig.tooltipFields` carried the comment "not part of the upstream
58
+ GanttConfigSchema".** It is, as of rc.6, so the key now arrives from the spec.
59
+ - **`AddressValue` declared five of the spec's seven parts** — `countryCode` and
60
+ `formatted` were missing, under a comment already claiming to be "the part
61
+ names of `AddressSchema`". The widget still renders five inputs; binding the
62
+ type stops it from asserting the platform cannot store the other two, and makes
63
+ the `{ ...address }` write-through say so.
64
+ - **`DATE_RANGE_PRESETS` was `Object.keys(PRESET_RANGES)`,** a third copy of a
65
+ vocabulary the spec extracted in objectstack#4614 precisely to collapse — its
66
+ own doc comment names this module as one of the three. It is now the spec's
67
+ array by reference, and the local date-macro bounds table is pinned complete
68
+ against it with `satisfies`, so a preset the schema gains without bounds here
69
+ is a compile error rather than a filter that validates clean and then selects
70
+ nothing.
71
+
72
+ `NavigationMode` was one hop from the spec already (`NavigationConfig['mode']`);
73
+ it is bound directly, with a both-directions type pin that it stays the same type
74
+ as the config's own `mode`. `KanbanConfig` / `CalendarConfig` /
75
+ `BreakpointColumnMap` / `BreakpointOrderMap` were exact hand copies of `$strict`
76
+ schemas and are now re-exports — "still exact" is the argument for binding them,
77
+ since a copy with nothing to protect can only drift.
78
+
79
+ `GlobalFilterSchema` is the one ALLOW entry. It is the same spread-composition
80
+ dialect as `SelectOptionSchema` next to it, and it collided only because rc.6's
81
+ new refinement forced `.extend()` to be respelled as a `.shape` spread — which
82
+ moved a derivation the guard could see into an object literal it deliberately
83
+ does not descend into. The dialect is unchanged and its three divergences are
84
+ pinned; which side moves on the refinement itself is objectui#4165.
85
+
86
+ `@objectstack/spec` moves from `devDependencies` to `dependencies` in
87
+ `@object-ui/layout`: its public type surface now references the spec.
88
+
89
+ ### Patch Changes
90
+
91
+ - f650253: `BaseSchema.ariaLabel` declares the keyed i18n vocabulary the renderer actually
92
+ resolves, `.disabled` accepts the predicate string it actually evaluates, and the
93
+ keyed shape finally has a name (objectui#4581)
94
+
95
+ Three slots on one base type had drifted from what the renderer does with them.
96
+ PR #4593 fixed `visible` and measured the rest; these are the rest.
97
+
98
+ `ariaLabel` was `string`, but `SchemaRenderer.tsx:111` resolves it with
99
+ `resolveKeyedI18nLabel`, whose input is the KEYED form
100
+ `{ key, defaultValue?, params? }` — a reference into a translation bundle. It is
101
+ now `string | KeyedI18nLabel`, and `KeyedI18nLabel` is a new exported type in
102
+ `@object-ui/types` rather than a fourth inline copy of one object literal: the
103
+ three that existed (`@object-ui/react`'s resolver, `@object-ui/layout`'s
104
+ `resolveLabel`, `@object-ui/app-shell`'s `t`-taking twin) were verified identical
105
+ in their object half first, and two of them now import the name.
106
+
107
+ The vocabulary matters more than the widening. `#4581` originally asked for
108
+ `string | I18nLabel`, and that spelling was withdrawn as measured-wrong: the
109
+ spec's `I18nLabel` is the INLINE LOCALE MAP (`string | Record<string, string>`),
110
+ a different vocabulary resolved against a BCP-47 locale by a different function
111
+ of a confusingly similar name. Under it the shipped keyed fixture type-checked
112
+ only vacuously — as a locale map whose "locales" are named `key` and
113
+ `defaultValue` — the same label carrying `params` was rejected outright, and a
114
+ genuine `{ en: 'Owner' }` compiled while rendering an EMPTY `aria-label`. Naming
115
+ the keyed shape is the declaration half of the fix objectui#4167 started on the
116
+ naming side; `@object-ui/app-shell`'s copy keeps its inline spelling for now
117
+ because an open PR has a pending change to that file, and the comment there says
118
+ so.
119
+
120
+ `disabled` was `boolean` on a key the renderer never reads as one:
121
+ `SchemaRenderer.tsx:466` evaluates it through the same `evaluateCondition` as
122
+ `visible`, and a `disabledOn?: string` sibling exists for the same reason. It is
123
+ now `boolean | string`. The asymmetry with `visible` was accidental rather than
124
+ deliberate.
125
+
126
+ Both are widenings on authored-input-dominant properties: authors gain a
127
+ spelling, nothing that type-checked before stops doing so, and readers already
128
+ coped with `any` through `BaseSchema`'s index signature. Three test fixtures that
129
+ had been casting past these declarations with `as unknown as BaseSchema` state
130
+ their values directly now, and the declared unions are pinned invariantly so
131
+ neither a missing widening nor an overshoot to `any` can pass unnoticed.
132
+
133
+ Declaring the vocabulary honestly also surfaced a real one: the `toggle`
134
+ renderer writes `aria-label` itself instead of going through SchemaRenderer's
135
+ resolver, and it forwarded the raw value. Invoked directly it emitted
136
+ `aria-label="[object Object]"` for a keyed label — announced verbatim by a
137
+ screen reader. It resolves now. Through `SchemaRenderer` the bug was invisible,
138
+ because SchemaRenderer injects its own resolved `aria-label` afterwards; a
139
+ downstream type-check sweep found it, not a test.
140
+
141
+ `BaseSchema.label` and `.description` are deliberately unchanged and pinned that
142
+ way. They receive the spec's inline `I18nLabel` from the view bridges, which is a
143
+ real defect, but resolving it belongs at the spec-to-schema boundary rather than
144
+ in this declaration — and that work is still blocked on a design question about
145
+ where the display locale enters, so it is not in this release.
146
+
147
+ - bb68488: An inline per-locale label now renders its locale's string at the thirteen read sites the `@objectstack/spec` 17.0.0-rc.6 bump exposed
148
+
149
+ rc.6 widened `I18nLabel` from `string` to `string | Record<string, string>`, so an author may write `label: { en: 'Owner', 'zh-CN': '负责人' }` anywhere the spec accepts a display label. PR #4169 repaired eight such sites; these thirteen were invisible to it because the five packages involved build through vite/rolldown, so `turbo run build` never type-checks their sources — only `turbo run type-check` does. All thirteen are now resolved through a shared resolver against a real locale, and `turbo run type-check` is 78/78 with zero errors.
150
+
151
+ | package | what an author can now write and see |
152
+ | ----------------------------- | --------------------------------------------------------------------------------------- |
153
+ | `@object-ui/layout` | `NavigationArea.label` — the sidebar area switcher's button and its tooltip |
154
+ | `@object-ui/plugin-list` | `ViewTab.label` — the inline pill row, and the mobile dropdown's trigger and menu items |
155
+ | `@object-ui/plugin-dashboard` | `DashboardWidget.title` — the widget card heading and its `title` attribute |
156
+ | `@object-ui/plugin-designer` | `DashboardWidget.title` — the widget card and the preview tile |
157
+ | `@object-ui/app-shell` | `ActionParam.label` **and** each `ActionParam.options[].label` |
158
+
159
+ **Patch, not minor, in every case: no public surface changes meaning.** Every entry above is a read site that previously could only be reached with a value the type system rejected, so no caller's working code changes behaviour. `@object-ui/app-shell` is the only package with an exported-type change and it is purely additive on the authoring side — `RawActionParam.label` and `RawActionParam.options[].label` widen to `I18nLabel` (they accept strictly more), `ResolveActionParamsContext` gains an optional `locale`, and the new `RawActionParamOption` names the authoring shape that was previously spelled with the resolved one. What `resolveActionParams` **emits** is unchanged: `ActionParamDef.label` and its options' labels are still plain `string`s.
160
+
161
+ Two consequences worth knowing:
162
+
163
+ - **The dashboard designer's title input is deliberately read-only for a map-valued title.** Resolving a per-locale map into a single-line input and writing `e.target.value` back would collapse every other locale on the first keystroke, so the write is guarded and an inline map survives an unrelated edit-and-save round trip untouched — the same conservative branch #4169 took for `DashboardWidgetInspector`. What Studio should actually offer for authoring a per-locale label is objectui#4163 part 2, which is unclaimed and pending design.
164
+ - **`@object-ui/layout` resolves at the spec's `en` default, not the viewer's language.** That package carries no i18n dependency by design (its whole i18n story is injection), and `AppSchemaRendererProps` exposes no locale to thread. The choice and what would change it are documented at the call site.
165
+
166
+ - Updated dependencies [ceccdcf]
167
+ - Updated dependencies [d6e5124]
168
+ - Updated dependencies [debad27]
169
+ - Updated dependencies [dc2aa3e]
170
+ - Updated dependencies [ee66e2e]
171
+ - Updated dependencies [ee26e65]
172
+ - Updated dependencies [5900ac5]
173
+ - Updated dependencies [f650253]
174
+ - Updated dependencies [3d9769a]
175
+ - Updated dependencies [8f85f8b]
176
+ - Updated dependencies [d0c3b26]
177
+ - Updated dependencies [3fc2971]
178
+ - Updated dependencies [aca27fa]
179
+ - Updated dependencies [dde7283]
180
+ - Updated dependencies [4dadf0d]
181
+ - Updated dependencies [ae10a01]
182
+ - Updated dependencies [92876f0]
183
+ - Updated dependencies [f279deb]
184
+ - Updated dependencies [4b70d28]
185
+ - Updated dependencies [eb7f586]
186
+ - Updated dependencies [e901131]
187
+ - Updated dependencies [d9d3463]
188
+ - Updated dependencies [2a40f69]
189
+ - Updated dependencies [bec3e14]
190
+ - Updated dependencies [613b167]
191
+ - Updated dependencies [b4d3c22]
192
+ - Updated dependencies [1f9b905]
193
+ - Updated dependencies [cb13400]
194
+ - Updated dependencies [bc64bfe]
195
+ - Updated dependencies [abb0f81]
196
+ - Updated dependencies [38ab505]
197
+ - Updated dependencies [3e19fe7]
198
+ - Updated dependencies [b953a97]
199
+ - Updated dependencies [d7f3e30]
200
+ - Updated dependencies [7e4f0e5]
201
+ - Updated dependencies [a84385b]
202
+ - Updated dependencies [45e1949]
203
+ - Updated dependencies [92250d6]
204
+ - Updated dependencies [c1d939f]
205
+ - Updated dependencies [49ae9f4]
206
+ - Updated dependencies [a3ae404]
207
+ - Updated dependencies [bfdf3d4]
208
+ - Updated dependencies [bb68488]
209
+ - Updated dependencies [b1e42d0]
210
+ - Updated dependencies [2459a3e]
211
+ - Updated dependencies [d6aa172]
212
+ - Updated dependencies [fe52a04]
213
+ - Updated dependencies [3f5f87c]
214
+ - Updated dependencies [f5e1143]
215
+ - Updated dependencies [f148a64]
216
+ - Updated dependencies [bb68488]
217
+ - Updated dependencies [9461dd3]
218
+ - Updated dependencies [47f551b]
219
+ - Updated dependencies [ab04728]
220
+ - Updated dependencies [5bf09fd]
221
+ - @object-ui/react@17.5.0
222
+ - @object-ui/components@17.5.0
223
+ - @object-ui/core@17.5.0
224
+ - @object-ui/types@17.5.0
225
+
226
+ ## 17.4.0
227
+
228
+ ### Patch Changes
229
+
230
+ - 6bd6a4d: `registerLayout()` 的 `inputs` 声明面与渲染器实现对齐 —— 校验器不再对正确写法报假诊断
231
+
232
+ `inputs` 是**作者面**:`sdui-parser/src/validate.ts` 拿一个节点的顶层属性逐个比对
233
+ `comp.inputs`,不在其中的报 `unknown-prop`,类型不符的报 `type-mismatch`;设计器面板、
234
+ `sdui.manifest.json`、生成的 JSX 类型也都由它派生。所以声明面写错的代价不是"文档不全",
235
+ 而是**校验器对着能正常渲染的 schema 说谎**(objectui#3972,与 objectui#3900 同族、换到属性面)。
236
+
237
+ 两处修正,都是按渲染器**实际读点**审计出来的:
238
+
239
+ - **`page-header` 补声明 `icon` 与 `actions`。** 两个键三面齐全:渲染器真读
240
+ (`PageHeader.tsx:117` 取参 `:224-226` 渲染 icon;`:119` 取参 `:192-196` 把 actions
241
+ 委派给 `record:quick_actions`)、`@objectstack/spec/ui` 的 `PageHeaderProps` 声明、
242
+ `ManifestInputType` 表达得了(`string` / `array`)。`content/docs/layout/page-header.mdx`
243
+ 的 Component Props 段落也把两者写成公开契约,而该文档页**唯一**的 live demo
244
+ (`layout-page-header/pageheader-with-actions`)就写着 `"icon": "users"` —— 于是仓内
245
+ 自己的文档示例每次过 manifest 门都收到一条 `unknown-prop: page-header has no prop "icon"`。
246
+ `actions` 的类型与 canonical 的 `page:header` 逐字一致(`type: 'array'`),一个概念一个键
247
+ 一种类型。
248
+ - **`navigation-renderer` 的 `items` 由 `type: 'object'` 改为 `'array'`。**
249
+ `NavigationRendererProps.items` 是 `NavigationItem[]`(`NavigationRenderer.tsx:108`),
250
+ 而 `checkType` 对 `'object'` 判 `typeof value === 'object' && !Array.isArray(value)`、
251
+ 对 `'array'` 判 `Array.isArray`(`validate.ts:124-129`)—— 两者互斥。所以旧声明对这个
252
+ 渲染器**唯一能渲染的形状**报 `type-mismatch ... expected an object`,而对真会让它崩的
253
+ 对象形状一言不发。这不是 objectui#3832 的表达力问题:`ManifestInputType` 本来就有
254
+ `'array'`,只是声明写错了一个表达得了的类型。
255
+
256
+ **刻意不声明**的键同样被钉住,因为"照抄 spec 的 shape"是这条修复最容易滑进去的反向缺陷:
257
+ `breadcrumb`(spec 有、这个渲染器零读点 —— 声明它就是 objectui#3829 的缺陷方向)、
258
+ `showBack` / `action` / `description`(渲染器读、spec 无此键 —— 声明任一个就是在开第二套
259
+ 方言,正是 objectui#3226 收窄要防的事)、`aria`(每个 block 都因同一理由省略的可访问性逃逸口)。
260
+
261
+ 渲染输出逐字节不变:渲染路径从不读 `inputs`。变化只在校验/设计器/清单这一侧,且两个方向
262
+ 都钉了 —— 正确写法放行的同时,`description` 这类刻意不声明的键仍报 `unknown-prop`、
263
+ `items` 写成对象仍报 `type-mismatch`(诊断没有被弄哑)。
264
+
265
+ - 876e3f7: `@object-ui/layout` no longer tells bundlers it has no side effects while registering components at load time (objectui#3899)
266
+
267
+ The published manifest declared `"sideEffects": false` — a promise that no module
268
+ in the package does anything on evaluation, so any module whose exports go unused
269
+ may be dropped whole. But `src/index.ts` ends with a bare
270
+ `try { registerLayout(); } catch {}`, and that call is the only thing that puts
271
+ `page-header`, `page:card`, `app-shell`, `responsive-grid`,
272
+ `navigation-renderer` and `app-schema-renderer` into the `ComponentRegistry`.
273
+
274
+ Both statements cannot be true, and a bundler that believes the manifest is
275
+ right to delete the registration. Measured with the repo's own bundler by
276
+ building `import '@object-ui/layout';` — the side-effect-only import, i.e. the
277
+ documented "import it to register" pattern:
278
+
279
+ - `sideEffects: false` — the bundle is **0 bytes**. Zero registrations, exit
280
+ code 0, no warning.
281
+ - after this change — the bundle keeps all six `ComponentRegistry.register`
282
+ calls.
283
+
284
+ A dropped registration does not fail where it happened. It surfaces later as a
285
+ red `Unknown component type` panel (OBJUI-001) on a fully green build, with
286
+ nothing in the build log to connect the two. Nobody had been bitten yet only
287
+ because every consumer today ALSO imports a named export, which forces the module
288
+ to be evaluated regardless — coincidence, not design. objectui#3787 met the
289
+ hazard and routed around it by calling `registerLayout()` explicitly.
290
+
291
+ `sideEffects` is now the narrowest honest answer: an array naming the modules
292
+ that actually register, rather than `true`, which would be honest but would hand
293
+ the whole package to every bundler as unshakeable.
294
+
295
+ ```json
296
+ "sideEffects": ["./dist/index.js", "./dist/index.umd.cjs", "./src/index.ts"]
297
+ ```
298
+
299
+ All three are load-bearing, and the set is derived from the manifest rather than
300
+ guessed:
301
+
302
+ - `./dist/index.js` and `./dist/index.umd.cjs` are every JS file the manifest's
303
+ own entry fields point at (`module` / `main` / `exports` import+require). The
304
+ library build inlines everything into those two files, so there is no third
305
+ chunk to name.
306
+ - `./src/index.ts` is not published (`files` ships `dist` only) but is bundled
307
+ for real: `apps/console` and `examples/console-starter` both alias the
308
+ specifier straight at `packages/layout/src`, and a bundler reads this same
309
+ manifest for those files. With only the published paths declared, the console's
310
+ alias shape still produced a 0-byte bundle.
311
+
312
+ What deliberately did NOT change: the load-time `registerLayout()` itself.
313
+ Replacing it with an explicit registration API is the opposite direction — it
314
+ eliminates the side effect instead of declaring it, and it is breaking for any
315
+ consumer relying on automatic registration. objectui#3899 leaves that call to the
316
+ maintainer, and the two steps do not conflict: once the manifest tells the truth,
317
+ the migration to explicit registration can happen whenever it is wanted.
318
+
319
+ A new pin (`packages/layout/src/__tests__/side-effects-manifest.test.ts`) runs a
320
+ real bundler build per entry form and asserts the registrations survive a
321
+ side-effect-only import, with a `sideEffects: false` control per form asserting
322
+ they are dropped — so the pin cannot pass because the bundler stopped shaking
323
+ anything. The required set is derived from the manifest's own entry fields, so a
324
+ renamed build output or a new `exports` subpath fails as a missing declaration
325
+ instead of drifting silently.
326
+
327
+ - f3b2874: `navigation-renderer` 的 `items` 声明为 `required: true` —— 校验器不再放过必崩的节点
328
+
329
+ `items` 在组件侧是**非可选**的 `NavigationItem[]`(`NavigationRendererProps.items`,无 `?`),
330
+ 渲染器也不给默认值,而注册声明一直没写 `required`。`sdui-parser` 只在 `input.required` 为真时
331
+ 报 `missing-required-prop`(`validate.ts:55-64`),于是 `{ "type": "navigation-renderer" }`
332
+ 这个节点**校验零诊断、渲染直接抛**:第一处无守卫的读点是 `pinnedItems` memo 里的
333
+ `collectPinnedItems(filteredItems)`(`NavigationRenderer.tsx:1242` → `:1410` 的
334
+ `for (const item of items)`),实测 `TypeError: items is not iterable`。
335
+ (`resolveActiveNavItem` memo 挡得住 —— 它的 `visit` 首行是 `if (!nodes) return`;
336
+ `:1247` 的 `filteredItems.slice()` 同样会抛,但根本走不到。)
337
+
338
+ 这是 objectui#3972(键的**存在**与**类型**三面对齐)的第四面:**可选性**。#3972 与
339
+ objectui#3900 都是删除假诊断,这一条相反——它是**收紧**。
340
+
341
+ **blast radius:** 今天省略 `items` 写 `navigation-renderer` 的 schema,会新增一条
342
+ **error** 级 `missing-required-prop`。受影响面是仓外按 `inputs` / `packages/layout/README.md`
343
+ 做 schema 驱动的消费者(仓内没有任何 JSON 元数据把它当 schema 节点写,React 调用侧的必填由
344
+ TS 兜住;`examples/schema-catalog` 的 `not-a-container` 对照节点补了 `items: []`,使它只剩
345
+ 那一处故意植入的缺陷)。而这条诊断新拦下的形状,**恰好等于渲染必然崩溃的形状** —— 让作者
346
+ (尤其是 AI 作者)在发布期就听到运行期注定要发生的失败,正是 `missing-required-prop` 存在
347
+ 的理由。若某个消费者确实想要"缺 items 就渲染空导航",那是给组件加 `= []` 默认值的另一条路
348
+ (objectui#3987 里记了,与本改动不互斥),而不是让校验器继续沉默。
349
+
350
+ `basePath` **保持可选**并被钉成对照:渲染器真的给了它默认值(`basePath = ''`)。`required`
351
+ 是逐个属性从组件读出的事实,不是一刀切——否则这道门会开始拒绝完全能渲染的 schema,作者就会
352
+ 学着无视 `missing-required-prop`,正如 #3972 里他们被教着无视 `type-mismatch`。
353
+
354
+ - 82f8dff: `page-header` 注册补 `isContainer: true` —— 校验器不再对文档承诺的 children 写法报 `not-a-container`
355
+
356
+ `PageHeader` 一直**有意**把 `schema.children` 渲染进右侧动作槽(`PageHeader.tsx:182`,
357
+ `record:quick_actions` 嵌在 `page:header.children` 下就是靠它),
358
+ `content/docs/layout/page-header.mdx` 把该槽的优先级(`action` → React `children` →
359
+ `actions` → schema children)写成公开契约,该文档页唯一的 live demo
360
+ (`layout-page-header/pageheader-with-actions`)正是这个形状且实测正常渲染。但
361
+ `packages/layout/src/index.ts` 的注册漏了 `isContainer: true`。
362
+
363
+ 漏这个 flag 从来没有挡住任何渲染 —— 渲染路径根本不读它(`SchemaRenderer` 把
364
+ `children` 从 React props 里剥掉当元数据,而始终把整个节点作为 `schema` 传下去,
365
+ `PageHeader` 自己再把 `schema.children` 放回槽里)。它的消费者在别处:`sdui-parser`
366
+ 的 `not-a-container` 诊断、Studio 调色板元数据、react-page 标签表。所以真正的后果是
367
+ **校验器在说谎**:作者照文档写出能正常渲染的 schema,却拿到一条
368
+ "`page-header` does not accept children" 的 warning;信了这条 warning 去掉 children,
369
+ 右槽就空掉。而会说谎的 warning 比缺一条 warning 更贵 —— 它训练作者(尤其 AI 作者)
370
+ 连真实的 `not-a-container`(那些确实不收子节点的组件)一起无视。
371
+
372
+ 这不是在 spec 之外新开作者面:`children` 是 objectui JSON 协议里**每个节点**的基础属性
373
+ (`sdui-parser/src/validate.ts` 的 `BASE_PROPS` 把它和 `type`/`id`/`className` 并列),
374
+ 不是 `PageHeaderProps` 的键。所以这个 flag 回答的是协议层面的"该节点是否接受子节点列表",
375
+ 而对这个组件,答案一直是"是"。维护者 2026-08-09 就 objectui#3900 的 A/B 分叉裁定 A 案,
376
+ 理由同上。
377
+
378
+ 行为面变化极窄:注册元数据一个布尔位。渲染输出逐字节不变(渲染路径不读该 flag);
379
+ `sdui-parser` 对带 children 的 `page-header` 少报一条 warning;设计器把它当容器对待
380
+ (即它本来的样子)。canonical 的 `page:header`(`@object-ui/components`)不在此列且刻意不动
381
+ —— 那个渲染器完全不读 `schema.children`,所以它没有 `isContainer` 是正确的。
382
+
383
+ 两个方向都已钉住:文档 demo 走应用真实构建的 manifest 后不再产生 `not-a-container`,
384
+ 而一个真正不收子节点的组件(`navigation-renderer`)带 children 时诊断照旧触发 ——
385
+ 后者是前者的对照,保证这条修复不是把诊断弄哑了。
386
+
387
+ - Updated dependencies [794c497]
388
+ - Updated dependencies [993336f]
389
+ - Updated dependencies [f0a625a]
390
+ - Updated dependencies [b5980f4]
391
+ - Updated dependencies [8aad9fd]
392
+ - Updated dependencies [6719877]
393
+ - Updated dependencies [56ff091]
394
+ - Updated dependencies [0cbdca8]
395
+ - Updated dependencies [d229dfa]
396
+ - Updated dependencies [ecae400]
397
+ - Updated dependencies [4bc6c23]
398
+ - Updated dependencies [d3e738a]
399
+ - Updated dependencies [c3b01a7]
400
+ - Updated dependencies [7ed3360]
401
+ - Updated dependencies [0fa5e4d]
402
+ - Updated dependencies [5bfaabd]
403
+ - Updated dependencies [e06810e]
404
+ - Updated dependencies [ab3ad4f]
405
+ - Updated dependencies [c2fd122]
406
+ - Updated dependencies [e24d767]
407
+ - Updated dependencies [aca561a]
408
+ - Updated dependencies [48132f7]
409
+ - Updated dependencies [0ef9dfd]
410
+ - Updated dependencies [1d723e3]
411
+ - Updated dependencies [0109f54]
412
+ - Updated dependencies [7e5bb5d]
413
+ - Updated dependencies [fbc23e0]
414
+ - Updated dependencies [e6fdbdc]
415
+ - Updated dependencies [54233b1]
416
+ - Updated dependencies [97b63d7]
417
+ - Updated dependencies [6bb454a]
418
+ - Updated dependencies [523be48]
419
+ - Updated dependencies [7e2b7e9]
420
+ - Updated dependencies [c1e1e6b]
421
+ - @object-ui/components@17.4.0
422
+ - @object-ui/react@17.4.0
423
+ - @object-ui/core@17.4.0
424
+ - @object-ui/types@17.4.0
425
+
3
426
  ## 17.3.0
4
427
 
5
428
  ### Minor Changes
@@ -17,6 +440,7 @@
17
440
  the switcher and instead rendered as a selectable, empty area.
18
441
 
19
442
  ## What changed
443
+
20
444
  - **Area visibility is now derived, not authored.** An area appears in the
21
445
  switcher iff at least one of its navigation items survives the exact
22
446
  item-level guards `NavigationRenderer` applies: the `visible` expression,
@@ -1012,6 +1436,7 @@
1012
1436
  - b703480: feat(layout): smoother sidebar transitions
1013
1437
 
1014
1438
  `SidebarNav` now animates the previously-instant state changes:
1439
+
1015
1440
  - Active-state colour swap on `SidebarMenuButton` /
1016
1441
  `SidebarMenuSubButton` is wrapped in `transition-colors duration-150`
1017
1442
  so navigating between rows glides rather than snaps.
@@ -1091,6 +1516,7 @@
1091
1516
  record detail page (lead, opportunity, future account/contact/case).
1092
1517
  Before this change it had two problems that bled into every custom
1093
1518
  page across the product:
1519
+
1094
1520
  1. **Quadruple registration**: `@object-ui/layout` registered both
1095
1521
  `page-header` and `page:header`, and `@object-ui/components`
1096
1522
  independently registered `page:header` (and `page:section`).
@@ -1101,6 +1527,7 @@
1101
1527
  than the default detail view it was meant to supersede.
1102
1528
 
1103
1529
  This commit:
1530
+
1104
1531
  - Removes the `@object-ui/layout` `page:header` registration. The
1105
1532
  layout package keeps the legacy kebab-cased `page-header` alias only.
1106
1533
  The canonical renderer now lives in `@object-ui/components` and is
@@ -1179,6 +1606,7 @@
1179
1606
  - d714e85: Lookup display-name resolution now falls back through a Salesforce-style chain
1180
1607
  when an `$expand`'d reference object lacks a top-level `name`/`label`/
1181
1608
  `display_name`/`title` field:
1609
+
1182
1610
  1. Standard display fields (existing behaviour)
1183
1611
  2. `salutation first_name last_name` composite — handles person records that
1184
1612
  only carry first/last name parts
@@ -1237,6 +1665,7 @@ Lin` and no `name` field now renders as `Bob Lin` everywhere — instead of
1237
1665
  pages without a record context are unaffected.
1238
1666
 
1239
1667
  - 2bd45af: feat(shell): main becomes the scroll container; record tabs are sticky
1668
+
1240
1669
  - `AppShell`'s SidebarProvider wrapper is now constrained to viewport
1241
1670
  height (`h-svh overflow-hidden`) instead of expanding with content via
1242
1671
  the default `min-h-svh`. This makes the inner `<main>` (which is
@@ -1259,6 +1688,7 @@ Lin` and no `name` field now renders as `Bob Lin` everywhere — instead of
1259
1688
  ### Patch Changes
1260
1689
 
1261
1690
  - 6b683c8: fix(detail): clean up record page rendering
1691
+
1262
1692
  - Drop `ai:chat_window` from the protocol-component placeholder list. The
1263
1693
  floating chat overlay (plugin-chatbot) is the canonical AI entry point;
1264
1694
  inline page schemas that still reference `ai:chat_window` now surface
@@ -1272,6 +1702,7 @@ Lin` and no `name` field now renders as `Bob Lin` everywhere — instead of
1272
1702
  as a fallback so both inlined and raw-bag schema shapes are supported.
1273
1703
 
1274
1704
  - 0d8eb98: feat(detail): Salesforce-style record header + section field grid
1705
+
1275
1706
  - `page:header` now renders an icon chip (resolves Lucide names via
1276
1707
  `LazyIcon`) plus subtitle, so detail pages can show
1277
1708
  "Name / Company" without an extra component.
@@ -1430,6 +1861,7 @@ Lin` and no `name` field now renders as `Bob Lin` everywhere — instead of
1430
1861
  Library builds (vite lib mode) now externalize every non-relative import instead of bundling third-party CJS dependencies into the published dist. This avoids inlined `require("react")` / `require("react-dom")` calls that cause `Calling \`require\` for "react" in an environment that doesn't expose the \`require\` function` runtime errors when consumer apps re-bundle the published dist.
1431
1862
 
1432
1863
  Specifically fixes:
1864
+
1433
1865
  - `@object-ui/plugin-dashboard` no longer inlines `react-grid-layout` (and its transitive `react-draggable` / `react-resizable` CJS bundles). `react-grid-layout` is now declared as a peer dependency so consumers install a single ESM-friendly copy.
1434
1866
  - `@object-ui/components`, `@object-ui/plugin-calendar`, `@object-ui/plugin-charts`, `@object-ui/plugin-designer` no longer inline `react-i18next` / `i18next` / `use-sync-external-store` CJS shims.
1435
1867
  - All plugin packages now use a unified `external: (id) => !/^[./]/.test(id) && !id.startsWith(__dirname)` rule, ensuring future additions of CJS deps are automatically externalized.
package/README.md CHANGED
@@ -17,9 +17,27 @@ pnpm add @object-ui/layout
17
17
  ```
18
18
 
19
19
  **Peer Dependencies:**
20
- - `react` >= 18.0.0
21
- - `react-dom` >= 18.0.0
22
- - `react-router-dom` >= 6.0.0
20
+ - `react` ^18.0.0 || ^19.0.0
21
+ - `react-dom` ^18.0.0 || ^19.0.0
22
+ - `react-router-dom` ^6.0.0 || ^7.0.0
23
+
24
+ ## Registration
25
+
26
+ Importing this package registers its component keys (`page-header`, `page:card`,
27
+ `app-shell`, `responsive-grid`, `navigation-renderer`, `app-schema-renderer`) on
28
+ the `ComponentRegistry` as a module load side effect, so the side-effect-only
29
+ import is enough:
30
+
31
+ ```typescript
32
+ import '@object-ui/layout';
33
+ ```
34
+
35
+ That is a supported entry point, not an accident of the build: `package.json`
36
+ declares the registering modules in `sideEffects`, which is what stops a bundler
37
+ from tree-shaking a side-effect-only import away (objectui#3899 — the manifest
38
+ used to say `"sideEffects": false`, and a bundler honouring it dropped the
39
+ registration silently). `registerLayout()` is also exported for hosts that
40
+ prefer to register explicitly.
23
41
 
24
42
  ## Components
25
43
 
@@ -119,22 +137,11 @@ All components accept `className` prop for Tailwind customization:
119
137
 
120
138
  ## API Reference
121
139
 
122
- For detailed API documentation, visit the [Object UI Documentation](https://www.objectui.org/docs/layout).
123
-
124
- <!-- release-metadata:v3.3.0 -->
125
-
126
- ## Compatibility
127
-
128
- - **React:** 18.x or 19.x
129
- - **Node.js:** ≥ 18
130
- - **TypeScript:** ≥ 5.0 (strict mode)
131
- - **`@objectstack/spec`:** ^3.3.0
132
- - **`@objectstack/client`:** ^3.3.0
133
- - **Tailwind CSS:** ≥ 3.4 (for packages with UI)
140
+ For detailed API documentation, visit the [Object UI Documentation](https://www.objectui.org/docs/layout/app-shell).
134
141
 
135
142
  ## Links
136
143
 
137
- - 📚 [Documentation](https://www.objectui.org/docs/layout)
144
+ - 📚 [Documentation](https://www.objectui.org/docs/guide/layout)
138
145
  - 📦 [npm package](https://www.npmjs.com/package/@object-ui/layout)
139
146
  - 📝 [Changelog](./CHANGELOG.md)
140
147
  - 🐛 [Report an issue](https://github.com/objectstack-ai/objectui/issues)
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { NavigationItem } from '@object-ui/types';
2
+ import { NavigationItem, KeyedI18nLabel } from '@object-ui/types';
3
3
  /**
4
4
  * Callback to evaluate a visibility expression.
5
5
  * Return `true` if the item should be visible.
@@ -141,14 +141,18 @@ export interface NavigationRendererProps {
141
141
  export declare function resolveIcon(name?: string): React.ComponentType<any>;
142
142
  /**
143
143
  * Resolve a NavigationItem label to a plain string.
144
- * Handles both plain strings and I18nLabel objects { key, defaultValue }.
145
- * When a `t` function is provided, I18nLabel objects are translated via i18next.
144
+ *
145
+ * Handles both plain strings and the KEYED i18n form
146
+ * `{ key, defaultValue?, params? }` — named `KeyedI18nLabel` in
147
+ * `@object-ui/types` since #4581, which is what this signature now states
148
+ * instead of a third inline copy of the same object literal. When a `t`
149
+ * function is provided the key is translated via i18next.
150
+ *
151
+ * "Keyed", not the spec's `I18nLabel`: that one is the INLINE LOCALE MAP
152
+ * (`{ en: 'Owner' }`) resolved against a BCP-47 locale, and the two answer
153
+ * wrongly for each other's input, silently (objectui#4167).
146
154
  */
147
- export declare function resolveLabel(label: string | {
148
- key: string;
149
- defaultValue?: string;
150
- params?: Record<string, any>;
151
- }, t?: (key: string, options?: any) => string): string;
155
+ export declare function resolveLabel(label: string | KeyedI18nLabel, t?: (key: string, options?: any) => string): string;
152
156
  /** Guard callbacks for {@link hasVisibleNavigationItems}. */
153
157
  export interface NavigationVisibilityOptions {
154
158
  /** Evaluator for item `visible` expressions. Defaults to always-visible. */
@@ -1,28 +1,25 @@
1
1
  import { default as React } from 'react';
2
+ import { BreakpointColumnMap, BreakpointOrderMap } from '@objectstack/spec/ui';
2
3
  /**
3
- * Spec-aligned breakpoint column map (mirrors @objectstack/spec BreakpointColumnMapSchema).
4
- * Maps breakpoint names to grid column counts (1-12).
5
- */
6
- export interface BreakpointColumnMap {
7
- xs?: number;
8
- sm?: number;
9
- md?: number;
10
- lg?: number;
11
- xl?: number;
12
- '2xl'?: number;
13
- }
14
- /**
15
- * Spec-aligned breakpoint order map (mirrors @objectstack/spec BreakpointOrderMapSchema).
16
- * Maps breakpoint names to display order numbers.
4
+ * Breakpoint column map (`BreakpointColumnMapSchema`) and breakpoint order map
5
+ * (`BreakpointOrderMapSchema`), both re-exported from `@objectstack/spec/ui`.
6
+ *
7
+ * These were hand copies until objectui#4167, each carrying the word "mirrors"
8
+ * — the doc-comment shape objectstack#4115 catalogues, where the claim is what
9
+ * the next agent reads as canonical and the code is what actually decides. rc.6
10
+ * publishes both names, and both copies happened to still be exact: six
11
+ * optional numbers keyed `xs`…`2xl`, on a `$strict` schema. "Still exact" is
12
+ * the argument FOR binding them, not against — the copies had nothing to
13
+ * protect, so the only thing they could do from here was drift, and a
14
+ * breakpoint the spec adds now arrives instead of silently not existing.
15
+ *
16
+ * `BreakpointOrderMap` has no read point in this package (`ResponsiveGrid`
17
+ * resolves columns only); it is published because `ResponsiveConfigSchema`
18
+ * pairs the two and an author configuring order needs the type. Bound rather
19
+ * than deleted for that reason — deleting a published type is a separate
20
+ * decision from stopping it being a fork.
17
21
  */
18
- export interface BreakpointOrderMap {
19
- xs?: number;
20
- sm?: number;
21
- md?: number;
22
- lg?: number;
23
- xl?: number;
24
- '2xl'?: number;
25
- }
22
+ export type { BreakpointColumnMap, BreakpointOrderMap };
26
23
  export interface ResponsiveGridProps {
27
24
  /** Grid column map per breakpoint */
28
25
  columns?: BreakpointColumnMap;