@domql/element 2.5.0 → 2.5.1
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 +7 -2
- package/dist/cjs/create.js +7 -4
- package/dist/cjs/extend.js +2 -2
- package/extend.js +5 -3
- package/package.json +2 -2
- package/LICENSE +0 -21
package/create.js
CHANGED
|
@@ -55,6 +55,9 @@ const create = (element, parent, key, options = OPTIONS.create || {}) => {
|
|
|
55
55
|
|
|
56
56
|
const ref = addRef(element, parent, key)
|
|
57
57
|
|
|
58
|
+
// assign initial props
|
|
59
|
+
ref.__initialProps = deepClone(element.props, [])
|
|
60
|
+
|
|
58
61
|
// assign context
|
|
59
62
|
applyContext(element, parent, options)
|
|
60
63
|
|
|
@@ -68,7 +71,7 @@ const create = (element, parent, key, options = OPTIONS.create || {}) => {
|
|
|
68
71
|
|
|
69
72
|
// Only resolve extends, skip everything else
|
|
70
73
|
if (options.onlyResolveExtends) {
|
|
71
|
-
return onlyResolveExtends(element, parent, options)
|
|
74
|
+
return onlyResolveExtends(element, parent, key, options)
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
replaceOptions(element, parent, options)
|
|
@@ -281,7 +284,7 @@ const addCaching = (element, parent) => {
|
|
|
281
284
|
}
|
|
282
285
|
}
|
|
283
286
|
|
|
284
|
-
const onlyResolveExtends = (element, parent, options) => {
|
|
287
|
+
const onlyResolveExtends = (element, parent, key, options) => {
|
|
285
288
|
const { __ref } = element
|
|
286
289
|
element.tag = detectTag(element)
|
|
287
290
|
|
|
@@ -317,6 +320,8 @@ const onlyResolveExtends = (element, parent, options) => {
|
|
|
317
320
|
}
|
|
318
321
|
}
|
|
319
322
|
|
|
323
|
+
parent[key || element.key] = element
|
|
324
|
+
|
|
320
325
|
delete element.update
|
|
321
326
|
delete element.__element
|
|
322
327
|
|
package/dist/cjs/create.js
CHANGED
|
@@ -36,6 +36,7 @@ var import_tree = require("./tree");
|
|
|
36
36
|
var import_registry = require("@domql/registry");
|
|
37
37
|
var import_event = require("@domql/event");
|
|
38
38
|
var import_render = require("@domql/render");
|
|
39
|
+
var import_node2 = require("@domql/node");
|
|
39
40
|
var import_state = require("@domql/state");
|
|
40
41
|
var import_methods = require("./methods");
|
|
41
42
|
var import_props = require("./props");
|
|
@@ -57,12 +58,13 @@ const create = (element, parent, key, options = import_options.default.create ||
|
|
|
57
58
|
parent = redefineParent(element, parent, key);
|
|
58
59
|
key = createKey(element, parent, key);
|
|
59
60
|
const ref = addRef(element, parent, key);
|
|
61
|
+
ref.__initialProps = deepClone(element.props, []);
|
|
60
62
|
applyContext(element, parent, options);
|
|
61
63
|
(0, import_component.applyComponentFromContext)(element, parent, options);
|
|
62
64
|
(0, import_extend.applyExtend)(element, parent, options);
|
|
63
65
|
element.key = key;
|
|
64
66
|
if (options.onlyResolveExtends) {
|
|
65
|
-
return onlyResolveExtends(element, parent, options);
|
|
67
|
+
return onlyResolveExtends(element, parent, key, options);
|
|
66
68
|
}
|
|
67
69
|
replaceOptions(element, parent, options);
|
|
68
70
|
addCaching(element, parent);
|
|
@@ -184,7 +186,7 @@ const createIfConditionFlag = (element, parent) => {
|
|
|
184
186
|
if ((0, import_utils.isFunction)(element.if)) {
|
|
185
187
|
const ifPassed = element.if(element, element.state);
|
|
186
188
|
if (!ifPassed) {
|
|
187
|
-
const ifFragment = (0,
|
|
189
|
+
const ifFragment = (0, import_node2.cacheNode)({ tag: "fragment" });
|
|
188
190
|
ref.__ifFragment = (0, import_render.appendNode)(ifFragment, parent.node);
|
|
189
191
|
delete ref.__if;
|
|
190
192
|
} else
|
|
@@ -224,9 +226,9 @@ const addCaching = (element, parent) => {
|
|
|
224
226
|
ref.__path = parentRef.__path.concat(element.key);
|
|
225
227
|
}
|
|
226
228
|
};
|
|
227
|
-
const onlyResolveExtends = (element, parent, options) => {
|
|
229
|
+
const onlyResolveExtends = (element, parent, key, options) => {
|
|
228
230
|
const { __ref } = element;
|
|
229
|
-
element.tag = (0,
|
|
231
|
+
element.tag = (0, import_node2.detectTag)(element);
|
|
230
232
|
if (!__ref.__exec)
|
|
231
233
|
__ref.__exec = {};
|
|
232
234
|
if (!__ref.__attr)
|
|
@@ -250,6 +252,7 @@ const onlyResolveExtends = (element, parent, options) => {
|
|
|
250
252
|
create((0, import_utils.exec)(prop, element), element, param, options);
|
|
251
253
|
}
|
|
252
254
|
}
|
|
255
|
+
parent[key || element.key] = element;
|
|
253
256
|
delete element.update;
|
|
254
257
|
delete element.__element;
|
|
255
258
|
delete element.props.update;
|
package/dist/cjs/extend.js
CHANGED
|
@@ -30,9 +30,9 @@ const applyExtend = (element, parent, options = {}) => {
|
|
|
30
30
|
let { extend, props, context, __ref } = element;
|
|
31
31
|
const COMPONENTS = context && context.components || options.components;
|
|
32
32
|
if ((0, import_utils.isString)(extend)) {
|
|
33
|
-
if (COMPONENTS && COMPONENTS[extend])
|
|
33
|
+
if (COMPONENTS && COMPONENTS[extend]) {
|
|
34
34
|
extend = COMPONENTS[extend];
|
|
35
|
-
else {
|
|
35
|
+
} else {
|
|
36
36
|
if (ENV !== "test" || ENV !== "development") {
|
|
37
37
|
console.warn("Extend is string but component was not found:", extend);
|
|
38
38
|
}
|
package/extend.js
CHANGED
|
@@ -22,11 +22,13 @@ export const applyExtend = (element, parent, options = {}) => {
|
|
|
22
22
|
|
|
23
23
|
const COMPONENTS = (context && context.components) || options.components
|
|
24
24
|
if (isString(extend)) {
|
|
25
|
-
if (COMPONENTS && COMPONENTS[extend])
|
|
26
|
-
|
|
25
|
+
if (COMPONENTS && COMPONENTS[extend]) {
|
|
26
|
+
extend = COMPONENTS[extend]
|
|
27
|
+
} else {
|
|
27
28
|
if (ENV !== 'test' || ENV !== 'development') {
|
|
28
29
|
console.warn('Extend is string but component was not found:', extend)
|
|
29
|
-
}
|
|
30
|
+
}
|
|
31
|
+
extend = {}
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@domql/state": "latest",
|
|
32
32
|
"@domql/utils": "latest"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "e5952db705e332f062e2e78113d620bd48ba16d9",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 symbo.ls
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|