@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/publishSwcAppMessage.ts"],
4
- "sourcesContent": ["import {ReflectUtils} from '@dooboostore/core';\nimport {SwcUtils} from '../utils/Utils';\n\nexport const PUBLISH_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for('simple-web-component:publish-swc-app-message');\n\nexport interface PublishSwcAppMessageMetadata {\n propertyKey: string | symbol;\n messageType?: string;\n}\n\nexport interface PublishSwcAppMessageOptions {\n messageType?: string;\n}\n\nfunction createPublishSwcAppMessage(messageType?: string): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor) as PublishSwcAppMessageMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType });\n \n if (!descriptor) {\n return descriptor;\n }\n\n // \uBA54\uC11C\uB4DC \uB798\uD551 - \uC6D0\uBCF8 \uBA54\uC11C\uB4DC\uC758 \uBC18\uD658\uAC12\uC744 \uCEA1\uCC98\uD558\uC5EC \uBA54\uC2DC\uC9C0 \uBC1C\uD589\n const originalMethod = descriptor.value;\n descriptor.value = function (...args: any[]) {\n // \uC6D0\uBCF8 \uBA54\uC11C\uB4DC \uC2E4\uD589\n const result = originalMethod.apply(this, args);\n \n // Promise \uCCB4\uD06C\n if (result instanceof Promise) {\n result.then((data) => {\n // appHost \uCC3E\uC544\uC11C \uBA54\uC2DC\uC9C0 \uBC1C\uD589\n const appHost = SwcUtils.getAppHost(this as HTMLElement);\n if (appHost) {\n appHost.publishMessage({\n publisher: this,\n data,\n type: messageType\n });\n }\n }).catch((err) => {\n console.warn('publishSwcAppMessage async error:', err);\n });\n } else {\n // \uB3D9\uAE30 \uD638\uCD9C - \uBC14\uB85C \uBA54\uC2DC\uC9C0 \uBC1C\uD589\n const appHost = SwcUtils.getAppHost(this as HTMLElement);\n if (appHost) {\n appHost.publishMessage({\n publisher: this,\n data: result,\n type: messageType\n });\n }\n }\n \n return result;\n };\n\n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function publishSwcAppMessage(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function publishSwcAppMessage(): MethodDecorator;\nexport function publishSwcAppMessage(messageType: string): MethodDecorator;\n\nexport function publishSwcAppMessage(targetOrMessageType?: any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @publishSwcAppMessage\n if (targetOrMessageType && typeof targetOrMessageType === 'object' && \n propertyKey && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol') &&\n descriptor) {\n const target = targetOrMessageType;\n return createPublishSwcAppMessage()(target, propertyKey, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @publishSwcAppMessage() / @publishSwcAppMessage('messageType')\n let messageType: string | undefined;\n\n if (typeof targetOrMessageType === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @publishSwcAppMessage('messageType')\n messageType = targetOrMessageType;\n }\n\n return createPublishSwcAppMessage(messageType);\n}\n\n// Helper function to retrieve publish message metadata\nexport const getPublishSwcAppMessageMetadata = (target: any): PublishSwcAppMessageMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAC3B,mBAAuB;AAEhB,MAAM,uCAAuC,OAAO,IAAI,8CAA8C;AAW7G,SAAS,2BAA2B,aAAuC;AACzE,SAAO,CAAC,QAAgB,aAA8B,eAAoC;AACxF,UAAM,cAAc,OAAO;AAC3B,Q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kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,eAAe,sCAAsC,WAAW;AACtF;",
6
- "names": []
4
+ "sourcesContent": ["import {ReflectUtils} from '@dooboostore/core';\nimport {SwcUtils} from '../utils/Utils';\n\nexport const PUBLISH_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for('simple-web-component:publish-swc-app-message');\n\nexport interface PublishSwcAppMessageMetadata {\n propertyKey: string | symbol;\n messageType?: string;\n}\n\nexport interface PublishSwcAppMessageOptions {\n messageType?: string;\n /**\n * Custom key to extract value from return object.\n * If not provided, uses PUBLISH_SWC_APP_MESSAGE_METADATA_KEY by default.\n * Useful when multiple @publishSwcAppMessage decorators are on the same method.\n * \n * Example:\n * @publishSwcAppMessage('event1', { valueKey: 'detail1' })\n * @publishSwcAppMessage('event2', { valueKey: 'detail2' })\n * myMethod() {\n * return {\n * detail1: { type: 'event1', data: 'value1' },\n * detail2: { type: 'event2', data: 'value2' }\n * };\n * }\n */\n valueKey?: symbol | string;\n}\n\nfunction createPublishSwcAppMessage(messageType?: string, options?: PublishSwcAppMessageOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, constructor) as PublishSwcAppMessageMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(PUBLISH_SWC_APP_MESSAGE_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, messageType });\n \n if (!descriptor) {\n return descriptor;\n }\n\n // \uBA54\uC11C\uB4DC \uB798\uD551 - \uC6D0\uBCF8 \uBA54\uC11C\uB4DC\uC758 \uBC18\uD658\uAC12\uC744 \uCEA1\uCC98\uD558\uC5EC \uBA54\uC2DC\uC9C0 \uBC1C\uD589\n const originalMethod = descriptor.value;\n descriptor.value = function (...args: any[]) {\n // \uC6D0\uBCF8 \uBA54\uC11C\uB4DC \uC2E4\uD589\n const result = originalMethod.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 PUBLISH_SWC_APP_MESSAGE_METADATA_KEY.\n */\n const extractValue = (v: any) => {\n const keyToUse = options?.valueKey ?? PUBLISH_SWC_APP_MESSAGE_METADATA_KEY;\n if (v && typeof v === 'object' && keyToUse in v) {\n return v[keyToUse];\n }\n return v;\n };\n\n const publishMessage = (data: any) => {\n // appHost \uCC3E\uC544\uC11C \uBA54\uC2DC\uC9C0 \uBC1C\uD589\n const appHost = SwcUtils.getAppHost(this as HTMLElement);\n if (appHost) {\n appHost.publishMessage({\n publisher: this,\n data,\n type: messageType\n });\n }\n };\n \n // Promise \uCCB4\uD06C\n if (result instanceof Promise) {\n result.then((data) => {\n const extracted = extractValue(data);\n publishMessage(extracted);\n }).catch((err) => {\n console.warn('publishSwcAppMessage async error:', err);\n });\n } else {\n // \uB3D9\uAE30 \uD638\uCD9C - \uBC14\uB85C \uBA54\uC2DC\uC9C0 \uBC1C\uD589\n const extracted = extractValue(result);\n publishMessage(extracted);\n }\n \n return result;\n };\n\n return descriptor;\n };\n}\n\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uC9C1\uC811 \uC0AC\uC6A9 (\uAD04\uD638 \uC5C6\uC74C)\nexport function publishSwcAppMessage(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor | void;\n// \uC624\uBC84\uB85C\uB4DC \uC2DC\uADF8\uB2C8\uCC98 - \uD568\uC218 \uD638\uCD9C (\uAD04\uD638 \uC788\uC74C)\nexport function publishSwcAppMessage(): MethodDecorator;\nexport function publishSwcAppMessage(messageType: string): MethodDecorator;\nexport function publishSwcAppMessage(messageType: string, options: PublishSwcAppMessageOptions): MethodDecorator;\nexport function publishSwcAppMessage(options: PublishSwcAppMessageOptions): MethodDecorator;\n\nexport function publishSwcAppMessage(targetOrMessageTypeOrOptions?: any, propertyKeyOrOptions?: string | symbol | PublishSwcAppMessageOptions, descriptor?: PropertyDescriptor): any {\n // \uC9C1\uC811 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC5C6\uC74C): @publishSwcAppMessage\n if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === 'object' && \n propertyKeyOrOptions && (typeof propertyKeyOrOptions === 'string' || typeof propertyKeyOrOptions === 'symbol') &&\n descriptor) {\n const target = targetOrMessageTypeOrOptions;\n return createPublishSwcAppMessage()(target, propertyKeyOrOptions, descriptor);\n }\n\n // \uD568\uC218\uB85C \uD638\uCD9C\uB41C \uACBD\uC6B0 (\uAD04\uD638 \uC788\uC74C): @publishSwcAppMessage() / @publishSwcAppMessage('messageType') / @publishSwcAppMessage({...})\n let messageType: string | undefined;\n let options: PublishSwcAppMessageOptions | undefined;\n\n if (typeof targetOrMessageTypeOrOptions === 'string') {\n // \uBA54\uC2DC\uC9C0 \uD0C0\uC785 \uC804\uB2EC: @publishSwcAppMessage('messageType')\n messageType = targetOrMessageTypeOrOptions;\n if (typeof propertyKeyOrOptions === 'object' && propertyKeyOrOptions !== null) {\n options = propertyKeyOrOptions as PublishSwcAppMessageOptions;\n }\n } else if (typeof targetOrMessageTypeOrOptions === 'object' && targetOrMessageTypeOrOptions !== null) {\n // \uC635\uC158 \uAC1D\uCCB4 \uC804\uB2EC: @publishSwcAppMessage({...})\n options = targetOrMessageTypeOrOptions as PublishSwcAppMessageOptions;\n messageType = options.messageType;\n }\n\n return createPublishSwcAppMessage(messageType, options);\n}\n\n// --- Aliases: publish... ---\nexport const publishMessage = publishSwcAppMessage;\n\n// Helper function to retrieve publish message metadata\nexport const getPublishSwcAppMessageMetadata = (target: any): PublishSwcAppMessageMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getOwnMetadata(PUBLISH_SWC_APP_MESSAG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AM;AACrC,QAAAA,gBAAe,SAAS;AAAA,MAC1B;AAEA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AACF;AAUO,SAAS,qBAAqB,8BAAoC,sBAAsE,YAAsC;AAEnL,MAAI,gCAAgC,OAAO,iCAAiC,YACxE,yBAAyB,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,aACrG,YAAY;AACd,UAAM,SAAS;AACf,WAAO,2BAA2B,EAAE,QAAQ,sBAAsB,UAAU;AAAA,EAC9E;AAGA,MAAI;AACJ,MAAI;AAEJ,MAAI,OAAO,iCAAiC,UAAU;AAEpD,kBAAc;AACd,QAAI,OAAO,yBAAyB,YAAY,yBAAyB,MAAM;AAC7E,gBAAU;AAAA,IACZ;AAAA,EACF,WAAW,OAAO,iCAAiC,YAAY,iCAAiC,MAAM;AAEpG,cAAU;AACV,kBAAc,QAAQ;AAAA,EACxB;AAEA,SAAO,2BAA2B,aAAa,OAAO;AACxD;AAGO,MAAM,iBAAiB;AAGvB,MAAM,kCAAkC,CAAC,WAA4D;AAC1G,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,eAAe,sCAAsC,WAAW;AACtF;",
6
+ "names": ["publishMessage"]
7
7
  }
@@ -19,162 +19,113 @@ var query_exports = {};
19
19
  __export(query_exports, {
20
20
  QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
21
21
  getQueryMetadata: () => getQueryMetadata,
22
- query: () => query,
23
- queryAppHost: () => queryAppHost,
24
- queryDocument: () => queryDocument,
25
- queryHost: () => queryHost,
26
- queryThis: () => queryThis,
27
- queryWindow: () => queryWindow
22
+ query: () => query
28
23
  });
29
24
  module.exports = __toCommonJS(query_exports);
30
25
  var import_core = require("@dooboostore/core");
31
26
  var import_elementDefine = require("./elementDefine");
32
27
  var import_Utils = require("../utils/Utils");
33
28
  const QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
34
- function query(selectorOrTarget, options = {}) {
35
- return (targetObj, propertyKey, descriptor) => {
36
- if (descriptor !== void 0) {
37
- throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
38
- }
39
- const constructor = targetObj.constructor;
40
- let queries = import_core.ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
41
- if (!queries) {
42
- queries = [];
43
- import_core.ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);
44
- }
45
- queries.push({ propertyKey, selector: selectorOrTarget, options });
46
- Object.defineProperty(targetObj, propertyKey, {
47
- get() {
48
- (0, import_elementDefine.ensureInit)(this);
49
- const selector = selectorOrTarget;
50
- const r = options.root || "auto";
51
- const applyRoot = (t) => {
52
- if (!t || !(t instanceof HTMLElement))
29
+ function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
30
+ if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
31
+ throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
32
+ }
33
+ if (typeof selectorOrTarget === "string") {
34
+ return (targetObj, propertyKey, descriptor2) => {
35
+ if (descriptor2 !== void 0) {
36
+ throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
37
+ }
38
+ const constructor = targetObj.constructor;
39
+ let queries = import_core.ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
40
+ if (!queries) {
41
+ queries = [];
42
+ import_core.ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);
43
+ }
44
+ queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
45
+ Object.defineProperty(targetObj, propertyKey, {
46
+ get() {
47
+ (0, import_elementDefine.ensureInit)(this);
48
+ const selector = selectorOrTarget;
49
+ const r = optionsOrPropertyKey?.root || "auto";
50
+ const applyRoot = (t) => {
51
+ if (!t || !(t instanceof HTMLElement))
52
+ return t;
53
+ if (r === "auto")
54
+ return t.shadowRoot || t;
55
+ if (r === "shadow")
56
+ return t.shadowRoot;
57
+ if (r === "light")
58
+ return t;
59
+ if (r === "all")
60
+ return t.shadowRoot || t;
53
61
  return t;
54
- if (r === "auto")
55
- return t.shadowRoot || t;
62
+ };
63
+ const hostSet = import_Utils.SwcUtils.getHostSet(this);
64
+ if (selector === "$this")
65
+ return applyRoot(this);
66
+ if (selector === "$host")
67
+ return applyRoot(hostSet.$host);
68
+ if (selector === "$parentHost")
69
+ return applyRoot(hostSet.$parentHost);
70
+ if (selector === "$appHost")
71
+ return applyRoot(hostSet.$appHost);
72
+ if (selector === "$firstHost")
73
+ return applyRoot(hostSet.$firstHost);
74
+ if (selector === "$lastHost")
75
+ return applyRoot(hostSet.$lastHost);
76
+ if (selector === "$firstAppHost")
77
+ return applyRoot(hostSet.$firstAppHost);
78
+ if (selector === "$lastAppHost")
79
+ return applyRoot(hostSet.$lastAppHost);
80
+ const config = (0, import_elementDefine.getElementConfig)(this);
81
+ const win = config?.window || window;
82
+ if (selector === "$window")
83
+ return win;
84
+ if (selector === "$document")
85
+ return win.document;
56
86
  if (r === "shadow")
57
- return t.shadowRoot;
87
+ return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
58
88
  if (r === "light")
59
- return t;
60
- if (r === "all")
61
- return t.shadowRoot || t;
62
- return t;
63
- };
64
- const hostSet = import_Utils.SwcUtils.getHostSet(this);
65
- if (selector === "$this")
66
- return applyRoot(this);
67
- if (selector === "$host")
68
- return applyRoot(hostSet.$host);
69
- if (selector === "$parentHost")
70
- return applyRoot(hostSet.$parentHost);
71
- if (selector === "$appHost")
72
- return applyRoot(hostSet.$appHost);
73
- if (selector === "$firstHost")
74
- return applyRoot(hostSet.$firstHost);
75
- if (selector === "$lastHost")
76
- return applyRoot(hostSet.$lastHost);
77
- if (selector === "$firstAppHost")
78
- return applyRoot(hostSet.$firstAppHost);
79
- if (selector === "$lastAppHost")
80
- return applyRoot(hostSet.$lastAppHost);
81
- const config = (0, import_elementDefine.getElementConfig)(this);
82
- const win = config?.window || window;
83
- if (selector === "$window")
84
- return win;
85
- if (selector === "$document")
86
- return win.document;
87
- if (r === "shadow")
88
- return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
89
- if (r === "light")
90
- return this.querySelector(selector);
91
- if (r === "all") {
92
- const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
93
- return shadowMatch || this.querySelector(selector);
94
- }
95
- return (this.shadowRoot || this).querySelector(selector);
96
- },
97
- set(nv) {
98
- (0, import_elementDefine.ensureInit)(this);
99
- if (nv === null || nv === void 0) {
100
- const selector = selectorOrTarget;
101
- if (selector.startsWith("$") && selector !== "$this")
102
- return;
103
- const r = options.root || "auto";
104
- const targets = [];
105
- if (r === "shadow") {
106
- if (this.shadowRoot?.querySelector(selector))
107
- targets.push(this.shadowRoot.querySelector(selector));
108
- } else if (r === "light") {
109
- if (this.querySelector(selector))
110
- targets.push(this.querySelector(selector));
111
- } else if (r === "all") {
112
- if (this.shadowRoot?.querySelector(selector))
113
- targets.push(this.shadowRoot.querySelector(selector));
114
- if (this.querySelector(selector))
115
- targets.push(this.querySelector(selector));
116
- } else {
117
- const el = (this.shadowRoot || this).querySelector(selector);
118
- if (el)
119
- targets.push(el);
89
+ return this.querySelector(selector);
90
+ if (r === "all") {
91
+ const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
92
+ return shadowMatch || this.querySelector(selector);
120
93
  }
121
- targets.forEach((t) => t.remove());
122
- }
123
- },
124
- enumerable: true,
125
- configurable: true
126
- });
127
- };
128
- }
129
- function queryThis(targetOrOptions, propertyKey) {
130
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
131
- return query("$this", {})(targetOrOptions, propertyKey);
132
- }
133
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
134
- return query("$this", targetOrOptions);
135
- } else {
136
- return query("$this", {});
137
- }
138
- }
139
- function queryWindow(targetOrOptions, propertyKey) {
140
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
141
- return query("$window", {})(targetOrOptions, propertyKey);
142
- }
143
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
144
- return query("$window", targetOrOptions);
145
- } else {
146
- return query("$window", {});
147
- }
148
- }
149
- function queryDocument(targetOrOptions, propertyKey) {
150
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
151
- return query("$document", {})(targetOrOptions, propertyKey);
152
- }
153
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
154
- return query("$document", targetOrOptions);
155
- } else {
156
- return query("$document", {});
157
- }
158
- }
159
- function queryHost(targetOrOptions, propertyKey) {
160
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
161
- return query("$host", {})(targetOrOptions, propertyKey);
162
- }
163
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
164
- return query("$host", targetOrOptions);
165
- } else {
166
- return query("$host", {});
167
- }
168
- }
169
- function queryAppHost(targetOrOptions, propertyKey) {
170
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
171
- return query("$appHost", {})(targetOrOptions, propertyKey);
172
- }
173
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
174
- return query("$appHost", targetOrOptions);
175
- } else {
176
- return query("$appHost", {});
94
+ return (this.shadowRoot || this).querySelector(selector);
95
+ },
96
+ set(nv) {
97
+ (0, import_elementDefine.ensureInit)(this);
98
+ if (nv === null || nv === void 0) {
99
+ const selector = selectorOrTarget;
100
+ if (selector.startsWith("$") && selector !== "$this")
101
+ return;
102
+ const r = optionsOrPropertyKey?.root || "auto";
103
+ const targets = [];
104
+ if (r === "shadow") {
105
+ if (this.shadowRoot?.querySelector(selector))
106
+ targets.push(this.shadowRoot.querySelector(selector));
107
+ } else if (r === "light") {
108
+ if (this.querySelector(selector))
109
+ targets.push(this.querySelector(selector));
110
+ } else if (r === "all") {
111
+ if (this.shadowRoot?.querySelector(selector))
112
+ targets.push(this.shadowRoot.querySelector(selector));
113
+ if (this.querySelector(selector))
114
+ targets.push(this.querySelector(selector));
115
+ } else {
116
+ const el = (this.shadowRoot || this).querySelector(selector);
117
+ if (el)
118
+ targets.push(el);
119
+ }
120
+ targets.forEach((t) => t.remove());
121
+ }
122
+ },
123
+ enumerable: true,
124
+ configurable: true
125
+ });
126
+ };
177
127
  }
128
+ return query("$this", selectorOrTarget);
178
129
  }
179
130
  const getQueryMetadata = (target) => {
180
131
  const constructor = target instanceof Function ? target : target.constructor;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/query.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface QueryMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: SwcQueryOptions ;\n}\n\nexport const QUERY_METADATA_KEY = Symbol.for('simple-web-component:query');\n\nexport function query(target: SpecialSelector): PropertyDecorator;\nexport function query(selector: string, options?: SwcQueryOptions): PropertyDecorator;\n/**\n * @query decorator to inject a single element into a class property.\n */\nexport function query(selectorOrTarget: string, options: any = {}): PropertyDecorator {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryMetadata[]>(QUERY_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget, options });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const selector = selectorOrTarget;\n\n const r = options.root || 'auto';\n const applyRoot = (t: any) => {\n if (!t || !(t instanceof HTMLElement)) return t;\n if (r === 'auto') return t.shadowRoot || t;\n if (r === 'shadow') return t.shadowRoot;\n if (r === 'light') return t;\n if (r === 'all') return t.shadowRoot || t; \n return t;\n };\n\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === '$this') return applyRoot(this);\n if (selector === '$host') return applyRoot(hostSet.$host);\n if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);\n if (selector === '$appHost') return applyRoot(hostSet.$appHost);\n if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);\n if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);\n if (selector === '$firstAppHost') return applyRoot(hostSet.$firstAppHost);\n if (selector === '$lastAppHost') return applyRoot(hostSet.$lastAppHost);\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n if (selector === '$window') return win;\n if (selector === '$document') return win.document;\n\n // --- Standard Selectors ---\n if (r === 'shadow') return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n if (r === 'light') return this.querySelector(selector);\n if (r === 'all') {\n const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n return shadowMatch || this.querySelector(selector);\n }\n return (this.shadowRoot || this).querySelector(selector);\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined) {\n const selector = selectorOrTarget;\n if (selector.startsWith('$') && selector !== '$this') return;\n\n const r = options.root || 'auto';\n const targets: Element[] = [];\n\n if (r === 'shadow') {\n if (this.shadowRoot?.querySelector(selector)) targets.push(this.shadowRoot.querySelector(selector)!);\n } else if (r === 'light') {\n if (this.querySelector(selector)) targets.push(this.querySelector(selector)!);\n } else if (r === 'all') {\n if (this.shadowRoot?.querySelector(selector)) targets.push(this.shadowRoot.querySelector(selector)!);\n if (this.querySelector(selector)) targets.push(this.querySelector(selector)!);\n } else {\n const el = (this.shadowRoot || this).querySelector(selector);\n if (el) targets.push(el);\n }\n\n targets.forEach(t => t.remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n}\n\n/**\n * @queryThis decorator - simplified version of @query for $this selector\n */\nexport function queryThis(target: Object, propertyKey: string | symbol): void;\nexport function queryThis(): PropertyDecorator;\nexport function queryThis(options: SwcQueryOptions): PropertyDecorator;\nexport function queryThis(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query('$this', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query('$this', targetOrOptions as SwcQueryOptions);\n } else {\n return query('$this', {});\n }\n}\n\n\nexport function queryWindow(target: Object, propertyKey: string | symbol): void;\nexport function queryWindow(): PropertyDecorator;\nexport function queryWindow(options: SwcQueryOptions): PropertyDecorator;\nexport function queryWindow(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query('$window', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query('$window', targetOrOptions as SwcQueryOptions);\n } else {\n return query('$window', {});\n }\n}\n\nexport function queryDocument(target: Object, propertyKey: string | symbol): void;\nexport function queryDocument(): PropertyDecorator;\nexport function queryDocument(options: SwcQueryOptions): PropertyDecorator;\nexport function queryDocument(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query('$document', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query('$document', targetOrOptions as SwcQueryOptions);\n } else {\n return query('$document', {});\n }\n}\n/**\n * @host - Query $host (Direct parent SWC component)\n */\nexport function queryHost(target: Object, propertyKey: string | symbol): void;\nexport function queryHost(): PropertyDecorator;\nexport function queryHost(options: SwcQueryOptions): PropertyDecorator;\nexport function queryHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query('$host', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query('$host', targetOrOptions as SwcQueryOptions);\n } else {\n return query('$host', {});\n }\n}\n\n/**\n * @appHost - Query $appHost (Nearest <swc-app>)\n */\nexport function queryAppHost(target: Object, propertyKey: string | symbol): void;\nexport function queryAppHost(): PropertyDecorator;\nexport function queryAppHost(options: SwcQueryOptions): PropertyDecorator;\nexport function queryAppHost(targetOrOptions?: any, propertyKey?: string | symbol): any {\n if (propertyKey !== undefined && (typeof propertyKey === 'string' || typeof propertyKey === 'symbol')) {\n return query('$appHost', {})(targetOrOptions, propertyKey);\n }\n if (typeof targetOrOptions === 'object' && targetOrOptions !== null) {\n return query('$appHost', targetOrOptions as SwcQueryOptions);\n } else {\n return query('$appHost', {});\n }\n}\n\nexport const getQueryMetadata = (target: any): QueryMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor) ?? [];\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AASlB,MAAM,qBAAqB,OAAO,IAAI,4BAA4B;AAOnE,SAAU,MAAM,kBAA0B,UAAe,CAAA,GAAE;AAC/D,SAAO,CAAC,WAAmB,aAA8B,eAA4B;AACnF,QAAI,eAAe,QAAW;AAC5B,YAAM,IAAI,MAAM,wDAAwD,OAAO,WAAW,CAAC,GAAG;IAChG;AAEA,UAAM,cAAc,UAAU;AAC9B,QAAI,UAAU,yBAAa,YAA6B,oBAAoB,WAAW;AACvF,QAAI,CAAC,SAAS;AACZ,gBAAU,CAAA;AACV,+BAAa,eAAe,oBAAoB,SAAS,WAAW;IACtE;AACA,YAAQ,KAAK,EAAE,aAAa,UAAU,kBAAkB,QAAO,CAAE;AAEjE,WAAO,eAAe,WAAW,aAAa;M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"names": []
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface QueryMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: SwcQueryOptions ;\n}\n\nexport const QUERY_METADATA_KEY = Symbol.for('simple-web-component:query');\n\nexport function query(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor | void;\nexport function query(selector: string, options?: SwcQueryOptions): PropertyDecorator;\nexport function query(options?: SwcQueryOptions): PropertyDecorator;\n/**\n * @query decorator to inject a single element into a class property.\n */\nexport function query(selectorOrTarget?: string | Object, optionsOrPropertyKey?: SwcQueryOptions | string | symbol, descriptor?: PropertyDescriptor): any {\n // Bare decorator: @query\n if (descriptor !== undefined && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol')) {\n throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);\n }\n // With selector\n if (typeof selectorOrTarget === 'string') {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryMetadata[]>(QUERY_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey as SwcQueryOptions || {} });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const selector = selectorOrTarget;\n\n const r = (optionsOrPropertyKey as SwcQueryOptions)?.root || 'auto';\n const applyRoot = (t: any) => {\n if (!t || !(t instanceof HTMLElement)) return t;\n if (r === 'auto') return t.shadowRoot || t;\n if (r === 'shadow') return t.shadowRoot;\n if (r === 'light') return t;\n if (r === 'all') return t.shadowRoot || t; \n return t;\n };\n\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === '$this') return applyRoot(this);\n if (selector === '$host') return applyRoot(hostSet.$host);\n if (selector === '$parentHost') return applyRoot(hostSet.$parentHost);\n if (selector === '$appHost') return applyRoot(hostSet.$appHost);\n if (selector === '$firstHost') return applyRoot(hostSet.$firstHost);\n if (selector === '$lastHost') return applyRoot(hostSet.$lastHost);\n if (selector === '$firstAppHost') return applyRoot(hostSet.$firstAppHost);\n if (selector === '$lastAppHost') return applyRoot(hostSet.$lastAppHost);\n\n // --- Special Selectors: Env ---\n const config = getElementConfig(this);\n const win = config?.window || window;\n if (selector === '$window') return win;\n if (selector === '$document') return win.document;\n\n // --- Standard Selectors ---\n if (r === 'shadow') return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n if (r === 'light') return this.querySelector(selector);\n if (r === 'all') {\n const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;\n return shadowMatch || this.querySelector(selector);\n }\n return (this.shadowRoot || this).querySelector(selector);\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined) {\n const selector = selectorOrTarget;\n if (selector.startsWith('$') && selector !== '$this') return;\n\n const r = (optionsOrPropertyKey as SwcQueryOptions)?.root || 'auto';\n const targets: Element[] = [];\n\n if (r === 'shadow') {\n if (this.shadowRoot?.querySelector(selector)) targets.push(this.shadowRoot.querySelector(selector)!);\n } else if (r === 'light') {\n if (this.querySelector(selector)) targets.push(this.querySelector(selector)!);\n } else if (r === 'all') {\n if (this.shadowRoot?.querySelector(selector)) targets.push(this.shadowRoot.querySelector(selector)!);\n if (this.querySelector(selector)) targets.push(this.querySelector(selector)!);\n } else {\n const el = (this.shadowRoot || this).querySelector(selector);\n if (el) targets.push(el);\n }\n\n targets.forEach(t => t.remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n }\n // Without selector (defaults to $this)\n return query('$this', selectorOrTarget as SwcQueryOptions);\n}\n\nexport const getQueryMetadata = (target: any): QueryMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor) ?? [];\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AASlB,MAAM,qBAAqB,OAAO,IAAI,4BAA4B;AAQnE,SAAU,MAAM,kBAAoC,sBAA0D,YAA+B;AAEjJ,MAAI,eAAe,WAAc,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,WAAW;AACtH,UAAM,IAAI,MAAM,wDAAwD,OAAO,oBAAoB,CAAC,GAAG;EACzG;AAEA,MAAI,OAAO,qBAAqB,UAAU;AACxC,WAAO,CAAC,WAAmB,aAA8BA,gBAA4B;AACnF,UAAIA,gBAAe,QAAW;AAC5B,cAAM,IAAI,MAAM,wDAAwD,OAAO,WAAW,CAAC,GAAG;MAChG;AAEA,YAAM,cAAc,UAAU;AAC9B,UAAI,UAAU,yBAAa,YAA6B,oBAAoB,WAAW;AACvF,UAAI,CAAC,SAAS;AACZ,kBAAU,CAAA;AACV,iCAAa,eAAe,oBAAoB,SAAS,WAAW;MACtE;AACA,cAAQ,KAAK,EAAE,aAAa,UAAU,kBAAkB,SAAS,wBAA2C,CAAA,EAAE,CAAE;AAEhH,aAAO,eAAe,WAAW,aAAa;QAC5C,MAAG;AACD,+CAAW,IAAI;AACf,gBAAM,WAAW;AAEjB,gBAAM,IAAK,sBAA0C,QAAQ;AAC7D,gBAAM,YAAY,CAAC,MAAU;AAC3B,gBAAI,CAAC,KAAK,EAAE,aAAa;AAAc,qBAAO;AAC9C,gBAAI,MAAM;AAAQ,qBAAO,EAAE,cAAc;AACzC,gBAAI,MAAM;AAAU,qBAAO,EAAE;AAC7B,gBAAI,MAAM;AAAS,qBAAO;AAC1B,gBAAI,MAAM;AAAO,q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QAAQ,CAAE;YACrG,WAAW,MAAM,SAAS;AACxB,kBAAI,KAAK,cAAc,QAAQ;AAAG,wBAAQ,KAAK,KAAK,cAAc,QAAQ,CAAE;YAC9E,WAAW,MAAM,OAAO;AACtB,kBAAI,KAAK,YAAY,cAAc,QAAQ;AAAG,wBAAQ,KAAK,KAAK,WAAW,cAAc,QAAQ,CAAE;AACnG,kBAAI,KAAK,cAAc,QAAQ;AAAG,wBAAQ,KAAK,KAAK,cAAc,QAAQ,CAAE;YAC9E,OAAO;AACL,oBAAM,MAAM,KAAK,cAAc,MAAM,cAAc,QAAQ;AAC3D,kBAAI;AAAI,wBAAQ,KAAK,EAAE;YACzB;AAEA,oBAAQ,QAAQ,OAAK,EAAE,OAAM,CAAE;UACjC;QACF;QACA,YAAY;QACZ,cAAc;OACf;IACH;EACF;AAEA,SAAO,MAAM,SAAS,gBAAmC;AAC3D;AAEO,MAAM,mBAAmB,CAAC,WAAiC;AAChE,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,YAAY,oBAAoB,WAAW,KAAK,CAAA;AACtE;",
6
+ "names": ["descriptor"]
7
7
  }
@@ -18,150 +18,123 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var queryAll_exports = {};
19
19
  __export(queryAll_exports, {
20
20
  QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
21
- allAppHost: () => allAppHost,
22
- allParentHost: () => allParentHost,
23
21
  getQueryAllMetadata: () => getQueryAllMetadata,
24
- queryAll: () => queryAll,
25
- queryAllThis: () => queryAllThis
22
+ queryAll: () => queryAll
26
23
  });
27
24
  module.exports = __toCommonJS(queryAll_exports);
28
25
  var import_core = require("@dooboostore/core");
29
26
  var import_elementDefine = require("./elementDefine");
30
27
  var import_Utils = require("../utils/Utils");
31
28
  const QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
32
- function queryAll(selectorOrTarget, options = {}) {
33
- return (targetObj, propertyKey, descriptor) => {
34
- if (descriptor !== void 0) {
35
- throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
36
- }
37
- const constructor = targetObj.constructor;
38
- let queries = import_core.ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
39
- if (!queries) {
40
- queries = [];
41
- import_core.ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
42
- }
43
- queries.push({ propertyKey, selector: selectorOrTarget, options });
44
- Object.defineProperty(targetObj, propertyKey, {
45
- get() {
46
- (0, import_elementDefine.ensureInit)(this);
47
- const selector = selectorOrTarget;
48
- const r = options.root || "auto";
49
- const applyRoot = (t) => {
50
- if (!t)
51
- return [];
52
- const items = Array.isArray(t) ? t : [t];
53
- const results = [];
54
- items.forEach((it) => {
55
- if (!(it instanceof HTMLElement)) {
56
- results.push(it);
57
- return;
58
- }
59
- if (r === "auto")
60
- results.push(it.shadowRoot || it);
61
- else {
62
- if (r === "light" || r === "all")
63
- results.push(it);
64
- if ((r === "shadow" || r === "all") && it.shadowRoot)
65
- results.push(it.shadowRoot);
66
- }
67
- });
68
- return results;
69
- };
70
- const hostSet = import_Utils.SwcUtils.getHostSet(this);
71
- if (selector === "$hosts")
72
- return applyRoot(hostSet.$hosts);
73
- if (selector === "$appHosts")
74
- return applyRoot(hostSet.$appHosts);
75
- if (selector === "$host")
76
- return applyRoot(hostSet.$host);
77
- if (selector === "$parentHost")
78
- return applyRoot(hostSet.$parentHost);
79
- if (selector === "$appHost")
80
- return applyRoot(hostSet.$appHost);
81
- if (selector === "$firstHost")
82
- return applyRoot(hostSet.$firstHost);
83
- if (selector === "$lastHost")
84
- return applyRoot(hostSet.$lastHost);
85
- if (selector === "$firstAppHost")
86
- return applyRoot(hostSet.$firstAppHost);
87
- if (selector === "$lastAppHost")
88
- return applyRoot(hostSet.$lastAppHost);
89
- const config = (0, import_elementDefine.getElementConfig)(this);
90
- const win = config?.window || window;
91
- if (selector === "$window")
92
- return [win];
93
- if (selector === "$document")
94
- return [win.document];
95
- if (selector === "$this")
96
- return applyRoot(this);
97
- if (r === "shadow")
98
- return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
99
- if (r === "light")
100
- return Array.from(this.querySelectorAll(selector));
101
- if (r === "all") {
102
- const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
103
- const lNodes = Array.from(this.querySelectorAll(selector));
104
- return [...sNodes, ...lNodes];
105
- }
106
- const root = this.shadowRoot || this;
107
- return Array.from(root.querySelectorAll(selector));
108
- },
109
- set(nv) {
110
- (0, import_elementDefine.ensureInit)(this);
111
- if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
29
+ function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
30
+ if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
31
+ throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
32
+ }
33
+ if (typeof selectorOrTarget === "string") {
34
+ return (targetObj, propertyKey, descriptor2) => {
35
+ if (descriptor2 !== void 0) {
36
+ throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
37
+ }
38
+ const constructor = targetObj.constructor;
39
+ let queries = import_core.ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
40
+ if (!queries) {
41
+ queries = [];
42
+ import_core.ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
43
+ }
44
+ queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
45
+ Object.defineProperty(targetObj, propertyKey, {
46
+ get() {
47
+ (0, import_elementDefine.ensureInit)(this);
112
48
  const selector = selectorOrTarget;
113
- if (selector.startsWith("$") && selector !== "$this")
114
- return;
115
- const r = options.root || "auto";
116
- let targets = [];
49
+ const r = optionsOrPropertyKey?.root || "auto";
50
+ const applyRoot = (t) => {
51
+ if (!t)
52
+ return [];
53
+ const items = Array.isArray(t) ? t : [t];
54
+ const results = [];
55
+ items.forEach((it) => {
56
+ if (!(it instanceof HTMLElement)) {
57
+ results.push(it);
58
+ return;
59
+ }
60
+ if (r === "auto")
61
+ results.push(it.shadowRoot || it);
62
+ else {
63
+ if (r === "light" || r === "all")
64
+ results.push(it);
65
+ if ((r === "shadow" || r === "all") && it.shadowRoot)
66
+ results.push(it.shadowRoot);
67
+ }
68
+ });
69
+ return results;
70
+ };
71
+ const hostSet = import_Utils.SwcUtils.getHostSet(this);
72
+ if (selector === "$hosts")
73
+ return applyRoot(hostSet.$hosts);
74
+ if (selector === "$appHosts")
75
+ return applyRoot(hostSet.$appHosts);
76
+ if (selector === "$host")
77
+ return applyRoot(hostSet.$host);
78
+ if (selector === "$parentHost")
79
+ return applyRoot(hostSet.$parentHost);
80
+ if (selector === "$appHost")
81
+ return applyRoot(hostSet.$appHost);
82
+ if (selector === "$firstHost")
83
+ return applyRoot(hostSet.$firstHost);
84
+ if (selector === "$lastHost")
85
+ return applyRoot(hostSet.$lastHost);
86
+ if (selector === "$firstAppHost")
87
+ return applyRoot(hostSet.$firstAppHost);
88
+ if (selector === "$lastAppHost")
89
+ return applyRoot(hostSet.$lastAppHost);
90
+ const config = (0, import_elementDefine.getElementConfig)(this);
91
+ const win = config?.window || window;
92
+ if (selector === "$window")
93
+ return [win];
94
+ if (selector === "$document")
95
+ return [win.document];
96
+ if (selector === "$this")
97
+ return applyRoot(this);
117
98
  if (r === "shadow")
118
- targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
119
- else if (r === "light")
120
- targets = Array.from(this.querySelectorAll(selector));
121
- else if (r === "all") {
99
+ return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
100
+ if (r === "light")
101
+ return Array.from(this.querySelectorAll(selector));
102
+ if (r === "all") {
122
103
  const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
123
104
  const lNodes = Array.from(this.querySelectorAll(selector));
124
- targets = [...sNodes, ...lNodes];
125
- } else {
126
- targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
105
+ return [...sNodes, ...lNodes];
127
106
  }
128
- targets.forEach((t) => t.remove());
129
- }
130
- },
131
- enumerable: true,
132
- configurable: true
133
- });
134
- };
135
- }
136
- function queryAllThis(targetOrOptions, propertyKey) {
137
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
138
- return queryAll("$this", {})(targetOrOptions, propertyKey);
139
- }
140
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
141
- return queryAll("$this", targetOrOptions);
142
- } else {
143
- return queryAll("$this", {});
144
- }
145
- }
146
- function allParentHost(targetOrOptions, propertyKey) {
147
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
148
- return queryAll("$host", {})(targetOrOptions, propertyKey);
149
- }
150
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
151
- return queryAll("$host", targetOrOptions);
152
- } else {
153
- return queryAll("$host", {});
154
- }
155
- }
156
- function allAppHost(targetOrOptions, propertyKey) {
157
- if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
158
- return queryAll("$appHost", {})(targetOrOptions, propertyKey);
159
- }
160
- if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
161
- return queryAll("$appHost", targetOrOptions);
162
- } else {
163
- return queryAll("$appHost", {});
107
+ const root = this.shadowRoot || this;
108
+ return Array.from(root.querySelectorAll(selector));
109
+ },
110
+ set(nv) {
111
+ (0, import_elementDefine.ensureInit)(this);
112
+ if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
113
+ const selector = selectorOrTarget;
114
+ if (selector.startsWith("$") && selector !== "$this")
115
+ return;
116
+ const r = optionsOrPropertyKey?.root || "auto";
117
+ let targets = [];
118
+ if (r === "shadow")
119
+ targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
120
+ else if (r === "light")
121
+ targets = Array.from(this.querySelectorAll(selector));
122
+ else if (r === "all") {
123
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
124
+ const lNodes = Array.from(this.querySelectorAll(selector));
125
+ targets = [...sNodes, ...lNodes];
126
+ } else {
127
+ targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
128
+ }
129
+ targets.forEach((t) => t.remove());
130
+ }
131
+ },
132
+ enumerable: true,
133
+ configurable: true
134
+ });
135
+ };
164
136
  }
137
+ return queryAll("$this", selectorOrTarget);
165
138
  }
166
139
  const getQueryAllMetadata = (target) => {
167
140
  const constructor = target instanceof Function ? target : target.constructor;