@domql/element 2.5.132 → 2.5.135
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 +18 -19
- package/dist/cjs/create.js +8 -9
- package/package.json +7 -7
package/create.js
CHANGED
|
@@ -2,20 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import createNode from './node'
|
|
4
4
|
import { ROOT } from './tree'
|
|
5
|
-
import { TAGS } from '@domql/registry'
|
|
6
|
-
import { triggerEventOn } from '@domql/event'
|
|
7
|
-
import { assignNode } from '@domql/render'
|
|
8
|
-
import { createState } from '@domql/state'
|
|
9
|
-
|
|
10
|
-
import { isMethod } from './methods'
|
|
11
|
-
import { createProps } from './props'
|
|
12
|
-
import { applyExtend } from './extend'
|
|
13
|
-
import { registry } from './mixins'
|
|
14
|
-
import { addMethods } from './methods/set'
|
|
15
|
-
import { assignKeyAsClassname } from './mixins/classList'
|
|
16
|
-
import { throughInitialExec, throughInitialDefine } from './iterate'
|
|
17
|
-
|
|
18
5
|
import {
|
|
6
|
+
HTML_TAGS,
|
|
19
7
|
isObject,
|
|
20
8
|
isFunction,
|
|
21
9
|
isString,
|
|
@@ -31,6 +19,17 @@ import {
|
|
|
31
19
|
isVariant,
|
|
32
20
|
detectInfiniteLoop
|
|
33
21
|
} from '@domql/utils'
|
|
22
|
+
import { triggerEventOn } from '@domql/event'
|
|
23
|
+
import { assignNode } from '@domql/render'
|
|
24
|
+
import { createState } from '@domql/state'
|
|
25
|
+
|
|
26
|
+
import { isMethod } from './methods'
|
|
27
|
+
import { createProps } from './props'
|
|
28
|
+
import { applyExtend } from './extend'
|
|
29
|
+
import { registry } from './mixins'
|
|
30
|
+
import { addMethods } from './methods/set'
|
|
31
|
+
import { assignKeyAsClassname } from './mixins/classList'
|
|
32
|
+
import { throughInitialExec, throughInitialDefine } from './iterate'
|
|
34
33
|
|
|
35
34
|
import OPTIONS from './cache/options'
|
|
36
35
|
|
|
@@ -214,7 +213,7 @@ const addElementIntoParentChildren = (element, parent) => {
|
|
|
214
213
|
const visitedElements = new WeakMap()
|
|
215
214
|
const renderElement = (element, parent, options, attachOptions) => {
|
|
216
215
|
if (visitedElements.has(element)) {
|
|
217
|
-
if (ENV === 'test' || ENV === 'development') console.warn('Cyclic rendering detected:', element.__ref.
|
|
216
|
+
if (ENV === 'test' || ENV === 'development') console.warn('Cyclic rendering detected:', element.__ref.path)
|
|
218
217
|
}
|
|
219
218
|
|
|
220
219
|
visitedElements.set(element, true)
|
|
@@ -223,13 +222,13 @@ const renderElement = (element, parent, options, attachOptions) => {
|
|
|
223
222
|
|
|
224
223
|
// CREATE a real NODE
|
|
225
224
|
try {
|
|
226
|
-
const isInfiniteLoopDetected = detectInfiniteLoop(ref.
|
|
225
|
+
const isInfiniteLoopDetected = detectInfiniteLoop(ref.path)
|
|
227
226
|
if (ref.__uniqId || isInfiniteLoopDetected) return
|
|
228
227
|
createNode(element, options)
|
|
229
228
|
ref.__uniqId = Math.random()
|
|
230
229
|
} catch (e) {
|
|
231
230
|
if (ENV === 'test' || ENV === 'development') {
|
|
232
|
-
const path = ref.
|
|
231
|
+
const path = ref.path
|
|
233
232
|
if (path.includes('ComponentsGrid')) path.splice(0, path.indexOf('ComponentsGrid') + 2)
|
|
234
233
|
if (path.includes('demoComponent')) path.splice(0, path.indexOf('demoComponent') + 1)
|
|
235
234
|
const isDemoComponent = element.lookup(el => el.state.key)?.state?.key
|
|
@@ -262,7 +261,7 @@ const checkIfPrimitive = (element) => is(element)('string', 'number')
|
|
|
262
261
|
const applyValueAsText = (element, parent, key) => {
|
|
263
262
|
const extendTag = element.extend && element.extend.tag
|
|
264
263
|
const childExtendTag = parent.childExtend && parent.childExtend.tag
|
|
265
|
-
const isKeyValidHTMLTag = ((
|
|
264
|
+
const isKeyValidHTMLTag = ((HTML_TAGS.body.indexOf(key) > -1) && key)
|
|
266
265
|
return {
|
|
267
266
|
text: element,
|
|
268
267
|
tag: extendTag || childExtendTag || isKeyValidHTMLTag || 'string'
|
|
@@ -328,8 +327,8 @@ const addCaching = (element, parent) => {
|
|
|
328
327
|
// set the PATH array
|
|
329
328
|
// if (ENV === 'test' || ENV === 'development') {
|
|
330
329
|
if (!parentRef) parentRef = parent.ref = {}
|
|
331
|
-
if (!parentRef.
|
|
332
|
-
ref.
|
|
330
|
+
if (!parentRef.path) parentRef.path = []
|
|
331
|
+
ref.path = parentRef.path.concat(element.key)
|
|
333
332
|
// }
|
|
334
333
|
}
|
|
335
334
|
|
package/dist/cjs/create.js
CHANGED
|
@@ -33,7 +33,7 @@ __export(create_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(create_exports);
|
|
34
34
|
var import_node = __toESM(require("./node"), 1);
|
|
35
35
|
var import_tree = require("./tree");
|
|
36
|
-
var
|
|
36
|
+
var import_utils = require("@domql/utils");
|
|
37
37
|
var import_event = require("@domql/event");
|
|
38
38
|
var import_render = require("@domql/render");
|
|
39
39
|
var import_state = require("@domql/state");
|
|
@@ -44,7 +44,6 @@ var import_mixins = require("./mixins");
|
|
|
44
44
|
var import_set = require("./methods/set");
|
|
45
45
|
var import_classList = require("./mixins/classList");
|
|
46
46
|
var import_iterate = require("./iterate");
|
|
47
|
-
var import_utils = require("@domql/utils");
|
|
48
47
|
var import_options = __toESM(require("./cache/options"), 1);
|
|
49
48
|
var import_component = require("./utils/component");
|
|
50
49
|
const ENV = "development";
|
|
@@ -172,19 +171,19 @@ const renderElement = (element, parent, options, attachOptions) => {
|
|
|
172
171
|
var _a, _b;
|
|
173
172
|
if (visitedElements.has(element)) {
|
|
174
173
|
if (ENV === "test" || ENV === "development")
|
|
175
|
-
console.warn("Cyclic rendering detected:", element.__ref.
|
|
174
|
+
console.warn("Cyclic rendering detected:", element.__ref.path);
|
|
176
175
|
}
|
|
177
176
|
visitedElements.set(element, true);
|
|
178
177
|
const { __ref: ref, key } = element;
|
|
179
178
|
try {
|
|
180
|
-
const isInfiniteLoopDetected = (0, import_utils.detectInfiniteLoop)(ref.
|
|
179
|
+
const isInfiniteLoopDetected = (0, import_utils.detectInfiniteLoop)(ref.path);
|
|
181
180
|
if (ref.__uniqId || isInfiniteLoopDetected)
|
|
182
181
|
return;
|
|
183
182
|
(0, import_node.default)(element, options);
|
|
184
183
|
ref.__uniqId = Math.random();
|
|
185
184
|
} catch (e) {
|
|
186
185
|
if (ENV === "test" || ENV === "development") {
|
|
187
|
-
const path = ref.
|
|
186
|
+
const path = ref.path;
|
|
188
187
|
if (path.includes("ComponentsGrid"))
|
|
189
188
|
path.splice(0, path.indexOf("ComponentsGrid") + 2);
|
|
190
189
|
if (path.includes("demoComponent"))
|
|
@@ -208,7 +207,7 @@ const checkIfPrimitive = (element) => (0, import_utils.is)(element)("string", "n
|
|
|
208
207
|
const applyValueAsText = (element, parent, key) => {
|
|
209
208
|
const extendTag = element.extend && element.extend.tag;
|
|
210
209
|
const childExtendTag = parent.childExtend && parent.childExtend.tag;
|
|
211
|
-
const isKeyValidHTMLTag =
|
|
210
|
+
const isKeyValidHTMLTag = import_utils.HTML_TAGS.body.indexOf(key) > -1 && key;
|
|
212
211
|
return {
|
|
213
212
|
text: element,
|
|
214
213
|
tag: extendTag || childExtendTag || isKeyValidHTMLTag || "string"
|
|
@@ -261,9 +260,9 @@ const addCaching = (element, parent) => {
|
|
|
261
260
|
ref.root = hasRoot ? element : parentRef.root;
|
|
262
261
|
if (!parentRef)
|
|
263
262
|
parentRef = parent.ref = {};
|
|
264
|
-
if (!parentRef.
|
|
265
|
-
parentRef.
|
|
266
|
-
ref.
|
|
263
|
+
if (!parentRef.path)
|
|
264
|
+
parentRef.path = [];
|
|
265
|
+
ref.path = parentRef.path.concat(element.key);
|
|
267
266
|
};
|
|
268
267
|
const onlyResolveExtends = (element, parent, key, options) => {
|
|
269
268
|
const { __ref: ref } = element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.135",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@domql/event": "
|
|
30
|
-
"@domql/node": "
|
|
31
|
-
"@domql/render": "
|
|
32
|
-
"@domql/state": "
|
|
33
|
-
"@domql/utils": "
|
|
29
|
+
"@domql/event": "^2.5.134",
|
|
30
|
+
"@domql/node": "^2.5.0",
|
|
31
|
+
"@domql/render": "^2.5.134",
|
|
32
|
+
"@domql/state": "^2.5.134",
|
|
33
|
+
"@domql/utils": "^2.5.134"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "b7ae353fa66bf64258fe4b0a45287c67239d1ca7",
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/core": "^7.12.0"
|
|
38
38
|
}
|