@domql/element 2.5.124 → 2.5.127
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 +2 -2
- package/dist/cjs/create.js +1 -1
- package/dist/cjs/node.js +4 -1
- package/dist/cjs/update.js +1 -1
- package/dist/cjs/utils/component.js +0 -24
- package/dist/cjs/utils/object.js +51 -4
- package/node.js +5 -1
- package/package.json +2 -2
- package/update.js +2 -1
- package/utils/component.js +0 -30
- package/utils/object.js +33 -2
package/create.js
CHANGED
|
@@ -24,7 +24,8 @@ import {
|
|
|
24
24
|
isNode,
|
|
25
25
|
isUndefined,
|
|
26
26
|
generateKey,
|
|
27
|
-
deepCloneWithExtend
|
|
27
|
+
deepCloneWithExtend,
|
|
28
|
+
detectInfiniteLoop
|
|
28
29
|
} from '@domql/utils'
|
|
29
30
|
|
|
30
31
|
import OPTIONS from './cache/options'
|
|
@@ -35,7 +36,6 @@ import {
|
|
|
35
36
|
applyVariant,
|
|
36
37
|
checkIfKeyIsComponent,
|
|
37
38
|
createValidDomqlObjectFromSugar,
|
|
38
|
-
detectInfiniteLoop,
|
|
39
39
|
isVariant
|
|
40
40
|
} from './utils/component'
|
|
41
41
|
|
package/dist/cjs/create.js
CHANGED
|
@@ -176,7 +176,7 @@ const renderElement = (element, parent, options, attachOptions) => {
|
|
|
176
176
|
visitedElements.set(element, true);
|
|
177
177
|
const { __ref: ref, key } = element;
|
|
178
178
|
try {
|
|
179
|
-
const isInfiniteLoopDetected = (0,
|
|
179
|
+
const isInfiniteLoopDetected = (0, import_utils.detectInfiniteLoop)(ref.__path);
|
|
180
180
|
if (ref.__uniqId || isInfiniteLoopDetected)
|
|
181
181
|
return;
|
|
182
182
|
(0, import_node.default)(element, options);
|
package/dist/cjs/node.js
CHANGED
|
@@ -42,6 +42,7 @@ var import_mixins = require("./mixins");
|
|
|
42
42
|
var import_applyParam = require("./utils/applyParam");
|
|
43
43
|
var import_utils2 = require("./utils");
|
|
44
44
|
var import_propEvents = require("./utils/propEvents");
|
|
45
|
+
var import_on = require("../event/on");
|
|
45
46
|
const ENV = "development";
|
|
46
47
|
const createNode = (element, options) => {
|
|
47
48
|
let { node, tag, __ref: ref } = element;
|
|
@@ -65,8 +66,10 @@ const createNode = (element, options) => {
|
|
|
65
66
|
(0, import_iterate.throughInitialExec)(element);
|
|
66
67
|
if (element.tag !== "string" && element.tag !== "fragment") {
|
|
67
68
|
(0, import_propEvents.propagateEventsFromProps)(element);
|
|
68
|
-
if (isNewNode && (0, import_utils.isObject)(element.on))
|
|
69
|
+
if (isNewNode && (0, import_utils.isObject)(element.on)) {
|
|
70
|
+
(0, import_on.applyAnimationFrame)(element, options);
|
|
69
71
|
(0, import_event.applyEventsOnNode)(element, options);
|
|
72
|
+
}
|
|
70
73
|
}
|
|
71
74
|
for (const param in element) {
|
|
72
75
|
const value = element[param];
|
package/dist/cjs/update.js
CHANGED
|
@@ -36,12 +36,12 @@ var import_event = require("@domql/event");
|
|
|
36
36
|
var import_methods = require("./methods");
|
|
37
37
|
var import_props = require("./props");
|
|
38
38
|
var import_state = require("@domql/state");
|
|
39
|
-
var import_utils2 = require("./utils");
|
|
40
39
|
var import_create = __toESM(require("./create"), 1);
|
|
41
40
|
var import_iterate = require("./iterate");
|
|
42
41
|
var import_mixins = require("./mixins");
|
|
43
42
|
var import_applyParam = require("./utils/applyParam");
|
|
44
43
|
var import_options = __toESM(require("./cache/options"), 1);
|
|
44
|
+
var import_utils2 = require("./utils");
|
|
45
45
|
const snapshot = {
|
|
46
46
|
snapshotId: import_utils.createSnapshotId
|
|
47
47
|
};
|
|
@@ -25,7 +25,6 @@ __export(component_exports, {
|
|
|
25
25
|
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
|
|
26
26
|
checkIfKeyIsProperty: () => checkIfKeyIsProperty,
|
|
27
27
|
createValidDomqlObjectFromSugar: () => createValidDomqlObjectFromSugar,
|
|
28
|
-
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
29
28
|
extendizeByKey: () => extendizeByKey,
|
|
30
29
|
hasVariantProp: () => hasVariantProp,
|
|
31
30
|
isVariant: () => isVariant,
|
|
@@ -175,26 +174,3 @@ const applyVariant = (element) => {
|
|
|
175
174
|
});
|
|
176
175
|
return element;
|
|
177
176
|
};
|
|
178
|
-
const detectInfiniteLoop = (arr) => {
|
|
179
|
-
const maxRepeats = 10;
|
|
180
|
-
let pattern = [];
|
|
181
|
-
let repeatCount = 0;
|
|
182
|
-
for (let i = 0; i < arr.length; i++) {
|
|
183
|
-
if (pattern.length < 2) {
|
|
184
|
-
pattern.push(arr[i]);
|
|
185
|
-
} else {
|
|
186
|
-
if (arr[i] === pattern[i % 2]) {
|
|
187
|
-
repeatCount++;
|
|
188
|
-
} else {
|
|
189
|
-
pattern = [arr[i - 1], arr[i]];
|
|
190
|
-
repeatCount = 1;
|
|
191
|
-
}
|
|
192
|
-
if (repeatCount >= maxRepeats * 2) {
|
|
193
|
-
if (ENV === "test" || ENV === "development") {
|
|
194
|
-
console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
|
|
195
|
-
}
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
};
|
package/dist/cjs/utils/object.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 object_exports = {};
|
|
20
20
|
__export(object_exports, {
|
|
21
|
+
METHODS: () => METHODS,
|
|
21
22
|
METHODS_EXL: () => METHODS_EXL,
|
|
22
23
|
clone: () => clone,
|
|
23
24
|
deepClone: () => deepClone,
|
|
@@ -32,13 +33,59 @@ __export(object_exports, {
|
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(object_exports);
|
|
34
35
|
var import_utils = require("@domql/utils");
|
|
35
|
-
var import_state = require("@domql/state");
|
|
36
36
|
var import_props = require("../props");
|
|
37
|
-
|
|
37
|
+
const IGNORE_STATE_PARAMS = [
|
|
38
|
+
"update",
|
|
39
|
+
"parse",
|
|
40
|
+
"clean",
|
|
41
|
+
"create",
|
|
42
|
+
"destroy",
|
|
43
|
+
"add",
|
|
44
|
+
"toggle",
|
|
45
|
+
"remove",
|
|
46
|
+
"apply",
|
|
47
|
+
"set",
|
|
48
|
+
"reset",
|
|
49
|
+
"replace",
|
|
50
|
+
"quietReplace",
|
|
51
|
+
"quietUpdate",
|
|
52
|
+
"applyReplace",
|
|
53
|
+
"applyFunction",
|
|
54
|
+
"rootUpdate",
|
|
55
|
+
"parentUpdate",
|
|
56
|
+
"parent",
|
|
57
|
+
"__element",
|
|
58
|
+
"__depends",
|
|
59
|
+
"__ref",
|
|
60
|
+
"__children",
|
|
61
|
+
"root"
|
|
62
|
+
];
|
|
63
|
+
const METHODS = [
|
|
64
|
+
"set",
|
|
65
|
+
"reset",
|
|
66
|
+
"update",
|
|
67
|
+
"remove",
|
|
68
|
+
"updateContent",
|
|
69
|
+
"removeContent",
|
|
70
|
+
"lookup",
|
|
71
|
+
"lookdown",
|
|
72
|
+
"lookdownAll",
|
|
73
|
+
"setNodeStyles",
|
|
74
|
+
"spotByPath",
|
|
75
|
+
"keys",
|
|
76
|
+
"parse",
|
|
77
|
+
"setProps",
|
|
78
|
+
"parseDeep",
|
|
79
|
+
"variables",
|
|
80
|
+
"if",
|
|
81
|
+
"log",
|
|
82
|
+
"nextElement",
|
|
83
|
+
"previousElement"
|
|
84
|
+
];
|
|
38
85
|
const METHODS_EXL = (0, import_utils.joinArrays)(
|
|
39
86
|
["node", "state", "context", "extend", "__element"],
|
|
40
|
-
|
|
41
|
-
|
|
87
|
+
METHODS,
|
|
88
|
+
IGNORE_STATE_PARAMS,
|
|
42
89
|
import_props.IGNORE_PROPS_PARAMS
|
|
43
90
|
);
|
|
44
91
|
const deepMerge = (element, extend, exclude = METHODS_EXL) => {
|
package/node.js
CHANGED
|
@@ -15,6 +15,7 @@ import { registry } from './mixins'
|
|
|
15
15
|
import { applyParam } from './utils/applyParam'
|
|
16
16
|
import { isVariant } from './utils'
|
|
17
17
|
import { propagateEventsFromProps } from './utils/propEvents'
|
|
18
|
+
import { applyAnimationFrame } from '../event/on'
|
|
18
19
|
// import { defineSetter } from './methods'
|
|
19
20
|
|
|
20
21
|
const ENV = process.env.NODE_ENV
|
|
@@ -54,7 +55,10 @@ export const createNode = (element, options) => {
|
|
|
54
55
|
if (element.tag !== 'string' && element.tag !== 'fragment') {
|
|
55
56
|
propagateEventsFromProps(element)
|
|
56
57
|
// apply events
|
|
57
|
-
if (isNewNode && isObject(element.on))
|
|
58
|
+
if (isNewNode && isObject(element.on)) {
|
|
59
|
+
applyAnimationFrame(element, options)
|
|
60
|
+
applyEventsOnNode(element, options)
|
|
61
|
+
}
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
for (const param in element) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.127",
|
|
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": "b8f8a11aed03f9afe2e2e6d3e85a4cce1bc03cdf",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/update.js
CHANGED
|
@@ -19,12 +19,12 @@ import { isMethod } from './methods'
|
|
|
19
19
|
import { updateProps } from './props'
|
|
20
20
|
import { createState, findInheritedState } from '@domql/state'
|
|
21
21
|
|
|
22
|
-
import { METHODS_EXL, deepClone, isVariant, deepMerge } from './utils'
|
|
23
22
|
import create from './create'
|
|
24
23
|
import { throughUpdatedDefine, throughUpdatedExec } from './iterate'
|
|
25
24
|
import { registry } from './mixins'
|
|
26
25
|
import { applyParam } from './utils/applyParam'
|
|
27
26
|
import OPTIONS from './cache/options'
|
|
27
|
+
import { METHODS_EXL, deepClone, isVariant, deepMerge } from './utils'
|
|
28
28
|
|
|
29
29
|
const snapshot = {
|
|
30
30
|
snapshotId: createSnapshotId
|
|
@@ -80,6 +80,7 @@ const update = function (params = {}, opts) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const overwriteChanges = overwriteDeep(element, params, METHODS_EXL)
|
|
83
|
+
// const overwriteChanges = overwriteDeep(element, params)
|
|
83
84
|
const execChanges = throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS })
|
|
84
85
|
const definedChanges = throughUpdatedDefine(element)
|
|
85
86
|
|
package/utils/component.js
CHANGED
|
@@ -165,33 +165,3 @@ export const applyVariant = (element) => {
|
|
|
165
165
|
|
|
166
166
|
return element
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
export const detectInfiniteLoop = arr => {
|
|
170
|
-
const maxRepeats = 10 // Maximum allowed repetitions
|
|
171
|
-
let pattern = []
|
|
172
|
-
let repeatCount = 0
|
|
173
|
-
|
|
174
|
-
for (let i = 0; i < arr.length; i++) {
|
|
175
|
-
if (pattern.length < 2) {
|
|
176
|
-
// Build the initial pattern with two consecutive elements
|
|
177
|
-
pattern.push(arr[i])
|
|
178
|
-
} else {
|
|
179
|
-
// Check if the current element follows the repeating pattern
|
|
180
|
-
if (arr[i] === pattern[i % 2]) {
|
|
181
|
-
repeatCount++
|
|
182
|
-
} else {
|
|
183
|
-
// If there's a mismatch, reset the pattern and repeat counter
|
|
184
|
-
pattern = [arr[i - 1], arr[i]]
|
|
185
|
-
repeatCount = 1 // Reset to 1 because we start a new potential pattern
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// If the pattern repeats more than `maxRepeats`, throw a warning
|
|
189
|
-
if (repeatCount >= maxRepeats * 2) {
|
|
190
|
-
if (ENV === 'test' || ENV === 'development') {
|
|
191
|
-
console.warn('Warning: Potential infinite loop detected due to repeated sequence:', pattern)
|
|
192
|
-
}
|
|
193
|
-
return true
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
package/utils/object.js
CHANGED
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { isArray, isObject, isObjectLike, joinArrays, deepCloneWithExtend } from '@domql/utils'
|
|
4
|
-
import { IGNORE_STATE_PARAMS } from '@domql/state'
|
|
5
4
|
import { IGNORE_PROPS_PARAMS } from '../props'
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
// breaks server build
|
|
7
|
+
// import { IGNORE_STATE_PARAMS } from '@domql/state'
|
|
8
|
+
// import { METHODS } from '../methods'
|
|
9
|
+
|
|
10
|
+
const IGNORE_STATE_PARAMS = [
|
|
11
|
+
'update', 'parse', 'clean', 'create', 'destroy', 'add', 'toggle', 'remove', 'apply', 'set', 'reset',
|
|
12
|
+
'replace', 'quietReplace', 'quietUpdate', 'applyReplace', 'applyFunction',
|
|
13
|
+
'rootUpdate', 'parentUpdate', 'parent', '__element', '__depends', '__ref', '__children', 'root'
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
export const METHODS = [
|
|
17
|
+
'set',
|
|
18
|
+
'reset',
|
|
19
|
+
'update',
|
|
20
|
+
'remove',
|
|
21
|
+
'updateContent',
|
|
22
|
+
'removeContent',
|
|
23
|
+
'lookup',
|
|
24
|
+
'lookdown',
|
|
25
|
+
'lookdownAll',
|
|
26
|
+
'setNodeStyles',
|
|
27
|
+
'spotByPath',
|
|
28
|
+
'keys',
|
|
29
|
+
'parse',
|
|
30
|
+
'setProps',
|
|
31
|
+
'parseDeep',
|
|
32
|
+
'variables',
|
|
33
|
+
'if',
|
|
34
|
+
'log',
|
|
35
|
+
'nextElement',
|
|
36
|
+
'previousElement'
|
|
37
|
+
]
|
|
7
38
|
|
|
8
39
|
export const METHODS_EXL = joinArrays(
|
|
9
40
|
['node', 'state', 'context', 'extend', '__element'],
|