mindcache 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MindCache, a as MindCacheOptions } from './CloudAdapter-CSncOr3V.mjs';
2
- export { A as AccessLevel, C as CloudAdapter, j as CloudAdapterEvents, h as CloudConfig, i as ConnectionState, D as DEFAULT_KEY_ATTRIBUTES, G as GlobalListener, H as HistoryEntry, e as HistoryOptions, K as KeyAttributes, b as KeyType, L as Listener, f as MindCacheCloudOptions, g as MindCacheIndexedDBOptions, c as STM, d as STMEntry, S as SystemTag } from './CloudAdapter-CSncOr3V.mjs';
1
+ import { M as MindCache, a as MindCacheOptions } from './CloudAdapter-BgpqZE00.mjs';
2
+ export { A as AccessLevel, C as CloudAdapter, j as CloudAdapterEvents, h as CloudConfig, i as ConnectionState, D as DEFAULT_KEY_ATTRIBUTES, G as GlobalListener, H as HistoryEntry, e as HistoryOptions, K as KeyAttributes, b as KeyType, L as Listener, f as MindCacheCloudOptions, g as MindCacheIndexedDBOptions, c as STM, d as STMEntry, S as SystemTag } from './CloudAdapter-BgpqZE00.mjs';
3
3
  import 'yjs';
4
4
 
5
5
  interface IndexedDBConfig {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MindCache, a as MindCacheOptions } from './CloudAdapter-CSncOr3V.js';
2
- export { A as AccessLevel, C as CloudAdapter, j as CloudAdapterEvents, h as CloudConfig, i as ConnectionState, D as DEFAULT_KEY_ATTRIBUTES, G as GlobalListener, H as HistoryEntry, e as HistoryOptions, K as KeyAttributes, b as KeyType, L as Listener, f as MindCacheCloudOptions, g as MindCacheIndexedDBOptions, c as STM, d as STMEntry, S as SystemTag } from './CloudAdapter-CSncOr3V.js';
1
+ import { M as MindCache, a as MindCacheOptions } from './CloudAdapter-BgpqZE00.js';
2
+ export { A as AccessLevel, C as CloudAdapter, j as CloudAdapterEvents, h as CloudConfig, i as ConnectionState, D as DEFAULT_KEY_ATTRIBUTES, G as GlobalListener, H as HistoryEntry, e as HistoryOptions, K as KeyAttributes, b as KeyType, L as Listener, f as MindCacheCloudOptions, g as MindCacheIndexedDBOptions, c as STM, d as STMEntry, S as SystemTag } from './CloudAdapter-BgpqZE00.js';
3
3
  import 'yjs';
4
4
 
5
5
  interface IndexedDBConfig {
package/dist/index.js CHANGED
@@ -429,7 +429,7 @@ var MindCache = class {
429
429
  listeners = {};
430
430
  globalListeners = [];
431
431
  // Metadata
432
- version = "3.1.0";
432
+ version = "3.3.1";
433
433
  // Internal flag to prevent sync loops when receiving remote updates
434
434
  // (Less critical with Yjs but kept for API compat)
435
435
  _isRemoteUpdate = false;
@@ -489,8 +489,22 @@ var MindCache = class {
489
489
  constructor(options) {
490
490
  this.doc = new Y__namespace.Doc();
491
491
  this.rootMap = this.doc.getMap("mindcache");
492
- this.rootMap.observe((event) => {
493
- event.keysChanged.forEach((key) => {
492
+ this.rootMap.observeDeep((events) => {
493
+ const keysAffected = /* @__PURE__ */ new Set();
494
+ events.forEach((event) => {
495
+ if (event.target === this.rootMap) {
496
+ const mapEvent = event;
497
+ mapEvent.keysChanged.forEach((key) => keysAffected.add(key));
498
+ } else if (event.target.parent === this.rootMap) {
499
+ for (const [key, val] of this.rootMap) {
500
+ if (val === event.target) {
501
+ keysAffected.add(key);
502
+ break;
503
+ }
504
+ }
505
+ }
506
+ });
507
+ keysAffected.forEach((key) => {
494
508
  const entryMap = this.rootMap.get(key);
495
509
  if (entryMap) {
496
510
  const value = entryMap.get("value");
@@ -503,8 +517,6 @@ var MindCache = class {
503
517
  }
504
518
  }
505
519
  });
506
- });
507
- this.rootMap.observeDeep((_events) => {
508
520
  this.notifyGlobalListeners();
509
521
  });
510
522
  this.initGlobalUndoManager();