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