@peteai/presentation-editor 0.0.2 → 0.0.4
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 +2 -2
- package/dist/components/presentation-editor/active-layers-buttons.svelte +53 -0
- package/dist/components/presentation-editor/active-layers-buttons.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/active-layers.svelte +181 -0
- package/dist/components/presentation-editor/active-layers.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient-def.svelte +81 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient-def.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient.svelte +21 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator.svelte +23 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator.svelte.d.ts +6 -0
- package/dist/components/presentation-editor/color-indicator/index.d.ts +4 -0
- package/dist/components/presentation-editor/color-indicator/index.js +6 -0
- package/dist/components/presentation-editor/cursor-tooltip.svelte +1 -1
- package/dist/components/presentation-editor/dragged.svelte +21 -11
- package/dist/components/presentation-editor/fonts.d.ts +3 -0
- package/dist/components/presentation-editor/fonts.js +1278 -0
- package/dist/components/presentation-editor/header.svelte +21 -33
- package/dist/components/presentation-editor/header.svelte.d.ts +16 -6
- package/dist/components/presentation-editor/hotkeys.svelte +85 -0
- package/dist/components/presentation-editor/{sidebar/layers.svelte.d.ts → hotkeys.svelte.d.ts} +3 -3
- package/dist/components/presentation-editor/layers/active-background-border.svelte +3 -7
- package/dist/components/presentation-editor/layers/active-layer-border.svelte +2 -5
- package/dist/components/presentation-editor/layers/active-layer-border.svelte.d.ts +0 -1
- package/dist/components/presentation-editor/layers/buttons/border-button/border-button.svelte +113 -129
- package/dist/components/presentation-editor/layers/buttons/border-button/border-button.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/corner-radius-button.svelte +51 -32
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/corner-radius-button.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/buttons/flip-button/flip-button.svelte +30 -7
- package/dist/components/presentation-editor/layers/buttons/flip-button/flip-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/buttons/opacity-button/opacity-button.svelte +76 -33
- package/dist/components/presentation-editor/layers/buttons/opacity-button/opacity-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/corner-scale-control.svelte +89 -59
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/corner-scale-control.svelte.d.ts +5 -100
- package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte +337 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte.d.ts +104 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/index.js +4 -0
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte +128 -43
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte.d.ts +1 -5
- package/dist/components/presentation-editor/layers/controls/side-resize-control/side-resize-control.svelte +68 -57
- package/dist/components/presentation-editor/layers/controls/side-resize-control/side-resize-control.svelte.d.ts +2 -110
- package/dist/components/presentation-editor/layers/controls/side-scale-control/side-scale-control.svelte +45 -32
- package/dist/components/presentation-editor/layers/controls/side-scale-control/side-scale-control.svelte.d.ts +2 -54
- package/dist/components/presentation-editor/layers/index.d.ts +4 -5
- package/dist/components/presentation-editor/layers/index.js +7 -8
- package/dist/components/presentation-editor/layers/layer-button.svelte +25 -7
- package/dist/components/presentation-editor/layers/layer-wrapper.svelte +212 -162
- package/dist/components/presentation-editor/layers/layer-wrapper.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte +41 -0
- package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte +28 -74
- package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte.d.ts +2 -17
- package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte +19 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer.svelte +69 -61
- package/dist/components/presentation-editor/layers/types/background/background-layer.svelte.d.ts +2 -3
- package/dist/components/presentation-editor/layers/types/background/index.d.ts +2 -3
- package/dist/components/presentation-editor/layers/types/background/index.js +2 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/alignment-button.svelte +55 -12
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/alignment-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte +60 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/case-button.svelte +59 -24
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/case-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/color-button.svelte +27 -76
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/color-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/font-family-button.svelte +36 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/font-family-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/font-size-button.svelte +72 -29
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/font-size-button.svelte.d.ts +3 -5
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte +60 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte +71 -18
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/strikethrough-button.svelte +54 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/strikethrough-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/underline-button.svelte +54 -9
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/underline-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/editor/createEditor.js +2 -2
- package/dist/components/presentation-editor/layers/types/html/editor/utils.d.ts +11 -0
- package/dist/components/presentation-editor/layers/types/html/editor/utils.js +88 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/font-family.d.ts +27 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/font-family.js +40 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/font-size.d.ts +5 -1
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/font-size.js +3 -7
- package/dist/components/presentation-editor/layers/types/html/extensions.d.ts +1 -0
- package/dist/components/presentation-editor/layers/types/html/extensions.js +56 -0
- package/dist/components/presentation-editor/layers/types/html/html-content.svelte +26 -5
- package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte +26 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte +103 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte +61 -53
- package/dist/components/presentation-editor/layers/types/html/index.d.ts +3 -5
- package/dist/components/presentation-editor/layers/types/html/index.js +3 -56
- package/dist/components/presentation-editor/layers/types/image/{image-content.svelte → image-layer-content.svelte} +11 -3
- package/dist/components/presentation-editor/layers/types/image/image-layer-content.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer.svelte +51 -21
- package/dist/components/presentation-editor/layers/types/image/index.d.ts +2 -4
- package/dist/components/presentation-editor/layers/types/image/index.js +2 -4
- package/dist/components/presentation-editor/layers/utils.d.ts +68 -9
- package/dist/components/presentation-editor/layers/utils.js +260 -25
- package/dist/components/presentation-editor/menu/background-menu-content.svelte +80 -0
- package/dist/components/presentation-editor/menu/background-menu-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/menu/layer-menu-content.svelte +183 -0
- package/dist/components/presentation-editor/menu/layer-menu-content.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/menu/slide-menu-content.svelte +67 -0
- package/dist/components/presentation-editor/menu/slide-menu-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/presentation-editor.svelte +119 -175
- package/dist/components/presentation-editor/presentation-editor.svelte.js +597 -136
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-color.svelte +58 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-color.svelte.d.ts +10 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte +144 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar.svelte +404 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/index.d.ts +2 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/index.js +2 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar-button.svelte +26 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar-button.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar.svelte +216 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/index.d.ts +2 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/index.js +2 -0
- package/dist/components/presentation-editor/sidebar/position-slidebar.svelte +130 -0
- package/dist/components/presentation-editor/sidebar/position-slidebar.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab-button.svelte +90 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab.svelte +82 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/sidebar/{images-library.svelte → sidebar-uploads-tab.svelte} +0 -1
- package/dist/components/presentation-editor/sidebar/sidebar-uploads-tab.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/sidebar-wrapper.svelte +25 -0
- package/dist/components/presentation-editor/sidebar/sidebar-wrapper.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/sidebar.svelte +71 -15
- package/dist/components/presentation-editor/sidebar/sidebar.svelte.d.ts +16 -5
- package/dist/components/presentation-editor/sidebar/uploads-image.svelte +28 -11
- package/dist/components/presentation-editor/slide-editor.svelte +20 -22
- package/dist/components/presentation-editor/slide-inner.svelte +19 -18
- package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte +61 -52
- package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte +6 -8
- package/dist/components/presentation-editor/snapping-guides.svelte +3 -3
- package/dist/components/presentation-editor/types.d.ts +67 -27
- package/dist/components/presentation-editor/utils.d.ts +50 -1
- package/dist/components/presentation-editor/utils.js +101 -6
- package/dist/components/ui/button/button.svelte +3 -2
- package/dist/components/ui/button/button.svelte.d.ts +5 -82
- package/dist/components/ui/color-picker/color-picker-alpha-grid.svelte +43 -0
- package/dist/components/ui/color-picker/color-picker-alpha-grid.svelte.d.ts +8 -0
- package/dist/components/ui/color-picker/color-picker.svelte +344 -0
- package/dist/components/ui/color-picker/color-picker.svelte.d.ts +13 -0
- package/dist/components/ui/color-picker/index.d.ts +3 -0
- package/dist/components/ui/color-picker/index.js +5 -0
- package/dist/components/ui/context-menu/context-menu-shortcut.svelte +6 -3
- package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +6 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/infinite-loader/index.d.ts +4 -0
- package/dist/components/ui/infinite-loader/index.js +4 -0
- package/dist/components/ui/infinite-loader/infinite-loader-loop-tracker.d.ts +13 -0
- package/dist/components/ui/infinite-loader/infinite-loader-loop-tracker.js +44 -0
- package/dist/components/ui/infinite-loader/infinite-loader-state.svelte.d.ts +15 -0
- package/dist/components/ui/infinite-loader/infinite-loader-state.svelte.js +28 -0
- package/dist/components/ui/infinite-loader/infinite-loader.svelte +149 -0
- package/dist/components/ui/infinite-loader/infinite-loader.svelte.d.ts +17 -0
- package/dist/components/ui/input/input.svelte +1 -1
- package/dist/components/ui/slider/slider.svelte +20 -18
- package/dist/components/ui/tabs/index.d.ts +6 -0
- package/dist/components/ui/tabs/index.js +8 -0
- package/dist/components/ui/tabs/tabs-content.svelte +19 -0
- package/dist/components/ui/tabs/tabs-content.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-list.svelte +19 -0
- package/dist/components/ui/tabs/tabs-list.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte +19 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte.d.ts +4 -0
- package/dist/components/ui/toggle/toggle.svelte +3 -2
- package/dist/components/ui/toggle/toggle.svelte.d.ts +2 -46
- package/dist/plugin.js +3 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/package.json +28 -25
- package/dist/components/presentation-editor/app.css +0 -12
- package/dist/components/presentation-editor/layers/hovered-layer.svelte +0 -34
- package/dist/components/presentation-editor/layers/hovered-layer.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/background/background-content.svelte +0 -11
- package/dist/components/presentation-editor/layers/types/background/background-content.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte +0 -12
- package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/html/html-layer-active.svelte +0 -159
- package/dist/components/presentation-editor/layers/types/html/html-layer-active.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/html/html-layer-buttons.svelte +0 -42
- package/dist/components/presentation-editor/layers/types/html/html-layer-buttons.svelte.d.ts +0 -10
- package/dist/components/presentation-editor/layers/types/html/html-layer-thumb.svelte +0 -24
- package/dist/components/presentation-editor/layers/types/html/html-layer-thumb.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/image/image-content.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte +0 -21
- package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/image/image-layer-thumb.svelte +0 -13
- package/dist/components/presentation-editor/layers/types/image/image-layer-thumb.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/sidebar/images-library.svelte.d.ts +0 -3
- package/dist/components/presentation-editor/sidebar/layers.svelte +0 -94
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-delete-button.svelte +0 -32
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-delete-button.svelte.d.ts +0 -10
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-duplicate-button.svelte +0 -34
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-duplicate-button.svelte.d.ts +0 -10
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
-
import type { Layer } from '../../../types.js';
|
|
3
2
|
declare const cornerScaleControlVariants: import("tailwind-variants").TVReturnType<{
|
|
4
3
|
origin: {
|
|
5
4
|
'bottom-right': {
|
|
@@ -27,53 +26,7 @@ declare const cornerScaleControlVariants: import("tailwind-variants").TVReturnTy
|
|
|
27
26
|
base: string;
|
|
28
27
|
handler: string;
|
|
29
28
|
cursor: string;
|
|
30
|
-
}, undefined,
|
|
31
|
-
origin: {
|
|
32
|
-
'bottom-right': {
|
|
33
|
-
base: string;
|
|
34
|
-
handler: string;
|
|
35
|
-
cursor: string;
|
|
36
|
-
};
|
|
37
|
-
'bottom-left': {
|
|
38
|
-
base: string;
|
|
39
|
-
handler: string;
|
|
40
|
-
cursor: string;
|
|
41
|
-
};
|
|
42
|
-
'top-right': {
|
|
43
|
-
base: string;
|
|
44
|
-
handler: string;
|
|
45
|
-
cursor: string;
|
|
46
|
-
};
|
|
47
|
-
'top-left': {
|
|
48
|
-
base: string;
|
|
49
|
-
handler: string;
|
|
50
|
-
cursor: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
}, {
|
|
54
|
-
origin: {
|
|
55
|
-
'bottom-right': {
|
|
56
|
-
base: string;
|
|
57
|
-
handler: string;
|
|
58
|
-
cursor: string;
|
|
59
|
-
};
|
|
60
|
-
'bottom-left': {
|
|
61
|
-
base: string;
|
|
62
|
-
handler: string;
|
|
63
|
-
cursor: string;
|
|
64
|
-
};
|
|
65
|
-
'top-right': {
|
|
66
|
-
base: string;
|
|
67
|
-
handler: string;
|
|
68
|
-
cursor: string;
|
|
69
|
-
};
|
|
70
|
-
'top-left': {
|
|
71
|
-
base: string;
|
|
72
|
-
handler: string;
|
|
73
|
-
cursor: string;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
}>, {
|
|
29
|
+
}, undefined, {
|
|
77
30
|
origin: {
|
|
78
31
|
'bottom-right': {
|
|
79
32
|
base: string;
|
|
@@ -127,58 +80,10 @@ declare const cornerScaleControlVariants: import("tailwind-variants").TVReturnTy
|
|
|
127
80
|
base: string;
|
|
128
81
|
handler: string;
|
|
129
82
|
cursor: string;
|
|
130
|
-
}, undefined,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
base: string;
|
|
134
|
-
handler: string;
|
|
135
|
-
cursor: string;
|
|
136
|
-
};
|
|
137
|
-
'bottom-left': {
|
|
138
|
-
base: string;
|
|
139
|
-
handler: string;
|
|
140
|
-
cursor: string;
|
|
141
|
-
};
|
|
142
|
-
'top-right': {
|
|
143
|
-
base: string;
|
|
144
|
-
handler: string;
|
|
145
|
-
cursor: string;
|
|
146
|
-
};
|
|
147
|
-
'top-left': {
|
|
148
|
-
base: string;
|
|
149
|
-
handler: string;
|
|
150
|
-
cursor: string;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
}, {
|
|
154
|
-
origin: {
|
|
155
|
-
'bottom-right': {
|
|
156
|
-
base: string;
|
|
157
|
-
handler: string;
|
|
158
|
-
cursor: string;
|
|
159
|
-
};
|
|
160
|
-
'bottom-left': {
|
|
161
|
-
base: string;
|
|
162
|
-
handler: string;
|
|
163
|
-
cursor: string;
|
|
164
|
-
};
|
|
165
|
-
'top-right': {
|
|
166
|
-
base: string;
|
|
167
|
-
handler: string;
|
|
168
|
-
cursor: string;
|
|
169
|
-
};
|
|
170
|
-
'top-left': {
|
|
171
|
-
base: string;
|
|
172
|
-
handler: string;
|
|
173
|
-
cursor: string;
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
}>, unknown, unknown, undefined>>;
|
|
177
|
-
type Origin = VariantProps<typeof cornerScaleControlVariants>['origin'];
|
|
178
|
-
interface Props {
|
|
179
|
-
origin: NonNullable<Origin>;
|
|
180
|
-
layer: Layer;
|
|
83
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
84
|
+
type Variants = VariantProps<typeof cornerScaleControlVariants>;
|
|
85
|
+
interface Props extends Omit<Variants, 'origin'>, Required<Pick<Variants, 'origin'>> {
|
|
181
86
|
}
|
|
182
|
-
declare const CornerScaleControl: import("svelte").Component<Props, {}, "
|
|
87
|
+
declare const CornerScaleControl: import("svelte").Component<Props, {}, "">;
|
|
183
88
|
type CornerScaleControl = ReturnType<typeof CornerScaleControl>;
|
|
184
89
|
export default CornerScaleControl;
|
|
@@ -0,0 +1,337 @@
|
|
|
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>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const sideResizeControlVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
origin: {
|
|
4
|
+
right: {
|
|
5
|
+
base: string;
|
|
6
|
+
handler: string;
|
|
7
|
+
grip: string;
|
|
8
|
+
cursor: string;
|
|
9
|
+
};
|
|
10
|
+
left: {
|
|
11
|
+
base: string;
|
|
12
|
+
handler: string;
|
|
13
|
+
grip: string;
|
|
14
|
+
cursor: string;
|
|
15
|
+
};
|
|
16
|
+
top: {
|
|
17
|
+
base: string;
|
|
18
|
+
handler: string;
|
|
19
|
+
grip: string;
|
|
20
|
+
cursor: string;
|
|
21
|
+
};
|
|
22
|
+
bottom: {
|
|
23
|
+
base: string;
|
|
24
|
+
handler: string;
|
|
25
|
+
grip: string;
|
|
26
|
+
cursor: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
base: string;
|
|
31
|
+
handler: string;
|
|
32
|
+
grip: string;
|
|
33
|
+
cursor: string;
|
|
34
|
+
}, undefined, {
|
|
35
|
+
origin: {
|
|
36
|
+
right: {
|
|
37
|
+
base: string;
|
|
38
|
+
handler: string;
|
|
39
|
+
grip: string;
|
|
40
|
+
cursor: string;
|
|
41
|
+
};
|
|
42
|
+
left: {
|
|
43
|
+
base: string;
|
|
44
|
+
handler: string;
|
|
45
|
+
grip: string;
|
|
46
|
+
cursor: string;
|
|
47
|
+
};
|
|
48
|
+
top: {
|
|
49
|
+
base: string;
|
|
50
|
+
handler: string;
|
|
51
|
+
grip: string;
|
|
52
|
+
cursor: string;
|
|
53
|
+
};
|
|
54
|
+
bottom: {
|
|
55
|
+
base: string;
|
|
56
|
+
handler: string;
|
|
57
|
+
grip: string;
|
|
58
|
+
cursor: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}, {
|
|
62
|
+
base: string;
|
|
63
|
+
handler: string;
|
|
64
|
+
grip: string;
|
|
65
|
+
cursor: string;
|
|
66
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
67
|
+
origin: {
|
|
68
|
+
right: {
|
|
69
|
+
base: string;
|
|
70
|
+
handler: string;
|
|
71
|
+
grip: string;
|
|
72
|
+
cursor: string;
|
|
73
|
+
};
|
|
74
|
+
left: {
|
|
75
|
+
base: string;
|
|
76
|
+
handler: string;
|
|
77
|
+
grip: string;
|
|
78
|
+
cursor: string;
|
|
79
|
+
};
|
|
80
|
+
top: {
|
|
81
|
+
base: string;
|
|
82
|
+
handler: string;
|
|
83
|
+
grip: string;
|
|
84
|
+
cursor: string;
|
|
85
|
+
};
|
|
86
|
+
bottom: {
|
|
87
|
+
base: string;
|
|
88
|
+
handler: string;
|
|
89
|
+
grip: string;
|
|
90
|
+
cursor: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}, {
|
|
94
|
+
base: string;
|
|
95
|
+
handler: string;
|
|
96
|
+
grip: string;
|
|
97
|
+
cursor: string;
|
|
98
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
99
|
+
type Variants = VariantProps<typeof sideResizeControlVariants>;
|
|
100
|
+
interface Props extends Omit<Variants, 'origin'>, Required<Pick<Variants, 'origin'>> {
|
|
101
|
+
}
|
|
102
|
+
declare const GroupResizeControl: import("svelte").Component<Props, {}, "">;
|
|
103
|
+
type GroupResizeControl = ReturnType<typeof GroupResizeControl>;
|
|
104
|
+
export default GroupResizeControl;
|