kritzel-stencil 0.0.111 → 0.0.112

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 +36 -27
  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 -3
  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 +44 -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-CB9PaoF-.js → p--2WHhuBI.js} +7 -5
  18. package/dist/components/{p-CB9PaoF-.js.map → p--2WHhuBI.js.map} +1 -1
  19. package/dist/components/{p-c5feBXbv.js → p-BnsTGnvc.js} +27 -26
  20. package/dist/components/p-BnsTGnvc.js.map +1 -0
  21. package/dist/esm/kritzel-brush-style_18.entry.js +36 -27
  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-65e86254.entry.js +2 -0
  26. package/dist/stencil/p-65e86254.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,25 @@ 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, _b;
1150
+ this.tooltipVisible = false;
1151
+ (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.enable();
1152
+ (_b = this.kritzelEngine) === null || _b === void 0 ? void 0 : _b.setFocus();
1153
+ }
1135
1154
  get activeToolAsTextTool() {
1136
1155
  var _a;
1137
1156
  return (_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.tool;
@@ -1173,25 +1192,6 @@ const KritzelControls = class {
1173
1192
  }
1174
1193
  }
1175
1194
  }
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
1195
  async handleControlClick(control) {
1196
1196
  this.activeControl = control;
1197
1197
  if (this.activeControl.type === 'tool') {
@@ -1210,18 +1210,18 @@ const KritzelControls = class {
1210
1210
  render() {
1211
1211
  var _a, _b;
1212
1212
  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: {
1213
+ return (index.h(index.Host, { key: 'b0ed601253a0f6187e601afd2fb56bdbc7d5a9cd', class: {
1214
1214
  mobile: this.isTouchDevice,
1215
- } }, index.h("kritzel-utility-panel", { key: '8b89423a1d1d4d93945f774f0867b2fd8bd4b0bf', style: {
1215
+ } }, index.h("kritzel-utility-panel", { key: 'a8621ccdc3186a3f6ac6d9b5aa9ee6d92401e5d9', style: {
1216
1216
  position: 'absolute',
1217
1217
  bottom: '56px',
1218
1218
  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 => {
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: 'ade9f5ee7b854eac1d4497c4f3e5e3cd6a2f1f7f', class: "kritzel-controls" }, this.controls.map(control => {
1220
1220
  var _a, _b, _c, _d, _e, _f, _g, _h;
1221
1221
  if (control.type === 'tool') {
1222
1222
  return (index.h("button", { class: {
1223
1223
  '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),
1224
+ 'selected': ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.name) === (control === null || control === void 0 ? void 0 : control.name),
1225
1225
  }, 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
1226
  }
1227
1227
  if (control.type === 'divider') {
@@ -2932,6 +2932,13 @@ const KritzelEditor = class {
2932
2932
  event.preventDefault();
2933
2933
  }
2934
2934
  }
2935
+ handleKeyDown(ev) {
2936
+ var _a;
2937
+ ev.preventDefault();
2938
+ if (ev.key === 'Escape') {
2939
+ (_a = this.controlsRef) === null || _a === void 0 ? void 0 : _a.closeTooltip();
2940
+ }
2941
+ }
2935
2942
  componentWillLoad() {
2936
2943
  this.registerCustomSvgIcons();
2937
2944
  }
@@ -2941,7 +2948,7 @@ const KritzelEditor = class {
2941
2948
  }
2942
2949
  }
2943
2950
  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' } })));
2951
+ return (index.h(index.Host, { key: 'b861ac259f78cf3a4a7070ce2e54a731414a8c08' }, index.h("kritzel-engine", { key: '026f2caba18bce0b0453b904616d9baa455592d9', ref: el => (this.engineRef = el) }), index.h("kritzel-controls", { key: 'afc78be61bfddeafd3650f7a383ad4a1847fa3b5', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' } })));
2945
2952
  }
2946
2953
  get host() { return index.getElement(this); }
2947
2954
  };
@@ -3661,10 +3668,8 @@ class KritzelKeyHandler extends KritzelBaseHandler {
3661
3668
  if (this._store.state.isFocused === false) {
3662
3669
  return;
3663
3670
  }
3671
+ event.preventDefault();
3664
3672
  this._store.state.isCtrlKeyPressed = event.ctrlKey;
3665
- if (this._store.state.isCtrlKeyPressed) {
3666
- event.preventDefault();
3667
- }
3668
3673
  if (event.key === 'Escape' && this._store.state.selectionGroup) {
3669
3674
  this._store.clearSelection();
3670
3675
  }
@@ -3740,6 +3745,10 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
3740
3745
  this.objectContextMenuItems = objectContextMenuItems;
3741
3746
  }
3742
3747
  handleContextMenu(event) {
3748
+ if (this._store.state.skipContextMenu) {
3749
+ this._store.state.skipContextMenu = false;
3750
+ return;
3751
+ }
3743
3752
  const selectedObject = this._store.getObjectFromPointerEvent(event, '.object');
3744
3753
  if (selectedObject && !(selectedObject instanceof KritzelSelectionGroup)) {
3745
3754
  this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);