@domql/element 2.5.157 → 2.5.159
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 +2 -2
- package/dist/cjs/cache/options.js +3 -1
- package/dist/cjs/create.js +6 -5
- package/dist/cjs/methods/set.js +4 -14
- 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/scope.js +4 -2
- package/dist/cjs/mixins/style.js +4 -2
- package/dist/cjs/mixins/text.js +4 -2
- package/dist/cjs/set.js +8 -17
- package/dist/cjs/update.js +5 -14
- package/methods/set.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/scope.js +3 -1
- package/mixins/style.js +3 -1
- package/mixins/text.js +3 -1
- package/package.json +6 -6
- package/set.js +3 -3
- package/update.js +3 -3
package/cache/options.js
CHANGED
package/create.js
CHANGED
|
@@ -34,7 +34,7 @@ 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
|
|
@@ -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) => {
|
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/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);
|
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/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
|
|
@@ -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
|
}
|
package/methods/set.js
CHANGED
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/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.159",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@domql/event": "^2.5.
|
|
30
|
-
"@domql/render": "^2.5.
|
|
31
|
-
"@domql/state": "^2.5.
|
|
32
|
-
"@domql/utils": "^2.5.
|
|
29
|
+
"@domql/event": "^2.5.159",
|
|
30
|
+
"@domql/render": "^2.5.159",
|
|
31
|
+
"@domql/state": "^2.5.159",
|
|
32
|
+
"@domql/utils": "^2.5.159"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "7595b1077d3096c3ee7b1da5eef02aa9248f2ed6",
|
|
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
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
|