@cosmicdrift/kumiko-headless 0.327.0 → 0.328.1

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.
Files changed (109) hide show
  1. package/dist/apex/css.d.ts +3 -0
  2. package/{src/apex/css.ts → dist/apex/css.js} +11 -24
  3. package/dist/apex/index.d.ts +229 -0
  4. package/dist/apex/index.js +360 -0
  5. package/dist/apex/lightbox.d.ts +4 -0
  6. package/{src/apex/lightbox.ts → dist/apex/lightbox.js} +0 -4
  7. package/dist/contracts/asset.d.ts +15 -0
  8. package/dist/contracts/asset.js +17 -0
  9. package/dist/contracts/index.d.ts +3 -0
  10. package/dist/contracts/index.js +1 -0
  11. package/dist/contracts/locale.d.ts +7 -0
  12. package/dist/contracts/locale.js +11 -0
  13. package/dist/contracts/primitives.d.ts +93 -0
  14. package/dist/contracts/primitives.js +21 -0
  15. package/dist/dispatcher/index.d.ts +2 -0
  16. package/dist/dispatcher/index.js +1 -0
  17. package/dist/dispatcher/types.d.ts +86 -0
  18. package/dist/dispatcher/types.js +34 -0
  19. package/dist/form/form-controller.d.ts +2 -0
  20. package/dist/form/form-controller.js +404 -0
  21. package/dist/form/index.d.ts +3 -0
  22. package/dist/form/index.js +2 -0
  23. package/dist/form/types.d.ts +71 -0
  24. package/dist/form/types.js +1 -0
  25. package/dist/form/zod-bridge.d.ts +5 -0
  26. package/{src/form/zod-bridge.ts → dist/form/zod-bridge.js} +52 -58
  27. package/dist/format/escape.d.ts +5 -0
  28. package/{src/format/escape.ts → dist/format/escape.js} +43 -47
  29. package/dist/format/html-template.d.ts +9 -0
  30. package/dist/format/html-template.js +39 -0
  31. package/dist/format/index.d.ts +10 -0
  32. package/dist/format/index.js +192 -0
  33. package/dist/format/money.d.ts +1 -0
  34. package/{src/format/money.ts → dist/format/money.js} +6 -5
  35. package/dist/index.d.ts +14 -0
  36. package/dist/index.js +9 -0
  37. package/dist/locale-routing/index.d.ts +39 -0
  38. package/dist/locale-routing/index.js +143 -0
  39. package/dist/nav/index.d.ts +2 -0
  40. package/dist/nav/index.js +1 -0
  41. package/dist/nav/resolve.d.ts +2 -0
  42. package/dist/nav/resolve.js +58 -0
  43. package/dist/nav/types.d.ts +26 -0
  44. package/dist/nav/types.js +1 -0
  45. package/dist/store/create-store.d.ts +2 -0
  46. package/{src/store/create-store.ts → dist/store/create-store.js} +21 -23
  47. package/dist/store/equality.d.ts +1 -0
  48. package/{src/store/equality.ts → dist/store/equality.js} +19 -17
  49. package/dist/store/index.d.ts +3 -0
  50. package/dist/store/index.js +2 -0
  51. package/dist/store/types.d.ts +7 -0
  52. package/dist/store/types.js +10 -0
  53. package/dist/view-model/edit.d.ts +10 -0
  54. package/dist/view-model/edit.js +392 -0
  55. package/dist/view-model/embedded-list.d.ts +27 -0
  56. package/dist/view-model/embedded-list.js +63 -0
  57. package/dist/view-model/index.d.ts +7 -0
  58. package/dist/view-model/index.js +3 -0
  59. package/dist/view-model/list.d.ts +16 -0
  60. package/dist/view-model/list.js +201 -0
  61. package/dist/view-model/types.d.ts +300 -0
  62. package/dist/view-model/types.js +1 -0
  63. package/package.json +31 -12
  64. package/src/changes.json +7 -0
  65. package/src/apex/__tests__/lightbox.test.ts +0 -20
  66. package/src/apex/__tests__/page-head.test.ts +0 -63
  67. package/src/apex/__tests__/render.test.ts +0 -401
  68. package/src/apex/index.ts +0 -667
  69. package/src/contracts/__tests__/contracts.test.ts +0 -123
  70. package/src/contracts/__tests__/field-issue-compat.test.ts +0 -19
  71. package/src/contracts/asset.ts +0 -48
  72. package/src/contracts/index.ts +0 -23
  73. package/src/contracts/locale.ts +0 -33
  74. package/src/contracts/primitives.ts +0 -158
  75. package/src/dispatcher/__tests__/contract.test.ts +0 -163
  76. package/src/dispatcher/index.ts +0 -16
  77. package/src/dispatcher/types.ts +0 -217
  78. package/src/form/__tests__/conditional-fields.test.ts +0 -177
  79. package/src/form/__tests__/form-controller.test.ts +0 -231
  80. package/src/form/__tests__/submit.test.ts +0 -575
  81. package/src/form/__tests__/validation.test.ts +0 -274
  82. package/src/form/form-controller.ts +0 -458
  83. package/src/form/index.ts +0 -15
  84. package/src/form/types.ts +0 -297
  85. package/src/format/__tests__/escape.test.ts +0 -79
  86. package/src/format/__tests__/format.test.ts +0 -281
  87. package/src/format/__tests__/html-template.test.ts +0 -47
  88. package/src/format/html-template.ts +0 -49
  89. package/src/format/index.ts +0 -219
  90. package/src/index.ts +0 -118
  91. package/src/locale-routing/__tests__/locale-routing.test.ts +0 -276
  92. package/src/locale-routing/index.ts +0 -218
  93. package/src/nav/__tests__/resolve.test.ts +0 -279
  94. package/src/nav/index.ts +0 -8
  95. package/src/nav/resolve.ts +0 -60
  96. package/src/nav/types.ts +0 -70
  97. package/src/store/__tests__/create-store.test.ts +0 -139
  98. package/src/store/__tests__/equality.test.ts +0 -66
  99. package/src/store/index.ts +0 -3
  100. package/src/store/types.ts +0 -27
  101. package/src/view-model/__tests__/edit.test.ts +0 -1072
  102. package/src/view-model/__tests__/embedded-list.test.ts +0 -96
  103. package/src/view-model/__tests__/field-labels.test.ts +0 -62
  104. package/src/view-model/__tests__/list.test.ts +0 -428
  105. package/src/view-model/edit.ts +0 -641
  106. package/src/view-model/embedded-list.ts +0 -89
  107. package/src/view-model/index.ts +0 -43
  108. package/src/view-model/list.ts +0 -277
  109. package/src/view-model/types.ts +0 -392
@@ -1,392 +0,0 @@
1
- import type {
2
- EditFieldSpec,
3
- EditSectionSpec,
4
- FieldIconKey,
5
- FieldRenderer,
6
- IconKey,
7
- ListColumnSpec,
8
- ListFacetSpec,
9
- ListSortSpec,
10
- PlatformComponent,
11
- RelatedListToolbarAction,
12
- RowAction,
13
- ScreenSlots,
14
- } from "@cosmicdrift/kumiko-framework/ui-types";
15
-
16
- // Runtime-only renderer — function form allowed here because the renderer
17
- // layer (render-list) injects reference-column lookup closures at mount time.
18
- // Never serialized to JSON.
19
- export type RuntimeRenderer = (value: unknown, row?: Readonly<Record<string, unknown>>) => string;
20
-
21
- // View-Models — plain data structures produced by computeListViewModel and
22
- // computeEditViewModel. They flatten the combined [screen-def + entity-def
23
- // + row-data + user] inputs into a shape the renderer draws directly,
24
- // without re-resolving conditions or re-reading the entity field map.
25
- //
26
- // The renderer's render-list.tsx / render-edit.tsx are essentially
27
- // (viewModel) => JSX // on web
28
- // (viewModel) => <View/Text> // on native
29
- // so everything the renderer needs to render one frame must be in here.
30
- //
31
- // Why pre-compute instead of resolving at render-time: predicates
32
- // (visible/readonly/required) are arbitrary JS closures — running them
33
- // inside React's render is wasteful (happens on every re-render, even
34
- // when values haven't changed) and mixes side-effect-free view code
35
- // with business logic. Computing once on form-state-change gives the
36
- // renderer pure data and keeps render paths trivial.
37
-
38
- // --- list view model ---
39
-
40
- // One column, fully resolved. `label` is the localized string the
41
- // renderer puts in the column header; view-model builder runs it through
42
- // LocaleResolver.translate() from the i18nKey wired onto the field.
43
- // `renderer` passes through ScreenDefinition's FieldRenderer verbatim; the
44
- // renderer layer may also inject a RuntimeRenderer closure (reference lookups).
45
- export type ListColumnViewModel = {
46
- readonly field: string;
47
- readonly label: string;
48
- readonly type: string; // field-type ("text", "number", "money", ...)
49
- readonly renderer?: FieldRenderer | RuntimeRenderer;
50
- readonly sortable: boolean;
51
- /** Only for `type: "select"` or `type: "multiSelect"` — translated option
52
- * labels keyed by raw value. The renderer renders `optionLabels[value]`
53
- * instead of humanizeSlug when present. Convention key:
54
- * `<feature>:entity:<entity>:field:<field>:option:<value>`. */
55
- readonly optionLabels?: Readonly<Record<string, string>>;
56
- /** Nur bei `type: "reference"` — referenced Entity-Name für Bulk-
57
- * Lookup im Renderer (`<refFeature>:query:<refEntity>:list`). */
58
- readonly refEntity?: string;
59
- /** Nur bei `type: "reference"` — Feature-Name in dem die referenced
60
- * Entity wohnt. Default = current feature. Cross-Feature über
61
- * qualifizierte Form ("feature:entity") am ReferenceFieldDef. */
62
- readonly refFeature?: string;
63
- /** Nur bei `type: "reference"` — Welches Feld der referenced Entity
64
- * als Display-Wert in der Cell erscheint (Default "id"). */
65
- readonly refLabelField?: string;
66
- /** Set by the caller at runtime (not schema-derived) to emphasize one
67
- * column — e.g. the currently selected base-year column in a
68
- * multi-year statement grid. DataTable renders it with a distinct
69
- * header/cell background. */
70
- readonly highlighted?: boolean;
71
- /** Only for `type: "number"` — mirrors `NumberFieldDef.grouping` (default
72
- * `true`). `false` renders without thousands-separators (e.g. a model
73
- * year). */
74
- readonly grouping?: boolean;
75
- };
76
-
77
- export type ListRowViewModel = {
78
- readonly id: string;
79
- readonly values: Readonly<Record<string, unknown>>;
80
- };
81
-
82
- export type ListViewModel = {
83
- readonly screenId: string;
84
- readonly entityName: string;
85
- readonly columns: readonly ListColumnViewModel[];
86
- readonly rows: readonly ListRowViewModel[];
87
- readonly slots?: ScreenSlots;
88
- // Flags for the renderer to decide what kind of container to draw.
89
- readonly isEmpty: boolean;
90
- };
91
-
92
- // --- edit view model ---
93
-
94
- // Per-cell metadata for one sub-field of an embedded-LIST field
95
- // (`multiple: true`) — the column/cell shape a renderer needs to draw an
96
- // invoice-positions-style table. One entry per key of the source
97
- // EmbeddedFieldDef's `schema`.
98
- export type EmbeddedListCellViewModel = {
99
- readonly field: string;
100
- readonly label: string;
101
- readonly type:
102
- | "text"
103
- | "number"
104
- | "boolean"
105
- | "date"
106
- | "money"
107
- | "decimal"
108
- | "select"
109
- | "reference"
110
- | "timestamp";
111
- readonly required: boolean;
112
- /** Only for `type: "select"`. */
113
- readonly options?: readonly string[];
114
- readonly optionLabels?: Readonly<Record<string, string>>;
115
- /** Only for `type: "reference"`. */
116
- readonly refEntity?: string;
117
- readonly refFeature?: string;
118
- readonly refLabelField?: string;
119
- readonly refOptionsQuery?: string;
120
- /** Only for `type: "decimal"`. */
121
- readonly scale?: number;
122
- };
123
-
124
- // Resolved field — all predicates evaluated, labels translated. The
125
- // renderer reads `{ visible, readonly, required }` directly without
126
- // re-running any predicate.
127
- export type EditFieldViewModel = {
128
- readonly field: string;
129
- readonly label: string;
130
- readonly type: string;
131
- readonly value: unknown;
132
- readonly visible: boolean;
133
- // `readOnly` (camelCase) matches the spec-side name on EditFieldSpec —
134
- // one convention through the stack. The TS property modifier `readonly`
135
- // (lowercase) only collides as a key name in type declarations of the
136
- // spec; here in the view-model we could have used either, but symmetric
137
- // naming beats clever ergonomics. Parallel-agent chose `readOnly` on
138
- // the input; we honour it on the output.
139
- readonly readOnly: boolean;
140
- readonly required: boolean;
141
- readonly span?: number;
142
- readonly renderer?: FieldRenderer;
143
- /** Set for `type: "select"` and `type: "multiSelect"` — the allowed
144
- * values. The renderer uses these as dropdown/combobox options.
145
- * Source is SelectFieldDef.options / MultiSelectFieldDef.options on
146
- * the EntityDefinition. */
147
- readonly options?: readonly string[];
148
- /** Set for `type: "select"` and `type: "multiSelect"` — translated
149
- * labels per option, keyed by raw value. The renderer shows
150
- * `optionLabels[value]` as the dropdown/combobox label instead of the
151
- * raw value. Convention key:
152
- * `<feature>:entity:<entity>:field:<field>:option:<value>`. */
153
- readonly optionLabels?: Readonly<Record<string, string>>;
154
- /** Set for `type: "multiSelect"` when MultiSelectFieldDef.display is
155
- * "checkboxes" — the renderer shows a checkbox grid with a select-all
156
- * toggle instead of the default combobox dropdown. Set for
157
- * `type: "select"` when SelectFieldDef.display is "radio" or "dropdown" —
158
- * the renderer then skips its own radio-vs-dropdown heuristic. */
159
- readonly display?: "checkboxes" | "dropdown" | "radio";
160
- /** Set for `type: "multiSelect"` when MultiSelectFieldDef.columns is
161
- * defined — column count for the checkbox grid at the widest breakpoint.
162
- * Ignored unless `display` is "checkboxes". */
163
- readonly columns?: 1 | 2 | 3 | 4;
164
- /** Set for `type: "multiSelect"` when MultiSelectFieldDef.maxRows is
165
- * defined — grid rows visible before the checkbox grid becomes
166
- * scrollable. Ignored unless `display` is "checkboxes". */
167
- readonly maxRows?: number;
168
- /** For `type: "text"`, set when TextFieldDef.multiline is true — the
169
- * renderer then renders a textarea instead of a single-line input.
170
- * `type: "longText"` always renders a textarea regardless of this
171
- * value; here it only carries an optional `{ rows }` override.
172
- * `true` = default rows, `{ rows }` = explicit height. */
173
- readonly multiline?: boolean | { readonly rows?: number };
174
- /** From TextFieldDef.format — `password` makes the renderer mask the input. */
175
- readonly format?: "email" | "url" | "phone" | "password";
176
- /** Nur bei `type: "timestamp"` gesetzt wenn TimestampFieldDef.locatedBy
177
- * existiert — Wall-Clock-Zeit ohne Offset. Der Renderer emittiert
178
- * dann lokale Zeit ohne `Z` statt eines UTC-Instants. */
179
- readonly wallClock?: boolean;
180
- /** Nur bei `type: "date" | "timestamp"` — Datumsgrenzen (ISO) und
181
- * Format/Locale-Override aus der FieldDefinition. Der Renderer begrenzt
182
- * damit den Picker; die Write-Validierung läuft separat über Zod. */
183
- readonly min?: string;
184
- readonly max?: string;
185
- readonly dateLocale?: string;
186
- /** Only for `type: "number"` — mirrors `NumberFieldDef.grouping` (default
187
- * `true`). `false` renders without thousands-separators (e.g. a model
188
- * year). */
189
- readonly grouping?: boolean;
190
- /** Nur bei `type: "reference"` gesetzt — Tier 2.7e-3.
191
- * Die referenced Entity (kurz, ohne feature-prefix). Der Renderer
192
- * baut die Query-QN als `<refFeature>:query:<refEntity>:list`. */
193
- readonly refEntity?: string;
194
- /** Nur bei `type: "reference"` gesetzt — Feature-Name in dem die
195
- * referenced Entity wohnt. Same-feature default = aktuelles
196
- * Feature. Cross-Feature wird über "feature:entity" am
197
- * ReferenceFieldDef.entity erkannt. */
198
- readonly refFeature?: string;
199
- /** Nur bei `type: "reference"` gesetzt — Welches Feld der referenced
200
- * Entity als Display-Label im Dropdown erscheint. Default: "id". */
201
- readonly refLabelField?: string;
202
- /** Only for `type: "reference"` — query handler QN the picker sources its
203
- * options from (fw#2780), replacing the referenced entity's list handler.
204
- * Rows carry `{ id, label }`; `refLabelField` is then unused for the
205
- * picker but still drives list cells. */
206
- readonly refOptionsQuery?: string;
207
- /** Nur bei `type: "reference"` — Multi-Mode (Tier 2.7e-Multi):
208
- * Wert ist UUID-Array, Renderer mountet Multi-Combobox mit Tags. */
209
- readonly refMultiple?: boolean;
210
- /** Nur bei `type: "file" | "image"` — erlaubte Extensions/MIME (z.B.
211
- * ["jpg","png"]) + Max-Größe ("5mb"). Der Renderer setzt das `accept`-
212
- * Attribut + zeigt die Grenze; die Validierung läuft serverseitig im
213
- * Upload-Endpoint gegen die Field-Def. */
214
- readonly accept?: readonly string[];
215
- readonly maxSize?: string;
216
- /** Nur bei `type: "file" | "image"` — Entity-Name + Field-Name für den
217
- * Upload-POST (`/api/files`), damit der Endpoint maxSize/accept gegen
218
- * die richtige Field-Def prüfen kann. */
219
- readonly entityType?: string;
220
- readonly fieldName?: string;
221
- /** Only for `type: "image"` — the variant name the preview requests
222
- * (`/api/files/:id/variant/:name`) instead of the original. The FIRST
223
- * variant declared on the field def wins; a spec may legitimately carry
224
- * neither `size` nor `maxEdge` (format-/blur-only), so "the smallest one"
225
- * is not a rule that always has an answer. Absent when the field declares
226
- * no variants — the preview then loads the original. */
227
- readonly imageVariant?: string;
228
- /** Only for `type: "image"` — forwarded to the file input's `capture`
229
- * attribute so a phone opens the camera instead of the file picker. */
230
- readonly capture?: "environment" | "user";
231
- /** Closed FieldIconKey from EditFieldSpec.icon (FIELD_ICONS registry). */
232
- readonly icon?: FieldIconKey;
233
- /** Only set for an embedded-LIST field (`multiple: true`) — the per-cell
234
- * metadata the renderer needs to draw each column/cell. Absent for a
235
- * plain (non-list) embedded field. */
236
- readonly embeddedListCells?: readonly EmbeddedListCellViewModel[];
237
- /** Minimum row count for the embedded list. From EmbeddedFieldDef.minItems. */
238
- readonly embeddedListMinItems?: number;
239
- /** Maximum row count for the embedded list. From EmbeddedFieldDef.maxItems. */
240
- readonly embeddedListMaxItems?: number;
241
- /** Sub-field name → how to compute its cell from other sub-fields of the
242
- * same row. From EmbeddedFieldDef.derived. */
243
- readonly embeddedListDerived?: Readonly<
244
- Record<
245
- string,
246
- { readonly op: "multiply" | "sum" | "subtract"; readonly from: readonly string[] }
247
- >
248
- >;
249
- /** Numeric sub-field names to sum in a totals row. From EmbeddedFieldDef.totals. */
250
- readonly embeddedListTotals?: readonly string[];
251
- /** Currency for the whole embedded list's money cells and totals row —
252
- * currency lives on the head aggregate (EntityDefinition.defaultCurrency),
253
- * not per row. Falls back to "EUR" when the entity has no defaultCurrency. */
254
- readonly embeddedListCurrency?: string;
255
- /** Only set for a plain (non-list, non-embedded) `type: "money"` field —
256
- * same source as embeddedListCurrency (EntityDefinition.defaultCurrency,
257
- * falls back to "EUR"). The renderer needs this to build the payload's
258
- * `{amount, currency}` shape (kumiko-framework#1923). */
259
- readonly currency?: string;
260
- /** Only set for `type: "number"` when NumberFieldDef.unit is set — a static
261
- * suffix string, or a sibling-field reference the renderer resolves against
262
- * the live row values. Display-only, never converts the stored number. */
263
- readonly unit?: string | { readonly field: string };
264
- };
265
-
266
- // Discriminated by `kind` — mirrors EditSectionSpec on the engine side.
267
- // The builder always emits `kind` explicitly (no defaulting), so the
268
- // renderer narrows with a strict equality check.
269
- export type EditSectionViewModel =
270
- | EditFieldsSectionViewModel
271
- | EditExtensionSectionViewModel
272
- | EditRelatedListSectionViewModel
273
- | EditWriteFormSectionViewModel;
274
-
275
- export type EditFieldsSectionViewModel = {
276
- readonly kind: "fields";
277
- /** From `EditFieldsSection.id`. The boot-validator makes it mandatory under
278
- * `layout.mode: "tabs"` so the tab strip has a stable key per tab; other
279
- * layouts leave it unset. */
280
- readonly id?: string;
281
- /** False when the section has fields but none of them is visible.
282
- * The renderer then draws nothing, but the section stays in the array
283
- * (key stability). */
284
- readonly visible: boolean;
285
- /** Optional — eine titellose Section rendert nur ihre Felder (flache Form). */
286
- readonly title?: string;
287
- /** Translated help text under the block heading, from
288
- * `EditFieldsSection.description`. Renders even without `title`. */
289
- readonly description?: string;
290
- readonly columns: number;
291
- readonly fields: readonly EditFieldViewModel[];
292
- /** From `EditFieldsSection.groups` — each entry's `fields` are the same
293
- * view-model objects as `fields` above, re-grouped (not recomputed). */
294
- readonly groups?: readonly {
295
- readonly title: string;
296
- readonly columns: number;
297
- readonly fields: readonly EditFieldViewModel[];
298
- }[];
299
- /** From `EditFieldsSection.icon` — closed IconKey vocabulary, renders
300
- * left of the title. No effect without `title`. */
301
- readonly icon?: IconKey;
302
- /** From `EditFieldsSection.actions` — rendered in the Section's
303
- * title row, same slot as the projectionDetail head card's actions. */
304
- readonly actions?: readonly RowAction[];
305
- };
306
-
307
- export type EditExtensionSectionViewModel = {
308
- readonly kind: "extension";
309
- /** From `EditExtensionSection.id` — same tab-strip role as on a "fields"
310
- * section, see EditFieldsSectionViewModel.id. */
311
- readonly id?: string;
312
- readonly title: string;
313
- readonly component: PlatformComponent;
314
- readonly contributesToFormSubmit: boolean;
315
- /** Section-declared override — see `EditExtensionSection.entityName`. */
316
- readonly entityName?: string;
317
- /** From `EditExtensionSection.actions`. */
318
- readonly actions?: readonly RowAction[];
319
- };
320
-
321
- // Mirrors EditRelatedListSection verbatim — no per-row/query resolution
322
- // happens in the view-model builder, the renderer's RelatedListSection
323
- // runs the query itself (fw#2166).
324
- export type EditRelatedListSectionViewModel = {
325
- readonly kind: "relatedList";
326
- readonly title: string;
327
- readonly query: string;
328
- readonly parentParam?: string;
329
- readonly parentFilter?: { readonly field: string };
330
- readonly columns: readonly ListColumnSpec[];
331
- readonly pageSize?: number;
332
- readonly defaultSort?: ListSortSpec;
333
- readonly searchable?: boolean;
334
- readonly facets?: readonly ListFacetSpec[];
335
- readonly rowClick?: { readonly entity: string; readonly idColumn?: string };
336
- readonly rowActions?: readonly RowAction[];
337
- readonly toolbarActions?: readonly RelatedListToolbarAction[];
338
- /** From `EditRelatedListSection.actions` — rendered in the
339
- * Section's title row, distinct from `toolbarActions` (which render
340
- * above the table itself). */
341
- readonly actions?: readonly RowAction[];
342
- /** From `EditRelatedListSection.emptyState` — forwarded to the
343
- * DataTable's `emptyState` prop when the section has zero rows. */
344
- readonly emptyState?: {
345
- readonly title: string;
346
- readonly description?: string;
347
- readonly action?: RowAction;
348
- };
349
- };
350
-
351
- // Mirrors EditWriteFormSection, except `fields` is already resolved through
352
- // the same per-field pipeline as EditFieldsSectionViewModel (computed via a
353
- // recursive computeEditViewModel call against the section's own fieldDefs —
354
- // see edit.ts) — the renderer needs no second field-resolution path.
355
- export type EditWriteFormSectionViewModel = {
356
- readonly kind: "writeForm";
357
- readonly title?: string;
358
- readonly description?: string;
359
- readonly columns: number;
360
- readonly fields: readonly EditFieldViewModel[];
361
- readonly icon?: IconKey;
362
- readonly handler: string;
363
- readonly submitLabel?: string;
364
- /** From `EditWriteFormSection.actions`. */
365
- readonly actions?: readonly RowAction[];
366
- };
367
-
368
- export type EditViewModel = {
369
- readonly screenId: string;
370
- readonly entityName: string;
371
- readonly id: string | null; // null on create (no existing row)
372
- readonly sections: readonly EditSectionViewModel[];
373
- readonly slots?: ScreenSlots;
374
- };
375
-
376
- // --- resolver interfaces (host-injected) ---
377
-
378
- // The view-model builder calls this to translate i18n keys into strings.
379
- // Normally the host passes the renderer's LocaleResolver.translate
380
- // directly — keeping the interface narrow here avoids dragging the full
381
- // LocaleResolver (with subscribe) into a pure compute path.
382
- export type Translate = (key: string, params?: Readonly<Record<string, unknown>>) => string;
383
-
384
- // Optional condition context forwarded to field visibility/readonly/required
385
- // predicates. Same ctx the form-controller uses in conditional-fields — so
386
- // a predicate that gated "admin-only" there keeps working here.
387
- export type FieldConditionCtx = unknown;
388
-
389
- // Re-export the ScreenDef spec halves we don't want ui-core callers to
390
- // import from @cosmicdrift/kumiko-framework separately. Renderer packages expect a
391
- // single import surface.
392
- export type { EditFieldSpec, EditSectionSpec, FieldRenderer, ListColumnSpec, ScreenSlots };