@dooboostore/simple-web-component 1.0.44 → 1.0.46

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 (95) hide show
  1. package/README.md +25 -25
  2. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  3. package/dist/cjs/decorators/applyAttribute.js +36 -15
  4. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  5. package/dist/cjs/decorators/applyClass.js +53 -22
  6. package/dist/cjs/decorators/applyClass.js.map +2 -2
  7. package/dist/cjs/decorators/applyNode.js +54 -24
  8. package/dist/cjs/decorators/applyNode.js.map +2 -2
  9. package/dist/cjs/decorators/applyProperty.js +38 -17
  10. package/dist/cjs/decorators/applyProperty.js.map +2 -2
  11. package/dist/cjs/decorators/applyStyle.js +53 -22
  12. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  13. package/dist/cjs/decorators/elementDefine.js +49 -33
  14. package/dist/cjs/decorators/elementDefine.js.map +3 -3
  15. package/dist/cjs/decorators/emitCustomEvent.js +61 -47
  16. package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
  17. package/dist/cjs/decorators/lifecycles.js +11 -36
  18. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  19. package/dist/cjs/decorators/query.js +91 -56
  20. package/dist/cjs/decorators/query.js.map +2 -2
  21. package/dist/cjs/decorators/queryAll.js +104 -66
  22. package/dist/cjs/decorators/queryAll.js.map +2 -2
  23. package/dist/cjs/elements/SwcAppMixin.js +6 -2
  24. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  25. package/dist/cjs/types/window.d.js.map +1 -1
  26. package/dist/esm/decorators/addEventListener.js.map +2 -2
  27. package/dist/esm/decorators/applyAttribute.js +36 -15
  28. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  29. package/dist/esm/decorators/applyClass.js +53 -22
  30. package/dist/esm/decorators/applyClass.js.map +2 -2
  31. package/dist/esm/decorators/applyNode.js +54 -24
  32. package/dist/esm/decorators/applyNode.js.map +2 -2
  33. package/dist/esm/decorators/applyProperty.js +38 -17
  34. package/dist/esm/decorators/applyProperty.js.map +2 -2
  35. package/dist/esm/decorators/applyStyle.js +53 -22
  36. package/dist/esm/decorators/applyStyle.js.map +2 -2
  37. package/dist/esm/decorators/elementDefine.js +50 -34
  38. package/dist/esm/decorators/elementDefine.js.map +2 -2
  39. package/dist/esm/decorators/emitCustomEvent.js +61 -47
  40. package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
  41. package/dist/esm/decorators/lifecycles.js +11 -36
  42. package/dist/esm/decorators/lifecycles.js.map +2 -2
  43. package/dist/esm/decorators/query.js +91 -56
  44. package/dist/esm/decorators/query.js.map +2 -2
  45. package/dist/esm/decorators/queryAll.js +104 -66
  46. package/dist/esm/decorators/queryAll.js.map +2 -2
  47. package/dist/esm/elements/SwcAppMixin.js +6 -2
  48. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  49. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +572 -320
  50. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +3 -3
  51. package/dist/types/decorators/addEventListener.d.ts +7 -6
  52. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  53. package/dist/types/decorators/applyAttribute.d.ts +13 -8
  54. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  55. package/dist/types/decorators/applyClass.d.ts +8 -7
  56. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  57. package/dist/types/decorators/applyNode.d.ts +18 -17
  58. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  59. package/dist/types/decorators/applyProperty.d.ts +14 -9
  60. package/dist/types/decorators/applyProperty.d.ts.map +1 -1
  61. package/dist/types/decorators/applyStyle.d.ts +6 -5
  62. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  63. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  64. package/dist/types/decorators/emitCustomEvent.d.ts +3 -2
  65. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  66. package/dist/types/decorators/lifecycles.d.ts +12 -13
  67. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  68. package/dist/types/decorators/query.d.ts +15 -5
  69. package/dist/types/decorators/query.d.ts.map +1 -1
  70. package/dist/types/decorators/queryAll.d.ts +15 -5
  71. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  72. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  73. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +572 -320
  74. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +3 -3
  75. package/package.json +3 -3
  76. package/src/decorators/addEventListener.ts +9 -7
  77. package/src/decorators/applyAttribute.ts +60 -27
  78. package/src/decorators/applyClass.ts +78 -32
  79. package/src/decorators/applyNode.ts +118 -73
  80. package/src/decorators/applyProperty.ts +63 -30
  81. package/src/decorators/applyStyle.ts +76 -30
  82. package/src/decorators/elementDefine.ts +57 -37
  83. package/src/decorators/emitCustomEvent.ts +63 -39
  84. package/src/decorators/lifecycles.ts +53 -52
  85. package/src/decorators/query.ts +111 -49
  86. package/src/decorators/queryAll.ts +121 -61
  87. package/src/elements/SwcAppMixin.ts +7 -3
  88. package/src/types/window.d.ts +3 -0
  89. package/dist/cjs/examples/RxJSOperatorsExample.js +0 -285
  90. package/dist/cjs/examples/RxJSOperatorsExample.js.map +0 -7
  91. package/dist/esm/examples/RxJSOperatorsExample.js +0 -266
  92. package/dist/esm/examples/RxJSOperatorsExample.js.map +0 -7
  93. package/dist/types/examples/RxJSOperatorsExample.d.ts +0 -94
  94. package/dist/types/examples/RxJSOperatorsExample.d.ts.map +0 -1
  95. package/src/examples/RxJSOperatorsExample.ts +0 -279
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/lifecycles.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\nexport const ON_INITIALIZE_METADATA_KEY = Symbol.for('simple-web-component:on-constructor');\nexport const ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-connected');\nexport const ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-connected');\nexport const ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-disconnected');\nexport const ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-disconnected');\nexport const ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-adopted');\nexport const ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-adopted');\nexport const ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:on-add-event-listener');\nexport const ON_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component');\nexport const ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for('simple-web-component:on-connected-swc-app');\nexport const ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for('simple-web-component:on-completed');\n\nexport const ATTRIBUTE_CHANGED_WILDCARD = '*';\n\nexport interface InnerHtmlOptions {\n ssrFirst?: boolean;\n // replaceWrap?:{ start: string, end:string},\n useShadow?: boolean;\n}\nexport interface InnerHtmlMetadata {\n propertyKey: string | symbol;\n options: InnerHtmlOptions;\n}\n\nexport interface OnConnectedOptions {\n ssrFirst?: boolean;\n order?: number;\n}\nexport interface OnConnectedMetadata {\n propertyKey: string | symbol;\n options: OnConnectedOptions;\n}\n\nexport interface LifecycleOptions {\n order?: number;\n}\nexport interface LifecycleMetadata {\n propertyKey: string | symbol;\n order?: number;\n}\n\n\nexport function onConnectedBefore(options: OnConnectedOptions): MethodDecorator;\nexport function onConnectedBefore(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedBefore(arg1?: OnConnectedOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n const decorator = (options: OnConnectedOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<OnConnectedMetadata[]>(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n };\n\n if (arg2) {\n return decorator({}, arg1!, arg2);\n }\n\n return (target: Object, propertyKey: string | symbol) => {\n decorator((arg1 as OnConnectedOptions) || {}, target, propertyKey);\n };\n}\n\nexport function onConnectedAfter(options: OnConnectedOptions): MethodDecorator;\nexport function onConnectedAfter(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedAfter(arg1?: OnConnectedOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n const decorator = (options: OnConnectedOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<OnConnectedMetadata[]>(ON_AFTER_CONNECTED_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n };\n\n if (arg2) {\n return decorator({}, arg1!, arg2);\n }\n\n return (target: Object, propertyKey: string | symbol) => {\n decorator((arg1 as OnConnectedOptions) || {}, target, propertyKey);\n };\n}\n\n\nfunction createLifecycleDecorator(metadataKey: symbol): ((options?: LifecycleOptions) => MethodDecorator) & MethodDecorator {\n const decorator = (options?: LifecycleOptions): MethodDecorator => {\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(metadataKey, list, constructor);\n }\n list.push({ propertyKey, order: options?.order ?? 0 });\n };\n };\n\n // Support both @decorator and @decorator() syntax\n return Object.assign(\n (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(metadataKey, list, constructor);\n }\n list.push({ propertyKey, order: 0 });\n },\n { __isDecorator: true, __decorator: decorator }\n ) as any;\n}\n\n// Helper to handle both @decorator and @decorator() syntax\nfunction createLifecycleDecoratorWithOptions(metadataKey: symbol) {\n return function(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n if (propertyKey) {\n // Direct decorator usage: @decorator\n const constructor = (optionOrTarget as Object).constructor;\n let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(metadataKey, list, constructor);\n }\n list.push({ propertyKey, order: 0 });\n return;\n }\n\n // Decorator with options: @decorator({ order: 1 })\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(metadataKey, list, constructor);\n }\n list.push({ propertyKey, order: (optionOrTarget as LifecycleOptions)?.order ?? 0 });\n };\n };\n}\n\nexport function onInitialize(options?: LifecycleOptions): MethodDecorator;\nexport function onInitialize(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onInitialize(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_INITIALIZE_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport function onDisconnectedBefore(options?: LifecycleOptions): MethodDecorator;\nexport function onDisconnectedBefore(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onDisconnectedBefore(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_BEFORE_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport function onDisconnectedAfter(options?: LifecycleOptions): MethodDecorator;\nexport function onDisconnectedAfter(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onDisconnectedAfter(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_AFTER_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport const onDisconnected = onDisconnectedAfter;\n\nexport function onAdoptedBefore(options?: LifecycleOptions): MethodDecorator;\nexport function onAdoptedBefore(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onAdoptedBefore(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_BEFORE_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport function onAdoptedAfter(options?: LifecycleOptions): MethodDecorator;\nexport function onAdoptedAfter(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onAdoptedAfter(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_AFTER_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport const onAdopted = onAdoptedAfter;\n\nexport function onConnectedSwcApp(options?: LifecycleOptions): MethodDecorator;\nexport function onConnectedSwcApp(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedSwcApp(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_CONNECTED_SWC_APP_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport function onConnectedCompleted(options?: LifecycleOptions): MethodDecorator;\nexport function onConnectedCompleted(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedCompleted(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_CONNECTED_COMPLETED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\n\n\n\n\nconst decorator = (options: InnerHtmlOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<InnerHtmlMetadata[]>(ON_CONNECTED_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(ON_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n};\n\nexport function onConnectedShadow(options: Omit<InnerHtmlOptions, 'useShadow'>): MethodDecorator; // \uD30C\uB77C\uBBF8\uD130\uC788\uC74C\nexport function onConnectedShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void; // \uD30C\uB77C\uBBF8\uD130\uC5C6\uC74C\nexport function onConnectedShadow(optionOrTarget: Omit<InnerHtmlOptions, 'useShadow'> | Object, propertyKey?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n if (propertyKey) { // no parameter option @decorator\n return decorator({useShadow: true}, optionOrTarget!, propertyKey);\n }\n // parameter option @decorator()\n return (target: Object, propertyKey: string | symbol) => {\n decorator({...optionOrTarget??{}, useShadow: true}, target, propertyKey);\n };\n}\n\nexport function onConnectedLight(options: Omit<InnerHtmlOptions, 'useShadow'>): MethodDecorator; // \uD30C\uB77C\uBBF8\uD130\uC788\uC74C\nexport function onConnectedLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void; // \uD30C\uB77C\uBBF8\uD130\uC5C6\uC74C\nexport function onConnectedLight(optionOrTarget: Omit<InnerHtmlOptions, 'useShadow'> | Object, propertyKey?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n if (propertyKey) { // no parameter option @decorator\n return decorator({useShadow: false}, optionOrTarget!, propertyKey);\n }\n // parameter option @decorator()\n return (target: Object, propertyKey: string | symbol) => {\n decorator({...optionOrTarget??{}, useShadow: false}, target, propertyKey);\n };\n}\nexport function onConnected(options: InnerHtmlOptions): MethodDecorator;\nexport function onConnected(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnected(optionOrTarget: InnerHtmlOptions | Object, propertyKey?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n if (propertyKey) { // no parameter option @decorator\n return decorator({}, optionOrTarget!, propertyKey);\n }\n // parameter option @decorator()\n return (target: Object, propertyKey: string | symbol) => {\n decorator((optionOrTarget as InnerHtmlOptions) || {}, target, propertyKey);\n };\n}\n\n/**\n * \uD504\uB85C\uD1A0\uD0C0\uC785 \uCCB4\uC778\uC744 \uC21C\uD68C\uD558\uBA70 \uBAA8\uB4E0 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uBA54\uC11C\uB4DC\uB97C \uC218\uC9D1\uD569\uB2C8\uB2E4.\n */\nexport const findAllLifecycleMetadata = (target: any, metadataKey: symbol): LifecycleMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[] ?? [];\n // Sort by order (default 0 if not specified)\n return [...results].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n};\n\nexport const findAllOnConnectedMetadata = (target: any): InnerHtmlMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getMetadata(ON_CONNECTED_METADATA_KEY, constructor) ?? [];\n // Sort by order (default 0 if not specified)\n return [...results].sort((a, b) => {\n const orderA = (a.options as any)?.order ?? 0;\n const orderB = (b.options as any)?.order ?? 0;\n return orderA - orderB;\n });\n};\n\nexport const findAllOnConnectedBeforeMetadata = (target: any): OnConnectedMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];\n // Sort by order\n return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));\n};\n\nexport const findAllOnConnectedAfterMetadata = (target: any): OnConnectedMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];\n // Sort by order\n return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAEtB,MAAM,6BAA6B,OAAO,IAAI,qCAAqC;AACnF,MAAM,mCAAmC,OAAO,IAAI,0CAA0C;AAC9F,MAAM,kCAAkC,OAAO,IAAI,yCAAyC;AAC5F,MAAM,sCAAsC,OAAO,IAAI,6CAA6C;AACpG,MAAM,qCAAqC,OAAO,IAAI,4CAA4C;AAClG,MAAM,iCAAiC,OAAO,IAAI,wCAAwC;AAC1F,MAAM,gCAAgC,OAAO,IAAI,uCAAuC;AACxF,MAAM,qCAAqC,OAAO,IAAI,4CAA4C;AAClG,MAAM,4BAA4B,OAAO,IAAI,sBAAsB;AACnE,MAAM,oCAAoC,OAAO,IAAI,2CAA2C;AAChG,MAAM,sCAAsC,OAAO,IAAI,mCAAmC;AAE1F,MAAM,6BAA6B;AAgCnC,SAAS,kBAAkB,MAAoC,MAAwB,MAAmD;AAC/I,QAAMA,aAAY,CAAC,SAA6B,QAAgB,gBAAiC;AAC/F,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,YAAmC,kCAAkC,WAAW;AACxG,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,+BAAa,eAAe,kCAAkC,MAAM,WAAW;AAAA,IACjF;AACA,SAAK,KAAK,EAAE,aAAa,QAAQ,CAAC;AAAA,EACpC;AAEA,MAAI,MAAM;AACR,WAAOA,WAAU,CAAC,GAAG,MAAO,IAAI;AAAA,EA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AAO,EAAE,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,SAAS,EAAE;AACpE;AAEO,MAAM,6BAA6B,CAAC,WAAqC;AAC9E,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,QAAM,UAAU,yBAAa,YAAY,2BAA2B,WAAW,KAAK,CAAC;AAErF,SAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,MAAM;AACjC,UAAM,SAAU,EAAE,SAAiB,SAAS;AAC5C,UAAM,SAAU,EAAE,SAAiB,SAAS;AAC5C,WAAO,SAAS;AAAA,EAClB,CAAC;AACH;AAEO,MAAM,mCAAmC,CAAC,WAAuC;AACtF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,QAAM,UAAU,yBAAa,YAAY,kCAAkC,WAAW,KAAK,CAAC;AAE5F,SAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,EAAE;AACtF;AAEO,MAAM,kCAAkC,CAAC,WAAuC;AACrF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,QAAM,UAAU,yBAAa,YAAY,iCAAiC,WAAW,KAAK,CAAC;AAE3F,SAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,EAAE;AACtF;",
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\n\nexport const ON_INITIALIZE_METADATA_KEY = Symbol.for('simple-web-component:on-constructor');\nexport const ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-connected');\nexport const ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-connected');\nexport const ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-disconnected');\nexport const ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-disconnected');\nexport const ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for('simple-web-component:on-before-adopted');\nexport const ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for('simple-web-component:on-after-adopted');\nexport const ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for('simple-web-component:on-add-event-listener');\nexport const ON_CONNECTED_BODY_METADATA_KEY = Symbol.for('simple-web-component:on-connected-body');\nexport const ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for('simple-web-component:on-connected-swc-app');\nexport const ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for('simple-web-component:on-completed');\n\nexport const ATTRIBUTE_CHANGED_WILDCARD = '*';\n\nexport interface OnConnectedAppendChildOptions {\n // ssrFirst?: boolean;\n // replaceWrap?:{ start: string, end:string},\n useShadow?: boolean;\n order?: number;\n}\nexport interface OnConnectedAppendChildOptionsMetadata {\n propertyKey: string | symbol;\n options: OnConnectedAppendChildOptions;\n}\n\nexport interface OnConnectedOptions {\n // ssrFirst?: boolean;\n order?: number;\n}\nexport interface OnConnectedMetadata {\n propertyKey: string | symbol;\n options: OnConnectedOptions;\n}\n\nexport interface LifecycleOptions {\n order?: number;\n}\nexport interface LifecycleMetadata {\n propertyKey: string | symbol;\n order?: number;\n}\n\n\nexport function onConnectedBefore(options: OnConnectedOptions): MethodDecorator;\nexport function onConnectedBefore(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedBefore(arg1?: OnConnectedOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n const decorator = (options: OnConnectedOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<OnConnectedMetadata[]>(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n };\n\n if (arg2) {\n return decorator({}, arg1!, arg2);\n }\n\n return (target: Object, propertyKey: string | symbol) => {\n decorator((arg1 as OnConnectedOptions) || {}, target, propertyKey);\n };\n}\n\nexport function onConnectedAfter(options: OnConnectedOptions): MethodDecorator;\nexport function onConnectedAfter(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedAfter(arg1?: OnConnectedOptions | Object, arg2?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n const decorator = (options: OnConnectedOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<OnConnectedMetadata[]>(ON_AFTER_CONNECTED_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n };\n\n if (arg2) {\n return decorator({}, arg1!, arg2);\n }\n\n return (target: Object, propertyKey: string | symbol) => {\n decorator((arg1 as OnConnectedOptions) || {}, target, propertyKey);\n };\n}\n\n\n// function createLifecycleDecorator(metadataKey: symbol): ((options?: LifecycleOptions) => MethodDecorator) & MethodDecorator {\n// const decorator = (options?: LifecycleOptions): MethodDecorator => {\n// return (target: Object, propertyKey: string | symbol) => {\n// const constructor = target.constructor;\n// let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[];\n// if (!list) {\n// list = [];\n// ReflectUtils.defineMetadata(metadataKey, list, constructor);\n// }\n// list.push({ propertyKey, order: options?.order ?? 0 });\n// };\n// };\n//\n// // Support both @decorator and @decorator() syntax\n// return Object.assign(\n// (target: Object, propertyKey: string | symbol) => {\n// const constructor = target.constructor;\n// let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[];\n// if (!list) {\n// list = [];\n// ReflectUtils.defineMetadata(metadataKey, list, constructor);\n// }\n// list.push({ propertyKey, order: 0 });\n// },\n// { __isDecorator: true, __decorator: decorator }\n// ) as any;\n// }\n\n// Helper to handle both @decorator and @decorator() syntax\nfunction createLifecycleDecoratorWithOptions(metadataKey: symbol) {\n return function(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n if (propertyKey) {\n // Direct decorator usage: @decorator\n const constructor = (optionOrTarget as Object).constructor;\n let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(metadataKey, list, constructor);\n }\n list.push({ propertyKey, order: 0 });\n return;\n }\n\n // Decorator with options: @decorator({ order: 1 })\n return (target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[];\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(metadataKey, list, constructor);\n }\n list.push({ propertyKey, order: (optionOrTarget as LifecycleOptions)?.order ?? 0 });\n };\n };\n}\n\nexport function onInitialize(options?: LifecycleOptions): MethodDecorator;\nexport function onInitialize(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onInitialize(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_INITIALIZE_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport function onDisconnectedBefore(options?: LifecycleOptions): MethodDecorator;\nexport function onDisconnectedBefore(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onDisconnectedBefore(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_BEFORE_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport function onDisconnectedAfter(options?: LifecycleOptions): MethodDecorator;\nexport function onDisconnectedAfter(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onDisconnectedAfter(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_AFTER_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport const onDisconnected = onDisconnectedAfter;\n\nexport function onAdoptedBefore(options?: LifecycleOptions): MethodDecorator;\nexport function onAdoptedBefore(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onAdoptedBefore(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_BEFORE_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport function onAdoptedAfter(options?: LifecycleOptions): MethodDecorator;\nexport function onAdoptedAfter(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onAdoptedAfter(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_AFTER_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport const onAdopted = onAdoptedAfter;\n\nexport function onConnectedSwcApp(options?: LifecycleOptions): MethodDecorator;\nexport function onConnectedSwcApp(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedSwcApp(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_CONNECTED_SWC_APP_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\nexport function onConnectedCompleted(options?: LifecycleOptions): MethodDecorator;\nexport function onConnectedCompleted(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedCompleted(optionOrTarget?: LifecycleOptions | Object, propertyKey?: string | symbol): MethodDecorator | void {\n return createLifecycleDecoratorWithOptions(ON_CONNECTED_COMPLETED_METADATA_KEY)(optionOrTarget, propertyKey);\n}\n\n\n\n\n\nconst decorator = (options: OnConnectedAppendChildOptions, target: Object, propertyKey: string | symbol) => {\n const constructor = target.constructor;\n let list = ReflectUtils.getMetadata<OnConnectedAppendChildOptionsMetadata[]>(ON_CONNECTED_BODY_METADATA_KEY, constructor);\n if (!list) {\n list = [];\n ReflectUtils.defineMetadata(ON_CONNECTED_BODY_METADATA_KEY, list, constructor);\n }\n list.push({ propertyKey, options });\n};\n\nexport function onConnectedBodyShadow(options: Omit<OnConnectedAppendChildOptions, 'useShadow'>): MethodDecorator; // \uD30C\uB77C\uBBF8\uD130\uC788\uC74C\nexport function onConnectedBodyShadow(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void; // \uD30C\uB77C\uBBF8\uD130\uC5C6\uC74C\nexport function onConnectedBodyShadow(optionOrTarget: Omit<OnConnectedAppendChildOptions, 'useShadow'> | Object, propertyKey?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n if (propertyKey) { // no parameter option @decorator\n return decorator({useShadow: true}, optionOrTarget!, propertyKey);\n }\n // parameter option @decorator()\n return (target: Object, propertyKey: string | symbol) => {\n decorator({...optionOrTarget??{}, useShadow: true}, target, propertyKey);\n };\n}\n\nexport function onConnectedBodyLight(options: Omit<OnConnectedAppendChildOptions, 'useShadow'>): MethodDecorator; // \uD30C\uB77C\uBBF8\uD130\uC788\uC74C\nexport function onConnectedBodyLight(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void; // \uD30C\uB77C\uBBF8\uD130\uC5C6\uC74C\nexport function onConnectedBodyLight(optionOrTarget: Omit<OnConnectedAppendChildOptions, 'useShadow'> | Object, propertyKey?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n if (propertyKey) { // no parameter option @decorator\n return decorator({useShadow: false}, optionOrTarget!, propertyKey);\n }\n // parameter option @decorator()\n return (target: Object, propertyKey: string | symbol) => {\n decorator({...optionOrTarget??{}, useShadow: false}, target, propertyKey);\n };\n}\nexport function onConnectedBody(options: OnConnectedAppendChildOptions): MethodDecorator;\nexport function onConnectedBody(target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function onConnectedBody(optionOrTarget: OnConnectedAppendChildOptions | Object, propertyKey?: string | symbol, arg3?: PropertyDescriptor): MethodDecorator | void {\n if (propertyKey) { // no parameter option @decorator\n return decorator({}, optionOrTarget!, propertyKey);\n }\n // parameter option @decorator()\n return (target: Object, propertyKey: string | symbol) => {\n decorator((optionOrTarget as OnConnectedAppendChildOptions) || {}, target, propertyKey);\n };\n}\n\n/**\n * \uD504\uB85C\uD1A0\uD0C0\uC785 \uCCB4\uC778\uC744 \uC21C\uD68C\uD558\uBA70 \uBAA8\uB4E0 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uBA54\uC11C\uB4DC\uB97C \uC218\uC9D1\uD569\uB2C8\uB2E4.\n */\nexport const findAllLifecycleMetadata = (target: any, metadataKey: symbol): LifecycleMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getOwnMetadata(metadataKey, constructor) as LifecycleMetadata[] ?? [];\n // Sort by order (default 0 if not specified)\n return [...results].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n};\n\nexport const findAllOnConnectedMetadata = (target: any): OnConnectedAppendChildOptionsMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getMetadata<OnConnectedAppendChildOptionsMetadata[]>(ON_CONNECTED_BODY_METADATA_KEY, constructor) ?? [];\n // Sort by order (default 0 if not specified)\n return [...results].sort((a, b) => {\n const orderA = a.options?.order ?? 0;\n const orderB = b.options?.order ?? 0;\n return orderA - orderB;\n });\n};\n\nexport const findAllOnConnectedBeforeMetadata = (target: any): OnConnectedMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getMetadata<OnConnectedMetadata[]>(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];\n // Sort by order\n return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));\n};\n\nexport const findAllOnConnectedAfterMetadata = (target: any): OnConnectedMetadata[] => {\n const constructor = target instanceof Function ? target : target.constructor;\n const results = ReflectUtils.getMetadata<OnConnectedMetadata[]>(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];\n // Sort by order\n return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6B;AAEtB,MAAM,6BAA6B,OAAO,IAAI,qCAAqC;AACnF,MAAM,mCAAmC,OAAO,IAAI,0CAA0C;AAC9F,MAAM,kCAAkC,OAAO,IAAI,yCAAyC;AAC5F,MAAM,sCAAsC,OAAO,IAAI,6CAA6C;AACpG,MAAM,qCAAqC,OAAO,IAAI,4CAA4C;AAClG,MAAM,iCAAiC,OAAO,IAAI,wCAAwC;AAC1F,MAAM,gCAAgC,OAAO,IAAI,uCAAuC;AACxF,MAAM,qCAAqC,OAAO,IAAI,4CAA4C;AAClG,MAAM,iCAAiC,OAAO,IAAI,wCAAwC;AAC1F,MAAM,oCAAoC,OAAO,IAAI,2CAA2C;AAChG,MAAM,sCAAsC,OAAO,IAAI,mCAAmC;AAE1F,MAAM,6BAA6B;AAiCnC,SAAS,kBAAkB,MAAoC,MAAwB,MAAmD;AAC/I,QAAMA,aAAY,CAAC,SAA6B,QAAgB,gBAAiC;AAC/F,UAAM,cAAc,OAAO;AAC3B,QAAI,OAAO,yBAAa,YAAmC,kCAAkC,WAAW;AACxG,QAAI,CAAC,MAAM;AACT,aAAO,CAAC;AACR,+BAAa,eAAe,kCAAkC,MAAM,WAAW;AAAA,IACjF;AACA,SAAK,KAAK,EAAE,aAAa,QAAQ,CAAC;AAAA,EACpC;AAEA,MAAI,MAAM;AACR,WAAOA,WAAU,CAAC,GAAG,MAAO,IAAI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kC,CAAC,WAAuC;AACrF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,QAAM,UAAU,yBAAa,YAAmC,iCAAiC,WAAW,KAAK,CAAC;AAElH,SAAO,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,EAAE;AACtF;",
6
6
  "names": ["decorator", "propertyKey"]
7
7
  }
@@ -30,7 +30,7 @@ function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
30
30
  if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
31
31
  throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
32
32
  }
33
- if (typeof selectorOrTarget === "string") {
33
+ if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
34
34
  return (targetObj, propertyKey, descriptor2) => {
35
35
  if (descriptor2 !== void 0) {
36
36
  throw new Error(`@query decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
@@ -45,75 +45,110 @@ function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
45
45
  Object.defineProperty(targetObj, propertyKey, {
46
46
  get() {
47
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;
61
- return 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
48
  const config = (0, import_elementDefine.getElementConfig)(this);
81
49
  const win = config?.window || window;
82
- if (selector === "$window")
83
- return win;
84
- if (selector === "$document")
85
- return win.document;
86
- if (r === "shadow")
87
- return this.shadowRoot ? this.shadowRoot.querySelector(selector) : null;
88
- if (r === "light")
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);
50
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
51
+ let resolvedSelector;
52
+ let resolvedElement = null;
53
+ if (typeof selectorOrTarget === "function") {
54
+ const result = selectorOrTarget(this, hostSet);
55
+ if (result instanceof win.Node || result instanceof win.Element) {
56
+ resolvedElement = result instanceof win.HTMLElement ? result : null;
57
+ } else if (result instanceof win.NodeList || Array.isArray(result)) {
58
+ resolvedElement = result.length > 0 && result[0] instanceof win.HTMLElement ? result[0] : null;
59
+ }
60
+ } else {
61
+ resolvedSelector = selectorOrTarget;
62
+ const r = optionsOrPropertyKey?.root || "auto";
63
+ const applyRoot = (t) => {
64
+ if (!t || !(t instanceof HTMLElement))
65
+ return t;
66
+ if (r === "auto")
67
+ return t.shadowRoot || t;
68
+ if (r === "shadow")
69
+ return t.shadowRoot;
70
+ if (r === "light")
71
+ return t;
72
+ if (r === "all")
73
+ return t.shadowRoot || t;
74
+ return t;
75
+ };
76
+ if (resolvedSelector === "$this")
77
+ resolvedElement = applyRoot(this);
78
+ else if (resolvedSelector === "$host")
79
+ resolvedElement = applyRoot(hostSet.$host);
80
+ else if (resolvedSelector === "$parentHost")
81
+ resolvedElement = applyRoot(hostSet.$parentHost);
82
+ else if (resolvedSelector === "$appHost")
83
+ resolvedElement = applyRoot(hostSet.$appHost);
84
+ else if (resolvedSelector === "$firstHost")
85
+ resolvedElement = applyRoot(hostSet.$firstHost);
86
+ else if (resolvedSelector === "$lastHost")
87
+ resolvedElement = applyRoot(hostSet.$lastHost);
88
+ else if (resolvedSelector === "$firstAppHost")
89
+ resolvedElement = applyRoot(hostSet.$firstAppHost);
90
+ else if (resolvedSelector === "$lastAppHost")
91
+ resolvedElement = applyRoot(hostSet.$lastAppHost);
92
+ else if (resolvedSelector === "$window")
93
+ return win;
94
+ else if (resolvedSelector === "$document")
95
+ return win.document;
96
+ else {
97
+ if (r === "shadow")
98
+ resolvedElement = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
99
+ else if (r === "light")
100
+ resolvedElement = this.querySelector(resolvedSelector);
101
+ else if (r === "all") {
102
+ const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
103
+ resolvedElement = shadowMatch || this.querySelector(resolvedSelector);
104
+ } else
105
+ resolvedElement = (this.shadowRoot || this).querySelector(resolvedSelector);
106
+ }
107
+ }
108
+ if (resolvedElement instanceof win.HTMLElement && optionsOrPropertyKey?.filter) {
109
+ const shouldInclude = optionsOrPropertyKey.filter(resolvedElement, { currentThis: this, helper: hostSet });
110
+ if (!shouldInclude) {
111
+ return null;
112
+ }
93
113
  }
94
- return (this.shadowRoot || this).querySelector(selector);
114
+ return resolvedElement;
95
115
  },
96
116
  set(nv) {
97
117
  (0, import_elementDefine.ensureInit)(this);
98
118
  if (nv === null || nv === void 0) {
99
- const selector = selectorOrTarget;
100
- if (selector.startsWith("$") && selector !== "$this")
119
+ const config = (0, import_elementDefine.getElementConfig)(this);
120
+ const win = config?.window || window;
121
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
122
+ if (typeof selectorOrTarget === "function") {
123
+ const result = selectorOrTarget(this, hostSet);
124
+ if (result instanceof win.Element) {
125
+ result.remove();
126
+ } else if (result instanceof win.NodeList || Array.isArray(result)) {
127
+ const el = result.length > 0 ? result[0] : null;
128
+ if (el instanceof win.Element) {
129
+ el.remove();
130
+ }
131
+ }
132
+ return;
133
+ }
134
+ const resolvedSelector = selectorOrTarget;
135
+ if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
101
136
  return;
102
137
  const r = optionsOrPropertyKey?.root || "auto";
103
138
  const targets = [];
104
139
  if (r === "shadow") {
105
- if (this.shadowRoot?.querySelector(selector))
106
- targets.push(this.shadowRoot.querySelector(selector));
140
+ if (this.shadowRoot?.querySelector(resolvedSelector))
141
+ targets.push(this.shadowRoot.querySelector(resolvedSelector));
107
142
  } else if (r === "light") {
108
- if (this.querySelector(selector))
109
- targets.push(this.querySelector(selector));
143
+ if (this.querySelector(resolvedSelector))
144
+ targets.push(this.querySelector(resolvedSelector));
110
145
  } 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));
146
+ if (this.shadowRoot?.querySelector(resolvedSelector))
147
+ targets.push(this.shadowRoot.querySelector(resolvedSelector));
148
+ if (this.querySelector(resolvedSelector))
149
+ targets.push(this.querySelector(resolvedSelector));
115
150
  } else {
116
- const el = (this.shadowRoot || this).querySelector(selector);
151
+ const el = (this.shadowRoot || this).querySelector(resolvedSelector);
117
152
  if (el)
118
153
  targets.push(el);
119
154
  }
@@ -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: 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,qB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AK,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;",
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface QueryOptions extends SwcQueryOptions {\n /**\n * Filter function to determine whether to include the element.\n * If it returns false, the element is skipped.\n */\n filter?: (target: HTMLElement, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n}\n\nexport interface QueryMetadata {\n propertyKey: string | symbol;\n selector: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null);\n options: QueryOptions ;\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 | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null), options?: QueryOptions): PropertyDecorator;\nexport function query(options?: QueryOptions): PropertyDecorator;\n/**\n * @query decorator to inject a single element into a class property.\n * \n * Supports both string selectors and function-based selectors:\n * - String selector: @query('#my-element')\n * - Function selector: @query((currentThis, helper) => currentThis.shadowRoot?.querySelector('.item'))\n * \n * Supports filtering:\n * - @query('#my-element', { filter: (target, meta) => target.hasAttribute('active') })\n */\nexport function query(selectorOrTarget?: string | ((currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null) | Object, optionsOrPropertyKey?: QueryOptions | 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' || typeof selectorOrTarget === 'function') {\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 as any, options: optionsOrPropertyKey as QueryOptions || {} });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const config = getElementConfig(this);\n const win = config?.window || window;\n const hostSet = SwcUtils.getHelperAndHostSet(win, this);\n \n // Resolve selector - can be string or function\n let resolvedSelector: string;\n let resolvedElement: HTMLElement | null = null;\n \n if (typeof selectorOrTarget === 'function') {\n const result = (selectorOrTarget as any)(this, hostSet);\n // If function returns a Node/Element, return it directly\n if (result instanceof win.Node || result instanceof win.Element) {\n resolvedElement = result instanceof win.HTMLElement ? (result as HTMLElement) : null;\n }\n // If function returns NodeList or Element[], return first element\n else if (result instanceof win.NodeList || Array.isArray(result)) {\n resolvedElement = result.length > 0 && result[0] instanceof win.HTMLElement ? (result[0] as HTMLElement) : null;\n }\n } else {\n resolvedSelector = selectorOrTarget;\n\n const r = (optionsOrPropertyKey as QueryOptions)?.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 if (resolvedSelector === '$this') resolvedElement = applyRoot(this);\n else if (resolvedSelector === '$host') resolvedElement = applyRoot(hostSet.$host);\n else if (resolvedSelector === '$parentHost') resolvedElement = applyRoot(hostSet.$parentHost);\n else if (resolvedSelector === '$appHost') resolvedElement = applyRoot(hostSet.$appHost);\n else if (resolvedSelector === '$firstHost') resolvedElement = applyRoot(hostSet.$firstHost);\n else if (resolvedSelector === '$lastHost') resolvedElement = applyRoot(hostSet.$lastHost);\n else if (resolvedSelector === '$firstAppHost') resolvedElement = applyRoot(hostSet.$firstAppHost);\n else if (resolvedSelector === '$lastAppHost') resolvedElement = applyRoot(hostSet.$lastAppHost);\n // --- Special Selectors: Env ---\n else if (resolvedSelector === '$window') return win;\n else if (resolvedSelector === '$document') return win.document;\n // --- Standard Selectors ---\n else {\n if (r === 'shadow') resolvedElement = this.shadowRoot ? (this.shadowRoot.querySelector(resolvedSelector) as HTMLElement | null) : null;\n else if (r === 'light') resolvedElement = this.querySelector(resolvedSelector) as HTMLElement | null;\n else if (r === 'all') {\n const shadowMatch = this.shadowRoot ? (this.shadowRoot.querySelector(resolvedSelector) as HTMLElement | null) : null;\n resolvedElement = shadowMatch || (this.querySelector(resolvedSelector) as HTMLElement | null);\n }\n else resolvedElement = ((this.shadowRoot || this).querySelector(resolvedSelector) as HTMLElement | null);\n }\n }\n\n // Apply filter if provided\n if (resolvedElement instanceof win.HTMLElement && (optionsOrPropertyKey as QueryOptions)?.filter) {\n const shouldInclude = (optionsOrPropertyKey as QueryOptions).filter!(resolvedElement, { currentThis: this, helper: hostSet });\n if (!shouldInclude) {\n return null;\n }\n }\n\n return resolvedElement;\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined) {\n const config = getElementConfig(this);\n const win = config?.window || window;\n const hostSet = SwcUtils.getHelperAndHostSet(win, this);\n \n // Resolve selector - can be string or function\n if (typeof selectorOrTarget === 'function') {\n // Get the element from function and remove it\n const result = (selectorOrTarget as any)(this, hostSet);\n if (result instanceof win.Element) {\n (result as Element).remove();\n } else if (result instanceof win.NodeList || Array.isArray(result)) {\n const el = result.length > 0 ? result[0] : null;\n if (el instanceof win.Element) {\n (el as Element).remove();\n }\n }\n return;\n }\n \n const resolvedSelector = selectorOrTarget;\n \n if (resolvedSelector.startsWith('$') && resolvedSelector !== '$this') return;\n\n const r = (optionsOrPropertyKey as QueryOptions)?.root || 'auto';\n const targets: Element[] = [];\n\n if (r === 'shadow') {\n if (this.shadowRoot?.querySelector(resolvedSelector)) targets.push(this.shadowRoot.querySelector(resolvedSelector)!);\n } else if (r === 'light') {\n if (this.querySelector(resolvedSelector)) targets.push(this.querySelector(resolvedSelector)!);\n } else if (r === 'all') {\n if (this.shadowRoot?.querySelector(resolvedSelector)) targets.push(this.shadowRoot.querySelector(resolvedSelector)!);\n if (this.querySelector(resolvedSelector)) targets.push(this.querySelector(resolvedSelector)!);\n } else {\n const el = (this.shadowRoot || this).querySelector(resolvedSelector);\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;AAiBlB,MAAM,qBAAqB,OAAO,IAAI,4BAA4B;AAenE,SAAU,MAAM,kBAAkI,sBAAuD,YAA+B;AAE5O,MAAI,eAAe,WAAc,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,WAAW;AACtH,UAAM,IAAI,MAAM,wDAAwD,OAAO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,yBAAa,YAAY,oBAAoB,WAAW,KAAK,CAAA;AACtE;",
6
6
  "names": ["descriptor"]
7
7
  }
@@ -30,7 +30,7 @@ function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
30
30
  if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
31
31
  throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
32
32
  }
33
- if (typeof selectorOrTarget === "string") {
33
+ if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
34
34
  return (targetObj, propertyKey, descriptor2) => {
35
35
  if (descriptor2 !== void 0) {
36
36
  throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
@@ -45,86 +45,124 @@ function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
45
45
  Object.defineProperty(targetObj, propertyKey, {
46
46
  get() {
47
47
  (0, import_elementDefine.ensureInit)(this);
48
- const selector = selectorOrTarget;
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
48
  const config = (0, import_elementDefine.getElementConfig)(this);
91
49
  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);
98
- if (r === "shadow")
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") {
103
- const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
104
- const lNodes = Array.from(this.querySelectorAll(selector));
105
- return [...sNodes, ...lNodes];
50
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
51
+ let resolvedSelector;
52
+ let resolvedElements = [];
53
+ if (typeof selectorOrTarget === "function") {
54
+ const result = selectorOrTarget(this, hostSet);
55
+ if (result instanceof win.NodeList) {
56
+ resolvedElements = Array.from(result).filter((el) => el instanceof win.HTMLElement);
57
+ } else if (Array.isArray(result)) {
58
+ resolvedElements = result.filter((el) => el instanceof win.HTMLElement);
59
+ }
60
+ } else {
61
+ resolvedSelector = selectorOrTarget;
62
+ const r = optionsOrPropertyKey?.root || "auto";
63
+ const applyRoot = (t) => {
64
+ if (!t)
65
+ return [];
66
+ const items = Array.isArray(t) ? t : [t];
67
+ const results = [];
68
+ items.forEach((it) => {
69
+ if (!(it instanceof HTMLElement)) {
70
+ results.push(it);
71
+ return;
72
+ }
73
+ if (r === "auto")
74
+ results.push(it.shadowRoot || it);
75
+ else {
76
+ if (r === "light" || r === "all")
77
+ results.push(it);
78
+ if ((r === "shadow" || r === "all") && it.shadowRoot)
79
+ results.push(it.shadowRoot);
80
+ }
81
+ });
82
+ return results;
83
+ };
84
+ if (resolvedSelector === "$hosts")
85
+ resolvedElements = applyRoot(hostSet.$hosts).filter((el) => el instanceof HTMLElement);
86
+ else if (resolvedSelector === "$appHosts")
87
+ resolvedElements = applyRoot(hostSet.$appHosts).filter((el) => el instanceof HTMLElement);
88
+ else if (resolvedSelector === "$host")
89
+ resolvedElements = applyRoot(hostSet.$host).filter((el) => el instanceof HTMLElement);
90
+ else if (resolvedSelector === "$parentHost")
91
+ resolvedElements = applyRoot(hostSet.$parentHost).filter((el) => el instanceof HTMLElement);
92
+ else if (resolvedSelector === "$appHost")
93
+ resolvedElements = applyRoot(hostSet.$appHost).filter((el) => el instanceof HTMLElement);
94
+ else if (resolvedSelector === "$firstHost")
95
+ resolvedElements = applyRoot(hostSet.$firstHost).filter((el) => el instanceof HTMLElement);
96
+ else if (resolvedSelector === "$lastHost")
97
+ resolvedElements = applyRoot(hostSet.$lastHost).filter((el) => el instanceof HTMLElement);
98
+ else if (resolvedSelector === "$firstAppHost")
99
+ resolvedElements = applyRoot(hostSet.$firstAppHost).filter((el) => el instanceof HTMLElement);
100
+ else if (resolvedSelector === "$lastAppHost")
101
+ resolvedElements = applyRoot(hostSet.$lastAppHost).filter((el) => el instanceof HTMLElement);
102
+ else if (resolvedSelector === "$window")
103
+ return [win];
104
+ else if (resolvedSelector === "$document")
105
+ return [win.document];
106
+ else if (resolvedSelector === "$this")
107
+ resolvedElements = applyRoot(this).filter((el) => el instanceof HTMLElement);
108
+ else {
109
+ if (r === "shadow")
110
+ resolvedElements = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
111
+ else if (r === "light")
112
+ resolvedElements = Array.from(this.querySelectorAll(resolvedSelector));
113
+ else if (r === "all") {
114
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
115
+ const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
116
+ resolvedElements = [...sNodes, ...lNodes];
117
+ } else
118
+ resolvedElements = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
119
+ }
120
+ }
121
+ if (optionsOrPropertyKey?.filter) {
122
+ resolvedElements = resolvedElements.filter((el) => {
123
+ if (!(el instanceof win.HTMLElement))
124
+ return true;
125
+ return optionsOrPropertyKey.filter(el, { currentThis: this, helper: hostSet });
126
+ });
106
127
  }
107
- const root = this.shadowRoot || this;
108
- return Array.from(root.querySelectorAll(selector));
128
+ return resolvedElements;
109
129
  },
110
130
  set(nv) {
111
131
  (0, import_elementDefine.ensureInit)(this);
112
132
  if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
113
- const selector = selectorOrTarget;
114
- if (selector.startsWith("$") && selector !== "$this")
133
+ const config = (0, import_elementDefine.getElementConfig)(this);
134
+ const win = config?.window || window;
135
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(win, this);
136
+ if (typeof selectorOrTarget === "function") {
137
+ const result = selectorOrTarget(this, hostSet);
138
+ if (result instanceof win.NodeList) {
139
+ Array.from(result).forEach((el) => {
140
+ if (el instanceof win.Element)
141
+ el.remove();
142
+ });
143
+ } else if (Array.isArray(result)) {
144
+ result.forEach((el) => {
145
+ if (el instanceof win.Element)
146
+ el.remove();
147
+ });
148
+ }
149
+ return;
150
+ }
151
+ const resolvedSelector = selectorOrTarget;
152
+ if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
115
153
  return;
116
154
  const r = optionsOrPropertyKey?.root || "auto";
117
155
  let targets = [];
118
156
  if (r === "shadow")
119
- targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
157
+ targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
120
158
  else if (r === "light")
121
- targets = Array.from(this.querySelectorAll(selector));
159
+ targets = Array.from(this.querySelectorAll(resolvedSelector));
122
160
  else if (r === "all") {
123
- const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];
124
- const lNodes = Array.from(this.querySelectorAll(selector));
161
+ const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
162
+ const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
125
163
  targets = [...sNodes, ...lNodes];
126
164
  } else {
127
- targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));
165
+ targets = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
128
166
  }
129
167
  targets.forEach((t) => t.remove());
130
168
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/queryAll.ts"],
4
- "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SpecialSelector, SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface QueryAllMetadata {\n propertyKey: string | symbol;\n selector: string;\n options: SwcQueryOptions;\n}\n\nexport const QUERY_ALL_METADATA_KEY = Symbol.for('simple-web-component:query-all');\n\nexport function queryAll(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor | void;\nexport function queryAll(selector: string, options?: SwcQueryOptions): PropertyDecorator;\nexport function queryAll(options?: SwcQueryOptions): PropertyDecorator;\n/**\n * @queryAll decorator to inject a list of elements into a class property.\n */\nexport function queryAll(selectorOrTarget?: string | Object, optionsOrPropertyKey?: SwcQueryOptions | string | symbol, descriptor?: PropertyDescriptor): any {\n // Bare decorator: @queryAll\n if (descriptor !== undefined && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol')) {\n throw new Error(`@queryAll 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(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryAllMetadata[]>(QUERY_ALL_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget, options: 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): any[] => {\n if (!t) return [];\n const items = Array.isArray(t) ? t : [t];\n const results: any[] = [];\n items.forEach(it => {\n if (!(it instanceof HTMLElement)) {\n results.push(it);\n return;\n }\n if (r === 'auto') results.push(it.shadowRoot || it);\n else {\n if (r === 'light' || r === 'all') results.push(it);\n if ((r === 'shadow' || r === 'all') && it.shadowRoot) results.push(it.shadowRoot);\n }\n });\n return results;\n };\n\n // --- Special Selectors: HostSet ---\n const hostSet = SwcUtils.getHostSet(this);\n if (selector === '$hosts') return applyRoot(hostSet.$hosts);\n if (selector === '$appHosts') return applyRoot(hostSet.$appHosts);\n 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 if (selector === '$this') return applyRoot(this);\n\n // --- Standard Selectors ---\n if (r === 'shadow') return this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n if (r === 'light') return Array.from(this.querySelectorAll(selector));\n if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n const lNodes = Array.from(this.querySelectorAll(selector));\n return [...sNodes, ...lNodes];\n }\n const root = this.shadowRoot || this;\n return Array.from(root.querySelectorAll(selector));\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {\n const selector = selectorOrTarget;\n if (selector.startsWith('$') && selector !== '$this') return;\n\n const r = (optionsOrPropertyKey as SwcQueryOptions)?.root || 'auto';\n let targets: (Element | Node)[] = [];\n if (r === 'shadow') targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n else if (r === 'light') targets = Array.from(this.querySelectorAll(selector));\n else if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(selector)) : [];\n const lNodes = Array.from(this.querySelectorAll(selector));\n targets = [...sNodes, ...lNodes];\n } else {\n targets = Array.from((this.shadowRoot || this).querySelectorAll(selector));\n }\n targets.forEach(t => (t as Element).remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n }\n // Without selector (defaults to $this)\n return queryAll('$this', selectorOrTarget as SwcQueryOptions);\n}\n\nexport const getQueryAllMetadata = (target: any): QueryAllMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AASlB,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAQ3E,SAAU,SAAS,kBAAoC,sBAA0D,YAA+B;AAEpJ,MAAI,eAAe,WAAc,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,WAAW;AACtH,UAAM,IAAI,MAAM,2DAA2D,OAAO,oBAAoB,CAAC,GAAG;EAC5G;AAEA,MAAI,OAAO,qBAAqB,UAAU;AACxC,WAAO,CAAC,WAAmB,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AAiB,QAAQ,CAAC,IAAI,CAAA;qBAChG,MAAM;AAAS,wBAAU,MAAM,KAAK,KAAK,iBAAiB,QAAQ,CAAC;qBACnE,MAAM,OAAO;AACpB,oBAAM,SAAS,KAAK,aAAa,MAAM,KAAK,KAAK,WAAW,iBAAiB,QAAQ,CAAC,IAAI,CAAA;AAC1F,oBAAM,SAAS,MAAM,KAAK,KAAK,iBAAiB,QAAQ,CAAC;AACzD,wBAAU,CAAC,GAAG,QAAQ,GAAG,MAAM;YACjC,OAAO;AACL,wBAAU,MAAM,MAAM,KAAK,cAAc,MAAM,iBAAiB,QAAQ,CAAC;YAC3E;AACA,oBAAQ,QAAQ,OAAM,EAAc,OAAM,CAAE;UAC9C;QACF;QACA,YAAY;QACZ,cAAc;OACf;IACH;EACF;AAEA,SAAO,SAAS,SAAS,gBAAmC;AAC9D;AAEO,MAAM,sBAAsB,CAAC,WAA+C;AACjF,QAAM,cAAc,kBAAkB,WAAW,SAAS,OAAO;AACjE,SAAO,yBAAa,YAAY,wBAAwB,WAAW;AACrE;",
4
+ "sourcesContent": ["import { ReflectUtils } from '@dooboostore/core';\nimport { getElementConfig, ensureInit } from './elementDefine';\nimport { SwcUtils } from '../utils/Utils';\nimport { SwcQueryOptions, HelperHostSet } from '../types';\n\nexport interface QueryAllOptions extends SwcQueryOptions {\n /**\n * Filter function to determine whether to include the element.\n * If it returns false, the element is skipped.\n */\n filter?: (target: HTMLElement, meta: { currentThis: any, helper: HelperHostSet }) => boolean;\n}\n\nexport interface QueryAllMetadata {\n propertyKey: string | symbol;\n selector: string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null);\n options: QueryAllOptions;\n}\n\nexport const QUERY_ALL_METADATA_KEY = Symbol.for('simple-web-component:query-all');\n\nexport function queryAll(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor | void;\nexport function queryAll(selector: string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null), options?: QueryAllOptions): PropertyDecorator;\nexport function queryAll(options?: QueryAllOptions): PropertyDecorator;\n/**\n * @queryAll decorator to inject a list of elements into a class property.\n * \n * Supports both string selectors and function-based selectors:\n * - String selector: @queryAll('.item')\n * - Function selector: @queryAll((currentThis, helper) => currentThis.shadowRoot?.querySelectorAll('.item'))\n * \n * Supports filtering:\n * - @queryAll('.item', { filter: (target, meta) => target.hasAttribute('active') })\n */\nexport function queryAll(selectorOrTarget?: string | ((currentThis: any, helper: HelperHostSet) => NodeList | Element | Element[] | null) | Object, optionsOrPropertyKey?: QueryAllOptions | string | symbol, descriptor?: PropertyDescriptor): any {\n // Bare decorator: @queryAll\n if (descriptor !== undefined && (typeof optionsOrPropertyKey === 'string' || typeof optionsOrPropertyKey === 'symbol')) {\n throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);\n }\n // With selector\n if (typeof selectorOrTarget === 'string' || typeof selectorOrTarget === 'function') {\n return (targetObj: Object, propertyKey: string | symbol, descriptor?: never): void => {\n if (descriptor !== undefined) {\n throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);\n }\n\n const constructor = targetObj.constructor;\n let queries = ReflectUtils.getMetadata<QueryAllMetadata[]>(QUERY_ALL_METADATA_KEY, constructor);\n if (!queries) {\n queries = [];\n ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);\n }\n queries.push({ propertyKey, selector: selectorOrTarget as any, options: optionsOrPropertyKey as QueryAllOptions || {} });\n\n Object.defineProperty(targetObj, propertyKey, {\n get(this: HTMLElement) {\n ensureInit(this);\n const config = getElementConfig(this);\n const win = config?.window || window;\n const hostSet = SwcUtils.getHelperAndHostSet(win, this);\n \n // Resolve selector - can be string or function\n let resolvedSelector: string;\n let resolvedElements: HTMLElement[] = [];\n \n if (typeof selectorOrTarget === 'function') {\n const result = (selectorOrTarget as any)(this, hostSet);\n // If function returns NodeList or Element[], convert to array\n if (result instanceof win.NodeList) {\n resolvedElements = Array.from(result).filter(el => el instanceof win.HTMLElement) as HTMLElement[];\n } else if (Array.isArray(result)) {\n resolvedElements = result.filter(el => el instanceof win.HTMLElement) as HTMLElement[];\n }\n } else {\n resolvedSelector = selectorOrTarget;\n\n const r = (optionsOrPropertyKey as QueryAllOptions)?.root || 'auto';\n const applyRoot = (t: any): any[] => {\n if (!t) return [];\n const items = Array.isArray(t) ? t : [t];\n const results: any[] = [];\n items.forEach(it => {\n if (!(it instanceof HTMLElement)) {\n results.push(it);\n return;\n }\n if (r === 'auto') results.push(it.shadowRoot || it);\n else {\n if (r === 'light' || r === 'all') results.push(it);\n if ((r === 'shadow' || r === 'all') && it.shadowRoot) results.push(it.shadowRoot);\n }\n });\n return results;\n };\n\n // --- Special Selectors: HostSet ---\n if (resolvedSelector === '$hosts') resolvedElements = applyRoot(hostSet.$hosts).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$appHosts') resolvedElements = applyRoot(hostSet.$appHosts).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$host') resolvedElements = applyRoot(hostSet.$host).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$parentHost') resolvedElements = applyRoot(hostSet.$parentHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$appHost') resolvedElements = applyRoot(hostSet.$appHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$firstHost') resolvedElements = applyRoot(hostSet.$firstHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$lastHost') resolvedElements = applyRoot(hostSet.$lastHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$firstAppHost') resolvedElements = applyRoot(hostSet.$firstAppHost).filter(el => el instanceof HTMLElement);\n else if (resolvedSelector === '$lastAppHost') resolvedElements = applyRoot(hostSet.$lastAppHost).filter(el => el instanceof HTMLElement);\n // --- Special Selectors: Env ---\n else if (resolvedSelector === '$window') return [win];\n else if (resolvedSelector === '$document') return [win.document];\n else if (resolvedSelector === '$this') resolvedElements = applyRoot(this).filter(el => el instanceof HTMLElement);\n // --- Standard Selectors ---\n else {\n if (r === 'shadow') resolvedElements = this.shadowRoot ? (Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) as HTMLElement[]) : [];\n else if (r === 'light') resolvedElements = Array.from(this.querySelectorAll(resolvedSelector)) as HTMLElement[];\n else if (r === 'all') {\n const sNodes = this.shadowRoot ? (Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) as HTMLElement[]) : [];\n const lNodes = Array.from(this.querySelectorAll(resolvedSelector)) as HTMLElement[];\n resolvedElements = [...sNodes, ...lNodes];\n }\n else resolvedElements = (Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector)) as HTMLElement[]);\n }\n }\n\n // Apply filter if provided\n if ((optionsOrPropertyKey as QueryAllOptions)?.filter) {\n resolvedElements = resolvedElements.filter(el => {\n if (!(el instanceof win.HTMLElement)) return true;\n return (optionsOrPropertyKey as QueryAllOptions).filter!(el, { currentThis: this, helper: hostSet });\n });\n }\n\n return resolvedElements;\n },\n set(this: HTMLElement, nv: any) {\n ensureInit(this);\n if (nv === null || nv === undefined || (Array.isArray(nv) && nv.length === 0)) {\n const config = getElementConfig(this);\n const win = config?.window || window;\n const hostSet = SwcUtils.getHelperAndHostSet(win, this);\n \n // Resolve selector - can be string or function\n if (typeof selectorOrTarget === 'function') {\n // Get elements from function and remove them\n const result = (selectorOrTarget as any)(this, hostSet);\n if (result instanceof win.NodeList) {\n Array.from(result).forEach(el => {\n if (el instanceof win.Element) (el as Element).remove();\n });\n } else if (Array.isArray(result)) {\n result.forEach(el => {\n if (el instanceof win.Element) (el as Element).remove();\n });\n }\n return;\n }\n \n const resolvedSelector = selectorOrTarget;\n \n if (resolvedSelector.startsWith('$') && resolvedSelector !== '$this') return;\n\n const r = (optionsOrPropertyKey as SwcQueryOptions)?.root || 'auto';\n let targets: (Element | Node)[] = [];\n if (r === 'shadow') targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];\n else if (r === 'light') targets = Array.from(this.querySelectorAll(resolvedSelector));\n else if (r === 'all') {\n const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];\n const lNodes = Array.from(this.querySelectorAll(resolvedSelector));\n targets = [...sNodes, ...lNodes];\n } else {\n targets = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));\n }\n targets.forEach(t => (t as Element).remove());\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n }\n // Without selector (defaults to $this)\n return queryAll('$this', selectorOrTarget as SwcQueryOptions);\n}\n\nexport const getQueryAllMetadata = (target: any): QueryAllMetadata[] | undefined => {\n const constructor = target instanceof Function ? target : target.constructor;\n return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;kBAA6B;AAC7B,2BAA6C;AAC7C,mBAAyB;AAiBlB,MAAM,yBAAyB,OAAO,IAAI,gCAAgC;AAe3E,SAAU,SAAS,kBAA2H,sBAA0D,YAA+B;AAE3O,MAAI,eAAe,WAAc,OAAO,yBAAyB,YAAY,OAAO,yBAAyB,WAAW;AACtH,UAAM,IAAI,MAAM,2DAA2D,OAAO,oBAAoB,CAAC,GAAG;EAC5G;AAEA,MAAI,OAAO,qBAAqB,YAAY,OAAO,qBAAqB,YAAY;AAClF,WAAO,CAAC,WAAmB,aAA8BA,gBAA4B;AACnF,UAAIA,gBAAe,QAAW;AAC5B,cAAM,IAAI,MAAM,2DAA2D,OAAO,WAAW,CAAC,GAAG;MACnG;AAEA,YAAM,cAAc,UAAU;AAC9B,UAAI,UAAU,yBAAa,YAAgC,wBAAwB,WAAW;AAC9F,UAAI,CAAC,SAAS;AACZ,kBAAU,CAAA;AACV,iCAAa,eAAe,wBAAwB,SAAS,WAAW;MAC1E;AACA,cAAQ,KAAK,EAAE,aAAa,UAAU,kBAAyB,SAAS,wBAA2C,CAAA,EAAE,CAAE;AAEvH,aAAO,eAAe,W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