@noix-dev/brix-vue 0.0.0-stage → 0.2.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 (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -2
  3. package/package.json +117 -3
  4. package/src/components/address-field/AddressField.vue +337 -0
  5. package/src/components/address-field/index.ts +1 -0
  6. package/src/components/appearance-picker/AppearancePicker.vue +502 -0
  7. package/src/components/appearance-picker/AppearanceSegment.vue +175 -0
  8. package/src/components/appearance-picker/index.ts +44 -0
  9. package/src/components/autofill/AutoFillDialog.vue +264 -0
  10. package/src/components/autofill/index.ts +1 -0
  11. package/src/components/badge/Badge.vue +23 -0
  12. package/src/components/badge/index.ts +106 -0
  13. package/src/components/build-stamp/BuildStamp.vue +62 -0
  14. package/src/components/build-stamp/index.ts +1 -0
  15. package/src/components/button/Button.vue +31 -0
  16. package/src/components/button/index.ts +122 -0
  17. package/src/components/card/Card.vue +29 -0
  18. package/src/components/card/CardAction.vue +17 -0
  19. package/src/components/card/CardContent.vue +14 -0
  20. package/src/components/card/CardDescription.vue +14 -0
  21. package/src/components/card/CardFooter.vue +22 -0
  22. package/src/components/card/CardHeader.vue +22 -0
  23. package/src/components/card/CardTitle.vue +29 -0
  24. package/src/components/card/index.ts +47 -0
  25. package/src/components/chart/BarChart.vue +123 -0
  26. package/src/components/chart/StackedBarChart.vue +149 -0
  27. package/src/components/chart/appearanceRevision.ts +22 -0
  28. package/src/components/chart/chartColor.ts +59 -0
  29. package/src/components/chart/index.ts +6 -0
  30. package/src/components/checkbox/Checkbox.vue +61 -0
  31. package/src/components/checkbox/index.ts +1 -0
  32. package/src/components/code-editor/CodeEditor.vue +352 -0
  33. package/src/components/code-editor/index.ts +9 -0
  34. package/src/components/code-editor/syntaxTheme.ts +110 -0
  35. package/src/components/colour-picker/ColourPicker.vue +421 -0
  36. package/src/components/colour-picker/index.ts +1 -0
  37. package/src/components/combobox/Combobox.vue +337 -0
  38. package/src/components/combobox/index.ts +1 -0
  39. package/src/components/comments/CommentComposer.vue +302 -0
  40. package/src/components/comments/CommentMessage.vue +259 -0
  41. package/src/components/comments/CommentThread.vue +250 -0
  42. package/src/components/comments/commentBody.ts +185 -0
  43. package/src/components/comments/commentLevels.ts +139 -0
  44. package/src/components/comments/commentNode.ts +35 -0
  45. package/src/components/comments/composer.ts +20 -0
  46. package/src/components/comments/index.ts +29 -0
  47. package/src/components/confirm-dialog/ConfirmDialog.vue +153 -0
  48. package/src/components/confirm-dialog/index.ts +1 -0
  49. package/src/components/containers/Box.vue +42 -0
  50. package/src/components/containers/Section.vue +88 -0
  51. package/src/components/containers/SectionAction.vue +17 -0
  52. package/src/components/containers/SectionContent.vue +14 -0
  53. package/src/components/containers/SectionDescription.vue +14 -0
  54. package/src/components/containers/SectionHeader.vue +22 -0
  55. package/src/components/containers/SectionTitle.vue +17 -0
  56. package/src/components/containers/index.ts +9 -0
  57. package/src/components/data-table/ColumnMenu.vue +241 -0
  58. package/src/components/data-table/DataTable.vue +447 -0
  59. package/src/components/data-table/ExpandCaret.vue +34 -0
  60. package/src/components/data-table/SortableHead.vue +184 -0
  61. package/src/components/data-table/TableLoadingRow.vue +13 -0
  62. package/src/components/data-table/TableProgressRow.vue +26 -0
  63. package/src/components/data-table/columns.ts +13 -0
  64. package/src/components/data-table/index.ts +3 -0
  65. package/src/components/data-table/pinned.ts +19 -0
  66. package/src/components/data-table/rowActivation.ts +14 -0
  67. package/src/components/data-table/sort.ts +13 -0
  68. package/src/components/data-table/types.ts +23 -0
  69. package/src/components/date-picker/CalendarPanel.vue +432 -0
  70. package/src/components/date-picker/DateField.vue +293 -0
  71. package/src/components/date-picker/DatePicker.vue +147 -0
  72. package/src/components/date-picker/UntilDatePicker.vue +96 -0
  73. package/src/components/date-picker/dateFieldGuard.ts +87 -0
  74. package/src/components/date-picker/index.ts +4 -0
  75. package/src/components/date-picker/useDateField.ts +37 -0
  76. package/src/components/date-range-picker/DateRangePicker.vue +247 -0
  77. package/src/components/date-range-picker/index.ts +1 -0
  78. package/src/components/date-time-picker/DateTimePicker.vue +291 -0
  79. package/src/components/date-time-picker/index.ts +1 -0
  80. package/src/components/dialog/Dialog.vue +250 -0
  81. package/src/components/dialog/DialogSurface.vue +214 -0
  82. package/src/components/dialog/dialogEdges.ts +65 -0
  83. package/src/components/dialog/dialogSizes.ts +35 -0
  84. package/src/components/dialog/index.ts +12 -0
  85. package/src/components/dialog/toastHost.ts +18 -0
  86. package/src/components/dropdown/Dropdown.vue +101 -0
  87. package/src/components/dropdown/DropdownItems.vue +154 -0
  88. package/src/components/dropdown/dropdown.ts +64 -0
  89. package/src/components/dropdown/index.ts +2 -0
  90. package/src/components/file-preview/FilePreview.vue +78 -0
  91. package/src/components/file-preview/index.ts +1 -0
  92. package/src/components/file-upload/FileUpload.vue +234 -0
  93. package/src/components/file-upload/index.ts +1 -0
  94. package/src/components/filter-check-menu/FilterCheckMenu.vue +562 -0
  95. package/src/components/filter-check-menu/filterCheckOption.ts +10 -0
  96. package/src/components/filter-check-menu/index.ts +2 -0
  97. package/src/components/form-field/FormField.vue +74 -0
  98. package/src/components/form-field/index.ts +2 -0
  99. package/src/components/form-field/types.ts +5 -0
  100. package/src/components/frames/FrameCentred.vue +137 -0
  101. package/src/components/frames/FrameSidebar.vue +113 -0
  102. package/src/components/frames/FrameSplit.vue +109 -0
  103. package/src/components/frames/index.ts +3 -0
  104. package/src/components/icon/BellIcon.vue +27 -0
  105. package/src/components/icon/BoldIcon.vue +31 -0
  106. package/src/components/icon/CalendarDaysIcon.vue +33 -0
  107. package/src/components/icon/CheckIcon.vue +31 -0
  108. package/src/components/icon/ChevronDownIcon.vue +30 -0
  109. package/src/components/icon/ChevronLeftIcon.vue +31 -0
  110. package/src/components/icon/ChevronRightIcon.vue +31 -0
  111. package/src/components/icon/ChevronUpIcon.vue +30 -0
  112. package/src/components/icon/CircleAlertIcon.vue +29 -0
  113. package/src/components/icon/ClockIcon.vue +31 -0
  114. package/src/components/icon/Columns3Icon.vue +32 -0
  115. package/src/components/icon/FlipHorizontalIcon.vue +29 -0
  116. package/src/components/icon/ItalicIcon.vue +28 -0
  117. package/src/components/icon/LinkIcon.vue +27 -0
  118. package/src/components/icon/ListIcon.vue +29 -0
  119. package/src/components/icon/ListOrderedIcon.vue +28 -0
  120. package/src/components/icon/PenLineIcon.vue +31 -0
  121. package/src/components/icon/PlusIcon.vue +28 -0
  122. package/src/components/icon/RotateCcwIcon.vue +28 -0
  123. package/src/components/icon/RotateCwIcon.vue +28 -0
  124. package/src/components/icon/SearchIcon.vue +31 -0
  125. package/src/components/icon/StarIcon.vue +29 -0
  126. package/src/components/icon/TriangleAlertIcon.vue +29 -0
  127. package/src/components/icon/UnderlineIcon.vue +27 -0
  128. package/src/components/icon/Undo2Icon.vue +28 -0
  129. package/src/components/icon/XIcon.vue +31 -0
  130. package/src/components/icon/ZoomInIcon.vue +30 -0
  131. package/src/components/icon/ZoomOutIcon.vue +29 -0
  132. package/src/components/icon/index.ts +37 -0
  133. package/src/components/icon-picker/IconPicker.vue +560 -0
  134. package/src/components/icon-picker/index.ts +1 -0
  135. package/src/components/image-crop-dialog/CropRatioRow.vue +132 -0
  136. package/src/components/image-crop-dialog/CropVariantStrip.vue +277 -0
  137. package/src/components/image-crop-dialog/ImageCropDialog.vue +1541 -0
  138. package/src/components/image-crop-dialog/index.ts +16 -0
  139. package/src/components/image-upload/ImageUpload.vue +345 -0
  140. package/src/components/image-upload/index.ts +2 -0
  141. package/src/components/input/Input.vue +48 -0
  142. package/src/components/input/index.ts +1 -0
  143. package/src/components/keycap/Keycap.vue +49 -0
  144. package/src/components/keycap/index.ts +1 -0
  145. package/src/components/label/Label.vue +26 -0
  146. package/src/components/label/index.ts +1 -0
  147. package/src/components/menu/MenuCheckboxItem.vue +63 -0
  148. package/src/components/menu/MenuContent.vue +45 -0
  149. package/src/components/menu/MenuGroup.vue +22 -0
  150. package/src/components/menu/MenuItem.vue +34 -0
  151. package/src/components/menu/MenuLabel.vue +22 -0
  152. package/src/components/menu/MenuRadioGroup.vue +22 -0
  153. package/src/components/menu/MenuRadioItem.vue +50 -0
  154. package/src/components/menu/MenuRoot.vue +25 -0
  155. package/src/components/menu/MenuSeparator.vue +27 -0
  156. package/src/components/menu/MenuSub.vue +29 -0
  157. package/src/components/menu/MenuSubContent.vue +48 -0
  158. package/src/components/menu/MenuSubTrigger.vue +49 -0
  159. package/src/components/menu/MenuTrigger.vue +22 -0
  160. package/src/components/menu/index.ts +20 -0
  161. package/src/components/menu/menuClasses.ts +74 -0
  162. package/src/components/morph-select/MorphSelect.vue +150 -0
  163. package/src/components/morph-select/index.ts +1 -0
  164. package/src/components/nav/NavFlyout.vue +343 -0
  165. package/src/components/nav/NavGroup.vue +306 -0
  166. package/src/components/nav/NavItem.vue +243 -0
  167. package/src/components/nav/NavNodes.ts +66 -0
  168. package/src/components/nav/NavSection.vue +105 -0
  169. package/src/components/nav/NavSidebar.vue +137 -0
  170. package/src/components/nav/index.ts +5 -0
  171. package/src/components/nav/navChain.ts +112 -0
  172. package/src/components/nav/navClasses.ts +229 -0
  173. package/src/components/nav/navNode.ts +10 -0
  174. package/src/components/nav/navRegistry.ts +24 -0
  175. package/src/components/notification-list/NotificationList.vue +314 -0
  176. package/src/components/notification-list/index.ts +2 -0
  177. package/src/components/notification-list/notifications.ts +21 -0
  178. package/src/components/pagination/Pagination.vue +296 -0
  179. package/src/components/pagination/index.ts +1 -0
  180. package/src/components/pin-field/PinField.vue +332 -0
  181. package/src/components/pin-field/index.ts +1 -0
  182. package/src/components/popover-panel/PopoverPanel.vue +115 -0
  183. package/src/components/popover-panel/index.ts +5 -0
  184. package/src/components/rating/Rating.vue +201 -0
  185. package/src/components/rating/index.ts +1 -0
  186. package/src/components/record-avatar/RecordAvatar.vue +76 -0
  187. package/src/components/record-avatar/index.ts +1 -0
  188. package/src/components/result-window/ResultWindow.vue +399 -0
  189. package/src/components/result-window/index.ts +2 -0
  190. package/src/components/result-window/results.ts +75 -0
  191. package/src/components/rich-editor/RichEditor.vue +370 -0
  192. package/src/components/rich-editor/RichEditorLinkDialog.vue +133 -0
  193. package/src/components/rich-editor/index.ts +8 -0
  194. package/src/components/row-actions/RowActions.vue +262 -0
  195. package/src/components/row-actions/index.ts +2 -0
  196. package/src/components/row-actions/rowActions.ts +44 -0
  197. package/src/components/search-select/SearchSelect.vue +599 -0
  198. package/src/components/search-select/index.ts +2 -0
  199. package/src/components/search-select/types.ts +14 -0
  200. package/src/components/segmented-choice/SegmentedChoice.vue +136 -0
  201. package/src/components/segmented-choice/index.ts +2 -0
  202. package/src/components/segmented-choice/segmentedOption.ts +6 -0
  203. package/src/components/select/Select.vue +18 -0
  204. package/src/components/select/SelectContent.vue +73 -0
  205. package/src/components/select/SelectGroup.vue +21 -0
  206. package/src/components/select/SelectItem.vue +47 -0
  207. package/src/components/select/SelectItemText.vue +12 -0
  208. package/src/components/select/SelectLabel.vue +17 -0
  209. package/src/components/select/SelectScrollDownButton.vue +36 -0
  210. package/src/components/select/SelectScrollUpButton.vue +36 -0
  211. package/src/components/select/SelectSeparator.vue +19 -0
  212. package/src/components/select/SelectTrigger.vue +52 -0
  213. package/src/components/select/SelectValue.vue +12 -0
  214. package/src/components/select/index.ts +11 -0
  215. package/src/components/session/IdleTimer.vue +71 -0
  216. package/src/components/session/SessionDialogs.vue +177 -0
  217. package/src/components/session/index.ts +2 -0
  218. package/src/components/split-button/SplitButton.vue +122 -0
  219. package/src/components/split-button/index.ts +2 -0
  220. package/src/components/split-button/splitButtonItem.ts +7 -0
  221. package/src/components/switch/Switch.vue +60 -0
  222. package/src/components/switch/index.ts +1 -0
  223. package/src/components/table/Table.vue +51 -0
  224. package/src/components/table/TableBody.vue +14 -0
  225. package/src/components/table/TableCaption.vue +17 -0
  226. package/src/components/table/TableCell.vue +22 -0
  227. package/src/components/table/TableEmpty.vue +72 -0
  228. package/src/components/table/TableFooter.vue +17 -0
  229. package/src/components/table/TableHead.vue +22 -0
  230. package/src/components/table/TableHeader.vue +14 -0
  231. package/src/components/table/TableRow.vue +22 -0
  232. package/src/components/table/index.ts +9 -0
  233. package/src/components/tabs/Tabs.vue +173 -0
  234. package/src/components/tabs/index.ts +2 -0
  235. package/src/components/tabs/tabItem.ts +12 -0
  236. package/src/components/textarea/LimitedTextarea.vue +81 -0
  237. package/src/components/textarea/TextLimitCounter.vue +107 -0
  238. package/src/components/textarea/Textarea.vue +42 -0
  239. package/src/components/textarea/index.ts +4 -0
  240. package/src/components/textarea/textLimit.ts +43 -0
  241. package/src/components/time-picker/TimePicker.vue +522 -0
  242. package/src/components/time-picker/index.ts +1 -0
  243. package/src/components/toast/ToastHost.vue +276 -0
  244. package/src/components/toast/index.ts +1 -0
  245. package/src/components/update-notice/UpdateNotice.vue +103 -0
  246. package/src/components/update-notice/index.ts +1 -0
  247. package/src/components/user-menu/UserMenu.vue +154 -0
  248. package/src/components/user-menu/index.ts +1 -0
  249. package/src/index.ts +182 -0
  250. package/src/lib/cn.ts +21 -0
  251. package/src/lib/panelFocus.ts +65 -0
  252. package/src/lib/sessionMonitor.ts +390 -0
  253. package/src/lib/slotContent.ts +17 -0
  254. package/src/lib/updateCheck.ts +133 -0
  255. package/src/styles.css +82 -0
@@ -0,0 +1,243 @@
1
+ <script setup lang="ts">
2
+ import type { HTMLAttributes, VNode } from 'vue';
3
+ import {
4
+ Comment,
5
+ Fragment,
6
+ Text,
7
+ computed,
8
+ inject,
9
+ onActivated,
10
+ onBeforeUnmount,
11
+ onDeactivated,
12
+ ref,
13
+ resolveDynamicComponent,
14
+ useAttrs,
15
+ useSlots,
16
+ watch,
17
+ } from 'vue';
18
+ import { cn } from '../../lib/cn';
19
+ import { NAV_CHAIN } from './navChain';
20
+ import {
21
+ navIconClass,
22
+ navIconCurrentClass,
23
+ navIconRailClass,
24
+ navIconRestClass,
25
+ navLabelClass,
26
+ navRowBarlessClass,
27
+ navRowClass,
28
+ navRowCollapsedClass,
29
+ navRowCurrentClass,
30
+ navRowDepthClass,
31
+ navRowInteractiveClass,
32
+ } from './navClasses';
33
+ import { NAV_COLLAPSED, NAV_DEPTH, NAV_GROUP } from './navRegistry';
34
+ import type { NavEntry } from './navRegistry';
35
+
36
+ /**
37
+ * One row of the navigation column. With `to` it is a link: the consumer's registered
38
+ * `RouterLink` where there is one (handed `to`), otherwise a plain anchor (handed `href`).
39
+ * Without `to` it is a non-interactive `div`, so a dead anchor takes no tab stop.
40
+ *
41
+ * A ROW IN A RAIL NEEDS AN ICON: the label is dropped from view there, so a row with no `#icon`
42
+ * draws an empty box. The name it keeps instead comes from `label`, or from the default slot's
43
+ * TEXT — and the second half has a hole, so it is stated as a limit and not as a guarantee.
44
+ * `textOf` below descends Text nodes, fragments and arrays; a COMPONENT vnode yields nothing,
45
+ * which is the ordinary i18n idiom (`<NavItem to="/a"><Trans /></NavItem>`). Such a row in a rail
46
+ * has no accessible name at all: no `aria-label`, no `title`, no hidden text — and a shut
47
+ * ancestor then prints a bare `·`, because the empty string it registers is not `undefined` and
48
+ * `NavGroup`'s `??` fallback never fires. **`label` IS REQUIRED whenever the row's content is
49
+ * anything but text**, and development warns when a rail row can derive no name (below), on
50
+ * `Dialog`'s precedent for the same kind of silent miss.
51
+ *
52
+ * WHAT THE ROW DOES NOT TAKE FROM `$attrs`. `aria-current`, `aria-label` and `title` are bound
53
+ * after it, so the explicit bindings win — INCLUDING when they are `undefined`, which discards a
54
+ * consumer's own value rather than falling back to it. Do not flip the order to "fix" that:
55
+ * `aria-current` is this family's, driven by `current`, and a consumer able to overwrite it could
56
+ * mark a second current row in the same menu. So the spec's "or reads `aria-current` from the
57
+ * element it renders" is not available — pass `current` — and a `RouterLink`'s own `aria-current`
58
+ * does not survive either, which is settled rather than open: measured against a real router,
59
+ * `destination` is spread after `$attrs` and the explicit binding after that, so `NavItem`'s
60
+ * value wins. What has NOT been looked at is the `router-link-active` class a `RouterLink` adds
61
+ * by concatenation: it lands on the row beside this family's own classes and is a second marking
62
+ * mechanism nothing here knows about.
63
+ *
64
+ * THE ICON BOX SIZES ITS DIRECT SVG CHILD (15px open, 16px in a rail, as the record does), so a
65
+ * size class on that svg does not win. An svg nested deeper is not reached.
66
+ *
67
+ * A CURRENT ROW INSIDE A FLYOUT KEEPS ITS INK AND DROPS THE BAR, because the bar marks the edge
68
+ * of a column and a panel has no such edge. The ink is the gated cue and stands alone there; see
69
+ * `navRowBarlessClass` for the reasoning and the figure that was never drawn.
70
+ *
71
+ * The label is `label` when given and otherwise the default slot's text, because a group
72
+ * header has to print it. In a collapsed rail the label is dropped from view and the row keeps
73
+ * its name: a link takes `aria-label` and `title`; a row with no `to` is a `div`, on which ARIA
74
+ * prohibits `aria-label`, so it keeps the label as visually hidden text instead (and a `title`
75
+ * for the pointer).
76
+ */
77
+ defineOptions({ inheritAttrs: false });
78
+
79
+ const props = defineProps<{
80
+ to?: string;
81
+ current?: boolean;
82
+ label?: string;
83
+ class?: HTMLAttributes['class'];
84
+ }>();
85
+
86
+ const slots = useSlots();
87
+ const attrs = useAttrs();
88
+
89
+ // Every app registers RouterLink globally; this package must not import vue-router itself.
90
+ // An unregistered name resolves to the name STRING, which `<component :is>` would render as an
91
+ // unknown `<routerlink>` element: no href, no keyboard behaviour. Hence the typeof guard.
92
+ // `resolveDynamicComponent` is used over `resolveComponent` because it resolves the same name
93
+ // without the "Failed to resolve component" warning, which would otherwise print once per row
94
+ // in an application with no router.
95
+ const routerLink = resolveDynamicComponent('RouterLink');
96
+
97
+ const is = computed(() => (!props.to ? 'div' : typeof routerLink === 'string' ? 'a' : routerLink));
98
+ const destination = computed(() =>
99
+ !props.to ? {} : typeof routerLink === 'string' ? { href: props.to } : { to: props.to },
100
+ );
101
+
102
+ const depth = inject(NAV_DEPTH, ref(0));
103
+ const collapsed = inject(NAV_COLLAPSED, ref(false));
104
+ // Inside a flyout panel a current row keeps its ink and drops the bar: the bar marks a column's
105
+ // edge and a panel has none (see `navRowBarlessClass`). The chain never appears or goes while a
106
+ // row is mounted, so this is read once and not reactively.
107
+ const inPanel = inject(NAV_CHAIN, null) !== null;
108
+
109
+ function textOf(nodes: VNode[] | undefined): string {
110
+ let out = '';
111
+ for (const node of nodes ?? []) {
112
+ if (node.type === Comment) continue;
113
+ if (node.type === Text || typeof node.children === 'string') {
114
+ out += String(node.children);
115
+ } else if (node.type === Fragment && Array.isArray(node.children)) {
116
+ out += textOf(node.children as VNode[]);
117
+ } else if (Array.isArray(node.children)) {
118
+ out += textOf(node.children as VNode[]);
119
+ }
120
+ }
121
+ return out;
122
+ }
123
+
124
+ const text = computed(() => (props.label ?? textOf(slots.default?.())).trim());
125
+
126
+ const entry = computed<Readonly<NavEntry>>(() => ({
127
+ label: text.value,
128
+ current: !!props.current,
129
+ }));
130
+ const group = inject(NAV_GROUP, null);
131
+ let withdraw: (() => void) | undefined = group?.register(entry);
132
+ // A cached (KeepAlive) item is deactivated, not unmounted, and must stop naming a page in a
133
+ // shut ancestor while it is out of sight.
134
+ function leave(): void {
135
+ withdraw?.();
136
+ withdraw = undefined;
137
+ }
138
+ onBeforeUnmount(leave);
139
+ onDeactivated(leave);
140
+ onActivated(() => {
141
+ withdraw ??= group?.register(entry);
142
+ });
143
+
144
+ /**
145
+ * THE WARNING FOR A RAIL ROW THAT HAS NO NAME, which is the one case where this component can
146
+ * draw something a screen reader cannot read at all: `collapsed` drops the label from view, and
147
+ * `textOf` finds nothing in a slot whose child is a component. For a row with `to` that is WCAG
148
+ * 4.1.2 and 2.4.4, and silent — the row still draws its icon, so nothing looks wrong. A row with
149
+ * no `to` is a non-interactive `div` and neither criterion applies to it as stated; the advice
150
+ * (pass `label`) holds there as well, because the visually hidden name it keeps comes from it.
151
+ *
152
+ * `Dialog`'s shape exactly, and for its reasons: the same `process.env.NODE_ENV` guard, so a
153
+ * consumer's production build stays quiet under whatever bundler they use and the two components
154
+ * agree about what development means; and the same grace period, because a label loaded from an
155
+ * API arrives after the first render and a check at that moment would cry wolf. It is dropped
156
+ * when the name turns up, so the warning is only printed for a row that is still nameless.
157
+ *
158
+ * NOT ON A SERVER. `onBeforeUnmount` never runs there, so a timer scheduled during a server
159
+ * render is never cleared: one per nameless rail row per request, each holding the process's
160
+ * event loop for the grace period. `NavSidebar` guards its `document` read the same way.
161
+ *
162
+ * THE MESSAGE SAYS WHEN THE CONSUMER DID PASS A NAME. `aria-label` and `title` given as
163
+ * attributes are discarded (see above), so a consumer who plainly named the row would otherwise
164
+ * be told it has no name without being told why, which is how a warning gets learned as noise.
165
+ */
166
+ const NAME_GRACE_MS = 1500;
167
+ let nameTimer: ReturnType<typeof setTimeout> | undefined;
168
+
169
+ function stopNameCheck(): void {
170
+ if (nameTimer !== undefined) {
171
+ clearTimeout(nameTimer);
172
+ nameTimer = undefined;
173
+ }
174
+ }
175
+
176
+ const nameless = computed(() => collapsed.value && text.value === '');
177
+
178
+ watch(
179
+ nameless,
180
+ (missing) => {
181
+ stopNameCheck();
182
+ if (!missing || process.env.NODE_ENV === 'production') {
183
+ return;
184
+ }
185
+ if (typeof document === 'undefined') return;
186
+ nameTimer = setTimeout(() => {
187
+ nameTimer = undefined;
188
+ if (!nameless.value) return;
189
+ const dropped = (['aria-label', 'title'] as const).filter((name) => name in attrs);
190
+ console.warn(
191
+ 'Warning: a `NavItem` in a collapsed rail has no accessible name.\n\n' +
192
+ 'The rail draws no labels, and the default slot yielded no text to keep as one — ' +
193
+ 'a component in the slot (an i18n `<Trans />`) renders none that can be read here. ' +
194
+ 'Pass `label`.' +
195
+ (dropped.length > 0
196
+ ? `\n\nThe ${dropped.map((name) => `\`${name}\``).join(' and ')} passed as ` +
197
+ 'an attribute is not used: `NavItem` sets its own name from `label` and ' +
198
+ 'discards that attribute.'
199
+ : ''),
200
+ );
201
+ }, NAME_GRACE_MS);
202
+ },
203
+ { immediate: true },
204
+ );
205
+ onBeforeUnmount(stopNameCheck);
206
+ </script>
207
+
208
+ <template>
209
+ <component
210
+ :is="is"
211
+ v-bind="{ ...$attrs, ...destination }"
212
+ data-slot="nav-item"
213
+ :aria-current="current ? 'page' : undefined"
214
+ :aria-label="collapsed && to && text ? text : undefined"
215
+ :title="collapsed && text ? text : undefined"
216
+ :class="
217
+ cn(
218
+ navRowClass,
219
+ navRowDepthClass(depth),
220
+ to && navRowInteractiveClass,
221
+ current && navRowCurrentClass,
222
+ current && inPanel && navRowBarlessClass,
223
+ collapsed && navRowCollapsedClass,
224
+ props.class,
225
+ )
226
+ "
227
+ >
228
+ <span
229
+ v-if="$slots.icon"
230
+ :class="
231
+ cn(
232
+ navIconClass,
233
+ current ? navIconCurrentClass : navIconRestClass,
234
+ collapsed && navIconRailClass,
235
+ )
236
+ "
237
+ >
238
+ <slot name="icon" />
239
+ </span>
240
+ <span v-if="!collapsed" :class="navLabelClass"><slot /></span>
241
+ <span v-else-if="!to" class="sr-only">{{ text }}</span>
242
+ </component>
243
+ </template>
@@ -0,0 +1,66 @@
1
+ import type { FunctionalComponent, VNode } from 'vue';
2
+ import { h } from 'vue';
3
+ import NavGroup from './NavGroup.vue';
4
+ import NavItem from './NavItem.vue';
5
+ import NavSection from './NavSection.vue';
6
+ import type { NavNode } from './navNode';
7
+
8
+ /** Whether `current` is the `to` of this node or of anything beneath it. */
9
+ function holds(node: NavNode, current: string | undefined): boolean {
10
+ if (current === undefined) return false;
11
+ if ('section' in node) return node.children.some((child) => holds(child, current));
12
+ if (node.children?.length) return node.children.some((child) => holds(child, current));
13
+ return node.to === current;
14
+ }
15
+
16
+ /**
17
+ * The object door's renderer: one level of `NavNode`s drawn as the same three components the
18
+ * markup door is written in, so the two doors cannot draw two menus. Private to the family.
19
+ *
20
+ * A group's open state lives in `state`, which the column owns and keys by node path, because
21
+ * the node type carries none: a group opens by default when it holds the current page and is
22
+ * shut otherwise, and a press on its trigger overrides that for as long as the column stays
23
+ * mounted. It is a functional component so it holds no state of its own.
24
+ */
25
+ interface NavNodesProps {
26
+ nodes: NavNode[];
27
+ current?: string;
28
+ path?: string;
29
+ state: Record<string, boolean>;
30
+ }
31
+
32
+ export const NavNodes: FunctionalComponent<NavNodesProps> = (props) =>
33
+ props.nodes.map((node, index): VNode => {
34
+ const name = 'section' in node ? node.section : (node.to ?? node.label);
35
+ const key = `${props.path ?? ''}/${index}:${name}`;
36
+ const below = (children: NavNode[]) => () =>
37
+ h(NavNodes, { nodes: children, current: props.current, path: key, state: props.state });
38
+ if ('section' in node) {
39
+ return h(
40
+ NavSection,
41
+ { key, title: node.section, accent: node.accent },
42
+ { default: below(node.children) },
43
+ );
44
+ }
45
+ const icon = node.icon ? { icon: () => h(node.icon!) } : {};
46
+ if (node.children?.length) {
47
+ return h(
48
+ NavGroup,
49
+ {
50
+ key,
51
+ label: node.label,
52
+ open: props.state[key] ?? holds(node, props.current),
53
+ 'onUpdate:open': (value: boolean) => {
54
+ props.state[key] = value;
55
+ },
56
+ },
57
+ { ...icon, default: below(node.children) },
58
+ );
59
+ }
60
+ return h(
61
+ NavItem,
62
+ { key, to: node.to, current: node.to !== undefined && node.to === props.current },
63
+ { ...icon, default: () => node.label },
64
+ );
65
+ });
66
+ NavNodes.props = ['nodes', 'current', 'path', 'state'];
@@ -0,0 +1,105 @@
1
+ <script setup lang="ts">
2
+ import type { HTMLAttributes } from 'vue';
3
+ import { computed, inject, provide, ref, useSlots } from 'vue';
4
+ import { cn } from '../../lib/cn';
5
+ import {
6
+ navSectionClass,
7
+ navSectionDotClass,
8
+ navSectionHeadClass,
9
+ navSectionRailSepClass,
10
+ navSectionTitleClass,
11
+ } from './navClasses';
12
+ import { NAV_COLLAPSED, NAV_DEPTH } from './navRegistry';
13
+
14
+ /**
15
+ * A band of the navigation column: an uppercase header over the rows and groups it holds.
16
+ *
17
+ * `accent` is an open string, never a union, for the reason `Section` gives: a fixed list would
18
+ * bake one theme's vocabulary into a package whose premise is interchangeable themes. The
19
+ * component only puts the trimmed name on a `data-brix-accent` attribute of its root and reads no
20
+ * colour itself; the theme decides what the name means (kingfisher ships accent sets, so only
21
+ * there does the name change a colour; under the other themes every name draws the brand). A
22
+ * blank or whitespace-only name is no accent, so it never renders `data-brix-accent=""`, which
23
+ * `[data-brix-accent]` would match. The dot is drawn only under an accent.
24
+ *
25
+ * WHAT ACCENT SETS DO NOT GUARANTEE. The bar beside the current row reads `--accent-base`.
26
+ * Both inks of a row (`--primary-on-wash` current, `--sidebar-foreground` resting) are gated at
27
+ * 4.5:1 at THEME level only. Kingfisher's accent sets rebind `--accent-base` and
28
+ * `--primary-on-wash` for the subtree, and the gate walks theme-and-mode selectors only, so
29
+ * inside an accented section nothing measures either the bar or the current row's ink. Figures
30
+ * below were taken from the declared values with `packages/tokens/src/contrast.ts`, each column
31
+ * on the path its own contract entry is read by: the bar is an INDICATOR, so the ink is washed
32
+ * over its ground and the ground is passed raw, and the ink is a PAIR, so the ground is washed
33
+ * too (a set rebinds the ink, not `--sidebar-accent`, so the ground stays the theme's). The two
34
+ * paths differ in the third decimal where a theme writes `oklch`, which is what kingfisher does
35
+ * for `--sidebar`: an earlier revision read the bar on the pair path and had two of its six
36
+ * figures a hundredth high. They are not a gate's output and will not follow a later edit:
37
+ *
38
+ * bar on the column (floor 3) current row's ink (floor 4.5)
39
+ * teal light 8.95 dark 12.11 light 8.57 dark 10.23
40
+ * amber light 2.91 dark 7.91 light 6.51 dark 6.69
41
+ * indigo light 7.17 dark 8.99 light 6.87 dark 7.59
42
+ *
43
+ * One of the twelve is under its floor: amber's bar in light mode, 2.91. At that spot the ink
44
+ * reads 6.51, which is why the current row is also said by its ink and not only by the bar. That
45
+ * is `NavItem`'s doing; this component's part is to draw no colour of its own, so nothing here
46
+ * can cut across it, and the test scans this file's source to hold it to that.
47
+ *
48
+ * The section resets depth to 0, so its rows read depth 0 even when it sits inside a group. It
49
+ * provides no registry: a row inside it registers with whatever group encloses the section, so a
50
+ * shut group still names the current page it holds. With no group around, a row registers nowhere.
51
+ *
52
+ * In a rail there is no room for a header: the band draws a separator in its place and keeps its
53
+ * title as visually hidden text.
54
+ *
55
+ * The title is the `#title` slot when given and otherwise the `title` prop; with neither there
56
+ * is no header element at all.
57
+ */
58
+ defineOptions({ inheritAttrs: false });
59
+
60
+ const props = defineProps<{
61
+ title?: string;
62
+ accent?: string;
63
+ class?: HTMLAttributes['class'];
64
+ }>();
65
+
66
+ const slots = useSlots();
67
+ const accent = computed(() => props.accent?.trim() || undefined);
68
+ const hasTitle = computed(() => !!slots.title || !!props.title?.trim());
69
+
70
+ const collapsed = inject(NAV_COLLAPSED, ref(false));
71
+
72
+ provide(NAV_DEPTH, ref(0));
73
+ </script>
74
+
75
+ <template>
76
+ <div
77
+ v-bind="$attrs"
78
+ data-slot="nav-section"
79
+ :data-brix-accent="accent"
80
+ :class="cn(navSectionClass, props.class)"
81
+ >
82
+ <template v-if="hasTitle && collapsed">
83
+ <div
84
+ data-slot="nav-section-rail-sep"
85
+ aria-hidden="true"
86
+ :class="navSectionRailSepClass"
87
+ />
88
+ <span class="sr-only"
89
+ ><slot name="title">{{ title }}</slot></span
90
+ >
91
+ </template>
92
+ <div v-else-if="hasTitle" data-slot="nav-section-header" :class="navSectionHeadClass">
93
+ <span
94
+ v-if="accent"
95
+ data-slot="nav-section-dot"
96
+ aria-hidden="true"
97
+ :class="navSectionDotClass"
98
+ />
99
+ <span data-slot="nav-section-title" :class="navSectionTitleClass"
100
+ ><slot name="title">{{ title }}</slot></span
101
+ >
102
+ </div>
103
+ <slot />
104
+ </div>
105
+ </template>
@@ -0,0 +1,137 @@
1
+ <script setup lang="ts">
2
+ import { createReusableTemplate } from '@vueuse/core';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { computed, provide, reactive, useAttrs } from 'vue';
5
+ import { cn } from '../../lib/cn';
6
+ import { Dialog } from '../dialog';
7
+ import { navSidebarClass, navSidebarDrawerClass, navSidebarRailClass } from './navClasses';
8
+ import type { NavNode } from './navNode';
9
+ import { NavNodes } from './NavNodes';
10
+ import { NAV_COLLAPSED } from './navRegistry';
11
+
12
+ /**
13
+ * The navigation column, in three widths: 216px in the page, the 56px rail, and a drawer over
14
+ * the page. It is written in one of two ways that draw the same menu: as markup (`NavSection`,
15
+ * `NavGroup` and `NavItem` in the default slot) or as an object (`items`, walked into those same
16
+ * three components). With `items` the default slot is not drawn.
17
+ *
18
+ * `collapsed` (the rail) and `open` (the drawer) belong to the consumer (ADR 0017); the column
19
+ * only asks for a change. Nothing inside it toggles the rail, so `update:collapsed` is asked
20
+ * for through the `toggle` the `#top` slot is given, for a consumer who wants the button there.
21
+ * The `#top` slot is handed `{ collapsed, toggle }` so a search field can shrink with the rail.
22
+ *
23
+ * THE DEFAULT SLOT IS HANDED `{ collapsed }`, AND FOR THE REASON THE COMPONENT DOOR EXISTS. The
24
+ * three components in it read the rail through `NAV_COLLAPSED`, which is not exported from the
25
+ * package barrel and is not meant to be — but the spec's own argument for preferring markup over
26
+ * an object is that an object door "breaks at the first row that is not a menu item: a separator
27
+ * carrying a count, a live status line", and those are exactly the rows that have to shrink when
28
+ * the column does. Without the scope a consumer's own row could not learn it was in a rail, so
29
+ * the door preferred for arbitrary content was the one that could not shape it. It is the same
30
+ * value the `#top` slot is given: `collapsed` is the RAIL, false in a drawer, which is always
31
+ * the expanded column.
32
+ *
33
+ * THE ONE ASYMMETRY BETWEEN THE DOORS. They draw the same rows, but not the same behaviour: a markup
34
+ * group's `open` is the consumer's (`:open` / `v-model:open`, ADR 0017), while an object group's is
35
+ * kept inside the column, because a `NavNode` carries no open state to own and the plan leaves how
36
+ * it is keyed to the builder. It opens by default when it holds the current page, and a press
37
+ * overrides that until the column unmounts. A consumer who must drive open state writes markup.
38
+ *
39
+ * THE WIDTHS. `w-54` is 216px and `w-14` is 56px: `--spacing` is 0.25rem and Tailwind 4 spaces
40
+ * are dynamic, so 54 steps are 13.5rem. A class name is not a drawn width, so what is drawn is
41
+ * read in the browser, not here.
42
+ *
43
+ * THE DRAWER is the shipped edge `Dialog` (`edge="start"`), which owns the scrim, the focus
44
+ * trap and dismissal; Escape and a press on the scrim arrive here as `update:open`. The panel
45
+ * takes `w-54 max-w-[85vw]` through the dialog's `class`, which merges after its edge map's
46
+ * `w-[95vw]`, and `p-0 gap-0` so the column, not the dialog's padding, is what fills it. The
47
+ * record draws no drawer, so it takes the menu's own width and invents no look. A drawer is
48
+ * always the expanded column; `collapsed` is ignored there. It has no close button of its own
49
+ * (`hide-close`): the scrim and Escape dismiss it.
50
+ *
51
+ * THE LANDMARK. The column is a `<nav>`. Several navigation landmarks on a page each need their
52
+ * own accessible name, so pass `aria-label` (or `aria-labelledby`): attributes land on the
53
+ * `<nav>`. In a drawer they also name the dialog, which has no heading: an `aria-label` is used
54
+ * as it stands, and an `aria-labelledby` is resolved to the text of the element it points at
55
+ * when the drawer is drawn (the `Dialog` itself reads only `aria-label`).
56
+ *
57
+ * A ROW IN THE RAIL NEEDS AN ICON (see `NavItem`): the rail prints no labels.
58
+ *
59
+ * `v-bind="$attrs"` comes before `data-slot` so a consumer attribute cannot overwrite the
60
+ * selector anchor.
61
+ */
62
+ defineOptions({ inheritAttrs: false });
63
+
64
+ const props = defineProps<{
65
+ /** The rail. The consumer owns it (ADR 0017). */
66
+ collapsed?: boolean;
67
+ /** The drawer. Absent means the column is in the page, not over it. */
68
+ drawer?: boolean;
69
+ open?: boolean;
70
+ /** The object door. Absent means the markup door. */
71
+ items?: NavNode[];
72
+ /** The object door's current page, matched against a node's `to`. */
73
+ current?: string;
74
+ class?: HTMLAttributes['class'];
75
+ }>();
76
+ const emit = defineEmits<{
77
+ 'update:collapsed': [boolean];
78
+ 'update:open': [boolean];
79
+ }>();
80
+
81
+ const attrs = useAttrs();
82
+
83
+ // A function, called on every render: attrs are not reactive, and the element an
84
+ // `aria-labelledby` points at is read from the document when the drawer is drawn.
85
+ function dialogName(): string | undefined {
86
+ const label = attrs['aria-label'];
87
+ if (typeof label === 'string' && label.trim()) return label;
88
+ const ids = attrs['aria-labelledby'];
89
+ // No document in a server render: there is nothing to read the name from.
90
+ if (typeof ids !== 'string' || typeof document === 'undefined') return undefined;
91
+ const text = ids
92
+ .split(/\s+/)
93
+ .map((id) => document.getElementById(id)?.textContent?.trim() ?? '')
94
+ .filter(Boolean)
95
+ .join(' ');
96
+ return text || undefined;
97
+ }
98
+ // The object door's groups' open state, keyed by node path (see NavNodes).
99
+ const openState = reactive<Record<string, boolean>>({});
100
+ const rail = computed(() => !props.drawer && !!props.collapsed);
101
+ provide(NAV_COLLAPSED, rail);
102
+
103
+ const [DefineColumn, ReuseColumn] = createReusableTemplate();
104
+ </script>
105
+
106
+ <template>
107
+ <DefineColumn>
108
+ <nav
109
+ v-bind="$attrs"
110
+ data-slot="nav-sidebar"
111
+ :class="
112
+ cn(
113
+ navSidebarClass,
114
+ rail && navSidebarRailClass,
115
+ drawer && navSidebarDrawerClass,
116
+ props.class,
117
+ )
118
+ "
119
+ >
120
+ <slot name="top" :collapsed="rail" :toggle="() => emit('update:collapsed', !rail)" />
121
+ <NavNodes v-if="items" :nodes="items" :current="current" :state="openState" />
122
+ <slot v-else :collapsed="rail" />
123
+ </nav>
124
+ </DefineColumn>
125
+ <Dialog
126
+ v-if="drawer"
127
+ :open="!!open"
128
+ edge="start"
129
+ hide-close
130
+ :aria-label="dialogName()"
131
+ class="max-w-[85vw] w-54 gap-0 p-0"
132
+ @update:open="(value: boolean) => emit('update:open', value)"
133
+ >
134
+ <ReuseColumn />
135
+ </Dialog>
136
+ <ReuseColumn v-else />
137
+ </template>
@@ -0,0 +1,5 @@
1
+ export { default as NavGroup } from './NavGroup.vue';
2
+ export { default as NavItem } from './NavItem.vue';
3
+ export { default as NavSection } from './NavSection.vue';
4
+ export { default as NavSidebar } from './NavSidebar.vue';
5
+ export type { NavNode } from './navNode';
@@ -0,0 +1,112 @@
1
+ import type { InjectionKey } from 'vue';
2
+
3
+ /**
4
+ * The contract of the rail's flyout cascade: what one link of the chain gives the links it
5
+ * holds, and the two figures that make a pointer crossing different from a pointer resting.
6
+ *
7
+ * It is a module of its own rather than an addition to `navRegistry.ts` because that module is
8
+ * the family's registration contract and the three keys in it are read by every component here;
9
+ * the chain is read by `NavGroup` and `NavFlyout` alone.
10
+ */
11
+
12
+ export interface NavChainApi {
13
+ /**
14
+ * Shut every link of the chain at once, the rail's own panel included, and put focus back on
15
+ * the row in the rail that opened it IF the chain was holding focus. Escape asks for this,
16
+ * and so does following a link; `ArrowLeft` does not — it closes one link and returns to that
17
+ * link's own trigger.
18
+ *
19
+ * `restore` is the answer to `holdsFocus` below, read at the link the dismissal arrived at
20
+ * and carried up with the request. It is a parameter rather than a question the root asks
21
+ * for itself because the two are not the same question: the link that is dismissed is the
22
+ * innermost open one, which is where focus is if the chain has it, while the row focus
23
+ * belongs on is the root's. A root asking again would read false for a chain two links deep.
24
+ */
25
+ closeAll(restore?: boolean): void;
26
+ /**
27
+ * Whether focus stands in this link's own panel, on the row that opened it, or anywhere in
28
+ * the links above it. A chain the POINTER opened holds no focus at all, and Escape and an
29
+ * outside press arrive at the engine's layer whatever the user is doing, so a dismissal that
30
+ * focused the trigger regardless took the caret out of the field they were typing in.
31
+ */
32
+ holdsFocus(): boolean;
33
+ /**
34
+ * Tell this link and every link above it that `holds` is a link below, so that the root can
35
+ * ask the question `holdsFocus` answers upwards DOWNWARDS as well. Returns the way to take it
36
+ * back. A column widened under an open chain unmounts the whole chain from its root, and
37
+ * focus may be in a panel the root's own `holdsFocus` cannot see: the nested panels are
38
+ * portalled away from it, and the answer only ever travels up.
39
+ */
40
+ adopt(holds: () => boolean): () => void;
41
+ /**
42
+ * A pointer has come to rest on this link (`true`) or left it (`false`), to be relayed to
43
+ * every link above it.
44
+ *
45
+ * THE CHAIN IS NOT A DOM TREE, and that is the whole reason this exists. Each panel is
46
+ * portalled to the end of `body`, so a nested panel is a SIBLING of the panel whose row opened
47
+ * it, not a descendant: `outer.contains(inner)` is false. The hand crossing from one into the
48
+ * next therefore fires `pointerleave` on the outer panel, which reads as the pointer having
49
+ * left that link, and the link schedules its close — taking the panel under the hand with it,
50
+ * since closing a link unmounts everything it holds. Measured before this existed: resting in
51
+ * the second panel for 600ms left no panel standing at all, which made every child past the
52
+ * first level unreachable by pointer while leaving the keyboard path intact.
53
+ *
54
+ * So intent walks UP. A pointer anywhere in the chain is intent to keep every link above it,
55
+ * and a pointer leaving the innermost panel is intent to close all of them.
56
+ */
57
+ intent(open: boolean): void;
58
+ /**
59
+ * Whether `target` lies in the row that opened this link or any link above it.
60
+ *
61
+ * The engine's layer calls a press on such a row a press OUTSIDE the panel, which it is, and
62
+ * would dismiss on it — and then the row's own click would open the chain straight back up, so
63
+ * the chain could never be pressed shut. The layer that answers a press is the INNERMOST open
64
+ * one, whose own row is two levels below the rail's, which is why this question has to walk the
65
+ * chain rather than ask one link.
66
+ */
67
+ ownsTrigger(target: Node): boolean;
68
+ }
69
+
70
+ /**
71
+ * Provided by a flyout panel to the rows inside it. Its PRESENCE is also what tells a group that
72
+ * it stands inside a flyout and must open its own children as a further panel rather than in
73
+ * place: a 178px panel has as little room for 22px of indent as the 56px rail does.
74
+ */
75
+ export const NAV_CHAIN: InjectionKey<NavChainApi> = Symbol('nav-chain');
76
+
77
+ /**
78
+ * Pointer intent, in milliseconds. A crossing is a pointer that does not stay, so the panel waits
79
+ * before it opens and waits again before it goes, and the second figure is the larger of the two
80
+ * because the gap between a 38px row and its panel is crossed by hand.
81
+ *
82
+ * The record fixes no figure for either, so these are the house's, taken from the two the engine
83
+ * itself ships: `reka-ui`'s `NavigationMenuRoot` opens a menu after `delayDuration: 200`, and its
84
+ * `HoverCardRoot` closes one after `closeDelay: 300`.
85
+ */
86
+ export const NAV_FLYOUT_OPEN_DELAY = 200;
87
+ export const NAV_FLYOUT_CLOSE_DELAY = 300;
88
+
89
+ /**
90
+ * The rows of ONE flyout panel, in document order: its links and the triggers of the groups it
91
+ * holds, and nothing a nested panel holds — a nested panel is portalled to the document's end,
92
+ * so it is not inside this element to be found. A row without `to` is a `div` and takes no focus,
93
+ * which is why the query names the two focusable shapes instead of the slot attributes alone.
94
+ *
95
+ * THE FILTER IS NOT COSMETIC. A group inside a panel keeps its own children mounted in its own
96
+ * hidden kids container even while its panel is shut, because that is how the rail's row knows
97
+ * which page the whole menu holds. Those rows are `display: none` and take no focus, but they are
98
+ * inside this element, so a query that did not drop them would hand the arrows a row nobody can
99
+ * see and `ArrowRight` a first row that is not the first row. A row inside a kids container
100
+ * belongs to that group's level, never to this panel.
101
+ *
102
+ * Both halves of the keyboard pattern read it: the arrows that move within a panel, and the
103
+ * `ArrowRight` on a trigger that enters the panel it has just opened.
104
+ */
105
+ export function navFlyoutRows(panel: Element | null | undefined): HTMLElement[] {
106
+ if (!panel) return [];
107
+ return [
108
+ ...panel.querySelectorAll<HTMLElement>(
109
+ 'a[data-slot="nav-item"], button[data-slot="nav-group-trigger"]',
110
+ ),
111
+ ].filter((row) => row.closest('[data-slot="nav-group-kids"]') === null);
112
+ }