kritzel-stencil 0.0.115 → 0.0.117

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 (109) hide show
  1. package/dist/cjs/{index-C2M4eyxF.js → index-aaWestcD.js} +177 -2
  2. package/dist/cjs/index-aaWestcD.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +3 -1
  4. package/dist/cjs/index.cjs.js.map +1 -1
  5. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js +110 -229
  6. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/stencil.cjs.js +1 -1
  9. package/dist/collection/classes/objects/base-object.class.js +3 -0
  10. package/dist/collection/classes/objects/base-object.class.js.map +1 -1
  11. package/dist/collection/classes/objects/path.class.js +2 -2
  12. package/dist/collection/classes/objects/path.class.js.map +1 -1
  13. package/dist/collection/classes/registries/icon-registry.class.js +18 -18
  14. package/dist/collection/classes/registries/icon-registry.class.js.map +1 -1
  15. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +123 -2
  16. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
  17. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +87 -25
  18. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
  19. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +1 -1
  20. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.css +1 -1
  21. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.css +3 -3
  22. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +3 -4
  23. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +6 -8
  24. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
  25. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +2 -2
  26. package/dist/collection/configs/default-engine-state.js +1 -0
  27. package/dist/collection/configs/default-engine-state.js.map +1 -1
  28. package/dist/collection/helpers/class.helper.js +6 -0
  29. package/dist/collection/helpers/class.helper.js.map +1 -0
  30. package/dist/collection/index.js +2 -0
  31. package/dist/collection/index.js.map +1 -1
  32. package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
  33. package/dist/collection/interfaces/object.interface.js.map +1 -1
  34. package/dist/components/index.js +2 -1
  35. package/dist/components/index.js.map +1 -1
  36. package/dist/components/kritzel-brush-style.js +1 -1
  37. package/dist/components/kritzel-context-menu.js +1 -1
  38. package/dist/components/kritzel-control-brush-config.js +1 -1
  39. package/dist/components/kritzel-control-text-config.js +1 -1
  40. package/dist/components/kritzel-controls.js +1 -1
  41. package/dist/components/kritzel-dropdown.js +1 -1
  42. package/dist/components/kritzel-editor.js +56 -17
  43. package/dist/components/kritzel-editor.js.map +1 -1
  44. package/dist/components/kritzel-engine.js +1 -1
  45. package/dist/components/kritzel-font-family.js +1 -1
  46. package/dist/components/kritzel-icon.js +1 -1
  47. package/dist/components/kritzel-tooltip.js +1 -1
  48. package/dist/components/kritzel-utility-panel.js +1 -1
  49. package/dist/components/{p-mz1ayKXG.js → p-93b-eQ0s.js} +17 -19
  50. package/dist/components/p-93b-eQ0s.js.map +1 -0
  51. package/dist/components/{p-DLV-5gE_.js → p-B8nuvSxt.js} +5 -5
  52. package/dist/components/{p-DLV-5gE_.js.map → p-B8nuvSxt.js.map} +1 -1
  53. package/dist/components/{p-C9ZagG9K.js → p-BBIuV3j1.js} +3 -3
  54. package/dist/components/{p-C9ZagG9K.js.map → p-BBIuV3j1.js.map} +1 -1
  55. package/dist/components/{p-BH1Tkwyh.js → p-BV9-NuyD.js} +4 -4
  56. package/dist/components/{p-BH1Tkwyh.js.map → p-BV9-NuyD.js.map} +1 -1
  57. package/dist/components/p-C6kzcN4b.js +90 -0
  58. package/dist/components/p-C6kzcN4b.js.map +1 -0
  59. package/dist/components/{p-CRiUM-tD.js → p-CYnE3twZ.js} +4 -4
  60. package/dist/components/p-CYnE3twZ.js.map +1 -0
  61. package/dist/components/{p-C9FTWNZY.js → p-CtNzxQ7T.js} +3 -3
  62. package/dist/components/p-CtNzxQ7T.js.map +1 -0
  63. package/dist/components/{p-BIlVkMTU.js → p-DRuQsvUx.js} +8 -5
  64. package/dist/components/p-DRuQsvUx.js.map +1 -0
  65. package/dist/components/{p-aZgXbW1r.js → p-DuWb7MaD.js} +80 -57
  66. package/dist/components/{p-aZgXbW1r.js.map → p-DuWb7MaD.js.map} +1 -1
  67. package/dist/components/{p-BtjtAfGW.js → p-JQA2FRVr.js} +5 -5
  68. package/dist/components/{p-BtjtAfGW.js.map → p-JQA2FRVr.js.map} +1 -1
  69. package/dist/components/{p-h3bqYufZ.js → p-LIijWPsT.js} +3 -3
  70. package/dist/components/p-LIijWPsT.js.map +1 -0
  71. package/dist/components/{p-B94Na1ee.js → p-eBBOf568.js} +4 -4
  72. package/dist/components/p-eBBOf568.js.map +1 -0
  73. package/dist/esm/{index-rckCSz7Y.js → index-Dn7aP72S.js} +176 -3
  74. package/dist/esm/index-Dn7aP72S.js.map +1 -0
  75. package/dist/esm/index.js +1 -1
  76. package/dist/esm/kritzel-brush-style_18.entry.js +103 -222
  77. package/dist/esm/kritzel-brush-style_18.entry.js.map +1 -1
  78. package/dist/esm/loader.js +1 -1
  79. package/dist/esm/stencil.js +1 -1
  80. package/dist/stencil/index.esm.js +1 -1
  81. package/dist/stencil/p-6c35ba88.entry.js +2 -0
  82. package/dist/stencil/p-6c35ba88.entry.js.map +1 -0
  83. package/dist/stencil/p-Dn7aP72S.js +2 -0
  84. package/dist/stencil/p-Dn7aP72S.js.map +1 -0
  85. package/dist/stencil/stencil.esm.js +1 -1
  86. package/dist/types/classes/objects/base-object.class.d.ts +1 -0
  87. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +10 -1
  88. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +3 -1
  89. package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +1 -2
  90. package/dist/types/components.d.ts +24 -4
  91. package/dist/types/helpers/class.helper.d.ts +3 -0
  92. package/dist/types/index.d.ts +2 -0
  93. package/dist/types/interfaces/engine-state.interface.d.ts +1 -0
  94. package/dist/types/interfaces/object.interface.d.ts +1 -0
  95. package/package.json +4 -7
  96. package/dist/cjs/index-C2M4eyxF.js.map +0 -1
  97. package/dist/components/p-B94Na1ee.js.map +0 -1
  98. package/dist/components/p-BIlVkMTU.js.map +0 -1
  99. package/dist/components/p-C9FTWNZY.js.map +0 -1
  100. package/dist/components/p-CRiUM-tD.js.map +0 -1
  101. package/dist/components/p-h3bqYufZ.js.map +0 -1
  102. package/dist/components/p-ksTCzgsY.js +0 -90
  103. package/dist/components/p-ksTCzgsY.js.map +0 -1
  104. package/dist/components/p-mz1ayKXG.js.map +0 -1
  105. package/dist/esm/index-rckCSz7Y.js.map +0 -1
  106. package/dist/stencil/p-9394d74e.entry.js +0 -2
  107. package/dist/stencil/p-9394d74e.entry.js.map +0 -1
  108. package/dist/stencil/p-rckCSz7Y.js +0 -2
  109. package/dist/stencil/p-rckCSz7Y.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-CXT94beA.js');
4
- var index$1 = require('./index-C2M4eyxF.js');
4
+ var index$1 = require('./index-aaWestcD.js');
5
5
 
6
6
  const kritzelBrushStyleCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box;width:100%}.brush-style-button{display:flex;justify-content:center;align-items:center;width:42px;height:32px;padding:0;border:none;outline:none;background:none;cursor:default;border-radius:0;color:var(--control-text-color);font-weight:bold;-webkit-tap-highlight-color:transparent}.font-style-button:not(:last-child){border-right:1px solid #333333}.font-style-button:hover{background-color:var(--control-hover-bg)}.font-style-button:active{background-color:var(--control-active-bg)}.font-style-button.selected,.font-style-button.selected:hover,.font-style-button.selected:active{background-color:var(--control-selected-bg);color:var(--control-selected-color)}";
7
7
 
@@ -122,7 +122,7 @@ const KritzelColorPalette = class {
122
122
  };
123
123
  KritzelColorPalette.style = kritzelColorPaletteCss;
124
124
 
125
- const kritzelContextMenuCss = ":host{display:block}.menu-container{display:flex;flex-direction:column;background-color:var(--kritzel-context-menu-background-color, #ffffff);border-radius:var(--kritzel-context-menu-border-radius, 8px);box-shadow:var(--kritzel-context-menu-box-shadow, 0 1px 6px rgba(0, 0, 0, 0.12));border:var(--kritzel-context-menu-border, 1px solid hsl(0, 0%, 0%, 4.3%));padding:var(--kritzel-context-menu-padding,4px)}.menu-item{display:flex;align-items:center;gap:var(--kritzel-context-menu-item-gap, 8px);background:none;border:none;text-align:left;padding:var(--kritzel-context-menu-item-padding, 8px);border-radius:var(--kritzel-context-menu-item-border-radius, 8px);cursor:pointer;font-size:var(--kritzel-context-menu-item-font-size, 14px);color:var(--kritzel-context-menu-item-color, #333333);white-space:nowrap;-webkit-tap-highlight-color:transparent}.menu-item:not(.disabled):hover{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.menu-item:not(.disabled):active{background-color:var(--kritzel-context-menu-item-active-background-color, hsl(0, 0%, 0%, 8.6%))}.menu-item.disabled{color:var(--kritzel-context-menu-item-disabled-color, #aaaaaa);cursor:default}.menu-item kritzel-icon{opacity:0.8;flex-shrink:0}.menu-item.disabled kritzel-icon{opacity:0.4}.label{flex-grow:1}";
125
+ const kritzelContextMenuCss = ":host{display:block}.menu-container{display:flex;flex-direction:column;background-color:var(--kritzel-context-menu-background-color, #ffffff);border-radius:var(--kritzel-context-menu-border-radius, 12px);box-shadow:var(--kritzel-context-menu-box-shadow, 0 1px 6px rgba(0, 0, 0, 0.12));border:var(--kritzel-context-menu-border, 1px solid #f0f0f0);padding:var(--kritzel-context-menu-padding,4px)}.menu-item{display:flex;align-items:center;gap:var(--kritzel-context-menu-item-gap, 8px);background:none;border:none;text-align:left;padding:var(--kritzel-context-menu-item-padding, 8px);border-radius:var(--kritzel-context-menu-item-border-radius, 12px);cursor:pointer;font-size:var(--kritzel-context-menu-item-font-size, 14px);color:var(--kritzel-context-menu-item-color, #333333);white-space:nowrap;-webkit-tap-highlight-color:transparent}.menu-item:not(.disabled):hover{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.menu-item:not(.disabled):active{background-color:var(--kritzel-context-menu-item-active-background-color, hsl(0, 0%, 0%, 8.6%))}.menu-item.disabled{color:var(--kritzel-context-menu-item-disabled-color, #aaaaaa);cursor:default}.menu-item kritzel-icon{opacity:0.8;flex-shrink:0}.menu-item.disabled kritzel-icon{opacity:0.4}.label{flex-grow:1}";
126
126
 
127
127
  const KritzelContextMenu = class {
128
128
  constructor(hostRef) {
@@ -226,145 +226,6 @@ const KritzelControlTextConfig = class {
226
226
  };
227
227
  KritzelControlTextConfig.style = kritzelControlTextConfigCss;
228
228
 
229
- var cjs = {};
230
-
231
- var hasRequiredCjs;
232
-
233
- function requireCjs () {
234
- if (hasRequiredCjs) return cjs;
235
- hasRequiredCjs = 1;
236
- (function (exports) {
237
- var pe=Object.defineProperty;var ge=e=>pe(e,"__esModule",{value:true});var de=(e,t)=>{ge(e);for(var s in t)pe(e,s,{get:t[s],enumerable:true});};de(exports,{default:()=>ve,getStroke:()=>ne,getStrokeOutlinePoints:()=>te,getStrokePoints:()=>re});function $(e,t,s,x=h=>h){return e*x(.5-t*(.5-s))}function ce(e){return [-e[0],-e[1]]}function l(e,t){return [e[0]+t[0],e[1]+t[1]]}function a(e,t){return [e[0]-t[0],e[1]-t[1]]}function b(e,t){return [e[0]*t,e[1]*t]}function xe(e,t){return [e[0]/t,e[1]/t]}function R(e){return [e[1],-e[0]]}function B(e,t){return e[0]*t[0]+e[1]*t[1]}function me(e,t){return e[0]===t[0]&&e[1]===t[1]}function Se(e){return Math.hypot(e[0],e[1])}function Pe(e){return e[0]*e[0]+e[1]*e[1]}function A(e,t){return Pe(a(e,t))}function G(e){return xe(e,Se(e))}function ae(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function L(e,t,s){let x=Math.sin(s),h=Math.cos(s),y=e[0]-t[0],n=e[1]-t[1],f=y*h-n*x,d=y*x+n*h;return [f+t[0],d+t[1]]}function K(e,t,s){return l(e,b(a(t,e),s))}function ee(e,t,s){return l(e,b(t,s))}var{min:C,PI:ke}=Math,le=.275,V=ke+1e-4;function te(e,t={}){let{size:s=16,smoothing:x=.5,thinning:h=.5,simulatePressure:y=true,easing:n=r=>r,start:f={},end:d={},last:D=false}=t,{cap:S=true,easing:j=r=>r*(2-r)}=f,{cap:q=true,easing:c=r=>--r*r*r+1}=d;if(e.length===0||s<=0)return [];let p=e[e.length-1].runningLength,g=f.taper===false?0:f.taper===true?Math.max(s,p):f.taper,T=d.taper===false?0:d.taper===true?Math.max(s,p):d.taper,oe=Math.pow(s*x,2),_=[],M=[],H=e.slice(0,10).reduce((r,i)=>{let o=i.pressure;if(y){let u=C(1,i.distance/s),W=C(1,1-u);o=C(1,r+(W-r)*(u*le));}return (r+o)/2},e[0].pressure),m=$(s,h,e[e.length-1].pressure,n),U,X=e[0].vector,z=e[0].point,F=z,O=z,E=F,J=false;for(let r=0;r<e.length;r++){let{pressure:i}=e[r],{point:o,vector:u,distance:W,runningLength:I}=e[r];if(r<e.length-1&&p-I<3)continue;if(h){if(y){let v=C(1,W/s),Z=C(1,1-v);i=C(1,H+(Z-H)*(v*le));}m=$(s,h,i,n);}else m=s/2;U===void 0&&(U=m);let fe=I<g?j(I/g):1,be=p-I<T?c((p-I)/T):1;m=Math.max(.01,m*Math.min(fe,be));let se=(r<e.length-1?e[r+1]:e[r]).vector,Y=r<e.length-1?B(u,se):1,he=B(u,X)<0&&!J,ue=Y!==null&&Y<0;if(he||ue){let v=b(R(X),m);for(let Z=1/13,w=0;w<=1;w+=Z)O=L(a(o,v),o,V*w),_.push(O),E=L(l(o,v),o,V*-w),M.push(E);z=O,F=E,ue&&(J=true);continue}if(J=false,r===e.length-1){let v=b(R(u),m);_.push(a(o,v)),M.push(l(o,v));continue}let ie=b(R(K(se,u,Y)),m);O=a(o,ie),(r<=1||A(z,O)>oe)&&(_.push(O),z=O),E=l(o,ie),(r<=1||A(F,E)>oe)&&(M.push(E),F=E),H=i,X=u;}let P=e[0].point.slice(0,2),k=e.length>1?e[e.length-1].point.slice(0,2):l(e[0].point,[1,1]),Q=[],N=[];if(e.length===1){if(!(g||T)||D){let r=ee(P,G(R(a(P,k))),-(U||m)),i=[];for(let o=1/13,u=o;u<=1;u+=o)i.push(L(r,P,V*2*u));return i}}else {if(!(g||T&&e.length===1))if(S)for(let i=1/13,o=i;o<=1;o+=i){let u=L(M[0],P,V*o);Q.push(u);}else {let i=a(_[0],M[0]),o=b(i,.5),u=b(i,.51);Q.push(a(P,o),a(P,u),l(P,u),l(P,o));}let r=R(ce(e[e.length-1].vector));if(T||g&&e.length===1)N.push(k);else if(q){let i=ee(k,r,m);for(let o=1/29,u=o;u<1;u+=o)N.push(L(i,k,V*3*u));}else N.push(l(k,b(r,m)),l(k,b(r,m*.99)),a(k,b(r,m*.99)),a(k,b(r,m)));}return _.concat(N,M.reverse(),Q)}function re(e,t={}){var q;let{streamline:s=.5,size:x=16,last:h=false}=t;if(e.length===0)return [];let y=.15+(1-s)*.85,n=Array.isArray(e[0])?e:e.map(({x:c,y:p,pressure:g=.5})=>[c,p,g]);if(n.length===2){let c=n[1];n=n.slice(0,-1);for(let p=1;p<5;p++)n.push(K(n[0],c,p/4));}n.length===1&&(n=[...n,[...l(n[0],[1,1]),...n[0].slice(2)]]);let f=[{point:[n[0][0],n[0][1]],pressure:n[0][2]>=0?n[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],d=false,D=0,S=f[0],j=n.length-1;for(let c=1;c<n.length;c++){let p=h&&c===j?n[c].slice(0,2):K(S.point,n[c],y);if(me(S.point,p))continue;let g=ae(p,S.point);if(D+=g,c<j&&!d){if(D<x)continue;d=true;}S={point:p,pressure:n[c][2]>=0?n[c][2]:.5,vector:G(a(S.point,p)),distance:g,runningLength:D},f.push(S);}return f[0].vector=((q=f[1])==null?void 0:q.vector)||[0,0],f}function ne(e,t={}){return te(re(e,t),t)}var ve=ne;
238
- } (cjs));
239
- return cjs;
240
- }
241
-
242
- var cjsExports = requireCjs();
243
-
244
- class KritzelMathHelper {
245
- static average(a, b) {
246
- return (a + b) / 2;
247
- }
248
- }
249
-
250
- class KritzelPath extends index$1.KritzelBaseObject {
251
- constructor() {
252
- super(...arguments);
253
- this.__class__ = 'KritzelPath';
254
- this.stroke = 'none';
255
- this.lineSlack = 0.5;
256
- this.x = 0;
257
- this.y = 0;
258
- this.height = 0;
259
- this.width = 0;
260
- this.scale = 1;
261
- this.visible = true;
262
- this.debugInfoVisible = true;
263
- }
264
- get viewBox() {
265
- return `${this.x} ${this.y} ${this.width} ${this.height}`;
266
- }
267
- static create(store, options) {
268
- var _a, _b, _c, _d, _e, _f;
269
- const object = new KritzelPath();
270
- object._store = store;
271
- object.id = object.generateId();
272
- object.options = options;
273
- object.points = (_a = options === null || options === void 0 ? void 0 : options.points) !== null && _a !== void 0 ? _a : [];
274
- object.translateX = (_b = options === null || options === void 0 ? void 0 : options.translateX) !== null && _b !== void 0 ? _b : 0;
275
- object.translateY = (_c = options === null || options === void 0 ? void 0 : options.translateY) !== null && _c !== void 0 ? _c : 0;
276
- object.scale = (_d = options === null || options === void 0 ? void 0 : options.scale) !== null && _d !== void 0 ? _d : 1;
277
- object.strokeWidth = (_e = options === null || options === void 0 ? void 0 : options.strokeWidth) !== null && _e !== void 0 ? _e : 8;
278
- object.fill = (_f = options === null || options === void 0 ? void 0 : options.fill) !== null && _f !== void 0 ? _f : '#000000';
279
- object.zIndex = store.currentZIndex;
280
- object.d = object.generateSvgPath();
281
- object.updateDimensions();
282
- return object;
283
- }
284
- resize(x, y, width, height) {
285
- if (width <= 1 || height <= 1) {
286
- return;
287
- }
288
- const scaleX = width / this.width;
289
- const scaleY = height / this.height;
290
- this.width = width;
291
- this.height = height;
292
- this.points = this.points.map(([x, y]) => [x * scaleX, y * scaleY]);
293
- this.d = this.generateSvgPath();
294
- this.width = Math.max(...this.points.map(p => p[0])) - Math.min(...this.points.map(p => p[0])) + this.strokeWidth;
295
- this.height = Math.max(...this.points.map(p => p[1])) - Math.min(...this.points.map(p => p[1])) + this.strokeWidth;
296
- this.x = Math.min(...this.points.map(p => p[0])) - this.strokeWidth / 2;
297
- this.y = Math.min(...this.points.map(p => p[1])) - this.strokeWidth / 2;
298
- this.translateX = x;
299
- this.translateY = y;
300
- }
301
- rotate(value) {
302
- super.rotate(value);
303
- this.updateDimensions();
304
- }
305
- updateDimensions() {
306
- const rotatedPoints = this.points.map(([x, y]) => {
307
- const rotatedX = x * Math.cos(this.rotation) - y * Math.sin(this.rotation);
308
- const rotatedY = x * Math.sin(this.rotation) + y * Math.cos(this.rotation);
309
- return [rotatedX, rotatedY];
310
- });
311
- const minX = Math.min(...rotatedPoints.map(p => p[0] - this.strokeWidth / 2));
312
- const minY = Math.min(...rotatedPoints.map(p => p[1] - this.strokeWidth / 2));
313
- const maxX = Math.max(...rotatedPoints.map(p => p[0] + this.strokeWidth / 2));
314
- const maxY = Math.max(...rotatedPoints.map(p => p[1] + this.strokeWidth / 2));
315
- this.width = maxX - minX + this.lineSlack; // Add 0.5 to avoid rounding issues
316
- this.height = maxY - minY + this.lineSlack; // Add 0.5 to avoid rounding issues
317
- this.x = minX;
318
- this.y = minY;
319
- this.translateX = (this.x + this.translateX) / this.scale;
320
- this.translateY = (this.y + this.translateY) / this.scale;
321
- }
322
- generateSvgPath() {
323
- const stroke = this.getStrokeFromPoints(this.points, this.strokeWidth);
324
- return this.getSvgPathFromStroke(stroke);
325
- }
326
- getStrokeFromPoints(points, strokeWidth) {
327
- return cjsExports.getStroke(points, {
328
- size: strokeWidth,
329
- thinning: 0.5,
330
- smoothing: 0.5,
331
- streamline: 0.5,
332
- easing: t => t,
333
- simulatePressure: true,
334
- last: true,
335
- start: {
336
- cap: true,
337
- taper: 0,
338
- easing: t => t,
339
- },
340
- end: {
341
- cap: true,
342
- taper: 0,
343
- easing: t => t,
344
- },
345
- });
346
- }
347
- getSvgPathFromStroke(points, closed = true) {
348
- const len = points.length;
349
- if (len < 4) {
350
- return ``;
351
- }
352
- let a = points[0];
353
- let b = points[1];
354
- const c = points[2];
355
- let result = `M${a[0].toFixed(2)},${a[1].toFixed(2)} Q${b[0].toFixed(2)},${b[1].toFixed(2)} ${KritzelMathHelper.average(b[0], c[0]).toFixed(2)},${KritzelMathHelper.average(b[1], c[1]).toFixed(2)} T`;
356
- for (let i = 2, max = len - 1; i < max; i++) {
357
- a = points[i];
358
- b = points[i + 1];
359
- result += `${KritzelMathHelper.average(a[0], b[0]).toFixed(2)},${KritzelMathHelper.average(a[1], b[1]).toFixed(2)} `;
360
- }
361
- if (closed) {
362
- result += 'Z';
363
- }
364
- return result;
365
- }
366
- }
367
-
368
229
  class KritzelBrushTool extends index$1.KritzelBaseTool {
369
230
  constructor(store) {
370
231
  super(store);
@@ -385,7 +246,7 @@ class KritzelBrushTool extends index$1.KritzelBaseTool {
385
246
  this._store.state.isDrawing = true;
386
247
  const x = event.clientX - this._store.offsetX;
387
248
  const y = event.clientY - this._store.offsetY;
388
- this._store.state.currentPath = KritzelPath.create(this._store, {
249
+ this._store.state.currentPath = index$1.KritzelPath.create(this._store, {
389
250
  points: [[x, y]],
390
251
  translateX: -this._store.state.translateX,
391
252
  translateY: -this._store.state.translateY,
@@ -401,7 +262,7 @@ class KritzelBrushTool extends index$1.KritzelBaseTool {
401
262
  const x = Math.round(activePointers[0].clientX - this._store.offsetX);
402
263
  const y = Math.round(activePointers[0].clientY - this._store.offsetY);
403
264
  this._store.state.isDrawing = true;
404
- this._store.state.currentPath = KritzelPath.create(this._store, {
265
+ this._store.state.currentPath = index$1.KritzelPath.create(this._store, {
405
266
  points: [[x, y]],
406
267
  translateX: -this._store.state.translateX,
407
268
  translateY: -this._store.state.translateY,
@@ -421,7 +282,7 @@ class KritzelBrushTool extends index$1.KritzelBaseTool {
421
282
  if (this._store.state.isDrawing) {
422
283
  const x = event.clientX - this._store.offsetX;
423
284
  const y = event.clientY - this._store.offsetY;
424
- this._store.state.currentPath = KritzelPath.create(this._store, {
285
+ this._store.state.currentPath = index$1.KritzelPath.create(this._store, {
425
286
  points: [...this._store.state.currentPath.points, [x, y]],
426
287
  translateX: -this._store.state.translateX,
427
288
  translateY: -this._store.state.translateY,
@@ -437,7 +298,7 @@ class KritzelBrushTool extends index$1.KritzelBaseTool {
437
298
  if (activePointers.length === 1) {
438
299
  const x = Math.round(activePointers[0].clientX - this._store.offsetX);
439
300
  const y = Math.round(activePointers[0].clientY - this._store.offsetY);
440
- this._store.state.currentPath = KritzelPath.create(this._store, {
301
+ this._store.state.currentPath = index$1.KritzelPath.create(this._store, {
441
302
  points: [...this._store.state.currentPath.points, [x, y]],
442
303
  translateX: -this._store.state.translateX,
443
304
  translateY: -this._store.state.translateY,
@@ -483,12 +344,12 @@ class KritzelDevicesHelper {
483
344
  }
484
345
  }
485
346
 
486
- const kritzelControlsCss = ":host{display:flex;flex-direction:column;user-select:none}.kritzel-controls{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--kritzel-controls-gap, 8px);height:100%;padding:var(--kritzel-controls-padding, 8px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 8px);box-shadow:var(--kritzel-controls-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-controls-border, 1px solid hsl(0, 0%, 0%, 4.3%));border-radius:var(--kritzel-controls-border-radius, 8px);z-index:10000;position:relative}.kritzel-control{display:flex;justify-content:center;align-items:center;color:var(--kritzel-controls-control-color, #000000);border-radius:var(--kritzel-controls-control-border-radius, 8px);padding:var(--kritzel-controls-control-padding, 8px);border:none;outline:none;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;font-weight:bold}.kritzel-control:hover{background-color:var(--kritzel-controls-control-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.mobile) .kritzel-control:hover{background-color:unset}.kritzel-control:active{background-color:var(--kritzel-controls-control-active-background-color, hsl(0, 0%, 0%, 8.6%))}:host(.mobile) .kritzel-control:active{background-color:unset}.kritzel-control.selected,.kritzel-control.selected:hover,.kritzel-control.selected:active{background-color:var(--kritzel-controls-control-selected-background-color, #0E1111) !important;color:var(--kritzel-controls-control-selected-color, #ffffff) !important}.kritzel-divider{width:var(--kritzel-controls-divider-width, 1px);height:var(--kritzel-controls-divider-height, 24px);background-color:var(--kritzel-controls-divider-background-color, hsl(0, 0%, 0%, 4.3%))}.kritzel-config-container{position:relative;display:flex;justify-content:center;align-items:center;width:40px;height:40px;box-sizing:border-box;-webkit-tap-highlight-color:transparent}.kritzel-config{display:flex;justify-content:center;align-items:center;cursor:pointer}.color-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box;background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.font-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box;background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.no-config{height:24px;width:24px;border-radius:50%;border:1px dashed gray}kritzel-tooltip{position:fixed;bottom:66px;left:50%;transform:translateX(-50%);z-index:10001}";
347
+ const kritzelControlsCss = ":host{display:flex;flex-direction:column;user-select:none}.kritzel-controls{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--kritzel-controls-gap, 8px);height:100%;padding:var(--kritzel-controls-padding, 8px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 16px);box-shadow:var(--kritzel-controls-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-controls-border, 1px solid #f0f0f0);z-index:10000;position:relative}.kritzel-control{display:flex;justify-content:center;align-items:center;color:var(--kritzel-controls-control-color, #000000);border-radius:var(--kritzel-controls-control-border-radius, 12px);padding:var(--kritzel-controls-control-padding, 8px);border:none;outline:none;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;font-weight:bold}.kritzel-control:hover{background-color:var(--kritzel-controls-control-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.mobile) .kritzel-control:hover{background-color:unset}.kritzel-control:active{background-color:var(--kritzel-controls-control-active-background-color, hsl(0, 0%, 0%, 8.6%))}:host(.mobile) .kritzel-control:active{background-color:unset}.kritzel-control.selected,.kritzel-control.selected:hover,.kritzel-control.selected:active{background-color:var(--kritzel-controls-control-selected-background-color, #0E1111) !important;color:var(--kritzel-controls-control-selected-color, #ffffff) !important}.kritzel-divider{width:var(--kritzel-controls-divider-width, 1px);height:var(--kritzel-controls-divider-height, 24px);background-color:var(--kritzel-controls-divider-background-color, hsl(0, 0%, 0%, 4.3%))}.kritzel-config-container{position:relative;display:flex;justify-content:center;align-items:center;width:40px;height:40px;box-sizing:border-box;-webkit-tap-highlight-color:transparent}.kritzel-config{display:flex;justify-content:center;align-items:center;cursor:pointer}.color-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box;background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.font-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box;background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.no-config{height:24px;width:24px;border-radius:50%;border:1px dashed gray}kritzel-tooltip{position:fixed;bottom:66px;left:50%;transform:translateX(-50%);z-index:10001}";
487
348
 
488
349
  const KritzelControls = class {
489
350
  constructor(hostRef) {
490
351
  index.registerInstance(this, hostRef);
491
- this.controlsReady = index.createEvent(this, "controlsReady");
352
+ this.isControlsReady = index.createEvent(this, "isControlsReady");
492
353
  this.controls = [];
493
354
  this.activeControl = null;
494
355
  this.firstConfig = null;
@@ -525,9 +386,7 @@ const KritzelControls = class {
525
386
  async componentWillLoad() {
526
387
  await this.initializeEngine();
527
388
  await this.initializeTools();
528
- }
529
- componentDidLoad() {
530
- this.controlsReady.emit();
389
+ this.isControlsReady.emit();
531
390
  }
532
391
  async initializeEngine() {
533
392
  await customElements.whenDefined('kritzel-engine');
@@ -573,13 +432,13 @@ const KritzelControls = class {
573
432
  render() {
574
433
  var _a, _b;
575
434
  const hasNoConfig = ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.config) === undefined || ((_b = this.activeControl) === null || _b === void 0 ? void 0 : _b.config) === null;
576
- return (index.h(index.Host, { key: 'c20b7cbc7228f1b13a7e17f7ea94c96151e11608', class: {
435
+ return (index.h(index.Host, { key: 'fecdf68cef50c38670d8117cd4da92b572c940a5', class: {
577
436
  mobile: this.isTouchDevice,
578
- } }, index.h("kritzel-utility-panel", { key: '0e56c27c57d5cd7302ec80f6809fe4673afddae5', style: {
437
+ } }, index.h("kritzel-utility-panel", { key: '82c6af0d540137a2c24aac659f41e24b783b6555', style: {
579
438
  position: 'absolute',
580
439
  bottom: '56px',
581
440
  left: '12px',
582
- }, onUndo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.undo(); }, onRedo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.redo(); }, onDelete: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.delete(); } }), index.h("div", { key: '6454509e3c524a42345e383270e3c1220f87dab6', class: "kritzel-controls" }, this.controls.map(control => {
441
+ }, onUndo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.undo(); }, onRedo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.redo(); }, onDelete: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.delete(); } }), index.h("div", { key: 'a59d0611b6cd88779b7b72970a0fda50c7808686', class: "kritzel-controls" }, this.controls.map(control => {
583
442
  var _a, _b, _c, _d, _e, _f, _g, _h;
584
443
  if (control.type === 'tool') {
585
444
  return (index.h("button", { class: {
@@ -695,7 +554,7 @@ const KritzelCursorTrail = class {
695
554
  };
696
555
  KritzelCursorTrail.style = kritzelCursorTrailCss;
697
556
 
698
- const kritzelDropdownCss = ":host{display:inline-flex;vertical-align:middle;width:100%;}.dropdown-wrapper{display:flex;align-items:center;border:1px solid #333333;border-radius:var(--kritzel-controls-control-border-radius, 8px);overflow:hidden;height:32px;width:100%}.custom-select{padding:0 8px;padding-right:30px;height:100%;width:100%;box-sizing:border-box;border-radius:0;border:none;background-color:#fff;cursor:pointer;outline:none;font-size:inherit;color:var(--kritzel-controls-text-color, #333333);-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"%23333333\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 9 12 15 18 9\"/></svg>');background-size:16px 16px;background-repeat:no-repeat;background-position:right 8px center}.custom-select.has-suffix-border{border-right:1px solid #333333}.custom-select.has-prefix-border{border-left:1px solid #333333}::slotted(*){height:100%;box-sizing:border-box}";
557
+ const kritzelDropdownCss = ":host{display:inline-flex;vertical-align:middle;width:100%;}.dropdown-wrapper{display:flex;align-items:center;border:1px solid #333333;border-radius:var(--kritzel-controls-control-border-radius, 12px);overflow:hidden;height:32px;width:100%}.custom-select{padding:0 8px;padding-right:30px;height:100%;width:100%;box-sizing:border-box;border-radius:0;border:none;background-color:#fff;cursor:pointer;outline:none;font-size:inherit;color:var(--kritzel-controls-text-color, #333333);-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"%23333333\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 9 12 15 18 9\"/></svg>');background-size:16px 16px;background-repeat:no-repeat;background-position:right 8px center}.custom-select.has-suffix-border{border-right:1px solid #333333}.custom-select.has-prefix-border{border-left:1px solid #333333}::slotted(*){height:100%;box-sizing:border-box}";
699
558
 
700
559
  const KritzelDropdown = class {
701
560
  constructor(hostRef) {
@@ -808,24 +667,24 @@ class KritzelIconRegistry {
808
667
  }
809
668
  KritzelIconRegistry.registry = new Map();
810
669
  KritzelIconRegistry.registerIcons({
811
- 'cursor': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>',
812
- 'pen': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/></svg>',
813
- 'highlighter': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-highlighter-icon lucide-highlighter"><path d="m9 11-6 6v3h9l3-3"/><path d="m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"/></svg>',
814
- 'eraser': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg>',
815
- 'type': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 7 4 4 20 4 20 7"/><line x1="9" x2="15" y1="20" y2="20"/><line x1="12" x2="12" y1="4" y2="20"/></svg>',
816
- 'image': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
817
- 'chevron-down': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>',
818
- 'chevron-up': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m18 15-6-6-6 6"/></svg>',
819
- 'copy': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy-icon lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',
820
- 'paste': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard-paste-icon lucide-clipboard-paste"><path d="M11 14h10"/><path d="M16 4h2a2 2 0 0 1 2 2v1.344"/><path d="m17 18 4-4-4-4"/><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113"/><rect x="8" y="2" width="8" height="4" rx="1"/></svg>',
821
- 'cut': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-scissors-icon lucide-scissors"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>',
822
- 'delete': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash2-icon lucide-trash-2"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg>',
823
- 'bring-to-front': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-to-line-icon lucide-arrow-up-to-line"><path d="M5 3h14"/><path d="m18 13-6-6-6 6"/><path d="M12 7v14"/></svg>',
824
- 'send-to-back': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-to-line-icon lucide-arrow-down-to-line"><path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/></svg>',
825
- 'select-all': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-mouse-pointer-icon lucide-square-mouse-pointer"><path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"/><path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"/></svg>',
826
- 'download': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download-icon lucide-download"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>',
827
- 'undo': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-undo-icon lucide-undo"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>',
828
- 'redo': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-redo-icon lucide-redo"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>'
670
+ 'cursor': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>',
671
+ 'pen': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/></svg>',
672
+ 'highlighter': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-highlighter-icon lucide-highlighter"><path d="m9 11-6 6v3h9l3-3"/><path d="m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"/></svg>',
673
+ 'eraser': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg>',
674
+ 'type': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 7 4 4 20 4 20 7"/><line x1="9" x2="15" y1="20" y2="20"/><line x1="12" x2="12" y1="4" y2="20"/></svg>',
675
+ 'image': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
676
+ 'chevron-down': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>',
677
+ 'chevron-up': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m18 15-6-6-6 6"/></svg>',
678
+ 'copy': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy-icon lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',
679
+ 'paste': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard-paste-icon lucide-clipboard-paste"><path d="M11 14h10"/><path d="M16 4h2a2 2 0 0 1 2 2v1.344"/><path d="m17 18 4-4-4-4"/><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113"/><rect x="8" y="2" width="8" height="4" rx="1"/></svg>',
680
+ 'cut': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-scissors-icon lucide-scissors"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>',
681
+ 'delete': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash2-icon lucide-trash-2"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg>',
682
+ 'bring-to-front': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-to-line-icon lucide-arrow-up-to-line"><path d="M5 3h14"/><path d="m18 13-6-6-6 6"/><path d="M12 7v14"/></svg>',
683
+ 'send-to-back': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-to-line-icon lucide-arrow-down-to-line"><path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/></svg>',
684
+ 'select-all': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-mouse-pointer-icon lucide-square-mouse-pointer"><path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"/><path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"/></svg>',
685
+ 'download': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download-icon lucide-download"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>',
686
+ 'undo': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-undo-icon lucide-undo"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>',
687
+ 'redo': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-redo-icon lucide-redo"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>'
829
688
  });
830
689
 
831
690
  class BatchCommand extends index$1.KritzelBaseCommand {
@@ -933,37 +792,6 @@ class KritzelEraserTool extends index$1.KritzelBaseTool {
933
792
  }
934
793
  }
935
794
 
936
- class KritzelImage extends index$1.KritzelBaseObject {
937
- constructor() {
938
- super(...arguments);
939
- this.__class__ = 'KritzelImage';
940
- this.src = '';
941
- this.debugInfoVisible = true;
942
- }
943
- static create(store) {
944
- const object = new KritzelImage();
945
- object._store = store;
946
- object.id = object.generateId();
947
- object.x = 0;
948
- object.y = 0;
949
- object.translateX = 0;
950
- object.translateY = 0;
951
- object.scale = object._store.state.scale;
952
- object.zIndex = store.currentZIndex;
953
- return object;
954
- }
955
- resize(x, y, width, height) {
956
- if (width <= 1 || height <= 1) {
957
- return;
958
- }
959
- const scaleFactor = height / this.height;
960
- this.width = this.width * scaleFactor;
961
- this.height = this.height * scaleFactor;
962
- this.translateX = x;
963
- this.translateY = y;
964
- }
965
- }
966
-
967
795
  class RemoveSelectionGroupCommand extends index$1.KritzelBaseCommand {
968
796
  constructor(store, initiator) {
969
797
  super(store, initiator);
@@ -1841,13 +1669,13 @@ class KritzelReviver {
1841
1669
  let revivedObj;
1842
1670
  switch (obj.__class__) {
1843
1671
  case 'KritzelPath':
1844
- revivedObj = KritzelPath.create(this._store).revive(obj);
1672
+ revivedObj = index$1.KritzelPath.create(this._store).revive(obj);
1845
1673
  break;
1846
1674
  case 'KritzelText':
1847
1675
  revivedObj = index$1.KritzelText.create(this._store, obj.fontSize, obj.fontFamily).revive(obj);
1848
1676
  break;
1849
1677
  case 'KritzelImage':
1850
- revivedObj = KritzelImage.create(this._store).revive(obj);
1678
+ revivedObj = index$1.KritzelImage.create(this._store).revive(obj);
1851
1679
  break;
1852
1680
  case 'KritzelSelectionGroup':
1853
1681
  revivedObj = KritzelSelectionGroup.create(this._store).revive(obj);
@@ -2125,7 +1953,7 @@ class KritzelImageTool extends index$1.KritzelBaseTool {
2125
1953
  return { scaledWidth, scaledHeight };
2126
1954
  }
2127
1955
  createKritzelImage(img, width, height) {
2128
- const image = KritzelImage.create(this._store);
1956
+ const image = index$1.KritzelImage.create(this._store);
2129
1957
  image.src = img.src;
2130
1958
  image.width = width;
2131
1959
  image.height = height;
@@ -2286,9 +2114,22 @@ const kritzelEditorCss = "kritzel-editor{display:flex;margin:0;position:relative
2286
2114
  const KritzelEditor = class {
2287
2115
  constructor(hostRef) {
2288
2116
  index.registerInstance(this, hostRef);
2117
+ this.isReady = index.createEvent(this, "isReady");
2289
2118
  this.controls = DEFAULT_KRITZEL_CONTROLS;
2290
2119
  this.customSvgIcons = {};
2291
2120
  this.hideControls = false;
2121
+ this.isEngineReady = false;
2122
+ this.isControlsReady = false;
2123
+ }
2124
+ onIsEngineReady(newValue) {
2125
+ if (newValue && this.isControlsReady) {
2126
+ this.checkIsReady();
2127
+ }
2128
+ }
2129
+ onIsControlsReady(newValue) {
2130
+ if (newValue && this.isEngineReady) {
2131
+ this.checkIsReady();
2132
+ }
2292
2133
  }
2293
2134
  async getObjectById(id) {
2294
2135
  return this.engineRef.getObjectById(id);
@@ -2302,6 +2143,9 @@ const KritzelEditor = class {
2302
2143
  async removeObject(object) {
2303
2144
  return this.engineRef.removeObject(object);
2304
2145
  }
2146
+ async getSelectedObjects() {
2147
+ return this.engineRef.getSelectedObjects();
2148
+ }
2305
2149
  async selectObjects(objects) {
2306
2150
  return this.engineRef.selectObjects(objects);
2307
2151
  }
@@ -2311,6 +2155,9 @@ const KritzelEditor = class {
2311
2155
  async clearSelection() {
2312
2156
  this.engineRef.clearSelection();
2313
2157
  }
2158
+ async centerObjectInViewport(object) {
2159
+ return this.engineRef.centerObjectInViewport(object);
2160
+ }
2314
2161
  handleTouchStart(event) {
2315
2162
  if (event.cancelable) {
2316
2163
  event.preventDefault();
@@ -2323,18 +2170,31 @@ const KritzelEditor = class {
2323
2170
  (_a = this.controlsRef) === null || _a === void 0 ? void 0 : _a.closeTooltip();
2324
2171
  }
2325
2172
  }
2326
- componentWillLoad() {
2173
+ componentDidLoad() {
2327
2174
  this.registerCustomSvgIcons();
2328
2175
  }
2176
+ async checkIsReady() {
2177
+ await customElements.whenDefined('kritzel-editor');
2178
+ await customElements.whenDefined('kritzel-controls');
2179
+ await customElements.whenDefined('kritzel-engine');
2180
+ if (!this.isEngineReady || !this.isControlsReady) {
2181
+ return;
2182
+ }
2183
+ this.isReady.emit(this.host);
2184
+ }
2329
2185
  registerCustomSvgIcons() {
2330
2186
  for (const [name, svg] of Object.entries(this.customSvgIcons)) {
2331
2187
  KritzelIconRegistry.register(name, svg);
2332
2188
  }
2333
2189
  }
2334
2190
  render() {
2335
- return (index.h(index.Host, { key: '5192399124222f7bd8a8d66054e6053befdebdfb' }, index.h("kritzel-engine", { key: '5fe3019675f579dfd14bb0072422de1e97f4fe18', ref: el => (this.engineRef = el) }), index.h("kritzel-controls", { key: '99f382d75380d770a634cbdbe873c29bf95a7b08', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' } })));
2191
+ return (index.h(index.Host, { key: '6621a06171194680b6df309dfa328e96ce7723c5' }, index.h("kritzel-engine", { key: '623628c15564168b8e508dbe45afbf2e5f5b1ed5', ref: el => (this.engineRef = el), onIsEngineReady: () => (this.isEngineReady = true) }), index.h("kritzel-controls", { key: 'dc56bb4c327d17236443c648fd3ca37eeaadc515', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' }, onIsControlsReady: () => (this.isControlsReady = true) })));
2336
2192
  }
2337
2193
  get host() { return index.getElement(this); }
2194
+ static get watchers() { return {
2195
+ "isEngineReady": ["onIsEngineReady"],
2196
+ "isControlsReady": ["onIsControlsReady"]
2197
+ }; }
2338
2198
  };
2339
2199
  KritzelEditor.style = kritzelEditorCss;
2340
2200
 
@@ -2759,6 +2619,7 @@ const DEFAULT_ENGINE_STATE = {
2759
2619
  selectionGroup: null,
2760
2620
  resizeHandleType: null,
2761
2621
  hasViewportChanged: false,
2622
+ isReady: false,
2762
2623
  isEnabled: true,
2763
2624
  isScaling: false,
2764
2625
  isPanning: false,
@@ -3171,6 +3032,12 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
3171
3032
  }
3172
3033
  }
3173
3034
 
3035
+ class KritzelClassHelper {
3036
+ static isInstanceOf(object, className) {
3037
+ return object.__class__ === className;
3038
+ }
3039
+ }
3040
+
3174
3041
  const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.debug-panel{position:absolute;pointer-events:none;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;pointer-events:none;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{overflow:visible}textarea{all:unset;box-sizing:border-box;outline:none !important;border:none !important;overflow:visible}.resize-handle-overlay.top-left,.resize-handle-overlay.bottom-right{cursor:nwse-resize}.resize-handle-overlay.top-right,.resize-handle-overlay.bottom-left{cursor:nesw-resize}.rotation-handle-overlay{cursor:grab}";
3175
3042
 
3176
3043
  const KritzelEngine = class {
@@ -3182,7 +3049,7 @@ const KritzelEngine = class {
3182
3049
  }
3183
3050
  constructor(hostRef) {
3184
3051
  index.registerInstance(this, hostRef);
3185
- this.engineReady = index.createEvent(this, "engineReady");
3052
+ this.isEngineReady = index.createEvent(this, "isEngineReady");
3186
3053
  this.activeToolChange = index.createEvent(this, "activeToolChange");
3187
3054
  this.globalContextMenuItems = [
3188
3055
  {
@@ -3234,7 +3101,10 @@ const KritzelEngine = class {
3234
3101
  }
3235
3102
  componentDidLoad() {
3236
3103
  this.viewport = new KritzelViewport(this.store, this.host);
3237
- this.engineReady.emit();
3104
+ if (this.store.state.isReady === false) {
3105
+ this.store.state.isReady = true;
3106
+ this.isEngineReady.emit();
3107
+ }
3238
3108
  }
3239
3109
  handleWheel(ev) {
3240
3110
  var _a, _b;
@@ -3397,6 +3267,7 @@ const KritzelEngine = class {
3397
3267
  this.store.deselectAllObjects();
3398
3268
  object.id = object.generateId();
3399
3269
  object._store = this.store;
3270
+ object.scale = object.scale ? object.scale : this.store.state.scale;
3400
3271
  object.zIndex = this.store.currentZIndex;
3401
3272
  const command = new index$1.AddObjectCommand(this.store, this, object);
3402
3273
  this.store.history.executeCommand(command);
@@ -3414,12 +3285,16 @@ const KritzelEngine = class {
3414
3285
  this.store.history.executeCommand(command);
3415
3286
  return object;
3416
3287
  }
3288
+ async getSelectedObjects() {
3289
+ return this.store.state.selectionGroup ? this.store.state.selectionGroup.objects : [];
3290
+ }
3417
3291
  async selectObjects(objects) {
3418
3292
  var _a;
3419
3293
  (_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
3420
3294
  this.store.setState('activeTool', index$1.KritzelToolRegistry.getTool('selection'));
3421
3295
  this.store.deselectAllObjects();
3422
3296
  this.store.selectObjects(objects);
3297
+ console.log('Selected objects:', objects);
3423
3298
  }
3424
3299
  async selectAllObjectsInViewport() {
3425
3300
  var _a;
@@ -3431,21 +3306,27 @@ const KritzelEngine = class {
3431
3306
  async clearSelection() {
3432
3307
  this.store.clearSelection();
3433
3308
  }
3309
+ async centerObjectInViewport(object) {
3310
+ object.centerInViewport();
3311
+ const command = new UpdateObjectCommand(this.store, this, object, object);
3312
+ this.store.history.executeCommand(command);
3313
+ return object;
3314
+ }
3434
3315
  render() {
3435
3316
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
3436
3317
  const computedStyle = window.getComputedStyle(this.host);
3437
3318
  const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
3438
3319
  const baseHandleSize = parseFloat(baseHandleSizePx);
3439
3320
  const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
3440
- return (index.h(index.Host, { key: '46b1c0d4000229b7881636625af38db319ff49ae' }, index.h("div", { key: '7b91f710711ff1fefd395c38f79004c84a3df74d', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '63568d0cceef92262bbf40f54f84d5003302f7c1' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
3441
- _a.translateX), index.h("div", { key: 'cd7a9f6bf33d547b23814468c1d2ae726f5d5576' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
3442
- _b.translateY), index.h("div", { key: '42788d635e64f1e1f1da2f6b0ec8cf0fec988769' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
3443
- _c.viewportWidth), index.h("div", { key: 'bd674b2a6b13b22ad177d2bc0527a6b2d41d523f' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
3444
- _d.viewportHeight), index.h("div", { key: 'faa9581a80b8020ebe4f48cfbea4b0a91a17b1d0' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: '74e9671f7f546debca0884e74e7b5cdbba0810de' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
3445
- _e.scale), index.h("div", { key: '7f14af283874e226cfdcdf5bf17c0c4f6935f154' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
3446
- _g.name), index.h("div", { key: '5d9bb07762326387a04d99d9d1f0487c809a8d13' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: '65b54f060f162e328d8756845a991b84cd377fa8' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), index.h("div", { key: '0593106ef382e3a4b4368f503d435550ee52b686' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), index.h("div", { key: '2d9102c016bbc89bd3f61b46c364663d822ae773' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), index.h("div", { key: '5393b7974bf7e8c391ec67945610b0051d155393' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '3591db55fdf4b92162f4d516d307b9f42a6f996a' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '2fef15767414c841b320705638328f45ab6e01b7' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '20cf1b12790c3f7112484de2343ed157536f072f' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: 'b23da45c9f13deb827f837651ab4e09cdb435aa9' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '6c3d8cf2aeacf3c9e7930eca83676bfa59f3d2cb' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: 'c87abe35d1aa55d11d321cec3d78f6722a04d114' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '3d371da3b1075c5b116ae0db50ae5b8d22e6c2eb' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
3447
- _m.cursorX), index.h("div", { key: '1a426883cfbfd742aa127d7fff92080586f4af62' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
3448
- _o.cursorY)), index.h("div", { key: '5de09bb5222a271a3163d7226e012cb86c722a7e', class: "origin", style: {
3321
+ return (index.h(index.Host, { key: '1a8a4ac086fd25b356d25f1c4f094005771a3d57' }, index.h("div", { key: '5edf7faeb5d63e8341fa81b48287eaee001ed163', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '356a8bb56abb4a9c98ab79f1d224a64e6c202a34' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
3322
+ _a.translateX), index.h("div", { key: 'e3d853e7e11c32bf5f801c29a0ed9add91ce24c3' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
3323
+ _b.translateY), index.h("div", { key: '7ada7c0c256bbdc79b2b74b391c87a319c9aaf05' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
3324
+ _c.viewportWidth), index.h("div", { key: '156ed10ab63bbacf30d549f115d82beeb6e714d5' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
3325
+ _d.viewportHeight), index.h("div", { key: '1cf8c42989b1c4117a4895f05686313e169b808e' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: '1e558a335a31c050c80cda3cd763267fe95335d2' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
3326
+ _e.scale), index.h("div", { key: 'ff43094ed2f27d2157946329cc4473d92c2d3e30' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
3327
+ _g.name), index.h("div", { key: '844c0e1dd8d77270419e3c0a0362536e6027f4cb' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: '64a782868924f27f9ef4d426694ddac338293bc5' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), index.h("div", { key: '4fc48b5006641e0ecb9af0d8cc5b4fe2868faa3d' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), index.h("div", { key: '1407e97aba7434599060b33ead00da898482cc6a' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), index.h("div", { key: 'f99a32e77014bf5548a5ae50a99ee4e6f6ae4801' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '0c7708d4a8dc78e171b9493b8b5ab2cfe2984ad6' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '5bca3b678ee83f2faba320dfbeb63af8d41b2908' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '2cecae3e2108ca108220ca7bb67777829cd223ef' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: 'd0cf8270f99ae6e8ce915a856e54ed7b38cd40aa' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '4f1a0bad54e9a4ad46fec56d7c692a48e02cb7a2' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: '9a4b3fdc05e103a2c73a7940bd9a84a68f912b14' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '5a480fdbe4a3fa435697bb94701971dda75f41d3' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
3328
+ _m.cursorX), index.h("div", { key: 'f549e8faa3ddad5b3294bb72f24ad3735539e84b' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
3329
+ _o.cursorY)), index.h("div", { key: 'e81679812ed19a50a09357549df00e590ae613b6', class: "origin", style: {
3449
3330
  transform: `matrix(${(_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale}, 0, 0, ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale}, ${(_r = this.store.state) === null || _r === void 0 ? void 0 : _r.translateX}, ${(_s = this.store.state) === null || _s === void 0 ? void 0 : _s.translateY})`,
3450
3331
  } }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
3451
3332
  _t.map(object => {
@@ -3469,17 +3350,17 @@ const KritzelEngine = class {
3469
3350
  borderStyle: 'solid',
3470
3351
  padding: object.padding + 'px',
3471
3352
  overflow: 'visible',
3472
- } }, object instanceof KritzelPath && (index.h("svg", { ref: el => object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
3353
+ } }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (index.h("svg", { ref: el => object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
3473
3354
  height: object === null || object === void 0 ? void 0 : object.height.toString(),
3474
3355
  width: object === null || object === void 0 ? void 0 : object.width.toString(),
3475
3356
  position: 'absolute',
3476
3357
  overflow: 'visible',
3477
- }, viewBox: object === null || object === void 0 ? void 0 : object.viewBox }, index.h("path", { d: object === null || object === void 0 ? void 0 : object.d, fill: object.fill, stroke: object === null || object === void 0 ? void 0 : object.stroke }))), object instanceof KritzelImage && (index.h("img", { ref: el => object.mount(el), src: object.src, style: {
3358
+ }, viewBox: object === null || object === void 0 ? void 0 : object.viewBox }, index.h("path", { d: object === null || object === void 0 ? void 0 : object.d, fill: object.fill, stroke: object === null || object === void 0 ? void 0 : object.stroke }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (index.h("img", { ref: el => object.mount(el), src: object.src, style: {
3478
3359
  width: '100%',
3479
3360
  height: '100%',
3480
3361
  userSelect: 'none',
3481
3362
  pointerEvents: 'none',
3482
- }, draggable: false, onDragStart: e => e.preventDefault() })), object instanceof index$1.KritzelText && (index.h("textarea", { ref: el => object.mount(el), value: object.value, onKeyDown: event => object.handleKeyDown(event), onInput: event => object.handleInput(event), rows: object.rows, style: {
3363
+ }, draggable: false, onDragStart: e => e.preventDefault() })), KritzelClassHelper.isInstanceOf(object, 'KritzelText') && (index.h("textarea", { ref: el => object.mount(el), value: object.value, onKeyDown: event => object.handleKeyDown(event), onInput: event => object.handleInput(event), rows: object.rows, style: {
3483
3364
  width: '100%',
3484
3365
  height: '100%',
3485
3366
  color: object.fontColor,
@@ -3495,10 +3376,10 @@ const KritzelEngine = class {
3495
3376
  pointerEvents: object.isReadonly ? 'none' : 'auto',
3496
3377
  cursor: object.isReadonly ? 'default' : 'text',
3497
3378
  caretColor: object.isReadonly ? 'transparent' : 'auto',
3498
- } })), object instanceof KritzelSelectionGroup && (index.h("div", { ref: el => object.mount(el), style: {
3379
+ } })), KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') && (index.h("div", { ref: el => object.mount(el), style: {
3499
3380
  width: '100%',
3500
3381
  height: '100%',
3501
- } })), object instanceof KrtizelSelectionBox && (index.h("div", { ref: el => object.mount(el), style: {
3382
+ } })), KritzelClassHelper.isInstanceOf(object, 'KrtizelSelectionBox') && (index.h("div", { ref: el => object.mount(el), style: {
3502
3383
  width: '100%',
3503
3384
  height: '100%',
3504
3385
  } }))), index.h("line", { x1: "0", y1: "0", x2: object.totalWidth, y2: "0", style: {
@@ -3542,7 +3423,7 @@ const KritzelEngine = class {
3542
3423
  fill: 'transparent',
3543
3424
  cursor: 'grab',
3544
3425
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, index.h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.debugInfoVisible ? 'block' : 'none' } }, index.h("div", { style: { width: '100%', height: '100%' } }, index.h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), index.h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), index.h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), index.h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), index.h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation)))))));
3545
- }), index.h("svg", { key: '684971a4c93f5d8cdf52497d0f3f81dc21ece397', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
3426
+ }), index.h("svg", { key: 'bf2c561803773e19aed36d418e96b9f797c305be', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
3546
3427
  height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
3547
3428
  width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
3548
3429
  left: '0',
@@ -3552,12 +3433,12 @@ const KritzelEngine = class {
3552
3433
  transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
3553
3434
  transformOrigin: 'top left',
3554
3435
  overflow: 'visible',
3555
- }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: 'e29e0b110612e569a8fada121d749f66ab5e2aae', d: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.d, fill: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.fill, stroke: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: '81b88db00390e6ba768b7432e941a87ba56e54e5', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
3436
+ }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '5177dab02b9a5563129d00b80b99a1a198eb8ff5', d: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.d, fill: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.fill, stroke: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: 'ea3ae0531d9b2109e547baca7159ea29ebd34827', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
3556
3437
  position: 'fixed',
3557
3438
  left: `${this.store.state.contextMenuX}px`,
3558
3439
  top: `${this.store.state.contextMenuY}px`,
3559
3440
  zIndex: '10000',
3560
- }, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '700ef43b524157ef757973fc039b2d74e7920578', store: this.store })));
3441
+ }, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: 'c785558a0f922d7caeacaeeb44a9492ebcc0be7d', store: this.store })));
3561
3442
  }
3562
3443
  get host() { return index.getElement(this); }
3563
3444
  };
@@ -3690,7 +3571,7 @@ const KritzelStrokeSize = class {
3690
3571
  };
3691
3572
  KritzelStrokeSize.style = kritzelStrokeSizeCss;
3692
3573
 
3693
- const kritzelTooltipCss = ":host{width:auto}.tooltip-content{position:relative;padding:8px 12px;border-radius:4px;width:fit-content;background-color:var(--kritzel-controls-tooltip-background-color, #ffffff);color:var(--kritzel-controls-tooltip-color, #000000);padding:var(--kritzel-controls-tooltip-padding, 8px);border-radius:var(--kritzel-controls-tooltip-border-radius, 8px);white-space:nowrap;box-shadow:var(--kritzel-controls-tooltip-box-shadow, 0 1px 6px rgba(0, 0, 0, 0.12))}";
3574
+ const kritzelTooltipCss = ":host{width:auto}.tooltip-content{position:relative;padding:8px 12px;border-radius:4px;width:fit-content;background-color:var(--kritzel-controls-tooltip-background-color, #ffffff);color:var(--kritzel-controls-tooltip-color, #000000);padding:var(--kritzel-controls-tooltip-padding, 8px);border-radius:var(--kritzel-controls-tooltip-border-radius, 16px);white-space:nowrap;box-shadow:var(--kritzel-controls-tooltip-box-shadow, 0 1px 6px rgba(0, 0, 0, 0.12))}";
3694
3575
 
3695
3576
  const MOBILE_BREAKPOINT = 768;
3696
3577
  const KritzelTooltip = class {
@@ -3759,7 +3640,7 @@ const KritzelTooltip = class {
3759
3640
  };
3760
3641
  KritzelTooltip.style = kritzelTooltipCss;
3761
3642
 
3762
- const kritzelUtilityPanelCss = ":host{display:flex;flex-direction:row;align-items:center;padding:4px;gap:8px;border-top-left-radius:6px;border-top-right-radius:6px;background-color:rgb(226, 226, 226);width:fit-content;user-select:none}.utility-button{display:flex;justify-content:center;align-items:center;width:28px;height:28px;padding:8px 4px;border:none;outline:none;background:none;cursor:pointer;color:#333333;-webkit-tap-highlight-color:transparent}.utility-separator{width:1px;height:16px;background-color:hsl(0, 0%, 0%, 4.3%)}";
3643
+ const kritzelUtilityPanelCss = ":host{display:flex;flex-direction:row;align-items:center;padding:4px;gap:8px;border-top-left-radius:12px;border-top-right-radius:12px;background-color:rgb(226, 226, 226);width:fit-content;user-select:none}.utility-button{display:flex;justify-content:center;align-items:center;width:28px;height:28px;padding:8px 4px;border:none;outline:none;background:none;cursor:pointer;color:#333333;-webkit-tap-highlight-color:transparent}.utility-separator{width:1px;height:16px;background-color:hsl(0, 0%, 0%, 4.3%)}";
3763
3644
 
3764
3645
  const KritzelUtilityPanel = class {
3765
3646
  constructor(hostRef) {