@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
|
@@ -13,7 +13,7 @@ import {ElementApply} from "@dooboostore/core-web";
|
|
|
13
13
|
</p>
|
|
14
14
|
<!-- afterend -->
|
|
15
15
|
*/
|
|
16
|
-
export type ApplyNodePosition = 'beforeBegin' | 'afterBegin' | 'beforeEnd' | 'afterEnd' | 'replace' | 'replaceChildren' | 'innerHtml' | 'innerText' | 'remove';
|
|
16
|
+
export type ApplyNodePosition = 'beforeBegin' | 'afterBegin' | 'beforeEnd' | 'afterEnd' | 'replace' | 'replaceChildren' | 'innerHtml' | 'innerText' | 'remove' | 'clearChildren';
|
|
17
17
|
|
|
18
18
|
export interface ApplyNodeOptions {
|
|
19
19
|
position?: ApplyNodePosition;
|
|
@@ -27,6 +27,12 @@ export interface ApplyNodeOptions {
|
|
|
27
27
|
* Optional loading content to display while an async method is executing.
|
|
28
28
|
*/
|
|
29
29
|
fallback?: (helper: HelperHostSet) => any;
|
|
30
|
+
/**
|
|
31
|
+
* Custom key to extract value from return object.
|
|
32
|
+
* If not provided, uses APPLY_NODE_METADATA_KEY by default.
|
|
33
|
+
* Useful when multiple @applyNode decorators are on the same method.
|
|
34
|
+
*/
|
|
35
|
+
valueKey?: symbol | string;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
export interface ApplyNodeMetadata {
|
|
@@ -47,11 +53,17 @@ export const APPLY_NODE_METADATA_KEY = Symbol.for('simple-web-component:apply-no
|
|
|
47
53
|
|
|
48
54
|
const applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string, pos: ApplyNodePosition, win: Window, host?: any) => {
|
|
49
55
|
if (!targetEl) return;
|
|
56
|
+
|
|
57
|
+
// Handle clearChildren - ignore return value and always clear
|
|
58
|
+
if (pos === 'clearChildren') {
|
|
59
|
+
targetEl.replaceChildren();
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
|
|
50
63
|
const doc = win.document;
|
|
51
64
|
const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);
|
|
52
65
|
const id = currentThis._swcId;
|
|
53
66
|
|
|
54
|
-
|
|
55
67
|
const nodes: Node[] = [];
|
|
56
68
|
|
|
57
69
|
if (typeof res === 'string' && pos === 'innerHtml') {
|
|
@@ -64,8 +76,6 @@ const applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string,
|
|
|
64
76
|
|
|
65
77
|
SwcUtils.projectProcessHtml(id, nodes, doc);
|
|
66
78
|
|
|
67
|
-
|
|
68
|
-
|
|
69
79
|
const isShadowRoot = targetEl instanceof win.ShadowRoot;
|
|
70
80
|
// const nodes = normalizeNodes(res, doc);
|
|
71
81
|
if (pos === 'replace') {
|
|
@@ -95,8 +105,28 @@ const applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string,
|
|
|
95
105
|
|
|
96
106
|
/**
|
|
97
107
|
* @applyNode decorator to surgically add/replace nodes to a target element.
|
|
108
|
+
*
|
|
109
|
+
* Overloads:
|
|
110
|
+
* - applyNode(selector, options) - Apply to specific selector
|
|
111
|
+
* - applyNode(options) - Apply to $this (current element)
|
|
98
112
|
*/
|
|
99
|
-
export function applyNode(selector: string, options
|
|
113
|
+
export function applyNode(selector: string, options?: ApplyNodeOptions): MethodDecorator;
|
|
114
|
+
export function applyNode(options: ApplyNodeOptions): MethodDecorator;
|
|
115
|
+
export function applyNode(selectorOrOptions: string | ApplyNodeOptions, maybeOptions?: ApplyNodeOptions): MethodDecorator {
|
|
116
|
+
// Determine selector and options based on overload
|
|
117
|
+
let selector: string;
|
|
118
|
+
let options: ApplyNodeOptions;
|
|
119
|
+
|
|
120
|
+
if (typeof selectorOrOptions === 'string') {
|
|
121
|
+
// First overload: applyNode(selector, options)
|
|
122
|
+
selector = selectorOrOptions;
|
|
123
|
+
options = maybeOptions || {position: 'replaceChildren'};
|
|
124
|
+
} else {
|
|
125
|
+
// Second overload: applyNode(options) - default to $this
|
|
126
|
+
selector = '$this';
|
|
127
|
+
options = selectorOrOptions || {position: 'replaceChildren'};
|
|
128
|
+
}
|
|
129
|
+
|
|
100
130
|
return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
101
131
|
const constructor = targetObj.constructor;
|
|
102
132
|
let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor) as Map<string | symbol, ApplyNodeMetadata>;
|
|
@@ -140,6 +170,22 @@ export function applyNode(selector: string, options: ApplyNodeOptions = {positio
|
|
|
140
170
|
const targetEl = getTarget();
|
|
141
171
|
const res = original.apply(this, args);
|
|
142
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Extract value for this decorator from method return value
|
|
175
|
+
*
|
|
176
|
+
* If return value is an object with this decorator's key,
|
|
177
|
+
* use that value. Otherwise use the entire return value.
|
|
178
|
+
*
|
|
179
|
+
* Uses valueKey from options if provided, otherwise uses APPLY_NODE_METADATA_KEY.
|
|
180
|
+
*/
|
|
181
|
+
const extractValue = (v: any) => {
|
|
182
|
+
const keyToUse = options.valueKey ?? APPLY_NODE_METADATA_KEY;
|
|
183
|
+
if (v && typeof v === 'object' && keyToUse in v) {
|
|
184
|
+
return v[keyToUse];
|
|
185
|
+
}
|
|
186
|
+
return v;
|
|
187
|
+
};
|
|
188
|
+
|
|
143
189
|
const runApply = (target: any, val: any) => {
|
|
144
190
|
const pos = options.position || 'beforeEnd';
|
|
145
191
|
// Delegate HTML/node processing to applyToDom which centralizes
|
|
@@ -163,149 +209,384 @@ export function applyNode(selector: string, options: ApplyNodeOptions = {positio
|
|
|
163
209
|
|
|
164
210
|
if (res instanceof Promise) {
|
|
165
211
|
return res.then(finalRes => {
|
|
212
|
+
const extracted = extractValue(finalRes);
|
|
166
213
|
fallbackNodes.forEach((it: any)=>it.remove());
|
|
167
|
-
if (
|
|
214
|
+
if (extracted !== undefined && targetEl) runApply(targetEl, extracted);
|
|
168
215
|
return finalRes;
|
|
169
216
|
});
|
|
170
217
|
} else {
|
|
171
|
-
|
|
218
|
+
const extracted = extractValue(res);
|
|
219
|
+
if (extracted !== undefined && targetEl) runApply(targetEl, extracted);
|
|
172
220
|
return res;
|
|
173
221
|
}
|
|
174
222
|
};
|
|
175
223
|
};
|
|
176
224
|
}
|
|
177
225
|
|
|
178
|
-
|
|
179
|
-
export function applyNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
180
|
-
export function applyNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
181
|
-
const option: ApplyNodeOptions = {position: 'replaceChildren'};
|
|
182
|
-
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
183
|
-
const opt = targetOrOptions || {};
|
|
184
|
-
return applyNode('$this', {...option, ...opt});
|
|
185
|
-
}
|
|
226
|
+
// --- Overloaded convenience functions for common patterns ---
|
|
186
227
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
228
|
+
/**
|
|
229
|
+
* @replaceChildrenNode decorator - replaces children of target element
|
|
230
|
+
*
|
|
231
|
+
* Overloads:
|
|
232
|
+
* - replaceChildrenNode(selector, options) - Replace children of specific selector
|
|
233
|
+
* - replaceChildrenNode(options) - Replace children of $this (current element)
|
|
234
|
+
* - @replaceChildrenNode - Bare decorator, replaces children of $this
|
|
235
|
+
*/
|
|
236
|
+
export function replaceChildren(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
237
|
+
export function replaceChildren(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
238
|
+
export function replaceChildren(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
239
|
+
export function replaceChildren(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
240
|
+
// Bare decorator usage: @replaceChildrenNode
|
|
241
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
242
|
+
return applyNode({position: 'replaceChildren'})(selectorOrOptions, maybeOptions, descriptor);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (typeof selectorOrOptions === 'string') {
|
|
246
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'replaceChildren'});
|
|
247
|
+
}
|
|
248
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'replaceChildren'});
|
|
194
249
|
}
|
|
195
250
|
|
|
251
|
+
/**
|
|
252
|
+
* @clearChildrenNode decorator - clears all children of target element
|
|
253
|
+
*
|
|
254
|
+
* Overloads:
|
|
255
|
+
* - clearChildrenNode(selector, options) - Clear children of specific selector
|
|
256
|
+
* - clearChildrenNode(options) - Clear children of $this (current element)
|
|
257
|
+
* - @clearChildrenNode - Bare decorator, clears children of $this
|
|
258
|
+
*/
|
|
259
|
+
export function clearChildrenNode(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
260
|
+
export function clearChildrenNode(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
261
|
+
export function clearChildrenNode(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
262
|
+
export function clearChildrenNode(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
263
|
+
// Bare decorator usage: @clearChildrenNode
|
|
264
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
265
|
+
return applyNode({position: 'clearChildren'})(selectorOrOptions, maybeOptions, descriptor);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (typeof selectorOrOptions === 'string') {
|
|
269
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'clearChildren'});
|
|
270
|
+
}
|
|
271
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'clearChildren'});
|
|
272
|
+
}
|
|
196
273
|
|
|
274
|
+
// Alias for clearChildrenNode
|
|
275
|
+
export const clearNode = clearChildrenNode;
|
|
197
276
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
277
|
+
/**
|
|
278
|
+
* @innerHtmlNode decorator - sets innerHTML of target element
|
|
279
|
+
*
|
|
280
|
+
* Overloads:
|
|
281
|
+
* - innerHtmlNode(selector, options) - Set innerHTML of specific selector
|
|
282
|
+
* - innerHtmlNode(options) - Set innerHTML of $this (current element)
|
|
283
|
+
* - @innerHtmlNode - Bare decorator, sets innerHTML of $this
|
|
284
|
+
*/
|
|
285
|
+
export function innerHtml(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
286
|
+
export function innerHtml(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
287
|
+
export function innerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
288
|
+
export function innerHtml(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
289
|
+
// Bare decorator usage: @innerHtmlNode
|
|
290
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
291
|
+
return applyNode({position: 'innerHtml'})(selectorOrOptions, maybeOptions, descriptor);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (typeof selectorOrOptions === 'string') {
|
|
295
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerHtml'});
|
|
296
|
+
}
|
|
297
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerHtml'});
|
|
205
298
|
}
|
|
206
299
|
|
|
207
|
-
|
|
208
|
-
export
|
|
209
|
-
export function beforeEndLightNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
210
|
-
const option: ApplyNodeOptions = {position: 'beforeEnd', root: 'light'}
|
|
211
|
-
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
212
|
-
const opt = targetOrOptions || {};
|
|
213
|
-
return applyNode('$this', {...opt, ...option});
|
|
214
|
-
}
|
|
300
|
+
// Alias for innerHtmlNode
|
|
301
|
+
// export const setHtmlNode = innerHtml;
|
|
215
302
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
303
|
+
/**
|
|
304
|
+
* @innerHtmlLightNode decorator - sets innerHTML of light DOM element
|
|
305
|
+
*
|
|
306
|
+
* Overloads:
|
|
307
|
+
* - innerHtmlLightNode(selector, options) - Set innerHTML of specific selector in light DOM
|
|
308
|
+
* - innerHtmlLightNode(options) - Set innerHTML of $this in light DOM
|
|
309
|
+
* - @innerHtmlLightNode - Bare decorator, sets innerHTML of $this in light DOM
|
|
310
|
+
*/
|
|
311
|
+
export function innerHtmlLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
312
|
+
export function innerHtmlLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
313
|
+
export function innerHtmlLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
314
|
+
export function innerHtmlLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
315
|
+
// Bare decorator usage: @innerHtmlLightNode
|
|
316
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
317
|
+
return applyNode({position: 'innerHtml', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (typeof selectorOrOptions === 'string') {
|
|
321
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'light'});
|
|
322
|
+
}
|
|
323
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'light'});
|
|
223
324
|
}
|
|
224
325
|
|
|
225
|
-
export function afterBeginNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
226
|
-
export function afterBeginNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
227
|
-
export function afterBeginNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
228
|
-
const option: ApplyNodeOptions = {position: 'afterBegin'};
|
|
229
|
-
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
230
|
-
const opt = targetOrOptions || {};
|
|
231
|
-
return applyNode('$this', {...opt, ...option});
|
|
232
|
-
}
|
|
233
326
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
327
|
+
/**
|
|
328
|
+
* @innerHtmlShadowNode decorator - sets innerHTML of shadow DOM element
|
|
329
|
+
*
|
|
330
|
+
* Overloads:
|
|
331
|
+
* - innerHtmlShadowNode(selector, options) - Set innerHTML of specific selector in shadow DOM
|
|
332
|
+
* - innerHtmlShadowNode(options) - Set innerHTML of $this in shadow DOM
|
|
333
|
+
* - @innerHtmlShadowNode - Bare decorator, sets innerHTML of $this in shadow DOM
|
|
334
|
+
*/
|
|
335
|
+
export function innerHtmlShadow(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
336
|
+
export function innerHtmlShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
337
|
+
export function innerHtmlShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
338
|
+
export function innerHtmlShadow(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
339
|
+
// Bare decorator usage: @innerHtmlShadowNode
|
|
340
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
341
|
+
return applyNode({position: 'innerHtml', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (typeof selectorOrOptions === 'string') {
|
|
345
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'shadow'});
|
|
346
|
+
}
|
|
347
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'shadow'});
|
|
241
348
|
}
|
|
242
349
|
|
|
243
|
-
export function innerHtmlNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
244
|
-
export function innerHtmlNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
245
|
-
export function innerHtmlNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
246
|
-
const option: ApplyNodeOptions = {position: 'innerHtml'}
|
|
247
|
-
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
248
|
-
const opt = targetOrOptions || {};
|
|
249
|
-
return applyNode('$this', {...opt, ...option});
|
|
250
|
-
}
|
|
251
350
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
351
|
+
/**
|
|
352
|
+
* @innerTextNode decorator - sets innerText of target element
|
|
353
|
+
*
|
|
354
|
+
* Overloads:
|
|
355
|
+
* - innerTextNode(selector, options) - Set innerText of specific selector
|
|
356
|
+
* - innerTextNode(options) - Set innerText of $this (current element)
|
|
357
|
+
* - @innerTextNode - Bare decorator, sets innerText of $this
|
|
358
|
+
*/
|
|
359
|
+
export function innerText(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
360
|
+
export function innerText(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
361
|
+
export function innerText(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
362
|
+
export function innerText(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
363
|
+
// Bare decorator usage: @innerTextNode
|
|
364
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
365
|
+
return applyNode({position: 'innerText'})(selectorOrOptions, maybeOptions, descriptor);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (typeof selectorOrOptions === 'string') {
|
|
369
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerText'});
|
|
370
|
+
}
|
|
371
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerText'});
|
|
259
372
|
}
|
|
260
373
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* @innerTextLightNode decorator - sets innerText of light DOM element
|
|
377
|
+
*
|
|
378
|
+
* Overloads:
|
|
379
|
+
* - innerTextLightNode(selector, options) - Set innerText of specific selector in light DOM
|
|
380
|
+
* - innerTextLightNode(options) - Set innerText of $this in light DOM
|
|
381
|
+
* - @innerTextLightNode - Bare decorator, sets innerText of $this in light DOM
|
|
382
|
+
*/
|
|
383
|
+
export function innerTextLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
384
|
+
export function innerTextLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
385
|
+
export function innerTextLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
386
|
+
export function innerTextLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
387
|
+
// Bare decorator usage: @innerTextLightNode
|
|
388
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
389
|
+
return applyNode({position: 'innerText', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (typeof selectorOrOptions === 'string') {
|
|
393
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'light'});
|
|
394
|
+
}
|
|
395
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'light'});
|
|
268
396
|
}
|
|
269
397
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
398
|
+
/**
|
|
399
|
+
* @innerTextShadowNode decorator - sets innerText of shadow DOM element
|
|
400
|
+
*
|
|
401
|
+
* Overloads:
|
|
402
|
+
* - innerTextShadowNode(selector, options) - Set innerText of specific selector in shadow DOM
|
|
403
|
+
* - innerTextShadowNode(options) - Set innerText of $this in shadow DOM
|
|
404
|
+
* - @innerTextShadowNode - Bare decorator, sets innerText of $this in shadow DOM
|
|
405
|
+
*/
|
|
406
|
+
export function innerTextShadow(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
407
|
+
export function innerTextShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
408
|
+
export function innerTextShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
409
|
+
export function innerTextShadow(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
410
|
+
// Bare decorator usage: @innerTextShadowNode
|
|
411
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
412
|
+
return applyNode({position: 'innerText', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (typeof selectorOrOptions === 'string') {
|
|
416
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'shadow'});
|
|
417
|
+
}
|
|
418
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'shadow'});
|
|
277
419
|
}
|
|
278
420
|
|
|
279
|
-
|
|
280
|
-
|
|
421
|
+
/**
|
|
422
|
+
* @beforeEndNode decorator - appends nodes to target element
|
|
423
|
+
*
|
|
424
|
+
* Overloads:
|
|
425
|
+
* - beforeEndNode(selector, options) - Append to specific selector
|
|
426
|
+
* - beforeEndNode(options) - Append to $this (current element)
|
|
427
|
+
* - @beforeEndNode - Bare decorator, appends to $this
|
|
428
|
+
*/
|
|
429
|
+
export function insertBeforeEnd(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
430
|
+
export function insertBeforeEnd(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
431
|
+
export function insertBeforeEnd(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
432
|
+
export function insertBeforeEnd(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
433
|
+
// Bare decorator usage: @beforeEndNode
|
|
434
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
435
|
+
return applyNode({position: 'beforeEnd'})(selectorOrOptions, maybeOptions, descriptor);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
if (typeof selectorOrOptions === 'string') {
|
|
439
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'beforeEnd'});
|
|
440
|
+
}
|
|
441
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'beforeEnd'});
|
|
281
442
|
}
|
|
282
443
|
|
|
283
|
-
|
|
284
|
-
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @beforeEndLightNode decorator - appends nodes to light DOM element
|
|
447
|
+
*
|
|
448
|
+
* Overloads:
|
|
449
|
+
* - beforeEndLightNode(selector, options) - Append to specific selector in light DOM
|
|
450
|
+
* - beforeEndLightNode(options) - Append to $this in light DOM
|
|
451
|
+
* - @beforeEndLightNode - Bare decorator, appends to $this in light DOM
|
|
452
|
+
*/
|
|
453
|
+
export function insertBeforeEndLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
454
|
+
export function insertBeforeEndLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
455
|
+
export function insertBeforeEndLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
456
|
+
export function insertBeforeEndLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
457
|
+
// Bare decorator usage: @beforeEndLightNode
|
|
458
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
459
|
+
return applyNode({position: 'beforeEnd', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (typeof selectorOrOptions === 'string') {
|
|
463
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'light'});
|
|
464
|
+
}
|
|
465
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'light'});
|
|
285
466
|
}
|
|
286
467
|
|
|
287
|
-
|
|
288
|
-
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* @beforeEndShadowNode decorator - appends nodes to shadow DOM element
|
|
471
|
+
*
|
|
472
|
+
* Overloads:
|
|
473
|
+
* - beforeEndShadowNode(selector, options) - Append to specific selector in shadow DOM
|
|
474
|
+
* - beforeEndShadowNode(options) - Append to $this in shadow DOM
|
|
475
|
+
* - @beforeEndShadowNode - Bare decorator, appends to $this in shadow DOM
|
|
476
|
+
*/
|
|
477
|
+
export function insertBeforeEndShadow(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
478
|
+
export function insertBeforeEndShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
479
|
+
export function insertBeforeEndShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
480
|
+
export function insertBeforeEndShadow(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
481
|
+
// Bare decorator usage: @beforeEndShadowNode
|
|
482
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
483
|
+
return applyNode({position: 'beforeEnd', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (typeof selectorOrOptions === 'string') {
|
|
487
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'shadow'});
|
|
488
|
+
}
|
|
489
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'shadow'});
|
|
289
490
|
}
|
|
290
491
|
|
|
291
|
-
|
|
292
|
-
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* @afterBeginNode decorator - prepends nodes to target element
|
|
495
|
+
*
|
|
496
|
+
* Overloads:
|
|
497
|
+
* - afterBeginNode(selector, options) - Prepend to specific selector
|
|
498
|
+
* - afterBeginNode(options) - Prepend to $this (current element)
|
|
499
|
+
* - @afterBeginNode - Bare decorator, prepends to $this
|
|
500
|
+
*/
|
|
501
|
+
export function insertAfterBegin(selector: string, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
502
|
+
export function insertAfterBegin(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
503
|
+
export function insertAfterBegin(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
504
|
+
export function insertAfterBegin(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
505
|
+
// Bare decorator usage: @afterBeginNode
|
|
506
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
507
|
+
return applyNode({position: 'afterBegin'})(selectorOrOptions, maybeOptions, descriptor);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (typeof selectorOrOptions === 'string') {
|
|
511
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'afterBegin'});
|
|
512
|
+
}
|
|
513
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'afterBegin'});
|
|
293
514
|
}
|
|
294
515
|
|
|
295
|
-
|
|
296
|
-
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* @afterBeginLightNode decorator - prepends nodes to light DOM element
|
|
519
|
+
*
|
|
520
|
+
* Overloads:
|
|
521
|
+
* - afterBeginLightNode(selector, options) - Prepend to specific selector in light DOM
|
|
522
|
+
* - afterBeginLightNode(options) - Prepend to $this in light DOM
|
|
523
|
+
* - @afterBeginLightNode - Bare decorator, prepends to $this in light DOM
|
|
524
|
+
*/
|
|
525
|
+
export function insertAfterBeginLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
526
|
+
export function insertAfterBeginLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
527
|
+
export function insertAfterBeginLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
528
|
+
export function insertAfterBeginLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
529
|
+
// Bare decorator usage: @afterBeginLightNode
|
|
530
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
531
|
+
return applyNode({position: 'afterBegin', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if (typeof selectorOrOptions === 'string') {
|
|
535
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'afterBegin', root: 'light'});
|
|
536
|
+
}
|
|
537
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'afterBegin', root: 'light'});
|
|
297
538
|
}
|
|
298
539
|
|
|
299
|
-
|
|
300
|
-
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* @replaceChildrenLightNode decorator - replaces children of light DOM element
|
|
543
|
+
*
|
|
544
|
+
* Overloads:
|
|
545
|
+
* - replaceChildrenLightNode(selector, options) - Replace children of specific selector in light DOM
|
|
546
|
+
* - replaceChildrenLightNode(options) - Replace children of $this in light DOM
|
|
547
|
+
* - @replaceChildrenLightNode - Bare decorator, replaces children of $this in light DOM
|
|
548
|
+
*/
|
|
549
|
+
export function replaceChildrenLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
550
|
+
export function replaceChildrenLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
551
|
+
export function replaceChildrenLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
552
|
+
export function replaceChildrenLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
553
|
+
// Bare decorator usage: @replaceChildrenLightNode
|
|
554
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
555
|
+
return applyNode({position: 'replaceChildren', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (typeof selectorOrOptions === 'string') {
|
|
559
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'replaceChildren', root: 'light'});
|
|
560
|
+
}
|
|
561
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'replaceChildren', root: 'light'});
|
|
301
562
|
}
|
|
302
563
|
|
|
303
|
-
|
|
304
|
-
|
|
564
|
+
/**
|
|
565
|
+
* @clearChildrenLightNode decorator - clears children of light DOM element
|
|
566
|
+
*
|
|
567
|
+
* Overloads:
|
|
568
|
+
* - clearChildrenLightNode(selector, options) - Clear children of specific selector in light DOM
|
|
569
|
+
* - clearChildrenLightNode(options) - Clear children of $this in light DOM
|
|
570
|
+
* - @clearChildrenLightNode - Bare decorator, clears children of $this in light DOM
|
|
571
|
+
*/
|
|
572
|
+
export function clearChildrenLight(selector: string, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
573
|
+
export function clearChildrenLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
574
|
+
export function clearChildrenLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
575
|
+
export function clearChildrenLight(selectorOrOptions?: string | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
576
|
+
// Bare decorator usage: @clearChildrenLightNode
|
|
577
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
578
|
+
return applyNode({position: 'clearChildren', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
if (typeof selectorOrOptions === 'string') {
|
|
582
|
+
return applyNode(selectorOrOptions, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'clearChildren', root: 'light'});
|
|
583
|
+
}
|
|
584
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'clearChildren', root: 'light'});
|
|
305
585
|
}
|
|
306
586
|
|
|
307
587
|
|
|
308
588
|
|
|
589
|
+
|
|
309
590
|
export const findAllApplyNodeMetadata = (target: any): Map<string | symbol, ApplyNodeMetadata> => {
|
|
310
591
|
const result = new Map<string | symbol, ApplyNodeMetadata>();
|
|
311
592
|
const maps = ReflectUtils.findAllMetadata<Map<string | symbol, ApplyNodeMetadata>>(APPLY_NODE_METADATA_KEY, target);
|