kritzel-stencil 0.0.128 → 0.0.130

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 (154) hide show
  1. package/dist/cjs/index-CUSIflVf.js +2 -2
  2. package/dist/cjs/{index-C7Read21.js → index-CfXjPLHb.js} +46 -28
  3. package/dist/cjs/index-CfXjPLHb.js.map +1 -0
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/{kritzel-brush-style_22.cjs.entry.js → kritzel-brush-style_23.cjs.entry.js} +502 -438
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/stencil.cjs.js +1 -1
  8. package/dist/collection/classes/commands/add-object.command.js +2 -2
  9. package/dist/collection/classes/commands/add-object.command.js.map +1 -1
  10. package/dist/collection/classes/commands/add-selection-group.command.js +3 -3
  11. package/dist/collection/classes/commands/add-selection-group.command.js.map +1 -1
  12. package/dist/collection/classes/commands/remove-object.command.js +4 -4
  13. package/dist/collection/classes/commands/remove-object.command.js.map +1 -1
  14. package/dist/collection/classes/commands/remove-selection-group.command.js +2 -2
  15. package/dist/collection/classes/commands/remove-selection-group.command.js.map +1 -1
  16. package/dist/collection/classes/commands/rotate-selection-group.command.js +2 -2
  17. package/dist/collection/classes/commands/rotate-selection-group.command.js.map +1 -1
  18. package/dist/collection/classes/handlers/selection.handler.js +5 -5
  19. package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
  20. package/dist/collection/classes/objects/base-object.class.js +1 -1
  21. package/dist/collection/classes/objects/base-object.class.js.map +1 -1
  22. package/dist/collection/classes/objects/path.class.js +1 -1
  23. package/dist/collection/classes/objects/path.class.js.map +1 -1
  24. package/dist/collection/classes/objects/selection-group.class.js +6 -6
  25. package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
  26. package/dist/collection/classes/store.class.js +9 -22
  27. package/dist/collection/classes/store.class.js.map +1 -1
  28. package/dist/collection/classes/structures/object-map.structure.js +42 -0
  29. package/dist/collection/classes/structures/object-map.structure.js.map +1 -0
  30. package/dist/collection/collection-manifest.json +1 -0
  31. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +7 -0
  32. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +12 -2
  33. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
  34. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +17 -17
  35. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
  36. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.css +15 -155
  37. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +167 -177
  38. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js.map +1 -1
  39. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.css +129 -0
  40. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +261 -0
  41. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js.map +1 -0
  42. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +160 -43
  43. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js.map +1 -1
  44. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.css +83 -74
  45. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +142 -118
  46. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js.map +1 -1
  47. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
  48. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +4 -4
  49. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +2 -2
  50. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +2 -2
  51. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +5 -8
  52. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +3 -3
  53. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
  54. package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js +110 -88
  55. package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js.map +1 -1
  56. package/dist/collection/configs/default-engine-state.js +1 -1
  57. package/dist/collection/configs/default-engine-state.js.map +1 -1
  58. package/dist/collection/helpers/keyboard.helper.js +18 -0
  59. package/dist/collection/helpers/keyboard.helper.js.map +1 -1
  60. package/dist/collection/index.js +1 -0
  61. package/dist/collection/index.js.map +1 -1
  62. package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
  63. package/dist/collection/interfaces/menu-item.interface.js.map +1 -1
  64. package/dist/components/index.d.ts +2 -0
  65. package/dist/components/index.js +3 -2
  66. package/dist/components/index.js.map +1 -1
  67. package/dist/components/kritzel-control-brush-config.js +1 -1
  68. package/dist/components/kritzel-control-text-config.js +1 -1
  69. package/dist/components/kritzel-controls.js +1 -1
  70. package/dist/components/kritzel-editor.js +53 -39
  71. package/dist/components/kritzel-editor.js.map +1 -1
  72. package/dist/components/kritzel-engine.js +1 -1
  73. package/dist/components/kritzel-menu-item.d.ts +11 -0
  74. package/dist/components/kritzel-menu-item.js +9 -0
  75. package/dist/components/kritzel-menu-item.js.map +1 -0
  76. package/dist/components/kritzel-menu.js +1 -1
  77. package/dist/components/kritzel-portal.js +1 -1
  78. package/dist/components/kritzel-split-button.js +1 -1
  79. package/dist/components/kritzel-stroke-size.js +1 -1
  80. package/dist/components/kritzel-tooltip.js +1 -1
  81. package/dist/components/kritzel-utility-panel.js +1 -1
  82. package/dist/components/kritzel-workspace-manager.js +1 -1
  83. package/dist/components/{p-jG1e48OE.js → p-26poIWa_.js} +6 -6
  84. package/dist/components/{p-jG1e48OE.js.map → p-26poIWa_.js.map} +1 -1
  85. package/dist/components/{p-rQeWFfPG.js → p-BGccckxP.js} +3 -3
  86. package/dist/components/{p-rQeWFfPG.js.map → p-BGccckxP.js.map} +1 -1
  87. package/dist/components/p-BcQWRzsB.js +183 -0
  88. package/dist/components/p-BcQWRzsB.js.map +1 -0
  89. package/dist/components/p-C-DqsDXz.js +238 -0
  90. package/dist/components/p-C-DqsDXz.js.map +1 -0
  91. package/dist/components/{p-B7VrEdgP.js → p-C9-70hiF.js} +25 -7
  92. package/dist/components/p-C9-70hiF.js.map +1 -0
  93. package/dist/components/p-CJKA5zIE.js +10 -0
  94. package/dist/components/p-CJKA5zIE.js.map +1 -0
  95. package/dist/components/p-CaPdvVd4.js +127 -0
  96. package/dist/components/p-CaPdvVd4.js.map +1 -0
  97. package/dist/components/{p-a7KmQzo4.js → p-Cb1IUD_g.js} +5 -5
  98. package/dist/components/{p-a7KmQzo4.js.map → p-Cb1IUD_g.js.map} +1 -1
  99. package/dist/components/{p-BaKb8ZLg.js → p-Crni2OI4.js} +4 -4
  100. package/dist/components/{p-BaKb8ZLg.js.map → p-Crni2OI4.js.map} +1 -1
  101. package/dist/components/{p-BB22cVkU.js → p-D_Uh-xv_.js} +13 -18
  102. package/dist/components/p-D_Uh-xv_.js.map +1 -0
  103. package/dist/components/{p-BzSz74Ci.js → p-fyfT6A5K.js} +3 -3
  104. package/dist/components/{p-BzSz74Ci.js.map → p-fyfT6A5K.js.map} +1 -1
  105. package/dist/components/{p-D-zg05gA.js → p-jGaWxggY.js} +93 -179
  106. package/dist/components/p-jGaWxggY.js.map +1 -0
  107. package/dist/components/p-jpGLgpoq.js +237 -0
  108. package/dist/components/p-jpGLgpoq.js.map +1 -0
  109. package/dist/esm/{index-J4NpPimy.js → index-DqqxAoZI.js} +47 -29
  110. package/dist/esm/index-DqqxAoZI.js.map +1 -0
  111. package/dist/esm/index-NiIEUDzj.js +2 -2
  112. package/dist/esm/index.js +1 -1
  113. package/dist/esm/{kritzel-brush-style_22.entry.js → kritzel-brush-style_23.entry.js} +502 -439
  114. package/dist/esm/loader.js +1 -1
  115. package/dist/esm/stencil.js +1 -1
  116. package/dist/stencil/index.esm.js +1 -1
  117. package/dist/stencil/p-DqqxAoZI.js +2 -0
  118. package/dist/stencil/p-DqqxAoZI.js.map +1 -0
  119. package/dist/stencil/p-eebdbf65.entry.js +2 -0
  120. package/dist/stencil/p-eebdbf65.entry.js.map +1 -0
  121. package/dist/stencil/stencil.esm.js +1 -1
  122. package/dist/types/classes/structures/object-map.structure.d.ts +11 -0
  123. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +3 -0
  124. package/dist/types/components/shared/kritzel-menu/kritzel-menu.d.ts +18 -18
  125. package/dist/types/components/shared/kritzel-menu-item/kritzel-menu-item.d.ts +26 -0
  126. package/dist/types/components/shared/kritzel-portal/kritzel-portal.d.ts +15 -10
  127. package/dist/types/components/shared/kritzel-split-button/kritzel-split-button.d.ts +25 -16
  128. package/dist/types/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.d.ts +18 -14
  129. package/dist/types/components.d.ts +90 -61
  130. package/dist/types/helpers/keyboard.helper.d.ts +1 -0
  131. package/dist/types/index.d.ts +1 -0
  132. package/dist/types/interfaces/engine-state.interface.d.ts +2 -2
  133. package/dist/types/interfaces/menu-item.interface.d.ts +21 -7
  134. package/package.json +1 -1
  135. package/dist/cjs/index-C7Read21.js.map +0 -1
  136. package/dist/collection/classes/structures/octree.structure.js +0 -115
  137. package/dist/collection/classes/structures/octree.structure.js.map +0 -1
  138. package/dist/components/p-B7VrEdgP.js.map +0 -1
  139. package/dist/components/p-BB22cVkU.js.map +0 -1
  140. package/dist/components/p-BmJbJwkH.js +0 -167
  141. package/dist/components/p-BmJbJwkH.js.map +0 -1
  142. package/dist/components/p-D-zg05gA.js.map +0 -1
  143. package/dist/components/p-DV4ERZv5.js +0 -112
  144. package/dist/components/p-DV4ERZv5.js.map +0 -1
  145. package/dist/components/p-hSuNJiIq.js +0 -152
  146. package/dist/components/p-hSuNJiIq.js.map +0 -1
  147. package/dist/components/p-sQmW5NRu.js +0 -156
  148. package/dist/components/p-sQmW5NRu.js.map +0 -1
  149. package/dist/esm/index-J4NpPimy.js.map +0 -1
  150. package/dist/stencil/p-4a0009e7.entry.js +0 -2
  151. package/dist/stencil/p-4a0009e7.entry.js.map +0 -1
  152. package/dist/stencil/p-J4NpPimy.js +0 -2
  153. package/dist/stencil/p-J4NpPimy.js.map +0 -1
  154. package/dist/types/classes/structures/octree.structure.d.ts +0 -18
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-CUSIflVf.js');
4
- var index$1 = require('./index-C7Read21.js');
4
+ var index$1 = require('./index-CfXjPLHb.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
 
@@ -204,14 +204,14 @@ const KritzelControlBrushConfig = class {
204
204
  this.toolChange.emit(this.tool);
205
205
  }
206
206
  render() {
207
- return (index.h(index.Host, { key: 'd099d1c6722678fdfb06c34eb0860e8819dd17ca' }, index.h("div", { key: '0856f0150666415ee452a0fcec5c76b6d25b82c4', style: {
207
+ return (index.h(index.Host, { key: 'a1f04aba4ed04e91c7b375e0f88bcff4fea1cba4' }, index.h("div", { key: 'c7cd734c96498c8cd6a27321fb6d11773e7aa8a9', style: {
208
208
  display: 'flex',
209
209
  flexDirection: 'row',
210
210
  alignItems: 'center',
211
211
  justifyContent: 'flex-start',
212
212
  width: '100%',
213
213
  gap: '8px',
214
- } }, index.h("kritzel-brush-style", { key: '364e6026d1b280a02c3618c7ded11f40c7e3cba4', type: this.tool.type, onTypeChange: event => this.handleTypeChange(event) }), index.h("button", { key: 'fc58c9ceb9e92ef8c79836e686b9a64653f91210', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand', style: this.palette.length > 6 ? { visibillity: 'visible' } : { visibility: 'hidden' } }, index.h("kritzel-icon", { key: 'ab219c72a9ace56853c725ba75767be2079a3c10', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), index.h("kritzel-color-palette", { key: '8757c754217a3de88dad2c465ff748571716ae64', colors: this.palette, selectedColor: this.tool.color, isExpanded: this.isExpanded, isOpaque: true, onColorChange: color => this.handleColorChange(color) }), index.h("kritzel-stroke-size", { key: '056b227dd9a92b06588816739b55a80f5ce80835', selectedSize: this.tool.size, onSizeChange: event => this.handleSizeChange(event) })));
214
+ } }, index.h("kritzel-brush-style", { key: '67958dc2a34302eb23fabbafea3c7dc7863f1984', type: this.tool.type, onTypeChange: event => this.handleTypeChange(event) }), index.h("button", { key: '5c84a72d9f337dff253a161abe19acb832275272', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand', style: this.palette.length > 6 ? { visibillity: 'visible' } : { visibility: 'hidden' } }, index.h("kritzel-icon", { key: 'b3e0c44db35b53a584757e18b507df09f30bfa8a', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), index.h("kritzel-color-palette", { key: 'eb098094ae69aa5901244f9686a3eb990271c07d', colors: this.palette, selectedColor: this.tool.color, isExpanded: this.isExpanded, isOpaque: true, onColorChange: color => this.handleColorChange(color) }), index.h("kritzel-stroke-size", { key: '18ae184b282ca2ec6511a6ac0065914edf66f91b', selectedSize: this.tool.size, onSizeChange: event => this.handleSizeChange(event) })));
215
215
  }
216
216
  static get watchers() { return {
217
217
  "tool": ["handleToolChange"]
@@ -243,14 +243,14 @@ const KritzelControlTextConfig = class {
243
243
  this.toolChange.emit(this.tool);
244
244
  }
245
245
  render() {
246
- return (index.h(index.Host, { key: 'f0d35cc43f1fe58a5a26f21dad99f1a733b66cce' }, index.h("div", { key: 'efc7d31c11460015a41185b4215e9ff45970abdd', style: {
246
+ return (index.h(index.Host, { key: 'a5c0e3eb4343637d758888d7d2a0843549fa0c25' }, index.h("div", { key: '1d4d42af117ed9da1a91d1747a7d6f6531e0de9b', style: {
247
247
  display: 'flex',
248
248
  flexDirection: 'row',
249
249
  alignItems: 'center',
250
250
  justifyContent: 'flex-start',
251
251
  width: '100%',
252
252
  gap: '8px',
253
- } }, index.h("kritzel-font-family", { key: '7f7d3ccb061d4b0e5e0f181ba4224f3de430a88c', selectedFontFamily: this.tool.fontFamily, onFontFamilyChange: event => this.handleFamilyChange(event) }), index.h("button", { key: '6676fcfa245874d54fa9933888c242c6f611c58c', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand' }, index.h("kritzel-icon", { key: '0734f636889c77f9087a2de2899a28ebd8df30a2', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), index.h("kritzel-color-palette", { key: '68373ef79578d6a73028da681f1e3b0e8e3e5874', colors: this.tool.palette, selectedColor: this.tool.fontColor, isExpanded: this.isExpanded, onColorChange: event => this.handleColorChange(event) }), index.h("kritzel-font-size", { key: '56e6828f6ceaac3d37910b7d092a30bacbd84519', selectedSize: this.tool.fontSize, fontFamily: this.tool.fontFamily, onSizeChange: event => this.handleSizeChange(event) })));
253
+ } }, index.h("kritzel-font-family", { key: 'b19e1edcbc7bafb0829d3e173d33cff37d2a5959', selectedFontFamily: this.tool.fontFamily, onFontFamilyChange: event => this.handleFamilyChange(event) }), index.h("button", { key: 'ca3dce970ee5dd1a7c8c617127777859b45380c4', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand' }, index.h("kritzel-icon", { key: '241d82cd06db8d20794a369a4df6e6a71531131a', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), index.h("kritzel-color-palette", { key: 'ec82e5c09046e70e904cc1ec9716c53bec9cac2b', colors: this.tool.palette, selectedColor: this.tool.fontColor, isExpanded: this.isExpanded, onColorChange: event => this.handleColorChange(event) }), index.h("kritzel-font-size", { key: '1cbddf6e6de21bd62f3803cca9e21ef9e01f15c0', selectedSize: this.tool.fontSize, fontFamily: this.tool.fontFamily, onSizeChange: event => this.handleSizeChange(event) })));
254
254
  }
255
255
  };
256
256
  KritzelControlTextConfig.style = kritzelControlTextConfigCss;
@@ -261,7 +261,7 @@ class KritzelDevicesHelper {
261
261
  }
262
262
  }
263
263
 
264
- 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 #ebebeb);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, #007AFF) !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, #ebebeb)}.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, #ebebeb)}.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}";
264
+ const kritzelControlsCss = ":host{display:flex;flex-direction:column;user-select:none}:host(.mobile){--kritzel-controls-control-hover-background-color:transparent;--kritzel-controls-control-active-background-color:transparent}.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 #ebebeb);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%))}.kritzel-control:active{background-color:var(--kritzel-controls-control-active-background-color, hsl(0, 0%, 0%, 8.6%))}.kritzel-control.selected,.kritzel-control.selected:hover,.kritzel-control.selected:active{background-color:var(--kritzel-controls-control-selected-background-color, #007AFF) !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, #ebebeb)}.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, #ebebeb)}.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}";
265
265
 
266
266
  const KritzelControls = class {
267
267
  constructor(hostRef) {
@@ -356,13 +356,13 @@ const KritzelControls = class {
356
356
  render() {
357
357
  var _a, _b;
358
358
  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;
359
- return (index.h(index.Host, { key: 'af04746b6eaa04a51482cd9d25ba3ab303d631f1', class: {
359
+ return (index.h(index.Host, { key: '7ab1f3e176848cb9a34be7e7b90e13c2a861d78b', class: {
360
360
  mobile: this.isTouchDevice,
361
- } }, this.isUtilityPanelVisible && (index.h("kritzel-utility-panel", { key: 'd6ecb1087a332162f3fc809ed4321fc48f72c3e7', style: {
361
+ } }, this.isUtilityPanelVisible && (index.h("kritzel-utility-panel", { key: 'f168b27cb9cc3a1a7d0028055cd58c60cec9776f', style: {
362
362
  position: 'absolute',
363
363
  bottom: '56px',
364
364
  left: '12px',
365
- }, 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: '34723e47249d53fd544848d2d577deba4df1f131', class: "kritzel-controls" }, this.controls.map(control => {
365
+ }, 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: '9e568217b23632d73b051350d7f795f0cd7ab9ed', class: "kritzel-controls" }, this.controls.map(control => {
366
366
  var _a, _b, _c, _d, _e, _f, _g, _h;
367
367
  if (control.type === 'tool') {
368
368
  return (index.h("button", { class: {
@@ -618,7 +618,7 @@ KritzelIconRegistry.registerIcons({
618
618
  const ABSOLUTE_SCALE_MAX = 1000;
619
619
  const ABSOLUTE_SCALE_MIN = 0.0001;
620
620
 
621
- const kritzelEditorCss = "kritzel-editor{display:flex;margin:0;position:relative;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}kritzel-workspace-manager{position:absolute;top:14px;left:14px}kritzel-controls{position:absolute;bottom:28px}";
621
+ const kritzelEditorCss = "kritzel-editor{display:flex;margin:0;position:relative;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}kritzel-workspace-manager{position:absolute;top:14px;left:14px}kritzel-split-button{position:absolute;top:14px;left:14px;z-index:1}kritzel-controls{position:absolute;bottom:28px}";
622
622
 
623
623
  const KritzelEditor = class {
624
624
  constructor(hostRef) {
@@ -710,6 +710,7 @@ const KritzelEditor = class {
710
710
  this.isControlsReady = false;
711
711
  this.isWorkspaceManagerReady = false;
712
712
  this.workspaces = [];
713
+ this.isVirtualKeyboardOpen = false;
713
714
  }
714
715
  onIsEngineReady(newValue) {
715
716
  if (newValue && this.isControlsReady) {
@@ -755,6 +756,7 @@ const KritzelEditor = class {
755
756
  }
756
757
  componentDidLoad() {
757
758
  this.registerCustomSvgIcons();
759
+ this.listenForMobileKeyboard();
758
760
  }
759
761
  async checkIsReady() {
760
762
  await customElements.whenDefined('kritzel-editor');
@@ -776,8 +778,14 @@ const KritzelEditor = class {
776
778
  KritzelIconRegistry.register(name, svg);
777
779
  }
778
780
  }
781
+ listenForMobileKeyboard() {
782
+ index$1.KritzelKeyboardHelper.onKeyboardVisibleChanged(isOpen => {
783
+ console.log('Mobile keyboard visibility changed:', isOpen);
784
+ this.isVirtualKeyboardOpen = isOpen;
785
+ });
786
+ }
779
787
  render() {
780
- return (index.h(index.Host, { key: '9fe00d70c1a875076e545ca447e2f8d817ebb2fd' }, index.h("kritzel-workspace-manager", { key: 'ca9ce9f8f277e92f78315e7eaba2bc523da5b9cb', workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => this.activeWorkspace = event.detail, onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), index.h("kritzel-engine", { key: '098a4690198f0678e7b4c6c897f86ad1698f510f', ref: el => (this.engineRef = el), workspace: this.activeWorkspace, scaleMax: this.scaleMax, scaleMin: this.scaleMin, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.workspaces = event.detail }), index.h("kritzel-controls", { key: 'e1795f5a7460617628c09766f213c212e48f25e5', ref: el => (this.controlsRef = el), controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, style: this.isControlsVisible ? { display: 'flex' } : { display: 'none' }, onIsControlsReady: () => (this.isControlsReady = true) })));
788
+ return (index.h(index.Host, { key: '0f51215c0ede25bf8edfbf1420fc8d6c64175b8a' }, index.h("kritzel-workspace-manager", { key: '14affeb4c161a401d9cca32d0681d576b67b5199', workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => this.activeWorkspace = event.detail, onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), index.h("kritzel-engine", { key: '0e96fdbfbe412ea0a0bae49c693190b71e78f112', ref: el => (this.engineRef = el), workspace: this.activeWorkspace, scaleMax: this.scaleMax, scaleMin: this.scaleMin, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.workspaces = event.detail }), index.h("kritzel-controls", { key: '6098132ddf95b5dd4b1a1a6492b31f0ef43693c4', style: { display: this.isVirtualKeyboardOpen ? 'none' : (this.isControlsVisible ? 'flex' : 'none') }, ref: el => (this.controlsRef = el), controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, onIsControlsReady: () => (this.isControlsReady = true) })));
781
789
  }
782
790
  get host() { return index.getElement(this); }
783
791
  static get watchers() { return {
@@ -1087,128 +1095,13 @@ class KritzelHistory {
1087
1095
  }
1088
1096
  }
1089
1097
 
1090
- class KritzelOctree {
1091
- constructor(bounds, capacity = 8) {
1092
- this.objects = [];
1093
- this.children = null;
1094
- this.bounds = bounds;
1095
- this.capacity = capacity;
1096
- }
1097
- reset() {
1098
- this.objects = [];
1099
- this.children = null;
1100
- }
1101
- insert(object) {
1102
- if (!this.intersects(object.rotatedBoundingBox, this.bounds)) {
1103
- return false;
1104
- }
1105
- if (this.objects.length < this.capacity && this.children === null) {
1106
- this.objects.push(object);
1107
- return true;
1108
- }
1109
- if (this.children === null) {
1110
- this.subdivide();
1111
- }
1112
- for (const child of this.children) {
1113
- if (child.insert(object)) {
1114
- return true;
1115
- }
1116
- }
1117
- return false;
1118
- }
1119
- update(object) {
1120
- const index = this.objects.findIndex(o => o.id === object.id);
1121
- if (index !== -1) {
1122
- this.objects[index] = object;
1123
- return true;
1124
- }
1125
- if (this.children !== null) {
1126
- for (const child of this.children) {
1127
- if (child.update(object)) {
1128
- return true;
1129
- }
1130
- }
1131
- }
1132
- return false;
1133
- }
1134
- remove(predicate) {
1135
- const index = this.objects.findIndex(o => predicate(o));
1136
- if (index !== -1) {
1137
- this.objects.splice(index, 1);
1138
- }
1139
- if (this.children !== null) {
1140
- for (const child of this.children) {
1141
- child.remove(predicate);
1142
- }
1143
- }
1144
- }
1145
- query(range) {
1146
- const results = [];
1147
- if (!this.intersects(range, this.bounds)) {
1148
- return results;
1149
- }
1150
- for (const object of this.objects) {
1151
- if (this.intersects(object.rotatedBoundingBox, range)) {
1152
- results.push(object);
1153
- }
1154
- }
1155
- if (this.children !== null) {
1156
- for (const child of this.children) {
1157
- results.push(...child.query(range));
1158
- }
1159
- }
1160
- return results;
1161
- }
1162
- filter(predicate) {
1163
- const results = this.objects.filter(o => predicate(o));
1164
- if (this.children !== null) {
1165
- for (const child of this.children) {
1166
- results.push(...child.filter(predicate));
1167
- }
1168
- }
1169
- return results;
1170
- }
1171
- allObjects() {
1172
- const results = [...this.objects];
1173
- if (this.children !== null) {
1174
- for (const child of this.children) {
1175
- results.push(...child.allObjects());
1176
- }
1177
- }
1178
- return results;
1179
- }
1180
- subdivide() {
1181
- const { x, y, z, width, height, depth } = this.bounds;
1182
- const halfWidth = width / 2;
1183
- const halfHeight = height / 2;
1184
- const halfDepth = depth / 2;
1185
- this.children = [
1186
- new KritzelOctree({ x, y, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1187
- new KritzelOctree({ x: x + halfWidth, y, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1188
- new KritzelOctree({ x, y: y + halfHeight, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1189
- new KritzelOctree({ x: x + halfWidth, y: y + halfHeight, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1190
- new KritzelOctree({ x, y, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1191
- new KritzelOctree({ x: x + halfWidth, y, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1192
- new KritzelOctree({ x, y: y + halfHeight, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1193
- new KritzelOctree({ x: x + halfWidth, y: y + halfHeight, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1194
- ];
1195
- }
1196
- intersects(a, b) {
1197
- return !(a.x >= b.x + b.width || // a is completely to the right of b
1198
- a.x + a.width <= b.x || // a is completely to the left of b
1199
- a.y >= b.y + b.height || // a is completely below b
1200
- a.y + a.height <= b.y // a is completely above b
1201
- );
1202
- }
1203
- }
1204
-
1205
1098
  const DEFAULT_ENGINE_STATE = {
1206
1099
  activeWorkspace: null,
1207
1100
  activeTool: null,
1208
1101
  activeText: null,
1209
1102
  currentPath: null,
1210
1103
  copiedObjects: null,
1211
- objectsOctree: null,
1104
+ objectsMap: null,
1212
1105
  selectionBox: null,
1213
1106
  selectionGroup: null,
1214
1107
  resizeHandleType: null,
@@ -1500,6 +1393,48 @@ class KritzelWorkspace {
1500
1393
  }
1501
1394
  }
1502
1395
 
1396
+ class KritzelObjectMap {
1397
+ constructor() {
1398
+ this.map = new Map();
1399
+ }
1400
+ reset() {
1401
+ this.map.clear();
1402
+ }
1403
+ insert(object) {
1404
+ if (!object.id) {
1405
+ return false;
1406
+ }
1407
+ this.map.set(object.id, object);
1408
+ return true;
1409
+ }
1410
+ update(object) {
1411
+ if (!object.id || !this.map.has(object.id)) {
1412
+ return false;
1413
+ }
1414
+ this.map.set(object.id, object);
1415
+ return true;
1416
+ }
1417
+ remove(predicate) {
1418
+ for (const [id, object] of this.map) {
1419
+ if (predicate(object)) {
1420
+ this.map.delete(id);
1421
+ }
1422
+ }
1423
+ }
1424
+ filter(predicate) {
1425
+ const results = [];
1426
+ for (const object of this.map.values()) {
1427
+ if (predicate(object)) {
1428
+ results.push(object);
1429
+ }
1430
+ }
1431
+ return results;
1432
+ }
1433
+ allObjects() {
1434
+ return Array.from(this.map.values());
1435
+ }
1436
+ }
1437
+
1503
1438
  class KritzelStore {
1504
1439
  get history() {
1505
1440
  return this._history;
@@ -1511,10 +1446,10 @@ class KritzelStore {
1511
1446
  return this._state;
1512
1447
  }
1513
1448
  get currentZIndex() {
1514
- return this._state.objectsOctree.filter(o => !(o instanceof index$1.KritzelSelectionGroup) && !(o instanceof index$1.KrtizelSelectionBox)).length;
1449
+ return this._state.objectsMap.filter(o => !(o instanceof index$1.KritzelSelectionGroup) && !(o instanceof index$1.KrtizelSelectionBox)).length;
1515
1450
  }
1516
1451
  get allObjects() {
1517
- return this._state.objectsOctree.allObjects();
1452
+ return this._state.objectsMap.allObjects();
1518
1453
  }
1519
1454
  get selectedObjects() {
1520
1455
  return this.allObjects.filter(o => !(o instanceof index$1.KritzelSelectionGroup)).filter(o => o.isSelected);
@@ -1535,14 +1470,7 @@ class KritzelStore {
1535
1470
  this._kritzelEngine = kritzelEngine;
1536
1471
  this._history = new KritzelHistory(this);
1537
1472
  this._database = new KritzelDatabase('kritzelDB', 1, this._state.debugInfo.logDatabase);
1538
- this._state.objectsOctree = new KritzelOctree({
1539
- x: -Infinity,
1540
- y: -Infinity,
1541
- z: -Infinity,
1542
- width: Infinity,
1543
- height: Infinity,
1544
- depth: Infinity,
1545
- });
1473
+ this._state.objectsMap = new KritzelObjectMap();
1546
1474
  }
1547
1475
  async initializeDatabase() {
1548
1476
  await this._database.open([
@@ -1574,13 +1502,13 @@ class KritzelStore {
1574
1502
  await this.initializeWorkspaceObjects(this._state.activeWorkspace.id);
1575
1503
  }
1576
1504
  async initializeWorkspaceObjects(workspaceId) {
1577
- this._state.objectsOctree.reset();
1505
+ this._state.objectsMap.reset();
1578
1506
  this._history.reset();
1579
1507
  const objectsFromDb = await this._database.getAllByRange('objects', IDBKeyRange.bound([workspaceId], [workspaceId, '\uffff']));
1580
1508
  const reviver = new index$1.KritzelReviver(this);
1581
1509
  objectsFromDb.forEach(element => {
1582
1510
  const revivedObject = reviver.revive(element);
1583
- this._state.objectsOctree.insert(revivedObject);
1511
+ this._state.objectsMap.insert(revivedObject);
1584
1512
  });
1585
1513
  this.rerender();
1586
1514
  }
@@ -1671,6 +1599,7 @@ class KritzelStore {
1671
1599
  const objectRange = IDBKeyRange.bound([workspace.id], [workspace.id, '\uffff']);
1672
1600
  await this._database.deleteByRange('objects', objectRange);
1673
1601
  await this._database.delete('workspaces', workspace.id);
1602
+ this.state.workspaces = this.state.workspaces.filter(ws => ws.id !== workspace.id);
1674
1603
  }
1675
1604
  rerender() {
1676
1605
  if (this._kritzelEngine) {
@@ -1796,15 +1725,8 @@ class KritzelStore {
1796
1725
  this.history.executeCommand(new index$1.AddSelectionGroupCommand(this, this, selectionGroup));
1797
1726
  }
1798
1727
  selectAllObjectsInViewport() {
1799
- const objectsInViewport = this._state.objectsOctree
1800
- .query({
1801
- x: -this._state.translateX / this._state.scale,
1802
- y: -this._state.translateY / this._state.scale,
1803
- z: this._state.scale,
1804
- width: this._state.viewportWidth / this._state.scale,
1805
- height: this._state.viewportHeight / this._state.scale,
1806
- depth: 100,
1807
- })
1728
+ const objectsInViewport = this._state.objectsMap
1729
+ .filter(o => o.isInViewport())
1808
1730
  .filter(o => !(o instanceof index$1.KritzelSelectionGroup) && !(o instanceof index$1.KrtizelSelectionBox) && !(o instanceof KritzelContextMenu));
1809
1731
  if (objectsInViewport.length > 0) {
1810
1732
  const selectionGroup = index$1.KritzelSelectionGroup.create(this);
@@ -2307,8 +2229,8 @@ const KritzelEngine = class {
2307
2229
  });
2308
2230
  }
2309
2231
  async deleteWorkspace(workspace) {
2310
- return this.store.deleteWorkspace(workspace).then(() => {
2311
- this.workspacesChange.emit(this.store.state.workspaces.filter(ws => ws.id !== workspace.id));
2232
+ return this.store.deleteWorkspace(workspace).then(async () => {
2233
+ this.workspacesChange.emit(this.store.state.workspaces);
2312
2234
  });
2313
2235
  }
2314
2236
  async getWorkspaces() {
@@ -2337,19 +2259,19 @@ const KritzelEngine = class {
2337
2259
  const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
2338
2260
  const baseHandleSize = parseFloat(baseHandleSizePx);
2339
2261
  const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
2340
- return (index.h(index.Host, { key: 'c7e747aa6106e7904cf9f44db37fa285a6fb4434' }, index.h("div", { key: 'b75652ab9f9531dce765cbe448ad3131c172d06a', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: 'fd1355bd640b9296949f6bbcf084589578654db6' }, "ActiveWorkspaceId: ", (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeWorkspace) === null || _b === void 0 ? void 0 :
2341
- _b.id), index.h("div", { key: '8520e3e774e97ebc42ee86401fbfbafbe41c88e8' }, "ActiveWorkspaceName: ", (_d = (_c = this.store.state) === null || _c === void 0 ? void 0 : _c.activeWorkspace) === null || _d === void 0 ? void 0 :
2342
- _d.name), index.h("div", { key: 'f247b4d76cd018e787a9b59829deedeb6c5c5272' }, "TranslateX: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
2343
- _e.translateX), index.h("div", { key: 'e0438479bc9e950ef2cbe88ed0aa0b8ec1888890' }, "TranslateY: ", (_f = this.store.state) === null || _f === void 0 ? void 0 :
2344
- _f.translateY), index.h("div", { key: '1735fde66588e285039bcc090dee71630608d666' }, "ViewportWidth: ", (_g = this.store.state) === null || _g === void 0 ? void 0 :
2345
- _g.viewportWidth), index.h("div", { key: '15f8b3305c27a395b8aa6463c5acec42bb3e3ddd' }, "ViewportHeight: ", (_h = this.store.state) === null || _h === void 0 ? void 0 :
2346
- _h.viewportHeight), index.h("div", { key: 'd2e39bae191c7256967d0140f38e75dccf95f24c' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: 'cd3f53ff4a8f119a2ef975133f69fc3798fe0f71' }, "Scale: ", (_j = this.store.state) === null || _j === void 0 ? void 0 :
2347
- _j.scale), index.h("div", { key: 'b1f8c77589a80fe49d0947602bda46438921f7a8' }, "ActiveTool: ", (_l = (_k = this.store.state) === null || _k === void 0 ? void 0 : _k.activeTool) === null || _l === void 0 ? void 0 :
2348
- _l.name), index.h("div", { key: '41cd94f58f71cd5c1cffc679ada5fc51f6ceeea7' }, "HasViewportChanged: ", ((_m = this.store.state) === null || _m === void 0 ? void 0 : _m.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: 'bf8495bb924673aad3a9ca57ed0bf9ac23874dfb' }, "IsEnabled: ", ((_o = this.store.state) === null || _o === void 0 ? void 0 : _o.isEnabled) ? 'true' : 'false'), index.h("div", { key: '3823936f5b46b100742f94fac8d7e87ed93ddb58' }, "IsScaling: ", ((_p = this.store.state) === null || _p === void 0 ? void 0 : _p.isScaling) ? 'true' : 'false'), index.h("div", { key: '62eb836fff78b050cdab8cbef54f88f9d5b644ba' }, "IsPanning: ", ((_q = this.store.state) === null || _q === void 0 ? void 0 : _q.isPanning) ? 'true' : 'false'), index.h("div", { key: 'dac6b8d18ae8f6317bdd318ad48a9612f9942613' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: 'af232e2cd738e255029f5611531c246ac63a28ce' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '95a44fef4b6befe95bfadfc62957103b48bf76b6' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: 'e8162d4de449a0d6756c2f540fca28353c193438' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: '4440d023cd4982c834736e06863698c3baf72353' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: 'd3e467dd18e53850df4d5bedf2b69f54b1fbe5c6' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: 'df6e4bca16cbe4346786a544d6f6c53d87bdb699' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '532aebf1ff35cc578f12e36cdaf00713ffc76b97' }, "PointerX: ", (_r = this.store.state) === null || _r === void 0 ? void 0 :
2349
- _r.pointerX), index.h("div", { key: 'f710f8c8d27979da4a40e50452e2cdd63cdefa98' }, "PointerY: ", (_s = this.store.state) === null || _s === void 0 ? void 0 :
2350
- _s.pointerY), index.h("div", { key: '0175010e1d5a22be81ca0b2d88dd1aff217eacfd' }, "SelectedObjects: ", ((_t = this.store.state.selectionGroup) === null || _t === void 0 ? void 0 : _t.objects.length) || 0)), index.h("div", { key: 'dc2964c479405ed147bd5f090e24262595a474e2', id: "origin", class: "origin", style: {
2262
+ return (index.h(index.Host, { key: 'fd353ff17bcde1a9ab646b6f463d1c6ce00a3dff' }, index.h("div", { key: '45bc2af8f1a3a2bfa3aa76a478c7bf208027da0c', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '50e932febc35c7dbe852ad99d96ca4f0e0b742fc' }, "ActiveWorkspaceId: ", (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeWorkspace) === null || _b === void 0 ? void 0 :
2263
+ _b.id), index.h("div", { key: 'af94b5061f0803588fece6cccdf540f46f13ca05' }, "ActiveWorkspaceName: ", (_d = (_c = this.store.state) === null || _c === void 0 ? void 0 : _c.activeWorkspace) === null || _d === void 0 ? void 0 :
2264
+ _d.name), index.h("div", { key: '89c0d21ce94f4eda72153554fadbd6942e785edc' }, "TranslateX: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
2265
+ _e.translateX), index.h("div", { key: '340b5165265241972a7a940268c7940063ba8c12' }, "TranslateY: ", (_f = this.store.state) === null || _f === void 0 ? void 0 :
2266
+ _f.translateY), index.h("div", { key: '428054b3ea4a1c327f03d6b37bfe6331dea6c57b' }, "ViewportWidth: ", (_g = this.store.state) === null || _g === void 0 ? void 0 :
2267
+ _g.viewportWidth), index.h("div", { key: 'd67420ef633627413066a28b8ef9ac43c520015d' }, "ViewportHeight: ", (_h = this.store.state) === null || _h === void 0 ? void 0 :
2268
+ _h.viewportHeight), index.h("div", { key: 'dedf9eb89c79fa496f7b6d0df9c646898f66b3d4' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: '59bb8416941fd84305f2892f24098f6f4a084401' }, "Scale: ", (_j = this.store.state) === null || _j === void 0 ? void 0 :
2269
+ _j.scale), index.h("div", { key: '6705a4cec22e4e33f75e296e17bc2952a3d1cba7' }, "ActiveTool: ", (_l = (_k = this.store.state) === null || _k === void 0 ? void 0 : _k.activeTool) === null || _l === void 0 ? void 0 :
2270
+ _l.name), index.h("div", { key: 'ca22e0a377a11fdca851b38f1bf425648cd3b9dd' }, "HasViewportChanged: ", ((_m = this.store.state) === null || _m === void 0 ? void 0 : _m.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: '57508b9ee24a5af631e6bb1eace404c39af14f82' }, "IsEnabled: ", ((_o = this.store.state) === null || _o === void 0 ? void 0 : _o.isEnabled) ? 'true' : 'false'), index.h("div", { key: 'f6cea367b5007f767afb25a033215abda734de9d' }, "IsScaling: ", ((_p = this.store.state) === null || _p === void 0 ? void 0 : _p.isScaling) ? 'true' : 'false'), index.h("div", { key: '4386ef749facd2e54da7f58aa2713b87ed76f2df' }, "IsPanning: ", ((_q = this.store.state) === null || _q === void 0 ? void 0 : _q.isPanning) ? 'true' : 'false'), index.h("div", { key: '1713185b36a50dfe0f9efa0c92394222db80a377' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '5104f428b808e7d843712302ad2e58b619876bee' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '2cb3b27a00627188e7082fa94169eb961a1ae6ed' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '7407656e61be665f27e706738faa6d318e2c1d04' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: '701bf05c25cb3d3728af6602f694e6064627ea59' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '772c345ea9c64ef800fdbb26919f1a54ca889025' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: 'dc687c8ba24182b8b61979ad334b989d3be72ec6' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '10cbc575a7905396a76eca4e7b56be719755aeb4' }, "PointerX: ", (_r = this.store.state) === null || _r === void 0 ? void 0 :
2271
+ _r.pointerX), index.h("div", { key: '4f21199328ffadddcc58b7d6b102a89e5079f676' }, "PointerY: ", (_s = this.store.state) === null || _s === void 0 ? void 0 :
2272
+ _s.pointerY), index.h("div", { key: 'ac705f38cb323b8dc8cbf95f875657c5dec5c9ae' }, "SelectedObjects: ", ((_t = this.store.state.selectionGroup) === null || _t === void 0 ? void 0 : _t.objects.length) || 0)), index.h("div", { key: '2ca55c53246e64520af6720a3f87d2357295ca7f', id: "origin", class: "origin", style: {
2351
2273
  transform: `matrix(${(_u = this.store.state) === null || _u === void 0 ? void 0 : _u.scale}, 0, 0, ${(_v = this.store.state) === null || _v === void 0 ? void 0 : _v.scale}, ${(_w = this.store.state) === null || _w === void 0 ? void 0 : _w.translateX}, ${(_x = this.store.state) === null || _x === void 0 ? void 0 : _x.translateY})`,
2352
- } }, (_y = this.store.state.objectsOctree.allObjects()) === null || _y === void 0 ? void 0 :
2274
+ } }, (_y = this.store.state.objectsMap.allObjects()) === null || _y === void 0 ? void 0 :
2353
2275
  _y.map(object => {
2354
2276
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2355
2277
  return (index.h("div", { key: object.id, style: { display: object.isInViewport() ? 'block' : 'none', transform: object === null || object === void 0 ? void 0 : object.transformationMatrix, transformOrigin: 'top left', zIndex: object.zIndex.toString(), position: 'absolute' } }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", id: object.id, class: "object", style: {
@@ -2450,7 +2372,7 @@ const KritzelEngine = class {
2450
2372
  fill: 'transparent',
2451
2373
  cursor: 'grab',
2452
2374
  }, visibility: object.isSelected && !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.isDebugInfoVisible ? '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), index.h("div", { style: { whiteSpace: 'nowrap' } }, "x: ", object.x), index.h("div", { style: { whiteSpace: 'nowrap' } }, "y: ", object.y)))))));
2453
- }), index.h("svg", { key: '86f9a08bea3ac2d261b14b2eec471fafd20ca11f', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
2375
+ }), index.h("svg", { key: '0098f1b8233d45f49dc8bdcc13c08f20c04b65e1', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
2454
2376
  height: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.height.toString(),
2455
2377
  width: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.width.toString(),
2456
2378
  left: '0',
@@ -2460,7 +2382,7 @@ const KritzelEngine = class {
2460
2382
  transform: (_2 = this.store.state.currentPath) === null || _2 === void 0 ? void 0 : _2.transformationMatrix,
2461
2383
  transformOrigin: 'top left',
2462
2384
  overflow: 'visible',
2463
- }, viewBox: (_3 = this.store.state.currentPath) === null || _3 === void 0 ? void 0 : _3.viewBox }, index.h("path", { key: '66ebcf1791c993d62b34a2e4da1d4279428a17dd', d: (_4 = this.store.state.currentPath) === null || _4 === void 0 ? void 0 : _4.d, fill: (_5 = this.store.state.currentPath) === null || _5 === void 0 ? void 0 : _5.fill, stroke: (_6 = this.store.state.currentPath) === null || _6 === void 0 ? void 0 : _6.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: 'af91784e3afc84b71d5186237d287c31d472d80a', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, objects: ((_7 = this.store.state.selectionGroup) === null || _7 === void 0 ? void 0 : _7.objects) || [], style: {
2385
+ }, viewBox: (_3 = this.store.state.currentPath) === null || _3 === void 0 ? void 0 : _3.viewBox }, index.h("path", { key: '08310713fa8f2f1f695b1b61bb2b6e5a5f77f192', d: (_4 = this.store.state.currentPath) === null || _4 === void 0 ? void 0 : _4.d, fill: (_5 = this.store.state.currentPath) === null || _5 === void 0 ? void 0 : _5.fill, stroke: (_6 = this.store.state.currentPath) === null || _6 === void 0 ? void 0 : _6.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: '2529447e26ba02689303be39cc593dfafc25b96c', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, objects: ((_7 = this.store.state.selectionGroup) === null || _7 === void 0 ? void 0 : _7.objects) || [], style: {
2464
2386
  position: 'fixed',
2465
2387
  left: `${this.store.state.contextMenuX}px`,
2466
2388
  top: `${this.store.state.contextMenuY}px`,
@@ -2472,7 +2394,7 @@ const KritzelEngine = class {
2472
2394
  y: (-this.store.state.translateY + this.store.state.contextMenuY) / this.store.state.scale,
2473
2395
  }, (_a = this.store.state.selectionGroup) === null || _a === void 0 ? void 0 : _a.objects);
2474
2396
  this.hideContextMenu();
2475
- } })), ((_8 = this.store.state) === null || _8 === void 0 ? void 0 : _8.activeTool) instanceof index$1.KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '573a4422b742044df5f240b260bc66e83d004520', store: this.store })));
2397
+ } })), ((_8 = this.store.state) === null || _8 === void 0 ? void 0 : _8.activeTool) instanceof index$1.KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '7c10277160eb1bc51581e4dfbdd4d0cdf626ed8c', store: this.store })));
2476
2398
  }
2477
2399
  get host() { return index.getElement(this); }
2478
2400
  static get watchers() { return {
@@ -2588,183 +2510,306 @@ const KritzelIcon = class {
2588
2510
  };
2589
2511
  KritzelIcon.style = kritzelIconCss;
2590
2512
 
2591
- const kritzelMenuCss = ":host{display:flex;flex-direction:column;min-width:180px;padding:var(--kritzel-controls-padding, 8px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 12px);box-shadow:var(--kritzel-controls-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-controls-border, 1px solid #ebebeb);z-index:2;gap:var(--kritzel-menu-item-gap, 4px);overflow-y:auto;scrollbar-color:#ebebeb transparent;scrollbar-width:thin}button{all:unset;background:transparent;border:0;padding:0;margin:0;font:inherit;color:inherit;line-height:inherit;text-align:inherit;cursor:pointer;appearance:none;-webkit-appearance:none;-moz-appearance:none;border-radius:0;-webkit-tap-highlight-color:transparent}button:focus{outline:none}:host(:focus){outline:none}.menu-item{display:flex;align-items:center;justify-content:space-between;padding:var(--kritzel-context-menu-item-padding, 8px);border-radius:var(--kritzel-context-menu-item-border-radius, 12px);cursor:pointer;font-family:sans-serif;font-size:var(--kritzel-context-menu-item-font-size, 14px);color:var(--kritzel-context-menu-item-color, #333333);gap:var(--kritzel-context-menu-item-gap, 12px)}.menu-item:focus,.menu-item:focus-within{outline:none;background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.menu-item-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.menu-item:not(.disabled):not(.inactive):not(.active):hover{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.menu-item:not(.disabled):not(.inactive):not(.active):active{background-color:var(--kritzel-context-menu-item-active-background-color, hsl(0, 0%, 0%, 8.6%))}.menu-item.active{color:var(--kritzel-controls-background-color, #ffffff);background-color:var(--kritzel-controls-control-selected-background-color, #007aff)}.menu-item.active kritzel-icon{filter:brightness(0) invert(1)}.menu-item.active:hover{background-color:var(--kritzel-controls-control-selected-hover-background-color, #0075f1)}.menu-item.disabled{color:var(--kritzel-context-menu-item-disabled-color, #aaaaaa);background-color:transparent;cursor:default}.menu-item.child-open{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%)) !important}.menu-item.active.menu-item.child-open{background-color:var(--kritzel-controls-control-selected-active-background-color, #0075f1) !important}.menu-item kritzel-icon{opacity:0.8;flex-shrink:0}.menu-item.disabled kritzel-icon{opacity:0.4}.menu-item.edit-mode input{background:transparent;border:none;outline:none;font-size:inherit;font-family:inherit;color:inherit;padding:0;width:100%;padding:2px 0px;border-bottom:1px solid var(--kritzel-context-menu-item-color, #333333)}.menu-item.active.edit-mode input{border-bottom:1px solid var(--kritzel-controls-background-color, #ffffff)}.menu-item.edit-mode input::selection{background-color:var(--kritzel-controls-control-selected-background-color, #007aff);border-radius:4px;color:var(--kritzel-controls-background-color, #ffffff)}.menu-item.active.edit-mode input::selection{background-color:var(--kritzel-menu-item-selected-input-background-color, #ffffff34)}.menu-item-button{background:transparent;border:none;outline:none;cursor:pointer;padding:4px;border-radius:8px;display:flex;align-items:center;justify-content:center}.menu-item-button:hover{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.menu-item-button:focus{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.edit-container,.view-container{width:100%;display:flex;align-items:center;justify-content:space-between;gap:var(--kritzel-context-menu-item-gap, 4px)}";
2513
+ const kritzelMenuCss = ":host{position:relative;display:flex;flex-direction:column;background-color:var(--kritzel-menu-background-color, #ffffff);width:var(--kritzel-menu-width, 180px);padding:var(--kritzel-menu-padding, 8px);border-radius:var(--kritzel-menu-border-radius, 12px);box-shadow:var(--kritzel-menu-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-menu-border, 1px solid #ebebeb);z-index:2;gap:var(--kritzel-menu-item-gap, 4px);overflow-y:auto;scrollbar-color:#ebebeb transparent;scrollbar-width:thin;max-height:300px}.has-open-child-overlay{position:absolute;top:0;left:0;right:0;bottom:0;z-index:3}";
2592
2514
 
2593
2515
  const KritzelMenu = class {
2594
2516
  constructor(hostRef) {
2595
2517
  index.registerInstance(this, hostRef);
2518
+ this.itemSelect = index.createEvent(this, "itemSelect");
2519
+ this.itemSave = index.createEvent(this, "itemSave");
2520
+ this.itemCancel = index.createEvent(this, "itemCancel");
2521
+ this.itemToggleChildMenu = index.createEvent(this, "itemToggleChildMenu");
2522
+ this.itemCloseChildMenu = index.createEvent(this, "itemCloseChildMenu");
2596
2523
  this.close = index.createEvent(this, "close");
2597
- this.items = [];
2598
- this.parentIndex = null;
2599
2524
  this.parent = null;
2600
- this.activeItemIndex = null;
2601
- this.editingIndex = null;
2602
- this.openChildMenuIndex = null;
2603
- this.childMenuAnchor = null;
2604
- this.cancelButton = null;
2605
- this.saveButton = null;
2606
- }
2607
- onEditingIndexChange(newValue) {
2608
- if (newValue === null) {
2609
- this.openChildMenuIndex = null;
2610
- this.editInput = undefined;
2611
- return;
2612
- }
2613
- }
2614
- handleWindowClick(event) {
2615
- if (this.openChildMenuIndex === null) {
2616
- return;
2617
- }
2618
- const target = event.target;
2619
- if (!this.host.contains(target)) {
2620
- this.openChildMenuIndex = null;
2621
- }
2622
- }
2623
- handleEscape(event) {
2624
- var _a;
2625
- if (event.key === 'Escape') {
2626
- if (this.openChildMenuIndex !== null) {
2627
- return;
2628
- }
2629
- if (this.editingIndex !== null) {
2630
- (_a = this.cancelButton) === null || _a === void 0 ? void 0 : _a.click();
2631
- return;
2632
- }
2633
- this.close.emit();
2634
- }
2525
+ this.selectedIndex = null;
2526
+ this.onOverlayClick = (event) => {
2527
+ event.stopPropagation();
2528
+ this.itemCloseChildMenu.emit(this.openChildMenuItem);
2529
+ };
2530
+ this.handleItemSelect = (event) => {
2531
+ event.stopPropagation();
2532
+ this.itemSelect.emit(event.detail);
2533
+ };
2534
+ this.handleSave = (event) => {
2535
+ event.stopPropagation();
2536
+ this.itemSave.emit(event.detail);
2537
+ };
2538
+ this.handleCancel = (event) => {
2539
+ event.stopPropagation();
2540
+ this.itemCancel.emit(event.detail);
2541
+ };
2542
+ this.handleToggleChildMenu = (event) => {
2543
+ event.stopPropagation();
2544
+ this.itemToggleChildMenu.emit(event.detail);
2545
+ };
2546
+ this.handleCloseChildMenu = (event) => {
2547
+ event.stopPropagation();
2548
+ this.itemCloseChildMenu.emit(event.detail);
2549
+ };
2635
2550
  }
2636
- handleEnter(event) {
2637
- var _a;
2638
- if (event.key === 'Enter') {
2639
- if (this.editingIndex !== null) {
2640
- (_a = this.saveButton) === null || _a === void 0 ? void 0 : _a.click();
2641
- return;
2642
- }
2551
+ async setFocus() {
2552
+ const firstItem = this.host.querySelector('kritzel-menu-item');
2553
+ if (firstItem) {
2554
+ firstItem.focus();
2643
2555
  }
2644
2556
  }
2645
- componentDidLoad() {
2646
- requestAnimationFrame(() => {
2647
- this.host.focus();
2648
- });
2649
- }
2650
- isViewMode(index) {
2651
- return this.editingIndex !== index;
2557
+ get openChildMenuItem() {
2558
+ return this.items.find(item => item.isChildMenuOpen);
2652
2559
  }
2653
- handleSelect(item) {
2654
- var _a;
2655
- if (item.disabled || this.editingIndex !== null || this.openChildMenuIndex !== null) {
2656
- return;
2657
- }
2658
- (_a = item.select) === null || _a === void 0 ? void 0 : _a.call(item, item);
2560
+ get editingMenuItem() {
2561
+ return this.items.find(item => item.isEditing);
2659
2562
  }
2660
2563
  render() {
2661
- return (index.h(index.Host, { key: '6d98c1d40c1af36b7b36c45ddc96fb89ab6ebdca', tabIndex: 0 }, this.items.map((item, index$1) => (index.h("button", { tabIndex: 0, class: {
2662
- 'menu-item': true,
2663
- 'disabled': item.disabled,
2664
- 'inactive': this.openChildMenuIndex !== null && this.openChildMenuIndex !== index$1,
2665
- 'child-open': this.openChildMenuIndex === index$1,
2666
- 'edit-mode': this.editingIndex === index$1,
2667
- 'active': this.activeItemIndex === index$1,
2668
- }, onClick: () => this.handleSelect(item) }, this.isViewMode(index$1) === true && (index.h("div", { class: "view-container" }, index.h("span", { class: "menu-item-label" }, item.label), index.h("div", null, item.children && item.children.length > 0 && (index.h("button", { class: "menu-item-button", tabIndex: 0, onClick: event => {
2669
- if (this.editingIndex !== null)
2670
- return;
2671
- event.stopPropagation();
2672
- this.childMenuAnchor = this.openChildMenuIndex === index$1 ? null : event.currentTarget;
2673
- this.openChildMenuIndex = this.openChildMenuIndex === index$1 ? null : index$1;
2674
- } }, index.h("kritzel-icon", { name: "ellipsis-vertical", size: 16 }))), this.openChildMenuIndex === index$1 && (index.h("kritzel-portal", { anchor: this.childMenuAnchor, offsetY: 4, onClose: () => this.openChildMenuIndex = null }, index.h("kritzel-menu", { style: { minWidth: '100px' }, items: item.children, parentIndex: index$1, parent: item, onClose: () => {
2675
- var _a;
2676
- this.openChildMenuIndex = null;
2677
- (_a = this.childMenuAnchor) === null || _a === void 0 ? void 0 : _a.focus();
2678
- } })))))), this.isViewMode(index$1) === false && (index.h("div", { class: "edit-container" }, index.h("input", { tabIndex: 0, ref: el => {
2679
- this.editInput = el;
2680
- requestAnimationFrame(() => {
2681
- var _a, _b;
2682
- (_a = this.editInput) === null || _a === void 0 ? void 0 : _a.focus();
2683
- (_b = this.editInput) === null || _b === void 0 ? void 0 : _b.select();
2684
- });
2685
- }, type: "text", name: 'menu-item-' + index$1, value: item.label, onInput: e => (item.label = e.target.value) }), index.h("div", { style: { display: 'flex', gap: '8px' } }, index.h("button", { ref: el => (this.cancelButton = el), class: "menu-item-button", tabIndex: 0, onClick: () => { var _a; return (_a = item.cancel) === null || _a === void 0 ? void 0 : _a.call(item, item); } }, index.h("kritzel-icon", { name: "x", size: 16 })), index.h("button", { ref: el => (this.saveButton = el), class: "menu-item-button", tabIndex: 0, onClick: () => { var _a; return (_a = item.save) === null || _a === void 0 ? void 0 : _a.call(item, item); } }, index.h("kritzel-icon", { name: "check", size: 16 }))))))))));
2564
+ return (index.h(index.Host, { key: 'c82bde4dc70fdc79df7471bb10396394f6c3870a', onClick: e => e.stopPropagation() }, this.openChildMenuItem && index.h("div", { key: '5fe0323aaa0da44abe736c6ef5e0516113c7820d', class: "has-open-child-overlay", onClick: this.onOverlayClick }), this.items.map((item) => (index.h("kritzel-menu-item", { key: item.id, item: item, parent: this.parent, style: { pointerEvents: this.editingMenuItem && !item.isEditing ? 'none' : 'auto' }, onItemSelect: this.handleItemSelect, onItemSave: this.handleSave, onItemCancel: this.handleCancel, onItemToggleChildMenu: this.handleToggleChildMenu, onItemCloseChildMenu: this.handleCloseChildMenu })))));
2686
2565
  }
2687
2566
  get host() { return index.getElement(this); }
2688
- static get watchers() { return {
2689
- "editingIndex": ["onEditingIndexChange"]
2690
- }; }
2691
2567
  };
2692
2568
  KritzelMenu.style = kritzelMenuCss;
2693
2569
 
2694
- class KritzelHTMLHelper {
2695
- static getNumericValueFromStyle(element, property) {
2696
- const value = window.getComputedStyle(element).getPropertyValue(property);
2697
- return parseFloat(value) || 0;
2570
+ const kritzelMenuItemCss = ":host{position:relative;display:flex;align-items:center;justify-content:space-between;width:100%;padding:var(--kritzel-menu-item-padding, 8px);box-sizing:border-box;gap:16px;height:var(--kritzel-menu-item-height, 40px);min-height:var(--kritzel-menu-item-min-height, 40px);font-family:sans-serif;font-size:var(--kritzel-menu-item-font-size, 14px);border-radius:var(--kritzel-menu-item-border-radius, 12px);outline:none;cursor:default}:host(:hover) .menu-item-overlay,:host(:focus-within) .menu-item-overlay{background-color:var(--kritzel-menu-item-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.selected){background-color:var(--kritzel-menu-item-selected-bg, #007aff);color:var(--kritzel-menu-item-selected-color, #ffffff)}:host(.selected) .action-button{color:var(--kritzel-menu-item-selected-color, #ffffff)}:host(.selected.editing){background-color:var(--kritzel-menu-item-selected-bg, #007aff)}:host(.selected) .edit-input{color:var(--kritzel-menu-item-selected-color, #ffffff)}:host(.selected) .edit-input::selection{background-color:var(--kritzel-menu-item-input-selection-color, rgba(255, 255, 255, 0.16))}:host(.editing){background-color:var(--kritzel-menu-item-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.disabled){opacity:0.5;pointer-events:none}:host(.child-open){background-color:var(--kritzel-menu-item-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.child-open.selected){background-color:var(--kritzel-menu-item-selected-bg, #007aff)}.menu-item-overlay{position:absolute;inset:0;background-color:transparent;z-index:0;pointer-events:none;border-radius:var(--kritzel-menu-item-border-radius, 12px)}.menu-item-content{display:flex;align-items:center;gap:8px;position:relative;z-index:1;height:100%}.left{justify-content:flex-start;flex:1}.right{justify-content:flex-end}.edit-input{flex:1;height:var(--kritzel-menu-item-input-height, 24px);padding:0;background-color:transparent;border-radius:0;border:none;border-bottom:1px solid var(--kritzel-menu-item-input-border, #ccc);font-size:var(--kritzel-context-menu-item-font-size, 14px);width:100%;min-width:0;box-sizing:border-box;outline:none}.edit-input::selection{background-color:var(--kritzel-menu-item-input-selection-color, #007bff);color:var(--kritzel-menu-item-input-selection-text-color, #ffffff)}.action-button{padding:4px;border-radius:8px;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;background-color:transparent;background:transparent;outline:none;-webkit-tap-highlight-color:transparent}.action-button:hover,.action-button:focus{background-color:var(--kritzel-menu-item-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.action-button.disabled{pointer-events:none;opacity:0.5}";
2571
+
2572
+ const KritzelMenuItem = class {
2573
+ constructor(hostRef) {
2574
+ index.registerInstance(this, hostRef);
2575
+ this.itemSelect = index.createEvent(this, "itemSelect");
2576
+ this.itemSave = index.createEvent(this, "itemSave");
2577
+ this.itemCancel = index.createEvent(this, "itemCancel");
2578
+ this.itemToggleChildMenu = index.createEvent(this, "itemToggleChildMenu");
2579
+ this.itemCloseChildMenu = index.createEvent(this, "itemCloseChildMenu");
2580
+ this.parent = null;
2581
+ this.isDirty = false;
2582
+ this.handleItemSelect = (event) => {
2583
+ event.stopPropagation();
2584
+ this.itemSelect.emit({ item: this.item, parent: this.parent });
2585
+ };
2586
+ this.handleInputChange = (event) => {
2587
+ event.stopPropagation();
2588
+ const target = event.target;
2589
+ this.item.label = target.value;
2590
+ this.isDirty = true;
2591
+ };
2592
+ this.handleSave = (event) => {
2593
+ event.stopPropagation();
2594
+ this.host.focus();
2595
+ this.itemSave.emit(this.item);
2596
+ };
2597
+ this.handleCancel = (event) => {
2598
+ event.stopPropagation();
2599
+ this.host.focus();
2600
+ this.itemCancel.emit(this.item);
2601
+ };
2602
+ this.handleMenuToggle = (event) => {
2603
+ event.stopPropagation();
2604
+ this.itemToggleChildMenu.emit({ item: this.item, childMenuAnchor: event.target });
2605
+ };
2606
+ this.handleMenuClose = () => {
2607
+ this.itemCloseChildMenu.emit(this.item);
2608
+ };
2698
2609
  }
2699
- static getScrollableParent(element) {
2700
- var _a, _b;
2701
- if (!element) {
2702
- return window;
2703
- }
2704
- const parent = (_b = (_a = element.parentNode) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : element.parentElement;
2705
- if (!parent || parent.tagName === 'BODY') {
2706
- return window;
2707
- }
2708
- const style = window.getComputedStyle(parent);
2709
- if (style.overflow === 'auto' || style.overflowY === 'auto' || style.overflow === 'scroll' || style.overflowY === 'scroll') {
2710
- return parent;
2610
+ onItemChange(newValue, oldValue) {
2611
+ if (newValue !== oldValue) {
2612
+ this.isDirty = false;
2711
2613
  }
2712
- return this.getScrollableParent(parent);
2713
2614
  }
2714
- static isElementInViewport(element) {
2715
- if (!element) {
2716
- return false;
2615
+ componentDidLoad() {
2616
+ if (this.item.isEditing && this.inputRef && !this.isDirty) {
2617
+ this.inputRef.focus();
2618
+ this.inputRef.select();
2717
2619
  }
2718
- const scrollableParent = this.getScrollableParent(element);
2719
- const rect = element.getBoundingClientRect();
2720
- if (scrollableParent === window) {
2721
- const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
2722
- const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
2723
- return rect.top >= 0 && rect.left >= 0 && rect.bottom <= viewportHeight && rect.right <= viewportWidth;
2620
+ }
2621
+ componentDidUpdate() {
2622
+ if (this.item.isEditing && this.inputRef && !this.isDirty) {
2623
+ this.inputRef.focus();
2624
+ this.inputRef.select();
2724
2625
  }
2725
- const parentRect = scrollableParent.getBoundingClientRect();
2726
- return rect.top >= parentRect.top && rect.left >= parentRect.left && rect.bottom <= parentRect.bottom && rect.right <= parentRect.right;
2727
2626
  }
2728
- }
2627
+ renderViewMode() {
2628
+ return [
2629
+ index.h("div", { class: "menu-item-content left" }, index.h("div", null, this.item.label)),
2630
+ index.h("div", { class: "menu-item-content right" }, this.item.children &&
2631
+ this.item.children.length > 0 && [
2632
+ index.h("button", { id: "child-menu-toggle", class: "action-button", onClick: this.handleMenuToggle, disabled: this.item.isDisabled }, index.h("kritzel-icon", { name: "ellipsis-vertical", size: 16 })),
2633
+ index.h("kritzel-portal", { anchor: this.item.childMenuAnchor, offsetY: 4, onClose: this.handleMenuClose }, index.h("kritzel-menu", { items: this.item.children, parent: this.item, onItemSelect: event => this.itemSelect.emit(event.detail), onItemSave: event => this.itemSave.emit(event.detail), onItemCancel: event => this.itemCancel.emit(event.detail), onClose: this.handleMenuClose })),
2634
+ ]),
2635
+ ];
2636
+ }
2637
+ renderEditMode() {
2638
+ return [
2639
+ index.h("div", { class: "menu-item-content left" }, index.h("input", { ref: el => (this.inputRef = el), type: "text", class: "edit-input", value: this.item.label, onInput: this.handleInputChange })),
2640
+ index.h("div", { class: "menu-item-content right" }, index.h("div", { tabIndex: !this.isDirty && !this.item.isNewItem ? -1 : 0, class: { 'action-button': true, 'disabled': !this.isDirty && !this.item.isNewItem }, onClick: this.handleSave }, index.h("kritzel-icon", { name: "check", size: 16 })), index.h("div", { tabIndex: 0, class: "action-button", onClick: this.handleCancel }, index.h("kritzel-icon", { name: "x", size: 16 }))),
2641
+ ];
2642
+ }
2643
+ render() {
2644
+ return (index.h(index.Host, { key: '5440ed43726d00ab65e7f423f065c1a3fa74e39e', tabIndex: 0, class: {
2645
+ 'selected': this.item.isSelected,
2646
+ 'editing': this.item.isEditing,
2647
+ 'disabled': this.item.isDisabled,
2648
+ 'child-open': this.item.isChildMenuOpen,
2649
+ }, onClick: this.handleItemSelect }, index.h("div", { key: '69542710179216a1df47bde5d474a72e4a07aa5b', class: "menu-item-overlay" }), this.item.isEditing ? this.renderEditMode() : this.renderViewMode()));
2650
+ }
2651
+ get host() { return index.getElement(this); }
2652
+ static get watchers() { return {
2653
+ "item": ["onItemChange"]
2654
+ }; }
2655
+ };
2656
+ KritzelMenuItem.style = kritzelMenuItemCss;
2729
2657
 
2730
- const DEFAULT_OFFSET = 0;
2731
- const MIN_LEFT_POSITION = 0;
2732
- const Z_INDEX = '9005';
2733
- const ID_PORTAL = 'portal';
2734
2658
  const KritzelPortal = class {
2735
2659
  constructor(hostRef) {
2736
2660
  index.registerInstance(this, hostRef);
2737
2661
  this.close = index.createEvent(this, "close");
2738
2662
  this.autoFocus = true;
2739
- this.moved = false;
2740
- this.handleScroll = () => {
2741
- const isAnchorInViewport = KritzelHTMLHelper.isElementInViewport(this.anchor);
2742
- if (!isAnchorInViewport) {
2743
- this.close.emit();
2744
- return;
2745
- }
2746
- this.calculatePosition();
2747
- };
2663
+ this.id = `portal-${index$1.ObjectHelper.generateUUID()}`;
2664
+ this.defaultOffset = 0;
2665
+ this.minLeft = 0;
2748
2666
  }
2749
2667
  anchorChanged(newValue) {
2750
2668
  if (newValue) {
2669
+ this.openPortal();
2751
2670
  this.calculatePosition();
2671
+ if (this.autoFocus) {
2672
+ this.focusFirstElement();
2673
+ }
2674
+ }
2675
+ else {
2676
+ this.closePortal();
2677
+ }
2678
+ }
2679
+ handleOutsideClick(event) {
2680
+ event.stopPropagation();
2681
+ const isLastPortal = this.lastAddedPortal === this.portal;
2682
+ if (!isLastPortal)
2683
+ return;
2684
+ const target = event.target;
2685
+ if (!this.host.contains(target)) {
2686
+ this.close.emit();
2687
+ this.closePortal();
2688
+ }
2689
+ }
2690
+ handleKeyDown(event) {
2691
+ event.stopPropagation();
2692
+ const isLastPortal = this.lastAddedPortal === this.portal;
2693
+ if (!isLastPortal)
2694
+ return;
2695
+ if (event.key === 'Escape') {
2696
+ this.anchor.focus();
2697
+ this.close.emit();
2698
+ this.closePortal();
2699
+ }
2700
+ if (event.key === 'Tab') {
2701
+ this.trapFocus(event);
2702
+ }
2703
+ if (event.key === 'Enter') {
2704
+ const activeElement = this.getDeepActiveElement();
2705
+ if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.click) {
2706
+ event.preventDefault();
2707
+ activeElement.click();
2708
+ }
2752
2709
  }
2753
2710
  }
2754
2711
  handleResize() {
2755
2712
  this.calculatePosition();
2756
2713
  }
2714
+ focusFirstElement() {
2715
+ requestAnimationFrame(() => {
2716
+ var _a, _b;
2717
+ (_b = (_a = this.firstFocusableElement) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
2718
+ });
2719
+ }
2720
+ getDeepActiveElement() {
2721
+ var _a;
2722
+ let activeEl = document.activeElement;
2723
+ while ((_a = activeEl === null || activeEl === void 0 ? void 0 : activeEl.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) {
2724
+ activeEl = activeEl.shadowRoot.activeElement;
2725
+ }
2726
+ return activeEl;
2727
+ }
2728
+ trapFocus(event) {
2729
+ const focusableElements = this.getFocusableElements(this.host);
2730
+ if (focusableElements.length === 0)
2731
+ return;
2732
+ const firstFocusable = focusableElements[0];
2733
+ const lastFocusable = focusableElements[focusableElements.length - 1];
2734
+ const activeElement = this.getDeepActiveElement();
2735
+ if (event.shiftKey) {
2736
+ /* shift + tab */
2737
+ if (activeElement === firstFocusable) {
2738
+ lastFocusable.focus();
2739
+ event.preventDefault();
2740
+ }
2741
+ }
2742
+ else {
2743
+ /* tab */
2744
+ if (activeElement === lastFocusable) {
2745
+ firstFocusable.focus();
2746
+ event.preventDefault();
2747
+ }
2748
+ }
2749
+ }
2750
+ getFocusableElements(root) {
2751
+ if (!root)
2752
+ return [];
2753
+ const focusableElements = [];
2754
+ const focusableSelector = 'a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details, [tabindex]:not([tabindex="-1"])';
2755
+ const isVisible = (el) => {
2756
+ return el.offsetParent !== null;
2757
+ };
2758
+ // Check if the root element itself is focusable
2759
+ if (root.matches(focusableSelector) && !root.hasAttribute('disabled') && isVisible(root)) {
2760
+ focusableElements.push(root);
2761
+ }
2762
+ // Function to recursively find focusable elements
2763
+ const findFocusable = (element) => {
2764
+ // Search in shadow root
2765
+ if (element.shadowRoot) {
2766
+ Array.from(element.shadowRoot.querySelectorAll(focusableSelector)).forEach(el => {
2767
+ if (isVisible(el)) {
2768
+ focusableElements.push(el);
2769
+ }
2770
+ });
2771
+ Array.from(element.shadowRoot.children).forEach(findFocusable);
2772
+ }
2773
+ // Search in light DOM
2774
+ Array.from(element.querySelectorAll(focusableSelector)).forEach(el => {
2775
+ if (!focusableElements.includes(el) && isVisible(el)) {
2776
+ focusableElements.push(el);
2777
+ }
2778
+ });
2779
+ // Handle slotted content
2780
+ if (element.tagName === 'SLOT') {
2781
+ element.assignedElements({ flatten: true }).forEach(el => findFocusable(el));
2782
+ }
2783
+ Array.from(element.children).forEach(findFocusable);
2784
+ };
2785
+ findFocusable(root);
2786
+ // Return unique elements in document order
2787
+ return [...new Set(focusableElements)];
2788
+ }
2789
+ get firstFocusableElement() {
2790
+ var _a, _b;
2791
+ const slotEl = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
2792
+ const firstAssigned = slotEl === null || slotEl === void 0 ? void 0 : slotEl.assignedElements({ flatten: true })[0];
2793
+ if (!firstAssigned)
2794
+ return null;
2795
+ const focusable = this.getFocusableElements(firstAssigned);
2796
+ return (_b = focusable[0]) !== null && _b !== void 0 ? _b : firstAssigned;
2797
+ }
2798
+ get lastAddedPortal() {
2799
+ const portals = Array.from(document.querySelectorAll('[id^="portal-"]'));
2800
+ return portals.length ? portals[portals.length - 1] : null;
2801
+ }
2757
2802
  calculateLeft() {
2758
2803
  var _a;
2759
2804
  if (!this.anchor || !this.portal)
2760
2805
  return 0;
2761
2806
  const refRect = this.anchor.getBoundingClientRect();
2762
2807
  const portalRect = this.portal.getBoundingClientRect();
2763
- const offset = (_a = this.offsetX) !== null && _a !== void 0 ? _a : DEFAULT_OFFSET;
2808
+ const offset = (_a = this.offsetX) !== null && _a !== void 0 ? _a : this.defaultOffset;
2764
2809
  let left = refRect.left + offset;
2765
- const maxLeft = window.innerWidth - portalRect.width - MIN_LEFT_POSITION;
2766
- if (left < MIN_LEFT_POSITION)
2767
- left = MIN_LEFT_POSITION;
2810
+ const maxLeft = window.innerWidth - portalRect.width - this.minLeft;
2811
+ if (left < this.minLeft)
2812
+ left = this.minLeft;
2768
2813
  if (left > maxLeft)
2769
2814
  left = maxLeft;
2770
2815
  return Math.round(left + window.scrollX);
@@ -2775,25 +2820,29 @@ const KritzelPortal = class {
2775
2820
  return 0;
2776
2821
  const refRect = this.anchor.getBoundingClientRect();
2777
2822
  const portalRect = this.portal.getBoundingClientRect();
2778
- const offset = (_a = this.offsetY) !== null && _a !== void 0 ? _a : DEFAULT_OFFSET;
2823
+ const offset = (_a = this.offsetY) !== null && _a !== void 0 ? _a : this.defaultOffset;
2779
2824
  let top = refRect.bottom + offset;
2780
2825
  if (top + portalRect.height > window.innerHeight) {
2781
2826
  top = refRect.top - portalRect.height - offset;
2782
2827
  }
2783
2828
  return Math.round(top + window.scrollY);
2784
2829
  }
2785
- createPortal() {
2830
+ openPortal() {
2786
2831
  this.portal = document.createElement('div');
2787
- this.portal.setAttribute('id', ID_PORTAL);
2788
- this.portal.style.zIndex = Z_INDEX;
2832
+ this.portal.setAttribute('id', this.id);
2833
+ this.portal.style.zIndex = '1';
2789
2834
  this.portal.style.position = 'absolute';
2790
2835
  this.portal.style.top = '0px';
2791
2836
  this.portal.style.left = '0px';
2837
+ this.portal.appendChild(this.host);
2792
2838
  document.body.append(this.portal);
2793
2839
  }
2794
- moveElementToPortal() {
2795
- this.portal.appendChild(this.element);
2796
- this.moved = true;
2840
+ closePortal() {
2841
+ const portal = document.getElementById(this.id);
2842
+ if (!portal)
2843
+ return;
2844
+ document.body.removeChild(portal);
2845
+ this.host.remove();
2797
2846
  }
2798
2847
  calculatePosition() {
2799
2848
  if (!this.anchor || !this.portal)
@@ -2803,86 +2852,80 @@ const KritzelPortal = class {
2803
2852
  this.portal.style.top = `${top}px`;
2804
2853
  this.portal.style.left = `${left}px`;
2805
2854
  }
2806
- componentWillLoad() {
2807
- this.createPortal();
2808
- }
2809
- componentDidLoad() {
2810
- var _a;
2811
- this.moveElementToPortal();
2812
- if (this.anchor) {
2813
- this.calculatePosition();
2814
- this.scrollableParent = KritzelHTMLHelper.getScrollableParent(this.anchor);
2815
- (_a = this.scrollableParent) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', this.handleScroll);
2816
- }
2817
- }
2818
- disconnectedCallback() {
2819
- var _a;
2820
- this.moved ? this.portal.remove() : (this.moved = true);
2821
- (_a = this.scrollableParent) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', this.handleScroll);
2822
- }
2823
2855
  render() {
2824
- return (index.h(index.Host, { key: 'e39525c3e9ddbf738b63ac0c08d8c1e2264783b1', ref: el => (this.element = el) }, index.h("slot", { key: '95202c5bea32c77dc1dde0a12a58ac9bcebd8812' })));
2856
+ return (index.h(index.Host, { key: '968f0360b9396da16f5b970293ba20f8a1dcc09a', style: { display: this.anchor ? 'block' : 'none' } }, index.h("slot", { key: '0fe1569bde60a834e9226d7c838d113a64151164' })));
2825
2857
  }
2858
+ get host() { return index.getElement(this); }
2826
2859
  static get watchers() { return {
2827
2860
  "anchor": ["anchorChanged"]
2828
2861
  }; }
2829
2862
  };
2830
2863
 
2831
- const kritzelSplitButtonCss = ":host{position:relative;display:flex;align-items:center;font-family:sans-serif;z-index:1;padding:var(--kritzel-controls-padding, 4px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 12px);box-shadow:var(--kritzel-controls-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-controls-border, 1px solid #ebebeb);gap:var(--kritzel-context-menu-item-gap, 4px)}:host(:focus){outline:none}button{border:none;background-color:transparent;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;text-align:center;display:flex;align-items:center;justify-content:center;pointer-events:all;-webkit-tap-highlight-color:transparent}.split-main-button,.split-menu-button{height:auto;display:flex;align-items:center;padding:var(--kritzel-controls-padding, 8px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 12px);font-size:var(--kritzel-context-menu-item-font-size, 14px)}.split-main-button:hover,.split-menu-button:hover{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.split-main-button:focus,.split-menu-button:focus{outline:none;background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.split-main-button{gap:var(--kritzel-context-menu-item-gap, 4px)}.split-menu-button{border-left:none;justify-content:center}.split-divider{width:var(--kritzel-controls-divider-width, 1px);height:24px;background-color:var(--kritzel-controls-divider-background-color, hsl(0, 0%, 0%, 4.3%))}";
2864
+ const kritzelSplitButtonCss = ":host{position:relative;display:flex;align-items:center;font-family:sans-serif;z-index:1;padding:var(--kritzel-controls-padding, 4px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 12px);box-shadow:var(--kritzel-controls-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-controls-border, 1px solid #ebebeb);gap:var(--kritzel-context-menu-item-gap, 4px)}:host(:focus){outline:none}:host(.mobile){--kritzel-context-menu-item-hover-background-color:transparent}button{border:none;background-color:transparent;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;text-align:center;display:flex;align-items:center;justify-content:center;pointer-events:all;-webkit-tap-highlight-color:transparent}.split-main-button,.split-menu-button{height:auto;display:flex;align-items:center;padding:var(--kritzel-controls-padding, 8px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 12px);font-size:var(--kritzel-context-menu-item-font-size, 14px)}.split-main-button:hover,.split-menu-button:hover{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.split-main-button:focus,.split-menu-button:focus{outline:none;background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.split-main-button{gap:var(--kritzel-context-menu-item-gap, 4px)}.split-menu-button{border-left:none;justify-content:center}.split-divider{width:var(--kritzel-controls-divider-width, 1px);height:24px;background-color:var(--kritzel-controls-divider-background-color, hsl(0, 0%, 0%, 4.3%))}:disabled{pointer-events:none;opacity:0.5}";
2832
2865
 
2833
2866
  const KritzelSplitButton = class {
2834
2867
  constructor(hostRef) {
2835
2868
  index.registerInstance(this, hostRef);
2836
2869
  this.buttonClick = index.createEvent(this, "buttonClick");
2837
- this.optionSelect = index.createEvent(this, "optionSelect");
2838
- this.menuOpened = index.createEvent(this, "menuOpened");
2839
- this.menuClosed = index.createEvent(this, "menuClosed");
2870
+ this.itemSelect = index.createEvent(this, "itemSelect");
2871
+ this.itemSave = index.createEvent(this, "itemSave");
2872
+ this.itemCancel = index.createEvent(this, "itemCancel");
2873
+ this.itemToggleChildMenu = index.createEvent(this, "itemToggleChildMenu");
2874
+ this.itemCloseChildMenu = index.createEvent(this, "itemCloseChildMenu");
2875
+ this.close = index.createEvent(this, "close");
2876
+ this.buttonIcon = 'plus';
2840
2877
  this.dropdownIcon = 'chevron-down';
2841
- this.options = [];
2842
- this.disabled = false;
2843
- this.activeItemIndex = null;
2844
- this.editingIndex = null;
2878
+ this.items = [];
2879
+ this.mainButtonDisabled = false;
2880
+ this.menuButtonDisabled = false;
2845
2881
  this.isMenuOpen = false;
2846
- this.handleDocumentClick = (event) => {
2847
- const path = (event.composedPath && event.composedPath()) || [];
2848
- const clickedInside = path.some(node => (node === null || node === void 0 ? void 0 : node.tagName) === 'KRITZEL-SPLIT-BUTTON' || (node === null || node === void 0 ? void 0 : node.tagName) === 'KRITZEL-MENU');
2849
- if (!clickedInside) {
2850
- this.closeMenu();
2851
- }
2852
- else if (this.isMenuOpen) {
2853
- document.addEventListener('click', this.handleDocumentClick, { once: true });
2854
- }
2882
+ this.isTouchDevice = KritzelDevicesHelper.isTouchDevice();
2883
+ this.handleButtonClick = (event) => {
2884
+ event.stopPropagation();
2885
+ this.buttonClick.emit();
2855
2886
  };
2856
- this.toggleMenu = () => {
2887
+ this.toggleMenu = (event) => {
2888
+ event.stopPropagation();
2857
2889
  if (this.isMenuOpen) {
2858
2890
  this.closeMenu();
2859
2891
  }
2860
2892
  else {
2861
- this.openMenu();
2893
+ this.openMenu(event);
2862
2894
  }
2863
2895
  };
2864
- this.handleButtonClick = () => {
2865
- if (!this.disabled) {
2866
- this.buttonClick.emit();
2867
- }
2896
+ this.openMenu = (event) => {
2897
+ event.stopPropagation();
2898
+ this.isMenuOpen = true;
2899
+ this.anchorElement = this.host;
2900
+ };
2901
+ this.closeMenu = () => {
2902
+ this.isMenuOpen = false;
2903
+ this.anchorElement = null;
2904
+ this.close.emit();
2905
+ };
2906
+ this.handleItemSelect = event => {
2907
+ this.itemSelect.emit(event.detail);
2908
+ };
2909
+ this.handleItemSave = event => {
2910
+ this.itemSave.emit(event.detail);
2911
+ };
2912
+ this.handleItemCancel = event => {
2913
+ this.itemCancel.emit(event.detail);
2914
+ };
2915
+ this.handleItemToggleChildMenu = event => {
2916
+ this.itemToggleChildMenu.emit(event.detail);
2917
+ };
2918
+ this.handleItemCloseChildMenu = event => {
2919
+ this.itemCloseChildMenu.emit(event.detail);
2868
2920
  };
2869
2921
  }
2870
- async openMenu() {
2871
- if (this.disabled || this.isMenuOpen)
2872
- return;
2873
- this.isMenuOpen = true;
2874
- this.menuOpened.emit();
2875
- document.addEventListener('click', this.handleDocumentClick, { once: true });
2876
- }
2877
- async closeMenu() {
2878
- if (this.disabled || !this.isMenuOpen)
2922
+ async open() {
2923
+ if (this.isMenuOpen)
2879
2924
  return;
2880
- this.isMenuOpen = false;
2881
- this.menuClosed.emit();
2882
- this.host.focus();
2925
+ this.openMenu(new MouseEvent('click'));
2883
2926
  }
2884
2927
  render() {
2885
- return (index.h(index.Host, { key: 'cf133b2867dffe6b9d70259c7d44b86342411d38', tabIndex: 0 }, index.h("button", { key: '3044cd9cbe02dde919a276b9f1d8f1f24b8514e9', class: "split-main-button", tabIndex: 0, onClick: this.handleButtonClick, disabled: this.disabled }, this.buttonIcon && index.h("kritzel-icon", { key: '4ed314f7288df567bb35a909c4919cf353788dd2', name: this.buttonIcon }), this.buttonText && (index.h("span", { key: '68b2148200e4698468aae137d16a4b5f17764f9f' }, this.buttonText, " (", this.options.length, ")"))), index.h("div", { key: '5047a2aea1d31e80fba8f6350e4b64572198c87d', class: "split-divider" }), index.h("button", { key: 'd7b33d9c717553d7cff3c3d2fafe90ce9dce1e67', ref: el => (this.splitMenuButton = el), class: "split-menu-button", tabIndex: 0, onClick: this.toggleMenu, disabled: this.disabled }, index.h("kritzel-icon", { key: 'a3d485aee5e9843c2d07d367a0d5743bfc8f3d5c', name: this.dropdownIcon })), index.h("kritzel-portal", { key: '2bb8f5c58884e6c73d3d7025a8e6efce770ab039', anchor: this.host, offsetY: 4 }, this.isMenuOpen && (index.h("kritzel-menu", { key: '3f2bb51a43ec78ff8664d5f625afa21cf9ecfb8c', style: { maxHeight: '300px', width: '180px' }, items: this.options, activeItemIndex: this.activeItemIndex, editingIndex: this.editingIndex, onClose: () => this.closeMenu() })))));
2928
+ return (index.h(index.Host, { key: 'be79d702d2c400d1feedeb89eca6fc78559f30f3', class: { mobile: this.isTouchDevice } }, index.h("button", { key: 'e4a74c56c122ea617f44f1d7e31672d1f913de46', class: "split-main-button", tabIndex: 0, onClick: this.handleButtonClick, disabled: this.mainButtonDisabled }, this.buttonIcon && index.h("kritzel-icon", { key: '44bd79270e7cc4a17b45133b5c513642013e5a66', name: this.buttonIcon })), index.h("div", { key: '2392e8c6f75510c529585a69c861b2fcafdef5ce', class: "split-divider" }), index.h("button", { key: 'bcdf61c2a195271771479de385db3b4982f6cad2', ref: el => (this.splitMenuButtonRef = el), class: "split-menu-button", tabIndex: 0, onClick: this.toggleMenu, disabled: this.menuButtonDisabled }, index.h("kritzel-icon", { key: '90383a8690111c97054fb8ac93b91cb6644de137', name: this.dropdownIcon })), index.h("kritzel-portal", { key: 'c6a4c32ab731fede13e1382bff9dbd68794b1103', anchor: this.anchorElement, offsetY: 4, onClose: this.closeMenu }, index.h("kritzel-menu", { key: '8b792c9a2d4af60ba464bb80551c5358e21bfa96', ref: el => (this.menuRef = el), items: this.items, onItemSelect: this.handleItemSelect, onItemSave: this.handleItemSave, onItemCancel: this.handleItemCancel, onItemToggleChildMenu: this.handleItemToggleChildMenu, onItemCloseChildMenu: this.handleItemCloseChildMenu, onClose: this.closeMenu }))));
2886
2929
  }
2887
2930
  get host() { return index.getElement(this); }
2888
2931
  };
@@ -2902,7 +2945,7 @@ const KritzelStrokeSize = class {
2902
2945
  this.sizeChange.emit(size);
2903
2946
  }
2904
2947
  render() {
2905
- return (index.h(index.Host, { key: '0185d3243c35c49169324c98f87df6a286fc3d31' }, this.sizes.map(size => (index.h("div", { class: {
2948
+ return (index.h(index.Host, { key: 'f9f0fe49963655a2beeffe5c369ccbe018c8aa5e' }, this.sizes.map(size => (index.h("div", { class: {
2906
2949
  'size-container': true,
2907
2950
  'selected': this.selectedSize === size,
2908
2951
  }, onClick: () => this.handleSizeClick(size) }, index.h("kritzel-color", { value: '#000000', size: size }))))));
@@ -2951,23 +2994,23 @@ const KritzelTooltip = class {
2951
2994
  }
2952
2995
  }
2953
2996
  render() {
2954
- return (index.h(index.Host, { key: '7610e8185e037813cc363daa3212a4164a20daaf', style: {
2997
+ return (index.h(index.Host, { key: '6eb67bcfd08234affe3724dff4d94ddf7907a1a7', style: {
2955
2998
  position: 'fixed',
2956
2999
  zIndex: '9999',
2957
3000
  transition: 'opacity 0.3s ease-in-out, transform 0.3s ease-in-out',
2958
3001
  visibility: this.isVisible ? 'visible' : 'hidden',
2959
3002
  left: !this.isMobileView ? `${this.positionX}px` : '50%',
2960
3003
  marginBottom: `${this.offsetY + this.arrowSize}px`,
2961
- } }, index.h("div", { key: 'bd5c1f0f7ff3afddfcf2469277189d026e79b453', class: "tooltip-content", onClick: event => event.stopPropagation() }, index.h("slot", { key: '547e5a8fcb8131225461881a1ad0125fa4b0d55b' }), index.h("div", { key: 'de1d30c31667a81a36873d32bec20fcc911ec89f', class: "tooltip-arrow-wrapper", style: {
3004
+ } }, index.h("div", { key: '9314b30b71200776e3728027b2ac7332cf4ab669', class: "tooltip-content", onClick: event => event.stopPropagation() }, index.h("slot", { key: '80cb8d0a8a91d9c816580cedc02fc9382fb07f8c' }), index.h("div", { key: '87fb2399463a0eb7beb1ca0f2c2867d8ff033f3a', class: "tooltip-arrow-wrapper", style: {
2962
3005
  position: 'fixed',
2963
3006
  left: this.arrowOffset,
2964
3007
  bottom: `-${this.arrowSize * 2}px`,
2965
- } }, index.h("div", { key: 'ebbf83bd4d35e252b0258a7c81ebcef48ac10004', class: "tooltip-arrow", style: {
3008
+ } }, index.h("div", { key: 'fc3953ad9b6aa5a4b2228653573fc3a7e37c0487', class: "tooltip-arrow", style: {
2966
3009
  borderLeft: `${this.arrowSize}px solid transparent`,
2967
3010
  borderRight: `${this.arrowSize}px solid transparent`,
2968
3011
  borderTop: `${this.arrowSize}px solid var(--kritzel-controls-tooltip-background-color, #ffffff)`,
2969
3012
  filter: 'drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2))',
2970
- } }), index.h("div", { key: '918ca46c438657dc4f72ccc73f81d58076d637c5', class: "tooltip-arrow-rect", style: {
3013
+ } }), index.h("div", { key: '5b8e4e3eb90c4c47c47fa47dc96e4149794e1732', class: "tooltip-arrow-rect", style: {
2971
3014
  position: 'relative',
2972
3015
  width: `${this.arrowSize * 2}px`,
2973
3016
  height: `${this.arrowSize}px`,
@@ -3001,7 +3044,7 @@ const KritzelUtilityPanel = class {
3001
3044
  this.redo.emit();
3002
3045
  }
3003
3046
  render() {
3004
- return (index.h(index.Host, { key: 'cf7b5c501b6535fda22b17ea218e90bd60223c6e' }, index.h("button", { key: '05db2cee7f2e191674167ef503e70718200bf904', class: "utility-button", onClick: event => this.handleUndo(event) }, index.h("kritzel-icon", { key: '10412c038b9d4e66851c8a0c9b51b99607bac397', name: "undo" })), index.h("button", { key: 'edf0289de8ce5cddd9341bc1855eae095274226c', class: "utility-button", onClick: event => this.handleRedo(event) }, index.h("kritzel-icon", { key: '46263e3d3f166b224c9a18ba383085e020fac51a', name: "redo" })), index.h("div", { key: '3a6c0eca21f44887683d6308ca5741b095eceb77', class: "utility-separator" }), index.h("button", { key: 'ced83e0c47fc920edabdc5b3379a8805f1827374', class: "utility-button" }, index.h("kritzel-icon", { key: 'd49c6412d778d34fe21e86482f2114631621106a', name: "delete", onClick: () => this.delete.emit() }))));
3047
+ return (index.h(index.Host, { key: '134058928a840d11fdc39849b35f08b21840fc0c' }, index.h("button", { key: '8d80cb496983b0709c06bacb12ca6819789aa47d', class: "utility-button", onClick: event => this.handleUndo(event) }, index.h("kritzel-icon", { key: 'c6733ef61ab6a272f80a580243fdd15063b8bf0c', name: "undo" })), index.h("button", { key: 'dc6147152bccd43ea54b9af20d019d305e550987', class: "utility-button", onClick: event => this.handleRedo(event) }, index.h("kritzel-icon", { key: '3ab8bced0f398a8d5f053cb0f388199fd2148bfc', name: "redo" })), index.h("div", { key: 'ebbfd25fb69faf2b669de20dc74a3dcabc01f489', class: "utility-separator" }), index.h("button", { key: 'd86caf8a7f2c2bc899b09871f555973137693eb9', class: "utility-button" }, index.h("kritzel-icon", { key: 'e1b4e9eef3d3ab2a2ddd1688818d4bcd2d7226c1', name: "delete", onClick: () => this.delete.emit() }))));
3005
3048
  }
3006
3049
  };
3007
3050
  KritzelUtilityPanel.style = kritzelUtilityPanelCss;
@@ -3014,52 +3057,14 @@ const KritzelWorkspaceManager = class {
3014
3057
  this.isWorkspaceManagerReady = index.createEvent(this, "isWorkspaceManagerReady");
3015
3058
  this.workspaceChange = index.createEvent(this, "workspaceChange");
3016
3059
  this.workspaces = [];
3017
- this.editingIndex = null;
3060
+ this.childMenuAnchor = null;
3061
+ this.openChildMenuItem = null;
3018
3062
  this.newWorkspace = null;
3019
- this.kritzelEngine = null;
3020
- this.handleNewWorkspace = async () => {
3021
- var _a;
3022
- await ((_a = this.splitButtonRef) === null || _a === void 0 ? void 0 : _a.openMenu());
3023
- requestAnimationFrame(() => {
3024
- this.newWorkspace = new KritzelWorkspace(index$1.ObjectHelper.generateUUID(), 'New Workspace');
3025
- this.editingIndex = 0;
3026
- });
3027
- };
3028
- this.handleMenuClosed = () => {
3029
- this.editingIndex = null;
3030
- this.newWorkspace = null;
3031
- };
3032
- this.handleSave = async (item) => {
3033
- const workspace = item.value;
3034
- const updatedWorkspace = Object.assign(Object.assign({}, workspace), { name: item.label });
3035
- if (this.newWorkspace) {
3036
- await this.kritzelEngine.createWorkspace(updatedWorkspace);
3037
- this.selectWorkspace(updatedWorkspace);
3038
- }
3039
- else {
3040
- await this.kritzelEngine.updateWorkspace(updatedWorkspace);
3041
- }
3042
- this.editingIndex = null;
3043
- this.newWorkspace = null;
3044
- };
3045
- this.handleRename = (index) => {
3046
- this.editingIndex = index;
3047
- };
3048
- this.handleDelete = async (workspaceToDelete) => {
3049
- var _a;
3050
- await this.kritzelEngine.deleteWorkspace(workspaceToDelete);
3051
- if (((_a = this.activeWorkspace) === null || _a === void 0 ? void 0 : _a.id) === workspaceToDelete.id) {
3052
- const newActiveWorkspace = this.sortedWorkspaces.find(w => w.id !== workspaceToDelete.id) || null;
3053
- this.selectWorkspace(newActiveWorkspace);
3054
- }
3055
- };
3063
+ this.editingItemId = null;
3064
+ this.kritzelEngineRef = null;
3056
3065
  }
3057
3066
  get sortedWorkspaces() {
3058
- const uniqueWorkspaces = [...new Map(this.workspaces.map(workspace => [workspace.id, workspace])).values()];
3059
- return [this.newWorkspace, ...uniqueWorkspaces].filter(ws => ws !== null).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
3060
- }
3061
- get activeItemIndex() {
3062
- return this.sortedWorkspaces.findIndex(ws => { var _a; return ws.id === ((_a = this.activeWorkspace) === null || _a === void 0 ? void 0 : _a.id); });
3067
+ return [this.newWorkspace, ...this.workspaces].filter(ws => ws != null).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
3063
3068
  }
3064
3069
  async componentWillLoad() {
3065
3070
  await this.initializeEngine();
@@ -3067,42 +3072,100 @@ const KritzelWorkspaceManager = class {
3067
3072
  }
3068
3073
  async initializeEngine() {
3069
3074
  await customElements.whenDefined('kritzel-engine');
3070
- this.kritzelEngine = this.host.parentElement.querySelector('kritzel-engine');
3071
- if (!this.kritzelEngine) {
3075
+ this.kritzelEngineRef = this.host.parentElement.querySelector('kritzel-engine');
3076
+ if (!this.kritzelEngineRef) {
3072
3077
  throw new Error('kritzel-engine not found in parent element.');
3073
3078
  }
3074
3079
  }
3075
- handleSelect(workspace) {
3076
- this.selectWorkspace(workspace);
3077
- }
3078
- selectWorkspace(workspace) {
3079
- if (this.editingIndex !== null)
3080
+ async select(item, parent) {
3081
+ if (this.editingItemId) {
3080
3082
  return;
3081
- this.activeWorkspace = this.sortedWorkspaces.find(ws => ws.id === workspace.id);
3082
- this.workspaceChange.emit(workspace);
3083
+ }
3084
+ if (item.action) {
3085
+ item.action(item, parent);
3086
+ return;
3087
+ }
3088
+ this.workspaceChange.emit(item.value);
3089
+ }
3090
+ async add() {
3091
+ this.newWorkspace = new KritzelWorkspace(index$1.ObjectHelper.generateUUID(), 'New Workspace');
3092
+ this.editingItemId = this.newWorkspace.id;
3093
+ await this.splitButtonRef.open();
3094
+ }
3095
+ edit(item) {
3096
+ this.openChildMenuItem = null;
3097
+ this.childMenuAnchor = null;
3098
+ requestAnimationFrame(() => {
3099
+ this.editingItemId = item.id;
3100
+ });
3101
+ }
3102
+ async save(item) {
3103
+ if (this.newWorkspace) {
3104
+ await this.kritzelEngineRef.createWorkspace(Object.assign(Object.assign({}, item.value), { name: item.label }));
3105
+ this.workspaceChange.emit(this.newWorkspace);
3106
+ }
3107
+ else {
3108
+ await this.kritzelEngineRef.updateWorkspace(Object.assign(Object.assign({}, item.value), { name: item.label }));
3109
+ }
3110
+ this.editingItemId = null;
3111
+ this.newWorkspace = null;
3112
+ }
3113
+ cancel() {
3114
+ this.newWorkspace = null;
3115
+ this.editingItemId = null;
3116
+ }
3117
+ async delete(item) {
3118
+ this.openChildMenuItem = null;
3119
+ this.childMenuAnchor = null;
3120
+ await this.kritzelEngineRef.deleteWorkspace(item.value);
3121
+ }
3122
+ toggleChildMenu(item, anchor) {
3123
+ this.openChildMenuItem = item;
3124
+ this.childMenuAnchor = anchor;
3125
+ }
3126
+ closeChildMenu() {
3127
+ this.openChildMenuItem = null;
3128
+ this.childMenuAnchor = null;
3129
+ }
3130
+ closeMenu() {
3131
+ this.cancel();
3132
+ this.closeChildMenu();
3083
3133
  }
3084
3134
  render() {
3085
- const workspaceSelectionOptions = this.sortedWorkspaces.map((ws, index) => ({
3086
- label: ws.name,
3087
- value: ws,
3088
- select: () => this.handleSelect(ws),
3089
- cancel: this.handleMenuClosed,
3090
- save: this.handleSave,
3091
- children: [
3092
- {
3093
- label: 'Rename',
3094
- value: 'rename',
3095
- select: () => this.handleRename(index),
3096
- },
3097
- {
3098
- label: 'Delete',
3099
- value: 'delete',
3100
- disabled: this.sortedWorkspaces.length <= 1,
3101
- select: () => this.handleDelete(ws),
3102
- },
3103
- ],
3104
- }));
3105
- return (index.h(index.Host, { key: '1703451717d5583d6520edfbcdbe38a5b8f6840f' }, index.h("kritzel-split-button", { key: 'efd5d9b714ee72b23fd28c9b20ea6985957fe9b9', ref: el => (this.splitButtonRef = el), buttonIcon: "plus", options: workspaceSelectionOptions, activeItemIndex: this.activeItemIndex, editingIndex: this.editingIndex, onButtonClick: this.handleNewWorkspace, onMenuClosed: this.handleMenuClosed })));
3135
+ console.log('render workspace manager');
3136
+ const menuItems = this.sortedWorkspaces
3137
+ .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())
3138
+ .filter(ws => ws !== null)
3139
+ .map(ws => {
3140
+ var _a, _b, _c, _d;
3141
+ return {
3142
+ id: ws.id,
3143
+ label: ws.name,
3144
+ value: ws,
3145
+ isEditing: this.editingItemId === ws.id,
3146
+ isSelected: ((_a = this.activeWorkspace) === null || _a === void 0 ? void 0 : _a.id) === ws.id,
3147
+ isNewItem: ((_b = this.newWorkspace) === null || _b === void 0 ? void 0 : _b.id) === ws.id,
3148
+ isChildMenuOpen: ((_c = this.openChildMenuItem) === null || _c === void 0 ? void 0 : _c.id) === ws.id,
3149
+ childMenuAnchor: ((_d = this.openChildMenuItem) === null || _d === void 0 ? void 0 : _d.id) === ws.id ? this.childMenuAnchor : null,
3150
+ children: [
3151
+ {
3152
+ id: `${ws.id}-rename`,
3153
+ label: 'Rename',
3154
+ value: 'rename',
3155
+ action: (_item, parent) => this.edit(parent),
3156
+ },
3157
+ {
3158
+ id: `${ws.id}-delete`,
3159
+ label: 'Delete',
3160
+ value: 'delete',
3161
+ action: (_item, parent) => this.delete(parent),
3162
+ },
3163
+ ],
3164
+ };
3165
+ });
3166
+ return (index.h(index.Host, null, index.h("kritzel-split-button", { ref: el => (this.splitButtonRef = el), items: menuItems, mainButtonDisabled: this.editingItemId != null, onButtonClick: () => this.add(), onItemSelect: event => this.select(event.detail.item, event.detail.parent), onItemToggleChildMenu: event => this.toggleChildMenu(event.detail.item, event.detail.childMenuAnchor), onItemSave: event => this.save(event.detail), onItemCancel: () => this.cancel(), onItemCloseChildMenu: () => this.closeChildMenu(), onClose: () => {
3167
+ this.closeMenu();
3168
+ } })));
3106
3169
  }
3107
3170
  get host() { return index.getElement(this); }
3108
3171
  };
@@ -3124,10 +3187,11 @@ exports.kritzel_font_family = KritzelFontFamily;
3124
3187
  exports.kritzel_font_size = KritzelFontSize;
3125
3188
  exports.kritzel_icon = KritzelIcon;
3126
3189
  exports.kritzel_menu = KritzelMenu;
3190
+ exports.kritzel_menu_item = KritzelMenuItem;
3127
3191
  exports.kritzel_portal = KritzelPortal;
3128
3192
  exports.kritzel_split_button = KritzelSplitButton;
3129
3193
  exports.kritzel_stroke_size = KritzelStrokeSize;
3130
3194
  exports.kritzel_tooltip = KritzelTooltip;
3131
3195
  exports.kritzel_utility_panel = KritzelUtilityPanel;
3132
3196
  exports.kritzel_workspace_manager = KritzelWorkspaceManager;
3133
- //# sourceMappingURL=kritzel-brush-style.kritzel-color.kritzel-color-palette.kritzel-context-menu.kritzel-control-brush-config.kritzel-control-text-config.kritzel-controls.kritzel-cursor-trail.kritzel-dropdown.kritzel-editor.kritzel-engine.kritzel-font.kritzel-font-family.kritzel-font-size.kritzel-icon.kritzel-menu.kritzel-portal.kritzel-split-button.kritzel-stroke-size.kritzel-tooltip.kritzel-utility-panel.kritzel-workspace-manager.entry.cjs.js.map
3197
+ //# sourceMappingURL=kritzel-brush-style.kritzel-color.kritzel-color-palette.kritzel-context-menu.kritzel-control-brush-config.kritzel-control-text-config.kritzel-controls.kritzel-cursor-trail.kritzel-dropdown.kritzel-editor.kritzel-engine.kritzel-font.kritzel-font-family.kritzel-font-size.kritzel-icon.kritzel-menu.kritzel-menu-item.kritzel-portal.kritzel-split-button.kritzel-stroke-size.kritzel-tooltip.kritzel-utility-panel.kritzel-workspace-manager.entry.cjs.js.map