@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,41 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
One collapsible node of a hierarchy: an always-visible summary row and a subtree that folds away under it.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
TreeList — one collapsible node of a hierarchy: a summary row that is always
|
|
6
|
+
visible, and a subtree that folds away under it.
|
|
7
|
+
|
|
8
|
+
Built on `<details>` / `<summary>` rather than a `{#if}` and a button, and
|
|
9
|
+
deliberately NOT on a bits-ui primitive: the element already gives the
|
|
10
|
+
disclosure semantics, the keyboard behaviour, and — on a modern browser —
|
|
11
|
+
find-in-page inside the collapsed content, which no JavaScript
|
|
12
|
+
implementation matches. A hand-rolled equivalent is three ARIA attributes
|
|
13
|
+
that have to stay in step with each other.
|
|
14
|
+
|
|
15
|
+
Open by default: a taxonomy the reader has to unfold node by node hides the
|
|
16
|
+
shape they came to see. Pass `open={false}` where the subtree is an aside.
|
|
17
|
+
|
|
18
|
+
ARIA contract: the platform's disclosure semantics, plus a `<ul>`/`<li>`
|
|
19
|
+
structure so the nesting is announced as nesting. No `aria-expanded` is
|
|
20
|
+
written by hand — the browser maps `open`, and a second copy can only ever
|
|
21
|
+
disagree with it. This is a disclosure tree, not an ARIA `tree` widget:
|
|
22
|
+
`role="tree"` would commit the caller to roving tabindex and typeahead over
|
|
23
|
+
arbitrary nested content, which is a much larger promise than folding a
|
|
24
|
+
taxonomy.
|
|
25
|
+
-->
|
|
26
|
+
<script lang="ts">let { open = $bindable(true), title, children, class: className, ...rest } = $props();
|
|
27
|
+
export {};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<ul {...rest} class={['ml-1 pl-0', className]}>
|
|
31
|
+
<li class="relative block pl-2">
|
|
32
|
+
<details bind:open>
|
|
33
|
+
<summary
|
|
34
|
+
class="focus-visible:outline-primary block cursor-pointer marker:hidden focus:outline-hidden focus-visible:outline-1 focus-visible:outline-dotted"
|
|
35
|
+
>
|
|
36
|
+
{#if typeof title === 'string'}{title}{:else}{@render title()}{/if}
|
|
37
|
+
</summary>
|
|
38
|
+
{@render children?.()}
|
|
39
|
+
</details>
|
|
40
|
+
</li>
|
|
41
|
+
</ul>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends Omit<HTMLAttributes<HTMLUListElement>, 'title' | 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the subtree starts unfolded. Bindable.
|
|
6
|
+
* @defaultValue `true`
|
|
7
|
+
*/
|
|
8
|
+
open?: boolean | undefined;
|
|
9
|
+
/** The always-visible summary row — its own text, or richer markup. */
|
|
10
|
+
title: string | Snippet<[]>;
|
|
11
|
+
/** The subtree — typically nested `TreeListItem`s. */
|
|
12
|
+
children?: Snippet<[]> | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** One collapsible node of a hierarchy: an always-visible summary row and a subtree that folds away under it. */
|
|
15
|
+
declare const TreeList: import("svelte").Component<Props, {}, "open">;
|
|
16
|
+
type TreeList = ReturnType<typeof TreeList>;
|
|
17
|
+
export default TreeList;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- @component
|
|
2
|
+
One leaf under a `TreeList`, drawn with the connector rule that makes the nesting readable.
|
|
3
|
+
-->
|
|
4
|
+
<!--
|
|
5
|
+
TreeListItem — one leaf under a `TreeList`, drawn with the connector rule
|
|
6
|
+
that makes the nesting readable.
|
|
7
|
+
|
|
8
|
+
The rule is a border on the item rather than a line drawn between items, so
|
|
9
|
+
a subtree that grows or folds redraws itself; `last:border-transparent`
|
|
10
|
+
stops it running past the final child, which is the detail that separates a
|
|
11
|
+
tree from a stack of indented rows.
|
|
12
|
+
|
|
13
|
+
ARIA contract: a plain `<li>`. It is a list item inside its parent's list,
|
|
14
|
+
and the nesting is the structure — nothing is added.
|
|
15
|
+
-->
|
|
16
|
+
<script lang="ts">let { children, class: className, ...rest } = $props();
|
|
17
|
+
export {};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<li
|
|
21
|
+
{...rest}
|
|
22
|
+
class={[
|
|
23
|
+
"border-base-300 border-l-2 before:absolute before:top-2 before:left-1 before:block before:content-['']",
|
|
24
|
+
'last:border-transparent',
|
|
25
|
+
className,
|
|
26
|
+
]}
|
|
27
|
+
>
|
|
28
|
+
{@render children?.()}
|
|
29
|
+
</li>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends Omit<HTMLAttributes<HTMLLIElement>, 'children'> {
|
|
4
|
+
/** The leaf's content, beside the connector rule. */
|
|
5
|
+
children?: Snippet<[]> | undefined;
|
|
6
|
+
}
|
|
7
|
+
/** One leaf under a `TreeList`, drawn with the connector rule that makes the nesting readable. */
|
|
8
|
+
declare const TreeListItem: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type TreeListItem = ReturnType<typeof TreeListItem>;
|
|
10
|
+
export default TreeListItem;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a {@link DescriptionRow} learns which {@link DescriptionList} it is
|
|
3
|
+
* inside.
|
|
4
|
+
*
|
|
5
|
+
* The list variants render their rows differently — a `grid` row is a
|
|
6
|
+
* wrapper holding a stacked `<dt>`/`<dd>` pair, while a `card` or `bare`
|
|
7
|
+
* row's `<dt>` and `<dd>` are direct children of the `<dl>`, because a
|
|
8
|
+
* wrapper would break the alignment of a two-column grid (the list's own for
|
|
9
|
+
* `card`, the consumer's for `bare`). A call site writes the same
|
|
10
|
+
* `<DescriptionRow>` either way.
|
|
11
|
+
*
|
|
12
|
+
* The variant travels down as context rather than as a prop so a caller
|
|
13
|
+
* cannot get a list and its rows out of step, and so the list stays the
|
|
14
|
+
* single place the choice is made. A row mounted with no list above it gets
|
|
15
|
+
* the defaults, which is what makes one usable inside an app's own `<dl>`.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
/** The presentation a `DescriptionList` asks its rows for. */
|
|
20
|
+
export interface DescriptionListStyle {
|
|
21
|
+
/**
|
|
22
|
+
* The layout. `bare` adds no layout classes to the list and renders each
|
|
23
|
+
* row's `<dt>`/`<dd>` as direct children of the `<dl>`, for a consumer that
|
|
24
|
+
* lays the list out itself.
|
|
25
|
+
*/
|
|
26
|
+
readonly variant: 'grid' | 'card' | 'divided' | 'inline' | 'bare';
|
|
27
|
+
/** Render values in a fixed-width face that breaks anywhere. */
|
|
28
|
+
readonly mono: boolean;
|
|
29
|
+
/** Render a row whose value is empty, using `emptyLabel`. */
|
|
30
|
+
readonly showEmpty: boolean;
|
|
31
|
+
/** What an empty value reads as when `showEmpty`. */
|
|
32
|
+
readonly emptyLabel: string;
|
|
33
|
+
}
|
|
34
|
+
/** The presentation a `DescriptionRow` uses outside any `DescriptionList`: the `grid` variant, proportional text, empty rows hidden. */
|
|
35
|
+
export declare const defaultDescriptionListStyle: DescriptionListStyle;
|
|
36
|
+
/** Declare the style every descendant `DescriptionRow` renders in. */
|
|
37
|
+
export declare function setDescriptionListStyle(style: () => DescriptionListStyle): void;
|
|
38
|
+
/** The enclosing list's style, or the defaults when there is no enclosing list. */
|
|
39
|
+
export declare function getDescriptionListStyle(): () => DescriptionListStyle;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a {@link DescriptionRow} learns which {@link DescriptionList} it is
|
|
3
|
+
* inside.
|
|
4
|
+
*
|
|
5
|
+
* The list variants render their rows differently — a `grid` row is a
|
|
6
|
+
* wrapper holding a stacked `<dt>`/`<dd>` pair, while a `card` or `bare`
|
|
7
|
+
* row's `<dt>` and `<dd>` are direct children of the `<dl>`, because a
|
|
8
|
+
* wrapper would break the alignment of a two-column grid (the list's own for
|
|
9
|
+
* `card`, the consumer's for `bare`). A call site writes the same
|
|
10
|
+
* `<DescriptionRow>` either way.
|
|
11
|
+
*
|
|
12
|
+
* The variant travels down as context rather than as a prop so a caller
|
|
13
|
+
* cannot get a list and its rows out of step, and so the list stays the
|
|
14
|
+
* single place the choice is made. A row mounted with no list above it gets
|
|
15
|
+
* the defaults, which is what makes one usable inside an app's own `<dl>`.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { getContext, setContext } from 'svelte';
|
|
20
|
+
/** The presentation a `DescriptionRow` uses outside any `DescriptionList`: the `grid` variant, proportional text, empty rows hidden. */
|
|
21
|
+
export const defaultDescriptionListStyle = {
|
|
22
|
+
variant: 'grid',
|
|
23
|
+
mono: false,
|
|
24
|
+
showEmpty: false,
|
|
25
|
+
emptyLabel: 'unrecorded',
|
|
26
|
+
};
|
|
27
|
+
const STYLE_KEY = Symbol('@thomasfosterau/components:description-list');
|
|
28
|
+
/** Declare the style every descendant `DescriptionRow` renders in. */
|
|
29
|
+
export function setDescriptionListStyle(style) {
|
|
30
|
+
setContext(STYLE_KEY, style);
|
|
31
|
+
}
|
|
32
|
+
/** The enclosing list's style, or the defaults when there is no enclosing list. */
|
|
33
|
+
export function getDescriptionListStyle() {
|
|
34
|
+
return (getContext(STYLE_KEY) ??
|
|
35
|
+
(() => defaultDescriptionListStyle));
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The segment shape `DiffText` renders.
|
|
3
|
+
*
|
|
4
|
+
* A `.ts` module rather than a `<script module>` block so the diff algorithm
|
|
5
|
+
* that produces these — which is the app's, not this package's — can import
|
|
6
|
+
* the type without reaching through a component.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/** One run of a word- or character-level diff. */
|
|
11
|
+
export interface DiffSegment {
|
|
12
|
+
readonly kind: 'equal' | 'insert' | 'delete';
|
|
13
|
+
readonly text: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The segment shape `DiffText` renders.
|
|
3
|
+
*
|
|
4
|
+
* A `.ts` module rather than a `<script module>` block so the diff algorithm
|
|
5
|
+
* that produces these — which is the app's, not this package's — can import
|
|
6
|
+
* the type without reaching through a component.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data — the tables, lists and pagers an index page and a detail page are
|
|
3
|
+
* built from.
|
|
4
|
+
*
|
|
5
|
+
* Two shapes of list run through this family, and the split is worth stating
|
|
6
|
+
* once. `Table` and `ItemList` present a window a caller already chose:
|
|
7
|
+
* they never decide which rows exist, so they serve a server-paged collection
|
|
8
|
+
* of 40,000 as happily as a list of four. `DataGrid` is the other shape —
|
|
9
|
+
* it sorts, filters and pages a bounded set the page already holds, entirely
|
|
10
|
+
* on the client — and it composes the first two rather than duplicating them.
|
|
11
|
+
*
|
|
12
|
+
* Every optional prop in this family is declared `T | undefined`, not bare
|
|
13
|
+
* `T`: the workspace compiles with `exactOptionalPropertyTypes`, under which
|
|
14
|
+
* `prop?: T` rejects an explicitly passed `undefined`, and a caller
|
|
15
|
+
* forwarding its own optional prop straight through would not compile.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export { default as ChatBubble } from './ChatBubble.svelte';
|
|
20
|
+
export { default as DataGrid } from './DataGrid.svelte';
|
|
21
|
+
export { default as DescriptionList } from './DescriptionList.svelte';
|
|
22
|
+
export { default as DescriptionRow } from './DescriptionRow.svelte';
|
|
23
|
+
export { default as DiffText } from './DiffText.svelte';
|
|
24
|
+
export { default as ItemList } from './ItemList.svelte';
|
|
25
|
+
export { default as LinkListItem } from './LinkListItem.svelte';
|
|
26
|
+
export { default as MessageThread } from './MessageThread.svelte';
|
|
27
|
+
export { default as Pagination } from './Pagination.svelte';
|
|
28
|
+
export { default as PaginationFooter } from './PaginationFooter.svelte';
|
|
29
|
+
export { default as ResultCount } from './ResultCount.svelte';
|
|
30
|
+
export { default as Table } from './Table.svelte';
|
|
31
|
+
export { default as TreeList } from './TreeList.svelte';
|
|
32
|
+
export { default as TreeListItem } from './TreeListItem.svelte';
|
|
33
|
+
export * from './description-context.ts';
|
|
34
|
+
export * from './diff.ts';
|
|
35
|
+
export * from './list-item.ts';
|
|
36
|
+
export * from './pagination.ts';
|
|
37
|
+
export * from './table-types.ts';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data — the tables, lists and pagers an index page and a detail page are
|
|
3
|
+
* built from.
|
|
4
|
+
*
|
|
5
|
+
* Two shapes of list run through this family, and the split is worth stating
|
|
6
|
+
* once. `Table` and `ItemList` present a window a caller already chose:
|
|
7
|
+
* they never decide which rows exist, so they serve a server-paged collection
|
|
8
|
+
* of 40,000 as happily as a list of four. `DataGrid` is the other shape —
|
|
9
|
+
* it sorts, filters and pages a bounded set the page already holds, entirely
|
|
10
|
+
* on the client — and it composes the first two rather than duplicating them.
|
|
11
|
+
*
|
|
12
|
+
* Every optional prop in this family is declared `T | undefined`, not bare
|
|
13
|
+
* `T`: the workspace compiles with `exactOptionalPropertyTypes`, under which
|
|
14
|
+
* `prop?: T` rejects an explicitly passed `undefined`, and a caller
|
|
15
|
+
* forwarding its own optional prop straight through would not compile.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export { default as ChatBubble } from './ChatBubble.svelte';
|
|
20
|
+
export { default as DataGrid } from './DataGrid.svelte';
|
|
21
|
+
export { default as DescriptionList } from './DescriptionList.svelte';
|
|
22
|
+
export { default as DescriptionRow } from './DescriptionRow.svelte';
|
|
23
|
+
export { default as DiffText } from './DiffText.svelte';
|
|
24
|
+
export { default as ItemList } from './ItemList.svelte';
|
|
25
|
+
export { default as LinkListItem } from './LinkListItem.svelte';
|
|
26
|
+
export { default as MessageThread } from './MessageThread.svelte';
|
|
27
|
+
export { default as Pagination } from './Pagination.svelte';
|
|
28
|
+
export { default as PaginationFooter } from './PaginationFooter.svelte';
|
|
29
|
+
export { default as ResultCount } from './ResultCount.svelte';
|
|
30
|
+
export { default as Table } from './Table.svelte';
|
|
31
|
+
export { default as TreeList } from './TreeList.svelte';
|
|
32
|
+
export { default as TreeListItem } from './TreeListItem.svelte';
|
|
33
|
+
export * from "./description-context.js";
|
|
34
|
+
export * from "./diff.js";
|
|
35
|
+
export * from "./list-item.js";
|
|
36
|
+
export * from "./pagination.js";
|
|
37
|
+
export * from "./table-types.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The row shape an index page maps its data into before handing it to
|
|
3
|
+
* `ItemList`.
|
|
4
|
+
*
|
|
5
|
+
* A type, not a resource: the caller's own mappers turn a wire document into
|
|
6
|
+
* it, which is what keeps every API's shape out of this package. It lives in
|
|
7
|
+
* a `.ts` module rather than a `<script module>` block so a mapper — and the
|
|
8
|
+
* mapper's unit test — can import it without reaching through a component.
|
|
9
|
+
*
|
|
10
|
+
* Both optional members are declared `?: T | undefined` rather than bare
|
|
11
|
+
* `?: T`. The workspace compiles under `exactOptionalPropertyTypes`, where
|
|
12
|
+
* `{ subtitle: undefined }` is not the same thing as an absent key: with the
|
|
13
|
+
* narrow declaration every mapper reading a possibly-absent attribute has to
|
|
14
|
+
* spread the member conditionally, which is three lines and a comment at
|
|
15
|
+
* every call site. Widening it here is what removes them.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
/** One row of a `LinkListItem`-shaped list. */
|
|
20
|
+
export interface LinkListItemData {
|
|
21
|
+
/** Stable identity — the list's `{#each}` key. */
|
|
22
|
+
readonly id: string;
|
|
23
|
+
/** Where the row's title links to; resolved through the components context. */
|
|
24
|
+
readonly href: string;
|
|
25
|
+
readonly title: string;
|
|
26
|
+
/** A line of context under the title — an owner, a parent, a date. */
|
|
27
|
+
readonly subtitle?: string | undefined;
|
|
28
|
+
/** Short markers rendered as badges (a visibility state, a kind). */
|
|
29
|
+
readonly badges?: readonly string[] | undefined;
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The row shape an index page maps its data into before handing it to
|
|
3
|
+
* `ItemList`.
|
|
4
|
+
*
|
|
5
|
+
* A type, not a resource: the caller's own mappers turn a wire document into
|
|
6
|
+
* it, which is what keeps every API's shape out of this package. It lives in
|
|
7
|
+
* a `.ts` module rather than a `<script module>` block so a mapper — and the
|
|
8
|
+
* mapper's unit test — can import it without reaching through a component.
|
|
9
|
+
*
|
|
10
|
+
* Both optional members are declared `?: T | undefined` rather than bare
|
|
11
|
+
* `?: T`. The workspace compiles under `exactOptionalPropertyTypes`, where
|
|
12
|
+
* `{ subtitle: undefined }` is not the same thing as an absent key: with the
|
|
13
|
+
* narrow declaration every mapper reading a possibly-absent attribute has to
|
|
14
|
+
* spread the member conditionally, which is three lines and a comment at
|
|
15
|
+
* every call site. Widening it here is what removes them.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offset / limit pagination arithmetic, and the href that carries it.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions, deliberately: the window a pager renders (first page, last
|
|
5
|
+
* page, the current page's neighbours, the gaps between them) is arithmetic
|
|
6
|
+
* with a dozen edge cases — an offset past the end, a zero limit, a total of
|
|
7
|
+
* zero — and arithmetic is far cheaper to pin in a unit test than in a
|
|
8
|
+
* rendered component. `Pagination` is then markup over {@link pageWindow}.
|
|
9
|
+
*
|
|
10
|
+
* Ported from an Effect implementation with `Option` replaced by
|
|
11
|
+
* `undefined` and the query Schema left behind in the app that needs it:
|
|
12
|
+
* decoding an app's own URL is the app's job, and a component library that
|
|
13
|
+
* owned it would drag a validation library onto every consumer's page.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
/** The JSON:API offset query parameter — the default {@link pageHref} writes. */
|
|
18
|
+
export declare const PAGE_OFFSET_PARAM = "page[offset]";
|
|
19
|
+
/** The JSON:API limit query parameter — the default {@link pageHref} writes. */
|
|
20
|
+
export declare const PAGE_LIMIT_PARAM = "page[limit]";
|
|
21
|
+
/** A resolved page position. */
|
|
22
|
+
export interface Page {
|
|
23
|
+
readonly offset: number;
|
|
24
|
+
readonly limit: number;
|
|
25
|
+
}
|
|
26
|
+
/** The query-parameter names {@link pageHref} writes the position into. */
|
|
27
|
+
export interface PageParamNames {
|
|
28
|
+
readonly offset?: string | undefined;
|
|
29
|
+
readonly limit?: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build the href for `page` from `base` (a path, optionally with a query
|
|
33
|
+
* string and a fragment).
|
|
34
|
+
*
|
|
35
|
+
* Every other query parameter is preserved and the page parameters are
|
|
36
|
+
* replaced — paging through a filtered list that silently dropped the filter
|
|
37
|
+
* is the bug this shape exists to prevent. A relative `base` yields a
|
|
38
|
+
* relative href: the absolute origin below is a parsing scaffold, never part
|
|
39
|
+
* of the result.
|
|
40
|
+
*/
|
|
41
|
+
export declare function pageHref(base: string, page: Page, names?: PageParamNames): string;
|
|
42
|
+
/** One entry in a rendered page window: a page link, or the gap before one. */
|
|
43
|
+
export type PageWindowItem = {
|
|
44
|
+
readonly kind: 'page';
|
|
45
|
+
/** 1-based page number, as rendered. */
|
|
46
|
+
readonly page: number;
|
|
47
|
+
/** The offset that page starts at. */
|
|
48
|
+
readonly offset: number;
|
|
49
|
+
readonly current: boolean;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: 'gap'; /** The page number the gap follows. */
|
|
52
|
+
readonly after: number;
|
|
53
|
+
};
|
|
54
|
+
/** Everything a pager needs to draw itself, from one position and a total. */
|
|
55
|
+
export interface PageWindow {
|
|
56
|
+
/** 1-based current page. */
|
|
57
|
+
readonly page: number;
|
|
58
|
+
/** Total pages; at least 1, even with no rows. */
|
|
59
|
+
readonly pageCount: number;
|
|
60
|
+
/** 1-based index of the first row shown, or 0 when there are no rows. */
|
|
61
|
+
readonly from: number;
|
|
62
|
+
/** 1-based index of the last row shown, or 0 when there are no rows. */
|
|
63
|
+
readonly to: number;
|
|
64
|
+
/** Offset of the previous page, or `undefined` on the first. */
|
|
65
|
+
readonly previous: number | undefined;
|
|
66
|
+
/** Offset of the next page, or `undefined` on the last. */
|
|
67
|
+
readonly next: number | undefined;
|
|
68
|
+
/** First page, last page, and `siblings` pages either side of the current. */
|
|
69
|
+
readonly items: readonly PageWindowItem[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Compute the window of page links to render around `page`: the first and
|
|
73
|
+
* last pages always, plus `siblings` pages either side of the current one,
|
|
74
|
+
* with a gap marker wherever the sequence skips.
|
|
75
|
+
*
|
|
76
|
+
* Tolerant by construction — a zero or negative limit, a negative offset and
|
|
77
|
+
* an offset past the end all resolve to a real page rather than throwing,
|
|
78
|
+
* because every one of them arrives from a hand-edited URL sooner or later
|
|
79
|
+
* and a 500 is a worse answer than the first page.
|
|
80
|
+
*/
|
|
81
|
+
export declare function pageWindow(page: Page, total: number, siblings?: number): PageWindow;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offset / limit pagination arithmetic, and the href that carries it.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions, deliberately: the window a pager renders (first page, last
|
|
5
|
+
* page, the current page's neighbours, the gaps between them) is arithmetic
|
|
6
|
+
* with a dozen edge cases — an offset past the end, a zero limit, a total of
|
|
7
|
+
* zero — and arithmetic is far cheaper to pin in a unit test than in a
|
|
8
|
+
* rendered component. `Pagination` is then markup over {@link pageWindow}.
|
|
9
|
+
*
|
|
10
|
+
* Ported from an Effect implementation with `Option` replaced by
|
|
11
|
+
* `undefined` and the query Schema left behind in the app that needs it:
|
|
12
|
+
* decoding an app's own URL is the app's job, and a component library that
|
|
13
|
+
* owned it would drag a validation library onto every consumer's page.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
/** The JSON:API offset query parameter — the default {@link pageHref} writes. */
|
|
18
|
+
export const PAGE_OFFSET_PARAM = 'page[offset]';
|
|
19
|
+
/** The JSON:API limit query parameter — the default {@link pageHref} writes. */
|
|
20
|
+
export const PAGE_LIMIT_PARAM = 'page[limit]';
|
|
21
|
+
/**
|
|
22
|
+
* Build the href for `page` from `base` (a path, optionally with a query
|
|
23
|
+
* string and a fragment).
|
|
24
|
+
*
|
|
25
|
+
* Every other query parameter is preserved and the page parameters are
|
|
26
|
+
* replaced — paging through a filtered list that silently dropped the filter
|
|
27
|
+
* is the bug this shape exists to prevent. A relative `base` yields a
|
|
28
|
+
* relative href: the absolute origin below is a parsing scaffold, never part
|
|
29
|
+
* of the result.
|
|
30
|
+
*/
|
|
31
|
+
export function pageHref(base, page, names = {}) {
|
|
32
|
+
const url = new URL(base, 'http://pagination.invalid');
|
|
33
|
+
url.searchParams.set(names.offset ?? PAGE_OFFSET_PARAM, String(page.offset));
|
|
34
|
+
url.searchParams.set(names.limit ?? PAGE_LIMIT_PARAM, String(page.limit));
|
|
35
|
+
return `${url.pathname}${url.search}${url.hash}`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Compute the window of page links to render around `page`: the first and
|
|
39
|
+
* last pages always, plus `siblings` pages either side of the current one,
|
|
40
|
+
* with a gap marker wherever the sequence skips.
|
|
41
|
+
*
|
|
42
|
+
* Tolerant by construction — a zero or negative limit, a negative offset and
|
|
43
|
+
* an offset past the end all resolve to a real page rather than throwing,
|
|
44
|
+
* because every one of them arrives from a hand-edited URL sooner or later
|
|
45
|
+
* and a 500 is a worse answer than the first page.
|
|
46
|
+
*/
|
|
47
|
+
export function pageWindow(page, total, siblings = 1) {
|
|
48
|
+
const limit = Math.max(1, Math.floor(page.limit));
|
|
49
|
+
const offset = Math.max(0, Math.floor(page.offset));
|
|
50
|
+
const rows = Math.max(0, total);
|
|
51
|
+
const pageCount = Math.max(1, Math.ceil(rows / limit));
|
|
52
|
+
const current = Math.min(pageCount, Math.floor(offset / limit) + 1);
|
|
53
|
+
const wanted = [];
|
|
54
|
+
const want = (n) => {
|
|
55
|
+
if (n >= 1 && n <= pageCount && !wanted.includes(n))
|
|
56
|
+
wanted.push(n);
|
|
57
|
+
};
|
|
58
|
+
want(1);
|
|
59
|
+
for (let n = current - siblings; n <= current + siblings; n += 1)
|
|
60
|
+
want(n);
|
|
61
|
+
want(pageCount);
|
|
62
|
+
wanted.sort((left, right) => left - right);
|
|
63
|
+
const items = [];
|
|
64
|
+
for (const [index, n] of wanted.entries()) {
|
|
65
|
+
const previous = index > 0 ? wanted[index - 1] : undefined;
|
|
66
|
+
if (previous !== undefined && n - previous > 1)
|
|
67
|
+
items.push({ kind: 'gap', after: previous });
|
|
68
|
+
items.push({ kind: 'page', page: n, offset: (n - 1) * limit, current: n === current });
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
page: current,
|
|
72
|
+
pageCount,
|
|
73
|
+
from: rows > 0 ? (current - 1) * limit + 1 : 0,
|
|
74
|
+
to: rows > 0 ? Math.min(rows, current * limit) : 0,
|
|
75
|
+
previous: current > 1 ? (current - 2) * limit : undefined,
|
|
76
|
+
next: current < pageCount ? current * limit : undefined,
|
|
77
|
+
items,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The column spec `Table` and `DataGrid` share.
|
|
3
|
+
*
|
|
4
|
+
* Declarative data rather than a table engine. The apps this is consolidated
|
|
5
|
+
* from were built on `@tanstack/svelte-table` — a column helper, a
|
|
6
|
+
* `createTable` instance, four row-model factories and a `FlexRender`
|
|
7
|
+
* indirection — which is ~40 kB of client JavaScript for tables whose whole
|
|
8
|
+
* job is to show rows, sort one column and page. The spec below is data, and
|
|
9
|
+
* the sorting / filtering / paging live in `DataGrid`'s own derivations.
|
|
10
|
+
* Reach for an engine again when something needs column resizing, grouping
|
|
11
|
+
* or virtualisation; none of those are on the map.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { Snippet } from 'svelte';
|
|
16
|
+
/**
|
|
17
|
+
* One column of a table.
|
|
18
|
+
*
|
|
19
|
+
* `value` is required and does triple duty: it is the cell's text, the key
|
|
20
|
+
* the column sorts on, and the corpus `DataGrid`'s filter searches. One
|
|
21
|
+
* accessor for all three is what stops a grid that sorts a column by one
|
|
22
|
+
* thing and shows another — the failure mode of a spec where they are
|
|
23
|
+
* separate. `cell` layers richer markup (a link, a badge, a formatted date)
|
|
24
|
+
* over that same value.
|
|
25
|
+
*/
|
|
26
|
+
export interface TableColumn<T> {
|
|
27
|
+
/** Stable id — the `{#each}` key and the sort state's handle. */
|
|
28
|
+
readonly key: string;
|
|
29
|
+
/** The `<th>` text, already in the caller's language. */
|
|
30
|
+
readonly header: string;
|
|
31
|
+
/** The cell's text, its sort key, and what a filter matches against. */
|
|
32
|
+
readonly value: (row: T) => string | number;
|
|
33
|
+
/** Richer cell markup; `value`'s result is rendered when omitted. */
|
|
34
|
+
readonly cell?: Snippet<[T]> | undefined;
|
|
35
|
+
/** Whether the header offers a sort control on this column. */
|
|
36
|
+
readonly sortable?: boolean | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Render this column's body cells as `<th scope="row">` — the row's header,
|
|
39
|
+
* so a screen reader moving down another column announces it with each cell
|
|
40
|
+
* ("Jane Smith, 48,000"). Give it to the column that names the row, usually
|
|
41
|
+
* one per table.
|
|
42
|
+
*/
|
|
43
|
+
readonly rowHeader?: boolean | undefined;
|
|
44
|
+
/** Right-align numeric columns. */
|
|
45
|
+
readonly align?: 'start' | 'end' | undefined;
|
|
46
|
+
/** Extra classes on this column's header and body cells. */
|
|
47
|
+
readonly class?: string | undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Which column a table is sorted by, and which way.
|
|
51
|
+
*
|
|
52
|
+
* Unsorted is `undefined`, not a `SortState` with an empty key: "no column"
|
|
53
|
+
* is the absence of a sort, and modelling it as a sentinel key means every
|
|
54
|
+
* reader of the state has to know the sentinel.
|
|
55
|
+
*/
|
|
56
|
+
export interface SortState {
|
|
57
|
+
/** The `key` of the sorted {@link TableColumn}. */
|
|
58
|
+
readonly key: string;
|
|
59
|
+
readonly direction: 'asc' | 'desc';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The next state in the three-step cycle a sortable header runs:
|
|
63
|
+
* unsorted → ascending → descending → unsorted.
|
|
64
|
+
*
|
|
65
|
+
* A pure function rather than a method on the component so `DataGrid` and a
|
|
66
|
+
* server-sorted caller cycle identically, and so the cycle is unit-testable
|
|
67
|
+
* without a DOM.
|
|
68
|
+
*/
|
|
69
|
+
export declare function nextSortState(current: SortState | undefined, key: string): SortState | undefined;
|
|
70
|
+
/** What a column's `<th>` announces in `aria-sort`. */
|
|
71
|
+
export declare function columnAriaSort(sort: SortState | undefined, key: string): 'ascending' | 'descending' | 'none';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The column spec `Table` and `DataGrid` share.
|
|
3
|
+
*
|
|
4
|
+
* Declarative data rather than a table engine. The apps this is consolidated
|
|
5
|
+
* from were built on `@tanstack/svelte-table` — a column helper, a
|
|
6
|
+
* `createTable` instance, four row-model factories and a `FlexRender`
|
|
7
|
+
* indirection — which is ~40 kB of client JavaScript for tables whose whole
|
|
8
|
+
* job is to show rows, sort one column and page. The spec below is data, and
|
|
9
|
+
* the sorting / filtering / paging live in `DataGrid`'s own derivations.
|
|
10
|
+
* Reach for an engine again when something needs column resizing, grouping
|
|
11
|
+
* or virtualisation; none of those are on the map.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The next state in the three-step cycle a sortable header runs:
|
|
17
|
+
* unsorted → ascending → descending → unsorted.
|
|
18
|
+
*
|
|
19
|
+
* A pure function rather than a method on the component so `DataGrid` and a
|
|
20
|
+
* server-sorted caller cycle identically, and so the cycle is unit-testable
|
|
21
|
+
* without a DOM.
|
|
22
|
+
*/
|
|
23
|
+
export function nextSortState(current, key) {
|
|
24
|
+
if (current === undefined || current.key !== key)
|
|
25
|
+
return { key, direction: 'asc' };
|
|
26
|
+
if (current.direction === 'asc')
|
|
27
|
+
return { key, direction: 'desc' };
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
/** What a column's `<th>` announces in `aria-sort`. */
|
|
31
|
+
export function columnAriaSort(sort, key) {
|
|
32
|
+
if (sort === undefined || sort.key !== key)
|
|
33
|
+
return 'none';
|
|
34
|
+
return sort.direction === 'asc' ? 'ascending' : 'descending';
|
|
35
|
+
}
|