@domql/element 3.7.3 → 3.7.5
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 +5 -1
- package/dist/cjs/create.js +5 -1
- package/dist/cjs/iterate.js +13 -7
- package/dist/cjs/mixins/attr.js +4 -1
- package/dist/esm/create.js +5 -1
- package/dist/esm/iterate.js +13 -7
- package/dist/esm/mixins/attr.js +5 -2
- package/dist/iife/index.js +35 -16
- package/iterate.js +13 -7
- package/mixins/attr.js +5 -2
- package/package.json +5 -5
package/create.js
CHANGED
|
@@ -286,7 +286,11 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
286
286
|
!optionsHasDefine &&
|
|
287
287
|
!contextHasDefine
|
|
288
288
|
) {
|
|
289
|
-
|
|
289
|
+
try {
|
|
290
|
+
create(exec(element[k], element), element, k, options)
|
|
291
|
+
} catch (e) {
|
|
292
|
+
console.warn('[DOMQL] onlyResolveExtends child error in', k, ':', e?.message || e)
|
|
293
|
+
}
|
|
290
294
|
}
|
|
291
295
|
}
|
|
292
296
|
}
|
package/dist/cjs/create.js
CHANGED
|
@@ -201,7 +201,11 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
201
201
|
if (!ref.__skipCreate && import_mixins.REGISTRY[k] && !optionsHasDefine) {
|
|
202
202
|
continue;
|
|
203
203
|
} else if (element[k] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
204
|
-
|
|
204
|
+
try {
|
|
205
|
+
create((0, import_utils.exec)(element[k], element), element, k, options);
|
|
206
|
+
} catch (e) {
|
|
207
|
+
console.warn("[DOMQL] onlyResolveExtends child error in", k, ":", e?.message || e);
|
|
208
|
+
}
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
}
|
package/dist/cjs/iterate.js
CHANGED
|
@@ -33,13 +33,19 @@ const throughInitialExec = (element, exclude = {}) => {
|
|
|
33
33
|
const prop = element[param];
|
|
34
34
|
if ((0, import_utils.isFunction)(prop) && !(0, import_utils.isMethod)(param, element)) {
|
|
35
35
|
ref.__exec[param] = prop;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
result.then
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
try {
|
|
37
|
+
const result = prop(element, element.state, element.context);
|
|
38
|
+
if (result && typeof result.then === "function") {
|
|
39
|
+
result.then((resolved) => {
|
|
40
|
+
element[param] = resolved;
|
|
41
|
+
}).catch((e) => {
|
|
42
|
+
console.warn("[DOMQL] Async exec error in", param, ":", e?.message || e);
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
element[param] = result;
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.warn("[DOMQL] Exec error in", param, ":", e?.message || e);
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
}
|
package/dist/cjs/mixins/attr.js
CHANGED
|
@@ -32,7 +32,10 @@ function attr(params, element, node) {
|
|
|
32
32
|
const attrs = (0, import_utils.exec)(params, element);
|
|
33
33
|
if (props.attr) (0, import_utils.deepMerge)(attrs, props.attr);
|
|
34
34
|
for (const attr2 in attrs) {
|
|
35
|
-
|
|
35
|
+
let val = (0, import_utils.exec)(attrs[attr2], element);
|
|
36
|
+
if ((0, import_utils.isString)(val) && val.includes("{{") && element.call) {
|
|
37
|
+
val = element.call("replaceLiteralsWithObjectFields", val, element.state);
|
|
38
|
+
}
|
|
36
39
|
if (val === __attr[attr2]) continue;
|
|
37
40
|
if (val !== false && val !== void 0 && val !== null && node.setAttribute) {
|
|
38
41
|
node.setAttribute(attr2, val);
|
package/dist/esm/create.js
CHANGED
|
@@ -192,7 +192,11 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
192
192
|
if (!ref.__skipCreate && REGISTRY[k] && !optionsHasDefine) {
|
|
193
193
|
continue;
|
|
194
194
|
} else if (element[k] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
195
|
-
|
|
195
|
+
try {
|
|
196
|
+
create(exec(element[k], element), element, k, options);
|
|
197
|
+
} catch (e) {
|
|
198
|
+
console.warn("[DOMQL] onlyResolveExtends child error in", k, ":", e?.message || e);
|
|
199
|
+
}
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
}
|
package/dist/esm/iterate.js
CHANGED
|
@@ -16,13 +16,19 @@ const throughInitialExec = (element, exclude = {}) => {
|
|
|
16
16
|
const prop = element[param];
|
|
17
17
|
if (isFunction(prop) && !isMethod(param, element)) {
|
|
18
18
|
ref.__exec[param] = prop;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
result.then
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
try {
|
|
20
|
+
const result = prop(element, element.state, element.context);
|
|
21
|
+
if (result && typeof result.then === "function") {
|
|
22
|
+
result.then((resolved) => {
|
|
23
|
+
element[param] = resolved;
|
|
24
|
+
}).catch((e) => {
|
|
25
|
+
console.warn("[DOMQL] Async exec error in", param, ":", e?.message || e);
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
element[param] = result;
|
|
29
|
+
}
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.warn("[DOMQL] Exec error in", param, ":", e?.message || e);
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
}
|
package/dist/esm/mixins/attr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deepMerge, exec, isNot } from "@domql/utils";
|
|
1
|
+
import { deepMerge, exec, isNot, isString } from "@domql/utils";
|
|
2
2
|
import { report } from "@domql/report";
|
|
3
3
|
function attr(params, element, node) {
|
|
4
4
|
const { __ref: ref, props } = element;
|
|
@@ -8,7 +8,10 @@ function attr(params, element, node) {
|
|
|
8
8
|
const attrs = exec(params, element);
|
|
9
9
|
if (props.attr) deepMerge(attrs, props.attr);
|
|
10
10
|
for (const attr2 in attrs) {
|
|
11
|
-
|
|
11
|
+
let val = exec(attrs[attr2], element);
|
|
12
|
+
if (isString(val) && val.includes("{{") && element.call) {
|
|
13
|
+
val = element.call("replaceLiteralsWithObjectFields", val, element.state);
|
|
14
|
+
}
|
|
12
15
|
if (val === __attr[attr2]) continue;
|
|
13
16
|
if (val !== false && val !== void 0 && val !== null && node.setAttribute) {
|
|
14
17
|
node.setAttribute(attr2, val);
|
package/dist/iife/index.js
CHANGED
|
@@ -1080,14 +1080,17 @@ var DomqlElement = (() => {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
return element;
|
|
1082
1082
|
};
|
|
1083
|
-
trackSourcemapDeep = (sourcemap, obj, sourceName) => {
|
|
1083
|
+
trackSourcemapDeep = (sourcemap, obj, sourceName, seen) => {
|
|
1084
|
+
if (!seen) seen = /* @__PURE__ */ new WeakSet();
|
|
1085
|
+
if (seen.has(obj)) return;
|
|
1086
|
+
seen.add(obj);
|
|
1084
1087
|
for (const key in obj) {
|
|
1085
1088
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
1086
1089
|
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
1087
1090
|
const val = obj[key];
|
|
1088
1091
|
if (isObject(val) && !isArray(val)) {
|
|
1089
1092
|
sourcemap[key] = sourcemap[key] || {};
|
|
1090
|
-
trackSourcemapDeep(sourcemap[key], val, sourceName);
|
|
1093
|
+
trackSourcemapDeep(sourcemap[key], val, sourceName, seen);
|
|
1091
1094
|
} else {
|
|
1092
1095
|
sourcemap[key] = sourceName;
|
|
1093
1096
|
}
|
|
@@ -1938,7 +1941,9 @@ var DomqlElement = (() => {
|
|
|
1938
1941
|
);
|
|
1939
1942
|
createClient = mod.createClient;
|
|
1940
1943
|
}
|
|
1941
|
-
|
|
1944
|
+
const client = createClient(supabaseUrl, key, options);
|
|
1945
|
+
if (!client || !client.auth) return null;
|
|
1946
|
+
return supabaseAdapter(client);
|
|
1942
1947
|
};
|
|
1943
1948
|
applyFilters = (query, params) => {
|
|
1944
1949
|
if (!params) return query;
|
|
@@ -2570,7 +2575,7 @@ var DomqlElement = (() => {
|
|
|
2570
2575
|
return resolved;
|
|
2571
2576
|
};
|
|
2572
2577
|
initAdapterAuth = async (adapter, context) => {
|
|
2573
|
-
if (adapter.__authInitialized) return;
|
|
2578
|
+
if (!adapter || adapter.__authInitialized) return;
|
|
2574
2579
|
adapter.__authInitialized = true;
|
|
2575
2580
|
if (!adapter.getSession) return;
|
|
2576
2581
|
const updateAuth = (user, session) => {
|
|
@@ -2602,9 +2607,10 @@ var DomqlElement = (() => {
|
|
|
2602
2607
|
if (db.__resolving) return db.__resolving;
|
|
2603
2608
|
db.__resolving = resolveDb(db);
|
|
2604
2609
|
const resolved = await db.__resolving;
|
|
2610
|
+
delete db.__resolving;
|
|
2611
|
+
if (!resolved) return null;
|
|
2605
2612
|
db.__resolved = resolved;
|
|
2606
2613
|
context.fetch = resolved;
|
|
2607
|
-
delete db.__resolving;
|
|
2608
2614
|
if (db.auth !== false) await initAdapterAuth(resolved, context);
|
|
2609
2615
|
return resolved;
|
|
2610
2616
|
};
|
|
@@ -3451,12 +3457,12 @@ var DomqlElement = (() => {
|
|
|
3451
3457
|
const result = fn.call(this, ...args);
|
|
3452
3458
|
if (result && typeof result.then === "function") {
|
|
3453
3459
|
result.catch((err) => {
|
|
3454
|
-
this
|
|
3460
|
+
error.call(this, err);
|
|
3455
3461
|
});
|
|
3456
3462
|
}
|
|
3457
3463
|
return result;
|
|
3458
3464
|
} catch (err) {
|
|
3459
|
-
this
|
|
3465
|
+
error.call(this, err);
|
|
3460
3466
|
if (context?.strictMode) throw err;
|
|
3461
3467
|
}
|
|
3462
3468
|
}
|
|
@@ -4137,13 +4143,19 @@ ${element}` : "";
|
|
|
4137
4143
|
const prop = element[param];
|
|
4138
4144
|
if (isFunction(prop) && !isMethod(param, element)) {
|
|
4139
4145
|
ref.__exec[param] = prop;
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
result.then
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4146
|
+
try {
|
|
4147
|
+
const result = prop(element, element.state, element.context);
|
|
4148
|
+
if (result && typeof result.then === "function") {
|
|
4149
|
+
result.then((resolved) => {
|
|
4150
|
+
element[param] = resolved;
|
|
4151
|
+
}).catch((e) => {
|
|
4152
|
+
console.warn("[DOMQL] Async exec error in", param, ":", e?.message || e);
|
|
4153
|
+
});
|
|
4154
|
+
} else {
|
|
4155
|
+
element[param] = result;
|
|
4156
|
+
}
|
|
4157
|
+
} catch (e) {
|
|
4158
|
+
console.warn("[DOMQL] Exec error in", param, ":", e?.message || e);
|
|
4147
4159
|
}
|
|
4148
4160
|
}
|
|
4149
4161
|
}
|
|
@@ -4299,7 +4311,10 @@ ${element}` : "";
|
|
|
4299
4311
|
const attrs = exec(params, element);
|
|
4300
4312
|
if (props.attr) deepMerge(attrs, props.attr);
|
|
4301
4313
|
for (const attr2 in attrs) {
|
|
4302
|
-
|
|
4314
|
+
let val = exec(attrs[attr2], element);
|
|
4315
|
+
if (isString(val) && val.includes("{{") && element.call) {
|
|
4316
|
+
val = element.call("replaceLiteralsWithObjectFields", val, element.state);
|
|
4317
|
+
}
|
|
4303
4318
|
if (val === __attr[attr2]) continue;
|
|
4304
4319
|
if (val !== false && val !== void 0 && val !== null && node.setAttribute) {
|
|
4305
4320
|
node.setAttribute(attr2, val);
|
|
@@ -6628,7 +6643,11 @@ ${element}` : "";
|
|
|
6628
6643
|
if (!ref.__skipCreate && REGISTRY[k] && !optionsHasDefine) {
|
|
6629
6644
|
continue;
|
|
6630
6645
|
} else if (element[k] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
6631
|
-
|
|
6646
|
+
try {
|
|
6647
|
+
create(exec(element[k], element), element, k, options);
|
|
6648
|
+
} catch (e) {
|
|
6649
|
+
console.warn("[DOMQL] onlyResolveExtends child error in", k, ":", e?.message || e);
|
|
6650
|
+
}
|
|
6632
6651
|
}
|
|
6633
6652
|
}
|
|
6634
6653
|
}
|
package/iterate.js
CHANGED
|
@@ -19,13 +19,19 @@ export const throughInitialExec = (element, exclude = {}) => {
|
|
|
19
19
|
const prop = element[param]
|
|
20
20
|
if (isFunction(prop) && !isMethod(param, element)) {
|
|
21
21
|
ref.__exec[param] = prop
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
result.then
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
try {
|
|
23
|
+
const result = prop(element, element.state, element.context)
|
|
24
|
+
if (result && typeof result.then === 'function') {
|
|
25
|
+
result.then(resolved => {
|
|
26
|
+
element[param] = resolved
|
|
27
|
+
}).catch(e => {
|
|
28
|
+
console.warn('[DOMQL] Async exec error in', param, ':', e?.message || e)
|
|
29
|
+
})
|
|
30
|
+
} else {
|
|
31
|
+
element[param] = result
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.warn('[DOMQL] Exec error in', param, ':', e?.message || e)
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
37
|
}
|
package/mixins/attr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { deepMerge, exec, isNot } from '@domql/utils'
|
|
3
|
+
import { deepMerge, exec, isNot, isString } from '@domql/utils'
|
|
4
4
|
import { report } from '@domql/report'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -14,7 +14,10 @@ export function attr (params, element, node) {
|
|
|
14
14
|
const attrs = exec(params, element)
|
|
15
15
|
if (props.attr) deepMerge(attrs, props.attr)
|
|
16
16
|
for (const attr in attrs) {
|
|
17
|
-
|
|
17
|
+
let val = exec(attrs[attr], element)
|
|
18
|
+
if (isString(val) && val.includes('{{') && element.call) {
|
|
19
|
+
val = element.call('replaceLiteralsWithObjectFields', val, element.state)
|
|
20
|
+
}
|
|
18
21
|
if (val === __attr[attr]) continue
|
|
19
22
|
if (
|
|
20
23
|
val !== false &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.5",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"build:iife": "cross-env NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=DomqlElement --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@domql/report": "^3.7.
|
|
50
|
-
"@domql/state": "^3.7.
|
|
51
|
-
"@domql/utils": "^3.7.
|
|
52
|
-
"attrs-in-props": "^3.7.
|
|
49
|
+
"@domql/report": "^3.7.5",
|
|
50
|
+
"@domql/state": "^3.7.5",
|
|
51
|
+
"@domql/utils": "^3.7.5",
|
|
52
|
+
"attrs-in-props": "^3.7.5"
|
|
53
53
|
},
|
|
54
54
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
55
55
|
"devDependencies": {
|