@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,80 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Image, ImageLayer } from '../../../types.js';
|
|
3
|
+
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
4
|
+
import ImageContent from './image-content.svelte';
|
|
5
|
+
import { calculateImageFill } from '../../utils.js';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
layer: ImageLayer;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { layer = $bindable() }: Props = $props();
|
|
12
|
+
|
|
13
|
+
const editor = getPresentationEditorContext();
|
|
14
|
+
|
|
15
|
+
let layerSubstitute: ImageLayer | null = $state(null);
|
|
16
|
+
|
|
17
|
+
let ref: HTMLDivElement;
|
|
18
|
+
|
|
19
|
+
const buildImageDropChanges = (image: Image) => {
|
|
20
|
+
const layerScale = layer.scale || 1;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
image,
|
|
24
|
+
...calculateImageFill(image, {
|
|
25
|
+
width: layer.width * layerScale,
|
|
26
|
+
height: layer.height * layerScale,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const onDragEnter = (e: DragEvent) => {
|
|
32
|
+
console.log('dragenter image layer', e);
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
|
|
36
|
+
if (editor.dragged) {
|
|
37
|
+
editor.dragged.hidden = true;
|
|
38
|
+
layerSubstitute = { ...layer, ...buildImageDropChanges(editor.dragged.image) };
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const onDragOver = (e: DragEvent) => {
|
|
43
|
+
// console.log('dragover image layer', e);
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const onDragLeave = (e: DragEvent) => {
|
|
48
|
+
console.log('dragleave image layer', e);
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
|
|
52
|
+
layerSubstitute = null;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onDrop = (e: DragEvent) => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
|
|
58
|
+
if (editor.dragged) {
|
|
59
|
+
const redo = buildImageDropChanges(editor.dragged.image);
|
|
60
|
+
const undo = Object.fromEntries(
|
|
61
|
+
Object.keys(redo).map((key) => [key, layer[key as keyof ImageLayer]]),
|
|
62
|
+
);
|
|
63
|
+
Object.assign(layer, redo);
|
|
64
|
+
editor.historyPush({ type: 'layer', layer: { id: layer.id, type: layer.type }, undo, redo });
|
|
65
|
+
}
|
|
66
|
+
layerSubstitute = null;
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
71
|
+
<div
|
|
72
|
+
bind:this={ref}
|
|
73
|
+
class="h-full w-full"
|
|
74
|
+
ondragenter={onDragEnter}
|
|
75
|
+
ondragover={onDragOver}
|
|
76
|
+
ondragleave={onDragLeave}
|
|
77
|
+
ondrop={onDrop}
|
|
78
|
+
>
|
|
79
|
+
<ImageContent layer={layerSubstitute ?? layer} />
|
|
80
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from './image-layer.svelte';
|
|
2
|
+
import ImageLayerThumb from './image-layer-thumb.svelte';
|
|
3
|
+
import ImageLayerButtons from './image-layer-buttons.svelte';
|
|
4
|
+
import ImageLayerActive from './image-layer-active.svelte';
|
|
5
|
+
export { Root, Root as ImageLayer, ImageLayerThumb, ImageLayerButtons, ImageLayerActive };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from './image-layer.svelte';
|
|
2
|
+
import ImageLayerThumb from './image-layer-thumb.svelte';
|
|
3
|
+
import ImageLayerButtons from './image-layer-buttons.svelte';
|
|
4
|
+
import ImageLayerActive from './image-layer-active.svelte';
|
|
5
|
+
export { Root, Root as ImageLayer, ImageLayerThumb, ImageLayerButtons, ImageLayerActive };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type Origin = 'top-left' | 'top-right' | 'center-left' | 'center-right' | 'bottom-left' | 'bottom-right' | 'left' | 'right' | 'top' | 'bottom';
|
|
2
|
+
interface ElementProps {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
rotate: number | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const calculateNewPosition: (origin: Origin, element: ElementProps, newWidth: number, newHeight: number) => {
|
|
10
|
+
newX: number;
|
|
11
|
+
newY: number;
|
|
12
|
+
};
|
|
13
|
+
export declare function calculateBoundingBox(element: ElementProps): {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function calculateImageFill(image: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}, bBox: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}): {
|
|
26
|
+
offsetX: number;
|
|
27
|
+
offsetY: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
scale: number;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const rotatePoint = (point, angleRad) => {
|
|
2
|
+
const cos = Math.cos(angleRad);
|
|
3
|
+
const sin = Math.sin(angleRad);
|
|
4
|
+
return {
|
|
5
|
+
x: point.x * cos - point.y * sin,
|
|
6
|
+
y: point.x * sin + point.y * cos,
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
const getPoints = (origin, width, height) => {
|
|
10
|
+
const halfWidth = width / 2;
|
|
11
|
+
const halfHeight = height / 2;
|
|
12
|
+
switch (origin) {
|
|
13
|
+
case 'top-left':
|
|
14
|
+
return { x: -halfWidth, y: -halfHeight };
|
|
15
|
+
case 'top-right':
|
|
16
|
+
return { x: halfWidth, y: -halfHeight };
|
|
17
|
+
case 'center-left':
|
|
18
|
+
case 'left':
|
|
19
|
+
return { x: -halfWidth, y: 0 };
|
|
20
|
+
case 'center-right':
|
|
21
|
+
case 'right':
|
|
22
|
+
return { x: halfWidth, y: 0 };
|
|
23
|
+
case 'bottom-left':
|
|
24
|
+
return { x: -halfWidth, y: halfHeight };
|
|
25
|
+
case 'bottom-right':
|
|
26
|
+
return { x: halfWidth, y: halfHeight };
|
|
27
|
+
case 'top':
|
|
28
|
+
return { x: 0, y: -halfHeight };
|
|
29
|
+
case 'bottom':
|
|
30
|
+
return { x: 0, y: halfHeight };
|
|
31
|
+
default:
|
|
32
|
+
throw new Error(`Unknown origin: ${origin}`);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export const calculateNewPosition = (origin, element, newWidth, newHeight) => {
|
|
36
|
+
const { x, y, width, height } = element;
|
|
37
|
+
const rotate = element.rotate || 0;
|
|
38
|
+
const oldPoint = getPoints(origin, width, height);
|
|
39
|
+
const newPoint = getPoints(origin, newWidth, newHeight);
|
|
40
|
+
let deltaX = newPoint.x - oldPoint.x;
|
|
41
|
+
let deltaY = newPoint.y - oldPoint.y;
|
|
42
|
+
if (rotate !== 0) {
|
|
43
|
+
const rad = (rotate * Math.PI) / 180;
|
|
44
|
+
const rotatedOldCenter = rotatePoint(oldPoint, rad);
|
|
45
|
+
const rotatedNewCenter = rotatePoint(newPoint, rad);
|
|
46
|
+
deltaX = rotatedNewCenter.x - rotatedOldCenter.x;
|
|
47
|
+
deltaY = rotatedNewCenter.y - rotatedOldCenter.y;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
newX: x - deltaX - (newWidth - width) / 2,
|
|
51
|
+
newY: y - deltaY - (newHeight - height) / 2,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export function calculateBoundingBox(element) {
|
|
55
|
+
const { x, y, width, height } = element;
|
|
56
|
+
const rotate = element.rotate || 0;
|
|
57
|
+
if (rotate === 0) {
|
|
58
|
+
return { x, y, width, height };
|
|
59
|
+
}
|
|
60
|
+
const radians = (rotate * Math.PI) / 180;
|
|
61
|
+
const origins = ['top-left', 'top-right'];
|
|
62
|
+
const corners = origins.map((position) => rotatePoint(getPoints(position, width, height), radians));
|
|
63
|
+
const maxX = Math.max(...corners.map((corner) => Math.abs(corner.x)));
|
|
64
|
+
const maxY = Math.max(...corners.map((corner) => Math.abs(corner.y)));
|
|
65
|
+
return {
|
|
66
|
+
x: x + width / 2 - maxX,
|
|
67
|
+
y: y + height / 2 - maxY,
|
|
68
|
+
width: maxX * 2,
|
|
69
|
+
height: maxY * 2,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function calculateImageFill(image, bBox) {
|
|
73
|
+
const widthScale = bBox.width / image.width;
|
|
74
|
+
const heightScale = bBox.height / image.height;
|
|
75
|
+
const scale = Math.max(widthScale, heightScale);
|
|
76
|
+
const width = bBox.width / scale;
|
|
77
|
+
const height = bBox.height / scale;
|
|
78
|
+
return {
|
|
79
|
+
width,
|
|
80
|
+
height,
|
|
81
|
+
scale,
|
|
82
|
+
...(widthScale > heightScale
|
|
83
|
+
? {
|
|
84
|
+
offsetX: 0,
|
|
85
|
+
offsetY: (image.height - bBox.height / scale) / 2,
|
|
86
|
+
}
|
|
87
|
+
: {
|
|
88
|
+
offsetX: (image.width - bBox.width / scale) / 2,
|
|
89
|
+
offsetY: 0,
|
|
90
|
+
}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, tick } from 'svelte';
|
|
3
|
+
import CheckIcon from 'lucide-svelte/icons/check';
|
|
4
|
+
import * as DropdownMenu from '../ui/dropdown-menu/index.js';
|
|
5
|
+
import { Slider } from '../ui/slider/index.js';
|
|
6
|
+
import { buttonVariants } from '../ui/button/index.js';
|
|
7
|
+
import type { ActiveSidebar, Image } from './types.js';
|
|
8
|
+
import { checkImage } from './utils.js';
|
|
9
|
+
import {
|
|
10
|
+
PresentationEditor,
|
|
11
|
+
type PresentationEditorOptions,
|
|
12
|
+
} from './presentation-editor.svelte.js';
|
|
13
|
+
import Header from './header.svelte';
|
|
14
|
+
import Sidebar from './sidebar/sidebar.svelte';
|
|
15
|
+
import SlideEditor from './slide-editor.svelte';
|
|
16
|
+
import SlidesNavigation from './slides-navigation/slides-navigation.svelte';
|
|
17
|
+
import CursorTooltip from './cursor-tooltip.svelte';
|
|
18
|
+
import Dragged from './dragged.svelte';
|
|
19
|
+
|
|
20
|
+
let editorOptions: PresentationEditorOptions = $props();
|
|
21
|
+
|
|
22
|
+
const presentationEditor = new PresentationEditor(editorOptions);
|
|
23
|
+
|
|
24
|
+
let activeSidebarTab: ActiveSidebar = $state('images');
|
|
25
|
+
|
|
26
|
+
const toggleActiveSidebarTab = (name: ActiveSidebar) => {
|
|
27
|
+
const newTab = activeSidebarTab === name ? null : name;
|
|
28
|
+
if (newTab !== activeSidebarTab && (newTab === null || activeSidebarTab === null)) {
|
|
29
|
+
onResize();
|
|
30
|
+
}
|
|
31
|
+
activeSidebarTab = newTab;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
let fittedToScreen = $state(false);
|
|
35
|
+
let filledToScreen = $state(false);
|
|
36
|
+
|
|
37
|
+
const sliderMin = -2.304;
|
|
38
|
+
const sliderMax = 1.61;
|
|
39
|
+
const zoomMin = 0.1;
|
|
40
|
+
const zoomMax = 5;
|
|
41
|
+
const referenceSlider = 0;
|
|
42
|
+
const referenceZoom = 1;
|
|
43
|
+
|
|
44
|
+
const slope1 = (referenceZoom - zoomMin) / (referenceSlider - sliderMin);
|
|
45
|
+
const intercept1 = referenceZoom - slope1 * referenceSlider;
|
|
46
|
+
|
|
47
|
+
const slope2 = (zoomMax - referenceZoom) / (sliderMax - referenceSlider);
|
|
48
|
+
const intercept2 = referenceZoom - slope2 * referenceSlider;
|
|
49
|
+
|
|
50
|
+
const convertSliderToZoom = (value: number) => {
|
|
51
|
+
if (value <= referenceSlider) {
|
|
52
|
+
return slope1 * value + intercept1;
|
|
53
|
+
} else {
|
|
54
|
+
return slope2 * value + intercept2;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const convertZoomToSlider = (value: number) => {
|
|
59
|
+
if (value <= referenceZoom) {
|
|
60
|
+
return (value - intercept1) / slope1;
|
|
61
|
+
} else {
|
|
62
|
+
return (value - intercept2) / slope2;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
let sliderValue = $state(convertZoomToSlider(presentationEditor.zoom));
|
|
67
|
+
const setZoom = (zoom: number) => {
|
|
68
|
+
sliderValue = convertZoomToSlider(zoom);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
let viewportRef: HTMLDivElement | null = $state(null);
|
|
72
|
+
let wrapperRef: HTMLDivElement | null = $state(null);
|
|
73
|
+
|
|
74
|
+
let scaledWidth = $derived(presentationEditor.width * presentationEditor.zoom);
|
|
75
|
+
let scaledHeight = $derived(presentationEditor.height * presentationEditor.zoom);
|
|
76
|
+
|
|
77
|
+
let centerX = 0;
|
|
78
|
+
let centerY = 0;
|
|
79
|
+
$effect(() => {
|
|
80
|
+
fittedToScreen = false;
|
|
81
|
+
filledToScreen = false;
|
|
82
|
+
const newZoom = convertSliderToZoom(sliderValue);
|
|
83
|
+
if (viewportRef) {
|
|
84
|
+
const centeringPrecision = 0.001;
|
|
85
|
+
const newCenterX =
|
|
86
|
+
(viewportRef.clientWidth / 2 + viewportRef.scrollLeft) / viewportRef.scrollWidth;
|
|
87
|
+
const newCenterY =
|
|
88
|
+
(viewportRef.clientHeight / 2 + viewportRef.scrollTop) / viewportRef.scrollHeight;
|
|
89
|
+
|
|
90
|
+
centerX = Math.abs(centerX - newCenterX) < centeringPrecision ? centerX : newCenterX;
|
|
91
|
+
centerY = Math.abs(centerY - newCenterY) < centeringPrecision ? centerY : newCenterY;
|
|
92
|
+
|
|
93
|
+
presentationEditor.zoom = newZoom;
|
|
94
|
+
tick().then(() => {
|
|
95
|
+
if (viewportRef) {
|
|
96
|
+
viewportRef.scrollLeft = centerX * viewportRef.scrollWidth - viewportRef.clientWidth / 2;
|
|
97
|
+
viewportRef.scrollTop = centerY * viewportRef.scrollHeight - viewportRef.clientHeight / 2;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
presentationEditor.zoom = newZoom;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const fillScreen = async () => {
|
|
106
|
+
if (viewportRef && wrapperRef) {
|
|
107
|
+
sliderValue = convertZoomToSlider(
|
|
108
|
+
(presentationEditor.zoom *
|
|
109
|
+
(viewportRef.clientWidth - (wrapperRef.clientWidth - scaledWidth))) /
|
|
110
|
+
scaledWidth,
|
|
111
|
+
);
|
|
112
|
+
tick().then(() => {
|
|
113
|
+
filledToScreen = true;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const fitToScreen = () => {
|
|
119
|
+
if (viewportRef && wrapperRef) {
|
|
120
|
+
viewportRef.scrollLeft = 0;
|
|
121
|
+
viewportRef.scrollTop = 0;
|
|
122
|
+
sliderValue = convertZoomToSlider(
|
|
123
|
+
presentationEditor.zoom *
|
|
124
|
+
Math.min(
|
|
125
|
+
(viewportRef.clientWidth - (wrapperRef.clientWidth - scaledWidth)) / scaledWidth,
|
|
126
|
+
(viewportRef.clientHeight - (wrapperRef.clientHeight - scaledHeight)) / scaledHeight,
|
|
127
|
+
),
|
|
128
|
+
);
|
|
129
|
+
tick().then(() => {
|
|
130
|
+
fittedToScreen = true;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
136
|
+
console.log('keydown', e);
|
|
137
|
+
if (e.key === 'Escape') {
|
|
138
|
+
if (presentationEditor.activeAction) {
|
|
139
|
+
presentationEditor.activeAction = null;
|
|
140
|
+
} else {
|
|
141
|
+
presentationEditor.setActiveBackground(!!presentationEditor.activeLayer);
|
|
142
|
+
}
|
|
143
|
+
} else if (['Delete', 'Backspace'].includes(e.key)) {
|
|
144
|
+
if (presentationEditor.activeLayer) {
|
|
145
|
+
presentationEditor.removeLayer(presentationEditor.activeLayer);
|
|
146
|
+
} else if (presentationEditor.activeBackground) {
|
|
147
|
+
presentationEditor.removeBackground();
|
|
148
|
+
} else if (presentationEditor.slideSelected) {
|
|
149
|
+
presentationEditor.removeSlide(presentationEditor.activeSlide);
|
|
150
|
+
}
|
|
151
|
+
} else if (e.key === 'z') {
|
|
152
|
+
if (e.metaKey || e.ctrlKey) {
|
|
153
|
+
if (e.shiftKey) {
|
|
154
|
+
presentationEditor.historyRedo();
|
|
155
|
+
} else {
|
|
156
|
+
presentationEditor.historyUndo();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
} else if (e.key === 'y' && (e.metaKey || e.ctrlKey)) {
|
|
160
|
+
presentationEditor.historyRedo();
|
|
161
|
+
} else if (e.key === 'd' && (e.metaKey || e.ctrlKey)) {
|
|
162
|
+
if (presentationEditor.slideSelected) {
|
|
163
|
+
presentationEditor.duplicateSlide(presentationEditor.activeSlide);
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
}
|
|
166
|
+
} else if (e.key === 'c' && (e.metaKey || e.ctrlKey)) {
|
|
167
|
+
if (presentationEditor.activeLayer) {
|
|
168
|
+
presentationEditor.clipboard = presentationEditor.activeLayer;
|
|
169
|
+
} else if (presentationEditor.slideSelected) {
|
|
170
|
+
presentationEditor.clipboard = presentationEditor.activeSlide;
|
|
171
|
+
}
|
|
172
|
+
} else if (e.key === 'v' && (e.metaKey || e.ctrlKey)) {
|
|
173
|
+
if (presentationEditor.clipboard) {
|
|
174
|
+
if ('type' in presentationEditor.clipboard) {
|
|
175
|
+
presentationEditor.duplicateLayer(presentationEditor.clipboard);
|
|
176
|
+
} else if ('layers' in presentationEditor.clipboard) {
|
|
177
|
+
presentationEditor.duplicateSlide(presentationEditor.clipboard);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const onResize = () => {
|
|
184
|
+
tick().then(() => {
|
|
185
|
+
if (fittedToScreen) {
|
|
186
|
+
fitToScreen();
|
|
187
|
+
} else if (filledToScreen) {
|
|
188
|
+
fillScreen();
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const onDragOver = (e: DragEvent) => {
|
|
194
|
+
// console.log('dragover windown', e);
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
if (e.dataTransfer?.items.length) {
|
|
197
|
+
presentationEditor.fileDragged = true;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const onDrop = async (e: DragEvent) => {
|
|
202
|
+
console.log('drop images library', e);
|
|
203
|
+
|
|
204
|
+
let dropToSlide = false;
|
|
205
|
+
const viewportRect = viewportRef?.getBoundingClientRect();
|
|
206
|
+
const wrapperRect = wrapperRef?.getBoundingClientRect();
|
|
207
|
+
if (viewportRect && wrapperRect) {
|
|
208
|
+
const minLeft = Math.max(viewportRect.left, wrapperRect.left);
|
|
209
|
+
const maxRight = Math.min(viewportRect.right, wrapperRect.right);
|
|
210
|
+
const minTop = Math.max(viewportRect.top, wrapperRect.top);
|
|
211
|
+
const maxBottom = Math.min(viewportRect.bottom, wrapperRect.bottom);
|
|
212
|
+
|
|
213
|
+
dropToSlide =
|
|
214
|
+
e.pageX > minLeft && e.pageX < maxRight && e.pageY > minTop && e.pageY < maxBottom;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
e.preventDefault();
|
|
218
|
+
e.stopPropagation();
|
|
219
|
+
presentationEditor.fileDragged = false;
|
|
220
|
+
if (e.dataTransfer?.items.length) {
|
|
221
|
+
const item = e.dataTransfer.items[0];
|
|
222
|
+
console.log('item', item, item.kind, item.type);
|
|
223
|
+
if (['image/png', 'image/jpeg', 'image/gif'].includes(item.type)) {
|
|
224
|
+
const file = item.getAsFile();
|
|
225
|
+
console.log('image file', file);
|
|
226
|
+
if (file) {
|
|
227
|
+
try {
|
|
228
|
+
let image: Image;
|
|
229
|
+
if (presentationEditor.onImageUpload) {
|
|
230
|
+
image = await presentationEditor.onImageUpload(file);
|
|
231
|
+
} else {
|
|
232
|
+
const url = URL.createObjectURL(file);
|
|
233
|
+
console.log('image url', url);
|
|
234
|
+
// presentationEditor.
|
|
235
|
+
const htmlImage = await checkImage(url);
|
|
236
|
+
image = {
|
|
237
|
+
id: presentationEditor.generateId(),
|
|
238
|
+
src: url,
|
|
239
|
+
width: htmlImage.width,
|
|
240
|
+
height: htmlImage.height,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
presentationEditor.images.push(image);
|
|
244
|
+
if (dropToSlide) {
|
|
245
|
+
presentationEditor.addImageLayer({
|
|
246
|
+
x: (presentationEditor.width - image.width) / 2,
|
|
247
|
+
y: (presentationEditor.height - image.height) / 2,
|
|
248
|
+
width: image.width,
|
|
249
|
+
height: image.height,
|
|
250
|
+
image: {
|
|
251
|
+
id: image.id,
|
|
252
|
+
src: image.src,
|
|
253
|
+
width: image.width,
|
|
254
|
+
height: image.height,
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
} catch (err) {
|
|
259
|
+
console.log('err', err);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
onMount(() => {
|
|
267
|
+
tick().then(() => {
|
|
268
|
+
fitToScreen();
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<svelte:window onkeydown={onKeyDown} onresize={onResize} ondragover={onDragOver} />
|
|
274
|
+
|
|
275
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
276
|
+
<div
|
|
277
|
+
class="flex h-full select-none flex-col"
|
|
278
|
+
ondragover={(e) => e.preventDefault()}
|
|
279
|
+
ondrop={onDrop}
|
|
280
|
+
>
|
|
281
|
+
<Dragged />
|
|
282
|
+
<CursorTooltip />
|
|
283
|
+
<Header {activeSidebarTab} onChange={toggleActiveSidebarTab} />
|
|
284
|
+
|
|
285
|
+
<div class="flex min-h-0 flex-1">
|
|
286
|
+
<Sidebar {activeSidebarTab} />
|
|
287
|
+
|
|
288
|
+
<div class="relative flex grow flex-col overflow-hidden bg-gray-100">
|
|
289
|
+
<main class="flex min-h-0 flex-1 flex-col bg-gray-200">
|
|
290
|
+
<SlideEditor bind:wrapperRef bind:viewportRef />
|
|
291
|
+
</main>
|
|
292
|
+
|
|
293
|
+
<footer class="relative">
|
|
294
|
+
{#if presentationEditor.mode === 'multiple'}
|
|
295
|
+
<SlidesNavigation />
|
|
296
|
+
{/if}
|
|
297
|
+
<div class="flex items-center justify-end gap-2 px-4">
|
|
298
|
+
<div class="w-48">
|
|
299
|
+
<Slider
|
|
300
|
+
type="single"
|
|
301
|
+
bind:value={sliderValue}
|
|
302
|
+
min={sliderMin}
|
|
303
|
+
max={sliderMax}
|
|
304
|
+
step={0.001}
|
|
305
|
+
/>
|
|
306
|
+
</div>
|
|
307
|
+
<DropdownMenu.Root>
|
|
308
|
+
<DropdownMenu.Trigger
|
|
309
|
+
class={buttonVariants({ variant: 'ghost', size: 'icon-xs', class: 'w-16' })}
|
|
310
|
+
>
|
|
311
|
+
{Math.round(presentationEditor.zoom * 100)}%
|
|
312
|
+
</DropdownMenu.Trigger>
|
|
313
|
+
|
|
314
|
+
<DropdownMenu.Content align="end" class="w-48">
|
|
315
|
+
{#each [3, 2, 1.25, 1, 0.75, 0.5, 0.25, 0.1] as zoomLevel}
|
|
316
|
+
<DropdownMenu.Item onclick={() => setZoom(zoomLevel)}>
|
|
317
|
+
{(zoomLevel * 100).toFixed(0)}%
|
|
318
|
+
{#if presentationEditor.zoom === zoomLevel}<CheckIcon class="h-4 w-4" />{/if}
|
|
319
|
+
</DropdownMenu.Item>
|
|
320
|
+
{/each}
|
|
321
|
+
<DropdownMenu.Separator />
|
|
322
|
+
<DropdownMenu.Item onclick={fitToScreen}>
|
|
323
|
+
Fit
|
|
324
|
+
{#if fittedToScreen}<CheckIcon class="h-4 w-4" />{/if}
|
|
325
|
+
</DropdownMenu.Item>
|
|
326
|
+
<DropdownMenu.Item onclick={fillScreen}>
|
|
327
|
+
Fill
|
|
328
|
+
{#if filledToScreen}<CheckIcon class="h-4 w-4" />{/if}
|
|
329
|
+
</DropdownMenu.Item>
|
|
330
|
+
</DropdownMenu.Content>
|
|
331
|
+
</DropdownMenu.Root>
|
|
332
|
+
</div>
|
|
333
|
+
</footer>
|
|
334
|
+
</div>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PresentationEditor } from './presentation-editor.svelte.js';
|
|
2
|
+
declare const PresentationEditor: import("svelte").Component<PresentationEditorOptions, {
|
|
3
|
+
fillScreen: () => Promise<void>;
|
|
4
|
+
fitToScreen: () => void;
|
|
5
|
+
}, "">;
|
|
6
|
+
type PresentationEditor = ReturnType<typeof PresentationEditor>;
|
|
7
|
+
export default PresentationEditor;
|