domql 1.2.12 → 1.3.0
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": "rackai",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.3.0",
|
|
7
7
|
"repository": "https://github.com/rackai/domql",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"registry": "https://registry.npmjs.org"
|
package/src/element/create.js
CHANGED
|
@@ -46,12 +46,12 @@ const create = (element, parent, key, options = {}) => {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// enable STATE
|
|
50
|
-
element.state = createState(element, parent)
|
|
51
|
-
|
|
52
49
|
// create PROTOtypal inheritance
|
|
53
50
|
applyPrototype(element, parent, options)
|
|
54
51
|
|
|
52
|
+
// enable STATE
|
|
53
|
+
element.state = createState(element, parent)
|
|
54
|
+
|
|
55
55
|
// console.groupCollapsed('Create:', assignedKey)
|
|
56
56
|
// console.log(element)
|
|
57
57
|
|
|
@@ -34,7 +34,11 @@ export const updateState = function (obj, options = {}) {
|
|
|
34
34
|
|
|
35
35
|
export default function (element, parent) {
|
|
36
36
|
let { state } = element
|
|
37
|
-
if (!state) return (parent && parent.state) || {}
|
|
37
|
+
// if (!state) return (parent && parent.state) || {}
|
|
38
|
+
if (!state) {
|
|
39
|
+
if (parent && parent.state) return parent.state
|
|
40
|
+
return {}
|
|
41
|
+
}
|
|
38
42
|
if (isFunction(state)) state = exec(state, element)
|
|
39
43
|
|
|
40
44
|
state = deepClone(state, ['update', 'parse', '__element'])
|
package/src/element/update.js
CHANGED
|
@@ -9,6 +9,7 @@ import { merge } from '../utils/object'
|
|
|
9
9
|
import { appendNode } from './assign'
|
|
10
10
|
import { createNode } from '.'
|
|
11
11
|
import { updateProps } from './createProps'
|
|
12
|
+
import createState from './createState'
|
|
12
13
|
|
|
13
14
|
const UPDATE_DEFAULT_OPTIONS = {
|
|
14
15
|
stackChanges: false,
|
|
@@ -20,17 +21,6 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
20
21
|
const element = this
|
|
21
22
|
const { define, parent, node } = element
|
|
22
23
|
|
|
23
|
-
// console.groupCollapsed('Update:', element.path)
|
|
24
|
-
// console.log('params:')
|
|
25
|
-
// console.log(params)
|
|
26
|
-
// console.log('props:')
|
|
27
|
-
// console.log(element.props)
|
|
28
|
-
// console.log('element:')
|
|
29
|
-
// console.log(element)
|
|
30
|
-
// console.log('PARAMS.PROPS:')
|
|
31
|
-
// console.log(params.props)
|
|
32
|
-
// console.groupEnd('Update:')
|
|
33
|
-
// if params is string
|
|
34
24
|
if (isString(params) || isNumber(params)) {
|
|
35
25
|
params = { text: params }
|
|
36
26
|
}
|
|
@@ -39,14 +29,10 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
39
29
|
on.initUpdate(element.on.initUpdate, element, element.state)
|
|
40
30
|
}
|
|
41
31
|
|
|
42
|
-
// console.log(element, parent)
|
|
43
32
|
updateProps(params.props, element, parent)
|
|
44
|
-
// // console.log(element.path)
|
|
45
|
-
// // console.log(element)
|
|
46
33
|
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// console.groupEnd('UPDATE:')
|
|
34
|
+
// const state = params.state || element.state
|
|
35
|
+
// element.state = createState({ state }, parent)
|
|
50
36
|
|
|
51
37
|
const overwriteChanges = overwrite(element, params, UPDATE_DEFAULT_OPTIONS)
|
|
52
38
|
const execChanges = throughUpdatedExec(element, UPDATE_DEFAULT_OPTIONS)
|
|
@@ -70,9 +56,6 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
70
56
|
}
|
|
71
57
|
}
|
|
72
58
|
|
|
73
|
-
// console.log(node)
|
|
74
|
-
// console.groupEnd('Update:')
|
|
75
|
-
|
|
76
59
|
if (!node || options.preventRecursive) return
|
|
77
60
|
|
|
78
61
|
for (const param in element) {
|
package/src/utils/object.js
CHANGED
|
@@ -77,7 +77,7 @@ export const deepMerge = (element, proto) => {
|
|
|
77
77
|
const elementProp = element[e]
|
|
78
78
|
const protoProp = proto[e]
|
|
79
79
|
// const cachedProps = cache.props
|
|
80
|
-
if (e === 'parent' || e === 'props') continue
|
|
80
|
+
if (e === 'parent' || e === 'props' || e === 'state') continue
|
|
81
81
|
if (elementProp === undefined) {
|
|
82
82
|
element[e] = protoProp
|
|
83
83
|
} else if (isObjectLike(elementProp) && isObject(protoProp)) {
|
|
@@ -122,7 +122,7 @@ export const overwrite = (element, params, options) => {
|
|
|
122
122
|
const changes = {}
|
|
123
123
|
|
|
124
124
|
for (const e in params) {
|
|
125
|
-
if (e === 'props') continue
|
|
125
|
+
if (e === 'props' || e === 'state') continue
|
|
126
126
|
|
|
127
127
|
const elementProp = element[e]
|
|
128
128
|
const paramsProp = params[e]
|