@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,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getPresentationEditorContext } from '../presentation-editor.svelte.js';
|
|
3
|
+
import type { Layer } from '../types.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
layer: Layer | 'background';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { layer }: Props = $props();
|
|
10
|
+
|
|
11
|
+
const editor = getPresentationEditorContext();
|
|
12
|
+
|
|
13
|
+
let x = $derived(layer === 'background' ? 0 : layer.x * editor.zoom);
|
|
14
|
+
let y = $derived(layer === 'background' ? 0 : layer.y * editor.zoom);
|
|
15
|
+
let width = $derived(
|
|
16
|
+
(layer === 'background' ? editor.width : layer.width * (layer.scale || 1)) * editor.zoom,
|
|
17
|
+
);
|
|
18
|
+
let height = $derived(
|
|
19
|
+
(layer === 'background' ? editor.height : layer.height * (layer.scale || 1)) * editor.zoom,
|
|
20
|
+
);
|
|
21
|
+
let rotate = $derived(layer === 'background' ? 0 : layer.rotate || 0);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class="absolute"
|
|
26
|
+
style:width="{width}px"
|
|
27
|
+
style:height="{height}px"
|
|
28
|
+
style:transform={`translate(${x}px, ${y}px) rotate(${rotate}deg)`}
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
class="absolute -inset-px border-2 border-purple-500"
|
|
32
|
+
style:box-shadow="0 0 0 1px hsla(0, 0%, 100%, .07), inset 0 0 0 1px hsla(0, 0%, 100%, .07)"
|
|
33
|
+
></div>
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import LayerButton from './layer-button.svelte';
|
|
2
|
+
import LayerThumbWrapper from './layer-thumb-wrapper.svelte';
|
|
3
|
+
import LayerWrapper from './layer-wrapper.svelte';
|
|
4
|
+
import HoveredLayer from './hovered-layer.svelte';
|
|
5
|
+
import ActiveBackgroundBorder from './active-background-border.svelte';
|
|
6
|
+
import ActiveLayerBorder from './active-layer-border.svelte';
|
|
7
|
+
import { BackgroundLayerButtons, BackgroundLayer, BackgroundLayerThumb } from './types/background/index.js';
|
|
8
|
+
import { HtmlLayer, HtmlLayerActive, HtmlLayerButtons, HtmlLayerThumb } from './types/html/index.js';
|
|
9
|
+
import { ImageLayer, ImageLayerActive, ImageLayerButtons, ImageLayerThumb } from './types/image/index.js';
|
|
10
|
+
export { LayerButton, LayerThumbWrapper, LayerWrapper, BackgroundLayer, BackgroundLayerThumb, BackgroundLayerButtons, HtmlLayer, HtmlLayerThumb, HtmlLayerButtons, HtmlLayerActive, ImageLayer, ImageLayerThumb, ImageLayerButtons, ImageLayerActive, HoveredLayer, ActiveBackgroundBorder, ActiveLayerBorder, };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import LayerButton from './layer-button.svelte';
|
|
2
|
+
import LayerThumbWrapper from './layer-thumb-wrapper.svelte';
|
|
3
|
+
import LayerWrapper from './layer-wrapper.svelte';
|
|
4
|
+
import HoveredLayer from './hovered-layer.svelte';
|
|
5
|
+
import ActiveBackgroundBorder from './active-background-border.svelte';
|
|
6
|
+
import ActiveLayerBorder from './active-layer-border.svelte';
|
|
7
|
+
import { BackgroundLayerButtons, BackgroundLayer, BackgroundLayerThumb, } from './types/background/index.js';
|
|
8
|
+
import { HtmlLayer, HtmlLayerActive, HtmlLayerButtons, HtmlLayerThumb, } from './types/html/index.js';
|
|
9
|
+
import { ImageLayer, ImageLayerActive, ImageLayerButtons, ImageLayerThumb, } from './types/image/index.js';
|
|
10
|
+
export {
|
|
11
|
+
// layer buttons
|
|
12
|
+
LayerButton, LayerThumbWrapper,
|
|
13
|
+
// layers
|
|
14
|
+
LayerWrapper,
|
|
15
|
+
// background layer
|
|
16
|
+
BackgroundLayer, BackgroundLayerThumb, BackgroundLayerButtons,
|
|
17
|
+
// html layer
|
|
18
|
+
HtmlLayer, HtmlLayerThumb, HtmlLayerButtons, HtmlLayerActive,
|
|
19
|
+
//image layer
|
|
20
|
+
ImageLayer, ImageLayerThumb, ImageLayerButtons, ImageLayerActive,
|
|
21
|
+
// layers state
|
|
22
|
+
HoveredLayer, ActiveBackgroundBorder, ActiveLayerBorder, };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import GripVerticalIcon from 'lucide-svelte/icons/grip-vertical';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
import type { Layer } from '../types.js';
|
|
5
|
+
import { getPresentationEditorContext } from '../presentation-editor.svelte.js';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
layer?: Layer;
|
|
9
|
+
children?: import('svelte').Snippet;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { layer, children }: Props = $props();
|
|
13
|
+
|
|
14
|
+
const editor = getPresentationEditorContext();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="relative">
|
|
18
|
+
<button
|
|
19
|
+
onclick={() => (layer ? editor.setActiveLayer(layer) : editor.setActiveBackground(true))}
|
|
20
|
+
class={cn(
|
|
21
|
+
'flex w-full items-center justify-between rounded-md border-2 border-transparent p-2 outline-none',
|
|
22
|
+
{
|
|
23
|
+
'border-blue-500': layer ? editor.activeLayer?.id === layer.id : editor.activeBackground,
|
|
24
|
+
},
|
|
25
|
+
)}
|
|
26
|
+
style:background-color="rgba(53,71,90,.2)"
|
|
27
|
+
>
|
|
28
|
+
<div class="h-6 w-10 px-2">
|
|
29
|
+
{#if layer}
|
|
30
|
+
<GripVerticalIcon />
|
|
31
|
+
{/if}
|
|
32
|
+
</div>
|
|
33
|
+
<div class="relative flex h-8 w-48 items-center justify-center overflow-hidden rounded-sm">
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
</div>
|
|
36
|
+
<div class="h-6 w-6 p-2"></div>
|
|
37
|
+
</button>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Layer } from '../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer?: Layer;
|
|
4
|
+
children?: import('svelte').Snippet;
|
|
5
|
+
}
|
|
6
|
+
declare const LayerButton: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type LayerButton = ReturnType<typeof LayerButton>;
|
|
8
|
+
export default LayerButton;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Layer } from '../types.js';
|
|
3
|
+
|
|
4
|
+
type Thumb = { width: number; height: number };
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
layer: Layer;
|
|
8
|
+
thumb: Thumb | number;
|
|
9
|
+
children?: import('svelte').Snippet<[{ thumbScale: number }]>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { layer, thumb, children }: Props = $props();
|
|
13
|
+
|
|
14
|
+
const getThumbScale = (layer: Layer, thumb: Thumb) => {
|
|
15
|
+
const radians = layer.rotate ? layer.rotate * (Math.PI / 180) : 0;
|
|
16
|
+
const cos = Math.abs(Math.cos(radians));
|
|
17
|
+
const sin = Math.abs(Math.sin(radians));
|
|
18
|
+
|
|
19
|
+
const width = layer.width * scale * cos + layer.height * scale * sin;
|
|
20
|
+
const height = layer.width * scale * sin + layer.height * scale * cos;
|
|
21
|
+
|
|
22
|
+
return Math.min(thumb.width / width, thumb.height / height);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let scale = $derived(layer.scale || 1);
|
|
26
|
+
let thumbScale = $derived(typeof thumb === 'object' ? getThumbScale(layer, thumb) : thumb);
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
class="pointer-events-none absolute"
|
|
31
|
+
style:width="{layer.width * scale * thumbScale}px"
|
|
32
|
+
style:height="{layer.height * scale * thumbScale}px"
|
|
33
|
+
style:transform={`${typeof thumb !== 'object' ? `translate(${layer.x * thumbScale}px, ${layer.y * thumbScale}px)` : ''} rotate(${layer.rotate || 0}deg)`}
|
|
34
|
+
>
|
|
35
|
+
{@render children?.({ thumbScale })}
|
|
36
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Layer } from '../types.js';
|
|
2
|
+
type Thumb = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
interface Props {
|
|
7
|
+
layer: Layer;
|
|
8
|
+
thumb: Thumb | number;
|
|
9
|
+
children?: import('svelte').Snippet<[{
|
|
10
|
+
thumbScale: number;
|
|
11
|
+
}]>;
|
|
12
|
+
}
|
|
13
|
+
declare const LayerThumbWrapper: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type LayerThumbWrapper = ReturnType<typeof LayerThumbWrapper>;
|
|
15
|
+
export default LayerThumbWrapper;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ActiveLayerGuide, BoxLayerGuide, Layer, LineLayerGuide } from '../types.js';
|
|
3
|
+
import { getPresentationEditorContext } from '../presentation-editor.svelte.js';
|
|
4
|
+
import { calculateBoundingBox } from './utils.js';
|
|
5
|
+
import { generateId } from '../../../utils.js';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
layer: Layer;
|
|
9
|
+
hoveredLayer: Layer | 'background' | null;
|
|
10
|
+
activeLayerGuides: ActiveLayerGuide[];
|
|
11
|
+
children?: import('svelte').Snippet;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
layer = $bindable(),
|
|
16
|
+
hoveredLayer = $bindable(null),
|
|
17
|
+
activeLayerGuides = $bindable(),
|
|
18
|
+
children,
|
|
19
|
+
}: Props = $props();
|
|
20
|
+
|
|
21
|
+
const editor = getPresentationEditorContext();
|
|
22
|
+
|
|
23
|
+
let scale = $derived(layer.scale || 1);
|
|
24
|
+
let rotate = $derived(layer.rotate || 0);
|
|
25
|
+
|
|
26
|
+
const onMouseDown = () => {
|
|
27
|
+
console.log('mousedown', layer.id);
|
|
28
|
+
if (editor.activeLayer?.id !== layer.id || !editor.activeAction) {
|
|
29
|
+
editor.setActiveLayer(layer);
|
|
30
|
+
addEventListener('mousemove', onMouseMove);
|
|
31
|
+
addEventListener('mouseup', onMouseUp);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const onMouseUp = () => {
|
|
36
|
+
console.log('mouseup', layer.id);
|
|
37
|
+
if (editor.activeLayer?.id === layer.id && editor.activeAction?.type === 'drag') {
|
|
38
|
+
if (editor.checkIfLayerInBounds(layer)) {
|
|
39
|
+
editor.historyPush({
|
|
40
|
+
type: 'layer',
|
|
41
|
+
layer: { id: layer.id, type: layer.type },
|
|
42
|
+
undo: { x: editor.activeAction.layer.x, y: editor.activeAction.layer.y },
|
|
43
|
+
redo: { x: layer.x, y: layer.y },
|
|
44
|
+
});
|
|
45
|
+
editor.activeAction = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
activeLayerGuides = [];
|
|
49
|
+
removeEventListener('mousemove', onMouseMove);
|
|
50
|
+
removeEventListener('mouseup', onMouseUp);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const boxInset = Math.round(Math.min(editor.width, editor.height) / 10);
|
|
54
|
+
const paddingGuide: BoxLayerGuide = {
|
|
55
|
+
id: generateId(),
|
|
56
|
+
type: 'box',
|
|
57
|
+
style: 'solid',
|
|
58
|
+
inset: boxInset,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const verticalPositions = [0, editor.width / 2, editor.width];
|
|
62
|
+
const horizontalPositions = [0, editor.height / 2, editor.height];
|
|
63
|
+
const edgeGuides: LineLayerGuide[] = [
|
|
64
|
+
...verticalPositions.map(
|
|
65
|
+
(x): LineLayerGuide => ({
|
|
66
|
+
id: generateId(),
|
|
67
|
+
type: 'vertical',
|
|
68
|
+
style: 'solid',
|
|
69
|
+
x: x,
|
|
70
|
+
y: 0,
|
|
71
|
+
length: editor.height,
|
|
72
|
+
}),
|
|
73
|
+
),
|
|
74
|
+
...horizontalPositions.map(
|
|
75
|
+
(y): LineLayerGuide => ({
|
|
76
|
+
id: generateId(),
|
|
77
|
+
type: 'horizontal',
|
|
78
|
+
style: 'solid',
|
|
79
|
+
x: 0,
|
|
80
|
+
y: y,
|
|
81
|
+
length: editor.width,
|
|
82
|
+
}),
|
|
83
|
+
),
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
let snappingGrid: LineLayerGuide[][] = [];
|
|
87
|
+
const buildSnappingGrid = () =>
|
|
88
|
+
editor.activeSlide.layers
|
|
89
|
+
.filter((l) => l.id !== layer.id)
|
|
90
|
+
.map((l) => calculateBoundingBox(l))
|
|
91
|
+
.map(({ x, y, width, height }) => {
|
|
92
|
+
const verticalPositions = [x, x + width / 2, x + width];
|
|
93
|
+
const horizontalPositions = [y, y + height / 2, y + height];
|
|
94
|
+
|
|
95
|
+
return [
|
|
96
|
+
...verticalPositions.map(
|
|
97
|
+
(xPos): LineLayerGuide => ({
|
|
98
|
+
id: generateId(),
|
|
99
|
+
type: 'vertical',
|
|
100
|
+
style: 'dotted',
|
|
101
|
+
x: xPos,
|
|
102
|
+
y,
|
|
103
|
+
length: height,
|
|
104
|
+
}),
|
|
105
|
+
),
|
|
106
|
+
...horizontalPositions.map(
|
|
107
|
+
(yPos): LineLayerGuide => ({
|
|
108
|
+
id: generateId(),
|
|
109
|
+
type: 'horizontal',
|
|
110
|
+
style: 'dotted',
|
|
111
|
+
x,
|
|
112
|
+
y: yPos,
|
|
113
|
+
length: width,
|
|
114
|
+
}),
|
|
115
|
+
),
|
|
116
|
+
];
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const onMouseMove = (e: MouseEvent) => {
|
|
120
|
+
console.log('mousemove', layer.id);
|
|
121
|
+
if (editor.activeLayer?.id === layer.id) {
|
|
122
|
+
if (!editor.activeAction) {
|
|
123
|
+
editor.activeAction = {
|
|
124
|
+
type: 'drag',
|
|
125
|
+
cursor: 'cursor-move',
|
|
126
|
+
clientX: e.clientX,
|
|
127
|
+
clientY: e.clientY,
|
|
128
|
+
layer: { ...layer },
|
|
129
|
+
};
|
|
130
|
+
snappingGrid = buildSnappingGrid();
|
|
131
|
+
}
|
|
132
|
+
if (editor.activeAction.type === 'drag') {
|
|
133
|
+
let x =
|
|
134
|
+
editor.activeAction.layer.x + (e.clientX - editor.activeAction.clientX) / editor.zoom;
|
|
135
|
+
let y =
|
|
136
|
+
editor.activeAction.layer.y + (e.clientY - editor.activeAction.clientY) / editor.zoom;
|
|
137
|
+
|
|
138
|
+
const boundingBox = calculateBoundingBox({
|
|
139
|
+
x,
|
|
140
|
+
y,
|
|
141
|
+
width: layer.width,
|
|
142
|
+
height: layer.height,
|
|
143
|
+
rotate,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const guides: {
|
|
147
|
+
xDiff?: number;
|
|
148
|
+
yDiff?: number;
|
|
149
|
+
x?: number;
|
|
150
|
+
y?: number;
|
|
151
|
+
guide: ActiveLayerGuide;
|
|
152
|
+
}[] = [];
|
|
153
|
+
const snapping = 10;
|
|
154
|
+
let minXDiff: number = Infinity;
|
|
155
|
+
let minYDiff: number = Infinity;
|
|
156
|
+
const xSnappingCheck = (coords: number[]) => {
|
|
157
|
+
for (let i = 0; i < coords.length; i++) {
|
|
158
|
+
const coordsForCheck = [
|
|
159
|
+
coords[i],
|
|
160
|
+
coords[i] - boundingBox.width / 2,
|
|
161
|
+
coords[i] - boundingBox.width,
|
|
162
|
+
];
|
|
163
|
+
for (let j = 0; j < coordsForCheck.length; j++) {
|
|
164
|
+
const xDiff = Math.abs(boundingBox.x - coordsForCheck[j]);
|
|
165
|
+
if (xDiff <= snapping) {
|
|
166
|
+
if (xDiff < minXDiff) {
|
|
167
|
+
minXDiff = xDiff;
|
|
168
|
+
}
|
|
169
|
+
const x = coordsForCheck[j] + (boundingBox.width - layer.width) / 2;
|
|
170
|
+
return { xDiff, x };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const ySnappingCheck = (coords: number[]) => {
|
|
176
|
+
for (let i = 0; i < coords.length; i++) {
|
|
177
|
+
const coordsForCheck = [
|
|
178
|
+
coords[i],
|
|
179
|
+
coords[i] - boundingBox.height / 2,
|
|
180
|
+
coords[i] - boundingBox.height,
|
|
181
|
+
];
|
|
182
|
+
for (let j = 0; j < coordsForCheck.length; j++) {
|
|
183
|
+
const yDiff = Math.abs(boundingBox.y - coordsForCheck[j]);
|
|
184
|
+
if (yDiff <= snapping) {
|
|
185
|
+
if (yDiff < minYDiff) {
|
|
186
|
+
minYDiff = yDiff;
|
|
187
|
+
}
|
|
188
|
+
const y = coordsForCheck[j] + (boundingBox.height - layer.height) / 2;
|
|
189
|
+
return { yDiff, y };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const checkLineSnapping = (guide: ActiveLayerGuide) => {
|
|
195
|
+
if (guide.type === 'vertical') {
|
|
196
|
+
const xSnapping = xSnappingCheck([guide.x]);
|
|
197
|
+
if (typeof xSnapping === 'object') {
|
|
198
|
+
guides.push({ guide, ...xSnapping });
|
|
199
|
+
}
|
|
200
|
+
} else if (guide.type === 'horizontal') {
|
|
201
|
+
const ySnapping = ySnappingCheck([guide.y]);
|
|
202
|
+
if (typeof ySnapping === 'object') {
|
|
203
|
+
guides.push({ guide, ...ySnapping });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const checkBoxSnapping = (guide: BoxLayerGuide) => {
|
|
208
|
+
const xSnapping = xSnappingCheck([guide.inset, editor.width - guide.inset]);
|
|
209
|
+
const ySnapping = ySnappingCheck([guide.inset, editor.height - guide.inset]);
|
|
210
|
+
if (typeof xSnapping === 'object' || typeof ySnapping === 'object') {
|
|
211
|
+
guides.push({ guide, ...xSnapping, ...ySnapping });
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// slide padding
|
|
216
|
+
checkBoxSnapping(paddingGuide);
|
|
217
|
+
|
|
218
|
+
// slide edges
|
|
219
|
+
edgeGuides.forEach(checkLineSnapping);
|
|
220
|
+
|
|
221
|
+
// rest of the slides
|
|
222
|
+
snappingGrid.forEach((layerGuides) => {
|
|
223
|
+
layerGuides.forEach(checkLineSnapping);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
const guidesToSnap = guides.filter(
|
|
227
|
+
({ xDiff, yDiff }) => xDiff === minXDiff || yDiff === minYDiff,
|
|
228
|
+
);
|
|
229
|
+
guidesToSnap.forEach((guide) => {
|
|
230
|
+
if (guide.x !== undefined) {
|
|
231
|
+
x = guide.x;
|
|
232
|
+
}
|
|
233
|
+
if (guide.y !== undefined) {
|
|
234
|
+
y = guide.y;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
activeLayerGuides = guidesToSnap.map(({ guide }) => {
|
|
239
|
+
if (guide.type === 'horizontal') {
|
|
240
|
+
const x = Math.min(boundingBox.x, guide.x);
|
|
241
|
+
const length = Math.max(boundingBox.x + boundingBox.width, guide.x + guide.length) - x;
|
|
242
|
+
return { ...guide, x, length };
|
|
243
|
+
} else if (guide.type === 'vertical') {
|
|
244
|
+
const y = Math.min(boundingBox.y, guide.y);
|
|
245
|
+
const length = Math.max(boundingBox.y + boundingBox.height, guide.y + guide.length) - y;
|
|
246
|
+
return { ...guide, y, length };
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return guide;
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
Object.assign(layer, { x, y });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const onMouseOver = () => {
|
|
258
|
+
console.log('mouseover', layer.id);
|
|
259
|
+
hoveredLayer = layer;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const onMouseLeave = () => {
|
|
263
|
+
console.log('mouseleave', layer.id);
|
|
264
|
+
hoveredLayer = null;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const onDragEnter = (e: DragEvent) => {
|
|
268
|
+
console.log('dragenter layer wrapper', e);
|
|
269
|
+
e.preventDefault();
|
|
270
|
+
// e.stopPropagation();
|
|
271
|
+
};
|
|
272
|
+
</script>
|
|
273
|
+
|
|
274
|
+
<!-- svelte-ignore a11y_mouse_events_have_key_events -->
|
|
275
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
276
|
+
<div
|
|
277
|
+
class="pointer-events-auto absolute select-none"
|
|
278
|
+
style:width="{layer.width * scale}px"
|
|
279
|
+
style:height="{layer.height * scale}px"
|
|
280
|
+
style:transform={`translate(${layer.x}px, ${layer.y}px) rotate(${rotate}deg)`}
|
|
281
|
+
style:opacity={layer.opacity ?? null}
|
|
282
|
+
onmousedown={onMouseDown}
|
|
283
|
+
onmouseover={onMouseOver}
|
|
284
|
+
onmouseleave={onMouseLeave}
|
|
285
|
+
ondragenter={onDragEnter}
|
|
286
|
+
>
|
|
287
|
+
{@render children?.()}
|
|
288
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ActiveLayerGuide, Layer } from '../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer: Layer;
|
|
4
|
+
hoveredLayer: Layer | 'background' | null;
|
|
5
|
+
activeLayerGuides: ActiveLayerGuide[];
|
|
6
|
+
children?: import('svelte').Snippet;
|
|
7
|
+
}
|
|
8
|
+
declare const LayerWrapper: import("svelte").Component<Props, {}, "layer" | "hoveredLayer" | "activeLayerGuides">;
|
|
9
|
+
type LayerWrapper = ReturnType<typeof LayerWrapper>;
|
|
10
|
+
export default LayerWrapper;
|
package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import PaletteIcon from 'lucide-svelte/icons/palette';
|
|
3
|
+
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
4
|
+
import * as Popover from '../../../../ui/popover/index.js';
|
|
5
|
+
import { Button, buttonVariants } from '../../../../ui/button/index.js';
|
|
6
|
+
import { cn } from '../../../../../utils.js';
|
|
7
|
+
|
|
8
|
+
const editor = getPresentationEditorContext();
|
|
9
|
+
|
|
10
|
+
const colors = [
|
|
11
|
+
{ value: '#000000', name: 'Black' },
|
|
12
|
+
{ value: '#545454', name: 'Dark Gray' },
|
|
13
|
+
{ value: '#737373', name: 'Gray' },
|
|
14
|
+
{ value: '#a6a6a6', name: 'Gray' },
|
|
15
|
+
{ value: '#d9d9d9', name: 'Light Gray' },
|
|
16
|
+
{ value: '#ffffff', name: 'White' },
|
|
17
|
+
|
|
18
|
+
{ value: '#ff3131', name: 'Bright Red' },
|
|
19
|
+
{ value: '#ff5757', name: 'Coral Red' },
|
|
20
|
+
{ value: '#ff66c4', name: 'Pink' },
|
|
21
|
+
{ value: '#cb6ce6', name: 'Magenta' },
|
|
22
|
+
{ value: '#8c52ff', name: 'Purple' },
|
|
23
|
+
{ value: '#5e17eb', name: 'Violet' },
|
|
24
|
+
|
|
25
|
+
{ value: '#0097b2', name: 'Dark Turquoise' },
|
|
26
|
+
{ value: '#0cc0df', name: 'Aqua Blue' },
|
|
27
|
+
{ value: '#5ce1e6', name: 'Turquoise Blue' },
|
|
28
|
+
{ value: '#38b6ff', name: 'Light Blue' },
|
|
29
|
+
{ value: '#5271ff', name: 'Royal Blue' },
|
|
30
|
+
{ value: '#004aad', name: 'Cobalt Blue' },
|
|
31
|
+
|
|
32
|
+
{ value: '#00bf63', name: 'Green' },
|
|
33
|
+
{ value: '#7ed957', name: 'Grass Green' },
|
|
34
|
+
{ value: '#c1ff72', name: 'Lime' },
|
|
35
|
+
{ value: '#ffde59', name: 'Yellow' },
|
|
36
|
+
{ value: '#ffbd59', name: 'Peach' },
|
|
37
|
+
{ value: '#ff914d', name: 'Orange' },
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const setColor = (value: string) => () => {
|
|
41
|
+
const undo = { backgroundColor: editor.activeSlide.backgroundColor };
|
|
42
|
+
const redo = { backgroundColor: value };
|
|
43
|
+
Object.assign(editor.activeSlide, redo);
|
|
44
|
+
editor.historyPush({ type: 'slide', undo, redo });
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<Popover.Root>
|
|
49
|
+
<Popover.Trigger class={buttonVariants({ variant: 'ghost', size: 'icon-xs' })}>
|
|
50
|
+
<span
|
|
51
|
+
class="h-6 w-6 rounded-full border border-gray-300"
|
|
52
|
+
style:background-color={editor.activeSlide.backgroundColor}
|
|
53
|
+
></span>
|
|
54
|
+
</Popover.Trigger>
|
|
55
|
+
<Popover.Content align="start" sideOffset={2} class="w-auto p-2">
|
|
56
|
+
<div class="flex flex-col gap-2">
|
|
57
|
+
<div class="flex items-center gap-2 p-2">
|
|
58
|
+
<PaletteIcon class="h-5 w-5" />
|
|
59
|
+
<h5 class="text-left text-sm font-bold">Colors</h5>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="grid grid-cols-6 items-stretch gap-3">
|
|
62
|
+
{#each colors as color}
|
|
63
|
+
<Button
|
|
64
|
+
class={cn(
|
|
65
|
+
'relative h-10 w-10 after:absolute after:inset-0 after:rounded-full after:transition-shadow',
|
|
66
|
+
editor.activeSlide.backgroundColor === color.value && 'after:shadow-active',
|
|
67
|
+
)}
|
|
68
|
+
variant="ghost"
|
|
69
|
+
size="icon"
|
|
70
|
+
onclick={setColor(color.value)}
|
|
71
|
+
>
|
|
72
|
+
<span
|
|
73
|
+
class="h-full w-full rounded-full after:absolute after:inset-0 after:rounded-full after:shadow-inner"
|
|
74
|
+
style:background-color={color.value}
|
|
75
|
+
></span>
|
|
76
|
+
</Button>
|
|
77
|
+
{/each}
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</Popover.Content>
|
|
81
|
+
</Popover.Root>
|
|
@@ -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 BackgroundLayerButtons: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type BackgroundLayerButtons = InstanceType<typeof BackgroundLayerButtons>;
|
|
18
|
+
export default BackgroundLayerButtons;
|
package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Slide } from '../../../types.js';
|
|
3
|
+
import BackgroundContent from './background-content.svelte';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
slide: Slide;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { slide }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<BackgroundContent {slide} />
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Slide } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
slide: Slide;
|
|
4
|
+
}
|
|
5
|
+
declare const BackgroundLayerThumb: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type BackgroundLayerThumb = ReturnType<typeof BackgroundLayerThumb>;
|
|
7
|
+
export default BackgroundLayerThumb;
|