@domql/element 2.5.67 → 2.5.70
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/dist/cjs/set.js +18 -13
- package/package.json +2 -2
- package/set.js +17 -14
package/dist/cjs/set.js
CHANGED
|
@@ -28,7 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var set_exports = {};
|
|
30
30
|
__export(set_exports, {
|
|
31
|
-
default: () => set_default
|
|
31
|
+
default: () => set_default,
|
|
32
|
+
resetElement: () => resetElement
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(set_exports);
|
|
34
35
|
var import_utils = require("@domql/utils");
|
|
@@ -36,6 +37,19 @@ var import_create = __toESM(require("./create"), 1);
|
|
|
36
37
|
var import_options = __toESM(require("./cache/options"), 1);
|
|
37
38
|
var import_mixins = require("./mixins");
|
|
38
39
|
var import_content = require("./mixins/content");
|
|
40
|
+
const resetElement = (params, element, options) => {
|
|
41
|
+
const perf = performance.now();
|
|
42
|
+
if (!options.preventRemove)
|
|
43
|
+
(0, import_content.removeContent)(element, options);
|
|
44
|
+
(0, import_create.default)(params, element, options.contentElementKey || "content", {
|
|
45
|
+
ignoreChildExtend: true,
|
|
46
|
+
...import_mixins.registry.defaultOptions,
|
|
47
|
+
...import_options.default.create,
|
|
48
|
+
...options
|
|
49
|
+
});
|
|
50
|
+
if (element.key === "Grid")
|
|
51
|
+
console.log(element.key, performance.now() - perf);
|
|
52
|
+
};
|
|
39
53
|
const set = function(params, options = {}, el) {
|
|
40
54
|
const element = el || this;
|
|
41
55
|
const { __ref: ref, content } = element;
|
|
@@ -45,25 +59,16 @@ const set = function(params, options = {}, el) {
|
|
|
45
59
|
if (options.preventContentUpdate === true && !hasCollection)
|
|
46
60
|
return;
|
|
47
61
|
if (ref.__noCollectionDifference || __contentRef && __contentRef.__cached && (0, import_utils.deepContains)(params, content)) {
|
|
48
|
-
return;
|
|
62
|
+
return content == null ? void 0 : content.update();
|
|
49
63
|
}
|
|
50
|
-
const setAsync = () => {
|
|
51
|
-
(0, import_content.removeContent)(element);
|
|
52
|
-
(0, import_create.default)(params, element, options.newElementKey || "content", {
|
|
53
|
-
ignoreChildExtend: true,
|
|
54
|
-
...import_mixins.registry.defaultOptions,
|
|
55
|
-
...import_options.default.create,
|
|
56
|
-
...options
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
64
|
if (params) {
|
|
60
65
|
const { childExtend } = params;
|
|
61
66
|
if (!childExtend && element.childExtend)
|
|
62
67
|
params.childExtend = element.childExtend;
|
|
63
68
|
if (lazyLoad) {
|
|
64
|
-
window.requestAnimationFrame(
|
|
69
|
+
window.requestAnimationFrame(() => resetElement(params, element, options));
|
|
65
70
|
} else
|
|
66
|
-
|
|
71
|
+
resetElement(params, element, options);
|
|
67
72
|
}
|
|
68
73
|
return element;
|
|
69
74
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.70",
|
|
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": "2b5a18c63d6037ad465f1dc7031b8f7e5f73938a",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/set.js
CHANGED
|
@@ -7,6 +7,19 @@ import OPTIONS from './cache/options'
|
|
|
7
7
|
import { registry } from './mixins'
|
|
8
8
|
import { removeContent } from './mixins/content'
|
|
9
9
|
|
|
10
|
+
export const resetElement = (params, element, options) => {
|
|
11
|
+
const perf = performance.now()
|
|
12
|
+
if (!options.preventRemove) removeContent(element, options)
|
|
13
|
+
create(params, element, options.contentElementKey || 'content', {
|
|
14
|
+
ignoreChildExtend: true,
|
|
15
|
+
...registry.defaultOptions,
|
|
16
|
+
...OPTIONS.create,
|
|
17
|
+
...options
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
if (element.key === 'Grid') console.log(element.key, performance.now() - perf)
|
|
21
|
+
}
|
|
22
|
+
|
|
10
23
|
const set = function (params, options = {}, el) {
|
|
11
24
|
const element = el || this
|
|
12
25
|
const { __ref: ref, content } = element
|
|
@@ -17,18 +30,8 @@ const set = function (params, options = {}, el) {
|
|
|
17
30
|
if (options.preventContentUpdate === true && !hasCollection) return
|
|
18
31
|
|
|
19
32
|
if (ref.__noCollectionDifference || (__contentRef && __contentRef.__cached && deepContains(params, content))) {
|
|
20
|
-
return
|
|
21
|
-
// return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const setAsync = () => {
|
|
25
|
-
removeContent(element)
|
|
26
|
-
create(params, element, options.newElementKey || 'content', {
|
|
27
|
-
ignoreChildExtend: true,
|
|
28
|
-
...registry.defaultOptions,
|
|
29
|
-
...OPTIONS.create,
|
|
30
|
-
...options
|
|
31
|
-
})
|
|
33
|
+
return content?.update()
|
|
34
|
+
// return
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
if (params) {
|
|
@@ -36,8 +39,8 @@ const set = function (params, options = {}, el) {
|
|
|
36
39
|
if (!childExtend && element.childExtend) params.childExtend = element.childExtend
|
|
37
40
|
|
|
38
41
|
if (lazyLoad) {
|
|
39
|
-
window.requestAnimationFrame(
|
|
40
|
-
} else
|
|
42
|
+
window.requestAnimationFrame(() => resetElement(params, element, options))
|
|
43
|
+
} else resetElement(params, element, options)
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
return element
|