@dooboostore/simple-web-component 1.0.38 → 1.0.40
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/LICENSE.md +7 -0
- package/README.md +88 -871
- package/dist/cjs/SwcAppEngine.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +194 -111
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +82 -80
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +213 -0
- package/dist/cjs/decorators/applyProperty.js.map +7 -0
- package/dist/cjs/decorators/applySlot.js +93 -82
- package/dist/cjs/decorators/applySlot.js.map +3 -3
- package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
- package/dist/cjs/decorators/elementDefine.js +14 -34
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/index.js +2 -2
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +4 -4
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/state.js +0 -1
- package/dist/cjs/decorators/state.js.map +2 -2
- package/dist/cjs/elements/SwcApp.js.map +2 -2
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/SwcAppEngine.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +196 -113
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +82 -80
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +194 -0
- package/dist/esm/decorators/applyProperty.js.map +7 -0
- package/dist/esm/decorators/applySlot.js +93 -82
- package/dist/esm/decorators/applySlot.js.map +3 -3
- package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
- package/dist/esm/decorators/elementDefine.js +14 -34
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/index.js +2 -2
- package/dist/esm/decorators/index.js.map +1 -1
- package/dist/esm/decorators/lifecycles.js +4 -4
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/state.js +0 -1
- package/dist/esm/decorators/state.js.map +2 -2
- package/dist/esm/elements/SwcApp.js.map +2 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +525 -513
- 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/applyAttribute.d.ts +56 -15
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +28 -24
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +61 -0
- package/dist/types/decorators/applyProperty.d.ts.map +1 -0
- package/dist/types/decorators/applySlot.d.ts +17 -15
- package/dist/types/decorators/applySlot.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +2 -2
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +4 -4
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/state.d.ts.map +1 -1
- package/dist/types/elements/SwcApp.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -6
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +525 -513
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +1 -1
- package/src/SwcAppEngine.ts +1 -0
- package/src/decorators/applyAttribute.ts +311 -126
- package/src/decorators/applyNode.ts +108 -105
- package/src/decorators/applyProperty.ts +302 -0
- package/src/decorators/applySlot.ts +112 -94
- package/src/decorators/changedAttributeThis.ts +1 -1
- package/src/decorators/elementDefine.ts +44 -33
- package/src/decorators/index.ts +2 -3
- package/src/decorators/lifecycles.ts +6 -6
- package/src/decorators/state.ts +0 -1
- package/src/elements/SwcApp.ts +0 -1
- package/src/types/index.ts +7 -7
- package/dist/cjs/decorators/attribute.js +0 -187
- package/dist/cjs/decorators/attribute.js.map +0 -7
- package/dist/cjs/decorators/setProperty.js +0 -109
- package/dist/cjs/decorators/setProperty.js.map +0 -7
- package/dist/esm/decorators/attribute.js +0 -168
- package/dist/esm/decorators/attribute.js.map +0 -7
- package/dist/esm/decorators/setProperty.js +0 -90
- package/dist/esm/decorators/setProperty.js.map +0 -7
- package/dist/types/decorators/attribute.d.ts +0 -31
- package/dist/types/decorators/attribute.d.ts.map +0 -1
- package/dist/types/decorators/setProperty.d.ts +0 -17
- package/dist/types/decorators/setProperty.d.ts.map +0 -1
- package/src/decorators/attribute.ts +0 -223
- package/src/decorators/setProperty.ts +0 -112
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SwcAppEngine.ts"],
|
|
4
|
-
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => it(this._config.window)))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAkC;AAClC,sBAAgE;AAChE,2BAA8B;AAC9B,IAAAA,sBAA0B;AAgCnB,MAAM,aAAa;AAAA,EAMxB,YAAoB,MAAmB;AAAnB;AALpB,wBAAO;AACP,wBAAO;AACP,wBAAQ;AACR,wBAAQ;AAAA,EAEgC;AAAA,EAExC,IAAI,SAAS;AACX,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,QAAuB;AACnC,QAAI;AACF,WAAK,UAAU;AAGf,UAAI,KAAK,QAAQ,cAAc,QAAQ;AACrC,aAAK,SAAS,IAAI,2BAAW,EAAE,QAAQ,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ,KAAK,CAAC;AAAA,MAC3F,WAAW,KAAK,QAAQ,cAAc,QAAQ;AAC5C,aAAK,SAAS,IAAI,2BAAW,EAAE,QAAQ,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ,KAAK,CAAC;AAAA,MAC3F,WAAW,KAAK,QAAQ,cAAc,WAAW;AAC/C,aAAK,SAAS,IAAI,mCAAc,EAAE,QAAQ,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ,KAAK,CAAC;AAAA,MAC9F;AAKA,WAAK,oBAAoB,IAAI;AAAA,QAC3B,IAAI,8BAAU;AAAA,UACZ,eAAe,CAAE,KAAK,QAAQ,OAAe,IAAI;AAAA,UACjD,WAAW,KAAK,QAAQ;AAAA,QAC1B,CAAC;AAAA,MACH;AAEA,YAAM,mBAAmB,oBAAI,IAAc;AAC3C,WAAK,QAAQ,kBAAkB,QAAQ,CAAC,GAAG,MAAM;AAC/C,yBAAiB,IAAI,GAAG,CAAC;AAAA,MAC3B,CAAC;AACD,UAAI,KAAK,OAAQ,kBAAiB,IAAI,wBAAQ,KAAK,MAAM;AACzD,WAAK,kBAAkB,IAAI,gBAAgB;AAG3C,UAAI,KAAK,QAAQ,8BAA8B;
|
|
4
|
+
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n // console.log('-------->', this._config.onStartedLazyDefineComponent)\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => it(this._config.window)))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AA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AM,GAAG,KAAK,QAAQ,MAAM,CAAC,CAAC;AAAA,MAChG;AACA,UAAI,KAAK,QAAQ,iBAAiB;AAChC,cAAM,KAAK,QAAQ,gBAAgB,KAAK,mBAAmB,KAAK,IAAkC;AAAA,MACpG;AAAA,IACF,SAAS,GAAG;AACV,cAAQ,MAAM,iCAAiC,GAAG,KAAK,OAAO;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,aAAa;AACX,SAAK,oBAAoB,YAAY;AAAA,EACvC;AACF;",
|
|
6
6
|
"names": ["import_simple_boot"]
|
|
7
7
|
}
|
|
@@ -17,143 +17,226 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var applyAttribute_exports = {};
|
|
19
19
|
__export(applyAttribute_exports, {
|
|
20
|
-
|
|
20
|
+
ATTRIBUTE_METADATA_KEY: () => ATTRIBUTE_METADATA_KEY,
|
|
21
21
|
applyAttribute: () => applyAttribute,
|
|
22
|
-
|
|
22
|
+
attribute: () => attribute,
|
|
23
|
+
attributeThis: () => attributeThis,
|
|
24
|
+
convertValue: () => convertValue,
|
|
25
|
+
default: () => applyAttribute_default,
|
|
23
26
|
findAllAttributeApplyMetadata: () => findAllAttributeApplyMetadata,
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
findAllAttributeMetadata: () => findAllAttributeMetadata,
|
|
28
|
+
getAttributeValue: () => getAttributeValue,
|
|
29
|
+
resolveAttributeTargets: () => resolveAttributeTargets,
|
|
26
30
|
setAttribute: () => setAttribute,
|
|
27
|
-
setAttributeThis: () => setAttributeThis
|
|
28
|
-
updateAttribute: () => updateAttribute,
|
|
29
|
-
updateAttributeThis: () => updateAttributeThis
|
|
31
|
+
setAttributeThis: () => setAttributeThis
|
|
30
32
|
});
|
|
31
33
|
module.exports = __toCommonJS(applyAttribute_exports);
|
|
32
34
|
var import_core = require("@dooboostore/core");
|
|
33
35
|
var import_elementDefine = require("./elementDefine");
|
|
34
36
|
var import_Utils = require("../utils/Utils");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
var import_core_web = require("@dooboostore/core-web");
|
|
38
|
+
const ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
|
|
39
|
+
const convertValue = (val, type) => {
|
|
40
|
+
if (val === null || val === void 0) return val;
|
|
41
|
+
if (type === Number) return Number(val);
|
|
42
|
+
if (type === Boolean) return val === "false" || val === "0" ? false : true;
|
|
43
|
+
return val;
|
|
44
|
+
};
|
|
45
|
+
const getAttributeValue = (inst, attrName, options) => {
|
|
46
|
+
const conf = (0, import_elementDefine.getElementConfig)(inst);
|
|
47
|
+
const currentWin = inst._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
48
|
+
const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];
|
|
49
|
+
const primaryTarget = targets[0];
|
|
50
|
+
if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
|
|
51
|
+
let domVal = primaryTarget.getAttribute(attrName);
|
|
52
|
+
const ae = new import_core.ActionExpression(domVal);
|
|
53
|
+
const expr = ae.getFirstExpression("callReturn");
|
|
54
|
+
if (expr) {
|
|
55
|
+
try {
|
|
56
|
+
const result = import_core.FunctionUtils.executeReturn({
|
|
57
|
+
script: import_core_web.ConvertUtils.decodeHtmlEntity(expr.script, currentWin.document),
|
|
58
|
+
context: inst,
|
|
59
|
+
args: import_Utils.SwcUtils.getHelperAndHostSet(currentWin, inst)
|
|
60
|
+
});
|
|
61
|
+
return convertValue(result, options?.type);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);
|
|
64
|
+
return convertValue(domVal, options?.type);
|
|
44
65
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
66
|
+
}
|
|
67
|
+
return convertValue(domVal, options?.type);
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
71
|
+
const resolveAttributeTargets = (inst, selector, options) => {
|
|
72
|
+
const conf = (0, import_elementDefine.getElementConfig)(inst);
|
|
73
|
+
const currentWin = conf.window;
|
|
74
|
+
const r = options.root || "auto";
|
|
75
|
+
const results = [];
|
|
76
|
+
const applyRoot = (target) => {
|
|
77
|
+
if (!target) return;
|
|
78
|
+
if (r === "auto") {
|
|
79
|
+
results.push(target);
|
|
80
|
+
} else {
|
|
81
|
+
if (r === "light" || r === "all") results.push(target);
|
|
82
|
+
if ((r === "shadow" || r === "all") && target.shadowRoot) results.push(target.shadowRoot);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
if (selector === "$this" || !selector) {
|
|
86
|
+
applyRoot(inst);
|
|
87
|
+
} else {
|
|
88
|
+
const hostSet = import_Utils.SwcUtils.getHostSet(inst);
|
|
89
|
+
if (selector === "$host") applyRoot(hostSet.$host);
|
|
90
|
+
else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
|
|
91
|
+
else if (selector === "$appHost") applyRoot(hostSet.$appHost);
|
|
92
|
+
else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
|
|
93
|
+
else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
|
|
94
|
+
else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
95
|
+
else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
96
|
+
else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
|
|
97
|
+
else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
98
|
+
else {
|
|
99
|
+
if (r === "shadow") {
|
|
100
|
+
const found = inst.shadowRoot?.querySelectorAll(selector);
|
|
101
|
+
if (found) results.push(...found);
|
|
102
|
+
} else if (r === "light") {
|
|
103
|
+
const found = inst.querySelectorAll(selector);
|
|
104
|
+
if (found) results.push(...found);
|
|
105
|
+
} else if (r === "all") {
|
|
106
|
+
const sMatch = inst.shadowRoot?.querySelectorAll(selector);
|
|
107
|
+
const lMatch = inst.querySelectorAll(selector);
|
|
108
|
+
if (sMatch) results.push(...sMatch);
|
|
109
|
+
if (lMatch) results.push(...lMatch);
|
|
110
|
+
} else {
|
|
111
|
+
const found = (inst.shadowRoot || inst).querySelectorAll(selector);
|
|
112
|
+
if (found) results.push(...found);
|
|
49
113
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return results;
|
|
117
|
+
};
|
|
118
|
+
function applyAttribute(selector, targetAttributeNameOrOptions, options) {
|
|
119
|
+
return (target, propertyKey, descriptor) => {
|
|
120
|
+
const constructor = target.constructor;
|
|
121
|
+
const designType = Reflect.getMetadata("design:type", target, propertyKey);
|
|
122
|
+
const metaType = descriptor && typeof descriptor.value === "function" ? "method" : "property";
|
|
123
|
+
let finalOptions = {};
|
|
124
|
+
let targetAttributeName;
|
|
125
|
+
if (typeof targetAttributeNameOrOptions === "string") {
|
|
126
|
+
targetAttributeName = targetAttributeNameOrOptions;
|
|
127
|
+
finalOptions = options || {};
|
|
128
|
+
} else if (targetAttributeNameOrOptions) {
|
|
129
|
+
finalOptions = targetAttributeNameOrOptions;
|
|
130
|
+
targetAttributeName = finalOptions.name || String(propertyKey);
|
|
131
|
+
} else {
|
|
132
|
+
targetAttributeName = String(propertyKey);
|
|
133
|
+
}
|
|
134
|
+
let metaList = import_core.ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor);
|
|
135
|
+
if (!metaList) {
|
|
136
|
+
metaList = [];
|
|
137
|
+
import_core.ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);
|
|
138
|
+
}
|
|
139
|
+
metaList.push({
|
|
140
|
+
propertyKey,
|
|
141
|
+
selector,
|
|
142
|
+
targetAttributeName,
|
|
143
|
+
options: finalOptions,
|
|
144
|
+
type: metaType
|
|
145
|
+
});
|
|
146
|
+
const applyValueToTargets = (inst, resolvedValue) => {
|
|
147
|
+
const conf = (0, import_elementDefine.getElementConfig)(inst);
|
|
148
|
+
const currentWin = conf.window;
|
|
149
|
+
const targetEls = resolveAttributeTargets(inst, selector, finalOptions);
|
|
150
|
+
const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(currentWin, inst);
|
|
151
|
+
targetEls.forEach((targetEl) => {
|
|
152
|
+
if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: inst, helper: hostSet })) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (resolvedValue === null) {
|
|
156
|
+
targetEl.removeAttribute(targetAttributeName);
|
|
157
|
+
} else if (resolvedValue !== void 0) {
|
|
158
|
+
targetEl.setAttribute(targetAttributeName, resolvedValue === true ? "" : String(resolvedValue));
|
|
159
|
+
}
|
|
55
160
|
});
|
|
161
|
+
return resolvedValue;
|
|
162
|
+
};
|
|
163
|
+
if (descriptor && typeof descriptor.value === "function") {
|
|
56
164
|
const original = descriptor.value;
|
|
57
165
|
descriptor.value = function(...args) {
|
|
58
166
|
(0, import_elementDefine.ensureInit)(this);
|
|
59
167
|
const res = original.apply(this, args);
|
|
60
|
-
const handleResult = (resolvedValue) => {
|
|
61
|
-
if (resolvedValue !== void 0) {
|
|
62
|
-
const win = this.ownerDocument?.defaultView || window;
|
|
63
|
-
const host = this;
|
|
64
|
-
const hostSet = { ...import_Utils.SwcUtils.getHelperAndHostSet(win, host), $this: this };
|
|
65
|
-
const r = finalOptions.root || "auto";
|
|
66
|
-
const targetEls = [];
|
|
67
|
-
const applyRoot = (t) => {
|
|
68
|
-
if (!t || !(t instanceof win.HTMLElement)) return;
|
|
69
|
-
targetEls.push(t);
|
|
70
|
-
};
|
|
71
|
-
if (selector === "$this" || !selector) applyRoot(host);
|
|
72
|
-
else if (selector === "$host") applyRoot(hostSet.$host);
|
|
73
|
-
else if (selector === "$parentHost") applyRoot(hostSet.$parentHost);
|
|
74
|
-
else if (selector === "$appHost") applyRoot(hostSet.$appHost);
|
|
75
|
-
else if (selector === "$firstHost") applyRoot(hostSet.$firstHost);
|
|
76
|
-
else if (selector === "$lastHost") applyRoot(hostSet.$lastHost);
|
|
77
|
-
else if (selector === "$firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
78
|
-
else if (selector === "$lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
79
|
-
else if (selector === "$hosts") hostSet.$hosts.forEach(applyRoot);
|
|
80
|
-
else if (selector === "$appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
81
|
-
else {
|
|
82
|
-
const targetRoot = r === "auto" ? host.shadowRoot || host : r === "shadow" ? host.shadowRoot : host;
|
|
83
|
-
if (targetRoot) {
|
|
84
|
-
const found = targetRoot.querySelectorAll(selector);
|
|
85
|
-
if (found) targetEls.push(...Array.from(found));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
targetEls.forEach((targetEl) => {
|
|
89
|
-
if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: this, helper: hostSet })) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
|
|
93
|
-
if (action === "set" || action === "update") {
|
|
94
|
-
if (attributeName) {
|
|
95
|
-
if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
|
|
96
|
-
targetEl.removeAttribute(attributeName);
|
|
97
|
-
} else {
|
|
98
|
-
targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
|
|
99
|
-
}
|
|
100
|
-
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
101
|
-
Object.entries(resolvedRes).forEach(([attr, val]) => {
|
|
102
|
-
const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
|
|
103
|
-
if (finalVal === null || finalVal === void 0 || finalVal === false) {
|
|
104
|
-
targetEl.removeAttribute(attr);
|
|
105
|
-
} else {
|
|
106
|
-
targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
} else if (action === "remove") {
|
|
111
|
-
if (attributeName) {
|
|
112
|
-
targetEl.removeAttribute(attributeName);
|
|
113
|
-
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
114
|
-
Object.entries(resolvedRes).forEach(([attr, val]) => {
|
|
115
|
-
const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
|
|
116
|
-
if (shouldRemove) targetEl.removeAttribute(attr);
|
|
117
|
-
});
|
|
118
|
-
} else {
|
|
119
|
-
const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
|
|
120
|
-
attrs.forEach((a) => targetEl.removeAttribute(String(a)));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
return resolvedValue;
|
|
126
|
-
};
|
|
127
168
|
if (res instanceof Promise) {
|
|
128
|
-
return res.then(
|
|
169
|
+
return res.then((v) => {
|
|
170
|
+
applyValueToTargets(this, v);
|
|
171
|
+
return v;
|
|
172
|
+
});
|
|
129
173
|
} else {
|
|
130
|
-
|
|
174
|
+
applyValueToTargets(this, res);
|
|
175
|
+
return res;
|
|
131
176
|
}
|
|
132
177
|
};
|
|
133
|
-
return
|
|
134
|
-
}
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
Object.defineProperty(target, propertyKey, {
|
|
181
|
+
configurable: true,
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get() {
|
|
184
|
+
(0, import_elementDefine.ensureInit)(this);
|
|
185
|
+
const mergedOptions = { ...finalOptions, selector, type: finalOptions.type || designType };
|
|
186
|
+
return getAttributeValue(this, targetAttributeName, mergedOptions);
|
|
187
|
+
},
|
|
188
|
+
set(value) {
|
|
189
|
+
(0, import_elementDefine.ensureInit)(this);
|
|
190
|
+
if (value instanceof Promise) {
|
|
191
|
+
value.then((v) => applyValueToTargets(this, v)).catch(() => {
|
|
192
|
+
});
|
|
193
|
+
} else {
|
|
194
|
+
applyValueToTargets(this, value);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
135
198
|
};
|
|
136
199
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
200
|
+
function attribute(selector, targetAttributeNameOrOptions, options) {
|
|
201
|
+
return applyAttribute(selector, targetAttributeNameOrOptions, options);
|
|
202
|
+
}
|
|
203
|
+
function attributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
|
|
204
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") {
|
|
205
|
+
return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
|
|
206
|
+
}
|
|
207
|
+
if (typeof targetOrOptions === "string") {
|
|
208
|
+
return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
|
|
209
|
+
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
210
|
+
return applyAttribute("$this", void 0, targetOrOptions);
|
|
211
|
+
} else {
|
|
212
|
+
return applyAttribute("$this", void 0, {});
|
|
213
|
+
}
|
|
139
214
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
|
|
143
|
-
function applyAttributeThis(action = "update", options = {}) {
|
|
144
|
-
return createAttributeDecorator(action)("$this", options);
|
|
215
|
+
function setAttribute(selector, targetAttributeNameOrOptions, options) {
|
|
216
|
+
return applyAttribute(selector, targetAttributeNameOrOptions, options);
|
|
145
217
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
218
|
+
function setAttributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
|
|
219
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
220
|
+
return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
|
|
221
|
+
}
|
|
222
|
+
if (typeof targetOrOptions === "string") {
|
|
223
|
+
return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
|
|
224
|
+
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
225
|
+
return applyAttribute("$this", void 0, targetOrOptions);
|
|
226
|
+
} else {
|
|
227
|
+
return applyAttribute("$this", void 0, {});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const findAllAttributeMetadata = (target) => {
|
|
231
|
+
const actualTarget = target instanceof Function ? target : target.constructor;
|
|
232
|
+
return import_core.ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, actualTarget).flat();
|
|
233
|
+
};
|
|
149
234
|
const findAllAttributeApplyMetadata = (target) => {
|
|
150
235
|
const result = /* @__PURE__ */ new Map();
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (map instanceof Map) {
|
|
154
|
-
map.forEach((v, k) => result.set(k, v));
|
|
155
|
-
}
|
|
236
|
+
findAllAttributeMetadata(target).forEach((meta) => {
|
|
237
|
+
result.set(meta.propertyKey, meta);
|
|
156
238
|
});
|
|
157
239
|
return result;
|
|
158
240
|
};
|
|
241
|
+
var applyAttribute_default = applyAttribute;
|
|
159
242
|
//# sourceMappingURL=applyAttribute.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/applyAttribute.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport type AttributeAction = 'set' | 'update' | 'remove';\n\nexport interface AttributeApplyOptions extends SwcQueryOptions {\n name?: string;\n filter?: (target: HTMLElement, value: any, meta: {currentThis: any, helper: HelperHostSet}) => boolean;\n}\n\nexport interface AttributeApplyMetadata {\n propertyKey: string | symbol;\n selector: string;\n action: AttributeAction;\n options: AttributeApplyOptions;\n}\n\nexport const ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for('simple-web-component:attribute-apply');\n\nfunction createAttributeDecorator(action: AttributeAction) {\n return (selector: string, nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}): MethodDecorator => {\n return (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const constructor = target.constructor;\n let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor) as Map<string | symbol, AttributeApplyMetadata>;\n if (!metaList) {\n metaList = new Map<string | symbol, AttributeApplyMetadata>();\n ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);\n }\n\n let attributeName = typeof nameOrOptions === 'string' ? nameOrOptions : undefined;\n let finalOptions = options;\n \n if (typeof nameOrOptions === 'object' && nameOrOptions !== null) {\n finalOptions = nameOrOptions as AttributeApplyOptions;\n }\n\n metaList.set(propertyKey, { \n propertyKey, \n selector, \n action, \n options: { ...finalOptions, name: attributeName } \n });\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n const res = (original as any).apply(this, args);\n\n const handleResult = (resolvedValue: any) => {\n if (resolvedValue !== undefined) {\n const win = (this as any).ownerDocument?.defaultView || window;\n const host = this as unknown as HTMLElement;\n const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host), $this: this };\n const r = finalOptions.root || 'auto';\n const targetEls: HTMLElement[] = [];\n\n const applyRoot = (t: any) => {\n if (!t || !(t instanceof win.HTMLElement)) return;\n targetEls.push(t);\n };\n\n if (selector === '$this' || !selector) applyRoot(host);\n else if (selector === '$host') applyRoot(hostSet.$host);\n else if (selector === '$parentHost') applyRoot(hostSet.$parentHost);\n else if (selector === '$appHost') applyRoot(hostSet.$appHost);\n else if (selector === '$firstHost') applyRoot(hostSet.$firstHost);\n else if (selector === '$lastHost') applyRoot(hostSet.$lastHost);\n else if (selector === '$firstAppHost') applyRoot(hostSet.$firstAppHost);\n else if (selector === '$lastAppHost') applyRoot(hostSet.$lastAppHost);\n else if (selector === '$hosts') hostSet.$hosts.forEach(applyRoot);\n else if (selector === '$appHosts') hostSet.$appHosts.forEach(applyRoot);\n else {\n const targetRoot = r === 'auto' ? (host.shadowRoot || host) : (r === 'shadow' ? host.shadowRoot : host);\n if (targetRoot) {\n const found = targetRoot.querySelectorAll(selector);\n if (found) targetEls.push(...(Array.from(found) as HTMLElement[]));\n }\n }\n\n targetEls.forEach(targetEl => {\n if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, {currentThis: this, helper: hostSet})) {\n return;\n }\n const resolvedRes = typeof resolvedValue === 'function' ? (resolvedValue as any)(targetEl, hostSet) : resolvedValue;\n\n if (action === 'set' || action === 'update') {\n if (attributeName) {\n // Case: @setAttribute(selector, 'name')\n if (resolvedRes === null || resolvedRes === undefined || resolvedRes === false) {\n targetEl.removeAttribute(attributeName);\n } else {\n targetEl.setAttribute(attributeName, resolvedRes === true ? '' : String(resolvedRes));\n }\n } else if (typeof resolvedRes === 'object' && resolvedRes !== null && !Array.isArray(resolvedRes)) {\n // Case: @applyAttribute(selector) with Object return\n Object.entries(resolvedRes as any).forEach(([attr, val]) => {\n const finalVal = typeof val === 'function' ? val(targetEl, hostSet) : val;\n if (finalVal === null || finalVal === undefined || finalVal === false) {\n targetEl.removeAttribute(attr);\n } else {\n targetEl.setAttribute(attr, finalVal === true ? '' : String(finalVal));\n }\n });\n }\n } else if (action === 'remove') {\n if (attributeName) {\n targetEl.removeAttribute(attributeName);\n } else if (typeof resolvedRes === 'object' && resolvedRes !== null && !Array.isArray(resolvedRes)) {\n Object.entries(resolvedRes as any).forEach(([attr, val]) => {\n const shouldRemove = typeof val === 'function' ? val(targetEl, hostSet) : !!val;\n if (shouldRemove) targetEl.removeAttribute(attr);\n });\n } else {\n const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];\n attrs.forEach(a => targetEl.removeAttribute(String(a)));\n }\n }\n });\n }\n return resolvedValue;\n };\n\n if (res instanceof Promise) {\n return res.then(handleResult);\n } else {\n return handleResult(res);\n }\n };\n return descriptor;\n };\n };\n}\n\nexport function applyAttribute(selector: string, action: AttributeAction = 'update', options: AttributeApplyOptions = {}): MethodDecorator {\n return createAttributeDecorator(action)(selector, options);\n}\n\nexport const setAttribute = (selector: string, nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('set')(selector, nameOrOptions, options);\nexport const updateAttribute = (selector: string, nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('update')(selector, nameOrOptions, options);\nexport const removeAttribute = (selector: string, nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('remove')(selector, nameOrOptions, options);\n\n// This versions\nexport function applyAttributeThis(action: AttributeAction = 'update', options: AttributeApplyOptions = {}): MethodDecorator {\n return createAttributeDecorator(action)('$this', options);\n}\nexport const setAttributeThis = (nameOrOptions: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('set')('$this', nameOrOptions, options);\nexport const updateAttributeThis = (nameOrOptions: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('update')('$this', nameOrOptions, options);\nexport const removeAttributeThis = (nameOrOptions?: string | AttributeApplyOptions, options: AttributeApplyOptions = {}) => createAttributeDecorator('remove')('$this', nameOrOptions, options);\n\nexport const findAllAttributeApplyMetadata = (target: any): Map<string | symbol, AttributeApplyMetadata> => {\n const result = new Map<string | symbol, AttributeApplyMetadata>();\n const maps = ReflectUtils.findAllMetadata<Map<string | symbol, AttributeApplyMetadata>>(ATTRIBUTE_APPLY_METADATA_KEY, target);\n maps.forEach(map => {\n if (map instanceof Map) {\n map.forEach((v, k) => result.set(k, v));\n }\n });\n return result;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {ReflectUtils, FunctionUtils, ActionExpression} from '@dooboostore/core';\nimport {ensureInit, getElementConfig} from './elementDefine';\nimport {SwcUtils} from '../utils/Utils';\nimport {SwcQueryOptions, HelperHostSet} from '../types';\nimport {ConvertUtils} from '@dooboostore/core-web';\n\n// ============================================\n// Types & Interfaces\n// ============================================\n\nexport interface AttributeOptions extends SwcQueryOptions {\n name?: string;\n type?: typeof Number | typeof Boolean | typeof String;\n filter?: (target: HTMLElement, value: any, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n}\n\nexport interface AttributeMetadata {\n propertyKey: string | symbol;\n selector: string;\n targetAttributeName: string;\n options: AttributeOptions;\n type: 'property' | 'method';\n}\n\nexport const ATTRIBUTE_METADATA_KEY = Symbol.for('simple-web-component:attribute');\n\n// ============================================\n// Utilities\n// ============================================\n\nconst convertValue = (val: string | null, type: any): any => {\n if (val === null || val === undefined) return val;\n if (type === Number) return Number(val);\n if (type === Boolean) return val === 'false' || val === '0' ? false : true;\n return val;\n};\n\nexport {convertValue};\n\nexport const getAttributeValue = (inst: any, attrName: string, options?: AttributeOptions & { selector?: string }): any => {\n const conf = getElementConfig(inst);\n const currentWin = inst._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as any);\n\n // If selector is not provided, use inst itself\n const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];\n\n const primaryTarget = targets[0];\n\n if (primaryTarget && typeof (primaryTarget as any).hasAttribute === 'function' && (primaryTarget as any).hasAttribute(attrName)) {\n let domVal = (primaryTarget as any).getAttribute(attrName);\n\n // \uD45C\uD604\uC2DD \uCCB4\uD06C\n const ae = new ActionExpression(domVal);\n const expr = ae.getFirstExpression('callReturn');\n if (expr) {\n try {\n const result = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, currentWin.document),\n context: inst,\n args: SwcUtils.getHelperAndHostSet(currentWin, inst)\n });\n return convertValue(result, options?.type);\n } catch (err) {\n console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);\n return convertValue(domVal, options?.type);\n }\n }\n\n return convertValue(domVal, options?.type);\n }\n\n // If no target found, return null\n return null;\n};\n\n/**\n * Resolve target elements based on selector and options\n * Handles special selectors ($this, $host, etc.) and CSS selectors\n * Returns HTMLElement[] for attribute operations\n */\nexport const resolveAttributeTargets = (inst: any, selector: string, options: AttributeOptions): HTMLElement[] => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const r = options.root || 'auto';\n const results: HTMLElement[] = [];\n\n const applyRoot = (target: any) => {\n if (!target) return;\n if (r === 'auto') {\n results.push(target);\n } else {\n if (r === 'light' || r === 'all') results.push(target);\n if ((r === 'shadow' || r === 'all') && target.shadowRoot) results.push(target.shadowRoot);\n }\n };\n\n if (selector === '$this' || !selector) {\n applyRoot(inst);\n } else {\n const hostSet = SwcUtils.getHostSet(inst);\n if (selector === '$host') applyRoot(hostSet.$host);\n else if (selector === '$parentHost') applyRoot(hostSet.$parentHost);\n else if (selector === '$appHost') applyRoot(hostSet.$appHost as any);\n else if (selector === '$firstHost') applyRoot(hostSet.$firstHost);\n else if (selector === '$lastHost') applyRoot(hostSet.$lastHost);\n else if (selector === '$firstAppHost') applyRoot(hostSet.$firstAppHost as any);\n else if (selector === '$lastAppHost') applyRoot(hostSet.$lastAppHost as any);\n else if (selector === '$hosts') hostSet.$hosts.forEach(applyRoot);\n else if (selector === '$appHosts') hostSet.$appHosts.forEach(applyRoot);\n else {\n if (r === 'shadow') {\n const found = inst.shadowRoot?.querySelectorAll(selector);\n if (found) results.push(...found);\n } else if (r === 'light') {\n const found = inst.querySelectorAll(selector);\n if (found) results.push(...found);\n } else if (r === 'all') {\n const sMatch = inst.shadowRoot?.querySelectorAll(selector);\n const lMatch = inst.querySelectorAll(selector);\n if (sMatch) results.push(...sMatch);\n if (lMatch) results.push(...lMatch);\n } else {\n const found = (inst.shadowRoot || inst).querySelectorAll(selector);\n if (found) results.push(...found);\n }\n }\n }\n return results;\n};\n\n/**\n * @applyAttribute decorator - set/get element attributes\n *\n * Usage:\n * - @applyAttribute('selector', 'attrName') - Set attribute with explicit name\n * - @applyAttribute('selector') - Use property name as attribute name\n * - @applyAttribute('selector', { name: 'attrName' }) - Set attribute via options\n * - Return null to remove attribute\n */\nexport function applyAttribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function applyAttribute(selector: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function applyAttribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator & PropertyDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n // ensureInit(target as any);\n\n const constructor = target.constructor;\n const designType = (Reflect as any).getMetadata('design:type', target, propertyKey);\n const metaType: 'property' | 'method' = descriptor && typeof descriptor.value === 'function' ? 'method' : 'property';\n\n // Parse arguments\n let finalOptions: AttributeOptions = {};\n let targetAttributeName: string;\n\n if (typeof targetAttributeNameOrOptions === 'string') {\n // applyAttribute('selector', 'attrName', options?)\n targetAttributeName = targetAttributeNameOrOptions;\n finalOptions = options || {};\n } else if (targetAttributeNameOrOptions) {\n // applyAttribute('selector', options)\n finalOptions = targetAttributeNameOrOptions;\n targetAttributeName = finalOptions.name || String(propertyKey);\n } else {\n // applyAttribute('selector')\n targetAttributeName = String(propertyKey);\n }\n\n // Store metadata\n let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor) as AttributeMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);\n }\n metaList.push({\n propertyKey,\n selector,\n targetAttributeName,\n options: finalOptions,\n type: metaType\n });\n\n // Helper: Apply resolved value to targets\n const applyValueToTargets = (inst: any, resolvedValue: any) => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const targetEls = resolveAttributeTargets(inst, selector, finalOptions);\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);\n\n targetEls.forEach(targetEl => {\n // Apply filter if provided\n if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, {currentThis: inst, helper: hostSet})) {\n return;\n }\n\n if (resolvedValue === null) {\n // Remove attribute if value is null\n targetEl.removeAttribute(targetAttributeName);\n } else if (resolvedValue !== undefined) {\n // Set attribute\n targetEl.setAttribute(targetAttributeName, resolvedValue === true ? '' : String(resolvedValue));\n }\n });\n\n return resolvedValue;\n };\n\n // Method decorator: wrap method to apply its return value to attributes\n if (descriptor && typeof descriptor.value === 'function') {\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n const res = (original as any).apply(this, args);\n\n if (res instanceof Promise) {\n return res.then((v: any) => {\n applyValueToTargets(this, v);\n return v;\n });\n } else {\n applyValueToTargets(this, res);\n return res;\n }\n };\n return;\n }\n\n // Property decorator: define getter/setter to proxy to element attributes\n Object.defineProperty(target, propertyKey, {\n configurable: true,\n enumerable: true,\n get(this: any) {\n ensureInit(this);\n const mergedOptions = {...finalOptions, selector, type: finalOptions.type || designType};\n return getAttributeValue(this, targetAttributeName, mergedOptions);\n },\n set(this: any, value: any) {\n ensureInit(this);\n\n if (value instanceof Promise) {\n value.then((v: any) => applyValueToTargets(this, v)).catch(() => { /* swallow */\n });\n } else {\n applyValueToTargets(this, value);\n }\n }\n });\n };\n}\n\n// ============================================\n// Convenience Aliases\n// ============================================\n\n/**\n * @attribute - Alias for @applyAttribute\n */\nexport function attribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attribute(selector: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator & PropertyDecorator {\n return applyAttribute(selector, targetAttributeNameOrOptions as any, options);\n}\n\n/**\n * @attributeThis - Apply attribute on $this element\n * Can be used as: @attributeThis or @attributeThis('attrName') or @attributeThis({ name: 'attrName' })\n */\nexport function attributeThis(target: Object, propertyKey: string | symbol): void;\nexport function attributeThis(targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attributeThis(options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attributeThis(targetOrOptions?: any, propertyKeyOrOptions?: any, descriptor?: PropertyDescriptor): any {\n // Direct decorator usage: @attributeThis\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null && !Array.isArray(targetOrOptions) &&\n typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol') {\n // Called as @attributeThis (target, propertyKey)\n return applyAttribute('$this', undefined as any, {})(targetOrOptions, propertyKeyOrOptions, descriptor);\n }\n\n // Called with parameters\n if (typeof targetOrOptions === 'string') {\n // @attributeThis('attrName', options?)\n return applyAttribute('$this', targetOrOptions, propertyKeyOrOptions);\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // @attributeThis({ name: 'attrName' })\n return applyAttribute('$this', undefined as any, targetOrOptions);\n } else {\n // @attributeThis() or @attributeThis\n return applyAttribute('$this', undefined as any, {});\n }\n}\n\n/**\n * @setAttribute - Alias for @applyAttribute (method-decorator semantics)\n */\nexport function setAttribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttribute(selector: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator {\n return applyAttribute(selector, targetAttributeNameOrOptions as any, options) as MethodDecorator;\n}\n\n/**\n * @setAttributeThis - Set attribute on $this element\n * Can be used as: @setAttributeThis or @setAttributeThis('attrName') or @setAttributeThis({ name: 'attrName' })\n */\nexport function setAttributeThis(target: Object, propertyKey: string | symbol): void;\nexport function setAttributeThis(targetAttributeName: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttributeThis(options?: AttributeOptions): MethodDecorator;\nexport function setAttributeThis(targetOrOptions?: any, propertyKeyOrOptions?: any, descriptor?: PropertyDescriptor): any {\n // Direct decorator usage: @setAttributeThis\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null && !Array.isArray(targetOrOptions) &&\n (typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol')) {\n // Called as @setAttributeThis (target, propertyKey)\n return applyAttribute('$this', undefined as any, {})(targetOrOptions, propertyKeyOrOptions, descriptor);\n }\n\n // Called with parameters\n if (typeof targetOrOptions === 'string') {\n // @setAttributeThis('attrName', options?)\n return applyAttribute('$this', targetOrOptions, propertyKeyOrOptions) as MethodDecorator;\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // @setAttributeThis({ name: 'attrName' })\n return applyAttribute('$this', undefined as any, targetOrOptions) as MethodDecorator;\n } else {\n // @setAttributeThis() or @setAttributeThis\n return applyAttribute('$this', undefined as any, {}) as MethodDecorator;\n }\n}\n\n// ============================================\n// Metadata Helpers\n// ============================================\n\nexport const findAllAttributeMetadata = (target: any): AttributeMetadata[] => {\n const actualTarget = target instanceof Function ? target : target.constructor;\n return ReflectUtils.findAllMetadata<AttributeMetadata[]>(ATTRIBUTE_METADATA_KEY, actualTarget).flat();\n};\n\n// Backward compatibility alias\nexport const findAllAttributeApplyMetadata = (target: any): Map<string | symbol, AttributeMetadata> => {\n const result = new Map<string | symbol, AttributeMetadata>();\n findAllAttributeMetadata(target).forEach(meta => {\n result.set(meta.propertyKey, meta);\n });\n return result;\n};\n\n\nexport default applyAttribute;\n"],
|
|
5
|
+
"mappings": ";;;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