@dooboostore/simple-web-component 1.0.36 → 1.0.38
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 +396 -68
- package/dist/cjs/{elements/SwcAppEngine.js → SwcAppEngine.js} +9 -6
- package/dist/cjs/SwcAppEngine.js.map +7 -0
- package/dist/cjs/decorators/addEventListener.js +20 -4
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js.map +1 -1
- package/dist/cjs/decorators/applyClass.js.map +1 -1
- package/dist/cjs/decorators/applyNode.js +109 -26
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +129 -0
- package/dist/cjs/decorators/applySlot.js.map +7 -0
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/attribute.js.map +1 -1
- package/dist/cjs/decorators/elementDefine.js +90 -52
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/emitCustomEvent.js.map +1 -1
- package/dist/cjs/decorators/index.js +2 -0
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +88 -24
- package/dist/cjs/decorators/lifecycles.js.map +3 -3
- package/dist/cjs/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/cjs/decorators/query.js +1 -1
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js.map +1 -1
- package/dist/cjs/decorators/setProperty.js.map +1 -1
- package/dist/cjs/decorators/state.js +84 -0
- package/dist/cjs/decorators/state.js.map +7 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/elements/SwcApp.js +231 -0
- package/dist/cjs/elements/SwcApp.js.map +7 -0
- package/dist/cjs/elements/SwcAppMixin.js +78 -80
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/elements/index.js +2 -1
- package/dist/cjs/elements/index.js.map +2 -2
- package/dist/cjs/elements/tt/SwcAppMixin.js +1 -0
- package/dist/cjs/elements/tt/SwcAppMixin.js.map +7 -0
- package/dist/cjs/elements/tt/SwcAsync.js +1 -0
- package/dist/cjs/elements/tt/SwcAsync.js.map +7 -0
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js +1 -0
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +7 -0
- package/dist/cjs/elements/tt/SwcChoose.js +1 -0
- package/dist/cjs/elements/tt/SwcChoose.js.map +7 -0
- package/dist/cjs/elements/tt/SwcChooseTemplate.js +1 -0
- package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +7 -0
- package/dist/cjs/elements/tt/SwcIf.js +1 -0
- package/dist/cjs/elements/tt/SwcIf.js.map +7 -0
- package/dist/cjs/elements/tt/SwcIfTemplate.js +1 -0
- package/dist/cjs/elements/tt/SwcIfTemplate.js.map +7 -0
- package/dist/cjs/elements/tt/SwcLoop.js +1 -0
- package/dist/cjs/elements/tt/SwcLoop.js.map +7 -0
- package/dist/cjs/elements/tt/SwcLoopTemplate.js +1 -0
- package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +7 -0
- package/dist/cjs/elements/tt/SwcSubTemplates.js +1 -0
- package/dist/cjs/elements/tt/SwcSubTemplates.js.map +7 -0
- package/dist/cjs/elements/tt/register.js +1 -0
- package/dist/cjs/elements/tt/register.js.map +7 -0
- package/dist/cjs/index.js +10 -8
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/{types.js → types/index.js} +1 -1
- package/dist/cjs/types/index.js.map +7 -0
- package/dist/cjs/types/window.d.js +16 -0
- package/dist/cjs/types/window.d.js.map +7 -0
- package/dist/cjs/utils/Utils.js +168 -26
- package/dist/cjs/utils/Utils.js.map +3 -3
- package/dist/esm/{elements/SwcAppEngine.js → SwcAppEngine.js} +7 -4
- package/dist/esm/SwcAppEngine.js.map +7 -0
- package/dist/esm/decorators/addEventListener.js +20 -4
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js.map +1 -1
- package/dist/esm/decorators/applyClass.js.map +1 -1
- package/dist/esm/decorators/applyNode.js +109 -26
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +110 -0
- package/dist/esm/decorators/applySlot.js.map +7 -0
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/attribute.js.map +1 -1
- package/dist/esm/decorators/elementDefine.js +96 -58
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js.map +1 -1
- package/dist/esm/decorators/index.js +2 -0
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +88 -24
- package/dist/esm/decorators/lifecycles.js.map +3 -3
- package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/esm/decorators/query.js +1 -1
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js.map +1 -1
- package/dist/esm/decorators/setProperty.js.map +1 -1
- package/dist/esm/decorators/state.js +65 -0
- package/dist/esm/decorators/state.js.map +7 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/elements/SwcApp.js +212 -0
- package/dist/esm/elements/SwcApp.js.map +7 -0
- package/dist/esm/elements/SwcAppMixin.js +76 -78
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/elements/index.js +2 -1
- package/dist/esm/elements/index.js.map +2 -2
- package/dist/esm/elements/tt/SwcAppMixin.js +1 -0
- package/dist/esm/elements/tt/SwcAppMixin.js.map +7 -0
- package/dist/esm/elements/tt/SwcAsync.js +1 -0
- package/dist/esm/elements/tt/SwcAsync.js.map +7 -0
- package/dist/esm/elements/tt/SwcAsyncTemplate.js +1 -0
- package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +7 -0
- package/dist/esm/elements/tt/SwcChoose.js +1 -0
- package/dist/esm/elements/tt/SwcChoose.js.map +7 -0
- package/dist/esm/elements/tt/SwcChooseTemplate.js +1 -0
- package/dist/esm/elements/tt/SwcChooseTemplate.js.map +7 -0
- package/dist/esm/elements/tt/SwcIf.js +1 -0
- package/dist/esm/elements/tt/SwcIf.js.map +7 -0
- package/dist/esm/elements/tt/SwcIfTemplate.js +1 -0
- package/dist/esm/elements/tt/SwcIfTemplate.js.map +7 -0
- package/dist/esm/elements/tt/SwcLoop.js +1 -0
- package/dist/esm/elements/tt/SwcLoop.js.map +7 -0
- package/dist/esm/elements/tt/SwcLoopTemplate.js +1 -0
- package/dist/esm/elements/tt/SwcLoopTemplate.js.map +7 -0
- package/dist/esm/elements/tt/SwcSubTemplates.js +1 -0
- package/dist/esm/elements/tt/SwcSubTemplates.js.map +7 -0
- package/dist/esm/elements/tt/register.js +1 -0
- package/dist/esm/elements/tt/register.js.map +7 -0
- package/dist/esm/index.js +11 -9
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/{types.js → types/index.js} +1 -1
- package/dist/esm/types/index.js.map +7 -0
- package/dist/esm/types/window.d.js +1 -0
- package/dist/esm/types/window.d.js.map +7 -0
- package/dist/esm/utils/Utils.js +168 -26
- package/dist/esm/utils/Utils.js.map +3 -3
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +7477 -2828
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/{elements/SwcAppEngine.d.ts → SwcAppEngine.d.ts} +9 -4
- package/dist/types/SwcAppEngine.d.ts.map +1 -0
- package/dist/types/decorators/addEventListener.d.ts +5 -2
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +24 -8
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applySlot.d.ts +27 -0
- package/dist/types/decorators/applySlot.d.ts.map +1 -0
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/attribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +2 -0
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +26 -15
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +1 -1
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/setProperty.d.ts +1 -1
- package/dist/types/decorators/setProperty.d.ts.map +1 -1
- package/dist/types/decorators/state.d.ts +9 -0
- package/dist/types/decorators/state.d.ts.map +1 -0
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +5 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/elements/SwcApp.d.ts +36 -0
- package/dist/types/elements/SwcApp.d.ts.map +1 -0
- package/dist/types/elements/SwcAppMixin.d.ts +26 -7
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/elements/index.d.ts +2 -1
- package/dist/types/elements/index.d.ts.map +1 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts +1 -0
- package/dist/types/elements/tt/SwcAppMixin.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcAsync.d.ts +1 -0
- package/dist/types/elements/tt/SwcAsync.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +1 -0
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcChoose.d.ts +1 -0
- package/dist/types/elements/tt/SwcChoose.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts +1 -0
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcIf.d.ts +1 -0
- package/dist/types/elements/{SwcIf.d.ts.map → tt/SwcIf.d.ts.map} +1 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts +1 -0
- package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcLoop.d.ts +1 -0
- package/dist/types/elements/tt/SwcLoop.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts +1 -0
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +1 -0
- package/dist/types/elements/tt/SwcSubTemplates.d.ts +1 -0
- package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +1 -0
- package/dist/types/elements/tt/register.d.ts +1 -0
- package/dist/types/elements/tt/register.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/{types.d.ts → types/index.d.ts} +12 -12
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/utils/Utils.d.ts +18 -5
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +7478 -2829
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +4 -4
- package/src/{elements/SwcAppEngine.ts → SwcAppEngine.ts} +17 -8
- package/src/decorators/addEventListener.ts +21 -5
- package/src/decorators/applyAttribute.ts +1 -1
- package/src/decorators/applyClass.ts +1 -1
- package/src/decorators/applyNode.ts +186 -66
- package/src/decorators/applySlot.ts +188 -0
- package/src/decorators/applyStyle.ts +4 -4
- package/src/decorators/attribute.ts +1 -1
- package/src/decorators/elementDefine.ts +142 -68
- package/src/decorators/emitCustomEvent.ts +1 -1
- package/src/decorators/index.ts +3 -0
- package/src/decorators/lifecycles.ts +119 -30
- package/src/decorators/publishSwcAppMessage.ts +2 -3
- package/src/decorators/query.ts +4 -4
- package/src/decorators/queryAll.ts +1 -1
- package/src/decorators/setProperty.ts +1 -1
- package/src/decorators/state.ts +84 -0
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -1
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +4 -3
- package/src/elements/SwcApp.ts +241 -0
- package/src/elements/SwcAppMixin.ts +98 -146
- package/src/elements/index.ts +4 -1
- package/src/elements/tt/SwcAppMixin.ts +13 -0
- package/src/elements/tt/SwcAsync.ts +139 -0
- package/src/elements/tt/SwcAsyncTemplate.ts +126 -0
- package/src/elements/tt/SwcChoose.ts +182 -0
- package/src/elements/tt/SwcChooseTemplate.ts +229 -0
- package/src/elements/tt/SwcIf.ts +145 -0
- package/src/elements/tt/SwcIfTemplate.ts +158 -0
- package/src/elements/tt/SwcLoop.ts +222 -0
- package/src/elements/tt/SwcLoopTemplate.ts +255 -0
- package/src/elements/tt/SwcSubTemplates.ts +6 -0
- package/src/elements/tt/register.ts +720 -0
- package/src/index.ts +11 -9
- package/src/{types.ts → types/index.ts} +15 -11
- package/src/types/window.d.ts +46 -0
- package/src/utils/Utils.ts +214 -24
- package/dist/cjs/elements/SwcAppEngine.js.map +0 -7
- package/dist/cjs/elements/SwcAsync.js +0 -129
- package/dist/cjs/elements/SwcAsync.js.map +0 -7
- package/dist/cjs/elements/SwcChoose.js +0 -155
- package/dist/cjs/elements/SwcChoose.js.map +0 -7
- package/dist/cjs/elements/SwcIf.js +0 -117
- package/dist/cjs/elements/SwcIf.js.map +0 -7
- package/dist/cjs/elements/SwcLoop.js +0 -176
- package/dist/cjs/elements/SwcLoop.js.map +0 -7
- package/dist/cjs/elements/SwcSubTemplates.js +0 -13
- package/dist/cjs/elements/SwcSubTemplates.js.map +0 -7
- package/dist/cjs/elements/register.js +0 -1026
- package/dist/cjs/elements/register.js.map +0 -7
- package/dist/cjs/types.js.map +0 -7
- package/dist/esm/elements/SwcAppEngine.js.map +0 -7
- package/dist/esm/elements/SwcAsync.js +0 -129
- package/dist/esm/elements/SwcAsync.js.map +0 -7
- package/dist/esm/elements/SwcChoose.js +0 -155
- package/dist/esm/elements/SwcChoose.js.map +0 -7
- package/dist/esm/elements/SwcIf.js +0 -117
- package/dist/esm/elements/SwcIf.js.map +0 -7
- package/dist/esm/elements/SwcLoop.js +0 -176
- package/dist/esm/elements/SwcLoop.js.map +0 -7
- package/dist/esm/elements/SwcSubTemplates.js +0 -13
- package/dist/esm/elements/SwcSubTemplates.js.map +0 -7
- package/dist/esm/elements/register.js +0 -1007
- package/dist/esm/elements/register.js.map +0 -7
- package/dist/esm/types.js.map +0 -7
- package/dist/types/elements/SwcAppEngine.d.ts.map +0 -1
- package/dist/types/elements/SwcAsync.d.ts +0 -2
- package/dist/types/elements/SwcAsync.d.ts.map +0 -1
- package/dist/types/elements/SwcChoose.d.ts +0 -2
- package/dist/types/elements/SwcChoose.d.ts.map +0 -1
- package/dist/types/elements/SwcIf.d.ts +0 -2
- package/dist/types/elements/SwcLoop.d.ts +0 -2
- package/dist/types/elements/SwcLoop.d.ts.map +0 -1
- package/dist/types/elements/SwcSubTemplates.d.ts +0 -13
- package/dist/types/elements/SwcSubTemplates.d.ts.map +0 -1
- package/dist/types/elements/register.d.ts +0 -4
- package/dist/types/elements/register.d.ts.map +0 -1
- package/dist/types/types.d.ts.map +0 -1
- package/src/elements/SwcAsync.ts +0 -126
- package/src/elements/SwcChoose.ts +0 -190
- package/src/elements/SwcIf.ts +0 -124
- package/src/elements/SwcLoop.ts +0 -205
- package/src/elements/SwcSubTemplates.ts +0 -6
- package/src/elements/register.ts +0 -1022
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dooboostore/simple-web-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.38",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -92,10 +92,10 @@
|
|
|
92
92
|
"webpack": "^5.93.0",
|
|
93
93
|
"webpack-cli": "^5.1.4",
|
|
94
94
|
"webpack-dev-server": "^5.2.0",
|
|
95
|
-
"@dooboostore/core": "1.0.
|
|
95
|
+
"@dooboostore/core": "1.0.32",
|
|
96
96
|
"@dooboostore/core-node": "1.0.12",
|
|
97
|
-
"@dooboostore/core-web": "1.0.
|
|
98
|
-
"@dooboostore/simple-boot": "1.0.
|
|
97
|
+
"@dooboostore/core-web": "1.0.12",
|
|
98
|
+
"@dooboostore/simple-boot": "1.0.56"
|
|
99
99
|
},
|
|
100
100
|
"scripts": {
|
|
101
101
|
"clean": "rm -rf dist",
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import { SimpleApplication } from '@dooboostore/simple-boot
|
|
1
|
+
import { SimpleApplication } from '@dooboostore/simple-boot';
|
|
2
2
|
import { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';
|
|
3
|
-
import { ElementRouter } from '
|
|
4
|
-
import { SimOption } from '@dooboostore/simple-boot
|
|
3
|
+
import { ElementRouter } from './router/ElementRouter';
|
|
4
|
+
import { SimOption } from '@dooboostore/simple-boot';
|
|
5
5
|
import { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';
|
|
6
|
-
|
|
7
|
-
import { SwcAppInterface } from '../types';
|
|
6
|
+
import { SwcAppInterface } from './types';
|
|
8
7
|
import { SimConfig } from '@dooboostore/simple-boot';
|
|
9
8
|
|
|
10
9
|
export type SwcConfigType = {
|
|
11
10
|
routeType: 'path' | 'hash' | 'element';
|
|
12
|
-
connectMode?: 'direct' | 'swap' | 'clear-swap';
|
|
11
|
+
// connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate 아직 개발중
|
|
13
12
|
container?: symbol;
|
|
14
13
|
otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;
|
|
15
14
|
path?: string;
|
|
16
15
|
window: Window;
|
|
17
|
-
onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => void;
|
|
16
|
+
onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;
|
|
17
|
+
onConnectedChildAfter?: (swcEl: HTMLElement) => void;
|
|
18
|
+
onConnectedChildBefore?: (swcEl: HTMLElement) => void;
|
|
19
|
+
onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;
|
|
20
|
+
onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;
|
|
18
21
|
onConnected?: (app: SwcAppInterface) => void;
|
|
19
22
|
onDisconnected?: (app: SwcAppInterface) => void;
|
|
23
|
+
ssr?: boolean;
|
|
24
|
+
onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];
|
|
20
25
|
|
|
21
26
|
onChildrenConnectedDone?: (app: SwcAppInterface) => void;
|
|
22
27
|
// onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;
|
|
@@ -70,8 +75,12 @@ export class SwcAppEngine {
|
|
|
70
75
|
if (this.router) otherInstanceSim.set(Router, this.router);
|
|
71
76
|
this.simpleApplication.run(otherInstanceSim);
|
|
72
77
|
|
|
78
|
+
|
|
79
|
+
if (this._config.onStartedLazyDefineComponent) {
|
|
80
|
+
await Promise.all(this._config.onStartedLazyDefineComponent.map(it => it(this._config.window)))
|
|
81
|
+
}
|
|
73
82
|
if (this._config.onEngineStarted) {
|
|
74
|
-
this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);
|
|
83
|
+
await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);
|
|
75
84
|
}
|
|
76
85
|
} catch (e) {
|
|
77
86
|
console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);
|
|
@@ -8,7 +8,7 @@ export interface AddEventListenerBaseOptions extends EventListenerOptions {
|
|
|
8
8
|
stopPropagation?: boolean;
|
|
9
9
|
stopImmediatePropagation?: boolean;
|
|
10
10
|
preventDefault?: boolean;
|
|
11
|
-
removeOnDisconnected?: boolean;
|
|
11
|
+
// removeOnDisconnected?: boolean;
|
|
12
12
|
delegate?: boolean;
|
|
13
13
|
filter?: (target: Event | CustomEvent, meta:{currentThis: any, helper: HelperHostSet}) => boolean;
|
|
14
14
|
}
|
|
@@ -41,10 +41,20 @@ export function addEventListener(selectorOrTarget: string, type: string, options
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
}
|
|
44
|
+
|
|
45
|
+
export function addEventListenerDelegateLightDom(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions, 'delegate'>): MethodDecorator {
|
|
46
|
+
return addEventListener(selector, type, {...options??{}, root:'light', delegate: true});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function addEventListenerDelegateShadowDom(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions, 'delegate'>): MethodDecorator {
|
|
50
|
+
return addEventListener(selector, type, {...options??{}, root:'shadow', delegate: true});
|
|
51
|
+
}
|
|
52
|
+
export function addEventListenerDelegateAllDom(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions, 'delegate'>): MethodDecorator {
|
|
53
|
+
return addEventListener(selector, type, {...options??{}, root:'all', delegate: true});
|
|
54
|
+
}
|
|
55
|
+
export function addEventListenerDelegate(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions, 'delegate'>): MethodDecorator {
|
|
56
|
+
return addEventListener(selector, type, {...options??{}, root:'auto', delegate: true});
|
|
57
|
+
}
|
|
48
58
|
|
|
49
59
|
/**
|
|
50
60
|
* @addEventListenerThis decorator - simplified version of @addEventListener for $this selector
|
|
@@ -59,9 +69,15 @@ export function addEventListenerThis(type: string, options?: AddEventListenerBas
|
|
|
59
69
|
export function addEventListenerAppHost(type: string, options?: AddEventListenerBaseOptions & SwcQueryOptions): MethodDecorator {
|
|
60
70
|
return addEventListener('$appHost', type, options);
|
|
61
71
|
}
|
|
72
|
+
|
|
62
73
|
export function addEventListenerWindow(type: string, options?: AddEventListenerBaseOptions & SwcQueryOptions): MethodDecorator {
|
|
63
74
|
return addEventListener('$window', type, options);
|
|
64
75
|
}
|
|
65
76
|
export function addEventListenerDocument(type: string, options?: AddEventListenerBaseOptions & SwcQueryOptions): MethodDecorator {
|
|
66
77
|
return addEventListener('$document', type, options);
|
|
67
78
|
}
|
|
79
|
+
|
|
80
|
+
export const getAddEventListenerMetadata = (target: any): AddEventListenerMetadata[] | undefined => {
|
|
81
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
82
|
+
return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
83
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReflectUtils } from '@dooboostore/core';
|
|
2
2
|
import { ensureInit } from './elementDefine';
|
|
3
3
|
import { SwcUtils } from '../utils/Utils';
|
|
4
|
-
import { SwcQueryOptions, HelperHostSet } from '../types';
|
|
4
|
+
import { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';
|
|
5
5
|
|
|
6
6
|
export type AttributeAction = 'set' | 'update' | 'remove';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReflectUtils } from '@dooboostore/core';
|
|
2
2
|
import { ensureInit } from './elementDefine';
|
|
3
3
|
import { SwcUtils } from '../utils/Utils';
|
|
4
|
-
import { SwcQueryOptions, HelperHostSet } from '../types';
|
|
4
|
+
import { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';
|
|
5
5
|
|
|
6
6
|
export const CLASS_METADATA_KEY = Symbol.for('simple-web-component:class');
|
|
7
7
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ReflectUtils } from '@dooboostore/core';
|
|
2
2
|
import { ensureInit, getElementConfig } from './elementDefine';
|
|
3
|
-
import { HelperHostSet, SwcRootType
|
|
4
|
-
import { SwcUtils
|
|
3
|
+
import {SpecialSelector, SwcQueryOptions, HelperHostSet, SwcRootType} from '../types';
|
|
4
|
+
import { SwcUtils} from "../utils/Utils";
|
|
5
|
+
import {findAllStateMetadata} from "./state";
|
|
6
|
+
import {ElementApply} from "@dooboostore/core-web";
|
|
5
7
|
/*
|
|
6
8
|
<!-- beforebegin -->
|
|
7
|
-
<p>
|
|
9
|
+
<p> <-- it's me
|
|
8
10
|
<!-- afterbegin -->
|
|
9
11
|
foo
|
|
10
12
|
<!-- beforeend -->
|
|
@@ -20,11 +22,11 @@ export interface ApplyNodeOptions {
|
|
|
20
22
|
* Filter function to determine whether to perform DOM operation.
|
|
21
23
|
* If it returns false, the operation is skipped.
|
|
22
24
|
*/
|
|
23
|
-
filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;
|
|
25
|
+
filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta: { currentThis: any, helper: HelperHostSet }) => boolean;
|
|
24
26
|
/**
|
|
25
27
|
* Optional loading content to display while an async method is executing.
|
|
26
28
|
*/
|
|
27
|
-
|
|
29
|
+
fallback?: (helper: HelperHostSet) => any;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export interface ApplyNodeMetadata {
|
|
@@ -43,39 +45,67 @@ const normalizeNodes = (res: any, doc: Document): Node[] => {
|
|
|
43
45
|
});
|
|
44
46
|
};
|
|
45
47
|
|
|
46
|
-
const applyToDom = (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const applyToDom = (currentThis: any, targetEl: HTMLElement, res: any, pos: ApplyNodePosition, win: Window, host?: any) => {
|
|
49
|
+
if (!targetEl) return;
|
|
50
|
+
|
|
51
|
+
// console.log('------------',currentThis.tagName, res)
|
|
52
|
+
const doc = win.document;
|
|
53
|
+
const hostSet = SwcUtils.getHelperAndHostSet(win, currentThis);
|
|
54
|
+
const id = currentThis._swcId;
|
|
55
|
+
// Allow processHtml to run here so all DOM insertions go through a single
|
|
56
|
+
// processing point. processHtml may mutate Node[] in-place or return a
|
|
57
|
+
// transformed string result for text processing.
|
|
58
|
+
try {
|
|
59
|
+
if (typeof res === 'string') {
|
|
60
|
+
const processed = SwcUtils.projectProcessHtml(id, res as string, doc);
|
|
61
|
+
if (processed !== undefined) res = processed;
|
|
62
|
+
} else if (res) {
|
|
63
|
+
SwcUtils.projectProcessHtml(id, res, doc);
|
|
52
64
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
} catch (e) {
|
|
66
|
+
// swallow and proceed with original res
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (pos === 'innerHtml') {
|
|
70
|
+
targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (pos === 'innerText') {
|
|
75
|
+
if (targetEl.innerText !== undefined) {
|
|
76
|
+
targetEl.innerText = res !== undefined && res !== null ? String(res) : '';
|
|
59
77
|
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const stateContext: any = {...hostSet};
|
|
82
|
+
findAllStateMetadata(currentThis).forEach(it => {
|
|
83
|
+
stateContext[it.name] = currentThis[it.propertyKey]
|
|
84
|
+
})
|
|
85
|
+
new ElementApply(currentThis, {id: currentThis._swcId}).apply({target: 'noInitialized', context: stateContext, bind: currentThis});
|
|
60
86
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
87
|
+
|
|
88
|
+
const isShadowRoot = targetEl instanceof win.ShadowRoot;
|
|
89
|
+
const nodes = normalizeNodes(res, doc);
|
|
90
|
+
if (pos === 'replace') {
|
|
91
|
+
if (!isShadowRoot) targetEl.replaceWith(...nodes);
|
|
92
|
+
} else if (pos === 'replaceChildren') {
|
|
93
|
+
targetEl.replaceChildren(...nodes);
|
|
94
|
+
} else {
|
|
95
|
+
if (pos === 'beforeEnd') {
|
|
96
|
+
console.log('tarbbbbbbbbbbbbbb')
|
|
97
|
+
targetEl.append(...nodes)
|
|
72
98
|
}
|
|
99
|
+
else if (pos === 'afterBegin') targetEl.prepend(...nodes);
|
|
100
|
+
else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);
|
|
101
|
+
else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);
|
|
102
|
+
}
|
|
73
103
|
};
|
|
74
104
|
|
|
75
105
|
/**
|
|
76
106
|
* @applyNode decorator to surgically add/replace nodes to a target element.
|
|
77
107
|
*/
|
|
78
|
-
export function applyNode(selector: string, options: ApplyNodeOptions = {
|
|
108
|
+
export function applyNode(selector: string, options: ApplyNodeOptions = {position: 'replaceChildren'}): MethodDecorator {
|
|
79
109
|
return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
80
110
|
const constructor = targetObj.constructor;
|
|
81
111
|
let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor) as Map<string | symbol, ApplyNodeMetadata>;
|
|
@@ -83,17 +113,17 @@ export function applyNode(selector: string, options: ApplyNodeOptions = { positi
|
|
|
83
113
|
metaList = new Map<string | symbol, ApplyNodeMetadata>();
|
|
84
114
|
ReflectUtils.defineMetadata(APPLY_NODE_METADATA_KEY, metaList, constructor);
|
|
85
115
|
}
|
|
86
|
-
metaList.set(propertyKey, {
|
|
116
|
+
metaList.set(propertyKey, {propertyKey, selector, options});
|
|
87
117
|
|
|
88
118
|
const original = descriptor.value;
|
|
89
119
|
descriptor.value = function (...args: any[]) {
|
|
90
120
|
ensureInit(this);
|
|
91
|
-
|
|
121
|
+
|
|
92
122
|
const conf = getElementConfig(this);
|
|
93
123
|
const currentWin = (this as any)._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as Window);
|
|
94
124
|
const currentDoc = currentWin.document;
|
|
95
125
|
const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
96
|
-
|
|
126
|
+
|
|
97
127
|
const getTarget = () => {
|
|
98
128
|
const r = options.root || 'auto';
|
|
99
129
|
const applyRoot = (t: any) => {
|
|
@@ -111,37 +141,45 @@ export function applyNode(selector: string, options: ApplyNodeOptions = { positi
|
|
|
111
141
|
if (selector === '$appHost') return applyRoot(hostSet.$appHost);
|
|
112
142
|
if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);
|
|
113
143
|
if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);
|
|
114
|
-
|
|
144
|
+
|
|
115
145
|
const targetRoot = applyRoot(this);
|
|
116
146
|
return targetRoot ? targetRoot.querySelector(selector) : null;
|
|
117
147
|
};
|
|
118
148
|
|
|
149
|
+
|
|
150
|
+
console.log('fffffffffff')
|
|
119
151
|
const targetEl = getTarget();
|
|
120
152
|
const res = original.apply(this, args);
|
|
121
153
|
|
|
122
154
|
const runApply = (target: any, val: any) => {
|
|
123
155
|
const pos = options.position || 'beforeEnd';
|
|
124
|
-
|
|
156
|
+
// Delegate HTML/node processing to applyToDom which centralizes
|
|
157
|
+
// processing. runApply should not call processHtml itself to avoid
|
|
158
|
+
// duplicate processing.
|
|
159
|
+
const processedVal = val;
|
|
160
|
+
|
|
125
161
|
// 사용자가 filter를 명시하면 그 조건으로, 아니면 항상 적용
|
|
126
|
-
if (!options.filter || options.filter(target,
|
|
127
|
-
|
|
162
|
+
if (!options.filter || options.filter(target, processedVal, {currentThis: this, helper: hostSet})) {
|
|
163
|
+
applyToDom(this, target, processedVal, pos, currentWin);
|
|
128
164
|
}
|
|
129
165
|
};
|
|
130
166
|
|
|
131
167
|
if (res instanceof Promise) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
168
|
+
// 비동기일 때만 로딩 표시
|
|
169
|
+
if (targetEl && options.fallback) {
|
|
170
|
+
const loadingRes = options.fallback.call(this, hostSet);
|
|
171
|
+
// applyToDom expects a Window as the 4th argument
|
|
172
|
+
applyToDom(this, targetEl, loadingRes, options.position || 'beforeEnd', currentWin);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return res.then(finalRes => {
|
|
176
|
+
console.log('amnkj')
|
|
177
|
+
if (finalRes !== undefined && targetEl) runApply(targetEl, finalRes);
|
|
178
|
+
return finalRes;
|
|
179
|
+
});
|
|
142
180
|
} else {
|
|
143
|
-
|
|
144
|
-
|
|
181
|
+
if (res !== undefined && targetEl) runApply(targetEl, res);
|
|
182
|
+
return res;
|
|
145
183
|
}
|
|
146
184
|
};
|
|
147
185
|
};
|
|
@@ -161,35 +199,117 @@ export const findAllApplyNodeMetadata = (target: any): Map<string | symbol, Appl
|
|
|
161
199
|
export function applyNodeThis(options: ApplyNodeOptions): MethodDecorator;
|
|
162
200
|
export function applyNodeThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
163
201
|
export function applyNodeThis(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
164
|
-
|
|
202
|
+
const option: ApplyNodeOptions = {position: 'replaceChildren'};
|
|
203
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
204
|
+
const opt = targetOrOptions || {};
|
|
205
|
+
return applyNode('$this', {...option, ...opt});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function applyNodeThisReplaceChildren(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
209
|
+
export function applyNodeThisReplaceChildren(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
210
|
+
export function applyNodeThisReplaceChildren(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
211
|
+
const option: ApplyNodeOptions = {position: 'replaceChildren'};
|
|
212
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
213
|
+
const opt = targetOrOptions || {};
|
|
214
|
+
return applyNode('$this', {...opt, ...option});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function applyNodeThisReplaceChildrenLightDom(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
218
|
+
export function applyNodeThisReplaceChildrenLightDom(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
219
|
+
export function applyNodeThisReplaceChildrenLightDom(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
220
|
+
const options: ApplyNodeOptions = {position: 'replaceChildren', root: 'light'};
|
|
221
|
+
if (propertyKey !== undefined) return applyNode('$this', options)(targetOrOptions, propertyKey, descriptor);
|
|
165
222
|
const opt = targetOrOptions || {};
|
|
166
|
-
return applyNode('$this', {
|
|
223
|
+
return applyNode('$this', {...opt, ...options});
|
|
167
224
|
}
|
|
168
225
|
|
|
169
|
-
export function
|
|
170
|
-
export function
|
|
171
|
-
export function
|
|
172
|
-
|
|
226
|
+
export function applyNodeThisBeforeEnd(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
227
|
+
export function applyNodeThisBeforeEnd(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
228
|
+
export function applyNodeThisBeforeEnd(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
229
|
+
const options: ApplyNodeOptions = {position: 'beforeEnd'};
|
|
230
|
+
if (propertyKey !== undefined) return applyNode('$this', options)(targetOrOptions, propertyKey, descriptor);
|
|
173
231
|
const opt = targetOrOptions || {};
|
|
174
|
-
return applyNode('$this', {
|
|
232
|
+
return applyNode('$this', {...opt, ...options});
|
|
175
233
|
}
|
|
176
234
|
|
|
177
|
-
export function
|
|
178
|
-
export function
|
|
179
|
-
export function
|
|
180
|
-
|
|
235
|
+
export function applyNodeThisBeforeEndLightDom(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
236
|
+
export function applyNodeThisBeforeEndLightDom(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
237
|
+
export function applyNodeThisBeforeEndLightDom(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
238
|
+
const option: ApplyNodeOptions = {position: 'beforeEnd', root: 'light'}
|
|
239
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
181
240
|
const opt = targetOrOptions || {};
|
|
182
|
-
return applyNode('$this', {
|
|
241
|
+
return applyNode('$this', {...opt, ...option});
|
|
242
|
+
}
|
|
243
|
+
export function applyNodeThisBeforeEndShadow(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
244
|
+
export function applyNodeThisBeforeEndShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
245
|
+
export function applyNodeThisBeforeEndShadow(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
246
|
+
const option: ApplyNodeOptions = {position: 'beforeEnd', root: 'shadow'}
|
|
247
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
248
|
+
const opt = targetOrOptions || {};
|
|
249
|
+
return applyNode('$this', {...opt, ...option});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function applyNodeThisAfterBegin(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
253
|
+
export function applyNodeThisAfterBegin(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
254
|
+
export function applyNodeThisAfterBegin(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
255
|
+
const option: ApplyNodeOptions = {position: 'afterBegin'};
|
|
256
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
257
|
+
const opt = targetOrOptions || {};
|
|
258
|
+
return applyNode('$this', {...opt, ...option});
|
|
183
259
|
}
|
|
184
260
|
|
|
185
|
-
export function
|
|
186
|
-
|
|
261
|
+
export function applyNodeThisAfterBeginLightDom(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
262
|
+
export function applyNodeThisAfterBeginLightDom(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
263
|
+
export function applyNodeThisAfterBeginLightDom(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
264
|
+
const option: ApplyNodeOptions = {position: 'afterBegin', root: 'light'}
|
|
265
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
266
|
+
const opt = targetOrOptions || {};
|
|
267
|
+
return applyNode('$this', {...opt, ...option});
|
|
187
268
|
}
|
|
188
269
|
|
|
189
|
-
export function
|
|
190
|
-
|
|
270
|
+
export function applyThisInnerHtmlNode(options: Omit<ApplyNodeOptions, 'position'>): MethodDecorator;
|
|
271
|
+
export function applyThisInnerHtmlNode(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
272
|
+
export function applyThisInnerHtmlNode(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
273
|
+
const option: ApplyNodeOptions = {position: 'innerHtml'}
|
|
274
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
275
|
+
const opt = targetOrOptions || {};
|
|
276
|
+
return applyNode('$this', {...opt, ...option});
|
|
191
277
|
}
|
|
192
278
|
|
|
193
|
-
export function
|
|
194
|
-
|
|
279
|
+
export function applyThisInnerHtmlNodeLightDom(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
280
|
+
export function applyThisInnerHtmlNodeLightDom(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
281
|
+
export function applyThisInnerHtmlNodeLightDom(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
282
|
+
const option: ApplyNodeOptions = {position: 'innerHtml', root: 'light'};
|
|
283
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
284
|
+
const opt = targetOrOptions || {};
|
|
285
|
+
return applyNode('$this', {...opt, ...option});
|
|
195
286
|
}
|
|
287
|
+
|
|
288
|
+
export function applyThisReplaceChildrenNodeLightDom(options: Omit<ApplyNodeOptions, 'position' | 'root'>): MethodDecorator;
|
|
289
|
+
export function applyThisReplaceChildrenNodeLightDom(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
|
|
290
|
+
export function applyThisReplaceChildrenNodeLightDom(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {
|
|
291
|
+
const option: ApplyNodeOptions = {position: 'replaceChildren', root: 'light'};
|
|
292
|
+
if (propertyKey !== undefined) return applyNode('$this', option)(targetOrOptions, propertyKey, descriptor);
|
|
293
|
+
const opt = targetOrOptions || {};
|
|
294
|
+
return applyNode('$this', {...opt, ...option});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export function applyNodeReplaceChildren(selector: string, options: Omit<ApplyNodeOptions, 'position'> = {}): MethodDecorator {
|
|
298
|
+
return applyNode(selector, {...options, position: 'replaceChildren'});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export function applyNodeInnerHtml(selector: string, options: Omit<ApplyNodeOptions, 'position'> = {}): MethodDecorator {
|
|
302
|
+
return applyNode(selector, {...options, position: 'innerHtml'});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// export function applyNodeInnerHtmlLightDom(selector: string, options: Omit<ApplyNodeOptions, 'position' | 'root'> = {}): MethodDecorator {
|
|
306
|
+
// return applyNode(selector, {...options, position: 'innerHtml', root: 'light'});
|
|
307
|
+
// }
|
|
308
|
+
|
|
309
|
+
export function applyNodeInnerText(selector: string, options: Omit<ApplyNodeOptions, 'position'> = {}): MethodDecorator {
|
|
310
|
+
return applyNode(selector, {...options, position: 'innerText'});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// export function applyNodeInnerTextLightDom(selector: string, options: Omit<ApplyNodeOptions, 'position' | 'root'> = {}): MethodDecorator {
|
|
314
|
+
// return applyNode(selector, {...options, position: 'innerText', root: 'light'});
|
|
315
|
+
// }
|