@domql/state 2.29.77 → 2.29.79

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/create.js CHANGED
@@ -1,7 +1,15 @@
1
1
  'use strict'
2
2
 
3
3
  import { triggerEventOn } from '@domql/event'
4
- import { deepClone, exec, is, isArray, isFunction, isObject, isUndefined } from '@domql/utils'
4
+ import {
5
+ deepClone,
6
+ exec,
7
+ is,
8
+ isArray,
9
+ isFunction,
10
+ isObject,
11
+ isUndefined
12
+ } from '@domql/utils'
5
13
  import { IGNORE_STATE_PARAMS } from './ignore.js'
6
14
  import {
7
15
  add,
@@ -49,7 +57,10 @@ export const applyInitialState = async function (element, parent, options) {
49
57
  element.state = isUndefined(inheritedState) ? {} : inheritedState
50
58
  }
51
59
 
52
- const dependentState = applyDependentState(element, element.state || parent.state || {})
60
+ const dependentState = applyDependentState(
61
+ element,
62
+ element.state || parent.state || {}
63
+ )
53
64
  if (dependentState) element.state = dependentState
54
65
 
55
66
  applyMethods(element)
@@ -65,16 +76,22 @@ const applyDependentState = (element, state) => {
65
76
  const origState = exec(__ref || ref || __element?.state, element)
66
77
  if (!origState) return
67
78
  const dependentState = deepClone(origState, IGNORE_STATE_PARAMS)
68
- const newDepends = { [element.key]: dependentState }
79
+ const newDepends = { [element.key + Math.random()]: dependentState }
69
80
 
70
81
  const __depends = isObject(origState.__depends)
71
82
  ? { ...origState.__depends, ...newDepends }
72
83
  : newDepends
73
84
 
74
85
  if (Array.isArray(origState)) {
75
- addProtoToArray(origState, { ...Object.getPrototypeOf(origState), __depends })
86
+ addProtoToArray(origState, {
87
+ ...Object.getPrototypeOf(origState),
88
+ __depends
89
+ })
76
90
  } else {
77
- Object.setPrototypeOf(origState, { ...Object.getPrototypeOf(origState), __depends })
91
+ Object.setPrototypeOf(origState, {
92
+ ...Object.getPrototypeOf(origState),
93
+ __depends
94
+ })
78
95
  }
79
96
 
80
97
  return dependentState
@@ -155,5 +172,7 @@ const applyMethods = (element) => {
155
172
  Object.setPrototypeOf(state, proto)
156
173
  }
157
174
 
158
- if (state.parent && state.parent.__children) { state.parent.__children[element.key] = state }
175
+ if (state.parent && state.parent.__children) {
176
+ state.parent.__children[element.key] = state
177
+ }
159
178
  }
@@ -42,7 +42,10 @@ const applyInitialState = async function(element, parent, options) {
42
42
  const inheritedState = (0, import_inherit.createInheritedState)(element, parent);
43
43
  element.state = (0, import_utils.isUndefined)(inheritedState) ? {} : inheritedState;
44
44
  }
45
- const dependentState = applyDependentState(element, element.state || parent.state || {});
45
+ const dependentState = applyDependentState(
46
+ element,
47
+ element.state || parent.state || {}
48
+ );
46
49
  if (dependentState) element.state = dependentState;
47
50
  applyMethods(element);
48
51
  await (0, import_event.triggerEventOn)("stateCreated", element);
@@ -53,12 +56,18 @@ const applyDependentState = (element, state) => {
53
56
  const origState = (0, import_utils.exec)(__ref || ref || (__element == null ? void 0 : __element.state), element);
54
57
  if (!origState) return;
55
58
  const dependentState = (0, import_utils.deepClone)(origState, import_ignore.IGNORE_STATE_PARAMS);
56
- const newDepends = { [element.key]: dependentState };
59
+ const newDepends = { [element.key + Math.random()]: dependentState };
57
60
  const __depends = (0, import_utils.isObject)(origState.__depends) ? { ...origState.__depends, ...newDepends } : newDepends;
58
61
  if (Array.isArray(origState)) {
59
- addProtoToArray(origState, { ...Object.getPrototypeOf(origState), __depends });
62
+ addProtoToArray(origState, {
63
+ ...Object.getPrototypeOf(origState),
64
+ __depends
65
+ });
60
66
  } else {
61
- Object.setPrototypeOf(origState, { ...Object.getPrototypeOf(origState), __depends });
67
+ Object.setPrototypeOf(origState, {
68
+ ...Object.getPrototypeOf(origState),
69
+ __depends
70
+ });
62
71
  }
63
72
  return dependentState;
64
73
  };
@@ -18,7 +18,15 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { triggerEventOn } from "@domql/event";
21
- import { deepClone, exec, is, isArray, isFunction, isObject, isUndefined } from "@domql/utils";
21
+ import {
22
+ deepClone,
23
+ exec,
24
+ is,
25
+ isArray,
26
+ isFunction,
27
+ isObject,
28
+ isUndefined
29
+ } from "@domql/utils";
22
30
  import { IGNORE_STATE_PARAMS } from "./ignore.js";
23
31
  import {
24
32
  add,
@@ -61,7 +69,10 @@ const applyInitialState = async function(element, parent, options) {
61
69
  const inheritedState = createInheritedState(element, parent);
62
70
  element.state = isUndefined(inheritedState) ? {} : inheritedState;
63
71
  }
64
- const dependentState = applyDependentState(element, element.state || parent.state || {});
72
+ const dependentState = applyDependentState(
73
+ element,
74
+ element.state || parent.state || {}
75
+ );
65
76
  if (dependentState) element.state = dependentState;
66
77
  applyMethods(element);
67
78
  await triggerEventOn("stateCreated", element);
@@ -72,12 +83,16 @@ const applyDependentState = (element, state) => {
72
83
  const origState = exec(__ref || ref || (__element == null ? void 0 : __element.state), element);
73
84
  if (!origState) return;
74
85
  const dependentState = deepClone(origState, IGNORE_STATE_PARAMS);
75
- const newDepends = { [element.key]: dependentState };
86
+ const newDepends = { [element.key + Math.random()]: dependentState };
76
87
  const __depends = isObject(origState.__depends) ? __spreadValues(__spreadValues({}, origState.__depends), newDepends) : newDepends;
77
88
  if (Array.isArray(origState)) {
78
- addProtoToArray(origState, __spreadProps(__spreadValues({}, Object.getPrototypeOf(origState)), { __depends }));
89
+ addProtoToArray(origState, __spreadProps(__spreadValues({}, Object.getPrototypeOf(origState)), {
90
+ __depends
91
+ }));
79
92
  } else {
80
- Object.setPrototypeOf(origState, __spreadProps(__spreadValues({}, Object.getPrototypeOf(origState)), { __depends }));
93
+ Object.setPrototypeOf(origState, __spreadProps(__spreadValues({}, Object.getPrototypeOf(origState)), {
94
+ __depends
95
+ }));
81
96
  }
82
97
  return dependentState;
83
98
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.29.77",
3
+ "version": "2.29.79",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -28,9 +28,9 @@
28
28
  "prepublish": "npx rimraf -I dist && npm run build && npm run copy:package:cjs"
29
29
  },
30
30
  "dependencies": {
31
- "@domql/event": "^2.29.77",
32
- "@domql/report": "^2.29.77",
33
- "@domql/utils": "^2.29.77"
31
+ "@domql/event": "^2.29.79",
32
+ "@domql/report": "^2.29.79",
33
+ "@domql/utils": "^2.29.79"
34
34
  },
35
- "gitHead": "576ad1140f3bbb46be9531ec57c50136bcd5d2f1"
35
+ "gitHead": "aefa41e70ddc76983c23822905afa22a2b944299"
36
36
  }