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,142 @@
|
|
|
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;
|
|
142
|
+
//# sourceMappingURL=zabi-strings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zabi-strings.d.ts","sourceRoot":"","sources":["../../../src/components/util/zabi-strings.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,oBAA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*
|
|
7
|
+
* The stylesheet goes to --out, or to stdout. Everything else (warnings, the
|
|
8
|
+
* one-line summary) goes to stderr, so `zabi-theme … > file.css` stays clean.
|
|
9
|
+
*
|
|
10
|
+
* Exit codes: 0 done · 1 --strict and a role pair is below WCAG AA · 2 bad usage.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import { createTheme } from './index.js';
|
|
16
|
+
|
|
17
|
+
const HELP = `zabi-theme: generate brand tokens for zabi-components
|
|
18
|
+
|
|
19
|
+
Usage
|
|
20
|
+
zabi-theme --brand <hex> [--pin] [--accent <hex>] [--pin-accent] [--neutral <hex>]
|
|
21
|
+
[--neutral-chroma <n>] [--dark-primary brand|mirror]
|
|
22
|
+
[--out <file>] [--strict] [--set <token>=<value> ...]
|
|
23
|
+
[--set-light <token>=<value> ...] [--set-dark <token>=<value> ...]
|
|
24
|
+
|
|
25
|
+
Options
|
|
26
|
+
--brand <hex> Brand colour (required). Builds --zabi-brand-50 … 950.
|
|
27
|
+
--pin Put the exact brand colour on primary buttons (see below).
|
|
28
|
+
--accent <hex> Second brand colour. Builds --zabi-accent-50 … 950.
|
|
29
|
+
--pin-accent The same for the solid accent fill. Needs --accent.
|
|
30
|
+
--neutral <hex> Tints the 21-step neutral ramp, --zabi-base-50 … 950.
|
|
31
|
+
--neutral-chroma <n>
|
|
32
|
+
Chroma at the neutral ramp's peak, 0 to 0.1 (OKLCH). Default: the
|
|
33
|
+
hue of --neutral at most 0.03. Use 0.04 to 0.06 for a clearly
|
|
34
|
+
tinted neutral. Needs --neutral. With it, the ink roles (secondary
|
|
35
|
+
button, hover and pressed tints, overlay edge, shadow colour)
|
|
36
|
+
follow the neutral ramp instead of staying grey.
|
|
37
|
+
--dark-primary <brand|mirror>
|
|
38
|
+
Dark primary and danger fills. brand (default): the same steps as
|
|
39
|
+
light, with a white label. mirror: the 8.1 pale mirrored steps.
|
|
40
|
+
--out <file> Write the CSS here. Without it the CSS goes to stdout.
|
|
41
|
+
--strict Exit 1 when any role pair is below WCAG AA.
|
|
42
|
+
--set <t>=<v> Also write this declaration, e.g. --set "--color-link=var(--color-brand-800)".
|
|
43
|
+
Repeatable. It applies in light and dark and is contrast-checked.
|
|
44
|
+
--set-light <t>=<v>
|
|
45
|
+
The same, for light only. Dark keeps the library's own value for that
|
|
46
|
+
token: the file restates it under the dark selectors. Repeatable.
|
|
47
|
+
--set-dark <t>=<v>
|
|
48
|
+
The same, for dark only. Repeatable. A token given to --set and to
|
|
49
|
+
--set-light or --set-dark: the mode-specific value wins in its mode.
|
|
50
|
+
--help Show this text.
|
|
51
|
+
|
|
52
|
+
Each ramp is built on the library's lightness curve. Your colour supplies hue
|
|
53
|
+
and chroma and is not pinned to a step, so the exact hex may not appear in the
|
|
54
|
+
file; the header says which step is closest.
|
|
55
|
+
|
|
56
|
+
With --pin the ramp is the same, and the primary action is the exact colour in
|
|
57
|
+
light: the fill, its hover and pressed states, and where they still pass, the
|
|
58
|
+
focus ring and links. The label is white or the ramp's dark end, whichever
|
|
59
|
+
reaches 4.5:1. Dark takes the colour only if it passes there; otherwise dark
|
|
60
|
+
keeps the ramp, and the header says so. A pair that fails is reported, and
|
|
61
|
+
the colour is never moved to make it pass.
|
|
62
|
+
|
|
63
|
+
Import the file after the theme:
|
|
64
|
+
@import "zabi-components/theme-only";
|
|
65
|
+
@import "zabi-components/theme-dark-only";
|
|
66
|
+
@import "./brand.generated.css";
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
const VALUE_OPTIONS = ['brand', 'accent', 'neutral', 'neutral-chroma', 'dark-primary', 'out'];
|
|
70
|
+
const FLAG_OPTIONS = ['strict', 'help', 'pin', 'pin-accent'];
|
|
71
|
+
|
|
72
|
+
function usageError(message) {
|
|
73
|
+
process.stderr.write(`zabi-theme: ${message}\nRun "zabi-theme --help" for usage.\n`);
|
|
74
|
+
process.exit(2);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function parseArgs(argv) {
|
|
78
|
+
const options = {};
|
|
79
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
80
|
+
const arg = argv[i];
|
|
81
|
+
if (arg === '-h') { options.help = true; continue; }
|
|
82
|
+
if (!arg.startsWith('--')) usageError(`unexpected argument "${arg}"`);
|
|
83
|
+
const [name, inline] = arg.slice(2).split(/=(.*)/s, 2);
|
|
84
|
+
if (name === 'set' || name === 'set-light' || name === 'set-dark') {
|
|
85
|
+
// The value is itself a custom property name, so it starts with "--".
|
|
86
|
+
const pair = inline !== undefined ? inline : argv[(i += 1)];
|
|
87
|
+
const match = /^(--[\w-]+)\s*[=:]\s*(.+)$/s.exec(pair ?? '');
|
|
88
|
+
if (!match) usageError(`--${name} needs <token>=<value>, for example --${name} "--color-link=var(--color-brand-800)"`);
|
|
89
|
+
// `--set` alone stays the flat map; a mode flag adds its own map.
|
|
90
|
+
const key = name === 'set' ? 'both' : name === 'set-light' ? 'light' : 'dark';
|
|
91
|
+
options.modes = { ...options.modes, [key]: { ...options.modes?.[key], [match[1]]: match[2].trim() } };
|
|
92
|
+
} else if (FLAG_OPTIONS.includes(name)) {
|
|
93
|
+
if (inline !== undefined) usageError(`--${name} takes no value`);
|
|
94
|
+
options[name] = true;
|
|
95
|
+
} else if (VALUE_OPTIONS.includes(name)) {
|
|
96
|
+
const value = inline !== undefined ? inline : argv[(i += 1)];
|
|
97
|
+
if (value === undefined || value === '' || (inline === undefined && value.startsWith('--'))) {
|
|
98
|
+
usageError(`--${name} needs a value`);
|
|
99
|
+
}
|
|
100
|
+
options[name] = value;
|
|
101
|
+
} else {
|
|
102
|
+
usageError(`unknown option "--${name}"`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return options;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function parseChroma(text) {
|
|
109
|
+
const value = Number(text);
|
|
110
|
+
if (text.trim() === '' || !Number.isFinite(value)) usageError(`--neutral-chroma must be a number such as 0.05 (got "${text}")`);
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const options = parseArgs(process.argv.slice(2));
|
|
115
|
+
|
|
116
|
+
if (options.help) {
|
|
117
|
+
process.stdout.write(HELP);
|
|
118
|
+
process.exit(0);
|
|
119
|
+
}
|
|
120
|
+
if (!options.brand) usageError('--brand is required, for example --brand "#0026EA"');
|
|
121
|
+
|
|
122
|
+
let result;
|
|
123
|
+
try {
|
|
124
|
+
result = createTheme({
|
|
125
|
+
brand: options.brand,
|
|
126
|
+
accent: options.accent,
|
|
127
|
+
neutral: options.neutral,
|
|
128
|
+
// Left out when not asked for, so the options are what they always were.
|
|
129
|
+
...(options['neutral-chroma'] !== undefined ? { neutralChroma: parseChroma(options['neutral-chroma']) } : {}),
|
|
130
|
+
...(options['dark-primary'] !== undefined ? { darkPrimary: options['dark-primary'] } : {}),
|
|
131
|
+
// `--set` alone is the flat map, as it always was; a mode flag makes it { light, dark, both }.
|
|
132
|
+
overrides: options.modes && (options.modes.light || options.modes.dark) ? options.modes : options.modes?.both,
|
|
133
|
+
// Left out when not asked for, so the options are what they always were.
|
|
134
|
+
...(options.pin || options['pin-accent'] ? { pin: { brand: !!options.pin, accent: !!options['pin-accent'] } } : {}),
|
|
135
|
+
});
|
|
136
|
+
} catch (error) {
|
|
137
|
+
if (error instanceof TypeError) usageError(error.message.replace(/^zabi-theme: /, ''));
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (options.out) {
|
|
142
|
+
const target = path.resolve(options.out);
|
|
143
|
+
try {
|
|
144
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
145
|
+
fs.writeFileSync(target, result.css, 'utf8');
|
|
146
|
+
} catch (error) {
|
|
147
|
+
usageError(`could not write ${options.out}: ${error.message}`);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
process.stdout.write(result.css);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const contrast = result.warnings.filter((warning) => warning.type === 'contrast');
|
|
154
|
+
for (const warning of result.warnings) {
|
|
155
|
+
process.stderr.write(`zabi-theme: warning: ${warning.message}\n`);
|
|
156
|
+
}
|
|
157
|
+
const closest = Object.entries(result.closest)
|
|
158
|
+
.map(([name, c]) => `${name} closest to step ${c.step}`)
|
|
159
|
+
.join(', ');
|
|
160
|
+
for (const [name, report] of Object.entries(result.pinned ?? {})) {
|
|
161
|
+
process.stderr.write(
|
|
162
|
+
`zabi-theme: ${name} ${report.hex} is pinned in light` +
|
|
163
|
+
(report.dark.pinned ? ' and in dark.\n' : '; dark keeps the ramp, because the colour fails there.\n'),
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
process.stderr.write(
|
|
167
|
+
`zabi-theme: ${options.out ? `wrote ${options.out}` : 'done'} (${closest}); ` +
|
|
168
|
+
(contrast.length === 0
|
|
169
|
+
? 'every role pair passes WCAG AA in light and dark.\n'
|
|
170
|
+
: `${contrast.length} role pair${contrast.length === 1 ? '' : 's'} below WCAG AA.\n`),
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
if (options.strict && contrast.length > 0) process.exit(1);
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/** A hex colour: `#rgb` or `#rrggbb`, with or without the `#`. */
|
|
2
|
+
export type HexColor = string;
|
|
3
|
+
|
|
4
|
+
/** A map of custom property names to values. */
|
|
5
|
+
export type TokenMap = Record<string, string>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Either one map for both modes, or `light`, `dark` and `both` maps. The two
|
|
9
|
+
* forms may be mixed: a `--token` key beside them counts as `both`.
|
|
10
|
+
*/
|
|
11
|
+
export type Overrides = TokenMap | ({ light?: TokenMap; dark?: TokenMap; both?: TokenMap } & { [token: `--${string}`]: string });
|
|
12
|
+
|
|
13
|
+
export interface CreateThemeOptions {
|
|
14
|
+
/**
|
|
15
|
+
* The brand colour. Supplies hue and chroma for `--zabi-brand-50 … 950`:
|
|
16
|
+
* primary actions, focus rings, links and brand tints.
|
|
17
|
+
*/
|
|
18
|
+
brand: HexColor;
|
|
19
|
+
/** Second brand colour, for `--zabi-accent-50 … 950`. Omitted: the library's citron. */
|
|
20
|
+
accent?: HexColor;
|
|
21
|
+
/**
|
|
22
|
+
* Tints the neutral ramp, `--zabi-base-50 … 950` (21 steps), toward this
|
|
23
|
+
* hue: text, borders, the page, cards and the dark surface levels. Only the
|
|
24
|
+
* hue and a little chroma are used. Omitted: the library's greys.
|
|
25
|
+
*/
|
|
26
|
+
neutral?: HexColor;
|
|
27
|
+
/**
|
|
28
|
+
* The OKLCH chroma at the neutral ramp's peak, `0` to `0.1`. Needs
|
|
29
|
+
* `neutral`, which still supplies the hue. Omitted: the ramp takes the hue
|
|
30
|
+
* of `neutral` at no more than 0.03 chroma, so it stays a tinted grey. For a
|
|
31
|
+
* clearly tinted neutral, such as a blue-slate UI, give 0.04 to 0.06. The
|
|
32
|
+
* profile across the 21 steps is the same; only its peak moves.
|
|
33
|
+
*
|
|
34
|
+
* With it, the translucent ink roles follow the neutral ramp instead of
|
|
35
|
+
* staying grey: `--color-action-secondary` (and `-hover`, `-active`),
|
|
36
|
+
* `--color-surface-hover`, `--color-surface-active` and
|
|
37
|
+
* `--color-border-overlay` become `color-mix()` of `--zabi-base-900` (light)
|
|
38
|
+
* or `--zabi-base-50` (dark) at their usual alphas, and `--shadow-color` is
|
|
39
|
+
* the ramp's step 900 in light. `--color-overlay` (the modal scrim) stays
|
|
40
|
+
* black. Dark values are written under the dark selectors, as with `pin`.
|
|
41
|
+
* Omitted: the output is exactly what it is without the option.
|
|
42
|
+
*
|
|
43
|
+
* The contrast check does not evaluate these translucent roles, with or
|
|
44
|
+
* without the option.
|
|
45
|
+
*/
|
|
46
|
+
neutralChroma?: number;
|
|
47
|
+
/**
|
|
48
|
+
* What the dark primary and danger fills are. `'brand'` (the default) is
|
|
49
|
+
* what the library does: the same steps as light (600, 700, 800) with a
|
|
50
|
+
* white label, so the main action keeps its colour in dark, and nothing
|
|
51
|
+
* extra is written. `'mirror'` restores the 8.1 behaviour: under the dark
|
|
52
|
+
* selectors the primary is the mirrored `--color-brand-600 | 700 | 800`
|
|
53
|
+
* (pale steps in dark), danger the mirrored `--color-error-600 | 700 | 800`,
|
|
54
|
+
* the label is chosen by the contrast check, and the control veil is the
|
|
55
|
+
* lighten-heavy 22% / 6%. A `dark` or `both` override of any of these roles
|
|
56
|
+
* wins over both settings. With `pin`, dark takes the pinned colour only
|
|
57
|
+
* when no guarded pair fails with it, and otherwise keeps what this option
|
|
58
|
+
* gives.
|
|
59
|
+
*/
|
|
60
|
+
darkPrimary?: 'brand' | 'mirror';
|
|
61
|
+
/**
|
|
62
|
+
* Extra declarations written after the ramps, for example
|
|
63
|
+
* `{ "--color-link": "var(--color-brand-800)" }`. They apply in light and in
|
|
64
|
+
* dark, and take part in the contrast check and in the choice of the "on"
|
|
65
|
+
* colours.
|
|
66
|
+
*
|
|
67
|
+
* Or per mode: `{ light, dark, both }`, each a map of the same shape.
|
|
68
|
+
* `both` is the flat form (flat keys beside the three also count as `both`).
|
|
69
|
+
* A token in `light` goes on `:root`, and the file restates the library's
|
|
70
|
+
* own dark value for it under the dark selectors, so dark does not move; a
|
|
71
|
+
* token in `dark` is written only under the dark selectors. A token set in
|
|
72
|
+
* `both` and in a mode takes the mode's value in that mode. The contrast
|
|
73
|
+
* check uses each mode's own values. A token the library defines no dark
|
|
74
|
+
* value for (or one you invented) cannot be put back in dark: it stays what
|
|
75
|
+
* `light` says there unless you also set it in `dark`.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* overrides: { light: { "--color-surface-raised": "#f8faff" } }
|
|
79
|
+
*/
|
|
80
|
+
overrides?: Overrides;
|
|
81
|
+
/**
|
|
82
|
+
* Put the exact colour on the solid fill, where the ramp would use its
|
|
83
|
+
* step 600. `true` pins the brand: in light, `--color-action-primary` is
|
|
84
|
+
* the hex you gave, with hover and pressed states derived from it and a
|
|
85
|
+
* label (white, or the ramp's dark end) that reaches 4.5:1 on all three.
|
|
86
|
+
* The focus ring and links take the colour too where every guarded pair
|
|
87
|
+
* still passes, and stay on the ramp where it would not. The ramp itself,
|
|
88
|
+
* and so every tint and border, is unchanged.
|
|
89
|
+
*
|
|
90
|
+
* Dark takes the colour only if nothing guarded fails with it; otherwise
|
|
91
|
+
* dark keeps the mirrored ramp step, as it does without `pin`.
|
|
92
|
+
*
|
|
93
|
+
* A pair that fails with the pinned colour is reported in `warnings`. The
|
|
94
|
+
* colour is never moved to make it pass.
|
|
95
|
+
*
|
|
96
|
+
* `{ accent: true }` does the same for `--color-accent` and needs `accent`.
|
|
97
|
+
* Omitted or `false`: the output is exactly what it is without the option.
|
|
98
|
+
*/
|
|
99
|
+
pin?: boolean | { brand?: boolean; accent?: boolean };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** A role pair below WCAG AA with the generated ramps in place. */
|
|
103
|
+
export interface ContrastWarning {
|
|
104
|
+
type: 'contrast';
|
|
105
|
+
/** The pair, as the library's contrast guard names it, e.g. `"link on page"`. */
|
|
106
|
+
pair: string;
|
|
107
|
+
mode: 'light' | 'dark';
|
|
108
|
+
/** Measured ratio, to two decimals. */
|
|
109
|
+
ratio: number;
|
|
110
|
+
/** 4.5 for text, 3 for UI parts and focus rings. */
|
|
111
|
+
required: number;
|
|
112
|
+
foreground: { token: string; value: string };
|
|
113
|
+
background: { token: string; value: string };
|
|
114
|
+
message: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** An input that will not give the ramp its author probably expects. */
|
|
118
|
+
/** What `pin` did with one colour. */
|
|
119
|
+
export interface PinReport {
|
|
120
|
+
/** The pinned colour, as `#rrggbb`. */
|
|
121
|
+
hex: string;
|
|
122
|
+
light: {
|
|
123
|
+
/** Role groups that took the colour besides the fill: `"focus ring"`, `"link"`, `"accent text"`. */
|
|
124
|
+
followed: string[];
|
|
125
|
+
/** Role groups left on the ramp, because the colour fails a guarded pair there. */
|
|
126
|
+
onRamp: string[];
|
|
127
|
+
/** Which way hover and pressed go from the fill. */
|
|
128
|
+
states: 'darker' | 'lighter';
|
|
129
|
+
};
|
|
130
|
+
dark: {
|
|
131
|
+
/** False when the colour fails in dark and dark keeps the ramp. */
|
|
132
|
+
pinned: boolean;
|
|
133
|
+
followed: string[];
|
|
134
|
+
onRamp: string[];
|
|
135
|
+
states?: 'darker' | 'lighter';
|
|
136
|
+
/** When not pinned: the pairs that would fail with the colour. */
|
|
137
|
+
failed?: string[];
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface InputWarning {
|
|
142
|
+
type: 'input';
|
|
143
|
+
option: 'brand' | 'accent' | 'neutral';
|
|
144
|
+
message: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type ThemeWarning = ContrastWarning | InputWarning;
|
|
148
|
+
|
|
149
|
+
/** Where an input colour landed in the ramp built from it. */
|
|
150
|
+
export interface ClosestStep {
|
|
151
|
+
step: number;
|
|
152
|
+
hex: string;
|
|
153
|
+
/** CIELAB ΔE*ab between the input and that step, to one decimal. */
|
|
154
|
+
deltaE: number;
|
|
155
|
+
exact: boolean;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface CreateThemeResult {
|
|
159
|
+
/**
|
|
160
|
+
* The stylesheet: a header comment and one `:root { … }` rule. With `pin`,
|
|
161
|
+
* `neutralChroma`, `darkPrimary: 'mirror'` or `light` / `dark` overrides, two more rules follow, with the dark values of those roles:
|
|
162
|
+
* `.dark, [data-theme="dark"] { … }` and the same declarations for
|
|
163
|
+
* `[data-theme="auto"]` inside `@media (prefers-color-scheme: dark)`.
|
|
164
|
+
*/
|
|
165
|
+
css: string;
|
|
166
|
+
/** Every declaration of the `:root` rule, name to value, in output order. */
|
|
167
|
+
tokens: Record<string, string>;
|
|
168
|
+
/** Only with `pin`, `neutralChroma`, `darkPrimary: 'mirror'` or `light` / `dark` overrides: every declaration of the dark rules. */
|
|
169
|
+
darkTokens?: Record<string, string>;
|
|
170
|
+
/** Only with `pin`: what was pinned and which roles took the colour. */
|
|
171
|
+
pinned?: { brand?: PinReport; accent?: PinReport };
|
|
172
|
+
/** Contrast failures and input notes. Empty when everything passes. */
|
|
173
|
+
warnings: ThemeWarning[];
|
|
174
|
+
closest: { brand: ClosestStep; accent?: ClosestStep; neutral?: ClosestStep };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Builds the ramps for a brand on the library's lightness curve and checks
|
|
179
|
+
* every guarded role pair in light and dark. Deterministic: the same options
|
|
180
|
+
* give the same bytes.
|
|
181
|
+
*
|
|
182
|
+
* @throws {TypeError} when `brand` is missing, a colour is not a hex value, `neutralChroma` is not a number from 0 to 0.1 or is given without `neutral`, or `darkPrimary` is not `'brand'` or `'mirror'`.
|
|
183
|
+
*/
|
|
184
|
+
export function createTheme(options: CreateThemeOptions): CreateThemeResult;
|
|
185
|
+
export default createTheme;
|
|
186
|
+
|
|
187
|
+
/** The steps of a chromatic ramp: 50, 100 … 900, 950. */
|
|
188
|
+
export const RAMP_STEPS: number[];
|
|
189
|
+
/** The 21 steps of the neutral ramp, half steps included. */
|
|
190
|
+
export const BASE_STEPS: number[];
|