polotno 4.13.0 → 4.14.1

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 (76) hide show
  1. package/blueprint/side-panel/select-video.d.ts +105 -36
  2. package/canvas/apply-filters.js +1 -1
  3. package/canvas/downscale.d.ts +4 -0
  4. package/canvas/downscale.js +1 -1
  5. package/canvas/element.d.ts +1 -1
  6. package/canvas/element.js +1 -1
  7. package/canvas/figure-element.js +1 -1
  8. package/canvas/gif-element.js +1 -1
  9. package/canvas/html-element.js +1 -1
  10. package/canvas/image-element.js +1 -1
  11. package/canvas/line-element.js +1 -1
  12. package/canvas/page.js +1 -1
  13. package/canvas/paint-opacity.d.ts +12 -0
  14. package/canvas/paint-opacity.js +1 -0
  15. package/canvas/render-tag-element.js +1 -1
  16. package/canvas/rich-editor.js +11 -3
  17. package/canvas/table-element.js +1 -1
  18. package/canvas/text-element/font-specs-loader.js +1 -1
  19. package/canvas/text-element.js +1 -1
  20. package/canvas/use-filtered-source.js +1 -1
  21. package/canvas/video-element.js +1 -1
  22. package/canvas/workspace-canvas.js +1 -1
  23. package/model/audio-model.d.ts +54 -2
  24. package/model/figure-model.d.ts +65 -24
  25. package/model/gif-model.d.ts +65 -24
  26. package/model/group-model.d.ts +497 -182
  27. package/model/group-model.js +1 -1
  28. package/model/history.js +1 -1
  29. package/model/image-model.d.ts +65 -24
  30. package/model/line-model.d.ts +65 -24
  31. package/model/node-model.d.ts +65 -24
  32. package/model/node-model.js +1 -1
  33. package/model/page-model.d.ts +4369 -445
  34. package/model/page-model.js +1 -1
  35. package/model/shape-model.d.ts +65 -24
  36. package/model/store.d.ts +480 -18060
  37. package/model/store.js +1 -1
  38. package/model/svg-model.d.ts +64 -24
  39. package/model/table-model.d.ts +40 -12
  40. package/model/table-model.js +1 -1
  41. package/model/text-model.d.ts +64 -24
  42. package/model/text-model.js +1 -1
  43. package/model/video-model.d.ts +65 -24
  44. package/package.json +8 -8
  45. package/polotno.bundle.js +167 -156
  46. package/primitives/panel-header.js +1 -1
  47. package/primitives/panel-scroll-area.d.ts +4 -0
  48. package/primitives/panel-scroll-area.js +1 -0
  49. package/primitives/select.js +1 -1
  50. package/primitives/slider.js +1 -1
  51. package/side-panel/animations-panel.js +1 -1
  52. package/side-panel/draw-panel.js +1 -1
  53. package/side-panel/effects-panel.js +1 -1
  54. package/side-panel/elements-panel.js +1 -1
  55. package/side-panel/image-clip-panel.js +1 -1
  56. package/side-panel/layers-panel.js +1 -1
  57. package/side-panel/select-video.d.ts +105 -36
  58. package/side-panel/side-panel.js +1 -1
  59. package/side-panel/size-panel.js +1 -1
  60. package/side-panel/text-panel.js +1 -1
  61. package/toolbar/color-picker.js +1 -1
  62. package/toolbar/html-toolbar.js +3 -3
  63. package/toolbar/opacity-picker.js +1 -1
  64. package/toolbar/text-toolbar.js +1 -1
  65. package/ui.css +1 -1
  66. package/utils/canvas.d.ts +0 -3
  67. package/utils/canvas.js +1 -1
  68. package/utils/clipboard.d.ts +104 -36
  69. package/utils/fonts.js +1 -1
  70. package/utils/from-svg.js +1 -1
  71. package/utils/l10n.d.ts +21 -0
  72. package/utils/l10n.js +1 -1
  73. package/utils/pointer-drag.js +1 -1
  74. package/utils/text-format-state.d.ts +3 -0
  75. package/utils/text-format-state.js +1 -1
  76. package/utils/validate-key.js +1 -1
@@ -1 +1 @@
1
- var e=this&&this.__rest||function(e,t){var o={};for(var i in e){Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++){t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(o[i[r]]=e[i[r]])}}return o};import{detach as t,isAlive as o,types as i}from"mobx-state-tree";import{nanoid as r}from"nanoid";import{Node as n}from"./node-model.js";import{Animation as s,Shape as l}from"./shape-model.js";import{animate as a}from"../utils/animations.js";import{polotnoError as d}from"@polotno/core/errors";import{getPlayheadLocalTime as c}from"../utils/timeline.js";import{getCenter as p,getTotalClientRect as h}from"../utils/math.js";import{TextElement as y}from"./text-model.js";import{ImageElement as m}from"./image-model.js";import{VideoElement as f}from"./video-model.js";import{LineElement as u}from"./line-model.js";import{SVGElement as g}from"./svg-model.js";import{FigureElement as E}from"./figure-model.js";import{GifElement as b}from"./gif-model.js";import{TableElement as v}from"./table-model.js";export const forEveryChild=(e,t)=>{if(e.children){for(const o of e.children){if(!0===t(o)){break}forEveryChild(o,t)}}};export{forEveryNode}from"@polotno/core/for-every-node";export function zIndexOps(e){const o=(t,o,i)=>{const r=t.map(t=>e.children.findIndex(e=>e.id===t)).filter(e=>-1!==e).sort((e,t)=>(t-e)*o);for(const n of r){const r=e.children[n+o];!r||t.indexOf(r.id)>=0||i(n)}},i=(e,t)=>{let i=!1;return o(e,t,()=>{i=!0}),i},r=(i,r)=>{o(i,r,o=>{const i=e.children[o];t(i),e.children.splice(o+r,0,i)})},n=(t,o)=>{const i=[],r=[];e.children.forEach(e=>{(t.indexOf(e.id)>=0?i:r).push(e)}),e.children.replace(o?r.concat(i):i.concat(r))};return{canMoveElementsUp:e=>i(e,1),canMoveElementsTop:e=>i(e,1),canMoveElementsDown:e=>i(e,-1),canMoveElementsBottom:e=>i(e,-1),moveElementsUp(e){r(e,1)},moveElementsDown(e){r(e,-1)},moveElementsTop(e){n(e,!0)},moveElementsBottom(e){n(e,!1)},setElementZIndex(o,i){const r=e.children.find(e=>e.id===o);r&&(t(r),e.children.remove(r),e.children.splice(i,0,r))}}}const x=[...new Array(20)].map((e,t)=>i.late(()=>S[t]));export const ElementTypes=i.union({dispatcher:e=>{const t=TYPES_MAP[e.type];if(!t){const t=`Unknown element type: "${e.type}"`;throw d("DESIGN_INVALID",t,{errors:[{path:"type",message:t}],knownTypes:Object.keys(TYPES_MAP)})}return t}},g,y,m,u,f,E,b,v,i.late(()=>GroupElement),...x);const w=Object.freeze({x:0,y:0,offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,opacity:1});function j(e){return 1===e?w:Object.assign(Object.assign({},w),{opacity:e})}const O={x:0,y:0,width:0,height:0,rotation:0,opacity:1,fontSize:0,cropX:0,cropY:0,cropWidth:1,cropHeight:1},P=(e,t)=>"number"==typeof e&&isFinite(e)?e:t;function C(e,t,o,i){O.x=e.x,O.y=e.y,O.width=e.width,O.height=e.height,O.opacity=i;const r=a({element:O,animation:t,dTime:o})||{},n=P(r.width,e.width),s=P(r.height,e.height);return{x:P(r.x,e.x),y:P(r.y,e.y),width:n>0?n:e.width,height:s>0?s:e.height,rotation:P(r.rotation,0),opacity:P(r.opacity,i)}}export const GroupElement=n.named("Group").props({type:"group",children:i.array(ElementTypes),animations:i.array(s)}).views(e=>({get draggable(){let t=!0;return forEveryChild(e,e=>{e.draggable||(t=!1)}),t},get resizable(){let t=!0;return forEveryChild(e,e=>{e.resizable||(t=!1)}),t},get contentEditable(){let t=!0;return forEveryChild(e,e=>{e.contentEditable||(t=!1)}),t},get styleEditable(){let t=!0;return forEveryChild(e,e=>{e.styleEditable||(t=!1)}),t},get locked(){let t=!0;return forEveryChild(e,e=>{e.locked||(t=!1)}),t},get _restingBbox(){const t=[];if(forEveryChild(e,e=>{var o,i,r;if("group"===e.type){return}const n=e.width,s=e.height;!n||!s||n<=0||s<=0||t.push({x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0,width:n,height:s,rotation:null!==(r=e.rotation)&&void 0!==r?r:0})}),!t.length){return null}const o=h(t);return o.width<=0||o.height<=0?null:{x:o.x,y:o.y,width:o.width,height:o.height}},get a(){if(!o(e)){return w}const t=c(e);if(null===t){return j(e.opacity)}if(e.store.isEditingPaused&&this.isSelectedDirectly){return j(e.opacity)}const i=e.page,r=e.store.animatedElementsIds;if(r.length&&!r.includes(e.id)){return j(e.opacity)}let n,s,l;for(const o of e.animations){o.enabled&&("enter"===o.type?n=o:"exit"===o.type?s=o:"loop"===o.type&&(l=o))}const a=!!n&&t<n.delay,d=!!n&&t>=n.delay&&t<=n.delay+n.duration,h=!a&&!d&&!!s&&t>=i.duration-s.duration-s.delay&&t<=i.duration-s.delay,y=!!s&&t>=i.duration-s.delay;if(!(a||d||h||y||l)){return j(e.opacity)}const m=this._restingBbox;if(!m){return j(e.opacity)}let f={x:m.x,y:m.y,width:m.width,height:m.height,rotation:0,opacity:e.opacity};a&&(f.opacity=0),d&&(f=C(m,n,t-n.delay,e.opacity)),h&&(f=C(m,s,t-(i.duration-s.duration-s.delay),e.opacity)),y&&(f.opacity=0),l&&(f=C(f,l,t,f.opacity));const u=p(f);return{x:u.x,y:u.y,offsetX:m.x+m.width/2,offsetY:m.y+m.height/2,scaleX:f.width/m.width,scaleY:f.height/m.height,rotation:f.rotation,opacity:f.opacity}},get isSelectedDirectly(){return!!o(e)&&e.store.selectedElements.indexOf(e)>=0&&e.selectable},get active(){return!0}})).actions(t=>Object.assign(Object.assign({set(o){var{draggable:i,contentEditable:r,styleEditable:n,resizable:s}=o,l=e(o,["draggable","contentEditable","styleEditable","resizable"]);void 0!==i&&forEveryChild(t,e=>{e.set({draggable:i})}),void 0!==r&&forEveryChild(t,e=>{e.set({contentEditable:r})}),void 0!==n&&forEveryChild(t,e=>{e.set({styleEditable:n})}),void 0!==s&&forEveryChild(t,e=>{e.set({resizable:s})}),Object.assign(t,l)},addElement(e,{skipSelect:o=!1}={}){const i=TYPES_MAP[e.type];if(!i){return void console.error("Can not find model with type "+e.type)}e.children&&e.children.forEach(e=>{e.id=e.id||r(10)});const n=i.create(Object.assign({id:r(10)},e));return t.children.push(n),n.selectable&&!o&&t.store.selectElements([n.id]),n}},zIndexOps(t)),{setAnimation(e,o){const i=t.animations.find(t=>t.type===e);i?Object.assign(i,o):t.animations.push(Object.assign({type:e},o))}}));const S=[];export const TYPES_MAP={svg:g,text:y,image:m,group:GroupElement,line:u,video:f,figure:E,gif:b,table:v};export function registerShapeModel(e,t){const o=e.type;if(!o){throw new Error('You must pass "type" attribute to custom model.')}let i=l.named(o).props(e);t&&(i=t(i)),TYPES_MAP[o]=i,S.push(i)}
1
+ var e=this&&this.__rest||function(e,t){var o={};for(var i in e){Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++){t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(o[i[r]]=e[i[r]])}}return o};import{detach as t,isAlive as o,types as i}from"mobx-state-tree";import{nanoid as r}from"nanoid";import{GROUP_BLEND_MODES as n}from"@polotno/schema/defaults";import{Node as s}from"./node-model.js";import{Animation as l,Shape as a}from"./shape-model.js";import{animate as d}from"../utils/animations.js";import{polotnoError as c}from"@polotno/core/errors";import{getPlayheadLocalTime as p}from"../utils/timeline.js";import{getCenter as h,getTotalClientRect as m}from"../utils/math.js";import{TextElement as y}from"./text-model.js";import{ImageElement as f}from"./image-model.js";import{VideoElement as u}from"./video-model.js";import{LineElement as g}from"./line-model.js";import{SVGElement as E}from"./svg-model.js";import{FigureElement as b}from"./figure-model.js";import{GifElement as v}from"./gif-model.js";import{TableElement as x}from"./table-model.js";export const forEveryChild=(e,t)=>{if(e.children){for(const o of e.children){if(!0===t(o)){break}forEveryChild(o,t)}}};export{forEveryNode}from"@polotno/core/for-every-node";export function zIndexOps(e){const o=(t,o,i)=>{const r=t.map(t=>e.children.findIndex(e=>e.id===t)).filter(e=>-1!==e).sort((e,t)=>(t-e)*o);for(const n of r){const r=e.children[n+o];!r||t.indexOf(r.id)>=0||i(n)}},i=(e,t)=>{let i=!1;return o(e,t,()=>{i=!0}),i},r=(i,r)=>{o(i,r,o=>{const i=e.children[o];t(i),e.children.splice(o+r,0,i)})},n=(t,o)=>{const i=[],r=[];e.children.forEach(e=>{(t.indexOf(e.id)>=0?i:r).push(e)}),e.children.replace(o?r.concat(i):i.concat(r))};return{canMoveElementsUp:e=>i(e,1),canMoveElementsTop:e=>i(e,1),canMoveElementsDown:e=>i(e,-1),canMoveElementsBottom:e=>i(e,-1),moveElementsUp(e){r(e,1)},moveElementsDown(e){r(e,-1)},moveElementsTop(e){n(e,!0)},moveElementsBottom(e){n(e,!1)},setElementZIndex(o,i){const r=e.children.find(e=>e.id===o);r&&(t(r),e.children.remove(r),e.children.splice(i,0,r))}}}const w=[...new Array(20)].map((e,t)=>i.late(()=>M[t]));export const ElementTypes=i.union({dispatcher:e=>{const t=TYPES_MAP[e.type];if(!t){const t=`Unknown element type: "${e.type}"`;throw c("DESIGN_INVALID",t,{errors:[{path:"type",message:t}],knownTypes:Object.keys(TYPES_MAP)})}return t}},E,y,f,g,u,b,v,x,i.late(()=>GroupElement),...w);const j=Object.freeze({x:0,y:0,offsetX:0,offsetY:0,scaleX:1,scaleY:1,rotation:0,opacity:1});function O(e){return 1===e?j:Object.assign(Object.assign({},j),{opacity:e})}const P={x:0,y:0,width:0,height:0,rotation:0,opacity:1,fontSize:0,cropX:0,cropY:0,cropWidth:1,cropHeight:1},C=(e,t)=>"number"==typeof e&&isFinite(e)?e:t;function S(e,t,o,i){P.x=e.x,P.y=e.y,P.width=e.width,P.height=e.height,P.opacity=i;const r=d({element:P,animation:t,dTime:o})||{},n=C(r.width,e.width),s=C(r.height,e.height);return{x:C(r.x,e.x),y:C(r.y,e.y),width:n>0?n:e.width,height:s>0?s:e.height,rotation:C(r.rotation,0),opacity:C(r.opacity,i)}}export const GroupElement=s.named("Group").props({type:"group",blendMode:i.optional(i.enumeration([...n]),"pass-through"),children:i.array(ElementTypes),animations:i.array(l)}).views(e=>({get draggable(){let t=!0;return forEveryChild(e,e=>{e.draggable||(t=!1)}),t},get resizable(){let t=!0;return forEveryChild(e,e=>{e.resizable||(t=!1)}),t},get contentEditable(){let t=!0;return forEveryChild(e,e=>{e.contentEditable||(t=!1)}),t},get styleEditable(){let t=!0;return forEveryChild(e,e=>{e.styleEditable||(t=!1)}),t},get locked(){let t=!0;return forEveryChild(e,e=>{e.locked||(t=!1)}),t},get _restingBbox(){const t=[];if(forEveryChild(e,e=>{var o,i,r;if("group"===e.type){return}const n=e.width,s=e.height;!n||!s||n<=0||s<=0||t.push({x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0,width:n,height:s,rotation:null!==(r=e.rotation)&&void 0!==r?r:0})}),!t.length){return null}const o=m(t);return o.width<=0||o.height<=0?null:{x:o.x,y:o.y,width:o.width,height:o.height}},get a(){if(!o(e)){return j}const t=p(e);if(null===t){return O(e.opacity)}if(e.store.isEditingPaused&&this.isSelectedDirectly){return O(e.opacity)}const i=e.page,r=e.store.animatedElementsIds;if(r.length&&!r.includes(e.id)){return O(e.opacity)}let n,s,l;for(const o of e.animations){o.enabled&&("enter"===o.type?n=o:"exit"===o.type?s=o:"loop"===o.type&&(l=o))}const a=!!n&&t<n.delay,d=!!n&&t>=n.delay&&t<=n.delay+n.duration,c=!a&&!d&&!!s&&t>=i.duration-s.duration-s.delay&&t<=i.duration-s.delay,m=!!s&&t>=i.duration-s.delay;if(!(a||d||c||m||l)){return O(e.opacity)}const y=this._restingBbox;if(!y){return O(e.opacity)}let f={x:y.x,y:y.y,width:y.width,height:y.height,rotation:0,opacity:e.opacity};a&&(f.opacity=0),d&&(f=S(y,n,t-n.delay,e.opacity)),c&&(f=S(y,s,t-(i.duration-s.duration-s.delay),e.opacity)),m&&(f.opacity=0),l&&(f=S(f,l,t,f.opacity));const u=h(f);return{x:u.x,y:u.y,offsetX:y.x+y.width/2,offsetY:y.y+y.height/2,scaleX:f.width/y.width,scaleY:f.height/y.height,rotation:f.rotation,opacity:f.opacity}},get isSelectedDirectly(){return!!o(e)&&e.store.selectedElements.indexOf(e)>=0&&e.selectable},get active(){return!0}})).actions(t=>Object.assign(Object.assign({set(o){var{draggable:i,contentEditable:r,styleEditable:n,resizable:s}=o,l=e(o,["draggable","contentEditable","styleEditable","resizable"]);void 0!==i&&forEveryChild(t,e=>{e.set({draggable:i})}),void 0!==r&&forEveryChild(t,e=>{e.set({contentEditable:r})}),void 0!==n&&forEveryChild(t,e=>{e.set({styleEditable:n})}),void 0!==s&&forEveryChild(t,e=>{e.set({resizable:s})}),Object.assign(t,l)},addElement(e,{skipSelect:o=!1}={}){const i=TYPES_MAP[e.type];if(!i){return void console.error("Can not find model with type "+e.type)}e.children&&e.children.forEach(e=>{e.id=e.id||r(10)});const n=i.create(Object.assign({id:r(10)},e));return t.children.push(n),n.selectable&&!o&&t.store.selectElements([n.id]),n}},zIndexOps(t)),{setAnimation(e,o){const i=t.animations.find(t=>t.type===e);i?Object.assign(i,o):t.animations.push(Object.assign({type:e},o))}}));const M=[];export const TYPES_MAP={svg:E,text:y,image:f,group:GroupElement,line:g,video:u,figure:b,gif:v,table:x};export function registerShapeModel(e,t){const o=e.type;if(!o){throw new Error('You must pass "type" attribute to custom model.')}const i=a.named(o).props(e),r=t?t(i):i;TYPES_MAP[o]=r,M.push(r)}
package/model/history.js CHANGED
@@ -1 +1 @@
1
- import{types as t,resolvePath as e,onSnapshot as o,getSnapshot as a,applySnapshot as n}from"mobx-state-tree";import{deepEqual as r}from"../utils/deep-equal.js";Object.assign(t);export const UndoManager=t.model("UndoManager",{history:t.array(t.frozen()),undoIdx:-1,targetPath:""}).views(t=>({get canUndo(){return t.undoIdx>0},get canRedo(){return t.undoIdx<t.history.length-1}})).actions(t=>{let d,s,i=!1,c=null,u=0,h=0;const l=()=>h>0;function g(){const t=a(d);return{pages:t.pages,width:t.width,height:t.height,custom:t.custom,audios:t.audios}}function m(t){const e=d.pages.map(t=>t.id),o=t.pages.map(t=>t.id),a=!r(e,o),s=!r(d.custom,t.custom);a?n(d.pages,t.pages):d.pages.forEach((e,o)=>{n(e,t.pages[o])}),s&&d.set({custom:t.custom}),d.setSize(t.width,t.height)}const p={startTransaction(){h++},endTransaction(t){h--,t||p.requestAddState(g())},async ignore(t,e=!1,o=!1){o&&await new Promise(t=>setTimeout(t,10));const a=!!u;u&&p.addUndoState();let n=l();p.startTransaction();let r=h;try{await t()}catch(i){setTimeout(()=>{throw i})}const d=r!==h,s=!d;p.endTransaction(s),e||n&&!a||p.replaceState(),d||(clearTimeout(u),u=0)},async transaction(t){await p.ignore(t,!0),p.addUndoState()},requestAddState(t){c=t,u||l()||(i?i=!1:u=setTimeout(()=>{u=0,clearTimeout(u),l()||p.addUndoState()},100))},addUndoState(){if(i){return void(i=!1)}const e=t.history[t.undoIdx];!r(c,e)&&(clearTimeout(u),u=0,t.history.splice(t.undoIdx+1),t.history.push(c),t.undoIdx=t.history.length-1)},afterCreate(){if(d=e(t,".."),!d){throw new Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment")}s=o(d,()=>{p.requestAddState(g())}),0===t.history.length&&p.requestAddState(g())},clear(){clearTimeout(u),u=0,t.history.splice(0,t.history.length),t.undoIdx=-1,p.addUndoState()},beforeDestroy(){s()},undo(){u&&p.addUndoState(),l()?m(t.history[t.undoIdx]):t.canUndo?(t.undoIdx--,i=!0,m(t.history[t.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){u&&p.addUndoState(),t.canRedo?(t.undoIdx++,i=!0,m(t.history[t.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){t.history[t.undoIdx]=g()}};return p});export default UndoManager;
1
+ import{types as t,resolvePath as e,onSnapshot as o,getSnapshot as a,applySnapshot as n}from"mobx-state-tree";import{deepEqual as r}from"../utils/deep-equal.js";Object.assign(t);export const UndoManager=t.model("UndoManager",{history:t.array(t.frozen()),undoIdx:-1,targetPath:""}).views(t=>({get canUndo(){return t.undoIdx>0},get canRedo(){return t.undoIdx<t.history.length-1}})).actions(t=>{let d,s,i=!1,c=null,u=0,h=0;const l=()=>h>0;function g(){const t=a(d);return{pages:t.pages,width:t.width,height:t.height,custom:t.custom,audios:t.audios}}function m(t){const e=d.pages.map(t=>t.id),o=t.pages.map(t=>t.id),a=!r(e,o),s=!r(d.custom,t.custom);a?n(d.pages,t.pages):d.pages.forEach((e,o)=>{n(e,t.pages[o])}),s&&d.set({custom:t.custom}),d.setSize(t.width,t.height)}const p={startTransaction(){h++},endTransaction(t){h--,t||p.requestAddState(g())},async ignore(t,e=!1,o=!1){o&&await new Promise(t=>setTimeout(t,10));const a=!!u;u&&p.addUndoState();let n=l();p.startTransaction();let r=h;try{await t()}catch(i){setTimeout(()=>{throw i})}const d=r!==h,s=!d;p.endTransaction(s),e||n&&!a||p.replaceState(),d||(clearTimeout(u),u=0)},async transaction(t){await p.ignore(t,!0),p.addUndoState()},requestAddState(t){c=t,u||l()||(i?i=!1:u=setTimeout(()=>{u=0,clearTimeout(u),l()||p.addUndoState()},100))},addUndoState(){if(i){return void(i=!1)}const e=t.history[t.undoIdx];!r(c,e)&&(clearTimeout(u),u=0,t.history.splice(t.undoIdx+1),t.history.push(c),t.undoIdx=t.history.length-1)},afterCreate(){if(d=e(t,".."),!d){throw new Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment")}s=o(d,()=>{p.requestAddState(g())}),0===t.history.length&&p.requestAddState(g())},clear(){clearTimeout(u),u=0,t.history.splice(0,t.history.length),t.undoIdx=-1,p.addUndoState()},beforeDestroy(){s()},undo(){if(u&&p.addUndoState(),l()){const e=t.history[t.undoIdx];return void(e&&m(e))}t.canUndo?(t.undoIdx--,i=!0,m(t.history[t.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){u&&p.addUndoState(),t.canRedo?(t.undoIdx++,i=!0,m(t.history[t.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){t.history[t.undoIdx]=g()}};return p});export default UndoManager;
@@ -4,6 +4,7 @@ export declare const ImageElement: 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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
7
8
  custom: import("mobx-state-tree").IType<any, any, any>;
8
9
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
9
10
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -73,6 +74,7 @@ export declare const ImageElement: import("mobx-state-tree").IModelType<{
73
74
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
74
75
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
75
76
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
77
+ 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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
76
78
  custom: import("mobx-state-tree").IType<any, any, any>;
77
79
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
78
80
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -84,6 +86,7 @@ export declare const ImageElement: import("mobx-state-tree").IModelType<{
84
86
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
85
87
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
86
88
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
89
+ 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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
87
90
  custom: import("mobx-state-tree").IType<any, any, any>;
88
91
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
89
92
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -95,24 +98,37 @@ export declare const ImageElement: import("mobx-state-tree").IModelType<{
95
98
  type: string | undefined;
96
99
  name: string | undefined;
97
100
  opacity: number | undefined;
101
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
98
102
  custom: any;
99
103
  visible: boolean | undefined;
100
104
  selectable: boolean | undefined;
101
105
  removable: boolean | undefined;
102
106
  alwaysOnTop: boolean | undefined;
103
107
  showInExport: boolean | undefined;
104
- }>, import("mobx-state-tree").ModelSnapshotType<{
105
- id: import("mobx-state-tree").ISimpleType<string>;
106
- type: import("mobx-state-tree").IType<string | undefined, string, string>;
107
- name: import("mobx-state-tree").IType<string | undefined, string, string>;
108
- opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
109
- custom: import("mobx-state-tree").IType<any, any, any>;
110
- visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
111
- selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
112
- removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
113
- alwaysOnTop: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
114
- showInExport: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
115
- }>>>;
108
+ }>, {
109
+ id: string;
110
+ type: string;
111
+ name: string;
112
+ opacity: number;
113
+ custom: any;
114
+ visible: boolean;
115
+ selectable: boolean;
116
+ removable: boolean;
117
+ alwaysOnTop: boolean;
118
+ showInExport: boolean;
119
+ } | {
120
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
121
+ id: string;
122
+ type: string;
123
+ name: string;
124
+ opacity: number;
125
+ custom: any;
126
+ visible: boolean;
127
+ selectable: boolean;
128
+ removable: boolean;
129
+ alwaysOnTop: boolean;
130
+ showInExport: boolean;
131
+ }>>;
116
132
  readonly parent: any;
117
133
  readonly zIndex: any;
118
134
  } & {
@@ -127,6 +143,18 @@ export declare const ImageElement: import("mobx-state-tree").IModelType<{
127
143
  removable: boolean;
128
144
  alwaysOnTop: boolean;
129
145
  showInExport: boolean;
146
+ } | {
147
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
148
+ id: string;
149
+ type: string;
150
+ name: string;
151
+ opacity: number;
152
+ custom: any;
153
+ visible: boolean;
154
+ selectable: boolean;
155
+ removable: boolean;
156
+ alwaysOnTop: boolean;
157
+ showInExport: boolean;
130
158
  };
131
159
  } & {
132
160
  clone(attrs?: any, { skipSelect }?: {
@@ -165,22 +193,35 @@ export declare const ImageElement: import("mobx-state-tree").IModelType<{
165
193
  type: string | undefined;
166
194
  name: string | undefined;
167
195
  opacity: number | undefined;
196
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
168
197
  custom: any;
169
198
  visible: boolean | undefined;
170
199
  selectable: boolean | undefined;
171
200
  removable: boolean | undefined;
172
201
  alwaysOnTop: boolean | undefined;
173
202
  showInExport: boolean | undefined;
174
- }>, import("mobx-state-tree").ModelSnapshotType<{
175
- id: import("mobx-state-tree").ISimpleType<string>;
176
- type: import("mobx-state-tree").IType<string | undefined, string, string>;
177
- name: import("mobx-state-tree").IType<string | undefined, string, string>;
178
- opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
179
- custom: import("mobx-state-tree").IType<any, any, any>;
180
- visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
181
- selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
182
- removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
183
- alwaysOnTop: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
184
- showInExport: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
185
- }>>;
203
+ }>, {
204
+ id: string;
205
+ type: string;
206
+ name: string;
207
+ opacity: number;
208
+ custom: any;
209
+ visible: boolean;
210
+ selectable: boolean;
211
+ removable: boolean;
212
+ alwaysOnTop: boolean;
213
+ showInExport: boolean;
214
+ } | {
215
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
216
+ id: string;
217
+ type: string;
218
+ name: string;
219
+ opacity: number;
220
+ custom: any;
221
+ visible: boolean;
222
+ selectable: boolean;
223
+ removable: boolean;
224
+ alwaysOnTop: boolean;
225
+ showInExport: boolean;
226
+ }>;
186
227
  export type ImageElementType = Instance<typeof ImageElement>;
@@ -4,6 +4,7 @@ export declare const LineElement: 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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
7
8
  custom: import("mobx-state-tree").IType<any, any, any>;
8
9
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
9
10
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -64,6 +65,7 @@ export declare const LineElement: import("mobx-state-tree").IModelType<{
64
65
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
65
66
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
66
67
  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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
67
69
  custom: import("mobx-state-tree").IType<any, any, any>;
68
70
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
69
71
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -75,6 +77,7 @@ export declare const LineElement: import("mobx-state-tree").IModelType<{
75
77
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
76
78
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
77
79
  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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
78
81
  custom: import("mobx-state-tree").IType<any, any, any>;
79
82
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
80
83
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -86,24 +89,37 @@ export declare const LineElement: import("mobx-state-tree").IModelType<{
86
89
  type: string | undefined;
87
90
  name: string | undefined;
88
91
  opacity: number | undefined;
92
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
89
93
  custom: any;
90
94
  visible: boolean | undefined;
91
95
  selectable: boolean | undefined;
92
96
  removable: boolean | undefined;
93
97
  alwaysOnTop: boolean | undefined;
94
98
  showInExport: boolean | undefined;
95
- }>, import("mobx-state-tree").ModelSnapshotType<{
96
- id: import("mobx-state-tree").ISimpleType<string>;
97
- type: import("mobx-state-tree").IType<string | undefined, string, string>;
98
- name: import("mobx-state-tree").IType<string | undefined, string, string>;
99
- opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
100
- custom: import("mobx-state-tree").IType<any, any, any>;
101
- visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
102
- selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
103
- removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
104
- alwaysOnTop: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
105
- showInExport: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
106
- }>>>;
99
+ }>, {
100
+ id: string;
101
+ type: string;
102
+ name: string;
103
+ opacity: number;
104
+ custom: any;
105
+ visible: boolean;
106
+ selectable: boolean;
107
+ removable: boolean;
108
+ alwaysOnTop: boolean;
109
+ showInExport: boolean;
110
+ } | {
111
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
112
+ id: string;
113
+ type: string;
114
+ name: string;
115
+ opacity: number;
116
+ custom: any;
117
+ visible: boolean;
118
+ selectable: boolean;
119
+ removable: boolean;
120
+ alwaysOnTop: boolean;
121
+ showInExport: boolean;
122
+ }>>;
107
123
  readonly parent: any;
108
124
  readonly zIndex: any;
109
125
  } & {
@@ -118,6 +134,18 @@ export declare const LineElement: import("mobx-state-tree").IModelType<{
118
134
  removable: boolean;
119
135
  alwaysOnTop: boolean;
120
136
  showInExport: boolean;
137
+ } | {
138
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
139
+ id: string;
140
+ type: string;
141
+ name: string;
142
+ opacity: number;
143
+ custom: any;
144
+ visible: boolean;
145
+ selectable: boolean;
146
+ removable: boolean;
147
+ alwaysOnTop: boolean;
148
+ showInExport: boolean;
121
149
  };
122
150
  } & {
123
151
  clone(attrs?: any, { skipSelect }?: {
@@ -149,22 +177,35 @@ export declare const LineElement: import("mobx-state-tree").IModelType<{
149
177
  type: string | undefined;
150
178
  name: string | undefined;
151
179
  opacity: number | undefined;
180
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
152
181
  custom: any;
153
182
  visible: boolean | undefined;
154
183
  selectable: boolean | undefined;
155
184
  removable: boolean | undefined;
156
185
  alwaysOnTop: boolean | undefined;
157
186
  showInExport: boolean | undefined;
158
- }>, import("mobx-state-tree").ModelSnapshotType<{
159
- id: import("mobx-state-tree").ISimpleType<string>;
160
- type: import("mobx-state-tree").IType<string | undefined, string, string>;
161
- name: import("mobx-state-tree").IType<string | undefined, string, string>;
162
- opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
163
- custom: import("mobx-state-tree").IType<any, any, any>;
164
- visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
165
- selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
166
- removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
167
- alwaysOnTop: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
168
- showInExport: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
169
- }>>;
187
+ }>, {
188
+ id: string;
189
+ type: string;
190
+ name: string;
191
+ opacity: number;
192
+ custom: any;
193
+ visible: boolean;
194
+ selectable: boolean;
195
+ removable: boolean;
196
+ alwaysOnTop: boolean;
197
+ showInExport: boolean;
198
+ } | {
199
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
200
+ id: string;
201
+ type: string;
202
+ name: string;
203
+ opacity: number;
204
+ custom: any;
205
+ visible: boolean;
206
+ selectable: boolean;
207
+ removable: boolean;
208
+ alwaysOnTop: boolean;
209
+ showInExport: boolean;
210
+ }>;
170
211
  export type LineElementType = Instance<typeof LineElement>;
@@ -4,6 +4,7 @@ export declare const Node: 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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
7
8
  custom: import("mobx-state-tree").IType<any, any, any>;
8
9
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
9
10
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -18,6 +19,7 @@ export declare const Node: import("mobx-state-tree").IModelType<{
18
19
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
19
20
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
20
21
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
22
+ 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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
21
23
  custom: import("mobx-state-tree").IType<any, any, any>;
22
24
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
23
25
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -29,6 +31,7 @@ export declare const Node: import("mobx-state-tree").IModelType<{
29
31
  type: import("mobx-state-tree").IType<string | undefined, string, string>;
30
32
  name: import("mobx-state-tree").IType<string | undefined, string, string>;
31
33
  opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
34
+ 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" | "overlay" | "saturation" | "screen" | "soft-light">, [undefined]>;
32
35
  custom: import("mobx-state-tree").IType<any, any, any>;
33
36
  visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
34
37
  selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -40,24 +43,37 @@ export declare const Node: import("mobx-state-tree").IModelType<{
40
43
  type: string | undefined;
41
44
  name: string | undefined;
42
45
  opacity: number | undefined;
46
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
43
47
  custom: any;
44
48
  visible: boolean | undefined;
45
49
  selectable: boolean | undefined;
46
50
  removable: boolean | undefined;
47
51
  alwaysOnTop: boolean | undefined;
48
52
  showInExport: boolean | undefined;
49
- }>, import("mobx-state-tree").ModelSnapshotType<{
50
- id: import("mobx-state-tree").ISimpleType<string>;
51
- type: import("mobx-state-tree").IType<string | undefined, string, string>;
52
- name: import("mobx-state-tree").IType<string | undefined, string, string>;
53
- opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
54
- custom: import("mobx-state-tree").IType<any, any, any>;
55
- visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
56
- selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
57
- removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
58
- alwaysOnTop: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
59
- showInExport: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
60
- }>>>;
53
+ }>, {
54
+ id: string;
55
+ type: string;
56
+ name: string;
57
+ opacity: number;
58
+ custom: any;
59
+ visible: boolean;
60
+ selectable: boolean;
61
+ removable: boolean;
62
+ alwaysOnTop: boolean;
63
+ showInExport: boolean;
64
+ } | {
65
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
66
+ id: string;
67
+ type: string;
68
+ name: string;
69
+ opacity: number;
70
+ custom: any;
71
+ visible: boolean;
72
+ selectable: boolean;
73
+ removable: boolean;
74
+ alwaysOnTop: boolean;
75
+ showInExport: boolean;
76
+ }>>;
61
77
  readonly parent: any;
62
78
  readonly zIndex: any;
63
79
  } & {
@@ -72,6 +88,18 @@ export declare const Node: import("mobx-state-tree").IModelType<{
72
88
  removable: boolean;
73
89
  alwaysOnTop: boolean;
74
90
  showInExport: boolean;
91
+ } | {
92
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
93
+ id: string;
94
+ type: string;
95
+ name: string;
96
+ opacity: number;
97
+ custom: any;
98
+ visible: boolean;
99
+ selectable: boolean;
100
+ removable: boolean;
101
+ alwaysOnTop: boolean;
102
+ showInExport: boolean;
75
103
  };
76
104
  } & {
77
105
  clone(attrs?: any, { skipSelect }?: {
@@ -89,22 +117,35 @@ export declare const Node: import("mobx-state-tree").IModelType<{
89
117
  type: string | undefined;
90
118
  name: string | undefined;
91
119
  opacity: number | undefined;
120
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | undefined;
92
121
  custom: any;
93
122
  visible: boolean | undefined;
94
123
  selectable: boolean | undefined;
95
124
  removable: boolean | undefined;
96
125
  alwaysOnTop: boolean | undefined;
97
126
  showInExport: boolean | undefined;
98
- }>, import("mobx-state-tree").ModelSnapshotType<{
99
- id: import("mobx-state-tree").ISimpleType<string>;
100
- type: import("mobx-state-tree").IType<string | undefined, string, string>;
101
- name: import("mobx-state-tree").IType<string | undefined, string, string>;
102
- opacity: import("mobx-state-tree").IType<number | undefined, number, number>;
103
- custom: import("mobx-state-tree").IType<any, any, any>;
104
- visible: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
105
- selectable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
106
- removable: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
107
- alwaysOnTop: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
108
- showInExport: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
109
- }>>;
127
+ }>, {
128
+ id: string;
129
+ type: string;
130
+ name: string;
131
+ opacity: number;
132
+ custom: any;
133
+ visible: boolean;
134
+ selectable: boolean;
135
+ removable: boolean;
136
+ alwaysOnTop: boolean;
137
+ showInExport: boolean;
138
+ } | {
139
+ blendMode: "normal" | "color" | "color-burn" | "color-dodge" | "darken" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light";
140
+ id: string;
141
+ type: string;
142
+ name: string;
143
+ opacity: number;
144
+ custom: any;
145
+ visible: boolean;
146
+ selectable: boolean;
147
+ removable: boolean;
148
+ alwaysOnTop: boolean;
149
+ showInExport: boolean;
150
+ }>;
110
151
  export type NodeType = Instance<typeof Node>;
@@ -1 +1 @@
1
- import{types as e,getParentOfType as t,getSnapshot as n,hasParentOfType as o,isAlive as r}from"mobx-state-tree";import{nanoid as s}from"nanoid";import{Store as i}from"./store.js";import{Page as l}from"./page-model.js";import{GroupElement as a,forEveryNode as d}from"./group-model.js";export const Node=e.model("Node",{id:e.identifier,type:"none",name:"",opacity:1,custom:e.frozen(),visible:!0,selectable:!0,removable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{for(var t in e){null===e[t]&&(e[t]=void 0)}return e}).postProcessSnapshot(e=>{const t=Object.assign({},e),n={};for(var o in t){"_"!==o[0]&&(n[o]=e[o])}return n}).views(e=>({get page(){return r(e)?t(e,l):null},get store(){return r(e)?t(e,i):null},get top(){if(!r(e)){return e}let n=e;for(;;){if(!o(n,a)){return n}n=t(n,a)}},get parent(){if(!r(e)){return null}if(o(e,a)){const n=t(e,a);return n&&n.children&&n.children.length,n}if(o(e,l)){const n=t(e,l);return n&&n.children&&n.children.length,n}if(o(e,i)){const n=t(e,i);return n&&n.pages&&n.pages.length,n}return null},get zIndex(){return r(e)?e.parent.children.indexOf(e):-1}})).actions(e=>({toJSON:()=>Object.assign({},n(e))})).actions(e=>({clone(t={},{skipSelect:n=!1}={}){const o=JSON.parse(JSON.stringify(e.toJSON()));t.id=t.id||s(10);const r=new Map;return d(o,e=>{const t=e.id,n=s(10);r.set(t,n),e.id=n}),d(o,e=>{e.mergedInto&&r.has(e.mergedInto)&&(e.mergedInto=r.get(e.mergedInto))}),Object.assign(o,t),e.page.addElement(o,{skipSelect:n})},set(t){Object.assign(e,t)},moveUp(){var t;null===(t=e.parent)||void 0===t||t.moveElementsUp([e.id])},moveTop(){var t;null===(t=e.parent)||void 0===t||t.moveElementsTop([e.id])},moveDown(){var t;null===(t=e.parent)||void 0===t||t.moveElementsDown([e.id])},moveBottom(){var t;null===(t=e.parent)||void 0===t||t.moveElementsBottom([e.id])},setZIndex(t){e.parent.setElementZIndex(e.id,t)},beforeDestroy(){}}));
1
+ var e=this&&this.__rest||function(e,t){var o={};for(var n in e){Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++){t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}}return o};import{types as t,getParentOfType as o,getSnapshot as n,hasParentOfType as r,isAlive as s}from"mobx-state-tree";import{nanoid as i}from"nanoid";import{BLEND_MODES as l}from"@polotno/schema/defaults";import{Store as a}from"./store.js";import{Page as p}from"./page-model.js";import{GroupElement as d,forEveryNode as m}from"./group-model.js";export const Node=t.model("Node",{id:t.identifier,type:"none",name:"",opacity:1,blendMode:t.optional(t.enumeration([...l]),"normal"),custom:t.frozen(),visible:!0,selectable:!0,removable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{for(var t in e){null===e[t]&&(e[t]=void 0)}return e}).postProcessSnapshot(t=>{const{blendMode:o}=t,n=e(t,["blendMode"]);for(const e in n){"_"===e[0]&&delete n[e]}return o===("group"===n.type?"pass-through":"normal")?n:Object.assign(Object.assign({},n),{blendMode:o})}).views(e=>({get page(){return s(e)?o(e,p):null},get store(){return s(e)?o(e,a):null},get top(){if(!s(e)){return e}let t=e;for(;;){if(!r(t,d)){return t}t=o(t,d)}},get parent(){if(!s(e)){return null}if(r(e,d)){const t=o(e,d);return t&&t.children&&t.children.length,t}if(r(e,p)){const t=o(e,p);return t&&t.children&&t.children.length,t}if(r(e,a)){const t=o(e,a);return t&&t.pages&&t.pages.length,t}return null},get zIndex(){return s(e)?e.parent.children.indexOf(e):-1}})).actions(e=>({toJSON:()=>Object.assign({},n(e))})).actions(e=>({clone(t={},{skipSelect:o=!1}={}){const n=JSON.parse(JSON.stringify(e.toJSON()));t.id=t.id||i(10);const r=new Map;return m(n,e=>{const t=e.id,o=i(10);r.set(t,o),e.id=o}),m(n,e=>{e.mergedInto&&r.has(e.mergedInto)&&(e.mergedInto=r.get(e.mergedInto))}),Object.assign(n,t),e.page.addElement(n,{skipSelect:o})},set(t){Object.assign(e,t)},moveUp(){var t;null===(t=e.parent)||void 0===t||t.moveElementsUp([e.id])},moveTop(){var t;null===(t=e.parent)||void 0===t||t.moveElementsTop([e.id])},moveDown(){var t;null===(t=e.parent)||void 0===t||t.moveElementsDown([e.id])},moveBottom(){var t;null===(t=e.parent)||void 0===t||t.moveElementsBottom([e.id])},setZIndex(t){e.parent.setElementZIndex(e.id,t)},beforeDestroy(){}}));