kritzel-stencil 0.0.107 → 0.0.108

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 (52) hide show
  1. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js +52 -35
  2. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +1 -1
  3. package/dist/collection/classes/handlers/key.handler.js +1 -1
  4. package/dist/collection/classes/handlers/key.handler.js.map +1 -1
  5. package/dist/collection/classes/registries/icon-registry.class.js.map +1 -0
  6. package/dist/collection/classes/registries/tool.registry.js.map +1 -0
  7. package/dist/collection/classes/store.class.js +3 -54
  8. package/dist/collection/classes/store.class.js.map +1 -1
  9. package/dist/collection/classes/tools/image-tool.class.js +1 -1
  10. package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
  11. package/dist/collection/classes/tools/selection-tool.class.js +1 -1
  12. package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
  13. package/dist/collection/classes/tools/text-tool.class.js +1 -1
  14. package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
  15. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +2 -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 +18 -16
  18. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
  19. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js +1 -1
  20. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js.map +1 -1
  21. package/dist/collection/configs/default-engine-state.js +53 -0
  22. package/dist/collection/configs/default-engine-state.js.map +1 -0
  23. package/dist/collection/helpers/event.helper.js +14 -0
  24. package/dist/collection/helpers/event.helper.js.map +1 -1
  25. package/dist/components/kritzel-controls.js +1 -1
  26. package/dist/components/kritzel-editor.js +4 -4
  27. package/dist/components/kritzel-editor.js.map +1 -1
  28. package/dist/components/kritzel-engine.js +1 -1
  29. package/dist/components/{p-CesjDLvT.js → p-BNfHRlWL.js} +34 -20
  30. package/dist/components/p-BNfHRlWL.js.map +1 -0
  31. package/dist/components/{p-DTcfnx4-.js → p-Box62paJ.js} +3 -3
  32. package/dist/components/{p-DTcfnx4-.js.map → p-Box62paJ.js.map} +1 -1
  33. package/dist/components/p-CZkSABuJ.js.map +1 -1
  34. package/dist/components/{p-_3gCPfqz.js → p-CqJr3YCp.js} +22 -19
  35. package/dist/components/{p-_3gCPfqz.js.map → p-CqJr3YCp.js.map} +1 -1
  36. package/dist/esm/kritzel-brush-style_18.entry.js +52 -35
  37. package/dist/esm/kritzel-brush-style_18.entry.js.map +1 -1
  38. package/dist/stencil/p-3a7d7b58.entry.js +2 -0
  39. package/dist/stencil/p-3a7d7b58.entry.js.map +1 -0
  40. package/dist/stencil/stencil.esm.js +1 -1
  41. package/dist/types/classes/{tool.registry.d.ts → registries/tool.registry.d.ts} +2 -2
  42. package/dist/types/configs/default-engine-state.d.ts +2 -0
  43. package/dist/types/helpers/event.helper.d.ts +5 -3
  44. package/package.json +1 -1
  45. package/dist/collection/classes/icon-registry.class.js.map +0 -1
  46. package/dist/collection/classes/tool.registry.js.map +0 -1
  47. package/dist/components/p-CesjDLvT.js.map +0 -1
  48. package/dist/stencil/p-e596d004.entry.js +0 -2
  49. package/dist/stencil/p-e596d004.entry.js.map +0 -1
  50. /package/dist/collection/classes/{icon-registry.class.js → registries/icon-registry.class.js} +0 -0
  51. /package/dist/collection/classes/{tool.registry.js → registries/tool.registry.js} +0 -0
  52. /package/dist/types/classes/{icon-registry.class.d.ts → registries/icon-registry.class.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-DC8SDK2U.js';
2
- import { b as KritzelBaseCommand, c as KritzelBaseTool, d as KritzelEventHelper, e as KritzelBaseObject, f as KritzelText, g as KritzelToolRegistry, a as KritzelTextTool, K as KritzelBrushTool, h as KritzelPath, O as ObjectHelper, A as AddObjectCommand, i as KritzelKeyboardHelper } from './p-CesjDLvT.js';
2
+ import { b as KritzelBaseCommand, c as KritzelBaseTool, d as KritzelEventHelper, e as KritzelBaseObject, f as KritzelText, g as KritzelToolRegistry, a as KritzelTextTool, K as KritzelBrushTool, h as KritzelPath, O as ObjectHelper, A as AddObjectCommand, i as KritzelKeyboardHelper } from './p-BNfHRlWL.js';
3
3
  import { K as KritzelContextMenu, d as defineCustomElement$3 } from './p-Cbu5RSmC.js';
4
4
  import { d as defineCustomElement$2 } from './p-Ds3FhuuO.js';
5
5
  import { d as defineCustomElement$1 } from './p-CZkSABuJ.js';
@@ -1691,7 +1691,7 @@ class UpdateObjectCommand extends KritzelBaseCommand {
1691
1691
  }
1692
1692
  }
1693
1693
 
1694
- const initialState = {
1694
+ const DEFAULT_ENGINE_STATE = {
1695
1695
  activeTool: null,
1696
1696
  activeText: null,
1697
1697
  currentPath: null,
@@ -1743,6 +1743,7 @@ const initialState = {
1743
1743
  longTouchTimeout: null,
1744
1744
  longTouchDelay: 300,
1745
1745
  };
1746
+
1746
1747
  class KritzelStore {
1747
1748
  get history() {
1748
1749
  return this._history;
@@ -1768,7 +1769,7 @@ class KritzelStore {
1768
1769
  constructor(kritzelEngine) {
1769
1770
  this._listeners = new Map();
1770
1771
  this.objects = [];
1771
- this._state = initialState;
1772
+ this._state = DEFAULT_ENGINE_STATE;
1772
1773
  this._kritzelEngine = kritzelEngine;
1773
1774
  this._history = new KritzelHistory(this);
1774
1775
  this._state.objectsOctree = new KritzelOctree({
@@ -2268,6 +2269,9 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
2268
2269
  if (this.store.state.isEnabled === false) {
2269
2270
  return;
2270
2271
  }
2272
+ if (ev.touches.length === 2) {
2273
+ KritzelEventHelper.notifyTwoFingerTouch();
2274
+ }
2271
2275
  if (KritzelEventHelper.detectDoubleTap()) {
2272
2276
  const doubleTapEvent = new CustomEvent('doubletap', { detail: event, bubbles: true, composed: true });
2273
2277
  this.host.dispatchEvent(doubleTapEvent);
@@ -2443,20 +2447,20 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
2443
2447
  const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
2444
2448
  const baseHandleSize = parseFloat(baseHandleSizePx);
2445
2449
  const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
2446
- return (h(Host, { key: '0c20c50e3ad8ac088902881c35c406ad2f0787d5' }, h("div", { key: 'a89d76b5f6a10cbc54c40d034a08b3ceb99be063', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, h("div", { key: '94345439d02de7d005bb92abb377b7ebeb91fcdb' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
2447
- _a.translateX), h("div", { key: '1e2e3ffc6ad760f089f4d02d94dfeb09bb5725cb' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
2448
- _b.translateY), h("div", { key: '36d6170934959e19b95326d84b32c9abe2385edc' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
2449
- _c.viewportWidth), h("div", { key: '57e5d37af3fd1f6ad24ea89ca525a6f0bc8e014b' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
2450
- _d.viewportHeight), h("div", { key: '8281e788e350db75bbf1fe12dd8c17b91b429135' }, "ObjectsInViewport. ", this.store.objects.length), h("div", { key: '9f42aad27d0a266cbc720d1e13292bea5be84770' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
2451
- _e.scale), h("div", { key: '76848c1a0eb2379ee0d0314523a540dbeb3d0697' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
2452
- _g.name), h("div", { key: '77f8ff0b660227f7b25c12b74d70946bc1f66e78' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), h("div", { key: '229e94fee90a847a853419ae61bc131221313fc6' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), h("div", { key: 'f31784916ab54f9a5eda02cffebe55a1f9aaa51f' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), h("div", { key: '4611a6dd48f1033d42fc3b7813634cbc16bf9b3b' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), h("div", { key: '14388f4b5cca60d8a2d8d474f941b53a78ad327d' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), h("div", { key: '2f3dcd488855413e392f56718af640e369d99fae' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: '2cd0e44a1d13eaf5d3a942f75a727a074bf37622' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: '99d51cf25e02c9d06865bf1f847c704ad8a32110' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: '87ab9908a318b238ad1fb00e91dba9c485038443' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: '20f291bf45ba06b4107002e288b93f8f61ef9520' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), h("div", { key: '52244f4f0d368e7bc183eed4c65abe536d134f44' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), h("div", { key: '641edd47e7bccc7514ed6aeac3ecbead95568dde' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
2453
- _m.cursorX), h("div", { key: 'bf0826a9cbc800ca0f13d4de4da7dbb21241498f' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
2454
- _o.cursorY)), h("div", { key: '5659cb254f57b79ca8e33ab11a8087d5ca5088dc', class: "origin", style: {
2450
+ return (h(Host, { key: '7592f0cc9b3c4f5c2c68b8a69151e57e254e1bcd' }, h("div", { key: '83d550a8b257c6c30915b4125633410b935df1c7', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, h("div", { key: 'aaebf84d2344cf117d7e2b221f4675abfa3e2423' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
2451
+ _a.translateX), h("div", { key: '0dff156e5b57abe1919af5a14da374ee86f62821' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
2452
+ _b.translateY), h("div", { key: 'bb7fe1f8442c70e1bd7655ea222f37ed55c0cf8f' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
2453
+ _c.viewportWidth), h("div", { key: 'c0399a368afa2186ba45e7be6fa69495f77912b2' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
2454
+ _d.viewportHeight), h("div", { key: '2506ae215413710417a9b494dfeaa06a95381e1e' }, "ObjectsInViewport. ", this.store.objects.length), h("div", { key: '858e6cff62c24d97f36560ca57c59eb90d7fe253' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
2455
+ _e.scale), h("div", { key: 'b7dd1926a2a374b34ccb0f1af2f5100bb256a323' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
2456
+ _g.name), h("div", { key: 'e75a98de366a36b9e4a478119db1754df85ce149' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), h("div", { key: 'c78c09fbb6efc97be8cde8bc55d2c9ca724d913e' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), h("div", { key: '7864d38c808ff8fa01fc24d150ac03ec56eb2111' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), h("div", { key: '8ce8b3522065ad221d0cac69366199fa78e6c985' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), h("div", { key: 'f2dc96d374c66798ab0ec6f4759a851448375def' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), h("div", { key: '7a8642ee44c2c6d6419da80c2a27b0370c51c67d' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: '9f819435c8ad8c2f836edca397918bd98e2ed34d' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: '252201d35275563594bfe13ae19ded7289d4860a' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: '45056c11f0733c433f9a91008d021702df660063' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: 'a6fedfe47aac88ffa4df90da060a28d83f8bf1cf' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), h("div", { key: '30b311e5dee2174ba0baea6e5bc9f1fca1a01fac' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), h("div", { key: 'e2d1936e16dd5a268dd1efab8b7e67b567170e9b' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
2457
+ _m.cursorX), h("div", { key: 'bb1e751d01b31ca727c01537927808daec4425e9' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
2458
+ _o.cursorY)), h("div", { key: 'a5ccd3e025b425660a1dd9ef523db203fcbde610', class: "origin", style: {
2455
2459
  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})`,
2456
2460
  } }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
2457
2461
  _t.map(object => {
2458
2462
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2459
- return (h("div", { style: { transform: object === null || object === void 0 ? void 0 : object.transformationMatrix, transformOrigin: 'top left' } }, h("svg", { xmlns: "http://www.w3.org/2000/svg", key: object.id, id: object.id, class: "object", style: {
2463
+ return (h("div", { style: { transform: object === null || object === void 0 ? void 0 : object.transformationMatrix, transformOrigin: 'top left', zIndex: object.zIndex.toString(), position: 'absolute' } }, h("svg", { xmlns: "http://www.w3.org/2000/svg", key: object.id, id: object.id, class: "object", style: {
2460
2464
  height: object === null || object === void 0 ? void 0 : object.totalHeight.toString(),
2461
2465
  width: object === null || object === void 0 ? void 0 : object.totalWidth.toString(),
2462
2466
  left: '0',
@@ -2466,7 +2470,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
2466
2470
  transformOrigin: 'center',
2467
2471
  opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
2468
2472
  pointerEvents: object.markedForRemoval ? 'none' : 'auto',
2469
- zIndex: object.zIndex.toString(),
2470
2473
  } }, h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
2471
2474
  minHeight: '0',
2472
2475
  minWidth: '0',
@@ -2548,7 +2551,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
2548
2551
  fill: 'transparent',
2549
2552
  cursor: 'grab',
2550
2553
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.debugInfoVisible ? 'block' : 'none' } }, h("div", { style: { width: '100%', height: '100%' } }, h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation)))))));
2551
- }), h("svg", { key: '05a35ebb17312d00a4065dc6dc76f3a93a72eff4', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
2554
+ }), h("svg", { key: 'c2b10893d4bea0e25c98058e640ad8eef6135a80', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
2552
2555
  height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
2553
2556
  width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
2554
2557
  left: '0',
@@ -2558,12 +2561,12 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
2558
2561
  transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
2559
2562
  transformOrigin: 'top left',
2560
2563
  overflow: 'visible',
2561
- }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, h("path", { key: 'cb232e2697ce6ede2e4d9ed2e1b433ccde3961b5', 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 && (h("kritzel-context-menu", { key: 'e41b88a78bbd25f692fbdba88fda80993055a078', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
2564
+ }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, h("path", { key: '84b018b26b93e0f382062ac2e24efbce8bc07e3f', 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 && (h("kritzel-context-menu", { key: 'c372bd8595656b35d7eed2e38400490e7d71808b', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
2562
2565
  position: 'fixed',
2563
2566
  left: `${this.store.state.contextMenuX}px`,
2564
2567
  top: `${this.store.state.contextMenuY}px`,
2565
2568
  zIndex: '10000',
2566
- }, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && h("kritzel-cursor-trail", { key: '1d96c0d7fa94ddcf5820fd76fbaf69c54b1face2' })));
2569
+ }, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && h("kritzel-cursor-trail", { key: 'ce67e9df4714a9585bb1a8db3780baff6faeb66d' })));
2567
2570
  }
2568
2571
  get host() { return this; }
2569
2572
  static get style() { return kritzelEngineCss; }
@@ -2623,6 +2626,6 @@ function defineCustomElement() {
2623
2626
  }
2624
2627
 
2625
2628
  export { KritzelEngine as K, KritzelSelectionTool as a, KritzelEraserTool as b, KritzelImageTool as c, defineCustomElement as d };
2626
- //# sourceMappingURL=p-_3gCPfqz.js.map
2629
+ //# sourceMappingURL=p-CqJr3YCp.js.map
2627
2630
 
2628
- //# sourceMappingURL=p-_3gCPfqz.js.map
2631
+ //# sourceMappingURL=p-CqJr3YCp.js.map