@domql/state 2.5.16 → 2.5.18

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.
@@ -75,7 +75,19 @@ const destroy = function(options = {}) {
75
75
  for (const key in state.__children) {
76
76
  const child = state.__children[key];
77
77
  if (child.state) {
78
- child.parent = state.parent;
78
+ if ((0, import_utils.isArray)(child.state)) {
79
+ Object.defineProperty(child.state, "parent", {
80
+ value: state.parent,
81
+ enumerable: false,
82
+ // Set this to true if you want the method to appear in for...in loops
83
+ configurable: true,
84
+ // Set this to true if you want to allow redefining/removing the property later
85
+ writable: true
86
+ // Set this to true if you want to allow changing the function later
87
+ });
88
+ } else {
89
+ Object.setPrototypeOf(child, { parent: state.parent });
90
+ }
79
91
  }
80
92
  }
81
93
  }
@@ -31,8 +31,7 @@ const STATE_UPDATE_OPTIONS = {
31
31
  preventHoistElementUpdate: false,
32
32
  updateByState: true,
33
33
  isHoisted: true,
34
- execStateFunction: true,
35
- stateFunctionOverwrite: true
34
+ execStateFunction: true
36
35
  };
37
36
  const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
38
37
  const state = this;
@@ -96,7 +95,6 @@ const hoistStateUpdate = (state, obj, options) => {
96
95
  targetParent[stateKey] = value;
97
96
  targetParent.update(changesValue, {
98
97
  execStateFunction: false,
99
- stateFunctionOverwrite: false,
100
98
  isHoisted: true,
101
99
  ...options,
102
100
  preventUpdate: options.preventHoistElementUpdate,
package/methods.js CHANGED
@@ -53,7 +53,16 @@ export const destroy = function (options = {}) {
53
53
  for (const key in state.__children) {
54
54
  const child = state.__children[key]
55
55
  if (child.state) {
56
- child.parent = state.parent
56
+ if (isArray(child.state)) {
57
+ Object.defineProperty(child.state, 'parent', {
58
+ value: state.parent,
59
+ enumerable: false, // Set this to true if you want the method to appear in for...in loops
60
+ configurable: true, // Set this to true if you want to allow redefining/removing the property later
61
+ writable: true // Set this to true if you want to allow changing the function later
62
+ })
63
+ } else {
64
+ Object.setPrototypeOf(child, { parent: state.parent })
65
+ }
57
66
  }
58
67
  }
59
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.16",
3
+ "version": "2.5.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -31,5 +31,5 @@
31
31
  "@domql/report": "latest",
32
32
  "@domql/utils": "latest"
33
33
  },
34
- "gitHead": "2987c1965a4cab0258feb592d273d519260f5461"
34
+ "gitHead": "4aeead0b153d4cd5430694ecf45a5d3052f9f9f5"
35
35
  }
package/updateState.js CHANGED
@@ -11,8 +11,7 @@ const STATE_UPDATE_OPTIONS = {
11
11
  preventHoistElementUpdate: false,
12
12
  updateByState: true,
13
13
  isHoisted: true,
14
- execStateFunction: true,
15
- stateFunctionOverwrite: true
14
+ execStateFunction: true
16
15
  }
17
16
 
18
17
  export const updateState = function (obj, options = STATE_UPDATE_OPTIONS) {
@@ -84,7 +83,6 @@ const hoistStateUpdate = (state, obj, options) => {
84
83
  if (options.replace) targetParent[stateKey] = value
85
84
  targetParent.update(changesValue, {
86
85
  execStateFunction: false,
87
- stateFunctionOverwrite: false,
88
86
  isHoisted: true,
89
87
  ...options,
90
88
  preventUpdate: options.preventHoistElementUpdate,