zabi-components 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1924 -0
- package/README.md +243 -10
- package/THEME.md +149 -332
- package/THEMING.md +1192 -266
- package/dist/atoms/ActionPanel.svelte +15 -5
- package/dist/atoms/Avatar.svelte +104 -0
- package/dist/atoms/Avatar.svelte.d.ts +34 -0
- package/dist/atoms/Badge.svelte +36 -7
- package/dist/atoms/Badge.svelte.d.ts +2 -2
- package/dist/atoms/Button.svelte +177 -27
- package/dist/atoms/Button.svelte.d.ts +30 -2
- package/dist/atoms/Card.svelte +4 -4
- package/dist/atoms/CardHeader.svelte +16 -4
- package/dist/atoms/Checkbox.svelte +48 -21
- package/dist/atoms/Checkbox.svelte.d.ts +4 -2
- package/dist/atoms/CodeBlock.svelte +20 -2
- package/dist/atoms/CodeBlock.svelte.d.ts +4 -0
- package/dist/atoms/ColorPicker.svelte +259 -49
- package/dist/atoms/ColorPicker.svelte.d.ts +3 -0
- package/dist/atoms/Container.svelte +16 -8
- package/dist/atoms/DateField.svelte +107 -0
- package/dist/atoms/DateField.svelte.d.ts +53 -0
- package/dist/atoms/FieldMessages.svelte +69 -0
- package/dist/atoms/FieldMessages.svelte.d.ts +23 -0
- package/dist/atoms/FloatingActionButton.svelte +174 -0
- package/dist/atoms/FloatingActionButton.svelte.d.ts +51 -0
- package/dist/atoms/Heading.svelte +37 -5
- package/dist/atoms/Heading.svelte.d.ts +7 -0
- package/dist/atoms/IconButton.svelte +220 -24
- package/dist/atoms/IconButton.svelte.d.ts +49 -4
- package/dist/atoms/Input.svelte +253 -52
- package/dist/atoms/Input.svelte.d.ts +32 -2
- package/dist/atoms/List.svelte +4 -1
- package/dist/atoms/ListItem.svelte +44 -11
- package/dist/atoms/ListItem.svelte.d.ts +5 -0
- package/dist/atoms/Progress.svelte +27 -8
- package/dist/atoms/Progress.svelte.d.ts +4 -0
- package/dist/atoms/Radio.svelte +19 -3
- package/dist/atoms/Radio.svelte.d.ts +4 -2
- package/dist/atoms/Rating.svelte +494 -0
- package/dist/atoms/Rating.svelte.d.ts +56 -0
- package/dist/atoms/Select.svelte +433 -91
- package/dist/atoms/Select.svelte.d.ts +49 -3
- package/dist/atoms/SelectionControl.svelte +94 -17
- package/dist/atoms/SelectionControl.svelte.d.ts +4 -3
- package/dist/atoms/Skeleton.svelte +1 -1
- package/dist/atoms/Slider.svelte +309 -0
- package/dist/atoms/Slider.svelte.d.ts +40 -0
- package/dist/atoms/Spinner.svelte +57 -0
- package/dist/atoms/Spinner.svelte.d.ts +19 -0
- package/dist/atoms/Table.svelte +151 -6
- package/dist/atoms/Table.svelte.d.ts +15 -3
- package/dist/atoms/TemporalField.svelte +140 -0
- package/dist/atoms/TemporalField.svelte.d.ts +32 -0
- package/dist/atoms/Text.svelte +23 -11
- package/dist/atoms/Text.svelte.d.ts +6 -3
- package/dist/atoms/Textarea.svelte +55 -44
- package/dist/atoms/Textarea.svelte.d.ts +14 -2
- package/dist/atoms/ThemeToggle.svelte +223 -44
- package/dist/atoms/ThemeToggle.svelte.d.ts +26 -3
- package/dist/atoms/TimeField.svelte +108 -0
- package/dist/atoms/TimeField.svelte.d.ts +54 -0
- package/dist/atoms/Toast.svelte +17 -4
- package/dist/atoms/Toast.svelte.d.ts +2 -0
- package/dist/atoms/Toggle.svelte +41 -8
- package/dist/atoms/Toggle.svelte.d.ts +11 -2
- package/dist/atoms/Tooltip.svelte +508 -23
- package/dist/atoms/Tooltip.svelte.d.ts +11 -0
- package/dist/atoms/ZabiStringsProvider.svelte +45 -0
- package/dist/atoms/ZabiStringsProvider.svelte.d.ts +27 -0
- package/dist/atoms/index.d.ts +17 -0
- package/dist/atoms/index.js +12 -0
- package/dist/atoms/selection-control.styles.d.ts +36 -5
- package/dist/atoms/selection-control.styles.js +40 -9
- package/dist/components/atoms/index.d.ts +17 -0
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/atoms/selection-control.styles.d.ts +36 -5
- package/dist/components/atoms/selection-control.styles.d.ts.map +1 -1
- package/dist/components/index.d.ts +80 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/molecules/index.d.ts +46 -0
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/molecules/toast-store.d.ts +53 -7
- package/dist/components/molecules/toast-store.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +5 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/components/types/variants.d.ts +15 -1
- package/dist/components/types/variants.d.ts.map +1 -1
- package/dist/components/util/app-shell.d.ts +28 -0
- package/dist/components/util/app-shell.d.ts.map +1 -0
- package/dist/components/util/avatar.d.ts +36 -0
- package/dist/components/util/avatar.d.ts.map +1 -0
- package/dist/components/util/bottom-sheet.d.ts +30 -0
- package/dist/components/util/bottom-sheet.d.ts.map +1 -0
- package/dist/components/util/bottom-tab-bar.d.ts +35 -0
- package/dist/components/util/bottom-tab-bar.d.ts.map +1 -0
- package/dist/components/util/calendar.d.ts +56 -0
- package/dist/components/util/calendar.d.ts.map +1 -0
- package/dist/components/util/collapsible.d.ts +58 -0
- package/dist/components/util/collapsible.d.ts.map +1 -0
- package/dist/components/util/confirm-dialog.d.ts +12 -0
- package/dist/components/util/confirm-dialog.d.ts.map +1 -0
- package/dist/components/util/date.d.ts +96 -0
- package/dist/components/util/date.d.ts.map +1 -0
- package/dist/components/util/drawer.d.ts +13 -0
- package/dist/components/util/drawer.d.ts.map +1 -0
- package/dist/components/util/dropdown.d.ts +47 -0
- package/dist/components/util/dropdown.d.ts.map +1 -0
- package/dist/components/util/field.d.ts +39 -0
- package/dist/components/util/field.d.ts.map +1 -0
- package/dist/components/util/fit-in-viewport.d.ts +201 -0
- package/dist/components/util/fit-in-viewport.d.ts.map +1 -0
- package/dist/components/util/focus-utils.d.ts +75 -2
- package/dist/components/util/focus-utils.d.ts.map +1 -1
- package/dist/components/util/hydration.d.ts +45 -0
- package/dist/components/util/hydration.d.ts.map +1 -0
- package/dist/components/util/keyboard-inset.d.ts +18 -0
- package/dist/components/util/keyboard-inset.d.ts.map +1 -0
- package/dist/components/util/media-grid.d.ts +51 -0
- package/dist/components/util/media-grid.d.ts.map +1 -0
- package/dist/components/util/media.d.ts +6 -0
- package/dist/components/util/media.d.ts.map +1 -0
- package/dist/components/util/overlay-chrome.d.ts +53 -0
- package/dist/components/util/overlay-chrome.d.ts.map +1 -0
- package/dist/components/util/overlay.d.ts +72 -0
- package/dist/components/util/overlay.d.ts.map +1 -0
- package/dist/components/util/photo.d.ts +215 -0
- package/dist/components/util/photo.d.ts.map +1 -0
- package/dist/components/util/portal.d.ts +23 -0
- package/dist/components/util/portal.d.ts.map +1 -0
- package/dist/components/util/pull-to-refresh.d.ts +27 -0
- package/dist/components/util/pull-to-refresh.d.ts.map +1 -0
- package/dist/components/util/radio-keys.d.ts +25 -0
- package/dist/components/util/radio-keys.d.ts.map +1 -0
- package/dist/components/util/rating.d.ts +23 -0
- package/dist/components/util/rating.d.ts.map +1 -0
- package/dist/components/util/ready-made-strings.d.ts +77 -0
- package/dist/components/util/ready-made-strings.d.ts.map +1 -0
- package/dist/components/util/scroll-padding.d.ts +20 -0
- package/dist/components/util/scroll-padding.d.ts.map +1 -0
- package/dist/components/util/segmented-control.d.ts +16 -0
- package/dist/components/util/segmented-control.d.ts.map +1 -0
- package/dist/components/util/select.d.ts +41 -0
- package/dist/components/util/select.d.ts.map +1 -0
- package/dist/components/util/sheet-drag.d.ts +60 -0
- package/dist/components/util/sheet-drag.d.ts.map +1 -0
- package/dist/components/util/sidebar.d.ts +63 -0
- package/dist/components/util/sidebar.d.ts.map +1 -0
- package/dist/components/util/sortable-list.d.ts +65 -0
- package/dist/components/util/sortable-list.d.ts.map +1 -0
- package/dist/components/util/stepper.d.ts +40 -0
- package/dist/components/util/stepper.d.ts.map +1 -0
- package/dist/components/util/swipeable-list-item.d.ts +36 -0
- package/dist/components/util/swipeable-list-item.d.ts.map +1 -0
- package/dist/components/util/theme-mode.d.ts +80 -0
- package/dist/components/util/theme-mode.d.ts.map +1 -0
- package/dist/components/util/toaster.d.ts +93 -0
- package/dist/components/util/toaster.d.ts.map +1 -0
- package/dist/components/util/tooltip.d.ts +10 -0
- package/dist/components/util/tooltip.d.ts.map +1 -0
- package/dist/components/util/top-navbar.d.ts +11 -0
- package/dist/components/util/top-navbar.d.ts.map +1 -0
- package/dist/components/util/touch-target.d.ts +31 -0
- package/dist/components/util/touch-target.d.ts.map +1 -0
- package/dist/components/util/zabi-strings.d.ts +133 -0
- package/dist/components/util/zabi-strings.d.ts.map +1 -0
- package/dist/create-theme/cli.js +169 -0
- package/dist/create-theme/index.d.ts +176 -0
- package/dist/create-theme/index.js +817 -0
- package/dist/create-theme/lib/ramp-math.js +128 -0
- package/dist/create-theme/lib/resolve.js +141 -0
- package/dist/create-theme/theme-data.js +1116 -0
- package/dist/index.d.ts +80 -2
- package/dist/index.js +57 -2
- package/dist/molecules/Alert.svelte +33 -5
- package/dist/molecules/Alert.svelte.d.ts +2 -0
- package/dist/molecules/AppBar.svelte +415 -0
- package/dist/molecules/AppBar.svelte.d.ts +69 -0
- package/dist/molecules/AvatarGroup.svelte +116 -0
- package/dist/molecules/AvatarGroup.svelte.d.ts +40 -0
- package/dist/molecules/BottomSheet.svelte +540 -0
- package/dist/molecules/BottomSheet.svelte.d.ts +93 -0
- package/dist/molecules/BottomTabBar.svelte +297 -0
- package/dist/molecules/BottomTabBar.svelte.d.ts +64 -0
- package/dist/molecules/Calendar.svelte +597 -0
- package/dist/molecules/Calendar.svelte.d.ts +72 -0
- package/dist/molecules/Collapsible.svelte +243 -0
- package/dist/molecules/Collapsible.svelte.d.ts +44 -0
- package/dist/molecules/CollapsibleGroup.svelte +126 -0
- package/dist/molecules/CollapsibleGroup.svelte.d.ts +14 -0
- package/dist/molecules/ComponentDemo.svelte +16 -4
- package/dist/molecules/ComponentDemo.svelte.d.ts +3 -0
- package/dist/molecules/ConfirmDialog.svelte +253 -0
- package/dist/molecules/ConfirmDialog.svelte.d.ts +55 -0
- package/dist/molecules/ContactForm.svelte +34 -17
- package/dist/molecules/ContactForm.svelte.d.ts +8 -0
- package/dist/molecules/Drawer.svelte +394 -0
- package/dist/molecules/Drawer.svelte.d.ts +55 -0
- package/dist/molecules/Dropdown.svelte +509 -48
- package/dist/molecules/Dropdown.svelte.d.ts +45 -6
- package/dist/molecules/DropdownItem.svelte +122 -0
- package/dist/molecules/DropdownItem.svelte.d.ts +28 -0
- package/dist/molecules/EmptyState.svelte +55 -10
- package/dist/molecules/EmptyState.svelte.d.ts +8 -0
- package/dist/molecules/FormField.svelte +9 -1
- package/dist/molecules/FormField.svelte.d.ts +2 -0
- package/dist/molecules/Header.svelte +1 -1
- package/dist/molecules/ImageUpload.svelte +383 -70
- package/dist/molecules/ImageUpload.svelte.d.ts +47 -2
- package/dist/molecules/MediaGrid.svelte +527 -0
- package/dist/molecules/MediaGrid.svelte.d.ts +77 -0
- package/dist/molecules/Modal.svelte +288 -72
- package/dist/molecules/Modal.svelte.d.ts +51 -2
- package/dist/molecules/NavigationMenuContent.svelte +58 -1
- package/dist/molecules/NavigationMenuItem.svelte +0 -1
- package/dist/molecules/NavigationMenuLink.svelte +1 -1
- package/dist/molecules/NavigationMenuList.svelte +10 -3
- package/dist/molecules/NavigationMenuTrigger.svelte +2 -2
- package/dist/molecules/Page.svelte +32 -2
- package/dist/molecules/Page.svelte.d.ts +11 -0
- package/dist/molecules/PhotoGrid.svelte +433 -0
- package/dist/molecules/PhotoGrid.svelte.d.ts +62 -0
- package/dist/molecules/PhotoViewer.svelte +1116 -0
- package/dist/molecules/PhotoViewer.svelte.d.ts +56 -0
- package/dist/molecules/PropsTable.svelte +22 -10
- package/dist/molecules/PropsTable.svelte.d.ts +3 -0
- package/dist/molecules/PullToRefresh.svelte +263 -0
- package/dist/molecules/PullToRefresh.svelte.d.ts +52 -0
- package/dist/molecules/RadioGroup.svelte +52 -14
- package/dist/molecules/RadioGroup.svelte.d.ts +14 -3
- package/dist/molecules/Section.svelte +1 -1
- package/dist/molecules/SegmentedControl.svelte +323 -0
- package/dist/molecules/SegmentedControl.svelte.d.ts +34 -0
- package/dist/molecules/SidebarBrandHeader.svelte +11 -1
- package/dist/molecules/SidebarBrandHeader.svelte.d.ts +3 -0
- package/dist/molecules/SidebarFooter.svelte +29 -6
- package/dist/molecules/SidebarFooter.svelte.d.ts +3 -0
- package/dist/molecules/SlideUp.svelte +220 -61
- package/dist/molecules/SlideUp.svelte.d.ts +26 -0
- package/dist/molecules/SortableList.svelte +632 -0
- package/dist/molecules/SortableList.svelte.d.ts +69 -0
- package/dist/molecules/Stepper.svelte +548 -0
- package/dist/molecules/Stepper.svelte.d.ts +39 -0
- package/dist/molecules/StickyActionBar.svelte +191 -0
- package/dist/molecules/StickyActionBar.svelte.d.ts +65 -0
- package/dist/molecules/SwipeableListItem.svelte +334 -0
- package/dist/molecules/SwipeableListItem.svelte.d.ts +54 -0
- package/dist/molecules/Tabs.svelte +233 -9
- package/dist/molecules/Tabs.svelte.d.ts +7 -0
- package/dist/molecules/Toaster.svelte +350 -5
- package/dist/molecules/Toaster.svelte.d.ts +95 -2
- package/dist/molecules/ToasterToast.svelte +253 -67
- package/dist/molecules/ToasterToast.svelte.d.ts +9 -0
- package/dist/molecules/UnsavedChangesBar.svelte +212 -0
- package/dist/molecules/UnsavedChangesBar.svelte.d.ts +43 -0
- package/dist/molecules/index.d.ts +46 -0
- package/dist/molecules/index.js +27 -0
- package/dist/molecules/toast-store.d.ts +53 -7
- package/dist/molecules/toast-store.js +21 -0
- package/dist/organisms/AppShell.svelte +196 -0
- package/dist/organisms/AppShell.svelte.d.ts +61 -0
- package/dist/organisms/SidebarAccountPanel.svelte +107 -12
- package/dist/organisms/SidebarAccountPanel.svelte.d.ts +19 -0
- package/dist/organisms/SidebarNavigation.svelte +96 -15
- package/dist/organisms/SidebarNavigation.svelte.d.ts +29 -1
- package/dist/organisms/SidebarPanel.svelte +31 -10
- package/dist/organisms/SidebarShell.svelte +162 -11
- package/dist/organisms/SidebarShell.svelte.d.ts +56 -2
- package/dist/organisms/TopNavbar.svelte +256 -31
- package/dist/organisms/TopNavbar.svelte.d.ts +26 -0
- package/dist/organisms/index.d.ts +5 -0
- package/dist/organisms/index.js +3 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/types/components.d.ts.map +1 -1
- package/dist/types/index.d.ts +605 -25
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/variants.ts +17 -1
- package/dist/util/app-shell.d.ts +27 -0
- package/dist/util/app-shell.js +72 -0
- package/dist/util/avatar.d.ts +35 -0
- package/dist/util/avatar.js +52 -0
- package/dist/util/bottom-sheet.d.ts +29 -0
- package/dist/util/bottom-sheet.js +43 -0
- package/dist/util/bottom-tab-bar.d.ts +34 -0
- package/dist/util/bottom-tab-bar.js +54 -0
- package/dist/util/calendar.d.ts +55 -0
- package/dist/util/calendar.js +74 -0
- package/dist/util/collapsible.d.ts +57 -0
- package/dist/util/collapsible.js +23 -0
- package/dist/util/confirm-dialog.d.ts +11 -0
- package/dist/util/confirm-dialog.js +2 -0
- package/dist/util/date.d.ts +95 -0
- package/dist/util/date.js +237 -0
- package/dist/util/drawer.d.ts +12 -0
- package/dist/util/drawer.js +7 -0
- package/dist/util/dropdown.d.ts +46 -0
- package/dist/util/dropdown.js +21 -0
- package/dist/util/field.d.ts +38 -0
- package/dist/util/field.js +38 -0
- package/dist/util/fit-in-viewport.d.ts +200 -0
- package/dist/util/fit-in-viewport.js +399 -0
- package/dist/util/focus-utils.d.ts +75 -2
- package/dist/util/focus-utils.js +182 -9
- package/dist/util/hydration.d.ts +44 -0
- package/dist/util/hydration.js +58 -0
- package/dist/util/keyboard-inset.d.ts +17 -0
- package/dist/util/keyboard-inset.js +53 -0
- package/dist/util/media-grid.d.ts +50 -0
- package/dist/util/media-grid.js +81 -0
- package/dist/util/media.d.ts +5 -0
- package/dist/util/media.js +10 -0
- package/dist/util/overlay-chrome.d.ts +52 -0
- package/dist/util/overlay-chrome.js +56 -0
- package/dist/util/overlay.d.ts +71 -0
- package/dist/util/overlay.js +240 -0
- package/dist/util/photo.d.ts +214 -0
- package/dist/util/photo.js +206 -0
- package/dist/util/portal.d.ts +22 -0
- package/dist/util/portal.js +50 -0
- package/dist/util/pull-to-refresh.d.ts +26 -0
- package/dist/util/pull-to-refresh.js +30 -0
- package/dist/util/radio-keys.d.ts +24 -0
- package/dist/util/radio-keys.js +49 -0
- package/dist/util/rating.d.ts +22 -0
- package/dist/util/rating.js +26 -0
- package/dist/util/ready-made-strings.d.ts +76 -0
- package/dist/util/ready-made-strings.js +67 -0
- package/dist/util/scroll-padding.d.ts +19 -0
- package/dist/util/scroll-padding.js +44 -0
- package/dist/util/segmented-control.d.ts +15 -0
- package/dist/util/segmented-control.js +1 -0
- package/dist/util/select.d.ts +40 -0
- package/dist/util/select.js +63 -0
- package/dist/util/sheet-drag.d.ts +59 -0
- package/dist/util/sheet-drag.js +241 -0
- package/dist/util/sidebar.d.ts +62 -0
- package/dist/util/sidebar.js +38 -0
- package/dist/util/sortable-list.d.ts +64 -0
- package/dist/util/sortable-list.js +53 -0
- package/dist/util/stepper.d.ts +39 -0
- package/dist/util/stepper.js +38 -0
- package/dist/util/swipeable-list-item.d.ts +35 -0
- package/dist/util/swipeable-list-item.js +32 -0
- package/dist/util/theme-mode.d.ts +79 -0
- package/dist/util/theme-mode.js +121 -0
- package/dist/util/toaster.d.ts +92 -0
- package/dist/util/toaster.js +75 -0
- package/dist/util/tooltip.d.ts +9 -0
- package/dist/util/tooltip.js +18 -0
- package/dist/util/top-navbar.d.ts +10 -0
- package/dist/util/top-navbar.js +5 -0
- package/dist/util/touch-target.d.ts +30 -0
- package/dist/util/touch-target.js +30 -0
- package/dist/util/zabi-strings.d.ts +132 -0
- package/dist/util/zabi-strings.js +105 -0
- package/dist/zabi-components-colors.css +5 -2
- package/dist/zabi-components-theme-dark-only.css +543 -241
- package/dist/zabi-components-theme-dark.css +543 -241
- package/dist/zabi-components-theme-only.css +1584 -367
- package/dist/zabi-components-theme.css +1584 -367
- package/dist/zabi-components.css +3885 -518
- package/docs/lucide-icons.md +40 -17
- package/docs/theme-imports.md +81 -11
- package/package.json +35 -8
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types and pure helpers for `PhotoGrid` and `PhotoViewer`.
|
|
3
|
+
*
|
|
4
|
+
* Everything a gesture means is worked out here, on numbers: where a pinch
|
|
5
|
+
* leaves the photo, how far it may be panned, whether a swipe turns the page.
|
|
6
|
+
* The components only feed pointers in and apply the result, so the
|
|
7
|
+
* arithmetic can be tested without a browser.
|
|
8
|
+
*/
|
|
9
|
+
import type { Component } from "svelte";
|
|
10
|
+
export type PhotoKey = string | number;
|
|
11
|
+
/** One photo. `PhotoGrid` and `PhotoViewer` take the same array. */
|
|
12
|
+
export interface Photo {
|
|
13
|
+
/** Stable identity, when the same `src` may appear twice or may change. Without it, `src` is the identity. */
|
|
14
|
+
id?: PhotoKey;
|
|
15
|
+
/** The full image, shown in the viewer. */
|
|
16
|
+
src: string;
|
|
17
|
+
/** A small version for the grid, and for the viewer while the full image loads. Without it, `src`. */
|
|
18
|
+
thumbSrc?: string;
|
|
19
|
+
/** What the photo shows, for those who cannot see it. */
|
|
20
|
+
alt: string;
|
|
21
|
+
/** Width of the full image in px. With `height` it reserves the photo's box before it has loaded. */
|
|
22
|
+
width: number;
|
|
23
|
+
/** Height of the full image in px. */
|
|
24
|
+
height: number;
|
|
25
|
+
/** Shown under the photo in the viewer. */
|
|
26
|
+
caption?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function photoKey(photo: Photo): PhotoKey;
|
|
29
|
+
/** Payload of PhotoGrid's `onselect`. */
|
|
30
|
+
export interface PhotoGridSelectDetail {
|
|
31
|
+
photo: Photo;
|
|
32
|
+
index: number;
|
|
33
|
+
/** False when the press cleared the photo's selection (only in `multiple`). */
|
|
34
|
+
selected: boolean;
|
|
35
|
+
/** Every selected key after the change: one or none in `single`. */
|
|
36
|
+
keys: PhotoKey[];
|
|
37
|
+
}
|
|
38
|
+
/** Every built-in string of PhotoGrid. Pass a partial object to `strings` to translate. */
|
|
39
|
+
export interface PhotoGridStrings {
|
|
40
|
+
/** Visible label and name of the tile that adds a photo. */
|
|
41
|
+
addPhoto: string;
|
|
42
|
+
/** Name of a photo that has no `alt`. */
|
|
43
|
+
photoName: (position: number, total: number) => string;
|
|
44
|
+
/** Name of the last tile when it stands for the photos not shown. */
|
|
45
|
+
morePhotos: (count: number) => string;
|
|
46
|
+
/** Name of the button that opens a photo, in a grid where a press selects. */
|
|
47
|
+
openPhoto: (name: string) => string;
|
|
48
|
+
/** How to get around by keyboard. Read once when focus enters the grid, and shown while it has keyboard focus. */
|
|
49
|
+
keyboardHint: string;
|
|
50
|
+
}
|
|
51
|
+
export declare const PHOTO_GRID_STRINGS: PhotoGridStrings;
|
|
52
|
+
/** What the user did to close the viewer. `swipe` is a swipe down on the photo. */
|
|
53
|
+
export type PhotoViewerCloseReason = "escape" | "close-button" | "swipe";
|
|
54
|
+
/** Something to do with the photo that is showing: share it, delete it. */
|
|
55
|
+
export interface PhotoViewerAction {
|
|
56
|
+
id: string;
|
|
57
|
+
label: string;
|
|
58
|
+
/** An icon component, as `@lucide/svelte` icons are. */
|
|
59
|
+
icon?: Component<{
|
|
60
|
+
size?: number;
|
|
61
|
+
class?: string;
|
|
62
|
+
}>;
|
|
63
|
+
/** `danger` for a destructive action such as Delete. */
|
|
64
|
+
tone?: "danger";
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
onclick: (photo: Photo, index: number) => void;
|
|
67
|
+
}
|
|
68
|
+
/** Every built-in string of PhotoViewer. Pass a partial object to `strings` to translate. */
|
|
69
|
+
export interface PhotoViewerStrings {
|
|
70
|
+
close: string;
|
|
71
|
+
previous: string;
|
|
72
|
+
next: string;
|
|
73
|
+
/** The counter that is shown: "3 / 12". */
|
|
74
|
+
counter: (position: number, total: number) => string;
|
|
75
|
+
/** The same for a screen reader, read out after the photo's `alt`: "3 of 12". */
|
|
76
|
+
position: (position: number, total: number) => string;
|
|
77
|
+
/** Announced, with a spinner, when a photo takes a while to load. */
|
|
78
|
+
loading: string;
|
|
79
|
+
/** Shown when a photo cannot be loaded. */
|
|
80
|
+
loadError: string;
|
|
81
|
+
retry: string;
|
|
82
|
+
/** Name of the menu that holds the actions that do not fit in the bar. */
|
|
83
|
+
moreActions: string;
|
|
84
|
+
/** The button that shows all of a long caption, and the one that folds it again. */
|
|
85
|
+
showMore: string;
|
|
86
|
+
showLess: string;
|
|
87
|
+
/** Name of a photo that has no `alt`. */
|
|
88
|
+
photoName: (position: number, total: number) => string;
|
|
89
|
+
}
|
|
90
|
+
export declare const PHOTO_VIEWER_STRINGS: PhotoViewerStrings;
|
|
91
|
+
/** How many actions the viewer's bar shows before the rest go into a menu. */
|
|
92
|
+
export declare const MAX_BAR_ACTIONS = 3;
|
|
93
|
+
/** The actions shown in the bar, and those that go into the menu. */
|
|
94
|
+
export declare function splitActions<T>(actions: readonly T[], max?: number): {
|
|
95
|
+
bar: T[];
|
|
96
|
+
menu: T[];
|
|
97
|
+
};
|
|
98
|
+
/** An index held inside a list of `count` photos; -1 for an empty list. */
|
|
99
|
+
export declare function clampIndex(index: number, count: number): number;
|
|
100
|
+
/** What the grid shows of `total` photos under `max`, and how many the last tile stands for. */
|
|
101
|
+
export declare function visibleCount(total: number, max: number | undefined): {
|
|
102
|
+
shown: number;
|
|
103
|
+
hidden: number;
|
|
104
|
+
};
|
|
105
|
+
export interface Size {
|
|
106
|
+
width: number;
|
|
107
|
+
height: number;
|
|
108
|
+
}
|
|
109
|
+
export interface Point {
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Where the photo is. `scale` 1 is the photo fitted to the screen. `x` and
|
|
115
|
+
* `y` are how far its centre is from the centre of the screen, in px.
|
|
116
|
+
*/
|
|
117
|
+
export interface PhotoTransform {
|
|
118
|
+
scale: number;
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
}
|
|
122
|
+
export declare const REST: PhotoTransform;
|
|
123
|
+
export declare const MIN_SCALE = 1;
|
|
124
|
+
export declare const MAX_SCALE = 4;
|
|
125
|
+
/** What a double tap zooms to. */
|
|
126
|
+
export declare const DOUBLE_TAP_SCALE = 2.5;
|
|
127
|
+
export declare const isZoomed: (transform: PhotoTransform) => boolean;
|
|
128
|
+
/** The largest size a photo of `photo` px takes inside `view` without being cropped. */
|
|
129
|
+
export declare function fitSize(photo: Size, view: Size): Size;
|
|
130
|
+
/**
|
|
131
|
+
* The transform with its pan held to the photo's edges: an edge of the photo
|
|
132
|
+
* never comes further in than the edge of the screen, and a side that is
|
|
133
|
+
* narrower than the screen stays centred. `fit` is the photo's size at scale 1.
|
|
134
|
+
*/
|
|
135
|
+
export declare function clampPan(transform: PhotoTransform, fit: Size, view: Size): PhotoTransform;
|
|
136
|
+
/**
|
|
137
|
+
* Zooms to `scale` so that the point of the photo under `point` stays under
|
|
138
|
+
* it. `point` is measured from the centre of the screen.
|
|
139
|
+
*/
|
|
140
|
+
export declare function zoomAbout(transform: PhotoTransform, scale: number, point: Point, fit: Size, view: Size): PhotoTransform;
|
|
141
|
+
/** Two fingers on the glass: the point between them, and how far apart they are. */
|
|
142
|
+
export interface PinchSample {
|
|
143
|
+
centre: Point;
|
|
144
|
+
distance: number;
|
|
145
|
+
}
|
|
146
|
+
export declare function pinchSample(first: Point, second: Point): PinchSample;
|
|
147
|
+
/**
|
|
148
|
+
* Where a pinch has taken the photo: scaled by how much the fingers have
|
|
149
|
+
* spread, about the point that was between them when it began, and moved with
|
|
150
|
+
* that point. Points are measured from the centre of the screen.
|
|
151
|
+
*/
|
|
152
|
+
export declare function pinchTransform(start: PhotoTransform, from: PinchSample, now: PinchSample, fit: Size, view: Size): PhotoTransform;
|
|
153
|
+
/** A pinch let go a hair above the fitted size is the fitted size. */
|
|
154
|
+
export declare function settleZoom(transform: PhotoTransform, fit: Size, view: Size): PhotoTransform;
|
|
155
|
+
/** A double tap: in to 2.5 times about the tap from the fitted photo, and back to fitted from any zoom. */
|
|
156
|
+
export declare function doubleTapTransform(transform: PhotoTransform, point: Point, fit: Size, view: Size): PhotoTransform;
|
|
157
|
+
/** The photo moved by `delta` px, held to its edges. */
|
|
158
|
+
export declare function panBy(transform: PhotoTransform, delta: Point, fit: Size, view: Size): PhotoTransform;
|
|
159
|
+
/** One step of the keyboard or the wheel: in or out by half again, about the centre. */
|
|
160
|
+
export declare const ZOOM_STEP = 1.5;
|
|
161
|
+
/** Movement under this many px is a press, not a drag. */
|
|
162
|
+
export declare const TAP_SLOP = 8;
|
|
163
|
+
/** A press shorter than this is a tap, and two taps closer together than this are a double tap. */
|
|
164
|
+
export declare const TAP_MS = 300;
|
|
165
|
+
/** Two taps further apart than this are two taps. */
|
|
166
|
+
export declare const DOUBLE_TAP_RADIUS = 32;
|
|
167
|
+
export declare function isDoubleTap(previous: {
|
|
168
|
+
time: number;
|
|
169
|
+
point: Point;
|
|
170
|
+
} | null, now: {
|
|
171
|
+
time: number;
|
|
172
|
+
point: Point;
|
|
173
|
+
}): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Which way a drag on the fitted photo is going, once it has gone far enough
|
|
176
|
+
* to tell: `x` turns the page, `down` closes, and null is not yet known. A
|
|
177
|
+
* drag upwards is neither, and stays null.
|
|
178
|
+
*/
|
|
179
|
+
export declare function dragAxis(delta: Point, slop?: number): "x" | "down" | null;
|
|
180
|
+
/** Part of the screen's width a slow swipe has to cross to turn the page. */
|
|
181
|
+
export declare const TURN_DISTANCE = 0.25;
|
|
182
|
+
/** Part of the screen's height a slow swipe down has to cross to close. */
|
|
183
|
+
export declare const CLOSE_DISTANCE = 0.2;
|
|
184
|
+
/**
|
|
185
|
+
* What a horizontal swipe does when the finger lifts. A flick decides by its
|
|
186
|
+
* direction; a slow one by how far it went. Swiping left shows the next
|
|
187
|
+
* photo, and the previous one in a right-to-left layout. At either end there
|
|
188
|
+
* is nothing to turn to.
|
|
189
|
+
*/
|
|
190
|
+
export declare function swipeTurn(options: {
|
|
191
|
+
/** px moved; negative is to the left. */
|
|
192
|
+
distance: number;
|
|
193
|
+
/** px per ms at release; negative is to the left. */
|
|
194
|
+
velocity: number;
|
|
195
|
+
width: number;
|
|
196
|
+
index: number;
|
|
197
|
+
count: number;
|
|
198
|
+
rtl?: boolean;
|
|
199
|
+
flick: number;
|
|
200
|
+
}): -1 | 0 | 1;
|
|
201
|
+
/** Whether a swipe down closes the viewer when the finger lifts. */
|
|
202
|
+
export declare function swipeCloses(options: {
|
|
203
|
+
/** px moved down. */
|
|
204
|
+
distance: number;
|
|
205
|
+
/** px per ms at release; positive is down. */
|
|
206
|
+
velocity: number;
|
|
207
|
+
height: number;
|
|
208
|
+
flick: number;
|
|
209
|
+
}): boolean;
|
|
210
|
+
/**
|
|
211
|
+
* How far a drag past the first or last photo moves it: a third of the
|
|
212
|
+
* finger's travel, so it gives but does not come away.
|
|
213
|
+
*/
|
|
214
|
+
export declare function resist(distance: number): number;
|
|
215
|
+
//# sourceMappingURL=photo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"photo.d.ts","sourceRoot":"","sources":["../../../src/components/util/photo.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC,oEAAoE;AACpE,MAAM,WAAW,KAAK;IAClB,8GAA8G;IAC9G,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,qGAAqG;IACrG,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC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KG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE;IAC/B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAUb;AAED,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACjC,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAIV;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Action } from "svelte/action";
|
|
2
|
+
/**
|
|
3
|
+
* Where to render the node: `true` for `document.body`, an element, or a
|
|
4
|
+
* selector. `false` leaves the node where the template put it.
|
|
5
|
+
*/
|
|
6
|
+
export type PortalTarget = boolean | HTMLElement | string;
|
|
7
|
+
/**
|
|
8
|
+
* Moves an overlay out of its ancestors so none of them can trap it: a
|
|
9
|
+
* `transform`, `filter` or `contain` ancestor becomes the containing block of a
|
|
10
|
+
* `position: fixed` child, and an `overflow: hidden` one then clips it.
|
|
11
|
+
*
|
|
12
|
+
* SSR-safe by construction: actions never run on the server, so the markup is
|
|
13
|
+
* rendered in place and moved on mount. The node is removed on destroy, and
|
|
14
|
+
* Svelte's own teardown of a node that has already gone is a no-op.
|
|
15
|
+
*
|
|
16
|
+
* Put it on the single root element of an `{#if}` block. The theme is a `.dark`
|
|
17
|
+
* class on an ancestor, so a node portalled to `body` keeps it only when the
|
|
18
|
+
* class sits on `<html>` or `<body>`.
|
|
19
|
+
*
|
|
20
|
+
* Usage: `<div use:portal>` or `<div use:portal={enabled}>`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const portal: Action<HTMLElement, PortalTarget | undefined>;
|
|
23
|
+
//# sourceMappingURL=portal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/components/util/portal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC;AAW1D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS,CA8BhE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Public types and pure helpers for `PullToRefresh`. */
|
|
2
|
+
/** The words a `PullToRefresh` says by itself. */
|
|
3
|
+
export interface PullToRefreshStrings {
|
|
4
|
+
/** Shown while the list is being pulled, short of the threshold. */
|
|
5
|
+
pull: string;
|
|
6
|
+
/** Shown once letting go would refresh. */
|
|
7
|
+
release: string;
|
|
8
|
+
/** Shown, and announced, while the refresh runs. */
|
|
9
|
+
refreshing: string;
|
|
10
|
+
/** Announced when it has finished. */
|
|
11
|
+
done: string;
|
|
12
|
+
/** The button that refreshes without the gesture. */
|
|
13
|
+
refresh: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DEFAULT_PULL_TO_REFRESH_STRINGS: PullToRefreshStrings;
|
|
16
|
+
/**
|
|
17
|
+
* How far the indicator has come out for a finger that has travelled
|
|
18
|
+
* `distance` px: half as far, so the list feels held, and never more than one
|
|
19
|
+
* and a half times the threshold.
|
|
20
|
+
*/
|
|
21
|
+
export declare function pullDistance(distance: number, threshold: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* What scrolls the element: its nearest ancestor that scrolls on the block
|
|
24
|
+
* axis, or the page.
|
|
25
|
+
*/
|
|
26
|
+
export declare function scrollContainerOf(element: HTMLElement): HTMLElement;
|
|
27
|
+
//# sourceMappingURL=pull-to-refresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull-to-refresh.d.ts","sourceRoot":"","sources":["../../../src/components/util/pull-to-refresh.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACjC,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,+BAA+B,EAAE,oBAM7C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CAOnE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a key moves the selection in a radio group laid out in a row, as
|
|
3
|
+
* Rating and SegmentedControl are. Kept out of the components so it can be
|
|
4
|
+
* tested without a DOM.
|
|
5
|
+
*
|
|
6
|
+
* It is the native radio contract: Right and Down go to the next option, Left
|
|
7
|
+
* and Up to the previous one, both wrap, and Left and Right swap in a
|
|
8
|
+
* right-to-left layout.
|
|
9
|
+
*
|
|
10
|
+
* `current` is the option that has focus, which is not always the selected
|
|
11
|
+
* one: a screen reader's cursor can put focus on any radio, and the keys then
|
|
12
|
+
* move from where the user is. It is -1 when focus is on none of them: the
|
|
13
|
+
* next option is then the first, and the previous one the last.
|
|
14
|
+
*
|
|
15
|
+
* `hasSelection` is false while the group is empty. A forward key then selects
|
|
16
|
+
* the focused option itself instead of stepping over it, so Right on an empty
|
|
17
|
+
* rating gives one star, not two.
|
|
18
|
+
*
|
|
19
|
+
* Returns -1 for a key that is not a navigation key, or when there is nothing
|
|
20
|
+
* to move to.
|
|
21
|
+
*/
|
|
22
|
+
export declare function radioKeyIndex(key: string, current: number, count: number, rtl?: boolean, hasSelection?: boolean): number;
|
|
23
|
+
/** Whether `node` is laid out right to left. */
|
|
24
|
+
export declare function isRtl(node: Element): boolean;
|
|
25
|
+
//# sourceMappingURL=radio-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-keys.d.ts","sourceRoot":"","sources":["../../../src/components/util/radio-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CACzB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,GAAG,UAAQ,EACX,YAAY,UAAO,GACpB,MAAM,CAeR;AAED,gDAAgD;AAChD,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAE5C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Types and pure helpers for `Rating`. Kept out of the component so they can be tested without a DOM. */
|
|
2
|
+
/** Every built-in string. Pass a partial object to `strings` to translate. */
|
|
3
|
+
export interface RatingStrings {
|
|
4
|
+
/**
|
|
5
|
+
* Accessible name of one star ("4 of 5 stars"), and of a read-only
|
|
6
|
+
* rating as a whole ("3.5 of 5 stars"). `value` is already formatted.
|
|
7
|
+
*/
|
|
8
|
+
starLabel: (value: string, max: number) => string;
|
|
9
|
+
/** Accessible name of the clear button that `clearable` adds. */
|
|
10
|
+
clearLabel: string;
|
|
11
|
+
/** Shown, and read, for a read-only rating without a value. */
|
|
12
|
+
noRating: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const RATING_STRINGS: RatingStrings;
|
|
15
|
+
/** Number of stars: a whole number, at least one. */
|
|
16
|
+
export declare function starCount(max: number): number;
|
|
17
|
+
/** `value` held within 0..max; `null` for no rating or a value that is not a number. */
|
|
18
|
+
export declare function clampRating(value: number | null | undefined, max: number): number | null;
|
|
19
|
+
/** How much of star `star` (counted from 1) is filled, 0 to 1. */
|
|
20
|
+
export declare function starFill(value: number | null, star: number): number;
|
|
21
|
+
/** The value with at most one decimal: 4, 3.5, 3.7. */
|
|
22
|
+
export declare function defaultRatingFormat(value: number): string;
|
|
23
|
+
//# sourceMappingURL=rating.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rating.d.ts","sourceRoot":"","sources":["../../../src/components/util/rating.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC1B;;;OAGG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,aAI5B,CAAC;AAEF,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGxF;AAED,kEAAkE;AAClE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED,uDAAuD;AACvD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words of the components that come with text of their own: the colour
|
|
3
|
+
* picker, the ready-made contact form, and the two the docs site is built
|
|
4
|
+
* from. Each takes its own as `strings`; what is left out stays as it is here.
|
|
5
|
+
*/
|
|
6
|
+
/** `ColorPicker`. */
|
|
7
|
+
export interface ColorPickerStrings {
|
|
8
|
+
/** Accessible name of the field the hex value is typed in. */
|
|
9
|
+
hexInput: string;
|
|
10
|
+
/** Accessible name of the swatch button that opens the picker. */
|
|
11
|
+
open: string;
|
|
12
|
+
/** Accessible name of the picker that opens. */
|
|
13
|
+
picker: string;
|
|
14
|
+
/** Accessible name of the hue slider in it. */
|
|
15
|
+
hue: string;
|
|
16
|
+
/** Accessible name of the colour map: the two sliders below, on one surface. */
|
|
17
|
+
area: string;
|
|
18
|
+
/** Accessible name of the map's slider that goes across. */
|
|
19
|
+
saturation: string;
|
|
20
|
+
/** Accessible name of the map's slider that goes up and down. */
|
|
21
|
+
lightness: string;
|
|
22
|
+
/** The message under the field while what is typed is not a hex colour. */
|
|
23
|
+
invalidHex: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_COLOR_PICKER_STRINGS: ColorPickerStrings;
|
|
26
|
+
/** `ContactForm`: every label, placeholder and message of the form. */
|
|
27
|
+
export interface ContactFormStrings {
|
|
28
|
+
heading: string;
|
|
29
|
+
nameLabel: string;
|
|
30
|
+
namePlaceholder: string;
|
|
31
|
+
emailLabel: string;
|
|
32
|
+
emailPlaceholder: string;
|
|
33
|
+
messageLabel: string;
|
|
34
|
+
messagePlaceholder: string;
|
|
35
|
+
subscribeLabel: string;
|
|
36
|
+
submit: string;
|
|
37
|
+
/** Under a field left empty or filled in wrongly. */
|
|
38
|
+
nameRequired: string;
|
|
39
|
+
emailRequired: string;
|
|
40
|
+
emailInvalid: string;
|
|
41
|
+
messageRequired: string;
|
|
42
|
+
/** The box above the fields when the form could not be sent: its three lines. */
|
|
43
|
+
errorTitle: string;
|
|
44
|
+
errorMessage: string;
|
|
45
|
+
errorRecovery: string;
|
|
46
|
+
}
|
|
47
|
+
export declare const DEFAULT_CONTACT_FORM_STRINGS: ContactFormStrings;
|
|
48
|
+
/** `PropsTable`. The caption is the `caption` prop. */
|
|
49
|
+
export interface PropsTableStrings {
|
|
50
|
+
name: string;
|
|
51
|
+
type: string;
|
|
52
|
+
required: string;
|
|
53
|
+
default: string;
|
|
54
|
+
description: string;
|
|
55
|
+
yes: string;
|
|
56
|
+
no: string;
|
|
57
|
+
/** Shown instead of the table when there are no props. */
|
|
58
|
+
empty: string;
|
|
59
|
+
}
|
|
60
|
+
export declare const DEFAULT_PROPS_TABLE_STRINGS: PropsTableStrings;
|
|
61
|
+
/** `ComponentDemo`. */
|
|
62
|
+
export interface ComponentDemoStrings {
|
|
63
|
+
/** The two tabs, and what the switch between them is called. */
|
|
64
|
+
preview: string;
|
|
65
|
+
code: string;
|
|
66
|
+
showPreview: string;
|
|
67
|
+
showCode: string;
|
|
68
|
+
}
|
|
69
|
+
export declare const DEFAULT_COMPONENT_DEMO_STRINGS: ComponentDemoStrings;
|
|
70
|
+
/**
|
|
71
|
+
* Lays `strings` layers over a component's defaults, later layers winning. A
|
|
72
|
+
* key whose value is `undefined` is skipped, so `strings={{ close: t.close }}`
|
|
73
|
+
* with `t.close` missing keeps the default instead of blanking it. `null` and
|
|
74
|
+
* the empty string are kept: those are choices.
|
|
75
|
+
*/
|
|
76
|
+
export declare function mergeStrings<T extends object>(defaults: T, ...layers: Array<Partial<T> | null | undefined>): T;
|
|
77
|
+
//# sourceMappingURL=ready-made-strings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ready-made-strings.d.ts","sourceRoot":"","sources":["../../../src/components/util/ready-made-strings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAqB;AACrB,MAAM,WAAW,kBAAkB;IAC/B,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;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AAK,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,2BAA2B,EAAE,iBASzC,CAAC;AAEF,uBAAuB;AACvB,MAAM,WAAW,oBAAoB;IACjC,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,8BAA8B,EAAE,oBAK5C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EACzC,QAAQ,EAAE,CAAC,EACX,GAAG,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,GAChD,CAAC,CASH"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `scroll-padding-bottom` on a scrolling box, shared between the things that
|
|
3
|
+
* lie over its bottom edge.
|
|
4
|
+
*
|
|
5
|
+
* Each of them saves what was there and puts it back when it leaves. Done one
|
|
6
|
+
* by one that goes wrong as soon as two overlap in time: the second saves the
|
|
7
|
+
* first one's value as "what was there", and if the first leaves first, the
|
|
8
|
+
* second later restores a value nobody owns any more. Here the box's own
|
|
9
|
+
* value is saved once, the largest request is what is set, and the box gets
|
|
10
|
+
* its own value back when the last request is released.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Asks for room at the bottom of `container`. `set` gives or changes the
|
|
14
|
+
* amount in px; `release` withdraws the request. Call it in the browser.
|
|
15
|
+
*/
|
|
16
|
+
export declare function reserveScrollPaddingBottom(container: HTMLElement): {
|
|
17
|
+
set: (px: number) => void;
|
|
18
|
+
release: () => void;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=scroll-padding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-padding.d.ts","sourceRoot":"","sources":["../../../src/components/util/scroll-padding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAcH;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,WAAW,GAAG;IAChE,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB,CAuBA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Component } from "svelte";
|
|
2
|
+
/** An icon component, as `@lucide/svelte` icons are. */
|
|
3
|
+
export type SegmentedControlIcon = Component<{
|
|
4
|
+
size?: number;
|
|
5
|
+
class?: string;
|
|
6
|
+
}>;
|
|
7
|
+
/** One entry of SegmentedControl's `options`. */
|
|
8
|
+
export interface SegmentedControlOption {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
/** Rendered before the label. Decorative: the label names the segment. */
|
|
12
|
+
icon?: SegmentedControlIcon;
|
|
13
|
+
/** A disabled segment cannot be chosen, and the arrow keys skip it. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=segmented-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../../src/components/util/segmented-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,wDAAwD;AACxD,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEhF,iDAAiD;AACjD,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every word a `Select` says by itself, shown or only read out. An app in
|
|
3
|
+
* another language passes its own through `strings`; what it leaves out stays
|
|
4
|
+
* as it is here. The older props for six of them (`placeholder`,
|
|
5
|
+
* `searchPlaceholder`, `noResultsText`, `loadingText`, `emptyStateTitle`,
|
|
6
|
+
* `emptyStateDescription`) still work, and win over `strings`.
|
|
7
|
+
*/
|
|
8
|
+
export interface SelectStrings {
|
|
9
|
+
/** Shown in the field while nothing is chosen, and the first, empty option of the native select. */
|
|
10
|
+
placeholder: string;
|
|
11
|
+
/** Placeholder and accessible name of the search field above the options. */
|
|
12
|
+
searchPlaceholder: string;
|
|
13
|
+
/** Shown in the list when the search matches nothing. */
|
|
14
|
+
noResults: string;
|
|
15
|
+
/** Shown in the field and in the list while `isLoading`. */
|
|
16
|
+
loading: string;
|
|
17
|
+
/** Heading of the box shown in the list when there are no options at all. */
|
|
18
|
+
emptyTitle: string;
|
|
19
|
+
/** The line under that heading. */
|
|
20
|
+
emptyDescription: string;
|
|
21
|
+
/** Accessible name of the list of options. */
|
|
22
|
+
listLabel: string;
|
|
23
|
+
/** Accessible name of the close button of the sheet the list opens in on a phone. */
|
|
24
|
+
closeLabel: string;
|
|
25
|
+
/** Accessible name of that sheet's grip while its button takes the sheet up to full height. */
|
|
26
|
+
expandLabel: string;
|
|
27
|
+
/** The same, while it takes the sheet back down. */
|
|
28
|
+
collapseLabel: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const DEFAULT_SELECT_STRINGS: SelectStrings;
|
|
31
|
+
/** How a Select shows its options. See the `presentation` prop. */
|
|
32
|
+
export type SelectPresentation = "auto" | "popover" | "sheet" | "native";
|
|
33
|
+
/** Marks the native `<select>` a Select renders, so a choice made in it before the page hydrates can be found. */
|
|
34
|
+
export declare const NATIVE_SELECT_ATTRIBUTE = "data-zabi-select";
|
|
35
|
+
/**
|
|
36
|
+
* What the visitor (or the browser, restoring a form) chose in `element`
|
|
37
|
+
* before its component mounted; `undefined` when it still has the value the
|
|
38
|
+
* server rendered, and for an element this module never saw.
|
|
39
|
+
*/
|
|
40
|
+
export declare function choiceBeforeMount(element: Element): string | undefined;
|
|
41
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/components/util/select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,oGAAoG;IACpG,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,UAAU,EAAE,MAAM,CAAC;IACnB,+FAA+F;IAC/F,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAWpC,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzE,kHAAkH;AAClH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAgD1D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGtE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dragging a bottom sheet with a finger or a pointer. Shared by `BottomSheet`
|
|
3
|
+
* and `SlideUp`, so the two cannot disagree on what a swipe is.
|
|
4
|
+
*
|
|
5
|
+
* It only reports the gesture: how far the pointer has travelled since the
|
|
6
|
+
* drag began and how fast it was going at the end. What that means (move the
|
|
7
|
+
* panel, snap, close) is the caller's.
|
|
8
|
+
*/
|
|
9
|
+
export interface SheetDragCallbacks {
|
|
10
|
+
/** Asked when a gesture could begin. Return false to leave it alone. */
|
|
11
|
+
canStart?: () => boolean;
|
|
12
|
+
onStart?: () => void;
|
|
13
|
+
/** `distance` in px since the drag began; positive is down. */
|
|
14
|
+
onMove: (distance: number) => void;
|
|
15
|
+
/** `velocity` in px per ms over the last moments of the drag; positive is down. */
|
|
16
|
+
onEnd: (distance: number, velocity: number, event: Event) => void;
|
|
17
|
+
/** The browser took the gesture back (a call came in, the pointer was lost). */
|
|
18
|
+
onCancel?: () => void;
|
|
19
|
+
}
|
|
20
|
+
export interface SheetDragTargets {
|
|
21
|
+
/**
|
|
22
|
+
* The grip and the area around it. A drag that starts here moves the
|
|
23
|
+
* sheet in either direction. Give it `touch-action: none`.
|
|
24
|
+
*/
|
|
25
|
+
handleZone: HTMLElement;
|
|
26
|
+
/**
|
|
27
|
+
* The scrolling content. A touch that starts here scrolls it; only a
|
|
28
|
+
* downward swipe that begins with the content at its top moves the sheet.
|
|
29
|
+
*/
|
|
30
|
+
scroller?: HTMLElement | null;
|
|
31
|
+
}
|
|
32
|
+
/** Movement under this many px is a press, not a drag. */
|
|
33
|
+
export declare const DRAG_SLOP = 6;
|
|
34
|
+
/**
|
|
35
|
+
* When a pointer or touch event happened: its own `timeStamp`, which is when
|
|
36
|
+
* the finger moved. The time the handler runs is later by however busy the
|
|
37
|
+
* page is, and unevenly so, which made a flick on a janky frame (or a loaded
|
|
38
|
+
* machine) measure slower than it was and spring back. An event without a
|
|
39
|
+
* usable stamp gets the clock.
|
|
40
|
+
*/
|
|
41
|
+
export declare function timeOf(event: Event): number;
|
|
42
|
+
/**
|
|
43
|
+
* How fast a pointer was moving over the last moments of a gesture, on one
|
|
44
|
+
* axis. Also used by `PhotoViewer`, for both axes.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createVelocityTracker(): {
|
|
47
|
+
reset(y: number, time: number): void;
|
|
48
|
+
add(y: number, time: number): void;
|
|
49
|
+
velocity(): number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Listens for drags on a sheet. Call it when the sheet is open, in the
|
|
53
|
+
* browser, and call the returned function when it closes.
|
|
54
|
+
*/
|
|
55
|
+
export declare function attachSheetDrag({ handleZone, scroller }: SheetDragTargets, callbacks: SheetDragCallbacks): () => void;
|
|
56
|
+
/** A flick: faster than this, in px per ms, and the direction decides, not the distance. */
|
|
57
|
+
export declare const FLICK_VELOCITY = 0.5;
|
|
58
|
+
/** True where the user has asked for less motion, or where that cannot be asked. */
|
|
59
|
+
export declare function prefersReducedMotion(): boolean;
|
|
60
|
+
//# sourceMappingURL=sheet-drag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet-drag.d.ts","sourceRoot":"","sources":["../../../src/components/util/sheet-drag.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,kBAAkB;IAC/B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,+DAA+D;IAC/D,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,mFAAmF;IACnF,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClE,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC7B;;;OAGG;IACH,UAAU,EAAE,WAAW,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC;AAED,0DAA0D;AAC1D,eAAO,MAAM,SAAS,IAAI,CAAC;AAS3B;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAG3C;AAKD;;;GAGG;AACH,wBAAgB,qBAAqB;aAIpB,MAAM,QAAQ,MAAM;WAGtB,MAAM,QAAQ,MAAM;gBAIf,MAAM;EAYzB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC3B,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,gBAAgB,EAC1C,SAAS,EAAE,kBAAkB,GAC9B,MAAM,IAAI,CAwKZ;AAED,4FAA4F;AAC5F,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,oFAAoF;AACpF,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words the sidebar components say by themselves. Each takes its own as
|
|
3
|
+
* `strings`; `SidebarNavigation` takes them all and hands the footer and the
|
|
4
|
+
* brand header theirs.
|
|
5
|
+
*/
|
|
6
|
+
/** `SidebarBrandHeader`. */
|
|
7
|
+
export interface SidebarBrandHeaderStrings {
|
|
8
|
+
/** The logo's alt text when neither `logoAlt` nor `brandName` is given. */
|
|
9
|
+
brandAlt: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_SIDEBAR_BRAND_HEADER_STRINGS: SidebarBrandHeaderStrings;
|
|
12
|
+
/** `SidebarFooter`. */
|
|
13
|
+
export interface SidebarFooterStrings {
|
|
14
|
+
/** Accessible name of the footer. */
|
|
15
|
+
accountAndSettings: string;
|
|
16
|
+
/** Accessible name of the profile button in a collapsed rail. */
|
|
17
|
+
openAccountPanel: string;
|
|
18
|
+
/** The same button in an expanded sidebar, with the profile's name. */
|
|
19
|
+
openAccountPanelFor: (name: string) => string;
|
|
20
|
+
}
|
|
21
|
+
export declare const DEFAULT_SIDEBAR_FOOTER_STRINGS: SidebarFooterStrings;
|
|
22
|
+
/** `SidebarAccountPanel`. */
|
|
23
|
+
export interface SidebarAccountPanelStrings {
|
|
24
|
+
/** Accessible name of the panel. */
|
|
25
|
+
panelLabel: string;
|
|
26
|
+
/** The panel's heading. */
|
|
27
|
+
title: string;
|
|
28
|
+
/** Accessible name of the close button. */
|
|
29
|
+
closeLabel: string;
|
|
30
|
+
/** Accessible name of the list of rows. */
|
|
31
|
+
listLabel: string;
|
|
32
|
+
/** The first row, above the profile's name. */
|
|
33
|
+
account: string;
|
|
34
|
+
/** The row that switches the theme. */
|
|
35
|
+
theme: string;
|
|
36
|
+
/** That row's second line, in each mode. */
|
|
37
|
+
lightMode: string;
|
|
38
|
+
darkMode: string;
|
|
39
|
+
/** With `themeModes="three"`: the mode that follows the system. */
|
|
40
|
+
systemMode: string;
|
|
41
|
+
/** The badge on that row, in each mode. */
|
|
42
|
+
light: string;
|
|
43
|
+
dark: string;
|
|
44
|
+
system: string;
|
|
45
|
+
/** The second line of the log-out row. Its first line is `logoutLabel`. */
|
|
46
|
+
signOut: string;
|
|
47
|
+
}
|
|
48
|
+
export declare const DEFAULT_SIDEBAR_ACCOUNT_PANEL_STRINGS: SidebarAccountPanelStrings;
|
|
49
|
+
/** `SidebarNavigation`: its own words, and those of the footer and the brand header in it. */
|
|
50
|
+
export interface SidebarNavigationStrings extends SidebarFooterStrings, SidebarBrandHeaderStrings {
|
|
51
|
+
/** Accessible name of the main list of links, when it has no section heading. */
|
|
52
|
+
primaryNavigation: string;
|
|
53
|
+
/** Accessible name of the second list of links. */
|
|
54
|
+
secondaryNavigation: string;
|
|
55
|
+
/** Accessible name of a list under a section heading, from the heading. */
|
|
56
|
+
sectionNavigation: (section: string) => string;
|
|
57
|
+
/** Shown when a search matches no link: the heading. */
|
|
58
|
+
noMatchesTitle: string;
|
|
59
|
+
/** And the line under it, with what was searched for. */
|
|
60
|
+
noMatchesDescription: (term: string) => string;
|
|
61
|
+
}
|
|
62
|
+
export declare const DEFAULT_SIDEBAR_NAVIGATION_STRINGS: SidebarNavigationStrings;
|
|
63
|
+
//# sourceMappingURL=sidebar.d.ts.map
|