polotno 3.12.1 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/blueprint/canvas/context-menu/context-menu.d.ts +2 -2
  2. package/blueprint/canvas/page-controls.d.ts +14 -2
  3. package/blueprint/canvas/tooltip.d.ts +24 -2
  4. package/blueprint/pages-timeline/audio-track.d.ts +12 -2
  5. package/blueprint/pages-timeline/audios.d.ts +10 -2
  6. package/blueprint/pages-timeline/current-time.d.ts +2 -2
  7. package/blueprint/pages-timeline/element-track.d.ts +14 -2
  8. package/blueprint/pages-timeline/elements.d.ts +2 -2
  9. package/blueprint/pages-timeline/page-preview.d.ts +8 -2
  10. package/blueprint/pages-timeline/pages-timeline.d.ts +8 -2
  11. package/blueprint/pages-timeline/pages.d.ts +8 -2
  12. package/blueprint/pages-timeline/play-button.d.ts +2 -2
  13. package/blueprint/pages-timeline/time-ruler.d.ts +10 -2
  14. package/blueprint/side-panel/ai-images-panel.d.ts +6 -2
  15. package/blueprint/side-panel/animations-panel.d.ts +6 -2
  16. package/blueprint/side-panel/background-panel.d.ts +6 -2
  17. package/blueprint/side-panel/draw-panel.d.ts +6 -2
  18. package/blueprint/side-panel/effects-panel.d.ts +6 -2
  19. package/blueprint/side-panel/image-clip-panel.d.ts +6 -2
  20. package/blueprint/side-panel/layers-panel.d.ts +6 -2
  21. package/blueprint/side-panel/pages-panel.d.ts +6 -2
  22. package/blueprint/side-panel/select-video.d.ts +105 -36
  23. package/blueprint/side-panel/side-panel.d.ts +2 -2
  24. package/blueprint/side-panel/size-panel.d.ts +6 -2
  25. package/blueprint/side-panel/templates-panel.d.ts +6 -2
  26. package/blueprint/side-panel/text-panel.d.ts +6 -2
  27. package/blueprint/side-panel/videos-panel.d.ts +6 -2
  28. package/blueprint/toolbar/admin-button.d.ts +6 -2
  29. package/blueprint/toolbar/animations-picker.d.ts +18 -4
  30. package/blueprint/toolbar/copy-style.d.ts +6 -2
  31. package/blueprint/toolbar/download-button.d.ts +6 -2
  32. package/blueprint/toolbar/duplicate-button.d.ts +6 -2
  33. package/blueprint/toolbar/figure-toolbar.d.ts +8 -8
  34. package/blueprint/toolbar/filters-picker.d.ts +26 -6
  35. package/blueprint/toolbar/gif-toolbar.d.ts +2 -2
  36. package/blueprint/toolbar/group-button.d.ts +6 -2
  37. package/blueprint/toolbar/group-toolbar.d.ts +2 -2
  38. package/blueprint/toolbar/history-buttons.d.ts +6 -2
  39. package/blueprint/toolbar/html-toolbar.d.ts +10 -10
  40. package/blueprint/toolbar/image-remove-background-button.d.ts +10 -2
  41. package/blueprint/toolbar/image-toolbar.d.ts +28 -8
  42. package/blueprint/toolbar/line-toolbar.d.ts +14 -10
  43. package/blueprint/toolbar/lock-button.d.ts +6 -2
  44. package/blueprint/toolbar/many-toolbar.d.ts +2 -2
  45. package/blueprint/toolbar/opacity-picker.d.ts +6 -2
  46. package/blueprint/toolbar/page-toolbar.d.ts +2 -2
  47. package/blueprint/toolbar/position-picker.d.ts +6 -2
  48. package/blueprint/toolbar/remove-button.d.ts +6 -2
  49. package/blueprint/toolbar/svg-toolbar.d.ts +2 -2
  50. package/blueprint/toolbar/table-toolbar.d.ts +44 -14
  51. package/blueprint/toolbar/text-ai-write.d.ts +6 -2
  52. package/blueprint/toolbar/text-toolbar.d.ts +14 -14
  53. package/blueprint/toolbar/toolbar.d.ts +2 -2
  54. package/blueprint/toolbar/video-toolbar.d.ts +6 -6
  55. package/blueprint/toolbar/zoom-buttons.d.ts +4 -4
  56. package/canvas/apply-filters.js +1 -1
  57. package/canvas/audio.d.ts +3 -2
  58. package/canvas/context-menu/context-menu.d.ts +2 -2
  59. package/canvas/downscale.d.ts +4 -0
  60. package/canvas/downscale.js +1 -1
  61. package/canvas/drawing-layer.d.ts +2 -2
  62. package/canvas/element.d.ts +3 -3
  63. package/canvas/element.js +1 -1
  64. package/canvas/fade-overlay.d.ts +14 -0
  65. package/canvas/fade-overlay.js +1 -0
  66. package/canvas/figure-element.d.ts +2 -2
  67. package/canvas/figure-element.js +1 -1
  68. package/canvas/gif-element.d.ts +2 -2
  69. package/canvas/gif-element.js +1 -1
  70. package/canvas/highlighter.d.ts +6 -2
  71. package/canvas/html-element.d.ts +2 -2
  72. package/canvas/html-element.js +1 -1
  73. package/canvas/image-element.d.ts +5 -3
  74. package/canvas/image-element.js +1 -1
  75. package/canvas/line-element.d.ts +2 -2
  76. package/canvas/line-element.js +1 -1
  77. package/canvas/page-controls.d.ts +14 -2
  78. package/canvas/page.d.ts +2 -2
  79. package/canvas/page.js +1 -1
  80. package/canvas/paint-opacity.d.ts +12 -0
  81. package/canvas/paint-opacity.js +1 -0
  82. package/canvas/render-tag-element.d.ts +2 -2
  83. package/canvas/render-tag-element.js +1 -1
  84. package/canvas/rich-editor.js +11 -3
  85. package/canvas/rules.d.ts +2 -2
  86. package/canvas/table-element.d.ts +2 -2
  87. package/canvas/table-element.js +1 -1
  88. package/canvas/text-element/font-specs-loader.js +1 -1
  89. package/canvas/text-element.d.ts +2 -2
  90. package/canvas/text-element.js +1 -1
  91. package/canvas/tooltip.d.ts +24 -2
  92. package/canvas/use-filtered-source.js +1 -1
  93. package/canvas/video-element.d.ts +3 -2
  94. package/canvas/video-element.js +1 -1
  95. package/canvas/workspace-canvas.d.ts +2 -2
  96. package/canvas/workspace-canvas.js +1 -1
  97. package/hooks/use-fade-stop-focus.d.ts +2 -0
  98. package/hooks/use-fade-stop-focus.js +1 -0
  99. package/icons/registry.d.ts +106 -102
  100. package/model/audio-model.d.ts +54 -2
  101. package/model/figure-model.d.ts +65 -24
  102. package/model/gif-model.d.ts +65 -24
  103. package/model/group-model.d.ts +497 -182
  104. package/model/group-model.js +1 -1
  105. package/model/history.js +1 -1
  106. package/model/image-model.d.ts +65 -24
  107. package/model/line-model.d.ts +65 -24
  108. package/model/node-model.d.ts +65 -24
  109. package/model/node-model.js +1 -1
  110. package/model/page-model.d.ts +4369 -445
  111. package/model/page-model.js +1 -1
  112. package/model/shape-model.d.ts +65 -24
  113. package/model/store.d.ts +480 -18060
  114. package/model/store.js +1 -1
  115. package/model/svg-model.d.ts +64 -24
  116. package/model/table-model.d.ts +40 -12
  117. package/model/table-model.js +1 -1
  118. package/model/text-model.d.ts +64 -24
  119. package/model/text-model.js +1 -1
  120. package/model/video-model.d.ts +65 -24
  121. package/package.json +30 -33
  122. package/pages-timeline/audio-track.d.ts +14 -2
  123. package/pages-timeline/audio-track.js +1 -1
  124. package/pages-timeline/audios.d.ts +10 -2
  125. package/pages-timeline/current-time.d.ts +2 -2
  126. package/pages-timeline/current-time.js +1 -1
  127. package/pages-timeline/element-track.d.ts +14 -2
  128. package/pages-timeline/element-track.js +1 -1
  129. package/pages-timeline/elements.d.ts +2 -2
  130. package/pages-timeline/page-preview.d.ts +8 -2
  131. package/pages-timeline/page-preview.js +1 -1
  132. package/pages-timeline/pages-timeline.d.ts +8 -2
  133. package/pages-timeline/pages-timeline.js +1 -1
  134. package/pages-timeline/pages.d.ts +8 -2
  135. package/pages-timeline/play-button.d.ts +2 -2
  136. package/pages-timeline/time-ruler.d.ts +10 -2
  137. package/pages-timeline/time-ruler.js +1 -1
  138. package/polotno.bundle.js +181 -169
  139. package/primitives/panel-header.js +1 -1
  140. package/primitives/panel-scroll-area.d.ts +4 -0
  141. package/primitives/panel-scroll-area.js +1 -0
  142. package/primitives/select.js +1 -1
  143. package/side-panel/ai-images-panel.d.ts +6 -2
  144. package/side-panel/animations-panel.d.ts +6 -2
  145. package/side-panel/animations-panel.js +1 -1
  146. package/side-panel/background-panel.d.ts +6 -2
  147. package/side-panel/draw-panel.d.ts +6 -2
  148. package/side-panel/draw-panel.js +1 -1
  149. package/side-panel/effects-panel.d.ts +6 -2
  150. package/side-panel/effects-panel.js +1 -1
  151. package/side-panel/elements-panel.js +1 -1
  152. package/side-panel/image-clip-panel.d.ts +6 -2
  153. package/side-panel/image-clip-panel.js +1 -1
  154. package/side-panel/layers-panel.d.ts +6 -2
  155. package/side-panel/layers-panel.js +1 -1
  156. package/side-panel/pages-panel.d.ts +6 -2
  157. package/side-panel/select-video.d.ts +105 -36
  158. package/side-panel/side-panel.d.ts +2 -2
  159. package/side-panel/side-panel.js +1 -1
  160. package/side-panel/size-panel.d.ts +6 -2
  161. package/side-panel/size-panel.js +1 -1
  162. package/side-panel/templates-panel.d.ts +6 -2
  163. package/side-panel/text-panel.d.ts +6 -2
  164. package/side-panel/text-panel.js +1 -1
  165. package/side-panel/videos-panel.d.ts +6 -2
  166. package/toolbar/admin-button.d.ts +6 -2
  167. package/toolbar/animations-picker.d.ts +18 -4
  168. package/toolbar/color-picker.js +1 -1
  169. package/toolbar/copy-style.d.ts +6 -2
  170. package/toolbar/download-button.d.ts +6 -2
  171. package/toolbar/duplicate-button.d.ts +6 -2
  172. package/toolbar/figure-toolbar.d.ts +8 -8
  173. package/toolbar/filters-picker.d.ts +26 -6
  174. package/toolbar/gif-toolbar.d.ts +2 -2
  175. package/toolbar/group-button.d.ts +6 -2
  176. package/toolbar/group-toolbar.d.ts +2 -2
  177. package/toolbar/history-buttons.d.ts +6 -2
  178. package/toolbar/html-toolbar.d.ts +10 -10
  179. package/toolbar/html-toolbar.js +3 -3
  180. package/toolbar/image-remove-background-button.d.ts +10 -2
  181. package/toolbar/image-toolbar.d.ts +32 -10
  182. package/toolbar/line-toolbar.d.ts +14 -10
  183. package/toolbar/lock-button.d.ts +6 -2
  184. package/toolbar/many-toolbar.d.ts +2 -2
  185. package/toolbar/opacity-picker.d.ts +6 -2
  186. package/toolbar/opacity-picker.js +1 -1
  187. package/toolbar/page-toolbar.d.ts +2 -2
  188. package/toolbar/position-picker.d.ts +6 -2
  189. package/toolbar/remove-button.d.ts +6 -2
  190. package/toolbar/svg-toolbar.d.ts +2 -2
  191. package/toolbar/table-toolbar.d.ts +44 -14
  192. package/toolbar/text-ai-write.d.ts +6 -2
  193. package/toolbar/text-toolbar.d.ts +30 -18
  194. package/toolbar/text-toolbar.js +1 -1
  195. package/toolbar/toolbar.d.ts +2 -2
  196. package/toolbar/video-toolbar.d.ts +12 -6
  197. package/toolbar/video-toolbar.js +1 -1
  198. package/toolbar/zoom-buttons.d.ts +4 -4
  199. package/ui.css +1 -1
  200. package/utils/canvas.d.ts +0 -3
  201. package/utils/canvas.js +1 -1
  202. package/utils/clip-fade.d.ts +6 -0
  203. package/utils/clip-fade.js +1 -0
  204. package/utils/clipboard.d.ts +104 -36
  205. package/utils/fade-gradient.d.ts +33 -0
  206. package/utils/fade-gradient.js +1 -0
  207. package/utils/fade-overlay.d.ts +9 -0
  208. package/utils/fade-overlay.js +1 -0
  209. package/utils/fonts.js +1 -1
  210. package/utils/from-svg.js +1 -1
  211. package/utils/l10n.d.ts +40 -0
  212. package/utils/l10n.js +1 -1
  213. package/utils/pointer-drag.d.ts +6 -4
  214. package/utils/pointer-drag.js +1 -1
  215. package/utils/text-format-state.d.ts +3 -0
  216. package/utils/text-format-state.js +1 -1
  217. package/utils/validate-key.js +1 -1
@@ -7,13 +7,14 @@ export declare const useCornerRadiusAndCrop: (element: VideoElementType, image:
7
7
  width: number;
8
8
  height: number;
9
9
  }, pixelRatio: number, cornerRadius?: number, skipDownscale?: boolean) => readonly [HTMLCanvasElement | HTMLVideoElement | undefined, () => void];
10
+ export declare const useClip: (element: VideoElementType, image: HTMLVideoElement | HTMLCanvasElement | undefined, pixelRatio: number, deps: readonly unknown[]) => readonly [HTMLCanvasElement | HTMLVideoElement | undefined, () => void];
10
11
  type Props = {
11
12
  store: StoreType;
12
13
  element: VideoElementType;
13
14
  };
14
15
  export declare const setVideoLoaderHook: (customVideoLoaderHook: any) => void;
15
16
  export declare const useLoader: (status: string, src: string, id: string) => void;
16
- export declare const VideoElement: (({ element, store }: Props) => React.JSX.Element) & {
17
- displayName: string;
17
+ export declare const VideoElement: (({ element, store }: Props) => React.JSX.Element) & React.NamedExoticComponent<Props> & {
18
+ readonly type: ({ element, store }: Props) => React.JSX.Element;
18
19
  };
19
20
  export {};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import i from"react";import{observer as o}from"mobx-react-lite";import{isAlive as n}from"mobx-state-tree";import{nodeAutorun as a}from"../utils/mobx.js";import{Arc as d,Group as s,Image as l,Rect as c,Text as h}from"react-konva";import{ROLES as u}from"../model/store.js";import{useCanvasImage as m}from"./image-element.js";import{DEFAULT_RETRIES as g,isDeterministicUrl as p,retryDelayMs as f}from"@polotno/core/retry";import v from"konva";import{useWorkspaceStyle as w}from"./workspace-style.js";import{incrementLoader as x,triggerLoadError as y}from"../utils/loader.js";import{polotnoError as E}from"@polotno/core/errors";import{getCropRect as M}from"@polotno/core/image";import*as L from"@polotno/core/svg";import{roundEnabledPx as T,activeAnchorOf as b,roundedCropFraction as C,roundedGeometryPx as I,roundedPosition as R,isCornerAnchor as H,scaledBoxStyleAttrs as S,roundedBoxStyleAttrs as j}from"../utils/px.js";import{useFilteredSource as k}from"./use-filtered-source.js";import{useEvent as O}from"../hooks/use-event.js";import{useFadeIn as P}from"./use-fadein.js";import{isTouchDevice as A}from"../utils/screen.js";import{createPlayGate as W,playMedia as X}from"../utils/media.js";import{useMediabunnyVideo as Y}from"./use-mediabunny-video.js";import{getElementTimeRange as V,getVideoRestMs as _}from"../utils/timeline.js";import{drawReduced as D,exportKernelEnabled as z,shouldResample as U}from"./downscale.js";import{useSizeFixer as N}from"./image-element.js";import{CropOverlay as Z,CROP_CORNER_ANCHORS as B}from"./crop-overlay.js";function F(){return document.createElement("canvas")}const $=new window.Image;$.src=L.svgToURL('\n <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path opacity="0.6" d="M4 5.49683V18.5032C4 20.05 5.68077 21.0113 7.01404 20.227L18.0694 13.7239C19.384 12.9506 19.384 11.0494 18.0694 10.2761L7.01404 3.77296C5.68077 2.98869 4 3.95 4 5.49683Z" fill="white"/>\n <path d="M4 5.49683V18.5032C4 20.05 5.68077 21.0113 7.01404 20.227L18.0694 13.7239C19.384 12.9506 19.384 11.0494 18.0694 10.2761L7.01404 3.77296C5.68077 2.98869 4 3.95 4 5.49683Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n');const q=new window.Image;q.src=L.svgToURL('\n <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path opacity="0.6" d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" fill="white"/>\n <path opacity="0.6" d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" fill="white"/>\n <path d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n');export const useCornerRadiusAndCrop=(e,t,r,o,n=0,a=!1)=>{var d;const s=Math.floor(Math.max(e.width*o,1)),l=Math.floor(Math.max(e.height*o,1)),c=Math.min(n*o,s/2,l/2),h=Math.max(e.width/r.width,e.height/r.height)*o,u=z(e.page)&&!a&&U(h,s,l),m=t instanceof HTMLVideoElement?t.videoWidth:null==t?void 0:t.width,g=t instanceof HTMLVideoElement?t.videoHeight:null==t?void 0:t.height,p=0===r.x&&0===r.y&&r.width===m&&r.height===g,f=i.useMemo(()=>{if(t&&m&&g){return p&&0===c&&!u?void 0:F()}},[t,c,u,p,m,g]),w=()=>{if(!f||!t){return}f.width=s,f.height=l;const e=f.getContext("2d");e&&(c&&(e.beginPath(),e.moveTo(c,0),e.lineTo(s-c,0),e.arc(s-c,c,c,3*Math.PI/2,0,!1),e.lineTo(s,l-c),e.arc(s-c,l-c,c,0,Math.PI/2,!1),e.lineTo(c,l),e.arc(c,l-c,c,Math.PI/2,Math.PI,!1),e.lineTo(0,c),e.arc(c,c,c,Math.PI,3*Math.PI/2,!1),e.clip()),u?D(e,t,r,f.width,f.height):e.drawImage(t,r.x,r.y,r.width,r.height,0,0,f.width,f.height))};return i.useLayoutEffect(()=>{w()},[f,e.width,e.height,r.x,r.y,r.width,r.height,n,o,a,null===(d=e.page)||void 0===d?void 0:d._exportingOrRendering,u]),i.useEffect(()=>()=>{f&&"CANVAS"===f.nodeName&&v.Util.releaseCanvas(f)},[f]),[f||t,w]};const G=F(),J=o(({element:r})=>{const o=Math.min(30,r.width/4,r.height/4),n=i.useRef(null);i.useEffect(()=>{const e=n.current;if(!e){return}const t=new v.Animation(t=>{e.rotate(((null==t?void 0:t.timeDiff)||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});const{mediaLoadingStyle:a}=w();return t(s,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:r.a.opacity,hideInExport:!r.showInExport,children:[e(c,{width:r.width,height:r.height,fill:a.fill}),e(d,{ref:n,x:r.width/2,y:r.height/2,fill:a.textFill,outerRadius:Math.abs(o),innerRadius:Math.max(1,o-5),angle:270})]})}),K=o(({element:r})=>{const{mediaErrorStyle:i}=w(),o=Math.max(10,Math.min(30,r.width/25));return t(s,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:r.a.opacity,hideInExport:!r.showInExport,children:[e(c,{width:r.width,height:r.height,fill:i.fill}),e(h,{text:"Can not load the video...",fontSize:o,width:r.width,height:r.height,align:"center",fill:i.textFill,verticalAlign:"middle",padding:5})]})});let Q=function(e,t,r){const o=i.useRef("loading"),n=i.useRef(void 0),[a,d]=i.useState(0),s=i.useRef(void 0),l=i.useRef(void 0),c=i.useRef(void 0);return s.current===e&&l.current===t&&c.current===r||(o.current="loading",n.current=void 0,s.current=e,l.current=t,c.current=r),i.useLayoutEffect(()=>{if(!e){return}const i=p(e)?1:g;let a,s,l,c=0,h=!1,u=!1;const m=e=>{e&&(e.removeAttribute("src"),e.load())},v=()=>{c+=1;const g=document.createElement("video");function p(){h||(g.removeEventListener("canplay",p),u=!0,o.current="loaded",n.current=g,g.currentTime=0,d(Math.random()))}function w(e){var t;const r=4===g.readyState,l=g.buffered&&g.buffered.length>0&&g.buffered.end(g.buffered.length-1)/g.duration*100>=100;if(r&&l){return}if(h){return}if(!u&&c<i){return null==s||s(),m(g),void(a=setTimeout(v,f(c)))}const p=e.message||(null===(t=g.error)||void 0===t?void 0:t.message)||"Unknown error";console.error(new Error("Video failed to load: "+p)),o.current="failed",n.current=void 0,d(Math.random())}l=g,g.addEventListener("canplay",p),g.addEventListener("error",w),s=()=>{g.removeEventListener("canplay",p),g.removeEventListener("error",w)},t&&(g.crossOrigin=t),r&&(g.referrerPolicy=r),g.src=e,g.load()};return v(),()=>{h=!0,clearTimeout(a),null==s||s(),u||m(l)}},[e,t,r]),[n.current,o.current]};export const setVideoLoaderHook=e=>{Q=e};function ee(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}export const useLoader=(e,t,r)=>{const o=i.useRef(void 0),n=()=>{var e;null===(e=o.current)||void 0===e||e.call(o),o.current=void 0};i.useEffect(()=>n,[]),i.useLayoutEffect(()=>{const i=t.slice(0,200),a=`video with id ${r} url: ${i}`;"loading"!==e||o.current||(o.current=x(a)),"loading"!==e&&n(),"failed"===e&&y(E("VIDEO_FAILED",a,{src:i,elementId:r,reason:"load"}))},[e])};export const VideoElement=o(({element:o,store:d})=>{var h,g,p;const[f,w]=i.useState(!1),y=i.useRef(null),E=o.isSelected,[D,z]=i.useState(!1),[U,te]=Q(o.src,"anonymous"),[re,ie]=i.useState(!1),oe=d.activePage===o.page,ne=(null===(h=o.page)||void 0===h?void 0:h._exportingOrRendering)&&"loaded"===te,ae=Y(o,d,ne);useLoader(te,o.src,o.id),U&&(U.playsInline=!0);const de=((e,t,r)=>{const o=i.useMemo(()=>{var i,o;const{flipX:n,flipY:a}=e,d="svg"===e.type||L.isSvgUrl(e.src),s=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;if(!(n||a||s&&d)){return t}if(!t){return null}const l=t instanceof HTMLVideoElement?t.videoWidth:null==t?void 0:t.width,c=t instanceof HTMLVideoElement?t.videoHeight:null==t?void 0:t.height;if(!l||!c){return null}const h=F();let u=1;"svg"===e.type&&(u=Math.max(e.width/l*r,e.height/c*r)),h.width=Math.max(l*u,1),h.height=Math.max(c*u,1);let m=n?-h.width:0,g=a?-h.height:0;return null===(i=h.getContext("2d"))||void 0===i||i.scale(n?-1:1,a?-1:1),null===(o=h.getContext("2d"))||void 0===o||o.drawImage(t,m,g,h.width,h.height),h},[e.flipX,e.flipY,t,e.width,e.height,r]);return i.useEffect(()=>()=>{o&&"CANVAS"===o.nodeName&&v.Util.releaseCanvas(o)},[o]),o})(o,U,d._elementsPixelRatio),se=ne&&ae||de||G,[le=G,ce]=k(o,se);i.useEffect(()=>{U&&d.history.ignore(()=>{o.set({duration:1e3*U.duration})})},[U]);const he=i.useMemo(W,[U]);i.useEffect(()=>{var e;if(!U){return}const t=d.animatedElementsIds,r=(!t.length||t.includes(o.id))&&d.isPlaying;if(!oe||!r&&!D){return void U.pause()}D&&(U.muted=!1,U.currentTime=o.startTime*U.duration,X(U).then(e=>{"refused"===e&&z(!1)}));const i=new v.Animation(()=>{He()},null===(e=y.current)||void 0===e?void 0:e.getLayer());i.start();const n=()=>{z(!1),U.currentTime=o.startTime*U.duration},a=()=>{U.currentTime>=o.endTime*U.duration&&(U.pause(),U.currentTime=o.startTime*U.duration,z(!1))};return U.addEventListener("ended",n),U.addEventListener("timeupdate",a),()=>{U.pause(),i.stop(),U.removeEventListener("ended",n),U.removeEventListener("timeupdate",a)}},[U,D,d.isPlaying,oe]),i.useEffect(()=>{U&&(U.volume=o.volume)},[U,o.volume]),i.useEffect(()=>{U&&(U.playbackRate=o.speed,U.preservesPitch=!1)},[U,o.speed]);const ue=i.useRef(null);i.useEffect(()=>{const e=a(o,()=>{var e,t;if(U){if(ne&&ae){return He(),void d.currentTime}const r=d.animatedElementsIds;if(r.length&&!r.includes(o.id)){return}const i=d.activePage===o.page,n=d.currentTime>=o.page.startTime&&d.currentTime<o.page.startTime+o.page.duration,a=o.startTime*U.duration*1e3,s=U.duration*(o.endTime-o.startTime)*1e3,{start:l,end:c}=V(o.animations,o.page.duration),h=(d.currentTime||o.page.startTime)-o.page.startTime,u=n?_(d.currentTime,o.page.startTime,l,s,a,o.speed):0,m=u/1e3,g=n&&h>=l&&h<c;D||(U.muted=!g,g&&d.isPlaying&&i?U.paused?(U.currentTime=m,he.play(U)):Math.abs(1e3*U.currentTime-u)>500&&(U.currentTime=m):(he.reset(),U.paused||U.pause(),m!==U.currentTime&&(U.currentTime=m),!ee(U)&&!d.isPlaying&&!ue.current&&(ue.current=x(`video ${o.id}`)))),He(),null===(t=null===(e=y.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()}});return()=>{e(),ue.current&&(ue.current(),ue.current=null)}},[d,U,ne,ae,D]),i.useEffect(()=>{var e,t;if(!U){return}if(ne){return null===(e=ue.current)||void 0===e||e.call(ue),void(ue.current=null)}const r=()=>{var e,t,r;!ee(U)&&(null===(e=o.page)||void 0===e?void 0:e._exportingOrRendering)||ue.current&&(He(),null===(r=null===(t=y.current)||void 0===t?void 0:t.getLayer())||void 0===r||r.batchDraw(),ue.current(),ue.current=null)};let i;return(null===(t=o.page)||void 0===t?void 0:t._exportingOrRendering)&&(i=setInterval(r,20)),U.addEventListener("timeupdate",r),U.addEventListener("canplay",r),()=>{clearInterval(i),U.removeEventListener("timeupdate",r),U.removeEventListener("canplay",r)}},[null===(g=o.page)||void 0===g?void 0:g._exportingOrRendering,U,o.id,x,ne]);let{cropX:me,cropY:ge,cropWidth:pe,cropHeight:fe}=o;"loaded"!==te&&(me=ge=0,pe=fe=1);const ve=(we=le)instanceof HTMLVideoElement?we.videoWidth:(null==we?void 0:we.width)||0;var we;const xe=(e=>e instanceof HTMLVideoElement?e.videoHeight:(null==e?void 0:e.height)||0)(le),ye=M({stretchEnabled:o.stretchEnabled,cropX:me,cropY:ge,cropWidth:pe,cropHeight:fe,width:o.a.width,height:o.a.height},{width:ve,height:xe}),Ee=ye.width,Me=ye.height,Le=o.stretchEnabled,Te=null!==(p=o.cornerRadius)&&void 0!==p?p:0,[be,Ce]=useCornerRadiusAndCrop(o,le,ye,d._elementsPixelRatio,Te,!0);let[Ie,Re]=((e,t,r,o)=>{const n=N(e.clipSrc||""),[a,d]=m(n,"anonymous"),s=e.clipSrc?d:"loaded";useLoader(s,e.clipSrc,e.id);const l=i.useMemo(()=>{if(t&&a){return F()}},[t,a]);function c(){var i;if(!a){return}const o=t instanceof HTMLVideoElement?t.videoWidth:null==t?void 0:t.width,n=t instanceof HTMLVideoElement?t.videoHeight:null==t?void 0:t.height;if(!t||!o||!n){return}if(!a||!a.width||!a.height){return}if(!l){return}const d=F(),s=Math.max(e.width/a.width*r,e.height/a.height*r);d.width=a.width*s,d.height=a.height*s,null===(i=d.getContext("2d"))||void 0===i||i.drawImage(a,0,0,d.width,d.height),l.width=Math.max(o,1),l.height=Math.max(n,1);const c=l.getContext("2d");c&&(c.save(),c.drawImage(d,0,0,o,n),v.Util.releaseCanvas(d),c.globalCompositeOperation="source-in",c.drawImage(t,0,0,l.width,l.height),c.restore())}return i.useLayoutEffect(()=>{c()},[l,t,a,e.width,e.height,r,...o]),[e.clipSrc&&a?l:t,c]})(o,be,d._elementsPixelRatio,[ye,Te,d._elementsPixelRatio]);const He=O(()=>{var e,t;ce(),Ce(),Re(),null===(t=null===(e=y.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()});i.useEffect(()=>{He()});const Se=()=>{o._cropEnabled&&setTimeout(()=>{n(o)&&o.toggleCropMode(!0)})},je="loading"===te,ke="failed"===te,Oe=!je&&!ke,Pe=i.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Ae=i.useRef(!1),We=Oe?o.a.opacity:0;P(y,We);const Xe=o.selectable||d.role===u.ADMIN,Ye=A();return e(r,{children:t(s,{onMouseEnter:()=>ie(!0),onMouseLeave:()=>ie(!1),children:[je&&e(J,{element:o}),ke&&e(K,{element:o}),e(l,{ref:y,name:"element",id:o.id,image:Ie,x:o.a.x,y:o.a.y,width:o.a.width||1,height:o.a.height||1,rotation:o.a.rotation,opacity:We,shadowEnabled:o.shadowEnabled,shadowBlur:o.shadowBlur,shadowOffsetX:o.shadowOffsetX,shadowOffsetY:o.shadowOffsetY,shadowColor:o.shadowColor,shadowOpacity:o.shadowOpacity,customCrop:ye,listening:Xe,draggable:Ye?o.draggable&&E:o.draggable,preventDefault:!Ye||E,hideInExport:!o.showInExport,onDragMove:e=>{o.set({x:e.target.x(),y:e.target.y()})},onDragEnd:e=>{o.set(R(e.target))},onDblClick:Se,onDblTap:Se,onTransformStart:e=>{w(!0),Ae.current=H(b(e.target)),Pe.current={cropX:o.cropX,cropY:o.cropY,cropWidth:o.cropWidth,cropHeight:o.cropHeight}},onTransform:e=>{const t=e.currentTarget,r=Math.abs(t.scaleX()-1)<1e-7?1:t.scaleX(),i=Math.abs(t.scaleY()-1)<1e-7?1:t.scaleY();t.scaleX(1),t.scaleY(1);const n=1-Ee/ve,a=Math.min(n,Math.max(0,o.cropX)),d=1-Me/xe,s=Math.min(d,Math.max(0,o.cropY)),l=Ae.current,c=!l&&r<1&&Pe.current.cropHeight>Me/xe;let h=l?o.cropWidth:o.cropWidth*r;c&&(h=o.cropWidth);const u=!l&&i<1&&Pe.current.cropWidth>Ee/ve;let m=l?o.cropHeight:o.cropHeight*i;u&&(m=o.cropHeight),Le&&(h=o.cropWidth,m=o.cropHeight);const g=l?Math.min(r,i):1;o.set(Object.assign({cropX:a,cropY:s,x:t.x(),y:t.y(),width:t.width()*r,height:t.height()*i,rotation:e.target.rotation(),cropWidth:Math.min(h,1-a),cropHeight:Math.min(m,1-s)},1!==g&&Object.assign(Object.assign({},S(o,g)),{borderSize:o.borderSize*g})))},onTransformEnd:e=>{const t=e.currentTarget;o.set(Object.assign(Object.assign({width:I(t.width()),height:I(t.height()),x:I(t.x()),y:I(t.y()),rotation:I(e.target.rotation()),cropX:C(o.cropX),cropY:C(o.cropY),cropWidth:C(Ee/ve),cropHeight:C(Me/xe)},j(o)),{borderSize:T(o.borderSize)})),w(!1)}}),e(c,{x:o.a.x,y:o.a.y,width:Math.max(o.a.width-o.borderSize,0),height:Math.max(o.a.height-o.borderSize,0),opacity:We,offsetX:-o.borderSize/2,offsetY:-o.borderSize/2,stroke:o.borderColor,strokeWidth:o.borderSize,listening:!1,visible:!!o.borderSize,rotation:o.rotation,cornerRadius:Math.max(0,Te-o.borderSize),hideInExport:!o.showInExport}),!d.isPlaying&&e(l,{image:D?re||Ye?q:void 0:$,x:o.a.x,y:o.a.y,offsetX:-o.a.width/2+15/d.scale,offsetY:-o.a.height/2+15/d.scale,rotation:o.a.rotation,width:30/d.scale,height:30/d.scale,hideInExport:!0,onClick:()=>z(!D),onTap:()=>z(!D)}),o._cropModeEnabled&&e(Z,{element:o,store:d,previewImage:Ie,sourceImage:le,sourceWidth:ve,sourceHeight:xe,cropAbsoluteWidth:Ee,cropAbsoluteHeight:Me,innerAnchors:B})]})})});
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{elementOpacity as i}from"./paint-opacity.js";import o from"react";import{observer as n}from"mobx-react-lite";import{isAlive as a}from"mobx-state-tree";import{nodeAutorun as s}from"../utils/mobx.js";import{Arc as d,Group as c,Image as h,Rect as l,Text as u}from"react-konva";import{ROLES as m}from"../model/store.js";import{DEFAULT_RETRIES as g,isDeterministicUrl as p,retryDelayMs as f}from"@polotno/core/retry";import v from"konva";import{useWorkspaceStyle as w}from"./workspace-style.js";import{incrementLoader as x,triggerLoadError as E}from"../utils/loader.js";import{polotnoError as y}from"@polotno/core/errors";import{getCropRect as M}from"@polotno/core/image";import*as L from"@polotno/core/svg";import{roundEnabledPx as b,activeAnchorOf as C,roundedCropFraction as T,roundedGeometryPx as k,roundedPosition as I,isCornerAnchor as R,scaledBoxStyleAttrs as j,roundedBoxStyleAttrs as S}from"../utils/px.js";import{useFilteredSource as P}from"./use-filtered-source.js";import{useEvent as A}from"../hooks/use-event.js";import{useFadeIn as O}from"./use-fadein.js";import{isTouchDevice as X}from"../utils/screen.js";import{createPlayGate as Y,playMedia as H}from"../utils/media.js";import{useMediabunnyVideo as W}from"./use-mediabunny-video.js";import{getElementTimeRange as _,getVideoRestMs as z}from"../utils/timeline.js";import{drawReduced as D,exportKernelEnabled as V,shouldResample as U,sourceSize as N}from"./downscale.js";import{trySetCanvasSize as Z}from"../utils/canvas.js";import{useClipImage as B}from"./image-element.js";import{CropOverlay as F,CROP_CORNER_ANCHORS as $}from"./crop-overlay.js";const q=new window.Image;q.src=L.svgToURL('\n <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path opacity="0.6" d="M4 5.49683V18.5032C4 20.05 5.68077 21.0113 7.01404 20.227L18.0694 13.7239C19.384 12.9506 19.384 11.0494 18.0694 10.2761L7.01404 3.77296C5.68077 2.98869 4 3.95 4 5.49683Z" fill="white"/>\n <path d="M4 5.49683V18.5032C4 20.05 5.68077 21.0113 7.01404 20.227L18.0694 13.7239C19.384 12.9506 19.384 11.0494 18.0694 10.2761L7.01404 3.77296C5.68077 2.98869 4 3.95 4 5.49683Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n');const G=new window.Image;G.src=L.svgToURL('\n <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path opacity="0.6" d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" fill="white"/>\n <path opacity="0.6" d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" fill="white"/>\n <path d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n');export const useCornerRadiusAndCrop=(e,t,r,i,n=0,a=!1)=>{var s;const d=Math.floor(Math.max(e.width*i,1)),c=Math.floor(Math.max(e.height*i,1)),h=Math.min(n*i,d/2,c/2),l=Math.max(e.width/r.width,e.height/r.height)*i,u=V(e.page)&&!a&&U(l,d,c),{width:m,height:g}=t?N(t):{},p=0===r.x&&0===r.y&&r.width===m&&r.height===g,f=o.useMemo(()=>{if(t&&m&&g){return p&&0===h&&!u?void 0:document.createElement("canvas")}},[t,h,u,p,m,g]),w=()=>{if(!f||!t){return}f.width=d,f.height=c;const e=f.getContext("2d");e&&(h&&(e.beginPath(),e.moveTo(h,0),e.lineTo(d-h,0),e.arc(d-h,h,h,3*Math.PI/2,0,!1),e.lineTo(d,c-h),e.arc(d-h,c-h,h,0,Math.PI/2,!1),e.lineTo(h,c),e.arc(h,c-h,h,Math.PI/2,Math.PI,!1),e.lineTo(0,h),e.arc(h,h,h,Math.PI,3*Math.PI/2,!1),e.clip()),u?D(e,t,r,f.width,f.height):e.drawImage(t,r.x,r.y,r.width,r.height,0,0,f.width,f.height))};return o.useLayoutEffect(()=>{w()},[f,e.width,e.height,r.x,r.y,r.width,r.height,n,i,a,null===(s=e.page)||void 0===s?void 0:s._exportingOrRendering,u]),o.useEffect(()=>()=>{f&&"CANVAS"===f.nodeName&&v.Util.releaseCanvas(f)},[f]),[f||t,w]};export const useClip=(e,t,r,i)=>{const[n,a]=B(e.clipSrc||""),s=e.clipSrc?a:"loaded";useLoader(s,e.clipSrc,e.id);const d=!!t&&!!n,c=o.useMemo(()=>d?{canvas:document.createElement("canvas"),mask:document.createElement("canvas"),width:0,height:0}:void 0,[d]),h=null==c?void 0:c.canvas;function l(){if(!c||!h||!t){return}const{width:i,height:o}=N(t);if(!i||!o){return}const n=Math.min(1e4,Math.max(i,Math.ceil(e.a.width*r),1)),a=Math.min(1e4,Math.max(o,Math.ceil(e.a.height*r),1));c.width===n&&c.height===a||(Z(h,n,a),c.width=n,c.height=a);const s=h.getContext("2d");s&&(s.clearRect(0,0,h.width,h.height),s.save(),s.drawImage(c.mask,0,0,h.width,h.height),s.globalCompositeOperation="source-in",s.drawImage(t,0,0,h.width,h.height),s.restore())}return o.useLayoutEffect(()=>{var t;if(!c||!(null==n?void 0:n.width)||!n.height){return}const i=Math.max(e.a.width/n.width*r,e.a.height/n.height*r);Z(c.mask,Math.min(1e4,Math.max(n.width*i,1)),Math.min(1e4,Math.max(n.height*i,1))),null===(t=c.mask.getContext("2d"))||void 0===t||t.drawImage(n,0,0,c.mask.width,c.mask.height)},[c,n,e.a.width,e.a.height,r]),o.useLayoutEffect(()=>{l()},[c,t,n,e.a.width,e.a.height,r,...i]),o.useEffect(()=>()=>{c&&v.Util.releaseCanvas(c.canvas,c.mask)},[c]),[d?h:t,l]};const J=document.createElement("canvas"),K=n(({element:r})=>{const n=Math.min(30,r.width/4,r.height/4),a=o.useRef(null);o.useEffect(()=>{const e=a.current;if(!e){return}const t=new v.Animation(t=>{e.rotate(((null==t?void 0:t.timeDiff)||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});const{mediaLoadingStyle:s}=w();return t(c,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:i(r),hideInExport:!r.showInExport,children:[e(l,{width:r.width,height:r.height,fill:s.fill}),e(d,{ref:a,x:r.width/2,y:r.height/2,fill:s.textFill,outerRadius:Math.abs(n),innerRadius:Math.max(1,n-5),angle:270})]})}),Q=n(({element:r})=>{const{mediaErrorStyle:o}=w(),n=Math.max(10,Math.min(30,r.width/25));return t(c,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:i(r),hideInExport:!r.showInExport,children:[e(l,{width:r.width,height:r.height,fill:o.fill}),e(u,{text:"Can not load the video...",fontSize:n,width:r.width,height:r.height,align:"center",fill:o.textFill,verticalAlign:"middle",padding:5})]})});let ee=function(e,t,r){const i=o.useRef("loading"),n=o.useRef(void 0),[a,s]=o.useState(0),d=o.useRef(void 0),c=o.useRef(void 0),h=o.useRef(void 0);return d.current===e&&c.current===t&&h.current===r||(i.current="loading",n.current=void 0,d.current=e,c.current=t,h.current=r),o.useLayoutEffect(()=>{if(!e){return}const o=p(e)?1:g;let a,d,c,h=0,l=!1,u=!1;const m=e=>{e&&(e.removeAttribute("src"),e.load())},v=()=>{h+=1;const g=document.createElement("video");function p(){l||(g.removeEventListener("canplay",p),u=!0,i.current="loaded",n.current=g,g.currentTime=0,s(Math.random()))}function w(e){var t;const r=4===g.readyState,c=g.buffered&&g.buffered.length>0&&g.buffered.end(g.buffered.length-1)/g.duration*100>=100;if(r&&c){return}if(l){return}if(!u&&h<o){return null==d||d(),m(g),void(a=setTimeout(v,f(h)))}const p=e.message||(null===(t=g.error)||void 0===t?void 0:t.message)||"Unknown error";console.error(new Error("Video failed to load: "+p)),i.current="failed",n.current=void 0,s(Math.random())}c=g,g.addEventListener("canplay",p),g.addEventListener("error",w),d=()=>{g.removeEventListener("canplay",p),g.removeEventListener("error",w)},t&&(g.crossOrigin=t),r&&(g.referrerPolicy=r),g.src=e,g.load()};return v(),()=>{l=!0,clearTimeout(a),null==d||d(),u||m(c)}},[e,t,r]),[n.current,i.current]};export const setVideoLoaderHook=e=>{ee=e};function te(e){return!e.seeking&&e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}export const useLoader=(e,t,r)=>{const i=o.useRef(void 0),n=()=>{var e;null===(e=i.current)||void 0===e||e.call(i),i.current=void 0};o.useEffect(()=>n,[]),o.useLayoutEffect(()=>{const o=t.slice(0,200),a=`video with id ${r} url: ${o}`;"loading"!==e||i.current||(i.current=x(a)),"loading"!==e&&n(),"failed"===e&&E(y("VIDEO_FAILED",a,{src:o,elementId:r,reason:"load"}))},[e])};export const VideoElement=n(({element:n,store:d})=>{var u,g,p;const[f,w]=o.useState(!1),E=o.useRef(null),y=n.isSelected,[D,V]=o.useState(!1),[U,Z]=ee(n.src,"anonymous"),[B,re]=o.useState(!1),ie=d.activePage===n.page,oe=(null===(u=n.page)||void 0===u?void 0:u._exportingOrRendering)&&"loaded"===Z,ne=W(n,d,oe);useLoader(Z,n.src,n.id),U&&(U.playsInline=!0);const ae=((e,t,r)=>{const i=o.useMemo(()=>{var i,o;const{flipX:n,flipY:a}=e,s="svg"===e.type||L.isSvgUrl(e.src),d=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;if(!(n||a||d&&s)){return t}if(!t){return null}const{width:c,height:h}=N(t);if(!c||!h){return null}const l=document.createElement("canvas");let u=1;"svg"===e.type&&(u=Math.max(e.width/c*r,e.height/h*r)),l.width=Math.max(c*u,1),l.height=Math.max(h*u,1);let m=n?-l.width:0,g=a?-l.height:0;return null===(i=l.getContext("2d"))||void 0===i||i.scale(n?-1:1,a?-1:1),null===(o=l.getContext("2d"))||void 0===o||o.drawImage(t,m,g,l.width,l.height),l},[e.flipX,e.flipY,t,e.width,e.height,r]);return o.useEffect(()=>()=>{i&&"CANVAS"===i.nodeName&&v.Util.releaseCanvas(i)},[i]),i})(n,U,d._elementsPixelRatio),se=oe&&ne||ae||J,[de=J,ce]=P(n,se);o.useEffect(()=>{U&&d.history.ignore(()=>{n.set({duration:1e3*U.duration})})},[U]);const he=o.useMemo(Y,[U]);o.useEffect(()=>{var e;if(!U){return}const t=d.animatedElementsIds,r=(!t.length||t.includes(n.id))&&d.isPlaying;if(!ie||!r&&!D){return void U.pause()}D&&(U.muted=!1,U.currentTime=n.startTime*U.duration,H(U).then(e=>{"refused"===e&&V(!1)}));const i=new v.Animation(()=>{ke()},null===(e=E.current)||void 0===e?void 0:e.getLayer());i.start();const o=()=>{V(!1),U.currentTime=n.startTime*U.duration},a=()=>{U.currentTime>=n.endTime*U.duration&&(U.pause(),U.currentTime=n.startTime*U.duration,V(!1))};return U.addEventListener("ended",o),U.addEventListener("timeupdate",a),()=>{U.pause(),i.stop(),U.removeEventListener("ended",o),U.removeEventListener("timeupdate",a)}},[U,D,d.isPlaying,ie]),o.useEffect(()=>{U&&(U.volume=n.volume)},[U,n.volume]),o.useEffect(()=>{U&&(U.playbackRate=n.speed,U.preservesPitch=!1)},[U,n.speed]);const le=o.useRef(null);o.useEffect(()=>{const e=s(n,()=>{var e,t;if(U){if(oe&&ne){return ke(),void d.currentTime}const r=d.animatedElementsIds;if(r.length&&!r.includes(n.id)){return}const i=d.activePage===n.page,o=d.currentTime>=n.page.startTime&&d.currentTime<n.page.startTime+n.page.duration,a=n.startTime*U.duration*1e3,s=U.duration*(n.endTime-n.startTime)*1e3,{start:c,end:h}=_(n.animations,n.page.duration),l=(d.currentTime||n.page.startTime)-n.page.startTime,u=o?z(d.currentTime,n.page.startTime,c,s,a,n.speed):0,m=u/1e3,g=o&&l>=c&&l<h;D||(U.muted=!g,g&&d.isPlaying&&i?U.paused?(U.currentTime=m,he.play(U)):Math.abs(1e3*U.currentTime-u)>500&&(U.currentTime=m):(he.reset(),U.paused||U.pause(),m!==U.currentTime&&(U.currentTime=m),!te(U)&&!d.isPlaying&&!le.current&&(le.current=x(`video ${n.id}`)))),ke(),null===(t=null===(e=E.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()}});return()=>{e(),le.current&&(le.current(),le.current=null)}},[d,U,oe,ne,D]),o.useEffect(()=>{var e,t;if(!U){return}if(oe){return null===(e=le.current)||void 0===e||e.call(le),void(le.current=null)}const r=()=>{var e;te(U)&&(ke(),null===(e=le.current)||void 0===e||e.call(le),le.current=null)};let i;return(null===(t=n.page)||void 0===t?void 0:t._exportingOrRendering)&&(i=setInterval(r,20)),U.addEventListener("timeupdate",r),U.addEventListener("canplay",r),U.addEventListener("seeked",r),()=>{clearInterval(i),U.removeEventListener("timeupdate",r),U.removeEventListener("canplay",r),U.removeEventListener("seeked",r)}},[null===(g=n.page)||void 0===g?void 0:g._exportingOrRendering,U,n.id,x,oe]);let{cropX:ue,cropY:me,cropWidth:ge,cropHeight:pe}=n;"loaded"!==Z&&(ue=me=0,ge=pe=1);const{width:fe,height:ve}=N(de),we=M({stretchEnabled:n.stretchEnabled,cropX:ue,cropY:me,cropWidth:ge,cropHeight:pe,width:n.a.width,height:n.a.height},{width:fe,height:ve}),xe=we.width,Ee=we.height,ye=n.stretchEnabled,Me=null!==(p=n.cornerRadius)&&void 0!==p?p:0,[Le,be]=useCornerRadiusAndCrop(n,de,we,d._elementsPixelRatio,Me,!0);let[Ce,Te]=useClip(n,Le,d._elementsPixelRatio,[we,Me,d._elementsPixelRatio]);const ke=A(()=>{var e,t;ce(),be(),Te(),null===(t=null===(e=E.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()});o.useEffect(()=>{ke()});const Ie=()=>{n._cropEnabled&&setTimeout(()=>{a(n)&&n.toggleCropMode(!0)})},Re="loading"===Z,je="failed"===Z,Se=!Re&&!je,Pe=o.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Ae=o.useRef(!1),Oe=Se?i(n):0;O(E,Oe);const Xe=n.selectable||d.role===m.ADMIN,Ye=X();return e(r,{children:t(c,{onMouseEnter:()=>re(!0),onMouseLeave:()=>re(!1),children:[Re&&e(K,{element:n}),je&&e(Q,{element:n}),e(h,{ref:E,name:"element",id:n.id,image:Ce,x:n.a.x,y:n.a.y,width:n.a.width||1,height:n.a.height||1,rotation:n.a.rotation,opacity:Oe,shadowEnabled:n.shadowEnabled,shadowBlur:n.shadowBlur,shadowOffsetX:n.shadowOffsetX,shadowOffsetY:n.shadowOffsetY,shadowColor:n.shadowColor,shadowOpacity:n.shadowOpacity,customCrop:we,listening:Xe,draggable:Ye?n.draggable&&y:n.draggable,preventDefault:!Ye||y,hideInExport:!n.showInExport,onDragMove:e=>{n.set({x:e.target.x(),y:e.target.y()})},onDragEnd:e=>{n.set(I(e.target))},onDblClick:Ie,onDblTap:Ie,onTransformStart:e=>{w(!0),Ae.current=R(C(e.target)),Pe.current={cropX:n.cropX,cropY:n.cropY,cropWidth:n.cropWidth,cropHeight:n.cropHeight}},onTransform:e=>{const t=e.currentTarget,r=Math.abs(t.scaleX()-1)<1e-7?1:t.scaleX(),i=Math.abs(t.scaleY()-1)<1e-7?1:t.scaleY();t.scaleX(1),t.scaleY(1);const o=1-xe/fe,a=Math.min(o,Math.max(0,n.cropX)),s=1-Ee/ve,d=Math.min(s,Math.max(0,n.cropY)),c=Ae.current,h=!c&&r<1&&Pe.current.cropHeight>Ee/ve;let l=c?n.cropWidth:n.cropWidth*r;h&&(l=n.cropWidth);const u=!c&&i<1&&Pe.current.cropWidth>xe/fe;let m=c?n.cropHeight:n.cropHeight*i;u&&(m=n.cropHeight),ye&&(l=n.cropWidth,m=n.cropHeight);const g=c?Math.min(r,i):1;n.set(Object.assign({cropX:a,cropY:d,x:t.x(),y:t.y(),width:t.width()*r,height:t.height()*i,rotation:e.target.rotation(),cropWidth:Math.min(l,1-a),cropHeight:Math.min(m,1-d)},1!==g&&Object.assign(Object.assign({},j(n,g)),{borderSize:n.borderSize*g})))},onTransformEnd:e=>{const t=e.currentTarget;n.set(Object.assign(Object.assign({width:k(t.width()),height:k(t.height()),x:k(t.x()),y:k(t.y()),rotation:k(e.target.rotation()),cropX:T(n.cropX),cropY:T(n.cropY),cropWidth:T(xe/fe),cropHeight:T(Ee/ve)},S(n)),{borderSize:b(n.borderSize)})),w(!1)}}),e(l,{x:n.a.x,y:n.a.y,width:Math.max(n.a.width-n.borderSize,0),height:Math.max(n.a.height-n.borderSize,0),opacity:Oe,offsetX:-n.borderSize/2,offsetY:-n.borderSize/2,stroke:n.borderColor,strokeWidth:n.borderSize,listening:!1,visible:!!n.borderSize,rotation:n.rotation,cornerRadius:Math.max(0,Me-n.borderSize),hideInExport:!n.showInExport}),!d.isPlaying&&e(h,{image:D?B||Ye?G:void 0:q,x:n.a.x,y:n.a.y,offsetX:-n.a.width/2+15/d.scale,offsetY:-n.a.height/2+15/d.scale,rotation:n.a.rotation,width:30/d.scale,height:30/d.scale,hideInExport:!0,onClick:()=>V(!D),onTap:()=>V(!D)}),n._cropModeEnabled&&e(F,{element:n,store:d,previewImage:Ce,sourceImage:de,sourceWidth:fe,sourceHeight:ve,cropAbsoluteWidth:xe,cropAbsoluteHeight:Ee,innerAnchors:$})]})})});
@@ -65,7 +65,7 @@ export type WorkspaceProps = {
65
65
  right?: number;
66
66
  };
67
67
  };
68
- export declare const WorkspaceCanvas: (({ store, layout, pageControlsEnabled, backgroundColor, transparencyBackgroundColor, pageBorderColor, activePageBorderColor, bleedColor, snapGuideStroke, snapGuideStrokeWidth, snapGuideDash, selectionRectFill, selectionRectStroke, selectionRectStrokeWidth, transformLabelFill, transformLabelTextFill, cropOverlayFill, cropGridStyle, transformerStyle, innerImageCropTransformerStyle, outerImageCropTransformerStyle, highlighterStyle, mediaLoadingStyle, mediaErrorStyle, textOverflowIndicatorStyle, distanceGuideStroke, distanceLabelFill, distanceLabelTextFill, rulerBackgroundColor, rulerTextColor, rulerBorderColor, rulerBorderSize, rulerTickColor, rulerTickSize, components, onKeyDown, onPaste, paddingX, paddingY, pageGap, altCloneEnabled, groupSelectionMode, visiblePagesOffset, renderOnlyActivePage, scrollToPageThreshold, tooltipSafeArea, }: WorkspaceProps) => React.JSX.Element) & {
69
- displayName: string;
68
+ export declare const WorkspaceCanvas: (({ store, layout, pageControlsEnabled, backgroundColor, transparencyBackgroundColor, pageBorderColor, activePageBorderColor, bleedColor, snapGuideStroke, snapGuideStrokeWidth, snapGuideDash, selectionRectFill, selectionRectStroke, selectionRectStrokeWidth, transformLabelFill, transformLabelTextFill, cropOverlayFill, cropGridStyle, transformerStyle, innerImageCropTransformerStyle, outerImageCropTransformerStyle, highlighterStyle, mediaLoadingStyle, mediaErrorStyle, textOverflowIndicatorStyle, distanceGuideStroke, distanceLabelFill, distanceLabelTextFill, rulerBackgroundColor, rulerTextColor, rulerBorderColor, rulerBorderSize, rulerTickColor, rulerTickSize, components, onKeyDown, onPaste, paddingX, paddingY, pageGap, altCloneEnabled, groupSelectionMode, visiblePagesOffset, renderOnlyActivePage, scrollToPageThreshold, tooltipSafeArea, }: WorkspaceProps) => React.JSX.Element) & React.NamedExoticComponent<WorkspaceProps> & {
69
+ readonly type: ({ store, layout, pageControlsEnabled, backgroundColor, transparencyBackgroundColor, pageBorderColor, activePageBorderColor, bleedColor, snapGuideStroke, snapGuideStrokeWidth, snapGuideDash, selectionRectFill, selectionRectStroke, selectionRectStrokeWidth, transformLabelFill, transformLabelTextFill, cropOverlayFill, cropGridStyle, transformerStyle, innerImageCropTransformerStyle, outerImageCropTransformerStyle, highlighterStyle, mediaLoadingStyle, mediaErrorStyle, textOverflowIndicatorStyle, distanceGuideStroke, distanceLabelFill, distanceLabelTextFill, rulerBackgroundColor, rulerTextColor, rulerBorderColor, rulerBorderSize, rulerTickColor, rulerTickSize, components, onKeyDown, onPaste, paddingX, paddingY, pageGap, altCloneEnabled, groupSelectionMode, visiblePagesOffset, renderOnlyActivePage, scrollToPageThreshold, tooltipSafeArea, }: WorkspaceProps) => React.JSX.Element;
70
70
  };
71
71
  export default WorkspaceCanvas;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import r from"react";import{observer as o}from"mobx-react-lite";import n from"./page.js";import{TopRules as l}from"./rules.js";import{AudioElement as i}from"./audio.js";import{handleHotkey as s,handleCopyEvent as a,handleCutEvent as c,handlePasteEvent as u}from"./hotkeys.js";import{t as d}from"../utils/l10n.js";import{WorkspaceStyleProvider as h,useResolvedWorkspaceStyle as g}from"./workspace-style.js";const p=(e,t,r)=>Math.max(t,Math.min(r,e)),f=(e,t)=>Math.sqrt(Math.pow(t.clientX-e.clientX,2)+Math.pow(t.clientY-e.clientY,2)),m=({store:r})=>t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"},children:[e("p",{children:d("workspace.noPages")}),e("button",{onClick:()=>{r.addPage()},children:d("workspace.addPage")})]}),v=({width:t,height:r,xPadding:o,yPadding:n,backgroundColor:l})=>e("div",{style:{width:t+"px",height:r+"px",backgroundColor:l,paddingLeft:o+"px",paddingRight:o+"px",paddingTop:n+"px",paddingBottom:n+"px",flexShrink:0},children:e("div",{style:{width:" 100%",height:"100%",backgroundColor:"white"}})});export const WorkspaceCanvas=o(({store:o,layout:d="vertical",pageControlsEnabled:w,backgroundColor:x,transparencyBackgroundColor:y,pageBorderColor:L,activePageBorderColor:T,bleedColor:b,snapGuideStroke:k,snapGuideStrokeWidth:S,snapGuideDash:E,selectionRectFill:M,selectionRectStroke:C,selectionRectStrokeWidth:P,transformLabelFill:R,transformLabelTextFill:F,cropOverlayFill:W,cropGridStyle:B,transformerStyle:O,innerImageCropTransformerStyle:z,outerImageCropTransformerStyle:j,highlighterStyle:N,mediaLoadingStyle:H,mediaErrorStyle:G,textOverflowIndicatorStyle:I,distanceGuideStroke:_,distanceLabelFill:Y,distanceLabelTextFill:D,rulerBackgroundColor:X,rulerTextColor:A,rulerBorderColor:K,rulerBorderSize:q,rulerTickColor:V,rulerTickSize:J,components:Q,onKeyDown:U,onPaste:Z,paddingX:$,paddingY:ee,pageGap:te,altCloneEnabled:re=!0,groupSelectionMode:oe="drill",visiblePagesOffset:ne,renderOnlyActivePage:le,scrollToPageThreshold:ie=.5,tooltipSafeArea:se})=>{var ae;const ce="horizontal"===d,ue=null!=$?$:20,de=null!=ee?ee:55,[he,ge]=r.useState({width:100,height:100}),pe=r.useRef(he),fe=r.useRef(null),me=r.useRef(null),ve=r.useRef(0);let we=0,xe=0,ye=0,Le=0;if(o.bleedVisible){for(const e of o.pages){const t=e.computedBleed;we=Math.max(we,t.left),xe=Math.max(xe,t.right),ye=Math.max(ye,t.top),Le=Math.max(Le,t.bottom)}}const Te=Math.max(...o.pages.map(e=>e.computedWidth)),be=Math.max(...o.pages.map(e=>e.computedHeight)),ke=(null===(ae=o.activePage)||void 0===ae?void 0:ae.computedHeight)||0,Se=Te+we+xe,Ee=(le?ke:be)+ye+Le,Me=async({skipTimeout:e}={skipTimeout:!1})=>{if(e||await new Promise(e=>setTimeout(e,50)),null===fe.current){return}if(!Number.isFinite(Se)||!Number.isFinite(Ee)){return}const t=fe.current.getBoundingClientRect();0!==t.width&&0!==t.height||(console.warn("Polotno warning: <Workspace /> component can not automatically detect its size.\nWidth or height of parent elements is equal 0.\nPlease make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.\nFor simpler debugging here is the log of the parent element:"),console.log(fe.current));const r=me.current.clientWidth||t.width,n={width:r,height:t.height};(pe.current.width!==n.width||pe.current.height!==n.height)&&(ge(n),pe.current=n);const l=(r-2*ue)/Se,i=o.pages.length>1?3.1:2,s=(t.height-de*i)/Ee,a=o.pages.length>1?3.1:2,c=(r-ue*a)/Se,u=(t.height-2*de)/Ee,d=o.pages.length?Math.max(Math.min(ce?c:l,ce?u:s),.01):1;o.scaleToFit!==d&&(o.setScale(d),o._setScaleToFit(d))};r.useLayoutEffect(()=>{Me({skipTimeout:!0})},[]),r.useEffect(()=>{Me()},[Se,Ee,ee,$]),r.useLayoutEffect(()=>{Me({skipTimeout:!0})},[o.openedSidePanel]),r.useEffect(()=>{o.__()},[]),r.useEffect(()=>{const e=fe.current;if(window.ResizeObserver){const t=new ResizeObserver(()=>{Me({skipTimeout:!0})});return t.observe(e),()=>t.unobserve(e)}{const e=setInterval(()=>{Me({skipTimeout:!0})},100);return()=>clearInterval(e)}},[Se,Ee]);const Ce=le?1:o.pages.length;let Pe,Re;if(ce){const e=Se*o.scale*Ce;Pe=Math.max(ue,(he.width-e)/Ce/2),Re=Math.max(de,(he.height-Ee*o.scale)/2)}else{Pe=Math.max(ue,(he.width-Se*o.scale)/2);const e=Ee*o.scale*Ce;Re=Math.max(de,(he.height-e)/Ce/2)}Number.isNaN(Pe)&&(Pe=ue),Number.isNaN(Re)&&(Re=de),r.useEffect(()=>{const e=e=>{(U||s)(e,o)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),r.useEffect(()=>{const e=e=>a(e,o),t=e=>c(e,o),r=e=>(Z||u)(e,o);return window.addEventListener("copy",e),window.addEventListener("cut",t),window.addEventListener("paste",r),()=>{window.removeEventListener("copy",e),window.removeEventListener("cut",t),window.removeEventListener("paste",r)}},[Z]),r.useEffect(()=>{const e=e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();const t=Math.max(5,o.scaleToFit);let r=Math.min(.1,o.scaleToFit);ce&&Se>0&&Number.isFinite(Se)&&(r=Math.max(r,300/Se)),r=Math.max(r,.01);const n=.03,l=p(e.deltaY<0?o.scale*(1+n):o.scale/(1+n),r,t);return void o.setScale(l)}},t=me.current;return null==t||t.addEventListener("wheel",e),()=>null==t?void 0:t.removeEventListener("wheel",e)},[ce,Se,o]),r.useEffect(()=>{const e=me.current;if(!e){return}const t=e=>{2===e.touches.length&&(ve.current=f(e.touches[0],e.touches[1]))},r=t=>{if(2===t.touches.length&&ve.current>0){t.preventDefault();const r=f(t.touches[0],t.touches[1]),n=r/ve.current,l=Math.max(5,o.scaleToFit);let i=Math.min(.1,o.scaleToFit);ce&&Se>0&&Number.isFinite(Se)&&(i=Math.max(i,300/Se)),i=Math.max(i,.01);const s=o.scale,a=p(s*n,i,l),c=a/s,u=e.getBoundingClientRect(),d=(t.touches[0].clientX+t.touches[1].clientX)/2-u.left,h=(t.touches[0].clientY+t.touches[1].clientY)/2-u.top,g=e.scrollLeft+d,m=e.scrollTop+h;Ne.current=!0,o.setScale(a),e.scrollLeft=g*c-d,e.scrollTop=m*c-h,ve.current=r}},n=()=>{ve.current=0};return e.addEventListener("touchstart",t,{passive:!0}),e.addEventListener("touchmove",r,{passive:!1}),e.addEventListener("touchend",n,{passive:!0}),()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchmove",r),e.removeEventListener("touchend",n)}},[ce,Se,o]);const Fe=void 0!==te,We=o.pages.map(e=>{if(ce){const t=(e.computedWidth+we+xe)*o.scale;return Fe?t+te:t+2*Pe}{const t=(e.computedHeight+ye+Le)*o.scale;return Fe?t+te:t+2*Re}}),Be=[];let Oe=Fe?ce?Pe:Re:0;for(let e=0;e<We.length;e++){Be.push(Oe),Oe+=We[e]}const ze=We.reduce((e,t)=>e+t,0),je=Fe?ze+(ce?2*Pe:2*Re):ze,Ne=r.useRef(!1),[,He]=r.useReducer(e=>e+1,0);((e,t,o,n,l)=>{const i=r.useRef(0),s=r.useRef(0),a=r.useRef(null),c=r.useRef(null),u=r.useRef(!1),d=r.useRef(n.pages.length);u.current=d.current!==n.pages.length,d.current=n.pages.length,r.useEffect(()=>{const t=e.current,r=()=>{i.current=t.scrollLeft,s.current=t.scrollTop,a.current=t.scrollWidth,c.current=t.scrollHeight};return t.addEventListener("scroll",r),r(),()=>{t.removeEventListener("scroll",r)}},[]),r.useLayoutEffect(()=>{if(!e.current){return}if(u.current){const t=e.current;return a.current=t.scrollWidth,c.current=t.scrollHeight,i.current=t.scrollLeft,void(s.current=t.scrollTop)}const t=e.current,r=a.current,o=c.current;if(null===r||null===o){return a.current=t.scrollWidth,c.current=t.scrollHeight,i.current=t.scrollLeft,void(s.current=t.scrollTop)}l.current=!0;const n=t.offsetWidth,d=t.offsetHeight,h=(i.current+n/2)/r,g=(s.current+d/2)/o,f=Math.max(0,t.scrollWidth-n),m=Math.max(0,t.scrollHeight-d);t.scrollLeft=p(h*t.scrollWidth-n/2,0,f),t.scrollTop=p(g*t.scrollHeight-d/2,0,m),a.current=t.scrollWidth,c.current=t.scrollHeight,i.current=t.scrollLeft,s.current=t.scrollTop},[o,t])})(me,je,o.scale,o,Ne);const{handleScroll:Ge}=((e,t,o,n,l,i,s,a,c,u)=>{const d=r.useRef(!1),h=r.useRef(null),g=r.useRef(!1),p="horizontal"===c;r.useEffect(()=>{const t=e.current,r=()=>{s.current};return t.addEventListener("scroll",r),()=>{t.removeEventListener("scroll",r)}},[]);const f=n.pages.indexOf(n.activePage);return r.useLayoutEffect(()=>{if(a){return}if(!n.activePage){return}if(!e.current){return}if(d.current){return}const r=e.current,i=n.pages.indexOf(n.activePage),s=t[i]||0,c=p?r.scrollLeft:r.scrollTop,h=p?r.scrollWidth-r.clientWidth:r.scrollHeight-r.clientHeight,f=Math.min(s,Math.max(0,h)),m=o[i]||o[0]||0;let v=()=>{};return(Math.abs(f-c)>m*l||g.current)&&(g.current=!0,v=(({element:e,scrollTop:t,scrollLeft:r,duration:o=300,onFinish:n=()=>{}})=>{const l=void 0!==t,i=l?e.scrollTop:e.scrollLeft,s=l?t:r,a=s-i;let c=0,u=!1;if(0===o){return l?e.scrollTop=s:e.scrollLeft=s,()=>{}}const d=()=>{if(u){return}c+=20;const t=h(c,i,a,o);l?e.scrollTop=t:e.scrollLeft=t,c<o?setTimeout(d,20):n()},h=(e,t,r,o)=>(e/=o/2)<1?r/2*e*e+t:-r/2*(--e*(e-2)-1)+t;return d(),()=>{u=!0}})(Object.assign(Object.assign({element:r},p?{scrollLeft:f}:{scrollTop:f}),{onFinish:()=>{g.current=!1,null==u||u()},duration:n.isPlaying?0:300}))),v},[n.activePage,f,n.isPlaying,a,c,t,o]),{handleScroll:e=>{if(a){return}if(g.current){return}d.current=!0,clearTimeout(h.current),h.current=setTimeout(()=>{d.current=!1},300);const r=(p?e.currentTarget.scrollLeft:e.currentTarget.scrollTop)+(p?i.width:i.height)/3;let o=0;for(let n=t.length-1;n>=0;n--){if(r>=t[n]){o=n;break}}const l=n.pages[o];l&&n.activePage!==l&&l.select()}}})(me,Be,We,o,ie,he,Ne,le,d,He),Ie=he.width>=Se*o.scale+2*Pe,_e=he.height>=Ee*o.scale+2*Re,Ye=x||"rgba(232, 232, 232, 0.9)",De=(null==Q?void 0:Q.NoPages)||m,Xe=ce?he.width:he.height,Ae=me.current?ce?me.current.scrollLeft:me.current.scrollTop:0,Ke=e=>{for(let t=Be.length-1;t>=0;t--){if(e>=Be[t]){return t}}return 0},qe=Math.max(0,Ke(Ae)),Ve=Math.min(o.pages.length-1,Ke(Ae+Xe)),Je=null!=ne?ne:1,Qe=Math.max(0,qe-Je),Ue=Math.min(o.pages.length-1,Ve+Je),Ze=g({cropOverlayFill:W,cropGridStyle:B,workspaceBackgroundColor:x,pageBorderColor:L,activePageBorderColor:T,bleedColor:b,transparencyBackgroundColor:y,transformerStyle:O,innerImageCropTransformerStyle:z,outerImageCropTransformerStyle:j,highlighterStyle:N,snapGuideStroke:k,snapGuideStrokeWidth:S,snapGuideDash:E,selectionRectFill:M,selectionRectStroke:C,selectionRectStrokeWidth:P,transformLabelFill:R,transformLabelTextFill:F,distanceGuideStroke:_,distanceLabelFill:Y,distanceLabelTextFill:D,mediaLoadingStyle:H,mediaErrorStyle:G,textOverflowIndicatorStyle:I,rulerBackgroundColor:X,rulerTextColor:A,rulerBorderColor:K,rulerBorderSize:q,rulerTickColor:V,rulerTickSize:J});return e(h,{value:Ze,children:e("div",{ref:fe,style:{width:"100%",height:"100%",position:"relative",outline:"none",flex:1,backgroundColor:Ye,overflow:"hidden"},tabIndex:0,className:"polotno-workspace-container",children:t("div",{ref:me,onScroll:Ge,style:Object.assign({position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",flexDirection:ce?"row":"column",overflow:"auto",overflowX:ce?"auto":Ie?"hidden":"auto",overflowY:ce&&_e?"hidden":"auto"},Fe&&{paddingTop:ce?0:Re,paddingBottom:ce?0:Re,paddingLeft:ce?Pe:0,paddingRight:ce?Pe:0,boxSizing:"border-box"}),className:"polotno-workspace-inner",children:[o.pages.map((t,r)=>{const l=t===o.activePage;if(le&&!l&&!t._exportingOrRendering&&!t._forceMount){return null}const i=l||r>=Qe&&r<=Ue||t._exportingOrRendering||t._forceMount,s=ce?We[r]:Se*o.scale+2*Pe,a=ce?Ee*o.scale+2*Re:We[r];if(!i){return e("div",{style:{flexShrink:0},children:e(v,{width:s,height:a,backgroundColor:Ye,xPadding:Pe,yPadding:Re})},t.id)}const c=e(n,{page:t,xPadding:Pe,yPadding:Re,width:s,height:a,store:o,pageControlsEnabled:w,altCloneEnabled:re,groupSelectionMode:oe,components:Q,viewportSize:he,layout:d,tooltipSafeArea:se},t.id);return(t._exportingOrRendering||t._forceMount)&&!l&&le?e("div",{style:{display:"none",flexShrink:0},children:c},t.id):c}),o.rulesVisible&&e(l,{store:o,xPadding:Pe,yPadding:Re,width:Se*o.scale+2*Pe,height:Ee*o.scale+2*Re,pageSizes:We,layout:d,renderOnlyActivePage:le}),0===o.pages.length&&e(De,{store:o}),o.audios.map(t=>e(i,{audio:t,store:o},t.id))]})})})});export default WorkspaceCanvas;
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import r from"react";import{observer as o}from"mobx-react-lite";import n from"./page.js";import{TopRules as l}from"./rules.js";import{AudioElement as i}from"./audio.js";import{handleHotkey as s,handleCopyEvent as a,handleCutEvent as c,handlePasteEvent as u}from"./hotkeys.js";import{t as d}from"../utils/l10n.js";import{WorkspaceStyleProvider as h,useResolvedWorkspaceStyle as g}from"./workspace-style.js";const p=(e,t,r)=>Math.max(t,Math.min(r,e)),f=(e,t)=>Math.sqrt(Math.pow(t.clientX-e.clientX,2)+Math.pow(t.clientY-e.clientY,2)),m=({store:r})=>t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"},children:[e("p",{children:d("workspace.noPages")}),e("button",{onClick:()=>{r.addPage()},children:d("workspace.addPage")})]}),v=({width:t,height:r,xPadding:o,yPadding:n,backgroundColor:l})=>e("div",{style:{width:t+"px",height:r+"px",backgroundColor:l,paddingLeft:o+"px",paddingRight:o+"px",paddingTop:n+"px",paddingBottom:n+"px",flexShrink:0},children:e("div",{style:{width:" 100%",height:"100%",backgroundColor:"white"}})});export const WorkspaceCanvas=o(({store:o,layout:d="vertical",pageControlsEnabled:w,backgroundColor:x,transparencyBackgroundColor:y,pageBorderColor:L,activePageBorderColor:T,bleedColor:b,snapGuideStroke:k,snapGuideStrokeWidth:S,snapGuideDash:E,selectionRectFill:M,selectionRectStroke:C,selectionRectStrokeWidth:P,transformLabelFill:R,transformLabelTextFill:F,cropOverlayFill:W,cropGridStyle:B,transformerStyle:O,innerImageCropTransformerStyle:z,outerImageCropTransformerStyle:j,highlighterStyle:N,mediaLoadingStyle:H,mediaErrorStyle:G,textOverflowIndicatorStyle:I,distanceGuideStroke:_,distanceLabelFill:Y,distanceLabelTextFill:D,rulerBackgroundColor:X,rulerTextColor:A,rulerBorderColor:K,rulerBorderSize:q,rulerTickColor:V,rulerTickSize:J,components:Q,onKeyDown:U,onPaste:Z,paddingX:$,paddingY:ee,pageGap:te,altCloneEnabled:re=!0,groupSelectionMode:oe="drill",visiblePagesOffset:ne,renderOnlyActivePage:le,scrollToPageThreshold:ie=.5,tooltipSafeArea:se})=>{var ae;const ce="horizontal"===d,ue=null!=$?$:20,de=null!=ee?ee:55,[he,ge]=r.useState({width:100,height:100}),pe=r.useRef(he),fe=r.useRef(null),me=r.useRef(null),ve=r.useRef(0);let we=0,xe=0,ye=0,Le=0;if(o.bleedVisible){for(const e of o.pages){const t=e.computedBleed;we=Math.max(we,t.left),xe=Math.max(xe,t.right),ye=Math.max(ye,t.top),Le=Math.max(Le,t.bottom)}}const Te=Math.max(...o.pages.map(e=>e.computedWidth)),be=Math.max(...o.pages.map(e=>e.computedHeight)),ke=(null===(ae=o.activePage)||void 0===ae?void 0:ae.computedHeight)||0,Se=Te+we+xe,Ee=(le?ke:be)+ye+Le,Me=async({skipTimeout:e}={skipTimeout:!1})=>{if(e||await new Promise(e=>setTimeout(e,50)),null===fe.current){return}if(!Number.isFinite(Se)||!Number.isFinite(Ee)){return}const t=fe.current.getBoundingClientRect();0!==t.width&&0!==t.height||(console.warn("Polotno warning: <Workspace /> component can not automatically detect its size.\nWidth or height of parent elements is equal 0.\nPlease make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.\nFor simpler debugging here is the log of the parent element:"),console.log(fe.current));const r=me.current.clientWidth||t.width,n={width:r,height:t.height};(pe.current.width!==n.width||pe.current.height!==n.height)&&(ge(n),pe.current=n);const l=(r-2*ue)/Se,i=o.pages.length>1?3.1:2,s=(t.height-de*i)/Ee,a=o.pages.length>1?3.1:2,c=(r-ue*a)/Se,u=(t.height-2*de)/Ee,d=o.pages.length?Math.max(Math.min(ce?c:l,ce?u:s),.01):1;o.scaleToFit!==d&&(o.setScale(d),o._setScaleToFit(d))};r.useLayoutEffect(()=>{Me({skipTimeout:!0})},[]),r.useEffect(()=>{Me()},[Se,Ee,ee,$]),r.useLayoutEffect(()=>{Me({skipTimeout:!0})},[o.openedSidePanel]),r.useEffect(()=>{o.__()},[]),r.useEffect(()=>{const e=fe.current;if(window.ResizeObserver){const t=new ResizeObserver(()=>{Me({skipTimeout:!0})});return t.observe(e),()=>t.unobserve(e)}{const e=setInterval(()=>{Me({skipTimeout:!0})},100);return()=>clearInterval(e)}},[Se,Ee]);const Ce=le?1:o.pages.length;let Pe,Re;if(ce){const e=Se*o.scale*Ce;Pe=Math.max(ue,(he.width-e)/Ce/2),Re=Math.max(de,(he.height-Ee*o.scale)/2)}else{Pe=Math.max(ue,(he.width-Se*o.scale)/2);const e=Ee*o.scale*Ce;Re=Math.max(de,(he.height-e)/Ce/2)}Number.isNaN(Pe)&&(Pe=ue),Number.isNaN(Re)&&(Re=de),r.useEffect(()=>{const e=e=>{(U||s)(e,o)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),r.useEffect(()=>{const e=e=>a(e,o),t=e=>c(e,o),r=e=>(Z||u)(e,o);return window.addEventListener("copy",e),window.addEventListener("cut",t),window.addEventListener("paste",r),()=>{window.removeEventListener("copy",e),window.removeEventListener("cut",t),window.removeEventListener("paste",r)}},[Z]),r.useEffect(()=>{const e=e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();const t=Math.max(5,o.scaleToFit);let r=Math.min(.1,o.scaleToFit);ce&&Se>0&&Number.isFinite(Se)&&(r=Math.max(r,300/Se)),r=Math.max(r,.01);const n=.03,l=p(e.deltaY<0?o.scale*(1+n):o.scale/(1+n),r,t);return void o.setScale(l)}},t=me.current;return null==t||t.addEventListener("wheel",e),()=>null==t?void 0:t.removeEventListener("wheel",e)},[ce,Se,o]),r.useEffect(()=>{const e=me.current;if(!e){return}const t=e=>{2===e.touches.length&&(ve.current=f(e.touches[0],e.touches[1]))},r=t=>{if(2===t.touches.length&&ve.current>0){t.preventDefault();const r=f(t.touches[0],t.touches[1]),n=r/ve.current,l=Math.max(5,o.scaleToFit);let i=Math.min(.1,o.scaleToFit);ce&&Se>0&&Number.isFinite(Se)&&(i=Math.max(i,300/Se)),i=Math.max(i,.01);const s=o.scale,a=p(s*n,i,l),c=a/s,u=e.getBoundingClientRect(),d=(t.touches[0].clientX+t.touches[1].clientX)/2-u.left,h=(t.touches[0].clientY+t.touches[1].clientY)/2-u.top,g=e.scrollLeft+d,m=e.scrollTop+h;Ne.current=!0,o.setScale(a),e.scrollLeft=g*c-d,e.scrollTop=m*c-h,ve.current=r}},n=()=>{ve.current=0};return e.addEventListener("touchstart",t,{passive:!0}),e.addEventListener("touchmove",r,{passive:!1}),e.addEventListener("touchend",n,{passive:!0}),()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchmove",r),e.removeEventListener("touchend",n)}},[ce,Se,o]);const Fe=void 0!==te,We=o.pages.map(e=>{if(ce){const t=(e.computedWidth+we+xe)*o.scale;return Fe?t+te:t+2*Pe}{const t=(e.computedHeight+ye+Le)*o.scale;return Fe?t+te:t+2*Re}}),Be=[];let Oe=Fe?ce?Pe:Re:0;for(let e=0;e<We.length;e++){Be.push(Oe),Oe+=We[e]}const ze=We.reduce((e,t)=>e+t,0),je=Fe?ze+(ce?2*Pe:2*Re):ze,Ne=r.useRef(!1),[,He]=r.useReducer(e=>e+1,0);((e,t,o,n,l)=>{const i=r.useRef(0),s=r.useRef(0),a=r.useRef(null),c=r.useRef(null),u=r.useRef(!1),d=r.useRef(n.pages.length);u.current=d.current!==n.pages.length,d.current=n.pages.length,r.useEffect(()=>{const t=e.current,r=()=>{i.current=t.scrollLeft,s.current=t.scrollTop,a.current=t.scrollWidth,c.current=t.scrollHeight};return t.addEventListener("scroll",r),r(),()=>{t.removeEventListener("scroll",r)}},[]),r.useLayoutEffect(()=>{if(!e.current){return}if(u.current){const t=e.current;return a.current=t.scrollWidth,c.current=t.scrollHeight,i.current=t.scrollLeft,void(s.current=t.scrollTop)}const t=e.current,r=a.current,o=c.current;if(null===r||null===o){return a.current=t.scrollWidth,c.current=t.scrollHeight,i.current=t.scrollLeft,void(s.current=t.scrollTop)}l.current=!0;const n=t.offsetWidth,d=t.offsetHeight,h=(i.current+n/2)/r,g=(s.current+d/2)/o,f=Math.max(0,t.scrollWidth-n),m=Math.max(0,t.scrollHeight-d);t.scrollLeft=p(h*t.scrollWidth-n/2,0,f),t.scrollTop=p(g*t.scrollHeight-d/2,0,m),a.current=t.scrollWidth,c.current=t.scrollHeight,i.current=t.scrollLeft,s.current=t.scrollTop},[o,t])})(me,je,o.scale,o,Ne);const{handleScroll:Ge}=((e,t,o,n,l,i,s,a,c,u)=>{const d=r.useRef(!1),h=r.useRef(null),g=r.useRef(!1),p="horizontal"===c;r.useEffect(()=>{const t=e.current,r=()=>{s.current};return t.addEventListener("scroll",r),()=>{t.removeEventListener("scroll",r)}},[]);const f=n.pages.indexOf(n.activePage);return r.useLayoutEffect(()=>{if(a){return}if(!n.activePage){return}if(!e.current){return}if(d.current){return}const r=e.current,i=n.pages.indexOf(n.activePage),s=t[i]||0,c=p?r.scrollLeft:r.scrollTop,h=p?r.scrollWidth-r.clientWidth:r.scrollHeight-r.clientHeight,f=Math.min(s,Math.max(0,h)),m=o[i]||o[0]||0;let v=()=>{};return(Math.abs(f-c)>m*l||g.current)&&(g.current=!0,v=(({element:e,scrollTop:t,scrollLeft:r,duration:o=300,onFinish:n=()=>{}})=>{const l=void 0!==t,i=l?e.scrollTop:e.scrollLeft,s=l?t:r,a=s-i;let c=0,u=!1;if(0===o){return l?e.scrollTop=s:e.scrollLeft=s,()=>{}}const d=()=>{if(u){return}c+=20;const t=h(c,i,a,o);l?e.scrollTop=t:e.scrollLeft=t,c<o?setTimeout(d,20):n()},h=(e,t,r,o)=>(e/=o/2)<1?r/2*e*e+t:-r/2*(--e*(e-2)-1)+t;return d(),()=>{u=!0}})(Object.assign(Object.assign({element:r},p?{scrollLeft:f}:{scrollTop:f}),{onFinish:()=>{g.current=!1,null==u||u()},duration:n.isPlaying?0:300}))),v},[n.activePage,f,n.isPlaying,a,c]),{handleScroll:e=>{if(a){return}if(g.current){return}d.current=!0,clearTimeout(h.current),h.current=setTimeout(()=>{d.current=!1},300);const r=(p?e.currentTarget.scrollLeft:e.currentTarget.scrollTop)+(p?i.width:i.height)/3;let o=0;for(let n=t.length-1;n>=0;n--){if(r>=t[n]){o=n;break}}const l=n.pages[o];l&&n.activePage!==l&&l.select()}}})(me,Be,We,o,ie,he,Ne,le,d,He),Ie=he.width>=Se*o.scale+2*Pe,_e=he.height>=Ee*o.scale+2*Re,Ye=x||"rgba(232, 232, 232, 0.9)",De=(null==Q?void 0:Q.NoPages)||m,Xe=ce?he.width:he.height,Ae=me.current?ce?me.current.scrollLeft:me.current.scrollTop:0,Ke=e=>{for(let t=Be.length-1;t>=0;t--){if(e>=Be[t]){return t}}return 0},qe=Math.max(0,Ke(Ae)),Ve=Math.min(o.pages.length-1,Ke(Ae+Xe)),Je=null!=ne?ne:1,Qe=Math.max(0,qe-Je),Ue=Math.min(o.pages.length-1,Ve+Je),Ze=g({cropOverlayFill:W,cropGridStyle:B,workspaceBackgroundColor:x,pageBorderColor:L,activePageBorderColor:T,bleedColor:b,transparencyBackgroundColor:y,transformerStyle:O,innerImageCropTransformerStyle:z,outerImageCropTransformerStyle:j,highlighterStyle:N,snapGuideStroke:k,snapGuideStrokeWidth:S,snapGuideDash:E,selectionRectFill:M,selectionRectStroke:C,selectionRectStrokeWidth:P,transformLabelFill:R,transformLabelTextFill:F,distanceGuideStroke:_,distanceLabelFill:Y,distanceLabelTextFill:D,mediaLoadingStyle:H,mediaErrorStyle:G,textOverflowIndicatorStyle:I,rulerBackgroundColor:X,rulerTextColor:A,rulerBorderColor:K,rulerBorderSize:q,rulerTickColor:V,rulerTickSize:J});return e(h,{value:Ze,children:e("div",{ref:fe,style:{width:"100%",height:"100%",position:"relative",outline:"none",flex:1,backgroundColor:Ye,overflow:"hidden"},tabIndex:0,className:"polotno-workspace-container",children:t("div",{ref:me,onScroll:Ge,style:Object.assign({position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",flexDirection:ce?"row":"column",overflow:"auto",overflowX:ce?"auto":Ie?"hidden":"auto",overflowY:ce&&_e?"hidden":"auto"},Fe&&{paddingTop:ce?0:Re,paddingBottom:ce?0:Re,paddingLeft:ce?Pe:0,paddingRight:ce?Pe:0,boxSizing:"border-box"}),className:"polotno-workspace-inner",children:[o.pages.map((t,r)=>{const l=t===o.activePage;if(le&&!l&&!t._exportingOrRendering&&!t._forceMount){return null}const i=l||r>=Qe&&r<=Ue||t._exportingOrRendering||t._forceMount,s=ce?We[r]:Se*o.scale+2*Pe,a=ce?Ee*o.scale+2*Re:We[r];if(!i){return e("div",{style:{flexShrink:0},children:e(v,{width:s,height:a,backgroundColor:Ye,xPadding:Pe,yPadding:Re})},t.id)}const c=e(n,{page:t,xPadding:Pe,yPadding:Re,width:s,height:a,store:o,pageControlsEnabled:w,altCloneEnabled:re,groupSelectionMode:oe,components:Q,viewportSize:he,layout:d,tooltipSafeArea:se},t.id);return(t._exportingOrRendering||t._forceMount)&&!l&&le?e("div",{style:{display:"none",flexShrink:0},children:c},t.id):c}),o.rulesVisible&&e(l,{store:o,xPadding:Pe,yPadding:Re,width:Se*o.scale+2*Pe,height:Ee*o.scale+2*Re,pageSizes:We,layout:d,renderOnlyActivePage:le}),0===o.pages.length&&e(De,{store:o}),o.audios.map(t=>e(i,{audio:t,store:o},t.id))]})})})});export default WorkspaceCanvas;
@@ -0,0 +1,2 @@
1
+ import type { StoreType } from '../model/store.js';
2
+ export declare function useFadeStopFocus(store: StoreType, elementId: string, onSelectStop: (index: number) => boolean): void;
@@ -0,0 +1 @@
1
+ import e from"react";import{useEvent as t}from"./use-event.js";import{getFadeStopFocus as o,setFadeStopFocus as r}from"../utils/fade-overlay.js";export function useFadeStopFocus(n,s,u){const c=t(u);e.useEffect(()=>{const e={elementId:s,onSelectStop:c};return r(n,e),()=>{o(n)===e&&r(n,null)}},[n,s,c])}
@@ -3,111 +3,111 @@ export type IconComponent = ComponentType<{
3
3
  className?: string;
4
4
  }>;
5
5
  declare const defaults: {
6
- 'action.duplicate': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
7
- 'action.split': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
8
- 'action.rename': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
9
- 'action.remove': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
10
- 'action.lock': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
11
- 'action.unlock': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
12
- 'action.undo': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
13
- 'action.redo': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
14
- 'action.add': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
15
- 'action.more': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
16
- 'action.settings': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
17
- 'action.search': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
18
- 'action.close': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
19
- 'action.confirm': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
20
- 'action.none': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
21
- 'action.visible': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
22
- 'action.hidden': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
23
- 'action.dragHandle': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
24
- 'action.eyeDropper': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
25
- 'action.unmuted': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
26
- 'action.muted': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
27
- 'action.help': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
28
- 'ui.chevronUp': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
29
- 'ui.chevronDown': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
30
- 'ui.chevronLeft': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
31
- 'ui.chevronRight': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
32
- 'layering.menu': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
33
- 'layering.up': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
34
- 'layering.down': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
35
- 'layering.top': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
36
- 'layering.bottom': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
37
- 'text.bold': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
38
- 'text.italic': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
39
- 'text.underline': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
40
- 'text.strikethrough': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
41
- 'text.alignLeft': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
42
- 'text.alignCenter': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
43
- 'text.alignRight': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
44
- 'text.alignJustify': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
45
- 'text.valignTop': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
46
- 'text.valignMiddle': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
47
- 'text.valignBottom': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
48
- 'text.uppercase': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
49
- 'text.spacing': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
50
- 'text.bulletList': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
51
- 'text.numberedList': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
52
- 'text.paragraph': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
53
- 'text.richText': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
54
- 'text.uploadFont': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
55
- 'position.alignLeft': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
56
- 'position.alignCenter': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
57
- 'position.alignRight': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
58
- 'position.alignTop': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
59
- 'position.alignMiddle': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
60
- 'position.alignBottom': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
61
- 'position.distributeVertical': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
62
- 'position.distributeHorizontal': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
63
- 'sidePanel.templates': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
64
- 'sidePanel.text': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
65
- 'sidePanel.photos': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
66
- 'sidePanel.elements': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
67
- 'sidePanel.upload': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
68
- 'sidePanel.background': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
69
- 'sidePanel.pages': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
70
- 'sidePanel.layers': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
71
- 'sidePanel.resize': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
72
- 'sidePanel.draw': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
73
- 'sidePanel.videos': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
74
- 'toolbar.opacity': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
75
- 'toolbar.filters': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
76
- 'toolbar.aiWrite': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
77
- 'toolbar.duration': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
78
- 'toolbar.trim': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
79
- 'toolbar.flipHorizontal': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
80
- 'toolbar.flipVertical': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
81
- 'toolbar.zoomIn': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
82
- 'toolbar.zoomOut': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
83
- 'toolbar.crop': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
84
- 'download.export': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
85
- 'download.image': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
86
- 'download.pdf': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
87
- 'download.video': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
88
- 'draw.select': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
89
- 'draw.brush': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
90
- 'draw.highlighter': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
91
- 'background.colorPicker': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
92
- 'pagesTimeline.play': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
93
- 'pagesTimeline.pause': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
94
- 'pagesTimeline.rewind': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
6
+ 'action.duplicate': import("lucide-react").LucideIcon;
7
+ 'action.split': import("lucide-react").LucideIcon;
8
+ 'action.rename': import("lucide-react").LucideIcon;
9
+ 'action.remove': import("lucide-react").LucideIcon;
10
+ 'action.lock': import("lucide-react").LucideIcon;
11
+ 'action.unlock': import("lucide-react").LucideIcon;
12
+ 'action.undo': import("lucide-react").LucideIcon;
13
+ 'action.redo': import("lucide-react").LucideIcon;
14
+ 'action.add': import("lucide-react").LucideIcon;
15
+ 'action.more': import("lucide-react").LucideIcon;
16
+ 'action.settings': import("lucide-react").LucideIcon;
17
+ 'action.search': import("lucide-react").LucideIcon;
18
+ 'action.close': import("lucide-react").LucideIcon;
19
+ 'action.confirm': import("lucide-react").LucideIcon;
20
+ 'action.none': import("lucide-react").LucideIcon;
21
+ 'action.visible': import("lucide-react").LucideIcon;
22
+ 'action.hidden': import("lucide-react").LucideIcon;
23
+ 'action.dragHandle': import("lucide-react").LucideIcon;
24
+ 'action.eyeDropper': import("lucide-react").LucideIcon;
25
+ 'action.unmuted': import("lucide-react").LucideIcon;
26
+ 'action.muted': import("lucide-react").LucideIcon;
27
+ 'action.help': import("lucide-react").LucideIcon;
28
+ 'ui.chevronUp': import("lucide-react").LucideIcon;
29
+ 'ui.chevronDown': import("lucide-react").LucideIcon;
30
+ 'ui.chevronLeft': import("lucide-react").LucideIcon;
31
+ 'ui.chevronRight': import("lucide-react").LucideIcon;
32
+ 'layering.menu': import("lucide-react").LucideIcon;
33
+ 'layering.up': import("lucide-react").LucideIcon;
34
+ 'layering.down': import("lucide-react").LucideIcon;
35
+ 'layering.top': import("lucide-react").LucideIcon;
36
+ 'layering.bottom': import("lucide-react").LucideIcon;
37
+ 'text.bold': import("lucide-react").LucideIcon;
38
+ 'text.italic': import("lucide-react").LucideIcon;
39
+ 'text.underline': import("lucide-react").LucideIcon;
40
+ 'text.strikethrough': import("lucide-react").LucideIcon;
41
+ 'text.alignLeft': import("lucide-react").LucideIcon;
42
+ 'text.alignCenter': import("lucide-react").LucideIcon;
43
+ 'text.alignRight': import("lucide-react").LucideIcon;
44
+ 'text.alignJustify': import("lucide-react").LucideIcon;
45
+ 'text.valignTop': import("lucide-react").LucideIcon;
46
+ 'text.valignMiddle': import("lucide-react").LucideIcon;
47
+ 'text.valignBottom': import("lucide-react").LucideIcon;
48
+ 'text.uppercase': import("lucide-react").LucideIcon;
49
+ 'text.spacing': import("lucide-react").LucideIcon;
50
+ 'text.bulletList': import("lucide-react").LucideIcon;
51
+ 'text.numberedList': import("lucide-react").LucideIcon;
52
+ 'text.paragraph': import("lucide-react").LucideIcon;
53
+ 'text.richText': import("lucide-react").LucideIcon;
54
+ 'text.uploadFont': import("lucide-react").LucideIcon;
55
+ 'position.alignLeft': import("lucide-react").LucideIcon;
56
+ 'position.alignCenter': import("lucide-react").LucideIcon;
57
+ 'position.alignRight': import("lucide-react").LucideIcon;
58
+ 'position.alignTop': import("lucide-react").LucideIcon;
59
+ 'position.alignMiddle': import("lucide-react").LucideIcon;
60
+ 'position.alignBottom': import("lucide-react").LucideIcon;
61
+ 'position.distributeVertical': import("lucide-react").LucideIcon;
62
+ 'position.distributeHorizontal': import("lucide-react").LucideIcon;
63
+ 'sidePanel.templates': import("lucide-react").LucideIcon;
64
+ 'sidePanel.text': import("lucide-react").LucideIcon;
65
+ 'sidePanel.photos': import("lucide-react").LucideIcon;
66
+ 'sidePanel.elements': import("lucide-react").LucideIcon;
67
+ 'sidePanel.upload': import("lucide-react").LucideIcon;
68
+ 'sidePanel.background': import("lucide-react").LucideIcon;
69
+ 'sidePanel.pages': import("lucide-react").LucideIcon;
70
+ 'sidePanel.layers': import("lucide-react").LucideIcon;
71
+ 'sidePanel.resize': import("lucide-react").LucideIcon;
72
+ 'sidePanel.draw': import("lucide-react").LucideIcon;
73
+ 'sidePanel.videos': import("lucide-react").LucideIcon;
74
+ 'toolbar.opacity': import("lucide-react").LucideIcon;
75
+ 'toolbar.filters': import("lucide-react").LucideIcon;
76
+ 'toolbar.aiWrite': import("lucide-react").LucideIcon;
77
+ 'toolbar.duration': import("lucide-react").LucideIcon;
78
+ 'toolbar.trim': import("lucide-react").LucideIcon;
79
+ 'toolbar.flipHorizontal': import("lucide-react").LucideIcon;
80
+ 'toolbar.flipVertical': import("lucide-react").LucideIcon;
81
+ 'toolbar.zoomIn': import("lucide-react").LucideIcon;
82
+ 'toolbar.zoomOut': import("lucide-react").LucideIcon;
83
+ 'toolbar.crop': import("lucide-react").LucideIcon;
84
+ 'download.export': import("lucide-react").LucideIcon;
85
+ 'download.image': import("lucide-react").LucideIcon;
86
+ 'download.pdf': import("lucide-react").LucideIcon;
87
+ 'download.video': import("lucide-react").LucideIcon;
88
+ 'draw.select': import("lucide-react").LucideIcon;
89
+ 'draw.brush': import("lucide-react").LucideIcon;
90
+ 'draw.highlighter': import("lucide-react").LucideIcon;
91
+ 'background.colorPicker': import("lucide-react").LucideIcon;
92
+ 'pagesTimeline.play': import("lucide-react").LucideIcon;
93
+ 'pagesTimeline.pause': import("lucide-react").LucideIcon;
94
+ 'pagesTimeline.rewind': import("lucide-react").LucideIcon;
95
95
  'size.instagram': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
96
96
  'size.facebook': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
97
97
  'size.youtube': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
98
98
  'size.linkedin': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
99
99
  'size.twitter': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
100
- 'size.video': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
101
- 'size.print': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
102
- 'size.businessCard': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
103
- 'animation.directionRight': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
104
- 'animation.directionLeft': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
105
- 'animation.directionUp': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
106
- 'animation.directionDown': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
107
- 'animation.directionBottomRight': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
108
- 'animation.directionBottomLeft': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
109
- 'animation.directionTopRight': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
110
- 'animation.directionTopLeft': import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
100
+ 'size.video': import("lucide-react").LucideIcon;
101
+ 'size.print': import("lucide-react").LucideIcon;
102
+ 'size.businessCard': import("lucide-react").LucideIcon;
103
+ 'animation.directionRight': import("lucide-react").LucideIcon;
104
+ 'animation.directionLeft': import("lucide-react").LucideIcon;
105
+ 'animation.directionUp': import("lucide-react").LucideIcon;
106
+ 'animation.directionDown': import("lucide-react").LucideIcon;
107
+ 'animation.directionBottomRight': import("lucide-react").LucideIcon;
108
+ 'animation.directionBottomLeft': import("lucide-react").LucideIcon;
109
+ 'animation.directionTopRight': import("lucide-react").LucideIcon;
110
+ 'animation.directionTopLeft': import("lucide-react").LucideIcon;
111
111
  'animation.typeMove': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
112
112
  'animation.typeFade': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
113
113
  'animation.typeZoom': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
@@ -120,7 +120,11 @@ export declare const setIcons: (custom: Partial<Record<IconName, IconComponent>>
120
120
  export declare const resetIcons: () => void;
121
121
  export declare const PolotnoIcon: (({ name, ...rest }: {
122
122
  name: IconName;
123
- } & SVGProps<SVGSVGElement>) => import("react").JSX.Element) & {
124
- displayName: string;
123
+ } & SVGProps<SVGSVGElement>) => import("react").JSX.Element) & import("react").NamedExoticComponent<{
124
+ name: IconName;
125
+ } & SVGProps<SVGSVGElement>> & {
126
+ readonly type: ({ name, ...rest }: {
127
+ name: IconName;
128
+ } & SVGProps<SVGSVGElement>) => import("react").JSX.Element;
125
129
  };
126
130
  export {};
@@ -1,4 +1,4 @@
1
- import { Instance } from 'mobx-state-tree';
1
+ import { Instance, SnapshotIn } from 'mobx-state-tree';
2
2
  export declare const Audio: import("mobx-state-tree").IModelType<{
3
3
  id: import("mobx-state-tree").ISimpleType<string>;
4
4
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -26,6 +26,58 @@ export declare const Audio: import("mobx-state-tree").IModelType<{
26
26
  custom: any;
27
27
  };
28
28
  } & {
29
- set(attrs: any): void;
29
+ set(attrs: Partial<SnapshotIn<import("mobx-state-tree").ModelInstanceTypeProps<{
30
+ id: import("mobx-state-tree").ISimpleType<string>;
31
+ name: import("mobx-state-tree").IType<string | undefined, string, string>;
32
+ src: import("mobx-state-tree").IType<string | undefined, string, string>;
33
+ duration: import("mobx-state-tree").IType<number | undefined, number, number>;
34
+ startTime: import("mobx-state-tree").IType<number | undefined, number, number>;
35
+ endTime: import("mobx-state-tree").IType<number | undefined, number, number>;
36
+ volume: import("mobx-state-tree").IType<number | undefined, number, number>;
37
+ delay: import("mobx-state-tree").IType<number | undefined, number, number>;
38
+ speed: import("mobx-state-tree").IType<number | undefined, number, number>;
39
+ custom: import("mobx-state-tree").IType<any, any, any>;
40
+ }> & {
41
+ readonly visibleDuration: number;
42
+ } & {
43
+ toJSON(): {
44
+ id: string;
45
+ name: string;
46
+ src: string;
47
+ duration: number;
48
+ startTime: number;
49
+ endTime: number;
50
+ volume: number;
51
+ delay: number;
52
+ speed: number;
53
+ custom: any;
54
+ };
55
+ } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
56
+ id: import("mobx-state-tree").ISimpleType<string>;
57
+ name: import("mobx-state-tree").IType<string | undefined, string, string>;
58
+ src: import("mobx-state-tree").IType<string | undefined, string, string>;
59
+ duration: import("mobx-state-tree").IType<number | undefined, number, number>;
60
+ startTime: import("mobx-state-tree").IType<number | undefined, number, number>;
61
+ endTime: import("mobx-state-tree").IType<number | undefined, number, number>;
62
+ volume: import("mobx-state-tree").IType<number | undefined, number, number>;
63
+ delay: import("mobx-state-tree").IType<number | undefined, number, number>;
64
+ speed: import("mobx-state-tree").IType<number | undefined, number, number>;
65
+ custom: import("mobx-state-tree").IType<any, any, any>;
66
+ }, {
67
+ readonly visibleDuration: number;
68
+ } & {
69
+ toJSON(): {
70
+ id: string;
71
+ name: string;
72
+ src: string;
73
+ duration: number;
74
+ startTime: number;
75
+ endTime: number;
76
+ volume: number;
77
+ delay: number;
78
+ speed: number;
79
+ custom: any;
80
+ };
81
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>>>): void;
30
82
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
31
83
  export type AudioType = Instance<typeof Audio>;