kritzel-stencil 0.0.116 → 0.0.117
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.
- package/dist/cjs/kritzel-brush-style_18.cjs.entry.js +51 -24
- package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +77 -8
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +48 -12
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +6 -8
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-editor.js +38 -9
- package/dist/components/kritzel-editor.js.map +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/{p-o2f4ejEa.js → p-93b-eQ0s.js} +7 -9
- package/dist/components/p-93b-eQ0s.js.map +1 -0
- package/dist/components/{p-BAWNhoRC.js → p-DuWb7MaD.js} +22 -15
- package/dist/components/{p-BAWNhoRC.js.map → p-DuWb7MaD.js.map} +1 -1
- package/dist/esm/kritzel-brush-style_18.entry.js +51 -24
- package/dist/esm/kritzel-brush-style_18.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/p-6c35ba88.entry.js +2 -0
- package/dist/stencil/p-6c35ba88.entry.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +8 -2
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +1 -0
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +1 -2
- package/dist/types/components.d.ts +6 -4
- package/package.json +1 -1
- package/dist/components/p-o2f4ejEa.js.map +0 -1
- package/dist/stencil/p-b626c6a2.entry.js +0 -2
- package/dist/stencil/p-b626c6a2.entry.js.map +0 -1
|
@@ -349,7 +349,7 @@ const kritzelControlsCss = ":host{display:flex;flex-direction:column;user-select
|
|
|
349
349
|
const KritzelControls = class {
|
|
350
350
|
constructor(hostRef) {
|
|
351
351
|
index.registerInstance(this, hostRef);
|
|
352
|
-
this.
|
|
352
|
+
this.isControlsReady = index.createEvent(this, "isControlsReady");
|
|
353
353
|
this.controls = [];
|
|
354
354
|
this.activeControl = null;
|
|
355
355
|
this.firstConfig = null;
|
|
@@ -386,9 +386,7 @@ const KritzelControls = class {
|
|
|
386
386
|
async componentWillLoad() {
|
|
387
387
|
await this.initializeEngine();
|
|
388
388
|
await this.initializeTools();
|
|
389
|
-
|
|
390
|
-
componentDidLoad() {
|
|
391
|
-
this.controlsReady.emit();
|
|
389
|
+
this.isControlsReady.emit();
|
|
392
390
|
}
|
|
393
391
|
async initializeEngine() {
|
|
394
392
|
await customElements.whenDefined('kritzel-engine');
|
|
@@ -434,13 +432,13 @@ const KritzelControls = class {
|
|
|
434
432
|
render() {
|
|
435
433
|
var _a, _b;
|
|
436
434
|
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;
|
|
437
|
-
return (index.h(index.Host, { key: '
|
|
435
|
+
return (index.h(index.Host, { key: 'fecdf68cef50c38670d8117cd4da92b572c940a5', class: {
|
|
438
436
|
mobile: this.isTouchDevice,
|
|
439
|
-
} }, index.h("kritzel-utility-panel", { key: '
|
|
437
|
+
} }, index.h("kritzel-utility-panel", { key: '82c6af0d540137a2c24aac659f41e24b783b6555', style: {
|
|
440
438
|
position: 'absolute',
|
|
441
439
|
bottom: '56px',
|
|
442
440
|
left: '12px',
|
|
443
|
-
}, 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: '
|
|
441
|
+
}, 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: 'a59d0611b6cd88779b7b72970a0fda50c7808686', class: "kritzel-controls" }, this.controls.map(control => {
|
|
444
442
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
445
443
|
if (control.type === 'tool') {
|
|
446
444
|
return (index.h("button", { class: {
|
|
@@ -2120,6 +2118,18 @@ const KritzelEditor = class {
|
|
|
2120
2118
|
this.controls = DEFAULT_KRITZEL_CONTROLS;
|
|
2121
2119
|
this.customSvgIcons = {};
|
|
2122
2120
|
this.hideControls = false;
|
|
2121
|
+
this.isEngineReady = false;
|
|
2122
|
+
this.isControlsReady = false;
|
|
2123
|
+
}
|
|
2124
|
+
onIsEngineReady(newValue) {
|
|
2125
|
+
if (newValue && this.isControlsReady) {
|
|
2126
|
+
this.checkIsReady();
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
onIsControlsReady(newValue) {
|
|
2130
|
+
if (newValue && this.isEngineReady) {
|
|
2131
|
+
this.checkIsReady();
|
|
2132
|
+
}
|
|
2123
2133
|
}
|
|
2124
2134
|
async getObjectById(id) {
|
|
2125
2135
|
return this.engineRef.getObjectById(id);
|
|
@@ -2145,6 +2155,9 @@ const KritzelEditor = class {
|
|
|
2145
2155
|
async clearSelection() {
|
|
2146
2156
|
this.engineRef.clearSelection();
|
|
2147
2157
|
}
|
|
2158
|
+
async centerObjectInViewport(object) {
|
|
2159
|
+
return this.engineRef.centerObjectInViewport(object);
|
|
2160
|
+
}
|
|
2148
2161
|
handleTouchStart(event) {
|
|
2149
2162
|
if (event.cancelable) {
|
|
2150
2163
|
event.preventDefault();
|
|
@@ -2157,13 +2170,17 @@ const KritzelEditor = class {
|
|
|
2157
2170
|
(_a = this.controlsRef) === null || _a === void 0 ? void 0 : _a.closeTooltip();
|
|
2158
2171
|
}
|
|
2159
2172
|
}
|
|
2160
|
-
|
|
2173
|
+
componentDidLoad() {
|
|
2174
|
+
this.registerCustomSvgIcons();
|
|
2175
|
+
}
|
|
2176
|
+
async checkIsReady() {
|
|
2161
2177
|
await customElements.whenDefined('kritzel-editor');
|
|
2162
2178
|
await customElements.whenDefined('kritzel-controls');
|
|
2163
2179
|
await customElements.whenDefined('kritzel-engine');
|
|
2164
|
-
this.
|
|
2165
|
-
|
|
2166
|
-
|
|
2180
|
+
if (!this.isEngineReady || !this.isControlsReady) {
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
this.isReady.emit(this.host);
|
|
2167
2184
|
}
|
|
2168
2185
|
registerCustomSvgIcons() {
|
|
2169
2186
|
for (const [name, svg] of Object.entries(this.customSvgIcons)) {
|
|
@@ -2171,9 +2188,13 @@ const KritzelEditor = class {
|
|
|
2171
2188
|
}
|
|
2172
2189
|
}
|
|
2173
2190
|
render() {
|
|
2174
|
-
return (index.h(index.Host, { key: '
|
|
2191
|
+
return (index.h(index.Host, { key: '6621a06171194680b6df309dfa328e96ce7723c5' }, index.h("kritzel-engine", { key: '623628c15564168b8e508dbe45afbf2e5f5b1ed5', ref: el => (this.engineRef = el), onIsEngineReady: () => (this.isEngineReady = true) }), index.h("kritzel-controls", { key: 'dc56bb4c327d17236443c648fd3ca37eeaadc515', ref: el => (this.controlsRef = el), controls: this.controls, style: this.hideControls ? { display: 'none' } : { display: 'flex' }, onIsControlsReady: () => (this.isControlsReady = true) })));
|
|
2175
2192
|
}
|
|
2176
2193
|
get host() { return index.getElement(this); }
|
|
2194
|
+
static get watchers() { return {
|
|
2195
|
+
"isEngineReady": ["onIsEngineReady"],
|
|
2196
|
+
"isControlsReady": ["onIsControlsReady"]
|
|
2197
|
+
}; }
|
|
2177
2198
|
};
|
|
2178
2199
|
KritzelEditor.style = kritzelEditorCss;
|
|
2179
2200
|
|
|
@@ -3285,21 +3306,27 @@ const KritzelEngine = class {
|
|
|
3285
3306
|
async clearSelection() {
|
|
3286
3307
|
this.store.clearSelection();
|
|
3287
3308
|
}
|
|
3309
|
+
async centerObjectInViewport(object) {
|
|
3310
|
+
object.centerInViewport();
|
|
3311
|
+
const command = new UpdateObjectCommand(this.store, this, object, object);
|
|
3312
|
+
this.store.history.executeCommand(command);
|
|
3313
|
+
return object;
|
|
3314
|
+
}
|
|
3288
3315
|
render() {
|
|
3289
3316
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
3290
3317
|
const computedStyle = window.getComputedStyle(this.host);
|
|
3291
3318
|
const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
|
|
3292
3319
|
const baseHandleSize = parseFloat(baseHandleSizePx);
|
|
3293
3320
|
const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
|
|
3294
|
-
return (index.h(index.Host, { key: '
|
|
3295
|
-
_a.translateX), index.h("div", { key: '
|
|
3296
|
-
_b.translateY), index.h("div", { key: '
|
|
3297
|
-
_c.viewportWidth), index.h("div", { key: '
|
|
3298
|
-
_d.viewportHeight), index.h("div", { key: '
|
|
3299
|
-
_e.scale), index.h("div", { key: '
|
|
3300
|
-
_g.name), index.h("div", { key: '
|
|
3301
|
-
_m.cursorX), index.h("div", { key: '
|
|
3302
|
-
_o.cursorY)), index.h("div", { key: '
|
|
3321
|
+
return (index.h(index.Host, { key: '1a8a4ac086fd25b356d25f1c4f094005771a3d57' }, index.h("div", { key: '5edf7faeb5d63e8341fa81b48287eaee001ed163', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '356a8bb56abb4a9c98ab79f1d224a64e6c202a34' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
|
|
3322
|
+
_a.translateX), index.h("div", { key: 'e3d853e7e11c32bf5f801c29a0ed9add91ce24c3' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
|
|
3323
|
+
_b.translateY), index.h("div", { key: '7ada7c0c256bbdc79b2b74b391c87a319c9aaf05' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
|
|
3324
|
+
_c.viewportWidth), index.h("div", { key: '156ed10ab63bbacf30d549f115d82beeb6e714d5' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
|
|
3325
|
+
_d.viewportHeight), index.h("div", { key: '1cf8c42989b1c4117a4895f05686313e169b808e' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: '1e558a335a31c050c80cda3cd763267fe95335d2' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
|
|
3326
|
+
_e.scale), index.h("div", { key: 'ff43094ed2f27d2157946329cc4473d92c2d3e30' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
|
|
3327
|
+
_g.name), index.h("div", { key: '844c0e1dd8d77270419e3c0a0362536e6027f4cb' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: '64a782868924f27f9ef4d426694ddac338293bc5' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), index.h("div", { key: '4fc48b5006641e0ecb9af0d8cc5b4fe2868faa3d' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), index.h("div", { key: '1407e97aba7434599060b33ead00da898482cc6a' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), index.h("div", { key: 'f99a32e77014bf5548a5ae50a99ee4e6f6ae4801' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '0c7708d4a8dc78e171b9493b8b5ab2cfe2984ad6' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '5bca3b678ee83f2faba320dfbeb63af8d41b2908' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '2cecae3e2108ca108220ca7bb67777829cd223ef' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: 'd0cf8270f99ae6e8ce915a856e54ed7b38cd40aa' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '4f1a0bad54e9a4ad46fec56d7c692a48e02cb7a2' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: '9a4b3fdc05e103a2c73a7940bd9a84a68f912b14' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '5a480fdbe4a3fa435697bb94701971dda75f41d3' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
|
|
3328
|
+
_m.cursorX), index.h("div", { key: 'f549e8faa3ddad5b3294bb72f24ad3735539e84b' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
|
|
3329
|
+
_o.cursorY)), index.h("div", { key: 'e81679812ed19a50a09357549df00e590ae613b6', class: "origin", style: {
|
|
3303
3330
|
transform: `matrix(${(_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale}, 0, 0, ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale}, ${(_r = this.store.state) === null || _r === void 0 ? void 0 : _r.translateX}, ${(_s = this.store.state) === null || _s === void 0 ? void 0 : _s.translateY})`,
|
|
3304
3331
|
} }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
|
|
3305
3332
|
_t.map(object => {
|
|
@@ -3396,7 +3423,7 @@ const KritzelEngine = class {
|
|
|
3396
3423
|
fill: 'transparent',
|
|
3397
3424
|
cursor: 'grab',
|
|
3398
3425
|
}, visibility: object.selected && !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.debugInfoVisible ? '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)))))));
|
|
3399
|
-
}), index.h("svg", { key: '
|
|
3426
|
+
}), index.h("svg", { key: 'bf2c561803773e19aed36d418e96b9f797c305be', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
3400
3427
|
height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
|
|
3401
3428
|
width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
|
|
3402
3429
|
left: '0',
|
|
@@ -3406,12 +3433,12 @@ const KritzelEngine = class {
|
|
|
3406
3433
|
transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
|
|
3407
3434
|
transformOrigin: 'top left',
|
|
3408
3435
|
overflow: 'visible',
|
|
3409
|
-
}, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '
|
|
3436
|
+
}, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '5177dab02b9a5563129d00b80b99a1a198eb8ff5', d: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.d, fill: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.fill, stroke: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: 'ea3ae0531d9b2109e547baca7159ea29ebd34827', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
|
|
3410
3437
|
position: 'fixed',
|
|
3411
3438
|
left: `${this.store.state.contextMenuX}px`,
|
|
3412
3439
|
top: `${this.store.state.contextMenuY}px`,
|
|
3413
3440
|
zIndex: '10000',
|
|
3414
|
-
}, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '
|
|
3441
|
+
}, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: 'c785558a0f922d7caeacaeeb44a9492ebcc0be7d', store: this.store })));
|
|
3415
3442
|
}
|
|
3416
3443
|
get host() { return index.getElement(this); }
|
|
3417
3444
|
};
|