@domql/element 2.5.143 → 2.5.145
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/create.js +3 -0
- package/dist/cjs/create.js +2 -0
- package/dist/cjs/iterate.js +15 -0
- package/dist/cjs/node.js +1 -0
- package/dist/cjs/props/create.js +5 -5
- package/dist/cjs/update.js +4 -7
- package/dist/cjs/utils/onlyResolveExtends.js +2 -0
- package/iterate.js +15 -0
- package/node.js +4 -0
- package/package.json +6 -6
- package/props/create.js +5 -5
- package/update.js +16 -10
- package/utils/onlyResolveExtends.js +1 -0
package/create.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import createNode from './node'
|
|
4
4
|
import { ROOT } from './tree'
|
|
5
|
+
|
|
5
6
|
import {
|
|
6
7
|
HTML_TAGS,
|
|
7
8
|
isObject,
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
detectInfiniteLoop,
|
|
21
22
|
addChildrenIfNotInOriginal
|
|
22
23
|
} from '@domql/utils'
|
|
24
|
+
|
|
23
25
|
import { triggerEventOn } from '@domql/event'
|
|
24
26
|
import { assignNode } from '@domql/render'
|
|
25
27
|
import { createState } from '@domql/state'
|
|
@@ -306,6 +308,7 @@ const addCaching = (element, parent) => {
|
|
|
306
308
|
|
|
307
309
|
// enable EXEC
|
|
308
310
|
if (!ref.__exec) ref.__exec = {}
|
|
311
|
+
if (!ref.__execProps) ref.__execProps = {}
|
|
309
312
|
|
|
310
313
|
// enable CLASS CACHING
|
|
311
314
|
if (!ref.__class) ref.__class = {}
|
package/dist/cjs/create.js
CHANGED
package/dist/cjs/iterate.js
CHANGED
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var iterate_exports = {};
|
|
20
20
|
__export(iterate_exports, {
|
|
21
|
+
throughExecProps: () => throughExecProps,
|
|
21
22
|
throughInitialDefine: () => throughInitialDefine,
|
|
22
23
|
throughInitialExec: () => throughInitialExec,
|
|
23
24
|
throughUpdatedDefine: () => throughUpdatedDefine,
|
|
@@ -63,6 +64,20 @@ const throughUpdatedExec = (element, options = { excludes: import_utils2.METHODS
|
|
|
63
64
|
}
|
|
64
65
|
return changes;
|
|
65
66
|
};
|
|
67
|
+
const throughExecProps = (element) => {
|
|
68
|
+
const { __ref: ref } = element;
|
|
69
|
+
const { props } = element;
|
|
70
|
+
for (const k in props) {
|
|
71
|
+
const isDefine = k.startsWith("is") || k.startsWith("has") || k.startsWith("use");
|
|
72
|
+
const cachedExecProp = ref.__execProps[k];
|
|
73
|
+
if ((0, import_utils.isFunction)(cachedExecProp)) {
|
|
74
|
+
props[k] = (0, import_utils.exec)(cachedExecProp, element);
|
|
75
|
+
} else if (isDefine && (0, import_utils.isFunction)(props[k])) {
|
|
76
|
+
ref.__execProps[k] = props[k];
|
|
77
|
+
props[k] = (0, import_utils.exec)(props[k], element);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
66
81
|
const throughInitialDefine = (element) => {
|
|
67
82
|
const { define, context, __ref: ref } = element;
|
|
68
83
|
let defineObj = {};
|
package/dist/cjs/node.js
CHANGED
|
@@ -60,6 +60,7 @@ const createNode = (element, options) => {
|
|
|
60
60
|
if ((0, import_utils.isFunction)(node.setAttribute))
|
|
61
61
|
node.setAttribute("key", element.key);
|
|
62
62
|
}
|
|
63
|
+
(0, import_iterate.throughExecProps)(element);
|
|
63
64
|
(0, import_iterate.throughInitialDefine)(element);
|
|
64
65
|
(0, import_iterate.throughInitialExec)(element);
|
|
65
66
|
if (element.tag !== "string" && element.tag !== "fragment") {
|
package/dist/cjs/props/create.js
CHANGED
|
@@ -26,21 +26,21 @@ var import_utils = require("@domql/utils");
|
|
|
26
26
|
var import_ignore = require("./ignore");
|
|
27
27
|
var import_inherit = require("./inherit");
|
|
28
28
|
const createPropsStack = (element, parent) => {
|
|
29
|
-
const { props, __ref } = element;
|
|
30
|
-
const propsStack =
|
|
29
|
+
const { props, __ref: ref } = element;
|
|
30
|
+
const propsStack = ref.__props = (0, import_inherit.inheritParentProps)(element, parent);
|
|
31
31
|
if ((0, import_utils.isObject)(props))
|
|
32
32
|
propsStack.push(props);
|
|
33
33
|
else if (props === "inherit" && parent.props)
|
|
34
34
|
propsStack.push(parent.props);
|
|
35
35
|
else if (props)
|
|
36
36
|
propsStack.push(props);
|
|
37
|
-
if ((0, import_utils.isArray)(
|
|
38
|
-
|
|
37
|
+
if ((0, import_utils.isArray)(ref.__extend)) {
|
|
38
|
+
ref.__extend.forEach((extend) => {
|
|
39
39
|
if (extend.props && extend.props !== props)
|
|
40
40
|
propsStack.push(extend.props);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
ref.__props = propsStack;
|
|
44
44
|
return propsStack;
|
|
45
45
|
};
|
|
46
46
|
const syncProps = (props, element) => {
|
package/dist/cjs/update.js
CHANGED
|
@@ -93,16 +93,13 @@ const update = function(params = {}, opts) {
|
|
|
93
93
|
if (beforeUpdateReturns === false)
|
|
94
94
|
return element;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
(0, import_utils.overwriteDeep)(element, params, import_utils2.METHODS_EXL);
|
|
97
|
+
(0, import_iterate.throughExecProps)(element);
|
|
98
|
+
(0, import_iterate.throughUpdatedExec)(element, { ignore: UPDATE_DEFAULT_OPTIONS });
|
|
99
|
+
(0, import_iterate.throughUpdatedDefine)(element);
|
|
99
100
|
if (!options.isForced && !options.preventListeners) {
|
|
100
101
|
(0, import_event.triggerEventOn)("beforeClassAssign", element, options);
|
|
101
102
|
}
|
|
102
|
-
if (options.stackChanges && element.__stackChanges) {
|
|
103
|
-
const stackChanges = (0, import_utils.merge)(definedChanges, (0, import_utils.merge)(execChanges, overwriteChanges));
|
|
104
|
-
element.__stackChanges.push(stackChanges);
|
|
105
|
-
}
|
|
106
103
|
if (!ref.__if)
|
|
107
104
|
return false;
|
|
108
105
|
if (!node) {
|
package/iterate.js
CHANGED
|
@@ -58,6 +58,21 @@ export const throughUpdatedExec = (element, options = { excludes: METHODS_EXL })
|
|
|
58
58
|
return changes
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
export const throughExecProps = (element) => {
|
|
62
|
+
const { __ref: ref } = element
|
|
63
|
+
const { props } = element
|
|
64
|
+
for (const k in props) {
|
|
65
|
+
const isDefine = k.startsWith('is') || k.startsWith('has') || k.startsWith('use')
|
|
66
|
+
const cachedExecProp = ref.__execProps[k]
|
|
67
|
+
if (isFunction(cachedExecProp)) {
|
|
68
|
+
props[k] = exec(cachedExecProp, element)
|
|
69
|
+
} else if (isDefine && isFunction(props[k])) {
|
|
70
|
+
ref.__execProps[k] = props[k]
|
|
71
|
+
props[k] = exec(props[k], element)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
61
76
|
export const throughInitialDefine = (element) => {
|
|
62
77
|
const { define, context, __ref: ref } = element
|
|
63
78
|
|
package/node.js
CHANGED
|
@@ -8,6 +8,7 @@ import { isMethod } from './methods'
|
|
|
8
8
|
import create from './create'
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
+
throughExecProps,
|
|
11
12
|
throughInitialDefine,
|
|
12
13
|
throughInitialExec
|
|
13
14
|
} from './iterate'
|
|
@@ -44,6 +45,9 @@ export const createNode = (element, options) => {
|
|
|
44
45
|
if (isFunction(node.setAttribute)) node.setAttribute('key', element.key)
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
// iterate through exec props
|
|
49
|
+
throughExecProps(element)
|
|
50
|
+
|
|
47
51
|
// iterate through define
|
|
48
52
|
throughInitialDefine(element)
|
|
49
53
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.145",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@domql/event": "^2.5.
|
|
30
|
-
"@domql/render": "^2.5.
|
|
31
|
-
"@domql/state": "^2.5.
|
|
32
|
-
"@domql/utils": "^2.5.
|
|
29
|
+
"@domql/event": "^2.5.144",
|
|
30
|
+
"@domql/render": "^2.5.144",
|
|
31
|
+
"@domql/state": "^2.5.144",
|
|
32
|
+
"@domql/utils": "^2.5.144"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "873bb299c17fb6c1f69d5e98ae34f4a5d23ce352",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/props/create.js
CHANGED
|
@@ -6,20 +6,20 @@ import { IGNORE_PROPS_PARAMS } from './ignore'
|
|
|
6
6
|
import { inheritParentProps } from './inherit'
|
|
7
7
|
|
|
8
8
|
const createPropsStack = (element, parent) => {
|
|
9
|
-
const { props, __ref } = element
|
|
10
|
-
const propsStack =
|
|
9
|
+
const { props, __ref: ref } = element
|
|
10
|
+
const propsStack = ref.__props = inheritParentProps(element, parent)
|
|
11
11
|
|
|
12
12
|
if (isObject(props)) propsStack.push(props)
|
|
13
13
|
else if (props === 'inherit' && parent.props) propsStack.push(parent.props)
|
|
14
14
|
else if (props) propsStack.push(props)
|
|
15
15
|
|
|
16
|
-
if (isArray(
|
|
17
|
-
|
|
16
|
+
if (isArray(ref.__extend)) {
|
|
17
|
+
ref.__extend.forEach(extend => {
|
|
18
18
|
if (extend.props && extend.props !== props) propsStack.push(extend.props)
|
|
19
19
|
})
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
ref.__props = propsStack
|
|
23
23
|
|
|
24
24
|
return propsStack
|
|
25
25
|
}
|
package/update.js
CHANGED
|
@@ -21,7 +21,7 @@ import { updateProps } from './props'
|
|
|
21
21
|
import { createState, findInheritedState } from '@domql/state'
|
|
22
22
|
|
|
23
23
|
import create from './create'
|
|
24
|
-
import { throughUpdatedDefine, throughUpdatedExec } from './iterate'
|
|
24
|
+
import { throughExecProps, throughUpdatedDefine, throughUpdatedExec } from './iterate'
|
|
25
25
|
import { registry } from './mixins'
|
|
26
26
|
import { applyParam } from './utils/applyParam'
|
|
27
27
|
import OPTIONS from './cache/options'
|
|
@@ -80,20 +80,15 @@ const update = function (params = {}, opts) {
|
|
|
80
80
|
if (beforeUpdateReturns === false) return element
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
overwriteDeep(element, params, METHODS_EXL)
|
|
84
|
+
throughExecProps(element)
|
|
85
|
+
throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS })
|
|
86
|
+
throughUpdatedDefine(element)
|
|
87
87
|
|
|
88
88
|
if (!options.isForced && !options.preventListeners) {
|
|
89
89
|
triggerEventOn('beforeClassAssign', element, options)
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
if (options.stackChanges && element.__stackChanges) {
|
|
93
|
-
const stackChanges = merge(definedChanges, merge(execChanges, overwriteChanges))
|
|
94
|
-
element.__stackChanges.push(stackChanges)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
92
|
if (!ref.__if) return false
|
|
98
93
|
if (!node) {
|
|
99
94
|
// return createNode(element, options)
|
|
@@ -315,3 +310,14 @@ const createStateUpdate = (element, parent, options) => {
|
|
|
315
310
|
}
|
|
316
311
|
|
|
317
312
|
export default update
|
|
313
|
+
|
|
314
|
+
// save updates history
|
|
315
|
+
// const overwriteChanges = overwriteDeep(element, params, METHODS_EXL)
|
|
316
|
+
// // const overwriteChanges = overwriteDeep(element, params)
|
|
317
|
+
// const propsChanges = throughExecProps(element)
|
|
318
|
+
// const execChanges = throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS })
|
|
319
|
+
// const definedChanges = throughUpdatedDefine(element)
|
|
320
|
+
// if (options.stackChanges && ref.__stackChanges) {
|
|
321
|
+
// const stackChanges = merge(definedChanges, merge(execChanges, overwriteChanges))
|
|
322
|
+
// ref.__stackChanges.push(stackChanges)
|
|
323
|
+
// }
|