@domql/state 2.5.159 → 2.5.161
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 +2 -2
- package/dist/cjs/create.js +1 -1
- package/dist/cjs/inherit.js +1 -1
- package/dist/cjs/methods.js +2 -2
- package/inherit.js +2 -2
- package/methods.js +3 -3
- package/package.json +4 -4
package/create.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { triggerEventOn } from '@domql/event'
|
|
4
|
-
import {
|
|
4
|
+
import { deepClone, exec, is, isArray, isFunction, isObject, isUndefined } from '@domql/utils'
|
|
5
5
|
import { IGNORE_STATE_PARAMS } from './ignore'
|
|
6
6
|
import {
|
|
7
7
|
add,
|
|
@@ -59,7 +59,7 @@ const applyDependentState = (element, state) => {
|
|
|
59
59
|
const { __ref, ref, __element } = state //
|
|
60
60
|
const origState = exec(__ref || ref || __element?.state, element)
|
|
61
61
|
if (!origState) return
|
|
62
|
-
const dependentState =
|
|
62
|
+
const dependentState = deepClone(origState, IGNORE_STATE_PARAMS)
|
|
63
63
|
const newDepends = { [element.key]: dependentState }
|
|
64
64
|
|
|
65
65
|
const __depends = isObject(origState.__depends)
|
package/dist/cjs/create.js
CHANGED
|
@@ -57,7 +57,7 @@ const applyDependentState = (element, state) => {
|
|
|
57
57
|
const origState = (0, import_utils.exec)(__ref || ref || (__element == null ? void 0 : __element.state), element);
|
|
58
58
|
if (!origState)
|
|
59
59
|
return;
|
|
60
|
-
const dependentState = (0, import_utils.
|
|
60
|
+
const dependentState = (0, import_utils.deepClone)(origState, import_ignore.IGNORE_STATE_PARAMS);
|
|
61
61
|
const newDepends = { [element.key]: dependentState };
|
|
62
62
|
const __depends = (0, import_utils.isObject)(origState.__depends) ? { ...origState.__depends, ...newDepends } : newDepends;
|
|
63
63
|
if (Array.isArray(origState)) {
|
package/dist/cjs/inherit.js
CHANGED
|
@@ -96,7 +96,7 @@ const createInheritedState = (element, parent) => {
|
|
|
96
96
|
if ((0, import_utils.isUndefined)(inheritedState))
|
|
97
97
|
return element.state;
|
|
98
98
|
if ((0, import_utils.is)(inheritedState)("object", "array")) {
|
|
99
|
-
return (0, import_utils.
|
|
99
|
+
return (0, import_utils.deepClone)(inheritedState, { exclude: import_ignore.IGNORE_STATE_PARAMS });
|
|
100
100
|
} else if ((0, import_utils.is)(inheritedState)("string", "number", "boolean")) {
|
|
101
101
|
ref.__stateType = typeof inheritedState;
|
|
102
102
|
return { value: inheritedState };
|
package/dist/cjs/methods.js
CHANGED
|
@@ -136,12 +136,12 @@ const remove = function(key, options = {}) {
|
|
|
136
136
|
};
|
|
137
137
|
const set = function(val, options = {}) {
|
|
138
138
|
const state = this;
|
|
139
|
-
const value = (0, import_utils.
|
|
139
|
+
const value = (0, import_utils.deepClone)(val);
|
|
140
140
|
return state.clean({ preventStateUpdate: true, ...options }).update(value, { replace: true, ...options });
|
|
141
141
|
};
|
|
142
142
|
const reset = function(options = {}) {
|
|
143
143
|
const state = this;
|
|
144
|
-
const value = (0, import_utils.
|
|
144
|
+
const value = (0, import_utils.deepClone)(state.parse());
|
|
145
145
|
return state.set(value, { replace: true, ...options });
|
|
146
146
|
};
|
|
147
147
|
const apply = function(func, options = {}) {
|
package/inherit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { deepClone, is, isObjectLike, isUndefined } from '@domql/utils'
|
|
4
4
|
import { IGNORE_STATE_PARAMS } from './ignore'
|
|
5
5
|
|
|
6
6
|
export const getRootStateInKey = (stateKey, parentState) => {
|
|
@@ -69,7 +69,7 @@ export const createInheritedState = (element, parent) => {
|
|
|
69
69
|
if (isUndefined(inheritedState)) return element.state
|
|
70
70
|
|
|
71
71
|
if (is(inheritedState)('object', 'array')) {
|
|
72
|
-
return
|
|
72
|
+
return deepClone(inheritedState, { exclude: IGNORE_STATE_PARAMS })
|
|
73
73
|
} else if (is(inheritedState)('string', 'number', 'boolean')) {
|
|
74
74
|
ref.__stateType = typeof inheritedState
|
|
75
75
|
return { value: inheritedState }
|
package/methods.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { isArray,
|
|
3
|
+
import { isArray, deepClone, isFunction, isObject, isString } from '@domql/utils'
|
|
4
4
|
|
|
5
5
|
import { IGNORE_STATE_PARAMS } from './ignore'
|
|
6
6
|
|
|
@@ -110,14 +110,14 @@ export const remove = function (key, options = {}) {
|
|
|
110
110
|
|
|
111
111
|
export const set = function (val, options = {}) {
|
|
112
112
|
const state = this
|
|
113
|
-
const value =
|
|
113
|
+
const value = deepClone(val)
|
|
114
114
|
return state.clean({ preventStateUpdate: true, ...options })
|
|
115
115
|
.update(value, { replace: true, ...options })
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export const reset = function (options = {}) {
|
|
119
119
|
const state = this
|
|
120
|
-
const value =
|
|
120
|
+
const value = deepClone(state.parse())
|
|
121
121
|
return state.set(value, { replace: true, ...options })
|
|
122
122
|
}
|
|
123
123
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/state",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.161",
|
|
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.
|
|
30
|
+
"@domql/event": "^2.5.161",
|
|
31
31
|
"@domql/report": "^2.5.0",
|
|
32
|
-
"@domql/utils": "^2.5.
|
|
32
|
+
"@domql/utils": "^2.5.161"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "39a7af3d77c6b0257d5e1a0d6110850926d83c19"
|
|
35
35
|
}
|