@domql/element 2.5.100 → 2.5.101
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/methods/index.js +20 -0
- package/dist/cjs/methods/set.js +1 -0
- package/dist/cjs/mixins/registry.js +1 -0
- package/methods/index.js +21 -0
- package/methods/set.js +2 -0
- package/mixins/registry.js +1 -0
- package/package.json +2 -2
|
@@ -25,6 +25,7 @@ __export(methods_exports, {
|
|
|
25
25
|
keys: () => keys,
|
|
26
26
|
log: () => log,
|
|
27
27
|
lookdown: () => lookdown,
|
|
28
|
+
lookdownAll: () => lookdownAll,
|
|
28
29
|
lookup: () => lookup,
|
|
29
30
|
nextElement: () => nextElement,
|
|
30
31
|
parse: () => parse,
|
|
@@ -95,6 +96,24 @@ const lookdown = function(param) {
|
|
|
95
96
|
}
|
|
96
97
|
return null;
|
|
97
98
|
};
|
|
99
|
+
const lookdownAll = function(param, results = []) {
|
|
100
|
+
const el = this;
|
|
101
|
+
const { __ref: ref } = el;
|
|
102
|
+
const children = ref.__children;
|
|
103
|
+
for (let i = 0; i < children.length; i++) {
|
|
104
|
+
const v = children[i];
|
|
105
|
+
const childElem = el[v];
|
|
106
|
+
if (v === param)
|
|
107
|
+
results.push(childElem);
|
|
108
|
+
else if ((0, import_utils.isFunction)(param)) {
|
|
109
|
+
const exec = param(childElem, childElem.state, childElem.context);
|
|
110
|
+
if (childElem.state && exec)
|
|
111
|
+
results.push(childElem);
|
|
112
|
+
}
|
|
113
|
+
childElem == null ? void 0 : childElem.lookdownAll(param, results);
|
|
114
|
+
}
|
|
115
|
+
return results.length ? results : null;
|
|
116
|
+
};
|
|
98
117
|
const remove = function() {
|
|
99
118
|
const element = this;
|
|
100
119
|
if ((0, import_utils.isFunction)(element.node.remove))
|
|
@@ -206,6 +225,7 @@ const METHODS = [
|
|
|
206
225
|
"removeContent",
|
|
207
226
|
"lookup",
|
|
208
227
|
"lookdown",
|
|
228
|
+
"lookdownAll",
|
|
209
229
|
"spotByPath",
|
|
210
230
|
"keys",
|
|
211
231
|
"parse",
|
package/dist/cjs/methods/set.js
CHANGED
|
@@ -46,6 +46,7 @@ const addMethods = (element, parent) => {
|
|
|
46
46
|
setProps: import__.setProps.bind(element),
|
|
47
47
|
lookup: import__.lookup.bind(element),
|
|
48
48
|
lookdown: import__.lookdown.bind(element),
|
|
49
|
+
lookdownAll: import__.lookdownAll.bind(element),
|
|
49
50
|
spotByPath: import__.spotByPath.bind(element),
|
|
50
51
|
parse: import__.parse.bind(element),
|
|
51
52
|
parseDeep: import__.parseDeep.bind(element),
|
package/methods/index.js
CHANGED
|
@@ -65,6 +65,26 @@ export const lookdown = function (param) {
|
|
|
65
65
|
return null
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
export const lookdownAll = function (param, results = []) {
|
|
69
|
+
const el = this
|
|
70
|
+
const { __ref: ref } = el
|
|
71
|
+
const children = ref.__children
|
|
72
|
+
|
|
73
|
+
for (let i = 0; i < children.length; i++) {
|
|
74
|
+
const v = children[i]
|
|
75
|
+
const childElem = el[v]
|
|
76
|
+
|
|
77
|
+
if (v === param) results.push(childElem)
|
|
78
|
+
else if (isFunction(param)) {
|
|
79
|
+
const exec = param(childElem, childElem.state, childElem.context)
|
|
80
|
+
if (childElem.state && exec) results.push(childElem)
|
|
81
|
+
}
|
|
82
|
+
childElem?.lookdownAll(param, results)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return results.length ? results : null
|
|
86
|
+
}
|
|
87
|
+
|
|
68
88
|
export const remove = function () {
|
|
69
89
|
const element = this
|
|
70
90
|
if (isFunction(element.node.remove)) element.node.remove()
|
|
@@ -183,6 +203,7 @@ export const METHODS = [
|
|
|
183
203
|
'removeContent',
|
|
184
204
|
'lookup',
|
|
185
205
|
'lookdown',
|
|
206
|
+
'lookdownAll',
|
|
186
207
|
'spotByPath',
|
|
187
208
|
'keys',
|
|
188
209
|
'parse',
|
package/methods/set.js
CHANGED
|
@@ -8,6 +8,7 @@ import update from '../update'
|
|
|
8
8
|
import {
|
|
9
9
|
lookup,
|
|
10
10
|
lookdown,
|
|
11
|
+
lookdownAll,
|
|
11
12
|
setProps,
|
|
12
13
|
remove,
|
|
13
14
|
spotByPath,
|
|
@@ -31,6 +32,7 @@ export const addMethods = (element, parent) => {
|
|
|
31
32
|
setProps: setProps.bind(element),
|
|
32
33
|
lookup: lookup.bind(element),
|
|
33
34
|
lookdown: lookdown.bind(element),
|
|
35
|
+
lookdownAll: lookdownAll.bind(element),
|
|
34
36
|
spotByPath: spotByPath.bind(element),
|
|
35
37
|
parse: parse.bind(element),
|
|
36
38
|
parseDeep: parseDeep.bind(element),
|
package/mixins/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.101",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@domql/state": "latest",
|
|
32
32
|
"@domql/utils": "latest"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "5a5e8988f25e9a77e44596d9fd23e8a00b725685",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|