@studiometa/js-toolkit 2.0.0-alpha.1 → 2.0.0-alpha.10

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 (201) hide show
  1. package/Base/index.d.ts +29 -47
  2. package/Base/index.js +144 -171
  3. package/Base/managers/ChildrenManager.d.ts +6 -6
  4. package/Base/managers/ChildrenManager.js +95 -119
  5. package/Base/managers/EventsManager.d.ts +9 -9
  6. package/Base/managers/EventsManager.js +128 -161
  7. package/Base/managers/OptionsManager.d.ts +50 -5
  8. package/Base/managers/OptionsManager.js +115 -116
  9. package/Base/managers/RefsManager.js +62 -73
  10. package/Base/managers/ServicesManager.d.ts +14 -3
  11. package/Base/managers/ServicesManager.js +78 -77
  12. package/Base/utils.js +5 -8
  13. package/README.md +12 -70
  14. package/decorators/index.js +1 -2
  15. package/decorators/withBreakpointManager.d.ts +4 -4
  16. package/decorators/withBreakpointManager.js +37 -75
  17. package/decorators/withBreakpointObserver.d.ts +2 -2
  18. package/decorators/withBreakpointObserver.js +54 -77
  19. package/decorators/withDrag.d.ts +3 -3
  20. package/decorators/withDrag.js +17 -41
  21. package/decorators/withExtraConfig.d.ts +3 -3
  22. package/decorators/withExtraConfig.js +2 -24
  23. package/decorators/withIntersectionObserver.d.ts +2 -2
  24. package/decorators/withIntersectionObserver.js +17 -56
  25. package/decorators/withMountWhenInView.d.ts +3 -3
  26. package/decorators/withMountWhenInView.js +23 -51
  27. package/helpers/createApp.d.ts +3 -3
  28. package/helpers/createApp.js +10 -12
  29. package/helpers/importOnInteraction.d.ts +3 -3
  30. package/helpers/importOnInteraction.js +7 -8
  31. package/helpers/importWhenIdle.d.ts +3 -3
  32. package/helpers/importWhenIdle.js +7 -8
  33. package/helpers/importWhenVisible.d.ts +3 -3
  34. package/helpers/importWhenVisible.js +9 -16
  35. package/helpers/index.d.ts +1 -3
  36. package/helpers/index.js +1 -4
  37. package/helpers/utils.js +1 -2
  38. package/index.d.ts +14 -4
  39. package/index.js +4 -4
  40. package/index.modern.js +1 -2
  41. package/index.umd.js +1 -2
  42. package/package.json +4 -6
  43. package/services/Service.js +48 -67
  44. package/services/drag.js +143 -179
  45. package/services/index.js +1 -2
  46. package/services/key.js +55 -97
  47. package/services/load.d.ts +1 -1
  48. package/services/load.js +21 -50
  49. package/services/pointer.js +117 -156
  50. package/services/raf.js +36 -64
  51. package/services/resize.js +47 -86
  52. package/services/scroll.js +81 -120
  53. package/utils/collide/boundingRectToCircle.js +7 -6
  54. package/utils/collide/collideCircleCircle.js +1 -2
  55. package/utils/collide/collideCircleRect.js +1 -2
  56. package/utils/collide/collidePointCircle.js +1 -2
  57. package/utils/collide/collidePointRect.js +1 -2
  58. package/utils/collide/collideRectRect.js +1 -2
  59. package/utils/collide/index.js +1 -2
  60. package/utils/css/classes.js +2 -3
  61. package/utils/css/index.js +1 -2
  62. package/utils/css/matrix.js +1 -2
  63. package/utils/css/styles.js +3 -8
  64. package/utils/css/transition.js +67 -140
  65. package/utils/debounce.js +3 -4
  66. package/utils/focusTrap.js +4 -5
  67. package/utils/history.js +13 -20
  68. package/utils/index.d.ts +2 -1
  69. package/utils/index.js +2 -2
  70. package/utils/keyCodes.js +1 -2
  71. package/utils/math/clamp.js +1 -2
  72. package/utils/math/clamp01.js +1 -2
  73. package/utils/math/damp.js +1 -2
  74. package/utils/math/index.js +1 -2
  75. package/utils/math/inertiaFinalValue.js +1 -2
  76. package/utils/math/lerp.js +1 -2
  77. package/utils/math/map.js +1 -2
  78. package/utils/math/round.js +1 -2
  79. package/utils/memoize.d.ts +30 -0
  80. package/utils/memoize.js +30 -0
  81. package/utils/nextFrame.js +4 -9
  82. package/utils/object/autoBind.js +11 -19
  83. package/utils/object/getAllProperties.js +3 -11
  84. package/utils/object/index.js +1 -2
  85. package/utils/object/isObject.js +2 -4
  86. package/utils/string/index.js +1 -2
  87. package/utils/string/withLeadingCharacters.js +1 -2
  88. package/utils/string/withLeadingSlash.js +1 -2
  89. package/utils/string/withTrailingCharacters.js +1 -2
  90. package/utils/string/withTrailingSlash.js +1 -2
  91. package/utils/string/withoutLeadingCharacters.js +1 -2
  92. package/utils/string/withoutLeadingCharactersRecursive.js +1 -2
  93. package/utils/string/withoutLeadingSlash.js +1 -2
  94. package/utils/string/withoutTrailingCharacters.js +1 -2
  95. package/utils/string/withoutTrailingCharactersRecursive.js +1 -2
  96. package/utils/string/withoutTrailingSlash.js +1 -2
  97. package/utils/throttle.js +2 -3
  98. package/Base/index.js.map +0 -1
  99. package/Base/managers/ChildrenManager.js.map +0 -1
  100. package/Base/managers/EventsManager.js.map +0 -1
  101. package/Base/managers/OptionsManager.js.map +0 -1
  102. package/Base/managers/RefsManager.js.map +0 -1
  103. package/Base/managers/ServicesManager.js.map +0 -1
  104. package/Base/utils.js.map +0 -1
  105. package/components/Accordion/Accordion.d.ts +0 -83
  106. package/components/Accordion/Accordion.js +0 -121
  107. package/components/Accordion/Accordion.js.map +0 -1
  108. package/components/Accordion/AccordionItem.d.ts +0 -122
  109. package/components/Accordion/AccordionItem.js +0 -327
  110. package/components/Accordion/AccordionItem.js.map +0 -1
  111. package/components/Accordion/index.d.ts +0 -27
  112. package/components/Accordion/index.js +0 -39
  113. package/components/Accordion/index.js.map +0 -1
  114. package/components/Cursor.d.ts +0 -138
  115. package/components/Cursor.js +0 -167
  116. package/components/Cursor.js.map +0 -1
  117. package/components/Draggable.d.ts +0 -49
  118. package/components/Draggable.js +0 -77
  119. package/components/Draggable.js.map +0 -1
  120. package/components/Modal.d.ts +0 -158
  121. package/components/Modal.js +0 -270
  122. package/components/Modal.js.map +0 -1
  123. package/components/Tabs.d.ts +0 -108
  124. package/components/Tabs.js +0 -195
  125. package/components/Tabs.js.map +0 -1
  126. package/components/index.d.ts +0 -6
  127. package/components/index.js +0 -7
  128. package/components/index.js.map +0 -1
  129. package/decorators/index.js.map +0 -1
  130. package/decorators/withBreakpointManager.js.map +0 -1
  131. package/decorators/withBreakpointObserver.js.map +0 -1
  132. package/decorators/withDrag.js.map +0 -1
  133. package/decorators/withExtraConfig.js.map +0 -1
  134. package/decorators/withIntersectionObserver.js.map +0 -1
  135. package/decorators/withMountWhenInView.js.map +0 -1
  136. package/helpers/createApp.js.map +0 -1
  137. package/helpers/createBase.d.ts +0 -7
  138. package/helpers/createBase.js +0 -7
  139. package/helpers/createBase.js.map +0 -1
  140. package/helpers/defineComponent.d.ts +0 -11
  141. package/helpers/defineComponent.js +0 -68
  142. package/helpers/defineComponent.js.map +0 -1
  143. package/helpers/importOnInteraction.js.map +0 -1
  144. package/helpers/importWhenIdle.js.map +0 -1
  145. package/helpers/importWhenVisible.js.map +0 -1
  146. package/helpers/index.js.map +0 -1
  147. package/helpers/utils.js.map +0 -1
  148. package/index.js.map +0 -1
  149. package/index.modern.js.map +0 -1
  150. package/index.umd.js.map +0 -1
  151. package/services/Service.js.map +0 -1
  152. package/services/drag.js.map +0 -1
  153. package/services/index.js.map +0 -1
  154. package/services/key.js.map +0 -1
  155. package/services/load.js.map +0 -1
  156. package/services/pointer.js.map +0 -1
  157. package/services/raf.js.map +0 -1
  158. package/services/resize.js.map +0 -1
  159. package/services/scroll.js.map +0 -1
  160. package/utils/collide/boundingRectToCircle.js.map +0 -1
  161. package/utils/collide/collideCircleCircle.js.map +0 -1
  162. package/utils/collide/collideCircleRect.js.map +0 -1
  163. package/utils/collide/collidePointCircle.js.map +0 -1
  164. package/utils/collide/collidePointRect.js.map +0 -1
  165. package/utils/collide/collideRectRect.js.map +0 -1
  166. package/utils/collide/index.js.map +0 -1
  167. package/utils/css/classes.js.map +0 -1
  168. package/utils/css/index.js.map +0 -1
  169. package/utils/css/matrix.js.map +0 -1
  170. package/utils/css/styles.js.map +0 -1
  171. package/utils/css/transition.js.map +0 -1
  172. package/utils/debounce.js.map +0 -1
  173. package/utils/focusTrap.js.map +0 -1
  174. package/utils/history.js.map +0 -1
  175. package/utils/index.js.map +0 -1
  176. package/utils/keyCodes.js.map +0 -1
  177. package/utils/math/clamp.js.map +0 -1
  178. package/utils/math/clamp01.js.map +0 -1
  179. package/utils/math/damp.js.map +0 -1
  180. package/utils/math/index.js.map +0 -1
  181. package/utils/math/inertiaFinalValue.js.map +0 -1
  182. package/utils/math/lerp.js.map +0 -1
  183. package/utils/math/map.js.map +0 -1
  184. package/utils/math/round.js.map +0 -1
  185. package/utils/nextFrame.js.map +0 -1
  186. package/utils/object/autoBind.js.map +0 -1
  187. package/utils/object/getAllProperties.js.map +0 -1
  188. package/utils/object/index.js.map +0 -1
  189. package/utils/object/isObject.js.map +0 -1
  190. package/utils/string/index.js.map +0 -1
  191. package/utils/string/withLeadingCharacters.js.map +0 -1
  192. package/utils/string/withLeadingSlash.js.map +0 -1
  193. package/utils/string/withTrailingCharacters.js.map +0 -1
  194. package/utils/string/withTrailingSlash.js.map +0 -1
  195. package/utils/string/withoutLeadingCharacters.js.map +0 -1
  196. package/utils/string/withoutLeadingCharactersRecursive.js.map +0 -1
  197. package/utils/string/withoutLeadingSlash.js.map +0 -1
  198. package/utils/string/withoutTrailingCharacters.js.map +0 -1
  199. package/utils/string/withoutTrailingCharactersRecursive.js.map +0 -1
  200. package/utils/string/withoutTrailingSlash.js.map +0 -1
  201. package/utils/throttle.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/decorators/withBreakpointObserver.js"],"names":["useResize","testBreakpoints","instance","breakpoint","props","$options","activeBreakpoints","inactiveBreakpoints","isInActiveBreakpoint","split","includes","isInInactiveBreakpoint","hasBreakpointConfiguration","Boolean","testConflictingBreakpointConfiguration","name","Error","addToResize","key","add","has","onResize","action","$isMounted","setTimeout","withBreakpointObserver","BaseClass","element","remove","$id","mutationObserver","MutationObserver","mutation","type","attributeName","startsWith","$mount","observe","$el","attributes","config","options","String"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,uBAAtB;;AAwBA,SAASC,eAAT,CAAyBC,QAAzB,EAAgF;AAAA,MAA7CC,UAA6C,uEAAhCH,SA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B,0BAA0B,+BAA/B,EAAuC;AACrC,kBAAKwB,MAAL;;AACAR,YAAAA,MAAM,CAACV,GAAD,CAAN;AACA;AACD;;AAEDD,UAAAA,WAAW,CAACC,GAAD,gCAAX;AACD;AACF,OAfwB,CAAzB;AAgBAY,MAAAA,gBAAgB,CAACO,OAAjB,CAAyB,MAAKC,GAA9B,EAAmC;AAAEC,QAAAA,UAAU,EAAE;AAAd,OAAnC;;AAGA,UAAI,CAAC3B,0BAA0B,+BAA/B,EAAuC;AACrC;AACD;;AAEDK,MAAAA,WAAW,CAACC,GAAD,gCAAX;AACA;AACD;;AA1DH;AAAA;AAAA,aAiEE,kBAAS;AAEP,YAAI,CAACN,0BAA0B,CAAC,IAAD,CAA/B,EAAuC;AACrC;AACD;;AAED,YAAMU,MAAM,GAAGrB,eAAe,CAAC,IAAD,CAA9B;;AACA,YAAIqB,MAAM,KAAK,QAAf,EAAyB;AACvB;AACD;;AAED,eAAO,IAAP;AACD;AA7EH;;AAAA;AAAA,IAAqBI,SAArB,qEAEQA,SAAS,CAACc,MAAV,IAAoB,EAF5B;AAGIzB,IAAAA,IAAI,qCAAKW,SAAL,aAAKA,SAAL,4CAAKA,SAAS,CAAEc,MAAhB,sDAAK,kBAAmBzB,IAAxB,yEAAgC,EAAhC,2BAHR;AAII0B,IAAAA,OAAO,kCACD,CAAAf,SAAS,SAAT,IAAAA,SAAS,WAAT,kCAAAA,SAAS,CAAEc,MAAX,0EAAmBC,OAAnB,KAA8B,EAD7B;AAELnC,MAAAA,iBAAiB,EAAEoC,MAFd;AAGLnC,MAAAA,mBAAmB,EAAEmC;AAHhB;AAJX;AA+ED","sourcesContent":["import useResize from '../services/resize.js';\n\n/**\n * @typedef {import('../Base').default} Base\n * @typedef {import('../Base').BaseComponent} BaseComponent\n */\n\n/**\n * @typedef {Object} WithBreakpointObserverOptions\n * @property {String} [activeBreakpoints]\n * @property {String} [inactiveBreakpoints]\n */\n\n/**\n * @typedef {Object} WithBreakpointObserverInterface\n * @property {WithBreakpointObserverOptions} $options\n */\n\n/**\n * Test the breakpoins of the given Base instance and return the hook to call.\n *\n * @param {Base & WithBreakpointObserverInterface} instance The component's instance.\n * @return {String} The action to trigger.\n */\nfunction testBreakpoints(instance, breakpoint = useResize().props().breakpoint) {\n const { activeBreakpoints, inactiveBreakpoints } = instance.$options;\n const isInActiveBreakpoint =\n activeBreakpoints && activeBreakpoints.split(' ').includes(breakpoint);\n const isInInactiveBreakpoint =\n inactiveBreakpoints && inactiveBreakpoints.split(' ').includes(breakpoint);\n\n if (\n (activeBreakpoints && isInActiveBreakpoint) ||\n (inactiveBreakpoints && !isInInactiveBreakpoint)\n ) {\n return '$mount';\n }\n\n return '$destroy';\n}\n\n/**\n * Test if the given instance is configured for breakpoints.\n * @param {Base & WithBreakpointObserverInterface} instance A Base class instance.\n * @return {Boolean} True if configured correctly, false otherwise.\n */\nfunction hasBreakpointConfiguration(instance) {\n const { activeBreakpoints, inactiveBreakpoints } = instance.$options;\n return Boolean(activeBreakpoints || inactiveBreakpoints);\n}\n\n/**\n * Test if the given instance has a conflicting configuration for breakpoints.\n * @param {Base & WithBreakpointObserverInterface} instance A Base class instance.\n * @return {void}\n */\nfunction testConflictingBreakpointConfiguration(instance) {\n const { activeBreakpoints, inactiveBreakpoints, name } = instance.$options;\n if (activeBreakpoints && inactiveBreakpoints) {\n throw new Error(\n `[${name}] Incorrect configuration: the \\`activeBreakpoints\\` and \\`inactiveBreakpoints\\` are not compatible.`\n );\n }\n}\n\n/**\n * Add the current instance to the resize service.\n * @param {String} key The key for the resize service callback.\n * @param {Base} instance The instance to observe.\n */\nfunction addToResize(key, instance) {\n testConflictingBreakpointConfiguration(instance);\n const { add, has } = useResize();\n\n if (!has(key)) {\n add(key, function onResize({ breakpoint }) {\n const action = testBreakpoints(instance, breakpoint);\n\n // Always destroy before mounting\n if (action === '$destroy' && instance.$isMounted) {\n instance[action]();\n } else if (action === '$mount' && !instance.$isMounted) {\n setTimeout(() => instance[action](), 0);\n }\n });\n }\n}\n\n/**\n * BreakpointObserver class.\n *\n * @template {BaseComponent} T\n * @param {T} BaseClass The Base class to extend from.\n * @return {T}\n */\nexport default function withBreakpointObserver(BaseClass) {\n // @ts-ignore\n return class extends BaseClass {\n static config = {\n ...(BaseClass.config || {}),\n name: `${BaseClass?.config?.name ?? ''}WithBreakpointObserver`,\n options: {\n ...(BaseClass?.config?.options || {}),\n activeBreakpoints: String,\n inactiveBreakpoints: String,\n },\n };\n\n /**\n * Watch for the document resize to test the breakpoints.\n * @this {Base & WithBreakpointObserverInterface}\n * @param {HTMLElement} element The component's root element.\n */\n constructor(element) {\n super(element);\n\n const { remove, props } = useResize();\n const { name } = this.$options;\n\n // Do nothing if no breakpoint has been defined.\n // @see https://js-toolkit.meta.fr/services/resize.html#breakpoint\n if (!props().breakpoint) {\n throw new Error(\n `[${name}] The \\`BreakpointObserver\\` class requires breakpoints to be defined.`\n );\n }\n\n const key = `BreakpointObserver-${this.$id}`;\n\n // Watch change on the `data-options` attribute to emit the `set:options` event.\n const mutationObserver = new MutationObserver(([mutation]) => {\n if (\n mutation.type === 'attributes' &&\n (mutation.attributeName === 'data-options' ||\n mutation.attributeName.startsWith('data-option-'))\n ) {\n // Stop here silently when no breakpoint configuration given.\n if (!hasBreakpointConfiguration(this)) {\n this.$mount();\n remove(key);\n return;\n }\n\n addToResize(key, this);\n }\n });\n mutationObserver.observe(this.$el, { attributes: true });\n\n // Stop here silently when no breakpoint configuration given.\n if (!hasBreakpointConfiguration(this)) {\n return this;\n }\n\n addToResize(key, this);\n return this;\n }\n\n /**\n * Override the default $mount method to prevent component's from being\n * mounted when they should not.\n * @return {this}\n */\n $mount() {\n // Execute normal behavior when no breakpoint configuration given.\n if (!hasBreakpointConfiguration(this)) {\n return super.$mount();\n }\n\n const action = testBreakpoints(this);\n if (action === '$mount') {\n return super.$mount();\n }\n\n return this;\n }\n };\n}\n"],"file":"withBreakpointObserver.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/decorators/withDrag.js"],"names":["useDrag","withDrag","BaseClass","options","target","$el","el","$on","otherOptions","boundUseDrag","bind","undefined","call","$services","register","enable","disable","unregister"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,OAAP,MAAoB,qBAApB;AAoBA,eAAe,SAASC,QAAT,CACbC,SADa,EAOb;AAAA,MALAC,OAKA,uEALU;AACRC,IAAAA,MADQ,oBACC;AACP,aAAO,KAAKC,GAAZ;AACD;AAHO,GAKV;AAEA;AAAA;;AAAA;;AAKE,oBAAYC,EAAZ,EAAgB;AAAA;;AAAA;;AACd,gCAAMA,EAAN;;AAEA,YAAKC,GAAL,CAAS,SAAT,EAAoB,YAAM;AACxB,YAAQH,MAAR,GAAoCD,OAApC,CAAQC,MAAR;AAAA,YAAmBI,YAAnB,4BAAoCL,OAApC;;AACA,YAAMM,YAAY,GAAGT,OAAO,CAACU,IAAR,CAAaC,SAAb,EAAwBP,MAAM,CAACQ,IAAP,+BAAxB,EAA2CJ,YAA3C,CAArB;;AACA,cAAKK,SAAL,CAAeC,QAAf,CAAwB,SAAxB,EAAmCL,YAAnC;;AACA,cAAKI,SAAL,CAAeE,MAAf,CAAsB,SAAtB;AACD,OALD;;AAOA,YAAKR,GAAL,CAAS,WAAT,EAAsB,YAAM;AAC1B,cAAKM,SAAL,CAAeG,OAAf,CAAuB,SAAvB;;AACA,cAAKH,SAAL,CAAeI,UAAf,CAA0B,SAA1B;AACD,OAHD;;AAVc;AAcf;;AAnBH;AAAA,IAAqBf,SAArB;AAqBD","sourcesContent":["import useDrag from '../services/drag.js';\n\n/**\n * @typedef {import('../Base').default} Base\n * @typedef {import('../Base').BaseComponent} BaseComponent\n * @typedef {import('../services/drag').DragServiceOptions} DragServiceOptions\n */\n\n/**\n * @typedef {DragServiceOptions & { target: (this:Base) => HTMLElement }} DragDecoratorOptions\n */\n\n/**\n * Add dragging capabilities to a component.\n *\n * @template {BaseComponent} T\n * @param {T} BaseClass\n * @param {DragDecoratorOptions} options\n * @return {T}\n */\nexport default function withDrag(\n BaseClass,\n options = {\n target() {\n return this.$el;\n },\n }\n) {\n // @ts-ignore\n return class extends BaseClass {\n /**\n * Class constructor.\n * @param {HTMLElement} el\n */\n constructor(el) {\n super(el);\n\n this.$on('mounted', () => {\n const { target, ...otherOptions } = options;\n const boundUseDrag = useDrag.bind(undefined, target.call(this), otherOptions);\n this.$services.register('dragged', boundUseDrag);\n this.$services.enable('dragged');\n });\n\n this.$on('destroyed', () => {\n this.$services.disable('dragged');\n this.$services.unregister('dragged');\n });\n }\n };\n}\n"],"file":"withDrag.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/decorators/withExtraConfig.js"],"names":["merge","withExtraConfig","BaseClass","config","options","newConfig","name"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,WAAlB;AAiBA,eAAe,SAASC,eAAT,CAAyBC,SAAzB,EAAoCC,MAApC,EAA0D;AAAA;;AAAA,MAAdC,OAAc,uEAAJ,EAAI;AACvE,MAAMC,SAAS,GAAGL,KAAK,CAACE,SAAS,CAACC,MAAX,EAAmBA,MAAnB,EAA2BC,OAA3B,CAAvB;;AAEA,MAAIC,SAAS,CAACC,IAAV,KAAmBJ,SAAS,CAACC,MAAV,CAAiBG,IAAxC,EAA8C;AAC5CD,IAAAA,SAAS,CAACC,IAAV,aAAoBJ,SAAS,CAACC,MAAV,CAAiBG,IAArC;AACD;;AAGD;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA,IAAqBJ,SAArB,qCAKkBG,SALlB;AAOD","sourcesContent":["import merge from 'deepmerge';\n\n/**\n * @typedef {import('deepmerge').Options} DeepmergeOptions\n * @typedef {import('../Base').BaseConfig} BaseConfig\n * @typedef {import('../Base').BaseComponent} BaseComponent\n */\n\n/**\n * Extends the configuration of an existing class.\n *\n * @template {BaseComponent} T\n * @param {T} BaseClass The Base class to extend.\n * @param {Partial<BaseConfig>} config Extra configuration to merge.\n * @param {DeepmergeOptions} options Options for the `deepmerge` function. {@link https://github.com/TehShrike/deepmerge#options}\n * @return {T}\n */\nexport default function withExtraConfig(BaseClass, config, options = {}) {\n const newConfig = merge(BaseClass.config, config, options);\n\n if (newConfig.name === BaseClass.config.name) {\n newConfig.name = `${BaseClass.config.name}WithExtraConfig`;\n }\n\n // @ts-ignore\n return class extends BaseClass {\n /**\n * Class config.\n * @type {BaseConfig}\n */\n static config = newConfig;\n };\n}\n"],"file":"withExtraConfig.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/decorators/withIntersectionObserver.js"],"names":["createArrayOfNumber","length","Array","map","val","index","withIntersectionObserver","BaseClass","defaultOptions","threshold","element","intersected","Error","$observer","IntersectionObserver","entries","__debug","$emit","$options","intersectionObserver","$isMounted","observe","$el","$on","unobserve","config","name","options","Object"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,SAASA,mBAAT,CAA6BC,MAA7B,EAAqC;AACnC,SAAO,mBAAI,IAAIC,KAAJ,CAAUD,MAAM,GAAG,CAAnB,CAAJ,EAA2BE,GAA3B,CAA+B,UAACC,GAAD,EAAMC,KAAN;AAAA,WAAgBA,KAAK,GAAGJ,MAAxB;AAAA,GAA/B,CAAP;AACD;;AAUD,eAAe,SAASK,wBAAT,CACbC,SADa,EAGb;AAAA;;AAAA,MADAC,cACA,uEADiB;AAAEC,IAAAA,SAAS,EAAET,mBAAmB,CAAC,GAAD;AAAhC,GACjB;AAEA;AAAA;;AAAA;;AAuBE,oBAAYU,OAAZ,EAAqB;AAAA;;AAAA;;AACnB,gCAAMA,OAAN;;AAEA,UAAI,CAAC,MAAKC,WAAN,IAAqB,OAAO,MAAKA,WAAZ,KAA4B,UAArD,EAAiE;AAC/D,cAAM,IAAIC,KAAJ,CAAU,sEAAV,CAAN;AACD;;AAED,YAAKC,SAAL,GAAiB,IAAIC,oBAAJ,CACf,UAACC,OAAD,EAAa;AACX,cAAKC,OAAL,CAAa,aAAb,EAA4BD,OAA5B;;AACA,cAAKE,KAAL,CAAW,aAAX,EAA0BF,OAA1B;;AACA,cAAKJ,WAAL,CAAiBI,OAAjB;AACD,OALc,kCAMVP,cANU,GAMU,MAAKU,QAAL,CAAcC,oBAAd,IAAsC,EANhD,EAAjB;;AASA,UAAI,MAAKC,UAAT,EAAqB;AACnB,cAAKP,SAAL,CAAeQ,OAAf,CAAuB,MAAKC,GAA5B;AACD;;AAED,YAAKC,GAAL,CAAS,SAAT,EAAoB,YAAM;AACxB,cAAKV,SAAL,CAAeQ,OAAf,CAAuB,MAAKC,GAA5B;AACD,OAFD;;AAIA,YAAKC,GAAL,CAAS,WAAT,EAAsB,YAAM;AAC1B,cAAKV,SAAL,CAAeW,SAAf,CAAyB,MAAKF,GAA9B;AACD,OAFD;;AAIA;AACD;;AApDH;AAAA;AAAA,WAIE,eAA4B;AAC1B,4CAAY,0EAA+B,EAA3C,IAAgD,aAAhD;AACD;AANH;;AAAA;AAAA,IAAqBf,SAArB,qEASQA,SAAS,CAACkB,MAAV,IAAoB,EAT5B;AAUIC,IAAAA,IAAI,qCAAKnB,SAAL,aAAKA,SAAL,4CAAKA,SAAS,CAAEkB,MAAhB,sDAAK,kBAAmBC,IAAxB,yEAAgC,EAAhC,6BAVR;AAWIC,IAAAA,OAAO,kCACD,CAAApB,SAAS,SAAT,IAAAA,SAAS,WAAT,kCAAAA,SAAS,CAAEkB,MAAX,0EAAmBE,OAAnB,KAA8B,EAD7B;AAELR,MAAAA,oBAAoB,EAAES;AAFjB;AAXX;AAsDD","sourcesContent":["/**\n * @typedef {import('../Base').default} Base\n * @typedef {import('../Base').BaseComponent} BaseComponent\n */\n\n/**\n * @typedef {Object} WithIntersectionObserverOptions\n * @property {Object} intersectionObserver\n */\n\n/**\n * @typedef {Object} WithIntersectionObserverInterface\n * @property {WithIntersectionObserverOptions} $options\n * @property {IntersectionObserver} $observer\n * @property {(entries: IntersectionObserverEntry[]) => void} intersected\n */\n\n/**\n * Create an array of number between 0 and 1 from the given length.\n * @param {Number} length The length of the array.\n * @return {Array} An array of number.\n */\nfunction createArrayOfNumber(length) {\n return [...new Array(length + 1)].map((val, index) => index / length);\n}\n\n/**\n * IntersectionObserver decoration.\n *\n * @template {BaseComponent} T\n * @param {T} BaseClass The Base class to extend.\n * @param {Object} [defaultOptions] The options for the IntersectionObserver instance.\n * @return {T & { new: (element:HTMLElement) => { $observer: IntersectionObserver }}}\n */\nexport default function withIntersectionObserver(\n BaseClass,\n defaultOptions = { threshold: createArrayOfNumber(100) }\n) {\n // @ts-ignore\n return class extends BaseClass {\n /**\n * Add the `intersected` method to the list of method to exclude from the `autoBind` call.\n */\n get __excludeFromAutoBind() {\n return [...(super.__excludeFromAutoBind || []), 'intersected'];\n }\n\n static config = {\n ...(BaseClass.config || {}),\n name: `${BaseClass?.config?.name ?? ''}WithIntersectionObserver`,\n options: {\n ...(BaseClass?.config?.options || {}),\n intersectionObserver: Object,\n },\n };\n\n /**\n * Create an observer when the class in instantiated.\n *\n * @this {Base & WithIntersectionObserverInterface}\n * @param {HTMLElement} element The component's root element.\n */\n constructor(element) {\n super(element);\n\n if (!this.intersected || typeof this.intersected !== 'function') {\n throw new Error('[withIntersectionObserver] The `intersected` method must be defined.');\n }\n\n this.$observer = new IntersectionObserver(\n (entries) => {\n this.__debug('intersected', entries);\n this.$emit('intersected', entries);\n this.intersected(entries);\n },\n { ...defaultOptions, ...(this.$options.intersectionObserver || {}) }\n );\n\n if (this.$isMounted) {\n this.$observer.observe(this.$el);\n }\n\n this.$on('mounted', () => {\n this.$observer.observe(this.$el);\n });\n\n this.$on('destroyed', () => {\n this.$observer.unobserve(this.$el);\n });\n\n return this;\n }\n };\n}\n"],"file":"withIntersectionObserver.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/decorators/withMountWhenInView.js"],"names":["withMountWhenInView","BaseClass","defaultOptions","threshold","element","IntersectionObserver","entries","isVisible","reduce","acc","entry","isIntersecting","method","$options","intersectionObserver","observe","$el","$on","dis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AAS,SAAT,IAAAA,SAAS,WAAT,kCAAAA,SAAS,CAAEkB,MAAX,0EAAmBE,OAAnB,KAA8B,EAD7B;AAELP,MAAAA,oBAAoB,EAAEQ;AAFjB;AARX;AAqED","sourcesContent":["/**\n * @typedef {import('../Base').default} Base\n * @typedef {import('../Base').BaseOptions} BaseOptions\n * @typedef {import('../Base').BaseComponent} BaseComponent\n */\n\n/**\n * @typedef {Object} WithMountWhenInViewOptions\n * @property {Object} intersectionObserver\n */\n\n/**\n * @typedef {Object} WithMountWhenInViewInterface\n * @property {() => void} terminated\n * @property {WithMountWhenInViewOptions & BaseOptions} $options\n */\n\n/**\n * IntersectionObserver decoration.\n *\n * @template {BaseComponent} T\n * @param {T} BaseClass The Base class to extend.\n * @param {Object} [defaultOptions] The options for the IntersectionObserver instance.\n * @return {T}\n */\nexport default function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] }) {\n // @ts-ignore\n return class extends BaseClass {\n /**\n * Class config.\n * @type {Object}\n */\n static config = {\n ...(BaseClass.config || {}),\n name: `${BaseClass?.config?.name ?? ''}WithMountWhenInView`,\n options: {\n ...(BaseClass?.config?.options || {}),\n intersectionObserver: Object,\n },\n };\n\n /**\n * Is the component visible?\n * @type {Boolean}\n */\n #isVisible = false;\n\n /**\n * The component's observer.\n * @type {IntersectionObserver}\n */\n #observer;\n\n /**\n * Create an observer when the class in instantiated.\n *\n * @param {HTMLElement} element The component's root element.\n */\n constructor(element) {\n super(element);\n\n this.#observer = new IntersectionObserver(\n (entries) => {\n const isVisible = entries.reduce((acc, entry) => acc || entry.isIntersecting, false);\n if (this.#isVisible !== isVisible) {\n this.#isVisible = isVisible;\n\n const method = isVisible ? '$mount' : '$destroy';\n this[method]();\n }\n },\n { ...defaultOptions, ...this.$options.intersectionObserver }\n );\n\n this.#observer.observe(this.$el);\n\n this.$on('terminated', () => {\n this.#observer.disconnect();\n });\n\n return this;\n }\n\n /**\n * Override the mounting of the component.\n *\n * @return {this}\n */\n $mount() {\n if (this.#isVisible) {\n super.$mount();\n }\n\n return this;\n }\n };\n}\n"],"file":"withMountWhenInView.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/helpers/createApp.js"],"names":["createApp","App","rootElement","isLoaded","document","readyState","app","addEventListener","$mount","useApp","Promise","resolve","setTimeout"],"mappings":"AAoCA,eAAe,SAASA,SAAT,CAAmBC,GAAnB,EAAwBC,WAAxB,EAAqC;AAClD,MAAIC,QAAQ,GAAGC,QAAQ,CAACC,UAAT,KAAwB,UAAvC;AACA,MAAIC,GAAJ;;AAEA,MAAI,CAACH,QAAL,EAAe;AACbC,IAAAA,QAAQ,CAACG,gBAAT,CAA0B,kBAA1B,EAA8C,YAAM;AAClD,UAAIH,QAAQ,CAACC,UAAT,KAAwB,UAA5B,EAAwC;AACtCC,QAAAA,GAAG,GAAG,IAAIL,GAAJ,CAAQC,WAAR,EAAqBM,MAArB,EAAN;AACAL,QAAAA,QAAQ,GAAG,IAAX;AACD;AACF,KALD;AAMD,GAPD,MAOO;AACLG,IAAAA,GAAG,GAAG,IAAIL,GAAJ,CAAQC,WAAR,EAAqBM,MAArB,EAAN;AACD;;AAED,SAAO,SAASC,MAAT,GAAkB;AACvB,QAAIN,QAAJ,EAAc;AACZ,aAAOO,OAAO,CAACC,OAAR,CAAgBL,GAAhB,CAAP;AACD;;AAED,WAAO,IAAII,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9BP,MAAAA,QAAQ,CAACG,gBAAT,CAA0B,kBAA1B,EAA8C,YAAM;AAClD,YAAIH,QAAQ,CAACC,UAAT,KAAwB,UAA5B,EAAwC;AACtCO,UAAAA,UAAU,CAAC;AAAA,mBAAMD,OAAO,CAACL,GAAD,CAAb;AAAA,WAAD,EAAqB,CAArB,CAAV;AACD;AACF,OAJD;AAKD,KANM,CAAP;AAOD,GAZD;AAaD","sourcesContent":["/**\n * @typedef {import('../Base/index.js').BaseComponent} BaseComponent\n */\n\n/**\n * Instantiate and mount the given component on the given root element when the page has been loaded\n * and return a function to use the app instance when it is ready.\n *\n * @usage\n * ```js\n * // app.js\n * import Base, { createApp } from '@studiometa/js-toolkit';\n *\n * class App extends Base {\n * static config = {\n * name: 'App',\n * }\n * }\n *\n * export default createApp(App, document.body);\n * ```\n * ```js\n * // other.js\n * import useApp from './app.js';\n *\n * const app = await useApp();\n * console.log(app.$options.name); // 'App'\n * ```\n *\n * @template {BaseComponent} T\n * @param {T} App\n * @param {HTMLElement} rootElement\n *\n * @return {() => Promise<InstanceType<T>>}\n *\n */\nexport default function createApp(App, rootElement) {\n let isLoaded = document.readyState === 'complete';\n let app;\n\n if (!isLoaded) {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n app = new App(rootElement).$mount();\n isLoaded = true;\n }\n });\n } else {\n app = new App(rootElement).$mount();\n }\n\n return function useApp() {\n if (isLoaded) {\n return Promise.resolve(app);\n }\n\n return new Promise((resolve) => {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n setTimeout(() => resolve(app), 0);\n }\n });\n });\n };\n}\n"],"file":"createApp.js"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Create a Base instance with the given object configuration.
3
- *
4
- * @param {HTMLElement|String} elementOrSelector The instance root HTML element.
5
- * @param {Object} options The Base class configuration.
6
- */
7
- export default function createBase(elementOrSelector: HTMLElement | string, options: any): import("../index.js").Base;
@@ -1,7 +0,0 @@
1
- import defineComponent from './defineComponent.js';
2
- export default function createBase(elementOrSelector, options) {
3
- var Component = defineComponent(options);
4
- var element = typeof elementOrSelector === 'string' ? document.querySelector(elementOrSelector) : elementOrSelector;
5
- return new Component(element);
6
- }
7
- //# sourceMappingURL=createBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/helpers/createBase.js"],"names":["defineComponent","createBase","elementOrSelector","options","Component","element","document","querySelector"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,sBAA5B;AAQA,eAAe,SAASC,UAAT,CAAoBC,iBAApB,EAAuCC,OAAvC,EAAgD;AAC7D,MAAMC,SAAS,GAAGJ,eAAe,CAACG,OAAD,CAAjC;AAEA,MAAME,OAAO,GACX,OAAOH,iBAAP,KAA6B,QAA7B,GACII,QAAQ,CAACC,aAAT,CAAuBL,iBAAvB,CADJ,GAEIA,iBAHN;AAIA,SAAO,IAAIE,SAAJ,CAAcC,OAAd,CAAP;AACD","sourcesContent":["import defineComponent from './defineComponent.js';\n\n/**\n * Create a Base instance with the given object configuration.\n *\n * @param {HTMLElement|String} elementOrSelector The instance root HTML element.\n * @param {Object} options The Base class configuration.\n */\nexport default function createBase(elementOrSelector, options) {\n const Component = defineComponent(options);\n /** @type {HTMLElement} */\n const element =\n typeof elementOrSelector === 'string'\n ? document.querySelector(elementOrSelector)\n : elementOrSelector;\n return new Component(element);\n}\n"],"file":"createBase.js"}
@@ -1,11 +0,0 @@
1
- /**
2
- * @typedef {import('../Base').BaseComponent} BaseComponent
3
- */
4
- /**
5
- * Define a component without a class.
6
- *
7
- * @param {Object} options The component's object
8
- * @return {BaseComponent} A component's class.
9
- */
10
- export default function defineComponent(options: any): BaseComponent;
11
- export type BaseComponent = import('../Base').BaseComponent;
@@ -1,68 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
9
- var _excluded = ["config", "methods"];
10
-
11
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
-
13
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
-
15
- import Base from '../Base/index.js';
16
- export default function defineComponent(options) {
17
- var config = options.config,
18
- methods = options.methods,
19
- hooks = _objectWithoutProperties(options, _excluded);
20
-
21
- if (!config) {
22
- throw new Error('The `config` property is required.');
23
- }
24
-
25
- if (!config.name) {
26
- throw new Error('The `config.name` property is required.');
27
- }
28
-
29
- var Component = function (_Base) {
30
- _inherits(Component, _Base);
31
-
32
- var _super = _createSuper(Component);
33
-
34
- function Component() {
35
- _classCallCheck(this, Component);
36
-
37
- return _super.apply(this, arguments);
38
- }
39
-
40
- return Component;
41
- }(Base);
42
-
43
- _defineProperty(Component, "config", config);
44
-
45
- var allowedHooks = ['mounted', 'loaded', 'ticked', 'resized', 'moved', 'keyed', 'scrolled', 'destroyed', 'terminated'];
46
- var filteredHooks = Object.entries(hooks).reduce(function (acc, _ref) {
47
- var _ref2 = _slicedToArray(_ref, 2),
48
- name = _ref2[0],
49
- fn = _ref2[1];
50
-
51
- if (allowedHooks.includes(name)) {
52
- acc[name] = fn;
53
- } else {
54
- throw new Error("\n The \"".concat(name, "\" method is not a Base lifecycle hook,\n it should be placed in the \"method\" property.\n The following hooks are available: ").concat(allowedHooks.join(', '), "\n "));
55
- }
56
-
57
- return acc;
58
- }, {});
59
- [].concat(_toConsumableArray(Object.entries(methods || {})), _toConsumableArray(Object.entries(filteredHooks))).forEach(function (_ref3) {
60
- var _ref4 = _slicedToArray(_ref3, 2),
61
- name = _ref4[0],
62
- fn = _ref4[1];
63
-
64
- Component.prototype[name] = fn;
65
- });
66
- return Component;
67
- }
68
- //# sourceMappingURL=defineComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/helpers/defineComponent.js"],"names":["Base","defineComponent","options","config","methods","hooks","Error","name","Component","allowedHooks","filteredHooks","Object","entries","reduce","acc","fn","includes","join","forEach","prototype"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,IAAP,MAAiB,kBAAjB;AAYA,eAAe,SAASC,eAAT,CAAyBC,OAAzB,EAAkC;AAC/C,MAAQC,MAAR,GAAsCD,OAAtC,CAAQC,MAAR;AAAA,MAAgBC,OAAhB,GAAsCF,OAAtC,CAAgBE,OAAhB;AAAA,MAA4BC,KAA5B,4BAAsCH,OAAtC;;AAEA,MAAI,CAACC,MAAL,EAAa;AACX,UAAM,IAAIG,KAAJ,CAAU,oCAAV,CAAN;AACD;;AAED,MAAI,CAACH,MAAM,CAACI,IAAZ,EAAkB;AAChB,UAAM,IAAID,KAAJ,CAAU,yCAAV,CAAN;AACD;;AAT8C,MAczCE,SAdyC;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA,IAcvBR,IAduB;;AAAA,kBAczCQ,SAdyC,YAkB7BL,MAlB6B;;AAqB/C,MAAMM,YAAY,GAAG,CACnB,SADmB,EAEnB,QAFmB,EAGnB,QAHmB,EAInB,SAJmB,EAKnB,OALmB,EAMnB,OANmB,EAOnB,UAPmB,EAQnB,WARmB,EASnB,YATmB,CAArB;AAYA,MAAMC,aAAa,GAAGC,MAAM,CAACC,OAAP,CAAeP,KAAf,EAAsBQ,MAAtB,CAA6B,UAACC,GAAD,QAAqB;AAAA;AAAA,QAAdP,IAAc;AAAA,QAARQ,EAAQ;;AACtE,QAAIN,YAAY,CAACO,QAAb,CAAsBT,IAAtB,CAAJ,EAAiC;AAC/BO,MAAAA,GAAG,CAACP,IAAD,CAAH,GAAYQ,EAAZ;AACD,KAFD,MAEO;AACL,YAAM,IAAIT,KAAJ,6BAEKC,IAFL,8JAImCE,YAAY,CAACQ,IAAb,CAAkB,IAAlB,CAJnC,gBAAN;AAOD;;AAED,WAAOH,GAAP;AACD,GAdqB,EAcnB,EAdmB,CAAtB;AAgBA,+BAAIH,MAAM,CAACC,OAAP,CAAeR,OAAO,IAAI,EAA1B,CAAJ,sBAAsCO,MAAM,CAACC,OAAP,CAAeF,aAAf,CAAtC,GAAqEQ,OAArE,CAA6E,iBAAgB;AAAA;AAAA,QAAdX,IAAc;AAAA,QAARQ,EAAQ;;AAC3FP,IAAAA,SAAS,CAACW,SAAV,CAAoBZ,IAApB,IAA4BQ,EAA5B;AACD,GAFD;AAIA,SAAOP,SAAP;AACD","sourcesContent":["import Base from '../Base/index.js';\n\n/**\n * @typedef {import('../Base').BaseComponent} BaseComponent\n */\n\n/**\n * Define a component without a class.\n *\n * @param {Object} options The component's object\n * @return {BaseComponent} A component's class.\n */\nexport default function defineComponent(options) {\n const { config, methods, ...hooks } = options;\n\n if (!config) {\n throw new Error('The `config` property is required.');\n }\n\n if (!config.name) {\n throw new Error('The `config.name` property is required.');\n }\n\n /**\n * Component class.\n */\n class Component extends Base {\n /**\n * Component config.\n */\n static config = config;\n }\n\n const allowedHooks = [\n 'mounted',\n 'loaded',\n 'ticked',\n 'resized',\n 'moved',\n 'keyed',\n 'scrolled',\n 'destroyed',\n 'terminated',\n ];\n\n const filteredHooks = Object.entries(hooks).reduce((acc, [name, fn]) => {\n if (allowedHooks.includes(name)) {\n acc[name] = fn;\n } else {\n throw new Error(\n `\n The \"${name}\" method is not a Base lifecycle hook,\n it should be placed in the \"method\" property.\n The following hooks are available: ${allowedHooks.join(', ')}\n `\n );\n }\n\n return acc;\n }, {});\n\n [...Object.entries(methods || {}), ...Object.entries(filteredHooks)].forEach(([name, fn]) => {\n Component.prototype[name] = fn;\n });\n\n return Component;\n}\n"],"file":"defineComponent.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/helpers/importOnInteraction.js"],"names":["getTargetElements","importOnInteraction","fn","nameOrSelectorOrElement","events","parent","normalizedEvents","ResolvedClass","resolver","resolve","then","module","default","Promise","elements","$el","eventListenerOptions","capture","passive","once","handler","forEach","element","event","addEventListener"],"mappings":"AAAA,SAASA,iBAAT,QAAkC,YAAlC;AAuBA,eAAe,SAASC,mBAAT,CAA6BC,EAA7B,EAAiCC,uBAAjC,EAA0DC,MAA1D,EAAkEC,MAAlE,EAA0E;AACvF,MAAMC,gBAAgB,GAAG,OAAOF,MAAP,KAAkB,QAAlB,GAA6B,CAACA,MAAD,CAA7B,GAAwCA,MAAjE;AAEA,MAAIG,aAAJ;;AAEA,MAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,OAAD,EAAa;AAC5BP,IAAAA,EAAE,GAAGQ,IAAL,CAAU,UAACC,MAAD,EAAY;AACpBJ,MAAAA,aAAa,GAAG,aAAaI,MAAb,GAAsBA,MAAM,CAACC,OAA7B,GAAuCD,MAAvD;AACAF,MAAAA,OAAO,CAACF,aAAD,CAAP;AACD,KAHD;AAID,GALD;;AAOA,SAAO,IAAIM,OAAJ,CAAY,UAACJ,OAAD,EAAa;AAC9B,QAAMK,QAAQ,GAAGd,iBAAiB,CAACG,uBAAD,EAA0BE,MAA1B,aAA0BA,MAA1B,uBAA0BA,MAAM,CAAEU,GAAlC,CAAlC;AACA,QAAMC,oBAAoB,GAAG;AAC3BC,MAAAA,OAAO,EAAE,IADkB;AAE3BC,MAAAA,OAAO,EAAE,IAFkB;AAG3BC,MAAAA,IAAI,EAAE;AAHqB,KAA7B;;AAKA,QAAMC,OAAO,GAAG,SAAVA,OAAU,GAAM;AACpBZ,MAAAA,QAAQ,CAACC,OAAD,CAAR;AACD,KAFD;;AAIAK,IAAAA,QAAQ,CAACO,OAAT,CAAiB,UAACC,OAAD,EAAa;AAC5BhB,MAAAA,gBAAgB,CAACe,OAAjB,CAAyB,UAACE,KAAD,EAAW;AAClCD,QAAAA,OAAO,CAACE,gBAAR,CAAyBD,KAAzB,EAAgCH,OAAhC,EAAyCJ,oBAAzC;AACD,OAFD;AAGD,KAJD;AAKD,GAhBM,CAAP;AAiBD","sourcesContent":["import { getTargetElements } from './utils.js';\n\n/**\n * @typedef {import('../Base/index.js').BaseComponent} BaseComponent\n * @typedef {import('../Base/index.js').default} Base\n */\n\n/**\n * Import a component on an interaction.\n *\n * @template {BaseComponent} T\n *\n * @param {() => Promise<T|{default:T}>} fn\n * The import function.\n * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement\n * The name or selector for the component.\n * @param {string|string[]} events\n * The events to listen to to trigger the import.\n * @param {Base=} [parent]\n * The parent component.\n *\n * @return {Promise<T>}\n */\nexport default function importOnInteraction(fn, nameOrSelectorOrElement, events, parent) {\n const normalizedEvents = typeof events === 'string' ? [events] : events;\n\n let ResolvedClass;\n\n const resolver = (resolve) => {\n fn().then((module) => {\n ResolvedClass = 'default' in module ? module.default : module;\n resolve(ResolvedClass);\n });\n };\n\n return new Promise((resolve) => {\n const elements = getTargetElements(nameOrSelectorOrElement, parent?.$el);\n const eventListenerOptions = {\n capture: true,\n passive: true,\n once: true,\n };\n const handler = () => {\n resolver(resolve);\n };\n\n elements.forEach((element) => {\n normalizedEvents.forEach((event) => {\n element.addEventListener(event, handler, eventListenerOptions);\n });\n });\n });\n}\n"],"file":"importOnInteraction.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/helpers/importWhenIdle.js"],"names":["importWhenIdle","fn","options","ResolvedClass","resolver","resolve","then","module","default","Promise","timeout","window","setTimeout","requestIdleCallback"],"mappings":"AAiBA,eAAe,SAASA,cAAT,CAAwBC,EAAxB,EAA4BC,OAA5B,EAAqC;AAClD,MAAIC,aAAJ;;AAEA,MAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,OAAD,EAAa;AAC5BJ,IAAAA,EAAE,GAAGK,IAAL,CAAU,UAACC,MAAD,EAAY;AACpBJ,MAAAA,aAAa,GAAG,aAAaI,MAAb,GAAsBA,MAAM,CAACC,OAA7B,GAAuCD,MAAvD;AACAF,MAAAA,OAAO,CAACF,aAAD,CAAP;AACD,KAHD;AAID,GALD;;AAOA,SAAO,IAAIM,OAAJ,CAAY,UAACJ,OAAD,EAAa;AAAA;;AAC9B,QAAMK,OAAO,uBAAGR,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEQ,OAAZ,+DAAuB,CAApC;;AAEA,QAAI,EAAE,yBAAyBC,MAA3B,CAAJ,EAAwC;AACtCC,MAAAA,UAAU,CAAC,YAAM;AACfR,QAAAA,QAAQ,CAACC,OAAD,CAAR;AACD,OAFS,EAEPK,OAFO,CAAV;AAGD,KAJD,MAIO;AACLC,MAAAA,MAAM,CAACE,mBAAP,CACE,YAAM;AACJD,QAAAA,UAAU,CAAC,YAAM;AACfR,UAAAA,QAAQ,CAACC,OAAD,CAAR;AACD,SAFS,EAEP,CAFO,CAAV;AAGD,OALH,EAME;AAAEK,QAAAA,OAAO,EAAER,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEQ;AAApB,OANF;AAQD;AACF,GAjBM,CAAP;AAkBD","sourcesContent":["/**\n * @typedef {import('../Base/index.js').BaseComponent} BaseComponent\n * @typedef {{ timeout?: number }} ImportWhenIdleOptions\n */\n\n/**\n * Import a component when user is idle.\n *\n * @template {BaseComponent} T\n *\n * @param {() => Promise<T|{default:T}>} fn\n * The import function.\n * @param {ImportWhenIdleOptions=} [options]\n * The time to wait before triggering the callback if never idle.\n *\n * @return {Promise<T>}\n */\nexport default function importWhenIdle(fn, options) {\n let ResolvedClass;\n\n const resolver = (resolve) => {\n fn().then((module) => {\n ResolvedClass = 'default' in module ? module.default : module;\n resolve(ResolvedClass);\n });\n };\n\n return new Promise((resolve) => {\n const timeout = options?.timeout ?? 1;\n\n if (!('requestIdleCallback' in window)) {\n setTimeout(() => {\n resolver(resolve);\n }, timeout);\n } else {\n window.requestIdleCallback(\n () => {\n setTimeout(() => {\n resolver(resolve);\n }, 0);\n },\n { timeout: options?.timeout }\n );\n }\n });\n}\n"],"file":"importWhenIdle.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/helpers/importWhenVisible.js"],"names":["getTargetElements","importWhenVisible","fn","nameOrSelectorOrElement","parent","observerOptions","ResolvedClass","resolver","resolve","cb","then","module","default","Promise","observer","IntersectionObserver","entries","someEntriesAreVisible","some","entry","isIntersecting","setTimeout","disconnect","elements","$el","forEach","element","observe"],"mappings":"AAAA,SAASA,iBAAT,QAAkC,YAAlC;AAuBA,eAAe,SAASC,iBAAT,CACbC,EADa,EAEbC,uBAFa,EAGbC,MAHa,EAKb;AAAA,MADAC,eACA,uEADkB,EAClB;AACA,MAAIC,aAAJ;;AAEA,MAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,OAAD,EAAUC,EAAV,EAAiB;AAChCP,IAAAA,EAAE,GAAGQ,IAAL,CAAU,UAACC,MAAD,EAAY;AACpBL,MAAAA,aAAa,GAAG,aAAaK,MAAb,GAAsBA,MAAM,CAACC,OAA7B,GAAuCD,MAAvD;AACAH,MAAAA,OAAO,CAACF,aAAD,CAAP;;AAEA,UAAI,OAAOG,EAAP,KAAc,UAAlB,EAA8B;AAC5BA,QAAAA,EAAE;AACH;AACF,KAPD;AAQD,GATD;;AAWA,SAAO,IAAII,OAAJ,CAAY,UAACL,OAAD,EAAa;AAC9B,QAAMM,QAAQ,GAAG,IAAIC,oBAAJ,CAAyB,UAACC,OAAD,EAAa;AACrD,UAAMC,qBAAqB,GAAGD,OAAO,CAACE,IAAR,CAAa,UAACC,KAAD;AAAA,eAAWA,KAAK,CAACC,cAAjB;AAAA,OAAb,CAA9B;;AACA,UAAIH,qBAAJ,EAA2B;AACzBI,QAAAA,UAAU,CAAC,YAAM;AACfd,UAAAA,QAAQ,CAACC,OAAD,EAAU;AAAA,mBAAMM,QAAQ,CAACQ,UAAT,EAAN;AAAA,WAAV,CAAR;AACD,SAFS,EAEP,CAFO,CAAV;AAGD;AACF,KAPgB,EAOdjB,eAPc,CAAjB;AASA,QAAMkB,QAAQ,GAAGvB,iBAAiB,CAACG,uBAAD,EAA0BC,MAA1B,aAA0BA,MAA1B,uBAA0BA,MAAM,CAAEoB,GAAlC,CAAlC;AACAD,IAAAA,QAAQ,CAACE,OAAT,CAAiB,UAACC,OAAD;AAAA,aAAaZ,QAAQ,CAACa,OAAT,CAAiBD,OAAjB,CAAb;AAAA,KAAjB;AACD,GAZM,CAAP;AAaD","sourcesContent":["import { getTargetElements } from './utils.js';\n\n/**\n * @typedef {import('../Base/index.js').default} Base\n * @typedef {import('../Base/index.js').BaseComponent} BaseComponent\n */\n\n/**\n * Import a component when it is visible.\n *\n * @template {BaseComponent} T\n *\n * @param {() => Promise<T|{default:T}>} fn\n * The import function.\n * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement\n * The name or selector for the component.\n * @param {Base=} [parent]\n * The parent component.\n * @param {IntersectionObserverInit=} [observerOptions]\n * Options for the `IntersectionObserver` instance.\n *\n * @return {Promise<T>}\n */\nexport default function importWhenVisible(\n fn,\n nameOrSelectorOrElement,\n parent,\n observerOptions = {}\n) {\n let ResolvedClass;\n\n const resolver = (resolve, cb) => {\n fn().then((module) => {\n ResolvedClass = 'default' in module ? module.default : module;\n resolve(ResolvedClass);\n\n if (typeof cb === 'function') {\n cb();\n }\n });\n };\n\n return new Promise((resolve) => {\n const observer = new IntersectionObserver((entries) => {\n const someEntriesAreVisible = entries.some((entry) => entry.isIntersecting);\n if (someEntriesAreVisible) {\n setTimeout(() => {\n resolver(resolve, () => observer.disconnect());\n }, 0);\n }\n }, observerOptions);\n\n const elements = getTargetElements(nameOrSelectorOrElement, parent?.$el);\n elements.forEach((element) => observer.observe(element));\n });\n}\n"],"file":"importWhenVisible.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/helpers/index.js"],"names":["createApp","createBase","defineComponent","importOnInteraction","importWhenIdle","importWhenVisible"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,gBAAtB;AACA,OAAOC,UAAP,MAAuB,iBAAvB;AACA,OAAOC,eAAP,MAA4B,sBAA5B;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AAEA,SACEL,SADF,EAEEC,UAFF,EAGEC,eAHF,EAIEC,mBAJF,EAKEC,cALF,EAMEC,iBANF","sourcesContent":["import createApp from './createApp.js';\nimport createBase from './createBase.js';\nimport defineComponent from './defineComponent.js';\nimport importOnInteraction from './importOnInteraction.js';\nimport importWhenIdle from './importWhenIdle.js';\nimport importWhenVisible from './importWhenVisible.js';\n\nexport {\n createApp,\n createBase,\n defineComponent,\n importOnInteraction,\n importWhenIdle,\n importWhenVisible,\n};\n"],"file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../packages/js-toolkit/helpers/utils.js"],"names":["getComponentElements","getTargetElements","nameOrSelectorOrElement","context","Array","isArray"],"mappings":"AACA,SAASA,oBAAT,QAAqC,kBAArC;AAYA,OAAO,SAASC,iBAAT,CAA2BC,uBAA3B,EAAoDC,OAApD,EAA6D;AAClE,MAAI,OAAOD,uBAAP,KAAmC,QAAvC,EAAiD;AAC/C,WAAOF,oBAAoB,CAACE,uBAAD,EAA0BC,OAA1B,CAA3B;AACD;;AAED,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcH,uBAAd,CAAL,EAA6C;AAC3C,WAAO,CAACA,uBAAD,CAAP;AACD;;AAED,SAAOA,uBAAP;AACD","sourcesContent":["/* eslint-disable import/prefer-default-export */\nimport { getComponentElements } from '../Base/utils.js';\n\n/**\n * Get the target elements for the lazy import helper functions.\n *\n * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement\n * The original selector or element, or list of elements.\n * @param {HTMLElement=} [context]\n * The optional context to use to query for elements.\n *\n * @return {HTMLElement[]} A normalized list of elements.\n */\nexport function getTargetElements(nameOrSelectorOrElement, context) {\n if (typeof nameOrSelectorOrElement === 'string') {\n return getComponentElements(nameOrSelectorOrElement, context);\n }\n\n if (!Array.isArray(nameOrSelectorOrElement)) {\n return [nameOrSelectorOrElement];\n }\n\n return nameOrSelectorOrElement;\n}\n"],"file":"utils.js"}
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../packages/js-toolkit/index.js"],"names":["Base","createApp","createBase","defineComponent","importOnInteraction","importWhenIdle","importWhenVisible"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,iBAAjB;AACA,SACEC,SADF,EAEEC,UAFF,EAGEC,eAHF,EAIEC,mBAJF,EAKEC,cALF,EAMEC,iBANF,QAOO,oBAPP;AASA,SACEN,IADF,EAEEC,SAFF,EAGEC,UAHF,EAIEC,eAJF,EAKEC,mBALF,EAMEC,cANF,EAOEC,iBAPF;AAUA,eAAeN,IAAf","sourcesContent":["import Base from './Base/index.js';\nimport {\n createApp,\n createBase,\n defineComponent,\n importOnInteraction,\n importWhenIdle,\n importWhenVisible,\n} from './helpers/index.js';\n\nexport {\n Base,\n createApp,\n createBase,\n defineComponent,\n importOnInteraction,\n importWhenIdle,\n importWhenVisible,\n};\n\nexport default Base;\n"],"file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.modern.js","sources":["../packages/js-toolkit/utils/object/getAllProperties.js","../packages/js-toolkit/Base/utils.js","../packages/js-toolkit/Base/managers/ChildrenManager.js","../packages/js-toolkit/Base/managers/RefsManager.js","../packages/js-toolkit/services/Service.js","../packages/js-toolkit/services/pointer.js","../packages/js-toolkit/services/raf.js","../packages/js-toolkit/utils/nextFrame.js","../packages/js-toolkit/utils/debounce.js","../packages/js-toolkit/services/resize.js","../packages/js-toolkit/services/scroll.js","../packages/js-toolkit/utils/keyCodes.js","../packages/js-toolkit/services/key.js","../packages/js-toolkit/services/load.js","../packages/js-toolkit/Base/managers/ServicesManager.js","../packages/js-toolkit/Base/managers/EventsManager.js","../node_modules/deepmerge/dist/cjs.js","../node_modules/lower-case/dist.es2015/index.js","../node_modules/no-case/dist.es2015/index.js","../packages/js-toolkit/node_modules/mimic-fn/index.js","../node_modules/p-defer/index.js","../node_modules/map-age-cleaner/dist/index.js","../packages/js-toolkit/node_modules/mem/dist/index.js","../packages/js-toolkit/Base/managers/OptionsManager.js","../packages/js-toolkit/utils/object/isObject.js","../packages/js-toolkit/Base/index.js","../packages/js-toolkit/utils/object/autoBind.js","../packages/js-toolkit/helpers/createApp.js","../packages/js-toolkit/helpers/defineComponent.js","../packages/js-toolkit/helpers/createBase.js","../packages/js-toolkit/helpers/utils.js","../packages/js-toolkit/helpers/importOnInteraction.js","../packages/js-toolkit/helpers/importWhenIdle.js","../packages/js-toolkit/helpers/importWhenVisible.js"],"sourcesContent":["/**\n * Gets all non-builtin properties up the prototype chain.\n *\n * @param {Object} object\n * The object to get the propeties from.\n * @param {Array=} [props=[]]\n * The already existing properties.\n * @param {(name:string, proto:any) => boolean} testFn\n * @return {Array<[String, Object]>} An array of properties and the prototype they belong to.\n */\nexport default function getAllProperties(object, props = [], testFn = null) {\n const proto = Object.getPrototypeOf(object);\n\n if (proto === Object.prototype) {\n return props;\n }\n\n let foundProps = Object.getOwnPropertyNames(proto);\n\n if (typeof testFn === 'function') {\n foundProps = foundProps.filter((name) => testFn(name, proto));\n }\n\n foundProps = foundProps.map((name) => [name, proto]).reduce((acc, val) => [...acc, val], props);\n\n return getAllProperties(proto, foundProps, testFn);\n}\n","/**\n * @typedef {import('./index.js').default} Base\n */\n\n/**\n * Test if an object has a method.\n *\n * @param {Object} obj The object to test\n * @param {String} name The method's name\n * @return {Boolean}\n */\nexport function hasMethod(obj, name) {\n return typeof obj[name] === 'function';\n}\n\n/**\n * Call the given method while applying the given arguments.\n *\n * @param {Base} instance The Base instance on which to trigger the method.\n * @param {String} method The method to call.\n * @param {...any} args The arguments to pass to the method.\n */\nexport function callMethod(instance, method, ...args) {\n instance.__debug('callMethod', method, ...args);\n\n // Prevent duplicate call of `mounted` and `destroyed`\n // methods based on the component status\n if (\n (method === 'destroyed' && !instance.$isMounted) ||\n (method === 'mounted' && instance.$isMounted)\n ) {\n instance.__debug('not', method, 'because the method has already been triggered once.');\n return instance;\n }\n\n instance.$emit(method, ...args);\n\n // We always emit an event, but we do not call the method if it does not exist\n if (!hasMethod(instance, method)) {\n return instance;\n }\n\n instance[method].call(instance, ...args);\n instance.__debug(method, instance, ...args);\n\n return instance;\n}\n\n/**\n * Get a list of elements based on the name of a component.\n *\n * @param {String} nameOrSelector\n * The name or selector to used for this component.\n * @param {HTMLElement|Document} element\n * The root element on which to query the selector, defaults to `document`.\n * @return {Array<HTMLElement>}\n * A list of elements on which the component should be mounted.\n */\nexport function getComponentElements(nameOrSelector, element = document) {\n const selector = `[data-component=\"${nameOrSelector}\"]`;\n let elements = [];\n\n try {\n elements = Array.from(element.querySelectorAll(selector));\n // eslint-disable-next-line no-empty\n } catch {}\n\n // If no child component found with the default selector, try a classic DOM selector\n if (elements.length === 0) {\n elements = Array.from(element.querySelectorAll(nameOrSelector));\n }\n\n return elements;\n}\n","import { getComponentElements } from '../utils.js';\n\n/**\n * @typedef {import('../index.js').default} Base\n * @typedef {import('../index.js').BaseComponent} BaseComponent\n * @typedef {import('../index.js').BaseAsyncComponent} BaseAsyncComponent\n * @typedef {import('../index.js').BaseConfigComponents} BaseConfigComponents\n * @typedef {import('./EventsManager.js').default} EventsManager\n */\n\n/**\n * Children manager.\n */\nexport default class ChildrenManager {\n /**\n * @type {Base}\n * @private\n */\n __base;\n\n /**\n * @type {HTMLElement}\n * @private\n */\n __element;\n\n /**\n * @type {BaseConfigComponents}\n * @private\n */\n __components;\n\n /**\n * @type {EventsManager}\n * @private\n */\n __eventsManager;\n\n /**\n * @return {string[]}\n */\n get registeredNames() {\n return Object.keys(this).filter((key) => !key.startsWith('__'));\n }\n\n /**\n * Class constructor.\n * @param {Base} base\n * The component's instance.\n * @param {HTMLElement} element\n * The component's root element\n * @param {BaseConfigComponents} components\n * The children components' classes\n * @param {EventsManager} eventsManager\n */\n constructor(base, element, components, eventsManager) {\n this.__base = base;\n this.__element = element;\n this.__components = components;\n this.__eventsManager = eventsManager;\n }\n\n /**\n * Register instances of all children components.\n */\n registerAll() {\n Object.entries(this.__components).forEach(([name, component]) =>\n this.__register(name, component)\n );\n }\n\n /**\n * Register instance of a child component.\n *\n * @param {string} name\n * The name of the child component.\n * @param {BaseComponent|BaseAsyncComponent} component\n * A Base class or a Promise for async components.\n * @private\n */\n __register(name, component) {\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n get: () => {\n const elements = getComponentElements(name, this.__element);\n\n if (elements.length === 0) {\n return [];\n }\n\n return elements\n .map((element) => this.__getChild(element, component, name))\n .filter((instance) => instance !== 'terminated');\n },\n });\n }\n\n /**\n * Get a child component's instance.\n *\n * @param {HTMLElement & { __base__?: Base | 'terminated' }} el\n * The root element of the child component.\n * @param {BaseComponent|BaseAsyncComponent} ComponentClass\n * A Base class or a Promise for async components.\n * @param {string} name\n * The name of the child component.\n * @return {Base|Promise|'terminated'}\n * A Base instance or a Promise resolving to a Base instance.\n * @private\n */\n __getChild(el, ComponentClass, name) {\n // Return existing instance if it exists\n if (el.__base__) {\n return el.__base__;\n }\n\n // Return a new instance if the component class is a child of the Base class\n if ('$isBase' in ComponentClass) {\n const child = new ComponentClass(el);\n Object.defineProperty(child, '$parent', { get: () => this.__base });\n return child;\n }\n\n // Resolve async components\n return ComponentClass(this.__base).then((module) => {\n // @ts-ignore\n return this.__getChild(el, module.default ?? module, name);\n });\n }\n\n /**\n * Mount all child component instances.\n */\n mountAll() {\n this.__triggerHookForAll('$mount');\n }\n\n /**\n * Update all child component instances.\n */\n updateAll() {\n this.__triggerHookForAll('$update');\n }\n\n /**\n * Destroy all child component instances.\n */\n destroyAll() {\n this.__triggerHookForAll('$destroy');\n }\n\n /**\n * Execute the given hook for all children instances.\n *\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to execute.\n * @private\n */\n __triggerHookForAll(hook) {\n this.registeredNames.forEach((name) => {\n this[name].forEach((instance) => {\n if (instance instanceof Promise) {\n instance.then((resolvedInstance) => this.__triggerHook(hook, resolvedInstance, name));\n } else {\n this.__triggerHook(hook, instance, name);\n }\n });\n });\n }\n\n /**\n * Execute the given hook for the given instance.\n *\n * @param {'$mount'|'$update'|'$destroy'} hook The hook to trigger.\n * @param {Base} instance The target instance.\n * @param {string} name The name of the component.\n * @private\n */\n __triggerHook(hook, instance, name) {\n if (hook === '$update' && !instance.$isMounted) {\n // eslint-disable-next-line no-param-reassign\n hook = '$mount';\n }\n\n if (hook === '$update' || hook === '$destroy') {\n this.__eventsManager.unbindChild(name, instance);\n }\n\n if (hook === '$update' || hook === '$mount') {\n this.__eventsManager.bindChild(name, instance);\n }\n\n instance[hook]();\n }\n}\n","/**\n * @typedef {import('../index.js').default} Base\n * @typedef {import('./EventsManager.js').default} EventsManager\n */\n\n/**\n * Refs Manager\n */\nexport default class RefsManager {\n /**\n * @type {HTMLElement}\n * @private\n */\n __element;\n\n /**\n * @type {string[]}\n * @private\n */\n __refs;\n\n /**\n * @type {Base}\n * @private\n */\n __base;\n\n /**\n * @type {EventsManager}\n * @private\n */\n __eventsManager;\n\n /**\n * Class constructor.\n *\n * @param {Base} base\n * The base instance tied to this manager.\n * @param {HTMLElement} element\n * The root element of a Base component.\n * @param {string[]} refs\n * The list of refs of this component.\n * @param {EventsManager} eventsManager\n */\n constructor(base, element, refs, eventsManager) {\n this.__element = element;\n this.__refs = refs;\n this.__base = base;\n this.__eventsManager = eventsManager;\n }\n\n /**\n * Register all refs.\n *\n * @return {void}\n */\n registerAll() {\n this.__refs.forEach((refName) => this.__register(refName));\n }\n\n /**\n * Unregister all refs.\n *\n * @return {void}\n */\n unregisterAll() {\n this.__refs.forEach((refName) => this.__unregister(refName));\n }\n\n /**\n * Register one ref.\n *\n * @param {string} refName The ref name.\n * @private\n */\n __register(refName) {\n const isMultiple = refName.endsWith('[]');\n const propName = RefsManager.normalizeRefName(refName);\n\n const refs = /** @type {HTMLElement[]} */ (\n Array.from(this.__element.querySelectorAll(`[data-ref=\"${refName}\"]`))\n ).filter(\n /**\n * @param {HTMLElement} ref\n */\n (ref) => this.__filterRefsBelongingToInstance(ref)\n );\n\n if (!isMultiple && refs.length > 1) {\n console.warn(\n `[${this.__base.$options.name}]`,\n `The \"${refName}\" ref has been found multiple times.`,\n 'Did you forgot to add the `[]` suffix to its name?'\n );\n }\n\n this.__eventsManager.bindRef(refName, refs);\n\n Object.defineProperty(this, propName, {\n // @todo remove usage of non-multiple refs as array\n value: isMultiple || refs.length > 1 ? refs : refs[0],\n enumerable: true,\n configurable: true,\n });\n }\n\n /**\n * Unregister one ref.\n *\n * @param {string} refName The ref name.\n * @private\n */\n __unregister(refName) {\n const propName = RefsManager.normalizeRefName(refName);\n const refs = Array.isArray(this[propName]) ? this[propName] : [this[propName]];\n this.__eventsManager.unbindRef(refName, refs);\n }\n\n /**\n * Normalize the name of ref.\n *\n * @param {string} name The original name.\n * @return {string} The normalized name.\n */\n static normalizeRefName(name) {\n return name.endsWith('[]') ? name.replace(/\\[\\]$/, '') : name;\n }\n\n /**\n * Filter refs belonging to the related Base instance.\n *\n * @param {HTMLElement} ref The ref to test.\n * @return {boolean}\n * @private\n */\n __filterRefsBelongingToInstance(ref) {\n let ancestor = ref.parentElement;\n\n while (ancestor && ancestor.dataset.component === undefined) {\n ancestor = ancestor.parentElement;\n }\n\n return ancestor === null || ancestor === this.__element;\n }\n}\n","/**\n * Service abstract class\n */\nexport default class Service {\n /**\n * Class constructor, used to test the abstract class implementation.\n */\n constructor() {\n this.callbacks = new Map();\n this.isInit = false;\n }\n\n /**\n * Getter to get the services properties.\n * This getter MUST be implementer by the service extending this class.\n * @return {Object}\n */\n get props() {\n throw new Error('The `props` getter must be implemented.');\n }\n\n /**\n * Method to initialize the service behaviors.\n * This method MUST be implemented by the service extending this class.\n *\n * @return {Service} The current instance\n */\n init() {\n throw new Error('The `init` method must be implemented.');\n }\n\n /**\n * Method to kill the service behaviors.\n * This method MUST be implemented by the service extending this class.\n *\n * @return {Service} The current instance\n */\n kill() {\n throw new Error('The `kill` method must be implemented.');\n }\n\n /**\n * Add a callback.\n *\n * @param {String} key The callback's identifier\n * @param {Function} callback The callback function\n * @return {this} The current instance\n */\n add(key, callback) {\n if (this.has(key)) {\n throw new Error(`A callback with the key \\`${key}\\` has already been registered.`);\n }\n\n // Initialize the service when we add the first callback\n if (this.callbacks.size === 0 && !this.isInit) {\n this.init();\n this.isInit = true;\n }\n\n this.callbacks.set(key, callback);\n return this;\n }\n\n /**\n * Test if a callback with the given key has already been added.\n *\n * @param {String} key The identifier to test\n * @return {Boolean} Whether or not the identifier already exists\n */\n has(key) {\n return this.callbacks.has(key);\n }\n\n /**\n * Get the callback tied to the given key.\n *\n * @param {String} key The identifier to get\n * @return {Function} The callback function\n */\n get(key) {\n return this.callbacks.get(key);\n }\n\n /**\n * Remove the callback tied to the given key.\n *\n * @param {String} key The identifier to remove\n * @return {Service} The current instance\n */\n remove(key) {\n this.callbacks.delete(key);\n\n // Kill the service when we remove the last callback\n if (this.callbacks.size === 0 && this.isInit) {\n this.kill();\n this.isInit = false;\n }\n\n return this;\n }\n\n /**\n * Trigger each added callback with the given arguments.\n *\n * @param {Array} args All the arguments to apply to the callback\n * @return {Service} The current instance\n */\n trigger(...args) {\n this.callbacks.forEach(function forEachCallback(callback) {\n callback(...args);\n });\n\n return this;\n }\n}\n","import Service from './Service.js';\n\n/**\n * @typedef {import('./index').ServiceInterface} ServiceInterface\n */\n\n/**\n * @typedef {Object} PointerServiceProps\n * @property {MouseEvent | TouchEvent} event\n * @property {Boolean} isDown\n * @property {Number} x\n * @property {Number} y\n * @property {{ x: Boolean, y: Boolean }} changed\n * @property {{ x: Number, y: Number }} last\n * @property {{ x: Number, y: Number }} delta\n * @property {{ x: Number, y: Number }} progress\n * @property {{ x: Number, y: Number }} max\n */\n\n/**\n * @typedef {Object} PointerService\n * @property {(key:String, callback:(props:PointerServiceProps) => void) => void} add\n * Add a function to the resize service. The key must be uniq.\n * @property {() => PointerServiceProps} props\n * Get the current values of the resize service props.\n */\n\n/**\n * Test if an event is an instance of TouchEvent.\n *\n * @param {TouchEvent|MouseEvent} event The event instance to test.\n * @return {Boolean} Is it a TouchEvent?\n */\nfunction isTouchEvent(event) {\n return typeof TouchEvent !== 'undefined' && event instanceof TouchEvent;\n}\n\n/**\n * Pointer service\n */\nclass Pointer extends Service {\n /** @type {Boolean} State of the pointer. */\n isDown = false;\n\n /** @type {Number} The y pointer position. */\n y = window.innerHeight / 2;\n\n /** @type {Number} The y previous pointer position. */\n yLast = window.innerHeight / 2;\n\n /** @type {Number} The x pointer position. */\n x = window.innerWidth / 2;\n\n /** @type {Number} The x previous pointer position. */\n xLast = window.innerWidth / 2;\n\n /** @type {MouseEvent|TouchEvent} The latest event emitted from the pointer. */\n event;\n\n /**\n * Whether or not the raf service is running.\n * @type {Boolean}\n */\n hasRaf = false;\n\n /**\n * Bind the handler to the mousemove and touchmove events.\n * Bind the up and down handler to the mousedown, mouseup, touchstart and touchend events.\n *\n * @return {Pointer}\n */\n init() {\n document.documentElement.addEventListener('mouseenter', this, {\n once: true,\n capture: true,\n });\n\n const options = { passive: true, capture: true };\n document.addEventListener('mousemove', this, options);\n document.addEventListener('touchmove', this, options);\n document.addEventListener('mousedown', this, options);\n document.addEventListener('touchstart', this, options);\n document.addEventListener('mouseup', this, options);\n document.addEventListener('touchend', this, options);\n return this;\n }\n\n /**\n * Handle events.\n * @param {MouseEvent|TouchEvent} event The event object.\n */\n handleEvent(event) {\n // eslint-disable-next-line default-case\n switch (event.type) {\n case 'mouseenter':\n case 'mousemove':\n case 'touchmove':\n this.handler(event);\n break;\n case 'mousedown':\n case 'touchstart':\n this.downHandler();\n break;\n case 'mouseup':\n case 'touchend':\n this.upHandler();\n break;\n }\n }\n\n /**\n * Unbind all handlers from their bounded event.\n *\n * @return {Pointer}\n */\n kill() {\n document.removeEventListener('mousemove', this);\n document.removeEventListener('touchmove', this);\n document.removeEventListener('mousedown', this);\n document.removeEventListener('touchstart', this);\n document.removeEventListener('mouseup', this);\n document.removeEventListener('touchend', this);\n return this;\n }\n\n /**\n * The service handler.\n * @param {MouseEvent|TouchEvent} event The mouse event object.\n */\n handler(event) {\n this.updateValues(event);\n this.trigger(this.props);\n }\n\n /**\n * Handler for the pointer's down action.\n *\n * @return {void}\n */\n downHandler() {\n this.isDown = true;\n this.trigger(this.props);\n }\n\n /**\n * Handler for the pointer's up action.\n *\n * @return {void}\n */\n upHandler() {\n this.isDown = false;\n this.trigger(this.props);\n }\n\n /**\n * Update the pointer positions.\n *\n * @param {MouseEvent|TouchEvent} event The event object.\n * @return {void}\n */\n updateValues(event) {\n this.event = event;\n this.yLast = this.y;\n this.xLast = this.x;\n\n // Check pointer Y\n // We either get data from a touch event `event.touches[0].clientY` or from\n // a mouse event `event.clientY`.\n const y = isTouchEvent(event)\n ? /** @type {TouchEvent} */ (event).touches[0]?.clientY\n : /** @type {MouseEvent} */ (event).clientY;\n if (y !== this.y) {\n this.y = y;\n }\n\n // Check pointer X\n // We either get data from a touch event `event.touches[0].clientX` or from\n // a mouse event `event.clientX`.\n const x = isTouchEvent(event)\n ? /** @type {TouchEvent} */ (event).touches[0]?.clientX\n : /** @type {MouseEvent} */ (event).clientX;\n if (x !== this.x) {\n this.x = x;\n }\n }\n\n /**\n * Get the pointer props.\n *\n * @type {Object}\n */\n get props() {\n return {\n event: this.event,\n isDown: this.isDown,\n x: this.x,\n y: this.y,\n changed: {\n x: this.x !== this.xLast,\n y: this.y !== this.yLast,\n },\n last: {\n x: this.xLast,\n y: this.yLast,\n },\n delta: {\n x: this.x - this.xLast,\n y: this.y - this.yLast,\n },\n progress: {\n x: this.x / window.innerWidth,\n y: this.y / window.innerHeight,\n },\n max: {\n x: window.innerWidth,\n y: window.innerHeight,\n },\n };\n }\n}\n\nlet pointer = null;\n\n/**\n * Use the pointer.\n *\n * ```js\n * import usePointer from '@studiometa/js-toolkit/services';\n * const { add, remove, props } = usePointer();\n * add('id', () => {});\n * remove('id');\n * props();\n * ```\n *\n * @return {ServiceInterface & PointerService}\n */\nexport default function usePointer() {\n if (!pointer) {\n pointer = new Pointer();\n }\n\n const add = pointer.add.bind(pointer);\n const remove = pointer.remove.bind(pointer);\n const has = pointer.has.bind(pointer);\n const props = () => pointer.props;\n\n return {\n add,\n remove,\n has,\n props,\n };\n}\n","import Service from './Service.js';\nimport { getRaf, getCancelRaf } from '../utils/nextFrame.js';\n\n/**\n * @typedef {import('./index').ServiceInterface} ServiceInterface\n */\n\n/**\n * @typedef {Object} RafServiceProps\n * @property {DOMHighResTimeStamp} time\n */\n\n/**\n * @typedef {Object} RafService\n * @property {(key:String, callback:(props:RafServiceProps) => void) => void} add\n * Add a function to the resize service. The key must be uniq.\n * @property {() => RafServiceProps} props\n * Get the current values of the resize service props.\n */\n\n/**\n * Tick service\n */\nclass Raf extends Service {\n /** @type {Boolean} Whether the loop is running or not. */\n isTicking = false;\n\n /** @type {number} */\n id = 0;\n\n raf = getRaf();\n\n cancelRaf = getCancelRaf();\n\n /**\n * Bind loop to the instance.\n */\n constructor() {\n super();\n this.loop = this.loop.bind(this);\n }\n\n /**\n * Start the requestAnimationFrame loop.\n *\n * @return {Raf}\n */\n init() {\n this.isTicking = true;\n this.loop();\n return this;\n }\n\n /**\n * Loop method.\n */\n loop() {\n this.trigger(this.props);\n\n if (!this.isTicking) {\n return;\n }\n\n this.id = this.raf(this.loop);\n }\n\n /**\n * Stop the requestAnimationFrame loop.\n *\n * @return {Raf}\n */\n kill() {\n this.cancelRaf(this.id);\n this.isTicking = false;\n return this;\n }\n\n /**\n * Get raf props.\n *\n * @todo Return elapsed time / index?\n * @type {Object}\n */\n get props() {\n return {\n time: window.performance.now(),\n };\n }\n}\n\nlet instance = null;\n\n/**\n * Use the RequestAnimationFrame (raf) service.\n *\n * ```js\n * import { useRaf } from '@studiometa/js/services';\n * const { add, remove, props } = useRag();\n * add(id, (props) => {});\n * remove(id);\n * props();\n * ```\n *\n * @return {ServiceInterface & RafService}\n */\nexport default function useRaf() {\n if (!instance) {\n instance = new Raf();\n }\n\n const add = instance.add.bind(instance);\n const remove = instance.remove.bind(instance);\n const has = instance.has.bind(instance);\n\n // eslint-disable-next-line require-jsdoc\n function props() {\n return instance.props;\n }\n\n return {\n add,\n remove,\n has,\n props,\n };\n}\n","/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n * @return {(handler: Function) => number}\n */\nexport function getRaf() {\n return typeof window !== 'undefined' && window.requestAnimationFrame\n ? window.requestAnimationFrame.bind(window)\n : setTimeout;\n}\n\n/**\n * Get a function to cancel the method returned by `getRaf()`.\n *\n * @return {(id:number) => void}\n */\nexport function getCancelRaf() {\n return typeof window !== 'undefined' && window.cancelAnimationFrame\n ? window.cancelAnimationFrame.bind(window)\n : clearTimeout;\n}\n\n/**\n * Wait for the next frame to execute a function.\n *\n * @param {Function=} [fn=() => {}] The callback function to execute.\n * @return {Promise} A Promise resolving when the next frame is reached.\n *\n * @example\n * ```js\n * nextFrame(() => console.log('hello world'));\n *\n * await nextFrame();\n * console.log('hello world');\n * ```\n */\nexport default function nextFrame(fn = () => {}) {\n const raf = getRaf();\n return new Promise((resolve) => {\n raf(() => raf(() => resolve(fn())));\n });\n}\n","/**\n * Returns a function, that, as long as it continues to be invoked,\n * will not be triggered. The function will be called after it stops\n * being called for N milliseconds.\n *\n * @param {(...args:any[]) => void} fn The function to call.\n * @param {Number=} [delay=300] The delay in ms to wait before calling the function.\n * @return {(...args:any[]) => void} The debounced function.\n */\nexport default function debounce(fn, delay = 300) {\n let timeout;\n return function debounced(...args) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n fn(...args);\n }, delay);\n };\n}\n","import Service from './Service.js';\nimport debounce from '../utils/debounce.js';\n\n/**\n * @typedef {import('./index').ServiceInterface} ServiceInterface\n */\n\n/**\n * @typedef {Object} ResizeServiceProps\n * @property {Number} width\n * @property {Number} height\n * @property {Number} ratio\n * @property {'square'|'landscape'|'portrait'} orientation\n * @property {String} [breakpoint]\n * @property {String[]} [breakpoints]\n */\n\n/**\n * @typedef {Object} ResizeService\n * @property {(key:String, callback:(props:ResizeServiceProps) => void) => void} add\n * Add a function to the resize service. The key must be uniq.\n * @property {() => ResizeServiceProps} props\n * Get the current values of the resize service props.\n */\n\n/**\n * Resize service\n *\n * ```\n * import { useResize } from '@studiometa/js/services';\n * const { add, remove, props } = useResize();\n * add(key, (props) => {});\n * remove(key);\n * props();\n * ```\n */\nclass Resize extends Service {\n /**\n * Bind the handler to the resize event.\n *\n * @return {this}\n */\n init() {\n this.handler = debounce(() => {\n this.trigger(this.props);\n }).bind(this);\n\n window.addEventListener('resize', this.handler);\n\n return this;\n }\n\n /**\n * Unbind the handler from the resize event.\n *\n * @return {this}\n */\n kill() {\n window.removeEventListener('resize', this.handler);\n\n return this;\n }\n\n /**\n * Get resize props.\n *\n * @type {ResizeServiceProps}\n */\n get props() {\n /** @type {ResizeServiceProps} [description] */\n const props = {\n width: window.innerWidth,\n height: window.innerHeight,\n ratio: window.innerWidth / window.innerHeight,\n orientation: 'square',\n };\n\n if (props.ratio > 1) {\n props.orientation = 'landscape';\n }\n\n if (props.ratio < 1) {\n props.orientation = 'portrait';\n }\n\n if (this.breakpointElement) {\n props.breakpoint = this.breakpoint;\n props.breakpoints = this.breakpoints;\n }\n\n return props;\n }\n\n /**\n * The element holding the breakpoints data.\n * @return {HTMLElement}\n */\n get breakpointElement() {\n return document.querySelector('[data-breakpoint]') || null;\n }\n\n /**\n * Get the current breakpoint.\n * @return {String}\n */\n get breakpoint() {\n return window\n .getComputedStyle(this.breakpointElement, '::before')\n .getPropertyValue('content')\n .replace(/\"/g, '');\n }\n\n /**\n * Get all breakpoints.\n * @return {Array}\n */\n get breakpoints() {\n const breakpoints = window\n .getComputedStyle(this.breakpointElement, '::after')\n .getPropertyValue('content')\n .replace(/\"/g, '');\n\n return breakpoints.split(',');\n }\n\n /**\n * Test if we can use the `ResizeObserver` API.\n * @return {Boolean}\n */\n get canUseResizeObserver() {\n return typeof window.ResizeObserver !== 'undefined';\n }\n}\n\nlet resize = null;\n\n/**\n * Use the resize service.\n *\n * ```js\n * import useResize from '@studiometa/js-toolkit/services/resize';\n * const { add, remove, props } = useResize();\n * add(key, (props) => {});\n * remove(key);\n * props();\n * ```\n * @return {ServiceInterface & ResizeService}\n */\nexport default function useResize() {\n if (!resize) {\n resize = new Resize();\n }\n\n const add = resize.add.bind(resize);\n const remove = resize.remove.bind(resize);\n const has = resize.has.bind(resize);\n const props = () => resize.props;\n\n return {\n add,\n remove,\n has,\n props,\n };\n}\n","import Service from './Service.js';\nimport debounce from '../utils/debounce.js';\n\n/**\n * @typedef {import('./index').ServiceInterface} ServiceInterface\n */\n\n/**\n * @typedef {Object} ScrollServiceProps\n * @property {Number} x\n * @property {Number} y\n * @property {{ x: Boolean, y: Boolean }} changed\n * @property {{ x: Number, y: Number }} last\n * @property {{ x: Number, y: Number }} delta\n * @property {{ x: Number, y: Number }} progress\n * @property {{ x: Number, y: Number }} max\n * @property {{ x: 'LEFT'|'RIGHT'|'NONE', y: 'UP'|'DOWN'|'NONE' }} direction\n */\n\n/**\n * @typedef {Object} ScrollService\n * @property {(key:String, callback:(props:ScrollServiceProps) => void) => void} add\n * Add a function to the resize service. The key must be uniq.\n * @property {() => ScrollServiceProps} props\n * Get the current values of the resize service props.\n */\n\n/**\n * Scroll service\n */\nclass Scroll extends Service {\n /** @type {Number} The y scroll position. */\n y = window.pageYOffset;\n\n /** @type {Number} The y previous scroll position. */\n yLast = window.pageYOffset;\n\n /** @type {Number} The x scroll position. */\n x = window.pageXOffset;\n\n /** @type {Number} The x previous scroll position. */\n xLast = window.pageXOffset;\n\n /**\n * Bind the handler to the scroll event.\n *\n * @return {Scroll}\n */\n init() {\n document.addEventListener('scroll', this, { passive: true, capture: true });\n return this;\n }\n\n /**\n * Debounced handler.\n *\n * @return {() => void}\n */\n get debouncedHandler() {\n const debounced = debounce(() => {\n this.trigger(this.props);\n }, 0);\n\n // Define property to avoid multiple call to the getter\n Object.defineProperty(this, 'debouncedHandler', {\n value: debounced,\n });\n\n return debounced;\n }\n\n /**\n * Scroll event handler.\n *\n * @return {void}\n */\n handleEvent() {\n this.trigger(this.props);\n\n this.debouncedHandler();\n }\n\n /**\n * Unbind the handler from the scroll event.\n *\n * @return {Scroll}\n */\n kill() {\n document.removeEventListener('scroll', this);\n return this;\n }\n\n /**\n * Get scroll props.\n *\n * @type {Object}\n */\n get props() {\n this.yLast = this.y;\n this.xLast = this.x;\n\n // Check scroll Y\n if (window.pageYOffset !== this.y) {\n this.y = window.pageYOffset;\n }\n\n // Check scroll x\n if (window.pageXOffset !== this.x) {\n this.x = window.pageXOffset;\n }\n\n return {\n x: this.x,\n y: this.y,\n changed: {\n x: this.x !== this.xLast,\n y: this.y !== this.yLast,\n },\n last: {\n x: this.xLast,\n y: this.yLast,\n },\n delta: {\n x: this.x - this.xLast,\n y: this.y - this.yLast,\n },\n progress: {\n x: this.max.x === 0 ? 1 : this.x / this.max.x,\n y: this.max.y === 0 ? 1 : this.y / this.max.y,\n },\n direction: {\n /* eslint-disable no-nested-ternary */\n x: this.x > this.xLast ? 'RIGHT' : this.x < this.xLast ? 'LEFT' : 'NONE',\n y: this.y > this.yLast ? 'DOWN' : this.y < this.yLast ? 'UP' : 'NONE',\n /* eslint-enable no-nested-ternary */\n },\n max: this.max,\n };\n }\n\n /**\n * Get scroll max values.\n *\n * @type {Object}\n */\n get max() {\n return {\n x: (document.scrollingElement || document.body).scrollWidth - window.innerWidth,\n y: (document.scrollingElement || document.body).scrollHeight - window.innerHeight,\n };\n }\n}\n\nlet scroll = null;\n\n/**\n * Use the scroll service.\n *\n * ```js\n * import { useScroll } from '@studiometa/js-toolkit/services';\n * const { add, remove, props } = useScroll();\n * add(key, (props) => {});\n * remove(key);\n * props();\n * ```\n *\n * @return {ServiceInterface & ScrollService}\n */\nexport default function useScroll() {\n if (!scroll) {\n scroll = new Scroll();\n }\n\n const add = scroll.add.bind(scroll);\n const remove = scroll.remove.bind(scroll);\n const has = scroll.has.bind(scroll);\n const props = () => scroll.props;\n\n return {\n add,\n remove,\n has,\n props,\n };\n}\n","export default {\n ENTER: 13,\n SPACE: 32,\n TAB: 9,\n ESC: 27,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n};\n","import Service from './Service.js';\nimport keyCodes from '../utils/keyCodes.js';\n\n/**\n * @typedef {import('./index').ServiceInterface} ServiceInterface\n */\n\n/**\n * @typedef {Object} KeyServiceProps\n * @property {KeyboardEvent} event\n * @property {Number} triggered\n * @property {Boolean} isUp\n * @property {Boolean} isDown\n * @property {Boolean} ENTER\n * @property {Boolean} SPACE\n * @property {Boolean} TAB\n * @property {Boolean} ESC\n * @property {Boolean} LEFT\n * @property {Boolean} UP\n * @property {Boolean} RIGHT\n * @property {Boolean} DOWN\n */\n\n/**\n * @typedef {Object} KeyService\n * @property {(key:String, callback:(props:KeyServiceProps) => void) => void} add\n * Add a function to the resize service. The key must be uniq.\n * @property {() => KeyServiceProps} props\n * Get the current values of the resize service props.\n */\n\n/**\n * Scroll service\n */\nclass Key extends Service {\n /** @type {Object} The event object. */\n event = {};\n\n /**\n * Used to accumulate the number of times the `keydown` event has been triggered.\n * @type {Number}\n */\n triggered = 0;\n\n /** @type {Object} The previous event object. */\n previousEvent = {};\n\n /**\n * Bind the handler to the keyboard event.\n *\n * @return {Key}\n */\n init() {\n this.handler = (event) => {\n this.event = event;\n this.trigger(this.props);\n };\n document.addEventListener('keydown', this.handler, { passive: false });\n document.addEventListener('keyup', this.handler, { passive: false });\n return this;\n }\n\n /**\n * Unbind the handler from the keyboard event.\n *\n * @return {Key}\n */\n kill() {\n document.removeEventListener('keydown', this.handler);\n document.removeEventListener('keyup', this.handler);\n return this;\n }\n\n /**\n * Get keyboard props.\n *\n * @type {Object}\n */\n get props() {\n const keys = Object.entries(keyCodes).reduce((acc, [name, code]) => {\n acc[name] = code === this.event.keyCode;\n return acc;\n }, {});\n\n if (!this.previousEvent.type) {\n this.triggered = 0;\n }\n\n if (this.event.type === 'keydown' && this.previousEvent.type === 'keydown') {\n this.triggered += 1;\n } else {\n this.triggered = 1;\n }\n\n this.previousEvent = this.event;\n\n return {\n event: this.event,\n triggered: this.triggered,\n direction: this.event.type === 'keydown' ? 'down' : 'up',\n isUp: this.event.type === 'keyup',\n isDown: this.event.type === 'keydown',\n ...keys,\n };\n }\n}\n\nlet key = null;\n\n/**\n * Use the keyboard service.\n *\n * ```js\n * import { useKey } from '@studiometa/js-toolkit/services';\n * const { add, remove, props } = useKey();\n * add(key, (props) => {});\n * remove(key);\n * props();\n * ```\n *\n * @return {ServiceInterface & KeyService}\n */\nexport default function useKey() {\n if (!key) {\n key = new Key();\n }\n\n const add = key.add.bind(key);\n const remove = key.remove.bind(key);\n const has = key.has.bind(key);\n const props = () => key.props;\n\n return {\n add,\n remove,\n has,\n props,\n };\n}\n","import Service from './Service.js';\n\n/**\n * @typedef {import('./index').ServiceInterface} ServiceInterface\n */\n\n/**\n * @typedef {Object} LoadServiceProps\n * @property {DOMHighResTimeStamp} time\n */\n\n/**\n * @typedef {Object} LoadService\n * @property {(key:String, callback:(props:LoadServiceProps) => void) => void} add\n * Add a function to the resize service. The key must be uniq.\n * @property {() => LoadServiceProps} props\n * Get the current values of the resize service props.\n */\n\n/**\n * Load service\n */\nclass Load extends Service {\n /**\n * Start the requestAnimationFrame loop.\n *\n * @return {Load}\n */\n init() {\n this.handler = () => {\n this.trigger(this.props);\n };\n\n window.addEventListener('load', this.handler);\n return this;\n }\n\n /**\n * Stop the requestAnimationFrame loop.\n *\n * @return {Load}\n */\n kill() {\n window.removeEventListener('load', this.handler);\n return this;\n }\n\n /**\n * Get raf props.\n *\n * @todo Return elapsed time / index?\n * @type {Object}\n */\n get props() {\n return {};\n }\n}\n\nlet instance = null;\n\n/**\n * Use the load service.\n *\n * ```js\n * import { useLoad } from '@studiometa/js/services';\n * const { add, remove, props } = useRag();\n * add(id, (props) => {});\n * remove(id);\n * props();\n * ```\n *\n * @return {ServiceInterface & LoadService}\n */\nexport default function useRaf() {\n if (!instance) {\n instance = new Load();\n }\n\n const add = instance.add.bind(instance);\n const remove = instance.remove.bind(instance);\n const has = instance.has.bind(instance);\n\n // eslint-disable-next-line require-jsdoc\n function props() {\n return instance.props;\n }\n\n return {\n add,\n remove,\n has,\n props,\n };\n}\n","import usePointer from '../../services/pointer.js';\nimport useRaf from '../../services/raf.js';\nimport useResize from '../../services/resize.js';\nimport useScroll from '../../services/scroll.js';\nimport useKey from '../../services/key.js';\nimport useLoad from '../../services/load.js';\nimport { hasMethod, callMethod } from '../utils.js';\n\n/**\n * @typedef {import('../index').default} Base\n * @typedef {import('../../services').ServiceInterface} ServiceInterface\n */\n\n/**\n * @type {Record<string, () => ServiceInterface>}\n */\nconst SERVICES_MAP = {\n scrolled: useScroll,\n resized: useResize,\n ticked: useRaf,\n moved: usePointer,\n keyed: useKey,\n loaded: useLoad,\n};\n\n/**\n * @typedef {keyof SERVICES_MAP} ServiceName\n */\n\n/**\n * Services management for the Base class.\n */\nexport default class ServicesManager {\n /**\n * @type {Base}\n * @private\n */\n __base;\n\n /**\n * Class constructor.\n * @param {Base} instance The Base instance.\n */\n constructor(instance) {\n this.__base = instance;\n }\n\n /**\n * Test if the given service is registered.\n *\n * @param {ServiceName} service The name of the service.\n * @return {Boolean}\n */\n has(service) {\n if (!hasMethod(this.__base, service) && !SERVICES_MAP[service]) {\n return false;\n }\n\n const { has } = SERVICES_MAP[service]();\n return has(this.__base.$id);\n }\n\n /**\n * Init the given service and bind it to the given instance.\n *\n * @param {ServiceName} service The name of the service.\n * @return {() => void} A function to unbind the service.\n */\n enable(service) {\n if (this.has(service)) {\n return this.disable.bind(this, service);\n }\n\n if (!hasMethod(this.__base, service) || !SERVICES_MAP[service]) {\n return function noop() {};\n }\n\n const { add } = SERVICES_MAP[service]();\n const self = this;\n\n /**\n * @param {any[]} args\n */\n function serviceHandler(...args) {\n callMethod(self.__base, service, ...args);\n }\n\n add(this.__base.$id, serviceHandler);\n\n return this.disable.bind(this, service);\n }\n\n /**\n * Enable all services and return methods to disable them.\n *\n * @return {Function[]}\n */\n enableAll() {\n return Object.keys(SERVICES_MAP).map(\n /** @param {ServiceName} serviceName */\n (serviceName) => this.enable(serviceName)\n );\n }\n\n /**\n * Disable all services.\n *\n * @return {void}\n */\n disableAll() {\n Object.keys(SERVICES_MAP).forEach(\n /** @param {ServiceName} serviceName */\n (serviceName) => {\n this.disable(serviceName);\n }\n );\n }\n\n /**\n * Disable a service.\n *\n * @param {String} service The name of the service.\n * @return {void}\n */\n disable(service) {\n if (!SERVICES_MAP[service]) {\n return;\n }\n\n const { remove } = SERVICES_MAP[service]();\n remove(this.__base.$id);\n }\n\n /**\n * Register a new service to be enabled/disabled.\n *\n * @param {string} name The name of the service hook.\n * @param {() => ServiceInterface} useFunction The `use...` function for the service.\n */\n register(name, useFunction) {\n SERVICES_MAP[name] = useFunction;\n }\n\n /**\n * Unregister a new service to be enabled disabled.\n *\n * @param {string} name The name of the service hooK\n */\n unregister(name) {\n delete SERVICES_MAP[name];\n }\n}\n","import getAllProperties from '../../utils/object/getAllProperties.js';\nimport RefsManager from './RefsManager.js';\n\n/**\n * @typedef {import('../index.js').default} Base\n * @typedef {import('./ChildrenManager.js').default} ChildrenManager\n */\n\n/**\n * Event management class.\n */\nexport default class EventsManager {\n /**\n * @type {HTMLElement}\n * @private\n */\n __rootElement;\n\n /**\n * @type {Base}\n * @private\n */\n __base;\n\n /**\n * @type {WeakMap}\n * @private\n */\n __methodsCache = new WeakMap();\n\n /**\n * Event listener object for the root element.\n *\n * @type {EventListenerObject}\n */\n __rootElementHandler = {\n handleEvent: (event) => {\n const normalizedEventName = EventsManager.normalizeName(event.type);\n const method = `on${normalizedEventName}`;\n\n if (typeof this.__base[method] === 'function') {\n this.__base[method](event);\n }\n },\n };\n\n /**\n * Event listener object for the refs.\n *\n * @type {EventListenerObject}\n */\n __refsHandler = {\n handleEvent: (event) => {\n const ref = /** @type {HTMLElement} */ (event.currentTarget);\n const refName = RefsManager.normalizeRefName(ref.dataset.ref);\n\n const normalizedRefName = EventsManager.normalizeName(refName);\n const normalizedEventName = EventsManager.normalizeName(event.type);\n const method = `on${normalizedRefName}${normalizedEventName}`;\n\n if (typeof this.__base[method] === 'function') {\n let index = 0;\n if (Array.isArray(this.__base.$refs[refName])) {\n index = this.__base.$refs[refName].indexOf(ref);\n }\n\n this.__base[method](event, index);\n }\n },\n };\n\n /**\n * Event listener object for the children.\n *\n * @type {EventListenerObject}\n */\n __childrenHandler = {\n /**\n * @param {CustomEvent} event\n * @return {void}\n */\n handleEvent: (event) => {\n const child = /** @type {HTMLElement & { __base__: Base }} */ (event.currentTarget).__base__;\n let childName;\n let index = 0;\n\n const childrenManager = this.__base.$children;\n\n childrenManager.registeredNames.find((name) => {\n if (childrenManager[name].includes(child)) {\n childName = name;\n index = childrenManager[name].indexOf(child);\n return true;\n }\n\n return false;\n });\n\n const normalizedRefName = EventsManager.normalizeName(childName);\n const normalizedEventName = EventsManager.normalizeName(event.type);\n const method = `on${normalizedRefName}${normalizedEventName}`;\n\n if (typeof this.__base[method] === 'function') {\n const args = event.detail ?? [];\n this.__base[method](...args, index, event);\n }\n },\n };\n\n /**\n * Class constructor.\n *\n * @param {HTMLElement} rootElement\n * @param {Base} base\n */\n constructor(rootElement, base) {\n this.__rootElement = rootElement;\n this.__base = base;\n }\n\n /**\n * Manage a ref event methods.\n *\n * @param {string} name\n * The name of the ref.\n * @param {HTMLElement[]} elements\n * The elements of the ref.\n * @param {'add'|'remove'} [mode]\n * The action to perform: add or remove the event listeners.\n *\n * @return {void}\n * @private\n */\n __manageRef(name, elements, mode = 'add') {\n const action = `${mode}EventListener`;\n const methods = this.__getEventMethodsByName(name);\n methods.forEach((method) => {\n const event = this.__getEventNameByMethod(method, name);\n elements.forEach((element) => element[action](event, this.__refsHandler));\n });\n }\n\n /**\n * Bind event methods to the given ref elements.\n *\n * @param {string} name\n * The name of the ref.\n * @param {HTMLElement[]} elements\n * The elements of the ref.\n *\n * @return {void}\n */\n bindRef(name, elements) {\n this.__manageRef(name, elements);\n }\n\n /**\n * Bind event methods to the given ref elements.\n *\n * @param {string} name\n * The name of the ref.\n * @param {HTMLElement[]} elements\n * The elements of the ref.\n *\n * @return {void}\n */\n unbindRef(name, elements) {\n this.__manageRef(name, elements, 'remove');\n }\n\n /**\n * Manage event methods to the given child instance.\n *\n * @param {string} name\n * The name of the ref.\n * @param {Base} instance\n * A base instance.\n * @param {'add'|'remove'} [mode]\n * The action to perform: add or remove the event listeners.\n *\n * @return {void}\n * @private\n */\n __manageChild(name, instance, mode = 'add') {\n const action = mode === 'add' ? '$on' : '$off';\n const methods = this.__getEventMethodsByName(name);\n methods.forEach((method) => {\n const event = this.__getEventNameByMethod(method, name);\n instance[action](event, this.__childrenHandler);\n });\n }\n\n /**\n * Bind event methods to the given child instance.\n *\n * @param {string} name\n * The name of the ref.\n * @param {Base} instance\n * A base instance.\n *\n * @return {void}\n */\n bindChild(name, instance) {\n this.__manageChild(name, instance);\n }\n\n /**\n * Unbind event methods to the given child instance.\n *\n * @param {string} name\n * The name of the ref.\n * @param {Base} instance\n * A base instance.\n *\n * @return {void}\n */\n unbindChild(name, instance) {\n this.__manageChild(name, instance, 'remove');\n }\n\n /**\n * Manage event methods on the root element.\n *\n * @param {'add'|'remove'} [mode]\n * The action to perform: add or remove the event listeners.\n *\n * @return {void}\n * @private\n */\n __manageRootElement(mode = 'add') {\n const modeMethod = `${mode}EventListener`;\n const methods = this.__getEventMethodsByName();\n methods.forEach((method) => {\n const event = this.__getEventNameByMethod(method);\n this.__rootElement[modeMethod](event, this.__rootElementHandler);\n });\n }\n\n /**\n * Bind event methods on the root element.\n *\n * @return {void}\n */\n bindRootElement() {\n this.__manageRootElement();\n }\n\n /**\n * Unbind event method from the root element.\n *\n * @return {void}\n */\n unbindRootElement() {\n this.__manageRootElement('remove');\n }\n\n /**\n * Get the event name from the given method and its tied ref or children name.\n *\n * @param {string} method\n * @param {string} name\n * @return {string}\n * @private\n */\n __getEventNameByMethod(method, name = '') {\n const normalizedName = EventsManager.normalizeName(name);\n const regex = new RegExp(`^on${normalizedName}([A-Z].*)$`);\n const [, event] = method.match(regex);\n return EventsManager.normalizeEventName(event);\n }\n\n /**\n * Get the base instance methods matching the `onSomething` pattern.\n *\n * @param {string} [name]\n * @return {string[]}\n * @private\n */\n __getEventMethodsByName(name = '') {\n const normalizedName = EventsManager.normalizeName(name);\n const regex = new RegExp(`^on${normalizedName}[A-Z].*$`);\n\n let methods = this.__methodsCache.get(regex);\n\n if (!methods) {\n methods = getAllProperties(this.__base, [], (method) => regex.test(method));\n this.__methodsCache.set(regex, methods);\n }\n\n return methods.reduce((acc, [method]) => {\n if (!acc.includes(method)) {\n acc.push(method);\n }\n return acc;\n }, []);\n }\n\n /**\n * Normalize the given name to PascalCase, such as:\n *\n * ```\n * sentence case => SentenceCase\n * lowercase => Lowercase\n * UPPERCASE => Uppercase\n * kebab-case => KebabCase\n * snake_case => SnakeCase\n * camelCase => CamelCase\n * PascalCase => PascalCase\n * .class-selector => ClassSelector\n * .bem__selector => BemSelector\n * __id-selector => IdSelector\n * .complex[class^ =\"__\"] => ComplexClass\n * ```\n *\n * @param {string} name\n * @return {string}\n */\n static normalizeName(name) {\n return name\n .replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase())\n .replace(/[^a-zA-Z\\d\\s:]/g, ' ')\n .replace(/(^\\w|\\s+\\w)/g, (c) => c.trim().toUpperCase())\n .trim();\n }\n\n /**\n * Normalize the event names from PascalCase to kebab-case.\n *\n * @param {string} name\n * @return {string}\n */\n static normalizeEventName(name) {\n return name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace(/^-/, '');\n }\n}\n","'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn target.propertyIsEnumerable(symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /\\u0130|\\u0049|\\u0049\\u0307/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n az: {\n regexp: /\\u0130/g,\n map: {\n İ: \"\\u0069\",\n I: \"\\u0131\",\n İ: \"\\u0069\",\n },\n },\n lt: {\n regexp: /\\u0049|\\u004A|\\u012E|\\u00CC|\\u00CD|\\u0128/g,\n map: {\n I: \"\\u0069\\u0307\",\n J: \"\\u006A\\u0307\",\n Į: \"\\u012F\\u0307\",\n Ì: \"\\u0069\\u0307\\u0300\",\n Í: \"\\u0069\\u0307\\u0301\",\n Ĩ: \"\\u0069\\u0307\\u0303\",\n },\n },\n};\n/**\n * Localized lower case.\n */\nexport function localeLowerCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return lowerCase(str);\n}\n/**\n * Lower case as a function.\n */\nexport function lowerCase(str) {\n return str.toLowerCase();\n}\n//# sourceMappingURL=index.js.map","import { lowerCase } from \"lower-case\";\n// Support camel case (\"camelCase\" -> \"camel Case\" and \"CAMELCase\" -> \"CAMEL Case\").\nvar DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];\n// Remove all non-word characters.\nvar DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;\n/**\n * Normalize the string into something other libraries can manipulate easier.\n */\nexport function noCase(input, options) {\n if (options === void 0) { options = {}; }\n var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? \" \" : _d;\n var result = replace(replace(input, splitRegexp, \"$1\\0$2\"), stripRegexp, \"\\0\");\n var start = 0;\n var end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\")\n start++;\n while (result.charAt(end - 1) === \"\\0\")\n end--;\n // Transform each token independently.\n return result.slice(start, end).split(\"\\0\").map(transform).join(delimiter);\n}\n/**\n * Replace `re` in the input string with the replacement value.\n */\nfunction replace(input, re, value) {\n if (re instanceof RegExp)\n return input.replace(re, value);\n return re.reduce(function (input, re) { return input.replace(re, value); }, input);\n}\n//# sourceMappingURL=index.js.map","const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable &&\n\t\ttoDescriptor.enumerable === fromDescriptor.enumerable &&\n\t\ttoDescriptor.configurable === fromDescriptor.configurable &&\n\t\t(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tObject.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n","'use strict';\nmodule.exports = () => {\n\tconst ret = {};\n\n\tret.promise = new Promise((resolve, reject) => {\n\t\tret.resolve = resolve;\n\t\tret.reject = reject;\n\t});\n\n\treturn ret;\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst p_defer_1 = __importDefault(require(\"p-defer\"));\nfunction mapAgeCleaner(map, property = 'maxAge') {\n let processingKey;\n let processingTimer;\n let processingDeferred;\n const cleanup = () => __awaiter(this, void 0, void 0, function* () {\n if (processingKey !== undefined) {\n // If we are already processing an item, we can safely exit\n return;\n }\n const setupTimer = (item) => __awaiter(this, void 0, void 0, function* () {\n processingDeferred = p_defer_1.default();\n const delay = item[1][property] - Date.now();\n if (delay <= 0) {\n // Remove the item immediately if the delay is equal to or below 0\n map.delete(item[0]);\n processingDeferred.resolve();\n return;\n }\n // Keep track of the current processed key\n processingKey = item[0];\n processingTimer = setTimeout(() => {\n // Remove the item when the timeout fires\n map.delete(item[0]);\n if (processingDeferred) {\n processingDeferred.resolve();\n }\n }, delay);\n // tslint:disable-next-line:strict-type-predicates\n if (typeof processingTimer.unref === 'function') {\n // Don't hold up the process from exiting\n processingTimer.unref();\n }\n return processingDeferred.promise;\n });\n try {\n for (const entry of map) {\n yield setupTimer(entry);\n }\n }\n catch (_a) {\n // Do nothing if an error occurs, this means the timer was cleaned up and we should stop processing\n }\n processingKey = undefined;\n });\n const reset = () => {\n processingKey = undefined;\n if (processingTimer !== undefined) {\n clearTimeout(processingTimer);\n processingTimer = undefined;\n }\n if (processingDeferred !== undefined) { // tslint:disable-line:early-exit\n processingDeferred.reject(undefined);\n processingDeferred = undefined;\n }\n };\n const originalSet = map.set.bind(map);\n map.set = (key, value) => {\n if (map.has(key)) {\n // If the key already exist, remove it so we can add it back at the end of the map.\n map.delete(key);\n }\n // Call the original `map.set`\n const result = originalSet(key, value);\n // If we are already processing a key and the key added is the current processed key, stop processing it\n if (processingKey && processingKey === key) {\n reset();\n }\n // Always run the cleanup method in case it wasn't started yet\n cleanup(); // tslint:disable-line:no-floating-promises\n return result;\n };\n cleanup(); // tslint:disable-line:no-floating-promises\n return map;\n}\nexports.default = mapAgeCleaner;\n// Add support for CJS\nmodule.exports = mapAgeCleaner;\nmodule.exports.default = mapAgeCleaner;\n","import mimicFn from 'mimic-fn';\nimport mapAgeCleaner from 'map-age-cleaner';\nconst cacheStore = new WeakMap();\n/**\n[Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input.\n\n@param fn - Function to be memoized.\n\n@example\n```\nimport mem from 'mem';\n\nlet index = 0;\nconst counter = () => ++index;\nconst memoized = mem(counter);\n\nmemoized('foo');\n//=> 1\n\n// Cached as it's the same argument\nmemoized('foo');\n//=> 1\n\n// Not cached anymore as the arguments changed\nmemoized('bar');\n//=> 2\n\nmemoized('bar');\n//=> 2\n```\n*/\nexport default function mem(fn, { cacheKey, cache = new Map(), maxAge, } = {}) {\n if (typeof maxAge === 'number') {\n mapAgeCleaner(cache);\n }\n const memoized = function (...arguments_) {\n const key = cacheKey ? cacheKey(arguments_) : arguments_[0];\n const cacheItem = cache.get(key);\n if (cacheItem) {\n return cacheItem.data; // eslint-disable-line @typescript-eslint/no-unsafe-return\n }\n const result = fn.apply(this, arguments_);\n cache.set(key, {\n data: result,\n maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY,\n });\n return result; // eslint-disable-line @typescript-eslint/no-unsafe-return\n };\n mimicFn(memoized, fn, {\n ignoreNonConfigurable: true,\n });\n cacheStore.set(memoized, cache);\n return memoized;\n}\n/**\n@returns A [decorator](https://github.com/tc39/proposal-decorators) to memoize class methods or static class methods.\n\n@example\n```\nimport {memDecorator} from 'mem';\n\nclass Example {\n index = 0\n\n @memDecorator()\n counter() {\n return ++this.index;\n }\n}\n\nclass ExampleWithOptions {\n index = 0\n\n @memDecorator({maxAge: 1000})\n counter() {\n return ++this.index;\n }\n}\n```\n*/\nexport function memDecorator(options = {}) {\n const instanceMap = new WeakMap();\n return (target, propertyKey, descriptor) => {\n const input = target[propertyKey]; // eslint-disable-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n if (typeof input !== 'function') {\n throw new TypeError('The decorated value must be a function');\n }\n delete descriptor.value;\n delete descriptor.writable;\n descriptor.get = function () {\n if (!instanceMap.has(this)) {\n const value = mem(input, options);\n instanceMap.set(this, value);\n return value;\n }\n return instanceMap.get(this);\n };\n };\n}\n/**\nClear all cached data of a memoized function.\n\n@param fn - Memoized function.\n*/\nexport function memClear(fn) {\n const cache = cacheStore.get(fn);\n if (!cache) {\n throw new TypeError('Can\\'t clear a function that was not memoized!');\n }\n if (typeof cache.clear !== 'function') {\n throw new TypeError('The cache Map can\\'t be cleared!');\n }\n cache.clear();\n}\n","import deepmerge from 'deepmerge';\nimport { noCase } from 'no-case';\nimport mem from 'mem';\nimport isObject from '../../utils/object/isObject.js';\n\n/**\n * @typedef {import('../index.js').BaseConfig} BaseConfig\n * @typedef {StringConstructor|NumberConstructor|BooleanConstructor|ArrayConstructor|ObjectConstructor} OptionType\n * @typedef {{ [name:string]: OptionType | { type: OptionType, default: String|Number|Boolean|(() => Array|Object)} }} OptionsSchema\n * @typedef {{ [optionName:string]: any }} OptionsInterface\n */\n\n/**\n * Get the attribute name based on the given option name.\n * @param {String} name The option name.\n */\nfunction getAttributeName(name) {\n return `data-option-${noCase(name, { delimiter: '-' })}`;\n}\n\nconst memoizedGetAttributeName = mem(getAttributeName);\n\n/**\n * Class options to manage options as data attributes on an HTML element.\n * @augments {OptionsInterface}\n */\nexport default class OptionsManager {\n /**\n * The HTML element holding the options attributes.\n * @type {HTMLElement}\n * @private\n */\n __element;\n\n /**\n * An object to store Array and Object values for reference.\n * @type {Object}\n * @private\n */\n __values = {};\n\n /**\n * List of allowed types.\n * @type {Array}\n * @private\n */\n static types = [String, Number, Boolean, Array, Object];\n\n /**\n * The default values to return for each available type.\n * @type {Object}\n * @private\n */\n __defaultValues = {\n String: '',\n Number: 0,\n Boolean: false,\n Array: () => [],\n Object: () => ({}),\n };\n\n /**\n * Default value for the name property.\n * @type {string}\n */\n name = 'Base';\n\n /**\n * Default value for the debug property.\n * @type {boolean}\n */\n debug = false;\n\n /**\n * Default value for the log property.\n * @type {Boolean}\n */\n log = false;\n\n /**\n * Class constructor.\n *\n * @param {HTMLElement} element The HTML element storing the options.\n * @param {OptionsSchema} schema A Base class config options.\n * @param {BaseConfig} baseConfig A Base class config.\n */\n constructor(element, schema, baseConfig) {\n this.__element = element;\n this.name = baseConfig.name;\n\n schema.debug = {\n type: Boolean,\n default: baseConfig.debug ?? false,\n };\n\n schema.log = {\n type: Boolean,\n default: baseConfig.log ?? false,\n };\n\n Object.entries(schema).forEach(([name, config]) => {\n const isObjectConfig = !OptionsManager.types.includes(config);\n /** @type {OptionType} */\n // @ts-ignore\n const type = isObjectConfig ? config.type : config;\n\n if (!OptionsManager.types.includes(type)) {\n throw new Error(\n `The \"${name}\" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`\n );\n }\n\n // @ts-ignore\n const defaultValue = isObjectConfig ? config.default : this.__defaultValues[type.name];\n\n if ((type === Array || type === Object) && typeof defaultValue !== 'function') {\n throw new Error(\n `The default value for options of type \"${type.name}\" must be returned by a function.`\n );\n }\n\n Object.defineProperty(this, name, {\n get: () => {\n return this.get(name, type, defaultValue);\n },\n set: (value) => {\n this.set(name, type, value, defaultValue);\n },\n enumerable: true,\n });\n });\n\n return this;\n }\n\n /**\n * Get an option value.\n *\n * @param {String} name The option name.\n * @param {ArrayConstructor|ObjectConstructor|StringConstructor|NumberConstructor|BooleanConstructor} type The option data's type.\n * @param {any} defaultValue The default value for this option.\n */\n get(name, type, defaultValue) {\n const attributeName = memoizedGetAttributeName(name);\n const hasAttribute = this.__element.hasAttribute(attributeName);\n\n if (type === Boolean) {\n if (defaultValue) {\n const negatedAttributeName = memoizedGetAttributeName(`no-${name}`);\n const hasNegatedAttribute = this.__element.hasAttribute(negatedAttributeName);\n\n return !hasNegatedAttribute;\n }\n\n return hasAttribute || defaultValue;\n }\n\n const value = this.__element.getAttribute(attributeName);\n\n if (type === Number) {\n return hasAttribute ? Number(value) : defaultValue;\n }\n\n if (type === Array || type === Object) {\n const val = deepmerge(\n defaultValue(),\n hasAttribute ? JSON.parse(value) : this.__defaultValues[type.name]()\n );\n\n if (!this.__values[name]) {\n this.__values[name] = val;\n } else if (val !== this.__values[name]) {\n // When getting the value, wait for the next loop to update the data attribute\n // with the new value. This is a simple trick to avoid using a Proxy to watch\n // for any deep changes on an array or object. It should not break anything as\n // the original value is read once from the data attribute and is then read from\n // the private property `__values`.\n setTimeout(() => {\n this.__element.setAttribute(attributeName, JSON.stringify(this.__values[name]));\n }, 0);\n }\n\n return this.__values[name];\n }\n\n return hasAttribute ? value : defaultValue;\n }\n\n /**\n * Set an option value.\n *\n * @param {String} name The option name.\n * @param {ArrayConstructor|ObjectConstructor|StringConstructor|NumberConstructor|BooleanConstructor} type The option data's type.\n * @param {any} value The new value for this option.\n */\n set(name, type, value, defaultValue) {\n const attributeName = memoizedGetAttributeName(name);\n\n if (value.constructor.name !== type.name) {\n const val = Array.isArray(value) || isObject(value) ? JSON.stringify(value) : value;\n throw new TypeError(\n `The \"${val}\" value for the \"${name}\" option must be of type \"${type.name}\"`\n );\n }\n\n switch (type) {\n case Boolean:\n if (defaultValue) {\n const negatedAttributeName = memoizedGetAttributeName(`no-${name}`);\n\n if (value) {\n this.__element.removeAttribute(negatedAttributeName);\n } else {\n this.__element.setAttribute(negatedAttributeName, '');\n }\n } else if (value) {\n this.__element.setAttribute(attributeName, '');\n } else {\n this.__element.removeAttribute(attributeName);\n }\n break;\n case Array:\n case Object:\n this.__values[name] = value;\n this.__element.setAttribute(attributeName, JSON.stringify(value));\n break;\n default:\n this.__element.setAttribute(attributeName, value);\n }\n }\n}\n","/**\n * Test if the given value is an object.\n *\n * @param {*} value The value to test.\n * @return {Boolean} Whether or not the value is an object.\n */\nexport default function isObject(value) {\n return typeof value === 'object' && !!value && value.toString() === '[object Object]';\n}\n","import autoBind from '../utils/object/autoBind.js';\nimport { callMethod, getComponentElements } from './utils.js';\nimport ChildrenManager from './managers/ChildrenManager.js';\nimport RefsManager from './managers/RefsManager.js';\nimport ServicesManager from './managers/ServicesManager.js';\nimport EventsManager from './managers/EventsManager.js';\nimport OptionsManager from './managers/OptionsManager.js';\n\nlet id = 0;\n\nconst noop = function noop() {};\n\n/**\n * @typedef {typeof Base} BaseComponent\n * @typedef {(Base) => Promise<BaseComponent | { default: BaseComponent }>} BaseAsyncComponent\n * @typedef {OptionsManager & { [name:string]: any }} BaseOptions\n * @typedef {{ [name:string]: HTMLElement | HTMLElement[] }} BaseRefs\n * @typedef {{ [nameOrSelector:string]: Base[] | Promise<Base>[] }} BaseChildren\n * @typedef {{ [nameOrSelector:string]: BaseComponent | BaseAsyncComponent }} BaseConfigComponents\n * @typedef {import('./managers/OptionsManager').OptionsSchema} BaseConfigOptions\n * @typedef {import('./managers/ServicesManager.js').ServiceName} ServiceName\n */\n\n/**\n * @typedef {Object} BaseConfig\n * @property {String} name\n * @property {Boolean} [debug]\n * @property {Boolean} [log]\n * @property {String[]} [refs]\n * @property {BaseConfigComponents} [components]\n * @property {BaseConfigOptions} [options]\n */\n\n/**\n * Base class to easily create components.\n *\n * @example\n * ```js\n * class Component extends Base {\n * static config = {\n * name: 'Component',\n * log: true,\n * };\n *\n * mounted() {\n * this.$log('Component is mounted!');\n * }\n * }\n *\n * class App extends Base {\n * static config = {\n * name: 'App',\n * components: {\n * Component,\n * },\n * };\n * }\n *\n * new App(document.body).$mount();\n * ```\n */\nexport default class Base {\n /**\n * The instance parent.\n * @type {Base}\n */\n $parent = null;\n\n /**\n * The instance id.\n * @type {string}\n */\n $id;\n\n /**\n * The root element.\n * @type {HTMLElement}\n */\n $el;\n\n /**\n * The state of the component.\n * @type {Boolean}\n */\n $isMounted = false;\n\n /**\n * This is a Base instance.\n * @type {Boolean}\n */\n static $isBase = true;\n\n /**\n * Get properties to exclude from the autobind call.\n * @return {Array<String|RegExp>}\n */\n get __excludeFromAutoBind() {\n return [\n '$mount',\n '$update',\n '$destroy',\n '$terminate',\n '$log',\n '$on',\n '$once',\n '$off',\n '$emit',\n 'mounted',\n 'loaded',\n 'ticked',\n 'resized',\n 'moved',\n 'keyed',\n 'scrolled',\n 'destroyed',\n 'terminated',\n ];\n }\n\n /**\n * Merge configuration with the parents' configurations.\n *\n * @return {BaseConfig}\n * @private\n */\n get __config() {\n let proto = Object.getPrototypeOf(this);\n let { config } = proto.constructor;\n\n while (proto.constructor.config && proto.constructor.$isBase) {\n config = {\n ...proto.constructor.config,\n ...config,\n };\n\n if (proto.constructor.config.options) {\n config.options = {\n ...proto.constructor.config.options,\n ...config.options,\n };\n }\n\n proto = Object.getPrototypeOf(proto);\n }\n\n return config;\n }\n\n /**\n * @type {BaseConfig}\n */\n static config;\n\n /**\n * @type {ServicesManager}\n */\n __services;\n\n /**\n * The instance services.\n * @type {ServicesManager}\n */\n get $services() {\n const services = this.__services;\n this.$emit('get:services', services);\n return services;\n }\n\n /**\n * @type {RefsManager}\n */\n __refs;\n\n /**\n * @return {RefsManager}\n */\n get $refs() {\n const refs = this.__refs;\n this.$emit('get:refs', refs);\n return refs;\n }\n\n /**\n * @type {BaseOptions}\n */\n __options;\n\n /**\n * @return {BaseOptions}\n */\n get $options() {\n const options = this.__options;\n this.$emit('get:options', options);\n return options;\n }\n\n /**\n * @type {ChildrenManager}\n */\n __children;\n\n /**\n * @return {ChildrenManager}\n */\n get $children() {\n this.__debug('before:getChildren', this.$el, this.__config.components);\n\n const children = this.__children;\n this.$emit('get:children', children);\n\n this.__debug(this, 'after:getChildren', children);\n\n return children;\n }\n\n /**\n * @type {EventsManager}\n */\n __events;\n\n /**\n * Small helper to log stuff.\n *\n * @return {(...args: any) => void}\n */\n get $log() {\n return this.__options.log ? window.console.log.bind(window, `[${this.__config.name}]`) : noop;\n }\n\n /**\n * Small helper to debug information.\n *\n * @return {(...args:any) => void}\n */\n get __debug() {\n return this.__options.debug && typeof window.__DEV__ !== 'undefined' && window.__DEV__\n ? window.console.log.bind(window, `[debug] [${this.$id}]`)\n : noop;\n }\n\n /**\n * Class constructor where all the magic takes place.\n *\n * @param {HTMLElement} element The component's root element dd.\n */\n constructor(element) {\n if (!element) {\n throw new Error('The root element must be defined.');\n }\n\n const { __config } = this;\n\n if (!__config) {\n throw new Error('The `config` static property must be defined.');\n }\n\n if (!__config.name) {\n throw new Error('The `config.name` property is required.');\n }\n\n this.$id = `${__config.name}-${id}`;\n id += 1;\n\n this.$el = element;\n\n if (!('__base__' in this.$el)) {\n Object.defineProperty(this.$el, '__base__', {\n get: () => this,\n configurable: true,\n });\n }\n\n this.__options = new OptionsManager(element, __config.options || {}, __config);\n this.__services = new ServicesManager(this);\n this.__events = new EventsManager(element, this);\n this.__children = new ChildrenManager(this, element, __config.components || {}, this.__events);\n this.__refs = new RefsManager(this, element, __config.refs || [], this.__events);\n\n // Autobind all methods to the instance\n // @todo Maybe remove for performance reason? This pattern can use a lot of memory when creating\n // a large number of instances.\n autoBind(this, {\n exclude: [...this.__excludeFromAutoBind],\n });\n\n this.__debug('constructor', this);\n\n return this;\n }\n\n /**\n * Trigger the `mounted` callback.\n */\n $mount() {\n this.__debug('$mount');\n\n this.$children.registerAll();\n this.$refs.registerAll();\n this.__events.bindRootElement();\n this.$services.enableAll();\n this.$children.mountAll();\n\n callMethod(this, 'mounted');\n this.$isMounted = true;\n return this;\n }\n\n /**\n * Update the instance children.\n */\n $update() {\n this.__debug('$update');\n\n // Undo\n this.$refs.unregisterAll();\n this.$services.disableAll();\n\n // Redo\n this.$children.registerAll();\n this.$refs.registerAll();\n this.$services.enableAll();\n\n // Update\n this.$children.updateAll();\n\n callMethod(this, 'updated');\n return this;\n }\n\n /**\n * Trigger the `destroyed` callback.\n */\n $destroy() {\n this.__debug('$destroy');\n\n this.__events.unbindRootElement();\n this.$refs.unregisterAll();\n this.$services.disableAll();\n this.$children.destroyAll();\n callMethod(this, 'destroyed');\n this.$isMounted = false;\n return this;\n }\n\n /**\n * Terminate a child instance when it is not needed anymore.\n * @return {void}\n */\n $terminate() {\n this.__debug('$terminate');\n\n // First, destroy the component.\n this.$destroy();\n\n // Execute the `terminated` hook if it exists\n callMethod(this, 'terminated');\n\n // Delete the reference to the instance\n // delete this.$el.__base__;\n\n // And update its status to prevent re-instantiation when accessing the\n // parent's `$children` property\n Object.defineProperty(this.$el, '__base__', {\n value: 'terminated',\n configurable: false,\n writable: false,\n });\n }\n\n /**\n * Factory method to generate multiple instance of the class.\n *\n * @param {String} nameOrSelector The selector on which to mount each instance.\n * @return {Array<Base>} A list of the created instance.\n */\n static $factory(nameOrSelector) {\n if (!nameOrSelector) {\n throw new Error(\n 'The $factory method requires a component’s name or selector to be specified.'\n );\n }\n\n return getComponentElements(nameOrSelector).map((el) => new this(el).$mount());\n }\n\n /**\n * Bind a listener function to an event.\n *\n * @param {string} event\n * Name of the event.\n * @param {EventListenerOrEventListenerObject} listener\n * Function to be called.\n * @param {boolean|AddEventListenerOptions} [options]\n * Options for the `removeEventListener` method.\n * @return {() => void}\n * A function to unbind the listener.\n */\n $on(event, listener, options) {\n this.__debug('$on', event, listener, options);\n\n this.$el.addEventListener(event, listener, options);\n\n return () => {\n this.$off(event, listener, options);\n };\n }\n\n /**\n * Unbind a listener function from an event.\n *\n * @param {string} event\n * Name of the event.\n * @param {EventListenerOrEventListenerObject} listener\n * Function to be removed.\n * @param {boolean|EventListenerOptions} [options]\n * Options for the `removeEventListener` method.\n *\n * @return {void}\n */\n $off(event, listener, options) {\n this.__debug('$off', event, listener);\n\n this.$el.removeEventListener(event, listener, options);\n }\n\n /**\n * Emits an event.\n *\n * @param {string} event\n * Name of the event.\n * @param {any[]} args The arguments to apply to the functions bound to this event.\n * @return {void}\n */\n $emit(event, ...args) {\n this.__debug('$emit', event, args);\n\n this.$el.dispatchEvent(\n new CustomEvent(event, {\n detail: args,\n })\n );\n }\n}\n","import getAllProperties from './getAllProperties.js';\n\n/**\n * Auto-bind methods to an instance.\n *\n * @param {Object} instance The instance.\n * @param {Object} options Define specific methods to include or exlude.\n * @param {Array<String|RegExp>} [options.include] Methods to include.\n * @param {Array<String|RegExp>} [options.exclude] Methods to exclude.\n * @return {Object} The instance.\n */\nexport default function autoBind(instance, options) {\n const { exclude, include } = options || {};\n const filter = (key) => {\n const match = (pattern) => (typeof pattern === 'string' ? key === pattern : pattern.test(key));\n\n if (include) {\n return include.some(match);\n }\n\n if (exclude) {\n return !exclude.some(match);\n }\n\n return true;\n };\n\n getAllProperties(instance)\n .filter(([key]) => key !== 'constructor' && filter(key))\n .forEach(([key, object]) => {\n const descriptor = Object.getOwnPropertyDescriptor(object, key);\n if (descriptor && typeof descriptor.value === 'function') {\n instance[key] = instance[key].bind(instance);\n }\n });\n\n return instance;\n}\n","/**\n * @typedef {import('../Base/index.js').BaseComponent} BaseComponent\n */\n\n/**\n * Instantiate and mount the given component on the given root element when the page has been loaded\n * and return a function to use the app instance when it is ready.\n *\n * @usage\n * ```js\n * // app.js\n * import Base, { createApp } from '@studiometa/js-toolkit';\n *\n * class App extends Base {\n * static config = {\n * name: 'App',\n * }\n * }\n *\n * export default createApp(App, document.body);\n * ```\n * ```js\n * // other.js\n * import useApp from './app.js';\n *\n * const app = await useApp();\n * console.log(app.$options.name); // 'App'\n * ```\n *\n * @template {BaseComponent} T\n * @param {T} App\n * @param {HTMLElement} rootElement\n *\n * @return {() => Promise<InstanceType<T>>}\n *\n */\nexport default function createApp(App, rootElement) {\n let isLoaded = document.readyState === 'complete';\n let app;\n\n if (!isLoaded) {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n app = new App(rootElement).$mount();\n isLoaded = true;\n }\n });\n } else {\n app = new App(rootElement).$mount();\n }\n\n return function useApp() {\n if (isLoaded) {\n return Promise.resolve(app);\n }\n\n return new Promise((resolve) => {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n setTimeout(() => resolve(app), 0);\n }\n });\n });\n };\n}\n","import Base from '../Base/index.js';\n\n/**\n * @typedef {import('../Base').BaseComponent} BaseComponent\n */\n\n/**\n * Define a component without a class.\n *\n * @param {Object} options The component's object\n * @return {BaseComponent} A component's class.\n */\nexport default function defineComponent(options) {\n const { config, methods, ...hooks } = options;\n\n if (!config) {\n throw new Error('The `config` property is required.');\n }\n\n if (!config.name) {\n throw new Error('The `config.name` property is required.');\n }\n\n /**\n * Component class.\n */\n class Component extends Base {\n /**\n * Component config.\n */\n static config = config;\n }\n\n const allowedHooks = [\n 'mounted',\n 'loaded',\n 'ticked',\n 'resized',\n 'moved',\n 'keyed',\n 'scrolled',\n 'destroyed',\n 'terminated',\n ];\n\n const filteredHooks = Object.entries(hooks).reduce((acc, [name, fn]) => {\n if (allowedHooks.includes(name)) {\n acc[name] = fn;\n } else {\n throw new Error(\n `\n The \"${name}\" method is not a Base lifecycle hook,\n it should be placed in the \"method\" property.\n The following hooks are available: ${allowedHooks.join(', ')}\n `\n );\n }\n\n return acc;\n }, {});\n\n [...Object.entries(methods || {}), ...Object.entries(filteredHooks)].forEach(([name, fn]) => {\n Component.prototype[name] = fn;\n });\n\n return Component;\n}\n","import defineComponent from './defineComponent.js';\n\n/**\n * Create a Base instance with the given object configuration.\n *\n * @param {HTMLElement|String} elementOrSelector The instance root HTML element.\n * @param {Object} options The Base class configuration.\n */\nexport default function createBase(elementOrSelector, options) {\n const Component = defineComponent(options);\n /** @type {HTMLElement} */\n const element =\n typeof elementOrSelector === 'string'\n ? document.querySelector(elementOrSelector)\n : elementOrSelector;\n return new Component(element);\n}\n","/* eslint-disable import/prefer-default-export */\nimport { getComponentElements } from '../Base/utils.js';\n\n/**\n * Get the target elements for the lazy import helper functions.\n *\n * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement\n * The original selector or element, or list of elements.\n * @param {HTMLElement=} [context]\n * The optional context to use to query for elements.\n *\n * @return {HTMLElement[]} A normalized list of elements.\n */\nexport function getTargetElements(nameOrSelectorOrElement, context) {\n if (typeof nameOrSelectorOrElement === 'string') {\n return getComponentElements(nameOrSelectorOrElement, context);\n }\n\n if (!Array.isArray(nameOrSelectorOrElement)) {\n return [nameOrSelectorOrElement];\n }\n\n return nameOrSelectorOrElement;\n}\n","import { getTargetElements } from './utils.js';\n\n/**\n * @typedef {import('../Base/index.js').BaseComponent} BaseComponent\n * @typedef {import('../Base/index.js').default} Base\n */\n\n/**\n * Import a component on an interaction.\n *\n * @template {BaseComponent} T\n *\n * @param {() => Promise<T|{default:T}>} fn\n * The import function.\n * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement\n * The name or selector for the component.\n * @param {string|string[]} events\n * The events to listen to to trigger the import.\n * @param {Base=} [parent]\n * The parent component.\n *\n * @return {Promise<T>}\n */\nexport default function importOnInteraction(fn, nameOrSelectorOrElement, events, parent) {\n const normalizedEvents = typeof events === 'string' ? [events] : events;\n\n let ResolvedClass;\n\n const resolver = (resolve) => {\n fn().then((module) => {\n ResolvedClass = 'default' in module ? module.default : module;\n resolve(ResolvedClass);\n });\n };\n\n return new Promise((resolve) => {\n const elements = getTargetElements(nameOrSelectorOrElement, parent?.$el);\n const eventListenerOptions = {\n capture: true,\n passive: true,\n once: true,\n };\n const handler = () => {\n resolver(resolve);\n };\n\n elements.forEach((element) => {\n normalizedEvents.forEach((event) => {\n element.addEventListener(event, handler, eventListenerOptions);\n });\n });\n });\n}\n","/**\n * @typedef {import('../Base/index.js').BaseComponent} BaseComponent\n * @typedef {{ timeout?: number }} ImportWhenIdleOptions\n */\n\n/**\n * Import a component when user is idle.\n *\n * @template {BaseComponent} T\n *\n * @param {() => Promise<T|{default:T}>} fn\n * The import function.\n * @param {ImportWhenIdleOptions=} [options]\n * The time to wait before triggering the callback if never idle.\n *\n * @return {Promise<T>}\n */\nexport default function importWhenIdle(fn, options) {\n let ResolvedClass;\n\n const resolver = (resolve) => {\n fn().then((module) => {\n ResolvedClass = 'default' in module ? module.default : module;\n resolve(ResolvedClass);\n });\n };\n\n return new Promise((resolve) => {\n const timeout = options?.timeout ?? 1;\n\n if (!('requestIdleCallback' in window)) {\n setTimeout(() => {\n resolver(resolve);\n }, timeout);\n } else {\n window.requestIdleCallback(\n () => {\n setTimeout(() => {\n resolver(resolve);\n }, 0);\n },\n { timeout: options?.timeout }\n );\n }\n });\n}\n","import { getTargetElements } from './utils.js';\n\n/**\n * @typedef {import('../Base/index.js').default} Base\n * @typedef {import('../Base/index.js').BaseComponent} BaseComponent\n */\n\n/**\n * Import a component when it is visible.\n *\n * @template {BaseComponent} T\n *\n * @param {() => Promise<T|{default:T}>} fn\n * The import function.\n * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement\n * The name or selector for the component.\n * @param {Base=} [parent]\n * The parent component.\n * @param {IntersectionObserverInit=} [observerOptions]\n * Options for the `IntersectionObserver` instance.\n *\n * @return {Promise<T>}\n */\nexport default function importWhenVisible(\n fn,\n nameOrSelectorOrElement,\n parent,\n observerOptions = {}\n) {\n let ResolvedClass;\n\n const resolver = (resolve, cb) => {\n fn().then((module) => {\n ResolvedClass = 'default' in module ? module.default : module;\n resolve(ResolvedClass);\n\n if (typeof cb === 'function') {\n cb();\n }\n });\n };\n\n return new Promise((resolve) => {\n const observer = new IntersectionObserver((entries) => {\n const someEntriesAreVisible = entries.some((entry) => entry.isIntersecting);\n if (someEntriesAreVisible) {\n setTimeout(() => {\n resolver(resolve, () => observer.disconnect());\n }, 0);\n }\n }, observerOptions);\n\n const elements = getTargetElements(nameOrSelectorOrElement, parent?.$el);\n elements.forEach((element) => observer.observe(element));\n });\n}\n"],"names":["getAllProperties","object","props","testFn","proto","Object","getPrototypeOf","prototype","foundProps","getOwnPropertyNames","filter","name","map","reduce","acc","val","hasMethod","obj","callMethod","instance","method","args","__debug","$isMounted","$emit","call","getComponentElements","nameOrSelector","element","document","selector","elements","Array","from","querySelectorAll","length","ChildrenManager","registeredNames","keys","this","key","startsWith","constructor","base","components","eventsManager","__base","__element","__components","__eventsManager","registerAll","entries","forEach","component","__register","defineProperty","enumerable","configurable","get","__getChild","el","ComponentClass","__base__","child","then","module","default","mountAll","__triggerHookForAll","updateAll","destroyAll","hook","Promise","resolvedInstance","__triggerHook","unbindChild","bindChild","RefsManager","refs","__refs","refName","unregisterAll","__unregister","isMultiple","endsWith","propName","normalizeRefName","ref","__filterRefsBelongingToInstance","console","warn","$options","bindRef","value","isArray","unbindRef","[object Object]","replace","ancestor","parentElement","undefined","dataset","Service","callbacks","Map","isInit","Error","init","kill","add","callback","has","size","set","remove","delete","trigger","isTouchEvent","event","TouchEvent","Pointer","isDown","y","window","innerHeight","yLast","x","innerWidth","xLast","hasRaf","documentElement","addEventListener","once","capture","options","passive","handleEvent","type","handler","downHandler","upHandler","removeEventListener","updateValues","touches","_event$touches$","clientY","_event$touches$2","clientX","changed","last","delta","progress","max","pointer","Raf","super","isTicking","id","raf","requestAnimationFrame","bind","setTimeout","cancelRaf","cancelAnimationFrame","clearTimeout","loop","time","performance","now","debounce","fn","delay","timeout","Resize","width","height","ratio","orientation","breakpointElement","breakpoint","breakpoints","querySelector","getComputedStyle","getPropertyValue","split","canUseResizeObserver","ResizeObserver","resize","Scroll","pageYOffset","pageXOffset","debouncedHandler","debounced","direction","scrollingElement","body","scrollWidth","scrollHeight","scroll","ENTER","SPACE","TAB","ESC","LEFT","UP","RIGHT","DOWN","Key","triggered","previousEvent","keyCodes","code","keyCode","isUp","Load","SERVICES_MAP","scrolled","resized","ticked","moved","keyed","loaded","ServicesManager","service","$id","enable","disable","self","enableAll","serviceName","disableAll","register","useFunction","unregister","EventsManager","rootElement","__methodsCache","WeakMap","__rootElementHandler","normalizeName","__refsHandler","currentTarget","index","$refs","indexOf","__childrenHandler","childName","childrenManager","$children","find","includes","detail","__rootElement","__manageRef","mode","action","__getEventMethodsByName","__getEventNameByMethod","__manageChild","__manageRootElement","modeMethod","bindRootElement","unbindRootElement","normalizedName","regex","RegExp","match","normalizeEventName","methods","test","push","c","toLowerCase","trim","toUpperCase","isMergeableObject","isNonNullObject","stringValue","toString","$$typeof","REACT_ELEMENT_TYPE","isReactElement","isSpecial","Symbol","for","cloneUnlessOtherwiseSpecified","clone","deepmerge","defaultArrayMerge","target","source","concat","getKeys","getOwnPropertySymbols","symbol","propertyIsEnumerable","getEnumerableOwnPropertySymbols","propertyIsOnObject","property","_","arrayMerge","sourceIsArray","destination","hasOwnProperty","propertyIsUnsafe","customMerge","getMergeFunction","mergeObject","all","array","prev","next","lowerCase","str","DEFAULT_SPLIT_REGEXP","DEFAULT_STRIP_REGEXP","input","re","copyProperty","to","ignoreNonConfigurable","toDescriptor","getOwnPropertyDescriptor","fromDescriptor","canCopyProperty","writable","wrappedToString","withName","fromBody","toStringDescriptor","Function","toStringName","ret","promise","resolve","reject","__awaiter","thisArg","_arguments","P","generator","fulfilled","step","e","rejected","result","done","apply","__importDefault","mod","__esModule","p_defer_1","require$$0","mapAgeCleaner","processingKey","processingTimer","processingDeferred","cleanup","setupTimer","item","Date","unref","entry","_a","originalSet","exports","cacheStore","memoizedGetAttributeName","cacheKey","cache","maxAge","memoized","arguments_","cacheItem","data","Number","POSITIVE_INFINITY","Reflect","ownKeys","fromPrototype","setPrototypeOf","changePrototype","newToString","changeToString","mimicFn","mem","splitRegexp","_b","stripRegexp","_c","transform","_d","delimiter","start","end","charAt","slice","join","noCase","OptionsManager","schema","baseConfig","__values","__defaultValues","String","Boolean","debug","log","config","isObjectConfig","types","defaultValue","attributeName","hasAttribute","negatedAttributeName","getAttribute","JSON","parse","setAttribute","stringify","isObject","TypeError","removeAttribute","noop","Base","__excludeFromAutoBind","__config","$isBase","$services","services","__services","__options","$el","children","__children","$log","__DEV__","$parent","__events","exclude","include","pattern","some","descriptor","autoBind","$mount","$update","$destroy","$terminate","$on","listener","$off","dispatchEvent","CustomEvent","createApp","App","app","isLoaded","readyState","defineComponent","hooks","Component","allowedHooks","filteredHooks","createBase","elementOrSelector","getTargetElements","nameOrSelectorOrElement","context","importOnInteraction","events","parent","normalizedEvents","ResolvedClass","eventListenerOptions","resolver","importWhenIdle","requestIdleCallback","importWhenVisible","observerOptions","observer","IntersectionObserver","isIntersecting","cb","disconnect","observe"],"mappings":"wNAUwBA,EAAiBC,EAAQC,EAAQ,GAAIC,EAAS,MACpE,MAAMC,EAAQC,OAAOC,eAAeL,GAEpC,GAAIG,IAAUC,OAAOE,UACnB,OAAOL,EAGT,IAAIM,E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