@dooboostore/simple-web-component 1.0.44 → 1.0.45
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/README.md +25 -25
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +36 -15
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +53 -22
- package/dist/cjs/decorators/applyClass.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +51 -23
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +38 -17
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +53 -22
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +44 -25
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/emitCustomEvent.js +61 -47
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/query.js +91 -56
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +104 -66
- package/dist/cjs/decorators/queryAll.js.map +2 -2
- package/dist/cjs/types/window.d.js.map +1 -1
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +36 -15
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +53 -22
- package/dist/esm/decorators/applyClass.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +51 -23
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +38 -17
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +53 -22
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +44 -25
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js +61 -47
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/query.js +91 -56
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +104 -66
- package/dist/esm/decorators/queryAll.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +531 -293
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
- package/dist/types/decorators/addEventListener.d.ts +7 -6
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +12 -8
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +8 -7
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +18 -17
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +13 -9
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +6 -5
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +3 -2
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +15 -5
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +15 -5
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +531 -293
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
- package/package.json +3 -3
- package/src/decorators/addEventListener.ts +9 -7
- package/src/decorators/applyAttribute.ts +59 -27
- package/src/decorators/applyClass.ts +78 -32
- package/src/decorators/applyNode.ts +115 -72
- package/src/decorators/applyProperty.ts +62 -30
- package/src/decorators/applyStyle.ts +76 -30
- package/src/decorators/elementDefine.ts +49 -26
- package/src/decorators/emitCustomEvent.ts +63 -39
- package/src/decorators/query.ts +111 -49
- package/src/decorators/queryAll.ts +121 -61
- package/src/types/window.d.ts +3 -0
|
@@ -44,6 +44,26 @@ var import_Utils = require("../utils/Utils");
|
|
|
44
44
|
var import_state = require("./state");
|
|
45
45
|
var import_core_web = require("@dooboostore/core-web");
|
|
46
46
|
const APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
|
|
47
|
+
const resolveSelector = (selector, inst, win) => {
|
|
48
|
+
if (typeof selector === "function") {
|
|
49
|
+
const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, inst);
|
|
50
|
+
const result = selector(inst, hostSet);
|
|
51
|
+
if (result instanceof win.Element) {
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
if (result instanceof win.NodeList) {
|
|
55
|
+
return result.length > 0 ? result[0] : null;
|
|
56
|
+
}
|
|
57
|
+
if (Array.isArray(result)) {
|
|
58
|
+
return result.length > 0 ? result[0] : null;
|
|
59
|
+
}
|
|
60
|
+
if (result === null) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
return selector;
|
|
66
|
+
};
|
|
47
67
|
const applyToDom = (currentThis, targetEl, res, pos, win, host) => {
|
|
48
68
|
if (!targetEl) return;
|
|
49
69
|
if (pos === "clearChildren") {
|
|
@@ -88,7 +108,7 @@ const applyToDom = (currentThis, targetEl, res, pos, win, host) => {
|
|
|
88
108
|
function applyNode(selectorOrOptions, maybeOptions) {
|
|
89
109
|
let selector;
|
|
90
110
|
let options;
|
|
91
|
-
if (typeof selectorOrOptions === "string") {
|
|
111
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
92
112
|
selector = selectorOrOptions;
|
|
93
113
|
options = maybeOptions || { position: "replaceChildren" };
|
|
94
114
|
} else {
|
|
@@ -120,14 +140,22 @@ function applyNode(selectorOrOptions, maybeOptions) {
|
|
|
120
140
|
if (r === "all") return t.shadowRoot || t;
|
|
121
141
|
return t;
|
|
122
142
|
};
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
|
|
143
|
+
const resolved = resolveSelector(selector, this, currentWin);
|
|
144
|
+
if (resolved instanceof currentWin.Element) {
|
|
145
|
+
return applyRoot(resolved);
|
|
146
|
+
}
|
|
147
|
+
if (resolved === null) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const stringSelector = resolved;
|
|
151
|
+
if (stringSelector === "$this") return applyRoot(this);
|
|
152
|
+
if (stringSelector === "$host") return applyRoot(hostSet.$host);
|
|
153
|
+
if (stringSelector === "$parentHost") return applyRoot(hostSet.$parentHost);
|
|
154
|
+
if (stringSelector === "$appHost") return applyRoot(hostSet.$appHost);
|
|
155
|
+
if (stringSelector === "$firstHost") return applyRoot(hostSet.$firstHost);
|
|
156
|
+
if (stringSelector === "$lastHost") return applyRoot(hostSet.$lastHost);
|
|
129
157
|
const targetRoot = applyRoot(this);
|
|
130
|
-
return targetRoot ? targetRoot.querySelector(
|
|
158
|
+
return targetRoot ? targetRoot.querySelector(stringSelector) : null;
|
|
131
159
|
};
|
|
132
160
|
const targetEl = getTarget();
|
|
133
161
|
const res = original.apply(this, args);
|
|
@@ -169,7 +197,7 @@ function replaceChildren(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
169
197
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
170
198
|
return applyNode({ position: "replaceChildren" })(selectorOrOptions, maybeOptions, descriptor);
|
|
171
199
|
}
|
|
172
|
-
if (typeof selectorOrOptions === "string") {
|
|
200
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
173
201
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "replaceChildren" });
|
|
174
202
|
}
|
|
175
203
|
return applyNode({ ...selectorOrOptions, position: "replaceChildren" });
|
|
@@ -178,7 +206,7 @@ function clearChildrenNode(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
178
206
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
179
207
|
return applyNode({ position: "clearChildren" })(selectorOrOptions, maybeOptions, descriptor);
|
|
180
208
|
}
|
|
181
|
-
if (typeof selectorOrOptions === "string") {
|
|
209
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
182
210
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "clearChildren" });
|
|
183
211
|
}
|
|
184
212
|
return applyNode({ ...selectorOrOptions, position: "clearChildren" });
|
|
@@ -188,7 +216,7 @@ function innerHtml(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
188
216
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
189
217
|
return applyNode({ position: "innerHtml" })(selectorOrOptions, maybeOptions, descriptor);
|
|
190
218
|
}
|
|
191
|
-
if (typeof selectorOrOptions === "string") {
|
|
219
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
192
220
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml" });
|
|
193
221
|
}
|
|
194
222
|
return applyNode({ ...selectorOrOptions, position: "innerHtml" });
|
|
@@ -197,7 +225,7 @@ function innerHtmlLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
197
225
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
198
226
|
return applyNode({ position: "innerHtml", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
199
227
|
}
|
|
200
|
-
if (typeof selectorOrOptions === "string") {
|
|
228
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
201
229
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml", root: "light" });
|
|
202
230
|
}
|
|
203
231
|
return applyNode({ ...selectorOrOptions, position: "innerHtml", root: "light" });
|
|
@@ -206,7 +234,7 @@ function innerHtmlShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
206
234
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
207
235
|
return applyNode({ position: "innerHtml", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
208
236
|
}
|
|
209
|
-
if (typeof selectorOrOptions === "string") {
|
|
237
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
210
238
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml", root: "shadow" });
|
|
211
239
|
}
|
|
212
240
|
return applyNode({ ...selectorOrOptions, position: "innerHtml", root: "shadow" });
|
|
@@ -215,7 +243,7 @@ function innerText(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
215
243
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
216
244
|
return applyNode({ position: "innerText" })(selectorOrOptions, maybeOptions, descriptor);
|
|
217
245
|
}
|
|
218
|
-
if (typeof selectorOrOptions === "string") {
|
|
246
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
219
247
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText" });
|
|
220
248
|
}
|
|
221
249
|
return applyNode({ ...selectorOrOptions, position: "innerText" });
|
|
@@ -224,7 +252,7 @@ function innerTextLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
224
252
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
225
253
|
return applyNode({ position: "innerText", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
226
254
|
}
|
|
227
|
-
if (typeof selectorOrOptions === "string") {
|
|
255
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
228
256
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText", root: "light" });
|
|
229
257
|
}
|
|
230
258
|
return applyNode({ ...selectorOrOptions, position: "innerText", root: "light" });
|
|
@@ -233,7 +261,7 @@ function innerTextShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
233
261
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
234
262
|
return applyNode({ position: "innerText", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
235
263
|
}
|
|
236
|
-
if (typeof selectorOrOptions === "string") {
|
|
264
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
237
265
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText", root: "shadow" });
|
|
238
266
|
}
|
|
239
267
|
return applyNode({ ...selectorOrOptions, position: "innerText", root: "shadow" });
|
|
@@ -242,7 +270,7 @@ function insertBeforeEnd(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
242
270
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
243
271
|
return applyNode({ position: "beforeEnd" })(selectorOrOptions, maybeOptions, descriptor);
|
|
244
272
|
}
|
|
245
|
-
if (typeof selectorOrOptions === "string") {
|
|
273
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
246
274
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd" });
|
|
247
275
|
}
|
|
248
276
|
return applyNode({ ...selectorOrOptions, position: "beforeEnd" });
|
|
@@ -251,7 +279,7 @@ function insertBeforeEndLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
251
279
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
252
280
|
return applyNode({ position: "beforeEnd", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
253
281
|
}
|
|
254
|
-
if (typeof selectorOrOptions === "string") {
|
|
282
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
255
283
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd", root: "light" });
|
|
256
284
|
}
|
|
257
285
|
return applyNode({ ...selectorOrOptions, position: "beforeEnd", root: "light" });
|
|
@@ -260,7 +288,7 @@ function insertBeforeEndShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
260
288
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
261
289
|
return applyNode({ position: "beforeEnd", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
262
290
|
}
|
|
263
|
-
if (typeof selectorOrOptions === "string") {
|
|
291
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
264
292
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd", root: "shadow" });
|
|
265
293
|
}
|
|
266
294
|
return applyNode({ ...selectorOrOptions, position: "beforeEnd", root: "shadow" });
|
|
@@ -269,7 +297,7 @@ function insertAfterBegin(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
269
297
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
270
298
|
return applyNode({ position: "afterBegin" })(selectorOrOptions, maybeOptions, descriptor);
|
|
271
299
|
}
|
|
272
|
-
if (typeof selectorOrOptions === "string") {
|
|
300
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
273
301
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "afterBegin" });
|
|
274
302
|
}
|
|
275
303
|
return applyNode({ ...selectorOrOptions, position: "afterBegin" });
|
|
@@ -278,7 +306,7 @@ function insertAfterBeginLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
278
306
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
279
307
|
return applyNode({ position: "afterBegin", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
280
308
|
}
|
|
281
|
-
if (typeof selectorOrOptions === "string") {
|
|
309
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
282
310
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "afterBegin", root: "light" });
|
|
283
311
|
}
|
|
284
312
|
return applyNode({ ...selectorOrOptions, position: "afterBegin", root: "light" });
|
|
@@ -287,7 +315,7 @@ function replaceChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
287
315
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
288
316
|
return applyNode({ position: "replaceChildren", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
289
317
|
}
|
|
290
|
-
if (typeof selectorOrOptions === "string") {
|
|
318
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
291
319
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "replaceChildren", root: "light" });
|
|
292
320
|
}
|
|
293
321
|
return applyNode({ ...selectorOrOptions, position: "replaceChildren", root: "light" });
|
|
@@ -296,7 +324,7 @@ function clearChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
296
324
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
297
325
|
return applyNode({ position: "clearChildren", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
298
326
|
}
|
|
299
|
-
if (typeof selectorOrOptions === "string") {
|
|
327
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
300
328
|
return applyNode(selectorOrOptions, { ...maybeOptions, position: "clearChildren", root: "light" });
|
|
301
329
|
}
|
|
302
330
|
return applyNode({ ...selectorOrOptions, position: "clearChildren", root: "light" });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/applyNode.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit, getElementConfig } from './elementDefine';\nimport {SpecialSelector, SwcQueryOptions, HelperHostSet, SwcRootType} from '../types';\nimport { SwcUtils} from \"../utils/Utils\";\nimport {findAllStateMetadata} from \"./state\";\nimport {ElementApply} from \"@dooboostore/core-web\";\n/*\n<!-- beforebegin -->\n<p> <-- it's me\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplyNodePosition = 'beforeBegin' | 'afterBegin' | 'beforeEnd' | 'afterEnd' | 'replace' | 'replaceChildren' | 'innerHtml' | 'innerText' | 'remove' | 'clearChildren';\n\nexport interface ApplyNodeOptions {\n position?: ApplyNodePosition;\n root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n fallback?: (helper: HelperHostSet) => any;\n /**\n * Custom key to extract value from return object.\n * If not provided, uses APPLY_NODE_METADATA_KEY by default.\n * Useful when multiple @applyNode decorators are on the same method.\n */\n valueKey?: symbol | string;\n}\n\nexport interface ApplyNodeMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: ApplyNodeOptions;\n}\n\nexport const APPLY_NODE_METADATA_KEY = Symbol.for('simple-web-component:apply-node');\n\n// const normalizeNodes = (res: any, doc: Document): Node[] => {\n// const items = Array.isArray(res) ? res : [res];\n// return items.map(it => {\n// if (it instanceof Node) return it;\n// return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n// });\n// };\n\nconst applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string, pos: ApplyNodePosition, win: Window, host?: any) => {\n if (!targetEl) return;\n \n // Handle clearChildren - ignore return value and always clear\n if (pos === 'clearChildren') {\n targetEl.replaceChildren();\n return [];\n }\n \n const doc = win.document;\n const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);\n const id = currentThis._swcId;\n\n const nodes: Node[] = [];\n\n if (typeof res === 'string' && pos === 'innerHtml') {\n const t = win.document.createElement('template');\n t.innerHTML = res;\n nodes.push(...Array.from(t.content.childNodes));\n } else if (typeof res === 'string' && pos === 'innerText') {\n nodes.push(win.document.createTextNode(res));\n }\n\n SwcUtils.projectProcessHtml(id, nodes, doc);\n\n const isShadowRoot = targetEl instanceof win.ShadowRoot;\n // const nodes = normalizeNodes(res, doc);\n if (pos === 'replace') {\n if (!isShadowRoot) targetEl.replaceWith(...nodes);\n } else if (pos === 'innerHtml') {\n targetEl.replaceChildren(...nodes);\n } else if (pos === 'innerText') {\n targetEl.replaceChildren(...nodes);\n } else if (pos === 'replaceChildren') {\n targetEl.replaceChildren(...nodes);\n } else {\n if (pos === 'beforeEnd') {\n targetEl.append(...nodes)\n }\n else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n }\n\n const stateContext: any = {...hostSet};\n findAllStateMetadata(currentThis).forEach(it => {\n stateContext[it.name] = currentThis[it.propertyKey]\n })\n new ElementApply(targetEl, {id: id}).apply({target: 'noInitialized', context: stateContext, bind: currentThis});\n return nodes;\n};\n\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n * \n * Overloads:\n * - applyNode(selector, options) - Apply to specific selector\n * - applyNode(options) - Apply to $this (current element)\n */\nexport function applyNode(selector: string, options?: ApplyNodeOptions): MethodDecorator;\nexport function applyNode(options: ApplyNodeOptions): MethodDecorator;\nexport function applyNode(selectorOrOptions: string | ApplyNodeOptions, maybeOptions?: ApplyNodeOptions): MethodDecorator {\n // Determine selector and options based on overload\n let selector: string;\n let options: ApplyNodeOptions;\n\n if (typeof selectorOrOptions === 'string') {\n // First overload: applyNode(selector, options)\n selector = selectorOrOptions;\n options = maybeOptions || {position: 'replaceChildren'};\n } else {\n // Second overload: applyNode(options) - default to $this\n selector = '$this';\n options = selectorOrOptions || {position: 'replaceChildren'};\n }\n\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor) as Map<string | symbol, ApplyNodeMetadata>;\n if (!metaList) {\n metaList = new Map<string | symbol, ApplyNodeMetadata>();\n ReflectUtils.defineMetadata(APPLY_NODE_METADATA_KEY, metaList, constructor);\n }\n metaList.set(propertyKey, {propertyKey, selector, options});\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n\n const getTarget = () => {\n const r = options.root || 'auto';\n const applyRoot = (t: any) => {\n if (!t) return t;\n if (r === 'auto') return t.shadowRoot || t;\n if (r === 'shadow') return t.shadowRoot;\n if (r === 'light') return t;\n if (r === 'all') return t.shadowRoot || t;\n return t;\n };\n\n if (selector === '$this') return applyRoot(this);\n if (selector === '$host') return applyRoot(hostSet.$host);\n if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);\n if (selector === '$appHost') return applyRoot(hostSet.$appHost);\n if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);\n if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);\n\n const targetRoot = applyRoot(this);\n return targetRoot ? targetRoot.querySelector(selector) : null;\n };\n\n const targetEl = getTarget();\n const res = original.apply(this, args);\n\n /**\n * Extract value for this decorator from method return value\n * \n * If return value is an object with this decorator's key,\n * use that value. Otherwise use the entire return value.\n * \n * Uses valueKey from options if provided, otherwise uses APPLY_NODE_METADATA_KEY.\n */\n const extractValue = (v: any) => {\n const keyToUse = options.valueKey ?? APPLY_NODE_METADATA_KEY;\n if (v && typeof v === 'object' && keyToUse in v) {\n return v[keyToUse];\n }\n return v;\n };\n\n const runApply = (target: any, val: any) => {\n const pos = options.position || 'beforeEnd';\n // Delegate HTML/node processing to applyToDom which centralizes\n // processing. runApply should not call processHtml itself to avoid\n // duplicate processing.\n const processedVal = val;\n\n // \uC0AC\uC6A9\uC790\uAC00 filter\uB97C \uBA85\uC2DC\uD558\uBA74 \uADF8 \uC870\uAC74\uC73C\uB85C, \uC544\uB2C8\uBA74 \uD56D\uC0C1 \uC801\uC6A9\n if (!options.filter || options.filter(target, processedVal, {currentThis: this, helper: hostSet})) {\n applyToDom(this, target, processedVal, pos, currentWin);\n }\n };\n\n\n const fallbackNodes: Node[] = [];\n if (targetEl && options.fallback) {\n const loadingRes = options.fallback.call(this, hostSet);\n // applyToDom expects a Window as the 4th argument\n fallbackNodes.push(...applyToDom(this, targetEl, loadingRes, options.position || 'beforeEnd', currentWin));\n }\n\n if (res instanceof Promise) {\n return res.then(finalRes => {\n const extracted = extractValue(finalRes);\n fallbackNodes.forEach((it: any)=>it.remove());\n if (extracted !== undefined && targetEl) runApply(targetEl, extracted);\n return finalRes;\n });\n } else {\n const extracted = extractValue(res);\n if (extracted !== undefined && targetEl) runApply(targetEl, extracted);\n return res;\n }\n };\n };\n}\n\n// --- Overloaded convenience functions for common patterns ---\n\n/**\n * @replaceChildrenNode decorator - replaces children of target element\n * \n * Overloads:\n * - replaceChildrenNode(selector, options) - Replace children of specific selector\n * - replaceChildrenNode(options) - Replace children of $this (current element)\n * - @replaceChildrenNode - Bare decorator, replaces children of $this\n */\nexport function replaceChildren(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function replaceChildren(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function replaceChildren(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function replaceChildren(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @replaceChildrenNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'replaceChildren'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'replaceChildren'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'replaceChildren'});\n}\n\n/**\n * @clearChildrenNode decorator - clears all children of target element\n * \n * Overloads:\n * - clearChildrenNode(selector, options) - Clear children of specific selector\n * - clearChildrenNode(options) - Clear children of $this (current element)\n * - @clearChildrenNode - Bare decorator, clears children of $this\n */\nexport function clearChildrenNode(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function clearChildrenNode(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function clearChildrenNode(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function clearChildrenNode(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @clearChildrenNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'clearChildren'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'clearChildren'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'clearChildren'});\n}\n\n// Alias for clearChildrenNode\nexport const clearNode = clearChildrenNode;\n\n/**\n * @innerHtmlNode decorator - sets innerHTML of target element\n * \n * Overloads:\n * - innerHtmlNode(selector, options) - Set innerHTML of specific selector\n * - innerHtmlNode(options) - Set innerHTML of $this (current element)\n * - @innerHtmlNode - Bare decorator, sets innerHTML of $this\n */\nexport function innerHtml(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerHtml(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerHtml(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerHtmlNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerHtml'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerHtml'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerHtml'});\n}\n\n// Alias for innerHtmlNode\n// export const setHtmlNode = innerHtml;\n\n/**\n * @innerHtmlLightNode decorator - sets innerHTML of light DOM element\n * \n * Overloads:\n * - innerHtmlLightNode(selector, options) - Set innerHTML of specific selector in light DOM\n * - innerHtmlLightNode(options) - Set innerHTML of $this in light DOM\n * - @innerHtmlLightNode - Bare decorator, sets innerHTML of $this in light DOM\n */\nexport function innerHtmlLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerHtmlLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerHtmlLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerHtml', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'light'});\n}\n\n\n/**\n * @innerHtmlShadowNode decorator - sets innerHTML of shadow DOM element\n * \n * Overloads:\n * - innerHtmlShadowNode(selector, options) - Set innerHTML of specific selector in shadow DOM\n * - innerHtmlShadowNode(options) - Set innerHTML of $this in shadow DOM\n * - @innerHtmlShadowNode - Bare decorator, sets innerHTML of $this in shadow DOM\n */\nexport function innerHtmlShadow(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerHtmlShadow(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerHtmlShadowNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerHtml', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'shadow'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'shadow'});\n}\n\n\n/**\n * @innerTextNode decorator - sets innerText of target element\n * \n * Overloads:\n * - innerTextNode(selector, options) - Set innerText of specific selector\n * - innerTextNode(options) - Set innerText of $this (current element)\n * - @innerTextNode - Bare decorator, sets innerText of $this\n */\nexport function innerText(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerText(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerText(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerText(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerTextNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerText'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerText'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerText'});\n}\n\n\n/**\n * @innerTextLightNode decorator - sets innerText of light DOM element\n * \n * Overloads:\n * - innerTextLightNode(selector, options) - Set innerText of specific selector in light DOM\n * - innerTextLightNode(options) - Set innerText of $this in light DOM\n * - @innerTextLightNode - Bare decorator, sets innerText of $this in light DOM\n */\nexport function innerTextLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerTextLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerTextLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerTextLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerTextLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerText', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'light'});\n}\n\n/**\n * @innerTextShadowNode decorator - sets innerText of shadow DOM element\n * \n * Overloads:\n * - innerTextShadowNode(selector, options) - Set innerText of specific selector in shadow DOM\n * - innerTextShadowNode(options) - Set innerText of $this in shadow DOM\n * - @innerTextShadowNode - Bare decorator, sets innerText of $this in shadow DOM\n */\nexport function innerTextShadow(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerTextShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerTextShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerTextShadow(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerTextShadowNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerText', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'shadow'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'shadow'});\n}\n\n/**\n * @beforeEndNode decorator - appends nodes to target element\n * \n * Overloads:\n * - beforeEndNode(selector, options) - Append to specific selector\n * - beforeEndNode(options) - Append to $this (current element)\n * - @beforeEndNode - Bare decorator, appends to $this\n */\nexport function insertBeforeEnd(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function insertBeforeEnd(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function insertBeforeEnd(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertBeforeEnd(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @beforeEndNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'beforeEnd'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'beforeEnd'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'beforeEnd'});\n}\n\n\n/**\n * @beforeEndLightNode decorator - appends nodes to light DOM element\n * \n * Overloads:\n * - beforeEndLightNode(selector, options) - Append to specific selector in light DOM\n * - beforeEndLightNode(options) - Append to $this in light DOM\n * - @beforeEndLightNode - Bare decorator, appends to $this in light DOM\n */\nexport function insertBeforeEndLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertBeforeEndLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertBeforeEndLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertBeforeEndLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @beforeEndLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'beforeEnd', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'light'});\n}\n\n\n/**\n * @beforeEndShadowNode decorator - appends nodes to shadow DOM element\n * \n * Overloads:\n * - beforeEndShadowNode(selector, options) - Append to specific selector in shadow DOM\n * - beforeEndShadowNode(options) - Append to $this in shadow DOM\n * - @beforeEndShadowNode - Bare decorator, appends to $this in shadow DOM\n */\nexport function insertBeforeEndShadow(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertBeforeEndShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertBeforeEndShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertBeforeEndShadow(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @beforeEndShadowNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'beforeEnd', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'shadow'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'shadow'});\n}\n\n\n/**\n * @afterBeginNode decorator - prepends nodes to target element\n * \n * Overloads:\n * - afterBeginNode(selector, options) - Prepend to specific selector\n * - afterBeginNode(options) - Prepend to $this (current element)\n * - @afterBeginNode - Bare decorator, prepends to $this\n */\nexport function insertAfterBegin(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function insertAfterBegin(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function insertAfterBegin(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertAfterBegin(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @afterBeginNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'afterBegin'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'afterBegin'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'afterBegin'});\n}\n\n\n/**\n * @afterBeginLightNode decorator - prepends nodes to light DOM element\n * \n * Overloads:\n * - afterBeginLightNode(selector, options) - Prepend to specific selector in light DOM\n * - afterBeginLightNode(options) - Prepend to $this in light DOM\n * - @afterBeginLightNode - Bare decorator, prepends to $this in light DOM\n */\nexport function insertAfterBeginLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertAfterBeginLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertAfterBeginLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertAfterBeginLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @afterBeginLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'afterBegin', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'afterBegin', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'afterBegin', root: 'light'});\n}\n\n\n/**\n * @replaceChildrenLightNode decorator - replaces children of light DOM element\n * \n * Overloads:\n * - replaceChildrenLightNode(selector, options) - Replace children of specific selector in light DOM\n * - replaceChildrenLightNode(options) - Replace children of $this in light DOM\n * - @replaceChildrenLightNode - Bare decorator, replaces children of $this in light DOM\n */\nexport function replaceChildrenLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function replaceChildrenLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function replaceChildrenLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function replaceChildrenLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @replaceChildrenLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'replaceChildren', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'replaceChildren', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'replaceChildren', root: 'light'});\n}\n\n/**\n * @clearChildrenLightNode decorator - clears children of light DOM element\n * \n * Overloads:\n * - clearChildrenLightNode(selector, options) - Clear children of specific selector in light DOM\n * - clearChildrenLightNode(options) - Clear children of $this in light DOM\n * - @clearChildrenLightNode - Bare decorator, clears children of $this in light DOM\n */\nexport function clearChildrenLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function clearChildrenLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function clearChildrenLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function clearChildrenLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @clearChildrenLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'clearChildren', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string') {\n return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'clearChildren', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'clearChildren', root: 'light'});\n}\n\n\n\n\nexport const findAllApplyNodeMetadata = (target: any): Map<string | symbol, ApplyNodeMetadata> => {\n const result = new Map<string | symbol, ApplyNodeMetadata>();\n const maps = ReflectUtils.findAllMetadata<Map<string | symbol, ApplyNodeMetadata>>(APPLY_NODE_METADATA_KEY, target);\n maps.forEach(map => {\n if (map instanceof Map) {\n map.forEach((v, k) => result.set(k, v));\n }\n });\n return result;\n};"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAC7B,2BAA6C;AAE7C,mBAAwB;AACxB,mBAAmC;AACnC,sBAA2B;
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit, getElementConfig } from './elementDefine';\nimport {SpecialSelector, SwcQueryOptions, HelperHostSet, SwcRootType} from '../types';\nimport { SwcUtils} from \"../utils/Utils\";\nimport {findAllStateMetadata} from \"./state\";\nimport {ElementApply} from \"@dooboostore/core-web\";\n/*\n<!-- beforebegin -->\n<p> <-- it's me\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplyNodePosition = 'beforeBegin' | 'afterBegin' | 'beforeEnd' | 'afterEnd' | 'replace' | 'replaceChildren' | 'innerHtml' | 'innerText' | 'remove' | 'clearChildren';\n\nexport type ApplyNodeSelector = string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null);\n\nexport interface ApplyNodeOptions {\n position?: ApplyNodePosition;\n root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n fallback?: (helper: HelperHostSet) => any;\n /**\n * Custom key to extract value from return object.\n * If not provided, uses APPLY_NODE_METADATA_KEY by default.\n * Useful when multiple @applyNode decorators are on the same method.\n */\n valueKey?: symbol | string;\n}\n\nexport interface ApplyNodeMetadata {\n propertyKey: string | symbol;\n selector: ApplyNodeSelector;\n options: ApplyNodeOptions;\n}\n\nexport const APPLY_NODE_METADATA_KEY = Symbol.for('simple-web-component:apply-node');\n\n/**\n * Resolve selector to string or elements\n * Handles function-based selectors and returns elements if applicable\n */\nconst resolveSelector = (selector: ApplyNodeSelector, inst: any, win: Window): string | HTMLElement | null => {\n if (typeof selector === 'function') {\n const hostSet = SwcUtils.getHelperAndHostSet(win, inst);\n const result = selector(inst, hostSet);\n \n if (result instanceof win.Element) {\n return result as HTMLElement;\n }\n if (result instanceof win.NodeList) {\n return result.length > 0 ? (result[0] as HTMLElement) : null;\n }\n if (Array.isArray(result)) {\n return result.length > 0 ? (result[0] as HTMLElement) : null;\n }\n if (result === null) {\n return null;\n }\n // result must be a string at this point\n return result as unknown as string;\n }\n return selector as string;\n};\n\n// const normalizeNodes = (res: any, doc: Document): Node[] => {\n// const items = Array.isArray(res) ? res : [res];\n// return items.map(it => {\n// if (it instanceof Node) return it;\n// return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n// });\n// };\n\nconst applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string, pos: ApplyNodePosition, win: Window, host?: any) => {\n if (!targetEl) return;\n \n // Handle clearChildren - ignore return value and always clear\n if (pos === 'clearChildren') {\n targetEl.replaceChildren();\n return [];\n }\n \n const doc = win.document;\n const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);\n const id = currentThis._swcId;\n\n const nodes: Node[] = [];\n\n if (typeof res === 'string' && pos === 'innerHtml') {\n const t = win.document.createElement('template');\n t.innerHTML = res;\n nodes.push(...Array.from(t.content.childNodes));\n } else if (typeof res === 'string' && pos === 'innerText') {\n nodes.push(win.document.createTextNode(res));\n }\n\n SwcUtils.projectProcessHtml(id, nodes, doc);\n\n const isShadowRoot = targetEl instanceof win.ShadowRoot;\n // const nodes = normalizeNodes(res, doc);\n if (pos === 'replace') {\n if (!isShadowRoot) targetEl.replaceWith(...nodes);\n } else if (pos === 'innerHtml') {\n targetEl.replaceChildren(...nodes);\n } else if (pos === 'innerText') {\n targetEl.replaceChildren(...nodes);\n } else if (pos === 'replaceChildren') {\n targetEl.replaceChildren(...nodes);\n } else {\n if (pos === 'beforeEnd') {\n targetEl.append(...nodes)\n }\n else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n }\n\n const stateContext: any = {...hostSet};\n findAllStateMetadata(currentThis).forEach(it => {\n stateContext[it.name] = currentThis[it.propertyKey]\n })\n new ElementApply(targetEl, {id: id}).apply({target: 'noInitialized', context: stateContext, bind: currentThis});\n return nodes;\n};\n\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n * \n * Overloads:\n * - applyNode(selector, options) - Apply to specific selector\n * - applyNode(options) - Apply to $this (current element)\n */\nexport function applyNode(selector: ApplyNodeSelector, options?: ApplyNodeOptions): MethodDecorator;\nexport function applyNode(options: ApplyNodeOptions): MethodDecorator;\nexport function applyNode(selectorOrOptions: ApplyNodeSelector | ApplyNodeOptions, maybeOptions?: ApplyNodeOptions): MethodDecorator {\n // Determine selector and options based on overload\n let selector: ApplyNodeSelector;\n let options: ApplyNodeOptions;\n\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n // First overload: applyNode(selector, options)\n selector = selectorOrOptions;\n options = maybeOptions || {position: 'replaceChildren'};\n } else {\n // Second overload: applyNode(options) - default to $this\n selector = '$this';\n options = selectorOrOptions || {position: 'replaceChildren'};\n }\n\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor) as Map<string | symbol, ApplyNodeMetadata>;\n if (!metaList) {\n metaList = new Map<string | symbol, ApplyNodeMetadata>();\n ReflectUtils.defineMetadata(APPLY_NODE_METADATA_KEY, metaList, constructor);\n }\n metaList.set(propertyKey, {propertyKey, selector, options});\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n\n const getTarget = () => {\n const r = options.root || 'auto';\n const applyRoot = (t: any) => {\n if (!t) return t;\n if (r === 'auto') return t.shadowRoot || t;\n if (r === 'shadow') return t.shadowRoot;\n if (r === 'light') return t;\n if (r === 'all') return t.shadowRoot || t;\n return t;\n };\n\n // Resolve selector if it's a function\n const resolved = resolveSelector(selector, this, currentWin);\n \n // If selector function returned an element directly, use it\n if (resolved instanceof currentWin.Element) {\n return applyRoot(resolved);\n }\n if (resolved === null) {\n return null;\n }\n\n // Handle string selector\n const stringSelector = resolved as string;\n\n if (stringSelector === '$this') return applyRoot(this);\n if (stringSelector === '$host') return applyRoot(hostSet.$host);\n if (stringSelector === '$parentHost') return applyRoot(hostSet.$parentHost);\n if (stringSelector === '$appHost') return applyRoot(hostSet.$appHost);\n if (stringSelector === '$firstHost') return applyRoot(hostSet.$firstHost);\n if (stringSelector === '$lastHost') return applyRoot(hostSet.$lastHost);\n\n const targetRoot = applyRoot(this);\n return targetRoot ? targetRoot.querySelector(stringSelector) : null;\n };\n\n const targetEl = getTarget();\n const res = original.apply(this, args);\n\n /**\n * Extract value for this decorator from method return value\n * \n * If return value is an object with this decorator's key,\n * use that value. Otherwise use the entire return value.\n * \n * Uses valueKey from options if provided, otherwise uses APPLY_NODE_METADATA_KEY.\n */\n const extractValue = (v: any) => {\n const keyToUse = options.valueKey ?? APPLY_NODE_METADATA_KEY;\n if (v && typeof v === 'object' && keyToUse in v) {\n return v[keyToUse];\n }\n return v;\n };\n\n const runApply = (target: any, val: any) => {\n const pos = options.position || 'beforeEnd';\n // Delegate HTML/node processing to applyToDom which centralizes\n // processing. runApply should not call processHtml itself to avoid\n // duplicate processing.\n const processedVal = val;\n\n // \uC0AC\uC6A9\uC790\uAC00 filter\uB97C \uBA85\uC2DC\uD558\uBA74 \uADF8 \uC870\uAC74\uC73C\uB85C, \uC544\uB2C8\uBA74 \uD56D\uC0C1 \uC801\uC6A9\n if (!options.filter || options.filter(target, processedVal, {currentThis: this, helper: hostSet})) {\n applyToDom(this, target, processedVal, pos, currentWin);\n }\n };\n\n\n const fallbackNodes: Node[] = [];\n if (targetEl && options.fallback) {\n const loadingRes = options.fallback.call(this, hostSet);\n // applyToDom expects a Window as the 4th argument\n fallbackNodes.push(...applyToDom(this, targetEl, loadingRes, options.position || 'beforeEnd', currentWin));\n }\n\n if (res instanceof Promise) {\n return res.then(finalRes => {\n const extracted = extractValue(finalRes);\n fallbackNodes.forEach((it: any)=>it.remove());\n if (extracted !== undefined && targetEl) runApply(targetEl, extracted);\n return finalRes;\n });\n } else {\n const extracted = extractValue(res);\n if (extracted !== undefined && targetEl) runApply(targetEl, extracted);\n return res;\n }\n };\n };\n}\n\n// --- Overloaded convenience functions for common patterns ---\n\n/**\n * @replaceChildrenNode decorator - replaces children of target element\n * \n * Overloads:\n * - replaceChildrenNode(selector, options) - Replace children of specific selector\n * - replaceChildrenNode(options) - Replace children of $this (current element)\n * - @replaceChildrenNode - Bare decorator, replaces children of $this\n */\nexport function replaceChildren(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function replaceChildren(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function replaceChildren(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function replaceChildren(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @replaceChildrenNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'replaceChildren'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'replaceChildren'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'replaceChildren'});\n}\n\n/**\n * @clearChildrenNode decorator - clears all children of target element\n * \n * Overloads:\n * - clearChildrenNode(selector, options) - Clear children of specific selector\n * - clearChildrenNode(options) - Clear children of $this (current element)\n * - @clearChildrenNode - Bare decorator, clears children of $this\n */\nexport function clearChildrenNode(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function clearChildrenNode(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function clearChildrenNode(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function clearChildrenNode(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @clearChildrenNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'clearChildren'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'clearChildren'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'clearChildren'});\n}\n\n// Alias for clearChildrenNode\nexport const clearNode = clearChildrenNode;\n\n/**\n * @innerHtmlNode decorator - sets innerHTML of target element\n * \n * Overloads:\n * - innerHtmlNode(selector, options) - Set innerHTML of specific selector\n * - innerHtmlNode(options) - Set innerHTML of $this (current element)\n * - @innerHtmlNode - Bare decorator, sets innerHTML of $this\n */\nexport function innerHtml(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerHtml(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerHtml(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerHtmlNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerHtml'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerHtml'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerHtml'});\n}\n\n// Alias for innerHtmlNode\n// export const setHtmlNode = innerHtml;\n\n/**\n * @innerHtmlLightNode decorator - sets innerHTML of light DOM element\n * \n * Overloads:\n * - innerHtmlLightNode(selector, options) - Set innerHTML of specific selector in light DOM\n * - innerHtmlLightNode(options) - Set innerHTML of $this in light DOM\n * - @innerHtmlLightNode - Bare decorator, sets innerHTML of $this in light DOM\n */\nexport function innerHtmlLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerHtmlLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerHtmlLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerHtml', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'light'});\n}\n\n\n/**\n * @innerHtmlShadowNode decorator - sets innerHTML of shadow DOM element\n * \n * Overloads:\n * - innerHtmlShadowNode(selector, options) - Set innerHTML of specific selector in shadow DOM\n * - innerHtmlShadowNode(options) - Set innerHTML of $this in shadow DOM\n * - @innerHtmlShadowNode - Bare decorator, sets innerHTML of $this in shadow DOM\n */\nexport function innerHtmlShadow(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerHtmlShadow(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerHtmlShadowNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerHtml', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'shadow'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'shadow'});\n}\n\n\n/**\n * @innerTextNode decorator - sets innerText of target element\n * \n * Overloads:\n * - innerTextNode(selector, options) - Set innerText of specific selector\n * - innerTextNode(options) - Set innerText of $this (current element)\n * - @innerTextNode - Bare decorator, sets innerText of $this\n */\nexport function innerText(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerText(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerText(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerText(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerTextNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerText'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerText'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerText'});\n}\n\n\n/**\n * @innerTextLightNode decorator - sets innerText of light DOM element\n * \n * Overloads:\n * - innerTextLightNode(selector, options) - Set innerText of specific selector in light DOM\n * - innerTextLightNode(options) - Set innerText of $this in light DOM\n * - @innerTextLightNode - Bare decorator, sets innerText of $this in light DOM\n */\nexport function innerTextLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerTextLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerTextLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerTextLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerTextLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerText', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'light'});\n}\n\n/**\n * @innerTextShadowNode decorator - sets innerText of shadow DOM element\n * \n * Overloads:\n * - innerTextShadowNode(selector, options) - Set innerText of specific selector in shadow DOM\n * - innerTextShadowNode(options) - Set innerText of $this in shadow DOM\n * - @innerTextShadowNode - Bare decorator, sets innerText of $this in shadow DOM\n */\nexport function innerTextShadow(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerTextShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerTextShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function innerTextShadow(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @innerTextShadowNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'innerText', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'shadow'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'shadow'});\n}\n\n/**\n * @beforeEndNode decorator - appends nodes to target element\n * \n * Overloads:\n * - beforeEndNode(selector, options) - Append to specific selector\n * - beforeEndNode(options) - Append to $this (current element)\n * - @beforeEndNode - Bare decorator, appends to $this\n */\nexport function insertBeforeEnd(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function insertBeforeEnd(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function insertBeforeEnd(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertBeforeEnd(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @beforeEndNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'beforeEnd'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'beforeEnd'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'beforeEnd'});\n}\n\n\n/**\n * @beforeEndLightNode decorator - appends nodes to light DOM element\n * \n * Overloads:\n * - beforeEndLightNode(selector, options) - Append to specific selector in light DOM\n * - beforeEndLightNode(options) - Append to $this in light DOM\n * - @beforeEndLightNode - Bare decorator, appends to $this in light DOM\n */\nexport function insertBeforeEndLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertBeforeEndLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertBeforeEndLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertBeforeEndLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @beforeEndLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'beforeEnd', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'light'});\n}\n\n\n/**\n * @beforeEndShadowNode decorator - appends nodes to shadow DOM element\n * \n * Overloads:\n * - beforeEndShadowNode(selector, options) - Append to specific selector in shadow DOM\n * - beforeEndShadowNode(options) - Append to $this in shadow DOM\n * - @beforeEndShadowNode - Bare decorator, appends to $this in shadow DOM\n */\nexport function insertBeforeEndShadow(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertBeforeEndShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertBeforeEndShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertBeforeEndShadow(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @beforeEndShadowNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'beforeEnd', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'shadow'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'shadow'});\n}\n\n\n/**\n * @afterBeginNode decorator - prepends nodes to target element\n * \n * Overloads:\n * - afterBeginNode(selector, options) - Prepend to specific selector\n * - afterBeginNode(options) - Prepend to $this (current element)\n * - @afterBeginNode - Bare decorator, prepends to $this\n */\nexport function insertAfterBegin(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function insertAfterBegin(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function insertAfterBegin(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertAfterBegin(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @afterBeginNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'afterBegin'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'afterBegin'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'afterBegin'});\n}\n\n\n/**\n * @afterBeginLightNode decorator - prepends nodes to light DOM element\n * \n * Overloads:\n * - afterBeginLightNode(selector, options) - Prepend to specific selector in light DOM\n * - afterBeginLightNode(options) - Prepend to $this in light DOM\n * - @afterBeginLightNode - Bare decorator, prepends to $this in light DOM\n */\nexport function insertAfterBeginLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertAfterBeginLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function insertAfterBeginLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function insertAfterBeginLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @afterBeginLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'afterBegin', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'afterBegin', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'afterBegin', root: 'light'});\n}\n\n\n/**\n * @replaceChildrenLightNode decorator - replaces children of light DOM element\n * \n * Overloads:\n * - replaceChildrenLightNode(selector, options) - Replace children of specific selector in light DOM\n * - replaceChildrenLightNode(options) - Replace children of $this in light DOM\n * - @replaceChildrenLightNode - Bare decorator, replaces children of $this in light DOM\n */\nexport function replaceChildrenLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function replaceChildrenLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function replaceChildrenLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function replaceChildrenLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @replaceChildrenLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'replaceChildren', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'replaceChildren', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'replaceChildren', root: 'light'});\n}\n\n/**\n * @clearChildrenLightNode decorator - clears children of light DOM element\n * \n * Overloads:\n * - clearChildrenLightNode(selector, options) - Clear children of specific selector in light DOM\n * - clearChildrenLightNode(options) - Clear children of $this in light DOM\n * - @clearChildrenLightNode - Bare decorator, clears children of $this in light DOM\n */\nexport function clearChildrenLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function clearChildrenLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function clearChildrenLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function clearChildrenLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {\n // Bare decorator usage: @clearChildrenLightNode\n if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {\n return applyNode({position: 'clearChildren', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);\n }\n \n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'clearChildren', root: 'light'});\n }\n return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'clearChildren', root: 'light'});\n}\n\n\n\n\nexport const findAllApplyNodeMetadata = (target: any): Map<string | symbol, ApplyNodeMetadata> => {\n const result = new Map<string | symbol, ApplyNodeMetadata>();\n const maps = ReflectUtils.findAllMetadata<Map<string | symbol, ApplyNodeMetadata>>(APPLY_NODE_METADATA_KEY, target);\n maps.forEach(map => {\n if (map instanceof Map) {\n map.forEach((v, k) => result.set(k, v));\n }\n });\n return result;\n};"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAC7B,2BAA6C;AAE7C,mBAAwB;AACxB,mBAAmC;AACnC,sBAA2B;AAwCpB,MAAM,0BAA0B,OAAO,IAAI,iCAAiC;AAMnF,MAAM,kBAAkB,CAAC,UAA6B,MAAW,QAA6C;AAC5G,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
37
37
|
const r = options.root || "auto";
|
|
38
38
|
const results = [];
|
|
39
|
+
let resolvedSelector = selector;
|
|
40
|
+
if (typeof selector === "function") {
|
|
41
|
+
const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(currentWin, inst);
|
|
42
|
+
resolvedSelector = selector(inst, hostSet);
|
|
43
|
+
}
|
|
44
|
+
if (resolvedSelector instanceof currentWin.Element) {
|
|
45
|
+
results.push(resolvedSelector);
|
|
46
|
+
return results;
|
|
47
|
+
}
|
|
48
|
+
if (resolvedSelector instanceof currentWin.NodeList) {
|
|
49
|
+
results.push(...Array.from(resolvedSelector));
|
|
50
|
+
return results;
|
|
51
|
+
}
|
|
52
|
+
if (Array.isArray(resolvedSelector)) {
|
|
53
|
+
results.push(...resolvedSelector);
|
|
54
|
+
return results;
|
|
55
|
+
}
|
|
56
|
+
if (resolvedSelector === null) {
|
|
57
|
+
return results;
|
|
58
|
+
}
|
|
59
|
+
const stringSelector = resolvedSelector;
|
|
39
60
|
const applyRoot = (target) => {
|
|
40
61
|
if (!target) return;
|
|
41
62
|
if (r === "auto") {
|
|
@@ -45,37 +66,37 @@ const resolvePropertyTargets = (inst, selector, options) => {
|
|
|
45
66
|
if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
|
|
46
67
|
}
|
|
47
68
|
};
|
|
48
|
-
if (
|
|
69
|
+
if (stringSelector === "$this" || !stringSelector) {
|
|
49
70
|
applyRoot(inst);
|
|
50
|
-
} else if (
|
|
71
|
+
} else if (stringSelector === "$window") {
|
|
51
72
|
results.push(currentWin);
|
|
52
|
-
} else if (
|
|
73
|
+
} else if (stringSelector === "$document") {
|
|
53
74
|
results.push(currentWin.document);
|
|
54
75
|
} else {
|
|
55
76
|
const hostSet = import_Utils.SwcUtils.getHostSet(inst);
|
|
56
|
-
if (
|
|
57
|
-
else if (
|
|
58
|
-
else if (
|
|
59
|
-
else if (
|
|
60
|
-
else if (
|
|
61
|
-
else if (
|
|
62
|
-
else if (
|
|
63
|
-
else if (
|
|
64
|
-
else if (
|
|
77
|
+
if (stringSelector === "$host") applyRoot(hostSet.$host);
|
|
78
|
+
else if (stringSelector === "$parentHost") applyRoot(hostSet.$parentHost);
|
|
79
|
+
else if (stringSelector === "$appHost") applyRoot(hostSet.$appHost);
|
|
80
|
+
else if (stringSelector === "$firstHost") applyRoot(hostSet.$firstHost);
|
|
81
|
+
else if (stringSelector === "$lastHost") applyRoot(hostSet.$lastHost);
|
|
82
|
+
else if (stringSelector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
83
|
+
else if (stringSelector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
84
|
+
else if (stringSelector === "$hosts") hostSet.$hosts.forEach(applyRoot);
|
|
85
|
+
else if (stringSelector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
65
86
|
else {
|
|
66
87
|
if (r === "shadow") {
|
|
67
|
-
const found = inst.shadowRoot?.querySelectorAll(
|
|
88
|
+
const found = inst.shadowRoot?.querySelectorAll(stringSelector);
|
|
68
89
|
if (found) results.push(...found);
|
|
69
90
|
} else if (r === "light") {
|
|
70
|
-
const found = inst.querySelectorAll(
|
|
91
|
+
const found = inst.querySelectorAll(stringSelector);
|
|
71
92
|
if (found) results.push(...found);
|
|
72
93
|
} else if (r === "all") {
|
|
73
|
-
const sMatch = inst.shadowRoot?.querySelectorAll(
|
|
74
|
-
const lMatch = inst.querySelectorAll(
|
|
94
|
+
const sMatch = inst.shadowRoot?.querySelectorAll(stringSelector);
|
|
95
|
+
const lMatch = inst.querySelectorAll(stringSelector);
|
|
75
96
|
if (sMatch) results.push(...sMatch);
|
|
76
97
|
if (lMatch) results.push(...lMatch);
|
|
77
98
|
} else {
|
|
78
|
-
const found = (inst.shadowRoot || inst).querySelectorAll(
|
|
99
|
+
const found = (inst.shadowRoot || inst).querySelectorAll(stringSelector);
|
|
79
100
|
if (found) results.push(...found);
|
|
80
101
|
}
|
|
81
102
|
}
|