kritzel-stencil 0.3.8 → 0.3.10
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.cjs.js +2 -1
- package/dist/cjs/kritzel-active-users_42.cjs.entry.js +301 -126
- package/dist/cjs/kritzel-brush-style.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{schema.constants-rCfWpcBV.js → schema.constants-BNMNpzvA.js} +77 -12
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/core/core.class.js +3 -0
- package/dist/collection/classes/handlers/context-menu.handler.js +54 -0
- package/dist/collection/classes/managers/theme.manager.js +47 -5
- package/dist/collection/classes/objects/selection-box.class.js +2 -2
- package/dist/collection/classes/objects/selection-group.class.js +3 -3
- package/dist/collection/classes/objects/text.class.js +8 -0
- package/dist/collection/classes/registries/icon-registry.class.js +2 -1
- package/dist/collection/classes/tools/text-tool.class.js +2 -0
- package/dist/collection/components/core/kritzel-awareness-cursors/kritzel-awareness-cursors.js +1 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +168 -17
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +83 -1
- package/dist/collection/components/shared/kritzel-avatar/kritzel-avatar.js +3 -3
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +1 -1
- package/dist/collection/components/shared/kritzel-button/kritzel-button.js +2 -2
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js +8 -8
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +7 -7
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +7 -7
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js +1 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +1 -1
- package/dist/collection/components/shared/kritzel-input/kritzel-input.js +1 -1
- package/dist/collection/components/shared/kritzel-line-endings/kritzel-line-endings.js +2 -2
- package/dist/collection/components/shared/kritzel-master-detail/kritzel-master-detail.js +3 -3
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +1 -1
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +2 -2
- package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.js +1 -1
- package/dist/collection/components/shared/kritzel-opacity-slider/kritzel-opacity-slider.js +2 -1
- package/dist/collection/components/shared/kritzel-pill-tabs/kritzel-pill-tabs.js +1 -1
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +1 -1
- package/dist/collection/components/shared/kritzel-shape-fill/kritzel-shape-fill.js +2 -2
- package/dist/collection/components/shared/kritzel-slide-toggle/kritzel-slide-toggle.js +1 -1
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +1 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +2 -2
- package/dist/collection/components/ui/kritzel-back-to-content/kritzel-back-to-content.js +1 -1
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +94 -48
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +1 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +15 -14
- package/dist/collection/components/ui/kritzel-current-user/kritzel-current-user.js +1 -1
- package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.js +1 -1
- package/dist/collection/components/ui/kritzel-export/kritzel-export.js +1 -1
- package/dist/collection/components/ui/kritzel-login-dialog/kritzel-login-dialog.js +1 -1
- package/dist/collection/components/ui/kritzel-more-menu/kritzel-more-menu.js +1 -1
- package/dist/collection/components/ui/kritzel-settings/kritzel-settings.js +28 -9
- package/dist/collection/components/ui/kritzel-share-dialog/kritzel-share-dialog.js +2 -2
- package/dist/collection/components/ui/kritzel-tool-config/kritzel-tool-config.js +6 -6
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
- package/dist/collection/constants/color-palette.constants.js +4 -1
- package/dist/collection/constants/version.js +1 -1
- package/dist/collection/index.js +2 -0
- package/dist/collection/themes/dark-theme.js +4 -0
- package/dist/collection/themes/light-theme.js +4 -0
- 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-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-CJjwjpMH.js → p-BFgWBbpu.js} +1 -1
- package/dist/components/{p-CqAkznU_.js → p-BI_UUiTr.js} +1 -1
- package/dist/components/p-BPEn0_hr.js +1 -0
- package/dist/components/{p-Cz2gQKbL.js → p-B_JH91jB.js} +1 -1
- package/dist/components/{p-BV3EJRtU.js → p-Bp3kdH4l.js} +1 -1
- package/dist/components/p-C0wFAtT_.js +1 -0
- package/dist/components/p-C8ggg-5h.js +1 -0
- package/dist/components/{p-B638ZH7S.js → p-CARNM9pf.js} +1 -1
- package/dist/components/p-CB7ynHtI.js +1 -0
- package/dist/components/{p-DDBaFNFi.js → p-CJ2V42sz.js} +1 -1
- package/dist/components/{p-A7Ult9iv.js → p-CJERvHdy.js} +1 -1
- package/dist/components/{p-CrSLn46K.js → p-CKY7AvGR.js} +1 -1
- package/dist/components/{p-C4vg_-vg.js → p-COIxq81R.js} +1 -1
- package/dist/components/p-CT2IjyIk.js +1 -0
- package/dist/components/{p-B5a3arJg.js → p-CWgI1dA0.js} +1 -1
- package/dist/components/{p-0cs6zQLB.js → p-CYR9wbJg.js} +1 -1
- package/dist/components/{p-CrmWVXea.js → p-Cr7xOsIZ.js} +1 -1
- package/dist/components/{p-qBqQhAmh.js → p-CxtTuKCy.js} +1 -1
- package/dist/components/{p-DEd2L0e3.js → p-D0aom7Yu.js} +1 -1
- package/dist/components/{p-DwHZN643.js → p-D15NO5kE.js} +1 -1
- package/dist/components/p-DH-H7om7.js +1 -0
- package/dist/components/{p-PMiFTdm6.js → p-DJLJfKY2.js} +1 -1
- package/dist/components/{p-W0nK9EQJ.js → p-DLlIaDNn.js} +2 -2
- package/dist/components/{p-DXO_ppUK.js → p-DRB3TZzI.js} +1 -1
- package/dist/components/{p-CaKSDRid.js → p-DXgUuzXW.js} +1 -1
- package/dist/components/{p-ihbmwmHg.js → p-DdmJquQr.js} +1 -1
- package/dist/components/{p-Czaea0WP.js → p-DfH7YY2C.js} +1 -1
- package/dist/components/{p-CTj2UdbS.js → p-DgtrNOWm.js} +1 -1
- package/dist/components/{p-D6KNaj_Y.js → p-DhAM4qeQ.js} +1 -1
- package/dist/components/{p-DMfU0hHe.js → p-DmTG0Y5h.js} +1 -1
- package/dist/components/{p-BMsKd6TF.js → p-Dov3qOAR.js} +1 -1
- package/dist/components/{p-CvCTQQcJ.js → p-Dw9sKOsb.js} +1 -1
- package/dist/components/{p-CSODtZrV.js → p-Dx_xz_El.js} +1 -1
- package/dist/components/{p-BVEYAGm1.js → p-IiG44Unz.js} +1 -1
- package/dist/components/{p-DsxW_miC.js → p-K7ySy791.js} +1 -1
- package/dist/components/{p-Bda1I4pR.js → p-KVG5rztB.js} +1 -1
- package/dist/components/{p-C_OSXZqJ.js → p-KjtNlFTl.js} +1 -1
- package/dist/components/{p-DVEfOb8T.js → p-RnuCSIt-.js} +1 -1
- package/dist/components/{p-Z9_amVdR.js → p-ZgZqbJ58.js} +1 -1
- package/dist/components/{p-C4bAtxyk.js → p-guqEWGgV.js} +1 -1
- package/dist/components/{p-DemKKw9U.js → p-u0b2RJAn.js} +1 -1
- package/dist/components/{p-BLjdzUzs.js → p-x38RbGJA.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-active-users_42.entry.js +301 -126
- package/dist/esm/kritzel-brush-style.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{schema.constants-cuIrI5X8.js → schema.constants-CqBoZbmA.js} +77 -13
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-3372fb1e.entry.js +9 -0
- package/dist/stencil/{p-10c2b77c.entry.js → p-69298b5f.entry.js} +1 -1
- package/dist/stencil/p-CqBoZbmA.js +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/handlers/context-menu.handler.d.ts +14 -0
- package/dist/types/classes/managers/theme.manager.d.ts +22 -2
- package/dist/types/classes/objects/text.class.d.ts +1 -0
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +14 -2
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +18 -1
- package/dist/types/components/shared/kritzel-color/kritzel-color.d.ts +3 -2
- package/dist/types/components/shared/kritzel-color-palette/kritzel-color-palette.d.ts +3 -2
- package/dist/types/components/ui/kritzel-context-menu/kritzel-context-menu.d.ts +9 -3
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +2 -2
- package/dist/types/components/ui/kritzel-settings/kritzel-settings.d.ts +2 -1
- package/dist/types/components/ui/kritzel-tool-config/kritzel-tool-config.d.ts +3 -2
- package/dist/types/components.d.ts +61 -18
- package/dist/types/constants/color-palette.constants.d.ts +4 -2
- package/dist/types/constants/version.d.ts +1 -1
- package/dist/types/helpers/color.helper.d.ts +4 -3
- package/dist/types/helpers/svg-export.helper.d.ts +3 -3
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/theme.interface.d.ts +7 -3
- package/package.json +1 -1
- package/dist/components/p-B8wX0-3H.js +0 -1
- package/dist/components/p-BvgGpgKP.js +0 -1
- package/dist/components/p-C-sJ1r3g.js +0 -1
- package/dist/components/p-CBTqCoUx.js +0 -1
- package/dist/components/p-DdlK75Kx.js +0 -1
- package/dist/components/p-DjAiIBXv.js +0 -1
- package/dist/stencil/p-9ce67a14.entry.js +0 -9
- package/dist/stencil/p-cuIrI5X8.js +0 -1
|
@@ -101,10 +101,10 @@ export class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
101
101
|
object.scale = core.store.state.scale;
|
|
102
102
|
object.zIndex = 99999;
|
|
103
103
|
// Initialize styling with theme-aware defaults
|
|
104
|
-
object.borderColor =
|
|
104
|
+
object.borderColor = undefined;
|
|
105
105
|
object.borderWidth = 2;
|
|
106
|
-
object.handleColor =
|
|
107
|
-
object.handleStrokeColor =
|
|
106
|
+
object.handleColor = undefined;
|
|
107
|
+
object.handleStrokeColor = undefined;
|
|
108
108
|
object.handleSize = 6;
|
|
109
109
|
return object;
|
|
110
110
|
}
|
|
@@ -25,6 +25,7 @@ export class KritzelText extends KritzelBaseObject {
|
|
|
25
25
|
isDebugInfoVisible = true;
|
|
26
26
|
isEditable = true;
|
|
27
27
|
isEditing = false;
|
|
28
|
+
isNewlyCreated = false;
|
|
28
29
|
editor = null;
|
|
29
30
|
content = null;
|
|
30
31
|
_schema = new Schema({
|
|
@@ -330,6 +331,13 @@ export class KritzelText extends KritzelBaseObject {
|
|
|
330
331
|
this._core.store.objects.consolidateTemporaryItems();
|
|
331
332
|
this._core.store.objects.update(this);
|
|
332
333
|
this._core.engine.emitObjectsChange();
|
|
334
|
+
if (this.isNewlyCreated) {
|
|
335
|
+
this.isNewlyCreated = false;
|
|
336
|
+
this._core.engine.emitObjectsAdded([this]);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
this._core.engine.emitObjectsUpdated([{ object: this, changedProperties: ['content'] }]);
|
|
340
|
+
}
|
|
333
341
|
}
|
|
334
342
|
/**
|
|
335
343
|
* Handles the Escape key while the text object is in edit mode.
|
|
@@ -110,5 +110,6 @@ KritzelIconRegistry.registerIcons({
|
|
|
110
110
|
'log-out': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-log-out-icon lucide-log-out"><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/></svg>',
|
|
111
111
|
'users-round': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-users-round-icon lucide-users-round"><path d="M18 21a8 8 0 0 0-16 0"/><circle cx="10" cy="8" r="5"/><path d="M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3"/></svg>',
|
|
112
112
|
'google': '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" xmlns:xlink="http://www.w3.org/1999/xlink" style="display: block;"><path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"></path><path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"></path><path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"></path><path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"></path><path fill="none" d="M0 0h48v48H0z"></path></svg>',
|
|
113
|
-
'braces': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-braces-icon lucide-braces"><path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/></svg>'
|
|
113
|
+
'braces': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-braces-icon lucide-braces"><path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/></svg>',
|
|
114
|
+
'heart': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-heart-icon lucide-heart"><path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/></svg>'
|
|
114
115
|
});
|
|
@@ -117,6 +117,7 @@ export class KritzelTextTool extends KritzelBaseTool {
|
|
|
117
117
|
text.translateX = (clientX - this._core.store.state.translateX) / viewportScale;
|
|
118
118
|
text.translateY = (clientY - this._core.store.state.translateY) / viewportScale;
|
|
119
119
|
text.zIndex = this._core.store.currentZIndex;
|
|
120
|
+
text.isNewlyCreated = true;
|
|
120
121
|
this._core.store.objects.insert(text);
|
|
121
122
|
this._core.rerender();
|
|
122
123
|
text.edit(event);
|
|
@@ -154,6 +155,7 @@ export class KritzelTextTool extends KritzelBaseTool {
|
|
|
154
155
|
text.translateX = (clientX - this._core.store.state.translateX) / viewportScale;
|
|
155
156
|
text.translateY = (clientY - this._core.store.state.translateY) / viewportScale;
|
|
156
157
|
text.zIndex = this._core.store.currentZIndex;
|
|
158
|
+
text.isNewlyCreated = true;
|
|
157
159
|
this._core.store.objects.insert(text);
|
|
158
160
|
this._core.rerender();
|
|
159
161
|
text.edit(event);
|
package/dist/collection/components/core/kritzel-awareness-cursors/kritzel-awareness-cursors.js
CHANGED
|
@@ -195,7 +195,7 @@ export class KritzelAwarenessCursors {
|
|
|
195
195
|
void _ty;
|
|
196
196
|
void this.objectVersion;
|
|
197
197
|
const cursors = Array.from(this.remoteCursors.values());
|
|
198
|
-
return (h(Host, { key: '
|
|
198
|
+
return (h(Host, { key: '5c695e3c5a012767b31bb1b756ef03e2a174f46e' }, cursors.map(remoteCursor => {
|
|
199
199
|
if (!remoteCursor.cursor)
|
|
200
200
|
return null;
|
|
201
201
|
// When a remote user is actively drawing, derive cursor position from
|
|
@@ -63,7 +63,7 @@ export class KritzelCursorTrail {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
render() {
|
|
66
|
-
return (h(Host, { key: '
|
|
66
|
+
return (h(Host, { key: 'b427550b19a3e172cb25d05e34635121b82a61c5' }, this.cursorTrailPoints.length > 1 && (h("svg", { key: '9685b563497e110f36c0feffbfde04ebeb38024b', class: "cursor-trail-svg", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
67
67
|
position: 'absolute',
|
|
68
68
|
left: '0',
|
|
69
69
|
top: '0',
|
|
@@ -18,6 +18,9 @@ import { KritzelKeyboardHelper } from "../../../helpers/keyboard.helper";
|
|
|
18
18
|
import { KritzelDevicesHelper } from "../../../helpers/devices.helper";
|
|
19
19
|
import { DEFAULT_ASSET_STORAGE_CONFIG } from "../../..";
|
|
20
20
|
import { DEFAULT_SYNC_CONFIG } from "../../../configs/default-sync.config";
|
|
21
|
+
import { ThemeHelper } from "../../../helpers/theme.helper";
|
|
22
|
+
import { lightTheme } from "../../../themes/light-theme";
|
|
23
|
+
import { darkTheme } from "../../../themes/dark-theme";
|
|
21
24
|
import { KritzelSelectionGroup } from "../../../classes/objects/selection-group.class";
|
|
22
25
|
import { KritzelSelectionBox } from "../../../classes/objects/selection-box.class";
|
|
23
26
|
export class KritzelEditor {
|
|
@@ -178,6 +181,8 @@ export class KritzelEditor {
|
|
|
178
181
|
},
|
|
179
182
|
{ label: 'Delete', icon: 'delete', group: 'edit', action: () => this.engineRef.delete() },
|
|
180
183
|
];
|
|
184
|
+
themes;
|
|
185
|
+
theme = 'light';
|
|
181
186
|
customSvgIcons = {};
|
|
182
187
|
isControlsVisible = true;
|
|
183
188
|
isUtilityPanelVisible = true;
|
|
@@ -224,9 +229,9 @@ export class KritzelEditor {
|
|
|
224
229
|
isVirtualKeyboardOpen = false;
|
|
225
230
|
undoState = null;
|
|
226
231
|
isBackToContentButtonVisible = false;
|
|
227
|
-
currentTheme = 'light';
|
|
228
232
|
shortcuts = [];
|
|
229
233
|
currentIsPublic = false;
|
|
234
|
+
isEditorVisible = false;
|
|
230
235
|
onIsEngineReady(newValue) {
|
|
231
236
|
if (newValue && this.isControlsReady) {
|
|
232
237
|
this.checkIsReady();
|
|
@@ -278,11 +283,15 @@ export class KritzelEditor {
|
|
|
278
283
|
}
|
|
279
284
|
}
|
|
280
285
|
onCurrentThemeChange() {
|
|
286
|
+
this.applyTheme();
|
|
281
287
|
setTimeout(() => this.setOsSpecificCssVariables(), 0);
|
|
282
288
|
if (this.engineRef) {
|
|
283
289
|
this.engineRef.saveSettings(this.currentSettingsConfig);
|
|
284
290
|
}
|
|
285
291
|
}
|
|
292
|
+
onThemesChange() {
|
|
293
|
+
this.applyTheme();
|
|
294
|
+
}
|
|
286
295
|
onTouchStart(event) {
|
|
287
296
|
if (event.cancelable) {
|
|
288
297
|
event.preventDefault();
|
|
@@ -424,6 +433,12 @@ export class KritzelEditor {
|
|
|
424
433
|
async exportViewportAsSvg() {
|
|
425
434
|
return this.engineRef.exportViewportAsSvg();
|
|
426
435
|
}
|
|
436
|
+
async exportSelectedObjectsAsPng() {
|
|
437
|
+
return this.engineRef.exportSelectedObjectsAsPng();
|
|
438
|
+
}
|
|
439
|
+
async exportSelectedObjectsAsSvg() {
|
|
440
|
+
return this.engineRef.exportSelectedObjectsAsSvg();
|
|
441
|
+
}
|
|
427
442
|
async downloadAsJson(filename) {
|
|
428
443
|
return this.engineRef.downloadAsJson(filename);
|
|
429
444
|
}
|
|
@@ -451,6 +466,9 @@ export class KritzelEditor {
|
|
|
451
466
|
async hideContextMenu() {
|
|
452
467
|
return this.engineRef.hideContextMenu();
|
|
453
468
|
}
|
|
469
|
+
async openContextMenu(options) {
|
|
470
|
+
return this.engineRef.openContextMenu(options);
|
|
471
|
+
}
|
|
454
472
|
async triggerSelectionChange() {
|
|
455
473
|
return this.engineRef.triggerSelectionChange();
|
|
456
474
|
}
|
|
@@ -466,6 +484,15 @@ export class KritzelEditor {
|
|
|
466
484
|
loginDialogRef;
|
|
467
485
|
componentWillLoad() {
|
|
468
486
|
this.loadSettingsFromStorage();
|
|
487
|
+
this.applyTheme();
|
|
488
|
+
}
|
|
489
|
+
applyTheme() {
|
|
490
|
+
const themeObj = this.resolveThemeObject();
|
|
491
|
+
ThemeHelper.applyThemeToElement(this.host, themeObj);
|
|
492
|
+
}
|
|
493
|
+
resolveThemeObject() {
|
|
494
|
+
return this.themes?.find(t => t.name === this.theme)
|
|
495
|
+
?? (this.theme === 'dark' ? darkTheme : lightTheme);
|
|
469
496
|
}
|
|
470
497
|
componentDidLoad() {
|
|
471
498
|
this.registerCustomSvgIcons();
|
|
@@ -480,6 +507,7 @@ export class KritzelEditor {
|
|
|
480
507
|
if (!this.isEngineReady || !this.isControlsReady || !this.isWorkspaceManagerReady || !this.activeWorkspace) {
|
|
481
508
|
return;
|
|
482
509
|
}
|
|
510
|
+
this.isEditorVisible = true;
|
|
483
511
|
const { id, name, isPublic, createdAt, updatedAt } = this.activeWorkspace;
|
|
484
512
|
this.isReady.emit({
|
|
485
513
|
host: this.host,
|
|
@@ -493,6 +521,7 @@ export class KritzelEditor {
|
|
|
493
521
|
syncConfig: this.syncConfig,
|
|
494
522
|
assetStorageConfig: this.assetStorageConfig,
|
|
495
523
|
loginConfig: this.loginConfig,
|
|
524
|
+
theme: this.theme
|
|
496
525
|
});
|
|
497
526
|
}
|
|
498
527
|
async onEngineReady(event) {
|
|
@@ -506,6 +535,7 @@ export class KritzelEditor {
|
|
|
506
535
|
this.loadShortcuts();
|
|
507
536
|
}
|
|
508
537
|
handleWorkspacesChange(event) {
|
|
538
|
+
event.stopPropagation();
|
|
509
539
|
this.workspaces = event.detail;
|
|
510
540
|
}
|
|
511
541
|
handleActiveWorkspaceChange(event) {
|
|
@@ -524,46 +554,54 @@ export class KritzelEditor {
|
|
|
524
554
|
});
|
|
525
555
|
}
|
|
526
556
|
handleObjectsChange(event) {
|
|
557
|
+
event.stopPropagation();
|
|
527
558
|
this.objectsChange.emit(event.detail);
|
|
528
559
|
}
|
|
529
560
|
handleObjectsAdded(event) {
|
|
561
|
+
event.stopPropagation();
|
|
530
562
|
this.objectsAdded.emit(event.detail);
|
|
531
563
|
}
|
|
532
564
|
handleObjectsRemoved(event) {
|
|
565
|
+
event.stopPropagation();
|
|
533
566
|
this.objectsRemoved.emit(event.detail);
|
|
534
567
|
}
|
|
535
568
|
handleObjectsUpdated(event) {
|
|
569
|
+
event.stopPropagation();
|
|
536
570
|
this.objectsUpdated.emit(event.detail);
|
|
537
571
|
}
|
|
538
572
|
handleUndoStateChange(event) {
|
|
573
|
+
event.stopPropagation();
|
|
539
574
|
this.undoStateChange.emit(event.detail);
|
|
540
575
|
this.undoState = event.detail;
|
|
541
576
|
}
|
|
542
577
|
async handleObjectsInViewportChange(event) {
|
|
578
|
+
event.stopPropagation();
|
|
543
579
|
const hasVisibleObjects = this.getContentObjects(event.detail).length > 0;
|
|
544
580
|
const hasAnyObjectsAtAll = this.getContentObjects(await this.engineRef.getAllObjects()).length > 0;
|
|
545
581
|
this.isBackToContentButtonVisible = !hasVisibleObjects && hasAnyObjectsAtAll;
|
|
546
582
|
}
|
|
547
583
|
handleViewportChange(event) {
|
|
584
|
+
event.stopPropagation();
|
|
548
585
|
this.viewportChange.emit(event.detail);
|
|
549
586
|
}
|
|
550
587
|
handleAwarenessChange(event) {
|
|
588
|
+
event.stopPropagation();
|
|
551
589
|
this.awarenessChange.emit(event.detail);
|
|
552
590
|
}
|
|
553
591
|
handleSettingsChange(event) {
|
|
554
592
|
this.scaleMin = event.detail.scaleMin;
|
|
555
593
|
this.scaleMax = event.detail.scaleMax;
|
|
556
594
|
this.lockDrawingScale = event.detail.lockDrawingScale;
|
|
557
|
-
this.
|
|
595
|
+
this.theme = event.detail.theme;
|
|
558
596
|
this.viewportBoundaryLeft = event.detail.viewportBoundaryLeft ?? -Infinity;
|
|
559
597
|
this.viewportBoundaryRight = event.detail.viewportBoundaryRight ?? Infinity;
|
|
560
598
|
this.viewportBoundaryTop = event.detail.viewportBoundaryTop ?? -Infinity;
|
|
561
599
|
this.viewportBoundaryBottom = event.detail.viewportBoundaryBottom ?? Infinity;
|
|
562
600
|
this.debugInfo = event.detail.debugInfo;
|
|
563
|
-
this.themeChange.emit(event.detail.theme);
|
|
564
601
|
if (this.engineRef) {
|
|
565
602
|
this.engineRef.saveSettings(event.detail);
|
|
566
603
|
}
|
|
604
|
+
this.themeChange.emit(event.detail.theme);
|
|
567
605
|
}
|
|
568
606
|
get moreMenuItems() {
|
|
569
607
|
return [
|
|
@@ -659,8 +697,8 @@ export class KritzelEditor {
|
|
|
659
697
|
if (typeof parsed.lockDrawingScale === 'boolean') {
|
|
660
698
|
this.lockDrawingScale = parsed.lockDrawingScale;
|
|
661
699
|
}
|
|
662
|
-
if (
|
|
663
|
-
this.
|
|
700
|
+
if (typeof parsed.theme === 'string') {
|
|
701
|
+
this.theme = parsed.theme;
|
|
664
702
|
}
|
|
665
703
|
if (typeof parsed.viewportBoundaryLeft === 'number') {
|
|
666
704
|
this.viewportBoundaryLeft = parsed.viewportBoundaryLeft;
|
|
@@ -691,7 +729,7 @@ export class KritzelEditor {
|
|
|
691
729
|
scaleMin: this.scaleMin,
|
|
692
730
|
scaleMax: this.scaleMax,
|
|
693
731
|
lockDrawingScale: this.lockDrawingScale,
|
|
694
|
-
theme: this.
|
|
732
|
+
theme: this.theme,
|
|
695
733
|
viewportBoundaryLeft: this.viewportBoundaryLeft,
|
|
696
734
|
viewportBoundaryRight: this.viewportBoundaryRight,
|
|
697
735
|
viewportBoundaryTop: this.viewportBoundaryTop,
|
|
@@ -744,28 +782,32 @@ export class KritzelEditor {
|
|
|
744
782
|
render() {
|
|
745
783
|
const isLoggedIn = this.isLoggedIn;
|
|
746
784
|
const shouldShowCurrentUser = isLoggedIn;
|
|
747
|
-
const shouldShowLoginButton = !!this.loginConfig && !isLoggedIn;
|
|
748
|
-
return (h(Host, { key: '
|
|
785
|
+
const shouldShowLoginButton = this.isReady && !!this.loginConfig && !isLoggedIn;
|
|
786
|
+
return (h(Host, { key: '3606d2318e6811f2f4b647f1531ff8bda409a401', style: {
|
|
787
|
+
opacity: this.isEditorVisible ? '1' : '0',
|
|
788
|
+
visibility: this.isEditorVisible ? 'visible' : 'hidden',
|
|
789
|
+
transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out',
|
|
790
|
+
} }, h("div", { key: '094e66c69a829a3d150cd672f66f3f092cf19623', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'b31a64b26f0f13a24bc07f2a5db8230ebc0377e2', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: '9768ead0daf60292c649a0ccdb4dcd92d8ce342a', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), h("kritzel-engine", { key: 'cf4cf487da19cd10352a31dab4e50db4aaabfd7a', ref: el => {
|
|
749
791
|
if (el) {
|
|
750
792
|
this.engineRef = el;
|
|
751
793
|
}
|
|
752
|
-
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.
|
|
794
|
+
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.theme, themes: this.themes, 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: 'eb0839b834e688f15461ebd7391c87b331a5b328', class: { 'keyboard-open': this.isVirtualKeyboardOpen }, style: { display: this.isControlsVisible ? 'flex' : 'none' }, ref: el => {
|
|
753
795
|
if (el) {
|
|
754
796
|
this.controlsRef = el;
|
|
755
797
|
}
|
|
756
|
-
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.
|
|
798
|
+
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: 'e5c14a118d245ef0ec1c5863eb21022a5e5d7c77', class: "top-right-buttons" }, h("kritzel-settings", { key: 'bad9ebae5bc91efaf388e525375ba263f0344374', ref: el => {
|
|
757
799
|
if (el) {
|
|
758
800
|
this.settingsRef = el;
|
|
759
801
|
}
|
|
760
|
-
}, shortcuts: this.shortcuts, settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '
|
|
802
|
+
}, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: 'ca28cd1057181b347af75ea51950114272bf33ec', ref: el => {
|
|
761
803
|
if (el) {
|
|
762
804
|
this.exportRef = el;
|
|
763
805
|
}
|
|
764
|
-
}, 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: '
|
|
806
|
+
}, 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: '1b667e832c1f231ecdd9ea0cca0504c6f4a82ce1', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: 'ec0a1827625f79435d20b8d53374eb29e7174f7e', user: this.user }), shouldShowLoginButton && (h("kritzel-button", { key: '0ddec61cc09b96797c33ae18c225ec967efed3e8', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in")), h("kritzel-more-menu", { key: 'e9d41eff38bbd4e9420f8586559597f8ec9d6802', items: this.moreMenuItems, visible: this.isMoreMenuVisible }), h("kritzel-share-dialog", { key: 'f3fd8a06f5cf0ac89c02d535ee30dec05c9e536f', ref: el => {
|
|
765
807
|
if (el) {
|
|
766
808
|
this.shareDialogRef = el;
|
|
767
809
|
}
|
|
768
|
-
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '
|
|
810
|
+
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '49bd9f85d4cb7ee0f8dc7d2b7248169848c36b9f', ref: el => {
|
|
769
811
|
if (el) {
|
|
770
812
|
this.loginDialogRef = el;
|
|
771
813
|
}
|
|
@@ -1092,6 +1134,57 @@ export class KritzelEditor {
|
|
|
1092
1134
|
"setter": false,
|
|
1093
1135
|
"defaultValue": "[\n { label: 'Copy', icon: 'copy', group: 'clipboard', action: () => this.engineRef.copy() },\n { label: 'Cut', icon: 'cut', group: 'clipboard', action: () => this.engineRef.cut() },\n {\n label: 'Paste',\n icon: 'paste',\n group: 'clipboard',\n disabled: async () => (await this.engineRef.getCopiedObjects()).length === 0,\n action: (menu, _) => this.engineRef.paste(menu.x, menu.y),\n },\n {\n label: 'Order',\n icon: 'ordering',\n group: 'other',\n children: [\n { label: 'Bring to Front', icon: 'bring-to-front', action: () => this.engineRef.bringToFront() },\n { label: 'Send to Back', icon: 'send-to-back', action: () => this.engineRef.sendToBack() },\n { label: 'Move Up', icon: 'arrow-up-from-dot', action: () => this.engineRef.bringForward() },\n { label: 'Move Down', icon: 'arrow-down-from-dot', action: () => this.engineRef.sendBackward() },\n ],\n },\n {\n label: 'Align',\n icon: 'align',\n group: 'other',\n disabled: async () => (await this.engineRef.getSelectedObjects()).length < 2,\n children: [\n { label: 'Align Left', icon: 'align-start-vertical', action: () => this.engineRef.alignObjects(KritzelAlignment.StartHorizontal) },\n { label: 'Align Center Horizontally', icon: 'align-center-horizontal', action: () => this.engineRef.alignObjects(KritzelAlignment.CenterHorizontal) },\n { label: 'Align Right', icon: 'align-end-vertical', action: () => this.engineRef.alignObjects(KritzelAlignment.EndHorizontal) },\n { label: 'Align Top', icon: 'align-start-horizontal', action: () => this.engineRef.alignObjects(KritzelAlignment.StartVertical) },\n { label: 'Align Center Vertically', icon: 'align-center-vertical', action: () => this.engineRef.alignObjects(KritzelAlignment.CenterVertical) },\n { label: 'Align Bottom', icon: 'align-end-horizontal', action: () => this.engineRef.alignObjects(KritzelAlignment.EndVertical) },\n ],\n },\n {\n label: 'Group',\n icon: 'group',\n group: 'other',\n children: [\n {\n label: 'Group',\n icon: 'group',\n disabled: async () => (await this.engineRef.getSelectedObjects()).length < 2,\n action: () => this.engineRef.group(),\n },\n {\n label: 'Ungroup',\n icon: 'ungroup',\n disabled: async () => {\n const selectedObjects = await this.engineRef.getSelectedObjects();\n return !selectedObjects.some(obj => obj.__class__ === 'KritzelGroup');\n },\n action: () => this.engineRef.ungroup(),\n },\n ],\n },\n {\n label: 'Export',\n icon: 'download',\n group: 'export',\n children: [\n { label: 'Export as SVG', icon: 'download', action: () => this.engineRef.exportSelectedObjectsAsSvg() },\n { label: 'Export as PNG', icon: 'download', action: () => this.engineRef.exportSelectedObjectsAsPng() },\n ],\n },\n { label: 'Delete', icon: 'delete', group: 'edit', action: () => this.engineRef.delete() },\n ]"
|
|
1094
1136
|
},
|
|
1137
|
+
"themes": {
|
|
1138
|
+
"type": "unknown",
|
|
1139
|
+
"mutable": false,
|
|
1140
|
+
"complexType": {
|
|
1141
|
+
"original": "KritzelTheme[]",
|
|
1142
|
+
"resolved": "KritzelTheme[]",
|
|
1143
|
+
"references": {
|
|
1144
|
+
"KritzelTheme": {
|
|
1145
|
+
"location": "import",
|
|
1146
|
+
"path": "../../../interfaces/theme.interface",
|
|
1147
|
+
"id": "src/interfaces/theme.interface.ts::KritzelTheme",
|
|
1148
|
+
"referenceLocation": "KritzelTheme"
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
"required": false,
|
|
1153
|
+
"optional": true,
|
|
1154
|
+
"docs": {
|
|
1155
|
+
"tags": [],
|
|
1156
|
+
"text": ""
|
|
1157
|
+
},
|
|
1158
|
+
"getter": false,
|
|
1159
|
+
"setter": false
|
|
1160
|
+
},
|
|
1161
|
+
"theme": {
|
|
1162
|
+
"type": "string",
|
|
1163
|
+
"mutable": true,
|
|
1164
|
+
"complexType": {
|
|
1165
|
+
"original": "ThemeName",
|
|
1166
|
+
"resolved": "\"dark\" | \"light\" | string & {}",
|
|
1167
|
+
"references": {
|
|
1168
|
+
"ThemeName": {
|
|
1169
|
+
"location": "import",
|
|
1170
|
+
"path": "../../../interfaces/theme.interface",
|
|
1171
|
+
"id": "src/interfaces/theme.interface.ts::ThemeName",
|
|
1172
|
+
"referenceLocation": "ThemeName"
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
"required": false,
|
|
1177
|
+
"optional": false,
|
|
1178
|
+
"docs": {
|
|
1179
|
+
"tags": [],
|
|
1180
|
+
"text": ""
|
|
1181
|
+
},
|
|
1182
|
+
"getter": false,
|
|
1183
|
+
"setter": false,
|
|
1184
|
+
"reflect": false,
|
|
1185
|
+
"attribute": "theme",
|
|
1186
|
+
"defaultValue": "'light'"
|
|
1187
|
+
},
|
|
1095
1188
|
"customSvgIcons": {
|
|
1096
1189
|
"type": "unknown",
|
|
1097
1190
|
"mutable": false,
|
|
@@ -1362,9 +1455,9 @@ export class KritzelEditor {
|
|
|
1362
1455
|
"isVirtualKeyboardOpen": {},
|
|
1363
1456
|
"undoState": {},
|
|
1364
1457
|
"isBackToContentButtonVisible": {},
|
|
1365
|
-
"currentTheme": {},
|
|
1366
1458
|
"shortcuts": {},
|
|
1367
|
-
"currentIsPublic": {}
|
|
1459
|
+
"currentIsPublic": {},
|
|
1460
|
+
"isEditorVisible": {}
|
|
1368
1461
|
};
|
|
1369
1462
|
}
|
|
1370
1463
|
static get events() {
|
|
@@ -1534,7 +1627,7 @@ export class KritzelEditor {
|
|
|
1534
1627
|
},
|
|
1535
1628
|
"complexType": {
|
|
1536
1629
|
"original": "ThemeName",
|
|
1537
|
-
"resolved": "\"dark\" | \"light\"",
|
|
1630
|
+
"resolved": "\"dark\" | \"light\" | string & {}",
|
|
1538
1631
|
"references": {
|
|
1539
1632
|
"ThemeName": {
|
|
1540
1633
|
"location": "import",
|
|
@@ -2746,6 +2839,40 @@ export class KritzelEditor {
|
|
|
2746
2839
|
"tags": []
|
|
2747
2840
|
}
|
|
2748
2841
|
},
|
|
2842
|
+
"exportSelectedObjectsAsPng": {
|
|
2843
|
+
"complexType": {
|
|
2844
|
+
"signature": "() => Promise<void>",
|
|
2845
|
+
"parameters": [],
|
|
2846
|
+
"references": {
|
|
2847
|
+
"Promise": {
|
|
2848
|
+
"location": "global",
|
|
2849
|
+
"id": "global::Promise"
|
|
2850
|
+
}
|
|
2851
|
+
},
|
|
2852
|
+
"return": "Promise<void>"
|
|
2853
|
+
},
|
|
2854
|
+
"docs": {
|
|
2855
|
+
"text": "",
|
|
2856
|
+
"tags": []
|
|
2857
|
+
}
|
|
2858
|
+
},
|
|
2859
|
+
"exportSelectedObjectsAsSvg": {
|
|
2860
|
+
"complexType": {
|
|
2861
|
+
"signature": "() => Promise<void>",
|
|
2862
|
+
"parameters": [],
|
|
2863
|
+
"references": {
|
|
2864
|
+
"Promise": {
|
|
2865
|
+
"location": "global",
|
|
2866
|
+
"id": "global::Promise"
|
|
2867
|
+
}
|
|
2868
|
+
},
|
|
2869
|
+
"return": "Promise<void>"
|
|
2870
|
+
},
|
|
2871
|
+
"docs": {
|
|
2872
|
+
"text": "",
|
|
2873
|
+
"tags": []
|
|
2874
|
+
}
|
|
2875
|
+
},
|
|
2749
2876
|
"downloadAsJson": {
|
|
2750
2877
|
"complexType": {
|
|
2751
2878
|
"signature": "(filename?: string) => Promise<void>",
|
|
@@ -2965,6 +3092,27 @@ export class KritzelEditor {
|
|
|
2965
3092
|
"tags": []
|
|
2966
3093
|
}
|
|
2967
3094
|
},
|
|
3095
|
+
"openContextMenu": {
|
|
3096
|
+
"complexType": {
|
|
3097
|
+
"signature": "(options: { x: number; y: number; objectId?: string; }) => Promise<void>",
|
|
3098
|
+
"parameters": [{
|
|
3099
|
+
"name": "options",
|
|
3100
|
+
"type": "{ x: number; y: number; objectId?: string; }",
|
|
3101
|
+
"docs": ""
|
|
3102
|
+
}],
|
|
3103
|
+
"references": {
|
|
3104
|
+
"Promise": {
|
|
3105
|
+
"location": "global",
|
|
3106
|
+
"id": "global::Promise"
|
|
3107
|
+
}
|
|
3108
|
+
},
|
|
3109
|
+
"return": "Promise<void>"
|
|
3110
|
+
},
|
|
3111
|
+
"docs": {
|
|
3112
|
+
"text": "",
|
|
3113
|
+
"tags": []
|
|
3114
|
+
}
|
|
3115
|
+
},
|
|
2968
3116
|
"triggerSelectionChange": {
|
|
2969
3117
|
"complexType": {
|
|
2970
3118
|
"signature": "() => Promise<void>",
|
|
@@ -3067,8 +3215,11 @@ export class KritzelEditor {
|
|
|
3067
3215
|
"propName": "activeWorkspaceId",
|
|
3068
3216
|
"methodName": "onActiveWorkspaceIdChange"
|
|
3069
3217
|
}, {
|
|
3070
|
-
"propName": "
|
|
3218
|
+
"propName": "theme",
|
|
3071
3219
|
"methodName": "onCurrentThemeChange"
|
|
3220
|
+
}, {
|
|
3221
|
+
"propName": "themes",
|
|
3222
|
+
"methodName": "onThemesChange"
|
|
3072
3223
|
}];
|
|
3073
3224
|
}
|
|
3074
3225
|
static get listeners() {
|
|
@@ -134,6 +134,14 @@ export class KritzelEngine {
|
|
|
134
134
|
onThemeChange(newValue) {
|
|
135
135
|
this.core.themeManager.setTheme(newValue);
|
|
136
136
|
}
|
|
137
|
+
/** An array of available themes for the editor. */
|
|
138
|
+
themes;
|
|
139
|
+
onThemesChange(newValue) {
|
|
140
|
+
if (newValue && newValue.length > 0) {
|
|
141
|
+
this.core.themeManager.registerThemes(newValue);
|
|
142
|
+
this.core.themeManager.applyTheme(this.core.themeManager.currentTheme);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
137
145
|
/** Left boundary of the viewport in world coordinates. Objects beyond this X position cannot be panned to. */
|
|
138
146
|
viewportBoundaryLeft = -Infinity;
|
|
139
147
|
onViewportBoundaryLeftChange(newValue) {
|
|
@@ -496,6 +504,18 @@ export class KritzelEngine {
|
|
|
496
504
|
this.core.store.state.isEnabled = true;
|
|
497
505
|
this.core.rerender();
|
|
498
506
|
}
|
|
507
|
+
/**
|
|
508
|
+
* Programmatically opens the context menu at a specified world-coordinate position.
|
|
509
|
+
* If `objectId` is provided and found, the object context menu is shown for that object.
|
|
510
|
+
* If no `objectId` is provided but a selection group already exists, the object context menu is shown.
|
|
511
|
+
* Otherwise, the global context menu is shown.
|
|
512
|
+
* @param options.x - The X position in world (canvas) coordinates.
|
|
513
|
+
* @param options.y - The Y position in world (canvas) coordinates.
|
|
514
|
+
* @param options.objectId - Optional ID of an object to select and show the object context menu for.
|
|
515
|
+
*/
|
|
516
|
+
async openContextMenu(options) {
|
|
517
|
+
this.contextMenuHandler.open(options);
|
|
518
|
+
}
|
|
499
519
|
/**
|
|
500
520
|
* Retrieves a canvas object by its unique ID.
|
|
501
521
|
* @param id - The object's unique identifier.
|
|
@@ -1350,6 +1370,11 @@ export class KritzelEngine {
|
|
|
1350
1370
|
}
|
|
1351
1371
|
componentWillLoad() {
|
|
1352
1372
|
this.core.setEditorId(this.editorId);
|
|
1373
|
+
if (this.themes && this.themes.length > 0) {
|
|
1374
|
+
this.core.themeManager.registerThemes(this.themes);
|
|
1375
|
+
}
|
|
1376
|
+
const editorElement = this.host.closest('kritzel-editor');
|
|
1377
|
+
this.core.themeManager.injectThemeEarly(editorElement || this.host);
|
|
1353
1378
|
this.core.setUser(this.user);
|
|
1354
1379
|
this.validateScaleMax(this.scaleMax);
|
|
1355
1380
|
this.validateScaleMin(this.scaleMin);
|
|
@@ -2334,7 +2359,7 @@ export class KritzelEngine {
|
|
|
2334
2359
|
"mutable": false,
|
|
2335
2360
|
"complexType": {
|
|
2336
2361
|
"original": "ThemeName",
|
|
2337
|
-
"resolved": "\"dark\" | \"light\"",
|
|
2362
|
+
"resolved": "\"dark\" | \"light\" | string & {}",
|
|
2338
2363
|
"references": {
|
|
2339
2364
|
"ThemeName": {
|
|
2340
2365
|
"location": "import",
|
|
@@ -2356,6 +2381,30 @@ export class KritzelEngine {
|
|
|
2356
2381
|
"attribute": "theme",
|
|
2357
2382
|
"defaultValue": "'light'"
|
|
2358
2383
|
},
|
|
2384
|
+
"themes": {
|
|
2385
|
+
"type": "unknown",
|
|
2386
|
+
"mutable": false,
|
|
2387
|
+
"complexType": {
|
|
2388
|
+
"original": "KritzelTheme[]",
|
|
2389
|
+
"resolved": "KritzelTheme[]",
|
|
2390
|
+
"references": {
|
|
2391
|
+
"KritzelTheme": {
|
|
2392
|
+
"location": "import",
|
|
2393
|
+
"path": "../../../interfaces/theme.interface",
|
|
2394
|
+
"id": "src/interfaces/theme.interface.ts::KritzelTheme",
|
|
2395
|
+
"referenceLocation": "KritzelTheme"
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
},
|
|
2399
|
+
"required": false,
|
|
2400
|
+
"optional": true,
|
|
2401
|
+
"docs": {
|
|
2402
|
+
"tags": [],
|
|
2403
|
+
"text": "An array of available themes for the editor."
|
|
2404
|
+
},
|
|
2405
|
+
"getter": false,
|
|
2406
|
+
"setter": false
|
|
2407
|
+
},
|
|
2359
2408
|
"viewportBoundaryLeft": {
|
|
2360
2409
|
"type": "number",
|
|
2361
2410
|
"mutable": false,
|
|
@@ -3312,6 +3361,36 @@ export class KritzelEngine {
|
|
|
3312
3361
|
"tags": []
|
|
3313
3362
|
}
|
|
3314
3363
|
},
|
|
3364
|
+
"openContextMenu": {
|
|
3365
|
+
"complexType": {
|
|
3366
|
+
"signature": "(options: { x: number; y: number; objectId?: string; }) => Promise<void>",
|
|
3367
|
+
"parameters": [{
|
|
3368
|
+
"name": "options",
|
|
3369
|
+
"type": "{ x: number; y: number; objectId?: string; }",
|
|
3370
|
+
"docs": ""
|
|
3371
|
+
}],
|
|
3372
|
+
"references": {
|
|
3373
|
+
"Promise": {
|
|
3374
|
+
"location": "global",
|
|
3375
|
+
"id": "global::Promise"
|
|
3376
|
+
}
|
|
3377
|
+
},
|
|
3378
|
+
"return": "Promise<void>"
|
|
3379
|
+
},
|
|
3380
|
+
"docs": {
|
|
3381
|
+
"text": "Programmatically opens the context menu at a specified world-coordinate position.\nIf `objectId` is provided and found, the object context menu is shown for that object.\nIf no `objectId` is provided but a selection group already exists, the object context menu is shown.\nOtherwise, the global context menu is shown.",
|
|
3382
|
+
"tags": [{
|
|
3383
|
+
"name": "param",
|
|
3384
|
+
"text": "options.x - The X position in world (canvas) coordinates."
|
|
3385
|
+
}, {
|
|
3386
|
+
"name": "param",
|
|
3387
|
+
"text": "options.y - The Y position in world (canvas) coordinates."
|
|
3388
|
+
}, {
|
|
3389
|
+
"name": "param",
|
|
3390
|
+
"text": "options.objectId - Optional ID of an object to select and show the object context menu for."
|
|
3391
|
+
}]
|
|
3392
|
+
}
|
|
3393
|
+
},
|
|
3315
3394
|
"getObjectById": {
|
|
3316
3395
|
"complexType": {
|
|
3317
3396
|
"signature": "<T extends KritzelBaseObject>(id: string) => Promise<T | null>",
|
|
@@ -4648,6 +4727,9 @@ export class KritzelEngine {
|
|
|
4648
4727
|
}, {
|
|
4649
4728
|
"propName": "theme",
|
|
4650
4729
|
"methodName": "onThemeChange"
|
|
4730
|
+
}, {
|
|
4731
|
+
"propName": "themes",
|
|
4732
|
+
"methodName": "onThemesChange"
|
|
4651
4733
|
}, {
|
|
4652
4734
|
"propName": "viewportBoundaryLeft",
|
|
4653
4735
|
"methodName": "onViewportBoundaryLeftChange"
|
|
@@ -81,16 +81,16 @@ export class KritzelAvatar {
|
|
|
81
81
|
height: `${this.size}px`,
|
|
82
82
|
fontSize: `${Math.round(this.size * 0.4)}px`,
|
|
83
83
|
};
|
|
84
|
-
return (h(Host, { key: '
|
|
84
|
+
return (h(Host, { key: '571bd5b92adc7c65b96ded37b8daf5ed79905361', style: containerStyles, class: {
|
|
85
85
|
'has-image': !!showImage,
|
|
86
86
|
'has-initials': !!showInitials,
|
|
87
87
|
'has-default': !!showDefaultIcon,
|
|
88
|
-
}, role: "img", "aria-label": this.getDisplayName() || 'User avatar' }, showImage && (h("img", { key: '
|
|
88
|
+
}, role: "img", "aria-label": this.getDisplayName() || 'User avatar' }, showImage && (h("img", { key: '1065850b4575fda4637ab61ce07c6dfc97f14a90', src: imageUrl, alt: "", class: "avatar-image", ref: (el) => {
|
|
89
89
|
if (el) {
|
|
90
90
|
el.referrerPolicy = 'no-referrer';
|
|
91
91
|
el.crossOrigin = 'anonymous';
|
|
92
92
|
}
|
|
93
|
-
}, onError: this.handleImageError })), showInitials && (h("span", { key: '
|
|
93
|
+
}, onError: this.handleImageError })), showInitials && (h("span", { key: 'a6d9c9dd2eac6e44c731a878e2460017da7fb0b7', class: "avatar-initials", style: { backgroundColor: this.getBackgroundColor() } }, initials)), showDefaultIcon && (h("span", { key: '9e9d33cdd213649071b76cb0875008562b30f6a1', class: "avatar-default" }, h("svg", { key: '5d0be5c503a8944b45de239f08e6f40378c2dc5e', viewBox: "0 0 24 24", fill: "currentColor" }, h("path", { key: '9264549c9b8abbdea74cd707d6f77bcfdde6459d', d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }))))));
|
|
94
94
|
}
|
|
95
95
|
static get is() { return "kritzel-avatar"; }
|
|
96
96
|
static get encapsulation() { return "shadow"; }
|