@domql/element 2.31.25 → 2.31.26
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 +0 -19
- package/dist/esm/set.js +1 -20
- package/package.json +6 -6
- package/set.js +27 -25
package/dist/cjs/set.js
CHANGED
|
@@ -33,7 +33,6 @@ var import_event = require("@domql/event");
|
|
|
33
33
|
const resetElement = async (params, element, options) => {
|
|
34
34
|
if (!options.preventRemove) (0, import_content.removeContent)(element, options);
|
|
35
35
|
const { __ref: ref } = element;
|
|
36
|
-
if (params instanceof Promise) console.log(params, params instanceof Promise);
|
|
37
36
|
await (0, import_create.create)(params, element, ref.contentElementKey || "content", {
|
|
38
37
|
ignoreChildExtend: true,
|
|
39
38
|
...import_mixins.registry.defaultOptions,
|
|
@@ -53,32 +52,14 @@ const reset = async (options) => {
|
|
|
53
52
|
const set = async function(params, options = {}, el) {
|
|
54
53
|
var _a, _b, _c;
|
|
55
54
|
const element = el || this;
|
|
56
|
-
const { __ref: ref } = element;
|
|
57
55
|
if (options.preventContentUpdate || options.preventUpdate && ((_b = (_a = options.preventUpdate).includes) == null ? void 0 : _b.call(_a, "content")))
|
|
58
56
|
return;
|
|
59
57
|
if (options.routerContentElement && options.lastElement) {
|
|
60
58
|
if (options.routerContentElement !== options.lastElement.content) return;
|
|
61
59
|
}
|
|
62
|
-
const content = (0, import_utils.setContentKey)(element, options);
|
|
63
|
-
const __contentRef = content && content.__ref;
|
|
64
60
|
const lazyLoad = element.props && element.props.lazyLoad;
|
|
65
61
|
const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
|
|
66
62
|
if (options.preventContentUpdate === true && !hasCollection) return;
|
|
67
|
-
if (ref.__noCollectionDifference || __contentRef && __contentRef.__cached && (0, import_utils.deepContains)(params, content)) {
|
|
68
|
-
if (!options.preventBeforeUpdateListener && !options.preventListeners) {
|
|
69
|
-
const beforeUpdateReturns = await (0, import_event.triggerEventOnUpdate)(
|
|
70
|
-
"beforeUpdate",
|
|
71
|
-
params,
|
|
72
|
-
element,
|
|
73
|
-
options
|
|
74
|
-
);
|
|
75
|
-
if (beforeUpdateReturns === false) return element;
|
|
76
|
-
}
|
|
77
|
-
if (content == null ? void 0 : content.update) await content.update();
|
|
78
|
-
if (!options.preventUpdateListener)
|
|
79
|
-
await (0, import_event.triggerEventOn)("update", element, options);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
63
|
if (params) {
|
|
83
64
|
let { childExtend, props } = params;
|
|
84
65
|
if (!props) props = params.props = {};
|
package/dist/esm/set.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deepContains, setContentKey } from "@domql/utils";
|
|
1
|
+
import { deepClone, deepContains, setContentKey } from "@domql/utils";
|
|
2
2
|
import { OPTIONS } from "./cache/options.js";
|
|
3
3
|
import { create } from "./create.js";
|
|
4
4
|
import { registry } from "./mixins/index.js";
|
|
@@ -7,7 +7,6 @@ import { triggerEventOn, triggerEventOnUpdate } from "@domql/event";
|
|
|
7
7
|
const resetElement = async (params, element, options) => {
|
|
8
8
|
if (!options.preventRemove) removeContent(element, options);
|
|
9
9
|
const { __ref: ref } = element;
|
|
10
|
-
if (params instanceof Promise) console.log(params, params instanceof Promise);
|
|
11
10
|
await create(params, element, ref.contentElementKey || "content", {
|
|
12
11
|
ignoreChildExtend: true,
|
|
13
12
|
...registry.defaultOptions,
|
|
@@ -27,32 +26,14 @@ const reset = async (options) => {
|
|
|
27
26
|
const set = async function(params, options = {}, el) {
|
|
28
27
|
var _a, _b, _c;
|
|
29
28
|
const element = el || this;
|
|
30
|
-
const { __ref: ref } = element;
|
|
31
29
|
if (options.preventContentUpdate || options.preventUpdate && ((_b = (_a = options.preventUpdate).includes) == null ? void 0 : _b.call(_a, "content")))
|
|
32
30
|
return;
|
|
33
31
|
if (options.routerContentElement && options.lastElement) {
|
|
34
32
|
if (options.routerContentElement !== options.lastElement.content) return;
|
|
35
33
|
}
|
|
36
|
-
const content = setContentKey(element, options);
|
|
37
|
-
const __contentRef = content && content.__ref;
|
|
38
34
|
const lazyLoad = element.props && element.props.lazyLoad;
|
|
39
35
|
const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
|
|
40
36
|
if (options.preventContentUpdate === true && !hasCollection) return;
|
|
41
|
-
if (ref.__noCollectionDifference || __contentRef && __contentRef.__cached && deepContains(params, content)) {
|
|
42
|
-
if (!options.preventBeforeUpdateListener && !options.preventListeners) {
|
|
43
|
-
const beforeUpdateReturns = await triggerEventOnUpdate(
|
|
44
|
-
"beforeUpdate",
|
|
45
|
-
params,
|
|
46
|
-
element,
|
|
47
|
-
options
|
|
48
|
-
);
|
|
49
|
-
if (beforeUpdateReturns === false) return element;
|
|
50
|
-
}
|
|
51
|
-
if (content == null ? void 0 : content.update) await content.update();
|
|
52
|
-
if (!options.preventUpdateListener)
|
|
53
|
-
await triggerEventOn("update", element, options);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
37
|
if (params) {
|
|
57
38
|
let { childExtend, props } = params;
|
|
58
39
|
if (!props) props = params.props = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.31.
|
|
3
|
+
"version": "2.31.26",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"prepublish": "npx rimraf -I dist && npm run build && npm run copy:package:cjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@domql/event": "^2.31.
|
|
31
|
-
"@domql/render": "^2.31.
|
|
32
|
-
"@domql/state": "^2.31.
|
|
33
|
-
"@domql/utils": "^2.31.
|
|
30
|
+
"@domql/event": "^2.31.26",
|
|
31
|
+
"@domql/render": "^2.31.26",
|
|
32
|
+
"@domql/state": "^2.31.26",
|
|
33
|
+
"@domql/utils": "^2.31.26"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "126577d65a218af7e2f66b0a3f9691942ee8b9d2",
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/core": "^7.27.1"
|
|
38
38
|
}
|
package/set.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { deepContains, setContentKey } from '@domql/utils'
|
|
3
|
+
import { deepClone, deepContains, setContentKey } from '@domql/utils'
|
|
4
4
|
|
|
5
5
|
import { OPTIONS } from './cache/options.js'
|
|
6
6
|
import { create } from './create.js'
|
|
@@ -11,8 +11,6 @@ import { triggerEventOn, triggerEventOnUpdate } from '@domql/event'
|
|
|
11
11
|
export const resetElement = async (params, element, options) => {
|
|
12
12
|
if (!options.preventRemove) removeContent(element, options)
|
|
13
13
|
const { __ref: ref } = element
|
|
14
|
-
// console.warn('resetting content', ref.path)
|
|
15
|
-
if (params instanceof Promise) console.log(params, params instanceof Promise)
|
|
16
14
|
await create(params, element, ref.contentElementKey || 'content', {
|
|
17
15
|
ignoreChildExtend: true,
|
|
18
16
|
...registry.defaultOptions,
|
|
@@ -21,7 +19,7 @@ export const resetElement = async (params, element, options) => {
|
|
|
21
19
|
})
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
export const reset = async options => {
|
|
22
|
+
export const reset = async (options) => {
|
|
25
23
|
const element = this
|
|
26
24
|
await create(element, element.parent, undefined, {
|
|
27
25
|
ignoreChildExtend: true,
|
|
@@ -33,7 +31,7 @@ export const reset = async options => {
|
|
|
33
31
|
|
|
34
32
|
export const set = async function (params, options = {}, el) {
|
|
35
33
|
const element = el || this
|
|
36
|
-
const { __ref: ref } = element
|
|
34
|
+
// const { __ref: ref } = element
|
|
37
35
|
|
|
38
36
|
if (
|
|
39
37
|
options.preventContentUpdate ||
|
|
@@ -45,32 +43,36 @@ export const set = async function (params, options = {}, el) {
|
|
|
45
43
|
if (options.routerContentElement !== options.lastElement.content) return
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
const
|
|
49
|
-
const
|
|
46
|
+
// const contentKey = setContentKey(element, options)
|
|
47
|
+
// const content = element[contentKey]
|
|
48
|
+
// const __contentRef = content && content.__ref
|
|
50
49
|
const lazyLoad = element.props && element.props.lazyLoad
|
|
51
50
|
|
|
52
51
|
const hasCollection =
|
|
53
52
|
element.$collection || element.$stateCollection || element.$propsCollection
|
|
54
53
|
if (options.preventContentUpdate === true && !hasCollection) return
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
// console.log(deepClone(params), deepClone(content))
|
|
56
|
+
// console.log(deepContains(params, content))
|
|
57
|
+
|
|
58
|
+
// if (
|
|
59
|
+
// ref.__noCollectionDifference ||
|
|
60
|
+
// (__contentRef && __contentRef.__cached && deepContains(params, content))
|
|
61
|
+
// ) {
|
|
62
|
+
// // if (!options.preventBeforeUpdateListener && !options.preventListeners) {
|
|
63
|
+
// // const beforeUpdateReturns = await triggerEventOnUpdate(
|
|
64
|
+
// // 'beforeUpdate',
|
|
65
|
+
// // params,
|
|
66
|
+
// // element,
|
|
67
|
+
// // options
|
|
68
|
+
// // )
|
|
69
|
+
// // if (beforeUpdateReturns === false) return element
|
|
70
|
+
// // }
|
|
71
|
+
// // if (content?.update) await content.update()
|
|
72
|
+
// // if (!options.preventUpdateListener)
|
|
73
|
+
// // await triggerEventOn('update', element, options)
|
|
74
|
+
// return
|
|
75
|
+
// }
|
|
74
76
|
|
|
75
77
|
if (params) {
|
|
76
78
|
let { childExtend, props } = params
|