@dooboostore/simple-web-component 1.0.42 → 1.0.44
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 +689 -85
- package/dist/cjs/SwcAppEngine.js +3 -1
- package/dist/cjs/SwcAppEngine.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +10 -0
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +41 -30
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +66 -23
- package/dist/cjs/decorators/applyClass.js.map +3 -3
- package/dist/cjs/decorators/applyNode.js +176 -107
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +21 -30
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +11 -2
- package/dist/cjs/decorators/applySlot.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +48 -17
- package/dist/cjs/decorators/applyStyle.js.map +3 -3
- package/dist/cjs/decorators/{changedAttributeThis.js → changedAttribute.js} +6 -6
- package/dist/cjs/decorators/changedAttribute.js.map +7 -0
- package/dist/cjs/decorators/elementDefine.js +37 -6
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +58 -42
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/index.js +1 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/publishSwcAppMessage.js +37 -23
- package/dist/cjs/decorators/publishSwcAppMessage.js.map +3 -3
- package/dist/cjs/decorators/query.js +96 -145
- package/dist/cjs/decorators/query.js.map +3 -3
- package/dist/cjs/decorators/queryAll.js +104 -131
- package/dist/cjs/decorators/queryAll.js.map +3 -3
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +17 -2
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/examples/RxJSOperatorsExample.js +285 -0
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/router/ElementRouter.js +4 -0
- package/dist/cjs/router/ElementRouter.js.map +2 -2
- package/dist/esm/SwcAppEngine.js +3 -1
- package/dist/esm/SwcAppEngine.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +10 -0
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +41 -30
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +66 -23
- package/dist/esm/decorators/applyClass.js.map +3 -3
- package/dist/esm/decorators/applyNode.js +176 -107
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +21 -30
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +11 -2
- package/dist/esm/decorators/applySlot.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +48 -17
- package/dist/esm/decorators/applyStyle.js.map +3 -3
- package/dist/esm/decorators/{changedAttributeThis.js → changedAttribute.js} +3 -3
- package/dist/esm/decorators/changedAttribute.js.map +7 -0
- package/dist/esm/decorators/elementDefine.js +35 -4
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js +58 -42
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/index.js +1 -1
- package/dist/esm/decorators/index.js.map +1 -1
- package/dist/esm/decorators/publishSwcAppMessage.js +37 -23
- package/dist/esm/decorators/publishSwcAppMessage.js.map +3 -3
- package/dist/esm/decorators/query.js +96 -145
- package/dist/esm/decorators/query.js.map +3 -3
- package/dist/esm/decorators/queryAll.js +104 -131
- package/dist/esm/decorators/queryAll.js.map +3 -3
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +18 -3
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/examples/RxJSOperatorsExample.js +266 -0
- package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/router/ElementRouter.js +4 -0
- package/dist/esm/router/ElementRouter.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +900 -578
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/decorators/addEventListener.d.ts +22 -14
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +61 -20
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +22 -36
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +178 -30
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +53 -18
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applySlot.d.ts +6 -0
- package/dist/types/decorators/applySlot.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +13 -7
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/{changedAttributeThis.d.ts → changedAttribute.d.ts} +2 -2
- package/dist/types/decorators/changedAttribute.d.ts.map +1 -0
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +20 -10
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +1 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/publishSwcAppMessage.d.ts +19 -0
- package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +3 -26
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +3 -20
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +1 -0
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +4 -4
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/examples/RxJSOperatorsExample.d.ts +94 -0
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/router/ElementRouter.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +900 -578
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +7 -9
- package/src/SwcAppEngine.ts +3 -1
- package/src/decorators/addEventListener.ts +35 -24
- package/src/decorators/applyAttribute.ts +167 -65
- package/src/decorators/applyClass.ts +113 -17
- package/src/decorators/applyNode.ts +383 -102
- package/src/decorators/applyProperty.ts +99 -65
- package/src/decorators/applySlot.ts +24 -10
- package/src/decorators/applyStyle.ts +83 -13
- package/src/decorators/{changedAttributeThis.ts → changedAttribute.ts} +1 -1
- package/src/decorators/elementDefine.ts +47 -4
- package/src/decorators/emitCustomEvent.ts +62 -35
- package/src/decorators/index.ts +1 -1
- package/src/decorators/publishSwcAppMessage.ts +71 -27
- package/src/decorators/query.ts +90 -159
- package/src/decorators/queryAll.ts +92 -134
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -0
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +3 -1
- package/src/elements/SwcAppMixin.ts +43 -24
- package/src/examples/RxJSOperatorsExample.ts +279 -0
- package/src/index.ts +2 -0
- package/src/router/ElementRouter.ts +4 -0
- package/dist/cjs/decorators/changedAttributeThis.js.map +0 -7
- package/dist/esm/decorators/changedAttributeThis.js.map +0 -7
- package/dist/types/decorators/changedAttributeThis.d.ts.map +0 -1
|
@@ -18,26 +18,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
18
18
|
var applyNode_exports = {};
|
|
19
19
|
__export(applyNode_exports, {
|
|
20
20
|
APPLY_NODE_METADATA_KEY: () => APPLY_NODE_METADATA_KEY,
|
|
21
|
-
afterBeginLightNodeThis: () => afterBeginLightNodeThis,
|
|
22
|
-
afterBeginNodeThis: () => afterBeginNodeThis,
|
|
23
21
|
applyNode: () => applyNode,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
beforeEndShadowNodeThis: () => beforeEndShadowNodeThis,
|
|
22
|
+
clearChildrenLight: () => clearChildrenLight,
|
|
23
|
+
clearChildrenNode: () => clearChildrenNode,
|
|
24
|
+
clearNode: () => clearNode,
|
|
28
25
|
findAllApplyNodeMetadata: () => findAllApplyNodeMetadata,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
innerHtml: () => innerHtml,
|
|
27
|
+
innerHtmlLight: () => innerHtmlLight,
|
|
28
|
+
innerHtmlShadow: () => innerHtmlShadow,
|
|
29
|
+
innerText: () => innerText,
|
|
30
|
+
innerTextLight: () => innerTextLight,
|
|
31
|
+
innerTextShadow: () => innerTextShadow,
|
|
32
|
+
insertAfterBegin: () => insertAfterBegin,
|
|
33
|
+
insertAfterBeginLight: () => insertAfterBeginLight,
|
|
34
|
+
insertBeforeEnd: () => insertBeforeEnd,
|
|
35
|
+
insertBeforeEndLight: () => insertBeforeEndLight,
|
|
36
|
+
insertBeforeEndShadow: () => insertBeforeEndShadow,
|
|
37
|
+
replaceChildren: () => replaceChildren,
|
|
38
|
+
replaceChildrenLight: () => replaceChildrenLight
|
|
41
39
|
});
|
|
42
40
|
module.exports = __toCommonJS(applyNode_exports);
|
|
43
41
|
var import_core = require("@dooboostore/core");
|
|
@@ -48,6 +46,10 @@ var import_core_web = require("@dooboostore/core-web");
|
|
|
48
46
|
const APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
|
|
49
47
|
const applyToDom = (currentThis, targetEl, res, pos, win, host) => {
|
|
50
48
|
if (!targetEl) return;
|
|
49
|
+
if (pos === "clearChildren") {
|
|
50
|
+
targetEl.replaceChildren();
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
51
53
|
const doc = win.document;
|
|
52
54
|
const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, currentThis);
|
|
53
55
|
const id = currentThis._swcId;
|
|
@@ -83,7 +85,16 @@ const applyToDom = (currentThis, targetEl, res, pos, win, host) => {
|
|
|
83
85
|
new import_core_web.ElementApply(targetEl, { id }).apply({ target: "noInitialized", context: stateContext, bind: currentThis });
|
|
84
86
|
return nodes;
|
|
85
87
|
};
|
|
86
|
-
function applyNode(
|
|
88
|
+
function applyNode(selectorOrOptions, maybeOptions) {
|
|
89
|
+
let selector;
|
|
90
|
+
let options;
|
|
91
|
+
if (typeof selectorOrOptions === "string") {
|
|
92
|
+
selector = selectorOrOptions;
|
|
93
|
+
options = maybeOptions || { position: "replaceChildren" };
|
|
94
|
+
} else {
|
|
95
|
+
selector = "$this";
|
|
96
|
+
options = selectorOrOptions || { position: "replaceChildren" };
|
|
97
|
+
}
|
|
87
98
|
return (targetObj, propertyKey, descriptor) => {
|
|
88
99
|
const constructor = targetObj.constructor;
|
|
89
100
|
let metaList = import_core.ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor);
|
|
@@ -120,6 +131,13 @@ function applyNode(selector, options = { position: "replaceChildren" }) {
|
|
|
120
131
|
};
|
|
121
132
|
const targetEl = getTarget();
|
|
122
133
|
const res = original.apply(this, args);
|
|
134
|
+
const extractValue = (v) => {
|
|
135
|
+
const keyToUse = options.valueKey ?? APPLY_NODE_METADATA_KEY;
|
|
136
|
+
if (v && typeof v === "object" && keyToUse in v) {
|
|
137
|
+
return v[keyToUse];
|
|
138
|
+
}
|
|
139
|
+
return v;
|
|
140
|
+
};
|
|
123
141
|
const runApply = (target, val) => {
|
|
124
142
|
const pos = options.position || "beforeEnd";
|
|
125
143
|
const processedVal = val;
|
|
@@ -134,103 +152,154 @@ function applyNode(selector, options = { position: "replaceChildren" }) {
|
|
|
134
152
|
}
|
|
135
153
|
if (res instanceof Promise) {
|
|
136
154
|
return res.then((finalRes) => {
|
|
155
|
+
const extracted = extractValue(finalRes);
|
|
137
156
|
fallbackNodes.forEach((it) => it.remove());
|
|
138
|
-
if (
|
|
157
|
+
if (extracted !== void 0 && targetEl) runApply(targetEl, extracted);
|
|
139
158
|
return finalRes;
|
|
140
159
|
});
|
|
141
160
|
} else {
|
|
142
|
-
|
|
161
|
+
const extracted = extractValue(res);
|
|
162
|
+
if (extracted !== void 0 && targetEl) runApply(targetEl, extracted);
|
|
143
163
|
return res;
|
|
144
164
|
}
|
|
145
165
|
};
|
|
146
166
|
};
|
|
147
167
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return applyNode(
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
168
|
+
function replaceChildren(selectorOrOptions, maybeOptions, descriptor) {
|
|
169
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
170
|
+
return applyNode({ position: "replaceChildren" })(selectorOrOptions, maybeOptions, descriptor);
|
|
171
|
+
}
|
|
172
|
+
if (typeof selectorOrOptions === "string") {
|
|
173
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "replaceChildren" });
|
|
174
|
+
}
|
|
175
|
+
return applyNode({ ...selectorOrOptions, position: "replaceChildren" });
|
|
176
|
+
}
|
|
177
|
+
function clearChildrenNode(selectorOrOptions, maybeOptions, descriptor) {
|
|
178
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
179
|
+
return applyNode({ position: "clearChildren" })(selectorOrOptions, maybeOptions, descriptor);
|
|
180
|
+
}
|
|
181
|
+
if (typeof selectorOrOptions === "string") {
|
|
182
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "clearChildren" });
|
|
183
|
+
}
|
|
184
|
+
return applyNode({ ...selectorOrOptions, position: "clearChildren" });
|
|
185
|
+
}
|
|
186
|
+
const clearNode = clearChildrenNode;
|
|
187
|
+
function innerHtml(selectorOrOptions, maybeOptions, descriptor) {
|
|
188
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
189
|
+
return applyNode({ position: "innerHtml" })(selectorOrOptions, maybeOptions, descriptor);
|
|
190
|
+
}
|
|
191
|
+
if (typeof selectorOrOptions === "string") {
|
|
192
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml" });
|
|
193
|
+
}
|
|
194
|
+
return applyNode({ ...selectorOrOptions, position: "innerHtml" });
|
|
195
|
+
}
|
|
196
|
+
function innerHtmlLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
197
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
198
|
+
return applyNode({ position: "innerHtml", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
199
|
+
}
|
|
200
|
+
if (typeof selectorOrOptions === "string") {
|
|
201
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml", root: "light" });
|
|
202
|
+
}
|
|
203
|
+
return applyNode({ ...selectorOrOptions, position: "innerHtml", root: "light" });
|
|
204
|
+
}
|
|
205
|
+
function innerHtmlShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
206
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
207
|
+
return applyNode({ position: "innerHtml", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
208
|
+
}
|
|
209
|
+
if (typeof selectorOrOptions === "string") {
|
|
210
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerHtml", root: "shadow" });
|
|
211
|
+
}
|
|
212
|
+
return applyNode({ ...selectorOrOptions, position: "innerHtml", root: "shadow" });
|
|
213
|
+
}
|
|
214
|
+
function innerText(selectorOrOptions, maybeOptions, descriptor) {
|
|
215
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
216
|
+
return applyNode({ position: "innerText" })(selectorOrOptions, maybeOptions, descriptor);
|
|
217
|
+
}
|
|
218
|
+
if (typeof selectorOrOptions === "string") {
|
|
219
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText" });
|
|
220
|
+
}
|
|
221
|
+
return applyNode({ ...selectorOrOptions, position: "innerText" });
|
|
222
|
+
}
|
|
223
|
+
function innerTextLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
224
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
225
|
+
return applyNode({ position: "innerText", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
226
|
+
}
|
|
227
|
+
if (typeof selectorOrOptions === "string") {
|
|
228
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText", root: "light" });
|
|
229
|
+
}
|
|
230
|
+
return applyNode({ ...selectorOrOptions, position: "innerText", root: "light" });
|
|
231
|
+
}
|
|
232
|
+
function innerTextShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
233
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
234
|
+
return applyNode({ position: "innerText", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
235
|
+
}
|
|
236
|
+
if (typeof selectorOrOptions === "string") {
|
|
237
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "innerText", root: "shadow" });
|
|
238
|
+
}
|
|
239
|
+
return applyNode({ ...selectorOrOptions, position: "innerText", root: "shadow" });
|
|
240
|
+
}
|
|
241
|
+
function insertBeforeEnd(selectorOrOptions, maybeOptions, descriptor) {
|
|
242
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
243
|
+
return applyNode({ position: "beforeEnd" })(selectorOrOptions, maybeOptions, descriptor);
|
|
244
|
+
}
|
|
245
|
+
if (typeof selectorOrOptions === "string") {
|
|
246
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd" });
|
|
247
|
+
}
|
|
248
|
+
return applyNode({ ...selectorOrOptions, position: "beforeEnd" });
|
|
249
|
+
}
|
|
250
|
+
function insertBeforeEndLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
251
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
252
|
+
return applyNode({ position: "beforeEnd", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
253
|
+
}
|
|
254
|
+
if (typeof selectorOrOptions === "string") {
|
|
255
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd", root: "light" });
|
|
256
|
+
}
|
|
257
|
+
return applyNode({ ...selectorOrOptions, position: "beforeEnd", root: "light" });
|
|
258
|
+
}
|
|
259
|
+
function insertBeforeEndShadow(selectorOrOptions, maybeOptions, descriptor) {
|
|
260
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
261
|
+
return applyNode({ position: "beforeEnd", root: "shadow" })(selectorOrOptions, maybeOptions, descriptor);
|
|
262
|
+
}
|
|
263
|
+
if (typeof selectorOrOptions === "string") {
|
|
264
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "beforeEnd", root: "shadow" });
|
|
265
|
+
}
|
|
266
|
+
return applyNode({ ...selectorOrOptions, position: "beforeEnd", root: "shadow" });
|
|
267
|
+
}
|
|
268
|
+
function insertAfterBegin(selectorOrOptions, maybeOptions, descriptor) {
|
|
269
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
270
|
+
return applyNode({ position: "afterBegin" })(selectorOrOptions, maybeOptions, descriptor);
|
|
271
|
+
}
|
|
272
|
+
if (typeof selectorOrOptions === "string") {
|
|
273
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "afterBegin" });
|
|
274
|
+
}
|
|
275
|
+
return applyNode({ ...selectorOrOptions, position: "afterBegin" });
|
|
276
|
+
}
|
|
277
|
+
function insertAfterBeginLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
278
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
279
|
+
return applyNode({ position: "afterBegin", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
280
|
+
}
|
|
281
|
+
if (typeof selectorOrOptions === "string") {
|
|
282
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "afterBegin", root: "light" });
|
|
283
|
+
}
|
|
284
|
+
return applyNode({ ...selectorOrOptions, position: "afterBegin", root: "light" });
|
|
285
|
+
}
|
|
286
|
+
function replaceChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
287
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
288
|
+
return applyNode({ position: "replaceChildren", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
289
|
+
}
|
|
290
|
+
if (typeof selectorOrOptions === "string") {
|
|
291
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "replaceChildren", root: "light" });
|
|
292
|
+
}
|
|
293
|
+
return applyNode({ ...selectorOrOptions, position: "replaceChildren", root: "light" });
|
|
294
|
+
}
|
|
295
|
+
function clearChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
296
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
297
|
+
return applyNode({ position: "clearChildren", root: "light" })(selectorOrOptions, maybeOptions, descriptor);
|
|
298
|
+
}
|
|
299
|
+
if (typeof selectorOrOptions === "string") {
|
|
300
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "clearChildren", root: "light" });
|
|
301
|
+
}
|
|
302
|
+
return applyNode({ ...selectorOrOptions, position: "clearChildren", root: "light" });
|
|
234
303
|
}
|
|
235
304
|
const findAllApplyNodeMetadata = (target) => {
|
|
236
305
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -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';\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\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 const doc = win.document;\n const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);\n const id = currentThis._swcId;\n\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\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 */\nexport function applyNode(selector: string, options: ApplyNodeOptions = {position: 'replaceChildren'}): MethodDecorator {\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 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 fallbackNodes.forEach((it: any)=>it.remove());\n if (finalRes !== undefined && targetEl) runApply(targetEl, finalRes);\n return finalRes;\n });\n } else {\n if (res !== undefined && targetEl) runApply(targetEl, res);\n return res;\n }\n };\n };\n}\n\nexport function applyNodeThis(options: ApplyNodeOptions): MethodDecorator;\nexport function applyNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function applyNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'replaceChildren'};\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...option, ...opt});\n}\n\nexport function replaceChildrenNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function replaceChildrenNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function replaceChildrenNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'replaceChildren'};\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\n\n\nexport function beforeEndNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function beforeEndNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function beforeEndNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const options: ApplyNodeOptions = {position: 'beforeEnd'};\n if (propertyKey !== undefined) return applyNode('$this', options)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...options});\n}\n\nexport function beforeEndLightNodeThis(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function beforeEndLightNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function beforeEndLightNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'beforeEnd', root: 'light'}\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\nexport function beforeEndShadowNodeThis(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function beforeEndShadowNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function beforeEndShadowNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'beforeEnd', root: 'shadow'}\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\nexport function afterBeginNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function afterBeginNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function afterBeginNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'afterBegin'};\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\nexport function afterBeginLightNodeThis(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function afterBeginLightNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function afterBeginLightNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'afterBegin', root: 'light'}\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\nexport function innerHtmlNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerHtmlNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function innerHtmlNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'innerHtml'}\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\nexport function innerTextNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;\nexport function innerTextNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function innerTextNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'innerText'}\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\nexport function innerHtmlLightNodeThis(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function innerHtmlLightNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function innerHtmlLightNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'innerHtml', root: 'light'};\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\nexport function replaceChildrenLightNodeThis(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;\nexport function replaceChildrenLightNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function replaceChildrenLightNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n const option: ApplyNodeOptions = {position: 'replaceChildren', root: 'light'};\n if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);\n const opt = targetOrOptions || {};\n return applyNode('$this', {...opt, ...option});\n}\n\nexport function replaceChildrenNode(selector: string, options: Omit<ApplyNodeOptions, 'position'> = {}): MethodDecorator {\n return applyNode(selector, {...options, position: 'replaceChildren'});\n}\n\nexport function innerHtmlNode(selector: string, options: Omit<ApplyNodeOptions, 'position'> = {}): MethodDecorator {\n return applyNode(selector, {...options, position: 'innerHtml'});\n}\n\nexport function innerHtmlLightNode(selector: string, options: Omit<ApplyNodeOptions, 'position' | 'root'> = {}): MethodDecorator {\n return applyNode(selector, {...options, position: 'innerHtml', root: 'light'});\n}\n\nexport function innerHtmlShadowNode(selector: string, options: Omit<ApplyNodeOptions, 'position' | 'root'> = {}): MethodDecorator {\n return applyNode(selector, {...options, position: 'innerHtml', root: 'shadow'});\n}\n\nexport function innerTextNode(selector: string, options: Omit<ApplyNodeOptions, 'position'> = {}): MethodDecorator {\n return applyNode(selector, {...options, position: 'innerText'});\n}\n\nexport function innerTextLightNode(selector: string, options: Omit<ApplyNodeOptions, 'position' | 'root'> = {}): MethodDecorator {\n return applyNode(selector, {...options, position: 'innerText', root: 'light'});\n}\n\nexport function innerTextShadowNode(selector: string, options: Omit<ApplyNodeOptions, 'position' | 'root'> = {}): MethodDecorator {\n return applyNode(selector, {...options, position: 'innerText', root: 'shadow'});\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
|
|
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;AAsCpB,MAAM,0BAA0B,OAAO,IAAI,iCAAiC;AAUnF,MAAM,aAAa,CAAC,aAAkB,UAAuB,KAAoB,KAAwB,KAAa,SAAe;AACnI,MAAI,CAAC,SAAU;AAGf,MAAI,QAAQ,iBAAiB;AAC3B,aAAS,gBAAgB;AACzB,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,MAAM,IAAI;AAChB,QAAM,UAAU,sBAAS,oB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_exports, {
|
|
|
23
23
|
findAllPropertyApplyMetadata: () => findAllPropertyApplyMetadata,
|
|
24
24
|
findAllPropertyMetadata: () => findAllPropertyMetadata,
|
|
25
25
|
property: () => property,
|
|
26
|
-
propertyThis: () => propertyThis,
|
|
27
26
|
resolvePropertyTargets: () => resolvePropertyTargets,
|
|
28
|
-
setProperty: () => setProperty
|
|
29
|
-
setPropertyThis: () => setPropertyThis
|
|
27
|
+
setProperty: () => setProperty
|
|
30
28
|
});
|
|
31
29
|
module.exports = __toCommonJS(applyProperty_exports);
|
|
32
30
|
var import_core = require("@dooboostore/core");
|
|
@@ -131,13 +129,21 @@ function applyProperty(selector, targetPropertyKeyOrOptions, options) {
|
|
|
131
129
|
descriptor.value = function(...args) {
|
|
132
130
|
(0, import_elementDefine.ensureInit)(this);
|
|
133
131
|
const res = original.apply(this, args);
|
|
132
|
+
const extractValue = (v) => {
|
|
133
|
+
if (v && typeof v === "object" && PROPERTY_METADATA_KEY in v) {
|
|
134
|
+
return v[PROPERTY_METADATA_KEY];
|
|
135
|
+
}
|
|
136
|
+
return v;
|
|
137
|
+
};
|
|
134
138
|
if (res instanceof Promise) {
|
|
135
139
|
return res.then((v) => {
|
|
136
|
-
|
|
140
|
+
const extracted = extractValue(v);
|
|
141
|
+
applyValueToTargets(this, extracted);
|
|
137
142
|
return v;
|
|
138
143
|
});
|
|
139
144
|
} else {
|
|
140
|
-
|
|
145
|
+
const extracted = extractValue(res);
|
|
146
|
+
applyValueToTargets(this, extracted);
|
|
141
147
|
return res;
|
|
142
148
|
}
|
|
143
149
|
};
|
|
@@ -168,35 +174,20 @@ function applyProperty(selector, targetPropertyKeyOrOptions, options) {
|
|
|
168
174
|
});
|
|
169
175
|
};
|
|
170
176
|
}
|
|
171
|
-
function property(
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
function propertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
|
|
175
|
-
if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
176
|
-
return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
|
|
177
|
+
function property(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor) {
|
|
178
|
+
if (optionsOrDescriptor !== void 0 && (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol")) {
|
|
179
|
+
return applyProperty("$this", void 0, {})(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
177
180
|
}
|
|
178
|
-
if (typeof
|
|
179
|
-
return applyProperty(
|
|
180
|
-
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
181
|
-
return applyProperty("$this", void 0, targetOrOptions);
|
|
182
|
-
} else {
|
|
183
|
-
return applyProperty("$this", void 0, {});
|
|
181
|
+
if (typeof selectorOrTarget === "string") {
|
|
182
|
+
return applyProperty(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
184
183
|
}
|
|
184
|
+
return applyProperty("$this", void 0, selectorOrTarget);
|
|
185
185
|
}
|
|
186
|
-
function setProperty(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
function setPropertyThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
|
|
190
|
-
if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
191
|
-
return applyProperty("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
|
|
192
|
-
}
|
|
193
|
-
if (typeof targetOrOptions === "string" || typeof targetOrOptions === "symbol") {
|
|
194
|
-
return applyProperty("$this", targetOrOptions, propertyKeyOrOptions);
|
|
195
|
-
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
196
|
-
return applyProperty("$this", void 0, targetOrOptions);
|
|
197
|
-
} else {
|
|
198
|
-
return applyProperty("$this", void 0, {});
|
|
186
|
+
function setProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined) {
|
|
187
|
+
if (typeof selectorOrOptions === "string") {
|
|
188
|
+
return applyProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined);
|
|
199
189
|
}
|
|
190
|
+
return applyProperty("$this", void 0, selectorOrOptions);
|
|
200
191
|
}
|
|
201
192
|
const findAllPropertyMetadata = (target) => {
|
|
202
193
|
const actualTarget = target instanceof Function ? target : target.constructor;
|