@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,337 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
-
import type { Layer } from '../../../types.js';
|
|
4
|
-
|
|
5
|
-
const sideResizeControlVariants = tv({
|
|
6
|
-
slots: {
|
|
7
|
-
base: 'group absolute flex flex-col items-center justify-center pointer-events-none',
|
|
8
|
-
handler: 'absolute pointer-events-auto',
|
|
9
|
-
grip: 'rounded-sm bg-white group-active:bg-primary group-hover:bg-primary transition-colors',
|
|
10
|
-
cursor: '',
|
|
11
|
-
},
|
|
12
|
-
variants: {
|
|
13
|
-
origin: {
|
|
14
|
-
right: {
|
|
15
|
-
base: '-left-4 w-8 h-full',
|
|
16
|
-
handler: '-translate-x-2 w-4 h-full',
|
|
17
|
-
grip: 'w-1.5 h-4',
|
|
18
|
-
cursor: 'cursor-ew-resize',
|
|
19
|
-
},
|
|
20
|
-
left: {
|
|
21
|
-
base: '-right-4 w-8 h-full',
|
|
22
|
-
handler: 'translate-x-2 w-4 h-full',
|
|
23
|
-
grip: 'w-1.5 h-4',
|
|
24
|
-
cursor: 'cursor-ew-resize',
|
|
25
|
-
},
|
|
26
|
-
top: {
|
|
27
|
-
base: '-bottom-4 w-full h-8',
|
|
28
|
-
handler: 'translate-y-2 w-full h-4',
|
|
29
|
-
grip: 'w-4 h-1.5',
|
|
30
|
-
cursor: 'cursor-ns-resize',
|
|
31
|
-
},
|
|
32
|
-
bottom: {
|
|
33
|
-
base: '-top-4 w-full h-8',
|
|
34
|
-
handler: '-translate-y-2 w-full h-4',
|
|
35
|
-
grip: 'w-4 h-1.5',
|
|
36
|
-
cursor: 'cursor-ns-resize',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
type Variants = VariantProps<typeof sideResizeControlVariants>;
|
|
43
|
-
|
|
44
|
-
interface Props extends Omit<Variants, 'origin'>, Required<Pick<Variants, 'origin'>> {}
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<script lang="ts">
|
|
48
|
-
import { tick } from 'svelte';
|
|
49
|
-
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
50
|
-
import { cn } from '../../../../../utils.js';
|
|
51
|
-
import {
|
|
52
|
-
calculateGroupRotatedBoundingBox,
|
|
53
|
-
calculateLayerTransform,
|
|
54
|
-
calculateNewPosition,
|
|
55
|
-
calculateNewSize,
|
|
56
|
-
degToRad,
|
|
57
|
-
getRotatedBoundingBox,
|
|
58
|
-
rotatePoint,
|
|
59
|
-
type Transform,
|
|
60
|
-
} from '../../utils.js';
|
|
61
|
-
|
|
62
|
-
let { origin }: Props = $props();
|
|
63
|
-
|
|
64
|
-
const type = `${origin}-origin-resize`;
|
|
65
|
-
|
|
66
|
-
const editor = getPresentationEditorContext();
|
|
67
|
-
|
|
68
|
-
const { base, handler, grip, cursor } = sideResizeControlVariants({ origin });
|
|
69
|
-
|
|
70
|
-
let initial: {
|
|
71
|
-
clientX: number;
|
|
72
|
-
clientY: number;
|
|
73
|
-
bbox: Transform;
|
|
74
|
-
layers: (Layer & { state: Layer })[];
|
|
75
|
-
} | null = null;
|
|
76
|
-
let isChanged = false;
|
|
77
|
-
const actionId = editor.generateId();
|
|
78
|
-
|
|
79
|
-
const onMouseDown = (e: MouseEvent) => {
|
|
80
|
-
if (e.button !== 0) return;
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
e.stopPropagation();
|
|
83
|
-
console.log(type, 'mousedown', e);
|
|
84
|
-
|
|
85
|
-
isChanged = false;
|
|
86
|
-
initial = {
|
|
87
|
-
clientX: e.clientX,
|
|
88
|
-
clientY: e.clientY,
|
|
89
|
-
bbox: calculateGroupRotatedBoundingBox(
|
|
90
|
-
editor.activeLayers.map(calculateLayerTransform),
|
|
91
|
-
editor.activeGroupRotate,
|
|
92
|
-
),
|
|
93
|
-
layers: editor.activeLayers.map((layer) => ({ ...layer, state: layer })),
|
|
94
|
-
};
|
|
95
|
-
editor.activeAction = {
|
|
96
|
-
id: actionId,
|
|
97
|
-
type,
|
|
98
|
-
cursor: cursor(),
|
|
99
|
-
};
|
|
100
|
-
addEventListener('mousemove', onMouseMove);
|
|
101
|
-
addEventListener('mouseup', onMouseUp);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const onMouseUp = (e: MouseEvent) => {
|
|
105
|
-
console.log(type, 'mouseup', e);
|
|
106
|
-
removeEventListener('mousemove', onMouseMove);
|
|
107
|
-
removeEventListener('mouseup', onMouseUp);
|
|
108
|
-
|
|
109
|
-
if (editor.activeAction?.id !== actionId) return;
|
|
110
|
-
editor.activeAction = null;
|
|
111
|
-
if (!initial || !isChanged) return;
|
|
112
|
-
|
|
113
|
-
editor.historyPush({
|
|
114
|
-
type: 'layersGroup',
|
|
115
|
-
actions: initial.layers.map((layerWithState) => {
|
|
116
|
-
const { state, ...layer } = layerWithState;
|
|
117
|
-
if (editor.isLayerOutOfBounds(state)) {
|
|
118
|
-
return {
|
|
119
|
-
type: 'layersRemove',
|
|
120
|
-
slideId: editor.activeSlide.id,
|
|
121
|
-
layers: [layer],
|
|
122
|
-
};
|
|
123
|
-
} else {
|
|
124
|
-
return {
|
|
125
|
-
type: 'layer',
|
|
126
|
-
slideId: editor.activeSlide.id,
|
|
127
|
-
layer: { id: layer.id, type: layer.type },
|
|
128
|
-
undo: {
|
|
129
|
-
x: layer.x,
|
|
130
|
-
y: layer.y,
|
|
131
|
-
width: layer.width,
|
|
132
|
-
height: layer.height,
|
|
133
|
-
...(layer.type === 'image' && {
|
|
134
|
-
scale: layer.scale,
|
|
135
|
-
offsetX: layer.offsetX,
|
|
136
|
-
offsetY: layer.offsetY,
|
|
137
|
-
}),
|
|
138
|
-
},
|
|
139
|
-
redo: {
|
|
140
|
-
x: state.x,
|
|
141
|
-
y: state.y,
|
|
142
|
-
width: state.width,
|
|
143
|
-
height: state.height,
|
|
144
|
-
...(state.type === 'image' && {
|
|
145
|
-
scale: state.scale,
|
|
146
|
-
offsetX: state.offsetX,
|
|
147
|
-
offsetY: state.offsetY,
|
|
148
|
-
}),
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}),
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const onMouseMove = async (e: MouseEvent) => {
|
|
157
|
-
if (!initial || editor.activeAction?.id !== actionId) return;
|
|
158
|
-
|
|
159
|
-
const groupBbox = initial.bbox;
|
|
160
|
-
const groupAngle = degToRad(groupBbox.rotate);
|
|
161
|
-
const xDiff = (e.clientX - initial.clientX) / editor.zoom;
|
|
162
|
-
const yDiff = (e.clientY - initial.clientY) / editor.zoom;
|
|
163
|
-
const adjustedXDiff = xDiff * Math.cos(groupAngle) + yDiff * Math.sin(groupAngle);
|
|
164
|
-
const adjustedYDiff = -xDiff * Math.sin(groupAngle) + yDiff * Math.cos(groupAngle);
|
|
165
|
-
|
|
166
|
-
let groupNewWidth = groupBbox.width;
|
|
167
|
-
let groupNewHeight = groupBbox.height;
|
|
168
|
-
const minSize = 10;
|
|
169
|
-
if (origin === 'left') {
|
|
170
|
-
groupNewWidth = Math.max(groupBbox.width + adjustedXDiff, minSize);
|
|
171
|
-
} else if (origin === 'top') {
|
|
172
|
-
groupNewHeight = Math.max(groupBbox.height + adjustedYDiff, minSize);
|
|
173
|
-
} else if (origin === 'right') {
|
|
174
|
-
groupNewWidth = Math.max(groupBbox.width - adjustedXDiff, minSize);
|
|
175
|
-
} else if (origin === 'bottom') {
|
|
176
|
-
groupNewHeight = Math.max(groupBbox.height - adjustedYDiff, minSize);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
isChanged = groupNewWidth !== groupBbox.width || groupNewHeight !== groupBbox.height;
|
|
180
|
-
|
|
181
|
-
const { newX: groupNewX, newY: groupNewY } = calculateNewPosition(
|
|
182
|
-
origin,
|
|
183
|
-
initial.bbox,
|
|
184
|
-
groupNewWidth,
|
|
185
|
-
groupNewHeight,
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
const widthScale = groupNewWidth / groupBbox.width;
|
|
189
|
-
const heightScale = groupNewHeight / groupBbox.height;
|
|
190
|
-
|
|
191
|
-
const groupCenter = {
|
|
192
|
-
x: groupBbox.x + groupBbox.width / 2,
|
|
193
|
-
y: groupBbox.y + groupBbox.height / 2,
|
|
194
|
-
};
|
|
195
|
-
const groupNewCenter = { x: groupNewX + groupNewWidth / 2, y: groupNewY + groupNewHeight / 2 };
|
|
196
|
-
// calculate rotated points relative to new group center
|
|
197
|
-
const groupCenterRotated = rotatePoint(groupCenter, groupNewCenter, -groupAngle);
|
|
198
|
-
|
|
199
|
-
await Promise.all(
|
|
200
|
-
initial.layers.map(async (layer) => {
|
|
201
|
-
const { width, height, x, y, rotate } = calculateLayerTransform(layer);
|
|
202
|
-
const center = { x: x + width / 2, y: y + height / 2 };
|
|
203
|
-
const centerRotated = rotatePoint(center, groupNewCenter, -groupAngle);
|
|
204
|
-
const newCenterRotated = {
|
|
205
|
-
x: groupNewCenter.x + (centerRotated.x - groupCenterRotated.x) * widthScale,
|
|
206
|
-
y: groupNewCenter.y + (centerRotated.y - groupCenterRotated.y) * heightScale,
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
// rotate relative to the bbox
|
|
210
|
-
const rotateRelative = rotate - groupBbox.rotate;
|
|
211
|
-
|
|
212
|
-
const isHorizontal = origin === 'left' || origin === 'right';
|
|
213
|
-
const bboxScale = isHorizontal ? widthScale : heightScale;
|
|
214
|
-
const newSize = calculateNewSize(width, height, rotateRelative, bboxScale, isHorizontal);
|
|
215
|
-
|
|
216
|
-
const scale = layer.scale || 1;
|
|
217
|
-
|
|
218
|
-
let newWidth = newSize.width;
|
|
219
|
-
let newHeight = newSize.height;
|
|
220
|
-
let newScale = scale;
|
|
221
|
-
|
|
222
|
-
if (layer.type === 'html') {
|
|
223
|
-
if (newSize.scaled === 'height') {
|
|
224
|
-
newHeight = layer.height * scale;
|
|
225
|
-
} else {
|
|
226
|
-
Object.assign(layer.state, {
|
|
227
|
-
width: newWidth / scale,
|
|
228
|
-
});
|
|
229
|
-
await tick();
|
|
230
|
-
|
|
231
|
-
const layerContent = document.getElementById(`layer-content-${layer.id}`);
|
|
232
|
-
if (layerContent) {
|
|
233
|
-
newHeight = layerContent.offsetHeight * scale;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (newWidth < minSize) {
|
|
239
|
-
newWidth = minSize;
|
|
240
|
-
}
|
|
241
|
-
if (newHeight < minSize) {
|
|
242
|
-
newHeight = minSize;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const bboxRotated = getRotatedBoundingBox(
|
|
246
|
-
centerRotated,
|
|
247
|
-
newWidth,
|
|
248
|
-
newHeight,
|
|
249
|
-
rotateRelative,
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
if (origin === 'left' || origin === 'right') {
|
|
253
|
-
const minX = groupNewX + bboxRotated.width / 2;
|
|
254
|
-
const maxX = groupNewX + groupNewWidth - bboxRotated.width / 2;
|
|
255
|
-
newCenterRotated.x =
|
|
256
|
-
origin === 'left'
|
|
257
|
-
? Math.max(Math.min(newCenterRotated.x, maxX), minX)
|
|
258
|
-
: Math.min(Math.max(newCenterRotated.x, minX), maxX);
|
|
259
|
-
} else {
|
|
260
|
-
const minY = groupNewY + bboxRotated.height / 2;
|
|
261
|
-
const maxY = groupNewY + groupNewHeight - bboxRotated.height / 2;
|
|
262
|
-
newCenterRotated.y =
|
|
263
|
-
origin === 'top'
|
|
264
|
-
? Math.max(Math.min(newCenterRotated.y, maxY), minY)
|
|
265
|
-
: Math.min(Math.max(newCenterRotated.y, minY), maxY);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
let newCenter = rotatePoint(newCenterRotated, groupNewCenter, degToRad(groupBbox.rotate));
|
|
269
|
-
|
|
270
|
-
if (layer.type === 'image') {
|
|
271
|
-
const offsetX = layer.offsetX || 0;
|
|
272
|
-
const offsetY = layer.offsetY || 0;
|
|
273
|
-
|
|
274
|
-
const { image } = layer;
|
|
275
|
-
|
|
276
|
-
let newOffsetX = offsetX;
|
|
277
|
-
let newOffsetY = offsetY;
|
|
278
|
-
|
|
279
|
-
if (newSize.scaled === 'width') {
|
|
280
|
-
const maxOffsetDiff = Math.min(offsetX, image.width - offsetX - layer.width);
|
|
281
|
-
const maxWidth = (layer.width + Math.max(maxOffsetDiff, 0) * 2) * scale;
|
|
282
|
-
if (newWidth > maxWidth) {
|
|
283
|
-
newScale *= newWidth / maxWidth;
|
|
284
|
-
newOffsetX = offsetX - maxOffsetDiff;
|
|
285
|
-
newOffsetY += ((layer.image.height / 2 - offsetY) * (newScale - scale)) / newScale;
|
|
286
|
-
} else {
|
|
287
|
-
newOffsetX += (layer.width - newWidth / newScale) / 2;
|
|
288
|
-
}
|
|
289
|
-
} else {
|
|
290
|
-
const maxOffsetDiff = Math.min(offsetY, image.height - offsetY - layer.height);
|
|
291
|
-
const maxHeight = (layer.height + Math.max(maxOffsetDiff, 0) * 2) * scale;
|
|
292
|
-
if (newHeight > maxHeight) {
|
|
293
|
-
newScale *= newHeight / maxHeight;
|
|
294
|
-
newOffsetY = offsetY - maxOffsetDiff;
|
|
295
|
-
newOffsetX += ((layer.image.width / 2 - offsetX) * (newScale - scale)) / newScale;
|
|
296
|
-
} else {
|
|
297
|
-
newOffsetY += (layer.height - newHeight / newScale) / 2;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
Object.assign(layer.state, {
|
|
302
|
-
x: newCenter.x - newWidth / 2,
|
|
303
|
-
y: newCenter.y - newHeight / 2,
|
|
304
|
-
width: newWidth / newScale,
|
|
305
|
-
height: newHeight / newScale,
|
|
306
|
-
scale: newScale,
|
|
307
|
-
offsetX: newOffsetX,
|
|
308
|
-
offsetY: newOffsetY,
|
|
309
|
-
});
|
|
310
|
-
} else {
|
|
311
|
-
Object.assign(layer.state, {
|
|
312
|
-
x: newCenter.x - newWidth / 2,
|
|
313
|
-
y: newCenter.y - newHeight / 2,
|
|
314
|
-
width: newWidth / newScale,
|
|
315
|
-
height: newHeight / newScale,
|
|
316
|
-
scale: newScale,
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
}),
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
editor.activeAction.tooltip = {
|
|
323
|
-
x: e.clientX,
|
|
324
|
-
y: e.clientY,
|
|
325
|
-
text: `w: ${Math.round(groupNewWidth)} h: ${Math.round(groupNewHeight)}`,
|
|
326
|
-
};
|
|
327
|
-
};
|
|
328
|
-
</script>
|
|
329
|
-
|
|
330
|
-
<div class={base()}>
|
|
331
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
332
|
-
<div class={cn(handler(), cursor())} onmousedown={onMouseDown}></div>
|
|
333
|
-
<div
|
|
334
|
-
class={grip()}
|
|
335
|
-
style:box-shadow="0 0 4px 1px rgba(57,76,96,.15), 0 0 0 1px rgba(43,59,74,.3)"
|
|
336
|
-
></div>
|
|
337
|
-
</div>
|
package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Slide } from '../../../types.js';
|
|
3
|
-
import { ColorIndicator } from '../../../color-indicator/index.js';
|
|
4
|
-
import BackgroundContentImage from './background-content-image.svelte';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
slide: Slide;
|
|
8
|
-
thumbScale?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
let { slide, thumbScale }: Props = $props();
|
|
12
|
-
|
|
13
|
-
let backgroundColor = $derived(slide.backgroundColor || '#ffffff');
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<ColorIndicator color={backgroundColor} />
|
|
17
|
-
{#if slide.backgroundImage}
|
|
18
|
-
<BackgroundContentImage backgroundImage={slide.backgroundImage} {thumbScale} />
|
|
19
|
-
{/if}
|
package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import BoldIcon from 'lucide-svelte/icons/bold';
|
|
3
|
-
import { Toggle } from '../../../../../../ui/toggle/index.js';
|
|
4
|
-
import type { HtmlLayer } from '../../../../../types.js';
|
|
5
|
-
import { getPresentationEditorContext } from '../../../../../presentation-editor.svelte.js';
|
|
6
|
-
import { createEditorNotReactive } from '../../editor/utils.js';
|
|
7
|
-
import { applyHtmlToLayer } from '../../../../utils.js';
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
layers: HtmlLayer[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let { layers = $bindable() }: Props = $props();
|
|
14
|
-
|
|
15
|
-
const editor = getPresentationEditorContext();
|
|
16
|
-
|
|
17
|
-
const { htmlEditor } = editor;
|
|
18
|
-
|
|
19
|
-
const editorNotReactive = createEditorNotReactive();
|
|
20
|
-
|
|
21
|
-
const isActive = $derived.by(() => {
|
|
22
|
-
if (editor.activeAction?.type === 'edit') {
|
|
23
|
-
return $htmlEditor.isActive('bold');
|
|
24
|
-
} else {
|
|
25
|
-
return layers.every((layer) => {
|
|
26
|
-
editorNotReactive.chain().setContent(layer.html).selectAll().run();
|
|
27
|
-
return editorNotReactive.isActive('bold');
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const setValue = async (value: boolean) => {
|
|
33
|
-
if (editor.activeAction?.type === 'edit') {
|
|
34
|
-
if (value) {
|
|
35
|
-
$htmlEditor.chain().focus().setBold().run();
|
|
36
|
-
} else {
|
|
37
|
-
$htmlEditor.chain().focus().unsetBold().run();
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
editor.historyPush({
|
|
41
|
-
type: 'layersGroup',
|
|
42
|
-
actions: await Promise.all(
|
|
43
|
-
layers.map(async (layer) => {
|
|
44
|
-
let chain = editorNotReactive.chain().setContent(layer.html).selectAll();
|
|
45
|
-
if (value) {
|
|
46
|
-
chain = chain.setBold();
|
|
47
|
-
} else {
|
|
48
|
-
chain = chain.unsetBold();
|
|
49
|
-
}
|
|
50
|
-
chain.run();
|
|
51
|
-
|
|
52
|
-
const undo = { html: layer.html, x: layer.x, y: layer.y, height: layer.height };
|
|
53
|
-
const redo = await applyHtmlToLayer(layer, editorNotReactive.getJSON());
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
type: 'layer',
|
|
57
|
-
slideId: editor.activeSlide.id,
|
|
58
|
-
layer: { id: layer.id, type: layer.type },
|
|
59
|
-
undo,
|
|
60
|
-
redo,
|
|
61
|
-
};
|
|
62
|
-
}),
|
|
63
|
-
),
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<Toggle size="xs" pressed={isActive} onPressedChange={(val) => setValue(val)}>
|
|
70
|
-
<BoldIcon class="h-6 w-6" />
|
|
71
|
-
</Toggle>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import ItalicIcon from 'lucide-svelte/icons/italic';
|
|
3
|
-
import { Toggle } from '../../../../../../ui/toggle/index.js';
|
|
4
|
-
import type { HtmlLayer } from '../../../../../types.js';
|
|
5
|
-
import { getPresentationEditorContext } from '../../../../../presentation-editor.svelte.js';
|
|
6
|
-
import { createEditorNotReactive } from '../../editor/utils.js';
|
|
7
|
-
import { applyHtmlToLayer } from '../../../../utils.js';
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
layers: HtmlLayer[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let { layers = $bindable() }: Props = $props();
|
|
14
|
-
|
|
15
|
-
const editor = getPresentationEditorContext();
|
|
16
|
-
|
|
17
|
-
const { htmlEditor } = editor;
|
|
18
|
-
|
|
19
|
-
const editorNotReactive = createEditorNotReactive();
|
|
20
|
-
|
|
21
|
-
const isActive = $derived.by(() => {
|
|
22
|
-
if (editor.activeAction?.type === 'edit') {
|
|
23
|
-
return $htmlEditor.isActive('italic');
|
|
24
|
-
} else {
|
|
25
|
-
return layers.every((layer) => {
|
|
26
|
-
editorNotReactive.chain().setContent(layer.html).selectAll().run();
|
|
27
|
-
return editorNotReactive.isActive('italic');
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const setValue = async (value: boolean) => {
|
|
33
|
-
if (editor.activeAction?.type === 'edit') {
|
|
34
|
-
if (value) {
|
|
35
|
-
$htmlEditor.chain().focus().setItalic().run();
|
|
36
|
-
} else {
|
|
37
|
-
$htmlEditor.chain().focus().unsetItalic().run();
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
editor.historyPush({
|
|
41
|
-
type: 'layersGroup',
|
|
42
|
-
actions: await Promise.all(
|
|
43
|
-
layers.map(async (layer) => {
|
|
44
|
-
let chain = editorNotReactive.chain().setContent(layer.html).selectAll();
|
|
45
|
-
if (value) {
|
|
46
|
-
chain = chain.setItalic();
|
|
47
|
-
} else {
|
|
48
|
-
chain = chain.unsetItalic();
|
|
49
|
-
}
|
|
50
|
-
chain.run();
|
|
51
|
-
|
|
52
|
-
const undo = { html: layer.html, x: layer.x, y: layer.y, height: layer.height };
|
|
53
|
-
const redo = await applyHtmlToLayer(layer, editorNotReactive.getJSON());
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
type: 'layer',
|
|
57
|
-
slideId: editor.activeSlide.id,
|
|
58
|
-
layer: { id: layer.id, type: layer.type },
|
|
59
|
-
undo,
|
|
60
|
-
redo,
|
|
61
|
-
};
|
|
62
|
-
}),
|
|
63
|
-
),
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<Toggle size="xs" pressed={isActive} onPressedChange={(val) => setValue(val)}>
|
|
70
|
-
<ItalicIcon class="h-6 w-6" />
|
|
71
|
-
</Toggle>
|
package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import BulletListIcon from 'lucide-svelte/icons/list';
|
|
3
|
-
import OrderedListIcon from 'lucide-svelte/icons/list-ordered';
|
|
4
|
-
import { Toggle } from '../../../../../../ui/toggle/index.js';
|
|
5
|
-
import { getPresentationEditorContext } from '../../../../../presentation-editor.svelte.js';
|
|
6
|
-
import type { HtmlLayer } from '../../../../../types.js';
|
|
7
|
-
import type { Editor } from '../../editor/index.js';
|
|
8
|
-
import { createEditorNotReactive } from '../../editor/utils.js';
|
|
9
|
-
import { applyHtmlToLayer } from '../../../../utils.js';
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
layers: HtmlLayer[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let { layers = $bindable() }: Props = $props();
|
|
16
|
-
|
|
17
|
-
const editor = getPresentationEditorContext();
|
|
18
|
-
|
|
19
|
-
const { htmlEditor } = editor;
|
|
20
|
-
|
|
21
|
-
type ListType = 'bulletList' | 'orderedList';
|
|
22
|
-
|
|
23
|
-
const editorNotReactive = createEditorNotReactive();
|
|
24
|
-
|
|
25
|
-
const getListType = (editor: Editor): ListType | false => {
|
|
26
|
-
const listTypes: ListType[] = ['bulletList', 'orderedList'];
|
|
27
|
-
for (let type of listTypes) {
|
|
28
|
-
if (editor.isActive(type)) {
|
|
29
|
-
return type;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const currentListType = $derived.by(() => {
|
|
36
|
-
if (editor.activeAction?.type === 'edit') {
|
|
37
|
-
return getListType($htmlEditor);
|
|
38
|
-
} else {
|
|
39
|
-
const set = new Set<ListType | false>();
|
|
40
|
-
layers.forEach((layer) => {
|
|
41
|
-
editorNotReactive.chain().setContent(layer.html).selectAll().run();
|
|
42
|
-
set.add(getListType(editorNotReactive));
|
|
43
|
-
});
|
|
44
|
-
return set.size > 1 ? false : Array.from(set)[0];
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const setNextListType = (editor: Editor, type: ListType | false) => {
|
|
49
|
-
!type
|
|
50
|
-
? editor.commands.toggleBulletList()
|
|
51
|
-
: type === 'bulletList'
|
|
52
|
-
? editor.commands.toggleOrderedList()
|
|
53
|
-
: editor.commands.toggleUnstyledList();
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const switchListType = async () => {
|
|
57
|
-
if (editor.activeAction?.type === 'edit') {
|
|
58
|
-
setNextListType($htmlEditor, currentListType);
|
|
59
|
-
} else {
|
|
60
|
-
editor.historyPush({
|
|
61
|
-
type: 'layersGroup',
|
|
62
|
-
actions: await Promise.all(
|
|
63
|
-
layers.map(async (layer) => {
|
|
64
|
-
editorNotReactive.chain().setContent(layer.html).selectAll().run();
|
|
65
|
-
setNextListType(editorNotReactive, currentListType);
|
|
66
|
-
|
|
67
|
-
const undo = { html: layer.html, x: layer.x, y: layer.y, height: layer.height };
|
|
68
|
-
const redo = await applyHtmlToLayer(layer, editorNotReactive.getJSON());
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
type: 'layer',
|
|
72
|
-
slideId: editor.activeSlide.id,
|
|
73
|
-
layer: { id: layer.id, type: layer.type },
|
|
74
|
-
undo,
|
|
75
|
-
redo,
|
|
76
|
-
};
|
|
77
|
-
}),
|
|
78
|
-
),
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<Toggle size="xs" pressed={!!currentListType} onPressedChange={switchListType}>
|
|
85
|
-
{#if currentListType === 'orderedList'}
|
|
86
|
-
<OrderedListIcon class="h-6 w-6" />
|
|
87
|
-
{:else}
|
|
88
|
-
<BulletListIcon class="h-6 w-6" />
|
|
89
|
-
{/if}
|
|
90
|
-
</Toggle>
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import {} from '@tiptap/core';
|
|
2
|
-
import { Editor } from './Editor.js';
|
|
3
|
-
import { extensions } from '../extensions.js';
|
|
4
|
-
export const DEFAULT_COLOR = '#000000';
|
|
5
|
-
export const createEditorNotReactive = (content) => {
|
|
6
|
-
return new Editor({
|
|
7
|
-
extensions,
|
|
8
|
-
injectCSS: false,
|
|
9
|
-
content,
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
export const extractSelectionFonts = (editor) => {
|
|
13
|
-
const selection = editor.view.state.selection;
|
|
14
|
-
const set = new Set();
|
|
15
|
-
editor.view.state.doc.nodesBetween(selection.from, selection.to, (node) => {
|
|
16
|
-
if (node.attrs.fontFamily) {
|
|
17
|
-
set.add(node.attrs.fontFamily);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
return Array.from(set);
|
|
21
|
-
};
|
|
22
|
-
export const extractNodeFonts = (content, set = new Set()) => {
|
|
23
|
-
if (content.type !== 'text') {
|
|
24
|
-
if (content.attrs?.fontFamily) {
|
|
25
|
-
set.add(content.attrs.fontFamily);
|
|
26
|
-
}
|
|
27
|
-
content.content?.forEach((content) => extractNodeFonts(content, set));
|
|
28
|
-
}
|
|
29
|
-
return Array.from(set);
|
|
30
|
-
};
|
|
31
|
-
export const extractSelectionFontSizes = (editor) => {
|
|
32
|
-
const selection = editor.view.state.selection;
|
|
33
|
-
const set = new Set();
|
|
34
|
-
editor.view.state.doc.nodesBetween(selection.from, selection.to, (node) => {
|
|
35
|
-
if (node.attrs.fontSize) {
|
|
36
|
-
set.add(node.attrs.fontSize);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return Array.from(set);
|
|
40
|
-
};
|
|
41
|
-
export const extractNodeFontSizes = (content, set = new Set()) => {
|
|
42
|
-
if (content.type !== 'text') {
|
|
43
|
-
if (content.attrs?.fontSize) {
|
|
44
|
-
set.add(content.attrs.fontSize);
|
|
45
|
-
}
|
|
46
|
-
content.content?.forEach((content) => extractNodeFontSizes(content, set));
|
|
47
|
-
}
|
|
48
|
-
return Array.from(set);
|
|
49
|
-
};
|
|
50
|
-
export const extractSelectionColors = (editor) => {
|
|
51
|
-
const selection = editor.view.state.selection;
|
|
52
|
-
const set = new Set();
|
|
53
|
-
editor.view.state.doc.nodesBetween(selection.from, selection.to, (node) => {
|
|
54
|
-
if (node.isText && node.text?.trim().length) {
|
|
55
|
-
const color = node.marks?.find((mark) => mark.type.name === 'textStyle')?.attrs?.color;
|
|
56
|
-
set.add(color || DEFAULT_COLOR);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return Array.from(set);
|
|
60
|
-
};
|
|
61
|
-
export const extractNodeColors = (content, set = new Set()) => {
|
|
62
|
-
if (content.type === 'text') {
|
|
63
|
-
const color = content.marks?.find((mark) => mark.type === 'textStyle')?.attrs?.color;
|
|
64
|
-
set.add(color || DEFAULT_COLOR);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
if (content.attrs?.color) {
|
|
68
|
-
set.add(content.attrs.color);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
content.content?.forEach((content) => extractNodeColors(content, set));
|
|
72
|
-
return Array.from(set);
|
|
73
|
-
};
|
|
74
|
-
export const extractUppercase = (editor) => {
|
|
75
|
-
const selection = editor.view.state.selection;
|
|
76
|
-
let uppercase = null;
|
|
77
|
-
editor.view.state.doc.nodesBetween(selection.from, selection.to, (node) => {
|
|
78
|
-
if (node.type.name !== 'text') {
|
|
79
|
-
if (uppercase !== false && node.attrs.textTransform === 'uppercase') {
|
|
80
|
-
uppercase = true;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
uppercase = false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
return !!uppercase;
|
|
88
|
-
};
|