zabi-components 7.0.2 → 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 +287 -11
- package/THEME.md +149 -332
- package/THEMING.md +1329 -163
- package/dist/atoms/ActionPanel.svelte +24 -9
- package/dist/atoms/ActionPanel.svelte.d.ts +2 -0
- package/dist/atoms/Avatar.svelte +104 -0
- package/dist/atoms/Avatar.svelte.d.ts +34 -0
- package/dist/atoms/Badge.svelte +124 -58
- package/dist/atoms/Badge.svelte.d.ts +17 -5
- package/dist/atoms/Button.svelte +212 -62
- package/dist/atoms/Button.svelte.d.ts +33 -2
- package/dist/atoms/Card.svelte +31 -28
- package/dist/atoms/Card.svelte.d.ts +5 -2
- package/dist/atoms/CardContent.svelte +10 -2
- package/dist/atoms/CardContent.svelte.d.ts +2 -0
- package/dist/atoms/CardFooter.svelte +10 -2
- package/dist/atoms/CardFooter.svelte.d.ts +2 -0
- package/dist/atoms/CardHeader.svelte +26 -6
- package/dist/atoms/CardHeader.svelte.d.ts +2 -0
- package/dist/atoms/Checkbox.svelte +52 -21
- package/dist/atoms/Checkbox.svelte.d.ts +6 -2
- package/dist/atoms/CodeBlock.svelte +35 -9
- package/dist/atoms/CodeBlock.svelte.d.ts +13 -3
- package/dist/atoms/ColorPicker.svelte +272 -52
- package/dist/atoms/ColorPicker.svelte.d.ts +6 -1
- package/dist/atoms/Container.svelte +17 -10
- package/dist/atoms/DateField.svelte +107 -0
- package/dist/atoms/DateField.svelte.d.ts +53 -0
- package/dist/atoms/Divider.svelte +4 -4
- package/dist/atoms/FeatureCard.svelte +4 -3
- 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 +93 -32
- package/dist/atoms/Heading.svelte.d.ts +24 -4
- package/dist/atoms/IconButton.svelte +242 -53
- package/dist/atoms/IconButton.svelte.d.ts +49 -4
- package/dist/atoms/Input.svelte +267 -74
- package/dist/atoms/Input.svelte.d.ts +32 -2
- package/dist/atoms/List.svelte +13 -2
- package/dist/atoms/List.svelte.d.ts +2 -0
- package/dist/atoms/ListItem.svelte +44 -11
- package/dist/atoms/ListItem.svelte.d.ts +5 -0
- package/dist/atoms/ListItemLeading.svelte +4 -2
- package/dist/atoms/ListItemLeading.svelte.d.ts +1 -1
- package/dist/atoms/OptimizedImage.svelte +11 -2
- package/dist/atoms/OptimizedImage.svelte.d.ts +2 -0
- package/dist/atoms/Progress.svelte +31 -9
- package/dist/atoms/Progress.svelte.d.ts +6 -0
- package/dist/atoms/Radio.svelte +23 -3
- package/dist/atoms/Radio.svelte.d.ts +6 -2
- package/dist/atoms/Rating.svelte +494 -0
- package/dist/atoms/Rating.svelte.d.ts +56 -0
- package/dist/atoms/Select.svelte +475 -135
- package/dist/atoms/Select.svelte.d.ts +52 -2
- package/dist/atoms/SelectionControl.svelte +99 -18
- package/dist/atoms/SelectionControl.svelte.d.ts +6 -3
- package/dist/atoms/Skeleton.svelte +5 -3
- 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 +152 -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 +56 -15
- package/dist/atoms/Text.svelte.d.ts +13 -4
- package/dist/atoms/Textarea.svelte +57 -45
- package/dist/atoms/Textarea.svelte.d.ts +14 -2
- package/dist/atoms/ThemeToggle.svelte +238 -56
- package/dist/atoms/ThemeToggle.svelte.d.ts +28 -3
- package/dist/atoms/TimeField.svelte +108 -0
- package/dist/atoms/TimeField.svelte.d.ts +54 -0
- package/dist/atoms/Toast.svelte +25 -10
- package/dist/atoms/Toast.svelte.d.ts +2 -0
- package/dist/atoms/Toggle.svelte +60 -19
- package/dist/atoms/Toggle.svelte.d.ts +18 -2
- package/dist/atoms/Tooltip.svelte +583 -40
- package/dist/atoms/Tooltip.svelte.d.ts +26 -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 +83 -3
- 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 +6 -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/cn.d.ts +8 -0
- package/dist/components/util/cn.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/ssr-safe.d.ts +4 -4
- package/dist/components/util/ssr-safe.d.ts.map +1 -1
- 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 +83 -3
- package/dist/index.js +60 -8
- package/dist/molecules/Alert.svelte +73 -66
- package/dist/molecules/Alert.svelte.d.ts +9 -1
- 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 +25 -5
- package/dist/molecules/ComponentDemo.svelte.d.ts +5 -0
- package/dist/molecules/ConfirmDialog.svelte +253 -0
- package/dist/molecules/ConfirmDialog.svelte.d.ts +55 -0
- package/dist/molecules/ContactForm.svelte +46 -19
- package/dist/molecules/ContactForm.svelte.d.ts +10 -0
- package/dist/molecules/Drawer.svelte +394 -0
- package/dist/molecules/Drawer.svelte.d.ts +55 -0
- package/dist/molecules/Dropdown.svelte +540 -50
- package/dist/molecules/Dropdown.svelte.d.ts +49 -6
- package/dist/molecules/DropdownItem.svelte +122 -0
- package/dist/molecules/DropdownItem.svelte.d.ts +28 -0
- package/dist/molecules/EmptyState.svelte +56 -10
- package/dist/molecules/EmptyState.svelte.d.ts +8 -0
- package/dist/molecules/Form.svelte +25 -14
- package/dist/molecules/Form.svelte.d.ts +13 -5
- package/dist/molecules/FormField.svelte +11 -2
- package/dist/molecules/FormField.svelte.d.ts +2 -0
- package/dist/molecules/Header.svelte +13 -3
- package/dist/molecules/Header.svelte.d.ts +2 -0
- package/dist/molecules/ImageUpload.svelte +422 -70
- package/dist/molecules/ImageUpload.svelte.d.ts +61 -5
- package/dist/molecules/MediaGrid.svelte +527 -0
- package/dist/molecules/MediaGrid.svelte.d.ts +77 -0
- package/dist/molecules/Modal.svelte +340 -45
- package/dist/molecules/Modal.svelte.d.ts +59 -7
- package/dist/molecules/NavigationMenu.svelte +15 -3
- package/dist/molecules/NavigationMenu.svelte.d.ts +4 -0
- package/dist/molecules/NavigationMenuContent.svelte +91 -36
- package/dist/molecules/NavigationMenuContent.svelte.d.ts +2 -0
- package/dist/molecules/NavigationMenuItem.svelte +10 -3
- package/dist/molecules/NavigationMenuItem.svelte.d.ts +2 -0
- package/dist/molecules/NavigationMenuLink.svelte +10 -2
- package/dist/molecules/NavigationMenuLink.svelte.d.ts +2 -0
- package/dist/molecules/NavigationMenuList.svelte +19 -4
- package/dist/molecules/NavigationMenuList.svelte.d.ts +2 -0
- package/dist/molecules/NavigationMenuTrigger.svelte +16 -3
- package/dist/molecules/NavigationMenuTrigger.svelte.d.ts +2 -0
- package/dist/molecules/Page.svelte +38 -2
- package/dist/molecules/Page.svelte.d.ts +13 -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 +26 -11
- package/dist/molecules/PropsTable.svelte.d.ts +5 -0
- package/dist/molecules/PullToRefresh.svelte +263 -0
- package/dist/molecules/PullToRefresh.svelte.d.ts +52 -0
- package/dist/molecules/RadioGroup.svelte +57 -15
- package/dist/molecules/RadioGroup.svelte.d.ts +16 -3
- package/dist/molecules/Section.svelte +13 -5
- package/dist/molecules/Section.svelte.d.ts +3 -1
- package/dist/molecules/SegmentedControl.svelte +323 -0
- package/dist/molecules/SegmentedControl.svelte.d.ts +34 -0
- package/dist/molecules/SidebarBrandHeader.svelte +24 -5
- package/dist/molecules/SidebarBrandHeader.svelte.d.ts +5 -0
- package/dist/molecules/SidebarFooter.svelte +39 -8
- package/dist/molecules/SidebarFooter.svelte.d.ts +5 -0
- package/dist/molecules/SidebarNavSection.svelte +12 -4
- package/dist/molecules/SidebarNavSection.svelte.d.ts +2 -0
- package/dist/molecules/SlideUp.svelte +253 -30
- package/dist/molecules/SlideUp.svelte.d.ts +31 -4
- 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 +254 -24
- package/dist/molecules/Tabs.svelte.d.ts +15 -4
- package/dist/molecules/Toaster.svelte +352 -6
- package/dist/molecules/Toaster.svelte.d.ts +95 -2
- package/dist/molecules/ToasterToast.svelte +279 -62
- package/dist/molecules/ToasterToast.svelte.d.ts +11 -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 +111 -12
- package/dist/organisms/SidebarAccountPanel.svelte.d.ts +21 -0
- package/dist/organisms/SidebarNavigation.svelte +193 -69
- package/dist/organisms/SidebarNavigation.svelte.d.ts +31 -1
- package/dist/organisms/SidebarPanel.svelte +45 -16
- package/dist/organisms/SidebarPanel.svelte.d.ts +2 -0
- package/dist/organisms/SidebarShell.svelte +263 -0
- package/dist/organisms/SidebarShell.svelte.d.ts +106 -0
- package/dist/organisms/TopNavbar.svelte +329 -33
- package/dist/organisms/TopNavbar.svelte.d.ts +28 -0
- package/dist/organisms/index.d.ts +6 -0
- package/dist/organisms/index.js +4 -0
- package/dist/routes/lib/variant-utils.d.ts +26 -0
- package/dist/routes/lib/{variant-utils.ts → variant-utils.js} +15 -46
- package/dist/types/components.d.ts +4 -0
- package/dist/types/components.d.ts.map +1 -1
- package/dist/types/events.js +1 -0
- package/dist/types/index.d.ts +605 -25
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -0
- 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/cn.d.ts +7 -0
- package/dist/util/cn.js +48 -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/ssr-safe.d.ts +4 -4
- 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 +574 -225
- package/dist/zabi-components-theme-dark.css +574 -225
- package/dist/zabi-components-theme-only.css +1680 -317
- package/dist/zabi-components-theme.css +1680 -317
- package/dist/zabi-components.css +4473 -1158
- package/docs/lucide-icons.md +41 -16
- package/docs/theme-imports.md +81 -11
- package/package.json +51 -29
- package/dist/lib/layout-width-tokens.d.ts +0 -17
- package/dist/lib/layout-width-tokens.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Button.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Button.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Input.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Input.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/List.d.ts +0 -3
- package/dist/lib/showcase/component-docs/List.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Modal.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Modal.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Radio.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Radio.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/SidebarNavigation.d.ts +0 -3
- package/dist/lib/showcase/component-docs/SidebarNavigation.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Skeleton.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Skeleton.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/_shared.d.ts +0 -12
- package/dist/lib/showcase/component-docs/_shared.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/index.d.ts +0 -4
- package/dist/lib/showcase/component-docs/index.d.ts.map +0 -1
- package/dist/lib/showcase/components-catalog.d.ts +0 -3
- package/dist/lib/showcase/components-catalog.d.ts.map +0 -1
- package/dist/lib/showcase/components-showcase-constants.d.ts +0 -89
- package/dist/lib/showcase/components-showcase-constants.d.ts.map +0 -1
- package/dist/lib/showcase/docs-sidebar-helpers.d.ts +0 -15
- package/dist/lib/showcase/docs-sidebar-helpers.d.ts.map +0 -1
- package/dist/routes/lib/focus-utils.d.ts +0 -12
- package/dist/routes/lib/focus-utils.ts +0 -110
- package/dist/routes/lib/ssr-safe.ts +0 -58
- package/scripts/fix-lucide-svelte-icon-dts.js +0 -35
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar dates as strings: `YYYY-MM-DD` for a day, `YYYY-MM` for a month,
|
|
3
|
+
* `HH:mm` (or `HH:mm:ss`) for a time of day. The formats a native date or
|
|
4
|
+
* time input reads and writes.
|
|
5
|
+
*
|
|
6
|
+
* A date here is a day on the calendar, not a moment. Nothing in this file
|
|
7
|
+
* goes through a local `Date`: the arithmetic is on the numbers, or on UTC,
|
|
8
|
+
* where every day has 24 hours. So a date never moves to the day before or
|
|
9
|
+
* after because of a time zone, and a day on which the clocks change is a day
|
|
10
|
+
* like any other.
|
|
11
|
+
*
|
|
12
|
+
* Years 0001 to 9999, four digits: within that, two dates compare as strings.
|
|
13
|
+
*/
|
|
14
|
+
export interface DateParts {
|
|
15
|
+
year: number;
|
|
16
|
+
/** 1 to 12. */
|
|
17
|
+
month: number;
|
|
18
|
+
day: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function isLeapYear(year: number): boolean;
|
|
21
|
+
/** Days in a month; `month` is 1 to 12. */
|
|
22
|
+
export declare function daysInMonth(year: number, month: number): number;
|
|
23
|
+
/** The parts of a `YYYY-MM-DD` string, or null when it is not a real date. */
|
|
24
|
+
export declare function parseIsoDate(value: string | null | undefined): DateParts | null;
|
|
25
|
+
export declare function isIsoDate(value: string | null | undefined): value is string;
|
|
26
|
+
/** The parts of a `YYYY-MM` string, or null when it is not a real month. */
|
|
27
|
+
export declare function parseIsoMonth(value: string | null | undefined): {
|
|
28
|
+
year: number;
|
|
29
|
+
month: number;
|
|
30
|
+
} | null;
|
|
31
|
+
export declare function toIsoDate(year: number, month: number, day: number): string;
|
|
32
|
+
export declare function toIsoMonth(year: number, month: number): string;
|
|
33
|
+
/** The month a date is in: `2026-10-06` gives `2026-10`. Null for a string that is not a date. */
|
|
34
|
+
export declare function monthOf(date: string | null | undefined): string | null;
|
|
35
|
+
/** The date `count` days later (earlier when negative), or null outside years 1 to 9999. */
|
|
36
|
+
export declare function addDays(date: string, count: number): string | null;
|
|
37
|
+
/** The month `count` months later (earlier when negative), or null outside years 1 to 9999. */
|
|
38
|
+
export declare function addMonthsToMonth(month: string, count: number): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* The same day of the month `count` months later. A day the target month does
|
|
41
|
+
* not have becomes its last one: 31 January plus a month is 28 or 29 February.
|
|
42
|
+
*/
|
|
43
|
+
export declare function addMonths(date: string, count: number): string | null;
|
|
44
|
+
/** Day of the week, 0 for Sunday to 6 for Saturday. -1 for a string that is not a date. */
|
|
45
|
+
export declare function weekdayOf(date: string): number;
|
|
46
|
+
/** A whole number from 0 to 6 for the first day of the week; anything else is Monday. */
|
|
47
|
+
export declare function normaliseWeekStart(weekStartsOn: number | undefined): number;
|
|
48
|
+
/** The first day of the week a date is in. */
|
|
49
|
+
export declare function startOfWeek(date: string, weekStartsOn?: number): string | null;
|
|
50
|
+
/** The last day of the week a date is in. */
|
|
51
|
+
export declare function endOfWeek(date: string, weekStartsOn?: number): string | null;
|
|
52
|
+
/**
|
|
53
|
+
* The weeks of a month, each seven entries from the first day of the week. A
|
|
54
|
+
* day of the month is its ISO date; a place before the 1st or after the last
|
|
55
|
+
* day is null. There are as many weeks as the month touches: four (a
|
|
56
|
+
* 28-day February that starts on the first day of the week), five or six.
|
|
57
|
+
*/
|
|
58
|
+
export declare function monthGrid(month: string, weekStartsOn?: number): (string | null)[][];
|
|
59
|
+
/** The seven days of the week as numbers (0 for Sunday), from the first day of the week. */
|
|
60
|
+
export declare function weekdayOrder(weekStartsOn?: number): number[];
|
|
61
|
+
/**
|
|
62
|
+
* Today where the user is, as `YYYY-MM-DD`. This is the one place that reads
|
|
63
|
+
* the local clock: "today" is a local idea. Call it in the browser; on a
|
|
64
|
+
* server it is the server's day.
|
|
65
|
+
*/
|
|
66
|
+
export declare function todayIso(now?: Date): string;
|
|
67
|
+
/** Today in UTC: the same on a server and in a browser at the same moment. */
|
|
68
|
+
export declare function todayIsoUtc(now?: Date): string;
|
|
69
|
+
/** A date held between `min` and `max`, either of which may be missing or invalid. */
|
|
70
|
+
export declare function clampDate(date: string, min?: string | null, max?: string | null): string;
|
|
71
|
+
/**
|
|
72
|
+
* A date for reading: `formatDate("2026-10-06", "sv")` is "6 okt. 2026",
|
|
73
|
+
* `formatDate("2026-10-06", "en-GB")` is "6 Oct 2026".
|
|
74
|
+
*
|
|
75
|
+
* `value` is `YYYY-MM-DD`, what a DateField holds. The day shown is always
|
|
76
|
+
* the day in the string: it does not depend on the time zone of the browser
|
|
77
|
+
* or the server. An empty or invalid value gives an empty string.
|
|
78
|
+
*
|
|
79
|
+
* Pass the `locale` of the page. Without it the runtime's own is used, which
|
|
80
|
+
* on a server is the server's and may differ from the reader's, so text
|
|
81
|
+
* rendered on the server and again in the browser may not match.
|
|
82
|
+
*
|
|
83
|
+
* `options` are those of `Intl.DateTimeFormat`; `timeZone` is not one you can
|
|
84
|
+
* set here.
|
|
85
|
+
*/
|
|
86
|
+
export declare function formatDate(value: string | null | undefined, locale?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
|
87
|
+
/**
|
|
88
|
+
* A time of day for reading: `formatTime("19:00", "sv")` is "19:00",
|
|
89
|
+
* `formatTime("19:00", "en-US")` is "7:00 PM".
|
|
90
|
+
*
|
|
91
|
+
* `value` is `HH:mm` or `HH:mm:ss`, what a TimeField holds. It is a time on
|
|
92
|
+
* the clock, with no zone: nothing shifts it. An empty or invalid value gives
|
|
93
|
+
* an empty string. `locale` and `options` as for `formatDate`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function formatTime(value: string | null | undefined, locale?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
|
96
|
+
//# sourceMappingURL=date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","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EAAE,EAC1B,OAAO,GAAE,IAAI,CAAC,qBAA2E,GAC1F,MAAM,CAIR;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAE1B,OAAO,GAAE,IAAI,CAAC,qBAA8C,GAC7D,MAAM,CASR"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Public types and pure helpers for `Drawer`. */
|
|
2
|
+
/**
|
|
3
|
+
* The edge the drawer is anchored to. `left` and `right` are physical and stay
|
|
4
|
+
* put in a right-to-left page; `start` and `end` follow the writing direction.
|
|
5
|
+
*/
|
|
6
|
+
export type DrawerSide = "left" | "right" | "start" | "end";
|
|
7
|
+
/** Panel width on wide screens. On a phone the panel is never wider than the screen. */
|
|
8
|
+
export type DrawerSize = "sm" | "md" | "lg";
|
|
9
|
+
/** What the user did to close the drawer. The same values Modal reports. */
|
|
10
|
+
export type DrawerCloseReason = "escape" | "backdrop" | "close-button";
|
|
11
|
+
/** The physical edge a side resolves to, given the writing direction. */
|
|
12
|
+
export declare function resolveDrawerEdge(side: DrawerSide, rtl: boolean): "left" | "right";
|
|
13
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/util/drawer.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAE5D,wFAAwF;AACxF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,UAAU,GAAG,cAAc,CAAC;AAEvE,yEAAyE;AACzE,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,OAAO,GACb,MAAM,GAAG,OAAO,CAGlB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Component } from "svelte";
|
|
2
|
+
/** An icon component, as `@lucide/svelte` icons are. */
|
|
3
|
+
export type DropdownItemIcon = Component<{
|
|
4
|
+
size?: number;
|
|
5
|
+
class?: string;
|
|
6
|
+
}>;
|
|
7
|
+
export type DropdownItemTone = "default" | "danger";
|
|
8
|
+
/** One entry of Dropdown's `options`. */
|
|
9
|
+
export interface DropdownOption {
|
|
10
|
+
value: string | number;
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* A disabled item stays focusable, so the arrow keys still reach it and a
|
|
14
|
+
* screen reader can read why it is unavailable; it cannot be chosen.
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Rendered before the label, at 16px. Decorative: the label names the item. */
|
|
18
|
+
icon?: DropdownItemIcon;
|
|
19
|
+
/** `danger` for a destructive action such as Delete. */
|
|
20
|
+
tone?: DropdownItemTone;
|
|
21
|
+
/** Second line under the label, e.g. why the item is disabled. */
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* How a Dropdown's menu is shown: `popover` under its trigger, `sheet` in a
|
|
26
|
+
* BottomSheet, or `auto`: a sheet on a phone, the pop-over everywhere else.
|
|
27
|
+
*/
|
|
28
|
+
export type DropdownPresentation = "auto" | "popover" | "sheet";
|
|
29
|
+
/**
|
|
30
|
+
* A phone, for `auto`: a touch screen (`pointer: coarse`) narrower than the
|
|
31
|
+
* `sm` breakpoint. A tablet has the room for a pop-over under its trigger,
|
|
32
|
+
* and a narrow window with a mouse has the precision for one.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SHEET_MEDIA_QUERY = "(pointer: coarse) and (max-width: 639.98px)";
|
|
35
|
+
/**
|
|
36
|
+
* Whether a menu asked for as `presentation` opens in a sheet right now.
|
|
37
|
+
* Read when the menu opens, in the browser: on the server it is never a sheet,
|
|
38
|
+
* so what is rendered before anyone touches the control is the same everywhere.
|
|
39
|
+
*/
|
|
40
|
+
export declare function opensAsSheet(presentation: DropdownPresentation): boolean;
|
|
41
|
+
/** What a Dropdown tells the items inside it. */
|
|
42
|
+
export interface DropdownContext {
|
|
43
|
+
/** `option` inside a listbox, `menuitem` inside a menu. */
|
|
44
|
+
readonly itemRole: "menuitem" | "option";
|
|
45
|
+
}
|
|
46
|
+
export declare const DROPDOWN_CONTEXT_KEY: unique symbol;
|
|
47
|
+
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -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":"A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AE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,IAAI,CAsBpF"}
|
|
@@ -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
|