@domql/element 2.5.142 → 2.5.144
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/methods/set.js +20 -20
- package/dist/cjs/node.js +1 -0
- package/dist/cjs/update.js +7 -7
- package/dist/cjs/utils/onlyResolveExtends.js +2 -0
- package/iterate.js +15 -0
- package/methods/set.js +20 -20
- package/node.js +4 -0
- package/package.json +6 -6
- package/update.js +20 -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/methods/set.js
CHANGED
|
@@ -36,30 +36,30 @@ var import_set = __toESM(require("../set"), 1);
|
|
|
36
36
|
var import_update = __toESM(require("../update"), 1);
|
|
37
37
|
var import__ = require("./");
|
|
38
38
|
var import_content = require("../mixins/content");
|
|
39
|
-
const addMethods = (element, parent) => {
|
|
39
|
+
const addMethods = (element, parent, options) => {
|
|
40
40
|
const proto = {
|
|
41
|
-
set: import_set.default
|
|
42
|
-
reset: import_set.reset
|
|
43
|
-
update: import_update.default
|
|
44
|
-
variables: import__.variables
|
|
45
|
-
remove: import__.remove
|
|
46
|
-
updateContent: import_content.updateContent
|
|
47
|
-
removeContent: import_content.removeContent
|
|
48
|
-
setProps: import__.setProps
|
|
49
|
-
lookup: import__.lookup
|
|
50
|
-
lookdown: import__.lookdown
|
|
51
|
-
lookdownAll: import__.lookdownAll
|
|
52
|
-
setNodeStyles: import__.setNodeStyles
|
|
53
|
-
spotByPath: import__.spotByPath
|
|
54
|
-
parse: import__.parse
|
|
55
|
-
parseDeep: import__.parseDeep
|
|
56
|
-
keys: import__.keys
|
|
57
|
-
nextElement: import__.nextElement
|
|
58
|
-
previousElement: import__.previousElement
|
|
41
|
+
set: import_set.default,
|
|
42
|
+
reset: import_set.reset,
|
|
43
|
+
update: import_update.default,
|
|
44
|
+
variables: import__.variables,
|
|
45
|
+
remove: import__.remove,
|
|
46
|
+
updateContent: import_content.updateContent,
|
|
47
|
+
removeContent: import_content.removeContent,
|
|
48
|
+
setProps: import__.setProps,
|
|
49
|
+
lookup: import__.lookup,
|
|
50
|
+
lookdown: import__.lookdown,
|
|
51
|
+
lookdownAll: import__.lookdownAll,
|
|
52
|
+
setNodeStyles: import__.setNodeStyles,
|
|
53
|
+
spotByPath: import__.spotByPath,
|
|
54
|
+
parse: import__.parse,
|
|
55
|
+
parseDeep: import__.parseDeep,
|
|
56
|
+
keys: import__.keys,
|
|
57
|
+
nextElement: import__.nextElement,
|
|
58
|
+
previousElement: import__.previousElement
|
|
59
59
|
};
|
|
60
60
|
if (element.context.methods)
|
|
61
61
|
(0, import_utils.merge)(proto, element.context.methods);
|
|
62
62
|
if ((0, import_utils.isDevelopment)())
|
|
63
|
-
proto.log = import__.log
|
|
63
|
+
proto.log = import__.log;
|
|
64
64
|
Object.setPrototypeOf(element, proto);
|
|
65
65
|
};
|
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/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) {
|
|
@@ -147,6 +144,9 @@ const update = function(params = {}, opts) {
|
|
|
147
144
|
if (!canUpdate)
|
|
148
145
|
continue;
|
|
149
146
|
const lazyLoad = element.props.lazyLoad || options.lazyLoad;
|
|
147
|
+
if (options.onEachUpdate) {
|
|
148
|
+
options.onEachUpdate(param, element, element.state, element.context);
|
|
149
|
+
}
|
|
150
150
|
const childUpdateCall = () => update.call(prop, params[prop], {
|
|
151
151
|
...options,
|
|
152
152
|
currentSnapshot: snapshotOnCallee,
|
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/methods/set.js
CHANGED
|
@@ -24,28 +24,28 @@ import {
|
|
|
24
24
|
|
|
25
25
|
import { removeContent, updateContent } from '../mixins/content'
|
|
26
26
|
|
|
27
|
-
export const addMethods = (element, parent) => {
|
|
27
|
+
export const addMethods = (element, parent, options) => {
|
|
28
28
|
const proto = {
|
|
29
|
-
set
|
|
30
|
-
reset
|
|
31
|
-
update
|
|
32
|
-
variables
|
|
33
|
-
remove
|
|
34
|
-
updateContent
|
|
35
|
-
removeContent
|
|
36
|
-
setProps
|
|
37
|
-
lookup
|
|
38
|
-
lookdown
|
|
39
|
-
lookdownAll
|
|
40
|
-
setNodeStyles
|
|
41
|
-
spotByPath
|
|
42
|
-
parse
|
|
43
|
-
parseDeep
|
|
44
|
-
keys
|
|
45
|
-
nextElement
|
|
46
|
-
previousElement
|
|
29
|
+
set,
|
|
30
|
+
reset,
|
|
31
|
+
update,
|
|
32
|
+
variables,
|
|
33
|
+
remove,
|
|
34
|
+
updateContent,
|
|
35
|
+
removeContent,
|
|
36
|
+
setProps,
|
|
37
|
+
lookup,
|
|
38
|
+
lookdown,
|
|
39
|
+
lookdownAll,
|
|
40
|
+
setNodeStyles,
|
|
41
|
+
spotByPath,
|
|
42
|
+
parse,
|
|
43
|
+
parseDeep,
|
|
44
|
+
keys,
|
|
45
|
+
nextElement,
|
|
46
|
+
previousElement
|
|
47
47
|
}
|
|
48
48
|
if (element.context.methods) merge(proto, element.context.methods)
|
|
49
|
-
if (isDevelopment()) proto.log = log
|
|
49
|
+
if (isDevelopment()) proto.log = log
|
|
50
50
|
Object.setPrototypeOf(element, proto)
|
|
51
51
|
}
|
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.144",
|
|
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": "9026efab1932521ec5eec3e88261eadb81f2e3cb",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
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)
|
|
@@ -146,6 +141,10 @@ const update = function (params = {}, opts) {
|
|
|
146
141
|
|
|
147
142
|
const lazyLoad = element.props.lazyLoad || options.lazyLoad
|
|
148
143
|
|
|
144
|
+
if (options.onEachUpdate) {
|
|
145
|
+
options.onEachUpdate(param, element, element.state, element.context)
|
|
146
|
+
}
|
|
147
|
+
|
|
149
148
|
const childUpdateCall = () => update.call(prop, params[prop], {
|
|
150
149
|
...options,
|
|
151
150
|
currentSnapshot: snapshotOnCallee,
|
|
@@ -311,3 +310,14 @@ const createStateUpdate = (element, parent, options) => {
|
|
|
311
310
|
}
|
|
312
311
|
|
|
313
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
|
+
// }
|