kritzel-stencil 0.3.7 → 0.3.8
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 +39 -39
- package/dist/cjs/kritzel-active-users_42.cjs.entry.js +274 -223
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{workspace.migrations-BlC8KRoQ.js → schema.constants-rCfWpcBV.js} +43 -28
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/tools/brush-tool.class.js +3 -0
- package/dist/collection/classes/tools/line-tool.class.js +3 -0
- package/dist/collection/classes/tools/selection-tool.class.js +2 -0
- package/dist/collection/classes/tools/shape-tool.class.js +3 -0
- package/dist/collection/classes/tools/text-tool.class.js +3 -0
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +30 -6
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +59 -10
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +1 -1
- package/dist/collection/components/ui/kritzel-tool-config/kritzel-tool-config.js +17 -2
- package/dist/collection/configs/default-brush-tool.config.js +4 -0
- package/dist/collection/configs/default-line-tool.config.js +2 -0
- package/dist/collection/configs/default-shape-tool.config.js +2 -0
- package/dist/collection/configs/default-text-tool.config.js +2 -0
- package/dist/collection/constants/stroke-size.constants.js +2 -0
- package/dist/collection/constants/version.js +1 -1
- package/dist/collection/helpers/tool-config.helper.js +4 -0
- package/dist/collection/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-editor.js +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-settings.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tool-config.js +1 -1
- package/dist/components/{p-D0ctIEh_.js → p-B8wX0-3H.js} +1 -1
- package/dist/components/p-CJjwjpMH.js +1 -0
- package/dist/components/{p-Ctd1w9-z.js → p-DdlK75Kx.js} +1 -1
- package/dist/components/p-DwHZN643.js +1 -0
- package/dist/components/p-W0nK9EQJ.js +9 -0
- package/dist/components/{p-DF8X_22i.js → p-ihbmwmHg.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-active-users_42.entry.js +68 -17
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{workspace.migrations-BLXBI--a.js → schema.constants-cuIrI5X8.js} +43 -29
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-9ce67a14.entry.js +9 -0
- package/dist/stencil/p-cuIrI5X8.js +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/tools/brush-tool.class.d.ts +2 -0
- package/dist/types/classes/tools/line-tool.class.d.ts +2 -0
- package/dist/types/classes/tools/shape-tool.class.d.ts +2 -0
- package/dist/types/classes/tools/text-tool.class.d.ts +2 -0
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +1 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +6 -0
- package/dist/types/components/ui/kritzel-tool-config/kritzel-tool-config.d.ts +2 -0
- package/dist/types/components.d.ts +6 -0
- package/dist/types/constants/stroke-size.constants.d.ts +2 -0
- package/dist/types/constants/version.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interfaces/tool-config.interface.d.ts +1 -0
- package/dist/types/interfaces/toolbar-control.interface.d.ts +6 -0
- package/package.json +1 -1
- package/dist/components/p-8b9zAWnS.js +0 -1
- package/dist/components/p-CoJdbj3f.js +0 -1
- package/dist/components/p-P0p4WBpa.js +0 -9
- package/dist/stencil/p-3058e485.entry.js +0 -9
- package/dist/stencil/p-BLXBI--a.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CFnj_FXt.js');
|
|
4
|
-
var
|
|
4
|
+
var schema_constants = require('./schema.constants-rCfWpcBV.js');
|
|
5
5
|
var Y = require('yjs');
|
|
6
6
|
require('y-indexeddb');
|
|
7
7
|
require('y-websocket');
|
|
@@ -291,7 +291,7 @@ const KritzelAwarenessCursors = class {
|
|
|
291
291
|
const obj = this.core.store.objects?.findById(objectId);
|
|
292
292
|
if (!obj)
|
|
293
293
|
return null;
|
|
294
|
-
if (obj instanceof
|
|
294
|
+
if (obj instanceof schema_constants.KritzelPath && !obj.isCompleted) {
|
|
295
295
|
const lastPoint = obj.points[obj.points.length - 1];
|
|
296
296
|
if (!lastPoint)
|
|
297
297
|
return null;
|
|
@@ -300,7 +300,7 @@ const KritzelAwarenessCursors = class {
|
|
|
300
300
|
y: (lastPoint[1] - obj.y) / obj.scale + obj.translateY,
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
if (obj instanceof
|
|
303
|
+
if (obj instanceof schema_constants.KritzelLine && !obj.isCompleted) {
|
|
304
304
|
return {
|
|
305
305
|
x: (obj.endX - obj.x) / obj.scale + obj.translateX,
|
|
306
306
|
y: (obj.endY - obj.y) / obj.scale + obj.translateY,
|
|
@@ -523,7 +523,7 @@ const KritzelColorComponent = class {
|
|
|
523
523
|
return '';
|
|
524
524
|
if (typeof this.value === 'string')
|
|
525
525
|
return this.value;
|
|
526
|
-
return
|
|
526
|
+
return schema_constants.KritzelColorHelper.resolveThemeColor(this.value, this.theme);
|
|
527
527
|
}
|
|
528
528
|
isLightColor(hexColor) {
|
|
529
529
|
if (!hexColor)
|
|
@@ -623,7 +623,7 @@ const KritzelColorPalette = class {
|
|
|
623
623
|
return (index.h("div", { tabIndex: 0, class: {
|
|
624
624
|
'color-container': true,
|
|
625
625
|
'selected': this.areColorsEqual(this.selectedColor, color),
|
|
626
|
-
}, onClick: () => this.handleColorClick(color), onKeyDown: event => this.handleKeyDown(event, color) }, index.h("kritzel-color", { value:
|
|
626
|
+
}, onClick: () => this.handleColorClick(color), onKeyDown: event => this.handleKeyDown(event, color) }, index.h("kritzel-color", { value: schema_constants.KritzelColorHelper.applyOpacity(color, this.opacity, this.theme), theme: this.theme })));
|
|
627
627
|
}))));
|
|
628
628
|
}
|
|
629
629
|
};
|
|
@@ -834,54 +834,58 @@ KritzelContextMenu.style = kritzelContextMenuCss();
|
|
|
834
834
|
class KritzelToolConfigHelper {
|
|
835
835
|
static getToolConfig(tool) {
|
|
836
836
|
const toolConstructorName = tool?.constructor?.name;
|
|
837
|
-
if (tool instanceof
|
|
837
|
+
if (tool instanceof schema_constants.KritzelSelectionTool || toolConstructorName === 'KritzelSelectionTool') {
|
|
838
838
|
return tool.getToolConfig();
|
|
839
839
|
}
|
|
840
|
-
if (tool instanceof
|
|
840
|
+
if (tool instanceof schema_constants.KritzelBrushTool || toolConstructorName === 'KritzelBrushTool') {
|
|
841
841
|
return {
|
|
842
842
|
type: 'brush',
|
|
843
843
|
colorProperty: 'color',
|
|
844
844
|
sizeProperty: 'size',
|
|
845
845
|
opacityProperty: 'opacity',
|
|
846
846
|
paletteSource: 'palette',
|
|
847
|
+
sizesSource: 'sizes',
|
|
847
848
|
controls: [
|
|
848
849
|
{ type: 'stroke-size', propertyName: 'size' },
|
|
849
850
|
],
|
|
850
851
|
};
|
|
851
852
|
}
|
|
852
|
-
if (tool instanceof
|
|
853
|
+
if (tool instanceof schema_constants.KritzelLineTool || toolConstructorName === 'KritzelLineTool') {
|
|
853
854
|
return {
|
|
854
855
|
type: 'line',
|
|
855
856
|
colorProperty: 'color',
|
|
856
857
|
sizeProperty: 'size',
|
|
857
858
|
opacityProperty: 'opacity',
|
|
858
859
|
paletteSource: 'palette',
|
|
860
|
+
sizesSource: 'sizes',
|
|
859
861
|
controls: [
|
|
860
862
|
{ type: 'stroke-size', propertyName: 'size' },
|
|
861
863
|
{ type: 'line-endings', propertyName: 'arrows', additionalProps: {} },
|
|
862
864
|
],
|
|
863
865
|
};
|
|
864
866
|
}
|
|
865
|
-
if (tool instanceof
|
|
867
|
+
if (tool instanceof schema_constants.KritzelShapeTool || toolConstructorName === 'KritzelShapeTool') {
|
|
866
868
|
return {
|
|
867
869
|
type: 'shape',
|
|
868
870
|
colorProperty: 'strokeColor',
|
|
869
871
|
sizeProperty: 'strokeWidth',
|
|
870
872
|
opacityProperty: 'opacity',
|
|
871
873
|
paletteSource: 'palette',
|
|
874
|
+
sizesSource: 'sizes',
|
|
872
875
|
controls: [
|
|
873
876
|
{ type: 'stroke-size', propertyName: 'strokeWidth' },
|
|
874
877
|
{ type: 'shape-fill', propertyName: 'fillColor', additionalProps: {} },
|
|
875
878
|
],
|
|
876
879
|
};
|
|
877
880
|
}
|
|
878
|
-
if (tool instanceof
|
|
881
|
+
if (tool instanceof schema_constants.KritzelTextTool || toolConstructorName === 'KritzelTextTool') {
|
|
879
882
|
return {
|
|
880
883
|
type: 'text',
|
|
881
884
|
colorProperty: 'fontColor',
|
|
882
885
|
sizeProperty: 'fontSize',
|
|
883
886
|
opacityProperty: 'opacity',
|
|
884
887
|
paletteSource: 'palette',
|
|
888
|
+
sizesSource: 'sizes',
|
|
885
889
|
controls: [
|
|
886
890
|
{ type: 'font-size', propertyName: 'fontSize', additionalProps: {} },
|
|
887
891
|
{ type: 'font-family', propertyName: 'fontFamily' },
|
|
@@ -908,7 +912,7 @@ const KritzelControls = class {
|
|
|
908
912
|
theme;
|
|
909
913
|
isControlsReady;
|
|
910
914
|
firstConfig = null;
|
|
911
|
-
isTouchDevice =
|
|
915
|
+
isTouchDevice = schema_constants.KritzelDevicesHelper.isTouchDevice();
|
|
912
916
|
selectedSubOptions = new Map();
|
|
913
917
|
canScrollLeft = false;
|
|
914
918
|
canScrollRight = false;
|
|
@@ -932,7 +936,7 @@ const KritzelControls = class {
|
|
|
932
936
|
this.closeTooltip();
|
|
933
937
|
}
|
|
934
938
|
handleSelectionChange() {
|
|
935
|
-
if (this.activeControl?.tool instanceof
|
|
939
|
+
if (this.activeControl?.tool instanceof schema_constants.KritzelSelectionTool) {
|
|
936
940
|
this.updateDisplayValues(this.activeControl.tool);
|
|
937
941
|
}
|
|
938
942
|
}
|
|
@@ -981,10 +985,10 @@ const KritzelControls = class {
|
|
|
981
985
|
const opacity = tool[config.opacityProperty] ?? 1;
|
|
982
986
|
const size = tool[config.sizeProperty];
|
|
983
987
|
const displayValues = {
|
|
984
|
-
color:
|
|
988
|
+
color: schema_constants.KritzelColorHelper.applyOpacity(color, opacity, this.theme),
|
|
985
989
|
size,
|
|
986
990
|
};
|
|
987
|
-
if (tool instanceof
|
|
991
|
+
if (tool instanceof schema_constants.KritzelTextTool) {
|
|
988
992
|
displayValues.fontFamily = tool.fontFamily;
|
|
989
993
|
}
|
|
990
994
|
// Check for equality implementation to prevent unnecessary re-renders
|
|
@@ -1259,7 +1263,7 @@ const KritzelCursorTrail = class {
|
|
|
1259
1263
|
isLeftButtonDown = false;
|
|
1260
1264
|
handleMouseDown(ev) {
|
|
1261
1265
|
if (ev.pointerType === 'mouse') {
|
|
1262
|
-
if (ev.button ===
|
|
1266
|
+
if (ev.button === schema_constants.KritzelMouseButton.Left) {
|
|
1263
1267
|
this.isLeftButtonDown = true;
|
|
1264
1268
|
this.cursorTrailPoints = [];
|
|
1265
1269
|
}
|
|
@@ -1286,7 +1290,7 @@ const KritzelCursorTrail = class {
|
|
|
1286
1290
|
}
|
|
1287
1291
|
handlePointerUp(ev) {
|
|
1288
1292
|
if (ev.pointerType === 'mouse') {
|
|
1289
|
-
if (ev.button ===
|
|
1293
|
+
if (ev.button === schema_constants.KritzelMouseButton.Left) {
|
|
1290
1294
|
this.isLeftButtonDown = false;
|
|
1291
1295
|
this.cursorTrailPoints = [];
|
|
1292
1296
|
}
|
|
@@ -2108,14 +2112,15 @@ const KritzelDropdown = class {
|
|
|
2108
2112
|
KritzelDropdown.style = kritzelDropdownCss();
|
|
2109
2113
|
|
|
2110
2114
|
const DEFAULT_SHAPE_CONFIG = {
|
|
2111
|
-
shapeType:
|
|
2115
|
+
shapeType: schema_constants.ShapeType.Rectangle,
|
|
2112
2116
|
fillColor: { light: 'transparent', dark: 'transparent' },
|
|
2113
|
-
strokeColor:
|
|
2117
|
+
strokeColor: schema_constants.DEFAULT_COLOR_PALETTE[0],
|
|
2114
2118
|
strokeWidth: 4,
|
|
2115
|
-
fontColor:
|
|
2119
|
+
fontColor: schema_constants.DEFAULT_COLOR_PALETTE[0],
|
|
2116
2120
|
fontSize: 16,
|
|
2117
2121
|
fontFamily: 'Arial',
|
|
2118
|
-
palette: [...
|
|
2122
|
+
palette: [...schema_constants.DEFAULT_COLOR_PALETTE],
|
|
2123
|
+
sizes: [...schema_constants.DEFAULT_STROKE_SIZES],
|
|
2119
2124
|
};
|
|
2120
2125
|
|
|
2121
2126
|
const ABSOLUTE_SCALE_MAX = 1000;
|
|
@@ -2126,7 +2131,7 @@ const ABSOLUTE_SCALE_MIN = 0.0001;
|
|
|
2126
2131
|
*/
|
|
2127
2132
|
const DEFAULT_SYNC_CONFIG = {
|
|
2128
2133
|
providers: [
|
|
2129
|
-
|
|
2134
|
+
schema_constants.IndexedDBSyncProvider
|
|
2130
2135
|
],
|
|
2131
2136
|
};
|
|
2132
2137
|
|
|
@@ -2171,52 +2176,52 @@ const KritzelEditor = class {
|
|
|
2171
2176
|
name: 'selection',
|
|
2172
2177
|
type: 'tool',
|
|
2173
2178
|
isDefault: true,
|
|
2174
|
-
tool:
|
|
2179
|
+
tool: schema_constants.KritzelSelectionTool,
|
|
2175
2180
|
icon: 'cursor',
|
|
2176
2181
|
},
|
|
2177
2182
|
{
|
|
2178
2183
|
name: 'brush',
|
|
2179
2184
|
type: 'tool',
|
|
2180
|
-
tool:
|
|
2185
|
+
tool: schema_constants.KritzelBrushTool,
|
|
2181
2186
|
icon: 'pen',
|
|
2182
|
-
config:
|
|
2187
|
+
config: schema_constants.DEFAULT_BRUSH_CONFIG,
|
|
2183
2188
|
},
|
|
2184
2189
|
{
|
|
2185
2190
|
name: 'eraser',
|
|
2186
2191
|
type: 'tool',
|
|
2187
|
-
tool:
|
|
2192
|
+
tool: schema_constants.KritzelEraserTool,
|
|
2188
2193
|
icon: 'eraser',
|
|
2189
2194
|
},
|
|
2190
2195
|
{
|
|
2191
2196
|
name: 'line',
|
|
2192
2197
|
type: 'tool',
|
|
2193
|
-
tool:
|
|
2198
|
+
tool: schema_constants.KritzelLineTool,
|
|
2194
2199
|
icon: 'arrow',
|
|
2195
|
-
config:
|
|
2200
|
+
config: schema_constants.DEFAULT_LINE_TOOL_CONFIG,
|
|
2196
2201
|
},
|
|
2197
2202
|
{
|
|
2198
2203
|
name: 'shape',
|
|
2199
2204
|
type: 'tool',
|
|
2200
|
-
tool:
|
|
2205
|
+
tool: schema_constants.KritzelShapeTool,
|
|
2201
2206
|
icon: 'shape-rectangle',
|
|
2202
2207
|
config: DEFAULT_SHAPE_CONFIG,
|
|
2203
2208
|
subOptions: [
|
|
2204
|
-
{ id: 'rectangle', icon: 'shape-rectangle', label: 'Rectangle', value:
|
|
2205
|
-
{ id: 'ellipse', icon: 'shape-ellipse', label: 'Ellipse', value:
|
|
2206
|
-
{ id: 'triangle', icon: 'shape-triangle', label: 'Triangle', value:
|
|
2209
|
+
{ id: 'rectangle', icon: 'shape-rectangle', label: 'Rectangle', value: schema_constants.ShapeType.Rectangle, toolProperty: 'shapeType' },
|
|
2210
|
+
{ id: 'ellipse', icon: 'shape-ellipse', label: 'Ellipse', value: schema_constants.ShapeType.Ellipse, toolProperty: 'shapeType' },
|
|
2211
|
+
{ id: 'triangle', icon: 'shape-triangle', label: 'Triangle', value: schema_constants.ShapeType.Triangle, toolProperty: 'shapeType' },
|
|
2207
2212
|
],
|
|
2208
2213
|
},
|
|
2209
2214
|
{
|
|
2210
2215
|
name: 'text',
|
|
2211
2216
|
type: 'tool',
|
|
2212
|
-
tool:
|
|
2217
|
+
tool: schema_constants.KritzelTextTool,
|
|
2213
2218
|
icon: 'type',
|
|
2214
|
-
config:
|
|
2219
|
+
config: schema_constants.DEFAULT_TEXT_CONFIG,
|
|
2215
2220
|
},
|
|
2216
2221
|
{
|
|
2217
2222
|
name: 'image',
|
|
2218
2223
|
type: 'tool',
|
|
2219
|
-
tool:
|
|
2224
|
+
tool: schema_constants.KritzelImageTool,
|
|
2220
2225
|
icon: 'image',
|
|
2221
2226
|
},
|
|
2222
2227
|
{
|
|
@@ -2265,12 +2270,12 @@ const KritzelEditor = class {
|
|
|
2265
2270
|
group: 'other',
|
|
2266
2271
|
disabled: async () => (await this.engineRef.getSelectedObjects()).length < 2,
|
|
2267
2272
|
children: [
|
|
2268
|
-
{ label: 'Align Left', icon: 'align-start-vertical', action: () => this.engineRef.alignObjects(
|
|
2269
|
-
{ label: 'Align Center Horizontally', icon: 'align-center-horizontal', action: () => this.engineRef.alignObjects(
|
|
2270
|
-
{ label: 'Align Right', icon: 'align-end-vertical', action: () => this.engineRef.alignObjects(
|
|
2271
|
-
{ label: 'Align Top', icon: 'align-start-horizontal', action: () => this.engineRef.alignObjects(
|
|
2272
|
-
{ label: 'Align Center Vertically', icon: 'align-center-vertical', action: () => this.engineRef.alignObjects(
|
|
2273
|
-
{ label: 'Align Bottom', icon: 'align-end-horizontal', action: () => this.engineRef.alignObjects(
|
|
2273
|
+
{ label: 'Align Left', icon: 'align-start-vertical', action: () => this.engineRef.alignObjects(schema_constants.KritzelAlignment.StartHorizontal) },
|
|
2274
|
+
{ label: 'Align Center Horizontally', icon: 'align-center-horizontal', action: () => this.engineRef.alignObjects(schema_constants.KritzelAlignment.CenterHorizontal) },
|
|
2275
|
+
{ label: 'Align Right', icon: 'align-end-vertical', action: () => this.engineRef.alignObjects(schema_constants.KritzelAlignment.EndHorizontal) },
|
|
2276
|
+
{ label: 'Align Top', icon: 'align-start-horizontal', action: () => this.engineRef.alignObjects(schema_constants.KritzelAlignment.StartVertical) },
|
|
2277
|
+
{ label: 'Align Center Vertically', icon: 'align-center-vertical', action: () => this.engineRef.alignObjects(schema_constants.KritzelAlignment.CenterVertical) },
|
|
2278
|
+
{ label: 'Align Bottom', icon: 'align-end-horizontal', action: () => this.engineRef.alignObjects(schema_constants.KritzelAlignment.EndVertical) },
|
|
2274
2279
|
],
|
|
2275
2280
|
},
|
|
2276
2281
|
{
|
|
@@ -2312,7 +2317,7 @@ const KritzelEditor = class {
|
|
|
2312
2317
|
isWorkspaceManagerVisible = true;
|
|
2313
2318
|
isMoreMenuVisible = true;
|
|
2314
2319
|
syncConfig = DEFAULT_SYNC_CONFIG;
|
|
2315
|
-
assetStorageConfig =
|
|
2320
|
+
assetStorageConfig = schema_constants.DEFAULT_ASSET_STORAGE_CONFIG;
|
|
2316
2321
|
/** The element to use as the target for the cursor. Defaults to the editor container if not set. */
|
|
2317
2322
|
cursorTarget;
|
|
2318
2323
|
/** Optional login configuration. When provided, a "Sign in" button is shown that opens a login dialog with the configured providers. */
|
|
@@ -2495,6 +2500,9 @@ const KritzelEditor = class {
|
|
|
2495
2500
|
async changeActiveTool(tool) {
|
|
2496
2501
|
return this.engineRef.changeActiveTool(tool);
|
|
2497
2502
|
}
|
|
2503
|
+
async changeActiveToolByName(toolName) {
|
|
2504
|
+
return this.engineRef.changeActiveToolByName(toolName);
|
|
2505
|
+
}
|
|
2498
2506
|
async disable() {
|
|
2499
2507
|
return this.engineRef.disable();
|
|
2500
2508
|
}
|
|
@@ -2825,20 +2833,20 @@ const KritzelEditor = class {
|
|
|
2825
2833
|
};
|
|
2826
2834
|
}
|
|
2827
2835
|
getContentObjects(objects) {
|
|
2828
|
-
return objects.filter(obj => !(obj instanceof
|
|
2836
|
+
return objects.filter(obj => !(obj instanceof schema_constants.KritzelSelectionGroup) && !(obj instanceof schema_constants.KritzelSelectionBox));
|
|
2829
2837
|
}
|
|
2830
2838
|
registerCustomSvgIcons() {
|
|
2831
2839
|
for (const [name, svg] of Object.entries(this.customSvgIcons)) {
|
|
2832
|
-
|
|
2840
|
+
schema_constants.KritzelIconRegistry.register(name, svg);
|
|
2833
2841
|
}
|
|
2834
2842
|
}
|
|
2835
2843
|
listenForMobileKeyboard() {
|
|
2836
|
-
|
|
2844
|
+
schema_constants.KritzelKeyboardHelper.onKeyboardVisibleChanged(isOpen => {
|
|
2837
2845
|
this.isVirtualKeyboardOpen = isOpen;
|
|
2838
2846
|
});
|
|
2839
2847
|
}
|
|
2840
2848
|
setOsSpecificCssVariables() {
|
|
2841
|
-
const os =
|
|
2849
|
+
const os = schema_constants.KritzelDevicesHelper.detectOS();
|
|
2842
2850
|
switch (os) {
|
|
2843
2851
|
case 'iOS':
|
|
2844
2852
|
// iOS specific adjustments
|
|
@@ -2870,27 +2878,27 @@ const KritzelEditor = class {
|
|
|
2870
2878
|
const isLoggedIn = this.isLoggedIn;
|
|
2871
2879
|
const shouldShowCurrentUser = isLoggedIn;
|
|
2872
2880
|
const shouldShowLoginButton = !!this.loginConfig && !isLoggedIn;
|
|
2873
|
-
return (index.h(index.Host, { key: '
|
|
2881
|
+
return (index.h(index.Host, { key: '2856db9fa6a0926df078d5d6eedb19d2b4de98a5' }, index.h("div", { key: '7ffad0fd28904b740af43e20addfef701bbcead9', class: "top-left-buttons" }, index.h("kritzel-workspace-manager", { key: '0639e3d0f1a91935d42c10d5dfa793fd595cc234', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), index.h("kritzel-back-to-content", { key: '0039bc16615c26ab239ceeac418a7d47ff2ad40a', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), index.h("kritzel-engine", { key: '4815e1c4dfc6a04e68894b795c02dd678fec108d', ref: el => {
|
|
2874
2882
|
if (el) {
|
|
2875
2883
|
this.engineRef = el;
|
|
2876
2884
|
}
|
|
2877
|
-
}, 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.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) }), index.h("kritzel-controls", { key: '
|
|
2885
|
+
}, 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.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) }), index.h("kritzel-controls", { key: 'fc44c417ee17a98f2b5d8eecffac6a86e43fda2a', class: { 'keyboard-open': this.isVirtualKeyboardOpen }, style: { display: this.isControlsVisible ? 'flex' : 'none' }, ref: el => {
|
|
2878
2886
|
if (el) {
|
|
2879
2887
|
this.controlsRef = el;
|
|
2880
2888
|
}
|
|
2881
|
-
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.currentTheme, onIsControlsReady: () => (this.isControlsReady = true) }), index.h("div", { key: '
|
|
2889
|
+
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.currentTheme, onIsControlsReady: () => (this.isControlsReady = true) }), index.h("div", { key: 'f333d2b31d456d4e35dbd41c93492329939a7c4d', class: "top-right-buttons" }, index.h("kritzel-settings", { key: '7900c9b1c3fd35e07e0d2a2aa0b797f455f52e1d', ref: el => {
|
|
2882
2890
|
if (el) {
|
|
2883
2891
|
this.settingsRef = el;
|
|
2884
2892
|
}
|
|
2885
|
-
}, shortcuts: this.shortcuts, settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), index.h("kritzel-export", { key: '
|
|
2893
|
+
}, shortcuts: this.shortcuts, settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), index.h("kritzel-export", { key: 'c6ad8ae5255c9d90d854b7a26e81b65cfdc6236d', ref: el => {
|
|
2886
2894
|
if (el) {
|
|
2887
2895
|
this.exportRef = el;
|
|
2888
2896
|
}
|
|
2889
|
-
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), index.h("kritzel-active-users", { key: '
|
|
2897
|
+
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), index.h("kritzel-active-users", { key: '3d6d3c460e5954b4d477c6bcc9992e503f781a81', users: this.activeUsers }), shouldShowCurrentUser && index.h("kritzel-current-user", { key: '33a72ce69276082ca7cc2815a93ad14de8dcf5a0', user: this.user }), shouldShowLoginButton && index.h("kritzel-button", { key: '809dedeacbf89674e42ab3e5850e67aadfe1111c', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in"), index.h("kritzel-more-menu", { key: '7521045a24e32e6aa69a5a8c41a4edea5d657d93', items: this.moreMenuItems, visible: this.isMoreMenuVisible }), index.h("kritzel-share-dialog", { key: 'a4e778dee23b3dba94109c141e3628f22b740355', ref: el => {
|
|
2890
2898
|
if (el) {
|
|
2891
2899
|
this.shareDialogRef = el;
|
|
2892
2900
|
}
|
|
2893
|
-
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (index.h("kritzel-login-dialog", { key: '
|
|
2901
|
+
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (index.h("kritzel-login-dialog", { key: '3394d489bdbc92c572208c8f65601bf91568f0c4', ref: el => {
|
|
2894
2902
|
if (el) {
|
|
2895
2903
|
this.loginDialogRef = el;
|
|
2896
2904
|
}
|
|
@@ -20327,7 +20335,7 @@ class KritzelViewport {
|
|
|
20327
20335
|
if (event.pointerType === 'mouse') {
|
|
20328
20336
|
const adjustedClientX = event.clientX - this._core.store.offsetX;
|
|
20329
20337
|
const adjustedClientY = event.clientY - this._core.store.offsetY;
|
|
20330
|
-
if (event.button ===
|
|
20338
|
+
if (event.button === schema_constants.KritzelMouseButton.Right) {
|
|
20331
20339
|
this._core.store.state.isPanning = true;
|
|
20332
20340
|
this._core.store.state.startX = adjustedClientX;
|
|
20333
20341
|
this._core.store.state.startY = adjustedClientY;
|
|
@@ -20349,7 +20357,7 @@ class KritzelViewport {
|
|
|
20349
20357
|
// Clear selection box when scaling starts to prevent it from remaining on screen
|
|
20350
20358
|
if (this._core.store.state.isSelecting) {
|
|
20351
20359
|
this._core.store.state.isSelecting = false;
|
|
20352
|
-
this._core.store.objects.remove(obj => obj instanceof
|
|
20360
|
+
this._core.store.objects.remove(obj => obj instanceof schema_constants.KritzelSelectionBox);
|
|
20353
20361
|
this._core.store.setSelectionBox(null);
|
|
20354
20362
|
// Clear selection preview state from objects - use selectedObjects for efficiency
|
|
20355
20363
|
this._core.store.selectedObjects.forEach(object => {
|
|
@@ -20877,7 +20885,7 @@ const NUDGE_AMOUNT = 10;
|
|
|
20877
20885
|
* Provides functionality for tool switching, clipboard operations, object manipulation,
|
|
20878
20886
|
* undo/redo, and navigation via keyboard input.
|
|
20879
20887
|
*/
|
|
20880
|
-
class KritzelKeyHandler extends
|
|
20888
|
+
class KritzelKeyHandler extends schema_constants.KritzelBaseHandler {
|
|
20881
20889
|
/**
|
|
20882
20890
|
* Array of registered keyboard shortcuts with their associated actions.
|
|
20883
20891
|
* Each shortcut defines the key combination, display label, category, optional condition, and action to execute.
|
|
@@ -21058,7 +21066,7 @@ class KritzelKeyHandler extends workspace_migrations.KritzelBaseHandler {
|
|
|
21058
21066
|
* Manages the display and positioning of context menus, selecting appropriate menu items
|
|
21059
21067
|
* based on whether an object is targeted or the canvas background is right-clicked.
|
|
21060
21068
|
*/
|
|
21061
|
-
class KritzelContextMenuHandler extends
|
|
21069
|
+
class KritzelContextMenuHandler extends schema_constants.KritzelBaseHandler {
|
|
21062
21070
|
/**
|
|
21063
21071
|
* Menu items to display when the context menu is opened on the canvas background
|
|
21064
21072
|
* (i.e., when no object is selected).
|
|
@@ -21094,7 +21102,7 @@ class KritzelContextMenuHandler extends workspace_migrations.KritzelBaseHandler
|
|
|
21094
21102
|
* @returns void - This method does not return a value; it updates state and triggers a rerender.
|
|
21095
21103
|
*/
|
|
21096
21104
|
handleContextMenu(event) {
|
|
21097
|
-
if (!(this._core.store.state.activeTool instanceof
|
|
21105
|
+
if (!(this._core.store.state.activeTool instanceof schema_constants.KritzelSelectionTool)) {
|
|
21098
21106
|
return;
|
|
21099
21107
|
}
|
|
21100
21108
|
if (this._core.store.state.skipContextMenu) {
|
|
@@ -21104,13 +21112,13 @@ class KritzelContextMenuHandler extends workspace_migrations.KritzelBaseHandler
|
|
|
21104
21112
|
const selectionTool = this._core.store.state.activeTool;
|
|
21105
21113
|
selectionTool?.moveHandler?.cancelPendingDrag();
|
|
21106
21114
|
if (this._core.store.selectionBox) {
|
|
21107
|
-
this._core.store.objects.remove(object => object instanceof
|
|
21115
|
+
this._core.store.objects.remove(object => object instanceof schema_constants.KritzelSelectionBox);
|
|
21108
21116
|
this._core.store.setSelectionBox(null);
|
|
21109
21117
|
this._core.store.state.isSelecting = false;
|
|
21110
21118
|
}
|
|
21111
21119
|
const selectedObject = this._core.getObjectFromPointerEvent(event, '.object');
|
|
21112
|
-
if (selectedObject && !(selectedObject instanceof
|
|
21113
|
-
const selectionGroup =
|
|
21120
|
+
if (selectedObject && !(selectedObject instanceof schema_constants.KritzelSelectionGroup) && !(selectedObject instanceof schema_constants.KritzelSelectionBox)) {
|
|
21121
|
+
const selectionGroup = schema_constants.KritzelSelectionGroup.create(this._core);
|
|
21114
21122
|
selectionGroup.addOrRemove(selectedObject);
|
|
21115
21123
|
selectionGroup.isSelected = true;
|
|
21116
21124
|
selectionGroup.rotation = selectedObject.rotation;
|
|
@@ -21150,7 +21158,7 @@ class KritzelContextMenuHandler extends workspace_migrations.KritzelBaseHandler
|
|
|
21150
21158
|
* Extends KritzelBaseObject to inherit common object functionality like positioning,
|
|
21151
21159
|
* scaling, and lifecycle management.
|
|
21152
21160
|
*/
|
|
21153
|
-
class KritzelCustomElement extends
|
|
21161
|
+
class KritzelCustomElement extends schema_constants.KritzelBaseObject {
|
|
21154
21162
|
__class__ = 'KritzelCustomElement';
|
|
21155
21163
|
/** The HTML element to be rendered on the canvas. */
|
|
21156
21164
|
element;
|
|
@@ -21295,16 +21303,16 @@ class KritzelReviver {
|
|
|
21295
21303
|
let revivedObj;
|
|
21296
21304
|
switch (obj.__class__) {
|
|
21297
21305
|
case 'KritzelPath':
|
|
21298
|
-
revivedObj =
|
|
21306
|
+
revivedObj = schema_constants.KritzelPath.create(this._core).deserialize(obj);
|
|
21299
21307
|
break;
|
|
21300
21308
|
case 'KritzelLine':
|
|
21301
|
-
revivedObj =
|
|
21309
|
+
revivedObj = schema_constants.KritzelLine.create(this._core).deserialize(obj);
|
|
21302
21310
|
break;
|
|
21303
21311
|
case 'KritzelText':
|
|
21304
|
-
revivedObj =
|
|
21312
|
+
revivedObj = schema_constants.KritzelText.create(this._core, obj.fontSize, obj.fontFamily).deserialize(obj);
|
|
21305
21313
|
break;
|
|
21306
21314
|
case 'KritzelShape':
|
|
21307
|
-
revivedObj =
|
|
21315
|
+
revivedObj = schema_constants.KritzelShape.create(this._core, {
|
|
21308
21316
|
shapeType: obj.shapeType,
|
|
21309
21317
|
fillColor: obj.fillColor,
|
|
21310
21318
|
strokeColor: obj.strokeColor,
|
|
@@ -21315,40 +21323,40 @@ class KritzelReviver {
|
|
|
21315
21323
|
}).deserialize(obj);
|
|
21316
21324
|
break;
|
|
21317
21325
|
case 'KritzelImage':
|
|
21318
|
-
revivedObj =
|
|
21326
|
+
revivedObj = schema_constants.KritzelImage.create(this._core).deserialize(obj);
|
|
21319
21327
|
break;
|
|
21320
21328
|
case 'KritzelCustomElement':
|
|
21321
21329
|
revivedObj = KritzelCustomElement.create(this._core).deserialize(obj);
|
|
21322
21330
|
break;
|
|
21323
21331
|
case 'KritzelSelectionGroup':
|
|
21324
|
-
revivedObj =
|
|
21332
|
+
revivedObj = schema_constants.KritzelSelectionGroup.create(this._core).deserialize(obj);
|
|
21325
21333
|
break;
|
|
21326
21334
|
case 'KritzelGroup':
|
|
21327
|
-
revivedObj =
|
|
21335
|
+
revivedObj = schema_constants.KritzelGroup.create(this._core).deserialize(obj);
|
|
21328
21336
|
break;
|
|
21329
21337
|
case 'KritzelWorkspace':
|
|
21330
|
-
revivedObj =
|
|
21338
|
+
revivedObj = schema_constants.KritzelWorkspace.create(this._core, obj).deserialize(obj);
|
|
21331
21339
|
break;
|
|
21332
21340
|
case 'KritzelBrushTool':
|
|
21333
|
-
revivedObj = new
|
|
21341
|
+
revivedObj = new schema_constants.KritzelBrushTool(this._core);
|
|
21334
21342
|
break;
|
|
21335
21343
|
case 'KritzelEraserTool':
|
|
21336
|
-
revivedObj = new
|
|
21344
|
+
revivedObj = new schema_constants.KritzelEraserTool(this._core);
|
|
21337
21345
|
break;
|
|
21338
21346
|
case 'KritzelImageTool':
|
|
21339
|
-
revivedObj = new
|
|
21347
|
+
revivedObj = new schema_constants.KritzelImageTool(this._core);
|
|
21340
21348
|
break;
|
|
21341
21349
|
case 'KritzelSelectionTool':
|
|
21342
|
-
revivedObj = new
|
|
21350
|
+
revivedObj = new schema_constants.KritzelSelectionTool(this._core);
|
|
21343
21351
|
break;
|
|
21344
21352
|
case 'KritzelTextTool':
|
|
21345
|
-
revivedObj = new
|
|
21353
|
+
revivedObj = new schema_constants.KritzelTextTool(this._core);
|
|
21346
21354
|
break;
|
|
21347
21355
|
case 'KritzelLineTool':
|
|
21348
|
-
revivedObj = new
|
|
21356
|
+
revivedObj = new schema_constants.KritzelLineTool(this._core);
|
|
21349
21357
|
break;
|
|
21350
21358
|
case 'KritzelShapeTool':
|
|
21351
|
-
revivedObj = new
|
|
21359
|
+
revivedObj = new schema_constants.KritzelShapeTool(this._core);
|
|
21352
21360
|
break;
|
|
21353
21361
|
default:
|
|
21354
21362
|
revivedObj = obj;
|
|
@@ -21476,32 +21484,32 @@ class AlignmentHelper {
|
|
|
21476
21484
|
const offsetX = objBounds.x - obj.translateX;
|
|
21477
21485
|
const offsetY = objBounds.y - obj.translateY;
|
|
21478
21486
|
switch (alignment) {
|
|
21479
|
-
case
|
|
21487
|
+
case schema_constants.KritzelAlignment.StartHorizontal:
|
|
21480
21488
|
// Align left edges to selection's left edge
|
|
21481
21489
|
newTranslateX = selectionBounds.minX - offsetX;
|
|
21482
21490
|
break;
|
|
21483
|
-
case
|
|
21491
|
+
case schema_constants.KritzelAlignment.CenterHorizontal:
|
|
21484
21492
|
// Align centers horizontally
|
|
21485
21493
|
const selectionCenterX = (selectionBounds.minX + selectionBounds.maxX) / 2;
|
|
21486
21494
|
const objCenterX = objBounds.x + objBounds.width / 2;
|
|
21487
21495
|
newTranslateX = obj.translateX + (selectionCenterX - objCenterX);
|
|
21488
21496
|
break;
|
|
21489
|
-
case
|
|
21497
|
+
case schema_constants.KritzelAlignment.EndHorizontal:
|
|
21490
21498
|
// Align right edges to selection's right edge
|
|
21491
21499
|
const objRightEdge = objBounds.x + objBounds.width;
|
|
21492
21500
|
newTranslateX = obj.translateX + (selectionBounds.maxX - objRightEdge);
|
|
21493
21501
|
break;
|
|
21494
|
-
case
|
|
21502
|
+
case schema_constants.KritzelAlignment.StartVertical:
|
|
21495
21503
|
// Align top edges to selection's top edge
|
|
21496
21504
|
newTranslateY = selectionBounds.minY - offsetY;
|
|
21497
21505
|
break;
|
|
21498
|
-
case
|
|
21506
|
+
case schema_constants.KritzelAlignment.CenterVertical:
|
|
21499
21507
|
// Align centers vertically
|
|
21500
21508
|
const selectionCenterY = (selectionBounds.minY + selectionBounds.maxY) / 2;
|
|
21501
21509
|
const objCenterY = objBounds.y + objBounds.height / 2;
|
|
21502
21510
|
newTranslateY = obj.translateY + (selectionCenterY - objCenterY);
|
|
21503
21511
|
break;
|
|
21504
|
-
case
|
|
21512
|
+
case schema_constants.KritzelAlignment.EndVertical:
|
|
21505
21513
|
// Align bottom edges to selection's bottom edge
|
|
21506
21514
|
const objBottomEdge = objBounds.y + objBounds.height;
|
|
21507
21515
|
newTranslateY = obj.translateY + (selectionBounds.maxY - objBottomEdge);
|
|
@@ -21981,7 +21989,7 @@ class KritzelObjectMap {
|
|
|
21981
21989
|
}
|
|
21982
21990
|
});
|
|
21983
21991
|
const localUserId = this._core?.user?.id;
|
|
21984
|
-
const orphanedGroups = this.quadtree.filter(o => o instanceof
|
|
21992
|
+
const orphanedGroups = this.quadtree.filter(o => o instanceof schema_constants.KritzelSelectionGroup
|
|
21985
21993
|
&& o.userId != null
|
|
21986
21994
|
&& o.userId !== localUserId
|
|
21987
21995
|
&& !activeUserIds.has(o.userId));
|
|
@@ -22204,7 +22212,7 @@ class KritzelObjectMap {
|
|
|
22204
22212
|
this.initializeMetadata('workspace', workspaceId, workspaceName);
|
|
22205
22213
|
// Run any pending schema migrations before loading data
|
|
22206
22214
|
const quietMigrations = !core.store?.state?.debugInfo?.showMigrationInfo;
|
|
22207
|
-
|
|
22215
|
+
schema_constants.runMigrations(this._ydoc, this._metadataMap, { objects: this._objectsMap }, schema_constants.WORKSPACE_MIGRATIONS, schema_constants.CURRENT_WORKSPACE_SCHEMA_VERSION, { quiet: quietMigrations });
|
|
22208
22216
|
// Load objects from Yjs
|
|
22209
22217
|
this.loadFromYjs();
|
|
22210
22218
|
}
|
|
@@ -22240,7 +22248,7 @@ class KritzelObjectMap {
|
|
|
22240
22248
|
if (serialized) {
|
|
22241
22249
|
const object = this._reviver?.revive(serialized);
|
|
22242
22250
|
// Separate SelectionGroups to process them after regular objects
|
|
22243
|
-
if (object instanceof
|
|
22251
|
+
if (object instanceof schema_constants.KritzelSelectionGroup) {
|
|
22244
22252
|
selectionGroupsToUpdate.push(object);
|
|
22245
22253
|
}
|
|
22246
22254
|
else {
|
|
@@ -22311,7 +22319,7 @@ class KritzelObjectMap {
|
|
|
22311
22319
|
...objectsToDelete
|
|
22312
22320
|
]);
|
|
22313
22321
|
// Find any existing SelectionGroups that contain changed objects
|
|
22314
|
-
const existingSelectionGroups = this.quadtree.filter(o => o instanceof
|
|
22322
|
+
const existingSelectionGroups = this.quadtree.filter(o => o instanceof schema_constants.KritzelSelectionGroup && !updatedSelectionGroupIds.has(o.id));
|
|
22315
22323
|
for (const selectionGroup of existingSelectionGroups) {
|
|
22316
22324
|
const hasChangedChildren = selectionGroup.objectIds.some(id => changedObjectIds.has(id));
|
|
22317
22325
|
if (hasChangedChildren) {
|
|
@@ -22360,7 +22368,7 @@ class KritzelObjectMap {
|
|
|
22360
22368
|
this._metadataMap?.set('isPublic', false);
|
|
22361
22369
|
}
|
|
22362
22370
|
if (this._metadataMap?.get('schemaVersion') === undefined) {
|
|
22363
|
-
this._metadataMap?.set('schemaVersion',
|
|
22371
|
+
this._metadataMap?.set('schemaVersion', schema_constants.CURRENT_WORKSPACE_SCHEMA_VERSION);
|
|
22364
22372
|
}
|
|
22365
22373
|
this._metadataMap?.set('workspaceId', workspaceId);
|
|
22366
22374
|
this._metadataMap?.set('workspaceName', workspaceName);
|
|
@@ -22490,7 +22498,7 @@ class KritzelObjectMap {
|
|
|
22490
22498
|
const object = this._reviver?.revive(serialized);
|
|
22491
22499
|
// Remove remote selection groups on startup — they are transient UI state
|
|
22492
22500
|
// that should not survive an app restart. The owning user's session is gone.
|
|
22493
|
-
if (object instanceof
|
|
22501
|
+
if (object instanceof schema_constants.KritzelSelectionGroup && object.userId != null && object.userId !== localUserId) {
|
|
22494
22502
|
staleSelectionGroupIds.push(key);
|
|
22495
22503
|
return;
|
|
22496
22504
|
}
|
|
@@ -22638,7 +22646,7 @@ class KritzelObjectMap {
|
|
|
22638
22646
|
* @returns `true` if the object should be persisted, `false` otherwise
|
|
22639
22647
|
*/
|
|
22640
22648
|
isPersistable(object) {
|
|
22641
|
-
if (object instanceof
|
|
22649
|
+
if (object instanceof schema_constants.KritzelSelectionBox) {
|
|
22642
22650
|
return false;
|
|
22643
22651
|
}
|
|
22644
22652
|
return true;
|
|
@@ -22877,7 +22885,7 @@ class KritzelStore {
|
|
|
22877
22885
|
* @returns The next z-index value to use for new objects
|
|
22878
22886
|
*/
|
|
22879
22887
|
get currentZIndex() {
|
|
22880
|
-
return Math.max(0, ...this.objects.filter(o => !(o instanceof
|
|
22888
|
+
return Math.max(0, ...this.objects.filter(o => !(o instanceof schema_constants.KritzelSelectionGroup) && !(o instanceof schema_constants.KritzelSelectionBox)).map(o => o.zIndex)) + 1;
|
|
22881
22889
|
}
|
|
22882
22890
|
/**
|
|
22883
22891
|
* Returns true if viewport boundaries are set to finite values (not Infinity).
|
|
@@ -22948,14 +22956,14 @@ class KritzelStore {
|
|
|
22948
22956
|
* @returns Array of all regular canvas objects
|
|
22949
22957
|
*/
|
|
22950
22958
|
get allNonSelectionObjects() {
|
|
22951
|
-
return this.allObjects.filter(o => !(o instanceof
|
|
22959
|
+
return this.allObjects.filter(o => !(o instanceof schema_constants.KritzelSelectionGroup) && !(o instanceof schema_constants.KritzelSelectionBox));
|
|
22952
22960
|
}
|
|
22953
22961
|
/**
|
|
22954
22962
|
* Gets all currently selected objects (excluding the selection group itself).
|
|
22955
22963
|
* @returns Array of selected objects
|
|
22956
22964
|
*/
|
|
22957
22965
|
get selectedObjects() {
|
|
22958
|
-
return this.allObjects.filter(o => !(o instanceof
|
|
22966
|
+
return this.allObjects.filter(o => !(o instanceof schema_constants.KritzelSelectionGroup)).filter(o => o.isSelected);
|
|
22959
22967
|
}
|
|
22960
22968
|
/**
|
|
22961
22969
|
* Gets the current selection box if one exists.
|
|
@@ -22966,7 +22974,7 @@ class KritzelStore {
|
|
|
22966
22974
|
if (this._selectionBoxCacheValid) {
|
|
22967
22975
|
return this._cachedSelectionBox;
|
|
22968
22976
|
}
|
|
22969
|
-
const selectionBoxes = this.objects.filter(o => o instanceof
|
|
22977
|
+
const selectionBoxes = this.objects.filter(o => o instanceof schema_constants.KritzelSelectionBox);
|
|
22970
22978
|
this._cachedSelectionBox = selectionBoxes.length > 0 ? selectionBoxes[0] : null;
|
|
22971
22979
|
this._selectionBoxCacheValid = true;
|
|
22972
22980
|
return this._cachedSelectionBox;
|
|
@@ -22981,7 +22989,7 @@ class KritzelStore {
|
|
|
22981
22989
|
if (this._selectionGroupCacheValid) {
|
|
22982
22990
|
return this._cachedSelectionGroup;
|
|
22983
22991
|
}
|
|
22984
|
-
const selectionGroups = this.objects.filter(o => o instanceof
|
|
22992
|
+
const selectionGroups = this.objects.filter(o => o instanceof schema_constants.KritzelSelectionGroup);
|
|
22985
22993
|
if (this._localUserId) {
|
|
22986
22994
|
this._cachedSelectionGroup = selectionGroups.find(sg => sg.userId === this._localUserId) ?? null;
|
|
22987
22995
|
}
|
|
@@ -23030,7 +23038,7 @@ class KritzelStore {
|
|
|
23030
23038
|
* @returns The text object in editing mode, or null if none
|
|
23031
23039
|
*/
|
|
23032
23040
|
get activeText() {
|
|
23033
|
-
const activeTexts = this.objects.filter(o => o instanceof
|
|
23041
|
+
const activeTexts = this.objects.filter(o => o instanceof schema_constants.KritzelText && o.isEditing);
|
|
23034
23042
|
return activeTexts.length > 0 ? activeTexts[0] : null;
|
|
23035
23043
|
}
|
|
23036
23044
|
/**
|
|
@@ -23038,7 +23046,7 @@ class KritzelStore {
|
|
|
23038
23046
|
* @returns The shape object in editing mode, or null if none
|
|
23039
23047
|
*/
|
|
23040
23048
|
get activeShape() {
|
|
23041
|
-
const activeShapes = this.objects.filter(o => o instanceof
|
|
23049
|
+
const activeShapes = this.objects.filter(o => o instanceof schema_constants.KritzelShape && o.isEditing);
|
|
23042
23050
|
return activeShapes.length > 0 ? activeShapes[0] : null;
|
|
23043
23051
|
}
|
|
23044
23052
|
/**
|
|
@@ -23046,7 +23054,7 @@ class KritzelStore {
|
|
|
23046
23054
|
* @returns The incomplete path object, or null if no path is being drawn
|
|
23047
23055
|
*/
|
|
23048
23056
|
get currentPath() {
|
|
23049
|
-
const drawingPaths = this.objects.filter(o => o instanceof
|
|
23057
|
+
const drawingPaths = this.objects.filter(o => o instanceof schema_constants.KritzelPath && o.isCompleted === false);
|
|
23050
23058
|
return drawingPaths.length > 0 ? drawingPaths[0] : null;
|
|
23051
23059
|
}
|
|
23052
23060
|
/**
|
|
@@ -23054,7 +23062,7 @@ class KritzelStore {
|
|
|
23054
23062
|
* @returns The incomplete line object, or null if no line is being drawn
|
|
23055
23063
|
*/
|
|
23056
23064
|
get currentLine() {
|
|
23057
|
-
const drawingLines = this.objects.filter(o => o instanceof
|
|
23065
|
+
const drawingLines = this.objects.filter(o => o instanceof schema_constants.KritzelLine && o.isCompleted === false);
|
|
23058
23066
|
return drawingLines.length > 0 ? drawingLines[0] : null;
|
|
23059
23067
|
}
|
|
23060
23068
|
/**
|
|
@@ -23250,7 +23258,7 @@ class KritzelAppStateMap {
|
|
|
23250
23258
|
this._isReady = true;
|
|
23251
23259
|
// Run any pending schema migrations before loading data
|
|
23252
23260
|
const quietMigrations = !core.store.state.debugInfo.showMigrationInfo;
|
|
23253
|
-
|
|
23261
|
+
schema_constants.runMigrations(this._ydoc, this._metadataMap, { workspaces: this._workspacesMap }, schema_constants.APP_STATE_MIGRATIONS, schema_constants.CURRENT_APP_STATE_SCHEMA_VERSION, { quiet: quietMigrations });
|
|
23254
23262
|
// Initialize document metadata (only if not already set by a previous client)
|
|
23255
23263
|
this.initializeMetadata('state');
|
|
23256
23264
|
// Load workspaces from Yjs
|
|
@@ -23279,7 +23287,7 @@ class KritzelAppStateMap {
|
|
|
23279
23287
|
if (instanceId) {
|
|
23280
23288
|
return instanceId;
|
|
23281
23289
|
}
|
|
23282
|
-
const generatedInstanceId =
|
|
23290
|
+
const generatedInstanceId = schema_constants.ObjectHelper.generateUUID();
|
|
23283
23291
|
try {
|
|
23284
23292
|
storage.setItem(storageKey, generatedInstanceId);
|
|
23285
23293
|
}
|
|
@@ -23356,7 +23364,7 @@ class KritzelAppStateMap {
|
|
|
23356
23364
|
scale,
|
|
23357
23365
|
};
|
|
23358
23366
|
}
|
|
23359
|
-
const workspace = new
|
|
23367
|
+
const workspace = new schema_constants.KritzelWorkspace(serialized.id, serialized.name, viewport);
|
|
23360
23368
|
if (this._core) {
|
|
23361
23369
|
workspace._core = this._core;
|
|
23362
23370
|
}
|
|
@@ -23381,7 +23389,7 @@ class KritzelAppStateMap {
|
|
|
23381
23389
|
this._metadataMap?.set('isPublic', false);
|
|
23382
23390
|
}
|
|
23383
23391
|
if (this._metadataMap?.get('schemaVersion') === undefined) {
|
|
23384
|
-
this._metadataMap?.set('schemaVersion',
|
|
23392
|
+
this._metadataMap?.set('schemaVersion', schema_constants.CURRENT_APP_STATE_SCHEMA_VERSION);
|
|
23385
23393
|
}
|
|
23386
23394
|
}, 'metadata');
|
|
23387
23395
|
}
|
|
@@ -23604,7 +23612,7 @@ class KritzelCursorManager {
|
|
|
23604
23612
|
this._targetElement = element;
|
|
23605
23613
|
// Set the pointer cursor CSS variable for child components to use
|
|
23606
23614
|
if (this._targetElement) {
|
|
23607
|
-
this._targetElement.style.setProperty('--kritzel-global-pointer-cursor',
|
|
23615
|
+
this._targetElement.style.setProperty('--kritzel-global-pointer-cursor', schema_constants.KritzelCursorHelper.getPointerCursor());
|
|
23608
23616
|
}
|
|
23609
23617
|
}
|
|
23610
23618
|
/**
|
|
@@ -23690,7 +23698,7 @@ class KritzelCursorManager {
|
|
|
23690
23698
|
const icon = state.cursor?.icon;
|
|
23691
23699
|
const iconActive = state.cursor?.iconActive ?? icon;
|
|
23692
23700
|
const rotation = state.cursor?.rotation;
|
|
23693
|
-
const cursor =
|
|
23701
|
+
const cursor = schema_constants.KritzelCursorHelper.getCursor({
|
|
23694
23702
|
iconName: isPointerDown ? iconActive : icon,
|
|
23695
23703
|
rotation: rotation,
|
|
23696
23704
|
});
|
|
@@ -23834,11 +23842,11 @@ class KritzelCore {
|
|
|
23834
23842
|
this._editorId = editorId;
|
|
23835
23843
|
this._store = new KritzelStore(DEFAULT_ENGINE_CONFIG);
|
|
23836
23844
|
this._appStateMap = new KritzelAppStateMap();
|
|
23837
|
-
this._anchorManager = new
|
|
23845
|
+
this._anchorManager = new schema_constants.KritzelAnchorManager(this);
|
|
23838
23846
|
this._cursorManager = new KritzelCursorManager(this);
|
|
23839
|
-
this._themeManager = new
|
|
23847
|
+
this._themeManager = new schema_constants.KritzelThemeManager(this);
|
|
23840
23848
|
this._toolRegistry = new KritzelToolRegistry(this);
|
|
23841
|
-
this._assetResolver = new
|
|
23849
|
+
this._assetResolver = new schema_constants.KritzelAssetResolver();
|
|
23842
23850
|
}
|
|
23843
23851
|
/**
|
|
23844
23852
|
* Gets the asset resolver responsible for storing and resolving
|
|
@@ -23871,7 +23879,7 @@ class KritzelCore {
|
|
|
23871
23879
|
setEditorId(editorId) {
|
|
23872
23880
|
this._editorId = editorId;
|
|
23873
23881
|
// Re-create theme manager so it picks up the new storage key
|
|
23874
|
-
this._themeManager = new
|
|
23882
|
+
this._themeManager = new schema_constants.KritzelThemeManager(this);
|
|
23875
23883
|
}
|
|
23876
23884
|
/**
|
|
23877
23885
|
* Initializes the Yjs document for collaborative editing.
|
|
@@ -23982,7 +23990,7 @@ class KritzelCore {
|
|
|
23982
23990
|
}
|
|
23983
23991
|
else {
|
|
23984
23992
|
// Create fallback workspace
|
|
23985
|
-
activeWorkspace = new
|
|
23993
|
+
activeWorkspace = new schema_constants.KritzelWorkspace(schema_constants.ObjectHelper.generateUUID(), 'New Workspace');
|
|
23986
23994
|
activeWorkspace._core = this;
|
|
23987
23995
|
this.saveWorkspaceToAppState(activeWorkspace);
|
|
23988
23996
|
}
|
|
@@ -24035,7 +24043,7 @@ class KritzelCore {
|
|
|
24035
24043
|
let workspace = this.getWorkspaces().find(w => w.id === workspaceId);
|
|
24036
24044
|
if (!workspace) {
|
|
24037
24045
|
// Create it if it doesn't exist locally
|
|
24038
|
-
workspace = new
|
|
24046
|
+
workspace = new schema_constants.KritzelWorkspace(workspaceId, name);
|
|
24039
24047
|
workspace.isPublic = true;
|
|
24040
24048
|
this.createWorkspace(workspace);
|
|
24041
24049
|
}
|
|
@@ -24065,7 +24073,7 @@ class KritzelCore {
|
|
|
24065
24073
|
}
|
|
24066
24074
|
return this._store.objects
|
|
24067
24075
|
.query(viewportBounds)
|
|
24068
|
-
.filter(obj => !(obj instanceof
|
|
24076
|
+
.filter(obj => !(obj instanceof schema_constants.KritzelSelectionGroup) && !(obj instanceof schema_constants.KritzelSelectionBox))
|
|
24069
24077
|
.sort((a, b) => a.zIndex - b.zIndex);
|
|
24070
24078
|
}
|
|
24071
24079
|
/**
|
|
@@ -24201,7 +24209,7 @@ class KritzelCore {
|
|
|
24201
24209
|
*/
|
|
24202
24210
|
removeObject(object, preserveChildren = false) {
|
|
24203
24211
|
// Handle KritzelGroup: recursively delete all children first (unless preserveChildren is true)
|
|
24204
|
-
if (
|
|
24212
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelGroup') && !preserveChildren) {
|
|
24205
24213
|
// Get children before removing the group
|
|
24206
24214
|
const children = [...object.children];
|
|
24207
24215
|
children.forEach(child => {
|
|
@@ -24209,7 +24217,7 @@ class KritzelCore {
|
|
|
24209
24217
|
});
|
|
24210
24218
|
}
|
|
24211
24219
|
// Handle anchor cleanup
|
|
24212
|
-
if (
|
|
24220
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelLine')) {
|
|
24213
24221
|
// If removing a line, clean up its anchor index entries
|
|
24214
24222
|
this._anchorManager.handleLineDeleted(object.id);
|
|
24215
24223
|
}
|
|
@@ -24411,7 +24419,7 @@ class KritzelCore {
|
|
|
24411
24419
|
this.removeSelectionGroup();
|
|
24412
24420
|
this.removeSelectionBox();
|
|
24413
24421
|
// Create a new selection group for the pasted objects
|
|
24414
|
-
const selectionGroup =
|
|
24422
|
+
const selectionGroup = schema_constants.KritzelSelectionGroup.create(this);
|
|
24415
24423
|
// Build a reverse mapping: originalId -> newCopiedObjectId
|
|
24416
24424
|
// This is used to remap anchor references from original IDs to the copied object IDs
|
|
24417
24425
|
const originalToNewIdMap = new Map();
|
|
@@ -24443,7 +24451,7 @@ class KritzelCore {
|
|
|
24443
24451
|
child.updatePosition(child.translateX + offsetX, child.translateY + offsetY);
|
|
24444
24452
|
child.zIndex = parentZIndex + childIndex + 1;
|
|
24445
24453
|
// Recurse before adding so grandchildren are inserted as well
|
|
24446
|
-
if (
|
|
24454
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(child, 'KritzelGroup')) {
|
|
24447
24455
|
flushPendingChildren(child, child.zIndex);
|
|
24448
24456
|
}
|
|
24449
24457
|
this.addObject(child);
|
|
@@ -24461,7 +24469,7 @@ class KritzelCore {
|
|
|
24461
24469
|
// Update z-index
|
|
24462
24470
|
obj.zIndex = baseZIndex + i;
|
|
24463
24471
|
// Handle KritzelGroup: also add pending children (and grandchildren) with offset
|
|
24464
|
-
if (
|
|
24472
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(obj, 'KritzelGroup')) {
|
|
24465
24473
|
flushPendingChildren(obj, obj.zIndex);
|
|
24466
24474
|
}
|
|
24467
24475
|
// Add to objectsMap
|
|
@@ -24472,7 +24480,7 @@ class KritzelCore {
|
|
|
24472
24480
|
// Update line anchors to point to the newly pasted objects
|
|
24473
24481
|
// Only remap if the anchor target was also part of the copied selection
|
|
24474
24482
|
copiedObjects.forEach(obj => {
|
|
24475
|
-
if (
|
|
24483
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(obj, 'KritzelLine')) {
|
|
24476
24484
|
let updated = false;
|
|
24477
24485
|
if (obj.startAnchor && originalToNewIdMap.has(obj.startAnchor.objectId)) {
|
|
24478
24486
|
obj.startAnchor = { objectId: originalToNewIdMap.get(obj.startAnchor.objectId) };
|
|
@@ -24635,12 +24643,12 @@ class KritzelCore {
|
|
|
24635
24643
|
return;
|
|
24636
24644
|
}
|
|
24637
24645
|
// Create a group from the selected objects
|
|
24638
|
-
const group =
|
|
24646
|
+
const group = schema_constants.KritzelGroup.createFromObjects(this, selectionGroup.objects);
|
|
24639
24647
|
// Add the group to the object store
|
|
24640
24648
|
this.addObject(group);
|
|
24641
24649
|
// Remove the selection group and create a new one with just the group
|
|
24642
24650
|
this.removeSelectionGroup();
|
|
24643
|
-
const newSelectionGroup =
|
|
24651
|
+
const newSelectionGroup = schema_constants.KritzelSelectionGroup.create(this);
|
|
24644
24652
|
newSelectionGroup.addOrRemove(group);
|
|
24645
24653
|
newSelectionGroup.isSelected = true;
|
|
24646
24654
|
newSelectionGroup.rotation = group.rotation;
|
|
@@ -24657,13 +24665,13 @@ class KritzelCore {
|
|
|
24657
24665
|
if (!selectionGroup) {
|
|
24658
24666
|
return;
|
|
24659
24667
|
}
|
|
24660
|
-
const groups = selectionGroup.objects.filter(obj =>
|
|
24668
|
+
const groups = selectionGroup.objects.filter(obj => schema_constants.KritzelClassHelper.isInstanceOf(obj, 'KritzelGroup'));
|
|
24661
24669
|
if (groups.length === 0) {
|
|
24662
24670
|
return;
|
|
24663
24671
|
}
|
|
24664
24672
|
// Collect all children from all groups
|
|
24665
24673
|
const allChildren = [];
|
|
24666
|
-
const nonGroupObjects = selectionGroup.objects.filter(obj => !
|
|
24674
|
+
const nonGroupObjects = selectionGroup.objects.filter(obj => !schema_constants.KritzelClassHelper.isInstanceOf(obj, 'KritzelGroup'));
|
|
24667
24675
|
groups.forEach(group => {
|
|
24668
24676
|
// Get children before removing the group
|
|
24669
24677
|
const children = group.ungroup();
|
|
@@ -24673,7 +24681,7 @@ class KritzelCore {
|
|
|
24673
24681
|
});
|
|
24674
24682
|
// Create a new selection group with all the ungrouped children and non-group objects
|
|
24675
24683
|
this.removeSelectionGroup();
|
|
24676
|
-
const newSelectionGroup =
|
|
24684
|
+
const newSelectionGroup = schema_constants.KritzelSelectionGroup.create(this);
|
|
24677
24685
|
[...allChildren, ...nonGroupObjects].forEach(child => {
|
|
24678
24686
|
newSelectionGroup.addOrRemove(child);
|
|
24679
24687
|
});
|
|
@@ -24691,7 +24699,7 @@ class KritzelCore {
|
|
|
24691
24699
|
if (objects.length === 0) {
|
|
24692
24700
|
return;
|
|
24693
24701
|
}
|
|
24694
|
-
const selectionGroup =
|
|
24702
|
+
const selectionGroup = schema_constants.KritzelSelectionGroup.create(this);
|
|
24695
24703
|
objects.forEach(obj => {
|
|
24696
24704
|
obj.isSelected = false;
|
|
24697
24705
|
selectionGroup.addOrRemove(obj);
|
|
@@ -24711,9 +24719,9 @@ class KritzelCore {
|
|
|
24711
24719
|
selectAllObjects() {
|
|
24712
24720
|
const allObjects = this._store.objects
|
|
24713
24721
|
.allObjects()
|
|
24714
|
-
.filter(o => !(o instanceof
|
|
24722
|
+
.filter(o => !(o instanceof schema_constants.KritzelSelectionGroup) && !(o instanceof schema_constants.KritzelSelectionBox) && !(o instanceof KritzelContextMenu));
|
|
24715
24723
|
if (allObjects.length > 0) {
|
|
24716
|
-
const selectionGroup =
|
|
24724
|
+
const selectionGroup = schema_constants.KritzelSelectionGroup.create(this);
|
|
24717
24725
|
allObjects.forEach(obj => {
|
|
24718
24726
|
obj.isSelected = false;
|
|
24719
24727
|
selectionGroup.addOrRemove(obj);
|
|
@@ -24745,9 +24753,9 @@ class KritzelCore {
|
|
|
24745
24753
|
const objectsInViewport = this._store.objects
|
|
24746
24754
|
.query(viewportBounds)
|
|
24747
24755
|
.filter(o => o.isInViewport())
|
|
24748
|
-
.filter(o => !(o instanceof
|
|
24756
|
+
.filter(o => !(o instanceof schema_constants.KritzelSelectionGroup) && !(o instanceof schema_constants.KritzelSelectionBox) && !(o instanceof KritzelContextMenu));
|
|
24749
24757
|
if (objectsInViewport.length > 0) {
|
|
24750
|
-
const selectionGroup =
|
|
24758
|
+
const selectionGroup = schema_constants.KritzelSelectionGroup.create(this);
|
|
24751
24759
|
objectsInViewport.forEach(obj => {
|
|
24752
24760
|
obj.isSelected = false;
|
|
24753
24761
|
selectionGroup.addOrRemove(obj);
|
|
@@ -24769,8 +24777,8 @@ class KritzelCore {
|
|
|
24769
24777
|
clearSelection() {
|
|
24770
24778
|
this.removeSelectionGroup();
|
|
24771
24779
|
const localUserId = this._user?.id;
|
|
24772
|
-
this._store.objects.remove(o => o instanceof
|
|
24773
|
-
(o instanceof
|
|
24780
|
+
this._store.objects.remove(o => o instanceof schema_constants.KritzelSelectionBox ||
|
|
24781
|
+
(o instanceof schema_constants.KritzelSelectionGroup && (localUserId == null || o.userId === localUserId || o.userId == null)));
|
|
24774
24782
|
this._store.setSelectionBox(null);
|
|
24775
24783
|
this._store.setSelectionGroup(null);
|
|
24776
24784
|
this._store.state.isSelecting = false;
|
|
@@ -24927,13 +24935,13 @@ class KritzelCore {
|
|
|
24927
24935
|
return false;
|
|
24928
24936
|
}
|
|
24929
24937
|
// Remote selection groups always show group UI (border only, no handles)
|
|
24930
|
-
if (object instanceof
|
|
24938
|
+
if (object instanceof schema_constants.KritzelSelectionGroup && this._user?.id != null && object.userId != null && object.userId !== this._user.id) {
|
|
24931
24939
|
return true;
|
|
24932
24940
|
}
|
|
24933
24941
|
const selectionGroup = this._store.selectionGroup;
|
|
24934
24942
|
if (!selectionGroup) {
|
|
24935
24943
|
// During selection phase (no group yet), hide UI for KritzelLine objects
|
|
24936
|
-
return !(object instanceof
|
|
24944
|
+
return !(object instanceof schema_constants.KritzelLine);
|
|
24937
24945
|
}
|
|
24938
24946
|
// Show UI if selection contains more than one object
|
|
24939
24947
|
if (selectionGroup.objects.length > 1) {
|
|
@@ -24942,7 +24950,7 @@ class KritzelCore {
|
|
|
24942
24950
|
// Hide UI if selection contains a single KritzelLine
|
|
24943
24951
|
if (selectionGroup.objects.length === 1) {
|
|
24944
24952
|
const selectedObject = selectionGroup.objects[0];
|
|
24945
|
-
return !(selectedObject instanceof
|
|
24953
|
+
return !(selectedObject instanceof schema_constants.KritzelLine);
|
|
24946
24954
|
}
|
|
24947
24955
|
return true;
|
|
24948
24956
|
}
|
|
@@ -24954,7 +24962,7 @@ class KritzelCore {
|
|
|
24954
24962
|
*/
|
|
24955
24963
|
displaySelectionLineUI(object) {
|
|
24956
24964
|
// Only show line UI on KritzelLine objects, not on selection groups
|
|
24957
|
-
if (!(object instanceof
|
|
24965
|
+
if (!(object instanceof schema_constants.KritzelLine)) {
|
|
24958
24966
|
return false;
|
|
24959
24967
|
}
|
|
24960
24968
|
// During selection phase (no group yet), show line UI if line is selected
|
|
@@ -24968,7 +24976,7 @@ class KritzelCore {
|
|
|
24968
24976
|
// Show UI only if selection contains exactly one KritzelLine and it's this object
|
|
24969
24977
|
if (selectionGroup.objects.length === 1) {
|
|
24970
24978
|
const selectedObject = selectionGroup.objects[0];
|
|
24971
|
-
return selectedObject instanceof
|
|
24979
|
+
return selectedObject instanceof schema_constants.KritzelLine && selectedObject.id === object.id;
|
|
24972
24980
|
}
|
|
24973
24981
|
return false;
|
|
24974
24982
|
}
|
|
@@ -25052,7 +25060,7 @@ class KritzelSvgExportHelper {
|
|
|
25052
25060
|
static flattenObjects(objects) {
|
|
25053
25061
|
const result = [];
|
|
25054
25062
|
for (const obj of objects) {
|
|
25055
|
-
if (
|
|
25063
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(obj, 'KritzelGroup')) {
|
|
25056
25064
|
result.push(...this.flattenObjects(obj.children));
|
|
25057
25065
|
}
|
|
25058
25066
|
else {
|
|
@@ -25070,7 +25078,7 @@ class KritzelSvgExportHelper {
|
|
|
25070
25078
|
static collectDefs(objects, theme) {
|
|
25071
25079
|
const defs = [];
|
|
25072
25080
|
for (const obj of objects) {
|
|
25073
|
-
if (
|
|
25081
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(obj, 'KritzelLine')) {
|
|
25074
25082
|
if (obj.hasStartArrow) {
|
|
25075
25083
|
defs.push(this.generateArrowMarker(obj, 'start', theme));
|
|
25076
25084
|
}
|
|
@@ -25108,22 +25116,22 @@ class KritzelSvgExportHelper {
|
|
|
25108
25116
|
* @returns SVG element string, or empty string if object type is not supported
|
|
25109
25117
|
*/
|
|
25110
25118
|
static objectToSvgElement(object, theme) {
|
|
25111
|
-
if (
|
|
25119
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelPath')) {
|
|
25112
25120
|
return this.pathToSvg(object, theme);
|
|
25113
25121
|
}
|
|
25114
|
-
if (
|
|
25122
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelLine')) {
|
|
25115
25123
|
return this.lineToSvg(object, theme);
|
|
25116
25124
|
}
|
|
25117
|
-
if (
|
|
25125
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelShape')) {
|
|
25118
25126
|
return this.shapeToSvg(object, theme);
|
|
25119
25127
|
}
|
|
25120
|
-
if (
|
|
25128
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelText')) {
|
|
25121
25129
|
return this.textToSvg(object, theme);
|
|
25122
25130
|
}
|
|
25123
|
-
if (
|
|
25131
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelImage')) {
|
|
25124
25132
|
return this.imageToSvg(object);
|
|
25125
25133
|
}
|
|
25126
|
-
if (
|
|
25134
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelGroup')) {
|
|
25127
25135
|
return this.groupToSvg(object, theme);
|
|
25128
25136
|
}
|
|
25129
25137
|
return '';
|
|
@@ -25136,8 +25144,8 @@ class KritzelSvgExportHelper {
|
|
|
25136
25144
|
*/
|
|
25137
25145
|
static pathToSvg(path, theme) {
|
|
25138
25146
|
const transform = this.buildTransform(path);
|
|
25139
|
-
const fill =
|
|
25140
|
-
const stroke =
|
|
25147
|
+
const fill = schema_constants.KritzelColorHelper.resolveThemeColor(path.fill, theme);
|
|
25148
|
+
const stroke = schema_constants.KritzelColorHelper.resolveThemeColor(path.stroke, theme);
|
|
25141
25149
|
const opacity = path.opacity !== 1 ? ` opacity="${path.opacity}"` : '';
|
|
25142
25150
|
// Path needs to be wrapped in a g with translation since path.d uses local coordinates
|
|
25143
25151
|
return `<g transform="${transform}"${opacity}>
|
|
@@ -25154,7 +25162,7 @@ class KritzelSvgExportHelper {
|
|
|
25154
25162
|
*/
|
|
25155
25163
|
static lineToSvg(line, theme) {
|
|
25156
25164
|
const transform = this.buildTransform(line);
|
|
25157
|
-
const stroke =
|
|
25165
|
+
const stroke = schema_constants.KritzelColorHelper.resolveThemeColor(line.stroke, theme);
|
|
25158
25166
|
const opacity = line.opacity !== 1 ? ` opacity="${line.opacity}"` : '';
|
|
25159
25167
|
const markerStart = line.hasStartArrow ? ` marker-start="url(#${line.startMarkerId})"` : '';
|
|
25160
25168
|
const markerEnd = line.hasEndArrow ? ` marker-end="url(#${line.endMarkerId})"` : '';
|
|
@@ -25172,8 +25180,8 @@ class KritzelSvgExportHelper {
|
|
|
25172
25180
|
*/
|
|
25173
25181
|
static shapeToSvg(shape, theme) {
|
|
25174
25182
|
const transform = this.buildTransform(shape);
|
|
25175
|
-
const fill =
|
|
25176
|
-
const stroke =
|
|
25183
|
+
const fill = schema_constants.KritzelColorHelper.resolveThemeColor(shape.fillColor, theme);
|
|
25184
|
+
const stroke = schema_constants.KritzelColorHelper.resolveThemeColor(shape.strokeColor, theme);
|
|
25177
25185
|
const opacity = shape.opacity !== 1 ? ` opacity="${shape.opacity}"` : '';
|
|
25178
25186
|
// Get the SVG path for the shape
|
|
25179
25187
|
const pathD = shape.getSvgPath();
|
|
@@ -25183,7 +25191,7 @@ class KritzelSvgExportHelper {
|
|
|
25183
25191
|
else if (shape.content) {
|
|
25184
25192
|
const textHtml = this.prosemirrorToHtml(shape.content, shape, theme);
|
|
25185
25193
|
if (textHtml) {
|
|
25186
|
-
const fontColor =
|
|
25194
|
+
const fontColor = schema_constants.KritzelColorHelper.resolveThemeColor(shape.fontColor, theme);
|
|
25187
25195
|
textContent = `
|
|
25188
25196
|
<foreignObject x="${shape.x}" y="${shape.y}" width="${shape.width}" height="${shape.height}">
|
|
25189
25197
|
<div xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; font-family: ${shape.fontFamily}; font-size: ${shape.fontSize}px; color: ${fontColor}; overflow: hidden;">
|
|
@@ -25207,8 +25215,8 @@ class KritzelSvgExportHelper {
|
|
|
25207
25215
|
static textToSvg(text, theme) {
|
|
25208
25216
|
const transform = this.buildTransform(text);
|
|
25209
25217
|
const opacity = text.opacity !== 1 ? ` opacity="${text.opacity}"` : '';
|
|
25210
|
-
const fontColor =
|
|
25211
|
-
const bgColor =
|
|
25218
|
+
const fontColor = schema_constants.KritzelColorHelper.resolveThemeColor(text.fontColor, theme);
|
|
25219
|
+
const bgColor = schema_constants.KritzelColorHelper.resolveThemeColor(text.backgroundColor, theme);
|
|
25212
25220
|
// Convert ProseMirror content to HTML
|
|
25213
25221
|
const htmlContent = this.prosemirrorToHtml(text.content, text, theme);
|
|
25214
25222
|
// Calculate dimensions accounting for scale
|
|
@@ -26460,8 +26468,8 @@ const KritzelEngine = class {
|
|
|
26460
26468
|
if (this.core.store.isDisabled) {
|
|
26461
26469
|
return;
|
|
26462
26470
|
}
|
|
26463
|
-
if (
|
|
26464
|
-
|
|
26471
|
+
if (schema_constants.KritzelDevicesHelper.isTouchDevice()) {
|
|
26472
|
+
schema_constants.KritzelEventHelper.onLongPress(ev, (event) => this.longpress.emit(event));
|
|
26465
26473
|
}
|
|
26466
26474
|
this.host.setPointerCapture(ev.pointerId);
|
|
26467
26475
|
this.core.store.state.pointers.set(ev.pointerId, ev);
|
|
@@ -26611,17 +26619,13 @@ const KritzelEngine = class {
|
|
|
26611
26619
|
if (this.core.toolRegistry.hasTool(toolName)) {
|
|
26612
26620
|
const existingTool = this.core.toolRegistry.getTool(toolName);
|
|
26613
26621
|
if (toolConfig) {
|
|
26614
|
-
|
|
26615
|
-
existingTool[key] = value;
|
|
26616
|
-
});
|
|
26622
|
+
this.applyToolConfig(existingTool, toolConfig);
|
|
26617
26623
|
}
|
|
26618
26624
|
return existingTool;
|
|
26619
26625
|
}
|
|
26620
26626
|
const registeredTool = this.core.toolRegistry.registerTool(toolName, toolClass);
|
|
26621
26627
|
if (toolConfig) {
|
|
26622
|
-
|
|
26623
|
-
registeredTool[key] = value;
|
|
26624
|
-
});
|
|
26628
|
+
this.applyToolConfig(registeredTool, toolConfig);
|
|
26625
26629
|
}
|
|
26626
26630
|
return Promise.resolve(registeredTool);
|
|
26627
26631
|
}
|
|
@@ -26638,6 +26642,18 @@ const KritzelEngine = class {
|
|
|
26638
26642
|
this.core.deselectAllObjects();
|
|
26639
26643
|
tool?.onActivate();
|
|
26640
26644
|
}
|
|
26645
|
+
/**
|
|
26646
|
+
* Switches the active drawing tool by its registered name.
|
|
26647
|
+
* @param toolName - The name the tool was registered with (e.g., 'brush', 'eraser').
|
|
26648
|
+
*/
|
|
26649
|
+
async changeActiveToolByName(toolName) {
|
|
26650
|
+
const tool = this.core.toolRegistry.getTool(toolName);
|
|
26651
|
+
if (!tool) {
|
|
26652
|
+
console.warn(`[KritzelEngine] No tool registered with name: ${toolName}`);
|
|
26653
|
+
return;
|
|
26654
|
+
}
|
|
26655
|
+
await this.changeActiveTool(tool);
|
|
26656
|
+
}
|
|
26641
26657
|
/** Disables all user interaction with the engine (pointer, keyboard, etc.). */
|
|
26642
26658
|
async disable() {
|
|
26643
26659
|
this.core.store.state.isEnabled = false;
|
|
@@ -26723,7 +26739,7 @@ const KritzelEngine = class {
|
|
|
26723
26739
|
async hideContextMenu() {
|
|
26724
26740
|
this.core.store.state.pointers.clear();
|
|
26725
26741
|
this.core.store.state.isContextMenuVisible = false;
|
|
26726
|
-
this.core.store.objects?.remove(o => o instanceof
|
|
26742
|
+
this.core.store.objects?.remove(o => o instanceof schema_constants.KritzelSelectionBox);
|
|
26727
26743
|
this.core.store.setSelectionBox(null);
|
|
26728
26744
|
this.core.store.objects?.clearLocalSelectionBox();
|
|
26729
26745
|
this.core.store.state.isSelecting = false;
|
|
@@ -26782,7 +26798,7 @@ const KritzelEngine = class {
|
|
|
26782
26798
|
object.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
26783
26799
|
// Handle KritzelText: recreate the editor now that _core is available
|
|
26784
26800
|
// The editor's dispatchTransaction callback needs _core for persisting changes
|
|
26785
|
-
if (
|
|
26801
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelText')) {
|
|
26786
26802
|
const pendingContent = object.content;
|
|
26787
26803
|
object.editor = object.createEditor();
|
|
26788
26804
|
if (pendingContent) {
|
|
@@ -26790,7 +26806,7 @@ const KritzelEngine = class {
|
|
|
26790
26806
|
}
|
|
26791
26807
|
}
|
|
26792
26808
|
// Handle KritzelGroup: flush pending children (recursively for nested groups) into the store
|
|
26793
|
-
if (
|
|
26809
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelGroup') && object._pendingChildren.length > 0) {
|
|
26794
26810
|
// Build a map of old ID → new ID across all nesting levels so we can
|
|
26795
26811
|
// remap anchor references regardless of how deeply nested the line is.
|
|
26796
26812
|
const idRemapping = new Map();
|
|
@@ -26814,7 +26830,7 @@ const KritzelEngine = class {
|
|
|
26814
26830
|
allFlushedChildren.push(child);
|
|
26815
26831
|
// Recurse into nested groups before inserting so grandchildren get
|
|
26816
26832
|
// proper IDs and `childIds` references before the parent is added.
|
|
26817
|
-
if (
|
|
26833
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(child, 'KritzelGroup')) {
|
|
26818
26834
|
flushGroup(child);
|
|
26819
26835
|
}
|
|
26820
26836
|
});
|
|
@@ -26822,7 +26838,7 @@ const KritzelEngine = class {
|
|
|
26822
26838
|
flushGroup(object);
|
|
26823
26839
|
// Remap anchor references in lines across all flushed descendants
|
|
26824
26840
|
allFlushedChildren.forEach(child => {
|
|
26825
|
-
if (
|
|
26841
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(child, 'KritzelLine')) {
|
|
26826
26842
|
if (child.startAnchor && idRemapping.has(child.startAnchor.objectId)) {
|
|
26827
26843
|
child.startAnchor = { objectId: idRemapping.get(child.startAnchor.objectId) };
|
|
26828
26844
|
}
|
|
@@ -27238,11 +27254,11 @@ const KritzelEngine = class {
|
|
|
27238
27254
|
if (!data.__class__ || data.__class__ !== 'KritzelWorkspace') {
|
|
27239
27255
|
throw new Error('Invalid workspace data: missing or incorrect __class__ identifier');
|
|
27240
27256
|
}
|
|
27241
|
-
if (data.version && data.version !==
|
|
27242
|
-
console.warn(`Workspace version mismatch: expected ${
|
|
27257
|
+
if (data.version && data.version !== schema_constants.WORKSPACE_EXPORT_VERSION) {
|
|
27258
|
+
console.warn(`Workspace version mismatch: expected ${schema_constants.WORKSPACE_EXPORT_VERSION}, got ${data.version}`);
|
|
27243
27259
|
}
|
|
27244
27260
|
// Create a new workspace with a fresh ID but use the imported name
|
|
27245
|
-
const newWorkspaceId =
|
|
27261
|
+
const newWorkspaceId = schema_constants.ObjectHelper.generateUUID();
|
|
27246
27262
|
const importedName = data.name || 'Imported Workspace';
|
|
27247
27263
|
let importedViewport = data.viewport || { centerWorldX: 0, centerWorldY: 0, scale: 1 };
|
|
27248
27264
|
// Backward compatibility: convert legacy translateX/translateY to centerWorldX/centerWorldY
|
|
@@ -27254,7 +27270,7 @@ const KritzelEngine = class {
|
|
|
27254
27270
|
scale,
|
|
27255
27271
|
};
|
|
27256
27272
|
}
|
|
27257
|
-
const newWorkspace = new
|
|
27273
|
+
const newWorkspace = new schema_constants.KritzelWorkspace(newWorkspaceId, importedName, importedViewport);
|
|
27258
27274
|
// Save the new workspace
|
|
27259
27275
|
this.core.createWorkspace(newWorkspace);
|
|
27260
27276
|
this.workspacesChange.emit(this.core.store.state.workspaces);
|
|
@@ -27292,8 +27308,8 @@ const KritzelEngine = class {
|
|
|
27292
27308
|
if (!data.__class__ || data.__class__ !== 'KritzelWorkspace') {
|
|
27293
27309
|
throw new Error('Invalid workspace data: missing or incorrect __class__ identifier');
|
|
27294
27310
|
}
|
|
27295
|
-
if (data.version && data.version !==
|
|
27296
|
-
console.warn(`Workspace version mismatch: expected ${
|
|
27311
|
+
if (data.version && data.version !== schema_constants.WORKSPACE_EXPORT_VERSION) {
|
|
27312
|
+
console.warn(`Workspace version mismatch: expected ${schema_constants.WORKSPACE_EXPORT_VERSION}, got ${data.version}`);
|
|
27297
27313
|
}
|
|
27298
27314
|
const activeWorkspace = this.core.store.state.activeWorkspace;
|
|
27299
27315
|
if (!activeWorkspace) {
|
|
@@ -27458,7 +27474,7 @@ const KritzelEngine = class {
|
|
|
27458
27474
|
const workspaceId = token;
|
|
27459
27475
|
let workspace = this.core.getWorkspaces().find(w => w.id === workspaceId);
|
|
27460
27476
|
if (!workspace) {
|
|
27461
|
-
workspace = new
|
|
27477
|
+
workspace = new schema_constants.KritzelWorkspace(workspaceId, 'Shared Workspace');
|
|
27462
27478
|
workspace.isPublic = true;
|
|
27463
27479
|
this.core.createWorkspace(workspace);
|
|
27464
27480
|
}
|
|
@@ -27538,11 +27554,32 @@ const KritzelEngine = class {
|
|
|
27538
27554
|
syncLoadingState() {
|
|
27539
27555
|
this.core.store.state.isLoading = this._isWorkspaceLoading || this.isLoading;
|
|
27540
27556
|
}
|
|
27557
|
+
applyToolConfig(tool, toolConfig) {
|
|
27558
|
+
Object.entries(toolConfig).forEach(([key, value]) => {
|
|
27559
|
+
tool[key] = value;
|
|
27560
|
+
});
|
|
27561
|
+
// Resolve palettes map into the flat palette array the UI reads
|
|
27562
|
+
if ('palettes' in toolConfig && 'type' in toolConfig) {
|
|
27563
|
+
const brushConfig = toolConfig;
|
|
27564
|
+
const resolvedPalette = brushConfig.palettes[brushConfig.type];
|
|
27565
|
+
if (resolvedPalette) {
|
|
27566
|
+
tool['palette'] = resolvedPalette;
|
|
27567
|
+
}
|
|
27568
|
+
}
|
|
27569
|
+
// Resolve sizes map into the flat sizes array the UI reads (brush tool uses a map keyed by type)
|
|
27570
|
+
if ('sizes' in toolConfig && toolConfig.sizes != null && 'type' in toolConfig) {
|
|
27571
|
+
const brushConfig = toolConfig;
|
|
27572
|
+
const resolvedSizes = brushConfig.sizes?.[brushConfig.type];
|
|
27573
|
+
if (resolvedSizes) {
|
|
27574
|
+
tool['sizes'] = resolvedSizes;
|
|
27575
|
+
}
|
|
27576
|
+
}
|
|
27577
|
+
}
|
|
27541
27578
|
get isSelecting() {
|
|
27542
|
-
return this.core.store.state.activeTool instanceof
|
|
27579
|
+
return this.core.store.state.activeTool instanceof schema_constants.KritzelSelectionTool && this.core.store.state.isSelecting;
|
|
27543
27580
|
}
|
|
27544
27581
|
get isSelectionActive() {
|
|
27545
|
-
return this.core.store.state.activeTool instanceof
|
|
27582
|
+
return this.core.store.state.activeTool instanceof schema_constants.KritzelSelectionTool && this.core.store.selectionGroup !== null;
|
|
27546
27583
|
}
|
|
27547
27584
|
constructor(hostRef) {
|
|
27548
27585
|
index.registerInstance(this, hostRef);
|
|
@@ -27809,19 +27846,19 @@ const KritzelEngine = class {
|
|
|
27809
27846
|
this.core.store.onStateChange('activeTool', this._handleActiveToolChange.bind(this));
|
|
27810
27847
|
}
|
|
27811
27848
|
_handleActiveToolChange(activeTool) {
|
|
27812
|
-
if (!(activeTool instanceof
|
|
27849
|
+
if (!(activeTool instanceof schema_constants.KritzelSelectionTool)) {
|
|
27813
27850
|
this.core.clearSelection();
|
|
27814
|
-
this.core.store.objects?.remove(o => o instanceof
|
|
27851
|
+
this.core.store.objects?.remove(o => o instanceof schema_constants.KritzelSelectionBox);
|
|
27815
27852
|
this.core.store.setSelectionBox(null);
|
|
27816
27853
|
this.core.store.objects?.clearLocalSelectionBox();
|
|
27817
27854
|
this.core.store.state.isSelecting = false;
|
|
27818
27855
|
this.core.store.state.isResizeHandleSelected = false;
|
|
27819
27856
|
this.core.store.state.isRotationHandleSelected = false;
|
|
27820
27857
|
}
|
|
27821
|
-
if (!(activeTool instanceof
|
|
27858
|
+
if (!(activeTool instanceof schema_constants.KritzelTextTool)) {
|
|
27822
27859
|
this.core.resetActiveText();
|
|
27823
27860
|
}
|
|
27824
|
-
if (!(activeTool instanceof
|
|
27861
|
+
if (!(activeTool instanceof schema_constants.KritzelShapeTool)) {
|
|
27825
27862
|
this.core.resetActiveShape();
|
|
27826
27863
|
}
|
|
27827
27864
|
this.core.store.state.skipContextMenu = false;
|
|
@@ -27829,7 +27866,7 @@ const KritzelEngine = class {
|
|
|
27829
27866
|
if (activeTool) {
|
|
27830
27867
|
this.activeToolChange.emit(activeTool);
|
|
27831
27868
|
}
|
|
27832
|
-
|
|
27869
|
+
schema_constants.KritzelKeyboardHelper.forceHideKeyboard();
|
|
27833
27870
|
this.core.rerender();
|
|
27834
27871
|
}
|
|
27835
27872
|
render() {
|
|
@@ -27860,7 +27897,7 @@ const KritzelEngine = class {
|
|
|
27860
27897
|
position: 'absolute',
|
|
27861
27898
|
zIndex: object.zIndex.toString(),
|
|
27862
27899
|
pointerEvents: this.core.store.state.isScaling ? 'none' : 'auto',
|
|
27863
|
-
} },
|
|
27900
|
+
} }, schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (() => {
|
|
27864
27901
|
const effectiveOpacity = (object.markedForRemoval ? 0.5 : 1) * object.opacity;
|
|
27865
27902
|
return (index.h("svg", { ref: el => el && object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
27866
27903
|
height: object?.totalHeight + 'px',
|
|
@@ -27872,8 +27909,8 @@ const KritzelEngine = class {
|
|
|
27872
27909
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
27873
27910
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
27874
27911
|
overflow: 'visible',
|
|
27875
|
-
}, viewBox: object?.viewBox }, index.h("path", { d: object?.d, fill:
|
|
27876
|
-
})(),
|
|
27912
|
+
}, viewBox: object?.viewBox }, index.h("path", { d: object?.d, fill: schema_constants.KritzelColorHelper.applyOpacity(object.fill, effectiveOpacity, currentTheme), stroke: schema_constants.KritzelColorHelper.applyOpacity(object?.stroke, effectiveOpacity, currentTheme), "shape-rendering": object.isLowRes() ? 'optimizeSpeed' : 'auto' })));
|
|
27913
|
+
})(), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelLine') && (() => {
|
|
27877
27914
|
const effectiveOpacity = (object.markedForRemoval ? 0.5 : 1) * object.opacity;
|
|
27878
27915
|
return (index.h("svg", { ref: el => el && object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
27879
27916
|
height: object?.totalHeight + 'px',
|
|
@@ -27885,8 +27922,8 @@ const KritzelEngine = class {
|
|
|
27885
27922
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
27886
27923
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
27887
27924
|
overflow: 'visible',
|
|
27888
|
-
}, viewBox: object?.viewBox }, (object.hasStartArrow || object.hasEndArrow) && (index.h("defs", null, object.hasStartArrow && (index.h("marker", { id: object.startMarkerId, markerWidth: object.getArrowSize('start'), markerHeight: object.getArrowSize('start'), refX: 0, refY: object.getArrowSize('start') / 2, orient: "auto-start-reverse", markerUnits: "userSpaceOnUse" }, index.h("path", { d: object.getArrowPath(object.arrows?.start?.style), fill:
|
|
27889
|
-
})(),
|
|
27925
|
+
}, viewBox: object?.viewBox }, (object.hasStartArrow || object.hasEndArrow) && (index.h("defs", null, object.hasStartArrow && (index.h("marker", { id: object.startMarkerId, markerWidth: object.getArrowSize('start'), markerHeight: object.getArrowSize('start'), refX: 0, refY: object.getArrowSize('start') / 2, orient: "auto-start-reverse", markerUnits: "userSpaceOnUse" }, index.h("path", { d: object.getArrowPath(object.arrows?.start?.style), fill: schema_constants.KritzelColorHelper.applyOpacity(object.getArrowFill('start'), effectiveOpacity), transform: `scale(${object.getArrowSize('start') / 10})` }))), object.hasEndArrow && (index.h("marker", { id: object.endMarkerId, markerWidth: object.getArrowSize('end'), markerHeight: object.getArrowSize('end'), refX: 0, refY: object.getArrowSize('end') / 2, orient: "auto", markerUnits: "userSpaceOnUse" }, index.h("path", { d: object.getArrowPath(object.arrows?.end?.style), fill: schema_constants.KritzelColorHelper.applyOpacity(object.getArrowFill('end'), effectiveOpacity), transform: `scale(${object.getArrowSize('end') / 10})` }))))), index.h("path", { d: this.core.anchorManager.computeClippedLinePath(object), fill: "none", stroke: "transparent", "stroke-width": Math.max(object?.strokeWidth || 0, 10), "stroke-linecap": "round" }), index.h("path", { d: this.core.anchorManager.computeClippedLinePath(object), fill: "none", stroke: schema_constants.KritzelColorHelper.applyOpacity(object?.stroke, effectiveOpacity, currentTheme), "stroke-width": object?.strokeWidth, "stroke-linecap": "round", "marker-start": object.hasStartArrow ? `url(#${object.startMarkerId})` : undefined, "marker-end": object.hasEndArrow ? `url(#${object.endMarkerId})` : undefined })));
|
|
27926
|
+
})(), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && object.loadState === 'ready' && (index.h("img", { ref: el => el && object.mount(el), src: object.resolvedSrc || object.src, style: {
|
|
27890
27927
|
position: 'absolute',
|
|
27891
27928
|
left: '0',
|
|
27892
27929
|
top: '0',
|
|
@@ -27896,15 +27933,15 @@ const KritzelEngine = class {
|
|
|
27896
27933
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
27897
27934
|
opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
|
|
27898
27935
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
27899
|
-
backgroundColor:
|
|
27900
|
-
borderColor:
|
|
27936
|
+
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
27937
|
+
borderColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme),
|
|
27901
27938
|
borderWidth: object.borderWidth + 'px',
|
|
27902
27939
|
borderStyle: 'solid',
|
|
27903
27940
|
padding: object.padding + 'px',
|
|
27904
27941
|
overflow: 'visible',
|
|
27905
27942
|
userSelect: 'none',
|
|
27906
27943
|
imageRendering: this.core.store.state.isScaling || this.core.store.state.isPanning ? 'pixelated' : 'auto',
|
|
27907
|
-
}, draggable: false, decoding: "async", loading: "eager", onDragStart: e => e.preventDefault() })),
|
|
27944
|
+
}, draggable: false, decoding: "async", loading: "eager", onDragStart: e => e.preventDefault() })), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && object.loadState !== 'ready' && (index.h("div", { ref: () => object.ensureLoaded(), style: {
|
|
27908
27945
|
position: 'absolute',
|
|
27909
27946
|
left: '0',
|
|
27910
27947
|
top: '0',
|
|
@@ -27914,10 +27951,10 @@ const KritzelEngine = class {
|
|
|
27914
27951
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
27915
27952
|
opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
|
|
27916
27953
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
27917
|
-
backgroundColor:
|
|
27954
|
+
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor({ light: '#e5e7eb', dark: '#2a2a2a' }, currentTheme),
|
|
27918
27955
|
borderColor: object.loadState === 'error'
|
|
27919
|
-
?
|
|
27920
|
-
:
|
|
27956
|
+
? schema_constants.KritzelColorHelper.resolveThemeColor({ light: '#9ca3af', dark: '#6b7280' }, currentTheme)
|
|
27957
|
+
: schema_constants.KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme),
|
|
27921
27958
|
borderWidth: object.loadState === 'error' ? '1px' : object.borderWidth + 'px',
|
|
27922
27959
|
borderStyle: 'solid',
|
|
27923
27960
|
padding: object.padding + 'px',
|
|
@@ -27927,8 +27964,8 @@ const KritzelEngine = class {
|
|
|
27927
27964
|
alignItems: 'center',
|
|
27928
27965
|
justifyContent: 'center',
|
|
27929
27966
|
} }, index.h("kritzel-icon", { name: object.loadState === 'error' ? 'image-off' : 'image', size: Math.max(16, Math.min(object.totalWidth, object.totalHeight) * 0.3), style: {
|
|
27930
|
-
color:
|
|
27931
|
-
} }))),
|
|
27967
|
+
color: schema_constants.KritzelColorHelper.resolveThemeColor({ light: '#9ca3af', dark: '#6b7280' }, currentTheme),
|
|
27968
|
+
} }))), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelCustomElement') && (index.h("div", { ref: el => el && object.mount(el), style: {
|
|
27932
27969
|
position: 'absolute',
|
|
27933
27970
|
left: '0',
|
|
27934
27971
|
top: '0',
|
|
@@ -27938,14 +27975,14 @@ const KritzelEngine = class {
|
|
|
27938
27975
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
27939
27976
|
opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
|
|
27940
27977
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
27941
|
-
backgroundColor:
|
|
27942
|
-
borderColor:
|
|
27978
|
+
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
27979
|
+
borderColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme),
|
|
27943
27980
|
borderWidth: object.borderWidth + 'px',
|
|
27944
27981
|
borderStyle: 'solid',
|
|
27945
27982
|
padding: object.padding + 'px',
|
|
27946
27983
|
overflow: 'hidden',
|
|
27947
27984
|
display: 'block',
|
|
27948
|
-
} })),
|
|
27985
|
+
} })), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') && !this.core.displaySelectionLineUI(object) && (index.h("div", { ref: el => el && object.mount(el), style: {
|
|
27949
27986
|
position: 'absolute',
|
|
27950
27987
|
left: '0',
|
|
27951
27988
|
top: '0',
|
|
@@ -27955,7 +27992,7 @@ const KritzelEngine = class {
|
|
|
27955
27992
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
27956
27993
|
opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
|
|
27957
27994
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
27958
|
-
} })),
|
|
27995
|
+
} })), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionBox') && (index.h("div", { ref: el => el && object.mount(el), style: {
|
|
27959
27996
|
position: 'absolute',
|
|
27960
27997
|
left: '0',
|
|
27961
27998
|
top: '0',
|
|
@@ -27965,11 +28002,11 @@ const KritzelEngine = class {
|
|
|
27965
28002
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
27966
28003
|
opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
|
|
27967
28004
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
27968
|
-
backgroundColor:
|
|
27969
|
-
borderColor:
|
|
28005
|
+
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
28006
|
+
borderColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme),
|
|
27970
28007
|
borderWidth: object.borderWidth + 'px',
|
|
27971
28008
|
borderStyle: 'solid',
|
|
27972
|
-
} })),
|
|
28009
|
+
} })), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelText') && (index.h("div", { style: {
|
|
27973
28010
|
position: 'absolute',
|
|
27974
28011
|
left: '0',
|
|
27975
28012
|
top: '0',
|
|
@@ -27987,12 +28024,12 @@ const KritzelEngine = class {
|
|
|
27987
28024
|
width: 'max-content',
|
|
27988
28025
|
transformOrigin: 'top left',
|
|
27989
28026
|
transform: `scale(${object.scaleFactor})`,
|
|
27990
|
-
backgroundColor:
|
|
28027
|
+
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
27991
28028
|
overflow: 'visible',
|
|
27992
|
-
} }))),
|
|
28029
|
+
} }))), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelShape') && (() => {
|
|
27993
28030
|
const effectiveOpacity = (object.markedForRemoval ? 0.5 : 1) * object.opacity;
|
|
27994
|
-
const fillResolved =
|
|
27995
|
-
const strokeResolved =
|
|
28031
|
+
const fillResolved = schema_constants.KritzelColorHelper.resolveThemeColor(object.fillColor, currentTheme);
|
|
28032
|
+
const strokeResolved = schema_constants.KritzelColorHelper.resolveThemeColor(object.strokeColor, currentTheme);
|
|
27996
28033
|
const isFilled = !!fillResolved && fillResolved !== 'transparent';
|
|
27997
28034
|
const strokeMatchesFill = isFilled && strokeResolved === fillResolved;
|
|
27998
28035
|
return (index.h("div", { ref: el => el && object.mount(el), onPointerDown: e => object.handlePointerDown(e), onPointerMove: e => object.handlePointerMove(e), onPointerUp: e => object.handlePointerUp(e), style: {
|
|
@@ -28013,7 +28050,7 @@ const KritzelEngine = class {
|
|
|
28013
28050
|
height: '100%',
|
|
28014
28051
|
overflow: 'visible',
|
|
28015
28052
|
pointerEvents: 'none',
|
|
28016
|
-
}, viewBox: object.viewBox, preserveAspectRatio: "none" }, index.h("path", { d: object.getSvgPath(), fill:
|
|
28053
|
+
}, viewBox: object.viewBox, preserveAspectRatio: "none" }, index.h("path", { d: object.getSvgPath(), fill: schema_constants.KritzelColorHelper.applyOpacity(object.fillColor, effectiveOpacity, currentTheme), stroke: strokeMatchesFill ? 'none' : schema_constants.KritzelColorHelper.applyOpacity(object.strokeColor, effectiveOpacity, currentTheme), "stroke-width": strokeMatchesFill ? 0 : object.strokeWidth })), index.h("div", { ref: el => el && object.mountTextEditor(el), style: {
|
|
28017
28054
|
position: 'absolute',
|
|
28018
28055
|
top: '0',
|
|
28019
28056
|
left: '0',
|
|
@@ -28032,9 +28069,9 @@ const KritzelEngine = class {
|
|
|
28032
28069
|
left: `${object.totalWidth}px`,
|
|
28033
28070
|
top: '0',
|
|
28034
28071
|
zIndex: (object.zIndex + 2).toString(),
|
|
28035
|
-
} }, index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "Id: ", object.id), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "userId: ", object.userId), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "width: ", object.width), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "height: ", object.height), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "translateX: ", object.translateX), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "translateY: ", object.translateY), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "rotationDegrees: ", object.rotationDegrees), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "zIndex: ", object.zIndex),
|
|
28072
|
+
} }, index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "Id: ", object.id), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "userId: ", object.userId), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "width: ", object.width), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "height: ", object.height), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "translateX: ", object.translateX), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "translateY: ", object.translateY), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "rotationDegrees: ", object.rotationDegrees), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "zIndex: ", object.zIndex), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (index.h("div", null, index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "assetId: ", object.assetId), index.h("div", { style: { whiteSpace: 'nowrap', fontSize: '10px' } }, "mimeType: ", object.mimeType))))), (this.core.displaySelectionGroupUI(object) || this.core.displaySelectionLineUI(object)) &&
|
|
28036
28073
|
(() => {
|
|
28037
|
-
const isSelectionGroup =
|
|
28074
|
+
const isSelectionGroup = schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup');
|
|
28038
28075
|
const localClientId = this.core.store.objects?.localClientId;
|
|
28039
28076
|
const awarenessStates = this.core.store.objects?.awareness?.getStates();
|
|
28040
28077
|
const isRemoteSelection = isSelectionGroup && (
|
|
@@ -28063,7 +28100,7 @@ const KritzelEngine = class {
|
|
|
28063
28100
|
}
|
|
28064
28101
|
}
|
|
28065
28102
|
const selectionBorderColor = remoteUserColor
|
|
28066
|
-
?? (
|
|
28103
|
+
?? (schema_constants.KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme) || 'var(--kritzel-selection-border-color, #007AFF)');
|
|
28067
28104
|
const selectionHandleStrokeColor = remoteUserColor
|
|
28068
28105
|
?? 'var(--kritzel-selection-handle-stroke-color, #007AFF)';
|
|
28069
28106
|
return (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", style: {
|
|
@@ -28079,9 +28116,9 @@ const KritzelEngine = class {
|
|
|
28079
28116
|
pointerEvents: 'none',
|
|
28080
28117
|
} }, this.core.displaySelectionGroupUI(object) && (index.h("g", { class: "selection-group-ui", style: { pointerEvents: 'none' } }, (() => {
|
|
28081
28118
|
const remoteLineObject = isRemoteSelection &&
|
|
28082
|
-
|
|
28119
|
+
schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') &&
|
|
28083
28120
|
object.objects.length === 1 &&
|
|
28084
|
-
|
|
28121
|
+
schema_constants.KritzelClassHelper.isInstanceOf(object.objects[0], 'KritzelLine')
|
|
28085
28122
|
? object.objects[0]
|
|
28086
28123
|
: null;
|
|
28087
28124
|
if (remoteLineObject) {
|
|
@@ -28152,7 +28189,7 @@ const KritzelEngine = class {
|
|
|
28152
28189
|
} }), index.h("circle", { class: "rotation-handle-overlay", cx: object.totalWidth / 2, cy: -((15 * object.scale) / this.core.store.state?.scale), r: `${(baseHandleTouchSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
28153
28190
|
fill: 'transparent',
|
|
28154
28191
|
paintOrder: 'fill',
|
|
28155
|
-
} }))))), this.core.displaySelectionLineUI(object) &&
|
|
28192
|
+
} }))))), this.core.displaySelectionLineUI(object) && schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelLine') && (index.h("g", { class: "selection-line-ui", style: { pointerEvents: 'none' } }, index.h("g", { class: "selection-line-borders" }, index.h("path", { class: "selection-line-border", d: this.core.anchorManager.computeClippedLinePath(object, true), style: {
|
|
28156
28193
|
stroke: selectionBorderColor,
|
|
28157
28194
|
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${this.core.store.state?.scale})`,
|
|
28158
28195
|
strokeLinecap: 'round',
|
|
@@ -28277,7 +28314,7 @@ const KritzelEngine = class {
|
|
|
28277
28314
|
}, this.core.store.selectionGroup?.objects || []);
|
|
28278
28315
|
}
|
|
28279
28316
|
this.hideContextMenu();
|
|
28280
|
-
}, onClose: () => this.hideContextMenu() })), this.core.store.objects?.hasAwareness && index.h("kritzel-awareness-cursors", { core: this.core }), this.core.store.state?.activeTool instanceof
|
|
28317
|
+
}, onClose: () => this.hideContextMenu() })), this.core.store.objects?.hasAwareness && index.h("kritzel-awareness-cursors", { core: this.core }), this.core.store.state?.activeTool instanceof schema_constants.KritzelEraserTool && !this.core.store.state.isScaling && index.h("kritzel-cursor-trail", { core: this.core })));
|
|
28281
28318
|
}
|
|
28282
28319
|
static get watchers() { return {
|
|
28283
28320
|
"workspace": [{
|
|
@@ -28514,7 +28551,7 @@ const KritzelIcon = class {
|
|
|
28514
28551
|
label;
|
|
28515
28552
|
size = 24;
|
|
28516
28553
|
render() {
|
|
28517
|
-
const svgContent =
|
|
28554
|
+
const svgContent = schema_constants.KritzelIconRegistry.get(this.name);
|
|
28518
28555
|
if (!svgContent) {
|
|
28519
28556
|
console.error(`[kritzel-icon] Icon "${this.name}" not found in registry.`);
|
|
28520
28557
|
return index.h("span", { class: "error-icon", "aria-label": `Error: Icon ${this.name} not found` }, "?");
|
|
@@ -28926,7 +28963,7 @@ const KritzelMenuItem = class {
|
|
|
28926
28963
|
requestAnimationFrame(() => {
|
|
28927
28964
|
if (this.inputRef) {
|
|
28928
28965
|
this.inputRef.focus();
|
|
28929
|
-
if (
|
|
28966
|
+
if (schema_constants.KritzelDevicesHelper.isIOS()) {
|
|
28930
28967
|
const length = this.inputRef.value.length;
|
|
28931
28968
|
this.inputRef.setSelectionRange(length, length);
|
|
28932
28969
|
}
|
|
@@ -28945,7 +28982,7 @@ const KritzelMenuItem = class {
|
|
|
28945
28982
|
this.focusInput();
|
|
28946
28983
|
}
|
|
28947
28984
|
setDeviceSpecificStyles = () => {
|
|
28948
|
-
const isTouchDevice =
|
|
28985
|
+
const isTouchDevice = schema_constants.KritzelDevicesHelper.isTouchDevice();
|
|
28949
28986
|
if (isTouchDevice) {
|
|
28950
28987
|
this.host.style.setProperty('--kritzel-menu-item-overlay-background-color', 'transparent');
|
|
28951
28988
|
this.host.style.setProperty('--kritzel-menu-item-button-hover-background-color', 'transparent');
|
|
@@ -29045,7 +29082,7 @@ const KritzelMoreMenu = class {
|
|
|
29045
29082
|
*/
|
|
29046
29083
|
itemSelect;
|
|
29047
29084
|
menuAnchor = null;
|
|
29048
|
-
isTouchDevice =
|
|
29085
|
+
isTouchDevice = schema_constants.KritzelDevicesHelper.isTouchDevice();
|
|
29049
29086
|
toggleMenu = (event) => {
|
|
29050
29087
|
event.stopPropagation();
|
|
29051
29088
|
if (this.menuAnchor) {
|
|
@@ -29375,7 +29412,7 @@ const KritzelPortal = class {
|
|
|
29375
29412
|
this.calculatePosition();
|
|
29376
29413
|
}
|
|
29377
29414
|
portal;
|
|
29378
|
-
id = `portal-${
|
|
29415
|
+
id = `portal-${schema_constants.ObjectHelper.generateUUID()}`;
|
|
29379
29416
|
defaultOffset = 0;
|
|
29380
29417
|
minLeft = 0;
|
|
29381
29418
|
themeObserver;
|
|
@@ -29574,7 +29611,7 @@ const KritzelPortal = class {
|
|
|
29574
29611
|
* This file is auto-generated by the version bump scripts.
|
|
29575
29612
|
* Do not modify manually.
|
|
29576
29613
|
*/
|
|
29577
|
-
const KRITZEL_VERSION = '0.3.
|
|
29614
|
+
const KRITZEL_VERSION = '0.3.8';
|
|
29578
29615
|
|
|
29579
29616
|
const kritzelSettingsCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-body-padding:0;--kritzel-dialog-width-large:800px;--kritzel-dialog-height-large:500px}.footer-button{padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px}.cancel-button{border:1px solid #ebebeb;background:#fff;color:inherit}.cancel-button:hover{background:#f5f5f5}.settings-content{padding:0}.settings-content h3{margin:0 0 16px 0;font-size:18px;font-weight:600;color:var(--kritzel-settings-content-heading-color, #333333)}.settings-content p{margin:0;font-size:14px;color:var(--kritzel-settings-content-text-color, #666666);line-height:1.5}.settings-group{display:flex;flex-direction:column;gap:24px}.settings-item{display:flex;flex-direction:column;gap:8px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-label{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.settings-description{font-size:12px;color:var(--kritzel-settings-description-color, #888888);margin:0;line-height:1.4}.shortcuts-list{display:flex;flex-direction:column;gap:24px}.shortcuts-category{display:flex;flex-direction:column;gap:8px}.shortcuts-category-title{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.shortcuts-group{display:flex;flex-direction:column;gap:4px}.shortcut-item{display:flex;justify-content:space-between;align-items:center;padding:6px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-item-bg, rgba(0, 0, 0, 0.02))}.shortcut-label{font-size:14px;color:var(--kritzel-settings-content-text-color, #666666)}.shortcut-key{font-family:monospace;font-size:12px;padding:2px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-key-bg, #f0f0f0);color:var(--kritzel-settings-shortcut-key-color, #333333);border:1px solid var(--kritzel-settings-shortcut-key-border, #ddd)}`;
|
|
29580
29617
|
|
|
@@ -29756,7 +29793,7 @@ const KritzelSettings = class {
|
|
|
29756
29793
|
case 'developer':
|
|
29757
29794
|
return (index.h("div", { class: "settings-content" }, index.h("h3", null, "Developer Options"), index.h("div", { class: "settings-group" }, index.h("div", { class: "settings-item" }, index.h("label", { class: "settings-label" }, "Show Viewport Info"), index.h("p", { class: "settings-description" }, "Display viewport debug information such as position, zoom level, and boundaries."), index.h("kritzel-slide-toggle", { checked: this.debugInfo.showViewportInfo, label: "Show Viewport Info", onCheckedChange: this.handleDebugInfoChange('showViewportInfo') })), index.h("div", { class: "settings-item" }, index.h("label", { class: "settings-label" }, "Show Object Info"), index.h("p", { class: "settings-description" }, "Display debug information about objects on the canvas."), index.h("kritzel-slide-toggle", { checked: this.debugInfo.showObjectInfo, label: "Show Object Info", onCheckedChange: this.handleDebugInfoChange('showObjectInfo') })), index.h("div", { class: "settings-item" }, index.h("label", { class: "settings-label" }, "Show Sync Provider Info"), index.h("p", { class: "settings-description" }, "Display debug information about the sync provider connection status."), index.h("kritzel-slide-toggle", { checked: this.debugInfo.showSyncProviderInfo, label: "Show Sync Provider Info", onCheckedChange: this.handleDebugInfoChange('showSyncProviderInfo') })), index.h("div", { class: "settings-item" }, index.h("label", { class: "settings-label" }, "Show Migration Info"), index.h("p", { class: "settings-description" }, "Display debug information about data migrations."), index.h("kritzel-slide-toggle", { checked: this.debugInfo.showMigrationInfo, label: "Show Migration Info", onCheckedChange: this.handleDebugInfoChange('showMigrationInfo') })))));
|
|
29758
29795
|
case 'about':
|
|
29759
|
-
return (index.h("div", { class: "settings-content" }, index.h("h3", null, "About"), index.h("p", null, "Kritzel - A drawing application"), index.h("p", { class: "version-info" }, "Version ", KRITZEL_VERSION), index.h("p", { class: "version-info" }, "App-State Schema v",
|
|
29796
|
+
return (index.h("div", { class: "settings-content" }, index.h("h3", null, "About"), index.h("p", null, "Kritzel - A drawing application"), index.h("p", { class: "version-info" }, "Version ", KRITZEL_VERSION), index.h("p", { class: "version-info" }, "App-State Schema v", schema_constants.CURRENT_APP_STATE_SCHEMA_VERSION), index.h("p", { class: "version-info" }, "Workspace Schema v", schema_constants.CURRENT_WORKSPACE_SCHEMA_VERSION)));
|
|
29760
29797
|
default:
|
|
29761
29798
|
return null;
|
|
29762
29799
|
}
|
|
@@ -29967,7 +30004,7 @@ const KritzelSplitButton = class {
|
|
|
29967
30004
|
menuOpen;
|
|
29968
30005
|
menuClose;
|
|
29969
30006
|
isMenuOpen = false;
|
|
29970
|
-
isTouchDevice =
|
|
30007
|
+
isTouchDevice = schema_constants.KritzelDevicesHelper.isTouchDevice();
|
|
29971
30008
|
anchorElement;
|
|
29972
30009
|
menuScrollTop = 0;
|
|
29973
30010
|
splitMenuButtonRef;
|
|
@@ -30038,7 +30075,7 @@ const KritzelSplitButton = class {
|
|
|
30038
30075
|
};
|
|
30039
30076
|
KritzelSplitButton.style = kritzelSplitButtonCss();
|
|
30040
30077
|
|
|
30041
|
-
const kritzelStrokeSizeCss = () => `:host{display:flex;align-items:flex-start;gap:0;padding:0;width:100%;box-sizing:border-box}.size-grid{width:100%;display:grid;grid-template-columns:repeat(
|
|
30078
|
+
const kritzelStrokeSizeCss = () => `:host{display:flex;align-items:flex-start;gap:0;padding:0;width:100%;box-sizing:border-box}.size-grid{width:100%;display:grid;grid-template-columns:repeat(auto-fill, 32px);gap:8px;justify-items:center}.size-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:var(--kritzel-global-pointer-cursor, pointer);border:2px solid transparent;box-sizing:border-box}.size-container:hover{background-color:var(--kritzel-stroke-size-hover-background-color, #ebebeb)}.size-container.selected{border-color:var(--kritzel-selection-border-color, #007AFF);background-color:var(--kritzel-stroke-size-selected-background-color, #ebebeb)}`;
|
|
30042
30079
|
|
|
30043
30080
|
const KritzelStrokeSize = class {
|
|
30044
30081
|
constructor(hostRef) {
|
|
@@ -30093,6 +30130,7 @@ const KritzelToolConfig = class {
|
|
|
30093
30130
|
this.config = newConfig;
|
|
30094
30131
|
if (this.config) {
|
|
30095
30132
|
this.updatePalette();
|
|
30133
|
+
this.updateSizes();
|
|
30096
30134
|
this.currentOpacity = newTool[this.config.opacityProperty] ?? 1;
|
|
30097
30135
|
// Emit the values since they might have been updated from the old tool
|
|
30098
30136
|
this.emitDisplayValues();
|
|
@@ -30117,13 +30155,15 @@ const KritzelToolConfig = class {
|
|
|
30117
30155
|
displayValuesChange;
|
|
30118
30156
|
config;
|
|
30119
30157
|
palette = [];
|
|
30158
|
+
sizes = [];
|
|
30120
30159
|
currentOpacity = 1;
|
|
30121
30160
|
updateTrigger = 0;
|
|
30122
30161
|
handleSelectionChange() {
|
|
30123
|
-
if (this.tool instanceof
|
|
30162
|
+
if (this.tool instanceof schema_constants.KritzelSelectionTool) {
|
|
30124
30163
|
this.config = KritzelToolConfigHelper.getToolConfig(this.tool);
|
|
30125
30164
|
if (this.config) {
|
|
30126
30165
|
this.updatePalette();
|
|
30166
|
+
this.updateSizes();
|
|
30127
30167
|
this.currentOpacity = this.tool[this.config.opacityProperty] ?? 1;
|
|
30128
30168
|
this.emitDisplayValues();
|
|
30129
30169
|
}
|
|
@@ -30138,6 +30178,7 @@ const KritzelToolConfig = class {
|
|
|
30138
30178
|
this.config = KritzelToolConfigHelper.getToolConfig(this.tool);
|
|
30139
30179
|
if (this.config) {
|
|
30140
30180
|
this.updatePalette();
|
|
30181
|
+
this.updateSizes();
|
|
30141
30182
|
this.currentOpacity = this.tool[this.config.opacityProperty] ?? 1;
|
|
30142
30183
|
this.emitDisplayValues();
|
|
30143
30184
|
}
|
|
@@ -30152,10 +30193,10 @@ const KritzelToolConfig = class {
|
|
|
30152
30193
|
const opacity = this.currentOpacity;
|
|
30153
30194
|
const size = this.tool[this.config.sizeProperty];
|
|
30154
30195
|
const displayValues = {
|
|
30155
|
-
color:
|
|
30196
|
+
color: schema_constants.KritzelColorHelper.applyOpacity(color, opacity, this.theme),
|
|
30156
30197
|
size,
|
|
30157
30198
|
};
|
|
30158
|
-
if (this.tool instanceof
|
|
30199
|
+
if (this.tool instanceof schema_constants.KritzelTextTool) {
|
|
30159
30200
|
displayValues.fontFamily = this.tool.fontFamily;
|
|
30160
30201
|
}
|
|
30161
30202
|
this.displayValuesChange.emit(displayValues);
|
|
@@ -30170,6 +30211,16 @@ const KritzelToolConfig = class {
|
|
|
30170
30211
|
this.palette = this.tool.palette || [];
|
|
30171
30212
|
}
|
|
30172
30213
|
}
|
|
30214
|
+
updateSizes() {
|
|
30215
|
+
if (!this.config)
|
|
30216
|
+
return;
|
|
30217
|
+
if (this.config.sizesSource === 'none') {
|
|
30218
|
+
this.sizes = [];
|
|
30219
|
+
}
|
|
30220
|
+
else {
|
|
30221
|
+
this.sizes = this.tool.sizes || [];
|
|
30222
|
+
}
|
|
30223
|
+
}
|
|
30173
30224
|
handleToggleExpand = () => {
|
|
30174
30225
|
this.isExpanded = !this.isExpanded;
|
|
30175
30226
|
};
|
|
@@ -30230,9 +30281,9 @@ const KritzelToolConfig = class {
|
|
|
30230
30281
|
const value = this.tool[control.propertyName];
|
|
30231
30282
|
switch (control.type) {
|
|
30232
30283
|
case 'stroke-size':
|
|
30233
|
-
return (index.h("kritzel-stroke-size", { key: control.type, selectedSize: value, onSizeChange: this.handleSizeChange }));
|
|
30284
|
+
return (index.h("kritzel-stroke-size", { key: control.type, sizes: this.sizes.length > 0 ? this.sizes : undefined, selectedSize: value, onSizeChange: this.handleSizeChange }));
|
|
30234
30285
|
case 'font-size':
|
|
30235
|
-
return (index.h("kritzel-font-size", { key: control.type, selectedSize: value, fontFamily: this.tool.fontFamily, onSizeChange: this.handleSizeChange }));
|
|
30286
|
+
return (index.h("kritzel-font-size", { key: control.type, sizes: this.sizes.length > 0 ? this.sizes : undefined, selectedSize: value, fontFamily: this.tool.fontFamily, onSizeChange: this.handleSizeChange }));
|
|
30236
30287
|
case 'line-endings':
|
|
30237
30288
|
return (index.h("kritzel-line-endings", { key: control.type, value: value, onValueChange: (event) => this.handlePropertyChange(control.propertyName, event.detail) }));
|
|
30238
30289
|
case 'shape-fill':
|
|
@@ -30525,7 +30576,7 @@ const KritzelWorkspaceManager = class {
|
|
|
30525
30576
|
}
|
|
30526
30577
|
async add() {
|
|
30527
30578
|
await this.splitButtonRef.open();
|
|
30528
|
-
this.newWorkspace = new
|
|
30579
|
+
this.newWorkspace = new schema_constants.KritzelWorkspace(schema_constants.ObjectHelper.generateUUID(), 'New Workspace');
|
|
30529
30580
|
this.editingItemId = this.newWorkspace.id;
|
|
30530
30581
|
}
|
|
30531
30582
|
edit(item) {
|