@domql/element 2.5.156 → 2.5.158
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/cache/options.js +2 -1
- package/create.js +5 -5
- package/define.js +3 -3
- package/dist/cjs/cache/options.js +3 -1
- package/dist/cjs/create.js +8 -7
- package/dist/cjs/define.js +2 -2
- package/dist/cjs/methods/index.js +1 -1
- package/dist/cjs/methods/set.js +4 -14
- package/dist/cjs/methods/v2.js +1 -1
- package/dist/cjs/mixins/attr.js +8 -6
- package/dist/cjs/mixins/classList.js +3 -1
- package/dist/cjs/mixins/content.js +2 -12
- package/dist/cjs/mixins/data.js +3 -1
- package/dist/cjs/mixins/html.js +4 -2
- package/dist/cjs/mixins/index.js +20 -30
- package/dist/cjs/mixins/registry.js +3 -1
- package/dist/cjs/mixins/scope.js +4 -2
- package/dist/cjs/mixins/style.js +4 -2
- package/dist/cjs/mixins/text.js +4 -2
- package/dist/cjs/node.js +1 -1
- package/dist/cjs/set.js +8 -17
- package/dist/cjs/update.js +6 -15
- package/dist/cjs/utils/applyParam.js +1 -1
- package/dist/cjs/utils/component.js +1 -1
- package/dist/cjs/utils/onlyResolveExtends.js +2 -2
- package/methods/index.js +2 -2
- package/methods/set.js +2 -2
- package/methods/v2.js +2 -2
- package/mixins/attr.js +3 -1
- package/mixins/classList.js +3 -1
- package/mixins/content.js +1 -1
- package/mixins/data.js +3 -1
- package/mixins/html.js +3 -1
- package/mixins/index.js +17 -14
- package/mixins/registry.js +3 -1
- package/mixins/scope.js +3 -1
- package/mixins/style.js +3 -1
- package/mixins/text.js +3 -1
- package/node.js +2 -2
- package/package.json +2 -2
- package/set.js +3 -3
- package/update.js +5 -5
- package/utils/applyParam.js +2 -2
- package/utils/component.js +2 -2
- package/utils/onlyResolveExtends.js +3 -3
package/cache/options.js
CHANGED
package/create.js
CHANGED
|
@@ -29,12 +29,12 @@ import { createState } from '@domql/state'
|
|
|
29
29
|
import { isMethod } from './methods'
|
|
30
30
|
import { createProps } from './props'
|
|
31
31
|
import { applyExtend } from './extend'
|
|
32
|
-
import { registry } from './mixins'
|
|
32
|
+
import { REGISTRY, registry } from './mixins'
|
|
33
33
|
import { addMethods } from './methods/set'
|
|
34
34
|
import { assignKeyAsClassname } from './mixins/classList'
|
|
35
35
|
import { throughInitialExec, throughInitialDefine } from './iterate'
|
|
36
36
|
|
|
37
|
-
import OPTIONS from './cache/options'
|
|
37
|
+
import { OPTIONS } from './cache/options'
|
|
38
38
|
|
|
39
39
|
import {
|
|
40
40
|
applyVariant,
|
|
@@ -46,7 +46,7 @@ const ENV = process.env.NODE_ENV
|
|
|
46
46
|
/**
|
|
47
47
|
* Creating a domQL element using passed parameters
|
|
48
48
|
*/
|
|
49
|
-
const create = (element, parent, key, options = OPTIONS.create || {}, attachOptions) => {
|
|
49
|
+
export const create = (element, parent, key, options = OPTIONS.create || {}, attachOptions) => {
|
|
50
50
|
cacheOptions(element, options)
|
|
51
51
|
|
|
52
52
|
// if element is STRING
|
|
@@ -373,7 +373,7 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
373
373
|
if (
|
|
374
374
|
isUndefined(element[k]) ||
|
|
375
375
|
isMethod(k, element) ||
|
|
376
|
-
isObject(registry[k]) ||
|
|
376
|
+
isObject((registry.default || registry)[k]) ||
|
|
377
377
|
isVariant(k)
|
|
378
378
|
) continue
|
|
379
379
|
|
|
@@ -382,7 +382,7 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
382
382
|
element.context.define[k]
|
|
383
383
|
const optionsHasDefine = options.define && options.define[k]
|
|
384
384
|
|
|
385
|
-
if (!ref.__skipCreate &&
|
|
385
|
+
if (!ref.__skipCreate && REGISTRY[k] && !optionsHasDefine) {
|
|
386
386
|
continue
|
|
387
387
|
} else if (element[k] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
388
388
|
create(exec(element[k], element), element, k, options)
|
package/define.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { report } from '@domql/report'
|
|
4
|
-
import {
|
|
4
|
+
import { REGISTRY } from './mixins'
|
|
5
5
|
|
|
6
6
|
export default (params, options = {}) => {
|
|
7
7
|
const { overwrite } = options
|
|
8
8
|
for (const param in params) {
|
|
9
|
-
if (
|
|
9
|
+
if (REGISTRY[param] && !overwrite) {
|
|
10
10
|
report('OverwriteToBuiltin', param)
|
|
11
|
-
} else
|
|
11
|
+
} else REGISTRY[param] = params[param]
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -18,7 +18,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var options_exports = {};
|
|
20
20
|
__export(options_exports, {
|
|
21
|
+
OPTIONS: () => OPTIONS,
|
|
21
22
|
default: () => options_default
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(options_exports);
|
|
24
|
-
|
|
25
|
+
const OPTIONS = {};
|
|
26
|
+
var options_default = OPTIONS;
|
package/dist/cjs/create.js
CHANGED
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var create_exports = {};
|
|
30
30
|
__export(create_exports, {
|
|
31
|
+
create: () => create,
|
|
31
32
|
default: () => create_default
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(create_exports);
|
|
@@ -44,10 +45,10 @@ var import_mixins = require("./mixins");
|
|
|
44
45
|
var import_set = require("./methods/set");
|
|
45
46
|
var import_classList = require("./mixins/classList");
|
|
46
47
|
var import_iterate = require("./iterate");
|
|
47
|
-
var import_options =
|
|
48
|
+
var import_options = require("./cache/options");
|
|
48
49
|
var import_component = require("./utils/component");
|
|
49
50
|
const ENV = "development";
|
|
50
|
-
const create = (element, parent, key, options = import_options.
|
|
51
|
+
const create = (element, parent, key, options = import_options.OPTIONS.create || {}, attachOptions) => {
|
|
51
52
|
cacheOptions(element, options);
|
|
52
53
|
if (checkIfPrimitive(element)) {
|
|
53
54
|
element = applyValueAsText(element, parent, key);
|
|
@@ -141,9 +142,9 @@ const redefineParent = (element, parent, key, options) => {
|
|
|
141
142
|
return parent;
|
|
142
143
|
};
|
|
143
144
|
const cacheOptions = (element, options) => {
|
|
144
|
-
if (options && !import_options.
|
|
145
|
-
import_options.
|
|
146
|
-
import_options.
|
|
145
|
+
if (options && !import_options.OPTIONS.create) {
|
|
146
|
+
import_options.OPTIONS.create = options;
|
|
147
|
+
import_options.OPTIONS.create.context = element.context || options.context;
|
|
147
148
|
}
|
|
148
149
|
};
|
|
149
150
|
const createKey = (element, parent, key) => {
|
|
@@ -298,12 +299,12 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
298
299
|
(0, import_iterate.throughInitialDefine)(element);
|
|
299
300
|
(0, import_iterate.throughInitialExec)(element);
|
|
300
301
|
for (const k in element) {
|
|
301
|
-
if ((0, import_utils.isUndefined)(element[k]) || (0, import_methods.isMethod)(k, element) || (0, import_utils.isObject)(import_mixins.registry[k]) || (0, import_utils.isVariant)(k))
|
|
302
|
+
if ((0, import_utils.isUndefined)(element[k]) || (0, import_methods.isMethod)(k, element) || (0, import_utils.isObject)((import_mixins.registry.default || import_mixins.registry)[k]) || (0, import_utils.isVariant)(k))
|
|
302
303
|
continue;
|
|
303
304
|
const hasDefine = element.define && element.define[k];
|
|
304
305
|
const contextHasDefine = element.context && element.context.define && element.context.define[k];
|
|
305
306
|
const optionsHasDefine = options.define && options.define[k];
|
|
306
|
-
if (!ref.__skipCreate && import_mixins.
|
|
307
|
+
if (!ref.__skipCreate && import_mixins.REGISTRY[k] && !optionsHasDefine) {
|
|
307
308
|
continue;
|
|
308
309
|
} else if (element[k] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
309
310
|
create((0, import_utils.exec)(element[k], element), element, k, options);
|
package/dist/cjs/define.js
CHANGED
|
@@ -26,9 +26,9 @@ var import_mixins = require("./mixins");
|
|
|
26
26
|
var define_default = (params, options = {}) => {
|
|
27
27
|
const { overwrite } = options;
|
|
28
28
|
for (const param in params) {
|
|
29
|
-
if (import_mixins.
|
|
29
|
+
if (import_mixins.REGISTRY[param] && !overwrite) {
|
|
30
30
|
(0, import_report.report)("OverwriteToBuiltin", param);
|
|
31
31
|
} else
|
|
32
|
-
import_mixins.
|
|
32
|
+
import_mixins.REGISTRY[param] = params[param];
|
|
33
33
|
}
|
|
34
34
|
};
|
|
@@ -174,7 +174,7 @@ function keys() {
|
|
|
174
174
|
const element = this;
|
|
175
175
|
const keys2 = [];
|
|
176
176
|
for (const param in element) {
|
|
177
|
-
if (import_mixins.
|
|
177
|
+
if (import_mixins.REGISTRY[param] && !import_mixins.parseFilters.elementKeys.includes(param) || !Object.hasOwnProperty.call(element, param)) {
|
|
178
178
|
continue;
|
|
179
179
|
}
|
|
180
180
|
keys2.push(param);
|
package/dist/cjs/methods/set.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var set_exports = {};
|
|
30
20
|
__export(set_exports, {
|
|
@@ -32,15 +22,15 @@ __export(set_exports, {
|
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(set_exports);
|
|
34
24
|
var import_utils = require("@domql/utils");
|
|
35
|
-
var import_set =
|
|
36
|
-
var import_update =
|
|
25
|
+
var import_set = require("../set");
|
|
26
|
+
var import_update = require("../update");
|
|
37
27
|
var import__ = require("./");
|
|
38
28
|
var import_content = require("../mixins/content");
|
|
39
29
|
const addMethods = (element, parent, options = {}) => {
|
|
40
30
|
const proto = {
|
|
41
|
-
set: import_set.
|
|
31
|
+
set: import_set.set,
|
|
42
32
|
reset: import_set.reset,
|
|
43
|
-
update: import_update.
|
|
33
|
+
update: import_update.update,
|
|
44
34
|
variables: import__.variables,
|
|
45
35
|
remove: import__.remove,
|
|
46
36
|
updateContent: import_content.updateContent,
|
package/dist/cjs/methods/v2.js
CHANGED
|
@@ -34,7 +34,7 @@ const keys = function() {
|
|
|
34
34
|
const element = this;
|
|
35
35
|
const keys2 = [];
|
|
36
36
|
for (const param in element) {
|
|
37
|
-
if (import_mixins.
|
|
37
|
+
if (import_mixins.REGISTRY[param] && !import_mixins.parseFilters.elementKeys.includes(param)) {
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
keys2.push(param);
|
package/dist/cjs/mixins/attr.js
CHANGED
|
@@ -18,13 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var attr_exports = {};
|
|
20
20
|
__export(attr_exports, {
|
|
21
|
+
attr: () => attr,
|
|
21
22
|
default: () => attr_default
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(attr_exports);
|
|
24
25
|
var import_utils = require("@domql/utils");
|
|
25
26
|
var import_report = require("@domql/report");
|
|
26
27
|
var import_utils2 = require("../utils");
|
|
27
|
-
|
|
28
|
+
const attr = (params, element, node) => {
|
|
28
29
|
const { __ref } = element;
|
|
29
30
|
const { __attr } = __ref;
|
|
30
31
|
if ((0, import_utils.isNot)("object"))
|
|
@@ -32,13 +33,14 @@ var attr_default = (params, element, node) => {
|
|
|
32
33
|
if (params) {
|
|
33
34
|
if (element.props.attr)
|
|
34
35
|
(0, import_utils2.deepMerge)(params, element.props.attr);
|
|
35
|
-
for (const
|
|
36
|
-
const val = (0, import_utils.exec)(params[
|
|
36
|
+
for (const attr2 in params) {
|
|
37
|
+
const val = (0, import_utils.exec)(params[attr2], element);
|
|
37
38
|
if (val !== false && !(0, import_utils.isUndefined)(val) && !(0, import_utils.isNull)(val) && node.setAttribute)
|
|
38
|
-
node.setAttribute(
|
|
39
|
+
node.setAttribute(attr2, val);
|
|
39
40
|
else if (node.removeAttribute)
|
|
40
|
-
node.removeAttribute(
|
|
41
|
-
__attr[
|
|
41
|
+
node.removeAttribute(attr2);
|
|
42
|
+
__attr[attr2] = val;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
};
|
|
46
|
+
var attr_default = attr;
|
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var classList_exports = {};
|
|
20
20
|
__export(classList_exports, {
|
|
21
21
|
applyClassListOnNode: () => applyClassListOnNode,
|
|
22
|
+
applyClasslist: () => applyClasslist,
|
|
22
23
|
assignKeyAsClassname: () => assignKeyAsClassname,
|
|
23
24
|
classList: () => classList,
|
|
24
25
|
classify: () => classify,
|
|
@@ -68,6 +69,7 @@ const applyClassListOnNode = (params, element, node) => {
|
|
|
68
69
|
node.classList = className;
|
|
69
70
|
return className;
|
|
70
71
|
};
|
|
71
|
-
|
|
72
|
+
const applyClasslist = (params, element, node) => {
|
|
72
73
|
applyClassListOnNode(params, element, node);
|
|
73
74
|
};
|
|
75
|
+
var classList_default = applyClasslist;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var content_exports = {};
|
|
30
20
|
__export(content_exports, {
|
|
@@ -35,7 +25,7 @@ __export(content_exports, {
|
|
|
35
25
|
});
|
|
36
26
|
module.exports = __toCommonJS(content_exports);
|
|
37
27
|
var import_utils = require("@domql/utils");
|
|
38
|
-
var import_set =
|
|
28
|
+
var import_set = require("../set");
|
|
39
29
|
const updateContent = function(params, options) {
|
|
40
30
|
const element = this;
|
|
41
31
|
const ref = element.__ref;
|
|
@@ -77,7 +67,7 @@ const setContent = (param, element, node, opts) => {
|
|
|
77
67
|
if (element[contentElementKey].update) {
|
|
78
68
|
element[contentElementKey].update({}, opts);
|
|
79
69
|
} else {
|
|
80
|
-
import_set.
|
|
70
|
+
import_set.set.call(element, param, opts);
|
|
81
71
|
}
|
|
82
72
|
}
|
|
83
73
|
};
|
package/dist/cjs/mixins/data.js
CHANGED
|
@@ -18,12 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var data_exports = {};
|
|
20
20
|
__export(data_exports, {
|
|
21
|
+
data: () => data,
|
|
21
22
|
default: () => data_default
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(data_exports);
|
|
24
25
|
var import_utils = require("@domql/utils");
|
|
25
26
|
var import_report = require("@domql/report");
|
|
26
|
-
|
|
27
|
+
const data = (params, element, node) => {
|
|
27
28
|
if (params) {
|
|
28
29
|
if (element.props.data)
|
|
29
30
|
(0, import_utils.deepMerge)(params, element.props.data);
|
|
@@ -38,3 +39,4 @@ var data_default = (params, element, node) => {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
};
|
|
42
|
+
var data_default = data;
|
package/dist/cjs/mixins/html.js
CHANGED
|
@@ -18,11 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var html_exports = {};
|
|
20
20
|
__export(html_exports, {
|
|
21
|
-
default: () => html_default
|
|
21
|
+
default: () => html_default,
|
|
22
|
+
html: () => html
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(html_exports);
|
|
24
25
|
var import_utils = require("@domql/utils");
|
|
25
|
-
|
|
26
|
+
const html = (param, element, node) => {
|
|
26
27
|
var _a;
|
|
27
28
|
const prop = (0, import_utils.exec)(param, element) || (0, import_utils.exec)((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.html, element);
|
|
28
29
|
const { __ref } = element;
|
|
@@ -34,3 +35,4 @@ var html_default = (param, element, node) => {
|
|
|
34
35
|
__ref.__html = prop;
|
|
35
36
|
}
|
|
36
37
|
};
|
|
38
|
+
var html_default = html;
|
package/dist/cjs/mixins/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -18,37 +16,29 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
18
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var mixins_exports = {};
|
|
31
21
|
__export(mixins_exports, {
|
|
32
|
-
attr: () => import_attr.
|
|
33
|
-
classList: () => import_classList.
|
|
34
|
-
content: () => import_content.
|
|
35
|
-
data: () => import_data.
|
|
36
|
-
html: () => import_html.
|
|
37
|
-
registry: () => import_registry.
|
|
38
|
-
scope: () => import_scope.
|
|
39
|
-
state: () => import_state.
|
|
40
|
-
style: () => import_style.
|
|
41
|
-
text: () => import_text.
|
|
22
|
+
attr: () => import_attr.attr,
|
|
23
|
+
classList: () => import_classList.applyClasslist,
|
|
24
|
+
content: () => import_content.setContent,
|
|
25
|
+
data: () => import_data.data,
|
|
26
|
+
html: () => import_html.html,
|
|
27
|
+
registry: () => import_registry.REGISTRY,
|
|
28
|
+
scope: () => import_scope.scope,
|
|
29
|
+
state: () => import_state.state,
|
|
30
|
+
style: () => import_style.style,
|
|
31
|
+
text: () => import_text.text
|
|
42
32
|
});
|
|
43
33
|
module.exports = __toCommonJS(mixins_exports);
|
|
44
|
-
var import_attr =
|
|
45
|
-
var import_classList =
|
|
46
|
-
var import_content =
|
|
47
|
-
var import_data =
|
|
48
|
-
var import_html =
|
|
49
|
-
var import_style =
|
|
50
|
-
var import_text =
|
|
51
|
-
var import_state =
|
|
52
|
-
var import_scope =
|
|
53
|
-
var import_registry =
|
|
34
|
+
var import_attr = require("./attr");
|
|
35
|
+
var import_classList = require("./classList");
|
|
36
|
+
var import_content = require("./content");
|
|
37
|
+
var import_data = require("./data");
|
|
38
|
+
var import_html = require("./html");
|
|
39
|
+
var import_style = require("./style");
|
|
40
|
+
var import_text = require("./text");
|
|
41
|
+
var import_state = require("./state");
|
|
42
|
+
var import_scope = require("./scope");
|
|
43
|
+
var import_registry = require("./registry");
|
|
54
44
|
__reExport(mixins_exports, require("./registry"), module.exports);
|
|
@@ -18,13 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var registry_exports = {};
|
|
20
20
|
__export(registry_exports, {
|
|
21
|
+
REGISTRY: () => REGISTRY,
|
|
21
22
|
collectionFilters: () => collectionFilters,
|
|
22
23
|
default: () => registry_default,
|
|
23
24
|
parseFilters: () => parseFilters
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(registry_exports);
|
|
26
27
|
var import__ = require(".");
|
|
27
|
-
|
|
28
|
+
const REGISTRY = {
|
|
28
29
|
attr: import__.attr,
|
|
29
30
|
style: import__.style,
|
|
30
31
|
text: import__.text,
|
|
@@ -83,6 +84,7 @@ var registry_default = {
|
|
|
83
84
|
$setStateCollection: {},
|
|
84
85
|
$setPropsCollection: {}
|
|
85
86
|
};
|
|
87
|
+
var registry_default = REGISTRY;
|
|
86
88
|
const parseFilters = {
|
|
87
89
|
elementKeys: [
|
|
88
90
|
"tag",
|
package/dist/cjs/mixins/scope.js
CHANGED
|
@@ -18,11 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var scope_exports = {};
|
|
20
20
|
__export(scope_exports, {
|
|
21
|
-
default: () => scope_default
|
|
21
|
+
default: () => scope_default,
|
|
22
|
+
scope: () => scope
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(scope_exports);
|
|
24
25
|
var import_utils = require("@domql/utils");
|
|
25
|
-
|
|
26
|
+
const scope = (params, element, node) => {
|
|
26
27
|
if (!(0, import_utils.isObject)(params))
|
|
27
28
|
return;
|
|
28
29
|
for (const scopeItem in params) {
|
|
@@ -34,3 +35,4 @@ var scope_default = (params, element, node) => {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
};
|
|
38
|
+
var scope_default = scope;
|
package/dist/cjs/mixins/style.js
CHANGED
|
@@ -18,12 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var style_exports = {};
|
|
20
20
|
__export(style_exports, {
|
|
21
|
-
default: () => style_default
|
|
21
|
+
default: () => style_default,
|
|
22
|
+
style: () => style
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(style_exports);
|
|
24
25
|
var import_utils = require("@domql/utils");
|
|
25
26
|
var import_report = require("@domql/report");
|
|
26
|
-
|
|
27
|
+
const style = (params, element, node) => {
|
|
27
28
|
if (params) {
|
|
28
29
|
if ((0, import_utils.isObject)(params))
|
|
29
30
|
(0, import_utils.map)(node.style, params, element);
|
|
@@ -31,3 +32,4 @@ var style_default = (params, element, node) => {
|
|
|
31
32
|
(0, import_report.report)("HTMLInvalidStyles", params);
|
|
32
33
|
}
|
|
33
34
|
};
|
|
35
|
+
var style_default = style;
|
package/dist/cjs/mixins/text.js
CHANGED
|
@@ -18,12 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var text_exports = {};
|
|
20
20
|
__export(text_exports, {
|
|
21
|
-
default: () => text_default
|
|
21
|
+
default: () => text_default,
|
|
22
|
+
text: () => text
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(text_exports);
|
|
24
25
|
var import__ = require("..");
|
|
25
26
|
var import_utils = require("@domql/utils");
|
|
26
|
-
|
|
27
|
+
const text = (param, element, node) => {
|
|
27
28
|
let prop = (0, import_utils.exec)(param, element);
|
|
28
29
|
if ((0, import_utils.isString)(prop) && prop.includes("{{")) {
|
|
29
30
|
prop = (0, import_utils.replaceLiteralsWithObjectFields)(prop, element.state);
|
|
@@ -41,3 +42,4 @@ var text_default = (param, element, node) => {
|
|
|
41
42
|
(0, import__.create)({ tag: "string", text: prop }, element, "__text");
|
|
42
43
|
}
|
|
43
44
|
};
|
|
45
|
+
var text_default = text;
|
package/dist/cjs/node.js
CHANGED
|
@@ -74,7 +74,7 @@ const createNode = (element, options) => {
|
|
|
74
74
|
const value = element[param];
|
|
75
75
|
if (!Object.hasOwnProperty.call(element, param))
|
|
76
76
|
continue;
|
|
77
|
-
if ((0, import_utils.isUndefined)(value) || (0, import_methods.isMethod)(param, element) || (0, import_utils.isVariant)(param) || (0, import_utils.isObject)(import_mixins.
|
|
77
|
+
if ((0, import_utils.isUndefined)(value) || (0, import_methods.isMethod)(param, element) || (0, import_utils.isVariant)(param) || (0, import_utils.isObject)(import_mixins.REGISTRY[param]))
|
|
78
78
|
continue;
|
|
79
79
|
const isElement = (0, import_applyParam.applyParam)(param, element, options);
|
|
80
80
|
if (isElement) {
|
package/dist/cjs/set.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,25 +15,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var set_exports = {};
|
|
30
20
|
__export(set_exports, {
|
|
31
21
|
default: () => set_default,
|
|
32
22
|
reset: () => reset,
|
|
33
|
-
resetElement: () => resetElement
|
|
23
|
+
resetElement: () => resetElement,
|
|
24
|
+
set: () => set
|
|
34
25
|
});
|
|
35
26
|
module.exports = __toCommonJS(set_exports);
|
|
36
27
|
var import_utils = require("@domql/utils");
|
|
37
|
-
var
|
|
38
|
-
var
|
|
28
|
+
var import_options = require("./cache/options");
|
|
29
|
+
var import_create = require("./create");
|
|
39
30
|
var import_mixins = require("./mixins");
|
|
40
31
|
var import_content = require("./mixins/content");
|
|
41
32
|
var import_event = require("@domql/event");
|
|
@@ -43,19 +34,19 @@ const resetElement = (params, element, options) => {
|
|
|
43
34
|
if (!options.preventRemove)
|
|
44
35
|
(0, import_content.removeContent)(element, options);
|
|
45
36
|
const { __ref: ref } = element;
|
|
46
|
-
(0, import_create.
|
|
37
|
+
(0, import_create.create)(params, element, ref.contentElementKey || "content", {
|
|
47
38
|
ignoreChildExtend: true,
|
|
48
39
|
...import_mixins.registry.defaultOptions,
|
|
49
|
-
...import_options.
|
|
40
|
+
...import_options.OPTIONS.create,
|
|
50
41
|
...options
|
|
51
42
|
});
|
|
52
43
|
};
|
|
53
44
|
const reset = (options) => {
|
|
54
45
|
const element = void 0;
|
|
55
|
-
(0, import_create.
|
|
46
|
+
(0, import_create.create)(element, element.parent, void 0, {
|
|
56
47
|
ignoreChildExtend: true,
|
|
57
48
|
...import_mixins.registry.defaultOptions,
|
|
58
|
-
...import_options.
|
|
49
|
+
...import_options.OPTIONS.create,
|
|
59
50
|
...options
|
|
60
51
|
});
|
|
61
52
|
};
|
package/dist/cjs/update.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,18 +15,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var update_exports = {};
|
|
30
20
|
__export(update_exports, {
|
|
31
|
-
default: () => update_default
|
|
21
|
+
default: () => update_default,
|
|
22
|
+
update: () => update
|
|
32
23
|
});
|
|
33
24
|
module.exports = __toCommonJS(update_exports);
|
|
34
25
|
var import_utils = require("@domql/utils");
|
|
@@ -36,11 +27,11 @@ var import_event = require("@domql/event");
|
|
|
36
27
|
var import_methods = require("./methods");
|
|
37
28
|
var import_props = require("./props");
|
|
38
29
|
var import_state = require("@domql/state");
|
|
39
|
-
var import_create =
|
|
30
|
+
var import_create = require("./create");
|
|
40
31
|
var import_iterate = require("./iterate");
|
|
41
32
|
var import_mixins = require("./mixins");
|
|
42
33
|
var import_applyParam = require("./utils/applyParam");
|
|
43
|
-
var import_options =
|
|
34
|
+
var import_options = require("./cache/options");
|
|
44
35
|
var import_utils2 = require("./utils");
|
|
45
36
|
const snapshot = {
|
|
46
37
|
snapshotId: import_utils.createSnapshotId
|
|
@@ -133,7 +124,7 @@ const update = function(params = {}, opts) {
|
|
|
133
124
|
const isInPreventUpdate = (0, import_utils.isArray)(preventUpdate) && preventUpdate.includes(param);
|
|
134
125
|
const isInPreventDefineUpdate = (0, import_utils.isArray)(preventDefineUpdate) && preventDefineUpdate.includes(param);
|
|
135
126
|
const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
|
|
136
|
-
if ((0, import_utils.isUndefined)(prop) || isInPreventUpdate || isInPreventDefineUpdate || preventDefineUpdate === true || preventDefineUpdate === param || preventContentUpdate && param === "content" && !hasCollection || (preventStateUpdate && param) === "state" || (0, import_methods.isMethod)(param, element) || (0, import_utils.isObject)(import_mixins.
|
|
127
|
+
if ((0, import_utils.isUndefined)(prop) || isInPreventUpdate || isInPreventDefineUpdate || preventDefineUpdate === true || preventDefineUpdate === param || preventContentUpdate && param === "content" && !hasCollection || (preventStateUpdate && param) === "state" || (0, import_methods.isMethod)(param, element) || (0, import_utils.isObject)(import_mixins.REGISTRY[param]) || (0, import_utils.isVariant)(param))
|
|
137
128
|
continue;
|
|
138
129
|
if (preventStateUpdate === "once")
|
|
139
130
|
options.preventStateUpdate = false;
|
|
@@ -215,7 +206,7 @@ const checkIfOnUpdate = (element, parent, options) => {
|
|
|
215
206
|
};
|
|
216
207
|
delete element.__ref;
|
|
217
208
|
delete element.parent;
|
|
218
|
-
const createdElement = (0, import_create.
|
|
209
|
+
const createdElement = (0, import_create.create)(element, parent, element.key, import_options.OPTIONS.create, attachOptions);
|
|
219
210
|
if (options.preventUpdate !== true && element.on && (0, import_utils.isFunction)(element.on.update)) {
|
|
220
211
|
(0, import_event.applyEvent)(element.on.update, createdElement, createdElement.state);
|
|
221
212
|
}
|
|
@@ -27,7 +27,7 @@ const applyParam = (param, element, options) => {
|
|
|
27
27
|
const { node, context, __ref: ref } = element;
|
|
28
28
|
const prop = element[param];
|
|
29
29
|
const { onlyUpdate } = options;
|
|
30
|
-
const DOMQLProperty = import_mixins.
|
|
30
|
+
const DOMQLProperty = import_mixins.REGISTRY[param];
|
|
31
31
|
const DOMQLPropertyFromContext = context && context.registry && context.registry[param];
|
|
32
32
|
const isGlobalTransformer = DOMQLPropertyFromContext || DOMQLProperty;
|
|
33
33
|
const hasDefine = element.define && element.define[param];
|
|
@@ -45,7 +45,7 @@ const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
|
|
|
45
45
|
newElem.define[k] = prop;
|
|
46
46
|
}
|
|
47
47
|
const isComponent = (0, import_utils.checkIfKeyIsComponent)(k);
|
|
48
|
-
const isRegistry = import_mixins.
|
|
48
|
+
const isRegistry = import_mixins.REGISTRY[k];
|
|
49
49
|
if (isComponent || isRegistry) {
|
|
50
50
|
newElem[k] = prop;
|
|
51
51
|
} else {
|
|
@@ -76,12 +76,12 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
76
76
|
(0, import_iterate.throughInitialExec)(element);
|
|
77
77
|
for (const param in element) {
|
|
78
78
|
const prop = element[param];
|
|
79
|
-
if ((0, import_utils.isUndefined)(prop) || (0, import_methods.isMethod)(param, element) || (0, import_utils.isObject)(import_mixins.
|
|
79
|
+
if ((0, import_utils.isUndefined)(prop) || (0, import_methods.isMethod)(param, element) || (0, import_utils.isObject)(import_mixins.REGISTRY[param]) || (0, import__2.isVariant)(param))
|
|
80
80
|
continue;
|
|
81
81
|
const hasDefine = element.define && element.define[param];
|
|
82
82
|
const contextHasDefine = element.context && element.context.define && element.context.define[param];
|
|
83
83
|
const optionsHasDefine = options.define && options.define[param];
|
|
84
|
-
if (import_mixins.
|
|
84
|
+
if (import_mixins.REGISTRY[param] && !optionsHasDefine) {
|
|
85
85
|
continue;
|
|
86
86
|
} else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
87
87
|
(0, import__.create)((0, import_utils.exec)(prop, element), element, param, options);
|
package/methods/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { isDefined, isObject, isFunction, isObjectLike, isProduction, removeValueFromArray, deepClone } from '@domql/utils'
|
|
4
4
|
import { TREE } from '../tree'
|
|
5
|
-
import { parseFilters, registry } from '../mixins'
|
|
5
|
+
import { parseFilters, REGISTRY, registry } from '../mixins'
|
|
6
6
|
const ENV = process.env.NODE_ENV
|
|
7
7
|
|
|
8
8
|
// TODO: update these files
|
|
@@ -144,7 +144,7 @@ export function keys () {
|
|
|
144
144
|
const element = this
|
|
145
145
|
const keys = []
|
|
146
146
|
for (const param in element) {
|
|
147
|
-
if ((
|
|
147
|
+
if ((REGISTRY[param] && !parseFilters.elementKeys.includes(param)) || !Object.hasOwnProperty.call(element, param)) { continue }
|
|
148
148
|
keys.push(param)
|
|
149
149
|
}
|
|
150
150
|
return keys
|
package/methods/set.js
CHANGED
package/methods/v2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { isDefined, isFunction, isObjectLike } from '@domql/utils'
|
|
4
|
-
import { parseFilters,
|
|
4
|
+
import { parseFilters, REGISTRY } from '../mixins'
|
|
5
5
|
|
|
6
6
|
export const defineSetter = (element, key, get, set) =>
|
|
7
7
|
Object.defineProperty(element, key, { get, set })
|
|
@@ -10,7 +10,7 @@ export const keys = function () {
|
|
|
10
10
|
const element = this
|
|
11
11
|
const keys = []
|
|
12
12
|
for (const param in element) {
|
|
13
|
-
if (
|
|
13
|
+
if (REGISTRY[param] && !parseFilters.elementKeys.includes(param)) { continue }
|
|
14
14
|
keys.push(param)
|
|
15
15
|
}
|
|
16
16
|
return keys
|
package/mixins/attr.js
CHANGED
|
@@ -7,7 +7,7 @@ import { deepMerge } from '../utils'
|
|
|
7
7
|
/**
|
|
8
8
|
* Recursively add attributes to a DOM node
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export const attr = (params, element, node) => {
|
|
11
11
|
const { __ref } = element
|
|
12
12
|
const { __attr } = __ref
|
|
13
13
|
if (isNot('object')) report('HTMLInvalidAttr', params)
|
|
@@ -22,3 +22,5 @@ export default (params, element, node) => {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
export default attr
|
package/mixins/classList.js
CHANGED
|
@@ -43,6 +43,8 @@ export const applyClassListOnNode = (params, element, node) => {
|
|
|
43
43
|
return className
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export
|
|
46
|
+
export const applyClasslist = (params, element, node) => {
|
|
47
47
|
applyClassListOnNode(params, element, node)
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
export default applyClasslist
|
package/mixins/content.js
CHANGED
package/mixins/data.js
CHANGED
|
@@ -7,7 +7,7 @@ import { report } from '@domql/report'
|
|
|
7
7
|
* Apply data parameters on the DOM nodes
|
|
8
8
|
* this should only work if `showOnNode: true` is passed
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export const data = (params, element, node) => {
|
|
11
11
|
if (params) {
|
|
12
12
|
if (element.props.data) deepMerge(params, element.props.data)
|
|
13
13
|
if (params.showOnNode) {
|
|
@@ -22,3 +22,5 @@ export default (params, element, node) => {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
export default data
|
package/mixins/html.js
CHANGED
|
@@ -6,7 +6,7 @@ import { exec } from '@domql/utils'
|
|
|
6
6
|
* Appends raw HTML as content
|
|
7
7
|
* an original one as a child
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export const html = (param, element, node) => {
|
|
10
10
|
const prop = exec(param, element) || exec(element?.props?.html, element)
|
|
11
11
|
const { __ref } = element
|
|
12
12
|
if (prop !== __ref.__html) {
|
|
@@ -18,3 +18,5 @@ export default (param, element, node) => {
|
|
|
18
18
|
__ref.__html = prop
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
export default html
|
package/mixins/index.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import attr from './attr'
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import data from './data'
|
|
7
|
-
import html from './html'
|
|
8
|
-
import style from './style'
|
|
9
|
-
import text from './text'
|
|
10
|
-
import state from './state'
|
|
11
|
-
import scope from './scope'
|
|
12
|
-
import
|
|
3
|
+
import { attr } from './attr'
|
|
4
|
+
import { applyClasslist } from './classList'
|
|
5
|
+
import { setContent } from './content'
|
|
6
|
+
import { data } from './data'
|
|
7
|
+
import { html } from './html'
|
|
8
|
+
import { style } from './style'
|
|
9
|
+
import { text } from './text'
|
|
10
|
+
import { state } from './state'
|
|
11
|
+
import { scope } from './scope'
|
|
12
|
+
import { REGISTRY } from './registry'
|
|
13
|
+
|
|
14
|
+
export { REGISTRY as registry }
|
|
15
|
+
export { applyClasslist as classList }
|
|
16
|
+
export { setContent as content }
|
|
17
|
+
|
|
13
18
|
export {
|
|
14
19
|
attr,
|
|
15
|
-
classList,
|
|
16
|
-
content,
|
|
17
20
|
data,
|
|
18
21
|
style,
|
|
19
22
|
text,
|
|
20
23
|
html,
|
|
21
24
|
state,
|
|
22
|
-
scope
|
|
23
|
-
registry
|
|
25
|
+
scope
|
|
24
26
|
}
|
|
27
|
+
|
|
25
28
|
export * from './registry'
|
package/mixins/registry.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
text, scope
|
|
7
7
|
} from '.'
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export const REGISTRY = {
|
|
10
10
|
attr,
|
|
11
11
|
style,
|
|
12
12
|
text,
|
|
@@ -68,6 +68,8 @@ export default {
|
|
|
68
68
|
$setPropsCollection: {}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
export default REGISTRY
|
|
72
|
+
|
|
71
73
|
// List of keys for .parse() and .parseDeep() to include in the result.
|
|
72
74
|
// Keys not in the array are excluded.
|
|
73
75
|
export const parseFilters = {
|
package/mixins/scope.js
CHANGED
|
@@ -6,7 +6,7 @@ import { isFunction, isObject } from '@domql/utils'
|
|
|
6
6
|
* Apply data parameters on the DOM nodes
|
|
7
7
|
* this should only work if `showOnNode: true` is passed
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export const scope = (params, element, node) => {
|
|
10
10
|
if (!isObject(params)) return
|
|
11
11
|
|
|
12
12
|
// Apply data params on node
|
|
@@ -19,3 +19,5 @@ export default (params, element, node) => {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
export default scope
|
package/mixins/style.js
CHANGED
|
@@ -6,9 +6,11 @@ import { report } from '@domql/report'
|
|
|
6
6
|
/**
|
|
7
7
|
* Recursively add styles to a DOM node
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export const style = (params, element, node) => {
|
|
10
10
|
if (params) {
|
|
11
11
|
if (isObject(params)) map(node.style, params, element)
|
|
12
12
|
else report('HTMLInvalidStyles', params)
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
export default style
|
package/mixins/text.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
* Creates a text node and appends into
|
|
12
12
|
* an original one as a child
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export const text = (param, element, node) => {
|
|
15
15
|
let prop = exec(param, element)
|
|
16
16
|
if (isString(prop) && prop.includes('{{')) {
|
|
17
17
|
prop = replaceLiteralsWithObjectFields(prop, element.state)
|
|
@@ -26,3 +26,5 @@ export default (param, element, node) => {
|
|
|
26
26
|
} else create({ tag: 'string', text: prop }, element, '__text')
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
export default text
|
package/node.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
throughInitialDefine,
|
|
13
13
|
throughInitialExec
|
|
14
14
|
} from './iterate'
|
|
15
|
-
import { registry } from './mixins'
|
|
15
|
+
import { REGISTRY, registry } from './mixins'
|
|
16
16
|
import { applyParam } from './utils/applyParam'
|
|
17
17
|
import { propagateEventsFromProps } from './utils/propEvents'
|
|
18
18
|
// import { defineSetter } from './methods'
|
|
@@ -74,7 +74,7 @@ export const createNode = (element, options) => {
|
|
|
74
74
|
isUndefined(value) ||
|
|
75
75
|
isMethod(param, element) ||
|
|
76
76
|
isVariant(param) ||
|
|
77
|
-
isObject(
|
|
77
|
+
isObject(REGISTRY[param])
|
|
78
78
|
) continue
|
|
79
79
|
|
|
80
80
|
const isElement = applyParam(param, element, options)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.158",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@domql/state": "^2.5.156",
|
|
32
32
|
"@domql/utils": "^2.5.156"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "ac4c22e5e89db21110b79080a19a174cb7acef97",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/set.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { deepContains, setContentKey } from '@domql/utils'
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { OPTIONS } from './cache/options'
|
|
6
|
+
import { create } from './create'
|
|
7
7
|
import { registry } from './mixins'
|
|
8
8
|
import { removeContent } from './mixins/content'
|
|
9
9
|
import { triggerEventOn, triggerEventOnUpdate } from '@domql/event'
|
|
@@ -29,7 +29,7 @@ export const reset = (options) => {
|
|
|
29
29
|
})
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const set = function (params, options = {}, el) {
|
|
32
|
+
export const set = function (params, options = {}, el) {
|
|
33
33
|
const element = el || this
|
|
34
34
|
const { __ref: ref } = element
|
|
35
35
|
|
package/update.js
CHANGED
|
@@ -20,11 +20,11 @@ import { isMethod } from './methods'
|
|
|
20
20
|
import { updateProps } from './props'
|
|
21
21
|
import { createState, findInheritedState } from '@domql/state'
|
|
22
22
|
|
|
23
|
-
import create from './create'
|
|
23
|
+
import { create } from './create'
|
|
24
24
|
import { throughExecProps, throughUpdatedDefine, throughUpdatedExec } from './iterate'
|
|
25
|
-
import {
|
|
25
|
+
import { REGISTRY } from './mixins'
|
|
26
26
|
import { applyParam } from './utils/applyParam'
|
|
27
|
-
import OPTIONS from './cache/options'
|
|
27
|
+
import { OPTIONS } from './cache/options'
|
|
28
28
|
import { METHODS_EXL, deepClone, deepMerge } from './utils' // old utils (current)
|
|
29
29
|
|
|
30
30
|
const snapshot = {
|
|
@@ -40,7 +40,7 @@ const UPDATE_DEFAULT_OPTIONS = {
|
|
|
40
40
|
excludes: METHODS_EXL
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const update = function (params = {}, opts) {
|
|
43
|
+
export const update = function (params = {}, opts) {
|
|
44
44
|
const calleeElementCache = opts?.calleeElement
|
|
45
45
|
const options = deepClone(isObject(opts) ? deepMerge(opts, UPDATE_DEFAULT_OPTIONS) : UPDATE_DEFAULT_OPTIONS, ['calleeElement'])
|
|
46
46
|
options.calleeElement = calleeElementCache
|
|
@@ -128,7 +128,7 @@ const update = function (params = {}, opts) {
|
|
|
128
128
|
preventDefineUpdate === param ||
|
|
129
129
|
(preventContentUpdate && param === 'content' && !hasCollection) ||
|
|
130
130
|
(preventStateUpdate && param) === 'state' ||
|
|
131
|
-
isMethod(param, element) || isObject(
|
|
131
|
+
isMethod(param, element) || isObject(REGISTRY[param]) || isVariant(param)
|
|
132
132
|
) continue
|
|
133
133
|
|
|
134
134
|
if (preventStateUpdate === 'once') options.preventStateUpdate = false
|
package/utils/applyParam.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { isFunction } from '@domql/utils'
|
|
4
|
-
import {
|
|
4
|
+
import { REGISTRY } from '../mixins'
|
|
5
5
|
|
|
6
6
|
export const applyParam = (param, element, options) => {
|
|
7
7
|
const { node, context, __ref: ref } = element
|
|
@@ -9,7 +9,7 @@ export const applyParam = (param, element, options) => {
|
|
|
9
9
|
|
|
10
10
|
const { onlyUpdate } = options
|
|
11
11
|
|
|
12
|
-
const DOMQLProperty =
|
|
12
|
+
const DOMQLProperty = REGISTRY[param]
|
|
13
13
|
const DOMQLPropertyFromContext = context && context.registry && context.registry[param]
|
|
14
14
|
const isGlobalTransformer = DOMQLPropertyFromContext || DOMQLProperty
|
|
15
15
|
|
package/utils/component.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@domql/utils'
|
|
12
12
|
|
|
13
13
|
import { applyExtend } from '../extend'
|
|
14
|
-
import {
|
|
14
|
+
import { REGISTRY } from '../mixins'
|
|
15
15
|
|
|
16
16
|
const replaceOnKeys = key => key.replace(/on\w+/g, match => match.substring(2))
|
|
17
17
|
|
|
@@ -37,7 +37,7 @@ export const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const isComponent = checkIfKeyIsComponent(k)
|
|
40
|
-
const isRegistry =
|
|
40
|
+
const isRegistry = REGISTRY[k]
|
|
41
41
|
if (isComponent || isRegistry) {
|
|
42
42
|
newElem[k] = prop
|
|
43
43
|
} else {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { exec, isFunction, isObject, isUndefined } from '@domql/utils'
|
|
4
4
|
import { create } from '..'
|
|
5
|
-
import {
|
|
5
|
+
import { REGISTRY } from '../mixins'
|
|
6
6
|
import { applyVariant, isVariant } from '.'
|
|
7
7
|
import { isMethod } from '../methods'
|
|
8
8
|
import { addMethods } from '../methods/set'
|
|
@@ -82,7 +82,7 @@ export const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
82
82
|
if (
|
|
83
83
|
isUndefined(prop) ||
|
|
84
84
|
isMethod(param, element) ||
|
|
85
|
-
isObject(
|
|
85
|
+
isObject(REGISTRY[param]) ||
|
|
86
86
|
isVariant(param)
|
|
87
87
|
) continue
|
|
88
88
|
|
|
@@ -91,7 +91,7 @@ export const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
91
91
|
element.context.define[param]
|
|
92
92
|
const optionsHasDefine = options.define && options.define[param]
|
|
93
93
|
|
|
94
|
-
if (
|
|
94
|
+
if (REGISTRY[param] && !optionsHasDefine) {
|
|
95
95
|
continue
|
|
96
96
|
} else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
97
97
|
create(exec(prop, element), element, param, options)
|