@dooboostore/simple-web-component 1.0.16 → 1.0.18
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 +109 -48
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/appendChild.js +48 -0
- package/dist/cjs/decorators/appendChild.js.map +7 -0
- package/dist/cjs/decorators/elementDefine.js +216 -67
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/index.js +2 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/{innerHtml.js → onConnectedInnerHtml.js} +8 -8
- package/dist/cjs/decorators/onConnectedInnerHtml.js.map +7 -0
- package/dist/cjs/decorators/query.js +38 -0
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +32 -0
- package/dist/cjs/decorators/queryAll.js.map +2 -2
- package/dist/cjs/decorators/replaceChildren.js +53 -0
- package/dist/cjs/decorators/replaceChildren.js.map +7 -0
- package/dist/cjs/elements/SwcAppEngine.js +2 -1
- package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
- package/dist/cjs/elements/SwcAsync.js +188 -0
- package/dist/cjs/elements/SwcAsync.js.map +7 -0
- package/dist/cjs/elements/SwcChoose.js +155 -0
- package/dist/cjs/elements/SwcChoose.js.map +7 -0
- package/dist/cjs/elements/SwcIf.js +167 -0
- package/dist/cjs/elements/SwcIf.js.map +7 -0
- package/dist/cjs/elements/SwcLoop.js +246 -0
- package/dist/cjs/elements/SwcLoop.js.map +7 -0
- package/dist/cjs/elements/SwcSubTemplates.js +65 -0
- package/dist/cjs/elements/SwcSubTemplates.js.map +7 -0
- package/dist/cjs/elements/index.js +7 -0
- package/dist/cjs/elements/index.js.map +2 -2
- package/dist/cjs/index.js +12 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/Utils.js +74 -37
- package/dist/cjs/utils/Utils.js.map +3 -3
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/appendChild.js +29 -0
- package/dist/esm/decorators/appendChild.js.map +7 -0
- package/dist/esm/decorators/elementDefine.js +216 -67
- package/dist/esm/decorators/elementDefine.js.map +3 -3
- package/dist/esm/decorators/index.js +2 -1
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/{innerHtml.js → onConnectedInnerHtml.js} +5 -5
- package/dist/esm/decorators/onConnectedInnerHtml.js.map +7 -0
- package/dist/esm/decorators/query.js +38 -0
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +32 -0
- package/dist/esm/decorators/queryAll.js.map +2 -2
- package/dist/esm/decorators/replaceChildren.js +34 -0
- package/dist/esm/decorators/replaceChildren.js.map +7 -0
- package/dist/esm/elements/SwcAppEngine.js +2 -1
- package/dist/esm/elements/SwcAppEngine.js.map +2 -2
- package/dist/esm/elements/SwcAsync.js +169 -0
- package/dist/esm/elements/SwcAsync.js.map +7 -0
- package/dist/esm/elements/SwcChoose.js +136 -0
- package/dist/esm/elements/SwcChoose.js.map +7 -0
- package/dist/esm/elements/SwcIf.js +148 -0
- package/dist/esm/elements/SwcIf.js.map +7 -0
- package/dist/esm/elements/SwcLoop.js +227 -0
- package/dist/esm/elements/SwcLoop.js.map +7 -0
- package/dist/esm/elements/SwcSubTemplates.js +46 -0
- package/dist/esm/elements/SwcSubTemplates.js.map +7 -0
- package/dist/esm/elements/index.js +7 -0
- package/dist/esm/elements/index.js.map +2 -2
- package/dist/esm/index.js +8 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/Utils.js +74 -37
- package/dist/esm/utils/Utils.js.map +3 -3
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +1226 -149
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/addEventListener.d.ts +1 -0
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/appendChild.d.ts +17 -0
- package/dist/types/decorators/appendChild.d.ts.map +1 -0
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +2 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/onConnectedInnerHtml.d.ts +15 -0
- package/dist/types/decorators/onConnectedInnerHtml.d.ts.map +1 -0
- package/dist/types/decorators/query.d.ts +0 -2
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +0 -2
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/replaceChildren.d.ts +9 -0
- package/dist/types/decorators/replaceChildren.d.ts.map +1 -0
- package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/elements/SwcAsync.d.ts +16 -0
- package/dist/types/elements/SwcAsync.d.ts.map +1 -0
- package/dist/types/elements/SwcChoose.d.ts +13 -0
- package/dist/types/elements/SwcChoose.d.ts.map +1 -0
- package/dist/types/elements/SwcIf.d.ts +15 -0
- package/dist/types/elements/SwcIf.d.ts.map +1 -0
- package/dist/types/elements/SwcLoop.d.ts +20 -0
- package/dist/types/elements/SwcLoop.d.ts.map +1 -0
- package/dist/types/elements/SwcSubTemplates.d.ts +13 -0
- package/dist/types/elements/SwcSubTemplates.d.ts.map +1 -0
- package/dist/types/elements/index.d.ts +7 -0
- package/dist/types/elements/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +8 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +16 -10
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +1226 -149
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +10 -3
- package/src/decorators/addEventListener.ts +1 -0
- package/src/decorators/appendChild.ts +42 -0
- package/src/decorators/elementDefine.ts +225 -71
- package/src/decorators/index.ts +2 -1
- package/src/decorators/{innerHtml.ts → onConnectedInnerHtml.ts} +7 -6
- package/src/decorators/query.ts +32 -2
- package/src/decorators/queryAll.ts +32 -2
- package/src/decorators/replaceChildren.ts +35 -0
- package/src/elements/SwcAppEngine.ts +2 -1
- package/src/elements/SwcAsync.ts +163 -0
- package/src/elements/SwcChoose.ts +127 -0
- package/src/elements/SwcIf.ts +134 -0
- package/src/elements/SwcLoop.ts +215 -0
- package/src/elements/SwcSubTemplates.ts +19 -0
- package/src/elements/index.ts +8 -3
- package/src/index.ts +5 -2
- package/src/types.ts +9 -1
- package/src/utils/Utils.ts +86 -36
- package/dist/cjs/decorators/innerHtml.js.map +0 -7
- package/dist/esm/decorators/innerHtml.js.map +0 -7
- package/dist/types/decorators/innerHtml.d.ts +0 -12
- package/dist/types/decorators/innerHtml.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/elementDefine.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\nimport { getInnerHtmlMetadataList } from './innerHtml';\nimport { getQueryMetadata } from './query';\nimport { getQueryAllMetadata } from './queryAll';\nimport { getAddEventListenerMetadata } from './addEventListener';\nimport { 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, ON_ADD_EVENT_LISTENER_METADATA_KEY, ATTRIBUTE_CHANGED_WILDCARD, findAllLifecycleMetadata } from './lifecycles';\nimport { getEmitCustomEventMetadataList } from './emitCustomEvent';\nimport { changedAttribute, findAllAttributeChangedMetadata } from './changedAttribute';\nimport { setAttribute, findAllSetAttributeMetadata } from './setAttribute';\nimport { SwcUtils } from '../utils/Utils';\nimport { HTML_TAG_ENTRIES, DOM_EVENT_NAMES } from '../config/config';\nimport { SituationType, SituationTypeContainer, SituationTypeContainers } from '@dooboostore/simple-boot/decorators/inject/Inject';\nimport { ConstructorType } from '@dooboostore/core/types';\nimport { InjectSituationType, HostSet, SwcAppInterface } from '../types';\n\n// --- Core Interfaces & Types (Integrated) ---\n\nexport interface ElementConfig {\n name: string;\n extends?: string;\n observedAttributes?: string[];\n customElementRegistry?: CustomElementRegistry;\n window?: Window;\n}\n\nexport const ELEMENT_CONFIG_KEY = Symbol('simple-web-component:element-config');\n\n// --- Environment Initialization Helper ---\n\nfunction buildEnv(configWindow?: Window) {\n const win: any = configWindow || (typeof window !== 'undefined' ? window : undefined);\n const doc: Document = win?.document;\n\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\n const domHelpers = {\n $d: doc,\n $w: win,\n $q: (sel: string, root?: Element | Document | ShadowRoot) => (root ?? doc).querySelector(sel),\n $qa: (sel: string, root?: Element | Document | ShadowRoot) => Array.from((root ?? doc).querySelectorAll(sel)),\n $qi: (id: string, root?: Document | ShadowRoot) => (root ?? doc).getElementById(id)\n } as const;\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\nexport const elementDefine =\n (inConfig: ElementConfig | string): ClassDecorator =>\n (constructor: any) => {\n const config: ElementConfig = typeof inConfig === 'string' ? { name: inConfig } : inConfig;\n const { win, doc, builtInTagMap: BUILT_IN_TAG_MAP, domHelpers: SWC_DOM_HELPERS } = buildEnv(config.window);\n config.window = win;\n const SWC_DOM_HELPER_KEYS = Object.keys(SWC_DOM_HELPERS) as (keyof typeof SWC_DOM_HELPERS)[];\n const SWC_DOM_HELPER_VALS = () => SWC_DOM_HELPER_KEYS.map(k => (SWC_DOM_HELPERS as any)[k]);\n\n let extendsTagName = config.extends;\n if (!extendsTagName) {\n let proto = constructor;\n while (proto && proto !== HTMLElement && proto !== Function.prototype) {\n extendsTagName = BUILT_IN_TAG_MAP.get(proto);\n if (extendsTagName) break;\n proto = Object.getPrototypeOf(proto);\n }\n config.extends = extendsTagName;\n }\n\n const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];\n const addEventListenerList = getAddEventListenerMetadata(constructor) || [];\n const attrChangeMap = findAllAttributeChangedMetadata(constructor);\n const setAttrMap = findAllSetAttributeMetadata(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 const mergedObservedAttributes = [...new Set([...(config.observedAttributes ?? []), ...attrChangeMap.keys(), ...setAttrMap.keys(), ...emitCustomEventList.map(it => it.options.attributeName!), ...swcLifecycleAttributes, ...swcOnEvents])];\n const innerHtmlList = getInnerHtmlMetadataList(constructor) || [];\n\n const NewClass = class extends (constructor as any) {\n private _swcId = Math.random().toString(36).substring(2, 11);\n private _emitHandlers = new Map<string, EventListener>();\n\n private _executeSwcScript(attrName: string, hostSet: HostSet, extraArgs: Record<string, any> = {}) {\n const script = this.getAttribute(attrName);\n if (script) {\n try {\n const args = { ...hostSet, ...SWC_DOM_HELPERS, ...extraArgs };\n const argNames = Object.keys(args);\n const argValues = Object.values(args);\n new Function(...argNames, script).apply(this, argValues);\n } catch (e) {\n console.error(`[SWC] Failed to execute ${attrName}:`, e);\n }\n }\n }\n\n private async _invokeLifecycleMethod(methodName: string | symbol, hostSet: HostSet, extraArgs: any[] = []) {\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 private _bindAttributeEvent(el: HTMLElement, attrName: string, script: string, eventName?: string) {\n if (!eventName) {\n if (!attrName.startsWith('swc-on-')) return;\n eventName = attrName.substring(7);\n }\n if (swcLifecycleAttributes.includes(attrName)) return;\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 = (event: any) => {\n const hostSet = SwcUtils.getHostSet(el);\n const argNames = Object.keys(hostSet);\n const argValues = Object.values(hostSet);\n new Function('event', '$data', ...argNames, ...SWC_DOM_HELPER_KEYS, script).call(el, event, (event as CustomEvent).detail, ...argValues, ...SWC_DOM_HELPER_VALS());\n };\n\n el.addEventListener(eventName, handler);\n handlers.set(attrName, handler);\n }\n\n constructor(...args: any[]) {\n super(...args);\n const hostSet = SwcUtils.getHostSet(this as any);\n this._executeSwcScript('swc-on-constructor', hostSet);\n\n if (innerHtmlList.some(it => it.options.useShadow === true) && !this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n }\n }\n\n static get observedAttributes() {\n return mergedObservedAttributes;\n }\n\n async connectedCallback() {\n const hostSet = SwcUtils.getHostSet(this as any);\n\n this._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) await this._invokeLifecycleMethod(m, hostSet);\n }\n\n if (typeof (this as any).initCore === 'function') (this as any).initCore();\n\n if (innerHtmlList.length > 0) {\n let sContent = '',\n lContent = '';\n for (const meta of innerHtmlList) {\n const res = await (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 // --- @addEventListener binding ---\n addEventListenerList.forEach(meta => {\n const { selector, type, options } = meta;\n const { root, capture, once, passive, stopPropagation, stopImmediatePropagation, preventDefault, delegate } = options;\n\n if (delegate && selector && selector !== ':host') {\n const bindRoots: (HTMLElement | ShadowRoot)[] = [];\n const r = root || 'auto';\n if (r === 'auto') {\n bindRoots.push(this.shadowRoot || (this as any));\n } else if (r === 'light') {\n bindRoots.push(this as any);\n } else if (r === 'shadow') {\n if (this.shadowRoot) bindRoots.push(this.shadowRoot as any);\n } else if (r === 'all') {\n bindRoots.push(this as any);\n if (this.shadowRoot) bindRoots.push(this.shadowRoot as any);\n }\n\n bindRoots.forEach(bindRoot => {\n const handler = (event: Event) => {\n const target = event.target as HTMLElement;\n const matchedEl = target.closest(selector);\n if (matchedEl && (bindRoot as any).contains(matchedEl)) {\n if (stopPropagation) event.stopPropagation();\n if (stopImmediatePropagation) event.stopImmediatePropagation();\n if (preventDefault) event.preventDefault();\n\n const hostSet = SwcUtils.getHostSet(this as any);\n this._invokeLifecycleMethod(meta.propertyKey, hostSet, [event, hostSet, matchedEl]);\n }\n };\n bindRoot.addEventListener(type, handler, { capture, once, passive });\n });\n } else {\n const targetEls: (HTMLElement | Element | Document | ShadowRoot | Window)[] = [];\n if (!selector || selector === ':host') {\n targetEls.push(this as any);\n } else {\n const searchRoots: (HTMLElement | ShadowRoot)[] = [];\n const r = root || 'auto';\n if (r === 'auto') {\n searchRoots.push((this.shadowRoot || (this as any)) as any);\n } else if (r === 'light') {\n searchRoots.push(this as any);\n } else if (r === 'shadow') {\n if (this.shadowRoot) searchRoots.push(this.shadowRoot as any);\n } else if (r === 'all') {\n searchRoots.push(this as any);\n if (this.shadowRoot) searchRoots.push(this.shadowRoot as any);\n }\n\n searchRoots.forEach(sr => {\n const found = sr.querySelectorAll(selector);\n found.forEach(el => targetEls.push(el as any));\n });\n }\n\n targetEls.forEach(el => {\n const handler = (event: Event) => {\n if (stopPropagation) event.stopPropagation();\n if (stopImmediatePropagation) event.stopImmediatePropagation();\n if (preventDefault) event.preventDefault();\n\n const hostSet = SwcUtils.getHostSet(this as any);\n this._invokeLifecycleMethod(meta.propertyKey, hostSet, [event, hostSet]);\n };\n const opts = { capture, once, passive };\n el.addEventListener(type, handler, opts);\n });\n }\n });\n\n if (super.connectedCallback) await super.connectedCallback();\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);\n if (aMethods) {\n for (const m of aMethods) await this._invokeLifecycleMethod(m, hostSet);\n }\n\n this._executeSwcScript('swc-on-connected', hostSet);\n this._executeSwcScript('swc-on-after-connected', hostSet);\n }\n\n disconnectedCallback() {\n const hostSet = SwcUtils.getHostSet(this as any);\n this._executeSwcScript('swc-on-before-disconnected', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);\n if (bMethods) bMethods.forEach(m => this._invokeLifecycleMethod(m, hostSet));\n\n if (super.disconnectedCallback) super.disconnectedCallback();\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);\n if (aMethods) aMethods.forEach(m => this._invokeLifecycleMethod(m, hostSet));\n this._executeSwcScript('swc-on-disconnected', hostSet);\n this._executeSwcScript('swc-on-after-disconnected', hostSet);\n }\n\n adoptedCallback() {\n const hostSet = SwcUtils.getHostSet(this as any);\n this._executeSwcScript('swc-on-before-adopted', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_ADOPTED_METADATA_KEY);\n if (bMethods) bMethods.forEach(m => this._invokeLifecycleMethod(m, hostSet));\n\n if (super.adoptedCallback) super.adoptedCallback();\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);\n if (aMethods) aMethods.forEach(m => this._invokeLifecycleMethod(m, hostSet));\n this._executeSwcScript('swc-on-adopted', hostSet);\n this._executeSwcScript('swc-on-after-adopted', hostSet);\n }\n\n attributeChangedCallback(name: string, old: string | null, newVal: string | null) {\n if (super.attributeChangedCallback) super.attributeChangedCallback(name, old, newVal);\n\n if (name.startsWith('swc-on-') && !swcLifecycleAttributes.includes(name)) {\n if (newVal !== null) {\n const customEventMeta = emitCustomEventList.find(it => it.options.attributeName === name);\n const eventName = customEventMeta ? customEventMeta.options.type : name.substring(7);\n this._bindAttributeEvent(this as any, name, newVal, eventName);\n }\n }\n\n const mKeys = attrChangeMap.get(name);\n if (mKeys && Array.isArray(mKeys)) {\n const hSet = SwcUtils.getHostSet(this as any);\n mKeys.forEach(key => this._invokeLifecycleMethod(key, hSet, [newVal, old, name]));\n }\n }\n };\n\n // --- @setAttribute wrapping logic ---\n setAttrMap.forEach((methodName, attrName) => {\n const original = NewClass.prototype[methodName as any];\n if (typeof original === 'function') {\n NewClass.prototype[methodName as any] = function (...args: any[]) {\n const res = original.apply(this, args);\n if (res !== undefined) {\n if (res === null) this.removeAttribute(attrName);\n else this.setAttribute(attrName, String(res));\n }\n return res;\n };\n }\n });\n\n // --- @emitCustomEvent wrapping logic ---\n emitCustomEventList.forEach(meta => {\n const { propertyKey, options } = meta;\n const original = NewClass.prototype[propertyKey as any];\n if (typeof original === 'function') {\n NewClass.prototype[propertyKey as any] = function (...args: any[]) {\n const detail = original.apply(this, args);\n const event = new CustomEvent(options.type, {\n detail,\n bubbles: options.bubbles,\n composed: options.composed,\n cancelable: options.cancelable\n });\n this.dispatchEvent(event);\n return detail;\n };\n }\n });\n\n const originalProto = constructor.prototype;\n const newProto = NewClass.prototype;\n Object.getOwnPropertyNames(originalProto).forEach(name => {\n if (name === 'constructor') return;\n const keys = Reflect.getMetadataKeys(originalProto, name);\n keys.forEach(key => Reflect.defineMetadata(key, Reflect.getMetadata(key, originalProto, name), newProto, name));\n });\n\n ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, config, NewClass);\n ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, config, constructor);\n const registry = config.customElementRegistry || (win as any)?.customElements;\n if (registry && !registry.get(config.name)) {\n registry.define(config.name, NewClass as any, config.extends ? { extends: config.extends } : undefined);\n }\n return NewClass as any;\n };\n\nexport const getElementConfig = (target: any): ElementConfig | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);\n};\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AAGzC,SAAS,mCAAmC;AAC5C,SAAS,kCAAkC,iCAAiC,qCAAqC,oCAAoC,gCAAgC,+BAA+F,gCAAgC;AACpT,SAAS,sCAAsC;AAC/C,SAA2B,uCAAuC;AAClE,SAAuB,mCAAmC;AAC1D,SAAS,gBAAgB;AACzB,SAAS,kBAAkB,uBAAuB;AAClD,SAAwB,wBAAwB,+BAA+B;AAE/E,SAAS,2BAAqD;AAYvD,MAAM,qBAAqB,OAAO,qCAAqC;AAI9E,SAAS,SAAS,cAAqB;AACr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Aa;AAC/D,MAAI,YAAY,CAAC,SAAS,IAAI,OAAO,IAAI,GAAG;AAC1C,aAAS,OAAO,OAAO,MAAM,UAAiB,OAAO,UAAU,EAAE,SAAS,OAAO,QAAO,IAAK,MAAS;EACxG;AACA,SAAO;AACT;AAEK,MAAM,mBAAmB,CAAC,WAA0C;AACzE,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,oBAAoB,WAAW;AACjE;",
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\nimport { FunctionUtils } from '@dooboostore/core/function/FunctionUtils';\nimport { getOnConnectedInnerHtmlMetadata } from './onConnectedInnerHtml';\nimport { getQueryMetadata } from './query';\nimport { getQueryAllMetadata } from './queryAll';\nimport { getAddEventListenerMetadata } from './addEventListener';\nimport { 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, ON_ADD_EVENT_LISTENER_METADATA_KEY, ATTRIBUTE_CHANGED_WILDCARD, findAllLifecycleMetadata } from './lifecycles';\nimport { getEmitCustomEventMetadataList } from './emitCustomEvent';\nimport { changedAttribute, findAllAttributeChangedMetadata } from './changedAttribute';\nimport { setAttribute, findAllSetAttributeMetadata } from './setAttribute';\nimport { findAllReplaceChildrenMetadata } from './replaceChildren';\nimport { findAllAppendChildMetadata } from './appendChild';\nimport { SwcUtils } from '../utils/Utils';\nimport { HTML_TAG_ENTRIES, DOM_EVENT_NAMES } from '../config/config';\nimport { SituationType, SituationTypeContainer, SituationTypeContainers } from '@dooboostore/simple-boot/decorators/inject/Inject';\nimport { ConstructorType } from '@dooboostore/core/types';\nimport { SimpleApplication } from '@dooboostore/simple-boot/SimpleApplication';\nimport { Router } from '@dooboostore/core-web/routers/Router';\nimport { InjectSituationType, HostSet, SwcAppInterface } from '../types';\n\n// --- Core Interfaces & Types ---\n\nexport interface ElementConfig {\n name: string;\n extends?: string;\n observedAttributes?: string[];\n customElementRegistry?: CustomElementRegistry;\n window?: Window;\n}\n\nexport const ELEMENT_CONFIG_KEY = Symbol('simple-web-component:element-config');\n\n// Shared state for global delegation to prevent multiple listeners on the same root\nconst globalDelegatedRoots = new WeakSet<Node>();\n\n// --- Environment Initialization Helper ---\n\nfunction buildEnv(configWindow?: Window) {\n const win: any = configWindow || (typeof window !== 'undefined' ? window : undefined);\n const doc: Document = win?.document;\n\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\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\nexport const elementDefine =\n (inConfig: ElementConfig | string): ClassDecorator =>\n (constructor: any) => {\n const config: ElementConfig = typeof inConfig === 'string' ? { name: inConfig } : inConfig;\n const { win, doc, builtInTagMap: BUILT_IN_TAG_MAP, domHelpers: SWC_DOM_HELPERS } = buildEnv(config.window);\n config.window = win;\n\n let extendsTagName = config.extends;\n if (!extendsTagName) {\n let proto = constructor;\n while (proto && proto !== HTMLElement && proto !== Function.prototype) {\n extendsTagName = BUILT_IN_TAG_MAP.get(proto);\n if (extendsTagName) break;\n proto = Object.getPrototypeOf(proto);\n }\n config.extends = extendsTagName;\n }\n\n const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];\n const addEventListenerList = getAddEventListenerMetadata(constructor) || [];\n const attrChangeMap = findAllAttributeChangedMetadata(constructor);\n const setAttrMap = findAllSetAttributeMetadata(constructor);\n const replaceChildrenMap = findAllReplaceChildrenMetadata(constructor);\n const appendChildMap = findAllAppendChildMetadata(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 const mergedObservedAttributes = [...new Set([...(config.observedAttributes ?? []), ...attrChangeMap.keys(), ...setAttrMap.keys(), ...emitCustomEventList.map(it => it.options.attributeName!), ...swcLifecycleAttributes, ...swcOnEvents])];\n const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];\n\n const NewClass = class extends (constructor as any) {\n private _swcId = Math.random().toString(36).substring(2, 11);\n private _emitHandlers = new Map<string, EventListener>();\n private _boundListeners: Array<{ target: EventTarget; type: string; handler: EventListener; options?: any }> = [];\n\n private _executeSwcScript(attrName: string, hostSet: HostSet, extraArgs: Record<string, any> = {}) {\n const script = this.getAttribute(attrName);\n if (script) {\n try {\n const args = { ...hostSet, ...SWC_DOM_HELPERS, ...extraArgs };\n FunctionUtils.execute({ script, context: this, args });\n } catch (e) {\n console.error(`[SWC] Failed to execute ${attrName}:`, e);\n }\n }\n }\n\n private async _invokeLifecycleMethod(methodName: string | symbol, hostSet: HostSet, extraArgs: any[] = []) {\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 private _bindAttributeEvent(el: HTMLElement, attrName: string, script: string, eventName?: string) {\n if (!eventName) {\n if (!attrName.startsWith('swc-on-')) return;\n eventName = attrName.substring(7);\n }\n if (swcLifecycleAttributes.includes(attrName)) return;\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 = (event: any) => {\n const hostSet = SwcUtils.getHostSet(el);\n const args = {\n event,\n $data: (event as CustomEvent).detail,\n ...hostSet,\n ...SWC_DOM_HELPERS\n };\n FunctionUtils.execute({ script, context: el, args });\n };\n\n el.addEventListener(eventName, handler);\n handlers.set(attrName, handler);\n }\n\n constructor(...args: any[]) {\n super(...args);\n const hostSet = SwcUtils.getHostSet(this as any);\n this._executeSwcScript('swc-on-constructor', hostSet);\n\n if (connectedInnerHtmlList.some(it => it.options.useShadow === true) && !this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n }\n }\n\n static get observedAttributes() {\n return mergedObservedAttributes;\n }\n\n async connectedCallback() {\n const conf = getElementConfig(this);\n const currentWin = conf?.window || window;\n const currentDoc = currentWin.document;\n\n const hostSet = SwcUtils.getHostSet(this as any);\n\n this._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) await this._invokeLifecycleMethod(m, hostSet);\n }\n\n if (typeof (this as any).initCore === 'function') (this as any).initCore();\n\n if (connectedInnerHtmlList.length > 0) {\n let sContent = '',\n lContent = '';\n for (const meta of connectedInnerHtmlList) {\n const res = await (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 // --- Optimized Host Delegation ---\n const createDelegationHandler = (delegateHost: any) => (event: Event) => {\n if ((event as any).__swc_handled) return;\n\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 === delegateHost) break;\n if (!(node instanceof HTMLElement)) continue;\n\n const script = node.getAttribute?.(attrName);\n if (script && !getElementConfig(node)) {\n const host = SwcUtils.findNearestSwcHost(node);\n if (host) {\n const childHostSet = SwcUtils.getHostSet(node);\n const args = {\n event,\n $data: (event as CustomEvent).detail,\n ...childHostSet,\n ...SWC_DOM_HELPERS\n };\n FunctionUtils.execute({ script, context: node, args });\n (event as any).__swc_handled = true;\n break;\n }\n }\n }\n };\n\n // 1. Local Delegation (To itself)\n DOM_EVENT_NAMES.forEach(type => {\n const handler = createDelegationHandler(this);\n this.addEventListener(type, handler);\n this._boundListeners.push({ target: this as any, type, handler });\n });\n\n // 2. Structural/Global Delegation (If no parent host exists)\n const hasParentHost = SwcUtils.findAllSwcHosts(this as any).length > 0;\n if (!hasParentHost) {\n const root = this.getRootNode();\n if (!globalDelegatedRoots.has(root)) {\n DOM_EVENT_NAMES.forEach(type => {\n const handler = createDelegationHandler(root);\n root.addEventListener(type, handler);\n });\n globalDelegatedRoots.add(root);\n }\n }\n\n // --- @addEventListener binding (Direct/Delegate/Global) ---\n addEventListenerList.forEach(meta => {\n const { selector, type, options } = meta;\n const { root, capture, once, passive, stopPropagation, stopImmediatePropagation, preventDefault, delegate, removeOnDisconnected } = options;\n const opts = { capture, once, passive };\n\n const bindTargets: EventTarget[] = [];\n\n if (selector === ':window') {\n bindTargets.push(currentWin);\n } else if (selector === ':document') {\n bindTargets.push(currentDoc);\n } else if (selector === ':parentHost') {\n if (hostSet.$parentHost) bindTargets.push(hostSet.$parentHost);\n } else if (selector === ':appHost') {\n if (hostSet.$appHost) bindTargets.push(hostSet.$appHost);\n } else if (selector === ':firstHost') {\n if (hostSet.$firstHost) bindTargets.push(hostSet.$firstHost);\n } else if (selector === ':lastHost') {\n if (hostSet.$lastHost) bindTargets.push(hostSet.$lastHost);\n } else if (selector === ':firstAppHost') {\n if (hostSet.$firstAppHost) bindTargets.push(hostSet.$firstAppHost);\n } else if (selector === ':lastAppHost') {\n if (hostSet.$lastAppHost) bindTargets.push(hostSet.$lastAppHost);\n } else if (!selector || selector === ':host') {\n bindTargets.push(this as any);\n } else if (delegate) {\n const bindRoots: (HTMLElement | ShadowRoot)[] = [];\n const r = root || 'auto';\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') {\n if (this.shadowRoot) bindRoots.push(this.shadowRoot as any);\n } else if (r === 'all') {\n bindRoots.push(this as any);\n if (this.shadowRoot) bindRoots.push(this.shadowRoot as any);\n }\n\n bindRoots.forEach(br => {\n const handler = (event: Event) => {\n const matchedEl = (event.target as HTMLElement).closest(selector);\n if (matchedEl && (br as any).contains(matchedEl)) {\n if (stopPropagation) event.stopPropagation();\n if (stopImmediatePropagation) event.stopImmediatePropagation();\n if (preventDefault) event.preventDefault();\n const currentHostSet = SwcUtils.getHostSet(this as any);\n this._invokeLifecycleMethod(meta.propertyKey, currentHostSet, [event, currentHostSet, matchedEl]);\n }\n };\n br.addEventListener(type, handler, opts);\n const self: any = this;\n if (removeOnDisconnected === true || (br !== self && br !== self.shadowRoot)) {\n this._boundListeners.push({ target: br, type, handler, options: opts });\n }\n });\n } else {\n const searchRoots: (HTMLElement | ShadowRoot)[] = [];\n const r = root || 'auto';\n if (r === 'auto') searchRoots.push((this.shadowRoot || (this as any)) as any);\n else if (r === 'light') searchRoots.push(this as any);\n else if (r === 'shadow') {\n if (this.shadowRoot) searchRoots.push(this.shadowRoot as any);\n } else if (r === 'all') {\n searchRoots.push(this as any);\n if (this.shadowRoot) searchRoots.push(this.shadowRoot as any);\n }\n\n searchRoots.forEach(sr => {\n sr.querySelectorAll(selector).forEach(el => bindTargets.push(el));\n });\n }\n\n bindTargets.forEach(target => {\n const handler = (event: Event) => {\n if (stopPropagation) event.stopPropagation();\n if (stopImmediatePropagation) event.stopImmediatePropagation();\n if (preventDefault) event.preventDefault();\n const currentHostSet = SwcUtils.getHostSet(this as any);\n this._invokeLifecycleMethod(meta.propertyKey, currentHostSet, [event, currentHostSet]);\n };\n target.addEventListener(type, handler, opts);\n if (removeOnDisconnected === true || target === currentWin || target === currentDoc) {\n this._boundListeners.push({ target, type, handler, options: opts });\n }\n });\n });\n\n if (super.connectedCallback) await super.connectedCallback();\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);\n if (aMethods) {\n for (const m of aMethods) await this._invokeLifecycleMethod(m, hostSet);\n }\n\n this._executeSwcScript('swc-on-connected', hostSet);\n this._executeSwcScript('swc-on-after-connected', hostSet);\n }\n\n disconnectedCallback() {\n const hostSet = SwcUtils.getHostSet(this as any);\n this._executeSwcScript('swc-on-before-disconnected', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);\n if (bMethods) bMethods.forEach(m => this._invokeLifecycleMethod(m, hostSet));\n\n this._boundListeners.forEach(l => l.target.removeEventListener(l.type, l.handler, l.options));\n this._boundListeners = [];\n\n if (super.disconnectedCallback) super.disconnectedCallback();\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);\n if (aMethods) aMethods.forEach(m => this._invokeLifecycleMethod(m, hostSet));\n this._executeSwcScript('swc-on-disconnected', hostSet);\n this._executeSwcScript('swc-on-after-disconnected', hostSet);\n }\n\n adoptedCallback() {\n const hostSet = SwcUtils.getHostSet(this as any);\n this._executeSwcScript('swc-on-before-adopted', hostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_ADOPTED_METADATA_KEY);\n if (bMethods) bMethods.forEach(m => this._invokeLifecycleMethod(m, hostSet));\n\n if (super.adoptedCallback) super.adoptedCallback();\n\n const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);\n if (aMethods) aMethods.forEach(m => this._invokeLifecycleMethod(m, hostSet));\n this._executeSwcScript('swc-on-adopted', hostSet);\n this._executeSwcScript('swc-on-after-adopted', hostSet);\n }\n\n attributeChangedCallback(name: string, old: string | null, newVal: string | null) {\n if (super.attributeChangedCallback) super.attributeChangedCallback(name, old, newVal);\n\n if (name.startsWith('swc-on-') && !swcLifecycleAttributes.includes(name)) {\n if (newVal !== null) {\n const customEventMeta = emitCustomEventList.find(it => it.options.attributeName === name);\n const eventName = customEventMeta ? customEventMeta.options.type : name.substring(7);\n this._bindAttributeEvent(this as any, name, newVal, eventName);\n }\n }\n\n const mKeys = attrChangeMap.get(name);\n if (mKeys && Array.isArray(mKeys)) {\n const hSet = SwcUtils.getHostSet(this as any);\n mKeys.forEach(key => this._invokeLifecycleMethod(key, hSet, [newVal, old, name]));\n }\n }\n };\n\n // --- @setAttribute wrapping logic ---\n setAttrMap.forEach((methodName, attrName) => {\n const original = NewClass.prototype[methodName as any];\n if (typeof original === 'function') {\n NewClass.prototype[methodName as any] = function (...args: any[]) {\n const res = original.apply(this, args);\n if (res !== undefined) {\n if (res === null) this.removeAttribute(attrName);\n else this.setAttribute(attrName, String(res));\n }\n return res;\n };\n }\n });\n\n // --- @emitCustomEvent wrapping logic ---\n emitCustomEventList.forEach(meta => {\n const { propertyKey, options } = meta;\n const original = NewClass.prototype[propertyKey as any];\n if (typeof original === 'function') {\n NewClass.prototype[propertyKey as any] = function (...args: any[]) {\n const detail = original.apply(this, args);\n const event = new CustomEvent(options.type, {\n detail,\n bubbles: options.bubbles,\n composed: options.composed,\n cancelable: options.cancelable\n });\n this.dispatchEvent(event);\n return detail;\n };\n }\n });\n\n // --- @replaceChildren wrapping logic ---\n replaceChildrenMap.forEach((selector, methodName) => {\n const original = NewClass.prototype[methodName as any];\n if (typeof original === 'function') {\n NewClass.prototype[methodName as any] = function (...args: any[]) {\n const res = original.apply(this, args);\n if (res !== undefined) {\n const conf = getElementConfig(this);\n const currentWin = conf?.window || window;\n const currentDoc = currentWin.document;\n\n let targetEl: Element | null = null;\n if (selector === ':host' || !selector) {\n targetEl = this;\n } else {\n targetEl = (this.shadowRoot || this).querySelector(selector);\n }\n\n if (targetEl) {\n const nodes: (Node | string)[] = Array.isArray(res) ? res : [res];\n const normalizedNodes = nodes.map(n => {\n if (typeof n === 'string') {\n const t = currentDoc.createElement('template');\n t.innerHTML = n;\n return t.content;\n }\n return n as Node;\n });\n (targetEl as any).replaceChildren(...normalizedNodes);\n }\n }\n return res;\n };\n }\n });\n\n // --- @appendChild wrapping logic ---\n appendChildMap.forEach((meta, methodName) => {\n const { selector, options } = meta;\n const original = NewClass.prototype[methodName as any];\n if (typeof original === 'function') {\n NewClass.prototype[methodName as any] = function (...args: any[]) {\n const res = original.apply(this, args);\n if (res !== undefined) {\n const conf = getElementConfig(this);\n const currentWin = conf?.window || window;\n const currentDoc = currentWin.document;\n\n let targetEl: Element | null = null;\n if (selector === ':host' || !selector) {\n targetEl = this;\n } else {\n targetEl = (this.shadowRoot || this).querySelector(selector);\n }\n\n if (targetEl) {\n const nodes: (Node | string)[] = Array.isArray(res) ? res : [res];\n const normalizedNodes = nodes.map(n => {\n if (typeof n === 'string') {\n const t = currentDoc.createElement('template');\n t.innerHTML = n;\n return t.content;\n }\n return n as Node;\n });\n\n const pos = options.position || 'lastChild';\n if (pos === 'lastChild') (targetEl as any).append(...normalizedNodes);\n else if (pos === 'firstChild') (targetEl as any).prepend(...normalizedNodes);\n else if (pos === 'nextSibling') (targetEl as any).after(...normalizedNodes);\n else if (pos === 'previousSibling') (targetEl as any).before(...normalizedNodes);\n }\n }\n return res;\n };\n }\n });\n\n const originalProto = constructor.prototype;\n const newProto = NewClass.prototype;\n Object.getOwnPropertyNames(originalProto).forEach(name => {\n if (name === 'constructor') return;\n const keys = Reflect.getMetadataKeys(originalProto, name);\n keys.forEach(key => Reflect.defineMetadata(key, Reflect.getMetadata(key, originalProto, name), newProto, name));\n });\n\n ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, config, NewClass);\n ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, config, constructor);\n const registry = config.customElementRegistry || (win as any)?.customElements;\n if (registry && !registry.get(config.name)) {\n registry.define(config.name, NewClass as any, config.extends ? { extends: config.extends } : undefined);\n }\n return NewClass as any;\n };\n\nexport const getElementConfig = (target: any): ElementConfig | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,uCAAuC;AAGhD,SAAS,mCAAmC;AAC5C,SAAS,kCAAkC,iCAAiC,qCAAqC,oCAAoC,gCAAgC,+BAA+F,gCAAgC;AACpT,SAAS,sCAAsC;AAC/C,SAA2B,uCAAuC;AAClE,SAAuB,mCAAmC;AAC1D,SAAS,sCAAsC;AAC/C,SAAS,kCAAkC;AAC3C,SAAS,gBAAgB;AACzB,SAAS,kBAAkB,uBAAuB;AAClD,SAAwB,wBAAwB,+BAA+B;AAI/E,SAAS,2BAAqD;AAYvD,MAAM,qBAAqB,OAAO,qCAAqC;AAG9E,MAAM,uBAAuB,oBAAI,QAAO;AAIxC,SAAS,SAAS,cAAqB;AACrC,QAAM,MAAW,iBAAiB,OAAO,WAAW,cAAc,SAAS;AAC3E,QAAM,M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-3,7 +3,8 @@ export * from "./elementDefine.js";
|
|
|
3
3
|
export * from "./changedAttribute.js";
|
|
4
4
|
export * from "./setAttribute.js";
|
|
5
5
|
export * from "./emitCustomEvent.js";
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./replaceChildren.js";
|
|
7
|
+
export * from "./appendChild.js";
|
|
7
8
|
export * from "./lifecycles.js";
|
|
8
9
|
export * from "./query.js";
|
|
9
10
|
export * from "./queryAll.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './addEventListener';\nexport * from './elementDefine';\nexport * from './changedAttribute';\nexport * from './setAttribute';\nexport * from './emitCustomEvent';\nexport * from './
|
|
5
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
4
|
+
"sourcesContent": ["export * from './addEventListener';\nexport * from './elementDefine';\nexport * from './changedAttribute';\nexport * from './setAttribute';\nexport * from './emitCustomEvent';\nexport * from './replaceChildren';\nexport * from './appendChild';\nexport * from './lifecycles';\nexport * from './query';\nexport * from './queryAll';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReflectUtils } from "@dooboostore/core/reflect/ReflectUtils";
|
|
2
2
|
const INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
|
|
3
|
-
function
|
|
3
|
+
function onConnectedInnerHtml(arg1, arg2, arg3) {
|
|
4
4
|
const decorator = (options, target, propertyKey) => {
|
|
5
5
|
const constructor = target.constructor;
|
|
6
6
|
let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
|
|
@@ -17,13 +17,13 @@ function innerHtml(arg1, arg2, arg3) {
|
|
|
17
17
|
decorator(arg1 || {}, target, propertyKey);
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const getOnConnectedInnerHtmlMetadata = (target) => {
|
|
21
21
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
22
22
|
return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
|
|
23
23
|
};
|
|
24
24
|
export {
|
|
25
25
|
INNER_HTML_METADATA_KEY,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
getOnConnectedInnerHtmlMetadata,
|
|
27
|
+
onConnectedInnerHtml
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=onConnectedInnerHtml.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/onConnectedInnerHtml.ts"],
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\n\nexport interface InnerHtmlOptions {\n useShadow?: boolean;\n}\n\nexport interface InnerHtmlMetadata {\n propertyKey: string | symbol;\n options: InnerHtmlOptions;\n}\n\nexport const INNER_HTML_METADATA_KEY = Symbol('simple-web-component:inner-html');\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\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,SAAS,oBAAoB;AAWtB,MAAM,0BAA0B,OAAO,iCAAiC;AAOxE,SAAS,qBAAqB,MAAkC,MAAwB,MAAmD;AAChJ,QAAM,YAAY,CAAC,SAA2B,QAAgB,gBAAiC;AAC7F,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,YAAiC,yBAAyB,WAAW;AAC7F,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,mBAAa,eAAe,yBAAyB,MAAM,WAAW;AAAA,IACxE;AACA,SAAK,KAAK,EAAE,aAAa,QAAQ,CAAC;AAAA,EACpC;AAEA,MAAI,MAAM;AACR,WAAO,UAAU,CAAC,GAAG,MAAO,IAAI;AAAA,EAClC;AAEA,SAAO,CAAC,QAAgB,gBAAiC;AACvD,cAAW,QAA6B,CAAC,GAAG,QAAQ,WAAW;AAAA,EACjE;AACF;AAEO,MAAM,kCAAkC,CAAC,WAAiD;AAC/F,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,yBAAyB,WAAW;AACtE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReflectUtils } from "@dooboostore/core/reflect/ReflectUtils";
|
|
2
|
+
import { getElementConfig } from "./elementDefine.js";
|
|
3
|
+
import { SwcUtils } from "../utils/Utils.js";
|
|
2
4
|
const QUERY_METADATA_KEY = Symbol("simple-web-component:query");
|
|
3
5
|
function query(selector, options = {}) {
|
|
4
6
|
return (target, propertyKey, descriptor) => {
|
|
@@ -14,6 +16,26 @@ function query(selector, options = {}) {
|
|
|
14
16
|
queries.push({ selector, options, propertyKey });
|
|
15
17
|
Object.defineProperty(target, propertyKey, {
|
|
16
18
|
get() {
|
|
19
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
20
|
+
if (selector === ":parentHost")
|
|
21
|
+
return hostSet.$parentHost;
|
|
22
|
+
if (selector === ":appHost")
|
|
23
|
+
return hostSet.$appHost;
|
|
24
|
+
if (selector === ":firstHost")
|
|
25
|
+
return hostSet.$firstHost;
|
|
26
|
+
if (selector === ":lastHost")
|
|
27
|
+
return hostSet.$lastHost;
|
|
28
|
+
if (selector === ":firstAppHost")
|
|
29
|
+
return hostSet.$firstAppHost;
|
|
30
|
+
if (selector === ":lastAppHost")
|
|
31
|
+
return hostSet.$lastAppHost;
|
|
32
|
+
const config = getElementConfig(this);
|
|
33
|
+
const win = config?.window || window;
|
|
34
|
+
const doc = win.document;
|
|
35
|
+
if (selector === ":window")
|
|
36
|
+
return win;
|
|
37
|
+
if (selector === ":document")
|
|
38
|
+
return doc;
|
|
17
39
|
if (!selector || selector === ":host")
|
|
18
40
|
return this;
|
|
19
41
|
const r = options.root || "auto";
|
|
@@ -28,6 +50,22 @@ function query(selector, options = {}) {
|
|
|
28
50
|
}
|
|
29
51
|
return (this.shadowRoot || this).querySelector(selector);
|
|
30
52
|
},
|
|
53
|
+
set(nv) {
|
|
54
|
+
if (nv === null || nv === void 0) {
|
|
55
|
+
const r = options.root || "auto";
|
|
56
|
+
let targetEl = null;
|
|
57
|
+
if (r === "shadow")
|
|
58
|
+
targetEl = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
|
|
59
|
+
else if (r === "light")
|
|
60
|
+
targetEl = this.querySelector(selector);
|
|
61
|
+
else if (r === "all")
|
|
62
|
+
targetEl = this.shadowRoot?.querySelector(selector) || this.querySelector(selector);
|
|
63
|
+
else
|
|
64
|
+
targetEl = (this.shadowRoot || this).querySelector(selector);
|
|
65
|
+
if (targetEl)
|
|
66
|
+
targetEl.remove();
|
|
67
|
+
}
|
|
68
|
+
},
|
|
31
69
|
enumerable: true,
|
|
32
70
|
configurable: true
|
|
33
71
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/query.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\n\nexport interface QueryOptions {\n root?: 'light' | 'shadow' | 'all' | 'auto';\n}\n\nexport interface QueryMetadata {\n selector: string;\n options: QueryOptions;\n propertyKey: string | symbol;\n}\n\nexport const QUERY_METADATA_KEY = Symbol('simple-web-component:query');\n\n/**\n * @query decorator to inject a single element into a class property.\n
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\nimport { getElementConfig } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\n\nexport interface QueryOptions {\n root?: 'light' | 'shadow' | 'all' | 'auto';\n}\n\nexport interface QueryMetadata {\n selector: string;\n options: QueryOptions;\n propertyKey: string | symbol;\n}\n\nexport const QUERY_METADATA_KEY = Symbol('simple-web-component:query');\n\n/**\n * @query decorator to inject a single element into a class property.\n */\nexport function query(selector: string, options: QueryOptions = {}): PropertyDecorator {\n return (target: 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 = target.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({ selector, options, propertyKey });\n\n Object.defineProperty(target, propertyKey, {\n get(this: HTMLElement) {\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === ':parentHost') return hostSet.$parentHost;\n if (selector === ':appHost') return hostSet.$appHost;\n if (selector === ':firstHost') return hostSet.$firstHost;\n if (selector === ':lastHost') return hostSet.$lastHost;\n if (selector === ':firstAppHost') return hostSet.$firstAppHost;\n if (selector === ':lastAppHost') return hostSet.$lastAppHost;\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n const doc = win.document;\n\n if (selector === ':window') return win;\n if (selector === ':document') return doc;\n if (!selector || selector === ':host') return this;\n\n // --- Standard Selectors ---\n const r = options.root || 'auto';\n\n if (r === 'shadow') {\n return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n }\n if (r === 'light') {\n return this.querySelector(selector);\n }\n if (r === 'all') {\n return this.shadowRoot?.querySelector(selector) || this.querySelector(selector);\n }\n // auto\n return (this.shadowRoot || this).querySelector(selector);\n },\n set(this: HTMLElement, nv: any) {\n if (nv === null || nv === undefined) {\n const r = options.root || 'auto';\n let targetEl: Element | null = null;\n if (r === 'shadow') targetEl = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n else if (r === 'light') targetEl = this.querySelector(selector);\n else if (r === 'all') targetEl = this.shadowRoot?.querySelector(selector) || this.querySelector(selector);\n else targetEl = (this.shadowRoot || this).querySelector(selector);\n\n if (targetEl) targetEl.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"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,gBAAgB;AAYlB,MAAM,qBAAqB,OAAO,4BAA4B;AAK/D,SAAU,MAAM,UAAkB,UA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AQ,OAAO,QAAW;AACnC,gBAAM,IAAI,QAAQ,QAAQ;AAC1B,cAAI,WAA2B;AAC/B,cAAI,MAAM;AAAU,uBAAW,KAAK,aAAa,KAAK,WAAW,cAAc,QAAQ,IAAI;mBAClF,MAAM;AAAS,uBAAW,KAAK,cAAc,QAAQ;mBACrD,MAAM;AAAO,uBAAW,KAAK,YAAY,cAAc,QAAQ,KAAK,KAAK,cAAc,QAAQ;;AACnG,wBAAY,KAAK,cAAc,MAAM,cAAc,QAAQ;AAEhE,cAAI;AAAU,qBAAS,OAAM;QAC/B;MACF;MACA,YAAY;MACZ,cAAc;KACf;EACH;AACF;AAEO,MAAM,mBAAmB,CAAC,WAA4C;AAC3E,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,oBAAoB,WAAW;AACjE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReflectUtils } from "@dooboostore/core/reflect/ReflectUtils";
|
|
2
|
+
import { getElementConfig } from "./elementDefine.js";
|
|
3
|
+
import { SwcUtils } from "../utils/Utils.js";
|
|
2
4
|
const QUERY_ALL_METADATA_KEY = Symbol("simple-web-component:query-all");
|
|
3
5
|
function queryAll(selector, options = {}) {
|
|
4
6
|
return (target, propertyKey, descriptor) => {
|
|
@@ -14,6 +16,18 @@ function queryAll(selector, options = {}) {
|
|
|
14
16
|
queries.push({ selector, options, propertyKey });
|
|
15
17
|
Object.defineProperty(target, propertyKey, {
|
|
16
18
|
get() {
|
|
19
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
20
|
+
if (selector === ":hosts")
|
|
21
|
+
return hostSet.$hosts;
|
|
22
|
+
if (selector === ":appHosts")
|
|
23
|
+
return hostSet.$appHosts;
|
|
24
|
+
const config = getElementConfig(this);
|
|
25
|
+
const win = config?.window || window;
|
|
26
|
+
const doc = win.document;
|
|
27
|
+
if (selector === ":window")
|
|
28
|
+
return [win];
|
|
29
|
+
if (selector === ":document")
|
|
30
|
+
return [doc];
|
|
17
31
|
if (!selector || selector === ":host")
|
|
18
32
|
return [this];
|
|
19
33
|
const r = options.root || "auto";
|
|
@@ -31,6 +45,24 @@ function queryAll(selector, options = {}) {
|
|
|
31
45
|
const root = this.shadowRoot || this;
|
|
32
46
|
return root.querySelectorAll(selector);
|
|
33
47
|
},
|
|
48
|
+
set(nv) {
|
|
49
|
+
if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
|
|
50
|
+
const r = options.root || "auto";
|
|
51
|
+
let targets = [];
|
|
52
|
+
if (r === "shadow")
|
|
53
|
+
targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
|
|
54
|
+
else if (r === "light")
|
|
55
|
+
targets = Array.from(this.querySelectorAll(selector));
|
|
56
|
+
else if (r === "all") {
|
|
57
|
+
const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
|
|
58
|
+
const lNodes = Array.from(this.querySelectorAll(selector));
|
|
59
|
+
targets = [...sNodes, ...lNodes];
|
|
60
|
+
} else {
|
|
61
|
+
targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
|
|
62
|
+
}
|
|
63
|
+
targets.forEach((t) => t.remove());
|
|
64
|
+
}
|
|
65
|
+
},
|
|
34
66
|
enumerable: true,
|
|
35
67
|
configurable: true
|
|
36
68
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/queryAll.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\n\nexport interface QueryAllOptions {\n root?: 'light' | 'shadow' | 'all' | 'auto';\n}\n\nexport interface QueryAllMetadata {\n selector: string;\n options: QueryAllOptions;\n propertyKey: string | symbol;\n}\n\nexport const QUERY_ALL_METADATA_KEY = Symbol('simple-web-component:query-all');\n\n/**\n * @queryAll decorator to inject a list of elements into a class property.\n
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\nimport { getElementConfig } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\n\nexport interface QueryAllOptions {\n root?: 'light' | 'shadow' | 'all' | 'auto';\n}\n\nexport interface QueryAllMetadata {\n selector: string;\n options: QueryAllOptions;\n propertyKey: string | symbol;\n}\n\nexport const QUERY_ALL_METADATA_KEY = Symbol('simple-web-component:query-all');\n\n/**\n * @queryAll decorator to inject a list of elements into a class property.\n */\nexport function queryAll(selector: string, options: QueryAllOptions = {}): PropertyDecorator {\n return (target: 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 = target.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({ selector, options, propertyKey });\n\n Object.defineProperty(target, propertyKey, {\n get(this: HTMLElement) {\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === ':hosts') return hostSet.$hosts;\n if (selector === ':appHosts') return hostSet.$appHosts;\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n const doc = win.document;\n\n if (selector === ':window') return [win];\n if (selector === ':document') return [doc];\n if (!selector || selector === ':host') return [this];\n\n // --- Standard Selectors ---\n const r = options.root || 'auto';\n\n if (r === 'shadow') {\n return this.shadowRoot ? this.shadowRoot.querySelectorAll(selector) : [];\n }\n if (r === 'light') {\n return this.querySelectorAll(selector);\n }\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 // auto\n const root = this.shadowRoot || this;\n return root.querySelectorAll(selector);\n },\n set(this: HTMLElement, nv: any) {\n if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {\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"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,gBAAgB;AAYlB,MAAM,yBAAyB,OAAO,gCAAgC;AAKvE,SAAU,SAAS,UAAkB,UAA2B,CAAA,GAAE;AACtE,SAAO,CAAC,QAAgB,aAA8B,eAA4B;AAChF,QAAI,eAAe,QAAW;AAC5B,YAAM,IAAI,MAAM,2DAA2D,OAAO,WAAW,CAAC,GAAG;IACnG;AAEA,UAAM,cAAc,OAAO;AAC3B,QAAI,UAAU,aAAa,YAAgC,wBAAwB,WAAW;AAC9F,QAAI,CAAC,SAAS;AACZ,gBAAU,CAAA;AACV,mBAAa,eAAe,wBAAwB,SAAS,WAAW;IAC1E;AACA,YAAQ,KAAK,EAAE,UAAU,SAAS,YAAW,CAAE;AAE/C,WAAO,eAAe,QAAQ,aAAa;MACzC,MAAG;AAED,cAAM,UAAU,SAAS,WAAW,I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,CAAA;AAC1F,kBAAM,SAAS,MAAM,KAAK,KAAK,iBAAiB,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;AAEO,MAAM,sBAAsB,CAAC,WAA+C;AACjF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,wBAAwB,WAAW;AACrE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReflectUtils } from "@dooboostore/core/reflect/ReflectUtils";
|
|
2
|
+
const REPLACE_CHILDREN_METADATA_KEY = Symbol("simple-web-component:replace-children");
|
|
3
|
+
function replaceChildren(selector) {
|
|
4
|
+
return (target, propertyKey) => {
|
|
5
|
+
const constructor = target.constructor;
|
|
6
|
+
let meta = ReflectUtils.getOwnMetadata(REPLACE_CHILDREN_METADATA_KEY, constructor);
|
|
7
|
+
if (!meta) {
|
|
8
|
+
meta = /* @__PURE__ */ new Map();
|
|
9
|
+
ReflectUtils.defineMetadata(REPLACE_CHILDREN_METADATA_KEY, meta, constructor);
|
|
10
|
+
}
|
|
11
|
+
meta.set(propertyKey, selector);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const getReplaceChildrenMetadata = (target) => {
|
|
15
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
16
|
+
return ReflectUtils.getMetadata(REPLACE_CHILDREN_METADATA_KEY, constructor);
|
|
17
|
+
};
|
|
18
|
+
const findAllReplaceChildrenMetadata = (target) => {
|
|
19
|
+
const result = /* @__PURE__ */ new Map();
|
|
20
|
+
const maps = ReflectUtils.findAllMetadata(REPLACE_CHILDREN_METADATA_KEY, target);
|
|
21
|
+
maps.forEach((map) => {
|
|
22
|
+
if (map instanceof Map) {
|
|
23
|
+
map.forEach((v, k) => result.set(k, v));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
REPLACE_CHILDREN_METADATA_KEY,
|
|
30
|
+
findAllReplaceChildrenMetadata,
|
|
31
|
+
getReplaceChildrenMetadata,
|
|
32
|
+
replaceChildren
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=replaceChildren.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/replaceChildren.ts"],
|
|
4
|
+
"sourcesContent": ["import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\n\nexport const REPLACE_CHILDREN_METADATA_KEY = Symbol('simple-web-component:replace-children');\n\n/**\n * @replaceChildren decorator to surgically replace children of a target element.\n * Usage: @replaceChildren('#container') renderPart() { return '<div>New Content</div>'; }\n */\nexport function replaceChildren(selector: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let meta = ReflectUtils.getOwnMetadata(REPLACE_CHILDREN_METADATA_KEY, constructor) as Map<string | symbol, string>;\n if (!meta) {\n meta = new Map<string | symbol, string>();\n ReflectUtils.defineMetadata(REPLACE_CHILDREN_METADATA_KEY, meta, constructor);\n }\n meta.set(propertyKey, selector);\n };\n}\n\nexport const getReplaceChildrenMetadata = (target: any): Map<string | symbol, string> | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(REPLACE_CHILDREN_METADATA_KEY, constructor);\n};\n\nexport const findAllReplaceChildrenMetadata = (target: any): Map<string | symbol, string> => {\n const result = new Map<string | symbol, string>();\n const maps = ReflectUtils.findAllMetadata<Map<string | symbol, string>>(REPLACE_CHILDREN_METADATA_KEY, target);\n maps.forEach(map => {\n if (map instanceof Map) {\n map.forEach((v, k) => result.set(k, v));\n }\n });\n return result;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAEtB,MAAM,gCAAgC,OAAO,uCAAuC;AAMpF,SAAS,gBAAgB,UAAmC;AACjE,SAAO,CAAC,QAAgB,gBAAiC;AACvD,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,aAAa,eAAe,+BAA+B,WAAW;AACjF,QAAI,CAAC,MAAM;AACT,aAAO,oBAAI,IAA6B;AACxC,mBAAa,eAAe,+BAA+B,MAAM,WAAW;AAAA,IAC9E;AACA,SAAK,IAAI,aAAa,QAAQ;AAAA,EAChC;AACF;AAEO,MAAM,6BAA6B,CAAC,WAA0D;AACnG,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,+BAA+B,WAAW;AAC5E;AAEO,MAAM,iCAAiC,CAAC,WAA8C;AAC3F,QAAM,SAAS,oBAAI,IAA6B;AAChD,QAAM,OAAO,aAAa,gBAA8C,+BAA+B,MAAM;AAC7G,OAAK,QAAQ,SAAO;AAClB,QAAI,eAAe,KAAK;AACtB,UAAI,QAAQ,CAAC,GAAG,MAAM,OAAO,IAAI,GAAG,CAAC,CAAC;AAAA,IACxC;AAAA,EACF,CAAC;AACD,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -4,6 +4,7 @@ import { HashRouter } from "@dooboostore/core-web/routers/HashRouter";
|
|
|
4
4
|
import { ElementRouter } from "../router/ElementRouter.js";
|
|
5
5
|
import { SimOption } from "@dooboostore/simple-boot/SimOption";
|
|
6
6
|
import { Router } from "@dooboostore/core-web/routers/Router";
|
|
7
|
+
import { FunctionUtils } from "@dooboostore/core/function/FunctionUtils";
|
|
7
8
|
class SwcAppEngine {
|
|
8
9
|
constructor(host) {
|
|
9
10
|
this.host = host;
|
|
@@ -16,7 +17,7 @@ class SwcAppEngine {
|
|
|
16
17
|
const configStr = this.host.getAttribute("swc-get-application-config");
|
|
17
18
|
if (!configStr) return;
|
|
18
19
|
try {
|
|
19
|
-
const userConfig =
|
|
20
|
+
const userConfig = FunctionUtils.executeReturn({ script: configStr, context: this.host });
|
|
20
21
|
if (userConfig && userConfig.rootRouter) {
|
|
21
22
|
const _config = {
|
|
22
23
|
routeType: "element",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/elements/SwcAppEngine.ts"],
|
|
4
|
-
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot/SimpleApplication';\nimport { PathRouter } from '@dooboostore/core-web/routers/PathRouter';\nimport { HashRouter } from '@dooboostore/core-web/routers/HashRouter';\nimport { ElementRouter } from '../router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot/SimOption';\nimport { Router, RouterEventType } from '@dooboostore/core-web/routers/Router';\nimport { Subscription } from '@dooboostore/core/message/Subscription';\nimport { ConstructorType, Optional } from '@dooboostore/core/types';\n\nexport type SwcConfigType = {\n rootRouter: ConstructorType<any>;\n routeType: 'path' | 'hash' | 'element';\n path?: string;\n window: Window;\n};\n\nexport type SwcAttributeConfigType = Optional<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _isInitialized = false;\n\n constructor(private host: HTMLElement) {}\n\n async connect() {\n if (this._isInitialized) return;\n this._isInitialized = true;\n\n // Wait for event loop to ensure attributes and global scripts are ready\n await new Promise(resolve => setTimeout(resolve, 0));\n\n const configStr = this.host.getAttribute('swc-get-application-config');\n if (!configStr) return;\n\n try {\n const userConfig: SwcAttributeConfigType =
|
|
5
|
-
"mappings": "AAAA,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,cAA+B;
|
|
4
|
+
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot/SimpleApplication';\nimport { PathRouter } from '@dooboostore/core-web/routers/PathRouter';\nimport { HashRouter } from '@dooboostore/core-web/routers/HashRouter';\nimport { ElementRouter } from '../router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot/SimOption';\nimport { Router, RouterEventType } from '@dooboostore/core-web/routers/Router';\nimport { Subscription } from '@dooboostore/core/message/Subscription';\nimport { ConstructorType, Optional } from '@dooboostore/core/types';\nimport { FunctionUtils } from '@dooboostore/core/function/FunctionUtils';\n\nexport type SwcConfigType = {\n rootRouter: ConstructorType<any>;\n routeType: 'path' | 'hash' | 'element';\n path?: string;\n window: Window;\n};\n\nexport type SwcAttributeConfigType = Optional<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _isInitialized = false;\n\n constructor(private host: HTMLElement) {}\n\n async connect() {\n if (this._isInitialized) return;\n this._isInitialized = true;\n\n // Wait for event loop to ensure attributes and global scripts are ready\n await new Promise(resolve => setTimeout(resolve, 0));\n\n const configStr = this.host.getAttribute('swc-get-application-config');\n if (!configStr) return;\n\n try {\n const userConfig: SwcAttributeConfigType = FunctionUtils.executeReturn({ script: configStr, context: this.host });\n if (userConfig && userConfig.rootRouter) {\n const _config: SwcConfigType = {\n routeType: 'element',\n window: window,\n ...userConfig\n } as SwcConfigType;\n\n // Router Selection\n if (_config.routeType === 'path') {\n this.router = new PathRouter({ window: _config.window, firstUrl: _config.path });\n } else if (_config.routeType === 'hash') {\n this.router = new HashRouter({ window: _config.window, firstUrl: _config.path });\n } else if (_config.routeType === 'element') {\n this.router = new ElementRouter({ window: _config.window, firstUrl: _config.path });\n }\n\n // Routing sync\n if (this.router) {\n this.routerSubscription = this.router.observable.subscribe((route: RouterEventType) => {\n if (route.triggerPoint === 'end') {\n this.simpleApplication?.routing(route.path);\n }\n });\n }\n\n // App start\n this.simpleApplication = new SimpleApplication(new SimOption({ excludeProxys: [Node], rootRouter: _config.rootRouter }));\n\n const otherInstanceSim = new Map<any, any>();\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n // Rendering\n const data = this.simpleApplication.sim(_config.rootRouter);\n if (data instanceof Node) {\n if (this.host.shadowRoot) this.host.shadowRoot.replaceChildren(data);\n else this.host.replaceChildren(data);\n }\n\n if (_config.path) await this.router?.go(_config.path);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,cAA+B;AAGxC,SAAS,qBAAqB;AAWvB,MAAM,aAAa;AAAA,EAMxB,YAAoB,MAAmB;AAAnB;AAFpB,SAAQ,iBAAiB;AAAA,EAEe;AAAA,EAExC,MAAM,UAAU;AACd,QAAI,KAAK,eAAgB;AACzB,SAAK,iBAAiB;AAGtB,UAAM,IAAI,QAAQ,aAAW,WAAW,SAAS,CAAC,CAAC;AAEnD,UAAM,YAAY,KAAK,KAAK,aAAa,4BAA4B;AACrE,QAAI,CAAC,UAAW;AAEhB,QAAI;AACF,YAAM,aAAqC,cAAc,cAAc,EAAE,QAAQ,WAAW,SAAS,KAAK,KAAK,CAAC;AAChH,UAAI,cAAc,WAAW,YAAY;AACvC,cAAM,UAAyB;AAAA,UAC7B,WAAW;AAAA,UACX;AAAA,UACA,GAAG;AAAA,QACL;AAGA,YAAI,QAAQ,cAAc,QAAQ;AAChC,eAAK,SAAS,IAAI,WAAW,EAAE,QAAQ,QAAQ,QAAQ,UAAU,QAAQ,KAAK,CAAC;AAAA,QACjF,WAAW,QAAQ,cAAc,QAAQ;AACvC,eAAK,SAAS,IAAI,WAAW,EAAE,QAAQ,QAAQ,QAAQ,UAAU,QAAQ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