polotno 3.17.0 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blueprint/side-panel/select-video.d.ts +18 -16
- package/canvas/animated-shadow.d.ts +11 -0
- package/canvas/animated-shadow.js +1 -0
- package/canvas/apply-filters.d.ts +5 -1
- package/canvas/apply-filters.js +1 -1
- package/canvas/downscale.js +1 -1
- package/canvas/element.js +1 -1
- package/canvas/figure-element.js +1 -1
- package/canvas/gif-element.js +1 -1
- package/canvas/html-element.js +1 -1
- package/canvas/image-element.d.ts +1 -0
- package/canvas/image-element.js +1 -1
- package/canvas/line-element.js +1 -1
- package/canvas/page.js +1 -1
- package/canvas/render-tag-element.js +1 -1
- package/canvas/rich-editor.d.ts +2 -0
- package/canvas/rich-editor.js +8 -5
- package/canvas/text-element.js +1 -1
- package/canvas/use-animated-blur.d.ts +4 -0
- package/canvas/use-animated-blur.js +1 -0
- package/canvas/use-color.d.ts +1 -1
- package/canvas/use-filtered-source.js +1 -1
- package/canvas/use-offscreen-canvas.d.ts +2 -0
- package/canvas/use-offscreen-canvas.js +1 -0
- package/canvas/use-transformer-snap.js +1 -1
- package/canvas/video-element.js +1 -1
- package/icons/animation-icons.d.ts +30 -7
- package/icons/animation-icons.js +1 -1
- package/icons/registry.d.ts +22 -0
- package/icons/registry.js +1 -1
- package/image-tools/raster.js +1 -1
- package/model/figure-model.d.ts +10 -9
- package/model/gif-model.d.ts +10 -9
- package/model/group-model.d.ts +78 -68
- package/model/group-model.js +1 -1
- package/model/history.d.ts +3 -0
- package/model/history.js +1 -1
- package/model/image-model.d.ts +10 -9
- package/model/line-model.d.ts +10 -9
- package/model/node-model.d.ts +8 -8
- package/model/page-model.d.ts +228 -204
- package/model/shape-model.d.ts +15 -9
- package/model/shape-model.js +1 -1
- package/model/store.d.ts +31 -17
- package/model/store.js +1 -1
- package/model/svg-model.d.ts +9 -8
- package/model/table-model.d.ts +8 -7
- package/model/text-model.d.ts +9 -8
- package/model/video-model.d.ts +10 -9
- package/package.json +24 -21
- package/pages-timeline/element-track.js +1 -1
- package/pages-timeline/page-preview.js +1 -1
- package/polotno.bundle.js +195 -177
- package/side-panel/animations-panel.js +1 -1
- package/side-panel/select-video.d.ts +18 -16
- package/side-panel/text-panel.js +1 -1
- package/side-panel/text-template.js +1 -1
- package/toolbar/animations-picker.js +1 -1
- package/toolbar/use-copy-style.d.ts +1 -0
- package/toolbar/use-copy-style.js +1 -1
- package/ui.css +1 -1
- package/utils/animations.d.ts +212 -10
- package/utils/animations.js +1 -1
- package/utils/clipboard.d.ts +17 -15
- package/utils/clipboard.js +1 -1
- package/utils/duplicate.js +1 -1
- package/utils/fonts.js +1 -1
- package/utils/from-svg.js +1 -1
- package/utils/image-dpi.js +1 -1
- package/utils/image-edit.js +1 -1
- package/utils/l10n.d.ts +44 -0
- package/utils/l10n.js +1 -1
- package/utils/px.d.ts +1 -0
- package/utils/px.js +1 -1
- package/utils/timeline.d.ts +3 -1
- package/utils/timeline.js +1 -1
- package/utils/validate-key.js +1 -1
package/canvas/video-element.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{elementOpacity as i}from"./paint-opacity.js";import o from"react";import{toDisplayColor as n}from"@polotno/core/color";import{observer as a}from"mobx-react-lite";import{isAlive as s}from"mobx-state-tree";import{nodeAutorun as d}from"../utils/mobx.js";import{Arc as c,Group as h,Image as l,Rect as u,Text as m}from"react-konva";import{ROLES as p}from"../model/store.js";import{DEFAULT_RETRIES as g,isDeterministicUrl as f,retryDelayMs as v}from"@polotno/core/retry";import w from"konva";import{useWorkspaceStyle as x}from"./workspace-style.js";import{incrementLoader as E,triggerLoadError as y}from"../utils/loader.js";import{polotnoError as M}from"@polotno/core/errors";import{getCropRect as L}from"@polotno/core/image";import*as T from"@polotno/core/svg";import{activeAnchorOf as C,roundedCropFraction as b,roundedGeometryPx as k,roundedPosition as I,isCornerAnchor as R,scaledStyleAttrs as j,roundedStyleAttrs as S,transformScale as P}from"../utils/px.js";import{useFilteredSource as H}from"./use-filtered-source.js";import{useEvent as A}from"../hooks/use-event.js";import{useFadeIn as W}from"./use-fadein.js";import{isTouchDevice as X}from"../utils/screen.js";import{createPlayGate as Y,playMedia as O}from"../utils/media.js";import{useMediabunnyVideo as _}from"./use-mediabunny-video.js";import{getElementTimeRange as D,getVideoRestMs as z}from"../utils/timeline.js";import{drawReduced as V,exportKernelEnabled as U,shouldResample as Z,sourceSize as B}from"./downscale.js";import{trySetCanvasSize as F}from"../utils/canvas.js";import{useClipImage as N}from"./image-element.js";import{CropOverlay as $,CROP_CORNER_ANCHORS as q}from"./crop-overlay.js";const G=new window.Image;G.src=T.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 J=new window.Image;J.src=T.svgToURL('\n <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path opacity="0.6" d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" fill="white"/>\n <path opacity="0.6" d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" fill="white"/>\n <path d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n');export const useCornerRadiusAndCrop=(e,t,r,i,n=0,a=!1)=>{var s;const d=Math.floor(Math.max(e.width*i,1)),c=Math.floor(Math.max(e.height*i,1)),h=Math.min(n*i,d/2,c/2),l=Math.max(e.width/r.width,e.height/r.height)*i,u=U(e.page)&&!a&&Z(l,d,c),{width:m,height:p}=t?B(t):{},g=0===r.x&&0===r.y&&r.width===m&&r.height===p,f=o.useMemo(()=>{if(t&&m&&p){return g&&0===h&&!u?void 0:document.createElement("canvas")}},[t,h,u,g,m,p]),v=()=>{if(!f||!t){return}f.width=d,f.height=c;const e=f.getContext("2d");e&&(h&&(e.beginPath(),e.moveTo(h,0),e.lineTo(d-h,0),e.arc(d-h,h,h,3*Math.PI/2,0,!1),e.lineTo(d,c-h),e.arc(d-h,c-h,h,0,Math.PI/2,!1),e.lineTo(h,c),e.arc(h,c-h,h,Math.PI/2,Math.PI,!1),e.lineTo(0,h),e.arc(h,h,h,Math.PI,3*Math.PI/2,!1),e.clip()),u?V(e,t,r,f.width,f.height):e.drawImage(t,r.x,r.y,r.width,r.height,0,0,f.width,f.height))};return o.useLayoutEffect(()=>{v()},[f,e.width,e.height,r.x,r.y,r.width,r.height,n,i,a,null===(s=e.page)||void 0===s?void 0:s._exportingOrRendering,u]),o.useEffect(()=>()=>{f&&"CANVAS"===f.nodeName&&w.Util.releaseCanvas(f)},[f]),[f||t,v]};export const useClip=(e,t,r,i)=>{const[n,a]=N(e.clipSrc||""),s=e.clipSrc?a:"loaded";useLoader(s,e.clipSrc,e.id);const d=!!t&&!!n,c=o.useMemo(()=>d?{canvas:document.createElement("canvas"),mask:document.createElement("canvas"),width:0,height:0}:void 0,[d]),h=null==c?void 0:c.canvas;function l(){if(!c||!h||!t){return}const{width:i,height:o}=B(t);if(!i||!o){return}const n=Math.min(1e4,Math.max(i,Math.ceil(e.a.width*r),1)),a=Math.min(1e4,Math.max(o,Math.ceil(e.a.height*r),1));c.width===n&&c.height===a||(F(h,n,a),c.width=n,c.height=a);const s=h.getContext("2d");s&&(s.clearRect(0,0,h.width,h.height),s.save(),s.drawImage(c.mask,0,0,h.width,h.height),s.globalCompositeOperation="source-in",s.drawImage(t,0,0,h.width,h.height),s.restore())}return o.useLayoutEffect(()=>{var t;if(!c||!(null==n?void 0:n.width)||!n.height){return}const i=Math.max(e.a.width/n.width*r,e.a.height/n.height*r);F(c.mask,Math.min(1e4,Math.max(n.width*i,1)),Math.min(1e4,Math.max(n.height*i,1))),null===(t=c.mask.getContext("2d"))||void 0===t||t.drawImage(n,0,0,c.mask.width,c.mask.height)},[c,n,e.a.width,e.a.height,r]),o.useLayoutEffect(()=>{l()},[c,t,n,e.a.width,e.a.height,r,...i]),o.useEffect(()=>()=>{c&&w.Util.releaseCanvas(c.canvas,c.mask)},[c]),[d?h:t,l]};const K=document.createElement("canvas"),Q=a(({element:r})=>{const n=Math.min(30,r.width/4,r.height/4),a=o.useRef(null);o.useEffect(()=>{const e=a.current;if(!e){return}const t=new w.Animation(t=>{e.rotate(((null==t?void 0:t.timeDiff)||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});const{mediaLoadingStyle:s}=x();return t(h,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:i(r),hideInExport:!r.showInExport,children:[e(u,{width:r.width,height:r.height,fill:s.fill}),e(c,{ref:a,x:r.width/2,y:r.height/2,fill:s.textFill,outerRadius:Math.abs(n),innerRadius:Math.max(1,n-5),angle:270})]})}),ee=a(({element:r})=>{const{mediaErrorStyle:o}=x(),n=Math.max(10,Math.min(30,r.width/25));return t(h,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:i(r),hideInExport:!r.showInExport,children:[e(u,{width:r.width,height:r.height,fill:o.fill}),e(m,{text:"Can not load the video...",fontSize:n,width:r.width,height:r.height,align:"center",fill:o.textFill,verticalAlign:"middle",padding:5})]})});let te=function(e,t,r){const i=o.useRef("loading"),n=o.useRef(void 0),[a,s]=o.useState(0),d=o.useRef(void 0),c=o.useRef(void 0),h=o.useRef(void 0);return d.current===e&&c.current===t&&h.current===r||(i.current="loading",n.current=void 0,d.current=e,c.current=t,h.current=r),o.useLayoutEffect(()=>{if(!e){return}const o=f(e)?1:g;let a,d,c,h=0,l=!1,u=!1;const m=e=>{e&&(e.removeAttribute("src"),e.load())},p=()=>{h+=1;const g=document.createElement("video");function f(){l||(g.removeEventListener("canplay",f),u=!0,i.current="loaded",n.current=g,g.currentTime=0,s(Math.random()))}function w(e){var t;const r=4===g.readyState,c=g.buffered&&g.buffered.length>0&&g.buffered.end(g.buffered.length-1)/g.duration*100>=100;if(r&&c){return}if(l){return}if(!u&&h<o){return null==d||d(),m(g),void(a=setTimeout(p,v(h)))}const f=e.message||(null===(t=g.error)||void 0===t?void 0:t.message)||"Unknown error";console.error(new Error("Video failed to load: "+f)),i.current="failed",n.current=void 0,s(Math.random())}c=g,g.addEventListener("canplay",f),g.addEventListener("error",w),d=()=>{g.removeEventListener("canplay",f),g.removeEventListener("error",w)},t&&(g.crossOrigin=t),r&&(g.referrerPolicy=r),g.src=e,g.load()};return p(),()=>{l=!0,clearTimeout(a),null==d||d(),u||m(c)}},[e,t,r]),[n.current,i.current]};export const setVideoLoaderHook=e=>{te=e};function re(e){return!e.seeking&&e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}export const useLoader=(e,t,r)=>{const i=o.useRef(void 0),n=()=>{var e;null===(e=i.current)||void 0===e||e.call(i),i.current=void 0};o.useEffect(()=>n,[]),o.useLayoutEffect(()=>{const o=t.slice(0,200),a=`video with id ${r} url: ${o}`;"loading"!==e||i.current||(i.current=E(a)),"loading"!==e&&n(),"failed"===e&&y(M("VIDEO_FAILED",a,{src:o,elementId:r,reason:"load"}))},[e])};export const VideoElement=a(({element:a,store:c})=>{var m,g,f,v,x;const[y,M]=o.useState(!1),T=o.useRef(null),V=X(),[U,Z]=o.useState(!1),[F,N]=te(a.src,"anonymous"),[ie,oe]=o.useState(!1),ne=c.activePage===a.page,ae=(null===(m=a.page)||void 0===m?void 0:m._exportingOrRendering)&&"loaded"===N,se=_(a,c,ae);useLoader(N,a.src,a.id),F&&(F.playsInline=!0);const de=ae&&se||F,[ce,he]=((e,t)=>{const{flipX:r,flipY:i}=e,{width:n,height:a}=t?B(t):{},s=e=>{if(!t){return}const o=e.getContext("2d");o&&(o.clearRect(0,0,e.width,e.height),o.save(),o.scale(r?-1:1,i?-1:1),o.drawImage(t,r?-e.width:0,i?-e.height:0,e.width,e.height),o.restore())},d=o.useMemo(()=>{if(!r&&!i||!n||!a){return}const e=document.createElement("canvas");return e.width=n,e.height=a,s(e),e},[r,i,t,n,a]);return o.useEffect(()=>()=>{d&&w.Util.releaseCanvas(d)},[d]),[d||t,()=>{d&&s(d)}]})(a,de),[le=K,ue]=H(a,ce||K);o.useEffect(()=>{F&&c.history.ignore(()=>{a.set({duration:1e3*F.duration})})},[F]);const me=o.useMemo(Y,[F]);o.useEffect(()=>{var e;if(!F){return}const t=c.animatedElementsIds,r=(!t.length||t.includes(a.id))&&c.isPlaying;if(!ne||!r&&!U){return void F.pause()}U&&(F.muted=!1,F.currentTime=a.startTime*F.duration,O(F).then(e=>{"refused"===e&&Z(!1)}));const i=new w.Animation(()=>{Pe()},null===(e=T.current)||void 0===e?void 0:e.getLayer());i.start();const o=()=>{Z(!1),F.currentTime=a.startTime*F.duration},n=()=>{F.currentTime>=a.endTime*F.duration&&(F.pause(),F.currentTime=a.startTime*F.duration,Z(!1))};return F.addEventListener("ended",o),F.addEventListener("timeupdate",n),()=>{F.pause(),i.stop(),F.removeEventListener("ended",o),F.removeEventListener("timeupdate",n)}},[F,U,c.isPlaying,ne]),o.useEffect(()=>{F&&(F.volume=a.volume)},[F,a.volume]),o.useEffect(()=>{F&&(F.playbackRate=a.speed,F.preservesPitch=!1)},[F,a.speed]);const pe=o.useRef(null);o.useEffect(()=>{const e=d(a,()=>{var e,t;if(F){if(ae&&se){return Pe(),void c.currentTime}const r=c.animatedElementsIds;if(r.length&&!r.includes(a.id)){return}const i=c.activePage===a.page,o=c.currentTime>=a.page.startTime&&c.currentTime<a.page.startTime+a.page.duration,n=a.startTime*F.duration*1e3,s=F.duration*(a.endTime-a.startTime)*1e3,{start:d,end:h}=D(a.animations,a.page.duration),l=(c.currentTime||a.page.startTime)-a.page.startTime,u=o?z(c.currentTime,a.page.startTime,d,s,n,a.speed):0,m=u/1e3,p=o&&l>=d&&l<h;U||(F.muted=!p,p&&c.isPlaying&&i?F.paused?(F.currentTime=m,me.play(F)):Math.abs(1e3*F.currentTime-u)>500&&(F.currentTime=m):(me.reset(),F.paused||F.pause(),m!==F.currentTime&&(F.currentTime=m),!re(F)&&!c.isPlaying&&!pe.current&&(pe.current=E(`video ${a.id}`)))),Pe(),null===(t=null===(e=T.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()}});return()=>{e(),pe.current&&(pe.current(),pe.current=null)}},[c,F,ae,se,U]),o.useEffect(()=>{var e,t;if(!F){return}if(ae){return null===(e=pe.current)||void 0===e||e.call(pe),void(pe.current=null)}const r=()=>{var e;re(F)&&(Pe(),null===(e=pe.current)||void 0===e||e.call(pe),pe.current=null)};let i;return(null===(t=a.page)||void 0===t?void 0:t._exportingOrRendering)&&(i=setInterval(r,20)),F.addEventListener("timeupdate",r),F.addEventListener("canplay",r),F.addEventListener("seeked",r),()=>{clearInterval(i),F.removeEventListener("timeupdate",r),F.removeEventListener("canplay",r),F.removeEventListener("seeked",r)}},[null===(g=a.page)||void 0===g?void 0:g._exportingOrRendering,F,a.id,E,ae]);let{cropX:ge,cropY:fe,cropWidth:ve,cropHeight:we}=a;"loaded"!==N&&(ge=fe=0,ve=we=1);const{width:xe,height:Ee}=B(le),ye=null!==(f=null==F?void 0:F.videoWidth)&&void 0!==f?f:0,Me=null!==(v=null==F?void 0:F.videoHeight)&&void 0!==v?v:0;o.useLayoutEffect(()=>{"loaded"===N&&ye>0&&Me>0&&a._setSourceSize({width:ye,height:Me},a.src)},[a,a.src,N,ye,Me]);const Le=L({stretchEnabled:a.stretchEnabled,cropX:ge,cropY:fe,cropWidth:ve,cropHeight:we,width:a.a.width,height:a.a.height},{width:xe,height:Ee}),Te=Le.width,Ce=Le.height,be=a.stretchEnabled,ke=null!==(x=a.cornerRadius)&&void 0!==x?x:0,[Ie,Re]=useCornerRadiusAndCrop(a,le,Le,c._elementsPixelRatio,ke,!0);let[je,Se]=useClip(a,Ie,c._elementsPixelRatio,[Le,ke,c._elementsPixelRatio]);const Pe=A(()=>{var e,t;he(),ue(),Re(),Se(),null===(t=null===(e=T.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()});o.useEffect(()=>{Pe()});const He=()=>{a._cropEnabled&&setTimeout(()=>{s(a)&&a.toggleCropMode(!0)})},Ae="loading"===N,We="failed"===N,Xe=!Ae&&!We,Ye=o.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Oe=o.useRef(!1),_e=Xe?i(a):0;W(T,_e);const De=a.selectable||c.role===p.ADMIN;return e(r,{children:t(h,{onMouseEnter:()=>oe(!0),onMouseLeave:()=>oe(!1),children:[Ae&&e(Q,{element:a}),We&&e(ee,{element:a}),e(l,{ref:T,name:"element",id:a.id,image:je,x:a.a.x,y:a.a.y,width:a.a.width||1,height:a.a.height||1,rotation:a.a.rotation,opacity:_e,shadowEnabled:a.shadowEnabled,shadowBlur:a.shadowBlur,shadowOffsetX:a.shadowOffsetX,shadowOffsetY:a.shadowOffsetY,shadowColor:n(a.shadowColor),shadowOpacity:a.shadowOpacity,customCrop:Le,listening:De,draggable:V?a.draggable&&a.isSelected:a.draggable,preventDefault:!V||a.isSelected,hideInExport:!a.showInExport,onDragMove:e=>{a.set({x:e.target.x(),y:e.target.y()})},onDragEnd:e=>{a.set(I(e.target))},onDblClick:He,onDblTap:He,onTransformStart:e=>{M(!0),Oe.current=R(C(e.target)),Ye.current={cropX:a.cropX,cropY:a.cropY,cropWidth:a.cropWidth,cropHeight:a.cropHeight}},onTransform:e=>{const t=e.currentTarget,r=P(t.scaleX()),i=P(t.scaleY());t.scaleX(1),t.scaleY(1);const o=1-Te/xe,n=Math.min(o,Math.max(0,a.cropX)),s=1-Ce/Ee,d=Math.min(s,Math.max(0,a.cropY)),c=Oe.current,h=!c&&r<1&&Ye.current.cropHeight>Ce/Ee;let l=c?a.cropWidth:a.cropWidth*r;h&&(l=a.cropWidth);const u=!c&&i<1&&Ye.current.cropWidth>Te/xe;let m=c?a.cropHeight:a.cropHeight*i;u&&(m=a.cropHeight),be&&(l=a.cropWidth,m=a.cropHeight);const p=c?Math.min(r,i):1;a.set(Object.assign({cropX:n,cropY:d,x:t.x(),y:t.y(),width:t.width()*r,height:t.height()*i,rotation:e.target.rotation(),cropWidth:Math.min(l,1-n),cropHeight:Math.min(m,1-d)},1!==p&&j(a,p)))},onTransformEnd:e=>{const t=e.currentTarget;a.set(Object.assign({width:k(t.width()),height:k(t.height()),x:k(t.x()),y:k(t.y()),rotation:k(e.target.rotation()),cropX:b(a.cropX),cropY:b(a.cropY),cropWidth:b(Te/xe),cropHeight:b(Ce/Ee)},S(a))),M(!1)}}),!!a.borderSize&&e(u,{x:a.a.x,y:a.a.y,width:Math.max(a.a.width-a.borderSize,0),height:Math.max(a.a.height-a.borderSize,0),opacity:_e,offsetX:-a.borderSize/2,offsetY:-a.borderSize/2,stroke:n(a.borderColor),strokeWidth:a.borderSize,listening:!1,rotation:a.a.rotation,cornerRadius:Math.max(0,ke-a.borderSize),hideInExport:!a.showInExport}),!c.isPlaying&&e(l,{image:U?ie||V?J:void 0:G,x:a.a.x,y:a.a.y,offsetX:-a.a.width/2+15/c.scale,offsetY:-a.a.height/2+15/c.scale,rotation:a.a.rotation,width:30/c.scale,height:30/c.scale,hideInExport:!0,onClick:()=>Z(!U),onTap:()=>Z(!U)}),a._cropModeEnabled&&"loaded"===N&&e($,{element:a,store:c,previewImage:je,sourceImage:le,sourceWidth:xe,sourceHeight:Ee,cropAbsoluteWidth:Te,cropAbsoluteHeight:Ce,innerAnchors:q})]})})});
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{elementOpacity as i}from"./paint-opacity.js";import o from"react";import{toDisplayColor as n}from"@polotno/core/color";import{animatedShadow as a}from"./animated-shadow.js";import{observer as s}from"mobx-react-lite";import{isAlive as d}from"mobx-state-tree";import{nodeAutorun as c}from"../utils/mobx.js";import{Arc as h,Group as l,Image as u,Rect as m,Text as p}from"react-konva";import{ROLES as g}from"../model/store.js";import{DEFAULT_RETRIES as f,isDeterministicUrl as v,retryDelayMs as w}from"@polotno/core/retry";import x from"konva";import{useWorkspaceStyle as E}from"./workspace-style.js";import{incrementLoader as y,triggerLoadError as M}from"../utils/loader.js";import{polotnoError as L}from"@polotno/core/errors";import{getCropRect as C}from"@polotno/core/image";import*as T from"@polotno/core/svg";import{activeAnchorOf as b,roundedCropFraction as k,roundedGeometryPx as I,roundedPosition as R,isCornerAnchor as j,scaledStyleAttrs as S,roundedStyleAttrs as P,transformScale as H}from"../utils/px.js";import{useFilteredSource as A}from"./use-filtered-source.js";import{useOffscreenCanvas as W}from"./use-offscreen-canvas.js";import{useEvent as X}from"../hooks/use-event.js";import{useFadeIn as Y}from"./use-fadein.js";import{useAnimatedBlur as _}from"./use-animated-blur.js";import{isTouchDevice as D}from"../utils/screen.js";import{createPlayGate as V,playMedia as O}from"../utils/media.js";import{useMediabunnyVideo as z}from"./use-mediabunny-video.js";import{getElementTimeRange as F,getVideoRestMs as U}from"../utils/timeline.js";import{drawReduced as Z,exportKernelEnabled as N,shouldResample as q,sourceSize as $}from"./downscale.js";import{trySetCanvasSize as B}from"../utils/canvas.js";import{useClipImage as G}from"./image-element.js";import{CropOverlay as J,CROP_CORNER_ANCHORS as K}from"./crop-overlay.js";const Q=new window.Image;Q.src=T.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 ee=new window.Image;ee.src=T.svgToURL('\n <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path opacity="0.6" d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" fill="white"/>\n <path opacity="0.6" d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" fill="white"/>\n <path d="M14 19L14 5C14 3.89543 14.8954 3 16 3L17 3C18.1046 3 19 3.89543 19 5L19 19C19 20.1046 18.1046 21 17 21L16 21C14.8954 21 14 20.1046 14 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n <path d="M10 19L10 5C10 3.89543 9.10457 3 8 3L7 3C5.89543 3 5 3.89543 5 5L5 19C5 20.1046 5.89543 21 7 21L8 21C9.10457 21 10 20.1046 10 19Z" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n');export const useCornerRadiusAndCrop=(e,t,r,i,n=0,a=!1)=>{var s;const d=Math.floor(Math.max(e.a.width*i,1)),c=Math.floor(Math.max(e.a.height*i,1)),h=Math.min(n*i,d/2,c/2),l=Math.max(e.a.width/r.width,e.a.height/r.height)*i,u=N(e.page)&&!a&&q(l,d,c),{width:m,height:p}=t?$(t):{},g=0===r.x&&0===r.y&&r.width===m&&r.height===p,f=o.useMemo(()=>{if(t&&m&&p){return g&&0===h&&!u?void 0:document.createElement("canvas")}},[t,h,u,g,m,p]),v=()=>{if(!f||!t){return}f.width=d,f.height=c;const e=f.getContext("2d");e&&(h&&(e.beginPath(),e.moveTo(h,0),e.lineTo(d-h,0),e.arc(d-h,h,h,3*Math.PI/2,0,!1),e.lineTo(d,c-h),e.arc(d-h,c-h,h,0,Math.PI/2,!1),e.lineTo(h,c),e.arc(h,c-h,h,Math.PI/2,Math.PI,!1),e.lineTo(0,h),e.arc(h,h,h,Math.PI,3*Math.PI/2,!1),e.clip()),u?Z(e,t,r,f.width,f.height):e.drawImage(t,r.x,r.y,r.width,r.height,0,0,f.width,f.height))};return o.useLayoutEffect(()=>{v()},[f,e.a.width,e.a.height,r.x,r.y,r.width,r.height,n,i,a,null===(s=e.page)||void 0===s?void 0:s._exportingOrRendering,u]),o.useEffect(()=>()=>{f&&"CANVAS"===f.nodeName&&x.Util.releaseCanvas(f)},[f]),[f||t,v]};export const useClip=(e,t,r,i)=>{const[n,a]=G(e.clipSrc||""),s=e.clipSrc?a:"loaded";useLoader(s,e.clipSrc,e.id);const d=!!t&&!!n,c=o.useMemo(()=>d?{canvas:document.createElement("canvas"),mask:document.createElement("canvas"),width:0,height:0}:void 0,[d]),h=null==c?void 0:c.canvas;function l(){if(!c||!h||!t){return}const{width:i,height:o}=$(t);if(!i||!o){return}const n=Math.min(1e4,Math.max(i,Math.ceil(e.a.width*r),1)),a=Math.min(1e4,Math.max(o,Math.ceil(e.a.height*r),1));h.width&&c.width===n&&c.height===a||(B(h,n,a),c.width=n,c.height=a);const s=h.getContext("2d");s&&(s.clearRect(0,0,h.width,h.height),s.save(),s.drawImage(t,0,0,h.width,h.height),s.globalCompositeOperation="destination-in",s.drawImage(c.mask,0,0,h.width,h.height),s.restore())}return o.useLayoutEffect(()=>{var t;if(!c||!(null==n?void 0:n.width)||!n.height){return}const i=Math.max(e.a.width/n.width*r,e.a.height/n.height*r);B(c.mask,Math.min(1e4,Math.max(n.width*i,1)),Math.min(1e4,Math.max(n.height*i,1))),null===(t=c.mask.getContext("2d"))||void 0===t||t.drawImage(n,0,0,c.mask.width,c.mask.height)},[c,n,e.a.width,e.a.height,r]),o.useLayoutEffect(()=>{l()},[c,t,n,e.a.width,e.a.height,r,...i]),o.useEffect(()=>()=>{c&&x.Util.releaseCanvas(c.canvas,c.mask)},[c]),[d?h:t,l]};const te=document.createElement("canvas"),re=s(({element:r})=>{const n=Math.min(30,r.width/4,r.height/4),a=o.useRef(null);o.useEffect(()=>{const e=a.current;if(!e){return}const t=new x.Animation(t=>{e.rotate(((null==t?void 0:t.timeDiff)||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}});const{mediaLoadingStyle:s}=E();return t(l,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:i(r),hideInExport:!r.showInExport,children:[e(m,{width:r.width,height:r.height,fill:s.fill}),e(h,{ref:a,x:r.width/2,y:r.height/2,fill:s.textFill,outerRadius:Math.abs(n),innerRadius:Math.max(1,n-5),angle:270})]})}),ie=s(({element:r})=>{const{mediaErrorStyle:o}=E(),n=Math.max(10,Math.min(30,r.width/25));return t(l,{x:r.a.x,y:r.a.y,rotation:r.a.rotation,listening:!1,opacity:i(r),hideInExport:!r.showInExport,children:[e(m,{width:r.width,height:r.height,fill:o.fill}),e(p,{text:"Can not load the video...",fontSize:n,width:r.width,height:r.height,align:"center",fill:o.textFill,verticalAlign:"middle",padding:5})]})});let oe=function(e,t,r){const i=o.useRef("loading"),n=o.useRef(void 0),[a,s]=o.useState(0),d=o.useRef(void 0),c=o.useRef(void 0),h=o.useRef(void 0);return d.current===e&&c.current===t&&h.current===r||(i.current="loading",n.current=void 0,d.current=e,c.current=t,h.current=r),o.useLayoutEffect(()=>{if(!e){return}const o=v(e)?1:f;let a,d,c,h=0,l=!1,u=!1;const m=e=>{e&&(e.removeAttribute("src"),e.load())},p=()=>{h+=1;const g=document.createElement("video");function f(){l||(g.removeEventListener("canplay",f),u=!0,i.current="loaded",n.current=g,g.currentTime=0,s(Math.random()))}function v(e){var t;const r=4===g.readyState,c=g.buffered&&g.buffered.length>0&&g.buffered.end(g.buffered.length-1)/g.duration*100>=100;if(r&&c){return}if(l){return}if(!u&&h<o){return null==d||d(),m(g),void(a=setTimeout(p,w(h)))}const f=e.message||(null===(t=g.error)||void 0===t?void 0:t.message)||"Unknown error";console.error(new Error("Video failed to load: "+f)),i.current="failed",n.current=void 0,s(Math.random())}c=g,g.addEventListener("canplay",f),g.addEventListener("error",v),d=()=>{g.removeEventListener("canplay",f),g.removeEventListener("error",v)},t&&(g.crossOrigin=t),r&&(g.referrerPolicy=r),g.src=e,g.load()};return p(),()=>{l=!0,clearTimeout(a),null==d||d(),u||m(c)}},[e,t,r]),[n.current,i.current]};export const setVideoLoaderHook=e=>{oe=e};function ne(e){return!e.seeking&&e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA}export const useLoader=(e,t,r)=>{const i=o.useRef(void 0),n=()=>{var e;null===(e=i.current)||void 0===e||e.call(i),i.current=void 0};o.useEffect(()=>n,[]),o.useLayoutEffect(()=>{const o=t.slice(0,200),a=`video with id ${r} url: ${o}`;"loading"!==e||i.current||(i.current=y(a)),"loading"!==e&&n(),"failed"===e&&M(L("VIDEO_FAILED",a,{src:o,elementId:r,reason:"load"}))},[e])};export const VideoElement=s(({element:s,store:h})=>{var p,f,v,w,E;const[M,L]=o.useState(!1),T=o.useRef(null),Z=D(),[N,q]=o.useState(!1),[B,G]=oe(s.src,"anonymous"),[ae,se]=o.useState(!1),de=h.activePage===s.page,ce=(null===(p=s.page)||void 0===p?void 0:p._exportingOrRendering)&&"loaded"===G,he=z(s,h,ce);useLoader(G,s.src,s.id),B&&(B.playsInline=!0);const le=ce&&he||B,[ue,me]=((e,t)=>{const{flipX:r,flipY:i}=e,{width:o,height:n}=t?$(t):{},a=e=>{if(!t){return}const o=e.getContext("2d");o&&(o.clearRect(0,0,e.width,e.height),o.save(),o.scale(r?-1:1,i?-1:1),o.drawImage(t,r?-e.width:0,i?-e.height:0,e.width,e.height),o.restore())},s=W((r||i)&&!!o&&!!n,e=>{o&&n&&(e.width=o,e.height=n,a(e))},[r,i,t,o,n]);return[s||t,()=>{s&&a(s)}]})(s,le),[pe=te,ge]=A(s,ue||te);o.useEffect(()=>{B&&h.history.ignore(()=>{s.set({duration:1e3*B.duration})})},[B]);const fe=o.useMemo(V,[B]);o.useEffect(()=>{var e;if(!B){return}const t=h.animatedElementsIds,r=(!t.length||t.includes(s.id))&&h.isPlaying;if(!de||!r&&!N){return void B.pause()}N&&(B.muted=!1,B.currentTime=s.startTime*B.duration,O(B).then(e=>{"refused"===e&&q(!1)}));const i=new x.Animation(()=>{Xe()},null===(e=T.current)||void 0===e?void 0:e.getLayer());i.start();const o=()=>{q(!1),B.currentTime=s.startTime*B.duration},n=()=>{B.currentTime>=s.endTime*B.duration&&(B.pause(),B.currentTime=s.startTime*B.duration,q(!1))};return B.addEventListener("ended",o),B.addEventListener("timeupdate",n),()=>{B.pause(),i.stop(),B.removeEventListener("ended",o),B.removeEventListener("timeupdate",n)}},[B,N,h.isPlaying,de]),o.useEffect(()=>{B&&(B.volume=s.volume)},[B,s.volume]),o.useEffect(()=>{B&&(B.playbackRate=s.speed,B.preservesPitch=!1)},[B,s.speed]);const ve=o.useRef(null);o.useEffect(()=>{const e=c(s,()=>{var e,t;if(B){if(ce&&he){return Xe(),void h.currentTime}const r=h.animatedElementsIds;if(r.length&&!r.includes(s.id)){return}const i=h.activePage===s.page,o=h.currentTime>=s.page.startTime&&h.currentTime<s.page.startTime+s.page.duration,n=s.startTime*B.duration*1e3,a=B.duration*(s.endTime-s.startTime)*1e3,{start:d,end:c}=F(s.animations,s.page.duration),l=(h.currentTime||s.page.startTime)-s.page.startTime,u=o?U(h.currentTime,s.page.startTime,d,a,n,s.speed):0,m=u/1e3,p=o&&l>=d&&l<c;N||(B.muted=!p,p&&h.isPlaying&&i?B.paused?(B.currentTime=m,fe.play(B)):Math.abs(1e3*B.currentTime-u)>500&&(B.currentTime=m):(fe.reset(),B.paused||B.pause(),m!==B.currentTime&&(B.currentTime=m),!ne(B)&&!h.isPlaying&&!ve.current&&(ve.current=y(`video ${s.id}`)))),Xe(),null===(t=null===(e=T.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()}});return()=>{e(),ve.current&&(ve.current(),ve.current=null)}},[h,B,ce,he,N]),o.useEffect(()=>{var e,t;if(!B){return}if(ce){return null===(e=ve.current)||void 0===e||e.call(ve),void(ve.current=null)}const r=()=>{var e;null===(e=ve.current)||void 0===e||e.call(ve),ve.current=null},i=()=>{ne(B)&&(Xe(),r())};let o,n;(null===(t=s.page)||void 0===t?void 0:t._exportingOrRendering)&&(o=setInterval(i,20)),B.addEventListener("timeupdate",i),B.addEventListener("canplay",i),B.addEventListener("seeked",i);const a=()=>{B.paused&&(Xe(),ne(B)&&r()),n=B.requestVideoFrameCallback(a)};return"requestVideoFrameCallback"in B&&(n=B.requestVideoFrameCallback(a)),()=>{clearInterval(o),void 0!==n&&B.cancelVideoFrameCallback(n),B.removeEventListener("timeupdate",i),B.removeEventListener("canplay",i),B.removeEventListener("seeked",i)}},[null===(f=s.page)||void 0===f?void 0:f._exportingOrRendering,B,s.id,y,ce]);let{cropX:we,cropY:xe,cropWidth:Ee,cropHeight:ye}=s.a;"loaded"!==G&&(we=xe=0,Ee=ye=1);const{width:Me,height:Le}=$(pe),Ce=null!==(v=null==B?void 0:B.videoWidth)&&void 0!==v?v:0,Te=null!==(w=null==B?void 0:B.videoHeight)&&void 0!==w?w:0;o.useLayoutEffect(()=>{"loaded"===G&&Ce>0&&Te>0&&s._setSourceSize({width:Ce,height:Te},s.src)},[s,s.src,G,Ce,Te]);const be=C({stretchEnabled:s.stretchEnabled,cropX:we,cropY:xe,cropWidth:Ee,cropHeight:ye,width:s.a.width,height:s.a.height},{width:Me,height:Le}),ke=be.width,Ie=be.height,Re=s.stretchEnabled,je=null!==(E=s.cornerRadius)&&void 0!==E?E:0,[Se,Pe]=useCornerRadiusAndCrop(s,pe,be,h._elementsPixelRatio,je,!0);let[He,Ae]=useClip(s,Se,h._elementsPixelRatio,[be,je,h._elementsPixelRatio]);const We=_(T,s,He),Xe=X(()=>{var e,t;me(),ge(),Pe(),Ae(),We(),null===(t=null===(e=T.current)||void 0===e?void 0:e.getLayer())||void 0===t||t.batchDraw()});o.useEffect(()=>{Xe()});const Ye=()=>{s._cropEnabled&&setTimeout(()=>{d(s)&&s.toggleCropMode(!0)})},_e="loading"===G,De="failed"===G,Ve=!_e&&!De,Oe=o.useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),ze=o.useRef(!1),Fe=Ve?i(s):0;Y(T,Fe);const Ue=s.selectable||h.role===g.ADMIN;return e(r,{children:t(l,{onMouseEnter:()=>se(!0),onMouseLeave:()=>se(!1),children:[_e&&e(re,{element:s}),De&&e(ie,{element:s}),e(u,Object.assign({ref:T,name:"element",id:s.id,image:He,x:s.a.x,y:s.a.y,width:s.a.width||1,height:s.a.height||1,rotation:s.a.rotation,opacity:Fe},a(s),{customCrop:be,listening:Ue,draggable:Z?s.draggable&&s.isSelected:s.draggable,preventDefault:!Z||s.isSelected,hideInExport:!s.showInExport,onDragMove:e=>{s.set({x:e.target.x(),y:e.target.y()})},onDragEnd:e=>{s.set(R(e.target))},onDblClick:Ye,onDblTap:Ye,onTransformStart:e=>{L(!0),ze.current=j(b(e.target)),Oe.current={cropX:s.cropX,cropY:s.cropY,cropWidth:s.cropWidth,cropHeight:s.cropHeight}},onTransform:e=>{const t=e.currentTarget,r=H(t.scaleX()),i=H(t.scaleY());t.scaleX(1),t.scaleY(1);const o=1-ke/Me,n=Math.min(o,Math.max(0,s.cropX)),a=1-Ie/Le,d=Math.min(a,Math.max(0,s.cropY)),c=ze.current,h=!c&&r<1&&Oe.current.cropHeight>Ie/Le;let l=c?s.cropWidth:s.cropWidth*r;h&&(l=s.cropWidth);const u=!c&&i<1&&Oe.current.cropWidth>ke/Me;let m=c?s.cropHeight:s.cropHeight*i;u&&(m=s.cropHeight),Re&&(l=s.cropWidth,m=s.cropHeight);const p=c?Math.min(r,i):1;s.set(Object.assign({cropX:n,cropY:d,x:t.x(),y:t.y(),width:t.width()*r,height:t.height()*i,rotation:e.target.rotation(),cropWidth:Math.min(l,1-n),cropHeight:Math.min(m,1-d)},1!==p&&S(s,p)))},onTransformEnd:e=>{const t=e.currentTarget;s.set(Object.assign({width:I(t.width()),height:I(t.height()),x:I(t.x()),y:I(t.y()),rotation:I(e.target.rotation()),cropX:k(s.cropX),cropY:k(s.cropY),cropWidth:k(ke/Me),cropHeight:k(Ie/Le)},P(s))),L(!1)}})),!!s.borderSize&&e(m,{x:s.a.x,y:s.a.y,width:Math.max(s.a.width-s.borderSize,0),height:Math.max(s.a.height-s.borderSize,0),opacity:Fe,offsetX:-s.borderSize/2,offsetY:-s.borderSize/2,stroke:n(s.borderColor),strokeWidth:s.borderSize,listening:!1,rotation:s.a.rotation,cornerRadius:Math.max(0,je-s.borderSize),hideInExport:!s.showInExport}),!h.isPlaying&&e(u,{image:N?ae||Z?ee:void 0:Q,x:s.a.x,y:s.a.y,offsetX:-s.a.width/2+15/h.scale,offsetY:-s.a.height/2+15/h.scale,rotation:s.a.rotation,width:30/h.scale,height:30/h.scale,hideInExport:!0,onClick:()=>q(!N),onTap:()=>q(!N)}),s._cropModeEnabled&&"loaded"===G&&e(J,{element:s,store:h,previewImage:He,sourceImage:pe,sourceWidth:Me,sourceHeight:Le,cropAbsoluteWidth:ke,cropAbsoluteHeight:Ie,innerAnchors:K})]})})});
|
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
1
|
+
import React, { type SVGProps } from 'react';
|
|
2
|
+
type IconProps = SVGProps<SVGSVGElement>;
|
|
3
|
+
export declare const NoneIcon: (props: IconProps) => React.JSX.Element;
|
|
4
|
+
export declare const FadeIcon: (props: IconProps) => React.JSX.Element;
|
|
5
|
+
export declare const MoveIcon: (props: IconProps) => React.JSX.Element;
|
|
6
|
+
export declare const ZoomIcon: (props: IconProps) => React.JSX.Element;
|
|
7
|
+
export declare const PopIcon: (props: IconProps) => React.JSX.Element;
|
|
8
|
+
export declare const RiseIcon: (props: IconProps) => React.JSX.Element;
|
|
9
|
+
export declare const GrowTurnIcon: (props: IconProps) => React.JSX.Element;
|
|
10
|
+
export declare const FlipIcon: (props: IconProps) => React.JSX.Element;
|
|
11
|
+
export declare const WipeIcon: (props: IconProps) => React.JSX.Element;
|
|
12
|
+
export declare const BlurIcon: (props: IconProps) => React.JSX.Element;
|
|
13
|
+
export declare const CountIcon: (props: IconProps) => React.JSX.Element;
|
|
14
|
+
export declare const TypewriterIcon: (props: IconProps) => React.JSX.Element;
|
|
15
|
+
export declare const LineRiseIcon: (props: IconProps) => React.JSX.Element;
|
|
16
|
+
export declare const WordRiseIcon: (props: IconProps) => React.JSX.Element;
|
|
17
|
+
export declare const WordFadeIcon: (props: IconProps) => React.JSX.Element;
|
|
18
|
+
export declare const LetterPopIcon: (props: IconProps) => React.JSX.Element;
|
|
19
|
+
export declare const WordBlurIcon: (props: IconProps) => React.JSX.Element;
|
|
20
|
+
export declare const LineWipeIcon: (props: IconProps) => React.JSX.Element;
|
|
21
|
+
export declare const LetterWaveIcon: (props: IconProps) => React.JSX.Element;
|
|
22
|
+
export declare const RotateIcon: (props: IconProps) => React.JSX.Element;
|
|
23
|
+
export declare const BlinkIcon: (props: IconProps) => React.JSX.Element;
|
|
24
|
+
export declare const PulseIcon: (props: IconProps) => React.JSX.Element;
|
|
25
|
+
export declare const FloatIcon: (props: IconProps) => React.JSX.Element;
|
|
26
|
+
export declare const ShakeIcon: (props: IconProps) => React.JSX.Element;
|
|
27
|
+
export declare const GlowIcon: (props: IconProps) => React.JSX.Element;
|
|
28
|
+
export declare const KenBurnsIcon: (props: IconProps) => React.JSX.Element;
|
|
29
|
+
export declare const BounceIcon: (props: IconProps) => React.JSX.Element;
|
|
30
|
+
export {};
|
package/icons/animation-icons.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as C,jsxs as t}from"react/jsx-runtime";export const MoveIcon=t=>C("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:0}},t,{children:C("path",{d:"M9.88114 6.74408C9.79978 6.66282 9.73524 6.56631 9.69121 6.46009C9.64718 6.35387 9.62451 6.24001 9.62451 6.12502C9.62451 6.01003 9.64718 5.89617 9.69121 5.78994C9.73524 5.68372 9.79978 5.58722 9.88114 5.50595L13.3811 2.00595C13.4624 1.9246 13.5589 1.86006 13.6651 1.81603C13.7714 1.77199 13.8852 1.74933 14.0002 1.74933C14.1152 1.74933 14.229 1.77199 14.3353 1.81603C14.4415 1.86006 14.538 1.9246 14.6193 2.00595L18.1193 5.50595C18.2834 5.67014 18.3757 5.89282 18.3757 6.12502C18.3757 6.35721 18.2834 6.57989 18.1193 6.74408C17.9551 6.90827 17.7324 7.0005 17.5002 7.0005C17.268 7.0005 17.0453 6.90827 16.8811 6.74408L14.8752 4.73705V10.5C14.8752 10.7321 14.783 10.9546 14.6189 11.1187C14.4548 11.2828 14.2323 11.375 14.0002 11.375C13.7681 11.375 13.5456 11.2828 13.3815 11.1187C13.2174 10.9546 13.1252 10.7321 13.1252 10.5V4.73705L11.1193 6.74408C11.038 6.82543 10.9415 6.88997 10.8353 6.93401C10.729 6.97804 10.6152 7.00071 10.5002 7.00071C10.3852 7.00071 10.2714 6.97804 10.1651 6.93401C10.0589 6.88997 9.9624 6.82543 9.88114 6.74408ZM16.8811 21.256L14.8752 23.263V17.5C14.8752 17.268 14.783 17.0454 14.6189 16.8813C14.4548 16.7172 14.2323 16.625 14.0002 16.625C13.7681 16.625 13.5456 16.7172 13.3815 16.8813C13.2174 17.0454 13.1252 17.268 13.1252 17.5V23.263L11.1193 21.256C10.9551 21.0918 10.7324 20.9995 10.5002 20.9995C10.268 20.9995 10.0453 21.0918 9.88114 21.256C9.71695 21.4201 9.62471 21.6428 9.62471 21.875C9.62471 22.1072 9.71695 22.3299 9.88114 22.4941L13.3811 25.9941C13.4624 26.0754 13.5589 26.14 13.6651 26.184C13.7714 26.228 13.8852 26.2507 14.0002 26.2507C14.1152 26.2507 14.229 26.228 14.3353 26.184C14.4415 26.14 14.538 26.0754 14.6193 25.9941L18.1193 22.4941C18.2834 22.3299 18.3757 22.1072 18.3757 21.875C18.3757 21.6428 18.2834 21.4201 18.1193 21.256C17.9551 21.0918 17.7324 20.9995 17.5002 20.9995C17.268 20.9995 17.0453 21.0918 16.8811 21.256ZM25.9943 13.381L22.4943 9.88095C22.3301 9.71677 22.1074 9.62453 21.8752 9.62453C21.643 9.62453 21.4203 9.71677 21.2561 9.88095C21.092 10.0451 20.9997 10.2678 20.9997 10.5C20.9997 10.7322 21.092 10.9549 21.2561 11.1191L23.2632 13.125H17.5002C17.2681 13.125 17.0456 13.2172 16.8815 13.3813C16.7174 13.5454 16.6252 13.768 16.6252 14C16.6252 14.2321 16.7174 14.4546 16.8815 14.6187C17.0456 14.7828 17.2681 14.875 17.5002 14.875H23.2632L21.2561 16.881C21.092 17.0451 20.9997 17.2678 20.9997 17.5C20.9997 17.7322 21.092 17.9549 21.2561 18.1191C21.4203 18.2833 21.643 18.3755 21.8752 18.3755C22.1074 18.3755 22.3301 18.2833 22.4943 18.1191L25.9943 14.6191C26.0756 14.5378 26.1402 14.4413 26.1842 14.3351C26.2282 14.2289 26.2509 14.115 26.2509 14C26.2509 13.885 26.2282 13.7712 26.1842 13.6649C26.1402 13.5587 26.0756 13.4622 25.9943 13.381ZM4.73723 14.875H10.5002C10.7323 14.875 10.9548 14.7828 11.1189 14.6187C11.283 14.4546 11.3752 14.2321 11.3752 14C11.3752 13.768 11.283 13.5454 11.1189 13.3813C10.9548 13.2172 10.7323 13.125 10.5002 13.125H4.73723L6.74426 11.1191C6.90845 10.9549 7.00069 10.7322 7.00069 10.5C7.00069 10.2678 6.90845 10.0451 6.74426 9.88095C6.58008 9.71677 6.35739 9.62453 6.1252 9.62453C5.89301 9.62453 5.67032 9.71677 5.50614 9.88095L2.00614 13.381C1.92478 13.4622 1.86024 13.5587 1.81621 13.6649C1.77218 13.7712 1.74951 13.885 1.74951 14C1.74951 14.115 1.77218 14.2289 1.81621 14.3351C1.86024 14.4413 1.92478 14.5378 2.00614 14.6191L5.50614 18.1191C5.67032 18.2833 5.89301 18.3755 6.1252 18.3755C6.35739 18.3755 6.58008 18.2833 6.74426 18.1191C6.90845 17.9549 7.00069 17.7322 7.00069 17.5C7.00069 17.2678 6.90845 17.0451 6.74426 16.881L4.73723 14.875Z",fill:"currentColor"})}));export const FadeIcon=r=>t("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:0}},r,{children:[C("circle",{cx:"7",cy:"14",r:"5",fill:"currentColor",fillOpacity:"0.2",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.3"}),C("circle",{cx:"14",cy:"14",r:"5",fill:"currentColor",fillOpacity:"0.5",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.6"}),C("circle",{cx:"21",cy:"14",r:"5",fill:"currentColor",fillOpacity:"0.9",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"1"})]}));export const ZoomIcon=t=>C("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:0}},t,{children:C("path",{d:"M15.75 11.375V7C15.75 6.76793 15.8422 6.54537 16.0063 6.38128C16.1704 6.21719 16.3929 6.125 16.625 6.125C16.8571 6.125 17.0796 6.21719 17.2437 6.38128C17.4078 6.54537 17.5 6.76793 17.5 7V9.26297L22.1309 4.63094C22.2951 4.46675 22.5178 4.37451 22.75 4.37451C22.9822 4.37451 23.2049 4.46675 23.3691 4.63094C23.5332 4.79512 23.6255 5.0178 23.6255 5.25C23.6255 5.48219 23.5332 5.70488 23.3691 5.86906L18.737 10.5H21C21.2321 10.5 21.4546 10.5922 21.6187 10.7563C21.7828 10.9204 21.875 11.1429 21.875 11.375C21.875 11.6071 21.7828 11.8296 21.6187 11.9937C21.4546 12.1578 21.2321 12.25 21 12.25H16.625C16.3929 12.25 16.1704 12.1578 16.0063 11.9937C15.8422 11.8296 15.75 11.6071 15.75 11.375ZM11.375 15.75H7C6.76793 15.75 6.54537 15.8422 6.38128 16.0063C6.21719 16.1704 6.125 16.3929 6.125 16.625C6.125 16.8571 6.21719 17.0796 6.38128 17.2437C6.54537 17.4078 6.76793 17.5 7 17.5H9.26297L4.63094 22.1309C4.46675 22.2951 4.37451 22.5178 4.37451 22.75C4.37451 22.9822 4.46675 23.2049 4.63094 23.3691C4.79512 23.5332 5.0178 23.6255 5.25 23.6255C5.48219 23.6255 5.70488 23.5332 5.86906 23.3691L10.5 18.737V21C10.5 21.2321 10.5922 21.4546 10.7563 21.6187C10.9204 21.7828 11.1429 21.875 11.375 21.875C11.6071 21.875 11.8296 21.7828 11.9937 21.6187C12.1578 21.4546 12.25 21.2321 12.25 21V16.625C12.25 16.3929 12.1578 16.1704 11.9937 16.0063C11.8296 15.8422 11.6071 15.75 11.375 15.75ZM18.737 17.5H21C21.2321 17.5 21.4546 17.4078 21.6187 17.2437C21.7828 17.0796 21.875 16.8571 21.875 16.625C21.875 16.3929 21.7828 16.1704 21.6187 16.0063C21.4546 15.8422 21.2321 15.75 21 15.75H16.625C16.3929 15.75 16.1704 15.8422 16.0063 16.0063C15.8422 16.1704 15.75 16.3929 15.75 16.625V21C15.75 21.2321 15.8422 21.4546 16.0063 21.6187C16.1704 21.7828 16.3929 21.875 16.625 21.875C16.8571 21.875 17.0796 21.7828 17.2437 21.6187C17.4078 21.4546 17.5 21.2321 17.5 21V18.737L22.1309 23.3691C22.2122 23.4504 22.3087 23.5148 22.415 23.5588C22.5212 23.6028 22.635 23.6255 22.75 23.6255C22.865 23.6255 22.9788 23.6028 23.085 23.5588C23.1913 23.5148 23.2878 23.4504 23.3691 23.3691C23.4504 23.2878 23.5148 23.1913 23.5588 23.085C23.6028 22.9788 23.6255 22.865 23.6255 22.75C23.6255 22.635 23.6028 22.5212 23.5588 22.415C23.5148 22.3087 23.4504 22.2122 23.3691 22.1309L18.737 17.5ZM11.375 6.125C11.1429 6.125 10.9204 6.21719 10.7563 6.38128C10.5922 6.54537 10.5 6.76793 10.5 7V9.26297L5.86906 4.63094C5.70488 4.46675 5.48219 4.37451 5.25 4.37451C5.0178 4.37451 4.79512 4.46675 4.63094 4.63094C4.46675 4.79512 4.37451 5.0178 4.37451 5.25C4.37451 5.48219 4.46675 5.70488 4.63094 5.86906L9.26297 10.5H7C6.76793 10.5 6.54537 10.5922 6.38128 10.7563C6.21719 10.9204 6.125 11.1429 6.125 11.375C6.125 11.6071 6.21719 11.8296 6.38128 11.9937C6.54537 12.1578 6.76793 12.25 7 12.25H11.375C11.6071 12.25 11.8296 12.1578 11.9937 11.9937C12.1578 11.8296 12.25 11.6071 12.25 11.375V7C12.25 6.76793 12.1578 6.54537 11.9937 6.38128C11.8296 6.21719 11.6071 6.125 11.375 6.125Z",fill:"currentColor"})}));export const RotateIcon=t=>C("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg",style:{margin:0}},t,{children:C("path",{d:"M9.625 11.375H4.375C4.14294 11.375 3.92038 11.2828 3.75628 11.1187C3.59219 10.9546 3.5 10.7321 3.5 10.5V5.25001C3.5 5.01794 3.59219 4.79538 3.75628 4.63129C3.92038 4.46719 4.14294 4.37501 4.375 4.37501C4.60706 4.37501 4.82962 4.46719 4.99372 4.63129C5.15781 4.79538 5.25 5.01794 5.25 5.25001V8.38797L6.85016 6.78782C8.80164 4.82651 11.452 3.72026 14.2188 3.71219H14.2767C17.0199 3.70513 19.6555 4.77908 21.6125 6.70141C21.7723 6.86488 21.8618 7.0844 21.8618 7.313C21.8618 7.5416 21.7723 7.76112 21.6126 7.92461C21.4528 8.0881 21.2354 8.18257 21.0068 8.18781C20.7783 8.19306 20.5568 8.10865 20.3897 7.95266C18.7584 6.3515 16.5625 5.45684 14.2767 5.46219H14.2275C11.9221 5.46929 9.71368 6.39096 8.08719 8.02485L6.48703 9.62501H9.625C9.85706 9.62501 10.0796 9.71719 10.2437 9.88129C10.4078 10.0454 10.5 10.2679 10.5 10.5C10.5 10.7321 10.4078 10.9546 10.2437 11.1187C10.0796 11.2828 9.85706 11.375 9.625 11.375ZM23.625 16.625H18.375C18.1429 16.625 17.9204 16.7172 17.7563 16.8813C17.5922 17.0454 17.5 17.2679 17.5 17.5C17.5 17.7321 17.5922 17.9546 17.7563 18.1187C17.9204 18.2828 18.1429 18.375 18.375 18.375H21.513L19.9128 19.9752C18.2866 21.6088 16.0786 22.5304 13.7736 22.5378H13.7244C11.4386 22.5432 9.24264 21.6485 7.61141 20.0473C7.52991 19.964 7.43257 19.8977 7.32511 19.8525C7.21764 19.8073 7.10223 19.784 6.98564 19.784C6.86904 19.784 6.75363 19.8073 6.64617 19.8525C6.53872 19.8978 6.44138 19.964 6.35989 20.0474C6.2784 20.1308 6.2144 20.2296 6.17164 20.3381C6.12889 20.4466 6.10824 20.5625 6.11091 20.679C6.11359 20.7956 6.13953 20.9105 6.18721 21.0169C6.2349 21.1232 6.30337 21.219 6.38859 21.2986C8.3456 23.2209 10.9812 24.2949 13.7244 24.2878H13.7812C16.5476 24.2795 19.1975 23.1732 21.1488 21.2122L22.75 19.612V22.75C22.75 22.9821 22.8422 23.2046 23.0063 23.3687C23.1704 23.5328 23.3929 23.625 23.625 23.625C23.8571 23.625 24.0796 23.5328 24.2437 23.3687C24.4078 23.2046 24.5 22.9821 24.5 22.75V17.5C24.5 17.2679 24.4078 17.0454 24.2437 16.8813C24.0796 16.7172 23.8571 16.625 23.625 16.625Z",fill:"currentColor"})}));export const BlinkIcon=t=>C("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg",style:{margin:0}},t,{children:C("path",{d:"M24.9374 19.1406C24.8375 19.1976 24.7273 19.2343 24.6132 19.2487C24.499 19.263 24.3831 19.2547 24.2722 19.2243C24.1613 19.1938 24.0574 19.1417 23.9666 19.0711C23.8758 19.0004 23.7999 18.9126 23.7431 18.8125L21.6649 15.1813C20.4568 15.9982 19.124 16.6136 17.7187 17.0034L18.3607 20.8556C18.3797 20.969 18.3761 21.0851 18.3502 21.1971C18.3242 21.3091 18.2765 21.4149 18.2096 21.5085C18.1428 21.602 18.0582 21.6815 17.9606 21.7423C17.8631 21.8031 17.7545 21.8441 17.641 21.863C17.5944 21.8706 17.5472 21.8746 17.4999 21.875C17.2929 21.8747 17.0928 21.801 16.935 21.667C16.7772 21.5331 16.672 21.3475 16.6381 21.1433L16.007 17.3611C14.6761 17.5463 13.326 17.5463 11.9951 17.3611L11.364 21.1433C11.33 21.3479 11.2245 21.5337 11.0663 21.6677C10.908 21.8018 10.7073 21.8752 10.4999 21.875C10.4516 21.8748 10.4033 21.8708 10.3556 21.863C10.2421 21.8441 10.1335 21.8031 10.036 21.7423C9.93842 21.6815 9.8538 21.602 9.78696 21.5085C9.72012 21.4149 9.67238 21.3091 9.64645 21.1971C9.62053 21.0851 9.61694 20.969 9.63588 20.8556L10.2812 17.0034C8.87641 16.6123 7.54441 15.9958 6.33713 15.178L4.26557 18.8125C4.14954 19.0147 3.95794 19.1625 3.73292 19.2234C3.50791 19.2843 3.26791 19.2534 3.06573 19.1374C2.86354 19.0213 2.71573 18.8297 2.65481 18.6047C2.59389 18.3797 2.62485 18.1397 2.74088 17.9375L4.92838 14.1094C4.16002 13.4456 3.45348 12.7134 2.81744 11.9219C2.73812 11.8333 2.67768 11.7295 2.63981 11.6168C2.60194 11.5041 2.58744 11.3849 2.59718 11.2664C2.60693 11.1479 2.64071 11.0327 2.69649 10.9277C2.75226 10.8227 2.82884 10.7301 2.92156 10.6557C3.01428 10.5813 3.1212 10.5266 3.23578 10.4948C3.35036 10.4631 3.4702 10.4551 3.58799 10.4712C3.70578 10.4873 3.81905 10.5273 3.92088 10.5887C4.02271 10.65 4.11096 10.7315 4.18026 10.8281C5.99588 13.0747 9.17213 15.75 13.9999 15.75C18.8278 15.75 22.004 13.0714 23.8196 10.8281C23.8881 10.7295 23.9762 10.6461 24.0783 10.583C24.1805 10.5199 24.2945 10.4785 24.4133 10.4614C24.5321 10.4442 24.6532 10.4517 24.769 10.4834C24.8848 10.5151 24.9928 10.5702 25.0864 10.6454C25.18 10.7207 25.2571 10.8143 25.3129 10.9206C25.3687 11.0269 25.402 11.1435 25.4108 11.2633C25.4196 11.383 25.4037 11.5032 25.364 11.6166C25.3244 11.7299 25.2618 11.8338 25.1803 11.9219C24.5442 12.7134 23.8377 13.4456 23.0693 14.1094L25.2568 17.9375C25.3155 18.0373 25.3539 18.1477 25.3696 18.2625C25.3853 18.3772 25.3781 18.4939 25.3484 18.6058C25.3187 18.7177 25.2671 18.8226 25.1965 18.9144C25.126 19.0062 25.0379 19.0831 24.9374 19.1406Z",fill:"currentColor"})}));export const BounceIcon=t=>C("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg",style:{margin:0}},t,{children:C("path",{d:"M14 3.5C18.6944 3.5 22.5 7.30558 22.5 12C22.5 16.6944 18.6944 20.5 14 20.5C9.30558 20.5 5.5 16.6944 5.5 12C5.5 7.30558 9.30558 3.5 14 3.5ZM14 5.25C10.2721 5.25 7.25 8.27208 7.25 12C7.25 15.7279 10.2721 18.75 14 18.75C17.7279 18.75 20.75 15.7279 20.75 12C20.75 8.27208 17.7279 5.25 14 5.25ZM14 7C16.7614 7 19 9.23858 19 12C19 14.7614 16.7614 17 14 17C11.2386 17 9 14.7614 9 12C9 9.23858 11.2386 7 14 7ZM14 8.75C12.2051 8.75 10.75 10.2051 10.75 12C10.75 13.7949 12.2051 15.25 14 15.25C15.7949 15.25 17.25 13.7949 17.25 12C17.25 10.2051 15.7949 8.75 14 8.75ZM14 10.5C14.8284 10.5 15.5 11.1716 15.5 12C15.5 12.8284 14.8284 13.5 14 13.5C13.1716 13.5 12.5 12.8284 12.5 12C12.5 11.1716 13.1716 10.5 14 10.5Z",fill:"currentColor"})}));
|
|
1
|
+
var t=this&&this.__rest||function(t,c){var e={};for(var i in t){Object.prototype.hasOwnProperty.call(t,i)&&c.indexOf(i)<0&&(e[i]=t[i])}if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++){c.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(e[i[r]]=t[i[r]])}}return e};import{jsx as c,Fragment as e,jsxs as i}from"react/jsx-runtime";import r from"react";const o=t=>c("svg",Object.assign({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:0,overflow:"visible"}},t)),s="currentColor",n=()=>r.useId().replace(/[^a-zA-Z0-9_-]/g,""),a=e=>{var{x:i,y:r,size:o,opacity:n=1}=e,a=t(e,["x","y","size","opacity"]);return c("rect",Object.assign({x:i,y:r,width:o,height:o,rx:.24*o,fill:s,fillOpacity:n},a))},y=e=>{var{cx:i,cy:r,r:o,opacity:n=1}=e,a=t(e,["cx","cy","r","opacity"]);return c("circle",Object.assign({cx:i,cy:r,r:o,fill:s,fillOpacity:n},a))},h=e=>{var{d:i,opacity:r=.7,width:o=2}=e,n=t(e,["d","opacity","width"]);return c("path",Object.assign({d:i,stroke:s,strokeOpacity:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"},n))},l=e=>{var{opacity:i=.35}=e,r=t(e,["opacity"]);return c("rect",Object.assign({stroke:s,strokeOpacity:i,strokeWidth:1.6,strokeDasharray:"2.5 2.5"},r))},x={A:"M0 12 L4.5 0 L9 12 M1.8 7.6 H7.2",B:"M0.6 12 V0 H4.5 C6.6 0 7.8 1.2 7.8 3 C7.8 4.7 6.6 5.8 4.5 5.8 H0.6 M4.5 5.8 C7.2 5.8 8.6 7 8.6 8.9 C8.6 10.8 7.2 12 4.9 12 H0.6",C:"M8.7 2.4 C7.9 0.9 6.5 0 4.8 0 C2.1 0 0.2 2.6 0.2 6 C0.2 9.4 2.1 12 4.8 12 C6.5 12 7.9 11.1 8.7 9.6",D:"M0.6 12 V0 H3.9 C7 0 8.9 2.4 8.9 6 C8.9 9.6 7 12 3.9 12 Z",0:"M4.5 0 C7 0 8.6 2.7 8.6 6 C8.6 9.3 7 12 4.5 12 C2 12 0.4 9.3 0.4 6 C0.4 2.7 2 0 4.5 0 Z",1:"M1.6 2.6 L5 0 V12",2:"M0.6 3 C1.1 1.1 2.6 0 4.5 0 C6.7 0 8.2 1.4 8.2 3.4 C8.2 5.6 6.3 7.1 0.6 12 H8.6"},d=({ch:t,x:e,y:i,scale:r=1,opacity:o=1})=>c("path",{d:x[t],transform:`translate(${e} ${i}) scale(${r})`,stroke:s,strokeOpacity:o,strokeWidth:2.4/r,strokeLinecap:"round",strokeLinejoin:"round"}),p=({text:t,x:i,y:r,scale:o=1,opacity:s=1})=>c(e,{children:[...t].map((t,e)=>c(d,{ch:t,x:i+12*e*o,y:r,scale:o,opacity:s},e))});export const NoneIcon=t=>i(o,Object.assign({},t,{children:[c("rect",{x:12,y:12,width:24,height:24,rx:6,stroke:s,strokeOpacity:.45,strokeWidth:2,strokeDasharray:"3 3.2"}),c(h,{d:"M15 33 L33 15",opacity:.75})]}));export const FadeIcon=t=>{const e=n();return i(o,Object.assign({},t,{children:[c("defs",{children:i("linearGradient",{id:e,x1:"0",x2:"1",y1:"0",y2:"0",children:[c("stop",{offset:"0",stopColor:s,stopOpacity:.04}),c("stop",{offset:"1",stopColor:s,stopOpacity:1})]})}),c("rect",{x:12,y:12,width:24,height:24,rx:6,fill:`url(#${e})`}),c("rect",{x:12,y:12,width:24,height:24,rx:6,stroke:s,strokeOpacity:.3,strokeWidth:1.5,strokeDasharray:"2 3"})]}))};export const MoveIcon=t=>i(o,Object.assign({},t,{children:[c(a,{x:9,y:15,size:18,opacity:.14}),c(a,{x:15,y:15,size:18,opacity:.32}),c(a,{x:23,y:15,size:18}),c(h,{d:"M2 19.5 H6.5 M2 28.5 H6.5",opacity:.55})]}));export const ZoomIcon=t=>i(o,Object.assign({},t,{children:[c(a,{x:15,y:15,size:18}),c(h,{d:"M12 12 L6.5 6.5 M6.5 11 V6.5 H11 M36 12 L41.5 6.5 M37 6.5 H41.5 V11 M36 36 L41.5 41.5 M41.5 37 V41.5 H37 M12 36 L6.5 41.5 M11 41.5 H6.5 V37"})]}));export const PopIcon=t=>i(o,Object.assign({},t,{children:[c(l,{x:10.5,y:10.5,width:27,height:27,rx:7}),c(a,{x:15,y:15,size:18}),c(h,{d:"M40 8 L43.5 4.5 M42 13 H46 M35 6 V2",opacity:.65})]}));export const RiseIcon=t=>i(o,Object.assign({},t,{children:[c(a,{x:15,y:22,size:18,opacity:.14}),c(a,{x:15,y:15.5,size:18,opacity:.32}),c(a,{x:15,y:8,size:18}),c(h,{d:"M20 42 V46 M28 42 V46",opacity:.55})]}));export const GrowTurnIcon=t=>i(o,Object.assign({},t,{children:[c("rect",{x:7,y:27,width:11,height:11,rx:2.6,fill:s,fillOpacity:.18,transform:"rotate(-40 12.5 32.5)"}),c(a,{x:21,y:9,size:19}),c(h,{d:"M8 22 C8 14.5 11.5 9.5 17 7.5 M13.6 5.7 L17 7.5 L15.3 10.9",opacity:.65})]}));export const FlipIcon=t=>i(o,Object.assign({},t,{children:[c(h,{d:"M24 4 V44",opacity:.3,width:1.5,strokeDasharray:"2 3"}),c(l,{x:13,y:14,width:22,height:22,rx:5,opacity:.3}),c("rect",{x:19,y:14,width:10,height:22,rx:3,fill:s}),c(h,{d:"M14 9 C19.5 5.5 28.5 5.5 34 9 M30.6 6.2 L34 9 L30.2 10.6",opacity:.65})]}));export const WipeIcon=t=>{const e=n();return i(o,Object.assign({},t,{children:[c("defs",{children:c("clipPath",{id:e,children:c("rect",{width:27,height:48})})}),c(a,{x:13,y:13,size:22,opacity:.16}),c("g",{clipPath:`url(#${e})`,children:c(a,{x:13,y:13,size:22})}),c(h,{d:"M27 7 V41",opacity:1,width:2.2}),c(h,{d:"M31 24 H37 M34.5 21.2 L37.3 24 L34.5 26.8",opacity:.65})]}))};export const BlurIcon=t=>{const e=n();return i(o,Object.assign({},t,{children:[c("defs",{children:c("filter",{id:e,x:"-50%",y:"-50%",width:"200%",height:"200%",children:c("feGaussianBlur",{stdDeviation:2.6})})}),c(a,{x:16,y:16,size:16,filter:`url(#${e})`}),c(h,{d:"M9 16 V9 H16 M32 9 H39 V16 M39 32 V39 H32 M16 39 H9 V32"})]}))};export const CountIcon=t=>{const e=n();return i(o,Object.assign({},t,{children:[c("defs",{children:c("clipPath",{id:e,children:c("rect",{x:9,y:13,width:30,height:22,rx:5})})}),c("rect",{x:8,y:12,width:32,height:24,rx:6,stroke:s,strokeOpacity:.35,strokeWidth:1.8}),i("g",{clipPath:`url(#${e})`,children:[c(d,{ch:"0",x:14,y:5.5,opacity:.25}),c(d,{ch:"1",x:25,y:5.5,opacity:.25}),c(d,{ch:"1",x:14,y:20.5}),c(d,{ch:"2",x:25,y:20.5})]})]}))};export const TypewriterIcon=t=>i(o,Object.assign({},t,{children:[c(d,{ch:"A",x:5,y:18}),c(d,{ch:"B",x:17,y:18}),c(h,{d:"M30.5 14.5 V33.5",opacity:1,width:2.4}),c(d,{ch:"C",x:34,y:18,opacity:.2})]}));export const LineRiseIcon=t=>i(o,Object.assign({},t,{children:[c(p,{text:"ABC",x:10.5,y:9,scale:.75}),c(p,{text:"ABC",x:10.5,y:30,scale:.75,opacity:.28}),c(h,{d:"M42 37 V30.5 M39.6 32.8 L42 30.4 L44.4 32.8",opacity:.6})]}));export const WordRiseIcon=t=>i(o,Object.assign({},t,{children:[c(p,{text:"AB",x:3.5,y:17,scale:.85}),c(p,{text:"CD",x:27,y:24,scale:.85,opacity:.3})]}));export const WordFadeIcon=t=>i(o,Object.assign({},t,{children:[c(p,{text:"AB",x:3.5,y:19,scale:.85}),c(p,{text:"CD",x:27,y:19,scale:.85,opacity:.22})]}));export const LetterPopIcon=t=>i(o,Object.assign({},t,{children:[c(d,{ch:"A",x:6,y:24,scale:.5,opacity:.25}),c(d,{ch:"B",x:15,y:21,scale:.75,opacity:.5}),c(d,{ch:"C",x:28,y:18}),c(h,{d:"M39.5 14.5 L42.5 11.5 M41.5 20 H45 M34.5 12.5 V9",opacity:.6})]}));export const WordBlurIcon=t=>{const e=n();return i(o,Object.assign({},t,{children:[c("defs",{children:c("filter",{id:e,x:"-50%",y:"-50%",width:"200%",height:"200%",children:c("feGaussianBlur",{stdDeviation:1.3})})}),c(p,{text:"AB",x:3.5,y:19,scale:.85}),c("g",{filter:`url(#${e})`,children:c(p,{text:"CD",x:27,y:19,scale:.85,opacity:.75})})]}))};export const LineWipeIcon=t=>{const e=n();return i(o,Object.assign({},t,{children:[c("defs",{children:c("clipPath",{id:e,children:c("rect",{y:20,width:32,height:28})})}),c(p,{text:"ABC",x:10.5,y:10,scale:.75}),c(p,{text:"ABC",x:10.5,y:28,scale:.75,opacity:.16}),c("g",{clipPath:`url(#${e})`,children:c(p,{text:"ABC",x:10.5,y:28,scale:.75})}),c(h,{d:"M32 25 V42",opacity:1,width:2.2})]}))};export const LetterWaveIcon=t=>i(o,Object.assign({},t,{children:[c(d,{ch:"A",x:7.5,y:20}),c(d,{ch:"B",x:19.5,y:13}),c(d,{ch:"C",x:31.5,y:20}),c(h,{d:"M6 39 C10 35.5 14 35.5 18 39 S26 42.5 30 39 S38 35.5 42 39",opacity:.35})]}));export const RotateIcon=t=>i(o,Object.assign({},t,{children:[c(y,{cx:24,cy:24,r:9}),c(h,{d:"M9.5 19.5 A15.5 15.5 0 0 1 22 8.6 M18.6 6.6 L22 8.6 L19 11.4",opacity:.65}),c(h,{d:"M38.5 28.5 A15.5 15.5 0 0 1 26 39.4 M29.4 41.4 L26 39.4 L29 36.6",opacity:.65})]}));export const BlinkIcon=t=>i(o,Object.assign({},t,{children:[c(y,{cx:15.5,cy:24,r:8.5}),c("circle",{cx:32.5,cy:24,r:8,stroke:s,strokeOpacity:.45,strokeWidth:1.8,strokeDasharray:"2.5 2.5"})]}));export const PulseIcon=t=>i(o,Object.assign({},t,{children:[c("circle",{cx:24,cy:24,r:16.5,stroke:s,strokeOpacity:.16,strokeWidth:2}),c("circle",{cx:24,cy:24,r:12,stroke:s,strokeOpacity:.38,strokeWidth:2}),c(y,{cx:24,cy:24,r:7.5})]}));export const FloatIcon=t=>i(o,Object.assign({},t,{children:[c(y,{cx:24,cy:22,r:9,opacity:.18}),c(y,{cx:24,cy:17,r:9}),c("ellipse",{cx:24,cy:39,rx:9.5,ry:2.4,fill:s,fillOpacity:.22})]}));export const ShakeIcon=t=>i(o,Object.assign({},t,{children:[c(y,{cx:17,cy:24,r:9,opacity:.16}),c(y,{cx:31,cy:24,r:9,opacity:.16}),c(y,{cx:24,cy:24,r:9}),c(h,{d:"M5 19 V29 M43 19 V29",opacity:.5})]}));export const GlowIcon=t=>{const e=n();return i(o,Object.assign({},t,{children:[c("defs",{children:c("filter",{id:e,x:"-50%",y:"-50%",width:"200%",height:"200%",children:c("feGaussianBlur",{stdDeviation:3.2})})}),c(y,{cx:24,cy:24,r:14,opacity:.4,filter:`url(#${e})`}),c(y,{cx:24,cy:24,r:8.5})]}))};export const KenBurnsIcon=t=>i(o,Object.assign({},t,{children:[c("circle",{cx:24,cy:24,r:17,stroke:s,strokeOpacity:.3,strokeWidth:2}),c(y,{cx:20.5,cy:24,r:6.5,opacity:.2}),c(y,{cx:27,cy:24,r:9.5})]}));export const BounceIcon=t=>i(o,Object.assign({},t,{children:[c("circle",{cx:24,cy:24,r:14,stroke:s,strokeOpacity:.3,strokeWidth:1.8,strokeDasharray:"2.5 2.5"}),c(y,{cx:24,cy:24,r:6})]}));
|
package/icons/registry.d.ts
CHANGED
|
@@ -113,9 +113,31 @@ declare const defaults: {
|
|
|
113
113
|
'animation.typeMove': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
114
114
|
'animation.typeFade': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
115
115
|
'animation.typeZoom': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
116
|
+
'animation.typeBlur': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
117
|
+
'animation.typeCount': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
116
118
|
'animation.typeRotate': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
117
119
|
'animation.typeBlink': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
118
120
|
'animation.typeBounce': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
121
|
+
'animation.typePop': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
122
|
+
'animation.typeRise': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
123
|
+
'animation.typeFlip': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
124
|
+
'animation.typeGrowTurn': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
125
|
+
'animation.typePulse': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
126
|
+
'animation.typeFloat': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
127
|
+
'animation.typeShake': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
128
|
+
'animation.typeTypewriter': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
129
|
+
'animation.typeLineRise': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
130
|
+
'animation.typeWordRise': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
131
|
+
'animation.typeWordFade': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
132
|
+
'animation.typeLetterPop': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
133
|
+
'animation.typeWordBlur': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
134
|
+
'animation.typeWipe': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
135
|
+
'animation.typeGlow': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
136
|
+
'animation.typeKenBurns': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
137
|
+
'animation.typeLineWipe': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
138
|
+
'animation.typeLetterWave': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
139
|
+
'animation.typeNone': (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
|
|
140
|
+
'animation.settings': import("lucide-react").LucideIcon;
|
|
119
141
|
};
|
|
120
142
|
export type IconName = keyof typeof defaults;
|
|
121
143
|
export declare const setIcons: (custom: Partial<Record<IconName, IconComponent>>) => void;
|
package/icons/registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=this&&this.__rest||function(t,
|
|
1
|
+
var t=this&&this.__rest||function(t,i){var e={};for(var o in t){Object.prototype.hasOwnProperty.call(t,o)&&i.indexOf(o)<0&&(e[o]=t[o])}if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++){i.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(e[o[n]]=t[o[n]])}}return e};import{jsx as i}from"react/jsx-runtime";import{observable as e,action as o}from"mobx";import{observer as n}from"mobx-react-lite";import{AlignCenter as a,AlignCenterHorizontal as r,AlignCenterVertical as l,AlignEndHorizontal as p,AlignEndVertical as s,AlignHorizontalSpaceAround as c,AlignJustify as m,AlignLeft as d,AlignRight as y,AlignStartHorizontal as u,AlignStartVertical as g,AlignVerticalJustifyCenter as b,AlignVerticalJustifyEnd as f,AlignVerticalJustifyStart as x,AlignVerticalSpaceAround as h,ArrowDown as v,ArrowDownLeft as w,ArrowDownRight as P,ArrowLeft as z,ArrowLeftRight as k,ArrowRight as L,ArrowUp as O,ArrowUpDown as j,ArrowUpLeft as R,ArrowUpRight as T,Ban as B,Bold as I,CaseSensitive as W,Check as F,ChevronDown as C,ChevronLeft as D,ChevronRight as G,ChevronsDown as H,ChevronsUp as M,ChevronUp as S,CloudUpload as E,Contrast as U,Copy as V,CreditCard as $,Crop as _,Edit as J,Eye as K,EyeOff as N,Files as Z,FileText as q,GripVertical as A,HelpCircle as Q,Highlighter as X,Image as Y,Italic as tt,Layers as it,LayoutTemplate as et,List as ot,ListOrdered as nt,Lock as at,MousePointer as rt,MoreHorizontal as lt,PaintBucket as pt,Palette as st,Pause as ct,Pencil as mt,Pilcrow as dt,Pipette as yt,Play as ut,Plus as gt,Redo2 as bt,Scaling as ft,Scissors as xt,Search as ht,SkipBack as vt,Settings as wt,Shapes as Pt,SlidersHorizontal as zt,Sparkles as kt,Strikethrough as Lt,TextCursorInput as Ot,Timer as jt,Trash2 as Rt,Type as Tt,Underline as Bt,Undo2 as It,Unlock as Wt,Upload as Ft,Video as Ct,Volume2 as Dt,VolumeX as Gt,WandSparkles as Ht,WrapText as Mt,X as St,ZoomIn as Et,ZoomOut as Ut}from"lucide-react";import{Instagram as Vt,Facebook as $t,Youtube as _t,Linkedin as Jt,Twitter as Kt}from"./brand-icons.js";import{NoneIcon as Nt,MoveIcon as Zt,FadeIcon as qt,ZoomIcon as At,RotateIcon as Qt,BlinkIcon as Xt,BounceIcon as Yt,BlurIcon as ti,CountIcon as ii,PopIcon as ei,RiseIcon as oi,FlipIcon as ni,GrowTurnIcon as ai,PulseIcon as ri,FloatIcon as li,ShakeIcon as pi,TypewriterIcon as si,LineRiseIcon as ci,WordRiseIcon as mi,WordFadeIcon as di,LetterPopIcon as yi,WordBlurIcon as ui,WipeIcon as gi,GlowIcon as bi,KenBurnsIcon as fi,LineWipeIcon as xi,LetterWaveIcon as hi}from"./animation-icons.js";const vi={"action.duplicate":V,"action.split":xt,"action.rename":mt,"action.remove":Rt,"action.lock":at,"action.unlock":Wt,"action.undo":It,"action.redo":bt,"action.add":gt,"action.more":lt,"action.settings":wt,"action.search":ht,"action.close":St,"action.confirm":F,"action.none":B,"action.visible":K,"action.hidden":N,"action.dragHandle":A,"action.eyeDropper":yt,"action.unmuted":Dt,"action.muted":Gt,"action.help":Q,"ui.chevronUp":S,"ui.chevronDown":C,"ui.chevronLeft":D,"ui.chevronRight":G,"layering.menu":it,"layering.up":S,"layering.down":C,"layering.top":M,"layering.bottom":H,"text.bold":I,"text.italic":tt,"text.underline":Bt,"text.strikethrough":Lt,"text.alignLeft":d,"text.alignCenter":a,"text.alignRight":y,"text.alignJustify":m,"text.valignTop":x,"text.valignMiddle":b,"text.valignBottom":f,"text.uppercase":W,"text.spacing":Mt,"text.bulletList":ot,"text.numberedList":nt,"text.paragraph":dt,"text.richText":Ot,"text.uploadFont":Ft,"position.alignLeft":g,"position.alignCenter":l,"position.alignRight":s,"position.alignTop":u,"position.alignMiddle":r,"position.alignBottom":p,"position.distributeVertical":h,"position.distributeHorizontal":c,"sidePanel.templates":et,"sidePanel.text":Tt,"sidePanel.photos":Y,"sidePanel.elements":Pt,"sidePanel.upload":E,"sidePanel.background":pt,"sidePanel.pages":Z,"sidePanel.layers":it,"sidePanel.resize":ft,"sidePanel.draw":mt,"sidePanel.videos":Ct,"toolbar.opacity":U,"toolbar.filters":Ht,"toolbar.aiWrite":kt,"toolbar.duration":jt,"toolbar.trim":xt,"toolbar.flipHorizontal":k,"toolbar.flipVertical":j,"toolbar.zoomIn":Et,"toolbar.zoomOut":Ut,"toolbar.crop":_,"imageEdit.ai":kt,"colorPicker.reverseGradient":k,"download.export":Ft,"download.image":Y,"download.pdf":q,"download.video":Ct,"draw.select":rt,"draw.brush":J,"draw.highlighter":X,"background.colorPicker":st,"pagesTimeline.play":ut,"pagesTimeline.pause":ct,"pagesTimeline.rewind":vt,"size.instagram":Vt,"size.facebook":$t,"size.youtube":_t,"size.linkedin":Jt,"size.twitter":Kt,"size.video":Ct,"size.print":q,"size.businessCard":$,"animation.directionRight":L,"animation.directionLeft":z,"animation.directionUp":O,"animation.directionDown":v,"animation.directionBottomRight":P,"animation.directionBottomLeft":w,"animation.directionTopRight":T,"animation.directionTopLeft":R,"animation.typeMove":Zt,"animation.typeFade":qt,"animation.typeZoom":At,"animation.typeBlur":ti,"animation.typeCount":ii,"animation.typeRotate":Qt,"animation.typeBlink":Xt,"animation.typeBounce":Yt,"animation.typePop":ei,"animation.typeRise":oi,"animation.typeFlip":ni,"animation.typeGrowTurn":ai,"animation.typePulse":ri,"animation.typeFloat":li,"animation.typeShake":pi,"animation.typeTypewriter":si,"animation.typeLineRise":ci,"animation.typeWordRise":mi,"animation.typeWordFade":di,"animation.typeLetterPop":yi,"animation.typeWordBlur":ui,"animation.typeWipe":gi,"animation.typeGlow":bi,"animation.typeKenBurns":fi,"animation.typeLineWipe":xi,"animation.typeLetterWave":hi,"animation.typeNone":Nt,"animation.settings":zt},wi=e.map();export const setIcons=o(t=>{for(const i of Object.keys(t)){const e=t[i];null!=e&&("function"==typeof e||"object"==typeof e?wi.set(i,e):console.warn(`polotno: setIcons('${i}') expects a React component, received ${typeof e}. Ignored.`))}});export const resetIcons=o(()=>wi.clear());export const PolotnoIcon=n(e=>{var o,{name:n}=e,a=t(e,["name"]);const r=null!==(o=wi.get(n))&&void 0!==o?o:vi[n];return i(r,Object.assign({"data-pn-icon":""},a))});
|
package/image-tools/raster.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getFlippedCropRect as t,loadImage as e}from"@polotno/core/image";import{polotnoError as
|
|
1
|
+
import{getFlippedCropRect as t,loadImage as e,mayBeUnsizedSvg as i}from"@polotno/core/image";import{polotnoError as h}from"@polotno/core/errors";import{fetchSvgText as a,isSvgUrl as r,prepareSvgSource as o,urlToString as n}from"@polotno/core/svg";import{UNIT as c,matchesAspect as s}from"./geometry.js";export const WORKING_MAX_SIDE=4096;const w=(t,e,i)=>h("IMAGE_FAILED","This device could not prepare the image. Try a smaller image.",{reason:"raster-failed",stage:t,width:e.width,height:e.height},i);export function rasterCanvas(t,e){try{if(![t.width,t.height].every(t=>Number.isInteger(t)&&t>0&&t<=4096)){throw new Error("Invalid working dimensions")}const e=document.createElement("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");if(!i){throw new Error("Canvas 2D unavailable")}return{canvas:e,ctx:i}}catch(i){throw w(e,t,i)}}export async function encodeRaster(t,e){try{return await new Promise((e,i)=>t.toBlob(t=>t?e(t):i(new Error("PNG encoding failed")),"image/png"))}catch(i){throw w(e,t,i)}}export async function withBlobImage(t,i){const h=URL.createObjectURL(t);try{return await i(await e(h))}finally{URL.revokeObjectURL(h)}}export async function rasterizeImageInput(h,l=c){const g=r(h.src),d=g?o(await n(h.src)):h.src;let m=await e(d);if(!g&&i(m)){const t=await a(d).catch(()=>null);null!==t&&(m=await e(o(t)))}const f={width:m.naturalWidth,height:m.naturalHeight},p=t(h,f),u=Math.max(p.width,p.height)/Math.max(h.width,h.height),x=function(t){const e=Math.max(t.width,t.height);if(!Number.isFinite(e)||Math.min(t.width,t.height)<=0){throw w("compose",t)}for(let i=Math.min(4096,Math.ceil(e));i>0;i--){const h=i/e,a={width:Math.max(1,Math.round(t.width*h)),height:Math.max(1,Math.round(t.height*h))};if(s(a,t)){return a}}throw new RangeError("The image aspect cannot fit the working raster.")}({width:h.width*l.width*u,height:h.height*l.height*u}),{canvas:M,ctx:y}=rasterCanvas(x,"compose"),v=h.flipX?1-l.x-l.width:l.x,R=h.flipY?1-l.y-l.height:l.y;y.translate(h.flipX?x.width:0,h.flipY?x.height:0),y.scale(h.flipX?-1:1,h.flipY?-1:1);try{y.drawImage(m,p.x+v*p.width,p.y+R*p.height,l.width*p.width,l.height*p.height,0,0,x.width,x.height)}catch(I){throw w("compose",x,I)}return{image:await encodeRaster(M,"compose"),size:x}}export async function rectangleMask(t,e){const{canvas:i,ctx:h}=rasterCanvas(t,"mask");h.fillStyle="black",h.fillRect(0,0,t.width,t.height);const a=Math.max(0,Math.floor(e.x*t.width)),r=Math.max(0,Math.floor(e.y*t.height)),o=Math.min(t.width,Math.ceil((e.x+e.width)*t.width)),n=Math.min(t.height,Math.ceil((e.y+e.height)*t.height));return h.fillStyle="white",h.fillRect(a,r,o-a,n-r),encodeRaster(i,"mask")}
|
package/model/figure-model.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
4
4
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
5
5
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
6
6
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
7
|
-
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
7
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
8
8
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
9
9
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
10
10
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -25,6 +25,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
25
25
|
type: import("mobx-state-tree").ISimpleType<"exit" | "enter" | "loop">;
|
|
26
26
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
27
27
|
data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>;
|
|
28
|
+
easing: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
28
29
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
29
30
|
blurEnabled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
30
31
|
blurRadius: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
@@ -65,7 +66,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
65
66
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
66
67
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
67
68
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
68
|
-
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
69
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
69
70
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
70
71
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
71
72
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -77,7 +78,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
77
78
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
78
79
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
79
80
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
80
|
-
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
81
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
81
82
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
82
83
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
83
84
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -89,7 +90,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
89
90
|
type: string | undefined;
|
|
90
91
|
name: string | undefined;
|
|
91
92
|
opacity: number | undefined;
|
|
92
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
93
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light" | undefined;
|
|
93
94
|
custom: any;
|
|
94
95
|
visible: boolean | undefined;
|
|
95
96
|
selectable: boolean | undefined;
|
|
@@ -108,7 +109,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
108
109
|
alwaysOnTop: boolean;
|
|
109
110
|
showInExport: boolean;
|
|
110
111
|
} | {
|
|
111
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
112
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
|
|
112
113
|
id: string;
|
|
113
114
|
type: string;
|
|
114
115
|
name: string;
|
|
@@ -136,7 +137,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
136
137
|
alwaysOnTop: boolean;
|
|
137
138
|
showInExport: boolean;
|
|
138
139
|
} | {
|
|
139
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
140
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
|
|
140
141
|
id: string;
|
|
141
142
|
type: string;
|
|
142
143
|
name: string;
|
|
@@ -171,14 +172,14 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
171
172
|
readonly isSelected: boolean;
|
|
172
173
|
readonly isSelectedDirectly: boolean;
|
|
173
174
|
} & {
|
|
174
|
-
setAnimation(type:
|
|
175
|
+
setAnimation(type: "enter" | "exit" | "loop", attrs: import("../utils/animations.js").AnimationAttrs): void;
|
|
175
176
|
setFilter(type: any, value: any): void;
|
|
176
177
|
}, import("mobx-state-tree").ModelCreationType<{
|
|
177
178
|
id: string;
|
|
178
179
|
type: string | undefined;
|
|
179
180
|
name: string | undefined;
|
|
180
181
|
opacity: number | undefined;
|
|
181
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
182
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light" | undefined;
|
|
182
183
|
custom: any;
|
|
183
184
|
visible: boolean | undefined;
|
|
184
185
|
selectable: boolean | undefined;
|
|
@@ -197,7 +198,7 @@ export declare const FigureElement: import("mobx-state-tree").IModelType<{
|
|
|
197
198
|
alwaysOnTop: boolean;
|
|
198
199
|
showInExport: boolean;
|
|
199
200
|
} | {
|
|
200
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
201
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
|
|
201
202
|
id: string;
|
|
202
203
|
type: string;
|
|
203
204
|
name: string;
|
package/model/gif-model.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
4
4
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
5
5
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
6
6
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
7
|
-
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
7
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
8
8
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
9
9
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
10
10
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -25,6 +25,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
25
25
|
type: import("mobx-state-tree").ISimpleType<"exit" | "enter" | "loop">;
|
|
26
26
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
27
27
|
data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>;
|
|
28
|
+
easing: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
28
29
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
29
30
|
blurEnabled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
30
31
|
blurRadius: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
@@ -78,7 +79,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
78
79
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
79
80
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
80
81
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
81
|
-
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
82
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
82
83
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
83
84
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
84
85
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -90,7 +91,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
90
91
|
type: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
91
92
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
92
93
|
opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
93
|
-
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
94
|
+
blendMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light">, [undefined]>;
|
|
94
95
|
custom: import("mobx-state-tree").IType<any, any, any>;
|
|
95
96
|
visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
96
97
|
selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
@@ -102,7 +103,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
102
103
|
type: string | undefined;
|
|
103
104
|
name: string | undefined;
|
|
104
105
|
opacity: number | undefined;
|
|
105
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
106
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light" | undefined;
|
|
106
107
|
custom: any;
|
|
107
108
|
visible: boolean | undefined;
|
|
108
109
|
selectable: boolean | undefined;
|
|
@@ -121,7 +122,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
121
122
|
alwaysOnTop: boolean;
|
|
122
123
|
showInExport: boolean;
|
|
123
124
|
} | {
|
|
124
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
125
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
|
|
125
126
|
id: string;
|
|
126
127
|
type: string;
|
|
127
128
|
name: string;
|
|
@@ -149,7 +150,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
149
150
|
alwaysOnTop: boolean;
|
|
150
151
|
showInExport: boolean;
|
|
151
152
|
} | {
|
|
152
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
153
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
|
|
153
154
|
id: string;
|
|
154
155
|
type: string;
|
|
155
156
|
name: string;
|
|
@@ -184,7 +185,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
184
185
|
readonly isSelected: boolean;
|
|
185
186
|
readonly isSelectedDirectly: boolean;
|
|
186
187
|
} & {
|
|
187
|
-
setAnimation(type:
|
|
188
|
+
setAnimation(type: "enter" | "exit" | "loop", attrs: import("../utils/animations.js").AnimationAttrs): void;
|
|
188
189
|
setFilter(type: any, value: any): void;
|
|
189
190
|
} & {
|
|
190
191
|
_setSourceSize(size: import("../image-tools/types.js").Size, src: string): void;
|
|
@@ -208,7 +209,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
208
209
|
type: string | undefined;
|
|
209
210
|
name: string | undefined;
|
|
210
211
|
opacity: number | undefined;
|
|
211
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
212
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light" | undefined;
|
|
212
213
|
custom: any;
|
|
213
214
|
visible: boolean | undefined;
|
|
214
215
|
selectable: boolean | undefined;
|
|
@@ -227,7 +228,7 @@ export declare const GifElement: import("mobx-state-tree").IModelType<{
|
|
|
227
228
|
alwaysOnTop: boolean;
|
|
228
229
|
showInExport: boolean;
|
|
229
230
|
} | {
|
|
230
|
-
blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "
|
|
231
|
+
blendMode: "normal" | "color" | "overlay" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "saturation" | "screen" | "soft-light";
|
|
231
232
|
id: string;
|
|
232
233
|
type: string;
|
|
233
234
|
name: string;
|