@exponential-at/ui 0.0.0-stage → 0.1.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 (251) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +54 -0
  3. package/README.md +360 -2
  4. package/catalog/a11y.json +668 -0
  5. package/catalog/basic-map.json +104 -0
  6. package/catalog/code.json +58 -0
  7. package/catalog/core.catalog.json +4752 -0
  8. package/catalog/core.schema.json +22667 -0
  9. package/catalog/host.json +64 -0
  10. package/catalog/layout.json +20 -0
  11. package/catalog/limits.json +9 -0
  12. package/catalog/locale.json +48 -0
  13. package/catalog/macros.json +3417 -0
  14. package/catalog/recipes.json +61 -0
  15. package/catalog/strings.json +72 -0
  16. package/catalog/style.json +128 -0
  17. package/catalog/theme.schema.json +42543 -0
  18. package/catalog/tokens.json +47 -0
  19. package/conformance/README.md +217 -0
  20. package/conformance/baseline.ts +101 -0
  21. package/conformance/browser-page.ts +146 -0
  22. package/conformance/browser-suites.ts +683 -0
  23. package/conformance/compare.ts +201 -0
  24. package/conformance/dom.ts +96 -0
  25. package/conformance/dump.ts +163 -0
  26. package/conformance/fonts.json +154 -0
  27. package/conformance/manifest.json +224 -0
  28. package/conformance/parity-compare.ts +191 -0
  29. package/conformance/parity-report.schema.json +73 -0
  30. package/conformance/parity.ts +412 -0
  31. package/conformance/pixel.ts +177 -0
  32. package/conformance/primitives-page.ts +49 -0
  33. package/conformance/report.schema.json +66 -0
  34. package/conformance/run.ts +118 -0
  35. package/dist/chunks/index-98npjvsd.js +3940 -0
  36. package/dist/chunks/index-98npjvsd.js.map +27 -0
  37. package/dist/chunks/index-gwkt14w3.js +7314 -0
  38. package/dist/chunks/index-gwkt14w3.js.map +10 -0
  39. package/dist/chunks/index-njt7yzzm.js +134 -0
  40. package/dist/chunks/index-njt7yzzm.js.map +9 -0
  41. package/dist/chunks/index-we7va6v6.js +7984 -0
  42. package/dist/chunks/index-we7va6v6.js.map +15 -0
  43. package/dist/chunks/index-xrm6f7wc.js +2563 -0
  44. package/dist/chunks/index-xrm6f7wc.js.map +10 -0
  45. package/dist/conformance.js +182749 -0
  46. package/dist/conformance.js.map +10 -0
  47. package/dist/entries/prompt.js +251 -0
  48. package/dist/entries/prompt.js.map +11 -0
  49. package/dist/entries/schema.js +1725 -0
  50. package/dist/entries/schema.js.map +11 -0
  51. package/dist/host/index.js +122 -0
  52. package/dist/host/index.js.map +9 -0
  53. package/dist/index.js +3213 -0
  54. package/dist/index.js.map +27 -0
  55. package/dist/types/src/a11y.d.ts +21 -0
  56. package/dist/types/src/animation.d.ts +76 -0
  57. package/dist/types/src/basic-map.d.ts +38 -0
  58. package/dist/types/src/builder.d.ts +50 -0
  59. package/dist/types/src/catalog.d.ts +54 -0
  60. package/dist/types/src/catalog.described.d.ts +33 -0
  61. package/dist/types/src/catalog.generated.d.ts +829 -0
  62. package/dist/types/src/chart.d.ts +46 -0
  63. package/dist/types/src/code.d.ts +44 -0
  64. package/dist/types/src/color.d.ts +20 -0
  65. package/dist/types/src/conformance.d.ts +39 -0
  66. package/dist/types/src/connector/app.d.ts +14 -0
  67. package/dist/types/src/connector/connector.d.ts +77 -0
  68. package/dist/types/src/connector/index.d.ts +4 -0
  69. package/dist/types/src/css.d.ts +29 -0
  70. package/dist/types/src/define.d.ts +66 -0
  71. package/dist/types/src/direction.d.ts +16 -0
  72. package/dist/types/src/dynamic.d.ts +159 -0
  73. package/dist/types/src/entries/prompt.d.ts +11 -0
  74. package/dist/types/src/entries/schema.d.ts +8 -0
  75. package/dist/types/src/expr.d.ts +71 -0
  76. package/dist/types/src/extension.d.ts +4 -0
  77. package/dist/types/src/format.d.ts +112 -0
  78. package/dist/types/src/geometry.d.ts +40 -0
  79. package/dist/types/src/host/contract.d.ts +188 -0
  80. package/dist/types/src/host/decoders.d.ts +61 -0
  81. package/dist/types/src/host/index.d.ts +11 -0
  82. package/dist/types/src/host/package.d.ts +58 -0
  83. package/dist/types/src/host/policy.d.ts +105 -0
  84. package/dist/types/src/host/router.d.ts +34 -0
  85. package/dist/types/src/host/runtime.d.ts +205 -0
  86. package/dist/types/src/host/sources.d.ts +15 -0
  87. package/dist/types/src/host/transports.d.ts +109 -0
  88. package/dist/types/src/index.d.ts +63 -0
  89. package/dist/types/src/layout.d.ts +20 -0
  90. package/dist/types/src/limits.d.ts +21 -0
  91. package/dist/types/src/list.d.ts +133 -0
  92. package/dist/types/src/locale.d.ts +22 -0
  93. package/dist/types/src/macros.d.ts +29 -0
  94. package/dist/types/src/overlay.d.ts +27 -0
  95. package/dist/types/src/prompt.d.ts +44 -0
  96. package/dist/types/src/recipes.d.ts +17 -0
  97. package/dist/types/src/reducer.d.ts +41 -0
  98. package/dist/types/src/resizable.d.ts +38 -0
  99. package/dist/types/src/schema.d.ts +7 -0
  100. package/dist/types/src/strings.d.ts +13 -0
  101. package/dist/types/src/style.d.ts +201 -0
  102. package/dist/types/src/test-preload.d.ts +1 -0
  103. package/dist/types/src/text-shimmer.d.ts +24 -0
  104. package/dist/types/src/theme-types.d.ts +162 -0
  105. package/dist/types/src/theme.d.ts +73 -0
  106. package/dist/types/src/themes.d.ts +22 -0
  107. package/dist/types/src/tree-guides.d.ts +17 -0
  108. package/dist/types/src/types.d.ts +314 -0
  109. package/dist/types/src/validate.d.ts +31 -0
  110. package/dist/types/src/web/base-css.d.ts +1 -0
  111. package/dist/types/src/web/box-css.d.ts +55 -0
  112. package/dist/types/src/web/coerce.d.ts +32 -0
  113. package/dist/types/src/web/data.d.ts +105 -0
  114. package/dist/types/src/web/dates.d.ts +12 -0
  115. package/dist/types/src/web/form.d.ts +44 -0
  116. package/dist/types/src/web/host-types.d.ts +119 -0
  117. package/dist/types/src/web/index.d.ts +28 -0
  118. package/dist/types/src/web/inputs.d.ts +55 -0
  119. package/dist/types/src/web/list.d.ts +13 -0
  120. package/dist/types/src/web/listbox.d.ts +14 -0
  121. package/dist/types/src/web/markdown.d.ts +96 -0
  122. package/dist/types/src/web/media.d.ts +62 -0
  123. package/dist/types/src/web/parts.d.ts +4 -0
  124. package/dist/types/src/web/primitives/alert-dialog.d.ts +10 -0
  125. package/dist/types/src/web/primitives/alert.d.ts +9 -0
  126. package/dist/types/src/web/primitives/avatar-color.d.ts +2 -0
  127. package/dist/types/src/web/primitives/avatar.d.ts +13 -0
  128. package/dist/types/src/web/primitives/badge.d.ts +10 -0
  129. package/dist/types/src/web/primitives/breadcrumb.d.ts +10 -0
  130. package/dist/types/src/web/primitives/button.d.ts +6 -0
  131. package/dist/types/src/web/primitives/calendar.d.ts +43 -0
  132. package/dist/types/src/web/primitives/card.d.ts +9 -0
  133. package/dist/types/src/web/primitives/checkbox.d.ts +5 -0
  134. package/dist/types/src/web/primitives/choice-tiles.d.ts +32 -0
  135. package/dist/types/src/web/primitives/cn.d.ts +3 -0
  136. package/dist/types/src/web/primitives/code-block.d.ts +24 -0
  137. package/dist/types/src/web/primitives/command.d.ts +134 -0
  138. package/dist/types/src/web/primitives/context-ring.d.ts +24 -0
  139. package/dist/types/src/web/primitives/dialog-arms.d.ts +6 -0
  140. package/dist/types/src/web/primitives/dialog.d.ts +24 -0
  141. package/dist/types/src/web/primitives/disclosure-header.d.ts +5 -0
  142. package/dist/types/src/web/primitives/dock.d.ts +42 -0
  143. package/dist/types/src/web/primitives/dropdown-menu.d.ts +14 -0
  144. package/dist/types/src/web/primitives/empty-state.d.ts +15 -0
  145. package/dist/types/src/web/primitives/glass-card.d.ts +4 -0
  146. package/dist/types/src/web/primitives/hover-card.d.ts +7 -0
  147. package/dist/types/src/web/primitives/icon-disc.d.ts +12 -0
  148. package/dist/types/src/web/primitives/index.d.ts +48 -0
  149. package/dist/types/src/web/primitives/input.d.ts +5 -0
  150. package/dist/types/src/web/primitives/kbd.d.ts +4 -0
  151. package/dist/types/src/web/primitives/label.d.ts +3 -0
  152. package/dist/types/src/web/primitives/menu-surface.d.ts +17 -0
  153. package/dist/types/src/web/primitives/meter.d.ts +21 -0
  154. package/dist/types/src/web/primitives/popover.d.ts +3 -0
  155. package/dist/types/src/web/primitives/progress-ring.d.ts +5 -0
  156. package/dist/types/src/web/primitives/progress.d.ts +8 -0
  157. package/dist/types/src/web/primitives/scroll-area.d.ts +49 -0
  158. package/dist/types/src/web/primitives/segmented-control.d.ts +5 -0
  159. package/dist/types/src/web/primitives/select.d.ts +47 -0
  160. package/dist/types/src/web/primitives/separator.d.ts +3 -0
  161. package/dist/types/src/web/primitives/sheet-chrome.d.ts +4 -0
  162. package/dist/types/src/web/primitives/sheet.d.ts +20 -0
  163. package/dist/types/src/web/primitives/skeleton.d.ts +3 -0
  164. package/dist/types/src/web/primitives/spinner.d.ts +3 -0
  165. package/dist/types/src/web/primitives/switch.d.ts +4 -0
  166. package/dist/types/src/web/primitives/table.d.ts +11 -0
  167. package/dist/types/src/web/primitives/tabs.d.ts +13 -0
  168. package/dist/types/src/web/primitives/textarea.d.ts +3 -0
  169. package/dist/types/src/web/primitives/toast.d.ts +163 -0
  170. package/dist/types/src/web/primitives/tooltip.d.ts +3 -0
  171. package/dist/types/src/web/primitives/truncate.d.ts +7 -0
  172. package/dist/types/src/web/primitives/typeahead-portal.d.ts +12 -0
  173. package/dist/types/src/web/share.d.ts +6 -0
  174. package/dist/types/src/web/table.d.ts +20 -0
  175. package/dist/types/src/web/theme-css.d.ts +69 -0
  176. package/dist/types/src/web/urls.d.ts +21 -0
  177. package/dist/web/index.js +2303 -0
  178. package/dist/web/index.js.map +26 -0
  179. package/dist/web/primitives/index.js +1450 -0
  180. package/dist/web/primitives/index.js.map +57 -0
  181. package/docs/components.generated.json +6238 -0
  182. package/docs/round-1-contract.md +679 -0
  183. package/docs/round-2-contract.md +476 -0
  184. package/docs/round-3-contract.md +174 -0
  185. package/docs/themes.generated.json +3503 -0
  186. package/fixtures/animations.json +2890 -0
  187. package/fixtures/bench-list.json +58 -0
  188. package/fixtures/bind-time.json +30664 -0
  189. package/fixtures/catalog-basic-map.json +1692 -0
  190. package/fixtures/catalog-components.json +9323 -0
  191. package/fixtures/catalog-extension.json +620 -0
  192. package/fixtures/catalog-macros.json +36370 -0
  193. package/fixtures/code-tokens.json +1993 -0
  194. package/fixtures/conformance-baseline.json +55544 -0
  195. package/fixtures/conformance-cases.json +49 -0
  196. package/fixtures/conformance-known.json +2123 -0
  197. package/fixtures/control-geometry.json +4200 -0
  198. package/fixtures/dashboard.data.json +74 -0
  199. package/fixtures/dashboard.json +752 -0
  200. package/fixtures/demo-surface.json +47 -0
  201. package/fixtures/format.json +870 -0
  202. package/fixtures/host-policy.json +1067 -0
  203. package/fixtures/host-router.json +1152 -0
  204. package/fixtures/host-transport.json +590 -0
  205. package/fixtures/interactions-round1.json +773 -0
  206. package/fixtures/kitchen-sink.expanded.json +10844 -0
  207. package/fixtures/kitchen-sink.json +3049 -0
  208. package/fixtures/layout-geometry-round1.json +7278 -0
  209. package/fixtures/layout-geometry.json +2072 -0
  210. package/fixtures/overlay-geometry.json +272 -0
  211. package/fixtures/primitive-specimens.json +58 -0
  212. package/fixtures/prompt-budget.json +33 -0
  213. package/fixtures/resizable.json +714 -0
  214. package/fixtures/round4-contract.json +2985 -0
  215. package/fixtures/specimens.json +9832 -0
  216. package/fixtures/style-conditions.json +336 -0
  217. package/fixtures/template-items.json +2215 -0
  218. package/fixtures/text-direction.json +309 -0
  219. package/fixtures/text-shimmer.json +96 -0
  220. package/fixtures/theme-extends.json +573 -0
  221. package/fixtures/theme-invalid.json +1296 -0
  222. package/fixtures/theme-recipes.json +58600 -0
  223. package/fixtures/theme-resolved.json +23949 -0
  224. package/fixtures/toast-stack.json +215 -0
  225. package/fixtures/tree-guides.json +224 -0
  226. package/fixtures/virtual-list.json +733 -0
  227. package/generated/ExponentialUICatalog.generated.kt +67 -0
  228. package/generated/ExponentialUICatalog.generated.swift +67 -0
  229. package/generated/ExponentialUIThemes.generated.kt +23 -0
  230. package/generated/ExponentialUIThemes.generated.swift +23 -0
  231. package/generated/catalog.descriptions.generated.rs +6 -0
  232. package/generated/catalog.generated.rs +80 -0
  233. package/generated/catalog.themes.generated.rs +34 -0
  234. package/generated/core.descriptions.json +2505 -0
  235. package/generated/core.runtime.json +3609 -0
  236. package/package.json +87 -4
  237. package/themes/exponential.recipes.json +49 -0
  238. package/themes/exponential.theme.json +755 -0
  239. package/themes/neutral.theme.json +5676 -0
  240. package/themes/orange.theme.json +43 -0
  241. package/themes/playful.theme.json +219 -0
  242. package/vendor/a2ui/LICENSE.txt +203 -0
  243. package/vendor/a2ui/README.md +27 -0
  244. package/vendor/a2ui/v0_9/basic_catalog.json +1387 -0
  245. package/vendor/a2ui/v0_9/basic_catalog_rules.txt +5 -0
  246. package/vendor/a2ui/v0_9/client_capabilities.json +97 -0
  247. package/vendor/a2ui/v0_9/client_to_server.json +104 -0
  248. package/vendor/a2ui/v0_9/common_types.json +315 -0
  249. package/vendor/a2ui/v0_9/server_to_client.json +132 -0
  250. package/vendor/json-render/LICENSE.txt +201 -0
  251. package/vendor/json-render/README.md +13 -0
@@ -0,0 +1,205 @@
1
+ import type { ResolvedTheme } from "../theme-types.js";
2
+ import type { ExtensionDef, FlatComponent, ReduceIssue, UiNode } from "../types.js";
3
+ import type { ClientMessage, HostOp } from "./contract.js";
4
+ import type { PackageIssue, AppPackage } from "./package.js";
5
+ import type { FunctionDecision, FunctionPolicy, MediaOptions, MediaRequest, UrlPolicy } from "./policy.js";
6
+ import { HostRouter } from "./router.js";
7
+ import type { SourceResolvers } from "./sources.js";
8
+ export type TransportStatus = `connecting` | `open` | `closed` | `error`;
9
+ /** Messages in, client messages out. Adapters: `transports.ts`. */
10
+ export interface Transport {
11
+ /** Start delivering messages; report the connection state. */
12
+ start(receive: (message: unknown) => void, status: (status: TransportStatus, detail?: string) => void): void;
13
+ send(message: ClientMessage): void | Promise<void>;
14
+ close(): void;
15
+ }
16
+ export interface FunctionCallInfo {
17
+ surfaceId: string;
18
+ componentId: string;
19
+ name: string;
20
+ args: Record<string, unknown>;
21
+ }
22
+ export type HostFunction = (args: Record<string, unknown>, call: FunctionCallInfo) => unknown | Promise<unknown>;
23
+ export interface HostPolicy {
24
+ /** The declarative gate; `ask` decisions go to onFunctionCall. */
25
+ functions?: FunctionPolicy;
26
+ /** The consent hook: true runs the call. Unset = `ask` is denied. */
27
+ onFunctionCall?: (call: FunctionCallInfo) => boolean | Promise<boolean>;
28
+ urls?: UrlPolicy;
29
+ /** Opens an allowed url (default: `window.open(url, "_blank")`). */
30
+ openUrl?: (url: string) => void;
31
+ media?: MediaOptions;
32
+ }
33
+ export interface HostOptions {
34
+ transport?: Transport;
35
+ functions?: Record<string, HostFunction>;
36
+ sources?: SourceResolvers;
37
+ extensions?: readonly ExtensionDef[];
38
+ packages?: readonly AppPackage[];
39
+ policy?: HostPolicy;
40
+ /** Every client message that leaves (after the transport got it). */
41
+ onSend?: (message: ClientMessage) => void;
42
+ /** Ops the host performs (tests, logging). */
43
+ onOp?: (op: HostOp) => void;
44
+ /** Every problem the host meets (a package that failed validation, an
45
+ * error it answered a message with, an invalid surface theme). A
46
+ * transport-less host has no server to tell: this is where they land. */
47
+ onIssue?: (issue: HostIssue) => void;
48
+ }
49
+ /** One problem the host met; `host.issues` keeps the latest ones. */
50
+ export interface HostIssue {
51
+ /** A host error code (`TEMPLATE_NOT_FOUND`…) or `PACKAGE_INVALID`. */
52
+ code: string;
53
+ message: string;
54
+ surfaceId?: string;
55
+ /** A JSON pointer (into the package or the message). */
56
+ path?: string;
57
+ packageId?: string;
58
+ }
59
+ /** A package passed in `HostOptions.packages` that failed validation. */
60
+ export declare class PackageError extends Error {
61
+ readonly packageId: string;
62
+ readonly issues: PackageIssue[];
63
+ constructor(packageId: string, issues: PackageIssue[]);
64
+ }
65
+ /** A `createSurface.theme` (a built-in id or a theme JSON) → the resolved
66
+ * theme, or why it is unusable. */
67
+ export declare function resolveSurfaceTheme(input: unknown): {
68
+ theme: ResolvedTheme | null;
69
+ issues: string[];
70
+ };
71
+ export interface FunctionOutcome {
72
+ decision: FunctionDecision;
73
+ result?: unknown;
74
+ error?: string;
75
+ }
76
+ type Listener = () => void;
77
+ /** One surface's state: the flat components, the data model, the reduced
78
+ * tree. Mutations notify subscribers; `root` is reduced lazily. */
79
+ export declare class SurfaceStore {
80
+ private extensions;
81
+ readonly surfaceId: string;
82
+ catalogId: string;
83
+ packageId?: string;
84
+ sendDataModel: boolean;
85
+ /** The flat components, mutated in place while nothing holds them. */
86
+ private list;
87
+ /** `list` was handed out (`components`): the next update copies first. */
88
+ private shared;
89
+ private positions;
90
+ data: Record<string, unknown>;
91
+ /** The server's `createSurface.theme`, resolved (undefined = the
92
+ * renderer's own theme). */
93
+ theme?: ResolvedTheme;
94
+ private reduced;
95
+ private listeners;
96
+ version: number;
97
+ constructor(surfaceId: string, catalogId: string, extensions: () => readonly ExtensionDef[]);
98
+ /** The flat components as a SNAPSHOT: an array handed out here is never
99
+ * mutated afterwards (the next update copies first), so a renderer that
100
+ * keeps it sees a stable value; a stream nobody reads stays linear. */
101
+ get components(): readonly FlatComponent[];
102
+ /** The flat component with this id (undefined = none). */
103
+ component(id: string): FlatComponent | undefined;
104
+ get root(): UiNode | null;
105
+ get issues(): ReduceIssue[];
106
+ /** Round 2 §4: the reducer's lifted data templates (absent without any). */
107
+ get templates(): Record<string, UiNode> | undefined;
108
+ private reduce;
109
+ /** A2UI: a later update replaces components BY ID and keeps the rest
110
+ * (an id → position map: a streamed surface costs linear, VAPP-103). */
111
+ setComponents(components: readonly FlatComponent[]): void;
112
+ /** Re-reduce on the next read (the extension set changed). */
113
+ invalidate(): void;
114
+ /** Write the data model at `pointer` (`undefined` removes); a refused
115
+ * write (writePointer) changes nothing and returns the reason. */
116
+ setData(pointer: string, value: unknown): string | undefined;
117
+ subscribe(listener: Listener): () => void;
118
+ notify(): void;
119
+ }
120
+ export declare class ExponentialHost {
121
+ private options;
122
+ readonly router: HostRouter;
123
+ private stores;
124
+ private subscriptions;
125
+ /** Per surface: the FLAT component owning a failed node → that
126
+ * component as it was when it failed + the node ids already reported. */
127
+ private paintErrors;
128
+ private listeners;
129
+ private functions;
130
+ private sources;
131
+ private extensions;
132
+ status: TransportStatus;
133
+ statusDetail?: string;
134
+ /** The last UNSUPPORTED_CATALOG id seen (the catalog-update banner). */
135
+ unsupportedCatalog?: string;
136
+ /** The latest problems (newest last, capped); a new array per change. */
137
+ issues: readonly HostIssue[];
138
+ constructor(options?: HostOptions);
139
+ /** False for a local-only host (packages, in-memory feeds): no
140
+ * `host_offline` state to show. */
141
+ get hasTransport(): boolean;
142
+ get supportedCatalogIds(): string[];
143
+ clientCapabilities(): {
144
+ "v0.9": {
145
+ supportedCatalogIds: string[];
146
+ };
147
+ };
148
+ get extensionDefs(): readonly ExtensionDef[];
149
+ registerExtension(ext: ExtensionDef): void;
150
+ registerFunction(name: string, fn: HostFunction): void;
151
+ registerSource(scheme: string, resolver: SourceResolvers[string]): void;
152
+ /** Install a package; its validation issues are returned AND reported
153
+ * (`issues`, `onIssue`). A package with issues is not installed. */
154
+ installPackage(pkg: AppPackage): PackageIssue[];
155
+ private report;
156
+ surface(id: string): SurfaceStore | undefined;
157
+ surfaceIds(): string[];
158
+ subscribe(listener: Listener): () => void;
159
+ private notify;
160
+ connect(): void;
161
+ close(): void;
162
+ /** One server message (a transport calls this; tests and in-memory hosts
163
+ * may call it directly). */
164
+ receive(message: unknown): HostOp[];
165
+ send(message: ClientMessage): void;
166
+ private perform;
167
+ private unbind;
168
+ /** A component's server event: the A2UI client action message. */
169
+ action(event: {
170
+ surfaceId: string;
171
+ componentId: string;
172
+ name: string;
173
+ context?: Record<string, unknown>;
174
+ payload?: Record<string, unknown>;
175
+ timestamp?: string;
176
+ }): ClientMessage;
177
+ /** The policy decision for a call, before any consent hook. */
178
+ decide(surfaceId: string, name: string): FunctionDecision;
179
+ /** An action `functionCall` to a host function: gate, consent, run. A
180
+ * built-in other than openUrl has no effect as an action. */
181
+ callFunction(call: FunctionCallInfo): Promise<FunctionOutcome>;
182
+ /** The URL policy every href passes (relative urls against the urls' or
183
+ * the media `baseUrl`). */
184
+ urlPolicy(): UrlPolicy;
185
+ /** openUrl / Link through the URL policy. True when it opened. */
186
+ openUrl(url: string): boolean;
187
+ /** A renderer's painter for `componentId` failed. Reported ONCE per
188
+ * surface + component id (whatever the message) as an A2UI
189
+ * `RENDER_FAILED` error (and so a host issue), and not again until that
190
+ * component's props change (an `updateComponents` naming it, or the
191
+ * surface re-created). A part or template-instance id counts under the
192
+ * flat component it belongs to (`card.body` → `card`), so the record is
193
+ * bounded by the surface's components. */
194
+ paintError(error: {
195
+ surfaceId: string;
196
+ componentId: string;
197
+ message: string;
198
+ }): void;
199
+ private forgetPaintErrors;
200
+ /** The media policy every src passes (`policy.media`). */
201
+ mediaOptions(): MediaOptions | undefined;
202
+ /** The image loader's request (absolute url + auth headers). */
203
+ mediaRequest(url: string): MediaRequest | null;
204
+ }
205
+ export {};
@@ -0,0 +1,15 @@
1
+ export interface ParsedSource {
2
+ /** The source as written. */
3
+ uri: string;
4
+ scheme: string;
5
+ name: string;
6
+ params: Record<string, string>;
7
+ }
8
+ /** `exp:issues?board=b1&limit=20` → `{scheme: "exp", name: "issues",
9
+ * params: {board: "b1", limit: "20"}}`; null when it does not parse. */
10
+ export declare function parseSource(uri: string): ParsedSource | null;
11
+ /** What a resolver emits into: the value lands at the bound path. */
12
+ export type SourceEmit = (value: unknown) => void;
13
+ /** A scheme's resolver: start following `source`, return the cancel. */
14
+ export type SourceResolver = (source: ParsedSource, emit: SourceEmit) => (() => void) | void;
15
+ export type SourceResolvers = Record<string, SourceResolver>;
@@ -0,0 +1,109 @@
1
+ import type { ClientMessage } from "./contract.js";
2
+ import { JsonlDecoder, SseDecoder } from "./decoders.js";
3
+ import type { Decoded } from "./decoders.js";
4
+ import type { Transport, TransportStatus } from "./runtime.js";
5
+ type Receive = (message: unknown) => void;
6
+ type Status = (status: TransportStatus, detail?: string) => void;
7
+ /** In-memory: `feed` messages in, read what the host sent from `sent`. */
8
+ export declare class MemoryTransport implements Transport {
9
+ readonly sent: ClientMessage[];
10
+ private receiveFn?;
11
+ private pending;
12
+ onSend?: (message: ClientMessage) => void;
13
+ start(receive: Receive, status: Status): void;
14
+ feed(...messages: unknown[]): void;
15
+ /** JSONL text, as a stream server would send it. */
16
+ feedJsonl(text: string): void;
17
+ send(message: ClientMessage): void;
18
+ close(): void;
19
+ }
20
+ export interface HttpTransportOptions {
21
+ /** The stream to read (GET). */
22
+ url: string;
23
+ /** Where client messages go (POST, JSON body); default `url`. */
24
+ postUrl?: string;
25
+ headers?: Record<string, string>;
26
+ /** Reconnect after a drop (an error or an aborted stream), ms (0 =
27
+ * never). Default 2000. */
28
+ reconnectMs?: number;
29
+ /** Reconnect after a CLEAN end of the stream too (the server resumes it).
30
+ * Default false: a stream that ends is done (status `closed`). An SSE
31
+ * stream that sent a `retry:` field signals this itself. */
32
+ resumable?: boolean;
33
+ fetch?: typeof fetch;
34
+ }
35
+ declare abstract class StreamTransport implements Transport {
36
+ protected options: HttpTransportOptions;
37
+ private controller?;
38
+ /** Bumped by every start/close: a loop whose generation is stale exits
39
+ * (an old loop asleep in its reconnect wait never runs beside a new
40
+ * one). */
41
+ private generation;
42
+ constructor(options: HttpTransportOptions);
43
+ protected abstract decoder(): {
44
+ push(chunk: string): Decoded;
45
+ end(): Decoded;
46
+ retryMs?: number;
47
+ };
48
+ protected abstract accept(): string;
49
+ start(receive: Receive, status: Status): void;
50
+ private run;
51
+ send(message: ClientMessage): Promise<void>;
52
+ close(): void;
53
+ }
54
+ /** A2UI JSONL over a streamed HTTP response (`application/jsonl`). */
55
+ export declare class JsonlStreamTransport extends StreamTransport {
56
+ protected decoder(): JsonlDecoder;
57
+ protected accept(): string;
58
+ }
59
+ /** Server-Sent Events read through fetch (headers allowed, unlike
60
+ * EventSource). */
61
+ export declare class SseTransport extends StreamTransport {
62
+ protected decoder(): SseDecoder;
63
+ protected accept(): string;
64
+ }
65
+ /** One A2UI message (or JSONL) per frame; client messages go back as
66
+ * frames. */
67
+ export declare class WebSocketTransport implements Transport {
68
+ private options;
69
+ private socket?;
70
+ /** Bumped by every start/close: a stale socket's reconnect timer is a
71
+ * no-op. */
72
+ private generation;
73
+ constructor(options: {
74
+ url: string;
75
+ protocols?: string | string[];
76
+ reconnectMs?: number;
77
+ WebSocket?: typeof WebSocket;
78
+ });
79
+ start(receive: Receive, status: Status): void;
80
+ send(message: ClientMessage): void;
81
+ close(): void;
82
+ }
83
+ export interface McpTransportOptions {
84
+ /** The MCP server's streamable-HTTP endpoint. */
85
+ url: string;
86
+ /** The tool whose result carries the surface (called once at start). */
87
+ tool: string;
88
+ arguments?: Record<string, unknown>;
89
+ /** The tool client messages go to; default `a2ui_event`. */
90
+ actionTool?: string;
91
+ headers?: Record<string, string>;
92
+ fetch?: typeof fetch;
93
+ }
94
+ /** A2UI over MCP: calls `tool`, delivers the A2UI resources in its result,
95
+ * and sends every client message as a tools/call to `actionTool` (its
96
+ * result may carry more messages). JSON-RPC over plain POST; an SSE
97
+ * response body is read through the SSE decoder. */
98
+ export declare class McpTransport implements Transport {
99
+ private options;
100
+ private id;
101
+ private receiveFn?;
102
+ private session?;
103
+ constructor(options: McpTransportOptions);
104
+ start(receive: Receive, status: Status): void;
105
+ send(message: ClientMessage): Promise<void>;
106
+ close(): void;
107
+ private rpc;
108
+ }
109
+ export {};
@@ -0,0 +1,63 @@
1
+ export * from "./types.js";
2
+ export { CORE_CATALOG_ID, CORE_LITE_CATALOG_ID, A2UI_BASIC_CATALOG_ID, A2UI_VERSION, SUPPORTED_CATALOG_IDS, UNKNOWN_COMPONENT, TOKEN_GROUPS, coreCatalog, coreMacros, catalogView, sharedCatalogView, componentDef, componentNames, coreLite, isOffered, parseTokenRef, isKnownToken, } from "./catalog.js";
3
+ export type { CatalogView } from "./catalog.js";
4
+ export * from "./catalog.generated.js";
5
+ export { STYLE_KEYS, STYLE_LAYOUT_KEYS, STYLE_VISUAL_KEYS, STYLE_LAYOUT_EFFECT_KEYS, STYLE_MEDIA, STYLE_STATES, STYLE_TRANSFORM, validateStyle, create, props, parseMediaCondition, mediaMatches, resolveConditions, activeBreakpoint, styleKeyEnum, styleKeyType, } from "./style.js";
6
+ export type { Style, StyleProps, MediaKey, StateKey, StyleIssue, Gradient, ConditionContext, MediaCondition } from "./style.js";
7
+ export { validateProps, validateNode, isCallableName, isDynamic } from "./validate.js";
8
+ export type { PropIssue } from "./validate.js";
9
+ export { evalValue, evalExpr, evalCondition, evalConditionValue, truthy, isBinding, isCall, percent, valuesEqual, clampNumber, fillTemplate, filterItems, CORE_FUNCTIONS, CORE_FUNCTION_NAMES } from "./expr.js";
10
+ export type { ExprContext, Dynamic } from "./expr.js";
11
+ export { expandMacros, isResponsiveValue, responsiveAt, propsAt, BREAKPOINTS } from "./macros.js";
12
+ export { resolveDynamic, isVisible, runAction, withOwnWrites, submitClosesOverlay, bindTree, readPointer, writePointer, writeTokens, POINTER_ISSUES, absolutePath, readPath, hasItem, isDataSchema, resolveProp, resolveNodeProps, hasRowSlots, rowScope, bindRowSlot, sectionScope, bindSectionHeader, BIND_FUNCTIONS, BIND_FUNCTION_NAMES } from "./dynamic.js";
13
+ export { displayString, englishFormatter, intlFormatter, formatFunctions, formatPattern, parseDateValue, relativeTimeUnit, currencyDigits, FORMAT_FUNCTION_NAMES, ENGLISH_FORMAT_FUNCTIONS, ENGLISH_DATE_PATTERNS, ENGLISH_TIME_PATTERN, ENGLISH_DATE_TIME_JOIN, fixedOffset, intlZoneOffset } from "./format.js";
14
+ export type { Formatter, NumberOptions, DateOptions, DateStyle, PluralCategory, RelativeUnit, ZoneOffset } from "./format.js";
15
+ export { templateItemKeys, tableRowKeys, templateInstances, itemExtents, itemOffsets, virtualWindow, scrollOffsetForIndex, scrollOffsetForItem, instanceSegment, listSections, sectionRows, stickyHeader, templateBudget, templateSiteKey, WINDOW_OVERSCAN } from "./list.js";
16
+ export type { TemplateInstance, TemplateBudget, WindowRange, ScrollAlign, ListSection } from "./list.js";
17
+ export { normalizeSizes, resizePanels, keyboardResize, panelExtents, dragDelta, RESIZE_STEP, PANEL_MIN, RESIZE_HANDLE_HIT } from "./resizable.js";
18
+ export type { PanelLimits, ResizeKey } from "./resizable.js";
19
+ export { nodeDirections, physicalTextAlign, nodeTextAlign } from "./direction.js";
20
+ export type { Direction, PhysicalAlign } from "./direction.js";
21
+ export { LIMITS, MAX_COMPONENTS, MAX_DEPTH, MAX_MESSAGE_BYTES, MAX_TEMPLATE_ITEMS, MAX_POINTER_BYTES, MAX_POINTER_SEGMENTS, LIMIT_ISSUES } from "./limits.js";
22
+ export { LAYOUT_CONSTANTS, FIELD_INTRINSIC_WIDTH, MEDIA_INTRINSIC_WIDTH, MEDIA_ASPECT_RATIO, TREE_GUIDE_COLUMN, TREE_GUIDE_RADIUS, TREE_GUIDE_BRIDGE, PENDING_DELAY_MS, SKELETON_PULSE_MS, SKELETON_OPACITY_LOW, SKELETON_OPACITY_HIGH, SKELETON_REDUCED_OPACITY, SEARCH_LIST_FADE } from "./layout.js";
23
+ export { treeGuides, applyTreeGuides, isRowRoot } from "./tree-guides.js";
24
+ export type { TreeGuide } from "./tree-guides.js";
25
+ export { ANIMATIONS, ANIMATION_NAMES, ANIMATION_PROPERTIES_CSS, animatesOpacity, animationTiming, animationFrame, cubicBezier, keyframesCss, animationCss, paintedOpacity } from "./animation.js";
26
+ export type { AnimationDef, AnimationFrame, AnimationTiming, Keyframe } from "./animation.js";
27
+ export type { DataScope, ResolveOptions, ActionOutcome, FunctionTable, PointerWrite } from "./dynamic.js";
28
+ export { DEFAULT_STRINGS, STRING_IDS, parseStringRef, isStringRef, stringTable, formatString, resolveString } from "./strings.js";
29
+ export { DEFAULT_LOCALE, parseLocale, localeRegion, weekStart, textDirection, RTL_MIRRORED_ICONS, mirrorsInRtl } from "./locale.js";
30
+ export type { LocaleParts } from "./locale.js";
31
+ export { tokenizeCode, codeText, ansiRuns, CODE_LANGUAGES, CODE_LANGUAGE_NAMES } from "./code.js";
32
+ export type { AnsiRun } from "./code.js";
33
+ export { textShimmer, TEXT_SHIMMER } from "./text-shimmer.js";
34
+ export type { TextShimmer } from "./text-shimmer.js";
35
+ export { A11Y_ROLES, A11Y_RULES, A11Y_COMMANDS, COMPONENT_A11Y, componentA11y, isA11yRole } from "./a11y.js";
36
+ export { chartExtent, chartSummaryParams, sparklineSummaryParams, niceTicks, seriesColor, DONUT_HOLE, WINDOW_THRESHOLD } from "./chart.js";
37
+ export type { ChartSeries } from "./chart.js";
38
+ export type { ComponentA11y } from "./a11y.js";
39
+ export type { CodeToken } from "./code.js";
40
+ export { basicMap, mapBasicComponent, mapBasicIcon, BASIC_TRANSFORM_NAMES } from "./basic-map.js";
41
+ export type { MappedComponent } from "./basic-map.js";
42
+ export { reduceSurface, reduceNested, preorder, RESERVED_KEYS, validVisible, slotAllowed, childTemplate } from "./reducer.js";
43
+ export type { ReduceOptions, ReduceResult } from "./reducer.js";
44
+ export { defineExtension, validateExtension } from "./extension.js";
45
+ export { defineSurface, flattenSurface, ui, el, bind, call, event, run } from "./define.js";
46
+ export type { SurfaceNode, TemplateChildren, DefineOptions, DefinedSurface, Factory } from "./define.js";
47
+ export * from "./theme-types.js";
48
+ export { parseColor, toHex, toThemeHex, isThemeHex, luminance, contrast } from "./color.js";
49
+ export type { Rgba } from "./color.js";
50
+ export { RECIPE_STATES, RECIPE_KEYS, recipeParts, macroParts, nativeRecipeProps } from "./recipes.js";
51
+ export type { PartSpec } from "./recipes.js";
52
+ export { MODES, DENSITIES, THEME_SCHEMA_ID, resolveMode, applyDensity, applyContrast, resolveConditionKey, easingCss, ThemeError, validateTheme, tryLoadTheme, loadTheme, resolveToken, resolveStyleValues, recipeStyle, resolveRecipe, nodeRecipeQuery, resolveNodeStyle, shadowCss, } from "./theme.js";
53
+ export type { ThemeOptions } from "./theme.js";
54
+ export { BUILTIN_THEMES, BUILTIN_THEME_IDS, DEFAULT_THEME_ID, neutralTheme, exponentialTheme, playfulTheme, orangeTheme, builtinTheme, builtinThemes, themeOrDefault } from "./themes.js";
55
+ export { styleToCss, styleAttribute, gradientCss } from "./css.js";
56
+ export { SHADCN_COLOR_VARS, importShadcnCss, themeFromImport, diffTheme, exportThemeJson, parseThemeJson, parseShadow } from "./builder.js";
57
+ export type { ThemeImport } from "./builder.js";
58
+ export { CONTROL_PARTS, GEOMETRY_KEYS, controlGeometry, checkGeometry, verifyPainterGeometry } from "./geometry.js";
59
+ export type { ControlGeometry, GeometryKey, MeasuredBox, PainterOverride, GeometryIssue } from "./geometry.js";
60
+ export { OVERLAY_OFFSET, OVERLAY_PADDING, placeOverlay } from "./overlay.js";
61
+ export type { OverlaySide, OverlayAlign, OverlayPlacement, Rect, Size } from "./overlay.js";
62
+ export * from "./host/index.js";
63
+ export * from "./connector/index.js";
@@ -0,0 +1,20 @@
1
+ export declare const LAYOUT_CONSTANTS: Readonly<Record<string, number>>;
2
+ export declare const WINDOW_THRESHOLD: number;
3
+ export declare const WINDOW_OVERSCAN: number;
4
+ export declare const RESIZE_STEP: number;
5
+ export declare const PANEL_MIN: number;
6
+ export declare const RESIZE_HANDLE_HIT: number;
7
+ export declare const FIELD_INTRINSIC_WIDTH: number;
8
+ export declare const MEDIA_INTRINSIC_WIDTH: number;
9
+ export declare const MEDIA_ASPECT_RATIO: number;
10
+ export declare const TREE_GUIDE_COLUMN: number;
11
+ /** Round 3: the elbow's corner radius and how far the guide verticals overshoot a row's top edge (paint only). */
12
+ export declare const TREE_GUIDE_RADIUS: number;
13
+ export declare const TREE_GUIDE_BRIDGE: number;
14
+ /** EXP-1259: the pending Button's delay, the Skeleton's pulse and the SearchList's bottom fade (feedback-states.json, search-list.json). */
15
+ export declare const PENDING_DELAY_MS: number;
16
+ export declare const SKELETON_PULSE_MS: number;
17
+ export declare const SKELETON_OPACITY_LOW: number;
18
+ export declare const SKELETON_OPACITY_HIGH: number;
19
+ export declare const SKELETON_REDUCED_OPACITY: number;
20
+ export declare const SEARCH_LIST_FADE: number;
@@ -0,0 +1,21 @@
1
+ export declare const LIMITS: Readonly<Record<string, number>>;
2
+ /** Nodes the reducer places in one surface's tree (template nodes included). */
3
+ export declare const MAX_COMPONENTS: number;
4
+ /** Component nesting levels (the root = 1). */
5
+ export declare const MAX_DEPTH: number;
6
+ /** One server message as UTF-8 JSON. */
7
+ export declare const MAX_MESSAGE_BYTES: number;
8
+ /** Template items one surface instantiates. */
9
+ export declare const MAX_TEMPLATE_ITEMS: number;
10
+ /** A data pointer's length in UTF-8 bytes. */
11
+ export declare const MAX_POINTER_BYTES: number;
12
+ /** A data pointer's token count. */
13
+ export declare const MAX_POINTER_SEGMENTS: number;
14
+ /** The issue messages, byte-identical in every core. */
15
+ export declare const LIMIT_ISSUES: {
16
+ readonly usedTwice: "id used twice; only its first place renders";
17
+ readonly depth: `nesting deeper than ${number} levels`;
18
+ readonly components: `surface: more than ${number} components; the rest is dropped`;
19
+ readonly templateItems: `template: more than ${number} items; the rest is not rendered`;
20
+ readonly messageBytes: `message larger than ${number} bytes`;
21
+ };
@@ -0,0 +1,133 @@
1
+ import type { ChildTemplate, ReduceIssue, UiNode } from "./types.js";
2
+ export { WINDOW_THRESHOLD, WINDOW_OVERSCAN } from "./layout.js";
3
+ /** The instance key of every item: the value at `keyPointer` (relative to
4
+ * the item; objects as their JSON) — `#<index>` when that value is missing,
5
+ * null, `` or a DUPLICATE of an earlier item's key (more `#`s until unique);
6
+ * without a pointer, the index. */
7
+ export declare function templateItemKeys(items: readonly unknown[], keyPointer?: string): string[];
8
+ /** Table row keys: the `rowKey` FIELD (default `id`) under the same rules
9
+ * (`#<index>` for missing, empty or duplicate). */
10
+ export declare function tableRowKeys(rows: readonly unknown[], rowKey?: string): string[];
11
+ /** A key as one instance-suffix segment: `~` → `~0`, `.` → `~1` (as JSON
12
+ * pointer escapes `/`), so dotted keys never collide across nesting levels
13
+ * (`a.b` + `c` vs `a` + `b.c`). */
14
+ export declare const instanceSegment: (key: string) => string;
15
+ export interface TemplateInstance {
16
+ /** The item's key (see `templateItemKeys`). */
17
+ key: string;
18
+ /** The item's data pointer: its scope (`/posts/3`). */
19
+ path: string;
20
+ index: number;
21
+ /** The suffix every node of the item wears: the enclosing instance's
22
+ * suffix + `.<key>`, the key escaped by `instanceSegment` (`.a` for an
23
+ * outer item, `.a.0` inside it, `.a~1b` for key `a.b`). A node's painted
24
+ * id = its id + the suffix. */
25
+ instance: string;
26
+ }
27
+ /** The items a node's `template` renders in a data scope: one per array
28
+ * item at `template.path` (relative to `scope`), keyed by `template.key`.
29
+ * `instance` = the suffix of the item the template sits in (`` at the top). */
30
+ export declare function templateInstances(data: unknown, template: ChildTemplate, scope?: string, instance?: string): TemplateInstance[];
31
+ /** A template site's key in a `TemplateBudget`: the node holding the
32
+ * template + the data scope it sits in. */
33
+ export declare const templateSiteKey: (nodeId: string, scope: string) => string;
34
+ export interface TemplateBudget {
35
+ /** Items each visited template site builds (absent = a site the walk
36
+ * never reached: it sits in an item that is not built). */
37
+ allowed: Map<string, number>;
38
+ /** ONE issue per build: the template component whose next item did not
39
+ * fit (`LIMIT_ISSUES.templateItems` or `LIMIT_ISSUES.components`); null =
40
+ * everything fits. */
41
+ issue: ReduceIssue | null;
42
+ }
43
+ /** VAPP-103: the template items ONE surface builds, in the Rust layout
44
+ * build's order (depth-first: a node's slots and static children, then its
45
+ * template items, each item's own subtree, nested items included, before
46
+ * the next item). The build holds `maxComponents` nodes: it starts at the
47
+ * reduced root tree's own nodes (children + slots; template definitions
48
+ * aside), and every item costs 1 against `maxTemplateItems` AND its
49
+ * template subtree's nodes. The first item that does not fit either budget
50
+ * and every later one is not built, with ONE issue on that template
51
+ * component. A windowed List (more than `WINDOW_THRESHOLD` rows) mounts
52
+ * its rows on demand: its items are not counted up front. Iterative. */
53
+ export declare function templateBudget(root: UiNode, data: unknown, templateNode: (componentId: string) => UiNode | undefined): TemplateBudget;
54
+ /** Start offsets of items laid end to end on one axis with `gap` between
55
+ * them (a `divided` list adds `$control.hairline` to the gap; the divider
56
+ * is centred in it): `offsets[i]` = where item i starts, `offsets[count]` =
57
+ * the content length. */
58
+ export declare function itemOffsets(extents: readonly number[], gap?: number): number[];
59
+ /** Every item's extent on the list's axis: a measured item keeps its
60
+ * extent; an unmeasured one (`null`) takes the MEAN of the measured
61
+ * extents once any item is measured (the content length stays stable while
62
+ * rows measure in, so a fling lands on the real end), else `row` (the
63
+ * theme's `$control.row`). */
64
+ export declare function itemExtents(measured: readonly (number | null | undefined)[], row: number): number[];
65
+ export interface WindowRange {
66
+ /** First rendered item. */
67
+ start: number;
68
+ /** One past the last rendered item. */
69
+ end: number;
70
+ /** Space before `start` / after `end - 1` (the spacers). */
71
+ before: number;
72
+ after: number;
73
+ /** The content length. */
74
+ total: number;
75
+ }
76
+ /** The items to render for a viewport `[scroll, scroll + viewport)` on the
77
+ * list's axis (both relative to the list's content start; a list without a
78
+ * bounded size windows against its nearest scrolling ancestor or the host
79
+ * viewport, translated into this frame): every item that intersects it
80
+ * (an item ending exactly at the viewport start still counts) plus
81
+ * `overscan` items on each side. Unmeasured items take `itemExtents`'s
82
+ * estimate (the caller's extents). `offsets` = `itemOffsets(extents, gap)` when the
83
+ * caller caches it (recompute only when an extent changes): the window is
84
+ * then two binary searches, O(log n) per scroll frame. */
85
+ export declare function virtualWindow(extents: readonly number[], gap: number, scroll: number, viewport: number, overscan?: number, offsets?: readonly number[]): WindowRange;
86
+ export type ScrollAlign = `start` | `center` | `end` | `nearest`;
87
+ /** The scroll offset that brings item `index` into a viewport of length
88
+ * `viewport` currently at `scroll` (the `scrollToIndex` command): `start` =
89
+ * its start at the viewport start (after `inset`, the pinned header's
90
+ * extent), `end` = its end at the viewport end, `center` = centred,
91
+ * `nearest` (default) = the smallest move that shows it whole (none when it
92
+ * already is). Clamped to `[0, max(0, total - viewport)]`. `offsets` = the
93
+ * cached `itemOffsets`, as for `virtualWindow`. */
94
+ export declare function scrollOffsetForIndex(extents: readonly number[], gap: number, index: number, viewport: number, scroll: number, align?: ScrollAlign, inset?: number, offsets?: readonly number[]): number;
95
+ export interface ListSection {
96
+ /** The `sectionBy` value its items share (as `displayString`; `` for
97
+ * missing). */
98
+ value: string;
99
+ /** Index of the section's first item in the data. */
100
+ start: number;
101
+ count: number;
102
+ }
103
+ /** Consecutive template items with the same `sectionBy` value (a pointer
104
+ * relative to each item) form a section; the data order is kept (sort the
105
+ * data to group it). */
106
+ export declare function listSections(items: readonly unknown[], sectionBy: string): ListSection[];
107
+ /** The flat ROW list a sectioned list windows: a header row before each
108
+ * section's items (`{header: sectionIndex}` / `{item: dataIndex}`). */
109
+ export declare function sectionRows(sections: readonly ListSection[]): ({
110
+ header: number;
111
+ } | {
112
+ item: number;
113
+ })[];
114
+ /** `scrollToIndex` on a SECTIONED list: the DATA index → its flat row
115
+ * (`sectionRows`; -1 = absent → no move), then `scrollOffsetForIndex` over
116
+ * the rows' extents with `inset` = the extent of the item's own section
117
+ * header when headers are sticky (it pins over the item), else 0. */
118
+ export declare function scrollOffsetForItem(rows: readonly ({
119
+ header: number;
120
+ } | {
121
+ item: number;
122
+ })[], rowExtents: readonly number[], gap: number, dataIndex: number, viewport: number, scroll: number, align?: ScrollAlign, stickyHeaders?: boolean, offsets?: readonly number[]): number;
123
+ /** The sticky header at a scroll offset: the LAST header row starting at or
124
+ * before `scroll` is pinned at the viewport start — pushed back by the next
125
+ * header as it arrives (its offset = min(scroll, nextHeaderStart −
126
+ * extent)). `rowOffsets` = itemOffsets of the flat rows; `headerRows` = the
127
+ * flat indices of the header rows, ascending. Null before the first header
128
+ * reaches the viewport start. Binary search: O(log headers). The pinned header is rendered even when the
129
+ * window does not contain it. */
130
+ export declare function stickyHeader(rowOffsets: readonly number[], rowExtents: readonly number[], headerRows: readonly number[], scroll: number): {
131
+ row: number;
132
+ offset: number;
133
+ } | null;
@@ -0,0 +1,22 @@
1
+ export declare const DEFAULT_LOCALE: string;
2
+ export interface LocaleParts {
3
+ language: string;
4
+ region: string | null;
5
+ }
6
+ /** `pt-BR` → {pt, BR}; `zh-Hant-TW` → {zh, TW}; `de` → {de, null}. The
7
+ * region = the first 2-letter or 3-digit subtag after the language; a
8
+ * deprecated language code is normalised (`iw` → `he`, `ji` → `yi`, `in` →
9
+ * `id`: `languageAliases`). */
10
+ export declare function parseLocale(locale: string): LocaleParts;
11
+ /** The region a locale's data comes from: its own, else the language's
12
+ * likely region (CLDR likelySubtags), else null. */
13
+ export declare function localeRegion(locale: string): string | null;
14
+ /** The first day of the week, 0 = Sunday … 6 = Saturday. */
15
+ export declare function weekStart(locale: string): number;
16
+ /** `rtl` for the right-to-left languages, else `ltr`. */
17
+ export declare function textDirection(locale: string): `ltr` | `rtl`;
18
+ /** The directional glyphs (icons.json names) a painter mirrors under rtl. */
19
+ export declare const RTL_MIRRORED_ICONS: readonly string[];
20
+ /** True when `icon` is drawn mirrored (scaleX(-1), outermost) in this
21
+ * direction. */
22
+ export declare function mirrorsInRtl(icon: string, direction: `ltr` | `rtl`): boolean;
@@ -0,0 +1,29 @@
1
+ import { isDynamic, truthy } from "./expr.js";
2
+ import type { ExtensionDef, MacroChild, ReduceIssue, UiNode } from "./types.js";
3
+ /** The breakpoint names in ascending order (tokens.json). */
4
+ export declare const BREAKPOINTS: readonly string[];
5
+ /** `{base, sm?, md?, lg?, xl?}`: an object with `base` and only breakpoint
6
+ * keys besides. */
7
+ export declare function isResponsiveValue(value: unknown): value is Record<string, unknown> & {
8
+ base: unknown;
9
+ };
10
+ /** The value a responsive prop takes at a breakpoint: the nearest defined
11
+ * key at or below it, `base` under the first one. `null` = the base. */
12
+ export declare function responsiveAt(value: Record<string, unknown> & {
13
+ base: unknown;
14
+ }, breakpoint: string | null): unknown;
15
+ /** The author's props with every responsive object replaced by its value at
16
+ * `breakpoint`. */
17
+ export declare function propsAt(props: Record<string, unknown>, breakpoint: string | null): Record<string, unknown>;
18
+ /** The normalized tree with every macro (core + extensions) expanded into
19
+ * natives, recipes attached. Pure: the input is not mutated; expansion
20
+ * problems (an author function that replaces a `$set` write) are pushed to
21
+ * `options.issues` when given. */
22
+ export declare function expandMacros(root: UiNode, options?: {
23
+ extensions?: readonly ExtensionDef[];
24
+ issues?: ReduceIssue[];
25
+ }): UiNode;
26
+ /** True for a value the expander would keep (see expr.ts). */
27
+ export declare const keeps: typeof truthy;
28
+ export { isDynamic };
29
+ export type { MacroChild };
@@ -0,0 +1,27 @@
1
+ export declare const OVERLAY_OFFSET = 4;
2
+ export declare const OVERLAY_PADDING = 8;
3
+ export type OverlaySide = `top` | `right` | `bottom` | `left`;
4
+ export type OverlayAlign = `start` | `center` | `end`;
5
+ export interface Rect {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+ export interface Size {
12
+ width: number;
13
+ height: number;
14
+ }
15
+ export interface OverlayPlacement {
16
+ x: number;
17
+ y: number;
18
+ side: OverlaySide;
19
+ /** True when the preferred side was swapped for its opposite. */
20
+ flipped: boolean;
21
+ }
22
+ export declare function placeOverlay(anchor: Rect, size: Size, viewport: Size, options?: {
23
+ side?: OverlaySide;
24
+ align?: OverlayAlign;
25
+ offset?: number;
26
+ padding?: number;
27
+ }): OverlayPlacement;