@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.
package/dist/ichigo.cjs CHANGED
@@ -6941,6 +6941,8 @@
6941
6941
  const allDependencies = new Set();
6942
6942
  const directDependencies = functionDependencies[funcName] || [];
6943
6943
  for (const dep of directDependencies) {
6944
+ if (dep === funcName)
6945
+ continue; // Skip self-references
6944
6946
  if (functions[dep]) {
6945
6947
  // It's a function, recursively resolve its dependencies
6946
6948
  const subDependencies = resolveDependencies(dep);
@@ -7889,7 +7891,7 @@
7889
7891
  }
7890
7892
  // Create the proxy with path captured in closure
7891
7893
  const proxy = new Proxy(target, {
7892
- get(obj, key) {
7894
+ get(obj, key, receiver) {
7893
7895
  const value = Reflect.get(obj, key);
7894
7896
  // If the value is an object or array, make it reactive too
7895
7897
  if (typeof value === 'object' && value !== null) {
@@ -7908,16 +7910,22 @@
7908
7910
  const nestedPath = path ? (Array.isArray(obj) ? `${path}[${keyStr}]` : `${path}.${keyStr}`) : keyStr;
7909
7911
  return ReactiveProxy.create(value, onChange, nestedPath);
7910
7912
  }
7911
- // For arrays, intercept mutation methods
7912
- if (Array.isArray(obj) && typeof value === 'function') {
7913
- const arrayMutationMethods = ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'];
7914
- if (arrayMutationMethods.includes(key)) {
7915
- return function (...args) {
7916
- const result = value.apply(obj, args);
7917
- onChange(path || undefined);
7918
- return result;
7919
- };
7913
+ // For arrays and Maps, intercept mutation methods
7914
+ if (typeof value === 'function') {
7915
+ let mutationMethods = [];
7916
+ if (Array.isArray(obj)) {
7917
+ mutationMethods.push('push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse');
7918
+ }
7919
+ else if (obj.constructor.name === 'Map') {
7920
+ mutationMethods.push('set', 'delete', 'clear');
7920
7921
  }
7922
+ return function (...args) {
7923
+ const result = value.apply(this === receiver ? obj : this, args);
7924
+ if (mutationMethods.includes(key)) {
7925
+ onChange(path || undefined);
7926
+ }
7927
+ return result;
7928
+ };
7921
7929
  }
7922
7930
  return value;
7923
7931
  },