@peteai/presentation-editor 0.0.6 → 0.0.7
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/{presentation-editor → editor}/active-layers.svelte +89 -48
- 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} +53 -48
- package/dist/components/editor/editor.svelte.d.ts +4 -0
- package/dist/components/editor/editor.svelte.js +1167 -0
- package/dist/components/{presentation-editor → editor}/header.svelte +11 -7
- package/dist/components/editor/header.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/hotkeys.svelte +41 -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 +32 -38
- 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 +27 -34
- package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte +9 -13
- 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/{presentation-editor → editor}/layers/index.d.ts +3 -2
- package/dist/components/{presentation-editor → editor}/layers/index.js +6 -3
- 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/{presentation-editor → editor}/layers/types/background/background-content-image.svelte +2 -2
- 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 +5 -7
- 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/{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 +14 -11
- package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte +8 -14
- 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 +264 -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 +9 -16
- package/dist/components/{presentation-editor → editor}/layers/utils.js +65 -68
- 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} +25 -24
- 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/{presentation-editor/sidebar/position-slidebar.svelte → editor/sidebar/position-sidebar.svelte} +28 -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 +11 -7
- 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 +282 -0
- package/dist/components/{presentation-editor → editor}/utils.d.ts +14 -6
- package/dist/components/{presentation-editor → editor}/utils.js +97 -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/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.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/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/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}/active-layers.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/rotate-control/rotate-control.svelte.d.ts +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 → editor}/layers/types/image/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/index.js +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
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import RotateIcon from 'lucide
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
calculateGroupRotatedBoundingBox,
|
|
6
|
-
calculateLayerTransform,
|
|
7
|
-
type Transform,
|
|
8
|
-
} from '../../utils.js';
|
|
2
|
+
import RotateIcon from '@lucide/svelte/icons/refresh-cw';
|
|
3
|
+
import { getEditorContext } from '../../../editor.svelte.js';
|
|
4
|
+
import { calculateGroupRotatedBoundingBox, type Transform } from '../../utils.js';
|
|
9
5
|
import type { Layer } from '../../../types.js';
|
|
10
6
|
|
|
11
7
|
const type = 'rotate';
|
|
12
8
|
|
|
13
|
-
const editor =
|
|
9
|
+
const editor = getEditorContext();
|
|
14
10
|
|
|
15
11
|
let element: HTMLElement | null = $state(null);
|
|
16
12
|
|
|
@@ -46,13 +42,11 @@
|
|
|
46
42
|
initial = {
|
|
47
43
|
clientX: e.clientX,
|
|
48
44
|
clientY: e.clientY,
|
|
49
|
-
bbox:
|
|
45
|
+
bbox: $state.snapshot(
|
|
50
46
|
editor.activeLayers.length === 1
|
|
51
|
-
?
|
|
52
|
-
: calculateGroupRotatedBoundingBox(
|
|
53
|
-
|
|
54
|
-
editor.activeGroupRotate,
|
|
55
|
-
),
|
|
47
|
+
? editor.activeLayers[0]
|
|
48
|
+
: calculateGroupRotatedBoundingBox(editor.activeLayers, editor.activeGroupRotate),
|
|
49
|
+
),
|
|
56
50
|
layers: editor.activeLayers.map((layer) => ({ ...layer, state: layer })),
|
|
57
51
|
};
|
|
58
52
|
editor.activeAction = { id: actionId, type, cursor: 'cursor-grabbing' };
|
|
@@ -70,41 +64,40 @@
|
|
|
70
64
|
editor.activeAction = null;
|
|
71
65
|
if (!initial || currentRotate === initial.bbox.rotate) return;
|
|
72
66
|
|
|
73
|
-
editor.historyPush(
|
|
74
|
-
|
|
75
|
-
actions: initial.layers.map((layer) => {
|
|
67
|
+
editor.historyPush(
|
|
68
|
+
initial.layers.map((layer) => {
|
|
76
69
|
if (editor.isLayerOutOfBounds(layer.state)) {
|
|
77
70
|
return {
|
|
78
|
-
type: '
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
type: 'layerRemove',
|
|
72
|
+
pageId: editor.activePage.id,
|
|
73
|
+
layer,
|
|
81
74
|
};
|
|
82
75
|
} else {
|
|
83
76
|
return {
|
|
84
|
-
type: '
|
|
85
|
-
|
|
77
|
+
type: 'layerUpdate',
|
|
78
|
+
pageId: editor.activePage.id,
|
|
86
79
|
layer: { id: layer.id, type: layer.type },
|
|
87
80
|
undo: { x: layer.x, y: layer.y, rotate: layer.rotate },
|
|
88
81
|
redo: { x: layer.state.x, y: layer.state.y, rotate: layer.state.rotate },
|
|
89
82
|
};
|
|
90
83
|
}
|
|
91
84
|
}),
|
|
92
|
-
|
|
85
|
+
);
|
|
93
86
|
};
|
|
94
87
|
|
|
95
88
|
const onMouseMove = (e: MouseEvent) => {
|
|
96
89
|
if (!initial || editor.activeAction?.id !== actionId || !element) return;
|
|
97
90
|
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
91
|
+
const pageClientRect = element.closest('[data-page-container]')?.getBoundingClientRect();
|
|
92
|
+
if (!pageClientRect) return;
|
|
100
93
|
|
|
101
|
-
const { x:
|
|
94
|
+
const { x: pageX, y: pageY } = pageClientRect;
|
|
102
95
|
|
|
103
|
-
const { width, height, x, y, rotate } = initial.bbox;
|
|
96
|
+
const { width, height, x, y, rotate, scale } = initial.bbox;
|
|
104
97
|
|
|
105
98
|
// Calculate the center of the layer
|
|
106
|
-
const clientX =
|
|
107
|
-
const clientY =
|
|
99
|
+
const clientX = pageX + x * editor.zoom + (width * scale * editor.zoom) / 2;
|
|
100
|
+
const clientY = pageY + y * editor.zoom + (height * scale * editor.zoom) / 2;
|
|
108
101
|
|
|
109
102
|
// Calculate the current angle based on the current mouse position relative to the center of the layer
|
|
110
103
|
const currentAngle = Math.atan2(
|
|
@@ -134,10 +127,10 @@
|
|
|
134
127
|
const centerY = y + height / 2;
|
|
135
128
|
|
|
136
129
|
initial.layers.forEach((layer) => {
|
|
137
|
-
const { width, height, x, y, rotate } =
|
|
130
|
+
const { width, height, x, y, rotate, scale } = layer;
|
|
138
131
|
// Find center of layerect
|
|
139
|
-
const layerCenterX = x + width / 2;
|
|
140
|
-
const layerCenterY = y + height / 2;
|
|
132
|
+
const layerCenterX = x + (width * scale) / 2;
|
|
133
|
+
const layerCenterY = y + (height * scale) / 2;
|
|
141
134
|
|
|
142
135
|
// Translate to origin
|
|
143
136
|
const dx = layerCenterX - centerX;
|
|
@@ -152,8 +145,8 @@
|
|
|
152
145
|
const newCenterY = rotatedY + centerY;
|
|
153
146
|
|
|
154
147
|
// Compute new top-left corner
|
|
155
|
-
const newX = newCenterX - width / 2;
|
|
156
|
-
const newY = newCenterY - height / 2;
|
|
148
|
+
const newX = newCenterX - (width * scale) / 2;
|
|
149
|
+
const newY = newCenterY - (height * scale) / 2;
|
|
157
150
|
|
|
158
151
|
const newRotate = normalizeRotation(rotate + rotateDiff);
|
|
159
152
|
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
</script>
|
|
49
49
|
|
|
50
50
|
<script lang="ts">
|
|
51
|
-
import {
|
|
51
|
+
import { getEditorContext } from '../../../editor.svelte.js';
|
|
52
52
|
import { cn } from '../../../../../utils.js';
|
|
53
53
|
import { calculateNewPosition } from '../../utils.js';
|
|
54
54
|
|
|
55
55
|
let { origin, layer = $bindable() }: Props = $props();
|
|
56
56
|
|
|
57
|
-
const editor =
|
|
57
|
+
const editor = getEditorContext();
|
|
58
58
|
|
|
59
59
|
const { base, handler, grip, cursor } = sideResizeControlVariants({ origin });
|
|
60
60
|
|
|
@@ -94,14 +94,14 @@
|
|
|
94
94
|
|
|
95
95
|
if (editor.isLayerOutOfBounds(layer)) {
|
|
96
96
|
editor.historyPush({
|
|
97
|
-
type: '
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
type: 'layerRemove',
|
|
98
|
+
pageId: editor.activePage.id,
|
|
99
|
+
layer: initial.layer,
|
|
100
100
|
});
|
|
101
101
|
} else {
|
|
102
102
|
editor.historyPush({
|
|
103
|
-
type: '
|
|
104
|
-
|
|
103
|
+
type: 'layerUpdate',
|
|
104
|
+
pageId: editor.activePage.id,
|
|
105
105
|
layer: { id: layer.id, type: layer.type },
|
|
106
106
|
undo: {
|
|
107
107
|
scale: initial.layer.scale,
|
|
@@ -130,11 +130,7 @@
|
|
|
130
130
|
if (!initial || editor.activeAction?.id !== actionId) return;
|
|
131
131
|
|
|
132
132
|
isChanged = true;
|
|
133
|
-
const { width, height, x, y, flipX, flipY } = initial.layer;
|
|
134
|
-
const scale = initial.layer.scale || 1;
|
|
135
|
-
const rotate = initial.layer.rotate || 0;
|
|
136
|
-
const offsetX = initial.layer.offsetX || 0;
|
|
137
|
-
const offsetY = initial.layer.offsetY || 0;
|
|
133
|
+
const { width, height, x, y, scale, rotate, offsetX, offsetY, flipX, flipY } = initial.layer;
|
|
138
134
|
|
|
139
135
|
const angle = (rotate * Math.PI) / 180;
|
|
140
136
|
const xDiff = (e.clientX - initial.clientX) / editor.zoom;
|
|
@@ -196,7 +192,7 @@
|
|
|
196
192
|
|
|
197
193
|
const { newX, newY } = calculateNewPosition(
|
|
198
194
|
origin,
|
|
199
|
-
{ x, y, width
|
|
195
|
+
{ x, y, width, height, rotate, scale },
|
|
200
196
|
newWidth,
|
|
201
197
|
newHeight,
|
|
202
198
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TextLayer } from '../../../types.js';
|
|
4
4
|
|
|
5
5
|
const sideScaleControlVariants = tv({
|
|
6
6
|
slots: {
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
|
|
29
29
|
export interface Props {
|
|
30
30
|
origin: NonNullable<Origin>;
|
|
31
|
-
layer:
|
|
31
|
+
layer: TextLayer;
|
|
32
32
|
}
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
<script lang="ts">
|
|
36
36
|
import { tick } from 'svelte';
|
|
37
|
-
import {
|
|
37
|
+
import { getEditorContext } from '../../../editor.svelte.js';
|
|
38
38
|
import { cn } from '../../../../../utils.js';
|
|
39
39
|
import { calculateNewPosition } from '../../utils.js';
|
|
40
40
|
|
|
41
41
|
let { origin, layer = $bindable() }: Props = $props();
|
|
42
42
|
|
|
43
|
-
const editor =
|
|
43
|
+
const editor = getEditorContext();
|
|
44
44
|
|
|
45
|
-
let initial: { clientX: number; clientY: number; layer:
|
|
45
|
+
let initial: { clientX: number; clientY: number; layer: TextLayer } | null = null;
|
|
46
46
|
let isChanged = false;
|
|
47
47
|
const actionId = editor.generateId();
|
|
48
48
|
|
|
@@ -79,14 +79,14 @@
|
|
|
79
79
|
|
|
80
80
|
if (editor.isLayerOutOfBounds(layer)) {
|
|
81
81
|
editor.historyPush({
|
|
82
|
-
type: '
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
type: 'layerRemove',
|
|
83
|
+
pageId: editor.activePage.id,
|
|
84
|
+
layer: initial.layer,
|
|
85
85
|
});
|
|
86
86
|
} else {
|
|
87
87
|
editor.historyPush({
|
|
88
|
-
type: '
|
|
89
|
-
|
|
88
|
+
type: 'layerUpdate',
|
|
89
|
+
pageId: editor.activePage.id,
|
|
90
90
|
layer: { id: layer.id, type: layer.type },
|
|
91
91
|
undo: {
|
|
92
92
|
x: initial.layer.x,
|
|
@@ -103,9 +103,7 @@
|
|
|
103
103
|
const onMouseMove = async (e: MouseEvent) => {
|
|
104
104
|
if (!initial || editor.activeAction?.id !== actionId) return;
|
|
105
105
|
|
|
106
|
-
const { width, height, x, y } = initial.layer;
|
|
107
|
-
const scale = initial.layer.scale || 1;
|
|
108
|
-
const rotate = initial.layer.rotate || 0;
|
|
106
|
+
const { width, height, x, y, scale, rotate } = initial.layer;
|
|
109
107
|
|
|
110
108
|
const angle = (rotate * Math.PI) / 180;
|
|
111
109
|
const xDiff = (e.clientX - initial.clientX) / editor.zoom;
|
|
@@ -121,7 +119,7 @@
|
|
|
121
119
|
newWidth = Math.max(newWidth, 10);
|
|
122
120
|
isChanged = newWidth !== width * scale;
|
|
123
121
|
|
|
124
|
-
layer
|
|
122
|
+
Object.assign(layer, { width: newWidth / scale });
|
|
125
123
|
await tick();
|
|
126
124
|
|
|
127
125
|
const layerContent = document.getElementById(`layer-content-${layer.id}`);
|
|
@@ -130,7 +128,7 @@
|
|
|
130
128
|
|
|
131
129
|
const { newX, newY } = calculateNewPosition(
|
|
132
130
|
`top-${origin}`,
|
|
133
|
-
{ x, y, width
|
|
131
|
+
{ x, y, width, height, rotate, scale },
|
|
134
132
|
newWidth,
|
|
135
133
|
newHeight,
|
|
136
134
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextLayer } from '../../../types.js';
|
|
3
3
|
declare const sideScaleControlVariants: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
origin: {
|
|
5
5
|
right: {
|
|
@@ -55,7 +55,7 @@ declare const sideScaleControlVariants: import("tailwind-variants").TVReturnType
|
|
|
55
55
|
type Origin = VariantProps<typeof sideScaleControlVariants>['origin'];
|
|
56
56
|
export interface Props {
|
|
57
57
|
origin: NonNullable<Origin>;
|
|
58
|
-
layer:
|
|
58
|
+
layer: TextLayer;
|
|
59
59
|
}
|
|
60
60
|
declare const SideScaleControl: import("svelte").Component<Props, {}, "layer">;
|
|
61
61
|
type SideScaleControl = ReturnType<typeof SideScaleControl>;
|
|
@@ -4,6 +4,7 @@ import LayerWrapper from './layer-wrapper.svelte';
|
|
|
4
4
|
import ActiveBackgroundBorder from './active-background-border.svelte';
|
|
5
5
|
import ActiveLayerBorder from './active-layer-border.svelte';
|
|
6
6
|
import { BackgroundLayer, BackgroundLayerContent, BackgroundLayerButtons } from './types/background/index.js';
|
|
7
|
-
import {
|
|
7
|
+
import { TextLayer, TextLayerContent, HtmlContent, TextLayerEdit } from './types/text/index.js';
|
|
8
8
|
import { ImageLayer, ImageLayerContent } from './types/image/index.js';
|
|
9
|
-
|
|
9
|
+
import { GroupLayer, GroupLayerContent } from './types/group/index.js';
|
|
10
|
+
export { LayerButton, LayerThumbWrapper, LayerWrapper, BackgroundLayer, BackgroundLayerContent, BackgroundLayerButtons, TextLayer, TextLayerContent, HtmlContent, TextLayerEdit, ImageLayer, ImageLayerContent, GroupLayer, GroupLayerContent, ActiveBackgroundBorder, ActiveLayerBorder, };
|
|
@@ -4,8 +4,9 @@ import LayerWrapper from './layer-wrapper.svelte';
|
|
|
4
4
|
import ActiveBackgroundBorder from './active-background-border.svelte';
|
|
5
5
|
import ActiveLayerBorder from './active-layer-border.svelte';
|
|
6
6
|
import { BackgroundLayer, BackgroundLayerContent, BackgroundLayerButtons, } from './types/background/index.js';
|
|
7
|
-
import {
|
|
7
|
+
import { TextLayer, TextLayerContent, HtmlContent, TextLayerEdit } from './types/text/index.js';
|
|
8
8
|
import { ImageLayer, ImageLayerContent } from './types/image/index.js';
|
|
9
|
+
import { GroupLayer, GroupLayerContent } from './types/group/index.js';
|
|
9
10
|
export {
|
|
10
11
|
// layer buttons
|
|
11
12
|
LayerButton, LayerThumbWrapper,
|
|
@@ -13,9 +14,11 @@ LayerButton, LayerThumbWrapper,
|
|
|
13
14
|
LayerWrapper,
|
|
14
15
|
// background layer
|
|
15
16
|
BackgroundLayer, BackgroundLayerContent, BackgroundLayerButtons,
|
|
16
|
-
//
|
|
17
|
-
|
|
17
|
+
// text layer
|
|
18
|
+
TextLayer, TextLayerContent, HtmlContent, TextLayerEdit,
|
|
18
19
|
//image layer
|
|
19
20
|
ImageLayer, ImageLayerContent,
|
|
21
|
+
// group layer
|
|
22
|
+
GroupLayer, GroupLayerContent,
|
|
20
23
|
// layers state
|
|
21
24
|
ActiveBackgroundBorder, ActiveLayerBorder, };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import GripVerticalIcon from 'lucide
|
|
3
|
-
import LockedIcon from 'lucide
|
|
2
|
+
import GripVerticalIcon from '@lucide/svelte/icons/grip-vertical';
|
|
3
|
+
import LockedIcon from '@lucide/svelte/icons/lock-keyhole';
|
|
4
|
+
import GroupIcon from '@lucide/svelte/icons/group';
|
|
4
5
|
import { cn } from '../../../utils.js';
|
|
5
6
|
import type { Layer } from '../types.js';
|
|
6
|
-
import {
|
|
7
|
+
import { getEditorContext } from '../editor.svelte.js';
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
9
10
|
layer?: Layer;
|
|
@@ -12,12 +13,13 @@
|
|
|
12
13
|
|
|
13
14
|
let { layer, children }: Props = $props();
|
|
14
15
|
|
|
15
|
-
const editor =
|
|
16
|
+
const editor = getEditorContext();
|
|
16
17
|
|
|
17
18
|
const onclick = (e: MouseEvent) => {
|
|
18
19
|
if (layer) {
|
|
19
20
|
if (e.metaKey) {
|
|
20
|
-
editor.
|
|
21
|
+
const action = editor.activeLayers.find((l) => l.id === layer.id) ? 'delete' : 'add';
|
|
22
|
+
editor.setActiveLayers(layer.id, action);
|
|
21
23
|
} else {
|
|
22
24
|
editor.setActiveLayers(layer.id);
|
|
23
25
|
}
|
|
@@ -33,13 +35,15 @@
|
|
|
33
35
|
class={cn(
|
|
34
36
|
'bg-muted flex w-full items-center justify-between rounded-md border-2 border-transparent p-2 outline-none',
|
|
35
37
|
{
|
|
36
|
-
'border-blue-500': layer
|
|
38
|
+
'border-blue-500': layer
|
|
39
|
+
? editor.activeLayers.find((l) => l.id === layer.id)
|
|
40
|
+
: editor.activeSelection.type === 'background',
|
|
37
41
|
},
|
|
38
42
|
)}
|
|
39
43
|
>
|
|
40
44
|
<div class="h-6 w-6">
|
|
41
45
|
{#if layer}
|
|
42
|
-
{#if !editor.
|
|
46
|
+
{#if !editor.activePage.locked && !layer.locked}
|
|
43
47
|
<GripVerticalIcon class="size-6" />
|
|
44
48
|
{/if}
|
|
45
49
|
{/if}
|
|
@@ -48,8 +52,10 @@
|
|
|
48
52
|
{@render children?.()}
|
|
49
53
|
</div>
|
|
50
54
|
<div class="h-6 w-6">
|
|
51
|
-
{#if editor.
|
|
55
|
+
{#if editor.activePage.locked || (layer ? layer.locked : editor.activePage.backgroundLocked)}
|
|
52
56
|
<LockedIcon class="size-6" />
|
|
57
|
+
{:else if layer?.type === 'group'}
|
|
58
|
+
<GroupIcon class="size-6" />
|
|
53
59
|
{/if}
|
|
54
60
|
</div>
|
|
55
61
|
</button>
|
|
@@ -16,21 +16,20 @@
|
|
|
16
16
|
const cos = Math.abs(Math.cos(radians));
|
|
17
17
|
const sin = Math.abs(Math.sin(radians));
|
|
18
18
|
|
|
19
|
-
const width = layer.width * scale * cos + layer.height * scale * sin;
|
|
20
|
-
const height = layer.width * scale * sin + layer.height * scale * cos;
|
|
19
|
+
const width = layer.width * layer.scale * cos + layer.height * layer.scale * sin;
|
|
20
|
+
const height = layer.width * layer.scale * sin + layer.height * layer.scale * cos;
|
|
21
21
|
|
|
22
22
|
return Math.min(thumb.width / width, thumb.height / height);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
let scale = $derived(layer.scale || 1);
|
|
26
25
|
let thumbScale = $derived(typeof thumb === 'object' ? getThumbScale(layer, thumb) : thumb);
|
|
27
26
|
</script>
|
|
28
27
|
|
|
29
28
|
<div
|
|
30
29
|
class="pointer-events-none absolute"
|
|
31
|
-
style:width="{layer.width * scale * thumbScale}px"
|
|
32
|
-
style:height="{layer.height * scale * thumbScale}px"
|
|
33
|
-
style:transform={`${typeof thumb !== 'object' ? `translate(${layer.x * thumbScale}px, ${layer.y * thumbScale}px)` : ''} rotate(${layer.rotate
|
|
30
|
+
style:width="{layer.width * layer.scale * thumbScale}px"
|
|
31
|
+
style:height="{layer.height * layer.scale * thumbScale}px"
|
|
32
|
+
style:transform={`${typeof thumb !== 'object' ? `translate(${layer.x * thumbScale}px, ${layer.y * thumbScale}px)` : ''} rotate(${layer.rotate}deg)`}
|
|
34
33
|
>
|
|
35
34
|
{@render children?.({ thumbScale })}
|
|
36
35
|
</div>
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import * as ContextMenu from '../../ui/context-menu/index.js';
|
|
3
3
|
import type { ActiveLayerGuide, BoxLayerGuide, Layer, LineLayerGuide } from '../types.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
calculateBoundingBox,
|
|
7
|
-
calculateGroupRotatedBoundingBox,
|
|
8
|
-
calculateLayerTransform,
|
|
9
|
-
type Transform,
|
|
10
|
-
} from './utils.js';
|
|
4
|
+
import { getEditorContext } from '../editor.svelte.js';
|
|
5
|
+
import { calculateBoundingBox, calculateGroupRotatedBoundingBox } from './utils.js';
|
|
11
6
|
import { generateId } from '../../../utils.js';
|
|
12
7
|
import LayerMenuContent from '../menu/layer-menu-content.svelte';
|
|
13
8
|
|
|
@@ -25,18 +20,21 @@
|
|
|
25
20
|
children,
|
|
26
21
|
}: Props = $props();
|
|
27
22
|
|
|
28
|
-
const editor =
|
|
23
|
+
const editor = getEditorContext();
|
|
29
24
|
|
|
30
25
|
let initial: {
|
|
31
26
|
clientX: number;
|
|
32
27
|
clientY: number;
|
|
33
|
-
bbox:
|
|
28
|
+
bbox: { x: number; y: number; width: number; height: number };
|
|
34
29
|
layers: (Layer & { state: Layer })[];
|
|
35
30
|
} | null = null;
|
|
36
31
|
const actionId = editor.generateId();
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
const onClick = (e: MouseEvent) => {
|
|
34
|
+
console.log('click', layer.id, e);
|
|
35
|
+
if (e.shiftKey) return;
|
|
36
|
+
editor.setActiveLayers(layer.id);
|
|
37
|
+
};
|
|
40
38
|
|
|
41
39
|
const tryToDeselect = () => {
|
|
42
40
|
removeEventListener('mouseup', tryToDeselect);
|
|
@@ -46,31 +44,21 @@
|
|
|
46
44
|
|
|
47
45
|
const onMouseDown = (e: MouseEvent) => {
|
|
48
46
|
console.log('mousedown', layer.id, e);
|
|
49
|
-
if (
|
|
47
|
+
if (editor.activeAction) return;
|
|
48
|
+
if (!editor.activeLayers.find((l) => l.id === layer.id)) {
|
|
50
49
|
editor.setActiveLayers(layer.id, e.shiftKey ? 'add' : undefined);
|
|
51
50
|
} else if (e.shiftKey) {
|
|
52
51
|
addEventListener('mouseup', tryToDeselect);
|
|
53
52
|
}
|
|
54
|
-
if (
|
|
55
|
-
!editor.activeSlide.locked &&
|
|
56
|
-
!editor.activeLayers.some((l) => l.locked) &&
|
|
57
|
-
!editor.activeAction &&
|
|
58
|
-
e.button === 0
|
|
59
|
-
) {
|
|
53
|
+
if (!editor.activePage.locked && !editor.activeLayers.some((l) => l.locked) && e.button === 0) {
|
|
60
54
|
initial = {
|
|
61
55
|
clientX: e.clientX,
|
|
62
56
|
clientY: e.clientY,
|
|
63
|
-
bbox:
|
|
64
|
-
|
|
65
|
-
editor.activeLayers
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
editor.activeLayers.map(calculateLayerTransform),
|
|
69
|
-
editor.activeGroupRotate,
|
|
70
|
-
),
|
|
71
|
-
),
|
|
72
|
-
rotate: 0,
|
|
73
|
-
},
|
|
57
|
+
bbox: calculateBoundingBox(
|
|
58
|
+
editor.activeLayers.length === 1
|
|
59
|
+
? editor.activeLayers[0]
|
|
60
|
+
: calculateGroupRotatedBoundingBox(editor.activeLayers, editor.activeGroupRotate),
|
|
61
|
+
),
|
|
74
62
|
layers: editor.activeLayers.map((layer) => ({ ...layer, state: layer })),
|
|
75
63
|
};
|
|
76
64
|
addEventListener('mousemove', onMouseMove);
|
|
@@ -88,27 +76,26 @@
|
|
|
88
76
|
editor.activeAction = null;
|
|
89
77
|
if (!initial || (initial.clientX === e.clientX && initial.clientY === e.clientY)) return;
|
|
90
78
|
|
|
91
|
-
editor.historyPush(
|
|
92
|
-
|
|
93
|
-
actions: initial.layers.map((layerWithState) => {
|
|
79
|
+
editor.historyPush(
|
|
80
|
+
initial.layers.map((layerWithState) => {
|
|
94
81
|
const { state, ...layer } = layerWithState;
|
|
95
82
|
if (editor.isLayerOutOfBounds(state)) {
|
|
96
83
|
return {
|
|
97
|
-
type: '
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
type: 'layerRemove',
|
|
85
|
+
pageId: editor.activePage.id,
|
|
86
|
+
layer,
|
|
100
87
|
};
|
|
101
88
|
} else {
|
|
102
89
|
return {
|
|
103
|
-
type: '
|
|
104
|
-
|
|
90
|
+
type: 'layerUpdate',
|
|
91
|
+
pageId: editor.activePage.id,
|
|
105
92
|
layer: { id: layer.id, type: layer.type },
|
|
106
93
|
undo: { x: layer.x, y: layer.y },
|
|
107
94
|
redo: { x: state.x, y: state.y },
|
|
108
95
|
};
|
|
109
96
|
}
|
|
110
97
|
}),
|
|
111
|
-
|
|
98
|
+
);
|
|
112
99
|
initial = null;
|
|
113
100
|
};
|
|
114
101
|
|
|
@@ -147,9 +134,9 @@
|
|
|
147
134
|
|
|
148
135
|
let snappingGrid: LineLayerGuide[][] = [];
|
|
149
136
|
const buildSnappingGrid = () =>
|
|
150
|
-
editor.
|
|
151
|
-
.filter((
|
|
152
|
-
.map((
|
|
137
|
+
editor.rootLayers
|
|
138
|
+
.filter((layer) => !editor.activeLayers.find((l) => l.id === layer.id))
|
|
139
|
+
.map((layer) => calculateBoundingBox(layer))
|
|
153
140
|
.map(({ x, y, width, height }) => {
|
|
154
141
|
const verticalPositions = [x, x + width / 2, x + width];
|
|
155
142
|
const horizontalPositions = [y, y + height / 2, y + height];
|
|
@@ -187,11 +174,11 @@
|
|
|
187
174
|
|
|
188
175
|
if (!initial || editor.activeAction?.id !== actionId) return;
|
|
189
176
|
|
|
190
|
-
|
|
191
|
-
let
|
|
192
|
-
let
|
|
193
|
-
let
|
|
194
|
-
|
|
177
|
+
const { clientX, clientY, bbox } = initial;
|
|
178
|
+
let xDiff = (e.clientX - clientX) / editor.zoom;
|
|
179
|
+
let yDiff = (e.clientY - clientY) / editor.zoom;
|
|
180
|
+
let x = bbox.x + xDiff;
|
|
181
|
+
let y = bbox.y + yDiff;
|
|
195
182
|
|
|
196
183
|
const guides: {
|
|
197
184
|
xDiff?: number;
|
|
@@ -205,7 +192,7 @@
|
|
|
205
192
|
let minYDiff: number = Infinity;
|
|
206
193
|
const xSnappingCheck = (coords: number[]) => {
|
|
207
194
|
for (let i = 0; i < coords.length; i++) {
|
|
208
|
-
const coordsForCheck = [coords[i], coords[i] - width / 2, coords[i] - width];
|
|
195
|
+
const coordsForCheck = [coords[i], coords[i] - bbox.width / 2, coords[i] - bbox.width];
|
|
209
196
|
for (let j = 0; j < coordsForCheck.length; j++) {
|
|
210
197
|
const xDiff = x - coordsForCheck[j];
|
|
211
198
|
const xDiffAbs = Math.abs(xDiff);
|
|
@@ -221,7 +208,7 @@
|
|
|
221
208
|
};
|
|
222
209
|
const ySnappingCheck = (coords: number[]) => {
|
|
223
210
|
for (let i = 0; i < coords.length; i++) {
|
|
224
|
-
const coordsForCheck = [coords[i], coords[i] - height / 2, coords[i] - height];
|
|
211
|
+
const coordsForCheck = [coords[i], coords[i] - bbox.height / 2, coords[i] - bbox.height];
|
|
225
212
|
for (let j = 0; j < coordsForCheck.length; j++) {
|
|
226
213
|
const yDiff = y - coordsForCheck[j];
|
|
227
214
|
const yDiffAbs = Math.abs(yDiff);
|
|
@@ -256,13 +243,13 @@
|
|
|
256
243
|
}
|
|
257
244
|
};
|
|
258
245
|
|
|
259
|
-
//
|
|
246
|
+
// page padding
|
|
260
247
|
checkBoxSnapping(paddingGuide);
|
|
261
248
|
|
|
262
|
-
//
|
|
249
|
+
// page edges
|
|
263
250
|
edgeGuides.forEach(checkLineSnapping);
|
|
264
251
|
|
|
265
|
-
// rest of the
|
|
252
|
+
// rest of the pages
|
|
266
253
|
snappingGrid.forEach((layerGuides) => {
|
|
267
254
|
layerGuides.forEach(checkLineSnapping);
|
|
268
255
|
});
|
|
@@ -281,11 +268,11 @@
|
|
|
281
268
|
.map(({ guide }) => {
|
|
282
269
|
if (guide.type === 'horizontal') {
|
|
283
270
|
const minX = Math.min(x, guide.x);
|
|
284
|
-
const length = Math.max(x + width, guide.x + guide.length) - minX;
|
|
271
|
+
const length = Math.max(x + bbox.width, guide.x + guide.length) - minX;
|
|
285
272
|
return { ...guide, x: minX, length };
|
|
286
273
|
} else if (guide.type === 'vertical') {
|
|
287
274
|
const minY = Math.min(y, guide.y);
|
|
288
|
-
const length = Math.max(y + height, guide.y + guide.length) - minY;
|
|
275
|
+
const length = Math.max(y + bbox.height, guide.y + guide.length) - minY;
|
|
289
276
|
return { ...guide, y: minY, length };
|
|
290
277
|
}
|
|
291
278
|
|
|
@@ -316,14 +303,16 @@
|
|
|
316
303
|
|
|
317
304
|
<ContextMenu.Root>
|
|
318
305
|
<ContextMenu.Trigger>
|
|
306
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
319
307
|
<!-- svelte-ignore a11y_mouse_events_have_key_events -->
|
|
320
308
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
321
309
|
<div
|
|
322
310
|
class="absolute select-none"
|
|
323
|
-
style:width="{layer.width * scale}px"
|
|
324
|
-
style:height="{layer.height * scale}px"
|
|
325
|
-
style:transform={`translate(${layer.x}px, ${layer.y}px) rotate(${rotate}deg)`}
|
|
326
|
-
style:opacity={layer.opacity
|
|
311
|
+
style:width="{layer.width * layer.scale}px"
|
|
312
|
+
style:height="{layer.height * layer.scale}px"
|
|
313
|
+
style:transform={`translate(${layer.x}px, ${layer.y}px) rotate(${layer.rotate}deg)`}
|
|
314
|
+
style:opacity={layer.opacity}
|
|
315
|
+
onclick={onClick}
|
|
327
316
|
onmousedown={onMouseDown}
|
|
328
317
|
onmouseover={onMouseOver}
|
|
329
318
|
onmouseleave={onMouseLeave}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
let { backgroundImage, thumbScale = 1 }: Props = $props();
|
|
10
10
|
|
|
11
|
-
let scale = $derived(
|
|
11
|
+
let scale = $derived(backgroundImage.scale * thumbScale);
|
|
12
12
|
|
|
13
13
|
let flipTransform = $derived(
|
|
14
14
|
backgroundImage.flipX || backgroundImage.flipY
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
class="relative"
|
|
28
28
|
style:width="{backgroundImage.image.width * scale}px"
|
|
29
29
|
style:height="{backgroundImage.image.height * scale}px"
|
|
30
|
-
style:transform={`translate(${-
|
|
30
|
+
style:transform={`translate(${-backgroundImage.offsetX * scale}px, ${-backgroundImage.offsetY * scale}px)`}
|
|
31
31
|
>
|
|
32
32
|
<img
|
|
33
33
|
src={backgroundImage.image.src}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Separator } from '../../../../ui/separator/index.js';
|
|
3
3
|
import { Button } from '../../../../ui/button/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getEditorContext } from '../../../editor.svelte.js';
|
|
5
5
|
import { ColorIndicator } from '../../../color-indicator/index.js';
|
|
6
6
|
import { ColorPickerAlphaGrid } from '../../../../ui/color-picker/index.js';
|
|
7
7
|
import { FlipButton } from '../../buttons/flip-button/index.js';
|
|
8
8
|
import { OpacityButton } from '../../buttons/opacity-button/index.js';
|
|
9
9
|
|
|
10
|
-
const editor =
|
|
10
|
+
const editor = getEditorContext();
|
|
11
11
|
|
|
12
|
-
let backgroundColor = $derived(editor.
|
|
12
|
+
let backgroundColor = $derived(editor.activePage.backgroundColor || '#ffffff');
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<Separator orientation="vertical" />
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
</ColorPickerAlphaGrid>
|
|
28
28
|
</div>
|
|
29
29
|
</Button>
|
|
30
|
-
{#if editor.
|
|
30
|
+
{#if editor.activePage.backgroundImage}
|
|
31
31
|
<Separator orientation="vertical" />
|
|
32
|
-
<FlipButton bind:layers={editor.
|
|
32
|
+
<FlipButton bind:layers={editor.activePage.backgroundImage} />
|
|
33
33
|
<Separator orientation="vertical" />
|
|
34
|
-
<OpacityButton bind:layers={editor.
|
|
34
|
+
<OpacityButton bind:layers={editor.activePage.backgroundImage} />
|
|
35
35
|
{/if}
|