@peteai/presentation-editor 0.0.6 → 0.0.8
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 +38 -38
- package/dist/components/editor/active-layers-buttons.svelte +56 -0
- package/dist/components/editor/active-layers.svelte +237 -0
- package/dist/components/editor/active-layers.svelte.d.ts +8 -0
- package/dist/components/{presentation-editor/cognition-slides.d.ts → editor/cognition-pages.d.ts} +1 -1
- package/dist/components/{presentation-editor/cognition-slides.js → editor/cognition-pages.js} +1 -1
- package/dist/components/{presentation-editor → editor}/cursor-tooltip.svelte +6 -2
- package/dist/components/editor/cursor-tooltip.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/dragged.svelte +7 -3
- package/dist/components/editor/dragged.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor/presentation-editor.svelte → editor/editor.svelte} +64 -61
- package/dist/components/editor/editor.svelte.d.ts +4 -0
- package/dist/components/editor/editor.svelte.js +1169 -0
- package/dist/components/editor/header.svelte +62 -0
- package/dist/components/editor/header.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/hotkeys.svelte +48 -16
- package/dist/components/editor/index.d.ts +3 -0
- package/dist/components/editor/index.js +3 -0
- package/dist/components/{presentation-editor → editor}/layers/active-background-border.svelte +2 -2
- package/dist/components/{presentation-editor → editor}/layers/active-layer-border.svelte +5 -8
- package/dist/components/editor/layers/buttons/border-button/border-button-colors.svelte +59 -0
- package/dist/components/editor/layers/buttons/border-button/border-button-colors.svelte.d.ts +9 -0
- package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/border-button.svelte +47 -65
- package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/corner-radius-button.svelte +24 -28
- package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/flip-button.svelte +11 -12
- package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/opacity-button.svelte +33 -44
- package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/corner-scale-control.svelte +27 -32
- package/dist/components/editor/layers/controls/group-resize-control/group-resize-control.svelte +418 -0
- package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/rotate-control.svelte +33 -34
- package/dist/components/editor/layers/controls/rotate-control/rotate-control.svelte.d.ts +6 -0
- package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte +22 -26
- package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/side-scale-control.svelte +13 -15
- package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/side-scale-control.svelte.d.ts +2 -2
- package/dist/components/editor/layers/index.d.ts +10 -0
- package/dist/components/{presentation-editor → editor}/layers/index.js +8 -5
- package/dist/components/{presentation-editor → editor}/layers/layer-button.svelte +14 -8
- package/dist/components/{presentation-editor → editor}/layers/layer-thumb-wrapper.svelte +5 -6
- package/dist/components/{presentation-editor → editor}/layers/layer-wrapper.svelte +46 -57
- package/dist/components/editor/layers/types/background/background-content-image.svelte +36 -0
- package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-buttons.svelte +6 -6
- package/dist/components/editor/layers/types/background/background-layer-content.svelte +21 -0
- package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-content.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer.svelte +7 -9
- package/dist/components/editor/layers/types/group/group-child-wrapper.svelte +44 -0
- package/dist/components/editor/layers/types/group/group-child-wrapper.svelte.d.ts +9 -0
- package/dist/components/editor/layers/types/group/group-layer-content.svelte +45 -0
- package/dist/components/editor/layers/types/group/group-layer-content.svelte.d.ts +9 -0
- package/dist/components/editor/layers/types/group/group-layer.svelte +33 -0
- package/dist/components/editor/layers/types/group/group-layer.svelte.d.ts +8 -0
- package/dist/components/editor/layers/types/group/index.d.ts +3 -0
- package/dist/components/editor/layers/types/group/index.js +3 -0
- package/dist/components/editor/layers/types/image/controls/image-rotate-control/image-rotate-control.svelte +120 -0
- package/dist/components/editor/layers/types/image/controls/image-rotate-control/image-rotate-control.svelte.d.ts +8 -0
- package/dist/components/editor/layers/types/image/controls/image-rotate-control/index.d.ts +2 -0
- package/dist/components/editor/layers/types/image/controls/image-rotate-control/index.js +4 -0
- package/dist/components/editor/layers/types/image/controls/image-scale-control/image-scale-control.svelte +154 -0
- package/dist/components/editor/layers/types/image/controls/image-scale-control/image-scale-control.svelte.d.ts +91 -0
- package/dist/components/editor/layers/types/image/controls/image-scale-control/index.d.ts +2 -0
- package/dist/components/editor/layers/types/image/controls/image-scale-control/index.js +4 -0
- package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte +10 -13
- package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte +15 -12
- package/dist/components/editor/layers/types/image/image-layer-crop.svelte +182 -0
- package/dist/components/editor/layers/types/image/image-layer-crop.svelte.d.ts +10 -0
- package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte +24 -14
- package/dist/components/editor/layers/types/image/index.d.ts +4 -0
- package/dist/components/editor/layers/types/image/index.js +4 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/alignment-button.svelte +13 -14
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/alignment-button.svelte.d.ts +2 -2
- package/dist/components/editor/layers/types/text/buttons/bold-button/bold-button.svelte +65 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/bold-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/case-button.svelte +24 -30
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/case-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/color-button.svelte +4 -4
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/color-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/font-family-button.svelte +4 -4
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/font-family-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/font-size-button.svelte +33 -40
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/font-size-button.svelte.d.ts +2 -2
- package/dist/components/editor/layers/types/text/buttons/italic-button/italic-button.svelte +65 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/italic-button.svelte.d.ts +2 -2
- package/dist/components/editor/layers/types/text/buttons/list-button/list-button.svelte +113 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/list-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/strikethrough-button.svelte +10 -11
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/strikethrough-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/underline-button.svelte +10 -11
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/underline-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/utils.d.ts +2 -0
- package/dist/components/editor/layers/types/text/editor/utils.js +166 -0
- package/dist/components/editor/layers/types/text/extensions/list/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/list/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/list/list.d.ts +67 -0
- package/dist/components/editor/layers/types/text/extensions/list/list.js +237 -0
- package/dist/components/editor/layers/types/text/extensions/list-item/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/list-item/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/list-item/list-item.d.ts +13 -0
- package/dist/components/editor/layers/types/text/extensions/list-item/list-item.js +262 -0
- package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/list-item-paragraph.d.ts +14 -0
- package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/list-item-paragraph.js +27 -0
- package/dist/components/editor/layers/types/text/extensions/paragraph/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/paragraph/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/paragraph/paragraph.d.ts +6 -0
- package/dist/components/editor/layers/types/text/extensions/paragraph/paragraph.js +28 -0
- package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/preserve-formatting-on-clear.d.ts +2 -0
- package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/preserve-formatting-on-clear.js +74 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/text-transform.js +1 -4
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions.js +13 -23
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/html-content.svelte +0 -9
- package/dist/components/editor/layers/types/text/index.d.ts +5 -0
- package/dist/components/editor/layers/types/text/index.js +5 -0
- package/dist/components/{presentation-editor/layers/types/html/html-layer-content.svelte → editor/layers/types/text/text-layer-content.svelte} +2 -2
- package/dist/components/editor/layers/types/text/text-layer-content.svelte.d.ts +9 -0
- package/dist/components/editor/layers/types/text/text-layer-edit.svelte +114 -0
- package/dist/components/editor/layers/types/text/text-layer-edit.svelte.d.ts +9 -0
- package/dist/components/editor/layers/types/text/text-layer.svelte +125 -0
- package/dist/components/editor/layers/types/text/text-layer.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/layers/utils.d.ts +32 -24
- package/dist/components/{presentation-editor → editor}/layers/utils.js +152 -102
- package/dist/components/{presentation-editor → editor}/menu/background-menu-content.svelte +24 -24
- package/dist/components/{presentation-editor → editor}/menu/background-menu-content.svelte.d.ts +4 -4
- package/dist/components/{presentation-editor → editor}/menu/layer-menu-content.svelte +62 -38
- package/dist/components/{presentation-editor/menu/slide-menu-content.svelte → editor/menu/page-menu-content.svelte} +19 -19
- package/dist/components/editor/menu/page-menu-content.svelte.d.ts +9 -0
- package/dist/components/{presentation-editor/slide-editor.svelte → editor/page-editor.svelte} +30 -25
- package/dist/components/editor/page-editor.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor/slide-inner.svelte → editor/page-inner.svelte} +5 -5
- package/dist/components/{presentation-editor/sidebar/sidebar.svelte.d.ts → editor/page-inner.svelte.d.ts} +3 -3
- package/dist/components/editor/page.svelte +69 -0
- package/dist/components/editor/page.svelte.d.ts +4 -0
- package/dist/components/editor/pages-navigation/page-preview.svelte +36 -0
- package/dist/components/editor/pages-navigation/page-preview.svelte.d.ts +8 -0
- package/dist/components/{presentation-editor/slides-navigation/slide-preview.svelte → editor/pages-navigation/pages-navigation-item.svelte} +21 -41
- package/dist/components/editor/pages-navigation/pages-navigation-item.svelte.d.ts +11 -0
- package/dist/components/{presentation-editor/slides-navigation/slides-navigation.svelte → editor/pages-navigation/pages-navigation.svelte} +26 -21
- package/dist/components/editor/pages-navigation/pages-navigation.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-color.svelte +1 -1
- package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte +2 -2
- package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar.svelte +92 -89
- package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar-button.svelte +3 -3
- package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar.svelte +34 -39
- package/dist/components/editor/sidebar/image-crop-sidebar.svelte +112 -0
- package/dist/components/editor/sidebar/image-crop-sidebar.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor/sidebar/position-slidebar.svelte → editor/sidebar/position-sidebar.svelte} +26 -20
- package/dist/components/editor/sidebar/position-sidebar.svelte.d.ts +3 -0
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab-button.svelte +5 -5
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab.svelte +5 -5
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar-uploads-tab.svelte +4 -4
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar-wrapper.svelte +6 -4
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar.svelte +17 -10
- package/dist/components/editor/sidebar/sidebar.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/sidebar/uploads-image.svelte +3 -3
- package/dist/components/editor/types.d.ts +283 -0
- package/dist/components/{presentation-editor → editor}/utils.d.ts +14 -6
- package/dist/components/{presentation-editor → editor}/utils.js +98 -63
- package/dist/components/ui/color-picker/color-picker.svelte +2 -2
- package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte +2 -2
- package/dist/components/ui/context-menu/context-menu-radio-item.svelte +1 -1
- package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/dialog/dialog-content.svelte +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +2 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/dropdown-menu/index.d.ts +1 -0
- package/dist/components/ui/slider/slider.svelte +28 -20
- package/dist/index.d.ts +12 -6
- package/dist/index.js +5 -3
- package/package.json +42 -38
- package/dist/components/presentation-editor/active-layers-buttons.svelte +0 -53
- package/dist/components/presentation-editor/active-layers.svelte +0 -181
- package/dist/components/presentation-editor/active-layers.svelte.d.ts +0 -3
- package/dist/components/presentation-editor/cursor-tooltip.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/dragged.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/header.svelte +0 -54
- package/dist/components/presentation-editor/header.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/index.d.ts +0 -2
- package/dist/components/presentation-editor/index.js +0 -2
- package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte +0 -337
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte.d.ts +0 -3
- package/dist/components/presentation-editor/layers/index.d.ts +0 -9
- package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte +0 -41
- package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte +0 -19
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte +0 -71
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte +0 -71
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte +0 -90
- package/dist/components/presentation-editor/layers/types/html/editor/utils.js +0 -88
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.d.ts +0 -3
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.js +0 -3
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.d.ts +0 -47
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.js +0 -74
- package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte.d.ts +0 -9
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte +0 -103
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte +0 -105
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/html/index.d.ts +0 -5
- package/dist/components/presentation-editor/layers/types/html/index.js +0 -5
- package/dist/components/presentation-editor/layers/types/image/index.d.ts +0 -3
- package/dist/components/presentation-editor/layers/types/image/index.js +0 -3
- package/dist/components/presentation-editor/menu/slide-menu-content.svelte.d.ts +0 -9
- package/dist/components/presentation-editor/presentation-editor.svelte.d.ts +0 -4
- package/dist/components/presentation-editor/presentation-editor.svelte.js +0 -813
- package/dist/components/presentation-editor/sidebar/position-slidebar.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/slide-editor.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/slide-inner.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte.d.ts +0 -11
- package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte.d.ts +0 -3
- package/dist/components/presentation-editor/types.d.ts +0 -158
- /package/dist/components/{presentation-editor → editor}/active-layers-buttons.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient-def.svelte +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient-def.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient.svelte +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator.svelte +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/fonts.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/fonts.js +0 -0
- /package/dist/components/{presentation-editor → editor}/hotkeys.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/active-background-border.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/active-layer-border.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/border-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/corner-radius-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/flip-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/opacity-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/corner-scale-control.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/group-resize-control.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/layer-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/layer-thumb-wrapper.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/layer-wrapper.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/background-content-image.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-buttons.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/Editor.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/Editor.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/createEditor.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/createEditor.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/editor-content.svelte +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/editor-content.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/types.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/types.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor.css +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/font-family.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/font-family.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/font-size.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/font-size.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/line-height.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/line-height.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/selection.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/selection.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/text-transform.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/html-content.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/menu/layer-menu-content.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-color.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-uploads-tab.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-wrapper.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/uploads-image.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/snapping-guides.svelte +0 -0
- /package/dist/components/{presentation-editor → editor}/snapping-guides.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/types.js +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
import type { ImageLayer } from '../../../../../types.js';
|
|
4
|
+
|
|
5
|
+
const cornerScaleControlVariants = tv({
|
|
6
|
+
slots: {
|
|
7
|
+
base: 'group absolute w-8 h-8 flex items-center justify-center pointer-events-none',
|
|
8
|
+
handler: 'absolute w-4 h-4 pointer-events-auto',
|
|
9
|
+
cursor: '',
|
|
10
|
+
},
|
|
11
|
+
variants: {
|
|
12
|
+
origin: {
|
|
13
|
+
'bottom-right': {
|
|
14
|
+
base: '-top-4 -left-4',
|
|
15
|
+
handler: '-translate-x-0.5 -translate-y-0.5 rounded-tl-full',
|
|
16
|
+
cursor: 'cursor-nwse-resize',
|
|
17
|
+
},
|
|
18
|
+
'bottom-left': {
|
|
19
|
+
base: '-top-4 -right-4',
|
|
20
|
+
handler: 'translate-x-0.5 -translate-y-0.5 rounded-tr-full',
|
|
21
|
+
cursor: 'cursor-nesw-resize',
|
|
22
|
+
},
|
|
23
|
+
'top-right': {
|
|
24
|
+
base: '-bottom-4 -left-4',
|
|
25
|
+
handler: '-translate-x-0.5 translate-y-0.5 rounded-bl-full',
|
|
26
|
+
cursor: 'cursor-nesw-resize',
|
|
27
|
+
},
|
|
28
|
+
'top-left': {
|
|
29
|
+
base: '-bottom-4 -right-4',
|
|
30
|
+
handler: 'translate-x-0.5 translate-y-0.5 rounded-br-full',
|
|
31
|
+
cursor: 'cursor-nwse-resize',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
type Variants = VariantProps<typeof cornerScaleControlVariants>;
|
|
38
|
+
|
|
39
|
+
interface Props extends Omit<Variants, 'origin'>, Required<Pick<Variants, 'origin'>> {
|
|
40
|
+
layer: ImageLayer;
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
import { cn } from '../../../../../../../utils.js';
|
|
46
|
+
import {
|
|
47
|
+
getImageLayerBboxRelativeToImageCenter,
|
|
48
|
+
calculateNewPosition,
|
|
49
|
+
degToRad,
|
|
50
|
+
rotatePoint,
|
|
51
|
+
} from '../../../../utils.js';
|
|
52
|
+
import { getEditorContext } from '../../../../../editor.svelte.js';
|
|
53
|
+
|
|
54
|
+
let { origin, layer }: Props = $props();
|
|
55
|
+
|
|
56
|
+
const type = `${origin}-origin-scale`;
|
|
57
|
+
|
|
58
|
+
const editor = getEditorContext();
|
|
59
|
+
|
|
60
|
+
let initial: {
|
|
61
|
+
clientX: number;
|
|
62
|
+
clientY: number;
|
|
63
|
+
layer: ImageLayer;
|
|
64
|
+
minScaleFactor: number;
|
|
65
|
+
} | null = null;
|
|
66
|
+
|
|
67
|
+
const { base, handler, cursor } = cornerScaleControlVariants({ origin });
|
|
68
|
+
|
|
69
|
+
const onMouseDown = (e: MouseEvent) => {
|
|
70
|
+
if (e.button !== 0) return;
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
console.log(type, 'mousedown', e);
|
|
74
|
+
|
|
75
|
+
const { minX, minY, maxX, maxY } = getImageLayerBboxRelativeToImageCenter(layer);
|
|
76
|
+
|
|
77
|
+
const minScaleFactor = Math.max(
|
|
78
|
+
~origin.indexOf('left') ? 0.5 + maxX / layer.image.width : 0.5 - minX / layer.image.width,
|
|
79
|
+
~origin.indexOf('top') ? 0.5 + maxY / layer.image.height : 0.5 - minY / layer.image.height,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
initial = {
|
|
83
|
+
clientX: e.clientX,
|
|
84
|
+
clientY: e.clientY,
|
|
85
|
+
layer: $state.snapshot(layer),
|
|
86
|
+
minScaleFactor,
|
|
87
|
+
};
|
|
88
|
+
addEventListener('mousemove', onMouseMove);
|
|
89
|
+
addEventListener('mouseup', onMouseUp);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const onMouseUp = (e: MouseEvent) => {
|
|
93
|
+
console.log(type, 'mouseup', e);
|
|
94
|
+
removeEventListener('mousemove', onMouseMove);
|
|
95
|
+
removeEventListener('mouseup', onMouseUp);
|
|
96
|
+
initial = null;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const onMouseMove = (e: MouseEvent) => {
|
|
100
|
+
if (!initial) return;
|
|
101
|
+
|
|
102
|
+
const { x, y, width, height, scale, rotate, image, imageRotate, offsetX, offsetY } =
|
|
103
|
+
initial.layer;
|
|
104
|
+
const imageX = x + offsetX * scale;
|
|
105
|
+
const imageY = y + offsetY * scale;
|
|
106
|
+
const rad = degToRad(rotate + imageRotate);
|
|
107
|
+
const xDiff = (e.clientX - initial.clientX) / editor.zoom;
|
|
108
|
+
const yDiff = (e.clientY - initial.clientY) / editor.zoom;
|
|
109
|
+
const adjustedXDiff = xDiff * Math.cos(rad) + yDiff * Math.sin(rad);
|
|
110
|
+
const adjustedYDiff = -xDiff * Math.sin(rad) + yDiff * Math.cos(rad);
|
|
111
|
+
|
|
112
|
+
// Define the new x2 and y2 coordinates based on the variant (corner being dragged)
|
|
113
|
+
const x2 = imageX + image.width * scale + adjustedXDiff * (~origin.indexOf('left') ? 1 : -1);
|
|
114
|
+
const y2 = imageY + image.height * scale + adjustedYDiff * (~origin.indexOf('top') ? 1 : -1);
|
|
115
|
+
|
|
116
|
+
// Calculate the slope of the rectangle
|
|
117
|
+
const slope = image.height / image.width;
|
|
118
|
+
|
|
119
|
+
// Calculate the x-coordinate of the intersection point
|
|
120
|
+
const xIntersect = (y2 + x2 / slope - imageY + imageX * slope) / (slope + 1 / slope);
|
|
121
|
+
|
|
122
|
+
let scaleFactor = Math.max(
|
|
123
|
+
(xIntersect - imageX) / (image.width * scale),
|
|
124
|
+
initial.minScaleFactor,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
if (scaleFactor > 0) {
|
|
128
|
+
const { newX, newY } = calculateNewPosition(
|
|
129
|
+
origin,
|
|
130
|
+
{ ...image, x: offsetX, y: offsetY, rotate: imageRotate, scale: 1 },
|
|
131
|
+
image.width * scaleFactor,
|
|
132
|
+
image.height * scaleFactor,
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const newProps = {
|
|
136
|
+
scale: scale * scaleFactor,
|
|
137
|
+
width: width / scaleFactor,
|
|
138
|
+
height: height / scaleFactor,
|
|
139
|
+
offsetX: newX / scaleFactor,
|
|
140
|
+
offsetY: newY / scaleFactor,
|
|
141
|
+
};
|
|
142
|
+
Object.assign(layer, newProps);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<div class={base()}>
|
|
148
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
149
|
+
<div class={cn(handler(), cursor())} onmousedown={onMouseDown}></div>
|
|
150
|
+
<div
|
|
151
|
+
class="group-hover:bg-primary group-active:bg-primary h-3 w-3 rounded-full bg-white transition-colors"
|
|
152
|
+
style:box-shadow="0 0 4px 1px rgba(57,76,96,.15), 0 0 0 1px rgba(43,59,74,.3)"
|
|
153
|
+
></div>
|
|
154
|
+
</div>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
import type { ImageLayer } from '../../../../../types.js';
|
|
3
|
+
declare const cornerScaleControlVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
origin: {
|
|
5
|
+
'bottom-right': {
|
|
6
|
+
base: string;
|
|
7
|
+
handler: string;
|
|
8
|
+
cursor: string;
|
|
9
|
+
};
|
|
10
|
+
'bottom-left': {
|
|
11
|
+
base: string;
|
|
12
|
+
handler: string;
|
|
13
|
+
cursor: string;
|
|
14
|
+
};
|
|
15
|
+
'top-right': {
|
|
16
|
+
base: string;
|
|
17
|
+
handler: string;
|
|
18
|
+
cursor: string;
|
|
19
|
+
};
|
|
20
|
+
'top-left': {
|
|
21
|
+
base: string;
|
|
22
|
+
handler: string;
|
|
23
|
+
cursor: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}, {
|
|
27
|
+
base: string;
|
|
28
|
+
handler: string;
|
|
29
|
+
cursor: string;
|
|
30
|
+
}, undefined, {
|
|
31
|
+
origin: {
|
|
32
|
+
'bottom-right': {
|
|
33
|
+
base: string;
|
|
34
|
+
handler: string;
|
|
35
|
+
cursor: string;
|
|
36
|
+
};
|
|
37
|
+
'bottom-left': {
|
|
38
|
+
base: string;
|
|
39
|
+
handler: string;
|
|
40
|
+
cursor: string;
|
|
41
|
+
};
|
|
42
|
+
'top-right': {
|
|
43
|
+
base: string;
|
|
44
|
+
handler: string;
|
|
45
|
+
cursor: string;
|
|
46
|
+
};
|
|
47
|
+
'top-left': {
|
|
48
|
+
base: string;
|
|
49
|
+
handler: string;
|
|
50
|
+
cursor: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
base: string;
|
|
55
|
+
handler: string;
|
|
56
|
+
cursor: string;
|
|
57
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
58
|
+
origin: {
|
|
59
|
+
'bottom-right': {
|
|
60
|
+
base: string;
|
|
61
|
+
handler: string;
|
|
62
|
+
cursor: string;
|
|
63
|
+
};
|
|
64
|
+
'bottom-left': {
|
|
65
|
+
base: string;
|
|
66
|
+
handler: string;
|
|
67
|
+
cursor: string;
|
|
68
|
+
};
|
|
69
|
+
'top-right': {
|
|
70
|
+
base: string;
|
|
71
|
+
handler: string;
|
|
72
|
+
cursor: string;
|
|
73
|
+
};
|
|
74
|
+
'top-left': {
|
|
75
|
+
base: string;
|
|
76
|
+
handler: string;
|
|
77
|
+
cursor: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
base: string;
|
|
82
|
+
handler: string;
|
|
83
|
+
cursor: string;
|
|
84
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
85
|
+
type Variants = VariantProps<typeof cornerScaleControlVariants>;
|
|
86
|
+
interface Props extends Omit<Variants, 'origin'>, Required<Pick<Variants, 'origin'>> {
|
|
87
|
+
layer: ImageLayer;
|
|
88
|
+
}
|
|
89
|
+
declare const ImageScaleControl: import("svelte").Component<Props, {}, "">;
|
|
90
|
+
type ImageScaleControl = ReturnType<typeof ImageScaleControl>;
|
|
91
|
+
export default ImageScaleControl;
|
package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { SideResizeControl } from '../../controls/side-resize-control/index.js';
|
|
4
4
|
import { CornerScaleControl } from '../../controls/corner-scale-control/index.js';
|
|
5
5
|
import { RotateControl } from '../../controls/rotate-control/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getEditorContext } from '../../../editor.svelte.js';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
layer: ImageLayer;
|
|
@@ -11,17 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
let { layer = $bindable() }: Props = $props();
|
|
13
13
|
|
|
14
|
-
const editor =
|
|
15
|
-
|
|
16
|
-
let scale = $derived(layer.scale || 1);
|
|
17
|
-
let rotate = $derived(layer.rotate || 0);
|
|
14
|
+
const editor = getEditorContext();
|
|
18
15
|
</script>
|
|
19
16
|
|
|
20
17
|
<div
|
|
21
18
|
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)`}
|
|
19
|
+
style:width={`${layer.width * layer.scale * editor.zoom}px`}
|
|
20
|
+
style:height={`${layer.height * layer.scale * editor.zoom}px`}
|
|
21
|
+
style:transform={`translate(${layer.x * editor.zoom}px, ${layer.y * editor.zoom}px) rotate(${layer.rotate}deg)`}
|
|
25
22
|
>
|
|
26
23
|
<div class="h-full w-full outline-none transition-opacity duration-300">
|
|
27
24
|
<div class="flex h-full w-full items-center justify-center">
|
|
@@ -29,11 +26,11 @@
|
|
|
29
26
|
<SideResizeControl origin="right" bind:layer />
|
|
30
27
|
<SideResizeControl origin="top" bind:layer />
|
|
31
28
|
<SideResizeControl origin="bottom" bind:layer />
|
|
32
|
-
<CornerScaleControl origin="bottom-right"
|
|
33
|
-
<CornerScaleControl origin="bottom-left"
|
|
34
|
-
<CornerScaleControl origin="top-right"
|
|
35
|
-
<CornerScaleControl origin="top-left"
|
|
36
|
-
<RotateControl
|
|
29
|
+
<CornerScaleControl origin="bottom-right" />
|
|
30
|
+
<CornerScaleControl origin="bottom-left" />
|
|
31
|
+
<CornerScaleControl origin="top-right" />
|
|
32
|
+
<CornerScaleControl origin="top-left" />
|
|
33
|
+
<RotateControl />
|
|
37
34
|
</div>
|
|
38
35
|
</div>
|
|
39
36
|
</div>
|
package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte
RENAMED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { ImageLayer } from '../../../types.js';
|
|
3
3
|
import ColorIndicatorGradientDef from '../../../color-indicator/color-indicator-gradient-def.svelte';
|
|
4
4
|
import { generateId } from '../../../../../utils.js';
|
|
5
|
+
import { onMount } from 'svelte';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
layer: ImageLayer;
|
|
@@ -11,10 +12,12 @@
|
|
|
11
12
|
let { layer, thumbScale = 1 }: Props = $props();
|
|
12
13
|
|
|
13
14
|
let imageLoaded = $state(false);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
onMount(() => {
|
|
16
|
+
const image = new Image();
|
|
17
|
+
image.crossOrigin = 'anonymous';
|
|
18
|
+
image.src = layer.image.src;
|
|
19
|
+
image.onload = () => (imageLoaded = true);
|
|
20
|
+
});
|
|
18
21
|
|
|
19
22
|
const layerBorderId = generateId();
|
|
20
23
|
const gradientId = generateId();
|
|
@@ -22,14 +25,14 @@
|
|
|
22
25
|
let borderColor = $derived(layer.borderColor || '#000000');
|
|
23
26
|
let isGradient = $derived(~borderColor.indexOf(':'));
|
|
24
27
|
|
|
25
|
-
let scale = $derived(layer.scale
|
|
26
|
-
let width = $derived(layer.width * scale
|
|
27
|
-
let height = $derived(layer.height * scale
|
|
28
|
+
let scale = $derived(layer.scale * thumbScale);
|
|
29
|
+
let width = $derived(layer.width * scale);
|
|
30
|
+
let height = $derived(layer.height * scale);
|
|
28
31
|
let flipTransform = $derived(
|
|
29
32
|
layer.flipX || layer.flipY ? `scale(${layer.flipX ? -1 : 1}, ${layer.flipY ? -1 : 1})` : null,
|
|
30
33
|
);
|
|
31
34
|
|
|
32
|
-
let cornderRadius = $derived((layer.cornerRadius
|
|
35
|
+
let cornderRadius = $derived(Math.min(layer.cornerRadius * thumbScale, width / 2, height / 2));
|
|
33
36
|
|
|
34
37
|
const bezier = 0.447715;
|
|
35
38
|
let roundedClipPath = $derived(
|
|
@@ -46,9 +49,9 @@
|
|
|
46
49
|
<div class="h-full w-full transition-transform" style:transform={flipTransform}>
|
|
47
50
|
<div
|
|
48
51
|
class="relative"
|
|
49
|
-
style:width="{layer.image.width * scale
|
|
50
|
-
style:height="{layer.image.height * scale
|
|
51
|
-
style:transform={`translate(${
|
|
52
|
+
style:width="{layer.image.width * scale}px"
|
|
53
|
+
style:height="{layer.image.height * scale}px"
|
|
54
|
+
style:transform={`translate(${layer.offsetX * scale}px, ${layer.offsetY * scale}px) rotate(${layer.imageRotate}deg)`}
|
|
52
55
|
>
|
|
53
56
|
{#if imageLoaded}
|
|
54
57
|
<img
|
|
@@ -82,7 +85,7 @@
|
|
|
82
85
|
<ColorIndicatorGradientDef id={gradientId} color={borderColor} {width} {height} />
|
|
83
86
|
{/if}
|
|
84
87
|
<clipPath id={layerBorderId}>
|
|
85
|
-
<path d={path}></path>
|
|
88
|
+
<path d={roundedClipPath || path}></path>
|
|
86
89
|
</clipPath>
|
|
87
90
|
</defs>
|
|
88
91
|
<path
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import type { ImageLayer } from '../../../types.js';
|
|
4
|
+
import { getEditorContext } from '../../../editor.svelte.js';
|
|
5
|
+
import ImageLayerContent from './image-layer-content.svelte';
|
|
6
|
+
import { ImageScaleControl } from './controls/image-scale-control/index.js';
|
|
7
|
+
import { ImageRotateControl } from './controls/image-rotate-control/index.js';
|
|
8
|
+
import { getImageLayerBboxRelativeToImageCenter, degToRad, rotatePoint } from '../../utils.js';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
layer: ImageLayer;
|
|
12
|
+
viewportRef: HTMLDivElement;
|
|
13
|
+
wrapperRef: HTMLDivElement;
|
|
14
|
+
pageRef: HTMLDivElement;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { layer, viewportRef, wrapperRef, pageRef }: Props = $props();
|
|
18
|
+
|
|
19
|
+
const editor = getEditorContext();
|
|
20
|
+
|
|
21
|
+
let overlayRef: HTMLDivElement | null = $state(null);
|
|
22
|
+
|
|
23
|
+
let imageTransform = $derived.by(() => {
|
|
24
|
+
const rad = degToRad(layer.rotate);
|
|
25
|
+
|
|
26
|
+
const layerCenter = {
|
|
27
|
+
x: layer.x + (layer.width * layer.scale) / 2,
|
|
28
|
+
y: layer.y + (layer.height * layer.scale) / 2,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const relativeCenter = {
|
|
32
|
+
x: layer.x + (layer.offsetX + layer.image.width / 2) * layer.scale,
|
|
33
|
+
y: layer.y + (layer.offsetY + layer.image.height / 2) * layer.scale,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const center = rotatePoint(rad, relativeCenter, layerCenter);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
x: center.x - (layer.image.width * layer.scale) / 2,
|
|
40
|
+
y: center.y - (layer.image.height * layer.scale) / 2,
|
|
41
|
+
width: layer.image.width,
|
|
42
|
+
height: layer.image.height,
|
|
43
|
+
rotate: layer.imageRotate + layer.rotate,
|
|
44
|
+
scale: layer.scale,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const updateOverlay = () => {
|
|
49
|
+
if (overlayRef) {
|
|
50
|
+
const viewportRect = viewportRef.getBoundingClientRect();
|
|
51
|
+
const wrapperRect = wrapperRef.getBoundingClientRect();
|
|
52
|
+
const pageRect = pageRef.getBoundingClientRect();
|
|
53
|
+
|
|
54
|
+
overlayRef.style.left = `${viewportRect.left - viewportRef.scrollLeft - pageRect.left}px`;
|
|
55
|
+
overlayRef.style.top = `${viewportRect.top - viewportRef.scrollTop - pageRect.top}px`;
|
|
56
|
+
overlayRef.style.width = `${wrapperRect.width > viewportRect.width ? wrapperRect.width : viewportRect.width}px`;
|
|
57
|
+
overlayRef.style.height = `${wrapperRect.height > viewportRect.height ? wrapperRect.height : viewportRect.height}px`;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
$effect(() => {
|
|
62
|
+
editor.zoom;
|
|
63
|
+
updateOverlay();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
onMount(() => {
|
|
67
|
+
const observer = new ResizeObserver(updateOverlay);
|
|
68
|
+
|
|
69
|
+
if (viewportRef) observer.observe(viewportRef);
|
|
70
|
+
|
|
71
|
+
return () => observer.disconnect();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
let initial: {
|
|
75
|
+
clientX: number;
|
|
76
|
+
clientY: number;
|
|
77
|
+
layer: ImageLayer;
|
|
78
|
+
minImageXDiff: number;
|
|
79
|
+
minImageYDiff: number;
|
|
80
|
+
maxImageXDiff: number;
|
|
81
|
+
maxImageYDiff: number;
|
|
82
|
+
} | null = null;
|
|
83
|
+
|
|
84
|
+
const onMouseDown = (e: MouseEvent) => {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
|
|
88
|
+
const { minX, minY, maxX, maxY } = getImageLayerBboxRelativeToImageCenter(layer);
|
|
89
|
+
|
|
90
|
+
initial = {
|
|
91
|
+
clientX: e.clientX,
|
|
92
|
+
clientY: e.clientY,
|
|
93
|
+
layer: $state.snapshot(layer),
|
|
94
|
+
minImageXDiff: maxX - layer.image.width / 2,
|
|
95
|
+
minImageYDiff: maxY - layer.image.height / 2,
|
|
96
|
+
maxImageXDiff: layer.image.width / 2 + minX,
|
|
97
|
+
maxImageYDiff: layer.image.height / 2 + minY,
|
|
98
|
+
};
|
|
99
|
+
addEventListener('mousemove', onMouseMove);
|
|
100
|
+
addEventListener('mouseup', onMouseUp);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const onMouseUp = (e: MouseEvent) => {
|
|
104
|
+
removeEventListener('mousemove', onMouseMove);
|
|
105
|
+
removeEventListener('mouseup', onMouseUp);
|
|
106
|
+
initial = null;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const onMouseMove = (e: MouseEvent) => {
|
|
110
|
+
if (!initial) return;
|
|
111
|
+
const { scale, rotate, imageRotate, offsetX, offsetY } = initial.layer;
|
|
112
|
+
|
|
113
|
+
const xDiff = (e.clientX - initial.clientX) / scale / editor.zoom;
|
|
114
|
+
const yDiff = (e.clientY - initial.clientY) / scale / editor.zoom;
|
|
115
|
+
|
|
116
|
+
const imageRad = degToRad(rotate + imageRotate);
|
|
117
|
+
|
|
118
|
+
const imageXDiff2 = Math.min(
|
|
119
|
+
Math.max(xDiff * Math.cos(imageRad) + yDiff * Math.sin(imageRad), initial.minImageXDiff),
|
|
120
|
+
initial.maxImageXDiff,
|
|
121
|
+
);
|
|
122
|
+
const imageYDiff2 = Math.min(
|
|
123
|
+
Math.max(-xDiff * Math.sin(imageRad) + yDiff * Math.cos(imageRad), initial.minImageYDiff),
|
|
124
|
+
initial.maxImageYDiff,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const rad = degToRad(-imageRotate);
|
|
128
|
+
|
|
129
|
+
const adjustedXDiff = imageXDiff2 * Math.cos(rad) + imageYDiff2 * Math.sin(rad);
|
|
130
|
+
const adjustedYDiff = -imageXDiff2 * Math.sin(rad) + imageYDiff2 * Math.cos(rad);
|
|
131
|
+
|
|
132
|
+
Object.assign(layer, {
|
|
133
|
+
offsetX: offsetX + adjustedXDiff,
|
|
134
|
+
offsetY: offsetY + adjustedYDiff,
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<div class="select-none">
|
|
140
|
+
<div bind:this={overlayRef} class="absolute bg-slate-500/50"></div>
|
|
141
|
+
<div
|
|
142
|
+
class="absolute opacity-50"
|
|
143
|
+
style:width={`${layer.image.width * layer.scale * editor.zoom}px`}
|
|
144
|
+
style:height={`${layer.image.height * layer.scale * editor.zoom}px`}
|
|
145
|
+
style:transform={`translate(${imageTransform.x * editor.zoom}px, ${imageTransform.y * editor.zoom}px) rotate(${imageTransform.rotate}deg)`}
|
|
146
|
+
>
|
|
147
|
+
<img class="pointer-events-none h-full w-full" src={layer.image.src} alt="" />
|
|
148
|
+
</div>
|
|
149
|
+
<div
|
|
150
|
+
class="absolute overflow-hidden"
|
|
151
|
+
style:width={`${layer.width * layer.scale * editor.zoom}px`}
|
|
152
|
+
style:height={`${layer.height * layer.scale * editor.zoom}px`}
|
|
153
|
+
style:transform={`translate(${layer.x * editor.zoom}px, ${layer.y * editor.zoom}px) rotate(${layer.rotate}deg)`}
|
|
154
|
+
>
|
|
155
|
+
<ImageLayerContent {layer} thumbScale={editor.zoom} />
|
|
156
|
+
</div>
|
|
157
|
+
<div class="pointer-events-auto">
|
|
158
|
+
<div
|
|
159
|
+
class="shadow-inner-1 outline-primary/50 pointer-events-none absolute outline outline-2"
|
|
160
|
+
style:width={`${layer.image.width * layer.scale * editor.zoom}px`}
|
|
161
|
+
style:height={`${layer.image.height * layer.scale * editor.zoom}px`}
|
|
162
|
+
style:transform={`translate(${imageTransform.x * editor.zoom}px, ${imageTransform.y * editor.zoom}px) rotate(${imageTransform.rotate}deg)`}
|
|
163
|
+
>
|
|
164
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
165
|
+
<div
|
|
166
|
+
class="pointer-events-auto absolute -inset-3 cursor-move"
|
|
167
|
+
onmousedown={onMouseDown}
|
|
168
|
+
></div>
|
|
169
|
+
<ImageScaleControl origin="bottom-right" {layer} />
|
|
170
|
+
<ImageScaleControl origin="bottom-left" {layer} />
|
|
171
|
+
<ImageScaleControl origin="top-right" {layer} />
|
|
172
|
+
<ImageScaleControl origin="top-left" {layer} />
|
|
173
|
+
<ImageRotateControl {pageRef} {layer} />
|
|
174
|
+
</div>
|
|
175
|
+
<div
|
|
176
|
+
class="outline-primary pointer-events-none absolute outline outline-2"
|
|
177
|
+
style:width={`${layer.width * layer.scale * editor.zoom}px`}
|
|
178
|
+
style:height={`${layer.height * layer.scale * editor.zoom}px`}
|
|
179
|
+
style:transform={`translate(${layer.x * editor.zoom}px, ${layer.y * editor.zoom}px) rotate(${layer.rotate}deg)`}
|
|
180
|
+
></div>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ImageLayer } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer: ImageLayer;
|
|
4
|
+
viewportRef: HTMLDivElement;
|
|
5
|
+
wrapperRef: HTMLDivElement;
|
|
6
|
+
pageRef: HTMLDivElement;
|
|
7
|
+
}
|
|
8
|
+
declare const ImageLayerCrop: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type ImageLayerCrop = ReturnType<typeof ImageLayerCrop>;
|
|
10
|
+
export default ImageLayerCrop;
|
package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte
RENAMED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Image, ImageLayer } from '../../../types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getEditorContext } from '../../../editor.svelte.js';
|
|
4
4
|
import ImageLayerContent from './image-layer-content.svelte';
|
|
5
|
-
import {
|
|
6
|
-
calculateBoundingBox,
|
|
7
|
-
calculateImageCover,
|
|
8
|
-
calculateLayerTransform,
|
|
9
|
-
} from '../../utils.js';
|
|
5
|
+
import { calculateBoundingBox, calculateImageCover } from '../../utils.js';
|
|
10
6
|
|
|
11
7
|
interface Props {
|
|
12
8
|
layer: ImageLayer;
|
|
@@ -14,20 +10,21 @@
|
|
|
14
10
|
|
|
15
11
|
let { layer = $bindable() }: Props = $props();
|
|
16
12
|
|
|
17
|
-
const editor =
|
|
13
|
+
const editor = getEditorContext();
|
|
14
|
+
|
|
15
|
+
let isCropping = $derived(editor.imageCropLayer?.id === layer.id);
|
|
18
16
|
|
|
19
17
|
let layerSubstitute: ImageLayer | null = $state(null);
|
|
20
18
|
|
|
21
19
|
let ref: HTMLDivElement;
|
|
22
20
|
|
|
23
21
|
const buildImageDropChanges = (image: Image) => {
|
|
24
|
-
const scale = layer.scale || 1;
|
|
25
|
-
|
|
26
22
|
return {
|
|
27
23
|
image,
|
|
24
|
+
imageRotate: 0,
|
|
28
25
|
...calculateImageCover(image, {
|
|
29
|
-
width: layer.width * scale,
|
|
30
|
-
height: layer.height * scale,
|
|
26
|
+
width: layer.width * layer.scale,
|
|
27
|
+
height: layer.height * layer.scale,
|
|
31
28
|
}),
|
|
32
29
|
};
|
|
33
30
|
};
|
|
@@ -79,14 +76,14 @@
|
|
|
79
76
|
);
|
|
80
77
|
Object.assign(layer, redo);
|
|
81
78
|
editor.historyPush({
|
|
82
|
-
type: '
|
|
83
|
-
|
|
79
|
+
type: 'layerUpdate',
|
|
80
|
+
pageId: editor.activePage.id,
|
|
84
81
|
layer: { id: layer.id, type: layer.type },
|
|
85
82
|
undo,
|
|
86
83
|
redo,
|
|
87
84
|
});
|
|
88
85
|
} else {
|
|
89
|
-
const bbox = calculateBoundingBox(
|
|
86
|
+
const bbox = calculateBoundingBox(layer);
|
|
90
87
|
const rect = ref.getBoundingClientRect();
|
|
91
88
|
const x = (e.clientX - rect.left - dragged.offsetX) / editor.zoom + bbox.x;
|
|
92
89
|
const y = (e.clientY - rect.top - dragged.offsetY) / editor.zoom + bbox.y;
|
|
@@ -95,12 +92,25 @@
|
|
|
95
92
|
}
|
|
96
93
|
layerSubstitute = null;
|
|
97
94
|
};
|
|
95
|
+
|
|
96
|
+
const onDoubleClick = () => {
|
|
97
|
+
if (editor.activeLayers.length > 1) return;
|
|
98
|
+
editor.imageCropLayer = $state.snapshot(
|
|
99
|
+
editor.activeGroupAndChild
|
|
100
|
+
? (editor.getAbsoluteGroupLayers(editor.activeGroupAndChild.groupLayer, [
|
|
101
|
+
layer,
|
|
102
|
+
])[0] as ImageLayer)
|
|
103
|
+
: layer,
|
|
104
|
+
);
|
|
105
|
+
};
|
|
98
106
|
</script>
|
|
99
107
|
|
|
100
108
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
101
109
|
<div
|
|
102
110
|
bind:this={ref}
|
|
103
111
|
class="h-full w-full"
|
|
112
|
+
style:opacity={isCropping ? 0 : null}
|
|
113
|
+
ondblclick={onDoubleClick}
|
|
104
114
|
ondragenter={onDragEnter}
|
|
105
115
|
ondragover={onDragOver}
|
|
106
116
|
ondragleave={onDragLeave}
|