kritzel-stencil 0.3.11 → 0.3.12
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 +1 -1
- package/dist/cjs/kritzel-active-users_42.cjs.entry.js +214 -50
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{schema.constants-BNMNpzvA.js → schema.constants-CzfoUWxF.js} +4 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/objects/shape.class.js +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +96 -7
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +302 -35
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +27 -6
- package/dist/collection/configs/default-brush-tool.config.js +1 -0
- package/dist/collection/configs/default-line-tool.config.js +1 -0
- package/dist/collection/configs/default-shape-tool.config.js +1 -0
- package/dist/collection/configs/default-text-tool.config.js +1 -0
- package/dist/collection/constants/version.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-tool-config.js +1 -1
- package/dist/components/{p-D15NO5kE.js → p-DIiGd0LS.js} +1 -1
- package/dist/components/{p-DLlIaDNn.js → p-DLh8x1jK.js} +2 -2
- package/dist/components/p-Do4UlU4e.js +1 -0
- package/dist/components/{p-BFgWBbpu.js → p-Dqjil3Hm.js} +1 -1
- package/dist/components/{p-B0VnbmWu.js → p-EFyZdR89.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-active-users_42.entry.js +214 -50
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{schema.constants-CqBoZbmA.js → schema.constants-BcT1vV4J.js} +4 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-0c95e585.entry.js +9 -0
- package/dist/stencil/{p-CqBoZbmA.js → p-BcT1vV4J.js} +1 -1
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/objects/base-object.class.d.ts +1 -1
- package/dist/types/classes/objects/shape.class.d.ts +1 -1
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +3 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +32 -0
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +1 -0
- package/dist/types/components.d.ts +43 -0
- package/dist/types/constants/version.d.ts +1 -1
- package/dist/types/interfaces/object.interface.d.ts +1 -1
- package/dist/types/interfaces/toolbar-control.interface.d.ts +4 -0
- package/package.json +1 -1
- package/dist/components/p-CB7ynHtI.js +0 -1
- package/dist/stencil/p-94992a11.entry.js +0 -9
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CFnj_FXt.js');
|
|
4
|
-
var schema_constants = require('./schema.constants-
|
|
4
|
+
var schema_constants = require('./schema.constants-CzfoUWxF.js');
|
|
5
5
|
var Y = require('yjs');
|
|
6
6
|
require('y-indexeddb');
|
|
7
7
|
require('y-websocket');
|
|
@@ -951,6 +951,7 @@ const KritzelControls = class {
|
|
|
951
951
|
this.isControlsReady = index.createEvent(this, "isControlsReady");
|
|
952
952
|
}
|
|
953
953
|
get host() { return index.getElement(this); }
|
|
954
|
+
visible = true;
|
|
954
955
|
controls = [];
|
|
955
956
|
activeControl = null;
|
|
956
957
|
isUtilityPanelVisible = true;
|
|
@@ -1175,13 +1176,13 @@ const KritzelControls = class {
|
|
|
1175
1176
|
// Separate tool controls from config control
|
|
1176
1177
|
const toolControls = this.internalControls.filter(c => c.type === 'tool' || c.type === 'separator');
|
|
1177
1178
|
const configControl = this.internalControls.find(c => c.type === 'config' && c.name === this.firstConfig?.name);
|
|
1178
|
-
return (index.h(index.Host, { key: '
|
|
1179
|
+
return (index.h(index.Host, { key: '0f40a136a6a9556080d922d346318045794421a8', style: { display: this.visible ? '' : 'none' }, class: {
|
|
1179
1180
|
mobile: this.isTouchDevice,
|
|
1180
|
-
} }, this.isUtilityPanelVisible && (index.h("kritzel-utility-panel", { key: '
|
|
1181
|
+
} }, this.isUtilityPanelVisible && (index.h("kritzel-utility-panel", { key: 'd543e7575cb30e54d9362eddf7c7221fb8cce5f5', style: {
|
|
1181
1182
|
position: 'absolute',
|
|
1182
1183
|
bottom: '56px',
|
|
1183
1184
|
left: '12px',
|
|
1184
|
-
}, undoState: this.undoState, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), index.h("div", { key: '
|
|
1185
|
+
}, undoState: this.undoState, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), index.h("div", { key: '1083380152e9d1b51c35da335533c20ca2ca8fcc', class: "kritzel-controls" }, index.h("div", { key: '11ef0fb76c30ffda0e30f01d43229ca2142a5854', class: { 'scroll-indicator-left': true, 'visible': this.canScrollLeft } }), index.h("div", { key: '269924a8859aece37ff31202307d4feaecbbde86', class: "kritzel-tools-scroll", ref: el => (this.toolsScrollRef = el), onScroll: this.handleToolsScroll }, toolControls.map(control => {
|
|
1185
1186
|
// Check if this control has sub-options (split-button)
|
|
1186
1187
|
if (control.subOptions?.length) {
|
|
1187
1188
|
const selectedSubOption = this.getSelectedSubOption(control);
|
|
@@ -1211,10 +1212,10 @@ const KritzelControls = class {
|
|
|
1211
1212
|
'kritzel-control': true,
|
|
1212
1213
|
'selected': this.activeControl?.name === control?.name,
|
|
1213
1214
|
}, key: control.name, "data-testid": `tool-${control.name}`, onClick: _event => this.handleControlClick?.(control), "aria-label": control.name.charAt(0).toUpperCase() + control.name.slice(1) }, index.h("kritzel-icon", { name: control.icon })));
|
|
1214
|
-
})), index.h("div", { key: '
|
|
1215
|
+
})), index.h("div", { key: '8b97a5bba3ac4992482e8f433d7ba6197918a914', class: { 'scroll-indicator-right': true, 'visible': this.canScrollRight && !(configControl && this.activeControl && hasConfigUI) } }), configControl && this.activeControl && (index.h("div", { class: {
|
|
1215
1216
|
'kritzel-config-container': true,
|
|
1216
1217
|
'visible': hasConfigUI,
|
|
1217
|
-
}, key: configControl.name }, index.h("div", { key: '
|
|
1218
|
+
}, key: configControl.name }, index.h("div", { key: 'd9adef8c2acc8d9b9d745174050ce78960b89b58', class: { 'config-gradient-left': true, 'visible': this.needsScrolling } }), index.h("kritzel-tooltip", { key: '7605bbd2b6335c89c57aa68952293f26efad6b4b', anchorElement: this.host.shadowRoot?.querySelector('.kritzel-config-container'), triggerElement: this.configTriggerRef }, index.h("kritzel-tool-config", { key: '27b0f41442215e78b692fa44bb665444a4993b89', tool: this.activeControl.tool, theme: this.theme, engine: this.kritzelEngine, onToolChange: event => this.handleToolChange?.(event), onDisplayValuesChange: this.handleDisplayValuesChange, style: { width: '100%', height: '100%' } })), index.h("div", { key: '1fb5979b1c531593acf5086861b22b7d78d03e8d', tabIndex: hasConfigUI ? 0 : -1, class: "kritzel-config", "data-testid": "tool-config", ref: el => {
|
|
1218
1219
|
if (el)
|
|
1219
1220
|
this.configTriggerRef = el;
|
|
1220
1221
|
}, onKeyDown: event => {
|
|
@@ -1223,7 +1224,7 @@ const KritzelControls = class {
|
|
|
1223
1224
|
}
|
|
1224
1225
|
}, style: {
|
|
1225
1226
|
cursor: 'pointer',
|
|
1226
|
-
} }, this.displayValues && (index.h("div", { key: '
|
|
1227
|
+
} }, this.displayValues && (index.h("div", { key: '3713ef344630f6b4d88df2e83992018859ddb18c', class: "color-container" }, index.h("kritzel-color", { key: 'c2679f68efae77c6daeb98be9e03d5320d51a73a', value: this.displayValues.color, theme: this.theme, size: 18, style: {
|
|
1227
1228
|
borderRadius: '50%',
|
|
1228
1229
|
border: 'none',
|
|
1229
1230
|
} })))))))));
|
|
@@ -2162,6 +2163,7 @@ const DEFAULT_SHAPE_CONFIG = {
|
|
|
2162
2163
|
fillColor: { light: 'transparent', dark: 'transparent' },
|
|
2163
2164
|
strokeColor: schema_constants.DEFAULT_COLOR_PALETTE[0],
|
|
2164
2165
|
strokeWidth: 4,
|
|
2166
|
+
opacity: 1,
|
|
2165
2167
|
fontColor: schema_constants.DEFAULT_COLOR_PALETTE[0],
|
|
2166
2168
|
fontSize: 16,
|
|
2167
2169
|
fontFamily: 'Arial',
|
|
@@ -2364,6 +2366,7 @@ const KritzelEditor = class {
|
|
|
2364
2366
|
isUtilityPanelVisible = true;
|
|
2365
2367
|
isWorkspaceManagerVisible = true;
|
|
2366
2368
|
isMoreMenuVisible = true;
|
|
2369
|
+
isObjectDistanceFadingActive = false;
|
|
2367
2370
|
syncConfig = DEFAULT_SYNC_CONFIG;
|
|
2368
2371
|
assetStorageConfig = schema_constants.DEFAULT_ASSET_STORAGE_CONFIG;
|
|
2369
2372
|
/** The element to use as the target for the cursor. Defaults to the editor container if not set. */
|
|
@@ -2479,12 +2482,18 @@ const KritzelEditor = class {
|
|
|
2479
2482
|
async addObject(object) {
|
|
2480
2483
|
return this.engineRef.addObject(object);
|
|
2481
2484
|
}
|
|
2485
|
+
async addObjects(objects) {
|
|
2486
|
+
return this.engineRef.addObjects(objects);
|
|
2487
|
+
}
|
|
2482
2488
|
async updateObject(object, updatedProperties) {
|
|
2483
2489
|
return this.engineRef.updateObject(object, updatedProperties);
|
|
2484
2490
|
}
|
|
2485
2491
|
async removeObject(object) {
|
|
2486
2492
|
return this.engineRef.removeObject(object);
|
|
2487
2493
|
}
|
|
2494
|
+
async removeObjects(objects) {
|
|
2495
|
+
return this.engineRef.removeObjects(objects);
|
|
2496
|
+
}
|
|
2488
2497
|
async getSelectedObjects() {
|
|
2489
2498
|
return this.engineRef.getSelectedObjects();
|
|
2490
2499
|
}
|
|
@@ -2959,31 +2968,31 @@ const KritzelEditor = class {
|
|
|
2959
2968
|
const isLoggedIn = this.isLoggedIn;
|
|
2960
2969
|
const shouldShowCurrentUser = isLoggedIn;
|
|
2961
2970
|
const shouldShowLoginButton = this.isReady && !!this.loginConfig && !isLoggedIn;
|
|
2962
|
-
return (index.h(index.Host, { key: '
|
|
2971
|
+
return (index.h(index.Host, { key: '440621eb23598732c63d4be92ae16785d84b3d6f', style: {
|
|
2963
2972
|
opacity: this.isEditorVisible ? '1' : '0',
|
|
2964
2973
|
visibility: this.isEditorVisible ? 'visible' : 'hidden',
|
|
2965
2974
|
transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out',
|
|
2966
|
-
} }, index.h("div", { key: '
|
|
2975
|
+
} }, index.h("div", { key: 'b20c930c8094f7ab9db8fdb09428cf34a2cab024', class: "top-left-buttons" }, index.h("kritzel-workspace-manager", { key: 'a6ff7e54fb3d45f4a3b1d009b12d2f6229d14d87', 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: 'a3cbb86082c2f0768b7457ec25740d27200e287b', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), index.h("kritzel-engine", { key: '82e611de33c40997943e1fd702f0b601fadbf591', ref: el => {
|
|
2967
2976
|
if (el) {
|
|
2968
2977
|
this.engineRef = el;
|
|
2969
2978
|
}
|
|
2970
|
-
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.theme, themes: this.themes, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), index.h("kritzel-controls", { key: '
|
|
2979
|
+
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, isObjectDistanceFadingActive: this.isObjectDistanceFadingActive, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.theme, themes: this.themes, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), index.h("kritzel-controls", { key: 'eb48df395318bde3fc0bc48784510bf5139bc9e8', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
|
|
2971
2980
|
if (el) {
|
|
2972
2981
|
this.controlsRef = el;
|
|
2973
2982
|
}
|
|
2974
|
-
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, onIsControlsReady: () => (this.isControlsReady = true) }), index.h("div", { key: '
|
|
2983
|
+
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, onIsControlsReady: () => (this.isControlsReady = true) }), index.h("div", { key: '1259089ca70c634621f7e2db274868b12a3e5e8a', class: "top-right-buttons" }, index.h("kritzel-settings", { key: 'b38b01040714827a5d824694b481edb8094eafd8', ref: el => {
|
|
2975
2984
|
if (el) {
|
|
2976
2985
|
this.settingsRef = el;
|
|
2977
2986
|
}
|
|
2978
|
-
}, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), index.h("kritzel-export", { key: '
|
|
2987
|
+
}, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), index.h("kritzel-export", { key: 'a678999cac4f3618c44d1340b6905ec2f3061dd5', ref: el => {
|
|
2979
2988
|
if (el) {
|
|
2980
2989
|
this.exportRef = el;
|
|
2981
2990
|
}
|
|
2982
|
-
}, 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: '
|
|
2991
|
+
}, 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: '7d0b70c7347e7fda4e96a59b27b8fb6c2eb77f49', users: this.activeUsers }), shouldShowCurrentUser && index.h("kritzel-current-user", { key: 'ed364648df937fb1e84d850953fee51f6e54e95e', user: this.user }), shouldShowLoginButton && (index.h("kritzel-button", { key: 'dd24afa0746a311ac4a27000281fef28bddf844a', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in")), index.h("kritzel-more-menu", { key: '713da1a5313809083470a8a23c0531e9e198c4bd', items: this.moreMenuItems, visible: this.isMoreMenuVisible }), index.h("kritzel-share-dialog", { key: '37f80fdb7b1087926b72ece7693f816c9f85f746', ref: el => {
|
|
2983
2992
|
if (el) {
|
|
2984
2993
|
this.shareDialogRef = el;
|
|
2985
2994
|
}
|
|
2986
|
-
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (index.h("kritzel-login-dialog", { key: '
|
|
2995
|
+
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (index.h("kritzel-login-dialog", { key: 'f5b59522082824bc236784a9083f1d425852d487', ref: el => {
|
|
2987
2996
|
if (el) {
|
|
2988
2997
|
this.loginDialogRef = el;
|
|
2989
2998
|
}
|
|
@@ -26524,6 +26533,11 @@ const KritzelEngine = class {
|
|
|
26524
26533
|
onLockDrawingScaleChange(newValue) {
|
|
26525
26534
|
this.core.store.state.lockDrawingScale = newValue;
|
|
26526
26535
|
}
|
|
26536
|
+
/** When true, objects fade based on distance to the viewport center. */
|
|
26537
|
+
isObjectDistanceFadingActive = false;
|
|
26538
|
+
onIsObjectDistanceFadingActiveChange() {
|
|
26539
|
+
this.core.rerender();
|
|
26540
|
+
}
|
|
26527
26541
|
/** The current theme to apply to the editor */
|
|
26528
26542
|
theme = 'light';
|
|
26529
26543
|
onThemeChange(newValue) {
|
|
@@ -26958,7 +26972,7 @@ const KritzelEngine = class {
|
|
|
26958
26972
|
this.core.deselectAllObjects();
|
|
26959
26973
|
object.id = object.generateId();
|
|
26960
26974
|
object._core = this.core;
|
|
26961
|
-
object.scale = this.core.store.state.scale;
|
|
26975
|
+
object.scale = object.scale ?? this.core.store.state.scale;
|
|
26962
26976
|
object.zIndex = this.core.store.currentZIndex;
|
|
26963
26977
|
object.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
26964
26978
|
// Handle KritzelText: recreate the editor now that _core is available
|
|
@@ -26987,7 +27001,7 @@ const KritzelEngine = class {
|
|
|
26987
27001
|
const oldId = child.id;
|
|
26988
27002
|
child.id = child.generateId();
|
|
26989
27003
|
child._core = this.core;
|
|
26990
|
-
child.scale = this.core.store.state.scale;
|
|
27004
|
+
child.scale = child.scale ?? this.core.store.state.scale;
|
|
26991
27005
|
child.zIndex = this.core.store.currentZIndex;
|
|
26992
27006
|
child.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
26993
27007
|
idRemapping.set(oldId, child.id);
|
|
@@ -27033,6 +27047,82 @@ const KritzelEngine = class {
|
|
|
27033
27047
|
this.emitObjectsAdded([object]);
|
|
27034
27048
|
return object;
|
|
27035
27049
|
}
|
|
27050
|
+
/**
|
|
27051
|
+
* Adds multiple objects to the canvas in a single batch operation.
|
|
27052
|
+
* All objects are inserted within one Yjs transaction (single undo step),
|
|
27053
|
+
* triggering only one rerender cycle. Intended for programmatic streaming
|
|
27054
|
+
* scenarios where per-object overhead would cause stutter.
|
|
27055
|
+
* @param objects - The object instances to add.
|
|
27056
|
+
* @returns The added objects.
|
|
27057
|
+
*/
|
|
27058
|
+
async addObjects(objects) {
|
|
27059
|
+
if (objects.length === 0) {
|
|
27060
|
+
return [];
|
|
27061
|
+
}
|
|
27062
|
+
this.core.store.objects.transaction(() => {
|
|
27063
|
+
for (const object of objects) {
|
|
27064
|
+
object.id = object.generateId();
|
|
27065
|
+
object._core = this.core;
|
|
27066
|
+
object.zIndex = this.core.store.currentZIndex;
|
|
27067
|
+
object.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
27068
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelText')) {
|
|
27069
|
+
const pendingContent = object.content;
|
|
27070
|
+
object.editor = object.createEditor();
|
|
27071
|
+
if (pendingContent) {
|
|
27072
|
+
object.setContent(pendingContent);
|
|
27073
|
+
}
|
|
27074
|
+
}
|
|
27075
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelGroup') && object._pendingChildren.length > 0) {
|
|
27076
|
+
const idRemapping = new Map();
|
|
27077
|
+
const allFlushedChildren = [];
|
|
27078
|
+
const flushGroup = (group) => {
|
|
27079
|
+
if (group._pendingChildren.length === 0) {
|
|
27080
|
+
return;
|
|
27081
|
+
}
|
|
27082
|
+
const pending = group._pendingChildren;
|
|
27083
|
+
group._pendingChildren = [];
|
|
27084
|
+
group.childIds = [];
|
|
27085
|
+
pending.forEach(child => {
|
|
27086
|
+
const oldId = child.id;
|
|
27087
|
+
child.id = child.generateId();
|
|
27088
|
+
child._core = this.core;
|
|
27089
|
+
child.zIndex = this.core.store.currentZIndex;
|
|
27090
|
+
child.workspaceId = this.core.store.state.activeWorkspace.id;
|
|
27091
|
+
idRemapping.set(oldId, child.id);
|
|
27092
|
+
group.childIds.push(child.id);
|
|
27093
|
+
allFlushedChildren.push(child);
|
|
27094
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(child, 'KritzelGroup')) {
|
|
27095
|
+
flushGroup(child);
|
|
27096
|
+
}
|
|
27097
|
+
});
|
|
27098
|
+
};
|
|
27099
|
+
flushGroup(object);
|
|
27100
|
+
allFlushedChildren.forEach(child => {
|
|
27101
|
+
if (schema_constants.KritzelClassHelper.isInstanceOf(child, 'KritzelLine')) {
|
|
27102
|
+
if (child.startAnchor && idRemapping.has(child.startAnchor.objectId)) {
|
|
27103
|
+
child.startAnchor = { objectId: idRemapping.get(child.startAnchor.objectId) };
|
|
27104
|
+
}
|
|
27105
|
+
if (child.endAnchor && idRemapping.has(child.endAnchor.objectId)) {
|
|
27106
|
+
child.endAnchor = { objectId: idRemapping.get(child.endAnchor.objectId) };
|
|
27107
|
+
}
|
|
27108
|
+
}
|
|
27109
|
+
});
|
|
27110
|
+
allFlushedChildren.forEach(child => {
|
|
27111
|
+
this.core.addObject(child);
|
|
27112
|
+
});
|
|
27113
|
+
object.finalize();
|
|
27114
|
+
this.core.anchorManager.rebuildIndex();
|
|
27115
|
+
}
|
|
27116
|
+
this.core.addObject(object);
|
|
27117
|
+
}
|
|
27118
|
+
});
|
|
27119
|
+
this.core.rerender();
|
|
27120
|
+
await new Promise(resolve => {
|
|
27121
|
+
requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
|
|
27122
|
+
});
|
|
27123
|
+
this.emitObjectsAdded(objects);
|
|
27124
|
+
return objects;
|
|
27125
|
+
}
|
|
27036
27126
|
/**
|
|
27037
27127
|
* Updates properties of an existing canvas object.
|
|
27038
27128
|
* @param object - The object to update.
|
|
@@ -27062,6 +27152,28 @@ const KritzelEngine = class {
|
|
|
27062
27152
|
this.emitObjectsRemoved([object]);
|
|
27063
27153
|
return object;
|
|
27064
27154
|
}
|
|
27155
|
+
/**
|
|
27156
|
+
* Removes multiple objects from the canvas in a single batch operation.
|
|
27157
|
+
* All removals happen within one Yjs transaction (single undo step),
|
|
27158
|
+
* triggering only one rerender cycle. Intended for programmatic streaming
|
|
27159
|
+
* scenarios where per-object overhead would cause stutter.
|
|
27160
|
+
* @param objects - The objects to remove.
|
|
27161
|
+
* @returns The removed objects.
|
|
27162
|
+
*/
|
|
27163
|
+
async removeObjects(objects) {
|
|
27164
|
+
const objectsMap = this.core.store.objects;
|
|
27165
|
+
if (!objectsMap || objects.length === 0) {
|
|
27166
|
+
return [];
|
|
27167
|
+
}
|
|
27168
|
+
objectsMap.transaction(() => {
|
|
27169
|
+
for (const object of objects) {
|
|
27170
|
+
this.core.removeObject(object);
|
|
27171
|
+
}
|
|
27172
|
+
});
|
|
27173
|
+
this.core.rerender();
|
|
27174
|
+
this.emitObjectsRemoved(objects);
|
|
27175
|
+
return objects;
|
|
27176
|
+
}
|
|
27065
27177
|
/** Returns the currently selected objects. Returns an empty array if nothing is selected. */
|
|
27066
27178
|
async getSelectedObjects() {
|
|
27067
27179
|
const selectionGroup = this.core.store.selectionGroup;
|
|
@@ -27716,6 +27828,12 @@ const KritzelEngine = class {
|
|
|
27716
27828
|
undoStackSize: 0,
|
|
27717
27829
|
redoStackSize: 0,
|
|
27718
27830
|
};
|
|
27831
|
+
_objectDistanceFadeNearScale = 1;
|
|
27832
|
+
_objectDistanceFadeFarScale = 0.15;
|
|
27833
|
+
_objectDistanceFadeMinOpacity = 0;
|
|
27834
|
+
_objectDistanceFadeCloseStartScale = 2;
|
|
27835
|
+
_objectDistanceFadeCloseMaxScale = 4;
|
|
27836
|
+
_objectDistanceFadeCloseMinOpacity = 0;
|
|
27719
27837
|
syncLoadingState() {
|
|
27720
27838
|
this.core.store.state.isLoading = this._isWorkspaceLoading || this.isLoading;
|
|
27721
27839
|
}
|
|
@@ -28039,6 +28157,54 @@ const KritzelEngine = class {
|
|
|
28039
28157
|
schema_constants.KritzelKeyboardHelper.forceHideKeyboard();
|
|
28040
28158
|
this.core.rerender();
|
|
28041
28159
|
}
|
|
28160
|
+
getObjectDistanceFadeMultiplier(objectScale, viewportScale) {
|
|
28161
|
+
if (!this.isObjectDistanceFadingActive) {
|
|
28162
|
+
return 1;
|
|
28163
|
+
}
|
|
28164
|
+
const safeViewportScale = Math.max(Number.isFinite(viewportScale) ? viewportScale : 1, Number.EPSILON);
|
|
28165
|
+
const safeObjectScale = Math.max(Number.isFinite(objectScale) ? objectScale : 1, Number.EPSILON);
|
|
28166
|
+
const normalizedScale = safeViewportScale / safeObjectScale;
|
|
28167
|
+
const farFadeMultiplier = this.getFarDistanceFadeMultiplier(normalizedScale);
|
|
28168
|
+
const closeFadeMultiplier = this.getCloseDistanceFadeMultiplier(normalizedScale);
|
|
28169
|
+
return Math.min(farFadeMultiplier, closeFadeMultiplier);
|
|
28170
|
+
}
|
|
28171
|
+
getFarDistanceFadeMultiplier(normalizedScale) {
|
|
28172
|
+
if (normalizedScale >= this._objectDistanceFadeNearScale) {
|
|
28173
|
+
return 1;
|
|
28174
|
+
}
|
|
28175
|
+
if (normalizedScale <= this._objectDistanceFadeFarScale) {
|
|
28176
|
+
return this._objectDistanceFadeMinOpacity;
|
|
28177
|
+
}
|
|
28178
|
+
const progress = (this._objectDistanceFadeNearScale - normalizedScale) /
|
|
28179
|
+
(this._objectDistanceFadeNearScale - this._objectDistanceFadeFarScale);
|
|
28180
|
+
const smooth = progress * progress * (3 - 2 * progress);
|
|
28181
|
+
return 1 - smooth * (1 - this._objectDistanceFadeMinOpacity);
|
|
28182
|
+
}
|
|
28183
|
+
getCloseDistanceFadeMultiplier(normalizedScale) {
|
|
28184
|
+
if (normalizedScale <= this._objectDistanceFadeCloseStartScale) {
|
|
28185
|
+
return 1;
|
|
28186
|
+
}
|
|
28187
|
+
if (normalizedScale >= this._objectDistanceFadeCloseMaxScale) {
|
|
28188
|
+
return this._objectDistanceFadeCloseMinOpacity;
|
|
28189
|
+
}
|
|
28190
|
+
const progress = (normalizedScale - this._objectDistanceFadeCloseStartScale) /
|
|
28191
|
+
(this._objectDistanceFadeCloseMaxScale - this._objectDistanceFadeCloseStartScale);
|
|
28192
|
+
const smooth = progress * progress * (3 - 2 * progress);
|
|
28193
|
+
return 1 - smooth * (1 - this._objectDistanceFadeCloseMinOpacity);
|
|
28194
|
+
}
|
|
28195
|
+
shouldApplyDistanceFade(object) {
|
|
28196
|
+
return (!schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') &&
|
|
28197
|
+
!schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionBox'));
|
|
28198
|
+
}
|
|
28199
|
+
getObjectEffectiveOpacity(object, viewportScale) {
|
|
28200
|
+
const safeObjectOpacity = Number.isFinite(object.opacity) ? object.opacity : 1;
|
|
28201
|
+
const distanceFadeMultiplier = this.shouldApplyDistanceFade(object)
|
|
28202
|
+
? this.getObjectDistanceFadeMultiplier(object.scale, viewportScale)
|
|
28203
|
+
: 1;
|
|
28204
|
+
const multiplied = (object.markedForRemoval ? 0.5 : 1) * safeObjectOpacity * distanceFadeMultiplier;
|
|
28205
|
+
const overridden = ((object.markedForRemoval ? 0.5 : safeObjectOpacity) * distanceFadeMultiplier).toString();
|
|
28206
|
+
return { multiplied, overridden };
|
|
28207
|
+
}
|
|
28042
28208
|
render() {
|
|
28043
28209
|
if (!this.viewport) {
|
|
28044
28210
|
return (index.h(index.Host, null, this.core.store.state.isLoading && (index.h("div", { class: "workspace-loading-overlay" }, index.h("span", { class: "workspace-loading-spinner" }), "Loading..."))));
|
|
@@ -28048,6 +28214,7 @@ const KritzelEngine = class {
|
|
|
28048
28214
|
const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
|
|
28049
28215
|
const baseHandleSize = parseFloat(baseHandleSizePx);
|
|
28050
28216
|
const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
|
|
28217
|
+
const viewportScale = this.core.store.state.scale;
|
|
28051
28218
|
const viewportCenterX = this.core.store.state.viewportWidth / 2 + this.core.store.state.translateX;
|
|
28052
28219
|
const viewportCenterY = this.core.store.state.viewportHeight / 2 + this.core.store.state.translateY;
|
|
28053
28220
|
const visibleObjects = this.core.store.objectsInViewport;
|
|
@@ -28061,39 +28228,34 @@ const KritzelEngine = class {
|
|
|
28061
28228
|
return (index.h(index.Host, null, this.core.store.state.isLoading && (index.h("div", { class: "workspace-loading-overlay" }, index.h("span", { class: "workspace-loading-spinner" }), "Loading...")), this.core.store.state.debugInfo.showViewportInfo && (index.h("div", { class: "debug-panel" }, index.h("div", null, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), index.h("div", null, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), index.h("div", null, "TranslateX: ", this.core.store.state?.translateX), index.h("div", null, "TranslateY: ", this.core.store.state?.translateY), index.h("div", null, "ViewportWidth: ", this.core.store.state?.viewportWidth), index.h("div", null, "ViewportHeight: ", this.core.store.state?.viewportHeight), index.h("div", null, "PointerCount: ", this.core.store.state.pointers.size), index.h("div", null, "Scale: ", this.core.store.state?.scale), index.h("div", null, "ActiveTool: ", this.core.store.state?.activeTool?.name), index.h("div", null, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), index.h("div", null, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), index.h("div", null, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), index.h("div", null, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), index.h("div", null, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", null, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", null, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", null, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", null, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), index.h("div", null, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), index.h("div", null, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), index.h("div", null, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), index.h("div", null, "PointerX: ", this.core.store.state?.pointerX), index.h("div", null, "PointerY: ", this.core.store.state?.pointerY), index.h("div", null, "TotalObjects: ", this.core.store.totalObjectCount), index.h("div", null, "ObjectsInViewport: ", this.core.store.objectsInViewport.length), index.h("div", null, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), index.h("div", null, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), index.h("div", { id: "origin", class: "origin", style: {
|
|
28062
28229
|
transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
|
|
28063
28230
|
} }, visibleObjects?.map(object => {
|
|
28231
|
+
const { multiplied: effectiveOpacity, overridden: effectiveOpacityString } = this.getObjectEffectiveOpacity(object, viewportScale);
|
|
28064
28232
|
return (index.h("div", { key: object.id, id: object.id, class: "object", style: {
|
|
28065
28233
|
transform: object?.transformationMatrix,
|
|
28066
28234
|
transformOrigin: 'top left',
|
|
28067
28235
|
position: 'absolute',
|
|
28068
28236
|
zIndex: object.zIndex.toString(),
|
|
28069
28237
|
pointerEvents: this.core.store.state.isScaling ? 'none' : 'auto',
|
|
28070
|
-
} }, schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && ((
|
|
28071
|
-
|
|
28072
|
-
|
|
28073
|
-
|
|
28074
|
-
|
|
28075
|
-
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28082
|
-
|
|
28083
|
-
|
|
28084
|
-
|
|
28085
|
-
|
|
28086
|
-
|
|
28087
|
-
|
|
28088
|
-
|
|
28089
|
-
|
|
28090
|
-
|
|
28091
|
-
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28092
|
-
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28093
|
-
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28094
|
-
overflow: 'visible',
|
|
28095
|
-
}, 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 })));
|
|
28096
|
-
})(), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && object.loadState === 'ready' && (index.h("img", { ref: el => el && object.mount(el), src: object.resolvedSrc || object.src, style: {
|
|
28238
|
+
} }, schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (index.h("svg", { ref: el => el && object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
28239
|
+
height: object?.totalHeight + 'px',
|
|
28240
|
+
width: object?.totalWidth + 'px',
|
|
28241
|
+
left: '0',
|
|
28242
|
+
top: '0',
|
|
28243
|
+
position: 'absolute',
|
|
28244
|
+
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28245
|
+
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28246
|
+
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28247
|
+
overflow: 'visible',
|
|
28248
|
+
}, 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' }))), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelLine') && (index.h("svg", { ref: el => el && object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
28249
|
+
height: object?.totalHeight + 'px',
|
|
28250
|
+
width: object?.totalWidth + 'px',
|
|
28251
|
+
left: '0',
|
|
28252
|
+
top: '0',
|
|
28253
|
+
position: 'absolute',
|
|
28254
|
+
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28255
|
+
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28256
|
+
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28257
|
+
overflow: 'visible',
|
|
28258
|
+
}, 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 }))), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && object.loadState === 'ready' && (index.h("img", { ref: el => el && object.mount(el), src: object.resolvedSrc || object.src, style: {
|
|
28097
28259
|
position: 'absolute',
|
|
28098
28260
|
left: '0',
|
|
28099
28261
|
top: '0',
|
|
@@ -28101,7 +28263,7 @@ const KritzelEngine = class {
|
|
|
28101
28263
|
height: object.totalHeight + 'px',
|
|
28102
28264
|
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28103
28265
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28104
|
-
opacity:
|
|
28266
|
+
opacity: effectiveOpacityString,
|
|
28105
28267
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28106
28268
|
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
28107
28269
|
borderColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme),
|
|
@@ -28119,7 +28281,7 @@ const KritzelEngine = class {
|
|
|
28119
28281
|
height: object.totalHeight + 'px',
|
|
28120
28282
|
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28121
28283
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28122
|
-
opacity:
|
|
28284
|
+
opacity: effectiveOpacityString,
|
|
28123
28285
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28124
28286
|
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor({ light: '#e5e7eb', dark: '#2a2a2a' }, currentTheme),
|
|
28125
28287
|
borderColor: object.loadState === 'error'
|
|
@@ -28143,7 +28305,7 @@ const KritzelEngine = class {
|
|
|
28143
28305
|
height: object.totalHeight + 'px',
|
|
28144
28306
|
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28145
28307
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28146
|
-
opacity:
|
|
28308
|
+
opacity: effectiveOpacityString,
|
|
28147
28309
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28148
28310
|
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
28149
28311
|
borderColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.borderColor, currentTheme),
|
|
@@ -28184,7 +28346,7 @@ const KritzelEngine = class {
|
|
|
28184
28346
|
height: object.totalHeight + 'px',
|
|
28185
28347
|
transform: object.rotationDegrees !== 0 ? `rotate(${object.rotationDegrees}deg)` : undefined,
|
|
28186
28348
|
transformOrigin: object.rotationDegrees !== 0 ? `${object.totalWidth / 2}px ${object.totalHeight / 2}px` : undefined,
|
|
28187
|
-
opacity:
|
|
28349
|
+
opacity: effectiveOpacityString,
|
|
28188
28350
|
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
28189
28351
|
} }, index.h("div", { id: "text-object", ref: el => el && object.mount(el), onPointerDown: e => object.handlePointerDown(e), onPointerMove: e => object.handlePointerMove(e), onPointerUp: e => object.handlePointerUp(e), style: {
|
|
28190
28352
|
minWidth: object.initialWidth + 'px',
|
|
@@ -28197,7 +28359,6 @@ const KritzelEngine = class {
|
|
|
28197
28359
|
backgroundColor: schema_constants.KritzelColorHelper.resolveThemeColor(object.backgroundColor, currentTheme),
|
|
28198
28360
|
overflow: 'visible',
|
|
28199
28361
|
} }))), schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelShape') && (() => {
|
|
28200
|
-
const effectiveOpacity = (object.markedForRemoval ? 0.5 : 1) * object.opacity;
|
|
28201
28362
|
const fillResolved = schema_constants.KritzelColorHelper.resolveThemeColor(object.fillColor, currentTheme);
|
|
28202
28363
|
const strokeResolved = schema_constants.KritzelColorHelper.resolveThemeColor(object.strokeColor, currentTheme);
|
|
28203
28364
|
const isFilled = !!fillResolved && fillResolved !== 'transparent';
|
|
@@ -28239,7 +28400,7 @@ const KritzelEngine = class {
|
|
|
28239
28400
|
left: `${object.totalWidth}px`,
|
|
28240
28401
|
top: '0',
|
|
28241
28402
|
zIndex: (object.zIndex + 2).toString(),
|
|
28242
|
-
} }, 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)) &&
|
|
28403
|
+
} }, 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' } }, "scale: ", object.scale), 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)) &&
|
|
28243
28404
|
(() => {
|
|
28244
28405
|
const isSelectionGroup = schema_constants.KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup');
|
|
28245
28406
|
const localClientId = this.core.store.objects?.localClientId;
|
|
@@ -28514,6 +28675,9 @@ const KritzelEngine = class {
|
|
|
28514
28675
|
"lockDrawingScale": [{
|
|
28515
28676
|
"onLockDrawingScaleChange": 0
|
|
28516
28677
|
}],
|
|
28678
|
+
"isObjectDistanceFadingActive": [{
|
|
28679
|
+
"onIsObjectDistanceFadingActiveChange": 0
|
|
28680
|
+
}],
|
|
28517
28681
|
"theme": [{
|
|
28518
28682
|
"onThemeChange": 0
|
|
28519
28683
|
}],
|
|
@@ -29785,7 +29949,7 @@ const KritzelPortal = class {
|
|
|
29785
29949
|
* This file is auto-generated by the version bump scripts.
|
|
29786
29950
|
* Do not modify manually.
|
|
29787
29951
|
*/
|
|
29788
|
-
const KRITZEL_VERSION = '0.3.
|
|
29952
|
+
const KRITZEL_VERSION = '0.3.12';
|
|
29789
29953
|
|
|
29790
29954
|
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)}`;
|
|
29791
29955
|
|