@dooboostore/simple-web-component 1.0.42 → 1.0.44

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 (153) hide show
  1. package/README.md +689 -85
  2. package/dist/cjs/SwcAppEngine.js +3 -1
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/addEventListener.js +10 -0
  5. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  6. package/dist/cjs/decorators/applyAttribute.js +41 -30
  7. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  8. package/dist/cjs/decorators/applyClass.js +66 -23
  9. package/dist/cjs/decorators/applyClass.js.map +3 -3
  10. package/dist/cjs/decorators/applyNode.js +176 -107
  11. package/dist/cjs/decorators/applyNode.js.map +2 -2
  12. package/dist/cjs/decorators/applyProperty.js +21 -30
  13. package/dist/cjs/decorators/applyProperty.js.map +2 -2
  14. package/dist/cjs/decorators/applySlot.js +11 -2
  15. package/dist/cjs/decorators/applySlot.js.map +2 -2
  16. package/dist/cjs/decorators/applyStyle.js +48 -17
  17. package/dist/cjs/decorators/applyStyle.js.map +3 -3
  18. package/dist/cjs/decorators/{changedAttributeThis.js → changedAttribute.js} +6 -6
  19. package/dist/cjs/decorators/changedAttribute.js.map +7 -0
  20. package/dist/cjs/decorators/elementDefine.js +37 -6
  21. package/dist/cjs/decorators/elementDefine.js.map +3 -3
  22. package/dist/cjs/decorators/emitCustomEvent.js +58 -42
  23. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  24. package/dist/cjs/decorators/index.js +1 -1
  25. package/dist/cjs/decorators/index.js.map +2 -2
  26. package/dist/cjs/decorators/publishSwcAppMessage.js +37 -23
  27. package/dist/cjs/decorators/publishSwcAppMessage.js.map +3 -3
  28. package/dist/cjs/decorators/query.js +96 -145
  29. package/dist/cjs/decorators/query.js.map +3 -3
  30. package/dist/cjs/decorators/queryAll.js +104 -131
  31. package/dist/cjs/decorators/queryAll.js.map +3 -3
  32. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
  33. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
  34. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
  35. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  36. package/dist/cjs/elements/SwcAppMixin.js +17 -2
  37. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  38. package/dist/cjs/examples/RxJSOperatorsExample.js +285 -0
  39. package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
  40. package/dist/cjs/index.js +1 -0
  41. package/dist/cjs/index.js.map +2 -2
  42. package/dist/cjs/router/ElementRouter.js +4 -0
  43. package/dist/cjs/router/ElementRouter.js.map +2 -2
  44. package/dist/esm/SwcAppEngine.js +3 -1
  45. package/dist/esm/SwcAppEngine.js.map +2 -2
  46. package/dist/esm/decorators/addEventListener.js +10 -0
  47. package/dist/esm/decorators/addEventListener.js.map +2 -2
  48. package/dist/esm/decorators/applyAttribute.js +41 -30
  49. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  50. package/dist/esm/decorators/applyClass.js +66 -23
  51. package/dist/esm/decorators/applyClass.js.map +3 -3
  52. package/dist/esm/decorators/applyNode.js +176 -107
  53. package/dist/esm/decorators/applyNode.js.map +2 -2
  54. package/dist/esm/decorators/applyProperty.js +21 -30
  55. package/dist/esm/decorators/applyProperty.js.map +2 -2
  56. package/dist/esm/decorators/applySlot.js +11 -2
  57. package/dist/esm/decorators/applySlot.js.map +2 -2
  58. package/dist/esm/decorators/applyStyle.js +48 -17
  59. package/dist/esm/decorators/applyStyle.js.map +3 -3
  60. package/dist/esm/decorators/{changedAttributeThis.js → changedAttribute.js} +3 -3
  61. package/dist/esm/decorators/changedAttribute.js.map +7 -0
  62. package/dist/esm/decorators/elementDefine.js +35 -4
  63. package/dist/esm/decorators/elementDefine.js.map +2 -2
  64. package/dist/esm/decorators/emitCustomEvent.js +58 -42
  65. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  66. package/dist/esm/decorators/index.js +1 -1
  67. package/dist/esm/decorators/index.js.map +1 -1
  68. package/dist/esm/decorators/publishSwcAppMessage.js +37 -23
  69. package/dist/esm/decorators/publishSwcAppMessage.js.map +3 -3
  70. package/dist/esm/decorators/query.js +96 -145
  71. package/dist/esm/decorators/query.js.map +3 -3
  72. package/dist/esm/decorators/queryAll.js +104 -131
  73. package/dist/esm/decorators/queryAll.js.map +3 -3
  74. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +2 -0
  75. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
  76. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -0
  77. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  78. package/dist/esm/elements/SwcAppMixin.js +18 -3
  79. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  80. package/dist/esm/examples/RxJSOperatorsExample.js +266 -0
  81. package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
  82. package/dist/esm/index.js +1 -0
  83. package/dist/esm/index.js.map +2 -2
  84. package/dist/esm/router/ElementRouter.js +4 -0
  85. package/dist/esm/router/ElementRouter.js.map +2 -2
  86. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +900 -578
  87. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  88. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  89. package/dist/types/decorators/addEventListener.d.ts +22 -14
  90. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  91. package/dist/types/decorators/applyAttribute.d.ts +61 -20
  92. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  93. package/dist/types/decorators/applyClass.d.ts +22 -36
  94. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  95. package/dist/types/decorators/applyNode.d.ts +178 -30
  96. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  97. package/dist/types/decorators/applyProperty.d.ts +53 -18
  98. package/dist/types/decorators/applyProperty.d.ts.map +1 -1
  99. package/dist/types/decorators/applySlot.d.ts +6 -0
  100. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  101. package/dist/types/decorators/applyStyle.d.ts +13 -7
  102. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  103. package/dist/types/decorators/{changedAttributeThis.d.ts → changedAttribute.d.ts} +2 -2
  104. package/dist/types/decorators/changedAttribute.d.ts.map +1 -0
  105. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  106. package/dist/types/decorators/emitCustomEvent.d.ts +20 -10
  107. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  108. package/dist/types/decorators/index.d.ts +1 -1
  109. package/dist/types/decorators/index.d.ts.map +1 -1
  110. package/dist/types/decorators/publishSwcAppMessage.d.ts +19 -0
  111. package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
  112. package/dist/types/decorators/query.d.ts +3 -26
  113. package/dist/types/decorators/query.d.ts.map +1 -1
  114. package/dist/types/decorators/queryAll.d.ts +3 -20
  115. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  116. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +1 -0
  117. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
  118. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +2 -0
  119. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  120. package/dist/types/elements/SwcAppMixin.d.ts +4 -4
  121. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  122. package/dist/types/examples/RxJSOperatorsExample.d.ts +94 -0
  123. package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
  124. package/dist/types/index.d.ts +1 -0
  125. package/dist/types/index.d.ts.map +1 -1
  126. package/dist/types/router/ElementRouter.d.ts.map +1 -1
  127. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +900 -578
  128. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  129. package/package.json +7 -9
  130. package/src/SwcAppEngine.ts +3 -1
  131. package/src/decorators/addEventListener.ts +35 -24
  132. package/src/decorators/applyAttribute.ts +167 -65
  133. package/src/decorators/applyClass.ts +113 -17
  134. package/src/decorators/applyNode.ts +383 -102
  135. package/src/decorators/applyProperty.ts +99 -65
  136. package/src/decorators/applySlot.ts +24 -10
  137. package/src/decorators/applyStyle.ts +83 -13
  138. package/src/decorators/{changedAttributeThis.ts → changedAttribute.ts} +1 -1
  139. package/src/decorators/elementDefine.ts +47 -4
  140. package/src/decorators/emitCustomEvent.ts +62 -35
  141. package/src/decorators/index.ts +1 -1
  142. package/src/decorators/publishSwcAppMessage.ts +71 -27
  143. package/src/decorators/query.ts +90 -159
  144. package/src/decorators/queryAll.ts +92 -134
  145. package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -0
  146. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +3 -1
  147. package/src/elements/SwcAppMixin.ts +43 -24
  148. package/src/examples/RxJSOperatorsExample.ts +279 -0
  149. package/src/index.ts +2 -0
  150. package/src/router/ElementRouter.ts +4 -0
  151. package/dist/cjs/decorators/changedAttributeThis.js.map +0 -7
  152. package/dist/esm/decorators/changedAttributeThis.js.map +0 -7
  153. package/dist/types/decorators/changedAttributeThis.d.ts.map +0 -1
package/dist/cjs/index.js CHANGED
@@ -28,6 +28,7 @@ __reExport(src_exports, require("./decorators"), module.exports);
28
28
  __reExport(src_exports, require("./types"), module.exports);
29
29
  __reExport(src_exports, require("./utils/Utils"), module.exports);
30
30
  __reExport(src_exports, require("./config/config"), module.exports);
31
+ __reExport(src_exports, require("./SwcAppEngine"), module.exports);
31
32
  var src_default = async (w, other) => {
32
33
  const cr = await (0, import_elements.defineSwcAppAll)(w);
33
34
  if (other) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import 'reflect-metadata';\nexport * from './elements'\nimport { defineSwcAppAll } from './elements';\nimport {ConstructorType} from \"@dooboostore/core\";\n\n// Decorators\nexport * from './decorators';\n\n// Types\nexport * from './types';\n\n// Utilities\nexport * from './utils/Utils';\n\n// Config\nexport * from './config/config';\n\n// Registration Factory\nexport default async (w: Window, other?: (((w: Window) => Promise<CustomElementConstructor> | CustomElementConstructor) | any) []) => {\n const cr = await defineSwcAppAll(w);\n // const cr = await elementFactories(w);\n if (other) {\n for (const fn of other) {\n if (typeof fn === 'function') {\n await fn(w);\n }\n }\n }\n\n return cr;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AACP,wBAAc,uBADd;AAEA,sBAAgC;AAIhC,wBAAc,yBANd;AASA,wBAAc,oBATd;AAYA,wBAAc,0BAZd;AAeA,wBAAc,4BAfd;AAkBA,IAAO,cAAQ,OAAO,GAAW,UAAqG;AACpI,QAAM,KAAK,UAAM,iCAAgB,CAAC;AAElC,MAAI,OAAO;AACT,eAAW,MAAM,OAAO;AACtB,UAAI,OAAO,OAAO,YAAY;AAC5B,cAAM,GAAG,CAAC;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import 'reflect-metadata';\nexport * from './elements'\nimport { defineSwcAppAll } from './elements';\nimport {ConstructorType} from \"@dooboostore/core\";\n\n// Decorators\nexport * from './decorators';\n\n// Types\nexport * from './types';\n\n// Utilities\nexport * from './utils/Utils';\n\n// Config\nexport * from './config/config';\n\nexport * from './SwcAppEngine'\n\n// Registration Factory\nexport default async (w: Window, other?: (((w: Window) => Promise<CustomElementConstructor> | CustomElementConstructor) | any) []) => {\n const cr = await defineSwcAppAll(w);\n // const cr = await elementFactories(w);\n if (other) {\n for (const fn of other) {\n if (typeof fn === 'function') {\n await fn(w);\n }\n }\n }\n\n return cr;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AACP,wBAAc,uBADd;AAEA,sBAAgC;AAIhC,wBAAc,yBANd;AASA,wBAAc,oBATd;AAYA,wBAAc,0BAZd;AAeA,wBAAc,4BAfd;AAiBA,wBAAc,2BAjBd;AAoBA,IAAO,cAAQ,OAAO,GAAW,UAAqG;AACpI,QAAM,KAAK,UAAM,iCAAgB,CAAC;AAElC,MAAI,OAAO;AACT,eAAW,MAAM,OAAO;AACtB,UAAI,OAAO,OAAO,YAAY;AAC5B,cAAM,GAAG,CAAC;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -29,6 +29,10 @@ class ElementRouter extends import_core_web.Router {
29
29
  super(config);
30
30
  __publicField(this, "_history", []);
31
31
  __publicField(this, "_currentIndex", -1);
32
+ if (config.firstUrl) {
33
+ this._history.push({ url: config.firstUrl, data: null, title: void 0 });
34
+ this._currentIndex = 0;
35
+ }
32
36
  }
33
37
  // Override pushState to manage internal history
34
38
  pushState(data, title, path, config) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/router/ElementRouter.ts"],
4
- "sourcesContent": ["import { ChangeStateConfig, ChangeStateResult, RouteAction, Router, RouterConfig, RouterMethodOptions } from '@dooboostore/core-web';\nimport { UrlUtils } from '@dooboostore/core';\n\nexport class ElementRouter extends Router {\n private _history: { url: string; data: any; title?: string }[] = [];\n private _currentIndex = -1;\n\n constructor(config: RouterConfig) {\n super(config);\n }\n\n // Override pushState to manage internal history\n pushState(data: any, title: string | undefined, path: string, config?: ChangeStateConfig): ChangeStateResult {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'start' });\n }\n\n // Ensure _history is initialized (defense for super calls)\n if (!this._history) this._history = [];\n\n this._history = this._history.slice(0, this._currentIndex + 1);\n this._history.push({ url: path, data, title });\n this._currentIndex++;\n\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'end' });\n }\n return { data };\n }\n\n // Override replaceState to manage internal history\n replaceState(data: any, title: string | undefined, path: string, config?: ChangeStateConfig): ChangeStateResult {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'start' });\n }\n\n if (!this._history) this._history = [];\n if (this._currentIndex === -1) {\n this._history.push({ url: path, data, title });\n this._currentIndex = 0;\n } else {\n this._history[this._currentIndex] = { url: path, data, title };\n }\n\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'end' });\n }\n return { data };\n }\n\n push(path: RouteAction, state?: RouterMethodOptions): void {\n this.pushState(state?.data, state?.title, this.toUrl(path), state?.config);\n }\n\n replace(path: RouteAction, state?: RouterMethodOptions): void {\n this.replaceState(state?.data, state?.title, this.toUrl(path), state?.config);\n }\n\n back(config?: ChangeStateConfig): void {\n if (this._currentIndex > 0) {\n this.go(-1, config);\n }\n }\n\n forward(config?: ChangeStateConfig): void {\n if (this._currentIndex < this._history.length - 1) {\n this.go(1, config);\n }\n }\n\n go(i: number, config?: ChangeStateConfig): void;\n async go(config: string | { path: RouteAction; state?: RouterMethodOptions; replace?: boolean; scrollToTop?: boolean }): Promise<void>;\n go(config: number | string | { path: RouteAction; state?: RouterMethodOptions; replace?: boolean; scrollToTop?: boolean }, changeStateConfig?: ChangeStateConfig): Promise<void> | void {\n if (typeof config === 'number') {\n const targetIndex = this._currentIndex + config;\n if (this._history && targetIndex >= 0 && targetIndex < this._history.length) {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData(), triggerPoint: 'start' });\n }\n\n this._currentIndex = targetIndex;\n const entry = this._history[this._currentIndex];\n\n if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: entry.url }), triggerPoint: 'end' });\n }\n }\n return;\n }\n return super.go(config as any, changeStateConfig);\n }\n\n getData(): any {\n return this._history?.[this._currentIndex]?.data;\n }\n\n getUrl(): string {\n return this._history?.[this._currentIndex]?.url ?? this.config?.firstUrl ?? '/';\n }\n\n getHref(): string {\n return this.getUrl();\n }\n\n getPathName(): string {\n return this.getUrl().split('?')[0];\n }\n\n getSearch(): string {\n const parts = this.getUrl().split('?');\n return parts[1] ? `?${parts[1]}` : '';\n }\n\n getSearchParams(data?: { delete?: string[]; append?: [[string, string]] }): URLSearchParams {\n const search = this.getSearch();\n const searchParams = new URLSearchParams(search);\n return UrlUtils.manipulateSearchParams(searchParams, data);\n }\n\n getHashSearchParams(data?: { delete?: string[]; append?: [[string, string]] }): URLSearchParams {\n const url = this.getUrl();\n const hashIdx = url.indexOf('#');\n const hash = hashIdx !== -1 ? url.slice(hashIdx + 1) : '';\n const searchParams = new URLSearchParams(hash);\n return UrlUtils.manipulateSearchParams(searchParams, data);\n }\n\n pushAddSearchParam(params: [[string, string]], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ append: params });\n this.push({ searchParams: s }, state);\n }\n\n pushDeleteHashSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });\n const url = this.getUrl().split('#')[0];\n const size = Array.from(s.entries()).length;\n this.push(url + (size > 0 ? '#' + s.toString() : ''), state);\n }\n\n pushDeleteSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });\n this.push({ searchParams: s }, state);\n }\n\n pushUpsertSearchParam(params: Record<string, string | string[]>, state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams();\n UrlUtils.upsertSearchParam(s, params);\n this.push({ searchParams: s }, state);\n }\n\n replaceAddSearchParam(params: [[string, string]], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ append: params });\n this.replace({ searchParams: s }, state);\n }\n\n replaceDeleteHashSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });\n const url = this.getUrl().split('#')[0];\n const size = Array.from(s.entries()).length;\n this.replace(url + (size > 0 ? '#' + s.toString() : ''), state);\n }\n\n replaceDeleteSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });\n this.replace({ searchParams: s }, state);\n }\n\n replaceUpsertSearchParam(params: Record<string, string | string[]>, state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParamObject();\n UrlUtils.upsertSearchParam(s as any, params);\n this.replace({ searchParams: s as any }, state);\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA6G;AAC7G,kBAAyB;AAElB,MAAM,sBAAsB,uBAAO;AAAA,EAIxC,YAAY,QAAsB;AAChC,UAAM,MAAM;AAJd,wBAAQ,YAAyD,CAAC;AAClE,wBAAQ,iBAAgB;AAAA,EAIxB;AAAA;AAAA,EAGA,UAAU,MAAW,OAA2B,MAAc,QAA+C;AAC3G,UAAM,kBAAmB,KAAa;AACtC,QAAI,CAAC,QAAQ,qBAAqB,iBAAiB;AACjD,sBAAgB,KAAK,EAAE,GAAG,KAAK,aAAa,EAAE,WAAW,KAAK,CAAC,GAAG,cAAc,QAAQ,CAAC;AAAA,IAC3F;AAGA,QAAI,CAAC,KAAK,SAAU,MAAK,WAAW,CAAC;AAErC,SAAK,WAAW,KAAK,SAAS,MAAM,GAAG,KAAK,gBAAgB,CAAC;AAC7D,SAAK,SAAS,KAAK,EAAE,KAAK,MAAM,MAAM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AEA,sBAAsB,QAA4B,OAA8C;AAC9F,UAAM,IAAI,KAAK,gBAAgB,EAAE,QAAQ,OAAO,CAAC;AACjD,SAAK,QAAQ,EAAE,cAAc,EAAE,GAAG,KAAK;AAAA,EACzC;AAAA,EAEA,6BAA6B,MAAyB,OAA8C;AAClG,UAAM,IAAI,KAAK,oBAAoB,EAAE,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;AAClF,UAAM,MAAM,KAAK,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC;AACtC,UAAM,OAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,EAAE;AACrC,SAAK,QAAQ,OAAO,OAAO,IAAI,MAAM,EAAE,SAAS,IAAI,KAAK,KAAK;AAAA,EAChE;AAAA,EAEA,yBAAyB,MAAyB,OAA8C;AAC9F,UAAM,IAAI,KAAK,gBAAgB,EAAE,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;AAC9E,SAAK,QAAQ,EAAE,cAAc,EAAE,GAAG,KAAK;AAAA,EACzC;AAAA,EAEA,yBAAyB,QAA2C,OAA8C;AAChH,UAAM,IAAI,KAAK,qBAAqB;AACpC,yBAAS,kBAAkB,GAAU,MAAM;AAC3C,SAAK,QAAQ,EAAE,cAAc,EAAS,GAAG,KAAK;AAAA,EAChD;AACF;",
4
+ "sourcesContent": ["import { ChangeStateConfig, ChangeStateResult, RouteAction, Router, RouterConfig, RouterMethodOptions } from '@dooboostore/core-web';\nimport { UrlUtils } from '@dooboostore/core';\n\nexport class ElementRouter extends Router {\n private _history: { url: string; data: any; title?: string }[] = [];\n private _currentIndex = -1;\n\n constructor(config: RouterConfig) {\n super(config);\n if (config.firstUrl) {\n this._history.push({ url: config.firstUrl, data: null, title: undefined });\n this._currentIndex = 0;\n }\n }\n\n // Override pushState to manage internal history\n pushState(data: any, title: string | undefined, path: string, config?: ChangeStateConfig): ChangeStateResult {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'start' });\n }\n\n // Ensure _history is initialized (defense for super calls)\n if (!this._history) this._history = [];\n\n this._history = this._history.slice(0, this._currentIndex + 1);\n this._history.push({ url: path, data, title });\n this._currentIndex++;\n\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'end' });\n }\n return { data };\n }\n\n // Override replaceState to manage internal history\n replaceState(data: any, title: string | undefined, path: string, config?: ChangeStateConfig): ChangeStateResult {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'start' });\n }\n\n if (!this._history) this._history = [];\n if (this._currentIndex === -1) {\n this._history.push({ url: path, data, title });\n this._currentIndex = 0;\n } else {\n this._history[this._currentIndex] = { url: path, data, title };\n }\n\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'end' });\n }\n return { data };\n }\n\n push(path: RouteAction, state?: RouterMethodOptions): void {\n this.pushState(state?.data, state?.title, this.toUrl(path), state?.config);\n }\n\n replace(path: RouteAction, state?: RouterMethodOptions): void {\n this.replaceState(state?.data, state?.title, this.toUrl(path), state?.config);\n }\n\n back(config?: ChangeStateConfig): void {\n if (this._currentIndex > 0) {\n this.go(-1, config);\n }\n }\n\n forward(config?: ChangeStateConfig): void {\n if (this._currentIndex < this._history.length - 1) {\n this.go(1, config);\n }\n }\n\n go(i: number, config?: ChangeStateConfig): void;\n async go(config: string | { path: RouteAction; state?: RouterMethodOptions; replace?: boolean; scrollToTop?: boolean }): Promise<void>;\n go(config: number | string | { path: RouteAction; state?: RouterMethodOptions; replace?: boolean; scrollToTop?: boolean }, changeStateConfig?: ChangeStateConfig): Promise<void> | void {\n if (typeof config === 'number') {\n const targetIndex = this._currentIndex + config;\n if (this._history && targetIndex >= 0 && targetIndex < this._history.length) {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData(), triggerPoint: 'start' });\n }\n\n this._currentIndex = targetIndex;\n const entry = this._history[this._currentIndex];\n\n if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: entry.url }), triggerPoint: 'end' });\n }\n }\n return;\n }\n return super.go(config as any, changeStateConfig);\n }\n\n getData(): any {\n return this._history?.[this._currentIndex]?.data;\n }\n\n getUrl(): string {\n return this._history?.[this._currentIndex]?.url ?? this.config?.firstUrl ?? '/';\n }\n\n getHref(): string {\n return this.getUrl();\n }\n\n getPathName(): string {\n return this.getUrl().split('?')[0];\n }\n\n getSearch(): string {\n const parts = this.getUrl().split('?');\n return parts[1] ? `?${parts[1]}` : '';\n }\n\n getSearchParams(data?: { delete?: string[]; append?: [[string, string]] }): URLSearchParams {\n const search = this.getSearch();\n const searchParams = new URLSearchParams(search);\n return UrlUtils.manipulateSearchParams(searchParams, data);\n }\n\n getHashSearchParams(data?: { delete?: string[]; append?: [[string, string]] }): URLSearchParams {\n const url = this.getUrl();\n const hashIdx = url.indexOf('#');\n const hash = hashIdx !== -1 ? url.slice(hashIdx + 1) : '';\n const searchParams = new URLSearchParams(hash);\n return UrlUtils.manipulateSearchParams(searchParams, data);\n }\n\n pushAddSearchParam(params: [[string, string]], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ append: params });\n this.push({ searchParams: s }, state);\n }\n\n pushDeleteHashSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });\n const url = this.getUrl().split('#')[0];\n const size = Array.from(s.entries()).length;\n this.push(url + (size > 0 ? '#' + s.toString() : ''), state);\n }\n\n pushDeleteSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });\n this.push({ searchParams: s }, state);\n }\n\n pushUpsertSearchParam(params: Record<string, string | string[]>, state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams();\n UrlUtils.upsertSearchParam(s, params);\n this.push({ searchParams: s }, state);\n }\n\n replaceAddSearchParam(params: [[string, string]], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ append: params });\n this.replace({ searchParams: s }, state);\n }\n\n replaceDeleteHashSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });\n const url = this.getUrl().split('#')[0];\n const size = Array.from(s.entries()).length;\n this.replace(url + (size > 0 ? '#' + s.toString() : ''), state);\n }\n\n replaceDeleteSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });\n this.replace({ searchParams: s }, state);\n }\n\n replaceUpsertSearchParam(params: Record<string, string | string[]>, state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParamObject();\n UrlUtils.upsertSearchParam(s as any, params);\n this.replace({ searchParams: s as any }, state);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA6G;AAC7G,kBAAyB;AAElB,MAAM,sBAAsB,uBAAO;AAAA,EAIxC,YAAY,QAAsB;AAChC,UAAM,MAAM;AAJd,wBAAQ,YAAyD,CAAC;AAClE,wBAAQ,iBAAgB;AAItB,QAAI,OAAO,UAAU;AACnB,WAAK,SAAS,KAAK,EAAE,KAAK,OAAO,UAAU,MAAM,MAAM,OAAO,OAAU,CAAC;AACzE,WAAK,gBAAgB;AAAA,IACvB;AAAA,EACF;AAAA;AAAA,EAGA,UAAU,MAAW,OAA2B,MAAc,QAA+C;AAC3G,UAAM,kBAAmB,KAAa;AACtC,QAAI,CAAC,QAAQ,qBA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simpleApplication.run(otherInstanceSim);
41
41
  if (this._config.onStartedLazyDefineComponent) {
42
- await Promise.all(this._config.onStartedLazyDefineComponent.map((it) => it(this._config.window)));
42
+ await Promise.all(this._config.onStartedLazyDefineComponent.map((it) => {
43
+ it(this._config.window);
44
+ }));
43
45
  }
44
46
  if (this._config.onEngineStarted) {
45
47
  await this._config.onEngineStarted(this.simpleApplication, this.host);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SwcAppEngine.ts"],
4
- "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n // console.log('-------->', this._config.onStartedLazyDefineComponent)\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => it(this._config.window)))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
5
- "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AQ,6BAA6B,IAAI,QAAM,GAAG,KAAK,QAAQ,MAAM,CAAC,CAAC;AAAA,MAChG;AACA,UAAI,KAAK,QAAQ,iBAAiB;AAChC,cAAM,KAAK,QAAQ,gBAAgB,KAAK,mBAAmB,KAAK,IAAkC;AAAA,MACpG;AAAA,IACF,SAAS,GAAG;AACV,cAAQ,MAAM,iCAAiC,GAAG,KAAK,OAAO;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,aAAa;AACX,SAAK,oBAAoB,YAAY;AAAA,EACvC;AACF;",
4
+ "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n // console.log('-------->', this._config.onStartedLazyDefineComponent)\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => {\n it(this._config.window);\n }))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();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AQ,IAAI,KAAK,QAAQ,6BAA6B,IAAI,QAAM;AACpE,aAAG,KAAK,QAAQ,MAAM;AAAA,QACxB,CAAC,CAAC;AAAA,MACJ;AACA,UAAI,KAAK,QAAQ,iBAAiB;AAChC,cAAM,KAAK,QAAQ,gBAAgB,KAAK,mBAAmB,KAAK,IAAkC;AAAA,MACpG;AAAA,IACF,SAAS,GAAG;AACV,cAAQ,MAAM,iCAAiC,GAAG,KAAK,OAAO;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,aAAa;AACX,SAAK,oBAAoB,YAAY;AAAA,EACvC;AACF;",
6
6
  "names": []
7
7
  }
@@ -23,6 +23,11 @@ function addEventListenerDelegateAllDom(selector, type, options) {
23
23
  function addEventListenerDelegate(selector, type, options) {
24
24
  return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
25
25
  }
26
+ const event = addEventListener;
27
+ const eventDelegateLightDom = addEventListenerDelegateLightDom;
28
+ const eventDelegateShadowDom = addEventListenerDelegateShadowDom;
29
+ const eventDelegateAllDom = addEventListenerDelegateAllDom;
30
+ const eventDelegate = addEventListenerDelegate;
26
31
  function addEventListenerThis(type, options) {
27
32
  return addEventListener("$this", type, options);
28
33
  }
@@ -50,6 +55,11 @@ export {
50
55
  addEventListenerDocument,
51
56
  addEventListenerThis,
52
57
  addEventListenerWindow,
58
+ event,
59
+ eventDelegate,
60
+ eventDelegateAllDom,
61
+ eventDelegateLightDom,
62
+ eventDelegateShadowDom,
53
63
  getAddEventListenerMetadata
54
64
  };
55
65
  //# sourceMappingURL=addEventListener.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/addEventListener.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface AddEventListenerBaseOptions extends EventListenerOptions {\n capture?: boolean;\n once?: boolean;\n passive?: boolean;\n stopPropagation?: boolean;\n stopImmediatePropagation?: boolean;\n preventDefault?: boolean;\n // removeOnDisconnected?: boolean;\n delegate?: boolean;\n filter?: (target: Event | CustomEvent, meta:{currentThis: any, helper: HelperHostSet}) => boolean;\n}\n\nexport interface AddEventListenerMetadata {\n propertyKey: string | symbol;\n selector: string;\n type: string;\n options: AddEventListenerBaseOptions & SwcQueryOptions & { delegate?: boolean };\n}\n\nexport const ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:add-event-listener');\n\nexport function addEventListener(target: SpecialSelector, type: string, options?: AddEventListenerBaseOptions): MethodDecorator;\nexport function addEventListener(selector: string, type: string, options?: AddEventListenerBaseOptions & SwcQueryOptions & { delegate?: boolean }): MethodDecorator;\n/**\n * @addEventListener decorator to bind events to elements.\n */\nexport function addEventListener(selectorOrTarget: string, type: string, options: any = {}): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const constructor = targetObj.constructor;\n\n let listeners = ReflectUtils.getMetadata<AddEventListenerMetadata[]>(ADD_EVENT_LISTENER_METADATA_KEY, constructor);\n if (!listeners) {\n listeners = [];\n ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);\n }\n\n listeners.push({ propertyKey, selector: selectorOrTarget, type, options });\n };\n}\n\n\nexport function addEventListenerDelegateLightDom(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions, 'delegate'>): MethodDecorator {\n return addEventListener(selector, type, {...options??{}, root:'light', delegate: true});\n}\n\nexport function addEventListenerDelegateShadowDom(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions, 'delegate'>): MethodDecorator {\n return addEventListener(selector, type, {...options??{}, root:'shadow', delegate: true});\n}\nexport function addEventListenerDelegateAllDom(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions, 'delegate'>): MethodDecorator {\n return addEventListener(selector, type, {...options??{}, root:'all', delegate: true});\n}\nexport function addEventListenerDelegate(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions, 'delegate'>): MethodDecorator {\n return addEventListener(selector, type, {...options??{}, root:'auto', delegate: true});\n}\n\n/**\n * @addEventListenerThis decorator - simplified version of @addEventListener for $this selector\n */\nexport function addEventListenerThis(type: string, options?: AddEventListenerBaseOptions & SwcQueryOptions): MethodDecorator {\n return addEventListener('$this', type, options);\n}\n\n/**\n * @addEventListenerAppHost decorator - simplified version of @addEventListener for $appHost selector\n */\nexport function addEventListenerAppHost(type: string, options?: AddEventListenerBaseOptions & SwcQueryOptions): MethodDecorator {\n return addEventListener('$appHost', type, options);\n}\n\nexport function addEventListenerWindow(type: string, options?: AddEventListenerBaseOptions & SwcQueryOptions): MethodDecorator {\n return addEventListener('$window', type, options);\n}\nexport function addEventListenerDocument(type: string, options?: AddEventListenerBaseOptions & SwcQueryOptions): MethodDecorator {\n return addEventListener('$document', type, options);\n}\n\nexport const getAddEventListenerMetadata = (target: any): AddEventListenerMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);\n};\n"],
5
- "mappings": "AAAA,SAAS,oBAAoB;AAsBtB,MAAM,kCAAkC,OAAO,IAAI,yCAAyC;AAO5F,SAAS,iBAAiB,kBAA0B,MAAc,UAAe,CAAC,GAAoB;AAC3G,SAAO,CAAC,WAAmB,aAA8B,eAAmC;AAC1F,UAAM,cAAc,UAAU;AAE9B,QAAI,YAAY,aAAa,YAAwC,iCAAiC,WAAW;AACjH,QAAI,CAAC,WAAW;AACd,kBAAY,CAAC;AACb,mBAAa,eAAe,iCAAiC,WAAW,WAAW;AAAA,IACrF;AAEA,cAAU,KAAK,EAAE,aAAa,UAAU,kBAAkB,MAAM,QAAQ,CAAC;AAAA,EAC3E;AACF;AAGO,SAAS,iCAAiC,UAAkB,MAAc,SAA0E;AACzJ,SAAO,iBAAiB,UAAU,MAAM,EAAC,GAAG,WAAS,CAAC,GAAG,MAAK,SAAS,UAAU,KAAI,CAAC;AACxF;AAEO,SAAS,kCAAkC,UAAkB,MAAc,SAA0E;AAC1J,SAAO,iBAAiB,UAAU,MAAM,EAAC,GAAG,WAAS,CAAC,GAAG,MAAK,UAAU,UAAU,KAAI,CAAC;AACzF;AACO,SAAS,+BAA+B,UAAkB,MAAc,SAA0E;AACvJ,SAAO,iBAAiB,UAAU,MAAM,EAAC,GAAG,WAAS,CAAC,GAAG,MAAK,OAAO,UAAU,KAAI,CAAC;AACtF;AACO,SAAS,yBAAyB,UAAkB,MAAc,SAA0E;AACjJ,SAAO,iBAAiB,UAAU,MAAM,EAAC,GAAG,WAAS,CAAC,GAAG,MAAK,QAAQ,UAAU,KAAI,CAAC;AACvF;AAKO,SAAS,qBAAqB,MAAc,SAA0E;AAC3H,SAAO,iBAAiB,SAAS,MAAM,OAAO;AAChD;AAKO,SAAS,wBAAwB,MAAc,SAA0E;AAC9H,SAAO,iBAAiB,YAAY,MAAM,OAAO;AACnD;AAEO,SAAS,uBAAuB,MAAc,SAA0E;AAC7H,SAAO,iBAAiB,WAAW,MAAM,OAAO;AAClD;AACO,SAAS,yBAAyB,MAAc,SAA0E;AAC/H,SAAO,iBAAiB,aAAa,MAAM,OAAO;AACpD;AAEO,MAAM,8BAA8B,CAAC,WAAwD;AAClG,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,iCAAiC,WAAW;AAC9E;",
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface AddEventListenerBaseOptions<TEvent extends Event = Event> extends EventListenerOptions {\n capture?: boolean;\n once?: boolean;\n passive?: boolean;\n stopPropagation?: boolean;\n stopImmediatePropagation?: boolean;\n preventDefault?: boolean;\n // removeOnDisconnected?: boolean;\n delegate?: boolean;\n filter?: (target: Event | CustomEvent, meta:{currentThis: any, helper: HelperHostSet}) => boolean;\n // RxJS operator options\n debounceTime?: number;\n throttleTime?: number;\n distinctUntilChanged?: boolean | ((prev: TEvent, curr: TEvent) => boolean);\n}\n\nexport interface AddEventListenerMetadata<TEvent extends Event = Event> {\n propertyKey: string | symbol;\n selector: string;\n type: string;\n options: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean };\n}\n\nexport const ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:add-event-listener');\n\nexport function addEventListener<TEvent extends Event = Event>(target: SpecialSelector, type: string, options?: AddEventListenerBaseOptions<TEvent>): MethodDecorator;\nexport function addEventListener<TEvent extends Event = Event>(selector: string, type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions & { delegate?: boolean }): MethodDecorator;\n/**\n * @addEventListener decorator to bind events to elements.\n */\nexport function addEventListener<TEvent extends Event = Event>(selectorOrTarget: string, type: string, options: any = {}): MethodDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const constructor = targetObj.constructor;\n\n let listeners = ReflectUtils.getMetadata<AddEventListenerMetadata<TEvent>[]>(ADD_EVENT_LISTENER_METADATA_KEY, constructor);\n if (!listeners) {\n listeners = [];\n ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);\n }\n\n listeners.push({ propertyKey, selector: selectorOrTarget, type, options });\n };\n}\n\n\nexport function addEventListenerDelegateLightDom<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'light', delegate: true});\n}\n\nexport function addEventListenerDelegateShadowDom<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'shadow', delegate: true});\n}\nexport function addEventListenerDelegateAllDom<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'all', delegate: true});\n}\nexport function addEventListenerDelegate<TEvent extends Event = Event>(selector: string, type: string, options?: Omit<AddEventListenerBaseOptions<TEvent>, 'delegate'>): MethodDecorator {\n return addEventListener<TEvent>(selector, type, {...options??{}, root:'auto', delegate: true});\n}\n\n/**\n * @addEventListenerThis decorator - simplified version of @addEventListener for $this selector\n */\n\n// --- Aliases: event... ---\nexport const event = addEventListener;\nexport const eventDelegateLightDom = addEventListenerDelegateLightDom;\nexport const eventDelegateShadowDom = addEventListenerDelegateShadowDom;\nexport const eventDelegateAllDom = addEventListenerDelegateAllDom;\nexport const eventDelegate = addEventListenerDelegate;\nexport function addEventListenerThis<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions): MethodDecorator {\n return addEventListener<TEvent>('$this', type, options);\n}\n\n/**\n * @addEventListenerAppHost decorator - simplified version of @addEventListener for $appHost selector\n */\nexport function addEventListenerAppHost<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions): MethodDecorator {\n return addEventListener<TEvent>('$appHost', type, options);\n}\n\nexport function addEventListenerWindow<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions): MethodDecorator {\n return addEventListener<TEvent>('$window', type, options);\n}\nexport function addEventListenerDocument<TEvent extends Event = Event>(type: string, options?: AddEventListenerBaseOptions<TEvent> & SwcQueryOptions): MethodDecorator {\n return addEventListener<TEvent>('$document', type, options);\n}\n\nexport const getAddEventListenerMetadata = (target: any): AddEventListenerMetadata<Event>[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);\n};\n"],
5
+ "mappings": "AAAA,SAAS,oBAAoB;AA0BtB,MAAM,kCAAkC,OAAO,IAAI,yCAAyC;AAO5F,SAAS,iBAA+C,kBAA0B,MAAc,UAAe,CAAC,GAAoB;AACzI,SAAO,CAAC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AAM,OAAO;AAC5D;AAEO,MAAM,8BAA8B,CAAC,WAA+D;AACzG,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,aAAa,YAAY,iCAAiC,WAAW;AAC9E;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,13 @@ import { ensureInit, getElementConfig } from "./elementDefine.js";
3
3
  import { SwcUtils } from "../utils/Utils.js";
4
4
  import { ConvertUtils } from "@dooboostore/core-web";
5
5
  const ATTRIBUTE_METADATA_KEY = Symbol.for("simple-web-component:attribute");
6
+ const isCssSelector = (str) => {
7
+ if (!str) return false;
8
+ if (str.startsWith("$")) return true;
9
+ if (/^[#.\[\:>+~]/.test(str)) return true;
10
+ if (/[>+~:\[\]]/.test(str)) return true;
11
+ return false;
12
+ };
6
13
  const convertValue = (val, type) => {
7
14
  if (val === null || val === void 0) return val;
8
15
  if (type === Number) return Number(val);
@@ -132,13 +139,22 @@ function applyAttribute(selector, targetAttributeNameOrOptions, options) {
132
139
  descriptor.value = function(...args) {
133
140
  ensureInit(this);
134
141
  const res = original.apply(this, args);
142
+ const extractValue = (v) => {
143
+ const keyToUse = finalOptions.valueKey ?? ATTRIBUTE_METADATA_KEY;
144
+ if (v && typeof v === "object" && keyToUse in v) {
145
+ return v[keyToUse];
146
+ }
147
+ return v;
148
+ };
135
149
  if (res instanceof Promise) {
136
150
  return res.then((v) => {
137
- applyValueToTargets(this, v);
151
+ const extracted = extractValue(v);
152
+ applyValueToTargets(this, extracted);
138
153
  return v;
139
154
  });
140
155
  } else {
141
- applyValueToTargets(this, res);
156
+ const extracted = extractValue(res);
157
+ applyValueToTargets(this, extracted);
142
158
  return res;
143
159
  }
144
160
  };
@@ -164,35 +180,32 @@ function applyAttribute(selector, targetAttributeNameOrOptions, options) {
164
180
  });
165
181
  };
166
182
  }
167
- function attribute(selector, targetAttributeNameOrOptions, options) {
168
- return applyAttribute(selector, targetAttributeNameOrOptions, options);
169
- }
170
- function attributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
171
- if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol") {
172
- return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
183
+ function attribute(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor) {
184
+ if (optionsOrDescriptor !== void 0 && (typeof attributeNameOrOptions === "string" || typeof attributeNameOrOptions === "symbol")) {
185
+ return applyAttribute("$this", void 0, {})(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor);
173
186
  }
174
- if (typeof targetOrOptions === "string") {
175
- return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
176
- } else if (targetOrOptions && typeof targetOrOptions === "object") {
177
- return applyAttribute("$this", void 0, targetOrOptions);
178
- } else {
179
- return applyAttribute("$this", void 0, {});
187
+ if (typeof selectorOrAttributeOrTarget === "string") {
188
+ const isSelector = isCssSelector(selectorOrAttributeOrTarget);
189
+ if (isSelector) {
190
+ return applyAttribute(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsOrDescriptor);
191
+ } else {
192
+ const options = typeof attributeNameOrOptions === "object" && attributeNameOrOptions !== null ? attributeNameOrOptions : {};
193
+ return applyAttribute("$this", selectorOrAttributeOrTarget, options);
194
+ }
180
195
  }
196
+ return applyAttribute("$this", void 0, selectorOrAttributeOrTarget);
181
197
  }
182
- function setAttribute(selector, targetAttributeNameOrOptions, options) {
183
- return applyAttribute(selector, targetAttributeNameOrOptions, options);
184
- }
185
- function setAttributeThis(targetOrOptions, propertyKeyOrOptions, descriptor) {
186
- if (typeof targetOrOptions === "object" && targetOrOptions !== null && !Array.isArray(targetOrOptions) && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
187
- return applyAttribute("$this", void 0, {})(targetOrOptions, propertyKeyOrOptions, descriptor);
188
- }
189
- if (typeof targetOrOptions === "string") {
190
- return applyAttribute("$this", targetOrOptions, propertyKeyOrOptions);
191
- } else if (targetOrOptions && typeof targetOrOptions === "object") {
192
- return applyAttribute("$this", void 0, targetOrOptions);
193
- } else {
194
- return applyAttribute("$this", void 0, {});
198
+ function setAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined) {
199
+ if (typeof selectorOrAttributeOrOptions === "string") {
200
+ const isSelector = isCssSelector(selectorOrAttributeOrOptions);
201
+ if (isSelector) {
202
+ return applyAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined);
203
+ } else {
204
+ const options = typeof attributeNameOrOptions === "object" && attributeNameOrOptions !== null ? attributeNameOrOptions : {};
205
+ return applyAttribute("$this", selectorOrAttributeOrOptions, options);
206
+ }
195
207
  }
208
+ return applyAttribute("$this", void 0, selectorOrAttributeOrOptions);
196
209
  }
197
210
  const findAllAttributeMetadata = (target) => {
198
211
  const actualTarget = target instanceof Function ? target : target.constructor;
@@ -210,14 +223,12 @@ export {
210
223
  ATTRIBUTE_METADATA_KEY,
211
224
  applyAttribute,
212
225
  attribute,
213
- attributeThis,
214
226
  convertValue,
215
227
  applyAttribute_default as default,
216
228
  findAllAttributeApplyMetadata,
217
229
  findAllAttributeMetadata,
218
230
  getAttributeValue,
219
231
  resolveAttributeTargets,
220
- setAttribute,
221
- setAttributeThis
232
+ setAttribute
222
233
  };
223
234
  //# sourceMappingURL=applyAttribute.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/applyAttribute.ts"],
4
- "sourcesContent": ["import {ReflectUtils, FunctionUtils, ActionExpression} from '@dooboostore/core';\nimport {ensureInit, getElementConfig} from './elementDefine';\nimport {SwcUtils} from '../utils/Utils';\nimport {SwcQueryOptions, HelperHostSet} from '../types';\nimport {ConvertUtils} from '@dooboostore/core-web';\n\n// ============================================\n// Types & Interfaces\n// ============================================\n\nexport interface AttributeOptions extends SwcQueryOptions {\n name?: string;\n type?: typeof Number | typeof Boolean | typeof String;\n filter?: (target: HTMLElement, value: any, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n}\n\nexport interface AttributeMetadata {\n propertyKey: string | symbol;\n selector: string;\n targetAttributeName: string;\n options: AttributeOptions;\n type: 'property' | 'method';\n}\n\nexport const ATTRIBUTE_METADATA_KEY = Symbol.for('simple-web-component:attribute');\n\n// ============================================\n// Utilities\n// ============================================\n\nconst convertValue = (val: string | null, 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\nexport {convertValue};\n\nexport const getAttributeValue = (inst: any, attrName: string, options?: AttributeOptions & { selector?: string }): any => {\n const conf = getElementConfig(inst);\n const currentWin = inst._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as any);\n\n // If selector is not provided, use inst itself\n const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];\n\n const primaryTarget = targets[0];\n\n if (primaryTarget && typeof (primaryTarget as any).hasAttribute === 'function' && (primaryTarget as any).hasAttribute(attrName)) {\n let domVal = (primaryTarget as any).getAttribute(attrName);\n\n // \uD45C\uD604\uC2DD \uCCB4\uD06C\n const ae = new ActionExpression(domVal);\n const expr = ae.getFirstExpression('callReturn');\n if (expr) {\n try {\n const result = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, currentWin.document),\n context: inst,\n args: SwcUtils.getHelperAndHostSet(currentWin, inst)\n });\n return convertValue(result, options?.type);\n } catch (err) {\n console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);\n return convertValue(domVal, options?.type);\n }\n }\n\n return convertValue(domVal, options?.type);\n }\n\n // If no target found, return null\n return null;\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[] for attribute operations\n */\nexport const resolveAttributeTargets = (inst: any, selector: string, options: AttributeOptions): HTMLElement[] => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const r = options.root || 'auto';\n const results: HTMLElement[] = [];\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 {\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 * @applyAttribute decorator - set/get element attributes\n *\n * Usage:\n * - @applyAttribute('selector', 'attrName') - Set attribute with explicit name\n * - @applyAttribute('selector') - Use property name as attribute name\n * - @applyAttribute('selector', { name: 'attrName' }) - Set attribute via options\n * - Return null to remove attribute\n */\nexport function applyAttribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function applyAttribute(selector: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function applyAttribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator & PropertyDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n // ensureInit(target as any);\n\n const constructor = target.constructor;\n const designType = (Reflect as any).getMetadata('design:type', target, propertyKey);\n const metaType: 'property' | 'method' = descriptor && typeof descriptor.value === 'function' ? 'method' : 'property';\n\n // Parse arguments\n let finalOptions: AttributeOptions = {};\n let targetAttributeName: string;\n\n if (typeof targetAttributeNameOrOptions === 'string') {\n // applyAttribute('selector', 'attrName', options?)\n targetAttributeName = targetAttributeNameOrOptions;\n finalOptions = options || {};\n } else if (targetAttributeNameOrOptions) {\n // applyAttribute('selector', options)\n finalOptions = targetAttributeNameOrOptions;\n targetAttributeName = finalOptions.name || String(propertyKey);\n } else {\n // applyAttribute('selector')\n targetAttributeName = String(propertyKey);\n }\n\n // Store metadata\n let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor) as AttributeMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);\n }\n metaList.push({\n propertyKey,\n selector,\n targetAttributeName,\n options: finalOptions,\n type: metaType\n });\n\n // Helper: Apply resolved value to targets\n const applyValueToTargets = (inst: any, resolvedValue: any) => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const targetEls = resolveAttributeTargets(inst, selector, finalOptions);\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 if (resolvedValue === null) {\n // Remove attribute if value is null\n targetEl.removeAttribute(targetAttributeName);\n } else if (resolvedValue !== undefined) {\n // Set attribute\n targetEl.setAttribute(targetAttributeName, resolvedValue === true ? '' : String(resolvedValue));\n }\n });\n\n return resolvedValue;\n };\n\n // Method decorator: wrap method to apply its return value to attributes\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) => {\n applyValueToTargets(this, v);\n return v;\n });\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 attributes\n Object.defineProperty(target, propertyKey, {\n configurable: true,\n enumerable: true,\n get(this: any) {\n ensureInit(this);\n const mergedOptions = {...finalOptions, selector, type: finalOptions.type || designType};\n return getAttributeValue(this, targetAttributeName, mergedOptions);\n },\n set(this: any, value: any) {\n ensureInit(this);\n\n if (value instanceof Promise) {\n value.then((v: any) => applyValueToTargets(this, v)).catch(() => { /* swallow */\n });\n } else {\n applyValueToTargets(this, value);\n }\n }\n });\n };\n}\n\n// ============================================\n// Convenience Aliases\n// ============================================\n\n/**\n * @attribute - Alias for @applyAttribute\n */\nexport function attribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attribute(selector: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator & PropertyDecorator {\n return applyAttribute(selector, targetAttributeNameOrOptions as any, options);\n}\n\n/**\n * @attributeThis - Apply attribute on $this element\n * Can be used as: @attributeThis or @attributeThis('attrName') or @attributeThis({ name: 'attrName' })\n */\nexport function attributeThis(target: Object, propertyKey: string | symbol): void;\nexport function attributeThis(targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attributeThis(options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function attributeThis(targetOrOptions?: any, propertyKeyOrOptions?: any, descriptor?: PropertyDescriptor): any {\n // Direct decorator usage: @attributeThis\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null && !Array.isArray(targetOrOptions) &&\n typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol') {\n // Called as @attributeThis (target, propertyKey)\n return applyAttribute('$this', undefined as any, {})(targetOrOptions, propertyKeyOrOptions, descriptor);\n }\n\n // Called with parameters\n if (typeof targetOrOptions === 'string') {\n // @attributeThis('attrName', options?)\n return applyAttribute('$this', targetOrOptions, propertyKeyOrOptions);\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // @attributeThis({ name: 'attrName' })\n return applyAttribute('$this', undefined as any, targetOrOptions);\n } else {\n // @attributeThis() or @attributeThis\n return applyAttribute('$this', undefined as any, {});\n }\n}\n\n/**\n * @setAttribute - Alias for @applyAttribute (method-decorator semantics)\n */\nexport function setAttribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttribute(selector: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator {\n return applyAttribute(selector, targetAttributeNameOrOptions as any, options) as MethodDecorator;\n}\n\n/**\n * @setAttributeThis - Set attribute on $this element\n * Can be used as: @setAttributeThis or @setAttributeThis('attrName') or @setAttributeThis({ name: 'attrName' })\n */\nexport function setAttributeThis(target: Object, propertyKey: string | symbol): void;\nexport function setAttributeThis(targetAttributeName: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttributeThis(options?: AttributeOptions): MethodDecorator;\nexport function setAttributeThis(targetOrOptions?: any, propertyKeyOrOptions?: any, descriptor?: PropertyDescriptor): any {\n // Direct decorator usage: @setAttributeThis\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null && !Array.isArray(targetOrOptions) &&\n (typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol')) {\n // Called as @setAttributeThis (target, propertyKey)\n return applyAttribute('$this', undefined as any, {})(targetOrOptions, propertyKeyOrOptions, descriptor);\n }\n\n // Called with parameters\n if (typeof targetOrOptions === 'string') {\n // @setAttributeThis('attrName', options?)\n return applyAttribute('$this', targetOrOptions, propertyKeyOrOptions) as MethodDecorator;\n } else if (targetOrOptions && typeof targetOrOptions === 'object') {\n // @setAttributeThis({ name: 'attrName' })\n return applyAttribute('$this', undefined as any, targetOrOptions) as MethodDecorator;\n } else {\n // @setAttributeThis() or @setAttributeThis\n return applyAttribute('$this', undefined as any, {}) as MethodDecorator;\n }\n}\n\n// ============================================\n// Metadata Helpers\n// ============================================\n\nexport const findAllAttributeMetadata = (target: any): AttributeMetadata[] => {\n const actualTarget = target instanceof Function ? target : target.constructor;\n return ReflectUtils.findAllMetadata<AttributeMetadata[]>(ATTRIBUTE_METADATA_KEY, actualTarget).flat();\n};\n\n// Backward compatibility alias\nexport const findAllAttributeApplyMetadata = (target: any): Map<string | symbol, AttributeMetadata> => {\n const result = new Map<string | symbol, AttributeMetadata>();\n findAllAttributeMetadata(target).forEach(meta => {\n result.set(meta.propertyKey, meta);\n });\n return result;\n};\n\n\nexport default applyAttribute;\n"],
5
- "mappings": "AAAA,SAAQ,cAAc,eAAe,wBAAuB;AAC5D,SAAQ,YAAY,wBAAuB;AAC3C,SAAQ,gBAAe;AAEvB,SAAQ,oBAAmB;AAoBpB,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAMjF,MAAM,eAAe,CAAC,KAAoB,SAAmB;AAC3D,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;AAIO,MAAM,oBAAoB,CAAC,MAAW,UAAkB,YAA4D;AACzH,QAAM,OAAO,iBAAiB,IAAI;AAClC,QAAM,aAAa,KAAK,iBAAiB,IAAI,MAAO,OAAO,WAAW,cAAc,SAAS;AAG7F,QAAM,UAAU,SAAS,WAAW,wBAAwB,MAAM,QAAQ,UAAU,OAAO,IAAI,CAAC,IAAI;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O,SAAS,aAAa,UAAkB,8BAA0D,SAA6C;AACpJ,SAAO,eAAe,UAAU,8BAAqC,OAAO;AAC9E;AASO,SAAS,iBAAiB,iBAAuB,sBAA4B,YAAsC;AAExH,MAAI,OAAO,oBAAoB,YAAY,oBAAoB,QAAQ,CAAC,MAAM,QAAQ,eAAe,MAClG,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,WAAW;AAExF,WAAO,eAAe,SAAS,QAAkB,CAAC,CAAC,EAAE,iBAAiB,sBAAsB,UAAU;AAAA,EACxG;AAGA,MAAI,OAAO,oBAAoB,UAAU;AAEvC,WAAO,eAAe,SAAS,iBAAiB,oBAAoB;AAAA,EACtE,WAAW,mBAAmB,OAAO,oBAAoB,UAAU;AAEjE,WAAO,eAAe,SAAS,QAAkB,eAAe;AAAA,EAClE,OAAO;AAEL,WAAO,eAAe,SAAS,QAAkB,CAAC,CAAC;AAAA,EACrD;AACF;AAMO,MAAM,2BAA2B,CAAC,WAAqC;AAC5E,QAAM,eAAe,kBAAkB,WAAW,SAAS,OAAO;AAClE,SAAO,aAAa,gBAAqC,wBAAwB,YAAY,EAAE,KAAK;AACtG;AAGO,MAAM,gCAAgC,CAAC,WAAyD;AACrG,QAAM,SAAS,oBAAI,IAAwC;AAC3D,2BAAyB,MAAM,EAAE,QAAQ,UAAQ;AAC/C,WAAO,IAAI,KAAK,aAAa,IAAI;AAAA,EACnC,CAAC;AACD,SAAO;AACT;AAGA,IAAO,yBAAQ;",
4
+ "sourcesContent": ["import {ReflectUtils, FunctionUtils, ActionExpression} from '@dooboostore/core';\nimport {ensureInit, getElementConfig} from './elementDefine';\nimport {SwcUtils} from '../utils/Utils';\nimport {SwcQueryOptions, HelperHostSet} from '../types';\nimport {ConvertUtils} from '@dooboostore/core-web';\n\n// ============================================\n// Types & Interfaces\n// ============================================\n\nexport interface AttributeOptions extends SwcQueryOptions {\n name?: string;\n type?: typeof Number | typeof Boolean | typeof String;\n filter?: (target: HTMLElement, value: any, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n /**\n * Custom key to extract value from return object.\n * If not provided, uses ATTRIBUTE_METADATA_KEY by default.\n * Useful when multiple @setAttribute decorators are on the same method.\n * \n * Example:\n * @setAttribute('selector1', { valueKey: 'attr1' })\n * @setAttribute('selector2', { valueKey: 'attr2' })\n * myMethod() {\n * return {\n * attr1: 'value1',\n * attr2: 'value2'\n * };\n * }\n * \n * Or with symbols:\n * @setAttribute('selector1', { valueKey: Symbol.for('attr1') })\n * @setAttribute('selector2', { valueKey: Symbol.for('attr2') })\n * myMethod() {\n * return {\n * [Symbol.for('attr1')]: 'value1',\n * [Symbol.for('attr2')]: 'value2'\n * };\n * }\n */\n valueKey?: symbol | string;\n}\n\nexport interface AttributeMetadata {\n propertyKey: string | symbol;\n selector: string;\n targetAttributeName: string;\n options: AttributeOptions;\n type: 'property' | 'method';\n}\n\nexport const ATTRIBUTE_METADATA_KEY = Symbol.for('simple-web-component:attribute');\n\n// ============================================\n// Utilities\n// ============================================\n\n/**\n * Determine if a string is a CSS selector or an attribute name\n * \n * CSS selectors typically:\n * - Start with: #, ., [, :, >, +, ~\n * - Contain special chars: >, +, ~, :, [, ]\n * - Are special keywords: $this, $host, $parentHost, etc.\n * \n * Attribute names are typically:\n * - kebab-case (lowercase with hyphens)\n * - No special selector syntax\n * \n * @param str - String to check\n * @returns true if it's a CSS selector, false if it's an attribute name\n */\nconst isCssSelector = (str: string): boolean => {\n if (!str) return false;\n \n // Special keywords\n if (str.startsWith('$')) return true;\n \n // CSS selector syntax\n if (/^[#.\\[\\:>+~]/.test(str)) return true;\n \n // Contains CSS combinator or pseudo-selector syntax\n if (/[>+~:\\[\\]]/.test(str)) return true;\n \n return false;\n};\n\nconst convertValue = (val: string | null, 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\nexport {convertValue};\n\nexport const getAttributeValue = (inst: any, attrName: string, options?: AttributeOptions & { selector?: string }): any => {\n const conf = getElementConfig(inst);\n const currentWin = inst._resolveWindow?.(conf) || ((typeof window !== 'undefined' ? window : undefined) as any);\n\n // If selector is not provided, use inst itself\n const targets = options?.selector ? resolveAttributeTargets(inst, options.selector, options) : [inst];\n\n const primaryTarget = targets[0];\n\n if (primaryTarget && typeof (primaryTarget as any).hasAttribute === 'function' && (primaryTarget as any).hasAttribute(attrName)) {\n let domVal = (primaryTarget as any).getAttribute(attrName);\n\n // \uD45C\uD604\uC2DD \uCCB4\uD06C\n const ae = new ActionExpression(domVal);\n const expr = ae.getFirstExpression('callReturn');\n if (expr) {\n try {\n const result = FunctionUtils.executeReturn({\n script: ConvertUtils.decodeHtmlEntity(expr.script, currentWin.document),\n context: inst,\n args: SwcUtils.getHelperAndHostSet(currentWin, inst)\n });\n return convertValue(result, options?.type);\n } catch (err) {\n console.error(`[SWC] Failed to execute directive {{= ${expr.script} }}:`, err);\n return convertValue(domVal, options?.type);\n }\n }\n\n return convertValue(domVal, options?.type);\n }\n\n // If no target found, return null\n return null;\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[] for attribute operations\n */\nexport const resolveAttributeTargets = (inst: any, selector: string, options: AttributeOptions): HTMLElement[] => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const r = options.root || 'auto';\n const results: HTMLElement[] = [];\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 {\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 * @applyAttribute decorator - set/get element attributes\n *\n * Usage:\n * - @applyAttribute('selector', 'attrName') - Set attribute with explicit name\n * - @applyAttribute('selector') - Use property name as attribute name\n * - @applyAttribute('selector', { name: 'attrName' }) - Set attribute via options\n * - Return null to remove attribute\n */\nexport function applyAttribute(selector: string, targetAttributeName: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function applyAttribute(selector: string, options?: AttributeOptions): MethodDecorator & PropertyDecorator;\nexport function applyAttribute(selector: string, targetAttributeNameOrOptions?: string | AttributeOptions, options?: AttributeOptions): MethodDecorator & PropertyDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n // ensureInit(target as any);\n\n const constructor = target.constructor;\n const designType = (Reflect as any).getMetadata('design:type', target, propertyKey);\n const metaType: 'property' | 'method' = descriptor && typeof descriptor.value === 'function' ? 'method' : 'property';\n\n // Parse arguments\n let finalOptions: AttributeOptions = {};\n let targetAttributeName: string;\n\n if (typeof targetAttributeNameOrOptions === 'string') {\n // applyAttribute('selector', 'attrName', options?)\n targetAttributeName = targetAttributeNameOrOptions;\n finalOptions = options || {};\n } else if (targetAttributeNameOrOptions) {\n // applyAttribute('selector', options)\n finalOptions = targetAttributeNameOrOptions;\n targetAttributeName = finalOptions.name || String(propertyKey);\n } else {\n // applyAttribute('selector')\n targetAttributeName = String(propertyKey);\n }\n\n // Store metadata\n let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_METADATA_KEY, constructor) as AttributeMetadata[];\n if (!metaList) {\n metaList = [];\n ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, metaList, constructor);\n }\n metaList.push({\n propertyKey,\n selector,\n targetAttributeName,\n options: finalOptions,\n type: metaType\n });\n\n // Helper: Apply resolved value to targets\n const applyValueToTargets = (inst: any, resolvedValue: any) => {\n const conf = getElementConfig(inst);\n const currentWin = conf.window;\n const targetEls = resolveAttributeTargets(inst, selector, finalOptions);\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 if (resolvedValue === null) {\n // Remove attribute if value is null\n targetEl.removeAttribute(targetAttributeName);\n } else if (resolvedValue !== undefined) {\n // Set attribute\n targetEl.setAttribute(targetAttributeName, resolvedValue === true ? '' : String(resolvedValue));\n }\n });\n\n return resolvedValue;\n };\n\n // Method decorator: wrap method to apply its return value to attributes\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 /**\n * Extract value for this decorator from method return value\n * \n * If return value is an object with this decorator's key,\n * use that value. Otherwise use the entire return value.\n * \n * Uses valueKey from options if provided, otherwise uses ATTRIBUTE_METADATA_KEY.\n * \n * Example:\n * @setAttribute('selector1', { valueKey: 'attr1' })\n * @setAttribute('selector2', { valueKey: 'attr2' })\n * myMethod() {\n * return {\n * attr1: 'attribute-value1',\n * attr2: 'attribute-value2'\n * };\n * }\n * \n * First decorator will use 'attribute-value1', second will use 'attribute-value2'\n */\n const extractValue = (v: any) => {\n const keyToUse = finalOptions.valueKey ?? ATTRIBUTE_METADATA_KEY;\n if (v && typeof v === 'object' && keyToUse in v) {\n return v[keyToUse];\n }\n return v;\n };\n\n if (res instanceof Promise) {\n return res.then((v: any) => {\n const extracted = extractValue(v);\n applyValueToTargets(this, extracted);\n return v;\n });\n } else {\n const extracted = extractValue(res);\n applyValueToTargets(this, extracted);\n return res;\n }\n };\n return;\n }\n\n // Property decorator: define getter/setter to proxy to element attributes\n Object.defineProperty(target, propertyKey, {\n configurable: true,\n enumerable: true,\n get(this: any) {\n ensureInit(this);\n const mergedOptions = {...finalOptions, selector, type: finalOptions.type || designType};\n return getAttributeValue(this, targetAttributeName, mergedOptions);\n },\n set(this: any, value: any) {\n ensureInit(this);\n\n if (value instanceof Promise) {\n value.then((v: any) => applyValueToTargets(this, v)).catch(() => { /* swallow */\n });\n } else {\n applyValueToTargets(this, value);\n }\n }\n });\n };\n}\n\n// ============================================\n// Convenience Aliases\n// ============================================\n\n/**\n * @attribute - Field decorator for binding element attributes (read/write)\n * \n * Intelligently distinguishes between attribute names and CSS selectors:\n * \n * Usage patterns:\n * - @attribute('product-id') - Attribute name on $this (auto-detected)\n * - @attribute('#user', 'product-id') - Attribute name on selector\n * - @attribute('product-id', options) - Attribute name on $this with options\n * - @attribute('#user', 'product-id', options) - Attribute name on selector with options\n * - @attribute - Bare decorator (uses property name as attribute on $this)\n * \n * Note: This decorator is for FIELDS ONLY. For methods, use @setAttribute.\n */\nexport function attribute(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\nexport function attribute(attributeName: string, options?: AttributeOptions): PropertyDecorator;\nexport function attribute(selector: string, attributeName: string, options?: AttributeOptions): PropertyDecorator;\nexport function attribute(selectorOrAttributeOrTarget?: string | Object, attributeNameOrOptions?: any, optionsOrDescriptor?: any): any {\n // Bare decorator: @attribute\n if (optionsOrDescriptor !== undefined && (typeof attributeNameOrOptions === 'string' || typeof attributeNameOrOptions === 'symbol')) {\n return applyAttribute('$this', undefined as any, {})(selectorOrAttributeOrTarget as Object, attributeNameOrOptions, optionsOrDescriptor as PropertyDescriptor);\n }\n \n // With string as first parameter\n if (typeof selectorOrAttributeOrTarget === 'string') {\n // Check if first parameter is a CSS selector or attribute name\n const isSelector = isCssSelector(selectorOrAttributeOrTarget);\n \n if (isSelector) {\n // First param is a selector: @attribute('#user', 'product-id', options?)\n return applyAttribute(selectorOrAttributeOrTarget, attributeNameOrOptions as any, optionsOrDescriptor as AttributeOptions);\n } else {\n // First param is an attribute name: @attribute('product-id', options?)\n // Treat as attribute name on $this\n const options = (typeof attributeNameOrOptions === 'object' && attributeNameOrOptions !== null) \n ? attributeNameOrOptions \n : {};\n return applyAttribute('$this', selectorOrAttributeOrTarget, options);\n }\n }\n \n // Without selector (defaults to $this with options)\n return applyAttribute('$this', undefined as any, selectorOrAttributeOrTarget as AttributeOptions);\n}\n\n/**\n * @setAttribute - Method decorator for setting element attributes from method return value\n * \n * Intelligently distinguishes between attribute names and CSS selectors:\n * \n * Usage patterns:\n * - @setAttribute('data-id') - Attribute name on $this (auto-detected)\n * - @setAttribute('#user', 'data-id') - Attribute name on selector\n * - @setAttribute('data-id', options) - Attribute name on $this with options\n * - @setAttribute('#user', 'data-id', options) - Attribute name on selector with options\n * - @setAttribute - Bare decorator (uses method name as attribute on $this)\n * \n * Note: This decorator is for METHODS ONLY. For fields, use @attribute.\n * \n * Example:\n * @setAttribute('data-status')\n * updateStatus() {\n * return 'active';\n * }\n */\nexport function setAttribute(selector: string, attributeName: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttribute(attributeName: string, options?: AttributeOptions): MethodDecorator;\nexport function setAttribute(selectorOrAttributeOrOptions?: string | AttributeOptions, attributeNameOrOptions?: any, optionsOrUndefined?: AttributeOptions): MethodDecorator {\n // With string as first parameter\n if (typeof selectorOrAttributeOrOptions === 'string') {\n // Check if first parameter is a CSS selector or attribute name\n const isSelector = isCssSelector(selectorOrAttributeOrOptions);\n \n if (isSelector) {\n // First param is a selector: @setAttribute('#user', 'data-id', options?)\n return applyAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions as any, optionsOrUndefined as AttributeOptions) as MethodDecorator;\n } else {\n // First param is an attribute name: @setAttribute('data-id', options?)\n // Treat as attribute name on $this\n const options = (typeof attributeNameOrOptions === 'object' && attributeNameOrOptions !== null) \n ? attributeNameOrOptions \n : {};\n return applyAttribute('$this', selectorOrAttributeOrOptions, options) as MethodDecorator;\n }\n }\n \n // Without selector (defaults to $this with options)\n return applyAttribute('$this', undefined as any, selectorOrAttributeOrOptions as AttributeOptions) as MethodDecorator;\n}\n\n// ============================================\n// Metadata Helpers\n// ============================================\n\nexport const findAllAttributeMetadata = (target: any): AttributeMetadata[] => {\n const actualTarget = target instanceof Function ? target : target.constructor;\n return ReflectUtils.findAllMetadata<AttributeMetadata[]>(ATTRIBUTE_METADATA_KEY, actualTarget).flat();\n};\n\n// Backward compatibility alias\nexport const findAllAttributeApplyMetadata = (target: any): Map<string | symbol, AttributeMetadata> => {\n const result = new Map<string | symbol, AttributeMetadata>();\n findAllAttributeMetadata(target).forEach(meta => {\n result.set(meta.propertyKey, meta);\n });\n return result;\n};\n\n\nexport default applyAttribute;\n"],
5
+ "mappings": "AAAA,SAAQ,cAAc,eAAe,wBAAuB;AAC5D,SAAQ,YAAY,wBAAuB;AAC3C,SAAQ,gBAAe;AAEvB,SAAQ,oBAAmB;AA8CpB,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAqBjF,MAAM,gBAAgB,CAAC,QAAyB;AAC9C,MAAI,CAAC,IAAK,QAAO;AAGjB,MAAI,IAAI,WAAW,GAAG,EAAG,QAAO;AAGhC,MAAI,eAAe,KAAK,GAAG,EAAG,QAAO;AAGrC,MAAI,aAAa,KAAK,GAAG,EAAG,QAAO;AAEnC,SAAO;AACT;AAEA,MAAM,eAAe,CAAC,KAAoB,SAAmB;AAC3D,MAA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CAAC;AACD,SAAO;AACT;AAGA,IAAO,yBAAQ;",
6
6
  "names": []
7
7
  }
@@ -23,6 +23,13 @@ function createClassDecorator(action) {
23
23
  descriptor.value = function(...args) {
24
24
  ensureInit(this);
25
25
  const res = original.apply(this, args);
26
+ const extractValue = (v) => {
27
+ const keyToUse = finalOptions.valueKey ?? CLASS_METADATA_KEY;
28
+ if (v && typeof v === "object" && keyToUse in v) {
29
+ return v[keyToUse];
30
+ }
31
+ return v;
32
+ };
26
33
  const handleResult = (resolvedValue) => {
27
34
  if (resolvedValue !== void 0) {
28
35
  const win = this.ownerDocument?.defaultView || window;
@@ -102,31 +109,73 @@ function createClassDecorator(action) {
102
109
  return resolvedValue;
103
110
  };
104
111
  if (res instanceof Promise) {
105
- return res.then(handleResult);
112
+ return res.then((v) => handleResult(extractValue(v)));
106
113
  } else {
107
- return handleResult(res);
114
+ return handleResult(extractValue(res));
108
115
  }
109
116
  };
110
117
  return descriptor;
111
118
  };
112
119
  };
113
120
  }
114
- function applyClass(selector, action = "update", options = {}) {
115
- return createClassDecorator(action)(selector, options);
116
- }
117
- const setClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("set")(selector, classMapOrOptions, options);
118
- const updateClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("update")(selector, classMapOrOptions, options);
119
- const addClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("add")(selector, classMapOrOptions, options);
120
- const removeClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("remove")(selector, classMapOrOptions, options);
121
- const toggleClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("toggle")(selector, classMapOrOptions, options);
122
- function applyClassThis(action = "update", options = {}) {
121
+ function applyClass(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
122
+ if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
123
+ return createClassDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
124
+ }
125
+ if (typeof selectorOrTarget === "string") {
126
+ const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
127
+ const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
128
+ return createClassDecorator(action2)(selectorOrTarget, options2);
129
+ }
130
+ const action = typeof selectorOrTarget === "string" ? selectorOrTarget : "update";
131
+ const options = typeof selectorOrTarget === "object" ? selectorOrTarget : actionOrPropertyKey;
123
132
  return createClassDecorator(action)("$this", options);
124
133
  }
125
- const setClassThis = (classMapOrOptions, options = {}) => createClassDecorator("set")("$this", classMapOrOptions, options);
126
- const updateClassThis = (classMapOrOptions, options = {}) => createClassDecorator("update")("$this", classMapOrOptions, options);
127
- const addClassThis = (classMapOrOptions, options = {}) => createClassDecorator("add")("$this", classMapOrOptions, options);
128
- const removeClassThis = (classMapOrOptions, options = {}) => createClassDecorator("remove")("$this", classMapOrOptions, options);
129
- const toggleClassThis = (classMapOrOptions, options = {}) => createClassDecorator("toggle")("$this", classMapOrOptions, options);
134
+ function setClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
135
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
136
+ return createClassDecorator("set")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
137
+ }
138
+ if (typeof selectorOrTarget === "string") {
139
+ return createClassDecorator("set")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
140
+ }
141
+ return createClassDecorator("set")("$this", selectorOrTarget);
142
+ }
143
+ function updateClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
144
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
145
+ return createClassDecorator("update")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
146
+ }
147
+ if (typeof selectorOrTarget === "string") {
148
+ return createClassDecorator("update")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
149
+ }
150
+ return createClassDecorator("update")("$this", selectorOrTarget);
151
+ }
152
+ function addClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
153
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
154
+ return createClassDecorator("add")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
155
+ }
156
+ if (typeof selectorOrTarget === "string") {
157
+ return createClassDecorator("add")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
158
+ }
159
+ return createClassDecorator("add")("$this", selectorOrTarget);
160
+ }
161
+ function removeClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
162
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
163
+ return createClassDecorator("remove")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
164
+ }
165
+ if (typeof selectorOrTarget === "string") {
166
+ return createClassDecorator("remove")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
167
+ }
168
+ return createClassDecorator("remove")("$this", selectorOrTarget);
169
+ }
170
+ function toggleClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
171
+ if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
172
+ return createClassDecorator("toggle")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
173
+ }
174
+ if (typeof selectorOrTarget === "string") {
175
+ return createClassDecorator("toggle")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
176
+ }
177
+ return createClassDecorator("toggle")("$this", selectorOrTarget);
178
+ }
130
179
  const findAllClassMetadata = (target) => {
131
180
  const result = /* @__PURE__ */ new Map();
132
181
  const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
@@ -140,17 +189,11 @@ const findAllClassMetadata = (target) => {
140
189
  export {
141
190
  CLASS_METADATA_KEY,
142
191
  addClass,
143
- addClassThis,
144
192
  applyClass,
145
- applyClassThis,
146
193
  findAllClassMetadata,
147
194
  removeClass,
148
- removeClassThis,
149
195
  setClass,
150
- setClassThis,
151
196
  toggleClass,
152
- toggleClassThis,
153
- updateClass,
154
- updateClassThis
197
+ updateClass
155
198
  };
156
199
  //# sourceMappingURL=applyClass.js.map