zabi-components 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1924 -0
- package/README.md +243 -10
- package/THEME.md +149 -332
- package/THEMING.md +1192 -266
- package/dist/atoms/ActionPanel.svelte +15 -5
- package/dist/atoms/Avatar.svelte +104 -0
- package/dist/atoms/Avatar.svelte.d.ts +34 -0
- package/dist/atoms/Badge.svelte +36 -7
- package/dist/atoms/Badge.svelte.d.ts +2 -2
- package/dist/atoms/Button.svelte +177 -27
- package/dist/atoms/Button.svelte.d.ts +30 -2
- package/dist/atoms/Card.svelte +4 -4
- package/dist/atoms/CardHeader.svelte +16 -4
- package/dist/atoms/Checkbox.svelte +48 -21
- package/dist/atoms/Checkbox.svelte.d.ts +4 -2
- package/dist/atoms/CodeBlock.svelte +20 -2
- package/dist/atoms/CodeBlock.svelte.d.ts +4 -0
- package/dist/atoms/ColorPicker.svelte +259 -49
- package/dist/atoms/ColorPicker.svelte.d.ts +3 -0
- package/dist/atoms/Container.svelte +16 -8
- package/dist/atoms/DateField.svelte +107 -0
- package/dist/atoms/DateField.svelte.d.ts +53 -0
- package/dist/atoms/FieldMessages.svelte +69 -0
- package/dist/atoms/FieldMessages.svelte.d.ts +23 -0
- package/dist/atoms/FloatingActionButton.svelte +174 -0
- package/dist/atoms/FloatingActionButton.svelte.d.ts +51 -0
- package/dist/atoms/Heading.svelte +37 -5
- package/dist/atoms/Heading.svelte.d.ts +7 -0
- package/dist/atoms/IconButton.svelte +220 -24
- package/dist/atoms/IconButton.svelte.d.ts +49 -4
- package/dist/atoms/Input.svelte +253 -52
- package/dist/atoms/Input.svelte.d.ts +32 -2
- package/dist/atoms/List.svelte +4 -1
- package/dist/atoms/ListItem.svelte +44 -11
- package/dist/atoms/ListItem.svelte.d.ts +5 -0
- package/dist/atoms/Progress.svelte +27 -8
- package/dist/atoms/Progress.svelte.d.ts +4 -0
- package/dist/atoms/Radio.svelte +19 -3
- package/dist/atoms/Radio.svelte.d.ts +4 -2
- package/dist/atoms/Rating.svelte +494 -0
- package/dist/atoms/Rating.svelte.d.ts +56 -0
- package/dist/atoms/Select.svelte +433 -91
- package/dist/atoms/Select.svelte.d.ts +49 -3
- package/dist/atoms/SelectionControl.svelte +94 -17
- package/dist/atoms/SelectionControl.svelte.d.ts +4 -3
- package/dist/atoms/Skeleton.svelte +1 -1
- package/dist/atoms/Slider.svelte +309 -0
- package/dist/atoms/Slider.svelte.d.ts +40 -0
- package/dist/atoms/Spinner.svelte +57 -0
- package/dist/atoms/Spinner.svelte.d.ts +19 -0
- package/dist/atoms/Table.svelte +151 -6
- package/dist/atoms/Table.svelte.d.ts +15 -3
- package/dist/atoms/TemporalField.svelte +140 -0
- package/dist/atoms/TemporalField.svelte.d.ts +32 -0
- package/dist/atoms/Text.svelte +23 -11
- package/dist/atoms/Text.svelte.d.ts +6 -3
- package/dist/atoms/Textarea.svelte +55 -44
- package/dist/atoms/Textarea.svelte.d.ts +14 -2
- package/dist/atoms/ThemeToggle.svelte +223 -44
- package/dist/atoms/ThemeToggle.svelte.d.ts +26 -3
- package/dist/atoms/TimeField.svelte +108 -0
- package/dist/atoms/TimeField.svelte.d.ts +54 -0
- package/dist/atoms/Toast.svelte +17 -4
- package/dist/atoms/Toast.svelte.d.ts +2 -0
- package/dist/atoms/Toggle.svelte +41 -8
- package/dist/atoms/Toggle.svelte.d.ts +11 -2
- package/dist/atoms/Tooltip.svelte +508 -23
- package/dist/atoms/Tooltip.svelte.d.ts +11 -0
- package/dist/atoms/ZabiStringsProvider.svelte +45 -0
- package/dist/atoms/ZabiStringsProvider.svelte.d.ts +27 -0
- package/dist/atoms/index.d.ts +17 -0
- package/dist/atoms/index.js +12 -0
- package/dist/atoms/selection-control.styles.d.ts +36 -5
- package/dist/atoms/selection-control.styles.js +40 -9
- package/dist/components/atoms/index.d.ts +17 -0
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/atoms/selection-control.styles.d.ts +36 -5
- package/dist/components/atoms/selection-control.styles.d.ts.map +1 -1
- package/dist/components/index.d.ts +80 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/molecules/index.d.ts +46 -0
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/molecules/toast-store.d.ts +53 -7
- package/dist/components/molecules/toast-store.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +5 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/components/types/variants.d.ts +15 -1
- package/dist/components/types/variants.d.ts.map +1 -1
- package/dist/components/util/app-shell.d.ts +28 -0
- package/dist/components/util/app-shell.d.ts.map +1 -0
- package/dist/components/util/avatar.d.ts +36 -0
- package/dist/components/util/avatar.d.ts.map +1 -0
- package/dist/components/util/bottom-sheet.d.ts +30 -0
- package/dist/components/util/bottom-sheet.d.ts.map +1 -0
- package/dist/components/util/bottom-tab-bar.d.ts +35 -0
- package/dist/components/util/bottom-tab-bar.d.ts.map +1 -0
- package/dist/components/util/calendar.d.ts +56 -0
- package/dist/components/util/calendar.d.ts.map +1 -0
- package/dist/components/util/collapsible.d.ts +58 -0
- package/dist/components/util/collapsible.d.ts.map +1 -0
- package/dist/components/util/confirm-dialog.d.ts +12 -0
- package/dist/components/util/confirm-dialog.d.ts.map +1 -0
- package/dist/components/util/date.d.ts +96 -0
- package/dist/components/util/date.d.ts.map +1 -0
- package/dist/components/util/drawer.d.ts +13 -0
- package/dist/components/util/drawer.d.ts.map +1 -0
- package/dist/components/util/dropdown.d.ts +47 -0
- package/dist/components/util/dropdown.d.ts.map +1 -0
- package/dist/components/util/field.d.ts +39 -0
- package/dist/components/util/field.d.ts.map +1 -0
- package/dist/components/util/fit-in-viewport.d.ts +201 -0
- package/dist/components/util/fit-in-viewport.d.ts.map +1 -0
- package/dist/components/util/focus-utils.d.ts +75 -2
- package/dist/components/util/focus-utils.d.ts.map +1 -1
- package/dist/components/util/hydration.d.ts +45 -0
- package/dist/components/util/hydration.d.ts.map +1 -0
- package/dist/components/util/keyboard-inset.d.ts +18 -0
- package/dist/components/util/keyboard-inset.d.ts.map +1 -0
- package/dist/components/util/media-grid.d.ts +51 -0
- package/dist/components/util/media-grid.d.ts.map +1 -0
- package/dist/components/util/media.d.ts +6 -0
- package/dist/components/util/media.d.ts.map +1 -0
- package/dist/components/util/overlay-chrome.d.ts +53 -0
- package/dist/components/util/overlay-chrome.d.ts.map +1 -0
- package/dist/components/util/overlay.d.ts +72 -0
- package/dist/components/util/overlay.d.ts.map +1 -0
- package/dist/components/util/photo.d.ts +215 -0
- package/dist/components/util/photo.d.ts.map +1 -0
- package/dist/components/util/portal.d.ts +23 -0
- package/dist/components/util/portal.d.ts.map +1 -0
- package/dist/components/util/pull-to-refresh.d.ts +27 -0
- package/dist/components/util/pull-to-refresh.d.ts.map +1 -0
- package/dist/components/util/radio-keys.d.ts +25 -0
- package/dist/components/util/radio-keys.d.ts.map +1 -0
- package/dist/components/util/rating.d.ts +23 -0
- package/dist/components/util/rating.d.ts.map +1 -0
- package/dist/components/util/ready-made-strings.d.ts +77 -0
- package/dist/components/util/ready-made-strings.d.ts.map +1 -0
- package/dist/components/util/scroll-padding.d.ts +20 -0
- package/dist/components/util/scroll-padding.d.ts.map +1 -0
- package/dist/components/util/segmented-control.d.ts +16 -0
- package/dist/components/util/segmented-control.d.ts.map +1 -0
- package/dist/components/util/select.d.ts +41 -0
- package/dist/components/util/select.d.ts.map +1 -0
- package/dist/components/util/sheet-drag.d.ts +60 -0
- package/dist/components/util/sheet-drag.d.ts.map +1 -0
- package/dist/components/util/sidebar.d.ts +63 -0
- package/dist/components/util/sidebar.d.ts.map +1 -0
- package/dist/components/util/sortable-list.d.ts +65 -0
- package/dist/components/util/sortable-list.d.ts.map +1 -0
- package/dist/components/util/stepper.d.ts +40 -0
- package/dist/components/util/stepper.d.ts.map +1 -0
- package/dist/components/util/swipeable-list-item.d.ts +36 -0
- package/dist/components/util/swipeable-list-item.d.ts.map +1 -0
- package/dist/components/util/theme-mode.d.ts +80 -0
- package/dist/components/util/theme-mode.d.ts.map +1 -0
- package/dist/components/util/toaster.d.ts +93 -0
- package/dist/components/util/toaster.d.ts.map +1 -0
- package/dist/components/util/tooltip.d.ts +10 -0
- package/dist/components/util/tooltip.d.ts.map +1 -0
- package/dist/components/util/top-navbar.d.ts +11 -0
- package/dist/components/util/top-navbar.d.ts.map +1 -0
- package/dist/components/util/touch-target.d.ts +31 -0
- package/dist/components/util/touch-target.d.ts.map +1 -0
- package/dist/components/util/zabi-strings.d.ts +133 -0
- package/dist/components/util/zabi-strings.d.ts.map +1 -0
- package/dist/create-theme/cli.js +169 -0
- package/dist/create-theme/index.d.ts +176 -0
- package/dist/create-theme/index.js +817 -0
- package/dist/create-theme/lib/ramp-math.js +128 -0
- package/dist/create-theme/lib/resolve.js +141 -0
- package/dist/create-theme/theme-data.js +1116 -0
- package/dist/index.d.ts +80 -2
- package/dist/index.js +57 -2
- package/dist/molecules/Alert.svelte +33 -5
- package/dist/molecules/Alert.svelte.d.ts +2 -0
- package/dist/molecules/AppBar.svelte +415 -0
- package/dist/molecules/AppBar.svelte.d.ts +69 -0
- package/dist/molecules/AvatarGroup.svelte +116 -0
- package/dist/molecules/AvatarGroup.svelte.d.ts +40 -0
- package/dist/molecules/BottomSheet.svelte +540 -0
- package/dist/molecules/BottomSheet.svelte.d.ts +93 -0
- package/dist/molecules/BottomTabBar.svelte +297 -0
- package/dist/molecules/BottomTabBar.svelte.d.ts +64 -0
- package/dist/molecules/Calendar.svelte +597 -0
- package/dist/molecules/Calendar.svelte.d.ts +72 -0
- package/dist/molecules/Collapsible.svelte +243 -0
- package/dist/molecules/Collapsible.svelte.d.ts +44 -0
- package/dist/molecules/CollapsibleGroup.svelte +126 -0
- package/dist/molecules/CollapsibleGroup.svelte.d.ts +14 -0
- package/dist/molecules/ComponentDemo.svelte +16 -4
- package/dist/molecules/ComponentDemo.svelte.d.ts +3 -0
- package/dist/molecules/ConfirmDialog.svelte +253 -0
- package/dist/molecules/ConfirmDialog.svelte.d.ts +55 -0
- package/dist/molecules/ContactForm.svelte +34 -17
- package/dist/molecules/ContactForm.svelte.d.ts +8 -0
- package/dist/molecules/Drawer.svelte +394 -0
- package/dist/molecules/Drawer.svelte.d.ts +55 -0
- package/dist/molecules/Dropdown.svelte +509 -48
- package/dist/molecules/Dropdown.svelte.d.ts +45 -6
- package/dist/molecules/DropdownItem.svelte +122 -0
- package/dist/molecules/DropdownItem.svelte.d.ts +28 -0
- package/dist/molecules/EmptyState.svelte +55 -10
- package/dist/molecules/EmptyState.svelte.d.ts +8 -0
- package/dist/molecules/FormField.svelte +9 -1
- package/dist/molecules/FormField.svelte.d.ts +2 -0
- package/dist/molecules/Header.svelte +1 -1
- package/dist/molecules/ImageUpload.svelte +383 -70
- package/dist/molecules/ImageUpload.svelte.d.ts +47 -2
- package/dist/molecules/MediaGrid.svelte +527 -0
- package/dist/molecules/MediaGrid.svelte.d.ts +77 -0
- package/dist/molecules/Modal.svelte +288 -72
- package/dist/molecules/Modal.svelte.d.ts +51 -2
- package/dist/molecules/NavigationMenuContent.svelte +58 -1
- package/dist/molecules/NavigationMenuItem.svelte +0 -1
- package/dist/molecules/NavigationMenuLink.svelte +1 -1
- package/dist/molecules/NavigationMenuList.svelte +10 -3
- package/dist/molecules/NavigationMenuTrigger.svelte +2 -2
- package/dist/molecules/Page.svelte +32 -2
- package/dist/molecules/Page.svelte.d.ts +11 -0
- package/dist/molecules/PhotoGrid.svelte +433 -0
- package/dist/molecules/PhotoGrid.svelte.d.ts +62 -0
- package/dist/molecules/PhotoViewer.svelte +1116 -0
- package/dist/molecules/PhotoViewer.svelte.d.ts +56 -0
- package/dist/molecules/PropsTable.svelte +22 -10
- package/dist/molecules/PropsTable.svelte.d.ts +3 -0
- package/dist/molecules/PullToRefresh.svelte +263 -0
- package/dist/molecules/PullToRefresh.svelte.d.ts +52 -0
- package/dist/molecules/RadioGroup.svelte +52 -14
- package/dist/molecules/RadioGroup.svelte.d.ts +14 -3
- package/dist/molecules/Section.svelte +1 -1
- package/dist/molecules/SegmentedControl.svelte +323 -0
- package/dist/molecules/SegmentedControl.svelte.d.ts +34 -0
- package/dist/molecules/SidebarBrandHeader.svelte +11 -1
- package/dist/molecules/SidebarBrandHeader.svelte.d.ts +3 -0
- package/dist/molecules/SidebarFooter.svelte +29 -6
- package/dist/molecules/SidebarFooter.svelte.d.ts +3 -0
- package/dist/molecules/SlideUp.svelte +220 -61
- package/dist/molecules/SlideUp.svelte.d.ts +26 -0
- package/dist/molecules/SortableList.svelte +632 -0
- package/dist/molecules/SortableList.svelte.d.ts +69 -0
- package/dist/molecules/Stepper.svelte +548 -0
- package/dist/molecules/Stepper.svelte.d.ts +39 -0
- package/dist/molecules/StickyActionBar.svelte +191 -0
- package/dist/molecules/StickyActionBar.svelte.d.ts +65 -0
- package/dist/molecules/SwipeableListItem.svelte +334 -0
- package/dist/molecules/SwipeableListItem.svelte.d.ts +54 -0
- package/dist/molecules/Tabs.svelte +233 -9
- package/dist/molecules/Tabs.svelte.d.ts +7 -0
- package/dist/molecules/Toaster.svelte +350 -5
- package/dist/molecules/Toaster.svelte.d.ts +95 -2
- package/dist/molecules/ToasterToast.svelte +253 -67
- package/dist/molecules/ToasterToast.svelte.d.ts +9 -0
- package/dist/molecules/UnsavedChangesBar.svelte +212 -0
- package/dist/molecules/UnsavedChangesBar.svelte.d.ts +43 -0
- package/dist/molecules/index.d.ts +46 -0
- package/dist/molecules/index.js +27 -0
- package/dist/molecules/toast-store.d.ts +53 -7
- package/dist/molecules/toast-store.js +21 -0
- package/dist/organisms/AppShell.svelte +196 -0
- package/dist/organisms/AppShell.svelte.d.ts +61 -0
- package/dist/organisms/SidebarAccountPanel.svelte +107 -12
- package/dist/organisms/SidebarAccountPanel.svelte.d.ts +19 -0
- package/dist/organisms/SidebarNavigation.svelte +96 -15
- package/dist/organisms/SidebarNavigation.svelte.d.ts +29 -1
- package/dist/organisms/SidebarPanel.svelte +31 -10
- package/dist/organisms/SidebarShell.svelte +162 -11
- package/dist/organisms/SidebarShell.svelte.d.ts +56 -2
- package/dist/organisms/TopNavbar.svelte +256 -31
- package/dist/organisms/TopNavbar.svelte.d.ts +26 -0
- package/dist/organisms/index.d.ts +5 -0
- package/dist/organisms/index.js +3 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/types/components.d.ts.map +1 -1
- package/dist/types/index.d.ts +605 -25
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/variants.ts +17 -1
- package/dist/util/app-shell.d.ts +27 -0
- package/dist/util/app-shell.js +72 -0
- package/dist/util/avatar.d.ts +35 -0
- package/dist/util/avatar.js +52 -0
- package/dist/util/bottom-sheet.d.ts +29 -0
- package/dist/util/bottom-sheet.js +43 -0
- package/dist/util/bottom-tab-bar.d.ts +34 -0
- package/dist/util/bottom-tab-bar.js +54 -0
- package/dist/util/calendar.d.ts +55 -0
- package/dist/util/calendar.js +74 -0
- package/dist/util/collapsible.d.ts +57 -0
- package/dist/util/collapsible.js +23 -0
- package/dist/util/confirm-dialog.d.ts +11 -0
- package/dist/util/confirm-dialog.js +2 -0
- package/dist/util/date.d.ts +95 -0
- package/dist/util/date.js +237 -0
- package/dist/util/drawer.d.ts +12 -0
- package/dist/util/drawer.js +7 -0
- package/dist/util/dropdown.d.ts +46 -0
- package/dist/util/dropdown.js +21 -0
- package/dist/util/field.d.ts +38 -0
- package/dist/util/field.js +38 -0
- package/dist/util/fit-in-viewport.d.ts +200 -0
- package/dist/util/fit-in-viewport.js +399 -0
- package/dist/util/focus-utils.d.ts +75 -2
- package/dist/util/focus-utils.js +182 -9
- package/dist/util/hydration.d.ts +44 -0
- package/dist/util/hydration.js +58 -0
- package/dist/util/keyboard-inset.d.ts +17 -0
- package/dist/util/keyboard-inset.js +53 -0
- package/dist/util/media-grid.d.ts +50 -0
- package/dist/util/media-grid.js +81 -0
- package/dist/util/media.d.ts +5 -0
- package/dist/util/media.js +10 -0
- package/dist/util/overlay-chrome.d.ts +52 -0
- package/dist/util/overlay-chrome.js +56 -0
- package/dist/util/overlay.d.ts +71 -0
- package/dist/util/overlay.js +240 -0
- package/dist/util/photo.d.ts +214 -0
- package/dist/util/photo.js +206 -0
- package/dist/util/portal.d.ts +22 -0
- package/dist/util/portal.js +50 -0
- package/dist/util/pull-to-refresh.d.ts +26 -0
- package/dist/util/pull-to-refresh.js +30 -0
- package/dist/util/radio-keys.d.ts +24 -0
- package/dist/util/radio-keys.js +49 -0
- package/dist/util/rating.d.ts +22 -0
- package/dist/util/rating.js +26 -0
- package/dist/util/ready-made-strings.d.ts +76 -0
- package/dist/util/ready-made-strings.js +67 -0
- package/dist/util/scroll-padding.d.ts +19 -0
- package/dist/util/scroll-padding.js +44 -0
- package/dist/util/segmented-control.d.ts +15 -0
- package/dist/util/segmented-control.js +1 -0
- package/dist/util/select.d.ts +40 -0
- package/dist/util/select.js +63 -0
- package/dist/util/sheet-drag.d.ts +59 -0
- package/dist/util/sheet-drag.js +241 -0
- package/dist/util/sidebar.d.ts +62 -0
- package/dist/util/sidebar.js +38 -0
- package/dist/util/sortable-list.d.ts +64 -0
- package/dist/util/sortable-list.js +53 -0
- package/dist/util/stepper.d.ts +39 -0
- package/dist/util/stepper.js +38 -0
- package/dist/util/swipeable-list-item.d.ts +35 -0
- package/dist/util/swipeable-list-item.js +32 -0
- package/dist/util/theme-mode.d.ts +79 -0
- package/dist/util/theme-mode.js +121 -0
- package/dist/util/toaster.d.ts +92 -0
- package/dist/util/toaster.js +75 -0
- package/dist/util/tooltip.d.ts +9 -0
- package/dist/util/tooltip.js +18 -0
- package/dist/util/top-navbar.d.ts +10 -0
- package/dist/util/top-navbar.js +5 -0
- package/dist/util/touch-target.d.ts +30 -0
- package/dist/util/touch-target.js +30 -0
- package/dist/util/zabi-strings.d.ts +132 -0
- package/dist/util/zabi-strings.js +105 -0
- package/dist/zabi-components-colors.css +5 -2
- package/dist/zabi-components-theme-dark-only.css +543 -241
- package/dist/zabi-components-theme-dark.css +543 -241
- package/dist/zabi-components-theme-only.css +1584 -367
- package/dist/zabi-components-theme.css +1584 -367
- package/dist/zabi-components.css +3885 -518
- package/docs/lucide-icons.md +40 -17
- package/docs/theme-imports.md +81 -11
- package/package.json +35 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/util/dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE5E,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpD,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,wDAAwD;IACxD,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,gDAAgD,CAAC;AAE/E;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAQxE;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,CAAC;CAC5C;AAED,eAAO,MAAM,oBAAoB,eAAqB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Input, Textarea and Select share about the text under a field, and
|
|
3
|
+
* DateField and TimeField through Input. Kept in one place so the four cannot
|
|
4
|
+
* drift: which message shows, in which variant, and what the control is
|
|
5
|
+
* described by.
|
|
6
|
+
*/
|
|
7
|
+
import type { SemanticVariant } from "../types/variants.js";
|
|
8
|
+
export interface FieldMessageInput {
|
|
9
|
+
variant?: SemanticVariant;
|
|
10
|
+
message?: string;
|
|
11
|
+
hint?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FieldMessageState {
|
|
15
|
+
/** The variant the control is drawn in: `error` whenever there is an error. */
|
|
16
|
+
variant: SemanticVariant;
|
|
17
|
+
/** The text of the status message: the error, or else `message`. */
|
|
18
|
+
message: string;
|
|
19
|
+
/** Whether the status message is rendered. A `message` without a variant is not. */
|
|
20
|
+
showMessage: boolean;
|
|
21
|
+
/** Whether the hint is rendered. */
|
|
22
|
+
showHint: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* `error` wins over `variant` and `message`: it sets the error variant and is
|
|
26
|
+
* the message. Without it, `message` shows in a `success`, `warning` or
|
|
27
|
+
* `error` variant, as it always has, and not in `default`: text for a field
|
|
28
|
+
* that is neither is a `hint`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function fieldMessageState({ variant, message, hint, error, }: FieldMessageInput): FieldMessageState;
|
|
31
|
+
export declare const fieldHintId: (fieldId: string) => string;
|
|
32
|
+
export declare const fieldMessageId: (fieldId: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* The ids a control is described by: the caller's own (a FormField around the
|
|
35
|
+
* field, say), then the hint, then the status message. Only ids of elements
|
|
36
|
+
* that are rendered; `undefined` when there are none, so no empty attribute.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fieldDescribedBy(fieldId: string, state: Pick<FieldMessageState, "showMessage" | "showHint">, own?: string | null): string | undefined;
|
|
39
|
+
//# sourceMappingURL=field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/components/util/field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAC9B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAC9B,+EAA+E;IAC/E,OAAO,EAAE,eAAe,CAAC;IACzB,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,WAAW,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,OAAmB,EACnB,OAAY,EACZ,IAAS,EACT,KAAU,GACb,EAAE,iBAAiB,GAAG,iBAAiB,CASvC;AAED,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,WAAsB,CAAC;AAClE,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,WAAyB,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,UAAU,CAAC,EAC1D,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,MAAM,GAAG,SAAS,CAUpB"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a floating box (a menu, a panel, a tooltip) where it can be seen.
|
|
3
|
+
*
|
|
4
|
+
* One module for everything that opens next to a trigger. Two layers:
|
|
5
|
+
*
|
|
6
|
+
* - `pickSide` and `shiftIntoViewport` are the two decisions every such box
|
|
7
|
+
* needs: which side of its trigger it opens on, and how far it has to move
|
|
8
|
+
* along that side to stay on screen. Tooltip uses them as they are.
|
|
9
|
+
* - `fitPanel` builds on them for a panel that hangs from one edge of its
|
|
10
|
+
* anchor (Dropdown, Select's list, NavigationMenuContent): it also narrows
|
|
11
|
+
* and shortens a panel too large for the screen. `measurePlacement` reads
|
|
12
|
+
* the layout for it, and `watchViewport` re-runs it while the panel is open.
|
|
13
|
+
*
|
|
14
|
+
* The arithmetic is pure, so it can be tested without a layout.
|
|
15
|
+
*
|
|
16
|
+
* The screen is not the only thing that cuts a panel off. Inside a box that
|
|
17
|
+
* scrolls (a Modal's body, a list with its own scrollbar) the box clips it
|
|
18
|
+
* first. `measurePlacement` takes the nearest such box into account: it
|
|
19
|
+
* decides which side the panel opens on, and when the panel fits on neither
|
|
20
|
+
* side it says where to put the panel with `position: fixed`, which a
|
|
21
|
+
* scrolling ancestor does not clip.
|
|
22
|
+
*/
|
|
23
|
+
export type PanelBlock = "bottom" | "top";
|
|
24
|
+
export type PanelInline = "start" | "end";
|
|
25
|
+
export interface PanelBox {
|
|
26
|
+
left: number;
|
|
27
|
+
right: number;
|
|
28
|
+
top: number;
|
|
29
|
+
bottom: number;
|
|
30
|
+
}
|
|
31
|
+
export interface FitPanelInput {
|
|
32
|
+
/** The box the panel is positioned against, in viewport coordinates. */
|
|
33
|
+
anchor: PanelBox;
|
|
34
|
+
/** The panel's natural size, measured with no limit on it. */
|
|
35
|
+
panel: {
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
};
|
|
39
|
+
viewport: {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
};
|
|
43
|
+
/** The side asked for. It is kept whenever the panel fits there. */
|
|
44
|
+
block: PanelBlock;
|
|
45
|
+
inline: PanelInline;
|
|
46
|
+
/** Right-to-left layout: `start` is then the right edge. */
|
|
47
|
+
rtl?: boolean;
|
|
48
|
+
/** Room kept between the panel and every edge of the viewport. */
|
|
49
|
+
margin?: number;
|
|
50
|
+
/** Distance between the anchor and the panel. */
|
|
51
|
+
gap?: number;
|
|
52
|
+
/** False keeps the panel on the `block` side asked for, whatever fits. */
|
|
53
|
+
flipBlock?: boolean;
|
|
54
|
+
/** False keeps it on the `inline` edge asked for and slides it back inside instead. */
|
|
55
|
+
flipInline?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The inside of the nearest ancestor that clips, in viewport coordinates.
|
|
58
|
+
* It decides which side the panel opens on and how far it slides; it
|
|
59
|
+
* never limits the panel's size, which only the viewport does.
|
|
60
|
+
*/
|
|
61
|
+
clip?: PanelBox | null;
|
|
62
|
+
}
|
|
63
|
+
export interface PanelFit {
|
|
64
|
+
block: PanelBlock;
|
|
65
|
+
inline: PanelInline;
|
|
66
|
+
/**
|
|
67
|
+
* Distance to put between the anchor's `inline` edge and the panel's, for
|
|
68
|
+
* `inset-inline-start` or `inset-inline-end`. 0 when the panel fits as it
|
|
69
|
+
* is; otherwise what slides it back inside.
|
|
70
|
+
*/
|
|
71
|
+
inlineOffset: number;
|
|
72
|
+
/** A limit to set, or null when the panel fits without one. */
|
|
73
|
+
maxWidth: number | null;
|
|
74
|
+
maxHeight: number | null;
|
|
75
|
+
/** Where the panel's box ends up, in viewport coordinates, and how wide it is there. */
|
|
76
|
+
left: number;
|
|
77
|
+
top: number;
|
|
78
|
+
width: number;
|
|
79
|
+
/** False when part of the panel is outside `clip` (or the viewport) even so. */
|
|
80
|
+
visible: boolean;
|
|
81
|
+
}
|
|
82
|
+
export type FloatingSide = "top" | "bottom" | "left" | "right";
|
|
83
|
+
/**
|
|
84
|
+
* The side a floating box of `size` opens on: the preferred one when it fits
|
|
85
|
+
* there, the opposite one when only that fits, and otherwise whichever of the
|
|
86
|
+
* two has more room.
|
|
87
|
+
*
|
|
88
|
+
* `gap` is the distance between trigger and box; `margin` is how close to the
|
|
89
|
+
* viewport edge the box may come. `clip` is the inside of an ancestor that
|
|
90
|
+
* cuts the box off, when there is one: the box then has to fit in what both
|
|
91
|
+
* leave.
|
|
92
|
+
*/
|
|
93
|
+
export declare function pickSide(preferred: FloatingSide, trigger: PanelBox, size: {
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
}, viewport: {
|
|
97
|
+
width: number;
|
|
98
|
+
height: number;
|
|
99
|
+
}, { gap, margin, clip, }?: {
|
|
100
|
+
gap?: number;
|
|
101
|
+
margin?: number;
|
|
102
|
+
clip?: PanelBox | null;
|
|
103
|
+
}): FloatingSide;
|
|
104
|
+
/**
|
|
105
|
+
* How far `box` has to move, in px, to lie inside the viewport with `margin`
|
|
106
|
+
* to spare. Zero on an axis where it already does. A box larger than the
|
|
107
|
+
* viewport is aligned to the start edge (top, left), where its text begins.
|
|
108
|
+
*/
|
|
109
|
+
export declare function shiftIntoViewport(box: PanelBox, viewport: {
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
112
|
+
}, margin?: number): {
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
};
|
|
116
|
+
export interface ViewportPoint {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* True when `point` lies in the triangle `a`, `b`, `c`, edges included. For
|
|
122
|
+
* the path a pointer takes from a trigger to its floating box: as long as it
|
|
123
|
+
* stays in the triangle between where it left and the near edge of the box,
|
|
124
|
+
* it is on its way there.
|
|
125
|
+
*/
|
|
126
|
+
export declare function insideTriangle(point: ViewportPoint, a: ViewportPoint, b: ViewportPoint, c: ViewportPoint): boolean;
|
|
127
|
+
/** Where the panel fits, starting from the side asked for. */
|
|
128
|
+
export declare function fitPanel(input: FitPanelInput): PanelFit;
|
|
129
|
+
/** A fit that changes nothing: the panel where the CSS puts it, with no limits. */
|
|
130
|
+
export declare function unfitted(block: PanelBlock, inline: PanelInline): PanelFit;
|
|
131
|
+
export interface MeasureOptions {
|
|
132
|
+
margin?: number;
|
|
133
|
+
gap?: number;
|
|
134
|
+
flipBlock?: boolean;
|
|
135
|
+
flipInline?: boolean;
|
|
136
|
+
/** Overrides the anchor's own direction; `false` for a panel placed with `left`, not `inset-inline-start`. */
|
|
137
|
+
rtl?: boolean;
|
|
138
|
+
clip?: PanelBox | null;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Measures `panel` against `anchor` and returns its fit. Any limit already on
|
|
142
|
+
* the panel is lifted for the measurement, so the answer does not depend on
|
|
143
|
+
* the previous one. Call it before paint (from an effect) and apply the result.
|
|
144
|
+
*/
|
|
145
|
+
export declare function measureFit(anchor: Element, panel: HTMLElement, preferred: {
|
|
146
|
+
block: PanelBlock;
|
|
147
|
+
inline: PanelInline;
|
|
148
|
+
}, options?: MeasureOptions): PanelFit;
|
|
149
|
+
/**
|
|
150
|
+
* The nearest ancestor of `element` that clips what reaches outside it (any
|
|
151
|
+
* `overflow` but `visible`), with the box it clips to: its inside, without
|
|
152
|
+
* borders or scrollbars, in viewport coordinates. Null when only the viewport
|
|
153
|
+
* clips.
|
|
154
|
+
*/
|
|
155
|
+
export declare function clippingAncestor(element: Element): {
|
|
156
|
+
element: HTMLElement;
|
|
157
|
+
box: PanelBox;
|
|
158
|
+
} | null;
|
|
159
|
+
export interface PanelPlacement extends PanelFit {
|
|
160
|
+
/**
|
|
161
|
+
* Set when the panel has to leave a clipping ancestor to be seen: the
|
|
162
|
+
* `top`, `left` and `width` to give it with `position: fixed`. Null when
|
|
163
|
+
* it stays where the CSS puts it.
|
|
164
|
+
*
|
|
165
|
+
* The width is the one the panel has where the CSS puts it. A fixed box
|
|
166
|
+
* is sized against the viewport instead of the anchor, so without it the
|
|
167
|
+
* panel would change width as it leaves the box.
|
|
168
|
+
*/
|
|
169
|
+
fixed: {
|
|
170
|
+
left: number;
|
|
171
|
+
top: number;
|
|
172
|
+
width: number;
|
|
173
|
+
} | null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The fit of `panel`, with the nearest clipping ancestor of `anchor` taken
|
|
177
|
+
* into account.
|
|
178
|
+
*
|
|
179
|
+
* - The panel fits inside that ancestor on the side asked for: nothing changes.
|
|
180
|
+
* - It fits on the other side: it opens there.
|
|
181
|
+
* - It fits on neither: it is placed against the viewport with `fixed`, on the
|
|
182
|
+
* side the viewport has room for, and reaches out of the ancestor. Only
|
|
183
|
+
* while some of the anchor can be seen in the ancestor: scrolled out of it,
|
|
184
|
+
* the anchor takes the panel with it.
|
|
185
|
+
* - It cannot be: something between the panel and that ancestor is the
|
|
186
|
+
* containing block of fixed descendants (a `transform`, a `filter`). It then
|
|
187
|
+
* opens on the side of the ancestor with more room, and is cut where that
|
|
188
|
+
* ends. That is the limit of what a panel can do without leaving its place
|
|
189
|
+
* in the DOM, and it stays there so that the keyboard, focus and a dialog's
|
|
190
|
+
* focus trap treat it as part of what opened it.
|
|
191
|
+
*/
|
|
192
|
+
export declare function measurePlacement(anchor: Element, panel: HTMLElement, preferred: {
|
|
193
|
+
block: PanelBlock;
|
|
194
|
+
inline: PanelInline;
|
|
195
|
+
}, options?: MeasureOptions): PanelPlacement;
|
|
196
|
+
/**
|
|
197
|
+
* Calls `update` when the viewport changes size or anything outside `panel`
|
|
198
|
+
* scrolls, at most once a frame. Returns the function that stops it.
|
|
199
|
+
*/
|
|
200
|
+
export declare function watchViewport(update: () => void, panel?: Element | null): () => void;
|
|
201
|
+
//# sourceMappingURL=fit-in-viewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit-in-viewport.d.ts","sourceRoot":"","sources":["../../../src/components/util/fit-in-viewport.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,11 +2,84 @@
|
|
|
2
2
|
/** From `app.css` `@layer components` — import the library/app stylesheet. */
|
|
3
3
|
export declare const FOCUS_BRAND_CLASS = "focus-brand";
|
|
4
4
|
export declare const FOCUS_NAV_CLASS = "focus-nav";
|
|
5
|
+
/** Every dialog panel: `dialog` and `alertdialog` are both dialogs to a focus trap. */
|
|
6
|
+
export declare const DIALOG_SELECTOR = "[role=\"dialog\"], [role=\"alertdialog\"]";
|
|
5
7
|
export declare function getFocusableElements(container: HTMLElement): HTMLElement[];
|
|
8
|
+
/** The region a `Toaster` renders its toasts in. */
|
|
9
|
+
export declare const TOAST_REGION_SELECTOR = "[data-zabi-toaster]";
|
|
10
|
+
/**
|
|
11
|
+
* Whether an event's target is in a toast. A toast is drawn over whatever is
|
|
12
|
+
* open, and a press on it is for the toast (to hold it, read it, dismiss it):
|
|
13
|
+
* a menu or a panel that closes on a press outside itself asks this first,
|
|
14
|
+
* and leaves a press on a toast alone.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isInsideToastRegion(target: unknown): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The controls of the toasts on screen. A toast is drawn over a modal
|
|
19
|
+
* overlay and can cover its buttons, so a focus trap that kept the keyboard
|
|
20
|
+
* out of it would leave no way to dismiss it: the trap takes these in, after
|
|
21
|
+
* the overlay's own controls.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getToastFocusables(): HTMLElement[];
|
|
24
|
+
/**
|
|
25
|
+
* One step of the Tab cycle of a modal overlay: through the controls of
|
|
26
|
+
* `container`, then through the toasts on screen, and round again. Focusables
|
|
27
|
+
* are looked up on every Tab, so what is added while the overlay is open is
|
|
28
|
+
* in the cycle. Focus that is nowhere in it goes to the first control.
|
|
29
|
+
*/
|
|
30
|
+
export declare function cycleTrappedFocus(container: HTMLElement, event: KeyboardEvent): void;
|
|
6
31
|
/** Tab wraps first↔last inside `container`. Caller should pair with `saveFocus` / `returnFocus`. */
|
|
7
32
|
export declare function trapFocus(container: HTMLElement): () => void;
|
|
8
33
|
export declare function saveFocus(): void;
|
|
9
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Restores focus from the last `saveFocus`. If that element has left the
|
|
36
|
+
* document, the element that now has its id takes the focus instead (a
|
|
37
|
+
* dropzone swapped for its Change button, say); with neither, nothing happens.
|
|
38
|
+
*/
|
|
10
39
|
export declare function returnFocus(): void;
|
|
11
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Moves focus into an overlay: to its first focusable element, or to the
|
|
42
|
+
* container itself when it has none (give the container `tabindex="-1"`), so
|
|
43
|
+
* focus never stays on the opener behind the backdrop.
|
|
44
|
+
*
|
|
45
|
+
* `preferred` is a CSS selector, looked up inside the container: the matching
|
|
46
|
+
* control takes focus instead of the first one, if it can take focus.
|
|
47
|
+
*/
|
|
48
|
+
export declare function focusFirstElement(container: HTMLElement, preferred?: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Joins the stack of open modal overlays (Modal, SlideUp, a drawer).
|
|
51
|
+
*
|
|
52
|
+
* Every overlay shares one z-index, so without this the paint order is the
|
|
53
|
+
* DOM order, and an overlay opened later but placed earlier in the document
|
|
54
|
+
* opens behind the first. `depth` is 0 for the first overlay and one more than
|
|
55
|
+
* the highest open one after that: put it on the overlay root as
|
|
56
|
+
* `z-index: calc(var(--z-modal) + depth)`.
|
|
57
|
+
*
|
|
58
|
+
* `panel` is the element with the dialog role. Call this when the overlay
|
|
59
|
+
* opens, in the browser, and `leave()` when it closes.
|
|
60
|
+
*/
|
|
61
|
+
export declare function joinOverlayStack(panel: HTMLElement): {
|
|
62
|
+
depth: number;
|
|
63
|
+
leave: () => void;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Keeps a modal overlay in charge of the keyboard when focus has left it
|
|
67
|
+
* without a Tab: the focused control was disabled or removed and the browser
|
|
68
|
+
* dropped focus on `<body>`, where the overlay's own key handlers never hear
|
|
69
|
+
* the key, and Tab would walk the page behind it.
|
|
70
|
+
*
|
|
71
|
+
* While installed, a Tab pressed with focus outside every dialog moves focus
|
|
72
|
+
* to the first focusable element of `container` (or to `container` itself),
|
|
73
|
+
* and Escape calls `onEscape`. Only the overlay on top of the stack acts (the
|
|
74
|
+
* one opened last), so every open overlay can install its own. An overlay that
|
|
75
|
+
* has not called `joinOverlayStack` is added to the stack for as long as the
|
|
76
|
+
* recovery is installed.
|
|
77
|
+
*
|
|
78
|
+
* `container` is the panel with `role="dialog"` or `"alertdialog"` and
|
|
79
|
+
* `aria-modal="true"`. Call it when the overlay opens, in the browser, and call
|
|
80
|
+
* the returned function when it closes.
|
|
81
|
+
*/
|
|
82
|
+
export declare function recoverStrayFocus(container: HTMLElement, options?: {
|
|
83
|
+
onEscape?: (event: KeyboardEvent) => void;
|
|
84
|
+
}): () => void;
|
|
12
85
|
//# sourceMappingURL=focus-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-utils.d.ts","sourceRoot":"","sources":["../../../src/components/util/focus-utils.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"focus-utils.d.ts","sourceRoot":"","sources":["../../../src/components/util/focus-utils.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C,uFAAuF;AACvF,eAAO,MAAM,eAAe,8CAA0C,CAAC;AAEvE,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,EAAE,CAqB1E;AAED,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAK5D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,EAAE,CAKlD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAiCpF;AAED,oGAAoG;AACpG,wBAAgB,SAAS,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,IAAI,CA2C5D;AASD,wBAAgB,SAAS,IAAI,IAAI,CAUhC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAqBlC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAMlF;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB,CAWA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;CAAO,GAC5D,MAAM,IAAI,CAgCZ"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controls that keep what a visitor chose before the page hydrated.
|
|
3
|
+
*
|
|
4
|
+
* A server-rendered page can be used before its scripts arrive: a checkbox
|
|
5
|
+
* can be ticked, a radio chosen. A component that writes `checked={…}` from
|
|
6
|
+
* its own state and listens for `change` loses that on hydration: Svelte sets
|
|
7
|
+
* `checked` from the state, which still says nothing was chosen.
|
|
8
|
+
*
|
|
9
|
+
* Svelte's own bindings do not. `bind:checked` and `bind:group` know when
|
|
10
|
+
* they run during hydration, compare the input with the markup the server
|
|
11
|
+
* sent (`defaultChecked`), and where they differ hand the input's state to
|
|
12
|
+
* the binding instead of overwriting it. They also put the binding back on a
|
|
13
|
+
* form reset. So the controls bind, and what they bind to is an accessor of
|
|
14
|
+
* their own: the place where a choice is taken in, by whatever road it came.
|
|
15
|
+
*
|
|
16
|
+
* `bind:group` takes only an identifier or a member expression, which is why
|
|
17
|
+
* this is an object with a `value` and not a pair of functions.
|
|
18
|
+
*/
|
|
19
|
+
/** What Svelte hands a group binding when no radio is checked: after a reset, or when hydration finds none. */
|
|
20
|
+
export type NoChoice = null | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The target of a radio's `bind:group={binding.value}`.
|
|
23
|
+
*
|
|
24
|
+
* `read` gives the chosen value; a radio is checked while its own value is
|
|
25
|
+
* that. `choose` is called when a radio was picked: by the user, or before
|
|
26
|
+
* hydration. `restore` is called with nothing chosen: a form is being reset
|
|
27
|
+
* (see `resetValueOf` for what to go back to).
|
|
28
|
+
*/
|
|
29
|
+
export declare function groupBinding<T>(read: () => T | NoChoice, choose: (value: T) => void, restore: () => void): {
|
|
30
|
+
value: T | NoChoice;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The value a group of radios goes back to on a form reset: that of the one
|
|
34
|
+
* whose `checked` attribute is set, in the type the component's options have
|
|
35
|
+
* (Svelte keeps it on the input as `__value`), or `undefined` when none is.
|
|
36
|
+
*
|
|
37
|
+
* It reads the attribute (`defaultChecked`), not `checked`: Svelte calls a
|
|
38
|
+
* binding's reset handler in a microtask after the `reset` event, and when a
|
|
39
|
+
* user pressed the reset button that is before the browser has reset
|
|
40
|
+
* anything. Svelte takes the `checked` attribute off a bound input once it
|
|
41
|
+
* has hydrated, so in practice a reset empties the group, as it does a bound
|
|
42
|
+
* native input.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resetValueOf<T>(inputs: Iterable<HTMLInputElement | undefined>): T | undefined;
|
|
45
|
+
//# sourceMappingURL=hydration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../../../src/components/util/hydration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,+GAA+G;AAC/G,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;AAExC;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC1B,IAAI,EAAE,MAAM,CAAC,GAAG,QAAQ,EACxB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC1B,OAAO,EAAE,MAAM,IAAI;WAGF,CAAC,GAAG,QAAQ;EAQhC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,CAK7F"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How much of the bottom of the page the on-screen keyboard covers.
|
|
3
|
+
*
|
|
4
|
+
* Browsers disagree on what a keyboard does. Some shrink the layout viewport,
|
|
5
|
+
* and everything pinned to the bottom moves up by itself. Others (iOS Safari,
|
|
6
|
+
* and Chrome on Android by default) leave the layout alone and only shrink
|
|
7
|
+
* the *visual* viewport, so a bar pinned to the bottom ends up behind the
|
|
8
|
+
* keyboard. The difference between the two viewports is the part to lift a
|
|
9
|
+
* bar by; where the layout has already shrunk, it is 0.
|
|
10
|
+
*/
|
|
11
|
+
/** The covered height in px, or 0 where it cannot be told (the server, an old browser). */
|
|
12
|
+
export declare function readKeyboardInset(): number;
|
|
13
|
+
/**
|
|
14
|
+
* Calls `onChange` with the inset now, and again whenever it changes. Call it
|
|
15
|
+
* in the browser; the returned function stops it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function watchKeyboardInset(onChange: (inset: number) => void): () => void;
|
|
18
|
+
//# sourceMappingURL=keyboard-inset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard-inset.d.ts","sourceRoot":"","sources":["../../../src/components/util/keyboard-inset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2FAA2F;AAC3F,wBAAgB,iBAAiB,IAAI,MAAM,CAU1C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAoBhF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Types and pure helpers for `MediaGrid`. Kept out of the component so they can be tested without a DOM. */
|
|
2
|
+
export type MediaGridKey = string | number;
|
|
3
|
+
export type MediaGridItemType = "image" | "video";
|
|
4
|
+
/** Payload of `onselect`. */
|
|
5
|
+
export interface MediaGridSelectDetail<T> {
|
|
6
|
+
item: T;
|
|
7
|
+
/** False when the activation cleared the item's selection. */
|
|
8
|
+
selected: boolean;
|
|
9
|
+
/** Every selected key after the change: one or none unless `multiple`. */
|
|
10
|
+
keys: MediaGridKey[];
|
|
11
|
+
}
|
|
12
|
+
/** Every built-in string. Pass a partial object to `strings` to translate. */
|
|
13
|
+
export interface MediaGridStrings {
|
|
14
|
+
/** Accessible name of an item's delete button. */
|
|
15
|
+
deleteLabel: (label: string) => string;
|
|
16
|
+
/** Accessible name of a video item; an image is named by its label alone. */
|
|
17
|
+
videoLabel: (label: string) => string;
|
|
18
|
+
/** Announced, and never shown, while `loading` is set. */
|
|
19
|
+
loading: string;
|
|
20
|
+
emptyTitle: string;
|
|
21
|
+
emptyDescription: string;
|
|
22
|
+
/**
|
|
23
|
+
* How to get around by keyboard. Read once when focus enters the grid,
|
|
24
|
+
* and shown below it while it has keyboard focus. Keep it to one short
|
|
25
|
+
* sentence.
|
|
26
|
+
*/
|
|
27
|
+
keyboardHint: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const MEDIA_GRID_STRINGS: MediaGridStrings;
|
|
30
|
+
export { isVideoUrl } from "./media.js";
|
|
31
|
+
/**
|
|
32
|
+
* Columns in the rendered grid, read from the top edge of each tile in DOM
|
|
33
|
+
* order: the first row ends where the top edge changes. The layout is CSS
|
|
34
|
+
* `auto-fill`, so only the browser knows the answer.
|
|
35
|
+
*/
|
|
36
|
+
export declare function columnCount(tops: readonly number[]): number;
|
|
37
|
+
export type MediaGridMove = "left" | "right" | "up" | "down" | "rowStart" | "rowEnd" | "first" | "last";
|
|
38
|
+
/**
|
|
39
|
+
* Index a navigation key lands on. Nothing wraps. Moving down from the row
|
|
40
|
+
* above a short last row lands on the last item, so the last row can always
|
|
41
|
+
* be reached from any column.
|
|
42
|
+
*/
|
|
43
|
+
export declare function moveIndex(index: number, move: MediaGridMove, columns: number, total: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* The move a key asks for in a grid of tiles, or undefined for a key that is
|
|
46
|
+
* not a navigation key. Left and Right follow what is on screen, which is
|
|
47
|
+
* mirrored in a right-to-left layout; Ctrl with Home or End goes to the first
|
|
48
|
+
* or last tile. Shared by `MediaGrid` and `PhotoGrid`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function moveForKey(event: Pick<KeyboardEvent, "key" | "ctrlKey">, rtl: boolean): MediaGridMove | undefined;
|
|
51
|
+
//# sourceMappingURL=media-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-grid.d.ts","sourceRoot":"","sources":["../../../src/components/util/media-grid.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAE7G,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,OAAO,CAAC;AAElD,6BAA6B;AAC7B,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC;IACR,8DAA8D;IAC9D,QAAQ,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,IAAI,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC7B,kDAAkD;IAClD,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,6EAA6E;IAC7E,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,EAAE,gBAOhC,CAAC;AAGF,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAK3D;AAED,MAAM,MAAM,aAAa,GACnB,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,CAAC;AAEb;;;;GAIG;AACH,wBAAgB,SAAS,CACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACd,MAAM,CAyBR;AASD;;;;;GAKG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,SAAS,CAAC,EAC7C,GAAG,EAAE,OAAO,GACb,aAAa,GAAG,SAAS,CAQ3B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** How the library tells a video from an image by its address. Shared by `ImageUpload` and `MediaGrid`. */
|
|
2
|
+
/** True for a path or file name with a video extension, before any query or hash. */
|
|
3
|
+
export declare function isVideoPath(path: string): boolean;
|
|
4
|
+
/** True for a video data URL, or a URL whose path has a video extension. */
|
|
5
|
+
export declare function isVideoUrl(url: string): boolean;
|
|
6
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/components/util/media.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAI3G,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chrome of an overlay at large text: the header of a BottomSheet, Drawer,
|
|
3
|
+
* Modal or SlideUp, and the padding of its footer.
|
|
4
|
+
*
|
|
5
|
+
* Tailwind's spacing is in rem, so at `html { font-size: 200% }` the gutters,
|
|
6
|
+
* the gap above the title, the title and the close button all doubled. On a
|
|
7
|
+
* phone that left a third of a half-height sheet to what the sheet was opened
|
|
8
|
+
* for. This is navigation chrome, as the app bar is (see AppBar): it says
|
|
9
|
+
* where you are and how to leave, and it is not what the user enlarged the
|
|
10
|
+
* text to read. So it is laid out in px, and its title grows to 1.3 times its
|
|
11
|
+
* size and stops. The content, and whatever the app puts in the footer, scale
|
|
12
|
+
* in full. docs/ACCESSIBILITY.md has the reasoning against WCAG 1.4.4.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* On the header box: the spacing scale in px for everything inside it, so
|
|
16
|
+
* `px-6`, `gap-4`, `size-8` and the 44px of `TOUCH_HIT_AREA` are the sizes
|
|
17
|
+
* they are at 100% text. Only for a box that holds chrome alone: an app's
|
|
18
|
+
* Button inside it would stop growing too, which is why a footer spells its
|
|
19
|
+
* padding out in px instead.
|
|
20
|
+
*/
|
|
21
|
+
export declare const OVERLAY_CHROME = "[--spacing:4px]";
|
|
22
|
+
/**
|
|
23
|
+
* How a title wraps: onto as many lines as it needs, between words, and a
|
|
24
|
+
* word wider than the whole line is cut rather than left sticking out.
|
|
25
|
+
*/
|
|
26
|
+
export declare const OVERLAY_TITLE_WRAP = "[overflow-wrap:break-word]";
|
|
27
|
+
/**
|
|
28
|
+
* On the title while the text is enlarged (`textIsEnlarged`): a word that does
|
|
29
|
+
* not fit at the end of a line is hyphenated by the rules of the page's
|
|
30
|
+
* `lang`, where the browser has them, before it is cut.
|
|
31
|
+
*
|
|
32
|
+
* Not at the default text size, and not narrowed with `hyphenate-limit-chars`:
|
|
33
|
+
* `hyphens: auto` hyphenates at the end of every line, not only where a word
|
|
34
|
+
* is too wide, and what a browser offers as a hyphenation point is the
|
|
35
|
+
* platform's ("sett-ings", "histor-y" in Chromium on macOS). A title that
|
|
36
|
+
* wraps between words today would get those. A limit, where it is supported
|
|
37
|
+
* at all (not in Safari), turns a hyphenated break of a shorter word into a
|
|
38
|
+
* plain cut.
|
|
39
|
+
*/
|
|
40
|
+
export declare const OVERLAY_TITLE_HYPHENS = "hyphens-auto";
|
|
41
|
+
/**
|
|
42
|
+
* Whether the reader has enlarged the text: the root font size is above the
|
|
43
|
+
* 16px every browser starts from. Read when an overlay opens. False on the
|
|
44
|
+
* server and until then, which is the layout at the default size.
|
|
45
|
+
*/
|
|
46
|
+
export declare function textIsEnlarged(): boolean;
|
|
47
|
+
/** A title of 20px (`text-xl`): up to 26px, on the same 1.4 line. */
|
|
48
|
+
export declare const OVERLAY_TITLE_XL = "text-[length:min(1.25rem,26px)] leading-[1.4]";
|
|
49
|
+
/** A title of 24px (`text-2xl`): up to 31.2px, on the same 4/3 line. */
|
|
50
|
+
export declare const OVERLAY_TITLE_2XL = "text-[length:min(1.5rem,31.2px)] leading-[calc(4/3)]";
|
|
51
|
+
/** The "×" of a close button: a control, so the size it is at 100%. */
|
|
52
|
+
export declare const OVERLAY_CLOSE_GLYPH = "text-[24px] leading-[32px]";
|
|
53
|
+
//# sourceMappingURL=overlay-chrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-chrome.d.ts","sourceRoot":"","sources":["../../../src/components/util/overlay-chrome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,+BAA+B,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAGxC;AAED,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,kDAAkD,CAAC;AAEhF,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,yDAAyD,CAAC;AAExF,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Modal, SlideUp and Drawer share beyond `focus-utils.ts`: the scroll
|
|
3
|
+
* lock on `<body>` and the Tab cycle inside the panel. One copy, so the
|
|
4
|
+
* overlays cannot drift apart and keep working when nested in any order.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Stops the page behind an overlay from scrolling. Ref-counted on `<body>`
|
|
8
|
+
* (`data-zabi-scroll-lock`), so nested overlays share one lock and the page
|
|
9
|
+
* scrolls again only when the last one has released it.
|
|
10
|
+
*
|
|
11
|
+
* Call it when the overlay opens, in the browser, and call the returned
|
|
12
|
+
* function when it closes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function lockBodyScroll(): () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Keeps Tab inside `container`: call it from the panel's `keydown` handler.
|
|
17
|
+
* Focusables are re-queried on every Tab, so content added while the overlay
|
|
18
|
+
* is open stays inside the cycle. A Tab that comes from a dialog nested in the
|
|
19
|
+
* container is left to that dialog. The toasts on screen are in the cycle too,
|
|
20
|
+
* after the container's own controls: see `getToastFocusables`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function trapTabKey(container: HTMLElement | undefined, event: KeyboardEvent): void;
|
|
23
|
+
/**
|
|
24
|
+
* Watches a scrolling box in an overlay and reports whether it has to be a
|
|
25
|
+
* Tab stop itself: true when its content is taller than it and holds nothing
|
|
26
|
+
* that can take focus, so the keyboard would otherwise have no way to scroll
|
|
27
|
+
* it. The answer changes with the viewport and with the content, so it is
|
|
28
|
+
* reported again whenever either does.
|
|
29
|
+
*
|
|
30
|
+
* Call it when the overlay opens, in the browser; the returned function stops it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function watchScrollerNeedsFocus(box: HTMLElement, onChange: (needsFocus: boolean) => void): () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Keeps an overlay on the part of the screen the on-screen keyboard leaves.
|
|
35
|
+
*
|
|
36
|
+
* Where the keyboard covers the page instead of shrinking it (iOS Safari,
|
|
37
|
+
* Chrome on Android), a panel at the bottom of a `fixed inset-0` root ends up
|
|
38
|
+
* behind it, footer and all. This moves the root's bottom edge up to the top
|
|
39
|
+
* of the keyboard (and its top edge down, if the browser has panned the
|
|
40
|
+
* screen), so everything laid out against the root follows: a sheet's height,
|
|
41
|
+
* a pinned footer, a drawer's end. `data-keyboard-open` is set on the root
|
|
42
|
+
* meanwhile. The field that has focus is scrolled back into view once the
|
|
43
|
+
* root has its new size. Where the page shrinks by itself, nothing is done.
|
|
44
|
+
*
|
|
45
|
+
* The root is usually the backdrop as well: while it is moved, its dimming is
|
|
46
|
+
* carried on past its edges, so the page does not show undimmed where the
|
|
47
|
+
* keyboard was while that slides away.
|
|
48
|
+
*
|
|
49
|
+
* `root` is the overlay's outermost, fixed element. Call it when the overlay
|
|
50
|
+
* opens, in the browser; the returned function stops it and puts the root back.
|
|
51
|
+
*/
|
|
52
|
+
export declare function followKeyboard(root: HTMLElement): () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Says that `footer` is pinned to the bottom of an open overlay, so what is
|
|
55
|
+
* drawn over the overlays (the toast stack) can stay off it. Call it when the
|
|
56
|
+
* footer is rendered, in the browser; the returned function withdraws it.
|
|
57
|
+
*/
|
|
58
|
+
export declare function registerOverlayFooter(footer: HTMLElement): () => void;
|
|
59
|
+
/**
|
|
60
|
+
* Says that `header` is the top of an open overlay and holds its close
|
|
61
|
+
* button, so the toast stack starts below it and never lies over the one
|
|
62
|
+
* control that always closes the overlay. Call it when the header is
|
|
63
|
+
* rendered, in the browser; the returned function withdraws it.
|
|
64
|
+
*/
|
|
65
|
+
export declare function registerOverlayHeader(header: HTMLElement): () => void;
|
|
66
|
+
/** The footer of the overlay on top, if it has one. */
|
|
67
|
+
export declare function topOverlayFooter(): HTMLElement | null;
|
|
68
|
+
/** The header of the overlay on top, if it has one. */
|
|
69
|
+
export declare function topOverlayHeader(): HTMLElement | null;
|
|
70
|
+
/** Calls `listener` whenever a registered header or footer appears, goes, moves or changes size. */
|
|
71
|
+
export declare function watchOverlayFooters(listener: () => void): () => void;
|
|
72
|
+
//# sourceMappingURL=overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/components/util/overlay.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,MAAM,IAAI,CAkB3C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAMzF;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACnC,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,GACxC,MAAM,IAAI,CAaZ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,IAAI,CAuD5D;AAyDD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,IAAI,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,IAAI,CAErE;AAWD,uDAAuD;AACvD,wBAAgB,gBAAgB,IAAI,WAAW,GAAG,IAAI,CAGrD;AAED,uDAAuD;AACvD,wBAAgB,gBAAgB,IAAI,WAAW,GAAG,IAAI,CAGrD;AAED,oGAAoG;AACpG,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKpE"}
|