@fragiola/primitives 0.0.0-stage → 0.1.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 (192) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/LICENSE +21 -0
  3. package/README.md +50 -2
  4. package/dist/async-list-Bv6ff5Oj.js +81 -0
  5. package/dist/async-list-Bv6ff5Oj.js.map +1 -0
  6. package/dist/async-list.d.ts +2 -0
  7. package/dist/async-list.js +1 -0
  8. package/dist/calendar-keys-DGYpjLwv.d.ts +12 -0
  9. package/dist/calendar-system-B5U5HcPQ.d.ts +415 -0
  10. package/dist/calendar-systems-Daa6Q_ca.js +659 -0
  11. package/dist/calendar-systems-Daa6Q_ca.js.map +1 -0
  12. package/dist/calendar-systems.d.ts +3 -0
  13. package/dist/calendar-systems.js +1 -0
  14. package/dist/carousel-LRbWqbAx.js +375 -0
  15. package/dist/carousel-LRbWqbAx.js.map +1 -0
  16. package/dist/carousel.d.ts +2 -0
  17. package/dist/carousel.js +1 -0
  18. package/dist/cascade-B155Xvvv.js +64 -0
  19. package/dist/cascade-B155Xvvv.js.map +1 -0
  20. package/dist/cascade.d.ts +2 -0
  21. package/dist/cascade.js +1 -0
  22. package/dist/clipboard-Cy2cbGEW.js +33 -0
  23. package/dist/clipboard-Cy2cbGEW.js.map +1 -0
  24. package/dist/clipboard.d.ts +2 -0
  25. package/dist/clipboard.js +1 -0
  26. package/dist/collection-Dbk-PB5S.js +609 -0
  27. package/dist/collection-Dbk-PB5S.js.map +1 -0
  28. package/dist/collection.d.ts +2 -0
  29. package/dist/collection.js +3 -0
  30. package/dist/color-sURV5Irg.js +699 -0
  31. package/dist/color-sURV5Irg.js.map +1 -0
  32. package/dist/color.d.ts +2 -0
  33. package/dist/color.js +1 -0
  34. package/dist/command-DueCXi65.js +104 -0
  35. package/dist/command-DueCXi65.js.map +1 -0
  36. package/dist/command.d.ts +2 -0
  37. package/dist/command.js +1 -0
  38. package/dist/date-CrbFSJKQ.js +215 -0
  39. package/dist/date-CrbFSJKQ.js.map +1 -0
  40. package/dist/date.d.ts +4 -0
  41. package/dist/date.js +1 -0
  42. package/dist/direction-CTnVLpmd.d.ts +8 -0
  43. package/dist/direction-DJDPvnxJ.js +13 -0
  44. package/dist/direction-DJDPvnxJ.js.map +1 -0
  45. package/dist/direction.d.ts +2 -0
  46. package/dist/direction.js +1 -0
  47. package/dist/drag-session-CSr06B5v.js +41 -0
  48. package/dist/drag-session-CSr06B5v.js.map +1 -0
  49. package/dist/file-DSLtfzbi.js +263 -0
  50. package/dist/file-DSLtfzbi.js.map +1 -0
  51. package/dist/file.d.ts +2 -0
  52. package/dist/file.js +1 -0
  53. package/dist/focus-BI-VvM0f.js +75 -0
  54. package/dist/focus-BI-VvM0f.js.map +1 -0
  55. package/dist/focus.d.ts +2 -0
  56. package/dist/focus.js +3 -0
  57. package/dist/form-DovwKtqz.js +501 -0
  58. package/dist/form-DovwKtqz.js.map +1 -0
  59. package/dist/form.d.ts +2 -0
  60. package/dist/form.js +1 -0
  61. package/dist/hover-BakyPYnC.js +62 -0
  62. package/dist/hover-BakyPYnC.js.map +1 -0
  63. package/dist/hover.d.ts +2 -0
  64. package/dist/hover.js +1 -0
  65. package/dist/id-B0Y8iZrc.js +13 -0
  66. package/dist/id-B0Y8iZrc.js.map +1 -0
  67. package/dist/id.d.ts +2 -0
  68. package/dist/id.js +1 -0
  69. package/dist/image-D4X_yRYw.js +44 -0
  70. package/dist/image-D4X_yRYw.js.map +1 -0
  71. package/dist/image.d.ts +2 -0
  72. package/dist/image.js +1 -0
  73. package/dist/index-B0rwIZw9.d.ts +51 -0
  74. package/dist/index-B4wF1isn.d.ts +128 -0
  75. package/dist/index-BHiBRE01.d.ts +20 -0
  76. package/dist/index-BNlMm-0u.d.ts +17 -0
  77. package/dist/index-BapNrjY9.d.ts +48 -0
  78. package/dist/index-Bd-tVb7C.d.ts +6 -0
  79. package/dist/index-BjE8nDiX.d.ts +125 -0
  80. package/dist/index-BpbT-FsX.d.ts +117 -0
  81. package/dist/index-CBgGcTeX.d.ts +37 -0
  82. package/dist/index-CGThV_Md.d.ts +100 -0
  83. package/dist/index-CMig3TXL.d.ts +28 -0
  84. package/dist/index-CWFRduRd.d.ts +212 -0
  85. package/dist/index-CkrHWyU_.d.ts +33 -0
  86. package/dist/index-Cwu6f7y1.d.ts +18 -0
  87. package/dist/index-D10LDdR6.d.ts +139 -0
  88. package/dist/index-D146vm21.d.ts +104 -0
  89. package/dist/index-DGKhEvNr.d.ts +107 -0
  90. package/dist/index-DbAu4s16.d.ts +48 -0
  91. package/dist/index-DdaCj6IO.d.ts +54 -0
  92. package/dist/index-DeHcNdjC.d.ts +68 -0
  93. package/dist/index-DeR4ncrW.d.ts +93 -0
  94. package/dist/index-HIksgK0e.d.ts +70 -0
  95. package/dist/index-IZB0mlZl.d.ts +71 -0
  96. package/dist/index-IfDZj87U.d.ts +28 -0
  97. package/dist/index-SrTuVBms.d.ts +75 -0
  98. package/dist/index-T9UcYvkf.d.ts +339 -0
  99. package/dist/index-fRTojAoR.d.ts +31 -0
  100. package/dist/index-fuLUke9n.d.ts +6 -0
  101. package/dist/index-l63esAck.d.ts +104 -0
  102. package/dist/index-raSUg9U7.d.ts +38 -0
  103. package/dist/index-twgzPKvZ.d.ts +278 -0
  104. package/dist/index-wBpjRykh.d.ts +125 -0
  105. package/dist/index.d.ts +39 -0
  106. package/dist/index.js +42 -0
  107. package/dist/inert-DlGToy3q.js +80 -0
  108. package/dist/inert-DlGToy3q.js.map +1 -0
  109. package/dist/inert.d.ts +2 -0
  110. package/dist/inert.js +1 -0
  111. package/dist/layer-stack-BEtzaFC1.js +118 -0
  112. package/dist/layer-stack-BEtzaFC1.js.map +1 -0
  113. package/dist/layers-C-N4rrZX.js +24 -0
  114. package/dist/layers-C-N4rrZX.js.map +1 -0
  115. package/dist/layers.d.ts +2 -0
  116. package/dist/layers.js +3 -0
  117. package/dist/list-navigation-CbWv4DK5.js +40 -0
  118. package/dist/list-navigation-CbWv4DK5.js.map +1 -0
  119. package/dist/month-year-BG5imFUq.js +108 -0
  120. package/dist/month-year-BG5imFUq.js.map +1 -0
  121. package/dist/month-year.d.ts +3 -0
  122. package/dist/month-year.js +1 -0
  123. package/dist/number-BFUio97d.js +316 -0
  124. package/dist/number-BFUio97d.js.map +1 -0
  125. package/dist/number.d.ts +2 -0
  126. package/dist/number.js +1 -0
  127. package/dist/overlay-BwPyiM3T.js +78 -0
  128. package/dist/overlay-BwPyiM3T.js.map +1 -0
  129. package/dist/overlay.d.ts +2 -0
  130. package/dist/overlay.js +1 -0
  131. package/dist/pagination-BkVzaIGP.js +51 -0
  132. package/dist/pagination-BkVzaIGP.js.map +1 -0
  133. package/dist/pagination.d.ts +2 -0
  134. package/dist/pagination.js +1 -0
  135. package/dist/plain-date-idQH1P6X.d.ts +29 -0
  136. package/dist/plain-date-time-B8PGahhe.d.ts +99 -0
  137. package/dist/pointer-CuDtD9XA.js +189 -0
  138. package/dist/pointer-CuDtD9XA.js.map +1 -0
  139. package/dist/pointer.d.ts +2 -0
  140. package/dist/pointer.js +3 -0
  141. package/dist/positioning-DDUQ75mB.js +148 -0
  142. package/dist/positioning-DDUQ75mB.js.map +1 -0
  143. package/dist/positioning.d.ts +2 -0
  144. package/dist/positioning.js +1 -0
  145. package/dist/presence-BhKDOmII.js +86 -0
  146. package/dist/presence-BhKDOmII.js.map +1 -0
  147. package/dist/presence.d.ts +2 -0
  148. package/dist/presence.js +1 -0
  149. package/dist/range-o0_GBhyY.js +158 -0
  150. package/dist/range-o0_GBhyY.js.map +1 -0
  151. package/dist/range.d.ts +2 -0
  152. package/dist/range.js +1 -0
  153. package/dist/scroll-area-BYNhv36t.js +447 -0
  154. package/dist/scroll-area-BYNhv36t.js.map +1 -0
  155. package/dist/scroll-area.d.ts +2 -0
  156. package/dist/scroll-area.js +1 -0
  157. package/dist/scroll-lock-JzRNOA1O.js +42 -0
  158. package/dist/scroll-lock-JzRNOA1O.js.map +1 -0
  159. package/dist/scroll-lock.d.ts +2 -0
  160. package/dist/scroll-lock.js +1 -0
  161. package/dist/segments-eRu5G_Bd.js +587 -0
  162. package/dist/segments-eRu5G_Bd.js.map +1 -0
  163. package/dist/segments.d.ts +3 -0
  164. package/dist/segments.js +1 -0
  165. package/dist/selection-Cor67w_V.js +287 -0
  166. package/dist/selection-Cor67w_V.js.map +1 -0
  167. package/dist/selection.d.ts +2 -0
  168. package/dist/selection.js +1 -0
  169. package/dist/swipe.d.ts +2 -0
  170. package/dist/swipe.js +1 -0
  171. package/dist/tabbable-BPiLssIv.js +35 -0
  172. package/dist/tabbable-BPiLssIv.js.map +1 -0
  173. package/dist/time-Ct6oq9kt.js +208 -0
  174. package/dist/time-Ct6oq9kt.js.map +1 -0
  175. package/dist/time-zone-DegkzwST.js +305 -0
  176. package/dist/time-zone-DegkzwST.js.map +1 -0
  177. package/dist/time-zone.d.ts +2 -0
  178. package/dist/time-zone.js +1 -0
  179. package/dist/time.d.ts +2 -0
  180. package/dist/time.js +1 -0
  181. package/dist/toast-BjRpJalM.js +400 -0
  182. package/dist/toast-BjRpJalM.js.map +1 -0
  183. package/dist/toast.d.ts +2 -0
  184. package/dist/toast.js +1 -0
  185. package/dist/unit-grid-DJy8lb5D.d.ts +21 -0
  186. package/dist/virtual-BlX1RuHD.js +306 -0
  187. package/dist/virtual-BlX1RuHD.js.map +1 -0
  188. package/dist/virtual.d.ts +2 -0
  189. package/dist/virtual.js +1 -0
  190. package/dist/watch-swipe-BIucfr9O.js +301 -0
  191. package/dist/watch-swipe-BIucfr9O.js.map +1 -0
  192. package/package.json +234 -3
@@ -0,0 +1,70 @@
1
+ /**
2
+ * How an overlay asks to be dismissed (spec/README.md, "Change details"): `none` when the overlay
3
+ * it was opened from closed (spec/README.md, "The nested overlay tree").
4
+ */
5
+ type DismissReason = "escape-key" | "outside-press" | "focus-out" | "none";
6
+ /** The DOM event that dismissed it: `undefined` when an ancestor overlay closed. */
7
+ type DismissEvent = KeyboardEvent | PointerEvent | FocusEvent | undefined;
8
+ type Elements = () => readonly (Element | null | undefined)[];
9
+ interface OverlaySessionOptions {
10
+ /** The overlay's own elements (its positioner or popup). */
11
+ elements: Elements;
12
+ /** Elements a press on does not dismiss it (its trigger, which toggles it itself). */
13
+ ignore?: Elements;
14
+ /**
15
+ * The elements it was opened from (its triggers), which make it a child of the overlay that
16
+ * contains them (default: `ignore`).
17
+ */
18
+ owner?: Elements;
19
+ /**
20
+ * Elements that cover the page under it (a dialog's backdrop and viewport): a press on one is
21
+ * outside this overlay but inside its parent.
22
+ */
23
+ backdrops?: Elements;
24
+ /**
25
+ * A modal overlay (a dialog): a press outside it and its descendants is outside it but inside
26
+ * its parent, so the overlays it was opened from stay open (`pushLayer`'s `modal`).
27
+ */
28
+ modal?: boolean;
29
+ /**
30
+ * Called when Escape, an outside press, (with `focusOut`) focus leaving, or the close of the
31
+ * overlay it was opened from (`none`) dismisses it, with the event that did.
32
+ */
33
+ dismiss: (reason: DismissReason, event?: DismissEvent) => void;
34
+ /**
35
+ * Non-modal overlays: dismiss when focus moves outside the overlay, its child layers and these
36
+ * elements (usually the trigger).
37
+ */
38
+ focusOut?: Elements;
39
+ /**
40
+ * Where focus goes when the session ends: `to()` when `reason()` (the reason the overlay closed)
41
+ * is one of `when` (or always, without `when`); nowhere otherwise. `to()` may return `false`
42
+ * for "do not move focus".
43
+ */
44
+ returnFocus?: {
45
+ when?: ReadonlySet<string>;
46
+ /**
47
+ * Reasons that return focus only once the press that dismissed the overlay has ended, and
48
+ * only when it left focus nowhere (on the body) or inside the closing overlay (which is
49
+ * leaving, with its exit animation): a press on a focusable element keeps the focus it
50
+ * gave (spec/popover.md, "Focus": Base UI's focus after an outside press). A getter is
51
+ * read when the session ends (a menu's `modal` may change while it is open).
52
+ */
53
+ whenUnfocused?: ReadonlySet<string> | (() => ReadonlySet<string> | undefined);
54
+ reason: () => string | null;
55
+ to: () => HTMLElement | null | false;
56
+ };
57
+ }
58
+ interface OverlaySession {
59
+ /** The elements of the overlays opened from this one (its descendant layers). */
60
+ elementsAbove: () => Element[];
61
+ /** Ends the session: removes the layer and the focus watch, then returns focus if due. */
62
+ end: () => void;
63
+ }
64
+ /**
65
+ * The wiring every overlay repeats (docs/reports/checkpoint.md, boundary pressure 2): its layer
66
+ * (Escape, outside presses), the non-modal focus-out watch, and the focus return by close reason.
67
+ * It holds no component state: the framework passes what it knows through the callbacks.
68
+ */
69
+ declare function openOverlaySession(doc: Document, options: OverlaySessionOptions): OverlaySession;
70
+ export { openOverlaySession as a, OverlaySessionOptions as i, DismissReason as n, OverlaySession as r, DismissEvent as t };
@@ -0,0 +1,71 @@
1
+ interface DragSessionOptions {
2
+ /** Every move of the dragging pointer, captured: outside the element and the window too. */
3
+ onMove: (event: PointerEvent) => void;
4
+ /** The drag ended: pointer up, cancel or a lost capture (`null` when `end()` stopped it). */
5
+ onEnd: (event: PointerEvent | null) => void;
6
+ }
7
+ /**
8
+ * A pointer drag from `event` (a `pointerdown` on `element`), with pointer capture (spec/slider.md,
9
+ * "Pointer"): `element` receives the pointer's moves until it is released. It holds no value;
10
+ * the framework turns each move into its state. Returns the cleanup, which also ends the drag.
11
+ */
12
+ declare function startDrag(element: Element, event: PointerEvent, options: DragSessionOptions): () => void;
13
+ interface Point {
14
+ x: number;
15
+ y: number;
16
+ }
17
+ /**
18
+ * Whether `point` is in the triangle between where the pointer left a submenu's trigger and the
19
+ * near edge of the submenu (spec/menu.md, "Pointer": crossing sibling items on the way does not
20
+ * close the submenu).
21
+ */
22
+ declare function isInSafeArea(point: Point, from: Point, submenu: Element): boolean;
23
+ /**
24
+ * Whether `point` is over `trigger`, over `popup`, or in the box that spans both (the gap the
25
+ * pointer crosses from a tooltip's trigger to its popup: spec/tooltip.md, "Pointer").
26
+ */
27
+ declare function isInHoverBridge(point: Point, trigger: Element, popup: Element): boolean;
28
+ interface LongPressOptions {
29
+ /** How long the pointer must stay down, in ms (default 500: spec/context-menu.md). */
30
+ delay?: number;
31
+ /** How far it may move from where it went down before the press is canceled, in px (default 10). */
32
+ moveTolerance?: number;
33
+ /** The pointer types that long-press (default `["touch"]`: the mouse has its right button). */
34
+ pointerTypes?: readonly string[];
35
+ /** The press lasted `delay`: where it went down, and its `pointerdown`. */
36
+ onLongPress: (point: Point, event: PointerEvent) => void;
37
+ }
38
+ /**
39
+ * Watches `element` for a long press (spec/context-menu.md, "Pointer"): a pointer of one of
40
+ * `pointerTypes` held down for `delay` without moving beyond `moveTolerance`. A release, a cancel
41
+ * or a larger move before then cancels it. Once a long press fired, the `click` and the
42
+ * `contextmenu` event that follow its release are swallowed (stopped, their default prevented), so
43
+ * they neither activate what is under the finger nor open the browser's menu. Returns the cleanup.
44
+ */
45
+ declare function watchLongPress(element: Element, options: LongPressOptions): () => void;
46
+ interface HoverBridgeCallbacks {
47
+ /** The pointer moved over the trigger, the popup or the gap between them. */
48
+ inside: () => void;
49
+ /** The pointer moved anywhere else, or left the document (the window or the iframe). */
50
+ outside: () => void;
51
+ }
52
+ /**
53
+ * Follows the pointer while a hover-opened tooltip is open (spec/tooltip.md, "Pointer"): every
54
+ * move of the document's pointer reports whether it is in the hover bridge of `trigger` and
55
+ * `popup` (`isInHoverBridge`), or over the trigger alone while there is no popup yet; the pointer
56
+ * leaving the document at once (`watchPointerExit`) is outside. It holds no
57
+ * state: the framework decides what a move means (cancel or start the close delay). Returns the
58
+ * cleanup.
59
+ */
60
+ declare function trackHoverBridge(trigger: Element, popup: Element | null, callbacks: HoverBridgeCallbacks): () => void;
61
+ /**
62
+ * Calls `onExit` when a mouse or pen pointer leaves the document: the window, or the iframe the
63
+ * document is in (a `pointerout` with no `relatedTarget`). A pointer that leaves at once sends no
64
+ * move outside a hover bridge first, so a hover-opened overlay listens to this too (Epic #49:
65
+ * spec/tooltip.md and navigation-menu.md, "Pointer"). A touch's `pointerout` after its release
66
+ * is no exit, nor is the pointer entering an iframe of the page (its `pointerout` has no
67
+ * `relatedTarget` either: the point is then inside the viewport, over the frame). Returns the
68
+ * cleanup.
69
+ */
70
+ declare function watchPointerExit(doc: Document, onExit: (event: PointerEvent) => void): () => void;
71
+ export { watchLongPress as a, isInSafeArea as c, LongPressOptions as i, DragSessionOptions as l, HoverBridgeCallbacks as n, isInHoverBridge as o, trackHoverBridge as r, Point as s, watchPointerExit as t, startDrag as u };
@@ -0,0 +1,28 @@
1
+ import { i as CalendarSystem } from "./calendar-system-B5U5HcPQ.js";
2
+ /** The Gregorian calendar (`gregory`): eras BC and AD. */
3
+ declare const gregory: CalendarSystem;
4
+ /** The Thai Buddhist calendar (`buddhist`): the ISO year + 543, era BE. */
5
+ declare const buddhist: CalendarSystem;
6
+ /** The Republic of China calendar (`roc`): the ISO year − 1911, eras before R.O.C. and Minguo. */
7
+ declare const roc: CalendarSystem;
8
+ /** The Japanese imperial calendar (`japanese`): the ISO year in eras from Meiji on. */
9
+ declare const japanese: CalendarSystem;
10
+ /** The Persian (Solar Hijri) calendar (`persian`). */
11
+ declare const persian: CalendarSystem;
12
+ /** The Indian national (Saka) calendar (`indian`). */
13
+ declare const indian: CalendarSystem;
14
+ /** The tabular Islamic calendar, civil epoch (`islamic-civil`). */
15
+ declare const islamicCivil: CalendarSystem;
16
+ /** The tabular Islamic calendar, astronomical epoch (`islamic-tbla`). */
17
+ declare const islamicTbla: CalendarSystem;
18
+ /** The Islamic Umm al-Qura calendar of Saudi Arabia (`islamic-umalqura`). */
19
+ declare const islamicUmalqura: CalendarSystem;
20
+ /** The Hebrew calendar (`hebrew`): 12 or 13 months, Adar I the leap month (6). */
21
+ declare const hebrew: CalendarSystem;
22
+ /** The Coptic calendar (`coptic`): 13 months. */
23
+ declare const coptic: CalendarSystem;
24
+ /** The Ethiopic calendar, Amete Mihret (`ethiopic`): 13 months. */
25
+ declare const ethiopic: CalendarSystem;
26
+ /** The Ethiopic calendar, Amete Alem (`ethioaa`): 13 months. */
27
+ declare const ethioaa: CalendarSystem;
28
+ export { gregory as a, islamicCivil as c, japanese as d, persian as f, ethiopic as i, islamicTbla as l, coptic as n, hebrew as o, roc as p, ethioaa as r, indian as s, buddhist as t, islamicUmalqura as u };
@@ -0,0 +1,75 @@
1
+ import { t as Direction } from "./direction-CTnVLpmd.js";
2
+ import { Placement } from "@floating-ui/dom";
3
+ /**
4
+ * The side of the anchor an overlay sits on (spec/README.md, `data-side`; Base UI's names, D4 §3
5
+ * "Naming"): `inline-start` and `inline-end` follow the direction (`inline-end` is the right in
6
+ * LTR, the left in RTL), `left` and `right` are physical.
7
+ */
8
+ type Side = "top" | "bottom" | "left" | "right" | "inline-start" | "inline-end";
9
+ type Align = "start" | "center" | "end";
10
+ /** The Floating UI placement of a side and align, in a direction. */
11
+ declare function toPlacement(side: Side, align: Align, direction: Direction): Placement;
12
+ /**
13
+ * The side and align of a resolved Floating UI placement. A horizontal side is named as it was
14
+ * asked: logically (`inline-start` / `inline-end`) when `requested` is a logical side, physically
15
+ * (`left` / `right`) otherwise, so a flipped `inline-end` reports `inline-start`.
16
+ */
17
+ declare function fromPlacement(placement: Placement, direction: Direction, requested?: Side): {
18
+ side: Side;
19
+ align: Align;
20
+ };
21
+ /**
22
+ * A rectangle to anchor a floating element to, instead of an element (spec/context-menu.md,
23
+ * "Positioning"): Floating UI's virtual element. `contextElement` is the element it belongs to
24
+ * (the area a context menu opened from): its scroll ancestors and its direction are read.
25
+ */
26
+ interface VirtualAnchor {
27
+ getBoundingClientRect: () => DOMRect;
28
+ contextElement?: Element;
29
+ }
30
+ /** A point, or a rectangle, in the viewport's (client) coordinates. */
31
+ interface AnchorRect {
32
+ x: number;
33
+ y: number;
34
+ width?: number;
35
+ height?: number;
36
+ }
37
+ /**
38
+ * A virtual anchor at a fixed point or rectangle of the viewport (the pointer of a right-click): a
39
+ * zero-size rectangle for a point. It does not follow the page's scroll.
40
+ */
41
+ declare function virtualAnchor(rect: AnchorRect, contextElement?: Element | null): VirtualAnchor;
42
+ interface AnchorOptions {
43
+ side?: Side;
44
+ align?: Align;
45
+ /** Distance from the anchor, in px. */
46
+ sideOffset?: number;
47
+ /** Shift along the anchor's edge, in px. */
48
+ alignOffset?: number;
49
+ /** Space kept from the viewport's edges when flipping and shifting, in px. */
50
+ collisionPadding?: number;
51
+ /** An arrow element inside the floating element, placed along its edge. */
52
+ arrow?: HTMLElement | null;
53
+ /**
54
+ * The reading direction a DirectionProvider gives (spec/direction.md): the logical sides follow
55
+ * it. Without it, the anchor's computed direction, read at every placement. A getter is read at
56
+ * every placement too.
57
+ */
58
+ direction?: Direction | null | (() => Direction | null | undefined);
59
+ /** Called after every placement with the side and align it ended up on. */
60
+ onPlaced?: (placed: {
61
+ side: Side;
62
+ align: Align;
63
+ }) => void;
64
+ }
65
+ /**
66
+ * Keeps `floating` next to `anchor` (spec/popover.md, "Positioning"): flip, shift, logical and
67
+ * physical sides, and it follows scroll and resize until the returned function is called. The
68
+ * anchor is an element, or a virtual anchor (`virtualAnchor`: a point or a rectangle, as a context
69
+ * menu's pointer; its direction is its `contextElement`'s, else the floating element's). It
70
+ * writes structural inline style only (`position`, `top`, `left`), the CSS variables
71
+ * `--anchor-width`, `--anchor-height`, `--available-width`, `--available-height`,
72
+ * `--transform-origin`, and the arrow's offset.
73
+ */
74
+ declare function anchorFloating(anchor: Element | VirtualAnchor, floating: HTMLElement, options?: AnchorOptions): () => void;
75
+ export { virtualAnchor as a, fromPlacement as c, VirtualAnchor as i, toPlacement as l, anchorFloating as n, Align as o, AnchorRect as r, Side as s, AnchorOptions as t };
@@ -0,0 +1,339 @@
1
+ /** Where a newly selected tab sits from the previous one (spec/tabs.md, `data-activation-direction`). */
2
+ type ActivationDirection = "left" | "right" | "up" | "down" | "none";
3
+ /**
4
+ * The physical direction from the previously selected tab to the new one, measured on the page
5
+ * (Base UI): `left` / `right` along a horizontal list, `up` / `down` along a vertical one, `none`
6
+ * when either tab is missing or both sit at the same place. In RTL the next tab sits on the left,
7
+ * so it gives `left`.
8
+ */
9
+ declare function activationDirection(previous: Element | null | undefined, next: Element | null | undefined, orientation: "horizontal" | "vertical"): ActivationDirection;
10
+ /** What a key on a focused chip does (spec/combobox.md, "Keyboard"). */
11
+ interface ChipKeyAction {
12
+ /** Where focus goes: a chip's index (after a removal: in the chips that are left), or the input. */
13
+ focus: number | "input";
14
+ /** Remove the focused chip's value. */
15
+ remove?: true;
16
+ /** Open the list. */
17
+ open?: true;
18
+ }
19
+ /** The arrow that goes back (toward the first chip) and forward, for the direction. */
20
+ declare function chipArrows(rtl: boolean): {
21
+ previous: string;
22
+ next: string;
23
+ };
24
+ /**
25
+ * The action of `key` on the chip at `index` of `count` chips, or `null` for a key it leaves
26
+ * alone. A printable character moves focus to the input, which receives it.
27
+ */
28
+ declare function chipKeyTarget(key: string, index: number, count: number, rtl: boolean): ChipKeyAction | null;
29
+ /** A group of items: any object with an `items` array (spec/combobox.md, "API"). */
30
+ interface ItemGroup<Item> {
31
+ readonly items: readonly Item[];
32
+ }
33
+ /** An item matches the query (spec/combobox.md, `filter`). */
34
+ type ItemFilter<Item> = (item: Item, query: string, itemToString: (item: Item) => string) => boolean;
35
+ /** Whether an item is a value (`isItemEqualToValue`). */
36
+ type ItemEquality<Item> = (item: Item, value: Item) => boolean;
37
+ /** Whether an entry of `items` is a group (it carries an `items` array). */
38
+ declare function isItemGroup<Item>(entry: Item | ItemGroup<Item>): entry is ItemGroup<Item>;
39
+ /** Every item of `items`, groups flattened, in order. */
40
+ declare function flattenItems<Item>(items: readonly (Item | ItemGroup<Item>)[]): Item[];
41
+ /**
42
+ * An item's text (`itemToStringLabel`): the consumer's function, else an object's `label`, else
43
+ * its `value`, else the item itself.
44
+ */
45
+ declare function itemLabel<Item>(item: Item | null | undefined, itemToStringLabel?: (item: Item) => string): string;
46
+ /**
47
+ * An item's form value (`itemToStringValue`): the consumer's function, else the `value` of an
48
+ * object with `value` and `label`, else the item as a string.
49
+ */
50
+ declare function itemFormValue<Item>(item: Item | null | undefined, itemToStringValue?: (item: Item) => string): string;
51
+ /** Whether `text` holds `query`, ignoring case, accents and punctuation (the locale's collator). */
52
+ declare function textContains(text: string, query: string, locale?: string): boolean;
53
+ /** The default `filter`: the item's label contains the query, for the locale. */
54
+ declare function containsFilter<Item>(locale?: string): ItemFilter<Item>;
55
+ /**
56
+ * Whether the query is the selected item's label: then a single combobox that just opened shows
57
+ * every item (spec/combobox.md, "The query").
58
+ */
59
+ declare function queryIsLabel(label: string, query: string, locale?: string): boolean;
60
+ interface FilterItemsOptions<Item> {
61
+ /** `null`: no filtering. */
62
+ filter: ItemFilter<Item> | null;
63
+ /** The most items kept, across groups; `-1` for no limit. */
64
+ limit: number;
65
+ itemToString: (item: Item) => string;
66
+ }
67
+ /**
68
+ * The entries a List renders for a query: the matching items, or the groups with their matching
69
+ * items (a group with none is left out), at most `limit` items in all.
70
+ */
71
+ declare function filterItems<Item>(items: readonly (Item | ItemGroup<Item>)[], query: string, options: FilterItemsOptions<Item>): (Item | ItemGroup<Item>)[];
72
+ /** `isItemEqualToValue`, with `null` and `undefined` compared by identity. */
73
+ declare function itemsEqual<Item>(item: Item | null | undefined, value: Item | null | undefined, isEqual?: ItemEquality<Item>): boolean;
74
+ /** Whether `item` is one of `values`. */
75
+ declare function includesItem<Item>(values: readonly Item[], item: Item, isEqual?: ItemEquality<Item>): boolean;
76
+ /** `values` with `item` added at the end, or removed when it is already one of them. */
77
+ declare function toggleItem<Item>(values: readonly Item[], item: Item, isEqual?: ItemEquality<Item>): Item[];
78
+ interface TabsKeyOptions {
79
+ orientation: "horizontal" | "vertical";
80
+ rtl: boolean;
81
+ loop: boolean;
82
+ }
83
+ /**
84
+ * The tab a key moves focus to (spec/tabs.md, "Keyboard"): arrows along the orientation (mirrored
85
+ * in RTL), Home and End; `null` when the key does not move it. Disabled tabs are reachable.
86
+ */
87
+ declare function tabsKeyTarget(key: string, index: number, count: number, options: TabsKeyOptions): number | null;
88
+ type AccordionKeyOptions = TabsKeyOptions;
89
+ /**
90
+ * The Trigger a key moves focus to in an accordion (spec/accordion.md, "Keyboard"): the tabs' key
91
+ * map (arrows along the orientation, mirrored in RTL, Home and End) over the enabled Triggers the
92
+ * caller passes; `null` when the key does not move it.
93
+ */
94
+ declare function accordionKeyTarget(key: string, index: number, count: number, options: AccordionKeyOptions): number | null;
95
+ /**
96
+ * The item a key moves focus to in a menu (spec/menu.md, "Keyboard"): ArrowDown and ArrowUp (wrapping
97
+ * with `loop`), Home and End; `null` when the key does not move it. Disabled items are reachable.
98
+ */
99
+ declare function menuKeyTarget(key: string, index: number, count: number, options: {
100
+ loop: boolean;
101
+ }): number | null;
102
+ /** The keys that open and close a submenu: the arrows toward and away from it. */
103
+ declare function submenuKeys(rtl: boolean): {
104
+ open: string;
105
+ close: string;
106
+ };
107
+ interface RadioKeyOptions {
108
+ rtl: boolean;
109
+ /** Wrap from the last radio to the first, and back (spec/radio-group.md, `loopFocus`). */
110
+ loop: boolean;
111
+ /** The radios the arrows pass over: the disabled ones. */
112
+ skip?: (index: number) => boolean;
113
+ }
114
+ /**
115
+ * The radio an arrow key moves focus (and the check) to in a radio group (spec/radio-group.md,
116
+ * "Keyboard"): ArrowDown and ArrowRight the next, ArrowUp and ArrowLeft the previous, whatever the
117
+ * orientation (APG); in RTL, ArrowLeft is the next and ArrowRight the previous. Skipped radios are
118
+ * passed over. `null` when the key does not move it: another key, or an end without `loop`.
119
+ */
120
+ declare function radioKeyTarget(key: string, index: number, count: number, options: RadioKeyOptions): number | null;
121
+ interface NavigationOptions {
122
+ /** Wrap from the last item to the first, and back (default `true`). */
123
+ loop?: boolean;
124
+ /** Items the navigation passes over (default: none). */
125
+ skip?: (index: number) => boolean;
126
+ }
127
+ /**
128
+ * The index `delta` steps from `current` in a list of `count` items (spec: menus, tabs). From no
129
+ * item (`current` -1), +1 goes to the first and -1 to the last. Returns `current` when there is
130
+ * nowhere to go.
131
+ */
132
+ declare function stepIndex(count: number, current: number, delta: 1 | -1, options?: NavigationOptions): number;
133
+ /** The first (or last) index not skipped, or -1. */
134
+ declare function edgeIndex(count: number, edge: "first" | "last", skip?: (index: number) => boolean): number;
135
+ /**
136
+ * A step through a list where "no item" sits between the ends (spec/combobox.md): from the last
137
+ * item +1 gives -1 (back to the input), from -1 it gives the first item; -1 mirrors it.
138
+ */
139
+ declare function stepThroughNone(count: number, current: number, delta: 1 | -1): number;
140
+ /** The axis a roving composite's arrows move along (spec/toolbar.md, "Keyboard"). */
141
+ type RovingOrientation = "horizontal" | "vertical";
142
+ /** The keys that move to a roving composite's next and previous item. */
143
+ interface RovingKeys {
144
+ next: string;
145
+ previous: string;
146
+ }
147
+ interface RovingKeyOptions {
148
+ orientation: RovingOrientation;
149
+ rtl: boolean;
150
+ /** Wrap from the last item to the first, and back (`loopFocus`). */
151
+ loop: boolean;
152
+ /** The items the keys pass over: the ones that cannot take focus (default: none). */
153
+ skip?: (index: number) => boolean;
154
+ }
155
+ /**
156
+ * The arrows of a roving composite (a toolbar, a toggle group, a menu bar; spec/toolbar.md,
157
+ * "Keyboard"): ArrowRight and ArrowLeft when horizontal (mirrored in RTL), ArrowDown and ArrowUp
158
+ * when vertical. A menu bar reads them to tell an arrow that moves to the neighbouring item.
159
+ */
160
+ declare function rovingKeys(orientation: RovingOrientation, rtl: boolean): RovingKeys;
161
+ /**
162
+ * The item a key moves focus to in a roving composite of `count` items (spec/toolbar.md,
163
+ * spec/toggle-group.md, "Keyboard"): the next and previous arrows of the orientation (mirrored in
164
+ * RTL), passing over skipped items and wrapping with `loop` (without it, an arrow at an end gives
165
+ * `index` back); Home and End the first and last item not skipped. From no item (`index` -1), the
166
+ * next arrow gives the first item and the previous one the last. `null` when the key is none of
167
+ * these (the other orientation's arrows included), or when every item is skipped.
168
+ */
169
+ declare function rovingKeyTarget(key: string, index: number, count: number, options: RovingKeyOptions): number | null;
170
+ /**
171
+ * The item that holds a roving composite's tab stop (`tabindex="0"`, spec/toolbar.md, "Focus"):
172
+ * `preferred` (the item that last had focus) while it is in range and not skipped, else the first
173
+ * item not skipped; -1 when every item is skipped (the composite is then no tab stop).
174
+ */
175
+ declare function rovingTabStop(count: number, preferred: number, skip?: (index: number) => boolean): number;
176
+ /**
177
+ * Whether a text field keeps a key a roving composite would act on (spec/toolbar.md, "A
178
+ * Toolbar.Input keeps its text keys", Base UI): while text is selected, every key; with a
179
+ * collapsed caret, the next arrow unless the caret is at the end, the previous arrow unless it is
180
+ * at the start, Home and End unless the text is empty. `false` for an element that is no enabled
181
+ * text field, and for any other key (the composite does not act on it anyway).
182
+ */
183
+ declare function textFieldKeepsKey(element: Element, key: string, keys: RovingKeys): boolean;
184
+ /**
185
+ * The entries in their elements' document order (a roving composite's items registered in any
186
+ * order: spec/toolbar.md, "Nested composites"). The order is taken in one tree: the document's
187
+ * when an element is connected, else the first element's; the entries whose element is in another
188
+ * tree (disconnected) come last, in their relative order.
189
+ */
190
+ declare function inDocumentOrder<Entry>(entries: readonly Entry[], element: (entry: Entry) => Node): Entry[];
191
+ /**
192
+ * Scrolls the scrollable ancestors of `item`, up to `boundary` (included), so the item is in view
193
+ * at the nearest edge: a highlighted option inside its popup (spec/select.md, spec/combobox.md).
194
+ * Unlike `Element.scrollIntoView`, it never scrolls past `boundary`: a list that mounts before it
195
+ * is positioned (at the end of a tall page) does not scroll the page.
196
+ */
197
+ declare function scrollIntoViewWithin(item: HTMLElement, boundary: HTMLElement | null): void;
198
+ /**
199
+ * A SegmentedControl Indicator's CSS variables (spec/segmented-control.md, "API"): the checked
200
+ * Item's box from the Root's padding box.
201
+ */
202
+ type SegmentIndicatorBox = Record<"--segment-indicator-inset-inline-start" | "--segment-indicator-inset-block-start" | "--segment-indicator-inline-size" | "--segment-indicator-block-size" | "--segment-indicator-left" | "--segment-indicator-right" | "--segment-indicator-top" | "--segment-indicator-bottom" | "--segment-indicator-width" | "--segment-indicator-height", string>;
203
+ /**
204
+ * The checked Item's box relative to the Root's padding box (where an absolute Indicator is placed
205
+ * from), as the Indicator's variables (spec/segmented-control.md, "API"): the logical ones
206
+ * (inline-start measured from the Root's right padding edge when `rtl`, the layout's direction)
207
+ * and the physical ones, every value in pixels.
208
+ */
209
+ declare function segmentIndicatorBox(root: Element, item: Element, rtl: boolean): SegmentIndicatorBox;
210
+ /**
211
+ * Places a server-rendered SegmentedControl Indicator before hydration
212
+ * (spec/segmented-control.md, "Server rendering"; Base UI's `renderBeforeHydration`, as
213
+ * {@link placeTabsIndicator}). It runs as an inline script inside the Indicator, as the page
214
+ * parses: `script` is that script, which it removes. The Root and its checked Item are found by
215
+ * their part attributes. Self-contained (no import, no closure): a framework writes its source
216
+ * into the page, `` `(${placeSegmentIndicator})(document.currentScript)` ``. It sets the variables
217
+ * of {@link segmentIndicatorBox}, computed the same way.
218
+ */
219
+ declare function placeSegmentIndicator(script: Element | null): void;
220
+ /** The Indicator's CSS variables (spec/tabs.md, "API"): the selected tab's box from the list. */
221
+ type TabsIndicatorBox = Record<"--tabs-indicator-inset-inline-start" | "--tabs-indicator-inset-block-start" | "--tabs-indicator-inline-size" | "--tabs-indicator-block-size" | "--active-tab-left" | "--active-tab-right" | "--active-tab-top" | "--active-tab-bottom" | "--active-tab-width" | "--active-tab-height", string>;
222
+ /**
223
+ * The selected tab's box relative to its list, as the Indicator's variables (spec/tabs.md, "API"):
224
+ * the logical ones (inline-start measured from the list's right edge when `rtl`, the layout's
225
+ * direction) and Base UI's physical ones, every value in pixels.
226
+ */
227
+ declare function tabsIndicatorBox(list: Element, tab: Element, rtl: boolean): TabsIndicatorBox;
228
+ /**
229
+ * Places a server-rendered Tabs Indicator before hydration (spec/tabs.md, "Server rendering"; Base
230
+ * UI's `renderBeforeHydration`). It runs as an inline script inside the Indicator, as the page
231
+ * parses: `script` is that script, which it removes, so the hydration finds the Indicator as the
232
+ * client renders it. The selected tab is the list's `aria-selected="true"` tab. Self-contained (no
233
+ * import, no closure): a framework writes its source into the page,
234
+ * `` `(${placeTabsIndicator})(document.currentScript)` ``. It sets the variables of
235
+ * {@link tabsIndicatorBox}, computed the same way.
236
+ */
237
+ declare function placeTabsIndicator(script: Element | null): void;
238
+ /** The keys of a key event that matter to the tag key maps (a `KeyboardEvent`, or a framework's). */
239
+ interface TagKeyEvent {
240
+ key: string;
241
+ shiftKey: boolean;
242
+ ctrlKey: boolean;
243
+ metaKey: boolean;
244
+ altKey: boolean;
245
+ }
246
+ /** What a key on a TagGroup's focused tag does (spec/tag-group.md, "Keyboard"). */
247
+ type TagGroupKeyAction = {
248
+ type: "focus";
249
+ index: number;
250
+ } | {
251
+ type: "select";
252
+ } | {
253
+ type: "remove";
254
+ };
255
+ interface TagGroupKeyOptions {
256
+ rtl: boolean;
257
+ /** Wrap from the last tag to the first, and back (`loopFocus`). */
258
+ loop: boolean;
259
+ /** The tags the keys pass over: the disabled ones (default: none). */
260
+ skip?: (index: number) => boolean;
261
+ /** Space and Enter select (a `selectionMode` other than `"none"`). */
262
+ selectable: boolean;
263
+ /** Delete and Backspace remove (the group has `onRemove`). */
264
+ removable: boolean;
265
+ }
266
+ /**
267
+ * The action of a key on the tag at `index` of a TagGroup's `count` tags (spec/tag-group.md,
268
+ * "Keyboard"), or `null` for a key it leaves alone: the next tag is ArrowRight (ArrowLeft in RTL)
269
+ * and ArrowDown, the previous one ArrowLeft (ArrowRight in RTL) and ArrowUp, passing over the
270
+ * skipped tags and wrapping with `loop`; Home and End the first and last tag not skipped; Space
271
+ * and Enter select; Delete and Backspace remove. A key with a modifier does nothing.
272
+ */
273
+ declare function tagGroupKeyTarget(event: TagKeyEvent, index: number, count: number, options: TagGroupKeyOptions): TagGroupKeyAction | null;
274
+ /**
275
+ * Where the focus goes once the item at `removed` of `count` items is gone (spec/tag-group.md,
276
+ * "Focus"): the first item after it not skipped, else the last one before it not skipped, else -1
277
+ * (the container). The index is the item's in the list before the removal.
278
+ */
279
+ declare function removalFocusIndex(count: number, removed: number, skip?: (index: number) => boolean): number;
280
+ /** What a key in a TagsInput's Input does (spec/tags-input.md, "Keyboard"). */
281
+ type TagsInputInputKeyAction = {
282
+ type: "add";
283
+ } | {
284
+ type: "focus-tag";
285
+ index: number;
286
+ };
287
+ /**
288
+ * The action of a key in a TagsInput's Input of `count` tags, or `null` for a key it leaves to the
289
+ * input: Enter adds (the caller checks the text is not blank); Backspace and the previous arrow,
290
+ * with the caret at the start and no text selected, focus the last tag. A key with Ctrl, Meta or
291
+ * Alt does nothing.
292
+ */
293
+ declare function tagsInputInputKeyTarget(event: TagKeyEvent, caret: {
294
+ selectionStart: number | null;
295
+ selectionEnd: number | null;
296
+ }, count: number, rtl: boolean): TagsInputInputKeyAction | null;
297
+ /** What a key on a TagsInput's focused tag does (spec/tags-input.md, "Keyboard"). */
298
+ type TagsInputTagKeyAction =
299
+ /** Focus a tag (its index) or the Input. */
300
+ {
301
+ type: "focus";
302
+ target: number | "input";
303
+ } |
304
+ /** Remove the tag, then focus a tag (its index once removed) or the Input. */
305
+ {
306
+ type: "remove";
307
+ focus: number | "input";
308
+ } |
309
+ /** Edit the tag in its TagInput. */
310
+ {
311
+ type: "edit";
312
+ } |
313
+ /** Focus the Input, which receives the key (a printable character). */
314
+ {
315
+ type: "type";
316
+ };
317
+ /**
318
+ * The action of a key on the tag at `index` of a TagsInput's `count` tags (spec/tags-input.md,
319
+ * "Keyboard"), or `null` for a key it leaves alone: the previous arrow focuses the previous tag
320
+ * (none on the first), the next arrow the next tag or, past the last, the Input; Backspace removes
321
+ * it and focuses the previous tag, else the one now at its place, else the Input; Delete removes it
322
+ * and focuses the one now at its place, else the previous tag, else the Input; Enter edits it when
323
+ * `editable`; Escape focuses the Input; a printable character goes to the Input. A key with Ctrl,
324
+ * Meta or Alt does nothing.
325
+ */
326
+ declare function tagsInputTagKeyTarget(event: TagKeyEvent, index: number, count: number, options: {
327
+ rtl: boolean;
328
+ editable: boolean;
329
+ }): TagsInputTagKeyAction | null;
330
+ /**
331
+ * Typeahead for lists (spec/menu.md): characters typed within `timeout` ms accumulate; repeating
332
+ * one character cycles through the items starting with it.
333
+ */
334
+ declare function createTypeahead(timeout?: number): {
335
+ /** The index of the item to move to for `key`, or -1. `labels[i]` is item i's text. */
336
+ match(key: string, labels: readonly string[], current: number, now?: number): number;
337
+ reset(): void;
338
+ };
339
+ export { ChipKeyAction as $, AccordionKeyOptions as A, ItemFilter as B, rovingKeys as C, edgeIndex as D, NavigationOptions as E, radioKeyTarget as F, includesItem as G, containsFilter as H, submenuKeys as I, itemLabel as J, isItemGroup as K, tabsKeyTarget as L, TabsKeyOptions as M, accordionKeyTarget as N, stepIndex as O, menuKeyTarget as P, toggleItem as Q, FilterItemsOptions as R, rovingKeyTarget as S, textFieldKeepsKey as T, filterItems as U, ItemGroup as V, flattenItems as W, queryIsLabel as X, itemsEqual as Y, textContains as Z, scrollIntoViewWithin as _, TagsInputInputKeyAction as a, RovingOrientation as b, tagGroupKeyTarget as c, TabsIndicatorBox as d, chipArrows as et, placeTabsIndicator as f, segmentIndicatorBox as g, placeSegmentIndicator as h, TagKeyEvent as i, RadioKeyOptions as j, stepThroughNone as k, tagsInputInputKeyTarget as l, SegmentIndicatorBox as m, TagGroupKeyAction as n, ActivationDirection as nt, TagsInputTagKeyAction as o, tabsIndicatorBox as p, itemFormValue as q, TagGroupKeyOptions as r, activationDirection as rt, removalFocusIndex as s, createTypeahead as t, chipKeyTarget as tt, tagsInputTagKeyTarget as u, RovingKeyOptions as v, rovingTabStop as w, inDocumentOrder as x, RovingKeys as y, ItemEquality as z };
@@ -0,0 +1,31 @@
1
+ /** What a key does in an open cascading select. */
2
+ type CascadeKeyAction = "next" | "previous" | "first" | "last" | "open-level" | "close-level" | "choose" | "close";
3
+ /**
4
+ * The action of a key in an open cascading select: ArrowDown / ArrowUp the next / previous item
5
+ * of the level, Home / End its first / last, the inline-end arrow opens the highlighted parent's
6
+ * level and the inline-start arrow closes the level (Right and Left in LTR, swapped in RTL, as a
7
+ * menu's submenus), Enter and Space choose, Escape closes; `null` for any other key and for a key
8
+ * with Alt, Ctrl or Meta.
9
+ */
10
+ declare function cascadeKeyAction(event: Pick<KeyboardEvent, "key" | "altKey" | "ctrlKey" | "metaKey">, rtl: boolean): CascadeKeyAction | null;
11
+ /** One entry of a cascading select's tree: a parent when it has children, else a leaf. */
12
+ interface CascadeItem {
13
+ value: string;
14
+ label: string;
15
+ disabled?: boolean;
16
+ children?: readonly CascadeItem[];
17
+ }
18
+ /** Whether an item is a parent: it has at least one child. */
19
+ declare function hasCascadeChildren(item: CascadeItem | undefined): boolean;
20
+ /**
21
+ * The items of each open level for a chain of values from the first level down: the first
22
+ * level's items, then the children of each value of `chain` that is a parent, stopping at the
23
+ * first value that is missing or a leaf.
24
+ */
25
+ declare function cascadeLevels(items: readonly CascadeItem[], chain: readonly string[]): (readonly CascadeItem[])[];
26
+ /**
27
+ * The items a path names, from the first level down; `null` when a value is not among its
28
+ * level's items (the path does not exist in the tree).
29
+ */
30
+ declare function cascadePathItems(items: readonly CascadeItem[], path: readonly string[]): CascadeItem[] | null;
31
+ export { CascadeKeyAction as a, hasCascadeChildren as i, cascadeLevels as n, cascadeKeyAction as o, cascadePathItems as r, CascadeItem as t };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Stops the page from scrolling while an overlay is open (spec/dialog.md), keeping the scrollbar's
3
+ * gutter so the layout does not shift. Nested locks are counted. Returns the unlock.
4
+ */
5
+ declare function lockScroll(doc: Document): () => void;
6
+ export { lockScroll as t };