@mintjamsinc/ichigojs 0.1.52 → 0.1.53

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.
@@ -7885,7 +7885,7 @@ class ReactiveProxy {
7885
7885
  }
7886
7886
  // Create the proxy with path captured in closure
7887
7887
  const proxy = new Proxy(target, {
7888
- get(obj, key) {
7888
+ get(obj, key, receiver) {
7889
7889
  const value = Reflect.get(obj, key);
7890
7890
  // If the value is an object or array, make it reactive too
7891
7891
  if (typeof value === 'object' && value !== null) {
@@ -7904,16 +7904,22 @@ class ReactiveProxy {
7904
7904
  const nestedPath = path ? (Array.isArray(obj) ? `${path}[${keyStr}]` : `${path}.${keyStr}`) : keyStr;
7905
7905
  return ReactiveProxy.create(value, onChange, nestedPath);
7906
7906
  }
7907
- // For arrays, intercept mutation methods
7908
- if (Array.isArray(obj) && typeof value === 'function') {
7909
- const arrayMutationMethods = ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'];
7910
- if (arrayMutationMethods.includes(key)) {
7911
- return function (...args) {
7912
- const result = value.apply(obj, args);
7913
- onChange(path || undefined);
7914
- return result;
7915
- };
7907
+ // For arrays and Maps, intercept mutation methods
7908
+ if (typeof value === 'function') {
7909
+ let mutationMethods = [];
7910
+ if (Array.isArray(obj)) {
7911
+ mutationMethods.push('push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse');
7912
+ }
7913
+ else if (obj.constructor.name === 'Map') {
7914
+ mutationMethods.push('set', 'delete', 'clear');
7916
7915
  }
7916
+ return function (...args) {
7917
+ const result = value.apply(this === receiver ? obj : this, args);
7918
+ if (mutationMethods.includes(key)) {
7919
+ onChange(path || undefined);
7920
+ }
7921
+ return result;
7922
+ };
7917
7923
  }
7918
7924
  return value;
7919
7925
  },