polotno 4.12.0 → 4.13.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 (176) hide show
  1. package/README.md +57 -22
  2. package/blueprint/canvas/context-menu/context-menu.d.ts +2 -2
  3. package/blueprint/canvas/page-controls.d.ts +14 -2
  4. package/blueprint/canvas/tooltip.d.ts +24 -2
  5. package/blueprint/pages-timeline/audio-track.d.ts +12 -2
  6. package/blueprint/pages-timeline/audios.d.ts +10 -2
  7. package/blueprint/pages-timeline/current-time.d.ts +2 -2
  8. package/blueprint/pages-timeline/element-track.d.ts +14 -2
  9. package/blueprint/pages-timeline/elements.d.ts +2 -2
  10. package/blueprint/pages-timeline/page-preview.d.ts +8 -2
  11. package/blueprint/pages-timeline/pages-timeline.d.ts +8 -2
  12. package/blueprint/pages-timeline/pages.d.ts +8 -2
  13. package/blueprint/pages-timeline/play-button.d.ts +2 -2
  14. package/blueprint/pages-timeline/time-ruler.d.ts +10 -2
  15. package/blueprint/side-panel/ai-images-panel.d.ts +6 -2
  16. package/blueprint/side-panel/animations-panel.d.ts +6 -2
  17. package/blueprint/side-panel/background-panel.d.ts +6 -2
  18. package/blueprint/side-panel/draw-panel.d.ts +6 -2
  19. package/blueprint/side-panel/effects-panel.d.ts +6 -2
  20. package/blueprint/side-panel/image-clip-panel.d.ts +6 -2
  21. package/blueprint/side-panel/layers-panel.d.ts +6 -2
  22. package/blueprint/side-panel/pages-panel.d.ts +6 -2
  23. package/blueprint/side-panel/select-video.d.ts +2 -2
  24. package/blueprint/side-panel/side-panel.d.ts +2 -2
  25. package/blueprint/side-panel/size-panel.d.ts +6 -2
  26. package/blueprint/side-panel/templates-panel.d.ts +6 -2
  27. package/blueprint/side-panel/text-panel.d.ts +6 -2
  28. package/blueprint/side-panel/videos-panel.d.ts +6 -2
  29. package/blueprint/toolbar/admin-button.d.ts +6 -2
  30. package/blueprint/toolbar/animations-picker.d.ts +18 -4
  31. package/blueprint/toolbar/copy-style.d.ts +6 -2
  32. package/blueprint/toolbar/download-button.d.ts +6 -2
  33. package/blueprint/toolbar/duplicate-button.d.ts +6 -2
  34. package/blueprint/toolbar/figure-toolbar.d.ts +8 -8
  35. package/blueprint/toolbar/filters-picker.d.ts +26 -6
  36. package/blueprint/toolbar/gif-toolbar.d.ts +2 -2
  37. package/blueprint/toolbar/group-button.d.ts +6 -2
  38. package/blueprint/toolbar/group-toolbar.d.ts +2 -2
  39. package/blueprint/toolbar/history-buttons.d.ts +6 -2
  40. package/blueprint/toolbar/html-toolbar.d.ts +10 -10
  41. package/blueprint/toolbar/image-remove-background-button.d.ts +10 -2
  42. package/blueprint/toolbar/image-toolbar.d.ts +28 -8
  43. package/blueprint/toolbar/line-toolbar.d.ts +14 -10
  44. package/blueprint/toolbar/lock-button.d.ts +6 -2
  45. package/blueprint/toolbar/many-toolbar.d.ts +2 -2
  46. package/blueprint/toolbar/opacity-picker.d.ts +6 -2
  47. package/blueprint/toolbar/page-toolbar.d.ts +2 -2
  48. package/blueprint/toolbar/position-picker.d.ts +6 -2
  49. package/blueprint/toolbar/remove-button.d.ts +6 -2
  50. package/blueprint/toolbar/svg-toolbar.d.ts +2 -2
  51. package/blueprint/toolbar/table-toolbar.d.ts +44 -14
  52. package/blueprint/toolbar/text-ai-write.d.ts +6 -2
  53. package/blueprint/toolbar/text-toolbar.d.ts +14 -14
  54. package/blueprint/toolbar/toolbar.d.ts +2 -2
  55. package/blueprint/toolbar/video-toolbar.d.ts +6 -6
  56. package/blueprint/toolbar/zoom-buttons.d.ts +4 -4
  57. package/canvas/audio.d.ts +3 -2
  58. package/canvas/context-menu/context-menu.d.ts +2 -2
  59. package/canvas/drawing-layer.d.ts +2 -2
  60. package/canvas/element.d.ts +2 -2
  61. package/canvas/fade-overlay.d.ts +14 -0
  62. package/canvas/fade-overlay.js +1 -0
  63. package/canvas/figure-element.d.ts +2 -2
  64. package/canvas/gif-element.d.ts +2 -2
  65. package/canvas/gif-element.js +1 -1
  66. package/canvas/highlighter.d.ts +6 -2
  67. package/canvas/html-element.d.ts +2 -2
  68. package/canvas/image-element.d.ts +5 -3
  69. package/canvas/image-element.js +1 -1
  70. package/canvas/line-element.d.ts +2 -2
  71. package/canvas/page-controls.d.ts +14 -2
  72. package/canvas/page.d.ts +2 -2
  73. package/canvas/page.js +1 -1
  74. package/canvas/render-tag-element.d.ts +2 -2
  75. package/canvas/render-tag-element.js +1 -1
  76. package/canvas/rich-editor.js +3 -3
  77. package/canvas/rules.d.ts +2 -2
  78. package/canvas/table-element.d.ts +2 -2
  79. package/canvas/text-element.d.ts +2 -2
  80. package/canvas/tooltip.d.ts +24 -2
  81. package/canvas/video-element.d.ts +3 -2
  82. package/canvas/video-element.js +1 -1
  83. package/canvas/workspace-canvas.d.ts +2 -2
  84. package/hooks/use-fade-stop-focus.d.ts +2 -0
  85. package/hooks/use-fade-stop-focus.js +1 -0
  86. package/icons/registry.d.ts +106 -102
  87. package/model/figure-model.d.ts +1 -1
  88. package/model/gif-model.d.ts +1 -1
  89. package/model/group-model.d.ts +8 -8
  90. package/model/image-model.d.ts +1 -1
  91. package/model/line-model.d.ts +1 -1
  92. package/model/page-model.d.ts +10 -10
  93. package/model/shape-model.d.ts +2 -2
  94. package/model/shape-model.js +1 -1
  95. package/model/store.d.ts +92 -92
  96. package/model/svg-model.d.ts +1 -1
  97. package/model/table-model.d.ts +1 -1
  98. package/model/text-model.d.ts +1 -1
  99. package/model/video-model.d.ts +1 -1
  100. package/package.json +52 -38
  101. package/pages-timeline/audio-track.d.ts +14 -2
  102. package/pages-timeline/audio-track.js +1 -1
  103. package/pages-timeline/audios.d.ts +10 -2
  104. package/pages-timeline/current-time.d.ts +2 -2
  105. package/pages-timeline/current-time.js +1 -1
  106. package/pages-timeline/element-track.d.ts +14 -2
  107. package/pages-timeline/element-track.js +1 -1
  108. package/pages-timeline/elements.d.ts +2 -2
  109. package/pages-timeline/page-preview.d.ts +8 -2
  110. package/pages-timeline/page-preview.js +1 -1
  111. package/pages-timeline/pages-timeline.d.ts +8 -2
  112. package/pages-timeline/pages-timeline.js +1 -1
  113. package/pages-timeline/pages.d.ts +8 -2
  114. package/pages-timeline/play-button.d.ts +2 -2
  115. package/pages-timeline/time-ruler.d.ts +10 -2
  116. package/pages-timeline/time-ruler.js +1 -1
  117. package/polotno.bundle.js +167 -166
  118. package/side-panel/ai-images-panel.d.ts +6 -2
  119. package/side-panel/animations-panel.d.ts +6 -2
  120. package/side-panel/background-panel.d.ts +6 -2
  121. package/side-panel/draw-panel.d.ts +6 -2
  122. package/side-panel/effects-panel.d.ts +6 -2
  123. package/side-panel/effects-panel.js +1 -1
  124. package/side-panel/image-clip-panel.d.ts +6 -2
  125. package/side-panel/layers-panel.d.ts +6 -2
  126. package/side-panel/pages-panel.d.ts +6 -2
  127. package/side-panel/select-video.d.ts +2 -2
  128. package/side-panel/side-panel.d.ts +2 -2
  129. package/side-panel/size-panel.d.ts +6 -2
  130. package/side-panel/templates-panel.d.ts +6 -2
  131. package/side-panel/text-panel.d.ts +6 -2
  132. package/side-panel/videos-panel.d.ts +6 -2
  133. package/toolbar/admin-button.d.ts +6 -2
  134. package/toolbar/animations-picker.d.ts +18 -4
  135. package/toolbar/copy-style.d.ts +6 -2
  136. package/toolbar/download-button.d.ts +6 -2
  137. package/toolbar/duplicate-button.d.ts +6 -2
  138. package/toolbar/figure-toolbar.d.ts +8 -8
  139. package/toolbar/filters-picker.d.ts +26 -6
  140. package/toolbar/gif-toolbar.d.ts +2 -2
  141. package/toolbar/group-button.d.ts +6 -2
  142. package/toolbar/group-toolbar.d.ts +2 -2
  143. package/toolbar/history-buttons.d.ts +6 -2
  144. package/toolbar/html-toolbar.d.ts +10 -10
  145. package/toolbar/image-remove-background-button.d.ts +10 -2
  146. package/toolbar/image-toolbar.d.ts +32 -10
  147. package/toolbar/line-toolbar.d.ts +14 -10
  148. package/toolbar/lock-button.d.ts +6 -2
  149. package/toolbar/many-toolbar.d.ts +2 -2
  150. package/toolbar/opacity-picker.d.ts +6 -2
  151. package/toolbar/page-toolbar.d.ts +2 -2
  152. package/toolbar/position-picker.d.ts +6 -2
  153. package/toolbar/remove-button.d.ts +6 -2
  154. package/toolbar/svg-toolbar.d.ts +2 -2
  155. package/toolbar/table-toolbar.d.ts +44 -14
  156. package/toolbar/text-ai-write.d.ts +6 -2
  157. package/toolbar/text-toolbar.d.ts +30 -18
  158. package/toolbar/toolbar.d.ts +2 -2
  159. package/toolbar/video-toolbar.d.ts +12 -6
  160. package/toolbar/video-toolbar.js +1 -1
  161. package/toolbar/zoom-buttons.d.ts +4 -4
  162. package/ui.css +1 -1
  163. package/utils/clip-fade.d.ts +6 -0
  164. package/utils/clip-fade.js +1 -0
  165. package/utils/clipboard.d.ts +2 -2
  166. package/utils/fade-gradient.d.ts +33 -0
  167. package/utils/fade-gradient.js +1 -0
  168. package/utils/fade-overlay.d.ts +9 -0
  169. package/utils/fade-overlay.js +1 -0
  170. package/utils/l10n.d.ts +19 -0
  171. package/utils/l10n.js +1 -1
  172. package/utils/pointer-drag.d.ts +6 -4
  173. package/utils/pointer-drag.js +1 -1
  174. package/utils/rich-text-html.d.ts +0 -10
  175. package/utils/rich-text-html.js +1 -1
  176. 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 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 s,Group as d,Image as h,Rect as l,Text as c}from"react-konva";import{ROLES as u}from"../model/store.js";import{DEFAULT_RETRIES as m,isDeterministicUrl as g,retryDelayMs as p}from"@polotno/core/retry";import f from"konva";import{useWorkspaceStyle as v}from"./workspace-style.js";import{incrementLoader as w,triggerLoadError as x}from"../utils/loader.js";import{polotnoError as M}from"@polotno/core/errors";import{getCropRect as E}from"@polotno/core/image";import*as y from"@polotno/core/svg";import{roundEnabledPx as L,activeAnchorOf as T,roundedCropFraction as b,roundedGeometryPx as C,roundedPosition as I,isCornerAnchor as R,scaledBoxStyleAttrs as k,roundedBoxStyleAttrs as H}from"../utils/px.js";import{useFilteredSource as S}from"./use-filtered-source.js";import{useEvent as j}from"../hooks/use-event.js";import{useFadeIn as O}from"./use-fadein.js";import{isTouchDevice as P}from"../utils/screen.js";import{createPlayGate as A,playMedia as W}from"../utils/media.js";import{useMediabunnyVideo as X}from"./use-mediabunny-video.js";import{getElementTimeRange as Y,getVideoRestMs as V}from"../utils/timeline.js";import{drawReduced as _,exportKernelEnabled as D,shouldResample as z}from"./downscale.js";import{trySetCanvasSize as U}from"../utils/canvas.js";import{useClipImage 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=y.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=y.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 s;const d=Math.floor(Math.max(e.width*o,1)),h=Math.floor(Math.max(e.height*o,1)),l=Math.min(n*o,d/2,h/2),c=Math.max(e.width/r.width,e.height/r.height)*o,u=D(e.page)&&!a&&z(c,d,h),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,v=i.useMemo(()=>{if(t&&m&&g){return p&&0===l&&!u?void 0:F()}},[t,l,u,p,m,g]),w=()=>{if(!v||!t){return}v.width=d,v.height=h;const e=v.getContext("2d");e&&(l&&(e.beginPath(),e.moveTo(l,0),e.lineTo(d-l,0),e.arc(d-l,l,l,3*Math.PI/2,0,!1),e.lineTo(d,h-l),e.arc(d-l,h-l,l,0,Math.PI/2,!1),e.lineTo(l,h),e.arc(l,h-l,l,Math.PI/2,Math.PI,!1),e.lineTo(0,l),e.arc(l,l,l,Math.PI,3*Math.PI/2,!1),e.clip()),u?_(e,t,r,v.width,v.height):e.drawImage(t,r.x,r.y,r.width,r.height,0,0,v.width,v.height))};return i.useLayoutEffect(()=>{w()},[v,e.width,e.height,r.x,r.y,r.width,r.height,n,o,a,null===(s=e.page)||void 0===s?void 0:s._exportingOrRendering,u]),i.useEffect(()=>()=>{v&&"CANVAS"===v.nodeName&&f.Util.releaseCanvas(v)},[v]),[v||t,w]};export const useClip=(e,t,r,o)=>{const[n,a]=N(e.clipSrc||""),s=e.clipSrc?a:"loaded";useLoader(s,e.clipSrc,e.id);const d=!!t&&!!n,h=i.useMemo(()=>d?{canvas:F(),mask:F(),width:0,height:0}:void 0,[d]),l=null==h?void 0:h.canvas;function c(){const i=t instanceof HTMLVideoElement?t.videoWidth:null==t?void 0:t.width,o=t instanceof HTMLVideoElement?t.videoHeight:null==t?void 0:t.height;if(!(h&&l&&t&&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));h.width===n&&h.height===a||(U(l,n,a),h.width=n,h.height=a);const s=l.getContext("2d");s&&(s.clearRect(0,0,l.width,l.height),s.save(),s.drawImage(h.mask,0,0,l.width,l.height),s.globalCompositeOperation="source-in",s.drawImage(t,0,0,l.width,l.height),s.restore())}return i.useLayoutEffect(()=>{var t;if(!h||!(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);U(h.mask,Math.min(1e4,Math.max(n.width*i,1)),Math.min(1e4,Math.max(n.height*i,1))),null===(t=h.mask.getContext("2d"))||void 0===t||t.drawImage(n,0,0,h.mask.width,h.mask.height)},[h,n,e.a.width,e.a.height,r]),i.useLayoutEffect(()=>{c()},[h,t,n,e.a.width,e.a.height,r,...o]),i.useEffect(()=>()=>{h&&f.Util.releaseCanvas(h.canvas,h.mask)},[h]),[d?l:t,c]};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 f.Animation(t=>{e.rotate(((null==t?void 0:t.timeDiff)||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});const{mediaLoadingStyle:a}=v();return t(d,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:r.a.opacity,hideInExport:!r.showInExport,children:[e(l,{width:r.width,height:r.height,fill:a.fill}),e(s,{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}=v(),o=Math.max(10,Math.min(30,r.width/25));return t(d,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:r.a.opacity,hideInExport:!r.showInExport,children:[e(l,{width:r.width,height:r.height,fill:i.fill}),e(c,{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,s]=i.useState(0),d=i.useRef(void 0),h=i.useRef(void 0),l=i.useRef(void 0);return d.current===e&&h.current===t&&l.current===r||(o.current="loading",n.current=void 0,d.current=e,h.current=t,l.current=r),i.useLayoutEffect(()=>{if(!e){return}const i=g(e)?1:m;let a,d,h,l=0,c=!1,u=!1;const f=e=>{e&&(e.removeAttribute("src"),e.load())},v=()=>{l+=1;const m=document.createElement("video");function g(){c||(m.removeEventListener("canplay",g),u=!0,o.current="loaded",n.current=m,m.currentTime=0,s(Math.random()))}function w(e){var t;const r=4===m.readyState,h=m.buffered&&m.buffered.length>0&&m.buffered.end(m.buffered.length-1)/m.duration*100>=100;if(r&&h){return}if(c){return}if(!u&&l<i){return null==d||d(),f(m),void(a=setTimeout(v,p(l)))}const g=e.message||(null===(t=m.error)||void 0===t?void 0:t.message)||"Unknown error";console.error(new Error("Video failed to load: "+g)),o.current="failed",n.current=void 0,s(Math.random())}h=m,m.addEventListener("canplay",g),m.addEventListener("error",w),d=()=>{m.removeEventListener("canplay",g),m.removeEventListener("error",w)},t&&(m.crossOrigin=t),r&&(m.referrerPolicy=r),m.src=e,m.load()};return v(),()=>{c=!0,clearTimeout(a),null==d||d(),u||f(h)}},[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=w(a)),"loading"!==e&&n(),"failed"===e&&x(M("VIDEO_FAILED",a,{src:i,elementId:r,reason:"load"}))},[e])};export const VideoElement=o(({element:o,store:s})=>{var c,m,g;const[p,v]=i.useState(!1),x=i.useRef(null),M=o.isSelected,[_,D]=i.useState(!1),[z,U]=Q(o.src,"anonymous"),[N,te]=i.useState(!1),re=s.activePage===o.page,ie=(null===(c=o.page)||void 0===c?void 0:c._exportingOrRendering)&&"loaded"===U,oe=X(o,s,ie);useLoader(U,o.src,o.id),z&&(z.playsInline=!0);const ne=((e,t,r)=>{const o=i.useMemo(()=>{var i,o;const{flipX:n,flipY:a}=e,s="svg"===e.type||y.isSvgUrl(e.src),d=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;if(!(n||a||d&&s)){return t}if(!t){return null}const h=t instanceof HTMLVideoElement?t.videoWidth:null==t?void 0:t.width,l=t instanceof HTMLVideoElement?t.videoHeight:null==t?void 0:t.height;if(!h||!l){return null}const c=F();let u=1;"svg"===e.type&&(u=Math.max(e.width/h*r,e.height/l*r)),c.width=Math.max(h*u,1),c.height=Math.max(l*u,1);let m=n?-c.width:0,g=a?-c.height:0;return null===(i=c.getContext("2d"))||void 0===i||i.scale(n?-1:1,a?-1:1),null===(o=c.getContext("2d"))||void 0===o||o.drawImage(t,m,g,c.width,c.height),c},[e.flipX,e.flipY,t,e.width,e.height,r]);return i.useEffect(()=>()=>{o&&"CANVAS"===o.nodeName&&f.Util.releaseCanvas(o)},[o]),o})(o,z,s._elementsPixelRatio),ae=ie&&oe||ne||G,[se=G,de]=S(o,ae);i.useEffect(()=>{z&&s.history.ignore(()=>{o.set({duration:1e3*z.duration})})},[z]);const he=i.useMemo(A,[z]);i.useEffect(()=>{var e;if(!z){return}const t=s.animatedElementsIds,r=(!t.length||t.includes(o.id))&&s.isPlaying;if(!re||!r&&!_){return void z.pause()}_&&(z.muted=!1,z.currentTime=o.startTime*z.duration,W(z).then(e=>{"refused"===e&&D(!1)}));const i=new f.Animation(()=>{Ie()},null===(e=x.current)||void 0===e?void 0:e.getLayer());i.start();const n=()=>{D(!1),z.currentTime=o.startTime*z.duration},a=()=>{z.currentTime>=o.endTime*z.duration&&(z.pause(),z.currentTime=o.startTime*z.duration,D(!1))};return z.addEventListener("ended",n),z.addEventListener("timeupdate",a),()=>{z.pause(),i.stop(),z.removeEventListener("ended",n),z.removeEventListener("timeupdate",a)}},[z,_,s.isPlaying,re]),i.useEffect(()=>{z&&(z.volume=o.volume)},[z,o.volume]),i.useEffect(()=>{z&&(z.playbackRate=o.speed,z.preservesPitch=!1)},[z,o.speed]);const le=i.useRef(null);i.useEffect(()=>{const e=a(o,()=>{var e,t;if(z){if(ie&&oe){return Ie(),void s.currentTime}const r=s.animatedElementsIds;if(r.length&&!r.includes(o.id)){return}const i=s.activePage===o.page,n=s.currentTime>=o.page.startTime&&s.currentTime<o.page.startTime+o.page.duration,a=o.startTime*z.duration*1e3,d=z.duration*(o.endTime-o.startTime)*1e3,{start:h,end:l}=Y(o.animations,o.page.duration),c=(s.currentTime||o.page.startTime)-o.page.startTime,u=n?V(s.currentTime,o.page.startTime,h,d,a,o.speed):0,m=u/1e3,g=n&&c>=h&&c<l;_||(z.muted=!g,g&&s.isPlaying&&i?z.paused?(z.currentTime=m,he.play(z)):Math.abs(1e3*z.currentTime-u)>500&&(z.currentTime=m):(he.reset(),z.paused||z.pause(),m!==z.currentTime&&(z.currentTime=m),!ee(z)&&!s.isPlaying&&!le.current&&(le.current=w(`video ${o.id}`)))),Ie(),null===(t=null===(e=x.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()}});return()=>{e(),le.current&&(le.current(),le.current=null)}},[s,z,ie,oe,_]),i.useEffect(()=>{var e,t;if(!z){return}if(ie){return null===(e=le.current)||void 0===e||e.call(le),void(le.current=null)}const r=()=>{var e,t,r;!ee(z)&&(null===(e=o.page)||void 0===e?void 0:e._exportingOrRendering)||le.current&&(Ie(),null===(r=null===(t=x.current)||void 0===t?void 0:t.getLayer())||void 0===r||r.batchDraw(),le.current(),le.current=null)};let i;return(null===(t=o.page)||void 0===t?void 0:t._exportingOrRendering)&&(i=setInterval(r,20)),z.addEventListener("timeupdate",r),z.addEventListener("canplay",r),()=>{clearInterval(i),z.removeEventListener("timeupdate",r),z.removeEventListener("canplay",r)}},[null===(m=o.page)||void 0===m?void 0:m._exportingOrRendering,z,o.id,w,ie]);let{cropX:ce,cropY:ue,cropWidth:me,cropHeight:ge}=o;"loaded"!==U&&(ce=ue=0,me=ge=1);const pe=(fe=se)instanceof HTMLVideoElement?fe.videoWidth:(null==fe?void 0:fe.width)||0;var fe;const ve=(e=>e instanceof HTMLVideoElement?e.videoHeight:(null==e?void 0:e.height)||0)(se),we=E({stretchEnabled:o.stretchEnabled,cropX:ce,cropY:ue,cropWidth:me,cropHeight:ge,width:o.a.width,height:o.a.height},{width:pe,height:ve}),xe=we.width,Me=we.height,Ee=o.stretchEnabled,ye=null!==(g=o.cornerRadius)&&void 0!==g?g:0,[Le,Te]=useCornerRadiusAndCrop(o,se,we,s._elementsPixelRatio,ye,!0);let[be,Ce]=useClip(o,Le,s._elementsPixelRatio,[we,ye,s._elementsPixelRatio]);const Ie=j(()=>{var e,t;de(),Te(),Ce(),null===(t=null===(e=x.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()});i.useEffect(()=>{Ie()});const Re=()=>{o._cropEnabled&&setTimeout(()=>{n(o)&&o.toggleCropMode(!0)})},ke="loading"===U,He="failed"===U,Se=!ke&&!He,je=i.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Oe=i.useRef(!1),Pe=Se?o.a.opacity:0;O(x,Pe);const Ae=o.selectable||s.role===u.ADMIN,We=P();return e(r,{children:t(d,{onMouseEnter:()=>te(!0),onMouseLeave:()=>te(!1),children:[ke&&e(J,{element:o}),He&&e(K,{element:o}),e(h,{ref:x,name:"element",id:o.id,image:be,x:o.a.x,y:o.a.y,width:o.a.width||1,height:o.a.height||1,rotation:o.a.rotation,opacity:Pe,shadowEnabled:o.shadowEnabled,shadowBlur:o.shadowBlur,shadowOffsetX:o.shadowOffsetX,shadowOffsetY:o.shadowOffsetY,shadowColor:o.shadowColor,shadowOpacity:o.shadowOpacity,customCrop:we,listening:Ae,draggable:We?o.draggable&&M:o.draggable,preventDefault:!We||M,hideInExport:!o.showInExport,onDragMove:e=>{o.set({x:e.target.x(),y:e.target.y()})},onDragEnd:e=>{o.set(I(e.target))},onDblClick:Re,onDblTap:Re,onTransformStart:e=>{v(!0),Oe.current=R(T(e.target)),je.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-xe/pe,a=Math.min(n,Math.max(0,o.cropX)),s=1-Me/ve,d=Math.min(s,Math.max(0,o.cropY)),h=Oe.current,l=!h&&r<1&&je.current.cropHeight>Me/ve;let c=h?o.cropWidth:o.cropWidth*r;l&&(c=o.cropWidth);const u=!h&&i<1&&je.current.cropWidth>xe/pe;let m=h?o.cropHeight:o.cropHeight*i;u&&(m=o.cropHeight),Ee&&(c=o.cropWidth,m=o.cropHeight);const g=h?Math.min(r,i):1;o.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(c,1-a),cropHeight:Math.min(m,1-d)},1!==g&&Object.assign(Object.assign({},k(o,g)),{borderSize:o.borderSize*g})))},onTransformEnd:e=>{const t=e.currentTarget;o.set(Object.assign(Object.assign({width:C(t.width()),height:C(t.height()),x:C(t.x()),y:C(t.y()),rotation:C(e.target.rotation()),cropX:b(o.cropX),cropY:b(o.cropY),cropWidth:b(xe/pe),cropHeight:b(Me/ve)},H(o)),{borderSize:L(o.borderSize)})),v(!1)}}),e(l,{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:Pe,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,ye-o.borderSize),hideInExport:!o.showInExport}),!s.isPlaying&&e(h,{image:_?N||We?q:void 0:$,x:o.a.x,y:o.a.y,offsetX:-o.a.width/2+15/s.scale,offsetY:-o.a.height/2+15/s.scale,rotation:o.a.rotation,width:30/s.scale,height:30/s.scale,hideInExport:!0,onClick:()=>D(!_),onTap:()=>D(!_)}),o._cropModeEnabled&&e(Z,{element:o,store:s,previewImage:be,sourceImage:se,sourceWidth:pe,sourceHeight:ve,cropAbsoluteWidth:xe,cropAbsoluteHeight:Me,innerAnchors:B})]})})});
@@ -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;
@@ -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 {};
@@ -133,7 +133,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
133
133
  } & {
134
134
  readonly locked: boolean;
135
135
  readonly a: import("./shape-model.js").AnimatedAttrs;
136
- animated(attr: any): any;
136
+ animated(attr: string): any;
137
137
  readonly timeRange: {
138
138
  start: number;
139
139
  end: number;
@@ -146,7 +146,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
146
146
  } & {
147
147
  readonly locked: boolean;
148
148
  readonly a: import("./shape-model.js").AnimatedAttrs;
149
- animated(attr: any): any;
149
+ animated(attr: string): any;
150
150
  readonly timeRange: {
151
151
  start: number;
152
152
  end: number;
@@ -203,7 +203,7 @@ export declare const TYPES_MAP: {
203
203
  } & {
204
204
  readonly locked: boolean;
205
205
  readonly a: import("./shape-model.js").AnimatedAttrs;
206
- animated(attr: any): any;
206
+ animated(attr: string): any;
207
207
  readonly timeRange: {
208
208
  start: number;
209
209
  end: number;
@@ -391,7 +391,7 @@ export declare const TYPES_MAP: {
391
391
  } & {
392
392
  readonly locked: boolean;
393
393
  readonly a: import("./shape-model.js").AnimatedAttrs;
394
- animated(attr: any): any;
394
+ animated(attr: string): any;
395
395
  readonly timeRange: {
396
396
  start: number;
397
397
  end: number;
@@ -561,7 +561,7 @@ export declare const TYPES_MAP: {
561
561
  } & {
562
562
  readonly locked: boolean;
563
563
  readonly a: import("./shape-model.js").AnimatedAttrs;
564
- animated(attr: any): any;
564
+ animated(attr: string): any;
565
565
  readonly timeRange: {
566
566
  start: number;
567
567
  end: number;
@@ -737,7 +737,7 @@ export declare const TYPES_MAP: {
737
737
  } & {
738
738
  readonly locked: boolean;
739
739
  readonly a: import("./shape-model.js").AnimatedAttrs;
740
- animated(attr: any): any;
740
+ animated(attr: string): any;
741
741
  readonly timeRange: {
742
742
  start: number;
743
743
  end: number;
@@ -921,7 +921,7 @@ export declare const TYPES_MAP: {
921
921
  } & {
922
922
  readonly locked: boolean;
923
923
  readonly a: import("./shape-model.js").AnimatedAttrs;
924
- animated(attr: any): any;
924
+ animated(attr: string): any;
925
925
  readonly timeRange: {
926
926
  start: number;
927
927
  end: number;
@@ -1096,7 +1096,7 @@ export declare const TYPES_MAP: {
1096
1096
  } & {
1097
1097
  readonly locked: boolean;
1098
1098
  readonly a: import("./shape-model.js").AnimatedAttrs;
1099
- animated(attr: any): any;
1099
+ animated(attr: string): any;
1100
1100
  readonly timeRange: {
1101
1101
  start: number;
1102
1102
  end: number;
@@ -1277,7 +1277,7 @@ export declare const TYPES_MAP: {
1277
1277
  } & {
1278
1278
  readonly locked: boolean;
1279
1279
  readonly a: import("./shape-model.js").AnimatedAttrs;
1280
- animated(attr: any): any;
1280
+ animated(attr: string): any;
1281
1281
  readonly timeRange: {
1282
1282
  start: number;
1283
1283
  end: number;
@@ -1601,7 +1601,7 @@ export declare const TYPES_MAP: {
1601
1601
  } & {
1602
1602
  readonly locked: boolean;
1603
1603
  readonly a: import("./shape-model.js").AnimatedAttrs;
1604
- animated(attr: any): any;
1604
+ animated(attr: string): any;
1605
1605
  readonly timeRange: {
1606
1606
  start: number;
1607
1607
  end: number;
@@ -142,7 +142,7 @@ export declare const ImageElement: import("mobx-state-tree").IModelType<{
142
142
  } & {
143
143
  readonly locked: boolean;
144
144
  readonly a: import("./shape-model.js").AnimatedAttrs;
145
- animated(attr: any): any;
145
+ animated(attr: string): any;
146
146
  readonly timeRange: {
147
147
  start: number;
148
148
  end: number;
@@ -133,7 +133,7 @@ export declare const LineElement: import("mobx-state-tree").IModelType<{
133
133
  } & {
134
134
  readonly locked: boolean;
135
135
  readonly a: import("./shape-model.js").AnimatedAttrs;
136
- animated(attr: any): any;
136
+ animated(attr: string): any;
137
137
  readonly timeRange: {
138
138
  start: number;
139
139
  end: number;
@@ -147,7 +147,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
147
147
  } & {
148
148
  readonly locked: boolean;
149
149
  readonly a: import("./shape-model.js").AnimatedAttrs;
150
- animated(attr: any): any;
150
+ animated(attr: string): any;
151
151
  readonly timeRange: {
152
152
  start: number;
153
153
  end: number;
@@ -334,7 +334,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
334
334
  } & {
335
335
  readonly locked: boolean;
336
336
  readonly a: import("./shape-model.js").AnimatedAttrs;
337
- animated(attr: any): any;
337
+ animated(attr: string): any;
338
338
  readonly timeRange: {
339
339
  start: number;
340
340
  end: number;
@@ -503,7 +503,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
503
503
  } & {
504
504
  readonly locked: boolean;
505
505
  readonly a: import("./shape-model.js").AnimatedAttrs;
506
- animated(attr: any): any;
506
+ animated(attr: string): any;
507
507
  readonly timeRange: {
508
508
  start: number;
509
509
  end: number;
@@ -677,7 +677,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
677
677
  } & {
678
678
  readonly locked: boolean;
679
679
  readonly a: import("./shape-model.js").AnimatedAttrs;
680
- animated(attr: any): any;
680
+ animated(attr: string): any;
681
681
  readonly timeRange: {
682
682
  start: number;
683
683
  end: number;
@@ -860,7 +860,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
860
860
  } & {
861
861
  readonly locked: boolean;
862
862
  readonly a: import("./shape-model.js").AnimatedAttrs;
863
- animated(attr: any): any;
863
+ animated(attr: string): any;
864
864
  readonly timeRange: {
865
865
  start: number;
866
866
  end: number;
@@ -1034,7 +1034,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
1034
1034
  } & {
1035
1035
  readonly locked: boolean;
1036
1036
  readonly a: import("./shape-model.js").AnimatedAttrs;
1037
- animated(attr: any): any;
1037
+ animated(attr: string): any;
1038
1038
  readonly timeRange: {
1039
1039
  start: number;
1040
1040
  end: number;
@@ -1214,7 +1214,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
1214
1214
  } & {
1215
1215
  readonly locked: boolean;
1216
1216
  readonly a: import("./shape-model.js").AnimatedAttrs;
1217
- animated(attr: any): any;
1217
+ animated(attr: string): any;
1218
1218
  readonly timeRange: {
1219
1219
  start: number;
1220
1220
  end: number;
@@ -1537,7 +1537,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
1537
1537
  } & {
1538
1538
  readonly locked: boolean;
1539
1539
  readonly a: import("./shape-model.js").AnimatedAttrs;
1540
- animated(attr: any): any;
1540
+ animated(attr: string): any;
1541
1541
  readonly timeRange: {
1542
1542
  start: number;
1543
1543
  end: number;
@@ -1737,7 +1737,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
1737
1737
  } & {
1738
1738
  readonly locked: boolean;
1739
1739
  readonly a: import("./shape-model.js").AnimatedAttrs;
1740
- animated(attr: any): any;
1740
+ animated(attr: string): any;
1741
1741
  readonly timeRange: {
1742
1742
  start: number;
1743
1743
  end: number;
@@ -1874,7 +1874,7 @@ export declare const Page: import("mobx-state-tree").IModelType<{
1874
1874
  } & {
1875
1875
  readonly locked: boolean;
1876
1876
  readonly a: import("./shape-model.js").AnimatedAttrs;
1877
- animated(attr: any): any;
1877
+ animated(attr: string): any;
1878
1878
  readonly timeRange: {
1879
1879
  start: number;
1880
1880
  end: number;
@@ -16,7 +16,7 @@ export declare const Animation: import("mobx-state-tree").IModelType<{
16
16
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
17
17
  data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>;
18
18
  }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
19
- export declare const getDiff: (obj1: Record<string, any>, obj2: Record<string, any>) => Record<string, any>;
19
+ export declare const getDiff: (obj1: Record<string, unknown>, obj2: Record<string, unknown>) => Record<string, number>;
20
20
  export declare const ShapeFilter: import("mobx-state-tree").IModelType<{
21
21
  intensity: import("mobx-state-tree").IType<number | undefined, number, number>;
22
22
  }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
@@ -147,7 +147,7 @@ export declare const Shape: import("mobx-state-tree").IModelType<{
147
147
  } & {
148
148
  readonly locked: boolean;
149
149
  readonly a: AnimatedAttrs;
150
- animated(attr: any): any;
150
+ animated(attr: string): any;
151
151
  readonly timeRange: {
152
152
  start: number;
153
153
  end: number;