@mortenbrudvik/waveui 0.11.0 → 0.12.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.
- package/README.md +97 -2
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +4 -4
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.mjs +10 -10
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +12 -12
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +235 -235
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +176 -175
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +188 -187
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +41 -40
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +89 -87
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/TagPicker.root.cjs +1 -1
- package/dist/components/input/TagPicker.root.cjs.map +1 -1
- package/dist/components/input/TagPicker.root.mjs +136 -135
- package/dist/components/input/TagPicker.root.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +156 -154
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +137 -127
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +4 -4
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +123 -123
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +1 -1
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.mjs +12 -12
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +173 -162
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +96 -91
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +47 -47
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +5 -5
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +1 -1
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useFocusVisible.cjs +2 -0
- package/dist/hooks/useFocusVisible.cjs.map +1 -0
- package/dist/hooks/useFocusVisible.mjs +49 -0
- package/dist/hooks/useFocusVisible.mjs.map +1 -0
- package/dist/hooks/useFocusableGroup.cjs +2 -0
- package/dist/hooks/useFocusableGroup.cjs.map +1 -0
- package/dist/hooks/useFocusableGroup.mjs +70 -0
- package/dist/hooks/useFocusableGroup.mjs.map +1 -0
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +4 -4
- package/dist/hooks/useModalOpen.cjs +2 -0
- package/dist/hooks/useModalOpen.cjs.map +1 -0
- package/dist/hooks/useModalOpen.mjs +14 -0
- package/dist/hooks/useModalOpen.mjs.map +1 -0
- package/dist/hooks/usePopupPosition.cjs +1 -1
- package/dist/hooks/usePopupPosition.cjs.map +1 -1
- package/dist/hooks/usePopupPosition.mjs +82 -53
- package/dist/hooks/usePopupPosition.mjs.map +1 -1
- package/dist/hooks/useResolvedTarget.cjs +2 -0
- package/dist/hooks/useResolvedTarget.cjs.map +1 -0
- package/dist/hooks/useResolvedTarget.mjs +37 -0
- package/dist/hooks/useResolvedTarget.mjs.map +1 -0
- package/dist/hooks/useRovingGrid.cjs +1 -1
- package/dist/hooks/useRovingGrid.cjs.map +1 -1
- package/dist/hooks/useRovingGrid.mjs +8 -57
- package/dist/hooks/useRovingGrid.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +142 -107
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +814 -18
- package/dist/index.d.ts +814 -18
- package/dist/index.mjs +120 -108
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +112 -109
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9,111 +9,123 @@ import { createToaster as hn } from "./lib/toaster.mjs";
|
|
|
9
9
|
import { useEventCallback as gn } from "./hooks/useEventCallback.mjs";
|
|
10
10
|
import { useControllable as _n } from "./hooks/useControllable.mjs";
|
|
11
11
|
import { useId as vn } from "./hooks/useId.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
109
|
-
import {
|
|
110
|
-
import {
|
|
111
|
-
import {
|
|
112
|
-
import {
|
|
113
|
-
import {
|
|
114
|
-
import {
|
|
115
|
-
import {
|
|
116
|
-
import {
|
|
117
|
-
import {
|
|
118
|
-
import {
|
|
119
|
-
|
|
12
|
+
import { getFirstTabbable as yn, getLastTabbable as bn, getTabbableElements as xn } from "./lib/focus.mjs";
|
|
13
|
+
import { useRovingTabIndex as Sn } from "./hooks/useRovingTabIndex.mjs";
|
|
14
|
+
import { useMergedRefs as Cn } from "./hooks/useMergedRefs.mjs";
|
|
15
|
+
import { useIsClient as wn } from "./hooks/useIsClient.mjs";
|
|
16
|
+
import { useFieldControl as Tn } from "./hooks/useFieldControl.mjs";
|
|
17
|
+
import { announce as En, useAnnounce as Dn } from "./hooks/useAnnounce.mjs";
|
|
18
|
+
import { usePresence as On } from "./hooks/usePresence.mjs";
|
|
19
|
+
import { useActiveDescendant as kn } from "./hooks/useActiveDescendant.mjs";
|
|
20
|
+
import { collectOptionLabels as An, markListboxElement as jn, useListbox as Mn, useListboxOption as Nn } from "./hooks/useListbox.mjs";
|
|
21
|
+
import { getThemeClassName as Pn } from "./lib/theme.mjs";
|
|
22
|
+
import { WaveProvider as Fn, useWaveTheme as In } from "./components/provider/WaveProvider.mjs";
|
|
23
|
+
import { usePopupPosition as Ln } from "./hooks/usePopupPosition.mjs";
|
|
24
|
+
import { hasOpenModal as Rn, modalAllowProps as zn } from "./lib/layers.mjs";
|
|
25
|
+
import { DismissLayerProvider as Bn, useDismiss as Vn } from "./hooks/useDismiss.mjs";
|
|
26
|
+
import { useFocusTrap as Hn, useInitialFocus as Un } from "./hooks/useFocusTrap.mjs";
|
|
27
|
+
import { useRestoreFocus as Wn } from "./hooks/useRestoreFocus.mjs";
|
|
28
|
+
import { useModalLayer as Gn } from "./hooks/useModalLayer.mjs";
|
|
29
|
+
import { useModalOpen as Kn } from "./hooks/useModalOpen.mjs";
|
|
30
|
+
import { useFocusVisible as qn } from "./hooks/useFocusVisible.mjs";
|
|
31
|
+
import { useFocusableGroup as Jn } from "./hooks/useFocusableGroup.mjs";
|
|
32
|
+
import { useGridNavigation as Yn } from "./components/table/useGridNavigation.mjs";
|
|
33
|
+
import { focusRing as Xn, focusRingInset as Zn, inputFocus as Qn, inputFocusWithin as $n } from "./lib/styles.mjs";
|
|
34
|
+
import { Portal as er } from "./components/portal/Portal.mjs";
|
|
35
|
+
import { Button as tr } from "./components/button/Button.mjs";
|
|
36
|
+
import { CompoundButton as nr } from "./components/button/CompoundButton.mjs";
|
|
37
|
+
import { ToggleButton as rr } from "./components/button/ToggleButton.mjs";
|
|
38
|
+
import { SplitButton as ir } from "./components/button/SplitButton.mjs";
|
|
39
|
+
import { MenuButton as ar } from "./components/button/MenuButton.mjs";
|
|
40
|
+
import { Link as or } from "./components/button/Link.mjs";
|
|
41
|
+
import { ToolbarButton as sr, ToolbarDivider as cr, ToolbarGroup as lr, ToolbarRadioButton as ur, ToolbarRadioGroup as dr, ToolbarToggleButton as fr } from "./components/button/Toolbar.parts.mjs";
|
|
42
|
+
import { Toolbar as pr } from "./components/button/Toolbar.mjs";
|
|
43
|
+
import { Input as mr } from "./components/input/Input.mjs";
|
|
44
|
+
import { Textarea as hr } from "./components/input/Textarea.mjs";
|
|
45
|
+
import { Field as gr } from "./components/input/Field.mjs";
|
|
46
|
+
import { Checkbox as _r } from "./components/input/Checkbox.mjs";
|
|
47
|
+
import { RadioGroup as vr, RadioGroupItem as yr, RadioItem as br } from "./components/input/RadioGroup.mjs";
|
|
48
|
+
import { Switch as xr } from "./components/input/Switch.mjs";
|
|
49
|
+
import { Select as Sr } from "./components/input/Select.mjs";
|
|
50
|
+
import { SearchBox as Cr } from "./components/input/SearchBox.mjs";
|
|
51
|
+
import { Slider as wr } from "./components/input/Slider.mjs";
|
|
52
|
+
import { SpinButton as Tr } from "./components/input/SpinButton.mjs";
|
|
53
|
+
import { Label as Er } from "./components/input/Label.mjs";
|
|
54
|
+
import { ListboxProvider as Dr, ListboxSurface as Or, Option as kr, OptionGroup as Ar, useListboxPopup as jr } from "./components/input/Option.mjs";
|
|
55
|
+
import { Combobox as Mr, ComboboxOption as Nr, ComboboxOptionGroup as Pr } from "./components/input/Combobox.mjs";
|
|
56
|
+
import { Dropdown as Fr, DropdownOption as Ir, DropdownOptionGroup as Lr } from "./components/input/Dropdown.mjs";
|
|
57
|
+
import { Listbox as Rr, ListboxOption as zr, ListboxOptionGroup as Br } from "./components/input/Listbox.mjs";
|
|
58
|
+
import { ColorSwatch as Vr, EmptySwatch as Hr, ImageSwatch as Ur } from "./components/input/SwatchPicker.swatches.mjs";
|
|
59
|
+
import { SwatchPicker as Wr, SwatchPickerRow as Gr } from "./components/input/SwatchPicker.mjs";
|
|
60
|
+
import { ColorPickerHexField as Kr, ColorPickerPreview as qr, ColorPickerSwatches as Jr } from "./components/input/ColorPicker.parts.mjs";
|
|
61
|
+
import { AlphaSlider as Yr } from "./components/input/AlphaSlider.mjs";
|
|
62
|
+
import { ColorArea as Xr } from "./components/input/ColorArea.mjs";
|
|
63
|
+
import { ColorSlider as Zr } from "./components/input/ColorSlider.mjs";
|
|
64
|
+
import { ColorPicker as Qr } from "./components/input/ColorPicker.mjs";
|
|
65
|
+
import { Tag as $r } from "./components/data-display/Tag.mjs";
|
|
66
|
+
import { TagGroup as ei } from "./components/data-display/TagGroup.mjs";
|
|
67
|
+
import { TagPickerOption as ti } from "./components/input/TagPicker.option.mjs";
|
|
68
|
+
import { TagPickerButton as ni, TagPickerControl as ri, TagPickerGroup as ii, TagPickerInput as ai, TagPickerList as oi, TagPickerOptionGroup as si } from "./components/input/TagPicker.parts.mjs";
|
|
69
|
+
import { TagPicker as ci } from "./components/input/TagPicker.mjs";
|
|
70
|
+
import { RatingItem as li } from "./components/input/Rating.item.mjs";
|
|
71
|
+
import { Rating as ui, RatingDisplay as di, RatingDisplayItem as fi } from "./components/input/Rating.mjs";
|
|
72
|
+
import { TimePicker as pi } from "./components/input/TimePicker.mjs";
|
|
73
|
+
import { Calendar as mi } from "./components/input/Calendar.mjs";
|
|
74
|
+
import { DatePicker as hi } from "./components/input/DatePicker.mjs";
|
|
75
|
+
import { Avatar as gi } from "./components/data-display/Avatar.mjs";
|
|
76
|
+
import { AvatarGroup as _i } from "./components/data-display/AvatarGroup.mjs";
|
|
77
|
+
import { Badge as vi } from "./components/data-display/Badge.mjs";
|
|
78
|
+
import { PresenceBadge as yi } from "./components/data-display/PresenceBadge.mjs";
|
|
79
|
+
import { CounterBadge as bi } from "./components/data-display/CounterBadge.mjs";
|
|
80
|
+
import { InteractionTag as xi, InteractionTagPrimary as Si, InteractionTagSecondary as Ci } from "./components/data-display/InteractionTag.mjs";
|
|
81
|
+
import { Persona as wi } from "./components/data-display/Persona.mjs";
|
|
82
|
+
import { Divider as Ti } from "./components/data-display/Divider.mjs";
|
|
83
|
+
import { InfoButton as Ei } from "./components/data-display/InfoButton.mjs";
|
|
84
|
+
import { InfoLabel as Di } from "./components/data-display/InfoLabel.mjs";
|
|
85
|
+
import { Image as Oi } from "./components/data-display/Image.mjs";
|
|
86
|
+
import { List as ki, ListItem as Ai } from "./components/data-display/List.mjs";
|
|
87
|
+
import { Text as ji } from "./components/typography/Text.mjs";
|
|
88
|
+
import { Card as Mi, CardBody as Ni, CardFooter as Pi, CardHeader as Fi } from "./components/layout/Card.mjs";
|
|
89
|
+
import { Accordion as Ii, AccordionItem as Li, AccordionPanel as Ri, AccordionTrigger as zi } from "./components/layout/Accordion.mjs";
|
|
90
|
+
import { TabList as Bi, TabListPanel as Vi, TabListPanels as Hi, TabListTab as Ui } from "./components/layout/TabList.mjs";
|
|
91
|
+
import { TreeItem as Wi } from "./components/layout/Tree.core.mjs";
|
|
92
|
+
import { TreeItemPersonaLayout as Gi } from "./components/layout/Tree.itemPersonaLayout.mjs";
|
|
93
|
+
import { Tree as Ki } from "./components/layout/Tree.mjs";
|
|
94
|
+
import { Carousel as qi, CarouselItem as Ji } from "./components/layout/Carousel.mjs";
|
|
95
|
+
import { Overflow as Yi, OverflowItem as Xi, useIsOverflowItemVisible as Zi, useIsOverflowing as Qi, useOverflowMenu as $i } from "./components/layout/Overflow.mjs";
|
|
96
|
+
import { Stack as ea } from "./components/layout/Stack.mjs";
|
|
97
|
+
import { Flex as ta } from "./components/layout/Flex.mjs";
|
|
98
|
+
import { Grid as na } from "./components/layout/Grid.mjs";
|
|
99
|
+
import { Breadcrumb as ra, BreadcrumbItem as ia } from "./components/navigation/Breadcrumb.mjs";
|
|
100
|
+
import { MenuDivider as aa, MenuItem as oa } from "./components/navigation/Menu.items.mjs";
|
|
101
|
+
import { MenuGroup as sa, MenuGroupHeader as ca } from "./components/navigation/Menu.group.mjs";
|
|
102
|
+
import { MenuItemLink as la } from "./components/navigation/Menu.link.mjs";
|
|
103
|
+
import { MenuPopover as ua } from "./components/navigation/Menu.popover.mjs";
|
|
104
|
+
import { MenuTrigger as da } from "./components/navigation/Menu.trigger.mjs";
|
|
105
|
+
import { MenuItemCheckbox as fa, MenuItemRadio as pa, MenuItemSwitch as ma } from "./components/navigation/Menu.selectable.mjs";
|
|
106
|
+
import { MenuSplitGroup as ha } from "./components/navigation/Menu.splitGroup.mjs";
|
|
107
|
+
import { Menu as ga } from "./components/navigation/Menu.mjs";
|
|
108
|
+
import { NavAppItem as _a, NavAppItemStatic as va, NavDivider as ya, NavSectionHeader as ba } from "./components/navigation/Nav.parts.mjs";
|
|
109
|
+
import { Nav as xa, NavCategory as Sa, NavItem as Ca, NavSubItem as wa } from "./components/navigation/Nav.mjs";
|
|
110
|
+
import { NavDrawer as Ta, NavDrawerBody as Ea, NavDrawerFooter as Da, NavDrawerHeader as Oa } from "./components/navigation/NavDrawer.mjs";
|
|
111
|
+
import { Hamburger as ka } from "./components/navigation/Hamburger.mjs";
|
|
112
|
+
import { Pagination as Aa } from "./components/navigation/Pagination.mjs";
|
|
113
|
+
import { Stepper as ja, StepperStep as Ma } from "./components/navigation/Stepper.mjs";
|
|
114
|
+
import { MessageBarActions as Na, MessageBarTitle as Pa } from "./components/feedback/MessageBar.parts.mjs";
|
|
115
|
+
import { MessageBar as Fa } from "./components/feedback/MessageBar.mjs";
|
|
116
|
+
import { ProgressBar as Ia } from "./components/feedback/ProgressBar.mjs";
|
|
117
|
+
import { Spinner as La } from "./components/feedback/Spinner.mjs";
|
|
118
|
+
import { Skeleton as Ra, SkeletonGroup as za } from "./components/feedback/Skeleton.mjs";
|
|
119
|
+
import { ToastBody as Ba, ToastClose as Va, ToastFooter as Ha, ToastTitle as Ua } from "./components/feedback/Toast.parts.mjs";
|
|
120
|
+
import { Toaster as Wa, useToastController as Ga } from "./components/feedback/Toaster.mjs";
|
|
121
|
+
import { Toast as Ka } from "./components/feedback/Toast.mjs";
|
|
122
|
+
import { Dialog as qa, DialogClose as Ja, DialogContent as Ya, DialogFooter as Xa, DialogTitle as Za, DialogTrigger as Qa } from "./components/overlays/Dialog.mjs";
|
|
123
|
+
import { Popover as $a, PopoverContent as eo, PopoverTrigger as to } from "./components/overlays/Popover.mjs";
|
|
124
|
+
import { Tooltip as no } from "./components/overlays/Tooltip.mjs";
|
|
125
|
+
import { DrawerBody as ro, DrawerClose as io, DrawerFooter as ao, DrawerHeader as oo, DrawerHeaderNavigation as so, DrawerHeaderTitle as co, DrawerTitle as lo, DrawerTrigger as uo } from "./components/overlays/Drawer.parts.mjs";
|
|
126
|
+
import { Drawer as fo } from "./components/overlays/Drawer.mjs";
|
|
127
|
+
import { TeachingPopover as po } from "./components/overlays/TeachingPopover.mjs";
|
|
128
|
+
import { Table as mo, TableBody as ho, TableCell as go, TableHead as _o, TableHeadCell as vo, TableHeader as yo, TableHeaderCell as bo, TableRow as xo } from "./components/table/Table.mjs";
|
|
129
|
+
import { DataGrid as So, DataGridBody as Co, DataGridCell as wo, DataGridHeader as To, DataGridHeaderCell as Eo, DataGridRow as Do } from "./components/table/DataGrid.mjs";
|
|
130
|
+
import { Presence as Oo } from "./components/motion/Presence.mjs";
|
|
131
|
+
export { Ii as Accordion, Li as AccordionItem, Ri as AccordionPanel, zi as AccordionTrigger, Yr as AlphaSlider, gi as Avatar, _i as AvatarGroup, vi as Badge, ra as Breadcrumb, ia as BreadcrumbItem, tr as Button, mi as Calendar, Mi as Card, Ni as CardBody, Pi as CardFooter, Fi as CardHeader, qi as Carousel, Ji as CarouselItem, _r as Checkbox, Xr as ColorArea, Qr as ColorPicker, Kr as ColorPickerHexField, qr as ColorPickerPreview, Jr as ColorPickerSwatches, Zr as ColorSlider, Vr as ColorSwatch, Mr as Combobox, Nr as ComboboxOption, Pr as ComboboxOptionGroup, nr as CompoundButton, bi as CounterBadge, So as DataGrid, Co as DataGridBody, wo as DataGridCell, To as DataGridHeader, Eo as DataGridHeaderCell, Do as DataGridRow, hi as DatePicker, qa as Dialog, Ja as DialogClose, Ya as DialogContent, Xa as DialogFooter, Za as DialogTitle, Qa as DialogTrigger, Bn as DismissLayerProvider, Ti as Divider, fo as Drawer, ro as DrawerBody, io as DrawerClose, ao as DrawerFooter, oo as DrawerHeader, so as DrawerHeaderNavigation, co as DrawerHeaderTitle, lo as DrawerTitle, uo as DrawerTrigger, Fr as Dropdown, Ir as DropdownOption, Lr as DropdownOptionGroup, Hr as EmptySwatch, gr as Field, ta as Flex, na as Grid, ka as Hamburger, Oi as Image, Ur as ImageSwatch, Ei as InfoButton, Di as InfoLabel, mr as Input, xi as InteractionTag, Si as InteractionTagPrimary, Ci as InteractionTagSecondary, Er as Label, or as Link, ki as List, Ai as ListItem, Rr as Listbox, zr as ListboxOption, Br as ListboxOptionGroup, Dr as ListboxProvider, Or as ListboxSurface, ga as Menu, ar as MenuButton, aa as MenuDivider, sa as MenuGroup, ca as MenuGroupHeader, oa as MenuItem, fa as MenuItemCheckbox, la as MenuItemLink, pa as MenuItemRadio, ma as MenuItemSwitch, ua as MenuPopover, ha as MenuSplitGroup, da as MenuTrigger, Fa as MessageBar, Na as MessageBarActions, Pa as MessageBarTitle, xa as Nav, _a as NavAppItem, va as NavAppItemStatic, Sa as NavCategory, ya as NavDivider, Ta as NavDrawer, Ea as NavDrawerBody, Da as NavDrawerFooter, Oa as NavDrawerHeader, Ca as NavItem, ba as NavSectionHeader, wa as NavSubItem, kr as Option, Ar as OptionGroup, Yi as Overflow, Xi as OverflowItem, Aa as Pagination, wi as Persona, $a as Popover, eo as PopoverContent, to as PopoverTrigger, er as Portal, Oo as Presence, yi as PresenceBadge, Ia as ProgressBar, vr as RadioGroup, yr as RadioGroupItem, br as RadioItem, ui as Rating, di as RatingDisplay, fi as RatingDisplayItem, li as RatingItem, Cr as SearchBox, Sr as Select, Ra as Skeleton, za as SkeletonGroup, wr as Slider, Tr as SpinButton, La as Spinner, ir as SplitButton, ea as Stack, ja as Stepper, Ma as StepperStep, Wr as SwatchPicker, Gr as SwatchPickerRow, xr as Switch, Bi as TabList, Vi as TabListPanel, Hi as TabListPanels, Ui as TabListTab, mo as Table, ho as TableBody, go as TableCell, _o as TableHead, vo as TableHeadCell, yo as TableHeader, bo as TableHeaderCell, xo as TableRow, $r as Tag, ei as TagGroup, ci as TagPicker, ni as TagPickerButton, ri as TagPickerControl, ii as TagPickerGroup, ai as TagPickerInput, oi as TagPickerList, ti as TagPickerOption, si as TagPickerOptionGroup, po as TeachingPopover, ji as Text, hr as Textarea, pi as TimePicker, Ka as Toast, Ba as ToastBody, Va as ToastClose, Ha as ToastFooter, Ua as ToastTitle, Wa as Toaster, rr as ToggleButton, pr as Toolbar, sr as ToolbarButton, cr as ToolbarDivider, lr as ToolbarGroup, ur as ToolbarRadioButton, dr as ToolbarRadioGroup, fr as ToolbarToggleButton, no as Tooltip, Ki as Tree, Wi as TreeItem, Gi as TreeItemPersonaLayout, Fn as WaveProvider, a as accordionClassNames, o as accordionItemClassNames, s as accordionPanelClassNames, c as accordionTriggerClassNames, cn as addDays, ln as addMonths, l as alphaSliderClassNames, En as announce, u as avatarClassNames, d as avatarGroupClassNames, f as badgeClassNames, p as breadcrumbClassNames, m as breadcrumbItemClassNames, h as buttonClassNames, g as calendarClassNames, _ as cardBodyClassNames, v as cardClassNames, y as cardFooterClassNames, b as cardHeaderClassNames, x as carouselClassNames, S as carouselItemClassNames, C as checkboxClassNames, e as cn, An as collectOptionLabels, w as colorAreaClassNames, T as colorPickerClassNames, E as colorPickerHexFieldClassNames, D as colorPickerPreviewClassNames, O as colorPickerSwatchesClassNames, k as colorSliderClassNames, A as colorSwatchClassNames, j as comboboxClassNames, r as composeEventHandlers, M as compoundButtonClassNames, N as counterBadgeClassNames, hn as createToaster, P as dataGridBodyClassNames, F as dataGridCellClassNames, I as dataGridClassNames, L as dataGridHeaderCellClassNames, R as dataGridHeaderClassNames, z as dataGridRowClassNames, B as datePickerClassNames, V as dialogContentClassNames, H as dialogFooterClassNames, U as dialogTitleClassNames, W as dividerClassNames, G as drawerBodyClassNames, K as drawerClassNames, q as drawerFooterClassNames, J as drawerHeaderClassNames, Y as drawerHeaderNavigationClassNames, X as drawerHeaderTitleClassNames, Z as drawerTitleClassNames, Q as dropdownClassNames, $ as emptySwatchClassNames, ee as fieldClassNames, te as flexClassNames, Xn as focusRing, Zn as focusRingInset, yn as getFirstTabbable, bn as getLastTabbable, xn as getTabbableElements, Pn as getThemeClassName, un as getWeekNumber, ne as gridClassNames, re as hamburgerClassNames, Rn as hasOpenModal, pn as hexToHsv, mn as hsvToHex, ie as imageClassNames, ae as imageSwatchClassNames, oe as infoButtonClassNames, se as infoLabelClassNames, ce as inputClassNames, Qn as inputFocus, $n as inputFocusWithin, le as interactionTagClassNames, ue as interactionTagPrimaryClassNames, de as interactionTagSecondaryClassNames, dn as isSameDay, fe as labelClassNames, pe as linkClassNames, me as listClassNames, he as listItemClassNames, ge as listboxClassNames, _e as listboxSurfaceClassNames, jn as markListboxElement, ve as menuButtonClassNames, ye as menuClassNames, be as menuDividerClassNames, xe as menuGroupClassNames, Se as menuGroupHeaderClassNames, Ce as menuItemCheckboxClassNames, we as menuItemClassNames, Te as menuItemLinkClassNames, Ee as menuItemRadioClassNames, De as menuItemSwitchClassNames, Oe as menuPopoverClassNames, ke as menuSplitGroupClassNames, i as mergeRefs, Ae as messageBarActionsClassNames, je as messageBarClassNames, Me as messageBarTitleClassNames, zn as modalAllowProps, Ne as navAppItemClassNames, Pe as navAppItemStaticClassNames, Fe as navCategoryClassNames, Ie as navClassNames, Le as navDividerClassNames, Re as navDrawerBodyClassNames, ze as navDrawerClassNames, Be as navDrawerFooterClassNames, Ve as navDrawerHeaderClassNames, He as navItemClassNames, Ue as navSectionHeaderClassNames, We as navSubItemClassNames, Ge as optionClassNames, Ke as optionGroupClassNames, qe as overflowClassNames, Je as overflowItemClassNames, Ye as paginationClassNames, Xe as personaClassNames, Ze as popoverContentClassNames, Qe as portalClassNames, $e as presenceBadgeClassNames, et as progressBarClassNames, tt as radioGroupClassNames, nt as radioGroupItemClassNames, rt as ratingClassNames, it as ratingDisplayClassNames, at as ratingItemClassNames, t as renderSlot, n as resolveSlot, ot as searchBoxClassNames, st as selectClassNames, ct as skeletonClassNames, lt as skeletonGroupClassNames, ut as sliderClassNames, dt as spinButtonClassNames, ft as spinnerClassNames, pt as splitButtonClassNames, mt as stackClassNames, fn as startOfWeek, ht as stepperClassNames, gt as stepperStepClassNames, _t as swatchPickerClassNames, vt as swatchPickerRowClassNames, yt as switchClassNames, bt as tabListClassNames, xt as tabListPanelClassNames, St as tabListPanelsClassNames, Ct as tabListTabClassNames, wt as tableBodyClassNames, Tt as tableCellClassNames, Et as tableClassNames, Dt as tableHeaderCellClassNames, Ot as tableHeaderClassNames, kt as tableRowClassNames, At as tagClassNames, jt as tagGroupClassNames, Mt as tagPickerButtonClassNames, Nt as tagPickerClassNames, Pt as tagPickerControlClassNames, Ft as tagPickerGroupClassNames, It as tagPickerInputClassNames, Lt as tagPickerListClassNames, Rt as tagPickerOptionClassNames, zt as teachingPopoverClassNames, Bt as textClassNames, Vt as textareaClassNames, Ht as timePickerClassNames, Ut as toastBodyClassNames, Wt as toastClassNames, Gt as toastFooterClassNames, Kt as toastTitleClassNames, qt as toasterClassNames, Jt as toggleButtonClassNames, Yt as toolbarButtonClassNames, Xt as toolbarClassNames, Zt as toolbarDividerClassNames, Qt as toolbarGroupClassNames, $t as toolbarRadioButtonClassNames, en as toolbarRadioGroupClassNames, tn as toolbarToggleButtonClassNames, nn as tooltipClassNames, rn as treeClassNames, an as treeItemClassNames, on as treeItemPersonaLayoutClassNames, kn as useActiveDescendant, Dn as useAnnounce, _n as useControllable, Vn as useDismiss, gn as useEventCallback, Tn as useFieldControl, Hn as useFocusTrap, qn as useFocusVisible, Jn as useFocusableGroup, Yn as useGridNavigation, vn as useId, Un as useInitialFocus, wn as useIsClient, Zi as useIsOverflowItemVisible, Qi as useIsOverflowing, Mn as useListbox, Nn as useListboxOption, jr as useListboxPopup, Cn as useMergedRefs, Gn as useModalLayer, Kn as useModalOpen, $i as useOverflowMenu, Ln as usePopupPosition, On as usePresence, Wn as useRestoreFocus, Sn as useRovingTabIndex, Ga as useToastController, In as useWaveTheme, sn as waveProviderClassNames };
|
package/dist/lib/layers.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./globalRegistry.cjs");var t={overlay:`var(--wave-z-overlay, 1000)`,toast:`var(--wave-z-toast, 1100)`,tooltip:`var(--wave-z-tooltip, 1200)`},n=`[data-wave-focus-trap-allow]
|
|
1
|
+
const e=require("./globalRegistry.cjs");var t={overlay:`var(--wave-z-overlay, 1000)`,toast:`var(--wave-z-toast, 1100)`,tooltip:`var(--wave-z-tooltip, 1200)`},n=`[data-wave-focus-trap-allow]`,r={"data-wave-focus-trap-allow":``};function i(){let t=e.getGlobalRegistry(`layers`,()=>({stack:[],elements:new Map,counter:0,press:null,listeners:null,subscribers:new Set,isolated:new Map}));return t.subscribers??=new Set,t.isolated??=new Map,t}function a(e){for(let t of Array.from(e.subscribers))t()}var o=1;function s(e,t){if(t!==null)return e.stack.find(e=>e.id===t)}function c(e,t,n){let r=new Set([t.id]),i=t.parentId;for(;i!==null&&!r.has(i);){if(i===n)return!0;r.add(i),i=s(e,i)?.parentId??null}return!1}function l(e,t){return!!e&&e.contains(t)}function u(e,t,n,r){if(r.has(t))return!1;r.add(t);let i=s(e,t);if(i&&i.getElements().some(e=>l(e,n)))return!0;let a=e.elements.get(t);if(a){for(let e of a)if(l(e,n))return!0}for(let i of e.stack)if(i.parentId===t&&u(e,i.id,n,r))return!0;return!1}function d(e){let t=e.nodeType===o?e:e.parentElement;return!!t&&t.closest(`[data-wave-focus-trap-allow]`)!==null}function f(e,t){return d(t)?!0:u(i(),e,t,new Set)}function p(e,t){if(e===t||e.id===t.id)return 0;let n=i();if(c(n,e,t.id))return 1;if(c(n,t,e.id))return-1;let r=n.stack.indexOf(e),a=n.stack.indexOf(t);return r!==-1&&a!==-1?r-a:e.order-t.order}function m(e){let{stack:t}=i();for(let n=t.length-1;n>=0;n--){let r=t[n];if(!e||e(r))return r}return null}function h(e){let t=i(),{isolated:n}=t,r=n.get(e)??0;n.set(e,r+1),r===0&&a(t);let o=!0;return()=>{if(!o)return;o=!1;let r=(n.get(e)??1)-1;r>0?n.set(e,r):n.delete(e)&&a(t)}}function g(e){return e.isolated.size===0?null:m(t=>e.isolated.has(t.id))}function _(e){let t=i();if(t.isolated.size===0)return!1;let n=s(t,e);return t.stack.some(r=>r.id!==e&&t.isolated.has(r.id)&&!c(t,r,e)&&(!n||p(n,r)>0))}function v(e,t){return!!t&&t!==e&&p(t,e)>0}function y(e){let{subscribers:t}=i();return t.add(e),()=>{t.delete(e)}}function b(){return i().stack.some(e=>e.kind===`modal`)}function x(){return[...i().stack]}function S(e){return s(i(),e)??null}function C(e,t){let n=i(),r=s(n,e);return!!r&&c(n,r,t)}function w(e,t){let n=i(),r=[],a=t?.includeOwnElements??!0,o=(t,i)=>{if(i.has(t))return;i.add(t);let c=s(n,t);if(c&&(a||t!==e))for(let e of c.getElements())e&&!r.includes(e)&&r.push(e);for(let e of n.elements.get(t)??[])r.includes(e)||r.push(e);for(let e of n.stack)e.parentId===t&&o(e.id,i)};return o(e,new Set),r}function T(e,t){let n=i();for(let r=n.stack.length-1;r>=0;r--){let i=n.stack[r];if(i.kind===`modal`&&(t===void 0||i.id!==t&&!c(n,i,t)))return!f(i.id,e)}return!1}function E(e,t){let n=i(),r=n.elements.get(e);return r||(r=new Set,n.elements.set(e,r)),r.add(t),()=>{let r=n.elements.get(e);r&&(r.delete(t),r.size===0&&n.elements.delete(e))}}function D(e){let t=i();t.counter+=1,e.order=t.counter;let n=t.stack.findIndex(n=>c(t,n,e.id));n===-1?t.stack.push(e):t.stack.splice(n,0,e),B(t),a(t);let r=!0;return()=>{if(!r)return;r=!1;let n=t.stack.indexOf(e);n!==-1&&t.stack.splice(n,1),t.press&&(t.press.layers=t.press.layers.filter(t=>t!==e)),t.stack.length===0&&V(t),a(t)}}function O(e){let t=e.target;return t&&typeof t.nodeType==`number`?t:null}function k(e){return[...e].sort((e,t)=>p(t,e))}function A(e,t,n){let r=g(e),i=e=>!!t&&f(e.id,t)||!!n&&f(e.id,n),a=e=>(e.escape===!0||e.escape===`inside`&&i(e))&&!v(e,r),o=m(i);return(o?m(t=>a(t)&&(t===o||c(e,t,o.id)))??m(e=>a(e)&&i(e)):null)??m(a)}function j(e){return e===`Enter`||e===` `||e===`Spacebar`}function M(e){let t=i();if(e.key===`Escape`||e.key===`Esc`){if(e.defaultPrevented||e.isComposing)return;let n=A(t,O(e),document.activeElement);if(!n)return;e.preventDefault(),n.onDismiss(`escape`,e);return}j(e.key)&&(t.press=null)}function N(e){let t=i(),n=O(e);if(!n||e.button!==0){t.press=null;return}let r=g(t);t.press={layers:t.stack.filter(t=>{let{outsidePress:i}=t;return!i||v(t,r)||f(t.id,n)?!1:typeof i!=`function`||i(e)!==!1})}}var P=1e3;function F(e){let t=i().press;if(!t)return;let n=e.pointerType===`mouse`?0:P;setTimeout(()=>{let e=i();e.press===t&&(e.press=null)},n)}function I(){i().press=null}function L(e){let t=i(),n=t.press;if(t.press=null,!n)return;let r=O(e),a=n.layers.filter(e=>!(r&&f(e.id,r)));for(let n of k(a))t.stack.includes(n)&&n.onDismiss(`outside-press`,e)}function R(e){let t=O(e);if(!t)return;let n=i().stack.filter(e=>e.focusOutside&&!f(e.id,t));n.length!==0&&queueMicrotask(()=>z(n,t,e))}function z(e,t,n){let r=i(),a=(t.ownerDocument??document).activeElement,o=e.filter(e=>r.stack.includes(e)&&!f(e.id,t)&&!(a&&f(e.id,a)));for(let e of k(o))r.stack.includes(e)&&e.onDismiss(`focus-outside`,n)}function B(e){if(e.listeners||typeof document>`u`)return;let t=document;t.addEventListener(`keydown`,M),t.addEventListener(`pointerdown`,N,!0),t.addEventListener(`pointerup`,F,!0),t.addEventListener(`pointercancel`,I,!0),t.addEventListener(`contextmenu`,I,!0),t.addEventListener(`click`,L),t.addEventListener(`focusin`,R,!0),e.listeners={remove(){t.removeEventListener(`keydown`,M),t.removeEventListener(`pointerdown`,N,!0),t.removeEventListener(`pointerup`,F,!0),t.removeEventListener(`pointercancel`,I,!0),t.removeEventListener(`contextmenu`,I,!0),t.removeEventListener(`click`,L),t.removeEventListener(`focusin`,R,!0)}}}function V(e){e.listeners?.remove(),e.listeners=null,e.press=null}exports.ALLOW_OUTSIDE_SELECTOR=n,exports.Z_INDEX=t,exports.compareLayers=p,exports.getLayer=S,exports.getLayerTreeElements=w,exports.getOpenLayers=x,exports.getTopmostLayer=m,exports.hasIsolatingModalBelow=_,exports.hasOpenModal=b,exports.isDescendantLayer=C,exports.isInsideLayerTree=f,exports.isInsideOtherOpenModal=T,exports.modalAllowProps=r,exports.registerLayer=D,exports.registerLayerElement=E,exports.registerLayerIsolation=h,exports.subscribeLayers=y;
|
|
2
2
|
//# sourceMappingURL=layers.cjs.map
|
package/dist/lib/layers.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layers.cjs","names":["getGlobalRegistry","require_globalRegistry","Z_INDEX","ALLOW_OUTSIDE_SELECTOR","getState","state","notifySubscribers","subscriber","ELEMENT_NODE","findLayer","id","layer","isDescendantOf","visited","parentId","ancestorId","containsNode","container","target","isInsideTreeWithoutAllowList","layerId","record","el","registered","isInsideAllowList","isInsideLayerTree","compareLayers","a","b","indexA","indexB","getTopmostLayer","i","stack","predicate","registerLayerIsolation","previous","isolated","count","getIsolationBarrier","hasIsolatingModalBelow","self","isBelowBarrier","barrier","subscribeLayers","subscribers","listener","getOpenLayers","getLayer","isDescendantLayer","getLayerTreeElements","result","includeOwn","options","visit","isInsideOtherOpenModal","exceptLayerId","registerLayerElement","set","current","registerLayer","firstDescendant","ensureListeners","index","removeListeners","getEventTargetNode","event","sortTopmostFirst","layers","findEscapeHandler","contains","active","isCandidate","scope","isClickActivationKey","key","handleKeyDown","handler","handlePointerDown","outsidePress","GESTURE_CLICK_TIMEOUT_MS","handlePointerUp","press","timeout","forgetPress","handleClick","toDismiss","handleFocusIn","candidates","dismissFocusOutside","doc"],"sources":["../../src/lib/layers.ts"],"sourcesContent":["import { getGlobalRegistry } from './globalRegistry';\n\n/**\n * The shared stack of open dismissable layers (dialogs, drawers, popovers, menus, listboxes,\n * tooltips) and the document listeners that route Escape, outside presses and focus changes to\n * them. `useDismiss` registers layers; focus traps, modal isolation and focus restore read the\n * stack. It lives in `getGlobalRegistry('layers')`, so an app that loads both the ESM and the CJS\n * build still has one stack and one set of listeners.\n */\n\n/**\n * z-index of each portal layer. `Portal` adds its nesting depth, so a surface opened from inside\n * another overlay always stacks above it. The values fall back to the defaults of `tokens.css`.\n */\nexport const Z_INDEX = {\n overlay: 'var(--wave-z-overlay, 1000)',\n toast: 'var(--wave-z-toast, 1100)',\n tooltip: 'var(--wave-z-tooltip, 1200)',\n} as const;\n\n/**\n * What kind of surface a layer is. `modal` marks dialog-like surfaces (focus-restore validation and\n * modal isolation look for them); a modal blocks presses and Escape for the layers below it only\n * while its page isolation is active ({@link registerLayerIsolation}). `dialog` marks a non-modal\n * Dialog or Drawer: it shields nothing (no isolation), takes Escape only from inside its tree\n * (`escape: 'inside'`), and the Toaster moves out of its way; focus-restore validation and modal\n * isolation do not count it.\n */\nexport type LayerKind = 'modal' | 'dialog' | 'popover' | 'menu' | 'listbox' | 'tooltip' | 'toast';\n\n/** Why a popup layer is dismissed: Escape, a press outside it, or focus moving outside it. */\nexport type DismissReason = 'escape' | 'outside-press' | 'focus-outside';\n\n/** A registered layer. Getters are allowed, so fields can read the latest options. */\nexport interface LayerRecord {\n /** Unique id; children name it as their `parentId` (through `DismissLayerContext`). */\n id: string;\n /** The enclosing layer (React parentage, which survives portals), or `null`. */\n parentId: string | null;\n kind: LayerKind;\n /** Global open-order counter, assigned by {@link registerLayer} (the passed value is replaced). */\n order: number;\n /** The elements that belong to the layer: its surface, its trigger, extra ignore targets. */\n getElements(): Array<HTMLElement | null>;\n /** The element the layer is anchored to (its trigger); focus traps leave the layer through it. */\n getAnchor(): HTMLElement | null;\n /**\n * Whether Escape dismisses the layer: always (`true`), never (`false`), or only while the key's\n * target or the focused element is in the layer's tree (`'inside'`).\n */\n escape: boolean | 'inside';\n /** Whether a press outside the layer's tree dismisses it; a predicate returning `false` opts out. */\n outsidePress: boolean | ((event: PointerEvent | MouseEvent) => boolean);\n /** Whether focus moving outside the layer's tree dismisses it. */\n focusOutside: boolean;\n /** Called when the layer should close. */\n onDismiss(reason: DismissReason, event: Event): void;\n}\n\n/**\n * Regions (the Toaster viewport) whose content counts as inside **every** layer and whose\n * tabbables join every focus trap's Tab cycle. Modal isolation never makes them inert.\n */\nexport const ALLOW_OUTSIDE_SELECTOR = '[data-wave-focus-trap-allow]';\n\ninterface PressSnapshot {\n /**\n * Layers with outside press enabled whose tree did not contain the pointerdown target. Only these\n * can be dismissed by the click: a layer registered later (opened by that press, or closed and\n * reopened, which registers a new record) is not in it, and a layer that unregisters is removed.\n */\n layers: LayerRecord[];\n}\n\ninterface InstalledListeners {\n remove(): void;\n}\n\ninterface LayerState {\n /** Open layers from bottom to top. A parent always precedes its descendants. */\n stack: LayerRecord[];\n /** Elements registered per layer id (portal wrappers of the layer's descendants). */\n elements: Map<string, Set<HTMLElement>>;\n counter: number;\n press: PressSnapshot | null;\n listeners: InstalledListeners | null;\n /**\n * Called after a layer registers or unregisters (modal isolation re-plans), and after the\n * isolated set changes (the dim-once snapshot).\n */\n subscribers: Set<() => void>;\n /** Ids of layers whose modal isolation currently makes the page inert, with a use count. */\n isolated: Map<string, number>;\n}\n\nfunction getState(): LayerState {\n const state = getGlobalRegistry<LayerState>('layers', () => ({\n stack: [],\n elements: new Map(),\n counter: 0,\n press: null,\n listeners: null,\n subscribers: new Set(),\n isolated: new Map(),\n }));\n // A registry created by an earlier copy of this module (hot reload) may predate these fields.\n state.subscribers ??= new Set();\n state.isolated ??= new Map();\n return state;\n}\n\nfunction notifySubscribers(state: LayerState): void {\n for (const subscriber of Array.from(state.subscribers)) subscriber();\n}\n\nconst ELEMENT_NODE = 1;\n\nfunction findLayer(state: LayerState, id: string | null): LayerRecord | undefined {\n if (id === null) return undefined;\n return state.stack.find((layer) => layer.id === id);\n}\n\n/** Whether `layer` is a (possibly indirect) descendant of the layer `ancestorId`. */\nfunction isDescendantOf(state: LayerState, layer: LayerRecord, ancestorId: string): boolean {\n const visited = new Set<string>([layer.id]);\n let parentId = layer.parentId;\n while (parentId !== null && !visited.has(parentId)) {\n if (parentId === ancestorId) return true;\n visited.add(parentId);\n parentId = findLayer(state, parentId)?.parentId ?? null;\n }\n return false;\n}\n\nfunction containsNode(container: Node | null | undefined, target: Node): boolean {\n return !!container && container.contains(target);\n}\n\nfunction isInsideTreeWithoutAllowList(\n state: LayerState,\n layerId: string,\n target: Node,\n visited: Set<string>,\n): boolean {\n if (visited.has(layerId)) return false;\n visited.add(layerId);\n\n const record = findLayer(state, layerId);\n if (record && record.getElements().some((el) => containsNode(el, target))) return true;\n\n const registered = state.elements.get(layerId);\n if (registered) {\n for (const el of registered) {\n if (containsNode(el, target)) return true;\n }\n }\n\n for (const layer of state.stack) {\n if (\n layer.parentId === layerId &&\n isInsideTreeWithoutAllowList(state, layer.id, target, visited)\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction isInsideAllowList(target: Node): boolean {\n const el = target.nodeType === ELEMENT_NODE ? (target as Element) : target.parentElement;\n return !!el && el.closest(ALLOW_OUTSIDE_SELECTOR) !== null;\n}\n\n/**\n * Whether `target` belongs to the tree of the layer `layerId`:\n * - the layer's own elements (`getElements()`),\n * - elements registered for it with {@link registerLayerElement} (portal wrappers of overlays\n * rendered inside it — React parentage survives portals, the DOM does not),\n * - every descendant layer's tree, and\n * - regions matching {@link ALLOW_OUTSIDE_SELECTOR} (the Toaster viewport), which count as inside\n * every layer.\n */\nexport function isInsideLayerTree(layerId: string, target: Node): boolean {\n if (isInsideAllowList(target)) return true;\n return isInsideTreeWithoutAllowList(getState(), layerId, target, new Set());\n}\n\n/**\n * Compares two layers for stacking: `> 0` when `a` is above `b`. A descendant layer is above its\n * ancestor; otherwise the layer whose tree opened later is above. (A parent that registers after\n * its descendants — effects run child-first when both open in one commit — takes the place of its\n * earliest descendant.)\n */\nexport function compareLayers(a: LayerRecord, b: LayerRecord): number {\n if (a === b || a.id === b.id) return 0;\n const state = getState();\n if (isDescendantOf(state, a, b.id)) return 1;\n if (isDescendantOf(state, b, a.id)) return -1;\n const indexA = state.stack.indexOf(a);\n const indexB = state.stack.indexOf(b);\n if (indexA !== -1 && indexB !== -1) return indexA - indexB;\n return a.order - b.order;\n}\n\n/** The topmost open layer (optionally the topmost one matching `predicate`), or `null`. */\nexport function getTopmostLayer(predicate?: (layer: LayerRecord) => boolean): LayerRecord | null {\n const { stack } = getState();\n for (let i = stack.length - 1; i >= 0; i--) {\n const layer = stack[i];\n if (!predicate || predicate(layer)) return layer;\n }\n return null;\n}\n\n/**\n * Marks the layer `layerId` as isolating the page: `useModalIsolation` made everything outside its\n * tree inert (Dialog, Drawer). While it is open, the topmost isolating layer is a barrier — layers\n * stacked below it (its ancestors and older siblings) are never dismissed by outside presses and\n * never receive Escape, the way a modal blocks the page behind it. Layers above it (its\n * descendants, or a modal opened later) are unaffected. A `kind: 'modal'` layer without isolation\n * (a transient popup such as the DatePicker calendar, whose page stays interactive) is no barrier.\n * Returns the unregister function; registrations are counted, so the layer stays marked until\n * every registration is removed.\n */\nexport function registerLayerIsolation(layerId: string): () => void {\n const state = getState();\n const { isolated } = state;\n const previous = isolated.get(layerId) ?? 0;\n isolated.set(layerId, previous + 1);\n // Subscribers (the dim-once snapshot of Dialog and Drawer) read isolation, which changes without\n // a layer registering: notify when the isolated set gains the layer, and again when it loses it.\n if (previous === 0) notifySubscribers(state);\n let registered = true;\n return () => {\n if (!registered) return;\n registered = false;\n const count = (isolated.get(layerId) ?? 1) - 1;\n if (count > 0) isolated.set(layerId, count);\n else if (isolated.delete(layerId)) notifySubscribers(state);\n };\n}\n\n/** The topmost open layer whose modal isolation is active, or `null`. */\nfunction getIsolationBarrier(state: LayerState): LayerRecord | null {\n if (state.isolated.size === 0) return null;\n return getTopmostLayer((layer) => state.isolated.has(layer.id));\n}\n\n/**\n * Whether an open layer whose modal isolation is active ({@link registerLayerIsolation}) is\n * stacked below the layer `layerId` (`compareLayers(self, other) > 0`). A `layerId` that is not\n * registered yet (the render that opens it) counts as the topmost layer, so every isolating open\n * layer counts. The layer itself and its descendants never count. Read during render through\n * `useSyncExternalStore(subscribeLayers, …)` (the dim-once rule of Dialog and Drawer).\n */\nexport function hasIsolatingModalBelow(layerId: string): boolean {\n const state = getState();\n if (state.isolated.size === 0) return false;\n const self = findLayer(state, layerId);\n return state.stack.some(\n (layer) =>\n layer.id !== layerId &&\n state.isolated.has(layer.id) &&\n !isDescendantOf(state, layer, layerId) &&\n (!self || compareLayers(self, layer) > 0),\n );\n}\n\n/** Whether `layer` is stacked below `barrier` (neither the barrier itself nor above it). */\nfunction isBelowBarrier(layer: LayerRecord, barrier: LayerRecord | null): boolean {\n return !!barrier && barrier !== layer && compareLayers(barrier, layer) > 0;\n}\n\n/**\n * Whether `layer` is stacked below the topmost open **isolating** modal (see\n * {@link registerLayerIsolation}). Such a layer is behind the modal and inert: outside presses\n * never dismiss it and Escape never reaches it. The modal's descendants are above it and stay\n * reachable; a modal-kind layer without isolation shields nothing.\n */\nexport function isBehindIsolatingModal(layer: LayerRecord): boolean {\n return isBelowBarrier(layer, getIsolationBarrier(getState()));\n}\n\n/**\n * Calls `listener` synchronously after any layer registers or unregisters (in the committing\n * component's layout effect, so a modal can re-plan its isolation before a newly opened modal\n * moves focus), and after a layer's modal isolation starts or ends ({@link registerLayerIsolation}).\n * Returns the unsubscribe function.\n */\nexport function subscribeLayers(listener: () => void): () => void {\n const { subscribers } = getState();\n subscribers.add(listener);\n return () => {\n subscribers.delete(listener);\n };\n}\n\n/** The open layers from bottom to top (a copy; a parent always precedes its descendants). */\nexport function getOpenLayers(): LayerRecord[] {\n return [...getState().stack];\n}\n\n/** The open layer with this id, or `null`. */\nexport function getLayer(layerId: string): LayerRecord | null {\n return findLayer(getState(), layerId) ?? null;\n}\n\n/** Whether the open layer `layerId` is a (possibly indirect) descendant of `ancestorId`. */\nexport function isDescendantLayer(layerId: string, ancestorId: string): boolean {\n const state = getState();\n const layer = findLayer(state, layerId);\n return !!layer && isDescendantOf(state, layer, ancestorId);\n}\n\n/**\n * Every element that makes up the tree of `layerId`: the layer's own elements, the elements\n * registered for it and the same for each descendant layer (the allow-list is not included).\n * With `includeOwnElements: false` the layer's own `getElements()` are left out (its descendants'\n * are still included).\n */\nexport function getLayerTreeElements(\n layerId: string,\n options?: { includeOwnElements?: boolean },\n): HTMLElement[] {\n const state = getState();\n const result: HTMLElement[] = [];\n const includeOwn = options?.includeOwnElements ?? true;\n const visit = (id: string, visited: Set<string>) => {\n if (visited.has(id)) return;\n visited.add(id);\n const record = findLayer(state, id);\n if (record && (includeOwn || id !== layerId)) {\n for (const el of record.getElements()) {\n if (el && !result.includes(el)) result.push(el);\n }\n }\n for (const el of state.elements.get(id) ?? []) {\n if (!result.includes(el)) result.push(el);\n }\n for (const layer of state.stack) {\n if (layer.parentId === id) visit(layer.id, visited);\n }\n };\n visit(layerId, new Set());\n return result;\n}\n\n/**\n * Whether focusing `el` would send focus behind another open modal layer: the topmost open modal\n * layer other than `exceptLayerId` (and its descendants, which close with it) does not contain\n * `el` in its tree. An element inside that modal's tree (for example an opener inside a parent\n * dialog) is reachable and returns `false`. Used to validate focus-restore targets.\n */\nexport function isInsideOtherOpenModal(el: Element, exceptLayerId?: string): boolean {\n const state = getState();\n for (let i = state.stack.length - 1; i >= 0; i--) {\n const layer = state.stack[i];\n if (layer.kind !== 'modal') continue;\n if (exceptLayerId !== undefined) {\n if (layer.id === exceptLayerId || isDescendantOf(state, layer, exceptLayerId)) continue;\n }\n return !isInsideLayerTree(layer.id, el);\n }\n return false;\n}\n\n/**\n * Registers an element (a portal wrapper) as part of the layer `layerId`, so presses and focus\n * inside it count as inside that layer and its ancestors. Returns the unregister function (usable\n * as a React 19 ref-callback cleanup). The layer does not need to be registered yet.\n */\nexport function registerLayerElement(layerId: string, el: HTMLElement): () => void {\n const state = getState();\n let set = state.elements.get(layerId);\n if (!set) {\n set = new Set();\n state.elements.set(layerId, set);\n }\n set.add(el);\n return () => {\n const current = state.elements.get(layerId);\n if (!current) return;\n current.delete(el);\n if (current.size === 0) state.elements.delete(layerId);\n };\n}\n\n/**\n * Registers an open layer and returns its unregister function. `record.order` is set to the next\n * value of the global open-order counter. The layer is placed on top of the stack — or, when some\n * of its descendants registered first (same commit), directly below the earliest of them.\n */\nexport function registerLayer(record: LayerRecord): () => void {\n const state = getState();\n state.counter += 1;\n record.order = state.counter;\n\n const firstDescendant = state.stack.findIndex((layer) => isDescendantOf(state, layer, record.id));\n if (firstDescendant === -1) state.stack.push(record);\n else state.stack.splice(firstDescendant, 0, record);\n\n ensureListeners(state);\n notifySubscribers(state);\n\n let registered = true;\n return () => {\n if (!registered) return;\n registered = false;\n const index = state.stack.indexOf(record);\n if (index !== -1) state.stack.splice(index, 1);\n if (state.press) {\n state.press.layers = state.press.layers.filter((layer) => layer !== record);\n }\n if (state.stack.length === 0) removeListeners(state);\n notifySubscribers(state);\n };\n}\n\n// ---------------------------------------------------------------------------\n// Document listeners\n// ---------------------------------------------------------------------------\n\nfunction getEventTargetNode(event: Event): Node | null {\n const target = event.target as { nodeType?: unknown } | null;\n return target && typeof target.nodeType === 'number' ? (target as Node) : null;\n}\n\n/** Topmost first: descendants before their ancestors. */\nfunction sortTopmostFirst(layers: LayerRecord[]): LayerRecord[] {\n return [...layers].sort((a, b) => compareLayers(b, a));\n}\n\n/**\n * The layer that handles an Escape whose target / focused element is `target` / `active`.\n * Candidates are the escape-enabled layers that are not stacked below the topmost isolating modal\n * (a modal that ignores Escape never lets the key close something inert behind it — its ancestor\n * dialog as much as an older sibling); a layer with `escape: 'inside'` is a candidate only while\n * its tree contains them (the toast region counts as inside every layer):\n * 1. the innermost layer whose tree contains them (the topmost such layer) is the focus scope;\n * 2. the topmost candidate of that scope's subtree handles it — the scope itself or an open\n * descendant above it (a tooltip or popover opened from the focused dialog closes first, while\n * a sibling of the focused layer is not in its subtree);\n * 3. else the topmost candidate whose tree contains them (an ancestor);\n * 4. else — no layer contains them, or none of the containing layers takes Escape — the global\n * topmost candidate.\n */\nfunction findEscapeHandler(\n state: LayerState,\n target: Node | null,\n active: Element | null,\n): LayerRecord | null {\n const barrier = getIsolationBarrier(state);\n const contains = (layer: LayerRecord) =>\n (!!target && isInsideLayerTree(layer.id, target)) ||\n (!!active && isInsideLayerTree(layer.id, active));\n const isCandidate = (layer: LayerRecord) =>\n (layer.escape === true || (layer.escape === 'inside' && contains(layer))) &&\n !isBelowBarrier(layer, barrier);\n const scope = getTopmostLayer(contains);\n const handler = scope\n ? (getTopmostLayer(\n (layer) =>\n isCandidate(layer) && (layer === scope || isDescendantOf(state, layer, scope.id)),\n ) ?? getTopmostLayer((layer) => isCandidate(layer) && contains(layer)))\n : null;\n return handler ?? getTopmostLayer(isCandidate);\n}\n\n/** Keys that activate the focused control with a synthetic click. */\nfunction isClickActivationKey(key: string): boolean {\n return key === 'Enter' || key === ' ' || key === 'Spacebar';\n}\n\nfunction handleKeyDown(event: KeyboardEvent): void {\n const state = getState();\n if (event.key === 'Escape' || event.key === 'Esc') {\n if (event.defaultPrevented || event.isComposing) return;\n const handler = findEscapeHandler(state, getEventTargetNode(event), document.activeElement);\n if (!handler) return;\n event.preventDefault();\n handler.onDismiss('escape', event);\n return;\n }\n // A keyboard-activated click (Enter/Space) must not dismiss layers recorded by an unrelated\n // earlier pointerdown. Other keys keep the pending press: modifiers held for a Shift/Ctrl+click\n // auto-repeat their keydown while the pointer is down.\n if (isClickActivationKey(event.key)) state.press = null;\n}\n\nfunction handlePointerDown(event: PointerEvent): void {\n const state = getState();\n const target = getEventTargetNode(event);\n // Only a primary press is followed by a click (right/middle buttons fire contextmenu/auxclick).\n if (!target || event.button !== 0) {\n state.press = null;\n return;\n }\n const barrier = getIsolationBarrier(state);\n const layers = state.stack.filter((layer) => {\n const { outsidePress } = layer;\n if (!outsidePress) return false;\n // A layer behind an open isolating modal (its parent dialog, or a dialog below a sibling\n // modal opened from inside it) is inert and not reachable: presses inside that modal, or on\n // its backdrop, are not \"outside\" presses for it.\n if (isBelowBarrier(layer, barrier)) return false;\n if (isInsideLayerTree(layer.id, target)) return false;\n return typeof outsidePress !== 'function' || outsidePress(event) !== false;\n });\n state.press = { layers };\n}\n\n/**\n * How long (ms) a touch, pen or unknown-device press waits for its click after the pointerup. A\n * tap's click follows within about 350 ms (at most the double-tap delay); a press that gets no\n * click (a long press that opened the context menu, a tap on a non-clickable area) is forgotten\n * after this, so a later programmatic `click()` cannot complete it.\n */\nconst GESTURE_CLICK_TIMEOUT_MS = 1000;\n\n/**\n * A mouse click is dispatched right after its pointerup, in the same task. When none follows (the\n * pointer was released over another window or element tree), a mouse press is forgotten on the\n * next macrotask, so a later programmatic `click()` cannot complete it. Touch and stylus taps are\n * turned into a click by a separate gesture event in a later task (Apple Pencil on iPadOS and\n * Android styluses report `pointerType: 'pen'`, and an unknown device type `''` may behave the\n * same way), so every other pointer type keeps its press for {@link GESTURE_CLICK_TIMEOUT_MS}.\n * The next pointerdown, pointercancel, contextmenu or Enter/Space forgets a press earlier.\n */\nfunction handlePointerUp(event: PointerEvent): void {\n const press = getState().press;\n if (!press) return;\n const timeout = event.pointerType === 'mouse' ? 0 : GESTURE_CLICK_TIMEOUT_MS;\n setTimeout(() => {\n const current = getState();\n if (current.press === press) current.press = null;\n }, timeout);\n}\n\n/** A cancelled pointer stream, or a context menu (a long press, a Mac Ctrl+click), gets no click. */\nfunction forgetPress(): void {\n getState().press = null;\n}\n\nfunction handleClick(event: MouseEvent): void {\n const state = getState();\n const press = state.press;\n state.press = null;\n if (!press) return;\n const target = getEventTargetNode(event);\n const toDismiss = press.layers.filter(\n (layer) => !(target && isInsideLayerTree(layer.id, target)),\n );\n for (const layer of sortTopmostFirst(toDismiss)) {\n // An earlier layer's onDismiss may already have unregistered this one.\n if (state.stack.includes(layer)) layer.onDismiss('outside-press', event);\n }\n}\n\nfunction handleFocusIn(event: FocusEvent): void {\n const target = getEventTargetNode(event);\n if (!target) return;\n const candidates = getState().stack.filter(\n (layer) => layer.focusOutside && !isInsideLayerTree(layer.id, target),\n );\n if (candidates.length === 0) return;\n // Not in this dispatch: React applies `autoFocus` in the layout phase of the commit that mounts\n // a surface, before that surface's portal wrapper and dismiss layer register. A field focused\n // as a popover or dialog opens inside the layer is inside its tree once that commit has run.\n queueMicrotask(() => dismissFocusOutside(candidates, target, event));\n}\n\n/**\n * Dismisses each of `candidates` that is still open and whose tree still contains neither the\n * focusin `target` nor the element focused now (focus that came back inside keeps it open; focus\n * lost to `<body>` after leaving does not).\n */\nfunction dismissFocusOutside(candidates: LayerRecord[], target: Node, event: FocusEvent): void {\n const state = getState();\n const active = (target.ownerDocument ?? document).activeElement;\n const toDismiss = candidates.filter(\n (layer) =>\n state.stack.includes(layer) &&\n !isInsideLayerTree(layer.id, target) &&\n !(active && isInsideLayerTree(layer.id, active)),\n );\n for (const layer of sortTopmostFirst(toDismiss)) {\n // An earlier layer's onDismiss may already have unregistered this one.\n if (state.stack.includes(layer)) layer.onDismiss('focus-outside', event);\n }\n}\n\nfunction ensureListeners(state: LayerState): void {\n if (state.listeners || typeof document === 'undefined') return;\n const doc = document;\n doc.addEventListener('keydown', handleKeyDown);\n doc.addEventListener('pointerdown', handlePointerDown, true);\n doc.addEventListener('pointerup', handlePointerUp, true);\n doc.addEventListener('pointercancel', forgetPress, true);\n doc.addEventListener('contextmenu', forgetPress, true);\n doc.addEventListener('click', handleClick);\n doc.addEventListener('focusin', handleFocusIn, true);\n state.listeners = {\n remove() {\n doc.removeEventListener('keydown', handleKeyDown);\n doc.removeEventListener('pointerdown', handlePointerDown, true);\n doc.removeEventListener('pointerup', handlePointerUp, true);\n doc.removeEventListener('pointercancel', forgetPress, true);\n doc.removeEventListener('contextmenu', forgetPress, true);\n doc.removeEventListener('click', handleClick);\n doc.removeEventListener('focusin', handleFocusIn, true);\n },\n };\n}\n\nfunction removeListeners(state: LayerState): void {\n state.listeners?.remove();\n state.listeners = null;\n state.press = null;\n}\n"],"mappings":"w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file":"layers.cjs","names":["getGlobalRegistry","require_globalRegistry","Z_INDEX","ALLOW_OUTSIDE_SELECTOR","modalAllowProps","getState","state","notifySubscribers","subscriber","ELEMENT_NODE","findLayer","id","layer","isDescendantOf","visited","parentId","ancestorId","containsNode","container","target","isInsideTreeWithoutAllowList","layerId","record","el","registered","isInsideAllowList","isInsideLayerTree","compareLayers","a","b","indexA","indexB","getTopmostLayer","i","stack","predicate","registerLayerIsolation","previous","isolated","count","getIsolationBarrier","hasIsolatingModalBelow","self","isBelowBarrier","barrier","subscribeLayers","subscribers","listener","hasOpenModal","getOpenLayers","getLayer","isDescendantLayer","getLayerTreeElements","result","includeOwn","options","visit","isInsideOtherOpenModal","exceptLayerId","registerLayerElement","set","current","registerLayer","firstDescendant","ensureListeners","index","removeListeners","getEventTargetNode","event","sortTopmostFirst","layers","findEscapeHandler","contains","active","isCandidate","scope","isClickActivationKey","key","handleKeyDown","handler","handlePointerDown","outsidePress","GESTURE_CLICK_TIMEOUT_MS","handlePointerUp","press","timeout","forgetPress","handleClick","toDismiss","handleFocusIn","candidates","dismissFocusOutside","doc"],"sources":["../../src/lib/layers.ts"],"sourcesContent":["import { getGlobalRegistry } from './globalRegistry';\n\n/**\n * The shared stack of open dismissable layers (dialogs, drawers, popovers, menus, listboxes,\n * tooltips) and the document listeners that route Escape, outside presses and focus changes to\n * them. `useDismiss` registers layers; focus traps, modal isolation and focus restore read the\n * stack. It lives in `getGlobalRegistry('layers')`, so an app that loads both the ESM and the CJS\n * build still has one stack and one set of listeners.\n */\n\n/**\n * z-index of each portal layer. `Portal` adds its nesting depth, so a surface opened from inside\n * another overlay always stacks above it. The values fall back to the defaults of `tokens.css`.\n */\nexport const Z_INDEX = {\n overlay: 'var(--wave-z-overlay, 1000)',\n toast: 'var(--wave-z-toast, 1100)',\n tooltip: 'var(--wave-z-tooltip, 1200)',\n} as const;\n\n/**\n * What kind of surface a layer is. `modal` marks dialog-like surfaces (focus-restore validation and\n * modal isolation look for them); a modal blocks presses and Escape for the layers below it only\n * while its page isolation is active ({@link registerLayerIsolation}). `dialog` marks a non-modal\n * Dialog or Drawer: it shields nothing (no isolation), takes Escape only from inside its tree\n * (`escape: 'inside'`), and the Toaster moves out of its way; focus-restore validation and modal\n * isolation do not count it.\n */\nexport type LayerKind = 'modal' | 'dialog' | 'popover' | 'menu' | 'listbox' | 'tooltip' | 'toast';\n\n/** Why a popup layer is dismissed: Escape, a press outside it, or focus moving outside it. */\nexport type DismissReason = 'escape' | 'outside-press' | 'focus-outside';\n\n/** A registered layer. Getters are allowed, so fields can read the latest options. */\nexport interface LayerRecord {\n /** Unique id; children name it as their `parentId` (through `DismissLayerContext`). */\n id: string;\n /** The enclosing layer (React parentage, which survives portals), or `null`. */\n parentId: string | null;\n kind: LayerKind;\n /** Global open-order counter, assigned by {@link registerLayer} (the passed value is replaced). */\n order: number;\n /** The elements that belong to the layer: its surface, its trigger, extra ignore targets. */\n getElements(): Array<HTMLElement | null>;\n /** The element the layer is anchored to (its trigger); focus traps leave the layer through it. */\n getAnchor(): HTMLElement | null;\n /**\n * Whether Escape dismisses the layer: always (`true`), never (`false`), or only while the key's\n * target or the focused element is in the layer's tree (`'inside'`).\n */\n escape: boolean | 'inside';\n /** Whether a press outside the layer's tree dismisses it; a predicate returning `false` opts out. */\n outsidePress: boolean | ((event: PointerEvent | MouseEvent) => boolean);\n /** Whether focus moving outside the layer's tree dismisses it. */\n focusOutside: boolean;\n /** Called when the layer should close. */\n onDismiss(reason: DismissReason, event: Event): void;\n}\n\n/**\n * Regions (the Toaster viewport) whose content counts as inside **every** layer and whose\n * tabbables join every focus trap's Tab cycle. Modal isolation never makes them inert.\n */\nexport const ALLOW_OUTSIDE_SELECTOR = '[data-wave-focus-trap-allow]';\n\n/**\n * Props that mark an app-owned region (a notification area, a live status bar) so that WaveUI's\n * modal surfaces leave it usable. Spread them on the region's element: `<div {...modalAllowProps}>`.\n * Over an open Dialog or Drawer the region\n *\n * - counts as inside every dismiss layer, so a press in it closes nothing;\n * - has its tabbable elements in the Tab cycle of every focus trap;\n * - is never made `inert` by the modal's page isolation.\n *\n * The attribute it sets, `data-wave-focus-trap-allow`, is the one the Toaster's own region\n * carries, and it is a stable contract.\n */\nexport const modalAllowProps = { 'data-wave-focus-trap-allow': '' } as const;\n\ninterface PressSnapshot {\n /**\n * Layers with outside press enabled whose tree did not contain the pointerdown target. Only these\n * can be dismissed by the click: a layer registered later (opened by that press, or closed and\n * reopened, which registers a new record) is not in it, and a layer that unregisters is removed.\n */\n layers: LayerRecord[];\n}\n\ninterface InstalledListeners {\n remove(): void;\n}\n\ninterface LayerState {\n /** Open layers from bottom to top. A parent always precedes its descendants. */\n stack: LayerRecord[];\n /** Elements registered per layer id (portal wrappers of the layer's descendants). */\n elements: Map<string, Set<HTMLElement>>;\n counter: number;\n press: PressSnapshot | null;\n listeners: InstalledListeners | null;\n /**\n * Called after a layer registers or unregisters (modal isolation re-plans), and after the\n * isolated set changes (the dim-once snapshot).\n */\n subscribers: Set<() => void>;\n /** Ids of layers whose modal isolation currently makes the page inert, with a use count. */\n isolated: Map<string, number>;\n}\n\nfunction getState(): LayerState {\n const state = getGlobalRegistry<LayerState>('layers', () => ({\n stack: [],\n elements: new Map(),\n counter: 0,\n press: null,\n listeners: null,\n subscribers: new Set(),\n isolated: new Map(),\n }));\n // A registry created by an earlier copy of this module (hot reload) may predate these fields.\n state.subscribers ??= new Set();\n state.isolated ??= new Map();\n return state;\n}\n\nfunction notifySubscribers(state: LayerState): void {\n for (const subscriber of Array.from(state.subscribers)) subscriber();\n}\n\nconst ELEMENT_NODE = 1;\n\nfunction findLayer(state: LayerState, id: string | null): LayerRecord | undefined {\n if (id === null) return undefined;\n return state.stack.find((layer) => layer.id === id);\n}\n\n/** Whether `layer` is a (possibly indirect) descendant of the layer `ancestorId`. */\nfunction isDescendantOf(state: LayerState, layer: LayerRecord, ancestorId: string): boolean {\n const visited = new Set<string>([layer.id]);\n let parentId = layer.parentId;\n while (parentId !== null && !visited.has(parentId)) {\n if (parentId === ancestorId) return true;\n visited.add(parentId);\n parentId = findLayer(state, parentId)?.parentId ?? null;\n }\n return false;\n}\n\nfunction containsNode(container: Node | null | undefined, target: Node): boolean {\n return !!container && container.contains(target);\n}\n\nfunction isInsideTreeWithoutAllowList(\n state: LayerState,\n layerId: string,\n target: Node,\n visited: Set<string>,\n): boolean {\n if (visited.has(layerId)) return false;\n visited.add(layerId);\n\n const record = findLayer(state, layerId);\n if (record && record.getElements().some((el) => containsNode(el, target))) return true;\n\n const registered = state.elements.get(layerId);\n if (registered) {\n for (const el of registered) {\n if (containsNode(el, target)) return true;\n }\n }\n\n for (const layer of state.stack) {\n if (\n layer.parentId === layerId &&\n isInsideTreeWithoutAllowList(state, layer.id, target, visited)\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction isInsideAllowList(target: Node): boolean {\n const el = target.nodeType === ELEMENT_NODE ? (target as Element) : target.parentElement;\n return !!el && el.closest(ALLOW_OUTSIDE_SELECTOR) !== null;\n}\n\n/**\n * Whether `target` belongs to the tree of the layer `layerId`:\n * - the layer's own elements (`getElements()`),\n * - elements registered for it with {@link registerLayerElement} (portal wrappers of overlays\n * rendered inside it — React parentage survives portals, the DOM does not),\n * - every descendant layer's tree, and\n * - regions matching {@link ALLOW_OUTSIDE_SELECTOR} (the Toaster viewport), which count as inside\n * every layer.\n */\nexport function isInsideLayerTree(layerId: string, target: Node): boolean {\n if (isInsideAllowList(target)) return true;\n return isInsideTreeWithoutAllowList(getState(), layerId, target, new Set());\n}\n\n/**\n * Compares two layers for stacking: `> 0` when `a` is above `b`. A descendant layer is above its\n * ancestor; otherwise the layer whose tree opened later is above. (A parent that registers after\n * its descendants — effects run child-first when both open in one commit — takes the place of its\n * earliest descendant.)\n */\nexport function compareLayers(a: LayerRecord, b: LayerRecord): number {\n if (a === b || a.id === b.id) return 0;\n const state = getState();\n if (isDescendantOf(state, a, b.id)) return 1;\n if (isDescendantOf(state, b, a.id)) return -1;\n const indexA = state.stack.indexOf(a);\n const indexB = state.stack.indexOf(b);\n if (indexA !== -1 && indexB !== -1) return indexA - indexB;\n return a.order - b.order;\n}\n\n/** The topmost open layer (optionally the topmost one matching `predicate`), or `null`. */\nexport function getTopmostLayer(predicate?: (layer: LayerRecord) => boolean): LayerRecord | null {\n const { stack } = getState();\n for (let i = stack.length - 1; i >= 0; i--) {\n const layer = stack[i];\n if (!predicate || predicate(layer)) return layer;\n }\n return null;\n}\n\n/**\n * Marks the layer `layerId` as isolating the page: `useModalIsolation` made everything outside its\n * tree inert (Dialog, Drawer). While it is open, the topmost isolating layer is a barrier — layers\n * stacked below it (its ancestors and older siblings) are never dismissed by outside presses and\n * never receive Escape, the way a modal blocks the page behind it. Layers above it (its\n * descendants, or a modal opened later) are unaffected. A `kind: 'modal'` layer without isolation\n * (a transient popup such as the DatePicker calendar, whose page stays interactive) is no barrier.\n * Returns the unregister function; registrations are counted, so the layer stays marked until\n * every registration is removed.\n */\nexport function registerLayerIsolation(layerId: string): () => void {\n const state = getState();\n const { isolated } = state;\n const previous = isolated.get(layerId) ?? 0;\n isolated.set(layerId, previous + 1);\n // Subscribers (the dim-once snapshot of Dialog and Drawer) read isolation, which changes without\n // a layer registering: notify when the isolated set gains the layer, and again when it loses it.\n if (previous === 0) notifySubscribers(state);\n let registered = true;\n return () => {\n if (!registered) return;\n registered = false;\n const count = (isolated.get(layerId) ?? 1) - 1;\n if (count > 0) isolated.set(layerId, count);\n else if (isolated.delete(layerId)) notifySubscribers(state);\n };\n}\n\n/** The topmost open layer whose modal isolation is active, or `null`. */\nfunction getIsolationBarrier(state: LayerState): LayerRecord | null {\n if (state.isolated.size === 0) return null;\n return getTopmostLayer((layer) => state.isolated.has(layer.id));\n}\n\n/**\n * Whether an open layer whose modal isolation is active ({@link registerLayerIsolation}) is\n * stacked below the layer `layerId` (`compareLayers(self, other) > 0`). A `layerId` that is not\n * registered yet (the render that opens it) counts as the topmost layer, so every isolating open\n * layer counts. The layer itself and its descendants never count. Read during render through\n * `useSyncExternalStore(subscribeLayers, …)` (the dim-once rule of Dialog and Drawer).\n */\nexport function hasIsolatingModalBelow(layerId: string): boolean {\n const state = getState();\n if (state.isolated.size === 0) return false;\n const self = findLayer(state, layerId);\n return state.stack.some(\n (layer) =>\n layer.id !== layerId &&\n state.isolated.has(layer.id) &&\n !isDescendantOf(state, layer, layerId) &&\n (!self || compareLayers(self, layer) > 0),\n );\n}\n\n/** Whether `layer` is stacked below `barrier` (neither the barrier itself nor above it). */\nfunction isBelowBarrier(layer: LayerRecord, barrier: LayerRecord | null): boolean {\n return !!barrier && barrier !== layer && compareLayers(barrier, layer) > 0;\n}\n\n/**\n * Whether `layer` is stacked below the topmost open **isolating** modal (see\n * {@link registerLayerIsolation}). Such a layer is behind the modal and inert: outside presses\n * never dismiss it and Escape never reaches it. The modal's descendants are above it and stay\n * reachable; a modal-kind layer without isolation shields nothing.\n */\nexport function isBehindIsolatingModal(layer: LayerRecord): boolean {\n return isBelowBarrier(layer, getIsolationBarrier(getState()));\n}\n\n/**\n * Calls `listener` synchronously after any layer registers or unregisters (in the committing\n * component's layout effect, so a modal can re-plan its isolation before a newly opened modal\n * moves focus), and after a layer's modal isolation starts or ends ({@link registerLayerIsolation}).\n * Returns the unsubscribe function.\n */\nexport function subscribeLayers(listener: () => void): () => void {\n const { subscribers } = getState();\n subscribers.add(listener);\n return () => {\n subscribers.delete(listener);\n };\n}\n\n/**\n * Whether a modal surface is open now: a layer of kind `'modal'` (a Dialog, an overlay Drawer, an\n * alert, the DatePicker's calendar, or your own `useDismiss({ kind: 'modal' })`). A non-modal\n * surface is no modal. Server-safe: `false` when no layer is registered, as on the server.\n */\nexport function hasOpenModal(): boolean {\n return getState().stack.some((layer) => layer.kind === 'modal');\n}\n\n/** The open layers from bottom to top (a copy; a parent always precedes its descendants). */\nexport function getOpenLayers(): LayerRecord[] {\n return [...getState().stack];\n}\n\n/** The open layer with this id, or `null`. */\nexport function getLayer(layerId: string): LayerRecord | null {\n return findLayer(getState(), layerId) ?? null;\n}\n\n/** Whether the open layer `layerId` is a (possibly indirect) descendant of `ancestorId`. */\nexport function isDescendantLayer(layerId: string, ancestorId: string): boolean {\n const state = getState();\n const layer = findLayer(state, layerId);\n return !!layer && isDescendantOf(state, layer, ancestorId);\n}\n\n/**\n * Every element that makes up the tree of `layerId`: the layer's own elements, the elements\n * registered for it and the same for each descendant layer (the allow-list is not included).\n * With `includeOwnElements: false` the layer's own `getElements()` are left out (its descendants'\n * are still included).\n */\nexport function getLayerTreeElements(\n layerId: string,\n options?: { includeOwnElements?: boolean },\n): HTMLElement[] {\n const state = getState();\n const result: HTMLElement[] = [];\n const includeOwn = options?.includeOwnElements ?? true;\n const visit = (id: string, visited: Set<string>) => {\n if (visited.has(id)) return;\n visited.add(id);\n const record = findLayer(state, id);\n if (record && (includeOwn || id !== layerId)) {\n for (const el of record.getElements()) {\n if (el && !result.includes(el)) result.push(el);\n }\n }\n for (const el of state.elements.get(id) ?? []) {\n if (!result.includes(el)) result.push(el);\n }\n for (const layer of state.stack) {\n if (layer.parentId === id) visit(layer.id, visited);\n }\n };\n visit(layerId, new Set());\n return result;\n}\n\n/**\n * Whether focusing `el` would send focus behind another open modal layer: the topmost open modal\n * layer other than `exceptLayerId` (and its descendants, which close with it) does not contain\n * `el` in its tree. An element inside that modal's tree (for example an opener inside a parent\n * dialog) is reachable and returns `false`. Used to validate focus-restore targets.\n */\nexport function isInsideOtherOpenModal(el: Element, exceptLayerId?: string): boolean {\n const state = getState();\n for (let i = state.stack.length - 1; i >= 0; i--) {\n const layer = state.stack[i];\n if (layer.kind !== 'modal') continue;\n if (exceptLayerId !== undefined) {\n if (layer.id === exceptLayerId || isDescendantOf(state, layer, exceptLayerId)) continue;\n }\n return !isInsideLayerTree(layer.id, el);\n }\n return false;\n}\n\n/**\n * Registers an element (a portal wrapper) as part of the layer `layerId`, so presses and focus\n * inside it count as inside that layer and its ancestors. Returns the unregister function (usable\n * as a React 19 ref-callback cleanup). The layer does not need to be registered yet.\n */\nexport function registerLayerElement(layerId: string, el: HTMLElement): () => void {\n const state = getState();\n let set = state.elements.get(layerId);\n if (!set) {\n set = new Set();\n state.elements.set(layerId, set);\n }\n set.add(el);\n return () => {\n const current = state.elements.get(layerId);\n if (!current) return;\n current.delete(el);\n if (current.size === 0) state.elements.delete(layerId);\n };\n}\n\n/**\n * Registers an open layer and returns its unregister function. `record.order` is set to the next\n * value of the global open-order counter. The layer is placed on top of the stack — or, when some\n * of its descendants registered first (same commit), directly below the earliest of them.\n */\nexport function registerLayer(record: LayerRecord): () => void {\n const state = getState();\n state.counter += 1;\n record.order = state.counter;\n\n const firstDescendant = state.stack.findIndex((layer) => isDescendantOf(state, layer, record.id));\n if (firstDescendant === -1) state.stack.push(record);\n else state.stack.splice(firstDescendant, 0, record);\n\n ensureListeners(state);\n notifySubscribers(state);\n\n let registered = true;\n return () => {\n if (!registered) return;\n registered = false;\n const index = state.stack.indexOf(record);\n if (index !== -1) state.stack.splice(index, 1);\n if (state.press) {\n state.press.layers = state.press.layers.filter((layer) => layer !== record);\n }\n if (state.stack.length === 0) removeListeners(state);\n notifySubscribers(state);\n };\n}\n\n// ---------------------------------------------------------------------------\n// Document listeners\n// ---------------------------------------------------------------------------\n\nfunction getEventTargetNode(event: Event): Node | null {\n const target = event.target as { nodeType?: unknown } | null;\n return target && typeof target.nodeType === 'number' ? (target as Node) : null;\n}\n\n/** Topmost first: descendants before their ancestors. */\nfunction sortTopmostFirst(layers: LayerRecord[]): LayerRecord[] {\n return [...layers].sort((a, b) => compareLayers(b, a));\n}\n\n/**\n * The layer that handles an Escape whose target / focused element is `target` / `active`.\n * Candidates are the escape-enabled layers that are not stacked below the topmost isolating modal\n * (a modal that ignores Escape never lets the key close something inert behind it — its ancestor\n * dialog as much as an older sibling); a layer with `escape: 'inside'` is a candidate only while\n * its tree contains them (the toast region counts as inside every layer):\n * 1. the innermost layer whose tree contains them (the topmost such layer) is the focus scope;\n * 2. the topmost candidate of that scope's subtree handles it — the scope itself or an open\n * descendant above it (a tooltip or popover opened from the focused dialog closes first, while\n * a sibling of the focused layer is not in its subtree);\n * 3. else the topmost candidate whose tree contains them (an ancestor);\n * 4. else — no layer contains them, or none of the containing layers takes Escape — the global\n * topmost candidate.\n */\nfunction findEscapeHandler(\n state: LayerState,\n target: Node | null,\n active: Element | null,\n): LayerRecord | null {\n const barrier = getIsolationBarrier(state);\n const contains = (layer: LayerRecord) =>\n (!!target && isInsideLayerTree(layer.id, target)) ||\n (!!active && isInsideLayerTree(layer.id, active));\n const isCandidate = (layer: LayerRecord) =>\n (layer.escape === true || (layer.escape === 'inside' && contains(layer))) &&\n !isBelowBarrier(layer, barrier);\n const scope = getTopmostLayer(contains);\n const handler = scope\n ? (getTopmostLayer(\n (layer) =>\n isCandidate(layer) && (layer === scope || isDescendantOf(state, layer, scope.id)),\n ) ?? getTopmostLayer((layer) => isCandidate(layer) && contains(layer)))\n : null;\n return handler ?? getTopmostLayer(isCandidate);\n}\n\n/** Keys that activate the focused control with a synthetic click. */\nfunction isClickActivationKey(key: string): boolean {\n return key === 'Enter' || key === ' ' || key === 'Spacebar';\n}\n\nfunction handleKeyDown(event: KeyboardEvent): void {\n const state = getState();\n if (event.key === 'Escape' || event.key === 'Esc') {\n if (event.defaultPrevented || event.isComposing) return;\n const handler = findEscapeHandler(state, getEventTargetNode(event), document.activeElement);\n if (!handler) return;\n event.preventDefault();\n handler.onDismiss('escape', event);\n return;\n }\n // A keyboard-activated click (Enter/Space) must not dismiss layers recorded by an unrelated\n // earlier pointerdown. Other keys keep the pending press: modifiers held for a Shift/Ctrl+click\n // auto-repeat their keydown while the pointer is down.\n if (isClickActivationKey(event.key)) state.press = null;\n}\n\nfunction handlePointerDown(event: PointerEvent): void {\n const state = getState();\n const target = getEventTargetNode(event);\n // Only a primary press is followed by a click (right/middle buttons fire contextmenu/auxclick).\n if (!target || event.button !== 0) {\n state.press = null;\n return;\n }\n const barrier = getIsolationBarrier(state);\n const layers = state.stack.filter((layer) => {\n const { outsidePress } = layer;\n if (!outsidePress) return false;\n // A layer behind an open isolating modal (its parent dialog, or a dialog below a sibling\n // modal opened from inside it) is inert and not reachable: presses inside that modal, or on\n // its backdrop, are not \"outside\" presses for it.\n if (isBelowBarrier(layer, barrier)) return false;\n if (isInsideLayerTree(layer.id, target)) return false;\n return typeof outsidePress !== 'function' || outsidePress(event) !== false;\n });\n state.press = { layers };\n}\n\n/**\n * How long (ms) a touch, pen or unknown-device press waits for its click after the pointerup. A\n * tap's click follows within about 350 ms (at most the double-tap delay); a press that gets no\n * click (a long press that opened the context menu, a tap on a non-clickable area) is forgotten\n * after this, so a later programmatic `click()` cannot complete it.\n */\nconst GESTURE_CLICK_TIMEOUT_MS = 1000;\n\n/**\n * A mouse click is dispatched right after its pointerup, in the same task. When none follows (the\n * pointer was released over another window or element tree), a mouse press is forgotten on the\n * next macrotask, so a later programmatic `click()` cannot complete it. Touch and stylus taps are\n * turned into a click by a separate gesture event in a later task (Apple Pencil on iPadOS and\n * Android styluses report `pointerType: 'pen'`, and an unknown device type `''` may behave the\n * same way), so every other pointer type keeps its press for {@link GESTURE_CLICK_TIMEOUT_MS}.\n * The next pointerdown, pointercancel, contextmenu or Enter/Space forgets a press earlier.\n */\nfunction handlePointerUp(event: PointerEvent): void {\n const press = getState().press;\n if (!press) return;\n const timeout = event.pointerType === 'mouse' ? 0 : GESTURE_CLICK_TIMEOUT_MS;\n setTimeout(() => {\n const current = getState();\n if (current.press === press) current.press = null;\n }, timeout);\n}\n\n/** A cancelled pointer stream, or a context menu (a long press, a Mac Ctrl+click), gets no click. */\nfunction forgetPress(): void {\n getState().press = null;\n}\n\nfunction handleClick(event: MouseEvent): void {\n const state = getState();\n const press = state.press;\n state.press = null;\n if (!press) return;\n const target = getEventTargetNode(event);\n const toDismiss = press.layers.filter(\n (layer) => !(target && isInsideLayerTree(layer.id, target)),\n );\n for (const layer of sortTopmostFirst(toDismiss)) {\n // An earlier layer's onDismiss may already have unregistered this one.\n if (state.stack.includes(layer)) layer.onDismiss('outside-press', event);\n }\n}\n\nfunction handleFocusIn(event: FocusEvent): void {\n const target = getEventTargetNode(event);\n if (!target) return;\n const candidates = getState().stack.filter(\n (layer) => layer.focusOutside && !isInsideLayerTree(layer.id, target),\n );\n if (candidates.length === 0) return;\n // Not in this dispatch: React applies `autoFocus` in the layout phase of the commit that mounts\n // a surface, before that surface's portal wrapper and dismiss layer register. A field focused\n // as a popover or dialog opens inside the layer is inside its tree once that commit has run.\n queueMicrotask(() => dismissFocusOutside(candidates, target, event));\n}\n\n/**\n * Dismisses each of `candidates` that is still open and whose tree still contains neither the\n * focusin `target` nor the element focused now (focus that came back inside keeps it open; focus\n * lost to `<body>` after leaving does not).\n */\nfunction dismissFocusOutside(candidates: LayerRecord[], target: Node, event: FocusEvent): void {\n const state = getState();\n const active = (target.ownerDocument ?? document).activeElement;\n const toDismiss = candidates.filter(\n (layer) =>\n state.stack.includes(layer) &&\n !isInsideLayerTree(layer.id, target) &&\n !(active && isInsideLayerTree(layer.id, active)),\n );\n for (const layer of sortTopmostFirst(toDismiss)) {\n // An earlier layer's onDismiss may already have unregistered this one.\n if (state.stack.includes(layer)) layer.onDismiss('focus-outside', event);\n }\n}\n\nfunction ensureListeners(state: LayerState): void {\n if (state.listeners || typeof document === 'undefined') return;\n const doc = document;\n doc.addEventListener('keydown', handleKeyDown);\n doc.addEventListener('pointerdown', handlePointerDown, true);\n doc.addEventListener('pointerup', handlePointerUp, true);\n doc.addEventListener('pointercancel', forgetPress, true);\n doc.addEventListener('contextmenu', forgetPress, true);\n doc.addEventListener('click', handleClick);\n doc.addEventListener('focusin', handleFocusIn, true);\n state.listeners = {\n remove() {\n doc.removeEventListener('keydown', handleKeyDown);\n doc.removeEventListener('pointerdown', handlePointerDown, true);\n doc.removeEventListener('pointerup', handlePointerUp, true);\n doc.removeEventListener('pointercancel', forgetPress, true);\n doc.removeEventListener('contextmenu', forgetPress, true);\n doc.removeEventListener('click', handleClick);\n doc.removeEventListener('focusin', handleFocusIn, true);\n },\n };\n}\n\nfunction removeListeners(state: LayerState): void {\n state.listeners?.remove();\n state.listeners = null;\n state.press = null;\n}\n"],"mappings":"wCAcA,IAAaE,EAAU,CACrB,QAAS,8BACT,MAAO,4BACP,QAAS,6BACX,EA6CaC,EAAyB,+BAczBC,EAAkB,CAAE,6BAA8B,EAAG,EAgClE,SAASC,GAAuB,CAC9B,IAAMC,EAAQN,EAAAA,kBAA8B,cAAiB,CAC3D,MAAO,CAAC,EACR,SAAU,IAAI,IACd,QAAS,EACT,MAAO,KACP,UAAW,KACX,YAAa,IAAI,IACjB,SAAU,IAAI,GAChB,EAAE,EAIF,MAFA,GAAM,cAAgB,IAAI,IAC1B,EAAM,WAAa,IAAI,IAChBM,CACT,CAEA,SAASC,EAAkB,EAAyB,CAClD,IAAK,IAAMC,KAAc,MAAM,KAAKF,EAAM,WAAW,EAAGE,EAAW,CACrE,CAEA,IAAMC,EAAe,EAErB,SAASC,EAAU,EAAmB,EAA4C,CAChF,GAAIC,IAAO,KACX,OAAOL,EAAM,MAAM,KAAM,GAAUM,EAAM,KAAOD,CAAE,CACpD,CAGA,SAASE,EAAe,EAAmB,EAAoB,EAA6B,CAC1F,IAAMC,EAAU,IAAI,IAAY,CAACF,EAAM,EAAE,CAAC,EACtCG,EAAWH,EAAM,SACrB,KAAOG,IAAa,MAAQ,CAACD,EAAQ,IAAIC,CAAQ,GAAG,CAClD,GAAIA,IAAaC,EAAY,MAAO,GACpCF,EAAQ,IAAIC,CAAQ,EACpB,EAAWL,EAAUJ,EAAOS,CAAQ,CAAC,EAAE,UAAY,IACrD,CACA,MAAO,EACT,CAEA,SAASE,EAAa,EAAoC,EAAuB,CAC/E,MAAO,CAAC,CAACC,GAAaA,EAAU,SAASC,CAAM,CACjD,CAEA,SAASC,EACP,EACA,EACA,EACA,EACS,CACT,GAAIN,EAAQ,IAAIO,CAAO,EAAG,MAAO,GACjCP,EAAQ,IAAIO,CAAO,EAEnB,IAAMC,EAASZ,EAAUJ,EAAOe,CA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