polotno 3.19.0 → 3.20.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.
Files changed (203) hide show
  1. package/LICENSE.md +8 -2
  2. package/THIRD_PARTY_NOTICES.md +2871 -0
  3. package/blueprint/canvas/context-menu/context-menu.js +1 -1
  4. package/blueprint/canvas/page-controls.d.ts +3 -3
  5. package/blueprint/pages-timeline/pages-timeline.js +2 -2
  6. package/blueprint/pages-timeline/play-button.js +2 -2
  7. package/blueprint/side-panel/animations-panel.d.ts +1 -1
  8. package/blueprint/side-panel/draw-panel.js +2 -2
  9. package/blueprint/side-panel/effect-card.js +3 -3
  10. package/blueprint/side-panel/effects-panel.d.ts +1 -1
  11. package/blueprint/side-panel/effects-panel.js +1 -1
  12. package/blueprint/side-panel/elements-panel.d.ts +1 -1
  13. package/blueprint/side-panel/select-video.d.ts +19 -19
  14. package/blueprint/side-panel/videos-grid.d.ts +4 -4
  15. package/blueprint/toolbar/animations-picker.d.ts +1 -1
  16. package/blueprint/toolbar/element-container.d.ts +1 -1
  17. package/blueprint/toolbar/figure-toolbar.js +1 -1
  18. package/blueprint/toolbar/filters-picker.d.ts +1 -1
  19. package/blueprint/toolbar/filters-picker.js +1 -1
  20. package/blueprint/toolbar/group-button.js +1 -1
  21. package/blueprint/toolbar/image-remove-background-button.js +1 -1
  22. package/blueprint/toolbar/image-toolbar.js +1 -1
  23. package/blueprint/toolbar/line-toolbar.js +1 -1
  24. package/blueprint/toolbar/page-toolbar.d.ts +1 -1
  25. package/blueprint/toolbar/position-picker.js +1 -1
  26. package/blueprint/toolbar/sketch.d.ts +5 -5
  27. package/blueprint/toolbar/svg-toolbar.js +1 -1
  28. package/blueprint/toolbar/table-toolbar.js +1 -1
  29. package/blueprint/toolbar/text-ai-write.js +1 -1
  30. package/blueprint/toolbar/text-toolbar.d.ts +1 -1
  31. package/blueprint.polotno.css +164 -153
  32. package/canvas/apply-filters.d.ts +2 -6
  33. package/canvas/apply-filters.js +1 -1
  34. package/canvas/context-menu/context-menu.js +1 -1
  35. package/canvas/crop-overlay.d.ts +1 -1
  36. package/canvas/crop-overlay.js +1 -1
  37. package/canvas/downscale.d.ts +1 -24
  38. package/canvas/downscale.js +1 -1
  39. package/canvas/element.d.ts +3 -1
  40. package/canvas/element.js +1 -1
  41. package/canvas/fade-overlay.js +1 -1
  42. package/canvas/figure-element.js +1 -1
  43. package/canvas/gif-element.d.ts +32 -0
  44. package/canvas/gif-element.js +1 -1
  45. package/canvas/hotkeys.d.ts +1 -1
  46. package/canvas/hotkeys.js +1 -1
  47. package/canvas/html-element.js +1 -1
  48. package/canvas/image-element.d.ts +4 -48
  49. package/canvas/image-element.js +1 -1
  50. package/canvas/image-tool-controls.js +1 -1
  51. package/canvas/line-element.js +1 -1
  52. package/canvas/lottie-element.d.ts +11 -0
  53. package/canvas/lottie-element.js +1 -0
  54. package/canvas/lottie-player.d.ts +2 -0
  55. package/canvas/lottie-player.js +1 -0
  56. package/canvas/lottie-player.wasm.d.ts +1 -0
  57. package/canvas/lottie-player.wasm.js +1 -0
  58. package/canvas/media-placeholders.d.ts +23 -0
  59. package/canvas/media-placeholders.js +1 -0
  60. package/canvas/page-controls.d.ts +3 -3
  61. package/canvas/page.js +1 -1
  62. package/canvas/quill-font-formats.d.ts +2 -2
  63. package/canvas/rect-control.js +1 -1
  64. package/canvas/render-tag-element.js +1 -1
  65. package/canvas/rich-editor.d.ts +7 -4
  66. package/canvas/rich-editor.js +5 -5
  67. package/canvas/rules.js +2 -2
  68. package/canvas/table-cell-text.d.ts +18 -0
  69. package/canvas/table-cell-text.js +1 -0
  70. package/canvas/table-element.js +1 -1
  71. package/canvas/text-element/caret-color.d.ts +3 -1
  72. package/canvas/text-element/render-tag-source.d.ts +33 -0
  73. package/canvas/text-element/render-tag-source.js +1 -0
  74. package/canvas/text-element.d.ts +1 -1
  75. package/canvas/text-element.js +1 -1
  76. package/canvas/use-color.d.ts +5 -5
  77. package/canvas/use-filtered-source.js +1 -1
  78. package/canvas/use-mediabunny-video.js +1 -1
  79. package/canvas/use-transformer-snap.d.ts +2 -2
  80. package/canvas/video-element.d.ts +4 -2
  81. package/canvas/video-element.js +1 -1
  82. package/icons/animation-icons.d.ts +1 -0
  83. package/icons/animation-icons.js +1 -1
  84. package/icons/registry.d.ts +35 -32
  85. package/icons/registry.js +1 -1
  86. package/image-tools/geometry.d.ts +2 -2
  87. package/image-tools/target.d.ts +6 -6
  88. package/image-tools/target.js +1 -1
  89. package/lib/utils.d.ts +1 -1
  90. package/model/figure-model.d.ts +10 -10
  91. package/model/gif-model.d.ts +10 -10
  92. package/model/group-model.d.ts +393 -84
  93. package/model/group-model.js +1 -1
  94. package/model/image-model.d.ts +10 -10
  95. package/model/image-tools.d.ts +1 -1
  96. package/model/line-model.d.ts +10 -10
  97. package/model/lottie-model.d.ts +242 -0
  98. package/model/lottie-model.js +5 -0
  99. package/model/node-model.d.ts +8 -8
  100. package/model/page-model.d.ts +1186 -297
  101. package/model/page-model.js +1 -1
  102. package/model/shape-model.d.ts +11 -11
  103. package/model/shape-model.js +1 -1
  104. package/model/store.d.ts +30 -26
  105. package/model/store.js +1 -1
  106. package/model/svg-model.d.ts +9 -9
  107. package/model/table-model.d.ts +127 -20
  108. package/model/table-model.js +1 -1
  109. package/model/text-model.d.ts +9 -9
  110. package/model/video-model.d.ts +10 -10
  111. package/package.json +36 -55
  112. package/pages-timeline/pages-timeline.js +1 -1
  113. package/pages-timeline/track-styles.d.ts +12 -12
  114. package/polotno-app.d.ts +1 -1
  115. package/polotno.bundle.js +183 -179
  116. package/primitives/button.d.ts +4 -4
  117. package/primitives/dialog.d.ts +4 -4
  118. package/primitives/dropdown-menu.d.ts +18 -18
  119. package/primitives/input-group.d.ts +1 -1
  120. package/primitives/popover.d.ts +4 -4
  121. package/primitives/select.d.ts +5 -5
  122. package/primitives/tooltip.d.ts +3 -3
  123. package/side-panel/animations-panel.js +1 -1
  124. package/side-panel/background-panel.js +1 -1
  125. package/side-panel/draw-panel.js +1 -1
  126. package/side-panel/effect-card.js +1 -1
  127. package/side-panel/effects-panel.js +1 -1
  128. package/side-panel/photos-panel.js +1 -1
  129. package/side-panel/select-lottie.d.ts +11 -0
  130. package/side-panel/select-lottie.js +1 -0
  131. package/side-panel/select-video.d.ts +19 -19
  132. package/side-panel/size-panel.js +1 -1
  133. package/side-panel/unsplash-credit.d.ts +4 -1
  134. package/side-panel/unsplash-credit.js +1 -1
  135. package/side-panel/upload-panel.js +1 -1
  136. package/themes/carbon.css +1 -1
  137. package/toolbar/gif-toolbar.d.ts +3 -0
  138. package/toolbar/gif-toolbar.js +1 -1
  139. package/toolbar/group-button.js +1 -1
  140. package/toolbar/html-toolbar.d.ts +1 -0
  141. package/toolbar/html-toolbar.js +3 -3
  142. package/toolbar/image-remove-background-button.js +1 -1
  143. package/toolbar/index.d.ts +1 -1
  144. package/toolbar/index.js +1 -1
  145. package/toolbar/line-toolbar.js +1 -1
  146. package/toolbar/position-picker.js +1 -1
  147. package/toolbar/table-toolbar.js +1 -1
  148. package/toolbar/text-ai-write.js +1 -1
  149. package/toolbar/text-toolbar.js +1 -1
  150. package/toolbar/toolbar-shared.d.ts +15 -4
  151. package/toolbar/toolbar-shared.js +1 -1
  152. package/toolbar/toolbar.js +1 -1
  153. package/ui.css +2 -2
  154. package/utils/animations.d.ts +47 -44
  155. package/utils/animations.js +1 -1
  156. package/utils/base64.d.ts +1 -2
  157. package/utils/base64.js +1 -1
  158. package/utils/clipboard.d.ts +19 -18
  159. package/utils/clipboard.js +1 -1
  160. package/utils/fade-gradient.d.ts +1 -1
  161. package/utils/file.d.ts +4 -3
  162. package/utils/file.js +1 -1
  163. package/utils/font-metric.d.ts +29 -28
  164. package/utils/fonts.js +1 -1
  165. package/utils/gif-lib.d.ts +1 -1
  166. package/utils/html2canvas.js +1 -1
  167. package/utils/image-dpi.d.ts +1 -1
  168. package/utils/image-dpi.js +1 -1
  169. package/utils/insert-file.js +1 -1
  170. package/utils/l10n.d.ts +1 -0
  171. package/utils/l10n.js +1 -1
  172. package/utils/lottie.d.ts +12 -0
  173. package/utils/lottie.js +1 -0
  174. package/utils/math.d.ts +4 -4
  175. package/utils/px.d.ts +3 -0
  176. package/utils/px.js +1 -1
  177. package/utils/react-color/components/common/Checkboard.d.ts +12 -12
  178. package/utils/react-color/components/common/Swatch.d.ts +6 -6
  179. package/utils/react-color/helpers/interaction.d.ts +6 -6
  180. package/utils/reactcss/components/active.d.ts +6 -6
  181. package/utils/reactcss/components/hover.d.ts +6 -6
  182. package/utils/rich-text-html.js +1 -1
  183. package/utils/selection-colors.js +1 -1
  184. package/utils/selection-transform.d.ts +4 -4
  185. package/utils/selection-transform.js +1 -1
  186. package/utils/split-element.js +1 -1
  187. package/utils/text-format-state.d.ts +1 -0
  188. package/utils/text-format-state.js +1 -1
  189. package/utils/text-format.d.ts +2 -2
  190. package/utils/text-sizing.d.ts +1 -1
  191. package/utils/timeline.d.ts +30 -2
  192. package/utils/timeline.js +1 -1
  193. package/utils/to-html.js +1 -1
  194. package/utils/to-svg.js +1 -1
  195. package/utils/validate-key.js +1 -1
  196. package/canvas/downscale-bands.d.ts +0 -10
  197. package/canvas/downscale-bands.js +0 -1
  198. package/canvas/downscale-kernel.d.ts +0 -7
  199. package/canvas/downscale-kernel.js +0 -1
  200. package/canvas/downscale-kernel.wasm.d.ts +0 -1
  201. package/canvas/downscale-kernel.wasm.js +0 -1
  202. package/canvas/downscale-passes.d.ts +0 -7
  203. package/canvas/downscale-passes.js +0 -1
@@ -14,7 +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" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
17
+ blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
18
18
  custom: import("mobx-state-tree").IType<any, any, any>;
19
19
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
20
20
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -32,7 +32,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
32
32
  delay: import("mobx-state-tree").IType<number | undefined, number, number>;
33
33
  duration: import("mobx-state-tree").IType<number | undefined, number, number>;
34
34
  enabled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
35
- type: import("mobx-state-tree").ISimpleType<"exit" | "enter" | "loop">;
35
+ type: import("mobx-state-tree").ISimpleType<"enter" | "exit" | "loop">;
36
36
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
37
37
  data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>;
38
38
  easing: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -92,7 +92,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
92
92
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
93
93
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
94
94
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
95
- blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
95
+ blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
96
96
  custom: import("mobx-state-tree").IType<any, any, any>;
97
97
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
98
98
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -104,7 +104,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
104
104
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
105
105
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
106
106
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
107
- blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
107
+ blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
108
108
  custom: import("mobx-state-tree").IType<any, any, any>;
109
109
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
110
110
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -116,7 +116,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
116
116
  type: string | undefined;
117
117
  name: string | undefined;
118
118
  opacity: number | undefined;
119
- blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light" | undefined;
119
+ blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
120
120
  custom: any;
121
121
  visible: boolean | undefined;
122
122
  selectable: boolean | undefined;
@@ -135,7 +135,6 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
135
135
  alwaysOnTop: boolean;
136
136
  showInExport: boolean;
137
137
  } | {
138
- blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
139
138
  id: string;
140
139
  type: string;
141
140
  name: string;
@@ -146,6 +145,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
146
145
  removable: boolean;
147
146
  alwaysOnTop: boolean;
148
147
  showInExport: boolean;
148
+ blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light";
149
149
  }>>;
150
150
  readonly parent: any;
151
151
  readonly isHighlighted: boolean;
@@ -163,7 +163,6 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
163
163
  alwaysOnTop: boolean;
164
164
  showInExport: boolean;
165
165
  } | {
166
- blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
167
166
  id: string;
168
167
  type: string;
169
168
  name: string;
@@ -174,6 +173,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
174
173
  removable: boolean;
175
174
  alwaysOnTop: boolean;
176
175
  showInExport: boolean;
176
+ blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light";
177
177
  };
178
178
  } & {
179
179
  clone(attrs?: any, { skipSelect }?: {
@@ -198,7 +198,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
198
198
  readonly isSelected: boolean;
199
199
  readonly isSelectedDirectly: boolean;
200
200
  } & {
201
- setAnimation(type: "enter" | "exit" | "loop", attrs: import("../utils/animations.js").AnimationAttrs): void;
201
+ setAnimation(type: 'enter' | 'exit' | 'loop', attrs: import("../utils/animations.js").AnimationAttrs): void;
202
202
  setFilter(type: any, value: any): void;
203
203
  } & {
204
204
  _setSourceSize(size: import("../image-tools/types.js").Size, src: string): void;
@@ -222,7 +222,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
222
222
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
223
223
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
224
224
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
225
- blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
225
+ blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
226
226
  custom: import("mobx-state-tree").IType<any, any, any>;
227
227
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
228
228
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -240,7 +240,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
240
240
  delay: import("mobx-state-tree").IType<number | undefined, number, number>;
241
241
  duration: import("mobx-state-tree").IType<number | undefined, number, number>;
242
242
  enabled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
243
- type: import("mobx-state-tree").ISimpleType<"exit" | "enter" | "loop">;
243
+ type: import("mobx-state-tree").ISimpleType<"enter" | "exit" | "loop">;
244
244
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
245
245
  data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>;
246
246
  easing: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -300,7 +300,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
300
300
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
301
301
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
302
302
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
303
- blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
303
+ blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
304
304
  custom: import("mobx-state-tree").IType<any, any, any>;
305
305
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
306
306
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -312,7 +312,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
312
312
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
313
313
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
314
314
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
315
- blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
315
+ blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
316
316
  custom: import("mobx-state-tree").IType<any, any, any>;
317
317
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
318
318
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -324,7 +324,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
324
324
  type: string | undefined;
325
325
  name: string | undefined;
326
326
  opacity: number | undefined;
327
- blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light" | undefined;
327
+ blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
328
328
  custom: any;
329
329
  visible: boolean | undefined;
330
330
  selectable: boolean | undefined;
@@ -343,7 +343,6 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
343
343
  alwaysOnTop: boolean;
344
344
  showInExport: boolean;
345
345
  } | {
346
- blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
347
346
  id: string;
348
347
  type: string;
349
348
  name: string;
@@ -354,6 +353,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
354
353
  removable: boolean;
355
354
  alwaysOnTop: boolean;
356
355
  showInExport: boolean;
356
+ blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light";
357
357
  }>>;
358
358
  readonly parent: any;
359
359
  readonly isHighlighted: boolean;
@@ -371,7 +371,6 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
371
371
  alwaysOnTop: boolean;
372
372
  showInExport: boolean;
373
373
  } | {
374
- blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
375
374
  id: string;
376
375
  type: string;
377
376
  name: string;
@@ -382,6 +381,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
382
381
  removable: boolean;
383
382
  alwaysOnTop: boolean;
384
383
  showInExport: boolean;
384
+ blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light";
385
385
  };
386
386
  } & {
387
387
  clone(attrs?: any, { skipSelect }?: {
@@ -406,7 +406,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
406
406
  readonly isSelected: boolean;
407
407
  readonly isSelectedDirectly: boolean;
408
408
  } & {
409
- setAnimation(type: "enter" | "exit" | "loop", attrs: import("../utils/animations.js").AnimationAttrs): void;
409
+ setAnimation(type: 'enter' | 'exit' | 'loop', attrs: import("../utils/animations.js").AnimationAttrs): void;
410
410
  setFilter(type: any, value: any): void;
411
411
  } & {
412
412
  _setSourceSize(size: import("../image-tools/types.js").Size, src: string): void;
@@ -430,7 +430,7 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
430
430
  type: string | undefined;
431
431
  name: string | undefined;
432
432
  opacity: number | undefined;
433
- blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light" | undefined;
433
+ blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
434
434
  custom: any;
435
435
  visible: boolean | undefined;
436
436
  selectable: boolean | undefined;
@@ -449,7 +449,6 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
449
449
  alwaysOnTop: boolean;
450
450
  showInExport: boolean;
451
451
  } | {
452
- blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
453
452
  id: string;
454
453
  type: string;
455
454
  name: string;
@@ -460,7 +459,8 @@ export declare const selectVideo: ({ src, droppedPos, targetElement, store, attr
460
459
  removable: boolean;
461
460
  alwaysOnTop: boolean;
462
461
  showInExport: boolean;
462
+ blendMode: "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "normal" | "overlay" | "saturation" | "screen" | "soft-light";
463
463
  }>> & {
464
- type: "video";
464
+ type: 'video';
465
465
  }) | undefined>;
466
466
  export {};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as i,Fragment as n}from"react/jsx-runtime";import*as t from"react";import{observer as a}from"mobx-react-lite";import{PolotnoIcon as s}from"../icons/registry.js";import{t as p}from"../utils/l10n.js";import{pxToUnit as l,pxToUnitRounded as d,unitToPx as o}from"../utils/unit.js";import{Button as r}from"../primitives/button.js";import{Switch as m}from"../primitives/switch.js";import{Select as c,SelectContent as u,SelectItem as h,SelectTrigger as x,SelectValue as v}from"../primitives/select.js";import{Tooltip as g,TooltipContent as z,TooltipTrigger as f}from"../primitives/tooltip.js";import{PanelScrollArea as b}from"../primitives/panel-scroll-area.js";import{NumericInputDelayed as w}from"../primitives/numeric-input-delayed.js";export const SIZE_CATEGORIES=[{name:"Instagram",icon:e(s,{name:"size.instagram"}),sizes:[["Post",1080,1080,"px",e(s,{name:"size.instagram"})],["Story",1080,1920,"px",e(s,{name:"size.instagram"})],["Ad",1080,1080,"px",e(s,{name:"size.instagram"})]]},{name:"Facebook",icon:e(s,{name:"size.facebook"}),sizes:[["Post (Landscape)",1200,630,"px",e(s,{name:"size.facebook"})],["Post (Square)",1080,1080,"px",e(s,{name:"size.facebook"})],["Cover",851,315,"px",e(s,{name:"size.facebook"})]]},{name:"Youtube",icon:e(s,{name:"size.youtube"}),sizes:[["Thumbnail",1280,720,"px",e(s,{name:"size.youtube"})],["Channel",2560,1440,"px",e(s,{name:"size.youtube"})],["Short",1080,1920,"px",e(s,{name:"size.youtube"})]]},{name:"LinkedIn",icon:e(s,{name:"size.linkedin"}),sizes:[["Post",1200,627,"px",e(s,{name:"size.linkedin"})],["Banner",1584,396,"px",e(s,{name:"size.linkedin"})],["Square",1080,1080,"px",e(s,{name:"size.linkedin"})]]},{name:"Twitter",icon:e(s,{name:"size.twitter"}),sizes:[["Post",1600,900,"px",e(s,{name:"size.twitter"})],["Header",1500,500,"px",e(s,{name:"size.twitter"})],["Square",1080,1080,"px",e(s,{name:"size.twitter"})]]},{name:"Video",icon:e(s,{name:"size.video"}),sizes:[["Full HD",1920,1080,"px",e(s,{name:"size.video"})],["4K UHD",3840,2160,"px",e(s,{name:"size.video"})],["Vertical HD",1080,1920,"px",e(s,{name:"size.video"})],["Square HD",1080,1080,"px",e(s,{name:"size.video"})]]},{name:"Print",icon:e(s,{name:"size.print"}),sizes:[["Invitation",14,14,"cm",e(s,{name:"size.print"})],["A4 Portrait",21,29.7,"cm",e(s,{name:"size.print"})],["A4 Landscape",29.7,21,"cm",e(s,{name:"size.print"})],["A3",29.7,42,"cm",e(s,{name:"size.print"})],["Letter Portrait",8.5,11,"in",e(s,{name:"size.print"})],["Letter Landscape",11,8.5,"in",e(s,{name:"size.print"})],["Business card",3.5,2,"in",e(s,{name:"size.businessCard"})],["Poster",18,24,"in",e(s,{name:"size.print"})]]}];const k=({width:i,height:n})=>{const t=i/n,a=t>=1?18:Math.max(4,18*t),s=t>=1?Math.max(4,18/t):18;return e("span",{className:"pn:flex pn:size-5 pn:shrink-0 pn:items-center pn:justify-center pn:text-muted-foreground",children:e("span",{className:"pn:rounded-[2px] pn:border pn:border-current",style:{width:a,height:s}})})};export const SizePanel=a(({store:a})=>{var P,N,y,j;const[B,C]=t.useState(!0),[S,E]=t.useState(!1),[V,I]=t.useState(a.width),[L,A]=t.useState(a.height),D=l({px:10,unit:a.unit,dpi:a.dpi}),H=(null===(P=a.activePage)||void 0===P?void 0:P.computedWidth)||a.width;t.useEffect(()=>{I(d({px:H,unit:a.unit,dpi:a.dpi}))},[H,a.unit,a.dpi]);const R=(null===(N=a.activePage)||void 0===N?void 0:N.computedHeight)||a.height;t.useEffect(()=>{A(d({px:R,unit:a.unit,dpi:a.dpi}))},[R,a.unit,a.dpi]);const T=(e,i,n)=>{var t,s,p,l;a.setSize(e,i,n),"auto"!==(null===(t=a.activePage)||void 0===t?void 0:t.width)&&(null===(s=a.activePage)||void 0===s||s.set({width:e})),"auto"!==(null===(p=a.activePage)||void 0===p?void 0:p.height)&&(null===(l=a.activePage)||void 0===l||l.set({height:i}))},F=d({px:null!==(j=null===(y=a.activePage)||void 0===y?void 0:y.computedBleed.top)&&void 0!==j?j:0,unit:a.unit,dpi:a.dpi});return i(b,{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:[p("sidePanel.useMagicResize")," ",i(g,{children:[e(f,{render:e("span",{className:"pn:inline-flex",children:e(s,{name:"action.help",className:"pn:size-4"})})}),e(z,{children:p("sidePanel.magicResizeDescription")})]})]}),e(m,{checked:B,onCheckedChange:e=>{C(Boolean(e))}})]}),i("div",{className:"pn:inline-block pn:w-1/2",children:[p("sidePanel.width")," (",a.unit,")"]}),e("div",{className:"pn:inline-block pn:w-1/2",children:e(w,{value:V,onChange:e=>{e||(e=D),I(e)},min:D,max:1e4,step:"px"===a.unit?1:.1})})]}),i("div",{style:{paddingBottom:"15px"},children:[i("div",{className:"pn:inline-block pn:w-1/2",children:[p("sidePanel.height")," (",a.unit,")"]}),e("div",{className:"pn:inline-block pn:w-1/2",children:e(w,{value:L,onChange:e=>{e||(e=D),A(e)},min:D,max:1e4,step:"px"===a.unit?1:.1})})]}),i("div",{style:{paddingBottom:"15px"},children:[e("div",{className:"pn:inline-block pn:w-1/2",children:p("sidePanel.units")}),e("div",{className:"pn:inline-block pn:w-1/2",children:i(c,{value:a.unit,onValueChange:e=>{const i=e;a.setUnit({unit:i,dpi:a.dpi})},children:[e(x,{className:"pn:w-full",children:e(v,{})}),i(u,{children:[e(h,{value:"px",children:"px"}),e(h,{value:"cm",children:"cm"}),e(h,{value:"in",children:"in"})]})]})})]}),e("div",{style:{paddingBottom:"15px"},children:e(r,{className:"pn:w-full",variant:"default",onClick:()=>{const e=o({unitVal:V,dpi:a.dpi,unit:a.unit}),i=o({unitVal:L,dpi:a.dpi,unit:a.unit});T(e,i,B)},children:p("sidePanel.resize")})}),i(r,{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(!S),children:[e(s,{name:S?"ui.chevronDown":"ui.chevronRight",className:"pn:size-3"}),p("sidePanel.advanced")]}),S&&i(n,{children:[i("div",{style:{paddingBottom:"15px"},children:[i("div",{className:"pn:inline-block pn:w-1/2",children:[p("sidePanel.bleed")," (",a.unit,")"]}),e("div",{className:"pn:inline-block pn:w-1/2",children:e(w,{"aria-label":"bleed",value:F,onChange:e=>{if(!Number.isFinite(e)){return}const i=o({unitVal:e,dpi:a.dpi,unit:a.unit});a.pages.forEach(e=>{e.set({bleed:i,bleedTop:void 0,bleedRight:void 0,bleedBottom:void 0,bleedLeft:void 0})}),i>0&&a.toggleBleed(!0)},min:0,max:1e3,step:"px"===a.unit?1:.1})})]}),i("label",{className:"pn:flex pn:items-center pn:justify-between",style:{paddingBottom:"15px"},children:[e("span",{children:p("sidePanel.showBleed")}),e(m,{"aria-label":"show bleed",checked:a.bleedVisible,onCheckedChange:e=>{a.toggleBleed(Boolean(e))}})]})]}),SIZE_CATEGORIES.map(({name:n,icon:s,sizes:p})=>i(t.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,n]}),e("div",{className:"pn:mb-1.5 pn:flex pn:flex-col",children:p.map(([n,t,s,p])=>i(r,{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 e=o({unitVal:t,dpi:a.dpi,unit:p}),i=o({unitVal:s,dpi:a.dpi,unit:p});a.setUnit({unit:p,dpi:a.dpi}),T(e,i,B)},children:[e(k,{width:t,height:s}),e("span",{className:"pn:truncate",children:n}),i("span",{className:"pn:ml-auto pn:shrink-0 pn:text-xs pn:text-muted-foreground",children:[t,"×",s," ",p]})]},n))})]},n))]})});
1
+ import{Fragment as e,jsx as i,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{observer as a}from"mobx-react-lite";import{PolotnoIcon as s}from"../icons/registry.js";import{t as p}from"../utils/l10n.js";import{pxToUnit as l,pxToUnitRounded as d,unitToPx as o}from"../utils/unit.js";import{Button as r}from"../primitives/button.js";import{Switch as m}from"../primitives/switch.js";import{Select as c,SelectContent as u,SelectItem as h,SelectTrigger as x,SelectValue as v}from"../primitives/select.js";import{Tooltip as g,TooltipContent as z,TooltipTrigger as f}from"../primitives/tooltip.js";import{PanelScrollArea as b}from"../primitives/panel-scroll-area.js";import{NumericInputDelayed as w}from"../primitives/numeric-input-delayed.js";export const SIZE_CATEGORIES=[{name:"Instagram",icon:i(s,{name:"size.instagram"}),sizes:[["Post",1080,1080,"px",i(s,{name:"size.instagram"})],["Story",1080,1920,"px",i(s,{name:"size.instagram"})],["Ad",1080,1080,"px",i(s,{name:"size.instagram"})]]},{name:"Facebook",icon:i(s,{name:"size.facebook"}),sizes:[["Post (Landscape)",1200,630,"px",i(s,{name:"size.facebook"})],["Post (Square)",1080,1080,"px",i(s,{name:"size.facebook"})],["Cover",851,315,"px",i(s,{name:"size.facebook"})]]},{name:"Youtube",icon:i(s,{name:"size.youtube"}),sizes:[["Thumbnail",1280,720,"px",i(s,{name:"size.youtube"})],["Channel",2560,1440,"px",i(s,{name:"size.youtube"})],["Short",1080,1920,"px",i(s,{name:"size.youtube"})]]},{name:"LinkedIn",icon:i(s,{name:"size.linkedin"}),sizes:[["Post",1200,627,"px",i(s,{name:"size.linkedin"})],["Banner",1584,396,"px",i(s,{name:"size.linkedin"})],["Square",1080,1080,"px",i(s,{name:"size.linkedin"})]]},{name:"Twitter",icon:i(s,{name:"size.twitter"}),sizes:[["Post",1600,900,"px",i(s,{name:"size.twitter"})],["Header",1500,500,"px",i(s,{name:"size.twitter"})],["Square",1080,1080,"px",i(s,{name:"size.twitter"})]]},{name:"Video",icon:i(s,{name:"size.video"}),sizes:[["Full HD",1920,1080,"px",i(s,{name:"size.video"})],["4K UHD",3840,2160,"px",i(s,{name:"size.video"})],["Vertical HD",1080,1920,"px",i(s,{name:"size.video"})],["Square HD",1080,1080,"px",i(s,{name:"size.video"})]]},{name:"Print",icon:i(s,{name:"size.print"}),sizes:[["Invitation",14,14,"cm",i(s,{name:"size.print"})],["A4 Portrait",21,29.7,"cm",i(s,{name:"size.print"})],["A4 Landscape",29.7,21,"cm",i(s,{name:"size.print"})],["A3",29.7,42,"cm",i(s,{name:"size.print"})],["Letter Portrait",8.5,11,"in",i(s,{name:"size.print"})],["Letter Landscape",11,8.5,"in",i(s,{name:"size.print"})],["Business card",3.5,2,"in",i(s,{name:"size.businessCard"})],["Poster",18,24,"in",i(s,{name:"size.print"})]]}];const k=({width:e,height:n})=>{const t=e/n,a=t>=1?18:Math.max(4,18*t),s=t>=1?Math.max(4,18/t):18;return i("span",{className:"pn:flex pn:size-5 pn:shrink-0 pn:items-center pn:justify-center pn:text-muted-foreground",children:i("span",{className:"pn:rounded-[2px] pn:border pn:border-current",style:{width:a,height:s}})})};export const SizePanel=a(({store:a})=>{var P,N,y,j;const[B,C]=t.useState(!0),[S,E]=t.useState(!1),[V,I]=t.useState(a.width),[L,A]=t.useState(a.height),D=l({px:10,unit:a.unit,dpi:a.dpi}),H=(null===(P=a.activePage)||void 0===P?void 0:P.computedWidth)||a.width;t.useEffect(()=>{I(d({px:H,unit:a.unit,dpi:a.dpi}))},[H,a.unit,a.dpi]);const R=(null===(N=a.activePage)||void 0===N?void 0:N.computedHeight)||a.height;t.useEffect(()=>{A(d({px:R,unit:a.unit,dpi:a.dpi}))},[R,a.unit,a.dpi]);const T=(e,i,n)=>{var t,s,p,l;a.setSize(e,i,n),"auto"!==(null===(t=a.activePage)||void 0===t?void 0:t.width)&&(null===(s=a.activePage)||void 0===s||s.set({width:e})),"auto"!==(null===(p=a.activePage)||void 0===p?void 0:p.height)&&(null===(l=a.activePage)||void 0===l||l.set({height:i}))},F=d({px:null!==(j=null===(y=a.activePage)||void 0===y?void 0:y.computedBleed.top)&&void 0!==j?j:0,unit:a.unit,dpi:a.dpi});return n(b,{children:[n("div",{style:{paddingBottom:"15px"},children:[n("label",{className:"pn:flex pn:items-center pn:justify-between",style:{marginTop:"8px",marginBottom:"25px"},children:[n("span",{className:"pn:flex pn:items-center pn:gap-1.5",children:[p("sidePanel.useMagicResize")," ",n(g,{children:[i(f,{render:i("span",{className:"pn:inline-flex",children:i(s,{name:"action.help",className:"pn:size-4"})})}),i(z,{children:p("sidePanel.magicResizeDescription")})]})]}),i(m,{checked:B,onCheckedChange:e=>{C(Boolean(e))}})]}),n("div",{className:"pn:inline-block pn:w-1/2",children:[p("sidePanel.width")," (",a.unit,")"]}),i("div",{className:"pn:inline-block pn:w-1/2",children:i(w,{value:V,onChange:e=>{e||(e=D),I(e)},min:D,max:1e4,step:"px"===a.unit?1:.1})})]}),n("div",{style:{paddingBottom:"15px"},children:[n("div",{className:"pn:inline-block pn:w-1/2",children:[p("sidePanel.height")," (",a.unit,")"]}),i("div",{className:"pn:inline-block pn:w-1/2",children:i(w,{value:L,onChange:e=>{e||(e=D),A(e)},min:D,max:1e4,step:"px"===a.unit?1:.1})})]}),n("div",{style:{paddingBottom:"15px"},children:[i("div",{className:"pn:inline-block pn:w-1/2",children:p("sidePanel.units")}),i("div",{className:"pn:inline-block pn:w-1/2",children:n(c,{value:a.unit,onValueChange:e=>{const i=e;a.setUnit({unit:i,dpi:a.dpi})},children:[i(x,{className:"pn:w-full",children:i(v,{})}),n(u,{children:[i(h,{value:"px",children:"px"}),i(h,{value:"cm",children:"cm"}),i(h,{value:"in",children:"in"})]})]})})]}),i("div",{style:{paddingBottom:"15px"},children:i(r,{className:"pn:w-full",variant:"default",onClick:()=>{const e=o({unitVal:V,dpi:a.dpi,unit:a.unit}),i=o({unitVal:L,dpi:a.dpi,unit:a.unit});T(e,i,B)},children:p("sidePanel.resize")})}),n(r,{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(!S),children:[i(s,{name:S?"ui.chevronDown":"ui.chevronRight",className:"pn:size-3"}),p("sidePanel.advanced")]}),S&&n(e,{children:[n("div",{style:{paddingBottom:"15px"},children:[n("div",{className:"pn:inline-block pn:w-1/2",children:[p("sidePanel.bleed")," (",a.unit,")"]}),i("div",{className:"pn:inline-block pn:w-1/2",children:i(w,{"aria-label":"bleed",value:F,onChange:e=>{if(!Number.isFinite(e)){return}const i=o({unitVal:e,dpi:a.dpi,unit:a.unit});a.pages.forEach(e=>{e.set({bleed:i,bleedTop:void 0,bleedRight:void 0,bleedBottom:void 0,bleedLeft:void 0})}),i>0&&a.toggleBleed(!0)},min:0,max:1e3,step:"px"===a.unit?1:.1})})]}),n("label",{className:"pn:flex pn:items-center pn:justify-between",style:{paddingBottom:"15px"},children:[i("span",{children:p("sidePanel.showBleed")}),i(m,{"aria-label":"show bleed",checked:a.bleedVisible,onCheckedChange:e=>{a.toggleBleed(Boolean(e))}})]})]}),SIZE_CATEGORIES.map(({name:e,icon:s,sizes:p})=>n(t.Fragment,{children:[n("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,e]}),i("div",{className:"pn:mb-1.5 pn:flex pn:flex-col",children:p.map(([e,t,s,p])=>n(r,{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 e=o({unitVal:t,dpi:a.dpi,unit:p}),i=o({unitVal:s,dpi:a.dpi,unit:p});a.setUnit({unit:p,dpi:a.dpi}),T(e,i,B)},children:[i(k,{width:t,height:s}),i("span",{className:"pn:truncate",children:e}),n("span",{className:"pn:ml-auto pn:shrink-0 pn:text-xs pn:text-muted-foreground",children:[t,"×",s," ",p]})]},e))})]},e))]})});
@@ -1,2 +1,5 @@
1
1
  import * as React from 'react';
2
- export declare function unsplashCredit(image: any): React.JSX.Element;
2
+ export declare function unsplashCredit(image: any, provider?: {
3
+ name: string;
4
+ url: string;
5
+ }): React.JSX.Element;
@@ -1 +1 @@
1
- import{jsx as r,jsxs as e}from"react/jsx-runtime";export function unsplashCredit(s){return e("span",{children:["Photo by"," ",r("a",{href:`https://unsplash.com/@${s.user.username}?utm_source=polotno&utm_medium=referral`,target:"_blank",children:s.user.name})," ","on"," ",r("a",{href:"https://unsplash.com/?utm_source=polotno&utm_medium=referral",target:"_blank",children:"Unsplash"})]})}
1
+ import{jsx as r,jsxs as l}from"react/jsx-runtime";export function unsplashCredit(n,e){var o,u,t,a,s;const i=null!==(t=n.author)&&void 0!==t?t:{name:null===(o=n.user)||void 0===o?void 0:o.name,url:`https://unsplash.com/@${null===(u=n.user)||void 0===u?void 0:u.username}?utm_source=polotno&utm_medium=referral`};return l("span",{children:["Photo by"," ",r("a",{href:i.url,target:"_blank",children:i.name})," ","on"," ",r("a",{href:null!==(a=null==e?void 0:e.url)&&void 0!==a?a:"https://unsplash.com/?utm_source=polotno&utm_medium=referral",target:"_blank",children:null!==(s=null==e?void 0:e.name)&&void 0!==s?s:"Unsplash"})]})}
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{PolotnoIcon as n}from"../icons/registry.js";import{getVideoPreview as o}from"../utils/video.js";import{getMediaType as r,getUploadFunc as l,MEDIA_ACCEPT as s}from"../utils/file.js";import{insertMediaIntoPage as a}from"../utils/insert-file.js";import{isImageLoadError as p}from"../utils/errors.js";import{ImagesGrid as c}from"./images-grid.js";import{t as d}from"../utils/l10n.js";import{cn as u}from"../lib/utils.js";import{Button as m}from"../primitives/button.js";export{setUploadFunc}from"../utils/file.js";let f=[],g=0;function h(){const e=new Blob(['\n <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">\n <circle cx="50" cy="50" r="45" fill="#f0f0f0" stroke="#ccc" stroke-width="2"/>\n <path d="M40,35 L40,65 L55,50 L70,50 M70,35 Q80,50 70,65" fill="none" stroke="#666" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n '],{type:"image/svg+xml"});return URL.createObjectURL(e)}async function v(e,t){if("audio"===t){return h()}const i=URL.createObjectURL(e);if("video"!==t){return i}try{return await o(i)}finally{URL.revokeObjectURL(i)}}const y=e=>{e.startsWith("blob:")&&URL.revokeObjectURL(e)};export const UploadPanel=({store:w})=>{const[x,j]=i.useState(f),[L,b]=i.useState([]),[U,k]=i.useState(null),R=i.useRef(null);i.useEffect(()=>{f=x},[x]);const P=[...L,...x];return t("div",{className:"pn:flex pn:h-full pn:flex-col",children:[e("div",{style:{height:"45px",paddingTop:"5px"},children:d("sidePanel.uploadTip")}),e("div",{style:{marginBottom:"20px"},children:t("label",{htmlFor:"input-file",children:[t(m,{variant:"outline",style:{width:"100%"},onClick:()=>{var e;null===(e=R.current)||void 0===e||e.click()},children:[e(n,{name:"action.add"}),d("sidePanel.uploadImage")]}),e("input",{type:"file",ref:R,style:{display:"none"},accept:s,onChange:async e=>{var t;const{target:i}=e,n=Array.from(null!==(t=i.files)&&void 0!==t?t:[]);i.value="",k(null);const s=[];for(const o of n){const e=r(o);e&&s.push({file:o,type:e})}s.length<n.length&&k(d("sidePanel.uploadUnsupported"));const a=await Promise.all(s.map(async({file:e,type:t})=>({id:g++,preview:await v(e,t),pending:!0})));b(e=>[...a,...e]);for(const[r,{file:p,type:c}]of s.entries()){const t=a[r];try{const e=await l()(p);let t=e;"video"===c?t=await o(e):"audio"===c&&(t=h()),j(i=>[{url:e,type:c,preview:t,name:p.name},...i])}catch(e){console.error(e),k(d("sidePanel.uploadFailed"))}finally{b(e=>e.filter(e=>e.id!==t.id)),y(t.preview)}}},multiple:!0})]})}),U&&e("div",{role:"alert",className:"pn:pb-[10px] pn:text-center pn:text-xs pn:text-muted-foreground",children:U}),e(c,{images:P,isLoading:!1,getPreview:e=>e.preview,getImageClassName:e=>"pending"in e?u("pn:animate-pulse pn:opacity-50"):"",hideNoResults:!0,onSelect:(e,t,i)=>{"pending"in e||(k(null),a({url:e.url,type:e.type,store:w,droppedPos:t,targetElement:i,name:e.name}).catch(e=>{if(!p(e)){throw e}console.warn("polotno: failed to add the uploaded file",e),k(d("sidePanel.error"))}))}})]})};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{PolotnoIcon as r}from"../icons/registry.js";import{svgToURL as o}from"@polotno/core/svg";import{getVideoPreview as n}from"../utils/video.js";import{detectMediaType as l,getUploadFunc as s,MEDIA_ACCEPT as a}from"../utils/file.js";import{getLottiePreview as p}from"../utils/lottie.js";import{insertMediaIntoPage as c}from"../utils/insert-file.js";import{isImageLoadError as d}from"../utils/errors.js";import{ImagesGrid as m}from"./images-grid.js";import{t as u}from"../utils/l10n.js";import{cn as f}from"../lib/utils.js";import{Button as v}from"../primitives/button.js";export{setUploadFunc}from"../utils/file.js";let h=[],g=0;const w=o('\n <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">\n <circle cx="50" cy="50" r="45" fill="#f0f0f0" stroke="#ccc" stroke-width="2"/>\n <path d="M40,35 L40,65 L55,50 L70,50 M70,35 Q80,50 70,65" fill="none" stroke="#666" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n'),y=e=>{e.startsWith("blob:")&&URL.revokeObjectURL(e)};export const UploadPanel=({store:o})=>{const[j,x]=i.useState(h),[b,k]=i.useState([]),[L,P]=i.useState(null),U=i.useRef(null);i.useEffect(()=>{h=j},[j]);const R=[...b,...j];return t("div",{className:"pn:flex pn:h-full pn:flex-col",children:[e("div",{style:{height:"45px",paddingTop:"5px"},children:u("sidePanel.uploadTip")}),e("div",{style:{marginBottom:"20px"},children:t("label",{htmlFor:"input-file",children:[t(v,{variant:"outline",style:{width:"100%"},onClick:()=>{var e;null===(e=U.current)||void 0===e||e.click()},children:[e(r,{name:"action.add"}),u("sidePanel.uploadImage")]}),e("input",{type:"file",ref:U,style:{display:"none"},accept:a,onChange:async e=>{var t;const{target:i}=e,r=Array.from(null!==(t=i.files)&&void 0!==t?t:[]);i.value="",P(null);const o=(await Promise.all(r.map(async e=>{const t=await l(e);if(!t){return}const i=await async function(e,t){if("audio"===t){return w}const i=URL.createObjectURL(e),r="video"===t?n:"lottie"===t?p:void 0;if(!r){return i}try{return await r(i)}finally{URL.revokeObjectURL(i)}}(e,t).catch(()=>{});return i?{file:e,type:t,preview:i}:void 0}))).filter(e=>void 0!==e);o.length<r.length&&P(u("sidePanel.uploadUnsupported"));const a=o.map(({preview:e})=>({id:g++,preview:e,pending:!0}));k(e=>[...a,...e]);for(const[n,{file:l,type:p}]of o.entries()){const t=a[n];try{const e=await s()(l),i=t.preview.startsWith("blob:")?e:t.preview;x(t=>[{url:e,type:p,preview:i,name:l.name},...t])}catch(e){console.error(e),P(u("sidePanel.uploadFailed"))}finally{k(e=>e.filter(e=>e.id!==t.id)),y(t.preview)}}},multiple:!0})]})}),L&&e("div",{role:"alert",className:"pn:pb-[10px] pn:text-center pn:text-xs pn:text-muted-foreground",children:L}),e(m,{images:R,isLoading:!1,getPreview:e=>e.preview,getImageClassName:e=>"pending"in e?f("pn:animate-pulse pn:opacity-50"):"",hideNoResults:!0,onSelect:(e,t,i)=>{"pending"in e||(P(null),c({url:e.url,type:e.type,store:o,droppedPos:t,targetElement:i,name:e.name}).catch(e=>{if(!d(e)){throw e}console.warn("polotno: failed to add the uploaded file",e),P(u("sidePanel.error"))}))}})]})};
package/themes/carbon.css CHANGED
@@ -119,7 +119,7 @@
119
119
  --sidebar-ring: #161616;
120
120
  }
121
121
 
122
- /* dark = website brand surface (#161616). Default theme (see providers.tsx). */
122
+ /* dark = website brand surface (#161616). */
123
123
  .dark {
124
124
  --background: #161616; /* website --color-bg */
125
125
  --foreground: #ffffff; /* website --color-fg */
@@ -7,4 +7,7 @@ type Props = {
7
7
  export declare const GifToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
8
8
  readonly type: ({ store, components }: Props) => React.JSX.Element;
9
9
  };
10
+ export declare const LottieToolbar: (({ store, components }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
11
+ readonly type: ({ store, components }: Props) => React.JSX.Element;
12
+ };
10
13
  export default GifToolbar;
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{observer as t}from"mobx-react-lite";import{ElementContainer as o,extendToolbar as i}from"./element-container.js";import r from"./filters-picker.js";import{AnimationsPicker as s}from"./animations-picker.js";import{flags as m}from"../utils/flags.js";const n={GifFilters:r,GifAnimations:s};export const GifToolbar=t(({store:t,components:r})=>{const s=t.selectedElements,f=["GifFilters",m.animationsEnabled&&"GifAnimations"].filter(e=>!!e),l=i({type:"gif",usedItems:f,components:r});return e(o,{items:l,itemRender:o=>{const i=r[o]||n[o];return e(i,{elements:s,element:s[0],store:t},o)}})});export default GifToolbar;
1
+ import{jsx as t}from"react/jsx-runtime";import{observer as e}from"mobx-react-lite";import{ElementContainer as o,extendToolbar as r}from"./element-container.js";import i from"./filters-picker.js";import{AnimationsPicker as s}from"./animations-picker.js";import{flags as n}from"../utils/flags.js";const m=(m,l)=>e(({store:e,components:a})=>{const f=e.selectedElements,p={[`${l}Filters`]:i,[`${l}Animations`]:s},c=[`${l}Filters`,n.animationsEnabled&&`${l}Animations`].filter(t=>!!t),j=r({type:m,usedItems:c,components:a});return t(o,{items:j,itemRender:o=>{const r=a[o]||p[o];return t(r,{elements:f,element:f[0],store:e},o)}})});export const GifToolbar=m("gif","Gif");export const LottieToolbar=m("lottie","Lottie");export default GifToolbar;
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as s}from"react/jsx-runtime";import{observer as r}from"mobx-react-lite";import{Button as o}from"../primitives/button.js";import{t as n}from"../utils/l10n.js";export const GroupButton=r(({store:r})=>{const l=r.selectedElements.length>1,m=1===r.selectedElements.length&&"group"===r.selectedElements[0].type;return s(t,{children:[l&&e(o,{variant:"ghost",size:"sm",onClick:()=>{r.groupElements(r.selectedElements.map(e=>e.id))},style:{marginLeft:"auto"},children:n("toolbar.groupElements")}),m&&e(o,{variant:"ghost",size:"sm",onClick:()=>{r.ungroupElements([r.selectedElements[0].id])},style:{marginLeft:"auto"},children:n("toolbar.ungroupElements")})]})});
1
+ import{Fragment as e,jsx as t,jsxs as s}from"react/jsx-runtime";import{observer as r}from"mobx-react-lite";import{Button as o}from"../primitives/button.js";import{t as n}from"../utils/l10n.js";export const GroupButton=r(({store:r})=>{const l=r.selectedElements.length>1,m=1===r.selectedElements.length&&"group"===r.selectedElements[0].type;return s(e,{children:[l&&t(o,{variant:"ghost",size:"sm",onClick:()=>{r.groupElements(r.selectedElements.map(e=>e.id))},style:{marginLeft:"auto"},children:n("toolbar.groupElements")}),m&&t(o,{variant:"ghost",size:"sm",onClick:()=>{r.ungroupElements([r.selectedElements[0].id])},style:{marginLeft:"auto"},children:n("toolbar.ungroupElements")})]})});
@@ -27,6 +27,7 @@ export declare const FontColorInput: (({ element, store }: InputProps) => React.
27
27
  export declare const DirectionInput: (({ element }: InputProps) => React.JSX.Element) & React.NamedExoticComponent<InputProps> & {
28
28
  readonly type: ({ element }: InputProps) => React.JSX.Element;
29
29
  };
30
+ export declare const PROPS_MAP: Record<string, React.ComponentType<any>>;
30
31
  export declare const HtmlToolbar: (({ store, components }: PageProps) => React.JSX.Element) & React.NamedExoticComponent<PageProps> & {
31
32
  readonly type: ({ store, components }: PageProps) => React.JSX.Element;
32
33
  };
@@ -1,4 +1,4 @@
1
- import{jsx as t,jsxs as e}from"react/jsx-runtime";import o from"react";import{observer as n}from"mobx-react-lite";import{PolotnoIcon as i}from"../icons/registry.js";import{Button as l}from"../primitives/button.js";import{Tooltip as r,TooltipContent as a,TooltipTrigger as s}from"../primitives/tooltip.js";import{TooltipIconButton as c}from"../primitives/tooltip-icon-button.js";import{ColorPicker as m}from"./color-picker.js";import p from"./filters-picker.js";import{ElementContainer as d,extendToolbar as f}from"./element-container.js";import u from"../utils/styled.js";import{AnimationsPicker as x}from"./animations-picker.js";import{flags as g}from"../utils/flags.js";import{TextAiWrite as v}from"./text-ai-write.js";import{t as h}from"../utils/l10n.js";import{quillRef as b,createQuill as T,setQuillContent as y}from"../canvas/html-element.js";import{FontMenu as F,fetcher as S,TextSpacing as z,TextFontSize as j,ALIGN_OPTIONS as C,VERTICAL_ALIGN_OPTIONS as N,VERTICAL_ALIGN_ICONS as w}from"./text-toolbar.js";import{cycleNext as A}from"./toolbar-shared.js";import k from"swr";import{getFontsList as E,globalFonts as D,isGoogleFontChanged as L}from"../utils/fonts.js";import{getGoogleFontsListAPI as I}from"../utils/api.js";import{quillHtmlToModelText as M,listEffectiveFontFamilies as R,isBoldWeight as O}from"../utils/rich-text-html.js";import{patchTextFormat as W,decorationTokensToString as B,isDecorationActive as H}from"../utils/text-format.js";import{useTextFormat as P,getActiveTextEditor as V,resolveSelectionScope as _,applyToLiveEditor as G,restoreEditorSelection as J}from"../utils/text-format-state.js";const Q=u("div")`
1
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import o from"react";import{observer as n}from"mobx-react-lite";import{PolotnoIcon as i}from"../icons/registry.js";import{Button as l}from"../primitives/button.js";import{Tooltip as r,TooltipContent as a,TooltipTrigger as s}from"../primitives/tooltip.js";import{TooltipIconButton as c}from"../primitives/tooltip-icon-button.js";import{ColorPicker as m}from"./color-picker.js";import p from"./filters-picker.js";import{ElementContainer as f,extendToolbar as d}from"./element-container.js";import u from"../utils/styled.js";import{AnimationsPicker as x}from"./animations-picker.js";import{flags as g}from"../utils/flags.js";import{TextAiWrite as v}from"./text-ai-write.js";import{t as h}from"../utils/l10n.js";import{quillRef as b,createQuill as T,setQuillContent as y}from"../canvas/html-element.js";import{editorHtml as S}from"../canvas/rich-editor.js";import{FontMenu as F,fetcher as z,TextSpacing as j,TextFontSize as A,ALIGN_OPTIONS as C,VERTICAL_ALIGN_OPTIONS as N,VERTICAL_ALIGN_ICONS as w}from"./text-toolbar.js";import{cycleNext as E,usedFontFamilies as k}from"./toolbar-shared.js";import D from"swr";import{getFontsList as L,globalFonts as M,isGoogleFontChanged as P}from"../utils/fonts.js";import{getGoogleFontsListAPI as I}from"../utils/api.js";import{quillHtmlToModelText as R,listEffectiveFontFamilies as O,isBoldWeight as W}from"../utils/rich-text-html.js";import{patchTextFormat as B,decorationTokensToString as H,isDecorationActive as V}from"../utils/text-format.js";import{activeFor as _,useTextFormat as G,resolveSelectionScope as J,applyToLiveEditor as U,restoreEditorSelection as X}from"../utils/text-format-state.js";const $=u("div")`
2
2
  position: relative;
3
3
  display: inline-block;
4
4
 
@@ -15,7 +15,7 @@ import{jsx as t,jsxs as e}from"react/jsx-runtime";import o from"react";import{ob
15
15
  &:focus-within .polotno-fs-mixed-overlay {
16
16
  display: none;
17
17
  }
18
- `,U=u("span")`
18
+ `,q=u("span")`
19
19
  position: absolute;
20
20
  left: 11px;
21
21
  top: 0;
@@ -25,4 +25,4 @@ import{jsx as t,jsxs as e}from"react/jsx-runtime";import o from"react";import{ob
25
25
  pointer-events: none;
26
26
  font-size: inherit;
27
27
  color: inherit;
28
- `,X=t=>{const e=V();return!!e&&e.store===t&&!!e.instance};let $=null;const q=()=>{b.pendingToolbarInteraction=!0,$&&clearTimeout($),$=setTimeout(()=>{b.pendingToolbarInteraction=!1,$=null},100)},K=t=>{var e;(!(e=t.target)||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&"SELECT"!==e.tagName&&!e.isContentEditable)&&t.preventDefault(),q()},Y=n(({store:e,isActive:o,toggle:n,icon:i,ariaLabel:l,tooltipContent:r})=>{const{format:a,applyTextFormat:s}=P(e);return t(c,{label:r||l||"",active:o(a),onMouseDown:t=>{t.preventDefault()},onClick:()=>n(a,s),children:i})});function Z(t,e){const o="underline"===e?"line-through":"underline",n=new Set;return H(t,e)||n.add(e),H(t,o)&&n.add(o),B(n)}const tt=(t,e,o)=>e({textDecoration:Z(t,o)},{decorationTokens:[o]});export const TextBold=n(({store:e})=>t(Y,{store:e,isActive:t=>O(t.fontWeight.value),toggle:(t,e)=>e({fontWeight:O(t.fontWeight.value)?400:700}),icon:t(i,{name:"text.bold",className:"pn:size-4"}),tooltipContent:h("toolbar.bold")}));const et=n(({store:e})=>t("div",{className:"pn:flex pn:items-center pn:gap-0.5",children:t(Y,{store:e,isActive:t=>"uppercase"===t.textTransform.value,toggle:(t,e)=>e({textTransform:"uppercase"===t.textTransform.value?"none":"uppercase"}),icon:t(i,{name:"text.uppercase",className:"pn:size-4"}),tooltipContent:h("toolbar.uppercase")})}));export const FontStyleGroup=n(({element:o,store:n,elements:m,components:p})=>{const d=(null==p?void 0:p.TextBold)||TextBold;return e("div",{className:"pn:flex pn:items-center pn:gap-0.5",children:[t(d,{element:o,store:n}),t(Y,{store:n,isActive:t=>"italic"===t.fontStyle.value,toggle:(t,e)=>e({fontStyle:"italic"===t.fontStyle.value?"normal":"italic"}),icon:t(i,{name:"text.italic",className:"pn:size-4"}),tooltipContent:h("toolbar.italic")}),t(Y,{store:n,isActive:t=>H(t,"underline"),toggle:(t,e)=>tt(t,e,"underline"),icon:t(i,{name:"text.underline",className:"pn:size-4"}),tooltipContent:h("toolbar.underline")}),t(Y,{store:n,isActive:t=>H(t,"line-through"),toggle:(t,e)=>tt(t,e,"line-through"),icon:t(i,{name:"text.strikethrough",className:"pn:size-4"}),tooltipContent:h("toolbar.strikethrough")}),t(c,{label:h("toolbar.textAlign"),onClick:()=>{const t=A(C,o.align);n.history.transaction(()=>{m.forEach(e=>{e.set({align:t})})})},children:"left"===o.align?t(i,{name:"text.alignLeft",className:"pn:size-4"}):"center"===o.align?t(i,{name:"text.alignCenter",className:"pn:size-4"}):"right"===o.align?t(i,{name:"text.alignRight",className:"pn:size-4"}):t(i,{name:"text.alignJustify",className:"pn:size-4"})}),g.textVerticalResizeEnabled&&e(r,{children:[t(s,{render:t(l,{variant:"ghost",size:"icon-sm",onClick:()=>{const t=A(N,o.verticalAlign);n.history.transaction(()=>{o.set({verticalAlign:t})})},"aria-label":h("toolbar.verticalAlign"),children:w[o.verticalAlign]})}),t(a,{children:h("toolbar.verticalAlign")})]}),t(c,{label:h("toolbar.listFormat"),onMouseDown:t=>{t.preventDefault()},onClick:()=>{var t;let e=window.__polotnoQuill;const n=!e;e=e||(({html:t})=>{const e=document.createElement("div");document.body.appendChild(e),e.style.display="none",e.style.whiteSpace="pre-wrap";const o=T(e);return y(o,t),o})({html:o.text}),n&&e.setSelection(0,e.getLength(),"api");const i=e.getSelection(!0)||(null===(t=V())||void 0===t?void 0:t.lastSelection)||{index:0,length:e.getLength()},l=e.getFormat(i);l.list?"bullet"===l.list?e.format("list","ordered"):e.format("list",!1):e.format("list","bullet"),n&&(o.set({text:M(e.root.innerHTML,{fontSize:o.fontSize,fontFamily:o.fontFamily})}),(t=>{t.root.parentElement.remove()})(e))},children:(()=>{const e=V();return"bullet"===(e&&e.store===n?e.currentFormat:{}).list?t(i,{name:"text.numberedList",className:"pn:size-5"}):t(i,{name:"text.bulletList",className:"pn:size-5"})})()})]})});export const FontColorInput=n(({element:e,store:o})=>{var n;const{format:i,applyTextFormat:l}=P(o);return t("div",{"data-polotno-keep-focus":!0,onMouseDown:K,children:t(m,{value:null!==(n=i.fill.value)&&void 0!==n?n:e.fill,gradientEnabled:!0,onClose:()=>{const t=V();(null==t?void 0:t.instance)&&t.lastSelection&&J(t.instance,t.lastSelection)},onChange:t=>l({fill:t}),store:o})})});export const DirectionInput=n(({element:e})=>{const o="rtl"===e.dir,n=h("toolbar.textDirection");return t(c,{label:n,onClick:()=>{e.set({dir:o?"ltr":"rtl"})},children:t(i,o?{name:"text.paragraph",className:"pn:size-5 pn:-scale-x-100"}:{name:"text.richText",className:"pn:size-5"})})});const ot=E(),nt={TextFontFamily:n(({elements:e,store:n})=>{var i;const{format:l,applyTextFormat:r}=P(n),a=X(n),s=l.fontFamily.mixed,c=s?Array.from(new Set(e.flatMap(t=>R(t.text,t.fontFamily)))).sort((t,e)=>t.localeCompare(e,void 0,{sensitivity:"base"})):void 0,[m,p]=o.useState(!1),{data:d,mutate:f}=k(m?I():null,S,{isPaused:()=>L(),fallbackData:[]});o.useEffect(()=>{f()},[L()]);const u=n.fonts.concat(D).map(t=>t.fontFamily).concat((null==d?void 0:d.length)&&!L()?d:ot),x=[];n.find(t=>("text"===t.type&&x.push(t.fontFamily),!1));const g=[...new Set(x.concat("_divider").concat(u))],v=null!==(i=l.fontFamily.value)&&void 0!==i?i:e[0].fontFamily;let h=v;h.length>15&&(h=h.slice(0,15)+"...");const b=t(F,{fonts:g,activeFont:v,activeFontLabel:h,store:n,mixed:s,mixedFonts:c,open:m,onOpenChange:p,onFontSelect:t=>r({fontFamily:t})});return a?t("div",{"data-polotno-keep-focus":!0,onMouseDown:K,children:b}):b}),TextFontSize:n(({elements:o,store:n})=>{const{format:i}=P(n),l=X(n),r=i.fontSize.mixed,a=i.fontSize.value,s=o.map(t=>new Proxy(t,{get:(t,e)=>"fontSize"===e?null!=a?a:t.fontSize:"set"===e?e=>((t,e)=>{if(!e.fontSize){return void t.set(e)}const o=V();if(o&&o.store===n&&o.instance){const{scope:t,isEmpty:n}=_(o.instance,o.lastSelection);if("partial"===t||"collapsed"===t&&n){return void G(o.instance,{fontSize:e.fontSize},o.lastSelection)}}const{attrsToSet:i}=W(t,{fontSize:e.fontSize});t.set(Object.assign(Object.assign({},e),i))})(t,e):Reflect.get(t,e)})),c=e(Q,{className:r?"polotno-mixed":"",children:[t(j,{elements:s,store:n}),r&&t(U,{className:"polotno-fs-mixed-overlay","aria-hidden":!0,children:"—"})]});return l?t("div",{"data-polotno-keep-focus":!0,onMouseDown:q,children:c}):c}),TextFontVariant:FontStyleGroup,TextTransform:et,TextFilters:p,TextFill:FontColorInput,TextSpacing:z,TextDirection:DirectionInput,TextAnimations:x,TextAiWrite:v};export const HtmlToolbar=n(({store:e,components:o})=>{const n=e.selectedElements,i=e.selectedElements[0],l=["TextFill","TextFontFamily","TextFontSize","TextFontVariant","TextSpacing","TextTransform","TextFilters",g.animationsEnabled&&"TextAnimations",g.aiTextEnabled&&"TextAiWrite"],r=f({type:"text",usedItems:l,components:o});return t(d,{items:r,itemRender:l=>{if("TextBold"===l){return null}const r=(null==o?void 0:o[l])||nt[l];return t(r,{element:i,elements:n,store:e,components:o},l)}})});
28
+ `;let K=null;const Q=()=>{b.pendingToolbarInteraction=!0,K&&clearTimeout(K),K=setTimeout(()=>{b.pendingToolbarInteraction=!1,K=null},100)},Y=t=>{var e;(!(e=t.target)||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&"SELECT"!==e.tagName&&!e.isContentEditable)&&t.preventDefault(),Q()},Z=n(({store:e,isActive:o,toggle:n,icon:i,ariaLabel:l,tooltipContent:r})=>{const{format:a,applyTextFormat:s}=G(e);return t(c,{label:r||l||"",active:o(a),onMouseDown:t=>{t.preventDefault()},onClick:()=>n(a,s),children:i})});function tt(t,e){const o="underline"===e?"line-through":"underline",n=new Set;return V(t,e)||n.add(e),V(t,o)&&n.add(o),H(n)}const et=(t,e,o)=>e({textDecoration:tt(t,o)},{decorationTokens:[o]});export const TextBold=n(({store:e})=>t(Z,{store:e,isActive:t=>W(t.fontWeight.value),toggle:(t,e)=>e({fontWeight:W(t.fontWeight.value)?400:700}),icon:t(i,{name:"text.bold",className:"pn:size-4"}),tooltipContent:h("toolbar.bold")}));const ot=n(({store:e})=>t("div",{className:"pn:flex pn:items-center pn:gap-0.5",children:t(Z,{store:e,isActive:t=>"uppercase"===t.textTransform.value,toggle:(t,e)=>e({textTransform:"uppercase"===t.textTransform.value?"none":"uppercase"}),icon:t(i,{name:"text.uppercase",className:"pn:size-4"}),tooltipContent:h("toolbar.uppercase")})}));export const FontStyleGroup=n(({element:o,store:n,elements:m,components:p})=>{const f=(null==p?void 0:p.TextBold)||TextBold;return e("div",{className:"pn:flex pn:items-center pn:gap-0.5",children:[t(f,{element:o,store:n}),t(Z,{store:n,isActive:t=>"italic"===t.fontStyle.value,toggle:(t,e)=>e({fontStyle:"italic"===t.fontStyle.value?"normal":"italic"}),icon:t(i,{name:"text.italic",className:"pn:size-4"}),tooltipContent:h("toolbar.italic")}),t(Z,{store:n,isActive:t=>V(t,"underline"),toggle:(t,e)=>et(t,e,"underline"),icon:t(i,{name:"text.underline",className:"pn:size-4"}),tooltipContent:h("toolbar.underline")}),t(Z,{store:n,isActive:t=>V(t,"line-through"),toggle:(t,e)=>et(t,e,"line-through"),icon:t(i,{name:"text.strikethrough",className:"pn:size-4"}),tooltipContent:h("toolbar.strikethrough")}),t(c,{label:h("toolbar.textAlign"),onClick:()=>{const t=E(C,o.align);n.history.transaction(()=>{m.forEach(e=>{e.set({align:t})})})},children:"left"===o.align?t(i,{name:"text.alignLeft",className:"pn:size-4"}):"center"===o.align?t(i,{name:"text.alignCenter",className:"pn:size-4"}):"right"===o.align?t(i,{name:"text.alignRight",className:"pn:size-4"}):t(i,{name:"text.alignJustify",className:"pn:size-4"})}),g.textVerticalResizeEnabled&&e(r,{children:[t(s,{render:t(l,{variant:"ghost",size:"icon-sm",onClick:()=>{const t=E(N,o.verticalAlign);n.history.transaction(()=>{m.forEach(e=>{e.set({verticalAlign:t})})})},"aria-label":h("toolbar.verticalAlign"),children:w[o.verticalAlign]})}),t(a,{children:h("toolbar.verticalAlign")})]}),t(c,{label:h("toolbar.listFormat"),onMouseDown:t=>{t.preventDefault()},onClick:()=>{const t=t=>t?"bullet"===t&&"ordered":"bullet",e=_(n);if(e){const o=e.instance,n=o.getSelection(!0)||e.lastSelection||{index:0,length:o.getLength()};return void o.format("list",t(o.getFormat(n).list))}const o=(({html:t})=>{const e=document.createElement("div");document.body.appendChild(e),e.style.display="none",e.style.whiteSpace="pre-wrap";const o=T(e);return y(o,t),o})({html:S(m[0])});try{const e=t(o.getFormat(0,o.getLength()).list);n.history.transaction(()=>{m.forEach((t,n)=>{n>0&&y(o,S(t)),o.formatLine(0,o.getLength(),"list",e),t.set({text:R(o.root.innerHTML,{fontSize:t.fontSize,fontFamily:t.fontFamily})})})})}finally{(t=>{t.root.parentElement.remove()})(o)}},children:"bullet"===(null!==(u=null===(d=_(n))||void 0===d?void 0:d.currentFormat)&&void 0!==u?u:{}).list?t(i,{name:"text.numberedList",className:"pn:size-5"}):t(i,{name:"text.bulletList",className:"pn:size-5"})})]});var d,u});export const FontColorInput=n(({element:e,store:o})=>{var n;const{format:i,applyTextFormat:l}=G(o);return t("div",{"data-polotno-keep-focus":!0,onMouseDown:Y,children:t(m,{value:null!==(n=i.fill.value)&&void 0!==n?n:e.fill,gradientEnabled:!0,onClose:()=>{const t=_(o);(null==t?void 0:t.lastSelection)&&X(t.instance,t.lastSelection)},onChange:t=>l({fill:t}),store:o})})});export const DirectionInput=n(({element:e})=>{const o="rtl"===e.dir,n=h("toolbar.textDirection");return t(c,{label:n,onClick:()=>{e.set({dir:o?"ltr":"rtl"})},children:t(i,o?{name:"text.paragraph",className:"pn:size-5 pn:-scale-x-100"}:{name:"text.richText",className:"pn:size-5"})})});const nt=L(),it=n(({elements:e,store:n})=>{var i;const{format:l,applyTextFormat:r}=G(n),a=!!_(n),s=l.fontFamily.mixed,c=s?Array.from(new Set(e.flatMap(t=>O(t.text,t.fontFamily)))).sort((t,e)=>t.localeCompare(e,void 0,{sensitivity:"base"})):void 0,[m,p]=o.useState(!1),{data:f,mutate:d}=D(m?I():null,z,{isPaused:()=>P(),fallbackData:[]});o.useEffect(()=>{d()},[P()]);const u=n.fonts.concat(M).map(t=>t.fontFamily).concat((null==f?void 0:f.length)&&!P()?f:nt),x=k(n),g=[...new Set(x.concat("_divider").concat(u))],v=null!==(i=l.fontFamily.value)&&void 0!==i?i:e[0].fontFamily;let h=v;h.length>15&&(h=h.slice(0,15)+"...");const b=t(F,{fonts:g,activeFont:v,activeFontLabel:h,store:n,mixed:s,mixedFonts:c,open:m,onOpenChange:p,onFontSelect:t=>r({fontFamily:t})});return a?t("div",{"data-polotno-keep-focus":!0,onMouseDown:Y,children:b}):b}),lt=n(({elements:o,store:n})=>{const{format:i}=G(n),l=!!_(n),r=i.fontSize.mixed,a=i.fontSize.value,s=o.map(t=>new Proxy(t,{get:(t,e)=>"fontSize"===e?null!=a?a:t.fontSize:"set"===e?e=>((t,e)=>{if(!e.fontSize){return void t.set(e)}const o=_(n);if(o){const{scope:t,isEmpty:n}=J(o.instance,o.lastSelection);if("partial"===t||"collapsed"===t&&n){return void U(o.instance,{fontSize:e.fontSize},o.lastSelection)}}const{attrsToSet:i}=B(t,{fontSize:e.fontSize});t.set(Object.assign(Object.assign({},e),i))})(t,e):Reflect.get(t,e)})),c=e($,{className:r?"polotno-mixed":"",children:[t(A,{elements:s,store:n}),r&&t(q,{className:"polotno-fs-mixed-overlay","aria-hidden":!0,children:"—"})]});return l?t("div",{"data-polotno-keep-focus":!0,onMouseDown:Q,children:c}):c});export const PROPS_MAP={TextFontFamily:it,TextFontSize:lt,TextFontVariant:FontStyleGroup,TextTransform:ot,TextFilters:p,TextFill:FontColorInput,TextSpacing:j,TextDirection:DirectionInput,TextAnimations:x,TextAiWrite:v};export const HtmlToolbar=n(({store:e,components:o})=>{const n=e.selectedElements,i=e.selectedElements[0],l=["TextFill","TextFontFamily","TextFontSize","TextFontVariant","TextSpacing","TextTransform","TextFilters",g.animationsEnabled&&"TextAnimations",g.aiTextEnabled&&"TextAiWrite"],r=d({type:"text",usedItems:l,components:o});return t(f,{items:r,itemRender:l=>{if("TextBold"===l){return null}const r=(null==o?void 0:o[l])||PROPS_MAP[l];return t(r,{element:i,elements:n,store:e,components:o},l)}})});
@@ -1 +1 @@
1
- import{jsx as r,jsxs as e,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{observer as t}from"mobx-react-lite";import{Button as i}from"../primitives/button.js";import{Spinner as s}from"../primitives/spinner.js";import{Dialog as l,DialogContent as c,DialogFooter as a,DialogHeader as m,DialogTitle as u}from"../primitives/dialog.js";import{getRemoveBackgroundFunc as d}from"../utils/api.js";export{setRemoveBackgroundFunc}from"../utils/api.js";import{t as p}from"../utils/l10n.js";export const RemoveBackgroundDialog=t(({isOpen:t,onClose:g,element:v})=>{const[h,f]=o.useState(v.src),b=o.useRef(null);o.useEffect(()=>(f(v.src),()=>{var r;null===(r=b.current)||void 0===r||r.abort(),b.current=null}),[v.src]);const[k,x]=o.useState(!1),j=o.useRef(void 0),B=()=>{var r;null===(r=b.current)||void 0===r||r.abort()},y=h!==v.src;return r(l,{open:t,onOpenChange:r=>{r||(B(),g())},children:e(c,{className:"pn:w-[80%] pn:max-w-[700px]",children:[r(m,{children:r(u,{children:p("toolbar.removeBackgroundTitle")})}),r("div",{children:r("img",{crossOrigin:"anonymous",src:h,style:{width:"100%",maxHeight:"400px",objectFit:"contain"}})}),e(a,{className:"pn:relative",children:[!y&&e(n,{children:[k&&r(i,{variant:"outline",onClick:B,children:p("toolbar.cancelRemoveBackground")}),e(i,{onClick:async()=>{const r=new AbortController;b.current=r,x(!0);try{const e=await d()(v.src,r.signal,{src:v.src,signal:r.signal});r.signal.aborted||(j.current="string"==typeof e?void 0:e.apply,f("string"==typeof e?e:e.src))}catch(e){"AbortError"!==(null==e?void 0:e.name)&&console.error(e)}finally{b.current===r&&(b.current=null),x(!1)}},disabled:k,children:[k&&r(s,{className:"pn:mr-2"}),p("toolbar.removeBackground")]})]}),y&&e(n,{children:[e(i,{variant:"outline",onClick:()=>{f(v.src),g()},disabled:k,children:[k&&r(s,{className:"pn:mr-2"}),p("toolbar.cancelRemoveBackground")]}),e(i,{onClick:()=>{const r=()=>v.set({src:h}),e=j.current;e?e({element:v,src:h,selection:null,applyDefault:r}):r(),g()},disabled:k,children:[k&&r(s,{className:"pn:mr-2"}),p("toolbar.confirmRemoveBackground")]})]})]})]})})});export const ImageRemoveBackground=({element:t})=>{const[s,l]=o.useState(!1);return e(n,{children:[r(i,{variant:"ghost",size:"sm",onClick:()=>{l(!0)},children:p("toolbar.removeBackground")}),r(RemoveBackgroundDialog,{isOpen:s,onClose:()=>{l(!1)},element:t})]})};
1
+ import{Fragment as r,jsx as e,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{observer as t}from"mobx-react-lite";import{Button as i}from"../primitives/button.js";import{Spinner as s}from"../primitives/spinner.js";import{Dialog as l,DialogContent as c,DialogFooter as a,DialogHeader as m,DialogTitle as u}from"../primitives/dialog.js";import{getRemoveBackgroundFunc as d}from"../utils/api.js";export{setRemoveBackgroundFunc}from"../utils/api.js";import{t as p}from"../utils/l10n.js";export const RemoveBackgroundDialog=t(({isOpen:t,onClose:g,element:v})=>{const[h,f]=o.useState(v.src),b=o.useRef(null);o.useEffect(()=>(f(v.src),()=>{var r;null===(r=b.current)||void 0===r||r.abort(),b.current=null}),[v.src]);const[k,x]=o.useState(!1),j=o.useRef(void 0),B=()=>{var r;null===(r=b.current)||void 0===r||r.abort()},y=h!==v.src;return e(l,{open:t,onOpenChange:r=>{r||(B(),g())},children:n(c,{className:"pn:w-[80%] pn:max-w-[700px]",children:[e(m,{children:e(u,{children:p("toolbar.removeBackgroundTitle")})}),e("div",{children:e("img",{crossOrigin:"anonymous",src:h,style:{width:"100%",maxHeight:"400px",objectFit:"contain"}})}),n(a,{className:"pn:relative",children:[!y&&n(r,{children:[k&&e(i,{variant:"outline",onClick:B,children:p("toolbar.cancelRemoveBackground")}),n(i,{onClick:async()=>{const r=new AbortController;b.current=r,x(!0);try{const e=await d()(v.src,r.signal,{src:v.src,signal:r.signal});r.signal.aborted||(j.current="string"==typeof e?void 0:e.apply,f("string"==typeof e?e:e.src))}catch(e){"AbortError"!==(null==e?void 0:e.name)&&console.error(e)}finally{b.current===r&&(b.current=null),x(!1)}},disabled:k,children:[k&&e(s,{className:"pn:mr-2"}),p("toolbar.removeBackground")]})]}),y&&n(r,{children:[n(i,{variant:"outline",onClick:()=>{f(v.src),g()},disabled:k,children:[k&&e(s,{className:"pn:mr-2"}),p("toolbar.cancelRemoveBackground")]}),n(i,{onClick:()=>{const r=()=>v.set({src:h}),e=j.current;e?e({element:v,src:h,selection:null,applyDefault:r}):r(),g()},disabled:k,children:[k&&e(s,{className:"pn:mr-2"}),p("toolbar.confirmRemoveBackground")]})]})]})]})})});export const ImageRemoveBackground=({element:t})=>{const[s,l]=o.useState(!1);return n(r,{children:[e(i,{variant:"ghost",size:"sm",onClick:()=>{l(!0)},children:p("toolbar.removeBackground")}),e(RemoveBackgroundDialog,{isOpen:s,onClose:()=>{l(!1)},element:t})]})};
@@ -15,7 +15,7 @@ export { TextToolbar, TextFill, TextFontFamily, TextFontSize, TextFontVariant, T
15
15
  export { NumberInput, FiltersPicker, EffectsPicker } from './filters-picker.js';
16
16
  export { AnimationsPicker, AnimationsPickerOld } from './animations-picker.js';
17
17
  export { FigureToolbar, FigureFill, FigureSettings, FigureStroke, } from './figure-toolbar.js';
18
- export { GifToolbar } from './gif-toolbar.js';
18
+ export { GifToolbar, LottieToolbar } from './gif-toolbar.js';
19
19
  export { PageToolbar } from './page-toolbar.js';
20
20
  export { ManyToolbar } from './many-toolbar.js';
21
21
  export { SvgToolbar } from './svg-toolbar.js';
package/toolbar/index.js CHANGED
@@ -1 +1 @@
1
- export{Toolbar,registerToolbarComponent,useToolbarCondensed}from"./toolbar.js";export{HistoryButtons}from"./history-buttons.js";export{ColorPicker,DEFAULT_COLORS,setColorsPresetFunc,getUsedColors}from"./color-picker.js";export{OpacityPicker}from"./opacity-picker.js";export{PositionPicker}from"./position-picker.js";export{LockButton}from"./lock-button.js";export{DuplicateButton}from"./duplicate-button.js";export{RemoveButton}from"./remove-button.js";export{GroupButton}from"./group-button.js";export{FlipButton}from"./flip-button.js";export{DownloadButton}from"./download-button.js";export{ZoomButtons,ZoomGroup}from"./zoom-buttons.js";export{ElementContainer,extendToolbar}from"./element-container.js";export{TextToolbar,TextFill,TextFontFamily,TextFontSize,TextFontVariant,TextSpacing,TextTransform,TextFilters}from"./text-toolbar.js";export{NumberInput,FiltersPicker,EffectsPicker}from"./filters-picker.js";export{AnimationsPicker,AnimationsPickerOld}from"./animations-picker.js";export{FigureToolbar,FigureFill,FigureSettings,FigureStroke}from"./figure-toolbar.js";export{GifToolbar}from"./gif-toolbar.js";export{PageToolbar}from"./page-toolbar.js";export{ManyToolbar}from"./many-toolbar.js";export{SvgToolbar}from"./svg-toolbar.js";export{ImageToolbar,ImageRemoveBackground}from"./image-toolbar.js";export{VideoToolbar}from"./video-toolbar.js";export{LineToolbar,LineSettings,LineColor,BasicHead,LineHeads}from"./line-toolbar.js";export{TableToolbar,TableBorderSettings,TableStructureMenu,TableStructure,CellPadding,CellBackground,CellVerticalAlign}from"./table-toolbar.js";export{HtmlToolbar,TextBold,FontStyleGroup,FontColorInput,DirectionInput}from"./html-toolbar.js";export{TextAiWrite}from"./text-ai-write.js";export{default as Sketch}from"./sketch.js";export{AdminButton}from"./admin-button.js";export{CopyStyleButton,PAINT_ICON}from"./copy-style.js";export{useLock}from"./use-lock.js";export{useDuplicateElement}from"./use-duplicate-element.js";export{useRemoveElement}from"./use-remove-element.js";export{useCopyStyle}from"./use-copy-style.js";
1
+ export{Toolbar,registerToolbarComponent,useToolbarCondensed}from"./toolbar.js";export{HistoryButtons}from"./history-buttons.js";export{ColorPicker,DEFAULT_COLORS,setColorsPresetFunc,getUsedColors}from"./color-picker.js";export{OpacityPicker}from"./opacity-picker.js";export{PositionPicker}from"./position-picker.js";export{LockButton}from"./lock-button.js";export{DuplicateButton}from"./duplicate-button.js";export{RemoveButton}from"./remove-button.js";export{GroupButton}from"./group-button.js";export{FlipButton}from"./flip-button.js";export{DownloadButton}from"./download-button.js";export{ZoomButtons,ZoomGroup}from"./zoom-buttons.js";export{ElementContainer,extendToolbar}from"./element-container.js";export{TextToolbar,TextFill,TextFontFamily,TextFontSize,TextFontVariant,TextSpacing,TextTransform,TextFilters}from"./text-toolbar.js";export{NumberInput,FiltersPicker,EffectsPicker}from"./filters-picker.js";export{AnimationsPicker,AnimationsPickerOld}from"./animations-picker.js";export{FigureToolbar,FigureFill,FigureSettings,FigureStroke}from"./figure-toolbar.js";export{GifToolbar,LottieToolbar}from"./gif-toolbar.js";export{PageToolbar}from"./page-toolbar.js";export{ManyToolbar}from"./many-toolbar.js";export{SvgToolbar}from"./svg-toolbar.js";export{ImageToolbar,ImageRemoveBackground}from"./image-toolbar.js";export{VideoToolbar}from"./video-toolbar.js";export{LineToolbar,LineSettings,LineColor,BasicHead,LineHeads}from"./line-toolbar.js";export{TableToolbar,TableBorderSettings,TableStructureMenu,TableStructure,CellPadding,CellBackground,CellVerticalAlign}from"./table-toolbar.js";export{HtmlToolbar,TextBold,FontStyleGroup,FontColorInput,DirectionInput}from"./html-toolbar.js";export{TextAiWrite}from"./text-ai-write.js";export{default as Sketch}from"./sketch.js";export{AdminButton}from"./admin-button.js";export{CopyStyleButton,PAINT_ICON}from"./copy-style.js";export{useLock}from"./use-lock.js";export{useDuplicateElement}from"./use-duplicate-element.js";export{useRemoveElement}from"./use-remove-element.js";export{useCopyStyle}from"./use-copy-style.js";
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{observer as n}from"mobx-react-lite";import{PolotnoIcon as i}from"../icons/registry.js";import{Button as o}from"../primitives/button.js";import{SliderField as s}from"../primitives/slider-field.js";import{Popover as a,PopoverContent as l,PopoverTrigger as d}from"../primitives/popover.js";import{Tooltip as c,TooltipContent as p,TooltipTrigger as h}from"../primitives/tooltip.js";import{cn as m}from"../lib/utils.js";import{ColorPicker as u}from"./color-picker.js";import{AnimationsPicker as L}from"./animations-picker.js";import{DashStyleButton as g,DASH_ICONS as k}from"./toolbar-shared.js";import{ElementContainer as f,extendToolbar as w}from"./element-container.js";import{getMiddlePoints as v,getLinePositionFromMiddlePoints as x}from"../canvas/line-element.js";import{t as j}from"../utils/l10n.js";import{flags as C}from"../utils/flags.js";export const LineSettings=n(({store:t,elements:n})=>{const m=e=>{t.history.transaction(()=>{n.forEach(r=>{r.set(e)})})};return r(a,{children:[r(c,{children:[e(h,{render:e(d,{render:e(o,{variant:"ghost",size:"icon-sm","aria-label":j("toolbar.lineStyle"),children:e(i,{name:"action.settings",className:"pn:size-4"})})})}),e(p,{children:j("toolbar.lineStyle")})]}),r(l,{className:"pn:w-[230px] pn:p-4",align:"start",children:[e(s,{label:j("toolbar.lineSize"),value:n[0].height,onChange:e=>{(e=>{t.history.transaction(()=>{n.forEach(r=>{const{middleLeft:t,middleRight:n}=v(r),{x:i,y:o,rotation:s}=x(t,n,e);r.set({x:i,y:o,rotation:s,height:e})})})})(e)},min:1,max:100}),r("div",{className:"pn:flex pn:items-center pn:justify-between pn:pt-4 pn:pb-1",children:[e(g,{active:0===n[0].dash.length,onClick:()=>{m({dash:[]})},icon:e(k.solid,{})}),e(g,{active:4===n[0].dash[0],onClick:()=>{m({dash:[4,1]})},icon:e(k.large,{})}),e(g,{active:2===n[0].dash[0],onClick:()=>{m({dash:[2,1]})},icon:e(k.medium,{})}),e(g,{active:1===n[0].dash[0],onClick:()=>{m({dash:[1,1]})},icon:e(k.small,{})})]})]})]})});export const LineColor=n(({elements:r,store:t})=>e(u,{value:r[0].color,gradientEnabled:!1,onChange:e=>t.history.transaction(()=>{r.forEach(r=>{r.set({color:e})})}),store:t}));const y={"":e("span",{"aria-hidden":"true",className:"pn:inline-flex",children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 16 8"})})}),arrow:e("span",{"aria-hidden":"true",className:"pn:inline-flex",children:r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 8 3 L 1 8 L 8 13",fill:"none",strokeLinejoin:"round",strokeLinecap:"round"}),e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})}),triangle:e("span",{"aria-hidden":"true",className:"pn:inline-flex",children:r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 8 3 L 1 8 L 8 13 Z",fill:"currentColor",strokeLinejoin:"round",strokeLinecap:"round"}),e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})}),bar:e("span",{"aria-hidden":"true",className:"pn:inline-flex",children:r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 3 L 1 13",strokeLinejoin:"round",strokeLinecap:"round"}),e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})}),square:e("span",{"aria-hidden":"true",className:"pn:inline-flex",children:r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 4 L 9 4 L 9 12 L 1 12 Z",fill:"currentColor",strokeLinejoin:"round",strokeLinecap:"round"}),e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})}),circle:e("span",{"aria-hidden":"true",className:"pn:inline-flex",children:r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[e("circle",{cx:"4",cy:"8",r:"4",fill:"currentColor"}),e("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})})},b=({type:r,active:t,onClick:n,flipped:i})=>{const s=y[r];return e(o,{variant:"ghost",size:"icon-sm",onClick:n,className:m(t&&"pn:bg-muted"),children:i?e("span",{style:{transform:"scaleX(-1)",display:"inline-flex"},children:s}):s})};export const BasicHead=n(({elements:t,store:n,property:i})=>{const s="endHead"===i,m=y[t[0][i]],u=s?e("span",{style:{transform:"scaleX(-1)",display:"inline-flex"},children:m}):m,L=e=>{n.history.transaction(()=>{t.forEach(r=>{r.set({[i]:e})})})},g=j("startHead"===i?"toolbar.lineStartHead":"toolbar.lineEndHead");return r(a,{children:[r(c,{children:[e(h,{render:e(d,{render:e(o,{variant:"ghost",size:"icon-sm","aria-label":g,children:u})})}),e(p,{children:g})]}),r(l,{className:"pn:w-[150px] pn:p-2.5",align:"start",children:[e("div",{className:"pn:flex pn:items-center pn:justify-between",children:["","arrow","triangle"].map(r=>e(b,{type:r,active:t[0][i]===r,onClick:()=>{L(r)},flipped:s},r))}),e("div",{className:"pn:flex pn:items-center pn:justify-between",children:["bar","square","circle"].map(r=>e(b,{type:r,active:t[0][i]===r,onClick:()=>{L(r)},flipped:s},r))})]})]})});export const LineHeads=n(({elements:n,store:i})=>r(t,{children:[e(BasicHead,{elements:n,store:i,property:"startHead"}),e(BasicHead,{elements:n,store:i,property:"endHead"})]}));const H={LineSettings,LineColor,LineHeads,LineAnimations:L};export const LineToolbar=n(({store:r,components:t})=>{const n=r.selectedElements[0],i=["LineColor","LineSettings","LineHeads",C.animationsEnabled&&"LineAnimations"].filter(e=>Boolean(e)),o=w({type:"line",usedItems:i,components:t});return e(f,{items:o,itemRender:i=>{const o=t[i]||H[i];return e(o,{element:n,store:r,elements:r.selectedElements},i)}})});export default LineToolbar;
1
+ import{Fragment as e,jsx as r,jsxs as t}from"react/jsx-runtime";import{observer as n}from"mobx-react-lite";import{PolotnoIcon as i}from"../icons/registry.js";import{Button as o}from"../primitives/button.js";import{SliderField as s}from"../primitives/slider-field.js";import{Popover as a,PopoverContent as l,PopoverTrigger as d}from"../primitives/popover.js";import{Tooltip as c,TooltipContent as p,TooltipTrigger as h}from"../primitives/tooltip.js";import{cn as m}from"../lib/utils.js";import{ColorPicker as u}from"./color-picker.js";import{AnimationsPicker as L}from"./animations-picker.js";import{DashStyleButton as g,DASH_ICONS as k}from"./toolbar-shared.js";import{ElementContainer as f,extendToolbar as w}from"./element-container.js";import{getMiddlePoints as v,getLinePositionFromMiddlePoints as x}from"../canvas/line-element.js";import{t as j}from"../utils/l10n.js";import{flags as C}from"../utils/flags.js";export const LineSettings=n(({store:e,elements:n})=>{const m=r=>{e.history.transaction(()=>{n.forEach(e=>{e.set(r)})})};return t(a,{children:[t(c,{children:[r(h,{render:r(d,{render:r(o,{variant:"ghost",size:"icon-sm","aria-label":j("toolbar.lineStyle"),children:r(i,{name:"action.settings",className:"pn:size-4"})})})}),r(p,{children:j("toolbar.lineStyle")})]}),t(l,{className:"pn:w-[230px] pn:p-4",align:"start",children:[r(s,{label:j("toolbar.lineSize"),value:n[0].height,onChange:r=>{(r=>{e.history.transaction(()=>{n.forEach(e=>{const{middleLeft:t,middleRight:n}=v(e),{x:i,y:o,rotation:s}=x(t,n,r);e.set({x:i,y:o,rotation:s,height:r})})})})(r)},min:1,max:100}),t("div",{className:"pn:flex pn:items-center pn:justify-between pn:pt-4 pn:pb-1",children:[r(g,{active:0===n[0].dash.length,onClick:()=>{m({dash:[]})},icon:r(k.solid,{})}),r(g,{active:4===n[0].dash[0],onClick:()=>{m({dash:[4,1]})},icon:r(k.large,{})}),r(g,{active:2===n[0].dash[0],onClick:()=>{m({dash:[2,1]})},icon:r(k.medium,{})}),r(g,{active:1===n[0].dash[0],onClick:()=>{m({dash:[1,1]})},icon:r(k.small,{})})]})]})]})});export const LineColor=n(({elements:e,store:t})=>r(u,{value:e[0].color,gradientEnabled:!1,onChange:r=>t.history.transaction(()=>{e.forEach(e=>{e.set({color:r})})}),store:t}));const y={"":r("span",{"aria-hidden":"true",className:"pn:inline-flex",children:r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 16 8"})})}),arrow:r("span",{"aria-hidden":"true",className:"pn:inline-flex",children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 8 3 L 1 8 L 8 13",fill:"none",strokeLinejoin:"round",strokeLinecap:"round"}),r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})}),triangle:r("span",{"aria-hidden":"true",className:"pn:inline-flex",children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 8 3 L 1 8 L 8 13 Z",fill:"currentColor",strokeLinejoin:"round",strokeLinecap:"round"}),r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})}),bar:r("span",{"aria-hidden":"true",className:"pn:inline-flex",children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 3 L 1 13",strokeLinejoin:"round",strokeLinecap:"round"}),r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})}),square:r("span",{"aria-hidden":"true",className:"pn:inline-flex",children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 4 L 9 4 L 9 12 L 1 12 Z",fill:"currentColor",strokeLinejoin:"round",strokeLinecap:"round"}),r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})}),circle:r("span",{"aria-hidden":"true",className:"pn:inline-flex",children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[r("circle",{cx:"4",cy:"8",r:"4",fill:"currentColor"}),r("path",{stroke:"currentColor",strokeWidth:"2",d:"M 1 8 L 15 8",strokeLinejoin:"round",strokeLinecap:"round"})]})})},b=({type:e,active:t,onClick:n,flipped:i})=>{const s=y[e];return r(o,{variant:"ghost",size:"icon-sm",onClick:n,className:m(t&&"pn:bg-muted"),children:i?r("span",{style:{transform:"scaleX(-1)",display:"inline-flex"},children:s}):s})};export const BasicHead=n(({elements:e,store:n,property:i})=>{const s="endHead"===i,m=y[e[0][i]],u=s?r("span",{style:{transform:"scaleX(-1)",display:"inline-flex"},children:m}):m,L=r=>{n.history.transaction(()=>{e.forEach(e=>{e.set({[i]:r})})})},g=j("startHead"===i?"toolbar.lineStartHead":"toolbar.lineEndHead");return t(a,{children:[t(c,{children:[r(h,{render:r(d,{render:r(o,{variant:"ghost",size:"icon-sm","aria-label":g,children:u})})}),r(p,{children:g})]}),t(l,{className:"pn:w-[150px] pn:p-2.5",align:"start",children:[r("div",{className:"pn:flex pn:items-center pn:justify-between",children:["","arrow","triangle"].map(t=>r(b,{type:t,active:e[0][i]===t,onClick:()=>{L(t)},flipped:s},t))}),r("div",{className:"pn:flex pn:items-center pn:justify-between",children:["bar","square","circle"].map(t=>r(b,{type:t,active:e[0][i]===t,onClick:()=>{L(t)},flipped:s},t))})]})]})});export const LineHeads=n(({elements:n,store:i})=>t(e,{children:[r(BasicHead,{elements:n,store:i,property:"startHead"}),r(BasicHead,{elements:n,store:i,property:"endHead"})]}));const H={LineSettings,LineColor,LineHeads,LineAnimations:L};export const LineToolbar=n(({store:e,components:t})=>{const n=e.selectedElements[0],i=["LineColor","LineSettings","LineHeads",C.animationsEnabled&&"LineAnimations"].filter(e=>Boolean(e)),o=w({type:"line",usedItems:i,components:t});return r(f,{items:o,itemRender:i=>{const o=t[i]||H[i];return r(o,{element:n,store:e,elements:e.selectedElements},i)}})});export default LineToolbar;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{observer as o}from"mobx-react-lite";import{PolotnoIcon as i}from"../icons/registry.js";import{Button as l}from"../primitives/button.js";import{Popover as s,PopoverContent as a,PopoverTrigger as r}from"../primitives/popover.js";import{t as c}from"../utils/l10n.js";import{alignBottom as d,alignCenter as p,alignLeft as m,alignMiddle as h,alignRight as v,alignTop as b,getBoundingBox as g,setElementPosition as x}from"../utils/alignment.js";import{SelectionSize as u}from"./selection-size.js";const f=({icon:n,text:o,disabled:i,onClick:l})=>t("button",{type:"button",disabled:i,onClick:l,className:"pn:flex pn:w-full pn:appearance-none pn:cursor-pointer pn:items-center pn:gap-2 pn:rounded-none pn:border-0 pn:bg-transparent pn:px-[7px] pn:py-[5px] pn:text-left pn:text-sm pn:outline-hidden pn:hover:bg-accent pn:hover:text-accent-foreground pn:disabled:pointer-events-none pn:disabled:cursor-default pn:disabled:opacity-50 pn:[&_svg]:size-4 pn:[&_svg]:shrink-0",children:[n,e("span",{children:o})]}),E=({title:t})=>e("div",{className:"pn:-mx-1 pn:mt-1 pn:border-t pn:border-border pn:pt-2 pn:pb-1 pn:px-2 pn:text-xs pn:font-semibold pn:text-foreground pn:first:mt-0 pn:first:border-t-0 pn:first:pt-1",children:t});export const PositionPicker=o(({store:o})=>{const y=o.selectedElements.length>0,k=o.selectedElements.every(e=>e.draggable),w=k&&o.selectedElements.length>1;return t(s,{children:[e(r,{disabled:!y,render:t(l,{variant:"ghost",size:"sm",className:"polotno-position",disabled:!y,"aria-label":c("toolbar.position"),children:[e(i,{name:"layering.menu",className:"pn:size-4"}),c("toolbar.position")]})}),t(a,{className:"pn:w-[280px] pn:p-1 pn:gap-0",align:"start",children:[e(E,{title:c("toolbar.layering")}),t("div",{className:"pn:flex",children:[t("div",{className:"pn:w-1/2",children:[e(f,{icon:e(i,{name:"layering.up"}),text:c("toolbar.up"),disabled:!o.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsUp([e.id])}),onClick:()=>{o.selectedElements.forEach(e=>e.moveUp())}}),e(f,{icon:e(i,{name:"layering.top"}),text:c("toolbar.toForward"),disabled:!o.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsTop([e.id])}),onClick:()=>{o.selectedElements.forEach(e=>e.moveTop())}})]}),t("div",{className:"pn:w-1/2",children:[e(f,{icon:e(i,{name:"layering.down"}),text:c("toolbar.down"),disabled:!o.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsDown([e.id])}),onClick:()=>{o.selectedElements.forEach(e=>e.moveDown())}}),e(f,{icon:e(i,{name:"layering.bottom"}),text:c("toolbar.toBottom"),disabled:!o.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsBottom([e.id])}),onClick:()=>{o.selectedElements.forEach(e=>e.moveBottom())}})]})]}),k&&t(n,{children:[e(E,{title:c("toolbar.position")}),t("div",{className:"pn:flex",children:[t("div",{className:"pn:w-1/2",children:[e(f,{icon:e(i,{name:"position.alignLeft"}),text:c("toolbar.alignLeft"),onClick:()=>{m(o)}}),e(f,{icon:e(i,{name:"position.alignCenter"}),text:c("toolbar.alignCenter"),onClick:()=>{p(o)}}),e(f,{icon:e(i,{name:"position.alignRight"}),text:c("toolbar.alignRight"),onClick:()=>{v(o)}})]}),t("div",{className:"pn:w-1/2",children:[e(f,{icon:e(i,{name:"position.alignTop"}),text:c("toolbar.alignTop"),onClick:()=>{b(o)}}),e(f,{icon:e(i,{name:"position.alignMiddle"}),text:c("toolbar.alignMiddle"),onClick:()=>{h(o)}}),e(f,{icon:e(i,{name:"position.alignBottom"}),text:c("toolbar.alignBottom"),onClick:()=>{d(o)}})]})]})]}),w&&t(n,{children:[e(E,{title:c("toolbar.spaceEvenly")}),t("div",{className:"pn:flex",children:[e("div",{className:"pn:w-1/2",children:e(f,{icon:e(i,{name:"position.distributeVertical"}),text:c("toolbar.verticalDistribution"),onClick:()=>{var e;let t=null===(e=o.activePage)||void 0===e?void 0:e.computedHeight,n=0,i=0;o.selectedElements.forEach(e=>{const o=g(e);t=Math.min(t,o.y),n=Math.max(n,o.y+o.height),i+=o.height});const l=(n-t-i)/(o.selectedElements.length-1),s=o.selectedElements.slice().sort((e,t)=>{const n=g(e),o=g(t);return n.y-o.y});let a=0;s.forEach(e=>{const n=g(e);x(e,n.x,t+a),a+=n.height+l})}})}),e("div",{className:"pn:w-1/2",children:e(f,{icon:e(i,{name:"position.distributeHorizontal"}),text:c("toolbar.horizontalDistribution"),onClick:()=>{var e;let t=null===(e=o.activePage)||void 0===e?void 0:e.computedWidth,n=0,i=0;o.selectedElements.forEach(e=>{const o=g(e);t=Math.min(t,o.x),n=Math.max(n,o.x+o.width),i+=o.width});const l=(n-t-i)/(o.selectedElements.length-1),s=o.selectedElements.slice().sort((e,t)=>{const n=g(e),o=g(t);return n.x-o.x});let a=0;s.forEach(e=>{const n=g(e);x(e,t+a,n.y),a+=n.width+l})}})})]})]}),e(E,{title:"px"===o.unit?"":o.unit}),e(u,{store:o})]})]})});
1
+ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{observer as o}from"mobx-react-lite";import{PolotnoIcon as i}from"../icons/registry.js";import{Button as l}from"../primitives/button.js";import{Popover as s,PopoverContent as a,PopoverTrigger as r}from"../primitives/popover.js";import{t as c}from"../utils/l10n.js";import{alignBottom as d,alignCenter as p,alignLeft as m,alignMiddle as h,alignRight as v,alignTop as b,getBoundingBox as g,setElementPosition as x}from"../utils/alignment.js";import{SelectionSize as u}from"./selection-size.js";const f=({icon:e,text:o,disabled:i,onClick:l})=>n("button",{type:"button",disabled:i,onClick:l,className:"pn:flex pn:w-full pn:appearance-none pn:cursor-pointer pn:items-center pn:gap-2 pn:rounded-none pn:border-0 pn:bg-transparent pn:px-[7px] pn:py-[5px] pn:text-left pn:text-sm pn:outline-hidden pn:hover:bg-accent pn:hover:text-accent-foreground pn:disabled:pointer-events-none pn:disabled:cursor-default pn:disabled:opacity-50 pn:[&_svg]:size-4 pn:[&_svg]:shrink-0",children:[e,t("span",{children:o})]}),E=({title:e})=>t("div",{className:"pn:-mx-1 pn:mt-1 pn:border-t pn:border-border pn:pt-2 pn:pb-1 pn:px-2 pn:text-xs pn:font-semibold pn:text-foreground pn:first:mt-0 pn:first:border-t-0 pn:first:pt-1",children:e});export const PositionPicker=o(({store:o})=>{const y=o.selectedElements.length>0,k=o.selectedElements.every(e=>e.draggable),w=k&&o.selectedElements.length>1;return n(s,{children:[t(r,{disabled:!y,render:n(l,{variant:"ghost",size:"sm",className:"polotno-position",disabled:!y,"aria-label":c("toolbar.position"),children:[t(i,{name:"layering.menu",className:"pn:size-4"}),c("toolbar.position")]})}),n(a,{className:"pn:w-[280px] pn:p-1 pn:gap-0",align:"start",children:[t(E,{title:c("toolbar.layering")}),n("div",{className:"pn:flex",children:[n("div",{className:"pn:w-1/2",children:[t(f,{icon:t(i,{name:"layering.up"}),text:c("toolbar.up"),disabled:!o.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsUp([e.id])}),onClick:()=>{o.selectedElements.forEach(e=>e.moveUp())}}),t(f,{icon:t(i,{name:"layering.top"}),text:c("toolbar.toForward"),disabled:!o.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsTop([e.id])}),onClick:()=>{o.selectedElements.forEach(e=>e.moveTop())}})]}),n("div",{className:"pn:w-1/2",children:[t(f,{icon:t(i,{name:"layering.down"}),text:c("toolbar.down"),disabled:!o.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsDown([e.id])}),onClick:()=>{o.selectedElements.forEach(e=>e.moveDown())}}),t(f,{icon:t(i,{name:"layering.bottom"}),text:c("toolbar.toBottom"),disabled:!o.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsBottom([e.id])}),onClick:()=>{o.selectedElements.forEach(e=>e.moveBottom())}})]})]}),k&&n(e,{children:[t(E,{title:c("toolbar.position")}),n("div",{className:"pn:flex",children:[n("div",{className:"pn:w-1/2",children:[t(f,{icon:t(i,{name:"position.alignLeft"}),text:c("toolbar.alignLeft"),onClick:()=>{m(o)}}),t(f,{icon:t(i,{name:"position.alignCenter"}),text:c("toolbar.alignCenter"),onClick:()=>{p(o)}}),t(f,{icon:t(i,{name:"position.alignRight"}),text:c("toolbar.alignRight"),onClick:()=>{v(o)}})]}),n("div",{className:"pn:w-1/2",children:[t(f,{icon:t(i,{name:"position.alignTop"}),text:c("toolbar.alignTop"),onClick:()=>{b(o)}}),t(f,{icon:t(i,{name:"position.alignMiddle"}),text:c("toolbar.alignMiddle"),onClick:()=>{h(o)}}),t(f,{icon:t(i,{name:"position.alignBottom"}),text:c("toolbar.alignBottom"),onClick:()=>{d(o)}})]})]})]}),w&&n(e,{children:[t(E,{title:c("toolbar.spaceEvenly")}),n("div",{className:"pn:flex",children:[t("div",{className:"pn:w-1/2",children:t(f,{icon:t(i,{name:"position.distributeVertical"}),text:c("toolbar.verticalDistribution"),onClick:()=>{var e;let t=null===(e=o.activePage)||void 0===e?void 0:e.computedHeight,n=0,i=0;o.selectedElements.forEach(e=>{const o=g(e);t=Math.min(t,o.y),n=Math.max(n,o.y+o.height),i+=o.height});const l=(n-t-i)/(o.selectedElements.length-1),s=o.selectedElements.slice().sort((e,t)=>{const n=g(e),o=g(t);return n.y-o.y});let a=0;s.forEach(e=>{const n=g(e);x(e,n.x,t+a),a+=n.height+l})}})}),t("div",{className:"pn:w-1/2",children:t(f,{icon:t(i,{name:"position.distributeHorizontal"}),text:c("toolbar.horizontalDistribution"),onClick:()=>{var e;let t=null===(e=o.activePage)||void 0===e?void 0:e.computedWidth,n=0,i=0;o.selectedElements.forEach(e=>{const o=g(e);t=Math.min(t,o.x),n=Math.max(n,o.x+o.width),i+=o.width});const l=(n-t-i)/(o.selectedElements.length-1),s=o.selectedElements.slice().sort((e,t)=>{const n=g(e),o=g(t);return n.x-o.x});let a=0;s.forEach(e=>{const n=g(e);x(e,t+a,n.y),a+=n.width+l})}})})]})]}),t(E,{title:"px"===o.unit?"":o.unit}),t(u,{store:o})]})]})});