@domql/element 2.5.200 → 2.5.205
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 +5 -5
- package/dist/cjs/create.js +88 -46
- package/dist/cjs/define.js +2 -1
- package/dist/cjs/extend.js +8 -4
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/iterate.js +18 -9
- package/dist/cjs/methods/index.js +69 -36
- package/dist/cjs/methods/set.js +2 -1
- package/dist/cjs/methods/v2.js +12 -6
- package/dist/cjs/mixins/attr.js +8 -4
- package/dist/cjs/mixins/classList.js +16 -8
- package/dist/cjs/mixins/content.js +16 -9
- package/dist/cjs/mixins/data.js +4 -2
- package/dist/cjs/mixins/html.js +4 -2
- package/dist/cjs/mixins/scope.js +2 -1
- package/dist/cjs/mixins/state.js +4 -2
- package/dist/cjs/mixins/style.js +4 -2
- package/dist/cjs/mixins/text.js +6 -3
- package/dist/cjs/node.js +13 -7
- package/dist/cjs/props/create.js +12 -6
- package/dist/cjs/props/inherit.js +4 -2
- package/dist/cjs/props/update.js +6 -3
- package/dist/cjs/set.js +16 -9
- package/dist/cjs/update.js +53 -29
- package/dist/cjs/utils/applyParam.js +4 -3
- package/dist/cjs/utils/component.js +6 -3
- package/dist/cjs/utils/extendUtils.js +19 -10
- package/dist/cjs/utils/object.js +16 -8
- package/dist/cjs/utils/onlyResolveExtends.js +26 -13
- package/dist/cjs/utils/propEvents.js +4 -2
- package/dist/esm/create.js +88 -46
- package/dist/esm/define.js +2 -1
- package/dist/esm/extend.js +8 -4
- package/dist/esm/iterate.js +18 -9
- package/dist/esm/methods/index.js +69 -36
- package/dist/esm/methods/set.js +2 -1
- package/dist/esm/methods/v2.js +12 -6
- package/dist/esm/mixins/attr.js +8 -4
- package/dist/esm/mixins/classList.js +16 -8
- package/dist/esm/mixins/content.js +16 -9
- package/dist/esm/mixins/data.js +4 -2
- package/dist/esm/mixins/html.js +4 -2
- package/dist/esm/mixins/scope.js +2 -1
- package/dist/esm/mixins/state.js +4 -2
- package/dist/esm/mixins/style.js +4 -2
- package/dist/esm/mixins/text.js +6 -3
- package/dist/esm/node.js +13 -7
- package/dist/esm/props/create.js +12 -6
- package/dist/esm/props/inherit.js +4 -2
- package/dist/esm/props/update.js +6 -3
- package/dist/esm/set.js +16 -9
- package/dist/esm/update.js +53 -29
- package/dist/esm/utils/applyParam.js +4 -3
- package/dist/esm/utils/component.js +6 -3
- package/dist/esm/utils/extendUtils.js +19 -10
- package/dist/esm/utils/object.js +16 -8
- package/dist/esm/utils/onlyResolveExtends.js +26 -13
- package/dist/esm/utils/propEvents.js +4 -2
- package/methods/index.js +3 -3
- package/mixins/content.js +2 -2
- package/node.js +1 -1
- package/package.json +8 -8
- package/set.js +3 -3
- package/update.js +6 -6
- package/utils/applyParam.js +2 -2
- package/utils/extendUtils.js +1 -1
package/create.js
CHANGED
|
@@ -128,13 +128,13 @@ export const create = async (element, parent, key, options = OPTIONS.create || {
|
|
|
128
128
|
const createBasedOnType = (element, parent, key, options) => {
|
|
129
129
|
// if ELEMENT is not given
|
|
130
130
|
if (element === undefined) {
|
|
131
|
-
if (ENV === '
|
|
131
|
+
if (ENV === 'testing' || ENV === 'development') {
|
|
132
132
|
console.warn(key, 'element is undefined in', parent && parent.__ref && parent.__ref.path)
|
|
133
133
|
}
|
|
134
134
|
return {}
|
|
135
135
|
}
|
|
136
136
|
if (isString(key) && key.slice(0, 2 === '__')) {
|
|
137
|
-
if (ENV === '
|
|
137
|
+
if (ENV === 'testing' || ENV === 'development') {
|
|
138
138
|
console.warn(key, 'seems like to be in __ref')
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -215,7 +215,7 @@ const addElementIntoParentChildren = (element, parent) => {
|
|
|
215
215
|
const visitedElements = new WeakMap()
|
|
216
216
|
const renderElement = async (element, parent, options, attachOptions) => {
|
|
217
217
|
if (visitedElements.has(element)) {
|
|
218
|
-
if (ENV === '
|
|
218
|
+
if (ENV === 'testing' || ENV === 'development') console.warn('Cyclic rendering detected:', element.__ref.path)
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
visitedElements.set(element, true)
|
|
@@ -230,7 +230,7 @@ const renderElement = async (element, parent, options, attachOptions) => {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
// CREATE a real NODE
|
|
233
|
-
if (ENV === '
|
|
233
|
+
if (ENV === 'testing' || ENV === 'development') {
|
|
234
234
|
await createNestedChild()
|
|
235
235
|
} else {
|
|
236
236
|
try {
|
|
@@ -344,7 +344,7 @@ const addCaching = (element, parent) => {
|
|
|
344
344
|
if (!ref.root) ref.root = hasRoot ? element : parentRef.root
|
|
345
345
|
|
|
346
346
|
// set the PATH array
|
|
347
|
-
// if (ENV === '
|
|
347
|
+
// if (ENV === 'testing' || ENV === 'development') {
|
|
348
348
|
if (!parentRef) parentRef = parent.ref = {}
|
|
349
349
|
if (!parentRef.path) parentRef.path = []
|
|
350
350
|
ref.path = parentRef.path.concat(element.key)
|
package/dist/cjs/create.js
CHANGED
|
@@ -63,17 +63,20 @@ const create = async (element, parent, key, options = import_options.OPTIONS.cre
|
|
|
63
63
|
(0, import_set.addMethods)(element, parent, options);
|
|
64
64
|
createScope(element, parent);
|
|
65
65
|
await (0, import_state.createState)(element, parent);
|
|
66
|
-
if (element.scope === "state")
|
|
66
|
+
if (element.scope === "state")
|
|
67
|
+
element.scope = element.state;
|
|
67
68
|
createIfConditionFlag(element, parent);
|
|
68
69
|
(0, import_props.createProps)(element, parent, options);
|
|
69
|
-
if (element.scope === "props" || element.scope === true)
|
|
70
|
+
if (element.scope === "props" || element.scope === true)
|
|
71
|
+
element.scope = element.props;
|
|
70
72
|
createIfConditionFlag(element, parent);
|
|
71
73
|
if (element.node && ref.__if) {
|
|
72
74
|
return (0, import_render.assignNode)(element, parent, key, attachOptions);
|
|
73
75
|
}
|
|
74
76
|
(0, import_component.applyVariant)(element, parent);
|
|
75
77
|
const onInit = await (0, import_event.triggerEventOn)("init", element, options);
|
|
76
|
-
if (onInit === false)
|
|
78
|
+
if (onInit === false)
|
|
79
|
+
return element;
|
|
77
80
|
(0, import_event.triggerEventOn)("beforeClassAssign", element, options);
|
|
78
81
|
(0, import_classList.assignKeyAsClassname)(element);
|
|
79
82
|
(0, import_utils.addChildrenIfNotInOriginal)(element, parent, key);
|
|
@@ -84,18 +87,20 @@ const create = async (element, parent, key, options = import_options.OPTIONS.cre
|
|
|
84
87
|
};
|
|
85
88
|
const createBasedOnType = (element, parent, key, options) => {
|
|
86
89
|
if (element === void 0) {
|
|
87
|
-
if (ENV === "
|
|
90
|
+
if (ENV === "testing" || ENV === "development") {
|
|
88
91
|
console.warn(key, "element is undefined in", parent && parent.__ref && parent.__ref.path);
|
|
89
92
|
}
|
|
90
93
|
return {};
|
|
91
94
|
}
|
|
92
|
-
if ((0, import_utils.isString)(key) && key.slice(0,
|
|
93
|
-
if (ENV === "
|
|
95
|
+
if ((0, import_utils.isString)(key) && key.slice(0, 2 === "__")) {
|
|
96
|
+
if (ENV === "testing" || ENV === "development") {
|
|
94
97
|
console.warn(key, "seems like to be in __ref");
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
|
-
if (element === null)
|
|
98
|
-
|
|
100
|
+
if (element === null)
|
|
101
|
+
return;
|
|
102
|
+
if (element === true)
|
|
103
|
+
return { text: true };
|
|
99
104
|
if (element.__hash) {
|
|
100
105
|
return { extend: element };
|
|
101
106
|
}
|
|
@@ -104,8 +109,10 @@ const createBasedOnType = (element, parent, key, options) => {
|
|
|
104
109
|
const redefineElement = (element, parent, key, options) => {
|
|
105
110
|
const elementWrapper = createBasedOnType(element, parent, key, options);
|
|
106
111
|
if (options.syntaxv3 || element.props && element.props.syntaxv3 || parent && parent.props && parent.props.syntaxv3) {
|
|
107
|
-
if (element.props)
|
|
108
|
-
|
|
112
|
+
if (element.props)
|
|
113
|
+
element.props.syntaxv3 = true;
|
|
114
|
+
else
|
|
115
|
+
element.syntaxv3 = true;
|
|
109
116
|
return (0, import_component.createValidDomqlObjectFromSugar)(element, parent, key, options);
|
|
110
117
|
} else if ((0, import_utils.checkIfKeyIsComponent)(key)) {
|
|
111
118
|
return (0, import_utils.applyKeyComponentAsExtend)(elementWrapper, parent, key);
|
|
@@ -116,7 +123,8 @@ const redefineElement = (element, parent, key, options) => {
|
|
|
116
123
|
return elementWrapper;
|
|
117
124
|
};
|
|
118
125
|
const redefineParent = (element, parent, key, options) => {
|
|
119
|
-
if (!parent)
|
|
126
|
+
if (!parent)
|
|
127
|
+
return import_tree.ROOT;
|
|
120
128
|
if ((0, import_utils.isNode)(parent)) {
|
|
121
129
|
const parentNodeWrapper = { key: ":root", node: parent };
|
|
122
130
|
import_tree.ROOT[`${key}_parent`] = parentNodeWrapper;
|
|
@@ -134,48 +142,58 @@ const createKey = (element, parent, key) => {
|
|
|
134
142
|
return ((0, import_utils.exec)(key, element) || key || element.key || (0, import_utils.generateKey)()).toString();
|
|
135
143
|
};
|
|
136
144
|
const addRef = (element, parent) => {
|
|
137
|
-
if (element.__ref)
|
|
138
|
-
|
|
145
|
+
if (element.__ref)
|
|
146
|
+
element.__ref.origin = element;
|
|
147
|
+
else
|
|
148
|
+
element.__ref = { origin: element };
|
|
139
149
|
return element.__ref;
|
|
140
150
|
};
|
|
141
151
|
const switchDefaultOptions = (element, parent, options) => {
|
|
142
152
|
if (Object.keys(options).length) {
|
|
143
153
|
import_mixins.registry.defaultOptions = options;
|
|
144
|
-
if (options.ignoreChildExtend)
|
|
154
|
+
if (options.ignoreChildExtend)
|
|
155
|
+
delete options.ignoreChildExtend;
|
|
145
156
|
}
|
|
146
157
|
};
|
|
147
158
|
const addElementIntoParentChildren = (element, parent) => {
|
|
148
|
-
if (parent.__ref && parent.__ref.__children)
|
|
159
|
+
if (parent.__ref && parent.__ref.__children)
|
|
160
|
+
parent.__ref.__children.push(element.key);
|
|
149
161
|
};
|
|
150
162
|
const visitedElements = /* @__PURE__ */ new WeakMap();
|
|
151
163
|
const renderElement = async (element, parent, options, attachOptions) => {
|
|
152
164
|
var _a, _b, _c, _d;
|
|
153
165
|
if (visitedElements.has(element)) {
|
|
154
|
-
if (ENV === "
|
|
166
|
+
if (ENV === "testing" || ENV === "development")
|
|
167
|
+
console.warn("Cyclic rendering detected:", element.__ref.path);
|
|
155
168
|
}
|
|
156
169
|
visitedElements.set(element, true);
|
|
157
170
|
const { __ref: ref, key } = element;
|
|
158
171
|
const createNestedChild = async () => {
|
|
159
172
|
const isInfiniteLoopDetected = (0, import_utils.detectInfiniteLoop)(ref.path);
|
|
160
|
-
if (ref.__uniqId || isInfiniteLoopDetected)
|
|
173
|
+
if (ref.__uniqId || isInfiniteLoopDetected)
|
|
174
|
+
return;
|
|
161
175
|
await (0, import_node.createNode)(element, options);
|
|
162
176
|
ref.__uniqId = Math.random();
|
|
163
177
|
};
|
|
164
|
-
if (ENV === "
|
|
178
|
+
if (ENV === "testing" || ENV === "development") {
|
|
165
179
|
await createNestedChild();
|
|
166
180
|
} else {
|
|
167
181
|
try {
|
|
168
182
|
await createNestedChild();
|
|
169
183
|
} catch (e) {
|
|
170
184
|
const path = ref.path;
|
|
171
|
-
if (path.includes("ComponentsGrid"))
|
|
172
|
-
|
|
185
|
+
if (path.includes("ComponentsGrid"))
|
|
186
|
+
path.splice(0, path.indexOf("ComponentsGrid") + 2);
|
|
187
|
+
if (path.includes("demoComponent"))
|
|
188
|
+
path.splice(0, path.indexOf("demoComponent") + 1);
|
|
173
189
|
const isDemoComponent = (_b = (_a = element.lookup((el) => el.state.key)) == null ? void 0 : _a.state) == null ? void 0 : _b.key;
|
|
174
190
|
element.warn("Error happened in:", isDemoComponent ? isDemoComponent + " " : "" + path.join("."));
|
|
175
191
|
element.verbose();
|
|
176
192
|
element.error(e, options);
|
|
177
|
-
if ((_c = element.on) == null ? void 0 : _c.error)
|
|
178
|
-
|
|
193
|
+
if ((_c = element.on) == null ? void 0 : _c.error)
|
|
194
|
+
element.on.error(e, element, element.state, element.context, options);
|
|
195
|
+
if ((_d = element.props) == null ? void 0 : _d.onError)
|
|
196
|
+
element.props.onError(e, element, element.state, element.context, options);
|
|
179
197
|
}
|
|
180
198
|
}
|
|
181
199
|
if (!ref.__if) {
|
|
@@ -202,37 +220,55 @@ const applyValueAsText = (element, parent, key) => {
|
|
|
202
220
|
};
|
|
203
221
|
const applyContext = (element, parent, options) => {
|
|
204
222
|
const forcedOptionsContext = options.context && !import_tree.ROOT.context && !element.context;
|
|
205
|
-
if (forcedOptionsContext)
|
|
206
|
-
|
|
223
|
+
if (forcedOptionsContext)
|
|
224
|
+
import_tree.ROOT.context = options.context;
|
|
225
|
+
if (!element.context)
|
|
226
|
+
element.context = parent.context || options.context || import_tree.ROOT.context;
|
|
207
227
|
};
|
|
208
228
|
const createScope = (element, parent) => {
|
|
209
229
|
const { __ref: ref } = element;
|
|
210
|
-
if (!element.scope)
|
|
230
|
+
if (!element.scope)
|
|
231
|
+
element.scope = parent.scope || ref.root.scope || {};
|
|
211
232
|
};
|
|
212
233
|
const createIfConditionFlag = (element, parent) => {
|
|
213
234
|
const { __ref: ref } = element;
|
|
214
235
|
if ((0, import_utils.isFunction)(element.if) && !element.if(element, element.state, element.context)) {
|
|
215
236
|
delete ref.__if;
|
|
216
|
-
} else
|
|
237
|
+
} else
|
|
238
|
+
ref.__if = true;
|
|
217
239
|
};
|
|
218
240
|
const addCaching = (element, parent) => {
|
|
219
241
|
const { __ref: ref, key } = element;
|
|
220
242
|
let { __ref: parentRef } = parent;
|
|
221
|
-
if (!element.transform)
|
|
222
|
-
|
|
223
|
-
if (!ref.
|
|
224
|
-
|
|
225
|
-
if (!ref.
|
|
226
|
-
|
|
227
|
-
if (!ref.
|
|
228
|
-
|
|
229
|
-
if (!ref.
|
|
230
|
-
|
|
231
|
-
if (
|
|
243
|
+
if (!element.transform)
|
|
244
|
+
element.transform = {};
|
|
245
|
+
if (!ref.__cached)
|
|
246
|
+
ref.__cached = {};
|
|
247
|
+
if (!ref.__defineCache)
|
|
248
|
+
ref.__defineCache = {};
|
|
249
|
+
if (!ref.__exec)
|
|
250
|
+
ref.__exec = {};
|
|
251
|
+
if (!ref.__execProps)
|
|
252
|
+
ref.__execProps = {};
|
|
253
|
+
if (!ref.__class)
|
|
254
|
+
ref.__class = {};
|
|
255
|
+
if (!ref.__classNames)
|
|
256
|
+
ref.__classNames = {};
|
|
257
|
+
if (!ref.__attr)
|
|
258
|
+
ref.__attr = {};
|
|
259
|
+
if (!ref.__changes)
|
|
260
|
+
ref.__changes = [];
|
|
261
|
+
if (!ref.__children)
|
|
262
|
+
ref.__children = [];
|
|
263
|
+
if ((0, import_utils.checkIfKeyIsComponent)(key))
|
|
264
|
+
ref.__componentKey = key.split("_")[0].split(".")[0].split("+")[0];
|
|
232
265
|
const hasRoot = parent && parent.key === ":root";
|
|
233
|
-
if (!ref.root)
|
|
234
|
-
|
|
235
|
-
if (!parentRef
|
|
266
|
+
if (!ref.root)
|
|
267
|
+
ref.root = hasRoot ? element : parentRef.root;
|
|
268
|
+
if (!parentRef)
|
|
269
|
+
parentRef = parent.ref = {};
|
|
270
|
+
if (!parentRef.path)
|
|
271
|
+
parentRef.path = [];
|
|
236
272
|
ref.path = parentRef.path.concat(element.key);
|
|
237
273
|
};
|
|
238
274
|
const onlyResolveExtends = (element, parent, key, options) => {
|
|
@@ -242,14 +278,17 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
242
278
|
(0, import_set.addMethods)(element, parent, options);
|
|
243
279
|
createScope(element, parent);
|
|
244
280
|
(0, import_state.createState)(element, parent);
|
|
245
|
-
if (element.scope === "state")
|
|
281
|
+
if (element.scope === "state")
|
|
282
|
+
element.scope = element.state;
|
|
246
283
|
createIfConditionFlag(element, parent);
|
|
247
284
|
(0, import_props.createProps)(element, parent, options);
|
|
248
|
-
if (element.scope === "props" || element.scope === true)
|
|
285
|
+
if (element.scope === "props" || element.scope === true)
|
|
286
|
+
element.scope = element.props;
|
|
249
287
|
if (element.node && ref.__if) {
|
|
250
288
|
parent[key || element.key] = element;
|
|
251
289
|
}
|
|
252
|
-
if (!element.props)
|
|
290
|
+
if (!element.props)
|
|
291
|
+
element.props = {};
|
|
253
292
|
(0, import_component.applyVariant)(element, parent);
|
|
254
293
|
addElementIntoParentChildren(element, parent);
|
|
255
294
|
}
|
|
@@ -257,7 +296,8 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
257
296
|
(0, import_iterate.throughInitialDefine)(element);
|
|
258
297
|
(0, import_iterate.throughInitialExec)(element);
|
|
259
298
|
for (const k in element) {
|
|
260
|
-
if ((0, import_utils.isUndefined)(element[k]) || (0, import_methods.isMethod)(k, element) || (0, import_utils.isObject)((import_mixins.registry.default || import_mixins.registry)[k]) || (0, import_utils.isVariant)(k))
|
|
299
|
+
if ((0, import_utils.isUndefined)(element[k]) || (0, import_methods.isMethod)(k, element) || (0, import_utils.isObject)((import_mixins.registry.default || import_mixins.registry)[k]) || (0, import_utils.isVariant)(k))
|
|
300
|
+
continue;
|
|
261
301
|
const hasDefine = element.define && element.define[k];
|
|
262
302
|
const contextHasDefine = element.context && element.context.define && element.context.define[k];
|
|
263
303
|
const optionsHasDefine = options.define && options.define[k];
|
|
@@ -282,8 +322,10 @@ const applyMediaProps = (element, parent, key) => {
|
|
|
282
322
|
const { props } = element;
|
|
283
323
|
if (props) {
|
|
284
324
|
props.display = "none";
|
|
285
|
-
if (props[key])
|
|
286
|
-
|
|
325
|
+
if (props[key])
|
|
326
|
+
props[key].display = props.display;
|
|
327
|
+
else
|
|
328
|
+
props[key] = { display: props.display || "block" };
|
|
287
329
|
return element;
|
|
288
330
|
} else {
|
|
289
331
|
return {
|
package/dist/cjs/define.js
CHANGED
|
@@ -28,6 +28,7 @@ var define_default = (params, options = {}) => {
|
|
|
28
28
|
for (const param in params) {
|
|
29
29
|
if (import_mixins.REGISTRY[param] && !overwrite) {
|
|
30
30
|
(0, import_report.report)("OverwriteToBuiltin", param);
|
|
31
|
-
} else
|
|
31
|
+
} else
|
|
32
|
+
import_mixins.REGISTRY[param] = params[param];
|
|
32
33
|
}
|
|
33
34
|
};
|
package/dist/cjs/extend.js
CHANGED
|
@@ -26,14 +26,16 @@ var import_utils2 = require("./utils/index.js");
|
|
|
26
26
|
const ENV = "development";
|
|
27
27
|
let mainExtend;
|
|
28
28
|
const applyExtend = (element, parent, options = {}) => {
|
|
29
|
-
if ((0, import_utils.isFunction)(element))
|
|
29
|
+
if ((0, import_utils.isFunction)(element))
|
|
30
|
+
element = (0, import_utils.exec)(element, parent);
|
|
30
31
|
const { props, __ref } = element;
|
|
31
32
|
let extend = (props == null ? void 0 : props.extends) || element.extends || element.extend;
|
|
32
33
|
const variant = props == null ? void 0 : props.variant;
|
|
33
34
|
const context = element.context || parent.context;
|
|
34
35
|
extend = (0, import_utils2.fallbackStringExtend)(extend, context, options, variant);
|
|
35
36
|
const extendStack = (0, import_utils2.getExtendStack)(extend, context);
|
|
36
|
-
if (ENV !== "test" || ENV !== "development")
|
|
37
|
+
if (ENV !== "test" || ENV !== "development")
|
|
38
|
+
delete element.extend;
|
|
37
39
|
let childExtendStack = [];
|
|
38
40
|
if (parent) {
|
|
39
41
|
element.parent = parent;
|
|
@@ -59,7 +61,8 @@ const applyExtend = (element, parent, options = {}) => {
|
|
|
59
61
|
stack = extendStack;
|
|
60
62
|
} else if (childExtendLength) {
|
|
61
63
|
stack = childExtendStack;
|
|
62
|
-
} else if (!context.defaultExtends)
|
|
64
|
+
} else if (!context.defaultExtends)
|
|
65
|
+
return element;
|
|
63
66
|
if (context.defaultExtends) {
|
|
64
67
|
if (!mainExtend) {
|
|
65
68
|
const defaultOptionsExtend = (0, import_utils2.getExtendStack)(context.defaultExtends, context);
|
|
@@ -68,7 +71,8 @@ const applyExtend = (element, parent, options = {}) => {
|
|
|
68
71
|
}
|
|
69
72
|
stack = [].concat(stack, mainExtend);
|
|
70
73
|
}
|
|
71
|
-
if (__ref)
|
|
74
|
+
if (__ref)
|
|
75
|
+
__ref.__extend = stack;
|
|
72
76
|
let mergedExtend = (0, import_utils2.cloneAndMergeArrayExtend)(stack);
|
|
73
77
|
const COMPONENTS = context && context.components || options.components;
|
|
74
78
|
const component = (0, import_utils.exec)(element.component || mergedExtend.component, element);
|
package/dist/cjs/index.js
CHANGED
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var element_exports = {};
|
|
30
|
+
__export(element_exports, {
|
|
31
31
|
TREE: () => import_tree.TREE,
|
|
32
32
|
create: () => import_create.default,
|
|
33
33
|
createNode: () => import_node.default,
|
|
@@ -35,7 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
set: () => import_set.default,
|
|
36
36
|
update: () => import_update.default
|
|
37
37
|
});
|
|
38
|
-
module.exports = __toCommonJS(
|
|
38
|
+
module.exports = __toCommonJS(element_exports);
|
|
39
39
|
var import_tree = require("./tree");
|
|
40
40
|
var import_create = __toESM(require("./create"), 1);
|
|
41
41
|
var import_node = __toESM(require("./node"), 1);
|
package/dist/cjs/iterate.js
CHANGED
|
@@ -31,7 +31,8 @@ var import_methods = require("./methods/index.js");
|
|
|
31
31
|
const throughInitialExec = (element, exclude = {}) => {
|
|
32
32
|
const { __ref: ref } = element;
|
|
33
33
|
for (const param in element) {
|
|
34
|
-
if (exclude[param])
|
|
34
|
+
if (exclude[param])
|
|
35
|
+
continue;
|
|
35
36
|
const prop = element[param];
|
|
36
37
|
if ((0, import_utils.isFunction)(prop) && !(0, import_methods.isMethod)(param, element) && !(0, import_utils.isVariant)(param)) {
|
|
37
38
|
ref.__exec[param] = prop;
|
|
@@ -45,7 +46,8 @@ const throughUpdatedExec = (element, options = { excludes: import_utils2.METHODS
|
|
|
45
46
|
for (const param in ref.__exec) {
|
|
46
47
|
const prop = element[param];
|
|
47
48
|
const isDefinedParam = ref.__defineCache[param];
|
|
48
|
-
if (isDefinedParam)
|
|
49
|
+
if (isDefinedParam)
|
|
50
|
+
continue;
|
|
49
51
|
const newExec = ref.__exec[param](element, element.state, element.context);
|
|
50
52
|
const execReturnsString = (0, import_utils.isString)(newExec) || (0, import_utils.isNumber)(newExec);
|
|
51
53
|
if (prop && prop.node && execReturnsString) {
|
|
@@ -80,8 +82,10 @@ const throughInitialDefine = (element) => {
|
|
|
80
82
|
const { define, context, __ref: ref } = element;
|
|
81
83
|
let defineObj = {};
|
|
82
84
|
const hasGlobalDefine = context && (0, import_utils.isObject)(context.define);
|
|
83
|
-
if ((0, import_utils.isObject)(define))
|
|
84
|
-
|
|
85
|
+
if ((0, import_utils.isObject)(define))
|
|
86
|
+
defineObj = { ...define };
|
|
87
|
+
if (hasGlobalDefine)
|
|
88
|
+
defineObj = { ...defineObj, ...context.define };
|
|
85
89
|
for (const param in defineObj) {
|
|
86
90
|
let elementProp = element[param];
|
|
87
91
|
if ((0, import_utils.isFunction)(elementProp) && !(0, import_methods.isMethod)(param, element) && !(0, import_utils.isVariant)(param)) {
|
|
@@ -93,7 +97,8 @@ const throughInitialDefine = (element) => {
|
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
const execParam = defineObj[param](elementProp, element, element.state, element.context);
|
|
96
|
-
if (execParam)
|
|
100
|
+
if (execParam)
|
|
101
|
+
element[param] = execParam;
|
|
97
102
|
}
|
|
98
103
|
return element;
|
|
99
104
|
};
|
|
@@ -101,14 +106,18 @@ const throughUpdatedDefine = (element) => {
|
|
|
101
106
|
const { context, define, __ref: ref } = element;
|
|
102
107
|
const changes = {};
|
|
103
108
|
let obj = {};
|
|
104
|
-
if ((0, import_utils.isObject)(define))
|
|
105
|
-
|
|
109
|
+
if ((0, import_utils.isObject)(define))
|
|
110
|
+
obj = { ...define };
|
|
111
|
+
if ((0, import_utils.isObject)(context && context.define))
|
|
112
|
+
obj = { ...obj, ...context.define };
|
|
106
113
|
for (const param in obj) {
|
|
107
114
|
const execParam = ref.__exec[param];
|
|
108
|
-
if (execParam)
|
|
115
|
+
if (execParam)
|
|
116
|
+
ref.__defineCache[param] = execParam(element, element.state, element.context);
|
|
109
117
|
const cached = (0, import_utils.exec)(ref.__defineCache[param], element);
|
|
110
118
|
const newExecParam = obj[param](cached, element, element.state, element.context);
|
|
111
|
-
if (newExecParam)
|
|
119
|
+
if (newExecParam)
|
|
120
|
+
element[param] = newExecParam;
|
|
112
121
|
}
|
|
113
122
|
return changes;
|
|
114
123
|
};
|