domql 1.5.92 → 1.5.94
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/src/element/iterate.js +1 -1
- package/src/element/node.js +2 -2
- package/src/element/props.js +3 -1
- package/src/element/state.js +12 -7
- package/src/element/update.js +2 -2
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.
|
|
5
|
+
"version": "1.5.94",
|
|
6
6
|
"repository": "https://github.com/domql/domql",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org"
|
package/src/element/iterate.js
CHANGED
|
@@ -56,7 +56,7 @@ export const throughInitialDefine = (element) => {
|
|
|
56
56
|
|
|
57
57
|
let obj = {}
|
|
58
58
|
if (isObject(define)) obj = { ...define }
|
|
59
|
-
if (isObject(context.define)) obj = { ...obj, ...context.define }
|
|
59
|
+
if (context && isObject(context.define)) obj = { ...obj, ...context.define }
|
|
60
60
|
|
|
61
61
|
for (const param in obj) {
|
|
62
62
|
let prop = element[param]
|
package/src/element/node.js
CHANGED
|
@@ -75,11 +75,11 @@ export const createNode = (element, options) => {
|
|
|
75
75
|
if (isMethod(param) || isObject(registry[param]) || prop === undefined) continue
|
|
76
76
|
|
|
77
77
|
const DOMQLProperty = registry[param]
|
|
78
|
-
const DOMQLPropertyFromContext = context.registry && context.registry[param]
|
|
78
|
+
const DOMQLPropertyFromContext = context && context.registry && context.registry[param]
|
|
79
79
|
const isGlobalTransformer = DOMQLPropertyFromContext || DOMQLProperty
|
|
80
80
|
|
|
81
81
|
const hasDefine = element.define && element.define[param]
|
|
82
|
-
const hasContextDefine = context.define && context.define[param]
|
|
82
|
+
const hasContextDefine = context && context.define && context.define[param]
|
|
83
83
|
|
|
84
84
|
// Check if param is in our method registry
|
|
85
85
|
if (isGlobalTransformer && !hasContextDefine) {
|
package/src/element/props.js
CHANGED
|
@@ -60,7 +60,9 @@ export const syncProps = (props, element) => {
|
|
|
60
60
|
const mergedProps = { update, __element: element }
|
|
61
61
|
props.forEach(v => {
|
|
62
62
|
if (v === 'update' || v === '__element') return
|
|
63
|
-
|
|
63
|
+
const execProps = exec(v, element)
|
|
64
|
+
if (isObject(execProps) && execProps.__element) return
|
|
65
|
+
element.props = deepMerge(mergedProps, deepClone(execProps))
|
|
64
66
|
})
|
|
65
67
|
element.props = mergedProps
|
|
66
68
|
return element.props
|
package/src/element/state.js
CHANGED
|
@@ -127,15 +127,20 @@ export const createState = function (element, parent, opts) {
|
|
|
127
127
|
let stateKey = element.__state
|
|
128
128
|
if (stateKey) {
|
|
129
129
|
let parentState = parent.state
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
stateKey = parents[i]
|
|
130
|
+
const parentKeysArr = stateKey.split('../')
|
|
131
|
+
for (let i = 1; i < parentKeysArr.length; i++) {
|
|
132
|
+
stateKey = parentKeysArr[i]
|
|
134
133
|
parentState = parentState.parent
|
|
135
134
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
const childrenKeysArr = stateKey.split('.')
|
|
136
|
+
for (let i = 0; i < childrenKeysArr.length; i++) {
|
|
137
|
+
const childKey = childrenKeysArr[i]
|
|
138
|
+
const grandChildKey = childrenKeysArr[i + 1]
|
|
139
|
+
const childInParent = parentState[childKey]
|
|
140
|
+
if (childInParent && childInParent[grandChildKey]) {
|
|
141
|
+
stateKey = grandChildKey
|
|
142
|
+
parentState = childInParent
|
|
143
|
+
}
|
|
139
144
|
}
|
|
140
145
|
if (parentState && parentState[stateKey]) {
|
|
141
146
|
const keyInParentState = parentState[stateKey]
|
package/src/element/update.js
CHANGED
|
@@ -114,11 +114,11 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
114
114
|
if (options.preventStateUpdate === 'once') options.preventStateUpdate = false
|
|
115
115
|
|
|
116
116
|
const DOMQLProperty = registry[param]
|
|
117
|
-
const DOMQLPropertyFromContext = context.registry && context.registry[param]
|
|
117
|
+
const DOMQLPropertyFromContext = context && context.registry && context.registry[param]
|
|
118
118
|
const isGlobalTransformer = DOMQLPropertyFromContext || DOMQLProperty
|
|
119
119
|
|
|
120
120
|
const hasDefine = element.define && element.define[param]
|
|
121
|
-
const hasContextDefine = context.define && context.define[param]
|
|
121
|
+
const hasContextDefine = context && context.define && context.define[param]
|
|
122
122
|
|
|
123
123
|
if (isGlobalTransformer && !hasContextDefine) {
|
|
124
124
|
if (isFunction(isGlobalTransformer)) isGlobalTransformer(prop, element, node, options)
|