neba 1.18.0 → 1.19.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 (200) hide show
  1. package/dist/a2ui/adapter-catalog.json +1 -1
  2. package/dist/a2ui/catalog.json +2 -2
  3. package/dist/components/accordion/Accordion.js +1 -1
  4. package/dist/components/agent-steps/AgentSteps.js +1 -1
  5. package/dist/components/alert/Alert.js +1 -1
  6. package/dist/components/anchor/Anchor.js +1 -1
  7. package/dist/components/animate-counter/AnimateCounter.js +1 -1
  8. package/dist/components/animate-headline/AnimateHeadline.js +1 -1
  9. package/dist/components/animate-lighting/AnimateLighting.js +1 -1
  10. package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
  11. package/dist/components/animate-scramble/AnimateScramble.js +1 -1
  12. package/dist/components/animate-typing/AnimateTyping.js +1 -1
  13. package/dist/components/app-logo/AppLogo.js +1 -1
  14. package/dist/components/approval/Approval.js +1 -1
  15. package/dist/components/aspect-ratio/AspectRatio.js +1 -1
  16. package/dist/components/avatar/Avatar.js +1 -1
  17. package/dist/components/badge/Badge.js +1 -1
  18. package/dist/components/bar-chart/BarChart.js +1 -1
  19. package/dist/components/blockquote/Blockquote.js +1 -1
  20. package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
  21. package/dist/components/breadcrumb/Breadcrumb.js +1 -1
  22. package/dist/components/button/Button.js +1 -1
  23. package/dist/components/button-group/ButtonGroup.js +1 -1
  24. package/dist/components/calendar/Calendar.js +1 -1
  25. package/dist/components/carousel/Carousel.js +1 -1
  26. package/dist/components/chat-bubble/ChatBubble.js +1 -1
  27. package/dist/components/checkbox/Checkbox.js +1 -1
  28. package/dist/components/checkbox/index.d.ts +1 -1
  29. package/dist/components/checkbox-group/CheckboxGroup.d.ts +84 -0
  30. package/dist/components/checkbox-group/CheckboxGroup.js +1 -0
  31. package/dist/components/checkbox-group/index.d.ts +2 -0
  32. package/dist/components/checkbox-group/index.js +1 -0
  33. package/dist/components/chip/Chip.d.ts +32 -3
  34. package/dist/components/chip/Chip.js +1 -1
  35. package/dist/components/code-block/CodeBlock.js +1 -1
  36. package/dist/components/collapsible/Collapsible.js +1 -1
  37. package/dist/components/color-picker/ColorPicker.js +1 -1
  38. package/dist/components/combobox/Combobox.d.ts +11 -0
  39. package/dist/components/combobox/Combobox.js +1 -1
  40. package/dist/components/combobox/index.d.ts +1 -1
  41. package/dist/components/command-palette/CommandPalette.d.ts +21 -5
  42. package/dist/components/command-palette/CommandPalette.js +1 -1
  43. package/dist/components/command-palette/CommandPaletteSheet.d.ts +27 -0
  44. package/dist/components/command-palette/CommandPaletteSheet.js +1 -0
  45. package/dist/components/command-palette/index.d.ts +1 -1
  46. package/dist/components/confirm/Confirm.d.ts +7 -5
  47. package/dist/components/confirm/Confirm.js +1 -1
  48. package/dist/components/data-list/DataList.js +1 -1
  49. package/dist/components/data-table/DataTable.js +1 -1
  50. package/dist/components/data-table/RowsPerPage.d.ts +43 -0
  51. package/dist/components/data-table/RowsPerPage.js +1 -0
  52. package/dist/components/date-picker/DatePicker.js +1 -1
  53. package/dist/components/date-range-picker/DateRangePicker.js +1 -1
  54. package/dist/components/date-time-picker/DateTimePicker.js +1 -1
  55. package/dist/components/dialog/Dialog.js +1 -1
  56. package/dist/components/dialog/index.d.ts +1 -1
  57. package/dist/components/drawer/Drawer.d.ts +1 -1
  58. package/dist/components/drawer/Drawer.js +1 -1
  59. package/dist/components/empty/Empty.js +1 -1
  60. package/dist/components/fieldset/Fieldset.d.ts +12 -1
  61. package/dist/components/fieldset/Fieldset.js +1 -1
  62. package/dist/components/file-picker/FilePicker.js +1 -1
  63. package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
  64. package/dist/components/floating-action-button/index.d.ts +1 -0
  65. package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
  66. package/dist/components/footer/Footer.js +1 -1
  67. package/dist/components/form/Form.d.ts +8 -2
  68. package/dist/components/form/Form.js +1 -1
  69. package/dist/components/gallery/Gallery.js +1 -1
  70. package/dist/components/gauge-chart/GaugeChart.js +1 -1
  71. package/dist/components/header/Header.js +1 -1
  72. package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
  73. package/dist/components/highlight/Highlight.js +1 -1
  74. package/dist/components/hover-card/HoverCard.js +1 -1
  75. package/dist/components/how-to-steps/HowToSteps.d.ts +3 -0
  76. package/dist/components/how-to-steps/HowToSteps.js +1 -1
  77. package/dist/components/image/Image.js +1 -1
  78. package/dist/components/inline-citation/InlineCitation.d.ts +24 -0
  79. package/dist/components/inline-citation/InlineCitation.js +1 -1
  80. package/dist/components/list/List.d.ts +9 -0
  81. package/dist/components/list/List.js +1 -1
  82. package/dist/components/menu/Menu.js +1 -1
  83. package/dist/components/menubar/Menubar.js +1 -1
  84. package/dist/components/meter/Meter.js +1 -1
  85. package/dist/components/mockup/Mockup.js +1 -1
  86. package/dist/components/navigation-menu/NavigationMenu.d.ts +2 -1
  87. package/dist/components/navigation-menu/NavigationMenu.js +1 -1
  88. package/dist/components/number-field/NumberField.js +1 -1
  89. package/dist/components/number-field/index.d.ts +1 -1
  90. package/dist/components/overlay/Overlay.js +1 -1
  91. package/dist/components/page-layout/PageLayout.js +1 -1
  92. package/dist/components/pagination/Pagination.js +1 -1
  93. package/dist/components/panes/Panes.js +1 -1
  94. package/dist/components/pie-chart/PieChart.js +1 -1
  95. package/dist/components/pill/Pill.js +1 -1
  96. package/dist/components/popover/Popover.js +1 -1
  97. package/dist/components/progress-box/ProgressBox.js +1 -1
  98. package/dist/components/progress-circular/ProgressCircular.js +1 -1
  99. package/dist/components/progress-linear/ProgressLinear.js +1 -1
  100. package/dist/components/prompt-input/PromptInput.js +1 -1
  101. package/dist/components/provider/NebaProvider.d.ts +3 -2
  102. package/dist/components/provider/NebaProvider.js +1 -1
  103. package/dist/components/radio-group/RadioGroup.d.ts +13 -0
  104. package/dist/components/radio-group/RadioGroup.js +1 -1
  105. package/dist/components/radio-group/index.d.ts +1 -1
  106. package/dist/components/rating/Rating.js +1 -1
  107. package/dist/components/reasoning/Reasoning.js +1 -1
  108. package/dist/components/scatter-chart/ScatterChart.js +1 -1
  109. package/dist/components/scroll-area/ScrollArea.js +1 -1
  110. package/dist/components/scroll-zone/ScrollZone.js +1 -1
  111. package/dist/components/segmented-button/SegmentedButton.js +1 -1
  112. package/dist/components/select/Select.d.ts +12 -0
  113. package/dist/components/select/Select.js +1 -1
  114. package/dist/components/select/index.d.ts +1 -1
  115. package/dist/components/shortcut/Shortcut.js +1 -1
  116. package/dist/components/sidebar/Sidebar.js +1 -1
  117. package/dist/components/sidebar/SidebarTrigger.js +1 -1
  118. package/dist/components/skeleton/Skeleton.js +1 -1
  119. package/dist/components/slider/Slider.js +1 -1
  120. package/dist/components/slider/index.d.ts +1 -1
  121. package/dist/components/sources/Sources.js +1 -1
  122. package/dist/components/sparkline/Sparkline.d.ts +7 -0
  123. package/dist/components/sparkline/Sparkline.js +1 -1
  124. package/dist/components/spoiler/Spoiler.js +1 -1
  125. package/dist/components/statistic/Statistic.js +1 -1
  126. package/dist/components/streaming-text/StreamingText.d.ts +10 -6
  127. package/dist/components/streaming-text/StreamingText.js +1 -1
  128. package/dist/components/switch/Switch.js +1 -1
  129. package/dist/components/switch/index.d.ts +1 -1
  130. package/dist/components/table/Table.js +1 -1
  131. package/dist/components/table/index.d.ts +1 -1
  132. package/dist/components/tabs/Tabs.js +1 -1
  133. package/dist/components/text-field/TextField.js +1 -1
  134. package/dist/components/text-field/index.d.ts +1 -1
  135. package/dist/components/text-link/TextLink.js +1 -1
  136. package/dist/components/time-picker/TimePicker.js +1 -1
  137. package/dist/components/timeline-chart/TimelineChart.js +1 -1
  138. package/dist/components/toast/Toast.d.ts +38 -5
  139. package/dist/components/toast/Toast.js +1 -1
  140. package/dist/components/toast/index.d.ts +2 -2
  141. package/dist/components/toast/index.js +1 -1
  142. package/dist/components/toggle/Toggle.js +1 -1
  143. package/dist/components/toggle-group/ToggleGroup.js +1 -1
  144. package/dist/components/tool-call/ToolCall.js +1 -1
  145. package/dist/components/toolbar/Toolbar.js +1 -1
  146. package/dist/components/tooltip/Tooltip.js +1 -1
  147. package/dist/components/tour/Tour.js +1 -1
  148. package/dist/components/tour/index.d.ts +1 -1
  149. package/dist/components/transfer/Transfer.d.ts +7 -0
  150. package/dist/components/transfer/Transfer.js +1 -1
  151. package/dist/components/tree-select/TreeSelect.js +1 -1
  152. package/dist/components/tree-view/TreeView.js +1 -1
  153. package/dist/components/window-pane/WindowPane.js +1 -1
  154. package/dist/index.d.ts +1 -0
  155. package/dist/index.js +1 -1
  156. package/dist/internal/animate.d.ts +34 -2
  157. package/dist/internal/animate.js +1 -1
  158. package/dist/internal/cache.d.ts +7 -1
  159. package/dist/internal/cache.js +1 -1
  160. package/dist/internal/calendar.d.ts +40 -1
  161. package/dist/internal/calendar.js +1 -1
  162. package/dist/internal/chart-frame.d.ts +86 -8
  163. package/dist/internal/chart-frame.js +1 -1
  164. package/dist/internal/chart-line.js +1 -1
  165. package/dist/internal/chart.d.ts +13 -0
  166. package/dist/internal/chart.js +1 -1
  167. package/dist/internal/checkbox-group.d.ts +29 -0
  168. package/dist/internal/checkbox-group.js +1 -0
  169. package/dist/internal/data-table.d.ts +7 -1
  170. package/dist/internal/data-table.js +1 -1
  171. package/dist/internal/date.d.ts +10 -0
  172. package/dist/internal/date.js +1 -1
  173. package/dist/internal/defaults.d.ts +14 -2
  174. package/dist/internal/idle.d.ts +10 -0
  175. package/dist/internal/idle.js +1 -0
  176. package/dist/internal/link.d.ts +4 -3
  177. package/dist/internal/media.js +1 -1
  178. package/dist/internal/observe.d.ts +4 -0
  179. package/dist/internal/observe.js +1 -1
  180. package/dist/internal/page-layout.d.ts +30 -2
  181. package/dist/internal/page-layout.js +1 -1
  182. package/dist/internal/picker.js +1 -1
  183. package/dist/internal/progress.d.ts +17 -0
  184. package/dist/internal/progress.js +1 -1
  185. package/dist/internal/refs.d.ts +18 -0
  186. package/dist/internal/refs.js +1 -0
  187. package/dist/internal/run.d.ts +34 -19
  188. package/dist/internal/run.js +1 -1
  189. package/dist/internal/sizer.d.ts +9 -4
  190. package/dist/internal/sizer.js +1 -1
  191. package/dist/internal/styles.d.ts +27 -1
  192. package/dist/internal/styles.js +1 -1
  193. package/dist/internal/tile.d.ts +34 -0
  194. package/dist/internal/tile.js +1 -0
  195. package/dist/internal/wheel.d.ts +24 -1
  196. package/dist/internal/wheel.js +1 -1
  197. package/dist/styles.css +1 -1
  198. package/dist/tailwind.css +369 -62
  199. package/dist/types.d.ts +4 -2
  200. package/package.json +2 -2
@@ -22,7 +22,7 @@
22
22
  * Chip before anything imported them.
23
23
  */
24
24
  import type * as React from 'react';
25
- import type { NebaColor, NebaDensity, NebaElevation, NebaSize, NebaVariant } from '../types.js';
25
+ import type { NebaColor, NebaDensity, NebaElevation, NebaOrientation, NebaSize, NebaVariant } from '../types.js';
26
26
  /**
27
27
  * Corner radius. ~45% of the control height at every step, held just short of
28
28
  * the 50% that would make it a pill.
@@ -274,6 +274,18 @@ export declare const sheetBodyClasses: Record<NebaSize, string>;
274
274
  export declare const sheetHeaderGapClasses: Record<NebaSize, string>;
275
275
  /** Between a sheet's sections, when there are no dividers to separate them. */
276
276
  export declare const sheetSectionGapClasses: Record<NebaSize, string>;
277
+ /**
278
+ * Between the options of a RadioGroup or a CheckboxGroup, when no `spacing`
279
+ * says otherwise.
280
+ *
281
+ * A column stands on the ladder above, the one a Form and a Fieldset put
282
+ * between their fields, so at `md` an option is as far from the next as a
283
+ * field is: a column of checkboxes and a column of text fields set side by side
284
+ * keep one rhythm. A row keeps a wider step along it, because a label has to
285
+ * end visibly before the next box starts, and puts its wrapped lines on the
286
+ * column's step.
287
+ */
288
+ export declare const optionGapClasses: Record<NebaOrientation, Record<NebaSize, string>>;
277
289
  /**
278
290
  * The frosted surface: a translucent fill over a blurred backdrop, a tile of
279
291
  * noise blended into it for tooth, and an angled sheen. The blur makes it a
@@ -452,6 +464,12 @@ export declare function clampClasses(lines: number): string;
452
464
  export declare function clampSlot(lines: number | undefined): React.CSSProperties | undefined;
453
465
  /** Icons track their label rather than carrying a size of their own. */
454
466
  export declare const iconClasses = "[&_svg]:pointer-events-none [&_svg]:size-[1.2em] [&_svg]:shrink-0";
467
+ /**
468
+ * A Select's trigger: a TextField's shell, to the pixel. Here rather than in
469
+ * `Select.tsx` because a DataTable's rows-per-page control draws the closed
470
+ * Select before the Select's own chunk arrives, and the two must not drift.
471
+ */
472
+ export declare const selectTriggerClasses: string;
455
473
  /**
456
474
  * A Base UI **Collapsible** panel: Collapsible itself, and the three agent
457
475
  * components built on the same primitive.
@@ -671,6 +689,14 @@ export declare function hasContent(node: React.ReactNode): boolean;
671
689
  * length.
672
690
  */
673
691
  export declare function toLength(value: number | string | undefined): string | undefined;
692
+ /**
693
+ * Which of the four units a length is written in, or `undefined` for a string
694
+ * `toPixels` would not read. The same test `toPixels` makes, without converting:
695
+ * converting a `rem` reads the root's font size, which is a style read, and a
696
+ * render that only needs to know *whether* something is a length has no reason
697
+ * to make one.
698
+ */
699
+ export declare function lengthUnit(value: string): 'px' | 'rem' | 'em' | '%' | undefined;
674
700
  /**
675
701
  * The other direction: a CSS length a caller wrote, as the number a drag can do
676
702
  * arithmetic on.
@@ -1 +1 @@
1
- export const radiusClasses={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-sm)",md:"rounded-(--neba-radius-md)",lg:"rounded-(--neba-radius-lg)",xl:"rounded-(--neba-radius-xl)"};export const controlHeightClasses={xs:"h-5.5",sm:"h-6.5",md:"h-8",lg:"h-10",xl:"h-12"};export const fieldHeightClasses={xs:"min-h-5.5",sm:"min-h-6.5",md:"min-h-8",lg:"min-h-10",xl:"min-h-12"};export const controlHeightValues={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"};export const measureWidths={xs:"30rem",sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem"};export function measureValue(e){return"number"==typeof e?`${e}px`:measureWidths[e]??e}export const controlSquareClasses={xs:"w-5.5",sm:"w-6.5",md:"w-8",lg:"w-10",xl:"w-12"};export const controlTextClasses={xs:"text-[0.6875rem]",sm:"text-[0.75rem]",md:"text-[0.8125rem]",lg:"text-[0.9375rem]",xl:"text-[1.0625rem]"};export const controlTextLeadingClasses={xs:"text-[0.6875rem]/[0.875rem]",sm:"text-[0.75rem]/[1rem]",md:"text-[0.8125rem]/[1.25rem]",lg:"text-[0.9375rem]/[1.375rem]",xl:"text-[1.0625rem]/[1.625rem]"};export const metaTextClasses={xs:"text-[0.625rem]",sm:"text-[0.6875rem]",md:"text-[0.75rem]",lg:"text-[0.8125rem]",xl:"text-[0.875rem]"};export const metaTextValues={xs:"0.625rem",sm:"0.6875rem",md:"0.75rem",lg:"0.8125rem",xl:"0.875rem"};export const paddingXClasses={default:{xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}};export const iconSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-5",lg:"size-6",xl:"size-7"};export const tickSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-4.5",lg:"size-5",xl:"size-6"};export const tickRadiusClasses={xs:"rounded-[0.25rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"};export const tickDotClasses={xs:"size-1.5",sm:"size-1.5",md:"size-2",lg:"size-2",xl:"size-2.5"};export const tickRowLeadingClasses="leading-[1.4]";export const hitAreaClasses="neba-hit";export const paddingXValues={default:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},compact:{xs:"0.375rem",sm:"0.5rem",md:"0.625rem",lg:"0.75rem",xl:"1rem"}};export const gapClasses={xs:"gap-1",sm:"gap-1.5",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"};export const stackGapClasses={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};export const sheetTitleClasses={xs:"text-[0.75rem]/[1rem]",sm:"text-[0.8125rem]/[1.125rem]",md:"text-[0.9375rem]/[1.25rem]",lg:"text-[1.0625rem]/[1.5rem]",xl:"text-[1.25rem]/[1.75rem]"};export const sheetTitleHeadingClasses="neba-title [&.neba-title_:where(h1,h2,h3,h4,h5,h6):not([class])]:[font:inherit] [&.neba-title_:where(h1,h2,h3,h4,h5,h6):not([class])]:m-0 [:where(&)_:where(h1,h2,h3,h4,h5,h6)]:[font:inherit] [:where(&)_:where(h1,h2,h3,h4,h5,h6)]:m-0";export const headingTitleClasses={xs:"[&.neba-heading]:text-[0.75rem]/[1rem]",sm:"[&.neba-heading]:text-[0.8125rem]/[1.125rem]",md:"[&.neba-heading]:text-[0.9375rem]/[1.25rem]",lg:"[&.neba-heading]:text-[1.0625rem]/[1.5rem]",xl:"[&.neba-heading]:text-[1.25rem]/[1.75rem]"};export const sheetBodyClasses={xs:"text-[0.6875rem]/[1rem]",sm:"text-[0.75rem]/[1.125rem]",md:"text-[0.8125rem]/[1.375rem]",lg:"text-[0.9375rem]/[1.5rem]",xl:"text-[1.0625rem]/[1.75rem]"};export const sheetHeaderGapClasses={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const sheetSectionGapClasses={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const surfaceClasses="[background-image:var(--neba-grain),var(--neba-sheen)] [background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]";export const ringRestClasses="[outline:0_solid_transparent]";export const transitionClasses=`${ringRestClasses} [transition-property:background-color,border-color,box-shadow,color,outline-color] [transition-duration:var(--neba-duration-fill),var(--neba-duration),var(--neba-duration),var(--neba-duration),var(--neba-duration)] [transition-timing-function:var(--neba-ease)]`;export const pressTransitionClasses="active:[transition-duration:0ms]";export const popupFadeStateClasses="data-[starting-style]:opacity-0 data-[ending-style]:opacity-0";export const popupFadeClasses="[transition:opacity_var(--neba-duration)_var(--neba-ease)] "+popupFadeStateClasses;export const focusRingClasses=`${ringRestClasses} outline-offset-2 focus-visible:[outline:2px_solid_var(--n-ring)]`;export const insetRingClasses=`${ringRestClasses} outline-offset-[-2px] focus-visible:[outline:2px_solid_var(--n-ring)]`;export const focusWithinRingClasses=`${ringRestClasses} outline-offset-2 has-[:focus-visible]:[outline:2px_solid_var(--n-ring)] supports-[not_selector(:has(*))]:focus-within:[outline:2px_solid_var(--n-ring)]`;export const fieldRingClasses=`${ringRestClasses} outline-offset-0 has-[:focus-visible]:[outline:2px_solid_var(--n-ring)]`;export const fieldFocusTransitionClasses="focus-within:[transition-duration:var(--neba-duration)]";export function clampClasses(e){return e>1?"line-clamp-(--n-lines)":"truncate"}export function clampSlot(e){return void 0!==e&&e>1?{"--n-lines":Math.floor(e)}:void 0}export const iconClasses="[&_svg]:pointer-events-none [&_svg]:size-[1.2em] [&_svg]:shrink-0";const e="[transition:height_var(--neba-duration)_var(--neba-ease)] motion-reduce:[transition-duration:0ms] data-[starting-style]:h-0 data-[ending-style]:h-0";export const collapsiblePanelClasses=`h-(--collapsible-panel-height) overflow-hidden ${e}`;export const accordionPanelClasses=`h-(--accordion-panel-height) overflow-hidden ${e}`;export const disclosureTriggerClasses="group/disclosure";export const disclosureChevronClasses="flex h-[1lh] shrink-0 items-center [transition:rotate_var(--neba-duration)_var(--neba-ease)] group-data-[panel-open]/disclosure:rotate-180";export const preformattedClasses="m-0 overflow-auto rounded-(--neba-radius-sm) bg-(--neba-groove) p-2 font-mono text-[0.9em]/[1.5] whitespace-pre";export const srOnlyClasses="absolute size-px overflow-hidden whitespace-nowrap [clip-path:inset(50%)]";export function controlSlots(e,s,t){const n="solid"===t;return{"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`,"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-on-tint":`var(--neba-${e}-on-tint)`,"--n-panel":`var(--neba-${e}-panel)`,"--n-panel-hover":`var(--neba-${e}-panel-hover)`,"--n-panel-press":`var(--neba-${e}-panel-press)`,"--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-glow":n?"var(--neba-glow-on-fill)":`var(--neba-${e}-soft)`,"--n-flash":n?"var(--neba-flash-on-fill)":`var(--neba-${e}-soft-press)`,"--n-elev":`var(--neba-shadow-${s})`,"--n-elev-hover":`var(--neba-shadow-${Math.min(s+1,4)})`,"--n-elev-press":`var(--neba-shadow-${Math.max(s-1,0)})`}}export function surfaceSlots(e,s){return{"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-on-tint":`var(--neba-${e}-on-tint)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-panel-press":"var(--neba-panel-press)","--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-elev":`var(--neba-shadow-${s})`}}export const tintPlateClasses="neba-tint-plate";export const disabledClasses={solid:"cursor-not-allowed bg-(--neba-disabled-bg) text-(--neba-disabled-fg) shadow-none",outline:"cursor-not-allowed border bg-transparent text-(--neba-disabled-fg) [border-color:var(--neba-disabled-border)] shadow-none",text:"cursor-not-allowed bg-transparent text-(--neba-disabled-fg) shadow-none"};export const fieldRestClasses={solid:`${surfaceClasses} text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev),var(--neba-plate-solid)] hover:bg-(--n-panel-press) focus-within:bg-(--n-panel-press)`,outline:`${surfaceClasses} border text-(--neba-fg) bg-(--n-panel) [border-color:var(--n-line)] [box-shadow:var(--n-elev),var(--neba-plate-glass)] hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)] focus-within:bg-(--n-panel-hover) focus-within:[border-color:var(--n-ring)] focus-within:hover:[border-color:var(--n-ring)]`,text:"text-(--neba-fg) bg-transparent hover:bg-(--n-soft) focus-within:bg-(--n-soft-hover) focus-within:hover:bg-(--n-soft-hover)"};export const fieldReadOnlyClasses={solid:`${surfaceClasses} text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--neba-plate-solid)] [filter:saturate(0.55)]`,outline:`${surfaceClasses} border text-(--neba-fg) bg-(--n-panel) [border-color:var(--n-line)] [box-shadow:var(--neba-plate-glass)] [filter:saturate(0.55)]`,text:"text-(--neba-fg) bg-transparent [filter:saturate(0.55)]"};export const readOnlyFilterClasses="[filter:saturate(0.55)]";export const fieldSheetClasses={solid:`${surfaceClasses} text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev)] hover:bg-(--n-panel-press) focus-within:bg-(--n-panel-press)`,outline:`${surfaceClasses} border [border-color:transparent] text-(--neba-fg) bg-(--n-panel) [box-shadow:var(--n-elev)] hover:bg-(--n-panel-hover) focus-within:bg-(--n-panel-hover)`,text:fieldRestClasses.text};export const fieldSheetReadOnlyClasses={solid:`${surfaceClasses} text-(--neba-fg) bg-(--n-panel-hover)`,outline:`${surfaceClasses} border [border-color:transparent] text-(--neba-fg) bg-(--n-panel)`,text:"text-(--neba-fg) bg-transparent"};export const fieldSheetDisabledClasses={solid:disabledClasses.solid,outline:"cursor-not-allowed border bg-transparent text-(--neba-disabled-fg) [border-color:transparent] shadow-none",text:disabledClasses.text};export const citationMarkClasses="inline-flex shrink-0 items-center justify-center rounded-[0.3em] min-w-[1.5em] px-[0.35em] py-[0.05em] bg-(--n-soft) text-[0.8em]/[1.6] font-semibold text-(--n-on-tint) tabular-nums";export const chipRemoveClasses="relative ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full size-[1.15em] cursor-pointer opacity-70 neba-hit [transition:opacity_var(--neba-duration)_var(--neba-ease)] hover:opacity-100 focus-visible:opacity-100 focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1 disabled:cursor-not-allowed";export const sheetCloseClasses="relative flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center rounded-full text-(--neba-muted-fg) neba-hit [&_svg]:size-[1.1em] [&_svg]:shrink-0 [transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)] hover:bg-(--n-soft) hover:text-(--neba-fg) focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2";export function hasContent(e){return null!=e&&!1!==e&&""!==e}export function toLength(e){if(null!=e)return"number"==typeof e?`${e}px`:e}const s=/^\s*(-?[\d.]+)\s*(px|rem|em|%)\s*$/;export function toPixels(e,n){const r=s.exec(e);if(!r)return;const a=Number(r[1]);if(!Number.isNaN(a))switch(r[2]){case"px":return a;case"%":return n.percentOf*a/100;case"em":return a*t(n.relativeTo);default:return a*t("undefined"==typeof document?null:document.documentElement)}}function t(e){return e&&"undefined"!=typeof getComputedStyle&&parseFloat(getComputedStyle(e).fontSize)||16}export function cx(...e){return e.filter(Boolean).join(" ")}
1
+ export const radiusClasses={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-sm)",md:"rounded-(--neba-radius-md)",lg:"rounded-(--neba-radius-lg)",xl:"rounded-(--neba-radius-xl)"};export const controlHeightClasses={xs:"h-5.5",sm:"h-6.5",md:"h-8",lg:"h-10",xl:"h-12"};export const fieldHeightClasses={xs:"min-h-5.5",sm:"min-h-6.5",md:"min-h-8",lg:"min-h-10",xl:"min-h-12"};export const controlHeightValues={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"};export const measureWidths={xs:"30rem",sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem"};export function measureValue(e){return"number"==typeof e?`${e}px`:measureWidths[e]??e}export const controlSquareClasses={xs:"w-5.5",sm:"w-6.5",md:"w-8",lg:"w-10",xl:"w-12"};export const controlTextClasses={xs:"text-[0.6875rem]",sm:"text-[0.75rem]",md:"text-[0.8125rem]",lg:"text-[0.9375rem]",xl:"text-[1.0625rem]"};export const controlTextLeadingClasses={xs:"text-[0.6875rem]/[0.875rem]",sm:"text-[0.75rem]/[1rem]",md:"text-[0.8125rem]/[1.25rem]",lg:"text-[0.9375rem]/[1.375rem]",xl:"text-[1.0625rem]/[1.625rem]"};export const metaTextClasses={xs:"text-[0.625rem]",sm:"text-[0.6875rem]",md:"text-[0.75rem]",lg:"text-[0.8125rem]",xl:"text-[0.875rem]"};export const metaTextValues={xs:"0.625rem",sm:"0.6875rem",md:"0.75rem",lg:"0.8125rem",xl:"0.875rem"};export const paddingXClasses={default:{xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}};export const iconSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-5",lg:"size-6",xl:"size-7"};export const tickSizeClasses={xs:"size-3.5",sm:"size-4",md:"size-4.5",lg:"size-5",xl:"size-6"};export const tickRadiusClasses={xs:"rounded-[0.25rem]",sm:"rounded-[0.3125rem]",md:"rounded-[0.375rem]",lg:"rounded-[0.4375rem]",xl:"rounded-[0.5rem]"};export const tickDotClasses={xs:"size-1.5",sm:"size-1.5",md:"size-2",lg:"size-2",xl:"size-2.5"};export const tickRowLeadingClasses="leading-[1.4]";export const hitAreaClasses="neba-hit";export const paddingXValues={default:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},compact:{xs:"0.375rem",sm:"0.5rem",md:"0.625rem",lg:"0.75rem",xl:"1rem"}};export const gapClasses={xs:"gap-1",sm:"gap-1.5",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"};export const stackGapClasses={xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-1.5",xl:"gap-2"};export const sheetTitleClasses={xs:"text-[0.75rem]/[1rem]",sm:"text-[0.8125rem]/[1.125rem]",md:"text-[0.9375rem]/[1.25rem]",lg:"text-[1.0625rem]/[1.5rem]",xl:"text-[1.25rem]/[1.75rem]"};export const sheetTitleHeadingClasses="neba-title [&.neba-title_:where(h1,h2,h3,h4,h5,h6):not([class])]:[font:inherit] [&.neba-title_:where(h1,h2,h3,h4,h5,h6):not([class])]:m-0 [:where(&)_:where(h1,h2,h3,h4,h5,h6)]:[font:inherit] [:where(&)_:where(h1,h2,h3,h4,h5,h6)]:m-0";export const headingTitleClasses={xs:"[&.neba-heading]:text-[0.75rem]/[1rem]",sm:"[&.neba-heading]:text-[0.8125rem]/[1.125rem]",md:"[&.neba-heading]:text-[0.9375rem]/[1.25rem]",lg:"[&.neba-heading]:text-[1.0625rem]/[1.5rem]",xl:"[&.neba-heading]:text-[1.25rem]/[1.75rem]"};export const sheetBodyClasses={xs:"text-[0.6875rem]/[1rem]",sm:"text-[0.75rem]/[1.125rem]",md:"text-[0.8125rem]/[1.375rem]",lg:"text-[0.9375rem]/[1.5rem]",xl:"text-[1.0625rem]/[1.75rem]"};export const sheetHeaderGapClasses={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const sheetSectionGapClasses={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const optionGapClasses={vertical:sheetSectionGapClasses,horizontal:{xs:"gap-x-5 gap-y-1.5",sm:"gap-x-5 gap-y-2",md:"gap-x-5 gap-y-3",lg:"gap-x-5 gap-y-3.5",xl:"gap-x-5 gap-y-4"}};export const surfaceClasses="[background-image:var(--neba-grain),var(--neba-sheen)] [background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]";export const ringRestClasses="[outline:0_solid_transparent]";export const transitionClasses=`${ringRestClasses} [transition-property:background-color,border-color,box-shadow,color,outline-color] [transition-duration:var(--neba-duration-fill),var(--neba-duration),var(--neba-duration),var(--neba-duration),var(--neba-duration)] [transition-timing-function:var(--neba-ease)]`;export const pressTransitionClasses="active:[transition-duration:0ms]";export const popupFadeStateClasses="data-[starting-style]:opacity-0 data-[ending-style]:opacity-0";export const popupFadeClasses="[transition:opacity_var(--neba-duration)_var(--neba-ease)] "+popupFadeStateClasses;export const focusRingClasses=`${ringRestClasses} outline-offset-2 focus-visible:[outline:2px_solid_var(--n-ring)]`;export const insetRingClasses=`${ringRestClasses} outline-offset-[-2px] focus-visible:[outline:2px_solid_var(--n-ring)]`;export const focusWithinRingClasses=`${ringRestClasses} outline-offset-2 has-[:focus-visible]:[outline:2px_solid_var(--n-ring)] supports-[not_selector(:has(*))]:focus-within:[outline:2px_solid_var(--n-ring)]`;export const fieldRingClasses=`${ringRestClasses} outline-offset-0 has-[:focus-visible]:[outline:2px_solid_var(--n-ring)]`;export const fieldFocusTransitionClasses="focus-within:[transition-duration:var(--neba-duration)]";export function clampClasses(e){return e>1?"line-clamp-(--n-lines)":"truncate"}export function clampSlot(e){return void 0!==e&&e>1?{"--n-lines":Math.floor(e)}:void 0}export const iconClasses="[&_svg]:pointer-events-none [&_svg]:size-[1.2em] [&_svg]:shrink-0";export const selectTriggerClasses=`group relative flex w-full cursor-pointer items-center select-none [-webkit-tap-highlight-color:transparent] [touch-action:manipulation] ${transitionClasses} ${fieldFocusTransitionClasses} ${iconClasses}`;const e="[transition:height_var(--neba-duration)_var(--neba-ease)] motion-reduce:[transition-duration:0ms] data-[starting-style]:h-0 data-[ending-style]:h-0";export const collapsiblePanelClasses=`h-(--collapsible-panel-height) overflow-hidden ${e}`;export const accordionPanelClasses=`h-(--accordion-panel-height) overflow-hidden ${e}`;export const disclosureTriggerClasses="group/disclosure";export const disclosureChevronClasses="flex h-[1lh] shrink-0 items-center [transition:rotate_var(--neba-duration)_var(--neba-ease)] group-data-[panel-open]/disclosure:rotate-180";export const preformattedClasses="m-0 overflow-auto rounded-(--neba-radius-sm) bg-(--neba-groove) p-2 font-mono text-[0.9em]/[1.5] whitespace-pre";export const srOnlyClasses="absolute size-px overflow-hidden whitespace-nowrap [clip-path:inset(50%)]";export function controlSlots(e,s,t){const n="solid"===t;return{"--n-fill":`var(--neba-${e}-fill)`,"--n-fill-hover":`var(--neba-${e}-fill-hover)`,"--n-fill-active":`var(--neba-${e}-fill-active)`,"--n-on-solid":`var(--neba-${e}-on-solid)`,"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-on-tint":`var(--neba-${e}-on-tint)`,"--n-panel":`var(--neba-${e}-panel)`,"--n-panel-hover":`var(--neba-${e}-panel-hover)`,"--n-panel-press":`var(--neba-${e}-panel-press)`,"--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-glow":n?"var(--neba-glow-on-fill)":`var(--neba-${e}-soft)`,"--n-flash":n?"var(--neba-flash-on-fill)":`var(--neba-${e}-soft-press)`,"--n-elev":`var(--neba-shadow-${s})`,"--n-elev-hover":`var(--neba-shadow-${Math.min(s+1,4)})`,"--n-elev-press":`var(--neba-shadow-${Math.max(s-1,0)})`}}export function surfaceSlots(e,s){return{"--n-accent":`var(--neba-${e}-accent)`,"--n-soft":`var(--neba-${e}-soft)`,"--n-soft-hover":`var(--neba-${e}-soft-hover)`,"--n-soft-press":`var(--neba-${e}-soft-press)`,"--n-on-tint":`var(--neba-${e}-on-tint)`,"--n-panel":"var(--neba-panel)","--n-panel-hover":"var(--neba-panel-hover)","--n-panel-press":"var(--neba-panel-press)","--n-line":`var(--neba-${e}-line)`,"--n-line-hover":`var(--neba-${e}-line-hover)`,"--n-ring":`var(--neba-${e}-ring)`,"--n-elev":`var(--neba-shadow-${s})`}}export const tintPlateClasses="neba-tint-plate";export const disabledClasses={solid:"cursor-not-allowed bg-(--neba-disabled-bg) text-(--neba-disabled-fg) shadow-none",outline:"cursor-not-allowed border bg-transparent text-(--neba-disabled-fg) [border-color:var(--neba-disabled-border)] shadow-none",text:"cursor-not-allowed bg-transparent text-(--neba-disabled-fg) shadow-none"};export const fieldRestClasses={solid:`${surfaceClasses} text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev),var(--neba-plate-solid)] hover:bg-(--n-panel-press) focus-within:bg-(--n-panel-press)`,outline:`${surfaceClasses} border text-(--neba-fg) bg-(--n-panel) [border-color:var(--n-line)] [box-shadow:var(--n-elev),var(--neba-plate-glass)] hover:bg-(--n-panel-hover) hover:[border-color:var(--n-line-hover)] focus-within:bg-(--n-panel-hover) focus-within:[border-color:var(--n-ring)] focus-within:hover:[border-color:var(--n-ring)]`,text:"text-(--neba-fg) bg-transparent hover:bg-(--n-soft) focus-within:bg-(--n-soft-hover) focus-within:hover:bg-(--n-soft-hover)"};export const fieldReadOnlyClasses={solid:`${surfaceClasses} text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--neba-plate-solid)] [filter:saturate(0.55)]`,outline:`${surfaceClasses} border text-(--neba-fg) bg-(--n-panel) [border-color:var(--n-line)] [box-shadow:var(--neba-plate-glass)] [filter:saturate(0.55)]`,text:"text-(--neba-fg) bg-transparent [filter:saturate(0.55)]"};export const readOnlyFilterClasses="[filter:saturate(0.55)]";export const fieldSheetClasses={solid:`${surfaceClasses} text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev)] hover:bg-(--n-panel-press) focus-within:bg-(--n-panel-press)`,outline:`${surfaceClasses} border [border-color:transparent] text-(--neba-fg) bg-(--n-panel) [box-shadow:var(--n-elev)] hover:bg-(--n-panel-hover) focus-within:bg-(--n-panel-hover)`,text:fieldRestClasses.text};export const fieldSheetReadOnlyClasses={solid:`${surfaceClasses} text-(--neba-fg) bg-(--n-panel-hover)`,outline:`${surfaceClasses} border [border-color:transparent] text-(--neba-fg) bg-(--n-panel)`,text:"text-(--neba-fg) bg-transparent"};export const fieldSheetDisabledClasses={solid:disabledClasses.solid,outline:"cursor-not-allowed border bg-transparent text-(--neba-disabled-fg) [border-color:transparent] shadow-none",text:disabledClasses.text};export const citationMarkClasses="inline-flex shrink-0 items-center justify-center rounded-[0.3em] min-w-[1.5em] px-[0.35em] py-[0.05em] bg-(--n-soft) text-[0.8em]/[1.6] font-semibold text-(--n-on-tint) tabular-nums";export const chipRemoveClasses="relative ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full size-[1.15em] cursor-pointer opacity-70 neba-hit [transition:opacity_var(--neba-duration)_var(--neba-ease)] hover:opacity-100 focus-visible:opacity-100 focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1 disabled:cursor-not-allowed";export const sheetCloseClasses="relative flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center rounded-full text-(--neba-muted-fg) neba-hit [&_svg]:size-[1.1em] [&_svg]:shrink-0 [transition:background-color_var(--neba-duration)_var(--neba-ease),color_var(--neba-duration)_var(--neba-ease)] hover:bg-(--n-soft) hover:text-(--neba-fg) focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2";export function hasContent(e){return null!=e&&!1!==e&&""!==e}export function toLength(e){if(null!=e)return"number"==typeof e?`${e}px`:e}const s=/^\s*(-?[\d.]+)\s*(px|rem|em|%)\s*$/;export function lengthUnit(e){const t=s.exec(e);if(t&&!Number.isNaN(Number(t[1])))return t[2]}export function toPixels(e,n){const r=s.exec(e);if(!r)return;const a=Number(r[1]);if(!Number.isNaN(a))switch(r[2]){case"px":return a;case"%":return n.percentOf*a/100;case"em":return a*t(n.relativeTo);default:return a*t("undefined"==typeof document?null:document.documentElement)}}function t(e){return e&&"undefined"!=typeof getComputedStyle&&parseFloat(getComputedStyle(e).fontSize)||16}export function cx(...e){return e.filter(Boolean).join(" ")}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Keeps a sliding tile on the item it marks while the items change under it.
3
+ *
4
+ * A SegmentedButton and a FloatingBottomNavigation draw one tile behind the
5
+ * current item and measure that item to place it. A value change is a render
6
+ * of the component and is measured there. What is not is a change to the items
7
+ * themselves: a label that grew, a font that arrived, the set reordered by its
8
+ * caller. Both components used to catch those by measuring again whenever their
9
+ * `children` changed identity, which is every render of whatever is above them,
10
+ * and every one of those measurements laid the page out to read four offsets
11
+ * that had not moved.
12
+ *
13
+ * So the items are watched instead, and nothing is measured unless something
14
+ * happened to them:
15
+ *
16
+ * - **The root's size**, with no animation. That is the container moving under
17
+ * a tile that was already in the right place, and a tile that slides there
18
+ * lags behind a window being dragged.
19
+ * - **Each item's size**, animated, as a label change always was.
20
+ * - **The set itself**, through a `MutationObserver` on the root: an item added,
21
+ * removed or moved, and the attribute that marks the current one moving to
22
+ * another node, which is what a reorder of unkeyed items looks like.
23
+ *
24
+ * The root is observed before any item, and that order is load-bearing. One
25
+ * `ResizeObserver` delivers its entries in the order its targets were added,
26
+ * so when a resize of the root resizes the items with it, the instant
27
+ * placement lands first and the animated ones that follow find the tile
28
+ * already there. The other way round, the animated one starts a transition and
29
+ * the instant one, asking for the same box, cannot stop it.
30
+ *
31
+ * `items` selects every item and `current` names the attribute on the current
32
+ * one. Returns what stops all three.
33
+ */
34
+ export declare function watchTile(root: HTMLElement, items: string, current: string, measure: (animate: boolean) => void): () => void;
@@ -0,0 +1 @@
1
+ import{observeResize as e}from"./observe.js";export function watchTile(t,o,r,s){const n=e(t,()=>s(!1)),c=new Map,i=()=>{const r=new Set(t.querySelectorAll(o));for(const[e,t]of c)r.has(e)||(t(),c.delete(e));for(const t of r)c.has(t)||c.set(t,e(t,()=>s(!0)))};i();const a=new MutationObserver(()=>{i(),s(!0)});return a.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[r]}),()=>{n(),a.disconnect();for(const e of c.values())e();c.clear()}}
@@ -18,7 +18,11 @@
18
18
  * Held only where there is a strip to hold it. A bar that fits in its box takes
19
19
  * nothing at all, which is what makes it safe to leave on: three tabs in a row
20
20
  * are not a scroll container as far as the reader is concerned, and must not
21
- * behave like one.
21
+ * behave like one. And it takes no listener either, which is what
22
+ * `bindAxisWheelWhileOverflowing` is for: a wheel listener that can cancel the
23
+ * scroll makes the browser ask the page's main thread before it scrolls
24
+ * anything under it, so every tab bar on a page held up the page's own scroll
25
+ * while the pointer crossed it, whether the bar could scroll or not.
22
26
  *
23
27
  * Two gestures are deliberately left alone. A wheel held with Ctrl is a zoom. A
24
28
  * trackpad swiping sideways is already travel along the strip, and the browser
@@ -36,3 +40,22 @@
36
40
  * if the page does not answer it as well.
37
41
  */
38
42
  export declare function bindAxisWheel(el: HTMLElement): () => void;
43
+ /** What `bindAxisWheelWhileOverflowing` hands back. */
44
+ export interface AxisWheelBinding {
45
+ /** Measures the strip again, and takes or drops the wheel to match. */
46
+ check: () => void;
47
+ /** The teardown. */
48
+ stop: () => void;
49
+ }
50
+ /**
51
+ * `bindAxisWheel`, attached only while the strip overflows along its width —
52
+ * the one case its handler acts on, measured the same way.
53
+ *
54
+ * `check` is for the caller to run whenever it measures the strip anyway: on a
55
+ * scroll, a resize, a change in what it holds. The strip also checks when a
56
+ * pointer arrives over it, because a label can grow without resizing anything
57
+ * an observer is watching, and a wheel can only reach the strip through a
58
+ * pointer that is over it. The reads come first and nothing is written, so a
59
+ * caller can run it ahead of its own writes without forcing a layout.
60
+ */
61
+ export declare function bindAxisWheelWhileOverflowing(el: HTMLElement): AxisWheelBinding;
@@ -1 +1 @@
1
- export function bindAxisWheel(e){const t=t=>{if(t.defaultPrevented)return;if(t.ctrlKey||Math.abs(t.deltaX)>Math.abs(t.deltaY))return;if(e.scrollWidth-e.clientWidth<=1)return;const r=1===t.deltaMode?16:2===t.deltaMode?e.clientWidth:1,l=t.deltaY*r;if(!l)return;t.preventDefault();const n="rtl"===getComputedStyle(e).direction;e.scrollBy({left:n?-l:l,behavior:"auto"})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)}
1
+ export function bindAxisWheel(e){const t=t=>{if(t.defaultPrevented)return;if(t.ctrlKey||Math.abs(t.deltaX)>Math.abs(t.deltaY))return;if(e.scrollWidth-e.clientWidth<=1)return;const n=1===t.deltaMode?16:2===t.deltaMode?e.clientWidth:1,l=t.deltaY*n;if(!l)return;t.preventDefault();const r="rtl"===getComputedStyle(e).direction;e.scrollBy({left:r?-l:l,behavior:"auto"})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)}export function bindAxisWheelWhileOverflowing(e){let t=null;const n=()=>{const n=e.scrollWidth-e.clientWidth>1;n&&!t?t=bindAxisWheel(e):!n&&t&&(t(),t=null)};return e.addEventListener("pointerenter",n),n(),{check:n,stop(){e.removeEventListener("pointerenter",n),t?.(),t=null}}}