@serene-pub/sdk 0.6.0-pr-2 → 0.6.0-pr-5

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 (186) hide show
  1. package/README.md +24 -20
  2. package/dist/actions.d.ts +150 -68
  3. package/dist/actions.js +90 -36
  4. package/dist/annexFields.d.ts +8 -4
  5. package/dist/annexFields.js +5 -2
  6. package/dist/announce.d.ts +78 -28
  7. package/dist/announce.js +14 -5
  8. package/dist/attributes.d.ts +9 -6
  9. package/dist/attributes.js +9 -5
  10. package/dist/bands.d.ts +41 -6
  11. package/dist/bands.js +83 -33
  12. package/dist/builder.d.ts +161 -58
  13. package/dist/builder.js +128 -22
  14. package/dist/candidates.d.ts +5 -3
  15. package/dist/candidates.js +3 -2
  16. package/dist/clauses.d.ts +2 -1
  17. package/dist/clauses.js +2 -1
  18. package/dist/component.d.ts +24 -7
  19. package/dist/component.js +16 -6
  20. package/dist/componentBuild.d.ts +16 -5
  21. package/dist/componentBuild.js +14 -5
  22. package/dist/componentClient.d.ts +61 -30
  23. package/dist/componentClient.js +11 -1
  24. package/dist/componentImports.d.ts +8 -5
  25. package/dist/componentImports.js +23 -4
  26. package/dist/componentModule.js +2 -1
  27. package/dist/componentWire.d.ts +2 -1
  28. package/dist/componentWire.js +34 -2
  29. package/dist/config.d.ts +28 -14
  30. package/dist/config.js +20 -10
  31. package/dist/connections.d.ts +9 -4
  32. package/dist/connections.js +7 -4
  33. package/dist/declarations.d.ts +46 -17
  34. package/dist/declarations.js +46 -15
  35. package/dist/descriptors.d.ts +242 -97
  36. package/dist/descriptors.js +145 -41
  37. package/dist/dev.d.ts +6 -5
  38. package/dist/dev.js +6 -5
  39. package/dist/document.d.ts +74 -25
  40. package/dist/document.js +32 -11
  41. package/dist/dowry.d.ts +241 -0
  42. package/dist/dowry.js +315 -0
  43. package/dist/engines.d.ts +16 -7
  44. package/dist/engines.js +6 -4
  45. package/dist/eventMapLaws.d.ts +19 -8
  46. package/dist/eventMapLaws.js +9 -6
  47. package/dist/events.d.ts +101 -39
  48. package/dist/events.js +106 -33
  49. package/dist/executor.d.ts +122 -41
  50. package/dist/executor.js +195 -96
  51. package/dist/extension.d.ts +99 -35
  52. package/dist/extension.js +43 -9
  53. package/dist/facets.d.ts +2 -1
  54. package/dist/facets.js +4 -2
  55. package/dist/foldedSections.d.ts +4 -2
  56. package/dist/foldedSections.js +2 -1
  57. package/dist/genres.d.ts +123 -41
  58. package/dist/genres.js +127 -22
  59. package/dist/guardedConnection.d.ts +4 -3
  60. package/dist/guardedConnection.js +4 -3
  61. package/dist/handlebarsReach.d.ts +1 -1
  62. package/dist/handlebarsReach.js +1 -1
  63. package/dist/hash.d.ts +16 -5
  64. package/dist/hash.js +14 -4
  65. package/dist/hookGrants.d.ts +3 -2
  66. package/dist/hookGrants.js +6 -4
  67. package/dist/hooks.d.ts +21 -16
  68. package/dist/hooks.js +12 -10
  69. package/dist/hostElements.d.ts +41 -17
  70. package/dist/hostElements.js +49 -17
  71. package/dist/i18n.d.ts +5 -3
  72. package/dist/i18n.js +5 -3
  73. package/dist/identity.d.ts +5 -4
  74. package/dist/identity.js +5 -4
  75. package/dist/index.d.ts +5 -0
  76. package/dist/index.js +15 -0
  77. package/dist/layout.d.ts +36 -15
  78. package/dist/layout.js +2 -2
  79. package/dist/loadouts.d.ts +97 -0
  80. package/dist/loadouts.js +81 -0
  81. package/dist/media.d.ts +26 -4
  82. package/dist/media.js +2 -1
  83. package/dist/messageBlocks.d.ts +44 -32
  84. package/dist/messageBlocks.js +23 -18
  85. package/dist/migration.d.ts +16 -8
  86. package/dist/migration.js +14 -8
  87. package/dist/names.d.ts +2 -1
  88. package/dist/names.js +2 -1
  89. package/dist/nodeInput.d.ts +2 -1
  90. package/dist/nodeInput.js +2 -1
  91. package/dist/participants.d.ts +22 -15
  92. package/dist/participants.js +14 -12
  93. package/dist/personGate.d.ts +2 -1
  94. package/dist/personGate.js +2 -1
  95. package/dist/pluginHarness.d.ts +8 -3
  96. package/dist/pluginHarness.js +4 -2
  97. package/dist/pluginPermissions.d.ts +2 -1
  98. package/dist/pluginPermissions.js +12 -1
  99. package/dist/pluginRuleRef.d.ts +2 -2
  100. package/dist/pluginRuleRef.js +1 -1
  101. package/dist/predicates.d.ts +16 -11
  102. package/dist/predicates.js +7 -6
  103. package/dist/preview.d.ts +8 -3
  104. package/dist/preview.js +2 -1
  105. package/dist/promptBlocks.d.ts +5 -3
  106. package/dist/promptBlocks.js +5 -3
  107. package/dist/rankingDecisions.d.ts +2 -1
  108. package/dist/rankingDecisions.js +2 -1
  109. package/dist/receipt.d.ts +65 -29
  110. package/dist/receipt.js +9 -4
  111. package/dist/receiverRules.js +3 -2
  112. package/dist/refs.d.ts +34 -9
  113. package/dist/refs.js +33 -13
  114. package/dist/registry.d.ts +42 -23
  115. package/dist/registry.js +7 -5
  116. package/dist/review.d.ts +16 -5
  117. package/dist/review.js +11 -4
  118. package/dist/sampling.d.ts +54 -0
  119. package/dist/sampling.js +95 -3
  120. package/dist/sceneSettings.d.ts +312 -0
  121. package/dist/sceneSettings.js +425 -0
  122. package/dist/scope.d.ts +6 -4
  123. package/dist/scope.js +4 -3
  124. package/dist/scripts.d.ts +81 -14
  125. package/dist/scripts.js +90 -11
  126. package/dist/sessionDossier.d.ts +521 -0
  127. package/dist/sessionDossier.js +33 -0
  128. package/dist/sessionLayout.d.ts +303 -19
  129. package/dist/sessionLayout.js +354 -40
  130. package/dist/sessionSettings.d.ts +8 -5
  131. package/dist/settings.d.ts +45 -20
  132. package/dist/settings.js +19 -12
  133. package/dist/settingsSlot.d.ts +11 -8
  134. package/dist/settingsSlot.js +11 -8
  135. package/dist/shapes.d.ts +103 -41
  136. package/dist/shapes.js +105 -40
  137. package/dist/sheets.d.ts +4 -2
  138. package/dist/sheets.js +6 -3
  139. package/dist/statShapes.d.ts +2 -1
  140. package/dist/statShapes.js +2 -1
  141. package/dist/status.d.ts +13 -9
  142. package/dist/status.js +8 -6
  143. package/dist/storage.d.ts +2 -1
  144. package/dist/storage.js +2 -1
  145. package/dist/storyTime.d.ts +13 -7
  146. package/dist/storyTime.js +11 -6
  147. package/dist/strokes.d.ts +176 -0
  148. package/dist/strokes.js +281 -0
  149. package/dist/surfaces.d.ts +54 -25
  150. package/dist/surfaces.js +3 -3
  151. package/dist/template.d.ts +9 -5
  152. package/dist/template.js +5 -3
  153. package/dist/templateCheck.d.ts +2 -2
  154. package/dist/templateCheck.js +2 -2
  155. package/dist/templateFit.d.ts +37 -8
  156. package/dist/templateFit.js +92 -8
  157. package/dist/templateIds.d.ts +3 -3
  158. package/dist/templateIds.js +3 -3
  159. package/dist/templateScopeAt.d.ts +21 -11
  160. package/dist/templateScopeAt.js +21 -11
  161. package/dist/testing.d.ts +11 -4
  162. package/dist/testing.js +13 -5
  163. package/dist/tokenizers.d.ts +2 -2
  164. package/dist/tokenizers.js +2 -2
  165. package/dist/turnLock.d.ts +4 -2
  166. package/dist/turnLock.js +2 -1
  167. package/dist/turnOrder.d.ts +17 -11
  168. package/dist/turnOrder.js +9 -5
  169. package/dist/validate.d.ts +11 -8
  170. package/dist/validate.js +81 -10
  171. package/dist/values.d.ts +17 -8
  172. package/dist/values.js +11 -6
  173. package/dist/variables.d.ts +46 -7
  174. package/dist/variables.js +87 -6
  175. package/dist/verdicts.d.ts +20 -13
  176. package/dist/verdicts.js +17 -11
  177. package/dist/widgetDecls.d.ts +8 -4
  178. package/dist/widgetDecls.js +4 -2
  179. package/dist/widgets.d.ts +987 -94
  180. package/dist/widgets.js +93 -18
  181. package/dist/wire.d.ts +13 -6
  182. package/dist/wire.js +3 -3
  183. package/dist/worldinfo.d.ts +11 -6
  184. package/dist/worldinfo.js +8 -4
  185. package/host-elements.d.ts +13 -0
  186. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The **session layout** (`SessionLayoutV1`, NOMENCLATURE §9) — the ONE layout
2
+ * The **session layout** (`SessionLayoutV1`) — the ONE layout
3
3
  * format: what the screen draws, what a person arranges, what a genre or a
4
4
  * plugin ships (`GenreLayoutDecl.preset`), and what a **session layout preset**
5
5
  * row stores. Plain JSON, stored verbatim; every reader reads it defensively,
@@ -17,6 +17,13 @@
17
17
  * - `arrangedGrid` — the arrangement per zone: whole grid cells (`cols` ×
18
18
  * `rows`) and each widget's cell box. Where a zone has one, it is what draws.
19
19
  *
20
+ * Three slots can name one zone, so what the screen DRAWS is a reading of
21
+ * them, and there is one: {@link resolveDrawn} (→ {@link DrawnLayout}) decides
22
+ * which slot draws each zone, drops retired widgets, gives every placed
23
+ * instance one pin ({@link pinnedOf}: absent means pinned) and walks each
24
+ * side's width ladder ({@link zoneRungAt}). The id readers that ask "is it
25
+ * drawn" ({@link drawnWidgetIds}, {@link primaryPlaced}) are that answer.
26
+ *
20
27
  * A named layout adds `widgetSettings` and `widgetStyles` (per-instance values
21
28
  * and style pins), so one blob is the portable layout. A session keeps those
22
29
  * two in its own rows instead, and its row adds the surface manager's
@@ -40,6 +47,7 @@
40
47
  * package SHIPS ({@link validateSessionLayout}), where refusing is right. No
41
48
  * `svelte` import, ever: a linked package that imports svelte gives the app a
42
49
  * second Svelte.
50
+ * @ruling NOMENCLATURE §9
43
51
  */
44
52
  import type { WidgetDecl } from './layout.js';
45
53
  /** The three zones, in visual order. There is no fourth. @experimental */
@@ -50,9 +58,19 @@ export type ZoneId = (typeof ZONE_IDS)[number];
50
58
  export declare const INSTANCE_NAME_SEPARATOR = "#";
51
59
  /** An instance name: short, kebab, lower case (`sanctum`, `2`). @experimental */
52
60
  export declare const INSTANCE_NAME: RegExp;
53
- /** The widget a placed id is a copy of: the id up to its `#`, else the id. @experimental */
61
+ /**
62
+ * The widget a placed id is a copy of: the id up to its `#`, else the id —
63
+ * read through {@link WIDGET_ID_ALIASES}, so `world-state` is a copy of
64
+ * `stats`. @experimental
65
+ */
54
66
  export declare function widgetOfInstance(instanceId: string): string;
55
- /** The instance name of a copy (`sanctum` of `messages#sanctum`), or `null` for the widget itself. @experimental */
67
+ /**
68
+ * The instance name of a copy (`sanctum` of `messages#sanctum`), or `null` for
69
+ * the widget itself. An aliased id answers the name it reads as
70
+ * (`world-state` → `world`, {@link resolveWidgetAlias}), so the pair
71
+ * {@link widgetOfInstance} · `instanceNameOf` always names one copy.
72
+ * @experimental
73
+ */
56
74
  export declare function instanceNameOf(instanceId: string): string | null;
57
75
  /** Is this placed id a copy of `widgetId` — the widget itself or one of its instances? @experimental */
58
76
  export declare function isInstanceOf(instanceId: string, widgetId: string): boolean;
@@ -73,7 +91,7 @@ export declare function isWidgetInstanceId(id: unknown): id is string;
73
91
  * field are one thing to arrange, and the field's shape is a setting on
74
92
  * `messages` rather than a widget beside it.
75
93
  *
76
- * `inventory` is one because R79 (2026-09-25) removed core's Inventory widget
94
+ * `inventory` is one because core's Inventory widget was removed (2026-09-25)
77
95
  * for now, with no replacement. Adventure and Lair shipped it, so layouts and
78
96
  * presets saved from them name it; dropping it here is what makes such a
79
97
  * layout open on the widgets it still has — nothing drawn in its place, no
@@ -81,8 +99,80 @@ export declare function isWidgetInstanceId(id: unknown): id is string;
81
99
  * the stats widget draws as a list. Take it off this list if the widget comes
82
100
  * back.
83
101
  * @experimental
102
+ * @ruling R79
84
103
  */
85
104
  export declare const RETIRED_WIDGET_IDS: ReadonlySet<string>;
105
+ /**
106
+ * One widget id that now reads as another widget with some settings implied
107
+ * ({@link WIDGET_ID_ALIASES}).
108
+ * @experimental
109
+ */
110
+ export interface WidgetIdAlias {
111
+ /** The widget it is now (`stats`). */
112
+ id: string;
113
+ /**
114
+ * The instance name it reads as (`world`): `world-state` is `stats#world`,
115
+ * `world-state#2` is `stats#world-2`.
116
+ */
117
+ instanceName: string;
118
+ /**
119
+ * The settings the old widget meant, merged UNDER the instance's own — a
120
+ * preset's and a person's stored values win. A reader takes them as the
121
+ * instance's defaults.
122
+ */
123
+ settings: Readonly<Record<string, unknown>>;
124
+ }
125
+ /**
126
+ * ⏳ Widget ids that are another widget now — an ALIAS, not a retirement: a
127
+ * stored layout, preset or arrangement that places one keeps drawing what it
128
+ * drew, as a copy of the widget it became with the settings it meant
129
+ * ({@link resolveWidgetAlias}). Every id reader goes through it
130
+ * ({@link widgetOfInstance}, {@link resolveDrawn}, {@link validateSessionLayout}),
131
+ * so an aliased id is neither retired nor unknown.
132
+ *
133
+ * `world-state` is one since the Stats uplift: World State was Stats drawn for the world, as a strip — one
134
+ * capability, so one widget, with `owners` and `arrangement` settings. A
135
+ * layout written today places `stats#world` with those settings itself (and
136
+ * `title: 'World State'`, as core's shipped layouts do).
137
+ * REMOVE in 0.7.0, with the `world-state` declaration (rewritten layouts
138
+ * have had a release to land).
139
+ * @experimental
140
+ * @ruling PLAN-core-widgets W7 (2026-10-11)
141
+ */
142
+ export declare const WIDGET_ID_ALIASES: Readonly<Record<string, WidgetIdAlias>>;
143
+ /**
144
+ * A placed id read through {@link WIDGET_ID_ALIASES} — what
145
+ * {@link resolveWidgetAlias} answers.
146
+ * @experimental
147
+ */
148
+ export interface ResolvedWidgetAlias {
149
+ /** The widget it is a copy of (`stats` for `world-state`). */
150
+ widgetId: string;
151
+ /**
152
+ * The instance id it reads as — `stats#world` for `world-state`,
153
+ * `stats#world-2` for `world-state#2` — what a layout written today would
154
+ * place. NOT a storage key: stored settings, style pins and a layout's
155
+ * own lists stay keyed by the id as placed. The id itself when nothing
156
+ * is aliased.
157
+ */
158
+ instanceId: string;
159
+ /** The settings the alias implies, merged under the instance's own; `{}` when none. */
160
+ impliedSettings: Readonly<Record<string, unknown>>;
161
+ /** The aliased widget id (`world-state`), or `null` when the id is not an alias. */
162
+ aliasedFrom: string | null;
163
+ }
164
+ /**
165
+ * Read a placed id through {@link WIDGET_ID_ALIASES}. An id that is no alias
166
+ * answers itself, its widget and no settings.
167
+ *
168
+ * The id it reads as is stable — `world-state` is always `stats#world`,
169
+ * `world-state#n` always `stats#world-n` — and, given the ids already placed
170
+ * (`taken`), collision-safe: one a layout already places is skipped for the
171
+ * next free `-2`, `-3`… So a caller rewriting a layout passes every id it
172
+ * places.
173
+ * @experimental
174
+ */
175
+ export declare function resolveWidgetAlias(instanceId: string, taken?: Iterable<string>): ResolvedWidgetAlias;
86
176
  /**
87
177
  * One width rule of a side zone's ladder. `min` is the session box's inline
88
178
  * size (px) at or above which the rule applies; rules merge ascending, each
@@ -118,7 +208,7 @@ export interface LayoutZoneDef {
118
208
  pinned?: boolean;
119
209
  /** Widget instance ids, in order. */
120
210
  widgets: string[];
121
- /** The width ladder. Absent means the app's default for the side. */
211
+ /** The width ladder. Absent means the default for where it is drawn ({@link DEFAULT_SIDE_RULES}, {@link DEFAULT_STRIP_RULES}). */
122
212
  rules?: LayoutZoneRule[];
123
213
  }
124
214
  /**
@@ -173,7 +263,7 @@ export interface GridWidget {
173
263
  h: GridSizeSpec;
174
264
  };
175
265
  anchor: WidgetAnchor;
176
- /** Stays visible when the drawer is closed. */
266
+ /** Stays visible when the drawer is closed. Absent means pinned ({@link pinnedOf}). */
177
267
  pinned?: boolean;
178
268
  /** Only meaningful when pinned: the card background toggle. */
179
269
  background?: boolean;
@@ -202,7 +292,7 @@ export interface ArrangedItem {
202
292
  anchor?: WidgetAnchor;
203
293
  /** Tab-group membership: items sharing one draw as one tab set (`g:` + the sorted members). */
204
294
  group?: string;
205
- /** Docked in a side column. ABSENT MEANS PINNED; `false` is the only value written. */
295
+ /** Docked in a side column. ABSENT MEANS PINNED ({@link pinnedOf}); `false` is the only value written. */
206
296
  pinned?: boolean;
207
297
  }
208
298
  /** One zone's arrangement: its cell grid and the items on it. @experimental */
@@ -251,19 +341,209 @@ export declare function layoutWidgetIds(layout: SessionLayoutV1): string[];
251
341
  */
252
342
  export declare function middleWidgetIds(layout: SessionLayoutV1): string[];
253
343
  /**
254
- * Every widget instance id the layout DRAWS, in reading order — middle, left,
255
- * right, then any strips — which is the page's own precedence, place by place:
344
+ * What a zone's width ladder resolves to at one inline size: its rules merged
345
+ * ascending, each stating only what changes. For a side zone the zone's pin
346
+ * then refines a `rail`: pinned (absent or `true`) stays a docked rail, and
347
+ * `pinned: false` is an icon strip. A strip is a `row` unless a rule hides it.
348
+ * @experimental
349
+ */
350
+ export interface ZoneRung {
351
+ mode: NonNullable<LayoutZoneRule['mode']>;
352
+ /** The rail's or drawer's inline size, px. */
353
+ width: number;
354
+ /** Rail stack columns (a wide screen turns a rail into a grid). */
355
+ columns: number;
356
+ }
357
+ /**
358
+ * The width ladder a side zone walks when it declares no `rules` of its own:
359
+ * an overlay drawer below the rail rung, a docked rail above it, wider and
360
+ * then two columns on a very wide box. The left docks later than the right,
361
+ * because the right is where a fresh session's widgets land.
362
+ *
363
+ * From 1200 to 1440 — where the left has just docked beside the right — each
364
+ * side's rail is 248px rather than 264, so two docked columns, their gaps and
365
+ * the stage's 696px measure fit a 1216px session box (a 1280 window):
366
+ * 248 + 248 + 2×8 + 696 = 1208. At 264 they needed 1240 and both sides tucked.
367
+ * @experimental
368
+ */
369
+ export declare const DEFAULT_SIDE_RULES: Readonly<Record<'left' | 'right', readonly LayoutZoneRule[]>>;
370
+ /** The width ladder a strip walks when it declares none: always a row. @experimental */
371
+ export declare const DEFAULT_STRIP_RULES: readonly LayoutZoneRule[];
372
+ /**
373
+ * A zone's width ladder at `inline` px — its own `rules`, else the default
374
+ * ladder for where it is drawn ({@link DEFAULT_SIDE_RULES},
375
+ * {@link DEFAULT_STRIP_RULES}) — with the pin refinement {@link ZoneRung}
376
+ * describes. The one walk: the page's rails, the editor's simulator and
377
+ * {@link resolveDrawn} all read a ladder through it.
378
+ * @experimental
379
+ */
380
+ export declare function zoneRungAt(def: LayoutZoneDef, inline: number): ZoneRung;
381
+ /**
382
+ * Is this placement pinned? **Absent means pinned; `false` is the only value
383
+ * that unpins.** The ONE pin rule of the session layout, for every slot that
384
+ * carries the field — an arranged item, a grid entry and a zone — so a layout
385
+ * saved before a slot had the field reads exactly as it drew: docked.
386
+ * Anything that is not `false` (a missing field, `true`, junk) is pinned.
256
387
  *
257
- * - the middle draws its arrangement whenever it has one (an emptied middle
258
- * stays empty), else the grid's middle entries;
259
- * - a side draws its arrangement when that places anything, else the lists
260
- * of the zones on it (by their `side`, never their key) — and, folded into
261
- * them, any grid entry naming that side, but only when the layout has a
262
- * zone on that side to fold it into;
263
- * - a strip draws its list.
388
+ * What a pin means is where it sits: an arranged item's or a grid entry's is
389
+ * that widget's (docked in its side column, or a rail icon that flies out);
390
+ * a zone's is the un-arranged side's (a docked rail, or an icon strip —
391
+ * {@link zoneRungAt}). ⚠ Not the widget envelope's `layout.v1.pinned`, which
392
+ * a host tells a widget about its own box.
393
+ * @experimental
394
+ */
395
+ export declare function pinnedOf(placement: {
396
+ pinned?: unknown;
397
+ } | null | undefined): boolean;
398
+ /**
399
+ * One widget instance a zone draws.
400
+ * @experimental
401
+ */
402
+ export interface DrawnInstance {
403
+ /** The widget instance id (`messages`, `messages#sanctum`). */
404
+ instanceId: string;
405
+ /** The widget it is a copy of ({@link widgetOfInstance}, read through {@link WIDGET_ID_ALIASES}). */
406
+ widgetId: string;
407
+ /**
408
+ * ⏳ When the id is an alias (`world-state`): the settings it implies
409
+ * ({@link resolveWidgetAlias}), which a settings reader merges UNDER the
410
+ * instance's stored ones. `instanceId` stays the id as placed — the key
411
+ * its stored settings and style pin live under.
412
+ */
413
+ impliedSettings?: Readonly<Record<string, unknown>>;
414
+ /**
415
+ * Its cells — 0-based origin and span in whole cells of the zone's
416
+ * arrangement ({@link DrawnZone.arrangement}) — when the zone is drawn from
417
+ * one. As written: a renderer that draws into a measured grid clamps it.
418
+ */
419
+ cells?: {
420
+ x: number;
421
+ y: number;
422
+ w: number;
423
+ h: number;
424
+ };
425
+ /** Pinned, by the one rule ({@link pinnedOf}). Every instance has exactly one. */
426
+ pinned: boolean;
427
+ /** Tab-group membership: instances sharing one draw as one tab set. */
428
+ group?: string;
429
+ /** The edges of its space it sticks to (an arrangement's or the grid's). */
430
+ anchor?: WidgetAnchor;
431
+ /** A grid-drawn instance's size spec. */
432
+ size?: GridWidget['size'];
433
+ /** A grid-drawn instance's span, in cells. */
434
+ colSpan?: number;
435
+ }
436
+ /**
437
+ * One of the three zones as a layout draws it.
438
+ * @experimental
439
+ */
440
+ export interface DrawnZone {
441
+ zone: ZoneId;
442
+ kind: 'side' | 'middle';
443
+ /** A side zone's edge. */
444
+ side?: 'left' | 'right';
445
+ /**
446
+ * Where its instances come from: its `arrangedGrid` frame (`arrangement`),
447
+ * the grid's middle entries (`grid`), or a side's zone lists, presented by
448
+ * the width ladder (`ladder`). {@link resolveDrawn} says which wins.
449
+ */
450
+ drawnFrom: 'arrangement' | 'grid' | 'ladder';
451
+ /** The arrangement's cell grid, when drawn from one. */
452
+ arrangement?: {
453
+ cols: number;
454
+ rows: number;
455
+ };
456
+ /**
457
+ * A side: the key of the first `zoneLayout` zone drawn on it — the one an
458
+ * editor writes to — or null when the layout declares none there.
459
+ */
460
+ zoneKey?: string | null;
461
+ /**
462
+ * A side: the zone's own pin, by the one rule ({@link pinnedOf}); true
463
+ * when the layout declares no zone there. It decides what an un-arranged
464
+ * side draws (its `rung`); an arranged side's instances carry their own.
465
+ * The middle is always pinned.
466
+ */
467
+ pinned: boolean;
468
+ /**
469
+ * A side: its width ladder at the box's inline size ({@link zoneRungAt};
470
+ * the first zone's, else the side's default ladder). An un-arranged side is
471
+ * drawn as its `mode`; an arranged one takes `width × columns` as its
472
+ * footprint and docks per instance.
473
+ */
474
+ rung?: ZoneRung;
475
+ /** What it draws, in reading order. */
476
+ instances: DrawnInstance[];
477
+ }
478
+ /** A strip as a layout draws it: its list, in order. @experimental */
479
+ export interface DrawnStrip {
480
+ /** The `zoneLayout` key of the strip. */
481
+ zoneKey: string;
482
+ area: 'top' | 'bottom';
483
+ rung: ZoneRung;
484
+ instances: DrawnInstance[];
485
+ }
486
+ /**
487
+ * What a session layout DRAWS, and where — {@link resolveDrawn}'s answer.
488
+ * The three slots are its inputs, never a second answer: a renderer, a
489
+ * picture of a preset, the primary floor and a genre's checks all read this.
490
+ * @experimental
491
+ */
492
+ export interface DrawnLayout {
493
+ left: DrawnZone;
494
+ middle: DrawnZone;
495
+ right: DrawnZone;
496
+ /** The strips, in the order `zoneLayout` declares them. */
497
+ strips: DrawnStrip[];
498
+ }
499
+ /**
500
+ * What a session layout draws at a session box of `box.inline` px: per zone,
501
+ * the instances it draws in reading order, each with one `pinned`, plus the
502
+ * facts a renderer draws the zone by. Pure and total — any value reads; what
503
+ * it cannot read places nothing.
504
+ *
505
+ * **The precedence, written once.** Three slots can name one zone; this is
506
+ * the one place that decides which draws.
507
+ *
508
+ * - **The middle draws its arrangement whenever the layout has one** — an
509
+ * empty one included, else the grid's middle entries by `order`. The
510
+ * arrangement is the editor's capture of what a person laid out; an
511
+ * emptied middle is a decision, and the primary floor (the app's) is what
512
+ * puts the conversation back.
513
+ * - **A side draws its arrangement when that places anything, else its zone
514
+ * lists** — every `zoneLayout` zone drawn on that side (by its `side`,
515
+ * never its key) in order, with any grid entry naming the side folded in
516
+ * after the first zone's list, but only when a zone is there to hold it.
517
+ * An arrangement of nothing is the editor's leftover, not a decision: a
518
+ * side that loses its last card goes back to its list.
519
+ * - **When a side has no arrangement, its width ladder decides how it is
520
+ * drawn** ({@link zoneRungAt}): docked as a rail, an icon strip, a drawer
521
+ * or hidden — the zone's pin refining the rail. An arranged side is not
522
+ * asked: each instance's own pin decides whether it docks.
523
+ * - **A strip draws its list.**
524
+ *
525
+ * Read in that order — middle, left, right, strips — an instance is drawn
526
+ * once, where it is first drawn. A copy of a retired widget
527
+ * ({@link RETIRED_WIDGET_IDS}) is never drawn; an aliased id
528
+ * ({@link WIDGET_ID_ALIASES}) is drawn as the widget it became, under the id
529
+ * it was placed by, with the settings it implies. Every `pinned` is
530
+ * {@link pinnedOf}'s: an arranged item's and a grid entry's own, a listed
531
+ * instance's its zone's.
264
532
  *
265
- * So an entry an arrangement shadows is named but not drawn. A retired widget
266
- * id is never drawn.
533
+ * The box's `block` size is not read today: no rung is a height.
534
+ * @experimental
535
+ */
536
+ export declare function resolveDrawn(layout: SessionLayoutV1, box: {
537
+ inline: number;
538
+ block?: number;
539
+ }): DrawnLayout;
540
+ /** Every instance a drawn layout draws, in its reading order: middle, left, right, strips. @experimental */
541
+ export declare function drawnInstances(drawn: DrawnLayout): DrawnInstance[];
542
+ /**
543
+ * Every widget instance id the layout DRAWS, in reading order — middle, left,
544
+ * right, then any strips: {@link resolveDrawn}'s answer as ids, so the
545
+ * precedence is that function's and nowhere else. An entry an arrangement
546
+ * shadows is named but not drawn; a retired widget is never drawn.
267
547
  * @experimental
268
548
  */
269
549
  export declare function drawnWidgetIds(layout: SessionLayoutV1): string[];
@@ -271,7 +551,7 @@ export declare function drawnWidgetIds(layout: SessionLayoutV1): string[];
271
551
  * Does the layout DRAW any instance of `primaryId` — the bare id or a
272
552
  * `#name` copy — anywhere? The **primary floor**'s question: placement is
273
553
  * free, and the one rule left is that a layout draws its genre's primary
274
- * widget somewhere.
554
+ * widget somewhere. Asked of {@link resolveDrawn}, like every "is it drawn".
275
555
  * @experimental
276
556
  */
277
557
  export declare function primaryPlaced(layout: SessionLayoutV1, primaryId: string): boolean;
@@ -333,6 +613,10 @@ export interface SessionLayoutValidationOptions {
333
613
  * `maxInstances` (readers draw the first ones in reading order);
334
614
  * - with `opts.unknownWidgets: 'warn'` too, a widget `opts.widgets` does not
335
615
  * hold (it draws a labelled placeholder).
616
+ *
617
+ * An aliased id (`world-state`, {@link WIDGET_ID_ALIASES}) is checked as the
618
+ * widget it became: neither retired nor unknown, and counted against that
619
+ * widget's `maxInstances`.
336
620
  * @experimental
337
621
  */
338
622
  export declare function validateSessionLayout(layout: unknown, opts?: SessionLayoutValidationOptions): SessionLayoutValidation;