@domql/state 2.5.181 → 2.5.184
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 +6 -6
- package/dist/cjs/create.js +6 -6
- package/dist/cjs/methods.js +1 -1
- package/methods.js +1 -1
- package/package.json +4 -4
package/create.js
CHANGED
|
@@ -31,13 +31,13 @@ import {
|
|
|
31
31
|
import { updateState } from './updateState'
|
|
32
32
|
import { checkIfInherits, createInheritedState } from './inherit'
|
|
33
33
|
|
|
34
|
-
export const createState = function (element, parent, options) {
|
|
35
|
-
element.state = applyInitialState(element, parent, options)
|
|
34
|
+
export const createState = async function (element, parent, options) {
|
|
35
|
+
element.state = await applyInitialState(element, parent, options)
|
|
36
36
|
return element.state
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export const applyInitialState = function (element, parent, options) {
|
|
40
|
-
const objectizeState = checkForTypes(element)
|
|
39
|
+
export const applyInitialState = async function (element, parent, options) {
|
|
40
|
+
const objectizeState = await checkForTypes(element)
|
|
41
41
|
if (objectizeState === false) return parent.state || {}
|
|
42
42
|
else element.state = objectizeState
|
|
43
43
|
|
|
@@ -80,12 +80,12 @@ const applyDependentState = (element, state) => {
|
|
|
80
80
|
return dependentState
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const checkForTypes = (element) => {
|
|
83
|
+
const checkForTypes = async (element) => {
|
|
84
84
|
const { state: orig, props, __ref: ref } = element
|
|
85
85
|
const state = props?.state || orig
|
|
86
86
|
if (isFunction(state)) {
|
|
87
87
|
ref.__state = state
|
|
88
|
-
return exec(state, element)
|
|
88
|
+
return await exec(state, element)
|
|
89
89
|
} else if (is(state)('string', 'number')) {
|
|
90
90
|
ref.__state = state
|
|
91
91
|
return { value: state }
|
package/dist/cjs/create.js
CHANGED
|
@@ -28,12 +28,12 @@ var import_ignore = require("./ignore");
|
|
|
28
28
|
var import_methods = require("./methods");
|
|
29
29
|
var import_updateState = require("./updateState");
|
|
30
30
|
var import_inherit = require("./inherit");
|
|
31
|
-
const createState = function(element, parent, options) {
|
|
32
|
-
element.state = applyInitialState(element, parent, options);
|
|
31
|
+
const createState = async function(element, parent, options) {
|
|
32
|
+
element.state = await applyInitialState(element, parent, options);
|
|
33
33
|
return element.state;
|
|
34
34
|
};
|
|
35
|
-
const applyInitialState = function(element, parent, options) {
|
|
36
|
-
const objectizeState = checkForTypes(element);
|
|
35
|
+
const applyInitialState = async function(element, parent, options) {
|
|
36
|
+
const objectizeState = await checkForTypes(element);
|
|
37
37
|
if (objectizeState === false)
|
|
38
38
|
return parent.state || {};
|
|
39
39
|
else
|
|
@@ -67,12 +67,12 @@ const applyDependentState = (element, state) => {
|
|
|
67
67
|
}
|
|
68
68
|
return dependentState;
|
|
69
69
|
};
|
|
70
|
-
const checkForTypes = (element) => {
|
|
70
|
+
const checkForTypes = async (element) => {
|
|
71
71
|
const { state: orig, props, __ref: ref } = element;
|
|
72
72
|
const state = (props == null ? void 0 : props.state) || orig;
|
|
73
73
|
if ((0, import_utils.isFunction)(state)) {
|
|
74
74
|
ref.__state = state;
|
|
75
|
-
return (0, import_utils.exec)(state, element);
|
|
75
|
+
return await (0, import_utils.exec)(state, element);
|
|
76
76
|
} else if ((0, import_utils.is)(state)("string", "number")) {
|
|
77
77
|
ref.__state = state;
|
|
78
78
|
return { value: state };
|
package/dist/cjs/methods.js
CHANGED
|
@@ -161,7 +161,7 @@ const setByPath = function(path, val, options = {}) {
|
|
|
161
161
|
const setPathCollection = function(changes, options = {}) {
|
|
162
162
|
const state = this;
|
|
163
163
|
const update = changes.reduce((acc, change) => {
|
|
164
|
-
const result = setByPath(...change, { preventUpdate: true });
|
|
164
|
+
const result = setByPath(...change.slice(1), { preventUpdate: true });
|
|
165
165
|
return (0, import_utils.overwriteDeep)(acc, result);
|
|
166
166
|
}, {});
|
|
167
167
|
return state.update(update, options);
|
package/methods.js
CHANGED
|
@@ -140,7 +140,7 @@ export const setByPath = function (path, val, options = {}) {
|
|
|
140
140
|
export const setPathCollection = function (changes, options = {}) {
|
|
141
141
|
const state = this
|
|
142
142
|
const update = changes.reduce((acc, change) => {
|
|
143
|
-
const result = setByPath(...change, { preventUpdate: true })
|
|
143
|
+
const result = setByPath(...change.slice(1), { preventUpdate: true })
|
|
144
144
|
return overwriteDeep(acc, result)
|
|
145
145
|
}, {})
|
|
146
146
|
return state.update(update, options)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/state",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.184",
|
|
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 && npm run build && npm run copy:package:cjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@domql/event": "^2.5.
|
|
30
|
+
"@domql/event": "^2.5.184",
|
|
31
31
|
"@domql/report": "^2.5.162",
|
|
32
|
-
"@domql/utils": "^2.5.
|
|
32
|
+
"@domql/utils": "^2.5.184"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "d8fb0c7460a5bed587290d7c88c0f4ca291794e8"
|
|
35
35
|
}
|