@dooboostore/simple-web-component 1.0.52 → 1.0.54
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 +7 -8
- package/dist/cjs/decorators/addEventListener.js +8 -3
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +15 -0
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/requestAnimationFrame.js +10 -2
- package/dist/cjs/decorators/requestAnimationFrame.js.map +2 -2
- package/dist/cjs/decorators/setInterval.js +4 -2
- package/dist/cjs/decorators/setInterval.js.map +2 -2
- package/dist/cjs/decorators/setTimeout.js +4 -2
- package/dist/cjs/decorators/setTimeout.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppMessage.js +14 -1
- package/dist/cjs/decorators/subscribeSwcAppMessage.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +8 -3
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +15 -0
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/requestAnimationFrame.js +10 -2
- package/dist/esm/decorators/requestAnimationFrame.js.map +2 -2
- package/dist/esm/decorators/setInterval.js +4 -2
- package/dist/esm/decorators/setInterval.js.map +2 -2
- package/dist/esm/decorators/setTimeout.js +4 -2
- package/dist/esm/decorators/setTimeout.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppMessage.js +14 -1
- package/dist/esm/decorators/subscribeSwcAppMessage.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +51 -6
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +12 -0
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/requestAnimationFrame.d.ts +7 -4
- package/dist/types/decorators/requestAnimationFrame.d.ts.map +1 -1
- package/dist/types/decorators/setInterval.d.ts +6 -4
- package/dist/types/decorators/setInterval.d.ts.map +1 -1
- package/dist/types/decorators/setTimeout.d.ts +6 -4
- package/dist/types/decorators/setTimeout.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts +12 -0
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +51 -6
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
- package/package.json +3 -3
- package/src/decorators/addEventListener.ts +10 -3
- package/src/decorators/applyNode.ts +30 -0
- package/src/decorators/requestAnimationFrame.ts +17 -5
- package/src/decorators/setInterval.ts +9 -5
- package/src/decorators/setTimeout.ts +9 -5
- package/src/decorators/subscribeSwcAppMessage.ts +27 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/setTimeout.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { buildSwcParameterArgs } from './parameter';\nimport { ElementDefineLifeCycler, HelperHostSet } from '../types';\n\nexport const SET_TIMEOUT_METADATA_KEY = Symbol.for('simple-web-component:set-timeout');\n\nexport type SetTimeoutType = 'onConnected' | 'returnValue';\n\nexport interface SetTimeoutOptions {\n /**\n * 'onConnected' (connect \uC2DC \uC790\uB3D9\uC73C\uB85C \uC608\uC57D, disconnect \uC2DC \uC790\uB3D9 \uC815\uB9AC) |\n * 'returnValue' (\uAE30\uBCF8\uAC12 - \uC790\uB3D9 \uC608\uC57D \uC5C6\uC74C. \uAC1C\uBC1C\uC790\uAC00 \uC774 \uBA54\uC11C\uB4DC\uB97C \uC9C1\uC811 \uD638\uCD9C\uD574\uC57C \uC608\uC57D\uB418\uACE0,\n * \uADF8 \uD638\uCD9C\uC758 \uB9AC\uD134\uAC12\uC774 \uC2E4\uC81C\uB85C \uC2E4\uD589\uB420 \uD568\uC218\uAC00 \uB41C\uB2E4 - \uC544\uB798 \uC124\uBA85 \uCC38\uACE0).\n */\n type?: SetTimeoutType;\n /** \uC2E4\uD589 \uC2DC \uB370\uCF54\uB808\uC774\uD2B8\uB41C \uBA54\uC11C\uB4DC\uC5D0 \uB118\uAE38 \uC778\uC790\uB97C \uACC4\uC0B0. type:'onConnected'\uC5D0\uC11C\uB9CC \uC758\uBBF8\uAC00 \uC788\uC74C (\uC5C6\uC73C\uBA74 \uC778\uC790 \uC5C6\uC774 \uD638\uCD9C). */\n parameter?: (set: HelperHostSet) => any[];\n /** \uD0C0\uC774\uBA38 \uB4F1\uB85D \uC9C1\uD6C4 1\uD68C \uD638\uCD9C (\uB514\uBC84\uAE45/\uB85C\uAE45\uC6A9). id\uB294 \uC2E4\uC81C setTimeout \uBC18\uD658\uAC12 - cleanup\uC740 \uC790\uB3D9\uC73C\uB85C \uCC98\uB9AC\uB418\uBBC0\uB85C \uC9C1\uC811 clear\uD560 \uD544\uC694 \uC5C6\uC74C. */\n created?: (set: HelperHostSet, id: number) => void;\n /** [type:'onConnected' \uC804\uC6A9] \uBC1C\uD654 \uC5EC\uBD80 \uAC8C\uC774\uD2B8. Promise<boolean>\uB3C4 \uAC00\uB2A5. false\uBA74 \uC2A4\uD0B5. */\n filter?: (set: HelperHostSet) => boolean | Promise<boolean>;\n /** [type:'onConnected' \uC804\uC6A9] \uD578\uB4E4\uB7EC \uC9C1\uC804 \uD6C5. await\uB418\uACE0, \uB9AC\uD134\uAC12\uC740 @setTimeoutBeforeReturn \uC73C\uB85C \uC8FC\uC785\uB41C\uB2E4. */\n before?: (set: HelperHostSet) => any | Promise<any>;\n /** [type:'onConnected' \uC804\uC6A9] \uD578\uB4E4\uB7EC\uAC00 \uC131\uACF5/\uC2E4\uD328\uD574\uB3C4 \uD56D\uC0C1 \uC2E4\uD589\uB418\uB294 \uC815\uB9AC \uD6C5. ctx\uB85C \uC778\uC790/\uACB0\uACFC/\uC5D0\uB7EC. */\n finally?: (set: HelperHostSet, ctx: { args: any[]; result?: any; error?: any }) => any | Promise<any>;\n /**\n * type:'onConnected' - fire \uC2DC \uB370\uCF54\uB808\uC774\uD2B8\uB41C \uBA54\uC11C\uB4DC\uC758 \uB9AC\uD134\uAC12\uC774 \uAC1D\uCCB4\uC774\uACE0 \uC774 \uD0A4\uC758 \uAC12\uC774 \uD568\uC218\uC774\uBA74 (id: number)\uB85C \uD638\uCD9C\uD55C\uB2E4.\n * type:'returnValue' - \uB9AC\uD134\uAC12\uC774 \uD568\uC218\uBA74 \uADF8 \uC790\uCCB4\uB97C, \uAC1D\uCCB4\uBA74 \uC774 \uD0A4\uC758 \uAC12\uC774 \uD568\uC218\uC77C \uB54C \uADF8 \uAC12\uC744 \"\uC2E4\uC81C\uB85C \uC2E4\uD589\uB420 \uD568\uC218\"\uB85C \uC0AC\uC6A9\uD55C\uB2E4.\n * \uC548 \uC8FC\uBA74 SET_TIMEOUT_METADATA_KEY\uB85C \uD3F4\uBC31\uD55C\uB2E4 - applyAttribute.ts/applyNode.ts\uC758 valueKey\uC640 \uB3D9\uC77C\uD55C \uCEE8\uBCA4\uC158\n * (\uB9AC\uD134 \uAC1D\uCCB4\uC5D0\uC11C \uC774 \uB370\uCF54\uB808\uC774\uD130 \uBAAB\uB9CC \uBF51\uC544 \uC4F0\uACE0, \uB2E4\uB978 \uB370\uCF54\uB808\uC774\uD130\uC640 \uC2A4\uD0DD\uD560 \uB54C\uB9CC \uCEE4\uC2A4\uD140 \uD0A4\uB85C \uAD6C\uBD84\uD558\uBA74 \uB41C\uB2E4).\n */\n valueKey?: symbol | string;\n}\n\nexport interface SetTimeoutMetadata {\n propertyKey: string | symbol;\n delay: number;\n options: SetTimeoutOptions;\n}\n\nconst getActiveEntries = (inst: any): number[] => (inst.__swc_timeoutIds ??= []);\n\n/**\n * type:'onConnected' - connect \uC2DC \uC790\uB3D9\uC73C\uB85C setTimeout\uC744 \uAC78\uACE0, disconnect \uC2DC (\uC544\uC9C1 \uC2E4\uD589 \uC804\uC774\uB77C\uBA74) \uC790\uB3D9\uC73C\uB85C clearTimeout \uD55C\uB2E4.\n * type:'returnValue'(\uAE30\uBCF8\uAC12) - \uBA54\uC11C\uB4DC\uB97C \uAC10\uC2F8\uC9C0 \uC54A\uB294 \uB300\uC2E0, \uD638\uCD9C\uB420 \uB54C\uB9C8\uB2E4(\uAC1C\uBC1C\uC790\uAC00 \uC9C1\uC811 \uD638\uCD9C) \uC6D0\uBCF8 \uB85C\uC9C1\uC744\n * \uADF8\uB300\uB85C \uC2E4\uD589\uD558\uACE0 \uB9AC\uD134\uAC12(\uB610\uB294 valueKey\uB85C \uBF51\uC740 \uAC12)\uC774 \uD568\uC218\uBA74 \uADF8 \uD568\uC218\uB97C \uC0C8 setTimeout\uC73C\uB85C \uC608\uC57D\uD55C\uB2E4.\n * \uD638\uCD9C\uD560 \uB54C\uB9C8\uB2E4 \uBCC4\uB3C4\uC758 \uC0C8 \uD0C0\uC774\uBA38\uAC00 \uC0DD\uAE30\uBA70, disconnect \uC2DC (\uC544\uC9C1 \uC2E4\uD589 \uC804\uC778 \uAC83\uB4E4\uC740) \uC804\uBD80 \uC815\uB9AC\uB41C\uB2E4.\n * \uC6D0\uBCF8 \uB9AC\uD134\uAC12\uC740 \uADF8\uB300\uB85C \uD1B5\uACFC\uC2DC\uD0A4\uBBC0\uB85C \uB2E4\uB978 \uB370\uCF54\uB808\uC774\uD130\uC640 \uAC19\uC740 \uBA54\uC11C\uB4DC\uC5D0 \uC2A4\uD0DD\uD574\uB3C4 \uC21C\uC11C\uC5D0 \uC0C1\uAD00\uC5C6\uC774 \uC548\uC804\uD558\uB2E4.\n */\nexport function setTimeout(delay: number, options: SetTimeoutOptions = {}): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n const normalizedOptions: SetTimeoutOptions = { ...options, type: options.type ?? 'returnValue' };\n\n let metaList = ReflectUtils.getOwnMetadata(SET_TIMEOUT_METADATA_KEY, constructor) as SetTimeoutMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(SET_TIMEOUT_METADATA_KEY, metaList, constructor);\n }\n metaList.push({ propertyKey, delay, options: normalizedOptions });\n\n if (normalizedOptions.type === 'onConnected' || !descriptor) {\n return; // LifeCycler\uAC00 connect/disconnect\uB97C \uC804\uB2F4 - wrapping \uBD88\uD544\uC694\n }\n\n const original = descriptor.value;\n descriptor.value = function (this: any, ...args: any[]) {\n const res = original.apply(this, args);\n // valueKey\uB97C \uC548 \uC8FC\uBA74 \uC774 \uB370\uCF54\uB808\uC774\uD130 \uC804\uC6A9 METADATA_KEY\uB85C \uD3F4\uBC31 (applyAttribute.ts/applyNode.ts\uC640 \uB3D9\uC77C\uD55C \uCEE8\uBCA4\uC158)\n const vk = normalizedOptions.valueKey ?? SET_TIMEOUT_METADATA_KEY;\n const tickFn: ((id: number) => void) | undefined =\n typeof res === 'function' ? res : res && typeof res === 'object' && typeof res[vk] === 'function' ? res[vk] : undefined;\n\n if (tickFn) {\n ensureInit(this);\n const win = SwcUtils.resolveWindow(this);\n const id = win.setTimeout(() => {\n const entries = getActiveEntries(this);\n const idx = entries.indexOf(id);\n if (idx >= 0) entries.splice(idx, 1);\n try {\n tickFn(id);\n } catch (e) {\n console.error('[SWC] setTimeout fire error:', e);\n }\n }, delay);\n normalizedOptions.created?.(SwcUtils.getHelperAndHostSet(this), id);\n getActiveEntries(this).push(id);\n }\n return res;\n };\n return descriptor;\n };\n}\n\nexport const findAllSetTimeoutMetadata = (target: any): SetTimeoutMetadata[] => {\n const constructor = typeof target === 'function' ? target : target.constructor;\n return (ReflectUtils.findAllMetadata<SetTimeoutMetadata[]>(SET_TIMEOUT_METADATA_KEY, constructor) || []).flat();\n};\n\nexport class SetTimeoutLifeCycler implements ElementDefineLifeCycler {\n onConnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n inst.__swc_timeoutIds = []; // \uC7AC\uC5F0\uACB0 \uB300\uBE44 \uB9AC\uC14B\n for (const meta of findAllSetTimeoutMetadata(inst)) {\n if (meta.options.type !== 'onConnected') continue; // returnValue \uD0C0\uC785\uC740 \uC218\uB3D9 \uD638\uCD9C\uC744 \uAE30\uB2E4\uB9BC\n const id = helperHostSet.$w.setTimeout(() => {\n void (async () => {\n const helper = SwcUtils.getHelperAndHostSet(inst);\n if (meta.options.filter && !(await meta.options.filter(helper))) return;\n const paramArgs = meta.options.parameter?.(helperHostSet) ?? [];\n const hostSet = SwcUtils.getHostSet(inst);\n const helperSet = SwcUtils.getHelperSet(helperHostSet.$w);\n const buildArgs = (beforeReturn: any) => buildSwcParameterArgs(inst, meta.propertyKey, {\n hostSet, helperHostSet: helper, helperSet, setTimeoutBeforeReturn: beforeReturn\n }, [...paramArgs, beforeReturn]);\n let args = buildArgs(undefined);\n if (meta.options.before) { const br = await meta.options.before(helper); args = buildArgs(br); }\n let result: any, error: any;\n try {\n result = await inst[meta.propertyKey](...args);\n const vk = meta.options.valueKey ?? SET_TIMEOUT_METADATA_KEY;\n if (result && typeof result === 'object' && typeof result[vk] === 'function') result[vk](id);\n } catch (e) {\n error = e;\n } finally {\n if (meta.options.finally) await meta.options.finally(helper, { args, result, error });\n }\n if (error) console.error('[SWC] setTimeout fire error:', error);\n })().catch(e => console.error('[SWC] setTimeout fire error:', e));\n }, meta.delay);\n meta.options.created?.(helperHostSet, id);\n getActiveEntries(inst).push(id);\n }\n }\n\n onDisconnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n for (const id of inst.__swc_timeoutIds ?? []) {\n try {\n helperHostSet.$w.clearTimeout(id);\n } catch (e) {\n console.error('[SWC] clearTimeout error:', e);\n }\n }\n inst.__swc_timeoutIds = [];\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAA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E,MAAM,WAAY,QAAO,EAAE,EAAE,EAAE;AAAA,UAC7F,SAAS,GAAG;AACV,oBAAQ;AAAA,UACV,UAAE;AACA,gBAAI,KAAK,QAAQ,QAAS,OAAM,KAAK,QAAQ,QAAQ,QAAQ,EAAE,MAAM,QAAQ,MAAM,CAAC;AAAA,UACtF;AACA,cAAI,MAAO,SAAQ,MAAM,gCAAgC,KAAK;AAAA,QAChE,GAAG,EAAE,MAAM,OAAK,QAAQ,MAAM,gCAAgC,CAAC,CAAC;AAAA,MAClE,GAAG,KAAK,KAAK;AACb,WAAK,QAAQ,UAAU,eAAe,EAAE;AACxC,uBAAiB,IAAI,EAAE,KAAK,EAAE;AAAA,IAChC;AAAA,EACF;AAAA,EAEA,eAAe,eAAoC;AACjD,UAAM,OAAO,cAAc;AAC3B,eAAW,MAAM,KAAK,oBAAoB,CAAC,GAAG;AAC5C,UAAI;AACF,sBAAc,GAAG,aAAa,EAAE;AAAA,MAClC,SAAS,GAAG;AACV,gBAAQ,MAAM,6BAA6B,CAAC;AAAA,MAC9C;AAAA,IACF;AACA,SAAK,mBAAmB,CAAC;AAAA,EAC3B;AACF;",
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { buildSwcParameterArgs } from './parameter';\nimport { ElementDefineLifeCycler, HelperHostSet } from '../types';\n\nexport const SET_TIMEOUT_METADATA_KEY = Symbol.for('simple-web-component:set-timeout');\n\nexport type SetTimeoutType = 'onConnected' | 'returnValue';\n\nexport interface SetTimeoutOptions {\n /**\n * 'onConnected' (\uAE30\uBCF8\uAC12 - connect \uC2DC \uC790\uB3D9\uC73C\uB85C \uC608\uC57D, disconnect \uC2DC \uC790\uB3D9 \uC815\uB9AC) |\n * 'returnValue' (\uC790\uB3D9 \uC608\uC57D \uC5C6\uC74C. \uAC1C\uBC1C\uC790\uAC00 \uC774 \uBA54\uC11C\uB4DC\uB97C \uC9C1\uC811 \uD638\uCD9C\uD574\uC57C \uC608\uC57D\uB418\uACE0,\n * \uADF8 \uD638\uCD9C\uC758 \uB9AC\uD134\uAC12\uC774 \uC2E4\uC81C\uB85C \uC2E4\uD589\uB420 \uD568\uC218\uAC00 \uB41C\uB2E4 - \uC544\uB798 \uC124\uBA85 \uCC38\uACE0).\n */\n type?: SetTimeoutType;\n /** \uC2E4\uD589 \uC2DC \uB370\uCF54\uB808\uC774\uD2B8\uB41C \uBA54\uC11C\uB4DC\uC5D0 \uB118\uAE38 \uC778\uC790\uB97C \uACC4\uC0B0. type:'onConnected'\uC5D0\uC11C\uB9CC \uC758\uBBF8\uAC00 \uC788\uC74C (\uC5C6\uC73C\uBA74 \uC778\uC790 \uC5C6\uC774 \uD638\uCD9C). */\n parameter?: (set: HelperHostSet) => any[];\n /** \uD0C0\uC774\uBA38 \uB4F1\uB85D \uC9C1\uD6C4 1\uD68C \uD638\uCD9C (\uB514\uBC84\uAE45/\uB85C\uAE45\uC6A9). id\uB294 \uC2E4\uC81C setTimeout \uBC18\uD658\uAC12 - cleanup\uC740 \uC790\uB3D9\uC73C\uB85C \uCC98\uB9AC\uB418\uBBC0\uB85C \uC9C1\uC811 clear\uD560 \uD544\uC694 \uC5C6\uC74C. */\n created?: (set: HelperHostSet, id: number) => void;\n /** [type:'onConnected' \uC804\uC6A9] \uBC1C\uD654 \uC5EC\uBD80 \uAC8C\uC774\uD2B8. Promise<boolean>\uB3C4 \uAC00\uB2A5. false\uBA74 \uC2A4\uD0B5. */\n filter?: (set: HelperHostSet) => boolean | Promise<boolean>;\n /** [type:'onConnected' \uC804\uC6A9] \uD578\uB4E4\uB7EC \uC9C1\uC804 \uD6C5. await\uB418\uACE0, \uB9AC\uD134\uAC12\uC740 @setTimeoutBeforeReturn \uC73C\uB85C \uC8FC\uC785\uB41C\uB2E4. */\n before?: (set: HelperHostSet) => any | Promise<any>;\n /** [type:'onConnected' \uC804\uC6A9] \uD578\uB4E4\uB7EC\uAC00 \uC131\uACF5/\uC2E4\uD328\uD574\uB3C4 \uD56D\uC0C1 \uC2E4\uD589\uB418\uB294 \uC815\uB9AC \uD6C5. ctx\uB85C \uC778\uC790/\uACB0\uACFC/\uC5D0\uB7EC. */\n finally?: (set: HelperHostSet, ctx: { args: any[]; result?: any; error?: any }) => any | Promise<any>;\n /**\n * type:'onConnected' - fire \uC2DC \uB370\uCF54\uB808\uC774\uD2B8\uB41C \uBA54\uC11C\uB4DC\uC758 \uB9AC\uD134\uAC12\uC774 \uAC1D\uCCB4\uC774\uACE0 \uC774 \uD0A4\uC758 \uAC12\uC774 \uD568\uC218\uC774\uBA74 (id: number)\uB85C \uD638\uCD9C\uD55C\uB2E4.\n * type:'returnValue' - \uB9AC\uD134\uAC12\uC774 \uD568\uC218\uBA74 \uADF8 \uC790\uCCB4\uB97C, \uAC1D\uCCB4\uBA74 \uC774 \uD0A4\uC758 \uAC12\uC774 \uD568\uC218\uC77C \uB54C \uADF8 \uAC12\uC744 \"\uC2E4\uC81C\uB85C \uC2E4\uD589\uB420 \uD568\uC218\"\uB85C \uC0AC\uC6A9\uD55C\uB2E4.\n * \uC548 \uC8FC\uBA74 SET_TIMEOUT_METADATA_KEY\uB85C \uD3F4\uBC31\uD55C\uB2E4 - applyAttribute.ts/applyNode.ts\uC758 valueKey\uC640 \uB3D9\uC77C\uD55C \uCEE8\uBCA4\uC158\n * (\uB9AC\uD134 \uAC1D\uCCB4\uC5D0\uC11C \uC774 \uB370\uCF54\uB808\uC774\uD130 \uBAAB\uB9CC \uBF51\uC544 \uC4F0\uACE0, \uB2E4\uB978 \uB370\uCF54\uB808\uC774\uD130\uC640 \uC2A4\uD0DD\uD560 \uB54C\uB9CC \uCEE4\uC2A4\uD140 \uD0A4\uB85C \uAD6C\uBD84\uD558\uBA74 \uB41C\uB2E4).\n */\n valueKey?: symbol | string;\n}\n\nexport interface SetTimeoutMetadata {\n propertyKey: string | symbol;\n delay: number;\n options: SetTimeoutOptions;\n}\n\nconst getActiveEntries = (inst: any): number[] => (inst.__swc_timeoutIds ??= []);\n\n/**\n * type:'onConnected'(\uAE30\uBCF8\uAC12) - connect \uC2DC \uC790\uB3D9\uC73C\uB85C setTimeout\uC744 \uAC78\uACE0, disconnect \uC2DC (\uC544\uC9C1 \uC2E4\uD589 \uC804\uC774\uB77C\uBA74) \uC790\uB3D9\uC73C\uB85C clearTimeout \uD55C\uB2E4.\n * type:'returnValue' (@setTimeoutReturnValue) - \uBA54\uC11C\uB4DC\uB97C \uAC10\uC2F8\uC9C0 \uC54A\uB294 \uB300\uC2E0, \uD638\uCD9C\uB420 \uB54C\uB9C8\uB2E4(\uAC1C\uBC1C\uC790\uAC00 \uC9C1\uC811 \uD638\uCD9C) \uC6D0\uBCF8 \uB85C\uC9C1\uC744\n * \uADF8\uB300\uB85C \uC2E4\uD589\uD558\uACE0 \uB9AC\uD134\uAC12(\uB610\uB294 valueKey\uB85C \uBF51\uC740 \uAC12)\uC774 \uD568\uC218\uBA74 \uADF8 \uD568\uC218\uB97C \uC0C8 setTimeout\uC73C\uB85C \uC608\uC57D\uD55C\uB2E4.\n * \uD638\uCD9C\uD560 \uB54C\uB9C8\uB2E4 \uBCC4\uB3C4\uC758 \uC0C8 \uD0C0\uC774\uBA38\uAC00 \uC0DD\uAE30\uBA70, disconnect \uC2DC (\uC544\uC9C1 \uC2E4\uD589 \uC804\uC778 \uAC83\uB4E4\uC740) \uC804\uBD80 \uC815\uB9AC\uB41C\uB2E4.\n * \uC6D0\uBCF8 \uB9AC\uD134\uAC12\uC740 \uADF8\uB300\uB85C \uD1B5\uACFC\uC2DC\uD0A4\uBBC0\uB85C \uB2E4\uB978 \uB370\uCF54\uB808\uC774\uD130\uC640 \uAC19\uC740 \uBA54\uC11C\uB4DC\uC5D0 \uC2A4\uD0DD\uD574\uB3C4 \uC21C\uC11C\uC5D0 \uC0C1\uAD00\uC5C6\uC774 \uC548\uC804\uD558\uB2E4.\n */\nexport function setTimeout(delay: number, options: SetTimeoutOptions = {}): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n const normalizedOptions: SetTimeoutOptions = { ...options, type: options.type ?? 'onConnected' };\n\n let metaList = ReflectUtils.getOwnMetadata(SET_TIMEOUT_METADATA_KEY, constructor) as SetTimeoutMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(SET_TIMEOUT_METADATA_KEY, metaList, constructor);\n }\n metaList.push({ propertyKey, delay, options: normalizedOptions });\n\n if (normalizedOptions.type === 'onConnected' || !descriptor) {\n return; // LifeCycler\uAC00 connect/disconnect\uB97C \uC804\uB2F4 - wrapping \uBD88\uD544\uC694\n }\n\n const original = descriptor.value;\n descriptor.value = function (this: any, ...args: any[]) {\n const res = original.apply(this, args);\n // valueKey\uB97C \uC548 \uC8FC\uBA74 \uC774 \uB370\uCF54\uB808\uC774\uD130 \uC804\uC6A9 METADATA_KEY\uB85C \uD3F4\uBC31 (applyAttribute.ts/applyNode.ts\uC640 \uB3D9\uC77C\uD55C \uCEE8\uBCA4\uC158)\n const vk = normalizedOptions.valueKey ?? SET_TIMEOUT_METADATA_KEY;\n const tickFn: ((id: number) => void) | undefined =\n typeof res === 'function' ? res : res && typeof res === 'object' && typeof res[vk] === 'function' ? res[vk] : undefined;\n\n if (tickFn) {\n ensureInit(this);\n const win = SwcUtils.resolveWindow(this);\n const id = win.setTimeout(() => {\n const entries = getActiveEntries(this);\n const idx = entries.indexOf(id);\n if (idx >= 0) entries.splice(idx, 1);\n try {\n tickFn(id);\n } catch (e) {\n console.error('[SWC] setTimeout fire error:', e);\n }\n }, delay);\n normalizedOptions.created?.(SwcUtils.getHelperAndHostSet(this), id);\n getActiveEntries(this).push(id);\n }\n return res;\n };\n return descriptor;\n };\n}\n\nexport const findAllSetTimeoutMetadata = (target: any): SetTimeoutMetadata[] => {\n const constructor = typeof target === 'function' ? target : target.constructor;\n return (ReflectUtils.findAllMetadata<SetTimeoutMetadata[]>(SET_TIMEOUT_METADATA_KEY, constructor) || []).flat();\n};\n\nexport class SetTimeoutLifeCycler implements ElementDefineLifeCycler {\n onConnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n inst.__swc_timeoutIds = []; // \uC7AC\uC5F0\uACB0 \uB300\uBE44 \uB9AC\uC14B\n for (const meta of findAllSetTimeoutMetadata(inst)) {\n if (meta.options.type !== 'onConnected') continue; // returnValue \uD0C0\uC785\uC740 \uC218\uB3D9 \uD638\uCD9C\uC744 \uAE30\uB2E4\uB9BC\n const id = helperHostSet.$w.setTimeout(() => {\n void (async () => {\n const helper = SwcUtils.getHelperAndHostSet(inst);\n if (meta.options.filter && !(await meta.options.filter(helper))) return;\n const paramArgs = meta.options.parameter?.(helperHostSet) ?? [];\n const hostSet = SwcUtils.getHostSet(inst);\n const helperSet = SwcUtils.getHelperSet(helperHostSet.$w);\n const buildArgs = (beforeReturn: any) => buildSwcParameterArgs(inst, meta.propertyKey, {\n hostSet, helperHostSet: helper, helperSet, setTimeoutBeforeReturn: beforeReturn\n }, [...paramArgs, beforeReturn]);\n let args = buildArgs(undefined);\n if (meta.options.before) { const br = await meta.options.before(helper); args = buildArgs(br); }\n let result: any, error: any;\n try {\n result = await inst[meta.propertyKey](...args);\n const vk = meta.options.valueKey ?? SET_TIMEOUT_METADATA_KEY;\n if (result && typeof result === 'object' && typeof result[vk] === 'function') result[vk](id);\n } catch (e) {\n error = e;\n } finally {\n if (meta.options.finally) await meta.options.finally(helper, { args, result, error });\n }\n if (error) console.error('[SWC] setTimeout fire error:', error);\n })().catch(e => console.error('[SWC] setTimeout fire error:', e));\n }, meta.delay);\n meta.options.created?.(helperHostSet, id);\n getActiveEntries(inst).push(id);\n }\n }\n\n onDisconnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n for (const id of inst.__swc_timeoutIds ?? []) {\n try {\n helperHostSet.$w.clearTimeout(id);\n } catch (e) {\n console.error('[SWC] clearTimeout error:', e);\n }\n }\n inst.__swc_timeoutIds = [];\n }\n}\n\n/** \uC218\uB3D9 \uC608\uC57D: \uBA54\uC11C\uB4DC\uB97C \uC9C1\uC811 \uD638\uCD9C\uD574\uC57C \uC608\uC57D\uB41C\uB2E4. = @setTimeout(delay, { type: 'returnValue' }) */\nexport const setTimeoutReturnValue = (delay: number, options: Omit<SetTimeoutOptions, 'type'> = {}): MethodDecorator =>\n setTimeout(delay, { ...options, type: 'returnValue' });\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,6BAA6B;AAG/B,MAAM,2BAA2B,OAAO,IAAI,kCAAkC;AAoCrF,MAAM,mBAAmB,CAAC,SAAyB,KAAK,qBAAL,KAAK,mBAAqB,CAAC;AASvE,SAAS,WAAW,OAAe,UAA6B,CAAC,GAAoB;AAC1F,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,OAAO;AAC3B,UAAM,oBAAuC,EAAE,GAAG,SAAS,MAAM,QAAQ,QAAQ,cAAc;AAE/F,QAAI,WAAW,aAAa,eAAe,0BAA0B,WAAW;AAChF,QAAI,CAAC,UAAU;AACb,iBAAW,CAAC;AACZ,mBAAa,eAAe,0BAA0B,UAAU,WAAW;AAAA,IAC7E;AACA,aAAS,KAAK,EAAE,aAAa,OAAO,SAAS,kBAAkB,CAAC;AAEhE,QAAI,kBAAkB,SAAS,iBAAiB,CAAC,YAAY;AAC3D;AAAA,IACF;AAEA,UAAM,WAAW,WAAW;AAC5B,eAAW,QAAQ,YAAwB,MAAa;AACtD,YAAM,MAAM,SAAS,MAAM,MAAM,IAAI;AAErC,YAAM,KAAK,kBAAkB,YAAY;AACzC,YAAM,SACJ,OAAO,QAAQ,aAAa,MAAM,OAAO,OAAO,QAAQ,YAAY,OAAO,IAAI,EAAE,MAAM,aAAa,IAAI,EAAE,IAAI;AAEhH,UAAI,QAAQ;AACV,mBAAW,IAAI;AACf,cAAM,MAAM,SAAS,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ribeSwcAppMessage(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 });
|
|
38
|
+
};
|
|
39
|
+
function subscribeSwcAppMessageBehavior(a, b, descriptor) {
|
|
40
|
+
return withSubject("behavior", a, b, descriptor);
|
|
41
|
+
}
|
|
42
|
+
function subscribeSwcAppMessageReplay(a, b, descriptor) {
|
|
43
|
+
return withSubject("replay", a, b, descriptor);
|
|
44
|
+
}
|
|
34
45
|
const getSubscribeSwcAppMessageMetadata = (target) => {
|
|
35
46
|
const constructor = typeof target === "function" ? target : target.constructor;
|
|
36
47
|
return ReflectUtils.findAllMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor).flat();
|
|
@@ -48,6 +59,8 @@ export {
|
|
|
48
59
|
SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY,
|
|
49
60
|
getSubscribeSwcAppMessageMetadata,
|
|
50
61
|
receiveMessage,
|
|
51
|
-
subscribeSwcAppMessage
|
|
62
|
+
subscribeSwcAppMessage,
|
|
63
|
+
subscribeSwcAppMessageBehavior,
|
|
64
|
+
subscribeSwcAppMessageReplay
|
|
52
65
|
};
|
|
53
66
|
//# 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 @appMessageBeforeReturn \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// 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;
|
|
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 @appMessageBeforeReturn \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,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YAAY,gBAAqC;AAAA,EAEjD;AAAA;AAAA,EAGA,YAAY,eAA6E;AACvF,WAAO,kCAAkC,cAAc,KAAK;AAAA,EAC9D;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -14816,7 +14816,9 @@ var EventListenerLifeCycler = class {
|
|
|
14816
14816
|
const currentWin = helperHostSet2.$w;
|
|
14817
14817
|
const { type, options } = meta;
|
|
14818
14818
|
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
14819
|
+
const matchedTargets = /* @__PURE__ */ new WeakMap();
|
|
14819
14820
|
const handler = async (event2) => {
|
|
14821
|
+
const matchedElement2 = matchedTargets.get(event2) ?? event2.currentTarget;
|
|
14820
14822
|
const helper = options.filter || options.before || options.finally ? SwcUtils.getHelperAndHostSet(target, currentWin) : void 0;
|
|
14821
14823
|
if (options.filter) {
|
|
14822
14824
|
if (!await options.filter(event2, { currentThis: inst, helper })) return;
|
|
@@ -14825,12 +14827,12 @@ var EventListenerLifeCycler = class {
|
|
|
14825
14827
|
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
14826
14828
|
if (options.preventDefault) event2.preventDefault();
|
|
14827
14829
|
const currentHostSet = SwcUtils.getHostSet(inst);
|
|
14828
|
-
const legacyArgs = [event2, { currentHostSet, $matchedElement:
|
|
14830
|
+
const legacyArgs = [event2, { currentHostSet, $matchedElement: matchedElement2 }, { event: event2, ...currentHostSet, $el: target, $root: target }];
|
|
14829
14831
|
const currentHelperSet = SwcUtils.getHelperSet(currentWin);
|
|
14830
14832
|
const currentHelperHostSet = { ...currentHelperSet, ...currentHostSet, $this: inst };
|
|
14831
14833
|
const buildArgs = (beforeReturn) => buildSwcParameterArgs(inst, meta.propertyKey, {
|
|
14832
14834
|
eventObject: event2,
|
|
14833
|
-
matchedElement:
|
|
14835
|
+
matchedElement: matchedElement2,
|
|
14834
14836
|
hostSet: currentHostSet,
|
|
14835
14837
|
helperHostSet: currentHelperHostSet,
|
|
14836
14838
|
helperSet: currentHelperSet,
|
|
@@ -14864,7 +14866,10 @@ var EventListenerLifeCycler = class {
|
|
|
14864
14866
|
next: (e) => handler(e).catch((err) => console.error("Event handler error:", err)),
|
|
14865
14867
|
error: (err) => console.error("Event stream error:", err)
|
|
14866
14868
|
});
|
|
14867
|
-
const wrappedHandler = (event2) =>
|
|
14869
|
+
const wrappedHandler = (event2) => {
|
|
14870
|
+
matchedTargets.set(event2, event2.currentTarget);
|
|
14871
|
+
eventSubject.next(event2);
|
|
14872
|
+
};
|
|
14868
14873
|
target.addEventListener(type, wrappedHandler, opts);
|
|
14869
14874
|
const onRemoves = options.removeListener ? [{ fn: options.removeListener, opts: options }] : [];
|
|
14870
14875
|
this.getBoundListeners(inst).push({ target, type, handler: wrappedHandler, options: opts, subscription, onRemoves, meta });
|
|
@@ -16936,6 +16941,17 @@ function subscribeSwcAppMessage(targetOrMessageTypeOrOptions, optionsOrPropertyK
|
|
|
16936
16941
|
return createSubscribeSwcAppMessage(options, messageType);
|
|
16937
16942
|
}
|
|
16938
16943
|
var receiveMessage = subscribeSwcAppMessage;
|
|
16944
|
+
var withSubject = (subject, a, b, descriptor) => {
|
|
16945
|
+
if (descriptor) return createSubscribeSwcAppMessage({ subject })(a, b, descriptor);
|
|
16946
|
+
if (typeof a === "string") return createSubscribeSwcAppMessage({ ...b ?? {}, subject }, a);
|
|
16947
|
+
return createSubscribeSwcAppMessage({ ...a ?? {}, subject });
|
|
16948
|
+
};
|
|
16949
|
+
function subscribeSwcAppMessageBehavior(a, b, descriptor) {
|
|
16950
|
+
return withSubject("behavior", a, b, descriptor);
|
|
16951
|
+
}
|
|
16952
|
+
function subscribeSwcAppMessageReplay(a, b, descriptor) {
|
|
16953
|
+
return withSubject("replay", a, b, descriptor);
|
|
16954
|
+
}
|
|
16939
16955
|
var getSubscribeSwcAppMessageMetadata = (target) => {
|
|
16940
16956
|
const constructor = typeof target === "function" ? target : target.constructor;
|
|
16941
16957
|
return ReflectUtils.findAllMetadata(SUBSCRIBE_SWC_APP_MESSAGE_METADATA_KEY, constructor).flat();
|
|
@@ -17010,7 +17026,7 @@ var getActiveEntries = (inst) => inst.__swc_intervalIds ?? (inst.__swc_intervalI
|
|
|
17010
17026
|
function setInterval2(interval2, options = {}) {
|
|
17011
17027
|
return (target, propertyKey, descriptor) => {
|
|
17012
17028
|
const constructor = target.constructor;
|
|
17013
|
-
const normalizedOptions = { ...options, type: options.type ?? "
|
|
17029
|
+
const normalizedOptions = { ...options, type: options.type ?? "onConnected" };
|
|
17014
17030
|
let metaList = ReflectUtils.getOwnMetadata(SET_INTERVAL_METADATA_KEY, constructor);
|
|
17015
17031
|
if (!metaList) {
|
|
17016
17032
|
metaList = [];
|
|
@@ -17100,6 +17116,7 @@ var SetIntervalLifeCycler = class {
|
|
|
17100
17116
|
inst.__swc_intervalIds = [];
|
|
17101
17117
|
}
|
|
17102
17118
|
};
|
|
17119
|
+
var setIntervalReturnValue = (interval2, options = {}) => setInterval2(interval2, { ...options, type: "returnValue" });
|
|
17103
17120
|
|
|
17104
17121
|
// src/decorators/setTimeout.ts
|
|
17105
17122
|
var SET_TIMEOUT_METADATA_KEY = Symbol.for("simple-web-component:set-timeout");
|
|
@@ -17107,7 +17124,7 @@ var getActiveEntries2 = (inst) => inst.__swc_timeoutIds ?? (inst.__swc_timeoutId
|
|
|
17107
17124
|
function setTimeout2(delay, options = {}) {
|
|
17108
17125
|
return (target, propertyKey, descriptor) => {
|
|
17109
17126
|
const constructor = target.constructor;
|
|
17110
|
-
const normalizedOptions = { ...options, type: options.type ?? "
|
|
17127
|
+
const normalizedOptions = { ...options, type: options.type ?? "onConnected" };
|
|
17111
17128
|
let metaList = ReflectUtils.getOwnMetadata(SET_TIMEOUT_METADATA_KEY, constructor);
|
|
17112
17129
|
if (!metaList) {
|
|
17113
17130
|
metaList = [];
|
|
@@ -17200,6 +17217,7 @@ var SetTimeoutLifeCycler = class {
|
|
|
17200
17217
|
inst.__swc_timeoutIds = [];
|
|
17201
17218
|
}
|
|
17202
17219
|
};
|
|
17220
|
+
var setTimeoutReturnValue = (delay, options = {}) => setTimeout2(delay, { ...options, type: "returnValue" });
|
|
17203
17221
|
|
|
17204
17222
|
// src/decorators/requestAnimationFrame.ts
|
|
17205
17223
|
var REQUEST_ANIMATION_FRAME_METADATA_KEY = Symbol.for("simple-web-component:request-animation-frame");
|
|
@@ -17226,7 +17244,7 @@ var startFrameLoop = (win, entries, frameFn) => {
|
|
|
17226
17244
|
};
|
|
17227
17245
|
var applyRequestAnimationFrame = (options, target, propertyKey, descriptor) => {
|
|
17228
17246
|
const constructor = target.constructor;
|
|
17229
|
-
const normalizedOptions = { ...options, type: options.type ?? "
|
|
17247
|
+
const normalizedOptions = { ...options, type: options.type ?? "onConnected" };
|
|
17230
17248
|
let metaList = ReflectUtils.getOwnMetadata(REQUEST_ANIMATION_FRAME_METADATA_KEY, constructor);
|
|
17231
17249
|
if (!metaList) {
|
|
17232
17250
|
metaList = [];
|
|
@@ -17288,6 +17306,13 @@ var RequestAnimationFrameLifeCycler = class {
|
|
|
17288
17306
|
inst.__swc_requestAnimationFrameIds = [];
|
|
17289
17307
|
}
|
|
17290
17308
|
};
|
|
17309
|
+
function requestAnimationFrameReturnValue(optionsOrTarget, propertyKey, descriptor) {
|
|
17310
|
+
if (propertyKey !== void 0) {
|
|
17311
|
+
applyRequestAnimationFrame({ type: "returnValue" }, optionsOrTarget, propertyKey, descriptor);
|
|
17312
|
+
return;
|
|
17313
|
+
}
|
|
17314
|
+
return (target, propertyKey2, descriptor2) => applyRequestAnimationFrame({ ...optionsOrTarget ?? {}, type: "returnValue" }, target, propertyKey2, descriptor2);
|
|
17315
|
+
}
|
|
17291
17316
|
|
|
17292
17317
|
// src/decorators/eventMedia.ts
|
|
17293
17318
|
var EVENT_MEDIA_METADATA_KEY = Symbol.for("simple-web-component:event-media");
|
|
@@ -18526,6 +18551,10 @@ var applyToDom = (currentThis, targetEl, res, pos, win, host) => {
|
|
|
18526
18551
|
targetEl.replaceChildren();
|
|
18527
18552
|
return [];
|
|
18528
18553
|
}
|
|
18554
|
+
if (pos === "remove") {
|
|
18555
|
+
(targetEl instanceof win.ShadowRoot ? targetEl.host : targetEl).remove();
|
|
18556
|
+
return [];
|
|
18557
|
+
}
|
|
18529
18558
|
const doc = win.document;
|
|
18530
18559
|
const hostSet2 = SwcUtils.getHelperAndHostSet(currentThis);
|
|
18531
18560
|
const id = currentThis._swcId;
|
|
@@ -18625,6 +18654,7 @@ function applyNode(selectorOrOptions, maybeOptions) {
|
|
|
18625
18654
|
};
|
|
18626
18655
|
const runApply = (target, val) => {
|
|
18627
18656
|
const pos = options.position || "beforeEnd";
|
|
18657
|
+
if (pos === "remove" && !val) return;
|
|
18628
18658
|
const processedVal = val;
|
|
18629
18659
|
if (!options.filter || options.filter(target, processedVal, { currentThis: this, helper: hostSet2 })) {
|
|
18630
18660
|
applyToDom(this, target, processedVal, pos, currentWin);
|
|
@@ -18669,6 +18699,15 @@ function clearChildrenNode(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
18669
18699
|
return applyNode({ ...selectorOrOptions, position: "clearChildren" });
|
|
18670
18700
|
}
|
|
18671
18701
|
var clearNode = clearChildrenNode;
|
|
18702
|
+
function removeNode(selectorOrOptions, maybeOptions, descriptor) {
|
|
18703
|
+
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
18704
|
+
return applyNode({ position: "remove" })(selectorOrOptions, maybeOptions, descriptor);
|
|
18705
|
+
}
|
|
18706
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
18707
|
+
return applyNode(selectorOrOptions, { ...maybeOptions, position: "remove" });
|
|
18708
|
+
}
|
|
18709
|
+
return applyNode({ ...selectorOrOptions, position: "remove" });
|
|
18710
|
+
}
|
|
18672
18711
|
function innerHtml(selectorOrOptions, maybeOptions, descriptor) {
|
|
18673
18712
|
if (descriptor !== void 0 && (typeof maybeOptions === "symbol" || typeof maybeOptions === "string")) {
|
|
18674
18713
|
return applyNode({ position: "innerHtml" })(selectorOrOptions, maybeOptions, descriptor);
|
|
@@ -24281,6 +24320,7 @@ export {
|
|
|
24281
24320
|
receiveMessage,
|
|
24282
24321
|
removeAttribute,
|
|
24283
24322
|
removeClass,
|
|
24323
|
+
removeNode,
|
|
24284
24324
|
removeSSRAttribute,
|
|
24285
24325
|
removeStyle,
|
|
24286
24326
|
replaceChildren,
|
|
@@ -24289,6 +24329,7 @@ export {
|
|
|
24289
24329
|
replaceChildrenSlot,
|
|
24290
24330
|
replaceChildrenTextSlot,
|
|
24291
24331
|
requestAnimationFrame,
|
|
24332
|
+
requestAnimationFrameReturnValue,
|
|
24292
24333
|
resizeObserver,
|
|
24293
24334
|
resizeObserverAll,
|
|
24294
24335
|
resizeObserverBeforeReturn,
|
|
@@ -24305,10 +24346,12 @@ export {
|
|
|
24305
24346
|
setClass,
|
|
24306
24347
|
setInterval2 as setInterval,
|
|
24307
24348
|
setIntervalBeforeReturn,
|
|
24349
|
+
setIntervalReturnValue,
|
|
24308
24350
|
setSSRAttribute,
|
|
24309
24351
|
setStyle,
|
|
24310
24352
|
setTimeout2 as setTimeout,
|
|
24311
24353
|
setTimeoutBeforeReturn,
|
|
24354
|
+
setTimeoutReturnValue,
|
|
24312
24355
|
skipIfEmpty,
|
|
24313
24356
|
skipIfExists,
|
|
24314
24357
|
skipIfSameTagPresent,
|
|
@@ -24319,6 +24362,8 @@ export {
|
|
|
24319
24362
|
styleLight,
|
|
24320
24363
|
styleShadow,
|
|
24321
24364
|
subscribeSwcAppMessage,
|
|
24365
|
+
subscribeSwcAppMessageBehavior,
|
|
24366
|
+
subscribeSwcAppMessageReplay,
|
|
24322
24367
|
subscribeSwcAppRouteChange,
|
|
24323
24368
|
subscribeSwcAppRouteChangeConnectedDone,
|
|
24324
24369
|
swcAppArticleTagName,
|