svelora 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +145 -0
- package/dist/Accordion/Accordion.svelte +207 -0
- package/dist/Accordion/Accordion.svelte.d.ts +6 -0
- package/dist/Accordion/accordion.types.d.ts +225 -0
- package/dist/Accordion/accordion.types.js +1 -0
- package/dist/Accordion/accordion.variants.d.ts +88 -0
- package/dist/Accordion/accordion.variants.js +28 -0
- package/dist/Accordion/index.d.ts +2 -0
- package/dist/Accordion/index.js +1 -0
- package/dist/Alert/Alert.svelte +131 -0
- package/dist/Alert/Alert.svelte.d.ts +5 -0
- package/dist/Alert/alert.types.d.ts +103 -0
- package/dist/Alert/alert.types.js +1 -0
- package/dist/Alert/alert.variants.d.ts +213 -0
- package/dist/Alert/alert.variants.js +293 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/index.js +1 -0
- package/dist/Avatar/Avatar.svelte +114 -0
- package/dist/Avatar/Avatar.svelte.d.ts +6 -0
- package/dist/Avatar/avatar.types.d.ts +73 -0
- package/dist/Avatar/avatar.types.js +1 -0
- package/dist/Avatar/avatar.variants.d.ts +316 -0
- package/dist/Avatar/avatar.variants.js +39 -0
- package/dist/Avatar/index.d.ts +2 -0
- package/dist/Avatar/index.js +1 -0
- package/dist/AvatarGroup/AvatarGroup.svelte +71 -0
- package/dist/AvatarGroup/AvatarGroup.svelte.d.ts +5 -0
- package/dist/AvatarGroup/avatar-group.types.d.ts +49 -0
- package/dist/AvatarGroup/avatar-group.types.js +1 -0
- package/dist/AvatarGroup/avatar-group.variants.d.ts +258 -0
- package/dist/AvatarGroup/avatar-group.variants.js +35 -0
- package/dist/AvatarGroup/index.d.ts +2 -0
- package/dist/AvatarGroup/index.js +1 -0
- package/dist/Badge/Badge.svelte +79 -0
- package/dist/Badge/Badge.svelte.d.ts +5 -0
- package/dist/Badge/badge.types.d.ts +83 -0
- package/dist/Badge/badge.types.js +1 -0
- package/dist/Badge/badge.variants.d.ts +303 -0
- package/dist/Badge/badge.variants.js +259 -0
- package/dist/Badge/index.d.ts +2 -0
- package/dist/Badge/index.js +1 -0
- package/dist/Banner/Banner.svelte +130 -0
- package/dist/Banner/Banner.svelte.d.ts +5 -0
- package/dist/Banner/banner.types.d.ts +148 -0
- package/dist/Banner/banner.types.js +1 -0
- package/dist/Banner/banner.variants.d.ts +293 -0
- package/dist/Banner/banner.variants.js +86 -0
- package/dist/Banner/index.d.ts +2 -0
- package/dist/Banner/index.js +1 -0
- package/dist/Breadcrumb/Breadcrumb.svelte +79 -0
- package/dist/Breadcrumb/Breadcrumb.svelte.d.ts +5 -0
- package/dist/Breadcrumb/breadcrumb.types.d.ts +66 -0
- package/dist/Breadcrumb/breadcrumb.types.js +1 -0
- package/dist/Breadcrumb/breadcrumb.variants.d.ts +138 -0
- package/dist/Breadcrumb/breadcrumb.variants.js +53 -0
- package/dist/Breadcrumb/index.d.ts +2 -0
- package/dist/Breadcrumb/index.js +1 -0
- package/dist/Button/Button.svelte +177 -0
- package/dist/Button/Button.svelte.d.ts +5 -0
- package/dist/Button/button.types.d.ts +151 -0
- package/dist/Button/button.types.js +1 -0
- package/dist/Button/button.variants.d.ts +388 -0
- package/dist/Button/button.variants.js +461 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/index.js +1 -0
- package/dist/Calendar/Calendar.svelte +344 -0
- package/dist/Calendar/Calendar.svelte.d.ts +6 -0
- package/dist/Calendar/calendar.types.d.ts +122 -0
- package/dist/Calendar/calendar.types.js +1 -0
- package/dist/Calendar/calendar.variants.d.ts +553 -0
- package/dist/Calendar/calendar.variants.js +368 -0
- package/dist/Calendar/index.d.ts +2 -0
- package/dist/Calendar/index.js +1 -0
- package/dist/Card/Card.svelte +54 -0
- package/dist/Card/Card.svelte.d.ts +5 -0
- package/dist/Card/card.types.d.ts +36 -0
- package/dist/Card/card.types.js +1 -0
- package/dist/Card/card.variants.d.ts +108 -0
- package/dist/Card/card.variants.js +32 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/index.js +1 -0
- package/dist/Carousel/Carousel.svelte +277 -0
- package/dist/Carousel/Carousel.svelte.d.ts +26 -0
- package/dist/Carousel/carousel.types.d.ts +251 -0
- package/dist/Carousel/carousel.types.js +1 -0
- package/dist/Carousel/carousel.variants.d.ts +408 -0
- package/dist/Carousel/carousel.variants.js +88 -0
- package/dist/Carousel/index.d.ts +2 -0
- package/dist/Carousel/index.js +1 -0
- package/dist/Checkbox/Checkbox.svelte +161 -0
- package/dist/Checkbox/Checkbox.svelte.d.ts +6 -0
- package/dist/Checkbox/checkbox.types.d.ts +101 -0
- package/dist/Checkbox/checkbox.types.js +1 -0
- package/dist/Checkbox/checkbox.variants.d.ts +448 -0
- package/dist/Checkbox/checkbox.variants.js +209 -0
- package/dist/Checkbox/index.d.ts +2 -0
- package/dist/Checkbox/index.js +1 -0
- package/dist/CheckboxGroup/CheckboxGroup.svelte +219 -0
- package/dist/CheckboxGroup/CheckboxGroup.svelte.d.ts +5 -0
- package/dist/CheckboxGroup/checkbox-group.types.d.ts +130 -0
- package/dist/CheckboxGroup/checkbox-group.types.js +1 -0
- package/dist/CheckboxGroup/checkbox-group.variants.d.ts +553 -0
- package/dist/CheckboxGroup/checkbox-group.variants.js +231 -0
- package/dist/CheckboxGroup/index.d.ts +2 -0
- package/dist/CheckboxGroup/index.js +1 -0
- package/dist/Chip/Chip.svelte +51 -0
- package/dist/Chip/Chip.svelte.d.ts +5 -0
- package/dist/Chip/chip.types.d.ts +66 -0
- package/dist/Chip/chip.types.js +1 -0
- package/dist/Chip/chip.variants.d.ts +418 -0
- package/dist/Chip/chip.variants.js +74 -0
- package/dist/Chip/index.d.ts +2 -0
- package/dist/Chip/index.js +1 -0
- package/dist/Collapsible/Collapsible.svelte +69 -0
- package/dist/Collapsible/Collapsible.svelte.d.ts +6 -0
- package/dist/Collapsible/CollapsibleTestWrapper.svelte +17 -0
- package/dist/Collapsible/CollapsibleTestWrapper.svelte.d.ts +4 -0
- package/dist/Collapsible/collapsible.types.d.ts +77 -0
- package/dist/Collapsible/collapsible.types.js +1 -0
- package/dist/Collapsible/collapsible.variants.d.ts +53 -0
- package/dist/Collapsible/collapsible.variants.js +21 -0
- package/dist/Collapsible/index.d.ts +2 -0
- package/dist/Collapsible/index.js +1 -0
- package/dist/Command/Command.svelte +183 -0
- package/dist/Command/Command.svelte.d.ts +6 -0
- package/dist/Command/CommandTestWrapper.svelte +13 -0
- package/dist/Command/CommandTestWrapper.svelte.d.ts +4 -0
- package/dist/Command/command.types.d.ts +100 -0
- package/dist/Command/command.types.js +1 -0
- package/dist/Command/command.variants.d.ts +226 -0
- package/dist/Command/command.variants.js +86 -0
- package/dist/Command/index.d.ts +2 -0
- package/dist/Command/index.js +1 -0
- package/dist/Container/Container.svelte +21 -0
- package/dist/Container/Container.svelte.d.ts +5 -0
- package/dist/Container/container.types.d.ts +19 -0
- package/dist/Container/container.types.js +1 -0
- package/dist/Container/container.variants.d.ts +29 -0
- package/dist/Container/container.variants.js +9 -0
- package/dist/Container/index.d.ts +2 -0
- package/dist/Container/index.js +1 -0
- package/dist/ContextMenu/ContextMenu.svelte +344 -0
- package/dist/ContextMenu/ContextMenu.svelte.d.ts +6 -0
- package/dist/ContextMenu/context-menu.types.d.ts +265 -0
- package/dist/ContextMenu/context-menu.types.js +1 -0
- package/dist/ContextMenu/context-menu.variants.d.ts +307 -0
- package/dist/ContextMenu/context-menu.variants.js +144 -0
- package/dist/ContextMenu/index.d.ts +2 -0
- package/dist/ContextMenu/index.js +1 -0
- package/dist/Drawer/Drawer.svelte +207 -0
- package/dist/Drawer/Drawer.svelte.d.ts +6 -0
- package/dist/Drawer/DrawerTriggerTestWrapper.svelte +10 -0
- package/dist/Drawer/DrawerTriggerTestWrapper.svelte.d.ts +18 -0
- package/dist/Drawer/drawer.types.d.ts +116 -0
- package/dist/Drawer/drawer.types.js +1 -0
- package/dist/Drawer/drawer.variants.d.ts +193 -0
- package/dist/Drawer/drawer.variants.js +139 -0
- package/dist/Drawer/index.d.ts +2 -0
- package/dist/Drawer/index.js +1 -0
- package/dist/DropdownMenu/DropdownMenu.svelte +363 -0
- package/dist/DropdownMenu/DropdownMenu.svelte.d.ts +6 -0
- package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte +12 -0
- package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte.d.ts +7 -0
- package/dist/DropdownMenu/dropdown-menu.types.d.ts +279 -0
- package/dist/DropdownMenu/dropdown-menu.types.js +1 -0
- package/dist/DropdownMenu/dropdown-menu.variants.d.ts +312 -0
- package/dist/DropdownMenu/dropdown-menu.variants.js +149 -0
- package/dist/DropdownMenu/index.d.ts +2 -0
- package/dist/DropdownMenu/index.js +1 -0
- package/dist/Editor/Editor.svelte +756 -0
- package/dist/Editor/Editor.svelte.d.ts +6 -0
- package/dist/Editor/EditorUrlPrompt.svelte +94 -0
- package/dist/Editor/EditorUrlPrompt.svelte.d.ts +15 -0
- package/dist/Editor/SlashPopup.svelte +74 -0
- package/dist/Editor/SlashPopup.svelte.d.ts +11 -0
- package/dist/Editor/editor.extensions.d.ts +23 -0
- package/dist/Editor/editor.extensions.js +132 -0
- package/dist/Editor/editor.schemas.d.ts +5 -0
- package/dist/Editor/editor.schemas.js +27 -0
- package/dist/Editor/editor.slash.svelte.d.ts +25 -0
- package/dist/Editor/editor.slash.svelte.js +299 -0
- package/dist/Editor/editor.suggestion.d.ts +7 -0
- package/dist/Editor/editor.suggestion.js +165 -0
- package/dist/Editor/editor.toolbar.d.ts +11 -0
- package/dist/Editor/editor.toolbar.js +204 -0
- package/dist/Editor/editor.types.d.ts +367 -0
- package/dist/Editor/editor.types.js +1 -0
- package/dist/Editor/editor.variants.d.ts +303 -0
- package/dist/Editor/editor.variants.js +135 -0
- package/dist/Editor/index.d.ts +55 -0
- package/dist/Editor/index.js +54 -0
- package/dist/Empty/Empty.svelte +118 -0
- package/dist/Empty/Empty.svelte.d.ts +5 -0
- package/dist/Empty/empty.types.d.ts +91 -0
- package/dist/Empty/empty.types.js +1 -0
- package/dist/Empty/empty.variants.d.ts +308 -0
- package/dist/Empty/empty.variants.js +73 -0
- package/dist/Empty/index.d.ts +2 -0
- package/dist/Empty/index.js +1 -0
- package/dist/FieldGroup/FieldGroup.svelte +53 -0
- package/dist/FieldGroup/FieldGroup.svelte.d.ts +5 -0
- package/dist/FieldGroup/field-group.types.d.ts +37 -0
- package/dist/FieldGroup/field-group.types.js +1 -0
- package/dist/FieldGroup/field-group.variants.d.ts +116 -0
- package/dist/FieldGroup/field-group.variants.js +49 -0
- package/dist/FieldGroup/index.d.ts +2 -0
- package/dist/FieldGroup/index.js +1 -0
- package/dist/FileUpload/FileUpload.svelte +639 -0
- package/dist/FileUpload/FileUpload.svelte.d.ts +8 -0
- package/dist/FileUpload/file-upload.types.d.ts +203 -0
- package/dist/FileUpload/file-upload.types.js +1 -0
- package/dist/FileUpload/file-upload.variants.d.ts +397 -0
- package/dist/FileUpload/file-upload.variants.js +224 -0
- package/dist/FileUpload/index.d.ts +2 -0
- package/dist/FileUpload/index.js +1 -0
- package/dist/Form/Form.svelte +197 -0
- package/dist/Form/Form.svelte.d.ts +26 -0
- package/dist/Form/form.context.svelte.d.ts +64 -0
- package/dist/Form/form.context.svelte.js +478 -0
- package/dist/Form/form.types.d.ts +164 -0
- package/dist/Form/form.types.js +12 -0
- package/dist/Form/form.variants.d.ts +39 -0
- package/dist/Form/form.variants.js +17 -0
- package/dist/Form/index.d.ts +4 -0
- package/dist/Form/index.js +6 -0
- package/dist/Form/validate-schema.d.ts +13 -0
- package/dist/Form/validate-schema.js +113 -0
- package/dist/FormField/FormField.svelte +186 -0
- package/dist/FormField/FormField.svelte.d.ts +5 -0
- package/dist/FormField/form-field.types.d.ts +109 -0
- package/dist/FormField/form-field.types.js +1 -0
- package/dist/FormField/form-field.variants.d.ts +313 -0
- package/dist/FormField/form-field.variants.js +74 -0
- package/dist/FormField/index.d.ts +2 -0
- package/dist/FormField/index.js +1 -0
- package/dist/Icon/Icon.svelte +46 -0
- package/dist/Icon/Icon.svelte.d.ts +6 -0
- package/dist/Icon/icon.types.d.ts +49 -0
- package/dist/Icon/icon.types.js +1 -0
- package/dist/Icon/index.d.ts +2 -0
- package/dist/Icon/index.js +1 -0
- package/dist/Input/Input.svelte +199 -0
- package/dist/Input/Input.svelte.d.ts +26 -0
- package/dist/Input/index.d.ts +2 -0
- package/dist/Input/index.js +1 -0
- package/dist/Input/input.types.d.ts +113 -0
- package/dist/Input/input.types.js +1 -0
- package/dist/Input/input.variants.d.ts +398 -0
- package/dist/Input/input.variants.js +387 -0
- package/dist/Kbd/Kbd.svelte +45 -0
- package/dist/Kbd/Kbd.svelte.d.ts +5 -0
- package/dist/Kbd/index.d.ts +3 -0
- package/dist/Kbd/index.js +2 -0
- package/dist/Kbd/kbd.types.d.ts +91 -0
- package/dist/Kbd/kbd.types.js +1 -0
- package/dist/Kbd/kbd.variants.d.ts +180 -0
- package/dist/Kbd/kbd.variants.js +168 -0
- package/dist/Kbd/useKbd.svelte.d.ts +29 -0
- package/dist/Kbd/useKbd.svelte.js +248 -0
- package/dist/Link/Link.svelte +168 -0
- package/dist/Link/Link.svelte.d.ts +5 -0
- package/dist/Link/index.d.ts +2 -0
- package/dist/Link/index.js +1 -0
- package/dist/Link/link.types.d.ts +86 -0
- package/dist/Link/link.types.js +1 -0
- package/dist/Link/link.variants.d.ts +113 -0
- package/dist/Link/link.variants.js +43 -0
- package/dist/Modal/Modal.svelte +218 -0
- package/dist/Modal/Modal.svelte.d.ts +5 -0
- package/dist/Modal/ModalTriggerTestWrapper.svelte +10 -0
- package/dist/Modal/ModalTriggerTestWrapper.svelte.d.ts +18 -0
- package/dist/Modal/index.d.ts +2 -0
- package/dist/Modal/index.js +1 -0
- package/dist/Modal/modal.types.d.ts +155 -0
- package/dist/Modal/modal.types.js +1 -0
- package/dist/Modal/modal.variants.d.ts +303 -0
- package/dist/Modal/modal.variants.js +90 -0
- package/dist/Pagination/Pagination.svelte +253 -0
- package/dist/Pagination/Pagination.svelte.d.ts +6 -0
- package/dist/Pagination/index.d.ts +2 -0
- package/dist/Pagination/index.js +1 -0
- package/dist/Pagination/pagination.types.d.ts +191 -0
- package/dist/Pagination/pagination.types.js +1 -0
- package/dist/Pagination/pagination.variants.d.ts +160 -0
- package/dist/Pagination/pagination.variants.js +125 -0
- package/dist/PinInput/PinInput.svelte +162 -0
- package/dist/PinInput/PinInput.svelte.d.ts +6 -0
- package/dist/PinInput/index.d.ts +2 -0
- package/dist/PinInput/index.js +1 -0
- package/dist/PinInput/pin-input.types.d.ts +110 -0
- package/dist/PinInput/pin-input.types.js +1 -0
- package/dist/PinInput/pin-input.variants.d.ts +303 -0
- package/dist/PinInput/pin-input.variants.js +196 -0
- package/dist/Popover/Popover.svelte +122 -0
- package/dist/Popover/Popover.svelte.d.ts +6 -0
- package/dist/Popover/index.d.ts +2 -0
- package/dist/Popover/index.js +1 -0
- package/dist/Popover/popover.types.d.ts +58 -0
- package/dist/Popover/popover.types.js +1 -0
- package/dist/Popover/popover.variants.d.ts +53 -0
- package/dist/Popover/popover.variants.js +31 -0
- package/dist/Progress/Progress.svelte +135 -0
- package/dist/Progress/Progress.svelte.d.ts +6 -0
- package/dist/Progress/index.d.ts +2 -0
- package/dist/Progress/index.js +1 -0
- package/dist/Progress/progress.types.d.ts +71 -0
- package/dist/Progress/progress.types.js +1 -0
- package/dist/Progress/progress.variants.d.ts +513 -0
- package/dist/Progress/progress.variants.js +204 -0
- package/dist/RadioGroup/RadioGroup.svelte +226 -0
- package/dist/RadioGroup/RadioGroup.svelte.d.ts +6 -0
- package/dist/RadioGroup/index.d.ts +2 -0
- package/dist/RadioGroup/index.js +1 -0
- package/dist/RadioGroup/radio-group.types.d.ts +111 -0
- package/dist/RadioGroup/radio-group.types.js +1 -0
- package/dist/RadioGroup/radio-group.variants.d.ts +543 -0
- package/dist/RadioGroup/radio-group.variants.js +232 -0
- package/dist/Select/Select.svelte +461 -0
- package/dist/Select/Select.svelte.d.ts +6 -0
- package/dist/Select/index.d.ts +2 -0
- package/dist/Select/index.js +1 -0
- package/dist/Select/select.types.d.ts +263 -0
- package/dist/Select/select.types.js +1 -0
- package/dist/Select/select.variants.d.ts +713 -0
- package/dist/Select/select.variants.js +482 -0
- package/dist/SelectMenu/SelectMenu.svelte +637 -0
- package/dist/SelectMenu/SelectMenu.svelte.d.ts +5 -0
- package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte +11 -0
- package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte.d.ts +7 -0
- package/dist/SelectMenu/index.d.ts +2 -0
- package/dist/SelectMenu/index.js +1 -0
- package/dist/SelectMenu/select-menu.types.d.ts +326 -0
- package/dist/SelectMenu/select-menu.types.js +1 -0
- package/dist/SelectMenu/select-menu.variants.d.ts +795 -0
- package/dist/SelectMenu/select-menu.variants.js +70 -0
- package/dist/Separator/Separator.svelte +77 -0
- package/dist/Separator/Separator.svelte.d.ts +6 -0
- package/dist/Separator/index.d.ts +2 -0
- package/dist/Separator/index.js +1 -0
- package/dist/Separator/separator.types.d.ts +53 -0
- package/dist/Separator/separator.types.js +1 -0
- package/dist/Separator/separator.variants.d.ts +509 -0
- package/dist/Separator/separator.variants.js +110 -0
- package/dist/Skeleton/Skeleton.svelte +39 -0
- package/dist/Skeleton/Skeleton.svelte.d.ts +5 -0
- package/dist/Skeleton/index.d.ts +2 -0
- package/dist/Skeleton/index.js +1 -0
- package/dist/Skeleton/skeleton.types.d.ts +27 -0
- package/dist/Skeleton/skeleton.types.js +1 -0
- package/dist/Skeleton/skeleton.variants.d.ts +18 -0
- package/dist/Skeleton/skeleton.variants.js +12 -0
- package/dist/Slideover/Slideover.svelte +212 -0
- package/dist/Slideover/Slideover.svelte.d.ts +5 -0
- package/dist/Slideover/SlideoverTriggerTestWrapper.svelte +10 -0
- package/dist/Slideover/SlideoverTriggerTestWrapper.svelte.d.ts +18 -0
- package/dist/Slideover/index.d.ts +2 -0
- package/dist/Slideover/index.js +1 -0
- package/dist/Slideover/slideover.types.d.ts +154 -0
- package/dist/Slideover/slideover.types.js +1 -0
- package/dist/Slideover/slideover.variants.d.ts +298 -0
- package/dist/Slideover/slideover.variants.js +145 -0
- package/dist/Slider/Slider.svelte +129 -0
- package/dist/Slider/Slider.svelte.d.ts +6 -0
- package/dist/Slider/index.d.ts +2 -0
- package/dist/Slider/index.js +1 -0
- package/dist/Slider/slider.types.d.ts +55 -0
- package/dist/Slider/slider.types.js +1 -0
- package/dist/Slider/slider.variants.d.ts +383 -0
- package/dist/Slider/slider.variants.js +102 -0
- package/dist/Stepper/Stepper.svelte +254 -0
- package/dist/Stepper/Stepper.svelte.d.ts +5 -0
- package/dist/Stepper/index.d.ts +2 -0
- package/dist/Stepper/index.js +1 -0
- package/dist/Stepper/stepper.types.d.ts +223 -0
- package/dist/Stepper/stepper.types.js +1 -0
- package/dist/Stepper/stepper.variants.d.ts +428 -0
- package/dist/Stepper/stepper.variants.js +204 -0
- package/dist/Switch/Switch.svelte +150 -0
- package/dist/Switch/Switch.svelte.d.ts +6 -0
- package/dist/Switch/index.d.ts +2 -0
- package/dist/Switch/index.js +1 -0
- package/dist/Switch/switch.types.d.ts +80 -0
- package/dist/Switch/switch.types.js +1 -0
- package/dist/Switch/switch.variants.d.ts +433 -0
- package/dist/Switch/switch.variants.js +171 -0
- package/dist/Table/Table.svelte +667 -0
- package/dist/Table/Table.svelte.d.ts +26 -0
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.js +1 -0
- package/dist/Table/table.types.d.ts +202 -0
- package/dist/Table/table.types.js +1 -0
- package/dist/Table/table.utils.d.ts +54 -0
- package/dist/Table/table.utils.js +167 -0
- package/dist/Table/table.variants.d.ts +205 -0
- package/dist/Table/table.variants.js +126 -0
- package/dist/Tabs/Tabs.svelte +188 -0
- package/dist/Tabs/Tabs.svelte.d.ts +6 -0
- package/dist/Tabs/index.d.ts +2 -0
- package/dist/Tabs/index.js +1 -0
- package/dist/Tabs/tabs.types.d.ts +207 -0
- package/dist/Tabs/tabs.types.js +1 -0
- package/dist/Tabs/tabs.variants.d.ts +298 -0
- package/dist/Tabs/tabs.variants.js +251 -0
- package/dist/Textarea/Textarea.svelte +215 -0
- package/dist/Textarea/Textarea.svelte.d.ts +5 -0
- package/dist/Textarea/index.d.ts +2 -0
- package/dist/Textarea/index.js +1 -0
- package/dist/Textarea/textarea.types.d.ts +103 -0
- package/dist/Textarea/textarea.types.js +1 -0
- package/dist/Textarea/textarea.variants.d.ts +403 -0
- package/dist/Textarea/textarea.variants.js +404 -0
- package/dist/ThemeModeButton/ThemeModeButton.svelte +74 -0
- package/dist/ThemeModeButton/ThemeModeButton.svelte.d.ts +5 -0
- package/dist/ThemeModeButton/index.d.ts +2 -0
- package/dist/ThemeModeButton/index.js +1 -0
- package/dist/ThemeModeButton/theme-mode-button.types.d.ts +69 -0
- package/dist/ThemeModeButton/theme-mode-button.types.js +1 -0
- package/dist/ThemeModeButton/theme-mode-button.variants.d.ts +21 -0
- package/dist/ThemeModeButton/theme-mode-button.variants.js +17 -0
- package/dist/Timeline/Timeline.svelte +116 -0
- package/dist/Timeline/Timeline.svelte.d.ts +5 -0
- package/dist/Timeline/index.d.ts +2 -0
- package/dist/Timeline/index.js +1 -0
- package/dist/Timeline/timeline.types.d.ts +138 -0
- package/dist/Timeline/timeline.types.js +1 -0
- package/dist/Timeline/timeline.variants.d.ts +413 -0
- package/dist/Timeline/timeline.variants.js +201 -0
- package/dist/Toast/Toaster.svelte +619 -0
- package/dist/Toast/Toaster.svelte.d.ts +5 -0
- package/dist/Toast/index.d.ts +4 -0
- package/dist/Toast/index.js +2 -0
- package/dist/Toast/toast.d.ts +38 -0
- package/dist/Toast/toast.js +73 -0
- package/dist/Toast/toast.types.d.ts +19 -0
- package/dist/Toast/toast.types.js +1 -0
- package/dist/Toast/toast.variants.d.ts +7 -0
- package/dist/Toast/toast.variants.js +5 -0
- package/dist/Tooltip/Tooltip.svelte +151 -0
- package/dist/Tooltip/Tooltip.svelte.d.ts +6 -0
- package/dist/Tooltip/TooltipTestWrapper.svelte +8 -0
- package/dist/Tooltip/TooltipTestWrapper.svelte.d.ts +4 -0
- package/dist/Tooltip/index.d.ts +2 -0
- package/dist/Tooltip/index.js +1 -0
- package/dist/Tooltip/tooltip.types.d.ts +62 -0
- package/dist/Tooltip/tooltip.types.js +1 -0
- package/dist/Tooltip/tooltip.variants.d.ts +68 -0
- package/dist/Tooltip/tooltip.variants.js +35 -0
- package/dist/User/User.svelte +98 -0
- package/dist/User/User.svelte.d.ts +5 -0
- package/dist/User/index.d.ts +2 -0
- package/dist/User/index.js +1 -0
- package/dist/User/user.types.d.ts +78 -0
- package/dist/User/user.types.js +1 -0
- package/dist/User/user.variants.d.ts +368 -0
- package/dist/User/user.variants.js +85 -0
- package/dist/config.d.ts +73 -0
- package/dist/config.js +108 -0
- package/dist/hooks/HookContextProbe.svelte +7 -0
- package/dist/hooks/HookContextProbe.svelte.d.ts +18 -0
- package/dist/hooks/HookContextProvider.svelte +9 -0
- package/dist/hooks/HookContextProvider.svelte.d.ts +18 -0
- package/dist/hooks/HookEmitProbe.svelte +14 -0
- package/dist/hooks/HookEmitProbe.svelte.d.ts +18 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useClickOutside.svelte.d.ts +31 -0
- package/dist/hooks/useClickOutside.svelte.js +37 -0
- package/dist/hooks/useClipboard.svelte.d.ts +30 -0
- package/dist/hooks/useClipboard.svelte.js +45 -0
- package/dist/hooks/useDebounce.svelte.d.ts +36 -0
- package/dist/hooks/useDebounce.svelte.js +56 -0
- package/dist/hooks/useEscapeKeydown.svelte.d.ts +31 -0
- package/dist/hooks/useEscapeKeydown.svelte.js +37 -0
- package/dist/hooks/useFormField.svelte.d.ts +54 -0
- package/dist/hooks/useFormField.svelte.js +65 -0
- package/dist/hooks/useInfiniteScroll.svelte.d.ts +57 -0
- package/dist/hooks/useInfiniteScroll.svelte.js +69 -0
- package/dist/hooks/useMediaQuery.svelte.d.ts +31 -0
- package/dist/hooks/useMediaQuery.svelte.js +38 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +57 -0
- package/dist/theme.css +680 -0
- package/package.json +237 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const HookEmitProbe: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type HookEmitProbe = InstanceType<typeof HookEmitProbe>;
|
|
18
|
+
export default HookEmitProbe;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type { UseClickOutsideOptions } from './useClickOutside.svelte.js';
|
|
2
|
+
export { useClickOutside } from './useClickOutside.svelte.js';
|
|
3
|
+
export type { UseClipboardOptions } from './useClipboard.svelte.js';
|
|
4
|
+
export { useClipboard } from './useClipboard.svelte.js';
|
|
5
|
+
export type { UseDebounceOptions } from './useDebounce.svelte.js';
|
|
6
|
+
export { useDebounce } from './useDebounce.svelte.js';
|
|
7
|
+
export type { UseEscapeKeydownOptions } from './useEscapeKeydown.svelte.js';
|
|
8
|
+
export { useEscapeKeydown } from './useEscapeKeydown.svelte.js';
|
|
9
|
+
export type { FormFieldContext } from './useFormField.svelte.js';
|
|
10
|
+
export { FORM_FIELD_CONTEXT_KEY, useFormField, useFormFieldEmit } from './useFormField.svelte.js';
|
|
11
|
+
export type { UseInfiniteScrollOptions } from './useInfiniteScroll.svelte.js';
|
|
12
|
+
export { useInfiniteScroll } from './useInfiniteScroll.svelte.js';
|
|
13
|
+
export type { UseMediaQueryOptions } from './useMediaQuery.svelte.js';
|
|
14
|
+
export { useMediaQuery } from './useMediaQuery.svelte.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useClickOutside } from './useClickOutside.svelte.js';
|
|
2
|
+
export { useClipboard } from './useClipboard.svelte.js';
|
|
3
|
+
export { useDebounce } from './useDebounce.svelte.js';
|
|
4
|
+
export { useEscapeKeydown } from './useEscapeKeydown.svelte.js';
|
|
5
|
+
export { FORM_FIELD_CONTEXT_KEY, useFormField, useFormFieldEmit } from './useFormField.svelte.js';
|
|
6
|
+
export { useInfiniteScroll } from './useInfiniteScroll.svelte.js';
|
|
7
|
+
export { useMediaQuery } from './useMediaQuery.svelte.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Action } from 'svelte/action';
|
|
2
|
+
export interface UseClickOutsideOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Callback fired when a click occurs outside the element.
|
|
5
|
+
*/
|
|
6
|
+
handler: (event: PointerEvent) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the listener is active.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Svelte action that detects clicks outside an element.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```svelte
|
|
18
|
+
* <script>
|
|
19
|
+
* import { useClickOutside } from 'svelora'
|
|
20
|
+
*
|
|
21
|
+
* let open = $state(false)
|
|
22
|
+
* </script>
|
|
23
|
+
*
|
|
24
|
+
* {#if open}
|
|
25
|
+
* <div use:useClickOutside={{ handler: () => (open = false) }}>
|
|
26
|
+
* Dropdown content
|
|
27
|
+
* </div>
|
|
28
|
+
* {/if}
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const useClickOutside: Action<HTMLElement, UseClickOutsideOptions>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action that detects clicks outside an element.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```svelte
|
|
6
|
+
* <script>
|
|
7
|
+
* import { useClickOutside } from 'svelora'
|
|
8
|
+
*
|
|
9
|
+
* let open = $state(false)
|
|
10
|
+
* </script>
|
|
11
|
+
*
|
|
12
|
+
* {#if open}
|
|
13
|
+
* <div use:useClickOutside={{ handler: () => (open = false) }}>
|
|
14
|
+
* Dropdown content
|
|
15
|
+
* </div>
|
|
16
|
+
* {/if}
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const useClickOutside = (node, initialOptions) => {
|
|
20
|
+
let currentOptions = initialOptions;
|
|
21
|
+
function handlePointerDown(event) {
|
|
22
|
+
if (currentOptions.enabled === false)
|
|
23
|
+
return;
|
|
24
|
+
if (!node.contains(event.target)) {
|
|
25
|
+
currentOptions.handler(event);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
document.addEventListener('pointerdown', handlePointerDown, true);
|
|
29
|
+
return {
|
|
30
|
+
update(newOptions) {
|
|
31
|
+
currentOptions = newOptions;
|
|
32
|
+
},
|
|
33
|
+
destroy() {
|
|
34
|
+
document.removeEventListener('pointerdown', handlePointerDown, true);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface UseClipboardOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Duration in milliseconds before `copied` resets to `false`.
|
|
4
|
+
* @default 2000
|
|
5
|
+
*/
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface UseClipboardReturn {
|
|
9
|
+
/** Whether text was recently copied (resets after timeout) */
|
|
10
|
+
readonly copied: boolean;
|
|
11
|
+
/** Copy text to clipboard */
|
|
12
|
+
copy: (text: string) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Reactive clipboard hook. Copies text and tracks copied state.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```svelte
|
|
19
|
+
* <script>
|
|
20
|
+
* import { useClipboard } from 'svelora'
|
|
21
|
+
*
|
|
22
|
+
* const clipboard = useClipboard()
|
|
23
|
+
* </script>
|
|
24
|
+
*
|
|
25
|
+
* <Button onclick={() => clipboard.copy('Hello!')}>
|
|
26
|
+
* {clipboard.copied ? 'Copied!' : 'Copy'}
|
|
27
|
+
* </Button>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function useClipboard(options?: UseClipboardOptions): UseClipboardReturn;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive clipboard hook. Copies text and tracks copied state.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```svelte
|
|
6
|
+
* <script>
|
|
7
|
+
* import { useClipboard } from 'svelora'
|
|
8
|
+
*
|
|
9
|
+
* const clipboard = useClipboard()
|
|
10
|
+
* </script>
|
|
11
|
+
*
|
|
12
|
+
* <Button onclick={() => clipboard.copy('Hello!')}>
|
|
13
|
+
* {clipboard.copied ? 'Copied!' : 'Copy'}
|
|
14
|
+
* </Button>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function useClipboard(options = {}) {
|
|
18
|
+
const { timeout = 2000 } = options;
|
|
19
|
+
let copied = $state(false);
|
|
20
|
+
let timeoutId;
|
|
21
|
+
async function copy(text) {
|
|
22
|
+
if (typeof navigator === 'undefined' || !navigator.clipboard)
|
|
23
|
+
return;
|
|
24
|
+
try {
|
|
25
|
+
await navigator.clipboard.writeText(text);
|
|
26
|
+
copied = true;
|
|
27
|
+
clearTimeout(timeoutId);
|
|
28
|
+
timeoutId = setTimeout(() => {
|
|
29
|
+
copied = false;
|
|
30
|
+
}, timeout);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
copied = false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
$effect(() => {
|
|
37
|
+
return () => clearTimeout(timeoutId);
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
get copied() {
|
|
41
|
+
return copied;
|
|
42
|
+
},
|
|
43
|
+
copy
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface UseDebounceOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Delay in milliseconds before the callback is executed.
|
|
4
|
+
* @default 300
|
|
5
|
+
*/
|
|
6
|
+
delay?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reactive debounce hook. Delays execution until a pause in calls.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```svelte
|
|
13
|
+
* <script>
|
|
14
|
+
* import { useDebounce } from 'svelora'
|
|
15
|
+
*
|
|
16
|
+
* const debounce = useDebounce({ delay: 500 })
|
|
17
|
+
* let query = $state('')
|
|
18
|
+
*
|
|
19
|
+
* function handleInput(e: Event) {
|
|
20
|
+
* query = e.currentTarget.value
|
|
21
|
+
* debounce.run(() => fetchResults(query))
|
|
22
|
+
* }
|
|
23
|
+
* </script>
|
|
24
|
+
*
|
|
25
|
+
* <input oninput={handleInput} />
|
|
26
|
+
* {#if debounce.pending}
|
|
27
|
+
* <Spinner />
|
|
28
|
+
* {/if}
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useDebounce(options?: UseDebounceOptions): {
|
|
32
|
+
readonly pending: boolean;
|
|
33
|
+
run: (callback: () => void) => void;
|
|
34
|
+
cancel: () => void;
|
|
35
|
+
flush: (callback: () => void) => void;
|
|
36
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive debounce hook. Delays execution until a pause in calls.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```svelte
|
|
6
|
+
* <script>
|
|
7
|
+
* import { useDebounce } from 'svelora'
|
|
8
|
+
*
|
|
9
|
+
* const debounce = useDebounce({ delay: 500 })
|
|
10
|
+
* let query = $state('')
|
|
11
|
+
*
|
|
12
|
+
* function handleInput(e: Event) {
|
|
13
|
+
* query = e.currentTarget.value
|
|
14
|
+
* debounce.run(() => fetchResults(query))
|
|
15
|
+
* }
|
|
16
|
+
* </script>
|
|
17
|
+
*
|
|
18
|
+
* <input oninput={handleInput} />
|
|
19
|
+
* {#if debounce.pending}
|
|
20
|
+
* <Spinner />
|
|
21
|
+
* {/if}
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function useDebounce(options = {}) {
|
|
25
|
+
const { delay = 300 } = options;
|
|
26
|
+
let pending = $state(false);
|
|
27
|
+
let timeoutId;
|
|
28
|
+
function run(callback) {
|
|
29
|
+
pending = true;
|
|
30
|
+
clearTimeout(timeoutId);
|
|
31
|
+
timeoutId = setTimeout(() => {
|
|
32
|
+
pending = false;
|
|
33
|
+
callback();
|
|
34
|
+
}, delay);
|
|
35
|
+
}
|
|
36
|
+
function cancel() {
|
|
37
|
+
clearTimeout(timeoutId);
|
|
38
|
+
pending = false;
|
|
39
|
+
}
|
|
40
|
+
function flush(callback) {
|
|
41
|
+
clearTimeout(timeoutId);
|
|
42
|
+
pending = false;
|
|
43
|
+
callback();
|
|
44
|
+
}
|
|
45
|
+
$effect(() => {
|
|
46
|
+
return () => clearTimeout(timeoutId);
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
get pending() {
|
|
50
|
+
return pending;
|
|
51
|
+
},
|
|
52
|
+
run,
|
|
53
|
+
cancel,
|
|
54
|
+
flush
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Action } from 'svelte/action';
|
|
2
|
+
export interface UseEscapeKeydownOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Callback fired when Escape is pressed.
|
|
5
|
+
*/
|
|
6
|
+
handler: (event: KeyboardEvent) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the listener is active.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Svelte action that listens for Escape keydown on an element or the document.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```svelte
|
|
18
|
+
* <script>
|
|
19
|
+
* import { useEscapeKeydown } from 'svelora'
|
|
20
|
+
*
|
|
21
|
+
* let open = $state(true)
|
|
22
|
+
* </script>
|
|
23
|
+
*
|
|
24
|
+
* {#if open}
|
|
25
|
+
* <div use:useEscapeKeydown={{ handler: () => (open = false) }}>
|
|
26
|
+
* Press Escape to close
|
|
27
|
+
* </div>
|
|
28
|
+
* {/if}
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const useEscapeKeydown: Action<HTMLElement, UseEscapeKeydownOptions>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action that listens for Escape keydown on an element or the document.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```svelte
|
|
6
|
+
* <script>
|
|
7
|
+
* import { useEscapeKeydown } from 'svelora'
|
|
8
|
+
*
|
|
9
|
+
* let open = $state(true)
|
|
10
|
+
* </script>
|
|
11
|
+
*
|
|
12
|
+
* {#if open}
|
|
13
|
+
* <div use:useEscapeKeydown={{ handler: () => (open = false) }}>
|
|
14
|
+
* Press Escape to close
|
|
15
|
+
* </div>
|
|
16
|
+
* {/if}
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const useEscapeKeydown = (_node, initialOptions) => {
|
|
20
|
+
let currentOptions = initialOptions;
|
|
21
|
+
function handleKeydown(event) {
|
|
22
|
+
if (currentOptions.enabled === false)
|
|
23
|
+
return;
|
|
24
|
+
if (event.key === 'Escape') {
|
|
25
|
+
currentOptions.handler(event);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
document.addEventListener('keydown', handleKeydown);
|
|
29
|
+
return {
|
|
30
|
+
update(newOptions) {
|
|
31
|
+
currentOptions = newOptions;
|
|
32
|
+
},
|
|
33
|
+
destroy() {
|
|
34
|
+
document.removeEventListener('keydown', handleKeydown);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { FormFieldProps } from '../FormField/form-field.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Symbol key for the FormField context. Using a Symbol instead of a string
|
|
4
|
+
* prevents collisions with unrelated `getContext('formField')` calls from
|
|
5
|
+
* user code or other libraries.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FORM_FIELD_CONTEXT_KEY: unique symbol;
|
|
8
|
+
export interface FormFieldContext {
|
|
9
|
+
name?: string;
|
|
10
|
+
size: NonNullable<FormFieldProps['size']>;
|
|
11
|
+
error?: string | boolean;
|
|
12
|
+
ariaId: string;
|
|
13
|
+
/** Whether input events should validate this field before first blur. */
|
|
14
|
+
eagerValidation?: boolean;
|
|
15
|
+
/** Per-field override for the input debounce delay. */
|
|
16
|
+
validateOnInputDelay?: number;
|
|
17
|
+
/** Regex pattern used to match form errors for this field (in addition to exact name). */
|
|
18
|
+
errorPattern?: RegExp;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Access the nearest FormField context. Returns `undefined` when used outside a FormField.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```svelte
|
|
25
|
+
* <script>
|
|
26
|
+
* import { useFormField } from 'svelora'
|
|
27
|
+
*
|
|
28
|
+
* const formField = useFormField()
|
|
29
|
+
* const hasError = $derived(formField?.error !== undefined && formField?.error !== false)
|
|
30
|
+
* </script>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useFormField(): FormFieldContext | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Event emitter helpers for inputs nested inside a `<FormField>` within a `<Form>`.
|
|
36
|
+
* Each returned function is a safe no-op when used outside a Form, so inputs can
|
|
37
|
+
* unconditionally wire them to their native events.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```svelte
|
|
41
|
+
* <script>
|
|
42
|
+
* import { useFormFieldEmit } from 'svelora'
|
|
43
|
+
* const emit = useFormFieldEmit()
|
|
44
|
+
* </script>
|
|
45
|
+
*
|
|
46
|
+
* <input onblur={emit.onBlur} oninput={emit.onInput} onchange={emit.onChange} onfocus={emit.onFocus} />
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function useFormFieldEmit(): {
|
|
50
|
+
onBlur(): void;
|
|
51
|
+
onFocus(): void;
|
|
52
|
+
onChange(): void;
|
|
53
|
+
onInput(): void;
|
|
54
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { getContext } from 'svelte';
|
|
2
|
+
import { getFormContext } from '../Form/form.context.svelte.js';
|
|
3
|
+
/**
|
|
4
|
+
* Symbol key for the FormField context. Using a Symbol instead of a string
|
|
5
|
+
* prevents collisions with unrelated `getContext('formField')` calls from
|
|
6
|
+
* user code or other libraries.
|
|
7
|
+
*/
|
|
8
|
+
export const FORM_FIELD_CONTEXT_KEY = Symbol('svelora:form-field');
|
|
9
|
+
/**
|
|
10
|
+
* Access the nearest FormField context. Returns `undefined` when used outside a FormField.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```svelte
|
|
14
|
+
* <script>
|
|
15
|
+
* import { useFormField } from 'svelora'
|
|
16
|
+
*
|
|
17
|
+
* const formField = useFormField()
|
|
18
|
+
* const hasError = $derived(formField?.error !== undefined && formField?.error !== false)
|
|
19
|
+
* </script>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function useFormField() {
|
|
23
|
+
return getContext(FORM_FIELD_CONTEXT_KEY);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Event emitter helpers for inputs nested inside a `<FormField>` within a `<Form>`.
|
|
27
|
+
* Each returned function is a safe no-op when used outside a Form, so inputs can
|
|
28
|
+
* unconditionally wire them to their native events.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```svelte
|
|
32
|
+
* <script>
|
|
33
|
+
* import { useFormFieldEmit } from 'svelora'
|
|
34
|
+
* const emit = useFormFieldEmit()
|
|
35
|
+
* </script>
|
|
36
|
+
*
|
|
37
|
+
* <input onblur={emit.onBlur} oninput={emit.onInput} onchange={emit.onChange} onfocus={emit.onFocus} />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export function useFormFieldEmit() {
|
|
41
|
+
const fieldCtx = getContext(FORM_FIELD_CONTEXT_KEY);
|
|
42
|
+
const formCtx = getFormContext();
|
|
43
|
+
return {
|
|
44
|
+
onBlur() {
|
|
45
|
+
const n = fieldCtx?.name;
|
|
46
|
+
if (n)
|
|
47
|
+
formCtx?.onBlur(n);
|
|
48
|
+
},
|
|
49
|
+
onFocus() {
|
|
50
|
+
const n = fieldCtx?.name;
|
|
51
|
+
if (n)
|
|
52
|
+
formCtx?.onFocus(n);
|
|
53
|
+
},
|
|
54
|
+
onChange() {
|
|
55
|
+
const n = fieldCtx?.name;
|
|
56
|
+
if (n)
|
|
57
|
+
formCtx?.onChange(n);
|
|
58
|
+
},
|
|
59
|
+
onInput() {
|
|
60
|
+
const n = fieldCtx?.name;
|
|
61
|
+
if (n)
|
|
62
|
+
formCtx?.onInput(n, fieldCtx?.eagerValidation);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Action } from 'svelte/action';
|
|
2
|
+
export interface UseInfiniteScrollOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Callback fired when the user scrolls near the bottom.
|
|
5
|
+
* Return a promise to automatically manage the loading state.
|
|
6
|
+
*/
|
|
7
|
+
onLoad: () => void | Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Distance in pixels from the bottom to trigger loading.
|
|
10
|
+
* @default 100
|
|
11
|
+
*/
|
|
12
|
+
threshold?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the hook is active. Set to `false` when all data is loaded.
|
|
15
|
+
* Supports getter function for reactive control.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
enabled?: boolean | (() => boolean);
|
|
19
|
+
}
|
|
20
|
+
export interface UseInfiniteScrollReturn {
|
|
21
|
+
/** Whether an async onLoad is currently in progress */
|
|
22
|
+
readonly loading: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Reactive infinite scroll hook with Svelte action.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```svelte
|
|
29
|
+
* <script>
|
|
30
|
+
* import { useInfiniteScroll } from 'svelora'
|
|
31
|
+
*
|
|
32
|
+
* let items = $state([...])
|
|
33
|
+
* let hasMore = $state(true)
|
|
34
|
+
*
|
|
35
|
+
* const scroll = useInfiniteScroll({
|
|
36
|
+
* onLoad: async () => {
|
|
37
|
+
* const next = await fetchMore()
|
|
38
|
+
* items.push(...next)
|
|
39
|
+
* if (next.length === 0) hasMore = false
|
|
40
|
+
* },
|
|
41
|
+
* enabled: () => hasMore
|
|
42
|
+
* })
|
|
43
|
+
* </script>
|
|
44
|
+
*
|
|
45
|
+
* <div use:scroll.action>
|
|
46
|
+
* {#each items as item (item.id)}
|
|
47
|
+
* <div>{item.name}</div>
|
|
48
|
+
* {/each}
|
|
49
|
+
* {#if scroll.loading}
|
|
50
|
+
* <Spinner />
|
|
51
|
+
* {/if}
|
|
52
|
+
* </div>
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function useInfiniteScroll(options: UseInfiniteScrollOptions): UseInfiniteScrollReturn & {
|
|
56
|
+
action: Action<HTMLElement>;
|
|
57
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive infinite scroll hook with Svelte action.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```svelte
|
|
6
|
+
* <script>
|
|
7
|
+
* import { useInfiniteScroll } from 'svelora'
|
|
8
|
+
*
|
|
9
|
+
* let items = $state([...])
|
|
10
|
+
* let hasMore = $state(true)
|
|
11
|
+
*
|
|
12
|
+
* const scroll = useInfiniteScroll({
|
|
13
|
+
* onLoad: async () => {
|
|
14
|
+
* const next = await fetchMore()
|
|
15
|
+
* items.push(...next)
|
|
16
|
+
* if (next.length === 0) hasMore = false
|
|
17
|
+
* },
|
|
18
|
+
* enabled: () => hasMore
|
|
19
|
+
* })
|
|
20
|
+
* </script>
|
|
21
|
+
*
|
|
22
|
+
* <div use:scroll.action>
|
|
23
|
+
* {#each items as item (item.id)}
|
|
24
|
+
* <div>{item.name}</div>
|
|
25
|
+
* {/each}
|
|
26
|
+
* {#if scroll.loading}
|
|
27
|
+
* <Spinner />
|
|
28
|
+
* {/if}
|
|
29
|
+
* </div>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export function useInfiniteScroll(options) {
|
|
33
|
+
const { onLoad, threshold = 100 } = options;
|
|
34
|
+
let loading = $state(false);
|
|
35
|
+
function getEnabled() {
|
|
36
|
+
return typeof options.enabled === 'function' ? options.enabled() : (options.enabled ?? true);
|
|
37
|
+
}
|
|
38
|
+
async function check(el) {
|
|
39
|
+
if (loading || !getEnabled())
|
|
40
|
+
return;
|
|
41
|
+
const { scrollTop, scrollHeight, clientHeight } = el;
|
|
42
|
+
if (scrollHeight - scrollTop - clientHeight > threshold)
|
|
43
|
+
return;
|
|
44
|
+
loading = true;
|
|
45
|
+
try {
|
|
46
|
+
await onLoad();
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
loading = false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const action = (node) => {
|
|
53
|
+
function handleScroll() {
|
|
54
|
+
check(node);
|
|
55
|
+
}
|
|
56
|
+
node.addEventListener('scroll', handleScroll, { passive: true });
|
|
57
|
+
return {
|
|
58
|
+
destroy() {
|
|
59
|
+
node.removeEventListener('scroll', handleScroll);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
get loading() {
|
|
65
|
+
return loading;
|
|
66
|
+
},
|
|
67
|
+
action
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface UseMediaQueryOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Initial value before the media query is evaluated (SSR-safe).
|
|
4
|
+
* @default false
|
|
5
|
+
*/
|
|
6
|
+
initialValue?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UseMediaQueryReturn {
|
|
9
|
+
/** Whether the media query currently matches */
|
|
10
|
+
readonly matches: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Reactive media query hook. Tracks whether a CSS media query matches.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```svelte
|
|
17
|
+
* <script>
|
|
18
|
+
* import { useMediaQuery } from 'svelora'
|
|
19
|
+
*
|
|
20
|
+
* const isMobile = useMediaQuery('(max-width: 640px)')
|
|
21
|
+
* const prefersDark = useMediaQuery('(prefers-color-scheme: dark)')
|
|
22
|
+
* </script>
|
|
23
|
+
*
|
|
24
|
+
* {#if isMobile.matches}
|
|
25
|
+
* <MobileLayout />
|
|
26
|
+
* {:else}
|
|
27
|
+
* <DesktopLayout />
|
|
28
|
+
* {/if}
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useMediaQuery(query: string | (() => string), options?: UseMediaQueryOptions): UseMediaQueryReturn;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive media query hook. Tracks whether a CSS media query matches.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```svelte
|
|
6
|
+
* <script>
|
|
7
|
+
* import { useMediaQuery } from 'svelora'
|
|
8
|
+
*
|
|
9
|
+
* const isMobile = useMediaQuery('(max-width: 640px)')
|
|
10
|
+
* const prefersDark = useMediaQuery('(prefers-color-scheme: dark)')
|
|
11
|
+
* </script>
|
|
12
|
+
*
|
|
13
|
+
* {#if isMobile.matches}
|
|
14
|
+
* <MobileLayout />
|
|
15
|
+
* {:else}
|
|
16
|
+
* <DesktopLayout />
|
|
17
|
+
* {/if}
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function useMediaQuery(query, options = {}) {
|
|
21
|
+
const { initialValue = false } = options;
|
|
22
|
+
const resolveQuery = typeof query === 'function' ? query : () => query;
|
|
23
|
+
let matches = $state(initialValue);
|
|
24
|
+
$effect(() => {
|
|
25
|
+
const mediaQuery = window.matchMedia(resolveQuery());
|
|
26
|
+
matches = mediaQuery.matches;
|
|
27
|
+
function handler(event) {
|
|
28
|
+
matches = event.matches;
|
|
29
|
+
}
|
|
30
|
+
mediaQuery.addEventListener('change', handler);
|
|
31
|
+
return () => mediaQuery.removeEventListener('change', handler);
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
get matches() {
|
|
35
|
+
return matches;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|