kritzel-stencil 0.4.5 → 0.4.6

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.
@@ -531,6 +531,12 @@ export class KritzelEditor {
531
531
  async triggerSelectionChange() {
532
532
  return this.engineRef.triggerSelectionChange();
533
533
  }
534
+ async beginSceneBootstrap() {
535
+ return this.engineRef.beginSceneBootstrap();
536
+ }
537
+ async endSceneBootstrap() {
538
+ return this.engineRef.endSceneBootstrap();
539
+ }
534
540
  async getDisplayableShortcuts() {
535
541
  return this.engineRef.getDisplayableShortcuts();
536
542
  }
@@ -1010,36 +1016,36 @@ export class KritzelEditor {
1010
1016
  const isLoggedIn = this.isLoggedIn;
1011
1017
  const shouldShowCurrentUser = isLoggedIn;
1012
1018
  const shouldShowLoginButton = this.isReady && !!this.loginConfig && !isLoggedIn;
1013
- return (h(Host, { key: '00d652c74feac7b4917772146368125da6deeb1c' }, h("div", { key: 'f8fb86b45b0cdabb5e3ad52de6d6ef31a71a09e4', class: "editor-content", style: {
1019
+ return (h(Host, { key: '0fea11ea16e8baca0a7ecbd22c8025b47d451ac0' }, h("div", { key: 'd2ed05c8a6ecbe5b3cc4fc8bc12affefc1c15976', class: "editor-content", style: {
1014
1020
  opacity: this.isEditorVisible ? '1' : '0',
1015
1021
  visibility: this.isEditorVisible ? 'visible' : 'hidden',
1016
1022
  transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out',
1017
- } }, h("div", { key: '2378c776d8eecf2614567bed11c6e93fb338e302', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'ce41192540169694482d6f8cca60701bc4427438', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, terms: this.resolvedTerms, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'ec269d3e9f589362d8301370778f0c5e4252eead', visible: this.isBackToContentButtonVisible, text: this.resolvedTerms['backToContent.label'] ?? 'Back to content', onBackToContent: () => this.backToContent() })), this.activeNotification && (h("div", { key: '847ed8149d556c934090424ff54b17b6721ccc76', class: "top-center-notification-layer", role: "presentation" }, h("div", { key: '61d8b8e91cda100ffa6620db26ba6dfb2232946a', class: { 'top-center-notification-container': true, 'is-dismissing': this.isNotificationDismissing }, role: "presentation" }, h("kritzel-notification-card", { key: 'b7e132773225ace38e447756110dd39e4661f5fc', notification: this.activeNotification, locale: this.locale, onDismiss: this.dismissNotification, onHoverChange: event => this.handleNotificationHoverChange(event) })))), h("kritzel-engine", { key: '3e4a6d0dbc015ec675fb21a59990c87e9eaa805f', ref: el => {
1023
+ } }, h("div", { key: '3dfab068157d0091834c80d901262228b4f63546', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'e70f2a26a371a13c771d2b45f12fbd7f41fa7f9a', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, terms: this.resolvedTerms, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'f0e4851612bac461d97d16c0f23aeefbd1a220e4', visible: this.isBackToContentButtonVisible, text: this.resolvedTerms['backToContent.label'] ?? 'Back to content', onBackToContent: () => this.backToContent() })), this.activeNotification && (h("div", { key: '633dcabf1875a0af0399807f111d19e8e1d2781e', class: "top-center-notification-layer", role: "presentation" }, h("div", { key: '67336263f6de75f03116d751157b78b8f42649c8', class: { 'top-center-notification-container': true, 'is-dismissing': this.isNotificationDismissing }, role: "presentation" }, h("kritzel-notification-card", { key: 'b0316aa4e37283d1de8a969c07523c28408ce474', notification: this.activeNotification, locale: this.locale, onDismiss: this.dismissNotification, onHoverChange: event => this.handleNotificationHoverChange(event) })))), h("kritzel-engine", { key: '6e9c047b04221332ffb5a50970d8f37592db4b5d', ref: el => {
1018
1024
  if (el) {
1019
1025
  this.engineRef = el;
1020
1026
  }
1021
- }, 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, isPanningEnabled: this.isPanningEnabled, isZoomingEnabled: this.isZoomingEnabled, theme: this.theme, themes: this.themes, licenseKey: this.licenseKey, locale: this.locale, locales: this.locales, fallbackLocale: this.fallbackLocale, 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), onNotificationsChange: event => this.handleNotificationsChange(event) }), h("kritzel-controls", { key: 'f84607a0a4d0762c1249400f85b7b8454d672c1e', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
1027
+ }, 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, isPanningEnabled: this.isPanningEnabled, isZoomingEnabled: this.isZoomingEnabled, theme: this.theme, themes: this.themes, licenseKey: this.licenseKey, locale: this.locale, locales: this.locales, fallbackLocale: this.fallbackLocale, 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), onNotificationsChange: event => this.handleNotificationsChange(event) }), h("kritzel-controls", { key: 'a664a3b51842238e092835ba6e68b63409829dba', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
1022
1028
  if (el) {
1023
1029
  this.controlsRef = el;
1024
1030
  }
1025
- }, controls: this.normalizedControls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, terms: this.resolvedTerms, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: 'e2691e7c730195e197511cb1e4d0fe707677b5ff', class: "bottom-left-buttons" }, h("kritzel-zoom-panel", { key: 'd0ac6624eab49af78d4761c3ad91842834717aad', visible: this.isZoomPanelVisible, disabled: !this.isZoomingEnabled, zoomPercent: this.currentZoomPercent, terms: this.resolvedTerms, onZoomIn: () => this.zoomIn(), onZoomOut: () => this.zoomOut() })), h("div", { key: 'ad3d386ab7e8ad9fdfbb12754db005bc85fa28ce', class: "top-right-buttons" }, h("kritzel-settings", { key: '566024ac6f3d8f7f20238cc1f83882b39dbf698e', ref: el => {
1031
+ }, controls: this.normalizedControls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, terms: this.resolvedTerms, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '7da601af2f3e5be020b2dacac9ed377660488005', class: "bottom-left-buttons" }, h("kritzel-zoom-panel", { key: 'e764e09ab790810620527618e40c298495c56b72', visible: this.isZoomPanelVisible, disabled: !this.isZoomingEnabled, zoomPercent: this.currentZoomPercent, terms: this.resolvedTerms, onZoomIn: () => this.zoomIn(), onZoomOut: () => this.zoomOut() })), h("div", { key: 'c846bd187a9c3d4e4c9034a605ea77500a815cd2', class: "top-right-buttons" }, h("kritzel-settings", { key: '1b0d3c6acda30f6222dcf13f131d4cad87ced86b', ref: el => {
1026
1032
  if (el) {
1027
1033
  this.settingsRef = el;
1028
1034
  }
1029
- }, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], availableLocales: this.availableLocaleOptions, settings: this.currentSettingsConfig, terms: this.resolvedTerms, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '4a23ea0c6e070d424a90e9fc87de04e11cff7ade', ref: el => {
1035
+ }, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], availableLocales: this.availableLocaleOptions, settings: this.currentSettingsConfig, terms: this.resolvedTerms, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '7a81c4ff0c57159e892f393649fff5a0199b9875', ref: el => {
1030
1036
  if (el) {
1031
1037
  this.exportRef = el;
1032
1038
  }
1033
- }, workspaceName: this.activeWorkspace?.name || 'workspace', terms: this.resolvedTerms, onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: 'feef074b52e552fa2ef7e8258002571aca4c5abd', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: '844c722545363eaf7eec69037a835eae943afeb9', user: this.user, terms: this.resolvedTerms, onClick: () => this.currentUserDialogRef?.open() }), shouldShowCurrentUser && (h("kritzel-current-user-dialog", { key: '8363c1d3230d111cf1ace0ccf805669e592bb533', ref: el => {
1039
+ }, workspaceName: this.activeWorkspace?.name || 'workspace', terms: this.resolvedTerms, onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '4bde72a3369f8bc1b61a8c765c7a9f95204316d6', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: 'f03fd82e0adbd13746197e2f850cd378657aa2de', user: this.user, terms: this.resolvedTerms, onClick: () => this.currentUserDialogRef?.open() }), shouldShowCurrentUser && (h("kritzel-current-user-dialog", { key: '6b9e5ad046b65f874b0dc11e65264f998f8ce97c', ref: el => {
1034
1040
  if (el) {
1035
1041
  this.currentUserDialogRef = el;
1036
1042
  this.currentUserDialogRef.addEventListener('logoutRequest', this.handleCurrentUserLogout);
1037
1043
  }
1038
- }, user: this.user, terms: this.resolvedTerms })), shouldShowLoginButton && (h("kritzel-button", { key: '68ddf8c3aabc7634b4c1d88f3d2d584fa1f1b150', onButtonClick: () => this.loginDialogRef?.open() }, this.resolvedTerms['login.dialogTitle'] ?? 'Sign in')), h("kritzel-more-menu", { key: '39b938f5792f7a36bbf21ed88a1a5c7717a785a6', items: this.moreMenuItems, visible: this.isMoreMenuVisible, terms: this.resolvedTerms }), h("kritzel-share-dialog", { key: '61ed918499760d874d5d2ec140d3cf59ce94520b', ref: el => {
1044
+ }, user: this.user, terms: this.resolvedTerms })), shouldShowLoginButton && (h("kritzel-button", { key: '41adb50a6e861c57621d0ac65cbf5c8c152c096d', onButtonClick: () => this.loginDialogRef?.open() }, this.resolvedTerms['login.dialogTitle'] ?? 'Sign in')), h("kritzel-more-menu", { key: 'cc62a0b8a6af7d54637783f4138b7f5283e0ff58', items: this.moreMenuItems, visible: this.isMoreMenuVisible, terms: this.resolvedTerms }), h("kritzel-share-dialog", { key: '4239378411242077f1c44500e17cf9118842f44e', ref: el => {
1039
1045
  if (el) {
1040
1046
  this.shareDialogRef = el;
1041
1047
  }
1042
- }, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, terms: this.resolvedTerms, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '5f6528a57884bd1494e45755609e710f69041a4d', ref: el => {
1048
+ }, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, terms: this.resolvedTerms, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: 'c68ce90d2cc0dc96eeafd36355b91e19f921d8f7', ref: el => {
1043
1049
  if (el) {
1044
1050
  this.loginDialogRef = el;
1045
1051
  }
@@ -3722,6 +3728,40 @@ export class KritzelEditor {
3722
3728
  "tags": []
3723
3729
  }
3724
3730
  },
3731
+ "beginSceneBootstrap": {
3732
+ "complexType": {
3733
+ "signature": "() => Promise<void>",
3734
+ "parameters": [],
3735
+ "references": {
3736
+ "Promise": {
3737
+ "location": "global",
3738
+ "id": "global::Promise"
3739
+ }
3740
+ },
3741
+ "return": "Promise<void>"
3742
+ },
3743
+ "docs": {
3744
+ "text": "",
3745
+ "tags": []
3746
+ }
3747
+ },
3748
+ "endSceneBootstrap": {
3749
+ "complexType": {
3750
+ "signature": "() => Promise<void>",
3751
+ "parameters": [],
3752
+ "references": {
3753
+ "Promise": {
3754
+ "location": "global",
3755
+ "id": "global::Promise"
3756
+ }
3757
+ },
3758
+ "return": "Promise<void>"
3759
+ },
3760
+ "docs": {
3761
+ "text": "",
3762
+ "tags": []
3763
+ }
3764
+ },
3725
3765
  "getDisplayableShortcuts": {
3726
3766
  "complexType": {
3727
3767
  "signature": "() => Promise<Omit<KritzelShortcut, \"action\" | \"condition\">[]>",
@@ -264,6 +264,31 @@ export class KritzelEngine {
264
264
  async triggerSelectionChange() {
265
265
  this.objectsSelectionChange.emit();
266
266
  }
267
+ /** Starts a scene bootstrap phase by hiding the scene immediately. */
268
+ async beginSceneBootstrap() {
269
+ if (this._sceneBootstrapTransitionTimer !== null) {
270
+ clearTimeout(this._sceneBootstrapTransitionTimer);
271
+ this._sceneBootstrapTransitionTimer = null;
272
+ }
273
+ this._sceneBootstrapTransitionEnabled = false;
274
+ this._sceneBootstrapOpacity = 0;
275
+ this.core.rerender();
276
+ }
277
+ /** Ends a scene bootstrap phase by fading the scene back in. */
278
+ async endSceneBootstrap() {
279
+ if (this._sceneBootstrapTransitionTimer !== null) {
280
+ clearTimeout(this._sceneBootstrapTransitionTimer);
281
+ this._sceneBootstrapTransitionTimer = null;
282
+ }
283
+ this._sceneBootstrapTransitionEnabled = true;
284
+ this._sceneBootstrapOpacity = 1;
285
+ this.core.rerender();
286
+ this._sceneBootstrapTransitionTimer = setTimeout(() => {
287
+ this._sceneBootstrapTransitionEnabled = false;
288
+ this._sceneBootstrapTransitionTimer = null;
289
+ this.core.rerender();
290
+ }, 220);
291
+ }
267
292
  handleWheel(ev) {
268
293
  if (this.core.store.isDisabled) {
269
294
  return;
@@ -1439,14 +1464,26 @@ export class KritzelEngine {
1439
1464
  // Revive and add objects to the current workspace
1440
1465
  if (data.objects && Array.isArray(data.objects)) {
1441
1466
  const reviver = new KritzelReviver(this.core);
1442
- for (const objData of data.objects) {
1443
- const revivedObj = reviver.revive(objData);
1444
- if (revivedObj) {
1467
+ const objectsMap = this.core.store.objects;
1468
+ const insertRevivedObjects = () => {
1469
+ for (const objData of data.objects) {
1470
+ const revivedObj = reviver.revive(objData);
1471
+ if (!revivedObj) {
1472
+ continue;
1473
+ }
1445
1474
  // Update workspaceId to the current workspace's ID
1446
1475
  revivedObj.workspaceId = currentWorkspaceId;
1447
1476
  this.core.addObject(revivedObj);
1448
1477
  loadedCount++;
1449
1478
  }
1479
+ };
1480
+ if (objectsMap) {
1481
+ objectsMap.transaction(() => {
1482
+ insertRevivedObjects();
1483
+ });
1484
+ }
1485
+ else {
1486
+ insertRevivedObjects();
1450
1487
  }
1451
1488
  }
1452
1489
  // Rerender to apply changes
@@ -1808,6 +1845,9 @@ export class KritzelEngine {
1808
1845
  _hasLoggedUnlicensedWelcomeBanner = false;
1809
1846
  _previousVisibleCustomElements = new Set();
1810
1847
  _revealedImageKeys = new Set();
1848
+ _sceneBootstrapOpacity = 1;
1849
+ _sceneBootstrapTransitionEnabled = false;
1850
+ _sceneBootstrapTransitionTimer = null;
1811
1851
  _defaultUndoState = {
1812
1852
  canUndo: false,
1813
1853
  canRedo: false,
@@ -1901,6 +1941,10 @@ export class KritzelEngine {
1901
1941
  disconnectedCallback() {
1902
1942
  this.throttledPointerMoveMulti.cancel();
1903
1943
  this._revealedImageKeys.clear();
1944
+ if (this._sceneBootstrapTransitionTimer !== null) {
1945
+ clearTimeout(this._sceneBootstrapTransitionTimer);
1946
+ this._sceneBootstrapTransitionTimer = null;
1947
+ }
1904
1948
  // Unmount all remaining custom elements
1905
1949
  if (this.core.store.allObjects) {
1906
1950
  this.core.store.allObjects.forEach(object => {
@@ -2349,6 +2393,9 @@ export class KritzelEngine {
2349
2393
  }
2350
2394
  return (h(Host, null, h("kritzel-loading-overlay", { visible: this.core.store.state.isLoading, text: this.core.localizationManager.translate('engine.loading') }), h("kritzel-sync-indicator", { visible: this.isSyncing, text: "Syncing..." }), this.core.store.state.debugInfo.showViewportInfo && (h("div", { class: "debug-panel" }, h("div", null, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", null, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", null, "TranslateX: ", this.core.store.state?.translateX), h("div", null, "TranslateY: ", this.core.store.state?.translateY), h("div", null, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", null, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", null, "PointerCount: ", this.core.store.state.pointers.size), h("div", null, "Scale: ", this.core.store.state?.scale), h("div", null, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", null, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", null, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", null, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", null, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", null, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", null, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", null, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), h("div", null, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", null, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", null, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), h("div", null, "PointerX: ", this.core.store.state?.pointerX), h("div", null, "PointerY: ", this.core.store.state?.pointerY), h("div", null, "TotalObjects: ", this.core.store.totalObjectCount), h("div", null, "ObjectsInViewport: ", this.core.store.objectsInViewport.length), h("div", null, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), h("div", null, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), h("div", { id: "origin", class: "origin", style: {
2351
2395
  transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
2396
+ opacity: this._sceneBootstrapOpacity.toString(),
2397
+ transition: this._sceneBootstrapTransitionEnabled ? 'opacity 220ms ease-out' : 'none',
2398
+ willChange: this._sceneBootstrapTransitionEnabled ? 'opacity' : undefined,
2352
2399
  } }, visibleObjects?.map(object => {
2353
2400
  const { multiplied: effectiveOpacity, overridden: effectiveOpacityString } = this.getObjectEffectiveOpacity(object, viewportScale);
2354
2401
  return (h("div", { key: object.id, id: object.id, class: "object", style: {
@@ -3783,6 +3830,40 @@ export class KritzelEngine {
3783
3830
  "tags": []
3784
3831
  }
3785
3832
  },
3833
+ "beginSceneBootstrap": {
3834
+ "complexType": {
3835
+ "signature": "() => Promise<void>",
3836
+ "parameters": [],
3837
+ "references": {
3838
+ "Promise": {
3839
+ "location": "global",
3840
+ "id": "global::Promise"
3841
+ }
3842
+ },
3843
+ "return": "Promise<void>"
3844
+ },
3845
+ "docs": {
3846
+ "text": "Starts a scene bootstrap phase by hiding the scene immediately.",
3847
+ "tags": []
3848
+ }
3849
+ },
3850
+ "endSceneBootstrap": {
3851
+ "complexType": {
3852
+ "signature": "() => Promise<void>",
3853
+ "parameters": [],
3854
+ "references": {
3855
+ "Promise": {
3856
+ "location": "global",
3857
+ "id": "global::Promise"
3858
+ }
3859
+ },
3860
+ "return": "Promise<void>"
3861
+ },
3862
+ "docs": {
3863
+ "text": "Ends a scene bootstrap phase by fading the scene back in.",
3864
+ "tags": []
3865
+ }
3866
+ },
3786
3867
  "registerTool": {
3787
3868
  "complexType": {
3788
3869
  "signature": "(toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig | KritzelLineToolConfig | KritzelShapeToolConfig) => Promise<KritzelBaseTool | null>",
@@ -3,4 +3,4 @@
3
3
  * This file is auto-generated by the version bump scripts.
4
4
  * Do not modify manually.
5
5
  */
6
- export const KRITZEL_VERSION = '0.4.5';
6
+ export const KRITZEL_VERSION = '0.4.6';
@@ -1,6 +1,6 @@
1
1
  export { g as getAssetPath, r as render, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-B43upypT.js';
2
2
  export { K as KritzelBaseObject, b as KritzelLine, a as KritzelPath } from './p-Ka7OWbnk.js';
3
- export { u as APP_STATE_MIGRATIONS, A as AssetNotFoundError, D as DE_LOCALE, E as EN_LOCALE, F as FR_LOCALE, I as IndexedDBAssetProvider, s as KritzelAlignment, o as KritzelAnchorManager, n as KritzelAssetResolver, e as KritzelBaseTool, f as KritzelBrushTool, l as KritzelCursorHelper, d as KritzelCustomElement, r as KritzelCustomElementRendererRegistry, h as KritzelEraserTool, b as KritzelGroup, a as KritzelImage, i as KritzelImageTool, q as KritzelLicenseManager, g as KritzelLineTool, p as KritzelLocalizationManager, m as KritzelSelectionTool, c as KritzelShape, k as KritzelShapeTool, K as KritzelText, j as KritzelTextTool, S as ShapeType, W as WORKSPACE_MIGRATIONS, t as runMigrations } from './p--Oazz-BP.js';
3
+ export { u as APP_STATE_MIGRATIONS, A as AssetNotFoundError, D as DE_LOCALE, E as EN_LOCALE, F as FR_LOCALE, I as IndexedDBAssetProvider, s as KritzelAlignment, o as KritzelAnchorManager, n as KritzelAssetResolver, e as KritzelBaseTool, f as KritzelBrushTool, l as KritzelCursorHelper, d as KritzelCustomElement, r as KritzelCustomElementRendererRegistry, h as KritzelEraserTool, b as KritzelGroup, a as KritzelImage, i as KritzelImageTool, q as KritzelLicenseManager, g as KritzelLineTool, p as KritzelLocalizationManager, m as KritzelSelectionTool, c as KritzelShape, k as KritzelShapeTool, K as KritzelText, j as KritzelTextTool, S as ShapeType, W as WORKSPACE_MIGRATIONS, t as runMigrations } from './p-BBmP8lVY.js';
4
4
  import * as Y from 'yjs';
5
5
  import { IndexeddbPersistence } from 'y-indexeddb';
6
6
  import { WebsocketProvider } from 'y-websocket';
@@ -1,6 +1,6 @@
1
1
  import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
2
2
  import { K as KritzelIconRegistry, d as defineCustomElement$s } from './p-CdR76C4L.js';
3
- import { v as DEFAULT_STROKE_SIZES, w as DEFAULT_FONT_SIZES, S as ShapeType, m as KritzelSelectionTool, f as KritzelBrushTool, h as KritzelEraserTool, g as KritzelLineTool, k as KritzelShapeTool, j as KritzelTextTool, i as KritzelImageTool, s as KritzelAlignment, x as DEFAULT_SYNC_CONFIG, y as KritzelSelectionGroup, z as KritzelSelectionBox, B as KritzelKeyboardHelper, C as defineCustomElement$x } from './p--Oazz-BP.js';
3
+ import { v as DEFAULT_STROKE_SIZES, w as DEFAULT_FONT_SIZES, S as ShapeType, m as KritzelSelectionTool, f as KritzelBrushTool, h as KritzelEraserTool, g as KritzelLineTool, k as KritzelShapeTool, j as KritzelTextTool, i as KritzelImageTool, s as KritzelAlignment, x as DEFAULT_SYNC_CONFIG, y as KritzelSelectionGroup, z as KritzelSelectionBox, B as KritzelKeyboardHelper, C as defineCustomElement$x } from './p-BBmP8lVY.js';
4
4
  import { D as DEFAULT_COLOR_PALETTE, T as ThemeHelper, d as darkTheme, l as lightTheme } from './p-BmyTdQGy.js';
5
5
  import { D as DEFAULT_TEXT_TOOL_AVAILABLE_FONTS, r as resolveTextToolAvailableFonts, K as KritzelFontRegistry } from './p-DJkKlUyZ.js';
6
6
  import { A as ABSOLUTE_SCALE_MAX, a as ABSOLUTE_SCALE_MIN, d as defineCustomElement$4 } from './p-PSFAfAyd.js';
@@ -39,7 +39,7 @@ import { d as defineCustomElement$i } from './p-BDzlx2hB.js';
39
39
  import { d as defineCustomElement$h } from './p-B6t5q-V4.js';
40
40
  import { d as defineCustomElement$g } from './p-D09kgc5Q.js';
41
41
  import { d as defineCustomElement$f } from './p-Ca-igU1f.js';
42
- import { d as defineCustomElement$e } from './p-U6uE85Qx.js';
42
+ import { d as defineCustomElement$e } from './p-Ch42cOeY.js';
43
43
  import { d as defineCustomElement$d } from './p-BFYtCsZu.js';
44
44
  import { d as defineCustomElement$c } from './p-DUYmwrWV.js';
45
45
  import { d as defineCustomElement$b } from './p-CWRSGYOE.js';
@@ -3440,6 +3440,12 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
3440
3440
  async triggerSelectionChange() {
3441
3441
  return this.engineRef.triggerSelectionChange();
3442
3442
  }
3443
+ async beginSceneBootstrap() {
3444
+ return this.engineRef.beginSceneBootstrap();
3445
+ }
3446
+ async endSceneBootstrap() {
3447
+ return this.engineRef.endSceneBootstrap();
3448
+ }
3443
3449
  async getDisplayableShortcuts() {
3444
3450
  return this.engineRef.getDisplayableShortcuts();
3445
3451
  }
@@ -3919,36 +3925,36 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
3919
3925
  const isLoggedIn = this.isLoggedIn;
3920
3926
  const shouldShowCurrentUser = isLoggedIn;
3921
3927
  const shouldShowLoginButton = this.isReady && !!this.loginConfig && !isLoggedIn;
3922
- return (h(Host, { key: '00d652c74feac7b4917772146368125da6deeb1c' }, h("div", { key: 'f8fb86b45b0cdabb5e3ad52de6d6ef31a71a09e4', class: "editor-content", style: {
3928
+ return (h(Host, { key: '0fea11ea16e8baca0a7ecbd22c8025b47d451ac0' }, h("div", { key: 'd2ed05c8a6ecbe5b3cc4fc8bc12affefc1c15976', class: "editor-content", style: {
3923
3929
  opacity: this.isEditorVisible ? '1' : '0',
3924
3930
  visibility: this.isEditorVisible ? 'visible' : 'hidden',
3925
3931
  transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out',
3926
- } }, h("div", { key: '2378c776d8eecf2614567bed11c6e93fb338e302', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'ce41192540169694482d6f8cca60701bc4427438', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, terms: this.resolvedTerms, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'ec269d3e9f589362d8301370778f0c5e4252eead', visible: this.isBackToContentButtonVisible, text: this.resolvedTerms['backToContent.label'] ?? 'Back to content', onBackToContent: () => this.backToContent() })), this.activeNotification && (h("div", { key: '847ed8149d556c934090424ff54b17b6721ccc76', class: "top-center-notification-layer", role: "presentation" }, h("div", { key: '61d8b8e91cda100ffa6620db26ba6dfb2232946a', class: { 'top-center-notification-container': true, 'is-dismissing': this.isNotificationDismissing }, role: "presentation" }, h("kritzel-notification-card", { key: 'b7e132773225ace38e447756110dd39e4661f5fc', notification: this.activeNotification, locale: this.locale, onDismiss: this.dismissNotification, onHoverChange: event => this.handleNotificationHoverChange(event) })))), h("kritzel-engine", { key: '3e4a6d0dbc015ec675fb21a59990c87e9eaa805f', ref: el => {
3932
+ } }, h("div", { key: '3dfab068157d0091834c80d901262228b4f63546', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'e70f2a26a371a13c771d2b45f12fbd7f41fa7f9a', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, terms: this.resolvedTerms, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'f0e4851612bac461d97d16c0f23aeefbd1a220e4', visible: this.isBackToContentButtonVisible, text: this.resolvedTerms['backToContent.label'] ?? 'Back to content', onBackToContent: () => this.backToContent() })), this.activeNotification && (h("div", { key: '633dcabf1875a0af0399807f111d19e8e1d2781e', class: "top-center-notification-layer", role: "presentation" }, h("div", { key: '67336263f6de75f03116d751157b78b8f42649c8', class: { 'top-center-notification-container': true, 'is-dismissing': this.isNotificationDismissing }, role: "presentation" }, h("kritzel-notification-card", { key: 'b0316aa4e37283d1de8a969c07523c28408ce474', notification: this.activeNotification, locale: this.locale, onDismiss: this.dismissNotification, onHoverChange: event => this.handleNotificationHoverChange(event) })))), h("kritzel-engine", { key: '6e9c047b04221332ffb5a50970d8f37592db4b5d', ref: el => {
3927
3933
  if (el) {
3928
3934
  this.engineRef = el;
3929
3935
  }
3930
- }, 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, isPanningEnabled: this.isPanningEnabled, isZoomingEnabled: this.isZoomingEnabled, theme: this.theme, themes: this.themes, licenseKey: this.licenseKey, locale: this.locale, locales: this.locales, fallbackLocale: this.fallbackLocale, 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), onNotificationsChange: event => this.handleNotificationsChange(event) }), h("kritzel-controls", { key: 'f84607a0a4d0762c1249400f85b7b8454d672c1e', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
3936
+ }, 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, isPanningEnabled: this.isPanningEnabled, isZoomingEnabled: this.isZoomingEnabled, theme: this.theme, themes: this.themes, licenseKey: this.licenseKey, locale: this.locale, locales: this.locales, fallbackLocale: this.fallbackLocale, 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), onNotificationsChange: event => this.handleNotificationsChange(event) }), h("kritzel-controls", { key: 'a664a3b51842238e092835ba6e68b63409829dba', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
3931
3937
  if (el) {
3932
3938
  this.controlsRef = el;
3933
3939
  }
3934
- }, controls: this.normalizedControls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, terms: this.resolvedTerms, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: 'e2691e7c730195e197511cb1e4d0fe707677b5ff', class: "bottom-left-buttons" }, h("kritzel-zoom-panel", { key: 'd0ac6624eab49af78d4761c3ad91842834717aad', visible: this.isZoomPanelVisible, disabled: !this.isZoomingEnabled, zoomPercent: this.currentZoomPercent, terms: this.resolvedTerms, onZoomIn: () => this.zoomIn(), onZoomOut: () => this.zoomOut() })), h("div", { key: 'ad3d386ab7e8ad9fdfbb12754db005bc85fa28ce', class: "top-right-buttons" }, h("kritzel-settings", { key: '566024ac6f3d8f7f20238cc1f83882b39dbf698e', ref: el => {
3940
+ }, controls: this.normalizedControls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, terms: this.resolvedTerms, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '7da601af2f3e5be020b2dacac9ed377660488005', class: "bottom-left-buttons" }, h("kritzel-zoom-panel", { key: 'e764e09ab790810620527618e40c298495c56b72', visible: this.isZoomPanelVisible, disabled: !this.isZoomingEnabled, zoomPercent: this.currentZoomPercent, terms: this.resolvedTerms, onZoomIn: () => this.zoomIn(), onZoomOut: () => this.zoomOut() })), h("div", { key: 'c846bd187a9c3d4e4c9034a605ea77500a815cd2', class: "top-right-buttons" }, h("kritzel-settings", { key: '1b0d3c6acda30f6222dcf13f131d4cad87ced86b', ref: el => {
3935
3941
  if (el) {
3936
3942
  this.settingsRef = el;
3937
3943
  }
3938
- }, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], availableLocales: this.availableLocaleOptions, settings: this.currentSettingsConfig, terms: this.resolvedTerms, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '4a23ea0c6e070d424a90e9fc87de04e11cff7ade', ref: el => {
3944
+ }, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], availableLocales: this.availableLocaleOptions, settings: this.currentSettingsConfig, terms: this.resolvedTerms, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '7a81c4ff0c57159e892f393649fff5a0199b9875', ref: el => {
3939
3945
  if (el) {
3940
3946
  this.exportRef = el;
3941
3947
  }
3942
- }, workspaceName: this.activeWorkspace?.name || 'workspace', terms: this.resolvedTerms, onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: 'feef074b52e552fa2ef7e8258002571aca4c5abd', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: '844c722545363eaf7eec69037a835eae943afeb9', user: this.user, terms: this.resolvedTerms, onClick: () => this.currentUserDialogRef?.open() }), shouldShowCurrentUser && (h("kritzel-current-user-dialog", { key: '8363c1d3230d111cf1ace0ccf805669e592bb533', ref: el => {
3948
+ }, workspaceName: this.activeWorkspace?.name || 'workspace', terms: this.resolvedTerms, onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '4bde72a3369f8bc1b61a8c765c7a9f95204316d6', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: 'f03fd82e0adbd13746197e2f850cd378657aa2de', user: this.user, terms: this.resolvedTerms, onClick: () => this.currentUserDialogRef?.open() }), shouldShowCurrentUser && (h("kritzel-current-user-dialog", { key: '6b9e5ad046b65f874b0dc11e65264f998f8ce97c', ref: el => {
3943
3949
  if (el) {
3944
3950
  this.currentUserDialogRef = el;
3945
3951
  this.currentUserDialogRef.addEventListener('logoutRequest', this.handleCurrentUserLogout);
3946
3952
  }
3947
- }, user: this.user, terms: this.resolvedTerms })), shouldShowLoginButton && (h("kritzel-button", { key: '68ddf8c3aabc7634b4c1d88f3d2d584fa1f1b150', onButtonClick: () => this.loginDialogRef?.open() }, this.resolvedTerms['login.dialogTitle'] ?? 'Sign in')), h("kritzel-more-menu", { key: '39b938f5792f7a36bbf21ed88a1a5c7717a785a6', items: this.moreMenuItems, visible: this.isMoreMenuVisible, terms: this.resolvedTerms }), h("kritzel-share-dialog", { key: '61ed918499760d874d5d2ec140d3cf59ce94520b', ref: el => {
3953
+ }, user: this.user, terms: this.resolvedTerms })), shouldShowLoginButton && (h("kritzel-button", { key: '41adb50a6e861c57621d0ac65cbf5c8c152c096d', onButtonClick: () => this.loginDialogRef?.open() }, this.resolvedTerms['login.dialogTitle'] ?? 'Sign in')), h("kritzel-more-menu", { key: 'cc62a0b8a6af7d54637783f4138b7f5283e0ff58', items: this.moreMenuItems, visible: this.isMoreMenuVisible, terms: this.resolvedTerms }), h("kritzel-share-dialog", { key: '4239378411242077f1c44500e17cf9118842f44e', ref: el => {
3948
3954
  if (el) {
3949
3955
  this.shareDialogRef = el;
3950
3956
  }
3951
- }, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, terms: this.resolvedTerms, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '5f6528a57884bd1494e45755609e710f69041a4d', ref: el => {
3957
+ }, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, terms: this.resolvedTerms, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: 'c68ce90d2cc0dc96eeafd36355b91e19f921d8f7', ref: el => {
3952
3958
  if (el) {
3953
3959
  this.loginDialogRef = el;
3954
3960
  }
@@ -4104,6 +4110,8 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
4104
4110
  "hideContextMenu": [64],
4105
4111
  "openContextMenu": [64],
4106
4112
  "triggerSelectionChange": [64],
4113
+ "beginSceneBootstrap": [64],
4114
+ "endSceneBootstrap": [64],
4107
4115
  "getDisplayableShortcuts": [64],
4108
4116
  "triggerNotification": [64],
4109
4117
  "openLoginDialog": [64],
@@ -1,4 +1,4 @@
1
- import { G as KritzelEngine$1, C as defineCustomElement$1 } from './p--Oazz-BP.js';
1
+ import { G as KritzelEngine$1, C as defineCustomElement$1 } from './p-BBmP8lVY.js';
2
2
 
3
3
  const KritzelEngine = KritzelEngine$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { K as KritzelSettings$1, d as defineCustomElement$1 } from './p-U6uE85Qx.js';
1
+ import { K as KritzelSettings$1, d as defineCustomElement$1 } from './p-Ch42cOeY.js';
2
2
 
3
3
  const KritzelSettings = KritzelSettings$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -42165,6 +42165,18 @@ class KritzelViewport {
42165
42165
  animateViewportTo(targetTranslateX, targetTranslateY, targetScale, duration = 150) {
42166
42166
  // Cancel any existing animation
42167
42167
  this.cancelViewportAnimation();
42168
+ if (duration <= 0) {
42169
+ // Apply immediately; interpolating with duration 0 divides by zero
42170
+ // (rAF timestamps can precede performance.now()), producing NaN state.
42171
+ this._core.store.state.scale = targetScale;
42172
+ const clamped = this.clampTranslate(targetTranslateX, targetTranslateY);
42173
+ this._core.store.state.translateX = clamped.translateX;
42174
+ this._core.store.state.translateY = clamped.translateY;
42175
+ this._core.store.state.hasViewportChanged = true;
42176
+ this._core.rerender();
42177
+ this._debounceUpdate();
42178
+ return;
42179
+ }
42168
42180
  const startTranslateX = this._core.store.state.translateX;
42169
42181
  const startTranslateY = this._core.store.state.translateY;
42170
42182
  const startScale = this._core.store.state.scale;
@@ -42172,7 +42184,8 @@ class KritzelViewport {
42172
42184
  this._core.store.state.isScaling = true;
42173
42185
  const animate = (currentTime) => {
42174
42186
  const elapsed = currentTime - startTime;
42175
- const progress = Math.min(elapsed / duration, 1);
42187
+ // Clamp to [0, 1]; rAF timestamps can precede startTime, yielding negative progress
42188
+ const progress = Math.min(Math.max(elapsed, 0) / duration, 1);
42176
42189
  // easeOutCubic easing function
42177
42190
  const eased = 1 - Math.pow(1 - progress, 3);
42178
42191
  this._core.store.state.scale = startScale + (targetScale - startScale) * eased;
@@ -48807,6 +48820,31 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
48807
48820
  async triggerSelectionChange() {
48808
48821
  this.objectsSelectionChange.emit();
48809
48822
  }
48823
+ /** Starts a scene bootstrap phase by hiding the scene immediately. */
48824
+ async beginSceneBootstrap() {
48825
+ if (this._sceneBootstrapTransitionTimer !== null) {
48826
+ clearTimeout(this._sceneBootstrapTransitionTimer);
48827
+ this._sceneBootstrapTransitionTimer = null;
48828
+ }
48829
+ this._sceneBootstrapTransitionEnabled = false;
48830
+ this._sceneBootstrapOpacity = 0;
48831
+ this.core.rerender();
48832
+ }
48833
+ /** Ends a scene bootstrap phase by fading the scene back in. */
48834
+ async endSceneBootstrap() {
48835
+ if (this._sceneBootstrapTransitionTimer !== null) {
48836
+ clearTimeout(this._sceneBootstrapTransitionTimer);
48837
+ this._sceneBootstrapTransitionTimer = null;
48838
+ }
48839
+ this._sceneBootstrapTransitionEnabled = true;
48840
+ this._sceneBootstrapOpacity = 1;
48841
+ this.core.rerender();
48842
+ this._sceneBootstrapTransitionTimer = setTimeout(() => {
48843
+ this._sceneBootstrapTransitionEnabled = false;
48844
+ this._sceneBootstrapTransitionTimer = null;
48845
+ this.core.rerender();
48846
+ }, 220);
48847
+ }
48810
48848
  handleWheel(ev) {
48811
48849
  if (this.core.store.isDisabled) {
48812
48850
  return;
@@ -49982,14 +50020,26 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
49982
50020
  // Revive and add objects to the current workspace
49983
50021
  if (data.objects && Array.isArray(data.objects)) {
49984
50022
  const reviver = new KritzelReviver(this.core);
49985
- for (const objData of data.objects) {
49986
- const revivedObj = reviver.revive(objData);
49987
- if (revivedObj) {
50023
+ const objectsMap = this.core.store.objects;
50024
+ const insertRevivedObjects = () => {
50025
+ for (const objData of data.objects) {
50026
+ const revivedObj = reviver.revive(objData);
50027
+ if (!revivedObj) {
50028
+ continue;
50029
+ }
49988
50030
  // Update workspaceId to the current workspace's ID
49989
50031
  revivedObj.workspaceId = currentWorkspaceId;
49990
50032
  this.core.addObject(revivedObj);
49991
50033
  loadedCount++;
49992
50034
  }
50035
+ };
50036
+ if (objectsMap) {
50037
+ objectsMap.transaction(() => {
50038
+ insertRevivedObjects();
50039
+ });
50040
+ }
50041
+ else {
50042
+ insertRevivedObjects();
49993
50043
  }
49994
50044
  }
49995
50045
  // Rerender to apply changes
@@ -50351,6 +50401,9 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50351
50401
  _hasLoggedUnlicensedWelcomeBanner = false;
50352
50402
  _previousVisibleCustomElements = new Set();
50353
50403
  _revealedImageKeys = new Set();
50404
+ _sceneBootstrapOpacity = 1;
50405
+ _sceneBootstrapTransitionEnabled = false;
50406
+ _sceneBootstrapTransitionTimer = null;
50354
50407
  _defaultUndoState = {
50355
50408
  canUndo: false,
50356
50409
  canRedo: false,
@@ -50466,6 +50519,10 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50466
50519
  disconnectedCallback() {
50467
50520
  this.throttledPointerMoveMulti.cancel();
50468
50521
  this._revealedImageKeys.clear();
50522
+ if (this._sceneBootstrapTransitionTimer !== null) {
50523
+ clearTimeout(this._sceneBootstrapTransitionTimer);
50524
+ this._sceneBootstrapTransitionTimer = null;
50525
+ }
50469
50526
  // Unmount all remaining custom elements
50470
50527
  if (this.core.store.allObjects) {
50471
50528
  this.core.store.allObjects.forEach(object => {
@@ -50914,6 +50971,9 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50914
50971
  }
50915
50972
  return (h(Host, null, h("kritzel-loading-overlay", { visible: this.core.store.state.isLoading, text: this.core.localizationManager.translate('engine.loading') }), h("kritzel-sync-indicator", { visible: this.isSyncing, text: "Syncing..." }), this.core.store.state.debugInfo.showViewportInfo && (h("div", { class: "debug-panel" }, h("div", null, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", null, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", null, "TranslateX: ", this.core.store.state?.translateX), h("div", null, "TranslateY: ", this.core.store.state?.translateY), h("div", null, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", null, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", null, "PointerCount: ", this.core.store.state.pointers.size), h("div", null, "Scale: ", this.core.store.state?.scale), h("div", null, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", null, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", null, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", null, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", null, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", null, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", null, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", null, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", null, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), h("div", null, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", null, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", null, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), h("div", null, "PointerX: ", this.core.store.state?.pointerX), h("div", null, "PointerY: ", this.core.store.state?.pointerY), h("div", null, "TotalObjects: ", this.core.store.totalObjectCount), h("div", null, "ObjectsInViewport: ", this.core.store.objectsInViewport.length), h("div", null, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), h("div", null, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), h("div", { id: "origin", class: "origin", style: {
50916
50973
  transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
50974
+ opacity: this._sceneBootstrapOpacity.toString(),
50975
+ transition: this._sceneBootstrapTransitionEnabled ? 'opacity 220ms ease-out' : 'none',
50976
+ willChange: this._sceneBootstrapTransitionEnabled ? 'opacity' : undefined,
50917
50977
  } }, visibleObjects?.map(object => {
50918
50978
  const { multiplied: effectiveOpacity, overridden: effectiveOpacityString } = this.getObjectEffectiveOpacity(object, viewportScale);
50919
50979
  return (h("div", { key: object.id, id: object.id, class: "object", style: {
@@ -51461,6 +51521,8 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
51461
51521
  "forceUpdate": [32],
51462
51522
  "isSyncing": [32],
51463
51523
  "triggerSelectionChange": [64],
51524
+ "beginSceneBootstrap": [64],
51525
+ "endSceneBootstrap": [64],
51464
51526
  "registerTool": [64],
51465
51527
  "changeActiveTool": [64],
51466
51528
  "changeActiveToolByName": [64],
@@ -12,7 +12,7 @@ import { d as defineCustomElement$1 } from './p-CWRSGYOE.js';
12
12
  * This file is auto-generated by the version bump scripts.
13
13
  * Do not modify manually.
14
14
  */
15
- const KRITZEL_VERSION = '0.4.5';
15
+ const KRITZEL_VERSION = '0.4.6';
16
16
 
17
17
  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)}`;
18
18