@dooboostore/simple-web-component 1.0.39 → 1.0.41

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.
Files changed (98) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +235 -47
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +194 -111
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyNode.js +58 -43
  7. package/dist/cjs/decorators/applyNode.js.map +2 -2
  8. package/dist/cjs/decorators/applyProperty.js +213 -0
  9. package/dist/cjs/decorators/applyProperty.js.map +7 -0
  10. package/dist/cjs/decorators/applySlot.js +32 -26
  11. package/dist/cjs/decorators/applySlot.js.map +2 -2
  12. package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
  13. package/dist/cjs/decorators/elementDefine.js +17 -30
  14. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  15. package/dist/cjs/decorators/index.js +2 -2
  16. package/dist/cjs/decorators/index.js.map +2 -2
  17. package/dist/cjs/decorators/lifecycles.js +4 -4
  18. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  19. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
  20. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  21. package/dist/cjs/elements/SwcApp.js.map +2 -2
  22. package/dist/cjs/elements/SwcAppMixin.js +11 -4
  23. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  24. package/dist/cjs/types/index.js.map +1 -1
  25. package/dist/esm/SwcAppEngine.js.map +2 -2
  26. package/dist/esm/decorators/applyAttribute.js +196 -113
  27. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  28. package/dist/esm/decorators/applyNode.js +58 -43
  29. package/dist/esm/decorators/applyNode.js.map +2 -2
  30. package/dist/esm/decorators/applyProperty.js +194 -0
  31. package/dist/esm/decorators/applyProperty.js.map +7 -0
  32. package/dist/esm/decorators/applySlot.js +32 -26
  33. package/dist/esm/decorators/applySlot.js.map +2 -2
  34. package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
  35. package/dist/esm/decorators/elementDefine.js +17 -30
  36. package/dist/esm/decorators/elementDefine.js.map +2 -2
  37. package/dist/esm/decorators/index.js +2 -2
  38. package/dist/esm/decorators/index.js.map +1 -1
  39. package/dist/esm/decorators/lifecycles.js +4 -4
  40. package/dist/esm/decorators/lifecycles.js.map +2 -2
  41. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -3
  42. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  43. package/dist/esm/elements/SwcApp.js.map +2 -2
  44. package/dist/esm/elements/SwcAppMixin.js +11 -4
  45. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  46. package/dist/esm/types/index.js.map +1 -1
  47. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +441 -401
  48. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  49. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  50. package/dist/types/decorators/applyAttribute.d.ts +56 -15
  51. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  52. package/dist/types/decorators/applyNode.d.ts +28 -24
  53. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  54. package/dist/types/decorators/applyProperty.d.ts +61 -0
  55. package/dist/types/decorators/applyProperty.d.ts.map +1 -0
  56. package/dist/types/decorators/applySlot.d.ts +10 -10
  57. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  58. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  59. package/dist/types/decorators/index.d.ts +2 -2
  60. package/dist/types/decorators/index.d.ts.map +1 -1
  61. package/dist/types/decorators/lifecycles.d.ts +4 -4
  62. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  63. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
  64. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  65. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  66. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  67. package/dist/types/types/index.d.ts +1 -6
  68. package/dist/types/types/index.d.ts.map +1 -1
  69. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +441 -401
  70. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  71. package/package.json +3 -3
  72. package/src/SwcAppEngine.ts +1 -0
  73. package/src/decorators/applyAttribute.ts +311 -126
  74. package/src/decorators/applyNode.ts +68 -57
  75. package/src/decorators/applyProperty.ts +302 -0
  76. package/src/decorators/applySlot.ts +25 -18
  77. package/src/decorators/changedAttributeThis.ts +1 -1
  78. package/src/decorators/elementDefine.ts +41 -30
  79. package/src/decorators/index.ts +2 -3
  80. package/src/decorators/lifecycles.ts +6 -6
  81. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +14 -4
  82. package/src/elements/SwcApp.ts +0 -1
  83. package/src/elements/SwcAppMixin.ts +16 -4
  84. package/src/types/index.ts +7 -7
  85. package/dist/cjs/decorators/attribute.js +0 -187
  86. package/dist/cjs/decorators/attribute.js.map +0 -7
  87. package/dist/cjs/decorators/setProperty.js +0 -109
  88. package/dist/cjs/decorators/setProperty.js.map +0 -7
  89. package/dist/esm/decorators/attribute.js +0 -168
  90. package/dist/esm/decorators/attribute.js.map +0 -7
  91. package/dist/esm/decorators/setProperty.js +0 -90
  92. package/dist/esm/decorators/setProperty.js.map +0 -7
  93. package/dist/types/decorators/attribute.d.ts +0 -31
  94. package/dist/types/decorators/attribute.d.ts.map +0 -1
  95. package/dist/types/decorators/setProperty.d.ts +0 -17
  96. package/dist/types/decorators/setProperty.d.ts.map +0 -1
  97. package/src/decorators/attribute.ts +0 -223
  98. package/src/decorators/setProperty.ts +0 -112
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/decorators/applyProperty.ts"],
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { ensureInit, getElementConfig } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface PropertyOptions extends SwcQueryOptions {\n name?: string | symbol;\n filter?: (target: HTMLElement, value: any, meta: {currentThis: any, helper: HelperHostSet}) => boolean;\n}\n\nexport interface PropertyMetadata {\n propertyKey: string | symbol;\n selector: string;\n targetPropertyKey: string | symbol;\n options: PropertyOptions;\n type: 'property' | 'method';\n}\n\nexport const PROPERTY_METADATA_KEY = Symbol.for('simple-web-component:property');\n\n// ============================================\n// Utilities\n// ============================================\n\n/**\n * Resolve target elements based on selector and options\n * Handles special selectors ($this, $host, etc.) and CSS selectors\n * Returns HTMLElement[] but can include Window and Document for property access\n */\nexport const resolvePropertyTargets = (inst: any, selector: string, options: PropertyOptions): any[] => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const r = options.root || 'auto';\n const results: any[] = [];\n\n const applyRoot = (target: any) => {\n if (!target) return;\n if (r === 'auto') {\n results.push(target);\n } else {\n if (r === 'light' || r === 'all') results.push(target);\n if ((r === 'shadow' || r === 'all') && target.shadowRoot) results.push(target.shadowRoot);\n }\n };\n\n if (selector === '$this' || !selector) {\n applyRoot(inst);\n } else if (selector === '$window') {\n results.push(currentWin);\n } else if (selector === '$document') {\n results.push(currentWin.document);\n } else {\n const hostSet = SwcUtils.getHostSet(inst);\n if (selector === '$host') applyRoot(hostSet.$host);\n else if (selector === '$parentHost') applyRoot(hostSet.$parentHost);\n else if (selector === '$appHost') applyRoot(hostSet.$appHost as any);\n else if (selector === '$firstHost') applyRoot(hostSet.$firstHost);\n else if (selector === '$lastHost') applyRoot(hostSet.$lastHost);\n else if (selector === '$firstAppHost') applyRoot(hostSet.$firstAppHost as any);\n else if (selector === '$lastAppHost') applyRoot(hostSet.$lastAppHost as any);\n else if (selector === '$hosts') hostSet.$hosts.forEach(applyRoot);\n else if (selector === '$appHosts') hostSet.$appHosts.forEach(applyRoot);\n else {\n if (r === 'shadow') {\n const found = inst.shadowRoot?.querySelectorAll(selector);\n if (found) results.push(...found);\n } else if (r === 'light') {\n const found = inst.querySelectorAll(selector);\n if (found) results.push(...found);\n } else if (r === 'all') {\n const sMatch = inst.shadowRoot?.querySelectorAll(selector);\n const lMatch = inst.querySelectorAll(selector);\n if (sMatch) results.push(...sMatch);\n if (lMatch) results.push(...lMatch);\n } else {\n const found = (inst.shadowRoot || inst).querySelectorAll(selector);\n if (found) results.push(...found);\n }\n }\n }\n return results;\n};\n\n/**\n * @applyProperty decorator - set/get element properties\n * \n * Usage:\n * - @applyProperty('selector', 'propertyName') - Set property with explicit name\n * - @applyProperty('selector') - Use property name as target property name\n * - @applyProperty('selector', { name: 'propertyName' }) - Set property via options\n * - Return null/undefined to skip setting\n */\nexport function applyProperty(selector: string, targetPropertyKey: string | symbol, options?: PropertyOptions): MethodDecorator & PropertyDecorator;\nexport function applyProperty(selector: string, options?: PropertyOptions): MethodDecorator & PropertyDecorator;\nexport function applyProperty(selector: string, targetPropertyKeyOrOptions?: string | symbol | PropertyOptions, options?: PropertyOptions): MethodDecorator & PropertyDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n // ensureInit(target as any);\n \n const constructor = target.constructor;\n const metaType: 'property' | 'method' = descriptor && typeof descriptor.value === 'function' ? 'method' : 'property';\n \n // Parse arguments\n let finalOptions: PropertyOptions = {};\n let targetPropertyKey: string | symbol;\n \n if (typeof targetPropertyKeyOrOptions === 'string' || typeof targetPropertyKeyOrOptions === 'symbol') {\n // applyProperty('selector', 'propertyName', options?)\n targetPropertyKey = targetPropertyKeyOrOptions;\n finalOptions = options || {};\n } else if (targetPropertyKeyOrOptions) {\n // applyProperty('selector', options)\n finalOptions = targetPropertyKeyOrOptions;\n targetPropertyKey = finalOptions.name || propertyKey;\n } else {\n // applyProperty('selector')\n targetPropertyKey = propertyKey;\n }\n\n // Store metadata\n let metaList = ReflectUtils.getOwnMetadata(PROPERTY_METADATA_KEY, constructor) as PropertyMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(PROPERTY_METADATA_KEY, metaList, constructor);\n }\n metaList.push({\n propertyKey,\n selector,\n targetPropertyKey,\n options: finalOptions,\n type: metaType\n });\n\n // Helper: apply resolved value to targets\n const applyValueToTargets = (inst: any, resolvedValue: any) => {\n if (resolvedValue === undefined) return resolvedValue;\n\n const targetEls = resolvePropertyTargets(inst, selector, finalOptions);\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, inst);\n\n targetEls.forEach(targetEl => {\n // Apply filter if provided\n if (finalOptions.filter && !finalOptions.filter(targetEl, resolvedValue, { currentThis: inst, helper: hostSet })) {\n return;\n }\n\n const resolvedRes = typeof resolvedValue === 'function' ? (resolvedValue as any)(targetEl, hostSet) : resolvedValue;\n (targetEl as any)[targetPropertyKey] = resolvedRes;\n });\n\n return resolvedValue;\n };\n\n // Method decorator: wrap method to apply its return value to properties\n if (descriptor && typeof descriptor.value === 'function') {\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n const res = (original as any).apply(this, args);\n\n if (res instanceof Promise) {\n return res.then((v: any) => { applyValueToTargets(this, v); return v; });\n } else {\n applyValueToTargets(this, res);\n return res;\n }\n };\n return;\n }\n\n // Property decorator: define getter/setter to proxy to element properties\n Object.defineProperty(target, propertyKey, {\n configurable: true,\n enumerable: true,\n get(this: any) {\n ensureInit(this);\n // Read from matched elements\n const targetEls = resolvePropertyTargets(this, selector, finalOptions);\n const conf = getElementConfig(this);\n const currentWin = conf.window;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n\n // Apply filter\n const filtered = targetEls.filter(el => {\n if (finalOptions.filter && !finalOptions.filter(el, (el as any)[targetPropertyKey], { currentThis: this, helper: hostSet })) {\n return false;\n }\n return true;\n });\n\n const values = filtered.map(el => (el as any)[targetPropertyKey]);\n return values.length === 1 ? values[0] : values;\n },\n set(this: any, value: any) {\n ensureInit(this);\n applyValueToTargets(this, value);\n }\n });\n };\n}\n\n// ============================================\n// Convenience Aliases\n// ============================================\n\n/**\n * @property - Alias for @applyProperty\n */\nexport function property(selector: string, targetPropertyKey: string | symbol, options?: PropertyOptions): MethodDecorator & PropertyDecorator;\nexport function property(selector: string, options?: PropertyOptions): MethodDecorator & PropertyDecorator;\nexport function property(selector: string, targetPropertyKeyOrOptions?: string | symbol | PropertyOptions, options?: PropertyOptions): MethodDecorator & PropertyDecorator {\n return applyProperty(selector, targetPropertyKeyOrOptions as any, options);\n}\n\n/**\n * @propertyThis - Apply property on $this element\n * Can be used as: @propertyThis or @propertyThis('propertyName') or @propertyThis({ name: 'propertyName' })\n */\nexport function propertyThis(target: Object, propertyKey: string | symbol): void;\nexport function propertyThis(targetPropertyKey: string | symbol, options?: PropertyOptions): MethodDecorator & PropertyDecorator;\nexport function propertyThis(options?: PropertyOptions): MethodDecorator & PropertyDecorator;\nexport function propertyThis(targetOrOptions?: any, propertyKeyOrOptions?: any, descriptor?: PropertyDescriptor): any {\n // Direct decorator usage: @propertyThis\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null && !Array.isArray(targetOrOptions) && \n (typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol')) {\n // Called as @propertyThis (target, propertyKey)\n return applyProperty('$this', undefined as any, {})(targetOrOptions, propertyKeyOrOptions, descriptor);\n }\n \n // Called with parameters\n if (typeof targetOrOptions === 'string' || typeof targetOrOptions === 'symbol') {\n // @propertyThis('propertyName', options?)\n return applyProperty('$this', targetOrOptions, propertyKeyOrOptions);\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // @propertyThis({ name: 'propertyName' })\n return applyProperty('$this', undefined as any, targetOrOptions);\n } else {\n // @propertyThis() or @propertyThis\n return applyProperty('$this', undefined as any, {});\n }\n}\n\n/**\n * @setProperty - Alias for @applyProperty (method-decorator semantics)\n */\nexport function setProperty(selector: string, targetPropertyKey: string | symbol, options?: PropertyOptions): MethodDecorator;\nexport function setProperty(selector: string, options?: PropertyOptions): MethodDecorator;\nexport function setProperty(selector: string, targetPropertyKeyOrOptions?: string | symbol | PropertyOptions, options?: PropertyOptions): MethodDecorator {\n return applyProperty(selector, targetPropertyKeyOrOptions as any, options) as MethodDecorator;\n}\n\n/**\n * @setPropertyThis - Set property on $this element\n * Can be used as: @setPropertyThis or @setPropertyThis('propertyName') or @setPropertyThis({ name: 'propertyName' })\n */\nexport function setPropertyThis(target: Object, propertyKey: string | symbol): void;\nexport function setPropertyThis(targetPropertyKey: string | symbol, options?: PropertyOptions): MethodDecorator;\nexport function setPropertyThis(options?: PropertyOptions): MethodDecorator;\nexport function setPropertyThis(targetOrOptions?: any, propertyKeyOrOptions?: any, descriptor?: PropertyDescriptor): any {\n // Direct decorator usage: @setPropertyThis\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null && !Array.isArray(targetOrOptions) && \n (typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol')) {\n // Called as @setPropertyThis (target, propertyKey)\n return applyProperty('$this', undefined as any, {})(targetOrOptions, propertyKeyOrOptions, descriptor);\n }\n \n // Called with parameters\n if (typeof targetOrOptions === 'string' || typeof targetOrOptions === 'symbol') {\n // @setPropertyThis('propertyName', options?)\n return applyProperty('$this', targetOrOptions, propertyKeyOrOptions) as MethodDecorator;\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // @setPropertyThis({ name: 'propertyName' })\n return applyProperty('$this', undefined as any, targetOrOptions) as MethodDecorator;\n } else {\n // @setPropertyThis() or @setPropertyThis\n return applyProperty('$this', undefined as any, {}) as MethodDecorator;\n }\n}\n\n\n\n// ============================================\n// Metadata Helpers\n// ============================================\n\nexport const findAllPropertyMetadata = (target: any): PropertyMetadata[] => {\n const actualTarget = target instanceof Function ? target : target.constructor;\n return ReflectUtils.findAllMetadata<PropertyMetadata[]>(PROPERTY_METADATA_KEY, actualTarget).flat();\n};\n\n// Backward compatibility alias\nexport const findAllPropertyApplyMetadata = (target: any): Map<string | symbol, PropertyMetadata> => {\n const result = new Map<string | symbol, PropertyMetadata>();\n findAllPropertyMetadata(target).forEach(meta => {\n result.set(meta.propertyKey, meta);\n });\n return result;\n};\n\n\nexport default applyProperty;\n"],
5
+ "mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,wBAAwB;AAC7C,SAAS,gBAAgB;AAgBlB,MAAM,wBAAwB,OAAO,IAAI,+BAA+B;AAWxE,MAAM,yBAAyB,CAAC,MAAW,UAAkB,YAAoC;AACtG,QAAM,OAAO,iBAAiB,IAAI;AAClC,QAAM,aAAa,KAAK;AACxB,QAAM,IAAI,QAAQ,QAAQ;AAC1B,QAAM,UAAiB,CAAC;AAExB,QAAM,YAAY,CAAC,WAAgB;AACjC,QAAI,CAAC,OAAQ;AACb,QAAI,MAAM,QAAQ;AAChB,cAAQ,KAAK,MAAM;AAAA,IACrB,OAAO;AACL,UAAI,MAAM,WAAW,MAAM,MAAO,SAAQ,KAAK,MAAM;AACrD,WAAK,MAAM,YAAY,MAAM,UAAU,OAAO,WAAY,SAAQ,KAAK,OAAO,UAAU;AAAA,IAC1F;AAAA,EACF;AAEA,MAAI,aAAa,WAAW,CAAC,UAAU;AACrC,cAAU,IAAI;AAAA,EAChB,WAAW,aAAa,WAAW;AACjC,YAAQ,KAAK,UAAU;AAAA,EACzB,WAAW,aAAa,aAAa;AACnC,YAAQ,KAAK,WAAW,QAAQ;AAAA,EAClC,OAAO;AACL,UAAM,UAAU,SAAS,WAAW,IAAI;AACxC,QAAI,aAAa,QAAS,WAAU,QAAQ,KAAK;AAAA,aACxC,aAAa,cAAe,WAAU,QAAQ,WAAW;AAAA,aACzD,aAAa,WAAY,WAAU,QAAQ,QAAe;AAAA,aAC1D,aAAa,aAAc,WAAU,QAAQ,UAAU;AAAA,aACvD,aAAa,YAAa,WAAU,QAAQ,SAAS;AAAA,aACrD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gBAAgB,iBAAuB,sBAA4B,YAAsC;AAEvH,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,QAAQ,CAAC,MAAM,QAAQ,eAAe,MAChG,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,WAAW;AAE1F,WAAO,cAAc,SAAS,QAAkB,CAAC,CAAC,EAAE,iBAAiB,sBAAsB,UAAU;AAAA,EACvG;AAGA,MAAI,OAAO,oBAAoB,YAAY,OAAO,oBAAoB,UAAU;AAE9E,WAAO,cAAc,SAAS,iBAAiB,oBAAoB;AAAA,EACrE,WAAW,mBAAmB,OAAO,oBAAoB,UAAU;AAEjE,WAAO,cAAc,SAAS,QAAkB,eAAe;AAAA,EACjE,OAAO;AAEL,WAAO,cAAc,SAAS,QAAkB,CAAC,CAAC;AAAA,EACpD;AACF;AAQO,MAAM,0BAA0B,CAAC,WAAoC;AAC1E,QAAM,eAAe,kBAAkB,WAAW,SAAS,OAAO;AAClE,SAAO,aAAa,gBAAoC,uBAAuB,YAAY,EAAE,KAAK;AACpG;AAGO,MAAM,+BAA+B,CAAC,WAAwD;AACnG,QAAM,SAAS,oBAAI,IAAuC;AAC1D,0BAAwB,MAAM,EAAE,QAAQ,UAAQ;AAC9C,WAAO,IAAI,KAAK,aAAa,IAAI;AAAA,EACnC,CAAC;AACD,SAAO;AACT;AAGA,IAAO,wBAAQ;",
6
+ "names": []
7
+ }
@@ -17,7 +17,7 @@ const applyToDom = (swcId, id, pos, nodes) => {
17
17
  };
18
18
  function applySlot(targetId, opt) {
19
19
  return (targetObj, propertyKey, descriptor) => {
20
- const options = { position: "replaceChildrenHtml", ...opt };
20
+ const options = { position: "replaceChildren", ...opt };
21
21
  const constructor = targetObj.constructor;
22
22
  let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor);
23
23
  if (!metaList) {
@@ -69,47 +69,53 @@ function applySlot(targetId, opt) {
69
69
  };
70
70
  };
71
71
  }
72
- const findAllApplySlotMetadata = (target) => {
73
- const constructor = target instanceof Function ? target : target.constructor;
74
- return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
75
- };
76
- function applySlotClear(targetId) {
72
+ function clearSlot(targetId) {
77
73
  return applySlot(targetId, { position: "clear" });
78
74
  }
79
- function applySlotPrependHtml(targetId) {
75
+ function prependHtmlSlot(targetId) {
80
76
  return applySlot(targetId, { position: "prependHtml" });
81
77
  }
82
- const applySlotPrepend = applySlotPrependHtml;
83
- function applySlotPrependText(targetId) {
78
+ function prependSlot(targetId) {
79
+ return applySlot(targetId, { position: "prepend" });
80
+ }
81
+ function prependTextSlot(targetId) {
84
82
  return applySlot(targetId, { position: "prependText" });
85
83
  }
86
- function applySlotAppendHtml(targetId) {
84
+ function appendHtmlSlot(targetId) {
87
85
  return applySlot(targetId, { position: "appendHtml" });
88
86
  }
89
- function applySlotAppendText(targetId) {
87
+ function appendTextSlot(targetId) {
90
88
  return applySlot(targetId, { position: "appendText" });
91
89
  }
92
- const applySlotAppend = applySlotAppendHtml;
93
- function applySlotReplaceChildrenHtml(targetId) {
90
+ function appendSlot(targetId) {
91
+ return applySlot(targetId, { position: "append" });
92
+ }
93
+ function replaceChildrenHtmlSlot(targetId) {
94
94
  return applySlot(targetId, { position: "replaceChildrenHtml" });
95
95
  }
96
- const applySlotReplaceChildren = applySlotReplaceChildrenHtml;
97
- function applySlotReplaceChildrenText(targetId) {
96
+ function replaceChildrenSlot(targetId) {
97
+ return applySlot(targetId, { position: "replaceChildren" });
98
+ }
99
+ function replaceChildrenTextSlot(targetId) {
98
100
  return applySlot(targetId, { position: "replaceChildrenText" });
99
101
  }
102
+ const findAllApplySlotMetadata = (target) => {
103
+ const constructor = target instanceof Function ? target : target.constructor;
104
+ return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);
105
+ };
100
106
  export {
101
107
  APPLY_SLOT_METADATA_KEY,
108
+ appendHtmlSlot,
109
+ appendSlot,
110
+ appendTextSlot,
102
111
  applySlot,
103
- applySlotAppend,
104
- applySlotAppendHtml,
105
- applySlotAppendText,
106
- applySlotClear,
107
- applySlotPrepend,
108
- applySlotPrependHtml,
109
- applySlotPrependText,
110
- applySlotReplaceChildren,
111
- applySlotReplaceChildrenHtml,
112
- applySlotReplaceChildrenText,
113
- findAllApplySlotMetadata
112
+ clearSlot,
113
+ findAllApplySlotMetadata,
114
+ prependHtmlSlot,
115
+ prependSlot,
116
+ prependTextSlot,
117
+ replaceChildrenHtmlSlot,
118
+ replaceChildrenSlot,
119
+ replaceChildrenTextSlot
114
120
  };
115
121
  //# sourceMappingURL=applySlot.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/applySlot.ts"],
4
- "sourcesContent": ["import {OptionalType, ReflectUtils} from '@dooboostore/core';\nimport {ensureInit, getElementConfig} from './elementDefine';\nimport {SwcUtils} from \"../utils/Utils\";\nimport {NodeSlot} from \"@dooboostore/core-web\";\nimport {HelperHostSet} from \"../types\";\n/*\n<!-- beforebegin -->\n<p> <-- it's me\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplySlotPosition = 'prepend' | 'prependHtml' | 'prependText' | 'append' | 'appendHtml' | 'appendText' | 'replaceChildren' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';\n\nexport interface ApplySlotOptions {\n position: ApplySlotPosition;\n fallback?: (helper: HelperHostSet) => string | Node;\n // root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n // filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n // loading?: (helper: HelperHostSet) => any;\n}\n\nexport interface ApplySlotMetadata {\n propertyKey: string | symbol;\n targetId: string;\n // type: 'method' | 'property';\n options: ApplySlotOptions;\n}\n\nexport const APPLY_SLOT_METADATA_KEY = Symbol.for('simple-web-component:apply-slot');\n\n// const normalizeNodes = (res: any, doc: Document): Node[] => {\n// const items = Array.isArray(res) ? res : [res];\n// return items.map(it => {\n// if (it instanceof Node) return it;\n// return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n// });\n// };\n\n// const applyToDom = (targetEl: any, res: any, pos: ApplyNodePosition, win: Window) => {\n// if (!targetEl) return;\n//\n// const doc = win.document;\n//\n// if (pos === 'innerHtml') {\n// targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';\n// return;\n// }\n//\n// if (pos === 'innerText') {\n// if (targetEl.innerText !== undefined) {\n// targetEl.innerText = res !== undefined && res !== null ? String(res) : '';\n// }\n// return;\n// }\n//\n// const isShadowRoot = targetEl instanceof win.ShadowRoot;\n// const nodes = normalizeNodes(res, doc);\n// if (pos === 'replace') {\n// if (!isShadowRoot) targetEl.replaceWith(...nodes);\n// } else if (pos === 'replaceChildren') {\n// targetEl.replaceChildren(...nodes);\n// } else {\n// if (pos === 'beforeEnd') targetEl.append(...nodes);\n// else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n// else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n// else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n// }\n// };\n\nconst applyToDom = (swcId: string, id: string, pos: ApplySlotPosition, nodes: Node[]) => {\n const nodeSlot = new NodeSlot(this, swcId);\n if (pos === 'replaceChildrenText' || pos === 'replaceChildren' || pos === 'replaceChildrenHtml') {\n nodeSlot.replaceChildren(id, ...nodes);\n } else if (pos === 'appendHtml' || pos === 'append' || pos === 'appendText') {\n nodeSlot.append(id, ...nodes);\n } else if (pos === 'prependHtml' || pos === 'prepend' || pos === 'prependText') {\n nodeSlot.prepend(id, ...nodes);\n } else if (pos === 'clear') {\n nodeSlot.clear(id);\n }\n}\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n */\nexport function applySlot(targetId: string, opt: OptionalType<ApplySlotOptions, 'position'>): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {\n\n\n const options: ApplySlotOptions = {position: 'replaceChildrenHtml', ...opt};\n\n\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor) as ApplySlotMetadata[];\n if (!metaList) {\n metaList = []\n ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);\n }\n metaList.push({propertyKey, targetId, options});\n\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n\n const conf = getElementConfig(this);\n const currentWin = conf.window;\n const swcId = this._swcId;\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n const pos = options.position;\n\n const resToNodes = (res: string | Node) => {\n const nodes: Node[] = [];\n\n if (typeof res === 'string' && (pos === 'replaceChildrenHtml' || pos === 'appendHtml' || pos === 'prependHtml')) {\n const t = currentWin.document.createElement('template');\n t.innerHTML = res;\n nodes.push(...Array.from(t.content.childNodes));\n } else if (typeof res === 'string' && (pos === 'replaceChildrenText' || pos === 'prependText' || pos === 'appendText')) {\n nodes.push(currentWin.document.createTextNode(res));\n } else if (typeof res === 'object') {\n nodes.push(res);\n }\n SwcUtils.projectProcessHtml(swcId, nodes, currentDoc);\n return nodes;\n }\n\n const fallbackNodes: Node[] = [];\n if (options.fallback) {\n const res: string | Node = options.fallback.call(this, hostSet);\n const nodes: Node[] = resToNodes(res);\n fallbackNodes.push(...nodes);\n applyToDom(swcId, targetId, options.position, nodes);\n }\n\n let res = original.apply(this, args);\n if (res instanceof Promise) {\n return res.then(asyncRes => {\n const nodes = resToNodes(asyncRes)\n fallbackNodes.forEach((it: any)=>it.remove());\n applyToDom(swcId, targetId, options.position, nodes);\n })\n } else {\n const nodes: Node[] = resToNodes(res);\n applyToDom(swcId, targetId, options.position, nodes);\n }\n };\n };\n}\n\n// export const findAllApplySlotMetadata = (target: any): Map<string | symbol, ApplySlotMetadata> => {\nexport const findAllApplySlotMetadata = (target: any): ApplySlotMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);\n};\n\nexport function applySlotClear(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'clear'});\n}\n\nexport function applySlotPrependHtml(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'prependHtml'});\n}\n\nexport const applySlotPrepend = applySlotPrependHtml;\n\nexport function applySlotPrependText(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'prependText'});\n}\n\nexport function applySlotAppendHtml(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'appendHtml'});\n}\n\nexport function applySlotAppendText(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'appendText'});\n}\n\nexport const applySlotAppend = applySlotAppendHtml;\n\nexport function applySlotReplaceChildrenHtml(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'replaceChildrenHtml'});\n}\n\nexport const applySlotReplaceChildren = applySlotReplaceChildrenHtml;\n\nexport function applySlotReplaceChildrenText(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'replaceChildrenText'});\n}\n"],
5
- "mappings": "AAAA,SAAsB,oBAAmB;AACzC,SAAQ,YAAY,wBAAuB;AAC3C,SAAQ,gBAAe;AACvB,SAAQ,gBAAe;AAmChB,MAAM,0BAA0B,OAAO,IAAI,iCAAiC;AAyCnF,MAAM,aAAa,CAAC,OAAe,IAAY,KAAwB,UAAkB;AACvF,QAAM,WAAW,IAAI,SAAS,QAAM,KAAK;AACzC,MAAI,QAAQ,yBAAyB,QAAQ,qBAAqB,QAAQ,uBAAuB;AAC/F,aAAS,gBAAgB,IAAI,GAAG,KAAK;AAAA,EACvC,WAAW,QAAQ,gBAAgB,QAAQ,YAAY,QAAQ,cAAc;AAC3E,aAAS,OAAO,IAAI,GAAG,KAAK;AAAA,EAC9B,WAAW,QAAQ,iBAAiB,QAAQ,aAAa,QAAQ,eAAe;AAC9E,aAAS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AAC,UAAU,sBAAqB,CAAC;AAC9D;AAEO,MAAM,2BAA2B;AAEjC,SAAS,6BAA6B,UAAmC;AAC9E,SAAO,UAAU,UAAU,EAAC,UAAU,sBAAqB,CAAC;AAC9D;",
4
+ "sourcesContent": ["import {OptionalType, ReflectUtils} from '@dooboostore/core';\nimport {ensureInit, getElementConfig} from './elementDefine';\nimport {SwcUtils} from \"../utils/Utils\";\nimport {NodeSlot} from \"@dooboostore/core-web\";\nimport {HelperHostSet} from \"../types\";\n/*\n<!-- beforebegin -->\n<p> <-- it's me\n <!-- afterbegin -->\n foo\n <!-- beforeend -->\n</p>\n<!-- afterend -->\n */\nexport type ApplySlotPosition = 'prepend' | 'prependHtml' | 'prependText' | 'append' | 'appendHtml' | 'appendText' | 'replaceChildren' | 'replaceChildrenHtml' | 'replaceChildrenText' | 'clear';\n\nexport interface ApplySlotOptions {\n position: ApplySlotPosition;\n fallback?: (helper: HelperHostSet) => string | Node;\n // root?: SwcRootType;\n /**\n * Filter function to determine whether to perform DOM operation.\n * If it returns false, the operation is skipped.\n */\n // filter?: (target: HTMLElement | ShadowRoot, newValue: any, meta:{currentThis: any,helper: HelperHostSet}) => boolean;\n /**\n * Optional loading content to display while an async method is executing.\n */\n // loading?: (helper: HelperHostSet) => any;\n}\n\nexport interface ApplySlotMetadata {\n propertyKey: string | symbol;\n targetId: string;\n // type: 'method' | 'property';\n options: ApplySlotOptions;\n}\n\nexport const APPLY_SLOT_METADATA_KEY = Symbol.for('simple-web-component:apply-slot');\n\n// const normalizeNodes = (res: any, doc: Document): Node[] => {\n// const items = Array.isArray(res) ? res : [res];\n// return items.map(it => {\n// if (it instanceof Node) return it;\n// return doc.createTextNode(it !== undefined && it !== null ? String(it) : '');\n// });\n// };\n\n// const applyToDom = (targetEl: any, res: any, pos: ApplyNodePosition, win: Window) => {\n// if (!targetEl) return;\n//\n// const doc = win.document;\n//\n// if (pos === 'innerHtml') {\n// targetEl.innerHTML = res !== undefined && res !== null ? String(res) : '';\n// return;\n// }\n//\n// if (pos === 'innerText') {\n// if (targetEl.innerText !== undefined) {\n// targetEl.innerText = res !== undefined && res !== null ? String(res) : '';\n// }\n// return;\n// }\n//\n// const isShadowRoot = targetEl instanceof win.ShadowRoot;\n// const nodes = normalizeNodes(res, doc);\n// if (pos === 'replace') {\n// if (!isShadowRoot) targetEl.replaceWith(...nodes);\n// } else if (pos === 'replaceChildren') {\n// targetEl.replaceChildren(...nodes);\n// } else {\n// if (pos === 'beforeEnd') targetEl.append(...nodes);\n// else if (pos === 'afterBegin') targetEl.prepend(...nodes);\n// else if (pos === 'beforeBegin' && !isShadowRoot) targetEl.before(...nodes);\n// else if (pos === 'afterEnd' && !isShadowRoot) targetEl.after(...nodes);\n// }\n// };\n\nconst applyToDom = (swcId: string, id: string, pos: ApplySlotPosition, nodes: Node[]) => {\n const nodeSlot = new NodeSlot(this, swcId);\n if (pos === 'replaceChildrenText' || pos === 'replaceChildren' || pos === 'replaceChildrenHtml') {\n nodeSlot.replaceChildren(id, ...nodes);\n } else if (pos === 'appendHtml' || pos === 'append' || pos === 'appendText') {\n nodeSlot.append(id, ...nodes);\n } else if (pos === 'prependHtml' || pos === 'prepend' || pos === 'prependText') {\n nodeSlot.prepend(id, ...nodes);\n } else if (pos === 'clear') {\n nodeSlot.clear(id);\n }\n}\n\n/**\n * @applyNode decorator to surgically add/replace nodes to a target element.\n */\nexport function applySlot(targetId: string, opt: OptionalType<ApplySlotOptions, 'position'>): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {\n\n\n const options: ApplySlotOptions = {position: 'replaceChildren', ...opt};\n\n\n const constructor = targetObj.constructor;\n let metaList = ReflectUtils.getOwnMetadata(APPLY_SLOT_METADATA_KEY, constructor) as ApplySlotMetadata[];\n if (!metaList) {\n metaList = []\n ReflectUtils.defineMetadata(APPLY_SLOT_METADATA_KEY, metaList, constructor);\n }\n metaList.push({propertyKey, targetId, options});\n\n\n const original = descriptor.value;\n descriptor.value = function (...args: any[]) {\n ensureInit(this);\n\n const conf = getElementConfig(this);\n const currentWin = conf.window;\n const swcId = this._swcId;\n const currentDoc = currentWin.document;\n const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);\n const pos = options.position;\n\n const resToNodes = (res: string | Node) => {\n const nodes: Node[] = [];\n\n if (typeof res === 'string' && (pos === 'replaceChildrenHtml' || pos === 'appendHtml' || pos === 'prependHtml')) {\n const t = currentWin.document.createElement('template');\n t.innerHTML = res;\n nodes.push(...Array.from(t.content.childNodes));\n } else if (typeof res === 'string' && (pos === 'replaceChildrenText' || pos === 'prependText' || pos === 'appendText')) {\n nodes.push(currentWin.document.createTextNode(res));\n } else if (typeof res === 'object') {\n nodes.push(res);\n }\n SwcUtils.projectProcessHtml(swcId, nodes, currentDoc);\n return nodes;\n }\n\n const fallbackNodes: Node[] = [];\n if (options.fallback) {\n const res: string | Node = options.fallback.call(this, hostSet);\n const nodes: Node[] = resToNodes(res);\n fallbackNodes.push(...nodes);\n applyToDom(swcId, targetId, options.position, nodes);\n }\n\n let res = original.apply(this, args);\n if (res instanceof Promise) {\n return res.then(asyncRes => {\n const nodes = resToNodes(asyncRes)\n fallbackNodes.forEach((it: any) => it.remove());\n applyToDom(swcId, targetId, options.position, nodes);\n })\n } else {\n const nodes: Node[] = resToNodes(res);\n applyToDom(swcId, targetId, options.position, nodes);\n }\n };\n };\n}\n\nexport function clearSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'clear'});\n}\n\nexport function prependHtmlSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'prependHtml'});\n}\n\nexport function prependSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'prepend'});\n}\n\nexport function prependTextSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'prependText'});\n}\n\nexport function appendHtmlSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'appendHtml'});\n}\n\nexport function appendTextSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'appendText'});\n}\n\nexport function appendSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'append'});\n}\n\nexport function replaceChildrenHtmlSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'replaceChildrenHtml'});\n}\n\nexport function replaceChildrenSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'replaceChildren'});\n}\n\nexport function replaceChildrenTextSlot(targetId: string): MethodDecorator {\n return applySlot(targetId, {position: 'replaceChildrenText'});\n}\n\n// export const findAllApplySlotMetadata = (target: any): Map<string | symbol, ApplySlotMetadata> => {\nexport const findAllApplySlotMetadata = (target: any): ApplySlotMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(APPLY_SLOT_METADATA_KEY, constructor);\n};"],
5
+ "mappings": "AAAA,SAAsB,oBAAmB;AACzC,SAAQ,YAAY,wBAAuB;AAC3C,SAAQ,gBAAe;AACvB,SAAQ,gBAAe;AAmChB,MAAM,0BAA0B,OAAO,IAAI,iCAAiC;AAyCnF,MAAM,aAAa,CAAC,OAAe,IAAY,KAAwB,UAAkB;AACvF,QAAM,WAAW,IAAI,SAAS,QAAM,KAAK;AACzC,MAAI,QAAQ,yBAAyB,QAAQ,qBAAqB,QAAQ,uBAAuB;AAC/F,aAAS,gBAAgB,IAAI,GAAG,KAAK;AAAA,EACvC,WAAW,QAAQ,gBAAgB,QAAQ,YAAY,QAAQ,cAAc;AAC3E,aAAS,OAAO,IAAI,GAAG,KAAK;AAAA,EAC9B,WAAW,QAAQ,iBAAiB,QAAQ,aAAa,QAAQ,eAAe;AAC9E,aAAS,QAAQ,IAAI,GAAG,KAAK;AAAA,EAC/B,WAAW,QAAQ,SAAS;AAC1B,aAAS,MAAM,EAAE;AAAA,EACnB;AACF;AAKO,SAAS,UAAU,UAAkB,KAAkE;AAC5G,SAAO,CAAC,WAAmB,aAA8B,eAA6C;AAGpG,UAAM,UAA4B,EAAC,UAAU,mBAAmB,GAAG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,WAAqC;AAC5E,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,yBAAyB,WAAW;AACtE;",
6
6
  "names": ["res"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/changedAttributeThis.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\nexport const ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for('simple-web-component:on-attribute-changed');\n\nexport interface ChangedAttributeThisOptions {\n type?: typeof Number | typeof Boolean | typeof String;\n while?: 'connected';\n}\n\nexport interface ChangedAttributeThisMetadata {\n attributeName: string;\n propertyKey: string | symbol;\n options: ChangedAttributeThisOptions;\n}\n\nconst convertValue = (val: any, type: any): any => {\n if (val === null || val === undefined) return val;\n if (type === Number) return Number(val);\n if (type === Boolean) return val === 'false' || val === '0' ? false : true;\n return val;\n};\n\n/**\n * @changedAttributeThis decorator - fires when any attribute on $this changes\n */\nexport function changedAttributeThis(attributeName?: string, options: ChangedAttributeThisOptions = {}): MethodDecorator {\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) as ChangedAttributeThisMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, metaList, constructor);\n }\n\n const name = attributeName || String(propertyKey);\n metaList.push({\n attributeName: name,\n propertyKey,\n options\n });\n };\n}\n\nexport const getChangedAttributeMetadata = (target: any): ChangedAttributeThisMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);\n};\n\nexport const findAllAttributeChangedMetadata = (target: any): Map<string, ChangedAttributeThisMetadata[]> => {\n const constructor = target instanceof Function ? target : target.constructor;\n const metaList = ReflectUtils.findAllMetadata<ChangedAttributeThisMetadata[]>(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) || [];\n\n const result = new Map<string, ChangedAttributeThisMetadata[]>();\n metaList.forEach(meta => {\n meta.forEach(item => {\n if (!result.has(item.attributeName)) {\n result.set(item.attributeName, []);\n }\n result.get(item.attributeName)!.push(item);\n });\n });\n return result;\n};\n\nexport const convertAttributeValue = (val: any, type?: typeof Number | typeof Boolean | typeof String): any => {\n return convertValue(val, type);\n};\n"],
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\nexport const ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for('simple-web-component:on-attribute-changed');\n\nexport interface ChangedAttributeThisOptions {\n type?: typeof Number | typeof Boolean | typeof String;\n while?: 'connected';\n}\n\nexport interface ChangedAttributeThisMetadata {\n attributeName: string;\n propertyKey: string | symbol;\n options: ChangedAttributeThisOptions;\n}\n\nconst convertValue = (val: any, type: any): any => {\n if (val === null || val === undefined) return val;\n if (type === Number) return Number(val);\n if (type === Boolean) return val === 'false' || val === '0' ? false : true;\n return val;\n};\n\n/**\n * @changedAttributeThis decorator - fires when any attribute on $this changes\n */\nexport function changedAttributeThis(attributeName?: string, options: ChangedAttributeThisOptions = {}): MethodDecorator {\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let metaList = ReflectUtils.getOwnMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) as ChangedAttributeThisMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, metaList, constructor);\n }\n\n const name = attributeName || String(propertyKey);\n metaList.push({\n attributeName: name,\n propertyKey,\n options\n });\n };\n}\n\nexport const getChangedAttributeMetadata = (target: any): ChangedAttributeThisMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor);\n};\n\nexport const findAllAttributeChangedMetadata = (target: any): Map<string, ChangedAttributeThisMetadata[]> => {\n const constructor = target instanceof Function ? target : target.constructor;\n const metaList = ReflectUtils.findAllMetadata<ChangedAttributeThisMetadata[]>(ON_ATTRIBUTE_CHANGED_METADATA_KEY, constructor) || [];\n\n const result = new Map<string, ChangedAttributeThisMetadata[]>();\n metaList.forEach(meta => {\n meta.forEach(item => {\n if (!result.has(item.attributeName)) {\n result.set(item.attributeName, []);\n }\n result.get(item.attributeName)!.push(item);\n });\n });\n return result;\n};\n\nexport const convertAttributeValue = (val: any, type?: typeof Number | typeof Boolean | typeof String): any => {\n return convertValue(val, type);\n};\n"],
5
5
  "mappings": "AAAA,SAAS,oBAAoB;AAEtB,MAAM,oCAAoC,OAAO,IAAI,2CAA2C;AAavG,MAAM,eAAe,CAAC,KAAU,SAAmB;AACjD,MAAI,QAAQ,QAAQ,QAAQ,OAAW,QAAO;AAC9C,MAAI,SAAS,OAAQ,QAAO,OAAO,GAAG;AACtC,MAAI,SAAS,QAAS,QAAO,QAAQ,WAAW,QAAQ,MAAM,QAAQ;AACtE,SAAO;AACT;AAKO,SAAS,qBAAqB,eAAwB,UAAuC,CAAC,GAAoB;AACvH,SAAO,CAAC,QAAgB,gBAAiC;AACvD,UAAM,cAAc,OAAO;AAC3B,QAAI,WAAW,aAAa,eAAe,mCAAmC,WAAW;AACzF,QAAI,CAAC,UAAU;AACb,iBAAW,CAAC;AACZ,mBAAa,eAAe,mCAAmC,UAAU,WAAW;AAAA,IACtF;AAEA,UAAM,OAAO,iBAAiB,OAAO,WAAW;AAChD,aAAS,KAAK;AAAA,MACZ,eAAe;AAAA,MACf;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAEO,MAAM,8BAA8B,CAAC,WAA4D;AACtG,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,mCAAmC,WAAW;AAChF;AAEO,MAAM,kCAAkC,CAAC,WAA6D;AAC3G,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,QAAM,WAAW,aAAa,gBAAgD,mCAAmC,WAAW,KAAK,CAAC;AAElI,QAAM,SAAS,oBAAI,IAA4C;AAC/D,WAAS,QAAQ,UAAQ;AACvB,SAAK,QAAQ,UAAQ;AACnB,UAAI,CAAC,OAAO,IAAI,KAAK,aAAa,GAAG;AACnC,eAAO,IAAI,KAAK,eAAe,CAAC,CAAC;AAAA,MACnC;AACA,aAAO,IAAI,KAAK,aAAa,EAAG,KAAK,IAAI;AAAA,IAC3C,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;AAEO,MAAM,wBAAwB,CAAC,KAAU,SAA+D;AAC7G,SAAO,aAAa,KAAK,IAAI;AAC/B;",
6
6
  "names": []
7
7
  }
@@ -3,17 +3,17 @@ import { getAddEventListenerMetadata } from "./addEventListener.js";
3
3
  import { findAllLifecycleMetadata, findAllOnConnectedAfterMetadata, findAllOnConnectedBeforeMetadata, findAllOnConnectedMetadata, ON_AFTER_ADOPTED_METADATA_KEY, ON_AFTER_DISCONNECTED_METADATA_KEY, ON_BEFORE_ADOPTED_METADATA_KEY, ON_BEFORE_DISCONNECTED_METADATA_KEY, ON_CONNECTED_COMPLETED_METADATA_KEY, ON_INITIALIZE_METADATA_KEY } from "./lifecycles.js";
4
4
  import { getEmitCustomEventMetadataList } from "./emitCustomEvent.js";
5
5
  import { convertAttributeValue, findAllAttributeChangedMetadata } from "./changedAttributeThis.js";
6
- import { findAllAttributeApplyMetadata } from "./applyAttribute.js";
7
- import { findAllAttributeMetadata, getAttributeValue } from "./attribute.js";
6
+ import { findAllAttributeApplyMetadata, findAllAttributeMetadata, getAttributeValue } from "./applyAttribute.js";
8
7
  import { getQueryMetadata } from "./query.js";
9
8
  import { getQueryAllMetadata } from "./queryAll.js";
10
9
  import { SwcUtils } from "../utils/Utils.js";
11
10
  import { DOM_EVENT_NAMES, HTML_TAG_ENTRIES } from "../config/config.js";
12
11
  import { SituationTypeContainer, SituationTypeContainers } from "@dooboostore/simple-boot/decorators/inject/Inject";
13
12
  import { InjectSituationType } from "../types/index.js";
14
- import { ConvertUtils, ElementApply, NodeSlot } from "@dooboostore/core-web";
13
+ import { ConvertUtils, ElementApply } from "@dooboostore/core-web";
15
14
  import { isSSR } from "../elements/SwcAppMixin.js";
16
15
  import { findAllStateMetadata } from "./state.js";
16
+ import { findAllPropertyMetadata } from "./applyProperty.js";
17
17
  const ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
18
18
  const getElementConfig = (target) => {
19
19
  const constructor = target instanceof Function ? target : target.constructor;
@@ -26,13 +26,12 @@ const ensureInit = (inst) => {
26
26
  inst._boundListeners = [];
27
27
  inst.__swc_initialized = true;
28
28
  const target = inst instanceof Function ? inst : inst.constructor;
29
- const attributeList = findAllAttributeMetadata(target);
30
- attributeList.forEach((meta) => {
31
- const initUserData = inst[meta.propertyKey];
32
- delete inst[meta.propertyKey];
33
- if (initUserData !== void 0)
34
- inst[meta.propertyKey] = initUserData;
35
- });
29
+ const attributeAllList = findAllAttributeMetadata(target).filter((it) => it.type === "property");
30
+ if (attributeAllList) {
31
+ attributeAllList.forEach((meta) => {
32
+ delete inst[meta.propertyKey];
33
+ });
34
+ }
36
35
  const queryList = getQueryMetadata(target);
37
36
  if (queryList) {
38
37
  queryList.forEach((meta) => {
@@ -45,6 +44,12 @@ const ensureInit = (inst) => {
45
44
  delete inst[meta.propertyKey];
46
45
  });
47
46
  }
47
+ const propertyAllList = findAllPropertyMetadata(target).filter((it) => it.type === "property");
48
+ if (propertyAllList) {
49
+ propertyAllList.forEach((meta) => {
50
+ delete inst[meta.propertyKey];
51
+ });
52
+ }
48
53
  const stateAllList = findAllStateMetadata(target);
49
54
  if (stateAllList) {
50
55
  stateAllList.forEach((meta) => {
@@ -98,24 +103,6 @@ const getHandlers = (inst) => {
98
103
  const setupPrototype = (proto, win) => {
99
104
  if (proto.__swc_proto_setup) return;
100
105
  proto.__swc_proto_setup = true;
101
- proto.createSlotString = function(id) {
102
- return NodeSlot.slot(`${this._swcId}-${id}`);
103
- };
104
- proto.createEaHtml = function(id, script) {
105
- return ElementApply.html(id, script);
106
- };
107
- proto.createEaText = function(id, script) {
108
- return ElementApply.text(id, script);
109
- };
110
- proto.createEaAttribute = function(id, name, script) {
111
- return ElementApply.attribute(id, name, script);
112
- };
113
- proto.createEaEvent = function(id, name, script) {
114
- return ElementApply.event(id, name, script);
115
- };
116
- proto.createEaProperty = function(id, name, script) {
117
- return ElementApply.property(id, name, script);
118
- };
119
106
  proto._executeSwcScript = function(attrName, hostSet, extraArgs = {}) {
120
107
  ensureInit(this);
121
108
  const script = this.getAttribute(attrName);
@@ -245,8 +232,8 @@ const elementDefine = (name, config = {}) => (constructor) => {
245
232
  const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
246
233
  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"];
247
234
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
248
- const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
249
- const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.options.name || String(it.propertyKey));
235
+ const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.targetAttributeName).filter(Boolean);
236
+ const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.propertyKey || String(it.propertyKey));
250
237
  const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
251
238
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
252
239
  const proto = constructor.prototype;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/elementDefine.ts"],
4
- "sourcesContent": ["import {ActionExpression, FunctionUtils, ReflectUtils} from '@dooboostore/core';\nimport {getAddEventListenerMetadata} from './addEventListener';\nimport {findAllLifecycleMetadata, findAllOnConnectedAfterMetadata, findAllOnConnectedBeforeMetadata, findAllOnConnectedMetadata, ON_AFTER_ADOPTED_METADATA_KEY, ON_AFTER_DISCONNECTED_METADATA_KEY, ON_BEFORE_ADOPTED_METADATA_KEY, ON_BEFORE_DISCONNECTED_METADATA_KEY, ON_CONNECTED_COMPLETED_METADATA_KEY, ON_INITIALIZE_METADATA_KEY} from './lifecycles';\nimport {getEmitCustomEventMetadataList} from './emitCustomEvent';\nimport {convertAttributeValue, findAllAttributeChangedMetadata} from './changedAttributeThis';\nimport {findAllAttributeApplyMetadata} from './applyAttribute';\nimport {findAllAttributeMetadata, getAttributeValue} from './attribute';\nimport {getQueryMetadata} from './query';\nimport {getQueryAllMetadata} from './queryAll';\nimport {SwcUtils} from '../utils/Utils';\nimport {DOM_EVENT_NAMES, HTML_TAG_ENTRIES} from '../config/config';\nimport {SituationTypeContainer, SituationTypeContainers} from '@dooboostore/simple-boot/decorators/inject/Inject';\nimport {HelperHostSet, HostSet, InjectSituationType} from '../types';\nimport {ConvertUtils, ElementApply, NodeSlot} from '@dooboostore/core-web';\nimport {isSSR} from \"../elements/SwcAppMixin\";\nimport {findAllApplySlotMetadata} from \"./applySlot\";\nimport {findAllStateMetadata} from \"./state\";\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 useShadow?: boolean | 'open' | 'closed';\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) => { // HTMLElement\n if (!inst.__swc_initialized) {\n inst._swcId = inst?.getAttribute?.('swc-use-ssr') ?? 's' + Math.random().toString(36).substring(2, 11).toLowerCase();\n inst._emitHandlers = new Map();\n inst._boundListeners = [];\n inst.__swc_initialized = true;\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: own property\uAC00 \uC788\uC73C\uBA74 prototype\uC758 getter/setter\uB294 \uC808\uB300 \uC548 \uD0C4\uB2E4 \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 @attributeThis('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 const initUserData = (inst as any)[meta.propertyKey];\n delete (inst as any)[meta.propertyKey];\n // undefined \uC774\uBA74\uC740 \uC678\uBD80 attribute string html\uC744 \uB9AC\uC2A4\uD329\uD55C\uB2E4\n if (initUserData !== undefined)\n (inst as any)[meta.propertyKey] = initUserData;\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 // const slotAllList = findAllApplySlotMetadata(target);\n // if (slotAllList) {\n // slotAllList.filter(it => it.type === 'property').forEach(meta => {\n // delete (inst as any)[meta.propertyKey];\n // });\n // }\n const stateAllList = findAllStateMetadata(target);\n if (stateAllList) {\n stateAllList.forEach(meta => {\n const initUserData = (inst as any)[meta.propertyKey];\n delete (inst as any)[meta.propertyKey];\n (inst as any)[meta.propertyKey] = initUserData;\n });\n }\n\n // Call constructor script if present\n const hostSet = SwcUtils.getHostSet(inst);\n const appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(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\n// \uD6D4 \uC774\uAC8C\uB9DE\uB098?? global\uB85C \uAD00\uB9AC\uD558\uB294\uAC8C..\uD6D4... \uC65C\uC774\uB807\uAC8C \uD588\uC744\uAE4C..\n// --- Global Event Handling ---\nconst globalDelegatedRoots = new WeakSet<Node>();\n// \uC5EC\uAE30\uC5D0\uC11C \uC911\uBCF5 \uD638\uCD9C\uC548\uB418\uAC8C \uC798\uB9C9\uC544\uC900\uB2E4 ..\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.findNearestSwcHostIncludingSelf(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;\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, win: Window) => {\n if (proto.__swc_proto_setup) return;\n proto.__swc_proto_setup = true;\n\n\n proto.createSlotString = function (id: string) {\n return NodeSlot.slot(`${this._swcId}-${id}`);\n }\n proto.createEaHtml = function (id: string, script: string) {\n return ElementApply.html(id, script);\n }\n proto.createEaText = function (id: string, script: string) {\n return ElementApply.text(id, script);\n }\n proto.createEaAttribute = function (id: string, name: string, script: string) {\n return ElementApply.attribute(id, name, script);\n }\n proto.createEaEvent = function (id: string, name: string, script: string) {\n return ElementApply.event(id, name, script);\n }\n proto.createEaProperty = function (id: string, name: string, script: string) {\n return ElementApply.property(id, name, script);\n }\n\n // swc-id-asdasdasdasd-click=\" :value=\"\" {: value fsdfsdafsad :} {html: aaa :} {text: asdas :}\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.findAllSwcHostsIncludingSelf(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 getElementConfig(this).window ?? ((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 useHostSet = hostSet ?? SwcUtils.getHelperAndHostSet(win, this);\n const app = useHostSet?.$appHost?.simpleApplication;\n // console.log('---->hh',app, this, methodName);\n if (app) {\n const otherStorage = new Map<any, any>();\n const situations = new SituationTypeContainers([new SituationTypeContainer({situationType: InjectSituationType.HOST_SET, data: useHostSet}), new SituationTypeContainer({situationType: InjectSituationType.APP_HOST, data: useHostSet.$appHost}), new SituationTypeContainer({situationType: InjectSituationType.APP_HOSTS, data: useHostSet.$appHosts}), new SituationTypeContainer({\n situationType: InjectSituationType.HOST,\n data: useHostSet.$host\n }), new SituationTypeContainer({situationType: InjectSituationType.HOSTS, data: useHostSet.$hosts}), new SituationTypeContainer({situationType: InjectSituationType.FIRST_HOST, data: useHostSet.$firstHost}), new SituationTypeContainer({situationType: InjectSituationType.LAST_HOST, data: useHostSet.$lastHost}), new SituationTypeContainer({\n situationType: InjectSituationType.FIRST_APP_HOST,\n data: useHostSet.$firstAppHost\n }), new SituationTypeContainer({situationType: InjectSituationType.LAST_APP_HOST, data: useHostSet.$lastAppHost})]);\n otherStorage.set(SituationTypeContainers, situations);\n\n return app.simstanceManager.executeBindParameterSim(\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 hostSet = SwcUtils.getHostSet(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 hostSet = SwcUtils.getHostSet(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 === '$this' || 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 const attributeApplyNames = Array.from(applyAttributeMap.values())\n .map(it => it.options.name)\n .filter(Boolean) as string[];\n const hostAttributes = attributeList.filter(it => it.selector === '$this').map(it => it.options.name || String(it.propertyKey));\n // Get original static observedAttributes before they're overwritten by Object.defineProperty\n const originalStaticObservedAttributes = (constructor.observedAttributes ?? []) as string[];\n const mergedObservedAttributes = [...new Set([...(metadata.observedAttributes ?? []), ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map(it => (it.options as any).attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];\n // const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];\n\n const proto = constructor.prototype;\n setupPrototype(proto, win);\n\n // \uAC12\uC744 \uAE30\uB300\uD558\uC9C0\uC54A\uB294\uB2E4.\n let helperHostSet: HelperHostSet | null = null;\n const originalConnected = proto.connectedCallback;\n proto.connectedCallback = async function () {\n ensureInit(this);\n // connected \uB410\uC744\uC2DC \uCD5C\uC2E0\uD654\n helperHostSet = SwcUtils.getHelperAndHostSet(win, this as any);\n const appHost = helperHostSet.$appHost;\n const useSsr = isSSR(this);\n // console.log('isSsr', useSsr, this);\n // console.log('----helperHostSet--->', this, helperHostSet, useSsr)\n // let connectedApp: SwcAppInterface |undefined;\n try {\n if (appHost && typeof (appHost as any)._connected === 'function') {\n await (appHost as any)._connected(this);\n } else if (appHost && typeof (appHost as any)) {\n (appHost as any)._connected_safari_and_standby ??= [];\n (appHost as any)._connected_safari_and_standby.push(this);\n }\n\n // const hostSet = SwcUtils.getHostSet(this as any);\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n\n const bMethods = findAllOnConnectedBeforeMetadata(this).filter(it => useSsr ? !it.options.ssrFirst : true);\n // console.log('beforeConnected', bMethods)\n if (bMethods) {\n for (const m of bMethods) await (this as any)._invokeLifecycleMethod(m.propertyKey, helperHostSet);\n }\n (this as any)._executeSwcScript('swc-on-before-connected', helperHostSet);\n\n // console.log('vvvvvvvvvvvvvvvu-seSsr-vvvvvvvvvv>', useSsr, this.tagName, this.getAttribute('seq'))\n // // ssr \uCC98\uB9AC\uB77C\uC11C \uC774\uBBF8 \uB0B4\uB824\uC900\uAC70\uADF8\uB300\uB85C \uC0C1\uC694\uD558\uBA74\uB41C\uB2E4 \uB530\uB77C\uC11C \uD638\uCD9C\uC548\uD55C\uB2E4\n const targetConnectedList = findAllOnConnectedMetadata(constructor).filter(it => useSsr ? !it.options.ssrFirst : true);\n const shadowMode = conf?.useShadow || targetConnectedList.find(it => it.options.useShadow)?.options.useShadow;\n // console.log('--------->', this.tagName, shadowMode && !this.shadowRoot)\n if (shadowMode && !this.shadowRoot) {\n const mode = shadowMode === true ? 'open' : shadowMode;\n console.log('tagName=', this.tagName, 'mode', mode, this.shadowRoot);\n // if (this.tagName!=='INDEX-ROUTER') {\n this.attachShadow({mode: mode as ShadowRootMode});\n // }\n }\n\n const stateContext: any = {...helperHostSet};\n findAllStateMetadata(this).forEach(it => {\n stateContext[it.name] = this[it.propertyKey]\n })\n\n const shadowChildren: Node[] = [];\n const lightChildren: Node[] = [];\n\n console.log('targetConnectList', this.tagName, targetConnectedList.length)\n if (targetConnectedList.length > 0) {\n // let sContent = '',\n // lContent = '';\n for (const meta of targetConnectedList) {\n // const res = (this as any)[meta.propertyKey]();\n let res = await (this as any)._invokeLifecycleMethod(meta.propertyKey, helperHostSet);\n // res = SwcUtils.projectProcessHtml(this, res);\n if (typeof res === 'string') {\n const htmlTemplateElement = doc.createElement('template');\n htmlTemplateElement.innerHTML = res;//SwcUtils.projectProcessHtml(this._swcId, res, doc);\n res = htmlTemplateElement.content;\n }\n\n if (res) {\n const nodes = Array.isArray(res) ? res : [res];\n if (meta.options.useShadow || conf?.useShadow) {\n shadowChildren.push(...nodes);\n }else {\n lightChildren.push(...nodes);\n }\n }\n }\n try {\n if (this.shadowRoot) {\n const applyShadowChildren = SwcUtils.projectProcessHtml(this._swcId, shadowChildren, doc);\n this.shadowRoot.replaceChildren(...applyShadowChildren)\n }\n if (lightChildren.length) {\n const applyLightChildren = SwcUtils.projectProcessHtml(this._swcId, lightChildren, doc);\n this.replaceChildren(...applyLightChildren)\n }\n\n } catch (e) {\n console.error('[ElementDefine] innerHTML setting error:', e);\n }\n new ElementApply(this, {id: this._swcId}).apply({context: stateContext, bind: this});\n } else {\n new ElementApply(this, {id: this._swcId}).apply({exclude: {html: true, text: true, attribute: true}, context: stateContext, bind: this});\n }\n\n // global delegate event\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\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 !== '$host' && meta.selector !== '$appHost' && meta.selector !== '$firstHost' && meta.selector !== '$lastHost' && meta.selector !== '$firstAppHost' && meta.selector !== '$lastAppHost' && meta.selector !== '$hosts' && meta.selector !== '$appHosts' && meta.selector !== '$this' && 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 // Apply filter if specified\n if (options.filter) {\n const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);\n if (!options.filter(event, helper)) {\n continue; // Skip this listener if filter returns false\n }\n }\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, $matchedElement: 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 === '$host') applyRootOption(helperHostSet.$host);\n else if (selector === '$parentHost') applyRootOption(helperHostSet.$parentHost);\n else if (selector === '$appHost') applyRootOption(helperHostSet.$appHost);\n else if (selector === '$firstHost') applyRootOption(helperHostSet.$firstHost);\n else if (selector === '$lastHost') applyRootOption(helperHostSet.$lastHost);\n else if (selector === '$firstAppHost') applyRootOption(helperHostSet.$firstAppHost);\n else if (selector === '$lastAppHost') applyRootOption(helperHostSet.$lastAppHost);\n else if (selector === '$hosts') helperHostSet.$hosts.forEach(applyRootOption);\n else if (selector === '$appHosts') helperHostSet.$appHosts.forEach(applyRootOption);\n else if (selector === '$this' || !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 // Apply filter if specified\n if (options.filter) {\n const helper = SwcUtils.getHelperAndHostSet(currentWin, t as HTMLElement);\n if (!options.filter(event, {currentThis: this, helper})) {\n return; // Skip if filter returns false\n }\n }\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, $$matchedElement: event.currentTarget}, args);\n };\n t.addEventListener(type, handler, opts);\n (this as any)._boundListeners.push({target: t, type, handler, options: opts});\n });\n });\n\n if (originalConnected) await (originalConnected.apply(this));\n\n const aMethods = findAllOnConnectedAfterMetadata(this).filter(it => {\n return useSsr ? !it.options.ssrFirst : true;\n });\n // console.log('afterConnected', this.tagName, aMethods, getOnConnectedAfterMetadata(this))\n if (aMethods) {\n for (const m of aMethods) await (this as any)._invokeLifecycleMethod(m.propertyKey, helperHostSet);\n }\n (this as any)._executeSwcScript('swc-on-connected', helperHostSet);\n (this as any)._executeSwcScript('swc-on-after-connected', helperHostSet);\n (this as any).__swc_connected = true;\n\n // Trigger @changedAttributeThis with while: 'connected'\n for (let [name, metaList] of Array.from(attrChangeMap)) {\n for (const meta of metaList) {\n if (meta.options.while === 'connected') {\n const val = getAttributeValue(this, name, {type: meta.options.type});\n if (val !== null) {\n await ((this as any)[meta.propertyKey](val, null, name, helperHostSet));\n }\n }\n }\n }\n } finally {\n for (let mPropertyKey of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) {\n await (this as any)._invokeLifecycleMethod(mPropertyKey, helperHostSet);\n }\n if (appHost && typeof (appHost as any)._connectedDone === 'function') {\n await (appHost as any)._connectedDone(this);\n }\n }\n };\n\n const originalDisconnected = proto.disconnectedCallback;\n proto.disconnectedCallback = function () {\n // const helperHostSet = SwcUtils.getHelperAndHostSet(win, this as any);\n // Remove from appHost LAST when disconnected\n // console.log('disconnnnnnnnnnnnnnnnnnn', helperHostSet, this)\n const appHost = helperHostSet.$appHost;\n if (appHost && typeof (appHost as any)._disconnected === 'function') {\n (appHost as any)._disconnected(this);\n }\n\n (this as any)._executeSwcScript('swc-on-before-disconnected', helperHostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);\n if (bMethods) {\n for (const m of bMethods) (this as any)._invokeLifecycleMethod(m, helperHostSet);\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 new ElementApply(this, {id: this._swcId}).removeAllEventListener();\n\n // globalDelegatedRoots remove\n // const roots = [this, this.getRootNode()];\n // if (this.shadowRoot) {\n // roots.push(this.shadowRoot);\n // }\n // roots.forEach(root => {\n // DOM_EVENT_NAMES.forEach(type => {\n // root.removeEventListener(type, handleGlobalSwcEvent);\n // });\n // }\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, helperHostSet);\n }\n (this as any)._executeSwcScript('swc-on-disconnected', helperHostSet);\n (this as any)._executeSwcScript('swc-on-after-disconnected', helperHostSet);\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 // Process expression directive before passing to handlers\n let processedVal: any = newVal;\n if (newVal !== null) {\n const ae = new ActionExpression(newVal);\n const expr = ae.getFirstExpression('callReturn');\n if (expr) {\n const win = (this as any)._resolveWindow?.() || ((typeof window !== 'undefined' ? window : undefined) as any);\n const helperAndHostSet = SwcUtils.getHelperAndHostSet(win, this as any);\n const script = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n try {\n const result = FunctionUtils.executeReturn({\n script: script,\n context: this,\n args: helperAndHostSet\n });\n // Pass the result object directly without serialization\n processedVal = result;\n } catch (e) {\n console.error(`[SWC] Failed to execute directive {{= ${expr.script} }} on attribute ${name}: ${helperAndHostSet}`, e);\n processedVal = newVal;\n }\n }\n }\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 metaList = attrChangeMap.get(name);\n if (metaList && Array.isArray(metaList)) {\n for (const meta of metaList) {\n if (meta.options.while === 'connected' && !(this as any).__swc_connected) {\n continue;\n }\n const convertedVal = convertAttributeValue(processedVal, meta.options.type);\n (this as any)[meta.propertyKey](convertedVal, old, name, hSet);\n }\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,SAAQ,kBAAkB,eAAe,oBAAmB;AAC5D,SAAQ,mCAAkC;AAC1C,SAAQ,0BAA0B,iCAAiC,kCAAkC,4BAA4B,+BAA+B,oCAAoC,gCAAgC,qCAAqC,qCAAqC,kCAAiC;AAC/U,SAAQ,sCAAqC;AAC7C,SAAQ,uBAAuB,uCAAsC;AACrE,SAAQ,qCAAoC;AAC5C,SAAQ,0BAA0B,yBAAwB;AAC1D,SAAQ,wBAAuB;AAC/B,SAAQ,2BAA0B;AAClC,SAAQ,gBAAe;AACvB,SAAQ,iBAAiB,wBAAuB;AAChD,SAAQ,wBAAwB,+BAA8B;AAC9D,SAAgC,2BAA0B;AAC1D,SAAQ,cAAc,cAAc,gBAAe;AACnD,SAAQ,aAAY;AAEpB,SAAQ,4BAA2B;AAI5B,MAAM,qBAAqB,OAAO,IAAI,qCAAqC;AAe3E,MAAM,mBAAmB,CAAC,WAA6C;AAC5E,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,oBAAoB,WAAW;AACjE;AAEO,MAAM,aAAa,CAAC,SAAc;AACvC,MAAI,CAAC,KAAK,mBAAmB;AAC3B,SAAK,SAAS,MAAM,eAAe,aAAa,KAAK,MAAM,KAAK,OAAO,EAAE,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E;AAAA,IACF;AAEA,UAAM,sBAAsB,wBAAwB,KAAK,QAAO,GAAG,QAAgB,kBAAkBA,KAAI;AACzG,QAAI,uBAAuB,WAAW,MAAM;AAC1C,MAAC,KAAa,oBAAoB,MAAaA,OAAM,QAAQ,oBAAoB,IAAI;AAAA,IACvF;AAEA,UAAM,WAAW,cAAc,IAAIA,KAAI;AACvC,QAAI,YAAY,MAAM,QAAQ,QAAQ,GAAG;AACvC,iBAAW,QAAQ,UAAU;AAC3B,YAAI,KAAK,QAAQ,UAAU,eAAe,CAAE,KAAa,iBAAiB;AACxE;AAAA,QACF;AACA,cAAM,eAAe,sBAAsB,cAAc,KAAK,QAAQ,IAAI;AAC1E,QAAC,KAAa,KAAK,WAAW,EAAE,cAAc,KAAKA,OAAM,IAAI;AAAA,MAC/D;AAAA,IACF;AAAA,EACF;AAEA,SAAO,eAAe,aAAa,sBAAsB;AAAA,IACvD,KAAK,MAAM;AAAA,IACX,cAAc;AAAA,EAChB,CAAC;AAED,eAAa,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,EAAC,SAAS,SAAS,QAAO,IAAI,MAAS;AAAA,EAC/G;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import {ActionExpression, FunctionUtils, ReflectUtils} from '@dooboostore/core';\nimport {getAddEventListenerMetadata} from './addEventListener';\nimport {findAllLifecycleMetadata, findAllOnConnectedAfterMetadata, findAllOnConnectedBeforeMetadata, findAllOnConnectedMetadata, ON_AFTER_ADOPTED_METADATA_KEY, ON_AFTER_DISCONNECTED_METADATA_KEY, ON_BEFORE_ADOPTED_METADATA_KEY, ON_BEFORE_DISCONNECTED_METADATA_KEY, ON_CONNECTED_COMPLETED_METADATA_KEY, ON_INITIALIZE_METADATA_KEY} from './lifecycles';\nimport {getEmitCustomEventMetadataList} from './emitCustomEvent';\nimport {convertAttributeValue, findAllAttributeChangedMetadata} from './changedAttributeThis';\nimport {findAllAttributeApplyMetadata, findAllAttributeMetadata, getAttributeValue} from './applyAttribute';\nimport {getQueryMetadata} from './query';\nimport {getQueryAllMetadata} from './queryAll';\nimport {SwcUtils} from '../utils/Utils';\nimport {DOM_EVENT_NAMES, HTML_TAG_ENTRIES} from '../config/config';\nimport {SituationTypeContainer, SituationTypeContainers} from '@dooboostore/simple-boot/decorators/inject/Inject';\nimport {HelperHostSet, HostSet, InjectSituationType} from '../types';\nimport {ConvertUtils, ElementApply, NodeSlot} from '@dooboostore/core-web';\nimport {isSSR} from \"../elements/SwcAppMixin\";\nimport {findAllApplySlotMetadata} from \"./applySlot\";\nimport {findAllStateMetadata} from \"./state\";\nimport {findAllPropertyMetadata} from \"./applyProperty\";\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 useShadow?: boolean | 'open' | 'closed';\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) => { // HTMLElement\n if (!inst.__swc_initialized) {\n inst._swcId = inst?.getAttribute?.('swc-use-ssr') ?? 's' + Math.random().toString(36).substring(2, 11).toLowerCase();\n inst._emitHandlers = new Map();\n inst._boundListeners = [];\n inst.__swc_initialized = true;\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: own property\uAC00 \uC788\uC73C\uBA74 prototype\uC758 getter/setter\uB294 \uC808\uB300 \uC548 \uD0C4\uB2E4 \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 @attributeThis('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 // \uD568\uC218\uB294 decorator\uC5D0\uC11C \uAC12\uC790\uCCB4\uB97C descriptor.value = function (...args: any[]) {...\n\n // @attribute \uD544\uB4DC\uC758 own property \uC0AD\uC81C \u2192 getter/setter \uC791\uB3D9\n // const attributeList = findAllAttributeMetadata(target);\n const attributeAllList = findAllAttributeMetadata(target).filter(it => it.type === 'property');\n if (attributeAllList) {\n attributeAllList.forEach(meta => {\n // const initUserData = (inst as any)[meta.propertyKey];\n delete (inst as any)[meta.propertyKey];\n // (inst as any)[meta.propertyKey] = initUserData;\n });\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 // const slotAllList = findAllApplySlotMetadata(target);\n // if (slotAllList) {\n // slotAllList.filter(it => it.type === 'property').forEach(meta => {\n // delete (inst as any)[meta.propertyKey];\n // });\n // }\n\n\n const propertyAllList = findAllPropertyMetadata(target).filter(it => it.type === 'property');\n if (propertyAllList) {\n propertyAllList.forEach(meta => {\n delete (inst as any)[meta.propertyKey];\n });\n }\n\n const stateAllList = findAllStateMetadata(target);\n if (stateAllList) {\n stateAllList.forEach(meta => {\n const initUserData = (inst as any)[meta.propertyKey];\n delete (inst as any)[meta.propertyKey];\n (inst as any)[meta.propertyKey] = initUserData;\n });\n }\n\n // Call constructor script if present\n const hostSet = SwcUtils.getHostSet(inst);\n const appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(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\n// \uD6D4 \uC774\uAC8C\uB9DE\uB098?? global\uB85C \uAD00\uB9AC\uD558\uB294\uAC8C..\uD6D4... \uC65C\uC774\uB807\uAC8C \uD588\uC744\uAE4C..\n// --- Global Event Handling ---\nconst globalDelegatedRoots = new WeakSet<Node>();\n// \uC5EC\uAE30\uC5D0\uC11C \uC911\uBCF5 \uD638\uCD9C\uC548\uB418\uAC8C \uC798\uB9C9\uC544\uC900\uB2E4 ..\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.findNearestSwcHostIncludingSelf(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;\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, win: Window) => {\n if (proto.__swc_proto_setup) return;\n proto.__swc_proto_setup = true;\n\n\n // proto.createSlotString = function (id: string) {\n // return NodeSlot.slot(`${this._swcId}-${id}`);\n // }\n // proto.createEaHtml = function (id: string, script: string) {\n // return ElementApply.html(id, script);\n // }\n // proto.createEaText = function (id: string, script: string) {\n // return ElementApply.text(id, script);\n // }\n // proto.createEaAttribute = function (id: string, name: string, script: string) {\n // return ElementApply.attribute(id, name, script);\n // }\n // proto.createEaEvent = function (id: string, name: string, script: string) {\n // return ElementApply.event(id, name, script);\n // }\n // proto.createEaProperty = function (id: string, name: string, script: string) {\n // return ElementApply.property(id, name, script);\n // }\n\n // swc-id-asdasdasdasd-click=\" :value=\"\" {: value fsdfsdafsad :} {html: aaa :} {text: asdas :}\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.findAllSwcHostsIncludingSelf(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 getElementConfig(this).window ?? ((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 useHostSet = hostSet ?? SwcUtils.getHelperAndHostSet(win, this);\n const app = useHostSet?.$appHost?.simpleApplication;\n // console.log('---->hh',app, this, methodName);\n if (app) {\n const otherStorage = new Map<any, any>();\n const situations = new SituationTypeContainers([new SituationTypeContainer({situationType: InjectSituationType.HOST_SET, data: useHostSet}), new SituationTypeContainer({situationType: InjectSituationType.APP_HOST, data: useHostSet.$appHost}), new SituationTypeContainer({situationType: InjectSituationType.APP_HOSTS, data: useHostSet.$appHosts}), new SituationTypeContainer({\n situationType: InjectSituationType.HOST,\n data: useHostSet.$host\n }), new SituationTypeContainer({situationType: InjectSituationType.HOSTS, data: useHostSet.$hosts}), new SituationTypeContainer({situationType: InjectSituationType.FIRST_HOST, data: useHostSet.$firstHost}), new SituationTypeContainer({situationType: InjectSituationType.LAST_HOST, data: useHostSet.$lastHost}), new SituationTypeContainer({\n situationType: InjectSituationType.FIRST_APP_HOST,\n data: useHostSet.$firstAppHost\n }), new SituationTypeContainer({situationType: InjectSituationType.LAST_APP_HOST, data: useHostSet.$lastAppHost})]);\n otherStorage.set(SituationTypeContainers, situations);\n\n return app.simstanceManager.executeBindParameterSim(\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 hostSet = SwcUtils.getHostSet(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 hostSet = SwcUtils.getHostSet(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 === '$this' || 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 const attributeApplyNames = Array.from(applyAttributeMap.values())\n .map(it => it.targetAttributeName)\n .filter(Boolean) as string[];\n const hostAttributes = attributeList.filter(it => it.selector === '$this').map(it => it.propertyKey || String(it.propertyKey));\n // Get original static observedAttributes before they're overwritten by Object.defineProperty\n const originalStaticObservedAttributes = (constructor.observedAttributes ?? []) as string[];\n const mergedObservedAttributes = [...new Set([...(metadata.observedAttributes ?? []), ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map(it => (it.options as any).attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];\n // const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];\n\n const proto = constructor.prototype;\n setupPrototype(proto, win);\n\n // \uAC12\uC744 \uAE30\uB300\uD558\uC9C0\uC54A\uB294\uB2E4.\n let helperHostSet: HelperHostSet | null = null;\n const originalConnected = proto.connectedCallback;\n proto.connectedCallback = async function () {\n ensureInit(this);\n // connected \uB410\uC744\uC2DC \uCD5C\uC2E0\uD654\n helperHostSet = SwcUtils.getHelperAndHostSet(win, this as any);\n const appHost = helperHostSet.$appHost;\n const useSsr = isSSR(this);\n // console.log('isSsr', useSsr, this);\n // console.log('----helperHostSet--->', this, helperHostSet, useSsr)\n // let connectedApp: SwcAppInterface |undefined;\n try {\n if (appHost && typeof (appHost as any)._connected === 'function') {\n await (appHost as any)._connected(this);\n } else if (appHost && typeof (appHost as any)) {\n (appHost as any)._connected_safari_and_standby ??= [];\n (appHost as any)._connected_safari_and_standby.push(this);\n }\n\n // const hostSet = SwcUtils.getHostSet(this as any);\n const conf = getElementConfig(this);\n const currentWin = (this as any)._resolveWindow(conf);\n\n const bMethods = findAllOnConnectedBeforeMetadata(this).filter(it => useSsr ? !it.options.ssrFirst : true);\n // console.log('beforeConnected', bMethods)\n if (bMethods) {\n for (const m of bMethods) await (this as any)._invokeLifecycleMethod(m.propertyKey, helperHostSet);\n }\n (this as any)._executeSwcScript('swc-on-before-connected', helperHostSet);\n\n // console.log('vvvvvvvvvvvvvvvu-seSsr-vvvvvvvvvv>', useSsr, this.tagName, this.getAttribute('seq'))\n // // ssr \uCC98\uB9AC\uB77C\uC11C \uC774\uBBF8 \uB0B4\uB824\uC900\uAC70\uADF8\uB300\uB85C \uC0C1\uC694\uD558\uBA74\uB41C\uB2E4 \uB530\uB77C\uC11C \uD638\uCD9C\uC548\uD55C\uB2E4\n const targetConnectedList = findAllOnConnectedMetadata(constructor).filter(it => useSsr ? !it.options.ssrFirst : true);\n const shadowMode = conf?.useShadow || targetConnectedList.find(it => it.options.useShadow)?.options.useShadow;\n // console.log('--------->', this.tagName, shadowMode && !this.shadowRoot)\n if (shadowMode && !this.shadowRoot) {\n const mode = shadowMode === true ? 'open' : shadowMode;\n console.log('tagName=', this.tagName, 'mode', mode, this.shadowRoot);\n // if (this.tagName!=='INDEX-ROUTER') {\n this.attachShadow({mode: mode as ShadowRootMode});\n // }\n }\n\n const stateContext: any = {...helperHostSet};\n findAllStateMetadata(this).forEach(it => {\n stateContext[it.name] = this[it.propertyKey]\n })\n\n const shadowChildren: Node[] = [];\n const lightChildren: Node[] = [];\n\n console.log('targetConnectList', this.tagName, targetConnectedList.length)\n if (targetConnectedList.length > 0) {\n // let sContent = '',\n // lContent = '';\n for (const meta of targetConnectedList) {\n // const res = (this as any)[meta.propertyKey]();\n let res = await (this as any)._invokeLifecycleMethod(meta.propertyKey, helperHostSet);\n // res = SwcUtils.projectProcessHtml(this, res);\n if (typeof res === 'string') {\n const htmlTemplateElement = doc.createElement('template');\n htmlTemplateElement.innerHTML = res;//SwcUtils.projectProcessHtml(this._swcId, res, doc);\n res = htmlTemplateElement.content;\n }\n\n if (res) {\n const nodes = Array.isArray(res) ? res : [res];\n if (meta.options.useShadow || conf?.useShadow) {\n shadowChildren.push(...nodes);\n }else {\n lightChildren.push(...nodes);\n }\n }\n }\n try {\n if (this.shadowRoot) {\n const applyShadowChildren = SwcUtils.projectProcessHtml(this._swcId, shadowChildren, doc);\n this.shadowRoot.replaceChildren(...applyShadowChildren)\n }\n if (lightChildren.length) {\n const applyLightChildren = SwcUtils.projectProcessHtml(this._swcId, lightChildren, doc);\n this.replaceChildren(...applyLightChildren)\n }\n\n } catch (e) {\n console.error('[ElementDefine] innerHTML setting error:', e);\n }\n new ElementApply(this, {id: this._swcId}).apply({context: stateContext, bind: this});\n } else {\n new ElementApply(this, {id: this._swcId}).apply({exclude: {html: true, text: true, attribute: true}, context: stateContext, bind: this});\n }\n\n // global delegate event\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\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 !== '$host' && meta.selector !== '$appHost' && meta.selector !== '$firstHost' && meta.selector !== '$lastHost' && meta.selector !== '$firstAppHost' && meta.selector !== '$lastAppHost' && meta.selector !== '$hosts' && meta.selector !== '$appHosts' && meta.selector !== '$this' && 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 // Apply filter if specified\n if (options.filter) {\n const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);\n if (!options.filter(event, helper)) {\n continue; // Skip this listener if filter returns false\n }\n }\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, $matchedElement: 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 === '$host') applyRootOption(helperHostSet.$host);\n else if (selector === '$parentHost') applyRootOption(helperHostSet.$parentHost);\n else if (selector === '$appHost') applyRootOption(helperHostSet.$appHost);\n else if (selector === '$firstHost') applyRootOption(helperHostSet.$firstHost);\n else if (selector === '$lastHost') applyRootOption(helperHostSet.$lastHost);\n else if (selector === '$firstAppHost') applyRootOption(helperHostSet.$firstAppHost);\n else if (selector === '$lastAppHost') applyRootOption(helperHostSet.$lastAppHost);\n else if (selector === '$hosts') helperHostSet.$hosts.forEach(applyRootOption);\n else if (selector === '$appHosts') helperHostSet.$appHosts.forEach(applyRootOption);\n else if (selector === '$this' || !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 // Apply filter if specified\n if (options.filter) {\n const helper = SwcUtils.getHelperAndHostSet(currentWin, t as HTMLElement);\n if (!options.filter(event, {currentThis: this, helper})) {\n return; // Skip if filter returns false\n }\n }\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, $$matchedElement: event.currentTarget}, args);\n };\n t.addEventListener(type, handler, opts);\n (this as any)._boundListeners.push({target: t, type, handler, options: opts});\n });\n });\n\n if (originalConnected) await (originalConnected.apply(this));\n\n const aMethods = findAllOnConnectedAfterMetadata(this).filter(it => {\n return useSsr ? !it.options.ssrFirst : true;\n });\n // console.log('afterConnected', this.tagName, aMethods, getOnConnectedAfterMetadata(this))\n if (aMethods) {\n for (const m of aMethods) await (this as any)._invokeLifecycleMethod(m.propertyKey, helperHostSet);\n }\n (this as any)._executeSwcScript('swc-on-connected', helperHostSet);\n (this as any)._executeSwcScript('swc-on-after-connected', helperHostSet);\n (this as any).__swc_connected = true;\n\n // Trigger @changedAttributeThis with while: 'connected'\n for (let [name, metaList] of Array.from(attrChangeMap)) {\n for (const meta of metaList) {\n if (meta.options.while === 'connected') {\n const val = getAttributeValue(this, name, {type: meta.options.type});\n if (val !== null) {\n await ((this as any)[meta.propertyKey](val, null, name, helperHostSet));\n }\n }\n }\n }\n } finally {\n for (let mPropertyKey of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) {\n await (this as any)._invokeLifecycleMethod(mPropertyKey, helperHostSet);\n }\n if (appHost && typeof (appHost as any)._connectedDone === 'function') {\n await (appHost as any)._connectedDone(this);\n }\n }\n };\n\n const originalDisconnected = proto.disconnectedCallback;\n proto.disconnectedCallback = function () {\n // const helperHostSet = SwcUtils.getHelperAndHostSet(win, this as any);\n // Remove from appHost LAST when disconnected\n // console.log('disconnnnnnnnnnnnnnnnnnn', helperHostSet, this)\n const appHost = helperHostSet.$appHost;\n if (appHost && typeof (appHost as any)._disconnected === 'function') {\n (appHost as any)._disconnected(this);\n }\n\n (this as any)._executeSwcScript('swc-on-before-disconnected', helperHostSet);\n const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);\n if (bMethods) {\n for (const m of bMethods) (this as any)._invokeLifecycleMethod(m, helperHostSet);\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 new ElementApply(this, {id: this._swcId}).removeAllEventListener();\n\n // globalDelegatedRoots remove\n // const roots = [this, this.getRootNode()];\n // if (this.shadowRoot) {\n // roots.push(this.shadowRoot);\n // }\n // roots.forEach(root => {\n // DOM_EVENT_NAMES.forEach(type => {\n // root.removeEventListener(type, handleGlobalSwcEvent);\n // });\n // }\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, helperHostSet);\n }\n (this as any)._executeSwcScript('swc-on-disconnected', helperHostSet);\n (this as any)._executeSwcScript('swc-on-after-disconnected', helperHostSet);\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 // Process expression directive before passing to handlers\n let processedVal: any = newVal;\n if (newVal !== null) {\n const ae = new ActionExpression(newVal);\n const expr = ae.getFirstExpression('callReturn');\n if (expr) {\n const win = (this as any)._resolveWindow?.() || ((typeof window !== 'undefined' ? window : undefined) as any);\n const helperAndHostSet = SwcUtils.getHelperAndHostSet(win, this as any);\n const script = ConvertUtils.decodeHtmlEntity(expr.script, win.document);\n try {\n const result = FunctionUtils.executeReturn({\n script: script,\n context: this,\n args: helperAndHostSet\n });\n // Pass the result object directly without serialization\n processedVal = result;\n } catch (e) {\n console.error(`[SWC] Failed to execute directive {{= ${expr.script} }} on attribute ${name}: ${helperAndHostSet}`, e);\n processedVal = newVal;\n }\n }\n }\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 metaList = attrChangeMap.get(name);\n if (metaList && Array.isArray(metaList)) {\n for (const meta of metaList) {\n if (meta.options.while === 'connected' && !(this as any).__swc_connected) {\n continue;\n }\n const convertedVal = convertAttributeValue(processedVal, meta.options.type);\n (this as any)[meta.propertyKey](convertedVal, old, name, hSet);\n }\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,SAAQ,kBAAkB,eAAe,oBAAmB;AAC5D,SAAQ,mCAAkC;AAC1C,SAAQ,0BAA0B,iCAAiC,kCAAkC,4BAA4B,+BAA+B,oCAAoC,gCAAgC,qCAAqC,qCAAqC,kCAAiC;AAC/U,SAAQ,sCAAqC;AAC7C,SAAQ,uBAAuB,uCAAsC;AACrE,SAAQ,+BAA+B,0BAA0B,yBAAwB;AACzF,SAAQ,wBAAuB;AAC/B,SAAQ,2BAA0B;AAClC,SAAQ,gBAAe;AACvB,SAAQ,iBAAiB,wBAAuB;AAChD,SAAQ,wBAAwB,+BAA8B;AAC9D,SAAgC,2BAA0B;AAC1D,SAAQ,cAAc,oBAA6B;AACnD,SAAQ,aAAY;AAEpB,SAAQ,4BAA2B;AACnC,SAAQ,+BAA8B;AAI/B,MAAM,qBAAqB,OAAO,IAAI,qCAAqC;AAe3E,MAAM,mBAAmB,CAAC,WAA6C;AAC5E,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,oBAAoB,WAAW;AACjE;AAEO,MAAM,aAAa,CAAC,SAAc;AACvC,MAAI,CAAC,KAAK,mBAAmB;AAC3B,SAAK,SAAS,MAAM,eAAe,aAAa,KAAK,MAAM,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,YAAY;AACnH,SAAK,gBAAgB,oBAAI,IAAI;AAC7B,SAAK,kBAAkB,CAAC;AACxB,SAAK,oBAAoB;AAMzB,UAAM,SAAS,gBAAgB,WAAW,OAAO,KAAK;AAwBtD,UAAM,mBAAmB,yBAAyB,MAAM,EAAE,OAAO,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