kritzel-stencil 0.4.26 → 0.4.27

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.
Files changed (33) hide show
  1. package/dist/cjs/index.cjs.js +3 -42
  2. package/dist/cjs/kritzel-active-users_46.cjs.entry.js +75 -47
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{schema.constants-CjN-B633.js → schema.constants-CcvqL5nJ.js} +41 -0
  5. package/dist/cjs/stencil.cjs.js +1 -1
  6. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +4 -4
  7. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +57 -53
  8. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +16 -52
  9. package/dist/collection/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.css +13 -9
  10. package/dist/collection/configs/default-sync.config.js +2 -1
  11. package/dist/collection/constants/version.js +1 -1
  12. package/dist/components/index.js +2 -42
  13. package/dist/components/kritzel-editor.js +60 -18
  14. package/dist/components/kritzel-engine.js +1 -1
  15. package/dist/components/kritzel-loading-overlay.js +1 -1
  16. package/dist/components/kritzel-settings.js +1 -1
  17. package/dist/components/{p-Cva3jIIU.js → p-4uoSa0Xl.js} +1 -1
  18. package/dist/components/{p-m7SeNszM.js → p-BTo2cQZ9.js} +1 -1
  19. package/dist/components/{p-DUoQyGKc.js → p-CYwoBiqy.js} +56 -36
  20. package/dist/esm/index.js +4 -43
  21. package/dist/esm/kritzel-active-users_46.entry.js +75 -47
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/{schema.constants-DfvqHmxc.js → schema.constants-De_S50eB.js} +41 -1
  24. package/dist/esm/stencil.js +1 -1
  25. package/dist/stencil/index.esm.js +4 -43
  26. package/dist/stencil/{p-DfvqHmxc.js → p-De_S50eB.js} +41 -1
  27. package/dist/stencil/{p-5c045d3e.entry.js → p-f91efb01.entry.js} +75 -47
  28. package/dist/stencil/stencil.esm.js +1 -1
  29. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +8 -3
  30. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +3 -7
  31. package/dist/types/components.d.ts +5 -36
  32. package/dist/types/constants/version.d.ts +1 -1
  33. package/package.json +1 -1
@@ -1,8 +1,7 @@
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-bAacqNHq.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-DUoQyGKc.js';
3
+ export { v as APP_STATE_MIGRATIONS, A as AssetNotFoundError, D as DE_LOCALE, E as EN_LOCALE, F as FR_LOCALE, o as IndexedDBAssetProvider, I as IndexedDBSyncProvider, t as KritzelAlignment, p as KritzelAnchorManager, n as KritzelAssetResolver, e as KritzelBaseTool, f as KritzelBrushTool, l as KritzelCursorHelper, d as KritzelCustomElement, s as KritzelCustomElementRendererRegistry, h as KritzelEraserTool, b as KritzelGroup, a as KritzelImage, i as KritzelImageTool, r as KritzelLicenseManager, g as KritzelLineTool, q as KritzelLocalizationManager, m as KritzelSelectionTool, c as KritzelShape, k as KritzelShapeTool, K as KritzelText, j as KritzelTextTool, S as ShapeType, W as WORKSPACE_MIGRATIONS, u as runMigrations } from './p-CYwoBiqy.js';
4
4
  import * as Y from 'yjs';
5
- import { IndexeddbPersistence } from 'y-indexeddb';
6
5
  import { WebsocketProvider } from 'y-websocket';
7
6
  import { H as HocuspocusProvider, a as HocuspocusProviderWebsocket } from './kritzel-editor.js';
8
7
  export { d as DEFAULT_ASSET_STORAGE_CONFIG, D as DEFAULT_BRUSH_CONFIG, c as DEFAULT_LINE_TOOL_CONFIG, b as DEFAULT_TEXT_CONFIG, KritzelEditor, defineCustomElement as defineCustomElementKritzelEditor, h as hasRemoteSyncProvider } from './kritzel-editor.js';
@@ -554,45 +553,6 @@ class InMemorySyncProvider {
554
553
  }
555
554
  }
556
555
 
557
- /**
558
- * IndexedDB sync provider for local persistence
559
- */
560
- class IndexedDBSyncProvider {
561
- static type = 'local';
562
- type = 'local';
563
- provider;
564
- isConnected = false;
565
- constructor(docName, doc, options) {
566
- const dbName = options?.name || docName;
567
- this.provider = new IndexeddbPersistence(dbName, doc);
568
- }
569
- async connect() {
570
- if (this.isConnected) {
571
- return;
572
- }
573
- return new Promise(resolve => {
574
- this.provider.on('synced', () => {
575
- this.isConnected = true;
576
- resolve();
577
- });
578
- });
579
- }
580
- disconnect() {
581
- // IndexedDB doesn't need explicit disconnect
582
- this.isConnected = false;
583
- }
584
- async reconnect() {
585
- this.disconnect();
586
- return this.connect();
587
- }
588
- destroy() {
589
- if (this.provider) {
590
- this.provider.destroy();
591
- }
592
- this.isConnected = false;
593
- }
594
- }
595
-
596
556
  /**
597
557
  * WebSocket sync provider for real-time collaboration
598
558
  */
@@ -1235,4 +1195,4 @@ class PresignedAssetProvider {
1235
1195
  }
1236
1196
  }
1237
1197
 
1238
- export { BroadcastSyncProvider, HocuspocusSyncProvider, HttpAssetProvider, InMemorySyncProvider, IndexedDBSyncProvider, PresignedAssetProvider, WebSocketSyncProvider };
1198
+ export { BroadcastSyncProvider, HocuspocusSyncProvider, HttpAssetProvider, InMemorySyncProvider, PresignedAssetProvider, WebSocketSyncProvider };
@@ -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$r } from './p-CSuU8frA.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$w } from './p-DUoQyGKc.js';
3
+ import { w as DEFAULT_STROKE_SIZES, x 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, t as KritzelAlignment, y as DEFAULT_SYNC_CONFIG, z as KritzelSelectionGroup, B as KritzelSelectionBox, C as KritzelKeyboardHelper, G as defineCustomElement$w } from './p-CYwoBiqy.js';
4
4
  import { D as DEFAULT_COLOR_PALETTE, T as ThemeHelper, d as darkTheme, l as lightTheme } from './p-7I4Uzjrw.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-DK0anxtL.js';
@@ -29,7 +29,7 @@ import { d as defineCustomElement$t } from './p-djJSnjAX.js';
29
29
  import { d as defineCustomElement$s } from './p-BprEDRpA.js';
30
30
  import { d as defineCustomElement$q } from './p-NOWtUeeQ.js';
31
31
  import { d as defineCustomElement$p } from './p-CXpv9Rxe.js';
32
- import { d as defineCustomElement$o } from './p-Cva3jIIU.js';
32
+ import { d as defineCustomElement$o } from './p-4uoSa0Xl.js';
33
33
  import { d as defineCustomElement$n } from './p-C0FEC_gS.js';
34
34
  import { d as defineCustomElement$m } from './p-DhabvHJM.js';
35
35
  import { d as defineCustomElement$k, a as defineCustomElement$l } from './p-CAXR5-S9.js';
@@ -39,7 +39,7 @@ import { d as defineCustomElement$h } from './p-DTB3ykgO.js';
39
39
  import { d as defineCustomElement$g } from './p-DnmVD1Mz.js';
40
40
  import { d as defineCustomElement$f } from './p-jIKskj3S.js';
41
41
  import { d as defineCustomElement$e } from './p-CBrn5AIB.js';
42
- import { d as defineCustomElement$d } from './p-m7SeNszM.js';
42
+ import { d as defineCustomElement$d } from './p-BTo2cQZ9.js';
43
43
  import { d as defineCustomElement$c } from './p-BFYtCsZu.js';
44
44
  import { d as defineCustomElement$b } from './p-ChPs27Fd.js';
45
45
  import { d as defineCustomElement$a } from './p-Dvn6ad4a.js';
@@ -2934,7 +2934,7 @@ const DEFAULT_SHAPE_CONFIG = {
2934
2934
  sizes: [...DEFAULT_STROKE_SIZES],
2935
2935
  };
2936
2936
 
2937
- const kritzelEditorCss = () => `kritzel-editor{display:flex;margin:0;position:relative;container-type:inline-size;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:start;line-height:normal}.editor-content{position:absolute;inset:0}.editor-content>kritzel-engine{position:absolute;inset:0;z-index:0}kritzel-controls{position:absolute;z-index:1;left:0;right:0;margin-inline:auto;width:max-content;max-width:calc(100% - 16px);bottom:var(--kritzel-editor-controls-bottom, 14px);transition:transform var(--kritzel-editor-controls-transition-duration, 0.1s) var(--kritzel-editor-controls-transition, ease-in-out)}kritzel-controls.keyboard-open{transform:var(--kritzel-editor-controls-transform, translateY(300%))}.top-left-buttons{position:absolute;z-index:1;top:var(--kritzel-editor-top-left-buttons-top, 14px);left:var(--kritzel-editor-top-left-buttons-left, 14px);display:flex;align-items:flex-start;gap:8px}.top-center-notification-layer{position:absolute;top:var(--kritzel-editor-top-center-notification-top, 14px);left:0;right:0;z-index:var(--kritzel-editor-top-center-notification-z-index, 10001);display:flex;justify-content:center;pointer-events:none}.top-center-notification-container{width:min(90vw, 420px);pointer-events:auto;animation:kritzel-notification-slide-in var(--kritzel-editor-notification-animation-duration, 220ms) var(--kritzel-editor-notification-animation-easing, cubic-bezier(0.22, 1, 0.36, 1))}.top-center-notification-container.is-dismissing{animation:kritzel-notification-fade-out var(--kritzel-editor-notification-dismiss-animation-duration, 180ms) var(--kritzel-editor-notification-dismiss-animation-easing, ease-in) forwards}@keyframes kritzel-notification-slide-in{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes kritzel-notification-fade-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-6px)}}@media (prefers-reduced-motion: reduce){.top-center-notification-container{animation:none}}.top-right-buttons{position:absolute;z-index:1;top:var(--kritzel-editor-top-right-buttons-top, 14px);right:var(--kritzel-editor-top-right-buttons-right, 14px);display:flex;align-items:center;gap:8px}.bottom-left-buttons{position:absolute;z-index:1;left:var(--kritzel-editor-top-left-buttons-left, 14px);bottom:var(--kritzel-editor-controls-bottom, 14px);display:flex;align-items:flex-end}@container (max-width: 767px){.bottom-left-buttons{display:none}}.top-right-button{display:flex;align-items:center;justify-content:center;width:50px;height:50px;padding:0;border:var(--kritzel-split-button-border, 1px solid #ebebeb);border-radius:var(--kritzel-split-button-border-radius, 12px);background-color:var(--kritzel-split-button-background-color, #ffffff);cursor:var(--kritzel-global-pointer-cursor, pointer);box-shadow:var(--kritzel-split-button-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));transition:background-color 150ms ease;-webkit-tap-highlight-color:transparent}.top-right-button:hover{background-color:#f5f5f5}.top-right-button:active{background-color:#ebebeb}`;
2937
+ const kritzelEditorCss = () => `kritzel-editor{display:flex;margin:0;position:relative;container-type:inline-size;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:start;line-height:normal}.editor-content{position:absolute;inset:0}.editor-content>kritzel-engine{position:absolute;inset:0;z-index:0}kritzel-controls{position:absolute;z-index:2;left:0;right:0;margin-inline:auto;width:max-content;max-width:calc(100% - 16px);bottom:var(--kritzel-editor-controls-bottom, 14px);transition:transform var(--kritzel-editor-controls-transition-duration, 0.1s) var(--kritzel-editor-controls-transition, ease-in-out)}kritzel-controls.keyboard-open{transform:var(--kritzel-editor-controls-transform, translateY(300%))}.top-left-buttons{position:absolute;z-index:2;top:var(--kritzel-editor-top-left-buttons-top, 14px);left:var(--kritzel-editor-top-left-buttons-left, 14px);display:flex;align-items:flex-start;gap:8px}.top-center-notification-layer{position:absolute;top:var(--kritzel-editor-top-center-notification-top, 14px);left:0;right:0;z-index:var(--kritzel-editor-top-center-notification-z-index, 10001);display:flex;justify-content:center;pointer-events:none}.top-center-notification-container{width:min(90vw, 420px);pointer-events:auto;animation:kritzel-notification-slide-in var(--kritzel-editor-notification-animation-duration, 220ms) var(--kritzel-editor-notification-animation-easing, cubic-bezier(0.22, 1, 0.36, 1))}.top-center-notification-container.is-dismissing{animation:kritzel-notification-fade-out var(--kritzel-editor-notification-dismiss-animation-duration, 180ms) var(--kritzel-editor-notification-dismiss-animation-easing, ease-in) forwards}@keyframes kritzel-notification-slide-in{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes kritzel-notification-fade-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-6px)}}@media (prefers-reduced-motion: reduce){.top-center-notification-container{animation:none}}.top-right-buttons{position:absolute;z-index:2;top:var(--kritzel-editor-top-right-buttons-top, 14px);right:var(--kritzel-editor-top-right-buttons-right, 14px);display:flex;align-items:center;gap:8px}.bottom-left-buttons{position:absolute;z-index:2;left:var(--kritzel-editor-top-left-buttons-left, 14px);bottom:var(--kritzel-editor-controls-bottom, 14px);display:flex;align-items:flex-end}@container (max-width: 767px){.bottom-left-buttons{display:none}}.top-right-button{display:flex;align-items:center;justify-content:center;width:50px;height:50px;padding:0;border:var(--kritzel-split-button-border, 1px solid #ebebeb);border-radius:var(--kritzel-split-button-border-radius, 12px);background-color:var(--kritzel-split-button-background-color, #ffffff);cursor:var(--kritzel-global-pointer-cursor, pointer);box-shadow:var(--kritzel-split-button-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));transition:background-color 150ms ease;-webkit-tap-highlight-color:transparent}.top-right-button:hover{background-color:#f5f5f5}.top-right-button:active{background-color:#ebebeb}`;
2938
2938
 
2939
2939
  const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor extends H {
2940
2940
  constructor(registerHost) {
@@ -3168,15 +3168,12 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
3168
3168
  isWorkspaceManagerVisible = true;
3169
3169
  isMoreMenuVisible = true;
3170
3170
  isZoomPanelVisible = true;
3171
- isObjectDistanceFadingActive = false;
3172
3171
  syncConfig = DEFAULT_SYNC_CONFIG;
3173
3172
  assetStorageConfig = DEFAULT_ASSET_STORAGE_CONFIG;
3174
3173
  /** The element to use as the target for the cursor. Defaults to the editor container if not set. */
3175
3174
  cursorTarget;
3176
3175
  /** Optional login configuration. When provided, a "Sign in" button is shown that opens a login dialog with the configured providers. */
3177
3176
  loginConfig;
3178
- /** Whether the editor is in a loading state. When true, a loading overlay is displayed. */
3179
- isLoading = false;
3180
3177
  /** Optional unique identifier for namespacing storage keys across multiple editor instances. */
3181
3178
  editorId;
3182
3179
  /** Optional workspace ID to set as active. If provided, the editor will automatically activate the workspace with this ID. */
@@ -3217,6 +3214,11 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
3217
3214
  normalizedControls = [];
3218
3215
  resolvedMoreMenuItems = [];
3219
3216
  isLoadingOverlayVisible = false;
3217
+ loadingOverlayShowTimeout;
3218
+ loadingOverlayHideTimeout;
3219
+ loadingOverlayShownTimestamp;
3220
+ loadingOverlayDelayMs = 300;
3221
+ loadingOverlayMinDisplayDurationMs = 400;
3220
3222
  notificationDismissTimeout;
3221
3223
  notificationDismissAnimationTimeout;
3222
3224
  notificationDisplayDurationMs = 5000;
@@ -3596,6 +3598,8 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
3596
3598
  this.setOsSpecificCssVariables();
3597
3599
  }
3598
3600
  disconnectedCallback() {
3601
+ this.clearLoadingOverlayShowTimer();
3602
+ this.clearLoadingOverlayHideTimer();
3599
3603
  this.clearNotificationDismissTimer();
3600
3604
  this.clearNotificationDismissAnimationTimer();
3601
3605
  }
@@ -3711,6 +3715,46 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
3711
3715
  event.stopPropagation();
3712
3716
  this.contextMenuState = event.detail.isVisible ? event.detail : undefined;
3713
3717
  }
3718
+ handleIsLoadingChange(event) {
3719
+ console.log('isLoadingChange event:', event.detail);
3720
+ event.stopPropagation();
3721
+ this.clearLoadingOverlayShowTimer();
3722
+ this.clearLoadingOverlayHideTimer();
3723
+ if (event.detail) {
3724
+ this.loadingOverlayShowTimeout = setTimeout(() => {
3725
+ this.isLoadingOverlayVisible = true;
3726
+ this.loadingOverlayShownTimestamp = Date.now();
3727
+ this.loadingOverlayShowTimeout = undefined;
3728
+ }, this.loadingOverlayDelayMs);
3729
+ return;
3730
+ }
3731
+ if (this.isLoadingOverlayVisible && this.loadingOverlayShownTimestamp !== undefined) {
3732
+ const elapsed = Date.now() - this.loadingOverlayShownTimestamp;
3733
+ const remaining = this.loadingOverlayMinDisplayDurationMs - elapsed;
3734
+ if (remaining > 0) {
3735
+ this.loadingOverlayHideTimeout = setTimeout(() => {
3736
+ this.isLoadingOverlayVisible = false;
3737
+ this.loadingOverlayShownTimestamp = undefined;
3738
+ this.loadingOverlayHideTimeout = undefined;
3739
+ }, remaining);
3740
+ return;
3741
+ }
3742
+ }
3743
+ this.isLoadingOverlayVisible = false;
3744
+ this.loadingOverlayShownTimestamp = undefined;
3745
+ }
3746
+ clearLoadingOverlayShowTimer() {
3747
+ if (this.loadingOverlayShowTimeout) {
3748
+ clearTimeout(this.loadingOverlayShowTimeout);
3749
+ this.loadingOverlayShowTimeout = undefined;
3750
+ }
3751
+ }
3752
+ clearLoadingOverlayHideTimer() {
3753
+ if (this.loadingOverlayHideTimeout) {
3754
+ clearTimeout(this.loadingOverlayHideTimeout);
3755
+ this.loadingOverlayHideTimeout = undefined;
3756
+ }
3757
+ }
3714
3758
  handleContextMenuActionSelected(event) {
3715
3759
  const contextMenuState = this.contextMenuState;
3716
3760
  if (!contextMenuState || !event.detail.action) {
@@ -4012,40 +4056,40 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
4012
4056
  const isLoggedIn = this.isLoggedIn;
4013
4057
  const shouldShowCurrentUser = isLoggedIn;
4014
4058
  const shouldShowLoginButton = this.isReady && !!this.loginConfig && !isLoggedIn;
4015
- return (h(Host, { key: '10d7810f2db00207f1f024727fb3957dce6496c5' }, h("div", { key: 'f1bced369a6e820d17c89b6e8cdd8f09fc7e084f', class: "editor-content", style: {
4059
+ return (h(Host, { key: '247f9ad977943d29333094737c8904253ccab5c7' }, h("div", { key: 'e14e57a04ca7138690a4893f2ac14140e0532fd2', class: "editor-content", style: {
4016
4060
  opacity: this.isEditorVisible ? '1' : '0',
4017
4061
  visibility: this.isEditorVisible ? 'visible' : 'hidden',
4018
4062
  transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out',
4019
- } }, h("div", { key: '42d177987e4d14de10ebb45d673f750022c7d944', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'be583a237b378e0eeb14756fcb0bd9a733b51020', 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: '5713455fd09512085e5048ab3da35499d48c9bbc', visible: this.isBackToContentButtonVisible, text: this.resolvedTerms['backToContent.label'] ?? 'Back to content', onBackToContent: () => this.backToContent() })), this.activeNotification && (h("div", { key: '41c3fbd197ccca774bb87be7d003374bc548e46e', class: "top-center-notification-layer", role: "presentation" }, h("div", { key: '5634e4cfd0d6cb7accee59e7f239e3d758872202', class: { 'top-center-notification-container': true, 'is-dismissing': this.isNotificationDismissing }, role: "presentation" }, h("kritzel-notification-card", { key: 'b1b2a90199b16e874a54a6435ebb4f873cc8a403', notification: this.activeNotification, locale: this.locale, onDismiss: this.dismissNotification, onHoverChange: event => this.handleNotificationHoverChange(event) })))), this.contextMenuState && this.contextMenuState.items.length > 0 && (h("kritzel-context-menu", { key: '9b1d0f847171e177a2135454cab0c3761308c396', class: "context-menu", items: this.contextMenuState.items, objects: this.contextMenuState.objects, style: {
4063
+ } }, h("div", { key: 'd9304408c6336c4b742b0e44d4a6d4dda5b2fad6', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'f44ca859cd70828c77a92607cbe5b9c26fd4a203', 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: '1c65e5fbcc34dd43b7986f6177b8eab2bd709ad8', visible: this.isBackToContentButtonVisible, text: this.resolvedTerms['backToContent.label'] ?? 'Back to content', onBackToContent: () => this.backToContent() })), this.activeNotification && (h("div", { key: '2f7715f5c7c128ec63f2fe60c508543db7dd571c', class: "top-center-notification-layer", role: "presentation" }, h("div", { key: '357014e172134af3a3d35af9978d14d23fadf7e3', class: { 'top-center-notification-container': true, 'is-dismissing': this.isNotificationDismissing }, role: "presentation" }, h("kritzel-notification-card", { key: '3962a562a8fc10b2bbdc1c8dd741a057e9e6df29', notification: this.activeNotification, locale: this.locale, onDismiss: this.dismissNotification, onHoverChange: event => this.handleNotificationHoverChange(event) })))), this.contextMenuState && this.contextMenuState.items.length > 0 && (h("kritzel-context-menu", { key: '669e6dae09d52e87dc22aa536f6f564f725f6c34', class: "context-menu", items: this.contextMenuState.items, objects: this.contextMenuState.objects, style: {
4020
4064
  position: 'absolute',
4021
4065
  left: `${this.contextMenuState.position.x}px`,
4022
4066
  top: `${this.contextMenuState.position.y}px`,
4023
4067
  zIndex: '10002',
4024
- }, onActionSelected: event => this.handleContextMenuActionSelected(event), onClose: () => this.hideContextMenu() })), h("kritzel-loading-overlay", { key: '693536ad11dbc5080203902f0553d87b628704e9', visible: this.isLoadingOverlayVisible, text: this.resolvedTerms['editor.loading'] ?? 'Loading...' }), h("kritzel-engine", { key: 'd4dacd1803e63417c2d7d9dcd008345e947f2806', ref: el => {
4068
+ }, onActionSelected: event => this.handleContextMenuActionSelected(event), onClose: () => this.hideContextMenu() })), h("kritzel-loading-overlay", { key: '40a32849c45b9b8240b3be427579cb6a6c63fa97', visible: this.isLoadingOverlayVisible, text: this.resolvedTerms['editor.loading'] ?? 'Loading...' }), h("kritzel-engine", { key: '424ec83a0e8e9c8174cd12439fff2b49898b8016', ref: el => {
4025
4069
  if (el) {
4026
4070
  this.engineRef = el;
4027
4071
  }
4028
- }, 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), onContextMenuStateChange: event => this.handleContextMenuStateChange(event), onLoadingChange: event => (this.isLoadingOverlayVisible = event.detail) }), h("kritzel-controls", { key: 'f988a540cae6372b2259167956f81ecfae324bf1', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
4072
+ }, 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, 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), onContextMenuStateChange: event => this.handleContextMenuStateChange(event), onIsLoadingChange: event => this.handleIsLoadingChange(event) }), h("kritzel-controls", { key: 'e224d9cde14effc67b07f1f18597f45e3dc6d808', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
4029
4073
  if (el) {
4030
4074
  this.controlsRef = el;
4031
4075
  }
4032
- }, controls: this.normalizedControls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, terms: this.resolvedTerms, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: 'c9eca767869cb0504b18b480f14abb4ae9515e6a', class: "bottom-left-buttons" }, h("kritzel-zoom-panel", { key: '9a02ece644a46b9eaa1ce92245df2183bfe7bb5a', visible: this.isZoomPanelVisible, disabled: !this.isZoomingEnabled, zoomPercent: this.currentZoomPercent, terms: this.resolvedTerms, onZoomIn: () => this.zoomIn(), onZoomOut: () => this.zoomOut() })), h("div", { key: 'a214d0c6039cfeeda9e4e015e83ca196e4b73b56', class: "top-right-buttons" }, h("kritzel-settings", { key: 'c20518083d832267e85384d14adca6342fa82299', ref: el => {
4076
+ }, controls: this.normalizedControls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, terms: this.resolvedTerms, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '767b369fd2b55329d953d8c55ea897c35b921584', class: "bottom-left-buttons" }, h("kritzel-zoom-panel", { key: 'abaa0a55d433fa1740071f32f8dfc1854c6ed157', visible: this.isZoomPanelVisible, disabled: !this.isZoomingEnabled, zoomPercent: this.currentZoomPercent, terms: this.resolvedTerms, onZoomIn: () => this.zoomIn(), onZoomOut: () => this.zoomOut() })), h("div", { key: 'eb9e71d97b2b4663f02a17022494d353fa4f877e', class: "top-right-buttons" }, h("kritzel-settings", { key: '10ef2f68f90a6ceb3ce0a3110245c58da7ee2492', ref: el => {
4033
4077
  if (el) {
4034
4078
  this.settingsRef = el;
4035
4079
  }
4036
- }, 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: '3306caba17bb638e5285c838539c7862e889dbbd', ref: el => {
4080
+ }, 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: 'd72b5006a608570c26a2981d03f4d15e9b0c8b30', ref: el => {
4037
4081
  if (el) {
4038
4082
  this.exportRef = el;
4039
4083
  }
4040
- }, 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: '1aede3a116f502f017188153803c35e304592575', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: '8eaa1d59ca018d1b1190aa01c9fa3d2bd587de4c', user: this.user, terms: this.resolvedTerms, onClick: () => this.currentUserDialogRef?.open() }), shouldShowCurrentUser && (h("kritzel-current-user-dialog", { key: 'c9a138c1411746654b3a2385c6c5c82b875cf88d', ref: el => {
4084
+ }, 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: 'cceafd7ae3f289edb351af4e614afca2385e196a', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: '042fc9ce8487ea463f0ee77a5749786ed2931f07', user: this.user, terms: this.resolvedTerms, onClick: () => this.currentUserDialogRef?.open() }), shouldShowCurrentUser && (h("kritzel-current-user-dialog", { key: '7cce7677fbae0a1b897b2135f50e017df5409d32', ref: el => {
4041
4085
  if (el) {
4042
4086
  this.currentUserDialogRef = el;
4043
4087
  }
4044
- }, user: this.user, terms: this.resolvedTerms, onLogoutRequest: this.handleCurrentUserLogout })), shouldShowLoginButton && h("kritzel-button", { key: '9a2900deb52b4d70f1612fb75c5baa9302412ebf', onButtonClick: () => this.loginDialogRef?.open() }, this.resolvedTerms['login.dialogTitle'] ?? 'Sign in'), h("kritzel-more-menu", { key: '027d3c3d847bf975bc5c6f44e9ecf1b452c77bf9', items: this.resolvedMoreMenuItems, visible: this.isMoreMenuVisible, terms: this.resolvedTerms }), h("kritzel-share-dialog", { key: '461e239bd09abf63b85e6122b1b9f7425da23ec3', ref: el => {
4088
+ }, user: this.user, terms: this.resolvedTerms, onLogoutRequest: this.handleCurrentUserLogout })), shouldShowLoginButton && h("kritzel-button", { key: '97cf48d83804dfa5220ce38500af3f96687354d2', onButtonClick: () => this.loginDialogRef?.open() }, this.resolvedTerms['login.dialogTitle'] ?? 'Sign in'), h("kritzel-more-menu", { key: '40a757fe355666e9306f2224d9ed9bf2c9b58f7a', items: this.resolvedMoreMenuItems, visible: this.isMoreMenuVisible, terms: this.resolvedTerms }), h("kritzel-share-dialog", { key: 'abb85b65a9d6196be701d35cbdf8bc3003d36bfe', ref: el => {
4045
4089
  if (el) {
4046
4090
  this.shareDialogRef = el;
4047
4091
  }
4048
- }, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, terms: this.resolvedTerms, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '1e324fb764ab33047dba85eb34ae51418d081f2c', ref: el => {
4092
+ }, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, terms: this.resolvedTerms, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '6e8c86420a447b182bcbc23415d64a7fcb32a4a8', ref: el => {
4049
4093
  if (el) {
4050
4094
  this.loginDialogRef = el;
4051
4095
  }
@@ -4126,12 +4170,10 @@ const KritzelEditor$1 = /*@__PURE__*/ proxyCustomElement(class KritzelEditor ext
4126
4170
  "isWorkspaceManagerVisible": [4, "is-workspace-manager-visible"],
4127
4171
  "isMoreMenuVisible": [4, "is-more-menu-visible"],
4128
4172
  "isZoomPanelVisible": [4, "is-zoom-panel-visible"],
4129
- "isObjectDistanceFadingActive": [4, "is-object-distance-fading-active"],
4130
4173
  "syncConfig": [16],
4131
4174
  "assetStorageConfig": [16],
4132
4175
  "cursorTarget": [16],
4133
4176
  "loginConfig": [16],
4134
- "isLoading": [4, "is-loading"],
4135
4177
  "editorId": [1, "editor-id"],
4136
4178
  "activeWorkspaceId": [1, "active-workspace-id"],
4137
4179
  "isEngineReady": [32],
@@ -1,4 +1,4 @@
1
- import { G as KritzelEngine$1, C as defineCustomElement$1 } from './p-DUoQyGKc.js';
1
+ import { H as KritzelEngine$1, G as defineCustomElement$1 } from './p-CYwoBiqy.js';
2
2
 
3
3
  const KritzelEngine = KritzelEngine$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { K as KritzelLoadingOverlay$1, d as defineCustomElement$1 } from './p-Cva3jIIU.js';
1
+ import { K as KritzelLoadingOverlay$1, d as defineCustomElement$1 } from './p-4uoSa0Xl.js';
2
2
 
3
3
  const KritzelLoadingOverlay = KritzelLoadingOverlay$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { K as KritzelSettings$1, d as defineCustomElement$1 } from './p-m7SeNszM.js';
1
+ import { K as KritzelSettings$1, d as defineCustomElement$1 } from './p-BTo2cQZ9.js';
2
2
 
3
3
  const KritzelSettings = KritzelSettings$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,6 +1,6 @@
1
1
  import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-B43upypT.js';
2
2
 
3
- const kritzelLoadingOverlayCss = () => `:host{display:contents}.loading-overlay{position:absolute;inset:0;z-index:var(--kritzel-editor-loading-overlay-z-index, 9999);display:flex;align-items:center;justify-content:center;gap:10px;background-color:var(--kritzel-editor-loading-overlay-background, rgba(255, 255, 255, 0.6));color:var(--kritzel-editor-loading-overlay-color, #333);font-family:var(--kritzel-font-family, sans-serif);font-size:1.25rem;opacity:0;pointer-events:none;visibility:hidden}.loading-overlay.visible{pointer-events:all;visibility:visible;animation:kritzel-loading-fade-in 200ms ease-out var(--kritzel-editor-loading-overlay-delay, 300ms) forwards}.loading-spinner{width:20px;height:20px;box-sizing:border-box;display:block;flex-shrink:0;border:2px solid var(--kritzel-editor-loading-overlay-spinner-color, #cccccc);border-top-color:var(--kritzel-editor-loading-overlay-spinner-active-color, #333333);border-radius:50%;animation:kritzel-loading-spin 0.6s linear infinite}@keyframes kritzel-loading-spin{to{transform:rotate(360deg)}}@keyframes kritzel-loading-fade-in{to{opacity:1}}`;
3
+ const kritzelLoadingOverlayCss = () => `:host{position:absolute;inset:0;z-index:var(--kritzel-editor-loading-overlay-z-index, 1);display:block;pointer-events:none}.loading-overlay{position:absolute;inset:0;z-index:0;display:flex;align-items:center;justify-content:center;gap:10px;background-color:var(--kritzel-editor-loading-overlay-background, rgba(255, 255, 255, 0.6));color:var(--kritzel-editor-loading-overlay-color, #333);font-family:var(--kritzel-font-family, sans-serif);font-size:1.25rem;opacity:0;pointer-events:none;visibility:hidden;transition:opacity 300ms ease, visibility 0s linear 300ms}.loading-overlay.visible{opacity:1;pointer-events:all;visibility:visible;transition:opacity 300ms ease, visibility 0s linear 0s}.loading-spinner{width:20px;height:20px;box-sizing:border-box;display:block;flex-shrink:0;border:2px solid var(--kritzel-editor-loading-overlay-spinner-color, #cccccc);border-top-color:var(--kritzel-editor-loading-overlay-spinner-active-color, #333333);border-radius:50%;animation:kritzel-loading-spin 0.6s linear infinite}@keyframes kritzel-loading-spin{to{transform:rotate(360deg)}}`;
4
4
 
5
5
  const KritzelLoadingOverlay = /*@__PURE__*/ proxyCustomElement(class KritzelLoadingOverlay extends H {
6
6
  constructor(registerHost) {
@@ -12,7 +12,7 @@ import { d as defineCustomElement$1 } from './p-Dvn6ad4a.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.26';
15
+ const KRITZEL_VERSION = '0.4.27';
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-tab-panel{display:none}.settings-tab-panel.is-active{display:block}.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
 
@@ -10,6 +10,7 @@ import { K as KritzelWorkspace, W as WORKSPACE_EXPORT_VERSION } from './p-DAwPPD
10
10
  import { K as KritzelHTMLHelper } from './p-WUdQqYnu.js';
11
11
  import { O as ObjectHelper } from './p-DPONTran.js';
12
12
  import * as Y from 'yjs';
13
+ import { IndexeddbPersistence } from 'y-indexeddb';
13
14
  import { a as CURRENT_WORKSPACE_SCHEMA_VERSION, C as CURRENT_APP_STATE_SCHEMA_VERSION } from './p-CW-VyJgK.js';
14
15
  import { K as KritzelIconRegistry, d as defineCustomElement$2 } from './p-CSuU8frA.js';
15
16
 
@@ -21786,6 +21787,45 @@ class KritzelSelectionTool extends KritzelBaseTool {
21786
21787
  }
21787
21788
  }
21788
21789
 
21790
+ /**
21791
+ * IndexedDB sync provider for local persistence
21792
+ */
21793
+ class IndexedDBSyncProvider {
21794
+ static type = 'local';
21795
+ type = 'local';
21796
+ provider;
21797
+ isConnected = false;
21798
+ constructor(docName, doc, options) {
21799
+ const dbName = options?.name || docName;
21800
+ this.provider = new IndexeddbPersistence(dbName, doc);
21801
+ }
21802
+ async connect() {
21803
+ if (this.isConnected) {
21804
+ return;
21805
+ }
21806
+ return new Promise(resolve => {
21807
+ this.provider.on('synced', () => {
21808
+ this.isConnected = true;
21809
+ resolve();
21810
+ });
21811
+ });
21812
+ }
21813
+ disconnect() {
21814
+ // IndexedDB doesn't need explicit disconnect
21815
+ this.isConnected = false;
21816
+ }
21817
+ async reconnect() {
21818
+ this.disconnect();
21819
+ return this.connect();
21820
+ }
21821
+ destroy() {
21822
+ if (this.provider) {
21823
+ this.provider.destroy();
21824
+ }
21825
+ this.isConnected = false;
21826
+ }
21827
+ }
21828
+
21789
21829
  /**
21790
21830
  * Manages anchor connections between line endpoints and other objects.
21791
21831
  * Maintains a runtime index for efficient reverse lookups and handles
@@ -24326,7 +24366,7 @@ const WORKSPACE_MIGRATIONS = [
24326
24366
  * Default sync configuration - None
24327
24367
  */
24328
24368
  const DEFAULT_SYNC_CONFIG = {
24329
- providers: [],
24369
+ providers: [IndexedDBSyncProvider],
24330
24370
  };
24331
24371
 
24332
24372
  var lodash$1 = {exports: {}};
@@ -48866,11 +48906,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
48866
48906
  isPanningEnabled = true;
48867
48907
  /** When false, Ctrl+wheel events do not zoom the viewport. */
48868
48908
  isZoomingEnabled = true;
48869
- /** External loading state. Combined with internal workspace-loading state to drive the overlay. */
48870
- isLoading = false;
48871
- onIsLoadingChange() {
48872
- this.syncLoadingState();
48873
- }
48874
48909
  /** Emitted when the engine has fully initialized and is ready for interaction. */
48875
48910
  isEngineReady;
48876
48911
  /** Emitted when the active drawing tool changes. */
@@ -48903,8 +48938,8 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
48903
48938
  notificationsChange;
48904
48939
  /** Emitted when context-menu visibility, items, or position changes. */
48905
48940
  contextMenuStateChange;
48906
- /** Emitted when the combined loading state (external `isLoading` prop or internal workspace loading) changes. */
48907
- loadingChange;
48941
+ /** Emitted while the selected workspace's objects are being initialized and synchronized. */
48942
+ isLoadingChange;
48908
48943
  forceUpdate = 0;
48909
48944
  /** Manually triggers the `objectsSelectionChange` event. */
48910
48945
  async triggerSelectionChange() {
@@ -50482,7 +50517,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50482
50517
  _syncInitPromise = null;
50483
50518
  _syncConfigRevision = 0;
50484
50519
  _assetStorageConfigRevision = 0;
50485
- _isWorkspaceLoading = false;
50486
50520
  _hasLoggedUnlicensedWelcomeBanner = false;
50487
50521
  _previousVisibleCustomElements = new Set();
50488
50522
  _revealedImageKeys = new Set();
@@ -50501,9 +50535,12 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50501
50535
  _objectDistanceFadeCloseStartScale = 2;
50502
50536
  _objectDistanceFadeCloseMaxScale = 4;
50503
50537
  _objectDistanceFadeCloseMinOpacity = 0;
50504
- syncLoadingState() {
50505
- this.core.store.state.isLoading = this._isWorkspaceLoading || this.isLoading;
50506
- this.loadingChange.emit(this.core.store.state.isLoading);
50538
+ setLoadingState(isLoading) {
50539
+ if (this.core.store.state.isLoading === isLoading) {
50540
+ return;
50541
+ }
50542
+ this.core.store.state.isLoading = isLoading;
50543
+ this.isLoadingChange.emit(isLoading);
50507
50544
  }
50508
50545
  isNetworkAvailable() {
50509
50546
  return typeof navigator !== 'undefined' && navigator.onLine;
@@ -50613,7 +50650,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50613
50650
  this.awarenessChange = createEvent(this, "awarenessChange");
50614
50651
  this.notificationsChange = createEvent(this, "notificationsChange");
50615
50652
  this.contextMenuStateChange = createEvent(this, "contextMenuStateChange");
50616
- this.loadingChange = createEvent(this, "loadingChange");
50653
+ this.isLoadingChange = createEvent(this, "isLoadingChange");
50617
50654
  this.core = new KritzelCore(this);
50618
50655
  }
50619
50656
  disconnectedCallback() {
@@ -50670,8 +50707,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50670
50707
  this.core.store.state.debugInfo = this.debugInfo;
50671
50708
  this.core.assetResolver.setShowInfo(this.debugInfo.showAssetResolverInfo);
50672
50709
  }
50673
- this._isWorkspaceLoading = true;
50674
- this.syncLoadingState();
50675
50710
  }
50676
50711
  async componentDidLoad() {
50677
50712
  setTimeout(async () => {
@@ -50809,15 +50844,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50809
50844
  if (!this.core.appStateMap.hasNetworkSyncProvider || !this.isNetworkAvailable()) {
50810
50845
  return;
50811
50846
  }
50812
- this._isWorkspaceLoading = true;
50813
- this.syncLoadingState();
50814
- try {
50815
- await this.core.appStateMap.whenNetworkSynced();
50816
- }
50817
- finally {
50818
- this._isWorkspaceLoading = false;
50819
- this.syncLoadingState();
50820
- }
50847
+ await this.core.appStateMap.whenNetworkSynced();
50821
50848
  }
50822
50849
  resolveStartupWorkspace() {
50823
50850
  if (this.activeWorkspaceId) {
@@ -50866,21 +50893,21 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50866
50893
  await this._workspaceInitializationPromise;
50867
50894
  return;
50868
50895
  }
50869
- this._isWorkspaceLoading = true;
50870
- this.syncLoadingState();
50896
+ this.setLoadingState(true);
50871
50897
  const initializationPromise = this.core.initializeWorkspace(workspace, options);
50898
+ const objectsMap = this.core.store.objects;
50872
50899
  this._workspaceInitializationPromise = initializationPromise;
50873
50900
  this._workspaceInitializationTargetKey = targetKey;
50874
50901
  try {
50875
50902
  await initializationPromise;
50903
+ await objectsMap?.whenNetworkSynced();
50876
50904
  }
50877
50905
  finally {
50878
50906
  // Only the most recent init clears loading state to prevent race conditions
50879
50907
  if (this._workspaceInitializationPromise === initializationPromise) {
50880
50908
  this._workspaceInitializationPromise = null;
50881
50909
  this._workspaceInitializationTargetKey = null;
50882
- this._isWorkspaceLoading = false;
50883
- this.syncLoadingState();
50910
+ this.setLoadingState(false);
50884
50911
  }
50885
50912
  }
50886
50913
  }
@@ -51589,9 +51616,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
51589
51616
  }],
51590
51617
  "debugInfo": [{
51591
51618
  "onDebugInfoChange": 0
51592
- }],
51593
- "isLoading": [{
51594
- "onIsLoadingChange": 0
51595
51619
  }]
51596
51620
  }; }
51597
51621
  static get style() { return kritzelEngineCss(); }
@@ -51622,7 +51646,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
51622
51646
  "debugInfo": [16],
51623
51647
  "isPanningEnabled": [4, "is-panning-enabled"],
51624
51648
  "isZoomingEnabled": [4, "is-zooming-enabled"],
51625
- "isLoading": [4, "is-loading"],
51626
51649
  "forceUpdate": [32],
51627
51650
  "triggerSelectionChange": [64],
51628
51651
  "beginSceneBootstrap": [64],
@@ -51772,9 +51795,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
51772
51795
  }],
51773
51796
  "debugInfo": [{
51774
51797
  "onDebugInfoChange": 0
51775
- }],
51776
- "isLoading": [{
51777
- "onIsLoadingChange": 0
51778
51798
  }]
51779
51799
  }]);
51780
51800
  function defineCustomElement() {
@@ -51811,4 +51831,4 @@ function defineCustomElement() {
51811
51831
  } });
51812
51832
  }
51813
51833
 
51814
- export { AssetNotFoundError as A, KritzelKeyboardHelper as B, defineCustomElement as C, DE_LOCALE as D, EN_LOCALE as E, FR_LOCALE as F, KritzelEngine as G, IndexedDBAssetProvider as I, KritzelText as K, ShapeType as S, WORKSPACE_MIGRATIONS as W, KritzelImage as a, KritzelGroup as b, KritzelShape as c, KritzelCustomElement as d, KritzelBaseTool as e, KritzelBrushTool as f, KritzelLineTool as g, KritzelEraserTool as h, KritzelImageTool as i, KritzelTextTool as j, KritzelShapeTool as k, KritzelCursorHelper as l, KritzelSelectionTool as m, KritzelAssetResolver as n, KritzelAnchorManager as o, KritzelLocalizationManager as p, KritzelLicenseManager as q, KritzelCustomElementRendererRegistry as r, KritzelAlignment as s, runMigrations as t, APP_STATE_MIGRATIONS as u, DEFAULT_STROKE_SIZES as v, DEFAULT_FONT_SIZES as w, DEFAULT_SYNC_CONFIG as x, KritzelSelectionGroup as y, KritzelSelectionBox as z };
51834
+ export { AssetNotFoundError as A, KritzelSelectionBox as B, KritzelKeyboardHelper as C, DE_LOCALE as D, EN_LOCALE as E, FR_LOCALE as F, defineCustomElement as G, KritzelEngine as H, IndexedDBSyncProvider as I, KritzelText as K, ShapeType as S, WORKSPACE_MIGRATIONS as W, KritzelImage as a, KritzelGroup as b, KritzelShape as c, KritzelCustomElement as d, KritzelBaseTool as e, KritzelBrushTool as f, KritzelLineTool as g, KritzelEraserTool as h, KritzelImageTool as i, KritzelTextTool as j, KritzelShapeTool as k, KritzelCursorHelper as l, KritzelSelectionTool as m, KritzelAssetResolver as n, IndexedDBAssetProvider as o, KritzelAnchorManager as p, KritzelLocalizationManager as q, KritzelLicenseManager as r, KritzelCustomElementRendererRegistry as s, KritzelAlignment as t, runMigrations as u, APP_STATE_MIGRATIONS as v, DEFAULT_STROKE_SIZES as w, DEFAULT_FONT_SIZES as x, DEFAULT_SYNC_CONFIG as y, KritzelSelectionGroup as z };
package/dist/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { H as HocuspocusProvider, a as HocuspocusProviderWebsocket } from './schema.constants-DfvqHmxc.js';
2
- export { P as APP_STATE_MIGRATIONS, A as AssetNotFoundError, R as CURRENT_APP_STATE_SCHEMA_VERSION, T as CURRENT_WORKSPACE_SCHEMA_VERSION, E as DEFAULT_ASSET_STORAGE_CONFIG, D as DEFAULT_BRUSH_CONFIG, C as DEFAULT_LINE_TOOL_CONFIG, B as DEFAULT_TEXT_CONFIG, L as DE_LOCALE, J as EN_LOCALE, M as FR_LOCALE, I as IndexedDBAssetProvider, N as KritzelAlignment, t as KritzelAnchorManager, r as KritzelAssetResolver, K as KritzelBaseObject, i as KritzelBaseTool, j as KritzelBrushTool, p as KritzelCursorHelper, h as KritzelCustomElement, x as KritzelCustomElementRendererRegistry, l as KritzelEraserTool, y as KritzelFontRegistry, f as KritzelGroup, d as KritzelImage, m as KritzelImageTool, w as KritzelLicenseManager, e as KritzelLine, k as KritzelLineTool, v as KritzelLocalizationManager, c as KritzelPath, q as KritzelSelectionTool, g as KritzelShape, o as KritzelShapeTool, b as KritzelText, n as KritzelTextTool, u as KritzelThemeManager, s as KritzelWorkspace, S as ShapeType, W as WORKSPACE_EXPORT_VERSION, Q as WORKSPACE_MIGRATIONS, G as darkTheme, z as hasRemoteSyncProvider, F as lightTheme, O as runMigrations } from './schema.constants-DfvqHmxc.js';
1
+ import { H as HocuspocusProvider, a as HocuspocusProviderWebsocket } from './schema.constants-De_S50eB.js';
2
+ export { Q as APP_STATE_MIGRATIONS, A as AssetNotFoundError, T as CURRENT_APP_STATE_SCHEMA_VERSION, U as CURRENT_WORKSPACE_SCHEMA_VERSION, F as DEFAULT_ASSET_STORAGE_CONFIG, D as DEFAULT_BRUSH_CONFIG, E as DEFAULT_LINE_TOOL_CONFIG, C as DEFAULT_TEXT_CONFIG, M as DE_LOCALE, L as EN_LOCALE, N as FR_LOCALE, s as IndexedDBAssetProvider, I as IndexedDBSyncProvider, O as KritzelAlignment, u as KritzelAnchorManager, r as KritzelAssetResolver, K as KritzelBaseObject, i as KritzelBaseTool, j as KritzelBrushTool, p as KritzelCursorHelper, h as KritzelCustomElement, y as KritzelCustomElementRendererRegistry, l as KritzelEraserTool, z as KritzelFontRegistry, f as KritzelGroup, d as KritzelImage, m as KritzelImageTool, x as KritzelLicenseManager, e as KritzelLine, k as KritzelLineTool, w as KritzelLocalizationManager, c as KritzelPath, q as KritzelSelectionTool, g as KritzelShape, o as KritzelShapeTool, b as KritzelText, n as KritzelTextTool, v as KritzelThemeManager, t as KritzelWorkspace, S as ShapeType, W as WORKSPACE_EXPORT_VERSION, R as WORKSPACE_MIGRATIONS, J as darkTheme, B as hasRemoteSyncProvider, G as lightTheme, P as runMigrations } from './schema.constants-De_S50eB.js';
3
3
  import * as Y from 'yjs';
4
- import { IndexeddbPersistence } from 'y-indexeddb';
5
4
  import { WebsocketProvider } from 'y-websocket';
5
+ import 'y-indexeddb';
6
6
 
7
7
  /**
8
8
  * Common Math expressions.
@@ -501,45 +501,6 @@ class InMemorySyncProvider {
501
501
  }
502
502
  }
503
503
 
504
- /**
505
- * IndexedDB sync provider for local persistence
506
- */
507
- class IndexedDBSyncProvider {
508
- static type = 'local';
509
- type = 'local';
510
- provider;
511
- isConnected = false;
512
- constructor(docName, doc, options) {
513
- const dbName = options?.name || docName;
514
- this.provider = new IndexeddbPersistence(dbName, doc);
515
- }
516
- async connect() {
517
- if (this.isConnected) {
518
- return;
519
- }
520
- return new Promise(resolve => {
521
- this.provider.on('synced', () => {
522
- this.isConnected = true;
523
- resolve();
524
- });
525
- });
526
- }
527
- disconnect() {
528
- // IndexedDB doesn't need explicit disconnect
529
- this.isConnected = false;
530
- }
531
- async reconnect() {
532
- this.disconnect();
533
- return this.connect();
534
- }
535
- destroy() {
536
- if (this.provider) {
537
- this.provider.destroy();
538
- }
539
- this.isConnected = false;
540
- }
541
- }
542
-
543
504
  /**
544
505
  * WebSocket sync provider for real-time collaboration
545
506
  */
@@ -1182,4 +1143,4 @@ class PresignedAssetProvider {
1182
1143
  }
1183
1144
  }
1184
1145
 
1185
- export { BroadcastSyncProvider, HocuspocusSyncProvider, HttpAssetProvider, InMemorySyncProvider, IndexedDBSyncProvider, PresignedAssetProvider, WebSocketSyncProvider };
1146
+ export { BroadcastSyncProvider, HocuspocusSyncProvider, HttpAssetProvider, InMemorySyncProvider, PresignedAssetProvider, WebSocketSyncProvider };