@thomasfosterau/components 0.0.0 → 0.2.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/LICENSE +21 -0
- package/README.md +241 -56
- package/dist/canvas/VectorCanvas.svelte +320 -0
- package/dist/canvas/VectorCanvas.svelte.d.ts +105 -0
- package/dist/canvas/history.d.ts +105 -0
- package/dist/canvas/history.js +147 -0
- package/dist/canvas/index.d.ts +15 -0
- package/dist/canvas/index.js +14 -0
- package/dist/canvas/types.d.ts +91 -0
- package/dist/canvas/types.js +13 -0
- package/dist/canvas/utils.d.ts +66 -0
- package/dist/canvas/utils.js +114 -0
- package/dist/charts/Chart.svelte +300 -0
- package/dist/charts/Chart.svelte.d.ts +50 -0
- package/dist/charts/index.d.ts +11 -0
- package/dist/charts/index.js +10 -0
- package/dist/charts/types.d.ts +28 -0
- package/dist/charts/types.js +6 -0
- package/dist/citations/BookCitation.svelte +53 -0
- package/dist/citations/BookCitation.svelte.d.ts +41 -0
- package/dist/citations/ChapterCitation.svelte +38 -0
- package/dist/citations/ChapterCitation.svelte.d.ts +50 -0
- package/dist/citations/Citation.svelte +47 -0
- package/dist/citations/Citation.svelte.d.ts +24 -0
- package/dist/citations/CreditList.svelte +69 -0
- package/dist/citations/CreditList.svelte.d.ts +47 -0
- package/dist/citations/DOILink.svelte +28 -0
- package/dist/citations/DOILink.svelte.d.ts +19 -0
- package/dist/citations/Footnote.svelte +39 -0
- package/dist/citations/Footnote.svelte.d.ts +17 -0
- package/dist/citations/FootnoteList.svelte +36 -0
- package/dist/citations/FootnoteList.svelte.d.ts +21 -0
- package/dist/citations/ISBNLink.svelte +29 -0
- package/dist/citations/ISBNLink.svelte.d.ts +19 -0
- package/dist/citations/ISSNLink.svelte +29 -0
- package/dist/citations/ISSNLink.svelte.d.ts +19 -0
- package/dist/citations/Publisher.svelte +34 -0
- package/dist/citations/Publisher.svelte.d.ts +14 -0
- package/dist/citations/ReferenceList.svelte +53 -0
- package/dist/citations/ReferenceList.svelte.d.ts +21 -0
- package/dist/citations/ReportCitation.svelte +41 -0
- package/dist/citations/ReportCitation.svelte.d.ts +36 -0
- package/dist/citations/ScholarlyArticleCitation.svelte +64 -0
- package/dist/citations/ScholarlyArticleCitation.svelte.d.ts +41 -0
- package/dist/citations/ThesisCitation.svelte +35 -0
- package/dist/citations/ThesisCitation.svelte.d.ts +29 -0
- package/dist/citations/bibliography.svelte.d.ts +55 -0
- package/dist/citations/bibliography.svelte.js +78 -0
- package/dist/citations/citation.d.ts +71 -0
- package/dist/citations/citation.js +121 -0
- package/dist/citations/csl.d.ts +102 -0
- package/dist/citations/csl.js +20 -0
- package/dist/citations/index.d.ts +31 -0
- package/dist/citations/index.js +36 -0
- package/dist/citations/list-format.d.ts +34 -0
- package/dist/citations/list-format.js +40 -0
- package/dist/context.svelte.d.ts +46 -0
- package/dist/context.svelte.js +51 -0
- package/dist/data/ChatBubble.svelte +48 -0
- package/dist/data/ChatBubble.svelte.d.ts +33 -0
- package/dist/data/DataGrid.svelte +150 -0
- package/dist/data/DataGrid.svelte.d.ts +118 -0
- package/dist/data/DescriptionList.svelte +53 -0
- package/dist/data/DescriptionList.svelte.d.ts +26 -0
- package/dist/data/DescriptionRow.svelte +56 -0
- package/dist/data/DescriptionRow.svelte.d.ts +21 -0
- package/dist/data/DiffText.svelte +29 -0
- package/dist/data/DiffText.svelte.d.ts +19 -0
- package/dist/data/ItemList.svelte +80 -0
- package/dist/data/ItemList.svelte.d.ts +52 -0
- package/dist/data/LinkListItem.svelte +46 -0
- package/dist/data/LinkListItem.svelte.d.ts +21 -0
- package/dist/data/MessageThread.svelte +29 -0
- package/dist/data/MessageThread.svelte.d.ts +17 -0
- package/dist/data/Pagination.svelte +136 -0
- package/dist/data/Pagination.svelte.d.ts +79 -0
- package/dist/data/PaginationFooter.svelte +42 -0
- package/dist/data/PaginationFooter.svelte.d.ts +61 -0
- package/dist/data/ResultCount.svelte +27 -0
- package/dist/data/ResultCount.svelte.d.ts +18 -0
- package/dist/data/Table.svelte +151 -0
- package/dist/data/Table.svelte.d.ts +75 -0
- package/dist/data/TreeList.svelte +41 -0
- package/dist/data/TreeList.svelte.d.ts +17 -0
- package/dist/data/TreeListItem.svelte +29 -0
- package/dist/data/TreeListItem.svelte.d.ts +10 -0
- package/dist/data/description-context.d.ts +39 -0
- package/dist/data/description-context.js +36 -0
- package/dist/data/diff.d.ts +14 -0
- package/dist/data/diff.js +10 -0
- package/dist/data/index.d.ts +37 -0
- package/dist/data/index.js +37 -0
- package/dist/data/list-item.d.ts +30 -0
- package/dist/data/list-item.js +19 -0
- package/dist/data/pagination.d.ts +81 -0
- package/dist/data/pagination.js +79 -0
- package/dist/data/table-types.d.ts +71 -0
- package/dist/data/table-types.js +35 -0
- package/dist/feedback/ConfirmDialog.svelte +79 -0
- package/dist/feedback/ConfirmDialog.svelte.d.ts +82 -0
- package/dist/feedback/Dialog.svelte +47 -0
- package/dist/feedback/Dialog.svelte.d.ts +36 -0
- package/dist/feedback/DialogFrame.svelte +64 -0
- package/dist/feedback/DialogFrame.svelte.d.ts +23 -0
- package/dist/feedback/Drawer.svelte +43 -0
- package/dist/feedback/Drawer.svelte.d.ts +43 -0
- package/dist/feedback/LoadingBoundary.svelte +61 -0
- package/dist/feedback/LoadingBoundary.svelte.d.ts +34 -0
- package/dist/feedback/ProgressBar.svelte +46 -0
- package/dist/feedback/ProgressBar.svelte.d.ts +28 -0
- package/dist/feedback/SegmentBar.svelte +83 -0
- package/dist/feedback/SegmentBar.svelte.d.ts +37 -0
- package/dist/feedback/StatTile.svelte +77 -0
- package/dist/feedback/StatTile.svelte.d.ts +50 -0
- package/dist/feedback/Stats.svelte +18 -0
- package/dist/feedback/Stats.svelte.d.ts +16 -0
- package/dist/feedback/Steps.svelte +72 -0
- package/dist/feedback/Steps.svelte.d.ts +61 -0
- package/dist/feedback/Timeline.svelte +86 -0
- package/dist/feedback/Timeline.svelte.d.ts +55 -0
- package/dist/feedback/Toaster.svelte +78 -0
- package/dist/feedback/Toaster.svelte.d.ts +32 -0
- package/dist/feedback/index.d.ts +34 -0
- package/dist/feedback/index.js +29 -0
- package/dist/feedback/sizes.d.ts +41 -0
- package/dist/feedback/sizes.js +69 -0
- package/dist/feedback/toaster.d.ts +48 -0
- package/dist/feedback/toaster.js +29 -0
- package/dist/fields/Calendar.svelte +60 -0
- package/dist/fields/Calendar.svelte.d.ts +11 -0
- package/dist/fields/CalendarMonths.svelte +86 -0
- package/dist/fields/CalendarMonths.svelte.d.ts +30 -0
- package/dist/fields/Checkbox.svelte +33 -0
- package/dist/fields/Checkbox.svelte.d.ts +30 -0
- package/dist/fields/CheckboxGroup.svelte +41 -0
- package/dist/fields/CheckboxGroup.svelte.d.ts +40 -0
- package/dist/fields/Combobox.svelte +229 -0
- package/dist/fields/Combobox.svelte.d.ts +133 -0
- package/dist/fields/DateField.svelte +37 -0
- package/dist/fields/DateField.svelte.d.ts +20 -0
- package/dist/fields/DateInput.svelte +31 -0
- package/dist/fields/DateInput.svelte.d.ts +35 -0
- package/dist/fields/DatePicker.svelte +47 -0
- package/dist/fields/DatePicker.svelte.d.ts +25 -0
- package/dist/fields/DateRangePicker.svelte +70 -0
- package/dist/fields/DateRangePicker.svelte.d.ts +43 -0
- package/dist/fields/Dropzone.svelte +232 -0
- package/dist/fields/Dropzone.svelte.d.ts +103 -0
- package/dist/fields/FieldErrors.svelte +30 -0
- package/dist/fields/FieldErrors.svelte.d.ts +11 -0
- package/dist/fields/Fieldset.svelte +53 -0
- package/dist/fields/Fieldset.svelte.d.ts +27 -0
- package/dist/fields/FileInput.svelte +68 -0
- package/dist/fields/FileInput.svelte.d.ts +39 -0
- package/dist/fields/FormField.svelte +78 -0
- package/dist/fields/FormField.svelte.d.ts +29 -0
- package/dist/fields/ImageInput.svelte +87 -0
- package/dist/fields/ImageInput.svelte.d.ts +45 -0
- package/dist/fields/MultiSelect.svelte +112 -0
- package/dist/fields/MultiSelect.svelte.d.ts +75 -0
- package/dist/fields/NumberField.svelte +190 -0
- package/dist/fields/NumberField.svelte.d.ts +76 -0
- package/dist/fields/PasswordInput.svelte +95 -0
- package/dist/fields/PasswordInput.svelte.d.ts +58 -0
- package/dist/fields/PickerPopover.svelte +47 -0
- package/dist/fields/PickerPopover.svelte.d.ts +16 -0
- package/dist/fields/PinInput.svelte +83 -0
- package/dist/fields/PinInput.svelte.d.ts +66 -0
- package/dist/fields/PushToggle.svelte +93 -0
- package/dist/fields/PushToggle.svelte.d.ts +55 -0
- package/dist/fields/RadioGroup.svelte +88 -0
- package/dist/fields/RadioGroup.svelte.d.ts +41 -0
- package/dist/fields/RangeCalendar.svelte +51 -0
- package/dist/fields/RangeCalendar.svelte.d.ts +23 -0
- package/dist/fields/Rating.svelte +127 -0
- package/dist/fields/Rating.svelte.d.ts +86 -0
- package/dist/fields/SearchInput.svelte +58 -0
- package/dist/fields/SearchInput.svelte.d.ts +33 -0
- package/dist/fields/SegmentGroup.svelte +91 -0
- package/dist/fields/SegmentGroup.svelte.d.ts +20 -0
- package/dist/fields/Select.svelte +36 -0
- package/dist/fields/Select.svelte.d.ts +35 -0
- package/dist/fields/Slider.svelte +194 -0
- package/dist/fields/Slider.svelte.d.ts +100 -0
- package/dist/fields/TagsInput.svelte +256 -0
- package/dist/fields/TagsInput.svelte.d.ts +102 -0
- package/dist/fields/TextInput.svelte +26 -0
- package/dist/fields/TextInput.svelte.d.ts +36 -0
- package/dist/fields/Textarea.svelte +22 -0
- package/dist/fields/Textarea.svelte.d.ts +31 -0
- package/dist/fields/TimeField.svelte +30 -0
- package/dist/fields/TimeField.svelte.d.ts +19 -0
- package/dist/fields/Toggle.svelte +72 -0
- package/dist/fields/Toggle.svelte.d.ts +38 -0
- package/dist/fields/VideoInput.svelte +35 -0
- package/dist/fields/VideoInput.svelte.d.ts +46 -0
- package/dist/fields/calendar-props.d.ts +119 -0
- package/dist/fields/calendar-props.js +51 -0
- package/dist/fields/dates.d.ts +28 -0
- package/dist/fields/dates.js +26 -0
- package/dist/fields/field-types.d.ts +80 -0
- package/dist/fields/field-types.js +92 -0
- package/dist/fields/file-validation.d.ts +30 -0
- package/dist/fields/file-validation.js +51 -0
- package/dist/fields/index.d.ts +43 -0
- package/dist/fields/index.js +42 -0
- package/dist/fields/latest-search.svelte.d.ts +38 -0
- package/dist/fields/latest-search.svelte.js +85 -0
- package/dist/fields/number-format.d.ts +52 -0
- package/dist/fields/number-format.js +89 -0
- package/dist/fields/segmented-field.d.ts +128 -0
- package/dist/fields/segmented-field.js +52 -0
- package/dist/fields/slider-keys.d.ts +21 -0
- package/dist/fields/slider-keys.js +37 -0
- package/dist/formatting/Countdown.svelte +110 -0
- package/dist/formatting/Countdown.svelte.d.ts +35 -0
- package/dist/formatting/DateTime.svelte +35 -0
- package/dist/formatting/DateTime.svelte.d.ts +26 -0
- package/dist/formatting/Duration.svelte +18 -0
- package/dist/formatting/Duration.svelte.d.ts +20 -0
- package/dist/formatting/FormatList.svelte +31 -0
- package/dist/formatting/FormatList.svelte.d.ts +46 -0
- package/dist/formatting/Highlight.svelte +51 -0
- package/dist/formatting/Highlight.svelte.d.ts +19 -0
- package/dist/formatting/Number.svelte +35 -0
- package/dist/formatting/Number.svelte.d.ts +43 -0
- package/dist/formatting/RelativeTime.svelte +69 -0
- package/dist/formatting/RelativeTime.svelte.d.ts +26 -0
- package/dist/formatting/Year.svelte +39 -0
- package/dist/formatting/Year.svelte.d.ts +21 -0
- package/dist/formatting/duration.d.ts +44 -0
- package/dist/formatting/duration.js +125 -0
- package/dist/formatting/index.d.ts +15 -0
- package/dist/formatting/index.js +17 -0
- package/dist/forms/EntityForm.svelte +185 -0
- package/dist/forms/EntityForm.svelte.d.ts +66 -0
- package/dist/forms/FormActions.svelte +29 -0
- package/dist/forms/FormActions.svelte.d.ts +37 -0
- package/dist/forms/FormErrors.svelte +21 -0
- package/dist/forms/FormErrors.svelte.d.ts +16 -0
- package/dist/forms/HiddenField.svelte +22 -0
- package/dist/forms/HiddenField.svelte.d.ts +11 -0
- package/dist/forms/SearchForm.svelte +43 -0
- package/dist/forms/SearchForm.svelte.d.ts +36 -0
- package/dist/forms/entity-form.d.ts +12 -0
- package/dist/forms/entity-form.js +12 -0
- package/dist/forms/index.d.ts +14 -0
- package/dist/forms/index.js +14 -0
- package/dist/hotkeys/HotkeyBadge.svelte +39 -0
- package/dist/hotkeys/HotkeyBadge.svelte.d.ts +25 -0
- package/dist/hotkeys/HotkeyHelpDialog.svelte +68 -0
- package/dist/hotkeys/HotkeyHelpDialog.svelte.d.ts +35 -0
- package/dist/hotkeys/HotkeyProvider.svelte +92 -0
- package/dist/hotkeys/HotkeyProvider.svelte.d.ts +4 -0
- package/dist/hotkeys/context.svelte.d.ts +47 -0
- package/dist/hotkeys/context.svelte.js +72 -0
- package/dist/hotkeys/index.d.ts +28 -0
- package/dist/hotkeys/index.js +27 -0
- package/dist/hotkeys/match.d.ts +65 -0
- package/dist/hotkeys/match.js +135 -0
- package/dist/hotkeys/registry.svelte.d.ts +55 -0
- package/dist/hotkeys/registry.svelte.js +110 -0
- package/dist/hotkeys/types.d.ts +74 -0
- package/dist/hotkeys/types.js +18 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +37 -0
- package/dist/infobox/Infobox.svelte +79 -0
- package/dist/infobox/Infobox.svelte.d.ts +33 -0
- package/dist/infobox/InfoboxHeader.svelte +35 -0
- package/dist/infobox/InfoboxHeader.svelte.d.ts +18 -0
- package/dist/infobox/InfoboxImage.svelte +38 -0
- package/dist/infobox/InfoboxImage.svelte.d.ts +21 -0
- package/dist/infobox/InfoboxRow.svelte +50 -0
- package/dist/infobox/InfoboxRow.svelte.d.ts +25 -0
- package/dist/infobox/InfoboxSection.svelte +24 -0
- package/dist/infobox/InfoboxSection.svelte.d.ts +12 -0
- package/dist/infobox/index.d.ts +21 -0
- package/dist/infobox/index.js +20 -0
- package/dist/infobox/types.d.ts +86 -0
- package/dist/infobox/types.js +27 -0
- package/dist/layout/AppShell.svelte +50 -0
- package/dist/layout/AppShell.svelte.d.ts +28 -0
- package/dist/layout/Breadcrumbs.svelte +52 -0
- package/dist/layout/Breadcrumbs.svelte.d.ts +18 -0
- package/dist/layout/Cluster.svelte +28 -0
- package/dist/layout/Cluster.svelte.d.ts +27 -0
- package/dist/layout/DetailLayout.svelte +50 -0
- package/dist/layout/DetailLayout.svelte.d.ts +19 -0
- package/dist/layout/FilterBar.svelte +40 -0
- package/dist/layout/FilterBar.svelte.d.ts +12 -0
- package/dist/layout/Fits.svelte +27 -0
- package/dist/layout/Fits.svelte.d.ts +13 -0
- package/dist/layout/Flow.svelte +46 -0
- package/dist/layout/Flow.svelte.d.ts +16 -0
- package/dist/layout/Footer.svelte +32 -0
- package/dist/layout/Footer.svelte.d.ts +12 -0
- package/dist/layout/Grid.svelte +23 -0
- package/dist/layout/Grid.svelte.d.ts +26 -0
- package/dist/layout/HStack.svelte +12 -0
- package/dist/layout/HStack.svelte.d.ts +34 -0
- package/dist/layout/Hero.svelte +76 -0
- package/dist/layout/Hero.svelte.d.ts +36 -0
- package/dist/layout/Main.svelte +30 -0
- package/dist/layout/Main.svelte.d.ts +15 -0
- package/dist/layout/Navbar.svelte +68 -0
- package/dist/layout/Navbar.svelte.d.ts +31 -0
- package/dist/layout/PageHeader.svelte +77 -0
- package/dist/layout/PageHeader.svelte.d.ts +33 -0
- package/dist/layout/Section.svelte +72 -0
- package/dist/layout/Section.svelte.d.ts +40 -0
- package/dist/layout/Sidebar.svelte +54 -0
- package/dist/layout/Sidebar.svelte.d.ts +27 -0
- package/dist/layout/Spacer.svelte +12 -0
- package/dist/layout/Spacer.svelte.d.ts +6 -0
- package/dist/layout/Tabs.svelte +85 -0
- package/dist/layout/Tabs.svelte.d.ts +42 -0
- package/dist/layout/VStack.svelte +12 -0
- package/dist/layout/VStack.svelte.d.ts +29 -0
- package/dist/layout/index.d.ts +38 -0
- package/dist/layout/index.js +38 -0
- package/dist/layout/space.d.ts +44 -0
- package/dist/layout/space.js +76 -0
- package/dist/layout/types.d.ts +52 -0
- package/dist/layout/types.js +27 -0
- package/dist/links/ContextLinks.svelte +28 -0
- package/dist/links/ContextLinks.svelte.d.ts +20 -0
- package/dist/links/EmailLink.svelte +26 -0
- package/dist/links/EmailLink.svelte.d.ts +20 -0
- package/dist/links/index.d.ts +7 -0
- package/dist/links/index.js +7 -0
- package/dist/media/Figure.svelte +26 -0
- package/dist/media/Figure.svelte.d.ts +12 -0
- package/dist/media/Image.svelte +76 -0
- package/dist/media/Image.svelte.d.ts +41 -0
- package/dist/media/Video.svelte +65 -0
- package/dist/media/Video.svelte.d.ts +29 -0
- package/dist/media/image-dimensions.d.ts +28 -0
- package/dist/media/image-dimensions.js +34 -0
- package/dist/media/index.d.ts +10 -0
- package/dist/media/index.js +10 -0
- package/dist/search/CommandPalette.svelte +257 -0
- package/dist/search/CommandPalette.svelte.d.ts +59 -0
- package/dist/search/index.d.ts +13 -0
- package/dist/search/index.js +13 -0
- package/dist/search/types.d.ts +40 -0
- package/dist/search/types.js +20 -0
- package/dist/seo/Head.svelte +190 -0
- package/dist/seo/Head.svelte.d.ts +86 -0
- package/dist/seo/JsonLd.svelte +30 -0
- package/dist/seo/JsonLd.svelte.d.ts +20 -0
- package/dist/seo/index.d.ts +18 -0
- package/dist/seo/index.js +17 -0
- package/dist/seo/json-ld.d.ts +33 -0
- package/dist/seo/json-ld.js +29 -0
- package/dist/seo/og-image.d.ts +72 -0
- package/dist/seo/og-image.js +82 -0
- package/dist/seo/types.d.ts +43 -0
- package/dist/seo/types.js +6 -0
- package/dist/theme.css +161 -0
- package/dist/tips/PopoverTip.svelte +80 -0
- package/dist/tips/PopoverTip.svelte.d.ts +33 -0
- package/dist/tips/Tip.svelte +91 -0
- package/dist/tips/Tip.svelte.d.ts +25 -0
- package/dist/tips/index.d.ts +15 -0
- package/dist/tips/index.js +14 -0
- package/dist/tips/tip-stack.d.ts +26 -0
- package/dist/tips/tip-stack.js +37 -0
- package/dist/tips/tip-store.svelte.d.ts +75 -0
- package/dist/tips/tip-store.svelte.js +158 -0
- package/dist/tips/types.d.ts +46 -0
- package/dist/tips/types.js +6 -0
- package/dist/ui/Accordion.svelte +75 -0
- package/dist/ui/Accordion.svelte.d.ts +50 -0
- package/dist/ui/AccordionItem.svelte +73 -0
- package/dist/ui/AccordionItem.svelte.d.ts +18 -0
- package/dist/ui/Alert.svelte +61 -0
- package/dist/ui/Alert.svelte.d.ts +37 -0
- package/dist/ui/Badge.svelte +39 -0
- package/dist/ui/Badge.svelte.d.ts +32 -0
- package/dist/ui/Button.svelte +44 -0
- package/dist/ui/Button.svelte.d.ts +29 -0
- package/dist/ui/ButtonGroup.svelte +24 -0
- package/dist/ui/ButtonGroup.svelte.d.ts +17 -0
- package/dist/ui/Card.svelte +49 -0
- package/dist/ui/Card.svelte.d.ts +44 -0
- package/dist/ui/Chip.svelte +58 -0
- package/dist/ui/Chip.svelte.d.ts +21 -0
- package/dist/ui/ConfirmButton.svelte +75 -0
- package/dist/ui/ConfirmButton.svelte.d.ts +48 -0
- package/dist/ui/ContextMenu.svelte +75 -0
- package/dist/ui/ContextMenu.svelte.d.ts +25 -0
- package/dist/ui/Disclosure.svelte +46 -0
- package/dist/ui/Disclosure.svelte.d.ts +22 -0
- package/dist/ui/Divider.svelte +47 -0
- package/dist/ui/Divider.svelte.d.ts +28 -0
- package/dist/ui/DropdownMenu.svelte +44 -0
- package/dist/ui/DropdownMenu.svelte.d.ts +30 -0
- package/dist/ui/EmptyState.svelte +37 -0
- package/dist/ui/EmptyState.svelte.d.ts +22 -0
- package/dist/ui/ExternalLink.svelte +38 -0
- package/dist/ui/ExternalLink.svelte.d.ts +34 -0
- package/dist/ui/Heading.svelte +58 -0
- package/dist/ui/Heading.svelte.d.ts +22 -0
- package/dist/ui/Link.svelte +34 -0
- package/dist/ui/Link.svelte.d.ts +20 -0
- package/dist/ui/LinkButton.svelte +51 -0
- package/dist/ui/LinkButton.svelte.d.ts +33 -0
- package/dist/ui/Menu.svelte +24 -0
- package/dist/ui/Menu.svelte.d.ts +13 -0
- package/dist/ui/MenuCheckboxItem.svelte +33 -0
- package/dist/ui/MenuCheckboxItem.svelte.d.ts +20 -0
- package/dist/ui/MenuItem.svelte +73 -0
- package/dist/ui/MenuItem.svelte.d.ts +21 -0
- package/dist/ui/MenuRadioGroup.svelte +25 -0
- package/dist/ui/MenuRadioGroup.svelte.d.ts +20 -0
- package/dist/ui/MenuRadioItem.svelte +20 -0
- package/dist/ui/MenuRadioItem.svelte.d.ts +15 -0
- package/dist/ui/MenuSeparator.svelte +27 -0
- package/dist/ui/MenuSeparator.svelte.d.ts +8 -0
- package/dist/ui/MenuSub.svelte +24 -0
- package/dist/ui/MenuSub.svelte.d.ts +15 -0
- package/dist/ui/Popover.svelte +63 -0
- package/dist/ui/Popover.svelte.d.ts +40 -0
- package/dist/ui/ShareButton.svelte +64 -0
- package/dist/ui/ShareButton.svelte.d.ts +39 -0
- package/dist/ui/Skeleton.svelte +43 -0
- package/dist/ui/Skeleton.svelte.d.ts +22 -0
- package/dist/ui/Spinner.svelte +41 -0
- package/dist/ui/Spinner.svelte.d.ts +35 -0
- package/dist/ui/Stack.svelte +36 -0
- package/dist/ui/Stack.svelte.d.ts +48 -0
- package/dist/ui/ThemeToggle.svelte +65 -0
- package/dist/ui/ThemeToggle.svelte.d.ts +24 -0
- package/dist/ui/ToggleButton.svelte +58 -0
- package/dist/ui/ToggleButton.svelte.d.ts +45 -0
- package/dist/ui/ToggleGroup.svelte +142 -0
- package/dist/ui/ToggleGroup.svelte.d.ts +86 -0
- package/dist/ui/Toolbar.svelte +40 -0
- package/dist/ui/Toolbar.svelte.d.ts +20 -0
- package/dist/ui/ToolbarButton.svelte +29 -0
- package/dist/ui/ToolbarButton.svelte.d.ts +21 -0
- package/dist/ui/ToolbarLink.svelte +21 -0
- package/dist/ui/ToolbarLink.svelte.d.ts +12 -0
- package/dist/ui/ToolbarSeparator.svelte +22 -0
- package/dist/ui/ToolbarSeparator.svelte.d.ts +12 -0
- package/dist/ui/ToolbarToggleGroup.svelte +66 -0
- package/dist/ui/ToolbarToggleGroup.svelte.d.ts +52 -0
- package/dist/ui/Tooltip.svelte +54 -0
- package/dist/ui/Tooltip.svelte.d.ts +35 -0
- package/dist/ui/VisuallyHidden.svelte +23 -0
- package/dist/ui/VisuallyHidden.svelte.d.ts +10 -0
- package/dist/ui/accordion-context.d.ts +26 -0
- package/dist/ui/accordion-context.js +23 -0
- package/dist/ui/colour-token.d.ts +41 -0
- package/dist/ui/colour-token.js +49 -0
- package/dist/ui/context-menu.d.ts +13 -0
- package/dist/ui/context-menu.js +13 -0
- package/dist/ui/index.d.ts +63 -0
- package/dist/ui/index.js +62 -0
- package/dist/ui/menu-context.d.ts +20 -0
- package/dist/ui/menu-context.js +22 -0
- package/dist/ui/menu-parts/CheckboxItemPart.svelte +26 -0
- package/dist/ui/menu-parts/CheckboxItemPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/ItemPart.svelte +29 -0
- package/dist/ui/menu-parts/ItemPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/RadioGroupPart.svelte +24 -0
- package/dist/ui/menu-parts/RadioGroupPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/RadioItemPart.svelte +22 -0
- package/dist/ui/menu-parts/RadioItemPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/SeparatorPart.svelte +16 -0
- package/dist/ui/menu-parts/SeparatorPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/SubPart.svelte +28 -0
- package/dist/ui/menu-parts/SubPart.svelte.d.ts +5 -0
- package/dist/ui/menu-parts/menu-parts.d.ts +104 -0
- package/dist/ui/menu-parts/menu-parts.js +31 -0
- package/dist/ui/menu-parts/parts.d.ts +12 -0
- package/dist/ui/menu-parts/parts.js +27 -0
- package/dist/ui/slug.d.ts +19 -0
- package/dist/ui/slug.js +25 -0
- package/dist/ui/toggle-classes.d.ts +39 -0
- package/dist/ui/toggle-classes.js +36 -0
- package/dist/ui/tones.d.ts +103 -0
- package/dist/ui/tones.js +240 -0
- package/package.json +41 -25
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The control props `<FormField>` hands its `children` snippet, and every
|
|
3
|
+
* field primitive accepts by spread: `<TextInput {...control} bind:value />`.
|
|
4
|
+
* Carrying the ids this way is what keeps `aria-describedby` and
|
|
5
|
+
* `aria-invalid` on the control in step with the hint and error paragraphs
|
|
6
|
+
* `FormField` renders, without either side knowing the other's markup.
|
|
7
|
+
*
|
|
8
|
+
* The daisyUI size tables live here for the same reason `ui/tones.ts` holds
|
|
9
|
+
* the button ones: Tailwind only generates classes it can see verbatim, so a
|
|
10
|
+
* `input-${size}` template string emits nothing at build time. Every field
|
|
11
|
+
* component looks a complete class name up rather than building one.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { Size } from '../ui/tones.ts';
|
|
16
|
+
/** Wiring a field primitive receives from its enclosing `FormField`. */
|
|
17
|
+
export interface FieldControl {
|
|
18
|
+
/** The control's `id`; the `FormField` label points at it. */
|
|
19
|
+
readonly id: string;
|
|
20
|
+
/**
|
|
21
|
+
* The id of the visible `<label>`. A labelable control (`input`, `select`,
|
|
22
|
+
* `textarea`, `button`, …) ignores it: `<label for>` already names it. A
|
|
23
|
+
* control `<label for>` cannot reach — a `role="slider"` thumb, a
|
|
24
|
+
* `role="group"` / `radiogroup` root, a segmented date group — points
|
|
25
|
+
* `aria-labelledby` at it instead of taking a labelling prop of its own.
|
|
26
|
+
*/
|
|
27
|
+
readonly labelId: string;
|
|
28
|
+
/** Space-separated ids of the hint / error paragraphs; empty when neither is shown. */
|
|
29
|
+
readonly describedBy: string;
|
|
30
|
+
/** The field currently shows an error. */
|
|
31
|
+
readonly invalid: boolean;
|
|
32
|
+
readonly required: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* What `<Fieldset>` hands its `children` snippet: the id of its `<legend>`,
|
|
36
|
+
* for a role-based control inside the group (which a legend names only
|
|
37
|
+
* through the `<fieldset>`, a different node) to point `aria-labelledby` at.
|
|
38
|
+
*/
|
|
39
|
+
export interface FieldsetControl {
|
|
40
|
+
/** The id of the `<legend>`. */
|
|
41
|
+
readonly labelId: string;
|
|
42
|
+
}
|
|
43
|
+
/** Size steps shared by the field primitives (daisyUI has no `xl` field). */
|
|
44
|
+
export type FieldSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
45
|
+
/** One entry of a `Select`, `RadioGroup` or `CheckboxGroup`. */
|
|
46
|
+
export interface FieldOption {
|
|
47
|
+
readonly value: string;
|
|
48
|
+
readonly label: string;
|
|
49
|
+
readonly disabled?: boolean | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* What an options prop accepts: full options, or bare strings for the common
|
|
53
|
+
* case where the value and the label are the same word.
|
|
54
|
+
*/
|
|
55
|
+
export type FieldOptionInput = FieldOption | string;
|
|
56
|
+
/** Widen the bare-string shorthand into full {@link FieldOption}s. */
|
|
57
|
+
export declare function toFieldOptions(options: readonly FieldOptionInput[]): readonly FieldOption[];
|
|
58
|
+
/** Literal daisyUI class per `FieldSize` for `TextInput`; a lookup table so Tailwind's scanner sees every class. */
|
|
59
|
+
export declare const inputSize: Record<FieldSize, string>;
|
|
60
|
+
/** Literal daisyUI class per `FieldSize` for `Textarea`; a lookup table so Tailwind's scanner sees every class. */
|
|
61
|
+
export declare const textareaSize: Record<FieldSize, string>;
|
|
62
|
+
/** Literal daisyUI class per `FieldSize` for `Select`; a lookup table so Tailwind's scanner sees every class. */
|
|
63
|
+
export declare const selectSize: Record<FieldSize, string>;
|
|
64
|
+
/** Literal daisyUI class per `FieldSize` for `Checkbox`; a lookup table so Tailwind's scanner sees every class. */
|
|
65
|
+
export declare const checkboxSize: Record<FieldSize, string>;
|
|
66
|
+
/** Literal daisyUI class per `FieldSize` for `Toggle`; a lookup table so Tailwind's scanner sees every class. */
|
|
67
|
+
export declare const toggleSize: Record<FieldSize, string>;
|
|
68
|
+
/** Literal daisyUI class per `FieldSize` for `FileInput`; a lookup table so Tailwind's scanner sees every class. */
|
|
69
|
+
export declare const fileInputSize: Record<FieldSize, string>;
|
|
70
|
+
/**
|
|
71
|
+
* Literal daisyUI class per `FieldSize` for `Slider`; a lookup table so Tailwind's scanner sees every class.
|
|
72
|
+
* Each sets `--range-thumb-size`, which the slider's thumb and track are sized from.
|
|
73
|
+
*/
|
|
74
|
+
export declare const rangeSize: Record<FieldSize, string>;
|
|
75
|
+
/** Literal cell size and text-size classes per `FieldSize` for `PinInput`'s cells; a lookup table so Tailwind's scanner sees every class. */
|
|
76
|
+
export declare const pinCellSize: Record<FieldSize, string>;
|
|
77
|
+
/** Literal daisyUI button size per `FieldSize` for a button inside an `input` composite (`NumberField`'s − / +, `PasswordInput`'s reveal toggle), one step smaller than the field so it fits; a lookup table so Tailwind's scanner sees every class. */
|
|
78
|
+
export declare const inputButtonSize: Record<FieldSize, string>;
|
|
79
|
+
/** Literal daisyUI class per `Size` for `Rating`; each sets `--size`, the star height. A lookup table so Tailwind's scanner sees every class. */
|
|
80
|
+
export declare const ratingSize: Record<Size, string>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The control props `<FormField>` hands its `children` snippet, and every
|
|
3
|
+
* field primitive accepts by spread: `<TextInput {...control} bind:value />`.
|
|
4
|
+
* Carrying the ids this way is what keeps `aria-describedby` and
|
|
5
|
+
* `aria-invalid` on the control in step with the hint and error paragraphs
|
|
6
|
+
* `FormField` renders, without either side knowing the other's markup.
|
|
7
|
+
*
|
|
8
|
+
* The daisyUI size tables live here for the same reason `ui/tones.ts` holds
|
|
9
|
+
* the button ones: Tailwind only generates classes it can see verbatim, so a
|
|
10
|
+
* `input-${size}` template string emits nothing at build time. Every field
|
|
11
|
+
* component looks a complete class name up rather than building one.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/** Widen the bare-string shorthand into full {@link FieldOption}s. */
|
|
16
|
+
export function toFieldOptions(options) {
|
|
17
|
+
return options.map((option) => typeof option === 'string' ? { value: option, label: option } : option);
|
|
18
|
+
}
|
|
19
|
+
/** Literal daisyUI class per `FieldSize` for `TextInput`; a lookup table so Tailwind's scanner sees every class. */
|
|
20
|
+
export const inputSize = {
|
|
21
|
+
xs: 'input-xs',
|
|
22
|
+
sm: 'input-sm',
|
|
23
|
+
md: 'input-md',
|
|
24
|
+
lg: 'input-lg',
|
|
25
|
+
};
|
|
26
|
+
/** Literal daisyUI class per `FieldSize` for `Textarea`; a lookup table so Tailwind's scanner sees every class. */
|
|
27
|
+
export const textareaSize = {
|
|
28
|
+
xs: 'textarea-xs',
|
|
29
|
+
sm: 'textarea-sm',
|
|
30
|
+
md: 'textarea-md',
|
|
31
|
+
lg: 'textarea-lg',
|
|
32
|
+
};
|
|
33
|
+
/** Literal daisyUI class per `FieldSize` for `Select`; a lookup table so Tailwind's scanner sees every class. */
|
|
34
|
+
export const selectSize = {
|
|
35
|
+
xs: 'select-xs',
|
|
36
|
+
sm: 'select-sm',
|
|
37
|
+
md: 'select-md',
|
|
38
|
+
lg: 'select-lg',
|
|
39
|
+
};
|
|
40
|
+
/** Literal daisyUI class per `FieldSize` for `Checkbox`; a lookup table so Tailwind's scanner sees every class. */
|
|
41
|
+
export const checkboxSize = {
|
|
42
|
+
xs: 'checkbox-xs',
|
|
43
|
+
sm: 'checkbox-sm',
|
|
44
|
+
md: 'checkbox-md',
|
|
45
|
+
lg: 'checkbox-lg',
|
|
46
|
+
};
|
|
47
|
+
/** Literal daisyUI class per `FieldSize` for `Toggle`; a lookup table so Tailwind's scanner sees every class. */
|
|
48
|
+
export const toggleSize = {
|
|
49
|
+
xs: 'toggle-xs',
|
|
50
|
+
sm: 'toggle-sm',
|
|
51
|
+
md: 'toggle-md',
|
|
52
|
+
lg: 'toggle-lg',
|
|
53
|
+
};
|
|
54
|
+
/** Literal daisyUI class per `FieldSize` for `FileInput`; a lookup table so Tailwind's scanner sees every class. */
|
|
55
|
+
export const fileInputSize = {
|
|
56
|
+
xs: 'file-input-xs',
|
|
57
|
+
sm: 'file-input-sm',
|
|
58
|
+
md: 'file-input-md',
|
|
59
|
+
lg: 'file-input-lg',
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Literal daisyUI class per `FieldSize` for `Slider`; a lookup table so Tailwind's scanner sees every class.
|
|
63
|
+
* Each sets `--range-thumb-size`, which the slider's thumb and track are sized from.
|
|
64
|
+
*/
|
|
65
|
+
export const rangeSize = {
|
|
66
|
+
xs: 'range-xs',
|
|
67
|
+
sm: 'range-sm',
|
|
68
|
+
md: 'range-md',
|
|
69
|
+
lg: 'range-lg',
|
|
70
|
+
};
|
|
71
|
+
/** Literal cell size and text-size classes per `FieldSize` for `PinInput`'s cells; a lookup table so Tailwind's scanner sees every class. */
|
|
72
|
+
export const pinCellSize = {
|
|
73
|
+
xs: 'size-6 text-xs',
|
|
74
|
+
sm: 'size-8 text-sm',
|
|
75
|
+
md: 'size-10 text-base',
|
|
76
|
+
lg: 'size-12 text-lg',
|
|
77
|
+
};
|
|
78
|
+
/** Literal daisyUI button size per `FieldSize` for a button inside an `input` composite (`NumberField`'s − / +, `PasswordInput`'s reveal toggle), one step smaller than the field so it fits; a lookup table so Tailwind's scanner sees every class. */
|
|
79
|
+
export const inputButtonSize = {
|
|
80
|
+
xs: 'btn-xs',
|
|
81
|
+
sm: 'btn-xs',
|
|
82
|
+
md: 'btn-sm',
|
|
83
|
+
lg: 'btn-md',
|
|
84
|
+
};
|
|
85
|
+
/** Literal daisyUI class per `Size` for `Rating`; each sets `--size`, the star height. A lookup table so Tailwind's scanner sees every class. */
|
|
86
|
+
export const ratingSize = {
|
|
87
|
+
xs: 'rating-xs',
|
|
88
|
+
sm: 'rating-sm',
|
|
89
|
+
md: 'rating-md',
|
|
90
|
+
lg: 'rating-lg',
|
|
91
|
+
xl: 'rating-xl',
|
|
92
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client-side file checks `FileInput` and `Dropzone` share.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions, so the rules are the same wherever a file comes from —
|
|
5
|
+
* the native picker or a drop, which the browser does NOT filter by
|
|
6
|
+
* `accept` — and testable without a DOM.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/** Why `Dropzone` refused a file. */
|
|
11
|
+
export interface FileRejection {
|
|
12
|
+
/** The refused file. */
|
|
13
|
+
readonly file: File;
|
|
14
|
+
/** Which rule refused it. */
|
|
15
|
+
readonly reason: 'too-large' | 'wrong-type' | 'too-many';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Whether `file` satisfies an `accept` string, with the native attribute's
|
|
19
|
+
* syntax: comma-separated `.ext` suffixes, `type/*` families and exact MIME
|
|
20
|
+
* types, all case-insensitive. An absent or empty `accept` accepts anything.
|
|
21
|
+
*/
|
|
22
|
+
export declare function acceptMatches(file: File, accept: string | undefined): boolean;
|
|
23
|
+
/** Whether `file` is over `maxBytes`; no cap means never. */
|
|
24
|
+
export declare function exceedsSize(file: File, maxBytes: number | undefined): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A byte count for a file row, in the largest decimal unit that keeps the
|
|
27
|
+
* number at or above 1 ("820 kB", "4.2 MB"), through `Intl.NumberFormat`'s
|
|
28
|
+
* unit style.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatFileSize(bytes: number, locales: string | readonly string[] | undefined): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client-side file checks `FileInput` and `Dropzone` share.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions, so the rules are the same wherever a file comes from —
|
|
5
|
+
* the native picker or a drop, which the browser does NOT filter by
|
|
6
|
+
* `accept` — and testable without a DOM.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Whether `file` satisfies an `accept` string, with the native attribute's
|
|
12
|
+
* syntax: comma-separated `.ext` suffixes, `type/*` families and exact MIME
|
|
13
|
+
* types, all case-insensitive. An absent or empty `accept` accepts anything.
|
|
14
|
+
*/
|
|
15
|
+
export function acceptMatches(file, accept) {
|
|
16
|
+
const tokens = (accept ?? '')
|
|
17
|
+
.split(',')
|
|
18
|
+
.map((token) => token.trim().toLowerCase())
|
|
19
|
+
.filter((token) => token !== '');
|
|
20
|
+
if (tokens.length === 0)
|
|
21
|
+
return true;
|
|
22
|
+
const name = file.name.toLowerCase();
|
|
23
|
+
const type = file.type.toLowerCase();
|
|
24
|
+
return tokens.some((token) => {
|
|
25
|
+
if (token.startsWith('.'))
|
|
26
|
+
return name.endsWith(token);
|
|
27
|
+
if (token.endsWith('/*'))
|
|
28
|
+
return type.startsWith(token.slice(0, -1));
|
|
29
|
+
return type === token;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Whether `file` is over `maxBytes`; no cap means never. */
|
|
33
|
+
export function exceedsSize(file, maxBytes) {
|
|
34
|
+
return maxBytes !== undefined && file.size > maxBytes;
|
|
35
|
+
}
|
|
36
|
+
const UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte'];
|
|
37
|
+
/**
|
|
38
|
+
* A byte count for a file row, in the largest decimal unit that keeps the
|
|
39
|
+
* number at or above 1 ("820 kB", "4.2 MB"), through `Intl.NumberFormat`'s
|
|
40
|
+
* unit style.
|
|
41
|
+
*/
|
|
42
|
+
export function formatFileSize(bytes, locales) {
|
|
43
|
+
const exponent = Math.min(UNITS.length - 1, Math.max(0, Math.floor(Math.log10(Math.max(bytes, 1)) / 3)));
|
|
44
|
+
const value = bytes / 1000 ** exponent;
|
|
45
|
+
return new Intl.NumberFormat(typeof locales === 'string' || locales === undefined ? locales : [...locales], {
|
|
46
|
+
style: 'unit',
|
|
47
|
+
unit: UNITS[exponent],
|
|
48
|
+
unitDisplay: 'short',
|
|
49
|
+
maximumFractionDigits: exponent === 0 ? 0 : 1,
|
|
50
|
+
}).format(value);
|
|
51
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fields — form controls wired through `FormField`'s `FieldControl` contract.
|
|
3
|
+
*
|
|
4
|
+
* The shape every control in here shares: `FormField` (or `Fieldset`) owns
|
|
5
|
+
* the label, the hint and the errors, derives one `id` into a `describedBy`
|
|
6
|
+
* and an `invalid` flag, and hands that `FieldControl` to its `children`
|
|
7
|
+
* snippet. A control spreads it — `<TextInput {...control} bind:value />` —
|
|
8
|
+
* and so carries `aria-describedby`, `aria-invalid` and `required` without
|
|
9
|
+
* either side knowing the other's markup.
|
|
10
|
+
*
|
|
11
|
+
* Optional props are declared `T | undefined` rather than `prop?: T`: the
|
|
12
|
+
* workspace compiles with `exactOptionalPropertyTypes`, under which a caller
|
|
13
|
+
* forwarding its own optional prop would not compile otherwise.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
export { default as Checkbox } from './Checkbox.svelte';
|
|
18
|
+
export { default as CheckboxGroup } from './CheckboxGroup.svelte';
|
|
19
|
+
export { default as Combobox } from './Combobox.svelte';
|
|
20
|
+
export { default as DateInput } from './DateInput.svelte';
|
|
21
|
+
export { default as Dropzone } from './Dropzone.svelte';
|
|
22
|
+
export { default as FieldErrors } from './FieldErrors.svelte';
|
|
23
|
+
export { default as Fieldset } from './Fieldset.svelte';
|
|
24
|
+
export { default as FileInput } from './FileInput.svelte';
|
|
25
|
+
export { default as FormField } from './FormField.svelte';
|
|
26
|
+
export { default as ImageInput } from './ImageInput.svelte';
|
|
27
|
+
export { default as MultiSelect } from './MultiSelect.svelte';
|
|
28
|
+
export { default as NumberField } from './NumberField.svelte';
|
|
29
|
+
export { default as PasswordInput } from './PasswordInput.svelte';
|
|
30
|
+
export { default as PinInput } from './PinInput.svelte';
|
|
31
|
+
export { default as RadioGroup } from './RadioGroup.svelte';
|
|
32
|
+
export { default as Rating } from './Rating.svelte';
|
|
33
|
+
export { default as SearchInput } from './SearchInput.svelte';
|
|
34
|
+
export { default as Select } from './Select.svelte';
|
|
35
|
+
export { default as Slider } from './Slider.svelte';
|
|
36
|
+
export { default as TagsInput } from './TagsInput.svelte';
|
|
37
|
+
export { default as Textarea } from './Textarea.svelte';
|
|
38
|
+
export { default as TextInput } from './TextInput.svelte';
|
|
39
|
+
export { default as Toggle } from './Toggle.svelte';
|
|
40
|
+
export { default as PushToggle, type PushDeclineReason, type PushEnableResult, } from './PushToggle.svelte';
|
|
41
|
+
export { default as VideoInput } from './VideoInput.svelte';
|
|
42
|
+
export * from './field-types.ts';
|
|
43
|
+
export type { FileRejection } from './file-validation.ts';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fields — form controls wired through `FormField`'s `FieldControl` contract.
|
|
3
|
+
*
|
|
4
|
+
* The shape every control in here shares: `FormField` (or `Fieldset`) owns
|
|
5
|
+
* the label, the hint and the errors, derives one `id` into a `describedBy`
|
|
6
|
+
* and an `invalid` flag, and hands that `FieldControl` to its `children`
|
|
7
|
+
* snippet. A control spreads it — `<TextInput {...control} bind:value />` —
|
|
8
|
+
* and so carries `aria-describedby`, `aria-invalid` and `required` without
|
|
9
|
+
* either side knowing the other's markup.
|
|
10
|
+
*
|
|
11
|
+
* Optional props are declared `T | undefined` rather than `prop?: T`: the
|
|
12
|
+
* workspace compiles with `exactOptionalPropertyTypes`, under which a caller
|
|
13
|
+
* forwarding its own optional prop would not compile otherwise.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
export { default as Checkbox } from './Checkbox.svelte';
|
|
18
|
+
export { default as CheckboxGroup } from './CheckboxGroup.svelte';
|
|
19
|
+
export { default as Combobox } from './Combobox.svelte';
|
|
20
|
+
export { default as DateInput } from './DateInput.svelte';
|
|
21
|
+
export { default as Dropzone } from './Dropzone.svelte';
|
|
22
|
+
export { default as FieldErrors } from './FieldErrors.svelte';
|
|
23
|
+
export { default as Fieldset } from './Fieldset.svelte';
|
|
24
|
+
export { default as FileInput } from './FileInput.svelte';
|
|
25
|
+
export { default as FormField } from './FormField.svelte';
|
|
26
|
+
export { default as ImageInput } from './ImageInput.svelte';
|
|
27
|
+
export { default as MultiSelect } from './MultiSelect.svelte';
|
|
28
|
+
export { default as NumberField } from './NumberField.svelte';
|
|
29
|
+
export { default as PasswordInput } from './PasswordInput.svelte';
|
|
30
|
+
export { default as PinInput } from './PinInput.svelte';
|
|
31
|
+
export { default as RadioGroup } from './RadioGroup.svelte';
|
|
32
|
+
export { default as Rating } from './Rating.svelte';
|
|
33
|
+
export { default as SearchInput } from './SearchInput.svelte';
|
|
34
|
+
export { default as Select } from './Select.svelte';
|
|
35
|
+
export { default as Slider } from './Slider.svelte';
|
|
36
|
+
export { default as TagsInput } from './TagsInput.svelte';
|
|
37
|
+
export { default as Textarea } from './Textarea.svelte';
|
|
38
|
+
export { default as TextInput } from './TextInput.svelte';
|
|
39
|
+
export { default as Toggle } from './Toggle.svelte';
|
|
40
|
+
export { default as PushToggle, } from './PushToggle.svelte';
|
|
41
|
+
export { default as VideoInput } from './VideoInput.svelte';
|
|
42
|
+
export * from "./field-types.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The search lifecycle `Combobox` and `TagsInput` share: debounce,
|
|
3
|
+
* latest-wins and stale-while-revalidate.
|
|
4
|
+
*
|
|
5
|
+
* debounce a keystroke does not start a request; `debounceMs` of
|
|
6
|
+
* quiet does.
|
|
7
|
+
* latest-wins each request gets an `AbortController`, and starting a
|
|
8
|
+
* new one aborts the last, so a slow first response cannot
|
|
9
|
+
* overwrite a fast second one.
|
|
10
|
+
* stale-while- `results` keeps the previous answer while the next is in
|
|
11
|
+
* revalidate flight, with `pending` true, so a dropdown does not
|
|
12
|
+
* strobe on every keystroke.
|
|
13
|
+
*
|
|
14
|
+
* Reactive (`$state`) so a component reads `results`, `pending` and `error`
|
|
15
|
+
* straight into its template. Call `dispose()` from an `$effect` teardown.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
/** An asynchronous search: `signal` aborts when a newer query supersedes this one. */
|
|
20
|
+
export type SearchFn<T> = (query: string, signal: AbortSignal) => Promise<readonly T[]>;
|
|
21
|
+
/** Debounced, latest-wins search state for one input. */
|
|
22
|
+
export declare class LatestSearch<T> {
|
|
23
|
+
#private;
|
|
24
|
+
/** What the last settled search returned. */
|
|
25
|
+
results: readonly T[];
|
|
26
|
+
/** A search is scheduled or in flight. */
|
|
27
|
+
pending: boolean;
|
|
28
|
+
/** The last search's failure message, if it failed. */
|
|
29
|
+
error: string | undefined;
|
|
30
|
+
/** Getters, so the component's current props are read at call time. */
|
|
31
|
+
constructor(search: () => SearchFn<T> | undefined, debounceMs: () => number);
|
|
32
|
+
/** Search for `query` after the debounce, superseding anything earlier. */
|
|
33
|
+
schedule(query: string): void;
|
|
34
|
+
/** Cancel anything scheduled or in flight and empty the results. */
|
|
35
|
+
clear(): void;
|
|
36
|
+
/** Cancel anything scheduled or in flight; for an `$effect` teardown. */
|
|
37
|
+
dispose(): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The search lifecycle `Combobox` and `TagsInput` share: debounce,
|
|
3
|
+
* latest-wins and stale-while-revalidate.
|
|
4
|
+
*
|
|
5
|
+
* debounce a keystroke does not start a request; `debounceMs` of
|
|
6
|
+
* quiet does.
|
|
7
|
+
* latest-wins each request gets an `AbortController`, and starting a
|
|
8
|
+
* new one aborts the last, so a slow first response cannot
|
|
9
|
+
* overwrite a fast second one.
|
|
10
|
+
* stale-while- `results` keeps the previous answer while the next is in
|
|
11
|
+
* revalidate flight, with `pending` true, so a dropdown does not
|
|
12
|
+
* strobe on every keystroke.
|
|
13
|
+
*
|
|
14
|
+
* Reactive (`$state`) so a component reads `results`, `pending` and `error`
|
|
15
|
+
* straight into its template. Call `dispose()` from an `$effect` teardown.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
/** Debounced, latest-wins search state for one input. */
|
|
20
|
+
export class LatestSearch {
|
|
21
|
+
/** What the last settled search returned. */
|
|
22
|
+
results = $state([]);
|
|
23
|
+
/** A search is scheduled or in flight. */
|
|
24
|
+
pending = $state(false);
|
|
25
|
+
/** The last search's failure message, if it failed. */
|
|
26
|
+
error = $state();
|
|
27
|
+
#search;
|
|
28
|
+
#debounceMs;
|
|
29
|
+
#timer;
|
|
30
|
+
#inFlight;
|
|
31
|
+
/** Getters, so the component's current props are read at call time. */
|
|
32
|
+
constructor(search, debounceMs) {
|
|
33
|
+
this.#search = search;
|
|
34
|
+
this.#debounceMs = debounceMs;
|
|
35
|
+
}
|
|
36
|
+
/** Search for `query` after the debounce, superseding anything earlier. */
|
|
37
|
+
schedule(query) {
|
|
38
|
+
if (this.#timer !== undefined)
|
|
39
|
+
clearTimeout(this.#timer);
|
|
40
|
+
this.#timer = setTimeout(() => {
|
|
41
|
+
this.#timer = undefined;
|
|
42
|
+
this.#run(query);
|
|
43
|
+
}, this.#debounceMs());
|
|
44
|
+
}
|
|
45
|
+
/** Cancel anything scheduled or in flight and empty the results. */
|
|
46
|
+
clear() {
|
|
47
|
+
this.dispose();
|
|
48
|
+
this.#inFlight = undefined;
|
|
49
|
+
this.pending = false;
|
|
50
|
+
this.results = [];
|
|
51
|
+
}
|
|
52
|
+
/** Cancel anything scheduled or in flight; for an `$effect` teardown. */
|
|
53
|
+
dispose() {
|
|
54
|
+
if (this.#timer !== undefined)
|
|
55
|
+
clearTimeout(this.#timer);
|
|
56
|
+
this.#timer = undefined;
|
|
57
|
+
this.#inFlight?.abort();
|
|
58
|
+
}
|
|
59
|
+
#run(query) {
|
|
60
|
+
const search = this.#search();
|
|
61
|
+
if (search === undefined)
|
|
62
|
+
return;
|
|
63
|
+
this.#inFlight?.abort();
|
|
64
|
+
const own = new AbortController();
|
|
65
|
+
this.#inFlight = own;
|
|
66
|
+
this.pending = true;
|
|
67
|
+
this.error = undefined;
|
|
68
|
+
// A superseded request must not write: `#inFlight` is the identity check,
|
|
69
|
+
// `signal.aborted` catches the caller aborting its own work.
|
|
70
|
+
const current = () => !own.signal.aborted && this.#inFlight === own;
|
|
71
|
+
void search(query, own.signal)
|
|
72
|
+
.then((next) => {
|
|
73
|
+
if (!current())
|
|
74
|
+
return;
|
|
75
|
+
this.results = next;
|
|
76
|
+
this.pending = false;
|
|
77
|
+
})
|
|
78
|
+
.catch((error) => {
|
|
79
|
+
if (!current())
|
|
80
|
+
return;
|
|
81
|
+
this.pending = false;
|
|
82
|
+
this.error = error instanceof Error ? error.message : String(error);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware number formatting and parsing for `NumberField`.
|
|
3
|
+
*
|
|
4
|
+
* Formatting is `Intl.NumberFormat`. Parsing is the inverse the platform does
|
|
5
|
+
* not ship: the locale's group and decimal separators, and any literal text
|
|
6
|
+
* the options add (a unit, a currency symbol, a percent sign), are learnt
|
|
7
|
+
* from `formatToParts` on a sample number, so "1.234,5 cm" in `de-DE` and
|
|
8
|
+
* "1,234.5 cm" in `en-AU` both read back as `1234.5`.
|
|
9
|
+
*
|
|
10
|
+
* Only ASCII digits are parsed. A locale whose formatter writes other digits
|
|
11
|
+
* (Arabic-Indic, Devanagari) formats correctly but does not read its own
|
|
12
|
+
* output back; widening the parser is a later decision (#145).
|
|
13
|
+
*
|
|
14
|
+
* Pure functions, no module-level state, so the file stays tree-shakeable.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
/** The locales argument every function here accepts, as `Intl.NumberFormat` does. */
|
|
19
|
+
export type NumberLocales = string | readonly string[] | undefined;
|
|
20
|
+
/** What a locale and a set of options write around the digits. */
|
|
21
|
+
export interface NumberSymbols {
|
|
22
|
+
/** The grouping separator, e.g. `','` in `en-AU`, `'.'` in `de-DE`, a narrow no-break space in `fr-FR`. */
|
|
23
|
+
readonly group: string;
|
|
24
|
+
/** The decimal separator. */
|
|
25
|
+
readonly decimal: string;
|
|
26
|
+
/** Every other non-digit string the format adds: unit, currency, percent sign, literal spacing. */
|
|
27
|
+
readonly literals: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
/** Learn the separators and literal text a locale and options produce. */
|
|
30
|
+
export declare function numberSymbols(locales: NumberLocales, options?: Intl.NumberFormatOptions): NumberSymbols;
|
|
31
|
+
/** Format `value` for display; `''` for `undefined`. */
|
|
32
|
+
export declare function formatNumber(value: number | undefined, locales: NumberLocales, options?: Intl.NumberFormatOptions): string;
|
|
33
|
+
/**
|
|
34
|
+
* Parse text written in `locales` with `options` back into a number.
|
|
35
|
+
*
|
|
36
|
+
* Returns `undefined` for empty (or whitespace-only) text and `NaN` for text
|
|
37
|
+
* that is not a number, so a caller can tell "cleared" from "garbage".
|
|
38
|
+
* Percent-style input is divided by 100, the inverse of the formatter.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseNumber(text: string, locales: NumberLocales, options?: Intl.NumberFormatOptions): number | undefined;
|
|
41
|
+
/** Number of decimal places in `n` as written, e.g. 2 for `0.25`, 0 for `5`. */
|
|
42
|
+
export declare function decimalPlaces(n: number): number;
|
|
43
|
+
/** Round `n` to `places` decimal places without binary drift (`0.1 + 0.2` → `0.3`). */
|
|
44
|
+
export declare function roundTo(n: number, places: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* The decimal places a committed value keeps: the more of the step's and the
|
|
47
|
+
* formatter's own (a percent shows two more places of the fraction than it
|
|
48
|
+
* displays), so a value is never rounded finer than the reader can see.
|
|
49
|
+
*/
|
|
50
|
+
export declare function valuePrecision(step: number, locales: NumberLocales, options?: Intl.NumberFormatOptions): number;
|
|
51
|
+
/** Clamp `n` into `[min, max]`; either bound may be absent. */
|
|
52
|
+
export declare function clamp(n: number, min: number | undefined, max: number | undefined): number;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware number formatting and parsing for `NumberField`.
|
|
3
|
+
*
|
|
4
|
+
* Formatting is `Intl.NumberFormat`. Parsing is the inverse the platform does
|
|
5
|
+
* not ship: the locale's group and decimal separators, and any literal text
|
|
6
|
+
* the options add (a unit, a currency symbol, a percent sign), are learnt
|
|
7
|
+
* from `formatToParts` on a sample number, so "1.234,5 cm" in `de-DE` and
|
|
8
|
+
* "1,234.5 cm" in `en-AU` both read back as `1234.5`.
|
|
9
|
+
*
|
|
10
|
+
* Only ASCII digits are parsed. A locale whose formatter writes other digits
|
|
11
|
+
* (Arabic-Indic, Devanagari) formats correctly but does not read its own
|
|
12
|
+
* output back; widening the parser is a later decision (#145).
|
|
13
|
+
*
|
|
14
|
+
* Pure functions, no module-level state, so the file stays tree-shakeable.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
/** One formatter per call site; `Intl.NumberFormat` wants a mutable array. */
|
|
19
|
+
function formatter(locales, options) {
|
|
20
|
+
return new Intl.NumberFormat(typeof locales === 'string' || locales === undefined ? locales : [...locales], options);
|
|
21
|
+
}
|
|
22
|
+
/** Learn the separators and literal text a locale and options produce. */
|
|
23
|
+
export function numberSymbols(locales, options) {
|
|
24
|
+
const parts = formatter(locales, { ...options, useGrouping: true }).formatToParts(-12345.6);
|
|
25
|
+
const of = (type) => parts.find((part) => part.type === type)?.value ?? '';
|
|
26
|
+
const literals = parts
|
|
27
|
+
.filter((part) => ['literal', 'unit', 'currency', 'percentSign', 'plusSign'].includes(part.type))
|
|
28
|
+
.map((part) => part.value.trim())
|
|
29
|
+
.filter((value) => value !== '');
|
|
30
|
+
return { group: of('group'), decimal: of('decimal') || '.', literals };
|
|
31
|
+
}
|
|
32
|
+
/** Format `value` for display; `''` for `undefined`. */
|
|
33
|
+
export function formatNumber(value, locales, options) {
|
|
34
|
+
return value === undefined ? '' : formatter(locales, options).format(value);
|
|
35
|
+
}
|
|
36
|
+
/** Spaces a locale may group with, all read as the same separator. */
|
|
37
|
+
const SPACES = /[\s ]/g;
|
|
38
|
+
/**
|
|
39
|
+
* Parse text written in `locales` with `options` back into a number.
|
|
40
|
+
*
|
|
41
|
+
* Returns `undefined` for empty (or whitespace-only) text and `NaN` for text
|
|
42
|
+
* that is not a number, so a caller can tell "cleared" from "garbage".
|
|
43
|
+
* Percent-style input is divided by 100, the inverse of the formatter.
|
|
44
|
+
*/
|
|
45
|
+
export function parseNumber(text, locales, options) {
|
|
46
|
+
if (text.trim() === '')
|
|
47
|
+
return undefined;
|
|
48
|
+
const { group, decimal, literals } = numberSymbols(locales, options);
|
|
49
|
+
let rest = text;
|
|
50
|
+
// Longest first, so "US$" is removed before "$".
|
|
51
|
+
for (const literal of [...literals].sort((a, b) => b.length - a.length)) {
|
|
52
|
+
rest = rest.split(literal).join('');
|
|
53
|
+
}
|
|
54
|
+
if (group.trim() === '')
|
|
55
|
+
rest = rest.replace(SPACES, '');
|
|
56
|
+
else
|
|
57
|
+
rest = rest.split(group).join('').replace(SPACES, '');
|
|
58
|
+
rest = rest
|
|
59
|
+
.split(decimal)
|
|
60
|
+
.join('.')
|
|
61
|
+
.replace(/[−‒–]/g, '-');
|
|
62
|
+
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(rest))
|
|
63
|
+
return Number.NaN;
|
|
64
|
+
const parsed = Number(rest);
|
|
65
|
+
return options?.style === 'percent' ? roundTo(parsed / 100, 15) : parsed;
|
|
66
|
+
}
|
|
67
|
+
/** Number of decimal places in `n` as written, e.g. 2 for `0.25`, 0 for `5`. */
|
|
68
|
+
export function decimalPlaces(n) {
|
|
69
|
+
const [, fraction = ''] = String(n).split('.');
|
|
70
|
+
const exponent = /e-(\d+)$/.exec(String(n));
|
|
71
|
+
return exponent === null ? fraction.length : Number(exponent[1]) + fraction.length;
|
|
72
|
+
}
|
|
73
|
+
/** Round `n` to `places` decimal places without binary drift (`0.1 + 0.2` → `0.3`). */
|
|
74
|
+
export function roundTo(n, places) {
|
|
75
|
+
return Number(n.toFixed(Math.min(100, Math.max(0, places))));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The decimal places a committed value keeps: the more of the step's and the
|
|
79
|
+
* formatter's own (a percent shows two more places of the fraction than it
|
|
80
|
+
* displays), so a value is never rounded finer than the reader can see.
|
|
81
|
+
*/
|
|
82
|
+
export function valuePrecision(step, locales, options) {
|
|
83
|
+
const shown = formatter(locales, options).resolvedOptions().maximumFractionDigits ?? 0;
|
|
84
|
+
return Math.max(decimalPlaces(step), shown + (options?.style === 'percent' ? 2 : 0));
|
|
85
|
+
}
|
|
86
|
+
/** Clamp `n` into `[min, max]`; either bound may be absent. */
|
|
87
|
+
export function clamp(n, min, max) {
|
|
88
|
+
return Math.min(max ?? Number.POSITIVE_INFINITY, Math.max(min ?? Number.NEGATIVE_INFINITY, n));
|
|
89
|
+
}
|