polotno 4.12.1 → 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 (157) 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/side-panel.d.ts +2 -2
  23. package/blueprint/side-panel/size-panel.d.ts +6 -2
  24. package/blueprint/side-panel/templates-panel.d.ts +6 -2
  25. package/blueprint/side-panel/text-panel.d.ts +6 -2
  26. package/blueprint/side-panel/videos-panel.d.ts +6 -2
  27. package/blueprint/toolbar/admin-button.d.ts +6 -2
  28. package/blueprint/toolbar/animations-picker.d.ts +18 -4
  29. package/blueprint/toolbar/copy-style.d.ts +6 -2
  30. package/blueprint/toolbar/download-button.d.ts +6 -2
  31. package/blueprint/toolbar/duplicate-button.d.ts +6 -2
  32. package/blueprint/toolbar/figure-toolbar.d.ts +8 -8
  33. package/blueprint/toolbar/filters-picker.d.ts +26 -6
  34. package/blueprint/toolbar/gif-toolbar.d.ts +2 -2
  35. package/blueprint/toolbar/group-button.d.ts +6 -2
  36. package/blueprint/toolbar/group-toolbar.d.ts +2 -2
  37. package/blueprint/toolbar/history-buttons.d.ts +6 -2
  38. package/blueprint/toolbar/html-toolbar.d.ts +10 -10
  39. package/blueprint/toolbar/image-remove-background-button.d.ts +10 -2
  40. package/blueprint/toolbar/image-toolbar.d.ts +28 -8
  41. package/blueprint/toolbar/line-toolbar.d.ts +14 -10
  42. package/blueprint/toolbar/lock-button.d.ts +6 -2
  43. package/blueprint/toolbar/many-toolbar.d.ts +2 -2
  44. package/blueprint/toolbar/opacity-picker.d.ts +6 -2
  45. package/blueprint/toolbar/page-toolbar.d.ts +2 -2
  46. package/blueprint/toolbar/position-picker.d.ts +6 -2
  47. package/blueprint/toolbar/remove-button.d.ts +6 -2
  48. package/blueprint/toolbar/svg-toolbar.d.ts +2 -2
  49. package/blueprint/toolbar/table-toolbar.d.ts +44 -14
  50. package/blueprint/toolbar/text-ai-write.d.ts +6 -2
  51. package/blueprint/toolbar/text-toolbar.d.ts +14 -14
  52. package/blueprint/toolbar/toolbar.d.ts +2 -2
  53. package/blueprint/toolbar/video-toolbar.d.ts +6 -6
  54. package/blueprint/toolbar/zoom-buttons.d.ts +4 -4
  55. package/canvas/audio.d.ts +3 -2
  56. package/canvas/context-menu/context-menu.d.ts +2 -2
  57. package/canvas/drawing-layer.d.ts +2 -2
  58. package/canvas/element.d.ts +2 -2
  59. package/canvas/fade-overlay.d.ts +14 -0
  60. package/canvas/fade-overlay.js +1 -0
  61. package/canvas/figure-element.d.ts +2 -2
  62. package/canvas/gif-element.d.ts +2 -2
  63. package/canvas/gif-element.js +1 -1
  64. package/canvas/highlighter.d.ts +6 -2
  65. package/canvas/html-element.d.ts +2 -2
  66. package/canvas/image-element.d.ts +5 -3
  67. package/canvas/image-element.js +1 -1
  68. package/canvas/line-element.d.ts +2 -2
  69. package/canvas/page-controls.d.ts +14 -2
  70. package/canvas/page.d.ts +2 -2
  71. package/canvas/page.js +1 -1
  72. package/canvas/render-tag-element.d.ts +2 -2
  73. package/canvas/render-tag-element.js +1 -1
  74. package/canvas/rich-editor.js +3 -3
  75. package/canvas/rules.d.ts +2 -2
  76. package/canvas/table-element.d.ts +2 -2
  77. package/canvas/text-element.d.ts +2 -2
  78. package/canvas/tooltip.d.ts +24 -2
  79. package/canvas/video-element.d.ts +3 -2
  80. package/canvas/video-element.js +1 -1
  81. package/canvas/workspace-canvas.d.ts +2 -2
  82. package/hooks/use-fade-stop-focus.d.ts +2 -0
  83. package/hooks/use-fade-stop-focus.js +1 -0
  84. package/icons/registry.d.ts +106 -102
  85. package/package.json +31 -34
  86. package/pages-timeline/audio-track.d.ts +14 -2
  87. package/pages-timeline/audio-track.js +1 -1
  88. package/pages-timeline/audios.d.ts +10 -2
  89. package/pages-timeline/current-time.d.ts +2 -2
  90. package/pages-timeline/current-time.js +1 -1
  91. package/pages-timeline/element-track.d.ts +14 -2
  92. package/pages-timeline/element-track.js +1 -1
  93. package/pages-timeline/elements.d.ts +2 -2
  94. package/pages-timeline/page-preview.d.ts +8 -2
  95. package/pages-timeline/page-preview.js +1 -1
  96. package/pages-timeline/pages-timeline.d.ts +8 -2
  97. package/pages-timeline/pages-timeline.js +1 -1
  98. package/pages-timeline/pages.d.ts +8 -2
  99. package/pages-timeline/play-button.d.ts +2 -2
  100. package/pages-timeline/time-ruler.d.ts +10 -2
  101. package/pages-timeline/time-ruler.js +1 -1
  102. package/polotno.bundle.js +166 -165
  103. package/side-panel/ai-images-panel.d.ts +6 -2
  104. package/side-panel/animations-panel.d.ts +6 -2
  105. package/side-panel/background-panel.d.ts +6 -2
  106. package/side-panel/draw-panel.d.ts +6 -2
  107. package/side-panel/effects-panel.d.ts +6 -2
  108. package/side-panel/effects-panel.js +1 -1
  109. package/side-panel/image-clip-panel.d.ts +6 -2
  110. package/side-panel/layers-panel.d.ts +6 -2
  111. package/side-panel/pages-panel.d.ts +6 -2
  112. package/side-panel/side-panel.d.ts +2 -2
  113. package/side-panel/size-panel.d.ts +6 -2
  114. package/side-panel/templates-panel.d.ts +6 -2
  115. package/side-panel/text-panel.d.ts +6 -2
  116. package/side-panel/videos-panel.d.ts +6 -2
  117. package/toolbar/admin-button.d.ts +6 -2
  118. package/toolbar/animations-picker.d.ts +18 -4
  119. package/toolbar/copy-style.d.ts +6 -2
  120. package/toolbar/download-button.d.ts +6 -2
  121. package/toolbar/duplicate-button.d.ts +6 -2
  122. package/toolbar/figure-toolbar.d.ts +8 -8
  123. package/toolbar/filters-picker.d.ts +26 -6
  124. package/toolbar/gif-toolbar.d.ts +2 -2
  125. package/toolbar/group-button.d.ts +6 -2
  126. package/toolbar/group-toolbar.d.ts +2 -2
  127. package/toolbar/history-buttons.d.ts +6 -2
  128. package/toolbar/html-toolbar.d.ts +10 -10
  129. package/toolbar/image-remove-background-button.d.ts +10 -2
  130. package/toolbar/image-toolbar.d.ts +32 -10
  131. package/toolbar/line-toolbar.d.ts +14 -10
  132. package/toolbar/lock-button.d.ts +6 -2
  133. package/toolbar/many-toolbar.d.ts +2 -2
  134. package/toolbar/opacity-picker.d.ts +6 -2
  135. package/toolbar/page-toolbar.d.ts +2 -2
  136. package/toolbar/position-picker.d.ts +6 -2
  137. package/toolbar/remove-button.d.ts +6 -2
  138. package/toolbar/svg-toolbar.d.ts +2 -2
  139. package/toolbar/table-toolbar.d.ts +44 -14
  140. package/toolbar/text-ai-write.d.ts +6 -2
  141. package/toolbar/text-toolbar.d.ts +30 -18
  142. package/toolbar/toolbar.d.ts +2 -2
  143. package/toolbar/video-toolbar.d.ts +12 -6
  144. package/toolbar/video-toolbar.js +1 -1
  145. package/toolbar/zoom-buttons.d.ts +4 -4
  146. package/ui.css +1 -1
  147. package/utils/clip-fade.d.ts +6 -0
  148. package/utils/clip-fade.js +1 -0
  149. package/utils/fade-gradient.d.ts +33 -0
  150. package/utils/fade-gradient.js +1 -0
  151. package/utils/fade-overlay.d.ts +9 -0
  152. package/utils/fade-overlay.js +1 -0
  153. package/utils/l10n.d.ts +19 -0
  154. package/utils/l10n.js +1 -1
  155. package/utils/pointer-drag.d.ts +6 -4
  156. package/utils/pointer-drag.js +1 -1
  157. package/utils/validate-key.js +1 -1
@@ -7,6 +7,18 @@ export declare const ElementTrack: (({ element, page, store, scale, row, }: {
7
7
  store: StoreType;
8
8
  scale: number;
9
9
  row: number;
10
- }) => React.JSX.Element) & {
11
- displayName: string;
10
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
11
+ element: ShapeType;
12
+ page: PageType;
13
+ store: StoreType;
14
+ scale: number;
15
+ row: number;
16
+ }> & {
17
+ readonly type: ({ element, page, store, scale, row, }: {
18
+ element: ShapeType;
19
+ page: PageType;
20
+ store: StoreType;
21
+ scale: number;
22
+ row: number;
23
+ }) => React.JSX.Element;
12
24
  };
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import n from"react";import{observer as o}from"mobx-react-lite";import{PolotnoIcon as i}from"../icons/registry.js";import{duplicateElements as r}from"../utils/duplicate.js";import{clamp as l}from"../lib/utils.js";import{getElementTimeRange as s,MIN_DURATION as a,revealElementAtPlayhead as m}from"../utils/timeline.js";import{canSplitAtPlayhead as c,splitElementAtPlayhead as p}from"../utils/split-element.js";import{t as d}from"../utils/l10n.js";import{DRAG_SLOP_PX as u,isPrimaryDrag as f,startPointerDrag as x}from"../utils/pointer-drag.js";import{DropdownMenu as h,DropdownMenuContent as v,DropdownMenuItem as j}from"../primitives/dropdown-menu.js";import{TrackWrapper as E,TrackContainer as g,TrackMenu as w,TrackMenuButton as y,TrackHandleLeft as D,TrackHandleRight as M,TrackLabel as P,TrackNameInput as b}from"./track-styles.js";export const ELEMENT_ROW_HEIGHT=26;const S=o(({element:n,store:o})=>{var r;const l=o.effectiveTime-((null===(r=n.page)||void 0===r?void 0:r.startTime)||0),s=c(n,l);return t(j,{disabled:!s,onSelect:e=>{e.preventDefault();const t=p(n,l);t&&o.selectElements([t.id])},children:[e(i,{name:"action.split"}),d("contextMenu.split")]})}),T=(e,t)=>{const n=e.animations.find(e=>e.type===t);n&&n.enabled||e.setAnimation(t,{name:"none",enabled:!0})},X=(e,t,n,o)=>{const i=l(n,0,t-a),r=l(o,i+a,t);T(e,"enter"),T(e,"exit"),e.setAnimation("enter",{delay:i}),e.setAnimation("exit",{delay:Math.max(0,t-r)})};export const ElementTrack=o(({element:o,page:c,store:p,scale:T,row:k})=>{const A=c.duration,C=c.startTime,H=C+A,{start:N,end:O}=s(o.animations,A),W=(O-N)*T,$=(C+N)*T,_=o.name||o.type||d("toolbar.element"),[G,I]=n.useState(!1),[L,R]=n.useState(null),q=()=>{R(e=>null===e?k:e)},z=()=>{R(null)},B=(e,t)=>{if(!f(e)){return}e.stopPropagation();const n=e.clientX,i=N,r=O;x(e,{slopX:u,onMove:e=>{q();const s=(e.clientX-n)/T;if("start"===t){const e=l(C+i+s,C,C+r-a);X(o,A,e-C,r)}else{const e=l(C+r+s,C+i+a,H);X(o,A,i,e-C)}},onEnd:z})};return e(E,{style:{left:`${$}px`,top:26*(null!=L?L:k)+"px",width:`${W}px`,minWidth:"6px",height:"22px"},children:t(g,{style:{width:"100%",height:"100%",outline:p.selectedElements.find(e=>e.id===o.id)?"2px solid var(--pn-primary, var(--primary, #137cbd))":"none",outlineOffset:"-1px"},onPointerDown:e=>{if(!f(e)){return}e.stopPropagation();const t=e.clientX,n=N,i=O-n;x(e,{slopX:u,onMove:e=>{q();const r=(e.clientX-t)/T,s=l(C+n+r,C,H-i)-C;X(o,A,s,s+i)},onEnd:({moved:e,cancelled:t})=>{z(),e||t||(p.selectElements([o.id]),m(o))}})},children:[G?e(b,{value:o.name||"",onCommit:e=>{o.set({name:e}),I(!1)},onCancel:()=>I(!1)}):e(P,{children:_}),e(D,{onPointerDown:e=>B(e,"start")}),e(M,{onPointerDown:e=>B(e,"end")}),e(w,{onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:t(h,{children:[e(y,{}),t(v,{side:"top",className:"pn:whitespace-nowrap",children:[e(S,{element:o,store:p}),t(j,{onSelect:e=>{e.preventDefault(),I(!0)},children:[e(i,{name:"action.rename"}),d("contextMenu.rename")]}),t(j,{onSelect:e=>{e.preventDefault(),r([o],p)},children:[e(i,{name:"action.duplicate"}),d("contextMenu.duplicate")]}),t(j,{onSelect:e=>{e.preventDefault(),p.deleteElements([o.id])},children:[e(i,{name:"action.remove"}),d("contextMenu.remove")]})]})]})})]})})});
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import n from"react";import{observer as o}from"mobx-react-lite";import{PolotnoIcon as i}from"../icons/registry.js";import{duplicateElements as r}from"../utils/duplicate.js";import{clamp as l}from"../lib/utils.js";import{getElementTimeRange as s,MIN_DURATION as a,revealElementAtPlayhead as m}from"../utils/timeline.js";import{canSplitAtPlayhead as c,splitElementAtPlayhead as p}from"../utils/split-element.js";import{t as d}from"../utils/l10n.js";import{DRAG_SLOP_PX as u,isPrimaryDrag as f,usePointerDrag as x}from"../utils/pointer-drag.js";import{DropdownMenu as h,DropdownMenuContent as v,DropdownMenuItem as j}from"../primitives/dropdown-menu.js";import{TrackWrapper as E,TrackContainer as g,TrackMenu as w,TrackMenuButton as y,TrackHandleLeft as D,TrackHandleRight as M,TrackLabel as P,TrackNameInput as b}from"./track-styles.js";export const ELEMENT_ROW_HEIGHT=26;const S=o(({element:n,store:o})=>{var r;const l=o.effectiveTime-((null===(r=n.page)||void 0===r?void 0:r.startTime)||0),s=c(n,l);return t(j,{disabled:!s,onSelect:e=>{e.preventDefault();const t=p(n,l);t&&o.selectElements([t.id])},children:[e(i,{name:"action.split"}),d("contextMenu.split")]})}),T=(e,t)=>{const n=e.animations.find(e=>e.type===t);n&&n.enabled||e.setAnimation(t,{name:"none",enabled:!0})},X=(e,t,n,o)=>{const i=l(n,0,t-a),r=l(o,i+a,t);T(e,"enter"),T(e,"exit"),e.setAnimation("enter",{delay:i}),e.setAnimation("exit",{delay:Math.max(0,t-r)})};export const ElementTrack=o(({element:o,page:c,store:p,scale:T,row:k})=>{const A=c.duration,C=c.startTime,H=C+A,{start:N,end:O}=s(o.animations,A),W=(O-N)*T,$=(C+N)*T,_=o.name||o.type||d("toolbar.element"),[G,I]=n.useState(!1),L=x(),[R,q]=n.useState(null),z=()=>{q(e=>null===e?k:e)},B=()=>{q(null)},F=(e,t)=>{if(!f(e)){return}e.stopPropagation();const n=e.clientX,i=N,r=O;L(e,{slopX:u,node:o,onMove:e=>{z();const s=(e.clientX-n)/T;if("start"===t){const e=l(C+i+s,C,C+r-a);X(o,A,e-C,r)}else{const e=l(C+r+s,C+i+a,H);X(o,A,i,e-C)}},onEnd:B})};return e(E,{style:{left:`${$}px`,top:26*(null!=R?R:k)+"px",width:`${W}px`,minWidth:"6px",height:"22px"},children:t(g,{style:{width:"100%",height:"100%",outline:p.selectedElements.find(e=>e.id===o.id)?"2px solid var(--pn-primary, var(--primary, #137cbd))":"none",outlineOffset:"-1px"},onPointerDown:e=>{if(!f(e)){return}e.stopPropagation();const t=e.clientX,n=N,i=O-n;L(e,{slopX:u,node:o,onMove:e=>{z();const r=(e.clientX-t)/T,s=l(C+n+r,C,H-i)-C;X(o,A,s,s+i)},onEnd:({moved:e,cancelled:t})=>{B(),e||t||(p.selectElements([o.id]),m(o))}})},children:[G?e(b,{value:o.name||"",onCommit:e=>{o.set({name:e}),I(!1)},onCancel:()=>I(!1)}):e(P,{children:_}),e(D,{onPointerDown:e=>F(e,"start")}),e(M,{onPointerDown:e=>F(e,"end")}),e(w,{onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:t(h,{children:[e(y,{}),t(v,{side:"top",className:"pn:whitespace-nowrap",children:[e(S,{element:o,store:p}),t(j,{onSelect:e=>{e.preventDefault(),I(!0)},children:[e(i,{name:"action.rename"}),d("contextMenu.rename")]}),t(j,{onSelect:e=>{e.preventDefault(),r([o],p)},children:[e(i,{name:"action.duplicate"}),d("contextMenu.duplicate")]}),t(j,{onSelect:e=>{e.preventDefault(),p.deleteElements([o.id])},children:[e(i,{name:"action.remove"}),d("contextMenu.remove")]})]})]})})]})})});
@@ -4,7 +4,7 @@ interface ElementTimelineProps {
4
4
  scale: number;
5
5
  width: number;
6
6
  }
7
- export declare const ElementsTimeline: (({ store, scale, width }: ElementTimelineProps) => import("react").JSX.Element | null) & {
8
- displayName: string;
7
+ export declare const ElementsTimeline: (({ store, scale, width }: ElementTimelineProps) => import("react").JSX.Element | null) & import("react").NamedExoticComponent<ElementTimelineProps> & {
8
+ readonly type: ({ store, scale, width }: ElementTimelineProps) => import("react").JSX.Element | null;
9
9
  };
10
10
  export {};
@@ -8,6 +8,12 @@ export declare const usePagePreview: ({ page, setPreview, groupRef, }: {
8
8
  export declare const PagePreview: (({ page, scale }: {
9
9
  page: PageType;
10
10
  scale: number;
11
- }) => React.JSX.Element) & {
12
- displayName: string;
11
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
12
+ page: PageType;
13
+ scale: number;
14
+ }> & {
15
+ readonly type: ({ page, scale }: {
16
+ page: PageType;
17
+ scale: number;
18
+ }) => React.JSX.Element;
13
19
  };
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"react";import{observer as n}from"mobx-react-lite";import{nodeReaction as i}from"../utils/mobx.js";import{onSnapshot as a}from"mobx-state-tree";import{PolotnoIcon as s}from"../icons/registry.js";import{flags as r}from"../utils/flags.js";import{t as l}from"../utils/l10n.js";import{deepEqual as c}from"../utils/deep-equal.js";import{DropdownMenu as d,DropdownMenuContent as p,DropdownMenuItem as u}from"../primitives/dropdown-menu.js";import{DRAG_SLOP_PX as g,isPrimaryDrag as m,startPointerDrag as h}from"../utils/pointer-drag.js";import{Spinner as f}from"./spinner.js";import{TrackHandleRight as v,TrackMenu as x,TrackMenuButton as P}from"./track-styles.js";let b=[],w=!1;const y=async()=>{var e;if(w||0===b.length){return}w=!0;const{page:t,setPreview:o}=b.shift();try{o(await t.store.toDataURL({pageId:t.id,pixelRatio:.1,quickMode:!0}))}catch(n){"EXPORT_FAILED"===(null==n?void 0:n.code)&&["workspace-not-mounted","unmounted-during-export"].includes(null===(e=n.details)||void 0===e?void 0:e.reason)||n instanceof Error&&"string"==typeof n.message&&(n.message.includes("Canvas was unmounted.")||n.message.includes("<Workspace /> component is not mounted"))||console.error(n)}finally{w=!1}y()};export const usePagePreview=({page:e,setPreview:t,groupRef:n})=>{const s=o.useRef(!1);o.useEffect(()=>{const o=()=>{b.push({page:e,setPreview:e=>t(e)}),y()};let r=null,l=null,d=Date.now();const p=()=>{r&&clearTimeout(r),s.current&&(l||(l=setTimeout(()=>{Date.now()-d>=6e3&&(o(),d=Date.now(),l=null)},6e3)),r=setTimeout(()=>{o(),d=Date.now(),r=null,l&&(clearTimeout(l),l=null)},300))};let u=null;const g=a(e,e=>{c(u,e)||(p(),u=e)}),m=i(e,()=>e.children.some(e=>e._editModeEnabled),e=>{e||p()}),h=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting?(s.current=!0,p()):(r&&clearTimeout(r),l&&clearTimeout(l),s.current=!1)})},{threshold:.1});return n.current&&h.observe(n.current),()=>{h.disconnect(),r&&clearTimeout(r),l&&clearTimeout(l),g(),m(),b=b.filter(t=>t.page!==e)}},[n,e,t])};export const PagePreview=n(({page:n,scale:i})=>{const[a,c]=o.useState(null),b=n.store.activePage===n||n.store._selectedPagesIds.includes(n.id),w=o.useRef(null),y=n.store.pages.indexOf(n),j=60/n.computedHeight*n.computedWidth,k=r.animationsEnabled?n.duration*i:j,E=n.store.pages.length>1;return o.useLayoutEffect(()=>{w.current&&(w.current.style.width=k+"px")},[y,k]),usePagePreview({page:n,setPreview:c,groupRef:w}),t("div",{ref:w,style:{width:k+"px",marginRight:r.animationsEnabled?"0px":"10px",height:"60px",display:"flex",position:"relative",borderRadius:"15px",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.18)"},className:"polotno-page-container pn:[&:hover_.polotno-track-menu]:pointer-events-auto pn:[&:hover_.polotno-track-menu]:opacity-100"+(b?" sortable-selected":""),children:[e("div",{style:{width:"100%",height:"100%",borderRadius:"15px",backgroundImage:a?`url("${a}")`:"none",backgroundRepeat:"repeat-x",backgroundSize:"auto 100%",backgroundColor:"white",display:"flex",justifyContent:"center",alignItems:"center"},onClick:e=>{const{store:t}=n,o=t._selectedPagesIds.length?t._selectedPagesIds:t.activePage?[t.activePage.id]:[],i=o.includes(n.id),a=e.shiftKey;if(a&&i){const e=o.filter(e=>e!==n.id);t.selectPages(e)}else if(a&&!i){const e=o.concat([n.id]);t.selectPages(e)}else{t.selectPages([n.id])}},children:!a&&e(f,{})}),e("div",{style:{position:"absolute",top:"0",left:"0px",bottom:"0px",right:"0px",borderRadius:"15px",border:b?"2px solid rgb(0, 161, 255, 0.9)":"2px solid var(--pn-border)",zIndex:1,pointerEvents:"none"}}),r.animationsEnabled&&t("div",{style:{position:"absolute",zIndex:1,bottom:"5px",left:"5px",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"white",padding:"2px 7px",textAlign:"center",borderRadius:"4rem"},children:[(n.duration/1e3).toFixed(1),"s"]}),r.animationsEnabled&&e(v,{className:"pn:z-[2] pn:before:h-1/2",onPointerDown:e=>{if(!m(e)){return}const t=e.clientX,o=n.duration;h(e,{slopX:g,onMove:e=>{const a=(e.clientX-t)/i;n.set({duration:Math.max(1e3,o+a)})}})}}),b&&e(x,{className:"polotno-page-menu pn:top-[5px] pn:right-4 pn:translate-y-0",onClick:e=>{e.stopPropagation()},children:t(d,{children:[e(P,{}),t(p,{side:"top",className:"pn:whitespace-nowrap",children:[t(u,{onSelect:e=>{e.preventDefault();const t=n.store,o=(t.selectedPages||[]).filter(Boolean),i=o.length?o:t.activePage?[t.activePage]:[];if(!i.length){return}const a=new Set(i.map(e=>e.id)),s=t.pages.filter(e=>a.has(e.id)),r=s[s.length-1],l=s.map(e=>e.clone()),c=t.pages.indexOf(r);l.forEach((e,t)=>{e.setZIndex(c+1+t)}),t.selectPages(l.map(e=>e.id))},children:[e(s,{name:"action.duplicate",className:"pn:size-4"}),l("pagesTimeline.duplicatePage")]}),t(u,{onSelect:e=>{var t,o,i;e.preventDefault();const a=n.store.addPage({bleed:(null===(t=n.store.activePage)||void 0===t?void 0:t.bleed)||0,width:(null===(o=n.store.activePage)||void 0===o?void 0:o.width)||"auto",height:(null===(i=n.store.activePage)||void 0===i?void 0:i.height)||"auto"}),s=n.store.pages.indexOf(n);a.setZIndex(s+1)},children:[e(s,{name:"action.add",className:"pn:size-4"}),l("pagesTimeline.addPage")]}),E&&t(u,{onSelect:e=>{e.preventDefault();const t=n.store,o=(t.selectedPages||[]).filter(Boolean),i=o.length?o.map(e=>e.id):t.activePage?[t.activePage.id]:[];i.length&&t.deletePages(i)},children:[e(s,{name:"action.remove",className:"pn:size-4"}),l("pagesTimeline.removePage")]})]})]})})]})});
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"react";import{observer as n}from"mobx-react-lite";import{nodeReaction as i}from"../utils/mobx.js";import{onSnapshot as a}from"mobx-state-tree";import{PolotnoIcon as s}from"../icons/registry.js";import{flags as r}from"../utils/flags.js";import{t as l}from"../utils/l10n.js";import{deepEqual as c}from"../utils/deep-equal.js";import{DropdownMenu as d,DropdownMenuContent as p,DropdownMenuItem as u}from"../primitives/dropdown-menu.js";import{DRAG_SLOP_PX as g,isPrimaryDrag as m,usePointerDrag as h}from"../utils/pointer-drag.js";import{Spinner as f}from"./spinner.js";import{TrackHandleRight as v,TrackMenu as x,TrackMenuButton as P}from"./track-styles.js";let b=[],w=!1;const y=async()=>{var e;if(w||0===b.length){return}w=!0;const{page:t,setPreview:o}=b.shift();try{o(await t.store.toDataURL({pageId:t.id,pixelRatio:.1,quickMode:!0}))}catch(n){"EXPORT_FAILED"===(null==n?void 0:n.code)&&["workspace-not-mounted","unmounted-during-export"].includes(null===(e=n.details)||void 0===e?void 0:e.reason)||n instanceof Error&&"string"==typeof n.message&&(n.message.includes("Canvas was unmounted.")||n.message.includes("<Workspace /> component is not mounted"))||console.error(n)}finally{w=!1}y()};export const usePagePreview=({page:e,setPreview:t,groupRef:n})=>{const s=o.useRef(!1);o.useEffect(()=>{const o=()=>{b.push({page:e,setPreview:e=>t(e)}),y()};let r=null,l=null,d=Date.now();const p=()=>{r&&clearTimeout(r),s.current&&(l||(l=setTimeout(()=>{Date.now()-d>=6e3&&(o(),d=Date.now(),l=null)},6e3)),r=setTimeout(()=>{o(),d=Date.now(),r=null,l&&(clearTimeout(l),l=null)},300))};let u=null;const g=a(e,e=>{c(u,e)||(p(),u=e)}),m=i(e,()=>e.children.some(e=>e._editModeEnabled),e=>{e||p()}),h=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting?(s.current=!0,p()):(r&&clearTimeout(r),l&&clearTimeout(l),s.current=!1)})},{threshold:.1});return n.current&&h.observe(n.current),()=>{h.disconnect(),r&&clearTimeout(r),l&&clearTimeout(l),g(),m(),b=b.filter(t=>t.page!==e)}},[n,e,t])};export const PagePreview=n(({page:n,scale:i})=>{const[a,c]=o.useState(null),b=n.store.activePage===n||n.store._selectedPagesIds.includes(n.id),w=o.useRef(null),y=n.store.pages.indexOf(n),j=60/n.computedHeight*n.computedWidth,k=r.animationsEnabled?n.duration*i:j,E=n.store.pages.length>1;o.useLayoutEffect(()=>{w.current&&(w.current.style.width=k+"px")},[y,k]),usePagePreview({page:n,setPreview:c,groupRef:w});const I=h();return t("div",{ref:w,style:{width:k+"px",marginRight:r.animationsEnabled?"0px":"10px",height:"60px",display:"flex",position:"relative",borderRadius:"15px",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.18)"},className:"polotno-page-container pn:[&:hover_.polotno-track-menu]:pointer-events-auto pn:[&:hover_.polotno-track-menu]:opacity-100"+(b?" sortable-selected":""),children:[e("div",{style:{width:"100%",height:"100%",borderRadius:"15px",backgroundImage:a?`url("${a}")`:"none",backgroundRepeat:"repeat-x",backgroundSize:"auto 100%",backgroundColor:"white",display:"flex",justifyContent:"center",alignItems:"center"},onClick:e=>{const{store:t}=n,o=t._selectedPagesIds.length?t._selectedPagesIds:t.activePage?[t.activePage.id]:[],i=o.includes(n.id),a=e.shiftKey;if(a&&i){const e=o.filter(e=>e!==n.id);t.selectPages(e)}else if(a&&!i){const e=o.concat([n.id]);t.selectPages(e)}else{t.selectPages([n.id])}},children:!a&&e(f,{})}),e("div",{style:{position:"absolute",top:"0",left:"0px",bottom:"0px",right:"0px",borderRadius:"15px",border:b?"2px solid rgb(0, 161, 255, 0.9)":"2px solid var(--pn-border)",zIndex:1,pointerEvents:"none"}}),r.animationsEnabled&&t("div",{style:{position:"absolute",zIndex:1,bottom:"5px",left:"5px",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"white",padding:"2px 7px",textAlign:"center",borderRadius:"4rem"},children:[(n.duration/1e3).toFixed(1),"s"]}),r.animationsEnabled&&e(v,{className:"pn:z-[2] pn:before:h-1/2",onPointerDown:e=>{if(!m(e)){return}const t=e.clientX,o=n.duration;I(e,{slopX:g,node:n,onMove:e=>{const a=(e.clientX-t)/i;n.set({duration:Math.max(1e3,o+a)})}})}}),b&&e(x,{className:"polotno-page-menu pn:top-[5px] pn:right-4 pn:translate-y-0",onClick:e=>{e.stopPropagation()},children:t(d,{children:[e(P,{}),t(p,{side:"top",className:"pn:whitespace-nowrap",children:[t(u,{onSelect:e=>{e.preventDefault();const t=n.store,o=(t.selectedPages||[]).filter(Boolean),i=o.length?o:t.activePage?[t.activePage]:[];if(!i.length){return}const a=new Set(i.map(e=>e.id)),s=t.pages.filter(e=>a.has(e.id)),r=s[s.length-1],l=s.map(e=>e.clone()),c=t.pages.indexOf(r);l.forEach((e,t)=>{e.setZIndex(c+1+t)}),t.selectPages(l.map(e=>e.id))},children:[e(s,{name:"action.duplicate",className:"pn:size-4"}),l("pagesTimeline.duplicatePage")]}),t(u,{onSelect:e=>{var t,o,i;e.preventDefault();const a=n.store.addPage({bleed:(null===(t=n.store.activePage)||void 0===t?void 0:t.bleed)||0,width:(null===(o=n.store.activePage)||void 0===o?void 0:o.width)||"auto",height:(null===(i=n.store.activePage)||void 0===i?void 0:i.height)||"auto"}),s=n.store.pages.indexOf(n);a.setZIndex(s+1)},children:[e(s,{name:"action.add",className:"pn:size-4"}),l("pagesTimeline.addPage")]}),E&&t(u,{onSelect:e=>{e.preventDefault();const t=n.store,o=(t.selectedPages||[]).filter(Boolean),i=o.length?o.map(e=>e.id):t.activePage?[t.activePage.id]:[];i.length&&t.deletePages(i)},children:[e(s,{name:"action.remove",className:"pn:size-4"}),l("pagesTimeline.removePage")]})]})]})})]})});
@@ -3,6 +3,12 @@ import type { StoreType } from '../ui-types.js';
3
3
  export declare const PagesTimeline: (({ store, defaultOpened, }: {
4
4
  store: StoreType;
5
5
  defaultOpened?: boolean;
6
- }) => React.JSX.Element) & {
7
- displayName: string;
6
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
7
+ store: StoreType;
8
+ defaultOpened?: boolean;
9
+ }> & {
10
+ readonly type: ({ store, defaultOpened, }: {
11
+ store: StoreType;
12
+ defaultOpened?: boolean;
13
+ }) => React.JSX.Element;
8
14
  };
@@ -1 +1 @@
1
- import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import n from"react";import{observer as o}from"mobx-react-lite";import{PolotnoIcon as r}from"../icons/registry.js";import{flags as a}from"../utils/flags.js";import{t as s}from"../utils/l10n.js";import{clamp as l,cn as p}from"../lib/utils.js";import{Button as m}from"../primitives/button.js";import{floatingControl as d}from"../primitives/floating-control.js";import{Navbar as c}from"../primitives/navbar.js";import{Pages as h}from"./pages.js";import{CurrentTime as u}from"./current-time.js";import{Audios as g}from"./audios.js";import{ElementsTimeline as f}from"./elements.js";import{PlayButton as v}from"./play-button.js";import{TimeRuler as b}from"./time-ruler.js";import{isPrimaryDrag as x,startPointerDrag as j}from"../utils/pointer-drag.js";export const PagesTimeline=o(({store:o,defaultOpened:y=!1})=>{const E=n.useRef(null),[w,z]=n.useState(y),[N,k]=n.useState(.02),[S,C]=n.useState(()=>(e=>{if(!a.animationsEnabled){return 65}const i=e.pages.reduce((e,i)=>e+i.children.length,0),t=25*e.audios.length+20*i+140;return l(t,140,420)})(o)),[P,T]=n.useState(!1),W=o.duration*N;return i(t,{children:[e("div",{style:{position:"relative",height:"0px"},children:i(m,{variant:"ghost",size:"sm",onClick:()=>{z(!w)},className:p(d(),"pn:absolute pn:bottom-[5px] pn:left-[5px] pn:z-[1] pn:dark:hover:bg-accent"),children:[a.animationsEnabled&&!w?e(r,{name:"pagesTimeline.play",className:"pn:size-4"}):null,s("pagesTimeline.pages")]})}),i(c,{attached:"top",style:{padding:"5px",height:"auto",zIndex:1,position:"relative",overflow:"visible",display:w?"block":"none"},className:"polotno-pages-timeline pn:whitespace-normal pn:bg-background",children:[a.animationsEnabled&&e("div",{onPointerDown:e=>{if(!x(e)){return}const i=e.clientY,t=S;T(!0),j(e,{onMove:e=>{const n=t-(e.clientY-i);C(l(n,140,420))},onEnd:()=>T(!1)})},className:"pn:group/pn-resize-handle pn:absolute pn:top-0 pn:left-0 pn:right-0 pn:flex pn:h-[14px] pn:-translate-y-1/2 pn:cursor-ns-resize pn:touch-none pn:items-center pn:justify-center"+(P?" active":""),title:"Drag to adjust timeline height",children:e("div",{className:"pn:h-1 pn:w-full pn:rounded-[2px] pn:transition-colors pn:group-hover/pn-resize-handle:bg-primary"+(P?" pn:bg-primary":" pn:bg-transparent")})}),a.animationsEnabled&&e("div",{style:{display:"flex",justifyContent:"center"},children:e(v,{store:o,scale:N,onScaleChange:k})}),e("div",{dir:"ltr",style:{width:"100%",position:"relative",height:S},children:e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflowX:"auto",padding:"0 24px"},ref:E,children:i("div",{style:{position:"relative",minWidth:a.animationsEnabled?W+"px":void 0},children:[a.animationsEnabled&&e(b,{store:o,scale:N,minWidth:W}),i("div",{style:{position:"relative",display:"flex"},children:[e("div",{style:{position:"relative",minWidth:a.animationsEnabled?W+"px":void 0,height:"60px"},children:e(h,{store:o,scale:N})}),e(m,{variant:"ghost",size:"icon",style:{width:"60px",height:"60px",marginLeft:"12px"},onClick:()=>{var e;o.addPage({bleed:(null===(e=o.activePage)||void 0===e?void 0:e.bleed)||0})},children:e(r,{name:"action.add",className:"pn:size-4"})})]}),a.animationsEnabled&&i(t,{children:[e(f,{store:o,scale:N,width:W}),e(g,{store:o,scale:N,width:W})]}),a.animationsEnabled&&e(u,{store:o,scale:N,dragAreaRef:E,variant:"timeline"})]})})})]})]})});
1
+ import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import n from"react";import{observer as o}from"mobx-react-lite";import{PolotnoIcon as r}from"../icons/registry.js";import{flags as a}from"../utils/flags.js";import{t as s}from"../utils/l10n.js";import{clamp as l,cn as p}from"../lib/utils.js";import{Button as m}from"../primitives/button.js";import{floatingControl as d}from"../primitives/floating-control.js";import{Navbar as c}from"../primitives/navbar.js";import{Pages as h}from"./pages.js";import{CurrentTime as u}from"./current-time.js";import{Audios as g}from"./audios.js";import{ElementsTimeline as f}from"./elements.js";import{PlayButton as v}from"./play-button.js";import{TimeRuler as b}from"./time-ruler.js";import{isPrimaryDrag as x,usePointerDrag as j}from"../utils/pointer-drag.js";export const PagesTimeline=o(({store:o,defaultOpened:y=!1})=>{const E=n.useRef(null),[w,z]=n.useState(y),[N,k]=n.useState(.02),[S,C]=n.useState(()=>(e=>{if(!a.animationsEnabled){return 65}const i=e.pages.reduce((e,i)=>e+i.children.length,0),t=25*e.audios.length+20*i+140;return l(t,140,420)})(o)),[P,T]=n.useState(!1),W=j(),D=o.duration*N;return i(t,{children:[e("div",{style:{position:"relative",height:"0px"},children:i(m,{variant:"ghost",size:"sm",onClick:()=>{z(!w)},className:p(d(),"pn:absolute pn:bottom-[5px] pn:left-[5px] pn:z-[1] pn:dark:hover:bg-accent"),children:[a.animationsEnabled&&!w?e(r,{name:"pagesTimeline.play",className:"pn:size-4"}):null,s("pagesTimeline.pages")]})}),i(c,{attached:"top",style:{padding:"5px",height:"auto",zIndex:1,position:"relative",overflow:"visible",display:w?"block":"none"},className:"polotno-pages-timeline pn:whitespace-normal pn:bg-background",children:[a.animationsEnabled&&e("div",{onPointerDown:e=>{if(!x(e)){return}const i=e.clientY,t=S;T(!0),W(e,{onMove:e=>{const n=t-(e.clientY-i);C(l(n,140,420))},onEnd:()=>T(!1)})},className:"pn:group/pn-resize-handle pn:absolute pn:top-0 pn:left-0 pn:right-0 pn:flex pn:h-[14px] pn:-translate-y-1/2 pn:cursor-ns-resize pn:touch-none pn:items-center pn:justify-center"+(P?" active":""),title:"Drag to adjust timeline height",children:e("div",{className:"pn:h-1 pn:w-full pn:rounded-[2px] pn:transition-colors pn:group-hover/pn-resize-handle:bg-primary"+(P?" pn:bg-primary":" pn:bg-transparent")})}),a.animationsEnabled&&e("div",{style:{display:"flex",justifyContent:"center"},children:e(v,{store:o,scale:N,onScaleChange:k})}),e("div",{dir:"ltr",style:{width:"100%",position:"relative",height:S},children:e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflowX:"auto",padding:"0 24px"},ref:E,children:i("div",{style:{position:"relative",minWidth:a.animationsEnabled?D+"px":void 0},children:[a.animationsEnabled&&e(b,{store:o,scale:N,minWidth:D}),i("div",{style:{position:"relative",display:"flex"},children:[e("div",{style:{position:"relative",minWidth:a.animationsEnabled?D+"px":void 0,height:"60px"},children:e(h,{store:o,scale:N})}),e(m,{variant:"ghost",size:"icon",style:{width:"60px",height:"60px",marginLeft:"12px"},onClick:()=>{var e;o.addPage({bleed:(null===(e=o.activePage)||void 0===e?void 0:e.bleed)||0})},children:e(r,{name:"action.add",className:"pn:size-4"})})]}),a.animationsEnabled&&i(t,{children:[e(f,{store:o,scale:N,width:D}),e(g,{store:o,scale:N,width:D})]}),a.animationsEnabled&&e(u,{store:o,scale:N,dragAreaRef:E,variant:"timeline"})]})})})]})]})});
@@ -2,6 +2,12 @@ import type { StoreType } from '../ui-types.js';
2
2
  export declare const Pages: (({ store, scale }: {
3
3
  store: StoreType;
4
4
  scale: number;
5
- }) => import("react").JSX.Element) & {
6
- displayName: string;
5
+ }) => import("react").JSX.Element) & import("react").NamedExoticComponent<{
6
+ store: StoreType;
7
+ scale: number;
8
+ }> & {
9
+ readonly type: ({ store, scale }: {
10
+ store: StoreType;
11
+ scale: number;
12
+ }) => import("react").JSX.Element;
7
13
  };
@@ -4,7 +4,7 @@ interface PlayButtonProps {
4
4
  scale?: number;
5
5
  onScaleChange?: (scale: number) => void;
6
6
  }
7
- export declare const PlayButton: (({ store, scale, onScaleChange }: PlayButtonProps) => import("react").JSX.Element) & {
8
- displayName: string;
7
+ export declare const PlayButton: (({ store, scale, onScaleChange }: PlayButtonProps) => import("react").JSX.Element) & import("react").NamedExoticComponent<PlayButtonProps> & {
8
+ readonly type: ({ store, scale, onScaleChange }: PlayButtonProps) => import("react").JSX.Element;
9
9
  };
10
10
  export {};
@@ -4,6 +4,14 @@ export declare const TimeRuler: (({ store, scale, minWidth, }: {
4
4
  store: StoreType;
5
5
  scale: number;
6
6
  minWidth?: number;
7
- }) => React.JSX.Element) & {
8
- displayName: string;
7
+ }) => React.JSX.Element) & React.NamedExoticComponent<{
8
+ store: StoreType;
9
+ scale: number;
10
+ minWidth?: number;
11
+ }> & {
12
+ readonly type: ({ store, scale, minWidth, }: {
13
+ store: StoreType;
14
+ scale: number;
15
+ minWidth?: number;
16
+ }) => React.JSX.Element;
9
17
  };
@@ -1 +1 @@
1
- import{jsx as t,jsxs as e}from"react/jsx-runtime";import n from"react";import{observer as r}from"mobx-react-lite";import{clamp as i}from"../lib/utils.js";import{isPrimaryDrag as l,startPointerDrag as o}from"../utils/pointer-drag.js";export const TimeRuler=r(({store:r,scale:a,minWidth:s=0})=>{const c=n.useRef(null),p=Math.max(r.duration,0),m=Math.max(1,Math.ceil(p/1e3)),u=Math.max(p*a,s,120),h=1e3*a,d=[1,2,5,10,15,30,60,120,300,600],f=d.find(t=>t*h>=70)||d[d.length-1],x=Math.max(1,Math.ceil(20/h)),g=n.useCallback(t=>{var e;if(!c.current){return}const n=c.current.getBoundingClientRect(),l=i(t-n.left,0,n.width);r.setCurrentTime(i(l/a,0,r.duration)),null===(e=r.checkActivePage)||void 0===e||e.call(r)},[a,r]),v=n.useCallback(t=>{l(t)&&(g(t.clientX),o(t,{onMove:t=>g(t.clientX)}))},[g]);return t("div",{ref:c,className:"polotno-time-ruler pn:relative pn:h-6 pn:cursor-pointer pn:touch-pan-y pn:select-none pn:text-inherit",onPointerDown:v,style:{minWidth:u+"px",width:u+"px"},children:Array.from({length:m+1},(n,r)=>{const i=r%f===0,l=r%x===0&&!i;return i||l?e("div",{style:{position:"absolute",left:1e3*r*a+"px",top:0,transform:"translateX(-50%)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:4,pointerEvents:"none"},children:[l&&t("div",{className:"pn:size-1 pn:rounded-full pn:bg-current pn:opacity-50"}),i&&t("div",{className:"pn:mt-1 pn:text-center pn:text-[11px] pn:tabular-nums pn:opacity-70",children:r<60?`${r}s`:`${Math.floor(r/60)}m${r%60?r%60+"s":""}`})]},r):null})})});
1
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import n from"react";import{observer as r}from"mobx-react-lite";import{clamp as i}from"../lib/utils.js";import{isPrimaryDrag as l,usePointerDrag as o}from"../utils/pointer-drag.js";export const TimeRuler=r(({store:r,scale:a,minWidth:s=0})=>{const c=n.useRef(null),p=o(),m=Math.max(r.duration,0),u=Math.max(1,Math.ceil(m/1e3)),h=Math.max(m*a,s,120),d=1e3*a,f=[1,2,5,10,15,30,60,120,300,600],x=f.find(t=>t*d>=70)||f[f.length-1],g=Math.max(1,Math.ceil(20/d)),v=n.useCallback(t=>{var e;if(!c.current){return}const n=c.current.getBoundingClientRect(),l=i(t-n.left,0,n.width);r.setCurrentTime(i(l/a,0,r.duration)),null===(e=r.checkActivePage)||void 0===e||e.call(r)},[a,r]),y=n.useCallback(t=>{l(t)&&(v(t.clientX),p(t,{onMove:t=>v(t.clientX)}))},[p,v]);return t("div",{ref:c,className:"polotno-time-ruler pn:relative pn:h-6 pn:cursor-pointer pn:touch-pan-y pn:select-none pn:text-inherit",onPointerDown:y,style:{minWidth:h+"px",width:h+"px"},children:Array.from({length:u+1},(n,r)=>{const i=r%x===0,l=r%g===0&&!i;return i||l?e("div",{style:{position:"absolute",left:1e3*r*a+"px",top:0,transform:"translateX(-50%)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:4,pointerEvents:"none"},children:[l&&t("div",{className:"pn:size-1 pn:rounded-full pn:bg-current pn:opacity-50"}),i&&t("div",{className:"pn:mt-1 pn:text-center pn:text-[11px] pn:tabular-nums pn:opacity-70",children:r<60?`${r}s`:`${Math.floor(r/60)}m${r%60?r%60+"s":""}`})]},r):null})})});