@dooboostore/simple-web-component 1.0.43 → 1.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +312 -63
- package/dist/cjs/SwcAppEngine.js +3 -1
- package/dist/cjs/SwcAppEngine.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +66 -43
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +110 -43
- package/dist/cjs/decorators/applyClass.js.map +3 -3
- package/dist/cjs/decorators/applyNode.js +200 -112
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +49 -45
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +92 -37
- 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 +81 -31
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +80 -52
- 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 +5 -5
- package/dist/cjs/decorators/publishSwcAppMessage.js.map +3 -3
- package/dist/cjs/decorators/query.js +133 -147
- package/dist/cjs/decorators/query.js.map +3 -3
- package/dist/cjs/decorators/queryAll.js +143 -132
- 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/cjs/types/window.d.js.map +1 -1
- package/dist/esm/SwcAppEngine.js +3 -1
- package/dist/esm/SwcAppEngine.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +66 -43
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +110 -43
- package/dist/esm/decorators/applyClass.js.map +3 -3
- package/dist/esm/decorators/applyNode.js +200 -112
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +49 -45
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +92 -37
- 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 +79 -29
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js +80 -52
- 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 +5 -5
- package/dist/esm/decorators/publishSwcAppMessage.js.map +3 -3
- package/dist/esm/decorators/query.js +133 -147
- package/dist/esm/decorators/query.js.map +3 -3
- package/dist/esm/decorators/queryAll.js +143 -132
- 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 +1118 -633
- 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 +19 -15
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +45 -26
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +19 -38
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +175 -32
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +38 -25
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +10 -9
- 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 +6 -12
- 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 +1 -1
- package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +16 -29
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +16 -23
- 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 +1118 -633
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +1 -1
- package/src/SwcAppEngine.ts +3 -1
- package/src/decorators/addEventListener.ts +31 -25
- package/src/decorators/applyAttribute.ts +164 -86
- package/src/decorators/applyClass.ts +161 -41
- package/src/decorators/applyNode.ts +408 -108
- package/src/decorators/applyProperty.ts +100 -89
- package/src/decorators/applyStyle.ts +131 -37
- package/src/decorators/{changedAttributeThis.ts → changedAttribute.ts} +1 -1
- package/src/decorators/elementDefine.ts +96 -30
- package/src/decorators/emitCustomEvent.ts +92 -60
- package/src/decorators/index.ts +1 -1
- package/src/decorators/publishSwcAppMessage.ts +1 -1
- package/src/decorators/query.ts +155 -162
- package/src/decorators/queryAll.ts +157 -139
- 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/src/types/window.d.ts +3 -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,9 @@ 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
|
+
|
|
18
|
+
export type ApplyNodeSelector = string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null);
|
|
17
19
|
|
|
18
20
|
export interface ApplyNodeOptions {
|
|
19
21
|
position?: ApplyNodePosition;
|
|
@@ -37,12 +39,39 @@ export interface ApplyNodeOptions {
|
|
|
37
39
|
|
|
38
40
|
export interface ApplyNodeMetadata {
|
|
39
41
|
propertyKey: string | symbol;
|
|
40
|
-
selector:
|
|
42
|
+
selector: ApplyNodeSelector;
|
|
41
43
|
options: ApplyNodeOptions;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export const APPLY_NODE_METADATA_KEY = Symbol.for('simple-web-component:apply-node');
|
|
45
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Resolve selector to string or elements
|
|
50
|
+
* Handles function-based selectors and returns elements if applicable
|
|
51
|
+
*/
|
|
52
|
+
const resolveSelector = (selector: ApplyNodeSelector, inst: any, win: Window): string | HTMLElement | null => {
|
|
53
|
+
if (typeof selector === 'function') {
|
|
54
|
+
const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
|
|
55
|
+
const result = selector(inst, hostSet);
|
|
56
|
+
|
|
57
|
+
if (result instanceof win.Element) {
|
|
58
|
+
return result as HTMLElement;
|
|
59
|
+
}
|
|
60
|
+
if (result instanceof win.NodeList) {
|
|
61
|
+
return result.length > 0 ? (result[0] as HTMLElement) : null;
|
|
62
|
+
}
|
|
63
|
+
if (Array.isArray(result)) {
|
|
64
|
+
return result.length > 0 ? (result[0] as HTMLElement) : null;
|
|
65
|
+
}
|
|
66
|
+
if (result === null) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
// result must be a string at this point
|
|
70
|
+
return result as unknown as string;
|
|
71
|
+
}
|
|
72
|
+
return selector as string;
|
|
73
|
+
};
|
|
74
|
+
|
|
46
75
|
// const normalizeNodes = (res: any, doc: Document): Node[] => {
|
|
47
76
|
// const items = Array.isArray(res) ? res : [res];
|
|
48
77
|
// return items.map(it => {
|
|
@@ -53,11 +82,17 @@ export const APPLY_NODE_METADATA_KEY = Symbol.for('simple-web-component:apply-no
|
|
|
53
82
|
|
|
54
83
|
const applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string, pos: ApplyNodePosition, win: Window, host?: any) => {
|
|
55
84
|
if (!targetEl) return;
|
|
85
|
+
|
|
86
|
+
// Handle clearChildren - ignore return value and always clear
|
|
87
|
+
if (pos === 'clearChildren') {
|
|
88
|
+
targetEl.replaceChildren();
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
|
|
56
92
|
const doc = win.document;
|
|
57
93
|
const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);
|
|
58
94
|
const id = currentThis._swcId;
|
|
59
95
|
|
|
60
|
-
|
|
61
96
|
const nodes: Node[] = [];
|
|
62
97
|
|
|
63
98
|
if (typeof res === 'string' && pos === 'innerHtml') {
|
|
@@ -70,8 +105,6 @@ const applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string,
|
|
|
70
105
|
|
|
71
106
|
SwcUtils.projectProcessHtml(id, nodes, doc);
|
|
72
107
|
|
|
73
|
-
|
|
74
|
-
|
|
75
108
|
const isShadowRoot = targetEl instanceof win.ShadowRoot;
|
|
76
109
|
// const nodes = normalizeNodes(res, doc);
|
|
77
110
|
if (pos === 'replace') {
|
|
@@ -101,8 +134,28 @@ const applyToDom = (currentThis: any, targetEl: HTMLElement, res: Node | string,
|
|
|
101
134
|
|
|
102
135
|
/**
|
|
103
136
|
* @applyNode decorator to surgically add/replace nodes to a target element.
|
|
137
|
+
*
|
|
138
|
+
* Overloads:
|
|
139
|
+
* - applyNode(selector, options) - Apply to specific selector
|
|
140
|
+
* - applyNode(options) - Apply to $this (current element)
|
|
104
141
|
*/
|
|
105
|
-
export function applyNode(selector:
|
|
142
|
+
export function applyNode(selector: ApplyNodeSelector, options?: ApplyNodeOptions): MethodDecorator;
|
|
143
|
+
export function applyNode(options: ApplyNodeOptions): MethodDecorator;
|
|
144
|
+
export function applyNode(selectorOrOptions: ApplyNodeSelector | ApplyNodeOptions, maybeOptions?: ApplyNodeOptions): MethodDecorator {
|
|
145
|
+
// Determine selector and options based on overload
|
|
146
|
+
let selector: ApplyNodeSelector;
|
|
147
|
+
let options: ApplyNodeOptions;
|
|
148
|
+
|
|
149
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
150
|
+
// First overload: applyNode(selector, options)
|
|
151
|
+
selector = selectorOrOptions;
|
|
152
|
+
options = maybeOptions || {position: 'replaceChildren'};
|
|
153
|
+
} else {
|
|
154
|
+
// Second overload: applyNode(options) - default to $this
|
|
155
|
+
selector = '$this';
|
|
156
|
+
options = selectorOrOptions || {position: 'replaceChildren'};
|
|
157
|
+
}
|
|
158
|
+
|
|
106
159
|
return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
107
160
|
const constructor = targetObj.constructor;
|
|
108
161
|
let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor) as Map<string | symbol, ApplyNodeMetadata>;
|
|
@@ -132,15 +185,29 @@ export function applyNode(selector: string, options: ApplyNodeOptions = {positio
|
|
|
132
185
|
return t;
|
|
133
186
|
};
|
|
134
187
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
188
|
+
// Resolve selector if it's a function
|
|
189
|
+
const resolved = resolveSelector(selector, this, currentWin);
|
|
190
|
+
|
|
191
|
+
// If selector function returned an element directly, use it
|
|
192
|
+
if (resolved instanceof currentWin.Element) {
|
|
193
|
+
return applyRoot(resolved);
|
|
194
|
+
}
|
|
195
|
+
if (resolved === null) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Handle string selector
|
|
200
|
+
const stringSelector = resolved as string;
|
|
201
|
+
|
|
202
|
+
if (stringSelector === '$this') return applyRoot(this);
|
|
203
|
+
if (stringSelector === '$host') return applyRoot(hostSet.$host);
|
|
204
|
+
if (stringSelector === '$parentHost') return applyRoot(hostSet.$parentHost);
|
|
205
|
+
if (stringSelector === '$appHost') return applyRoot(hostSet.$appHost);
|
|
206
|
+
if (stringSelector === '$firstHost') return applyRoot(hostSet.$firstHost);
|
|
207
|
+
if (stringSelector === '$lastHost') return applyRoot(hostSet.$lastHost);
|
|
141
208
|
|
|
142
209
|
const targetRoot = applyRoot(this);
|
|
143
|
-
return targetRoot ? targetRoot.querySelector(
|
|
210
|
+
return targetRoot ? targetRoot.querySelector(stringSelector) : null;
|
|
144
211
|
};
|
|
145
212
|
|
|
146
213
|
const targetEl = getTarget();
|
|
@@ -199,137 +266,370 @@ export function applyNode(selector: string, options: ApplyNodeOptions = {positio
|
|
|
199
266
|
};
|
|
200
267
|
}
|
|
201
268
|
|
|
202
|
-
|
|
203
|
-
export function applyNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
204
|
-
export function applyNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
205
|
-
const option: ApplyNodeOptions = {position: 'replaceChildren'};
|
|
206
|
-
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
207
|
-
const opt = targetOrOptions || {};
|
|
208
|
-
return applyNode('$this', {...option, ...opt});
|
|
209
|
-
}
|
|
269
|
+
// --- Overloaded convenience functions for common patterns ---
|
|
210
270
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
271
|
+
/**
|
|
272
|
+
* @replaceChildrenNode decorator - replaces children of target element
|
|
273
|
+
*
|
|
274
|
+
* Overloads:
|
|
275
|
+
* - replaceChildrenNode(selector, options) - Replace children of specific selector
|
|
276
|
+
* - replaceChildrenNode(options) - Replace children of $this (current element)
|
|
277
|
+
* - @replaceChildrenNode - Bare decorator, replaces children of $this
|
|
278
|
+
*/
|
|
279
|
+
export function replaceChildren(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
280
|
+
export function replaceChildren(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
281
|
+
export function replaceChildren(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
282
|
+
export function replaceChildren(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
283
|
+
// Bare decorator usage: @replaceChildrenNode
|
|
284
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
285
|
+
return applyNode({position: 'replaceChildren'})(selectorOrOptions, maybeOptions, descriptor);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
289
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'replaceChildren'});
|
|
290
|
+
}
|
|
291
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'replaceChildren'});
|
|
218
292
|
}
|
|
219
293
|
|
|
294
|
+
/**
|
|
295
|
+
* @clearChildrenNode decorator - clears all children of target element
|
|
296
|
+
*
|
|
297
|
+
* Overloads:
|
|
298
|
+
* - clearChildrenNode(selector, options) - Clear children of specific selector
|
|
299
|
+
* - clearChildrenNode(options) - Clear children of $this (current element)
|
|
300
|
+
* - @clearChildrenNode - Bare decorator, clears children of $this
|
|
301
|
+
*/
|
|
302
|
+
export function clearChildrenNode(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
303
|
+
export function clearChildrenNode(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
304
|
+
export function clearChildrenNode(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
305
|
+
export function clearChildrenNode(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
306
|
+
// Bare decorator usage: @clearChildrenNode
|
|
307
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
308
|
+
return applyNode({position: 'clearChildren'})(selectorOrOptions, maybeOptions, descriptor);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
312
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'clearChildren'});
|
|
313
|
+
}
|
|
314
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'clearChildren'});
|
|
315
|
+
}
|
|
220
316
|
|
|
317
|
+
// Alias for clearChildrenNode
|
|
318
|
+
export const clearNode = clearChildrenNode;
|
|
221
319
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
320
|
+
/**
|
|
321
|
+
* @innerHtmlNode decorator - sets innerHTML of target element
|
|
322
|
+
*
|
|
323
|
+
* Overloads:
|
|
324
|
+
* - innerHtmlNode(selector, options) - Set innerHTML of specific selector
|
|
325
|
+
* - innerHtmlNode(options) - Set innerHTML of $this (current element)
|
|
326
|
+
* - @innerHtmlNode - Bare decorator, sets innerHTML of $this
|
|
327
|
+
*/
|
|
328
|
+
export function innerHtml(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
329
|
+
export function innerHtml(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
330
|
+
export function innerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
331
|
+
export function innerHtml(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
332
|
+
// Bare decorator usage: @innerHtmlNode
|
|
333
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
334
|
+
return applyNode({position: 'innerHtml'})(selectorOrOptions, maybeOptions, descriptor);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
338
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerHtml'});
|
|
339
|
+
}
|
|
340
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerHtml'});
|
|
229
341
|
}
|
|
230
342
|
|
|
231
|
-
|
|
232
|
-
export
|
|
233
|
-
export function beforeEndLightNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
234
|
-
const option: ApplyNodeOptions = {position: 'beforeEnd', root: 'light'}
|
|
235
|
-
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
236
|
-
const opt = targetOrOptions || {};
|
|
237
|
-
return applyNode('$this', {...opt, ...option});
|
|
238
|
-
}
|
|
343
|
+
// Alias for innerHtmlNode
|
|
344
|
+
// export const setHtmlNode = innerHtml;
|
|
239
345
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
346
|
+
/**
|
|
347
|
+
* @innerHtmlLightNode decorator - sets innerHTML of light DOM element
|
|
348
|
+
*
|
|
349
|
+
* Overloads:
|
|
350
|
+
* - innerHtmlLightNode(selector, options) - Set innerHTML of specific selector in light DOM
|
|
351
|
+
* - innerHtmlLightNode(options) - Set innerHTML of $this in light DOM
|
|
352
|
+
* - @innerHtmlLightNode - Bare decorator, sets innerHTML of $this in light DOM
|
|
353
|
+
*/
|
|
354
|
+
export function innerHtmlLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
355
|
+
export function innerHtmlLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
356
|
+
export function innerHtmlLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
357
|
+
export function innerHtmlLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
358
|
+
// Bare decorator usage: @innerHtmlLightNode
|
|
359
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
360
|
+
return applyNode({position: 'innerHtml', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
364
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'light'});
|
|
365
|
+
}
|
|
366
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'light'});
|
|
247
367
|
}
|
|
248
368
|
|
|
249
|
-
export function afterBeginNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
250
|
-
export function afterBeginNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
251
|
-
export function afterBeginNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
252
|
-
const option: ApplyNodeOptions = {position: 'afterBegin'};
|
|
253
|
-
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
254
|
-
const opt = targetOrOptions || {};
|
|
255
|
-
return applyNode('$this', {...opt, ...option});
|
|
256
|
-
}
|
|
257
369
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
370
|
+
/**
|
|
371
|
+
* @innerHtmlShadowNode decorator - sets innerHTML of shadow DOM element
|
|
372
|
+
*
|
|
373
|
+
* Overloads:
|
|
374
|
+
* - innerHtmlShadowNode(selector, options) - Set innerHTML of specific selector in shadow DOM
|
|
375
|
+
* - innerHtmlShadowNode(options) - Set innerHTML of $this in shadow DOM
|
|
376
|
+
* - @innerHtmlShadowNode - Bare decorator, sets innerHTML of $this in shadow DOM
|
|
377
|
+
*/
|
|
378
|
+
export function innerHtmlShadow(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
379
|
+
export function innerHtmlShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
380
|
+
export function innerHtmlShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
381
|
+
export function innerHtmlShadow(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
382
|
+
// Bare decorator usage: @innerHtmlShadowNode
|
|
383
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
384
|
+
return applyNode({position: 'innerHtml', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
388
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'shadow'});
|
|
389
|
+
}
|
|
390
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerHtml', root: 'shadow'});
|
|
265
391
|
}
|
|
266
392
|
|
|
267
|
-
export function innerHtmlNodeThis(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
268
|
-
export function innerHtmlNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
269
|
-
export function innerHtmlNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
270
|
-
const option: ApplyNodeOptions = {position: 'innerHtml'}
|
|
271
|
-
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
272
|
-
const opt = targetOrOptions || {};
|
|
273
|
-
return applyNode('$this', {...opt, ...option});
|
|
274
|
-
}
|
|
275
393
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
394
|
+
/**
|
|
395
|
+
* @innerTextNode decorator - sets innerText of target element
|
|
396
|
+
*
|
|
397
|
+
* Overloads:
|
|
398
|
+
* - innerTextNode(selector, options) - Set innerText of specific selector
|
|
399
|
+
* - innerTextNode(options) - Set innerText of $this (current element)
|
|
400
|
+
* - @innerTextNode - Bare decorator, sets innerText of $this
|
|
401
|
+
*/
|
|
402
|
+
export function innerText(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
403
|
+
export function innerText(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
404
|
+
export function innerText(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
405
|
+
export function innerText(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
406
|
+
// Bare decorator usage: @innerTextNode
|
|
407
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
408
|
+
return applyNode({position: 'innerText'})(selectorOrOptions, maybeOptions, descriptor);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
412
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerText'});
|
|
413
|
+
}
|
|
414
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'innerText'});
|
|
283
415
|
}
|
|
284
416
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* @innerTextLightNode decorator - sets innerText of light DOM element
|
|
420
|
+
*
|
|
421
|
+
* Overloads:
|
|
422
|
+
* - innerTextLightNode(selector, options) - Set innerText of specific selector in light DOM
|
|
423
|
+
* - innerTextLightNode(options) - Set innerText of $this in light DOM
|
|
424
|
+
* - @innerTextLightNode - Bare decorator, sets innerText of $this in light DOM
|
|
425
|
+
*/
|
|
426
|
+
export function innerTextLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
427
|
+
export function innerTextLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
428
|
+
export function innerTextLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
429
|
+
export function innerTextLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
430
|
+
// Bare decorator usage: @innerTextLightNode
|
|
431
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
432
|
+
return applyNode({position: 'innerText', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
436
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'light'});
|
|
437
|
+
}
|
|
438
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'light'});
|
|
292
439
|
}
|
|
293
440
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
441
|
+
/**
|
|
442
|
+
* @innerTextShadowNode decorator - sets innerText of shadow DOM element
|
|
443
|
+
*
|
|
444
|
+
* Overloads:
|
|
445
|
+
* - innerTextShadowNode(selector, options) - Set innerText of specific selector in shadow DOM
|
|
446
|
+
* - innerTextShadowNode(options) - Set innerText of $this in shadow DOM
|
|
447
|
+
* - @innerTextShadowNode - Bare decorator, sets innerText of $this in shadow DOM
|
|
448
|
+
*/
|
|
449
|
+
export function innerTextShadow(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
450
|
+
export function innerTextShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
451
|
+
export function innerTextShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
452
|
+
export function innerTextShadow(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
453
|
+
// Bare decorator usage: @innerTextShadowNode
|
|
454
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
455
|
+
return applyNode({position: 'innerText', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
459
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'shadow'});
|
|
460
|
+
}
|
|
461
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'innerText', root: 'shadow'});
|
|
301
462
|
}
|
|
302
463
|
|
|
303
|
-
|
|
304
|
-
|
|
464
|
+
/**
|
|
465
|
+
* @beforeEndNode decorator - appends nodes to target element
|
|
466
|
+
*
|
|
467
|
+
* Overloads:
|
|
468
|
+
* - beforeEndNode(selector, options) - Append to specific selector
|
|
469
|
+
* - beforeEndNode(options) - Append to $this (current element)
|
|
470
|
+
* - @beforeEndNode - Bare decorator, appends to $this
|
|
471
|
+
*/
|
|
472
|
+
export function insertBeforeEnd(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
473
|
+
export function insertBeforeEnd(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
474
|
+
export function insertBeforeEnd(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
475
|
+
export function insertBeforeEnd(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
476
|
+
// Bare decorator usage: @beforeEndNode
|
|
477
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
478
|
+
return applyNode({position: 'beforeEnd'})(selectorOrOptions, maybeOptions, descriptor);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
482
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'beforeEnd'});
|
|
483
|
+
}
|
|
484
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'beforeEnd'});
|
|
305
485
|
}
|
|
306
486
|
|
|
307
|
-
|
|
308
|
-
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* @beforeEndLightNode decorator - appends nodes to light DOM element
|
|
490
|
+
*
|
|
491
|
+
* Overloads:
|
|
492
|
+
* - beforeEndLightNode(selector, options) - Append to specific selector in light DOM
|
|
493
|
+
* - beforeEndLightNode(options) - Append to $this in light DOM
|
|
494
|
+
* - @beforeEndLightNode - Bare decorator, appends to $this in light DOM
|
|
495
|
+
*/
|
|
496
|
+
export function insertBeforeEndLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
497
|
+
export function insertBeforeEndLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
498
|
+
export function insertBeforeEndLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
499
|
+
export function insertBeforeEndLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
500
|
+
// Bare decorator usage: @beforeEndLightNode
|
|
501
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
502
|
+
return applyNode({position: 'beforeEnd', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
506
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'light'});
|
|
507
|
+
}
|
|
508
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'light'});
|
|
309
509
|
}
|
|
310
510
|
|
|
311
|
-
|
|
312
|
-
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @beforeEndShadowNode decorator - appends nodes to shadow DOM element
|
|
514
|
+
*
|
|
515
|
+
* Overloads:
|
|
516
|
+
* - beforeEndShadowNode(selector, options) - Append to specific selector in shadow DOM
|
|
517
|
+
* - beforeEndShadowNode(options) - Append to $this in shadow DOM
|
|
518
|
+
* - @beforeEndShadowNode - Bare decorator, appends to $this in shadow DOM
|
|
519
|
+
*/
|
|
520
|
+
export function insertBeforeEndShadow(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
521
|
+
export function insertBeforeEndShadow(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
522
|
+
export function insertBeforeEndShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
523
|
+
export function insertBeforeEndShadow(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
524
|
+
// Bare decorator usage: @beforeEndShadowNode
|
|
525
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
526
|
+
return applyNode({position: 'beforeEnd', root: 'shadow'})(selectorOrOptions, maybeOptions, descriptor);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
530
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'shadow'});
|
|
531
|
+
}
|
|
532
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'beforeEnd', root: 'shadow'});
|
|
313
533
|
}
|
|
314
534
|
|
|
315
|
-
|
|
316
|
-
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* @afterBeginNode decorator - prepends nodes to target element
|
|
538
|
+
*
|
|
539
|
+
* Overloads:
|
|
540
|
+
* - afterBeginNode(selector, options) - Prepend to specific selector
|
|
541
|
+
* - afterBeginNode(options) - Prepend to $this (current element)
|
|
542
|
+
* - @afterBeginNode - Bare decorator, prepends to $this
|
|
543
|
+
*/
|
|
544
|
+
export function insertAfterBegin(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
545
|
+
export function insertAfterBegin(options?: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
546
|
+
export function insertAfterBegin(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
547
|
+
export function insertAfterBegin(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
548
|
+
// Bare decorator usage: @afterBeginNode
|
|
549
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
550
|
+
return applyNode({position: 'afterBegin'})(selectorOrOptions, maybeOptions, descriptor);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
554
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position'>, position: 'afterBegin'});
|
|
555
|
+
}
|
|
556
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position'>, position: 'afterBegin'});
|
|
317
557
|
}
|
|
318
558
|
|
|
319
|
-
|
|
320
|
-
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* @afterBeginLightNode decorator - prepends nodes to light DOM element
|
|
562
|
+
*
|
|
563
|
+
* Overloads:
|
|
564
|
+
* - afterBeginLightNode(selector, options) - Prepend to specific selector in light DOM
|
|
565
|
+
* - afterBeginLightNode(options) - Prepend to $this in light DOM
|
|
566
|
+
* - @afterBeginLightNode - Bare decorator, prepends to $this in light DOM
|
|
567
|
+
*/
|
|
568
|
+
export function insertAfterBeginLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
569
|
+
export function insertAfterBeginLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
570
|
+
export function insertAfterBeginLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
571
|
+
export function insertAfterBeginLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
572
|
+
// Bare decorator usage: @afterBeginLightNode
|
|
573
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
574
|
+
return applyNode({position: 'afterBegin', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
578
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'afterBegin', root: 'light'});
|
|
579
|
+
}
|
|
580
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'afterBegin', root: 'light'});
|
|
321
581
|
}
|
|
322
582
|
|
|
323
|
-
|
|
324
|
-
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* @replaceChildrenLightNode decorator - replaces children of light DOM element
|
|
586
|
+
*
|
|
587
|
+
* Overloads:
|
|
588
|
+
* - replaceChildrenLightNode(selector, options) - Replace children of specific selector in light DOM
|
|
589
|
+
* - replaceChildrenLightNode(options) - Replace children of $this in light DOM
|
|
590
|
+
* - @replaceChildrenLightNode - Bare decorator, replaces children of $this in light DOM
|
|
591
|
+
*/
|
|
592
|
+
export function replaceChildrenLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
593
|
+
export function replaceChildrenLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
594
|
+
export function replaceChildrenLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
595
|
+
export function replaceChildrenLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
596
|
+
// Bare decorator usage: @replaceChildrenLightNode
|
|
597
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
598
|
+
return applyNode({position: 'replaceChildren', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
602
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'replaceChildren', root: 'light'});
|
|
603
|
+
}
|
|
604
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'replaceChildren', root: 'light'});
|
|
325
605
|
}
|
|
326
606
|
|
|
327
|
-
|
|
328
|
-
|
|
607
|
+
/**
|
|
608
|
+
* @clearChildrenLightNode decorator - clears children of light DOM element
|
|
609
|
+
*
|
|
610
|
+
* Overloads:
|
|
611
|
+
* - clearChildrenLightNode(selector, options) - Clear children of specific selector in light DOM
|
|
612
|
+
* - clearChildrenLightNode(options) - Clear children of $this in light DOM
|
|
613
|
+
* - @clearChildrenLightNode - Bare decorator, clears children of $this in light DOM
|
|
614
|
+
*/
|
|
615
|
+
export function clearChildrenLight(selector: ApplyNodeSelector, options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
616
|
+
export function clearChildrenLight(options?: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
617
|
+
export function clearChildrenLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;
|
|
618
|
+
export function clearChildrenLight(selectorOrOptions?: ApplyNodeSelector | Omit<ApplyNodeOptions, 'position' | 'root'> | Object, maybeOptions?: Omit<ApplyNodeOptions, 'position' | 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | PropertyDescriptor | void {
|
|
619
|
+
// Bare decorator usage: @clearChildrenLightNode
|
|
620
|
+
if (descriptor !== undefined && (typeof maybeOptions === 'symbol' || typeof maybeOptions === 'string')) {
|
|
621
|
+
return applyNode({position: 'clearChildren', root: 'light'})(selectorOrOptions, maybeOptions, descriptor);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {
|
|
625
|
+
return applyNode(selectorOrOptions as ApplyNodeSelector, {...maybeOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'clearChildren', root: 'light'});
|
|
626
|
+
}
|
|
627
|
+
return applyNode({...selectorOrOptions as Omit<ApplyNodeOptions, 'position' | 'root'>, position: 'clearChildren', root: 'light'});
|
|
329
628
|
}
|
|
330
629
|
|
|
331
630
|
|
|
332
631
|
|
|
632
|
+
|
|
333
633
|
export const findAllApplyNodeMetadata = (target: any): Map<string | symbol, ApplyNodeMetadata> => {
|
|
334
634
|
const result = new Map<string | symbol, ApplyNodeMetadata>();
|
|
335
635
|
const maps = ReflectUtils.findAllMetadata<Map<string | symbol, ApplyNodeMetadata>>(APPLY_NODE_METADATA_KEY, target);
|