@vokril/ui-solid 0.32.0 → 0.33.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 (57) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +65 -0
  3. package/dist/{StatusBarNotificationBell-CgsYrrpj.js → StatusBarNotificationBell-DKDoWK71.js} +1557 -1545
  4. package/dist/StatusBarNotificationBell-wO16mjon.cjs +50 -0
  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 +8 -0
  8. package/dist/_internal/contract/menuDensity.d.ts +8 -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 +3 -3
  13. package/dist/{server/useSettingsSubscription-DLEk4k4j.js → menuDensity-6x_EqCGb.js} +7 -5
  14. package/dist/{server/useSettingsSubscription-DKjCwmRd.cjs → menuDensity-Cf74__OQ.cjs} +1 -1
  15. package/dist/notifications/index.cjs +1 -1
  16. package/dist/notifications/index.js +2 -2
  17. package/dist/notifications/notificationOverlaySnapshot.d.cts +35 -6
  18. package/dist/notifications/notificationOverlaySnapshot.d.ts +35 -6
  19. package/dist/overlay/Modal.d.cts +7 -6
  20. package/dist/overlay/Modal.d.ts +7 -6
  21. package/dist/overlay/modalViewport.d.cts +2 -1
  22. package/dist/overlay/modalViewport.d.ts +2 -1
  23. package/dist/rowSource-D8gyHbEE.cjs +1 -0
  24. package/dist/{rowSource-BRGZHclZ.js → rowSource-_4IuosKj.js} +5 -0
  25. package/dist/server/{StatusBarNotificationBell-Cxs_bVKX.cjs → StatusBarNotificationBell-DEp4eEUv.cjs} +19 -19
  26. package/dist/server/{StatusBarNotificationBell-CJJFE4rf.js → StatusBarNotificationBell-kOm2ZNkl.js} +1519 -1507
  27. package/dist/server/index.cjs +1 -1
  28. package/dist/server/index.js +3 -3
  29. package/dist/{useSettingsSubscription-DLEk4k4j.js → server/menuDensity-6x_EqCGb.js} +7 -5
  30. package/dist/{useSettingsSubscription-DKjCwmRd.cjs → server/menuDensity-Cf74__OQ.cjs} +1 -1
  31. package/dist/server/notifications/index.cjs +1 -1
  32. package/dist/server/notifications/index.js +2 -2
  33. package/dist/server/{rowSource-CoeHYNsV.js → rowSource-BSa7rgYJ.js} +188 -183
  34. package/dist/server/rowSource-Yw-xtlih.cjs +1 -0
  35. package/dist/server/settings/index.cjs +1 -1
  36. package/dist/server/settings/index.js +26 -25
  37. package/dist/server/tree/index.cjs +1 -1
  38. package/dist/server/tree/index.js +1 -1
  39. package/dist/settings/index.cjs +1 -1
  40. package/dist/settings/index.js +26 -25
  41. package/dist/solid/_internal/contract/menuDensity.js +1 -0
  42. package/dist/solid/_internal/platform/settings/settingsTypes.js +1 -0
  43. package/dist/solid/notifications/NotificationHost.jsx +3 -16
  44. package/dist/solid/notifications/notificationOverlaySnapshot.js +26 -0
  45. package/dist/solid/tree/TreeRow.jsx +3 -1
  46. package/dist/style.css +1 -1
  47. package/dist/tree/TreeRow.d.cts +5 -4
  48. package/dist/tree/TreeRow.d.ts +5 -4
  49. package/dist/tree/descriptor.d.cts +13 -3
  50. package/dist/tree/descriptor.d.ts +13 -3
  51. package/dist/tree/index.cjs +1 -1
  52. package/dist/tree/index.js +1 -1
  53. package/dist/ui.css +1 -1
  54. package/package.json +1 -1
  55. package/dist/StatusBarNotificationBell-CNs_obmZ.cjs +0 -50
  56. package/dist/rowSource-C3zlzAtR.cjs +0 -1
  57. package/dist/server/rowSource-C1F4l0xZ.cjs +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ 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.0
9
+
10
+ ### Minor Changes
11
+
12
+ - 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.
13
+
14
+ 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.
15
+
16
+ **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`.
17
+ - 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`).
18
+
8
19
  ## 0.32.0
9
20
 
10
21
  ### Minor Changes
package/README.md CHANGED
@@ -236,6 +236,9 @@ const surface = createTreeSurface({
236
236
  vanishing above the viewport keep the visible rows in place.
237
237
  - `surface.cursorRow()` is the row under the cursor; `controller.focusKey(key)` and
238
238
  `controller.selectKey(key, modifier)` address a row by key.
239
+ - A row is named by its content. One that shows no text — a placeholder that loads the next page as it
240
+ scrolls into view — takes its accessible name from `rowProps`: `ariaLabel` (a `t()`-d string) becomes the
241
+ row's `aria-label`; left out or empty, the row has none. A sticky clone of the row does not restate it.
239
242
  - Very long lists scroll past the browser's element-height limit: the container is capped and positions
240
243
  map proportionally (`createVirtualWindow`).
241
244
 
@@ -255,6 +258,11 @@ modal layer:
255
258
  }
256
259
  ```
257
260
 
261
+ The value is the window's own: set it in a stylesheet rule, as above, not inline on the root. The
262
+ root's inline custom properties are the run-time appearance the native notification overlay's page
263
+ takes over, and that page, without a title bar, sets its own `0px` (see
264
+ [The native notification overlay](#the-native-notification-overlay)).
265
+
258
266
  A maximized modal can be pulled off the top by its header — it returns to its size under the
259
267
  pointer and the drag carries on, like a desktop window. A host that keeps maximized modals in
260
268
  place, as the reference's modal editor does, says so once for every modal of a root; the Restore
@@ -450,6 +458,63 @@ import { provideHostTranslator } from '@vokril/ui-solid/host';
450
458
  provideHostTranslator({ t: (key, values) => i18n.t(key, values), language: () => i18n.language() });
451
459
  ```
452
460
 
461
+ ## The native notification overlay
462
+
463
+ A desktop host whose embedded browser views paint over the page can lift the toasts above them.
464
+ Its `DesktopBridge.notificationOverlay(window)` returns the window's overlay port, and
465
+ `NotificationHost` sends the port a snapshot of the stack (`setNotificationOverlay`) at every
466
+ change. While the stack overlaps a visible browser view (`registerVisibleBrowser`) the snapshot is
467
+ `visible`, and the host draws its cards in a page of its own, in a window over the view.
468
+
469
+ A snapshot's appearance is the host window's run-time appearance. Its custom properties,
470
+ `cssVariables`, are the ones written inline on the host's root — what the host writes there while
471
+ it runs: a palette, the user's fonts, a scrollbar style —, not the ones the root computes;
472
+ `menuDensity` is the root's `data-menu-density` (left out when the root names no `MenuDensity`),
473
+ `fontSize` the root's computed font size (the overlay's rem base), `fontFamily` its computed font
474
+ and `theme` its `light` class. Every other token comes from the stylesheets (but for those the
475
+ theme's root markers select, below), so the overlay page:
476
+
477
+ - loads the kit's `theme.css` and the token sheets the host loads in its own windows;
478
+ - writes `cssVariables` inline on its root, and removes those a later snapshot no longer carries;
479
+ - writes `menuDensity` as its root's `data-menu-density`, and removes the attribute when a snapshot
480
+ has none;
481
+ - sets the values that belong to its own window itself, over the host's sheets:
482
+ `--modal-maximize-inset: 0px` (the overlay has no title bar — see [Modals](#modals)), a zoom
483
+ factor of its own.
484
+
485
+ ```ts
486
+ import type { MenuDensity } from '@vokril/ui-solid/settings';
487
+
488
+ // The overlay page, on every snapshot its window receives.
489
+ const written = new Set<string>();
490
+ function applyAppearance(state: { cssVariables?: Record<string, string>; menuDensity?: MenuDensity }): void {
491
+ const root = document.documentElement;
492
+ const variables = state.cssVariables ?? {};
493
+ for (const name of written) if (!(name in variables)) root.style.removeProperty(name);
494
+ written.clear();
495
+ for (const [name, value] of Object.entries(variables)) {
496
+ if (!name.startsWith('--')) continue; // the snapshot crossed a process boundary
497
+ root.style.setProperty(name, value);
498
+ written.add(name);
499
+ }
500
+ if (state.menuDensity) root.setAttribute('data-menu-density', state.menuDensity);
501
+ else root.removeAttribute('data-menu-density');
502
+ }
503
+ ```
504
+
505
+ The snapshot carries every custom property written inline on the host's root, so the host keeps a
506
+ value that belongs to one window out of the root's inline style — in a stylesheet rule, as the
507
+ title bar inset in [Modals](#modals).
508
+
509
+ The theme's markers on the host's root (`data-app-theme`, `data-design`, which `applyAppTheme`
510
+ stamps) are not carried: the kit's sheets key the root's `color-scheme` on them, a value of the
511
+ overlay's own window. The tokens a design hangs on them do not reach the overlay either. Under the
512
+ default design's and the high-contrast themes they are the ones a root of the same `light` or
513
+ `dark` class gets anyway; under a theme of the Vokril design they are the design's own — its
514
+ square corners, Manrope and flat surfaces —, which the overlay's cards then go without. A token
515
+ the host writes inline on its root travels with the snapshot whatever set it, so a host that
516
+ wants such tokens in the overlay writes them there.
517
+
453
518
  ## Server rendering and bundlers
454
519
 
455
520
  The package's export conditions: