@studiometa/js-toolkit 2.12.1 → 3.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 (383) hide show
  1. package/Base/Base.d.ts +8 -8
  2. package/Base/Base.js +75 -78
  3. package/Base/Base.js.map +2 -2
  4. package/Base/features.d.ts +15 -2
  5. package/Base/features.js +31 -1
  6. package/Base/features.js.map +2 -2
  7. package/Base/index.d.ts +1 -0
  8. package/Base/index.js +4 -0
  9. package/Base/index.js.map +2 -2
  10. package/Base/managers/AbstractManager.d.ts +1 -1
  11. package/Base/managers/ChildrenManager.d.ts +6 -6
  12. package/Base/managers/ChildrenManager.js +34 -20
  13. package/Base/managers/ChildrenManager.js.map +2 -2
  14. package/Base/managers/EventsManager.d.ts +6 -28
  15. package/Base/managers/EventsManager.js +54 -64
  16. package/Base/managers/EventsManager.js.map +2 -2
  17. package/Base/managers/OptionsManager.d.ts +6 -6
  18. package/Base/managers/OptionsManager.js +29 -23
  19. package/Base/managers/OptionsManager.js.map +3 -3
  20. package/Base/managers/RefsManager.d.ts +1 -1
  21. package/Base/managers/RefsManager.js +23 -34
  22. package/Base/managers/RefsManager.js.map +3 -3
  23. package/Base/managers/ResponsiveOptionsManager.js +7 -4
  24. package/Base/managers/ResponsiveOptionsManager.js.map +2 -2
  25. package/Base/managers/ServicesManager.d.ts +2 -4
  26. package/Base/managers/ServicesManager.js +2 -3
  27. package/Base/managers/ServicesManager.js.map +2 -2
  28. package/Base/utils.d.ts +10 -5
  29. package/Base/utils.js +37 -23
  30. package/Base/utils.js.map +2 -2
  31. package/README.md +107 -6
  32. package/decorators/index.d.ts +1 -1
  33. package/decorators/index.js +1 -1
  34. package/decorators/index.js.map +1 -1
  35. package/decorators/withBreakpointManager.js +6 -4
  36. package/decorators/withBreakpointManager.js.map +2 -2
  37. package/decorators/withBreakpointObserver.d.ts +0 -1
  38. package/decorators/withBreakpointObserver.js +5 -3
  39. package/decorators/withBreakpointObserver.js.map +2 -2
  40. package/decorators/withIntersectionObserver.js +3 -5
  41. package/decorators/withIntersectionObserver.js.map +2 -2
  42. package/decorators/withMountOnMediaQuery.js +3 -3
  43. package/decorators/withMountOnMediaQuery.js.map +2 -2
  44. package/decorators/withMountWhenInView.js +3 -3
  45. package/decorators/withMountWhenInView.js.map +2 -2
  46. package/decorators/withName.d.ts +6 -0
  47. package/decorators/withName.js +12 -0
  48. package/decorators/withName.js.map +7 -0
  49. package/decorators/withScrolledInView/utils.d.ts +12 -1
  50. package/decorators/withScrolledInView/utils.js.map +2 -2
  51. package/decorators/withScrolledInView/withScrolledInView.js +7 -62
  52. package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
  53. package/helpers/createApp.d.ts +3 -4
  54. package/helpers/createApp.js +21 -11
  55. package/helpers/createApp.js.map +2 -2
  56. package/helpers/getDirectChildren.js +10 -5
  57. package/helpers/getDirectChildren.js.map +2 -2
  58. package/helpers/importWhenVisible.js +1 -2
  59. package/helpers/importWhenVisible.js.map +1 -1
  60. package/index.d.ts +2 -3
  61. package/index.js +2 -4
  62. package/index.js.map +2 -2
  63. package/package.json +2 -10
  64. package/services/index.d.ts +1 -1
  65. package/services/index.js.map +2 -2
  66. package/services/pointer.d.ts +1 -1
  67. package/services/pointer.js +3 -3
  68. package/services/pointer.js.map +2 -2
  69. package/services/raf.js +2 -4
  70. package/services/raf.js.map +2 -2
  71. package/services/resize.d.ts +7 -6
  72. package/services/resize.js +18 -26
  73. package/services/resize.js.map +2 -2
  74. package/services/scroll.d.ts +14 -0
  75. package/services/scroll.js +39 -21
  76. package/services/scroll.js.map +2 -2
  77. package/utils/SmartQueue.d.ts +1 -1
  78. package/utils/SmartQueue.js +1 -1
  79. package/utils/SmartQueue.js.map +2 -2
  80. package/utils/css/animate.d.ts +33 -15
  81. package/utils/css/animate.js +67 -26
  82. package/utils/css/animate.js.map +2 -2
  83. package/utils/css/getOffsetSizes.js +2 -2
  84. package/utils/css/getOffsetSizes.js.map +1 -1
  85. package/utils/css/index.d.ts +2 -1
  86. package/utils/css/index.js +4 -4
  87. package/utils/css/index.js.map +2 -2
  88. package/utils/css/matrix.d.ts +1 -1
  89. package/utils/css/matrix.js.map +2 -2
  90. package/utils/css/transform.d.ts +1 -1
  91. package/utils/css/transform.js +1 -1
  92. package/utils/css/transform.js.map +2 -2
  93. package/utils/css/utils.d.ts +1 -1
  94. package/utils/css/utils.js +1 -1
  95. package/utils/css/utils.js.map +2 -2
  96. package/utils/index.d.ts +6 -4
  97. package/utils/index.js +17 -16
  98. package/utils/index.js.map +2 -2
  99. package/utils/is.d.ts +12 -0
  100. package/utils/is.js +17 -0
  101. package/utils/is.js.map +2 -2
  102. package/utils/math/createRange.d.ts +4 -0
  103. package/utils/math/createRange.js +13 -0
  104. package/utils/math/createRange.js.map +7 -0
  105. package/utils/math/ease.d.ts +1 -0
  106. package/utils/math/ease.js +2 -0
  107. package/utils/math/ease.js.map +2 -2
  108. package/utils/math/index.d.ts +5 -3
  109. package/utils/math/index.js +7 -3
  110. package/utils/math/index.js.map +2 -2
  111. package/utils/math/mean.d.ts +1 -0
  112. package/utils/math/mean.js +17 -0
  113. package/utils/math/mean.js.map +7 -0
  114. package/utils/memo.d.ts +5 -0
  115. package/utils/memo.js +14 -0
  116. package/utils/memo.js.map +7 -0
  117. package/utils/nextFrame.d.ts +4 -22
  118. package/utils/nextFrame.js +3 -10
  119. package/utils/nextFrame.js.map +2 -2
  120. package/utils/nextMicrotask.d.ts +4 -1
  121. package/utils/nextMicrotask.js +3 -3
  122. package/utils/nextMicrotask.js.map +2 -2
  123. package/utils/nextTick.d.ts +4 -1
  124. package/utils/nextTick.js +3 -3
  125. package/utils/nextTick.js.map +2 -2
  126. package/utils/random.d.ts +15 -0
  127. package/utils/random.js +15 -0
  128. package/utils/random.js.map +7 -0
  129. package/utils/scrollTo.d.ts +30 -6
  130. package/utils/scrollTo.js +97 -43
  131. package/utils/scrollTo.js.map +2 -2
  132. package/utils/string/changeCase.d.ts +24 -0
  133. package/utils/string/changeCase.js +47 -0
  134. package/utils/string/changeCase.js.map +7 -0
  135. package/utils/string/index.d.ts +1 -0
  136. package/utils/string/index.js +1 -0
  137. package/utils/string/index.js.map +2 -2
  138. package/utils/{focusTrap.d.ts → trapFocus.d.ts} +2 -10
  139. package/utils/{focusTrap.js → trapFocus.js} +5 -9
  140. package/utils/trapFocus.js.map +7 -0
  141. package/utils/tween.d.ts +59 -10
  142. package/utils/tween.js +24 -18
  143. package/utils/tween.js.map +2 -2
  144. package/Base/Base.cjs +0 -420
  145. package/Base/Base.cjs.map +0 -7
  146. package/Base/features.cjs +0 -27
  147. package/Base/features.cjs.map +0 -7
  148. package/Base/index.cjs +0 -21
  149. package/Base/index.cjs.map +0 -7
  150. package/Base/managers/AbstractManager.cjs +0 -78
  151. package/Base/managers/AbstractManager.cjs.map +0 -7
  152. package/Base/managers/ChildrenManager.cjs +0 -156
  153. package/Base/managers/ChildrenManager.cjs.map +0 -7
  154. package/Base/managers/EventsManager.cjs +0 -305
  155. package/Base/managers/EventsManager.cjs.map +0 -7
  156. package/Base/managers/OptionsManager.cjs +0 -198
  157. package/Base/managers/OptionsManager.cjs.map +0 -7
  158. package/Base/managers/RefsManager.cjs +0 -118
  159. package/Base/managers/RefsManager.cjs.map +0 -7
  160. package/Base/managers/ResponsiveOptionsManager.cjs +0 -79
  161. package/Base/managers/ResponsiveOptionsManager.cjs.map +0 -7
  162. package/Base/managers/ServicesManager.cjs +0 -161
  163. package/Base/managers/ServicesManager.cjs.map +0 -7
  164. package/Base/managers/index.cjs +0 -39
  165. package/Base/managers/index.cjs.map +0 -7
  166. package/Base/types.cjs +0 -19
  167. package/Base/types.cjs.map +0 -7
  168. package/Base/utils.cjs +0 -95
  169. package/Base/utils.cjs.map +0 -7
  170. package/decorators/index.cjs +0 -33
  171. package/decorators/index.cjs.map +0 -7
  172. package/decorators/withBreakpointManager.cjs +0 -102
  173. package/decorators/withBreakpointManager.cjs.map +0 -7
  174. package/decorators/withBreakpointObserver.cjs +0 -128
  175. package/decorators/withBreakpointObserver.cjs.map +0 -7
  176. package/decorators/withDrag.cjs +0 -56
  177. package/decorators/withDrag.cjs.map +0 -7
  178. package/decorators/withExtraConfig.cjs +0 -50
  179. package/decorators/withExtraConfig.cjs.map +0 -7
  180. package/decorators/withFreezedOptions.cjs +0 -50
  181. package/decorators/withFreezedOptions.cjs.map +0 -7
  182. package/decorators/withIntersectionObserver.cjs +0 -71
  183. package/decorators/withIntersectionObserver.cjs.map +0 -7
  184. package/decorators/withMountOnMediaQuery.cjs +0 -86
  185. package/decorators/withMountOnMediaQuery.cjs.map +0 -7
  186. package/decorators/withMountWhenInView.cjs +0 -92
  187. package/decorators/withMountWhenInView.cjs.map +0 -7
  188. package/decorators/withMountWhenPrefersMotion.cjs +0 -30
  189. package/decorators/withMountWhenPrefersMotion.cjs.map +0 -7
  190. package/decorators/withRelativePointer.cjs +0 -56
  191. package/decorators/withRelativePointer.cjs.map +0 -7
  192. package/decorators/withResponsiveOptions.cjs +0 -41
  193. package/decorators/withResponsiveOptions.cjs.map +0 -7
  194. package/decorators/withScrolledInView/index.cjs +0 -22
  195. package/decorators/withScrolledInView/index.cjs.map +0 -7
  196. package/decorators/withScrolledInView/types.cjs +0 -19
  197. package/decorators/withScrolledInView/types.cjs.map +0 -7
  198. package/decorators/withScrolledInView/utils.cjs +0 -99
  199. package/decorators/withScrolledInView/utils.cjs.map +0 -7
  200. package/decorators/withScrolledInView/withScrolledInView.cjs +0 -249
  201. package/decorators/withScrolledInView/withScrolledInView.cjs.map +0 -7
  202. package/decorators/withVue2.cjs +0 -68
  203. package/decorators/withVue2.cjs.map +0 -7
  204. package/decorators/withVue2.d.ts +0 -16
  205. package/decorators/withVue2.js +0 -46
  206. package/decorators/withVue2.js.map +0 -7
  207. package/helpers/createApp.cjs +0 -58
  208. package/helpers/createApp.cjs.map +0 -7
  209. package/helpers/getClosestParent.cjs +0 -45
  210. package/helpers/getClosestParent.cjs.map +0 -7
  211. package/helpers/getDirectChildren.cjs +0 -47
  212. package/helpers/getDirectChildren.cjs.map +0 -7
  213. package/helpers/getInstanceFromElement.cjs +0 -32
  214. package/helpers/getInstanceFromElement.cjs.map +0 -7
  215. package/helpers/importOnInteraction.cjs +0 -48
  216. package/helpers/importOnInteraction.cjs.map +0 -7
  217. package/helpers/importOnMediaQuery.cjs +0 -44
  218. package/helpers/importOnMediaQuery.cjs.map +0 -7
  219. package/helpers/importWhenIdle.cjs +0 -46
  220. package/helpers/importWhenIdle.cjs.map +0 -7
  221. package/helpers/importWhenPrefersMotion.cjs +0 -40
  222. package/helpers/importWhenPrefersMotion.cjs.map +0 -7
  223. package/helpers/importWhenVisible.cjs +0 -44
  224. package/helpers/importWhenVisible.cjs.map +0 -7
  225. package/helpers/index.cjs +0 -53
  226. package/helpers/index.cjs.map +0 -7
  227. package/helpers/utils.cjs +0 -37
  228. package/helpers/utils.cjs.map +0 -7
  229. package/index.cjs +0 -31
  230. package/index.cjs.map +0 -7
  231. package/services/drag.cjs +0 -231
  232. package/services/drag.cjs.map +0 -7
  233. package/services/index.cjs +0 -51
  234. package/services/index.cjs.map +0 -7
  235. package/services/key.cjs +0 -97
  236. package/services/key.cjs.map +0 -7
  237. package/services/load.cjs +0 -60
  238. package/services/load.cjs.map +0 -7
  239. package/services/pointer.cjs +0 -145
  240. package/services/pointer.cjs.map +0 -7
  241. package/services/raf.cjs +0 -80
  242. package/services/raf.cjs.map +0 -7
  243. package/services/resize.cjs +0 -107
  244. package/services/resize.cjs.map +0 -7
  245. package/services/scroll.cjs +0 -119
  246. package/services/scroll.cjs.map +0 -7
  247. package/services/service.cjs +0 -69
  248. package/services/service.cjs.map +0 -7
  249. package/utils/Queue.cjs +0 -93
  250. package/utils/Queue.cjs.map +0 -7
  251. package/utils/SmartQueue.cjs +0 -73
  252. package/utils/SmartQueue.cjs.map +0 -7
  253. package/utils/collide/boundingRectToCircle.cjs +0 -36
  254. package/utils/collide/boundingRectToCircle.cjs.map +0 -7
  255. package/utils/collide/collideCircleCircle.cjs +0 -35
  256. package/utils/collide/collideCircleCircle.cjs.map +0 -7
  257. package/utils/collide/collideCircleRect.cjs +0 -47
  258. package/utils/collide/collideCircleRect.cjs.map +0 -7
  259. package/utils/collide/collidePointCircle.cjs +0 -32
  260. package/utils/collide/collidePointCircle.cjs.map +0 -7
  261. package/utils/collide/collidePointRect.cjs +0 -32
  262. package/utils/collide/collidePointRect.cjs.map +0 -7
  263. package/utils/collide/collideRectRect.cjs +0 -32
  264. package/utils/collide/collideRectRect.cjs.map +0 -7
  265. package/utils/collide/index.cjs +0 -47
  266. package/utils/collide/index.cjs.map +0 -7
  267. package/utils/css/animate.cjs +0 -202
  268. package/utils/css/animate.cjs.map +0 -7
  269. package/utils/css/classes.cjs +0 -51
  270. package/utils/css/classes.cjs.map +0 -7
  271. package/utils/css/getOffsetSizes.cjs +0 -48
  272. package/utils/css/getOffsetSizes.cjs.map +0 -7
  273. package/utils/css/index.cjs +0 -52
  274. package/utils/css/index.cjs.map +0 -7
  275. package/utils/css/matrix.cjs +0 -30
  276. package/utils/css/matrix.cjs.map +0 -7
  277. package/utils/css/styles.cjs +0 -45
  278. package/utils/css/styles.cjs.map +0 -7
  279. package/utils/css/transform.cjs +0 -91
  280. package/utils/css/transform.cjs.map +0 -7
  281. package/utils/css/transition.cjs +0 -145
  282. package/utils/css/transition.cjs.map +0 -7
  283. package/utils/css/utils.cjs +0 -32
  284. package/utils/css/utils.cjs.map +0 -7
  285. package/utils/debounce.cjs +0 -35
  286. package/utils/debounce.cjs.map +0 -7
  287. package/utils/dom/ancestors.cjs +0 -37
  288. package/utils/dom/ancestors.cjs.map +0 -7
  289. package/utils/dom/index.cjs +0 -21
  290. package/utils/dom/index.cjs.map +0 -7
  291. package/utils/focusTrap.cjs +0 -93
  292. package/utils/focusTrap.cjs.map +0 -7
  293. package/utils/focusTrap.js.map +0 -7
  294. package/utils/getComponentResolver.cjs +0 -38
  295. package/utils/getComponentResolver.cjs.map +0 -7
  296. package/utils/has.cjs +0 -29
  297. package/utils/has.cjs.map +0 -7
  298. package/utils/history.cjs +0 -92
  299. package/utils/history.cjs.map +0 -7
  300. package/utils/index.cjs +0 -76
  301. package/utils/index.cjs.map +0 -7
  302. package/utils/is.cjs +0 -41
  303. package/utils/is.cjs.map +0 -7
  304. package/utils/keyCodes.cjs +0 -36
  305. package/utils/keyCodes.cjs.map +0 -7
  306. package/utils/math/clamp.cjs +0 -29
  307. package/utils/math/clamp.cjs.map +0 -7
  308. package/utils/math/clamp01.cjs +0 -40
  309. package/utils/math/clamp01.cjs.map +0 -7
  310. package/utils/math/createEases.cjs +0 -33
  311. package/utils/math/createEases.cjs.map +0 -7
  312. package/utils/math/damp.cjs +0 -29
  313. package/utils/math/damp.cjs.map +0 -7
  314. package/utils/math/ease.cjs +0 -82
  315. package/utils/math/ease.cjs.map +0 -7
  316. package/utils/math/index.cjs +0 -54
  317. package/utils/math/index.cjs.map +0 -7
  318. package/utils/math/inertiaFinalValue.cjs +0 -47
  319. package/utils/math/inertiaFinalValue.cjs.map +0 -7
  320. package/utils/math/lerp.cjs +0 -29
  321. package/utils/math/lerp.cjs.map +0 -7
  322. package/utils/math/map.cjs +0 -29
  323. package/utils/math/map.cjs.map +0 -7
  324. package/utils/math/round.cjs +0 -29
  325. package/utils/math/round.cjs.map +0 -7
  326. package/utils/memoize.cjs +0 -48
  327. package/utils/memoize.cjs.map +0 -7
  328. package/utils/nextFrame.cjs +0 -41
  329. package/utils/nextFrame.cjs.map +0 -7
  330. package/utils/nextMicrotask.cjs +0 -30
  331. package/utils/nextMicrotask.cjs.map +0 -7
  332. package/utils/nextTick.cjs +0 -31
  333. package/utils/nextTick.cjs.map +0 -7
  334. package/utils/noop.cjs +0 -32
  335. package/utils/noop.cjs.map +0 -7
  336. package/utils/object/autoBind.cjs +0 -60
  337. package/utils/object/autoBind.cjs.map +0 -7
  338. package/utils/object/autoBind.d.ts +0 -14
  339. package/utils/object/autoBind.js +0 -28
  340. package/utils/object/autoBind.js.map +0 -7
  341. package/utils/object/getAllProperties.cjs +0 -39
  342. package/utils/object/getAllProperties.cjs.map +0 -7
  343. package/utils/object/index.cjs +0 -39
  344. package/utils/object/index.cjs.map +0 -7
  345. package/utils/object/index.d.ts +0 -2
  346. package/utils/object/index.js +0 -7
  347. package/utils/object/index.js.map +0 -7
  348. package/utils/scheduler.cjs +0 -75
  349. package/utils/scheduler.cjs.map +0 -7
  350. package/utils/scrollTo.cjs +0 -88
  351. package/utils/scrollTo.cjs.map +0 -7
  352. package/utils/string/endsWith.cjs +0 -35
  353. package/utils/string/endsWith.cjs.map +0 -7
  354. package/utils/string/index.cjs +0 -58
  355. package/utils/string/index.cjs.map +0 -7
  356. package/utils/string/startsWith.cjs +0 -35
  357. package/utils/string/startsWith.cjs.map +0 -7
  358. package/utils/string/withLeadingCharacters.cjs +0 -40
  359. package/utils/string/withLeadingCharacters.cjs.map +0 -7
  360. package/utils/string/withLeadingSlash.cjs +0 -40
  361. package/utils/string/withLeadingSlash.cjs.map +0 -7
  362. package/utils/string/withTrailingCharacters.cjs +0 -40
  363. package/utils/string/withTrailingCharacters.cjs.map +0 -7
  364. package/utils/string/withTrailingSlash.cjs +0 -40
  365. package/utils/string/withTrailingSlash.cjs.map +0 -7
  366. package/utils/string/withoutLeadingCharacters.cjs +0 -29
  367. package/utils/string/withoutLeadingCharacters.cjs.map +0 -7
  368. package/utils/string/withoutLeadingCharactersRecursive.cjs +0 -45
  369. package/utils/string/withoutLeadingCharactersRecursive.cjs.map +0 -7
  370. package/utils/string/withoutLeadingSlash.cjs +0 -40
  371. package/utils/string/withoutLeadingSlash.cjs.map +0 -7
  372. package/utils/string/withoutTrailingCharacters.cjs +0 -29
  373. package/utils/string/withoutTrailingCharacters.cjs.map +0 -7
  374. package/utils/string/withoutTrailingCharactersRecursive.cjs +0 -45
  375. package/utils/string/withoutTrailingCharactersRecursive.cjs.map +0 -7
  376. package/utils/string/withoutTrailingSlash.cjs +0 -40
  377. package/utils/string/withoutTrailingSlash.cjs.map +0 -7
  378. package/utils/throttle.cjs +0 -37
  379. package/utils/throttle.cjs.map +0 -7
  380. package/utils/tween.cjs +0 -122
  381. package/utils/tween.cjs.map +0 -7
  382. package/utils/wait.cjs +0 -31
  383. package/utils/wait.cjs.map +0 -7
@@ -1,39 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/Base/managers/index.ts
20
- var managers_exports = {};
21
- __export(managers_exports, {
22
- AbstractManager: () => import_AbstractManager.AbstractManager,
23
- ChildrenManager: () => import_ChildrenManager.ChildrenManager,
24
- EventsManager: () => import_EventsManager.EventsManager,
25
- OptionsManager: () => import_OptionsManager.OptionsManager,
26
- RefsManager: () => import_RefsManager.RefsManager,
27
- ResponsiveOptionsManager: () => import_ResponsiveOptionsManager.ResponsiveOptionsManager,
28
- ServicesManager: () => import_ServicesManager.ServicesManager
29
- });
30
- module.exports = __toCommonJS(managers_exports);
31
- var import_AbstractManager = require("./AbstractManager.cjs");
32
- var import_ChildrenManager = require("./ChildrenManager.cjs");
33
- var import_EventsManager = require("./EventsManager.cjs");
34
- var import_OptionsManager = require("./OptionsManager.cjs");
35
- var import_RefsManager = require("./RefsManager.cjs");
36
- var import_ResponsiveOptionsManager = require("./ResponsiveOptionsManager.cjs");
37
- var import_ServicesManager = require("./ServicesManager.cjs");
38
- if (module.exports.default) module.exports = module.exports.default;
39
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/Base/managers/index.ts"],
4
- "sourcesContent": ["export { AbstractManager } from './AbstractManager.js';\nexport { ChildrenManager } from './ChildrenManager.js';\nexport { EventsManager } from './EventsManager.js';\nexport { OptionsManager } from './OptionsManager.js';\nexport { RefsManager } from './RefsManager.js';\nexport { ResponsiveOptionsManager } from './ResponsiveOptionsManager.js';\nexport { ServicesManager } from './ServicesManager.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAgC;AAChC,6BAAgC;AAChC,2BAA8B;AAC9B,4BAA+B;AAC/B,yBAA4B;AAC5B,sCAAyC;AACzC,6BAAgC;",
6
- "names": []
7
- }
package/Base/types.cjs DELETED
@@ -1,19 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // packages/js-toolkit/Base/types.ts
16
- var types_exports = {};
17
- module.exports = __toCommonJS(types_exports);
18
- if (module.exports.default) module.exports = module.exports.default;
19
- //# sourceMappingURL=types.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/Base/types.ts"],
4
- "sourcesContent": ["import type { Base, BaseProps } from './index.js';\nimport type {\n KeyServiceProps,\n LoadServiceProps,\n PointerServiceProps,\n RafServiceProps,\n ResizeServiceProps,\n ScrollServiceProps,\n} from '../services/index.js';\n\nexport interface BaseInterface {\n /**\n * Mounted hook.\n */\n mounted?(): void;\n /**\n * Updated hook.\n */\n updated?(): void;\n /**\n * Destroyed hook.\n */\n destroyed?(): void;\n /**\n * Terminated hook.\n */\n terminated?(): void;\n /**\n * Key service, executed when a keyboard key is pressed or released.\n */\n keyed?(props: KeyServiceProps): void;\n /**\n * Load service, executed when the window `load` event is fired.\n */\n loaded?(props: LoadServiceProps): void;\n /**\n * Pointer service, executed when the pointer is moving, pressed or released.\n */\n moved?(props: PointerServiceProps): void;\n /**\n * Raf service, executed on each rendered frame.\n */\n ticked?(props: RafServiceProps): void;\n /**\n * Resize service, executed when the window is resized.\n */\n resized?(props: ResizeServiceProps): void;\n /**\n * Scroll service, executed when the document is scrolled.\n */\n scrolled?(props: ScrollServiceProps): void;\n}\n\nexport type BaseDecorator<\n S extends BaseInterface,\n T extends Base,\n U extends BaseProps = BaseProps,\n> = {\n new <W extends BaseProps = BaseProps>(...args: unknown[]): S & T & Base<W & U>;\n} & Partial<Pick<T, keyof T>> &\n Pick<typeof Base, keyof typeof Base>;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;",
6
- "names": []
7
- }
package/Base/utils.cjs DELETED
@@ -1,95 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/Base/utils.ts
20
- var utils_exports = {};
21
- __export(utils_exports, {
22
- addToQueue: () => addToQueue,
23
- eventIsDefinedInConfig: () => eventIsDefinedInConfig,
24
- eventIsNative: () => eventIsNative,
25
- getComponentElements: () => getComponentElements,
26
- getEventTarget: () => getEventTarget
27
- });
28
- module.exports = __toCommonJS(utils_exports);
29
- var import_utils = require("../utils/index.cjs");
30
- var import_features = require("./features.cjs");
31
- var queue;
32
- function addToQueue(fn) {
33
- if (!import_features.features.get("asyncChildren")) {
34
- fn();
35
- return;
36
- }
37
- if (!queue) {
38
- queue = new import_utils.SmartQueue();
39
- }
40
- queue.add(fn);
41
- }
42
- var selectors = /* @__PURE__ */ new Map();
43
- var separator = " ";
44
- function getSelector(nameOrSelector) {
45
- if (!selectors.has(nameOrSelector)) {
46
- const parts = [
47
- // Single selector
48
- `[data-component="${nameOrSelector}"]`,
49
- // Selector in the middle of a list of selectors
50
- `[data-component*="${separator}${nameOrSelector}${separator}"]`,
51
- // Selector at the end of a list of selectors
52
- `[data-component$="${separator}${nameOrSelector}"]`,
53
- // Selector at the beginning of a list of selectors
54
- `[data-component^="${nameOrSelector}${separator}"]`
55
- ];
56
- selectors.set(nameOrSelector, parts.join(","));
57
- }
58
- return selectors.get(nameOrSelector);
59
- }
60
- function getComponentElements(nameOrSelector, element = document) {
61
- const selector = getSelector(nameOrSelector);
62
- let elements = [];
63
- try {
64
- elements = Array.from(element.querySelectorAll(selector));
65
- } catch {
66
- }
67
- if (elements.length === 0) {
68
- elements = Array.from(element.querySelectorAll(nameOrSelector));
69
- }
70
- return elements;
71
- }
72
- function eventIsDefinedInConfig(event, config) {
73
- return (0, import_utils.isArray)(config.emits) && config.emits.includes(event);
74
- }
75
- function eventIsNative(event, element) {
76
- return (0, import_utils.isDefined)(element[`on${event}`]);
77
- }
78
- function getEventTarget(instance, event, config) {
79
- if (eventIsDefinedInConfig(event, config)) {
80
- return instance;
81
- }
82
- if (eventIsNative(event, instance.$el)) {
83
- return instance.$el;
84
- }
85
- if (import_utils.isDev) {
86
- console.warn(
87
- `[${config.name}]`,
88
- `The "${event}" event is missing from the configuration and is not a native`,
89
- `event for the root element of type \`${instance.$el.constructor.name}\`.`
90
- );
91
- }
92
- return instance;
93
- }
94
- if (module.exports.default) module.exports = module.exports.default;
95
- //# sourceMappingURL=utils.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/Base/utils.ts"],
4
- "sourcesContent": ["import { isArray, isDefined, isDev, SmartQueue } from '../utils/index.js';\nimport type { Base, BaseConfig } from './index.js';\nimport { features } from './features.js';\n\nlet queue: SmartQueue;\n\n/**\n * Add a task to the main queue.\n */\nexport function addToQueue(fn: () => unknown): void {\n if (!features.get('asyncChildren')) {\n fn();\n return;\n }\n\n if (!queue) {\n queue = new SmartQueue();\n }\n\n queue.add(fn);\n}\n\nconst selectors = new Map();\n\n// Separator used for multi-component declaration in `data-component` attributeS.\nconst separator = ' ';\n\n/**\n * Get the selector for a given component.\n */\nfunction getSelector(nameOrSelector: string): string {\n if (!selectors.has(nameOrSelector)) {\n const parts = [\n // Single selector\n `[data-component=\"${nameOrSelector}\"]`,\n // Selector in the middle of a list of selectors\n `[data-component*=\"${separator}${nameOrSelector}${separator}\"]`,\n // Selector at the end of a list of selectors\n `[data-component$=\"${separator}${nameOrSelector}\"]`,\n // Selector at the beginning of a list of selectors\n `[data-component^=\"${nameOrSelector}${separator}\"]`,\n ];\n selectors.set(nameOrSelector, parts.join(','));\n }\n\n return selectors.get(nameOrSelector);\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 * @returns {Array<HTMLElement>}\n * A list of elements on which the component should be mounted.\n */\nexport function getComponentElements(\n nameOrSelector: string,\n element: HTMLElement | Document = document,\n): HTMLElement[] {\n const selector = getSelector(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\n/**\n * Test if an event is defined in the given config.\n */\nexport function eventIsDefinedInConfig(event: string, config: BaseConfig): boolean {\n return isArray(config.emits) && config.emits.includes(event);\n}\n\n/**\n * Test if an event can be used on the given element.\n */\nexport function eventIsNative(event: string, element: HTMLElement): boolean {\n return isDefined(element[`on${event}`]);\n}\n\n/**\n * Get the target of a given event.\n *\n * @todo Return false in v3 if event is not defined or not native to prevent adding a listener.\n */\nexport function getEventTarget(\n instance: Base,\n event: string,\n config: BaseConfig,\n): Base | Base['$el'] {\n if (eventIsDefinedInConfig(event, config)) {\n return instance;\n }\n\n if (eventIsNative(event, instance.$el)) {\n return instance.$el;\n }\n\n if (isDev) {\n console.warn(\n `[${config.name}]`,\n `The \"${event}\" event is missing from the configuration and is not a native`,\n `event for the root element of type \\`${instance.$el.constructor.name}\\`.`,\n );\n }\n\n // @todo v3 return false or null\n return instance;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsD;AAEtD,sBAAyB;AAEzB,IAAI;AAKG,SAAS,WAAW,IAAyB;AAClD,MAAI,CAAC,yBAAS,IAAI,eAAe,GAAG;AAClC,OAAG;AACH;AAAA,EACF;AAEA,MAAI,CAAC,OAAO;AACV,YAAQ,IAAI,wBAAW;AAAA,EACzB;AAEA,QAAM,IAAI,EAAE;AACd;AAEA,IAAM,YAAY,oBAAI,IAAI;AAG1B,IAAM,YAAY;AAKlB,SAAS,YAAY,gBAAgC;AACnD,MAAI,CAAC,UAAU,IAAI,cAAc,GAAG;AAClC,UAAM,QAAQ;AAAA;AAAA,MAEZ,oBAAoB,cAAc;AAAA;AAAA,MAElC,qBAAqB,SAAS,GAAG,cAAc,GAAG,SAAS;AAAA;AAAA,MAE3D,qBAAqB,SAAS,GAAG,cAAc;AAAA;AAAA,MAE/C,qBAAqB,cAAc,GAAG,SAAS;AAAA,IACjD;AACA,cAAU,IAAI,gBAAgB,MAAM,KAAK,GAAG,CAAC;AAAA,EAC/C;AAEA,SAAO,UAAU,IAAI,cAAc;AACrC;AAYO,SAAS,qBACd,gBACA,UAAkC,UACnB;AACf,QAAM,WAAW,YAAY,cAAc;AAC3C,MAAI,WAAW,CAAC;AAEhB,MAAI;AACF,eAAW,MAAM,KAAK,QAAQ,iBAAiB,QAAQ,CAAC;AAAA,EAE1D,QAAQ;AAAA,EAAC;AAGT,MAAI,SAAS,WAAW,GAAG;AACzB,eAAW,MAAM,KAAK,QAAQ,iBAAiB,cAAc,CAAC;AAAA,EAChE;AAEA,SAAO;AACT;AAKO,SAAS,uBAAuB,OAAe,QAA6B;AACjF,aAAO,sBAAQ,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,KAAK;AAC7D;AAKO,SAAS,cAAc,OAAe,SAA+B;AAC1E,aAAO,wBAAU,QAAQ,KAAK,KAAK,EAAE,CAAC;AACxC;AAOO,SAAS,eACd,UACA,OACA,QACoB;AACpB,MAAI,uBAAuB,OAAO,MAAM,GAAG;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,cAAc,OAAO,SAAS,GAAG,GAAG;AACtC,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,oBAAO;AACT,YAAQ;AAAA,MACN,IAAI,OAAO,IAAI;AAAA,MACf,QAAQ,KAAK;AAAA,MACb,wCAAwC,SAAS,IAAI,YAAY,IAAI;AAAA,IACvE;AAAA,EACF;AAGA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,33 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // packages/js-toolkit/decorators/index.ts
17
- var decorators_exports = {};
18
- module.exports = __toCommonJS(decorators_exports);
19
- __reExport(decorators_exports, require("./withBreakpointManager.cjs"), module.exports);
20
- __reExport(decorators_exports, require("./withBreakpointObserver.cjs"), module.exports);
21
- __reExport(decorators_exports, require("./withDrag.cjs"), module.exports);
22
- __reExport(decorators_exports, require("./withExtraConfig.cjs"), module.exports);
23
- __reExport(decorators_exports, require("./withFreezedOptions.cjs"), module.exports);
24
- __reExport(decorators_exports, require("./withIntersectionObserver.cjs"), module.exports);
25
- __reExport(decorators_exports, require("./withMountOnMediaQuery.cjs"), module.exports);
26
- __reExport(decorators_exports, require("./withMountWhenInView.cjs"), module.exports);
27
- __reExport(decorators_exports, require("./withMountWhenPrefersMotion.cjs"), module.exports);
28
- __reExport(decorators_exports, require("./withRelativePointer.cjs"), module.exports);
29
- __reExport(decorators_exports, require("./withResponsiveOptions.cjs"), module.exports);
30
- __reExport(decorators_exports, require("./withScrolledInView/index.cjs"), module.exports);
31
- __reExport(decorators_exports, require("./withVue2.cjs"), module.exports);
32
- if (module.exports.default) module.exports = module.exports.default;
33
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/decorators/index.ts"],
4
- "sourcesContent": ["export * from './withBreakpointManager.js';\nexport * from './withBreakpointObserver.js';\nexport * from './withDrag.js';\nexport * from './withExtraConfig.js';\nexport * from './withFreezedOptions.js';\nexport * from './withIntersectionObserver.js';\nexport * from './withMountOnMediaQuery.js';\nexport * from './withMountWhenInView.js';\nexport * from './withMountWhenPrefersMotion.js';\nexport * from './withRelativePointer.js';\nexport * from './withResponsiveOptions.js';\nexport * from './withScrolledInView/index.js';\nexport * from './withVue2.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,wCAAd;AACA,+BAAc,yCADd;AAEA,+BAAc,2BAFd;AAGA,+BAAc,kCAHd;AAIA,+BAAc,qCAJd;AAKA,+BAAc,2CALd;AAMA,+BAAc,wCANd;AAOA,+BAAc,sCAPd;AAQA,+BAAc,6CARd;AASA,+BAAc,sCATd;AAUA,+BAAc,wCAVd;AAWA,+BAAc,2CAXd;AAYA,+BAAc,2BAZd;",
6
- "names": []
7
- }
@@ -1,102 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/decorators/withBreakpointManager.ts
20
- var withBreakpointManager_exports = {};
21
- __export(withBreakpointManager_exports, {
22
- withBreakpointManager: () => withBreakpointManager
23
- });
24
- module.exports = __toCommonJS(withBreakpointManager_exports);
25
- var import_services = require("../services/index.cjs");
26
- var import_utils = require("../utils/index.cjs");
27
- function testBreakpoints(breakpoints) {
28
- const { breakpoint } = (0, import_services.useResize)().props();
29
- for (const [breakpointKeys, instance] of breakpoints) {
30
- if (breakpointKeys.includes(breakpoint) && !instance.$isMounted) {
31
- setTimeout(() => instance.$mount(), 0);
32
- } else if (!breakpointKeys.includes(breakpoint) && instance.$isMounted) {
33
- instance.$destroy();
34
- }
35
- }
36
- }
37
- function mountComponents(instance, breakpoints) {
38
- return breakpoints.map(([bk, ComponentClass]) => {
39
- const child = new ComponentClass(instance.$el);
40
- Object.defineProperty(child, "$parent", { get: () => instance.$parent });
41
- return [bk.split(" "), child];
42
- });
43
- }
44
- var instances = /* @__PURE__ */ new WeakMap();
45
- function withBreakpointManager(BaseClass, breakpoints) {
46
- if (!(0, import_utils.isArray)(breakpoints)) {
47
- if (import_utils.isDev) {
48
- throw new Error("[withBreakpointManager] The `breakpoints` parameter must be an array.");
49
- }
50
- return BaseClass;
51
- }
52
- if (breakpoints.length < 2) {
53
- if (import_utils.isDev) {
54
- throw new Error("[withBreakpointManager] You must define at least 2 breakpoints.");
55
- }
56
- return BaseClass;
57
- }
58
- const { add, props } = (0, import_services.useResize)();
59
- if (!props().breakpoint) {
60
- if (import_utils.isDev) {
61
- throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");
62
- }
63
- return BaseClass;
64
- }
65
- class WithBreakpointManager extends BaseClass {
66
- /**
67
- * Watch for the document resize to test the breakpoints.
68
- */
69
- constructor(element) {
70
- super(element);
71
- if (!instances.has(this)) {
72
- instances.set(this, mountComponents(this, breakpoints));
73
- }
74
- add(`BreakpointManager-${this.$id}`, () => {
75
- testBreakpoints(instances.get(this));
76
- });
77
- }
78
- /**
79
- * Override the default $mount method to prevent component's from being
80
- * mounted when they should not.
81
- */
82
- $mount() {
83
- super.$mount();
84
- testBreakpoints(instances.get(this));
85
- return this;
86
- }
87
- /**
88
- * Destroy all instances when the main one is destroyed.
89
- */
90
- $destroy() {
91
- if ((0, import_utils.isArray)(instances.get(this))) {
92
- for (const [, instance] of instances.get(this)) {
93
- instance.$destroy();
94
- }
95
- }
96
- return super.$destroy();
97
- }
98
- }
99
- return WithBreakpointManager;
100
- }
101
- if (module.exports.default) module.exports = module.exports.default;
102
- //# sourceMappingURL=withBreakpointManager.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/decorators/withBreakpointManager.ts"],
4
- "sourcesContent": ["import type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseConstructor, BaseProps } from '../Base/index.js';\nimport { useResize } from '../services/index.js';\nimport { isDev, isArray } from '../utils/index.js';\n\n/**\n * Test the breakpoins of the given Base instance and return the hook to call.\n */\nfunction testBreakpoints(breakpoints: Array<[string[], Base]>) {\n const { breakpoint } = useResize().props();\n for (const [breakpointKeys, instance] of breakpoints) {\n if (breakpointKeys.includes(breakpoint) && !instance.$isMounted) {\n setTimeout(() => instance.$mount(), 0);\n } else if (!breakpointKeys.includes(breakpoint) && instance.$isMounted) {\n instance.$destroy();\n }\n }\n}\n\n/**\n * Prepare the components.\n */\nfunction mountComponents(\n instance: Base,\n breakpoints: Array<[string, BaseConstructor]>,\n): Array<[string[], Base]> {\n return breakpoints.map(([bk, ComponentClass]) => {\n const child = new ComponentClass(instance.$el);\n Object.defineProperty(child, '$parent', { get: () => instance.$parent });\n return [bk.split(' '), child];\n });\n}\n\n/**\n * A cache object to hold each Base sub-instances.\n */\nconst instances: WeakMap<Base, Array<[string[], Base]>> = new WeakMap();\n\n/**\n * BreakpointManager class.\n */\nexport function withBreakpointManager<S extends Base>(\n BaseClass: typeof Base,\n breakpoints: Array<[string, BaseConstructor<Base>]>,\n): BaseDecorator<BaseInterface, S> {\n if (!isArray(breakpoints)) {\n if (isDev) {\n throw new Error('[withBreakpointManager] The `breakpoints` parameter must be an array.');\n }\n\n // @ts-ignore\n return BaseClass;\n }\n\n if (breakpoints.length < 2) {\n if (isDev) {\n throw new Error('[withBreakpointManager] You must define at least 2 breakpoints.');\n }\n\n // @ts-ignore\n return BaseClass;\n }\n\n const { add, props } = useResize();\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 if (isDev) {\n throw new Error('The `BreakpointManager` class requires breakpoints to be defined.');\n }\n\n // @ts-ignore\n return BaseClass;\n }\n\n /**\n * Class.\n */\n class WithBreakpointManager<T extends BaseProps = BaseProps> extends BaseClass<T> {\n /**\n * Watch for the document resize to test the breakpoints.\n */\n constructor(element: HTMLElement) {\n super(element);\n\n if (!instances.has(this)) {\n instances.set(this, mountComponents(this, breakpoints));\n }\n\n add(`BreakpointManager-${this.$id}`, () => {\n testBreakpoints(instances.get(this));\n });\n }\n\n /**\n * Override the default $mount method to prevent component's from being\n * mounted when they should not.\n */\n $mount(): this {\n super.$mount();\n\n testBreakpoints(instances.get(this));\n\n return this;\n }\n\n /**\n * Destroy all instances when the main one is destroyed.\n */\n $destroy(): this {\n if (isArray(instances.get(this))) {\n for (const [, instance] of instances.get(this)) {\n instance.$destroy();\n }\n }\n\n return super.$destroy();\n }\n }\n\n // @ts-ignore\n return WithBreakpointManager;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA0B;AAC1B,mBAA+B;AAK/B,SAAS,gBAAgB,aAAsC;AAC7D,QAAM,EAAE,WAAW,QAAI,2BAAU,EAAE,MAAM;AACzC,aAAW,CAAC,gBAAgB,QAAQ,KAAK,aAAa;AACpD,QAAI,eAAe,SAAS,UAAU,KAAK,CAAC,SAAS,YAAY;AAC/D,iBAAW,MAAM,SAAS,OAAO,GAAG,CAAC;AAAA,IACvC,WAAW,CAAC,eAAe,SAAS,UAAU,KAAK,SAAS,YAAY;AACtE,eAAS,SAAS;AAAA,IACpB;AAAA,EACF;AACF;AAKA,SAAS,gBACP,UACA,aACyB;AACzB,SAAO,YAAY,IAAI,CAAC,CAAC,IAAI,cAAc,MAAM;AAC/C,UAAM,QAAQ,IAAI,eAAe,SAAS,GAAG;AAC7C,WAAO,eAAe,OAAO,WAAW,EAAE,KAAK,MAAM,SAAS,QAAQ,CAAC;AACvE,WAAO,CAAC,GAAG,MAAM,GAAG,GAAG,KAAK;AAAA,EAC9B,CAAC;AACH;AAKA,IAAM,YAAoD,oBAAI,QAAQ;AAK/D,SAAS,sBACd,WACA,aACiC;AACjC,MAAI,KAAC,sBAAQ,WAAW,GAAG;AACzB,QAAI,oBAAO;AACT,YAAM,IAAI,MAAM,uEAAuE;AAAA,IACzF;AAGA,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,SAAS,GAAG;AAC1B,QAAI,oBAAO;AACT,YAAM,IAAI,MAAM,iEAAiE;AAAA,IACnF;AAGA,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,KAAK,MAAM,QAAI,2BAAU;AAIjC,MAAI,CAAC,MAAM,EAAE,YAAY;AACvB,QAAI,oBAAO;AACT,YAAM,IAAI,MAAM,mEAAmE;AAAA,IACrF;AAGA,WAAO;AAAA,EACT;AAAA,EAKA,MAAM,8BAA+D,UAAa;AAAA;AAAA;AAAA;AAAA,IAIhF,YAAY,SAAsB;AAChC,YAAM,OAAO;AAEb,UAAI,CAAC,UAAU,IAAI,IAAI,GAAG;AACxB,kBAAU,IAAI,MAAM,gBAAgB,MAAM,WAAW,CAAC;AAAA,MACxD;AAEA,UAAI,qBAAqB,KAAK,GAAG,IAAI,MAAM;AACzC,wBAAgB,UAAU,IAAI,IAAI,CAAC;AAAA,MACrC,CAAC;AAAA,IACH;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,SAAe;AACb,YAAM,OAAO;AAEb,sBAAgB,UAAU,IAAI,IAAI,CAAC;AAEnC,aAAO;AAAA,IACT;AAAA;AAAA;AAAA;AAAA,IAKA,WAAiB;AACf,cAAI,sBAAQ,UAAU,IAAI,IAAI,CAAC,GAAG;AAChC,mBAAW,CAAC,EAAE,QAAQ,KAAK,UAAU,IAAI,IAAI,GAAG;AAC9C,mBAAS,SAAS;AAAA,QACpB;AAAA,MACF;AAEA,aAAO,MAAM,SAAS;AAAA,IACxB;AAAA,EACF;AAGA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,128 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/decorators/withBreakpointObserver.ts
20
- var withBreakpointObserver_exports = {};
21
- __export(withBreakpointObserver_exports, {
22
- withBreakpointObserver: () => withBreakpointObserver
23
- });
24
- module.exports = __toCommonJS(withBreakpointObserver_exports);
25
- var import_services = require("../services/index.cjs");
26
- var import_utils = require("../utils/index.cjs");
27
- function testBreakpoints(instance, breakpoint = (0, import_services.useResize)().props().breakpoint) {
28
- const { activeBreakpoints, inactiveBreakpoints } = instance.$options;
29
- const isInActiveBreakpoint = activeBreakpoints && activeBreakpoints.split(" ").includes(breakpoint);
30
- const isInInactiveBreakpoint = inactiveBreakpoints && inactiveBreakpoints.split(" ").includes(breakpoint);
31
- if (activeBreakpoints && isInActiveBreakpoint || inactiveBreakpoints && !isInInactiveBreakpoint) {
32
- return "$mount";
33
- }
34
- return "$destroy";
35
- }
36
- function hasBreakpointConfiguration(instance) {
37
- const { activeBreakpoints, inactiveBreakpoints } = instance.$options;
38
- return Boolean(activeBreakpoints || inactiveBreakpoints);
39
- }
40
- function testConflictingBreakpointConfiguration(instance) {
41
- const { activeBreakpoints, inactiveBreakpoints, name } = instance.$options;
42
- if (activeBreakpoints && inactiveBreakpoints) {
43
- throw new Error(
44
- `[${name}] Incorrect configuration: the \`activeBreakpoints\` and \`inactiveBreakpoints\` are not compatible.`
45
- );
46
- }
47
- }
48
- function addToResize(key, instance) {
49
- if (import_utils.isDev) {
50
- testConflictingBreakpointConfiguration(instance);
51
- }
52
- const { add, has } = (0, import_services.useResize)();
53
- if (!has(key)) {
54
- add(key, ({ breakpoint }) => {
55
- const action = testBreakpoints(instance, breakpoint);
56
- if (action === "$destroy" && instance.$isMounted) {
57
- instance[action]();
58
- } else if (action === "$mount" && !instance.$isMounted) {
59
- setTimeout(() => instance[action](), 0);
60
- }
61
- });
62
- }
63
- }
64
- function withBreakpointObserver(BaseClass) {
65
- class WithBreakpointObserver extends BaseClass {
66
- /**
67
- * Config.
68
- */
69
- static config = {
70
- ...BaseClass.config,
71
- name: `${BaseClass.config.name}WithBreakpointObserver`,
72
- options: {
73
- ...BaseClass.config?.options || {},
74
- activeBreakpoints: String,
75
- inactiveBreakpoints: String
76
- }
77
- };
78
- /**
79
- * Watch for the document resize to test the breakpoints.
80
- */
81
- constructor(element) {
82
- super(element);
83
- const { remove, props } = (0, import_services.useResize)();
84
- const { name } = this.$options;
85
- if (!props().breakpoint) {
86
- if (import_utils.isDev) {
87
- throw new Error(
88
- `[${name}] The \`BreakpointObserver\` class requires breakpoints to be defined.`
89
- );
90
- }
91
- return;
92
- }
93
- const key = `BreakpointObserver-${this.$id}`;
94
- const mutationObserver = new MutationObserver(([mutation]) => {
95
- if (mutation.type === "attributes" && (mutation.attributeName === "data-options" || (0, import_utils.startsWith)(mutation.attributeName, "data-option-"))) {
96
- if (!hasBreakpointConfiguration(this)) {
97
- this.$mount();
98
- remove(key);
99
- return;
100
- }
101
- addToResize(key, this);
102
- }
103
- });
104
- mutationObserver.observe(this.$el, { attributes: true });
105
- if (!hasBreakpointConfiguration(this)) {
106
- return;
107
- }
108
- addToResize(key, this);
109
- }
110
- /**
111
- * Override the default $mount method to prevent component's from being
112
- * mounted when they should not.
113
- */
114
- $mount() {
115
- if (!hasBreakpointConfiguration(this)) {
116
- return super.$mount();
117
- }
118
- const action = testBreakpoints(this);
119
- if (action === "$mount") {
120
- return super.$mount();
121
- }
122
- return this;
123
- }
124
- }
125
- return WithBreakpointObserver;
126
- }
127
- if (module.exports.default) module.exports = module.exports.default;
128
- //# sourceMappingURL=withBreakpointObserver.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/decorators/withBreakpointObserver.ts"],
4
- "sourcesContent": ["import type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseProps, BaseConfig } from '../Base/index.js';\nimport { useResize } from '../services/index.js';\nimport { isDev, startsWith } from '../utils/index.js';\n\nexport interface WithBreakpointObserverProps extends BaseProps {\n $options: {\n activeBreakpoints?: string;\n inactiveBreakpoints?: string;\n };\n}\n\nexport interface WithBreakpointObserverInterface extends BaseInterface {\n $mount(): this;\n}\n\n/**\n * Test the breakpoins of the given Base instance and return the hook to call.\n *\n * @param {Base<WithBreakpointObserverProps>} instance The component's instance.\n * @param {string} [breakpoint] The breakpoint to test.\n * @returns {string} The action to trigger.\n */\nfunction testBreakpoints(\n instance: Base<WithBreakpointObserverProps>,\n breakpoint: string = useResize().props().breakpoint,\n): string {\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 *\n * @param {Base<WithBreakpointObserverProps>} instance A Base class instance.\n * @returns {boolean} True if configured correctly, false otherwise.\n */\nfunction hasBreakpointConfiguration(instance: Base<WithBreakpointObserverProps>): boolean {\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 *\n * @param {Base<WithBreakpointObserverProps>} instance A Base class instance.\n * @returns {void}\n */\nfunction testConflictingBreakpointConfiguration(instance: Base<WithBreakpointObserverProps>): void {\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 *\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 if (isDev) {\n testConflictingBreakpointConfiguration(instance);\n }\n\n const { add, has } = useResize();\n\n if (!has(key)) {\n add(key, ({ 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 */\nexport function withBreakpointObserver<S extends Base>(\n BaseClass: typeof Base,\n): BaseDecorator<WithBreakpointObserverInterface, S, WithBreakpointObserverProps> {\n /**\n * Class.\n */\n class WithBreakpointObserver<T extends BaseProps = BaseProps> extends BaseClass<\n T & WithBreakpointObserverProps\n > {\n /**\n * Config.\n */\n static config: BaseConfig = {\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 */\n constructor(element: HTMLElement) {\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 if (isDev) {\n throw new Error(\n `[${name}] The \\`BreakpointObserver\\` class requires breakpoints to be defined.`,\n );\n }\n return;\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 startsWith(mutation.attributeName, '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;\n }\n\n addToResize(key, this);\n }\n\n /**\n * Override the default $mount method to prevent component's from being\n * mounted when they should not.\n */\n $mount(): this {\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 // @ts-ignore\n return WithBreakpointObserver;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA0B;AAC1B,mBAAkC;AAoBlC,SAAS,gBACP,UACA,iBAAqB,2BAAU,EAAE,MAAM,EAAE,YACjC;AACR,QAAM,EAAE,mBAAmB,oBAAoB,IAAI,SAAS;AAC5D,QAAM,uBACJ,qBAAqB,kBAAkB,MAAM,GAAG,EAAE,SAAS,UAAU;AACvE,QAAM,yBACJ,uBAAuB,oBAAoB,MAAM,GAAG,EAAE,SAAS,UAAU;AAE3E,MACG,qBAAqB,wBACrB,uBAAuB,CAAC,wBACzB;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAQA,SAAS,2BAA2B,UAAsD;AACxF,QAAM,EAAE,mBAAmB,oBAAoB,IAAI,SAAS;AAC5D,SAAO,QAAQ,qBAAqB,mBAAmB;AACzD;AAQA,SAAS,uCAAuC,UAAmD;AACjG,QAAM,EAAE,mBAAmB,qBAAqB,KAAK,IAAI,SAAS;AAClE,MAAI,qBAAqB,qBAAqB;AAC5C,UAAM,IAAI;AAAA,MACR,IAAI,IAAI;AAAA,IACV;AAAA,EACF;AACF;AAQA,SAAS,YAAY,KAAK,UAAU;AAClC,MAAI,oBAAO;AACT,2CAAuC,QAAQ;AAAA,EACjD;AAEA,QAAM,EAAE,KAAK,IAAI,QAAI,2BAAU;AAE/B,MAAI,CAAC,IAAI,GAAG,GAAG;AACb,QAAI,KAAK,CAAC,EAAE,WAAW,MAAM;AAC3B,YAAM,SAAS,gBAAgB,UAAU,UAAU;AAGnD,UAAI,WAAW,cAAc,SAAS,YAAY;AAChD,iBAAS,MAAM,EAAE;AAAA,MACnB,WAAW,WAAW,YAAY,CAAC,SAAS,YAAY;AACtD,mBAAW,MAAM,SAAS,MAAM,EAAE,GAAG,CAAC;AAAA,MACxC;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAKO,SAAS,uBACd,WACgF;AAAA,EAIhF,MAAM,+BAAgE,UAEpE;AAAA;AAAA;AAAA;AAAA,IAIA,OAAO,SAAqB;AAAA,MAC1B,GAAG,UAAU;AAAA,MACb,MAAM,GAAG,UAAU,OAAO,IAAI;AAAA,MAC9B,SAAS;AAAA,QACP,GAAI,UAAU,QAAQ,WAAW,CAAC;AAAA,QAClC,mBAAmB;AAAA,QACnB,qBAAqB;AAAA,MACvB;AAAA,IACF;AAAA;AAAA;AAAA;AAAA,IAKA,YAAY,SAAsB;AAChC,YAAM,OAAO;AAEb,YAAM,EAAE,QAAQ,MAAM,QAAI,2BAAU;AACpC,YAAM,EAAE,KAAK,IAAI,KAAK;AAItB,UAAI,CAAC,MAAM,EAAE,YAAY;AACvB,YAAI,oBAAO;AACT,gBAAM,IAAI;AAAA,YACR,IAAI,IAAI;AAAA,UACV;AAAA,QACF;AACA;AAAA,MACF;AAEA,YAAM,MAAM,sBAAsB,KAAK,GAAG;AAG1C,YAAM,mBAAmB,IAAI,iBAAiB,CAAC,CAAC,QAAQ,MAAM;AAC5D,YACE,SAAS,SAAS,iBACjB,SAAS,kBAAkB,sBAC1B,yBAAW,SAAS,eAAe,cAAc,IACnD;AAEA,cAAI,CAAC,2BAA2B,IAAI,GAAG;AACrC,iBAAK,OAAO;AACZ,mBAAO,GAAG;AACV;AAAA,UACF;AAEA,sBAAY,KAAK,IAAI;AAAA,QACvB;AAAA,MACF,CAAC;AACD,uBAAiB,QAAQ,KAAK,KAAK,EAAE,YAAY,KAAK,CAAC;AAGvD,UAAI,CAAC,2BAA2B,IAAI,GAAG;AACrC;AAAA,MACF;AAEA,kBAAY,KAAK,IAAI;AAAA,IACvB;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,SAAe;AAEb,UAAI,CAAC,2BAA2B,IAAI,GAAG;AACrC,eAAO,MAAM,OAAO;AAAA,MACtB;AAEA,YAAM,SAAS,gBAAgB,IAAI;AACnC,UAAI,WAAW,UAAU;AACvB,eAAO,MAAM,OAAO;AAAA,MACtB;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AAGA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,56 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/decorators/withDrag.ts
20
- var withDrag_exports = {};
21
- __export(withDrag_exports, {
22
- withDrag: () => withDrag
23
- });
24
- module.exports = __toCommonJS(withDrag_exports);
25
- var import_services = require("../services/index.cjs");
26
- function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
27
- class WithDrag extends BaseClass {
28
- /**
29
- * Config.
30
- */
31
- static config = {
32
- name: `${BaseClass.config.name}WithDrag`,
33
- emits: ["dragged"]
34
- };
35
- /**
36
- * Class constructor.
37
- */
38
- constructor(element) {
39
- super(element);
40
- this.$on("mounted", () => {
41
- this.$services.register(
42
- "dragged",
43
- import_services.useDrag.bind(void 0, target.call(this, this), options)
44
- );
45
- this.$services.enable("dragged");
46
- });
47
- this.$on("destroyed", () => {
48
- this.$services.disable("dragged");
49
- this.$services.unregister("dragged");
50
- });
51
- }
52
- }
53
- return WithDrag;
54
- }
55
- if (module.exports.default) module.exports = module.exports.default;
56
- //# sourceMappingURL=withDrag.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/decorators/withDrag.ts"],
4
- "sourcesContent": ["import type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseProps, BaseConfig } from '../Base/index.js';\nimport type { DragServiceOptions, DragServiceProps } from '../services/drag.js';\nimport { useDrag } from '../services/index.js';\n\nexport type DragDecoratorOptions = DragServiceOptions & {\n target?: (this: Base, instance: Base) => HTMLElement;\n};\n\nexport interface WithDragInterface extends BaseInterface {\n dragged?(props: DragServiceProps): void;\n}\n\n/**\n * Add dragging capabilities to a component.\n */\nexport function withDrag<S extends Base>(\n BaseClass: typeof Base,\n { target = (instance) => instance.$el, ...options }: DragDecoratorOptions = {},\n): BaseDecorator<BaseInterface, S> {\n /**\n * Class.\n */\n class WithDrag<T extends BaseProps = BaseProps> extends BaseClass<T & WithDragInterface> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: `${BaseClass.config.name}WithDrag`,\n emits: ['dragged'],\n };\n\n /**\n * Class constructor.\n */\n constructor(element: HTMLElement) {\n super(element);\n\n this.$on('mounted', () => {\n this.$services.register(\n 'dragged',\n useDrag.bind(undefined, target.call(this, this), options),\n );\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 // @ts-ignore\n return WithDrag;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAwB;AAajB,SAAS,SACd,WACA,EAAE,SAAS,CAAC,aAAa,SAAS,KAAK,GAAG,QAAQ,IAA0B,CAAC,GAC5C;AAAA,EAIjC,MAAM,iBAAkD,UAAiC;AAAA;AAAA;AAAA;AAAA,IAIvF,OAAO,SAAqB;AAAA,MAC1B,MAAM,GAAG,UAAU,OAAO,IAAI;AAAA,MAC9B,OAAO,CAAC,SAAS;AAAA,IACnB;AAAA;AAAA;AAAA;AAAA,IAKA,YAAY,SAAsB;AAChC,YAAM,OAAO;AAEb,WAAK,IAAI,WAAW,MAAM;AACxB,aAAK,UAAU;AAAA,UACb;AAAA,UACA,wBAAQ,KAAK,QAAW,OAAO,KAAK,MAAM,IAAI,GAAG,OAAO;AAAA,QAC1D;AACA,aAAK,UAAU,OAAO,SAAS;AAAA,MACjC,CAAC;AAED,WAAK,IAAI,aAAa,MAAM;AAC1B,aAAK,UAAU,QAAQ,SAAS;AAChC,aAAK,UAAU,WAAW,SAAS;AAAA,MACrC,CAAC;AAAA,IACH;AAAA,EACF;AAGA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,50 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // packages/js-toolkit/decorators/withExtraConfig.ts
30
- var withExtraConfig_exports = {};
31
- __export(withExtraConfig_exports, {
32
- withExtraConfig: () => withExtraConfig
33
- });
34
- module.exports = __toCommonJS(withExtraConfig_exports);
35
- var import_deepmerge = __toESM(require("deepmerge"), 1);
36
- function withExtraConfig(BaseClass, config, options = {}) {
37
- const newConfig = (0, import_deepmerge.default)(BaseClass.config, config, options);
38
- if (newConfig.name === BaseClass.config.name) {
39
- newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
40
- }
41
- class WithExtraConfig extends BaseClass {
42
- /**
43
- * Config.
44
- */
45
- static config = newConfig;
46
- }
47
- return WithExtraConfig;
48
- }
49
- if (module.exports.default) module.exports = module.exports.default;
50
- //# sourceMappingURL=withExtraConfig.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/decorators/withExtraConfig.ts"],
4
- "sourcesContent": ["import merge from 'deepmerge';\nimport type { Options as DeepmergeOptions } from 'deepmerge';\nimport type { BaseDecorator, BaseInterface } from '../Base/types.js';\nimport type { Base, BaseProps, BaseConfig } from '../Base/index.js';\n\n/**\n * Extends the configuration of an existing class.\n */\nexport function withExtraConfig<S extends Base>(\n BaseClass: typeof Base,\n config: Partial<BaseConfig>,\n options: DeepmergeOptions = {},\n): BaseDecorator<BaseInterface, S> {\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 /**\n * Class.\n */\n class WithExtraConfig<T extends BaseProps = BaseProps> extends BaseClass<T> {\n /**\n * Config.\n */\n static config: BaseConfig = newConfig;\n }\n\n // @ts-ignore\n return WithExtraConfig;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAkB;AAQX,SAAS,gBACd,WACA,QACA,UAA4B,CAAC,GACI;AACjC,QAAM,gBAAY,iBAAAA,SAAM,UAAU,QAAQ,QAAQ,OAAO;AAEzD,MAAI,UAAU,SAAS,UAAU,OAAO,MAAM;AAC5C,cAAU,OAAO,GAAG,UAAU,OAAO,IAAI;AAAA,EAC3C;AAAA,EAKA,MAAM,wBAAyD,UAAa;AAAA;AAAA;AAAA;AAAA,IAI1E,OAAO,SAAqB;AAAA,EAC9B;AAGA,SAAO;AACT;",
6
- "names": ["merge"]
7
- }