domql 1.5.132 → 1.5.134

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "domql",
3
3
  "description": "DOM rendering Javascript framework at early stage.",
4
4
  "author": "symbo.ls",
5
- "version": "1.5.132",
5
+ "version": "1.5.134",
6
6
  "repository": "https://github.com/domql/domql",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org"
@@ -6,10 +6,7 @@ import { is, isObject, exec, isFunction, isUndefined } from '@domql/utils'
6
6
  import { deepClone, overwriteShallow, overwriteDeep } from '../utils'
7
7
 
8
8
  export const IGNORE_STATE_PARAMS = [
9
- 'update', 'parse', 'clean', 'create', 'parent', '__element', '__depends', '__ref', '__root',
10
- '__components',
11
- '__projectDesignSystem', '__projectState', '__projectComponents', '__projectPages', '__projectSnippets',
12
- 'projectStateUpdate', 'projectSystemUpdate'
9
+ 'update', 'parse', 'clean', 'create', 'parent', '__element', '__depends', '__ref', '__root', 'rootUpdate'
13
10
  ]
14
11
 
15
12
  export const parseState = function () {
@@ -33,20 +30,11 @@ export const cleanState = function () {
33
30
  return state
34
31
  }
35
32
 
36
- export const projectSystemUpdate = function (obj, options = {}) {
33
+ export const rootUpdate = function (obj, options = {}) {
37
34
  const state = this
38
35
  if (!state) return
39
- const rootState = (state.__element.__ref.__root || state.__element).state
40
- rootState.update({ PROJECT_DESIGN_SYSTEM: obj }, options)
41
- return state
42
- }
43
-
44
- export const projectStateUpdate = function (obj, options = {}) {
45
- const state = this
46
- if (!state) return
47
- const rootState = (state.__element.__ref.__root || state.__element).state
48
- rootState.update({ PROJECT_STATE: obj }, options)
49
- return state
36
+ const rootState = (state.__element.__ref.__root).state
37
+ return rootState.update(obj, options)
50
38
  }
51
39
 
52
40
  export const updateState = function (obj, options = {}) {
@@ -55,6 +43,8 @@ export const updateState = function (obj, options = {}) {
55
43
  const __elementRef = element.__ref
56
44
  state.parent = element.parent.state
57
45
 
46
+ for (const param in state) if (isUndefined(state[param])) delete state[param]
47
+
58
48
  if (!state.__element) createState(element, element.parent)
59
49
 
60
50
  // run `on.stateUpdated`
@@ -96,6 +86,8 @@ export const updateState = function (obj, options = {}) {
96
86
  if (!options.preventUpdateListener && element.on && isFunction(element.on.stateUpdated)) {
97
87
  on.stateUpdated(element.on.stateUpdated, element, state, obj)
98
88
  }
89
+
90
+ return state
99
91
  }
100
92
 
101
93
  export const createState = function (element, parent, opts) {
@@ -177,21 +169,12 @@ export const createState = function (element, parent, opts) {
177
169
  state.clean = cleanState
178
170
  state.parse = parseState
179
171
  state.update = updateState
172
+ state.rootUpdate = rootUpdate
180
173
  state.create = createState
181
174
  state.parent = element.parent.state
182
175
  state.__element = element
183
176
  state.__root = __elementRef.__root ? __elementRef.__root.state : state
184
177
 
185
- // editor stuff
186
- state.projectSystemUpdate = projectSystemUpdate
187
- state.projectStateUpdate = projectStateUpdate
188
- state.__components = state.__root.COMPONENTS
189
- state.__projectDesignSystem = state.__root.PROJECT_DESIGN_SYSTEM
190
- state.__projectState = state.__root.PROJECT_STATE
191
- state.__projectComponents = state.__root.PROJECT_COMPONENTS
192
- state.__projectPages = state.__root.PROJECT_PAGES
193
- state.__projectSnippets = state.__root.PROJECT_SNIPPETS
194
-
195
178
  // trigger `on.stateCreated`
196
179
  triggerEventOn('stateCreated', element)
197
180