@eifi1/ui-kit 0.8.1 → 0.10.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 (204) hide show
  1. package/README.md +25 -11
  2. package/dist/components/alert-banner.d.ts +32 -5
  3. package/dist/components/alert-banner.js +57 -14
  4. package/dist/components/alert-banner.js.map +1 -1
  5. package/dist/components/amount-input.d.ts +6 -0
  6. package/dist/components/breadcrumbs.d.ts +60 -0
  7. package/dist/components/breadcrumbs.js +88 -0
  8. package/dist/components/breadcrumbs.js.map +1 -0
  9. package/dist/components/bulk-action-bar.d.ts +66 -0
  10. package/dist/components/bulk-action-bar.js +149 -0
  11. package/dist/components/bulk-action-bar.js.map +1 -0
  12. package/dist/components/calculator.d.ts +6 -0
  13. package/dist/components/chip.d.ts +58 -10
  14. package/dist/components/chip.js +91 -7
  15. package/dist/components/chip.js.map +1 -1
  16. package/dist/components/copy-button.d.ts +13 -4
  17. package/dist/components/copy-button.js +17 -4
  18. package/dist/components/copy-button.js.map +1 -1
  19. package/dist/components/data-table-filter-popover.d.ts +1 -1
  20. package/dist/components/data-table-filters.d.ts +1 -1
  21. package/dist/components/data-table.d.ts +1 -1
  22. package/dist/components/data-table.js +122 -91
  23. package/dist/components/data-table.js.map +1 -1
  24. package/dist/components/date-picker.d.ts +89 -3
  25. package/dist/components/date-picker.js +163 -68
  26. package/dist/components/date-picker.js.map +1 -1
  27. package/dist/components/description-list.d.ts +43 -6
  28. package/dist/components/description-list.js +91 -11
  29. package/dist/components/description-list.js.map +1 -1
  30. package/dist/components/dialog-frame.d.ts +7 -0
  31. package/dist/components/dialog-frame.js.map +1 -1
  32. package/dist/components/disclosure.d.ts +68 -4
  33. package/dist/components/disclosure.js +33 -15
  34. package/dist/components/disclosure.js.map +1 -1
  35. package/dist/components/file-dropzone.d.ts +3 -4
  36. package/dist/components/file-dropzone.js +2 -1
  37. package/dist/components/file-dropzone.js.map +1 -1
  38. package/dist/components/floating-panel.d.ts +29 -2
  39. package/dist/components/floating-panel.js +16 -2
  40. package/dist/components/floating-panel.js.map +1 -1
  41. package/dist/components/full-bleed-dialog.d.ts +23 -4
  42. package/dist/components/full-bleed-dialog.js +11 -2
  43. package/dist/components/full-bleed-dialog.js.map +1 -1
  44. package/dist/components/list.d.ts +174 -0
  45. package/dist/components/list.js +215 -0
  46. package/dist/components/list.js.map +1 -0
  47. package/dist/components/menu-item.d.ts +99 -0
  48. package/dist/components/menu-item.js +83 -0
  49. package/dist/components/menu-item.js.map +1 -0
  50. package/dist/components/modal.d.ts +23 -1
  51. package/dist/components/modal.js +36 -10
  52. package/dist/components/modal.js.map +1 -1
  53. package/dist/components/number-field.d.ts +6 -0
  54. package/dist/components/number-input.d.ts +6 -0
  55. package/dist/components/numpad-sheet.d.ts +6 -0
  56. package/dist/components/page-contents.js +1 -2
  57. package/dist/components/page-contents.js.map +1 -1
  58. package/dist/components/page-header.d.ts +37 -0
  59. package/dist/components/page-header.js +36 -0
  60. package/dist/components/page-header.js.map +1 -0
  61. package/dist/components/progress-bar.d.ts +16 -2
  62. package/dist/components/progress-bar.js +4 -2
  63. package/dist/components/progress-bar.js.map +1 -1
  64. package/dist/components/series-chart-labels.d.ts +3 -0
  65. package/dist/components/series-chart-labels.js +2 -1
  66. package/dist/components/series-chart-labels.js.map +1 -1
  67. package/dist/components/series-chart.d.ts +16 -0
  68. package/dist/components/series-chart.js +137 -3
  69. package/dist/components/series-chart.js.map +1 -1
  70. package/dist/components/status-dot.d.ts +49 -0
  71. package/dist/components/status-dot.js +52 -0
  72. package/dist/components/status-dot.js.map +1 -0
  73. package/dist/components/table.d.ts +39 -6
  74. package/dist/components/table.js +43 -4
  75. package/dist/components/table.js.map +1 -1
  76. package/dist/components/text.d.ts +63 -0
  77. package/dist/components/text.js +23 -0
  78. package/dist/components/text.js.map +1 -0
  79. package/dist/components/toast.d.ts +167 -0
  80. package/dist/components/toast.js +226 -0
  81. package/dist/components/toast.js.map +1 -0
  82. package/dist/components/toggle-group.d.ts +29 -1
  83. package/dist/components/toggle-group.js +52 -3
  84. package/dist/components/toggle-group.js.map +1 -1
  85. package/dist/components/tooltip.d.ts +38 -15
  86. package/dist/components/tooltip.js +85 -47
  87. package/dist/components/tooltip.js.map +1 -1
  88. package/dist/components/ui.d.ts +139 -16
  89. package/dist/components/ui.js +136 -26
  90. package/dist/components/ui.js.map +1 -1
  91. package/dist/components/use-table-state.d.ts +1 -1
  92. package/dist/{data-table-filters-CF1PXqjQ.d.ts → data-table-filters-Dh9uF_S-.d.ts} +33 -2
  93. package/dist/data-table.d.ts +1 -1
  94. package/dist/hooks/use-close-transition.d.ts +7 -1
  95. package/dist/hooks/use-close-transition.js +5 -2
  96. package/dist/hooks/use-close-transition.js.map +1 -1
  97. package/dist/hooks/use-copy-to-clipboard.js +1 -1
  98. package/dist/hooks/use-copy-to-clipboard.js.map +1 -1
  99. package/dist/hooks/use-overlay-history.js +84 -4
  100. package/dist/hooks/use-overlay-history.js.map +1 -1
  101. package/dist/i18n/defaults.d.ts +6 -0
  102. package/dist/i18n/defaults.js +11 -1
  103. package/dist/i18n/defaults.js.map +1 -1
  104. package/dist/i18n/kit-labels.d.ts +11 -0
  105. package/dist/i18n/kit-labels.js.map +1 -1
  106. package/dist/i18n/locales/de-CH-informal.d.ts +6 -0
  107. package/dist/i18n/locales/de-CH.d.ts +6 -0
  108. package/dist/i18n/locales/de-informal.d.ts +6 -0
  109. package/dist/i18n/locales/de.d.ts +6 -0
  110. package/dist/i18n/locales/de.js +31 -1
  111. package/dist/i18n/locales/de.js.map +1 -1
  112. package/dist/i18n/locales/es.d.ts +6 -0
  113. package/dist/i18n/locales/es.js +31 -1
  114. package/dist/i18n/locales/es.js.map +1 -1
  115. package/dist/i18n/locales/fr.d.ts +6 -0
  116. package/dist/i18n/locales/fr.js +31 -1
  117. package/dist/i18n/locales/fr.js.map +1 -1
  118. package/dist/i18n/locales/hu.d.ts +6 -0
  119. package/dist/i18n/locales/hu.js +31 -1
  120. package/dist/i18n/locales/hu.js.map +1 -1
  121. package/dist/i18n/locales/it.d.ts +6 -0
  122. package/dist/i18n/locales/it.js +31 -1
  123. package/dist/i18n/locales/it.js.map +1 -1
  124. package/dist/i18n/locales/zh.d.ts +6 -0
  125. package/dist/i18n/locales/zh.js +31 -1
  126. package/dist/i18n/locales/zh.js.map +1 -1
  127. package/dist/index.d.ts +18 -8
  128. package/dist/index.js +14 -0
  129. package/dist/index.js.map +1 -1
  130. package/dist/lib/clipping.d.ts +9 -0
  131. package/dist/lib/clipping.js +14 -0
  132. package/dist/lib/clipping.js.map +1 -0
  133. package/dist/search/command-palette.d.ts +67 -2
  134. package/dist/search/command-palette.js +147 -33
  135. package/dist/search/command-palette.js.map +1 -1
  136. package/dist/search/global-search.d.ts +166 -0
  137. package/dist/search/global-search.js +293 -0
  138. package/dist/search/global-search.js.map +1 -0
  139. package/dist/search/search-index.d.ts +105 -0
  140. package/dist/search/search-index.js +142 -0
  141. package/dist/search/search-index.js.map +1 -0
  142. package/dist/search.d.ts +3 -1
  143. package/dist/search.js +2 -0
  144. package/dist/search.js.map +1 -1
  145. package/dist/wizard/stepper-nav.d.ts +10 -1
  146. package/dist/wizard/stepper-nav.js +3 -2
  147. package/dist/wizard/stepper-nav.js.map +1 -1
  148. package/dist/wizard/types.d.ts +2 -2
  149. package/dist/wizard/types.js.map +1 -1
  150. package/dist/wizard/use-wizard.js +1 -1
  151. package/dist/wizard/use-wizard.js.map +1 -1
  152. package/dist/wizard/wizard-summary.js +3 -3
  153. package/dist/wizard/wizard-summary.js.map +1 -1
  154. package/package.json +25 -12
  155. package/src/components/alert-banner.tsx +117 -18
  156. package/src/components/breadcrumbs.tsx +168 -0
  157. package/src/components/bulk-action-bar.tsx +256 -0
  158. package/src/components/chip.tsx +164 -13
  159. package/src/components/copy-button.tsx +29 -7
  160. package/src/components/data-table.tsx +81 -5
  161. package/src/components/date-picker.tsx +377 -118
  162. package/src/components/description-list.tsx +168 -15
  163. package/src/components/dialog-frame.tsx +7 -0
  164. package/src/components/disclosure.tsx +116 -28
  165. package/src/components/file-dropzone.tsx +9 -10
  166. package/src/components/floating-panel.tsx +46 -2
  167. package/src/components/full-bleed-dialog.tsx +42 -5
  168. package/src/components/list.tsx +417 -0
  169. package/src/components/menu-item.tsx +214 -0
  170. package/src/components/modal.tsx +80 -17
  171. package/src/components/page-contents.tsx +4 -4
  172. package/src/components/page-header.tsx +68 -0
  173. package/src/components/progress-bar.tsx +27 -3
  174. package/src/components/series-chart-labels.ts +4 -0
  175. package/src/components/series-chart.tsx +253 -3
  176. package/src/components/status-dot.tsx +99 -0
  177. package/src/components/table.tsx +91 -6
  178. package/src/components/text.tsx +89 -0
  179. package/src/components/toast.tsx +441 -0
  180. package/src/components/toggle-group.tsx +82 -3
  181. package/src/components/tooltip.tsx +186 -100
  182. package/src/components/ui.tsx +321 -41
  183. package/src/hooks/use-close-transition.ts +14 -5
  184. package/src/hooks/use-copy-to-clipboard.ts +1 -1
  185. package/src/hooks/use-overlay-history.ts +181 -4
  186. package/src/i18n/defaults.ts +10 -0
  187. package/src/i18n/kit-labels.tsx +10 -0
  188. package/src/i18n/locales/de.ts +30 -0
  189. package/src/i18n/locales/es.ts +30 -0
  190. package/src/i18n/locales/fr.ts +30 -0
  191. package/src/i18n/locales/hu.ts +30 -0
  192. package/src/i18n/locales/it.ts +30 -0
  193. package/src/i18n/locales/zh.ts +30 -0
  194. package/src/index.ts +30 -0
  195. package/src/lib/clipping.ts +16 -0
  196. package/src/search/command-palette.tsx +241 -31
  197. package/src/search/global-search.tsx +525 -0
  198. package/src/search/search-index.ts +295 -0
  199. package/src/search.ts +2 -0
  200. package/src/wizard/stepper-nav.tsx +13 -2
  201. package/src/wizard/types.ts +2 -2
  202. package/src/wizard/use-wizard.ts +3 -3
  203. package/src/wizard/wizard-summary.tsx +14 -10
  204. package/tokens.css +97 -0
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { SortState } from './data-table-sort.js';
3
- import { b as DataTableColumn, F as FilterState } from '../data-table-filters-CF1PXqjQ.js';
3
+ import { b as DataTableColumn, F as FilterState } from '../data-table-filters-Dh9uF_S-.js';
4
4
  import './swipeable-row.js';
5
5
  import './data-table-labels.js';
6
6
 
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, TdHTMLAttributes, ThHTMLAttributes } from 'react';
3
3
  import { SortDir, SortState, SortCycle } from './components/data-table-sort.js';
4
4
  import { SwipeAction } from './components/swipeable-row.js';
5
5
  import { DataTableLabels } from './components/data-table-labels.js';
@@ -36,7 +36,38 @@ interface DataTableColumn<T> {
36
36
  * Default `"asc"`.
37
37
  */
38
38
  firstSort?: SortDir;
39
+ /**
40
+ * Extra attributes for this column's `<td>` in a given row — a `data-*` hook, a
41
+ * `title`, an `aria-describedby`, a class. keksdose's accounts page
42
+ * (accounts-page.tsx, the name and IBAN columns) is why it exists: its demo mode
43
+ * blurs everything marked `data-private`, and with nowhere to put the marker on the
44
+ * cell it wrapped every value in an inner `<span data-private>` — which blurs the
45
+ * text but not the cell, and has to be remembered in every `cell` renderer.
46
+ *
47
+ * MERGED under the kit's own, which win: `className` is joined before the column's
48
+ * `className` (so the column's alignment is still the alignment), `style` is laid
49
+ * under a resized column's pinned width, and `data-col` and a `role` stay the
50
+ * table's — `data-col` is how a resize finds the column's cells, and a `<td>` that
51
+ * claims another role leaves its row's cell count wrong for a screen reader.
52
+ *
53
+ * On a phone the card field (`<dd>`, or the primary line) gets the `data-*`
54
+ * attributes only: the rest — padding classes, `colSpan`, a width — describe a
55
+ * table cell and would mean something else, or nothing, on a card.
56
+ */
57
+ cellProps?: (row: T) => DataTableCellProps | undefined;
58
+ /** The same for the column's `<th>`, once. `scope`, `aria-sort`, `data-col` and the
59
+ * width a resize pins stay the table's, and the class list goes before
60
+ * `headClassName` for the same reason as in {@link cellProps}. */
61
+ headProps?: DataTableHeadProps;
39
62
  }
63
+ /** A `data-*` attribute, typed so `{ "data-private": "" }` needs no cast. */
64
+ type DataAttributes = {
65
+ [key: `data-${string}`]: string | number | boolean | undefined;
66
+ };
67
+ /** What {@link DataTableColumn.cellProps} may return. */
68
+ type DataTableCellProps = TdHTMLAttributes<HTMLTableCellElement> & DataAttributes;
69
+ /** What {@link DataTableColumn.headProps} takes. */
70
+ type DataTableHeadProps = ThHTMLAttributes<HTMLTableCellElement> & DataAttributes;
40
71
  interface ServerPagination {
41
72
  page: number;
42
73
  pageSize: number;
@@ -383,4 +414,4 @@ declare function decodeFilterValueOfType(type: FilterValue["type"], raw: string)
383
414
  /** Inverse of {@link encodeFilterValue}, typed by the column's filter config. */
384
415
  declare function decodeFilterValue<T>(filter: ColumnFilter<T>, raw: string): FilterValue;
385
416
 
386
- export { type ColumnFilter as C, DataTable as D, type FilterState as F, type MobileSwipeActions as M, type ServerPagination as S, type DataTableChrome as a, type DataTableColumn as b, type DataTableDensity as c, type DataTableProps as d, type FilterValue as e, decodeFilterValue as f, decodeFilterValueOfType as g, defaultFilterState as h, encodeFilterValue as i, isFilterActive as j, rowMatches as k, resolveFilter as r };
417
+ export { type ColumnFilter as C, DataTable as D, type FilterState as F, type MobileSwipeActions as M, type ServerPagination as S, type DataTableChrome as a, type DataTableColumn as b, type DataTableDensity as c, type DataTableProps as d, type FilterValue as e, decodeFilterValue as f, decodeFilterValueOfType as g, defaultFilterState as h, encodeFilterValue as i, isFilterActive as j, rowMatches as k, type DataTableCellProps as l, type DataTableHeadProps as m, resolveFilter as r };
@@ -1,6 +1,6 @@
1
1
  export { DEFAULT_DATA_TABLE_LABELS, DataTableLabels, missingDataTableLabels, resolveDataTableLabels } from './components/data-table-labels.js';
2
2
  export { SortCycle, SortDir, SortState, SortStepOptions, decodeSorts, encodeSorts, nextSorts, normalizeSorts } from './components/data-table-sort.js';
3
- export { C as ColumnFilter, D as DataTable, a as DataTableChrome, b as DataTableColumn, c as DataTableDensity, d as DataTableProps, F as FilterState, e as FilterValue, M as MobileSwipeActions, S as ServerPagination, f as decodeFilterValue, g as decodeFilterValueOfType, h as defaultFilterState, i as encodeFilterValue, j as isFilterActive, r as resolveFilter, k as rowMatches } from './data-table-filters-CF1PXqjQ.js';
3
+ export { C as ColumnFilter, D as DataTable, a as DataTableChrome, b as DataTableColumn, c as DataTableDensity, d as DataTableProps, F as FilterState, e as FilterValue, M as MobileSwipeActions, S as ServerPagination, f as decodeFilterValue, g as decodeFilterValueOfType, h as defaultFilterState, i as encodeFilterValue, j as isFilterActive, r as resolveFilter, k as rowMatches } from './data-table-filters-Dh9uF_S-.js';
4
4
  export { PAGE_SIZE_OPTIONS, Pagination } from './components/data-table-pagination.js';
5
5
  export { FilterPopover } from './components/data-table-filter-popover.js';
6
6
  import 'react';
@@ -3,6 +3,12 @@
3
3
  * for. Exported so a test can advance a fake clock by the real number rather than
4
4
  * by a copy of it. */
5
5
  declare const OVERLAY_EXIT_MS = 220;
6
+ /**
7
+ * Whether the user has asked for no motion, read NOW. `true` where `matchMedia` is
8
+ * absent (jsdom, SSR): nothing is painting there, so "no animation" is the only
9
+ * correct answer. Shared by every exit timer in the package, so they agree.
10
+ */
11
+ declare function prefersReducedMotion(): boolean;
6
12
  /**
7
13
  * The state machine an exit animation needs, written once for every overlay in this
8
14
  * package (Keksdose live #320 rework: *"Recognized the opening transition. Choose
@@ -38,4 +44,4 @@ declare function useCloseTransition(onClose: () => void, ms?: number): {
38
44
  requestClose: () => void;
39
45
  };
40
46
 
41
- export { OVERLAY_EXIT_MS, useCloseTransition };
47
+ export { OVERLAY_EXIT_MS, prefersReducedMotion, useCloseTransition };
@@ -1,6 +1,9 @@
1
1
  "use client";
2
2
  import { useCallback, useEffect, useRef, useState } from "react";
3
3
  const OVERLAY_EXIT_MS = 220;
4
+ function prefersReducedMotion() {
5
+ return typeof window === "undefined" || typeof window.matchMedia !== "function" || window.matchMedia("(prefers-reduced-motion: reduce)").matches;
6
+ }
4
7
  function useCloseTransition(onClose, ms = OVERLAY_EXIT_MS) {
5
8
  const [closing, setClosing] = useState(false);
6
9
  const timer = useRef(null);
@@ -16,8 +19,7 @@ function useCloseTransition(onClose, ms = OVERLAY_EXIT_MS) {
16
19
  );
17
20
  const requestClose = useCallback(() => {
18
21
  if (timer.current) return;
19
- const reduced = typeof window === "undefined" || typeof window.matchMedia !== "function" || window.matchMedia("(prefers-reduced-motion: reduce)").matches;
20
- if (reduced || ms <= 0) {
22
+ if (prefersReducedMotion() || ms <= 0) {
21
23
  latest.current();
22
24
  return;
23
25
  }
@@ -32,6 +34,7 @@ function useCloseTransition(onClose, ms = OVERLAY_EXIT_MS) {
32
34
  }
33
35
  export {
34
36
  OVERLAY_EXIT_MS,
37
+ prefersReducedMotion,
35
38
  useCloseTransition
36
39
  };
37
40
  //# sourceMappingURL=use-close-transition.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/use-close-transition.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\n/** How long the exit animation runs, in ms. Mirrors `.animate-sheet-out` in\n * tokens.css — the sheet is the slower of the two, so it is what the unmount waits\n * for. Exported so a test can advance a fake clock by the real number rather than\n * by a copy of it. */\nexport const OVERLAY_EXIT_MS = 220;\n\n/**\n * The state machine an exit animation needs, written once for every overlay in this\n * package (Keksdose live #320 rework: *\"Recognized the opening transition. Choose\n * transition should be the same, only backwards\"*).\n *\n * ## Why a hook and not a class on the panel\n *\n * An enter animation is free: the element mounts, the keyframes run. An exit is not —\n * by the time the state says \"closed\" the element is already gone, so something has to\n * hold it on screen for exactly as long as the animation lasts. That something cannot\n * be the caller (every caller would need the same timer) and it cannot be the panel's\n * markup. It is this: the overlay's own affordances call {@link requestClose} instead\n * of `onClose`, render the `-out` classes while `closing` is true, and the real\n * `onClose` — the one that unmounts them — fires when the animation has finished.\n *\n * ## What it deliberately does not do\n *\n * It does not intercept a close the CALLER decides on. A dialog that closes itself\n * after a successful save sets its own state and unmounts, with no exit animation, and\n * that is the right trade: making it otherwise would mean every overlay owning an\n * `open` prop and every caller waiting on a callback to learn when its own state took\n * effect. What is animated is what the user dismissed — the X, the backdrop, Escape,\n * the Back gesture — which is the motion the row was about.\n *\n * ## Reduced motion\n *\n * Closes immediately, without the delay. A user who has asked for no motion must not\n * be made to wait 220ms for an animation they are not being shown, and the `-out`\n * classes are never applied, so tokens.css needs no reduced-motion rule for them.\n */\nexport function useCloseTransition(\n onClose: () => void,\n ms: number = OVERLAY_EXIT_MS,\n): { closing: boolean; requestClose: () => void } {\n const [closing, setClosing] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n // Latest-ref rather than a dependency: callers pass inline arrows, so a dependency\n // would hand every render a new `requestClose` — and this one is read once, by a\n // timer that has already been scheduled. Assigned in an effect, never during render\n // (`react-hooks/refs`), matching `use-long-press.ts` next door.\n const latest = useRef(onClose);\n useEffect(() => {\n latest.current = onClose;\n });\n\n // One timer, ever. A second Escape while the panel is already leaving must not\n // schedule a second unmount — two `onClose` calls is a caller's state machine being\n // run twice, which is how a \"close\" ends up also discarding the row behind it.\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n [],\n );\n\n const requestClose = useCallback(() => {\n if (timer.current) return;\n // Read at close time, not at mount: the setting can change under a long-lived\n // page, and `matchMedia` is absent in jsdom and in SSR — where \"no animation\" is\n // also the only correct answer, since nothing is painting.\n const reduced =\n typeof window === \"undefined\" ||\n typeof window.matchMedia !== \"function\" ||\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n if (reduced || ms <= 0) {\n latest.current();\n return;\n }\n setClosing(true);\n timer.current = setTimeout(() => {\n timer.current = null;\n // ⚠️ Reset BEFORE handing control back — reported from a phone within the hour\n // of the 0.4.52 deploy that first shipped this hook, against every table at once.\n // A panel that returns `null` while closed is still MOUNTED — `FullBleedDialog`\n // early-returns after its hooks, and DataTable renders it once and flips `open`\n // — so this state outlives the panel it describes. Left true, the NEXT open\n // rendered `animate-*-out` with `animation-fill-mode: forwards` on a sheet that\n // had only just arrived: it lowered itself off the screen in 220ms and stayed\n // there, invisible but still holding the backdrop's pointer events. Every table\n // on every phone, first open fine and every one after it not, until a route\n // change remounted the component.\n //\n // Batched with the `onClose` below, so a caller that unmounts on close still\n // renders exactly once and nothing flashes.\n setClosing(false);\n latest.current();\n }, ms);\n }, [ms]);\n\n return { closing, requestClose };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAMlD,MAAM,kBAAkB;AAgCxB,SAAS,mBACd,SACA,KAAa,iBACmC;AAChD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,QAAQ,OAA6C,IAAI;AAK/D,QAAM,SAAS,OAAO,OAAO;AAC7B,YAAU,MAAM;AACd,WAAO,UAAU;AAAA,EACnB,CAAC;AAKD;AAAA,IACE,MAAM,MAAM;AACV,UAAI,MAAM,QAAS,cAAa,MAAM,OAAO;AAAA,IAC/C;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,eAAe,YAAY,MAAM;AACrC,QAAI,MAAM,QAAS;AAInB,UAAM,UACJ,OAAO,WAAW,eAClB,OAAO,OAAO,eAAe,cAC7B,OAAO,WAAW,kCAAkC,EAAE;AACxD,QAAI,WAAW,MAAM,GAAG;AACtB,aAAO,QAAQ;AACf;AAAA,IACF;AACA,eAAW,IAAI;AACf,UAAM,UAAU,WAAW,MAAM;AAC/B,YAAM,UAAU;AAchB,iBAAW,KAAK;AAChB,aAAO,QAAQ;AAAA,IACjB,GAAG,EAAE;AAAA,EACP,GAAG,CAAC,EAAE,CAAC;AAEP,SAAO,EAAE,SAAS,aAAa;AACjC;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/use-close-transition.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\n/** How long the exit animation runs, in ms. Mirrors `.animate-sheet-out` in\n * tokens.css — the sheet is the slower of the two, so it is what the unmount waits\n * for. Exported so a test can advance a fake clock by the real number rather than\n * by a copy of it. */\nexport const OVERLAY_EXIT_MS = 220;\n\n/**\n * Whether the user has asked for no motion, read NOW. `true` where `matchMedia` is\n * absent (jsdom, SSR): nothing is painting there, so \"no animation\" is the only\n * correct answer. Shared by every exit timer in the package, so they agree.\n */\nexport function prefersReducedMotion(): boolean {\n return (\n typeof window === \"undefined\" ||\n typeof window.matchMedia !== \"function\" ||\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n );\n}\n\n/**\n * The state machine an exit animation needs, written once for every overlay in this\n * package (Keksdose live #320 rework: *\"Recognized the opening transition. Choose\n * transition should be the same, only backwards\"*).\n *\n * ## Why a hook and not a class on the panel\n *\n * An enter animation is free: the element mounts, the keyframes run. An exit is not —\n * by the time the state says \"closed\" the element is already gone, so something has to\n * hold it on screen for exactly as long as the animation lasts. That something cannot\n * be the caller (every caller would need the same timer) and it cannot be the panel's\n * markup. It is this: the overlay's own affordances call {@link requestClose} instead\n * of `onClose`, render the `-out` classes while `closing` is true, and the real\n * `onClose` — the one that unmounts them — fires when the animation has finished.\n *\n * ## What it deliberately does not do\n *\n * It does not intercept a close the CALLER decides on. A dialog that closes itself\n * after a successful save sets its own state and unmounts, with no exit animation, and\n * that is the right trade: making it otherwise would mean every overlay owning an\n * `open` prop and every caller waiting on a callback to learn when its own state took\n * effect. What is animated is what the user dismissed — the X, the backdrop, Escape,\n * the Back gesture — which is the motion the row was about.\n *\n * ## Reduced motion\n *\n * Closes immediately, without the delay. A user who has asked for no motion must not\n * be made to wait 220ms for an animation they are not being shown, and the `-out`\n * classes are never applied, so tokens.css needs no reduced-motion rule for them.\n */\nexport function useCloseTransition(\n onClose: () => void,\n ms: number = OVERLAY_EXIT_MS,\n): { closing: boolean; requestClose: () => void } {\n const [closing, setClosing] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n // Latest-ref rather than a dependency: callers pass inline arrows, so a dependency\n // would hand every render a new `requestClose` — and this one is read once, by a\n // timer that has already been scheduled. Assigned in an effect, never during render\n // (`react-hooks/refs`), matching `use-long-press.ts` next door.\n const latest = useRef(onClose);\n useEffect(() => {\n latest.current = onClose;\n });\n\n // One timer, ever. A second Escape while the panel is already leaving must not\n // schedule a second unmount — two `onClose` calls is a caller's state machine being\n // run twice, which is how a \"close\" ends up also discarding the row behind it.\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n [],\n );\n\n const requestClose = useCallback(() => {\n if (timer.current) return;\n // Read at close time, not at mount: the setting can change under a long-lived\n // page, and `matchMedia` is absent in jsdom and in SSR — where \"no animation\" is\n // also the only correct answer, since nothing is painting.\n if (prefersReducedMotion() || ms <= 0) {\n latest.current();\n return;\n }\n setClosing(true);\n timer.current = setTimeout(() => {\n timer.current = null;\n // ⚠️ Reset BEFORE handing control back — reported from a phone within the hour\n // of the 0.4.52 deploy that first shipped this hook, against every table at once.\n // A panel that returns `null` while closed is still MOUNTED — `FullBleedDialog`\n // early-returns after its hooks, and DataTable renders it once and flips `open`\n // — so this state outlives the panel it describes. Left true, the NEXT open\n // rendered `animate-*-out` with `animation-fill-mode: forwards` on a sheet that\n // had only just arrived: it lowered itself off the screen in 220ms and stayed\n // there, invisible but still holding the backdrop's pointer events. Every table\n // on every phone, first open fine and every one after it not, until a route\n // change remounted the component.\n //\n // Batched with the `onClose` below, so a caller that unmounts on close still\n // renders exactly once and nothing flashes.\n setClosing(false);\n latest.current();\n }, ms);\n }, [ms]);\n\n return { closing, requestClose };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAMlD,MAAM,kBAAkB;AAOxB,SAAS,uBAAgC;AAC9C,SACE,OAAO,WAAW,eAClB,OAAO,OAAO,eAAe,cAC7B,OAAO,WAAW,kCAAkC,EAAE;AAE1D;AAgCO,SAAS,mBACd,SACA,KAAa,iBACmC;AAChD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,QAAQ,OAA6C,IAAI;AAK/D,QAAM,SAAS,OAAO,OAAO;AAC7B,YAAU,MAAM;AACd,WAAO,UAAU;AAAA,EACnB,CAAC;AAKD;AAAA,IACE,MAAM,MAAM;AACV,UAAI,MAAM,QAAS,cAAa,MAAM,OAAO;AAAA,IAC/C;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,eAAe,YAAY,MAAM;AACrC,QAAI,MAAM,QAAS;AAInB,QAAI,qBAAqB,KAAK,MAAM,GAAG;AACrC,aAAO,QAAQ;AACf;AAAA,IACF;AACA,eAAW,IAAI;AACf,UAAM,UAAU,WAAW,MAAM;AAC/B,YAAM,UAAU;AAchB,iBAAW,KAAK;AAChB,aAAO,QAAQ;AAAA,IACjB,GAAG,EAAE;AAAA,EACP,GAAG,CAAC,EAAE,CAAC;AAEP,SAAO,EAAE,SAAS,aAAa;AACjC;","names":[]}
@@ -15,7 +15,7 @@ function legacyCopy(text) {
15
15
  area.style.opacity = "0";
16
16
  document.body.appendChild(area);
17
17
  area.select();
18
- let ok = false;
18
+ let ok;
19
19
  try {
20
20
  ok = document.execCommand("copy");
21
21
  } catch {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/use-copy-to-clipboard.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport type CopyState = \"idle\" | \"copied\" | \"failed\";\n\nexport interface UseCopyToClipboardOptions {\n /** How long `copied` / `failed` stays up before the state returns to `idle`, in\n * ms. `0` keeps it until the next copy or {@link UseCopyToClipboardReturn.reset}. */\n resetAfter?: number;\n}\n\nexport interface UseCopyToClipboardReturn {\n state: CopyState;\n /** Copy `text`. Resolves to whether it actually reached the clipboard — the same\n * answer `state` gives, for a caller that wants to act on it directly. */\n copy: (text: string) => Promise<boolean>;\n reset: () => void;\n}\n\n/**\n * The legacy path: select a throwaway `<textarea>` and ask the document to copy it.\n *\n * `navigator.clipboard` exists only in a secure context, so an app opened over plain\n * http on a LAN address (how keksdose is tested on a phone) has no Clipboard API at\n * all. `execCommand(\"copy\")` is deprecated but still implemented everywhere, and it\n * answers with a boolean, which is all this needs. Focus and the user's selection are\n * put back afterwards: copying must not move the keyboard.\n */\nfunction legacyCopy(text: string): boolean {\n if (typeof document === \"undefined\" || typeof document.execCommand !== \"function\") return false;\n const active = document.activeElement as HTMLElement | null;\n const selection = document.getSelection();\n const ranges: Range[] = [];\n if (selection) for (let i = 0; i < selection.rangeCount; i++) ranges.push(selection.getRangeAt(i));\n\n const area = document.createElement(\"textarea\");\n area.value = text;\n area.setAttribute(\"readonly\", \"\");\n // Off-screen but rendered: a `display: none` textarea cannot be selected.\n area.style.position = \"fixed\";\n area.style.top = \"0\";\n area.style.insetInlineStart = \"-9999px\";\n area.style.opacity = \"0\";\n document.body.appendChild(area);\n area.select();\n let ok = false;\n try {\n ok = document.execCommand(\"copy\");\n } catch {\n ok = false;\n }\n area.remove();\n if (selection) {\n selection.removeAllRanges();\n for (const r of ranges) selection.addRange(r);\n }\n active?.focus?.();\n return ok;\n}\n\n/** Copy `text`, by the Clipboard API when there is one and the legacy path when\n * there is not — or when the API refuses (a denied permission, a document that is\n * not focused). Never throws. */\nexport async function copyToClipboard(text: string): Promise<boolean> {\n const clipboard = typeof navigator !== \"undefined\" ? navigator.clipboard : undefined;\n if (clipboard && typeof clipboard.writeText === \"function\") {\n try {\n await clipboard.writeText(text);\n return true;\n } catch {\n // Fall through: the API exists but refused. The legacy path sometimes succeeds\n // where the permission prompt was dismissed.\n }\n }\n return legacyCopy(text);\n}\n\n/**\n * Copy text and KNOW whether it worked.\n *\n * keksdose had two copy buttons that flipped to \"Copied\" on click and never looked at\n * the promise — so on the http LAN build, where there is no Clipboard API, they\n * confirmed a copy that had not happened. The state here is set from the result, and\n * a failure is a state of its own rather than a quiet return to idle.\n */\nexport function useCopyToClipboard({ resetAfter = 2000 }: UseCopyToClipboardOptions = {}): UseCopyToClipboardReturn {\n const [state, setState] = useState<CopyState>(\"idle\");\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n if (timer.current) clearTimeout(timer.current);\n };\n }, []);\n\n const reset = useCallback(() => {\n if (timer.current) clearTimeout(timer.current);\n timer.current = null;\n setState(\"idle\");\n }, []);\n\n const copy = useCallback(\n async (text: string) => {\n if (timer.current) clearTimeout(timer.current);\n const ok = await copyToClipboard(text);\n if (!mounted.current) return ok;\n setState(ok ? \"copied\" : \"failed\");\n if (resetAfter > 0) {\n timer.current = setTimeout(() => {\n timer.current = null;\n setState(\"idle\");\n }, resetAfter);\n }\n return ok;\n },\n [resetAfter],\n );\n\n return { state, copy, reset };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AA2BzD,SAAS,WAAW,MAAuB;AACzC,MAAI,OAAO,aAAa,eAAe,OAAO,SAAS,gBAAgB,WAAY,QAAO;AAC1F,QAAM,SAAS,SAAS;AACxB,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,SAAkB,CAAC;AACzB,MAAI,UAAW,UAAS,IAAI,GAAG,IAAI,UAAU,YAAY,IAAK,QAAO,KAAK,UAAU,WAAW,CAAC,CAAC;AAEjG,QAAM,OAAO,SAAS,cAAc,UAAU;AAC9C,OAAK,QAAQ;AACb,OAAK,aAAa,YAAY,EAAE;AAEhC,OAAK,MAAM,WAAW;AACtB,OAAK,MAAM,MAAM;AACjB,OAAK,MAAM,mBAAmB;AAC9B,OAAK,MAAM,UAAU;AACrB,WAAS,KAAK,YAAY,IAAI;AAC9B,OAAK,OAAO;AACZ,MAAI,KAAK;AACT,MAAI;AACF,SAAK,SAAS,YAAY,MAAM;AAAA,EAClC,QAAQ;AACN,SAAK;AAAA,EACP;AACA,OAAK,OAAO;AACZ,MAAI,WAAW;AACb,cAAU,gBAAgB;AAC1B,eAAW,KAAK,OAAQ,WAAU,SAAS,CAAC;AAAA,EAC9C;AACA,UAAQ,QAAQ;AAChB,SAAO;AACT;AAKA,eAAsB,gBAAgB,MAAgC;AACpE,QAAM,YAAY,OAAO,cAAc,cAAc,UAAU,YAAY;AAC3E,MAAI,aAAa,OAAO,UAAU,cAAc,YAAY;AAC1D,QAAI;AACF,YAAM,UAAU,UAAU,IAAI;AAC9B,aAAO;AAAA,IACT,QAAQ;AAAA,IAGR;AAAA,EACF;AACA,SAAO,WAAW,IAAI;AACxB;AAUO,SAAS,mBAAmB,EAAE,aAAa,IAAK,IAA+B,CAAC,GAA6B;AAClH,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB,MAAM;AACpD,QAAM,QAAQ,OAA6C,IAAI;AAC/D,QAAM,UAAU,OAAO,IAAI;AAE3B,YAAU,MAAM;AACd,YAAQ,UAAU;AAClB,WAAO,MAAM;AACX,cAAQ,UAAU;AAClB,UAAI,MAAM,QAAS,cAAa,MAAM,OAAO;AAAA,IAC/C;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ,YAAY,MAAM;AAC9B,QAAI,MAAM,QAAS,cAAa,MAAM,OAAO;AAC7C,UAAM,UAAU;AAChB,aAAS,MAAM;AAAA,EACjB,GAAG,CAAC,CAAC;AAEL,QAAM,OAAO;AAAA,IACX,OAAO,SAAiB;AACtB,UAAI,MAAM,QAAS,cAAa,MAAM,OAAO;AAC7C,YAAM,KAAK,MAAM,gBAAgB,IAAI;AACrC,UAAI,CAAC,QAAQ,QAAS,QAAO;AAC7B,eAAS,KAAK,WAAW,QAAQ;AACjC,UAAI,aAAa,GAAG;AAClB,cAAM,UAAU,WAAW,MAAM;AAC/B,gBAAM,UAAU;AAChB,mBAAS,MAAM;AAAA,QACjB,GAAG,UAAU;AAAA,MACf;AACA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,SAAO,EAAE,OAAO,MAAM,MAAM;AAC9B;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/use-copy-to-clipboard.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport type CopyState = \"idle\" | \"copied\" | \"failed\";\n\nexport interface UseCopyToClipboardOptions {\n /** How long `copied` / `failed` stays up before the state returns to `idle`, in\n * ms. `0` keeps it until the next copy or {@link UseCopyToClipboardReturn.reset}. */\n resetAfter?: number;\n}\n\nexport interface UseCopyToClipboardReturn {\n state: CopyState;\n /** Copy `text`. Resolves to whether it actually reached the clipboard — the same\n * answer `state` gives, for a caller that wants to act on it directly. */\n copy: (text: string) => Promise<boolean>;\n reset: () => void;\n}\n\n/**\n * The legacy path: select a throwaway `<textarea>` and ask the document to copy it.\n *\n * `navigator.clipboard` exists only in a secure context, so an app opened over plain\n * http on a LAN address (how keksdose is tested on a phone) has no Clipboard API at\n * all. `execCommand(\"copy\")` is deprecated but still implemented everywhere, and it\n * answers with a boolean, which is all this needs. Focus and the user's selection are\n * put back afterwards: copying must not move the keyboard.\n */\nfunction legacyCopy(text: string): boolean {\n if (typeof document === \"undefined\" || typeof document.execCommand !== \"function\") return false;\n const active = document.activeElement as HTMLElement | null;\n const selection = document.getSelection();\n const ranges: Range[] = [];\n if (selection) for (let i = 0; i < selection.rangeCount; i++) ranges.push(selection.getRangeAt(i));\n\n const area = document.createElement(\"textarea\");\n area.value = text;\n area.setAttribute(\"readonly\", \"\");\n // Off-screen but rendered: a `display: none` textarea cannot be selected.\n area.style.position = \"fixed\";\n area.style.top = \"0\";\n area.style.insetInlineStart = \"-9999px\";\n area.style.opacity = \"0\";\n document.body.appendChild(area);\n area.select();\n let ok: boolean;\n try {\n ok = document.execCommand(\"copy\");\n } catch {\n ok = false;\n }\n area.remove();\n if (selection) {\n selection.removeAllRanges();\n for (const r of ranges) selection.addRange(r);\n }\n active?.focus?.();\n return ok;\n}\n\n/** Copy `text`, by the Clipboard API when there is one and the legacy path when\n * there is not — or when the API refuses (a denied permission, a document that is\n * not focused). Never throws. */\nexport async function copyToClipboard(text: string): Promise<boolean> {\n const clipboard = typeof navigator !== \"undefined\" ? navigator.clipboard : undefined;\n if (clipboard && typeof clipboard.writeText === \"function\") {\n try {\n await clipboard.writeText(text);\n return true;\n } catch {\n // Fall through: the API exists but refused. The legacy path sometimes succeeds\n // where the permission prompt was dismissed.\n }\n }\n return legacyCopy(text);\n}\n\n/**\n * Copy text and KNOW whether it worked.\n *\n * keksdose had two copy buttons that flipped to \"Copied\" on click and never looked at\n * the promise — so on the http LAN build, where there is no Clipboard API, they\n * confirmed a copy that had not happened. The state here is set from the result, and\n * a failure is a state of its own rather than a quiet return to idle.\n */\nexport function useCopyToClipboard({ resetAfter = 2000 }: UseCopyToClipboardOptions = {}): UseCopyToClipboardReturn {\n const [state, setState] = useState<CopyState>(\"idle\");\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n if (timer.current) clearTimeout(timer.current);\n };\n }, []);\n\n const reset = useCallback(() => {\n if (timer.current) clearTimeout(timer.current);\n timer.current = null;\n setState(\"idle\");\n }, []);\n\n const copy = useCallback(\n async (text: string) => {\n if (timer.current) clearTimeout(timer.current);\n const ok = await copyToClipboard(text);\n if (!mounted.current) return ok;\n setState(ok ? \"copied\" : \"failed\");\n if (resetAfter > 0) {\n timer.current = setTimeout(() => {\n timer.current = null;\n setState(\"idle\");\n }, resetAfter);\n }\n return ok;\n },\n [resetAfter],\n );\n\n return { state, copy, reset };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AA2BzD,SAAS,WAAW,MAAuB;AACzC,MAAI,OAAO,aAAa,eAAe,OAAO,SAAS,gBAAgB,WAAY,QAAO;AAC1F,QAAM,SAAS,SAAS;AACxB,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,SAAkB,CAAC;AACzB,MAAI,UAAW,UAAS,IAAI,GAAG,IAAI,UAAU,YAAY,IAAK,QAAO,KAAK,UAAU,WAAW,CAAC,CAAC;AAEjG,QAAM,OAAO,SAAS,cAAc,UAAU;AAC9C,OAAK,QAAQ;AACb,OAAK,aAAa,YAAY,EAAE;AAEhC,OAAK,MAAM,WAAW;AACtB,OAAK,MAAM,MAAM;A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S,KAAK,WAAW,QAAQ;AACjC,UAAI,aAAa,GAAG;AAClB,cAAM,UAAU,WAAW,MAAM;AAC/B,gBAAM,UAAU;AAChB,mBAAS,MAAM;AAAA,QACjB,GAAG,UAAU;AAAA,MACf;AACA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,SAAO,EAAE,OAAO,MAAM,MAAM;AAC9B;","names":[]}
@@ -3,6 +3,8 @@ import { useEffect, useRef } from "react";
3
3
  const SENTINEL_KEY = "__hbUiOverlayHistory";
4
4
  const stack = [];
5
5
  const pushed = [];
6
+ const buried = /* @__PURE__ */ new Map();
7
+ let lastSeen = null;
6
8
  const consumed = /* @__PURE__ */ new Set();
7
9
  let pendingProgrammatic = 0;
8
10
  let listening = false;
@@ -12,13 +14,81 @@ function runUnwind() {
12
14
  const job = unwind;
13
15
  unwind = null;
14
16
  if (!job) return;
15
- if (currentSentinel() !== job.id || currentHref() !== job.href) return;
17
+ if (currentSentinel() !== job.id || currentHref() !== job.href) {
18
+ if (taggedSentinel() === null) buryUnder(job.entries);
19
+ return;
20
+ }
16
21
  pendingProgrammatic += 1;
17
22
  window.history.go(-job.entries.length);
18
23
  }
19
24
  function currentHref() {
20
25
  return typeof window === "undefined" ? "" : window.location.href;
21
26
  }
27
+ function routerMark() {
28
+ const state = typeof window !== "undefined" ? window.history.state : null;
29
+ if (!state || typeof state !== "object") return { idx: void 0, key: void 0 };
30
+ const { idx, key } = state;
31
+ return { idx: typeof idx === "number" ? idx : void 0, key: typeof key === "string" ? key : void 0 };
32
+ }
33
+ function routeOf(href) {
34
+ try {
35
+ const url = new URL(href);
36
+ const hashRoute = url.hash.startsWith("#/") ? url.hash.split("?")[0] : "";
37
+ return url.origin + url.pathname + hashRoute;
38
+ } catch {
39
+ return href;
40
+ }
41
+ }
42
+ function isStillOn(p) {
43
+ if (routeOf(currentHref()) !== p.route) return false;
44
+ const { idx } = routerMark();
45
+ return idx === void 0 || p.idx === void 0 || idx === p.idx;
46
+ }
47
+ function buryUnder(records) {
48
+ const top = records[records.length - 1];
49
+ const here = routerMark();
50
+ if (!top || top.idx === void 0 || here.idx === void 0) return false;
51
+ let run;
52
+ if (here.idx > top.idx) {
53
+ run = [];
54
+ for (let i = records.length - 1; i >= 0 && records[i].idx === top.idx; i -= 1) run.unshift(records[i]);
55
+ } else if (here.idx === top.idx && !isStillOn(top)) {
56
+ run = [];
57
+ for (let i = records.length - 2; i >= 0 && records[i].idx === top.idx; i -= 1) run.unshift(records[i]);
58
+ } else {
59
+ return false;
60
+ }
61
+ run.forEach((r, i) => {
62
+ buried.set(r.id, {
63
+ idx: top.idx,
64
+ aboveIdx: here.idx,
65
+ belowKey: run[0].key,
66
+ aboveKey: here.key,
67
+ below: i,
68
+ above: run.length - 1 - i
69
+ });
70
+ });
71
+ for (const r of records) forgetPushed(r.id);
72
+ lastSeen = here;
73
+ return true;
74
+ }
75
+ function skipBuried(from) {
76
+ const tag = taggedSentinel();
77
+ const rec = tag !== null ? buried.get(tag) : void 0;
78
+ if (!rec || !from || stack.some((e) => e.id === tag)) return;
79
+ let steps = 0;
80
+ if (from.idx !== void 0 && from.idx > rec.idx || from.key !== void 0 && from.key === rec.aboveKey) {
81
+ steps = -(rec.below + 1);
82
+ } else if (from.idx !== void 0 && // Below the run, or level with it when nothing above it is (a push buried it),
83
+ // or level with it and provably the page beneath (a replace buried it). The
84
+ // router's first entry has no key at all, so an absent key is a key here.
85
+ (from.idx < rec.idx || from.idx === rec.idx && (rec.aboveIdx > rec.idx || from.key === rec.belowKey))) {
86
+ steps = rec.above + 1;
87
+ }
88
+ if (steps === 0) return;
89
+ pendingProgrammatic += 1;
90
+ window.history.go(steps);
91
+ }
22
92
  function forgetPushed(id) {
23
93
  const at = pushed.findIndex((p) => p.id === id);
24
94
  if (at >= 0) pushed.splice(at, 1);
@@ -44,7 +114,8 @@ function currentSentinel() {
44
114
  return tag;
45
115
  }
46
116
  if (standing === null || typeof window === "undefined") return null;
47
- if (!pushed.some((p) => p.id === standing)) {
117
+ const record = pushed.find((p) => p.id === standing);
118
+ if (!record || !isStillOn(record)) {
48
119
  standing = null;
49
120
  return null;
50
121
  }
@@ -53,10 +124,16 @@ function currentSentinel() {
53
124
  }
54
125
  function handlePop() {
55
126
  standing = taggedSentinel();
127
+ const from = lastSeen;
128
+ lastSeen = routerMark();
56
129
  if (pendingProgrammatic > 0) {
57
130
  pendingProgrammatic -= 1;
58
131
  return;
59
132
  }
133
+ closeOnPop();
134
+ skipBuried(from);
135
+ }
136
+ function closeOnPop() {
60
137
  const top = stack[stack.length - 1];
61
138
  if (!top) return;
62
139
  if (currentSentinel() === top.id) return;
@@ -90,13 +167,15 @@ function useOverlayHistory(open, onClose) {
90
167
  unwind = null;
91
168
  window.history.replaceState(marked, "");
92
169
  for (const owed of inherited.slice(0, -1)) pushed.push({ ...owed, dead: true });
93
- pushed.push({ id, href: currentHref(), dead: false });
170
+ const was = inherited[inherited.length - 1];
171
+ pushed.push({ id, href: currentHref(), dead: false, idx: was.idx, key: was.key, route: was.route });
94
172
  standing = id;
95
173
  } else {
96
174
  const under = pushed.findIndex((p) => p.id === currentSentinel());
97
175
  pushed.splice(under + 1);
98
176
  window.history.pushState(marked, "");
99
- pushed.push({ id, href: currentHref(), dead: false });
177
+ const page = routerMark();
178
+ pushed.push({ id, href: currentHref(), dead: false, idx: page.idx, key: page.key, route: routeOf(currentHref()) });
100
179
  standing = id;
101
180
  }
102
181
  return () => {
@@ -105,6 +184,7 @@ function useOverlayHistory(open, onClose) {
105
184
  if (consumed.delete(id)) return;
106
185
  const mine = pushed.findIndex((p) => p.id === id);
107
186
  if (currentSentinel() !== id) {
187
+ if (mine >= 0 && taggedSentinel() === null && buryUnder(pushed.slice(0, pushed.length))) return;
108
188
  if (mine >= 0) pushed[mine].dead = true;
109
189
  return;
110
190
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/use-overlay-history.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\n/**\n * Back closes the overlay, not the page (Keksdose feedback #172).\n *\n * On a phone the Back gesture is the universal \"dismiss this\" — so a dialog or a\n * full-screen search surface that ignores it doesn't merely fail to close: the\n * navigation lands somewhere else entirely, and on a route with nothing beneath it\n * that means leaving the app with the overlay still notionally open.\n *\n * The mechanism is one throwaway, SAME-URL history entry pushed while the overlay is\n * up. Back then pops a same-document entry — no route change, no re-render of the\n * page under it — and this hook turns that pop into `onClose()`. Same trick the\n * transactions page already uses for its unsaved-edit trap\n * (`use-soft-leave-guard.ts`); the two coexist because they use different marker\n * keys AND because `handlePop` only claims a pop that actually consumed OUR entry\n * — a foreign sentinel stacked on top of ours pops back ONTO us, and an overlay\n * that closed on that would vanish mid-edit (feedback #424/#426).\n *\n * Not a URL parameter, deliberately. Encoding \"a dialog is open\" in the address bar\n * makes it shareable and restorable, which is wrong for the overlays this covers —\n * nobody wants to send someone a link that opens a confirm dialog — and it would\n * fight the page-owned `?row=` / `f.*` params that ARE meaningful state.\n *\n * ## Ordering\n *\n * The stack is module-level because correctness here is about order ACROSS\n * instances: every mounted overlay hears the same `popstate`, but only the one whose\n * entry was actually popped may close. Overlays nest and unwind last-in-first-out —\n * a dialog opened from a search surface closes before the surface — so the top of\n * this stack is by construction the entry the browser just popped.\n *\n * ## Not undoing a real navigation\n *\n * The cleanup pops our entry when the overlay closes some other way (a button,\n * Escape, a backdrop click) so history doesn't silently accumulate dead entries. It\n * first checks that our marker is still the CURRENT entry: if the user followed a\n * link while the overlay was open, the router has pushed on top of us, and a blind\n * `history.back()` there would undo their navigation.\n *\n * ## The traversal is deferred\n *\n * And it is *scheduled* rather than issued, because `history.go()` lands a task\n * later while everything this module knows is written synchronously. See\n * {@link Unwind}: an overlay opening inside that window adopts the entry instead\n * of stacking a second one on it, which is what makes the hook survive React\n * StrictMode's mount → clean up → mount (steering-design feedback #49).\n */\nconst SENTINEL_KEY = \"__hbUiOverlayHistory\";\n\ninterface OverlayEntry {\n id: string;\n close: () => void;\n}\n\nconst stack: OverlayEntry[] = [];\n\n/**\n * The sentinels we have PUSHED and not yet unwound, oldest first.\n *\n * The stack above tracks live overlays; this tracks live history entries, and the\n * two come apart in exactly one case — which is the bug this list exists for.\n * Nested overlays that close in the same commit unwind parent-first, so the dialog's\n * cleanup runs while the sheet's entry is still on top of its own. It cannot call\n * `history.back()` there (that would consume the SHEET's entry, and the sheet is\n * about to consume it itself), so its entry was simply abandoned: a husk with no\n * live owner sitting between the user and the page.\n *\n * The user paid for it on the next Back press. It popped the husk, `handlePop` found\n * an empty stack and returned, and nothing visible happened — Back had to be pressed\n * twice to leave the page.\n *\n * So an abandoned entry is recorded as `dead` instead, and whichever overlay DOES\n * get to unwind pays the debt with a single `history.go(-n)`. `href` is what keeps\n * that safe: only dead entries pushed at the address we are still sitting at are\n * unwound, so a router navigation that landed between two sentinels is never\n * reversed on the user's behalf.\n */\ninterface PushedEntry {\n id: string;\n href: string;\n /** Its overlay is gone but the entry is not — someone above owes this pop. */\n dead: boolean;\n}\nconst pushed: PushedEntry[] = [];\n\n/** Entries a real Back press already consumed. Their overlay's cleanup still has to\n * run, and it must not mistake \"my entry is not current\" for \"my entry is buried\"\n * — it has no entry left at all. */\nconst consumed = new Set<string>();\n\n/** Pops WE caused (a cleanup unwinding its own entries) — their `popstate` is\n * bookkeeping, not a user gesture, and must not close a second overlay. A\n * `history.go(-n)` traversal fires exactly ONE popstate however far it travels. */\nlet pendingProgrammatic = 0;\nlet listening = false;\nlet nextId = 0;\n\n/**\n * The unwind a cleanup has asked for and not yet issued.\n *\n * **`history.go()` is asynchronous and everything above is written\n * synchronously**, which is the seam the whole of this block exists to close.\n * The traversal lands a task later, so an overlay that opens in the *same* tick\n * as one that closed used to push its sentinel on top of the entry that was\n * about to be popped — and the pop then took the NEW entry. The overlay left on\n * screen had no entry of its own (so Back no longer closed it) and the old one\n * stayed behind as a husk between the user and their page.\n *\n * That is not an exotic race. **React StrictMode remounts every effect** — mount,\n * clean up, mount again, all in one commit — so in development *every* dialog\n * anyone opened left a husk behind, the position drifted one entry further from\n * the page on each open, and the Back press that was meant to leave the page was\n * spent on something invisible instead (steering-design feedback #49).\n *\n * So the traversal is deferred by a task, and an overlay mounting inside that\n * window **adopts** the entry instead of pushing a second one (see the effect).\n * Adoption is `replaceState` on an entry that is already there: no traversal, no\n * window in which the count can be wrong, and the StrictMode remount costs\n * exactly nothing.\n */\ninterface Unwind {\n timer: ReturnType<typeof setTimeout>;\n /** The sentinel on the entry to leave — the top of `entries`. */\n id: string;\n href: string;\n /** That entry plus the abandoned ones directly beneath it, oldest first. */\n entries: PushedEntry[];\n}\nlet unwind: Unwind | null = null;\n\n/** Issue the deferred traversal, if the ground has not moved under it.\n *\n * A real Back press or a router navigation during the deferred task leaves us\n * somewhere that is not the entry we meant to leave, and going back from there\n * would take something that is not ours. The entries are then simply forgotten\n * rather than handed back as `dead`: a forgotten entry costs one dead Back\n * press, while an over-counted one costs the user a navigation they did make. */\nfunction runUnwind(): void {\n const job = unwind;\n unwind = null;\n if (!job) return;\n if (currentSentinel() !== job.id || currentHref() !== job.href) return;\n pendingProgrammatic += 1;\n window.history.go(-job.entries.length);\n}\n\nfunction currentHref(): string {\n return typeof window === \"undefined\" ? \"\" : window.location.href;\n}\n\nfunction forgetPushed(id: string): void {\n const at = pushed.findIndex((p) => p.id === id);\n if (at >= 0) pushed.splice(at, 1);\n}\n\n/**\n * The sentinel this module believes is on the entry we are standing on.\n *\n * `history.state` is where the tag physically sits, because it is the only\n * per-entry storage a browser has — but it is not this module's storage, so\n * since the 2026-09-22 audit it is no longer read as the last word.\n * The ROUTER owns that object and writes it WHOLE: every\n * `setSearchParams(…, { replace: true })` stamps `{usr, key, idx}` over\n * whatever was there. A `DataTable` with `urlSync` does exactly that, on mount\n * and on every filter change — so an overlay opened from such a table had its\n * tag wiped off the entry it was standing on, and then:\n *\n * * its cleanup read \"not my entry\" and abandoned a live entry as a husk;\n * * the push path below could not find itself in `pushed`, so it discarded\n * every record it had (`splice(0)`) and nothing was ever unwound again;\n * * the StrictMode adoption never matched, so in development every dialog\n * pushed a second entry and the deferred `go(-1)` ate the live one — which\n * is Back no longer closing the overlay at all.\n *\n * So `standing` answers when the tag is gone: a MISSING tag on an entry we have\n * not left is a wipe to repair rather than a verdict. The tag is still read\n * FIRST wherever it is there, because it is the one thing that can see a FOREIGN\n * same-URL entry stacked above ours (feedback #424/#426, below) — module-level\n * bookkeeping cannot, since nobody tells us about someone else's `pushState`.\n */\nlet standing: string | null = null;\n\n/** The tag actually on the current entry, with no repair and no belief. */\nfunction taggedSentinel(): string | null {\n const state = typeof window !== \"undefined\" ? window.history.state : null;\n if (!state || typeof state !== \"object\") return null;\n const id = (state as Record<string, unknown>)[SENTINEL_KEY];\n return typeof id === \"string\" ? id : null;\n}\n\n/** Put our tag back on the current entry, keeping whatever the router has since\n * written there — we are a passenger in that object, not its owner. */\nfunction retag(id: string): void {\n const prev = window.history.state;\n window.history.replaceState(\n { ...(prev && typeof prev === \"object\" ? prev : {}), [SENTINEL_KEY]: id },\n \"\",\n );\n}\n\nfunction currentSentinel(): string | null {\n const tag = taggedSentinel();\n if (tag !== null) {\n standing = tag;\n return tag;\n }\n if (standing === null || typeof window === \"undefined\") return null;\n // Only ever re-stamp an entry we still hold a record for. Without that guard a\n // belief left over from an overlay that is long gone — a tab that has since\n // navigated, a test file that ran another case — would be stamped onto a\n // stranger's entry, and the next cleanup would traverse off it.\n if (!pushed.some((p) => p.id === standing)) {\n standing = null;\n return null;\n }\n retag(standing);\n return standing;\n}\n\nfunction handlePop() {\n // A pop MOVES us, so the belief is stale by definition: re-read it from the\n // entry we have landed on before anything below consults it, or the repair in\n // `currentSentinel` would stamp the entry we just left onto the one we are on.\n standing = taggedSentinel();\n if (pendingProgrammatic > 0) {\n pendingProgrammatic -= 1;\n return;\n }\n // Nothing open → an ordinary navigation, which is none of our business.\n const top = stack[stack.length - 1];\n if (!top) return;\n // We landed back ON the top overlay's own entry, so that entry was NOT what the\n // pop consumed — something stacked ABOVE it was (Keksdose feedback #424/#426).\n // The app layers a second same-URL sentinel of its own on top of ours for the\n // unsaved-edit trap (`use-soft-leave-guard.ts`), and it pops that sentinel every\n // time the form goes back to clean — twice-toggling one field was enough to\n // close the whole dialog. A pop is only ours when the entry we came to rest on\n // is no longer ours: either the layer below (a different overlay's marker) or\n // the plain page entry (none at all).\n if (currentSentinel() === top.id) return;\n stack.pop();\n // The browser consumed this entry, so the overlay's own cleanup has nothing left\n // to unwind and nothing to record as owed.\n consumed.add(top.id);\n forgetPushed(top.id);\n top.close();\n}\n\nfunction ensureListening() {\n if (listening || typeof window === \"undefined\") return;\n window.addEventListener(\"popstate\", handlePop);\n listening = true;\n}\n\n/**\n * Make the platform Back gesture dismiss an overlay.\n *\n * @param open whether the overlay is currently showing. Components that mount\n * only while open (the common case) pass `true`.\n * @param onClose the overlay's own close handler — the same one Escape calls.\n */\nexport function useOverlayHistory(open: boolean, onClose: () => void): void {\n // The listener fires outside React's render, so it reads the latest handler\n // through a ref rather than through the closure the effect captured.\n const closeRef = useRef(onClose);\n useEffect(() => {\n closeRef.current = onClose;\n });\n\n useEffect(() => {\n if (!open || typeof window === \"undefined\") return;\n ensureListening();\n const id = `overlay-${(nextId += 1)}`;\n const entry: OverlayEntry = { id, close: () => closeRef.current() };\n stack.push(entry);\n const prev = window.history.state;\n const marked = { ...(prev && typeof prev === \"object\" ? prev : {}), [SENTINEL_KEY]: id };\n // An entry that is on its way out and that we are still standing on is ours\n // to take over: same URL, same slot, only the marker changes. Pushing a\n // second one on top of it is what used to leave a husk on every StrictMode\n // remount — see {@link Unwind}.\n const adopting = unwind && unwind.id === currentSentinel() && unwind.href === currentHref();\n if (adopting && unwind) {\n clearTimeout(unwind.timer);\n const inherited = unwind.entries;\n unwind = null;\n // Preserve react-router's own `{usr,key,idx}` — we only swap the marker,\n // and the entry we are swapping it on is the one the router is already on.\n window.history.replaceState(marked, \"\");\n // The abandoned ones beneath come back owed; ours takes the top slot.\n for (const owed of inherited.slice(0, -1)) pushed.push({ ...owed, dead: true });\n pushed.push({ id, href: currentHref(), dead: false });\n standing = id;\n } else {\n // A push DESTROYS every entry ahead of the one we are on, so anything we\n // still had recorded above our own position is gone. Kept, those would be\n // counted into a later `history.go(-n)` and the overshoot would come out\n // of a navigation the user actually made. Where we cannot tell which of\n // ours are beneath us — we are standing on a plain page entry, or on a\n // husk nobody tracks — none of them can be proven to be, so none survive.\n const under = pushed.findIndex((p) => p.id === currentSentinel());\n pushed.splice(under + 1);\n // Preserve react-router's own `{usr,key,idx}` — we only tack a marker on, and\n // the URL is unchanged, so the router treats popping this as a no-op re-render.\n window.history.pushState(marked, \"\");\n pushed.push({ id, href: currentHref(), dead: false });\n standing = id;\n }\n return () => {\n const at = stack.indexOf(entry);\n if (at >= 0) stack.splice(at, 1);\n\n // A Back press already took this entry; there is nothing to unwind or to owe.\n if (consumed.delete(id)) return;\n\n const mine = pushed.findIndex((p) => p.id === id);\n // Only unwind an entry that is still THE current one. If a router push landed\n // on top of it, going back would undo the user's navigation instead — and if\n // a SIBLING overlay's sentinel landed on top, that overlay is about to unwind\n // and is the one that can take ours with it.\n if (currentSentinel() !== id) {\n if (mine >= 0) pushed[mine].dead = true;\n return;\n }\n\n // Ours plus every abandoned entry lying directly beneath it at this address.\n // One traversal, so one popstate, so one programmatic pop to absorb.\n const here = currentHref();\n let steps = 1;\n while (steps <= mine && pushed[mine - steps].dead && pushed[mine - steps].href === here) {\n steps += 1;\n }\n const leaving = pushed.splice(mine - (steps - 1), steps);\n // Scheduled, not issued: an overlay opening in this same tick takes the\n // entry over instead, which is what makes the hook survive a StrictMode\n // remount. An unwind already waiting is dropped rather than merged — it\n // was the entry ABOVE ours and something has since moved off it, so its\n // count can no longer be proven, and an over-counted traversal costs a\n // navigation the user made while an under-counted one costs one dead Back.\n if (unwind) clearTimeout(unwind.timer);\n unwind = { timer: setTimeout(runUnwind, 0), id, href: here, entries: leaving };\n };\n }, [open]);\n}\n"],"mappings":";AAAA,SAAS,WAAW,cAAc;AAgDlC,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O,KAAK,EAAE,IAAI,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC;AACpD,iBAAW;AAAA,IACb,OAAO;AAOL,YAAM,QAAQ,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,gBAAgB,CAAC;AAChE,aAAO,OAAO,QAAQ,CAAC;AAGvB,aAAO,QAAQ,UAAU,QAAQ,EAAE;AACnC,aAAO,KAAK,EAAE,IAAI,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC;AACpD,iBAAW;AAAA,IACb;AACA,WAAO,MAAM;AACX,YAAM,KAAK,MAAM,QAAQ,KAAK;AAC9B,UAAI,MAAM,EAAG,OAAM,OAAO,IAAI,CAAC;AAG/B,UAAI,SAAS,OAAO,EAAE,EAAG;AAEzB,YAAM,OAAO,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE;AAKhD,UAAI,gBAAgB,MAAM,IAAI;AAC5B,YAAI,QAAQ,EAAG,QAAO,IAAI,EAAE,OAAO;AACnC;AAAA,MACF;AAIA,YAAM,OAAO,YAAY;AACzB,UAAI,QAAQ;AACZ,aAAO,SAAS,QAAQ,OAAO,OAAO,KAAK,EAAE,QAAQ,OAAO,OAAO,KAAK,EAAE,SAAS,MAAM;AACvF,iBAAS;AAAA,MACX;AACA,YAAM,UAAU,OAAO,OAAO,QAAQ,QAAQ,IAAI,KAAK;AAOvD,UAAI,OAAQ,cAAa,OAAO,KAAK;AACrC,eAAS,EAAE,OAAO,WAAW,WAAW,CAAC,GAAG,IAAI,MAAM,MAAM,SAAS,QAAQ;AAAA,IAC/E;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AACX;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/use-overlay-history.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\n/**\n * Back closes the overlay, not the page (Keksdose feedback #172).\n *\n * On a phone the Back gesture is the universal \"dismiss this\" — so a dialog or a\n * full-screen search surface that ignores it doesn't merely fail to close: the\n * navigation lands somewhere else entirely, and on a route with nothing beneath it\n * that means leaving the app with the overlay still notionally open.\n *\n * The mechanism is one throwaway, SAME-URL history entry pushed while the overlay is\n * up. Back then pops a same-document entry — no route change, no re-render of the\n * page under it — and this hook turns that pop into `onClose()`. Same trick the\n * transactions page already uses for its unsaved-edit trap\n * (`use-soft-leave-guard.ts`); the two coexist because they use different marker\n * keys AND because `handlePop` only claims a pop that actually consumed OUR entry\n * — a foreign sentinel stacked on top of ours pops back ONTO us, and an overlay\n * that closed on that would vanish mid-edit (feedback #424/#426).\n *\n * Not a URL parameter, deliberately. Encoding \"a dialog is open\" in the address bar\n * makes it shareable and restorable, which is wrong for the overlays this covers —\n * nobody wants to send someone a link that opens a confirm dialog — and it would\n * fight the page-owned `?row=` / `f.*` params that ARE meaningful state.\n *\n * ## Ordering\n *\n * The stack is module-level because correctness here is about order ACROSS\n * instances: every mounted overlay hears the same `popstate`, but only the one whose\n * entry was actually popped may close. Overlays nest and unwind last-in-first-out —\n * a dialog opened from a search surface closes before the surface — so the top of\n * this stack is by construction the entry the browser just popped.\n *\n * ## Not undoing a real navigation\n *\n * The cleanup pops our entry when the overlay closes some other way (a button,\n * Escape, a backdrop click) so history doesn't silently accumulate dead entries. It\n * first checks that our marker is still the CURRENT entry: if the user followed a\n * link while the overlay was open, the router has pushed on top of us, and a blind\n * `history.back()` there would undo their navigation.\n *\n * ## The traversal is deferred\n *\n * And it is *scheduled* rather than issued, because `history.go()` lands a task\n * later while everything this module knows is written synchronously. See\n * {@link Unwind}: an overlay opening inside that window adopts the entry instead\n * of stacking a second one on it, which is what makes the hook survive React\n * StrictMode's mount → clean up → mount (steering-design feedback #49).\n */\nconst SENTINEL_KEY = \"__hbUiOverlayHistory\";\n\ninterface OverlayEntry {\n id: string;\n close: () => void;\n}\n\nconst stack: OverlayEntry[] = [];\n\n/**\n * The sentinels we have PUSHED and not yet unwound, oldest first.\n *\n * The stack above tracks live overlays; this tracks live history entries, and the\n * two come apart in exactly one case — which is the bug this list exists for.\n * Nested overlays that close in the same commit unwind parent-first, so the dialog's\n * cleanup runs while the sheet's entry is still on top of its own. It cannot call\n * `history.back()` there (that would consume the SHEET's entry, and the sheet is\n * about to consume it itself), so its entry was simply abandoned: a husk with no\n * live owner sitting between the user and the page.\n *\n * The user paid for it on the next Back press. It popped the husk, `handlePop` found\n * an empty stack and returned, and nothing visible happened — Back had to be pressed\n * twice to leave the page.\n *\n * So an abandoned entry is recorded as `dead` instead, and whichever overlay DOES\n * get to unwind pays the debt with a single `history.go(-n)`. `href` is what keeps\n * that safe: only dead entries pushed at the address we are still sitting at are\n * unwound, so a router navigation that landed between two sentinels is never\n * reversed on the user's behalf.\n */\ninterface PushedEntry {\n id: string;\n href: string;\n /** Its overlay is gone but the entry is not — someone above owes this pop. */\n dead: boolean;\n /** The router's `idx` on this entry when the marker went on — see {@link locate}. */\n idx: number | undefined;\n /** The router's `key` copied from the page entry beneath ours. */\n key: string | undefined;\n /** {@link routeOf} the address the marker was placed at. */\n route: string;\n}\nconst pushed: PushedEntry[] = [];\n\n/**\n * Entries of ours that a ROUTER NAVIGATION made from inside the overlay has left\n * behind — ours, still in the history, but no longer on top and no longer anyone's.\n *\n * Nothing can take an entry out from under a newer one, so they cannot be unwound;\n * what can be done is to not let the user land on one. A traversal that comes to\n * rest on a buried entry is carried straight on over the whole run of them, in the\n * direction it was going (see `skipBuried`): Back from the new page lands on the page\n * the overlay was opened from, Forward from there lands on the new page, and no press\n * is spent on an entry with nothing on screen for it.\n *\n * `below` / `above` count the buried entries of the same run on either side. The\n * router's `idx` tells the direction apart — except after a REPLACE navigation, when\n * the page above the run shares the run's `idx`; the two keys decide there.\n */\ninterface BuriedEntry {\n idx: number;\n /** The `idx` of the router entry that buried the run: higher after a push, the\n * same after a replace. */\n aboveIdx: number;\n /** The key of the page entry directly beneath the run. */\n belowKey: string | undefined;\n /** The key of the router entry that buried the run, when it did. */\n aboveKey: string | undefined;\n below: number;\n above: number;\n}\nconst buried = new Map<string, BuriedEntry>();\n\n/** The router `{idx, key}` of the entry the last traversal (or burial) left us on —\n * what `skipBuried` compares against to know which way the user was going. */\nlet lastSeen: { idx: number | undefined; key: string | undefined } | null = null;\n\n/** Entries a real Back press already consumed. Their overlay's cleanup still has to\n * run, and it must not mistake \"my entry is not current\" for \"my entry is buried\"\n * — it has no entry left at all. */\nconst consumed = new Set<string>();\n\n/** Pops WE caused (a cleanup unwinding its own entries) — their `popstate` is\n * bookkeeping, not a user gesture, and must not close a second overlay. A\n * `history.go(-n)` traversal fires exactly ONE popstate however far it travels. */\nlet pendingProgrammatic = 0;\nlet listening = false;\nlet nextId = 0;\n\n/**\n * The unwind a cleanup has asked for and not yet issued.\n *\n * **`history.go()` is asynchronous and everything above is written\n * synchronously**, which is the seam the whole of this block exists to close.\n * The traversal lands a task later, so an overlay that opens in the *same* tick\n * as one that closed used to push its sentinel on top of the entry that was\n * about to be popped — and the pop then took the NEW entry. The overlay left on\n * screen had no entry of its own (so Back no longer closed it) and the old one\n * stayed behind as a husk between the user and their page.\n *\n * That is not an exotic race. **React StrictMode remounts every effect** — mount,\n * clean up, mount again, all in one commit — so in development *every* dialog\n * anyone opened left a husk behind, the position drifted one entry further from\n * the page on each open, and the Back press that was meant to leave the page was\n * spent on something invisible instead (steering-design feedback #49).\n *\n * So the traversal is deferred by a task, and an overlay mounting inside that\n * window **adopts** the entry instead of pushing a second one (see the effect).\n * Adoption is `replaceState` on an entry that is already there: no traversal, no\n * window in which the count can be wrong, and the StrictMode remount costs\n * exactly nothing.\n */\ninterface Unwind {\n timer: ReturnType<typeof setTimeout>;\n /** The sentinel on the entry to leave — the top of `entries`. */\n id: string;\n href: string;\n /** That entry plus the abandoned ones directly beneath it, oldest first. */\n entries: PushedEntry[];\n}\nlet unwind: Unwind | null = null;\n\n/** Issue the deferred traversal, if the ground has not moved under it.\n *\n * A real Back press or a router navigation during the deferred task leaves us\n * somewhere that is not the entry we meant to leave, and going back from there\n * would take something that is not ours. The entries are then simply forgotten\n * rather than handed back as `dead`: a forgotten entry costs one dead Back\n * press, while an over-counted one costs the user a navigation they did make. */\nfunction runUnwind(): void {\n const job = unwind;\n unwind = null;\n if (!job) return;\n if (currentSentinel() !== job.id || currentHref() !== job.href) {\n // A router navigation landed between the cleanup and this task: the entries\n // are under it (or were replaced by it) rather than simply forgotten.\n if (taggedSentinel() === null) buryUnder(job.entries);\n return;\n }\n pendingProgrammatic += 1;\n window.history.go(-job.entries.length);\n}\n\nfunction currentHref(): string {\n return typeof window === \"undefined\" ? \"\" : window.location.href;\n}\n\n/** The router's own `{idx, key}` on the current entry, where a router has put them. */\nfunction routerMark(): { idx: number | undefined; key: string | undefined } {\n const state = typeof window !== \"undefined\" ? (window.history.state as unknown) : null;\n if (!state || typeof state !== \"object\") return { idx: undefined, key: undefined };\n const { idx, key } = state as Record<string, unknown>;\n return { idx: typeof idx === \"number\" ? idx : undefined, key: typeof key === \"string\" ? key : undefined };\n}\n\n/**\n * The part of an address that names the PAGE — the query string left out.\n *\n * A `setSearchParams(…, { replace: true })` rewrites the query on the entry the\n * overlay is standing on; that is a wipe to repair, not a move. Anything else changing\n * is a navigation. Under a hash router the page lives in the hash (`#/table?f.q=x`), so\n * a hash that starts with `#/` counts up to its own `?`; an ordinary `#fragment` does\n * not name a page and is left out.\n */\nfunction routeOf(href: string): string {\n try {\n const url = new URL(href);\n const hashRoute = url.hash.startsWith(\"#/\") ? url.hash.split(\"?\")[0] : \"\";\n return url.origin + url.pathname + hashRoute;\n } catch {\n return href;\n }\n}\n\n/**\n * Is the untagged entry we are standing on still `p`'s — merely wiped by the router —\n * or an entry the router NAVIGATED to from inside the overlay?\n *\n * The router's `idx` is the one per-entry fact that separates the two, because it is\n * the one the router itself keeps straight: a replace leaves it as it was, a push adds\n * one. Our own push copies the page's state, so our entry carries the page's `idx` and\n * a router push on top of it carries one more. The key would not do — every replace\n * mints a new one, so the wipe this repair exists for would already fail it. Neither\n * would the address alone: a push to the address we are already at is still a push.\n *\n * `idx` does not see one move, the router REPLACING our entry with a different page\n * (same `idx`), so the page named by the address must also be unchanged. Where there is\n * no `idx` to compare (no router, or one that keeps none) the address is all there is.\n */\nfunction isStillOn(p: PushedEntry): boolean {\n if (routeOf(currentHref()) !== p.route) return false;\n const { idx } = routerMark();\n return idx === undefined || p.idx === undefined || idx === p.idx;\n}\n\n/**\n * The router has navigated while our entries were on top: record which of `records`\n * (ours, oldest first, ending with the top one) it buried and which it replaced, and\n * drop them from `pushed` — none of them can be unwound any more. Returns whether it\n * recognised a navigation at all; when it cannot tell (no router `idx` to go by), it\n * leaves everything as it was and the caller falls back to marking the entry dead.\n */\nfunction buryUnder(records: PushedEntry[]): boolean {\n const top = records[records.length - 1];\n const here = routerMark();\n if (!top || top.idx === undefined || here.idx === undefined) return false;\n let run: PushedEntry[];\n if (here.idx > top.idx) {\n run = [];\n for (let i = records.length - 1; i >= 0 && records[i].idx === top.idx; i -= 1) run.unshift(records[i]);\n } else if (here.idx === top.idx && !isStillOn(top)) {\n // Replaced: the top entry IS the new page now, and gone as ours. Those beneath it\n // are buried under it.\n run = [];\n for (let i = records.length - 2; i >= 0 && records[i].idx === top.idx; i -= 1) run.unshift(records[i]);\n } else {\n return false;\n }\n run.forEach((r, i) => {\n buried.set(r.id, {\n idx: top.idx as number,\n aboveIdx: here.idx as number,\n belowKey: run[0].key,\n aboveKey: here.key,\n below: i,\n above: run.length - 1 - i,\n });\n });\n for (const r of records) forgetPushed(r.id);\n lastSeen = here;\n return true;\n}\n\n/**\n * A traversal came to rest on one of our buried entries: carry it on over the run, the\n * way it was going. Back from above (a higher `idx`, or the very entry that buried us)\n * continues down to the page beneath; Forward from that page continues up. A landing\n * from anywhere this cannot place is left alone — one idle press is the price of not\n * guessing, and a wrong guess would move the user somewhere they did not ask to go.\n */\nfunction skipBuried(from: typeof lastSeen): void {\n const tag = taggedSentinel();\n const rec = tag !== null ? buried.get(tag) : undefined;\n if (!rec || !from || stack.some((e) => e.id === tag)) return;\n let steps = 0;\n if ((from.idx !== undefined && from.idx > rec.idx) || (from.key !== undefined && from.key === rec.aboveKey)) {\n steps = -(rec.below + 1);\n } else if (\n from.idx !== undefined &&\n // Below the run, or level with it when nothing above it is (a push buried it),\n // or level with it and provably the page beneath (a replace buried it). The\n // router's first entry has no key at all, so an absent key is a key here.\n (from.idx < rec.idx || (from.idx === rec.idx && (rec.aboveIdx > rec.idx || from.key === rec.belowKey)))\n ) {\n steps = rec.above + 1;\n }\n if (steps === 0) return;\n pendingProgrammatic += 1;\n window.history.go(steps);\n}\n\nfunction forgetPushed(id: string): void {\n const at = pushed.findIndex((p) => p.id === id);\n if (at >= 0) pushed.splice(at, 1);\n}\n\n/**\n * The sentinel this module believes is on the entry we are standing on.\n *\n * `history.state` is where the tag physically sits, because it is the only\n * per-entry storage a browser has — but it is not this module's storage, so\n * since the 2026-09-22 audit it is no longer read as the last word.\n * The ROUTER owns that object and writes it WHOLE: every\n * `setSearchParams(…, { replace: true })` stamps `{usr, key, idx}` over\n * whatever was there. A `DataTable` with `urlSync` does exactly that, on mount\n * and on every filter change — so an overlay opened from such a table had its\n * tag wiped off the entry it was standing on, and then:\n *\n * * its cleanup read \"not my entry\" and abandoned a live entry as a husk;\n * * the push path below could not find itself in `pushed`, so it discarded\n * every record it had (`splice(0)`) and nothing was ever unwound again;\n * * the StrictMode adoption never matched, so in development every dialog\n * pushed a second entry and the deferred `go(-1)` ate the live one — which\n * is Back no longer closing the overlay at all.\n *\n * So `standing` answers when the tag is gone: a MISSING tag on an entry we have\n * not left is a wipe to repair rather than a verdict. The tag is still read\n * FIRST wherever it is there, because it is the one thing that can see a FOREIGN\n * same-URL entry stacked above ours (feedback #424/#426, below) — module-level\n * bookkeeping cannot, since nobody tells us about someone else's `pushState`.\n */\nlet standing: string | null = null;\n\n/** The tag actually on the current entry, with no repair and no belief. */\nfunction taggedSentinel(): string | null {\n const state = typeof window !== \"undefined\" ? window.history.state : null;\n if (!state || typeof state !== \"object\") return null;\n const id = (state as Record<string, unknown>)[SENTINEL_KEY];\n return typeof id === \"string\" ? id : null;\n}\n\n/** Put our tag back on the current entry, keeping whatever the router has since\n * written there — we are a passenger in that object, not its owner. */\nfunction retag(id: string): void {\n const prev = window.history.state;\n window.history.replaceState(\n { ...(prev && typeof prev === \"object\" ? prev : {}), [SENTINEL_KEY]: id },\n \"\",\n );\n}\n\nfunction currentSentinel(): string | null {\n const tag = taggedSentinel();\n if (tag !== null) {\n standing = tag;\n return tag;\n }\n if (standing === null || typeof window === \"undefined\") return null;\n // Only ever re-stamp an entry we still hold a record for. Without that guard a\n // belief left over from an overlay that is long gone — a tab that has since\n // navigated, a test file that ran another case — would be stamped onto a\n // stranger's entry, and the next cleanup would traverse off it.\n //\n // And only an entry that is still the one the marker was placed on. A row that\n // NAVIGATES (a palette result, a dialog's link) has the router push the new page\n // before the overlay's cleanup runs; that entry carries no tag either, and\n // re-stamping it made the cleanup \"unwind\" the navigation itself — the page\n // changed and changed straight back. See `isStillOn` for how the two are told apart.\n const record = pushed.find((p) => p.id === standing);\n if (!record || !isStillOn(record)) {\n standing = null;\n return null;\n }\n retag(standing);\n return standing;\n}\n\nfunction handlePop() {\n // A pop MOVES us, so the belief is stale by definition: re-read it from the\n // entry we have landed on before anything below consults it, or the repair in\n // `currentSentinel` would stamp the entry we just left onto the one we are on.\n standing = taggedSentinel();\n const from = lastSeen;\n lastSeen = routerMark();\n if (pendingProgrammatic > 0) {\n pendingProgrammatic -= 1;\n return;\n }\n closeOnPop();\n skipBuried(from);\n}\n\nfunction closeOnPop() {\n // Nothing open → an ordinary navigation, which is none of our business.\n const top = stack[stack.length - 1];\n if (!top) return;\n // We landed back ON the top overlay's own entry, so that entry was NOT what the\n // pop consumed — something stacked ABOVE it was (Keksdose feedback #424/#426).\n // The app layers a second same-URL sentinel of its own on top of ours for the\n // unsaved-edit trap (`use-soft-leave-guard.ts`), and it pops that sentinel every\n // time the form goes back to clean — twice-toggling one field was enough to\n // close the whole dialog. A pop is only ours when the entry we came to rest on\n // is no longer ours: either the layer below (a different overlay's marker) or\n // the plain page entry (none at all).\n if (currentSentinel() === top.id) return;\n stack.pop();\n // The browser consumed this entry, so the overlay's own cleanup has nothing left\n // to unwind and nothing to record as owed.\n consumed.add(top.id);\n forgetPushed(top.id);\n top.close();\n}\n\nfunction ensureListening() {\n if (listening || typeof window === \"undefined\") return;\n window.addEventListener(\"popstate\", handlePop);\n listening = true;\n}\n\n/**\n * Make the platform Back gesture dismiss an overlay.\n *\n * @param open whether the overlay is currently showing. Components that mount\n * only while open (the common case) pass `true`.\n * @param onClose the overlay's own close handler — the same one Escape calls.\n */\nexport function useOverlayHistory(open: boolean, onClose: () => void): void {\n // The listener fires outside React's render, so it reads the latest handler\n // through a ref rather than through the closure the effect captured.\n const closeRef = useRef(onClose);\n useEffect(() => {\n closeRef.current = onClose;\n });\n\n useEffect(() => {\n if (!open || typeof window === \"undefined\") return;\n ensureListening();\n const id = `overlay-${(nextId += 1)}`;\n const entry: OverlayEntry = { id, close: () => closeRef.current() };\n stack.push(entry);\n const prev = window.history.state;\n const marked = { ...(prev && typeof prev === \"object\" ? prev : {}), [SENTINEL_KEY]: id };\n // An entry that is on its way out and that we are still standing on is ours\n // to take over: same URL, same slot, only the marker changes. Pushing a\n // second one on top of it is what used to leave a husk on every StrictMode\n // remount — see {@link Unwind}.\n const adopting = unwind && unwind.id === currentSentinel() && unwind.href === currentHref();\n if (adopting && unwind) {\n clearTimeout(unwind.timer);\n const inherited = unwind.entries;\n unwind = null;\n // Preserve react-router's own `{usr,key,idx}` — we only swap the marker,\n // and the entry we are swapping it on is the one the router is already on.\n window.history.replaceState(marked, \"\");\n // The abandoned ones beneath come back owed; ours takes the top slot.\n for (const owed of inherited.slice(0, -1)) pushed.push({ ...owed, dead: true });\n const was = inherited[inherited.length - 1];\n pushed.push({ id, href: currentHref(), dead: false, idx: was.idx, key: was.key, route: was.route });\n standing = id;\n } else {\n // A push DESTROYS every entry ahead of the one we are on, so anything we\n // still had recorded above our own position is gone. Kept, those would be\n // counted into a later `history.go(-n)` and the overshoot would come out\n // of a navigation the user actually made. Where we cannot tell which of\n // ours are beneath us — we are standing on a plain page entry, or on a\n // husk nobody tracks — none of them can be proven to be, so none survive.\n const under = pushed.findIndex((p) => p.id === currentSentinel());\n pushed.splice(under + 1);\n // Preserve react-router's own `{usr,key,idx}` — we only tack a marker on, and\n // the URL is unchanged, so the router treats popping this as a no-op re-render.\n window.history.pushState(marked, \"\");\n const page = routerMark();\n pushed.push({ id, href: currentHref(), dead: false, idx: page.idx, key: page.key, route: routeOf(currentHref()) });\n standing = id;\n }\n return () => {\n const at = stack.indexOf(entry);\n if (at >= 0) stack.splice(at, 1);\n\n // A Back press already took this entry; there is nothing to unwind or to owe.\n if (consumed.delete(id)) return;\n\n const mine = pushed.findIndex((p) => p.id === id);\n // Only unwind an entry that is still THE current one. If a router push landed\n // on top of it, going back would undo the user's navigation instead — and if\n // a SIBLING overlay's sentinel landed on top, that overlay is about to unwind\n // and is the one that can take ours with it.\n if (currentSentinel() !== id) {\n // A router navigation from inside the overlay: nothing to unwind — the\n // entries it left beneath the new page are skipped over instead.\n if (mine >= 0 && taggedSentinel() === null && buryUnder(pushed.slice(0, pushed.length))) return;\n if (mine >= 0) pushed[mine].dead = true;\n return;\n }\n\n // Ours plus every abandoned entry lying directly beneath it at this address.\n // One traversal, so one popstate, so one programmatic pop to absorb.\n const here = currentHref();\n let steps = 1;\n while (steps <= mine && pushed[mine - steps].dead && pushed[mine - steps].href === here) {\n steps += 1;\n }\n const leaving = pushed.splice(mine - (steps - 1), steps);\n // Scheduled, not issued: an overlay opening in this same tick takes the\n // entry over instead, which is what makes the hook survive a StrictMode\n // remount. An unwind already waiting is dropped rather than merged — it\n // was the entry ABOVE ours and something has since moved off it, so its\n // count can no longer be proven, and an over-counted traversal costs a\n // navigation the user made while an under-counted one costs one dead Back.\n if (unwind) clearTimeout(unwind.timer);\n unwind = { timer: setTimeout(runUnwind, 0), id, href: here, entries: leaving };\n };\n }, [open]);\n}\n"],"mappings":";AAAA,SAAS,WAAW,cAA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K;AACrC,eAAS,EAAE,OAAO,WAAW,WAAW,CAAC,GAAG,IAAI,MAAM,MAAM,SAAS,QAAQ;AAAA,IAC/E;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AACX;","names":[]}
@@ -12,6 +12,8 @@ import '../hooks/use-anchored-rect.js';
12
12
  import '../wizard/types.js';
13
13
  import '../tour/tour.js';
14
14
  import '../search/command-palette.js';
15
+ import '../search/global-search.js';
16
+ import '../search/search-index.js';
15
17
  import '../components/month-picker.js';
16
18
  import '../components/page-contents.js';
17
19
  import '../components/series-chart-labels.js';
@@ -32,6 +34,10 @@ import '../feedback/feedback-dialog.js';
32
34
  import '../components/confirm-dialog.js';
33
35
  import '../components/floating-panel.js';
34
36
  import '../components/copy-button.js';
37
+ import '../components/bulk-action-bar.js';
38
+ import '../components/list.js';
39
+ import '../components/breadcrumbs.js';
40
+ import '../components/toast.js';
35
41
 
36
42
  /**
37
43
  * The whole English tree in one object: what a translation is written against, and
@@ -10,6 +10,7 @@ import { DEFAULT_PASSWORD_REVEAL_LABELS, DEFAULT_TABS_LABELS } from "../componen
10
10
  import { DEFAULT_WIZARD_LABELS } from "../wizard/types.js";
11
11
  import { DEFAULT_TOUR_LABELS } from "../tour/tour.js";
12
12
  import { DEFAULT_COMMAND_PALETTE_LABELS } from "../search/command-palette.js";
13
+ import { DEFAULT_GLOBAL_SEARCH_LABELS } from "../search/global-search.js";
13
14
  import { DEFAULT_SERIES_CHART_LABELS } from "../components/series-chart-labels.js";
14
15
  import { DEFAULT_SPARKLINE_LABELS } from "../components/sparkline.js";
15
16
  import { DEFAULT_STAT_TILE_LABELS } from "../components/stat-tile.js";
@@ -25,6 +26,10 @@ import { DEFAULT_CONFIRM_DIALOG_LABELS } from "../components/confirm-dialog.js";
25
26
  import { DEFAULT_FLOATING_PANEL_LABELS } from "../components/floating-panel.js";
26
27
  import { DEFAULT_FEEDBACK_ATTACHMENT_LABELS } from "../feedback/feedback-attachment.js";
27
28
  import { DEFAULT_COPY_BUTTON_LABELS } from "../components/copy-button.js";
29
+ import { DEFAULT_BULK_ACTION_BAR_LABELS } from "../components/bulk-action-bar.js";
30
+ import { DEFAULT_LIST_LABELS } from "../components/list.js";
31
+ import { DEFAULT_BREADCRUMBS_LABELS } from "../components/breadcrumbs.js";
32
+ import { DEFAULT_TOAST_LABELS } from "../components/toast.js";
28
33
  import {
29
34
  DEFAULT_APP_SHELL_LABELS,
30
35
  DEFAULT_CALCULATOR_LABELS,
@@ -62,6 +67,7 @@ const DEFAULT_UI_KIT_LABELS = {
62
67
  wizard: DEFAULT_WIZARD_LABELS,
63
68
  tour: DEFAULT_TOUR_LABELS,
64
69
  commandPalette: DEFAULT_COMMAND_PALETTE_LABELS,
70
+ globalSearch: DEFAULT_GLOBAL_SEARCH_LABELS,
65
71
  seriesChart: DEFAULT_SERIES_CHART_LABELS,
66
72
  sparkline: DEFAULT_SPARKLINE_LABELS,
67
73
  statTile: DEFAULT_STAT_TILE_LABELS,
@@ -76,7 +82,11 @@ const DEFAULT_UI_KIT_LABELS = {
76
82
  feedbackAttachment: DEFAULT_FEEDBACK_ATTACHMENT_LABELS,
77
83
  confirmDialog: DEFAULT_CONFIRM_DIALOG_LABELS,
78
84
  floatingPanel: DEFAULT_FLOATING_PANEL_LABELS,
79
- copyButton: DEFAULT_COPY_BUTTON_LABELS
85
+ copyButton: DEFAULT_COPY_BUTTON_LABELS,
86
+ bulkActionBar: DEFAULT_BULK_ACTION_BAR_LABELS,
87
+ list: DEFAULT_LIST_LABELS,
88
+ breadcrumbs: DEFAULT_BREADCRUMBS_LABELS,
89
+ toast: DEFAULT_TOAST_LABELS
80
90
  };
81
91
  export {
82
92
  DEFAULT_UI_KIT_LABELS
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/i18n/defaults.ts"],"sourcesContent":["import { DEFAULT_DATA_TABLE_LABELS } from \"../components/data-table-labels\";\nimport { DEFAULT_MINI_CALENDAR_LABELS } from \"../components/mini-calendar\";\nimport { DEFAULT_MONTH_PICKER_LABELS } from \"../components/month-picker\";\nimport { DEFAULT_PAGE_CONTENTS_LABELS } from \"../components/page-contents\";\nimport { DEFAULT_POPOVER_LABELS } from \"../components/popover\";\nimport { DEFAULT_CHIP_INPUT_LABELS } from \"../components/chip\";\nimport { DEFAULT_FIELD_SYNC_LABELS } from \"../components/field-sync\";\nimport { DEFAULT_PASSWORD_REVEAL_LABELS, DEFAULT_TABS_LABELS } from \"../components/ui\";\nimport { DEFAULT_WIZARD_LABELS } from \"../wizard/types\";\nimport { DEFAULT_TOUR_LABELS } from \"../tour/tour\";\nimport { DEFAULT_COMMAND_PALETTE_LABELS } from \"../search/command-palette\";\nimport { DEFAULT_SERIES_CHART_LABELS } from \"../components/series-chart-labels\";\nimport { DEFAULT_SPARKLINE_LABELS } from \"../components/sparkline\";\nimport { DEFAULT_STAT_TILE_LABELS } from \"../components/stat-tile\";\nimport { DEFAULT_SIGNATURE_PAD_LABELS } from \"../components/signature-pad\";\nimport { DEFAULT_PASSWORD_STRENGTH_LABELS } from \"../components/password-strength\";\nimport { DEFAULT_DANGER_CONFIRM_LABELS } from \"../components/danger-confirm\";\nimport { DEFAULT_SWATCH_PICKER_LABELS } from \"../components/swatch-picker\";\nimport { DEFAULT_ICON_PICKER_LABELS } from \"../components/icon-picker\";\nimport { DEFAULT_DIALOG_FRAME_LABELS } from \"../components/dialog-frame\";\nimport { DEFAULT_FILE_PICKER_LABELS } from \"../components/file-button\";\nimport { DEFAULT_MEASURED_GRID_LABELS } from \"../components/measured-grid\";\nimport { DEFAULT_CONFIRM_DIALOG_LABELS } from \"../components/confirm-dialog\";\nimport { DEFAULT_FLOATING_PANEL_LABELS } from \"../components/floating-panel\";\nimport { DEFAULT_FEEDBACK_ATTACHMENT_LABELS } from \"../feedback/feedback-attachment\";\nimport { DEFAULT_COPY_BUTTON_LABELS } from \"../components/copy-button\";\nimport {\n DEFAULT_APP_SHELL_LABELS,\n DEFAULT_CALCULATOR_LABELS,\n DEFAULT_COMBOBOX_LABELS,\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n DEFAULT_DATE_PICKER_LABELS,\n DEFAULT_FILE_LABELS,\n DEFAULT_MULTI_SELECT_LABELS,\n DEFAULT_PICKER_SHEET_LABELS,\n DEFAULT_SWIPEABLE_ROW_LABELS,\n DEFAULT_TOP_BAR_LABELS,\n} from \"./kit-labels\";\nimport type { UiKitLabels } from \"./kit-labels\";\n\n/**\n * The whole English tree in one object: what a translation is written against, and\n * the `reference` for {@link missingKitLabels}.\n *\n * A separate module from the provider on purpose. Components import the provider's\n * hooks; this file imports the components' defaults. Kept together they would be an\n * import cycle through every component in the kit.\n */\nexport const DEFAULT_UI_KIT_LABELS: UiKitLabels = {\n common: DEFAULT_COMMON_LABELS,\n dataTable: DEFAULT_DATA_TABLE_LABELS,\n miniCalendar: DEFAULT_MINI_CALENDAR_LABELS,\n datePicker: DEFAULT_DATE_PICKER_LABELS,\n monthPicker: DEFAULT_MONTH_PICKER_LABELS,\n popover: DEFAULT_POPOVER_LABELS,\n combobox: DEFAULT_COMBOBOX_LABELS,\n multiSelect: DEFAULT_MULTI_SELECT_LABELS,\n calculator: DEFAULT_CALCULATOR_LABELS,\n currency: DEFAULT_CURRENCY_LABELS,\n chipInput: DEFAULT_CHIP_INPUT_LABELS,\n fieldSync: DEFAULT_FIELD_SYNC_LABELS,\n passwordReveal: DEFAULT_PASSWORD_REVEAL_LABELS,\n tabs: DEFAULT_TABS_LABELS,\n appShell: DEFAULT_APP_SHELL_LABELS,\n pageContents: DEFAULT_PAGE_CONTENTS_LABELS,\n topBar: DEFAULT_TOP_BAR_LABELS,\n pickerSheet: DEFAULT_PICKER_SHEET_LABELS,\n swipeableRow: DEFAULT_SWIPEABLE_ROW_LABELS,\n file: DEFAULT_FILE_LABELS,\n wizard: DEFAULT_WIZARD_LABELS,\n tour: DEFAULT_TOUR_LABELS,\n commandPalette: DEFAULT_COMMAND_PALETTE_LABELS,\n seriesChart: DEFAULT_SERIES_CHART_LABELS,\n sparkline: DEFAULT_SPARKLINE_LABELS,\n statTile: DEFAULT_STAT_TILE_LABELS,\n signaturePad: DEFAULT_SIGNATURE_PAD_LABELS,\n passwordStrength: DEFAULT_PASSWORD_STRENGTH_LABELS,\n dangerConfirm: DEFAULT_DANGER_CONFIRM_LABELS,\n swatchPicker: DEFAULT_SWATCH_PICKER_LABELS,\n iconPicker: DEFAULT_ICON_PICKER_LABELS,\n dialogFrame: DEFAULT_DIALOG_FRAME_LABELS,\n filePicker: DEFAULT_FILE_PICKER_LABELS,\n measuredGrid: DEFAULT_MEASURED_GRID_LABELS,\n feedbackAttachment: DEFAULT_FEEDBACK_ATTACHMENT_LABELS,\n confirmDialog: DEFAULT_CONFIRM_DIALOG_LABELS,\n floatingPanel: DEFAULT_FLOATING_PANEL_LABELS,\n copyButton: DEFAULT_COPY_BUTTON_LABELS,\n};\n"],"mappings":";AAAA,SAAS,iCAAiC;AAC1C,SAAS,oCAAoC;AAC7C,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,8BAA8B;AACvC,SAAS,iCAAiC;AAC1C,SAAS,iCAAiC;AAC1C,SAAS,gCAAgC,2BAA2B;AACpE,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,sCAAsC;AAC/C,SAAS,mCAAmC;AAC5C,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,oCAAoC;AAC7C,SAAS,wCAAwC;AACjD,SAAS,qCAAqC;AAC9C,SAAS,oCAAoC;AAC7C,SAAS,kCAAkC;AAC3C,SAAS,mCAAmC;AAC5C,SAAS,kCAAkC;AAC3C,SAAS,oCAAoC;AAC7C,SAAS,qCAAqC;AAC9C,SAAS,qCAAqC;AAC9C,SAAS,0CAA0C;AACnD,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,MAAM,wBAAqC;AAAA,EAChD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,SAAS;AAAA,EACT,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAAA,EACd,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,UAAU;AAAA,EACV,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,YAAY;AACd;","names":[]}
1
+ {"version":3,"sources":["../../src/i18n/defaults.ts"],"sourcesContent":["import { DEFAULT_DATA_TABLE_LABELS } from \"../components/data-table-labels\";\nimport { DEFAULT_MINI_CALENDAR_LABELS } from \"../components/mini-calendar\";\nimport { DEFAULT_MONTH_PICKER_LABELS } from \"../components/month-picker\";\nimport { DEFAULT_PAGE_CONTENTS_LABELS } from \"../components/page-contents\";\nimport { DEFAULT_POPOVER_LABELS } from \"../components/popover\";\nimport { DEFAULT_CHIP_INPUT_LABELS } from \"../components/chip\";\nimport { DEFAULT_FIELD_SYNC_LABELS } from \"../components/field-sync\";\nimport { DEFAULT_PASSWORD_REVEAL_LABELS, DEFAULT_TABS_LABELS } from \"../components/ui\";\nimport { DEFAULT_WIZARD_LABELS } from \"../wizard/types\";\nimport { DEFAULT_TOUR_LABELS } from \"../tour/tour\";\nimport { DEFAULT_COMMAND_PALETTE_LABELS } from \"../search/command-palette\";\nimport { DEFAULT_GLOBAL_SEARCH_LABELS } from \"../search/global-search\";\nimport { DEFAULT_SERIES_CHART_LABELS } from \"../components/series-chart-labels\";\nimport { DEFAULT_SPARKLINE_LABELS } from \"../components/sparkline\";\nimport { DEFAULT_STAT_TILE_LABELS } from \"../components/stat-tile\";\nimport { DEFAULT_SIGNATURE_PAD_LABELS } from \"../components/signature-pad\";\nimport { DEFAULT_PASSWORD_STRENGTH_LABELS } from \"../components/password-strength\";\nimport { DEFAULT_DANGER_CONFIRM_LABELS } from \"../components/danger-confirm\";\nimport { DEFAULT_SWATCH_PICKER_LABELS } from \"../components/swatch-picker\";\nimport { DEFAULT_ICON_PICKER_LABELS } from \"../components/icon-picker\";\nimport { DEFAULT_DIALOG_FRAME_LABELS } from \"../components/dialog-frame\";\nimport { DEFAULT_FILE_PICKER_LABELS } from \"../components/file-button\";\nimport { DEFAULT_MEASURED_GRID_LABELS } from \"../components/measured-grid\";\nimport { DEFAULT_CONFIRM_DIALOG_LABELS } from \"../components/confirm-dialog\";\nimport { DEFAULT_FLOATING_PANEL_LABELS } from \"../components/floating-panel\";\nimport { DEFAULT_FEEDBACK_ATTACHMENT_LABELS } from \"../feedback/feedback-attachment\";\nimport { DEFAULT_COPY_BUTTON_LABELS } from \"../components/copy-button\";\nimport { DEFAULT_BULK_ACTION_BAR_LABELS } from \"../components/bulk-action-bar\";\nimport { DEFAULT_LIST_LABELS } from \"../components/list\";\nimport { DEFAULT_BREADCRUMBS_LABELS } from \"../components/breadcrumbs\";\nimport { DEFAULT_TOAST_LABELS } from \"../components/toast\";\nimport {\n DEFAULT_APP_SHELL_LABELS,\n DEFAULT_CALCULATOR_LABELS,\n DEFAULT_COMBOBOX_LABELS,\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n DEFAULT_DATE_PICKER_LABELS,\n DEFAULT_FILE_LABELS,\n DEFAULT_MULTI_SELECT_LABELS,\n DEFAULT_PICKER_SHEET_LABELS,\n DEFAULT_SWIPEABLE_ROW_LABELS,\n DEFAULT_TOP_BAR_LABELS,\n} from \"./kit-labels\";\nimport type { UiKitLabels } from \"./kit-labels\";\n\n/**\n * The whole English tree in one object: what a translation is written against, and\n * the `reference` for {@link missingKitLabels}.\n *\n * A separate module from the provider on purpose. Components import the provider's\n * hooks; this file imports the components' defaults. Kept together they would be an\n * import cycle through every component in the kit.\n */\nexport const DEFAULT_UI_KIT_LABELS: UiKitLabels = {\n common: DEFAULT_COMMON_LABELS,\n dataTable: DEFAULT_DATA_TABLE_LABELS,\n miniCalendar: DEFAULT_MINI_CALENDAR_LABELS,\n datePicker: DEFAULT_DATE_PICKER_LABELS,\n monthPicker: DEFAULT_MONTH_PICKER_LABELS,\n popover: DEFAULT_POPOVER_LABELS,\n combobox: DEFAULT_COMBOBOX_LABELS,\n multiSelect: DEFAULT_MULTI_SELECT_LABELS,\n calculator: DEFAULT_CALCULATOR_LABELS,\n currency: DEFAULT_CURRENCY_LABELS,\n chipInput: DEFAULT_CHIP_INPUT_LABELS,\n fieldSync: DEFAULT_FIELD_SYNC_LABELS,\n passwordReveal: DEFAULT_PASSWORD_REVEAL_LABELS,\n tabs: DEFAULT_TABS_LABELS,\n appShell: DEFAULT_APP_SHELL_LABELS,\n pageContents: DEFAULT_PAGE_CONTENTS_LABELS,\n topBar: DEFAULT_TOP_BAR_LABELS,\n pickerSheet: DEFAULT_PICKER_SHEET_LABELS,\n swipeableRow: DEFAULT_SWIPEABLE_ROW_LABELS,\n file: DEFAULT_FILE_LABELS,\n wizard: DEFAULT_WIZARD_LABELS,\n tour: DEFAULT_TOUR_LABELS,\n commandPalette: DEFAULT_COMMAND_PALETTE_LABELS,\n globalSearch: DEFAULT_GLOBAL_SEARCH_LABELS,\n seriesChart: DEFAULT_SERIES_CHART_LABELS,\n sparkline: DEFAULT_SPARKLINE_LABELS,\n statTile: DEFAULT_STAT_TILE_LABELS,\n signaturePad: DEFAULT_SIGNATURE_PAD_LABELS,\n passwordStrength: DEFAULT_PASSWORD_STRENGTH_LABELS,\n dangerConfirm: DEFAULT_DANGER_CONFIRM_LABELS,\n swatchPicker: DEFAULT_SWATCH_PICKER_LABELS,\n iconPicker: DEFAULT_ICON_PICKER_LABELS,\n dialogFrame: DEFAULT_DIALOG_FRAME_LABELS,\n filePicker: DEFAULT_FILE_PICKER_LABELS,\n measuredGrid: DEFAULT_MEASURED_GRID_LABELS,\n feedbackAttachment: DEFAULT_FEEDBACK_ATTACHMENT_LABELS,\n confirmDialog: DEFAULT_CONFIRM_DIALOG_LABELS,\n floatingPanel: DEFAULT_FLOATING_PANEL_LABELS,\n copyButton: DEFAULT_COPY_BUTTON_LABELS,\n bulkActionBar: DEFAULT_BULK_ACTION_BAR_LABELS,\n list: DEFAULT_LIST_LABELS,\n breadcrumbs: DEFAULT_BREADCRUMBS_LABELS,\n toast: DEFAULT_TOAST_LABELS,\n};\n"],"mappings":";AAAA,SAAS,iCAAiC;AAC1C,SAAS,oCAAoC;AAC7C,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,8BAA8B;AACvC,SAAS,iCAAiC;AAC1C,SAAS,iCAAiC;AAC1C,SAAS,gCAAgC,2BAA2B;AACpE,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,sCAAsC;AAC/C,SAAS,oCAAoC;AAC7C,SAAS,mCAAmC;AAC5C,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,oCAAoC;AAC7C,SAAS,wCAAwC;AACjD,SAAS,qCAAqC;AAC9C,SAAS,oCAAoC;AAC7C,SAAS,kCAAkC;AAC3C,SAAS,mCAAmC;AAC5C,SAAS,kCAAkC;AAC3C,SAAS,oCAAoC;AAC7C,SAAS,qCAAqC;AAC9C,SAAS,qCAAqC;AAC9C,SAAS,0CAA0C;AACnD,SAAS,kCAAkC;AAC3C,SAAS,sCAAsC;AAC/C,SAAS,2BAA2B;AACpC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,MAAM,wBAAqC;AAAA,EAChD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,SAAS;AAAA,EACT,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAAA,EACd,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,WAAW;AAAA,EACX,UAAU;AAAA,EACV,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO;AACT;","names":[]}
@@ -9,6 +9,7 @@ import { PasswordRevealLabels, TabsLabels } from '../components/ui.js';
9
9
  import { WizardLabels } from '../wizard/types.js';
10
10
  import { TourLabels } from '../tour/tour.js';
11
11
  import { CommandPaletteLabels } from '../search/command-palette.js';
12
+ import { GlobalSearchLabels } from '../search/global-search.js';
12
13
  import { MonthPickerLabels } from '../components/month-picker.js';
13
14
  import { PageContentsLabels } from '../components/page-contents.js';
14
15
  import { SeriesChartLabels } from '../components/series-chart-labels.js';
@@ -26,9 +27,14 @@ import { FeedbackAttachmentFieldLabels } from '../feedback/feedback-attachment.j
26
27
  import { ConfirmDialogLabels } from '../components/confirm-dialog.js';
27
28
  import { FloatingPanelLabels } from '../components/floating-panel.js';
28
29
  import { CopyButtonLabels } from '../components/copy-button.js';
30
+ import { BulkActionBarLabels } from '../components/bulk-action-bar.js';
31
+ import { ListLabels } from '../components/list.js';
32
+ import { BreadcrumbsLabels } from '../components/breadcrumbs.js';
33
+ import { ToastLabels } from '../components/toast.js';
29
34
  import 'lucide-react';
30
35
  import '../components/tooltip.js';
31
36
  import '../hooks/use-anchored-rect.js';
37
+ import '../search/search-index.js';
32
38
  import '../components/tile-radio.js';
33
39
  import '../components/modal.js';
34
40
  import '../feedback/feedback-dialog.js';
@@ -204,6 +210,7 @@ interface UiKitLabels {
204
210
  wizard: WizardLabels;
205
211
  tour: TourLabels;
206
212
  commandPalette: CommandPaletteLabels;
213
+ globalSearch: GlobalSearchLabels;
207
214
  seriesChart: SeriesChartLabels;
208
215
  sparkline: SparklineLabels;
209
216
  statTile: StatTileLabels;
@@ -219,6 +226,10 @@ interface UiKitLabels {
219
226
  confirmDialog: ConfirmDialogLabels;
220
227
  floatingPanel: FloatingPanelLabels;
221
228
  copyButton: CopyButtonLabels;
229
+ bulkActionBar: BulkActionBarLabels;
230
+ list: ListLabels;
231
+ breadcrumbs: BreadcrumbsLabels;
232
+ toast: ToastLabels;
222
233
  }
223
234
  /** Any subset of the tree, one level deep — each namespace may be partial, and a
224
235
  * namespace that holds a record (`dataTable.presets`) is merged key by key. */