@domql/state 2.5.56 → 2.5.65

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,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { triggerEventOn } from '@domql/event'
4
- import { deepCloneWithExtnd, exec, is, isArray, isFunction, isObject, isUndefined } from '@domql/utils'
4
+ import { deepCloneWithExtend, exec, is, isArray, isFunction, isObject, isUndefined } from '@domql/utils'
5
5
  import { IGNORE_STATE_PARAMS } from './ignore'
6
6
  import {
7
7
  add,
@@ -27,7 +27,7 @@ export const createState = function (element, parent, options) {
27
27
  export const applyInitialState = function (element, parent, options) {
28
28
  const objectizeState = checkForTypes(element)
29
29
  if (objectizeState === false) return parent.state || {}
30
- else element.state = deepCloneWithExtnd(objectizeState, IGNORE_STATE_PARAMS)
30
+ else element.state = deepCloneWithExtend(objectizeState, IGNORE_STATE_PARAMS)
31
31
 
32
32
  const whatInitReturns = triggerEventOn('stateInit', element, options)
33
33
  if (whatInitReturns === false) return element.state
@@ -51,7 +51,7 @@ export const applyInitialState = function (element, parent, options) {
51
51
  const applyDependentState = (element, state) => {
52
52
  const { __ref: ref } = state
53
53
  if (!ref) return
54
- const dependentState = deepCloneWithExtnd(ref, IGNORE_STATE_PARAMS)
54
+ const dependentState = deepCloneWithExtend(ref, IGNORE_STATE_PARAMS)
55
55
  const newDepends = { [element.key]: dependentState }
56
56
  ref.__depends = isObject(ref.__depends)
57
57
  ? { ...ref.__depends, ...newDepends }
@@ -111,7 +111,7 @@ const applyMethods = (element) => {
111
111
  parent: element.parent.state,
112
112
  __element: element,
113
113
  __children: {},
114
- __root: ref.__root ? ref.__root.state : state
114
+ root: ref.root ? ref.root.state : state
115
115
  }
116
116
 
117
117
  if (isArray(state)) {
@@ -37,7 +37,7 @@ const applyInitialState = function(element, parent, options) {
37
37
  if (objectizeState === false)
38
38
  return parent.state || {};
39
39
  else
40
- element.state = (0, import_utils.deepCloneWithExtnd)(objectizeState, import_ignore.IGNORE_STATE_PARAMS);
40
+ element.state = (0, import_utils.deepCloneWithExtend)(objectizeState, import_ignore.IGNORE_STATE_PARAMS);
41
41
  const whatInitReturns = (0, import_event.triggerEventOn)("stateInit", element, options);
42
42
  if (whatInitReturns === false)
43
43
  return element.state;
@@ -56,7 +56,7 @@ const applyDependentState = (element, state) => {
56
56
  const { __ref: ref } = state;
57
57
  if (!ref)
58
58
  return;
59
- const dependentState = (0, import_utils.deepCloneWithExtnd)(ref, import_ignore.IGNORE_STATE_PARAMS);
59
+ const dependentState = (0, import_utils.deepCloneWithExtend)(ref, import_ignore.IGNORE_STATE_PARAMS);
60
60
  const newDepends = { [element.key]: dependentState };
61
61
  ref.__depends = (0, import_utils.isObject)(ref.__depends) ? { ...ref.__depends, ...newDepends } : newDepends;
62
62
  return dependentState;
@@ -112,7 +112,7 @@ const applyMethods = (element) => {
112
112
  parent: element.parent.state,
113
113
  __element: element,
114
114
  __children: {},
115
- __root: ref.__root ? ref.__root.state : state
115
+ root: ref.root ? ref.root.state : state
116
116
  };
117
117
  if ((0, import_utils.isArray)(state)) {
118
118
  addProtoToArray(state, proto);
@@ -40,5 +40,5 @@ const IGNORE_STATE_PARAMS = [
40
40
  "__depends",
41
41
  "__ref",
42
42
  "__children",
43
- "__root"
43
+ "root"
44
44
  ];
@@ -35,7 +35,7 @@ const getRootStateInKey = (stateKey, parentState) => {
35
35
  return;
36
36
  const arr = stateKey.split("~/");
37
37
  if (arr.length > 1)
38
- return parentState.__root;
38
+ return parentState.root;
39
39
  };
40
40
  const getParentStateInKey = (stateKey, parentState) => {
41
41
  if (!stateKey.includes("../"))
@@ -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.deepCloneWithExtnd)(inheritedState, import_ignore.IGNORE_STATE_PARAMS);
99
+ return (0, import_utils.deepCloneWithExtend)(inheritedState, 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 };
@@ -105,7 +105,7 @@ const rootUpdate = function(obj, options = {}) {
105
105
  const state = this;
106
106
  if (!state)
107
107
  return;
108
- const rootState = state.__element.__ref.__root.state;
108
+ const rootState = state.__element.__ref.root.state;
109
109
  return rootState.update(obj, { isHoisted: false, ...options });
110
110
  };
111
111
  const add = function(value, options = {}) {
@@ -132,12 +132,12 @@ const remove = function(key, options = {}) {
132
132
  };
133
133
  const set = function(val, options = {}) {
134
134
  const state = this;
135
- const value = (0, import_utils.deepCloneWithExtnd)(val);
135
+ const value = (0, import_utils.deepCloneWithExtend)(val);
136
136
  return state.clean({ preventStateUpdate: true, ...options }).update(value, { replace: true, ...options });
137
137
  };
138
138
  const reset = function(options = {}) {
139
139
  const state = this;
140
- const value = (0, import_utils.deepCloneWithExtnd)(state.parse());
140
+ const value = (0, import_utils.deepCloneWithExtend)(state.parse());
141
141
  return state.set(value, { replace: true, ...options });
142
142
  };
143
143
  const apply = function(func, options = {}) {
package/ignore.js CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  export const IGNORE_STATE_PARAMS = [
4
4
  'update', 'parse', 'clean', 'create', 'destroy', 'add', 'toggle', 'remove', 'apply', 'set', 'reset',
5
- 'rootUpdate', 'parentUpdate', 'parent', '__element', '__depends', '__ref', '__children', '__root'
5
+ 'rootUpdate', 'parentUpdate', 'parent', '__element', '__depends', '__ref', '__children', 'root'
6
6
  ]
package/inherit.js CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict'
2
2
 
3
- import { deepCloneWithExtnd, is, isObjectLike, isUndefined } from '@domql/utils'
3
+ import { deepCloneWithExtend, is, isObjectLike, isUndefined } from '@domql/utils'
4
4
  import { IGNORE_STATE_PARAMS } from './ignore'
5
5
 
6
6
  export const getRootStateInKey = (stateKey, parentState) => {
7
7
  if (!stateKey.includes('~/')) return
8
8
  const arr = stateKey.split('~/')
9
- if (arr.length > 1) return parentState.__root
9
+ if (arr.length > 1) return parentState.root
10
10
  }
11
11
 
12
12
  export const getParentStateInKey = (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 deepCloneWithExtnd(inheritedState, IGNORE_STATE_PARAMS)
72
+ return deepCloneWithExtend(inheritedState, 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, deepCloneWithExtnd, isFunction, isObject, isString, removeFromArray, removeFromObject } from '@domql/utils'
3
+ import { isArray, deepCloneWithExtend, isFunction, isObject, isString, removeFromArray, removeFromObject } from '@domql/utils'
4
4
 
5
5
  import { IGNORE_STATE_PARAMS } from './ignore'
6
6
 
@@ -80,7 +80,7 @@ export const parentUpdate = function (obj, options = {}) {
80
80
  export const rootUpdate = function (obj, options = {}) {
81
81
  const state = this
82
82
  if (!state) return
83
- const rootState = (state.__element.__ref.__root).state
83
+ const rootState = (state.__element.__ref.root).state
84
84
  return rootState.update(obj, { isHoisted: false, ...options })
85
85
  }
86
86
 
@@ -109,14 +109,14 @@ export const remove = function (key, options = {}) {
109
109
 
110
110
  export const set = function (val, options = {}) {
111
111
  const state = this
112
- const value = deepCloneWithExtnd(val)
112
+ const value = deepCloneWithExtend(val)
113
113
  return state.clean({ preventStateUpdate: true, ...options })
114
114
  .update(value, { replace: true, ...options })
115
115
  }
116
116
 
117
117
  export const reset = function (options = {}) {
118
118
  const state = this
119
- const value = deepCloneWithExtnd(state.parse())
119
+ const value = deepCloneWithExtend(state.parse())
120
120
  return state.set(value, { replace: true, ...options })
121
121
  }
122
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.56",
3
+ "version": "2.5.65",
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": "a832fd0b6d8c39f16e6c7b2b61ab6c3dccd1f539"
34
+ "gitHead": "473e5569815c8e062b8e584549889557330c249a"
35
35
  }