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
@@ -1132,6 +1132,24 @@ const KritzelControls = class {
1132
1132
  this.isTouchDevice = KritzelDevicesHelper.isTouchDevice();
1133
1133
  this.kritzelEngine = null;
1134
1134
  }
1135
+ async handleActiveToolChange(event) {
1136
+ var _a;
1137
+ this.activeControl = this.controls.find(control => control.tool === event.detail) || null;
1138
+ await ((_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.setFocus());
1139
+ }
1140
+ handleClick(event) {
1141
+ const element = event.target;
1142
+ if (!this.kritzelEngine || element.closest('.kritzel-tooltip')) {
1143
+ return;
1144
+ }
1145
+ this.tooltipVisible = false;
1146
+ this.kritzelEngine.enable();
1147
+ }
1148
+ async closeTooltip() {
1149
+ var _a;
1150
+ this.tooltipVisible = false;
1151
+ (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.enable();
1152
+ }
1135
1153
  get activeToolAsTextTool() {
1136
1154
  var _a;
1137
1155
  return (_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.tool;
@@ -1173,25 +1191,6 @@ const KritzelControls = class {
1173
1191
  }
1174
1192
  }
1175
1193
  }
1176
- async handleActiveToolChange(event) {
1177
- var _a;
1178
- this.activeControl = this.controls.find(control => control.tool === event.detail) || null;
1179
- await ((_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.setFocus());
1180
- }
1181
- handleClick(event) {
1182
- const element = event.target;
1183
- if (!this.kritzelEngine || element.closest('.kritzel-tooltip')) {
1184
- return;
1185
- }
1186
- this.tooltipVisible = false;
1187
- this.kritzelEngine.enable();
1188
- }
1189
- preventDefault(event) {
1190
- if (event.cancelable) {
1191
- event.preventDefault();
1192
- event.stopPropagation();
1193
- }
1194
- }
1195
1194
  async handleControlClick(control) {
1196
1195
  this.activeControl = control;
1197
1196
  if (this.activeControl.type === 'tool') {
@@ -1210,18 +1209,18 @@ const KritzelControls = class {
1210
1209
  render() {
1211
1210
  var _a, _b;
1212
1211
  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;
1213
- return (index.h(index.Host, { key: 'e5bfc1952235cb3524849733015d14e629f36f9d', class: {
1212
+ return (index.h(index.Host, { key: 'c20b7cbc7228f1b13a7e17f7ea94c96151e11608', class: {
1214
1213
  mobile: this.isTouchDevice,
1215
- } }, index.h("kritzel-utility-panel", { key: '8b89423a1d1d4d93945f774f0867b2fd8bd4b0bf', style: {
1214
+ } }, index.h("kritzel-utility-panel", { key: '0e56c27c57d5cd7302ec80f6809fe4673afddae5', style: {
1216
1215
  position: 'absolute',
1217
1216
  bottom: '56px',
1218
1217
  left: '12px',
1219
- }, 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: '8b58a76ff194663f312cfe55fd3e29e78b8067d1', class: "kritzel-controls" }, this.controls.map(control => {
1218
+ }, onUndo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.undo(); }, onRedo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.redo(); }, onDelete: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.delete(); } }), index.h("div", { key: '6454509e3c524a42345e383270e3c1220f87dab6', class: "kritzel-controls" }, this.controls.map(control => {
1220
1219
  var _a, _b, _c, _d, _e, _f, _g, _h;
1221
1220
  if (control.type === 'tool') {
1222
1221
  return (index.h("button", { class: {
1223
1222
  'kritzel-control': true,
1224
- selected: ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.name) === (control === null || control === void 0 ? void 0 : control.name),
1223
+ 'selected': ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.name) === (control === null || control === void 0 ? void 0 : control.name),
1225
1224
  }, key: control.name, onClick: _event => { var _a; return (_a = this.handleControlClick) === null || _a === void 0 ? void 0 : _a.call(this, control); } }, index.h("kritzel-icon", { name: control.icon })));
1226
1225
  }
1227
1226
  if (control.type === 'divider') {
@@ -2932,6 +2931,13 @@ const KritzelEditor = class {
2932
2931
  event.preventDefault();
2933
2932
  }
2934
2933
  }
2934
+ handleKeyDown(event) {
2935
+ var _a;
2936
+ if (event.key === 'Escape') {
2937
+ event.preventDefault();
2938
+ (_a = this.controlsRef) === null || _a === void 0 ? void 0 : _a.closeTooltip();
2939
+ }
2940
+ }
2935
2941
  componentWillLoad() {
2936
2942
  this.registerCustomSvgIcons();
2937
2943
  }
@@ -2941,7 +2947,7 @@ const KritzelEditor = class {
2941
2947
  }
2942
2948
  }
2943
2949
  render() {
2944
- return (index.h(index.Host, { key: '74206218105a7675872539955729e9329573b83b' }, index.h("kritzel-engine", { key: '596be73738bdfcbd04472a3ffef2e7ace393c94e', ref: el => (this.engineRef = el) }), index.h("kritzel-controls", { key: '95701130a74395c27c07c56eb74294074261a8be', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' } })));
2950
+ return (index.h(index.Host, { key: '009fe43f85f368b2f60b31947596e1423f60e28d' }, index.h("kritzel-engine", { key: '76fa90e8c283723d546d02ab4eacc111047d6b9d', ref: el => (this.engineRef = el) }), index.h("kritzel-controls", { key: 'a7381534ab01236d12135f7a9f1a486c9b4be05a', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' } })));
2945
2951
  }
2946
2952
  get host() { return index.getElement(this); }
2947
2953
  };
@@ -3659,6 +3665,7 @@ class KritzelKeyHandler extends KritzelBaseHandler {
3659
3665
  }
3660
3666
  handleKeyDown(event) {
3661
3667
  if (this._store.state.isFocused === false) {
3668
+ event.preventDefault();
3662
3669
  return;
3663
3670
  }
3664
3671
  this._store.state.isCtrlKeyPressed = event.ctrlKey;
@@ -3740,6 +3747,10 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
3740
3747
  this.objectContextMenuItems = objectContextMenuItems;
3741
3748
  }
3742
3749
  handleContextMenu(event) {
3750
+ if (this._store.state.skipContextMenu) {
3751
+ this._store.state.skipContextMenu = false;
3752
+ return;
3753
+ }
3743
3754
  const selectedObject = this._store.getObjectFromPointerEvent(event, '.object');
3744
3755
  if (selectedObject && !(selectedObject instanceof KritzelSelectionGroup)) {
3745
3756
  this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);