kritzel-stencil 0.0.111 → 0.0.113

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 (34) hide show
  1. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js +35 -24
  2. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/stencil.cjs.js +1 -1
  5. package/dist/collection/classes/handlers/context-menu.handler.js +4 -0
  6. package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
  7. package/dist/collection/classes/handlers/key.handler.js +1 -0
  8. package/dist/collection/classes/handlers/key.handler.js.map +1 -1
  9. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +14 -1
  10. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
  11. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +43 -23
  12. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
  13. package/dist/components/kritzel-controls.js +1 -1
  14. package/dist/components/kritzel-editor.js +11 -4
  15. package/dist/components/kritzel-editor.js.map +1 -1
  16. package/dist/components/kritzel-engine.js +1 -1
  17. package/dist/components/{p-c5feBXbv.js → p-CFwf2KYj.js} +26 -26
  18. package/dist/components/p-CFwf2KYj.js.map +1 -0
  19. package/dist/components/{p-CB9PaoF-.js → p-DieKGjdj.js} +7 -2
  20. package/dist/components/{p-CB9PaoF-.js.map → p-DieKGjdj.js.map} +1 -1
  21. package/dist/esm/kritzel-brush-style_18.entry.js +35 -24
  22. package/dist/esm/kritzel-brush-style_18.entry.js.map +1 -1
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/stencil.js +1 -1
  25. package/dist/stencil/p-dc26eb80.entry.js +2 -0
  26. package/dist/stencil/p-dc26eb80.entry.js.map +1 -0
  27. package/dist/stencil/stencil.esm.js +1 -1
  28. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +1 -0
  29. package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +6 -6
  30. package/dist/types/components.d.ts +1 -0
  31. package/package.json +1 -1
  32. package/dist/components/p-c5feBXbv.js.map +0 -1
  33. package/dist/stencil/p-dc8da7cf.entry.js +0 -2
  34. package/dist/stencil/p-dc8da7cf.entry.js.map +0 -1
@@ -1130,6 +1130,24 @@ const KritzelControls = class {
1130
1130
  this.isTouchDevice = KritzelDevicesHelper.isTouchDevice();
1131
1131
  this.kritzelEngine = null;
1132
1132
  }
1133
+ async handleActiveToolChange(event) {
1134
+ var _a;
1135
+ this.activeControl = this.controls.find(control => control.tool === event.detail) || null;
1136
+ await ((_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.setFocus());
1137
+ }
1138
+ handleClick(event) {
1139
+ const element = event.target;
1140
+ if (!this.kritzelEngine || element.closest('.kritzel-tooltip')) {
1141
+ return;
1142
+ }
1143
+ this.tooltipVisible = false;
1144
+ this.kritzelEngine.enable();
1145
+ }
1146
+ async closeTooltip() {
1147
+ var _a;
1148
+ this.tooltipVisible = false;
1149
+ (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.enable();
1150
+ }
1133
1151
  get activeToolAsTextTool() {
1134
1152
  var _a;
1135
1153
  return (_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.tool;
@@ -1171,25 +1189,6 @@ const KritzelControls = class {
1171
1189
  }
1172
1190
  }
1173
1191
  }
1174
- async handleActiveToolChange(event) {
1175
- var _a;
1176
- this.activeControl = this.controls.find(control => control.tool === event.detail) || null;
1177
- await ((_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.setFocus());
1178
- }
1179
- handleClick(event) {
1180
- const element = event.target;
1181
- if (!this.kritzelEngine || element.closest('.kritzel-tooltip')) {
1182
- return;
1183
- }
1184
- this.tooltipVisible = false;
1185
- this.kritzelEngine.enable();
1186
- }
1187
- preventDefault(event) {
1188
- if (event.cancelable) {
1189
- event.preventDefault();
1190
- event.stopPropagation();
1191
- }
1192
- }
1193
1192
  async handleControlClick(control) {
1194
1193
  this.activeControl = control;
1195
1194
  if (this.activeControl.type === 'tool') {
@@ -1208,18 +1207,18 @@ const KritzelControls = class {
1208
1207
  render() {
1209
1208
  var _a, _b;
1210
1209
  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;
1211
- return (h(Host, { key: 'e5bfc1952235cb3524849733015d14e629f36f9d', class: {
1210
+ return (h(Host, { key: 'c20b7cbc7228f1b13a7e17f7ea94c96151e11608', class: {
1212
1211
  mobile: this.isTouchDevice,
1213
- } }, h("kritzel-utility-panel", { key: '8b89423a1d1d4d93945f774f0867b2fd8bd4b0bf', style: {
1212
+ } }, h("kritzel-utility-panel", { key: '0e56c27c57d5cd7302ec80f6809fe4673afddae5', style: {
1214
1213
  position: 'absolute',
1215
1214
  bottom: '56px',
1216
1215
  left: '12px',
1217
- }, 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(); } }), h("div", { key: '8b58a76ff194663f312cfe55fd3e29e78b8067d1', class: "kritzel-controls" }, this.controls.map(control => {
1216
+ }, 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(); } }), h("div", { key: '6454509e3c524a42345e383270e3c1220f87dab6', class: "kritzel-controls" }, this.controls.map(control => {
1218
1217
  var _a, _b, _c, _d, _e, _f, _g, _h;
1219
1218
  if (control.type === 'tool') {
1220
1219
  return (h("button", { class: {
1221
1220
  'kritzel-control': true,
1222
- selected: ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.name) === (control === null || control === void 0 ? void 0 : control.name),
1221
+ 'selected': ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.name) === (control === null || control === void 0 ? void 0 : control.name),
1223
1222
  }, key: control.name, onClick: _event => { var _a; return (_a = this.handleControlClick) === null || _a === void 0 ? void 0 : _a.call(this, control); } }, h("kritzel-icon", { name: control.icon })));
1224
1223
  }
1225
1224
  if (control.type === 'divider') {
@@ -2930,6 +2929,13 @@ const KritzelEditor = class {
2930
2929
  event.preventDefault();
2931
2930
  }
2932
2931
  }
2932
+ handleKeyDown(event) {
2933
+ var _a;
2934
+ if (event.key === 'Escape') {
2935
+ event.preventDefault();
2936
+ (_a = this.controlsRef) === null || _a === void 0 ? void 0 : _a.closeTooltip();
2937
+ }
2938
+ }
2933
2939
  componentWillLoad() {
2934
2940
  this.registerCustomSvgIcons();
2935
2941
  }
@@ -2939,7 +2945,7 @@ const KritzelEditor = class {
2939
2945
  }
2940
2946
  }
2941
2947
  render() {
2942
- return (h(Host, { key: '74206218105a7675872539955729e9329573b83b' }, h("kritzel-engine", { key: '596be73738bdfcbd04472a3ffef2e7ace393c94e', ref: el => (this.engineRef = el) }), h("kritzel-controls", { key: '95701130a74395c27c07c56eb74294074261a8be', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' } })));
2948
+ return (h(Host, { key: '009fe43f85f368b2f60b31947596e1423f60e28d' }, h("kritzel-engine", { key: '76fa90e8c283723d546d02ab4eacc111047d6b9d', ref: el => (this.engineRef = el) }), h("kritzel-controls", { key: 'a7381534ab01236d12135f7a9f1a486c9b4be05a', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' } })));
2943
2949
  }
2944
2950
  get host() { return getElement(this); }
2945
2951
  };
@@ -3657,6 +3663,7 @@ class KritzelKeyHandler extends KritzelBaseHandler {
3657
3663
  }
3658
3664
  handleKeyDown(event) {
3659
3665
  if (this._store.state.isFocused === false) {
3666
+ event.preventDefault();
3660
3667
  return;
3661
3668
  }
3662
3669
  this._store.state.isCtrlKeyPressed = event.ctrlKey;
@@ -3738,6 +3745,10 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
3738
3745
  this.objectContextMenuItems = objectContextMenuItems;
3739
3746
  }
3740
3747
  handleContextMenu(event) {
3748
+ if (this._store.state.skipContextMenu) {
3749
+ this._store.state.skipContextMenu = false;
3750
+ return;
3751
+ }
3741
3752
  const selectedObject = this._store.getObjectFromPointerEvent(event, '.object');
3742
3753
  if (selectedObject && !(selectedObject instanceof KritzelSelectionGroup)) {
3743
3754
  this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);