@domql/state 2.5.64 → 2.5.69

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
@@ -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)) {
@@ -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("../"))
@@ -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 = {}) {
@@ -124,10 +124,7 @@ const toggle = function(key, options = {}) {
124
124
  };
125
125
  const remove = function(key, options = {}) {
126
126
  const state = this;
127
- if ((0, import_utils.isArray)(state))
128
- (0, import_utils.removeFromArray)(state, key);
129
- if ((0, import_utils.isObject)(state))
130
- (0, import_utils.removeFromObject)(state, key);
127
+ state[key] = null;
131
128
  return state.set(state.parse(), { replace: true, ...options });
132
129
  };
133
130
  const set = function(val, 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
@@ -6,7 +6,7 @@ import { IGNORE_STATE_PARAMS } from './ignore'
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) => {
package/methods.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { isArray, deepCloneWithExtend, isFunction, isObject, isString, removeFromArray, removeFromObject } from '@domql/utils'
3
+ import { isArray, deepCloneWithExtend, isFunction, isObject, isString } 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
 
@@ -102,8 +102,9 @@ export const toggle = function (key, options = {}) {
102
102
 
103
103
  export const remove = function (key, options = {}) {
104
104
  const state = this
105
- if (isArray(state)) removeFromArray(state, key)
106
- if (isObject(state)) removeFromObject(state, key)
105
+ // if (isArray(state)) removeFromArray(state, key)
106
+ // if (isObject(state)) removeFromObject(state, key)
107
+ state[key] = null
107
108
  return state.set(state.parse(), { replace: true, ...options })
108
109
  }
109
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.64",
3
+ "version": "2.5.69",
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": "ed8570ce73011589d920684013958c081147a39c"
34
+ "gitHead": "ee205b9ab7b486d6844338ba9417ec643055ae7f"
35
35
  }