polotno 3.12.1 → 3.14.0
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/blueprint/canvas/context-menu/context-menu.d.ts +2 -2
- package/blueprint/canvas/page-controls.d.ts +14 -2
- package/blueprint/canvas/tooltip.d.ts +24 -2
- package/blueprint/pages-timeline/audio-track.d.ts +12 -2
- package/blueprint/pages-timeline/audios.d.ts +10 -2
- package/blueprint/pages-timeline/current-time.d.ts +2 -2
- package/blueprint/pages-timeline/element-track.d.ts +14 -2
- package/blueprint/pages-timeline/elements.d.ts +2 -2
- package/blueprint/pages-timeline/page-preview.d.ts +8 -2
- package/blueprint/pages-timeline/pages-timeline.d.ts +8 -2
- package/blueprint/pages-timeline/pages.d.ts +8 -2
- package/blueprint/pages-timeline/play-button.d.ts +2 -2
- package/blueprint/pages-timeline/time-ruler.d.ts +10 -2
- package/blueprint/side-panel/ai-images-panel.d.ts +6 -2
- package/blueprint/side-panel/animations-panel.d.ts +6 -2
- package/blueprint/side-panel/background-panel.d.ts +6 -2
- package/blueprint/side-panel/draw-panel.d.ts +6 -2
- package/blueprint/side-panel/effects-panel.d.ts +6 -2
- package/blueprint/side-panel/image-clip-panel.d.ts +6 -2
- package/blueprint/side-panel/layers-panel.d.ts +6 -2
- package/blueprint/side-panel/pages-panel.d.ts +6 -2
- package/blueprint/side-panel/select-video.d.ts +105 -36
- package/blueprint/side-panel/side-panel.d.ts +2 -2
- package/blueprint/side-panel/size-panel.d.ts +6 -2
- package/blueprint/side-panel/templates-panel.d.ts +6 -2
- package/blueprint/side-panel/text-panel.d.ts +6 -2
- package/blueprint/side-panel/videos-panel.d.ts +6 -2
- package/blueprint/toolbar/admin-button.d.ts +6 -2
- package/blueprint/toolbar/animations-picker.d.ts +18 -4
- package/blueprint/toolbar/copy-style.d.ts +6 -2
- package/blueprint/toolbar/download-button.d.ts +6 -2
- package/blueprint/toolbar/duplicate-button.d.ts +6 -2
- package/blueprint/toolbar/figure-toolbar.d.ts +8 -8
- package/blueprint/toolbar/filters-picker.d.ts +26 -6
- package/blueprint/toolbar/gif-toolbar.d.ts +2 -2
- package/blueprint/toolbar/group-button.d.ts +6 -2
- package/blueprint/toolbar/group-toolbar.d.ts +2 -2
- package/blueprint/toolbar/history-buttons.d.ts +6 -2
- package/blueprint/toolbar/html-toolbar.d.ts +10 -10
- package/blueprint/toolbar/image-remove-background-button.d.ts +10 -2
- package/blueprint/toolbar/image-toolbar.d.ts +28 -8
- package/blueprint/toolbar/line-toolbar.d.ts +14 -10
- package/blueprint/toolbar/lock-button.d.ts +6 -2
- package/blueprint/toolbar/many-toolbar.d.ts +2 -2
- package/blueprint/toolbar/opacity-picker.d.ts +6 -2
- package/blueprint/toolbar/page-toolbar.d.ts +2 -2
- package/blueprint/toolbar/position-picker.d.ts +6 -2
- package/blueprint/toolbar/remove-button.d.ts +6 -2
- package/blueprint/toolbar/svg-toolbar.d.ts +2 -2
- package/blueprint/toolbar/table-toolbar.d.ts +44 -14
- package/blueprint/toolbar/text-ai-write.d.ts +6 -2
- package/blueprint/toolbar/text-toolbar.d.ts +14 -14
- package/blueprint/toolbar/toolbar.d.ts +2 -2
- package/blueprint/toolbar/video-toolbar.d.ts +6 -6
- package/blueprint/toolbar/zoom-buttons.d.ts +4 -4
- package/canvas/apply-filters.js +1 -1
- package/canvas/audio.d.ts +3 -2
- package/canvas/context-menu/context-menu.d.ts +2 -2
- package/canvas/downscale.d.ts +4 -0
- package/canvas/downscale.js +1 -1
- package/canvas/drawing-layer.d.ts +2 -2
- package/canvas/element.d.ts +3 -3
- package/canvas/element.js +1 -1
- package/canvas/fade-overlay.d.ts +14 -0
- package/canvas/fade-overlay.js +1 -0
- package/canvas/figure-element.d.ts +2 -2
- package/canvas/figure-element.js +1 -1
- package/canvas/gif-element.d.ts +2 -2
- package/canvas/gif-element.js +1 -1
- package/canvas/highlighter.d.ts +6 -2
- package/canvas/html-element.d.ts +2 -2
- package/canvas/html-element.js +1 -1
- package/canvas/image-element.d.ts +5 -3
- package/canvas/image-element.js +1 -1
- package/canvas/line-element.d.ts +2 -2
- package/canvas/line-element.js +1 -1
- package/canvas/page-controls.d.ts +14 -2
- package/canvas/page.d.ts +2 -2
- package/canvas/page.js +1 -1
- package/canvas/paint-opacity.d.ts +12 -0
- package/canvas/paint-opacity.js +1 -0
- package/canvas/render-tag-element.d.ts +2 -2
- package/canvas/render-tag-element.js +1 -1
- package/canvas/rich-editor.js +11 -3
- package/canvas/rules.d.ts +2 -2
- package/canvas/table-element.d.ts +2 -2
- package/canvas/table-element.js +1 -1
- package/canvas/text-element/font-specs-loader.js +1 -1
- package/canvas/text-element.d.ts +2 -2
- package/canvas/text-element.js +1 -1
- package/canvas/tooltip.d.ts +24 -2
- package/canvas/use-filtered-source.js +1 -1
- package/canvas/video-element.d.ts +3 -2
- package/canvas/video-element.js +1 -1
- package/canvas/workspace-canvas.d.ts +2 -2
- package/canvas/workspace-canvas.js +1 -1
- package/hooks/use-fade-stop-focus.d.ts +2 -0
- package/hooks/use-fade-stop-focus.js +1 -0
- package/icons/registry.d.ts +106 -102
- package/model/audio-model.d.ts +54 -2
- package/model/figure-model.d.ts +65 -24
- package/model/gif-model.d.ts +65 -24
- package/model/group-model.d.ts +497 -182
- package/model/group-model.js +1 -1
- package/model/history.js +1 -1
- package/model/image-model.d.ts +65 -24
- package/model/line-model.d.ts +65 -24
- package/model/node-model.d.ts +65 -24
- package/model/node-model.js +1 -1
- package/model/page-model.d.ts +4369 -445
- package/model/page-model.js +1 -1
- package/model/shape-model.d.ts +65 -24
- package/model/store.d.ts +480 -18060
- package/model/store.js +1 -1
- package/model/svg-model.d.ts +64 -24
- package/model/table-model.d.ts +40 -12
- package/model/table-model.js +1 -1
- package/model/text-model.d.ts +64 -24
- package/model/text-model.js +1 -1
- package/model/video-model.d.ts +65 -24
- package/package.json +30 -33
- package/pages-timeline/audio-track.d.ts +14 -2
- package/pages-timeline/audio-track.js +1 -1
- package/pages-timeline/audios.d.ts +10 -2
- package/pages-timeline/current-time.d.ts +2 -2
- package/pages-timeline/current-time.js +1 -1
- package/pages-timeline/element-track.d.ts +14 -2
- package/pages-timeline/element-track.js +1 -1
- package/pages-timeline/elements.d.ts +2 -2
- package/pages-timeline/page-preview.d.ts +8 -2
- package/pages-timeline/page-preview.js +1 -1
- package/pages-timeline/pages-timeline.d.ts +8 -2
- package/pages-timeline/pages-timeline.js +1 -1
- package/pages-timeline/pages.d.ts +8 -2
- package/pages-timeline/play-button.d.ts +2 -2
- package/pages-timeline/time-ruler.d.ts +10 -2
- package/pages-timeline/time-ruler.js +1 -1
- package/polotno.bundle.js +181 -169
- package/primitives/panel-header.js +1 -1
- package/primitives/panel-scroll-area.d.ts +4 -0
- package/primitives/panel-scroll-area.js +1 -0
- package/primitives/select.js +1 -1
- package/side-panel/ai-images-panel.d.ts +6 -2
- package/side-panel/animations-panel.d.ts +6 -2
- package/side-panel/animations-panel.js +1 -1
- package/side-panel/background-panel.d.ts +6 -2
- package/side-panel/draw-panel.d.ts +6 -2
- package/side-panel/draw-panel.js +1 -1
- package/side-panel/effects-panel.d.ts +6 -2
- package/side-panel/effects-panel.js +1 -1
- package/side-panel/elements-panel.js +1 -1
- package/side-panel/image-clip-panel.d.ts +6 -2
- package/side-panel/image-clip-panel.js +1 -1
- package/side-panel/layers-panel.d.ts +6 -2
- package/side-panel/layers-panel.js +1 -1
- package/side-panel/pages-panel.d.ts +6 -2
- package/side-panel/select-video.d.ts +105 -36
- package/side-panel/side-panel.d.ts +2 -2
- package/side-panel/side-panel.js +1 -1
- package/side-panel/size-panel.d.ts +6 -2
- package/side-panel/size-panel.js +1 -1
- package/side-panel/templates-panel.d.ts +6 -2
- package/side-panel/text-panel.d.ts +6 -2
- package/side-panel/text-panel.js +1 -1
- package/side-panel/videos-panel.d.ts +6 -2
- package/toolbar/admin-button.d.ts +6 -2
- package/toolbar/animations-picker.d.ts +18 -4
- package/toolbar/color-picker.js +1 -1
- package/toolbar/copy-style.d.ts +6 -2
- package/toolbar/download-button.d.ts +6 -2
- package/toolbar/duplicate-button.d.ts +6 -2
- package/toolbar/figure-toolbar.d.ts +8 -8
- package/toolbar/filters-picker.d.ts +26 -6
- package/toolbar/gif-toolbar.d.ts +2 -2
- package/toolbar/group-button.d.ts +6 -2
- package/toolbar/group-toolbar.d.ts +2 -2
- package/toolbar/history-buttons.d.ts +6 -2
- package/toolbar/html-toolbar.d.ts +10 -10
- package/toolbar/html-toolbar.js +3 -3
- package/toolbar/image-remove-background-button.d.ts +10 -2
- package/toolbar/image-toolbar.d.ts +32 -10
- package/toolbar/line-toolbar.d.ts +14 -10
- package/toolbar/lock-button.d.ts +6 -2
- package/toolbar/many-toolbar.d.ts +2 -2
- package/toolbar/opacity-picker.d.ts +6 -2
- package/toolbar/opacity-picker.js +1 -1
- package/toolbar/page-toolbar.d.ts +2 -2
- package/toolbar/position-picker.d.ts +6 -2
- package/toolbar/remove-button.d.ts +6 -2
- package/toolbar/svg-toolbar.d.ts +2 -2
- package/toolbar/table-toolbar.d.ts +44 -14
- package/toolbar/text-ai-write.d.ts +6 -2
- package/toolbar/text-toolbar.d.ts +30 -18
- package/toolbar/text-toolbar.js +1 -1
- package/toolbar/toolbar.d.ts +2 -2
- package/toolbar/video-toolbar.d.ts +12 -6
- package/toolbar/video-toolbar.js +1 -1
- package/toolbar/zoom-buttons.d.ts +4 -4
- package/ui.css +1 -1
- package/utils/canvas.d.ts +0 -3
- package/utils/canvas.js +1 -1
- package/utils/clip-fade.d.ts +6 -0
- package/utils/clip-fade.js +1 -0
- package/utils/clipboard.d.ts +104 -36
- package/utils/fade-gradient.d.ts +33 -0
- package/utils/fade-gradient.js +1 -0
- package/utils/fade-overlay.d.ts +9 -0
- package/utils/fade-overlay.js +1 -0
- package/utils/fonts.js +1 -1
- package/utils/from-svg.js +1 -1
- package/utils/l10n.d.ts +40 -0
- package/utils/l10n.js +1 -1
- package/utils/pointer-drag.d.ts +6 -4
- package/utils/pointer-drag.js +1 -1
- package/utils/text-format-state.d.ts +3 -0
- package/utils/text-format-state.js +1 -1
- package/utils/validate-key.js +1 -1
|
@@ -14,6 +14,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
14
14
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
15
15
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
16
16
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
17
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
17
18
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
18
19
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
19
20
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -90,6 +91,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
90
91
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
91
92
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
92
93
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
94
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
93
95
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
94
96
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
95
97
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -101,6 +103,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
101
103
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
102
104
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
103
105
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
106
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
104
107
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
105
108
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
106
109
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -112,24 +115,37 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
112
115
|
type: string | undefined;
|
|
113
116
|
name: string | undefined;
|
|
114
117
|
opacity: number | undefined;
|
|
118
|
+
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
|
|
115
119
|
custom: any;
|
|
116
120
|
visible: boolean | undefined;
|
|
117
121
|
selectable: boolean | undefined;
|
|
118
122
|
removable: boolean | undefined;
|
|
119
123
|
alwaysOnTop: boolean | undefined;
|
|
120
124
|
showInExport: boolean | undefined;
|
|
121
|
-
}>,
|
|
122
|
-
id:
|
|
123
|
-
type:
|
|
124
|
-
name:
|
|
125
|
-
opacity:
|
|
126
|
-
custom:
|
|
127
|
-
visible:
|
|
128
|
-
selectable:
|
|
129
|
-
removable:
|
|
130
|
-
alwaysOnTop:
|
|
131
|
-
showInExport:
|
|
132
|
-
}
|
|
125
|
+
}>, {
|
|
126
|
+
id: string;
|
|
127
|
+
type: string;
|
|
128
|
+
name: string;
|
|
129
|
+
opacity: number;
|
|
130
|
+
custom: any;
|
|
131
|
+
visible: boolean;
|
|
132
|
+
selectable: boolean;
|
|
133
|
+
removable: boolean;
|
|
134
|
+
alwaysOnTop: boolean;
|
|
135
|
+
showInExport: boolean;
|
|
136
|
+
} | {
|
|
137
|
+
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
|
|
138
|
+
id: string;
|
|
139
|
+
type: string;
|
|
140
|
+
name: string;
|
|
141
|
+
opacity: number;
|
|
142
|
+
custom: any;
|
|
143
|
+
visible: boolean;
|
|
144
|
+
selectable: boolean;
|
|
145
|
+
removable: boolean;
|
|
146
|
+
alwaysOnTop: boolean;
|
|
147
|
+
showInExport: boolean;
|
|
148
|
+
}>>;
|
|
133
149
|
readonly parent: any;
|
|
134
150
|
readonly zIndex: any;
|
|
135
151
|
} & {
|
|
@@ -144,6 +160,18 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
144
160
|
removable: boolean;
|
|
145
161
|
alwaysOnTop: boolean;
|
|
146
162
|
showInExport: boolean;
|
|
163
|
+
} | {
|
|
164
|
+
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
|
|
165
|
+
id: string;
|
|
166
|
+
type: string;
|
|
167
|
+
name: string;
|
|
168
|
+
opacity: number;
|
|
169
|
+
custom: any;
|
|
170
|
+
visible: boolean;
|
|
171
|
+
selectable: boolean;
|
|
172
|
+
removable: boolean;
|
|
173
|
+
alwaysOnTop: boolean;
|
|
174
|
+
showInExport: boolean;
|
|
147
175
|
};
|
|
148
176
|
} & {
|
|
149
177
|
clone(attrs?: any, { skipSelect }?: {
|
|
@@ -182,6 +210,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
182
210
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
183
211
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
184
212
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
213
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
185
214
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
186
215
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
187
216
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -258,6 +287,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
258
287
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
259
288
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
260
289
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
290
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
261
291
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
262
292
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
263
293
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -269,6 +299,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
269
299
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
270
300
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
271
301
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
302
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
272
303
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
273
304
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
274
305
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -280,24 +311,37 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
280
311
|
type: string | undefined;
|
|
281
312
|
name: string | undefined;
|
|
282
313
|
opacity: number | undefined;
|
|
314
|
+
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
|
|
283
315
|
custom: any;
|
|
284
316
|
visible: boolean | undefined;
|
|
285
317
|
selectable: boolean | undefined;
|
|
286
318
|
removable: boolean | undefined;
|
|
287
319
|
alwaysOnTop: boolean | undefined;
|
|
288
320
|
showInExport: boolean | undefined;
|
|
289
|
-
}>,
|
|
290
|
-
id:
|
|
291
|
-
type:
|
|
292
|
-
name:
|
|
293
|
-
opacity:
|
|
294
|
-
custom:
|
|
295
|
-
visible:
|
|
296
|
-
selectable:
|
|
297
|
-
removable:
|
|
298
|
-
alwaysOnTop:
|
|
299
|
-
showInExport:
|
|
300
|
-
}
|
|
321
|
+
}>, {
|
|
322
|
+
id: string;
|
|
323
|
+
type: string;
|
|
324
|
+
name: string;
|
|
325
|
+
opacity: number;
|
|
326
|
+
custom: any;
|
|
327
|
+
visible: boolean;
|
|
328
|
+
selectable: boolean;
|
|
329
|
+
removable: boolean;
|
|
330
|
+
alwaysOnTop: boolean;
|
|
331
|
+
showInExport: boolean;
|
|
332
|
+
} | {
|
|
333
|
+
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
|
|
334
|
+
id: string;
|
|
335
|
+
type: string;
|
|
336
|
+
name: string;
|
|
337
|
+
opacity: number;
|
|
338
|
+
custom: any;
|
|
339
|
+
visible: boolean;
|
|
340
|
+
selectable: boolean;
|
|
341
|
+
removable: boolean;
|
|
342
|
+
alwaysOnTop: boolean;
|
|
343
|
+
showInExport: boolean;
|
|
344
|
+
}>>;
|
|
301
345
|
readonly parent: any;
|
|
302
346
|
readonly zIndex: any;
|
|
303
347
|
} & {
|
|
@@ -312,6 +356,18 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
312
356
|
removable: boolean;
|
|
313
357
|
alwaysOnTop: boolean;
|
|
314
358
|
showInExport: boolean;
|
|
359
|
+
} | {
|
|
360
|
+
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
|
|
361
|
+
id: string;
|
|
362
|
+
type: string;
|
|
363
|
+
name: string;
|
|
364
|
+
opacity: number;
|
|
365
|
+
custom: any;
|
|
366
|
+
visible: boolean;
|
|
367
|
+
selectable: boolean;
|
|
368
|
+
removable: boolean;
|
|
369
|
+
alwaysOnTop: boolean;
|
|
370
|
+
showInExport: boolean;
|
|
315
371
|
};
|
|
316
372
|
} & {
|
|
317
373
|
clone(attrs?: any, { skipSelect }?: {
|
|
@@ -350,24 +406,37 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
|
|
|
350
406
|
type: string | undefined;
|
|
351
407
|
name: string | undefined;
|
|
352
408
|
opacity: number | undefined;
|
|
409
|
+
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
|
|
353
410
|
custom: any;
|
|
354
411
|
visible: boolean | undefined;
|
|
355
412
|
selectable: boolean | undefined;
|
|
356
413
|
removable: boolean | undefined;
|
|
357
414
|
alwaysOnTop: boolean | undefined;
|
|
358
415
|
showInExport: boolean | undefined;
|
|
359
|
-
}>,
|
|
360
|
-
id:
|
|
361
|
-
type:
|
|
362
|
-
name:
|
|
363
|
-
opacity:
|
|
364
|
-
custom:
|
|
365
|
-
visible:
|
|
366
|
-
selectable:
|
|
367
|
-
removable:
|
|
368
|
-
alwaysOnTop:
|
|
369
|
-
showInExport:
|
|
370
|
-
}
|
|
416
|
+
}>, {
|
|
417
|
+
id: string;
|
|
418
|
+
type: string;
|
|
419
|
+
name: string;
|
|
420
|
+
opacity: number;
|
|
421
|
+
custom: any;
|
|
422
|
+
visible: boolean;
|
|
423
|
+
selectable: boolean;
|
|
424
|
+
removable: boolean;
|
|
425
|
+
alwaysOnTop: boolean;
|
|
426
|
+
showInExport: boolean;
|
|
427
|
+
} | {
|
|
428
|
+
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
|
|
429
|
+
id: string;
|
|
430
|
+
type: string;
|
|
431
|
+
name: string;
|
|
432
|
+
opacity: number;
|
|
433
|
+
custom: any;
|
|
434
|
+
visible: boolean;
|
|
435
|
+
selectable: boolean;
|
|
436
|
+
removable: boolean;
|
|
437
|
+
alwaysOnTop: boolean;
|
|
438
|
+
showInExport: boolean;
|
|
439
|
+
}>> & {
|
|
371
440
|
type: "video";
|
|
372
441
|
}) | undefined>;
|
|
373
442
|
export {};
|
|
@@ -21,7 +21,7 @@ export interface SidePanelProps {
|
|
|
21
21
|
sections?: Section[];
|
|
22
22
|
defaultSection?: string;
|
|
23
23
|
}
|
|
24
|
-
export declare const SidePanel: (({ store, sections, defaultSection }: SidePanelProps) => React.JSX.Element) & {
|
|
25
|
-
|
|
24
|
+
export declare const SidePanel: (({ store, sections, defaultSection }: SidePanelProps) => React.JSX.Element) & React.NamedExoticComponent<SidePanelProps> & {
|
|
25
|
+
readonly type: ({ store, sections, defaultSection }: SidePanelProps) => React.JSX.Element;
|
|
26
26
|
};
|
|
27
27
|
export default SidePanel;
|
package/side-panel/side-panel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{observer as a}from"mobx-react-lite";import{flags as t}from"../utils/flags.js";import{useMobile as i}from"../utils/screen.js";import{t as l}from"../utils/l10n.js";import{cn as s}from"../lib/utils.js";import{PolotnoScope as r}from"../primitives/portal-scope.js";import{SectionTab as p}from"./tab-button.js";import{TemplatesPanel as m}from"./templates-panel.js";import{TextPanel as d}from"./text-panel.js";import{PhotosPanel as c}from"./photos-panel.js";import{ElementsPanel as b}from"./elements-panel.js";import{UploadPanel as f}from"./upload-panel.js";import{BackgroundPanel as u}from"./background-panel.js";import{PagesPanel as x}from"./pages-panel.js";import{LayersPanel as P}from"./layers-panel.js";import{SizePanel as h}from"./size-panel.js";import{DrawPanel as S}from"./draw-panel.js";import{VideosPanel as g}from"./videos-panel.js";import{ImageClipPanel as j}from"./image-clip-panel.js";import{AnimationsPanel as w}from"./animations-panel.js";import{EffectsPanel as v}from"./effects-panel.js";import{PolotnoIcon as T}from"../icons/registry.js";export{SectionTab}from"./tab-button.js";export{ImagesGrid}from"./images-grid.js";export const TemplatesSection={name:"templates",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.templates")},n,{children:e(T,{name:"sidePanel.templates"})}))),Panel:({store:n})=>e(m,{store:n})};export const TextSection={name:"text",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.text")},n,{children:e(T,{name:"sidePanel.text"})}))),Panel:({store:n})=>e(d,{store:n})};export const PhotosSection={name:"photos",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.photos")},n,{children:e(T,{name:"sidePanel.photos"})}))),Panel:({store:n})=>e(c,{store:n})};export const ElementsSection={name:"elements",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.elements"),iconSize:16},n,{children:e(T,{name:"sidePanel.elements"})}))),Panel:({store:n})=>e(b,{store:n})};export const UploadSection={name:"upload",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.upload")},n,{children:e(T,{name:"sidePanel.upload"})}))),Panel:({store:n})=>e(f,{store:n})};export const BackgroundSection={name:"background",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.background")},n,{children:e(T,{name:"sidePanel.background"})}))),Panel:({store:n})=>e(u,{store:n})};export const PagesSection={name:"pages",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.pages")},n,{children:e(T,{name:"sidePanel.pages"})}))),Panel:({store:n})=>e(x,{store:n}),visibleInList:!1};export const LayersSection={name:"layers",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.layers")},n,{children:e(T,{name:"sidePanel.layers"})}))),Panel:({store:n})=>e(P,{store:n})};export const SizeSection={name:"size",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.resize")},n,{children:e(T,{name:"sidePanel.resize"})}))),Panel:({store:n})=>e(h,{store:n})};export const DrawSection={name:"draw",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.draw")},n,{children:e(T,{name:"sidePanel.draw"})}))),Panel:({store:n})=>e(S,{store:n})};export const VideosSection={name:"videos",Tab:n=>e(p,Object.assign({name:l("sidePanel.videos")},n,{children:e(T,{name:"sidePanel.videos"})})),Panel:g};export const DEFAULT_SECTIONS=[TemplatesSection,TextSection,PhotosSection,ElementsSection,DrawSection,UploadSection,BackgroundSection,LayersSection,SizeSection];const k={name:"image-clip",Tab:()=>null,Panel:j},C={name:"effects",Tab:()=>null,Panel:v},N={name:"animation",Tab:()=>null,Panel:w};export const INTERNAL_SECTIONS=[k,C];const O=({onClick:o})=>n("div",{className:"pn-side-panel-hide-button pn:absolute pn:right-[-14px] pn:top-1/2 pn:z-10 pn:h-24 pn:w-[15px] pn:cursor-pointer pn:max-md:hidden pn:pn-mobile:hidden",onClick:o,children:[e("svg",{width:"15",height:"96",viewBox:"0 0 16 96",xmlns:"http://www.w3.org/2000/svg",children:e("path",{className:"pn:stroke-border pn:fill-background",d:"M 1 7 C 2 9 4 10 7.2 13.28 C 7.45 13.4625 7.6 13.6 7.7 13.8048 L 7.8 13.8 C 9.8 15.8 11.6 17.6 12.9 19.7 C 14 21.6 14.7 23.9 14.9 27 H 15 V 68 C 15 71.7 14.3 74.3 13 76.6 C 11.7 78.8 9.9 80.5 7.8 82.6344 L 7.79 82.6 C 7.6 82.8 7.4507 83 7.2729 83.2127 C 3.9102 86.5228 2 87 1 90"})}),e("div",{className:"pn:absolute pn:left-1/2 pn:top-1/2 pn:text-[0.5rem] pn:text-muted-foreground pn:hover:text-foreground",style:{transform:"translate(-50%, -50%) scaleY(2)"},children:"<"})]});export const SidePanel=a(({store:a,sections:l,defaultSection:p="photos"})=>{(()=>{const e=o.useRef(!0);e.current&&(e.current=!1,a.openSidePanel(p))})();const m=i();o.useLayoutEffect(()=>{m?a.openSidePanel(""):a.openSidePanel(p)},[m]);const d=[...l||DEFAULT_SECTIONS];if(INTERNAL_SECTIONS.forEach(e=>{d.find(n=>n.name===e.name)||d.push(e)}),t.animationsEnabled){if(!d.find(e=>"videos"===e.name)){const e=Math.floor(d.length/2);d.splice(e,0,VideosSection)}if(!d.find(e=>"animations"===e.name)){const e=Math.floor(d.length/2);d.splice(e,0,N)}}const c=d.filter(e=>{var n;return null===(n=e.visibleInList)||void 0===n||n}),b=e=>{const n=e.target,o=n.closest(".polotno-close-panel"),t=n.closest(".polotno-mobile");o&&(m||t)&&a.openSidePanel("")},f=o.useRef(null),u=o.useRef(null),x=o.useRef(new Set);return a.openedSidePanel&&x.current.add(a.openedSidePanel),e(r,{elementRef:u,children:n("div",{ref:u,className:s("polotno-side-panel pn-side-panel pn:relative pn:flex pn:h-full pn:bg-background pn:p-0 pn:text-foreground","pn:md:border-r pn:md:border-border","pn:max-md:h-auto pn:max-md:w-full pn:pn-mobile:h-auto pn:pn-mobile:w-full","pn:max-md:border-t pn:max-md:border-border pn:pn-mobile:border-t pn:pn-mobile:border-border",!a.openedSidePanel&&"collapsed"),children:[e("div",{ref:f,className:s("polotno-side-tabs-container pn:bg-background pn:max-md:w-full pn:max-md:overflow-auto pn:pn-mobile:w-full pn:pn-mobile:overflow-auto pn:md:overflow-y-auto pn:md:overflow-x-hidden pn:md:min-w-[72px]",a.openedSidePanel&&"pn:md:border-r pn:md:border-border"),children:e("div",{className:"polotno-side-tabs-inner pn:flex pn:flex-col pn:max-md:flex-row pn:max-md:min-w-min pn:pn-mobile:flex-row pn:pn-mobile:min-w-min",children:c.map(({name:n,Tab:o})=>e(o,{active:n===a.openedSidePanel,onClick:()=>{n===a.openedSidePanel&&m?a.openSidePanel(""):a.openSidePanel(n)}},n))})}),d.map(({name:n,Panel:o})=>x.current.has(n)&&e("div",{className:s("polotno-panel-container pn-side-panel-content pn:h-full pn:px-2.5
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{observer as a}from"mobx-react-lite";import{flags as t}from"../utils/flags.js";import{useMobile as i}from"../utils/screen.js";import{t as l}from"../utils/l10n.js";import{cn as s}from"../lib/utils.js";import{PolotnoScope as r}from"../primitives/portal-scope.js";import{SectionTab as p}from"./tab-button.js";import{TemplatesPanel as m}from"./templates-panel.js";import{TextPanel as d}from"./text-panel.js";import{PhotosPanel as c}from"./photos-panel.js";import{ElementsPanel as b}from"./elements-panel.js";import{UploadPanel as f}from"./upload-panel.js";import{BackgroundPanel as u}from"./background-panel.js";import{PagesPanel as x}from"./pages-panel.js";import{LayersPanel as P}from"./layers-panel.js";import{SizePanel as h}from"./size-panel.js";import{DrawPanel as S}from"./draw-panel.js";import{VideosPanel as g}from"./videos-panel.js";import{ImageClipPanel as j}from"./image-clip-panel.js";import{AnimationsPanel as w}from"./animations-panel.js";import{EffectsPanel as v}from"./effects-panel.js";import{PolotnoIcon as T}from"../icons/registry.js";export{SectionTab}from"./tab-button.js";export{ImagesGrid}from"./images-grid.js";export const TemplatesSection={name:"templates",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.templates")},n,{children:e(T,{name:"sidePanel.templates"})}))),Panel:({store:n})=>e(m,{store:n})};export const TextSection={name:"text",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.text")},n,{children:e(T,{name:"sidePanel.text"})}))),Panel:({store:n})=>e(d,{store:n})};export const PhotosSection={name:"photos",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.photos")},n,{children:e(T,{name:"sidePanel.photos"})}))),Panel:({store:n})=>e(c,{store:n})};export const ElementsSection={name:"elements",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.elements"),iconSize:16},n,{children:e(T,{name:"sidePanel.elements"})}))),Panel:({store:n})=>e(b,{store:n})};export const UploadSection={name:"upload",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.upload")},n,{children:e(T,{name:"sidePanel.upload"})}))),Panel:({store:n})=>e(f,{store:n})};export const BackgroundSection={name:"background",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.background")},n,{children:e(T,{name:"sidePanel.background"})}))),Panel:({store:n})=>e(u,{store:n})};export const PagesSection={name:"pages",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.pages")},n,{children:e(T,{name:"sidePanel.pages"})}))),Panel:({store:n})=>e(x,{store:n}),visibleInList:!1};export const LayersSection={name:"layers",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.layers")},n,{children:e(T,{name:"sidePanel.layers"})}))),Panel:({store:n})=>e(P,{store:n})};export const SizeSection={name:"size",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.resize")},n,{children:e(T,{name:"sidePanel.resize"})}))),Panel:({store:n})=>e(h,{store:n})};export const DrawSection={name:"draw",Tab:a(n=>e(p,Object.assign({name:l("sidePanel.draw")},n,{children:e(T,{name:"sidePanel.draw"})}))),Panel:({store:n})=>e(S,{store:n})};export const VideosSection={name:"videos",Tab:n=>e(p,Object.assign({name:l("sidePanel.videos")},n,{children:e(T,{name:"sidePanel.videos"})})),Panel:g};export const DEFAULT_SECTIONS=[TemplatesSection,TextSection,PhotosSection,ElementsSection,DrawSection,UploadSection,BackgroundSection,LayersSection,SizeSection];const k={name:"image-clip",Tab:()=>null,Panel:j},C={name:"effects",Tab:()=>null,Panel:v},N={name:"animation",Tab:()=>null,Panel:w};export const INTERNAL_SECTIONS=[k,C];const O=new Set([j,v,w]),E=({onClick:o})=>n("div",{className:"pn-side-panel-hide-button pn:absolute pn:right-[-14px] pn:top-1/2 pn:z-10 pn:h-24 pn:w-[15px] pn:cursor-pointer pn:max-md:hidden pn:pn-mobile:hidden",onClick:o,children:[e("svg",{width:"15",height:"96",viewBox:"0 0 16 96",xmlns:"http://www.w3.org/2000/svg",children:e("path",{className:"pn:stroke-border pn:fill-background",d:"M 1 7 C 2 9 4 10 7.2 13.28 C 7.45 13.4625 7.6 13.6 7.7 13.8048 L 7.8 13.8 C 9.8 15.8 11.6 17.6 12.9 19.7 C 14 21.6 14.7 23.9 14.9 27 H 15 V 68 C 15 71.7 14.3 74.3 13 76.6 C 11.7 78.8 9.9 80.5 7.8 82.6344 L 7.79 82.6 C 7.6 82.8 7.4507 83 7.2729 83.2127 C 3.9102 86.5228 2 87 1 90"})}),e("div",{className:"pn:absolute pn:left-1/2 pn:top-1/2 pn:text-[0.5rem] pn:text-muted-foreground pn:hover:text-foreground",style:{transform:"translate(-50%, -50%) scaleY(2)"},children:"<"})]});export const SidePanel=a(({store:a,sections:l,defaultSection:p="photos"})=>{(()=>{const e=o.useRef(!0);e.current&&(e.current=!1,a.openSidePanel(p))})();const m=i();o.useLayoutEffect(()=>{m?a.openSidePanel(""):a.openSidePanel(p)},[m]);const d=[...l||DEFAULT_SECTIONS];if(INTERNAL_SECTIONS.forEach(e=>{d.find(n=>n.name===e.name)||d.push(e)}),t.animationsEnabled){if(!d.find(e=>"videos"===e.name)){const e=Math.floor(d.length/2);d.splice(e,0,VideosSection)}if(!d.find(e=>"animations"===e.name)){const e=Math.floor(d.length/2);d.splice(e,0,N)}}const c=d.filter(e=>{var n;return null===(n=e.visibleInList)||void 0===n||n}),b=e=>{const n=e.target,o=n.closest(".polotno-close-panel"),t=n.closest(".polotno-mobile");o&&(m||t)&&a.openSidePanel("")},f=o.useRef(null),u=o.useRef(null),x=o.useRef(new Set);return a.openedSidePanel&&x.current.add(a.openedSidePanel),e(r,{elementRef:u,children:n("div",{ref:u,className:s("polotno-side-panel pn-side-panel pn:relative pn:flex pn:h-full pn:bg-background pn:p-0 pn:text-foreground","pn:md:border-r pn:md:border-border","pn:max-md:h-auto pn:max-md:w-full pn:pn-mobile:h-auto pn:pn-mobile:w-full","pn:max-md:border-t pn:max-md:border-border pn:pn-mobile:border-t pn:pn-mobile:border-border",!a.openedSidePanel&&"collapsed"),children:[e("div",{ref:f,className:s("polotno-side-tabs-container pn:bg-background pn:max-md:w-full pn:max-md:overflow-auto pn:pn-mobile:w-full pn:pn-mobile:overflow-auto pn:md:overflow-y-auto pn:md:overflow-x-hidden pn:md:min-w-[72px]",a.openedSidePanel&&"pn:md:border-r pn:md:border-border"),children:e("div",{className:"polotno-side-tabs-inner pn:flex pn:flex-col pn:max-md:flex-row pn:max-md:min-w-min pn:pn-mobile:flex-row pn:pn-mobile:min-w-min",children:c.map(({name:n,Tab:o})=>e(o,{active:n===a.openedSidePanel,onClick:()=>{n===a.openedSidePanel&&m?a.openSidePanel(""):a.openSidePanel(n)}},n))})}),d.map(({name:n,Panel:o})=>x.current.has(n)&&e("div",{className:s("polotno-panel-container pn-side-panel-content pn:h-full pn:px-2.5",!O.has(o)&&"pn:pt-2.5","pn:w-[var(--pn-sidebar-width,350px)]",!a.openedSidePanel&&"pn:w-0",n!==a.openedSidePanel&&"pn:hidden","pn:max-md:absolute pn:max-md:bottom-[54px] pn:max-md:z-[100] pn:max-md:!h-[50vh] pn:max-md:w-full pn:max-md:bg-background","pn:pn-mobile:absolute pn:pn-mobile:bottom-[54px] pn:pn-mobile:z-[100] pn:pn-mobile:!h-[50vh] pn:pn-mobile:w-full pn:pn-mobile:bg-background"),onClick:b,children:e(o,{store:a})},n)),a.openedSidePanel&&m&&e("div",{className:"polotno-close-panel",style:{position:"absolute",left:0,bottom:"72px",width:"100vw",height:"100vh",zIndex:99,backgroundColor:"rgba(0,0,0,0.05)"},onClick:()=>a.openSidePanel("")}),a.openedSidePanel&&e(E,{onClick:()=>a.openSidePanel("")})]})})});SidePanel.displayName="SidePanel";export default SidePanel;
|
|
@@ -8,8 +8,12 @@ export declare const SIZE_CATEGORIES: Array<{
|
|
|
8
8
|
}>;
|
|
9
9
|
export declare const SizePanel: (({ store }: {
|
|
10
10
|
store: StoreType;
|
|
11
|
-
}) => React.JSX.Element) & {
|
|
12
|
-
|
|
11
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
12
|
+
store: StoreType;
|
|
13
|
+
}> & {
|
|
14
|
+
readonly type: ({ store }: {
|
|
15
|
+
store: StoreType;
|
|
16
|
+
}) => React.JSX.Element;
|
|
13
17
|
};
|
|
14
18
|
export type SizePanelProps = {
|
|
15
19
|
store: StoreType;
|
package/side-panel/size-panel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=this&&this.__rest||function(e,n){var i={};for(var t in e){Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(i[t]=e[t])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(t=Object.getOwnPropertySymbols(e);a<t.length;a++){n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(i[t[a]]=e[t[a]])}}return i};import{jsx as n,jsxs as i,Fragment as t}from"react/jsx-runtime";import*as a from"react";import{observer as s}from"mobx-react-lite";import{PolotnoIcon as p}from"../icons/registry.js";import{t as r}from"../utils/l10n.js";import{cn as o}from"../lib/utils.js";import{pxToUnit as l,pxToUnitRounded as d,unitToPx as c}from"../utils/unit.js";import{Button as m}from"../primitives/button.js";import{Input as u}from"../primitives/input.js";import{Switch as h}from"../primitives/switch.js";import{Select as x,SelectContent as v,SelectItem as b,SelectTrigger as g,SelectValue as f}from"../primitives/select.js";import{Tooltip as z,TooltipContent as N,TooltipTrigger as w}from"../primitives/tooltip.js";export const SIZE_CATEGORIES=[{name:"Instagram",icon:n(p,{name:"size.instagram"}),sizes:[["Post",1080,1080,"px",n(p,{name:"size.instagram"})],["Story",1080,1920,"px",n(p,{name:"size.instagram"})],["Ad",1080,1080,"px",n(p,{name:"size.instagram"})]]},{name:"Facebook",icon:n(p,{name:"size.facebook"}),sizes:[["Post (Landscape)",1200,630,"px",n(p,{name:"size.facebook"})],["Post (Square)",1080,1080,"px",n(p,{name:"size.facebook"})],["Cover",851,315,"px",n(p,{name:"size.facebook"})]]},{name:"Youtube",icon:n(p,{name:"size.youtube"}),sizes:[["Thumbnail",1280,720,"px",n(p,{name:"size.youtube"})],["Channel",2560,1440,"px",n(p,{name:"size.youtube"})],["Short",1080,1920,"px",n(p,{name:"size.youtube"})]]},{name:"LinkedIn",icon:n(p,{name:"size.linkedin"}),sizes:[["Post",1200,627,"px",n(p,{name:"size.linkedin"})],["Banner",1584,396,"px",n(p,{name:"size.linkedin"})],["Square",1080,1080,"px",n(p,{name:"size.linkedin"})]]},{name:"Twitter",icon:n(p,{name:"size.twitter"}),sizes:[["Post",1600,900,"px",n(p,{name:"size.twitter"})],["Header",1500,500,"px",n(p,{name:"size.twitter"})],["Square",1080,1080,"px",n(p,{name:"size.twitter"})]]},{name:"Video",icon:n(p,{name:"size.video"}),sizes:[["Full HD",1920,1080,"px",n(p,{name:"size.video"})],["4K UHD",3840,2160,"px",n(p,{name:"size.video"})],["Vertical HD",1080,1920,"px",n(p,{name:"size.video"})],["Square HD",1080,1080,"px",n(p,{name:"size.video"})]]},{name:"Print",icon:n(p,{name:"size.print"}),sizes:[["Invitation",14,14,"cm",n(p,{name:"size.print"})],["A4 Portrait",21,29.7,"cm",n(p,{name:"size.print"})],["A4 Landscape",29.7,21,"cm",n(p,{name:"size.print"})],["A3",29.7,42,"cm",n(p,{name:"size.print"})],["Letter Portrait",8.5,11,"in",n(p,{name:"size.print"})],["Letter Landscape",11,8.5,"in",n(p,{name:"size.print"})],["Business card",3.5,2,"in",n(p,{name:"size.businessCard"})],["Poster",18,24,"in",n(p,{name:"size.print"})]]}];const
|
|
1
|
+
var e=this&&this.__rest||function(e,n){var i={};for(var t in e){Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(i[t]=e[t])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(t=Object.getOwnPropertySymbols(e);a<t.length;a++){n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(i[t[a]]=e[t[a]])}}return i};import{jsx as n,jsxs as i,Fragment as t}from"react/jsx-runtime";import*as a from"react";import{observer as s}from"mobx-react-lite";import{PolotnoIcon as p}from"../icons/registry.js";import{t as r}from"../utils/l10n.js";import{cn as o}from"../lib/utils.js";import{pxToUnit as l,pxToUnitRounded as d,unitToPx as c}from"../utils/unit.js";import{Button as m}from"../primitives/button.js";import{Input as u}from"../primitives/input.js";import{Switch as h}from"../primitives/switch.js";import{Select as x,SelectContent as v,SelectItem as b,SelectTrigger as g,SelectValue as f}from"../primitives/select.js";import{Tooltip as z,TooltipContent as N,TooltipTrigger as w}from"../primitives/tooltip.js";import{PanelScrollArea as y}from"../primitives/panel-scroll-area.js";export const SIZE_CATEGORIES=[{name:"Instagram",icon:n(p,{name:"size.instagram"}),sizes:[["Post",1080,1080,"px",n(p,{name:"size.instagram"})],["Story",1080,1920,"px",n(p,{name:"size.instagram"})],["Ad",1080,1080,"px",n(p,{name:"size.instagram"})]]},{name:"Facebook",icon:n(p,{name:"size.facebook"}),sizes:[["Post (Landscape)",1200,630,"px",n(p,{name:"size.facebook"})],["Post (Square)",1080,1080,"px",n(p,{name:"size.facebook"})],["Cover",851,315,"px",n(p,{name:"size.facebook"})]]},{name:"Youtube",icon:n(p,{name:"size.youtube"}),sizes:[["Thumbnail",1280,720,"px",n(p,{name:"size.youtube"})],["Channel",2560,1440,"px",n(p,{name:"size.youtube"})],["Short",1080,1920,"px",n(p,{name:"size.youtube"})]]},{name:"LinkedIn",icon:n(p,{name:"size.linkedin"}),sizes:[["Post",1200,627,"px",n(p,{name:"size.linkedin"})],["Banner",1584,396,"px",n(p,{name:"size.linkedin"})],["Square",1080,1080,"px",n(p,{name:"size.linkedin"})]]},{name:"Twitter",icon:n(p,{name:"size.twitter"}),sizes:[["Post",1600,900,"px",n(p,{name:"size.twitter"})],["Header",1500,500,"px",n(p,{name:"size.twitter"})],["Square",1080,1080,"px",n(p,{name:"size.twitter"})]]},{name:"Video",icon:n(p,{name:"size.video"}),sizes:[["Full HD",1920,1080,"px",n(p,{name:"size.video"})],["4K UHD",3840,2160,"px",n(p,{name:"size.video"})],["Vertical HD",1080,1920,"px",n(p,{name:"size.video"})],["Square HD",1080,1080,"px",n(p,{name:"size.video"})]]},{name:"Print",icon:n(p,{name:"size.print"}),sizes:[["Invitation",14,14,"cm",n(p,{name:"size.print"})],["A4 Portrait",21,29.7,"cm",n(p,{name:"size.print"})],["A4 Landscape",29.7,21,"cm",n(p,{name:"size.print"})],["A3",29.7,42,"cm",n(p,{name:"size.print"})],["Letter Portrait",8.5,11,"in",n(p,{name:"size.print"})],["Letter Landscape",11,8.5,"in",n(p,{name:"size.print"})],["Business card",3.5,2,"in",n(p,{name:"size.businessCard"})],["Poster",18,24,"in",n(p,{name:"size.print"})]]}];const k=t=>{var{value:s,onChange:r}=t,l=e(t,["value","onChange"]);const[d,c]=a.useState(s.toString()),m=a.useRef(s);m.current=d;const h=()=>{r(Math.max(l.min||0,parseFloat(m.current)))};a.useEffect(()=>{c(String(s))},[s]);const x=Number(l.step)||1,v=e=>{const n=parseFloat(m.current);let i=(Number.isNaN(n)?Number(s)||0:n)+e*x;"number"==typeof l.min&&(i=Math.max(l.min,i)),"number"==typeof l.max&&(i=Math.min(l.max,i)),i=parseFloat(i.toFixed(4)),c(String(i)),r(i)},{className:b}=l,g=e(l,["className"]);return i("div",{className:"pn:relative",children:[n(u,Object.assign({},g,{type:"number",value:d.toString(),className:o("pn:pr-6 pn:[appearance:textfield] pn:[&::-webkit-inner-spin-button]:appearance-none pn:[&::-webkit-outer-spin-button]:appearance-none",b),onChange:e=>{const n=e.target.value;Number.isNaN(parseFloat(n))?""===n&&c(n):c(n)},onBlur:h,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&h()}})),i("div",{className:"pn:absolute pn:inset-y-0 pn:right-0 pn:flex pn:w-5 pn:flex-col pn:border-l pn:border-input",children:[n("button",{type:"button",tabIndex:-1,"aria-label":"Increment",className:"pn:flex pn:flex-1 pn:appearance-none pn:cursor-pointer pn:items-center pn:justify-center pn:border-0 pn:bg-transparent pn:text-muted-foreground pn:hover:bg-muted pn:hover:text-foreground",onClick:()=>v(1),children:n(p,{name:"ui.chevronUp",className:"pn:size-3"})}),n("button",{type:"button",tabIndex:-1,"aria-label":"Decrement",className:"pn:flex pn:flex-1 pn:appearance-none pn:cursor-pointer pn:items-center pn:justify-center pn:border-0 pn:border-t pn:border-input pn:bg-transparent pn:text-muted-foreground pn:hover:bg-muted pn:hover:text-foreground",onClick:()=>v(-1),children:n(p,{name:"ui.chevronDown",className:"pn:size-3"})})]})]})},P=({width:e,height:i})=>{const t=e/i,a=t>=1?18:Math.max(4,18*t),s=t>=1?Math.max(4,18/t):18;return n("span",{className:"pn:flex pn:size-5 pn:shrink-0 pn:items-center pn:justify-center pn:text-muted-foreground",children:n("span",{className:"pn:rounded-[2px] pn:border pn:border-current",style:{width:a,height:s}})})};export const SizePanel=s(({store:e})=>{var s,o,u,j;const[S,C]=a.useState(!0),[B,E]=a.useState(!1),[O,F]=a.useState(e.width),[I,D]=a.useState(e.height),V=l({px:10,unit:e.unit,dpi:e.dpi}),L=(null===(s=e.activePage)||void 0===s?void 0:s.computedWidth)||e.width;a.useEffect(()=>{F(d({px:L,unit:e.unit,dpi:e.dpi}))},[L,e.unit,e.dpi]);const R=(null===(o=e.activePage)||void 0===o?void 0:o.computedHeight)||e.height;a.useEffect(()=>{D(d({px:R,unit:e.unit,dpi:e.dpi}))},[R,e.unit,e.dpi]);const A=(n,i,t)=>{var a,s,p,r;e.setSize(n,i,t),"auto"!==(null===(a=e.activePage)||void 0===a?void 0:a.width)&&(null===(s=e.activePage)||void 0===s||s.set({width:n})),"auto"!==(null===(p=e.activePage)||void 0===p?void 0:p.height)&&(null===(r=e.activePage)||void 0===r||r.set({height:i}))},H=d({px:null!==(j=null===(u=e.activePage)||void 0===u?void 0:u.computedBleed.top)&&void 0!==j?j:0,unit:e.unit,dpi:e.dpi});return i(y,{children:[i("div",{style:{paddingBottom:"15px"},children:[i("label",{className:"pn:flex pn:items-center pn:justify-between",style:{marginTop:"8px",marginBottom:"25px"},children:[i("span",{className:"pn:flex pn:items-center pn:gap-1.5",children:[r("sidePanel.useMagicResize")," ",i(z,{children:[n(w,{render:n("span",{className:"pn:inline-flex",children:n(p,{name:"action.help",className:"pn:size-4"})})}),n(N,{children:r("sidePanel.magicResizeDescription")})]})]}),n(h,{checked:S,onCheckedChange:e=>{C(Boolean(e))}})]}),i("div",{className:"pn:inline-block pn:w-1/2",children:[r("sidePanel.width")," (",e.unit,")"]}),n("div",{className:"pn:inline-block pn:w-1/2",children:n(k,{value:O,onChange:e=>{e||(e=V),F(e)},min:V,max:1e4,step:"px"===e.unit?1:.1})})]}),i("div",{style:{paddingBottom:"15px"},children:[i("div",{className:"pn:inline-block pn:w-1/2",children:[r("sidePanel.height")," (",e.unit,")"]}),n("div",{className:"pn:inline-block pn:w-1/2",children:n(k,{value:I,onChange:e=>{e||(e=V),D(e)},min:V,max:1e4,step:"px"===e.unit?1:.1})})]}),i("div",{style:{paddingBottom:"15px"},children:[n("div",{className:"pn:inline-block pn:w-1/2",children:r("sidePanel.units")}),n("div",{className:"pn:inline-block pn:w-1/2",children:i(x,{value:e.unit,onValueChange:n=>{const i=n;e.setUnit({unit:i,dpi:e.dpi})},children:[n(g,{className:"pn:w-full",children:n(f,{})}),i(v,{children:[n(b,{value:"px",children:"px"}),n(b,{value:"cm",children:"cm"}),n(b,{value:"in",children:"in"})]})]})})]}),n("div",{style:{paddingBottom:"15px"},children:n(m,{className:"pn:w-full",variant:"default",onClick:()=>{const n=c({unitVal:O,dpi:e.dpi,unit:e.unit}),i=c({unitVal:I,dpi:e.dpi,unit:e.unit});A(n,i,S)},children:r("sidePanel.resize")})}),i(m,{variant:"ghost",className:"pn:mb-1.5 pn:w-full pn:justify-start pn:gap-1 pn:px-2 pn:text-[13px] pn:font-normal pn:text-muted-foreground",onClick:()=>E(!B),children:[n(p,{name:B?"ui.chevronDown":"ui.chevronRight",className:"pn:size-3"}),r("sidePanel.advanced")]}),B&&i(t,{children:[i("div",{style:{paddingBottom:"15px"},children:[i("div",{className:"pn:inline-block pn:w-1/2",children:[r("sidePanel.bleed")," (",e.unit,")"]}),n("div",{className:"pn:inline-block pn:w-1/2",children:n(k,{"aria-label":"bleed",value:H,onChange:n=>{if(!Number.isFinite(n)){return}const i=c({unitVal:n,dpi:e.dpi,unit:e.unit});e.pages.forEach(e=>{e.set({bleed:i,bleedTop:void 0,bleedRight:void 0,bleedBottom:void 0,bleedLeft:void 0})}),i>0&&e.toggleBleed(!0)},min:0,max:1e3,step:"px"===e.unit?1:.1})})]}),i("label",{className:"pn:flex pn:items-center pn:justify-between",style:{paddingBottom:"15px"},children:[n("span",{children:r("sidePanel.showBleed")}),n(h,{"aria-label":"show bleed",checked:e.bleedVisible,onCheckedChange:n=>{e.toggleBleed(Boolean(n))}})]})]}),SIZE_CATEGORIES.map(({name:t,icon:s,sizes:p})=>i(a.Fragment,{children:[i("div",{className:"pn:flex pn:items-center pn:gap-1.5 pn:pt-3 pn:pb-1 pn:text-[13px] pn:font-semibold",children:[s,t]}),n("div",{className:"pn:mb-1.5 pn:flex pn:flex-col",children:p.map(([t,a,s,p])=>i(m,{variant:"ghost",className:"pn:h-9 pn:w-full pn:justify-start pn:gap-2.5 pn:px-2 pn:text-[13px] pn:font-normal",onClick:()=>{const n=c({unitVal:a,dpi:e.dpi,unit:p}),i=c({unitVal:s,dpi:e.dpi,unit:p});e.setUnit({unit:p,dpi:e.dpi}),A(n,i,S)},children:[n(P,{width:a,height:s}),n("span",{className:"pn:truncate",children:t}),i("span",{className:"pn:ml-auto pn:shrink-0 pn:text-xs pn:text-muted-foreground",children:[a,"×",s," ",p]})]},t))})]},t))]})});
|
|
@@ -2,8 +2,12 @@ import * as React from 'react';
|
|
|
2
2
|
import type { StoreType } from '../ui-types.js';
|
|
3
3
|
export declare const TemplatesPanel: (({ store }: {
|
|
4
4
|
store: StoreType;
|
|
5
|
-
}) => React.JSX.Element) & {
|
|
6
|
-
|
|
5
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
6
|
+
store: StoreType;
|
|
7
|
+
}> & {
|
|
8
|
+
readonly type: ({ store }: {
|
|
9
|
+
store: StoreType;
|
|
10
|
+
}) => React.JSX.Element;
|
|
7
11
|
};
|
|
8
12
|
export type TemplatesPanelProps = {
|
|
9
13
|
store: StoreType;
|
|
@@ -4,8 +4,12 @@ declare let uploadFunc: (file: File) => Promise<string>;
|
|
|
4
4
|
export declare function setFontUploadFunc(func: typeof uploadFunc): void;
|
|
5
5
|
export declare const TextPanel: (({ store }: {
|
|
6
6
|
store: StoreType;
|
|
7
|
-
}) => React.JSX.Element) & {
|
|
8
|
-
|
|
7
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
8
|
+
store: StoreType;
|
|
9
|
+
}> & {
|
|
10
|
+
readonly type: ({ store }: {
|
|
11
|
+
store: StoreType;
|
|
12
|
+
}) => React.JSX.Element;
|
|
9
13
|
};
|
|
10
14
|
export type TextPanelProps = {
|
|
11
15
|
store: StoreType;
|
package/side-panel/text-panel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=this&&this.__rest||function(e,t){var o={};for(var n in e){Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++){t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}}return o};import{jsx as t,jsxs as o}from"react/jsx-runtime";import*as n from"react";import{observer as i}from"mobx-react-lite";import l from"swr";import{PolotnoIcon as a}from"../icons/registry.js";import{t as r}from"../utils/l10n.js";import{isMobile as s}from"../utils/screen.js";import{textTemplateList as p}from"../utils/api.js";import{fetcher as c}from"../utils/use-api.js";import{localFileToURL as f}from"../utils/file.js";import{cssFontFamily as
|
|
1
|
+
var e=this&&this.__rest||function(e,t){var o={};for(var n in e){Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++){t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}}return o};import{jsx as t,jsxs as o}from"react/jsx-runtime";import*as n from"react";import{observer as i}from"mobx-react-lite";import l from"swr";import{PolotnoIcon as a}from"../icons/registry.js";import{t as r}from"../utils/l10n.js";import{isMobile as s}from"../utils/screen.js";import{textTemplateList as p}from"../utils/api.js";import{fetcher as c}from"../utils/use-api.js";import{localFileToURL as f}from"../utils/file.js";import{cssFontFamily as m}from"@polotno/core/fonts";import{registerNextDomDrop as d}from"../canvas/page.js";import{Button as h}from"../primitives/button.js";import{Tabs as y,TabsList as u,TabsTrigger as x}from"../primitives/tabs.js";import{ImagesGrid as g}from"./images-grid.js";import{loadTextTemplate as v}from"./text-template.js";import{PanelScrollArea as b}from"../primitives/panel-scroll-area.js";let j=async e=>f(e);export function setFontUploadFunc(e){j=e}const w=i(({onSelect:e,onRemove:n,font:i})=>o("div",{style:{fontFamily:m(i.fontFamily)},className:"polotno-font-item pn:relative pn:mb-2.5 pn:flex pn:h-[100px] pn:cursor-pointer pn:flex-col pn:justify-center pn:rounded-md pn:bg-black/40 pn:text-center pn:text-[25px] pn:text-white pn:shadow-[0_0_5px_rgba(16,22,26,0.3)]",onClick:e,children:[i.fontFamily," text",t(h,{style:{position:"absolute",right:0,bottom:0},variant:"ghost",size:"icon-sm",onClick:e=>{e.stopPropagation(),n()},children:t(a,{name:"action.remove"})})]})),S=o=>{var{onSelect:n}=o,i=e(o,["onSelect"]);return t(h,Object.assign({},i,{draggable:!0,className:"polotno-close-panel",onClick:()=>n(),onDragStart:()=>{d(({x:e,y:t})=>{n({x:e,y:t})})},onDragEnd:()=>{d(null)}}))},F=[{previewSize:"25px",fontSize:76,labelKey:"sidePanel.createHeader",textKey:"sidePanel.headerText"},{previewSize:"18px",fontSize:44,labelKey:"sidePanel.createSubHeader",textKey:"sidePanel.subHeaderText"},{previewSize:"14px",fontSize:30,labelKey:"sidePanel.createBody",textKey:"sidePanel.bodyText"}];export const TextPanel=i(({store:e})=>{n.useEffect(()=>{e.loadFont("Roboto")},[]);const i=t=>{var o;const n=t.width||e.width/2,i=((null==t?void 0:t.x)||e.width/2)-n/2,l=((null==t?void 0:t.y)||e.height/2)-t.fontSize/2,a=(e.width+e.height)/2160,r=null===(o=e.activePage)||void 0===o?void 0:o.addElement(Object.assign(Object.assign({type:"text",fontFamily:"Roboto"},t),{x:i,y:l,width:n,fontSize:t.fontSize*a}));s()||null==r||r.toggleEditMode(!0)};n.useEffect(()=>{e.fonts.forEach(t=>e.loadFont(t.fontFamily))},[e.fonts]);const{data:f,error:m}=l(p(),c),[d,P]=n.useState("text"),[z,O]=n.useState(null),E=n.useRef(null),C=e=>{E.current=e,O(e)};return o("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[t(y,{value:d,onValueChange:e=>P(String(e)),className:"pn:mb-3",children:o(u,{className:"pn:w-full pn:h-10",children:[t(x,{value:"text",children:r("sidePanel.text")}),t(x,{value:"font",children:r("sidePanel.myFonts")})]})}),"text"===d&&o("div",{className:"polotno-text-panel-container pn:flex pn:flex-col",style:{height:"calc(100% - 52px)"},children:[F.map(({previewSize:e,fontSize:o,labelKey:n,textKey:l})=>t(S,{style:{fontSize:e},variant:"ghost",className:"pn:mb-[5px] pn:w-full pn:h-auto pn:min-h-[2.5rem] pn:py-1 pn:justify-start pn:font-['Roboto']",onSelect:e=>{i(Object.assign(Object.assign({},e),{fontSize:o,text:r(l),fontFamily:"Roboto"}))},children:r(n)},n)),t(g,{shadowEnabled:!1,images:null==f?void 0:f.items,getPreview:e=>e.preview,getImageClassName:e=>e.json.indexOf("plain")>=0?"polotno-text-preview-plain":"",isLoading:!f,error:m,getIsLoading:e=>e.json===z,onSelect:async(t,o)=>{if(E.current===t.json){return}C(t.json);const n=await v(e,t).finally(()=>{E.current===t.json&&C(null)});if(!e.activePage){return}const i=(e.width+e.height)/2160,l=o?o.x-n.width/2*i:e.width/2-n.width/2*i,a=o?o.y-n.height/2*i:e.height/2-n.height/2*i;e.history.transaction(()=>{const t=n.pages[0].children,o=[];t.forEach(t=>{delete t.id;const{id:n}=e.activePage.addElement(Object.assign(Object.assign({},t),{fontSize:t.fontSize*i,x:t.x*i+l,y:t.y*i+a,width:t.width*i,height:t.height*i}));o.push(n)}),e.selectElements(o)})}})]}),"font"===d&&o("div",{style:{display:"flex",flexDirection:"column",height:"calc(100% - 62px)"},children:[o("label",{htmlFor:"polotno-font-upload",children:[o(h,{style:{width:"100%"},onClick:()=>{var e;null===(e=document.querySelector("#polotno-font-upload"))||void 0===e||e.click()},children:[t(a,{name:"text.uploadFont"}),r("sidePanel.uploadFont")]}),t("input",{type:"file",accept:".ttf, .otf, .woff, .woff2, .eot",id:"polotno-font-upload",style:{display:"none"},onChange:async t=>{const{target:o}=t;for(const n of Array.from(o.files||[])){const t=await j(n),o=n.name.split(".")[0].replace(/,/g,"");e.addFont({fontFamily:o,url:t})}o.value=""}})]}),t(b,{className:"pn:mt-4",children:e.fonts.map((o,n)=>t(w,{font:o,onSelect:()=>{i({fontSize:80,text:"Cool text",fontFamily:o.fontFamily})},onRemove:()=>{e.find(e=>("text"===e.type&&e.fontFamily===o.fontFamily&&e.set({fontFamily:"Roboto"}),!1)),e.removeFont(o.fontFamily)}},n))})]})]})});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { StoreType } from '../ui-types.js';
|
|
2
2
|
export declare const VideosPanel: (({ store }: {
|
|
3
3
|
store: StoreType;
|
|
4
|
-
}) => import("react").JSX.Element) & {
|
|
5
|
-
|
|
4
|
+
}) => import("react").JSX.Element) & import("react").NamedExoticComponent<{
|
|
5
|
+
store: StoreType;
|
|
6
|
+
}> & {
|
|
7
|
+
readonly type: ({ store }: {
|
|
8
|
+
store: StoreType;
|
|
9
|
+
}) => import("react").JSX.Element;
|
|
6
10
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { StoreType } from '../model/store.js';
|
|
2
2
|
export declare const AdminButton: (({ store }: {
|
|
3
3
|
store: StoreType;
|
|
4
|
-
}) => import("react").JSX.Element) & {
|
|
5
|
-
|
|
4
|
+
}) => import("react").JSX.Element) & import("react").NamedExoticComponent<{
|
|
5
|
+
store: StoreType;
|
|
6
|
+
}> & {
|
|
7
|
+
readonly type: ({ store }: {
|
|
8
|
+
store: StoreType;
|
|
9
|
+
}) => import("react").JSX.Element;
|
|
6
10
|
};
|
|
@@ -5,13 +5,27 @@ export declare const AnimationsPickerOld: (({ element, store, elements, }: {
|
|
|
5
5
|
elements?: Array<ShapeType>;
|
|
6
6
|
element?: ShapeType;
|
|
7
7
|
store: StoreType;
|
|
8
|
-
}) => React.JSX.Element) & {
|
|
9
|
-
|
|
8
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
9
|
+
elements?: Array<ShapeType>;
|
|
10
|
+
element?: ShapeType;
|
|
11
|
+
store: StoreType;
|
|
12
|
+
}> & {
|
|
13
|
+
readonly type: ({ element, store, elements, }: {
|
|
14
|
+
elements?: Array<ShapeType>;
|
|
15
|
+
element?: ShapeType;
|
|
16
|
+
store: StoreType;
|
|
17
|
+
}) => React.JSX.Element;
|
|
10
18
|
};
|
|
11
19
|
export declare const AnimationsPicker: (({ element, store }: {
|
|
12
20
|
element: ShapeType;
|
|
13
21
|
store: StoreType;
|
|
14
|
-
}) => React.JSX.Element | null) & {
|
|
15
|
-
|
|
22
|
+
}) => React.JSX.Element | null) & React.NamedExoticComponent<{
|
|
23
|
+
element: ShapeType;
|
|
24
|
+
store: StoreType;
|
|
25
|
+
}> & {
|
|
26
|
+
readonly type: ({ element, store }: {
|
|
27
|
+
element: ShapeType;
|
|
28
|
+
store: StoreType;
|
|
29
|
+
}) => React.JSX.Element | null;
|
|
16
30
|
};
|
|
17
31
|
export default AnimationsPicker;
|
package/toolbar/color-picker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=this&&this.__rest||function(e,r){var t={};for(var o in e){Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++){r.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(t[o[n]]=e[o[n]])}}return t};import{jsx as r,jsxs as t}from"react/jsx-runtime";import o from"react";import{observer as n}from"mobx-react-lite";import{t as s}from"../utils/l10n.js";import{parseColor as l,isGradient as i}from"@polotno/core/gradient";import{sameColors as a}from"@polotno/core/svg";import c from"./sketch.js";import{cn as d}from"../lib/utils.js";import{SliderField as u}from"../primitives/slider-field.js";import{Popover as p,PopoverContent as g,PopoverTrigger as f}from"../primitives/popover.js";import{Tabs as h,TabsContent as m,TabsList as v,TabsTrigger as x}from"../primitives/tabs.js";export const DEFAULT_COLORS=["#D0021B","#F5A623","#F8E71C","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"].reverse();export const getUsedColors=e=>{const r=[];e.pages.forEach(e=>{e.children.forEach(e=>{e.shadowEnabled&&r.push(e.shadowColor),"text"===e.type&&(r.push(e.fill),e.backgroundEnabled&&r.push(e.backgroundColor),e.strokeWidth&&r.push(e.stroke)),"svg"===e.type&&r.push(...e.colorsReplace.values()),"figure"===e.type&&(r.push(e.fill),e.strokeWidth&&r.push(e.stroke)),"line"===e.type&&r.push(e.color)})});const t=[];return r.forEach(e=>{if(i(e)){const{stops:r}=l(e);t.push(...r.map(e=>e.color))}else{t.push(e)}}),[...new Set(t)]};const b=t=>{var{style:n,color:s,onChange:l}=t,i=e(t,["style","color","onChange"]);const[a,d]=o.useState(s);o.useEffect(()=>{d(s)},[s]);const u=o.useRef(void 0),p=o.useRef(void 0);return r("div",{className:"pn-color-picker-solid",style:n,onMouseDown:e=>{"INPUT"!==e.target.tagName&&e.preventDefault()},children:r(c,Object.assign({color:a},i,{onChange:e=>{const{r,g:t,b:o,a:n}=e.rgb,s=`rgba(${r},${t},${o},${n})`;d(s),p.current=s,u.current||(u.current=window.setTimeout(()=>{u.current=0,l(p.current||s)},50))}}))})},w=e=>e.map(e=>`${e.color} ${100*e.offset}%`).join(","),C=({value:e,onChange:n,preset:i})=>{const{rotation:a,stops:c}=l(e),d=o.useRef(c);d.current=c;const p=o.useRef(a);p.current=a;const[g,f]=o.useState(0),
|
|
1
|
+
var e=this&&this.__rest||function(e,r){var t={};for(var o in e){Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++){r.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(t[o[n]]=e[o[n]])}}return t};import{jsx as r,jsxs as t}from"react/jsx-runtime";import o from"react";import{observer as n}from"mobx-react-lite";import{t as s}from"../utils/l10n.js";import{parseColor as l,isGradient as i}from"@polotno/core/gradient";import{sameColors as a}from"@polotno/core/svg";import c from"./sketch.js";import{cn as d}from"../lib/utils.js";import{SliderField as u}from"../primitives/slider-field.js";import{Popover as p,PopoverContent as g,PopoverTrigger as f}from"../primitives/popover.js";import{Tabs as h,TabsContent as m,TabsList as v,TabsTrigger as x}from"../primitives/tabs.js";export const DEFAULT_COLORS=["#D0021B","#F5A623","#F8E71C","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"].reverse();export const getUsedColors=e=>{const r=[];e.pages.forEach(e=>{e.children.forEach(e=>{e.shadowEnabled&&r.push(e.shadowColor),"text"===e.type&&(r.push(e.fill),e.backgroundEnabled&&r.push(e.backgroundColor),e.strokeWidth&&r.push(e.stroke)),"svg"===e.type&&r.push(...e.colorsReplace.values()),"figure"===e.type&&(r.push(e.fill),e.strokeWidth&&r.push(e.stroke)),"line"===e.type&&r.push(e.color)})});const t=[];return r.forEach(e=>{if(i(e)){const{stops:r}=l(e);t.push(...r.map(e=>e.color))}else{t.push(e)}}),[...new Set(t)]};const b=t=>{var{style:n,color:s,onChange:l}=t,i=e(t,["style","color","onChange"]);const[a,d]=o.useState(s);o.useEffect(()=>{d(s)},[s]);const u=o.useRef(void 0),p=o.useRef(void 0);return r("div",{className:"pn-color-picker-solid",style:n,onMouseDown:e=>{"INPUT"!==e.target.tagName&&e.preventDefault()},children:r(c,Object.assign({color:a},i,{onChange:e=>{const{r,g:t,b:o,a:n}=e.rgb,s=`rgba(${r},${t},${o},${n})`;d(s),p.current=s,u.current||(u.current=window.setTimeout(()=>{u.current=0,l(p.current||s)},50))}}))})},w=e=>e.map(e=>`${e.color} ${100*e.offset}%`).join(","),C=({value:e,onChange:n,preset:i})=>{const{rotation:a,stops:c}=l(e),d=o.useRef(c);d.current=c;const p=o.useRef(a);p.current=a;const[g,f]=o.useState(0),h=Math.min(g,c.length-1),[m,v]=o.useState(-1),x=o.useRef(null),C=o.useRef(!1),y=e=>{C.current=!0};return o.useEffect(()=>{m>-1&&(d.current.splice(m,1),n(`linear-gradient(${p.current}deg, ${w(d.current)})`),v(-1))},[m]),o.useEffect(()=>{var e;null===(e=x.current)||void 0===e||e.focus()},[]),o.useEffect(()=>{const e=e=>{if(C.current){const r=x.current.getBoundingClientRect(),t=e.clientX-r.left,o=t/r.width,s=o<-.5||o>1.5;if(c.length>2&&s){return f(0),C.current=!1,void v(h)}const l=Math.min(1,Math.max(0,t/r.width)),i=[...d.current];i[h].offset=l,n(`linear-gradient(${p.current}deg, ${w(i)})`)}},r=()=>{C.current=!1};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",r),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",r)}},[h,d]),t("div",{children:[t("div",{style:{width:"calc(100% - 35px)",height:"60px",position:"relative"},children:[r("div",{ref:x,tabIndex:0,style:{position:"absolute",top:0,left:0,width:"100%",marginLeft:"15px",height:"100%",zIndex:0,outline:"none"},onKeyDownCapture:e=>{if("Backspace"===e.key){if(e.preventDefault(),e.stopPropagation(),d.current.length<=2){return}d.current.splice(h,1),h>=d.current.length&&f(d.current.length-1),n(`linear-gradient(${p.current}deg, ${w(d.current)})`)}},onMouseDown:e=>{const r=e.currentTarget.getBoundingClientRect(),t=e.clientX-r.left,o=Math.min(1,Math.max(0,t/r.width)),s=c[0].color;c.push({color:s,offset:o}),c.sort((e,r)=>e.offset-r.offset);const l=c.findIndex(e=>e.offset===o);f(l),y(),n(`linear-gradient(${a}deg, ${w(c)})`)}}),c.map(({offset:e,color:t},o)=>r("div",{style:{position:"absolute",top:"10px",left:100*e+"%",border:o===h?"2px solid rgb(0, 161, 255)":"2px solid rgb(0, 0, 0, 0)",padding:"2px"},onMouseDown:e=>{e.stopPropagation(),f(o),y()},children:r(ColoredBox,{background:t,style:{margin:0}})},o))]}),r("div",{style:{width:"calc(100% - 30px)",height:"10px",marginLeft:"15px",background:`linear-gradient(90deg,${w(c)})`}}),r("div",{style:{padding:"10px"},children:r(u,{label:s("toolbar.colorPicker.angle"),value:a,min:0,max:360,onChange:e=>{n(`linear-gradient(${e}deg,${w(c)})`)}})}),r(b,{color:c[h].color,presetColors:i,onChange:e=>{const r=[...c];r[h].color=e,n(`linear-gradient(${a}deg, ${w(r)})`)}})]})},y=n(({value:e,onChange:n,preset:l,store:a})=>{const[c,d]=o.useState(i(e)?"gradient":"solid");return r("div",{style:{padding:"5px"},children:t(h,{value:c,onValueChange:e=>d(e),className:"pn:w-full",children:[t(v,{className:"pn:flex pn:w-full pn:flex-row",children:[r(x,{value:"solid",className:"pn:flex-1",children:s("toolbar.colorPicker.solid")}),r(x,{value:"gradient",className:"pn:flex-1",children:s("toolbar.colorPicker.linear")})]}),r(m,{value:"solid",className:"pn:w-full",children:r(b,{color:e,onChange:n,presetColors:l,style:{padding:"0"}})}),r(m,{value:"gradient",className:"ember-panel pn:w-full",children:r(C,{value:e,onChange:n,store:a,preset:l})})]})})});export const ColoredBox=o.forwardRef(function(t,o){var{size:n=30,background:s,style:l={},className:i,children:a=null}=t,c=e(t,["size","background","style","className","children"]);const u="string"==typeof s?s:"transparent",p=u.includes("gradient")?u:`linear-gradient(${u}, ${u}), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 8 8'%3E%3Cg fill='rgba(112, 112, 116, 1)' fill-opacity='1'%3E%3Cpath fill-rule='evenodd' d='M0 0h4v4H0V0zm4 4h4v4H4V4z'/%3E%3C/g%3E%3C/svg%3E")`;return r("div",Object.assign({ref:o,role:"button",tabIndex:0,"aria-label":"Pick color",onMouseDown:e=>e.preventDefault(),className:d("pn:flex pn:cursor-pointer pn:items-center pn:justify-center pn:overflow-hidden pn:rounded-md pn:border pn:border-foreground/30",i),style:Object.assign({width:n+"px",height:n+"px",backgroundImage:p},l)},c,{children:a}))});let E=e=>{const r=getUsedColors(e).slice(0,8).filter(e=>!DEFAULT_COLORS.find(r=>a(r,e)));return r.concat(DEFAULT_COLORS.slice(0,16-r.length).reverse())};export function setColorsPresetFunc(e){E=e}export const ColorPicker=({value:e,onChange:n,size:s,store:l,gradientEnabled:i,children:a,style:c,onOpen:d,onClose:u})=>{const h=E(l),[m,v]=o.useState(!1);return t(p,{open:m,onOpenChange:e=>{v(e),e?null==d||d():null==u||u()},children:[r(f,{nativeButton:!1,render:r(ColoredBox,{size:s,background:e,style:c,children:a})}),r(g,{className:"pn:w-[280px] pn:p-0",initialFocus:!1,children:i?r(y,{preset:h,value:e,onChange:n,store:l}):r("div",{style:{padding:"5px"},children:r(b,{color:e,onChange:n,presetColors:h})})})]})};export default ColorPicker;
|
package/toolbar/copy-style.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { StoreType } from '../model/store.js';
|
|
2
2
|
export declare const CopyStyleButton: (({ store }: {
|
|
3
3
|
store: StoreType;
|
|
4
|
-
}) => import("react").JSX.Element) & {
|
|
5
|
-
|
|
4
|
+
}) => import("react").JSX.Element) & import("react").NamedExoticComponent<{
|
|
5
|
+
store: StoreType;
|
|
6
|
+
}> & {
|
|
7
|
+
readonly type: ({ store }: {
|
|
8
|
+
store: StoreType;
|
|
9
|
+
}) => import("react").JSX.Element;
|
|
6
10
|
};
|
|
7
11
|
export declare const PAINT_ICON: import("react").JSX.Element;
|
|
@@ -2,7 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
import type { StoreType } from '../ui-types.js';
|
|
3
3
|
export declare const DownloadButton: (({ store }: {
|
|
4
4
|
store: StoreType;
|
|
5
|
-
}) => React.JSX.Element) & {
|
|
6
|
-
|
|
5
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
6
|
+
store: StoreType;
|
|
7
|
+
}> & {
|
|
8
|
+
readonly type: ({ store }: {
|
|
9
|
+
store: StoreType;
|
|
10
|
+
}) => React.JSX.Element;
|
|
7
11
|
};
|
|
8
12
|
export default DownloadButton;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { StoreType } from '../model/store.js';
|
|
2
2
|
export declare const DuplicateButton: (({ store }: {
|
|
3
3
|
store: StoreType;
|
|
4
|
-
}) => import("react").JSX.Element) & {
|
|
5
|
-
|
|
4
|
+
}) => import("react").JSX.Element) & import("react").NamedExoticComponent<{
|
|
5
|
+
store: StoreType;
|
|
6
|
+
}> & {
|
|
7
|
+
readonly type: ({ store }: {
|
|
8
|
+
store: StoreType;
|
|
9
|
+
}) => import("react").JSX.Element;
|
|
6
10
|
};
|
|
@@ -10,16 +10,16 @@ type ButtonProps = {
|
|
|
10
10
|
store: StoreType;
|
|
11
11
|
elements: FigureElementType[];
|
|
12
12
|
};
|
|
13
|
-
export declare const FigureFill: (({ elements, store }: ButtonProps) => React.JSX.Element) & {
|
|
14
|
-
|
|
13
|
+
export declare const FigureFill: (({ elements, store }: ButtonProps) => React.JSX.Element) & React.NamedExoticComponent<ButtonProps> & {
|
|
14
|
+
readonly type: ({ elements, store }: ButtonProps) => React.JSX.Element;
|
|
15
15
|
};
|
|
16
|
-
export declare const FigureSettings: (({ store, elements }: ButtonProps) => React.JSX.Element) & {
|
|
17
|
-
|
|
16
|
+
export declare const FigureSettings: (({ store, elements }: ButtonProps) => React.JSX.Element) & React.NamedExoticComponent<ButtonProps> & {
|
|
17
|
+
readonly type: ({ store, elements }: ButtonProps) => React.JSX.Element;
|
|
18
18
|
};
|
|
19
|
-
export declare const FigureStroke: (({ elements, store }: ButtonProps) => React.JSX.Element | null) & {
|
|
20
|
-
|
|
19
|
+
export declare const FigureStroke: (({ elements, store }: ButtonProps) => React.JSX.Element | null) & React.NamedExoticComponent<ButtonProps> & {
|
|
20
|
+
readonly type: ({ elements, store }: ButtonProps) => React.JSX.Element | null;
|
|
21
21
|
};
|
|
22
|
-
export declare const FigureToolbar: (({ store, components }: Props) => React.JSX.Element) & {
|
|
23
|
-
|
|
22
|
+
export declare const FigureToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
|
|
23
|
+
readonly type: ({ store, components }: Props) => React.JSX.Element;
|
|
24
24
|
};
|
|
25
25
|
export default FigureToolbar;
|