@metamorph-labs/polymorph-svelte 0.0.0-stage → 1.0.16

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 (59) hide show
  1. package/CHANGELOG.md +793 -0
  2. package/LICENSE +21 -0
  3. package/README.md +86 -2
  4. package/dist/conventions/Held.svelte +79 -0
  5. package/dist/conventions/Held.svelte.d.ts +46 -0
  6. package/dist/conventions/PageTransition.svelte +108 -0
  7. package/dist/conventions/PageTransition.svelte.d.ts +25 -0
  8. package/dist/conventions/PageTransitions.svelte +92 -0
  9. package/dist/conventions/PageTransitions.svelte.d.ts +11 -0
  10. package/dist/conventions/Portal.svelte +28 -0
  11. package/dist/conventions/Portal.svelte.d.ts +15 -0
  12. package/dist/conventions/Render.svelte +29 -0
  13. package/dist/conventions/Render.svelte.d.ts +7 -0
  14. package/dist/conventions/SlotOutlet.svelte +22 -0
  15. package/dist/conventions/SlotOutlet.svelte.d.ts +16 -0
  16. package/dist/conventions/SnippetHost.svelte +12 -0
  17. package/dist/conventions/SnippetHost.svelte.d.ts +12 -0
  18. package/dist/conventions/attributes.d.ts +24 -0
  19. package/dist/conventions/attributes.js +139 -0
  20. package/dist/conventions/control-ref.svelte.d.ts +16 -0
  21. package/dist/conventions/control-ref.svelte.js +15 -0
  22. package/dist/conventions/direction.svelte.d.ts +10 -0
  23. package/dist/conventions/direction.svelte.js +17 -0
  24. package/dist/conventions/effects.svelte.d.ts +39 -0
  25. package/dist/conventions/effects.svelte.js +82 -0
  26. package/dist/conventions/media.svelte.d.ts +17 -0
  27. package/dist/conventions/media.svelte.js +17 -0
  28. package/dist/conventions/mode.svelte.d.ts +18 -0
  29. package/dist/conventions/mode.svelte.js +25 -0
  30. package/dist/conventions/page-transitions.svelte.d.ts +33 -0
  31. package/dist/conventions/page-transitions.svelte.js +22 -0
  32. package/dist/conventions/render.d.ts +16 -0
  33. package/dist/conventions/render.js +6 -0
  34. package/dist/conventions/server.d.ts +16 -0
  35. package/dist/conventions/server.js +36 -0
  36. package/dist/conventions/slotted.svelte.d.ts +104 -0
  37. package/dist/conventions/slotted.svelte.js +542 -0
  38. package/dist/conventions/states.d.ts +23 -0
  39. package/dist/conventions/states.js +1 -0
  40. package/dist/conventions/theme-values.svelte.d.ts +23 -0
  41. package/dist/conventions/theme-values.svelte.js +40 -0
  42. package/dist/conventions/toast.svelte.d.ts +32 -0
  43. package/dist/conventions/toast.svelte.js +22 -0
  44. package/dist/icon/BrandMark.svelte +45 -0
  45. package/dist/icon/BrandMark.svelte.d.ts +26 -0
  46. package/dist/icon/Glyph.svelte +38 -0
  47. package/dist/icon/Glyph.svelte.d.ts +21 -0
  48. package/dist/icon/Icon.svelte +51 -0
  49. package/dist/icon/Icon.svelte.d.ts +17 -0
  50. package/dist/icon/glyphs.d.ts +14 -0
  51. package/dist/icon/glyphs.js +713 -0
  52. package/dist/icon/icon.module.css +34 -0
  53. package/dist/index.d.ts +54 -0
  54. package/dist/index.js +55 -0
  55. package/dist/motion/index.d.ts +14 -0
  56. package/dist/motion/index.js +10 -0
  57. package/dist/motion/presence.svelte.d.ts +76 -0
  58. package/dist/motion/presence.svelte.js +292 -0
  59. package/package.json +41 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,793 @@
1
+ # @polymorph/svelte
2
+
3
+ ## 1.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [2f0ddd2]
8
+ - @polymorph/engine@1.0.16
9
+
10
+ ## 1.0.15
11
+
12
+ ### Patch Changes
13
+
14
+ - @polymorph/engine@1.0.15
15
+
16
+ ## 1.0.14
17
+
18
+ ### Patch Changes
19
+
20
+ - 9b60a94: **`ScatterChart` reports nothing where it draws no point.** A row whose x, y or bubble value is
21
+ `null` draws no point for that series. The arrow keys still reach that position, and the live
22
+ region still says it, but Enter, Space and a click there no longer call `onSelect`. Before, they
23
+ called it with `{ index, key, datum }` for a point the plot did not draw. An agent does not list
24
+ such a position among the chart's `items`, and its `choose` refuses one. The engine's
25
+ `scatterChartSelection` returns `null` there, as `heatmapSelection` does at an absent cell.
26
+
27
+ **`BarChart` reports nothing at a walked bar that is not drawn.** With the reading walked to one
28
+ series (Up and Down) at a band where that series' value is `null`, Enter, Space or a click called
29
+ `onSelect` for a bar the plot does not draw. `barChartSelection` returns `null` there. A whole-band
30
+ reading reports the band as before.
31
+
32
+ **An agent action names the list it chooses among.** The agent fence's grammar has an optional
33
+ clause, `action <name> <id|ids> among <state> …`, which names the `choices` state whose choices
34
+ the argument names. A handle's action may carry it (`{ argument: 'id', among: 'series', run }`),
35
+ and so may a description's `agent` block, which every renderer hands to `agentMember` as written.
36
+ With `among`, the bridge checks the value, and whether a choice is marked destructive, against
37
+ that state's choices only, and refuses an id of another list with `invalid-value`. The snapshot
38
+ lists it beside the argument (`{ name: 'toggle', argument: 'id', among: 'series' }`). Without it
39
+ nothing changes, and no existing fence, handle or description changes meaning.
40
+
41
+ - `pnpm registry` fails on `among` on an action that takes no id, on `among` naming a state that
42
+ is not one of the fence's `choices` states, and on an `id` or `ids` action with no `among` in a
43
+ fence that declares more than one `choices` state.
44
+ - The staleness law holds the React member's and the description's `among` to the fence's.
45
+ - The agent conformance law draws an action's probe from the state it chooses among, checks that
46
+ the snapshot lists the same `among`, and checks that an id of another `choices` state is
47
+ refused and changes nothing.
48
+
49
+ **An agent hides and shows a chart's series with its legend.** `AreaChart`, `BarChart`,
50
+ `LineChart`, `RadarChart` and `ScatterChart` draw a legend whose keys hide and show a series. An
51
+ agent now reads them as two states and runs one action, in every web framework:
52
+
53
+ - `series` lists the legend's keys in the legend's order, each `{ id, label }`: the id is the
54
+ series' `key`, and the label is what its key says. `hidden` lists the ids of the series now
55
+ hidden. A chart with one series draws no legend, so both are empty there.
56
+ - `toggle` takes the id of one of `series` (`among series`) and presses its key with the key's own
57
+ click, as a person does, so the chart refits its domains as it does for a person.
58
+ - `choose` takes the id of one of `items` (`among items`), so a series' id is refused there, and
59
+ a mark's id is refused by `toggle`.
60
+ - Such a chart is listed for an agent while a person has something to operate in it: `onSelect`,
61
+ or a legend. A chart with a legend and no `onSelect` is listed now, with `items` empty and
62
+ `choose` refused, where before it registered nothing. `DonutChart` and `Treemap` draw a legend
63
+ that only labels, so nothing changes for them.
64
+
65
+ The engine exports `chartSeries`, `chartHiddenSeries` and `toggleChartSeries`, which read a
66
+ chart's legend keys from its element and press one, for every renderer, and the types
67
+ `ChartSeriesChoice` and `ChartLegendSeries`; each web framework's foundation re-exports them.
68
+
69
+ **An agent brushes a range on a `LineChart` or an `AreaChart`.** A chart with `onBrushEnd` on an
70
+ x it brushes (`time` or `linear` for `LineChart`, `time` for `AreaChart`) has a brush, and an agent
71
+ now reads and uses it through the machine a person's keys drive:
72
+
73
+ - `range-start` and `range-end` are the range a person sees drawn, in rows, the unit `position`
74
+ uses: the row the range was begun on and the row it ends on, or `null` while there is none.
75
+ - `brush` takes the row the range ends on, presses Shift and the arrow toward it once per row,
76
+ as a person does, and commits with Enter, so `onBrushEnd` receives what a person's committed
77
+ range reports. The range starts where a person's would: at the start of a range a person has
78
+ begun, else at the reading position, which `read` sets, else at an end of the chart.
79
+ - A chart without a brush lists both states as `null`, and `brush` throws, saying why. A number
80
+ that is not a row, and a range of one row, are refused too.
81
+ - A chart with a brush is listed for an agent with no `onSelect` and no legend.
82
+
83
+ The engine exports `chartRange` and `brushChartRange`, and the types `ChartRange` and
84
+ `ChartRangeSource`; each web framework's foundation re-exports them. `LineChart` and `AreaChart`
85
+ have a states fixture entry `brushable`.
86
+
87
+ - Updated dependencies [9b60a94]
88
+ - @polymorph/engine@1.0.14
89
+
90
+ ## 1.0.13
91
+
92
+ ### Patch Changes
93
+
94
+ - d84171d: An agent on a running page can read and operate the mounted members through an API, instead of
95
+ clicking or reading screenshots. A member's spec declares what an agent may read and do in an
96
+ `## Agent` section, and nothing else grants access. The bridge is opt-in: a page that does not
97
+ import `@polymorph/engine/agent` does not ship it. `docs/agents.md` describes the bridge for an
98
+ application and the section for a member's author.
99
+
100
+ **The bridge.**
101
+
102
+ `@polymorph/engine/agent` is a new entry point. `createAgentBridge({ confirm, policy, settleMs })`
103
+ returns a bridge with `snapshot()`, `query({ name, text, member })`, `act(steps)`,
104
+ `subscribe(listener)`, `acting` and `dispose()`.
105
+
106
+ - An action the spec does not declare is refused, and the error lists the actions that are
107
+ allowed.
108
+ - A secret value is reported as `{ secret: true }`, and so is any value that holds the text of a
109
+ password field.
110
+ - An action of a destructive instance runs only after `confirm` resolves true. Without a
111
+ `confirm`, it is refused.
112
+ - A policy can hide a member or deny an action. It cannot add either.
113
+ - A member is listed only while its element is in the document, so a closed Dialog, Drawer,
114
+ Popover or ConfirmDialog is not listed, and a step on it answers `unknown-member`. A member in
115
+ content marked `hidden` is not listed either, so a closed panel a renderer keeps in the
116
+ document gives an agent what a removed one does. A step that removes its member's element
117
+ still reports what changed.
118
+ - Each member carries `description`, the text of the elements its control names with
119
+ `aria-describedby`, such as a field's hint and error, when there is any. `query`'s `text`
120
+ matches it. A member that holds a secret, or a password field, gives none.
121
+ - A step that succeeds dispatches `polymorph:agentchange`, bubbling, on the element its member
122
+ names after the step, else on the one it named before if that is still in the document, else
123
+ on the document, with `detail: { id, member, action, changed, source: 'agent' }`, and
124
+ `bridge.acting` is true while its action runs, so a handler can tell an agent's change from a
125
+ person's.
126
+ - `agentTools(bridge)` returns the bridge as three tools, `polymorph_snapshot`,
127
+ `polymorph_query` and `polymorph_act`, for an application's own agent.
128
+ `registerWebMCP(bridge)` registers them with the browser's WebMCP API on
129
+ `document.modelContext` or `navigator.modelContext` and returns the function that unregisters
130
+ them. Where the API is absent it does nothing.
131
+
132
+ **Registration.**
133
+
134
+ `agentMember(handle)`, `agentFill(element, text)` and `agentPress(element)` are new exports of
135
+ `@polymorph/engine` and of every foundation, with the types `AgentHandle`, `AgentAction`,
136
+ `AgentArgumentType` and `AgentArgumentValues`. A member registers a handle while it is mounted.
137
+ `useAgentMember(handle)` in `@polymorph/react` registers a React member on mount, removes it on
138
+ unmount and calls the latest render's closures; `useAgentMember(handle, { unless })` registers
139
+ nothing while `unless` is true. The engine and every foundation also export
140
+ what several renderers share: `menuChoices`, `chooseMenuEntry`, `menubarChoices` and
141
+ `chooseMenubarEntry`; `railDestinations`, `currentRailDestination` and `goToRailDestination`,
142
+ which read an AppShell's destinations from its navigation in the document and press one, with
143
+ the types `RailClasses` and `RailDestination`; `listItems`, `currentListItem` and
144
+ `chooseListItem`, which read a List's items from its list in the document and press one, with
145
+ the type `ListItemChoice`; `jsonTreeBranches`, `jsonTreeExpanded` and `setJsonTreeBranch`, which
146
+ read a JsonTree's branches from its toggles by their JSON Pointer and press one, with the type
147
+ `JsonTreeBranch`; `chartMarks`, `chartPosition`, `readChartPosition` and `chooseChartMark`,
148
+ which read a window of at most `CHART_MARK_CAP` of a chart's marks through its reading, read and
149
+ move the reading's position, and pick a mark as Enter does, with the types `ChartMarkChoice`,
150
+ `ChartMarkReading` and `ChartMarkSource`; a
151
+ Table's sortable headers and its sort
152
+ (`tableSortColumns`, `tableSort`, `pressTableSort`); the notices of the toast store and an answer to
153
+ one (`toastNotices`, `toastDetails`, `dismissToastNotice`, `actOnToastNotice`); and the readers of
154
+ the text an agent sets on a date or duration field (`agentDate`, `agentDateTime`, `agentTime`,
155
+ `agentMonth`, `agentDateRange`, `agentDuration`).
156
+
157
+ A handle may give `withholds`, the element or elements whose registered members are not an
158
+ agent's. The bridge lists, matches and runs none of them, the policy cannot list them, and the
159
+ member is listed in their place. A member that holds a secret withholds its own element.
160
+
161
+ A custom element of `@polymorph/elements-ui` renders its Solid member, so the member inside it
162
+ registers too, and a page that builds the elements with a bundler creates a bridge as any
163
+ application does. A page with no build loads the bridge with `loadAgentBridge`, which
164
+ `polymorph.js` and `polymorph-all.js` export: it resolves to `@polymorph/engine/agent`, built with
165
+ the elements so it reads the registry they write to, and `polymorph.js` fetches it as a chunk of
166
+ its own on the first call.
167
+
168
+ **Registering before the bridge loads.**
169
+
170
+ `@polymorph/engine/webmcp` is a new entry point, an addition that changes no existing one, and
171
+ holds none of the bridge. `registerWebMCPOnCall(load, options)` registers the three tools with the
172
+ browser's WebMCP API at once, and on the first call of any of them calls `load`, a dynamic import
173
+ of `@polymorph/engine/agent`, once, and creates the bridge with `options`. A load that fails
174
+ resolves the call to `{ error: { code: 'failed', message } }`, and the next call loads again.
175
+ `applyAgentSetting(value)` and `AGENT_ATTRIBUTE` (`data-agent`) do what a page's agent setting
176
+ says: nothing without one, `on-call` as `registerWebMCPOnCall`, and `eager`, which loads the
177
+ bridge at once; another value warns, and without a WebMCP API neither registers nor loads
178
+ anything. `agentTools` and the new registration read one list of the tools' names, titles,
179
+ descriptions, schemas and hints.
180
+
181
+ One registration of the tools stands on a page at a time. While one does, a second
182
+ `registerWebMCP`, a `registerWebMCPOnCall` or a page's setting registers nothing and warns in the
183
+ console, where before the browser refused the second registration's names without a word.
184
+
185
+ A page with no build states `<html data-agent="on-call">` or `data-agent="eager"` and writes no
186
+ script: `polymorph.js` and `polymorph-all.js` read it as they load. `polymorph init --framework
187
+ elements` names the setting in the app's `AGENTS.md`, and its example page states none.
188
+
189
+ **The members.**
190
+
191
+ These members register, in every web vocabulary. Their props, markup and defaults are
192
+ unchanged. The system card lists each one's actions and states.
193
+
194
+ - Controls: Button, AvatarButton, ProviderButton, RecordButton, SplitButton, Link, Input,
195
+ Textarea, SearchInput, NumberInput, PhoneInput, PasswordInput, OTPInput, TagInput, InlineEdit,
196
+ ColorInput, Select, Combobox, MultiSelect, TreeSelect, Checkbox, CheckboxGroup, RadioGroup,
197
+ ChoiceCard, SegmentedControl, ModeSwitch, Switch, Slider, Rating, Calendar, DatePicker,
198
+ DateRangePicker, MonthInput, TimeInput, DurationInput, FileUpload and ImageEditor. A Button
199
+ reads `pressed` as `aria-pressed` says it, and as `null` on a Button that is not a toggle, and
200
+ `expanded` as `aria-expanded` says it, and as `null` on a Button that discloses nothing.
201
+ - Overlays: Dialog, ConfirmDialog, Drawer, Popover, Lightbox, Tour, Menu, ContextMenu, Menubar,
202
+ Command, Tabs and Toast. Toast registers on its viewport, which reads the notices on screen
203
+ and dismisses one or runs its action through the toast store.
204
+ - Structure: Accordion, Collapsible, Alert, Banner, Pagination, CursorPagination, Table,
205
+ DataTable, Tree, Stepper, Carousel, FilterBar, SectionNav, TableOfContents, Breadcrumbs, List
206
+ and AudioPlayer. A Table reads its own sortable headers, and its `sort` presses a header's
207
+ control once, so its caller decides the order; the Table a DataTable draws registers nothing. A
208
+ List reads the items that navigate or are picked from its list, with the current one, and its
209
+ `choose` presses an item's link or button, so `onSelect`, `onNavigate` or the browser takes it
210
+ as a person's press; an item that is only read is not a choice.
211
+ A Card with `href` registers its stretched link, which an agent presses as a person clicks
212
+ it, and ErrorSummary lists its errors and follows one to its field with `choose`, reading its
213
+ links with List's `listItems`. A JsonTree reads its open branches and the branches a reader can
214
+ see, each by the JSON Pointer of its value, and its `expand` and `collapse` press a branch's
215
+ toggle.
216
+ - Layout: SplitPane reads its divider's position in percent, as `aria-valuenow` reports it, and
217
+ its `set` moves the divider within the bounds its floors give and commits, as a key press does.
218
+ - Charts: AreaChart, BarChart, DonutChart, FunnelChart, Heatmap, Histogram, LineChart,
219
+ RadarChart, ScatterChart and Treemap, while they have `onSelect`. `items` lists the marks the
220
+ keys reach, labelled with what the live region says there, at most `CHART_MARK_CAP` of them:
221
+ the whole positions around the reading position. `position`, which the figure shows as
222
+ `data-position`, and `count` say where the reading is and how many positions the chart has,
223
+ `read` moves the reading as Left and Right do, and `choose` moves it to a listed mark and
224
+ activates it as Enter does, so `onSelect` receives a person's payload. A chart without
225
+ `onSelect` registers nothing, and Sparkline, which takes none, never does.
226
+ - Conversation: PromptInput, ChatThread, ToolCall, ReasoningDisclosure, AttachmentChip,
227
+ ArtifactPane and ApprovalCard. AppShell registers too: an agent collapses and expands its rail,
228
+ opens and closes its drawer below the breakpoint, reads the application's destinations from
229
+ its navigation, with the current one, and goes to one by pressing its NavItem, so `onNavigate`
230
+ or the browser takes it as a person's press.
231
+
232
+ What an agent is not given:
233
+
234
+ - A password and a one-time code are secret, and no action writes them. PasswordInput's reveal
235
+ toggle is not an agent's.
236
+ - No action confirms for a person. ConfirmDialog declares `cancel` only and withholds its
237
+ confirm Button, its phrase field and the Dialog it draws. ApprovalCard declares no action and
238
+ withholds its Buttons.
239
+ - A Button with `tone="danger"`, and a `danger`-toned entry of a Menu, ContextMenu, Menubar or
240
+ SplitButton, asks a person to confirm.
241
+ - RecordButton lets an agent stop a recording and never start one. FileUpload lets an agent
242
+ remove or retry a file and never add one. AudioPlayer and ImageEditor are read only.
243
+ - CopyButton, Tooltip, HoverCard and FormField give an agent nothing, and each spec says why.
244
+ Plan and ChatMessage are not registered, so they stay server components.
245
+ Citation and SourceList are not registered either: each of their links opens a new tab,
246
+ which an agent's press cannot open, and their words are on the page.
247
+ - The Popover ColorInput draws for its picker registers nothing, and ColorInput withholds its
248
+ panel, so an agent sees one ColorInput.
249
+
250
+ A React member that passed `value` or `defaultValue` straight to its substrate now holds the
251
+ value itself and keeps the substrate controlled, controlled when the prop is given, so an
252
+ agent's action and a person's reach the same handler in both forms: Checkbox, Switch,
253
+ RadioGroup, SegmentedControl, ChoiceCard, Select, Slider, Tabs, ReasoningDisclosure and
254
+ ToolCall. A native `form.reset()` now resets a Checkbox row's state attribute too.
255
+
256
+ **The tooling.**
257
+
258
+ - `@polymorph/registry`: each member carries an `agent` field, the statements of its spec's
259
+ `agent` fence, or `null` for a member agents cannot see. `@polymorph/registry/agent` exports
260
+ the grammar, in which a `number` state reads `null` while the member holds none, as an `id`
261
+ state does, and an action may say `presses <part>`, the part whose element it presses with the
262
+ element's own click. The coverage law fails on a control or an overlay whose spec has no decided
263
+ `## Agent` section, and the staleness law on a fence the code does not match.
264
+ - `@polymorph/shells`: a description takes an `agent` block (`on` or `element`, `state`,
265
+ `actions`, `secret`, `destructive`, `withholds`), which each renderer writes as a mount effect
266
+ that registers the instance. A compound part may give the block instead, which registers under
267
+ its member's name (Toast's viewport). A member that lends its identity reads the element the member it
268
+ lends to hands back, as `borrowed`; the Solid foundation exports `BORROWED` and
269
+ `BorrowedHolder`, and the Angular foundation `BORROWED`, `BorrowedHolder`, `handBack`,
270
+ `borrowedHolder`, `lenderHolder` and `KEEPS_HOLDER`.
271
+ - `@polymorph/conformance`: the runner executes every statement of an agent fence against every
272
+ renderer, with a bridge installed; `agentConformanceLaw` holds a shell's fences, and
273
+ `conformanceLaw` calls it. `WINDOW_SIZES` lists the fixture entries the runner mounts at a
274
+ window size other than the default, through the harness's new `viewport`, so an action that
275
+ exists only below a breakpoint is checked there.
276
+ - `@polymorph/engine/testing` exports `agentRegistrations()`, every registered member's id, name
277
+ and elements, withheld ones included.
278
+ - `pnpm new:member` writes the `## Agent` section with a placeholder the coverage law refuses.
279
+
280
+ - 73837b5: `MasterDetailPage` is a new page archetype: a list of items of one kind beside the detail of the
281
+ selected one, for an inbox, a notifications page, an audit log or a file browser. It takes
282
+ `title`, `description` and `actions` as PageHeader does, the `list` (a List, Table or Tree with its
283
+ FilterBar and pagination, the selected item marked `current`) named by `listLabel`, the selected
284
+ item's `detail`, an `emptyState` for the detail pane while nothing is selected, and `backLabel`
285
+ and `onBack` for the way back on a phone. It fills AppShell's content region, as ConversationPage
286
+ does, and the list and the detail scroll on their own. At or above a 48rem page the two sit side
287
+ by side in a SplitPane; below it the page draws the list, or the detail under the way back, and
288
+ `onBack` is where the application clears its selection. Focus moves only when the element that
289
+ held it is no longer drawn. A page that draws the selected item under a table can move to it.
290
+
291
+ The engine and every foundation export `masterDetailFocus`, `masterDetailHolds` and
292
+ `MASTER_DETAIL_PART`, the focus rule every renderer's MasterDetailPage shares. The SwiftUI and
293
+ Compose contracts gain `PMMasterDetailPageProps` and its rendering protocol, and both platforms
294
+ draw the page: two panes from a 48rem page, and below it the list, or the detail under the way
295
+ back. On iOS the way back is the page's own button and no system gesture. The elements vocabulary
296
+ has it as `<poly-master-detail-page>`.
297
+
298
+ - Updated dependencies [d84171d]
299
+ - Updated dependencies [508275a]
300
+ - Updated dependencies [73837b5]
301
+ - Updated dependencies [709d7b3]
302
+ - @polymorph/engine@1.0.13
303
+
304
+ ## 1.0.12
305
+
306
+ ### Patch Changes
307
+
308
+ - 6d714a7: `clockTime(seconds, locale?)`, `spokenDuration(seconds, locale?)` and
309
+ `pauseOtherPlayers(audio)` are new exports of the engine, and of every foundation, which
310
+ re-exports the engine.
311
+
312
+ `clockTime` writes a length as a media clock: `65` is `1:05`, and from an hour on the hours come
313
+ first, `3725` is `1:02:05`. The digits are the locale's numerals. `spokenDuration` writes the
314
+ same length in the locale's words, from `Intl`'s unit names joined as a list: `65` is
315
+ `1 minute, 5 seconds` in English. Both drop the fraction of a second, and both read a value that
316
+ is not a finite length above zero as zero.
317
+
318
+ `pauseOtherPlayers` pauses every other AudioPlayer's recording in the document, in whatever
319
+ framework it is drawn. Media the application plays itself is left alone. AudioPlayer calls it
320
+ when it starts, so one recording plays at a time.
321
+
322
+ - 51e8566: `diffLines(before, after)` and `diffRuns(rows, context)` are new exports of the engine, and of
323
+ every foundation, which re-exports the engine.
324
+
325
+ `diffLines` compares two texts line by line and returns one row for each line:
326
+ `{ kind: 'same' | 'added' | 'removed', text, beforeLine?, afterLine? }`. A missing, `null` or
327
+ empty text has no lines. `\r\n` ends a line as `\n` does, and a final line ending adds no empty
328
+ line. The rows are a longest common subsequence of the lines, so the same texts always give the
329
+ same rows. Within one change, the removed lines come before the added ones. The comparison
330
+ between the lines the two texts start and end with is bounded: past `DIFF_LINES_LIMIT`
331
+ (1,000,000) old lines × new lines, every old line there is removed and every new line added.
332
+
333
+ `diffRuns` groups those rows for a reader. It keeps `context` unchanged lines beside each change
334
+ (3 by default) and returns the rest as collapsed runs, each `{ key, collapsed, rows }`. A run
335
+ collapses only when it hides two lines or more. `Infinity` collapses nothing.
336
+
337
+ `Diff` draws both. An application that needs the rows for something else, such as a count of
338
+ changed lines, calls them directly. The types are `DiffRow`, `DiffRowKind` and `DiffRun`.
339
+
340
+ - e708348: `DurationInput` is a new member in every web vocabulary: a field for a length of time, such as
341
+ a session lifetime, a retention period or a timeout. It holds whole seconds and shows them as
342
+ counts of days, hours, minutes or seconds, each a spinbutton with its unit's word beside it,
343
+ so a reader sees "7 days" where a number field labelled "(seconds)" shows 604800.
344
+
345
+ `value`, `defaultValue` and `onChange` are whole seconds, and `null` is the empty field.
346
+ `onChange` reports committed values, as NumberInput's does: an arrow key commits at once, and
347
+ typed digits commit when focus leaves the field or on Enter. `min` (0 by default) and `max`
348
+ hold every commit, and the arrows stop at them. `units` chooses the counts, days, hours and
349
+ minutes by default. The largest count shown has no ceiling, so 36 hours is lawful when hours
350
+ are the largest. An arrow carries into the next count: one minute more than 59 minutes is an
351
+ hour. A typed count stays under the next unit: 90 cannot be typed into the minutes while hours
352
+ show. A value the counts cannot write exactly is drawn rounded to the smallest unit and kept
353
+ as it was until the reader changes it. `name` posts whole seconds as a decimal string. The
354
+ unit words, the digits and each count's name come from `Intl` in `locale`, and the one word
355
+ the member writes itself, what an empty count says, is `messages.empty`. The label, the
356
+ description and the error are FormField's.
357
+
358
+ It is not TimeInput, which holds a time of day, and it has no presets: a screen that offers a
359
+ few fixed lengths uses `Select` or `RadioGroup`.
360
+
361
+ The arithmetic is new in the engine, and so in every foundation, which re-exports it:
362
+ `durationKey` (what a key does in a count), `durationSegments` (the counts a draft draws),
363
+ `durationDraft` (seconds as counts), `typeIntoDuration` and `commitDuration`, with the types
364
+ `DurationUnit`, `DurationDraft`, `DurationFieldOptions`, `DurationSegment`, `DurationKey`,
365
+ `DurationKeyResult` and `DurationMessages`.
366
+
367
+ The SwiftUI and Compose renderings are not written yet. `DurationInput` is in both platforms'
368
+ pending lists, and both contracts are generated.
369
+
370
+ - f69f55e: `followEnd(region, content, report)` and `jumpToEnd(region)` are new exports of the engine, and
371
+ of every foundation, which re-exports the engine. `ChatThread` follows its newest turn with them
372
+ in every web vocabulary, and `LogView` follows its newest line with them.
373
+
374
+ `followEnd` keeps a scroll container at its end while the element inside it grows, for as long
375
+ as the reader is at the end: within `FOLLOW_SLACK_PX` (24) of it. A reader who scrolls away is
376
+ left where they scrolled. `report` receives `{ detached, overflowing }` once at the start and
377
+ again each time either changes, and `overflowing` counts both axes. It returns the function that
378
+ stops following. Without a container, without content or without `ResizeObserver` it does
379
+ nothing. `jumpToEnd` moves the container to its end and follows again from that call, which is
380
+ what a "Jump to latest" control does.
381
+
382
+ `ChatThread`'s jump control now follows from the press, so a turn that grows in the frame
383
+ before the browser reports the jump's scroll is followed too. A thread that is wider than its
384
+ box is a tab stop, as a taller one already was.
385
+
386
+ - 766b5fd: `FunnelChart` is a new chart member in every web vocabulary: the count that survives each stage
387
+ of an ordered process, such as a signup, a checkout or a ticket from opened to resolved. It
388
+ takes `label` and `stages`, where a `FunnelStage` is `{ key, label, value }`, and the tier's
389
+ `format`, `size`, `locale`, `tooltip`, `onSelect`, `loading` and `messages`.
390
+
391
+ Each stage is one horizontal bar from the inline start, its length its value against the
392
+ largest stage, with its label in a column before it and its value and share of the first stage
393
+ after it. Between two bars it writes the share of the stage above that reached the stage below:
394
+ "62% continued". Stages are drawn as given. A stage larger than the one before it dev-warns and
395
+ is not clamped or reordered. A first stage of zero has no shares, and a stage of zero has no
396
+ step after it. The tooltip, the live region and the table twin (stage, value, share,
397
+ continued) state every number the plot has no room for. It is one series, so it has one colour
398
+ and no legend.
399
+
400
+ `funnelChartModel`, `funnelChartReadout` and `funnelChartSelection` are new exports of
401
+ `@polymorph/engine/charts`, and of every foundation, which re-exports it, with the types
402
+ `FunnelStage`, `FunnelChartInput`, `FunnelChartModel`, `FunnelPlot`, `FunnelBar` and
403
+ `FunnelText`.
404
+
405
+ `ChartMessages` has four new keys, with English defaults in `DEFAULT_CHART_MESSAGES`:
406
+ `funnelSummary`, `stageColumn`, `continuedColumn` and `continued`. A host that spreads the
407
+ defaults is unaffected. A host that writes its own whole catalog adds the four keys, because the
408
+ catalog takes all keys or none.
409
+
410
+ On iOS, `PMChartMessages` takes the same four, and `PMSpecDefault.chartMessages` gives their
411
+ English. `FunnelChart` is native on iOS and its SwiftUI rendering is not written yet: it is in
412
+ the pending list, and its contract is generated. Android marks it absent, with `Table`, as it
413
+ does every chart member.
414
+
415
+ - 982e684: `Highlight` is a new member: the parts of a text that match a search, marked. It is phrasing
416
+ content, so it sits inside a Text, a table cell or a description's detail and takes the font
417
+ around it. The app passes `text` and either `query`, one term or several, matched as written and
418
+ never as a pattern, with case folded by `locale`, or `ranges`, the `[start, end]` offsets its
419
+ search engine returned, which take the query's place. Marks that overlap or touch are one mark,
420
+ and a range is cut at the text's end. An app that printed its search engine's highlight data as
421
+ JSON, because nothing drew it, passes it here.
422
+
423
+ A mark is a `<mark>` in `warning.text` on `warning.subtle`, a pair the contrast law measures in
424
+ every pairing, at the emphasis weight, so it is marked by more than colour. A screen reader reads
425
+ the text once, as it is, and hears no mark.
426
+
427
+ `highlightRuns(text, { query, ranges, locale })` is a new export of the engine, and of every
428
+ foundation, which re-exports the engine. It returns the text as runs, `{ text, marked }`, which
429
+ every framework's Highlight draws.
430
+
431
+ The SwiftUI and Compose renderings are pending.
432
+
433
+ - 2ffb66b: `Menubar` is a new member in every web vocabulary: an application's command menus in one row, as
434
+ a desktop application's File, Edit and View. It is for an editor, a canvas or a document tool
435
+ whose commands are too many for one Menu. It is not navigation: a title never links.
436
+
437
+ `Menubar` takes `label`, which names the bar, `menus`, each a `MenubarMenu` with a `label`, Menu's
438
+ `entries` and an optional `disabled`, and `defaultOpen`, the title whose menu is open on mount.
439
+ Each menu is Menu's panel with Menu's entries, and each entry reports through its own handler, as
440
+ in Menu. The bar is one tab stop. ArrowRight and ArrowLeft move along the row in the reading
441
+ direction and stop at the ends, Home and End go to the first and the last title, and a letter
442
+ goes to the title that starts with it. ArrowDown, Enter and Space open a menu on its first entry
443
+ and ArrowUp on its last. In an open menu, ArrowRight and ArrowLeft open the neighbour's menu.
444
+ While a menu is open, the title a mouse moves onto opens its own. A long row scrolls inside its
445
+ box. Below `30rem` the bar is one Menu behind one overflow Button named by `label`, each menu a
446
+ group under its title. The member is absent on iOS and Android, where the substitute is Menu.
447
+
448
+ The engine exports the model every framework's Menubar runs: `menubarStep`, `menubarStop`,
449
+ `menubarOpens`, `menubarHandOff`, `menubarEntries`, `roveMenubar`, `menubarNeighbour` and
450
+ `menubarEdge`, with their types. Each foundation re-exports them.
451
+
452
+ In the Vue, Svelte, Solid and Angular vocabularies, a Menu's, a ContextMenu's and a SplitButton's
453
+ submenu row now takes focus when the keys highlight it, as every other row does, and closing the
454
+ submenu returns focus to its row when focus is still in the submenu, as Radix's submenu does.
455
+
456
+ - d9713d4: `monthDraft(value)`, `monthFieldValue(draft)`, `monthOutOfBounds(value, { min, max })` and
457
+ `segmentValueText(segment, locale, empty)` are new exports of the engine, and of every
458
+ foundation, which re-exports the engine. The first three read and write a month field's
459
+ `YYYY-MM` text over the segmented field's draft, and compare it with its bounds. The last is what
460
+ a segment says as its value: its text, a month's number and name (`7 – July`), or the caller's
461
+ word for an empty segment.
462
+ - 3dc5f0f: `PromptInput` takes `triggers`, in every web vocabulary: characters that open a list of the app's
463
+ suggestions, such as `@` for people and `/` for commands. A composer without `triggers` is
464
+ unchanged.
465
+
466
+ ```tsx
467
+ <PromptInput
468
+ label="Message"
469
+ onSubmit={send}
470
+ triggers={[
471
+ {
472
+ char: '@',
473
+ label: 'People',
474
+ options: people,
475
+ onSelect: (person) => mention(person.id),
476
+ },
477
+ { char: '/', label: 'Commands', at: 'start', options: commands },
478
+ ]}
479
+ />
480
+ ```
481
+
482
+ A trigger is `{ char, label, options, at?, filter?, loading?, onQueryChange?, onSelect? }`, and
483
+ an option `{ id, label, description?, icon?, insert? }`. The list opens while the caret is in a
484
+ token: the character at the start of the prompt or after whitespace (`at: 'word'`, the default),
485
+ or only as the prompt's first character (`at: 'start'`), followed by the query, which holds no
486
+ whitespace. The member filters the options by the query as Combobox does; `filter: false` shows
487
+ the app's own results, which it loads from `onQueryChange` while `loading` is set.
488
+
489
+ The prompt stays plain text. Enter, Tab or a press picks the active option: the typed token is
490
+ replaced by the option's `insert`, or by the character and the label (`@Ada Lovelace`), and a
491
+ space, and the trigger's `onSelect` is called with the option. `insert: ''` removes the token and
492
+ writes nothing, for a command the app runs at once. The composer reports picks only: an app that
493
+ sends mentions checks, when the prompt is sent, which picked options' text is still in it.
494
+
495
+ While the list is open, ArrowUp and ArrowDown move the active option. Enter does nothing while the
496
+ trigger is `loading` with no option shown, and sends the prompt when nothing matches, as with the
497
+ list closed. Escape closes the list and keeps the text; inside a Dialog the dialog stays open until
498
+ the next Escape. Focus stays in the field, which carries
499
+ `aria-autocomplete="list"`, `aria-haspopup="listbox"`, and, while the list is open,
500
+ `aria-controls` and `aria-activedescendant`. A polite live region says how many options there
501
+ are. `PromptInputMessages` gains three optional strings: `suggestions(count)`,
502
+ `loadingSuggestions` and `noSuggestions`. The list opens above the composer, or below it when the
503
+ viewport has more room below, at the composer's width at every width. It is drawn in the
504
+ composer's root, so the composer's container must not clip it. The types are `PromptTrigger` and
505
+ `PromptTriggerOption`.
506
+
507
+ A composer focused on mount by `autoFocus` now has its caret at the end of its prompt in React,
508
+ as it already had in the other vocabularies.
509
+
510
+ `promptToken(text, caret, triggers)` and `promptPick(text, token, caret, insertion)` are new
511
+ exports of the engine, and of every foundation, which re-exports the engine: the token the caret
512
+ is in, and the text and caret a pick leaves. The types are `PromptToken` and
513
+ `PromptTokenTrigger`.
514
+
515
+ The SwiftUI and Compose contracts carry `triggers`, `PMPromptTrigger` and
516
+ `PMPromptTriggerOption`, and neither rendering draws a list: an `@` or a `/` stays text in the
517
+ prompt on iOS and Android.
518
+
519
+ - 9f8c97f: `rating` is a new icon role: one mark of a score. It draws lucide's `star`, and on Apple and
520
+ Android platforms the `star` symbol. It shares the glyph with `favorite`, as `close` and
521
+ `clear` share theirs: marking a thing to keep is not scoring it, and either can change glyph
522
+ without the other. `IconRole` includes it and every foundation's `Icon` draws it. The icon
523
+ rule no longer rewrites an import of the star glyph, because two roles draw it: it reports the
524
+ import and names both. Rating draws it.
525
+ - 9f8c97f: `Rating` is a new member in every web vocabulary: a score out of a few marks, five stars by
526
+ default, that a reader sets ("Rate this answer") or reads ("Average rating: 4.3 out of 5").
527
+
528
+ Set, it is a radio group with one radio per mark, named for the value it sets ("3 stars").
529
+ `value`, `defaultValue` and `onChange` are a whole number from 1 to `max`, and `null` for no
530
+ rating. A press on the chosen mark clears it, unless the rating is required (`aria-required`,
531
+ which FormField sets). The arrows move and choose, following the document's direction, Home
532
+ and End choose the first and the last mark, and the arrows stop at the ends. `name` posts the
533
+ value. Shown (`readOnly`), it is one image named by a sentence, and it draws any value to one
534
+ decimal place, with the mark the fraction lands in part filled. `max` is 2 to 10, `size` is the
535
+ marks' icon size, and `messages` with `locale` writes the marks' names and the sentence. Filled
536
+ and empty marks differ in shape, a solid star against an outline.
537
+
538
+ It is not RadioGroup, whose options are labelled rows, and not Meter, which measures against a
539
+ limit. Thumbs up and down under a reply are two pressed Buttons.
540
+
541
+ Its model is new in the engine, and so in every foundation, which re-exports it: `ratingModel`
542
+ (the marks, their fills and names, and the shown sentence), `ratingPress` (the clear rule),
543
+ `ratingStep` and `roveRating` (the keys), `ratingMax` and `RATING_DEFAULT_MAX`, with the types
544
+ `RatingModel`, `RatingMark`, `RatingFill`, `RatingOptions`, `RatingWords` and
545
+ `RatingKeyEvent`.
546
+
547
+ The SwiftUI and Compose renderings are not written yet. `Rating` is in both platforms' pending
548
+ lists, and both contracts are generated.
549
+
550
+ - 96daa65: `record` is a new icon role: start a recording of the reader's voice. It draws lucide's `mic`,
551
+ and on Apple and Android platforms the `mic` symbol. `IconRole` includes it, every foundation's
552
+ `Icon` draws it, and the icon rule's fix names it for an import of the microphone glyph.
553
+ RecordButton draws it at rest.
554
+ - 0936316: `TableOfContents` is a new member in every web vocabulary: the list of links to the sections of
555
+ one long page ("On this page"), with the section the reader is in marked. It takes `label` (the
556
+ landmark's name, drawn above the list), `items` (`{ id, label, level? }`, where `id` is the id of
557
+ the section's element in the document and `level: 2` draws a subsection one step in, in a list
558
+ inside its section's item) and `onCurrentChange`, called with the current section's id or
559
+ `null`. Each item is a real `<a href="#id">`; the current one carries `aria-current="location"`
560
+ and the selection treatment SectionNav gives its current item.
561
+
562
+ The current section is the last one whose top has reached a line a quarter of the way down the
563
+ page that scrolls around the sections, or the last section when the page is scrolled to its end.
564
+ A click marks its item at once, holds the mark while the browser scrolls to the section, and
565
+ moves focus to the section, which takes `tabindex="-1"` only while it has focus. An item whose
566
+ section is not in the document is drawn and never marked. The member does not scroll and does
567
+ not stay in view on its own: the page's CSS owns `scroll-behavior`, and the app places the list.
568
+
569
+ It is not SectionNav, whose items are pages the router marks.
570
+
571
+ `watchSections(owner, ids, report)` and `jumpToSection(owner, id, event)` are new exports of the
572
+ engine, and of every foundation, which re-exports the engine, with `SECTION_LINE` (0.25), the
573
+ line's place as a fraction of the page's height. Every framework's TableOfContents follows the
574
+ page with them.
575
+
576
+ The SwiftUI and Compose renderings are not written yet. `TableOfContents` is in both platforms'
577
+ pending lists, and both contracts are generated, with the item's shape.
578
+
579
+ - b88e331: The theme is readable as data. `readThemeValues(element?)` in `@polymorph/engine` returns what
580
+ an element resolves a pairing's tokens to, as the values a JavaScript API takes: a colour role
581
+ as `#rrggbb` (or `rgba()` when translucent) and as channels, a space step, a radius and a control
582
+ height in pixels, a type step, a font slot, a duration in milliseconds, the colour mode the
583
+ element is drawn in and the document's reading direction. A reading is a snapshot: it keeps each
584
+ value, the mode and the direction as it first read them. An element that is not in the document
585
+ reads as the document root.
586
+
587
+ `watchTheme(listener)` calls back when the system, palette, mode, density, motion temperament,
588
+ contrast preference or direction changes, when an element enters or leaves an inverse tone, and
589
+ when a pairing's sheet is installed, installed again or removed. A tone or a mode that a member
590
+ writes for its own variant does not call back. `themeVersion()` grows with each call back and
591
+ when `watchTheme` takes its first listener, so a store that keeps a reading knows when to take
592
+ another. `UNTHEMED_VALUES` is the reading a server render gets: every colour the empty string and
593
+ every number 0.
594
+
595
+ Each foundation wraps these as `useThemeValues`: a hook in React, a `ShallowRef` in Vue, a
596
+ `current` getter in Svelte, an accessor in Solid and a signal in Angular. It is for another
597
+ library's component that cannot be styled through CSS, such as a map, a canvas grid or a code
598
+ editor, inside a `<ThirdParty>` boundary (`docs/rules.md`). A value is read where the framework
599
+ renders or in an effect. In React, Vue and Solid the render that hydrates a server's markup gets
600
+ the server's empty values, and the component gets the document's once it has hydrated. React's
601
+ hook takes a ref, reads the ref's element after each commit of the component, and renders the
602
+ component again when the element is another one. Svelte's `current` is a new reading each time it
603
+ is read outside an effect. Outside a component, Vue's follows the theme in an effect scope and
604
+ Solid's under a root.
605
+
606
+ `@polymorph/engine/runtime` also exports `cssVarName` and `MORE_CONTRAST_QUERY`. Nothing is
607
+ renamed or removed.
608
+
609
+ - 00bce31: `Tour` is a new member in every web vocabulary: a short walk through the parts of a page, one
610
+ step at a time, that a reader goes through once and can leave at any step. It takes `steps`,
611
+ where a `TourStep` is `{ id, target?, title, body, side? }`. A step names the part it points at
612
+ by the `name` of a `Tour.Target`, which the application puts around that part and which adds no
613
+ box (`display: contents`). A step with no `target`, or whose target is not drawn when it opens,
614
+ is drawn centred.
615
+
616
+ The application opens the tour (`open`, `defaultOpen`) and records that it was seen: the member
617
+ stores nothing, and `onEnd(reason)` says why the reader ended it, `finished` from the last
618
+ step's Done or `dismissed` from Escape or the close control. The step is `step`, `defaultStep`
619
+ and `onStepChange`. The words it writes itself are in `messages` (`next`, `previous`, `done`,
620
+ `close`, `position`), with English defaults.
621
+
622
+ Each step's panel is a modal dialog, named by the step's title and described by its body and
623
+ its position ("Step 2 of 3"). Focus moves to the panel when each step opens and returns to where
624
+ it was when the tour ends. The rest of the page is hidden from assistive technology and takes no
625
+ presses, and the target is cut out of the scrim. The page keeps its scroll: the target is
626
+ scrolled into view when its step opens, and the panel and the cut-out follow it.
627
+
628
+ The engine, and every foundation, which re-exports it, has five new exports for it:
629
+ `tourTarget(name)` finds a step's target, `tourTargetRect(element)` measures the boxes inside
630
+ it, `revealTourTarget(element)` scrolls it into view, `tourViewport()` is the window's size, and
631
+ `tourPlacement(target, box, viewport, side)` places a panel beside a rectangle and inside the
632
+ window. The types are `TourPlacement`, `TourRect`, `TourSide` and `TourSize`, and the attribute
633
+ a target carries is `TOUR_TARGET_ATTRIBUTE`.
634
+
635
+ - 59658db: `Treemap` is a new chart member in every web vocabulary: parts of a whole as rectangles that
636
+ tile the plot, each with an area proportional to its value, such as storage by kind or tickets
637
+ by team and channel. It takes `label` and `items`, where a `TreemapItem` is
638
+ `{ key, label, value, children? }`, and the tier's `format`, `size`, `locale`, `tooltip`,
639
+ `onSelect`, `loading` and `messages`.
640
+
641
+ The layout is squarified, largest first from the inline start, and the same items and size
642
+ always give the same tiles. An item with `children` is a group, drawn as the sum of its
643
+ children; two levels are drawn, and deeper items are summed into the second with a dev
644
+ warning. With groups, each group takes a chart slot and its items its colour, with a legend of
645
+ the groups and a wider gap between them; with one level every tile is one colour. An item with
646
+ no positive value takes no area: the twin lists it and the summary counts it. A tile shows its
647
+ label and value on a plate of the surface colour, and only where both fit; the tooltip, the
648
+ live region and the twin name every item.
649
+
650
+ `squarify`, `treemapModel`, `treemapReadout` and `treemapSelection` are new exports of
651
+ `@polymorph/engine/charts`, and of every foundation, which re-exports it, with the types
652
+ `TreemapItem`, `TreemapInput`, `TreemapModel`, `TreemapPlot`, `TreemapTile`, `TreemapPlate`,
653
+ `TreemapLeaf` and `TreemapRect`.
654
+
655
+ `ChartMessages` has three new keys, with English defaults in `DEFAULT_CHART_MESSAGES`:
656
+ `treemapSummary`, `groupColumn` and `itemColumn`. A host that spreads the defaults is
657
+ unaffected. A host that writes its own whole catalog adds the three keys.
658
+
659
+ On iOS, `PMChartMessages` takes the same three, and `PMSpecDefault.chartMessages` gives their
660
+ English. `Treemap` is adapted on iOS, drawn with SwiftUI shapes because Swift Charts has no mark
661
+ that tiles a box by area; its rendering is not written yet, so it is in the pending list, and
662
+ its contract is generated. Android marks it absent, with `Table`, as it does every chart member.
663
+
664
+ - 4902f58: The colour mode is readable and followable. `readMode()` in `@polymorph/engine/runtime` (and the
665
+ engine's root) returns `{ preference, mode }`: the preference, `light`, `dark` or `system`, and
666
+ the mode it resolves to. It returns the same object until one of the two changes.
667
+ `watchMode(listener)` calls back after each `setMode`, from any caller, and each time the
668
+ operating system's mode changes while `system` is applied. `SERVER_MODE` is the reading a server
669
+ render gets, `system` and `light`, because a server stores no preference.
670
+
671
+ Each foundation wraps these as `useMode`: a hook in React, a `ShallowRef` in Vue, a `current`
672
+ getter in Svelte, an accessor in Solid and a signal in Angular. An application's Menu or command
673
+ palette reads the preference from it to mark the current choice, and sets the mode with
674
+ `setMode`, which every foundation already re-exports. In React, Vue and Solid the render that
675
+ hydrates a server's markup gets `SERVER_MODE`, and the component reads the document once it has
676
+ hydrated.
677
+
678
+ `getModePreference()` now returns the preference the last `setMode` applied to the document, and
679
+ the stored one before any call. It used to read storage each time, so it answered `system` where
680
+ storage refuses writes, and another tab's choice where one had stored it, while the document wore
681
+ something else. `teardownTheme()` also forgets the applied preference. Nothing is renamed or
682
+ removed.
683
+
684
+ - Updated dependencies [6d714a7]
685
+ - Updated dependencies [28aeda0]
686
+ - Updated dependencies [f918ed3]
687
+ - Updated dependencies [b209e98]
688
+ - Updated dependencies [51e8566]
689
+ - Updated dependencies [e708348]
690
+ - Updated dependencies [f69f55e]
691
+ - Updated dependencies [766b5fd]
692
+ - Updated dependencies [982e684]
693
+ - Updated dependencies [2ffb66b]
694
+ - Updated dependencies [d9713d4]
695
+ - Updated dependencies [49ab024]
696
+ - Updated dependencies [b9e5208]
697
+ - Updated dependencies [3dc5f0f]
698
+ - Updated dependencies [9f8c97f]
699
+ - Updated dependencies [9f8c97f]
700
+ - Updated dependencies [96daa65]
701
+ - Updated dependencies [3b0b47f]
702
+ - Updated dependencies [0936316]
703
+ - Updated dependencies [b88e331]
704
+ - Updated dependencies [00bce31]
705
+ - Updated dependencies [59658db]
706
+ - Updated dependencies [4902f58]
707
+ - @polymorph/engine@1.0.12
708
+
709
+ ## 1.0.10
710
+
711
+ ### Patch Changes
712
+
713
+ - cb0d0a3: Members follow a right-to-left document. With `dir="rtl"` on `<html>` or `<body>`, every member built on Radix or Zag now takes that direction: its root says `dir="rtl"`, and the arrow keys, a Slider's track, a submenu's side and a Tabs strip turn with the page. Before, those members wrote `dir="ltr"` on their root and ran left to right inside a right-to-left page. A member already on the page follows a change to the attribute. There is no new prop, and a left-to-right page renders as it did.
714
+
715
+ Each foundation exports `useDirection`, which returns the document's direction and keeps it current, and `@polymorph/engine` exports `readDirection` and `watchDirection` beneath it.
716
+
717
+ The page-transition indicator's right-to-left rule now reads `dir` instead of `:dir()`, which the published build's minifier had rewritten as a list of languages.
718
+
719
+ - Updated dependencies [7019d6f]
720
+ - Updated dependencies [cb0d0a3]
721
+ - @polymorph/engine@1.0.10
722
+
723
+ ## 1.0.9
724
+
725
+ ### Patch Changes
726
+
727
+ - @polymorph/engine@1.0.9
728
+
729
+ ## 1.0.8
730
+
731
+ ### Patch Changes
732
+
733
+ - 820c836: Every package now carries the release's version, and the release tag is `v` and that version.
734
+ Until this release each package kept its own number, so one release installed the engine at one
735
+ version, the foundations at another and the tag named a third. From this release on, pin every
736
+ `@polymorph/*` package you install at the same version, and check the native packages out at the
737
+ tag of that version.
738
+
739
+ This package's version jumps to the release's number. The jump carries no change of its own: the
740
+ versions it skips were never published.
741
+
742
+ - Updated dependencies [820c836]
743
+ - Updated dependencies [e1c80b3]
744
+ - @polymorph/engine@1.0.8
745
+
746
+ ## 1.0.3
747
+
748
+ ### Patch Changes
749
+
750
+ - Updated dependencies [22f607b]
751
+ - @polymorph/engine@1.0.6
752
+
753
+ ## 1.0.2
754
+
755
+ ### Patch Changes
756
+
757
+ - 1b900d8: CursorPagination has a "Load more" form, and RelativeTime writes the moment itself as well as the distance from now.
758
+
759
+ **`CursorPagination mode="append"` is "Load more".** It draws one `outline` Button, "Load more", that calls `onNext`; the app adds the window it fetches below the ones on screen. While `pending` the Button is busy and ignores presses. When `hasNext` turns false after a press, the list has run out: the Button leaves and an end line says "No more to load" through a status region, so a screen reader hears it. The form remembers that it asked for a window and does not read `hasPrevious`, so pass your query library's flags as they are. A list with no next window that the reader has not paged renders nothing, as one window does in the default form. `position` is what is on screen in your words ("50 shown"). In a DataTable, set the pager's `pending` while the next rows load, not the table's `loading`, which replaces the rows with skeletons. A hand-built "Load more" can be replaced with `<CursorPagination mode="append" hasPrevious={false} hasNext={hasNextPage} pending={isFetchingNextPage} onNext={fetchNextPage} />`; a list started again under a new query takes a new pager (`key={query}`).
760
+
761
+ In React the props are a union on `mode`: the default form still requires `onPrevious`, so every pager written before stays valid, and the append form takes none, because it has no previous direction. In Vue, Svelte, Solid and Angular `onPrevious` is an optional event, and the default form warns in development when `hasPrevious` has no `onPrevious`.
762
+
763
+ `CursorPaginationMessages` takes two optional words, `more` and `end`; an app that localizes the pager passes them, and the append form warns in development when `messages` leaves them out. Every web framework's CursorPagination takes `mode`, and so do `PMCursorPagination` on iOS and Android.
764
+
765
+ The Svelte foundation's `Held` takes `presses`, and the Angular foundation exports `pressOnce`: a states fixture entry presses a control once it is in the document, as the append form's "the list ran out" entry presses "Load more". An app has no use for either.
766
+
767
+ `@polymorph/recipes`' `structure/cursor-pagination.module.css` lays `.pagination` out as a column (`display: inline-flex; flex-direction: column`), so the append form's end line takes a line of its own under the row; the default form's one row looks as it did. It adds `.end`, the end line, in the position's type and colour. A vendored CursorPagination takes both with the recipe.
768
+
769
+ **`RelativeTime mode="absolute"` and `mode="both"`.** `absolute` writes the moment with `Intl.DateTimeFormat` in the member's `locale`: the medium date and the short time ("Aug 4, 2026, 2:05 PM"), or with `format="long"` the long date. An instant is written in the time zone of whatever renders the member: the reader's in a browser, the server's under server rendering or in a React server component. An app that renders on a server and must show the reader's zone renders the absolute forms in the browser, from a client component once it has mounted. A calendar date (`2026-08-04`) is the date alone, the same day everywhere. `both` writes the moment and the distance joined by `messages.both`, by default the moment, then the distance in parentheses ("Aug 4, 2026, 2:05 PM (2h ago)"); a localized app passes `messages={{ both: (moment, distance) => … }}` from its catalog, so its locale orders and punctuates the two. The default stays `relative`. Replace a hand-formatted timestamp in JSX with the member, which also writes the moment in `dateTime`.
770
+
771
+ **`relativeTimePhrase` takes `mode` and `messages`.** `relativeTimePhrase(value, { locale, numeric, format, mode, messages })` from `@polymorph/engine`, which every foundation re-exports, returns the text RelativeTime renders for those props, or `null` for a value that is not a moment. Use it where a member takes app-formatted text, such as Timeline's `time`, so the words match RelativeTime's ([design/components/relative-time.md](../design/components/relative-time.md)).
772
+
773
+ **On iOS and Android**, `PMRelativeTimeProps` gains `messages`, the same `both`. **On Android**, `PMRelativeTimeWords` gains `absolute(moment, long, locale)`, which an app implements to write the moment with the platform's formatter in the reader's zone. Without it the member writes Material 3's medium date and an instant's 24-hour time in UTC, said as UTC, because the member module reaches no time zone. The words are `PMStrings.relativeUtc`, a default only Android's `PMStrings` declares, so iOS's string catalog does not carry it; an app translates it through `LocalPMStrings`.
774
+
775
+ - Updated dependencies [1b900d8]
776
+ - Updated dependencies [1b900d8]
777
+ - Updated dependencies [1b900d8]
778
+ - @polymorph/engine@1.0.5
779
+
780
+ ## 1.0.1
781
+
782
+ ### Patch Changes
783
+
784
+ - 700e130: Two new packages ship the vocabulary for Svelte 5: `@polymorph/svelte`, the foundation (the engine re-exported, the icon gateway, `Icon`, the presences with their `PresenceOptions`, the portal, the slot conventions, the toast store, the page-transition convention and `afterRender`, which runs a function after Svelte's `tick`), and `@polymorph/svelte-ui`, the members, published as `@metamorph-labs/polymorph-svelte` and `@metamorph-labs/polymorph-svelte-ui`. Each member is a Svelte 5 component generated from its framework-neutral description. It takes the React member's props by the same names (each `onFoo` callback is a callback prop `onFoo` with the same payload, `children` and each node prop a snippet, a render prop a snippet with its argument) and renders the same DOM with the same recipes from `@polymorph/recipes`. `design/frameworks/svelte.json` says which members the Svelte vocabulary ships: every member but ImageEditor, whose entry says why.
785
+
786
+ Install them under their workspace names as npm aliases, beside `svelte@^5.46.4` (`docs/consuming.md`). Both packages publish their components as source under the `svelte` export condition, and the application's Svelte compiles them, for the browser and for a server render; each member imports its own recipe from `@polymorph/recipes`, and the entry imports the base layer.
787
+
788
+ A server-rendered application has two limits. A member that reads its slot as it is made mounts the slot to read it (FormField, ChatThread and Avatar.Group read what it holds; CodeBlock, Markdown and StreamingText read its text), and a mount inside a hydration reads the server's markup as its own. So an application that renders on the server mounts its root in the browser instead of hydrating it; SvelteKit hydrates by default, so a SvelteKit app sets `export const ssr = false` on the routes that render members. And outside Vite, FormField, ChatThread, CodeBlock, Markdown and StreamingText render on the server as if their slots were empty, and so do the members built on them; under Vite the server render reads their slots first.
789
+
790
+ Every type alias `@polymorph/react-ui` exports (`BadgeTone`, `TooltipSide`, `ControlSize`, `IconRole` and the rest) is exported by the vocabulary's entry under the same name, and the foundation's types with it, so a screen the emitter writes for this framework compiles against the vocabulary alone; the few React types the vocabulary cannot carry are listed with their reasons as `UNEXPORTED_TYPES` in `packages/shells/src/common.ts`.
791
+
792
+ - Updated dependencies [700e130]
793
+ - @polymorph/engine@1.0.4