domql 1.5.45 → 1.5.47

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
@@ -3,7 +3,7 @@
3
3
  "description": "DOM rendering Javascript framework at early stage.",
4
4
  "private": false,
5
5
  "author": "symbo.ls",
6
- "version": "1.5.45",
6
+ "version": "1.5.47",
7
7
  "repository": "https://github.com/domql/domql",
8
8
  "publishConfig": {
9
9
  "registry": "https://registry.npmjs.org"
@@ -59,18 +59,22 @@ const create = (element, parent, key, options = OPTIONS.create || {}) => {
59
59
 
60
60
  if (isKeyComponent(assignedKey)) {
61
61
  const hasComponentAttrs = extend || childExtend || props || state || element.on
62
+ const [ component, key ] = assignedKey.split('_')
62
63
  if (!hasComponentAttrs || childProps) {
63
64
  parent[assignedKey] = element = {
64
- extend: assignedKey.split('_')[0],
65
+ extend: component,
65
66
  props: {
66
- fromKey: assignedKey.split('_')[1],
67
+ fromKey: key,
67
68
  ...element
68
69
  }
69
70
  }
70
71
  } else if (!extend || extend === true) {
71
72
  parent[assignedKey] = element = {
72
73
  ...element,
73
- extend: assignedKey
74
+ extend: component,
75
+ props: {
76
+ fromKey: key
77
+ }
74
78
  }
75
79
  }
76
80
  }
@@ -42,7 +42,8 @@ export const updateState = function (obj, options = {}) {
42
42
 
43
43
  // run `on.stateUpdated`
44
44
  if (element.on && isFunction(element.on.initStateUpdated)) {
45
- on.initStateUpdated(element.on.initStateUpdated, element, state)
45
+ const initReturns = on.initStateUpdated(element.on.initStateUpdated, element, state, obj)
46
+ if (initReturns === false) return
46
47
  }
47
48
 
48
49
  overwriteDeep(state, obj, IGNORE_STATE_PARAMS)
@@ -56,6 +56,11 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
56
56
 
57
57
  if (!element.__ifFalsy && !options.preventPropsUpdate) updateProps(params.props, element, parent)
58
58
 
59
+ if (element.on && isFunction(element.on.initUpdate) && !options.ignoreInitUpdate) {
60
+ const whatinitreturns = on.initUpdate(element.on.initUpdate, element, element.state)
61
+ if (whatinitreturns === false) return
62
+ }
63
+
59
64
  const overwriteChanges = overwrite(element, params, UPDATE_DEFAULT_OPTIONS)
60
65
  const execChanges = throughUpdatedExec(element, UPDATE_DEFAULT_OPTIONS)
61
66
  const definedChanges = throughUpdatedDefine(element, options)
@@ -71,11 +76,6 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
71
76
  return
72
77
  }
73
78
 
74
- if (element.on && isFunction(element.on.initUpdate) && !options.ignoreInitUpdate) {
75
- const whatinitreturns = on.initUpdate(element.on.initUpdate, element, element.state)
76
- if (whatinitreturns === false) return
77
- }
78
-
79
79
  for (const param in element) {
80
80
  const prop = element[param]
81
81
 
package/src/event/on.js CHANGED
@@ -1,41 +1,41 @@
1
1
  'use strict'
2
2
 
3
3
  export const beforeClassAssign = (param, element, state) => {
4
- param(element, state)
4
+ return param(element, state)
5
5
  }
6
6
 
7
7
  export const init = (param, element, state) => {
8
- param(element, state)
8
+ return param(element, state)
9
9
  }
10
10
 
11
11
  export const render = (param, element, state) => {
12
- param(element, state)
12
+ return param(element, state)
13
13
  }
14
14
 
15
15
  export const initUpdate = (param, element, state) => {
16
- param(element, state)
16
+ return param(element, state)
17
17
  }
18
18
 
19
19
  export const attachNode = (param, element, state) => {
20
- param(element, state)
20
+ return param(element, state)
21
21
  }
22
22
 
23
23
  export const stateInit = (param, element, state) => {
24
- param(element, state)
24
+ return param(element, state)
25
25
  }
26
26
 
27
27
  export const stateCreated = (param, element, state) => {
28
- param(element, state)
28
+ return param(element, state)
29
29
  }
30
30
 
31
- export const initStateUpdated = (param, element, state) => {
32
- param(element, state)
31
+ export const initStateUpdated = (param, element, state, changes) => {
32
+ return param(element, state, changes)
33
33
  }
34
34
 
35
35
  export const stateUpdated = (param, element, state, changes) => {
36
- param(element, state, changes)
36
+ return param(element, state, changes)
37
37
  }
38
38
 
39
39
  export const update = (param, element, state) => {
40
- param(element, state)
40
+ return param(element, state)
41
41
  }
@@ -122,7 +122,7 @@ export const clone = obj => {
122
122
  /**
123
123
  * Deep cloning of object
124
124
  */
125
- export const deepClone = (obj, excluding = ['parent', 'node', '__element', '__root']) => {
125
+ export const deepClone = (obj, excluding = ['parent', 'node', '__element', '__root', 'context']) => {
126
126
  const o = {}
127
127
  for (const prop in obj) {
128
128
  if (excluding.indexOf(prop) > -1) continue