kritzel-stencil 0.1.39 → 0.1.41

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 (142) hide show
  1. package/dist/cjs/{alignment.enum-Bk86Xzvb.js → alignment.enum-Dz9JvPvf.js} +23 -336
  2. package/dist/cjs/index-Dc7LOVhs.js +2 -2
  3. package/dist/cjs/index.cjs.js +1 -2
  4. package/dist/cjs/{kritzel-back-to-content_34.cjs.entry.js → kritzel-active-users_37.cjs.entry.js} +602 -58
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/stencil.cjs.js +1 -1
  7. package/dist/collection/classes/core/core.class.js +38 -4
  8. package/dist/collection/classes/managers/theme.manager.js +21 -5
  9. package/dist/collection/classes/registries/icon-registry.class.js +2 -1
  10. package/dist/collection/classes/structures/app-state-map.structure.js +1 -1
  11. package/dist/collection/classes/structures/object-map.structure.js +1 -1
  12. package/dist/collection/collection-manifest.json +3 -0
  13. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +110 -14
  14. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +24 -3
  15. package/dist/collection/components/shared/kritzel-avatar/kritzel-avatar.css +57 -0
  16. package/dist/collection/components/shared/kritzel-avatar/kritzel-avatar.js +190 -0
  17. package/dist/collection/components/shared/kritzel-color/kritzel-color.js +2 -2
  18. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +1 -1
  19. package/dist/collection/components/shared/kritzel-font/kritzel-font.js +1 -1
  20. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +1 -1
  21. package/dist/collection/components/shared/kritzel-input/kritzel-input.js +1 -1
  22. package/dist/collection/components/shared/kritzel-master-detail/kritzel-master-detail.js +3 -3
  23. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +1 -1
  24. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +2 -2
  25. package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.js +1 -1
  26. package/dist/collection/components/shared/kritzel-opacity-slider/kritzel-opacity-slider.js +1 -1
  27. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +1 -1
  28. package/dist/collection/components/shared/kritzel-slide-toggle/kritzel-slide-toggle.js +1 -1
  29. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +1 -1
  30. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
  31. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +2 -2
  32. package/dist/collection/components/ui/kritzel-active-users/kritzel-active-users.css +65 -0
  33. package/dist/collection/components/ui/kritzel-active-users/kritzel-active-users.js +134 -0
  34. package/dist/collection/components/ui/kritzel-back-to-content/kritzel-back-to-content.js +1 -1
  35. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +18 -11
  36. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +9 -6
  37. package/dist/collection/components/ui/kritzel-current-user/kritzel-current-user.css +8 -0
  38. package/dist/collection/components/ui/kritzel-current-user/kritzel-current-user.js +165 -0
  39. package/dist/collection/components/ui/kritzel-export/kritzel-export.js +1 -1
  40. package/dist/collection/components/ui/kritzel-more-menu/kritzel-more-menu.js +1 -1
  41. package/dist/collection/components/ui/kritzel-settings/kritzel-settings.js +27 -3
  42. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
  43. package/dist/collection/constants/version.js +1 -1
  44. package/dist/collection/index.js +1 -1
  45. package/dist/collection/interfaces/user.interface.js +1 -0
  46. package/dist/components/index.d.ts +6 -0
  47. package/dist/components/index.js +1 -1
  48. package/dist/components/kritzel-active-users.d.ts +11 -0
  49. package/dist/components/kritzel-active-users.js +1 -0
  50. package/dist/components/kritzel-avatar.d.ts +11 -0
  51. package/dist/components/kritzel-avatar.js +1 -0
  52. package/dist/components/kritzel-back-to-content.js +1 -1
  53. package/dist/components/kritzel-brush-style.js +1 -1
  54. package/dist/components/kritzel-color-palette.js +1 -1
  55. package/dist/components/kritzel-color.js +1 -1
  56. package/dist/components/kritzel-context-menu.js +1 -1
  57. package/dist/components/kritzel-controls.js +1 -1
  58. package/dist/components/kritzel-current-user.d.ts +11 -0
  59. package/dist/components/kritzel-current-user.js +1 -0
  60. package/dist/components/kritzel-editor.js +1 -1
  61. package/dist/components/kritzel-engine.js +1 -1
  62. package/dist/components/kritzel-export.js +1 -1
  63. package/dist/components/kritzel-font-size.js +1 -1
  64. package/dist/components/kritzel-font.js +1 -1
  65. package/dist/components/kritzel-icon.js +1 -1
  66. package/dist/components/kritzel-input.js +1 -1
  67. package/dist/components/kritzel-master-detail.js +1 -1
  68. package/dist/components/kritzel-menu-item.js +1 -1
  69. package/dist/components/kritzel-menu.js +1 -1
  70. package/dist/components/kritzel-more-menu.js +1 -1
  71. package/dist/components/kritzel-numeric-input.js +1 -1
  72. package/dist/components/kritzel-opacity-slider.js +1 -1
  73. package/dist/components/kritzel-pill-tabs.js +1 -1
  74. package/dist/components/kritzel-portal.js +1 -1
  75. package/dist/components/kritzel-settings.js +1 -1
  76. package/dist/components/kritzel-slide-toggle.js +1 -1
  77. package/dist/components/kritzel-split-button.js +1 -1
  78. package/dist/components/kritzel-stroke-size.js +1 -1
  79. package/dist/components/kritzel-tool-config.js +1 -1
  80. package/dist/components/kritzel-tooltip.js +1 -1
  81. package/dist/components/kritzel-utility-panel.js +1 -1
  82. package/dist/components/kritzel-workspace-manager.js +1 -1
  83. package/dist/components/{p-BmkX5yQP.js → p-B-GDVmNN.js} +1 -1
  84. package/dist/components/{p-BWS8O7Wu.js → p-B9MeEvDJ.js} +1 -1
  85. package/dist/components/{p-yOKWtnZe.js → p-BFBpyf9R.js} +1 -1
  86. package/dist/components/p-BLKHAzUR.js +1 -0
  87. package/dist/components/{p-ClFX_Emc.js → p-BSaHVXHy.js} +1 -1
  88. package/dist/components/{p-BPXAG9ll.js → p-BYY00ZvE.js} +1 -1
  89. package/dist/components/{p-BY18fwCy.js → p-BjaGGda8.js} +1 -1
  90. package/dist/components/{p-BI94nvjc.js → p-C29U6J7y.js} +1 -1
  91. package/dist/components/{p-ZNNJRHh8.js → p-C4k-HMhs.js} +1 -1
  92. package/dist/components/{p-Dx3BuZ8P.js → p-C8UTXhkD.js} +1 -1
  93. package/dist/components/p-CAkzDITs.js +1 -0
  94. package/dist/components/{p-DovLdMPZ.js → p-CK2vp28O.js} +1 -1
  95. package/dist/components/{p-Crme5r__.js → p-CSBMUMlo.js} +1 -1
  96. package/dist/components/{p-CRx4LwU0.js → p-CSHiLPTp.js} +1 -1
  97. package/dist/components/{p-KcUtwuOF.js → p-CTo1YBDt.js} +1 -1
  98. package/dist/components/{p-BtXIkbFb.js → p-ChUH9Hzy.js} +1 -1
  99. package/dist/components/p-Cn9UIGr1.js +1 -0
  100. package/dist/components/{p-B922HwKl.js → p-D2fHPWRl.js} +1 -1
  101. package/dist/components/p-D4PeDpaN.js +1 -0
  102. package/dist/components/{p-CGycUPBQ.js → p-D7dBETJy.js} +1 -1
  103. package/dist/components/{p-D0re1vIA.js → p-DBYzJoBX.js} +1 -1
  104. package/dist/components/{p-CcYz9zmK.js → p-DE9PS-QJ.js} +1 -1
  105. package/dist/components/{p-ZtP7HCXO.js → p-DJE1P3_n.js} +1 -1
  106. package/dist/components/{p-Z5g8fZP3.js → p-DMOtC_Yd.js} +1 -1
  107. package/dist/components/p-D_GhB_1Z.js +1 -0
  108. package/dist/components/{p-PsEooMXF.js → p-DeMrunun.js} +1 -1
  109. package/dist/components/{p-X-thuGEx.js → p-DwI7PaAy.js} +1 -1
  110. package/dist/components/p-OX2czO2a.js +9 -0
  111. package/dist/components/{p-DwruFI4P.js → p-OvQNAee_.js} +1 -1
  112. package/dist/components/{p-C_12_nSz.js → p-bWUahQFj.js} +1 -1
  113. package/dist/components/{p-DYUa5Z2V.js → p-pXZH3Wcp.js} +1 -1
  114. package/dist/esm/{alignment.enum-CHLwomda.js → alignment.enum-Oa9syYYp.js} +24 -315
  115. package/dist/esm/index-MV-81ybv.js +2 -2
  116. package/dist/esm/index.js +1 -1
  117. package/dist/esm/{kritzel-back-to-content_34.entry.js → kritzel-active-users_37.entry.js} +599 -58
  118. package/dist/esm/loader.js +1 -1
  119. package/dist/esm/stencil.js +1 -1
  120. package/dist/stencil/index.esm.js +1 -1
  121. package/dist/stencil/p-22561c60.entry.js +9 -0
  122. package/dist/stencil/p-Oa9syYYp.js +1 -0
  123. package/dist/stencil/stencil.esm.js +1 -1
  124. package/dist/types/classes/core/core.class.d.ts +24 -1
  125. package/dist/types/classes/managers/theme.manager.d.ts +9 -3
  126. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +8 -0
  127. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +2 -0
  128. package/dist/types/components/shared/kritzel-avatar/kritzel-avatar.d.ts +22 -0
  129. package/dist/types/components/ui/kritzel-active-users/kritzel-active-users.d.ts +21 -0
  130. package/dist/types/components/ui/kritzel-current-user/kritzel-current-user.d.ts +31 -0
  131. package/dist/types/components/ui/kritzel-settings/kritzel-settings.d.ts +3 -0
  132. package/dist/types/components.d.ts +225 -5
  133. package/dist/types/constants/version.d.ts +1 -1
  134. package/dist/types/index.d.ts +1 -1
  135. package/dist/types/interfaces/toolbar-control.interface.d.ts +1 -1
  136. package/dist/types/interfaces/user.interface.d.ts +20 -0
  137. package/package.json +1 -1
  138. package/dist/components/p-BnUpFUE0.js +0 -9
  139. package/dist/components/p-Cz6bZ7Yw.js +0 -1
  140. package/dist/components/p-nJ-DYuNk.js +0 -1
  141. package/dist/stencil/p-00175871.entry.js +0 -9
  142. package/dist/stencil/p-CHLwomda.js +0 -1
@@ -1,28 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var Y = require('yjs');
4
3
  var yIndexeddb = require('y-indexeddb');
5
4
 
6
- function _interopNamespace(e) {
7
- if (e && e.__esModule) return e;
8
- var n = Object.create(null);
9
- if (e) {
10
- Object.keys(e).forEach(function (k) {
11
- if (k !== 'default') {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: function () { return e[k]; }
16
- });
17
- }
18
- });
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
-
24
- var Y__namespace = /*#__PURE__*/_interopNamespace(Y);
25
-
26
5
  /**
27
6
  * A static registry for managing drawing tools in the Kritzel library.
28
7
  * Tools are instantiated and stored by name, allowing retrieval by name or index.
@@ -14880,6 +14859,7 @@ class KritzelThemeManager {
14880
14859
  _core;
14881
14860
  _currentTheme = DEFAULT_THEME;
14882
14861
  _targetElement = null;
14862
+ _storageKey;
14883
14863
  /**
14884
14864
  * Creates a new KritzelThemeManager instance.
14885
14865
  * Initializes the current theme from localStorage or uses the default theme.
@@ -14888,7 +14868,8 @@ class KritzelThemeManager {
14888
14868
  */
14889
14869
  constructor(core) {
14890
14870
  this._core = core;
14891
- this._currentTheme = KritzelThemeManager.getStoredTheme();
14871
+ this._storageKey = core.editorId ? `${THEME_STORAGE_KEY}-${core.editorId}` : THEME_STORAGE_KEY;
14872
+ this._currentTheme = this.getStoredTheme();
14892
14873
  }
14893
14874
  /**
14894
14875
  * Gets the current active theme name.
@@ -14929,9 +14910,23 @@ class KritzelThemeManager {
14929
14910
  return themeName === 'dark' ? darkTheme : lightTheme;
14930
14911
  }
14931
14912
  /**
14932
- * Gets the stored theme name from localStorage.
14933
- * Can be called statically without a manager instance.
14934
- * This is useful for initializing theme before the manager is created.
14913
+ * Gets the stored theme name from localStorage using this instance's namespaced key.
14914
+ *
14915
+ * @returns The stored theme name if valid, or 'light' as the default
14916
+ */
14917
+ getStoredTheme() {
14918
+ if (typeof localStorage === 'undefined') {
14919
+ return DEFAULT_THEME;
14920
+ }
14921
+ const stored = localStorage.getItem(this._storageKey);
14922
+ if (stored === 'dark' || stored === 'light') {
14923
+ return stored;
14924
+ }
14925
+ return DEFAULT_THEME;
14926
+ }
14927
+ /**
14928
+ * Gets the stored theme from the default (non-namespaced) localStorage key.
14929
+ * Used by static utility helpers that don't have access to a core instance.
14935
14930
  *
14936
14931
  * @returns The stored theme name if valid, or 'light' as the default
14937
14932
  */
@@ -14955,7 +14950,7 @@ class KritzelThemeManager {
14955
14950
  if (typeof localStorage === 'undefined') {
14956
14951
  return;
14957
14952
  }
14958
- localStorage.setItem(THEME_STORAGE_KEY, themeName);
14953
+ localStorage.setItem(this._storageKey, themeName);
14959
14954
  }
14960
14955
  /**
14961
14956
  * Sets the current theme, persists it to storage, and applies it to the target element.
@@ -19917,7 +19912,8 @@ KritzelIconRegistry.registerIcons({
19917
19912
  'align-start-vertical': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-align-start-vertical-icon lucide-align-start-vertical"><rect width="9" height="6" x="6" y="14" rx="2"/><rect width="16" height="6" x="6" y="4" rx="2"/><path d="M2 2v20"/></svg>',
19918
19913
  'align-center-vertical': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-align-center-vertical-icon lucide-align-center-vertical"><path d="M12 2v20"/><path d="M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4"/><path d="M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4"/><path d="M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1"/><path d="M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1"/></svg>',
19919
19914
  'align-end-vertical': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-align-end-vertical-icon lucide-align-end-vertical"><rect width="16" height="6" x="2" y="4" rx="2"/><rect width="9" height="6" x="9" y="14" rx="2"/><path d="M22 22V2"/></svg>',
19920
- 'viewport': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize-icon lucide-maximize"><path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/></svg>'
19915
+ 'viewport': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize-icon lucide-maximize"><path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/></svg>',
19916
+ 'log-out': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-log-out-icon lucide-log-out"><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/></svg>'
19921
19917
  });
19922
19918
 
19923
19919
  class KritzelCursorHelper {
@@ -22373,313 +22369,6 @@ class KritzelWorkspace {
22373
22369
  }
22374
22370
  }
22375
22371
 
22376
- /**
22377
- * Default sync configuration - IndexedDB + BroadcastChannel
22378
- */
22379
- const DEFAULT_SYNC_CONFIG = {
22380
- providers: [
22381
- IndexedDBSyncProvider
22382
- ],
22383
- };
22384
-
22385
- /**
22386
- * Manages the application state for workspaces with Yjs-based synchronization support.
22387
- * This class provides a synchronized map of workspaces that can be shared across
22388
- * multiple clients using configurable sync providers (e.g., WebSocket, WebRTC).
22389
- */
22390
- class KritzelAppStateMap {
22391
- map;
22392
- _ydoc = null;
22393
- _workspacesMap = null;
22394
- _providers = [];
22395
- _core = null;
22396
- _isReady = false;
22397
- _onRemoteChangeCallback = null;
22398
- _workspacesObserver = null;
22399
- /**
22400
- * Indicates whether the app state map has been initialized and is ready for use.
22401
- * @returns True if initialized and all providers are connected, false otherwise.
22402
- */
22403
- get isReady() {
22404
- return this._isReady;
22405
- }
22406
- /**
22407
- * Creates a new KritzelAppStateMap instance with an empty workspace map.
22408
- */
22409
- constructor() {
22410
- this.map = new Map();
22411
- }
22412
- /**
22413
- * Registers a callback function to be invoked when remote changes are received.
22414
- * This allows external code to react to workspace changes from other clients.
22415
- * @param callback - The function to call when remote changes occur.
22416
- */
22417
- onRemoteChange(callback) {
22418
- this._onRemoteChangeCallback = callback;
22419
- }
22420
- /**
22421
- * Initializes the app state map with Yjs synchronization.
22422
- * Creates a dedicated Y.Doc for app state, sets up workspace observation,
22423
- * instantiates and connects all configured sync providers, and loads existing workspaces.
22424
- * @param core - The KritzelCore instance for triggering re-renders and accessing the store.
22425
- * @param config - Optional sync configuration specifying providers. Defaults to DEFAULT_SYNC_CONFIG.
22426
- * @returns A promise that resolves when all providers are connected and the state is loaded.
22427
- */
22428
- async initialize(core, config) {
22429
- this._core = core;
22430
- // Create a dedicated Y.Doc for app state (workspaces)
22431
- this._ydoc = new Y__namespace.Doc();
22432
- this._workspacesMap = this._ydoc.getMap('workspaces');
22433
- const docName = 'kritzel-app-state';
22434
- const finalConfig = config ?? DEFAULT_SYNC_CONFIG;
22435
- // Instantiate providers from configuration
22436
- for (const providerConfig of finalConfig.providers) {
22437
- let provider;
22438
- // Check if it's a class constructor or a factory
22439
- if (typeof providerConfig === 'function') {
22440
- // It's a class constructor
22441
- provider = new providerConfig(docName, this._ydoc);
22442
- }
22443
- else {
22444
- // It's a factory with a create method
22445
- provider = providerConfig.create(docName, this._ydoc);
22446
- }
22447
- this._providers.push(provider);
22448
- }
22449
- // Observe changes to workspaces and sync with application state
22450
- this._workspacesObserver = event => {
22451
- this.handleWorkspacesChange(event);
22452
- };
22453
- this._workspacesMap.observe(this._workspacesObserver);
22454
- // Connect all providers in parallel
22455
- await Promise.all(this._providers.map(p => p.connect()));
22456
- this._isReady = true;
22457
- // Load workspaces from Yjs
22458
- this.loadFromYjs();
22459
- }
22460
- /**
22461
- * Handles changes to the Yjs workspaces map.
22462
- * For local changes, only triggers a re-render. For remote changes, synchronizes
22463
- * the local map with the Yjs state by adding, updating, or deleting workspaces.
22464
- * @param event - The Yjs map event containing information about changed keys.
22465
- */
22466
- handleWorkspacesChange(event) {
22467
- // Skip Map updates for local changes (already done), but still trigger re-render
22468
- if (event.transaction.origin === 'local') {
22469
- this._core?.rerender();
22470
- return;
22471
- }
22472
- const changedKeys = Array.from(event.keysChanged);
22473
- const workspacesToUpdate = [];
22474
- const workspacesToDelete = [];
22475
- changedKeys.forEach(key => {
22476
- const change = event.changes.keys.get(key);
22477
- if (change && change.action === 'delete') {
22478
- workspacesToDelete.push(key);
22479
- }
22480
- else {
22481
- const serialized = this._workspacesMap.get(key);
22482
- if (serialized) {
22483
- const workspace = this.reviveWorkspace(serialized);
22484
- workspacesToUpdate.push(workspace);
22485
- }
22486
- }
22487
- });
22488
- // Delete workspaces from local map
22489
- workspacesToDelete.forEach(workspaceId => {
22490
- this.map.delete(workspaceId);
22491
- });
22492
- // Update or insert workspaces
22493
- workspacesToUpdate.forEach(workspace => {
22494
- this.map.set(workspace.id, workspace);
22495
- });
22496
- // Update the store's workspace list to reflect remote changes
22497
- if (this._core?.store) {
22498
- this._core.store.state.workspaces = this.allWorkspaces();
22499
- }
22500
- // Notify about remote changes
22501
- if (this._onRemoteChangeCallback) {
22502
- this._onRemoteChangeCallback();
22503
- }
22504
- this._core?.rerender();
22505
- }
22506
- /**
22507
- * Reconstructs a KritzelWorkspace instance from its serialized form.
22508
- * Restores all properties including id, name, viewport, and timestamps.
22509
- * @param serialized - The serialized workspace data object.
22510
- * @returns A fully reconstructed KritzelWorkspace instance.
22511
- */
22512
- reviveWorkspace(serialized) {
22513
- const workspace = new KritzelWorkspace(serialized.id, serialized.name, serialized.viewport);
22514
- workspace._core = this._core;
22515
- workspace.createdAt = new Date(serialized.createdAt);
22516
- workspace.updatedAt = new Date(serialized.updatedAt);
22517
- return workspace;
22518
- }
22519
- /**
22520
- * Executes a callback within a Yjs transaction marked as 'local'.
22521
- * This allows batching multiple Yjs operations and identifying them as local changes.
22522
- * @param callback - The function containing Yjs operations to execute within the transaction.
22523
- */
22524
- transaction(callback) {
22525
- if (this._ydoc) {
22526
- this._ydoc.transact(callback, 'local');
22527
- }
22528
- }
22529
- /**
22530
- * Loads all workspaces from the Yjs map into the local map.
22531
- * Clears the existing local map and repopulates it by reviving each serialized workspace.
22532
- * This is typically called during initialization or when a full sync is needed.
22533
- */
22534
- loadFromYjs() {
22535
- if (!this._workspacesMap) {
22536
- return;
22537
- }
22538
- this.map.clear();
22539
- this._workspacesMap.forEach((serialized, key) => {
22540
- const workspace = this.reviveWorkspace(serialized);
22541
- this.map.set(key, workspace);
22542
- });
22543
- }
22544
- /**
22545
- * Resets the app state by clearing both the local map and the Yjs workspaces map.
22546
- * This operation is performed within a local transaction to avoid triggering remote sync callbacks.
22547
- */
22548
- reset() {
22549
- this.map.clear();
22550
- this._ydoc.transact(() => {
22551
- this._workspacesMap.clear();
22552
- }, 'local');
22553
- }
22554
- /**
22555
- * Inserts a new workspace into both the local map and the Yjs map.
22556
- * The workspace is serialized before being stored in Yjs for synchronization.
22557
- * @param workspace - The workspace to insert.
22558
- * @returns True if the workspace was successfully inserted, false if it has no id.
22559
- */
22560
- insert(workspace) {
22561
- if (!workspace.id) {
22562
- return false;
22563
- }
22564
- this.map.set(workspace.id, workspace);
22565
- if (this._workspacesMap) {
22566
- const serialized = workspace.serialize();
22567
- this._ydoc.transact(() => {
22568
- this._workspacesMap.set(workspace.id, serialized);
22569
- }, 'local');
22570
- }
22571
- return true;
22572
- }
22573
- /**
22574
- * Updates an existing workspace in both the local map and the Yjs map.
22575
- * The workspace must already exist in the map to be updated.
22576
- * @param workspace - The workspace with updated data.
22577
- * @returns True if the workspace was successfully updated, false if it doesn't exist or has no id.
22578
- */
22579
- update(workspace) {
22580
- if (!workspace.id || !this.map.has(workspace.id)) {
22581
- return false;
22582
- }
22583
- this.map.set(workspace.id, workspace);
22584
- if (this._workspacesMap) {
22585
- const serialized = workspace.serialize();
22586
- this._ydoc.transact(() => {
22587
- this._workspacesMap.set(workspace.id, serialized);
22588
- }, 'local');
22589
- }
22590
- return true;
22591
- }
22592
- /**
22593
- * Removes a workspace matching the given predicate from both the local map and the Yjs map.
22594
- * Only the first matching workspace will be removed.
22595
- * @param predicate - A function that returns true for the workspace to remove.
22596
- * @returns True if a matching workspace was found and removed, false otherwise.
22597
- */
22598
- remove(predicate) {
22599
- const workspaceToRemove = Array.from(this.map.values()).find(predicate);
22600
- if (!workspaceToRemove) {
22601
- return false;
22602
- }
22603
- this.map.delete(workspaceToRemove.id);
22604
- if (this._workspacesMap) {
22605
- this._ydoc.transact(() => {
22606
- this._workspacesMap.delete(workspaceToRemove.id);
22607
- }, 'local');
22608
- }
22609
- return true;
22610
- }
22611
- /**
22612
- * Retrieves a workspace by its unique identifier.
22613
- * @param id - The unique identifier of the workspace to retrieve.
22614
- * @returns The workspace if found, undefined otherwise.
22615
- */
22616
- get(id) {
22617
- return this.map.get(id);
22618
- }
22619
- /**
22620
- * Returns all workspaces currently stored in the map.
22621
- * @returns An array containing all workspaces.
22622
- */
22623
- allWorkspaces() {
22624
- return Array.from(this.map.values());
22625
- }
22626
- /**
22627
- * Filters workspaces based on a predicate function.
22628
- * @param predicate - A function that returns true for workspaces to include.
22629
- * @returns An array of workspaces that match the predicate.
22630
- */
22631
- filter(predicate) {
22632
- return Array.from(this.map.values()).filter(predicate);
22633
- }
22634
- /**
22635
- * Finds the first workspace matching the given predicate.
22636
- * @param predicate - A function that returns true for the workspace to find.
22637
- * @returns The first matching workspace, or undefined if no match is found.
22638
- */
22639
- find(predicate) {
22640
- return Array.from(this.map.values()).find(predicate);
22641
- }
22642
- /**
22643
- * Checks if a workspace with the given id exists in the map.
22644
- * @param id - The unique identifier of the workspace to check.
22645
- * @returns True if a workspace with the given id exists, false otherwise.
22646
- */
22647
- has(id) {
22648
- return this.map.has(id);
22649
- }
22650
- /**
22651
- * Destroys the app state map and releases all resources.
22652
- * Unobserves the Yjs workspaces map, disconnects and destroys all sync providers,
22653
- * clears all maps, destroys the Y.Doc, and resets all internal references.
22654
- * This should be called when the app state map is no longer needed.
22655
- */
22656
- destroy() {
22657
- // Unobserve the workspaces map
22658
- if (this._workspacesMap && this._workspacesObserver) {
22659
- this._workspacesMap.unobserve(this._workspacesObserver);
22660
- this._workspacesObserver = null;
22661
- }
22662
- // Disconnect and destroy all providers
22663
- this._providers.forEach(p => {
22664
- p.disconnect();
22665
- p.destroy();
22666
- });
22667
- this._providers = [];
22668
- // Clear maps
22669
- this.map.clear();
22670
- this._workspacesMap = null;
22671
- // Destroy Y.Doc
22672
- if (this._ydoc) {
22673
- this._ydoc.destroy();
22674
- this._ydoc = null;
22675
- }
22676
- // Clear remaining references
22677
- this._core = null;
22678
- this._onRemoteChangeCallback = null;
22679
- this._isReady = false;
22680
- }
22681
- }
22682
-
22683
22372
  /**
22684
22373
  * Manages anchor connections between line endpoints and other objects.
22685
22374
  * Maintains a runtime index for efficient reverse lookups and handles
@@ -24058,11 +23747,9 @@ exports.KritzelAlignment = void 0;
24058
23747
  exports.DEFAULT_BRUSH_CONFIG = DEFAULT_BRUSH_CONFIG;
24059
23748
  exports.DEFAULT_COLOR_PALETTE = DEFAULT_COLOR_PALETTE;
24060
23749
  exports.DEFAULT_LINE_TOOL_CONFIG = DEFAULT_LINE_TOOL_CONFIG;
24061
- exports.DEFAULT_SYNC_CONFIG = DEFAULT_SYNC_CONFIG;
24062
23750
  exports.DEFAULT_TEXT_CONFIG = DEFAULT_TEXT_CONFIG;
24063
23751
  exports.IndexedDBSyncProvider = IndexedDBSyncProvider;
24064
23752
  exports.KritzelAnchorManager = KritzelAnchorManager;
24065
- exports.KritzelAppStateMap = KritzelAppStateMap;
24066
23753
  exports.KritzelBaseHandler = KritzelBaseHandler;
24067
23754
  exports.KritzelBaseObject = KritzelBaseObject;
24068
23755
  exports.KritzelBaseTool = KritzelBaseTool;
@@ -132,10 +132,10 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
132
132
  }
133
133
  switch(bundleId) {
134
134
 
135
- case 'kritzel-back-to-content_34.cjs':
135
+ case 'kritzel-active-users_37.cjs':
136
136
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
137
137
  /* webpackMode: "lazy" */
138
- './kritzel-back-to-content_34.cjs.entry.js')); }).then(processMod, consoleError);
138
+ './kritzel-active-users_37.cjs.entry.js')); }).then(processMod, consoleError);
139
139
  case 'kritzel-brush-style.cjs':
140
140
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
141
141
  /* webpackMode: "lazy" */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var alignment_enum = require('./alignment.enum-Bk86Xzvb.js');
3
+ var alignment_enum = require('./alignment.enum-Dz9JvPvf.js');
4
4
  var Y = require('yjs');
5
5
  var yWebsocket = require('y-websocket');
6
6
  require('y-indexeddb');
@@ -3577,7 +3577,6 @@ Object.defineProperty(exports, "KritzelAlignment", {
3577
3577
  get: function () { return alignment_enum.KritzelAlignment; }
3578
3578
  });
3579
3579
  exports.KritzelAnchorManager = alignment_enum.KritzelAnchorManager;
3580
- exports.KritzelAppStateMap = alignment_enum.KritzelAppStateMap;
3581
3580
  exports.KritzelBrushTool = alignment_enum.KritzelBrushTool;
3582
3581
  exports.KritzelCursorHelper = alignment_enum.KritzelCursorHelper;
3583
3582
  exports.KritzelEraserTool = alignment_enum.KritzelEraserTool;