@vokril/ui-solid 0.32.0 → 0.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +71 -0
  3. package/dist/StatusBarNotificationBell-BXPtDRks.cjs +50 -0
  4. package/dist/{StatusBarNotificationBell-CgsYrrpj.js → StatusBarNotificationBell-BjD8U_1v.js} +1557 -1544
  5. package/dist/_internal/contract/browser/workspace.d.cts +15 -0
  6. package/dist/_internal/contract/browser/workspace.d.ts +15 -0
  7. package/dist/_internal/contract/menuDensity.d.cts +10 -0
  8. package/dist/_internal/contract/menuDensity.d.ts +10 -0
  9. package/dist/_internal/platform/settings/settingsTypes.d.cts +2 -2
  10. package/dist/_internal/platform/settings/settingsTypes.d.ts +2 -2
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/notifications/index.cjs +1 -1
  14. package/dist/notifications/index.js +1 -1
  15. package/dist/notifications/notificationOverlaySnapshot.d.cts +35 -6
  16. package/dist/notifications/notificationOverlaySnapshot.d.ts +35 -6
  17. package/dist/overlay/Modal.d.cts +7 -6
  18. package/dist/overlay/Modal.d.ts +7 -6
  19. package/dist/overlay/modalViewport.d.cts +2 -1
  20. package/dist/overlay/modalViewport.d.ts +2 -1
  21. package/dist/rowSource-D8gyHbEE.cjs +1 -0
  22. package/dist/{rowSource-BRGZHclZ.js → rowSource-_4IuosKj.js} +5 -0
  23. package/dist/server/{StatusBarNotificationBell-Cxs_bVKX.cjs → StatusBarNotificationBell-CLNEipLk.cjs} +19 -19
  24. package/dist/server/{StatusBarNotificationBell-CJJFE4rf.js → StatusBarNotificationBell-ek4X322Y.js} +1519 -1506
  25. package/dist/server/index.cjs +1 -1
  26. package/dist/server/index.js +2 -2
  27. package/dist/server/notifications/index.cjs +1 -1
  28. package/dist/server/notifications/index.js +1 -1
  29. package/dist/server/{rowSource-CoeHYNsV.js → rowSource-BSa7rgYJ.js} +188 -183
  30. package/dist/server/rowSource-Yw-xtlih.cjs +1 -0
  31. package/dist/server/settings/index.cjs +1 -1
  32. package/dist/server/settings/index.js +14 -12
  33. package/dist/server/tokens/menu-density/index.cjs +1 -0
  34. package/dist/server/tokens/menu-density/index.js +4 -0
  35. package/dist/server/tree/index.cjs +1 -1
  36. package/dist/server/tree/index.js +1 -1
  37. package/dist/settings/index.cjs +1 -1
  38. package/dist/settings/index.js +14 -12
  39. package/dist/solid/_internal/contract/menuDensity.js +1 -0
  40. package/dist/solid/_internal/platform/settings/settingsTypes.js +1 -0
  41. package/dist/solid/notifications/NotificationHost.jsx +3 -16
  42. package/dist/solid/notifications/notificationOverlaySnapshot.js +26 -0
  43. package/dist/solid/tokens/menu-density/index.js +1 -0
  44. package/dist/solid/tree/TreeRow.jsx +3 -1
  45. package/dist/style.css +1 -1
  46. package/dist/tokens/menu-density/index.cjs +1 -0
  47. package/dist/tokens/menu-density/index.d.cts +12 -0
  48. package/dist/tokens/menu-density/index.d.ts +12 -0
  49. package/dist/tokens/menu-density/index.js +4 -0
  50. package/dist/tree/TreeRow.d.cts +5 -4
  51. package/dist/tree/TreeRow.d.ts +5 -4
  52. package/dist/tree/descriptor.d.cts +13 -3
  53. package/dist/tree/descriptor.d.ts +13 -3
  54. package/dist/tree/index.cjs +1 -1
  55. package/dist/tree/index.js +1 -1
  56. package/dist/ui.css +1 -1
  57. package/package.json +25 -1
  58. package/dist/StatusBarNotificationBell-CNs_obmZ.cjs +0 -50
  59. package/dist/rowSource-C3zlzAtR.cjs +0 -1
  60. package/dist/server/rowSource-C1F4l0xZ.cjs +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ All notable changes to `@vokril/ui-solid` are listed here. Versions follow
5
5
  contain breaking changes. From 0.1.1 on, entries are written by Changesets
6
6
  (`npm run release:version`) above the previous release.
7
7
 
8
+ ## 0.33.1
9
+
10
+ ### Patch Changes
11
+
12
+ - A process that checks the native notification overlay's snapshot at its boundary can take the menu densities without loading solid-js. 0.33.0 added the snapshot's `menuDensity` and the list a checker holds it to, `MENU_DENSITIES`, but exported the list only from `@vokril/ui-solid/settings`, which carries the settings registry: its module graph imports `solid-js` under every export condition, so a main process validating the snapshot with a schema had to load solid-js for the list. `@vokril/ui-solid/tokens/menu-density` exports `MENU_DENSITIES` and the `MenuDensity` type, and its module graph holds no package and touches no DOM under every export condition (`solid`, `node` import and require, `import`, `require`). `@vokril/ui-solid/settings` keeps exporting both, unchanged, and the two entries hand out the same array: the list keeps its one home in the kit's contract. A build test walks each condition's module graph, reads the subpath's declarations for the names they export, imports and requires the subpath in a plain Node process, holds its list to be the very array `/settings` exports, and shows the walk finding `solid-js` in `/settings` (`tests/menu-density-subpath.test.mjs`). The palette subpath's test shares the walk (`tests/fixtures/subpath-graph.mjs`), reads its declarations and shows the walk's finds in `/tokens` the same way. The walk now reads each built file with TypeScript's parser: a pattern match lost an import that followed a `//` inside a string on a minified line. The test that imports every entry through the `node` condition takes the entries from `scripts/entries.mjs`. The README's entry table lists the subpath, and its notification overlay section names it for a schema that checks the snapshot.
13
+
14
+ ## 0.33.0
15
+
16
+ ### Minor Changes
17
+
18
+ - The native notification overlay's snapshot carries the host window's run-time appearance, not every computed custom property of its root. `NotificationHost` read its root's computed style and sent each `--*` in it as `cssVariables` (`NotificationOverlayState`), so the values that belong to the host's own window went along and, written inline on the overlay page's root, overrode the overlay page's own: the title bar inset of the kit's `Modal` contract (`--modal-maximize-inset`, `0px` for a page without a title bar — the overlay window got the host's `2.2rem`), the host's title bar height and its zoom factor. A token derived from such a value arrives computed, so a consumer cannot filter it out by name; only the host's realm tells a run-time input from a stylesheet's output. `cssVariables` now holds the custom properties written inline on the host's root (`root.style`) — what the host writes while it runs: a palette, the user's fonts, a scrollbar style —, and the overlay page derives every other token from the stylesheets it loads. The reference's auxiliary windows take the same kind of input, never computed values: they clone the main window's stylesheets and copy every attribute of its root (`workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.ts:452-547`, `:561`; `base/browser/dom.ts:2443-2475`); the snapshot carries a part of them — the root's inline custom properties and its menu density. `fontFamily`, `fontSize` (the overlay's rem base) and `theme` are read as before.
19
+
20
+ The menu density travels as a typed field: `menuDensity` (`MenuDensity`), the root's `data-menu-density`, left out when the root names none of `MENU_DENSITIES` — a new export of `@vokril/ui-solid/settings` that `MenuDensity` is now derived from, and that a build test holds to the token sheet's density rules (`tests/menu-density.test.mjs`). The host reads the appearance again when that attribute changes; it watched `class`, `style`, `data-theme` and `data-palette` only, and a density change sent nothing. Measured on a host's overlay page in eight states (the default design's dark and light themes, the two high-contrast themes, a user font at 18px, the compact density, a colour-blind palette, a zoom of 1.5): the inline custom properties and the density keep the cards and the open gear menu identical to the computed snapshot, and the overlay's root keeps its own `0px` title bar inset; the inline properties without the density changed the compact gear menu. A component test mounts a root whose stylesheet sets `--modal-maximize-inset` and a static token, with custom properties inline: the snapshot carries the inline ones only, follows them as the host writes and removes them, carries `menuDensity` `compact`, a new snapshot with `sparse` when the attribute changes, and no density for a value the kit does not know (`tests/components/notification-overlay-appearance.test.tsx`). The README has a section on the overlay page; `Modal`'s `maximizeInset` and `modalTitlebarHeight` now ask a host for `--modal-maximize-inset` in a stylesheet rule, not inline on the root.
21
+
22
+ **Breaking:** an overlay page that loads no stylesheets no longer gets the static tokens from the snapshot. The page loads the kit's `theme.css` and the token sheets the host loads, writes `cssVariables` inline on its root and removes those a later snapshot no longer carries, writes `menuDensity` as its root's `data-menu-density` (and removes it when a snapshot has none), and sets the values of its own window itself (`--modal-maximize-inset: 0px`). Every custom property written inline on the host's root is carried, so the host keeps a value that belongs to one window out of the root's inline style (a stylesheet rule). The theme's root markers (`data-app-theme`, `data-design`) are not carried — the kit's sheets key the root's `color-scheme` on them —, so under a theme of the Vokril design the overlay's cards no longer get the design's own tokens (its corners, font and surfaces: about thirty tokens and those that derive from them); under the default design's and the high-contrast themes those tokens are the ones the overlay's root gets anyway. A host that wants them in the overlay writes them inline on its root, where the snapshot carries them. A copy of `NotificationOverlayState` kept outside the kit — a host's contract, a schema that checks the snapshot at a process boundary — adds `menuDensity`.
23
+ - A tree descriptor can name a row: `TreeRowDomProps` — what `rowProps` returns for a row — takes `ariaLabel`, the row's accessible name, which `TreeSurface` writes as the row's `aria-label`, as the reference's list writes the label its accessibility provider gives a row (`base/browser/ui/list/listWidget.ts:890`, `:1313-1335`). A row is named by its content; one that shows no text — a placeholder that loads the next page as it scrolls into view — had no name (axe: `aria-treeitem-name`), and its surface had no way to give it one. The name is `t()`-d like every text a descriptor gives. Left out or empty, the row has no `aria-label`, as before — the reference's list removes an empty label the same way —; the label follows the descriptor as it changes, and a mounted row that comes to show another row (the rows render by index) drops it. A sticky clone of the row does not restate it: a clone restates nothing of the real row's identity, and its generic element may not be named. A component test renders a named placeholder (axe passes) beside rows given no name, an empty name (no `aria-label`; axe reports the treeitem without a name), a changing name, a mounted row taken over by the next page's commit, and the clone (`tests/components/tree-row-name.test.tsx`).
24
+
8
25
  ## 0.32.0
9
26
 
10
27
  ### Minor Changes
package/README.md CHANGED
@@ -194,6 +194,7 @@ Every subpath has ESM, CommonJS, type declarations, a server build and a Solid s
194
194
  | `/a11y` | AriaAnnouncer and the announcement helpers |
195
195
  | `/tokens` | ThemeProvider, `useTheme`, `applyAppTheme`, the palettes and their derivation |
196
196
  | `/tokens/palette` | The palette's contract alone — `THEME_PALETTE_TOKENS`, `isThemePaletteColor`, the `ThemePalette` type — with no package and no DOM in its module graph, for code that checks a palette outside a window (a main process, a worker); `/tokens` exports the same |
197
+ | `/tokens/menu-density` | The menu densities alone — `MENU_DENSITIES`, the values of a root's `data-menu-density` the token sheet styles, and the `MenuDensity` type — with no package and no DOM in its module graph, for code that checks a density at a process boundary (a main process validating the [notification overlay](#the-native-notification-overlay)'s snapshot); `/settings` exports the same |
197
198
  | `/i18n` | `t`, `setLocale`, `setMessages`, language registry |
198
199
  | `/settings` | The settings registry the kit and its host share: `defineSettings`, field specs, the kit's own groups (notifications, header icon overrides) |
199
200
  | `/host` | The ports an application plugs into the kit (see [Embedding in an application](#embedding-in-an-application)) |
@@ -236,6 +237,9 @@ const surface = createTreeSurface({
236
237
  vanishing above the viewport keep the visible rows in place.
237
238
  - `surface.cursorRow()` is the row under the cursor; `controller.focusKey(key)` and
238
239
  `controller.selectKey(key, modifier)` address a row by key.
240
+ - A row is named by its content. One that shows no text — a placeholder that loads the next page as it
241
+ scrolls into view — takes its accessible name from `rowProps`: `ariaLabel` (a `t()`-d string) becomes the
242
+ row's `aria-label`; left out or empty, the row has none. A sticky clone of the row does not restate it.
239
243
  - Very long lists scroll past the browser's element-height limit: the container is capped and positions
240
244
  map proportionally (`createVirtualWindow`).
241
245
 
@@ -255,6 +259,11 @@ modal layer:
255
259
  }
256
260
  ```
257
261
 
262
+ The value is the window's own: set it in a stylesheet rule, as above, not inline on the root. The
263
+ root's inline custom properties are the run-time appearance the native notification overlay's page
264
+ takes over, and that page, without a title bar, sets its own `0px` (see
265
+ [The native notification overlay](#the-native-notification-overlay)).
266
+
258
267
  A maximized modal can be pulled off the top by its header — it returns to its size under the
259
268
  pointer and the drag carries on, like a desktop window. A host that keeps maximized modals in
260
269
  place, as the reference's modal editor does, says so once for every modal of a root; the Restore
@@ -450,6 +459,68 @@ import { provideHostTranslator } from '@vokril/ui-solid/host';
450
459
  provideHostTranslator({ t: (key, values) => i18n.t(key, values), language: () => i18n.language() });
451
460
  ```
452
461
 
462
+ ## The native notification overlay
463
+
464
+ A desktop host whose embedded browser views paint over the page can lift the toasts above them.
465
+ Its `DesktopBridge.notificationOverlay(window)` returns the window's overlay port, and
466
+ `NotificationHost` sends the port a snapshot of the stack (`setNotificationOverlay`) at every
467
+ change. While the stack overlaps a visible browser view (`registerVisibleBrowser`) the snapshot is
468
+ `visible`, and the host draws its cards in a page of its own, in a window over the view.
469
+
470
+ A snapshot's appearance is the host window's run-time appearance. Its custom properties,
471
+ `cssVariables`, are the ones written inline on the host's root — what the host writes there while
472
+ it runs: a palette, the user's fonts, a scrollbar style —, not the ones the root computes;
473
+ `menuDensity` is the root's `data-menu-density` (left out when the root names no `MenuDensity`),
474
+ `fontSize` the root's computed font size (the overlay's rem base), `fontFamily` its computed font
475
+ and `theme` its `light` class. Every other token comes from the stylesheets (but for those the
476
+ theme's root markers select, below), so the overlay page:
477
+
478
+ - loads the kit's `theme.css` and the token sheets the host loads in its own windows;
479
+ - writes `cssVariables` inline on its root, and removes those a later snapshot no longer carries;
480
+ - writes `menuDensity` as its root's `data-menu-density`, and removes the attribute when a snapshot
481
+ has none;
482
+ - sets the values that belong to its own window itself, over the host's sheets:
483
+ `--modal-maximize-inset: 0px` (the overlay has no title bar — see [Modals](#modals)), a zoom
484
+ factor of its own.
485
+
486
+ ```ts
487
+ import type { MenuDensity } from '@vokril/ui-solid/tokens/menu-density';
488
+
489
+ // The overlay page, on every snapshot its window receives.
490
+ const written = new Set<string>();
491
+ function applyAppearance(state: { cssVariables?: Record<string, string>; menuDensity?: MenuDensity }): void {
492
+ const root = document.documentElement;
493
+ const variables = state.cssVariables ?? {};
494
+ for (const name of written) if (!(name in variables)) root.style.removeProperty(name);
495
+ written.clear();
496
+ for (const [name, value] of Object.entries(variables)) {
497
+ if (!name.startsWith('--')) continue; // the snapshot crossed a process boundary
498
+ root.style.setProperty(name, value);
499
+ written.add(name);
500
+ }
501
+ if (state.menuDensity) root.setAttribute('data-menu-density', state.menuDensity);
502
+ else root.removeAttribute('data-menu-density');
503
+ }
504
+ ```
505
+
506
+ On its way to the overlay window the snapshot crosses a process boundary. A process that checks it
507
+ there — a schema in the host's main process — takes the densities from
508
+ `@vokril/ui-solid/tokens/menu-density`, whose module graph loads no package and touches no DOM;
509
+ `/settings` exports the same list, with the settings registry, which needs solid-js.
510
+
511
+ The snapshot carries every custom property written inline on the host's root, so the host keeps a
512
+ value that belongs to one window out of the root's inline style — in a stylesheet rule, as the
513
+ title bar inset in [Modals](#modals).
514
+
515
+ The theme's markers on the host's root (`data-app-theme`, `data-design`, which `applyAppTheme`
516
+ stamps) are not carried: the kit's sheets key the root's `color-scheme` on them, a value of the
517
+ overlay's own window. The tokens a design hangs on them do not reach the overlay either. Under the
518
+ default design's and the high-contrast themes they are the ones a root of the same `light` or
519
+ `dark` class gets anyway; under a theme of the Vokril design they are the design's own — its
520
+ square corners, Manrope and flat surfaces —, which the overlay's cards then go without. A token
521
+ the host writes inline on its root travels with the snapshot whatever set it, so a host that
522
+ wants such tokens in the overlay writes them there.
523
+
453
524
  ## Server rendering and bundlers
454
525
 
455
526
  The package's export conditions: