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,6 @@
|
|
|
1
|
+
import type { EditorProps } from './editor.types.js';
|
|
2
|
+
export type Props = EditorProps;
|
|
3
|
+
import { Editor } from '@tiptap/core';
|
|
4
|
+
declare const Editor: import("svelte").Component<EditorProps, {}, "value" | "ref" | "api">;
|
|
5
|
+
type Editor = ReturnType<typeof Editor>;
|
|
6
|
+
export default Editor;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">import { untrack } from 'svelte';
|
|
2
|
+
import Button from '../Button/Button.svelte';
|
|
3
|
+
import Form from '../Form/Form.svelte';
|
|
4
|
+
import type { FormApi, FormError, FormSubmitEvent } from '../Form/form.types.js';
|
|
5
|
+
import FormField from '../FormField/FormField.svelte';
|
|
6
|
+
import Input from '../Input/Input.svelte';
|
|
7
|
+
import Modal from '../Modal/Modal.svelte';
|
|
8
|
+
import { httpUrlSchema, type UrlSchema } from './editor.schemas.js';
|
|
9
|
+
interface Props {
|
|
10
|
+
open: boolean;
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
initialValue?: string;
|
|
15
|
+
confirmLabel?: string;
|
|
16
|
+
schema?: UrlSchema;
|
|
17
|
+
onConfirm?: (value: string) => void;
|
|
18
|
+
onCancel?: () => void;
|
|
19
|
+
}
|
|
20
|
+
let { open = $bindable(false), title = 'Enter URL', description, placeholder = 'https://', initialValue = '', confirmLabel = 'Insert', schema, onConfirm, onCancel }: Props = $props();
|
|
21
|
+
type UrlFormState = {
|
|
22
|
+
url: string;
|
|
23
|
+
};
|
|
24
|
+
let formApi = $state<FormApi<UrlFormState>>();
|
|
25
|
+
let formState = $state<UrlFormState>({ url: '' });
|
|
26
|
+
let inputRef: HTMLInputElement | null = $state(null);
|
|
27
|
+
let settled = $state(false);
|
|
28
|
+
const resolvedSchema = $derived(schema ?? httpUrlSchema);
|
|
29
|
+
$effect(() => {
|
|
30
|
+
if (open) {
|
|
31
|
+
const initial = untrack(() => initialValue);
|
|
32
|
+
formState = { url: initial };
|
|
33
|
+
settled = false;
|
|
34
|
+
untrack(() => formApi?.reset());
|
|
35
|
+
requestAnimationFrame(() => inputRef?.focus());
|
|
36
|
+
}
|
|
37
|
+
else if (!settled) {
|
|
38
|
+
settled = true;
|
|
39
|
+
onCancel?.();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
async function validate(state: object): Promise<FormError[]> {
|
|
43
|
+
const url = (state as Partial<UrlFormState>).url ?? '';
|
|
44
|
+
const result = await resolvedSchema['~standard'].validate(url);
|
|
45
|
+
if (result.issues) {
|
|
46
|
+
return [{ name: 'url', message: result.issues[0]?.message ?? 'Invalid value' }];
|
|
47
|
+
}
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
function handleSubmit(event: FormSubmitEvent<unknown>): void {
|
|
51
|
+
const data = event.data as UrlFormState;
|
|
52
|
+
settled = true;
|
|
53
|
+
onConfirm?.(data.url.trim());
|
|
54
|
+
open = false;
|
|
55
|
+
}
|
|
56
|
+
function cancel(): void {
|
|
57
|
+
settled = true;
|
|
58
|
+
onCancel?.();
|
|
59
|
+
open = false;
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<Modal bind:open {title} {description} size="sm">
|
|
64
|
+
{#snippet body()}
|
|
65
|
+
<Form
|
|
66
|
+
bind:api={formApi}
|
|
67
|
+
bind:state={formState}
|
|
68
|
+
{validate}
|
|
69
|
+
onsubmit={handleSubmit}
|
|
70
|
+
class="py-1"
|
|
71
|
+
>
|
|
72
|
+
<FormField name="url">
|
|
73
|
+
<Input
|
|
74
|
+
bind:ref={inputRef}
|
|
75
|
+
bind:value={formState.url}
|
|
76
|
+
{placeholder}
|
|
77
|
+
class="w-full"
|
|
78
|
+
/>
|
|
79
|
+
</FormField>
|
|
80
|
+
</Form>
|
|
81
|
+
{/snippet}
|
|
82
|
+
{#snippet footer()}
|
|
83
|
+
<div class="flex items-center justify-end gap-2">
|
|
84
|
+
<Button variant="ghost" size="sm" label="Cancel" onclick={cancel} />
|
|
85
|
+
<Button
|
|
86
|
+
color="primary"
|
|
87
|
+
size="sm"
|
|
88
|
+
label={confirmLabel}
|
|
89
|
+
loading={formApi?.loading}
|
|
90
|
+
onclick={() => void formApi?.submit()}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
{/snippet}
|
|
94
|
+
</Modal>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type UrlSchema } from './editor.schemas.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
open: boolean;
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
initialValue?: string;
|
|
8
|
+
confirmLabel?: string;
|
|
9
|
+
schema?: UrlSchema;
|
|
10
|
+
onConfirm?: (value: string) => void;
|
|
11
|
+
onCancel?: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const EditorUrlPrompt: import("svelte").Component<Props, {}, "open">;
|
|
14
|
+
type EditorUrlPrompt = ReturnType<typeof EditorUrlPrompt>;
|
|
15
|
+
export default EditorUrlPrompt;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Icon from '../Icon/Icon.svelte'
|
|
3
|
+
import type { SlashCommand } from './editor.types.js'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
items: SlashCommand[]
|
|
7
|
+
selectedIndex: number
|
|
8
|
+
onPick: (index: number) => void
|
|
9
|
+
listboxId: string
|
|
10
|
+
optionIdPrefix: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { items, selectedIndex, onPick, listboxId, optionIdPrefix }: Props = $props()
|
|
14
|
+
|
|
15
|
+
let listEl: HTMLDivElement | null = $state(null)
|
|
16
|
+
|
|
17
|
+
$effect(() => {
|
|
18
|
+
if (!listEl) return
|
|
19
|
+
const active = listEl.querySelector(`[data-index="${selectedIndex}"]`)
|
|
20
|
+
if (!active) return
|
|
21
|
+
requestAnimationFrame(() => {
|
|
22
|
+
;(active as HTMLElement).scrollIntoView({ block: 'nearest' })
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<div
|
|
28
|
+
bind:this={listEl}
|
|
29
|
+
id={listboxId}
|
|
30
|
+
role="listbox"
|
|
31
|
+
aria-label="Slash commands"
|
|
32
|
+
data-editor-slash-popup
|
|
33
|
+
class="max-h-72 max-w-80 min-w-64 overflow-y-auto rounded-lg border border-outline-variant bg-surface py-1 shadow-lg"
|
|
34
|
+
>
|
|
35
|
+
{#if items.length === 0}
|
|
36
|
+
<div class="px-3 py-2 text-sm text-on-surface-variant">No matches</div>
|
|
37
|
+
{:else}
|
|
38
|
+
{#each items as cmd, i (cmd.id)}
|
|
39
|
+
{@const active = i === selectedIndex}
|
|
40
|
+
<button
|
|
41
|
+
type="button"
|
|
42
|
+
role="option"
|
|
43
|
+
id={`${optionIdPrefix}${i}`}
|
|
44
|
+
aria-selected={active}
|
|
45
|
+
data-slash-item
|
|
46
|
+
data-id={cmd.id}
|
|
47
|
+
data-index={i}
|
|
48
|
+
class="flex w-full items-start gap-3 px-3 py-2 text-start hover:bg-surface-container-high {active
|
|
49
|
+
? 'bg-primary-container text-on-primary-container'
|
|
50
|
+
: 'text-on-surface'}"
|
|
51
|
+
onmousedown={(e) => {
|
|
52
|
+
e.preventDefault()
|
|
53
|
+
onPick(i)
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{#if cmd.icon}
|
|
57
|
+
<span
|
|
58
|
+
class="flex size-7 shrink-0 items-center justify-center rounded border border-outline-variant"
|
|
59
|
+
>
|
|
60
|
+
<Icon name={cmd.icon} class="size-4" />
|
|
61
|
+
</span>
|
|
62
|
+
{/if}
|
|
63
|
+
<span class="flex min-w-0 flex-col">
|
|
64
|
+
<span class="truncate text-sm font-medium">{cmd.label}</span>
|
|
65
|
+
{#if cmd.description}
|
|
66
|
+
<span class="truncate text-xs text-on-surface-variant"
|
|
67
|
+
>{cmd.description}</span
|
|
68
|
+
>
|
|
69
|
+
{/if}
|
|
70
|
+
</span>
|
|
71
|
+
</button>
|
|
72
|
+
{/each}
|
|
73
|
+
{/if}
|
|
74
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SlashCommand } from './editor.types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
items: SlashCommand[];
|
|
4
|
+
selectedIndex: number;
|
|
5
|
+
onPick: (index: number) => void;
|
|
6
|
+
listboxId: string;
|
|
7
|
+
optionIdPrefix: string;
|
|
8
|
+
}
|
|
9
|
+
declare const SlashPopup: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type SlashPopup = ReturnType<typeof SlashPopup>;
|
|
11
|
+
export default SlashPopup;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AnyExtension } from '@tiptap/core';
|
|
2
|
+
import type { SuggestionOptions } from '@tiptap/suggestion';
|
|
3
|
+
import type { SlashCommand } from './editor.types.js';
|
|
4
|
+
interface BuildExtensionsOptions {
|
|
5
|
+
headingLevels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
autolink?: boolean;
|
|
8
|
+
linkOpenInNewTab?: boolean;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
image?: boolean;
|
|
11
|
+
tables?: boolean;
|
|
12
|
+
markdown?: boolean;
|
|
13
|
+
markdownAllowHtml?: boolean;
|
|
14
|
+
mentionSuggestion?: Omit<SuggestionOptions, 'editor'>;
|
|
15
|
+
mentionTrigger?: string;
|
|
16
|
+
slashCommands?: SlashCommand[];
|
|
17
|
+
slashTrigger?: string;
|
|
18
|
+
youtube?: boolean;
|
|
19
|
+
dragHandle?: boolean;
|
|
20
|
+
extra?: AnyExtension[];
|
|
21
|
+
}
|
|
22
|
+
export declare function buildExtensions(options?: BuildExtensionsOptions): AnyExtension[] | Promise<AnyExtension[]>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import CharacterCount from '@tiptap/extension-character-count';
|
|
2
|
+
import { DragHandle } from '@tiptap/extension-drag-handle';
|
|
3
|
+
import Image from '@tiptap/extension-image';
|
|
4
|
+
import Mention from '@tiptap/extension-mention';
|
|
5
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
6
|
+
import TextAlign from '@tiptap/extension-text-align';
|
|
7
|
+
import Typography from '@tiptap/extension-typography';
|
|
8
|
+
import Youtube from '@tiptap/extension-youtube';
|
|
9
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
10
|
+
import { buildSlashExtension } from './editor.slash.svelte.js';
|
|
11
|
+
function buildCore(options) {
|
|
12
|
+
const { headingLevels = [1, 2, 3], autolink = true, linkOpenInNewTab = true, maxLength } = options;
|
|
13
|
+
return [
|
|
14
|
+
StarterKit.configure({
|
|
15
|
+
heading: { levels: headingLevels },
|
|
16
|
+
link: {
|
|
17
|
+
autolink,
|
|
18
|
+
openOnClick: false,
|
|
19
|
+
HTMLAttributes: linkOpenInNewTab
|
|
20
|
+
? { target: '_blank', rel: 'noopener noreferrer' }
|
|
21
|
+
: {}
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
TextAlign.configure({ types: ['heading', 'paragraph'] }),
|
|
25
|
+
Typography,
|
|
26
|
+
CharacterCount.configure({ limit: maxLength })
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
function buildImageExt() {
|
|
30
|
+
return Image.configure({
|
|
31
|
+
inline: false,
|
|
32
|
+
allowBase64: true,
|
|
33
|
+
HTMLAttributes: { class: 'ps-editor-image' }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function buildTableExts() {
|
|
37
|
+
const [{ Table }, { TableRow }, { TableCell }, { TableHeader }] = await Promise.all([
|
|
38
|
+
import('@tiptap/extension-table'),
|
|
39
|
+
import('@tiptap/extension-table-row'),
|
|
40
|
+
import('@tiptap/extension-table-cell'),
|
|
41
|
+
import('@tiptap/extension-table-header')
|
|
42
|
+
]);
|
|
43
|
+
return [
|
|
44
|
+
Table.configure({
|
|
45
|
+
resizable: true,
|
|
46
|
+
HTMLAttributes: { class: 'ps-editor-table' }
|
|
47
|
+
}),
|
|
48
|
+
TableRow,
|
|
49
|
+
TableHeader,
|
|
50
|
+
TableCell
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
async function buildMarkdownExt(allowHtml) {
|
|
54
|
+
const { Markdown } = await import('tiptap-markdown');
|
|
55
|
+
return Markdown.configure({
|
|
56
|
+
html: allowHtml,
|
|
57
|
+
tightLists: true,
|
|
58
|
+
bulletListMarker: '-',
|
|
59
|
+
linkify: true,
|
|
60
|
+
breaks: true,
|
|
61
|
+
transformPastedText: true,
|
|
62
|
+
transformCopiedText: false
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function buildMentionExt(suggestion, trigger) {
|
|
66
|
+
return Mention.configure({
|
|
67
|
+
HTMLAttributes: { class: 'ps-editor-mention' },
|
|
68
|
+
suggestion: { char: trigger, ...suggestion }
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function buildYoutubeExt() {
|
|
72
|
+
return Youtube.configure({
|
|
73
|
+
controls: true,
|
|
74
|
+
nocookie: true,
|
|
75
|
+
HTMLAttributes: { class: 'ps-editor-youtube' }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const GRIP_VERTICAL_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="5" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="19" r="1"/></svg>';
|
|
79
|
+
function buildDragHandleExt() {
|
|
80
|
+
return DragHandle.configure({
|
|
81
|
+
render() {
|
|
82
|
+
const handle = document.createElement('div');
|
|
83
|
+
handle.setAttribute('data-editor-drag-handle', '');
|
|
84
|
+
handle.setAttribute('aria-label', 'Drag to reorder');
|
|
85
|
+
handle.className = [
|
|
86
|
+
'inline-flex size-6 items-center justify-center',
|
|
87
|
+
'rounded text-on-surface-variant/70',
|
|
88
|
+
'hover:bg-surface-container-high hover:text-on-surface',
|
|
89
|
+
'cursor-grab active:cursor-grabbing select-none transition-colors'
|
|
90
|
+
].join(' ');
|
|
91
|
+
handle.innerHTML = GRIP_VERTICAL_SVG;
|
|
92
|
+
return handle;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const OPTIONAL_BUILDERS = [
|
|
97
|
+
(o) => (o.placeholder ? Placeholder.configure({ placeholder: o.placeholder }) : null),
|
|
98
|
+
(o) => (o.image ? buildImageExt() : null),
|
|
99
|
+
(o) => (o.tables ? buildTableExts() : null),
|
|
100
|
+
(o) => (o.youtube ? buildYoutubeExt() : null),
|
|
101
|
+
(o) => (o.markdown ? buildMarkdownExt(o.markdownAllowHtml ?? false) : null),
|
|
102
|
+
(o) => o.mentionSuggestion ? buildMentionExt(o.mentionSuggestion, o.mentionTrigger ?? '@') : null,
|
|
103
|
+
(o) => o.slashCommands && o.slashCommands.length > 0
|
|
104
|
+
? buildSlashExtension(o.slashCommands, o.slashTrigger ?? '/')
|
|
105
|
+
: null,
|
|
106
|
+
(o) => (o.dragHandle ? buildDragHandleExt() : null)
|
|
107
|
+
];
|
|
108
|
+
function collectOptionalExts(options) {
|
|
109
|
+
const sync = [];
|
|
110
|
+
const lazy = [];
|
|
111
|
+
for (const build of OPTIONAL_BUILDERS) {
|
|
112
|
+
const result = build(options);
|
|
113
|
+
if (result === null || result === undefined)
|
|
114
|
+
continue;
|
|
115
|
+
if (result instanceof Promise)
|
|
116
|
+
lazy.push(result);
|
|
117
|
+
else if (Array.isArray(result))
|
|
118
|
+
sync.push(...result);
|
|
119
|
+
else
|
|
120
|
+
sync.push(result);
|
|
121
|
+
}
|
|
122
|
+
if (lazy.length === 0)
|
|
123
|
+
return sync;
|
|
124
|
+
return Promise.all(lazy).then((resolved) => [...sync, ...resolved.flat()]);
|
|
125
|
+
}
|
|
126
|
+
export function buildExtensions(options = {}) {
|
|
127
|
+
const optional = collectOptionalExts(options);
|
|
128
|
+
if (optional instanceof Promise) {
|
|
129
|
+
return optional.then((opt) => [...buildCore(options), ...opt, ...(options.extra ?? [])]);
|
|
130
|
+
}
|
|
131
|
+
return [...buildCore(options), ...optional, ...(options.extra ?? [])];
|
|
132
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
export type UrlSchema = StandardSchemaV1<string, string>;
|
|
3
|
+
export declare const httpUrlSchema: UrlSchema;
|
|
4
|
+
export declare function isSafeImageSrc(src: string): boolean;
|
|
5
|
+
export declare const youtubeUrlSchema: UrlSchema;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export const httpUrlSchema = v.pipe(v.string(), v.trim(), v.nonEmpty('URL is required'), v.url('Please enter a valid URL'), v.regex(/^https?:\/\//i, 'URL must start with http:// or https://'));
|
|
3
|
+
function normalizeUrl(src) {
|
|
4
|
+
const s = src.replace(/[\t\n\r]/g, '');
|
|
5
|
+
let start = 0;
|
|
6
|
+
let end = s.length;
|
|
7
|
+
while (start < end && s.charCodeAt(start) <= 0x20)
|
|
8
|
+
start++;
|
|
9
|
+
while (end > start && s.charCodeAt(end - 1) <= 0x20)
|
|
10
|
+
end--;
|
|
11
|
+
return s.slice(start, end);
|
|
12
|
+
}
|
|
13
|
+
export function isSafeImageSrc(src) {
|
|
14
|
+
const s = normalizeUrl(src);
|
|
15
|
+
if (!s)
|
|
16
|
+
return false;
|
|
17
|
+
const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(s)?.[1]?.toLowerCase();
|
|
18
|
+
if (!scheme)
|
|
19
|
+
return true;
|
|
20
|
+
if (scheme === 'http' || scheme === 'https')
|
|
21
|
+
return true;
|
|
22
|
+
if (scheme === 'data') {
|
|
23
|
+
return /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp|x-icon|vnd\.microsoft\.icon)[;,]/i.test(s);
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
export const youtubeUrlSchema = v.pipe(v.string(), v.trim(), v.nonEmpty('URL is required'), v.url('Please enter a valid URL'), v.regex(/^https?:\/\/(?:www\.|m\.)?(?:youtube\.com|youtu\.be|youtube-nocookie\.com)\//i, 'Must be a YouTube URL (youtube.com or youtu.be)'));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { type SuggestionOptions } from '@tiptap/suggestion';
|
|
3
|
+
import { type UrlSchema } from './editor.schemas.js';
|
|
4
|
+
import type { SlashCommand } from './editor.types.js';
|
|
5
|
+
export interface UrlPromptOptions {
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
initialValue?: string;
|
|
10
|
+
confirmLabel?: string;
|
|
11
|
+
schema?: UrlSchema;
|
|
12
|
+
}
|
|
13
|
+
interface SlashCommandsContext {
|
|
14
|
+
image?: boolean;
|
|
15
|
+
tables?: boolean;
|
|
16
|
+
youtube?: boolean;
|
|
17
|
+
promptUrl?: (opts: UrlPromptOptions) => Promise<string | null>;
|
|
18
|
+
}
|
|
19
|
+
export declare function buildDefaultSlashCommands(ctx?: SlashCommandsContext): SlashCommand[];
|
|
20
|
+
interface SlashExtensionOptions {
|
|
21
|
+
suggestion: Partial<SuggestionOptions>;
|
|
22
|
+
}
|
|
23
|
+
export declare const SlashCommandsExtension: Extension<SlashExtensionOptions, any>;
|
|
24
|
+
export declare function buildSlashExtension(commands: SlashCommand[], trigger?: string): Extension;
|
|
25
|
+
export {};
|