@domql/element 2.4.1 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cache/index.js +24 -0
- package/dist/cjs/cache/options.js +24 -0
- package/dist/cjs/methods/index.js +186 -0
- package/dist/cjs/methods/set.js +58 -0
- package/dist/cjs/methods/v2.js +109 -0
- package/dist/cjs/mixins/attr.js +42 -0
- package/dist/cjs/mixins/classList.js +73 -0
- package/dist/cjs/mixins/content.js +75 -0
- package/dist/cjs/mixins/data.js +36 -0
- package/dist/cjs/mixins/html.js +35 -0
- package/dist/cjs/mixins/index.js +52 -0
- package/dist/cjs/mixins/registry.js +89 -0
- package/dist/cjs/mixins/state.js +40 -0
- package/dist/cjs/mixins/style.js +33 -0
- package/dist/cjs/mixins/text.js +60 -0
- package/dist/cjs/props/create.js +77 -0
- package/dist/cjs/props/ignore.js +24 -0
- package/dist/cjs/props/index.js +21 -0
- package/dist/cjs/props/inherit.js +52 -0
- package/dist/cjs/props/update.js +37 -0
- package/dist/cjs/test/create.test.js +51 -0
- package/dist/cjs/test/set.test.js +9 -0
- package/dist/cjs/test/update.test.js +8 -0
- package/dist/cjs/utils/component.js +133 -0
- package/dist/cjs/utils/extendUtils.js +144 -0
- package/dist/cjs/utils/index.js +20 -0
- package/dist/cjs/utils/object.js +142 -0
- package/package.json +4 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var cache_exports = {};
|
|
20
|
+
__export(cache_exports, {
|
|
21
|
+
cache: () => cache
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(cache_exports);
|
|
24
|
+
const cache = {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var options_exports = {};
|
|
20
|
+
__export(options_exports, {
|
|
21
|
+
default: () => options_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(options_exports);
|
|
24
|
+
var options_default = {};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var methods_exports = {};
|
|
20
|
+
__export(methods_exports, {
|
|
21
|
+
METHODS: () => METHODS,
|
|
22
|
+
defineSetter: () => defineSetter,
|
|
23
|
+
get: () => get,
|
|
24
|
+
isMethod: () => isMethod,
|
|
25
|
+
keys: () => keys,
|
|
26
|
+
log: () => log,
|
|
27
|
+
lookup: () => lookup,
|
|
28
|
+
nextElement: () => nextElement,
|
|
29
|
+
parse: () => parse,
|
|
30
|
+
parseDeep: () => parseDeep,
|
|
31
|
+
previousElement: () => previousElement,
|
|
32
|
+
remove: () => remove,
|
|
33
|
+
setProps: () => setProps,
|
|
34
|
+
spotByPath: () => spotByPath
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(methods_exports);
|
|
37
|
+
var import_utils = require("@domql/utils");
|
|
38
|
+
var import_tree = require("../tree");
|
|
39
|
+
var import_mixins = require("../mixins");
|
|
40
|
+
const spotByPath = function(path) {
|
|
41
|
+
const element = this;
|
|
42
|
+
const arr = [].concat(path);
|
|
43
|
+
let active = import_tree.TREE[arr[0]];
|
|
44
|
+
if (!arr || !arr.length)
|
|
45
|
+
return console.log(arr, "on", element.key, "is undefined");
|
|
46
|
+
while (active.key === arr[0]) {
|
|
47
|
+
arr.shift();
|
|
48
|
+
if (!arr.length)
|
|
49
|
+
break;
|
|
50
|
+
active = active[arr[0]];
|
|
51
|
+
if (!active)
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return active;
|
|
55
|
+
};
|
|
56
|
+
const lookup = function(key) {
|
|
57
|
+
const element = this;
|
|
58
|
+
let { parent } = element;
|
|
59
|
+
while (parent.key !== key) {
|
|
60
|
+
if (parent[key])
|
|
61
|
+
return parent[key];
|
|
62
|
+
parent = parent.parent;
|
|
63
|
+
if (!parent)
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
return parent;
|
|
67
|
+
};
|
|
68
|
+
const remove = function(params) {
|
|
69
|
+
const element = this;
|
|
70
|
+
if ((0, import_utils.isFunction)(element.node.remove))
|
|
71
|
+
element.node.remove();
|
|
72
|
+
else if (!(0, import_utils.isProduction)()) {
|
|
73
|
+
console.warn("This item cant be removed");
|
|
74
|
+
element.log();
|
|
75
|
+
}
|
|
76
|
+
delete element.parent[element.key];
|
|
77
|
+
};
|
|
78
|
+
const get = function(param) {
|
|
79
|
+
const element = this;
|
|
80
|
+
return element[param];
|
|
81
|
+
};
|
|
82
|
+
const setProps = function(param, options) {
|
|
83
|
+
const element = this;
|
|
84
|
+
if (!param || !element.props)
|
|
85
|
+
return;
|
|
86
|
+
element.update({ props: param }, options);
|
|
87
|
+
return element;
|
|
88
|
+
};
|
|
89
|
+
const defineSetter = (element, key, get2, set) => Object.defineProperty(element, key, { get: get2, set });
|
|
90
|
+
const keys = function() {
|
|
91
|
+
const element = this;
|
|
92
|
+
const keys2 = [];
|
|
93
|
+
for (const param in element) {
|
|
94
|
+
if (import_mixins.registry[param] && !import_mixins.parseFilters.elementKeys.includes(param)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
keys2.push(param);
|
|
98
|
+
}
|
|
99
|
+
return keys2;
|
|
100
|
+
};
|
|
101
|
+
const parse = function(excl = []) {
|
|
102
|
+
const element = this;
|
|
103
|
+
const obj = {};
|
|
104
|
+
const keyList = keys.call(element);
|
|
105
|
+
keyList.forEach((v) => {
|
|
106
|
+
if (excl.includes(v))
|
|
107
|
+
return;
|
|
108
|
+
let val = element[v];
|
|
109
|
+
if (v === "state") {
|
|
110
|
+
if (element.__ref && element.__ref.__hasRootState)
|
|
111
|
+
return;
|
|
112
|
+
if ((0, import_utils.isFunction)(val && val.parse))
|
|
113
|
+
val = val.parse();
|
|
114
|
+
} else if (v === "props") {
|
|
115
|
+
const { __element, update, ...props } = element[v];
|
|
116
|
+
obj[v] = props;
|
|
117
|
+
} else if ((0, import_utils.isDefined)(val))
|
|
118
|
+
obj[v] = val;
|
|
119
|
+
});
|
|
120
|
+
return obj;
|
|
121
|
+
};
|
|
122
|
+
const parseDeep = function(excl = []) {
|
|
123
|
+
const element = this;
|
|
124
|
+
const obj = parse.call(element, excl);
|
|
125
|
+
for (const v in obj) {
|
|
126
|
+
if (excl.includes(v))
|
|
127
|
+
return;
|
|
128
|
+
if ((0, import_utils.isObjectLike)(obj[v])) {
|
|
129
|
+
obj[v] = parseDeep.call(obj[v], excl);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return obj;
|
|
133
|
+
};
|
|
134
|
+
const log = function(...args) {
|
|
135
|
+
const element = this;
|
|
136
|
+
const { __ref } = element;
|
|
137
|
+
console.group(element.key);
|
|
138
|
+
if (args.length) {
|
|
139
|
+
args.forEach((v) => console.log(`%c${v}:
|
|
140
|
+
`, "font-weight: bold", element[v]));
|
|
141
|
+
} else {
|
|
142
|
+
console.log(__ref.path);
|
|
143
|
+
const keys2 = element.keys();
|
|
144
|
+
keys2.forEach((v) => console.log(`%c${v}:
|
|
145
|
+
`, "font-weight: bold", element[v]));
|
|
146
|
+
}
|
|
147
|
+
console.groupEnd(element.key);
|
|
148
|
+
return element;
|
|
149
|
+
};
|
|
150
|
+
const nextElement = function() {
|
|
151
|
+
const element = this;
|
|
152
|
+
const { key, parent } = element;
|
|
153
|
+
const { __children } = parent.__ref;
|
|
154
|
+
const currentIndex = __children.indexOf(key);
|
|
155
|
+
const nextChild = __children[currentIndex + 1];
|
|
156
|
+
return parent[nextChild];
|
|
157
|
+
};
|
|
158
|
+
const previousElement = function(el) {
|
|
159
|
+
const element = el || this;
|
|
160
|
+
const { key, parent } = element;
|
|
161
|
+
const { __children } = parent.__ref;
|
|
162
|
+
if (!__children)
|
|
163
|
+
return;
|
|
164
|
+
const currentIndex = __children.indexOf(key);
|
|
165
|
+
return parent[__children[currentIndex - 1]];
|
|
166
|
+
};
|
|
167
|
+
const METHODS = [
|
|
168
|
+
"set",
|
|
169
|
+
"update",
|
|
170
|
+
"remove",
|
|
171
|
+
"updateContent",
|
|
172
|
+
"removeContent",
|
|
173
|
+
"lookup",
|
|
174
|
+
"spotByPath",
|
|
175
|
+
"keys",
|
|
176
|
+
"parse",
|
|
177
|
+
"setProps",
|
|
178
|
+
"parseDeep",
|
|
179
|
+
"if",
|
|
180
|
+
"log",
|
|
181
|
+
"nextElement",
|
|
182
|
+
"previousElement"
|
|
183
|
+
];
|
|
184
|
+
const isMethod = function(param) {
|
|
185
|
+
return METHODS.includes(param);
|
|
186
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var set_exports = {};
|
|
30
|
+
__export(set_exports, {
|
|
31
|
+
addMethods: () => addMethods
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(set_exports);
|
|
34
|
+
var import_utils = require("@domql/utils");
|
|
35
|
+
var import_set = __toESM(require("../set"), 1);
|
|
36
|
+
var import_update = __toESM(require("../update"), 1);
|
|
37
|
+
var import__ = require("./");
|
|
38
|
+
var import_content = require("../mixins/content");
|
|
39
|
+
const addMethods = (element, parent) => {
|
|
40
|
+
const proto = {
|
|
41
|
+
set: import_set.default.bind(element),
|
|
42
|
+
update: import_update.default.bind(element),
|
|
43
|
+
remove: import__.remove.bind(element),
|
|
44
|
+
updateContent: import_content.updateContent.bind(element),
|
|
45
|
+
removeContent: import_content.removeContent.bind(element),
|
|
46
|
+
setProps: import__.setProps.bind(element),
|
|
47
|
+
lookup: import__.lookup.bind(element),
|
|
48
|
+
spotByPath: import__.spotByPath.bind(element),
|
|
49
|
+
parse: import__.parse.bind(element),
|
|
50
|
+
parseDeep: import__.parseDeep.bind(element),
|
|
51
|
+
keys: import__.keys.bind(element),
|
|
52
|
+
nextElement: import__.nextElement.bind(element),
|
|
53
|
+
previousElement: import__.previousElement.bind(element)
|
|
54
|
+
};
|
|
55
|
+
if ((0, import_utils.isDevelopment)())
|
|
56
|
+
proto.log = import__.log.bind(element);
|
|
57
|
+
Object.setPrototypeOf(element, proto);
|
|
58
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var v2_exports = {};
|
|
20
|
+
__export(v2_exports, {
|
|
21
|
+
defineSetter: () => defineSetter,
|
|
22
|
+
keys: () => keys,
|
|
23
|
+
log: () => log,
|
|
24
|
+
nextElement: () => nextElement,
|
|
25
|
+
parse: () => parse,
|
|
26
|
+
parseDeep: () => parseDeep,
|
|
27
|
+
previousElement: () => previousElement
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(v2_exports);
|
|
30
|
+
var import_utils = require("@domql/utils");
|
|
31
|
+
var import_mixins = require("../mixins");
|
|
32
|
+
const defineSetter = (element, key, get, set) => Object.defineProperty(element, key, { get, set });
|
|
33
|
+
const keys = function() {
|
|
34
|
+
const element = this;
|
|
35
|
+
const keys2 = [];
|
|
36
|
+
for (const param in element) {
|
|
37
|
+
if (import_mixins.registry[param] && !import_mixins.parseFilters.elementKeys.includes(param)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
keys2.push(param);
|
|
41
|
+
}
|
|
42
|
+
return keys2;
|
|
43
|
+
};
|
|
44
|
+
const parse = function(excl = []) {
|
|
45
|
+
const element = this;
|
|
46
|
+
const obj = {};
|
|
47
|
+
const keyList = keys.call(element);
|
|
48
|
+
keyList.forEach((v) => {
|
|
49
|
+
if (excl.includes(v))
|
|
50
|
+
return;
|
|
51
|
+
let val = element[v];
|
|
52
|
+
if (v === "state") {
|
|
53
|
+
if (element.__ref && element.__ref.__hasRootState)
|
|
54
|
+
return;
|
|
55
|
+
if ((0, import_utils.isFunction)(val && val.parse))
|
|
56
|
+
val = val.parse();
|
|
57
|
+
} else if (v === "props") {
|
|
58
|
+
const { __element, update, ...props } = element[v];
|
|
59
|
+
obj[v] = props;
|
|
60
|
+
} else if ((0, import_utils.isDefined)(val))
|
|
61
|
+
obj[v] = val;
|
|
62
|
+
});
|
|
63
|
+
return obj;
|
|
64
|
+
};
|
|
65
|
+
const parseDeep = function(excl = []) {
|
|
66
|
+
const element = this;
|
|
67
|
+
const obj = parse.call(element, excl);
|
|
68
|
+
for (const v in obj) {
|
|
69
|
+
if (excl.includes(v))
|
|
70
|
+
return;
|
|
71
|
+
if ((0, import_utils.isObjectLike)(obj[v])) {
|
|
72
|
+
obj[v] = parseDeep.call(obj[v], excl);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return obj;
|
|
76
|
+
};
|
|
77
|
+
const log = function(...args) {
|
|
78
|
+
const element = this;
|
|
79
|
+
const { __ref } = element;
|
|
80
|
+
console.group(element.key);
|
|
81
|
+
if (args.length) {
|
|
82
|
+
args.forEach((v) => console.log(`%c${v}:
|
|
83
|
+
`, "font-weight: bold", element[v]));
|
|
84
|
+
} else {
|
|
85
|
+
console.log(__ref.path);
|
|
86
|
+
const keys2 = element.keys();
|
|
87
|
+
keys2.forEach((v) => console.log(`%c${v}:
|
|
88
|
+
`, "font-weight: bold", element[v]));
|
|
89
|
+
}
|
|
90
|
+
console.groupEnd(element.key);
|
|
91
|
+
return element;
|
|
92
|
+
};
|
|
93
|
+
const nextElement = function() {
|
|
94
|
+
const element = this;
|
|
95
|
+
const { key, parent } = element;
|
|
96
|
+
const { __children } = parent.__ref;
|
|
97
|
+
const currentIndex = __children.indexOf(key);
|
|
98
|
+
const nextChild = __children[currentIndex + 1];
|
|
99
|
+
return parent[nextChild];
|
|
100
|
+
};
|
|
101
|
+
const previousElement = function(el) {
|
|
102
|
+
const element = el || this;
|
|
103
|
+
const { key, parent } = element;
|
|
104
|
+
const { __children } = parent.__ref;
|
|
105
|
+
if (!__children)
|
|
106
|
+
return;
|
|
107
|
+
const currentIndex = __children.indexOf(key);
|
|
108
|
+
return parent[__children[currentIndex - 1]];
|
|
109
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var attr_exports = {};
|
|
20
|
+
__export(attr_exports, {
|
|
21
|
+
default: () => attr_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(attr_exports);
|
|
24
|
+
var import_utils = require("@domql/utils");
|
|
25
|
+
var import_report = require("@domql/report");
|
|
26
|
+
var attr_default = (params, element, node) => {
|
|
27
|
+
const { __ref } = element;
|
|
28
|
+
const { __attr } = __ref;
|
|
29
|
+
if ((0, import_utils.isNot)("object"))
|
|
30
|
+
(0, import_report.report)("HTMLInvalidAttr", params);
|
|
31
|
+
if (params) {
|
|
32
|
+
for (const attr in params) {
|
|
33
|
+
const val = (0, import_utils.exec)(params[attr], element);
|
|
34
|
+
if (val && node.setAttribute)
|
|
35
|
+
node.setAttribute(attr, val);
|
|
36
|
+
else if (node.removeAttribute)
|
|
37
|
+
node.removeAttribute(attr);
|
|
38
|
+
__attr[attr] = val;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
console.groupEnd(params, __attr);
|
|
42
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var classList_exports = {};
|
|
20
|
+
__export(classList_exports, {
|
|
21
|
+
applyClassListOnNode: () => applyClassListOnNode,
|
|
22
|
+
assignClass: () => assignClass,
|
|
23
|
+
classList: () => classList,
|
|
24
|
+
classify: () => classify,
|
|
25
|
+
default: () => classList_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(classList_exports);
|
|
28
|
+
var import_utils = require("@domql/utils");
|
|
29
|
+
const assignClass = (element) => {
|
|
30
|
+
const { key } = element;
|
|
31
|
+
if (element.class === true)
|
|
32
|
+
element.class = key;
|
|
33
|
+
else if (!element.class && typeof key === "string" && key.charAt(0) === "_" && key.charAt(1) !== "_") {
|
|
34
|
+
element.class = key.slice(1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const classify = (obj, element) => {
|
|
38
|
+
let className = "";
|
|
39
|
+
for (const item in obj) {
|
|
40
|
+
const param = obj[item];
|
|
41
|
+
if (typeof param === "boolean" && param)
|
|
42
|
+
className += ` ${item}`;
|
|
43
|
+
else if (typeof param === "string")
|
|
44
|
+
className += ` ${param}`;
|
|
45
|
+
else if (typeof param === "function") {
|
|
46
|
+
className += ` ${(0, import_utils.exec)(param, element)}`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return className;
|
|
50
|
+
};
|
|
51
|
+
const classList = (params, element) => {
|
|
52
|
+
if (!params)
|
|
53
|
+
return;
|
|
54
|
+
const { key } = element;
|
|
55
|
+
if (params === true)
|
|
56
|
+
params = element.class = { key };
|
|
57
|
+
if ((0, import_utils.isString)(params))
|
|
58
|
+
params = element.class = { default: params };
|
|
59
|
+
if ((0, import_utils.isObject)(params))
|
|
60
|
+
params = classify(params, element);
|
|
61
|
+
const className = params.replace(/\s+/g, " ").trim();
|
|
62
|
+
if (element.ref)
|
|
63
|
+
element.ref.class = className;
|
|
64
|
+
return className;
|
|
65
|
+
};
|
|
66
|
+
const applyClassListOnNode = (params, element, node) => {
|
|
67
|
+
const className = classList(params, element);
|
|
68
|
+
node.classList = className;
|
|
69
|
+
return className;
|
|
70
|
+
};
|
|
71
|
+
var classList_default = (params, element, node) => {
|
|
72
|
+
applyClassListOnNode(params, element, node);
|
|
73
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var content_exports = {};
|
|
30
|
+
__export(content_exports, {
|
|
31
|
+
default: () => content_default,
|
|
32
|
+
removeContent: () => removeContent,
|
|
33
|
+
setContent: () => setContent,
|
|
34
|
+
updateContent: () => updateContent
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(content_exports);
|
|
37
|
+
var import_utils = require("@domql/utils");
|
|
38
|
+
var import_set = __toESM(require("../set"), 1);
|
|
39
|
+
const updateContent = function(params, options) {
|
|
40
|
+
const element = this;
|
|
41
|
+
if (!element.content)
|
|
42
|
+
return;
|
|
43
|
+
if (element.content.update)
|
|
44
|
+
element.content.update(params, options);
|
|
45
|
+
};
|
|
46
|
+
const removeContent = function(el) {
|
|
47
|
+
const element = el || this;
|
|
48
|
+
const { __ref } = element;
|
|
49
|
+
if (element.content) {
|
|
50
|
+
if (element.content.node) {
|
|
51
|
+
if (element.content.tag === "fragment")
|
|
52
|
+
element.node.innerHTML = "";
|
|
53
|
+
else
|
|
54
|
+
element.node.removeChild(element.content.node);
|
|
55
|
+
}
|
|
56
|
+
const { __cached } = __ref;
|
|
57
|
+
if (__cached && __cached.content) {
|
|
58
|
+
if (__cached.content.tag === "fragment")
|
|
59
|
+
__cached.content.parent.node.innerHTML = "";
|
|
60
|
+
else if (__cached.content && (0, import_utils.isFunction)(__cached.content.remove))
|
|
61
|
+
__cached.content.remove();
|
|
62
|
+
}
|
|
63
|
+
delete element.content;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const setContent = (param, element, node, options) => {
|
|
67
|
+
if (param && element) {
|
|
68
|
+
if (element.content.update) {
|
|
69
|
+
element.content.update({}, options);
|
|
70
|
+
} else {
|
|
71
|
+
import_set.default.call(element, param, options);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var content_default = setContent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var data_exports = {};
|
|
20
|
+
__export(data_exports, {
|
|
21
|
+
default: () => data_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(data_exports);
|
|
24
|
+
var import_utils = require("@domql/utils");
|
|
25
|
+
var import_report = require("@domql/report");
|
|
26
|
+
var data_default = (params, element, node) => {
|
|
27
|
+
if (params && params.showOnNode) {
|
|
28
|
+
if (!(0, import_utils.isObject)(params))
|
|
29
|
+
(0, import_report.report)("HTMLInvalidData", params);
|
|
30
|
+
for (const dataset in params) {
|
|
31
|
+
if (dataset !== "showOnNode") {
|
|
32
|
+
node.dataset[dataset] = (0, import_utils.exec)(params[dataset], element);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var html_exports = {};
|
|
20
|
+
__export(html_exports, {
|
|
21
|
+
default: () => html_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(html_exports);
|
|
24
|
+
var import_utils = require("@domql/utils");
|
|
25
|
+
var html_default = (param, element, node) => {
|
|
26
|
+
const prop = (0, import_utils.exec)(param, element);
|
|
27
|
+
const { __ref } = element;
|
|
28
|
+
if (prop !== __ref.__html) {
|
|
29
|
+
if (node.nodeName === "SVG")
|
|
30
|
+
node.textContent = prop;
|
|
31
|
+
else
|
|
32
|
+
node.innerHTML = prop;
|
|
33
|
+
__ref.__html = prop;
|
|
34
|
+
}
|
|
35
|
+
};
|