@peteai/presentation-editor 0.0.1
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/README.md +58 -0
- package/dist/components/presentation-editor/app.css +12 -0
- package/dist/components/presentation-editor/cognition-slides.d.ts +56 -0
- package/dist/components/presentation-editor/cognition-slides.js +182 -0
- package/dist/components/presentation-editor/cursor-tooltip.svelte +29 -0
- package/dist/components/presentation-editor/cursor-tooltip.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/dragged.svelte +31 -0
- package/dist/components/presentation-editor/dragged.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/header.svelte +66 -0
- package/dist/components/presentation-editor/header.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/index.d.ts +2 -0
- package/dist/components/presentation-editor/index.js +2 -0
- package/dist/components/presentation-editor/layers/active-background-border.svelte +16 -0
- package/dist/components/presentation-editor/layers/active-background-border.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/layers/active-layer-border.svelte +30 -0
- package/dist/components/presentation-editor/layers/active-layer-border.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/buttons/border-button/border-button.svelte +231 -0
- package/dist/components/presentation-editor/layers/buttons/border-button/border-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/buttons/border-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/buttons/border-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/corner-radius-button.svelte +88 -0
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/corner-radius-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/buttons/flip-button/flip-button.svelte +39 -0
- package/dist/components/presentation-editor/layers/buttons/flip-button/flip-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/buttons/flip-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/buttons/flip-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/buttons/opacity-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/buttons/opacity-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/buttons/opacity-button/opacity-button.svelte +93 -0
- package/dist/components/presentation-editor/layers/buttons/opacity-button/opacity-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/corner-scale-control.svelte +179 -0
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/corner-scale-control.svelte.d.ts +184 -0
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/index.js +4 -0
- package/dist/components/presentation-editor/layers/controls/rotate-control/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/controls/rotate-control/index.js +4 -0
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte +105 -0
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/controls/side-resize-control/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/controls/side-resize-control/index.js +4 -0
- package/dist/components/presentation-editor/layers/controls/side-resize-control/side-resize-control.svelte +220 -0
- package/dist/components/presentation-editor/layers/controls/side-resize-control/side-resize-control.svelte.d.ts +215 -0
- package/dist/components/presentation-editor/layers/controls/side-scale-control/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/controls/side-scale-control/index.js +4 -0
- package/dist/components/presentation-editor/layers/controls/side-scale-control/side-scale-control.svelte +141 -0
- package/dist/components/presentation-editor/layers/controls/side-scale-control/side-scale-control.svelte.d.ts +114 -0
- package/dist/components/presentation-editor/layers/hovered-layer.svelte +34 -0
- package/dist/components/presentation-editor/layers/hovered-layer.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/index.d.ts +10 -0
- package/dist/components/presentation-editor/layers/index.js +22 -0
- package/dist/components/presentation-editor/layers/layer-button.svelte +38 -0
- package/dist/components/presentation-editor/layers/layer-button.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/layer-thumb-wrapper.svelte +36 -0
- package/dist/components/presentation-editor/layers/layer-thumb-wrapper.svelte.d.ts +15 -0
- package/dist/components/presentation-editor/layers/layer-wrapper.svelte +288 -0
- package/dist/components/presentation-editor/layers/layer-wrapper.svelte.d.ts +10 -0
- package/dist/components/presentation-editor/layers/types/background/background-content.svelte +11 -0
- package/dist/components/presentation-editor/layers/types/background/background-content.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte +81 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte +12 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer.svelte +103 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/background/index.d.ts +5 -0
- package/dist/components/presentation-editor/layers/types/background/index.js +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/alignment-button.svelte +45 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/alignment-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte +19 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/case-button.svelte +37 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/case-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/color-button.svelte +88 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/color-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/font-size-button.svelte +132 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/font-size-button.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte +19 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte +37 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/strikethrough-button.svelte +19 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/strikethrough-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/underline-button.svelte +20 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/underline-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/editor/Editor.d.ts +4 -0
- package/dist/components/presentation-editor/layers/types/html/editor/Editor.js +4 -0
- package/dist/components/presentation-editor/layers/types/html/editor/createEditor.d.ts +5 -0
- package/dist/components/presentation-editor/layers/types/html/editor/createEditor.js +18 -0
- package/dist/components/presentation-editor/layers/types/html/editor/editor-content.svelte +60 -0
- package/dist/components/presentation-editor/layers/types/html/editor/editor-content.svelte.d.ts +5 -0
- package/dist/components/presentation-editor/layers/types/html/editor/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/editor/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/editor/types.d.ts +10 -0
- package/dist/components/presentation-editor/layers/types/html/editor/types.js +1 -0
- package/dist/components/presentation-editor/layers/types/html/editor.css +7 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/font-size.d.ts +20 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/font-size.js +44 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/line-height/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/line-height/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/line-height/line-height.d.ts +22 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/line-height/line-height.js +44 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/selection/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/selection/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/selection/selection.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/selection/selection.js +30 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/text-transform/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/text-transform/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/text-transform/text-transform.d.ts +20 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/text-transform/text-transform.js +50 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.d.ts +47 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.js +74 -0
- package/dist/components/presentation-editor/layers/types/html/html-content.svelte +21 -0
- package/dist/components/presentation-editor/layers/types/html/html-content.svelte.d.ts +5 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-active.svelte +159 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-active.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-buttons.svelte +42 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-buttons.svelte.d.ts +10 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-thumb.svelte +24 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-thumb.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte +97 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/index.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/index.js +58 -0
- package/dist/components/presentation-editor/layers/types/image/image-content.svelte +96 -0
- package/dist/components/presentation-editor/layers/types/image/image-content.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer-active.svelte +39 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer-active.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte +21 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer-thumb.svelte +13 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer-thumb.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer.svelte +80 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/image/index.d.ts +5 -0
- package/dist/components/presentation-editor/layers/types/image/index.js +5 -0
- package/dist/components/presentation-editor/layers/utils.d.ts +32 -0
- package/dist/components/presentation-editor/layers/utils.js +92 -0
- package/dist/components/presentation-editor/presentation-editor.svelte +336 -0
- package/dist/components/presentation-editor/presentation-editor.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/presentation-editor.svelte.js +352 -0
- package/dist/components/presentation-editor/sidebar/images-library.svelte +108 -0
- package/dist/components/presentation-editor/sidebar/images-library.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/layers.svelte +94 -0
- package/dist/components/presentation-editor/sidebar/layers.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/sidebar/sidebar.svelte +20 -0
- package/dist/components/presentation-editor/sidebar/sidebar.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/uploads-image.svelte +64 -0
- package/dist/components/presentation-editor/sidebar/uploads-image.svelte.d.ts +5 -0
- package/dist/components/presentation-editor/slide-editor.svelte +106 -0
- package/dist/components/presentation-editor/slide-editor.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/slide-inner.svelte +53 -0
- package/dist/components/presentation-editor/slide-inner.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-delete-button.svelte +32 -0
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-delete-button.svelte.d.ts +10 -0
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-duplicate-button.svelte +34 -0
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-duplicate-button.svelte.d.ts +10 -0
- package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte +134 -0
- package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte.d.ts +11 -0
- package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte +100 -0
- package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/snapping-guides.svelte +41 -0
- package/dist/components/presentation-editor/snapping-guides.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/types.d.ts +118 -0
- package/dist/components/presentation-editor/types.js +1 -0
- package/dist/components/presentation-editor/utils.d.ts +5 -0
- package/dist/components/presentation-editor/utils.js +348 -0
- package/dist/components/ui/button/button.svelte +94 -0
- package/dist/components/ui/button/button.svelte.d.ts +155 -0
- package/dist/components/ui/button/index.d.ts +2 -0
- package/dist/components/ui/button/index.js +4 -0
- package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte +40 -0
- package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte.d.ts +8 -0
- package/dist/components/ui/context-menu/context-menu-content.svelte +24 -0
- package/dist/components/ui/context-menu/context-menu-content.svelte.d.ts +7 -0
- package/dist/components/ui/context-menu/context-menu-group-heading.svelte +19 -0
- package/dist/components/ui/context-menu/context-menu-group-heading.svelte.d.ts +7 -0
- package/dist/components/ui/context-menu/context-menu-item.svelte +23 -0
- package/dist/components/ui/context-menu/context-menu-item.svelte.d.ts +7 -0
- package/dist/components/ui/context-menu/context-menu-radio-item.svelte +30 -0
- package/dist/components/ui/context-menu/context-menu-radio-item.svelte.d.ts +4 -0
- package/dist/components/ui/context-menu/context-menu-separator.svelte +16 -0
- package/dist/components/ui/context-menu/context-menu-separator.svelte.d.ts +4 -0
- package/dist/components/ui/context-menu/context-menu-shortcut.svelte +20 -0
- package/dist/components/ui/context-menu/context-menu-shortcut.svelte.d.ts +5 -0
- package/dist/components/ui/context-menu/context-menu-sub-content.svelte +19 -0
- package/dist/components/ui/context-menu/context-menu-sub-content.svelte.d.ts +4 -0
- package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +28 -0
- package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte.d.ts +7 -0
- package/dist/components/ui/context-menu/index.d.ts +16 -0
- package/dist/components/ui/context-menu/index.js +18 -0
- package/dist/components/ui/dialog/dialog-content.svelte +38 -0
- package/dist/components/ui/dialog/dialog-content.svelte.d.ts +9 -0
- package/dist/components/ui/dialog/dialog-description.svelte +16 -0
- package/dist/components/ui/dialog/dialog-description.svelte.d.ts +4 -0
- package/dist/components/ui/dialog/dialog-footer.svelte +20 -0
- package/dist/components/ui/dialog/dialog-footer.svelte.d.ts +5 -0
- package/dist/components/ui/dialog/dialog-header.svelte +20 -0
- package/dist/components/ui/dialog/dialog-header.svelte.d.ts +5 -0
- package/dist/components/ui/dialog/dialog-overlay.svelte +19 -0
- package/dist/components/ui/dialog/dialog-overlay.svelte.d.ts +4 -0
- package/dist/components/ui/dialog/dialog-title.svelte +16 -0
- package/dist/components/ui/dialog/dialog-title.svelte.d.ts +4 -0
- package/dist/components/ui/dialog/index.d.ts +12 -0
- package/dist/components/ui/dialog/index.js +14 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +40 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +8 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +21 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +4 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +19 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts +7 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +23 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts +7 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte +23 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte.d.ts +8 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +30 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +4 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte +16 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte.d.ts +4 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +20 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +5 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +19 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +4 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +28 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +7 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +25 -0
- package/dist/components/ui/dropdown-menu/index.js +17 -0
- package/dist/components/ui/input/index.d.ts +2 -0
- package/dist/components/ui/input/index.js +4 -0
- package/dist/components/ui/input/input.svelte +22 -0
- package/dist/components/ui/input/input.svelte.d.ts +5 -0
- package/dist/components/ui/label/index.d.ts +2 -0
- package/dist/components/ui/label/index.js +4 -0
- package/dist/components/ui/label/label.svelte +19 -0
- package/dist/components/ui/label/label.svelte.d.ts +4 -0
- package/dist/components/ui/popover/index.d.ts +6 -0
- package/dist/components/ui/popover/index.js +8 -0
- package/dist/components/ui/popover/popover-content.svelte +25 -0
- package/dist/components/ui/popover/popover-content.svelte.d.ts +4 -0
- package/dist/components/ui/scroll-area/index.d.ts +3 -0
- package/dist/components/ui/scroll-area/index.js +5 -0
- package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +29 -0
- package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte.d.ts +4 -0
- package/dist/components/ui/scroll-area/scroll-area.svelte +34 -0
- package/dist/components/ui/scroll-area/scroll-area.svelte.d.ts +10 -0
- package/dist/components/ui/separator/index.d.ts +2 -0
- package/dist/components/ui/separator/index.js +4 -0
- package/dist/components/ui/separator/separator.svelte +22 -0
- package/dist/components/ui/separator/separator.svelte.d.ts +4 -0
- package/dist/components/ui/slider/index.d.ts +2 -0
- package/dist/components/ui/slider/index.js +4 -0
- package/dist/components/ui/slider/slider.svelte +34 -0
- package/dist/components/ui/slider/slider.svelte.d.ts +4 -0
- package/dist/components/ui/toggle/index.d.ts +3 -0
- package/dist/components/ui/toggle/index.js +5 -0
- package/dist/components/ui/toggle/toggle.svelte +51 -0
- package/dist/components/ui/toggle/toggle.svelte.d.ts +90 -0
- package/dist/components/ui/tooltip/index.d.ts +6 -0
- package/dist/components/ui/tooltip/index.js +8 -0
- package/dist/components/ui/tooltip/tooltip-content.svelte +21 -0
- package/dist/components/ui/tooltip/tooltip-content.svelte.d.ts +4 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +8 -0
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.js +154 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +31 -0
- package/package.json +99 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type JSONContent } from '@tiptap/core';
|
|
2
|
+
export type ActiveSidebar = 'images' | 'layers' | null;
|
|
3
|
+
export type Image = {
|
|
4
|
+
id: string;
|
|
5
|
+
src: string;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
export type Dragged = {
|
|
10
|
+
id: string;
|
|
11
|
+
hidden: boolean;
|
|
12
|
+
sticky: boolean;
|
|
13
|
+
image: Image;
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
offsetX: number;
|
|
17
|
+
offsetY: number;
|
|
18
|
+
initialScale: number;
|
|
19
|
+
scale: number | null;
|
|
20
|
+
};
|
|
21
|
+
export type CursorTooltip = {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
text: string;
|
|
25
|
+
};
|
|
26
|
+
interface BaseLayer {
|
|
27
|
+
id: string;
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
rotate: number | null;
|
|
33
|
+
opacity: number | null;
|
|
34
|
+
sortOrder: number;
|
|
35
|
+
}
|
|
36
|
+
export interface HtmlLayer extends BaseLayer {
|
|
37
|
+
type: 'html';
|
|
38
|
+
scale: number | null;
|
|
39
|
+
html: JSONContent;
|
|
40
|
+
}
|
|
41
|
+
export type LayerBorder = {
|
|
42
|
+
borderStyle: 'solid' | 'dashed' | 'dotted' | null;
|
|
43
|
+
borderWidth: number | null;
|
|
44
|
+
borderColor: string | null;
|
|
45
|
+
};
|
|
46
|
+
export interface ImageLayer extends BaseLayer, LayerBorder {
|
|
47
|
+
type: 'image';
|
|
48
|
+
scale: number | null;
|
|
49
|
+
image: Image;
|
|
50
|
+
offsetX: number | null;
|
|
51
|
+
offsetY: number | null;
|
|
52
|
+
cornerRadius: number | null;
|
|
53
|
+
flipX: boolean;
|
|
54
|
+
flipY: boolean;
|
|
55
|
+
}
|
|
56
|
+
export type Layer = HtmlLayer | ImageLayer;
|
|
57
|
+
export type Slide = {
|
|
58
|
+
id: string;
|
|
59
|
+
backgroundColor: string | null;
|
|
60
|
+
layers: Layer[];
|
|
61
|
+
sortOrder: number;
|
|
62
|
+
};
|
|
63
|
+
export type ActiveAction = {
|
|
64
|
+
type: string;
|
|
65
|
+
cursor?: string;
|
|
66
|
+
tooltip?: CursorTooltip | null;
|
|
67
|
+
clientX: number;
|
|
68
|
+
clientY: number;
|
|
69
|
+
layer: Layer;
|
|
70
|
+
};
|
|
71
|
+
export type SlideAddAction = {
|
|
72
|
+
type: 'slideAdd';
|
|
73
|
+
slide: Slide;
|
|
74
|
+
};
|
|
75
|
+
export type SlideRemoveAction = {
|
|
76
|
+
type: 'slideRemove';
|
|
77
|
+
slide: Slide;
|
|
78
|
+
newSlide?: Slide;
|
|
79
|
+
};
|
|
80
|
+
export type LayerAddAction = {
|
|
81
|
+
type: 'layerAdd' | 'layerRemove';
|
|
82
|
+
layer: Layer;
|
|
83
|
+
};
|
|
84
|
+
export type SlideChangesAction = {
|
|
85
|
+
type: 'slide';
|
|
86
|
+
undo: object;
|
|
87
|
+
redo: object;
|
|
88
|
+
};
|
|
89
|
+
export type LayerChangesAction = {
|
|
90
|
+
type: 'layer';
|
|
91
|
+
layer: {
|
|
92
|
+
id: string;
|
|
93
|
+
type: string;
|
|
94
|
+
};
|
|
95
|
+
undo: object;
|
|
96
|
+
redo: object;
|
|
97
|
+
};
|
|
98
|
+
export type Action = SlideAddAction | SlideRemoveAction | LayerAddAction | SlideChangesAction | LayerChangesAction;
|
|
99
|
+
export type HistoryAction = Action & {
|
|
100
|
+
slideId: string;
|
|
101
|
+
};
|
|
102
|
+
interface BaseLayerGuide {
|
|
103
|
+
id: string;
|
|
104
|
+
type: string;
|
|
105
|
+
style: 'solid' | 'dashed' | 'dotted';
|
|
106
|
+
}
|
|
107
|
+
export interface LineLayerGuide extends BaseLayerGuide {
|
|
108
|
+
type: 'horizontal' | 'vertical';
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
length: number;
|
|
112
|
+
}
|
|
113
|
+
export interface BoxLayerGuide extends BaseLayerGuide {
|
|
114
|
+
type: 'box';
|
|
115
|
+
inset: number;
|
|
116
|
+
}
|
|
117
|
+
export type ActiveLayerGuide = LineLayerGuide | BoxLayerGuide;
|
|
118
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {} from '@tiptap/core';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Slide } from './types.js';
|
|
2
|
+
export declare const arraysEqual: (a: unknown[], b: unknown[]) => boolean;
|
|
3
|
+
export declare const checkImage: (url: string) => Promise<HTMLImageElement>;
|
|
4
|
+
export declare const getSlides: () => Slide[];
|
|
5
|
+
export declare const cognitionSlideToJson: (slide: any) => Slide;
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import uniqid from 'uniqid';
|
|
2
|
+
export const arraysEqual = (a, b) => {
|
|
3
|
+
// Check if the arrays have the same length
|
|
4
|
+
if (a.length !== b.length) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
// Compare each element of the arrays
|
|
8
|
+
for (let i = 0; i < a.length; i++) {
|
|
9
|
+
if (a[i] !== b[i]) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
// If all elements are equal, return true
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
16
|
+
export const checkImage = (url) => new Promise((resolve, reject) => {
|
|
17
|
+
// check that is a valid url
|
|
18
|
+
// then if valid url
|
|
19
|
+
const image = new Image();
|
|
20
|
+
image.crossOrigin = 'anonymous';
|
|
21
|
+
image.src = url;
|
|
22
|
+
image.onload = () => resolve(image);
|
|
23
|
+
image.onerror = reject;
|
|
24
|
+
});
|
|
25
|
+
export const getSlides = () => [
|
|
26
|
+
{
|
|
27
|
+
id: uniqid(),
|
|
28
|
+
backgroundColor: '#5ce1e6',
|
|
29
|
+
sortOrder: 1,
|
|
30
|
+
layers: [
|
|
31
|
+
{
|
|
32
|
+
id: uniqid(),
|
|
33
|
+
x: 200,
|
|
34
|
+
y: 250,
|
|
35
|
+
width: 1400,
|
|
36
|
+
height: 200,
|
|
37
|
+
type: 'html',
|
|
38
|
+
sortOrder: 1,
|
|
39
|
+
scale: null,
|
|
40
|
+
rotate: null,
|
|
41
|
+
opacity: null,
|
|
42
|
+
html: {
|
|
43
|
+
type: 'doc',
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: 'bulletList',
|
|
47
|
+
attrs: {
|
|
48
|
+
fontSize: 80,
|
|
49
|
+
},
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: 'listItem',
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'paragraph',
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: 'text',
|
|
59
|
+
text: 'first',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'listItem',
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: 'paragraph',
|
|
70
|
+
content: [
|
|
71
|
+
{
|
|
72
|
+
type: 'text',
|
|
73
|
+
text: 'second',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'listItem',
|
|
81
|
+
content: [
|
|
82
|
+
{
|
|
83
|
+
type: 'paragraph',
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: 'text',
|
|
87
|
+
text: 'third',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: 'paragraph',
|
|
97
|
+
attrs: {
|
|
98
|
+
fontSize: 120,
|
|
99
|
+
},
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: 'text',
|
|
103
|
+
text: 'Second ',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: 'text',
|
|
107
|
+
marks: [
|
|
108
|
+
{
|
|
109
|
+
type: 'textStyle',
|
|
110
|
+
attrs: {
|
|
111
|
+
color: '#b91c1c',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
text: 'text layer',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'text',
|
|
119
|
+
text: ' with some text to check overlapping!',
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: uniqid(),
|
|
128
|
+
x: 200,
|
|
129
|
+
y: 300,
|
|
130
|
+
width: 400,
|
|
131
|
+
height: 200,
|
|
132
|
+
type: 'html',
|
|
133
|
+
sortOrder: 2,
|
|
134
|
+
scale: 2,
|
|
135
|
+
rotate: 45,
|
|
136
|
+
opacity: null,
|
|
137
|
+
html: {
|
|
138
|
+
type: 'doc',
|
|
139
|
+
content: [
|
|
140
|
+
{
|
|
141
|
+
type: 'paragraph',
|
|
142
|
+
attrs: {
|
|
143
|
+
color: '#ff914d',
|
|
144
|
+
lineHeight: 1.2,
|
|
145
|
+
fontSize: 112,
|
|
146
|
+
textAlign: 'center',
|
|
147
|
+
textTransform: 'uppercase',
|
|
148
|
+
},
|
|
149
|
+
content: [
|
|
150
|
+
{
|
|
151
|
+
type: 'text',
|
|
152
|
+
text: 'Some text',
|
|
153
|
+
marks: [{ type: 'bold' }],
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: uniqid(),
|
|
162
|
+
x: 1100,
|
|
163
|
+
y: 100,
|
|
164
|
+
width: 600,
|
|
165
|
+
height: 200,
|
|
166
|
+
type: 'html',
|
|
167
|
+
sortOrder: 3,
|
|
168
|
+
scale: null,
|
|
169
|
+
rotate: null,
|
|
170
|
+
opacity: null,
|
|
171
|
+
html: {
|
|
172
|
+
type: 'doc',
|
|
173
|
+
content: [
|
|
174
|
+
{
|
|
175
|
+
type: 'paragraph',
|
|
176
|
+
attrs: {
|
|
177
|
+
fontSize: 128,
|
|
178
|
+
textTransform: 'uppercase',
|
|
179
|
+
},
|
|
180
|
+
content: [
|
|
181
|
+
{
|
|
182
|
+
type: 'text',
|
|
183
|
+
text: 'Another one',
|
|
184
|
+
marks: [{ type: 'bold' }],
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
type: 'paragraph',
|
|
190
|
+
attrs: {
|
|
191
|
+
fontSize: 64,
|
|
192
|
+
textAlign: 'right',
|
|
193
|
+
},
|
|
194
|
+
content: [
|
|
195
|
+
{
|
|
196
|
+
type: 'text',
|
|
197
|
+
text: 'Second paragraph',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
];
|
|
207
|
+
const buildParagraphContent = ({ text, fontSize = 40, textAlign, }) => ({
|
|
208
|
+
type: 'paragraph',
|
|
209
|
+
attrs: {
|
|
210
|
+
...(fontSize && { fontSize }),
|
|
211
|
+
...(textAlign && { textAlign }),
|
|
212
|
+
},
|
|
213
|
+
content: [{ type: 'text', text }],
|
|
214
|
+
});
|
|
215
|
+
const buildBulletListContent = ({ bullets }) => ({
|
|
216
|
+
type: 'bulletList',
|
|
217
|
+
content: bullets.map((bullet) => ({
|
|
218
|
+
type: 'listItem',
|
|
219
|
+
attrs: {
|
|
220
|
+
fontSize: 40,
|
|
221
|
+
},
|
|
222
|
+
content: [buildParagraphContent({ text: bullet })],
|
|
223
|
+
})),
|
|
224
|
+
});
|
|
225
|
+
const buildHeadlineLayer = ({ sortOrder, text, isTitle, withSubheadline, }) => ({
|
|
226
|
+
id: uniqid(),
|
|
227
|
+
x: 200,
|
|
228
|
+
y: isTitle ? (withSubheadline ? 300 : 450) : 50,
|
|
229
|
+
width: 1520,
|
|
230
|
+
height: 200,
|
|
231
|
+
type: 'html',
|
|
232
|
+
sortOrder,
|
|
233
|
+
scale: null,
|
|
234
|
+
rotate: null,
|
|
235
|
+
opacity: null,
|
|
236
|
+
html: {
|
|
237
|
+
type: 'doc',
|
|
238
|
+
content: [
|
|
239
|
+
{
|
|
240
|
+
type: 'paragraph',
|
|
241
|
+
attrs: {
|
|
242
|
+
fontSize: isTitle ? 120 : 74.6666666667,
|
|
243
|
+
textAlign: 'center',
|
|
244
|
+
},
|
|
245
|
+
content: [{ type: 'text', text, marks: [{ type: 'bold' }] }],
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
const buildSubheadlineLayer = ({ sortOrder, text, }) => ({
|
|
251
|
+
id: uniqid(),
|
|
252
|
+
x: 400,
|
|
253
|
+
y: 500,
|
|
254
|
+
width: 1120,
|
|
255
|
+
height: 200,
|
|
256
|
+
type: 'html',
|
|
257
|
+
sortOrder,
|
|
258
|
+
scale: null,
|
|
259
|
+
rotate: null,
|
|
260
|
+
opacity: null,
|
|
261
|
+
html: {
|
|
262
|
+
type: 'doc',
|
|
263
|
+
content: [buildParagraphContent({ text, fontSize: 80, textAlign: 'center' })],
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
const buildHtmlLayerParagraphFields = ({ text }) => ({
|
|
267
|
+
html: {
|
|
268
|
+
type: 'doc',
|
|
269
|
+
content: [buildParagraphContent({ text })],
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
const buildHtmlLayerBulletsFields = ({ bullets }) => ({
|
|
273
|
+
html: {
|
|
274
|
+
type: 'doc',
|
|
275
|
+
content: [buildBulletListContent({ bullets })],
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
const buildImageLayerFields = (image) => ({
|
|
279
|
+
image,
|
|
280
|
+
});
|
|
281
|
+
const buildColumnLayer = ({ sortOrder, slide, isRight, }) => {
|
|
282
|
+
const type = slide[isRight ? 'right_type' : 'left_type'];
|
|
283
|
+
return {
|
|
284
|
+
id: uniqid(),
|
|
285
|
+
x: isRight ? 1020 : 100,
|
|
286
|
+
y: 220,
|
|
287
|
+
width: 800,
|
|
288
|
+
height: 800,
|
|
289
|
+
type: type === 'image' ? 'image' : 'html',
|
|
290
|
+
sortOrder,
|
|
291
|
+
scale: null,
|
|
292
|
+
rotate: null,
|
|
293
|
+
opacity: null,
|
|
294
|
+
...(type === 'image'
|
|
295
|
+
? buildImageLayerFields(slide[isRight ? 'right_image' : 'left_image'])
|
|
296
|
+
: type === 'bullets'
|
|
297
|
+
? buildHtmlLayerBulletsFields({
|
|
298
|
+
bullets: slide[isRight ? 'right_bullets' : 'left_bullets'],
|
|
299
|
+
})
|
|
300
|
+
: buildHtmlLayerParagraphFields({ text: slide[isRight ? 'right_text' : 'left_text'] })),
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
let slideSortOrder = 1;
|
|
304
|
+
export const cognitionSlideToJson = (slide) => {
|
|
305
|
+
let sortOrder = 1;
|
|
306
|
+
const layers = [];
|
|
307
|
+
if (slide.type === 'title') {
|
|
308
|
+
layers.push(buildHeadlineLayer({
|
|
309
|
+
sortOrder: sortOrder++,
|
|
310
|
+
text: slide.headline,
|
|
311
|
+
isTitle: true,
|
|
312
|
+
withSubheadline: !!slide.subheadline,
|
|
313
|
+
}));
|
|
314
|
+
if (slide.subheadline) {
|
|
315
|
+
layers.push(buildSubheadlineLayer({ sortOrder: sortOrder++, text: slide.subheadline }));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
else if (slide.type === 'columns') {
|
|
319
|
+
layers.push(buildHeadlineLayer({ sortOrder: sortOrder++, text: slide.headline }));
|
|
320
|
+
layers.push(buildColumnLayer({ sortOrder: sortOrder++, slide }));
|
|
321
|
+
layers.push(buildColumnLayer({ sortOrder: sortOrder++, slide, isRight: true }));
|
|
322
|
+
}
|
|
323
|
+
else if (slide.type === 'bullets') {
|
|
324
|
+
layers.push(buildHeadlineLayer({ sortOrder: sortOrder++, text: slide.headline }));
|
|
325
|
+
layers.push({
|
|
326
|
+
id: uniqid(),
|
|
327
|
+
x: 560,
|
|
328
|
+
y: 220,
|
|
329
|
+
width: 800,
|
|
330
|
+
height: 800,
|
|
331
|
+
type: 'html',
|
|
332
|
+
sortOrder: sortOrder++,
|
|
333
|
+
scale: null,
|
|
334
|
+
rotate: null,
|
|
335
|
+
opacity: null,
|
|
336
|
+
html: {
|
|
337
|
+
type: 'doc',
|
|
338
|
+
content: [buildBulletListContent({ bullets: slide.bullets })],
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
return {
|
|
343
|
+
id: uniqid(),
|
|
344
|
+
sortOrder: slideSortOrder++,
|
|
345
|
+
backgroundColor: '#5ce1e6',
|
|
346
|
+
layers,
|
|
347
|
+
};
|
|
348
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { WithElementRef } from 'bits-ui';
|
|
3
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
4
|
+
import { type VariantProps, tv } from 'tailwind-variants';
|
|
5
|
+
|
|
6
|
+
export const buttonVariants = tv({
|
|
7
|
+
base: 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
8
|
+
// ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
12
|
+
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
|
13
|
+
outline: 'border-input bg-background hover:bg-accent hover:text-accent-foreground border',
|
|
14
|
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
15
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
16
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
default: 'h-10 px-4 py-2',
|
|
20
|
+
xs: 'h-8 rounded-md px-2',
|
|
21
|
+
sm: 'h-9 rounded-md px-3',
|
|
22
|
+
lg: 'h-11 rounded-md px-8',
|
|
23
|
+
icon: 'h-10 w-10',
|
|
24
|
+
'icon-xs': 'h-8 w-8',
|
|
25
|
+
},
|
|
26
|
+
active: {
|
|
27
|
+
true: '',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
compoundVariants: [
|
|
31
|
+
{
|
|
32
|
+
active: true,
|
|
33
|
+
variant: 'outline',
|
|
34
|
+
class: 'border-2 border-primary',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
active: true,
|
|
38
|
+
variant: 'ghost',
|
|
39
|
+
class: 'bg-primary/15 text-accent-foreground hover:bg-primary/15',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
variant: 'default',
|
|
44
|
+
size: 'default',
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>['variant'];
|
|
49
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>['size'];
|
|
50
|
+
export type ButtonActive = VariantProps<typeof buttonVariants>['active'];
|
|
51
|
+
|
|
52
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
|
|
53
|
+
WithElementRef<HTMLAnchorAttributes> & {
|
|
54
|
+
variant?: ButtonVariant;
|
|
55
|
+
size?: ButtonSize;
|
|
56
|
+
active?: ButtonActive;
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<script lang="ts">
|
|
61
|
+
import { cn } from '../../../utils.js';
|
|
62
|
+
|
|
63
|
+
let {
|
|
64
|
+
class: className,
|
|
65
|
+
variant = 'default',
|
|
66
|
+
size = 'default',
|
|
67
|
+
active = false,
|
|
68
|
+
ref = $bindable(null),
|
|
69
|
+
href = undefined,
|
|
70
|
+
type = 'button',
|
|
71
|
+
children,
|
|
72
|
+
...restProps
|
|
73
|
+
}: ButtonProps = $props();
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
{#if href}
|
|
77
|
+
<a
|
|
78
|
+
bind:this={ref}
|
|
79
|
+
class={cn(buttonVariants({ variant, size, active }), className)}
|
|
80
|
+
{href}
|
|
81
|
+
{...restProps}
|
|
82
|
+
>
|
|
83
|
+
{@render children?.()}
|
|
84
|
+
</a>
|
|
85
|
+
{:else}
|
|
86
|
+
<button
|
|
87
|
+
bind:this={ref}
|
|
88
|
+
class={cn(buttonVariants({ variant, size, active }), className)}
|
|
89
|
+
{type}
|
|
90
|
+
{...restProps}
|
|
91
|
+
>
|
|
92
|
+
{@render children?.()}
|
|
93
|
+
</button>
|
|
94
|
+
{/if}
|