@dooboostore/simple-web-component 1.0.25 → 1.0.27
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 +284 -68
- package/dist/cjs/decorators/attribute.js +32 -43
- package/dist/cjs/decorators/attribute.js.map +3 -3
- package/dist/cjs/decorators/elementDefine.js +33 -19
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/index.js +1 -0
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +5 -5
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/query.js +4 -4
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +4 -4
- package/dist/cjs/decorators/queryAll.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChange.js +59 -0
- package/dist/cjs/decorators/subscribeSwcAppRouteChange.js.map +7 -0
- package/dist/cjs/elements/SwcAppEngine.js +18 -63
- package/dist/cjs/elements/SwcAppEngine.js.map +3 -3
- package/dist/cjs/elements/SwcAppMixin.js +103 -24
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/elements/register.js +0 -1
- package/dist/cjs/elements/register.js.map +2 -2
- package/dist/cjs/utils/Utils.js +18 -0
- package/dist/cjs/utils/Utils.js.map +3 -3
- package/dist/esm/decorators/attribute.js +32 -43
- package/dist/esm/decorators/attribute.js.map +3 -3
- package/dist/esm/decorators/elementDefine.js +34 -20
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/index.js +1 -0
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +5 -5
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/query.js +4 -4
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +4 -4
- package/dist/esm/decorators/queryAll.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChange.js +40 -0
- package/dist/esm/decorators/subscribeSwcAppRouteChange.js.map +7 -0
- package/dist/esm/elements/SwcAppEngine.js +18 -63
- package/dist/esm/elements/SwcAppEngine.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +103 -24
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/elements/register.js +0 -1
- package/dist/esm/elements/register.js.map +2 -2
- package/dist/esm/utils/Utils.js +18 -0
- package/dist/esm/utils/Utils.js.map +3 -3
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +135 -2470
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/attribute.d.ts +0 -1
- package/dist/types/decorators/attribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +1 -0
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +2 -2
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +1 -1
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +1 -1
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts +18 -0
- package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts.map +1 -0
- package/dist/types/elements/SwcAppEngine.d.ts +3 -5
- package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +9 -0
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/elements/register.d.ts +1 -1
- package/dist/types/elements/register.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +3 -0
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +135 -2470
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +3 -3
- package/src/decorators/attribute.ts +62 -53
- package/src/decorators/elementDefine.ts +79 -30
- package/src/decorators/index.ts +1 -0
- package/src/decorators/lifecycles.ts +2 -2
- package/src/decorators/query.ts +5 -5
- package/src/decorators/queryAll.ts +8 -7
- package/src/decorators/subscribeSwcAppRouteChange.ts +71 -0
- package/src/elements/SwcAppEngine.ts +25 -81
- package/src/elements/SwcAppMixin.ts +143 -28
- package/src/elements/register.ts +0 -2
- package/src/utils/Utils.ts +33 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/elementDefine.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { FunctionUtils } from '@dooboostore/core';\nimport { getAddEventListenerMetadata } from './addEventListener';\nimport { ON_CONSTRUCTOR_METADATA_KEY, ON_BEFORE_CONNECTED_METADATA_KEY, ON_AFTER_CONNECTED_METADATA_KEY, ON_BEFORE_DISCONNECTED_METADATA_KEY, ON_AFTER_DISCONNECTED_METADATA_KEY, ON_BEFORE_ADOPTED_METADATA_KEY, ON_AFTER_ADOPTED_METADATA_KEY, findAllLifecycleMetadata, getOnConnectedInnerHtmlMetadata } from './lifecycles';\nimport { getEmitCustomEventMetadataList } from './emitCustomEvent';\nimport { findAllAttributeChangedMetadata } from './changedAttributeHost';\nimport { findAllAttributeApplyMetadata } from './applyAttribute';\nimport { findAllAttributeMetadata } from './attribute';\nimport { SwcUtils } from '../utils/Utils';\nimport { HTML_TAG_ENTRIES, DOM_EVENT_NAMES } from '../config/config';\nimport { SituationTypeContainer, SituationTypeContainers } from '@dooboostore/simple-boot/decorators/inject/Inject';\nimport { InjectSituationType, HostSet } from '../types';\n\n// --- Core Interfaces & Types ---\n\nexport const ELEMENT_CONFIG_KEY = Symbol.for('simple-web-component:element-config');\n\nexport interface ElementConfig {\n extends?: string;\n observedAttributes?: string[];\n customElementRegistry?: any;\n window?: Window;\n}\n\nexport interface ElementMetadata extends Omit<ElementConfig, 'window'> {\n name: string;\n window: Window;\n}\n\nexport const getElementConfig = (target: any): ElementMetadata | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);\n};\n\nexport const ensureInit = (inst: any) => {\n if (!inst.__swc_initialized) {\n inst._swcId = Math.random().toString(36).substring(2, 11);\n inst._emitHandlers = new Map();\n inst._boundListeners = [];\n inst.__swc_initialized = true;\n\n // Call constructor script if present\n const hostSet = SwcUtils.getHostSet(inst);\n inst._executeSwcScript?.('swc-on-constructor', hostSet);\n\n // Call @onConstructor lifecycle methods\n const cMethods = findAllLifecycleMetadata(inst, ON_CONSTRUCTOR_METADATA_KEY);\n if (cMethods) {\n for (const m of cMethods) (inst)._invokeLifecycleMethod(m, hostSet);\n }\n }\n};\n\n// --- Global Event Handling ---\nconst globalDelegatedRoots = new WeakSet<Node>();\n\nconst handleGlobalSwcEvent = async (event: Event) => {\n if ((event as any).__swc_handled) return;\n const path = event.composedPath();\n const type = event.type;\n const attrName = `swc-on-${type}`;\n\n for (const node of path) {\n if (!(node instanceof HTMLElement)) continue;\n const script = node.getAttribute?.(attrName);\n if (script && !getElementConfig(node)) {\n const host: any = SwcUtils.findNearestSwcHost(node);\n if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === 'function') {\n await host.__swc_executeAttributeEvent(node, attrName, script, event);\n (event as any).__swc_handled = true;\n break;\n }\n }\n }\n};\n\nfunction buildEnv(configWindow?: Window) {\n const win: Window = configWindow || ((typeof window !== 'undefined' ? window : undefined) as any);\n const doc: Document = win?.document;\n const builtInTagMap = new Map<any, string>();\n for (const [cls, tag] of HTML_TAG_ENTRIES) {\n if (win?.[cls]) builtInTagMap.set(win[cls], tag);\n }\n const domHelpers = SwcUtils.getHelperSet(win);\n return { win, doc, builtInTagMap, domHelpers };\n}\n\nconst getHandlers = (inst: any) => {\n if (!inst.__swc_attributeEventHandlers) inst.__swc_attributeEventHandlers = new Map();\n return inst.__swc_attributeEventHandlers;\n};\n\nconst setupPrototype = (proto: any) => {\n if (proto.__swc_proto_setup) return;\n proto.__swc_proto_setup = true;\n\n proto._executeSwcScript = function (attrName: string, hostSet: HostSet, extraArgs: Record<string, any> = {}) {\n ensureInit(this);\n const script = this.getAttribute(attrName);\n if (script) {\n try {\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n const helpers = SwcUtils.getHelperSet(currentWin);\n const args = { ...hostSet, ...helpers, ...extraArgs, $el: this, $root: this.getRootNode() };\n FunctionUtils.execute({ script, context: this, args });\n } catch (e) {\n console.error(`[SWC] Failed to execute ${attrName}:`, e);\n }\n }\n };\n\n proto._resolveWindow = function (localConfig?: ElementConfig): Window {\n ensureInit(this);\n if (localConfig?.window) return localConfig.window;\n const ancestors = SwcUtils.findAllSwcHosts(this as any);\n for (let i = ancestors.length - 1; i >= 0; i--) {\n const aConf = getElementConfig(ancestors[i]);\n if (aConf?.window) return aConf.window;\n }\n return (typeof window !== 'undefined' ? window : undefined) as Window;\n };\n\n proto._invokeLifecycleMethod = function (methodName: string | symbol, hostSet: HostSet, extraArgs: any[] = []) {\n ensureInit(this);\n if (typeof (this as any)[methodName] !== 'function') return;\n const app = hostSet.$appHost?.simpleApplication;\n\n if (app) {\n const otherStorage = new Map<any, any>();\n const situations = new SituationTypeContainers([new SituationTypeContainer({ situationType: InjectSituationType.HOST_SET, data: hostSet }), new SituationTypeContainer({ situationType: InjectSituationType.APP_HOST, data: hostSet.$appHost }), new SituationTypeContainer({ situationType: InjectSituationType.APP_HOSTS, data: hostSet.$appHosts }), new SituationTypeContainer({ situationType: InjectSituationType.HOST, data: hostSet.$host }), new SituationTypeContainer({ situationType: InjectSituationType.HOSTS, data: hostSet.$hosts }), new SituationTypeContainer({ situationType: InjectSituationType.FIRST_HOST, data: hostSet.$firstHost }), new SituationTypeContainer({ situationType: InjectSituationType.LAST_HOST, data: hostSet.$lastHost }), new SituationTypeContainer({ situationType: InjectSituationType.FIRST_APP_HOST, data: hostSet.$firstAppHost }), new SituationTypeContainer({ situationType: InjectSituationType.LAST_APP_HOST, data: hostSet.$lastAppHost })]);\n otherStorage.set(SituationTypeContainers, situations);\n\n return app.simstanceManager.executeBindParameterSimPromise(\n {\n target: this,\n targetKey: methodName,\n inputParameters: extraArgs\n },\n otherStorage\n );\n } else {\n return (this as any)[methodName](...extraArgs);\n }\n };\n\n proto._bindAttributeEvent = function (el: HTMLElement, attrName: string, script: string, eventName?: string) {\n ensureInit(this);\n if (!eventName) {\n if (!attrName.startsWith('swc-on-')) return;\n eventName = attrName.substring(7);\n }\n const elHandlers = getHandlers(this);\n let handlers = elHandlers.get(el);\n if (!handlers) {\n handlers = new Map();\n elHandlers.set(el, handlers);\n }\n\n const oldHandler = handlers.get(attrName);\n if (oldHandler) el.removeEventListener(eventName, oldHandler);\n\n const handler = async (event: any) => {\n const parent = SwcUtils.findNearestSwcHost(el);\n const hostSet = SwcUtils.getHostSet(parent || el);\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n const helpers = SwcUtils.getHelperSet(currentWin);\n const args = {\n event,\n $data: (event as CustomEvent).detail,\n ...hostSet,\n ...helpers,\n $el: el,\n $root: this.getRootNode()\n };\n await FunctionUtils.execute({ script, context: el, args });\n };\n\n el.addEventListener(eventName, handler);\n handlers.set(attrName, handler);\n };\n\n proto.__swc_executeAttributeEvent = async function (el: HTMLElement, attrName: string, script: string, event: Event) {\n ensureInit(this);\n\n const parent = SwcUtils.findNearestSwcHost(el);\n const hostSet = SwcUtils.getHostSet(parent || el);\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n const currentHelpers = SwcUtils.getHelperSet(currentWin);\n const detail = (event as CustomEvent).detail;\n const args = {\n event,\n $event: event,\n $data: detail,\n $detail: detail,\n ...hostSet,\n ...currentHelpers,\n $el: el,\n $root: this.getRootNode()\n };\n await FunctionUtils.execute({ script, context: el, args });\n };\n};\n\nexport const elementDefine =\n (name: string, config: Partial<ElementConfig> = {}): ClassDecorator =>\n (constructor: any) => {\n const { win, doc, builtInTagMap: BUILT_IN_TAG_MAP, domHelpers: SWC_DOM_HELPERS } = buildEnv(config.window);\n const metadata: ElementMetadata = { ...config, name, window: win };\n\n if (!metadata.window) {\n throw new Error('window is required');\n }\n\n let extendsTagName = metadata.extends;\n if (!extendsTagName) {\n let proto = constructor;\n const BaseHTMLElement = (win as any).HTMLElement;\n while (proto && proto !== BaseHTMLElement && proto !== Function.prototype) {\n extendsTagName = BUILT_IN_TAG_MAP.get(proto);\n if (extendsTagName) break;\n proto = Object.getPrototypeOf(proto);\n }\n metadata.extends = extendsTagName;\n }\n\n const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];\n const emitHostCustomEventList = emitCustomEventList.filter(meta => meta.selector === ':host' || meta.selector === '');\n const addEventListenerList = getAddEventListenerMetadata(constructor) || [];\n const attrChangeMap = findAllAttributeChangedMetadata(constructor);\n const attributeList = findAllAttributeMetadata(constructor);\n const applyAttributeMap = findAllAttributeApplyMetadata(constructor);\n\n const swcLifecycleAttributes = ['swc-on-constructor', 'swc-on-connected', 'swc-on-disconnected', 'swc-on-before-connected', 'swc-on-after-connected', 'swc-on-before-disconnected', 'swc-on-after-disconnected', 'swc-on-before-adopted', 'swc-on-after-adopted', 'swc-on-attribute-changed'];\n const swcOnEvents = DOM_EVENT_NAMES.map(e => `swc-on-${e}`);\n\n // Collect all observed attributes from all decorators\n const attributeApplyNames = Array.from(applyAttributeMap.values()).map(it => it.options.name).filter(Boolean) as string[];\n const attributeListNames = attributeList.map(it => it.options.name || String(it.propertyKey));\n \n const mergedObservedAttributes = [...new Set([\n ...(metadata.observedAttributes ?? []), \n ...attrChangeMap.keys(), \n ...attributeApplyNames,\n ...attributeListNames, \n ...emitHostCustomEventList.map(it => (it.options as any).attributeName).filter(Boolean), \n ...swcLifecycleAttributes, \n ...swcOnEvents\n ])];\n\n const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];\n\n const proto = constructor.prototype;\n setupPrototype(proto);\n\n const originalConnected = proto.connectedCallback;\n proto.connectedCallback = function () {\n ensureInit(this);\n\n if (connectedInnerHtmlList.some(it => it.options.useShadow === true) && !this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n }\n\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n const hostSet = SwcUtils.getHostSet(this as any);\n\n (this as any)._executeSwcScript('swc-on-before-connected', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);\n if (bMethods) {\n for (const m of bMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n\n // Initialize @attribute fields\n attributeList.forEach(meta => {\n if (meta.options.connectedInitialize === true) {\n (this as any).__swc_syncing_init = true;\n try {\n const memoryVal = (this as any)[meta.privateKey];\n if (memoryVal !== undefined) {\n (this as any)[meta.propertyKey] = memoryVal;\n }\n } finally {\n (this as any).__swc_syncing_init = false;\n }\n }\n });\n\n if (connectedInnerHtmlList.length > 0) {\n let sContent = '',\n lContent = '';\n for (const meta of connectedInnerHtmlList) {\n const res = (this as any)[meta.propertyKey]();\n if (res !== undefined) {\n if (meta.options.useShadow) sContent += res;\n else lContent += res;\n }\n }\n if (this.shadowRoot) this.shadowRoot.innerHTML = sContent;\n if (lContent) this.innerHTML = lContent;\n }\n\n const root = this.getRootNode();\n if (!globalDelegatedRoots.has(root)) {\n DOM_EVENT_NAMES.forEach(type => {\n root.addEventListener(type, handleGlobalSwcEvent);\n });\n globalDelegatedRoots.add(root);\n }\n\n // Separate delegate and non-delegate listeners\n const delegateListeners: typeof addEventListenerList = [];\n const nonDelegateListeners: typeof addEventListenerList = [];\n \n addEventListenerList.forEach(meta => {\n if (meta.options.delegate && meta.selector !== ':window' && meta.selector !== ':document' && meta.selector !== ':parentHost' && meta.selector !== ':appHost' && meta.selector !== ':firstHost' && meta.selector !== ':lastHost' && meta.selector !== ':firstAppHost' && meta.selector !== ':lastAppHost' && meta.selector !== ':hosts' && meta.selector !== ':appHosts' && meta.selector !== ':host' && meta.selector !== '') {\n delegateListeners.push(meta);\n } else {\n nonDelegateListeners.push(meta);\n }\n });\n\n const delegatesByTypeAndRoot = new Map<string, any[]>();\n delegateListeners.forEach(meta => {\n const r = meta.options.root || 'auto';\n const rootKey = `${meta.type}:${r}`;\n if (!delegatesByTypeAndRoot.has(rootKey)) {\n delegatesByTypeAndRoot.set(rootKey, []);\n }\n delegatesByTypeAndRoot.get(rootKey)!.push(meta);\n });\n\n delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {\n const [type, rStr] = typeRootKey.split(':');\n const r = rStr === 'auto' ? 'auto' : rStr;\n const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };\n \n const bindRoots: (HTMLElement | ShadowRoot)[] = [];\n if (r === 'auto') bindRoots.push(this.shadowRoot || (this as any));\n else if (r === 'light') bindRoots.push(this as any);\n else if (r === 'shadow' && this.shadowRoot) bindRoots.push(this.shadowRoot);\n else if (r === 'all') {\n bindRoots.push(this as any);\n if (this.shadowRoot) bindRoots.push(this.shadowRoot);\n }\n\n bindRoots.forEach(br => {\n const sortedMetaList = [...metaList].sort((a, b) => {\n const aStop = a.options.stopPropagation ? 1 : 0;\n const bStop = b.options.stopPropagation ? 1 : 0;\n return bStop - aStop;\n });\n \n const unifiedHandler = async (event: Event) => {\n for (const meta of sortedMetaList) {\n const { selector, options } = meta;\n const matchedEl = (event.target as HTMLElement).closest(selector);\n if (matchedEl && (br as any).contains(matchedEl)) {\n if (options.stopPropagation) event.stopPropagation();\n if (options.stopImmediatePropagation) event.stopImmediatePropagation();\n if (options.preventDefault) event.preventDefault();\n const currentHostSet = SwcUtils.getHostSet(this as any);\n const args = { event, ...currentHostSet, $el: matchedEl, $root: br };\n await (this as any)[meta.propertyKey](event, currentHostSet, matchedEl, args);\n if ((event as any).cancelBubble) break;\n }\n }\n };\n br.addEventListener(type, unifiedHandler, opts);\n (this as any)._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });\n });\n });\n\n nonDelegateListeners.forEach(meta => {\n const { selector, type, options } = meta;\n const opts = { capture: options.capture, once: options.once, passive: options.passive };\n const bindTargets: EventTarget[] = [];\n const r = options.root || 'auto';\n const applyRootOption = (target: any) => {\n if (!target) return;\n if (r === 'auto') {\n bindTargets.push(target.shadowRoot || target);\n } else {\n if (r === 'light' || r === 'all') bindTargets.push(target);\n if ((r === 'shadow' || r === 'all') && target.shadowRoot) bindTargets.push(target.shadowRoot);\n }\n };\n\n if (selector === ':window') bindTargets.push(currentWin);\n else if (selector === ':document') bindTargets.push(currentWin.document);\n else if (selector === ':parentHost') applyRootOption(hostSet.$parentHost);\n else if (selector === ':appHost') applyRootOption(hostSet.$appHost);\n else if (selector === ':firstHost') applyRootOption(hostSet.$firstHost);\n else if (selector === ':lastHost') applyRootOption(hostSet.$lastHost);\n else if (selector === ':firstAppHost') applyRootOption(hostSet.$firstAppHost);\n else if (selector === ':lastAppHost') applyRootOption(hostSet.$lastAppHost);\n else if (selector === ':hosts') hostSet.$hosts.forEach(applyRootOption);\n else if (selector === ':appHosts') hostSet.$appHosts.forEach(applyRootOption);\n else if (selector === ':host' || !selector) applyRootOption(this);\n else {\n const searchRoots: (HTMLElement | ShadowRoot)[] = [];\n if (r === 'auto') searchRoots.push(this.shadowRoot || (this as any));\n else if (r === 'light') searchRoots.push(this as any);\n else if (r === 'shadow' && this.shadowRoot) searchRoots.push(this.shadowRoot);\n else if (r === 'all') {\n searchRoots.push(this as any);\n if (this.shadowRoot) searchRoots.push(this.shadowRoot);\n }\n\n searchRoots.forEach(sr => {\n sr.querySelectorAll(selector).forEach(el => bindTargets.push(el));\n });\n }\n\n bindTargets.forEach(t => {\n const handler = async (event: Event) => {\n if (options.stopPropagation) event.stopPropagation();\n if (options.stopImmediatePropagation) event.stopImmediatePropagation();\n if (options.preventDefault) event.preventDefault();\n const currentHostSet = SwcUtils.getHostSet(this as any);\n const args = { event, ...currentHostSet, $el: t, $root: t };\n await (this as any)[meta.propertyKey](event, currentHostSet, args);\n };\n t.addEventListener(type, handler, opts);\n if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {\n (this as any)._boundListeners.push({ target: t, type, handler, options: opts });\n }\n });\n });\n\n if (originalConnected) originalConnected.apply(this);\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);\n if (aMethods) {\n for (const m of aMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n (this as any)._executeSwcScript('swc-on-connected', hostSet);\n (this as any)._executeSwcScript('swc-on-after-connected', hostSet);\n (this as any).__swc_connected = true;\n };\n\n const originalDisconnected = proto.disconnectedCallback;\n proto.disconnectedCallback = function () {\n const hostSet = SwcUtils.getHostSet(this as any);\n (this as any)._executeSwcScript('swc-on-before-disconnected', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);\n if (bMethods) {\n for (const m of bMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n\n if ((this as any)._boundListeners) {\n (this as any)._boundListeners.forEach((l: any) => l.target.removeEventListener(l.type, l.handler, l.options));\n (this as any)._boundListeners = [];\n }\n\n if (originalDisconnected) originalDisconnected.apply(this);\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);\n if (aMethods) {\n for (const m of aMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n (this as any)._executeSwcScript('swc-on-disconnected', hostSet);\n (this as any)._executeSwcScript('swc-on-after-disconnected', hostSet);\n (this as any).__swc_connected = false;\n };\n\n const originalAdopted = proto.adoptedCallback;\n proto.adoptedCallback = function () {\n const hostSet = SwcUtils.getHostSet(this as any);\n (this as any)._executeSwcScript('swc-on-before-adopted', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_ADOPTED_METADATA_KEY);\n if (bMethods) {\n for (const m of bMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n\n if (originalAdopted) originalAdopted.apply(this);\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);\n if (aMethods) {\n for (const m of aMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n (this as any)._executeSwcScript('swc-on-adopted', hostSet);\n (this as any)._executeSwcScript('swc-on-after-adopted', hostSet);\n };\n\n const originalAttributeChanged = proto.attributeChangedCallback;\n proto.attributeChangedCallback = function (name: string, old: string | null, newVal: string | null) {\n if (originalAttributeChanged) originalAttributeChanged.apply(this, [name, old, newVal]);\n\n const hSet = SwcUtils.getHostSet(this as any);\n\n if (name.startsWith('swc-on-') && !swcLifecycleAttributes.includes(name)) {\n if (newVal !== null) {\n const eventName = name.substring(7);\n (this as any)._bindAttributeEvent(this as any, name, newVal, eventName);\n }\n }\n\n const hostCustomEventMeta = emitHostCustomEventList.find(it => (it.options as any).attributeName === name);\n if (hostCustomEventMeta && newVal !== null) {\n (this as any)._bindAttributeEvent(this as any, name, newVal, hostCustomEventMeta.type);\n }\n\n const mKeys = attrChangeMap.get(name);\n if (mKeys && Array.isArray(mKeys)) {\n for (const key of mKeys) (this as any)[key](newVal, old, name, hSet);\n }\n };\n\n Object.defineProperty(constructor, 'observedAttributes', {\n get: () => mergedObservedAttributes,\n configurable: true\n });\n\n ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, metadata, constructor);\n const registry = metadata.customElementRegistry || (win as any)?.customElements;\n if (registry && !registry.get(metadata.name)) {\n registry.define(metadata.name, constructor as any, metadata.extends ? { extends: metadata.extends } : undefined);\n }\n return constructor;\n };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAC7B,IAAAA,eAA8B;AAC9B,8BAA4C;AAC5C,wBAAkT;AAClT,6BAA+C;AAC/C,kCAAgD;AAChD,4BAA8C;AAC9C,uBAAyC;AACzC,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KAAK,MAAM;AAAA,IACX,cAAc;AAAA,EAChB,CAAC;AAED,2BAAa,eAAe,oBAAoB,UAAU,WAAW;AACrE,QAAM,WAAW,SAAS,yBAA0B,KAAa;AACjE,MAAI,YAAY,CAAC,SAAS,IAAI,SAAS,IAAI,GAAG;AAC5C,aAAS,OAAO,SAAS,MAAM,aAAoB,SAAS,UAAU,EAAE,SAAS,SAAS,QAAQ,IAAI,MAAS;AAAA,EACjH;AACA,SAAO;AACT;",
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { FunctionUtils } from '@dooboostore/core';\nimport { getAddEventListenerMetadata } from './addEventListener';\nimport { ON_INITIALIZE_METADATA_KEY, ON_BEFORE_CONNECTED_METADATA_KEY, ON_AFTER_CONNECTED_METADATA_KEY, ON_BEFORE_DISCONNECTED_METADATA_KEY, ON_AFTER_DISCONNECTED_METADATA_KEY, ON_BEFORE_ADOPTED_METADATA_KEY, ON_AFTER_ADOPTED_METADATA_KEY, findAllLifecycleMetadata, getOnConnectedInnerHtmlMetadata } from './lifecycles';\nimport { getEmitCustomEventMetadataList } from './emitCustomEvent';\nimport { findAllAttributeChangedMetadata } from './changedAttributeHost';\nimport { findAllAttributeApplyMetadata } from './applyAttribute';\nimport { findAllAttributeMetadata } from './attribute';\nimport { getQueryMetadata } from './query';\nimport { getQueryAllMetadata } from './queryAll';\nimport { SwcUtils } from '../utils/Utils';\nimport { HTML_TAG_ENTRIES, DOM_EVENT_NAMES } from '../config/config';\nimport { SituationTypeContainer, SituationTypeContainers } from '@dooboostore/simple-boot/decorators/inject/Inject';\nimport { InjectSituationType, HostSet } from '../types';\n\n// --- Core Interfaces & Types ---\n\nexport const ELEMENT_CONFIG_KEY = Symbol.for('simple-web-component:element-config');\n\nexport interface ElementConfig {\n extends?: string;\n observedAttributes?: string[];\n customElementRegistry?: any;\n window?: Window;\n}\n\nexport interface ElementMetadata extends Omit<ElementConfig, 'window'> {\n name: string;\n window: Window;\n}\n\nexport const getElementConfig = (target: any): ElementMetadata | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);\n};\n\nexport const ensureInit = (inst: any) => {\n if (!inst.__swc_initialized) {\n inst._swcId = Math.random().toString(36).substring(2, 11);\n inst._emitHandlers = new Map();\n inst._boundListeners = [];\n inst.__swc_initialized = true;\n\n // const attributeList = findAllQ(inst);\n // attributeList.forEach(meta => {\n // delete (inst as any)[meta.propertyKey];\n // });\n\n const target = inst instanceof Function ? inst : inst.constructor;\n \n // \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n // \u2551 decorator \uD544\uB4DC\uC758 own property \uC0AD\uC81C \u2551\n // \u2551 \u2551\n // \u2551 \uC774\uC720: \u2551\n // \u2551 1. TypeScript\uB294 \uCD08\uAE30\uAC12\uC774 \uC788\uB294 \uD544\uB4DC\uB97C constructor\uC5D0\uC11C own property\uB85C \uC0DD\uC131 \u2551\n // \u2551 @attributeHost('id') myId: string = \"default\" \u2192 this.myId = \"default\" \u2551\n // \u2551 \u2551\n // \u2551 2. JavaScript\uC758 property lookup\uC740 own property\uB97C \uBA3C\uC800 \uCC3E\uC74C \u2551\n // \u2551 - this.myId \uC811\uADFC \u2551\n // \u2551 - 1\uC21C\uC704: instance\uC758 own property \uC788\uB098? \u2192 \uC788\uC73C\uBA74 \uADF8\uAC83 \uBC18\uD658 \u2551\n // \u2551 - 2\uC21C\uC704: prototype\uC758 getter \uC788\uB098? \u2192 \uC788\uC73C\uBA74 \uD638\uCD9C \u2551\n // \u2551 \u2551\n // \u2551 3. own property\uAC00 \uC788\uC73C\uBA74 prototype\uC758 getter\uB294 \uC808\uB300 \uD638\uCD9C\uB418\uC9C0 \uC54A\uC74C \u2551\n // \u2551 \uB530\uB77C\uC11C getter\uC5D0\uC11C \uC815\uC758\uB41C DOM \uB3D9\uAE30\uD654 \uB85C\uC9C1\uC774 \uC791\uB3D9\uD558\uC9C0 \uC54A\uC74C \u2551\n // \u2551 \u2551\n // \u2551 4. own property\uB97C \uC0AD\uC81C\uD558\uBA74 JavaScript\uAC00 prototype\uC758 getter\uB97C \uCC3E\uAC8C \uB428 \u2551\n // \u2551 \u2192 getter \uD638\uCD9C\uB428 \u2192 DOM \uC18D\uC131 \uAC12 \uB3D9\uAE30\uD654\uB428 \u2551\n // \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n \n // @attribute \uD544\uB4DC\uC758 own property \uC0AD\uC81C \u2192 getter/setter \uC791\uB3D9\n const attributeList = findAllAttributeMetadata(target);\n attributeList.forEach(meta => {\n delete (inst as any)[meta.propertyKey];\n });\n \n // @query \uD544\uB4DC\uC758 own property \uC0AD\uC81C \u2192 getter \uC791\uB3D9\n const queryList = getQueryMetadata(target);\n if (queryList) {\n queryList.forEach(meta => {\n delete (inst as any)[meta.propertyKey];\n });\n }\n \n // @queryAll \uD544\uB4DC\uC758 own property \uC0AD\uC81C \u2192 getter \uC791\uB3D9\n const queryAllList = getQueryAllMetadata(target);\n if (queryAllList) {\n queryAllList.forEach(meta => {\n delete (inst as any)[meta.propertyKey];\n });\n }\n\n // Call constructor script if present\n const hostSet = SwcUtils.getHostSet(inst);\n inst._executeSwcScript?.('swc-on-constructor', hostSet);\n\n // Call @onInitialize lifecycle methods\n const cMethods = findAllLifecycleMetadata(inst, ON_INITIALIZE_METADATA_KEY);\n if (cMethods) {\n for (const m of cMethods) (inst)._invokeLifecycleMethod(m, hostSet);\n }\n }\n};\n\n// --- Global Event Handling ---\nconst globalDelegatedRoots = new WeakSet<Node>();\n\nconst handleGlobalSwcEvent = async (event: Event) => {\n if ((event as any).__swc_handled) return;\n const path = event.composedPath();\n const type = event.type;\n const attrName = `swc-on-${type}`;\n\n for (const node of path) {\n if (!(node instanceof HTMLElement)) continue;\n const script = node.getAttribute?.(attrName);\n if (script && !getElementConfig(node)) {\n const host: any = SwcUtils.findNearestSwcHost(node);\n if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === 'function') {\n await host.__swc_executeAttributeEvent(node, attrName, script, event);\n (event as any).__swc_handled = true;\n break;\n }\n }\n }\n};\n\nfunction buildEnv(configWindow?: Window) {\n const win: Window = configWindow || ((typeof window !== 'undefined' ? window : undefined) as any);\n const doc: Document = win?.document;\n const builtInTagMap = new Map<any, string>();\n for (const [cls, tag] of HTML_TAG_ENTRIES) {\n if ((win as any)?.[cls]) builtInTagMap.set((win as any)[cls], tag);\n }\n const domHelpers = SwcUtils.getHelperSet(win);\n \n return { win, doc, builtInTagMap, domHelpers };\n}\n\nconst getHandlers = (inst: any) => {\n if (!inst.__swc_attributeEventHandlers) inst.__swc_attributeEventHandlers = new Map();\n return inst.__swc_attributeEventHandlers;\n};\n\nconst setupPrototype = (proto: any) => {\n if (proto.__swc_proto_setup) return;\n proto.__swc_proto_setup = true;\n\n proto._executeSwcScript = function (attrName: string, hostSet: HostSet, extraArgs: Record<string, any> = {}) {\n ensureInit(this);\n const script = this.getAttribute(attrName);\n if (script) {\n try {\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n const helpers = SwcUtils.getHelperSet(currentWin);\n const args = { ...hostSet, ...helpers, ...extraArgs, $el: this, $root: this.getRootNode() };\n FunctionUtils.execute({ script, context: this, args });\n } catch (e) {\n console.error(`[SWC] Failed to execute ${attrName}:`, e);\n }\n }\n };\n\n proto._resolveWindow = function (localConfig?: ElementConfig): Window {\n ensureInit(this);\n if (localConfig?.window) return localConfig.window;\n const ancestors = SwcUtils.findAllSwcHosts(this as any);\n for (let i = ancestors.length - 1; i >= 0; i--) {\n const aConf = getElementConfig(ancestors[i]);\n if (aConf?.window) return aConf.window;\n }\n return (typeof window !== 'undefined' ? window : undefined) as Window;\n };\n\n proto._invokeLifecycleMethod = function (methodName: string | symbol, hostSet: HostSet, extraArgs: any[] = []) {\n ensureInit(this);\n if (typeof (this as any)[methodName] !== 'function') return;\n const app = hostSet.$appHost?.simpleApplication;\n\n if (app) {\n const otherStorage = new Map<any, any>();\n const situations = new SituationTypeContainers([new SituationTypeContainer({ situationType: InjectSituationType.HOST_SET, data: hostSet }), new SituationTypeContainer({ situationType: InjectSituationType.APP_HOST, data: hostSet.$appHost }), new SituationTypeContainer({ situationType: InjectSituationType.APP_HOSTS, data: hostSet.$appHosts }), new SituationTypeContainer({ situationType: InjectSituationType.HOST, data: hostSet.$host }), new SituationTypeContainer({ situationType: InjectSituationType.HOSTS, data: hostSet.$hosts }), new SituationTypeContainer({ situationType: InjectSituationType.FIRST_HOST, data: hostSet.$firstHost }), new SituationTypeContainer({ situationType: InjectSituationType.LAST_HOST, data: hostSet.$lastHost }), new SituationTypeContainer({ situationType: InjectSituationType.FIRST_APP_HOST, data: hostSet.$firstAppHost }), new SituationTypeContainer({ situationType: InjectSituationType.LAST_APP_HOST, data: hostSet.$lastAppHost })]);\n otherStorage.set(SituationTypeContainers, situations);\n\n return app.simstanceManager.executeBindParameterSimPromise(\n {\n target: this,\n targetKey: methodName,\n inputParameters: extraArgs\n },\n otherStorage\n );\n } else {\n return (this as any)[methodName](...extraArgs);\n }\n };\n\n proto._bindAttributeEvent = function (el: HTMLElement, attrName: string, script: string, eventName?: string) {\n ensureInit(this);\n if (!eventName) {\n if (!attrName.startsWith('swc-on-')) return;\n eventName = attrName.substring(7);\n }\n const elHandlers = getHandlers(this);\n let handlers = elHandlers.get(el);\n if (!handlers) {\n handlers = new Map();\n elHandlers.set(el, handlers);\n }\n\n const oldHandler = handlers.get(attrName);\n if (oldHandler) el.removeEventListener(eventName, oldHandler);\n\n const handler = async (event: any) => {\n const parent = SwcUtils.findNearestSwcHost(el);\n const hostSet = SwcUtils.getHostSet(parent || el);\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n const helpers = SwcUtils.getHelperSet(currentWin);\n const args = {\n event,\n $data: (event as CustomEvent).detail,\n ...hostSet,\n ...helpers,\n $el: el,\n $root: this.getRootNode()\n };\n await FunctionUtils.execute({ script, context: el, args });\n };\n\n el.addEventListener(eventName, handler);\n handlers.set(attrName, handler);\n };\n\n proto.__swc_executeAttributeEvent = async function (el: HTMLElement, attrName: string, script: string, event: Event) {\n ensureInit(this);\n\n const parent = SwcUtils.findNearestSwcHost(el);\n const hostSet = SwcUtils.getHostSet(parent || el);\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n const currentHelpers = SwcUtils.getHelperSet(currentWin);\n const detail = (event as CustomEvent).detail;\n const args = {\n event,\n $event: event,\n $data: detail,\n $detail: detail,\n ...hostSet,\n ...currentHelpers,\n $el: el,\n $root: this.getRootNode()\n };\n await FunctionUtils.execute({ script, context: el, args });\n };\n};\n\nexport const elementDefine =\n (name: string, config: Partial<ElementConfig> = {}): ClassDecorator =>\n (constructor: any) => {\n const { win, doc, builtInTagMap: BUILT_IN_TAG_MAP, domHelpers: SWC_DOM_HELPERS } = buildEnv(config.window);\n const metadata: ElementMetadata = { ...config, name, window: win };\n\n if (!metadata.window) {\n throw new Error('window is required');\n }\n\n let extendsTagName = metadata.extends;\n if (!extendsTagName) {\n let proto = constructor;\n const BaseHTMLElement = (win as any).HTMLElement;\n while (proto && proto !== BaseHTMLElement && proto !== Function.prototype) {\n extendsTagName = BUILT_IN_TAG_MAP.get(proto);\n if (extendsTagName) break;\n proto = Object.getPrototypeOf(proto);\n }\n metadata.extends = extendsTagName;\n }\n\n const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];\n const emitHostCustomEventList = emitCustomEventList.filter(meta => meta.selector === ':host' || meta.selector === '');\n const addEventListenerList = getAddEventListenerMetadata(constructor) || [];\n const attrChangeMap = findAllAttributeChangedMetadata(constructor);\n const attributeList = findAllAttributeMetadata(constructor);\n const applyAttributeMap = findAllAttributeApplyMetadata(constructor);\n\n const swcLifecycleAttributes = ['swc-on-constructor', 'swc-on-connected', 'swc-on-disconnected', 'swc-on-before-connected', 'swc-on-after-connected', 'swc-on-before-disconnected', 'swc-on-after-disconnected', 'swc-on-before-adopted', 'swc-on-after-adopted', 'swc-on-attribute-changed'];\n const swcOnEvents = DOM_EVENT_NAMES.map(e => `swc-on-${e}`);\n\n // Collect all observed attributes from all decorators\n const attributeApplyNames = Array.from(applyAttributeMap.values()).map(it => it.options.name).filter(Boolean) as string[];\n // const attributeListNames = attributeList.map(it => it.options.name || String(it.propertyKey));\n const hostAttributes = attributeList.filter(it => it.selector === ':host').map(it=>it.options.name || String(it.propertyKey));\n\n const mergedObservedAttributes = [...new Set([\n ...(metadata.observedAttributes ?? []),\n ...attrChangeMap.keys(),\n ...attributeApplyNames,\n ...hostAttributes,\n ...emitHostCustomEventList.map(it => (it.options as any).attributeName).filter(Boolean),\n ...swcLifecycleAttributes,\n ...swcOnEvents\n ])];\n\n const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];\n\n const proto = constructor.prototype;\n setupPrototype(proto);\n\n const originalConnected = proto.connectedCallback;\n proto.connectedCallback = function () {\n ensureInit(this);\n\n const hostSet = SwcUtils.getHostSet(this as any);\n const appHost = hostSet.$appHost;\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n\n if (connectedInnerHtmlList.some(it => it.options.useShadow === true) && !this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n }\n\n (this as any)._executeSwcScript('swc-on-before-connected', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);\n if (bMethods) {\n for (const m of bMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n\n if (connectedInnerHtmlList.length > 0) {\n let sContent = '',\n lContent = '';\n for (const meta of connectedInnerHtmlList) {\n const res = (this as any)[meta.propertyKey]();\n if (res !== undefined) {\n if (meta.options.useShadow) sContent += res;\n else lContent += res;\n }\n }\n if (this.shadowRoot) this.shadowRoot.innerHTML = sContent;\n if (lContent) this.innerHTML = lContent;\n }\n\n const root = this.getRootNode();\n if (!globalDelegatedRoots.has(root)) {\n DOM_EVENT_NAMES.forEach(type => {\n root.addEventListener(type, handleGlobalSwcEvent);\n });\n globalDelegatedRoots.add(root);\n }\n\n // Separate delegate and non-delegate listeners\n const delegateListeners: typeof addEventListenerList = [];\n const nonDelegateListeners: typeof addEventListenerList = [];\n \n addEventListenerList.forEach(meta => {\n if (meta.options.delegate && meta.selector !== ':window' && meta.selector !== ':document' && meta.selector !== ':parentHost' && meta.selector !== ':appHost' && meta.selector !== ':firstHost' && meta.selector !== ':lastHost' && meta.selector !== ':firstAppHost' && meta.selector !== ':lastAppHost' && meta.selector !== ':hosts' && meta.selector !== ':appHosts' && meta.selector !== ':host' && meta.selector !== '') {\n delegateListeners.push(meta);\n } else {\n nonDelegateListeners.push(meta);\n }\n });\n\n const delegatesByTypeAndRoot = new Map<string, any[]>();\n delegateListeners.forEach(meta => {\n const r = meta.options.root || 'auto';\n const rootKey = `${meta.type}:${r}`;\n if (!delegatesByTypeAndRoot.has(rootKey)) {\n delegatesByTypeAndRoot.set(rootKey, []);\n }\n delegatesByTypeAndRoot.get(rootKey)!.push(meta);\n });\n\n delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {\n const [type, rStr] = typeRootKey.split(':');\n const r = rStr === 'auto' ? 'auto' : rStr;\n const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };\n \n const bindRoots: (HTMLElement | ShadowRoot)[] = [];\n if (r === 'auto') bindRoots.push(this.shadowRoot || (this as any));\n else if (r === 'light') bindRoots.push(this as any);\n else if (r === 'shadow' && this.shadowRoot) bindRoots.push(this.shadowRoot);\n else if (r === 'all') {\n bindRoots.push(this as any);\n if (this.shadowRoot) bindRoots.push(this.shadowRoot);\n }\n\n bindRoots.forEach(br => {\n const sortedMetaList = [...metaList].sort((a, b) => {\n const aStop = a.options.stopPropagation ? 1 : 0;\n const bStop = b.options.stopPropagation ? 1 : 0;\n return bStop - aStop;\n });\n \n const unifiedHandler = async (event: Event) => {\n for (const meta of sortedMetaList) {\n const { selector, options } = meta;\n const matchedEl = (event.target as HTMLElement).closest(selector);\n if (matchedEl && (br as any).contains(matchedEl)) {\n if (options.stopPropagation) event.stopPropagation();\n if (options.stopImmediatePropagation) event.stopImmediatePropagation();\n if (options.preventDefault) event.preventDefault();\n const currentHostSet = SwcUtils.getHostSet(this as any);\n const args = { event, ...currentHostSet, $el: matchedEl, $root: br };\n await (this as any)[meta.propertyKey](event, currentHostSet, matchedEl, args);\n if ((event as any).cancelBubble) break;\n }\n }\n };\n br.addEventListener(type, unifiedHandler, opts);\n (this as any)._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });\n });\n });\n\n nonDelegateListeners.forEach(meta => {\n const { selector, type, options } = meta;\n const opts = { capture: options.capture, once: options.once, passive: options.passive };\n const bindTargets: EventTarget[] = [];\n const r = options.root || 'auto';\n const applyRootOption = (target: any) => {\n if (!target) return;\n if (r === 'auto') {\n bindTargets.push(target.shadowRoot || target);\n } else {\n if (r === 'light' || r === 'all') bindTargets.push(target);\n if ((r === 'shadow' || r === 'all') && target.shadowRoot) bindTargets.push(target.shadowRoot);\n }\n };\n\n if (selector === ':window') bindTargets.push(currentWin);\n else if (selector === ':document') bindTargets.push(currentWin.document);\n else if (selector === ':parentHost') applyRootOption(hostSet.$parentHost);\n else if (selector === ':appHost') applyRootOption(hostSet.$appHost);\n else if (selector === ':firstHost') applyRootOption(hostSet.$firstHost);\n else if (selector === ':lastHost') applyRootOption(hostSet.$lastHost);\n else if (selector === ':firstAppHost') applyRootOption(hostSet.$firstAppHost);\n else if (selector === ':lastAppHost') applyRootOption(hostSet.$lastAppHost);\n else if (selector === ':hosts') hostSet.$hosts.forEach(applyRootOption);\n else if (selector === ':appHosts') hostSet.$appHosts.forEach(applyRootOption);\n else if (selector === ':host' || !selector) applyRootOption(this);\n else {\n const searchRoots: (HTMLElement | ShadowRoot)[] = [];\n if (r === 'auto') searchRoots.push(this.shadowRoot || (this as any));\n else if (r === 'light') searchRoots.push(this as any);\n else if (r === 'shadow' && this.shadowRoot) searchRoots.push(this.shadowRoot);\n else if (r === 'all') {\n searchRoots.push(this as any);\n if (this.shadowRoot) searchRoots.push(this.shadowRoot);\n }\n\n searchRoots.forEach(sr => {\n sr.querySelectorAll(selector).forEach(el => bindTargets.push(el));\n });\n }\n\n bindTargets.forEach(t => {\n const handler = async (event: Event) => {\n if (options.stopPropagation) event.stopPropagation();\n if (options.stopImmediatePropagation) event.stopImmediatePropagation();\n if (options.preventDefault) event.preventDefault();\n const currentHostSet = SwcUtils.getHostSet(this as any);\n const args = { event, ...currentHostSet, $el: t, $root: t };\n await (this as any)[meta.propertyKey](event, currentHostSet, args);\n };\n t.addEventListener(type, handler, opts);\n if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {\n (this as any)._boundListeners.push({ target: t, type, handler, options: opts });\n }\n });\n });\n\n if (originalConnected) originalConnected.apply(this);\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);\n if (aMethods) {\n for (const m of aMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n (this as any)._executeSwcScript('swc-on-connected', hostSet);\n (this as any)._executeSwcScript('swc-on-after-connected', hostSet);\n (this as any).__swc_connected = true;\n\n // Register to appHost LAST when all lifecycle completed\n if (appHost && typeof (appHost as any)._connected === 'function') {\n (appHost as any)._connected(this);\n }\n };\n\n const originalDisconnected = proto.disconnectedCallback;\n proto.disconnectedCallback = function () {\n const hostSet = SwcUtils.getHostSet(this as any);\n (this as any)._executeSwcScript('swc-on-before-disconnected', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);\n if (bMethods) {\n for (const m of bMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n\n if ((this as any)._boundListeners) {\n (this as any)._boundListeners.forEach((l: any) => l.target.removeEventListener(l.type, l.handler, l.options));\n (this as any)._boundListeners = [];\n }\n\n if (originalDisconnected) originalDisconnected.apply(this);\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);\n if (aMethods) {\n for (const m of aMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n (this as any)._executeSwcScript('swc-on-disconnected', hostSet);\n (this as any)._executeSwcScript('swc-on-after-disconnected', hostSet);\n (this as any).__swc_connected = false;\n \n // Remove from appHost LAST when disconnected\n const appHost = hostSet.$appHost;\n if (appHost && typeof (appHost as any)._disconnected === 'function') {\n (appHost as any)._disconnected(this);\n }\n };\n\n const originalAdopted = proto.adoptedCallback;\n proto.adoptedCallback = function () {\n const hostSet = SwcUtils.getHostSet(this as any);\n (this as any)._executeSwcScript('swc-on-before-adopted', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_ADOPTED_METADATA_KEY);\n if (bMethods) {\n for (const m of bMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n\n if (originalAdopted) originalAdopted.apply(this);\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);\n if (aMethods) {\n for (const m of aMethods) (this as any)._invokeLifecycleMethod(m, hostSet);\n }\n (this as any)._executeSwcScript('swc-on-adopted', hostSet);\n (this as any)._executeSwcScript('swc-on-after-adopted', hostSet);\n };\n\n const originalAttributeChanged = proto.attributeChangedCallback;\n proto.attributeChangedCallback = function (name: string, old: string | null, newVal: string | null) {\n if (originalAttributeChanged) originalAttributeChanged.apply(this, [name, old, newVal]);\n\n const hSet = SwcUtils.getHostSet(this as any);\n\n if (name.startsWith('swc-on-') && !swcLifecycleAttributes.includes(name)) {\n if (newVal !== null) {\n const eventName = name.substring(7);\n (this as any)._bindAttributeEvent(this as any, name, newVal, eventName);\n }\n }\n\n const hostCustomEventMeta = emitHostCustomEventList.find(it => (it.options as any).attributeName === name);\n if (hostCustomEventMeta && newVal !== null) {\n (this as any)._bindAttributeEvent(this as any, name, newVal, hostCustomEventMeta.type);\n }\n\n const mKeys = attrChangeMap.get(name);\n if (mKeys && Array.isArray(mKeys)) {\n for (const key of mKeys) (this as any)[key](newVal, old, name, hSet);\n }\n };\n\n Object.defineProperty(constructor, 'observedAttributes', {\n get: () => mergedObservedAttributes,\n configurable: true\n });\n\n ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, metadata, constructor);\n const registry = metadata.customElementRegistry || (win as any)?.customElements;\n if (registry && !registry.get(metadata.name)) {\n registry.define(metadata.name, constructor as any, metadata.extends ? { extends: metadata.extends } : undefined);\n }\n return constructor;\n };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAC7B,IAAAA,eAA8B;AAC9B,8BAA4C;AAC5C,wBAAiT;AACjT,6BAA+C;AAC/C,kCAAgD;AAChD,4BAA8C;AAC9C,uBAAyC;AACzC,mBAAiC;AACjC,sBAAoC;AACpC,mBAAyB;AACzB,oBAAkD;AAClD,oBAAg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AAK,QAAO,GAAG,QAAgB,kBAAkBA,KAAI;AACzG,QAAI,uBAAuB,WAAW,MAAM;AAC1C,MAAC,KAAa,oBAAoB,MAAaA,OAAM,QAAQ,oBAAoB,IAAI;AAAA,IACvF;AAEA,UAAM,QAAQ,cAAc,IAAIA,KAAI;AACpC,QAAI,SAAS,MAAM,QAAQ,KAAK,GAAG;AACjC,iBAAW,OAAO,MAAO,CAAC,KAAa,GAAG,EAAE,QAAQ,KAAKA,OAAM,IAAI;AAAA,IACrE;AAAA,EACF;AAEA,SAAO,eAAe,aAAa,sBAAsB;AAAA,IACvD,KAAK,MAAM;AAAA,IACX,cAAc;AAAA,EAChB,CAAC;AAED,2BAAa,eAAe,oBAAoB,UAAU,WAAW;AACrE,QAAM,WAAW,SAAS,yBAA0B,KAAa;AACjE,MAAI,YAAY,CAAC,SAAS,IAAI,SAAS,IAAI,GAAG;AAC5C,aAAS,OAAO,SAAS,MAAM,aAAoB,SAAS,UAAU,EAAE,SAAS,SAAS,QAAQ,IAAI,MAAS;AAAA,EACjH;AACA,SAAO;AACT;",
|
|
6
6
|
"names": ["import_core", "proto", "name"]
|
|
7
7
|
}
|
|
@@ -26,4 +26,5 @@ __reExport(decorators_exports, require("./queryAll"), module.exports);
|
|
|
26
26
|
__reExport(decorators_exports, require("./applyClass"), module.exports);
|
|
27
27
|
__reExport(decorators_exports, require("./applyStyle"), module.exports);
|
|
28
28
|
__reExport(decorators_exports, require("./applyAttribute"), module.exports);
|
|
29
|
+
__reExport(decorators_exports, require("./subscribeSwcAppRouteChange"), module.exports);
|
|
29
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './addEventListener';\nexport * from './attribute';\nexport * from './elementDefine';\nexport * from './changedAttributeHost';\nexport * from './emitCustomEvent';\nexport * from './applyNode';\nexport * from './lifecycles';\nexport * from './query';\nexport * from './queryAll';\nexport * from './applyClass';\nexport * from './applyStyle';\nexport * from './applyAttribute';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,+BAAd;AACA,+BAAc,wBADd;AAEA,+BAAc,4BAFd;AAGA,+BAAc,mCAHd;AAIA,+BAAc,8BAJd;AAKA,+BAAc,wBALd;AAMA,+BAAc,yBANd;AAOA,+BAAc,oBAPd;AAQA,+BAAc,uBARd;AASA,+BAAc,yBATd;AAUA,+BAAc,yBAVd;AAWA,+BAAc,6BAXd;",
|
|
4
|
+
"sourcesContent": ["export * from './addEventListener';\nexport * from './attribute';\nexport * from './elementDefine';\nexport * from './changedAttributeHost';\nexport * from './emitCustomEvent';\nexport * from './applyNode';\nexport * from './lifecycles';\nexport * from './query';\nexport * from './queryAll';\nexport * from './applyClass';\nexport * from './applyStyle';\nexport * from './applyAttribute';\nexport * from './subscribeSwcAppRouteChange';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,+BAAd;AACA,+BAAc,wBADd;AAEA,+BAAc,4BAFd;AAGA,+BAAc,mCAHd;AAIA,+BAAc,8BAJd;AAKA,+BAAc,wBALd;AAMA,+BAAc,yBANd;AAOA,+BAAc,oBAPd;AAQA,+BAAc,uBARd;AASA,+BAAc,yBATd;AAUA,+BAAc,yBAVd;AAWA,+BAAc,6BAXd;AAYA,+BAAc,yCAZd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,7 +26,7 @@ __export(lifecycles_exports, {
|
|
|
26
26
|
ON_BEFORE_ADOPTED_METADATA_KEY: () => ON_BEFORE_ADOPTED_METADATA_KEY,
|
|
27
27
|
ON_BEFORE_CONNECTED_METADATA_KEY: () => ON_BEFORE_CONNECTED_METADATA_KEY,
|
|
28
28
|
ON_BEFORE_DISCONNECTED_METADATA_KEY: () => ON_BEFORE_DISCONNECTED_METADATA_KEY,
|
|
29
|
-
|
|
29
|
+
ON_INITIALIZE_METADATA_KEY: () => ON_INITIALIZE_METADATA_KEY,
|
|
30
30
|
findAllLifecycleMetadata: () => findAllLifecycleMetadata,
|
|
31
31
|
getOnConnectedInnerHtmlMetadata: () => getOnConnectedInnerHtmlMetadata,
|
|
32
32
|
onAddEventListener: () => onAddEventListener,
|
|
@@ -39,12 +39,12 @@ __export(lifecycles_exports, {
|
|
|
39
39
|
onBeforeDisconnected: () => onBeforeDisconnected,
|
|
40
40
|
onConnected: () => onConnected,
|
|
41
41
|
onConnectedInnerHtml: () => onConnectedInnerHtml,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
onDisconnected: () => onDisconnected,
|
|
43
|
+
onInitialize: () => onInitialize
|
|
44
44
|
});
|
|
45
45
|
module.exports = __toCommonJS(lifecycles_exports);
|
|
46
46
|
var import_core = require("@dooboostore/core");
|
|
47
|
-
const
|
|
47
|
+
const ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
48
48
|
const ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
49
49
|
const ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
|
|
50
50
|
const ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
|
|
@@ -65,7 +65,7 @@ function createLifecycleDecorator(metadataKey) {
|
|
|
65
65
|
list.push(propertyKey);
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
|
|
69
69
|
const onBeforeConnected = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
70
70
|
const onAfterConnected = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
|
|
71
71
|
const onConnected = onAfterConnected;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/lifecycles.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\nexport const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAEtB,MAAM,
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\nexport const ON_INITIALIZE_METADATA_KEY = Symbol.for('simple-web-component:on-constructor');\nexport const ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-connected');\nexport const ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-connected');\nexport const ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-disconnected');\nexport const ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-disconnected');\nexport const ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-adopted');\nexport const ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-adopted');\nexport const ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:on-add-event-listener');\nexport const INNER_HTML_METADATA_KEY = Symbol.for('simple-web-component:inner-html');\n\nexport const ATTRIBUTE_CHANGED_WILDCARD = '*';\n\nexport interface InnerHtmlOptions {\n useShadow?: boolean;\n}\n\nexport interface InnerHtmlMetadata {\n propertyKey: string | symbol;\n options: InnerHtmlOptions;\n}\n\nfunction createLifecycleDecorator(metadataKey: symbol): MethodDecorator {\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as (string | symbol)[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(metadataKey, list, constructor);\n }\n list.push(propertyKey);\n };\n}\n\nexport const onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);\nexport const onBeforeConnected = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);\nexport const onAfterConnected = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);\nexport const onConnected = onAfterConnected;\n\nexport const onBeforeDisconnected = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);\nexport const onAfterDisconnected = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);\nexport const onDisconnected = onAfterDisconnected;\n\nexport const onBeforeAdopted = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);\nexport const onAfterAdopted = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);\nexport const onAdopted = onAfterAdopted;\n\nexport const onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);\n\n/**\n * @onConnectedInnerHtml decorator to define the initial HTML content when connected.\n */\nexport function onConnectedInnerHtml(options: InnerHtmlOptions): MethodDecorator;\nexport function onConnectedInnerHtml(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedInnerHtml(arg1?: InnerHtmlOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n const decorator = (options: InnerHtmlOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<InnerHtmlMetadata[]>(INNER_HTML_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n };\n\n if (arg2) {\n return decorator({}, arg1!, arg2);\n }\n\n return (target: Object, propertyKey: string | symbol) => {\n decorator((arg1 as InnerHtmlOptions) || {}, target, propertyKey);\n };\n}\n\n/**\n * \uD504\uB85C\uD1A0\uD0C0\uC785 \uCCB4\uC778\uC744 \uC21C\uD68C\uD558\uBA70 \uBAA8\uB4E0 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uBA54\uC11C\uB4DC\uB97C \uC218\uC9D1\uD569\uB2C8\uB2E4.\n */\nexport const findAllLifecycleMetadata = <T = (string | symbol)[]>(target: any, metadataKey: symbol): T | undefined => {\n const results = ReflectUtils.findAllMetadataFlatten(metadataKey, target);\n return results.length > 0 ? (results as unknown as T) : undefined;\n};\n\nexport const getOnConnectedInnerHtmlMetadata = (target: any): InnerHtmlMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAEtB,MAAM,6BAA6B,OAAO,IAAI,qCAAqC;AACnF,MAAM,mCAAmC,OAAO,IAAI,0CAA0C;AAC9F,MAAM,kCAAkC,OAAO,IAAI,yCAAyC;AAC5F,MAAM,sCAAsC,OAAO,IAAI,6CAA6C;AACpG,MAAM,qCAAqC,OAAO,IAAI,4CAA4C;AAClG,MAAM,iCAAiC,OAAO,IAAI,wCAAwC;AAC1F,MAAM,gCAAgC,OAAO,IAAI,uCAAuC;AACxF,MAAM,qCAAqC,OAAO,IAAI,4CAA4C;AAClG,MAAM,0BAA0B,OAAO,IAAI,iCAAiC;AAE5E,MAAM,6BAA6B;AAW1C,SAAS,yBAAyB,aAAsC;AACtE,SAAO,CAAC,QAAgB,gBAAiC;AACvD,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,eAAe,aAAa,WAAW;AAC/D,QAAI,CAAC,MAAM;AACT,aAAO,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-127,10 +127,6 @@ function query(selectorOrTarget, options = {}) {
|
|
|
127
127
|
});
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
const getQueryMetadata = (target) => {
|
|
131
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
132
|
-
return import_core.ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
|
|
133
|
-
};
|
|
134
130
|
function queryHost(targetOrOptions, propertyKey) {
|
|
135
131
|
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
136
132
|
return query(":host", {})(targetOrOptions, propertyKey);
|
|
@@ -202,4 +198,8 @@ function lastAppHost(targetOrOptions, propertyKey) {
|
|
|
202
198
|
return query(":lastAppHost", {});
|
|
203
199
|
}
|
|
204
200
|
}
|
|
201
|
+
const getQueryMetadata = (target) => {
|
|
202
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
203
|
+
return import_core.ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
|
|
204
|
+
};
|
|
205
205
|
//# 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 { SpecialSelector, SwcQueryOptions } from '../types';\n\nexport interface QueryMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: SwcQueryOptions;\n}\n\nexport const QUERY_METADATA_KEY = Symbol.for('simple-web-component:query');\n\nexport function query(target: SpecialSelector): PropertyDecorator;\nexport function query(selector: string, options?: SwcQueryOptions): PropertyDecorator;\n/**\n * @query decorator to inject a single element into a class property.\n */\nexport function query(selectorOrTarget: string, options: any = {}): PropertyDecorator {\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, options });\n\n // const propertyType = Reflect.getMetadata(\"design:type\", targetObj, propertyKey);\n // console.log(`Property ${String(propertyKey)} type is:`, propertyType.name);\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const selector = selectorOrTarget;\n\n const r = options.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; // query only returns one, so shadow preferred\n return t;\n };\n\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === ':parentHost') return applyRoot(hostSet.$parentHost);\n if (selector === ':appHost') return applyRoot(hostSet.$appHost);\n if (selector === ':firstHost') return applyRoot(hostSet.$firstHost);\n if (selector === ':lastHost') return applyRoot(hostSet.$lastHost);\n if (selector === ':firstAppHost') return applyRoot(hostSet.$firstAppHost);\n if (selector === ':lastAppHost') return applyRoot(hostSet.$lastAppHost);\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n if (selector === ':window') return win;\n if (selector === ':document') return win.document;\n if (selector === ':host') return applyRoot(this);\n\n // --- Standard Selectors ---\n if (r === 'shadow') return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n if (r === 'light') return this.querySelector(selector);\n if (r === 'all') {\n const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n return shadowMatch || this.querySelector(selector);\n }\n return (this.shadowRoot || this).querySelector(selector);\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined) {\n const selector = selectorOrTarget;\n if (selector.startsWith(':') && selector !== ':host') return;\n\n const r = options.root || 'auto';\n const targets: Element[] = [];\n\n if (r === 'shadow') {\n if (this.shadowRoot?.querySelector(selector)) targets.push(this.shadowRoot.querySelector(selector)!);\n } else if (r === 'light') {\n if (this.querySelector(selector)) targets.push(this.querySelector(selector)!);\n } else if (r === 'all') {\n if (this.shadowRoot?.querySelector(selector)) targets.push(this.shadowRoot.querySelector(selector)!);\n if (this.querySelector(selector)) targets.push(this.querySelector(selector)!);\n } else {\n const el = (this.shadowRoot || this).querySelector(selector);\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\nexport const getQueryMetadata = (target: any): QueryMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);\n};\n\n/**\n * @queryHost decorator - simplified version of @query for :host selector\n * Usage: @queryHost testzzs: HTMLElement | undefined;\n * Usage: @queryHost() testzzs: HTMLElement | undefined;\n * Usage: @queryHost({ root: 'shadow' }) testzzs: HTMLElement | undefined;\n */\nexport function queryHost(target: Object, propertyKey: string | symbol): void;\nexport function queryHost(): PropertyDecorator;\nexport function queryHost(options: SwcQueryOptions): PropertyDecorator;\nexport function queryHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n // Direct decorator usage: @queryHost (no parentheses)\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':host', {})(targetOrOptions, propertyKey);\n }\n\n // @queryHost() or @queryHost(options)\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':host', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':host', {});\n }\n}\n\n/**\n * @host - Alias for @queryHost decorator\n * Usage: @host element: HTMLElement | undefined;\n * Usage: @host() element: HTMLElement | undefined;\n * Usage: @host({ root: 'shadow' }) element: HTMLElement | undefined;\n */\nexport const host = queryHost;\n\n/**\n * @parentHost - Query :parentHost (Direct parent SWC component)\n * Usage: @parentHost parent: HTMLElement | undefined;\n * Usage: @parentHost() parent: HTMLElement | undefined;\n * Usage: @parentHost({ root: 'shadow' }) parent: HTMLElement | undefined;\n */\nexport function parentHost(target: Object, propertyKey: string | symbol): void;\nexport function parentHost(): PropertyDecorator;\nexport function parentHost(options: SwcQueryOptions): PropertyDecorator;\nexport function parentHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':parentHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':parentHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':parentHost', {});\n }\n}\n\n/**\n * @appHost - Query :appHost (Nearest <swc-app>)\n * Usage: @appHost app: SwcAppInterface | undefined;\n * Usage: @appHost() app: SwcAppInterface | undefined;\n * Usage: @appHost({ root: 'shadow' }) app: SwcAppInterface | undefined;\n */\nexport function appHost(target: Object, propertyKey: string | symbol): void;\nexport function appHost(): PropertyDecorator;\nexport function appHost(options: SwcQueryOptions): PropertyDecorator;\nexport function appHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':appHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':appHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':appHost', {});\n }\n}\n\n/**\n * @firstHost - Query :firstHost (First component in hierarchy)\n * Usage: @firstHost first: HTMLElement | undefined;\n * Usage: @firstHost() first: HTMLElement | undefined;\n * Usage: @firstHost({ root: 'shadow' }) first: HTMLElement | undefined;\n */\nexport function firstHost(target: Object, propertyKey: string | symbol): void;\nexport function firstHost(): PropertyDecorator;\nexport function firstHost(options: SwcQueryOptions): PropertyDecorator;\nexport function firstHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':firstHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':firstHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':firstHost', {});\n }\n}\n\n/**\n * @lastHost - Query :lastHost (Last component in hierarchy)\n * Usage: @lastHost last: HTMLElement | undefined;\n * Usage: @lastHost() last: HTMLElement | undefined;\n * Usage: @lastHost({ root: 'shadow' }) last: HTMLElement | undefined;\n */\nexport function lastHost(target: Object, propertyKey: string | symbol): void;\nexport function lastHost(): PropertyDecorator;\nexport function lastHost(options: SwcQueryOptions): PropertyDecorator;\nexport function lastHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':lastHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':lastHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':lastHost', {});\n }\n}\n\n/**\n * @firstAppHost - Query :firstAppHost (First <swc-app> in hierarchy)\n * Usage: @firstAppHost app: SwcAppInterface | undefined;\n * Usage: @firstAppHost() app: SwcAppInterface | undefined;\n * Usage: @firstAppHost({ root: 'shadow' }) app: SwcAppInterface | undefined;\n */\nexport function firstAppHost(target: Object, propertyKey: string | symbol): void;\nexport function firstAppHost(): PropertyDecorator;\nexport function firstAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function firstAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':firstAppHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':firstAppHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':firstAppHost', {});\n }\n}\n\n/**\n * @lastAppHost - Query :lastAppHost (Last <swc-app> in hierarchy)\n * Usage: @lastAppHost app: SwcAppInterface | undefined;\n * Usage: @lastAppHost() app: SwcAppInterface | undefined;\n * Usage: @lastAppHost({ root: 'shadow' }) app: SwcAppInterface | undefined;\n */\nexport function lastAppHost(target: Object, propertyKey: string | symbol): void;\nexport function lastAppHost(): PropertyDecorator;\nexport function lastAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function lastAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':lastAppHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':lastAppHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':lastAppHost', {});\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AASlB,MAAM,qBAAqB,OAAO,IAAI,4BAA4B;AAOnE,SAAU,MAAM,kBAA0B,UAAe,CAAA,GAAE;AAC/D,SAAO,CAAC,WAAmB,aAA8B,eAA4B;AACnF,QAAI,eAAe,QAAW;AAC5B,YAAM,IAAI,MAAM,wDAAwD,OAAO,WAAW,CAAC,GAAG;IAChG;AAEA,UAAM,cAAc,UAAU;AAC9B,QAAI,UAAU,yBAAa,YAA6B,oBAAoB,WAAW;AACvF,QAAI,CAAC,SAAS;AACZ,gBAAU,CAAA;AACV,+BAAa,eAAe,oBAAoB,SAAS,WAAW;IACtE;AACA,YAAQ,KAAK,EAAE,aAAa,UAAU,kBAAkB,QAAO,CAAE;AAIjE,WAAO,eAAe,WAAW,aAAa;MAC5C,MAAG;AACD,6CAAW,IAAI;AACf,cAAM,WAAW;AAEjB,cAAM,IAAI,QAAQ,QAAQ;AAC1B,cAAM,YAAY,CAAC,MAAU;AAC3B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C1B,gBAAM,UAAqB,CAAA;AAE3B,cAAI,MAAM,UAAU;AAClB,gBAAI,KAAK,YAAY,cAAc,QAAQ;AAAG,sBAAQ,KAAK,KAAK,WAAW,cAAc,QAAQ,CAAE;UACrG,WAAW,MAAM,SAAS;AACxB,gBAAI,KAAK,cAAc,QAAQ;AAAG,sBAAQ,KAAK,KAAK,cAAc,QAAQ,CAAE;UAC9E,WAAW,MAAM,OAAO;AACtB,gBAAI,KAAK,YAAY,cAAc,QAAQ;AAAG,sBAAQ,KAAK,KAAK,WAAW,cAAc,QAAQ,CAAE;AACnG,gBAAI,KAAK,cAAc,QAAQ;AAAG,sBAAQ,KAAK,KAAK,cAAc,QAAQ,CAAE;UAC9E,OAAO;AACL,kBAAM,MAAM,KAAK,cAAc,MAAM,cAAc,QAAQ;AAC3D,gBAAI;AAAI,sBAAQ,KAAK,EAAE;UACzB;AAEA,kBAAQ,QAAQ,OAAK,EAAE,OAAM,CAAE;QACjC;MACF;MACA,YAAY;MACZ,cAAc;KACf;EACH;AACF;
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions } from '../types';\n\nexport interface QueryMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: SwcQueryOptions;\n}\n\nexport const QUERY_METADATA_KEY = Symbol.for('simple-web-component:query');\n\nexport function query(target: SpecialSelector): PropertyDecorator;\nexport function query(selector: string, options?: SwcQueryOptions): PropertyDecorator;\n/**\n * @query decorator to inject a single element into a class property.\n */\nexport function query(selectorOrTarget: string, options: any = {}): PropertyDecorator {\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, options });\n\n // const propertyType = Reflect.getMetadata(\"design:type\", targetObj, propertyKey);\n // console.log(`Property ${String(propertyKey)} type is:`, propertyType.name);\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const selector = selectorOrTarget;\n\n const r = options.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; // query only returns one, so shadow preferred\n return t;\n };\n\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === ':parentHost') return applyRoot(hostSet.$parentHost);\n if (selector === ':appHost') return applyRoot(hostSet.$appHost);\n if (selector === ':firstHost') return applyRoot(hostSet.$firstHost);\n if (selector === ':lastHost') return applyRoot(hostSet.$lastHost);\n if (selector === ':firstAppHost') return applyRoot(hostSet.$firstAppHost);\n if (selector === ':lastAppHost') return applyRoot(hostSet.$lastAppHost);\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n if (selector === ':window') return win;\n if (selector === ':document') return win.document;\n if (selector === ':host') return applyRoot(this);\n\n // --- Standard Selectors ---\n if (r === 'shadow') return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n if (r === 'light') return this.querySelector(selector);\n if (r === 'all') {\n const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n return shadowMatch || this.querySelector(selector);\n }\n return (this.shadowRoot || this).querySelector(selector);\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined) {\n const selector = selectorOrTarget;\n if (selector.startsWith(':') && selector !== ':host') return;\n\n const r = options.root || 'auto';\n const targets: Element[] = [];\n\n if (r === 'shadow') {\n if (this.shadowRoot?.querySelector(selector)) targets.push(this.shadowRoot.querySelector(selector)!);\n } else if (r === 'light') {\n if (this.querySelector(selector)) targets.push(this.querySelector(selector)!);\n } else if (r === 'all') {\n if (this.shadowRoot?.querySelector(selector)) targets.push(this.shadowRoot.querySelector(selector)!);\n if (this.querySelector(selector)) targets.push(this.querySelector(selector)!);\n } else {\n const el = (this.shadowRoot || this).querySelector(selector);\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\n/**\n * @queryHost decorator - simplified version of @query for :host selector\n * Usage: @queryHost testzzs: HTMLElement | undefined;\n * Usage: @queryHost() testzzs: HTMLElement | undefined;\n * Usage: @queryHost({ root: 'shadow' }) testzzs: HTMLElement | undefined;\n */\nexport function queryHost(target: Object, propertyKey: string | symbol): void;\nexport function queryHost(): PropertyDecorator;\nexport function queryHost(options: SwcQueryOptions): PropertyDecorator;\nexport function queryHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n // Direct decorator usage: @queryHost (no parentheses)\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':host', {})(targetOrOptions, propertyKey);\n }\n\n // @queryHost() or @queryHost(options)\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':host', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':host', {});\n }\n}\n\n/**\n * @host - Alias for @queryHost decorator\n * Usage: @host element: HTMLElement | undefined;\n * Usage: @host() element: HTMLElement | undefined;\n * Usage: @host({ root: 'shadow' }) element: HTMLElement | undefined;\n */\nexport const host = queryHost;\n\n/**\n * @parentHost - Query :parentHost (Direct parent SWC component)\n * Usage: @parentHost parent: HTMLElement | undefined;\n * Usage: @parentHost() parent: HTMLElement | undefined;\n * Usage: @parentHost({ root: 'shadow' }) parent: HTMLElement | undefined;\n */\nexport function parentHost(target: Object, propertyKey: string | symbol): void;\nexport function parentHost(): PropertyDecorator;\nexport function parentHost(options: SwcQueryOptions): PropertyDecorator;\nexport function parentHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':parentHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':parentHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':parentHost', {});\n }\n}\n\n/**\n * @appHost - Query :appHost (Nearest <swc-app>)\n * Usage: @appHost app: SwcAppInterface | undefined;\n * Usage: @appHost() app: SwcAppInterface | undefined;\n * Usage: @appHost({ root: 'shadow' }) app: SwcAppInterface | undefined;\n */\nexport function appHost(target: Object, propertyKey: string | symbol): void;\nexport function appHost(): PropertyDecorator;\nexport function appHost(options: SwcQueryOptions): PropertyDecorator;\nexport function appHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':appHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':appHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':appHost', {});\n }\n}\n\n/**\n * @firstHost - Query :firstHost (First component in hierarchy)\n * Usage: @firstHost first: HTMLElement | undefined;\n * Usage: @firstHost() first: HTMLElement | undefined;\n * Usage: @firstHost({ root: 'shadow' }) first: HTMLElement | undefined;\n */\nexport function firstHost(target: Object, propertyKey: string | symbol): void;\nexport function firstHost(): PropertyDecorator;\nexport function firstHost(options: SwcQueryOptions): PropertyDecorator;\nexport function firstHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':firstHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':firstHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':firstHost', {});\n }\n}\n\n/**\n * @lastHost - Query :lastHost (Last component in hierarchy)\n * Usage: @lastHost last: HTMLElement | undefined;\n * Usage: @lastHost() last: HTMLElement | undefined;\n * Usage: @lastHost({ root: 'shadow' }) last: HTMLElement | undefined;\n */\nexport function lastHost(target: Object, propertyKey: string | symbol): void;\nexport function lastHost(): PropertyDecorator;\nexport function lastHost(options: SwcQueryOptions): PropertyDecorator;\nexport function lastHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':lastHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':lastHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':lastHost', {});\n }\n}\n\n/**\n * @firstAppHost - Query :firstAppHost (First <swc-app> in hierarchy)\n * Usage: @firstAppHost app: SwcAppInterface | undefined;\n * Usage: @firstAppHost() app: SwcAppInterface | undefined;\n * Usage: @firstAppHost({ root: 'shadow' }) app: SwcAppInterface | undefined;\n */\nexport function firstAppHost(target: Object, propertyKey: string | symbol): void;\nexport function firstAppHost(): PropertyDecorator;\nexport function firstAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function firstAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':firstAppHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':firstAppHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':firstAppHost', {});\n }\n}\n\n/**\n * @lastAppHost - Query :lastAppHost (Last <swc-app> in hierarchy)\n * Usage: @lastAppHost app: SwcAppInterface | undefined;\n * Usage: @lastAppHost() app: SwcAppInterface | undefined;\n * Usage: @lastAppHost({ root: 'shadow' }) app: SwcAppInterface | undefined;\n */\nexport function lastAppHost(target: Object, propertyKey: string | symbol): void;\nexport function lastAppHost(): PropertyDecorator;\nexport function lastAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function lastAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query(':lastAppHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query(':lastAppHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query(':lastAppHost', {});\n }\n}\n\nexport const getQueryMetadata = (target: any): QueryMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);\n};"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AASlB,MAAM,qBAAqB,OAAO,IAAI,4BAA4B;AAOnE,SAAU,MAAM,kBAA0B,UAAe,CAAA,GAAE;AAC/D,SAAO,CAAC,WAAmB,aAA8B,eAA4B;AACnF,QAAI,eAAe,QAAW;AAC5B,YAAM,IAAI,MAAM,wDAAwD,OAAO,WAAW,CAAC,GAAG;IAChG;AAEA,UAAM,cAAc,UAAU;AAC9B,QAAI,UAAU,yBAAa,YAA6B,oBAAoB,WAAW;AACvF,QAAI,CAAC,SAAS;AACZ,gBAAU,CAAA;AACV,+BAAa,eAAe,oBAAoB,SAAS,WAAW;IACtE;AACA,YAAQ,KAAK,EAAE,aAAa,UAAU,kBAAkB,QAAO,CAAE;AAIjE,WAAO,eAAe,WAAW,aAAa;MAC5C,MAAG;AACD,6CAAW,IAAI;AACf,cAAM,WAAW;AAEjB,cAAM,IAAI,QAAQ,QAAQ;AAC1B,cAAM,YAAY,CAAC,MAAU;AAC3B,cAAI,CAAC,KAAK,EAAE,aAAa;AAAc,mBAAO;AAC9C,cAAI,MAAM;AAAQ,mBAAO,EAAE,cAAc;AACzC,cAAI,MAAM;AAAU,mBAAO,E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,WAAO,MAAM,gBAAgB,CAAA,CAAE,EAAE,iBAAiB,WAAW;EAC/D;AACA,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;AACnE,WAAO,MAAM,gBAAgB,eAAkC;EACjE,OAAO;AACL,WAAO,MAAM,gBAAgB,CAAA,CAAE;EACjC;AACF;AAEO,MAAM,mBAAmB,CAAC,WAA4C;AAC3E,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,YAAY,oBAAoB,WAAW;AACjE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -124,10 +124,6 @@ function queryAll(selectorOrTarget, options = {}) {
|
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
const getQueryAllMetadata = (target) => {
|
|
128
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
129
|
-
return import_core.ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
130
|
-
};
|
|
131
127
|
function queryAllHost(targetOrOptions, propertyKey) {
|
|
132
128
|
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
133
129
|
return queryAll(":host", {})(targetOrOptions, propertyKey);
|
|
@@ -199,4 +195,8 @@ function allLastAppHost(targetOrOptions, propertyKey) {
|
|
|
199
195
|
return queryAll(":lastAppHost", {});
|
|
200
196
|
}
|
|
201
197
|
}
|
|
198
|
+
const getQueryAllMetadata = (target) => {
|
|
199
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
200
|
+
return import_core.ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
201
|
+
};
|
|
202
202
|
//# sourceMappingURL=queryAll.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/queryAll.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions } from '../types';\n\nexport interface QueryAllMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: SwcQueryOptions;\n}\n\nexport const QUERY_ALL_METADATA_KEY = Symbol.for('simple-web-component:query-all');\n\nexport function queryAll(target: SpecialSelector): PropertyDecorator;\nexport function queryAll(selector: string, options?: SwcQueryOptions): PropertyDecorator;\n/**\n * @queryAll decorator to inject a list of elements into a class property.\n */\nexport function queryAll(selectorOrTarget: string, options: any = {}): PropertyDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryAllMetadata[]>(QUERY_ALL_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget, options });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const selector = selectorOrTarget;\n\n const r = options.root || 'auto';\n const applyRoot = (t: any): any[] => {\n if (!t) return [];\n const items = Array.isArray(t) ? t : [t];\n const results: any[] = [];\n items.forEach(it => {\n if (!(it instanceof HTMLElement)) {\n results.push(it);\n return;\n }\n if (r === 'auto') results.push(it.shadowRoot || it);\n else {\n if (r === 'light' || r === 'all') results.push(it);\n if ((r === 'shadow' || r === 'all') && it.shadowRoot) results.push(it.shadowRoot);\n }\n });\n return results;\n };\n\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === ':hosts') return applyRoot(hostSet.$hosts);\n if (selector === ':appHosts') return applyRoot(hostSet.$appHosts);\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n if (selector === ':window') return [win];\n if (selector === ':document') return [win.document];\n if (selector === ':host') return applyRoot(this);\n\n // --- Standard Selectors ---\n if (r === 'shadow') return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n if (r === 'light') return Array.from(this.querySelectorAll(selector));\n if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n const lNodes = Array.from(this.querySelectorAll(selector));\n return [...sNodes, ...lNodes];\n }\n const root = this.shadowRoot || this;\n return Array.from(root.querySelectorAll(selector));\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {\n const selector = selectorOrTarget;\n if (selector.startsWith(':') && selector !== ':host') return;\n\n const r = options.root || 'auto';\n let targets: (Element | Node)[] = [];\n if (r === 'shadow') targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n else if (r === 'light') targets = Array.from(this.querySelectorAll(selector));\n else if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n const lNodes = Array.from(this.querySelectorAll(selector));\n targets = [...sNodes, ...lNodes];\n } else {\n targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));\n }\n targets.forEach(t => (t as Element).remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n}\n\nexport const getQueryAllMetadata = (target: any): QueryAllMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);\n};\n\n/**\n * @hostQueryAll decorator - simplified version of @queryAll for :host selector\n * Usage: @hostQueryAll()\n * Usage: @hostQueryAll({ root: 'shadow' })\n */\n/**\n * @queryAllHost decorator - simplified version of @queryAll for :host selector\n * Usage: @queryAllHost items: HTMLElement[];\n * Usage: @queryAllHost() items: HTMLElement[];\n * Usage: @queryAllHost({ root: 'shadow' }) items: HTMLElement[];\n */\nexport function queryAllHost(target: Object, propertyKey: string | symbol): void;\nexport function queryAllHost(): PropertyDecorator;\nexport function queryAllHost(options: SwcQueryOptions): PropertyDecorator;\nexport function queryAllHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n // Direct decorator usage: @queryAllHost (no parentheses)\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':host', {})(targetOrOptions, propertyKey);\n }\n\n // @queryAllHost() or @queryAllHost(options)\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':host', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':host', {});\n }\n}\n\n/**\n * @allHost - Alias for @queryAllHost decorator\n * Usage: @allHost items: HTMLElement[];\n * Usage: @allHost() items: HTMLElement[];\n * Usage: @allHost({ root: 'shadow' }) items: HTMLElement[];\n */\nexport const allHost = queryAllHost;\n/**\n * @allParentHost - Query all :parentHost (All parent SWC components)\n * Usage: @allParentHost parents: HTMLElement[];\n * Usage: @allParentHost() parents: HTMLElement[];\n * Usage: @allParentHost({ root: 'shadow' }) parents: HTMLElement[];\n */\nexport function allParentHost(target: Object, propertyKey: string | symbol): void;\nexport function allParentHost(): PropertyDecorator;\nexport function allParentHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allParentHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':parentHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':parentHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':parentHost', {});\n }\n}\n\n/**\n * @allAppHost - Query all :appHost (All <swc-app> instances)\n * Usage: @allAppHost apps: SwcAppInterface[];\n * Usage: @allAppHost() apps: SwcAppInterface[];\n * Usage: @allAppHost({ root: 'shadow' }) apps: SwcAppInterface[];\n */\nexport function allAppHost(target: Object, propertyKey: string | symbol): void;\nexport function allAppHost(): PropertyDecorator;\nexport function allAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':appHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':appHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':appHost', {});\n }\n}\n\n/**\n * @allFirstHost - Query all :firstHost (All first components in hierarchy)\n * Usage: @allFirstHost firsts: HTMLElement[];\n * Usage: @allFirstHost() firsts: HTMLElement[];\n * Usage: @allFirstHost({ root: 'shadow' }) firsts: HTMLElement[];\n */\nexport function allFirstHost(target: Object, propertyKey: string | symbol): void;\nexport function allFirstHost(): PropertyDecorator;\nexport function allFirstHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allFirstHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':firstHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':firstHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':firstHost', {});\n }\n}\n\n/**\n * @allLastHost - Query all :lastHost (All last components in hierarchy)\n * Usage: @allLastHost lasts: HTMLElement[];\n * Usage: @allLastHost() lasts: HTMLElement[];\n * Usage: @allLastHost({ root: 'shadow' }) lasts: HTMLElement[];\n */\nexport function allLastHost(target: Object, propertyKey: string | symbol): void;\nexport function allLastHost(): PropertyDecorator;\nexport function allLastHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allLastHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':lastHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':lastHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':lastHost', {});\n }\n}\n\n/**\n * @allFirstAppHost - Query all :firstAppHost (All first <swc-app> in hierarchy)\n * Usage: @allFirstAppHost apps: SwcAppInterface[];\n * Usage: @allFirstAppHost() apps: SwcAppInterface[];\n * Usage: @allFirstAppHost({ root: 'shadow' }) apps: SwcAppInterface[];\n */\nexport function allFirstAppHost(target: Object, propertyKey: string | symbol): void;\nexport function allFirstAppHost(): PropertyDecorator;\nexport function allFirstAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allFirstAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':firstAppHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':firstAppHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':firstAppHost', {});\n }\n}\n\n/**\n * @allLastAppHost - Query all :lastAppHost (All last <swc-app> in hierarchy)\n * Usage: @allLastAppHost apps: SwcAppInterface[];\n * Usage: @allLastAppHost() apps: SwcAppInterface[];\n * Usage: @allLastAppHost({ root: 'shadow' }) apps: SwcAppInterface[];\n */\nexport function allLastAppHost(target: Object, propertyKey: string | symbol): void;\nexport function allLastAppHost(): PropertyDecorator;\nexport function allLastAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allLastAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':lastAppHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':lastAppHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':lastAppHost', {});\n }\n}"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;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iB,QAAQ,CAAC;AACzD,sBAAU,CAAC,GAAG,QAAQ,GAAG,MAAM;UACjC,OAAO;AACL,sBAAU,MAAM,MAAM,KAAK,cAAc,MAAM,iBAAiB,QAAQ,CAAC;UAC3E;AACA,kBAAQ,QAAQ,OAAM,EAAc,OAAM,CAAE;QAC9C;MACF;MACA,YAAY;MACZ,cAAc;KACf;EACH;AACF;
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions } from '../types';\n\nexport interface QueryAllMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: SwcQueryOptions;\n}\n\nexport const QUERY_ALL_METADATA_KEY = Symbol.for('simple-web-component:query-all');\n\nexport function queryAll(target: SpecialSelector): PropertyDecorator;\nexport function queryAll(selector: string, options?: SwcQueryOptions): PropertyDecorator;\n/**\n * @queryAll decorator to inject a list of elements into a class property.\n */\nexport function queryAll(selectorOrTarget: string, options: any = {}): PropertyDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryAllMetadata[]>(QUERY_ALL_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget, options });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const selector = selectorOrTarget;\n\n const r = options.root || 'auto';\n const applyRoot = (t: any): any[] => {\n if (!t) return [];\n const items = Array.isArray(t) ? t : [t];\n const results: any[] = [];\n items.forEach(it => {\n if (!(it instanceof HTMLElement)) {\n results.push(it);\n return;\n }\n if (r === 'auto') results.push(it.shadowRoot || it);\n else {\n if (r === 'light' || r === 'all') results.push(it);\n if ((r === 'shadow' || r === 'all') && it.shadowRoot) results.push(it.shadowRoot);\n }\n });\n return results;\n };\n\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === ':hosts') return applyRoot(hostSet.$hosts);\n if (selector === ':appHosts') return applyRoot(hostSet.$appHosts);\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n if (selector === ':window') return [win];\n if (selector === ':document') return [win.document];\n if (selector === ':host') return applyRoot(this);\n\n // --- Standard Selectors ---\n if (r === 'shadow') return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n if (r === 'light') return Array.from(this.querySelectorAll(selector));\n if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n const lNodes = Array.from(this.querySelectorAll(selector));\n return [...sNodes, ...lNodes];\n }\n const root = this.shadowRoot || this;\n return Array.from(root.querySelectorAll(selector));\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {\n const selector = selectorOrTarget;\n if (selector.startsWith(':') && selector !== ':host') return;\n\n const r = options.root || 'auto';\n let targets: (Element | Node)[] = [];\n if (r === 'shadow') targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n else if (r === 'light') targets = Array.from(this.querySelectorAll(selector));\n else if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n const lNodes = Array.from(this.querySelectorAll(selector));\n targets = [...sNodes, ...lNodes];\n } else {\n targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));\n }\n targets.forEach(t => (t as Element).remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n}\n/**\n * @hostQueryAll decorator - simplified version of @queryAll for :host selector\n * Usage: @hostQueryAll()\n * Usage: @hostQueryAll({ root: 'shadow' })\n */\n/**\n * @queryAllHost decorator - simplified version of @queryAll for :host selector\n * Usage: @queryAllHost items: HTMLElement[];\n * Usage: @queryAllHost() items: HTMLElement[];\n * Usage: @queryAllHost({ root: 'shadow' }) items: HTMLElement[];\n */\nexport function queryAllHost(target: Object, propertyKey: string | symbol): void;\nexport function queryAllHost(): PropertyDecorator;\nexport function queryAllHost(options: SwcQueryOptions): PropertyDecorator;\nexport function queryAllHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n // Direct decorator usage: @queryAllHost (no parentheses)\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':host', {})(targetOrOptions, propertyKey);\n }\n\n // @queryAllHost() or @queryAllHost(options)\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':host', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':host', {});\n }\n}\n\n/**\n * @allHost - Alias for @queryAllHost decorator\n * Usage: @allHost items: HTMLElement[];\n * Usage: @allHost() items: HTMLElement[];\n * Usage: @allHost({ root: 'shadow' }) items: HTMLElement[];\n */\nexport const allHost = queryAllHost;\n/**\n * @allParentHost - Query all :parentHost (All parent SWC components)\n * Usage: @allParentHost parents: HTMLElement[];\n * Usage: @allParentHost() parents: HTMLElement[];\n * Usage: @allParentHost({ root: 'shadow' }) parents: HTMLElement[];\n */\nexport function allParentHost(target: Object, propertyKey: string | symbol): void;\nexport function allParentHost(): PropertyDecorator;\nexport function allParentHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allParentHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':parentHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':parentHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':parentHost', {});\n }\n}\n\n/**\n * @allAppHost - Query all :appHost (All <swc-app> instances)\n * Usage: @allAppHost apps: SwcAppInterface[];\n * Usage: @allAppHost() apps: SwcAppInterface[];\n * Usage: @allAppHost({ root: 'shadow' }) apps: SwcAppInterface[];\n */\nexport function allAppHost(target: Object, propertyKey: string | symbol): void;\nexport function allAppHost(): PropertyDecorator;\nexport function allAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':appHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':appHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':appHost', {});\n }\n}\n\n/**\n * @allFirstHost - Query all :firstHost (All first components in hierarchy)\n * Usage: @allFirstHost firsts: HTMLElement[];\n * Usage: @allFirstHost() firsts: HTMLElement[];\n * Usage: @allFirstHost({ root: 'shadow' }) firsts: HTMLElement[];\n */\nexport function allFirstHost(target: Object, propertyKey: string | symbol): void;\nexport function allFirstHost(): PropertyDecorator;\nexport function allFirstHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allFirstHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':firstHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':firstHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':firstHost', {});\n }\n}\n\n/**\n * @allLastHost - Query all :lastHost (All last components in hierarchy)\n * Usage: @allLastHost lasts: HTMLElement[];\n * Usage: @allLastHost() lasts: HTMLElement[];\n * Usage: @allLastHost({ root: 'shadow' }) lasts: HTMLElement[];\n */\nexport function allLastHost(target: Object, propertyKey: string | symbol): void;\nexport function allLastHost(): PropertyDecorator;\nexport function allLastHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allLastHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':lastHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':lastHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':lastHost', {});\n }\n}\n\n/**\n * @allFirstAppHost - Query all :firstAppHost (All first <swc-app> in hierarchy)\n * Usage: @allFirstAppHost apps: SwcAppInterface[];\n * Usage: @allFirstAppHost() apps: SwcAppInterface[];\n * Usage: @allFirstAppHost({ root: 'shadow' }) apps: SwcAppInterface[];\n */\nexport function allFirstAppHost(target: Object, propertyKey: string | symbol): void;\nexport function allFirstAppHost(): PropertyDecorator;\nexport function allFirstAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allFirstAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':firstAppHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':firstAppHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':firstAppHost', {});\n }\n}\n\n/**\n * @allLastAppHost - Query all :lastAppHost (All last <swc-app> in hierarchy)\n * Usage: @allLastAppHost apps: SwcAppInterface[];\n * Usage: @allLastAppHost() apps: SwcAppInterface[];\n * Usage: @allLastAppHost({ root: 'shadow' }) apps: SwcAppInterface[];\n */\nexport function allLastAppHost(target: Object, propertyKey: string | symbol): void;\nexport function allLastAppHost(): PropertyDecorator;\nexport function allLastAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function allLastAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return queryAll(':lastAppHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return queryAll(':lastAppHost', targetOrOptions as SwcQueryOptions);\n } else {\n return queryAll(':lastAppHost', {});\n }\n}\n\n\nexport const getQueryAllMetadata = (target: any): QueryAllMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);\n};\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AASlB,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAO3E,SAAU,SAAS,kBAA0B,UAAe,CAAA,GAAE;AAClE,SAAO,CAAC,WAAmB,aAA8B,eAA4B;AACnF,QAAI,eAAe,QAAW;AAC5B,YAAM,IAAI,MAAM,2DAA2D,OAAO,WAAW,CAAC,GAAG;IACnG;AAEA,UAAM,cAAc,UAAU;AAC9B,QAAI,UAAU,yBAAa,YAAgC,wBAAwB,WAAW;AAC9F,QAAI,CAAC,SAAS;AACZ,gBAAU,CAAA;AACV,+BAAa,eAAe,wBAAwB,SAAS,WAAW;IAC1E;AACA,YAAQ,KAAK,EAAE,aAAa,UAAU,kBAAkB,QAAO,CAAE;AAEjE,WAAO,eAAe,WAAW,aAAa;MAC5C,MAAG;AACD,6CAAW,IAAI;AACf,cAAM,WAAW;AAEjB,cAAM,IAAI,QAAQ,QAAQ;AAC1B,cAAM,YAAY,CAAC,MAAiB;AAClC,cAAI,CAAC;AAAG,mBAAO,CAAA;AACf,gBAAM,QAAQ,MAAM,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC;AACvC,gBAAM,UAAiB,CAAA;AACvB,gBAAM,QAAQ,QAAK;AACjB,gBAAI,EAAE,cAAc,cAAc;AAChC,sBAAQ,KAAK,EAAE;AACf;YACF;AACA,gBAAI,MAAM;AAAQ,sBAAQ,KAAK,GAAG,cAAc,EAAE;iBAC7C;AACH,kBAAI,MAAM,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,gBAAgB,WAAW;AACrG,WAAO,SAAS,gBAAgB,CAAA,CAAE,EAAE,iBAAiB,WAAW;EAClE;AACA,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,MAAM;AACnE,WAAO,SAAS,gBAAgB,eAAkC;EACpE,OAAO;AACL,WAAO,SAAS,gBAAgB,CAAA,CAAE;EACpC;AACF;AAGO,MAAM,sBAAsB,CAAC,WAA+C;AACjF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,YAAY,wBAAwB,WAAW;AACrE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var subscribeSwcAppRouteChange_exports = {};
|
|
19
|
+
__export(subscribeSwcAppRouteChange_exports, {
|
|
20
|
+
SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY: () => SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY,
|
|
21
|
+
getSubscribeSwcAppRouteChangeMetadata: () => getSubscribeSwcAppRouteChangeMetadata,
|
|
22
|
+
subscribeSwcAppRouteChange: () => subscribeSwcAppRouteChange
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(subscribeSwcAppRouteChange_exports);
|
|
25
|
+
var import_core = require("@dooboostore/core");
|
|
26
|
+
const SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change");
|
|
27
|
+
function createSwcAppRouteChangeSubscriber(options) {
|
|
28
|
+
return (target, propertyKey, descriptor) => {
|
|
29
|
+
const pathPattern = options?.path;
|
|
30
|
+
const filter = options?.filter;
|
|
31
|
+
const constructor = target.constructor;
|
|
32
|
+
let list = import_core.ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
|
|
33
|
+
if (!list) {
|
|
34
|
+
list = [];
|
|
35
|
+
import_core.ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, list, constructor);
|
|
36
|
+
}
|
|
37
|
+
list.push({ propertyKey, pathPattern, filter });
|
|
38
|
+
return descriptor;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function subscribeSwcAppRouteChange(targetOrOptions, propertyKey, descriptor) {
|
|
42
|
+
if (propertyKey && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
43
|
+
return createSwcAppRouteChangeSubscriber({})(targetOrOptions, propertyKey, descriptor);
|
|
44
|
+
}
|
|
45
|
+
let options = {};
|
|
46
|
+
if (Array.isArray(targetOrOptions)) {
|
|
47
|
+
options.path = targetOrOptions;
|
|
48
|
+
} else if (typeof targetOrOptions === "string") {
|
|
49
|
+
options.path = targetOrOptions;
|
|
50
|
+
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
51
|
+
options = targetOrOptions;
|
|
52
|
+
}
|
|
53
|
+
return createSwcAppRouteChangeSubscriber(options);
|
|
54
|
+
}
|
|
55
|
+
const getSubscribeSwcAppRouteChangeMetadata = (target) => {
|
|
56
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
57
|
+
return import_core.ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=subscribeSwcAppRouteChange.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/subscribeSwcAppRouteChange.ts"],
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { Router } from '@dooboostore/core-web';\n\nexport const SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY = Symbol.for('simple-web-component:subscribe-swc-app-route-change');\n\nexport interface SwcAppRouteChangeSubscriberMetadata {\n propertyKey: string | symbol;\n pathPattern?: string | string[];\n filter?: (router: Router) => boolean;\n}\n\nexport interface SwcAppRouteChangeOptions {\n path?: string | string[];\n filter?: (router: Router) => boolean;\n}\n\nfunction createSwcAppRouteChangeSubscriber(options?: SwcAppRouteChangeOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const pathPattern = options?.path;\n const filter = options?.filter;\n\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor) as SwcAppRouteChangeSubscriberMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, pathPattern, filter });\n \n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function subscribeSwcAppRouteChange(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function subscribeSwcAppRouteChange(): MethodDecorator;\nexport function subscribeSwcAppRouteChange(pathPattern: string): MethodDecorator;\nexport function subscribeSwcAppRouteChange(pathPatterns: string[]): MethodDecorator;\nexport function subscribeSwcAppRouteChange(options: SwcAppRouteChangeOptions): MethodDecorator;\n\n// \uC2E4\uC81C \uAD6C\uD604 (\uC774\uC911 \uBAA8\uB4DC)\nexport function subscribeSwcAppRouteChange(targetOrOptions?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @subscribeSwcAppRouteChange\n // propertyKey\uAC00 string | symbol\uC774\uACE0 descriptor\uAC00 \uC788\uC73C\uBA74 \uC9C1\uC811 \uC0AC\uC6A9\n if (propertyKey && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return createSwcAppRouteChangeSubscriber({})(targetOrOptions, propertyKey, descriptor);\n }\n \n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @subscribeSwcAppRouteChange() / @subscribeSwcAppRouteChange('/path')\n let options: SwcAppRouteChangeOptions = {};\n\n if (Array.isArray(targetOrOptions)) {\n // \uBC30\uC5F4: @subscribeSwcAppRouteChange(['/path1', '/path2'])\n options.path = targetOrOptions;\n } else if (typeof targetOrOptions === 'string') {\n // \uBB38\uC790\uC5F4: @subscribeSwcAppRouteChange('/path')\n options.path = targetOrOptions;\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // \uAC1D\uCCB4: @subscribeSwcAppRouteChange({ path: '/path', filter: ... })\n options = targetOrOptions;\n }\n\n return createSwcAppRouteChangeSubscriber(options);\n}\n\n// Helper function to retrieve route change subscribers metadata\nexport const getSubscribeSwcAppRouteChangeMetadata = (target: any): SwcAppRouteChangeSubscriberMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAGtB,MAAM,8CAA8C,OAAO,IAAI,qDAAqD;AAa3H,SAAS,kCAAkC,SAAqD;AAC9F,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,SAAS;AAC7B,UAAM,SAAS,SAAS;AAExB,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,eAAe,6CAA6C,WAAW;AAC/F,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,+BAAa,eAAe,6CAA6C,MAAM,WAAW;AAAA,IAC5F;AACA,SAAK,KAAK,EAAE,aAAa,aAAa,OAAO,CAAC;AAE9C,WAAO;AAAA,EACT;AACF;AAWO,SAAS,2BAA2B,iBAAuB,aAA+B,YAAsC;AAGrI,MAAI,gBAAgB,OAAO,gBAAgB,YAAY,OAAO,gBAAgB,WAAW;AACvF,WAAO,kCAAkC,CAAC,CAAC,EAAE,iBAAiB,aAAa,UAAU;AAAA,EACvF;AAGA,MAAI,UAAoC,CAAC;AAEzC,MAAI,MAAM,QAAQ,eAAe,GAAG;AAElC,YAAQ,OAAO;AAAA,EACjB,WAAW,OAAO,oBAAoB,UAAU;AAE9C,YAAQ,OAAO;AAAA,EACjB,WAAW,mBAAmB,OAAO,oBAAoB,UAAU;AAEjE,cAAU;AAAA,EACZ;AAEA,SAAO,kCAAkC,OAAO;AAClD;AAGO,MAAM,wCAAwC,CAAC,WAAmE;AACvH,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,eAAe,6CAA6C,WAAW;AAC7F;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|