zabi-components 8.0.0 → 9.0.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 +2935 -0
- package/README.md +243 -10
- package/THEME.md +162 -332
- package/THEMING.md +1419 -259
- package/dist/atoms/ActionPanel.svelte +15 -5
- package/dist/atoms/Avatar.svelte +120 -0
- package/dist/atoms/Avatar.svelte.d.ts +46 -0
- package/dist/atoms/Badge.svelte +71 -13
- package/dist/atoms/Badge.svelte.d.ts +8 -2
- package/dist/atoms/Block.svelte +74 -0
- package/dist/atoms/Block.svelte.d.ts +29 -0
- package/dist/atoms/Button.svelte +217 -30
- package/dist/atoms/Button.svelte.d.ts +33 -4
- package/dist/atoms/Card.svelte +182 -26
- package/dist/atoms/Card.svelte.d.ts +55 -3
- package/dist/atoms/CardHeader.svelte +16 -4
- package/dist/atoms/Checkbox.svelte +81 -21
- package/dist/atoms/Checkbox.svelte.d.ts +31 -2
- package/dist/atoms/Chip.svelte +351 -0
- package/dist/atoms/Chip.svelte.d.ts +57 -0
- package/dist/atoms/CodeBlock.svelte +20 -2
- package/dist/atoms/CodeBlock.svelte.d.ts +4 -0
- package/dist/atoms/CodeField.svelte +385 -0
- package/dist/atoms/CodeField.svelte.d.ts +61 -0
- package/dist/atoms/ColorPicker.svelte +260 -49
- package/dist/atoms/ColorPicker.svelte.d.ts +3 -0
- package/dist/atoms/Container.svelte +16 -8
- package/dist/atoms/DateField.svelte +145 -0
- package/dist/atoms/DateField.svelte.d.ts +81 -0
- package/dist/atoms/FieldMessages.svelte +69 -0
- package/dist/atoms/FieldMessages.svelte.d.ts +23 -0
- package/dist/atoms/FloatingActionButton.svelte +176 -0
- package/dist/atoms/FloatingActionButton.svelte.d.ts +51 -0
- package/dist/atoms/Heading.svelte +63 -5
- package/dist/atoms/Heading.svelte.d.ts +14 -0
- package/dist/atoms/IconButton.svelte +294 -26
- package/dist/atoms/IconButton.svelte.d.ts +62 -4
- package/dist/atoms/Input.svelte +259 -53
- package/dist/atoms/Input.svelte.d.ts +33 -2
- package/dist/atoms/List.svelte +5 -1
- package/dist/atoms/ListItem.svelte +70 -13
- package/dist/atoms/ListItem.svelte.d.ts +11 -0
- package/dist/atoms/PickerField.svelte +239 -0
- package/dist/atoms/PickerField.svelte.d.ts +67 -0
- package/dist/atoms/Progress.svelte +99 -19
- package/dist/atoms/Progress.svelte.d.ts +15 -1
- package/dist/atoms/Radio.svelte +51 -3
- package/dist/atoms/Radio.svelte.d.ts +30 -2
- package/dist/atoms/Rating.svelte +620 -0
- package/dist/atoms/Rating.svelte.d.ts +77 -0
- package/dist/atoms/Select.svelte +438 -98
- package/dist/atoms/Select.svelte.d.ts +61 -3
- package/dist/atoms/SelectionControl.svelte +193 -23
- package/dist/atoms/SelectionControl.svelte.d.ts +29 -3
- package/dist/atoms/Skeleton.svelte +114 -18
- package/dist/atoms/Skeleton.svelte.d.ts +30 -3
- package/dist/atoms/SkeletonGroup.svelte +43 -0
- package/dist/atoms/SkeletonGroup.svelte.d.ts +20 -0
- package/dist/atoms/Slider.svelte +344 -0
- package/dist/atoms/Slider.svelte.d.ts +40 -0
- package/dist/atoms/Sparkline.svelte +109 -0
- package/dist/atoms/Sparkline.svelte.d.ts +27 -0
- package/dist/atoms/SpeechBubble.svelte +187 -0
- package/dist/atoms/SpeechBubble.svelte.d.ts +33 -0
- package/dist/atoms/Spinner.svelte +57 -0
- package/dist/atoms/Spinner.svelte.d.ts +19 -0
- package/dist/atoms/Stat.svelte +72 -0
- package/dist/atoms/Stat.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 +472 -0
- package/dist/atoms/TemporalField.svelte.d.ts +48 -0
- package/dist/atoms/Text.svelte +23 -11
- package/dist/atoms/Text.svelte.d.ts +6 -3
- package/dist/atoms/Textarea.svelte +150 -44
- package/dist/atoms/Textarea.svelte.d.ts +35 -2
- package/dist/atoms/ThemeToggle.svelte +223 -44
- package/dist/atoms/ThemeToggle.svelte.d.ts +26 -3
- package/dist/atoms/TimeColumn.svelte +150 -0
- package/dist/atoms/TimeColumn.svelte.d.ts +25 -0
- package/dist/atoms/TimeField.svelte +151 -0
- package/dist/atoms/TimeField.svelte.d.ts +85 -0
- package/dist/atoms/Toast.svelte +22 -8
- package/dist/atoms/Toast.svelte.d.ts +2 -0
- package/dist/atoms/Toggle.svelte +98 -14
- package/dist/atoms/Toggle.svelte.d.ts +26 -2
- package/dist/atoms/Tooltip.svelte +528 -24
- package/dist/atoms/Tooltip.svelte.d.ts +18 -0
- package/dist/atoms/ZabiStringsProvider.svelte +45 -0
- package/dist/atoms/ZabiStringsProvider.svelte.d.ts +27 -0
- package/dist/atoms/index.d.ts +38 -0
- package/dist/atoms/index.js +29 -0
- package/dist/atoms/selection-control.styles.d.ts +47 -5
- package/dist/atoms/selection-control.styles.js +52 -10
- package/dist/components/atoms/index.d.ts +38 -0
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/atoms/selection-control.styles.d.ts +47 -5
- package/dist/components/atoms/selection-control.styles.d.ts.map +1 -1
- package/dist/components/index.d.ts +104 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/map.d.ts +11 -0
- package/dist/components/map.d.ts.map +1 -0
- package/dist/components/molecules/index.d.ts +51 -0
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/molecules/toast-store.d.ts +83 -7
- package/dist/components/molecules/toast-store.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +10 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/components/types/variants.d.ts +24 -1
- package/dist/components/types/variants.d.ts.map +1 -1
- package/dist/components/util/app-shell.d.ts +79 -0
- package/dist/components/util/app-shell.d.ts.map +1 -0
- package/dist/components/util/avatar.d.ts +39 -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 +41 -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/chart.d.ts +140 -0
- package/dist/components/util/chart.d.ts.map +1 -0
- package/dist/components/util/chip.d.ts +66 -0
- package/dist/components/util/chip.d.ts.map +1 -0
- package/dist/components/util/cn.d.ts.map +1 -1
- package/dist/components/util/code-field.d.ts +63 -0
- package/dist/components/util/code-field.d.ts.map +1 -0
- package/dist/components/util/collapsible.d.ts +64 -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/display-voice.d.ts +10 -0
- package/dist/components/util/display-voice.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-control.d.ts +30 -0
- package/dist/components/util/field-control.d.ts.map +1 -0
- package/dist/components/util/field.d.ts +45 -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 +77 -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/map-view.d.ts +144 -0
- package/dist/components/util/map-view.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 +234 -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/progress.d.ts +19 -0
- package/dist/components/util/progress.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-edge.d.ts +33 -0
- package/dist/components/util/scroll-edge.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 +84 -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/skeleton.d.ts +15 -0
- package/dist/components/util/skeleton.d.ts.map +1 -0
- package/dist/components/util/sliding-indicator.d.ts +25 -0
- package/dist/components/util/sliding-indicator.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/temporal-field.d.ts +89 -0
- package/dist/components/util/temporal-field.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 +133 -0
- package/dist/components/util/toaster.d.ts.map +1 -0
- package/dist/components/util/tone-surface.d.ts +34 -0
- package/dist/components/util/tone-surface.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 +35 -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 +142 -0
- package/dist/components/util/zabi-strings.d.ts.map +1 -0
- package/dist/create-theme/cli.js +173 -0
- package/dist/create-theme/index.d.ts +190 -0
- package/dist/create-theme/index.js +1034 -0
- package/dist/create-theme/lib/ramp-math.js +128 -0
- package/dist/create-theme/lib/resolve.js +238 -0
- package/dist/create-theme/theme-data.js +2644 -0
- package/dist/index.d.ts +104 -2
- package/dist/index.js +75 -2
- package/dist/map.d.ts +10 -0
- package/dist/map.js +9 -0
- package/dist/molecules/Alert.svelte +63 -16
- package/dist/molecules/Alert.svelte.d.ts +14 -1
- package/dist/molecules/AppBar.svelte +674 -0
- package/dist/molecules/AppBar.svelte.d.ts +131 -0
- package/dist/molecules/AvatarGroup.svelte +116 -0
- package/dist/molecules/AvatarGroup.svelte.d.ts +40 -0
- package/dist/molecules/BarChart.svelte +381 -0
- package/dist/molecules/BarChart.svelte.d.ts +45 -0
- package/dist/molecules/BottomSheet.svelte +608 -0
- package/dist/molecules/BottomSheet.svelte.d.ts +109 -0
- package/dist/molecules/BottomTabBar.svelte +403 -0
- package/dist/molecules/BottomTabBar.svelte.d.ts +98 -0
- package/dist/molecules/Calendar.svelte +597 -0
- package/dist/molecules/Calendar.svelte.d.ts +72 -0
- package/dist/molecules/ChipGroup.svelte +325 -0
- package/dist/molecules/ChipGroup.svelte.d.ts +41 -0
- package/dist/molecules/Collapsible.svelte +347 -0
- package/dist/molecules/Collapsible.svelte.d.ts +61 -0
- package/dist/molecules/CollapsibleGroup.svelte +136 -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 +257 -0
- package/dist/molecules/ConfirmDialog.svelte.d.ts +58 -0
- package/dist/molecules/ContactForm.svelte +34 -17
- package/dist/molecules/ContactForm.svelte.d.ts +8 -0
- package/dist/molecules/Drawer.svelte +415 -0
- package/dist/molecules/Drawer.svelte.d.ts +55 -0
- package/dist/molecules/Dropdown.svelte +517 -48
- package/dist/molecules/Dropdown.svelte.d.ts +47 -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 +492 -69
- package/dist/molecules/ImageUpload.svelte.d.ts +82 -2
- package/dist/molecules/LineChart.svelte +459 -0
- package/dist/molecules/LineChart.svelte.d.ts +53 -0
- package/dist/molecules/MapView.svelte +565 -0
- package/dist/molecules/MapView.svelte.d.ts +88 -0
- package/dist/molecules/MediaGrid.svelte +527 -0
- package/dist/molecules/MediaGrid.svelte.d.ts +77 -0
- package/dist/molecules/Modal.svelte +293 -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 +523 -0
- package/dist/molecules/PhotoGrid.svelte.d.ts +73 -0
- package/dist/molecules/PhotoViewer.svelte +1213 -0
- package/dist/molecules/PhotoViewer.svelte.d.ts +74 -0
- package/dist/molecules/PieChart.svelte +421 -0
- package/dist/molecules/PieChart.svelte.d.ts +51 -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 +72 -18
- package/dist/molecules/RadioGroup.svelte.d.ts +19 -3
- package/dist/molecules/Section.svelte +1 -1
- package/dist/molecules/SegmentedControl.svelte +456 -0
- package/dist/molecules/SegmentedControl.svelte.d.ts +40 -0
- package/dist/molecules/SidebarBrandHeader.svelte +11 -1
- package/dist/molecules/SidebarBrandHeader.svelte.d.ts +3 -0
- package/dist/molecules/SidebarFooter.svelte +30 -7
- package/dist/molecules/SidebarFooter.svelte.d.ts +3 -0
- package/dist/molecules/SidebarNavSection.svelte +1 -1
- package/dist/molecules/SlideUp.svelte +220 -61
- package/dist/molecules/SlideUp.svelte.d.ts +26 -0
- package/dist/molecules/SortableList.svelte +633 -0
- package/dist/molecules/SortableList.svelte.d.ts +69 -0
- package/dist/molecules/Stepper.svelte +562 -0
- package/dist/molecules/Stepper.svelte.d.ts +39 -0
- package/dist/molecules/StickyActionBar.svelte +250 -0
- package/dist/molecules/StickyActionBar.svelte.d.ts +78 -0
- package/dist/molecules/SwipeableListItem.svelte +334 -0
- package/dist/molecules/SwipeableListItem.svelte.d.ts +54 -0
- package/dist/molecules/Tabs.svelte +310 -9
- package/dist/molecules/Tabs.svelte.d.ts +7 -0
- package/dist/molecules/Toaster.svelte +514 -5
- package/dist/molecules/Toaster.svelte.d.ts +153 -2
- package/dist/molecules/ToasterToast.svelte +495 -77
- package/dist/molecules/ToasterToast.svelte.d.ts +15 -0
- package/dist/molecules/UnsavedChangesBar.svelte +223 -0
- package/dist/molecules/UnsavedChangesBar.svelte.d.ts +43 -0
- package/dist/molecules/index.d.ts +51 -0
- package/dist/molecules/index.js +31 -0
- package/dist/molecules/toast-store.d.ts +83 -7
- package/dist/molecules/toast-store.js +25 -1
- package/dist/organisms/AppNavigation.svelte +440 -0
- package/dist/organisms/AppNavigation.svelte.d.ts +72 -0
- package/dist/organisms/AppShell.svelte +696 -0
- package/dist/organisms/AppShell.svelte.d.ts +157 -0
- package/dist/organisms/AppShellHeaderPart.svelte +163 -0
- package/dist/organisms/AppShellHeaderPart.svelte.d.ts +57 -0
- package/dist/organisms/SidebarAccountPanel.svelte +107 -12
- package/dist/organisms/SidebarAccountPanel.svelte.d.ts +19 -0
- package/dist/organisms/SidebarNavigation.svelte +111 -43
- package/dist/organisms/SidebarNavigation.svelte.d.ts +29 -1
- package/dist/organisms/SidebarPanel.svelte +34 -17
- package/dist/organisms/SidebarPanel.svelte.d.ts +1 -0
- package/dist/organisms/SidebarShell.svelte +164 -14
- package/dist/organisms/SidebarShell.svelte.d.ts +56 -2
- package/dist/organisms/TopNavbar.svelte +353 -39
- package/dist/organisms/TopNavbar.svelte.d.ts +47 -0
- package/dist/organisms/TopNavbarSheetContent.svelte +145 -0
- package/dist/organisms/TopNavbarSheetContent.svelte.d.ts +24 -0
- package/dist/organisms/index.d.ts +10 -0
- package/dist/organisms/index.js +7 -0
- package/dist/types/components.d.ts +21 -1
- package/dist/types/components.d.ts.map +1 -1
- package/dist/types/index.d.ts +1093 -26
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/variants.ts +28 -1
- package/dist/util/app-shell.d.ts +78 -0
- package/dist/util/app-shell.js +97 -0
- package/dist/util/avatar.d.ts +38 -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 +40 -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/chart.d.ts +139 -0
- package/dist/util/chart.js +305 -0
- package/dist/util/chip.d.ts +65 -0
- package/dist/util/chip.js +58 -0
- package/dist/util/cn.js +28 -2
- package/dist/util/code-field.d.ts +62 -0
- package/dist/util/code-field.js +112 -0
- package/dist/util/collapsible.d.ts +63 -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/display-voice.d.ts +9 -0
- package/dist/util/display-voice.js +9 -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-control.d.ts +29 -0
- package/dist/util/field-control.js +32 -0
- package/dist/util/field.d.ts +44 -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 +77 -2
- package/dist/util/focus-utils.js +186 -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/map-view.d.ts +143 -0
- package/dist/util/map-view.js +121 -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 +233 -0
- package/dist/util/photo.js +209 -0
- package/dist/util/portal.d.ts +22 -0
- package/dist/util/portal.js +50 -0
- package/dist/util/progress.d.ts +18 -0
- package/dist/util/progress.js +17 -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-edge.d.ts +32 -0
- package/dist/util/scroll-edge.js +87 -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 +83 -0
- package/dist/util/sheet-drag.js +311 -0
- package/dist/util/sidebar.d.ts +62 -0
- package/dist/util/sidebar.js +38 -0
- package/dist/util/skeleton.d.ts +14 -0
- package/dist/util/skeleton.js +22 -0
- package/dist/util/sliding-indicator.d.ts +24 -0
- package/dist/util/sliding-indicator.js +44 -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/temporal-field.d.ts +88 -0
- package/dist/util/temporal-field.js +136 -0
- package/dist/util/theme-mode.d.ts +79 -0
- package/dist/util/theme-mode.js +121 -0
- package/dist/util/toaster.d.ts +132 -0
- package/dist/util/toaster.js +130 -0
- package/dist/util/tone-surface.d.ts +33 -0
- package/dist/util/tone-surface.js +35 -0
- package/dist/util/tooltip.d.ts +9 -0
- package/dist/util/tooltip.js +18 -0
- package/dist/util/top-navbar.d.ts +34 -0
- package/dist/util/top-navbar.js +28 -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 +141 -0
- package/dist/util/zabi-strings.js +105 -0
- package/dist/zabi-components-colors.css +11 -2
- package/dist/zabi-components-theme-dark-only.css +870 -258
- package/dist/zabi-components-theme-dark.css +870 -258
- package/dist/zabi-components-theme-only.css +2419 -368
- package/dist/zabi-components-theme.css +2419 -368
- package/dist/zabi-components.css +6032 -711
- package/docs/lucide-icons.md +40 -17
- package/docs/theme-imports.md +81 -11
- package/package.json +45 -8
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word a `Toaster` says by itself. An app in another language passes
|
|
3
|
+
* its own through `strings`; what it leaves out stays as it is here.
|
|
4
|
+
*/
|
|
5
|
+
export interface ToasterStrings {
|
|
6
|
+
/** Accessible name of the region the toasts are in. */
|
|
7
|
+
regionLabel: string;
|
|
8
|
+
/**
|
|
9
|
+
* What a toast says when it was pushed with neither a `title` nor a
|
|
10
|
+
* `message`, by type. A toast with a message shows the message.
|
|
11
|
+
*/
|
|
12
|
+
successTitle: string;
|
|
13
|
+
errorTitle: string;
|
|
14
|
+
warningTitle: string;
|
|
15
|
+
infoTitle: string;
|
|
16
|
+
/** The time a toast has left, while its timer runs. */
|
|
17
|
+
closesIn: (seconds: number) => string;
|
|
18
|
+
/** The same, while a pointer, a finger or focus holds the timer. */
|
|
19
|
+
pausedClosesIn: (seconds: number) => string;
|
|
20
|
+
/** The button that stops the timer; shown with `showCountdown`. */
|
|
21
|
+
stop: string;
|
|
22
|
+
/** The button under a toast's opened details, which closes them again. */
|
|
23
|
+
okay: string;
|
|
24
|
+
/** Accessible name of the button that opens a toast's details. */
|
|
25
|
+
expand: string;
|
|
26
|
+
/** The same button, once they are open. */
|
|
27
|
+
collapse: string;
|
|
28
|
+
/** Accessible name of the button that dismisses a toast. */
|
|
29
|
+
dismiss: string;
|
|
30
|
+
/**
|
|
31
|
+
* Read after a toast's text when it has an action, so a screen reader
|
|
32
|
+
* user hears that there is one. `label` is the action's own.
|
|
33
|
+
*/
|
|
34
|
+
actionAvailable: (label: string) => string;
|
|
35
|
+
}
|
|
36
|
+
export declare const DEFAULT_TOASTER_STRINGS: ToasterStrings;
|
|
37
|
+
/**
|
|
38
|
+
* The three lengths a toast can be given by name, in milliseconds.
|
|
39
|
+
*
|
|
40
|
+
* `short` (3 s) is for a few words that need no reading time ("Saved").
|
|
41
|
+
* Anything a person has to read is `medium` (7 s) or `long` (14 s). What
|
|
42
|
+
* they have to act on, and an error, should stay: `"persistent"`.
|
|
43
|
+
*/
|
|
44
|
+
export declare const TOAST_DURATIONS: {
|
|
45
|
+
readonly short: 3000;
|
|
46
|
+
readonly medium: 7000;
|
|
47
|
+
readonly long: 14000;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* How long a toast stays: one of the named lengths, `"persistent"` (until it
|
|
51
|
+
* is dismissed), or a number of milliseconds, where `0` is persistent too.
|
|
52
|
+
*/
|
|
53
|
+
export type ToastDuration = keyof typeof TOAST_DURATIONS | "persistent" | number;
|
|
54
|
+
/**
|
|
55
|
+
* A toast with more visible text than this (title and message together) gets
|
|
56
|
+
* `long` when the app gave it no duration.
|
|
57
|
+
*/
|
|
58
|
+
export declare const TOAST_LONG_TEXT_LENGTH = 120;
|
|
59
|
+
/**
|
|
60
|
+
* And one with more than this stays until it is dismissed: `long` was
|
|
61
|
+
* measured as too short to read it in, and nothing longer has a name.
|
|
62
|
+
*/
|
|
63
|
+
export declare const TOAST_PERSISTENT_TEXT_LENGTH = 240;
|
|
64
|
+
/**
|
|
65
|
+
* How long a toast stays, in milliseconds; `0` is until it is dismissed.
|
|
66
|
+
*
|
|
67
|
+
* What the app said for the toast wins, whatever the toast is. When it said
|
|
68
|
+
* nothing: an error stays, and so does a toast with an action, since the user
|
|
69
|
+
* has to be able to reach the button. So does a text longer than
|
|
70
|
+
* `TOAST_PERSISTENT_TEXT_LENGTH`, whatever the Toaster's default. Everything
|
|
71
|
+
* else gets the Toaster's `defaultDuration`, or `medium` without one; a text
|
|
72
|
+
* longer than `TOAST_LONG_TEXT_LENGTH` gets `long`, unless the default is
|
|
73
|
+
* longer still.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveToastDuration(toast: {
|
|
76
|
+
duration?: ToastDuration;
|
|
77
|
+
type: string;
|
|
78
|
+
hasAction: boolean;
|
|
79
|
+
textLength: number;
|
|
80
|
+
}, defaultDuration?: ToastDuration): number;
|
|
81
|
+
/**
|
|
82
|
+
* The least a toast has left when a finger that held it lifts, in seconds.
|
|
83
|
+
* As long as `short`: holding a short toast starts it again, in effect.
|
|
84
|
+
*/
|
|
85
|
+
export declare const TOAST_SECONDS_AFTER_HOLD = 3;
|
|
86
|
+
/** What `onpausechange` of a `Toaster` is called with. */
|
|
87
|
+
export interface ToastPauseChange {
|
|
88
|
+
/** The id of the toast, as `pushToast` returned it. */
|
|
89
|
+
id: string;
|
|
90
|
+
/** True while a pointer is over the toast, a finger is on it, or focus is inside it. */
|
|
91
|
+
paused: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* How a `Toaster` presents its toasts. `"stack"` is the stack in the corner
|
|
95
|
+
* (and across the width on a phone); `"snackbar"` is the compact form for a
|
|
96
|
+
* phone, one at a time, docked above whatever is at the bottom; `"auto"` is
|
|
97
|
+
* the snackbar below 640px and the stack from there up.
|
|
98
|
+
*/
|
|
99
|
+
export type ToasterMode = "stack" | "snackbar" | "auto";
|
|
100
|
+
/** The words of a toast on screen: its first line, and the line under it if there is one. */
|
|
101
|
+
export declare function toastTexts(toast: {
|
|
102
|
+
title?: string;
|
|
103
|
+
message: string;
|
|
104
|
+
type: string;
|
|
105
|
+
}, strings: Pick<ToasterStrings, "successTitle" | "errorTitle" | "warningTitle" | "infoTitle">): {
|
|
106
|
+
title: string;
|
|
107
|
+
message: string;
|
|
108
|
+
headerTitle: string;
|
|
109
|
+
secondLine: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* True when the toast has to stay until a person has dealt with it, which
|
|
113
|
+
* makes it the one a `max` never drops: an error, one with an action, one
|
|
114
|
+
* with no end (`"persistent"`, or text too long to read in `long`).
|
|
115
|
+
*/
|
|
116
|
+
export declare function toastStays(toast: {
|
|
117
|
+
title?: string;
|
|
118
|
+
message: string;
|
|
119
|
+
type: string;
|
|
120
|
+
duration?: ToastDuration;
|
|
121
|
+
action?: unknown;
|
|
122
|
+
}, defaultDuration?: ToastDuration): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Ids of toasts that a `max` is dropping to make room for a newer one. Such a
|
|
125
|
+
* toast leaves at once, without the exit motion: a newer toast is coming in
|
|
126
|
+
* where it is, and the two would otherwise lie on each other for a moment.
|
|
127
|
+
*/
|
|
128
|
+
export declare const toastsReplaced: Set<string>;
|
|
129
|
+
/** The Material standard curve (`--ease-standard`), as an easing function for a script-driven slide. */
|
|
130
|
+
export declare function easeStandard(t: number): number;
|
|
131
|
+
/** A toast dragged further than this share of its width is dismissed, flick or not. */
|
|
132
|
+
export declare const TOAST_SWIPE_DISMISS_FRACTION = 0.4;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export const DEFAULT_TOASTER_STRINGS = {
|
|
2
|
+
regionLabel: "Notifications",
|
|
3
|
+
successTitle: "Changes saved",
|
|
4
|
+
errorTitle: "Something went wrong",
|
|
5
|
+
warningTitle: "Please review",
|
|
6
|
+
infoTitle: "Notice",
|
|
7
|
+
closesIn: (seconds) => `This message will close in ${seconds} ${seconds === 1 ? "second" : "seconds"}.`,
|
|
8
|
+
pausedClosesIn: (seconds) => `Paused — closes in ${seconds} ${seconds === 1 ? "second" : "seconds"}.`,
|
|
9
|
+
stop: "Click to stop",
|
|
10
|
+
okay: "Okay",
|
|
11
|
+
expand: "Expand details",
|
|
12
|
+
collapse: "Collapse details",
|
|
13
|
+
dismiss: "Dismiss notification",
|
|
14
|
+
actionAvailable: (label) => `${label} available.`,
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The three lengths a toast can be given by name, in milliseconds.
|
|
18
|
+
*
|
|
19
|
+
* `short` (3 s) is for a few words that need no reading time ("Saved").
|
|
20
|
+
* Anything a person has to read is `medium` (7 s) or `long` (14 s). What
|
|
21
|
+
* they have to act on, and an error, should stay: `"persistent"`.
|
|
22
|
+
*/
|
|
23
|
+
export const TOAST_DURATIONS = { short: 3000, medium: 7000, long: 14000 };
|
|
24
|
+
/**
|
|
25
|
+
* A toast with more visible text than this (title and message together) gets
|
|
26
|
+
* `long` when the app gave it no duration.
|
|
27
|
+
*/
|
|
28
|
+
export const TOAST_LONG_TEXT_LENGTH = 120;
|
|
29
|
+
/**
|
|
30
|
+
* And one with more than this stays until it is dismissed: `long` was
|
|
31
|
+
* measured as too short to read it in, and nothing longer has a name.
|
|
32
|
+
*/
|
|
33
|
+
export const TOAST_PERSISTENT_TEXT_LENGTH = 240;
|
|
34
|
+
/** The milliseconds of a duration, `0` for one that stays; `undefined` for what is not a duration. */
|
|
35
|
+
function toastDurationMs(duration) {
|
|
36
|
+
if (duration === "persistent")
|
|
37
|
+
return 0;
|
|
38
|
+
if (typeof duration === "string") {
|
|
39
|
+
return Object.prototype.hasOwnProperty.call(TOAST_DURATIONS, duration)
|
|
40
|
+
? TOAST_DURATIONS[duration]
|
|
41
|
+
: undefined;
|
|
42
|
+
}
|
|
43
|
+
if (typeof duration !== "number" || Number.isNaN(duration))
|
|
44
|
+
return undefined;
|
|
45
|
+
return duration <= 0 ? 0 : duration;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* How long a toast stays, in milliseconds; `0` is until it is dismissed.
|
|
49
|
+
*
|
|
50
|
+
* What the app said for the toast wins, whatever the toast is. When it said
|
|
51
|
+
* nothing: an error stays, and so does a toast with an action, since the user
|
|
52
|
+
* has to be able to reach the button. So does a text longer than
|
|
53
|
+
* `TOAST_PERSISTENT_TEXT_LENGTH`, whatever the Toaster's default. Everything
|
|
54
|
+
* else gets the Toaster's `defaultDuration`, or `medium` without one; a text
|
|
55
|
+
* longer than `TOAST_LONG_TEXT_LENGTH` gets `long`, unless the default is
|
|
56
|
+
* longer still.
|
|
57
|
+
*/
|
|
58
|
+
export function resolveToastDuration(toast, defaultDuration) {
|
|
59
|
+
const said = toastDurationMs(toast.duration);
|
|
60
|
+
if (said !== undefined)
|
|
61
|
+
return said;
|
|
62
|
+
if (toast.type === "error" || toast.hasAction)
|
|
63
|
+
return 0;
|
|
64
|
+
if (toast.textLength > TOAST_PERSISTENT_TEXT_LENGTH)
|
|
65
|
+
return 0;
|
|
66
|
+
const base = toastDurationMs(defaultDuration) ?? TOAST_DURATIONS.medium;
|
|
67
|
+
if (base === 0 || toast.textLength <= TOAST_LONG_TEXT_LENGTH)
|
|
68
|
+
return base;
|
|
69
|
+
return Math.max(base, TOAST_DURATIONS.long);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The least a toast has left when a finger that held it lifts, in seconds.
|
|
73
|
+
* As long as `short`: holding a short toast starts it again, in effect.
|
|
74
|
+
*/
|
|
75
|
+
export const TOAST_SECONDS_AFTER_HOLD = 3;
|
|
76
|
+
/** The words of a toast on screen: its first line, and the line under it if there is one. */
|
|
77
|
+
export function toastTexts(toast, strings) {
|
|
78
|
+
const title = toast.title?.trim() ?? "";
|
|
79
|
+
const message = toast.message.trim();
|
|
80
|
+
const fallback = toast.type === "success"
|
|
81
|
+
? strings.successTitle
|
|
82
|
+
: toast.type === "error"
|
|
83
|
+
? strings.errorTitle
|
|
84
|
+
: toast.type === "warning"
|
|
85
|
+
? strings.warningTitle
|
|
86
|
+
: strings.infoTitle;
|
|
87
|
+
return {
|
|
88
|
+
title,
|
|
89
|
+
message,
|
|
90
|
+
// The title, or the message when there is no title.
|
|
91
|
+
headerTitle: title || message || fallback,
|
|
92
|
+
// The message, under a title that says something else.
|
|
93
|
+
secondLine: title && message && message !== title ? message : "",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* True when the toast has to stay until a person has dealt with it, which
|
|
98
|
+
* makes it the one a `max` never drops: an error, one with an action, one
|
|
99
|
+
* with no end (`"persistent"`, or text too long to read in `long`).
|
|
100
|
+
*/
|
|
101
|
+
export function toastStays(toast, defaultDuration) {
|
|
102
|
+
const title = toast.title?.trim() ?? "";
|
|
103
|
+
const message = toast.message.trim();
|
|
104
|
+
const textLength = (title || message).length + (title && message && message !== title ? message.length : 0);
|
|
105
|
+
return (resolveToastDuration({ duration: toast.duration, type: toast.type, hasAction: !!toast.action, textLength }, defaultDuration) === 0);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Ids of toasts that a `max` is dropping to make room for a newer one. Such a
|
|
109
|
+
* toast leaves at once, without the exit motion: a newer toast is coming in
|
|
110
|
+
* where it is, and the two would otherwise lie on each other for a moment.
|
|
111
|
+
*/
|
|
112
|
+
export const toastsReplaced = new Set();
|
|
113
|
+
/** The Material standard curve (`--ease-standard`), as an easing function for a script-driven slide. */
|
|
114
|
+
export function easeStandard(t) {
|
|
115
|
+
const [x1, y1, x2, y2] = [0.2, 0, 0, 1];
|
|
116
|
+
const at = (a, b, s) => 3 * a * (1 - s) ** 2 * s + 3 * b * (1 - s) * s ** 2 + s ** 3;
|
|
117
|
+
let lo = 0;
|
|
118
|
+
let hi = 1;
|
|
119
|
+
let s = t;
|
|
120
|
+
for (let i = 0; i < 20; i++) {
|
|
121
|
+
s = (lo + hi) / 2;
|
|
122
|
+
if (at(x1, x2, s) < t)
|
|
123
|
+
lo = s;
|
|
124
|
+
else
|
|
125
|
+
hi = s;
|
|
126
|
+
}
|
|
127
|
+
return at(y1, y2, s);
|
|
128
|
+
}
|
|
129
|
+
/** A toast dragged further than this share of its width is dismissed, flick or not. */
|
|
130
|
+
export const TOAST_SWIPE_DISMISS_FRACTION = 0.4;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SurfaceTone } from "../types/variants.js";
|
|
2
|
+
export type ToneSurfaceOptions = {
|
|
3
|
+
tone?: SurfaceTone;
|
|
4
|
+
/** Any CSS colour for a fill the app chooses, such as `var(--group-colour)`. Wins over `tone`. */
|
|
5
|
+
fill?: string;
|
|
6
|
+
/** The label colour on `fill`, any CSS colour. Without it the label is the block's own text colour. */
|
|
7
|
+
onFill?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ToneSurface = {
|
|
10
|
+
/** Utility classes for the fill and its on-colour scope; empty for `neutral`. */
|
|
11
|
+
classes: string;
|
|
12
|
+
/** Inline style for a custom fill, or undefined. */
|
|
13
|
+
style: string | undefined;
|
|
14
|
+
/** True when the surface is filled by tone or by `fill`, so the fill is its edge. */
|
|
15
|
+
filled: boolean;
|
|
16
|
+
/** True when the fill is the brand, the accent or a custom colour (the on-colour scope applies). */
|
|
17
|
+
scoped: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The classes and the inline style for a filled surface, shared by Card and Block.
|
|
21
|
+
*
|
|
22
|
+
* - `neutral` (the default): nothing, the component paints what it always did.
|
|
23
|
+
* - `tint`: the brand tint as a content surface. Text, links and rings are
|
|
24
|
+
* guarded on it, so it needs no on-colour scope.
|
|
25
|
+
* - `brand` / `accent`: the fill and its `on-brand` / `on-accent` scope.
|
|
26
|
+
* - `fill`: the app's own colour. Wins over `tone`. The scope is `on-fill`,
|
|
27
|
+
* with `onFill` as the label colour.
|
|
28
|
+
*
|
|
29
|
+
* The library cannot check the contrast of a `fill` and `onFill` pair: it is
|
|
30
|
+
* a colour the app picks at run time, so the app must hold the label to 4.5:1
|
|
31
|
+
* on the fill (3:1 for edges and focus rings).
|
|
32
|
+
*/
|
|
33
|
+
export declare function toneSurface({ tone, fill, onFill }: ToneSurfaceOptions): ToneSurface;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The classes and the inline style for a filled surface, shared by Card and Block.
|
|
3
|
+
*
|
|
4
|
+
* - `neutral` (the default): nothing, the component paints what it always did.
|
|
5
|
+
* - `tint`: the brand tint as a content surface. Text, links and rings are
|
|
6
|
+
* guarded on it, so it needs no on-colour scope.
|
|
7
|
+
* - `brand` / `accent`: the fill and its `on-brand` / `on-accent` scope.
|
|
8
|
+
* - `fill`: the app's own colour. Wins over `tone`. The scope is `on-fill`,
|
|
9
|
+
* with `onFill` as the label colour.
|
|
10
|
+
*
|
|
11
|
+
* The library cannot check the contrast of a `fill` and `onFill` pair: it is
|
|
12
|
+
* a colour the app picks at run time, so the app must hold the label to 4.5:1
|
|
13
|
+
* on the fill (3:1 for edges and focus rings).
|
|
14
|
+
*/
|
|
15
|
+
export function toneSurface({ tone = "neutral", fill, onFill }) {
|
|
16
|
+
if (fill) {
|
|
17
|
+
const parts = [`background-color: ${fill}`];
|
|
18
|
+
// --zabi-fill is the colour a solid control inside is lettered in when
|
|
19
|
+
// the scope inverts it; see `--zabi-inv-primary-text` in app.css.
|
|
20
|
+
parts.push(`--zabi-fill: ${fill}`);
|
|
21
|
+
if (onFill)
|
|
22
|
+
parts.push(`--zabi-on-fill: ${onFill}`);
|
|
23
|
+
return { classes: "on-fill", style: parts.join("; "), filled: true, scoped: true };
|
|
24
|
+
}
|
|
25
|
+
switch (tone) {
|
|
26
|
+
case "tint":
|
|
27
|
+
return { classes: "bg-card-tint", style: undefined, filled: true, scoped: false };
|
|
28
|
+
case "brand":
|
|
29
|
+
return { classes: "bg-action-primary on-brand", style: undefined, filled: true, scoped: true };
|
|
30
|
+
case "accent":
|
|
31
|
+
return { classes: "bg-accent on-accent", style: undefined, filled: true, scoped: true };
|
|
32
|
+
default:
|
|
33
|
+
return { classes: "", style: undefined, filled: false, scoped: false };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One tooltip at a time. A tooltip that opens closes the one that was open: a
|
|
3
|
+
* mouse resting on one trigger while Tab moves focus to another would
|
|
4
|
+
* otherwise show both, one of them stale.
|
|
5
|
+
*/
|
|
6
|
+
/** Called by a tooltip as it opens, with what closes it. Closes any other. */
|
|
7
|
+
export declare function claimOpenTooltip(close: () => void): void;
|
|
8
|
+
/** Called by a tooltip as it closes or goes. */
|
|
9
|
+
export declare function releaseOpenTooltip(close: () => void): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One tooltip at a time. A tooltip that opens closes the one that was open: a
|
|
3
|
+
* mouse resting on one trigger while Tab moves focus to another would
|
|
4
|
+
* otherwise show both, one of them stale.
|
|
5
|
+
*/
|
|
6
|
+
/** The tooltip that is open, as the function that closes it. */
|
|
7
|
+
let closeOpen = null;
|
|
8
|
+
/** Called by a tooltip as it opens, with what closes it. Closes any other. */
|
|
9
|
+
export function claimOpenTooltip(close) {
|
|
10
|
+
if (closeOpen && closeOpen !== close)
|
|
11
|
+
closeOpen();
|
|
12
|
+
closeOpen = close;
|
|
13
|
+
}
|
|
14
|
+
/** Called by a tooltip as it closes or goes. */
|
|
15
|
+
export function releaseOpenTooltip(close) {
|
|
16
|
+
if (closeOpen === close)
|
|
17
|
+
closeOpen = null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The words `TopNavbar` says by itself. Pass any of them as `strings`. */
|
|
2
|
+
export interface TopNavbarStrings {
|
|
3
|
+
/** Accessible name of the phone menu's button while the menu is closed. */
|
|
4
|
+
openMenu: string;
|
|
5
|
+
/** The same button, while the inline menu is open (the sheet's own button closes it). */
|
|
6
|
+
closeMenu: string;
|
|
7
|
+
/** The phone menu's sheet: its heading and its accessible name, and the name of the links' `nav` when the bar has no `ariaLabel`. */
|
|
8
|
+
menuTitle?: string;
|
|
9
|
+
/** The heading over the theme choice in the phone menu's sheet. */
|
|
10
|
+
themeHeading?: string;
|
|
11
|
+
/** Read after the label of a link that opens in a new tab. */
|
|
12
|
+
opensInNewTab: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Every word, including the optional ones: `menuTitle` and `themeHeading` are
|
|
16
|
+
* optional in `TopNavbarStrings` so that code written before they existed, with
|
|
17
|
+
* a complete object, still type-checks.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_TOP_NAVBAR_STRINGS: Required<TopNavbarStrings>;
|
|
20
|
+
/**
|
|
21
|
+
* Where a piece of the bar's `actions` is drawn: in the `bar`, or in the
|
|
22
|
+
* `menu` sheet that opens below `collapseAt`, where it has the full width.
|
|
23
|
+
*/
|
|
24
|
+
export type TopNavbarPlace = "bar" | "menu";
|
|
25
|
+
/** Called by the sheet's content: everything rendered inside it reads `"menu"`. */
|
|
26
|
+
export declare function markTopNavbarPlace(place: TopNavbarPlace): void;
|
|
27
|
+
/**
|
|
28
|
+
* Where the component calling this is drawn. Call it while the component
|
|
29
|
+
* initialises. A control in a TopNavbar's `actions` snippet can then draw
|
|
30
|
+
* itself large in the sheet and compact in the bar, with no argument to the
|
|
31
|
+
* snippet: `{#snippet actions()}<MyPicker />{/snippet}` keeps working. Outside
|
|
32
|
+
* a TopNavbar, in the bar and in `menu="inline"` it is `"bar"`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getTopNavbarPlace(): TopNavbarPlace;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getContext, setContext } from "svelte";
|
|
2
|
+
/**
|
|
3
|
+
* Every word, including the optional ones: `menuTitle` and `themeHeading` are
|
|
4
|
+
* optional in `TopNavbarStrings` so that code written before they existed, with
|
|
5
|
+
* a complete object, still type-checks.
|
|
6
|
+
*/
|
|
7
|
+
export const DEFAULT_TOP_NAVBAR_STRINGS = {
|
|
8
|
+
openMenu: "Open menu",
|
|
9
|
+
closeMenu: "Close menu",
|
|
10
|
+
menuTitle: "Menu",
|
|
11
|
+
themeHeading: "Theme",
|
|
12
|
+
opensInNewTab: "(opens in a new tab)",
|
|
13
|
+
};
|
|
14
|
+
const TOP_NAVBAR_PLACE = Symbol.for("zabi-components.top-navbar-place");
|
|
15
|
+
/** Called by the sheet's content: everything rendered inside it reads `"menu"`. */
|
|
16
|
+
export function markTopNavbarPlace(place) {
|
|
17
|
+
setContext(TOP_NAVBAR_PLACE, place);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Where the component calling this is drawn. Call it while the component
|
|
21
|
+
* initialises. A control in a TopNavbar's `actions` snippet can then draw
|
|
22
|
+
* itself large in the sheet and compact in the bar, with no argument to the
|
|
23
|
+
* snippet: `{#snippet actions()}<MyPicker />{/snippet}` keeps working. Outside
|
|
24
|
+
* a TopNavbar, in the bar and in `menu="inline"` it is `"bar"`.
|
|
25
|
+
*/
|
|
26
|
+
export function getTopNavbarPlace() {
|
|
27
|
+
return getContext(TOP_NAVBAR_PLACE) ?? "bar";
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Touch targets: 44 by 44px on a coarse pointer, nothing changed on a fine one.
|
|
3
|
+
*
|
|
4
|
+
* There are two ways to get there, and which one a control takes depends on
|
|
5
|
+
* what stands beside it.
|
|
6
|
+
*
|
|
7
|
+
* 1. The control itself grows: `pointer-coarse:min-h-11` (and `min-w-11` for a
|
|
8
|
+
* square one), written where the size is. Button, IconButton, Input and
|
|
9
|
+
* Select do this at `sm` and `md`, so a row of them still lines up; so does
|
|
10
|
+
* any control that has a neighbour close by (the handle and the move
|
|
11
|
+
* buttons of a SortableList row). `scripts/check-control-geometry.js` holds
|
|
12
|
+
* the shared controls to it.
|
|
13
|
+
*
|
|
14
|
+
* 2. The control keeps its size and an invisible layer around it takes the
|
|
15
|
+
* touch: `TOUCH_HIT_AREA` below. Only for a control that stands alone, with
|
|
16
|
+
* nothing pressable within about 10px: a close button in the corner of an
|
|
17
|
+
* Alert or in the header of a Modal, the switch of a Toggle. The layer
|
|
18
|
+
* reaches past the visible box, so beside another control it would cover
|
|
19
|
+
* that control's edge and a tap there would fire the wrong one. An `xs`
|
|
20
|
+
* IconButton had such a layer and lost it for that reason. A Toggle is
|
|
21
|
+
* stacked in settings lists, so its row is 44px tall on a coarse pointer:
|
|
22
|
+
* the layer of one switch then never reaches the switch above or below.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* An invisible hit area of at least 44 by 44px, centred on the element, on a
|
|
26
|
+
* coarse pointer only. The element must be positioned (`relative`, `absolute`
|
|
27
|
+
* or `fixed`; `pointer-coarse:relative` where it was not positioned before, so
|
|
28
|
+
* a fine pointer sees no change) and must not clip its overflow.
|
|
29
|
+
*/
|
|
30
|
+
export declare const TOUCH_HIT_AREA = "pointer-coarse:before:absolute pointer-coarse:before:top-1/2 pointer-coarse:before:left-1/2 pointer-coarse:before:size-full pointer-coarse:before:min-h-11 pointer-coarse:before:min-w-11 pointer-coarse:before:-translate-x-1/2 pointer-coarse:before:-translate-y-1/2 pointer-coarse:before:content-['']";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Touch targets: 44 by 44px on a coarse pointer, nothing changed on a fine one.
|
|
3
|
+
*
|
|
4
|
+
* There are two ways to get there, and which one a control takes depends on
|
|
5
|
+
* what stands beside it.
|
|
6
|
+
*
|
|
7
|
+
* 1. The control itself grows: `pointer-coarse:min-h-11` (and `min-w-11` for a
|
|
8
|
+
* square one), written where the size is. Button, IconButton, Input and
|
|
9
|
+
* Select do this at `sm` and `md`, so a row of them still lines up; so does
|
|
10
|
+
* any control that has a neighbour close by (the handle and the move
|
|
11
|
+
* buttons of a SortableList row). `scripts/check-control-geometry.js` holds
|
|
12
|
+
* the shared controls to it.
|
|
13
|
+
*
|
|
14
|
+
* 2. The control keeps its size and an invisible layer around it takes the
|
|
15
|
+
* touch: `TOUCH_HIT_AREA` below. Only for a control that stands alone, with
|
|
16
|
+
* nothing pressable within about 10px: a close button in the corner of an
|
|
17
|
+
* Alert or in the header of a Modal, the switch of a Toggle. The layer
|
|
18
|
+
* reaches past the visible box, so beside another control it would cover
|
|
19
|
+
* that control's edge and a tap there would fire the wrong one. An `xs`
|
|
20
|
+
* IconButton had such a layer and lost it for that reason. A Toggle is
|
|
21
|
+
* stacked in settings lists, so its row is 44px tall on a coarse pointer:
|
|
22
|
+
* the layer of one switch then never reaches the switch above or below.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* An invisible hit area of at least 44 by 44px, centred on the element, on a
|
|
26
|
+
* coarse pointer only. The element must be positioned (`relative`, `absolute`
|
|
27
|
+
* or `fixed`; `pointer-coarse:relative` where it was not positioned before, so
|
|
28
|
+
* a fine pointer sees no change) and must not clip its overflow.
|
|
29
|
+
*/
|
|
30
|
+
export const TOUCH_HIT_AREA = "pointer-coarse:before:absolute pointer-coarse:before:top-1/2 pointer-coarse:before:left-1/2 pointer-coarse:before:size-full pointer-coarse:before:min-h-11 pointer-coarse:before:min-w-11 pointer-coarse:before:-translate-x-1/2 pointer-coarse:before:-translate-y-1/2 pointer-coarse:before:content-['']";
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { AvatarGroupStrings } from "./avatar.js";
|
|
2
|
+
import type { CalendarStrings } from "./calendar.js";
|
|
3
|
+
import type { DateFieldStrings, TimeFieldStrings } from "./temporal-field.js";
|
|
4
|
+
import type { MediaGridStrings } from "./media-grid.js";
|
|
5
|
+
import type { CodeFieldStrings } from "./code-field.js";
|
|
6
|
+
import type { PhotoGridStrings, PhotoViewerStrings } from "./photo.js";
|
|
7
|
+
import type { ProgressStrings } from "./progress.js";
|
|
8
|
+
import type { PullToRefreshStrings } from "./pull-to-refresh.js";
|
|
9
|
+
import type { RatingStrings } from "./rating.js";
|
|
10
|
+
import type { ColorPickerStrings, ComponentDemoStrings, ContactFormStrings, PropsTableStrings } from "./ready-made-strings.js";
|
|
11
|
+
import type { SelectStrings } from "./select.js";
|
|
12
|
+
import type { SkeletonStrings } from "./skeleton.js";
|
|
13
|
+
import type { SidebarAccountPanelStrings, SidebarBrandHeaderStrings, SidebarFooterStrings, SidebarNavigationStrings } from "./sidebar.js";
|
|
14
|
+
import type { SortableListStrings } from "./sortable-list.js";
|
|
15
|
+
import type { StepperStrings } from "./stepper.js";
|
|
16
|
+
import type { SwipeableListItemStrings } from "./swipeable-list-item.js";
|
|
17
|
+
import type { ThemeToggleLabels } from "./theme-mode.js";
|
|
18
|
+
import type { ToasterStrings } from "./toaster.js";
|
|
19
|
+
import type { TopNavbarStrings } from "./top-navbar.js";
|
|
20
|
+
/**
|
|
21
|
+
* The few words that many components' single-text props default to. A
|
|
22
|
+
* component whose prop is not given says the one here.
|
|
23
|
+
*/
|
|
24
|
+
export interface ZabiCommonStrings {
|
|
25
|
+
/** The close button of a dialog, a drawer or a sheet (`closeLabel`). */
|
|
26
|
+
close: string;
|
|
27
|
+
/** AppBar's back control (`backLabel`). */
|
|
28
|
+
back: string;
|
|
29
|
+
/** A sheet's grip while it takes the sheet up a step (`expandLabel`). */
|
|
30
|
+
expand: string;
|
|
31
|
+
/** The same, while it takes it down (`collapseLabel`). */
|
|
32
|
+
collapse: string;
|
|
33
|
+
/** Read after the label of a required field (FormField's `requiredLabel`). */
|
|
34
|
+
required: string;
|
|
35
|
+
/** The button in a password field that shows what was typed (Input's `revealLabel`). */
|
|
36
|
+
showPassword: string;
|
|
37
|
+
/** Placeholder of a search field in a sidebar (`searchPlaceholder`). */
|
|
38
|
+
search: string;
|
|
39
|
+
/** ConfirmDialog's confirming button (`confirmLabel`). */
|
|
40
|
+
confirm: string;
|
|
41
|
+
/** ConfirmDialog's other button (`cancelLabel`). */
|
|
42
|
+
cancel: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const DEFAULT_ZABI_COMMON_STRINGS: ZabiCommonStrings;
|
|
45
|
+
/** Toast's own text: `closeLabel`. */
|
|
46
|
+
export interface ToastTexts {
|
|
47
|
+
closeLabel: string;
|
|
48
|
+
}
|
|
49
|
+
export declare const DEFAULT_TOAST_TEXTS: ToastTexts;
|
|
50
|
+
/** Alert's own text: `closeLabel`. */
|
|
51
|
+
export interface AlertTexts {
|
|
52
|
+
closeLabel: string;
|
|
53
|
+
}
|
|
54
|
+
export declare const DEFAULT_ALERT_TEXTS: AlertTexts;
|
|
55
|
+
/** CodeBlock's own texts: the copy button's name, and what is announced once copied. */
|
|
56
|
+
export interface CodeBlockTexts {
|
|
57
|
+
copyLabel: string;
|
|
58
|
+
copiedLabel: string;
|
|
59
|
+
}
|
|
60
|
+
export declare const DEFAULT_CODE_BLOCK_TEXTS: CodeBlockTexts;
|
|
61
|
+
/** ImageUpload's own texts, by the name of the prop each one is. */
|
|
62
|
+
export interface ImageUploadTexts {
|
|
63
|
+
placeholder: string;
|
|
64
|
+
browseText: string;
|
|
65
|
+
changeText: string;
|
|
66
|
+
removeText: string;
|
|
67
|
+
selectedText: string;
|
|
68
|
+
removedText: string;
|
|
69
|
+
errorTitle: string;
|
|
70
|
+
errorRecovery: string;
|
|
71
|
+
}
|
|
72
|
+
export declare const DEFAULT_IMAGE_UPLOAD_TEXTS: ImageUploadTexts;
|
|
73
|
+
/** UnsavedChangesBar's own texts, by the name of the prop each one is. */
|
|
74
|
+
export interface UnsavedChangesBarTexts {
|
|
75
|
+
message: string;
|
|
76
|
+
label: string;
|
|
77
|
+
saveLabel: string;
|
|
78
|
+
discardLabel: string;
|
|
79
|
+
}
|
|
80
|
+
export declare const DEFAULT_UNSAVED_CHANGES_BAR_TEXTS: UnsavedChangesBarTexts;
|
|
81
|
+
/** One optional entry per component that has words of its own, and `common`. */
|
|
82
|
+
export interface ZabiStrings {
|
|
83
|
+
common?: Partial<ZabiCommonStrings>;
|
|
84
|
+
alert?: Partial<AlertTexts>;
|
|
85
|
+
avatarGroup?: Partial<AvatarGroupStrings>;
|
|
86
|
+
calendar?: Partial<CalendarStrings>;
|
|
87
|
+
codeBlock?: Partial<CodeBlockTexts>;
|
|
88
|
+
codeField?: Partial<CodeFieldStrings>;
|
|
89
|
+
colorPicker?: Partial<ColorPickerStrings>;
|
|
90
|
+
dateField?: Partial<DateFieldStrings>;
|
|
91
|
+
componentDemo?: Partial<ComponentDemoStrings>;
|
|
92
|
+
contactForm?: Partial<ContactFormStrings>;
|
|
93
|
+
imageUpload?: Partial<ImageUploadTexts>;
|
|
94
|
+
mediaGrid?: Partial<MediaGridStrings>;
|
|
95
|
+
photoGrid?: Partial<PhotoGridStrings>;
|
|
96
|
+
photoViewer?: Partial<PhotoViewerStrings>;
|
|
97
|
+
propsTable?: Partial<PropsTableStrings>;
|
|
98
|
+
progress?: Partial<ProgressStrings>;
|
|
99
|
+
pullToRefresh?: Partial<PullToRefreshStrings>;
|
|
100
|
+
rating?: Partial<RatingStrings>;
|
|
101
|
+
select?: Partial<SelectStrings>;
|
|
102
|
+
skeleton?: Partial<SkeletonStrings>;
|
|
103
|
+
sidebarAccountPanel?: Partial<SidebarAccountPanelStrings>;
|
|
104
|
+
sidebarBrandHeader?: Partial<SidebarBrandHeaderStrings>;
|
|
105
|
+
sidebarFooter?: Partial<SidebarFooterStrings>;
|
|
106
|
+
sidebarNavigation?: Partial<SidebarNavigationStrings>;
|
|
107
|
+
sortableList?: Partial<SortableListStrings>;
|
|
108
|
+
stepper?: Partial<StepperStrings>;
|
|
109
|
+
swipeableListItem?: Partial<SwipeableListItemStrings>;
|
|
110
|
+
themeToggle?: Partial<ThemeToggleLabels>;
|
|
111
|
+
timeField?: Partial<TimeFieldStrings>;
|
|
112
|
+
toast?: Partial<ToastTexts>;
|
|
113
|
+
toaster?: Partial<ToasterStrings>;
|
|
114
|
+
topNavbar?: Partial<TopNavbarStrings>;
|
|
115
|
+
unsavedChangesBar?: Partial<UnsavedChangesBarTexts>;
|
|
116
|
+
}
|
|
117
|
+
/** What the context holds: an object whose `current` is read when it is needed, so a change reaches every reader. */
|
|
118
|
+
export interface ZabiStringsContext {
|
|
119
|
+
readonly current: ZabiStrings;
|
|
120
|
+
}
|
|
121
|
+
/** `over` on top of `under`, entry by entry: an inner provider only replaces the words it gives. */
|
|
122
|
+
export declare function mergeZabiStrings(under: ZabiStrings | undefined, over: ZabiStrings | undefined): ZabiStrings;
|
|
123
|
+
/** For `ZabiStringsProvider`: the provider above this one, if any. Call while the component initialises. */
|
|
124
|
+
export declare function outerZabiStrings(): ZabiStringsContext | undefined;
|
|
125
|
+
/** For `ZabiStringsProvider`: makes `context` what everything below reads. */
|
|
126
|
+
export declare function provideZabiStrings(context: ZabiStringsContext): void;
|
|
127
|
+
/**
|
|
128
|
+
* The words of the provider this component is under, for app code that wants
|
|
129
|
+
* the same words elsewhere. Call it while the component initialises, and read
|
|
130
|
+
* `current` where the words are used (in the markup, or a `$derived`), so a
|
|
131
|
+
* change of language is followed. Outside a provider `current` is empty.
|
|
132
|
+
*/
|
|
133
|
+
export declare function getZabiStrings(): ZabiStringsContext;
|
|
134
|
+
/**
|
|
135
|
+
* A component's own entry: `zabiStringsFor("select")` returns a function that
|
|
136
|
+
* gives the provider's words for Select now, or undefined. Call it while the
|
|
137
|
+
* component initialises; call what it returns inside a `$derived`.
|
|
138
|
+
*/
|
|
139
|
+
export declare function zabiStringsFor<K extends Exclude<keyof ZabiStrings, "common">>(key: K): () => ZabiStrings[K];
|
|
140
|
+
/** The common words with their defaults filled in, the same way. */
|
|
141
|
+
export declare function zabiCommonStrings(): () => ZabiCommonStrings;
|