@dooboostore/simple-web-component 1.0.55 → 1.0.57
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 +41 -0
- package/dist/cjs/decorators/subscribeSwcAppMessage.js +8 -4
- package/dist/cjs/decorators/subscribeSwcAppMessage.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppMessage.js +8 -4
- package/dist/esm/decorators/subscribeSwcAppMessage.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +46 -23
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts +9 -0
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +46 -23
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
- package/lsp/bin/swc-lsp.js +3 -0
- package/lsp/out/server/server.js +9960 -0
- package/lsp/package.json +82 -0
- package/package.json +23 -8
- package/src/decorators/subscribeSwcAppMessage.ts +17 -4
package/README.md
CHANGED
|
@@ -1992,6 +1992,40 @@ constructor(private service: Service) { super(); } // Web Components can't have
|
|
|
1992
1992
|
|
|
1993
1993
|
---
|
|
1994
1994
|
|
|
1995
|
+
## ⚡ Benchmarks
|
|
1996
|
+
|
|
1997
|
+
Measured in real Chrome against a hand-written `innerHTML` renderer and Lit, rendering the same 1,000-row table (state in fields, a decorated method returns the HTML, `@replaceChildren*` applies it):
|
|
1998
|
+
|
|
1999
|
+
- **Bulk rendering keeps up with Lit.** Creating 10,000 rows takes 244 ms, versus 232 ms for Lit and 222 ms for a hand-written `innerHTML` loop.
|
|
2000
|
+
- **Low memory.** 1,000 rows keep about 94 KB of JS heap, 6x less than Lit (558 KB); at 10,000 rows it is 1.6 MB versus 4.9 MB (3x less). Only the data is retained, no per-row template bookkeeping.
|
|
2001
|
+
- **Thin layer.** Rendering through the decorators costs within about 5% to 25% of the equivalent hand-written `innerHTML` code.
|
|
2002
|
+
|
|
2003
|
+
```text
|
|
2004
|
+
create 10,000 rows (lower is better)
|
|
2005
|
+
vanilla (innerHTML) ██████████████████████████ 222 ▲
|
|
2006
|
+
lit ████████████████████████████ 232
|
|
2007
|
+
simple-web-component █████████████████████████████ 244
|
|
2008
|
+
vanilla (DOM calls) ████████████████████████████████ 269
|
|
2009
|
+
|
|
2010
|
+
JS heap, 1,000 rows (KB) (lower is better)
|
|
2011
|
+
vanilla (innerHTML) ████ 73.4 ▲
|
|
2012
|
+
simple-web-component █████ 93.5
|
|
2013
|
+
vanilla (DOM calls) ███████ 119
|
|
2014
|
+
lit ████████████████████████████████ 558
|
|
2015
|
+
```
|
|
2016
|
+
|
|
2017
|
+
Full results, including the operations where other approaches are faster, methodology and caveats: [bench/RESULTS.md](./bench/RESULTS.md). Reproduce with `pnpm bench` inside `bench/`.
|
|
2018
|
+
|
|
2019
|
+
---
|
|
2020
|
+
|
|
2021
|
+
## 🧰 Editor Support (LSP)
|
|
2022
|
+
|
|
2023
|
+
The package ships a language server for SWC templates — `npx swc-lsp --stdio`:
|
|
2024
|
+
tag / attribute / `@state@` / `$host.` completion, hover, go to definition, parameter hints, and type errors inside `swc-on-*`, `{{= }}` and `@x@`
|
|
2025
|
+
(`swc-on-click="$host.tt(4)"` → *number is not assignable to string*).
|
|
2026
|
+
|
|
2027
|
+
Setup for IntelliJ, VS Code and Neovim: [lsp/README.md](https://github.com/dooboostore-develop/packages/tree/main/@dooboostore/simple-web-component/lsp).
|
|
2028
|
+
|
|
1995
2029
|
## 🧪 Testing
|
|
1996
2030
|
|
|
1997
2031
|
`pnpm test` type-checks the tests and runs them in a real browser (Chromium via Playwright, falling back to the installed Chrome) — no jsdom. Each test gets its own same-origin iframe window, so custom elements, `history` and `location` never leak between tests.
|
|
@@ -2054,8 +2088,15 @@ onAuth(@swcAppMessage msg: SwcAppMessage<User | null>) { ... }
|
|
|
2054
2088
|
@subscribeSwcAppMessage('auth-changed', { subject: 'behavior', trigger: 'connectedDone' })
|
|
2055
2089
|
@innerHtml('.wrap')
|
|
2056
2090
|
async load(@swcAppMessage msg: SwcAppMessage<User | null>) { ... }
|
|
2091
|
+
|
|
2092
|
+
// same thing, shorter (like @subscribeSwcAppRouteChangeConnectedDone)
|
|
2093
|
+
@subscribeSwcAppMessageBehaviorConnectedDone('auth-changed')
|
|
2094
|
+
@innerHtml('.wrap')
|
|
2095
|
+
async load(@swcAppMessage msg: SwcAppMessage<User | null>) { ... }
|
|
2057
2096
|
```
|
|
2058
2097
|
|
|
2098
|
+
This also covers an element that is attached again — e.g. a header re-created when a pre-rendered page boots: with the default trigger the replay lands before its render and the template's default text stays.
|
|
2099
|
+
|
|
2059
2100
|
Route subscribers (`@subscribeSwcAppRouteChange`) accept the same `trigger`.
|
|
2060
2101
|
Live broadcasts always reach everyone regardless of trigger.
|
|
2061
2102
|
|
|
@@ -23,6 +23,7 @@ __export(subscribeSwcAppMessage_exports, {
|
|
|
23
23
|
receiveMessage: () => receiveMessage,
|
|
24
24
|
subscribeSwcAppMessage: () => subscribeSwcAppMessage,
|
|
25
25
|
subscribeSwcAppMessageBehavior: () => subscribeSwcAppMessageBehavior,
|
|
26
|
+
subscribeSwcAppMessageBehaviorConnectedDone: () => subscribeSwcAppMessageBehaviorConnectedDone,
|
|
26
27
|
subscribeSwcAppMessageReplay: () => subscribeSwcAppMessageReplay
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(subscribeSwcAppMessage_exports);
|
|
@@ -59,14 +60,17 @@ function subscribeSwcAppMessage(targetOrMessageTypeOrOptions, optionsOrPropertyK
|
|
|
59
60
|
return createSubscribeSwcAppMessage(options, messageType);
|
|
60
61
|
}
|
|
61
62
|
const receiveMessage = subscribeSwcAppMessage;
|
|
62
|
-
const withSubject = (subject, a, b, descriptor) => {
|
|
63
|
-
if (descriptor) return createSubscribeSwcAppMessage({ subject })(a, b, descriptor);
|
|
64
|
-
if (typeof a === "string") return createSubscribeSwcAppMessage({ ...b ?? {}, subject }, a);
|
|
65
|
-
return createSubscribeSwcAppMessage({ ...a ?? {}, subject });
|
|
63
|
+
const withSubject = (subject, a, b, descriptor, fixed = {}) => {
|
|
64
|
+
if (descriptor) return createSubscribeSwcAppMessage({ subject, ...fixed })(a, b, descriptor);
|
|
65
|
+
if (typeof a === "string") return createSubscribeSwcAppMessage({ ...b ?? {}, subject, ...fixed }, a);
|
|
66
|
+
return createSubscribeSwcAppMessage({ ...a ?? {}, subject, ...fixed });
|
|
66
67
|
};
|
|
67
68
|
function subscribeSwcAppMessageBehavior(a, b, descriptor) {
|
|
68
69
|
return withSubject("behavior", a, b, descriptor);
|
|
69
70
|
}
|
|
71
|
+
function subscribeSwcAppMessageBehaviorConnectedDone(a, b, descriptor) {
|
|
72
|
+
return withSubject("behavior", a, b, descriptor, { trigger: "connectedDone" });
|
|
73
|
+
}
|
|
70
74
|
function subscribeSwcAppMessageReplay(a, b, descriptor) {
|
|
71
75
|
return withSubject("replay", a, b, descriptor);
|
|
72
76
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/subscribeSwcAppMessage.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SwcAppMessage, SwcAppMessageSubject, SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport const SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-message');\n\nexport interface SwcAppMessageOptions<Data = any, BeforeReturn = any, Result = any> {\n /** \uBA54\uC2DC\uC9C0 \uC218\uC2E0 \uC2DC \uD578\uB4E4\uB7EC \uC2E4\uD589 \uC5EC\uBD80 \uAC8C\uC774\uD2B8. Promise<boolean>\uB3C4 \uB418\uC5B4 async \uD310\uC815 \uAC00\uB2A5. false\uBA74 \uC2A4\uD0B5. */\n filter?: (message: SwcAppMessage<Data>, currentThis: any) => boolean | Promise<boolean>;\n /** filter \uD1B5\uACFC \uD6C4 \uD578\uB4E4\uB7EC \uC9C1\uC804 \uD6C5. await\uB418\uACE0, \uB9AC\uD134\uAC12\uC740 @swcAppMessageBeforeReturn \uC73C\uB85C \uD578\uB4E4\uB7EC\uC5D0 \uC8FC\uC785\uB41C\uB2E4. */\n before?: (message: SwcAppMessage<Data>, currentThis: any) => BeforeReturn | Promise<BeforeReturn>;\n /** \uD578\uB4E4\uB7EC\uAC00 \uC131\uACF5/\uC2E4\uD328\uD574\uB3C4 \uD56D\uC0C1 \uC2E4\uD589\uB418\uB294 \uC815\uB9AC \uD6C5. ctx\uB85C \uD578\uB4E4\uB7EC \uC778\uC790/\uACB0\uACFC/\uC5D0\uB7EC\uB97C \uBC1B\uB294\uB2E4. \uC5D0\uB7EC\uB294 \uC0BC\uD0A4\uC9C0 \uC54A\uACE0 \uC804\uD30C. */\n finally?: (message: SwcAppMessage<Data>, currentThis: any, ctx: { args: any[]; result?: Result; error?: any }) => any | Promise<any>;\n /**\n * \uB2A6\uAC8C \uC5F0\uACB0\uB41C \uACBD\uC6B0 \uACFC\uAC70 \uBA54\uC2DC\uC9C0 \uC7AC\uC0DD \uBC29\uC2DD. \uC774\uBBF8 \uC5F0\uACB0\uB41C \uAD6C\uB3C5\uC790\uC5D0\uAC8C\uB294 \uD56D\uC0C1 live\uB85C \uC3E8.\n * - \uBBF8\uC9C0\uC815/'subject': live\uB9CC. \uC9C0\uB098\uAC04 \uAC74 \uBABB \uBC1B\uC74C (\uAE30\uBCF8\uAC12, \uAE30\uC874 \uB3D9\uC791)\n * - 'behavior': \uB9C8\uC9C0\uB9C9 1\uAC1C \uC7AC\uC0DD\n * - 'replay': \uBC84\uD37C \uC804\uCCB4 \uC2DC\uAC04\uC21C \uC7AC\uC0DD\n */\n subject?: SwcAppMessageSubject;\n /**\n * \uC7AC\uC0DD \uC2DC\uC810. \uAE30\uBCF8 'connected' (\uC5F0\uACB0 \uC989\uC2DC).\n * - 'connectedDone': \uC5D8\uB9AC\uBA3C\uD2B8 render \uC644\uB8CC \uD6C4 (_connectedDone). @innerHtml \uB4F1\n * DOM \uD0C0\uAC9F\uC774 \uD544\uC694\uD55C \uD578\uB4E4\uB7EC\uB294 \uC774\uAC78\uB85C (replay\uAC00 render\uBCF4\uB2E4 \uBA3C\uC800 \uC640\uC11C \uC99D\uBC1C\uD558\uB294 \uB808\uC774\uC2A4 \uBC29\uC9C0).\n */\n trigger?: 'connected' | 'connectedDone';\n}\n\nexport interface SwcAppMessageSubscriberMetadata extends SwcAppMessageOptions {\n propertyKey: string | symbol;\n messageType?: string;\n}\n\nfunction createSubscribeSwcAppMessage(options?: SwcAppMessageOptions, messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor) as SwcAppMessageSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType, filter: options?.filter, before: options?.before, finally: options?.finally, subject: options?.subject, trigger: options?.trigger });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppMessage(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785\uB9CC\nexport function subscribeSwcAppMessage(messageType: string): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uC635\uC158\uB9CC\nexport function subscribeSwcAppMessage<Data = any, BeforeReturn = any, Result = any>(options: SwcAppMessageOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785 + \uC635\uC158\nexport function subscribeSwcAppMessage<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SwcAppMessageOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\n\nexport function subscribeSwcAppMessage(targetOrMessageTypeOrOptions?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppMessage\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n optionsOrPropertyKey && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n const propertyKey = optionsOrPropertyKey;\n return createSubscribeSwcAppMessage({})(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C)\n let messageType: string | undefined;\n let options: SwcAppMessageOptions = {};\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @subscribeSwcAppMessage('messageType') \uB610\uB294 @subscribeSwcAppMessage('messageType', options)\n messageType = targetOrMessageTypeOrOptions;\n if (optionsOrPropertyKey && typeof optionsOrPropertyKey === 'object') {\n options = optionsOrPropertyKey;\n }\n } else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object') {\n // \uC635\uC158\uB9CC \uC804\uB2EC: @subscribeSwcAppMessage({ filter: ... })\n options = targetOrMessageTypeOrOptions;\n }\n\n return createSubscribeSwcAppMessage(options, messageType);\n}\n\nexport const receiveMessage = subscribeSwcAppMessage;\n\n// \u2500\u2500 subject \uB97C \uC774\uB984\uC5D0 \uBC15\uC740 \uBCC4\uCE6D: @subscribeSwcAppMessageBehavior('auth') = @subscribeSwcAppMessage('auth', { subject: 'behavior' }) \u2500\u2500\ntype SubjectlessOptions<Data, BeforeReturn, Result> = Omit<SwcAppMessageOptions<Data, BeforeReturn, Result>, 'subject'>;\n\nconst withSubject = (subject: SwcAppMessageSubject, a?: any, b?: any, descriptor?: PropertyDescriptor): any => {\n if (descriptor) return createSubscribeSwcAppMessage({ subject })(a, b, descriptor); // \uAD04\uD638 \uC5C6\uC774\n if (typeof a === 'string') return createSubscribeSwcAppMessage({ ...(b ?? {}), subject }, a);\n return createSubscribeSwcAppMessage({ ...(a ?? {}), subject });\n};\n\n/** \uB2A6\uAC8C \uBD99\uC5B4\uB3C4 \uB9C8\uC9C0\uB9C9 \uBA54\uC2DC\uC9C0 1\uAC1C\uB97C \uBC1B\uB294\uB2E4 (subject: 'behavior') */\nexport function subscribeSwcAppMessageBehavior(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageBehavior(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior<Data = any, BeforeReturn = any, Result = any>(options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('behavior', a, b, descriptor);\n}\n\n/** \uB2A6\uAC8C \uBD99\uC5B4\uB3C4 \uC9C0\uB098\uAC04 \uBA54\uC2DC\uC9C0\uB97C \uC804\uBD80 \uC2DC\uAC04\uC21C\uC73C\uB85C \uBC1B\uB294\uB2E4 (subject: 'replay') */\nexport function subscribeSwcAppMessageReplay(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageReplay(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageReplay<Data = any, BeforeReturn = any, Result = any>(options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageReplay<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageReplay(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('replay', a, b, descriptor);\n}\n// Helper function to retrieve message subscribers metadata\nexport const getSubscribeSwcAppMessageMetadata = (target: any): SwcAppMessageSubscriberMetadata[] | undefined => {\n const constructor = typeof target === 'function' ? target : target.constructor;\n return ReflectUtils.findAllMetadata<any[]>(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor).flat();\n};\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// MessageSubscribeLifeCycler\n// NOTE: \uC2E4\uC81C \uAD6C\uB3C5 \uB85C\uC9C1\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\uB41C\uB2E4.\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nimport { ElementDefineLifeCycler } from '../types';\n\nexport class MessageSubscribeLifeCycler implements ElementDefineLifeCycler {\n onConnected(_helperHostSet: HelperHostSet): void {\n // \uC2E4\uC81C \uAD6C\uB3C5\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\n }\n\n /** SwcAppMixin \uC774 \uAD6C\uB3C5 \uB300\uC0C1 \uBA54\uD0C0\uB97C \uAEBC\uB0BC \uB54C \uC0AC\uC6A9 */\n getMetadata(helperHostSet: HelperHostSet): SwcAppMessageSubscriberMetadata[] | undefined {\n return getSubscribeSwcAppMessageMetadata(helperHostSet.$this);\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAGtB,MAAM,yCAAyC,OAAO,IAAI,gDAAgD;AA6BjH,SAAS,6BAA6B,SAAgC,aAAuC;AAC3G,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,eAAe,wCAAwC,WAAW;AAC1F,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,+BAAa,eAAe,wCAAwC,MAAM,WAAW;AAAA,IACvF;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,QAAQ,SAAS,QAAQ,QAAQ,SAAS,QAAQ,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,QAAQ,CAAC;AAEzK,WAAO;AAAA,EACT;AACF;AAWO,SAAS,uBAAuB,8BAAoC,sBAA4B,YAAsC;AAE3I,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,UAAM,cAAc;AACpB,WAAO,6BAA6B,CAAC,CAAC,EAAE,QAAQ,aAAa,UAAU;AAAA,EACzE;AAGA,MAAI;AACJ,MAAI,UAAgC,CAAC;AAErC,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,wBAAwB,OAAO,yBAAyB,UAAU;AACpE,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,gCAAgC,OAAO,iCAAiC,UAAU;AAE3F,cAAU;AAAA,EACZ;AAEA,SAAO,6BAA6B,SAAS,WAAW;AAC1D;AAEO,MAAM,iBAAiB;AAK9B,MAAM,cAAc,CAAC,SAA+B,GAAS,GAAS,
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SwcAppMessage, SwcAppMessageSubject, SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport const SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-message');\n\nexport interface SwcAppMessageOptions<Data = any, BeforeReturn = any, Result = any> {\n /** \uBA54\uC2DC\uC9C0 \uC218\uC2E0 \uC2DC \uD578\uB4E4\uB7EC \uC2E4\uD589 \uC5EC\uBD80 \uAC8C\uC774\uD2B8. Promise<boolean>\uB3C4 \uB418\uC5B4 async \uD310\uC815 \uAC00\uB2A5. false\uBA74 \uC2A4\uD0B5. */\n filter?: (message: SwcAppMessage<Data>, currentThis: any) => boolean | Promise<boolean>;\n /** filter \uD1B5\uACFC \uD6C4 \uD578\uB4E4\uB7EC \uC9C1\uC804 \uD6C5. await\uB418\uACE0, \uB9AC\uD134\uAC12\uC740 @swcAppMessageBeforeReturn \uC73C\uB85C \uD578\uB4E4\uB7EC\uC5D0 \uC8FC\uC785\uB41C\uB2E4. */\n before?: (message: SwcAppMessage<Data>, currentThis: any) => BeforeReturn | Promise<BeforeReturn>;\n /** \uD578\uB4E4\uB7EC\uAC00 \uC131\uACF5/\uC2E4\uD328\uD574\uB3C4 \uD56D\uC0C1 \uC2E4\uD589\uB418\uB294 \uC815\uB9AC \uD6C5. ctx\uB85C \uD578\uB4E4\uB7EC \uC778\uC790/\uACB0\uACFC/\uC5D0\uB7EC\uB97C \uBC1B\uB294\uB2E4. \uC5D0\uB7EC\uB294 \uC0BC\uD0A4\uC9C0 \uC54A\uACE0 \uC804\uD30C. */\n finally?: (message: SwcAppMessage<Data>, currentThis: any, ctx: { args: any[]; result?: Result; error?: any }) => any | Promise<any>;\n /**\n * \uB2A6\uAC8C \uC5F0\uACB0\uB41C \uACBD\uC6B0 \uACFC\uAC70 \uBA54\uC2DC\uC9C0 \uC7AC\uC0DD \uBC29\uC2DD. \uC774\uBBF8 \uC5F0\uACB0\uB41C \uAD6C\uB3C5\uC790\uC5D0\uAC8C\uB294 \uD56D\uC0C1 live\uB85C \uC3E8.\n * - \uBBF8\uC9C0\uC815/'subject': live\uB9CC. \uC9C0\uB098\uAC04 \uAC74 \uBABB \uBC1B\uC74C (\uAE30\uBCF8\uAC12, \uAE30\uC874 \uB3D9\uC791)\n * - 'behavior': \uB9C8\uC9C0\uB9C9 1\uAC1C \uC7AC\uC0DD\n * - 'replay': \uBC84\uD37C \uC804\uCCB4 \uC2DC\uAC04\uC21C \uC7AC\uC0DD\n */\n subject?: SwcAppMessageSubject;\n /**\n * \uC7AC\uC0DD \uC2DC\uC810. \uAE30\uBCF8 'connected' (\uC5F0\uACB0 \uC989\uC2DC).\n * - 'connectedDone': \uC5D8\uB9AC\uBA3C\uD2B8 render \uC644\uB8CC \uD6C4 (_connectedDone). @innerHtml \uB4F1\n * DOM \uD0C0\uAC9F\uC774 \uD544\uC694\uD55C \uD578\uB4E4\uB7EC\uB294 \uC774\uAC78\uB85C (replay\uAC00 render\uBCF4\uB2E4 \uBA3C\uC800 \uC640\uC11C \uC99D\uBC1C\uD558\uB294 \uB808\uC774\uC2A4 \uBC29\uC9C0).\n */\n trigger?: 'connected' | 'connectedDone';\n}\n\nexport interface SwcAppMessageSubscriberMetadata extends SwcAppMessageOptions {\n propertyKey: string | symbol;\n messageType?: string;\n}\n\nfunction createSubscribeSwcAppMessage(options?: SwcAppMessageOptions, messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor) as SwcAppMessageSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType, filter: options?.filter, before: options?.before, finally: options?.finally, subject: options?.subject, trigger: options?.trigger });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppMessage(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785\uB9CC\nexport function subscribeSwcAppMessage(messageType: string): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uC635\uC158\uB9CC\nexport function subscribeSwcAppMessage<Data = any, BeforeReturn = any, Result = any>(options: SwcAppMessageOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785 + \uC635\uC158\nexport function subscribeSwcAppMessage<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SwcAppMessageOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\n\nexport function subscribeSwcAppMessage(targetOrMessageTypeOrOptions?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppMessage\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n optionsOrPropertyKey && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n const propertyKey = optionsOrPropertyKey;\n return createSubscribeSwcAppMessage({})(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C)\n let messageType: string | undefined;\n let options: SwcAppMessageOptions = {};\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @subscribeSwcAppMessage('messageType') \uB610\uB294 @subscribeSwcAppMessage('messageType', options)\n messageType = targetOrMessageTypeOrOptions;\n if (optionsOrPropertyKey && typeof optionsOrPropertyKey === 'object') {\n options = optionsOrPropertyKey;\n }\n } else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object') {\n // \uC635\uC158\uB9CC \uC804\uB2EC: @subscribeSwcAppMessage({ filter: ... })\n options = targetOrMessageTypeOrOptions;\n }\n\n return createSubscribeSwcAppMessage(options, messageType);\n}\n\nexport const receiveMessage = subscribeSwcAppMessage;\n\n// \u2500\u2500 subject \uB97C \uC774\uB984\uC5D0 \uBC15\uC740 \uBCC4\uCE6D: @subscribeSwcAppMessageBehavior('auth') = @subscribeSwcAppMessage('auth', { subject: 'behavior' }) \u2500\u2500\ntype SubjectlessOptions<Data, BeforeReturn, Result> = Omit<SwcAppMessageOptions<Data, BeforeReturn, Result>, 'subject'>;\n\nconst withSubject = (subject: SwcAppMessageSubject, a?: any, b?: any, descriptor?: PropertyDescriptor, fixed: Partial<SwcAppMessageOptions> = {}): any => {\n if (descriptor) return createSubscribeSwcAppMessage({ subject, ...fixed })(a, b, descriptor); // \uAD04\uD638 \uC5C6\uC774\n if (typeof a === 'string') return createSubscribeSwcAppMessage({ ...(b ?? {}), subject, ...fixed }, a);\n return createSubscribeSwcAppMessage({ ...(a ?? {}), subject, ...fixed });\n};\n\n/** \uB2A6\uAC8C \uBD99\uC5B4\uB3C4 \uB9C8\uC9C0\uB9C9 \uBA54\uC2DC\uC9C0 1\uAC1C\uB97C \uBC1B\uB294\uB2E4 (subject: 'behavior') */\nexport function subscribeSwcAppMessageBehavior(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageBehavior(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior<Data = any, BeforeReturn = any, Result = any>(options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('behavior', a, b, descriptor);\n}\n\n/**\n * subscribeSwcAppMessageBehavior + trigger 'connectedDone' \u2014 \uB9C8\uC9C0\uB9C9 \uBA54\uC2DC\uC9C0\uB97C **\uC790\uAE30 \uB80C\uB354\uAC00 \uB05D\uB09C \uB4A4** \uBC1B\uB294\uB2E4.\n * \uD578\uB4E4\uB7EC\uAC00 \uC790\uAE30 DOM \uC5D0 \uC4F0\uB294 \uACBD\uC6B0(@innerHtml('.x'), @updateClass \uB4F1)\uC5D0 \uC4F4\uB2E4: \uAE30\uBCF8 trigger('connected')\uB294\n * \uB80C\uB354 \uC804\uC5D0 \uC7AC\uC0DD\uD574\uC11C \uB300\uC0C1\uC774 \uC544\uC9C1 \uC5C6\uC5B4 \uC870\uC6A9\uD788 \uBC84\uB824\uC9C4\uB2E4. (@subscribeSwcAppRouteChangeConnectedDone \uACFC \uAC19\uC740 \uADDC\uCE59)\n */\nexport function subscribeSwcAppMessageBehaviorConnectedDone(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageBehaviorConnectedDone(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageBehaviorConnectedDone<Data = any, BeforeReturn = any, Result = any>(options: Omit<SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>, 'trigger'>): MethodDecorator;\nexport function subscribeSwcAppMessageBehaviorConnectedDone<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: Omit<SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>, 'trigger'>): MethodDecorator;\nexport function subscribeSwcAppMessageBehaviorConnectedDone(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('behavior', a, b, descriptor, { trigger: 'connectedDone' });\n}\n\n/** \uB2A6\uAC8C \uBD99\uC5B4\uB3C4 \uC9C0\uB098\uAC04 \uBA54\uC2DC\uC9C0\uB97C \uC804\uBD80 \uC2DC\uAC04\uC21C\uC73C\uB85C \uBC1B\uB294\uB2E4 (subject: 'replay') */\nexport function subscribeSwcAppMessageReplay(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageReplay(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageReplay<Data = any, BeforeReturn = any, Result = any>(options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageReplay<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageReplay(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('replay', a, b, descriptor);\n}\n// Helper function to retrieve message subscribers metadata\nexport const getSubscribeSwcAppMessageMetadata = (target: any): SwcAppMessageSubscriberMetadata[] | undefined => {\n const constructor = typeof target === 'function' ? target : target.constructor;\n return ReflectUtils.findAllMetadata<any[]>(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor).flat();\n};\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// MessageSubscribeLifeCycler\n// NOTE: \uC2E4\uC81C \uAD6C\uB3C5 \uB85C\uC9C1\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\uB41C\uB2E4.\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nimport { ElementDefineLifeCycler } from '../types';\n\nexport class MessageSubscribeLifeCycler implements ElementDefineLifeCycler {\n onConnected(_helperHostSet: HelperHostSet): void {\n // \uC2E4\uC81C \uAD6C\uB3C5\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\n }\n\n /** SwcAppMixin \uC774 \uAD6C\uB3C5 \uB300\uC0C1 \uBA54\uD0C0\uB97C \uAEBC\uB0BC \uB54C \uC0AC\uC6A9 */\n getMetadata(helperHostSet: HelperHostSet): SwcAppMessageSubscriberMetadata[] | undefined {\n return getSubscribeSwcAppMessageMetadata(helperHostSet.$this);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAGtB,MAAM,yCAAyC,OAAO,IAAI,gDAAgD;AA6BjH,SAAS,6BAA6B,SAAgC,aAAuC;AAC3G,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,eAAe,wCAAwC,WAAW;AAC1F,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,+BAAa,eAAe,wCAAwC,MAAM,WAAW;AAAA,IACvF;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,QAAQ,SAAS,QAAQ,QAAQ,SAAS,QAAQ,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,QAAQ,CAAC;AAEzK,WAAO;AAAA,EACT;AACF;AAWO,SAAS,uBAAuB,8BAAoC,sBAA4B,YAAsC;AAE3I,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,UAAM,cAAc;AACpB,WAAO,6BAA6B,CAAC,CAAC,EAAE,QAAQ,aAAa,UAAU;AAAA,EACzE;AAGA,MAAI;AACJ,MAAI,UAAgC,CAAC;AAErC,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,wBAAwB,OAAO,yBAAyB,UAAU;AACpE,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,gCAAgC,OAAO,iCAAiC,UAAU;AAE3F,cAAU;AAAA,EACZ;AAEA,SAAO,6BAA6B,SAAS,WAAW;AAC1D;AAEO,MAAM,iBAAiB;AAK9B,MAAM,cAAc,CAAC,SAA+B,GAAS,GAAS,YAAiC,QAAuC,CAAC,MAAW;AACxJ,MAAI,WAAY,QAAO,6BAA6B,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,GAAG,GAAG,UAAU;AAC3F,MAAI,OAAO,MAAM,SAAU,QAAO,6BAA6B,EAAE,GAAI,KAAK,CAAC,GAAI,SAAS,GAAG,MAAM,GAAG,CAAC;AACrG,SAAO,6BAA6B,EAAE,GAAI,KAAK,CAAC,GAAI,SAAS,GAAG,MAAM,CAAC;AACzE;AAOO,SAAS,+BAA+B,GAAS,GAAS,YAAsC;AACrG,SAAO,YAAY,YAAY,GAAG,GAAG,UAAU;AACjD;AAWO,SAAS,4CAA4C,GAAS,GAAS,YAAsC;AAClH,SAAO,YAAY,YAAY,GAAG,GAAG,YAAY,EAAE,SAAS,gBAAgB,CAAC;AAC/E;AAOO,SAAS,6BAA6B,GAAS,GAAS,YAAsC;AACnG,SAAO,YAAY,UAAU,GAAG,GAAG,UAAU;AAC/C;AAEO,MAAM,oCAAoC,CAAC,WAA+D;AAC/G,QAAM,cAAc,OAAO,WAAW,aAAa,SAAS,OAAO;AACnE,SAAO,yBAAa,gBAAuB,wCAAwC,WAAW,EAAE,KAAK;AACvG;AAQO,MAAM,2BAA8D;AAAA,EACzE,YAAY,gBAAqC;AAAA,EAEjD;AAAA;AAAA,EAGA,YAAY,eAA6E;AACvF,WAAO,kCAAkC,cAAc,KAAK;AAAA,EAC9D;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -31,14 +31,17 @@ function subscribeSwcAppMessage(targetOrMessageTypeOrOptions, optionsOrPropertyK
|
|
|
31
31
|
return createSubscribeSwcAppMessage(options, messageType);
|
|
32
32
|
}
|
|
33
33
|
const receiveMessage = subscribeSwcAppMessage;
|
|
34
|
-
const withSubject = (subject, a, b, descriptor) => {
|
|
35
|
-
if (descriptor) return createSubscribeSwcAppMessage({ subject })(a, b, descriptor);
|
|
36
|
-
if (typeof a === "string") return createSubscribeSwcAppMessage({ ...b ?? {}, subject }, a);
|
|
37
|
-
return createSubscribeSwcAppMessage({ ...a ?? {}, subject });
|
|
34
|
+
const withSubject = (subject, a, b, descriptor, fixed = {}) => {
|
|
35
|
+
if (descriptor) return createSubscribeSwcAppMessage({ subject, ...fixed })(a, b, descriptor);
|
|
36
|
+
if (typeof a === "string") return createSubscribeSwcAppMessage({ ...b ?? {}, subject, ...fixed }, a);
|
|
37
|
+
return createSubscribeSwcAppMessage({ ...a ?? {}, subject, ...fixed });
|
|
38
38
|
};
|
|
39
39
|
function subscribeSwcAppMessageBehavior(a, b, descriptor) {
|
|
40
40
|
return withSubject("behavior", a, b, descriptor);
|
|
41
41
|
}
|
|
42
|
+
function subscribeSwcAppMessageBehaviorConnectedDone(a, b, descriptor) {
|
|
43
|
+
return withSubject("behavior", a, b, descriptor, { trigger: "connectedDone" });
|
|
44
|
+
}
|
|
42
45
|
function subscribeSwcAppMessageReplay(a, b, descriptor) {
|
|
43
46
|
return withSubject("replay", a, b, descriptor);
|
|
44
47
|
}
|
|
@@ -61,6 +64,7 @@ export {
|
|
|
61
64
|
receiveMessage,
|
|
62
65
|
subscribeSwcAppMessage,
|
|
63
66
|
subscribeSwcAppMessageBehavior,
|
|
67
|
+
subscribeSwcAppMessageBehaviorConnectedDone,
|
|
64
68
|
subscribeSwcAppMessageReplay
|
|
65
69
|
};
|
|
66
70
|
//# sourceMappingURL=subscribeSwcAppMessage.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/subscribeSwcAppMessage.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SwcAppMessage, SwcAppMessageSubject, SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport const SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-message');\n\nexport interface SwcAppMessageOptions<Data = any, BeforeReturn = any, Result = any> {\n /** \uBA54\uC2DC\uC9C0 \uC218\uC2E0 \uC2DC \uD578\uB4E4\uB7EC \uC2E4\uD589 \uC5EC\uBD80 \uAC8C\uC774\uD2B8. Promise<boolean>\uB3C4 \uB418\uC5B4 async \uD310\uC815 \uAC00\uB2A5. false\uBA74 \uC2A4\uD0B5. */\n filter?: (message: SwcAppMessage<Data>, currentThis: any) => boolean | Promise<boolean>;\n /** filter \uD1B5\uACFC \uD6C4 \uD578\uB4E4\uB7EC \uC9C1\uC804 \uD6C5. await\uB418\uACE0, \uB9AC\uD134\uAC12\uC740 @swcAppMessageBeforeReturn \uC73C\uB85C \uD578\uB4E4\uB7EC\uC5D0 \uC8FC\uC785\uB41C\uB2E4. */\n before?: (message: SwcAppMessage<Data>, currentThis: any) => BeforeReturn | Promise<BeforeReturn>;\n /** \uD578\uB4E4\uB7EC\uAC00 \uC131\uACF5/\uC2E4\uD328\uD574\uB3C4 \uD56D\uC0C1 \uC2E4\uD589\uB418\uB294 \uC815\uB9AC \uD6C5. ctx\uB85C \uD578\uB4E4\uB7EC \uC778\uC790/\uACB0\uACFC/\uC5D0\uB7EC\uB97C \uBC1B\uB294\uB2E4. \uC5D0\uB7EC\uB294 \uC0BC\uD0A4\uC9C0 \uC54A\uACE0 \uC804\uD30C. */\n finally?: (message: SwcAppMessage<Data>, currentThis: any, ctx: { args: any[]; result?: Result; error?: any }) => any | Promise<any>;\n /**\n * \uB2A6\uAC8C \uC5F0\uACB0\uB41C \uACBD\uC6B0 \uACFC\uAC70 \uBA54\uC2DC\uC9C0 \uC7AC\uC0DD \uBC29\uC2DD. \uC774\uBBF8 \uC5F0\uACB0\uB41C \uAD6C\uB3C5\uC790\uC5D0\uAC8C\uB294 \uD56D\uC0C1 live\uB85C \uC3E8.\n * - \uBBF8\uC9C0\uC815/'subject': live\uB9CC. \uC9C0\uB098\uAC04 \uAC74 \uBABB \uBC1B\uC74C (\uAE30\uBCF8\uAC12, \uAE30\uC874 \uB3D9\uC791)\n * - 'behavior': \uB9C8\uC9C0\uB9C9 1\uAC1C \uC7AC\uC0DD\n * - 'replay': \uBC84\uD37C \uC804\uCCB4 \uC2DC\uAC04\uC21C \uC7AC\uC0DD\n */\n subject?: SwcAppMessageSubject;\n /**\n * \uC7AC\uC0DD \uC2DC\uC810. \uAE30\uBCF8 'connected' (\uC5F0\uACB0 \uC989\uC2DC).\n * - 'connectedDone': \uC5D8\uB9AC\uBA3C\uD2B8 render \uC644\uB8CC \uD6C4 (_connectedDone). @innerHtml \uB4F1\n * DOM \uD0C0\uAC9F\uC774 \uD544\uC694\uD55C \uD578\uB4E4\uB7EC\uB294 \uC774\uAC78\uB85C (replay\uAC00 render\uBCF4\uB2E4 \uBA3C\uC800 \uC640\uC11C \uC99D\uBC1C\uD558\uB294 \uB808\uC774\uC2A4 \uBC29\uC9C0).\n */\n trigger?: 'connected' | 'connectedDone';\n}\n\nexport interface SwcAppMessageSubscriberMetadata extends SwcAppMessageOptions {\n propertyKey: string | symbol;\n messageType?: string;\n}\n\nfunction createSubscribeSwcAppMessage(options?: SwcAppMessageOptions, messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor) as SwcAppMessageSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType, filter: options?.filter, before: options?.before, finally: options?.finally, subject: options?.subject, trigger: options?.trigger });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppMessage(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785\uB9CC\nexport function subscribeSwcAppMessage(messageType: string): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uC635\uC158\uB9CC\nexport function subscribeSwcAppMessage<Data = any, BeforeReturn = any, Result = any>(options: SwcAppMessageOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785 + \uC635\uC158\nexport function subscribeSwcAppMessage<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SwcAppMessageOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\n\nexport function subscribeSwcAppMessage(targetOrMessageTypeOrOptions?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppMessage\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n optionsOrPropertyKey && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n const propertyKey = optionsOrPropertyKey;\n return createSubscribeSwcAppMessage({})(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C)\n let messageType: string | undefined;\n let options: SwcAppMessageOptions = {};\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @subscribeSwcAppMessage('messageType') \uB610\uB294 @subscribeSwcAppMessage('messageType', options)\n messageType = targetOrMessageTypeOrOptions;\n if (optionsOrPropertyKey && typeof optionsOrPropertyKey === 'object') {\n options = optionsOrPropertyKey;\n }\n } else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object') {\n // \uC635\uC158\uB9CC \uC804\uB2EC: @subscribeSwcAppMessage({ filter: ... })\n options = targetOrMessageTypeOrOptions;\n }\n\n return createSubscribeSwcAppMessage(options, messageType);\n}\n\nexport const receiveMessage = subscribeSwcAppMessage;\n\n// \u2500\u2500 subject \uB97C \uC774\uB984\uC5D0 \uBC15\uC740 \uBCC4\uCE6D: @subscribeSwcAppMessageBehavior('auth') = @subscribeSwcAppMessage('auth', { subject: 'behavior' }) \u2500\u2500\ntype SubjectlessOptions<Data, BeforeReturn, Result> = Omit<SwcAppMessageOptions<Data, BeforeReturn, Result>, 'subject'>;\n\nconst withSubject = (subject: SwcAppMessageSubject, a?: any, b?: any, descriptor?: PropertyDescriptor): any => {\n if (descriptor) return createSubscribeSwcAppMessage({ subject })(a, b, descriptor); // \uAD04\uD638 \uC5C6\uC774\n if (typeof a === 'string') return createSubscribeSwcAppMessage({ ...(b ?? {}), subject }, a);\n return createSubscribeSwcAppMessage({ ...(a ?? {}), subject });\n};\n\n/** \uB2A6\uAC8C \uBD99\uC5B4\uB3C4 \uB9C8\uC9C0\uB9C9 \uBA54\uC2DC\uC9C0 1\uAC1C\uB97C \uBC1B\uB294\uB2E4 (subject: 'behavior') */\nexport function subscribeSwcAppMessageBehavior(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageBehavior(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior<Data = any, BeforeReturn = any, Result = any>(options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('behavior', a, b, descriptor);\n}\n\n/** \uB2A6\uAC8C \uBD99\uC5B4\uB3C4 \uC9C0\uB098\uAC04 \uBA54\uC2DC\uC9C0\uB97C \uC804\uBD80 \uC2DC\uAC04\uC21C\uC73C\uB85C \uBC1B\uB294\uB2E4 (subject: 'replay') */\nexport function subscribeSwcAppMessageReplay(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageReplay(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageReplay<Data = any, BeforeReturn = any, Result = any>(options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageReplay<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageReplay(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('replay', a, b, descriptor);\n}\n// Helper function to retrieve message subscribers metadata\nexport const getSubscribeSwcAppMessageMetadata = (target: any): SwcAppMessageSubscriberMetadata[] | undefined => {\n const constructor = typeof target === 'function' ? target : target.constructor;\n return ReflectUtils.findAllMetadata<any[]>(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor).flat();\n};\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// MessageSubscribeLifeCycler\n// NOTE: \uC2E4\uC81C \uAD6C\uB3C5 \uB85C\uC9C1\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\uB41C\uB2E4.\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nimport { ElementDefineLifeCycler } from '../types';\n\nexport class MessageSubscribeLifeCycler implements ElementDefineLifeCycler {\n onConnected(_helperHostSet: HelperHostSet): void {\n // \uC2E4\uC81C \uAD6C\uB3C5\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\n }\n\n /** SwcAppMixin \uC774 \uAD6C\uB3C5 \uB300\uC0C1 \uBA54\uD0C0\uB97C \uAEBC\uB0BC \uB54C \uC0AC\uC6A9 */\n getMetadata(helperHostSet: HelperHostSet): SwcAppMessageSubscriberMetadata[] | undefined {\n return getSubscribeSwcAppMessageMetadata(helperHostSet.$this);\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAGtB,MAAM,yCAAyC,OAAO,IAAI,gDAAgD;AA6BjH,SAAS,6BAA6B,SAAgC,aAAuC;AAC3G,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,eAAe,wCAAwC,WAAW;AAC1F,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,mBAAa,eAAe,wCAAwC,MAAM,WAAW;AAAA,IACvF;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,QAAQ,SAAS,QAAQ,QAAQ,SAAS,QAAQ,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,QAAQ,CAAC;AAEzK,WAAO;AAAA,EACT;AACF;AAWO,SAAS,uBAAuB,8BAAoC,sBAA4B,YAAsC;AAE3I,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,UAAM,cAAc;AACpB,WAAO,6BAA6B,CAAC,CAAC,EAAE,QAAQ,aAAa,UAAU;AAAA,EACzE;AAGA,MAAI;AACJ,MAAI,UAAgC,CAAC;AAErC,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,wBAAwB,OAAO,yBAAyB,UAAU;AACpE,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,gCAAgC,OAAO,iCAAiC,UAAU;AAE3F,cAAU;AAAA,EACZ;AAEA,SAAO,6BAA6B,SAAS,WAAW;AAC1D;AAEO,MAAM,iBAAiB;AAK9B,MAAM,cAAc,CAAC,SAA+B,GAAS,GAAS,
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SwcAppMessage, SwcAppMessageSubject, SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport const SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-message');\n\nexport interface SwcAppMessageOptions<Data = any, BeforeReturn = any, Result = any> {\n /** \uBA54\uC2DC\uC9C0 \uC218\uC2E0 \uC2DC \uD578\uB4E4\uB7EC \uC2E4\uD589 \uC5EC\uBD80 \uAC8C\uC774\uD2B8. Promise<boolean>\uB3C4 \uB418\uC5B4 async \uD310\uC815 \uAC00\uB2A5. false\uBA74 \uC2A4\uD0B5. */\n filter?: (message: SwcAppMessage<Data>, currentThis: any) => boolean | Promise<boolean>;\n /** filter \uD1B5\uACFC \uD6C4 \uD578\uB4E4\uB7EC \uC9C1\uC804 \uD6C5. await\uB418\uACE0, \uB9AC\uD134\uAC12\uC740 @swcAppMessageBeforeReturn \uC73C\uB85C \uD578\uB4E4\uB7EC\uC5D0 \uC8FC\uC785\uB41C\uB2E4. */\n before?: (message: SwcAppMessage<Data>, currentThis: any) => BeforeReturn | Promise<BeforeReturn>;\n /** \uD578\uB4E4\uB7EC\uAC00 \uC131\uACF5/\uC2E4\uD328\uD574\uB3C4 \uD56D\uC0C1 \uC2E4\uD589\uB418\uB294 \uC815\uB9AC \uD6C5. ctx\uB85C \uD578\uB4E4\uB7EC \uC778\uC790/\uACB0\uACFC/\uC5D0\uB7EC\uB97C \uBC1B\uB294\uB2E4. \uC5D0\uB7EC\uB294 \uC0BC\uD0A4\uC9C0 \uC54A\uACE0 \uC804\uD30C. */\n finally?: (message: SwcAppMessage<Data>, currentThis: any, ctx: { args: any[]; result?: Result; error?: any }) => any | Promise<any>;\n /**\n * \uB2A6\uAC8C \uC5F0\uACB0\uB41C \uACBD\uC6B0 \uACFC\uAC70 \uBA54\uC2DC\uC9C0 \uC7AC\uC0DD \uBC29\uC2DD. \uC774\uBBF8 \uC5F0\uACB0\uB41C \uAD6C\uB3C5\uC790\uC5D0\uAC8C\uB294 \uD56D\uC0C1 live\uB85C \uC3E8.\n * - \uBBF8\uC9C0\uC815/'subject': live\uB9CC. \uC9C0\uB098\uAC04 \uAC74 \uBABB \uBC1B\uC74C (\uAE30\uBCF8\uAC12, \uAE30\uC874 \uB3D9\uC791)\n * - 'behavior': \uB9C8\uC9C0\uB9C9 1\uAC1C \uC7AC\uC0DD\n * - 'replay': \uBC84\uD37C \uC804\uCCB4 \uC2DC\uAC04\uC21C \uC7AC\uC0DD\n */\n subject?: SwcAppMessageSubject;\n /**\n * \uC7AC\uC0DD \uC2DC\uC810. \uAE30\uBCF8 'connected' (\uC5F0\uACB0 \uC989\uC2DC).\n * - 'connectedDone': \uC5D8\uB9AC\uBA3C\uD2B8 render \uC644\uB8CC \uD6C4 (_connectedDone). @innerHtml \uB4F1\n * DOM \uD0C0\uAC9F\uC774 \uD544\uC694\uD55C \uD578\uB4E4\uB7EC\uB294 \uC774\uAC78\uB85C (replay\uAC00 render\uBCF4\uB2E4 \uBA3C\uC800 \uC640\uC11C \uC99D\uBC1C\uD558\uB294 \uB808\uC774\uC2A4 \uBC29\uC9C0).\n */\n trigger?: 'connected' | 'connectedDone';\n}\n\nexport interface SwcAppMessageSubscriberMetadata extends SwcAppMessageOptions {\n propertyKey: string | symbol;\n messageType?: string;\n}\n\nfunction createSubscribeSwcAppMessage(options?: SwcAppMessageOptions, messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor) as SwcAppMessageSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType, filter: options?.filter, before: options?.before, finally: options?.finally, subject: options?.subject, trigger: options?.trigger });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppMessage(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785\uB9CC\nexport function subscribeSwcAppMessage(messageType: string): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uC635\uC158\uB9CC\nexport function subscribeSwcAppMessage<Data = any, BeforeReturn = any, Result = any>(options: SwcAppMessageOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C) - \uBA54\uC2DC\uC9C0 \uD0C0\uC785 + \uC635\uC158\nexport function subscribeSwcAppMessage<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SwcAppMessageOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\n\nexport function subscribeSwcAppMessage(targetOrMessageTypeOrOptions?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppMessage\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n optionsOrPropertyKey && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n const propertyKey = optionsOrPropertyKey;\n return createSubscribeSwcAppMessage({})(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C)\n let messageType: string | undefined;\n let options: SwcAppMessageOptions = {};\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @subscribeSwcAppMessage('messageType') \uB610\uB294 @subscribeSwcAppMessage('messageType', options)\n messageType = targetOrMessageTypeOrOptions;\n if (optionsOrPropertyKey && typeof optionsOrPropertyKey === 'object') {\n options = optionsOrPropertyKey;\n }\n } else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object') {\n // \uC635\uC158\uB9CC \uC804\uB2EC: @subscribeSwcAppMessage({ filter: ... })\n options = targetOrMessageTypeOrOptions;\n }\n\n return createSubscribeSwcAppMessage(options, messageType);\n}\n\nexport const receiveMessage = subscribeSwcAppMessage;\n\n// \u2500\u2500 subject \uB97C \uC774\uB984\uC5D0 \uBC15\uC740 \uBCC4\uCE6D: @subscribeSwcAppMessageBehavior('auth') = @subscribeSwcAppMessage('auth', { subject: 'behavior' }) \u2500\u2500\ntype SubjectlessOptions<Data, BeforeReturn, Result> = Omit<SwcAppMessageOptions<Data, BeforeReturn, Result>, 'subject'>;\n\nconst withSubject = (subject: SwcAppMessageSubject, a?: any, b?: any, descriptor?: PropertyDescriptor, fixed: Partial<SwcAppMessageOptions> = {}): any => {\n if (descriptor) return createSubscribeSwcAppMessage({ subject, ...fixed })(a, b, descriptor); // \uAD04\uD638 \uC5C6\uC774\n if (typeof a === 'string') return createSubscribeSwcAppMessage({ ...(b ?? {}), subject, ...fixed }, a);\n return createSubscribeSwcAppMessage({ ...(a ?? {}), subject, ...fixed });\n};\n\n/** \uB2A6\uAC8C \uBD99\uC5B4\uB3C4 \uB9C8\uC9C0\uB9C9 \uBA54\uC2DC\uC9C0 1\uAC1C\uB97C \uBC1B\uB294\uB2E4 (subject: 'behavior') */\nexport function subscribeSwcAppMessageBehavior(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageBehavior(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior<Data = any, BeforeReturn = any, Result = any>(options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageBehavior(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('behavior', a, b, descriptor);\n}\n\n/**\n * subscribeSwcAppMessageBehavior + trigger 'connectedDone' \u2014 \uB9C8\uC9C0\uB9C9 \uBA54\uC2DC\uC9C0\uB97C **\uC790\uAE30 \uB80C\uB354\uAC00 \uB05D\uB09C \uB4A4** \uBC1B\uB294\uB2E4.\n * \uD578\uB4E4\uB7EC\uAC00 \uC790\uAE30 DOM \uC5D0 \uC4F0\uB294 \uACBD\uC6B0(@innerHtml('.x'), @updateClass \uB4F1)\uC5D0 \uC4F4\uB2E4: \uAE30\uBCF8 trigger('connected')\uB294\n * \uB80C\uB354 \uC804\uC5D0 \uC7AC\uC0DD\uD574\uC11C \uB300\uC0C1\uC774 \uC544\uC9C1 \uC5C6\uC5B4 \uC870\uC6A9\uD788 \uBC84\uB824\uC9C4\uB2E4. (@subscribeSwcAppRouteChangeConnectedDone \uACFC \uAC19\uC740 \uADDC\uCE59)\n */\nexport function subscribeSwcAppMessageBehaviorConnectedDone(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageBehaviorConnectedDone(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageBehaviorConnectedDone<Data = any, BeforeReturn = any, Result = any>(options: Omit<SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>, 'trigger'>): MethodDecorator;\nexport function subscribeSwcAppMessageBehaviorConnectedDone<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: Omit<SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>, 'trigger'>): MethodDecorator;\nexport function subscribeSwcAppMessageBehaviorConnectedDone(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('behavior', a, b, descriptor, { trigger: 'connectedDone' });\n}\n\n/** \uB2A6\uAC8C \uBD99\uC5B4\uB3C4 \uC9C0\uB098\uAC04 \uBA54\uC2DC\uC9C0\uB97C \uC804\uBD80 \uC2DC\uAC04\uC21C\uC73C\uB85C \uBC1B\uB294\uB2E4 (subject: 'replay') */\nexport function subscribeSwcAppMessageReplay(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function subscribeSwcAppMessageReplay(messageType: string): MethodDecorator;\nexport function subscribeSwcAppMessageReplay<Data = any, BeforeReturn = any, Result = any>(options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageReplay<Data = any, BeforeReturn = any, Result = any>(messageType: string, options: SubjectlessOptions<NoInfer<Data>, NoInfer<BeforeReturn>, NoInfer<Result>>): MethodDecorator;\nexport function subscribeSwcAppMessageReplay(a?: any, b?: any, descriptor?: PropertyDescriptor): any {\n return withSubject('replay', a, b, descriptor);\n}\n// Helper function to retrieve message subscribers metadata\nexport const getSubscribeSwcAppMessageMetadata = (target: any): SwcAppMessageSubscriberMetadata[] | undefined => {\n const constructor = typeof target === 'function' ? target : target.constructor;\n return ReflectUtils.findAllMetadata<any[]>(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor).flat();\n};\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// MessageSubscribeLifeCycler\n// NOTE: \uC2E4\uC81C \uAD6C\uB3C5 \uB85C\uC9C1\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\uB41C\uB2E4.\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nimport { ElementDefineLifeCycler } from '../types';\n\nexport class MessageSubscribeLifeCycler implements ElementDefineLifeCycler {\n onConnected(_helperHostSet: HelperHostSet): void {\n // \uC2E4\uC81C \uAD6C\uB3C5\uC740 SwcAppMixin._connected \uC5D0\uC11C \uCC98\uB9AC\n }\n\n /** SwcAppMixin \uC774 \uAD6C\uB3C5 \uB300\uC0C1 \uBA54\uD0C0\uB97C \uAEBC\uB0BC \uB54C \uC0AC\uC6A9 */\n getMetadata(helperHostSet: HelperHostSet): SwcAppMessageSubscriberMetadata[] | undefined {\n return getSubscribeSwcAppMessageMetadata(helperHostSet.$this);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAGtB,MAAM,yCAAyC,OAAO,IAAI,gDAAgD;AA6BjH,SAAS,6BAA6B,SAAgC,aAAuC;AAC3G,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,eAAe,wCAAwC,WAAW;AAC1F,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,mBAAa,eAAe,wCAAwC,MAAM,WAAW;AAAA,IACvF;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,QAAQ,SAAS,QAAQ,QAAQ,SAAS,QAAQ,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,QAAQ,CAAC;AAEzK,WAAO;AAAA,EACT;AACF;AAWO,SAAS,uBAAuB,8BAAoC,sBAA4B,YAAsC;AAE3I,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,UAAM,cAAc;AACpB,WAAO,6BAA6B,CAAC,CAAC,EAAE,QAAQ,aAAa,UAAU;AAAA,EACzE;AAGA,MAAI;AACJ,MAAI,UAAgC,CAAC;AAErC,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,wBAAwB,OAAO,yBAAyB,UAAU;AACpE,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,gCAAgC,OAAO,iCAAiC,UAAU;AAE3F,cAAU;AAAA,EACZ;AAEA,SAAO,6BAA6B,SAAS,WAAW;AAC1D;AAEO,MAAM,iBAAiB;AAK9B,MAAM,cAAc,CAAC,SAA+B,GAAS,GAAS,YAAiC,QAAuC,CAAC,MAAW;AACxJ,MAAI,WAAY,QAAO,6BAA6B,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,GAAG,GAAG,UAAU;AAC3F,MAAI,OAAO,MAAM,SAAU,QAAO,6BAA6B,EAAE,GAAI,KAAK,CAAC,GAAI,SAAS,GAAG,MAAM,GAAG,CAAC;AACrG,SAAO,6BAA6B,EAAE,GAAI,KAAK,CAAC,GAAI,SAAS,GAAG,MAAM,CAAC;AACzE;AAOO,SAAS,+BAA+B,GAAS,GAAS,YAAsC;AACrG,SAAO,YAAY,YAAY,GAAG,GAAG,UAAU;AACjD;AAWO,SAAS,4CAA4C,GAAS,GAAS,YAAsC;AAClH,SAAO,YAAY,YAAY,GAAG,GAAG,YAAY,EAAE,SAAS,gBAAgB,CAAC;AAC/E;AAOO,SAAS,6BAA6B,GAAS,GAAS,YAAsC;AACnG,SAAO,YAAY,UAAU,GAAG,GAAG,UAAU;AAC/C;AAEO,MAAM,oCAAoC,CAAC,WAA+D;AAC/G,QAAM,cAAc,OAAO,WAAW,aAAa,SAAS,OAAO;AACnE,SAAO,aAAa,gBAAuB,wCAAwC,WAAW,EAAE,KAAK;AACvG;AAQO,MAAM,2BAA8D;AAAA,EACzE,YAAY,gBAAqC;AAAA,EAEjD;AAAA;AAAA,EAGA,YAAY,eAA6E;AACvF,WAAO,kCAAkC,cAAc,KAAK;AAAA,EAC9D;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// ../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js
|
|
34
34
|
var require_Reflect = __commonJS({
|
|
35
|
-
"
|
|
35
|
+
"../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js"() {
|
|
36
36
|
var Reflect2;
|
|
37
37
|
(function(Reflect3) {
|
|
38
38
|
(function(factory) {
|
|
@@ -15481,14 +15481,17 @@ function subscribeSwcAppMessage(targetOrMessageTypeOrOptions, optionsOrPropertyK
|
|
|
15481
15481
|
return createSubscribeSwcAppMessage(options, messageType);
|
|
15482
15482
|
}
|
|
15483
15483
|
var receiveMessage = subscribeSwcAppMessage;
|
|
15484
|
-
var withSubject = (subject, a, b, descriptor) => {
|
|
15485
|
-
if (descriptor) return createSubscribeSwcAppMessage({ subject })(a, b, descriptor);
|
|
15486
|
-
if (typeof a === "string") return createSubscribeSwcAppMessage({ ...b ?? {}, subject }, a);
|
|
15487
|
-
return createSubscribeSwcAppMessage({ ...a ?? {}, subject });
|
|
15484
|
+
var withSubject = (subject, a, b, descriptor, fixed = {}) => {
|
|
15485
|
+
if (descriptor) return createSubscribeSwcAppMessage({ subject, ...fixed })(a, b, descriptor);
|
|
15486
|
+
if (typeof a === "string") return createSubscribeSwcAppMessage({ ...b ?? {}, subject, ...fixed }, a);
|
|
15487
|
+
return createSubscribeSwcAppMessage({ ...a ?? {}, subject, ...fixed });
|
|
15488
15488
|
};
|
|
15489
15489
|
function subscribeSwcAppMessageBehavior(a, b, descriptor) {
|
|
15490
15490
|
return withSubject("behavior", a, b, descriptor);
|
|
15491
15491
|
}
|
|
15492
|
+
function subscribeSwcAppMessageBehaviorConnectedDone(a, b, descriptor) {
|
|
15493
|
+
return withSubject("behavior", a, b, descriptor, { trigger: "connectedDone" });
|
|
15494
|
+
}
|
|
15492
15495
|
function subscribeSwcAppMessageReplay(a, b, descriptor) {
|
|
15493
15496
|
return withSubject("replay", a, b, descriptor);
|
|
15494
15497
|
}
|
|
@@ -21124,26 +21127,45 @@ var SimstanceManager = class _SimstanceManager {
|
|
|
21124
21127
|
return registed.instance;
|
|
21125
21128
|
}
|
|
21126
21129
|
if (this.storage.has(targetKey) && void 0 === registed?.instance) {
|
|
21127
|
-
newInstanceCarrier.
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21131
|
-
|
|
21132
|
-
|
|
21133
|
-
|
|
21130
|
+
const resolving = newInstanceCarrier.resolving ?? (newInstanceCarrier.resolving = []);
|
|
21131
|
+
if (resolving.includes(targetKey)) {
|
|
21132
|
+
const nameOf = (t) => typeof t === "symbol" ? t.toString() : t?.name ?? String(t);
|
|
21133
|
+
throw new Error(
|
|
21134
|
+
`Circular dependency detected: ${[...resolving.map(nameOf), nameOf(targetKey)].join(" -> ")}`
|
|
21135
|
+
);
|
|
21136
|
+
}
|
|
21137
|
+
resolving.push(targetKey);
|
|
21138
|
+
let settled = false;
|
|
21139
|
+
try {
|
|
21140
|
+
newInstanceCarrier.depth++;
|
|
21141
|
+
const newSim = this.newSim({
|
|
21142
|
+
target: registed?.type ?? targetKey,
|
|
21143
|
+
newInstanceCarrier,
|
|
21144
|
+
simCreateAfter: (data) => {
|
|
21145
|
+
if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
|
|
21146
|
+
this.setStoreSet(targetKey, data, target);
|
|
21147
|
+
}
|
|
21134
21148
|
}
|
|
21135
|
-
}
|
|
21136
|
-
});
|
|
21137
|
-
newInstanceCarrier.depth--;
|
|
21138
|
-
if (newInstanceCarrier.depth === 0) {
|
|
21139
|
-
newInstanceCarrier.newInstances.forEach((it) => {
|
|
21140
|
-
this.callBindPostConstruct(it);
|
|
21141
21149
|
});
|
|
21150
|
+
newInstanceCarrier.depth--;
|
|
21151
|
+
resolving.pop();
|
|
21152
|
+
settled = true;
|
|
21153
|
+
if (newInstanceCarrier.depth === 0) {
|
|
21154
|
+
newInstanceCarrier.newInstances.forEach((it) => {
|
|
21155
|
+
this.callBindPostConstruct(it);
|
|
21156
|
+
});
|
|
21157
|
+
}
|
|
21158
|
+
if (isOnSimCreate(newSim)) {
|
|
21159
|
+
newSim.onSimCreate();
|
|
21160
|
+
}
|
|
21161
|
+
return newSim;
|
|
21162
|
+
} finally {
|
|
21163
|
+
if (!settled) {
|
|
21164
|
+
newInstanceCarrier.depth--;
|
|
21165
|
+
const idx = resolving.lastIndexOf(targetKey);
|
|
21166
|
+
if (idx !== -1) resolving.splice(idx, 1);
|
|
21167
|
+
}
|
|
21142
21168
|
}
|
|
21143
|
-
if (isOnSimCreate(newSim)) {
|
|
21144
|
-
newSim.onSimCreate();
|
|
21145
|
-
}
|
|
21146
|
-
return newSim;
|
|
21147
21169
|
}
|
|
21148
21170
|
const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
|
|
21149
21171
|
console.error(simNoSuch);
|
|
@@ -25193,6 +25215,7 @@ export {
|
|
|
25193
25215
|
styleShadow,
|
|
25194
25216
|
subscribeSwcAppMessage,
|
|
25195
25217
|
subscribeSwcAppMessageBehavior,
|
|
25218
|
+
subscribeSwcAppMessageBehaviorConnectedDone,
|
|
25196
25219
|
subscribeSwcAppMessageReplay,
|
|
25197
25220
|
subscribeSwcAppRouteChange,
|
|
25198
25221
|
subscribeSwcAppRouteChangeConnectedDone,
|