domql 1.4.4 → 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 +2 -1
- package/src/element/create.js +12 -12
- 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"
|
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
css,
|
|
17
17
|
sheet,
|
|
18
18
|
cache
|
|
19
|
-
} = createEmotion({ key: '
|
|
19
|
+
} = createEmotion({ key: 'smbls' })
|
|
20
20
|
|
|
21
21
|
const style = (params, element, node) => {
|
|
22
22
|
const execPareams = exec(params, element)
|
|
@@ -33,6 +33,7 @@ const classf = (params, element, node) => {
|
|
|
33
33
|
for (const key in params) {
|
|
34
34
|
const prop = exec(params[key], element)
|
|
35
35
|
if (!prop) continue
|
|
36
|
+
prop.label = key || element.key
|
|
36
37
|
const CSSed = css(prop)
|
|
37
38
|
classObjHelper[key] = CSSed
|
|
38
39
|
}
|
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!')
|
|
@@ -95,10 +104,10 @@ const create = (element, parent, key, options = {}) => {
|
|
|
95
104
|
element.update = update
|
|
96
105
|
element.remove = remove
|
|
97
106
|
element.lookup = lookup
|
|
107
|
+
element.parse = parse
|
|
108
|
+
element.parseDeep = parseDeep
|
|
109
|
+
element.keys = keys
|
|
98
110
|
if (ENV === 'test' || ENV === 'development') {
|
|
99
|
-
element.keys = keys
|
|
100
|
-
element.parse = parse
|
|
101
|
-
element.parseDeep = parseDeep
|
|
102
111
|
element.log = log
|
|
103
112
|
}
|
|
104
113
|
|
|
@@ -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
|
|