domql 1.4.6 → 1.4.7
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 +1 -1
- package/packages/emotion/index.js +1 -1
- package/src/element/create.js +9 -9
- package/src/element/update.js +11 -3
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": "rackai",
|
|
6
|
-
"version": "1.4.
|
|
6
|
+
"version": "1.4.7",
|
|
7
7
|
"repository": "https://github.com/rackai/domql",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"registry": "https://registry.npmjs.org"
|
package/src/element/create.js
CHANGED
|
@@ -83,6 +83,15 @@ const create = (element, parent, key, options = {}) => {
|
|
|
83
83
|
element.path = parent.path.concat(assignedKey)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// don't render IF in condition
|
|
87
|
+
if (isFunction(element.if) && !element.if(element, element.state)) {
|
|
88
|
+
// TODO: move as fragment
|
|
89
|
+
const ifFragment = cacheNode({ tag: 'fragment' })
|
|
90
|
+
element.__ifFragment = appendNode(ifFragment, parent.node)
|
|
91
|
+
element.__ifFalsy = true
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
|
|
86
95
|
// if it already HAS A NODE
|
|
87
96
|
if (element.node) {
|
|
88
97
|
// console.log('hasNode!')
|
|
@@ -137,15 +146,6 @@ const create = (element, parent, key, options = {}) => {
|
|
|
137
146
|
// console.log(element)
|
|
138
147
|
// console.groupEnd('Create:')
|
|
139
148
|
|
|
140
|
-
// don't render IF in condition
|
|
141
|
-
if (isFunction(element.if) && !element.if(element, element.state)) {
|
|
142
|
-
// TODO: move as fragment
|
|
143
|
-
const ifFragment = cacheNode({ tag: 'fragment' })
|
|
144
|
-
element.__ifFragment = appendNode(ifFragment, parent.node)
|
|
145
|
-
element.__ifFalsy = true
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
|
|
149
149
|
// CREATE a real NODE
|
|
150
150
|
createNode(element, options)
|
|
151
151
|
|
package/src/element/update.js
CHANGED
|
@@ -25,10 +25,14 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
25
25
|
params = { text: params }
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
if (element.on && isFunction(element.on.initUpdate)) {
|
|
29
|
-
on.initUpdate(element.on.initUpdate, element, element.state)
|
|
28
|
+
if (element.on && isFunction(element.on.initUpdate) && !options.ignoreInitUpdate) {
|
|
29
|
+
preventUpdate = on.initUpdate(element.on.initUpdate, element, element.state)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
// if (params.props) {
|
|
33
|
+
// console.log('INSIDE:')
|
|
34
|
+
// console.log(params.props)
|
|
35
|
+
// }
|
|
32
36
|
updateProps(params.props, element, parent)
|
|
33
37
|
|
|
34
38
|
// const state = params.state || element.state
|
|
@@ -42,6 +46,9 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
42
46
|
const stackChanges = merge(definedChanges, merge(execChanges, overwriteChanges))
|
|
43
47
|
element.__stackChanges.push(stackChanges)
|
|
44
48
|
}
|
|
49
|
+
// const stackChanges = merge(definedChanges, merge(execChanges, overwriteChanges))
|
|
50
|
+
// if (Object.keys(stackChanges).length === 0) return
|
|
51
|
+
// else console.log(element.path, '\n\n', stackChanges)
|
|
45
52
|
|
|
46
53
|
if (isFunction(element.if)) {
|
|
47
54
|
// TODO: move as fragment
|
|
@@ -61,6 +68,7 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
61
68
|
for (const param in element) {
|
|
62
69
|
const prop = element[param]
|
|
63
70
|
|
|
71
|
+
if (options.preventContentUpdate && param === 'content') continue
|
|
64
72
|
if (isMethod(param) || isObject(registry[param]) || prop === undefined) continue
|
|
65
73
|
|
|
66
74
|
const hasDefined = define && define[param]
|
|
@@ -71,7 +79,7 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
71
79
|
if (ourParam) {
|
|
72
80
|
if (isFunction(ourParam)) ourParam(prop, element, node)
|
|
73
81
|
} else if (prop && isObject(prop) && !hasDefined) {
|
|
74
|
-
update.call(prop, params[prop], UPDATE_DEFAULT_OPTIONS)
|
|
82
|
+
if (!options.preventChildrenUpdate) update.call(prop, params[prop], UPDATE_DEFAULT_OPTIONS)
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
|