@dooboostore/simple-web-component 1.0.47 → 1.0.49
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 +223 -27
- package/dist/cjs/config/config.js +1 -1
- package/dist/cjs/config/config.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +412 -16
- package/dist/cjs/decorators/addEventListener.js.map +3 -3
- package/dist/cjs/decorators/applyAttribute.js +25 -0
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +49 -18
- package/dist/cjs/decorators/applyClass.js.map +3 -3
- package/dist/cjs/decorators/applyNode.js +67 -1
- package/dist/cjs/decorators/applyNode.js.map +3 -3
- package/dist/cjs/decorators/applyProperty.js +101 -3
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +36 -5
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/changedAttribute.js +39 -0
- package/dist/cjs/decorators/changedAttribute.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +244 -225
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +55 -0
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/index.js +5 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/intersectionObserver.js +209 -0
- package/dist/cjs/decorators/intersectionObserver.js.map +7 -0
- package/dist/cjs/decorators/mutationObserver.js +244 -0
- package/dist/cjs/decorators/mutationObserver.js.map +7 -0
- package/dist/cjs/decorators/query.js +129 -102
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/resizeObserver.js +191 -0
- package/dist/cjs/decorators/resizeObserver.js.map +7 -0
- package/dist/cjs/decorators/setInterval.js +82 -0
- package/dist/cjs/decorators/setInterval.js.map +7 -0
- package/dist/cjs/decorators/setTimeout.js +82 -0
- package/dist/cjs/decorators/setTimeout.js.map +7 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js +9 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -0
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/examples/RxJSOperatorsExample.js +285 -0
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/config/config.js +1 -1
- package/dist/esm/config/config.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +413 -16
- package/dist/esm/decorators/addEventListener.js.map +3 -3
- package/dist/esm/decorators/applyAttribute.js +25 -0
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +49 -18
- package/dist/esm/decorators/applyClass.js.map +3 -3
- package/dist/esm/decorators/applyNode.js +67 -1
- package/dist/esm/decorators/applyNode.js.map +3 -3
- package/dist/esm/decorators/applyProperty.js +101 -3
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +36 -5
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/changedAttribute.js +40 -0
- package/dist/esm/decorators/changedAttribute.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +249 -230
- package/dist/esm/decorators/elementDefine.js.map +3 -3
- package/dist/esm/decorators/emitCustomEvent.js +55 -0
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/index.js +5 -1
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/intersectionObserver.js +191 -0
- package/dist/esm/decorators/intersectionObserver.js.map +7 -0
- package/dist/esm/decorators/mutationObserver.js +226 -0
- package/dist/esm/decorators/mutationObserver.js.map +7 -0
- package/dist/esm/decorators/query.js +129 -102
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/resizeObserver.js +173 -0
- package/dist/esm/decorators/resizeObserver.js.map +7 -0
- package/dist/esm/decorators/setInterval.js +64 -0
- package/dist/esm/decorators/setInterval.js.map +7 -0
- package/dist/esm/decorators/setTimeout.js +64 -0
- package/dist/esm/decorators/setTimeout.js.map +7 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +9 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -0
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/examples/RxJSOperatorsExample.js +266 -0
- package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +2413 -889
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/config/config.d.ts.map +1 -1
- package/dist/types/decorators/addEventListener.d.ts +93 -23
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +22 -34
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +34 -34
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +30 -20
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +57 -34
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +25 -12
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/changedAttribute.d.ts +11 -0
- package/dist/types/decorators/changedAttribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +28 -4
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +5 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/intersectionObserver.d.ts +49 -0
- package/dist/types/decorators/intersectionObserver.d.ts.map +1 -0
- package/dist/types/decorators/mutationObserver.d.ts +46 -0
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -0
- package/dist/types/decorators/query.d.ts +63 -8
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/resizeObserver.d.ts +48 -0
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -0
- package/dist/types/decorators/setInterval.d.ts +29 -0
- package/dist/types/decorators/setInterval.d.ts.map +1 -0
- package/dist/types/decorators/setTimeout.d.ts +29 -0
- package/dist/types/decorators/setTimeout.d.ts.map +1 -0
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +7 -1
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +6 -0
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/examples/RxJSOperatorsExample.d.ts +94 -0
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +104 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +2413 -889
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +8 -6
- package/src/config/config.ts +1 -1
- package/src/decorators/addEventListener.ts +426 -23
- package/src/decorators/applyAttribute.ts +50 -36
- package/src/decorators/applyClass.ts +76 -26
- package/src/decorators/applyNode.ts +114 -36
- package/src/decorators/applyProperty.ts +152 -40
- package/src/decorators/applyStyle.ts +64 -17
- package/src/decorators/changedAttribute.ts +46 -0
- package/src/decorators/elementDefine.ts +301 -317
- package/src/decorators/emitCustomEvent.ts +73 -5
- package/src/decorators/index.ts +5 -1
- package/src/decorators/intersectionObserver.ts +259 -0
- package/src/decorators/mutationObserver.ts +304 -0
- package/src/decorators/query.ts +182 -117
- package/src/decorators/resizeObserver.ts +235 -0
- package/src/decorators/setInterval.ts +80 -0
- package/src/decorators/setTimeout.ts +80 -0
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +17 -0
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +19 -0
- package/src/examples/RxJSOperatorsExample.ts +279 -0
- package/src/types/index.ts +141 -0
- package/dist/cjs/decorators/queryAll.js +0 -181
- package/dist/cjs/decorators/queryAll.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAppMixin.js +0 -1
- package/dist/cjs/elements/tt/SwcAppMixin.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAsync.js +0 -1
- package/dist/cjs/elements/tt/SwcAsync.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcChoose.js +0 -1
- package/dist/cjs/elements/tt/SwcChoose.js.map +0 -7
- package/dist/cjs/elements/tt/SwcChooseTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcIf.js +0 -1
- package/dist/cjs/elements/tt/SwcIf.js.map +0 -7
- package/dist/cjs/elements/tt/SwcIfTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcIfTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcLoop.js +0 -1
- package/dist/cjs/elements/tt/SwcLoop.js.map +0 -7
- package/dist/cjs/elements/tt/SwcLoopTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcSubTemplates.js +0 -1
- package/dist/cjs/elements/tt/SwcSubTemplates.js.map +0 -7
- package/dist/cjs/elements/tt/register.js +0 -1
- package/dist/cjs/elements/tt/register.js.map +0 -7
- package/dist/esm/decorators/queryAll.js +0 -162
- package/dist/esm/decorators/queryAll.js.map +0 -7
- package/dist/esm/elements/tt/SwcAppMixin.js +0 -1
- package/dist/esm/elements/tt/SwcAppMixin.js.map +0 -7
- package/dist/esm/elements/tt/SwcAsync.js +0 -1
- package/dist/esm/elements/tt/SwcAsync.js.map +0 -7
- package/dist/esm/elements/tt/SwcAsyncTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcChoose.js +0 -1
- package/dist/esm/elements/tt/SwcChoose.js.map +0 -7
- package/dist/esm/elements/tt/SwcChooseTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcChooseTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcIf.js +0 -1
- package/dist/esm/elements/tt/SwcIf.js.map +0 -7
- package/dist/esm/elements/tt/SwcIfTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcIfTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcLoop.js +0 -1
- package/dist/esm/elements/tt/SwcLoop.js.map +0 -7
- package/dist/esm/elements/tt/SwcLoopTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcLoopTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcSubTemplates.js +0 -1
- package/dist/esm/elements/tt/SwcSubTemplates.js.map +0 -7
- package/dist/esm/elements/tt/register.js +0 -1
- package/dist/esm/elements/tt/register.js.map +0 -7
- package/dist/types/decorators/queryAll.d.ts +0 -22
- package/dist/types/decorators/queryAll.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts +0 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAsync.d.ts +0 -1
- package/dist/types/elements/tt/SwcAsync.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcChoose.d.ts +0 -1
- package/dist/types/elements/tt/SwcChoose.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcIf.d.ts +0 -1
- package/dist/types/elements/tt/SwcIf.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcLoop.d.ts +0 -1
- package/dist/types/elements/tt/SwcLoop.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcSubTemplates.d.ts +0 -1
- package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +0 -1
- package/dist/types/elements/tt/register.d.ts +0 -1
- package/dist/types/elements/tt/register.d.ts.map +0 -1
- package/src/decorators/queryAll.ts +0 -186
- package/src/elements/tt/SwcAppMixin.ts +0 -13
- package/src/elements/tt/SwcAsync.ts +0 -139
- package/src/elements/tt/SwcAsyncTemplate.ts +0 -126
- package/src/elements/tt/SwcChoose.ts +0 -182
- package/src/elements/tt/SwcChooseTemplate.ts +0 -229
- package/src/elements/tt/SwcIf.ts +0 -145
- package/src/elements/tt/SwcIfTemplate.ts +0 -158
- package/src/elements/tt/SwcLoop.ts +0 -222
- package/src/elements/tt/SwcLoopTemplate.ts +0 -255
- package/src/elements/tt/SwcSubTemplates.ts +0 -6
- package/src/elements/tt/register.ts +0 -720
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\n\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n config?: SwcConfigType;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n\nexport interface SwcElement {\n _swcId: string;\n // createSlotString(id: string): string\n // createEaHtml(id: string, script: string): string\n // createEaText(id: string, script: string): string\n // createEaAttribute(id: string, attributeName: string): string\n // createEaEvent(id: string, eventName: string): string\n // createEaProperty(id: string, propertyName: string): string\n}"],
|
|
4
|
+
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\n// \uACF5\uD1B5 \uC140\uB809\uD130 \uD568\uC218 \u2014 \uC694\uC18C/\uB178\uB4DC\uB97C \uC9C1\uC811 \uBC18\uD658\uD558\uB294 \uD568\uC218 \uC140\uB809\uD130 (query\uB294 Node\uAE4C\uC9C0 \uBC18\uD658 \uAC00\uB2A5)\nexport type SwcFnSelector = (currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null;\n// \uACF5\uD1B5 \uC140\uB809\uD130 \u2014 \uBB38\uC790\uC5F4(CSS/\uD2B9\uC218) \uB610\uB294 \uD568\uC218\nexport type SwcSelector = string | SwcFnSelector;\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\n\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n config?: SwcConfigType;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n\nexport interface SwcElement {\n _swcId: string;\n // createSlotString(id: string): string\n // createEaHtml(id: string, script: string): string\n // createEaText(id: string, script: string): string\n // createEaAttribute(id: string, attributeName: string): string\n // createEaEvent(id: string, eventName: string): string\n // createEaProperty(id: string, propertyName: string): string\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// ElementDefineLifeCycler\n//\n// \uAC01 \uB370\uCF54\uB808\uC774\uD130 \uD30C\uC77C(addEventListener, mutationObserver, \u2026)\uC774 \uC774 interface\uB97C\n// \uAD6C\uD604\uD574 export \uD558\uACE0, elementDefine.ts\uB294 cyclers \uBC30\uC5F4\uB85C \uAD00\uB9AC\uD558\uBA70 \uC704\uC784\uB9CC \uD55C\uB2E4.\n//\n// \uC2DC\uD074\uB7EC\uB294 \uC0DD\uC131\uC790\uC5D0\uC11C \uC544\uBB34 \uC778\uC790\uB3C4 \uBC1B\uC9C0 \uC54A\uB294\uB2E4. \uC0C1\uD0DC\uB294 \uC778\uC2A4\uD134\uC2A4\uBCC4\uB85C \uAD00\uB9AC\uD574\uC57C \uD558\uBBC0\uB85C,\n// \uAC01 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uD6C5(onConnected \uB4F1)\uC758 \uCCAB \uBC88\uC9F8 \uC778\uC790\uB85C HelperHostSet \uC744 \uBC1B\uC544\n// \uADF8 \uC548\uC758 $this(\uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4) / $w(window) \uB85C \uCC98\uB9AC\uD55C\uB2E4.\n// elementDefine \uC740 elementDefine \uC2DC\uC810\uC5D0 \uC2DC\uD074\uB7EC\uB97C 1\uD68C \uC0DD\uC131\uD558\uACE0 \uACC4\uC18D \uC7AC\uC0AC\uC6A9\uD55C\uB2E4.\n// \uBAA8\uB4E0 \uBA54\uC11C\uB4DC\uB294 optional \u2014 \uAD00\uC2EC \uC788\uB294 \uD6C5\uB9CC \uAD6C\uD604\uD558\uBA74 \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\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// onConnected \uBC18\uD658 \uD0C0\uC785\n//\n// \uAC01 cycler \uAC00 \"\uD544\uC694\uD55C observer \uC815\uBCF4\"\uB97C \uC120\uC5B8\uD558\uBA74,\n// elementDefine \uC774 \uC218\uC9D1\uD574\uC11C \uD544\uC694\uD55C \uACBD\uC6B0\uC5D0\uB9CC observer \uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD55C\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\n\n/** observer observe \uB300\uC0C1 \uC5D4\uD2B8\uB9AC. delegate:true \uC774\uBA74 target \uC740 \uC140\uB809\uD130 \uBB38\uC790\uC5F4\uC774\uBA70, \uC2E4\uC81C \uC694\uC18C\uB294 \uB3D9\uC801 \uCD94\uC801\uC73C\uB85C observe/unobserve \uB41C\uB2E4. */\nexport interface ObserverObserveTarget<TOptions> {\n target: Element | ShadowRoot | string;\n options?: TOptions;\n delegate?: boolean;\n /** delegate \uB3D9\uC801 \uCD94\uC801 \uC2DC observe/unobserve \uB97C \uC2E4\uD589\uD560 \uB8E8\uD2B8(\uC2A4\uCF54\uD504). delegate:true \uC77C \uB54C\uB9CC \uC758\uBBF8 \uC788\uB2E4. */\n delegateRoot?: SwcRootType;\n}\n\n/** MutationObserver observe \uB300\uC0C1 \uD558\uB098. \uB3D9\uC77C \uB8E8\uD2B8\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface MutationObserverSetEntry {\n target: Element | ShadowRoot | string;\n options?: MutationObserverInit;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (mutations: MutationRecord[], observer: MutationObserver) => void;\n}\n\n/** observe \uD560 \uB300\uC0C1 \uBAA9\uB85D (\uC5D4\uD2B8\uB9AC\uBCC4 \uCF5C\uBC31 \uD3EC\uD568). elementDefine \uC774 \uD558\uB098\uC758 MutationObserver \uB85C \uBAA8\uB450 observe \uD55C\uB2E4. */\nexport type MutationObserverSet = MutationObserverSetEntry[];\n\n/** ResizeObserver observe \uB300\uC0C1 \uD558\uB098. \uB3D9\uC77C \uC140\uB809\uD130\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface ResizeObserverSetEntry {\n target: Element | ShadowRoot | string;\n options?: ResizeObserverOptions;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;\n}\n\n/** observe \uD560 \uB300\uC0C1 \uBAA9\uB85D (\uC5D4\uD2B8\uB9AC\uBCC4 \uCF5C\uBC31 \uD3EC\uD568). elementDefine \uC774 \uD558\uB098\uC758 ResizeObserver \uB85C \uBAA8\uB450 observe \uD55C\uB2E4. */\nexport type ResizeObserverSet = ResizeObserverSetEntry[];\n\n/** IntersectionObserver observe \uB300\uC0C1 \uD558\uB098. \uAC19\uC740 \uC635\uC158 \uADF8\uB8F9\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface IntersectionObserverSetEntry {\n target: Element | ShadowRoot | string;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void;\n}\n\n/** IntersectionObserver \uADF8\uB8F9. observer \uB294 \uC0DD\uC131 \uC2DC\uC810\uC5D0 \uC635\uC158\uC774 \uACE0\uC815\uB418\uBBC0\uB85C \uC635\uC158\uBCC4\uB85C 1\uAC1C\uC529 \uC0DD\uC131\uB41C\uB2E4. */\nexport interface IntersectionObserverGroup {\n /** observer \uC0DD\uC131 \uC635\uC158 (threshold/rootMargin/root). \uC774 \uAC12\uC774 \uAC19\uC73C\uBA74 \uAC19\uC740 observer \uB97C \uACF5\uC720\uD55C\uB2E4. */\n options: IntersectionObserverInit;\n observeTargets: IntersectionObserverSetEntry[];\n}\n\n/** observe \uD560 \uC635\uC158 \uADF8\uB8F9 \uBAA9\uB85D. elementDefine \uC774 \uADF8\uB8F9\uB9C8\uB2E4 IntersectionObserver \uB97C \uC0DD\uC131\uD55C\uB2E4. */\nexport type IntersectionObserverSet = IntersectionObserverGroup[];\n\n/**\n * onConnected \uC758 \uBC18\uD658 \uD0C0\uC785.\n * observer \uAC00 \uD544\uC694 \uC5C6\uB294 cycler \uB294 undefined \uB97C \uBC18\uD658\uD574\uB3C4 \uB41C\uB2E4.\n */\nexport interface OnConnectedResult {\n mutationObserverSet?: MutationObserverSet;\n resizeObserverSet?: ResizeObserverSet;\n intersectionObserverSet?: IntersectionObserverSet;\n}\n\n/**\n * \uAC01 \uB370\uCF54\uB808\uC774\uD130 \uD30C\uC77C\uC774 \uAD6C\uD604\uD558\uB294 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uC704\uC784 interface.\n *\n * \uAD6C\uD604\uCCB4\uB294 \uC0C1\uD0DC\uB97C \uAC16\uC9C0 \uC54A\uACE0, \uAC01 \uD6C5\uC758 \uCCAB \uBC88\uC9F8 \uC778\uC790\uB85C HelperHostSet \uC744 \uBC1B\uB294\uB2E4.\n * \uAD00\uC2EC \uC788\uB294 \uD6C5\uB9CC \uAD6C\uD604\uD558\uBA74 \uB41C\uB2E4 (\uC804\uBD80 optional).\n *\n * ```ts\n * const eventCycler = new EventListenerLifeCycler();\n * const cyclers: ElementDefineLifeCycler[] = [eventCycler, ...]; // elementDefine \uC2DC 1\uD68C \uC0DD\uC131\n *\n * proto.connectedCallback = async function () {\n * const helperHostSet = SwcUtils.getHelperAndHostSet(win, this);\n * const results = await Promise.all(cyclers.map(c => c.onConnected?.(helperHostSet)));\n * // results \uC5D0\uC11C mutationObserverSet / resizeObserverSet \uC218\uC9D1\n * // \u2192 \uD544\uC694\uD55C \uACBD\uC6B0\uC5D0\uB9CC MutationObserver / ResizeObserver \uC0DD\uC131\n * };\n * proto.disconnectedCallback = function () {\n * for (const c of cyclers) c.onDisconnected?.(helperHostSet);\n * };\n * ```\n */\nexport interface ElementDefineLifeCycler {\n /**\n * connectedCallback \uC2DC \uD638\uCD9C.\n * observer \uAC00 \uD544\uC694\uD558\uBA74 OnConnectedResult \uB97C \uBC18\uD658\uD558\uACE0,\n * \uD544\uC694 \uC5C6\uC73C\uBA74 void / undefined \uB97C \uBC18\uD658\uD55C\uB2E4.\n * @param helperHostSet \uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4($this)\uB97C \uD3EC\uD568\uD55C \uCEE8\uD14D\uC2A4\uD2B8\n * @param resizeObserverSet \uC774\uC804 \uC2DC\uD074\uB7EC\uAC00 \uBC18\uD658\uD55C resize observer set (mutation \uC2DC\uD074\uB7EC\uAC00 \uC8FC\uC785\uBC1B\uC544 \uC0AC\uC6A9)\n */\n onConnected?(helperHostSet: HelperHostSet, resizeObserverSet?: ResizeObserverSet): OnConnectedResult | void | Promise<OnConnectedResult | void>;\n\n /** disconnectedCallback \uC2DC \uD638\uCD9C. \uB4F1\uB85D\uD55C \uB9AC\uC18C\uC2A4\uB97C \uD574\uC81C\uD55C\uB2E4. */\n onDisconnected?(helperHostSet: HelperHostSet): void;\n\n /** adoptedCallback \uC2DC \uD638\uCD9C (\uC120\uD0DD\uC801). */\n onAdopted?(helperHostSet: HelperHostSet): void;\n\n /**\n * attributeChangedCallback \uC2DC \uD638\uCD9C (\uC120\uD0DD\uC801).\n * @param helperHostSet \uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4($this)\uB97C \uD3EC\uD568\uD55C \uCEE8\uD14D\uC2A4\uD2B8\n * @param name \uBCC0\uACBD\uB41C attribute \uC774\uB984\n * @param oldVal \uC774\uC804 \uAC12\n * @param newVal \uC0C8 \uAC12 (ActionExpression \uCC98\uB9AC \uD6C4)\n */\n onAttributeChanged?(helperHostSet: HelperHostSet, name: string, oldVal: string | null, newVal: any): void;\n\n /**\n * observedAttributes \uC5D0 \uD3EC\uD568\uD574\uC57C \uD558\uB294 attribute \uC774\uB984 \uBAA9\uB85D\uC744 \uBC18\uD658\uD55C\uB2E4.\n * elementDefine \uC774 define-time(constructor)\uC5D0 \uD638\uCD9C\uD574 \uC218\uC9D1\uD55C\uB2E4.\n * \uAD00\uC2EC \uC5C6\uC73C\uBA74 \uAD6C\uD604\uD558\uC9C0 \uC54A\uAC70\uB098 \uBE48 \uBC30\uC5F4\uC744 \uBC18\uD658\uD55C\uB2E4.\n * @param target constructor \uB610\uB294 element \uC778\uC2A4\uD134\uC2A4 (\uBA54\uD0C0\uB370\uC774\uD130 \uC870\uD68C\uC6A9)\n */\n getObservedAttributeNames?(target: any): string[];\n}"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAK,sBAAL,kBAAKA,yBAAL;AACL,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,iBAAc;AACd,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,gBAAa;AACb,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,oBAAiB;AACjB,EAAAA,qBAAA,mBAAgB;AAVN,SAAAA;AAAA,GAAA;",
|
|
6
6
|
"names": ["InjectSituationType"]
|
|
7
7
|
}
|
|
@@ -57,7 +57,7 @@ const HTML_TAG_ENTRIES = [
|
|
|
57
57
|
["HTMLHeadingElement", "h1"],
|
|
58
58
|
["HTMLBodyElement", "body"]
|
|
59
59
|
];
|
|
60
|
-
const DOM_EVENT_NAMES = ["click", "dblclick", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "contextmenu", "keydown", "keypress", "keyup", "blur", "change", "focus", "focusin", "focusout", "input", "invalid", "reset", "search", "select", "submit", "drag", "dragend", "dragenter", "dragleave", "dragover", "dragstart", "drop", "copy", "cut", "paste", "abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting", "scroll", "resize", "load", "
|
|
60
|
+
const DOM_EVENT_NAMES = ["click", "dblclick", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "contextmenu", "keydown", "keypress", "keyup", "blur", "change", "focus", "focusin", "focusout", "input", "invalid", "reset", "search", "select", "submit", "drag", "dragend", "dragenter", "dragleave", "dragover", "dragstart", "drop", "copy", "cut", "paste", "abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting", "scroll", "resize", "load", "hashchange", "connected"];
|
|
61
61
|
const BROWSER_GLOBALS = ["window", "document", "Node", "Element", "HTMLElement", "DocumentFragment", "CustomEvent", "customElements", "NodeFilter", ...HTML_TAG_ENTRIES.map(([className]) => className)];
|
|
62
62
|
export {
|
|
63
63
|
BROWSER_GLOBALS,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/config.ts"],
|
|
4
|
-
"sourcesContent": ["export const HTML_TAG_ENTRIES: [string, string][] = [\n ['HTMLAnchorElement', 'a'],\n ['HTMLAreaElement', 'area'],\n ['HTMLAudioElement', 'audio'],\n ['HTMLBaseElement', 'base'],\n ['HTMLButtonElement', 'button'],\n ['HTMLCanvasElement', 'canvas'],\n ['HTMLDataElement', 'data'],\n ['HTMLDataListElement', 'datalist'],\n ['HTMLDetailsElement', 'details'],\n ['HTMLDialogElement', 'dialog'],\n ['HTMLDivElement', 'div'],\n ['HTMLDListElement', 'dl'],\n ['HTMLEmbedElement', 'embed'],\n ['HTMLFieldSetElement', 'fieldset'],\n ['HTMLFormElement', 'form'],\n ['HTMLHRElement', 'hr'],\n ['HTMLIFrameElement', 'iframe'],\n ['HTMLImageElement', 'img'],\n ['HTMLInputElement', 'input'],\n ['HTMLLabelElement', 'label'],\n ['HTMLLegendElement', 'legend'],\n ['HTMLLIElement', 'li'],\n ['HTMLLinkElement', 'link'],\n ['HTMLMapElement', 'map'],\n ['HTMLMetaElement', 'meta'],\n ['HTMLMeterElement', 'meter'],\n ['HTMLModElement', 'del'],\n ['HTMLObjectElement', 'object'],\n ['HTMLOListElement', 'ol'],\n ['HTMLOptGroupElement', 'optgroup'],\n ['HTMLOptionElement', 'option'],\n ['HTMLOutputElement', 'output'],\n ['HTMLParagraphElement', 'p'],\n ['HTMLParamElement', 'param'],\n ['HTMLPictureElement', 'picture'],\n ['HTMLPreElement', 'pre'],\n ['HTMLProgressElement', 'progress'],\n ['HTMLQuoteElement', 'blockquote'],\n ['HTMLScriptElement', 'script'],\n ['HTMLSelectElement', 'select'],\n ['HTMLSlotElement', 'slot'],\n ['HTMLSourceElement', 'source'],\n ['HTMLSpanElement', 'span'],\n ['HTMLStyleElement', 'style'],\n ['HTMLTableElement', 'table'],\n ['HTMLTableSectionElement', 'tbody'],\n ['HTMLTableCellElement', 'td'],\n ['HTMLTemplateElement', 'template'],\n ['HTMLTextAreaElement', 'textarea'],\n ['HTMLTimeElement', 'time'],\n ['HTMLTitleElement', 'title'],\n ['HTMLTableRowElement', 'tr'],\n ['HTMLTrackElement', 'track'],\n ['HTMLUListElement', 'ul'],\n ['HTMLVideoElement', 'video'],\n ['HTMLHeadingElement', 'h1'],\n ['HTMLBodyElement', 'body']\n];\n\nexport const DOM_EVENT_NAMES = ['click', 'dblclick', 'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'contextmenu', 'keydown', 'keypress', 'keyup', 'blur', 'change', 'focus', 'focusin', 'focusout', 'input', 'invalid', 'reset', 'search', 'select', 'submit', 'drag', 'dragend', 'dragenter', 'dragleave', 'dragover', 'dragstart', 'drop', 'copy', 'cut', 'paste', 'abort', 'canplay', 'canplaythrough', 'durationchange', 'emptied', 'ended', 'error', 'loadeddata', 'loadedmetadata', 'loadstart', 'pause', 'play', 'playing', 'progress', 'ratechange', 'seeked', 'seeking', 'stalled', 'suspend', 'timeupdate', 'volumechange', 'waiting', 'scroll', 'resize', 'load', '
|
|
5
|
-
"mappings": "AAAO,MAAM,mBAAuC;AAAA,EAClD,CAAC,qBAAqB,GAAG;AAAA,EACzB,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,sBAAsB,SAAS;AAAA,EAChC,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,kBAAkB,KAAK;AAAA,EACxB,CAAC,oBAAoB,IAAI;AAAA,EACzB,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,iBAAiB,IAAI;AAAA,EACtB,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,oBAAoB,KAAK;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,iBAAiB,IAAI;AAAA,EACtB,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,kBAAkB,KAAK;AAAA,EACxB,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,kBAAkB,KAAK;AAAA,EACxB,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,oBAAoB,IAAI;AAAA,EACzB,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,wBAAwB,GAAG;AAAA,EAC5B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,sBAAsB,SAAS;AAAA,EAChC,CAAC,kBAAkB,KAAK;AAAA,EACxB,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,oBAAoB,YAAY;AAAA,EACjC,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,2BAA2B,OAAO;AAAA,EACnC,CAAC,wBAAwB,IAAI;AAAA,EAC7B,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,uBAAuB,IAAI;AAAA,EAC5B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,oBAAoB,IAAI;AAAA,EACzB,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,sBAAsB,IAAI;AAAA,EAC3B,CAAC,mBAAmB,MAAM;AAC5B;AAEO,MAAM,kBAAkB,CAAC,SAAS,YAAY,aAAa,cAAc,cAAc,aAAa,YAAY,aAAa,WAAW,eAAe,WAAW,YAAY,SAAS,QAAQ,UAAU,SAAS,WAAW,YAAY,SAAS,WAAW,SAAS,UAAU,UAAU,UAAU,QAAQ,WAAW,aAAa,aAAa,YAAY,aAAa,QAAQ,QAAQ,OAAO,SAAS,SAAS,WAAW,kBAAkB,kBAAkB,WAAW,SAAS,SAAS,cAAc,kBAAkB,aAAa,SAAS,QAAQ,WAAW,YAAY,cAAc,UAAU,WAAW,WAAW,WAAW,cAAc,gBAAgB,WAAW,UAAU,UAAU,QAAQ,
|
|
4
|
+
"sourcesContent": ["export const HTML_TAG_ENTRIES: [string, string][] = [\n ['HTMLAnchorElement', 'a'],\n ['HTMLAreaElement', 'area'],\n ['HTMLAudioElement', 'audio'],\n ['HTMLBaseElement', 'base'],\n ['HTMLButtonElement', 'button'],\n ['HTMLCanvasElement', 'canvas'],\n ['HTMLDataElement', 'data'],\n ['HTMLDataListElement', 'datalist'],\n ['HTMLDetailsElement', 'details'],\n ['HTMLDialogElement', 'dialog'],\n ['HTMLDivElement', 'div'],\n ['HTMLDListElement', 'dl'],\n ['HTMLEmbedElement', 'embed'],\n ['HTMLFieldSetElement', 'fieldset'],\n ['HTMLFormElement', 'form'],\n ['HTMLHRElement', 'hr'],\n ['HTMLIFrameElement', 'iframe'],\n ['HTMLImageElement', 'img'],\n ['HTMLInputElement', 'input'],\n ['HTMLLabelElement', 'label'],\n ['HTMLLegendElement', 'legend'],\n ['HTMLLIElement', 'li'],\n ['HTMLLinkElement', 'link'],\n ['HTMLMapElement', 'map'],\n ['HTMLMetaElement', 'meta'],\n ['HTMLMeterElement', 'meter'],\n ['HTMLModElement', 'del'],\n ['HTMLObjectElement', 'object'],\n ['HTMLOListElement', 'ol'],\n ['HTMLOptGroupElement', 'optgroup'],\n ['HTMLOptionElement', 'option'],\n ['HTMLOutputElement', 'output'],\n ['HTMLParagraphElement', 'p'],\n ['HTMLParamElement', 'param'],\n ['HTMLPictureElement', 'picture'],\n ['HTMLPreElement', 'pre'],\n ['HTMLProgressElement', 'progress'],\n ['HTMLQuoteElement', 'blockquote'],\n ['HTMLScriptElement', 'script'],\n ['HTMLSelectElement', 'select'],\n ['HTMLSlotElement', 'slot'],\n ['HTMLSourceElement', 'source'],\n ['HTMLSpanElement', 'span'],\n ['HTMLStyleElement', 'style'],\n ['HTMLTableElement', 'table'],\n ['HTMLTableSectionElement', 'tbody'],\n ['HTMLTableCellElement', 'td'],\n ['HTMLTemplateElement', 'template'],\n ['HTMLTextAreaElement', 'textarea'],\n ['HTMLTimeElement', 'time'],\n ['HTMLTitleElement', 'title'],\n ['HTMLTableRowElement', 'tr'],\n ['HTMLTrackElement', 'track'],\n ['HTMLUListElement', 'ul'],\n ['HTMLVideoElement', 'video'],\n ['HTMLHeadingElement', 'h1'],\n ['HTMLBodyElement', 'body']\n];\n\nexport const DOM_EVENT_NAMES = ['click', 'dblclick', 'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'contextmenu', 'keydown', 'keypress', 'keyup', 'blur', 'change', 'focus', 'focusin', 'focusout', 'input', 'invalid', 'reset', 'search', 'select', 'submit', 'drag', 'dragend', 'dragenter', 'dragleave', 'dragover', 'dragstart', 'drop', 'copy', 'cut', 'paste', 'abort', 'canplay', 'canplaythrough', 'durationchange', 'emptied', 'ended', 'error', 'loadeddata', 'loadedmetadata', 'loadstart', 'pause', 'play', 'playing', 'progress', 'ratechange', 'seeked', 'seeking', 'stalled', 'suspend', 'timeupdate', 'volumechange', 'waiting', 'scroll', 'resize', 'load', 'hashchange', 'connected'];\n\nexport const BROWSER_GLOBALS = ['window', 'document', 'Node', 'Element', 'HTMLElement', 'DocumentFragment', 'CustomEvent', 'customElements', 'NodeFilter', ...HTML_TAG_ENTRIES.map(([className]) => className)];\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,mBAAuC;AAAA,EAClD,CAAC,qBAAqB,GAAG;AAAA,EACzB,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,sBAAsB,SAAS;AAAA,EAChC,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,kBAAkB,KAAK;AAAA,EACxB,CAAC,oBAAoB,IAAI;AAAA,EACzB,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,iBAAiB,IAAI;AAAA,EACtB,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,oBAAoB,KAAK;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,iBAAiB,IAAI;AAAA,EACtB,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,kBAAkB,KAAK;AAAA,EACxB,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,kBAAkB,KAAK;AAAA,EACxB,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,oBAAoB,IAAI;AAAA,EACzB,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,wBAAwB,GAAG;AAAA,EAC5B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,sBAAsB,SAAS;AAAA,EAChC,CAAC,kBAAkB,KAAK;AAAA,EACxB,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,oBAAoB,YAAY;AAAA,EACjC,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,qBAAqB,QAAQ;AAAA,EAC9B,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,2BAA2B,OAAO;AAAA,EACnC,CAAC,wBAAwB,IAAI;AAAA,EAC7B,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,uBAAuB,UAAU;AAAA,EAClC,CAAC,mBAAmB,MAAM;AAAA,EAC1B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,uBAAuB,IAAI;AAAA,EAC5B,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,oBAAoB,IAAI;AAAA,EACzB,CAAC,oBAAoB,OAAO;AAAA,EAC5B,CAAC,sBAAsB,IAAI;AAAA,EAC3B,CAAC,mBAAmB,MAAM;AAC5B;AAEO,MAAM,kBAAkB,CAAC,SAAS,YAAY,aAAa,cAAc,cAAc,aAAa,YAAY,aAAa,WAAW,eAAe,WAAW,YAAY,SAAS,QAAQ,UAAU,SAAS,WAAW,YAAY,SAAS,WAAW,SAAS,UAAU,UAAU,UAAU,QAAQ,WAAW,aAAa,aAAa,YAAY,aAAa,QAAQ,QAAQ,OAAO,SAAS,SAAS,WAAW,kBAAkB,kBAAkB,WAAW,SAAS,SAAS,cAAc,kBAAkB,aAAa,SAAS,QAAQ,WAAW,YAAY,cAAc,UAAU,WAAW,WAAW,WAAW,cAAc,gBAAgB,WAAW,UAAU,UAAU,QAAQ,cAAc,WAAW;AAE3sB,MAAM,kBAAkB,CAAC,UAAU,YAAY,QAAQ,WAAW,eAAe,oBAAoB,eAAe,kBAAkB,cAAc,GAAG,iBAAiB,IAAI,CAAC,CAAC,SAAS,MAAM,SAAS,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,33 +1,65 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import { ReflectUtils } from "@dooboostore/core";
|
|
2
5
|
const ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
3
|
-
function addEventListener(
|
|
6
|
+
function addEventListener(selectorOrType, typeOrOptions, maybeOptions) {
|
|
4
7
|
return (targetObj, propertyKey, descriptor) => {
|
|
8
|
+
let selector;
|
|
9
|
+
let types;
|
|
10
|
+
let opts = {};
|
|
11
|
+
if (typeof typeOrOptions === "string" || Array.isArray(typeOrOptions)) {
|
|
12
|
+
selector = selectorOrType;
|
|
13
|
+
types = Array.isArray(typeOrOptions) ? typeOrOptions : [typeOrOptions];
|
|
14
|
+
opts = maybeOptions ?? {};
|
|
15
|
+
} else {
|
|
16
|
+
selector = "$this";
|
|
17
|
+
if (Array.isArray(selectorOrType)) types = selectorOrType;
|
|
18
|
+
else types = [selectorOrType];
|
|
19
|
+
opts = typeOrOptions ?? {};
|
|
20
|
+
}
|
|
5
21
|
const constructor = targetObj.constructor;
|
|
6
22
|
let listeners = ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
7
23
|
if (!listeners) {
|
|
8
24
|
listeners = [];
|
|
9
25
|
ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);
|
|
10
26
|
}
|
|
11
|
-
listeners.push({ propertyKey, selector
|
|
27
|
+
for (const type of types) listeners.push({ propertyKey, selector, type, options: opts });
|
|
12
28
|
};
|
|
13
29
|
}
|
|
14
|
-
function
|
|
30
|
+
function addEventListenerDelegateLight(selector, type, options) {
|
|
15
31
|
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: true });
|
|
16
32
|
}
|
|
17
|
-
function
|
|
33
|
+
function addEventListenerDelegateShadow(selector, type, options) {
|
|
18
34
|
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: true });
|
|
19
35
|
}
|
|
20
|
-
function
|
|
36
|
+
function addEventListenerDelegateAll(selector, type, options) {
|
|
21
37
|
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: true });
|
|
22
38
|
}
|
|
23
39
|
function addEventListenerDelegate(selector, type, options) {
|
|
24
40
|
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
25
41
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
function addEventListenerMutationLight(selector, type, options) {
|
|
43
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: "mutation" });
|
|
44
|
+
}
|
|
45
|
+
function addEventListenerMutationShadow(selector, type, options) {
|
|
46
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: "mutation" });
|
|
47
|
+
}
|
|
48
|
+
function addEventListenerMutationAll(selector, type, options) {
|
|
49
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: "mutation" });
|
|
50
|
+
}
|
|
51
|
+
function addEventListenerMutation(selector, type, options) {
|
|
52
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: "mutation" });
|
|
53
|
+
}
|
|
54
|
+
function addEventListenerLight(selector, type, options) {
|
|
55
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light" });
|
|
56
|
+
}
|
|
57
|
+
function addEventListenerShadow(selector, type, options) {
|
|
58
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow" });
|
|
59
|
+
}
|
|
60
|
+
function addEventListenerAll(selector, type, options) {
|
|
61
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all" });
|
|
62
|
+
}
|
|
31
63
|
function addEventListenerThis(type, options) {
|
|
32
64
|
return addEventListener("$this", type, options);
|
|
33
65
|
}
|
|
@@ -40,26 +72,391 @@ function addEventListenerWindow(type, options) {
|
|
|
40
72
|
function addEventListenerDocument(type, options) {
|
|
41
73
|
return addEventListener("$document", type, options);
|
|
42
74
|
}
|
|
75
|
+
const event = addEventListener;
|
|
76
|
+
const eventDelegateLight = addEventListenerDelegateLight;
|
|
77
|
+
const eventDelegateShadow = addEventListenerDelegateShadow;
|
|
78
|
+
const eventDelegateAll = addEventListenerDelegateAll;
|
|
79
|
+
const eventDelegate = addEventListenerDelegate;
|
|
80
|
+
const eventMutationLight = addEventListenerMutationLight;
|
|
81
|
+
const eventMutationShadow = addEventListenerMutationShadow;
|
|
82
|
+
const eventMutationAll = addEventListenerMutationAll;
|
|
83
|
+
const eventMutation = addEventListenerMutation;
|
|
84
|
+
const eventLight = addEventListenerLight;
|
|
85
|
+
const eventShadow = addEventListenerShadow;
|
|
86
|
+
const eventAll = addEventListenerAll;
|
|
87
|
+
const eventAppHost = addEventListenerAppHost;
|
|
88
|
+
const eventWindow = addEventListenerWindow;
|
|
89
|
+
const eventDocument = addEventListenerDocument;
|
|
90
|
+
const eventThis = addEventListenerThis;
|
|
43
91
|
const getAddEventListenerMetadata = (target) => {
|
|
44
92
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
45
93
|
return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
46
94
|
};
|
|
95
|
+
import { Subject } from "@dooboostore/core";
|
|
96
|
+
import { debounceTime, distinctUntilChanged, throttleTime } from "@dooboostore/core/message/operators";
|
|
97
|
+
import { SwcUtils } from "../utils/Utils.js";
|
|
98
|
+
class EventListenerLifeCycler {
|
|
99
|
+
constructor() {
|
|
100
|
+
/** 인스턴스별 boundListeners 상태 (시클러는 elementDefine 시 1회 생성되어 공유되므로) */
|
|
101
|
+
__publicField(this, "boundListenersMap", /* @__PURE__ */ new WeakMap());
|
|
102
|
+
/** 인스턴스별 delegate:'mutation' 바인딩 추적 WeakSet — MutationObserverLifeCycler 에서 참조 */
|
|
103
|
+
__publicField(this, "eventBoundSetsMap", /* @__PURE__ */ new WeakMap());
|
|
104
|
+
}
|
|
105
|
+
// ── 외부(MutationObserverLifeCycler)에서 직접 사용하는 공개 헬퍼 ──
|
|
106
|
+
/** 인스턴스별 boundListeners 를 반환한다 (없으면 생성). */
|
|
107
|
+
getBoundListeners(inst) {
|
|
108
|
+
let list = this.boundListenersMap.get(inst);
|
|
109
|
+
if (!list) {
|
|
110
|
+
list = [];
|
|
111
|
+
this.boundListenersMap.set(inst, list);
|
|
112
|
+
}
|
|
113
|
+
return list;
|
|
114
|
+
}
|
|
115
|
+
/** 인스턴스별 eventBoundSets 를 반환한다 (없으면 생성). */
|
|
116
|
+
getEventBoundSets(inst) {
|
|
117
|
+
let map = this.eventBoundSetsMap.get(inst);
|
|
118
|
+
if (!map) {
|
|
119
|
+
map = /* @__PURE__ */ new Map();
|
|
120
|
+
this.eventBoundSetsMap.set(inst, map);
|
|
121
|
+
}
|
|
122
|
+
return map;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* target 에 meta 이벤트를 직접 바인딩한다.
|
|
126
|
+
* delegate:'mutation' 초기/동적 바인딩에서 호출된다.
|
|
127
|
+
*/
|
|
128
|
+
bindDirect(helperHostSet, target, meta) {
|
|
129
|
+
const inst = helperHostSet.$this;
|
|
130
|
+
const currentWin = helperHostSet.$w;
|
|
131
|
+
const { type, options } = meta;
|
|
132
|
+
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
133
|
+
const handler = async (event2) => {
|
|
134
|
+
if (options.filter) {
|
|
135
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, target);
|
|
136
|
+
if (!options.filter(event2, { currentThis: inst, helper })) return;
|
|
137
|
+
}
|
|
138
|
+
if (options.stopPropagation) event2.stopPropagation();
|
|
139
|
+
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
140
|
+
if (options.preventDefault) event2.preventDefault();
|
|
141
|
+
const currentHostSet = SwcUtils.getHostSet(inst);
|
|
142
|
+
await inst[meta.propertyKey](event2, { currentHostSet, $matchedElement: event2.currentTarget }, { event: event2, ...currentHostSet, $el: target, $root: target });
|
|
143
|
+
};
|
|
144
|
+
const eventSubject = new Subject();
|
|
145
|
+
let eventStream = eventSubject;
|
|
146
|
+
if (options.debounceTime && options.debounceTime > 0)
|
|
147
|
+
eventStream = eventStream.pipe(debounceTime(options.debounceTime));
|
|
148
|
+
if (options.throttleTime && options.throttleTime > 0)
|
|
149
|
+
eventStream = eventStream.pipe(throttleTime(options.throttleTime));
|
|
150
|
+
if (options.distinctUntilChanged !== void 0 && options.distinctUntilChanged !== false) {
|
|
151
|
+
eventStream = typeof options.distinctUntilChanged === "function" ? eventStream.pipe(distinctUntilChanged(options.distinctUntilChanged)) : eventStream.pipe(distinctUntilChanged());
|
|
152
|
+
}
|
|
153
|
+
const subscription = eventStream.subscribe({
|
|
154
|
+
next: (e) => handler(e).catch((err) => console.error("Event handler error:", err)),
|
|
155
|
+
error: (err) => console.error("Event stream error:", err)
|
|
156
|
+
});
|
|
157
|
+
const wrappedHandler = (event2) => eventSubject.next(event2);
|
|
158
|
+
target.addEventListener(type, wrappedHandler, opts);
|
|
159
|
+
const onRemoves = options.removeListener ? [{ fn: options.removeListener, opts: options }] : [];
|
|
160
|
+
this.getBoundListeners(inst).push({ target, type, handler: wrappedHandler, options: opts, subscription, onRemoves, meta });
|
|
161
|
+
}
|
|
162
|
+
/** target + meta 조합 리스너를 제거한다. MutationObserver 추적 요소 제거 시 호출. */
|
|
163
|
+
unbindDirect(helperHostSet, target, meta) {
|
|
164
|
+
const inst = helperHostSet.$this;
|
|
165
|
+
const list = this.getBoundListeners(inst);
|
|
166
|
+
for (let i = list.length - 1; i >= 0; i--) {
|
|
167
|
+
const l = list[i];
|
|
168
|
+
if (l.target === target && l.type === meta.type && l.meta === meta) {
|
|
169
|
+
try {
|
|
170
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
171
|
+
l.subscription?.unsubscribe?.();
|
|
172
|
+
} catch (e) {
|
|
173
|
+
console.error("[SWC] unbindDirect error:", e);
|
|
174
|
+
}
|
|
175
|
+
for (const r of l.onRemoves ?? []) {
|
|
176
|
+
try {
|
|
177
|
+
r.fn(l.target, r.opts);
|
|
178
|
+
} catch (e) {
|
|
179
|
+
console.error("[SWC] unbindDirect removeListener error:", e);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
list.splice(i, 1);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 메타데이터 목록을 delegate / mutationDelegate / nonDelegate 로 분류한다.
|
|
188
|
+
* MutationObserverLifeCycler 에서 mutationDelegate 목록을 꺼낼 때 사용한다.
|
|
189
|
+
*/
|
|
190
|
+
classifyListeners(metaList) {
|
|
191
|
+
const isSpecial = (sel) => [
|
|
192
|
+
"$window",
|
|
193
|
+
"$document",
|
|
194
|
+
"$host",
|
|
195
|
+
"$appHost",
|
|
196
|
+
"$firstHost",
|
|
197
|
+
"$lastHost",
|
|
198
|
+
"$firstAppHost",
|
|
199
|
+
"$lastAppHost",
|
|
200
|
+
"$hosts",
|
|
201
|
+
"$appHosts",
|
|
202
|
+
"$this",
|
|
203
|
+
""
|
|
204
|
+
].includes(sel);
|
|
205
|
+
const delegateListeners = [];
|
|
206
|
+
const mutationDelegateListeners = [];
|
|
207
|
+
const nonDelegateListeners = [];
|
|
208
|
+
for (const meta of metaList) {
|
|
209
|
+
const isStr = typeof meta.selector === "string";
|
|
210
|
+
const mode = meta.options.delegate;
|
|
211
|
+
if (mode && isStr && !isSpecial(meta.selector)) {
|
|
212
|
+
mode === "mutation" ? mutationDelegateListeners.push(meta) : delegateListeners.push(meta);
|
|
213
|
+
} else {
|
|
214
|
+
nonDelegateListeners.push(meta);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return { delegateListeners, mutationDelegateListeners, nonDelegateListeners };
|
|
218
|
+
}
|
|
219
|
+
// ── ElementDefineLifeCycler 구현 ──
|
|
220
|
+
onConnected(helperHostSet) {
|
|
221
|
+
const inst = helperHostSet.$this;
|
|
222
|
+
const currentWin = helperHostSet.$w;
|
|
223
|
+
this.boundListenersMap.delete(inst);
|
|
224
|
+
this.eventBoundSetsMap.delete(inst);
|
|
225
|
+
const allMeta = getAddEventListenerMetadata(inst) ?? [];
|
|
226
|
+
const { delegateListeners, nonDelegateListeners, mutationDelegateListeners } = this.classifyListeners(allMeta);
|
|
227
|
+
const groups = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const meta of delegateListeners) {
|
|
229
|
+
const key = `${meta.type}:${meta.options.root || "auto"}`;
|
|
230
|
+
if (!groups.has(key)) groups.set(key, []);
|
|
231
|
+
groups.get(key).push(meta);
|
|
232
|
+
}
|
|
233
|
+
groups.forEach((metaList, key) => {
|
|
234
|
+
const ci = key.indexOf(":");
|
|
235
|
+
const type = key.slice(0, ci);
|
|
236
|
+
const r = key.slice(ci + 1);
|
|
237
|
+
const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
|
|
238
|
+
const roots = [];
|
|
239
|
+
if (r === "auto") roots.push(inst.shadowRoot || inst);
|
|
240
|
+
else if (r === "light") roots.push(inst);
|
|
241
|
+
else if (r === "shadow" && inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
242
|
+
else if (r === "all") {
|
|
243
|
+
roots.push(inst);
|
|
244
|
+
if (inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
245
|
+
}
|
|
246
|
+
for (const br of roots) {
|
|
247
|
+
const sorted = [...metaList].sort((a, b) => (b.options.stopPropagation ? 1 : 0) - (a.options.stopPropagation ? 1 : 0));
|
|
248
|
+
const handler = async (event2) => {
|
|
249
|
+
for (const m of sorted) {
|
|
250
|
+
const matchedEl = event2.target?.closest(m.selector);
|
|
251
|
+
console.log("[DBG][delegate] type=", event2.type, "| evtTarget=", event2.target?.tagName, "| sel=", m.selector, "| matchedEl=", matchedEl?.className || matchedEl?.tagName, "| brContains=", br.contains?.(matchedEl), "| brTag=", br.tagName || br.constructor?.name);
|
|
252
|
+
if (matchedEl && br.contains(matchedEl)) {
|
|
253
|
+
if (m.options.filter) {
|
|
254
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
255
|
+
if (!m.options.filter(event2, { currentThis: inst, helper })) continue;
|
|
256
|
+
}
|
|
257
|
+
if (m.options.stopPropagation) event2.stopPropagation();
|
|
258
|
+
if (m.options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
259
|
+
if (m.options.preventDefault) event2.preventDefault();
|
|
260
|
+
const hs = SwcUtils.getHostSet(inst);
|
|
261
|
+
await inst[m.propertyKey](event2, { ...hs, $matchedElement: matchedEl }, { event: event2, ...hs, $el: matchedEl, $root: br });
|
|
262
|
+
if (event2.cancelBubble) break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
br.addEventListener(type, handler, opts);
|
|
267
|
+
if (type === "click") {
|
|
268
|
+
console.log("[DBG][eventCycler] bound click on br=", br.tagName || br.constructor?.name, "| inst=", inst.tagName || inst.constructor?.name, "| isSame=", br === inst);
|
|
269
|
+
}
|
|
270
|
+
const onRemoves = sorted.filter((m) => m.options.removeListener).map((m) => ({ fn: m.options.removeListener, opts: m.options }));
|
|
271
|
+
this.getBoundListeners(inst).push({ target: br, type, handler, options: opts, onRemoves });
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
for (const meta of nonDelegateListeners) {
|
|
275
|
+
const { selector, options } = meta;
|
|
276
|
+
const r = options.root || "auto";
|
|
277
|
+
const bindTargets = [];
|
|
278
|
+
let resolvedSel = null;
|
|
279
|
+
if (typeof selector === "function") {
|
|
280
|
+
const result = selector(inst, helperHostSet);
|
|
281
|
+
if (typeof result === "string") resolvedSel = result;
|
|
282
|
+
else if (result instanceof currentWin.Element) bindTargets.push(result);
|
|
283
|
+
else if (result instanceof currentWin.NodeList) bindTargets.push(...Array.from(result));
|
|
284
|
+
else if (Array.isArray(result)) bindTargets.push(...result);
|
|
285
|
+
} else {
|
|
286
|
+
resolvedSel = selector;
|
|
287
|
+
}
|
|
288
|
+
const applyRoot = (t) => {
|
|
289
|
+
if (!t) return;
|
|
290
|
+
if (r === "auto") bindTargets.push(t.shadowRoot || t);
|
|
291
|
+
else {
|
|
292
|
+
if (r === "light" || r === "all") bindTargets.push(t);
|
|
293
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) bindTargets.push(t.shadowRoot);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
if (resolvedSel) {
|
|
297
|
+
if (resolvedSel === "$window") bindTargets.push(currentWin);
|
|
298
|
+
else if (resolvedSel === "$document") bindTargets.push(currentWin.document);
|
|
299
|
+
else if (resolvedSel === "$host") applyRoot(helperHostSet.$host);
|
|
300
|
+
else if (resolvedSel === "$parentHost") applyRoot(helperHostSet.$parentHost);
|
|
301
|
+
else if (resolvedSel === "$appHost") applyRoot(helperHostSet.$appHost);
|
|
302
|
+
else if (resolvedSel === "$firstHost") applyRoot(helperHostSet.$firstHost);
|
|
303
|
+
else if (resolvedSel === "$lastHost") applyRoot(helperHostSet.$lastHost);
|
|
304
|
+
else if (resolvedSel === "$firstAppHost") applyRoot(helperHostSet.$firstAppHost);
|
|
305
|
+
else if (resolvedSel === "$lastAppHost") applyRoot(helperHostSet.$lastAppHost);
|
|
306
|
+
else if (resolvedSel === "$hosts") helperHostSet.$hosts.forEach(applyRoot);
|
|
307
|
+
else if (resolvedSel === "$appHosts") helperHostSet.$appHosts.forEach(applyRoot);
|
|
308
|
+
else if (resolvedSel === "$this" || !resolvedSel) applyRoot(inst);
|
|
309
|
+
else {
|
|
310
|
+
const searchRoots = [];
|
|
311
|
+
if (r === "auto") searchRoots.push(inst.shadowRoot || inst);
|
|
312
|
+
else if (r === "light") searchRoots.push(inst);
|
|
313
|
+
else if (r === "shadow" && inst.shadowRoot) searchRoots.push(inst.shadowRoot);
|
|
314
|
+
else if (r === "all") {
|
|
315
|
+
searchRoots.push(inst);
|
|
316
|
+
if (inst.shadowRoot) searchRoots.push(inst.shadowRoot);
|
|
317
|
+
}
|
|
318
|
+
for (const sr of searchRoots) sr.querySelectorAll(resolvedSel).forEach((el) => bindTargets.push(el));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
for (const t of bindTargets) this.bindDirect(helperHostSet, t, meta);
|
|
322
|
+
}
|
|
323
|
+
if (mutationDelegateListeners.length > 0) {
|
|
324
|
+
const shadowEventDelegates = mutationDelegateListeners.filter((m) => {
|
|
325
|
+
const r = m.options.root || "auto";
|
|
326
|
+
return inst.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
327
|
+
});
|
|
328
|
+
const lightEventDelegates = mutationDelegateListeners.filter((m) => {
|
|
329
|
+
const r = m.options.root || "auto";
|
|
330
|
+
return r === "light" || r === "all" || !inst.shadowRoot && r === "auto";
|
|
331
|
+
});
|
|
332
|
+
const buildMutationEntry = (root, eventDelegates) => {
|
|
333
|
+
if (eventDelegates.length === 0) return null;
|
|
334
|
+
const boundSets = this.getEventBoundSets(inst);
|
|
335
|
+
const callback = (mutations, obs) => {
|
|
336
|
+
for (const m of eventDelegates) {
|
|
337
|
+
let boundSet = boundSets.get(m);
|
|
338
|
+
if (!boundSet) {
|
|
339
|
+
boundSet = /* @__PURE__ */ new WeakSet();
|
|
340
|
+
boundSets.set(m, boundSet);
|
|
341
|
+
}
|
|
342
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
343
|
+
const matchesSel = (n) => {
|
|
344
|
+
if (!n || n.nodeType !== 1) return false;
|
|
345
|
+
if (isThis) return true;
|
|
346
|
+
return typeof m.selector === "string" && n.matches?.(m.selector);
|
|
347
|
+
};
|
|
348
|
+
const bindEl = (el) => {
|
|
349
|
+
if (!boundSet.has(el)) {
|
|
350
|
+
this.bindDirect(helperHostSet, el, m);
|
|
351
|
+
boundSet.add(el);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
const unbindEl = (el) => {
|
|
355
|
+
if (boundSet.has(el)) {
|
|
356
|
+
this.unbindDirect(helperHostSet, el, m);
|
|
357
|
+
boundSet.delete(el);
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
for (const mut of mutations) {
|
|
361
|
+
Array.from(mut.addedNodes || []).forEach((n) => {
|
|
362
|
+
if (n.nodeType !== 1) return;
|
|
363
|
+
if (matchesSel(n)) bindEl(n);
|
|
364
|
+
else if (!isThis && typeof m.selector === "string") n.querySelectorAll?.(m.selector).forEach(bindEl);
|
|
365
|
+
});
|
|
366
|
+
Array.from(mut.removedNodes || []).forEach((n) => {
|
|
367
|
+
if (n.nodeType !== 1) return;
|
|
368
|
+
const el = n;
|
|
369
|
+
if (matchesSel(el)) unbindEl(el);
|
|
370
|
+
else if (!isThis && typeof m.selector === "string") el.querySelectorAll?.(m.selector).forEach(unbindEl);
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
for (const m of eventDelegates) {
|
|
376
|
+
let boundSet = boundSets.get(m);
|
|
377
|
+
if (!boundSet) {
|
|
378
|
+
boundSet = /* @__PURE__ */ new WeakSet();
|
|
379
|
+
boundSets.set(m, boundSet);
|
|
380
|
+
}
|
|
381
|
+
if (typeof m.selector !== "string") continue;
|
|
382
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
383
|
+
this.bindDirect(helperHostSet, root, m);
|
|
384
|
+
boundSet.add(root);
|
|
385
|
+
} else {
|
|
386
|
+
root.querySelectorAll(m.selector).forEach((el) => {
|
|
387
|
+
if (!boundSet.has(el)) {
|
|
388
|
+
this.bindDirect(helperHostSet, el, m);
|
|
389
|
+
boundSet.add(el);
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return { target: root, options: { childList: true, subtree: true }, callback };
|
|
395
|
+
};
|
|
396
|
+
const shadowEntry = inst.shadowRoot ? buildMutationEntry(inst.shadowRoot, shadowEventDelegates) : null;
|
|
397
|
+
const lightEntry = buildMutationEntry(inst, lightEventDelegates);
|
|
398
|
+
const mutationObserverSet = [shadowEntry, lightEntry].filter(Boolean);
|
|
399
|
+
if (mutationObserverSet.length > 0) return { mutationObserverSet };
|
|
400
|
+
}
|
|
401
|
+
return void 0;
|
|
402
|
+
}
|
|
403
|
+
onDisconnected(helperHostSet) {
|
|
404
|
+
const inst = helperHostSet.$this;
|
|
405
|
+
const list = this.boundListenersMap.get(inst) ?? [];
|
|
406
|
+
for (const l of list) {
|
|
407
|
+
try {
|
|
408
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
409
|
+
l.subscription?.unsubscribe?.();
|
|
410
|
+
} catch (e) {
|
|
411
|
+
console.error("[SWC] EventListenerLifeCycler cleanup error:", e);
|
|
412
|
+
}
|
|
413
|
+
for (const r of l.onRemoves ?? []) {
|
|
414
|
+
try {
|
|
415
|
+
r.fn(l.target, r.opts);
|
|
416
|
+
} catch (e) {
|
|
417
|
+
console.error("[SWC] removeListener error:", e);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
this.boundListenersMap.delete(inst);
|
|
422
|
+
this.eventBoundSetsMap.delete(inst);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
47
425
|
export {
|
|
48
426
|
ADD_EVENT_LISTENER_METADATA_KEY,
|
|
427
|
+
EventListenerLifeCycler,
|
|
49
428
|
addEventListener,
|
|
429
|
+
addEventListenerAll,
|
|
50
430
|
addEventListenerAppHost,
|
|
51
431
|
addEventListenerDelegate,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
432
|
+
addEventListenerDelegateAll,
|
|
433
|
+
addEventListenerDelegateLight,
|
|
434
|
+
addEventListenerDelegateShadow,
|
|
55
435
|
addEventListenerDocument,
|
|
436
|
+
addEventListenerLight,
|
|
437
|
+
addEventListenerMutation,
|
|
438
|
+
addEventListenerMutationAll,
|
|
439
|
+
addEventListenerMutationLight,
|
|
440
|
+
addEventListenerMutationShadow,
|
|
441
|
+
addEventListenerShadow,
|
|
56
442
|
addEventListenerThis,
|
|
57
443
|
addEventListenerWindow,
|
|
58
444
|
event,
|
|
445
|
+
eventAll,
|
|
446
|
+
eventAppHost,
|
|
59
447
|
eventDelegate,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
448
|
+
eventDelegateAll,
|
|
449
|
+
eventDelegateLight,
|
|
450
|
+
eventDelegateShadow,
|
|
451
|
+
eventDocument,
|
|
452
|
+
eventLight,
|
|
453
|
+
eventMutation,
|
|
454
|
+
eventMutationAll,
|
|
455
|
+
eventMutationLight,
|
|
456
|
+
eventMutationShadow,
|
|
457
|
+
eventShadow,
|
|
458
|
+
eventThis,
|
|
459
|
+
eventWindow,
|
|
63
460
|
getAddEventListenerMetadata
|
|
64
461
|
};
|
|
65
462
|
//# sourceMappingURL=addEventListener.js.map
|