@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
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ interface BaseLayer {
|
|
|
31
31
|
sortOrder: number;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
interface
|
|
35
|
-
type: '
|
|
34
|
+
interface TextLayer extends BaseLayer {
|
|
35
|
+
type: 'text';
|
|
36
36
|
scale: number | null;
|
|
37
37
|
html: JSONContent;
|
|
38
38
|
}
|
|
@@ -54,9 +54,9 @@ interface ImageLayer extends BaseLayer, LayerBorder {
|
|
|
54
54
|
flipY: boolean;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
type Layer =
|
|
57
|
+
type Layer = TextLayer | ImageLayer;
|
|
58
58
|
|
|
59
|
-
type
|
|
59
|
+
type Page = {
|
|
60
60
|
id: string;
|
|
61
61
|
backgroundColor: string | null;
|
|
62
62
|
layers: Layer[];
|
|
@@ -66,9 +66,9 @@ type Slide = {
|
|
|
66
66
|
|
|
67
67
|
### Html editor
|
|
68
68
|
|
|
69
|
-
PresentationEditor is using `Tiptap` editor for `
|
|
69
|
+
PresentationEditor is using `Tiptap` editor for `TextLayer` content editing.
|
|
70
70
|
|
|
71
|
-
`JSONContent` type provided by `@tiptap/core` is used for html content of `
|
|
71
|
+
`JSONContent` type provided by `@tiptap/core` is used for html content of `TextLayer` to store data in json format.
|
|
72
72
|
|
|
73
73
|
## Settings
|
|
74
74
|
|
|
@@ -81,22 +81,22 @@ interface BaseOptions {
|
|
|
81
81
|
height?: number;
|
|
82
82
|
generateId?: () => string;
|
|
83
83
|
onImageUpload?: (file: File) => Promise<Image>;
|
|
84
|
-
onLayerAdd?: (
|
|
85
|
-
onLayerUpdate?: (
|
|
86
|
-
onLayerRemove?: (
|
|
84
|
+
onLayerAdd?: (pageId: string, layer: Layer) => Promise<Layer>;
|
|
85
|
+
onLayerUpdate?: (pageId: string, layerId: string, layerType: string, changes: object) => void;
|
|
86
|
+
onLayerRemove?: (pageId: string, layerId: string, layerType: string) => Promise<void>;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
interface MultipleModeOption extends BaseOptions {
|
|
90
90
|
mode?: 'multiple';
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
pages?: Page[];
|
|
92
|
+
onPageAdd?: (page: Page) => Promise<Page>;
|
|
93
|
+
onPageUpdate?: (pageId: string, changes: object) => void;
|
|
94
|
+
onPageRemove?: (pageId: string) => Promise<void>;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
interface SingleModeOption extends BaseOptions {
|
|
98
98
|
mode: 'single';
|
|
99
|
-
|
|
99
|
+
page?: Page;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
export type PresentationEditorOptions = MultipleModeOption | SingleModeOption;
|
|
@@ -109,82 +109,82 @@ import { createEditor } from '@peteai/presentation-editor';
|
|
|
109
109
|
|
|
110
110
|
// images list
|
|
111
111
|
const images: Image[];
|
|
112
|
-
//
|
|
113
|
-
const
|
|
112
|
+
// pages list
|
|
113
|
+
const pages: Page[];
|
|
114
114
|
|
|
115
115
|
const editor = new createEditor({
|
|
116
116
|
target: document.querySelector('.target'),
|
|
117
117
|
props: {
|
|
118
|
-
// function for new
|
|
118
|
+
// function for new pages and layers ids generation
|
|
119
119
|
generateId: () => crypto.randomUUID(),
|
|
120
120
|
images,
|
|
121
|
-
|
|
121
|
+
pages,
|
|
122
122
|
onImageUpload: async (file) => {
|
|
123
123
|
// called when user uploads image
|
|
124
124
|
// callback to store file and return Image
|
|
125
125
|
// which will be added to the images list
|
|
126
|
-
// new ImageLayer gonna be created if image file was dropped on
|
|
126
|
+
// new ImageLayer gonna be created if image file was dropped on page
|
|
127
127
|
// ...
|
|
128
128
|
return image;
|
|
129
129
|
},
|
|
130
|
-
|
|
131
|
-
// called when new
|
|
132
|
-
// expect
|
|
130
|
+
onPageAdd: async (page) => {
|
|
131
|
+
// called when new page is added
|
|
132
|
+
// expect Page to be returned to overwrite newly created page
|
|
133
133
|
},
|
|
134
|
-
|
|
135
|
-
// called when
|
|
134
|
+
onPageUpdate: async (pageId, values) => {
|
|
135
|
+
// called when page is updated
|
|
136
136
|
},
|
|
137
|
-
|
|
138
|
-
// called when
|
|
137
|
+
onPageRemove: async (pageId) => {
|
|
138
|
+
// called when page is removed
|
|
139
139
|
},
|
|
140
|
-
onLayerAdd: async (
|
|
140
|
+
onLayerAdd: async (pageId, layer) => {
|
|
141
141
|
// called when new layer is added
|
|
142
142
|
// expect Layer to be returned to overwrite newly created layer
|
|
143
143
|
},
|
|
144
|
-
onLayerUpdate: async (
|
|
144
|
+
onLayerUpdate: async (pageId, layerId, layerType, values) => {
|
|
145
145
|
// called when layer is updated
|
|
146
146
|
},
|
|
147
|
-
onLayerRemove: async (
|
|
147
|
+
onLayerRemove: async (pageId, layerId, layerType) => {
|
|
148
148
|
// called when layer is removed
|
|
149
149
|
},
|
|
150
150
|
},
|
|
151
151
|
});
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
## Single
|
|
154
|
+
## Single Page Mode
|
|
155
155
|
|
|
156
156
|
```typescript
|
|
157
157
|
import { createEditor } from '@peteai/presentation-editor';
|
|
158
158
|
|
|
159
159
|
// images list
|
|
160
160
|
const images: Image[];
|
|
161
|
-
//
|
|
162
|
-
const
|
|
161
|
+
// pages list
|
|
162
|
+
const page: Page;
|
|
163
163
|
|
|
164
164
|
const editor = new createEditor({
|
|
165
165
|
target: document.querySelector('.target'),
|
|
166
166
|
props: {
|
|
167
167
|
mode: 'single',
|
|
168
|
-
// function for new
|
|
168
|
+
// function for new pages and layers ids generation
|
|
169
169
|
generateId: () => crypto.randomUUID(),
|
|
170
170
|
images,
|
|
171
|
-
|
|
171
|
+
page,
|
|
172
172
|
onImageUpload: async (file) => {
|
|
173
173
|
// called when user uploads image
|
|
174
174
|
// callback to store file and return Image
|
|
175
175
|
// which will be added to the images list
|
|
176
|
-
// new ImageLayer gonna be created if image file was dropped on
|
|
176
|
+
// new ImageLayer gonna be created if image file was dropped on page
|
|
177
177
|
// ...
|
|
178
178
|
return image;
|
|
179
179
|
},
|
|
180
|
-
onLayerAdd: async (
|
|
180
|
+
onLayerAdd: async (pageId, layer) => {
|
|
181
181
|
// called when new layer is added
|
|
182
182
|
// expect Layer to be returned to overwrite newly created layer
|
|
183
183
|
},
|
|
184
|
-
onLayerUpdate: async (
|
|
184
|
+
onLayerUpdate: async (pageId, layerId, layerType, values) => {
|
|
185
185
|
// called when layer is updated
|
|
186
186
|
},
|
|
187
|
-
onLayerRemove: async (
|
|
187
|
+
onLayerRemove: async (pageId, layerId, layerType) => {
|
|
188
188
|
// called when layer is removed
|
|
189
189
|
},
|
|
190
190
|
},
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Separator } from '../ui/separator/index.js';
|
|
3
|
+
import { BorderButton } from './layers/buttons/border-button/index.js';
|
|
4
|
+
import { CornerRadiusButton } from './layers/buttons/corner-radius-button/index.js';
|
|
5
|
+
import { FlipButton } from './layers/buttons/flip-button/index.js';
|
|
6
|
+
import { OpacityButton } from './layers/buttons/opacity-button/index.js';
|
|
7
|
+
import { AlignmentButton } from './layers/types/text/buttons/alignment-button/index.js';
|
|
8
|
+
import { BoldButton } from './layers/types/text/buttons/bold-button/index.js';
|
|
9
|
+
import { CaseButton } from './layers/types/text/buttons/case-button/index.js';
|
|
10
|
+
import { ColorButton } from './layers/types/text/buttons/color-button/index.js';
|
|
11
|
+
import { FontFamilyButton } from './layers/types/text/buttons/font-family-button/index.js';
|
|
12
|
+
import { FontSizeButton } from './layers/types/text/buttons/font-size-button/index.js';
|
|
13
|
+
import { ItalicButton } from './layers/types/text/buttons/italic-button/index.js';
|
|
14
|
+
import { ListButton } from './layers/types/text/buttons/list-button/index.js';
|
|
15
|
+
import { StrikethroughButton } from './layers/types/text/buttons/strikethrough-button/index.js';
|
|
16
|
+
import { UnderlineButton } from './layers/types/text/buttons/underline-button/index.js';
|
|
17
|
+
import { getEditorContext } from './editor.svelte.js';
|
|
18
|
+
|
|
19
|
+
const editor = getEditorContext();
|
|
20
|
+
|
|
21
|
+
let imageLayers = $derived(
|
|
22
|
+
editor.selectedSimpleLayersNotLocked.filter((layer) => layer.type === 'image'),
|
|
23
|
+
);
|
|
24
|
+
let textLayers = $derived(
|
|
25
|
+
editor.selectedSimpleLayersNotLocked.filter((layer) => layer.type === 'text'),
|
|
26
|
+
);
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if editor.activeLayers.length}
|
|
30
|
+
{#if imageLayers.length}
|
|
31
|
+
<Separator orientation="vertical" />
|
|
32
|
+
<BorderButton bind:layers={imageLayers} />
|
|
33
|
+
<CornerRadiusButton bind:layers={imageLayers} />
|
|
34
|
+
{#if textLayers.length === 0}
|
|
35
|
+
<Separator orientation="vertical" />
|
|
36
|
+
<FlipButton bind:layers={imageLayers} />
|
|
37
|
+
{/if}
|
|
38
|
+
{/if}
|
|
39
|
+
{#if textLayers.length}
|
|
40
|
+
<Separator orientation="vertical" />
|
|
41
|
+
<FontFamilyButton bind:layers={textLayers} />
|
|
42
|
+
<FontSizeButton bind:layers={textLayers} />
|
|
43
|
+
<ColorButton bind:layers={textLayers} />
|
|
44
|
+
<BoldButton bind:layers={textLayers} />
|
|
45
|
+
<ItalicButton bind:layers={textLayers} />
|
|
46
|
+
<UnderlineButton bind:layers={textLayers} />
|
|
47
|
+
<StrikethroughButton bind:layers={textLayers} />
|
|
48
|
+
<CaseButton bind:layers={textLayers} />
|
|
49
|
+
<AlignmentButton bind:layers={textLayers} />
|
|
50
|
+
<ListButton bind:layers={textLayers} />
|
|
51
|
+
{/if}
|
|
52
|
+
{#if editor.selectedLayersNotLocked.length}
|
|
53
|
+
<Separator orientation="vertical" />
|
|
54
|
+
<OpacityButton bind:layers={editor.selectedLayersNotLocked} />
|
|
55
|
+
{/if}
|
|
56
|
+
{/if}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getEditorContext } from './editor.svelte.js';
|
|
3
|
+
import {
|
|
4
|
+
calculateGroupRotatedBoundingBox,
|
|
5
|
+
calculateRelativeRects,
|
|
6
|
+
isRotatedVertically,
|
|
7
|
+
} from './layers/utils.js';
|
|
8
|
+
import { SideScaleControl } from './layers/controls/side-scale-control/index.js';
|
|
9
|
+
import { SideResizeControl } from './layers/controls/side-resize-control/index.js';
|
|
10
|
+
import { GroupResizeControl } from './layers/controls/group-resize-control/index.js';
|
|
11
|
+
import { CornerScaleControl } from './layers/controls/corner-scale-control/index.js';
|
|
12
|
+
import { RotateControl } from './layers/controls/rotate-control/index.js';
|
|
13
|
+
import { ImageLayerCrop, TextLayerEdit } from './layers/index.js';
|
|
14
|
+
import type { GroupLayer, ImageLayer, Layer, TextLayer } from './types.js';
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
viewportRef: HTMLDivElement;
|
|
18
|
+
wrapperRef: HTMLDivElement;
|
|
19
|
+
pageRef: HTMLDivElement;
|
|
20
|
+
}
|
|
21
|
+
const { viewportRef, wrapperRef, pageRef }: Props = $props();
|
|
22
|
+
|
|
23
|
+
const editor = getEditorContext();
|
|
24
|
+
|
|
25
|
+
let textLayerEditData: { layer: TextLayer; groupLayer?: GroupLayer } | undefined = $derived.by(
|
|
26
|
+
() => {
|
|
27
|
+
if (editor.activeAction?.type === 'edit') {
|
|
28
|
+
if (editor.activeSelection.type === 'root-layers') {
|
|
29
|
+
if (editor.activeLayers.length === 1) {
|
|
30
|
+
const layer = editor.activeLayers[0];
|
|
31
|
+
if (editor.activeAction.id == layer.id && layer.type === 'text') {
|
|
32
|
+
return { layer };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
} else if (editor.activeSelection.type === 'child-layer') {
|
|
36
|
+
if (editor.activeGroupAndChild) {
|
|
37
|
+
const { childLayer, groupLayer } = editor.activeGroupAndChild;
|
|
38
|
+
if (editor.activeAction.id == childLayer.id && childLayer.type === 'text') {
|
|
39
|
+
return { layer: childLayer, groupLayer };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
let imageLayerCropData: { layer: ImageLayer } | undefined = $derived.by(() => {
|
|
48
|
+
if (editor.imageCropLayer) {
|
|
49
|
+
return { layer: editor.imageCropLayer };
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const group = $derived.by(() => {
|
|
54
|
+
if (editor.activeSelection.type === 'background') {
|
|
55
|
+
return {
|
|
56
|
+
bbox: {
|
|
57
|
+
x: 0,
|
|
58
|
+
y: 0,
|
|
59
|
+
width: editor.width,
|
|
60
|
+
height: editor.height,
|
|
61
|
+
rotate: 0,
|
|
62
|
+
scale: 1,
|
|
63
|
+
},
|
|
64
|
+
padding: 3,
|
|
65
|
+
items: [],
|
|
66
|
+
};
|
|
67
|
+
} else if (editor.activeGroupAndChild) {
|
|
68
|
+
const { groupLayer, childLayer } = editor.activeGroupAndChild;
|
|
69
|
+
return {
|
|
70
|
+
bbox: groupLayer,
|
|
71
|
+
padding: 0,
|
|
72
|
+
items: [
|
|
73
|
+
{
|
|
74
|
+
...childLayer,
|
|
75
|
+
...{
|
|
76
|
+
x: childLayer.x * groupLayer.scale,
|
|
77
|
+
y: childLayer.y * groupLayer.scale,
|
|
78
|
+
width: childLayer.width * groupLayer.scale,
|
|
79
|
+
height: childLayer.height * groupLayer.scale,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
} else if (editor.activeLayers.length === 1) {
|
|
85
|
+
return {
|
|
86
|
+
bbox: editor.activeLayers[0],
|
|
87
|
+
padding: 0,
|
|
88
|
+
items: [],
|
|
89
|
+
};
|
|
90
|
+
} else if (editor.activeLayers.length > 1) {
|
|
91
|
+
const bbox = calculateGroupRotatedBoundingBox(editor.activeLayers, editor.activeGroupRotate);
|
|
92
|
+
const items = calculateRelativeRects(bbox, editor.activeLayers);
|
|
93
|
+
|
|
94
|
+
return { bbox, padding: 0, items };
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Determines if resizing should be forbidden based on the rotation of the group and its layers.
|
|
99
|
+
*
|
|
100
|
+
* @param {Layer[]} layers - The layers to check.
|
|
101
|
+
* @param {number} groupRotate - The rotation of the group in degrees.
|
|
102
|
+
* @returns {(boolean|string)} - Returns 'horizontal' or 'vertical' if resizing should be forbidden in that direction, otherwise returns false.
|
|
103
|
+
*/
|
|
104
|
+
const getConstrainedResizeAxis = (layers: Layer[], groupRotate: number) => {
|
|
105
|
+
// Check if all active layers are of type 'text'
|
|
106
|
+
const textLayersOnly = layers.every((layer) =>
|
|
107
|
+
layer.type === 'group'
|
|
108
|
+
? editor.findGroupChildren(editor.activePage, layer.id).every((l) => l.type === 'text')
|
|
109
|
+
: layer.type === 'text',
|
|
110
|
+
);
|
|
111
|
+
if (!textLayersOnly) return false; // If not all layers are 'text', resizing is not forbidden
|
|
112
|
+
|
|
113
|
+
const textLayersRotations = editor.activeLayers.flatMap((layer) =>
|
|
114
|
+
layer.type === 'group'
|
|
115
|
+
? editor.findGroupChildren(editor.activePage, layer.id).map((l) => l.rotate + layer.rotate)
|
|
116
|
+
: layer.rotate,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// Calculate the rotation of the first layer relative to the group rotation
|
|
120
|
+
const firstLayerRelativeRotate = textLayersRotations[0] - groupRotate;
|
|
121
|
+
// Determine if the first layer is rotated vertically
|
|
122
|
+
const firstLayerRotatedVertically = isRotatedVertically(firstLayerRelativeRotate);
|
|
123
|
+
|
|
124
|
+
// Check if all layers have the same rotation direction relative to the group rotation
|
|
125
|
+
const allLayersHaveSameRotationDirection = textLayersRotations.every(
|
|
126
|
+
(rotate) => isRotatedVertically(rotate - groupRotate) === firstLayerRotatedVertically,
|
|
127
|
+
);
|
|
128
|
+
if (!allLayersHaveSameRotationDirection) return false; // If not all layers have the same rotation direction, resizing is not forbidden
|
|
129
|
+
|
|
130
|
+
// Based on the rotation direction, determine the direction in which resizing should be forbidden
|
|
131
|
+
return firstLayerRotatedVertically ? 'horizontal' : 'vertical';
|
|
132
|
+
};
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
{#if textLayerEditData}
|
|
136
|
+
<TextLayerEdit {...textLayerEditData} />
|
|
137
|
+
{/if}
|
|
138
|
+
|
|
139
|
+
{#if imageLayerCropData}
|
|
140
|
+
<ImageLayerCrop {...imageLayerCropData} {viewportRef} {wrapperRef} {pageRef} />
|
|
141
|
+
{:else if group}
|
|
142
|
+
<div
|
|
143
|
+
class="pointer-events-none absolute left-0 top-0 h-full w-full"
|
|
144
|
+
style:width={`${group.bbox.width * group.bbox.scale * editor.zoom + group.padding * 2}px`}
|
|
145
|
+
style:height={`${group.bbox.height * group.bbox.scale * editor.zoom + group.padding * 2}px`}
|
|
146
|
+
style:transform={`translate(${group.bbox.x * editor.zoom - group.padding}px, ${group.bbox.y * editor.zoom - group.padding}px) rotate(${group.bbox.rotate}deg)`}
|
|
147
|
+
>
|
|
148
|
+
{#if !group.items.length}
|
|
149
|
+
<div
|
|
150
|
+
class="border-primary absolute -inset-px border-2"
|
|
151
|
+
style:box-shadow="0 0 0 1px hsla(0, 0%, 100%, .07), inset 0 0 0 1px hsla(0, 0%, 100%, .07)"
|
|
152
|
+
></div>
|
|
153
|
+
{:else}
|
|
154
|
+
<div class="group-border absolute -inset-px"></div>
|
|
155
|
+
{#each group.items as item}
|
|
156
|
+
<div
|
|
157
|
+
class="border-primary absolute -left-px -top-px border-2"
|
|
158
|
+
style:box-shadow="0 0 0 1px hsla(0, 0%, 100%, .07), inset 0 0 0 1px hsla(0, 0%, 100%, .07)"
|
|
159
|
+
style:width={`${item.width * item.scale * editor.zoom + 2}px`}
|
|
160
|
+
style:height={`${item.height * item.scale * editor.zoom + 2}px`}
|
|
161
|
+
style:transform={`translate(${item.x * editor.zoom}px, ${item.y * editor.zoom}px) rotate(${item.rotate}deg)`}
|
|
162
|
+
></div>
|
|
163
|
+
{/each}
|
|
164
|
+
{/if}
|
|
165
|
+
|
|
166
|
+
{#if editor.activeLayers.length > 0 && !editor.activePage.locked && !editor.activeLayers.some((l) => l.locked)}
|
|
167
|
+
<div class="h-full w-full outline-none transition-opacity duration-300">
|
|
168
|
+
<div class="flex h-full w-full items-center justify-center">
|
|
169
|
+
{#if editor.activeLayers.length === 1 && editor.activeLayers[0].type === 'text'}
|
|
170
|
+
{@const layer = editor.activeLayers[0]}
|
|
171
|
+
<SideScaleControl origin="left" {layer} />
|
|
172
|
+
<SideScaleControl origin="right" {layer} />
|
|
173
|
+
{:else if editor.activeLayers.length === 1 && editor.activeLayers[0].type === 'image'}
|
|
174
|
+
{@const layer = editor.activeLayers[0]}
|
|
175
|
+
<SideResizeControl origin="left" {layer} />
|
|
176
|
+
<SideResizeControl origin="right" {layer} />
|
|
177
|
+
<SideResizeControl origin="top" {layer} />
|
|
178
|
+
<SideResizeControl origin="bottom" {layer} />
|
|
179
|
+
{:else}
|
|
180
|
+
{@const constrainedResizeAxis = getConstrainedResizeAxis(
|
|
181
|
+
editor.activeLayers,
|
|
182
|
+
group.bbox.rotate,
|
|
183
|
+
)}
|
|
184
|
+
{#if constrainedResizeAxis !== 'horizontal'}
|
|
185
|
+
<GroupResizeControl origin="left" />
|
|
186
|
+
<GroupResizeControl origin="right" />
|
|
187
|
+
{/if}
|
|
188
|
+
{#if constrainedResizeAxis !== 'vertical'}
|
|
189
|
+
<GroupResizeControl origin="top" />
|
|
190
|
+
<GroupResizeControl origin="bottom" />
|
|
191
|
+
{/if}
|
|
192
|
+
{/if}
|
|
193
|
+
<CornerScaleControl origin="bottom-right" />
|
|
194
|
+
<CornerScaleControl origin="bottom-left" />
|
|
195
|
+
<CornerScaleControl origin="top-right" />
|
|
196
|
+
<CornerScaleControl origin="top-left" />
|
|
197
|
+
<RotateControl {pageRef} />
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
{/if}
|
|
201
|
+
</div>
|
|
202
|
+
{/if}
|
|
203
|
+
|
|
204
|
+
<style>
|
|
205
|
+
.group-border {
|
|
206
|
+
background-image:
|
|
207
|
+
linear-gradient(90deg, #fff 60%, rgba(53, 71, 90, 0.2) 0),
|
|
208
|
+
linear-gradient(180deg, #fff 60%, rgba(53, 71, 90, 0.2) 0),
|
|
209
|
+
linear-gradient(90deg, #fff 60%, rgba(53, 71, 90, 0.2) 0),
|
|
210
|
+
linear-gradient(180deg, #fff 60%, rgba(53, 71, 90, 0.2) 0),
|
|
211
|
+
linear-gradient(90deg, rgba(57, 76, 96, 0.15), rgba(57, 76, 96, 0.15)),
|
|
212
|
+
linear-gradient(180deg, rgba(57, 76, 96, 0.15), rgba(57, 76, 96, 0.15)),
|
|
213
|
+
linear-gradient(90deg, rgba(57, 76, 96, 0.15), rgba(57, 76, 96, 0.15)),
|
|
214
|
+
linear-gradient(180deg, rgba(57, 76, 96, 0.15), rgba(57, 76, 96, 0.15));
|
|
215
|
+
background-position:
|
|
216
|
+
top,
|
|
217
|
+
100%,
|
|
218
|
+
bottom,
|
|
219
|
+
0,
|
|
220
|
+
center 2px,
|
|
221
|
+
calc(100% - 2px),
|
|
222
|
+
center calc(100% - 2px),
|
|
223
|
+
2px;
|
|
224
|
+
background-repeat:
|
|
225
|
+
repeat-x, repeat-y, repeat-x, repeat-y, no-repeat, no-repeat, no-repeat, no-repeat;
|
|
226
|
+
background-size:
|
|
227
|
+
6px 2px,
|
|
228
|
+
2px 6px,
|
|
229
|
+
6px 2px,
|
|
230
|
+
2px 6px,
|
|
231
|
+
calc(100% - 6px) 1px,
|
|
232
|
+
1px calc(100% - 4px),
|
|
233
|
+
calc(100% - 6px) 1px,
|
|
234
|
+
1px calc(100% - 4px);
|
|
235
|
+
box-shadow: 0 0 0 1px rgba(57, 76, 96, 0.15);
|
|
236
|
+
}
|
|
237
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
viewportRef: HTMLDivElement;
|
|
3
|
+
wrapperRef: HTMLDivElement;
|
|
4
|
+
pageRef: HTMLDivElement;
|
|
5
|
+
}
|
|
6
|
+
declare const ActiveLayers: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type ActiveLayers = ReturnType<typeof ActiveLayers>;
|
|
8
|
+
export default ActiveLayers;
|
package/dist/components/{presentation-editor/cognition-slides.js → editor/cognition-pages.js}
RENAMED
|
@@ -25,7 +25,7 @@ export const cognitionImages = [
|
|
|
25
25
|
height: 800,
|
|
26
26
|
},
|
|
27
27
|
];
|
|
28
|
-
export const
|
|
28
|
+
export const cognitionPages = [
|
|
29
29
|
{
|
|
30
30
|
slide_layout_plan: "For the first slide, I want to introduce the topic and provide a brief overview of what's to come. A title slide is appropriate here, with a headline that clearly indicates the subject matter and a subheadline that gives some additional context. The image should reflect the high-level topic of AI in acquiring banks. This slide sets the stage for the deeper dive into the statistics and insights that will be covered in subsequent slides.",
|
|
31
31
|
type: 'title',
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import * as Tooltip from '../ui/tooltip/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import type { Editor } from './editor.svelte.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface Props {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { editor }: Props = $props();
|
|
6
10
|
</script>
|
|
7
11
|
|
|
8
12
|
{#if editor.activeAction?.tooltip}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { HtmlContent } from './layers/types/
|
|
3
|
-
import {
|
|
2
|
+
import { HtmlContent } from './layers/types/text/index.js';
|
|
3
|
+
import type { Editor } from './editor.svelte.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface Props {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { editor }: Props = $props();
|
|
6
10
|
</script>
|
|
7
11
|
|
|
8
12
|
{#if editor.dragged}
|