@domql/element 2.5.203 → 2.5.205
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/mixins/content.js +2 -2
- package/dist/cjs/set.js +3 -3
- package/dist/cjs/update.js +6 -6
- package/dist/cjs/utils/applyParam.js +2 -2
- package/dist/esm/mixins/content.js +2 -2
- package/dist/esm/set.js +3 -3
- package/dist/esm/update.js +6 -6
- package/dist/esm/utils/applyParam.js +2 -2
- package/mixins/content.js +2 -2
- package/package.json +2 -2
- package/set.js +3 -3
- package/update.js +6 -6
- package/utils/applyParam.js +2 -2
|
@@ -61,13 +61,13 @@ const removeContent = function(el, opts = {}) {
|
|
|
61
61
|
delete element[contentElementKey];
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
function setContent(param, element, node, opts) {
|
|
64
|
+
async function setContent(param, element, node, opts) {
|
|
65
65
|
const contentElementKey = (0, import_utils.setContentKey)(element, opts);
|
|
66
66
|
if (param && element) {
|
|
67
67
|
if (element[contentElementKey].update) {
|
|
68
68
|
element[contentElementKey].update({}, opts);
|
|
69
69
|
} else {
|
|
70
|
-
import_set.set.call(element, param, opts);
|
|
70
|
+
await import_set.set.call(element, param, opts);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
package/dist/cjs/set.js
CHANGED
|
@@ -41,9 +41,9 @@ const resetElement = async (params, element, options) => {
|
|
|
41
41
|
...options
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
const reset = (options) => {
|
|
44
|
+
const reset = async (options) => {
|
|
45
45
|
const element = void 0;
|
|
46
|
-
(0, import_create.create)(element, element.parent, void 0, {
|
|
46
|
+
await (0, import_create.create)(element, element.parent, void 0, {
|
|
47
47
|
ignoreChildExtend: true,
|
|
48
48
|
...import_mixins.registry.defaultOptions,
|
|
49
49
|
...import_options.OPTIONS.create,
|
|
@@ -67,7 +67,7 @@ const set = async function(params, options = {}, el) {
|
|
|
67
67
|
return element;
|
|
68
68
|
}
|
|
69
69
|
if (content == null ? void 0 : content.update)
|
|
70
|
-
content.update();
|
|
70
|
+
await content.update();
|
|
71
71
|
if (!options.preventUpdateListener)
|
|
72
72
|
await (0, import_event.triggerEventOn)("update", element, options);
|
|
73
73
|
return;
|
package/dist/cjs/update.js
CHANGED
|
@@ -125,7 +125,7 @@ const update = async function(params = {}, opts) {
|
|
|
125
125
|
continue;
|
|
126
126
|
if (preventStateUpdate === "once")
|
|
127
127
|
options.preventStateUpdate = false;
|
|
128
|
-
const isElement = (0, import_applyParam.applyParam)(param, element, options);
|
|
128
|
+
const isElement = await (0, import_applyParam.applyParam)(param, element, options);
|
|
129
129
|
if (isElement) {
|
|
130
130
|
const { hasDefine, hasContextDefine } = isElement;
|
|
131
131
|
const canUpdate = (0, import_utils.isObject)(prop) && !hasDefine && !hasContextDefine && !preventRecursive;
|
|
@@ -135,21 +135,21 @@ const update = async function(params = {}, opts) {
|
|
|
135
135
|
if (options.onEachUpdate) {
|
|
136
136
|
options.onEachUpdate(param, element, element.state, element.context);
|
|
137
137
|
}
|
|
138
|
-
const childUpdateCall = () => update.call(prop, params[prop], {
|
|
138
|
+
const childUpdateCall = async () => await update.call(prop, params[prop], {
|
|
139
139
|
...options,
|
|
140
140
|
currentSnapshot: snapshotOnCallee,
|
|
141
141
|
calleeElement
|
|
142
142
|
});
|
|
143
|
-
lazyLoad ? import_utils.window.requestAnimationFrame(() => {
|
|
144
|
-
childUpdateCall();
|
|
143
|
+
lazyLoad ? import_utils.window.requestAnimationFrame(async () => {
|
|
144
|
+
await childUpdateCall();
|
|
145
145
|
if (!options.preventUpdateListener) {
|
|
146
146
|
(0, import_event.triggerEventOn)("lazyLoad", element, options);
|
|
147
147
|
}
|
|
148
|
-
}) : childUpdateCall();
|
|
148
|
+
}) : await childUpdateCall();
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
if (!preventUpdateListener)
|
|
152
|
-
(0, import_event.triggerEventOn)("update", element, options);
|
|
152
|
+
await (0, import_event.triggerEventOn)("update", element, options);
|
|
153
153
|
};
|
|
154
154
|
const captureSnapshot = (element, options) => {
|
|
155
155
|
const ref = element.__ref;
|
|
@@ -23,7 +23,7 @@ __export(applyParam_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(applyParam_exports);
|
|
24
24
|
var import_utils = require("@domql/utils");
|
|
25
25
|
var import_mixins = require("../mixins/index.js");
|
|
26
|
-
const applyParam = (param, element, options) => {
|
|
26
|
+
const applyParam = async (param, element, options) => {
|
|
27
27
|
const { node, context, __ref: ref } = element;
|
|
28
28
|
const prop = element[param];
|
|
29
29
|
const { onlyUpdate } = options;
|
|
@@ -37,7 +37,7 @@ const applyParam = (param, element, options) => {
|
|
|
37
37
|
const hasOnlyUpdate = onlyUpdate ? onlyUpdate === param || element.lookup(onlyUpdate) : true;
|
|
38
38
|
if (isGlobalTransformer && !hasContextDefine && hasOnlyUpdate) {
|
|
39
39
|
if ((0, import_utils.isFunction)(isGlobalTransformer)) {
|
|
40
|
-
isGlobalTransformer(prop, element, node, options);
|
|
40
|
+
await isGlobalTransformer(prop, element, node, options);
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -35,13 +35,13 @@ const removeContent = function(el, opts = {}) {
|
|
|
35
35
|
delete element[contentElementKey];
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
function setContent(param, element, node, opts) {
|
|
38
|
+
async function setContent(param, element, node, opts) {
|
|
39
39
|
const contentElementKey = setContentKey(element, opts);
|
|
40
40
|
if (param && element) {
|
|
41
41
|
if (element[contentElementKey].update) {
|
|
42
42
|
element[contentElementKey].update({}, opts);
|
|
43
43
|
} else {
|
|
44
|
-
set.call(element, param, opts);
|
|
44
|
+
await set.call(element, param, opts);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
package/dist/esm/set.js
CHANGED
|
@@ -15,9 +15,9 @@ const resetElement = async (params, element, options) => {
|
|
|
15
15
|
...options
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
const reset = (options) => {
|
|
18
|
+
const reset = async (options) => {
|
|
19
19
|
const element = void 0;
|
|
20
|
-
create(element, element.parent, void 0, {
|
|
20
|
+
await create(element, element.parent, void 0, {
|
|
21
21
|
ignoreChildExtend: true,
|
|
22
22
|
...registry.defaultOptions,
|
|
23
23
|
...OPTIONS.create,
|
|
@@ -41,7 +41,7 @@ const set = async function(params, options = {}, el) {
|
|
|
41
41
|
return element;
|
|
42
42
|
}
|
|
43
43
|
if (content == null ? void 0 : content.update)
|
|
44
|
-
content.update();
|
|
44
|
+
await content.update();
|
|
45
45
|
if (!options.preventUpdateListener)
|
|
46
46
|
await triggerEventOn("update", element, options);
|
|
47
47
|
return;
|
package/dist/esm/update.js
CHANGED
|
@@ -115,7 +115,7 @@ const update = async function(params = {}, opts) {
|
|
|
115
115
|
continue;
|
|
116
116
|
if (preventStateUpdate === "once")
|
|
117
117
|
options.preventStateUpdate = false;
|
|
118
|
-
const isElement = applyParam(param, element, options);
|
|
118
|
+
const isElement = await applyParam(param, element, options);
|
|
119
119
|
if (isElement) {
|
|
120
120
|
const { hasDefine, hasContextDefine } = isElement;
|
|
121
121
|
const canUpdate = isObject(prop) && !hasDefine && !hasContextDefine && !preventRecursive;
|
|
@@ -125,21 +125,21 @@ const update = async function(params = {}, opts) {
|
|
|
125
125
|
if (options.onEachUpdate) {
|
|
126
126
|
options.onEachUpdate(param, element, element.state, element.context);
|
|
127
127
|
}
|
|
128
|
-
const childUpdateCall = () => update.call(prop, params[prop], {
|
|
128
|
+
const childUpdateCall = async () => await update.call(prop, params[prop], {
|
|
129
129
|
...options,
|
|
130
130
|
currentSnapshot: snapshotOnCallee,
|
|
131
131
|
calleeElement
|
|
132
132
|
});
|
|
133
|
-
lazyLoad ? window.requestAnimationFrame(() => {
|
|
134
|
-
childUpdateCall();
|
|
133
|
+
lazyLoad ? window.requestAnimationFrame(async () => {
|
|
134
|
+
await childUpdateCall();
|
|
135
135
|
if (!options.preventUpdateListener) {
|
|
136
136
|
triggerEventOn("lazyLoad", element, options);
|
|
137
137
|
}
|
|
138
|
-
}) : childUpdateCall();
|
|
138
|
+
}) : await childUpdateCall();
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
if (!preventUpdateListener)
|
|
142
|
-
triggerEventOn("update", element, options);
|
|
142
|
+
await triggerEventOn("update", element, options);
|
|
143
143
|
};
|
|
144
144
|
const captureSnapshot = (element, options) => {
|
|
145
145
|
const ref = element.__ref;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isFunction } from "@domql/utils";
|
|
2
2
|
import { REGISTRY } from "../mixins/index.js";
|
|
3
|
-
const applyParam = (param, element, options) => {
|
|
3
|
+
const applyParam = async (param, element, options) => {
|
|
4
4
|
const { node, context, __ref: ref } = element;
|
|
5
5
|
const prop = element[param];
|
|
6
6
|
const { onlyUpdate } = options;
|
|
@@ -14,7 +14,7 @@ const applyParam = (param, element, options) => {
|
|
|
14
14
|
const hasOnlyUpdate = onlyUpdate ? onlyUpdate === param || element.lookup(onlyUpdate) : true;
|
|
15
15
|
if (isGlobalTransformer && !hasContextDefine && hasOnlyUpdate) {
|
|
16
16
|
if (isFunction(isGlobalTransformer)) {
|
|
17
|
-
isGlobalTransformer(prop, element, node, options);
|
|
17
|
+
await isGlobalTransformer(prop, element, node, options);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
}
|
package/mixins/content.js
CHANGED
|
@@ -41,13 +41,13 @@ export const removeContent = function (el, opts = {}) {
|
|
|
41
41
|
* Appends anything as content
|
|
42
42
|
* an original one as a child
|
|
43
43
|
*/
|
|
44
|
-
export function setContent (param, element, node, opts) {
|
|
44
|
+
export async function setContent (param, element, node, opts) {
|
|
45
45
|
const contentElementKey = setContentKey(element, opts)
|
|
46
46
|
if (param && element) {
|
|
47
47
|
if (element[contentElementKey].update) {
|
|
48
48
|
element[contentElementKey].update({}, opts)
|
|
49
49
|
} else {
|
|
50
|
-
set.call(element, param, opts)
|
|
50
|
+
await set.call(element, param, opts)
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.205",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@domql/state": "^2.5.203",
|
|
33
33
|
"@domql/utils": "^2.5.203"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "0e199902ea51b67aa7c0ca0446aae8e492d49789",
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/core": "^7.12.0"
|
|
38
38
|
}
|
package/set.js
CHANGED
|
@@ -19,9 +19,9 @@ export const resetElement = async (params, element, options) => {
|
|
|
19
19
|
})
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const reset = (options) => {
|
|
22
|
+
export const reset = async (options) => {
|
|
23
23
|
const element = this
|
|
24
|
-
create(element, element.parent, undefined, {
|
|
24
|
+
await create(element, element.parent, undefined, {
|
|
25
25
|
ignoreChildExtend: true,
|
|
26
26
|
...registry.defaultOptions,
|
|
27
27
|
...OPTIONS.create,
|
|
@@ -45,7 +45,7 @@ export const set = async function (params, options = {}, el) {
|
|
|
45
45
|
const beforeUpdateReturns = await triggerEventOnUpdate('beforeUpdate', params, element, options)
|
|
46
46
|
if (beforeUpdateReturns === false) return element
|
|
47
47
|
}
|
|
48
|
-
if (content?.update) content.update()
|
|
48
|
+
if (content?.update) await content.update()
|
|
49
49
|
if (!options.preventUpdateListener) await triggerEventOn('update', element, options)
|
|
50
50
|
return
|
|
51
51
|
}
|
package/update.js
CHANGED
|
@@ -133,7 +133,7 @@ export const update = async function (params = {}, opts) {
|
|
|
133
133
|
|
|
134
134
|
if (preventStateUpdate === 'once') options.preventStateUpdate = false
|
|
135
135
|
|
|
136
|
-
const isElement = applyParam(param, element, options)
|
|
136
|
+
const isElement = await applyParam(param, element, options)
|
|
137
137
|
if (isElement) {
|
|
138
138
|
const { hasDefine, hasContextDefine } = isElement
|
|
139
139
|
const canUpdate = isObject(prop) && !hasDefine && !hasContextDefine && !preventRecursive
|
|
@@ -145,23 +145,23 @@ export const update = async function (params = {}, opts) {
|
|
|
145
145
|
options.onEachUpdate(param, element, element.state, element.context)
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
const childUpdateCall = () => update.call(prop, params[prop], {
|
|
148
|
+
const childUpdateCall = async () => await update.call(prop, params[prop], {
|
|
149
149
|
...options,
|
|
150
150
|
currentSnapshot: snapshotOnCallee,
|
|
151
151
|
calleeElement
|
|
152
152
|
})
|
|
153
153
|
|
|
154
|
-
lazyLoad ? window.requestAnimationFrame(() => { // eslint-disable-line
|
|
155
|
-
childUpdateCall()
|
|
154
|
+
lazyLoad ? window.requestAnimationFrame(async () => { // eslint-disable-line
|
|
155
|
+
await childUpdateCall()
|
|
156
156
|
// handle lazy load
|
|
157
157
|
if (!options.preventUpdateListener) {
|
|
158
158
|
triggerEventOn('lazyLoad', element, options)
|
|
159
159
|
}
|
|
160
|
-
}) : childUpdateCall()
|
|
160
|
+
}) : await childUpdateCall()
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
if (!preventUpdateListener) triggerEventOn('update', element, options)
|
|
164
|
+
if (!preventUpdateListener) await triggerEventOn('update', element, options)
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
const captureSnapshot = (element, options) => {
|
package/utils/applyParam.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { isFunction } from '@domql/utils'
|
|
4
4
|
import { REGISTRY } from '../mixins/index.js'
|
|
5
5
|
|
|
6
|
-
export const applyParam = (param, element, options) => {
|
|
6
|
+
export const applyParam = async (param, element, options) => {
|
|
7
7
|
const { node, context, __ref: ref } = element
|
|
8
8
|
const prop = element[param]
|
|
9
9
|
|
|
@@ -22,7 +22,7 @@ export const applyParam = (param, element, options) => {
|
|
|
22
22
|
|
|
23
23
|
if (isGlobalTransformer && !hasContextDefine && hasOnlyUpdate) {
|
|
24
24
|
if (isFunction(isGlobalTransformer)) {
|
|
25
|
-
isGlobalTransformer(prop, element, node, options)
|
|
25
|
+
await isGlobalTransformer(prop, element, node, options)
|
|
26
26
|
return
|
|
27
27
|
}
|
|
28
28
|
}
|