kritzel-stencil 0.1.78 → 0.1.80
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/{index-BRZ6e6oa.js → index-CFnj_FXt.js} +36 -9
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kritzel-active-users_42.cjs.entry.js +333 -177
- package/dist/cjs/kritzel-brush-style.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stencil.cjs.js +3 -3
- package/dist/cjs/{workspace.migrations-sUPrO23c.js → workspace.migrations-DUXtSb7C.js} +244 -197
- package/dist/collection/classes/core/core.class.js +39 -31
- package/dist/collection/classes/core/store.class.js +57 -16
- package/dist/collection/classes/core/viewport.class.js +12 -12
- package/dist/collection/classes/handlers/context-menu.handler.js +1 -1
- package/dist/collection/classes/handlers/line-handle.handler.js +7 -4
- package/dist/collection/classes/handlers/move.handler.js +11 -8
- package/dist/collection/classes/handlers/resize.handler.js +12 -3
- package/dist/collection/classes/handlers/rotation.handler.js +12 -3
- package/dist/collection/classes/handlers/selection.handler.js +20 -15
- package/dist/collection/classes/managers/anchor.manager.js +4 -4
- package/dist/collection/classes/objects/base-object.class.js +6 -6
- package/dist/collection/classes/objects/custom-element.class.js +2 -2
- package/dist/collection/classes/objects/group.class.js +10 -10
- package/dist/collection/classes/objects/image.class.js +2 -2
- package/dist/collection/classes/objects/line.class.js +7 -7
- package/dist/collection/classes/objects/path.class.js +5 -5
- package/dist/collection/classes/objects/selection-box.class.js +1 -1
- package/dist/collection/classes/objects/selection-group.class.js +16 -16
- package/dist/collection/classes/objects/shape.class.js +37 -31
- package/dist/collection/classes/objects/text.class.js +40 -32
- package/dist/collection/classes/structures/app-state-map.structure.js +18 -16
- package/dist/collection/classes/structures/object-map.structure.js +30 -27
- package/dist/collection/classes/tools/brush-tool.class.js +14 -14
- package/dist/collection/classes/tools/image-tool.class.js +1 -1
- package/dist/collection/classes/tools/line-tool.class.js +14 -14
- package/dist/collection/classes/tools/selection-tool.class.js +2 -2
- package/dist/collection/classes/tools/shape-tool.class.js +6 -6
- package/dist/collection/classes/tools/text-tool.class.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/core/kritzel-awareness-cursors/kritzel-awareness-cursors.js +6 -6
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +2 -2
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +70 -11
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +21 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +159 -60
- package/dist/collection/configs/default-engine-config.js +2 -2
- package/dist/collection/constants/version.js +1 -1
- package/dist/collection/helpers/keyboard.helper.js +15 -11
- package/dist/components/index.js +1 -1
- package/dist/components/kritzel-active-users.js +1 -1
- package/dist/components/kritzel-avatar.js +1 -1
- package/dist/components/kritzel-awareness-cursors.js +1 -1
- package/dist/components/kritzel-back-to-content.js +1 -1
- package/dist/components/kritzel-brush-style.js +1 -1
- package/dist/components/kritzel-button.js +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-context-menu.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-current-user-dialog.js +1 -1
- package/dist/components/kritzel-current-user.js +1 -1
- package/dist/components/kritzel-cursor-trail.js +1 -1
- package/dist/components/kritzel-dialog.js +1 -1
- package/dist/components/kritzel-dropdown.js +1 -1
- package/dist/components/kritzel-editor.js +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-export.js +1 -1
- package/dist/components/kritzel-font-family.js +1 -1
- package/dist/components/kritzel-font-size.js +1 -1
- package/dist/components/kritzel-font.js +1 -1
- package/dist/components/kritzel-icon.js +1 -1
- package/dist/components/kritzel-input.js +1 -1
- package/dist/components/kritzel-line-endings.js +1 -1
- package/dist/components/kritzel-login-dialog.js +1 -1
- package/dist/components/kritzel-master-detail.js +1 -1
- package/dist/components/kritzel-menu-item.js +1 -1
- package/dist/components/kritzel-menu.js +1 -1
- package/dist/components/kritzel-more-menu.js +1 -1
- package/dist/components/kritzel-numeric-input.js +1 -1
- package/dist/components/kritzel-opacity-slider.js +1 -1
- package/dist/components/kritzel-pill-tabs.js +1 -1
- package/dist/components/kritzel-portal.js +1 -1
- package/dist/components/kritzel-settings.js +1 -1
- package/dist/components/kritzel-shape-fill.js +1 -1
- package/dist/components/kritzel-share-dialog.js +1 -1
- package/dist/components/kritzel-slide-toggle.js +1 -1
- package/dist/components/kritzel-split-button.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tool-config.js +1 -1
- package/dist/components/kritzel-tooltip.js +1 -1
- package/dist/components/kritzel-utility-panel.js +1 -1
- package/dist/components/kritzel-workspace-manager.js +1 -1
- package/dist/components/{p-Md9Y-b3d.js → p-1ppb4M65.js} +1 -1
- package/dist/components/{p-KJ4dHzrS.js → p-7yR-sKH8.js} +1 -1
- package/dist/components/{p-CN8IxBlU.js → p-B-Gej_Ak.js} +1 -1
- package/dist/components/{p-76W5pG2O.js → p-B4F19Aqj.js} +1 -1
- package/dist/components/{p-BuI6Gkzg.js → p-B5WII1Lk.js} +1 -1
- package/dist/components/p-BWj1eE2b.js +1 -0
- package/dist/components/{p-ZC5YELQJ.js → p-BZ8bK8qT.js} +1 -1
- package/dist/components/{p-DkWWzVg8.js → p-BaaFG0p-.js} +1 -1
- package/dist/components/{p-6NFl6EB2.js → p-Bat829Bg.js} +1 -1
- package/dist/components/p-BcwZ36sO.js +1 -0
- package/dist/components/{p-53di1Zko.js → p-BjPmEs5A.js} +1 -1
- package/dist/components/{p-D5IhryUR.js → p-Brwz_Dpb.js} +1 -1
- package/dist/components/p-BzQmBVwr.js +9 -0
- package/dist/components/{p-C2l9mZ1P.js → p-C-MtTi6x.js} +1 -1
- package/dist/components/p-C8WnYSHi.js +1 -0
- package/dist/components/{p-BLsH_Oi0.js → p-C9zsWWH2.js} +1 -1
- package/dist/components/{p-ZQ2bKafG.js → p-CJKsuQun.js} +1 -1
- package/dist/components/{p-m1nVDC3G.js → p-CJzg_ejc.js} +1 -1
- package/dist/components/{p-Dte67BWd.js → p-CM7rYf9A.js} +1 -1
- package/dist/components/{p-Dr3-pKVg.js → p-CMGHx71q.js} +1 -1
- package/dist/components/{p-CI9Nbh-x.js → p-CNMpVlot.js} +1 -1
- package/dist/components/{p-DDKjsXCe.js → p-CS7r-zhx.js} +1 -1
- package/dist/components/{p-DaGZEV0R.js → p-C_fSm7T4.js} +1 -1
- package/dist/components/{p-Ck1dhpUQ.js → p-CfEGaTaV.js} +1 -1
- package/dist/components/{p-CWMFGEe0.js → p-CvyE2Wg-.js} +1 -1
- package/dist/components/{p-D3pNw-SV.js → p-D5BXoK9m.js} +1 -1
- package/dist/components/{p-DV7Z_qfa.js → p-D7pwbRUy.js} +1 -1
- package/dist/components/{p-CBslLN3-.js → p-DCH4Rlqx.js} +1 -1
- package/dist/components/{p-CYh7yV-K.js → p-DEOUiiyI.js} +1 -1
- package/dist/components/{p-pCC6t6BH.js → p-DKeBfe_l.js} +1 -1
- package/dist/components/{p-DWsCbu01.js → p-DUQmBcTy.js} +1 -1
- package/dist/components/{p-D14QNK3X.js → p-DUnKjQN7.js} +1 -1
- package/dist/components/{p-BrZ_gL8Q.js → p-DYcsC2zO.js} +1 -1
- package/dist/components/{p-D7yzmu1l.js → p-DkT0KZCm.js} +1 -1
- package/dist/components/{p-Cns7qSKS.js → p-DrsORMoT.js} +1 -1
- package/dist/components/{p-BueaqfA2.js → p-Dw0Obsn5.js} +1 -1
- package/dist/components/{p-DxzDda_J.js → p-Gm5hSQ-e.js} +1 -1
- package/dist/components/{p-C4fKLlrd.js → p-HK-6khHo.js} +1 -1
- package/dist/components/{p-_QEHfsIk.js → p-V3VW2JKl.js} +1 -1
- package/dist/components/{p-Lhyh6KeB.js → p-VxgCvVox.js} +1 -1
- package/dist/components/{p-l_YGO7RB.js → p-cjeDomsc.js} +1 -1
- package/dist/components/{p-gtQlsorg.js → p-rNu5JVNH.js} +1 -1
- package/dist/components/p-xYCbKFih.js +1 -0
- package/dist/esm/{index-BbOHefEf.js → index-D9HaikfQ.js} +36 -9
- package/dist/esm/index.js +1 -1
- package/dist/esm/kritzel-active-users_42.entry.js +333 -177
- package/dist/esm/kritzel-brush-style.entry.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/stencil.js +4 -4
- package/dist/esm/{workspace.migrations-NhRgr2_H.js → workspace.migrations-OzSSw5kt.js} +244 -197
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-D9HaikfQ.js +2 -0
- package/dist/stencil/p-OzSSw5kt.js +1 -0
- package/dist/stencil/{p-98238bf9.entry.js → p-b0be4da1.entry.js} +1 -1
- package/dist/stencil/p-f7be06a8.entry.js +9 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/core/store.class.d.ts +23 -0
- package/dist/types/classes/objects/shape.class.d.ts +1 -0
- package/dist/types/classes/objects/text.class.d.ts +1 -0
- package/dist/types/classes/providers/hocuspocus-sync-provider.class.d.ts +1 -1
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +7 -5
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +10 -4
- package/dist/types/components.d.ts +35 -13
- package/dist/types/constants/version.d.ts +1 -1
- package/dist/types/helpers/tool-config.helper.d.ts +1 -1
- package/dist/types/interfaces/engine-state.interface.d.ts +10 -10
- package/package.json +1 -1
- package/dist/components/p-Ban3OlgZ.js +0 -9
- package/dist/components/p-CGGiwvWZ.js +0 -1
- package/dist/components/p-CHY71o5B.js +0 -1
- package/dist/components/p-DXpYcAnT.js +0 -1
- package/dist/components/p-pGzF7PUB.js +0 -1
- package/dist/stencil/p-4a4b38e4.entry.js +0 -9
- package/dist/stencil/p-BbOHefEf.js +0 -2
- package/dist/stencil/p-NhRgr2_H.js +0 -1
|
@@ -69,8 +69,8 @@ export class KritzelLineTool extends KritzelBaseTool {
|
|
|
69
69
|
});
|
|
70
70
|
line.isCompleted = false;
|
|
71
71
|
this._currentLineId = line.id;
|
|
72
|
-
this._core.store.
|
|
73
|
-
this._core.store.
|
|
72
|
+
this._core.store.objects.insert(line);
|
|
73
|
+
this._core.store.objects?.setActiveDrawingObject(line.id);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
@@ -99,8 +99,8 @@ export class KritzelLineTool extends KritzelBaseTool {
|
|
|
99
99
|
});
|
|
100
100
|
line.isCompleted = false;
|
|
101
101
|
this._currentLineId = line.id;
|
|
102
|
-
this._core.store.
|
|
103
|
-
this._core.store.
|
|
102
|
+
this._core.store.objects.insert(line);
|
|
103
|
+
this._core.store.objects?.setActiveDrawingObject(line.id);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -116,7 +116,7 @@ export class KritzelLineTool extends KritzelBaseTool {
|
|
|
116
116
|
}
|
|
117
117
|
if (event.pointerType === 'mouse') {
|
|
118
118
|
if (this._core.store.state.isDrawing && this._currentLineId) {
|
|
119
|
-
const currentLine = this._core.store.
|
|
119
|
+
const currentLine = this._core.store.objects.findById(this._currentLineId);
|
|
120
120
|
if (currentLine) {
|
|
121
121
|
const viewportScale = this._core.store.state.scale;
|
|
122
122
|
const lockScale = this._core.store.state.lockDrawingScale;
|
|
@@ -140,14 +140,14 @@ export class KritzelLineTool extends KritzelBaseTool {
|
|
|
140
140
|
updatedLine.workspaceId = currentLine.workspaceId;
|
|
141
141
|
updatedLine.zIndex = currentLine.zIndex;
|
|
142
142
|
updatedLine.isCompleted = false;
|
|
143
|
-
this._core.store.
|
|
143
|
+
this._core.store.objects.update(updatedLine);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
if (event.pointerType === 'touch' || event.pointerType === 'pen') {
|
|
148
148
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
149
149
|
if (activePointers.length === 1 && this._currentLineId) {
|
|
150
|
-
const currentLine = this._core.store.
|
|
150
|
+
const currentLine = this._core.store.objects.findById(this._currentLineId);
|
|
151
151
|
if (currentLine) {
|
|
152
152
|
const viewportScale = this._core.store.state.scale;
|
|
153
153
|
const lockScale = this._core.store.state.lockDrawingScale;
|
|
@@ -171,7 +171,7 @@ export class KritzelLineTool extends KritzelBaseTool {
|
|
|
171
171
|
updatedLine.workspaceId = currentLine.workspaceId;
|
|
172
172
|
updatedLine.zIndex = currentLine.zIndex;
|
|
173
173
|
updatedLine.isCompleted = false;
|
|
174
|
-
this._core.store.
|
|
174
|
+
this._core.store.objects.update(updatedLine);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
@@ -190,16 +190,16 @@ export class KritzelLineTool extends KritzelBaseTool {
|
|
|
190
190
|
if (this._core.store.state.isDrawing) {
|
|
191
191
|
this._core.store.state.isDrawing = false;
|
|
192
192
|
if (this._currentLineId) {
|
|
193
|
-
const currentLine = this._core.store.
|
|
193
|
+
const currentLine = this._core.store.objects.findById(this._currentLineId);
|
|
194
194
|
if (currentLine) {
|
|
195
195
|
currentLine.isCompleted = true;
|
|
196
|
-
this._core.store.
|
|
196
|
+
this._core.store.objects.update(currentLine);
|
|
197
197
|
this._core.engine.emitObjectsChange();
|
|
198
198
|
this._core.engine.emitObjectsAdded([currentLine]);
|
|
199
199
|
// Switch to selection tool and select the drawn line
|
|
200
200
|
this.selectLineAndSwitchTool(currentLine);
|
|
201
201
|
}
|
|
202
|
-
this._core.store.
|
|
202
|
+
this._core.store.objects?.setActiveDrawingObject(null);
|
|
203
203
|
this._currentLineId = null;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -208,16 +208,16 @@ export class KritzelLineTool extends KritzelBaseTool {
|
|
|
208
208
|
if (this._core.store.state.isDrawing) {
|
|
209
209
|
this._core.store.state.isDrawing = false;
|
|
210
210
|
if (this._currentLineId) {
|
|
211
|
-
const currentLine = this._core.store.
|
|
211
|
+
const currentLine = this._core.store.objects.findById(this._currentLineId);
|
|
212
212
|
if (currentLine) {
|
|
213
213
|
currentLine.isCompleted = true;
|
|
214
|
-
this._core.store.
|
|
214
|
+
this._core.store.objects.update(currentLine);
|
|
215
215
|
this._core.engine.emitObjectsChange();
|
|
216
216
|
this._core.engine.emitObjectsAdded([currentLine]);
|
|
217
217
|
// Switch to selection tool and select the drawn line
|
|
218
218
|
this.selectLineAndSwitchTool(currentLine);
|
|
219
219
|
}
|
|
220
|
-
this._core.store.
|
|
220
|
+
this._core.store.objects?.setActiveDrawingObject(null);
|
|
221
221
|
this._currentLineId = null;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -234,7 +234,7 @@ export class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
234
234
|
const objects = this.flattenObjects(this.getSelectedObjects());
|
|
235
235
|
for (const obj of objects) {
|
|
236
236
|
if (obj instanceof KritzelLine)
|
|
237
|
-
return obj.arrows;
|
|
237
|
+
return obj.arrows ?? { start: { enabled: false }, end: { enabled: false } };
|
|
238
238
|
}
|
|
239
239
|
return { start: { enabled: false }, end: { enabled: false } };
|
|
240
240
|
}
|
|
@@ -476,7 +476,7 @@ export class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
476
476
|
getSelectedObject(event) {
|
|
477
477
|
const path = event.composedPath().slice(1);
|
|
478
478
|
const objectElement = path.find(element => element.classList && element.classList.contains('object'));
|
|
479
|
-
const object = this._core.findObjectById(objectElement
|
|
479
|
+
const object = objectElement?.id ? this._core.findObjectById(objectElement.id) : null;
|
|
480
480
|
if (!object) {
|
|
481
481
|
return null;
|
|
482
482
|
}
|
|
@@ -178,8 +178,8 @@ export class KritzelShapeTool extends KritzelBaseTool {
|
|
|
178
178
|
fontFamily: this.fontFamily,
|
|
179
179
|
scale: lockScale ? 1 : viewportScale,
|
|
180
180
|
});
|
|
181
|
-
this._core.store.
|
|
182
|
-
this._core.store.
|
|
181
|
+
this._core.store.objects.insert(this.currentShape);
|
|
182
|
+
this._core.store.objects?.setActiveDrawingObject(this.currentShape.id);
|
|
183
183
|
this._core.rerender();
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
@@ -213,7 +213,7 @@ export class KritzelShapeTool extends KritzelBaseTool {
|
|
|
213
213
|
this.currentShape.translateX = -this._core.store.state.translateX / divider;
|
|
214
214
|
this.currentShape.translateY = -this._core.store.state.translateY / divider;
|
|
215
215
|
this.currentShape.updateDimensions();
|
|
216
|
-
this._core.store.
|
|
216
|
+
this._core.store.objects.update(this.currentShape);
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Completes the shape drawing process.
|
|
@@ -229,18 +229,18 @@ export class KritzelShapeTool extends KritzelBaseTool {
|
|
|
229
229
|
// Compare in screen space
|
|
230
230
|
if (this.currentShape.width < 10 && this.currentShape.height < 10) {
|
|
231
231
|
const shapeId = this.currentShape.id;
|
|
232
|
-
this._core.store.
|
|
232
|
+
this._core.store.objects.remove(o => o.id === shapeId);
|
|
233
233
|
}
|
|
234
234
|
else {
|
|
235
235
|
this.currentShape.zIndex = this._core.store.currentZIndex;
|
|
236
|
-
this._core.store.
|
|
236
|
+
this._core.store.objects.update(this.currentShape);
|
|
237
237
|
this._core.engine.emitObjectsChange();
|
|
238
238
|
this._core.engine.emitObjectsAdded([this.currentShape]);
|
|
239
239
|
this._core.selectObjects([this.currentShape]);
|
|
240
240
|
this._core.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
|
|
241
241
|
}
|
|
242
242
|
this.isDrawing = false;
|
|
243
|
-
this._core.store.
|
|
243
|
+
this._core.store.objects?.setActiveDrawingObject(null);
|
|
244
244
|
this.currentShape = null;
|
|
245
245
|
this._core.rerender();
|
|
246
246
|
}
|
|
@@ -71,7 +71,7 @@ export class KritzelTextTool extends KritzelBaseTool {
|
|
|
71
71
|
text.translateX = (clientX - this._core.store.state.translateX) / viewportScale;
|
|
72
72
|
text.translateY = (clientY - this._core.store.state.translateY) / viewportScale;
|
|
73
73
|
text.zIndex = this._core.store.currentZIndex;
|
|
74
|
-
this._core.store.
|
|
74
|
+
this._core.store.objects.insert(text);
|
|
75
75
|
this._core.rerender();
|
|
76
76
|
text.edit(event);
|
|
77
77
|
}
|
|
@@ -108,7 +108,7 @@ export class KritzelTextTool extends KritzelBaseTool {
|
|
|
108
108
|
text.translateX = (clientX - this._core.store.state.translateX) / viewportScale;
|
|
109
109
|
text.translateY = (clientY - this._core.store.state.translateY) / viewportScale;
|
|
110
110
|
text.zIndex = this._core.store.currentZIndex;
|
|
111
|
-
this._core.store.
|
|
111
|
+
this._core.store.objects.insert(text);
|
|
112
112
|
this._core.rerender();
|
|
113
113
|
text.edit(event);
|
|
114
114
|
}
|
package/dist/collection/components/core/kritzel-awareness-cursors/kritzel-awareness-cursors.js
CHANGED
|
@@ -13,10 +13,10 @@ export class KritzelAwarenessCursors {
|
|
|
13
13
|
cleanupIntervalId;
|
|
14
14
|
objectChangeRafId = null;
|
|
15
15
|
componentDidLoad() {
|
|
16
|
-
this.core.store.
|
|
16
|
+
this.core.store.objects?.onAwarenessChange(states => {
|
|
17
17
|
this.handleAwarenessChange(states);
|
|
18
18
|
});
|
|
19
|
-
this.core.store.
|
|
19
|
+
this.core.store.objects?.onObjectsChange(() => {
|
|
20
20
|
this.handleRemoteObjectChange();
|
|
21
21
|
});
|
|
22
22
|
this.cleanupIntervalId = setInterval(() => {
|
|
@@ -32,7 +32,7 @@ export class KritzelAwarenessCursors {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
handleAwarenessChange(states) {
|
|
35
|
-
const localClientId = this.core.store.
|
|
35
|
+
const localClientId = this.core.store.objects?.localClientId;
|
|
36
36
|
const now = Date.now();
|
|
37
37
|
const updated = new Map(this.remoteCursors);
|
|
38
38
|
// Track which clientIds are still present
|
|
@@ -108,7 +108,7 @@ export class KritzelAwarenessCursors {
|
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
getActiveObjectTip(objectId) {
|
|
111
|
-
const obj = this.core.store.
|
|
111
|
+
const obj = this.core.store.objects?.findById(objectId);
|
|
112
112
|
if (!obj)
|
|
113
113
|
return null;
|
|
114
114
|
if (obj instanceof KritzelPath && !obj.isCompleted) {
|
|
@@ -185,7 +185,7 @@ export class KritzelAwarenessCursors {
|
|
|
185
185
|
void _ty;
|
|
186
186
|
void this.objectVersion;
|
|
187
187
|
const cursors = Array.from(this.remoteCursors.values());
|
|
188
|
-
return (h(Host, { key: '
|
|
188
|
+
return (h(Host, { key: '1743084eadda932b5aaf89552f500b90e194a79f' }, cursors.map(remoteCursor => {
|
|
189
189
|
if (!remoteCursor.cursor)
|
|
190
190
|
return null;
|
|
191
191
|
// When a remote user is actively drawing, derive cursor position from
|
|
@@ -295,7 +295,7 @@ export class KritzelAwarenessCursors {
|
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
},
|
|
298
|
-
"required":
|
|
298
|
+
"required": true,
|
|
299
299
|
"optional": false,
|
|
300
300
|
"docs": {
|
|
301
301
|
"tags": [],
|
|
@@ -63,7 +63,7 @@ export class KritzelCursorTrail {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
render() {
|
|
66
|
-
return (h(Host, { key: '
|
|
66
|
+
return (h(Host, { key: 'b0f5c795c4803e27a49d7f76f3fedea818967049' }, this.cursorTrailPoints.length > 1 && (h("svg", { key: '6ff883be1aecfb302bc9ecb3b7562617d753d5ba', class: "cursor-trail-svg", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
67
67
|
position: 'absolute',
|
|
68
68
|
left: '0',
|
|
69
69
|
top: '0',
|
|
@@ -112,7 +112,7 @@ export class KritzelCursorTrail {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
|
-
"required":
|
|
115
|
+
"required": true,
|
|
116
116
|
"optional": false,
|
|
117
117
|
"docs": {
|
|
118
118
|
"tags": [],
|
|
@@ -193,6 +193,8 @@ export class KritzelEditor {
|
|
|
193
193
|
}
|
|
194
194
|
]
|
|
195
195
|
};
|
|
196
|
+
/** Whether the editor is in a loading state. When true, a loading overlay is displayed. */
|
|
197
|
+
isLoading = false;
|
|
196
198
|
/** Optional unique identifier for namespacing storage keys across multiple editor instances. */
|
|
197
199
|
editorId;
|
|
198
200
|
/** Optional workspace ID to set as active. If provided, the editor will automatically activate the workspace with this ID. */
|
|
@@ -232,9 +234,10 @@ export class KritzelEditor {
|
|
|
232
234
|
}
|
|
233
235
|
}
|
|
234
236
|
onWorkspacesChange(newWorkspaces) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
const activeWorkspace = this.activeWorkspace;
|
|
238
|
+
if (activeWorkspace) {
|
|
239
|
+
const updatedActiveWorkspace = newWorkspaces.find(ws => ws.id === activeWorkspace.id);
|
|
240
|
+
if (updatedActiveWorkspace && updatedActiveWorkspace !== activeWorkspace) {
|
|
238
241
|
this.activeWorkspace = updatedActiveWorkspace;
|
|
239
242
|
}
|
|
240
243
|
}
|
|
@@ -461,7 +464,7 @@ export class KritzelEditor {
|
|
|
461
464
|
await customElements.whenDefined('kritzel-workspace-manager');
|
|
462
465
|
await customElements.whenDefined('kritzel-controls');
|
|
463
466
|
await customElements.whenDefined('kritzel-engine');
|
|
464
|
-
if (!this.isEngineReady || !this.isControlsReady || !this.isWorkspaceManagerReady) {
|
|
467
|
+
if (!this.isEngineReady || !this.isControlsReady || !this.isWorkspaceManagerReady || !this.activeWorkspace) {
|
|
465
468
|
return;
|
|
466
469
|
}
|
|
467
470
|
const { id, name, isPublic, createdAt, updatedAt } = this.activeWorkspace;
|
|
@@ -480,6 +483,9 @@ export class KritzelEditor {
|
|
|
480
483
|
}
|
|
481
484
|
async onEngineReady(event) {
|
|
482
485
|
this.isEngineReady = true;
|
|
486
|
+
if (!event.detail.activeWorkspace) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
483
489
|
this.activeWorkspace = event.detail.activeWorkspace;
|
|
484
490
|
this.workspaces = event.detail.workspaces;
|
|
485
491
|
this.currentIsPublic = await this.engineRef.getIsPublic();
|
|
@@ -562,7 +568,7 @@ export class KritzelEditor {
|
|
|
562
568
|
icon: 'upload',
|
|
563
569
|
action: async () => {
|
|
564
570
|
const preview = await this.engineRef.getScreenshot('png');
|
|
565
|
-
this.exportRef.open(preview);
|
|
571
|
+
this.exportRef.open(preview ?? undefined);
|
|
566
572
|
},
|
|
567
573
|
},
|
|
568
574
|
{
|
|
@@ -593,7 +599,7 @@ export class KritzelEditor {
|
|
|
593
599
|
activeWorkspace.isPublic = isPublic;
|
|
594
600
|
await this.engineRef.updateWorkspace(activeWorkspace);
|
|
595
601
|
this.activeWorkspace = activeWorkspace.clone();
|
|
596
|
-
this.isPublicChange.emit({ isPublic, workspaceId:
|
|
602
|
+
this.isPublicChange.emit({ isPublic, workspaceId: activeWorkspace.id });
|
|
597
603
|
};
|
|
598
604
|
/**
|
|
599
605
|
* Updates the currentIsPublic state from the active workspace and emits the isPublicChange event.
|
|
@@ -602,6 +608,9 @@ export class KritzelEditor {
|
|
|
602
608
|
const isPublic = this.activeWorkspace?.isPublic ?? false;
|
|
603
609
|
const workspaceId = this.activeWorkspace?.id;
|
|
604
610
|
this.currentIsPublic = isPublic;
|
|
611
|
+
if (!workspaceId) {
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
605
614
|
this.isPublicChange.emit({ isPublic, workspaceId });
|
|
606
615
|
}
|
|
607
616
|
handleProviderLogin = (event) => {
|
|
@@ -706,7 +715,31 @@ export class KritzelEditor {
|
|
|
706
715
|
const isLoggedIn = this.isLoggedIn;
|
|
707
716
|
const shouldShowCurrentUser = isLoggedIn;
|
|
708
717
|
const shouldShowLoginButton = !!this.loginConfig && !isLoggedIn;
|
|
709
|
-
return (h(Host, { key: '
|
|
718
|
+
return (h(Host, { key: '1e3c220506d14f276ca246365c2bda79110c6c35' }, h("div", { key: '154b45141b995f749adb52a11dc3363ab2989475', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: '22519269ea7227a1a7a05d2f282bbcd2466edf5d', workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'e89f0609dfd031cb040fd80a1f60ecb56d56734c', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), h("kritzel-engine", { key: '0b3acdf827d48c9589fb8170b49a602beb273684', ref: el => {
|
|
719
|
+
if (el) {
|
|
720
|
+
this.engineRef = el;
|
|
721
|
+
}
|
|
722
|
+
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.currentTheme, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), h("kritzel-controls", { key: '324ba00f982938abc7a3f4dc47368f3b9bad665e', class: { 'keyboard-open': this.isVirtualKeyboardOpen }, style: { display: this.isControlsVisible ? 'flex' : 'none' }, ref: el => {
|
|
723
|
+
if (el) {
|
|
724
|
+
this.controlsRef = el;
|
|
725
|
+
}
|
|
726
|
+
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.currentTheme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '0c4662e92cbe90a958f8704e6db0375915d9c634', class: "top-right-buttons" }, h("kritzel-settings", { key: 'e0422c1a02bc895bafd4b777d4d593afcfdf335b', ref: el => {
|
|
727
|
+
if (el) {
|
|
728
|
+
this.settingsRef = el;
|
|
729
|
+
}
|
|
730
|
+
}, shortcuts: this.shortcuts, editorId: this.editorId, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '72f59ec2eab76d753bb64475f199f0fa33e935d4', ref: el => {
|
|
731
|
+
if (el) {
|
|
732
|
+
this.exportRef = el;
|
|
733
|
+
}
|
|
734
|
+
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: 'c60411370947fc408b5e9d7adade3e28210b8d47', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: '4783940d3d4f9c2a7e8156c0713f29cb8b043125', user: this.user }), shouldShowLoginButton && h("kritzel-button", { key: 'bdb727d5641f8cda3711856086e1b9aa8533a5a6', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in"), h("kritzel-more-menu", { key: '3afa57ea46636c92cc7232dfe22a27cace85766e', items: this.moreMenuItems }), h("kritzel-share-dialog", { key: '852f9980fa3b89ceb5b6d8bde1bdd5598d3dc6e4', ref: el => {
|
|
735
|
+
if (el) {
|
|
736
|
+
this.shareDialogRef = el;
|
|
737
|
+
}
|
|
738
|
+
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: 'cdccbb7ef0b9932c0747545a18071f22e5683d8c', ref: el => {
|
|
739
|
+
if (el) {
|
|
740
|
+
this.loginDialogRef = el;
|
|
741
|
+
}
|
|
742
|
+
}, providers: this.loginConfig.providers, dialogTitle: this.loginConfig.title, subtitle: this.loginConfig.subtitle, onProviderLogin: this.handleProviderLogin })))));
|
|
710
743
|
}
|
|
711
744
|
static get is() { return "kritzel-editor"; }
|
|
712
745
|
static get originalStyleUrls() {
|
|
@@ -1142,6 +1175,26 @@ export class KritzelEditor {
|
|
|
1142
1175
|
"setter": false,
|
|
1143
1176
|
"defaultValue": "{\r\n providers: [\r\n {\r\n label: 'Sign in with Google',\r\n icon: 'google',\r\n name: 'Google',\r\n }\r\n ]\r\n }"
|
|
1144
1177
|
},
|
|
1178
|
+
"isLoading": {
|
|
1179
|
+
"type": "boolean",
|
|
1180
|
+
"mutable": false,
|
|
1181
|
+
"complexType": {
|
|
1182
|
+
"original": "boolean",
|
|
1183
|
+
"resolved": "boolean",
|
|
1184
|
+
"references": {}
|
|
1185
|
+
},
|
|
1186
|
+
"required": false,
|
|
1187
|
+
"optional": false,
|
|
1188
|
+
"docs": {
|
|
1189
|
+
"tags": [],
|
|
1190
|
+
"text": "Whether the editor is in a loading state. When true, a loading overlay is displayed."
|
|
1191
|
+
},
|
|
1192
|
+
"getter": false,
|
|
1193
|
+
"setter": false,
|
|
1194
|
+
"reflect": false,
|
|
1195
|
+
"attribute": "is-loading",
|
|
1196
|
+
"defaultValue": "false"
|
|
1197
|
+
},
|
|
1145
1198
|
"editorId": {
|
|
1146
1199
|
"type": "string",
|
|
1147
1200
|
"mutable": false,
|
|
@@ -2103,7 +2156,7 @@ export class KritzelEditor {
|
|
|
2103
2156
|
},
|
|
2104
2157
|
"registerTool": {
|
|
2105
2158
|
"complexType": {
|
|
2106
|
-
"signature": "(toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig | KritzelLineToolConfig | KritzelShapeToolConfig) => Promise<KritzelBaseTool>",
|
|
2159
|
+
"signature": "(toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig | KritzelLineToolConfig | KritzelShapeToolConfig) => Promise<KritzelBaseTool | null>",
|
|
2107
2160
|
"parameters": [{
|
|
2108
2161
|
"name": "toolName",
|
|
2109
2162
|
"type": "string",
|
|
@@ -2485,7 +2538,7 @@ export class KritzelEditor {
|
|
|
2485
2538
|
},
|
|
2486
2539
|
"getScreenshot": {
|
|
2487
2540
|
"complexType": {
|
|
2488
|
-
"signature": "(format?: \"png\" | \"svg\") => Promise<string>",
|
|
2541
|
+
"signature": "(format?: \"png\" | \"svg\") => Promise<string | null>",
|
|
2489
2542
|
"parameters": [{
|
|
2490
2543
|
"name": "format",
|
|
2491
2544
|
"type": "\"svg\" | \"png\"",
|
|
@@ -2643,10 +2696,10 @@ export class KritzelEditor {
|
|
|
2643
2696
|
},
|
|
2644
2697
|
"findObjects": {
|
|
2645
2698
|
"complexType": {
|
|
2646
|
-
"signature": "<T extends KritzelBaseObject>(predicate: (obj: KritzelBaseObject) => boolean) => Promise<T[]>",
|
|
2699
|
+
"signature": "<T extends KritzelBaseObject>(predicate: (obj: KritzelBaseObject<Element>) => boolean) => Promise<T[]>",
|
|
2647
2700
|
"parameters": [{
|
|
2648
2701
|
"name": "predicate",
|
|
2649
|
-
"type": "(obj: KritzelBaseObject<
|
|
2702
|
+
"type": "(obj: KritzelBaseObject<Element>) => boolean",
|
|
2650
2703
|
"docs": ""
|
|
2651
2704
|
}],
|
|
2652
2705
|
"references": {
|
|
@@ -2663,6 +2716,12 @@ export class KritzelEditor {
|
|
|
2663
2716
|
"path": "../../../classes/objects/base-object.class",
|
|
2664
2717
|
"id": "src/classes/objects/base-object.class.ts::KritzelBaseObject",
|
|
2665
2718
|
"referenceLocation": "KritzelBaseObject"
|
|
2719
|
+
},
|
|
2720
|
+
"Element": {
|
|
2721
|
+
"location": "import",
|
|
2722
|
+
"path": "@stencil/core",
|
|
2723
|
+
"id": "../../node_modules/@stencil/core/internal/stencil-core/index.d.ts::Element",
|
|
2724
|
+
"referenceLocation": "Element"
|
|
2666
2725
|
}
|
|
2667
2726
|
},
|
|
2668
2727
|
"return": "Promise<T[]>"
|
|
@@ -29,14 +29,34 @@ p, h1, h2, h3, h4, h5, h6, blockquote, pre {
|
|
|
29
29
|
display: flex;
|
|
30
30
|
align-items: center;
|
|
31
31
|
justify-content: center;
|
|
32
|
+
gap: 10px;
|
|
32
33
|
background-color: var(--kritzel-loading-overlay-background, rgba(255, 255, 255, 0.6));
|
|
33
34
|
color: var(--kritzel-loading-overlay-color, #333);
|
|
35
|
+
font-family: var(--kritzel-font-family, sans-serif);
|
|
34
36
|
font-size: 1.25rem;
|
|
35
37
|
pointer-events: all;
|
|
36
|
-
animation: workspace-loading-fade-in var(--kritzel-loading-overlay-delay, 300ms)
|
|
38
|
+
animation: workspace-loading-fade-in 200ms ease-out var(--kritzel-loading-overlay-delay, 300ms) forwards;
|
|
37
39
|
opacity: 0;
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
.workspace-loading-spinner {
|
|
43
|
+
width: 20px;
|
|
44
|
+
height: 20px;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
display: block;
|
|
47
|
+
flex-shrink: 0;
|
|
48
|
+
border: 2px solid var(--kritzel-loading-overlay-spinner-color, #cccccc);
|
|
49
|
+
border-top-color: var(--kritzel-loading-overlay-spinner-active-color, #333333);
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
animation: workspace-loading-spin 0.6s linear infinite;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@keyframes workspace-loading-spin {
|
|
55
|
+
to {
|
|
56
|
+
transform: rotate(360deg);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
40
60
|
@keyframes workspace-loading-fade-in {
|
|
41
61
|
to {
|
|
42
62
|
opacity: 1;
|