@mintjamsinc/ichigojs 0.1.51 → 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.
@@ -6935,6 +6935,8 @@ class ExpressionUtils {
6935
6935
  const allDependencies = new Set();
6936
6936
  const directDependencies = functionDependencies[funcName] || [];
6937
6937
  for (const dep of directDependencies) {
6938
+ if (dep === funcName)
6939
+ continue; // Skip self-references
6938
6940
  if (functions[dep]) {
6939
6941
  // It's a function, recursively resolve its dependencies
6940
6942
  const subDependencies = resolveDependencies(dep);
@@ -7883,7 +7885,7 @@ class ReactiveProxy {
7883
7885
  }
7884
7886
  // Create the proxy with path captured in closure
7885
7887
  const proxy = new Proxy(target, {
7886
- get(obj, key) {
7888
+ get(obj, key, receiver) {
7887
7889
  const value = Reflect.get(obj, key);
7888
7890
  // If the value is an object or array, make it reactive too
7889
7891
  if (typeof value === 'object' && value !== null) {
@@ -7902,16 +7904,22 @@ class ReactiveProxy {
7902
7904
  const nestedPath = path ? (Array.isArray(obj) ? `${path}[${keyStr}]` : `${path}.${keyStr}`) : keyStr;
7903
7905
  return ReactiveProxy.create(value, onChange, nestedPath);
7904
7906
  }
7905
- // For arrays, intercept mutation methods
7906
- if (Array.isArray(obj) && typeof value === 'function') {
7907
- const arrayMutationMethods = ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'];
7908
- if (arrayMutationMethods.includes(key)) {
7909
- return function (...args) {
7910
- const result = value.apply(obj, args);
7911
- onChange(path || undefined);
7912
- return result;
7913
- };
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');
7914
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
+ };
7915
7923
  }
7916
7924
  return value;
7917
7925
  },