@dooboostore/simple-web-component 1.0.49 → 1.0.50

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 (145) hide show
  1. package/README.md +72 -0
  2. package/dist/cjs/decorators/addEventListener.js +1994 -9
  3. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +10 -4
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyClass.js +10 -4
  7. package/dist/cjs/decorators/applyClass.js.map +2 -2
  8. package/dist/cjs/decorators/applyNode.js +10 -4
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/applyProperty.js +14 -8
  11. package/dist/cjs/decorators/applyProperty.js.map +2 -2
  12. package/dist/cjs/decorators/applySlot.js +6 -5
  13. package/dist/cjs/decorators/applySlot.js.map +2 -2
  14. package/dist/cjs/decorators/applyStyle.js +10 -4
  15. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  16. package/dist/cjs/decorators/changedAttribute.js +22 -13
  17. package/dist/cjs/decorators/changedAttribute.js.map +2 -2
  18. package/dist/cjs/decorators/elementDefine.js +18 -3
  19. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  20. package/dist/cjs/decorators/eventMedia.js +84 -0
  21. package/dist/cjs/decorators/eventMedia.js.map +7 -0
  22. package/dist/cjs/decorators/index.js +3 -0
  23. package/dist/cjs/decorators/index.js.map +2 -2
  24. package/dist/cjs/decorators/intersectionObserver.js +46 -55
  25. package/dist/cjs/decorators/intersectionObserver.js.map +2 -2
  26. package/dist/cjs/decorators/mutationObserver.js +46 -55
  27. package/dist/cjs/decorators/mutationObserver.js.map +2 -2
  28. package/dist/cjs/decorators/parameter.js +73 -0
  29. package/dist/cjs/decorators/parameter.js.map +7 -0
  30. package/dist/cjs/decorators/requestAnimationFrame.js +124 -0
  31. package/dist/cjs/decorators/requestAnimationFrame.js.map +7 -0
  32. package/dist/cjs/decorators/resizeObserver.js +46 -55
  33. package/dist/cjs/decorators/resizeObserver.js.map +2 -2
  34. package/dist/cjs/decorators/setInterval.js +46 -14
  35. package/dist/cjs/decorators/setInterval.js.map +2 -2
  36. package/dist/cjs/decorators/setTimeout.js +49 -14
  37. package/dist/cjs/decorators/setTimeout.js.map +2 -2
  38. package/dist/cjs/elements/SwcAppMixin.js +19 -3
  39. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  40. package/dist/cjs/types/window.d.js.map +1 -1
  41. package/dist/esm/decorators/addEventListener.js +1994 -9
  42. package/dist/esm/decorators/addEventListener.js.map +2 -2
  43. package/dist/esm/decorators/applyAttribute.js +10 -4
  44. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  45. package/dist/esm/decorators/applyClass.js +10 -4
  46. package/dist/esm/decorators/applyClass.js.map +2 -2
  47. package/dist/esm/decorators/applyNode.js +10 -4
  48. package/dist/esm/decorators/applyNode.js.map +2 -2
  49. package/dist/esm/decorators/applyProperty.js +14 -8
  50. package/dist/esm/decorators/applyProperty.js.map +2 -2
  51. package/dist/esm/decorators/applySlot.js +6 -5
  52. package/dist/esm/decorators/applySlot.js.map +2 -2
  53. package/dist/esm/decorators/applyStyle.js +10 -4
  54. package/dist/esm/decorators/applyStyle.js.map +2 -2
  55. package/dist/esm/decorators/changedAttribute.js +22 -13
  56. package/dist/esm/decorators/changedAttribute.js.map +2 -2
  57. package/dist/esm/decorators/elementDefine.js +18 -3
  58. package/dist/esm/decorators/elementDefine.js.map +2 -2
  59. package/dist/esm/decorators/eventMedia.js +66 -0
  60. package/dist/esm/decorators/eventMedia.js.map +7 -0
  61. package/dist/esm/decorators/index.js +3 -0
  62. package/dist/esm/decorators/index.js.map +2 -2
  63. package/dist/esm/decorators/intersectionObserver.js +46 -55
  64. package/dist/esm/decorators/intersectionObserver.js.map +2 -2
  65. package/dist/esm/decorators/mutationObserver.js +46 -55
  66. package/dist/esm/decorators/mutationObserver.js.map +2 -2
  67. package/dist/esm/decorators/parameter.js +54 -0
  68. package/dist/esm/decorators/parameter.js.map +7 -0
  69. package/dist/esm/decorators/requestAnimationFrame.js +105 -0
  70. package/dist/esm/decorators/requestAnimationFrame.js.map +7 -0
  71. package/dist/esm/decorators/resizeObserver.js +46 -55
  72. package/dist/esm/decorators/resizeObserver.js.map +2 -2
  73. package/dist/esm/decorators/setInterval.js +46 -15
  74. package/dist/esm/decorators/setInterval.js.map +2 -2
  75. package/dist/esm/decorators/setTimeout.js +49 -15
  76. package/dist/esm/decorators/setTimeout.js.map +2 -2
  77. package/dist/esm/elements/SwcAppMixin.js +20 -4
  78. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  79. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +2813 -571
  80. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  81. package/dist/types/decorators/addEventListener.d.ts +962 -0
  82. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  83. package/dist/types/decorators/applyAttribute.d.ts +2 -0
  84. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  85. package/dist/types/decorators/applyClass.d.ts +2 -0
  86. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  87. package/dist/types/decorators/applyNode.d.ts +2 -0
  88. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  89. package/dist/types/decorators/applyProperty.d.ts +4 -0
  90. package/dist/types/decorators/applyProperty.d.ts.map +1 -1
  91. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  92. package/dist/types/decorators/applyStyle.d.ts +2 -0
  93. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  94. package/dist/types/decorators/changedAttribute.d.ts +1 -3
  95. package/dist/types/decorators/changedAttribute.d.ts.map +1 -1
  96. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  97. package/dist/types/decorators/eventMedia.d.ts +25 -0
  98. package/dist/types/decorators/eventMedia.d.ts.map +1 -0
  99. package/dist/types/decorators/index.d.ts +3 -0
  100. package/dist/types/decorators/index.d.ts.map +1 -1
  101. package/dist/types/decorators/intersectionObserver.d.ts +9 -0
  102. package/dist/types/decorators/intersectionObserver.d.ts.map +1 -1
  103. package/dist/types/decorators/mutationObserver.d.ts +10 -1
  104. package/dist/types/decorators/mutationObserver.d.ts.map +1 -1
  105. package/dist/types/decorators/parameter.d.ts +35 -0
  106. package/dist/types/decorators/parameter.d.ts.map +1 -0
  107. package/dist/types/decorators/requestAnimationFrame.d.ts +47 -0
  108. package/dist/types/decorators/requestAnimationFrame.d.ts.map +1 -0
  109. package/dist/types/decorators/resizeObserver.d.ts +9 -0
  110. package/dist/types/decorators/resizeObserver.d.ts.map +1 -1
  111. package/dist/types/decorators/setInterval.d.ts +17 -5
  112. package/dist/types/decorators/setInterval.d.ts.map +1 -1
  113. package/dist/types/decorators/setTimeout.d.ts +17 -5
  114. package/dist/types/decorators/setTimeout.d.ts.map +1 -1
  115. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  116. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +2813 -571
  117. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  118. package/package.json +3 -3
  119. package/src/decorators/addEventListener.ts +1060 -8
  120. package/src/decorators/applyAttribute.ts +14 -4
  121. package/src/decorators/applyClass.ts +14 -4
  122. package/src/decorators/applyNode.ts +14 -4
  123. package/src/decorators/applyProperty.ts +28 -8
  124. package/src/decorators/applySlot.ts +6 -5
  125. package/src/decorators/applyStyle.ts +14 -4
  126. package/src/decorators/changedAttribute.ts +30 -15
  127. package/src/decorators/elementDefine.ts +32 -5
  128. package/src/decorators/eventMedia.ts +78 -0
  129. package/src/decorators/index.ts +3 -0
  130. package/src/decorators/intersectionObserver.ts +77 -61
  131. package/src/decorators/mutationObserver.ts +78 -61
  132. package/src/decorators/parameter.ts +81 -0
  133. package/src/decorators/requestAnimationFrame.ts +158 -0
  134. package/src/decorators/resizeObserver.ts +76 -60
  135. package/src/decorators/setInterval.ts +71 -15
  136. package/src/decorators/setTimeout.ts +74 -15
  137. package/src/elements/SwcAppMixin.ts +20 -5
  138. package/src/types/window.d.ts +2 -18
  139. package/dist/cjs/examples/RxJSOperatorsExample.js +0 -285
  140. package/dist/cjs/examples/RxJSOperatorsExample.js.map +0 -7
  141. package/dist/esm/examples/RxJSOperatorsExample.js +0 -266
  142. package/dist/esm/examples/RxJSOperatorsExample.js.map +0 -7
  143. package/dist/types/examples/RxJSOperatorsExample.d.ts +0 -94
  144. package/dist/types/examples/RxJSOperatorsExample.d.ts.map +0 -1
  145. package/src/examples/RxJSOperatorsExample.ts +0 -279
package/README.md CHANGED
@@ -316,6 +316,78 @@ onCriticalClick(event: Event) {
316
316
  - `addEventListenerAll(selector, type, options)` / `eventAll(...)` - Bind (non-delegated) in both light & shadow DOM
317
317
  - `addEventListenerMutation(selector, type, options)` / `eventMutation(...)` - Delegate via `MutationObserver` instead of event bubbling (useful for non-bubbling events like `focus`/`blur`); `*Light`/`*Shadow`/`*All` variants also available
318
318
 
319
+ **Event-Type-Specific Aliases (eventClick, eventInputThis, ...):**
320
+
321
+ Beyond the generic `event(selector, type, options)` form, every scope/delegate variant above is also pre-bound to ~59 common DOM event types, so you don't have to repeat the type string:
322
+
323
+ ```typescript
324
+ @eventClick('.logo')
325
+ onLogoClick() { ... }
326
+
327
+ // Same as: @eventDelegateLight('.item', 'click')
328
+ @eventClickDelegateLight('.item')
329
+ onItemClick(event: Event) { ... }
330
+
331
+ // Same as: @addEventListenerThis('keydown')
332
+ @eventKeydownThis()
333
+ onKeydown(event: KeyboardEvent) { ... }
334
+ ```
335
+
336
+ Naming pattern: `event` + `PascalCase(type)` + scope suffix (`''`(base) / `DelegateLight` / `DelegateShadow` / `DelegateAll` / `Delegate` / `MutationLight` / `MutationShadow` / `MutationAll` / `Mutation` / `Light` / `Shadow` / `All` / `This` / `AppHost` / `Window` / `Document`) — e.g. `eventClick`, `eventClickDelegateShadow`, `eventDblclickThis`, `eventPointerdownDelegateAll`, `eventKeydownWindow`.
337
+
338
+ Covered event types include mouse (`click`, `dblclick`, `mousedown`, `mouseup`, `mousemove`, `mouseover`, `mouseout`, `mouseenter`, `mouseleave`, `contextmenu`, `wheel`), keyboard (`keydown`, `keyup`, `keypress`), form (`input`, `change`, `submit`, `reset`, `invalid`, `select`), focus (`focus`, `blur`, `focusin`, `focusout`), drag & drop (`dragstart`, `drag`, `dragend`, `dragenter`, `dragleave`, `dragover`, `drop`), touch (`touchstart`, `touchmove`, `touchend`, `touchcancel`), pointer (`pointerdown`, `pointerup`, `pointermove`, `pointerover`, `pointerout`, `pointerenter`, `pointerleave`, `pointercancel`), clipboard (`copy`, `cut`, `paste`), animation/transition (`animationstart/end/iteration/cancel`, `transitionstart/end/cancel/run`), and misc (`scroll`, `resize`, `load`, `error`, `toggle`).
339
+
340
+ These aliases are generated in `addEventListener.ts` from a small internal `makeTypedEventAliases<TEvent>(type)` factory — adding a new event type is a one-line addition, not hand-written boilerplate. Any event type not covered still works via the generic `@event(selector, 'your-type', options)` / `@eventDelegateLight(selector, 'your-type', options)` etc.
341
+
342
+ #### Order-Independent Parameter Decorators (@eventObject, @matchedElement, @hostSet, @helperHostSet, @helperSet)
343
+
344
+ `@addEventListener`-bound handlers normally receive fixed positional arguments (`(event, legacyHelper1, legacyHelper2)`). If you'd rather not memorize that order, decorate individual parameters instead — order and position no longer matter, and any parameter left undecorated in a method that uses none of these decorators still gets the legacy positional arguments (fully backward-compatible):
345
+
346
+ ```typescript
347
+ import { addEventListener, eventObject, matchedElement, hostSet, helperHostSet, helperSet } from '@dooboostore/simple-web-component';
348
+
349
+ @elementDefine('product-list')
350
+ class ProductList extends HTMLElement {
351
+ // Order can be anything you like
352
+ @addEventListenerDelegateLight('.item', 'click')
353
+ onItemClick(@matchedElement $item: Element, @eventObject event: Event) {
354
+ console.log('clicked item:', $item, event);
355
+ }
356
+
357
+ // Only need the host tree info? Just ask for @hostSet.
358
+ @eventClickThis()
359
+ onHostClick(@hostSet hs: HostSet) {
360
+ console.log(hs.$appHost, hs.$hosts);
361
+ }
362
+
363
+ // Need DOM helpers ($q, $qa, ...) too? Use @helperHostSet (superset of @hostSet) or @helperSet (helpers only).
364
+ @eventClickThis()
365
+ onHostClickFull(@helperHostSet full: HelperHostSet, @helperSet helpers: HelperSet) { ... }
366
+ }
367
+ ```
368
+
369
+ - `@eventObject` - the original DOM `Event`
370
+ - `@matchedElement` - the delegate-matched element (or `event.currentTarget` for direct bindings)
371
+ - `@hostSet` - host-ancestor-tree info only (`$host`, `$parentHost`, `$hosts`, `$appHost`, `$appHosts`, `$firstHost`, `$lastHost`, `$firstAppHost`, `$lastAppHost`)
372
+ - `@helperHostSet` - `@hostSet` + DOM/window helpers (`$d`, `$w`, `$q`, `$qa`, `$qi`) + `$this`
373
+ - `@helperSet` - DOM/window helpers only (`$d`, `$w`, `$q`, `$qa`, `$qi`), no host-tree info
374
+
375
+ The same mechanism (and the same 5 decorators, plus two more) also applies to:
376
+ - **`@onInitialize`/`@onConnectedBefore`/`@onConnectedAfter`/... lifecycle methods** — can freely mix `@hostSet`/`@helperHostSet`/`@helperSet` with `@inject(...)` on the same method.
377
+ - **`@subscribeSwcAppRouteChangeWhileConnected`** — add `@routerEvent` to receive the `RouterEventType` regardless of position.
378
+ - **`@subscribeSwcAppMessageWhileConnected`** — add `@appMessage` to receive the `SwcAppMessage` regardless of position.
379
+
380
+ ```typescript
381
+ @onConnectedAfter
382
+ onconstructor(@inject(UserService.SYMBOL) userService: UserService, @hostSet hs: HostSet) { ... }
383
+
384
+ @subscribeSwcAppRouteChangeWhileConnected()
385
+ onRouteChanged(@helperSet helpers: HelperSet, @routerEvent re: RouterEventType) { ... }
386
+
387
+ @subscribeSwcAppMessageWhileConnected
388
+ onMessage(@hostSet hs: HostSet, @appMessage msg: SwcAppMessage) { ... }
389
+ ```
390
+
319
391
  #### @emitCustomEvent
320
392
  Emit custom events with data.
321
393