@domql/element 2.5.184 → 2.5.186
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 +11 -11
- package/dist/cjs/create.js +11 -11
- package/dist/cjs/extend.js +1 -1
- package/dist/cjs/iterate.js +2 -2
- package/dist/cjs/methods/index.js +2 -2
- package/dist/cjs/methods/set.js +24 -24
- package/dist/cjs/methods/v2.js +1 -1
- package/dist/cjs/mixins/attr.js +1 -1
- package/dist/cjs/mixins/content.js +1 -1
- package/dist/cjs/mixins/index.js +11 -11
- package/dist/cjs/mixins/registry.js +28 -10
- package/dist/cjs/mixins/text.js +1 -1
- package/dist/cjs/node.js +6 -6
- package/dist/cjs/props/create.js +2 -2
- package/dist/cjs/props/index.js +4 -4
- package/dist/cjs/props/update.js +2 -2
- package/dist/cjs/set.js +4 -4
- package/dist/cjs/update.js +8 -8
- package/dist/cjs/utils/applyParam.js +1 -1
- package/dist/cjs/utils/component.js +2 -2
- package/dist/cjs/utils/index.js +3 -3
- package/dist/cjs/utils/object.js +1 -1
- package/dist/cjs/utils/onlyResolveExtends.js +1 -1
- package/dist/esm/cache/index.js +4 -0
- package/dist/esm/cache/options.js +6 -0
- package/dist/esm/create.js +334 -0
- package/dist/esm/define.js +14 -0
- package/dist/esm/extend.js +71 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/iterate.js +112 -0
- package/dist/esm/methods/index.js +333 -0
- package/dist/esm/methods/set.js +61 -0
- package/dist/esm/methods/v2.js +89 -0
- package/dist/esm/mixins/attr.js +26 -0
- package/dist/esm/mixins/classList.js +55 -0
- package/dist/esm/mixins/content.js +54 -0
- package/dist/esm/mixins/data.js +22 -0
- package/dist/esm/mixins/html.js +18 -0
- package/dist/esm/mixins/index.js +23 -0
- package/dist/esm/mixins/registry.js +105 -0
- package/dist/esm/mixins/scope.js +18 -0
- package/dist/esm/mixins/state.js +19 -0
- package/dist/esm/mixins/style.js +15 -0
- package/dist/esm/mixins/text.js +28 -0
- package/dist/esm/node.js +69 -0
- package/dist/esm/props/create.js +78 -0
- package/dist/esm/props/ignore.js +4 -0
- package/dist/esm/props/index.js +4 -0
- package/dist/esm/props/inherit.js +33 -0
- package/dist/esm/props/update.js +17 -0
- package/dist/esm/set.js +73 -0
- package/dist/esm/tree.js +11 -0
- package/dist/esm/update.js +255 -0
- package/dist/esm/utils/applyParam.js +25 -0
- package/dist/esm/utils/component.js +65 -0
- package/dist/esm/utils/extendUtils.js +122 -0
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/object.js +159 -0
- package/dist/esm/utils/onlyResolveExtends.js +81 -0
- package/dist/esm/utils/propEvents.js +21 -0
- package/extend.js +1 -1
- package/iterate.js +2 -2
- package/methods/index.js +2 -2
- package/methods/set.js +18 -19
- package/methods/v2.js +1 -1
- package/mixins/attr.js +1 -1
- package/mixins/content.js +1 -1
- package/mixins/index.js +11 -11
- package/mixins/registry.js +10 -6
- package/mixins/text.js +1 -1
- package/node.js +6 -6
- package/package.json +7 -7
- package/props/create.js +2 -2
- package/props/index.js +4 -4
- package/props/update.js +2 -2
- package/set.js +4 -4
- package/update.js +8 -8
- package/utils/applyParam.js +1 -1
- package/utils/component.js +2 -2
- package/utils/index.js +3 -3
- package/utils/object.js +1 -1
- package/utils/onlyResolveExtends.js +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import attr from "./attr.js";
|
|
2
|
+
import { classList } from "./classList.js";
|
|
3
|
+
import setContent from "./content.js";
|
|
4
|
+
import data from "./data.js";
|
|
5
|
+
import html from "./html.js";
|
|
6
|
+
import scope from "./scope.js";
|
|
7
|
+
import state from "./state.js";
|
|
8
|
+
import style from "./style.js";
|
|
9
|
+
import text from "./text.js";
|
|
10
|
+
const REGISTRY = {
|
|
11
|
+
attr,
|
|
12
|
+
style,
|
|
13
|
+
text,
|
|
14
|
+
html,
|
|
15
|
+
setContent,
|
|
16
|
+
data,
|
|
17
|
+
class: classList,
|
|
18
|
+
state,
|
|
19
|
+
scope,
|
|
20
|
+
deps: (param, el) => param || el.parent.deps,
|
|
21
|
+
extend: {},
|
|
22
|
+
childExtend: {},
|
|
23
|
+
childExtendRecursive: {},
|
|
24
|
+
props: {},
|
|
25
|
+
path: {},
|
|
26
|
+
if: {},
|
|
27
|
+
define: {},
|
|
28
|
+
transform: {},
|
|
29
|
+
__name: {},
|
|
30
|
+
__ref: {},
|
|
31
|
+
__hash: {},
|
|
32
|
+
__text: {},
|
|
33
|
+
nextElement: {},
|
|
34
|
+
previousElement: {},
|
|
35
|
+
key: {},
|
|
36
|
+
tag: {},
|
|
37
|
+
query: {},
|
|
38
|
+
parent: {},
|
|
39
|
+
node: {},
|
|
40
|
+
set: {},
|
|
41
|
+
reset: {},
|
|
42
|
+
update: {},
|
|
43
|
+
error: {},
|
|
44
|
+
warn: {},
|
|
45
|
+
call: {},
|
|
46
|
+
setProps: {},
|
|
47
|
+
remove: {},
|
|
48
|
+
updateContent: {},
|
|
49
|
+
removeContent: {},
|
|
50
|
+
variables: {},
|
|
51
|
+
lookup: {},
|
|
52
|
+
lookdown: {},
|
|
53
|
+
getRef: {},
|
|
54
|
+
getPath: {},
|
|
55
|
+
lookdownAll: {},
|
|
56
|
+
setNodeStyles: {},
|
|
57
|
+
spotByPath: {},
|
|
58
|
+
keys: {},
|
|
59
|
+
log: {},
|
|
60
|
+
parse: {},
|
|
61
|
+
parseDeep: {},
|
|
62
|
+
on: {},
|
|
63
|
+
component: {},
|
|
64
|
+
context: {},
|
|
65
|
+
$collection: {},
|
|
66
|
+
$stateCollection: {},
|
|
67
|
+
$propsCollection: {},
|
|
68
|
+
$setCollection: {},
|
|
69
|
+
$setStateCollection: {},
|
|
70
|
+
$setPropsCollection: {}
|
|
71
|
+
};
|
|
72
|
+
var registry_default = REGISTRY;
|
|
73
|
+
const parseFilters = {
|
|
74
|
+
elementKeys: [
|
|
75
|
+
"tag",
|
|
76
|
+
"text",
|
|
77
|
+
"style",
|
|
78
|
+
"attr",
|
|
79
|
+
"class",
|
|
80
|
+
"state",
|
|
81
|
+
"props",
|
|
82
|
+
"data",
|
|
83
|
+
"content",
|
|
84
|
+
"html",
|
|
85
|
+
"on",
|
|
86
|
+
"key",
|
|
87
|
+
"extend",
|
|
88
|
+
"childExtend",
|
|
89
|
+
"childExtendRecursive",
|
|
90
|
+
"scope",
|
|
91
|
+
"query",
|
|
92
|
+
"$collection",
|
|
93
|
+
"$stateCollection",
|
|
94
|
+
"$propsCollection"
|
|
95
|
+
],
|
|
96
|
+
propsKeys: ["__element", "update"],
|
|
97
|
+
stateKeys: []
|
|
98
|
+
};
|
|
99
|
+
const collectionFilters = ["$collection", "$stateCollection", "$propsCollection"];
|
|
100
|
+
export {
|
|
101
|
+
REGISTRY,
|
|
102
|
+
collectionFilters,
|
|
103
|
+
registry_default as default,
|
|
104
|
+
parseFilters
|
|
105
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isFunction, isObject } from "@domql/utils";
|
|
2
|
+
function scope(params, element, node) {
|
|
3
|
+
if (!isObject(params))
|
|
4
|
+
return;
|
|
5
|
+
for (const scopeItem in params) {
|
|
6
|
+
const value = params[scopeItem];
|
|
7
|
+
if (isFunction(value)) {
|
|
8
|
+
element.scope[scopeItem] = value.bind(element);
|
|
9
|
+
} else {
|
|
10
|
+
element.scope[scopeItem] = value;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
var scope_default = scope;
|
|
15
|
+
export {
|
|
16
|
+
scope_default as default,
|
|
17
|
+
scope
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IGNORE_STATE_PARAMS } from "@domql/state";
|
|
2
|
+
import { exec, isObject } from "@domql/utils";
|
|
3
|
+
function state(params, element, node) {
|
|
4
|
+
const state2 = exec(params, element);
|
|
5
|
+
if (isObject(state2)) {
|
|
6
|
+
for (const param in state2) {
|
|
7
|
+
if (IGNORE_STATE_PARAMS.includes(param))
|
|
8
|
+
continue;
|
|
9
|
+
if (!Object.hasOwnProperty.call(state2, param))
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return element;
|
|
14
|
+
}
|
|
15
|
+
var state_default = state;
|
|
16
|
+
export {
|
|
17
|
+
state_default as default,
|
|
18
|
+
state
|
|
19
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isObject, map } from "@domql/utils";
|
|
2
|
+
import { report } from "@domql/report";
|
|
3
|
+
function style(params, element, node) {
|
|
4
|
+
if (params) {
|
|
5
|
+
if (isObject(params))
|
|
6
|
+
map(node.style, params, element);
|
|
7
|
+
else
|
|
8
|
+
report("HTMLInvalidStyles", params);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
var style_default = style;
|
|
12
|
+
export {
|
|
13
|
+
style_default as default,
|
|
14
|
+
style
|
|
15
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { create } from "../create.js";
|
|
2
|
+
import {
|
|
3
|
+
exec,
|
|
4
|
+
isString
|
|
5
|
+
} from "@domql/utils";
|
|
6
|
+
function text(param, element, node) {
|
|
7
|
+
let prop = exec(param, element);
|
|
8
|
+
if (isString(prop) && prop.includes("{{")) {
|
|
9
|
+
prop = element.call("replaceLiteralsWithObjectFields", prop);
|
|
10
|
+
}
|
|
11
|
+
if (element.tag === "string") {
|
|
12
|
+
node.nodeValue = prop;
|
|
13
|
+
} else if (param !== void 0 || param !== null) {
|
|
14
|
+
if (element.__text) {
|
|
15
|
+
if (element.__text.text === prop)
|
|
16
|
+
return;
|
|
17
|
+
element.__text.text = prop;
|
|
18
|
+
if (element.__text.node)
|
|
19
|
+
element.__text.node.nodeValue = prop;
|
|
20
|
+
} else
|
|
21
|
+
create({ tag: "string", text: prop }, element, "__text");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
var text_default = text;
|
|
25
|
+
export {
|
|
26
|
+
text_default as default,
|
|
27
|
+
text
|
|
28
|
+
};
|
package/dist/esm/node.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { exec, isFunction, isObject, isUndefined, isVariant } from "@domql/utils";
|
|
2
|
+
import { applyEventsOnNode, triggerEventOn, applyAnimationFrame } from "@domql/event";
|
|
3
|
+
import { cacheNode } from "@domql/render";
|
|
4
|
+
import { isMethod } from "./methods/index.js";
|
|
5
|
+
import create from "./create.js";
|
|
6
|
+
import {
|
|
7
|
+
throughExecProps,
|
|
8
|
+
throughInitialDefine,
|
|
9
|
+
throughInitialExec
|
|
10
|
+
} from "./iterate.js";
|
|
11
|
+
import { REGISTRY } from "./mixins/index.js";
|
|
12
|
+
import { applyParam } from "./utils/applyParam.js";
|
|
13
|
+
import { propagateEventsFromProps } from "./utils/propEvents.js";
|
|
14
|
+
const ENV = "development";
|
|
15
|
+
const createNode = async (element, options) => {
|
|
16
|
+
let { node, tag, __ref: ref } = element;
|
|
17
|
+
let isNewNode;
|
|
18
|
+
if (!node) {
|
|
19
|
+
isNewNode = true;
|
|
20
|
+
if (!ref.__if)
|
|
21
|
+
return element;
|
|
22
|
+
if (tag === "shadow") {
|
|
23
|
+
node = element.node = element.parent.node.attachShadow({ mode: "open" });
|
|
24
|
+
} else
|
|
25
|
+
node = element.node = cacheNode(element);
|
|
26
|
+
triggerEventOn("attachNode", element, options);
|
|
27
|
+
}
|
|
28
|
+
if (ENV === "test" || ENV === "development" || options.alowRefReference) {
|
|
29
|
+
node.ref = element;
|
|
30
|
+
if (isFunction(node.setAttribute))
|
|
31
|
+
node.setAttribute("key", element.key);
|
|
32
|
+
}
|
|
33
|
+
throughExecProps(element);
|
|
34
|
+
throughInitialDefine(element);
|
|
35
|
+
throughInitialExec(element);
|
|
36
|
+
if (element.tag !== "string" && element.tag !== "fragment") {
|
|
37
|
+
propagateEventsFromProps(element);
|
|
38
|
+
applyAnimationFrame(element, options);
|
|
39
|
+
if (isNewNode && isObject(element.on)) {
|
|
40
|
+
applyEventsOnNode(element, options);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (const param in element) {
|
|
44
|
+
const value = element[param];
|
|
45
|
+
if (!Object.hasOwnProperty.call(element, param))
|
|
46
|
+
continue;
|
|
47
|
+
if (isUndefined(value) || isMethod(param, element) || isVariant(param) || isObject(REGISTRY[param]))
|
|
48
|
+
continue;
|
|
49
|
+
const isElement = applyParam(param, element, options);
|
|
50
|
+
if (isElement) {
|
|
51
|
+
const { hasDefine, hasContextDefine } = isElement;
|
|
52
|
+
if (element[param] && !hasDefine && !hasContextDefine) {
|
|
53
|
+
const createAsync = async () => {
|
|
54
|
+
await create(exec(value, element), element, param, options);
|
|
55
|
+
};
|
|
56
|
+
if (element.props && element.props.lazyLoad || options.lazyLoad) {
|
|
57
|
+
window.requestAnimationFrame(async () => await createAsync());
|
|
58
|
+
} else
|
|
59
|
+
await createAsync();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return element;
|
|
64
|
+
};
|
|
65
|
+
var node_default = createNode;
|
|
66
|
+
export {
|
|
67
|
+
createNode,
|
|
68
|
+
node_default as default
|
|
69
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { exec, isArray, isObject, deepClone, deepMerge } from "@domql/utils";
|
|
2
|
+
import { IGNORE_PROPS_PARAMS } from "./ignore.js";
|
|
3
|
+
import { inheritParentProps } from "./inherit.js";
|
|
4
|
+
const createPropsStack = (element, parent) => {
|
|
5
|
+
const { props, __ref: ref } = element;
|
|
6
|
+
const propsStack = ref.__props = inheritParentProps(element, parent);
|
|
7
|
+
if (isObject(props))
|
|
8
|
+
propsStack.push(props);
|
|
9
|
+
else if (props === "inherit" && parent.props)
|
|
10
|
+
propsStack.push(parent.props);
|
|
11
|
+
else if (props)
|
|
12
|
+
propsStack.push(props);
|
|
13
|
+
if (isArray(ref.__extend)) {
|
|
14
|
+
ref.__extend.forEach((extend) => {
|
|
15
|
+
if (extend.props && extend.props !== props)
|
|
16
|
+
propsStack.push(extend.props);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
ref.__props = propsStack;
|
|
20
|
+
return propsStack;
|
|
21
|
+
};
|
|
22
|
+
const syncProps = (props, element, opts) => {
|
|
23
|
+
element.props = {};
|
|
24
|
+
const mergedProps = {};
|
|
25
|
+
props.forEach((v) => {
|
|
26
|
+
if (IGNORE_PROPS_PARAMS.includes(v))
|
|
27
|
+
return;
|
|
28
|
+
let execProps;
|
|
29
|
+
try {
|
|
30
|
+
execProps = exec(v, element);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
element.error(e, opts);
|
|
33
|
+
}
|
|
34
|
+
element.props = deepMerge(
|
|
35
|
+
mergedProps,
|
|
36
|
+
deepClone(execProps, { ignore: IGNORE_PROPS_PARAMS }),
|
|
37
|
+
IGNORE_PROPS_PARAMS
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
element.props = mergedProps;
|
|
41
|
+
const methods = { update: update.bind(element.props), __element: element };
|
|
42
|
+
Object.setPrototypeOf(element.props, methods);
|
|
43
|
+
return element.props;
|
|
44
|
+
};
|
|
45
|
+
const createProps = function(element, parent, options) {
|
|
46
|
+
const { __ref: ref } = element;
|
|
47
|
+
const applyProps = () => {
|
|
48
|
+
const propsStack = options.cachedProps || createPropsStack(element, parent);
|
|
49
|
+
if (propsStack.length) {
|
|
50
|
+
ref.__props = propsStack;
|
|
51
|
+
syncProps(propsStack, element);
|
|
52
|
+
} else {
|
|
53
|
+
ref.__props = options.cachedProps || [];
|
|
54
|
+
element.props = {};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
if (ref.__if)
|
|
58
|
+
applyProps();
|
|
59
|
+
else {
|
|
60
|
+
try {
|
|
61
|
+
applyProps();
|
|
62
|
+
} catch {
|
|
63
|
+
element.props = {};
|
|
64
|
+
ref.__props = options.cachedProps || [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const methods = { update: update.bind(element.props), __element: element };
|
|
68
|
+
Object.setPrototypeOf(element.props, methods);
|
|
69
|
+
return element;
|
|
70
|
+
};
|
|
71
|
+
function update(props, options) {
|
|
72
|
+
const element = this.__element;
|
|
73
|
+
element.update({ props }, options);
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
createProps,
|
|
77
|
+
syncProps
|
|
78
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { exec, is, isString } from "@domql/utils";
|
|
2
|
+
const objectizeStringProperty = (propValue) => {
|
|
3
|
+
if (is(propValue)("string", "number")) {
|
|
4
|
+
return { inheritedString: propValue };
|
|
5
|
+
}
|
|
6
|
+
return propValue;
|
|
7
|
+
};
|
|
8
|
+
const inheritParentProps = (element, parent) => {
|
|
9
|
+
var _a;
|
|
10
|
+
let propsStack = [];
|
|
11
|
+
const parentProps = exec(parent, parent.state).props;
|
|
12
|
+
const matchParent = parent.props && parentProps[element.key];
|
|
13
|
+
const matchParentIsString = isString(matchParent);
|
|
14
|
+
const matchParentChildProps = parentProps && parentProps.childProps;
|
|
15
|
+
if (matchParent) {
|
|
16
|
+
if (matchParentIsString) {
|
|
17
|
+
const inheritedStringExists = propsStack.filter((v) => v.inheritedString)[0];
|
|
18
|
+
if (inheritedStringExists)
|
|
19
|
+
inheritedStringExists.inheritedString = matchParent;
|
|
20
|
+
else {
|
|
21
|
+
propsStack = [].concat(objectizeStringProperty(matchParent), propsStack);
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
propsStack.push(objectizeStringProperty(matchParent));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (matchParentChildProps && !((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.ignoreChildProps))
|
|
28
|
+
propsStack.push(matchParentChildProps);
|
|
29
|
+
return propsStack;
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
inheritParentProps
|
|
33
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { syncProps } from "./create.js";
|
|
2
|
+
import { inheritParentProps } from "./inherit.js";
|
|
3
|
+
const updateProps = (newProps, element, parent) => {
|
|
4
|
+
const { __ref } = element;
|
|
5
|
+
let propsStack = __ref.__props;
|
|
6
|
+
const parentProps = inheritParentProps(element, parent);
|
|
7
|
+
if (parentProps.length)
|
|
8
|
+
propsStack = __ref.__props = [].concat(parentProps, propsStack);
|
|
9
|
+
if (newProps)
|
|
10
|
+
propsStack = __ref.__props = [].concat(newProps, propsStack);
|
|
11
|
+
if (propsStack)
|
|
12
|
+
syncProps(propsStack, element);
|
|
13
|
+
return element;
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
updateProps
|
|
17
|
+
};
|
package/dist/esm/set.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { deepContains, setContentKey } from "@domql/utils";
|
|
2
|
+
import { OPTIONS } from "./cache/options.js";
|
|
3
|
+
import { create } from "./create.js";
|
|
4
|
+
import { registry } from "./mixins/index.js";
|
|
5
|
+
import { removeContent } from "./mixins/content.js";
|
|
6
|
+
import { triggerEventOn, triggerEventOnUpdate } from "@domql/event";
|
|
7
|
+
const resetElement = (params, element, options) => {
|
|
8
|
+
if (!options.preventRemove)
|
|
9
|
+
removeContent(element, options);
|
|
10
|
+
const { __ref: ref } = element;
|
|
11
|
+
create(params, element, ref.contentElementKey || "content", {
|
|
12
|
+
ignoreChildExtend: true,
|
|
13
|
+
...registry.defaultOptions,
|
|
14
|
+
...OPTIONS.create,
|
|
15
|
+
...options
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const reset = (options) => {
|
|
19
|
+
const element = void 0;
|
|
20
|
+
create(element, element.parent, void 0, {
|
|
21
|
+
ignoreChildExtend: true,
|
|
22
|
+
...registry.defaultOptions,
|
|
23
|
+
...OPTIONS.create,
|
|
24
|
+
...options
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const set = function(params, options = {}, el) {
|
|
28
|
+
var _a;
|
|
29
|
+
const element = el || this;
|
|
30
|
+
const { __ref: ref } = element;
|
|
31
|
+
const content = setContentKey(element, options);
|
|
32
|
+
const __contentRef = content && content.__ref;
|
|
33
|
+
const lazyLoad = element.props && element.props.lazyLoad;
|
|
34
|
+
const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
|
|
35
|
+
if (options.preventContentUpdate === true && !hasCollection)
|
|
36
|
+
return;
|
|
37
|
+
if (ref.__noCollectionDifference || __contentRef && __contentRef.__cached && deepContains(params, content)) {
|
|
38
|
+
if (!options.preventBeforeUpdateListener && !options.preventListeners) {
|
|
39
|
+
const beforeUpdateReturns = triggerEventOnUpdate("beforeUpdate", params, element, options);
|
|
40
|
+
if (beforeUpdateReturns === false)
|
|
41
|
+
return element;
|
|
42
|
+
}
|
|
43
|
+
if (content == null ? void 0 : content.update)
|
|
44
|
+
content.update();
|
|
45
|
+
if (!options.preventUpdateListener)
|
|
46
|
+
triggerEventOn("update", element, options);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (params) {
|
|
50
|
+
let { childExtend, childProps, props } = params;
|
|
51
|
+
if (!childExtend && element.childExtend)
|
|
52
|
+
params.childExtend = element.childExtend;
|
|
53
|
+
if (!childProps && element.childProps)
|
|
54
|
+
params.childProps = element.childProps;
|
|
55
|
+
if (!(props == null ? void 0 : props.childProps) && ((_a = element.props) == null ? void 0 : _a.childProps)) {
|
|
56
|
+
if (!props)
|
|
57
|
+
props = params.props = {};
|
|
58
|
+
props.childProps = element.props.childProps;
|
|
59
|
+
}
|
|
60
|
+
if (lazyLoad) {
|
|
61
|
+
window.requestAnimationFrame(() => resetElement(params, element, options));
|
|
62
|
+
} else
|
|
63
|
+
resetElement(params, element, options);
|
|
64
|
+
}
|
|
65
|
+
return element;
|
|
66
|
+
};
|
|
67
|
+
var set_default = set;
|
|
68
|
+
export {
|
|
69
|
+
set_default as default,
|
|
70
|
+
reset,
|
|
71
|
+
resetElement,
|
|
72
|
+
set
|
|
73
|
+
};
|
package/dist/esm/tree.js
ADDED