@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,159 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tick, untrack } from 'svelte';
|
|
3
|
+
import type { HtmlLayer } from '../../../types.js';
|
|
4
|
+
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
5
|
+
import { createEditor, EditorContent } from './editor/index.js';
|
|
6
|
+
import { extensions } from './index.js';
|
|
7
|
+
import { calculateNewPosition } from '../../utils.js';
|
|
8
|
+
import { SideScaleControl } from '../../controls/side-scale-control/index.js';
|
|
9
|
+
import { CornerScaleControl } from '../../controls/corner-scale-control/index.js';
|
|
10
|
+
import { RotateControl } from '../../controls/rotate-control/index.js';
|
|
11
|
+
import { createDebouncedCallback } from '../../../../../utils.js';
|
|
12
|
+
|
|
13
|
+
import './editor.css';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
layer: HtmlLayer;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let { layer = $bindable() }: Props = $props();
|
|
20
|
+
|
|
21
|
+
const editorState = getPresentationEditorContext();
|
|
22
|
+
|
|
23
|
+
let scaleAndZoom = $derived((layer.scale || 1) * editorState.zoom);
|
|
24
|
+
let rotate = $derived(layer.rotate || 0);
|
|
25
|
+
|
|
26
|
+
let undo: object | null = null;
|
|
27
|
+
let currentLayer: HtmlLayer | null = $state(layer);
|
|
28
|
+
let currentHtml: object | undefined = layer.html;
|
|
29
|
+
|
|
30
|
+
const updateContent = (reset: boolean = true) => {
|
|
31
|
+
if (reset) {
|
|
32
|
+
$editor.chain().setContent(layer.html).selectAll().run();
|
|
33
|
+
} else {
|
|
34
|
+
console.log('html changed');
|
|
35
|
+
if (editorState.activeAction?.type === 'edit') {
|
|
36
|
+
if (layer.html !== currentHtml) {
|
|
37
|
+
$editor.chain().setContent(layer.html).focus().run();
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
$editor.chain().setContent(layer.html).selectAll().run();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
currentHtml = layer.html;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const debouncedUpdates = createDebouncedCallback((e, action) => {
|
|
47
|
+
console.log('debouncedUpdates', action);
|
|
48
|
+
editorState.historyPush(action);
|
|
49
|
+
undo = null;
|
|
50
|
+
}, 750);
|
|
51
|
+
|
|
52
|
+
console.log('create editor');
|
|
53
|
+
const editor = createEditor({
|
|
54
|
+
content: layer.html,
|
|
55
|
+
extensions,
|
|
56
|
+
injectCSS: false,
|
|
57
|
+
editorProps: { attributes: { class: 'whitespace-pre-wrap focus:outline-none' } },
|
|
58
|
+
onUpdate: async (e) => {
|
|
59
|
+
if (!undo) {
|
|
60
|
+
undo = { html: currentHtml, x: layer.x, y: layer.y, height: layer.height };
|
|
61
|
+
}
|
|
62
|
+
layer.html = e.editor.getJSON();
|
|
63
|
+
currentHtml = layer.html;
|
|
64
|
+
await tick();
|
|
65
|
+
|
|
66
|
+
const { x, y, width, height } = layer;
|
|
67
|
+
const scale = layer.scale || 1;
|
|
68
|
+
const rotate = layer.rotate || 0;
|
|
69
|
+
const layerContent = document.getElementById(`layer-content-${layer.id}`);
|
|
70
|
+
if (layerContent) {
|
|
71
|
+
const contentHeight = layerContent.offsetHeight;
|
|
72
|
+
if (contentHeight !== height) {
|
|
73
|
+
const newHeight = contentHeight * scale;
|
|
74
|
+
|
|
75
|
+
const { newX, newY } = calculateNewPosition(
|
|
76
|
+
`top-left`,
|
|
77
|
+
{ x, y, width: width * scale, height: height * scale, rotate },
|
|
78
|
+
width * scale,
|
|
79
|
+
newHeight,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const newValues = { x: newX, y: newY, height: newHeight / scale };
|
|
83
|
+
Object.assign(layer, newValues);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const action = {
|
|
87
|
+
type: 'layer',
|
|
88
|
+
layer: { id: layer.id, type: layer.type },
|
|
89
|
+
undo: undo,
|
|
90
|
+
redo: { html: e.editor.getJSON(), x: layer.x, y: layer.y, height: layer.height },
|
|
91
|
+
};
|
|
92
|
+
debouncedUpdates(e, action);
|
|
93
|
+
},
|
|
94
|
+
onDestroy: () => {
|
|
95
|
+
console.log('destroy editor');
|
|
96
|
+
editorState.htmlEditor = null;
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
editorState.htmlEditor = editor;
|
|
101
|
+
updateContent();
|
|
102
|
+
|
|
103
|
+
$effect(() => {
|
|
104
|
+
if (currentLayer !== layer) {
|
|
105
|
+
console.log('layer changed');
|
|
106
|
+
currentLayer = layer;
|
|
107
|
+
updateContent();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// update html when it changes by history undo/redo
|
|
112
|
+
$effect(() => {
|
|
113
|
+
if (layer.html !== untrack(() => currentHtml)) {
|
|
114
|
+
updateContent(false);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
{#if editorState.activeAction?.type === 'edit'}
|
|
120
|
+
<div
|
|
121
|
+
class="absolute origin-top-left select-none"
|
|
122
|
+
hidden={editorState.activeAction?.type !== 'edit'}
|
|
123
|
+
>
|
|
124
|
+
<div
|
|
125
|
+
class="pointer-events-auto select-text"
|
|
126
|
+
style:width={`${layer.width * scaleAndZoom}px`}
|
|
127
|
+
style:height={`${layer.height * scaleAndZoom}px`}
|
|
128
|
+
style:transform={`translate(${layer.x * editorState.zoom}px, ${layer.y * editorState.zoom}px) rotate(${rotate}deg)`}
|
|
129
|
+
>
|
|
130
|
+
<div
|
|
131
|
+
class="origin-top-left"
|
|
132
|
+
style:width="{layer.width}px"
|
|
133
|
+
style:height="{layer.height}px"
|
|
134
|
+
style:transform={`scale(${scaleAndZoom})`}
|
|
135
|
+
>
|
|
136
|
+
<EditorContent editor={$editor} />
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
{/if}
|
|
141
|
+
|
|
142
|
+
<div
|
|
143
|
+
class="pointer-events-none absolute left-0 top-0 h-full w-full"
|
|
144
|
+
style:width={`${layer.width * scaleAndZoom}px`}
|
|
145
|
+
style:height={`${layer.height * scaleAndZoom}px`}
|
|
146
|
+
style:transform={`translate(${layer.x * editorState.zoom}px, ${layer.y * editorState.zoom}px) rotate(${rotate}deg)`}
|
|
147
|
+
>
|
|
148
|
+
<div class="h-full w-full outline-none transition-opacity duration-300">
|
|
149
|
+
<div class="flex h-full w-full items-center justify-center">
|
|
150
|
+
<SideScaleControl origin="left" bind:layer />
|
|
151
|
+
<SideScaleControl origin="right" bind:layer />
|
|
152
|
+
<CornerScaleControl origin="bottom-right" bind:layer />
|
|
153
|
+
<CornerScaleControl origin="bottom-left" bind:layer />
|
|
154
|
+
<CornerScaleControl origin="top-right" bind:layer />
|
|
155
|
+
<CornerScaleControl origin="top-left" bind:layer />
|
|
156
|
+
<RotateControl bind:layer />
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HtmlLayer } from '../../../types.js';
|
|
2
|
+
import './editor.css';
|
|
3
|
+
interface Props {
|
|
4
|
+
layer: HtmlLayer;
|
|
5
|
+
}
|
|
6
|
+
declare const HtmlLayerActive: import("svelte").Component<Props, {}, "layer">;
|
|
7
|
+
type HtmlLayerActive = ReturnType<typeof HtmlLayerActive>;
|
|
8
|
+
export default HtmlLayerActive;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Readable } from 'svelte/store';
|
|
3
|
+
import type { HtmlLayer } from '../../../types.js';
|
|
4
|
+
import { Separator } from '../../../../ui/separator/index.js';
|
|
5
|
+
import { FontSizeButton } from './buttons/font-size-button/index.js';
|
|
6
|
+
import { ColorButton } from './buttons/color-button/index.js';
|
|
7
|
+
import { BoldButton } from './buttons/bold-button/index.js';
|
|
8
|
+
import { ItalicButton } from './buttons/italic-button/index.js';
|
|
9
|
+
import { UnderlineButton } from './buttons/underline-button/index.js';
|
|
10
|
+
import { StrikethroughButton } from './buttons/strikethrough-button/index.js';
|
|
11
|
+
import { CaseButton } from './buttons/case-button/index.js';
|
|
12
|
+
import { AlignmentButton } from './buttons/alignment-button/index.js';
|
|
13
|
+
import { ListButton } from './buttons/list-button/index.js';
|
|
14
|
+
import { OpacityButton } from '../../buttons/opacity-button/index.js';
|
|
15
|
+
import type { Editor } from './editor/Editor.js';
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
htmlEditor: Readable<Editor>;
|
|
19
|
+
layer: HtmlLayer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let { htmlEditor, layer = $bindable() }: Props = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if $htmlEditor}
|
|
26
|
+
<FontSizeButton {layer} editor={$htmlEditor} />
|
|
27
|
+
<ColorButton editor={$htmlEditor} />
|
|
28
|
+
<div class="grid grid-flow-col items-center gap-0.5">
|
|
29
|
+
<BoldButton editor={$htmlEditor} />
|
|
30
|
+
<ItalicButton editor={$htmlEditor} />
|
|
31
|
+
<UnderlineButton editor={$htmlEditor} />
|
|
32
|
+
<StrikethroughButton editor={$htmlEditor} />
|
|
33
|
+
<CaseButton editor={$htmlEditor} />
|
|
34
|
+
</div>
|
|
35
|
+
<Separator orientation="vertical" />
|
|
36
|
+
<div class="grid grid-flow-col items-center gap-0.5">
|
|
37
|
+
<AlignmentButton editor={$htmlEditor} />
|
|
38
|
+
<ListButton editor={$htmlEditor} />
|
|
39
|
+
</div>
|
|
40
|
+
<Separator orientation="vertical" />
|
|
41
|
+
<OpacityButton bind:layer />
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Readable } from 'svelte/store';
|
|
2
|
+
import type { HtmlLayer } from '../../../types.js';
|
|
3
|
+
import type { Editor } from './editor/Editor.js';
|
|
4
|
+
interface Props {
|
|
5
|
+
htmlEditor: Readable<Editor>;
|
|
6
|
+
layer: HtmlLayer;
|
|
7
|
+
}
|
|
8
|
+
declare const HtmlLayerButtons: import("svelte").Component<Props, {}, "layer">;
|
|
9
|
+
type HtmlLayerButtons = ReturnType<typeof HtmlLayerButtons>;
|
|
10
|
+
export default HtmlLayerButtons;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HtmlLayer } from '../../../types.js';
|
|
3
|
+
import { HtmlContent } from './index.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
layer: HtmlLayer;
|
|
7
|
+
thumbScale: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { layer, thumbScale }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class="h-full origin-top-left"
|
|
15
|
+
style:width="{layer.width}px"
|
|
16
|
+
style:height="{layer.height}px"
|
|
17
|
+
style:transform={`scale(${thumbScale * (layer.scale || 1)})`}
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
class="whitespace-pre-wrap break-words p-0 text-left text-base font-normal normal-case not-italic text-black"
|
|
21
|
+
>
|
|
22
|
+
<HtmlContent html={layer.html} />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HtmlLayer } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer: HtmlLayer;
|
|
4
|
+
thumbScale: number;
|
|
5
|
+
}
|
|
6
|
+
declare const HtmlLayerThumb: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type HtmlLayerThumb = ReturnType<typeof HtmlLayerThumb>;
|
|
8
|
+
export default HtmlLayerThumb;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import type { HtmlLayer } from '../../../types.js';
|
|
4
|
+
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
5
|
+
import { cn } from '../../../../../utils.js';
|
|
6
|
+
import { HtmlContent } from './index.js';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
layer: HtmlLayer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { layer = $bindable() }: Props = $props();
|
|
13
|
+
|
|
14
|
+
const editor = getPresentationEditorContext();
|
|
15
|
+
|
|
16
|
+
let ref: HTMLElement;
|
|
17
|
+
|
|
18
|
+
let scale = $derived(layer.scale || 1);
|
|
19
|
+
|
|
20
|
+
onMount(() => {
|
|
21
|
+
layer.height = ref.offsetHeight;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const onMouseDown = () => {
|
|
25
|
+
console.log('mousedown', layer.id);
|
|
26
|
+
if (editor.activeLayer?.id === layer.id && !editor.activeAction) {
|
|
27
|
+
addEventListener('mouseup', onMouseUp);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const onMouseUp = (e: MouseEvent) => {
|
|
32
|
+
console.log('mouseup', layer.id);
|
|
33
|
+
if (editor.activeLayer?.id === layer.id && !editor.activeAction) {
|
|
34
|
+
console.log('edit layer', layer.id);
|
|
35
|
+
editor.activeAction = {
|
|
36
|
+
type: 'edit',
|
|
37
|
+
clientX: e.clientX,
|
|
38
|
+
clientY: e.clientY,
|
|
39
|
+
layer: { ...layer },
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
removeEventListener('mouseup', onMouseUp);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const onDragEnter = (e: DragEvent) => {
|
|
46
|
+
console.log('dragenter html layer', e);
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
|
|
50
|
+
if (editor.dragged) {
|
|
51
|
+
editor.dragged = { ...editor.dragged, hidden: false, scale: editor.zoom, sticky: true };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onDrop = (e: DragEvent) => {
|
|
56
|
+
console.log('drop html layer', e);
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
|
|
59
|
+
const { dragged } = editor;
|
|
60
|
+
if (dragged) {
|
|
61
|
+
editor.addImageLayer({
|
|
62
|
+
x: e.offsetX - dragged.offsetX / editor.zoom + layer.x,
|
|
63
|
+
y: e.offsetY - dragged.offsetY / editor.zoom + layer.y,
|
|
64
|
+
width: dragged.image.width,
|
|
65
|
+
height: dragged.image.height,
|
|
66
|
+
image: {
|
|
67
|
+
id: dragged.image.id,
|
|
68
|
+
src: dragged.image.src,
|
|
69
|
+
width: dragged.image.width,
|
|
70
|
+
height: dragged.image.height,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<div
|
|
78
|
+
class={cn('h-full', { 'origin-top-left': scale !== 1 })}
|
|
79
|
+
style:width="{layer.width}px"
|
|
80
|
+
style:height="{layer.height}px"
|
|
81
|
+
style:transform={scale !== 1 ? `scale(${layer.scale})` : ''}
|
|
82
|
+
>
|
|
83
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
84
|
+
<div
|
|
85
|
+
class="whitespace-pre-wrap break-words p-0 text-left text-base font-normal normal-case not-italic text-black"
|
|
86
|
+
bind:this={ref}
|
|
87
|
+
id="layer-content-{layer.id}"
|
|
88
|
+
style:opacity={editor.activeLayer?.id === layer.id && editor.activeAction?.type === 'edit'
|
|
89
|
+
? 0
|
|
90
|
+
: null}
|
|
91
|
+
onmousedown={onMouseDown}
|
|
92
|
+
ondragenter={onDragEnter}
|
|
93
|
+
ondrop={onDrop}
|
|
94
|
+
>
|
|
95
|
+
<HtmlContent html={layer.html} />
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Root from './html-layer.svelte';
|
|
2
|
+
import HtmlLayerThumb from './html-layer-thumb.svelte';
|
|
3
|
+
import HtmlContent from './html-content.svelte';
|
|
4
|
+
import HtmlLayerButtons from './html-layer-buttons.svelte';
|
|
5
|
+
import HtmlLayerActive from './html-layer-active.svelte';
|
|
6
|
+
declare const extensions: (import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Node<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-bold").BoldOptions, any>)[];
|
|
7
|
+
export { Root, Root as HtmlLayer, HtmlLayerThumb, HtmlContent, HtmlLayerButtons, HtmlLayerActive, extensions, };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Document } from '@tiptap/extension-document';
|
|
2
|
+
import { Paragraph } from '@tiptap/extension-paragraph';
|
|
3
|
+
import { Text } from '@tiptap/extension-text';
|
|
4
|
+
import { ListItem } from '@tiptap/extension-list-item';
|
|
5
|
+
import { BulletList } from '@tiptap/extension-bullet-list';
|
|
6
|
+
import { OrderedList } from '@tiptap/extension-ordered-list';
|
|
7
|
+
import { UnstyledList } from './extensions/unstyled-list/index.js';
|
|
8
|
+
import { TextStyle } from '@tiptap/extension-text-style';
|
|
9
|
+
import { TextAlign } from '@tiptap/extension-text-align';
|
|
10
|
+
import { LineHeight } from './extensions/line-height/index.js';
|
|
11
|
+
import { TextTransform } from './extensions/text-transform/index.js';
|
|
12
|
+
import { FontSize } from './extensions/font-size/index.js';
|
|
13
|
+
import { Color } from '@tiptap/extension-color';
|
|
14
|
+
import { Bold } from '@tiptap/extension-bold';
|
|
15
|
+
import { Italic } from '@tiptap/extension-italic';
|
|
16
|
+
import { Underline } from '@tiptap/extension-underline';
|
|
17
|
+
import { Strike } from '@tiptap/extension-strike';
|
|
18
|
+
import { Selection } from './extensions/selection/index.js';
|
|
19
|
+
import Root from './html-layer.svelte';
|
|
20
|
+
import HtmlLayerThumb from './html-layer-thumb.svelte';
|
|
21
|
+
import HtmlContent from './html-content.svelte';
|
|
22
|
+
import HtmlLayerButtons from './html-layer-buttons.svelte';
|
|
23
|
+
import HtmlLayerActive from './html-layer-active.svelte';
|
|
24
|
+
const extensions = [
|
|
25
|
+
Document,
|
|
26
|
+
Paragraph,
|
|
27
|
+
Text,
|
|
28
|
+
ListItem.configure({
|
|
29
|
+
HTMLAttributes: { style: 'margin-left: calc(var(--list-item-ident)*1em)' },
|
|
30
|
+
}),
|
|
31
|
+
BulletList.configure({
|
|
32
|
+
HTMLAttributes: { class: 'list-disc', style: '--list-item-ident: 1.7' },
|
|
33
|
+
keepAttributes: true,
|
|
34
|
+
keepMarks: true,
|
|
35
|
+
}),
|
|
36
|
+
OrderedList.configure({
|
|
37
|
+
HTMLAttributes: { class: 'list-decimal', style: '--list-item-ident: 1.7' },
|
|
38
|
+
keepAttributes: true,
|
|
39
|
+
keepMarks: true,
|
|
40
|
+
}),
|
|
41
|
+
UnstyledList.configure({
|
|
42
|
+
HTMLAttributes: { class: 'list-none', style: '--list-item-ident: 0' },
|
|
43
|
+
keepAttributes: true,
|
|
44
|
+
keepMarks: true,
|
|
45
|
+
}),
|
|
46
|
+
TextStyle,
|
|
47
|
+
TextAlign.configure({ types: ['paragraph', 'listItem'] }),
|
|
48
|
+
LineHeight.configure({ types: ['paragraph', 'listItem'] }),
|
|
49
|
+
TextTransform.configure({ types: ['paragraph', 'listItem'] }),
|
|
50
|
+
FontSize.configure({ types: ['paragraph', 'listItem'] }),
|
|
51
|
+
Color.configure({ types: ['paragraph', 'listItem', 'textStyle'] }),
|
|
52
|
+
Bold,
|
|
53
|
+
Italic,
|
|
54
|
+
Underline,
|
|
55
|
+
Strike,
|
|
56
|
+
Selection,
|
|
57
|
+
];
|
|
58
|
+
export { Root, Root as HtmlLayer, HtmlLayerThumb, HtmlContent, HtmlLayerButtons, HtmlLayerActive, extensions, };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ImageLayer } from '../../../types.js';
|
|
3
|
+
import { generateId } from '../../../../../utils.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
layer: ImageLayer;
|
|
7
|
+
thumbScale?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { layer = $bindable(), thumbScale = 1 }: Props = $props();
|
|
11
|
+
|
|
12
|
+
let imageLoaded = $state(false);
|
|
13
|
+
const image = new Image();
|
|
14
|
+
image.crossOrigin = 'anonymous';
|
|
15
|
+
image.src = layer.image.src;
|
|
16
|
+
image.onload = () => (imageLoaded = true);
|
|
17
|
+
|
|
18
|
+
const layerBorderId = generateId();
|
|
19
|
+
|
|
20
|
+
let scale = $derived(layer.scale || 1);
|
|
21
|
+
let width = $derived(layer.width * scale * thumbScale);
|
|
22
|
+
let height = $derived(layer.height * scale * thumbScale);
|
|
23
|
+
let flipTransform = $derived(
|
|
24
|
+
layer.flipX || layer.flipY ? `scale(${layer.flipX ? -1 : 1}, ${layer.flipY ? -1 : 1})` : null,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
let cornderRadius = $derived((layer.cornerRadius || 0) * thumbScale);
|
|
28
|
+
|
|
29
|
+
const bezier = 0.447715;
|
|
30
|
+
let roundedClipPath = $derived(
|
|
31
|
+
cornderRadius
|
|
32
|
+
? `M0,${cornderRadius}L0,${height - cornderRadius}C0,${height - cornderRadius * bezier} ${cornderRadius * bezier},${height} ${cornderRadius},${height}L${width - cornderRadius},${height}C${width - cornderRadius * bezier},${height} ${width},${height - cornderRadius * bezier} ${width},${height - cornderRadius}L${width},${cornderRadius}C${width},${cornderRadius * bezier} ${width - cornderRadius * bezier},0 ${width - cornderRadius},0L${cornderRadius},0C${cornderRadius * bezier},0 0,${cornderRadius * bezier} 0,${cornderRadius}Z`
|
|
33
|
+
: null,
|
|
34
|
+
);
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div
|
|
38
|
+
class="relative h-full w-full overflow-hidden"
|
|
39
|
+
style:clip-path={roundedClipPath ? `path("${roundedClipPath}")` : null}
|
|
40
|
+
>
|
|
41
|
+
<div class="h-full w-full transition-transform" style:transform={flipTransform}>
|
|
42
|
+
<div
|
|
43
|
+
class="relative"
|
|
44
|
+
style:width="{layer.image.width * scale * thumbScale}px"
|
|
45
|
+
style:height="{layer.image.height * scale * thumbScale}px"
|
|
46
|
+
style:transform={`translate(${-(layer.offsetX || 0) * scale * thumbScale}px, ${-(layer.offsetY || 0) * scale * thumbScale}px)`}
|
|
47
|
+
>
|
|
48
|
+
{#if imageLoaded}
|
|
49
|
+
<img
|
|
50
|
+
src={layer.image.src}
|
|
51
|
+
alt=""
|
|
52
|
+
crossorigin="anonymous"
|
|
53
|
+
class="pointer-events-none absolute h-full w-full object-fill"
|
|
54
|
+
draggable={false}
|
|
55
|
+
/>
|
|
56
|
+
{/if}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
{#if layer.borderWidth}
|
|
61
|
+
{@const borderWidth = layer.borderWidth * thumbScale}
|
|
62
|
+
{@const path = `M0,0L0,${height}L${width},${height}L${width},0L0,0`}
|
|
63
|
+
<div
|
|
64
|
+
class="pointer-events-none absolute left-0 top-0 origin-top-left"
|
|
65
|
+
style:width="{width}px"
|
|
66
|
+
style:height="{height}px"
|
|
67
|
+
>
|
|
68
|
+
<svg
|
|
69
|
+
class="absolute left-0 top-0 overflow-hidden"
|
|
70
|
+
preserveAspectRatio="none"
|
|
71
|
+
viewBox="0 0 {width} {height}"
|
|
72
|
+
style:width="{width}px"
|
|
73
|
+
style:height="{height}px"
|
|
74
|
+
>
|
|
75
|
+
<defs>
|
|
76
|
+
<clipPath id={layerBorderId}>
|
|
77
|
+
<path d={path}></path>
|
|
78
|
+
</clipPath>
|
|
79
|
+
</defs>
|
|
80
|
+
<path
|
|
81
|
+
d={roundedClipPath || path}
|
|
82
|
+
stroke={layer.borderColor || '#000000'}
|
|
83
|
+
stroke-width={borderWidth * 2}
|
|
84
|
+
stroke-linecap="butt"
|
|
85
|
+
clip-path="url(#{layerBorderId})"
|
|
86
|
+
fill="none"
|
|
87
|
+
vector-effect="non-scaling-stroke"
|
|
88
|
+
stroke-dasharray={layer.borderStyle !== 'solid'
|
|
89
|
+
? `${(layer.borderStyle === 'dashed' ? 3 : 1) * borderWidth},${borderWidth}`
|
|
90
|
+
: null}
|
|
91
|
+
>
|
|
92
|
+
</path>
|
|
93
|
+
</svg>
|
|
94
|
+
</div>
|
|
95
|
+
{/if}
|
|
96
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ImageLayer } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer: ImageLayer;
|
|
4
|
+
thumbScale?: number;
|
|
5
|
+
}
|
|
6
|
+
declare const ImageContent: import("svelte").Component<Props, {}, "layer">;
|
|
7
|
+
type ImageContent = ReturnType<typeof ImageContent>;
|
|
8
|
+
export default ImageContent;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ImageLayer } from '../../../types.js';
|
|
3
|
+
import { SideResizeControl } from '../../controls/side-resize-control/index.js';
|
|
4
|
+
import { CornerScaleControl } from '../../controls/corner-scale-control/index.js';
|
|
5
|
+
import { RotateControl } from '../../controls/rotate-control/index.js';
|
|
6
|
+
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
layer: ImageLayer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { layer = $bindable() }: Props = $props();
|
|
13
|
+
|
|
14
|
+
const editor = getPresentationEditorContext();
|
|
15
|
+
|
|
16
|
+
let scale = $derived(layer.scale || 1);
|
|
17
|
+
let rotate = $derived(layer.rotate || 0);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
class="pointer-events-none absolute left-0 top-0 h-full w-full"
|
|
22
|
+
style:width={`${layer.width * scale * editor.zoom}px`}
|
|
23
|
+
style:height={`${layer.height * scale * editor.zoom}px`}
|
|
24
|
+
style:transform={`translate(${layer.x * editor.zoom}px, ${layer.y * editor.zoom}px) rotate(${rotate}deg)`}
|
|
25
|
+
>
|
|
26
|
+
<div class="h-full w-full outline-none transition-opacity duration-300">
|
|
27
|
+
<div class="flex h-full w-full items-center justify-center">
|
|
28
|
+
<SideResizeControl origin="left" bind:layer />
|
|
29
|
+
<SideResizeControl origin="right" bind:layer />
|
|
30
|
+
<SideResizeControl origin="top" bind:layer />
|
|
31
|
+
<SideResizeControl origin="bottom" bind:layer />
|
|
32
|
+
<CornerScaleControl origin="bottom-right" bind:layer />
|
|
33
|
+
<CornerScaleControl origin="bottom-left" bind:layer />
|
|
34
|
+
<CornerScaleControl origin="top-right" bind:layer />
|
|
35
|
+
<CornerScaleControl origin="top-left" bind:layer />
|
|
36
|
+
<RotateControl bind:layer />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ImageLayer } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer: ImageLayer;
|
|
4
|
+
}
|
|
5
|
+
declare const ImageLayerActive: import("svelte").Component<Props, {}, "layer">;
|
|
6
|
+
type ImageLayerActive = ReturnType<typeof ImageLayerActive>;
|
|
7
|
+
export default ImageLayerActive;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ImageLayer } from '../../../types.js';
|
|
3
|
+
import { Separator } from '../../../../ui/separator/index.js';
|
|
4
|
+
import { BorderButton } from '../../buttons/border-button/index.js';
|
|
5
|
+
import { CornerRadiusButton } from '../../buttons/corner-radius-button/index.js';
|
|
6
|
+
import { FlipButton } from '../../buttons/flip-button/index.js';
|
|
7
|
+
import { OpacityButton } from '../../buttons/opacity-button/index.js';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
layer: ImageLayer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { layer = $bindable() }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<BorderButton bind:layer />
|
|
17
|
+
<CornerRadiusButton bind:layer />
|
|
18
|
+
<Separator orientation="vertical" />
|
|
19
|
+
<FlipButton bind:layer />
|
|
20
|
+
<Separator orientation="vertical" />
|
|
21
|
+
<OpacityButton bind:layer />
|
package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ImageLayer } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer: ImageLayer;
|
|
4
|
+
}
|
|
5
|
+
declare const ImageLayerButtons: import("svelte").Component<Props, {}, "layer">;
|
|
6
|
+
type ImageLayerButtons = ReturnType<typeof ImageLayerButtons>;
|
|
7
|
+
export default ImageLayerButtons;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ImageLayer } from '../../../types.js';
|
|
3
|
+
import ImageLayerContent from './image-content.svelte';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
layer: ImageLayer;
|
|
7
|
+
thumbScale: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { layer, thumbScale }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<ImageLayerContent {layer} {thumbScale} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ImageLayer } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer: ImageLayer;
|
|
4
|
+
thumbScale: number;
|
|
5
|
+
}
|
|
6
|
+
declare const ImageLayerThumb: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type ImageLayerThumb = ReturnType<typeof ImageLayerThumb>;
|
|
8
|
+
export default ImageLayerThumb;
|