@dooboostore/simple-web-component 1.0.48 → 1.0.50
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 +189 -19
- package/dist/cjs/config/config.js +1 -1
- package/dist/cjs/config/config.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +2373 -30
- package/dist/cjs/decorators/addEventListener.js.map +3 -3
- package/dist/cjs/decorators/applyAttribute.js +31 -0
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +55 -18
- package/dist/cjs/decorators/applyClass.js.map +3 -3
- package/dist/cjs/decorators/applyNode.js +73 -1
- package/dist/cjs/decorators/applyNode.js.map +3 -3
- package/dist/cjs/decorators/applyProperty.js +107 -3
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +6 -5
- package/dist/cjs/decorators/applySlot.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +42 -5
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/changedAttribute.js +61 -13
- package/dist/cjs/decorators/changedAttribute.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +254 -439
- 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/eventMedia.js +84 -0
- package/dist/cjs/decorators/eventMedia.js.map +7 -0
- package/dist/cjs/decorators/index.js +6 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/intersectionObserver.js +200 -0
- package/dist/cjs/decorators/intersectionObserver.js.map +7 -0
- package/dist/cjs/decorators/mutationObserver.js +186 -55
- package/dist/cjs/decorators/mutationObserver.js.map +3 -3
- package/dist/cjs/decorators/parameter.js +73 -0
- package/dist/cjs/decorators/parameter.js.map +7 -0
- package/dist/cjs/decorators/query.js +117 -102
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/requestAnimationFrame.js +124 -0
- package/dist/cjs/decorators/requestAnimationFrame.js.map +7 -0
- package/dist/cjs/decorators/resizeObserver.js +133 -55
- package/dist/cjs/decorators/resizeObserver.js.map +2 -2
- package/dist/cjs/decorators/setInterval.js +114 -0
- package/dist/cjs/decorators/setInterval.js.map +7 -0
- package/dist/cjs/decorators/setTimeout.js +117 -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/elements/SwcAppMixin.js +19 -3
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/window.d.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 +2374 -30
- package/dist/esm/decorators/addEventListener.js.map +3 -3
- package/dist/esm/decorators/applyAttribute.js +31 -0
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +55 -18
- package/dist/esm/decorators/applyClass.js.map +3 -3
- package/dist/esm/decorators/applyNode.js +73 -1
- package/dist/esm/decorators/applyNode.js.map +3 -3
- package/dist/esm/decorators/applyProperty.js +107 -3
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +6 -5
- package/dist/esm/decorators/applySlot.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +42 -5
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/changedAttribute.js +62 -13
- package/dist/esm/decorators/changedAttribute.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +261 -446
- 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/eventMedia.js +66 -0
- package/dist/esm/decorators/eventMedia.js.map +7 -0
- package/dist/esm/decorators/index.js +6 -1
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/intersectionObserver.js +182 -0
- package/dist/esm/decorators/intersectionObserver.js.map +7 -0
- package/dist/esm/decorators/mutationObserver.js +187 -55
- package/dist/esm/decorators/mutationObserver.js.map +3 -3
- package/dist/esm/decorators/parameter.js +54 -0
- package/dist/esm/decorators/parameter.js.map +7 -0
- package/dist/esm/decorators/query.js +117 -102
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/requestAnimationFrame.js +105 -0
- package/dist/esm/decorators/requestAnimationFrame.js.map +7 -0
- package/dist/esm/decorators/resizeObserver.js +134 -55
- package/dist/esm/decorators/resizeObserver.js.map +2 -2
- package/dist/esm/decorators/setInterval.js +95 -0
- package/dist/esm/decorators/setInterval.js.map +7 -0
- package/dist/esm/decorators/setTimeout.js +98 -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/elements/SwcAppMixin.js +20 -4
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +4961 -1628
- 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 +1046 -33
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +24 -34
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +36 -34
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +32 -20
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +61 -34
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applySlot.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +27 -12
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/changedAttribute.d.ts +12 -3
- package/dist/types/decorators/changedAttribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts +0 -14
- 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/eventMedia.d.ts +25 -0
- package/dist/types/decorators/eventMedia.d.ts.map +1 -0
- package/dist/types/decorators/index.d.ts +6 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/intersectionObserver.d.ts +58 -0
- package/dist/types/decorators/intersectionObserver.d.ts.map +1 -0
- package/dist/types/decorators/mutationObserver.d.ts +44 -25
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -1
- package/dist/types/decorators/parameter.d.ts +35 -0
- package/dist/types/decorators/parameter.d.ts.map +1 -0
- package/dist/types/decorators/query.d.ts +57 -14
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/requestAnimationFrame.d.ts +47 -0
- package/dist/types/decorators/requestAnimationFrame.d.ts.map +1 -0
- package/dist/types/decorators/resizeObserver.d.ts +43 -23
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -1
- package/dist/types/decorators/setInterval.d.ts +41 -0
- package/dist/types/decorators/setInterval.d.ts.map +1 -0
- package/dist/types/decorators/setTimeout.d.ts +41 -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/elements/SwcAppMixin.d.ts.map +1 -1
- 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 +4961 -1628
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +7 -5
- package/src/config/config.ts +1 -1
- package/src/decorators/addEventListener.ts +1446 -34
- package/src/decorators/applyAttribute.ts +60 -36
- package/src/decorators/applyClass.ts +86 -26
- package/src/decorators/applyNode.ts +124 -36
- package/src/decorators/applyProperty.ts +172 -40
- package/src/decorators/applySlot.ts +6 -5
- package/src/decorators/applyStyle.ts +74 -17
- package/src/decorators/changedAttribute.ts +76 -15
- package/src/decorators/elementDefine.ts +310 -582
- package/src/decorators/emitCustomEvent.ts +73 -5
- package/src/decorators/eventMedia.ts +78 -0
- package/src/decorators/index.ts +6 -1
- package/src/decorators/intersectionObserver.ts +275 -0
- package/src/decorators/mutationObserver.ts +282 -89
- package/src/decorators/parameter.ts +81 -0
- package/src/decorators/query.ts +168 -126
- package/src/decorators/requestAnimationFrame.ts +158 -0
- package/src/decorators/resizeObserver.ts +211 -89
- package/src/decorators/setInterval.ts +136 -0
- package/src/decorators/setTimeout.ts +139 -0
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +17 -0
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +19 -0
- package/src/elements/SwcAppMixin.ts +20 -5
- package/src/types/index.ts +141 -0
- package/src/types/window.d.ts +2 -18
- package/dist/cjs/decorators/queryAll.js +0 -181
- package/dist/cjs/decorators/queryAll.js.map +0 -7
- package/dist/cjs/examples/RxJSOperatorsExample.js +0 -285
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +0 -7
- package/dist/esm/decorators/queryAll.js +0 -162
- package/dist/esm/decorators/queryAll.js.map +0 -7
- package/dist/esm/examples/RxJSOperatorsExample.js +0 -266
- package/dist/esm/examples/RxJSOperatorsExample.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/examples/RxJSOperatorsExample.d.ts +0 -94
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +0 -1
- package/src/decorators/queryAll.ts +0 -186
- package/src/examples/RxJSOperatorsExample.ts +0 -279
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/mutationObserver.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\nimport { EventListenerSelector } from './addEventListener';\n\nexport interface MutationObserverBaseOptions extends MutationObserverInit, SwcQueryOptions {\n // observe \uB300\uC0C1 \uC140\uB809\uD130. \uAE30\uBCF8\uAC12 $this (\uCEF4\uD3EC\uB10C\uD2B8 \uC790\uC2E0)\n // delegate: true \uC778 \uACBD\uC6B0 root\uC5D0 observer\uB97C \uAC78\uACE0 \uC140\uB809\uD130 \uB9E4\uCE6D \uB300\uC0C1\uC758 mutation\uB9CC \uCF5C\uBC31\n // \uC140\uB809\uD130\uB85C \uC9C1\uC811 \uC9C0\uC815\uD55C \uACBD\uC6B0 \uD574\uB2F9 \uC694\uC18C\uB4E4\uC744 \uAC01\uAC01 observe\n delegate?: boolean;\n filter?: (matchedEls: HTMLElement[], meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n // observer \uD574\uC81C(disconnected) \uC2DC \uD638\uCD9C\uB418\uB294 \uCF5C\uBC31. \uCCAB \uBC88\uC9F8 \uC778\uC790\uB294 observe\uB41C target element, \uB450 \uBC88\uC9F8\uB294 \uC0AC\uC6A9\uC790 \uC635\uC158 \uAC1D\uCCB4.\n removeObserver?: (target: Element, optionValue: MutationObserverBaseOptions) => void;\n}\n\nexport interface MutationObserverMetadata {\n propertyKey: string | symbol;\n selector: EventListenerSelector;\n options: MutationObserverBaseOptions;\n}\n\nexport const MUTATION_OBSERVER_METADATA_KEY = Symbol.for('simple-web-component:mutation-observer');\n\nexport function mutationObserver(target: SpecialSelector, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserver(selector: EventListenerSelector, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserver(options?: MutationObserverBaseOptions): MethodDecorator;\n/**\n * @mutationObserver decorator to observe DOM mutations.\n */\nexport function mutationObserver(selectorOrOptions?: EventListenerSelector | MutationObserverBaseOptions, maybeOptions?: MutationObserverBaseOptions): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n let selector: EventListenerSelector = '$this';\n let options: MutationObserverBaseOptions = {};\n\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n selector = selectorOrOptions;\n options = maybeOptions ?? {};\n } else {\n selector = '$this';\n options = selectorOrOptions ?? {};\n }\n\n const constructor = targetObj.constructor;\n\n let observers = ReflectUtils.getMetadata<MutationObserverMetadata[]>(MUTATION_OBSERVER_METADATA_KEY, constructor);\n if (!observers) {\n observers = [];\n ReflectUtils.defineMetadata(MUTATION_OBSERVER_METADATA_KEY, observers, constructor);\n }\n\n observers.push({ propertyKey, selector, options });\n };\n}\n\nexport function mutationObserverThis<TEvent extends Event = Event>(options?: MutationObserverBaseOptions): MethodDecorator {\n return mutationObserver('$this', options);\n}\n\n// \u2500\u2500\u2500 root\uBCC4 delegate \uD5EC\uD37C (addEventListener\uC640 \uB3D9\uC77C \uD328\uD134) \u2500\u2500\u2500\n\nexport function mutationObserverDelegateLight(selector: EventListenerSelector, options?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator;\nexport function mutationObserverDelegateLight(options?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator;\nexport function mutationObserverDelegateLight(selectorOrOptions?: EventListenerSelector | Omit<MutationObserverBaseOptions, 'delegate'>, maybeOptions?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'light', delegate: true});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'light', delegate: true});\n}\n\nexport function mutationObserverDelegateShadow(selector: EventListenerSelector, options?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator;\nexport function mutationObserverDelegateShadow(options?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator;\nexport function mutationObserverDelegateShadow(selectorOrOptions?: EventListenerSelector | Omit<MutationObserverBaseOptions, 'delegate'>, maybeOptions?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'shadow', delegate: true});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'shadow', delegate: true});\n}\n\nexport function mutationObserverDelegateAll(selector: EventListenerSelector, options?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator;\nexport function mutationObserverDelegateAll(options?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator;\nexport function mutationObserverDelegateAll(selectorOrOptions?: EventListenerSelector | Omit<MutationObserverBaseOptions, 'delegate'>, maybeOptions?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'all', delegate: true});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'all', delegate: true});\n}\n\nexport function mutationObserverDelegate(selector: EventListenerSelector, options?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator;\nexport function mutationObserverDelegate(options?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator;\nexport function mutationObserverDelegate(selectorOrOptions?: EventListenerSelector | Omit<MutationObserverBaseOptions, 'delegate'>, maybeOptions?: Omit<MutationObserverBaseOptions, 'delegate'>): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'auto', delegate: true});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'auto', delegate: true});\n}\n\n// \u2500\u2500\u2500 root\uBCC4 \uC77C\uBC18 \uD5EC\uD37C (delegate \uC5C6\uC774, \uC140\uB809\uD130 \uC0DD\uB7B5 \uC2DC $this) \u2500\u2500\u2500\n\nexport function mutationObserverLight(selector: EventListenerSelector, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverLight(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverLight(selectorOrOptions?: EventListenerSelector | MutationObserverBaseOptions, maybeOptions?: MutationObserverBaseOptions): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'light'});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'light'});\n}\n\nexport function mutationObserverShadow(selector: EventListenerSelector, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverShadow(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverShadow(selectorOrOptions?: EventListenerSelector | MutationObserverBaseOptions, maybeOptions?: MutationObserverBaseOptions): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'shadow'});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'shadow'});\n}\n\nexport function mutationObserverAll(selector: EventListenerSelector, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverAll(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverAll(selectorOrOptions?: EventListenerSelector | MutationObserverBaseOptions, maybeOptions?: MutationObserverBaseOptions): MethodDecorator {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return mutationObserver(selectorOrOptions, {...maybeOptions ?? {}, root: 'all'});\n }\n return mutationObserver({...selectorOrOptions ?? {}, root: 'all'});\n}\n\nexport function getMutationObserverMetadata(target: any): MutationObserverMetadata[] | undefined {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);\n}"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SpecialSelector, SwcQueryOptions, SwcSelector, SwcFnSelector, HelperHostSet } from '../types';\n\n// \uACF5\uD1B5 \uC635\uC158 \u2014 root\u00B7delegate \uC5C6\uC74C (MutationObserverInit + filter/removeObserver)\nexport interface MutationObserverBaseOptions extends MutationObserverInit {\n filter?: (matchedEls: HTMLElement[], meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n // observer \uD574\uC81C(disconnected) \uC2DC \uD638\uCD9C\uB418\uB294 \uCF5C\uBC31. \uCCAB \uBC88\uC9F8 \uC778\uC790\uB294 observe\uB41C target element, \uB450 \uBC88\uC9F8\uB294 \uC0AC\uC6A9\uC790 \uC635\uC158 \uAC1D\uCCB4.\n removeObserver?: (target: Element, optionValue: MutationObserverQueryOptions) => void;\n}\n\n// \uBB38\uC790\uC5F4 \uC140\uB809\uD130 \uC804\uC6A9 \u2014 root\u00B7delegate \uD5C8\uC6A9 (\uC140\uB809\uD130\uB85C \uD0D0\uC0C9/\uB378\uB9AC\uAC8C\uC774\uC158)\nexport type MutationObserverQueryOptions = MutationObserverBaseOptions & SwcQueryOptions & { delegate?: boolean };\n// \uD568\uC218 \uC140\uB809\uD130 \uC804\uC6A9 \u2014 root\u00B7delegate \uAE08\uC9C0 (\uC774\uBBF8 \uC694\uC18C\uB97C \uC9C1\uC811 \uBC18\uD658)\nexport type MutationObserverNonQueryOptions = MutationObserverBaseOptions;\n\n// \uC140\uB809\uD130 \uC885\uB958\uC5D0 \uB530\uB77C \uC635\uC158 \uD0C0\uC785 \uBD84\uAE30\nexport type MutationObserverOptionsOf<S extends SwcSelector> = S extends string ? MutationObserverQueryOptions : MutationObserverNonQueryOptions;\n\nexport interface MutationObserverMetadata {\n propertyKey: string | symbol;\n selector: SwcSelector;\n options: MutationObserverQueryOptions;\n}\n\nexport const MUTATION_OBSERVER_METADATA_KEY = Symbol.for('simple-web-component:mutation-observer');\n\nconst applyMutationObserver = (selector: SwcSelector, options: MutationObserverQueryOptions, targetObj: Object, propertyKey: string | symbol): void => {\n const constructor = targetObj.constructor;\n let observers = ReflectUtils.getMetadata<MutationObserverMetadata[]>(MUTATION_OBSERVER_METADATA_KEY, constructor);\n if (!observers) {\n observers = [];\n ReflectUtils.defineMetadata(MUTATION_OBSERVER_METADATA_KEY, observers, constructor);\n }\n observers.push({ propertyKey, selector, options });\n};\n\nconst resolveMutationObserverArgs = (\n selectorOrOptions: SwcSelector | MutationObserverQueryOptions | undefined,\n maybeOptions: MutationObserverQueryOptions | undefined,\n extra: Partial<MutationObserverQueryOptions>\n): { selector: SwcSelector; options: MutationObserverQueryOptions } => {\n if (typeof selectorOrOptions === 'string' || typeof selectorOrOptions === 'function') {\n return { selector: selectorOrOptions, options: { ...(maybeOptions ?? {}), ...extra } };\n }\n return { selector: '$this', options: { ...(selectorOrOptions ?? {}), ...extra } };\n};\n\n/**\n * selectorOrOptionsOrTarget/maybeOptionsOrPropertyKey/descriptor\uC744 \uBC1B\uC544 bare(@decorator)\uC640\n * factory(@decorator()/@decorator(...)) \uD638\uCD9C\uC744 \uBAA8\uB450 \uCC98\uB9AC\uD558\uB294 \uACF5\uD1B5 \uB514\uC2A4\uD328\uCC98.\n * extra\uB294 Light/Shadow/All/Delegate \uBCC0\uD615\uC774 \uAC15\uC81C\uB85C \uB367\uC50C\uC6B0\uB294 \uC635\uC158(root, delegate \uB4F1)\uC774\uB2E4.\n */\nconst dispatchMutationObserver = (\n selectorOrOptionsOrTarget: SwcSelector | MutationObserverQueryOptions | Object | undefined,\n maybeOptionsOrPropertyKey: MutationObserverQueryOptions | string | symbol | undefined,\n descriptor: PropertyDescriptor | undefined,\n extra: Partial<MutationObserverQueryOptions>\n): MethodDecorator | void => {\n if ((typeof maybeOptionsOrPropertyKey === 'string' || typeof maybeOptionsOrPropertyKey === 'symbol') && descriptor !== undefined) {\n // \uC635\uC158 \uC5C6\uC774: @decorator\n applyMutationObserver('$this', { ...extra }, selectorOrOptionsOrTarget as Object, maybeOptionsOrPropertyKey);\n return;\n }\n // \uC635\uC158\uACFC \uD568\uAED8: @decorator() / @decorator(selector, options) / @decorator(options)\n const { selector, options } = resolveMutationObserverArgs(\n selectorOrOptionsOrTarget as SwcSelector | MutationObserverQueryOptions | undefined,\n maybeOptionsOrPropertyKey as MutationObserverQueryOptions | undefined,\n extra\n );\n return (targetObj: Object, propertyKey: string | symbol) => {\n applyMutationObserver(selector, options, targetObj, propertyKey);\n };\n};\n\nexport function mutationObserver(target: SpecialSelector, options?: MutationObserverQueryOptions): MethodDecorator;\nexport function mutationObserver(selector: string, options?: MutationObserverQueryOptions): MethodDecorator;\nexport function mutationObserver(selector: SwcFnSelector, options?: MutationObserverNonQueryOptions): MethodDecorator;\nexport function mutationObserver(options?: MutationObserverQueryOptions): MethodDecorator;\nexport function mutationObserver(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\n/**\n * @mutationObserver decorator to observe DOM mutations.\n * \uC635\uC158 \uC5C6\uC774 `@mutationObserver` \uADF8\uB300\uB85C \uBD99\uC5EC\uB3C4 \uB418\uACE0, `@mutationObserver(...)`\uCC98\uB7FC \uC140\uB809\uD130/\uC635\uC158\uC744 \uC904 \uC218\uB3C4 \uC788\uB2E4.\n */\nexport function mutationObserver(selectorOrOptionsOrTarget?: SwcSelector | MutationObserverQueryOptions | Object, maybeOptionsOrPropertyKey?: MutationObserverQueryOptions | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(selectorOrOptionsOrTarget, maybeOptionsOrPropertyKey, descriptor, {});\n}\n\nexport function mutationObserverThis(options?: MutationObserverQueryOptions): MethodDecorator;\nexport function mutationObserverThis(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function mutationObserverThis(optionsOrTarget?: MutationObserverQueryOptions | Object, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(optionsOrTarget, propertyKey, descriptor, {});\n}\n\n// \u2500\u2500\u2500 root\uBCC4 delegate \uD5EC\uD37C (addEventListener\uC640 \uB3D9\uC77C \uD328\uD134) \u2500\u2500\u2500\n\nexport function mutationObserverDelegateLight(selector: string, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateLight(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function mutationObserverDelegateLight(selectorOrOptionsOrTarget?: string | Omit<MutationObserverQueryOptions, 'root'> | Object, maybeOptionsOrPropertyKey?: Omit<MutationObserverQueryOptions, 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(selectorOrOptionsOrTarget as any, maybeOptionsOrPropertyKey as any, descriptor, { root: 'light', delegate: true });\n}\n\nexport function mutationObserverDelegateShadow(selector: string, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateShadow(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function mutationObserverDelegateShadow(selectorOrOptionsOrTarget?: string | Omit<MutationObserverQueryOptions, 'root'> | Object, maybeOptionsOrPropertyKey?: Omit<MutationObserverQueryOptions, 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(selectorOrOptionsOrTarget as any, maybeOptionsOrPropertyKey as any, descriptor, { root: 'shadow', delegate: true });\n}\n\nexport function mutationObserverDelegateAll(selector: string, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateAll(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegateAll(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function mutationObserverDelegateAll(selectorOrOptionsOrTarget?: string | Omit<MutationObserverQueryOptions, 'root'> | Object, maybeOptionsOrPropertyKey?: Omit<MutationObserverQueryOptions, 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(selectorOrOptionsOrTarget as any, maybeOptionsOrPropertyKey as any, descriptor, { root: 'all', delegate: true });\n}\n\nexport function mutationObserverDelegate(selector: string, options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegate(options?: MutationObserverBaseOptions): MethodDecorator;\nexport function mutationObserverDelegate(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function mutationObserverDelegate(selectorOrOptionsOrTarget?: string | Omit<MutationObserverQueryOptions, 'root'> | Object, maybeOptionsOrPropertyKey?: Omit<MutationObserverQueryOptions, 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(selectorOrOptionsOrTarget as any, maybeOptionsOrPropertyKey as any, descriptor, { root: 'auto', delegate: true });\n}\n\n// \u2500\u2500\u2500 root\uBCC4 \uC77C\uBC18 \uD5EC\uD37C (delegate \uC5C6\uC774, \uC140\uB809\uD130 \uC0DD\uB7B5 \uC2DC $this) \u2500\u2500\u2500\n\nexport function mutationObserverLight(selector: string, options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverLight(options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function mutationObserverLight(selectorOrOptionsOrTarget?: string | Omit<MutationObserverQueryOptions, 'root'> | Object, maybeOptionsOrPropertyKey?: Omit<MutationObserverQueryOptions, 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(selectorOrOptionsOrTarget as any, maybeOptionsOrPropertyKey as any, descriptor, { root: 'light' });\n}\n\nexport function mutationObserverShadow(selector: string, options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverShadow(options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function mutationObserverShadow(selectorOrOptionsOrTarget?: string | Omit<MutationObserverQueryOptions, 'root'> | Object, maybeOptionsOrPropertyKey?: Omit<MutationObserverQueryOptions, 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(selectorOrOptionsOrTarget as any, maybeOptionsOrPropertyKey as any, descriptor, { root: 'shadow' });\n}\n\nexport function mutationObserverAll(selector: string, options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverAll(options?: Omit<MutationObserverQueryOptions, 'root'>): MethodDecorator;\nexport function mutationObserverAll(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function mutationObserverAll(selectorOrOptionsOrTarget?: string | Omit<MutationObserverQueryOptions, 'root'> | Object, maybeOptionsOrPropertyKey?: Omit<MutationObserverQueryOptions, 'root'> | string | symbol, descriptor?: PropertyDescriptor): MethodDecorator | void {\n return dispatchMutationObserver(selectorOrOptionsOrTarget as any, maybeOptionsOrPropertyKey as any, descriptor, { root: 'all' });\n}\n\nexport function getMutationObserverMetadata(target: any): MutationObserverMetadata[] | undefined {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);\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// MutationObserverLifeCycler\n// observer \uB97C \uC9C1\uC811 \uC0DD\uC131\uD558\uC9C0 \uC54A\uACE0 OnConnectedResult \uB97C \uBC18\uD658\uD55C\uB2E4.\n// elementDefine \uC774 \uC218\uC9D1\uB41C MutationObserverSet \uC73C\uB85C observer \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\nimport { ElementDefineLifeCycler, MutationObserverSet, MutationObserverSetEntry, ObserverObserveTarget, OnConnectedResult } from '../types';\nimport { SwcUtils } from '../utils/Utils';\n\nexport class MutationObserverLifeCycler implements ElementDefineLifeCycler {\n private readonly removeObserverCallbacksMap = new WeakMap<Element, Array<{ fn: (target: Element, opts: unknown) => void; target: any; opts: unknown }>>();\n\n onConnected(helperHostSet: HelperHostSet): OnConnectedResult | void {\n const inst = helperHostSet.$this;\n const currentWin = helperHostSet.$w;\n\n const removeObserverCallbacks: Array<{ fn: (target: Element, opts: unknown) => void; target: any; opts: unknown }> = [];\n this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);\n\n const allMeta = getMutationObserverMetadata(inst) ?? [];\n // \uCC98\uB9AC\uD560 \uBA54\uD0C0\uAC00 \uC5C6\uC73C\uBA74 observer \uBD88\uD544\uC694\n if (allMeta.length === 0) return;\n\n // \u2500\u2500 shadow / light \uB8E8\uD2B8\uBCC4 \uBD84\uB958 \u2500\u2500\n const shadowMetas = allMeta.filter(m => {\n const r = m.options.root || 'auto';\n return inst.shadowRoot && (r === 'shadow' || r === 'all' || r === 'auto');\n });\n const lightMetas = allMeta.filter(m => {\n const r = m.options.root || 'auto';\n return r === 'light' || r === 'all' || (!inst.shadowRoot && r === 'auto');\n });\n // \u2500\u2500 MutationObserverSet \uC0DD\uC131 \uD5EC\uD37C (\uB8E8\uD2B8\uBCC4) \u2500\u2500\n const buildSet = (\n root: HTMLElement | ShadowRoot,\n metas: MutationObserverMetadata[],\n ): { callback: MutationObserverSetEntry['callback']; observeTargets: ObserverObserveTarget<MutationObserverInit>[] } | null => {\n if (metas.length === 0) return null;\n\n const initFrom = (o: MutationObserverBaseOptions): MutationObserverInit => {\n const init: MutationObserverInit = {\n childList: o.childList, attributes: o.attributes, characterData: o.characterData,\n subtree: o.subtree, attributeFilter: o.attributeFilter,\n attributeOldValue: o.attributeOldValue, characterDataOldValue: o.characterDataOldValue,\n };\n if (!init.childList && !init.attributes && !init.characterData) init.childList = true;\n return init;\n };\n\n const fnObservedSets = new Map<MutationObserverMetadata, WeakSet<Element>>();\n\n const callback = (mutations: MutationRecord[], obs: MutationObserver) => {\n // \u2500\u2500 MutationObserver \uBA54\uD0C0 \uCF5C\uBC31 \u2500\u2500\n for (const meta of metas) {\n const { selector, options } = meta;\n let matchedEls: HTMLElement[] = [];\n\n const typeMatches = (m: MutationRecord): boolean => {\n const has = !!(options.childList || options.attributes || options.characterData);\n if (m.type === 'childList') return has ? !!options.childList : true;\n if (m.type === 'attributes') return !!options.attributes;\n if (m.type === 'characterData') return !!options.characterData;\n return true;\n };\n\n const collect = (matchesSel: (n: any) => boolean) =>\n mutations.flatMap(m => {\n if (!typeMatches(m)) return [];\n const els: HTMLElement[] = [];\n if (matchesSel(m.target)) els.push(m.target as HTMLElement);\n Array.from(m.addedNodes || []).filter(matchesSel).forEach(n => els.push(n as HTMLElement));\n Array.from(m.removedNodes || []).filter(matchesSel).forEach(n => els.push(n as HTMLElement));\n return els;\n });\n\n if (options.delegate && typeof selector === 'string') {\n const isThis = selector === '$this' || selector === '';\n matchedEls = collect(n => {\n if (!n || n.nodeType !== 1) return false;\n if (isThis) return true;\n const el = n as HTMLElement;\n return el.matches?.(selector) || !!el.closest?.(selector);\n });\n } else if (typeof selector === 'string') {\n const isThis = selector === '$this' || selector === '';\n matchedEls = collect(n => {\n if (!n || n.nodeType !== 1) return false;\n if (isThis) return true;\n return (n as HTMLElement).matches?.(selector);\n });\n } else if (typeof selector === 'function') {\n const set = fnObservedSets.get(meta);\n matchedEls = mutations.filter(m => typeMatches(m))\n .map(m => m.target as HTMLElement)\n .filter(t => t && t.nodeType === 1 && (set ? set.has(t) : false));\n } else {\n matchedEls = mutations.filter(m => typeMatches(m))\n .map(m => m.target as HTMLElement)\n .filter(t => t && t.nodeType === 1);\n }\n\n if (matchedEls.length === 0) continue;\n if (options.filter) {\n if (!options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;\n }\n const hostSet = SwcUtils.getHostSet(inst);\n inst[meta.propertyKey](matchedEls, mutations, obs, { ...hostSet, $root: root });\n }\n\n };\n\n // \u2500\u2500 observe \uB300\uC0C1 \uBAA9\uB85D \uAD6C\uC131 \u2500\u2500\n const observeTargets: ObserverObserveTarget<MutationObserverInit>[] = [];\n\n // delegate \uC788\uC73C\uBA74 \uB8E8\uD2B8 \uC804\uCCB4 subtree observe\n if (metas.some(m => m.options.delegate)) {\n observeTargets.push({ target: root, options: { childList: true, subtree: true } });\n }\n\n // non-delegate: \uC140\uB809\uD130 \uB9E4\uCE6D \uC694\uC18C \uC9C1\uC811 observe\n for (const m of metas.filter(m => !m.options.delegate)) {\n const { selector, options } = m;\n const mInit = initFrom(options);\n if (typeof selector === 'string') {\n if (selector === '$this' || selector === '') {\n observeTargets.push({ target: root, options: mInit });\n } else {\n root.querySelectorAll(selector).forEach(el => observeTargets.push({ target: el as Element, options: mInit }));\n }\n } else if (typeof selector === 'function') {\n const res = (selector as any)(inst, helperHostSet);\n let targets: HTMLElement[] = [];\n if (res instanceof currentWin.HTMLElement) targets = [res as HTMLElement];\n else if (res instanceof currentWin.NodeList) targets = Array.from(res as NodeList).filter((e: any) => e instanceof currentWin.HTMLElement) as HTMLElement[];\n else if (Array.isArray(res)) targets = res.filter((e: any) => e instanceof currentWin.HTMLElement) as HTMLElement[];\n const set = new WeakSet<Element>();\n for (const el of targets) { set.add(el); observeTargets.push({ target: el, options: mInit }); }\n fnObservedSets.set(m, set);\n }\n }\n\n // removeObserver \uCF5C\uBC31 \uC218\uC9D1\n for (const m of metas) {\n if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });\n }\n\n return { callback, observeTargets };\n };\n\n const shadowSet = inst.shadowRoot ? buildSet(inst.shadowRoot, shadowMetas) : null;\n const lightSet = buildSet(inst as any, lightMetas);\n\n // \uB450 \uB8E8\uD2B8\uC758 observe \uB300\uC0C1 + \uCF5C\uBC31\uC744 \uC5D4\uD2B8\uB9AC \uBC30\uC5F4(MutationObserverSet)\uB85C \uBCD1\uD569\n // \uAC19\uC740 \uB8E8\uD2B8\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4.\n const mutationObserverSet: MutationObserverSet = [\n ...(shadowSet?.observeTargets ?? []).map(t => ({ ...t, callback: shadowSet!.callback })),\n ...(lightSet?.observeTargets ?? []).map(t => ({ ...t, callback: lightSet!.callback })),\n ];\n if (mutationObserverSet.length === 0) return;\n\n return { mutationObserverSet };\n }\n\n onDisconnected(helperHostSet: HelperHostSet): void {\n const inst = helperHostSet.$this;\n for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {\n try { cb.fn(cb.target, cb.opts); } catch (e) { console.error('[SWC] removeObserver error:', e); }\n }\n this.removeObserverCallbacksMap.delete(inst);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;AAAA,SAAS,oBAAoB;AAwBtB,MAAM,iCAAiC,OAAO,IAAI,wCAAwC;AAEjG,MAAM,wBAAwB,CAAC,UAAuB,SAAuC,WAAmB,gBAAuC;AACrJ,QAAM,cAAc,UAAU;AAC9B,MAAI,YAAY,aAAa,YAAwC,gCAAgC,WAAW;AAChH,MAAI,CAAC,WAAW;AACd,gBAAY,CAAC;AACb,iBAAa,eAAe,gCAAgC,WAAW,WAAW;AAAA,EACpF;AACA,YAAU,KAAK,EAAE,aAAa,UAAU,QAAQ,CAAC;AACnD;AAEA,MAAM,8BAA8B,CAClC,mBACA,cACA,UACqE;AACrE,MAAI,OAAO,sBAAsB,YAAY,OAAO,sBAAsB,YAAY;AACpF,WAAO,EAAE,UAAU,mBAAmB,SAAS,EAAE,GAAI,gBAAgB,CAAC,GAAI,GAAG,MAAM,EAAE;AAAA,EACvF;AACA,SAAO,EAAE,UAAU,SAAS,SAAS,EAAE,GAAI,qBAAqB,CAAC,GAAI,GAAG,MAAM,EAAE;AAClF;AAOA,MAAM,2BAA2B,CAC/B,2BACA,2BACA,YACA,UAC2B;AAC3B,OAAK,OAAO,8BAA8B,YAAY,OAAO,8BAA8B,aAAa,eAAe,QAAW;AAEhI,0BAAsB,SAAS,EAAE,GAA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AAmB,CAAC,GAAG,IAAI,QAAM,EAAE,GAAG,GAAG,UAAU,SAAU,SAAS,EAAE;AAAA,IACxF;AACA,QAAI,oBAAoB,WAAW,EAAG;AAEtC,WAAO,EAAE,oBAAoB;AAAA,EAC/B;AAAA,EAEA,eAAe,eAAoC;AACjD,UAAM,OAAO,cAAc;AAC3B,eAAW,MAAM,KAAK,2BAA2B,IAAI,IAAI,KAAK,CAAC,GAAG;AAChE,UAAI;AAAE,WAAG,GAAG,GAAG,QAAQ,GAAG,IAAI;AAAA,MAAG,SAAS,GAAG;AAAE,gBAAQ,MAAM,+BAA+B,CAAC;AAAA,MAAG;AAAA,IAClG;AACA,SAAK,2BAA2B,OAAO,IAAI;AAAA,EAC7C;AACF;",
|
|
6
|
+
"names": ["m"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReflectUtils } from "@dooboostore/core";
|
|
2
|
+
const SWC_PARAMETER_METADATA_KEY = Symbol.for("simple-web-component:parameter");
|
|
3
|
+
const registerParam = (kind, target, propertyKey, parameterIndex) => {
|
|
4
|
+
if (!propertyKey) return;
|
|
5
|
+
const constructor = target.constructor;
|
|
6
|
+
const saves = ReflectUtils.getOwnMetadata(SWC_PARAMETER_METADATA_KEY, constructor, propertyKey) ?? [];
|
|
7
|
+
saves.push({ index: parameterIndex, kind });
|
|
8
|
+
ReflectUtils.defineMetadata(SWC_PARAMETER_METADATA_KEY, saves, constructor, propertyKey);
|
|
9
|
+
};
|
|
10
|
+
function eventObject(target, propertyKey, parameterIndex) {
|
|
11
|
+
registerParam("event", target, propertyKey, parameterIndex);
|
|
12
|
+
}
|
|
13
|
+
function matchedElement(target, propertyKey, parameterIndex) {
|
|
14
|
+
registerParam("matched", target, propertyKey, parameterIndex);
|
|
15
|
+
}
|
|
16
|
+
function hostSet(target, propertyKey, parameterIndex) {
|
|
17
|
+
registerParam("hostSet", target, propertyKey, parameterIndex);
|
|
18
|
+
}
|
|
19
|
+
function helperHostSet(target, propertyKey, parameterIndex) {
|
|
20
|
+
registerParam("helperHostSet", target, propertyKey, parameterIndex);
|
|
21
|
+
}
|
|
22
|
+
function helperSet(target, propertyKey, parameterIndex) {
|
|
23
|
+
registerParam("helperSet", target, propertyKey, parameterIndex);
|
|
24
|
+
}
|
|
25
|
+
function routerEvent(target, propertyKey, parameterIndex) {
|
|
26
|
+
registerParam("routerEvent", target, propertyKey, parameterIndex);
|
|
27
|
+
}
|
|
28
|
+
function appMessage(target, propertyKey, parameterIndex) {
|
|
29
|
+
registerParam("appMessage", target, propertyKey, parameterIndex);
|
|
30
|
+
}
|
|
31
|
+
const getParameterMetadata = (target, propertyKey) => {
|
|
32
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
33
|
+
return ReflectUtils.getMetadata(SWC_PARAMETER_METADATA_KEY, constructor, propertyKey) ?? [];
|
|
34
|
+
};
|
|
35
|
+
const buildSwcParameterArgs = (target, propertyKey, kindValues, legacyArgs) => {
|
|
36
|
+
const saves = getParameterMetadata(target, propertyKey);
|
|
37
|
+
if (saves.length === 0) return legacyArgs;
|
|
38
|
+
const maxIndex = Math.max(...saves.map((s) => s.index));
|
|
39
|
+
const args = new Array(maxIndex + 1);
|
|
40
|
+
for (const s of saves) args[s.index] = kindValues[s.kind];
|
|
41
|
+
return args;
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
appMessage,
|
|
45
|
+
buildSwcParameterArgs,
|
|
46
|
+
eventObject,
|
|
47
|
+
getParameterMetadata,
|
|
48
|
+
helperHostSet,
|
|
49
|
+
helperSet,
|
|
50
|
+
hostSet,
|
|
51
|
+
matchedElement,
|
|
52
|
+
routerEvent
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=parameter.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/parameter.ts"],
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\n/**\n * @eventObject/@matchedElement/@hostSet/@helperHostSet/@helperSet/@routerEvent/@appMessage \u2014\n * @addEventListener/lifecycle/subscribeSwcAppRouteChangeWhileConnected/subscribeSwcAppMessageWhileConnected\n * \uACC4\uC5F4 \uD578\uB4E4\uB7EC\uC758 \uD30C\uB77C\uBBF8\uD130\uB97C \uC21C\uC11C \uBB34\uAD00\uD558\uAC8C \uC120\uC5B8\uD560 \uC218 \uC788\uAC8C \uD574\uC8FC\uB294 \uD30C\uB77C\uBBF8\uD130 \uB370\uCF54\uB808\uC774\uD130.\n * @dooboostore/simple-boot\uC758 @Inject\uC640 \uB3D9\uC77C\uD55C \uC778\uB371\uC2A4 \uAE30\uBC18 \uBA54\uD0C0\uB370\uC774\uD130 \uD328\uD134\uC744 \uB530\uB978\uB2E4:\n * \uB370\uCF54\uB808\uC774\uD130\uAC00 \uC2E4\uD589\uB418\uB294 \uC21C\uC11C\uAC00 \uC544\uB2C8\uB77C \uC2E4\uC81C parameterIndex\uB85C \uC2AC\uB86F\uC744 \uB9E4\uCE6D\uD558\uBBC0\uB85C,\n * \uC0AC\uC6A9\uC790\uAC00 \uD30C\uB77C\uBBF8\uD130 \uC120\uC5B8 \uC21C\uC11C\uB97C \uC790\uC720\uB86D\uAC8C \uBC14\uAFD4\uB3C4 \uB41C\uB2E4.\n */\nexport type SwcParamKind = 'event' | 'matched' | 'hostSet' | 'helperHostSet' | 'helperSet' | 'routerEvent' | 'appMessage';\n\nconst SWC_PARAMETER_METADATA_KEY = Symbol.for('simple-web-component:parameter');\n\ntype SaveParamConfig = { index: number; kind: SwcParamKind };\n\nconst registerParam = (kind: SwcParamKind, target: Object, propertyKey: string | symbol | undefined, parameterIndex: number) => {\n if (!propertyKey) return;\n const constructor = target.constructor;\n const saves = (ReflectUtils.getOwnMetadata(SWC_PARAMETER_METADATA_KEY, constructor, propertyKey) ?? []) as SaveParamConfig[];\n saves.push({ index: parameterIndex, kind });\n ReflectUtils.defineMetadata(SWC_PARAMETER_METADATA_KEY, saves, constructor, propertyKey);\n};\n\n/** \uC774\uBCA4\uD2B8 \uD578\uB4E4\uB7EC\uC758 \uC6D0\uBCF8 Event \uAC1D\uCCB4\uB97C \uC8FC\uC785\uD55C\uB2E4. */\nexport function eventObject(target: Object, propertyKey: string | symbol, parameterIndex: number): void {\n registerParam('event', target, propertyKey, parameterIndex);\n}\n\n/** delegate\uB85C \uB9E4\uCE6D\uB41C \uC2E4\uC81C \uC5D8\uB9AC\uBA3C\uD2B8($matchedElement)\uB97C \uC8FC\uC785\uD55C\uB2E4. */\nexport function matchedElement(target: Object, propertyKey: string | symbol, parameterIndex: number): void {\n registerParam('matched', target, propertyKey, parameterIndex);\n}\n\n/** HostSet(\uD638\uC2A4\uD2B8 \uD2B8\uB9AC \uC815\uBCF4 \u2014 $host/$hosts/$firstHost/$appHost \uB4F1)\uC744 \uC8FC\uC785\uD55C\uB2E4. */\nexport function hostSet(target: Object, propertyKey: string | symbol, parameterIndex: number): void {\n registerParam('hostSet', target, propertyKey, parameterIndex);\n}\n\n/** HelperHostSet(HelperSet + HostSet + $this \uC804\uCCB4 \uBB36\uC74C)\uC744 \uC8FC\uC785\uD55C\uB2E4. */\nexport function helperHostSet(target: Object, propertyKey: string | symbol, parameterIndex: number): void {\n registerParam('helperHostSet', target, propertyKey, parameterIndex);\n}\n\n/** HelperSet($d/$w/$q/$qa/$qi \uB4F1 \uC21C\uC218 DOM/window \uD5EC\uD37C, \uD638\uC2A4\uD2B8 \uD2B8\uB9AC \uC815\uBCF4 \uC5C6\uC74C)\uC744 \uC8FC\uC785\uD55C\uB2E4. */\nexport function helperSet(target: Object, propertyKey: string | symbol, parameterIndex: number): void {\n registerParam('helperSet', target, propertyKey, parameterIndex);\n}\n\n/** @subscribeSwcAppRouteChangeWhileConnected \uD578\uB4E4\uB7EC\uC758 \uB77C\uC6B0\uD2B8 \uBCC0\uACBD \uC774\uBCA4\uD2B8({...RouterEventType, pathData})\uB97C \uC8FC\uC785\uD55C\uB2E4. */\nexport function routerEvent(target: Object, propertyKey: string | symbol, parameterIndex: number): void {\n registerParam('routerEvent', target, propertyKey, parameterIndex);\n}\n\n/** @subscribeSwcAppMessageWhileConnected \uD578\uB4E4\uB7EC\uC758 SwcAppMessage \uD398\uC774\uB85C\uB4DC\uB97C \uC8FC\uC785\uD55C\uB2E4. */\nexport function appMessage(target: Object, propertyKey: string | symbol, parameterIndex: number): void {\n registerParam('appMessage', target, propertyKey, parameterIndex);\n}\n\nexport const getParameterMetadata = (target: any, propertyKey: string | symbol): SaveParamConfig[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(SWC_PARAMETER_METADATA_KEY, constructor, propertyKey) ?? [];\n};\n\n/**\n * \uC704 \uD30C\uB77C\uBBF8\uD130 \uB370\uCF54\uB808\uC774\uD130 \uBA54\uD0C0\uB370\uC774\uD130\uAC00 \uD558\uB098\uB77C\uB3C4 \uC788\uC73C\uBA74 kind\uBCC4 \uAC12\uC744 index \uC21C\uC11C\uC5D0 \uB9DE\uAC8C\n * \uBC30\uC5F4\uB85C \uC870\uB9BD\uD558\uACE0, \uD558\uB098\uB3C4 \uC5C6\uC73C\uBA74 \uAE30\uC874 \uC704\uCE58 \uC778\uC790(legacyArgs)\uB97C \uADF8\uB300\uB85C \uBC18\uD658\uD55C\uB2E4 \u2014 \uC644\uC804 \uD558\uC704\uD638\uD658.\n */\nexport const buildSwcParameterArgs = (\n target: any,\n propertyKey: string | symbol,\n kindValues: Partial<Record<SwcParamKind, any>>,\n legacyArgs: any[]\n): any[] => {\n const saves = getParameterMetadata(target, propertyKey);\n if (saves.length === 0) return legacyArgs;\n const maxIndex = Math.max(...saves.map(s => s.index));\n const args: any[] = new Array(maxIndex + 1);\n for (const s of saves) args[s.index] = kindValues[s.kind];\n return args;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAY7B,MAAM,6BAA6B,OAAO,IAAI,gCAAgC;AAI9E,MAAM,gBAAgB,CAAC,MAA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;AAC1C,aAAW,KAAK,MAAO,MAAK,EAAE,KAAK,IAAI,WAAW,EAAE,IAAI;AACxD,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,6 +2,77 @@ import { ReflectUtils } from "@dooboostore/core";
|
|
|
2
2
|
import { getElementConfig, ensureInit } from "./elementDefine.js";
|
|
3
3
|
import { SwcUtils } from "../utils/Utils.js";
|
|
4
4
|
const QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
|
|
5
|
+
const resolveQueryElements = (inst, selector, options, win) => {
|
|
6
|
+
const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
|
|
7
|
+
let all = [];
|
|
8
|
+
if (typeof selector === "function") {
|
|
9
|
+
const result = selector(inst, hostSet);
|
|
10
|
+
if (result instanceof win.NodeList)
|
|
11
|
+
all = Array.from(result).filter((e) => e instanceof win.HTMLElement);
|
|
12
|
+
else if (Array.isArray(result))
|
|
13
|
+
all = result.filter((e) => e instanceof win.HTMLElement);
|
|
14
|
+
else if (result instanceof win.HTMLElement)
|
|
15
|
+
all = [result];
|
|
16
|
+
} else if (typeof selector === "string") {
|
|
17
|
+
const r = options?.root || "auto";
|
|
18
|
+
if (selector === "$this")
|
|
19
|
+
all = [inst];
|
|
20
|
+
else if (selector === "$host")
|
|
21
|
+
all = hostSet.$host ? [hostSet.$host] : [];
|
|
22
|
+
else if (selector === "$parentHost")
|
|
23
|
+
all = hostSet.$parentHost ? [hostSet.$parentHost] : [];
|
|
24
|
+
else if (selector === "$appHost")
|
|
25
|
+
all = hostSet.$appHost ? [hostSet.$appHost] : [];
|
|
26
|
+
else if (selector === "$firstHost")
|
|
27
|
+
all = hostSet.$firstHost ? [hostSet.$firstHost] : [];
|
|
28
|
+
else if (selector === "$lastHost")
|
|
29
|
+
all = hostSet.$lastHost ? [hostSet.$lastHost] : [];
|
|
30
|
+
else if (selector === "$firstAppHost")
|
|
31
|
+
all = hostSet.$firstAppHost ? [hostSet.$firstAppHost] : [];
|
|
32
|
+
else if (selector === "$lastAppHost")
|
|
33
|
+
all = hostSet.$lastAppHost ? [hostSet.$lastAppHost] : [];
|
|
34
|
+
else if (selector === "$hosts")
|
|
35
|
+
all = hostSet.$hosts.filter(Boolean);
|
|
36
|
+
else if (selector === "$appHosts")
|
|
37
|
+
all = hostSet.$appHosts.filter(Boolean);
|
|
38
|
+
else {
|
|
39
|
+
const scopes = [];
|
|
40
|
+
if (r === "auto")
|
|
41
|
+
scopes.push(inst.shadowRoot || inst);
|
|
42
|
+
else if (r === "light")
|
|
43
|
+
scopes.push(inst);
|
|
44
|
+
else if (r === "shadow" && inst.shadowRoot)
|
|
45
|
+
scopes.push(inst.shadowRoot);
|
|
46
|
+
else if (r === "all") {
|
|
47
|
+
scopes.push(inst);
|
|
48
|
+
if (inst.shadowRoot)
|
|
49
|
+
scopes.push(inst.shadowRoot);
|
|
50
|
+
}
|
|
51
|
+
for (const scope of scopes) {
|
|
52
|
+
const found = scope?.querySelectorAll?.(selector);
|
|
53
|
+
if (found?.length)
|
|
54
|
+
all.push(...Array.from(found).filter((e) => e instanceof win.HTMLElement));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (options?.filter) {
|
|
59
|
+
all = all.filter((el) => options.filter(el, { currentThis: inst, helper: hostSet }));
|
|
60
|
+
}
|
|
61
|
+
return all;
|
|
62
|
+
};
|
|
63
|
+
const pickElements = (all, pick) => {
|
|
64
|
+
if (pick === "all")
|
|
65
|
+
return all;
|
|
66
|
+
if (pick === "even")
|
|
67
|
+
return all.filter((_, i) => i % 2 === 0);
|
|
68
|
+
if (pick === "odd")
|
|
69
|
+
return all.filter((_, i) => i % 2 === 1);
|
|
70
|
+
if (typeof pick === "number")
|
|
71
|
+
return all[pick] ?? null;
|
|
72
|
+
if (pick === "last")
|
|
73
|
+
return all.length ? all[all.length - 1] : null;
|
|
74
|
+
return all.length ? all[0] : null;
|
|
75
|
+
};
|
|
5
76
|
function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
6
77
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
7
78
|
throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
|
|
@@ -23,112 +94,26 @@ function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
|
23
94
|
ensureInit(this);
|
|
24
95
|
const config = getElementConfig(this);
|
|
25
96
|
const win = config?.window || window;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (typeof selectorOrTarget === "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} else if (result instanceof win.NodeList || Array.isArray(result)) {
|
|
34
|
-
resolvedElement = result.length > 0 && result[0] instanceof win.HTMLElement ? result[0] : null;
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
resolvedSelector = selectorOrTarget;
|
|
38
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
39
|
-
const applyRoot = (t) => {
|
|
40
|
-
if (!t || !(t instanceof HTMLElement))
|
|
41
|
-
return t;
|
|
42
|
-
if (r === "auto")
|
|
43
|
-
return t.shadowRoot || t;
|
|
44
|
-
if (r === "shadow")
|
|
45
|
-
return t.shadowRoot;
|
|
46
|
-
if (r === "light")
|
|
47
|
-
return t;
|
|
48
|
-
if (r === "all")
|
|
49
|
-
return t.shadowRoot || t;
|
|
50
|
-
return t;
|
|
51
|
-
};
|
|
52
|
-
if (resolvedSelector === "$this")
|
|
53
|
-
resolvedElement = applyRoot(this);
|
|
54
|
-
else if (resolvedSelector === "$host")
|
|
55
|
-
resolvedElement = applyRoot(hostSet.$host);
|
|
56
|
-
else if (resolvedSelector === "$parentHost")
|
|
57
|
-
resolvedElement = applyRoot(hostSet.$parentHost);
|
|
58
|
-
else if (resolvedSelector === "$appHost")
|
|
59
|
-
resolvedElement = applyRoot(hostSet.$appHost);
|
|
60
|
-
else if (resolvedSelector === "$firstHost")
|
|
61
|
-
resolvedElement = applyRoot(hostSet.$firstHost);
|
|
62
|
-
else if (resolvedSelector === "$lastHost")
|
|
63
|
-
resolvedElement = applyRoot(hostSet.$lastHost);
|
|
64
|
-
else if (resolvedSelector === "$firstAppHost")
|
|
65
|
-
resolvedElement = applyRoot(hostSet.$firstAppHost);
|
|
66
|
-
else if (resolvedSelector === "$lastAppHost")
|
|
67
|
-
resolvedElement = applyRoot(hostSet.$lastAppHost);
|
|
68
|
-
else if (resolvedSelector === "$window")
|
|
69
|
-
return win;
|
|
70
|
-
else if (resolvedSelector === "$document")
|
|
71
|
-
return win.document;
|
|
72
|
-
else {
|
|
73
|
-
if (r === "shadow")
|
|
74
|
-
resolvedElement = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
|
|
75
|
-
else if (r === "light")
|
|
76
|
-
resolvedElement = this.querySelector(resolvedSelector);
|
|
77
|
-
else if (r === "all") {
|
|
78
|
-
const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
|
|
79
|
-
resolvedElement = shadowMatch || this.querySelector(resolvedSelector);
|
|
80
|
-
} else
|
|
81
|
-
resolvedElement = (this.shadowRoot || this).querySelector(resolvedSelector);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (resolvedElement instanceof win.HTMLElement && optionsOrPropertyKey?.filter) {
|
|
85
|
-
const shouldInclude = optionsOrPropertyKey.filter(resolvedElement, { currentThis: this, helper: hostSet });
|
|
86
|
-
if (!shouldInclude) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return resolvedElement;
|
|
97
|
+
const options = optionsOrPropertyKey || {};
|
|
98
|
+
if (typeof selectorOrTarget === "string" && selectorOrTarget === "$window")
|
|
99
|
+
return win;
|
|
100
|
+
if (typeof selectorOrTarget === "string" && selectorOrTarget === "$document")
|
|
101
|
+
return win.document;
|
|
102
|
+
const all = resolveQueryElements(this, selectorOrTarget, options, win);
|
|
103
|
+
return pickElements(all, options.pick ?? "first");
|
|
91
104
|
},
|
|
92
105
|
set(nv) {
|
|
93
106
|
ensureInit(this);
|
|
94
|
-
if (nv === null || nv === void 0) {
|
|
107
|
+
if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
|
|
95
108
|
const config = getElementConfig(this);
|
|
96
109
|
const win = config?.window || window;
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (el instanceof win.Element) {
|
|
105
|
-
el.remove();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const resolvedSelector = selectorOrTarget;
|
|
111
|
-
if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
|
|
112
|
-
return;
|
|
113
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
114
|
-
const targets = [];
|
|
115
|
-
if (r === "shadow") {
|
|
116
|
-
if (this.shadowRoot?.querySelector(resolvedSelector))
|
|
117
|
-
targets.push(this.shadowRoot.querySelector(resolvedSelector));
|
|
118
|
-
} else if (r === "light") {
|
|
119
|
-
if (this.querySelector(resolvedSelector))
|
|
120
|
-
targets.push(this.querySelector(resolvedSelector));
|
|
121
|
-
} else if (r === "all") {
|
|
122
|
-
if (this.shadowRoot?.querySelector(resolvedSelector))
|
|
123
|
-
targets.push(this.shadowRoot.querySelector(resolvedSelector));
|
|
124
|
-
if (this.querySelector(resolvedSelector))
|
|
125
|
-
targets.push(this.querySelector(resolvedSelector));
|
|
126
|
-
} else {
|
|
127
|
-
const el = (this.shadowRoot || this).querySelector(resolvedSelector);
|
|
128
|
-
if (el)
|
|
129
|
-
targets.push(el);
|
|
130
|
-
}
|
|
131
|
-
targets.forEach((t) => t.remove());
|
|
110
|
+
const options = optionsOrPropertyKey || {};
|
|
111
|
+
const all = resolveQueryElements(this, selectorOrTarget, options, win);
|
|
112
|
+
const picked = pickElements(all, options.pick ?? "first");
|
|
113
|
+
if (Array.isArray(picked))
|
|
114
|
+
picked.forEach((t) => t.remove());
|
|
115
|
+
else if (picked)
|
|
116
|
+
picked.remove();
|
|
132
117
|
}
|
|
133
118
|
},
|
|
134
119
|
enumerable: true,
|
|
@@ -142,6 +127,17 @@ const getQueryMetadata = (target) => {
|
|
|
142
127
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
143
128
|
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor) ?? [];
|
|
144
129
|
};
|
|
130
|
+
const QUERY_ALL_METADATA_KEY = QUERY_METADATA_KEY;
|
|
131
|
+
function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
132
|
+
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
133
|
+
return query(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
134
|
+
}
|
|
135
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
136
|
+
return query(selectorOrTarget, { ...optionsOrPropertyKey ?? {}, pick: "all" });
|
|
137
|
+
}
|
|
138
|
+
return query({ ...selectorOrTarget ?? {}, pick: "all" });
|
|
139
|
+
}
|
|
140
|
+
const getQueryAllMetadata = getQueryMetadata;
|
|
145
141
|
function queryShadow(selector, options) {
|
|
146
142
|
return query(selector, { ...options ?? {}, root: "shadow" });
|
|
147
143
|
}
|
|
@@ -151,12 +147,31 @@ function queryLight(selector, options) {
|
|
|
151
147
|
function queryAllRoots(selector, options) {
|
|
152
148
|
return query(selector, { ...options ?? {}, root: "all" });
|
|
153
149
|
}
|
|
150
|
+
function queryAllShadow(selector, options) {
|
|
151
|
+
return query(selector, { ...options ?? {}, root: "shadow", pick: "all" });
|
|
152
|
+
}
|
|
153
|
+
function queryAllLight(selector, options) {
|
|
154
|
+
return query(selector, { ...options ?? {}, root: "light", pick: "all" });
|
|
155
|
+
}
|
|
156
|
+
function queryAllAll(selector, options) {
|
|
157
|
+
return query(selector, { ...options ?? {}, root: "all", pick: "all" });
|
|
158
|
+
}
|
|
159
|
+
const queryIn = (root, pick) => (selector, options) => query(selector, { ...options ?? {}, root, ...pick !== void 0 ? { pick } : {} });
|
|
154
160
|
export {
|
|
161
|
+
QUERY_ALL_METADATA_KEY,
|
|
155
162
|
QUERY_METADATA_KEY,
|
|
163
|
+
getQueryAllMetadata,
|
|
156
164
|
getQueryMetadata,
|
|
165
|
+
pickElements,
|
|
157
166
|
query,
|
|
167
|
+
queryAll,
|
|
168
|
+
queryAllAll,
|
|
169
|
+
queryAllLight,
|
|
158
170
|
queryAllRoots,
|
|
171
|
+
queryAllShadow,
|
|
172
|
+
queryIn,
|
|
159
173
|
queryLight,
|
|
160
|
-
queryShadow
|
|
174
|
+
queryShadow,
|
|
175
|
+
resolveQueryElements
|
|
161
176
|
};
|
|
162
177
|
//# sourceMappingURL=query.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/query.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface QueryOptions extends SwcQueryOptions {\n /**\n * Filter function to determine whether to include the element.\n * If it returns false, the element is skipped.\n */\n filter?: (target: HTMLElement, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n}\n\nexport interface QueryMetadata {\n propertyKey: string | symbol;\n selector: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null);\n options: QueryOptions ;\n}\n\nexport const QUERY_METADATA_KEY = Symbol.for('simple-web-component:query');\n\nexport function query(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor | void;\nexport function query(selector: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null), options?: QueryOptions): PropertyDecorator;\nexport function query(options?: QueryOptions): PropertyDecorator;\n/**\n * @query decorator to inject a single element into a class property.\n * \n * Supports both string selectors and function-based selectors:\n * - String selector: @query('#my-element')\n * - Function selector: @query((currentThis, helper) => currentThis.shadowRoot?.querySelector('.item'))\n * \n * Supports filtering:\n * - @query('#my-element', { filter: (target, meta) => target.hasAttribute('active') })\n */\nexport function query(selectorOrTarget?: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null) | Object, optionsOrPropertyKey?: QueryOptions | string | symbol, descriptor?: PropertyDescriptor): any {\n // Bare decorator: @query\n if (descriptor !== undefined && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol')) {\n throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);\n }\n // With selector\n if (typeof selectorOrTarget === 'string' || typeof selectorOrTarget === 'function') {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryMetadata[]>(QUERY_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget as any, options: optionsOrPropertyKey as QueryOptions || {} });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const config = getElementConfig(this);\n const win = config?.window || window;\n const hostSet = SwcUtils.getHelperAndHostSet(win, this);\n \n // Resolve selector - can be string or function\n let resolvedSelector: string;\n let resolvedElement: HTMLElement | null = null;\n \n if (typeof selectorOrTarget === 'function') {\n const result = (selectorOrTarget as any)(this, hostSet);\n // If function returns a Node/Element, return it directly\n if (result instanceof win.Node || result instanceof win.Element) {\n resolvedElement = result instanceof win.HTMLElement ? (result as HTMLElement) : null;\n }\n // If function returns NodeList or Element[], return first element\n else if (result instanceof win.NodeList || Array.isArray(result)) {\n resolvedElement = result.length > 0 && result[0] instanceof win.HTMLElement ? (result[0] as HTMLElement) : null;\n }\n } else {\n resolvedSelector = selectorOrTarget;\n\n const r = (optionsOrPropertyKey as QueryOptions)?.root || 'auto';\n const applyRoot = (t: any) => {\n if (!t || !(t instanceof HTMLElement)) return t;\n if (r === 'auto') return t.shadowRoot || t;\n if (r === 'shadow') return t.shadowRoot;\n if (r === 'light') return t;\n if (r === 'all') return t.shadowRoot || t; \n return t;\n };\n\n // --- Special Selectors: HostSet ---\n if (resolvedSelector === '$this') resolvedElement = applyRoot(this);\n else if (resolvedSelector === '$host') resolvedElement = applyRoot(hostSet.$host);\n else if (resolvedSelector === '$parentHost') resolvedElement = applyRoot(hostSet.$parentHost);\n else if (resolvedSelector === '$appHost') resolvedElement = applyRoot(hostSet.$appHost);\n else if (resolvedSelector === '$firstHost') resolvedElement = applyRoot(hostSet.$firstHost);\n else if (resolvedSelector === '$lastHost') resolvedElement = applyRoot(hostSet.$lastHost);\n else if (resolvedSelector === '$firstAppHost') resolvedElement = applyRoot(hostSet.$firstAppHost);\n else if (resolvedSelector === '$lastAppHost') resolvedElement = applyRoot(hostSet.$lastAppHost);\n // --- Special Selectors: Env ---\n else if (resolvedSelector === '$window') return win;\n else if (resolvedSelector === '$document') return win.document;\n // --- Standard Selectors ---\n else {\n if (r === 'shadow') resolvedElement = this.shadowRoot ? (this.shadowRoot.querySelector(resolvedSelector) as HTMLElement | null) : null;\n else if (r === 'light') resolvedElement = this.querySelector(resolvedSelector) as HTMLElement | null;\n else if (r === 'all') {\n const shadowMatch = this.shadowRoot ? (this.shadowRoot.querySelector(resolvedSelector) as HTMLElement | null) : null;\n resolvedElement = shadowMatch || (this.querySelector(resolvedSelector) as HTMLElement | null);\n }\n else resolvedElement = ((this.shadowRoot || this).querySelector(resolvedSelector) as HTMLElement | null);\n }\n }\n\n // Apply filter if provided\n if (resolvedElement instanceof win.HTMLElement && (optionsOrPropertyKey as QueryOptions)?.filter) {\n const shouldInclude = (optionsOrPropertyKey as QueryOptions).filter!(resolvedElement, { currentThis: this, helper: hostSet });\n if (!shouldInclude) {\n return null;\n }\n }\n\n return resolvedElement;\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined) {\n const config = getElementConfig(this);\n const win = config?.window || window;\n const hostSet = SwcUtils.getHelperAndHostSet(win, this);\n \n // Resolve selector - can be string or function\n if (typeof selectorOrTarget === 'function') {\n // Get the element from function and remove it\n const result = (selectorOrTarget as any)(this, hostSet);\n if (result instanceof win.Element) {\n (result as Element).remove();\n } else if (result instanceof win.NodeList || Array.isArray(result)) {\n const el = result.length > 0 ? result[0] : null;\n if (el instanceof win.Element) {\n (el as Element).remove();\n }\n }\n return;\n }\n \n const resolvedSelector = selectorOrTarget;\n \n if (resolvedSelector.startsWith('$') && resolvedSelector !== '$this') return;\n\n const r = (optionsOrPropertyKey as QueryOptions)?.root || 'auto';\n const targets: Element[] = [];\n\n if (r === 'shadow') {\n if (this.shadowRoot?.querySelector(resolvedSelector)) targets.push(this.shadowRoot.querySelector(resolvedSelector)!);\n } else if (r === 'light') {\n if (this.querySelector(resolvedSelector)) targets.push(this.querySelector(resolvedSelector)!);\n } else if (r === 'all') {\n if (this.shadowRoot?.querySelector(resolvedSelector)) targets.push(this.shadowRoot.querySelector(resolvedSelector)!);\n if (this.querySelector(resolvedSelector)) targets.push(this.querySelector(resolvedSelector)!);\n } else {\n const el = (this.shadowRoot || this).querySelector(resolvedSelector);\n if (el) targets.push(el);\n }\n\n targets.forEach(t => t.remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n }\n // Without selector (defaults to $this)\n return query('$this', selectorOrTarget as SwcQueryOptions);\n}\n\nexport const getQueryMetadata = (target: any): QueryMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor) ?? [];\n};\n\n// ─── root별 편의 데코레이터 ───\n\n/**\n * @queryShadow(selector, options?) — shadow DOM에서 단일 요소를 쿼리\n */\nexport function queryShadow(selector: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null), options?: Omit<QueryOptions, 'root'>): PropertyDecorator {\n return query(selector, {...options ?? {}, root: 'shadow'});\n}\n\n/**\n * @queryLight(selector, options?) — light DOM에서 단일 요소를 쿼리\n */\nexport function queryLight(selector: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null), options?: Omit<QueryOptions, 'root'>): PropertyDecorator {\n return query(selector, {...options ?? {}, root: 'light'});\n}\n\n/**\n * @queryAll(selector, options?) — shadow+light 모두에서 요소를 쿼리\n */\nexport function queryAllRoots(selector: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null), options?: Omit<QueryOptions, 'root'>): PropertyDecorator {\n return query(selector, {...options ?? {}, root: 'all'});\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,kBAAkB;AAC7C,SAAS,gBAAgB;
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SwcQueryOptions, SwcRootType, SwcFnSelector, SwcSelector, HelperHostSet } from '../types';\n\nexport type QueryPick = 'first' | 'last' | 'all' | 'even' | 'odd' | number;\n\nexport interface QueryBaseOptions {\n // 어떤 요소를 고를지 — 기본 'first'(단일). 'all'/'even'/'odd'는 배열, number는 인덱스(단일)\n pick?: QueryPick;\n filter?: (target: HTMLElement, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n}\n// 문자열 셀렉터 전용 — root 허용\nexport type QueryOptions = QueryBaseOptions & SwcQueryOptions;\n// 함수 셀렉터 전용 — root 금지\nexport type QueryNonQueryOptions = QueryBaseOptions;\n\nexport type QueryFnSelector = SwcFnSelector;\nexport type QuerySelector = SwcSelector;\n\n// 셀렉터 종류에 따라 옵션 타입 분기\nexport type QueryOptionsOf<S extends QuerySelector> = S extends string ? QueryOptions : QueryNonQueryOptions;\n\nexport interface QueryMetadata {\n propertyKey: string | symbol;\n selector: QuerySelector;\n options: QueryOptions;\n}\n\nexport const QUERY_METADATA_KEY = Symbol.for('simple-web-component:query');\n\n/**\n * 셀렉터를 해석해 매칭된 모든 요소를 배열로 반환한다 (query/queryAll 공용).\n * $window/$document는 요소가 아니므로 여기서 처리하지 않는다.\n */\nexport const resolveQueryElements = (\n inst: any,\n selector: QuerySelector,\n options: QueryOptions,\n win: Window\n): HTMLElement[] => {\n const hostSet = SwcUtils.getHelperAndHostSet(win, inst);\n let all: HTMLElement[] = [];\n\n if (typeof selector === 'function') {\n const result = (selector as any)(inst, hostSet);\n if (result instanceof win.NodeList) all = Array.from(result as NodeList).filter(e => e instanceof win.HTMLElement) as HTMLElement[];\n else if (Array.isArray(result)) all = (result as any[]).filter(e => e instanceof win.HTMLElement) as HTMLElement[];\n else if (result instanceof win.HTMLElement) all = [result as HTMLElement];\n } else if (typeof selector === 'string') {\n const r = (options as any)?.root || 'auto';\n if (selector === '$this') all = [inst as HTMLElement];\n else if (selector === '$host') all = hostSet.$host ? [hostSet.$host] : [];\n else if (selector === '$parentHost') all = hostSet.$parentHost ? [hostSet.$parentHost] : [];\n else if (selector === '$appHost') all = hostSet.$appHost ? [hostSet.$appHost as any] : [];\n else if (selector === '$firstHost') all = hostSet.$firstHost ? [hostSet.$firstHost] : [];\n else if (selector === '$lastHost') all = hostSet.$lastHost ? [hostSet.$lastHost] : [];\n else if (selector === '$firstAppHost') all = hostSet.$firstAppHost ? [hostSet.$firstAppHost as any] : [];\n else if (selector === '$lastAppHost') all = hostSet.$lastAppHost ? [hostSet.$lastAppHost as any] : [];\n else if (selector === '$hosts') all = hostSet.$hosts.filter(Boolean);\n else if (selector === '$appHosts') all = hostSet.$appHosts.filter(Boolean) as any[];\n else {\n const scopes: any[] = [];\n if (r === 'auto') scopes.push(inst.shadowRoot || inst);\n else if (r === 'light') scopes.push(inst);\n else if (r === 'shadow' && inst.shadowRoot) scopes.push(inst.shadowRoot);\n else if (r === 'all') { scopes.push(inst); if (inst.shadowRoot) scopes.push(inst.shadowRoot); }\n for (const scope of scopes) {\n const found = scope?.querySelectorAll?.(selector) as NodeListOf<HTMLElement> | undefined;\n if (found?.length) all.push(...Array.from(found).filter(e => e instanceof win.HTMLElement));\n }\n }\n }\n\n if ((options as any)?.filter) {\n all = all.filter(el => (options as any).filter(el, { currentThis: inst, helper: hostSet }));\n }\n return all;\n};\n\n/**\n * 매칭된 요소 배열에서 pick 옵션에 따라 요소를 고른다.\n * - 'first'(기본) / 'last' / number(인덱스) → 단일 요소\n * - 'all' / 'even'(0,2,4...) / 'odd'(1,3,5...) → 배열\n */\nexport const pickElements = (\n all: HTMLElement[],\n pick: QueryPick\n): HTMLElement | HTMLElement[] | null => {\n if (pick === 'all') return all;\n if (pick === 'even') return all.filter((_, i) => i % 2 === 0);\n if (pick === 'odd') return all.filter((_, i) => i % 2 === 1);\n if (typeof pick === 'number') return all[pick] ?? null;\n if (pick === 'last') return all.length ? all[all.length - 1] : null;\n return all.length ? all[0] : null;\n};\n\nexport function query(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor | void;\nexport function query(selector: string, options?: QueryOptions): PropertyDecorator;\nexport function query(selector: QueryFnSelector, options?: QueryNonQueryOptions): PropertyDecorator;\nexport function query(options?: QueryOptions): PropertyDecorator;\n/**\n * @query decorator — 클래스 필드에 요소를 주입한다.\n *\n * - 문자열 셀렉터: CSS / 특수 셀렉터($this,$host,$window,...), root 옵션으로 탐색 영역 지정\n * - 함수 셀렉터: (currentThis, helper) => Node | NodeList | Element | Element[] | null (root 금지)\n * - options.pick: 'first'(기본) | 'last' | 'all' | 'even' | 'odd' | number\n */\nexport function query(selectorOrTarget?: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null) | Object, optionsOrPropertyKey?: QueryOptions | string | symbol, descriptor?: PropertyDescriptor): any {\n // Bare decorator: @query\n if (descriptor !== undefined && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol')) {\n throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);\n }\n // With selector\n if (typeof selectorOrTarget === 'string' || typeof selectorOrTarget === 'function') {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryMetadata[]>(QUERY_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget as any, options: (optionsOrPropertyKey as QueryOptions) || {} });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const config = getElementConfig(this);\n const win = config?.window || window;\n const options = (optionsOrPropertyKey as QueryOptions) || {};\n\n // $window/$document는 요소가 아니므로 항상 단일 반환\n if (typeof selectorOrTarget === 'string' && selectorOrTarget === '$window') return win;\n if (typeof selectorOrTarget === 'string' && selectorOrTarget === '$document') return win.document;\n\n const all = resolveQueryElements(this, selectorOrTarget as QuerySelector, options, win);\n return pickElements(all, options.pick ?? 'first');\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {\n const config = getElementConfig(this);\n const win = config?.window || window;\n const options = (optionsOrPropertyKey as QueryOptions) || {};\n const all = resolveQueryElements(this, selectorOrTarget as QuerySelector, options, win);\n const picked = pickElements(all, options.pick ?? 'first');\n if (Array.isArray(picked)) picked.forEach(t => t.remove());\n else if (picked) picked.remove();\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n }\n // Without selector (defaults to $this)\n return query('$this', selectorOrTarget as QueryOptions);\n}\n\nexport const getQueryMetadata = (target: any): QueryMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor) ?? [];\n};\n\n// ─── queryAll (query의 pick:'all' 편의 래퍼 — 호환용) ───\nexport const QUERY_ALL_METADATA_KEY = QUERY_METADATA_KEY;\n\nexport function queryAll(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor | void;\nexport function queryAll(selector: string, options?: Omit<QueryOptions, 'pick'>): PropertyDecorator;\nexport function queryAll(selector: QueryFnSelector, options?: Omit<QueryNonQueryOptions, 'pick'>): PropertyDecorator;\nexport function queryAll(options?: Omit<QueryOptions, 'pick'>): PropertyDecorator;\nexport function queryAll(selectorOrTarget?: any, optionsOrPropertyKey?: any, descriptor?: PropertyDescriptor): any {\n // bare(필드 직접 적용)는 query로 위임\n if (descriptor !== undefined && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol')) {\n return query(selectorOrTarget, optionsOrPropertyKey, descriptor);\n }\n if (typeof selectorOrTarget === 'string' || typeof selectorOrTarget === 'function') {\n return query(selectorOrTarget, {...(optionsOrPropertyKey ?? {}), pick: 'all'});\n }\n return query({...(selectorOrTarget ?? {}), pick: 'all'});\n}\n\nexport const getQueryAllMetadata = getQueryMetadata;\n\n// ─── root별 편의 데코레이터 ───\n\n/**\n * @queryShadow(selector, options?) — shadow DOM에서 요소를 쿼리\n */\nexport function queryShadow(selector: string | QueryFnSelector, options?: QueryBaseOptions): PropertyDecorator {\n return query(selector as any, {...options ?? {}, root: 'shadow'});\n}\n\n/**\n * @queryLight(selector, options?) — light DOM에서 요소를 쿼리\n */\nexport function queryLight(selector: string | QueryFnSelector, options?: QueryBaseOptions): PropertyDecorator {\n return query(selector as any, {...options ?? {}, root: 'light'});\n}\n\n/**\n * @queryAllRoots(selector, options?) — shadow+light 모두에서 요소를 쿼리 (pick 기본 first)\n */\nexport function queryAllRoots(selector: string | QueryFnSelector, options?: QueryBaseOptions): PropertyDecorator {\n return query(selector as any, {...options ?? {}, root: 'all'});\n}\n\n/**\n * @queryAllShadow(selector, options?) — shadow DOM에서 모든 매칭 요소를 배열로 쿼리\n */\nexport function queryAllShadow(selector: string | QueryFnSelector, options?: QueryBaseOptions): PropertyDecorator {\n return query(selector as any, {...options ?? {}, root: 'shadow', pick: 'all'});\n}\n\n/**\n * @queryAllLight(selector, options?) — light DOM에서 모든 매칭 요소를 배열로 쿼리\n */\nexport function queryAllLight(selector: string | QueryFnSelector, options?: QueryBaseOptions): PropertyDecorator {\n return query(selector as any, {...options ?? {}, root: 'light', pick: 'all'});\n}\n\n/**\n * @queryAllAll(selector, options?) — shadow+light 모두에서 모든 매칭 요소를 배열로 쿼리\n */\nexport function queryAllAll(selector: string | QueryFnSelector, options?: QueryBaseOptions): PropertyDecorator {\n return query(selector as any, {...options ?? {}, root: 'all', pick: 'all'});\n}\n\n/**\n * @queryIn(root, pick?) — root + pick 조합 팩토리.\n * first/last/even/odd/all/number를 모두 지원하는 데코레이터를 생성한다.\n *\n * @example\n * @queryIn('shadow', 'even')('.item') // shadow DOM 짝수 인덱스들\n * @queryIn('light', 2)('.item') // light DOM 3번째 요소\n * @queryIn('all')('.item') // root all, pick 기본 first\n */\nexport const queryIn = (root: SwcRootType, pick?: QueryPick) =>\n (selector: string | QueryFnSelector, options?: QueryBaseOptions): PropertyDecorator =>\n query(selector as any, {...options ?? {}, root, ...(pick !== undefined ? {pick} : {})});"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,kBAAkB;AAC7C,SAAS,gBAAgB;AA2BlB,MAAM,qBAAqB,OAAO,IAAI,4BAA4B;AAMlE,MAAM,uBAAuB,CAClC,MACA,UACA,SACA,QACiB;AACjB,QAAM,UAAU,SAAS,oBAAoB,KAAK,IAAI;AACtD,MAAI,MAAqB,CAAA;AAEzB,MAAI,OAAO,aAAa,YAAY;AAClC,UAAM,SAAU,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