@silverpoint/core 0.3.0 → 0.7.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.
Files changed (47) hide show
  1. package/README.md +18 -0
  2. package/dist/catalog.d.ts +97 -0
  3. package/dist/catalog.js +8004 -0
  4. package/dist/catalog.js.map +1 -0
  5. package/dist/{chunk-I6BAZ7MJ.js → chunk-46QELMCG.js} +41 -236
  6. package/dist/chunk-46QELMCG.js.map +1 -0
  7. package/dist/chunk-5MP3BLZK.js +48 -0
  8. package/dist/chunk-5MP3BLZK.js.map +1 -0
  9. package/dist/chunk-6YFO7OP3.js +84 -0
  10. package/dist/chunk-6YFO7OP3.js.map +1 -0
  11. package/dist/chunk-ANJSW5JX.js +93 -0
  12. package/dist/chunk-ANJSW5JX.js.map +1 -0
  13. package/dist/chunk-E5CC2NNQ.js +172 -0
  14. package/dist/chunk-E5CC2NNQ.js.map +1 -0
  15. package/dist/chunk-G7N4X5XD.js +12 -0
  16. package/dist/chunk-G7N4X5XD.js.map +1 -0
  17. package/dist/chunk-KFBSQH5G.js +34 -0
  18. package/dist/chunk-KFBSQH5G.js.map +1 -0
  19. package/dist/chunk-NI7B6UEO.js +24 -0
  20. package/dist/chunk-NI7B6UEO.js.map +1 -0
  21. package/dist/chunk-WYFRHI4S.js +179 -0
  22. package/dist/chunk-WYFRHI4S.js.map +1 -0
  23. package/dist/contrast-siWF_R5o.d.ts +30 -0
  24. package/dist/dashboard-demos.d.ts +2 -2
  25. package/dist/index.d.ts +16 -60
  26. package/dist/index.js +34 -179
  27. package/dist/index.js.map +1 -1
  28. package/dist/model-DVVt59AB.d.ts +53 -0
  29. package/dist/palettes.d.ts +29 -0
  30. package/dist/palettes.js +79 -0
  31. package/dist/palettes.js.map +1 -0
  32. package/dist/{props-3G1XYd-r.d.ts → props-BZ9CcrGv.d.ts} +394 -2
  33. package/dist/timeline.d.ts +90 -0
  34. package/dist/timeline.js +125 -0
  35. package/dist/timeline.js.map +1 -0
  36. package/dist/{types-CbVMKvyQ.d.ts → types-BT3Xm7fP.d.ts} +3 -1
  37. package/dist/types-D5ys35fF.d.ts +576 -0
  38. package/dist/types-DHBJ0PzV.d.ts +57 -0
  39. package/dist/ui-demos.d.ts +14 -3
  40. package/dist/ui-demos.js +163 -1
  41. package/dist/ui-demos.js.map +1 -1
  42. package/dist/ui.d.ts +346 -325
  43. package/dist/ui.js +933 -118
  44. package/dist/ui.js.map +1 -1
  45. package/dist/view-DteS9glE.d.ts +82 -0
  46. package/package.json +19 -1
  47. package/dist/chunk-I6BAZ7MJ.js.map +0 -1
package/dist/ui.d.ts CHANGED
@@ -1,225 +1,37 @@
1
- import { S as Seed, e as GroundRef, f as SubstrateName, I as InkMode, a5 as ToneLevel, b as Stroke, G as Geometry, a7 as UiTokens, a as Ground, a6 as ToneSpec, P as ProviderConfig } from './props-3G1XYd-r.js';
1
+ import { S as StepStatus, a as StepItem, U as UiOrientation, b as UiItem, c as SpRadioGroupProps, d as SpRateProps, e as SpSegmentedProps, f as SpSliderProps, g as SpTabsProps, h as SpAlertProps, i as SpBadgeProps, j as SpProgressProps, k as SpSkeletonProps, l as SpStepsProps, m as SpTagProps, n as SpAvatarGroupProps, o as SpAvatarProps, p as SpBreadcrumbProps, q as SpCollapseProps, r as SpCollapseItemProps, s as SpDescriptionsProps, t as SpEmptyProps, u as SpGlyphProps, v as SpInputNumberProps, w as SpPaginationProps, x as SpResultProps, y as SpStatisticProps, z as SpSurfaceProps, A as SpTableProps, B as SpTextareaProps, D as SpTimelineListProps, E as SpDrawerProps, F as SpDropdownMenuProps, M as MenuEntry, G as SpModalProps, H as SpPopoverProps, I as SpSelectProps, J as SpToastProps, K as SpToasterProps, L as SpTooltipProps } from './types-D5ys35fF.js';
2
+ export { N as AlertKind, O as BreadcrumbItem, C as CommonUiProps, P as DescriptionItem, Q as SpButtonProps, R as SpCardProps, T as SpCheckboxProps, V as SpDividerProps, W as SpInputProps, X as SpSwitchProps, Y as TableColumn, Z as TimelineListItem, _ as UI_FRAME_KINDS, $ as UiFrameKind, a0 as UiSize, a1 as UiToneLevel, a2 as UiVariant, a3 as uiFrameOutline, a4 as uiFrameVariant } from './types-D5ys35fF.js';
3
+ import { o as Stroke, aB as UiTokens, am as Ground, aA as ToneSpec, x as Datum } from './props-BZ9CcrGv.js';
4
+ import { U as UiResolved, a as UiElement } from './view-DteS9glE.js';
5
+ export { b as UiAttrValue, c as UiBind, d as UiEnvironment, e as UiNode, f as UiSlot, r as resolveUi, u as uiButtonView, g as uiCardView, h as uiCheckboxView, i as uiDividerView, j as uiInputView, k as uiSwitchView } from './view-DteS9glE.js';
2
6
 
3
- /** Control size; heights come from the ground's `ui.controlHeight` (Data Model §3.8). */
4
- type UiSize = 'sm' | 'md' | 'lg';
5
- /** Props every UI component takes, as `CommonChartProps` does for charts (API Spec §3). */
6
- interface CommonUiProps {
7
- /** The frame variant and every related id derive from it (REQ-307, REQ-329). */
8
- id?: string;
9
- /** Overrides `id` for the frame variant only. */
10
- seed?: Seed;
11
- /** Style ground. Defaults to the dashboard's, then the app provider's, or `silverpoint` (REQ-311). */
12
- ground?: GroundRef;
13
- /** Prepared substrate within the ground (REQ-046). */
14
- substrate?: SubstrateName;
15
- /** `ink` by default; `precision` disables inking (REQ-021, REQ-306). */
16
- mode?: InkMode;
17
- /** Default `'md'`. */
18
- size?: UiSize;
19
- /** Added to the component's root element, after its own classes. */
20
- className?: string;
21
- }
22
- /** An item of Tabs, Segmented or RadioGroup; keys are unique (REQ-325). */
23
- interface UiItem {
24
- key: string;
25
- label: string;
26
- disabled?: boolean;
27
- }
28
- type StepStatus = 'wait' | 'process' | 'finish' | 'error';
29
- interface StepItem {
30
- key: string;
31
- title: string;
32
- description?: string;
33
- /** Derived from `current` when omitted; `'error'` must be explicit. */
34
- status?: StepStatus;
35
- }
36
- /** Button emphasis. Not a tone: `tone` names only a level 1-4 of the ground's ramp (A-07). */
37
- type UiVariant = 'default' | 'primary' | 'danger';
38
- type AlertKind = 'info' | 'success' | 'warning' | 'error';
39
- type UiOrientation = 'horizontal' | 'vertical';
40
- /** A tonal level a component may ask for; 0 (no fill) is not one. */
41
- type UiToneLevel = Exclude<ToneLevel, 0>;
42
- interface SpButtonProps extends CommonUiProps {
43
- /** Default `'default'`; `danger` also draws the exact ✕ glyph (REQ-310). */
44
- variant?: UiVariant;
45
- /** Default `'button'`. */
46
- type?: 'button' | 'submit' | 'reset';
47
- /** Not focusable, not submitted; drawn with the disabled tone. */
48
- disabled?: boolean;
49
- /** Accessible name of an icon-only button (REQ-319). */
50
- label?: string;
51
- /** Fills the width of its container. */
52
- block?: boolean;
53
- /** Renders an `<a>`. */
54
- href?: string;
55
- }
56
- interface SpInputProps extends CommonUiProps {
57
- /** Native input type. Default `'text'`. */
58
- type?: 'text' | 'search' | 'email' | 'url' | 'tel' | 'password' | 'number';
59
- /** Hint shown while empty; not a substitute for the accessible name. */
60
- placeholder?: string;
61
- /** Form field name; the native input submits under it (REQ-323). */
62
- name?: string;
63
- /** Not focusable and not submitted. */
64
- disabled?: boolean;
65
- /** Focusable and submitted, but not editable. */
66
- readOnly?: boolean;
67
- /** Sets `aria-invalid` and draws the exact ⚠ glyph (REQ-334). */
68
- invalid?: boolean;
69
- /** Help or error text under the control, referenced by `aria-describedby` (REQ-334). */
70
- message?: string;
71
- /** Accessible name, when no `<label for>` names the control. */
72
- label?: string;
73
- }
74
- interface SpCheckboxProps extends CommonUiProps {
75
- /** The visible text and accessible name. */
76
- label: string;
77
- /** Form field name; submitted as `on` when checked. */
78
- name?: string;
79
- /** Not focusable and not submitted. */
80
- disabled?: boolean;
81
- /** Draws the exact dash and sets the native `indeterminate` state. */
82
- indeterminate?: boolean;
83
- }
84
- interface SpRadioGroupProps extends CommonUiProps {
85
- /** The choices; each a native radio. Keys are unique (REQ-325). */
86
- items: readonly UiItem[];
87
- /** Required: the native radios submit under it (REQ-323). */
88
- name: string;
89
- /** The group's name, its `<legend>`. */
90
- label: string;
91
- /** Default `'vertical'`. */
92
- orientation?: UiOrientation;
93
- }
94
- interface SpSwitchProps extends CommonUiProps {
95
- /** The visible text and accessible name. */
96
- label: string;
97
- /** Form field name; submitted as `on` when on. */
98
- name?: string;
99
- /** Not focusable and not submitted. */
100
- disabled?: boolean;
101
- }
102
- interface SpSliderProps extends CommonUiProps {
103
- /** Accessible name of the native range input. */
104
- label: string;
105
- /** Default `0`. */
106
- min?: number;
107
- /** Default `100`. */
108
- max?: number;
109
- /** Default `1`. */
110
- step?: number;
111
- /** Form field name; the native input submits under it. */
112
- name?: string;
113
- /** Not focusable and not submitted. */
114
- disabled?: boolean;
115
- /** Values on the rail that get a labelled mark. */
116
- marks?: readonly number[];
117
- }
118
- interface SpRateProps extends CommonUiProps {
119
- /** The group's name, its `<legend>`. */
120
- label: string;
121
- /** Default `5`, in 1..10; each mark an exact lozenge. */
122
- count?: number;
123
- /** Form field name; the native radios submit under it. */
124
- name?: string;
125
- /** Not focusable and not submitted. */
126
- disabled?: boolean;
127
- /** Shows the value; the keyboard and the pointer do not change it. */
128
- readOnly?: boolean;
129
- }
130
- interface SpSegmentedProps extends CommonUiProps {
131
- /** The options; each a native radio. Keys are unique (REQ-325). */
132
- items: readonly UiItem[];
133
- /** The control's name, its `<legend>`. */
134
- label: string;
135
- /** Form field name; the native radios submit under it. */
136
- name?: string;
137
- /** Fills the width of its container. */
138
- block?: boolean;
139
- }
140
- interface SpTabsProps extends CommonUiProps {
141
- /** The tabs; a disabled one is skipped by the arrows. Keys are unique (REQ-325). */
142
- items: readonly UiItem[];
143
- /** Accessible name of the tab list. */
144
- label?: string;
145
- /** Default `'horizontal'`. */
146
- orientation?: UiOrientation;
147
- /** Default `'automatic'`: a tab is selected as focus reaches it. */
148
- activation?: 'automatic' | 'manual';
149
- }
150
- interface SpStepsProps extends CommonUiProps {
151
- /** The steps, in order; a status is derived from `current` unless set. */
152
- items: readonly StepItem[];
153
- /** 0-based. */
154
- current: number;
155
- /** Default `'horizontal'`. */
156
- orientation?: UiOrientation;
157
- /** Accessible name of the list. */
158
- label?: string;
159
- }
160
- interface SpCardProps extends CommonUiProps {
161
- /** Heading of the card; without it the card is a plain container. */
162
- title?: string;
163
- /** Default `3`. */
164
- headingLevel?: 2 | 3 | 4 | 5 | 6;
165
- }
166
- interface SpTagProps extends CommonUiProps {
167
- /** Tonal level, default `1`. */
168
- tone?: UiToneLevel;
169
- /** Adds a native close button; each adapter raises its close event. */
170
- closable?: boolean;
171
- /** Accessible name of the close button. Default `Remove <text>`. */
172
- closeLabel?: string;
173
- }
174
- interface SpBadgeProps extends CommonUiProps {
175
- /** The number shown, up to `max`. */
176
- count?: number;
177
- /** Default `99`; above it the badge reads `99+`. */
178
- max?: number;
179
- /** A dot with no number. */
180
- dot?: boolean;
181
- /** Accessible text of the badge, e.g. `unread messages`. */
182
- label?: string;
183
- }
184
- interface SpDividerProps extends CommonUiProps {
185
- /** Default `'horizontal'`. */
186
- orientation?: UiOrientation;
187
- /** A caption set in the rule. */
188
- text?: string;
189
- /** Default `'center'`. */
190
- align?: 'start' | 'center' | 'end';
191
- }
192
- interface SpProgressProps extends CommonUiProps {
193
- /** 0..100; omitted, the progress is indeterminate. */
194
- value?: number;
195
- /** Default `'line'`. */
196
- shape?: 'line' | 'circle';
197
- /** Accessible name (REQ-318). */
198
- label: string;
199
- /** Default `true`. */
200
- showValue?: boolean;
201
- }
202
- interface SpAlertProps extends CommonUiProps {
203
- /** Default `'info'`. */
204
- kind?: AlertKind;
205
- /** Bold first line of the alert. */
206
- title?: string;
207
- /** Adds a native close button; each adapter raises its close event. */
208
- closable?: boolean;
209
- /** Accessible name of the close button. Default `'Close'`. */
210
- closeLabel?: string;
211
- }
212
- interface SpSkeletonProps extends CommonUiProps {
213
- /** Default `3`, in 1..8. */
214
- lines?: number;
215
- /** Draws an avatar placeholder before the lines. */
216
- avatar?: boolean;
217
- /** Default `'Loading'`. */
218
- label?: string;
219
- }
7
+ /** Exact glyphs in a 16 × 16 box: their strokes are values, never inked (REQ-304, REQ-310). */
8
+ declare const UI_GLYPHS: Readonly<{
9
+ tick: "M3.5,8.5L6.5,11.5L12.5,4.5";
10
+ dash: "M4,8H12";
11
+ cross: "M4.5,4.5L11.5,11.5M11.5,4.5L4.5,11.5";
12
+ warning: "M8,2.5L14.5,13.5H1.5Z M8,6.5V9.5 M8,11.5V11.5";
13
+ /** A radio's selection: filled by ui.css. */
14
+ dot: "M11,8A3,3 0 1,1 5,8A3,3 0 1,1 11,8Z";
15
+ /** A Rate mark (C-2). */
16
+ lozenge: "M8,1.5L14.5,8L8,14.5L1.5,8Z";
17
+ info: "M14.5,8A6.5,6.5 0 1,1 1.5,8A6.5,6.5 0 1,1 14.5,8Z M8,7.5V11.5 M8,4.75V4.75";
18
+ plus: "M8,3.5V12.5M3.5,8H12.5";
19
+ chevronDown: "M4,6L8,10L12,6";
20
+ chevronRight: "M6,4L10,8L6,12";
21
+ chevronLeft: "M10,4L6,8L10,12";
22
+ arrowUp: "M8,12.5V3.5M4.5,7L8,3.5L11.5,7";
23
+ arrowDown: "M8,3.5V12.5M4.5,9L8,12.5L11.5,9";
24
+ sortUp: "M5,9.5L8,5.5L11,9.5Z";
25
+ sortDown: "M5,6.5L8,10.5L11,6.5Z";
26
+ sort: "M5,7L8,3.5L11,7Z M5,9L8,12.5L11,9Z";
27
+ ellipsis: "M3.5,8V8 M8,8V8 M12.5,8V8";
28
+ }>;
29
+ type UiGlyph = keyof typeof UI_GLYPHS;
220
30
 
221
31
  /** The catalog's groups (PRD §6.11), in the order the documentation lists them. */
222
- type UiGroup = 'actions' | 'data-entry' | 'navigation' | 'data-display' | 'feedback';
32
+ type UiGroup = 'actions' | 'data-entry' | 'navigation' | 'data-display' | 'feedback' | 'building-blocks' | 'disclosure' | 'overlays';
33
+ /** `ui`: the 17 of `0.3.0`; `composed` and `overlay`: feature-004's (API delta §2). */
34
+ type UiFamily = 'ui' | 'composed' | 'overlay';
223
35
  /** One UI component: every gate, fixture set and example page iterates this list. */
224
36
  interface UiComponentRow {
225
37
  /** Catalog name, as the PRD writes it. */
@@ -229,12 +41,17 @@ interface UiComponentRow {
229
41
  /** The exported name, the same in the three adapters (OQ-U2). */
230
42
  readonly component: string;
231
43
  readonly group: UiGroup;
232
- /** The batch of step 6c that implements it (plan-and-tasks.md). */
233
- readonly batch: 'B1' | 'B2' | 'B3';
44
+ readonly family: UiFamily;
45
+ /** The batch that implements it: step 6c (`B*`) or step 8d (`A1`, `A2`, `B`) (plan-and-tasks.md). */
46
+ readonly batch: 'B1' | 'B2' | 'B3' | 'A1' | 'A2' | 'B';
234
47
  /** Declared states (Data Model §5); one fixture and one demo each. */
235
48
  readonly states: readonly string[];
236
49
  }
237
- /** The 17 components of `0.3.0` and their 45 declared states (REQ-300, Data Model §5). */
50
+ /**
51
+ * The 17 components of `0.3.0` and their 45 declared states (REQ-300), then the 21 of feature-004
52
+ * and their 35 (REQ-470, Data Model delta §5). `SpTimeline` is not a row: it lives on its own
53
+ * subpath, with one fixture of its own.
54
+ */
238
55
  declare const UI_COMPONENTS: readonly UiComponentRow[];
239
56
 
240
57
  /** A linear value's domain. Without `step` the value is only clamped (Progress). */
@@ -332,30 +149,6 @@ declare function uiRovingKey(state: UiRovingState, key: UiRovingKey, orientation
332
149
  /** Whether a `KeyboardEvent.key` moves a roving focus: the arrows, Home and End (REQ-315). */
333
150
  declare const uiIsRovingKey: (key: string) => key is UiRovingKey;
334
151
 
335
- type UiFrameKind = 'control' | 'pill' | 'box' | 'card' | 'round';
336
- /**
337
- * Each frame kind is drawn once in a square box and cut into slices for the grounds build
338
- * (DD-022): four corners of `slice` px, and four edges between them when `size > 2 * slice`.
339
- * `round` and `box` have no edges; they frame fixed-size squares.
340
- */
341
- declare const UI_FRAME_KINDS: Readonly<Record<UiFrameKind, Readonly<{
342
- size: number;
343
- slice: number;
344
- radius: number;
345
- }>>>;
346
- /**
347
- * The frame variant of a component: from `seed`, else `id`, by the charts' seed rule; `0` with
348
- * neither (REQ-307, I-21). Never from mount order, randomness or time (Art. 4). `variants` is read
349
- * as an integer in 1..6.
350
- */
351
- declare function uiFrameVariant(seed: Seed | undefined, id: string | undefined, variants: number): number;
352
- /**
353
- * The exact outline of a frame kind: the input the grounds build inks, once per variant, into the
354
- * pieces of `ui.css` (DD-022). It is an `ornament` stroke —a frame carries no value (Art. 1, as
355
- * amended)— so the ground's inker may draw it by hand, with its vertices preserved. Build time only.
356
- */
357
- declare function uiFrameOutline(kind: UiFrameKind): Geometry;
358
-
359
152
  /**
360
153
  * Keeps the first item of each key and skips later ones, and any item without a key, warning
361
154
  * `SP019` without throwing (REQ-325). Returns the input itself when every key is unique.
@@ -378,12 +171,17 @@ declare function uiRequireName(component: string, text: string | undefined, labe
378
171
 
379
172
  /** The `ui` tokens of a ground that declares none (Data Model §3.8). */
380
173
  declare const UI_TOKEN_DEFAULTS: UiTokens;
174
+ type Level = 1 | 2 | 3 | 4;
381
175
  /**
382
176
  * A ground's `ui` tokens, or the defaults, held to their domain: heights ≥ 24 px, focus ≥ 2 px,
383
- * 1..6 variants. A `weight` ground has no inker that draws by hand, so its frame is always the
177
+ * 1..6 variants, backdrop and row tone a level 1..4 (2 and 1 when a section written before
178
+ * feature-004 has none). A `weight` ground has no inker that draws by hand, so its frame is always the
384
179
  * exact `css` one with a single variant (DD-022). Pure.
385
180
  */
386
- declare function resolveUiTokens(ground: Ground): UiTokens;
181
+ declare function resolveUiTokens(ground: Ground): UiTokens & {
182
+ readonly backdrop: Level;
183
+ readonly rowTone: Level;
184
+ };
387
185
 
388
186
  /** One repeating layer of a control's tone: a tile the grounds build inks and lays as a CSS mask. */
389
187
  interface UiToneLayer {
@@ -399,92 +197,207 @@ interface UiToneLayer {
399
197
  */
400
198
  declare function uiToneTile(spec: ToneSpec): readonly UiToneLayer[];
401
199
 
402
- /** Exact glyphs in a 16 × 16 box: their strokes are values, never inked (REQ-304, REQ-310). */
403
- declare const UI_GLYPHS: Readonly<{
404
- tick: "M3.5,8.5L6.5,11.5L12.5,4.5";
405
- dash: "M4,8H12";
406
- cross: "M4.5,4.5L11.5,11.5M11.5,4.5L4.5,11.5";
407
- warning: "M8,2.5L14.5,13.5H1.5Z M8,6.5V9.5 M8,11.5V11.5";
408
- /** A radio's selection: filled by ui.css. */
409
- dot: "M11,8A3,3 0 1,1 5,8A3,3 0 1,1 11,8Z";
410
- /** A Rate mark (C-2). */
411
- lozenge: "M8,1.5L14.5,8L8,14.5L1.5,8Z";
412
- info: "M14.5,8A6.5,6.5 0 1,1 1.5,8A6.5,6.5 0 1,1 14.5,8Z M8,7.5V11.5 M8,4.75V4.75";
413
- }>;
414
- type UiGlyph = keyof typeof UI_GLYPHS;
200
+ /**
201
+ * A table's rows in order of `key` (REQ-474, I-34): stable, `null` and missing values last in input
202
+ * order, `desc` reversing the present rows only. No locale, so the order is the same on every
203
+ * server. Pure: the input is never mutated.
204
+ */
205
+ declare function uiSortRows<T extends Datum>(rows: readonly T[], key: string | undefined, order?: 'asc' | 'desc'): readonly T[];
415
206
 
207
+ /** A page number, or a gap where pages are left out. */
208
+ type UiPageEntry = number | 'start-gap' | 'end-gap';
209
+ interface UiPagination {
210
+ /** Number of pages, at least 1. */
211
+ readonly count: number;
212
+ /** The current page as drawn, 1-based. */
213
+ readonly current: number;
214
+ /** First and last item shown, 1-based; 0 and 0 when there are none. */
215
+ readonly start: number;
216
+ readonly end: number;
217
+ /** An input was not drawable as given. */
218
+ readonly corrected: boolean;
219
+ }
416
220
  /**
417
- * The markup contract of the UI components (API delta §4), as data: every adapter writes this tree
418
- * and nothing else, and the parity gate compares each adapter's server render with it (REQ-327).
419
- * An adapter binds behaviour —value, events, forms— to the elements marked `bind`, and puts the
420
- * consumer's content where a `slot` stands. It computes nothing (Art. 2).
221
+ * The pages a pagination shows (REQ-476, Data Model §2.27): the first, a gap, a window of
222
+ * `siblings` on each side of `current`, a gap, the last.
421
223
  */
422
- type UiAttrValue = string | true;
423
- interface UiElement {
424
- readonly tag: string;
425
- /** HTML attribute names; `true` is a boolean attribute. */
426
- readonly attrs: Readonly<Record<string, UiAttrValue>>;
427
- readonly children: readonly UiNode[];
428
- /** What an adapter binds to the element: see `UiBind`. */
429
- readonly bind?: UiBind;
224
+ declare function uiPageWindow(count: number, current: number, siblings: number): readonly UiPageEntry[];
225
+ /** Pages, the corrected current page and the `start–end of total` numbers; corrections warn `SP017` (REQ-486). */
226
+ declare function uiPagination(total: number, pageSize: number, current: number, component?: string): UiPagination;
227
+
228
+ /** The bounds, step and decimals of a number field; any of them may be absent. */
229
+ interface UiNumberRange {
230
+ readonly min?: number;
231
+ readonly max?: number;
232
+ readonly step?: number;
233
+ /** Decimals the value is rounded to. */
234
+ readonly precision?: number;
235
+ }
236
+ interface UiNumberValue {
237
+ /** The value to render; `null` for an empty field. */
238
+ readonly value: number | null;
239
+ readonly corrected: boolean;
240
+ /** The value sits on a bound: that stepper is disabled (REQ-485). */
241
+ readonly atMin: boolean;
242
+ readonly atMax: boolean;
243
+ /** The range as drawn: invalid bounds, step or precision left out. */
244
+ readonly range: UiNumberRange;
245
+ }
246
+ /** A number field's value clamped to `min`/`max` and rounded to `precision`; `null` stays `null` (REQ-485, REQ-486). */
247
+ declare function uiNumberValue(value: number | null, range: UiNumberRange, component?: string): UiNumberValue;
248
+ /** One stepper press: `value ± step` from the value, else from `min ?? 0`, then clamped and rounded (REQ-485). */
249
+ declare function uiNumberStep(value: number | null, direction: 1 | -1, range: UiNumberRange, component?: string): number;
250
+
251
+ /** An avatar's initials (REQ-478): the first letters of the first two words, upper-cased; '?' for none. */
252
+ declare function uiInitials(name: string | undefined): string;
253
+
254
+ /** The state an open or closed list overlay keeps: its active (highlighted) item and which are disabled. */
255
+ interface UiListState {
256
+ /** The active item; `-1` when none is. */
257
+ readonly active: number;
258
+ readonly count: number;
259
+ readonly disabled: readonly boolean[];
260
+ readonly open: boolean;
261
+ }
262
+ /** The next active item, and what the adapter does: open the list, close it, or select the active item and close. */
263
+ interface UiListResult {
264
+ readonly active: number;
265
+ readonly intent?: 'open' | 'close' | 'select';
430
266
  }
431
267
  /**
432
- * `native`: a control an adapter binds value, events and forms to —one, or one per item of a
433
- * composite, told apart by its `value` or `data-key`. `close`: the button that emits `close`.
268
+ * The WAI-ARIA APG transitions of a select-only combobox (`listbox`, REQ-494) and a menu button
269
+ * (`menu`, REQ-495), as a pure function of state and key (DD-039). Disabled items are skipped and
270
+ * never selected (REQ-326); a move with no enabled item to go to keeps the active one.
434
271
  */
435
- type UiBind = 'native' | 'close';
436
- type UiSlot = 'content' | 'prefix' | 'suffix' | 'extra' | 'footer';
437
- type UiNode = UiElement | {
438
- readonly text: string;
439
- } | {
440
- readonly slot: UiSlot;
441
- };
442
- /** What a component inherits around it: the provider, the dashboard cell, the environment. */
443
- interface UiEnvironment {
444
- readonly provider?: ProviderConfig;
445
- /** The configuration of the dashboard whose cell holds the component (REQ-311). */
446
- readonly cell?: ProviderConfig;
447
- /** `prefers-contrast: more` or `forced-colors: active` holds (REQ-123). */
448
- readonly forcedPrecision?: boolean;
272
+ declare function uiListKey(state: UiListState, key: string, kind: 'listbox' | 'menu'): UiListResult;
273
+ /**
274
+ * Typeahead (REQ-494): the first enabled label that starts with `buffer`, searching from the item
275
+ * after `from` for one character (so repeating it cycles) and from `from` itself for several (so
276
+ * typing on stays put), wrapping; case-insensitive; `-1` when none matches. Pure.
277
+ */
278
+ declare function uiTypeahead(labels: readonly string[], disabled: readonly boolean[], buffer: string, from: number): number;
279
+
280
+ /** A box in viewport coordinates (`getBoundingClientRect`). */
281
+ interface UiBox {
282
+ readonly x: number;
283
+ readonly y: number;
284
+ readonly width: number;
285
+ readonly height: number;
449
286
  }
450
- interface UiResolved {
451
- readonly ground: string;
452
- readonly substrate: SubstrateName;
453
- readonly mode: InkMode;
454
- readonly size: UiSize;
455
- /** 0..5: `ui.css` folds it onto the variants the ground draws. */
456
- readonly frame: number;
287
+ /** Logical sides: `start` and `end` are left and right in `ltr`, mirrored in `rtl` (REQ-523). */
288
+ type UiSide = 'top' | 'end' | 'bottom' | 'start';
289
+ type UiAlign = 'start' | 'center' | 'end';
290
+ interface UiPlaceInput {
291
+ readonly anchor: UiBox;
292
+ readonly floating: {
293
+ readonly width: number;
294
+ readonly height: number;
295
+ };
296
+ readonly viewport: {
297
+ readonly width: number;
298
+ readonly height: number;
299
+ };
300
+ readonly side: UiSide;
301
+ readonly align: UiAlign;
302
+ /** Gap between the anchor and the overlay, px. */
303
+ readonly offset: number;
304
+ /** The overlay keeps this far from the viewport's edges, px. */
305
+ readonly padding: number;
306
+ readonly dir: 'ltr' | 'rtl';
307
+ }
308
+ interface UiPlacement {
309
+ /** The overlay's top-left corner, viewport px, 2 decimals. */
310
+ readonly x: number;
311
+ readonly y: number;
312
+ /** The side it ended on, after any flip. */
313
+ readonly side: UiSide;
314
+ readonly align: UiAlign;
457
315
  }
458
316
  /**
459
- * Ground, substrate and mode with the charts' precedence: prop, then dashboard, then provider,
460
- * then the library default; a forced `precision` applies after, and nothing overrides it (REQ-311).
317
+ * Where an anchored overlay goes (REQ-493, I-35): on the preferred side of its anchor, flipped to the
318
+ * opposite side when it does not fit there and fits there, aligned along the side, then shifted to
319
+ * stay in the viewport. Pure.
461
320
  */
462
- declare function resolveUi(props: CommonUiProps, env: UiEnvironment): UiResolved;
463
- /** `SpButton`: a native `<button>`, or `<a>` with `href` (REQ-314, REQ-310). */
464
- declare function uiButtonView(props: SpButtonProps, r: UiResolved, content: {
465
- readonly text?: string;
466
- }): UiElement;
467
- /** `SpInput`: a native `<input>` in a framed box, its message after it (REQ-314, REQ-334). */
468
- declare function uiInputView(props: SpInputProps, r: UiResolved, state: {
469
- readonly value: string;
470
- readonly prefix?: boolean;
471
- readonly suffix?: boolean;
472
- }): UiElement;
473
- /** `SpCheckbox`: native state; the tick and dash are drawn and shown by it (REQ-310). */
474
- declare function uiCheckboxView(props: SpCheckboxProps, r: UiResolved, state: {
475
- readonly checked: boolean;
476
- }): UiElement;
477
- /** `SpSwitch`: a native checkbox with `role="switch"`, a pill track and an exact knob (REQ-314). */
478
- declare function uiSwitchView(props: SpSwitchProps, r: UiResolved, state: {
479
- readonly checked: boolean;
480
- }): UiElement;
481
- /** `SpCard`: an `<article>` named by its heading, or a `<section>` without a title (REQ-318). */
482
- declare function uiCardView(props: SpCardProps, r: UiResolved, slots: {
483
- readonly extra?: boolean;
484
- readonly footer?: boolean;
485
- }): UiElement;
486
- /** `SpDivider`: a `separator`; with text, the text between two rules (REQ-318). */
487
- declare function uiDividerView(props: SpDividerProps, r: UiResolved): UiElement;
321
+ declare function uiPlace(input: UiPlaceInput): UiPlacement;
322
+
323
+ /** A measured rectangle, in viewport pixels. */
324
+ interface UiRect {
325
+ readonly x: number;
326
+ readonly y: number;
327
+ readonly width: number;
328
+ readonly height: number;
329
+ }
330
+ /** The window an overlay is placed in, as much of it as this reads; the core has no DOM types. */
331
+ interface UiAnchorView {
332
+ readonly innerWidth: number;
333
+ readonly innerHeight: number;
334
+ addEventListener(type: string, listener: () => void, options?: boolean | {
335
+ readonly capture?: boolean;
336
+ readonly passive?: boolean;
337
+ }): void;
338
+ removeEventListener(type: string, listener: () => void, options?: boolean | {
339
+ readonly capture?: boolean;
340
+ }): void;
341
+ /** Absent in an engine without it: the overlay is then placed on scroll and resize only. */
342
+ readonly ResizeObserver?: new (callback: () => void) => {
343
+ observe(target: never): void;
344
+ disconnect(): void;
345
+ };
346
+ }
347
+ /** The trigger an overlay hangs from. */
348
+ interface UiAnchorTarget {
349
+ getBoundingClientRect(): UiRect;
350
+ closest(selector: string): {
351
+ getAttribute(name: string): string | null;
352
+ } | null;
353
+ }
354
+ /** The overlay: measured, then given `--sp-ui-x`, `--sp-ui-y` and `data-side`. */
355
+ interface UiAnchorFloating {
356
+ getBoundingClientRect(): UiRect;
357
+ setAttribute(name: string, value: string): void;
358
+ readonly style: {
359
+ setProperty(name: string, value: string): void;
360
+ };
361
+ readonly ownerDocument: {
362
+ readonly defaultView: UiAnchorView | null;
363
+ } | null;
364
+ }
365
+ interface UiAnchorOptions {
366
+ readonly side: UiSide;
367
+ readonly align: UiAlign;
368
+ /** Gap between the trigger and the overlay, px (`6`). */
369
+ readonly offset?: number;
370
+ /** Least distance to the viewport's edges, px (`8`). */
371
+ readonly padding?: number;
372
+ }
373
+ /**
374
+ * The DOM side of an anchored overlay, as `uiRovingFocus` is for REQ-315 (REQ-493): measures the
375
+ * trigger and the overlay, places it with `uiPlace` in the nearest `dir`, and writes `--sp-ui-x`,
376
+ * `--sp-ui-y` and `data-side`; again on every scroll and resize, and whenever the trigger or the
377
+ * overlay changes size (a web font replacing its fallback), until the returned cleanup runs.
378
+ * Client only, on open.
379
+ */
380
+ declare function uiAnchor(anchor: UiAnchorTarget, floating: UiAnchorFloating, options: UiAnchorOptions): () => void;
381
+
382
+ /** How an overlay opens: `showModal()`, `show()`, or the Popover API (DD-038). */
383
+ type UiOverlayKind = 'modal' | 'dialog' | 'popover';
384
+ /** A `<dialog>` or a `[popover]` element, as much of it as this reads; the core has no DOM types. */
385
+ interface UiOverlayElement {
386
+ readonly open?: boolean;
387
+ showModal?(): void;
388
+ show?(): void;
389
+ close?(): void;
390
+ showPopover?(): void;
391
+ hidePopover?(): void;
392
+ matches(selector: string): boolean;
393
+ }
394
+ /**
395
+ * Opens or closes a native overlay as its state says (REQ-491, REQ-492): `showModal()` or `show()`
396
+ * and `close()` for a `<dialog>`, `showPopover()` and `hidePopover()` for a popover, each only when
397
+ * the element is in the other state, so no second `close` or `toggle` event is fired. Without the
398
+ * Popover API the popover stays in the page's flow. Client only, after mount (REQ-502).
399
+ */
400
+ declare function uiOverlaySync(element: UiOverlayElement, kind: UiOverlayKind, open: boolean): void;
488
401
 
489
402
  /** `SpRadioGroup`: a `<fieldset>` of native radios; the value `null` checks none (REQ-314, REQ-322). */
490
403
  declare function uiRadioGroupView(props: SpRadioGroupProps, r: UiResolved, state: {
@@ -542,4 +455,112 @@ declare function uiAlertView(props: SpAlertProps, r: UiResolved, state: {
542
455
  /** `SpSkeleton`: `aria-busy`, a label for assistive technology, and hidden toned shapes (REQ-318). */
543
456
  declare function uiSkeletonView(props: SpSkeletonProps, r: UiResolved): UiElement;
544
457
 
545
- export { type AlertKind, type CommonUiProps, type SpAlertProps, type SpBadgeProps, type SpButtonProps, type SpCardProps, type SpCheckboxProps, type SpDividerProps, type SpInputProps, type SpProgressProps, type SpRadioGroupProps, type SpRateProps, type SpSegmentedProps, type SpSkeletonProps, type SpSliderProps, type SpStepsProps, type SpSwitchProps, type SpTabsProps, type SpTagProps, type StepItem, type StepStatus, UI_COMPONENTS, UI_FRAME_KINDS, UI_GLYPHS, UI_PROGRESS_VIEWBOX, UI_TOKEN_DEFAULTS, type UiAttrValue, type UiBind, type UiComponentRow, type UiElement, type UiEnvironment, type UiFrameKind, type UiGlyph, type UiGroup, type UiItem, type UiNode, type UiOrientation, type UiRange, type UiResolved, type UiRovingKey, type UiRovingRoot, type UiRovingState, type UiSize, type UiSlot, type UiStep, type UiToneLayer, type UiToneLevel, type UiValue, type UiVariant, resolveUi, resolveUiTokens, uiAlertView, uiBadgeView, uiButtonView, uiCardView, uiCheckboxView, uiDividerView, uiFrameOutline, uiFrameVariant, uiInputView, uiIsRovingKey, uiItems, uiProgressArc, uiProgressView, uiRadioGroupView, uiRange, uiRateCount, uiRateView, uiRequireName, uiRovingFocus, uiRovingKey, uiSegmentedView, uiSelectedKey, uiSkeletonView, uiSliderView, uiSteps, uiStepsView, uiSwitchView, uiTabPanelView, uiTabsView, uiTagView, uiToneTile, uiValue };
458
+ /** `SpSurface`: the root contract on any element, with an optional frame and tone (REQ-472). */
459
+ declare function uiSurfaceView(props: SpSurfaceProps, r: UiResolved): UiElement;
460
+ /** `SpGlyph`: one exact mark of `UI_GLYPHS` (REQ-472). */
461
+ declare function uiGlyphView(props: SpGlyphProps, r: UiResolved): UiElement;
462
+ /** `SpTable`: a native table in a framed scroller; sortable headers are buttons that report the key (REQ-473, REQ-474). */
463
+ declare function uiTableView(props: SpTableProps, r: UiResolved): UiElement;
464
+ /** `SpPagination`: a labelled nav; pages are buttons, the current one a heightened span (REQ-476). */
465
+ declare function uiPaginationView(props: SpPaginationProps, r: UiResolved, state: {
466
+ readonly current: number;
467
+ }): UiElement;
468
+ /** `SpBreadcrumb`: a labelled nav of an ordered list; the last item is the current page (REQ-477). */
469
+ declare function uiBreadcrumbView(props: SpBreadcrumbProps, r: UiResolved): UiElement;
470
+ /** `SpAvatar`: an image, or initials named as an image; a round or box frame (REQ-478). */
471
+ declare function uiAvatarView(props: SpAvatarProps, r: UiResolved): UiElement;
472
+ /** `SpAvatarGroup`: a labelled group of avatars (REQ-478). */
473
+ declare function uiAvatarGroupView(props: SpAvatarGroupProps, r: UiResolved): UiElement;
474
+ /** `SpStatistic`: the trend is carried by an exact arrow and by text, never by tone alone (REQ-479). */
475
+ declare function uiStatisticView(props: SpStatisticProps, r: UiResolved): UiElement;
476
+ /** `SpDescriptions`: a section named by its heading around a `<dl>` (REQ-480). */
477
+ declare function uiDescriptionsView(props: SpDescriptionsProps, r: UiResolved): UiElement;
478
+ /** `SpTimelineList`: an ordered list; each status by its mark's shape, one current (REQ-481). */
479
+ declare function uiTimelineListView(props: SpTimelineListProps, r: UiResolved): UiElement;
480
+ /** `SpCollapse`: a frame around its items; `accordion` gives them one `<details name>` (REQ-482). */
481
+ declare function uiCollapseView(props: SpCollapseProps, r: UiResolved): UiElement;
482
+ /** The `name` an accordion's items share, `${id}--accordion`, the same in every adapter (REQ-329, DD-040). */
483
+ declare function uiCollapseGroup(props: SpCollapseProps): string | undefined;
484
+ /** `SpCollapseItem`: a native `<details>`; `group` is its accordion's shared name (REQ-482). */
485
+ declare function uiCollapseItemView(props: SpCollapseItemProps, r: UiResolved, state: {
486
+ readonly open: boolean;
487
+ readonly group?: string;
488
+ }): UiElement;
489
+ /** `SpEmpty`: a toned tray and a description (REQ-483). */
490
+ declare function uiEmptyView(props: SpEmptyProps, r: UiResolved, slots: {
491
+ readonly extra?: boolean;
492
+ }): UiElement;
493
+ /** `SpResult`: the status glyph in a round frame; status or alert by its kind (REQ-483). */
494
+ declare function uiResultView(props: SpResultProps, r: UiResolved, slots: {
495
+ readonly extra?: boolean;
496
+ }): UiElement;
497
+ /** `SpTextarea`: a native `<textarea>` on the `SpInput` contract, with an optional counter (REQ-484). */
498
+ declare function uiTextareaView(props: SpTextareaProps, r: UiResolved, state: {
499
+ readonly value: string;
500
+ }): UiElement;
501
+ /** `SpInputNumber`: a native number input between exact − and + steppers (REQ-485, REQ-486). */
502
+ declare function uiInputNumberView(props: SpInputNumberProps, r: UiResolved, state: {
503
+ readonly value: number | null;
504
+ }): UiElement;
505
+
506
+ type UiTriggerKind = 'dialog' | 'popover' | 'menu' | 'tooltip';
507
+ /** Where a consumer's trigger goes: the adapter binds the element inside it (REQ-500). */
508
+ declare function uiTriggerView(): UiElement;
509
+ /**
510
+ * The ARIA an overlay sets on a consumer's trigger, at runtime (REQ-500): `aria-haspopup`,
511
+ * `aria-expanded` and `aria-controls` as its APG pattern asks; a tooltip's `aria-describedby`.
512
+ * The relations need the instance `id`.
513
+ */
514
+ declare function uiTriggerAria(kind: UiTriggerKind, id: string | undefined, open: boolean): Readonly<Record<string, string>>;
515
+ /** A Select's items: a string is its own key and label; repeated keys skipped, `SP019` (REQ-325). */
516
+ declare function uiSelectItems(items: readonly (string | UiItem)[]): readonly UiItem[];
517
+ /** A menu's actionable items, in order: what `uiListKey` and `uiTypeahead` move over (REQ-495). */
518
+ declare function uiMenuItems(entries: readonly MenuEntry[]): readonly UiItem[];
519
+ /** How long a toast stays: its own duration, the toaster's, or 5000 ms; at least 1000 or `Infinity` (Data Model §2.27). */
520
+ declare function uiToastDuration(duration: number | undefined, toaster?: number): number;
521
+ /** `SpModal`: a native dialog opened with `showModal()` (REQ-491). */
522
+ declare function uiModalView(props: SpModalProps, r: UiResolved, s: {
523
+ readonly open: boolean;
524
+ }, slots: {
525
+ readonly footer?: boolean;
526
+ }): UiElement;
527
+ /** `SpDrawer`: the same dialog on a logical side (REQ-491, REQ-523). */
528
+ declare function uiDrawerView(props: SpDrawerProps, r: UiResolved, s: {
529
+ readonly open: boolean;
530
+ }, slots: {
531
+ readonly footer?: boolean;
532
+ }): UiElement;
533
+ /** `SpPopover`: an `auto` popover with the dialog role (REQ-492). */
534
+ declare function uiPopoverView(props: SpPopoverProps, r: UiResolved, s: {
535
+ readonly open: boolean;
536
+ }): UiElement;
537
+ /** `SpTooltip`: a `manual` popover, so it never closes an open `auto` one (REQ-492, REQ-496). */
538
+ declare function uiTooltipView(props: SpTooltipProps, r: UiResolved, s: {
539
+ readonly open: boolean;
540
+ }): UiElement;
541
+ /** `SpSelect`: the APG select-only combobox; focus stays on the trigger (REQ-494, REQ-498, DD-039). */
542
+ declare function uiSelectView(props: SpSelectProps, r: UiResolved, s: {
543
+ readonly value: string | null;
544
+ readonly open: boolean;
545
+ readonly active: string | null;
546
+ }): UiElement;
547
+ /** `SpDropdownMenu`: the APG menu button; DOM focus moves to the active item (REQ-495, REQ-498, DD-039). */
548
+ declare function uiDropdownMenuView(props: SpDropdownMenuProps, r: UiResolved, s: {
549
+ readonly open: boolean;
550
+ readonly active: string | null;
551
+ }, slots: {
552
+ readonly trigger?: boolean;
553
+ }): UiElement;
554
+ /**
555
+ * `SpToast`: its kind by glyph and text, announced politely or assertively (REQ-497). The live
556
+ * role is on the toast's body: a list item may not take another role.
557
+ */
558
+ declare function uiToastView(props: SpToastProps, r: UiResolved, s: {
559
+ readonly open: boolean;
560
+ }, slots: {
561
+ readonly action?: boolean;
562
+ }): UiElement;
563
+ /** `SpToaster`: a labelled region holding its toasts (REQ-497). */
564
+ declare function uiToasterView(props: SpToasterProps, r: UiResolved): UiElement;
565
+
566
+ export { MenuEntry, SpAlertProps, SpAvatarGroupProps, SpAvatarProps, SpBadgeProps, SpBreadcrumbProps, SpCollapseItemProps, SpCollapseProps, SpDescriptionsProps, SpDrawerProps, SpDropdownMenuProps, SpEmptyProps, SpGlyphProps, SpInputNumberProps, SpModalProps, SpPaginationProps, SpPopoverProps, SpProgressProps, SpRadioGroupProps, SpRateProps, SpResultProps, SpSegmentedProps, SpSelectProps, SpSkeletonProps, SpSliderProps, SpStatisticProps, SpStepsProps, SpSurfaceProps, SpTableProps, SpTabsProps, SpTagProps, SpTextareaProps, SpTimelineListProps, SpToastProps, SpToasterProps, SpTooltipProps, StepItem, StepStatus, UI_COMPONENTS, UI_GLYPHS, UI_PROGRESS_VIEWBOX, UI_TOKEN_DEFAULTS, type UiAlign, type UiAnchorFloating, type UiAnchorOptions, type UiAnchorTarget, type UiBox, type UiComponentRow, UiElement, type UiFamily, type UiGlyph, type UiGroup, UiItem, type UiListResult, type UiListState, type UiNumberRange, type UiNumberValue, UiOrientation, type UiOverlayElement, type UiOverlayKind, type UiPageEntry, type UiPagination, type UiPlaceInput, type UiPlacement, type UiRange, UiResolved, type UiRovingKey, type UiRovingRoot, type UiRovingState, type UiSide, type UiStep, type UiToneLayer, type UiTriggerKind, type UiValue, resolveUiTokens, uiAlertView, uiAnchor, uiAvatarGroupView, uiAvatarView, uiBadgeView, uiBreadcrumbView, uiCollapseGroup, uiCollapseItemView, uiCollapseView, uiDescriptionsView, uiDrawerView, uiDropdownMenuView, uiEmptyView, uiGlyphView, uiInitials, uiInputNumberView, uiIsRovingKey, uiItems, uiListKey, uiMenuItems, uiModalView, uiNumberStep, uiNumberValue, uiOverlaySync, uiPageWindow, uiPagination, uiPaginationView, uiPlace, uiPopoverView, uiProgressArc, uiProgressView, uiRadioGroupView, uiRange, uiRateCount, uiRateView, uiRequireName, uiResultView, uiRovingFocus, uiRovingKey, uiSegmentedView, uiSelectItems, uiSelectView, uiSelectedKey, uiSkeletonView, uiSliderView, uiSortRows, uiStatisticView, uiSteps, uiStepsView, uiSurfaceView, uiTabPanelView, uiTableView, uiTabsView, uiTagView, uiTextareaView, uiTimelineListView, uiToastDuration, uiToastView, uiToasterView, uiToneTile, uiTooltipView, uiTriggerAria, uiTriggerView, uiTypeahead, uiValue };