@adecore/ui 0.39.0 → 0.40.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 (207) hide show
  1. package/dist/AccentSwatches.js +2 -3
  2. package/dist/Banner.js +1 -6
  3. package/dist/ChoiceCards.js +0 -5
  4. package/dist/ColorSwatch.js +1 -4
  5. package/dist/ColorWheelPicker.js +3 -6
  6. package/dist/DockShell.js +3 -5
  7. package/dist/EmptyState.js +0 -1
  8. package/dist/ErrorBoundary.js +1 -5
  9. package/dist/Field.js +2 -6
  10. package/dist/FileIcon.js +2 -4
  11. package/dist/Icon.js +1 -2
  12. package/dist/IconButton.js +1 -1
  13. package/dist/IconPicker.js +3 -7
  14. package/dist/Input.js +1 -2
  15. package/dist/Kbd.js +1 -3
  16. package/dist/LazyBoundary.js +2 -3
  17. package/dist/Meter.js +0 -1
  18. package/dist/MiddleTruncate.js +2 -6
  19. package/dist/PanelEmpty.js +0 -1
  20. package/dist/PanelHeader.js +1 -4
  21. package/dist/Pill.js +1 -6
  22. package/dist/ProjectSwitcher.js +1 -1
  23. package/dist/PromptDialog.js +5 -8
  24. package/dist/RelativeTime.js +1 -1
  25. package/dist/SegmentBar.js +1 -2
  26. package/dist/Segmented.js +2 -5
  27. package/dist/Select.js +1 -4
  28. package/dist/ShortcutHints.js +2 -3
  29. package/dist/Slider.js +0 -1
  30. package/dist/SlidingColumn.js +2 -4
  31. package/dist/SplitButton.js +1 -5
  32. package/dist/TextMenu.js +1 -5
  33. package/dist/Tile.js +0 -4
  34. package/dist/Toasts.js +1 -9
  35. package/dist/Tooltip.js +1 -1
  36. package/dist/UIProvider.js +0 -5
  37. package/dist/Waveform.js +4 -2
  38. package/dist/Wipe.js +1 -6
  39. package/dist/ZoomControls.js +0 -1
  40. package/dist/clipboard.js +2 -5
  41. package/dist/combobox/parts.js +3 -9
  42. package/dist/command-palette/parts.js +5 -14
  43. package/dist/dialog/parts.js +5 -10
  44. package/dist/dialog-layer.js +2 -3
  45. package/dist/error-boundary.js +4 -20
  46. package/dist/file-icon.js +4 -9
  47. package/dist/file-tree/empty-lines.js +2 -8
  48. package/dist/file-tree/use-empty-lines.js +1 -5
  49. package/dist/file-tree/use-slots.js +6 -10
  50. package/dist/format/datetime.js +32 -29
  51. package/dist/format/duration.js +2 -10
  52. package/dist/format/locale.js +19 -39
  53. package/dist/format/number.js +9 -22
  54. package/dist/format/regions.js +4 -7
  55. package/dist/icon-picker.js +5 -14
  56. package/dist/key-value-list/parts.js +1 -5
  57. package/dist/lazy.js +4 -19
  58. package/dist/locales.js +2 -6
  59. package/dist/menu/parts.js +61 -133
  60. package/dist/middle-truncate.js +2 -3
  61. package/dist/placement.js +0 -1
  62. package/dist/popover/parts.js +1 -5
  63. package/dist/popup-layer.js +2 -4
  64. package/dist/prefetch.js +2 -5
  65. package/dist/selection.js +1 -5
  66. package/dist/settings/MasterDetail.js +1 -7
  67. package/dist/settings/SettingsDialog.js +1 -2
  68. package/dist/settings/SettingsRow.js +2 -5
  69. package/dist/settings/SettingsSection.js +1 -1
  70. package/dist/shortcut-hints.js +1 -5
  71. package/dist/shortcut.js +1 -2
  72. package/dist/tabs/overflow.js +1 -6
  73. package/dist/tabs/parts.js +69 -95
  74. package/dist/testing/dedupe.js +5 -7
  75. package/dist/tint.js +3 -5
  76. package/dist/toast-store.js +2 -10
  77. package/dist/tree/use-tree-shift.js +2 -6
  78. package/dist/useColumnResize.js +9 -10
  79. package/dist/useNow.js +2 -9
  80. package/dist/workspace/DropPreview.js +1 -5
  81. package/dist/workspace/preview.js +4 -9
  82. package/package.json +9 -9
  83. package/src/AccentSwatches.tsx +9 -3
  84. package/src/Banner.tsx +5 -11
  85. package/src/Button.tsx +4 -0
  86. package/src/Checkbox.tsx +3 -0
  87. package/src/ChoiceCards.tsx +12 -11
  88. package/src/CloseButton.tsx +1 -0
  89. package/src/ColorSwatch.tsx +7 -8
  90. package/src/ColorWheelPicker.tsx +28 -12
  91. package/src/ColumnResizeHandle.tsx +1 -0
  92. package/src/CopyButton.tsx +6 -0
  93. package/src/DisabledReason.tsx +1 -0
  94. package/src/DockShell.tsx +11 -10
  95. package/src/EmptyState.tsx +10 -6
  96. package/src/ErrorBoundary.tsx +13 -10
  97. package/src/Field.tsx +11 -13
  98. package/src/FileIcon.tsx +4 -4
  99. package/src/Icon.tsx +2 -4
  100. package/src/IconButton.tsx +14 -5
  101. package/src/IconPicker.tsx +30 -15
  102. package/src/Input.tsx +11 -9
  103. package/src/Kbd.tsx +8 -7
  104. package/src/LazyBoundary.tsx +3 -3
  105. package/src/Meter.tsx +7 -2
  106. package/src/MiddleTruncate.tsx +15 -6
  107. package/src/PanelEmpty.tsx +9 -7
  108. package/src/PanelHeader.tsx +2 -5
  109. package/src/Pill.tsx +7 -8
  110. package/src/ProjectSwitcher.tsx +16 -6
  111. package/src/PromptDialog.tsx +31 -26
  112. package/src/RelativeTime.tsx +6 -1
  113. package/src/SegmentBar.tsx +22 -11
  114. package/src/Segmented.tsx +16 -11
  115. package/src/Select.tsx +7 -4
  116. package/src/SelectSearch.tsx +3 -0
  117. package/src/ShortcutHints.tsx +24 -3
  118. package/src/Skeleton.tsx +1 -0
  119. package/src/Slider.tsx +4 -1
  120. package/src/SlidingColumn.tsx +18 -14
  121. package/src/Spinner.tsx +1 -0
  122. package/src/SplitButton.tsx +8 -8
  123. package/src/Stepper.tsx +6 -0
  124. package/src/Switch.tsx +2 -0
  125. package/src/TextMenu.tsx +2 -5
  126. package/src/Tile.tsx +2 -6
  127. package/src/Toasts.tsx +8 -12
  128. package/src/Tooltip.tsx +10 -5
  129. package/src/UIProvider.tsx +7 -7
  130. package/src/Waveform.tsx +41 -12
  131. package/src/Wipe.tsx +5 -6
  132. package/src/ZoomControls.tsx +5 -2
  133. package/src/clipboard.ts +4 -5
  134. package/src/combobox/parts.tsx +18 -14
  135. package/src/command-palette/context.ts +2 -0
  136. package/src/command-palette/index.parts.ts +1 -0
  137. package/src/command-palette/parts.tsx +20 -14
  138. package/src/command-palette/virtual.tsx +21 -0
  139. package/src/dialog/parts.tsx +10 -13
  140. package/src/dialog-layer.ts +5 -3
  141. package/src/error-boundary.ts +7 -20
  142. package/src/file-icon.ts +8 -9
  143. package/src/file-tree/empty-lines.ts +24 -8
  144. package/src/file-tree/helpers.ts +34 -0
  145. package/src/file-tree/highlight.ts +19 -0
  146. package/src/file-tree/index.parts.ts +1 -0
  147. package/src/file-tree/parts.tsx +41 -5
  148. package/src/file-tree/use-empty-lines.ts +22 -5
  149. package/src/file-tree/use-file-tree-shift.tsx +10 -0
  150. package/src/file-tree/use-file-tree.ts +2 -0
  151. package/src/file-tree/use-slots.ts +77 -12
  152. package/src/format/datetime.ts +42 -17
  153. package/src/format/duration.ts +28 -10
  154. package/src/format/index.ts +3 -0
  155. package/src/format/locale.ts +33 -42
  156. package/src/format/number.ts +21 -27
  157. package/src/format/regions.ts +4 -7
  158. package/src/icon-picker.ts +23 -16
  159. package/src/index.ts +8 -0
  160. package/src/key-value-list/parts.tsx +1 -5
  161. package/src/lazy-landings.ts +2 -0
  162. package/src/lazy.tsx +23 -19
  163. package/src/locales.ts +2 -6
  164. package/src/match.ts +14 -0
  165. package/src/menu/parts.tsx +30 -55
  166. package/src/middle-truncate.ts +12 -3
  167. package/src/modality.ts +4 -0
  168. package/src/placement.ts +2 -1
  169. package/src/platform.ts +2 -0
  170. package/src/popover/parts.tsx +3 -5
  171. package/src/popup-layer.ts +6 -4
  172. package/src/prefetch.ts +18 -5
  173. package/src/project-switcher-row.tsx +2 -0
  174. package/src/segmented-keys.ts +6 -0
  175. package/src/select-shared.ts +2 -0
  176. package/src/selection.ts +5 -5
  177. package/src/settings/ConfirmDialog.tsx +3 -0
  178. package/src/settings/MasterDetail.tsx +3 -9
  179. package/src/settings/SettingsDialog.tsx +27 -9
  180. package/src/settings/SettingsRow.tsx +16 -10
  181. package/src/settings/SettingsSection.tsx +10 -5
  182. package/src/settings/index.ts +3 -0
  183. package/src/settings/target.ts +1 -0
  184. package/src/shortcut-hints.ts +10 -5
  185. package/src/shortcut.ts +26 -6
  186. package/src/tabs/overflow.ts +8 -6
  187. package/src/tabs/parts.tsx +50 -26
  188. package/src/testing/dedupe.ts +27 -7
  189. package/src/testing/fake-source.ts +1 -0
  190. package/src/tint.ts +3 -5
  191. package/src/toast-store.ts +20 -14
  192. package/src/tree/parts.tsx +8 -0
  193. package/src/tree/shift.ts +6 -0
  194. package/src/tree/use-tree-shift.tsx +23 -7
  195. package/src/useAsyncAction.ts +8 -0
  196. package/src/useColumnResize.ts +24 -15
  197. package/src/useContentSize.ts +5 -0
  198. package/src/useMeasuredWidth.ts +1 -0
  199. package/src/useNow.ts +6 -11
  200. package/src/workspace/DropPreview.tsx +3 -5
  201. package/src/workspace/SplitView.tsx +109 -0
  202. package/src/workspace/TabStrip.tsx +42 -0
  203. package/src/workspace/Workspace.tsx +5 -0
  204. package/src/workspace/context.ts +1 -0
  205. package/src/workspace/geometry.ts +49 -0
  206. package/src/workspace/model.ts +72 -0
  207. package/src/workspace/preview.ts +15 -15
@@ -26,22 +26,13 @@ export const filterSections = (sections, query, keywords = {}) => {
26
26
  }] : [];
27
27
  });
28
28
  };
29
- /* The one icon the grid's tab stop sits on: the one last focused, else the chosen one, else the first, as long as the search shows it. */
30
- export const tabStopOf = (visible, focused, value) => {
31
- if (focused !== null && visible.includes(focused)) {
32
- return focused;
33
- }
34
- if (value !== null && visible.includes(value)) {
35
- return value;
36
- }
37
- return visible[0] ?? null;
38
- };
29
+ /* The one last focused, else the chosen one, else the first, as long as the search shows it. */
30
+ export const tabStopOf = (visible, focused, value) => [focused, value].find(name => name !== null && visible.includes(name)) ?? visible[0] ?? null;
39
31
  /* Rows lie a few pixels apart at least, so a rounding difference between two cells of one row is no new row. */
40
32
  const SAME_ROW = 2;
41
33
  /*
42
- * The cell a key moves the focus to, or null for a key the grid leaves alone. Up and down go by what
43
- * the eye sees: the nearest cell in the next row drawn, which may belong to another group. At an edge
44
- * the focus stays, so the key never scrolls the grid instead.
34
+ * Null for a key the grid leaves alone. Up and down go to the nearest cell in the next row drawn, which
35
+ * may belong to another group. At an edge the focus stays, so the key never scrolls the grid instead.
45
36
  */
46
37
  export const cellForKey = (key, boxes, from) => {
47
38
  const last = boxes.length - 1;
@@ -85,5 +76,5 @@ export const cellForKey = (key, boxes, from) => {
85
76
  });
86
77
  return nearest;
87
78
  };
88
- /* Escape empties a search that holds text and goes no further; on an empty one it is left to whatever else hears it, such as a dialog. */
79
+ /* On an empty search Escape is left to whatever else hears it, such as a dialog. */
89
80
  export const escapeClearsSearch = (key, query) => key === 'Escape' && query !== '';
@@ -1,11 +1,7 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { useRender } from '@base-ui/react/use-render';
4
- /*
5
- * The names take the width of the widest one, up to two fifths of the list, and a longer name wraps
6
- * there. Every item is a subgrid of the list, so the names line up across rows and a hairline runs
7
- * under both columns.
8
- */
4
+ /* Every item is a subgrid of the list, so the names line up across rows and a hairline runs under both columns. */
9
5
  export function KeyValueListRoot(t0) {
10
6
  const $ = _c(16);
11
7
  let className;
package/dist/lazy.js CHANGED
@@ -2,11 +2,7 @@ import { c as _c } from "react/compiler-runtime";
2
2
  import { Suspense, lazy, useState, useSyncExternalStore } from 'react';
3
3
  import { noteLanding } from './lazy-landings.js';
4
4
  import { prefetcher } from './prefetch.js';
5
- /*
6
- * A module's component, loaded once and kept. `React.lazy` suspends for a tick even on a module the
7
- * prefetcher already has, which shows the fallback and mounts a dialog already open; a component
8
- * that is here is drawn straight away instead.
9
- */
5
+ /* `React.lazy` suspends for a tick even on a module the prefetcher already has, which mounts a dialog already open; a component here draws at once. */
10
6
  import { jsx as _jsx } from "react/jsx-runtime";
11
7
  export class LoadedComponent {
12
8
  current = null;
@@ -34,11 +30,7 @@ export class LoadedComponent {
34
30
  }
35
31
  }
36
32
  const openErrorListeners = new Set();
37
- /*
38
- * Tells `listener` when a module that `lazyNamed` or `lazyDialog` loads for a render fails to load,
39
- * which is a load a person waits on. A failed prefetch never reaches it, not even one of the same
40
- * module at the same moment, so an app can answer the one without being woken by the other.
41
- */
33
+ /* Only a load for a render, which a person waits on; a failed prefetch never reaches it, not even one of the same module at the same moment. */
42
34
  export function onLazyOpenError(listener) {
43
35
  openErrorListeners.add(listener);
44
36
  return () => {
@@ -58,11 +50,7 @@ async function open(loaded) {
58
50
  throw error;
59
51
  }
60
52
  }
61
- /*
62
- * `React.lazy` for a module that exports its component by name, `default` included. Every module
63
- * loaded through here, or through `lazyDialog`, registers with `prefetcher`, which loads it ahead of
64
- * its first opening once the app calls `prefetcher.prefetchEverything()`.
65
- */
53
+ /* Registers with `prefetcher`, like `lazyDialog`, so `prefetcher.prefetchEverything()` loads it ahead of its first opening. */
66
54
  export function lazyNamed(load, name) {
67
55
  const loaded = new LoadedComponent(async () => (await load())[name]);
68
56
  prefetcher.register(() => loaded.load());
@@ -91,10 +79,7 @@ function useOpenedOnce(open) {
91
79
  }
92
80
  return opened || open;
93
81
  }
94
- /*
95
- * A dialog that keeps its own open state. Once its module is here, prefetched or opened, it stays
96
- * mounted closed, so its first opening animates like every other; before that, opening loads it.
97
- */
82
+ /* Once its module is here it stays mounted closed, so its first opening animates like every other. */
98
83
  export function lazyDialog(load, name, useStore, isOpen) {
99
84
  const loaded = new LoadedComponent(async () => (await load())[name]);
100
85
  prefetcher.register(() => loaded.load());
package/dist/locales.js CHANGED
@@ -1,17 +1,13 @@
1
1
  /* The words are modules, not JSON: Node needs `with { type: 'json' }` on a JSON import, and a browser refuses it on the JavaScript Vite serves. */
2
2
  import en from './locales/en.js';
3
3
  import nl from './locales/nl.js';
4
- /* The words of this library live in a namespace of their own, which the app adds to its i18next beside its own namespaces. */
5
4
  export const UI_NAMESPACE = 'ui';
6
- /*
7
- * Every language the library speaks, by language code. Small enough to ship whole, which is what lets
8
- * `addUiResources` run synchronously before the first render, so no word ever shows as its key.
9
- */
5
+ /* Small enough to ship whole, so `addUiResources` runs before the first render and no word shows as its key. */
10
6
  export const UI_RESOURCES = {
11
7
  en,
12
8
  nl
13
9
  };
14
- /* Adds the `ui` namespace in every language to an i18next instance. A language the app already filled keeps its words. */
10
+ /* A language the app already filled keeps its words. */
15
11
  export const addUiResources = i18n => {
16
12
  for (const [language, words] of Object.entries(UI_RESOURCES)) {
17
13
  if (!i18n.hasResourceBundle(language, UI_NAMESPACE)) {
@@ -11,13 +11,9 @@ import { Icon } from "../Icon.js";
11
11
  import { Tooltip } from "../Tooltip.js";
12
12
  import { splitPlacement } from '../placement.js';
13
13
  import { renderPositioner } from '../popup-layer.js';
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  const MenuKindContext = createContext('menu');
16
- /*
17
- * A menu hangs under its trigger, lined up with its start, unless there is no room. A context menu
18
- * opens at the pointer, which its positioner already knows. A submenu sits beside its row, pulled
19
- * up by the popup's own padding so its first row lines up with the row that opened it.
20
- */
16
+ /* A context menu opens at the pointer, which its positioner already knows. A submenu is pulled up by the popup's padding so its first row lines up with the row that opened it. */
21
17
  const PLACEMENT = {
22
18
  menu: {
23
19
  side: 'bottom',
@@ -30,12 +26,11 @@ const PLACEMENT = {
30
26
  alignOffset: -4
31
27
  }
32
28
  };
33
- /* The label above a group of rows. It takes the line height of the row it sits in. */
29
+ /* It takes the line height of the row it sits in. */
34
30
  export const MENU_LABEL = 'px-2.5 pt-1.5 pb-0.5 text-xs/[inherit] text-text-faint';
35
31
  /* A trailing hint in a row: what the item does to something else, never a shortcut. A shortcut stays a `Kbd`, which `.menu-item` already pushes to the right. */
36
32
  const MENU_HINT = 'ml-auto pl-3 text-xs/[inherit] text-text-faint';
37
- /* The hairline between two groups of rows. It runs the whole width of the popup, which is what the
38
- negative margin buys back from its 4px of padding, and it is softer than a border a surface ends with. */
33
+ /* The negative margin buys back the popup's 4px of padding, so the line runs its whole width. */
39
34
  const MENU_SEPARATOR = '-mx-1 my-1 h-px bg-border-soft';
40
35
  export function MenuRoot(props) {
41
36
  const $ = _c(2);
@@ -90,11 +85,6 @@ export function MenuSubmenuRoot(props) {
90
85
  }
91
86
  export const MenuTrigger = BaseMenu.Trigger;
92
87
  export const ContextMenuTrigger = BaseContextMenu.Trigger;
93
- /*
94
- * The shell every menu is drawn in: the portal, the layer it sits on and the gap to its trigger are
95
- * decided once. The popup scrolls inside the room the window leaves it; `className` adds a minimum
96
- * width or a layout of its own, such as a grid of swatches.
97
- */
98
88
  export function MenuPopup(t0) {
99
89
  const $ = _c(12);
100
90
  const {
@@ -197,11 +187,7 @@ export function MenuItem(t0) {
197
187
  }
198
188
  return t3;
199
189
  }
200
- /*
201
- * The slot before the label of a row that can be checked, in a menu or a list that reads as one. It
202
- * is one line of the row tall, so a row with a second line keeps the tick beside its first. Radio and
203
- * checkbox items draw it themselves; a plain row that shows a state hands it `checked`.
204
- */
190
+ /* One line of the row tall, so a row with a second line keeps the tick beside its first. */
205
191
  export function MenuCheck(t0) {
206
192
  const $ = _c(15);
207
193
  const {
@@ -276,9 +262,16 @@ export function MenuCheck(t0) {
276
262
  }
277
263
  return t6;
278
264
  }
279
- /* A row that is on or off. The box before its label is part of it. */
265
+ const checkRow = (kind, unstyled, indicator, children) => unstyled ? children : /*#__PURE__*/_jsxs(_Fragment, {
266
+ children: [indicator === 'start' && /*#__PURE__*/_jsx(MenuCheck, {
267
+ kind: kind
268
+ }), children, indicator === 'end' && /*#__PURE__*/_jsx(MenuCheck, {
269
+ kind: kind,
270
+ className: "ml-auto"
271
+ })]
272
+ });
280
273
  export function MenuCheckboxItem(t0) {
281
- const $ = _c(22);
274
+ const $ = _c(17);
282
275
  let children;
283
276
  let className;
284
277
  let props;
@@ -307,74 +300,44 @@ export function MenuCheckboxItem(t0) {
307
300
  }
308
301
  const unstyled = t1 === undefined ? false : t1;
309
302
  const indicator = t2 === undefined ? "start" : t2;
310
- if (unstyled) {
311
- let t3;
312
- if ($[6] !== children || $[7] !== className || $[8] !== props) {
313
- t3 = /*#__PURE__*/_jsx(BaseMenu.CheckboxItem, {
314
- className: className,
315
- ...props,
316
- children: children
317
- });
318
- $[6] = children;
319
- $[7] = className;
320
- $[8] = props;
321
- $[9] = t3;
322
- } else {
323
- t3 = $[9];
324
- }
325
- return t3;
326
- }
327
303
  let t3;
328
- if ($[10] !== className) {
329
- t3 = withClass("menu-item", className);
330
- $[10] = className;
331
- $[11] = t3;
304
+ if ($[6] !== className || $[7] !== unstyled) {
305
+ t3 = unstyled ? className : withClass("menu-item", className);
306
+ $[6] = className;
307
+ $[7] = unstyled;
308
+ $[8] = t3;
332
309
  } else {
333
- t3 = $[11];
310
+ t3 = $[8];
334
311
  }
335
312
  let t4;
336
- if ($[12] !== indicator) {
337
- t4 = indicator === "start" && /*#__PURE__*/_jsx(MenuCheck, {
338
- kind: "checkbox"
339
- });
340
- $[12] = indicator;
341
- $[13] = t4;
313
+ if ($[9] !== children || $[10] !== indicator || $[11] !== unstyled) {
314
+ t4 = checkRow("checkbox", unstyled, indicator, children);
315
+ $[9] = children;
316
+ $[10] = indicator;
317
+ $[11] = unstyled;
318
+ $[12] = t4;
342
319
  } else {
343
- t4 = $[13];
320
+ t4 = $[12];
344
321
  }
345
322
  let t5;
346
- if ($[14] !== indicator) {
347
- t5 = indicator === "end" && /*#__PURE__*/_jsx(MenuCheck, {
348
- kind: "checkbox",
349
- className: "ml-auto"
350
- });
351
- $[14] = indicator;
352
- $[15] = t5;
353
- } else {
354
- t5 = $[15];
355
- }
356
- let t6;
357
- if ($[16] !== children || $[17] !== props || $[18] !== t3 || $[19] !== t4 || $[20] !== t5) {
358
- t6 = /*#__PURE__*/_jsxs(BaseMenu.CheckboxItem, {
323
+ if ($[13] !== props || $[14] !== t3 || $[15] !== t4) {
324
+ t5 = /*#__PURE__*/_jsx(BaseMenu.CheckboxItem, {
359
325
  className: t3,
360
326
  ...props,
361
- children: [t4, children, t5]
327
+ children: t4
362
328
  });
363
- $[16] = children;
364
- $[17] = props;
365
- $[18] = t3;
366
- $[19] = t4;
367
- $[20] = t5;
368
- $[21] = t6;
329
+ $[13] = props;
330
+ $[14] = t3;
331
+ $[15] = t4;
332
+ $[16] = t5;
369
333
  } else {
370
- t6 = $[21];
334
+ t5 = $[16];
371
335
  }
372
- return t6;
336
+ return t5;
373
337
  }
374
338
  export const MenuRadioGroup = BaseMenu.RadioGroup;
375
- /* One of several. The tick before its label is part of it. */
376
339
  export function MenuRadioItem(t0) {
377
- const $ = _c(22);
340
+ const $ = _c(17);
378
341
  let children;
379
342
  let className;
380
343
  let props;
@@ -403,69 +366,40 @@ export function MenuRadioItem(t0) {
403
366
  }
404
367
  const unstyled = t1 === undefined ? false : t1;
405
368
  const indicator = t2 === undefined ? "start" : t2;
406
- if (unstyled) {
407
- let t3;
408
- if ($[6] !== children || $[7] !== className || $[8] !== props) {
409
- t3 = /*#__PURE__*/_jsx(BaseMenu.RadioItem, {
410
- className: className,
411
- ...props,
412
- children: children
413
- });
414
- $[6] = children;
415
- $[7] = className;
416
- $[8] = props;
417
- $[9] = t3;
418
- } else {
419
- t3 = $[9];
420
- }
421
- return t3;
422
- }
423
369
  let t3;
424
- if ($[10] !== className) {
425
- t3 = withClass("menu-item", className);
426
- $[10] = className;
427
- $[11] = t3;
370
+ if ($[6] !== className || $[7] !== unstyled) {
371
+ t3 = unstyled ? className : withClass("menu-item", className);
372
+ $[6] = className;
373
+ $[7] = unstyled;
374
+ $[8] = t3;
428
375
  } else {
429
- t3 = $[11];
376
+ t3 = $[8];
430
377
  }
431
378
  let t4;
432
- if ($[12] !== indicator) {
433
- t4 = indicator === "start" && /*#__PURE__*/_jsx(MenuCheck, {
434
- kind: "radio"
435
- });
436
- $[12] = indicator;
437
- $[13] = t4;
379
+ if ($[9] !== children || $[10] !== indicator || $[11] !== unstyled) {
380
+ t4 = checkRow("radio", unstyled, indicator, children);
381
+ $[9] = children;
382
+ $[10] = indicator;
383
+ $[11] = unstyled;
384
+ $[12] = t4;
438
385
  } else {
439
- t4 = $[13];
386
+ t4 = $[12];
440
387
  }
441
388
  let t5;
442
- if ($[14] !== indicator) {
443
- t5 = indicator === "end" && /*#__PURE__*/_jsx(MenuCheck, {
444
- kind: "radio",
445
- className: "ml-auto"
446
- });
447
- $[14] = indicator;
448
- $[15] = t5;
449
- } else {
450
- t5 = $[15];
451
- }
452
- let t6;
453
- if ($[16] !== children || $[17] !== props || $[18] !== t3 || $[19] !== t4 || $[20] !== t5) {
454
- t6 = /*#__PURE__*/_jsxs(BaseMenu.RadioItem, {
389
+ if ($[13] !== props || $[14] !== t3 || $[15] !== t4) {
390
+ t5 = /*#__PURE__*/_jsx(BaseMenu.RadioItem, {
455
391
  className: t3,
456
392
  ...props,
457
- children: [t4, children, t5]
393
+ children: t4
458
394
  });
459
- $[16] = children;
460
- $[17] = props;
461
- $[18] = t3;
462
- $[19] = t4;
463
- $[20] = t5;
464
- $[21] = t6;
395
+ $[13] = props;
396
+ $[14] = t3;
397
+ $[15] = t4;
398
+ $[16] = t5;
465
399
  } else {
466
- t6 = $[21];
400
+ t5 = $[16];
467
401
  }
468
- return t6;
402
+ return t5;
469
403
  }
470
404
  export function MenuSubmenuTrigger(t0) {
471
405
  const $ = _c(14);
@@ -529,10 +463,7 @@ export function MenuSubmenuTrigger(t0) {
529
463
  }
530
464
  return t4;
531
465
  }
532
- /*
533
- * A row with buttons at its end that reads as one row. Its first item is the row, every `RowAction`
534
- * and `RowSubmenuTrigger` after it an item of its own, so the arrow keys reach each.
535
- */
466
+ /* Its first item is the row, every `RowAction` and `RowSubmenuTrigger` after it an item of its own, so the arrow keys reach each. */
536
467
  export function MenuRow(t0) {
537
468
  const $ = _c(14);
538
469
  let className;
@@ -674,10 +605,7 @@ export function MenuRowAction(t0) {
674
605
  }
675
606
  return t4;
676
607
  }
677
- /*
678
- * A button in a `Menu.Row` that opens a submenu, inside a `Menu.SubmenuRoot`. It has no tooltip: the
679
- * submenu opens on the same hover and says what the button holds.
680
- */
608
+ /* No tooltip: the submenu opens on the same hover and says what the button holds. */
681
609
  export function MenuRowSubmenuTrigger(t0) {
682
610
  const $ = _c(16);
683
611
  let className;
@@ -1,8 +1,7 @@
1
1
  export const MIDDLE_ELLIPSIS = '…';
2
2
  /*
3
- * The head and tail of `text` that keep the most of it around an ellipsis within `width`, or null
4
- * when the whole text fits. The tail gets the odd character, since the end of a path or a branch is
5
- * what tells two of them apart. Code points, never UTF-16 units, so a cut never halves a character.
3
+ * Null when the whole text fits. The tail gets the odd character, since the end of a path is what tells
4
+ * two of them apart. Code points, never UTF-16 units, so a cut never halves a character.
6
5
  */
7
6
  export function fitMiddle(text, width, measure) {
8
7
  if (measure(text) <= width) {
package/dist/placement.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /* The positioner props a popup part takes beside its own, so a caller places a popup on the one element it renders. */
2
2
  const PLACEMENT_KEYS = ['side', 'align', 'sideOffset', 'alignOffset', 'collisionPadding', 'collisionBoundary', 'collisionAvoidance', 'anchor', 'sticky', 'positionMethod'];
3
- /* Splits a popup part's props into what goes to the positioner and what goes to the popup. */
4
3
  export function splitPlacement(props) {
5
4
  const placement = {};
6
5
  const rest = {
@@ -4,10 +4,7 @@ import { PreviewCard as BasePreviewCard } from '@base-ui/react/preview-card';
4
4
  import { withClass } from '../class-name.js';
5
5
  import { splitPlacement } from '../placement.js';
6
6
  import { renderPositioner } from '../popup-layer.js';
7
- /*
8
- * The surface a popup is drawn on. `menu` is the padded card menus use, `picker` a card whose
9
- * content runs to its edges (a search field on top of a list), and `plain` leaves the surface to the caller.
10
- */
7
+ /* `picker` is a card whose content runs to its edges, `plain` leaves the surface to the caller. */
11
8
  import { jsx as _jsx } from "react/jsx-runtime";
12
9
  const POPUP_VARIANT = {
13
10
  menu: 'menu-popup',
@@ -19,7 +16,6 @@ export const PopoverTrigger = BasePopover.Trigger;
19
16
  export const PopoverClose = BasePopover.Close;
20
17
  export const PopoverTitle = BasePopover.Title;
21
18
  export const PopoverDescription = BasePopover.Description;
22
- /* The portal, the positioner and the popup of a popover: under its trigger and lined up with its start unless it says otherwise. */
23
19
  export function PopoverPopup(t0) {
24
20
  const $ = _c(19);
25
21
  let align;
@@ -3,9 +3,8 @@ import { createElement, useLayoutEffect } from 'react';
3
3
  // One attribute serves every open popup, so it stays until the last one closes.
4
4
  const open = new Set();
5
5
  /*
6
- * Marks the root with `data-popup-open` while a popup is open, which the theme reads to turn the
7
- * window's drag regions off. An attribute on the root instead of `:root:has(...)`, which made the
8
- * browser restyle the whole page on every DOM insertion.
6
+ * The theme reads `data-popup-open` to turn the window's drag regions off. An attribute instead of
7
+ * `:root:has(...)`, which made the browser restyle the whole page on every DOM insertion.
9
8
  */
10
9
  function usePopupLayer(isOpen) {
11
10
  const $ = _c(3);
@@ -44,7 +43,6 @@ function LayerPositioner(t0) {
44
43
  usePopupLayer(isOpen);
45
44
  return createElement("div", props);
46
45
  }
47
- /* The `render` of a popup's positioner, which knows whether the popup is open and so marks the root for as long as it is. */
48
46
  export const renderPositioner = (props, state) => createElement(LayerPositioner, {
49
47
  ...props,
50
48
  open: state.open
package/dist/prefetch.js CHANGED
@@ -1,7 +1,6 @@
1
1
  /*
2
- * Loads lazy modules ahead of their first opening, one per idle moment and never two at once, so
3
- * the first open resolves from the module cache. A loader registered while everything is on
4
- * joins the end, which is how a lazy surface inside another lazy one gets its turn.
2
+ * One module per idle moment and never two at once. A loader registered while everything is on joins
3
+ * the end, which is how a lazy surface inside another lazy one gets its turn.
5
4
  */
6
5
  export class Prefetcher {
7
6
  registered = [];
@@ -27,7 +26,6 @@ export class Prefetcher {
27
26
  this.enqueue(load);
28
27
  }
29
28
  }
30
- /* Loads this one module, ahead of whatever is registered. */
31
29
  prefetch(load) {
32
30
  if (!this.allowed()) {
33
31
  return Promise.resolve();
@@ -99,5 +97,4 @@ const whenIdle = run => {
99
97
  };
100
98
  /* Not in every DOM typing yet, and only Chromium reports it. */
101
99
  const savesData = () => navigator.connection?.saveData === true;
102
- /* The one every `lazyNamed` and `lazyDialog` registers with. */
103
100
  export const prefetcher = /* @__PURE__ */new Prefetcher(whenIdle, () => !savesData());
package/dist/selection.js CHANGED
@@ -1,8 +1,4 @@
1
- /*
2
- * The text selection, as a context menu has to read it. The app has one selection at a time and a
3
- * menu belongs to the surface the click landed on, so both of these are scoped to an element.
4
- * A selection somewhere else is no selection this menu can copy.
5
- */
1
+ /* A menu belongs to the surface the click landed on, so both of these are scoped to an element: a selection elsewhere is none this menu can copy. */
6
2
  export const selectionWithin = element => {
7
3
  const selection = window.getSelection();
8
4
  if (!element || !selection || selection.isCollapsed || selection.rangeCount === 0) {
@@ -6,12 +6,7 @@ const LIST_WIDTHS = {
6
6
  320: 'w-80',
7
7
  340: 'w-85'
8
8
  };
9
- /*
10
- * A list beside the detail of what is picked in it, for a pane of many things of one kind (accounts,
11
- * devices, shortcut categories). Each side scrolls on its own, and the detail takes the rest of the
12
- * width, like a single-column pane. Its section must be `split`, so the dialog hands the pane its whole height
13
- * instead of a padded scrolling column.
14
- */
9
+ /* Its section must be `split`, so the dialog hands the pane its whole height instead of a padded scrolling column. */
15
10
  export function MasterDetail(t0) {
16
11
  const $ = _c(15);
17
12
  const {
@@ -84,7 +79,6 @@ export function MasterDetail(t0) {
84
79
  }
85
80
  return t6;
86
81
  }
87
- /* One row of the list. The picked one is lifted a shade. */
88
82
  export function MasterItem(t0) {
89
83
  const $ = _c(9);
90
84
  const {
@@ -295,7 +295,6 @@ function SearchField(t0) {
295
295
  }
296
296
  return t10;
297
297
  }
298
- /* In place of the navigation while a query is typed: the panes and rows that match, each a jump to where it lives. */
299
298
  function SearchResults({
300
299
  search,
301
300
  query,
@@ -336,7 +335,7 @@ function SearchResults({
336
335
  }, `${result.section}:${result.id ?? ''}`))
337
336
  });
338
337
  }
339
- /* Sections on the left, one pane on the right. A pane mounts only while its section is open. */
338
+ /* A pane mounts only while its section is open. */
340
339
  export function SettingsDialog(t0) {
341
340
  const $ = _c(110);
342
341
  const {
@@ -7,7 +7,7 @@ import { useSettingsTarget } from './target.js';
7
7
  /* How long a row a search result jumped to stays lit. */
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const TARGET_MS = 1600;
10
- /* An icon beside text that may wrap: the box is one line of `text-sm` high, so the icon sits on the first line. */
10
+ /* The box is one line of `text-sm` high, so the icon sits on the first line of text that may wrap. */
11
11
  export function TopIcon(t0) {
12
12
  const $ = _c(7);
13
13
  const {
@@ -46,10 +46,7 @@ export function TopIcon(t0) {
46
46
  }
47
47
  return t3;
48
48
  }
49
- /*
50
- * One setting: what it is on the left, the control on the right. Where the two do not fit side by
51
- * side (a tablet, a narrow window) the control wraps under the label instead of widening the dialog.
52
- */
49
+ /* Where label and control do not fit side by side, the control wraps under the label instead of widening the dialog. */
53
50
  export function SettingsRow(t0) {
54
51
  const $ = _c(35);
55
52
  const {
@@ -1,7 +1,7 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { Icon } from "../Icon.js";
4
- /* A titled group of rows in one card; rows divide themselves with a hairline. Without a title it is the card alone. */
4
+ /* Rows divide themselves with a hairline. Without a title it is the card alone. */
5
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  export function SettingsSection(t0) {
7
7
  const $ = _c(20);
@@ -14,11 +14,7 @@ export const registerShortcutHint = (element, shortcut) => {
14
14
  };
15
15
  };
16
16
  export const shortcutHintTargets = () => targets;
17
- /*
18
- * Whether the hints are up: the platform's modifier (Cmd on macOS, Ctrl elsewhere) held on its own for
19
- * `HINT_DELAY_MS`. Any other key, the modifier coming up or the caller cancelling takes them down, so
20
- * a shortcut pressed in passing never flashes them.
21
- */
17
+ /* The platform's modifier held on its own for `HINT_DELAY_MS`; any other key takes the hints down, so a shortcut pressed in passing never flashes them. */
22
18
  export class ModifierHold {
23
19
  apple;
24
20
  onChange;
package/dist/shortcut.js CHANGED
@@ -120,7 +120,7 @@ const KEY_LABELS = {
120
120
  other: '↓'
121
121
  }
122
122
  };
123
- /* The modifiers and the key as separate caps, in the order the platform prints them. */
123
+ /* In the order the platform prints them. */
124
124
  export const shortcutParts = (target, apple) => {
125
125
  const parts = [];
126
126
  if (apple) {
@@ -174,5 +174,4 @@ export const KEY_SHORTCUTS = {
174
174
  shift: /* @__PURE__ */shortcut('Shift'),
175
175
  rename: /* @__PURE__ */shortcut('F2')
176
176
  };
177
- /* Whether the platform's own modifier is down during a pointer gesture: Cmd on macOS, Ctrl elsewhere. */
178
177
  export const isModHeld = (event, apple) => apple ? event.metaKey : event.ctrlKey;
@@ -1,9 +1,4 @@
1
- /*
2
- * The tabs a strip shows, by index, given the width of every tab, the room the strip has, the gap
3
- * between two tabs and the width of the button that opens the rest. Everything fits, or the tabs fit
4
- * from the start up to the button. The kept tabs (the picked one, the pinned ones) are never left to
5
- * the menu: they take the place of the last ones that no longer fit beside them.
6
- */
1
+ /* The kept tabs (the picked one, the pinned ones) never go to the menu: they take the place of the last ones that no longer fit beside them. */
7
2
  export const shownTabs = (widths, room, gap, more, kept) => {
8
3
  const span = indices => indices.reduce((sum, index) => sum + widths[index], 0) + gap * Math.max(0, indices.length - 1);
9
4
  const all = widths.map((_, index) => index);