@domql/state 2.5.134 → 2.5.139

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
@@ -44,7 +44,7 @@ export const applyInitialState = function (element, parent, options) {
44
44
  element.state = isUndefined(inheritedState) ? {} : inheritedState
45
45
  }
46
46
 
47
- const dependentState = applyDependentState(element, element.state)
47
+ const dependentState = applyDependentState(element, element.state || parent.state || {})
48
48
  if (dependentState) element.state = dependentState
49
49
 
50
50
  applyMethods(element)
@@ -76,7 +76,8 @@ const applyDependentState = (element, state) => {
76
76
  }
77
77
 
78
78
  const checkForTypes = (element) => {
79
- const { state, __ref: ref } = element
79
+ const { state: orig, props, __ref: ref } = element
80
+ const state = props?.state || orig
80
81
  if (isFunction(state)) {
81
82
  ref.__state = state
82
83
  return exec(state, element)
@@ -45,7 +45,7 @@ const applyInitialState = function(element, parent, options) {
45
45
  const inheritedState = (0, import_inherit.createInheritedState)(element, parent);
46
46
  element.state = (0, import_utils.isUndefined)(inheritedState) ? {} : inheritedState;
47
47
  }
48
- const dependentState = applyDependentState(element, element.state);
48
+ const dependentState = applyDependentState(element, element.state || parent.state || {});
49
49
  if (dependentState)
50
50
  element.state = dependentState;
51
51
  applyMethods(element);
@@ -68,7 +68,8 @@ const applyDependentState = (element, state) => {
68
68
  return dependentState;
69
69
  };
70
70
  const checkForTypes = (element) => {
71
- const { state, __ref: ref } = element;
71
+ const { state: orig, props, __ref: ref } = element;
72
+ const state = (props == null ? void 0 : props.state) || orig;
72
73
  if ((0, import_utils.isFunction)(state)) {
73
74
  ref.__state = state;
74
75
  return (0, import_utils.exec)(state, element);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.134",
3
+ "version": "2.5.139",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -27,9 +27,9 @@
27
27
  "prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/event": "^2.5.134",
30
+ "@domql/event": "^2.5.139",
31
31
  "@domql/report": "^2.5.0",
32
- "@domql/utils": "^2.5.134"
32
+ "@domql/utils": "^2.5.139"
33
33
  },
34
- "gitHead": "20e65426dc742448bd6dc85211dea3a48ed74ae0"
34
+ "gitHead": "db49c6131a93bd7e9c1f1c95bc5de7752a8f48d1"
35
35
  }