@apia/util 1.0.4 → 2.0.1

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 (274) hide show
  1. package/dist/animate/index.d.ts +4 -0
  2. package/dist/animate/index.d.ts.map +1 -0
  3. package/dist/animate/index.js +24 -0
  4. package/dist/animate/index.js.map +1 -0
  5. package/dist/array/arrayOrArray.d.ts +4 -0
  6. package/dist/array/arrayOrArray.d.ts.map +1 -0
  7. package/dist/array/arrayOrArray.js +8 -0
  8. package/dist/array/arrayOrArray.js.map +1 -0
  9. package/dist/array/getIndex.d.ts +14 -0
  10. package/dist/array/getIndex.d.ts.map +1 -0
  11. package/dist/array/getIndex.js +12 -0
  12. package/dist/array/getIndex.js.map +1 -0
  13. package/dist/crypto/decrypt.d.ts +4 -0
  14. package/dist/crypto/decrypt.d.ts.map +1 -0
  15. package/dist/crypto/decrypt.js +16 -0
  16. package/dist/crypto/decrypt.js.map +1 -0
  17. package/dist/crypto/encrypt.d.ts +4 -0
  18. package/dist/crypto/encrypt.d.ts.map +1 -0
  19. package/dist/crypto/encrypt.js +13 -0
  20. package/dist/crypto/encrypt.js.map +1 -0
  21. package/dist/crypto/generateKey.js +11 -0
  22. package/dist/crypto/generateKey.js.map +1 -0
  23. package/dist/date/apiaDateToStandarFormat.d.ts +4 -0
  24. package/dist/date/apiaDateToStandarFormat.d.ts.map +1 -0
  25. package/dist/date/apiaDateToStandarFormat.js +12 -0
  26. package/dist/date/apiaDateToStandarFormat.js.map +1 -0
  27. package/dist/date/dateToApiaFormat.d.ts +4 -0
  28. package/dist/date/dateToApiaFormat.d.ts.map +1 -0
  29. package/dist/date/dateToApiaFormat.js +9 -0
  30. package/dist/date/dateToApiaFormat.js.map +1 -0
  31. package/dist/date/getDateFormat.d.ts +11 -0
  32. package/dist/date/getDateFormat.d.ts.map +1 -0
  33. package/dist/date/getDateFormat.js +20 -0
  34. package/dist/date/getDateFormat.js.map +1 -0
  35. package/dist/debug/debugDispatcher.d.ts +32 -0
  36. package/dist/debug/debugDispatcher.d.ts.map +1 -0
  37. package/dist/debug/debugDispatcher.js +72 -0
  38. package/dist/debug/debugDispatcher.js.map +1 -0
  39. package/dist/debug/shortcutController.d.ts +57 -0
  40. package/dist/debug/shortcutController.d.ts.map +1 -0
  41. package/dist/debug/shortcutController.js +152 -0
  42. package/dist/debug/shortcutController.js.map +1 -0
  43. package/dist/documents/downloadStringAsDoc.d.ts +8 -0
  44. package/dist/documents/downloadStringAsDoc.d.ts.map +1 -0
  45. package/dist/documents/downloadStringAsDoc.js +12 -0
  46. package/dist/documents/downloadStringAsDoc.js.map +1 -0
  47. package/dist/documents/downloadUrl.d.ts +20 -0
  48. package/dist/documents/downloadUrl.d.ts.map +1 -0
  49. package/dist/documents/downloadUrl.js +18 -0
  50. package/dist/documents/downloadUrl.js.map +1 -0
  51. package/dist/documents/openAndReadFile.d.ts +4 -0
  52. package/dist/documents/openAndReadFile.d.ts.map +1 -0
  53. package/dist/documents/openAndReadFile.js +29 -0
  54. package/dist/documents/openAndReadFile.js.map +1 -0
  55. package/dist/dom/autoDisconnectMutationObserver.d.ts +17 -0
  56. package/dist/dom/autoDisconnectMutationObserver.d.ts.map +1 -0
  57. package/dist/dom/autoDisconnectMutationObserver.js +35 -0
  58. package/dist/dom/autoDisconnectMutationObserver.js.map +1 -0
  59. package/dist/dom/customEvents.d.ts +40 -0
  60. package/dist/dom/customEvents.d.ts.map +1 -0
  61. package/dist/dom/customEvents.js +34 -0
  62. package/dist/dom/customEvents.js.map +1 -0
  63. package/dist/dom/enableChildrenFocus.d.ts +18 -0
  64. package/dist/dom/enableChildrenFocus.d.ts.map +1 -0
  65. package/dist/dom/enableChildrenFocus.js +26 -0
  66. package/dist/dom/enableChildrenFocus.js.map +1 -0
  67. package/dist/dom/findOffsetRelativeToScrollParent.d.ts +7 -0
  68. package/dist/dom/findOffsetRelativeToScrollParent.d.ts.map +1 -0
  69. package/dist/dom/findOffsetRelativeToScrollParent.js +19 -0
  70. package/dist/dom/findOffsetRelativeToScrollParent.js.map +1 -0
  71. package/dist/dom/findScrollContainer.d.ts +8 -0
  72. package/dist/dom/findScrollContainer.d.ts.map +1 -0
  73. package/dist/dom/findScrollContainer.js +9 -0
  74. package/dist/dom/findScrollContainer.js.map +1 -0
  75. package/dist/dom/getFocusSelector.d.ts +25 -0
  76. package/dist/dom/getFocusSelector.d.ts.map +1 -0
  77. package/dist/dom/getFocusSelector.js +30 -0
  78. package/dist/dom/getFocusSelector.js.map +1 -0
  79. package/dist/dom/getSpecificParent.d.ts +23 -0
  80. package/dist/dom/getSpecificParent.d.ts.map +1 -0
  81. package/dist/dom/getSpecificParent.js +19 -0
  82. package/dist/dom/getSpecificParent.js.map +1 -0
  83. package/dist/dom/isChild.d.ts +13 -0
  84. package/dist/dom/isChild.d.ts.map +1 -0
  85. package/dist/dom/isChild.js +8 -0
  86. package/dist/dom/isChild.js.map +1 -0
  87. package/dist/dom/scrollParentIntoElement.d.ts +9 -0
  88. package/dist/dom/scrollParentIntoElement.d.ts.map +1 -0
  89. package/dist/dom/scrollParentIntoElement.js +24 -0
  90. package/dist/dom/scrollParentIntoElement.js.map +1 -0
  91. package/dist/dom/url.d.ts +18 -0
  92. package/dist/dom/url.d.ts.map +1 -0
  93. package/dist/dom/url.js +52 -0
  94. package/dist/dom/url.js.map +1 -0
  95. package/dist/dom/usePanAndZoom.d.ts +14 -0
  96. package/dist/dom/usePanAndZoom.d.ts.map +1 -0
  97. package/dist/dom/usePanAndZoom.js +111 -0
  98. package/dist/dom/usePanAndZoom.js.map +1 -0
  99. package/dist/encoding/index.d.ts +8 -0
  100. package/dist/encoding/index.d.ts.map +1 -0
  101. package/dist/encoding/index.js +12 -0
  102. package/dist/encoding/index.js.map +1 -0
  103. package/dist/events/BouncingEmitter.d.ts +67 -0
  104. package/dist/events/BouncingEmitter.d.ts.map +1 -0
  105. package/dist/events/BouncingEmitter.js +72 -0
  106. package/dist/events/BouncingEmitter.js.map +1 -0
  107. package/dist/events/EventEmitter.d.ts +47 -0
  108. package/dist/events/EventEmitter.d.ts.map +1 -0
  109. package/dist/events/EventEmitter.js +75 -0
  110. package/dist/events/EventEmitter.js.map +1 -0
  111. package/dist/events/StatefulEmitter.d.ts +44 -0
  112. package/dist/events/StatefulEmitter.d.ts.map +1 -0
  113. package/dist/events/StatefulEmitter.js +57 -0
  114. package/dist/events/StatefulEmitter.js.map +1 -0
  115. package/dist/events/types.d.ts +29 -0
  116. package/dist/events/types.d.ts.map +1 -0
  117. package/dist/focus/focusController.d.ts +108 -0
  118. package/dist/focus/focusController.d.ts.map +1 -0
  119. package/dist/focus/focusController.js +295 -0
  120. package/dist/focus/focusController.js.map +1 -0
  121. package/dist/focus/globalFocus.d.ts +24 -0
  122. package/dist/focus/globalFocus.d.ts.map +1 -0
  123. package/dist/focus/globalFocus.js +87 -0
  124. package/dist/focus/globalFocus.js.map +1 -0
  125. package/dist/history/History.d.ts +81 -0
  126. package/dist/history/History.d.ts.map +1 -0
  127. package/dist/history/History.js +122 -0
  128. package/dist/history/History.js.map +1 -0
  129. package/dist/hooks/useCombinedRefs.d.ts +18 -0
  130. package/dist/hooks/useCombinedRefs.d.ts.map +1 -0
  131. package/dist/hooks/useCombinedRefs.js +20 -0
  132. package/dist/hooks/useCombinedRefs.js.map +1 -0
  133. package/dist/hooks/useDebouncedCallback.d.ts +7 -0
  134. package/dist/hooks/useDebouncedCallback.d.ts.map +1 -0
  135. package/dist/hooks/useDebouncedCallback.js +21 -0
  136. package/dist/hooks/useDebouncedCallback.js.map +1 -0
  137. package/dist/hooks/useLatest.d.ts +13 -0
  138. package/dist/hooks/useLatest.d.ts.map +1 -0
  139. package/dist/hooks/useLatest.js +10 -0
  140. package/dist/hooks/useLatest.js.map +1 -0
  141. package/dist/hooks/useMount.d.ts +6 -0
  142. package/dist/hooks/useMount.d.ts.map +1 -0
  143. package/dist/hooks/useMount.js +14 -0
  144. package/dist/hooks/useMount.js.map +1 -0
  145. package/dist/hooks/usePrevious.d.ts +6 -0
  146. package/dist/hooks/usePrevious.d.ts.map +1 -0
  147. package/dist/hooks/usePrevious.js +12 -0
  148. package/dist/hooks/usePrevious.js.map +1 -0
  149. package/dist/hooks/useShallowMemo.d.ts +9 -0
  150. package/dist/hooks/useShallowMemo.d.ts.map +1 -0
  151. package/dist/hooks/useShallowMemo.js +42 -0
  152. package/dist/hooks/useShallowMemo.js.map +1 -0
  153. package/dist/hooks/useStateRef.d.ts +10 -0
  154. package/dist/hooks/useStateRef.d.ts.map +1 -0
  155. package/dist/hooks/useStateRef.js +11 -0
  156. package/dist/hooks/useStateRef.js.map +1 -0
  157. package/dist/hooks/useSubscription.d.ts +31 -0
  158. package/dist/hooks/useSubscription.d.ts.map +1 -0
  159. package/dist/hooks/useSubscription.js +21 -0
  160. package/dist/hooks/useSubscription.js.map +1 -0
  161. package/dist/hooks/useUnmount.d.ts +4 -0
  162. package/dist/hooks/useUnmount.d.ts.map +1 -0
  163. package/dist/hooks/useUnmount.js +10 -0
  164. package/dist/hooks/useUnmount.js.map +1 -0
  165. package/dist/hooks/useUpdateEffect.d.ts +10 -0
  166. package/dist/hooks/useUpdateEffect.d.ts.map +1 -0
  167. package/dist/hooks/useUpdateEffect.js +16 -0
  168. package/dist/hooks/useUpdateEffect.js.map +1 -0
  169. package/dist/imperative/makeImperativeComponent.d.ts +56 -0
  170. package/dist/imperative/makeImperativeComponent.d.ts.map +1 -0
  171. package/dist/imperative/makeImperativeComponent.js +48 -0
  172. package/dist/imperative/makeImperativeComponent.js.map +1 -0
  173. package/dist/imperative/makeSingleImperativeComponent.d.ts +15 -0
  174. package/dist/imperative/makeSingleImperativeComponent.d.ts.map +1 -0
  175. package/dist/imperative/makeSingleImperativeComponent.js +31 -0
  176. package/dist/imperative/makeSingleImperativeComponent.js.map +1 -0
  177. package/dist/imperative/types.d.ts +22 -0
  178. package/dist/imperative/types.d.ts.map +1 -0
  179. package/dist/imperative/types.js +8 -0
  180. package/dist/imperative/types.js.map +1 -0
  181. package/dist/imperative/useImperativeComponentEvents.d.ts +6 -0
  182. package/dist/imperative/useImperativeComponentEvents.d.ts.map +1 -0
  183. package/dist/imperative/useImperativeComponentEvents.js +35 -0
  184. package/dist/imperative/useImperativeComponentEvents.js.map +1 -0
  185. package/dist/imperative/useImperativeIdentifierContext.d.ts +14 -0
  186. package/dist/imperative/useImperativeIdentifierContext.d.ts.map +1 -0
  187. package/dist/imperative/useImperativeIdentifierContext.js +10 -0
  188. package/dist/imperative/useImperativeIdentifierContext.js.map +1 -0
  189. package/dist/index.d.ts +69 -1777
  190. package/dist/index.js +63 -2659
  191. package/dist/index.js.map +1 -1
  192. package/dist/labels/formatMessage.d.ts +19 -0
  193. package/dist/labels/formatMessage.d.ts.map +1 -0
  194. package/dist/labels/formatMessage.js +13 -0
  195. package/dist/labels/formatMessage.js.map +1 -0
  196. package/dist/labels/getLabel.d.ts +34 -0
  197. package/dist/labels/getLabel.d.ts.map +1 -0
  198. package/dist/labels/getLabel.js +18 -0
  199. package/dist/labels/getLabel.js.map +1 -0
  200. package/dist/number/index.d.ts +29 -0
  201. package/dist/number/index.d.ts.map +1 -0
  202. package/dist/number/index.js +43 -0
  203. package/dist/number/index.js.map +1 -0
  204. package/dist/objects/getValueByPath.d.ts +23 -0
  205. package/dist/objects/getValueByPath.d.ts.map +1 -0
  206. package/dist/objects/getValueByPath.js +19 -0
  207. package/dist/objects/getValueByPath.js.map +1 -0
  208. package/dist/objects/setValueByPath.d.ts +33 -0
  209. package/dist/objects/setValueByPath.d.ts.map +1 -0
  210. package/dist/objects/setValueByPath.js +35 -0
  211. package/dist/objects/setValueByPath.js.map +1 -0
  212. package/dist/propsStore/propsStore.d.ts +42 -0
  213. package/dist/propsStore/propsStore.d.ts.map +1 -0
  214. package/dist/propsStore/propsStore.js +157 -0
  215. package/dist/propsStore/propsStore.js.map +1 -0
  216. package/dist/propsStore/types.d.ts +24 -0
  217. package/dist/propsStore/types.d.ts.map +1 -0
  218. package/dist/propsStore/usePropsSelector.d.ts +67 -0
  219. package/dist/propsStore/usePropsSelector.d.ts.map +1 -0
  220. package/dist/propsStore/usePropsSelector.js +92 -0
  221. package/dist/propsStore/usePropsSelector.js.map +1 -0
  222. package/dist/screenLock/screenLocker.d.ts +60 -0
  223. package/dist/screenLock/screenLocker.d.ts.map +1 -0
  224. package/dist/screenLock/screenLocker.js +95 -0
  225. package/dist/screenLock/screenLocker.js.map +1 -0
  226. package/dist/states/useDebouncedState.d.ts +10 -0
  227. package/dist/states/useDebouncedState.d.ts.map +1 -0
  228. package/dist/states/useDebouncedState.js +22 -0
  229. package/dist/states/useDebouncedState.js.map +1 -0
  230. package/dist/states/useDomState.d.ts +86 -0
  231. package/dist/states/useDomState.d.ts.map +1 -0
  232. package/dist/states/useDomState.js +35 -0
  233. package/dist/states/useDomState.js.map +1 -0
  234. package/dist/storage/StatefulStore.d.ts +205 -0
  235. package/dist/storage/StatefulStore.d.ts.map +1 -0
  236. package/dist/storage/StatefulStore.js +301 -0
  237. package/dist/storage/StatefulStore.js.map +1 -0
  238. package/dist/storage/persistentStorage.d.ts +12 -0
  239. package/dist/storage/persistentStorage.d.ts.map +1 -0
  240. package/dist/storage/persistentStorage.js +28 -0
  241. package/dist/storage/persistentStorage.js.map +1 -0
  242. package/dist/storage/useLocalStorage.d.ts +7 -0
  243. package/dist/storage/useLocalStorage.d.ts.map +1 -0
  244. package/dist/storage/useLocalStorage.js +40 -0
  245. package/dist/storage/useLocalStorage.js.map +1 -0
  246. package/dist/string/alignment.d.ts +25 -0
  247. package/dist/string/alignment.d.ts.map +1 -0
  248. package/dist/string/alignment.js +26 -0
  249. package/dist/string/alignment.js.map +1 -0
  250. package/dist/string/ucfirst.d.ts +4 -0
  251. package/dist/string/ucfirst.d.ts.map +1 -0
  252. package/dist/string/ucfirst.js +6 -0
  253. package/dist/string/ucfirst.js.map +1 -0
  254. package/dist/typeGuards/toBoolean.d.ts +26 -0
  255. package/dist/typeGuards/toBoolean.d.ts.map +1 -0
  256. package/dist/typeGuards/toBoolean.js +11 -0
  257. package/dist/typeGuards/toBoolean.js.map +1 -0
  258. package/dist/types/apia/common.d.ts +114 -0
  259. package/dist/types/apia/common.d.ts.map +1 -0
  260. package/dist/types/apia/date.d.ts +4 -0
  261. package/dist/types/apia/date.d.ts.map +1 -0
  262. package/dist/types/apia/forms.d.ts +221 -0
  263. package/dist/types/apia/forms.d.ts.map +1 -0
  264. package/dist/types/misc.d.ts +9 -0
  265. package/dist/types/misc.d.ts.map +1 -0
  266. package/dist/xml/parseXmlAsync.d.ts +4 -0
  267. package/dist/xml/parseXmlAsync.d.ts.map +1 -0
  268. package/dist/xml/parseXmlAsync.js +58 -0
  269. package/dist/xml/parseXmlAsync.js.map +1 -0
  270. package/package.json +24 -35
  271. package/LICENSE.md +0 -21
  272. package/README.md +0 -18
  273. package/cleanDist.json +0 -3
  274. package/entries.json +0 -1
@@ -0,0 +1,4 @@
1
+ declare function animate(duration: number, callback: (progress: number) => unknown, onFinish?: () => unknown): () => void;
2
+
3
+ export { animate };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { addBoundary } from '../number/index.js';
2
+
3
+ function animate(duration, callback, onFinish) {
4
+ let initialTime = void 0;
5
+ let suscription;
6
+ function innerAnimate(current) {
7
+ if (initialTime === void 0)
8
+ initialTime = current;
9
+ const ellapsed = current - initialTime;
10
+ const progress = ellapsed / duration;
11
+ callback(addBoundary(progress, 0, 1));
12
+ if (progress < 1)
13
+ suscription = window.requestAnimationFrame(innerAnimate);
14
+ else
15
+ onFinish?.();
16
+ }
17
+ suscription = window.requestAnimationFrame(innerAnimate);
18
+ return () => {
19
+ window.cancelAnimationFrame(suscription);
20
+ };
21
+ }
22
+
23
+ export { animate };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/animate/index.ts"],"sourcesContent":["import { addBoundary } from '../number';\n\nexport function animate(\n duration: number,\n callback: (progress: number) => unknown,\n onFinish?: () => unknown,\n) {\n let initialTime: number | undefined = undefined;\n let suscription: number;\n\n function innerAnimate(current: number) {\n if (initialTime === undefined) initialTime = current;\n\n const ellapsed = current - initialTime;\n const progress = ellapsed / duration;\n\n callback(addBoundary(progress, 0, 1));\n if (progress < 1) suscription = window.requestAnimationFrame(innerAnimate);\n else onFinish?.();\n }\n\n suscription = window.requestAnimationFrame(innerAnimate);\n\n return () => {\n window.cancelAnimationFrame(suscription);\n };\n}\n"],"names":[],"mappings":";;AAEgB,SAAA,OAAA,CACd,QACA,EAAA,QAAA,EACA,QACA,EAAA;AACA,EAAA,IAAI,WAAkC,GAAA,KAAA,CAAA,CAAA;AACtC,EAAI,IAAA,WAAA,CAAA;AAEJ,EAAA,SAAS,aAAa,OAAiB,EAAA;AACrC,IAAA,IAAI,WAAgB,KAAA,KAAA,CAAA;AAAW,MAAc,WAAA,GAAA,OAAA,CAAA;AAE7C,IAAA,MAAM,WAAW,OAAU,GAAA,WAAA,CAAA;AAC3B,IAAA,MAAM,WAAW,QAAW,GAAA,QAAA,CAAA;AAE5B,IAAA,QAAA,CAAS,WAAY,CAAA,QAAA,EAAU,CAAG,EAAA,CAAC,CAAC,CAAA,CAAA;AACpC,IAAA,IAAI,QAAW,GAAA,CAAA;AAAG,MAAc,WAAA,GAAA,MAAA,CAAO,sBAAsB,YAAY,CAAA,CAAA;AAAA;AACpE,MAAW,QAAA,IAAA,CAAA;AAAA,GAClB;AAEA,EAAc,WAAA,GAAA,MAAA,CAAO,sBAAsB,YAAY,CAAA,CAAA;AAEvD,EAAA,OAAO,MAAM;AACX,IAAA,MAAA,CAAO,qBAAqB,WAAW,CAAA,CAAA;AAAA,GACzC,CAAA;AACF;;;;"}
@@ -0,0 +1,4 @@
1
+ declare function arrayOrArray<T>(o: T | T[] | undefined): T[];
2
+
3
+ export { arrayOrArray as default };
4
+ //# sourceMappingURL=arrayOrArray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayOrArray.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ function arrayOrArray(o) {
2
+ if (o === void 0)
3
+ return [];
4
+ return Array.isArray(o) ? o : [o];
5
+ }
6
+
7
+ export { arrayOrArray as default };
8
+ //# sourceMappingURL=arrayOrArray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayOrArray.js","sources":["../../src/array/arrayOrArray.ts"],"sourcesContent":["export default function arrayOrArray<T>(o: T | T[] | undefined): T[] {\n if (o === undefined) return [];\n\n return (Array.isArray(o) ? o : [o]) as T[];\n}\n"],"names":[],"mappings":"AAAA,SAAwB,aAAgB,CAA6B,EAAA;AACnE,EAAA,IAAI,CAAM,KAAA,KAAA,CAAA;AAAW,IAAA,OAAO,EAAC,CAAA;AAE7B,EAAA,OAAQ,MAAM,OAAQ,CAAA,CAAC,CAAI,GAAA,CAAA,GAAI,CAAC,CAAC,CAAA,CAAA;AACnC;;;;"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This function gets an array of elements of any kind and an array of
3
+ * functions which will be called to test conditions and will return element
4
+ * whose index equals the matching condition's index
5
+ *
6
+ * @param arr An array of elements of any kind
7
+ * @param conditions An array of conditions, which will be tested in order to determine which index of the array will be returned
8
+ * @param defaultIndex The return value in case that no condition matches
9
+ * @returns An element of the array if any of the conditions matches or the defaultIndex otherwise
10
+ */
11
+ declare function getIndex<T = unknown>(arr: T[], conditions: (boolean | (() => boolean))[], defaultIndex?: number): T;
12
+
13
+ export { getIndex };
14
+ //# sourceMappingURL=getIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIndex.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import isFunction from 'lodash-es/isFunction';
2
+
3
+ function getIndex(arr, conditions, defaultIndex) {
4
+ for (let i = 0; i < conditions.length; i++) {
5
+ if (typeof conditions[i] === "boolean" && conditions[i] || isFunction(conditions[i]) && conditions[i]())
6
+ return arr[i];
7
+ }
8
+ return arr[defaultIndex ?? -1];
9
+ }
10
+
11
+ export { getIndex };
12
+ //# sourceMappingURL=getIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIndex.js","sources":["../../src/array/getIndex.ts"],"sourcesContent":["import isFunction from 'lodash-es/isFunction';\n\n/**\n * This function gets an array of elements of any kind and an array of\n * functions which will be called to test conditions and will return element\n * whose index equals the matching condition's index\n *\n * @param arr An array of elements of any kind\n * @param conditions An array of conditions, which will be tested in order to determine which index of the array will be returned\n * @param defaultIndex The return value in case that no condition matches\n * @returns An element of the array if any of the conditions matches or the defaultIndex otherwise\n */\nexport function getIndex<T = unknown>(\n arr: T[],\n conditions: (boolean | (() => boolean))[],\n defaultIndex?: number,\n): T {\n for (let i = 0; i < conditions.length; i++) {\n if (\n (typeof conditions[i] === 'boolean' && conditions[i]) ||\n (isFunction(conditions[i]) && (conditions[i] as () => boolean)())\n )\n return arr[i];\n }\n return arr[defaultIndex ?? -1];\n}\n"],"names":[],"mappings":";;AAYgB,SAAA,QAAA,CACd,GACA,EAAA,UAAA,EACA,YACG,EAAA;AACH,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,UAAA,CAAW,QAAQ,CAAK,EAAA,EAAA;AAC1C,IAAA,IACG,OAAO,UAAA,CAAW,CAAC,CAAA,KAAM,aAAa,UAAW,CAAA,CAAC,CAClD,IAAA,UAAA,CAAW,WAAW,CAAC,CAAC,CAAM,IAAA,UAAA,CAAW,CAAC,CAAoB,EAAA;AAE/D,MAAA,OAAO,IAAI,CAAC,CAAA,CAAA;AAAA,GAChB;AACA,EAAO,OAAA,GAAA,CAAI,gBAAgB,CAAE,CAAA,CAAA,CAAA;AAC/B;;;;"}
@@ -0,0 +1,4 @@
1
+ declare const decrypt: (salt: string, iv: string, passPhrase: string, cipherText: string, keySize: number, iterationCount: number) => Promise<string>;
2
+
3
+ export { decrypt };
4
+ //# sourceMappingURL=decrypt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decrypt.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { generateKey } from './generateKey.js';
2
+
3
+ const decrypt = async (salt, iv, passPhrase, cipherText, keySize, iterationCount) => {
4
+ const CryptoJS = (await import('crypto-js')).default;
5
+ const key = await generateKey(salt, passPhrase, keySize, iterationCount);
6
+ const cipherParams = CryptoJS.lib.CipherParams.create({
7
+ ciphertext: CryptoJS.enc.Base64.parse(cipherText)
8
+ });
9
+ const decrypted = CryptoJS.AES.decrypt(cipherParams, key, {
10
+ iv: CryptoJS.enc.Hex.parse(iv)
11
+ });
12
+ return decrypted.toString(CryptoJS.enc.Utf8);
13
+ };
14
+
15
+ export { decrypt };
16
+ //# sourceMappingURL=decrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decrypt.js","sources":["../../src/crypto/decrypt.ts"],"sourcesContent":["import { generateKey } from './generateKey';\n\nexport const decrypt = async (\n salt: string,\n iv: string,\n passPhrase: string,\n cipherText: string,\n keySize: number,\n iterationCount: number,\n) => {\n const CryptoJS = (await import('crypto-js')).default;\n const key = await generateKey(salt, passPhrase, keySize, iterationCount);\n const cipherParams = CryptoJS.lib.CipherParams.create({\n ciphertext: CryptoJS.enc.Base64.parse(cipherText),\n });\n const decrypted = CryptoJS.AES.decrypt(cipherParams, key, {\n iv: CryptoJS.enc.Hex.parse(iv),\n });\n return decrypted.toString(CryptoJS.enc.Utf8);\n};\n"],"names":[],"mappings":";;AAEO,MAAM,UAAU,OACrB,IAAA,EACA,IACA,UACA,EAAA,UAAA,EACA,SACA,cACG,KAAA;AACH,EAAA,MAAM,QAAY,GAAA,CAAA,MAAM,OAAO,WAAW,CAAG,EAAA,OAAA,CAAA;AAC7C,EAAA,MAAM,MAAM,MAAM,WAAA,CAAY,IAAM,EAAA,UAAA,EAAY,SAAS,cAAc,CAAA,CAAA;AACvE,EAAA,MAAM,YAAe,GAAA,QAAA,CAAS,GAAI,CAAA,YAAA,CAAa,MAAO,CAAA;AAAA,IACpD,UAAY,EAAA,QAAA,CAAS,GAAI,CAAA,MAAA,CAAO,MAAM,UAAU,CAAA;AAAA,GACjD,CAAA,CAAA;AACD,EAAA,MAAM,SAAY,GAAA,QAAA,CAAS,GAAI,CAAA,OAAA,CAAQ,cAAc,GAAK,EAAA;AAAA,IACxD,EAAI,EAAA,QAAA,CAAS,GAAI,CAAA,GAAA,CAAI,MAAM,EAAE,CAAA;AAAA,GAC9B,CAAA,CAAA;AACD,EAAA,OAAO,SAAU,CAAA,QAAA,CAAS,QAAS,CAAA,GAAA,CAAI,IAAI,CAAA,CAAA;AAC7C;;;;"}
@@ -0,0 +1,4 @@
1
+ declare const encrypt: (salt: string, iv: string, passPhrase: string, plainText: string, keySize: number, iterationCount: number) => Promise<string>;
2
+
3
+ export { encrypt };
4
+ //# sourceMappingURL=encrypt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encrypt.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { generateKey } from './generateKey.js';
2
+
3
+ const encrypt = async (salt, iv, passPhrase, plainText, keySize, iterationCount) => {
4
+ const CryptoJS = (await import('crypto-js')).default;
5
+ const key = await generateKey(salt, passPhrase, keySize, iterationCount);
6
+ const encrypted = CryptoJS.AES.encrypt(plainText, key, {
7
+ iv: CryptoJS.enc.Hex.parse(iv)
8
+ });
9
+ return encrypted.ciphertext.toString(CryptoJS.enc.Base64);
10
+ };
11
+
12
+ export { encrypt };
13
+ //# sourceMappingURL=encrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encrypt.js","sources":["../../src/crypto/encrypt.ts"],"sourcesContent":["import { generateKey } from './generateKey';\n\nexport const encrypt = async (\n salt: string,\n iv: string,\n passPhrase: string,\n plainText: string,\n keySize: number,\n iterationCount: number,\n) => {\n const CryptoJS = (await import('crypto-js')).default;\n const key = await generateKey(salt, passPhrase, keySize, iterationCount);\n const encrypted = CryptoJS.AES.encrypt(plainText, key, {\n iv: CryptoJS.enc.Hex.parse(iv),\n });\n return encrypted.ciphertext.toString(CryptoJS.enc.Base64);\n};\n"],"names":[],"mappings":";;AAEO,MAAM,UAAU,OACrB,IAAA,EACA,IACA,UACA,EAAA,SAAA,EACA,SACA,cACG,KAAA;AACH,EAAA,MAAM,QAAY,GAAA,CAAA,MAAM,OAAO,WAAW,CAAG,EAAA,OAAA,CAAA;AAC7C,EAAA,MAAM,MAAM,MAAM,WAAA,CAAY,IAAM,EAAA,UAAA,EAAY,SAAS,cAAc,CAAA,CAAA;AACvE,EAAA,MAAM,SAAY,GAAA,QAAA,CAAS,GAAI,CAAA,OAAA,CAAQ,WAAW,GAAK,EAAA;AAAA,IACrD,EAAI,EAAA,QAAA,CAAS,GAAI,CAAA,GAAA,CAAI,MAAM,EAAE,CAAA;AAAA,GAC9B,CAAA,CAAA;AACD,EAAA,OAAO,SAAU,CAAA,UAAA,CAAW,QAAS,CAAA,QAAA,CAAS,IAAI,MAAM,CAAA,CAAA;AAC1D;;;;"}
@@ -0,0 +1,11 @@
1
+ const generateKey = async (salt, passPhrase, keySize, iterationCount) => {
2
+ const CryptoJS = (await import('crypto-js')).default;
3
+ const key = CryptoJS.PBKDF2(passPhrase, CryptoJS.enc.Hex.parse(salt), {
4
+ keySize: keySize / 32,
5
+ iterations: iterationCount
6
+ });
7
+ return key;
8
+ };
9
+
10
+ export { generateKey };
11
+ //# sourceMappingURL=generateKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateKey.js","sources":["../../src/crypto/generateKey.ts"],"sourcesContent":["export const generateKey = async (\n salt: string,\n passPhrase: string,\n keySize: number,\n iterationCount: number,\n) => {\n const CryptoJS = (await import('crypto-js')).default;\n const key = CryptoJS.PBKDF2(passPhrase, CryptoJS.enc.Hex.parse(salt), {\n keySize: keySize / 32,\n iterations: iterationCount,\n });\n return key;\n};\n"],"names":[],"mappings":"AAAO,MAAM,WAAc,GAAA,OACzB,IACA,EAAA,UAAA,EACA,SACA,cACG,KAAA;AACH,EAAA,MAAM,QAAY,GAAA,CAAA,MAAM,OAAO,WAAW,CAAG,EAAA,OAAA,CAAA;AAC7C,EAAM,MAAA,GAAA,GAAM,SAAS,MAAO,CAAA,UAAA,EAAY,SAAS,GAAI,CAAA,GAAA,CAAI,KAAM,CAAA,IAAI,CAAG,EAAA;AAAA,IACpE,SAAS,OAAU,GAAA,EAAA;AAAA,IACnB,UAAY,EAAA,cAAA;AAAA,GACb,CAAA,CAAA;AACD,EAAO,OAAA,GAAA,CAAA;AACT;;;;"}
@@ -0,0 +1,4 @@
1
+ declare function apiaDateToStandarFormat(date: string): string;
2
+
3
+ export { apiaDateToStandarFormat };
4
+ //# sourceMappingURL=apiaDateToStandarFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiaDateToStandarFormat.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import dayjs from 'dayjs';
2
+ import { getDateFormat } from './getDateFormat.js';
3
+
4
+ function apiaDateToStandarFormat(date) {
5
+ const newDate = dayjs(date, getDateFormat());
6
+ if (!newDate.isValid())
7
+ return "";
8
+ return newDate.format("YYYY-MM-DD");
9
+ }
10
+
11
+ export { apiaDateToStandarFormat };
12
+ //# sourceMappingURL=apiaDateToStandarFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiaDateToStandarFormat.js","sources":["../../src/date/apiaDateToStandarFormat.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { getDateFormat } from './getDateFormat';\n\nexport function apiaDateToStandarFormat(date: string) {\n const newDate = dayjs(date, getDateFormat());\n if (!newDate.isValid()) return '';\n return newDate.format('YYYY-MM-DD');\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,wBAAwB,IAAc,EAAA;AACpD,EAAA,MAAM,OAAU,GAAA,KAAA,CAAM,IAAM,EAAA,aAAA,EAAe,CAAA,CAAA;AAC3C,EAAI,IAAA,CAAC,QAAQ,OAAQ,EAAA;AAAG,IAAO,OAAA,EAAA,CAAA;AAC/B,EAAO,OAAA,OAAA,CAAQ,OAAO,YAAY,CAAA,CAAA;AACpC;;;;"}
@@ -0,0 +1,4 @@
1
+ declare function dateToApiaFormat(date: string | Date): string;
2
+
3
+ export { dateToApiaFormat };
4
+ //# sourceMappingURL=dateToApiaFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateToApiaFormat.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import dayjs from 'dayjs';
2
+ import { getDateFormat } from './getDateFormat.js';
3
+
4
+ function dateToApiaFormat(date) {
5
+ return dayjs(date).format(getDateFormat());
6
+ }
7
+
8
+ export { dateToApiaFormat };
9
+ //# sourceMappingURL=dateToApiaFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateToApiaFormat.js","sources":["../../src/date/dateToApiaFormat.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { getDateFormat } from './getDateFormat';\n\nexport function dateToApiaFormat(date: string | Date) {\n return dayjs(date).format(getDateFormat());\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,iBAAiB,IAAqB,EAAA;AACpD,EAAA,OAAO,KAAM,CAAA,IAAI,CAAE,CAAA,MAAA,CAAO,eAAe,CAAA,CAAA;AAC3C;;;;"}
@@ -0,0 +1,11 @@
1
+ import { TDateFormat } from '../types/apia/date.js';
2
+
3
+ declare global {
4
+ interface Window {
5
+ DATE_FORMAT: string;
6
+ }
7
+ }
8
+ declare const getDateFormat: () => TDateFormat;
9
+
10
+ export { getDateFormat };
11
+ //# sourceMappingURL=getDateFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDateFormat.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import dayjs from 'dayjs';
2
+ import customParseFormat from 'dayjs/plugin/customParseFormat';
3
+
4
+ dayjs.extend(customParseFormat);
5
+ const DEFAULT_DATE_FORMAT = "DD/MM/YYYY";
6
+ const getDateFormat = () => {
7
+ switch (window.DATE_FORMAT) {
8
+ case "m/d/Y":
9
+ return "MM/DD/YYYY";
10
+ case "d/m/Y":
11
+ return DEFAULT_DATE_FORMAT;
12
+ case "Y/m/d":
13
+ return "YYYY/MM/DD";
14
+ default:
15
+ return "DD/MM/YYYY";
16
+ }
17
+ };
18
+
19
+ export { DEFAULT_DATE_FORMAT, getDateFormat };
20
+ //# sourceMappingURL=getDateFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDateFormat.js","sources":["../../src/date/getDateFormat.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport { TDateFormat } from '../types/apia/date';\n\ndayjs.extend(customParseFormat);\n\ndeclare global {\n interface Window {\n DATE_FORMAT: string;\n }\n}\n\nexport const DEFAULT_DATE_FORMAT: TDateFormat = 'DD/MM/YYYY';\n\nexport const getDateFormat = (): TDateFormat => {\n switch (window.DATE_FORMAT) {\n case 'm/d/Y':\n return 'MM/DD/YYYY';\n case 'd/m/Y':\n return DEFAULT_DATE_FORMAT;\n case 'Y/m/d':\n return 'YYYY/MM/DD';\n default:\n return 'DD/MM/YYYY';\n }\n};\n"],"names":[],"mappings":";;;AAIA,KAAA,CAAM,OAAO,iBAAiB,CAAA,CAAA;AAQvB,MAAM,mBAAmC,GAAA,aAAA;AAEzC,MAAM,gBAAgB,MAAmB;AAC9C,EAAA,QAAQ,OAAO,WAAa;AAAA,IAC1B,KAAK,OAAA;AACH,MAAO,OAAA,YAAA,CAAA;AAAA,IACT,KAAK,OAAA;AACH,MAAO,OAAA,mBAAA,CAAA;AAAA,IACT,KAAK,OAAA;AACH,MAAO,OAAA,YAAA,CAAA;AAAA,IACT;AACE,MAAO,OAAA,YAAA,CAAA;AAAA,GACX;AACF;;;;"}
@@ -0,0 +1,32 @@
1
+ import React__default from 'react';
2
+
3
+ declare global {
4
+ const WP_DEVELOP_MODE: boolean;
5
+ }
6
+ /**
7
+ * Indica si el debugDispatcher fue activado, lo que en muchos casos indica que
8
+ * estamos en ambiente de desarrollo
9
+ */
10
+ declare function isDebugDispatcherEnabled(): boolean;
11
+ type TWindowDDispatch = (action: string, ...parameters: unknown[]) => void;
12
+ type TDispatchCallback = (parameters: unknown[]) => unknown;
13
+ interface IStoredCallback {
14
+ (parameters: unknown[]): unknown;
15
+ help: () => void;
16
+ }
17
+ declare const debugDispatcher: {
18
+ callbacks: Record<string, IStoredCallback[]>;
19
+ actions: Record<string, () => void>;
20
+ on(action: string, cb: TDispatchCallback, help: string | React__default.ReactNode, onlyDevelop?: boolean): () => void;
21
+ off(action: string, cb: TDispatchCallback): void;
22
+ emit: TWindowDDispatch;
23
+ };
24
+ declare global {
25
+ interface Window {
26
+ adt: typeof debugDispatcher;
27
+ dd: typeof debugDispatcher & Record<string, () => unknown>;
28
+ }
29
+ }
30
+
31
+ export { type TDispatchCallback, debugDispatcher, isDebugDispatcherEnabled };
32
+ //# sourceMappingURL=debugDispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugDispatcher.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
1
+ const isEnabled = WP_DEVELOP_MODE;
2
+ function isDebugDispatcherEnabled() {
3
+ return isEnabled;
4
+ }
5
+ const debugDispatcher = new class DDispatcher {
6
+ constructor() {
7
+ this.callbacks = {};
8
+ this.actions = {
9
+ shout: () => {
10
+ console.log(Object.keys(this.callbacks));
11
+ }
12
+ };
13
+ this.emit = (action, ...parameters) => {
14
+ try {
15
+ if (this.actions[action])
16
+ this.actions[action]();
17
+ else {
18
+ if ((this.callbacks[action] ?? []).length === 1)
19
+ return this.callbacks[action]?.[0]?.(parameters);
20
+ (this.callbacks[action] ?? []).forEach((cb) => {
21
+ return cb(parameters);
22
+ });
23
+ }
24
+ return null;
25
+ } catch (e) {
26
+ console.error("DD", e);
27
+ }
28
+ };
29
+ }
30
+ on(action, cb, help, onlyDevelop = false) {
31
+ if (!isEnabled && onlyDevelop)
32
+ return () => {
33
+ };
34
+ if (Object.keys(this.actions).includes(action))
35
+ throw new Error(
36
+ `The action ${action} is a reserved word for the dispatcher.`
37
+ );
38
+ if (!this.callbacks[action])
39
+ this.callbacks[action] = [];
40
+ const actionMethod = Object.assign(cb, {
41
+ help: () => {
42
+ if (typeof help === "string")
43
+ console.info(help);
44
+ }
45
+ });
46
+ this.callbacks[action].push(actionMethod);
47
+ this[action] = Object.assign(
48
+ (...props) => {
49
+ this.emit(action, ...props);
50
+ },
51
+ {
52
+ help: () => {
53
+ if (typeof help === "string")
54
+ console.info(help);
55
+ }
56
+ }
57
+ );
58
+ return () => {
59
+ this.off(action, cb);
60
+ };
61
+ }
62
+ off(action, cb) {
63
+ this.callbacks[action] = this.callbacks[action].filter((current) => {
64
+ return current !== cb;
65
+ });
66
+ }
67
+ }();
68
+ window.dd = debugDispatcher;
69
+ window.adt = debugDispatcher;
70
+
71
+ export { debugDispatcher, isDebugDispatcherEnabled };
72
+ //# sourceMappingURL=debugDispatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugDispatcher.js","sources":["../../src/debug/debugDispatcher.ts"],"sourcesContent":["import React from 'react';\n\ndeclare global {\n const WP_DEVELOP_MODE: boolean;\n}\n\nconst isEnabled = WP_DEVELOP_MODE;\n\n/**\n * Indica si el debugDispatcher fue activado, lo que en muchos casos indica que\n * estamos en ambiente de desarrollo\n */\nexport function isDebugDispatcherEnabled() {\n return isEnabled;\n}\n\ntype TWindowDDispatch = (action: string, ...parameters: unknown[]) => void;\nexport type TDispatchCallback = (parameters: unknown[]) => unknown;\ninterface IStoredCallback {\n (parameters: unknown[]): unknown;\n help: () => void;\n}\n\nexport const debugDispatcher = new (class DDispatcher {\n callbacks: Record<string, IStoredCallback[]> = {};\n\n actions: Record<string, () => void> = {\n shout: () => {\n console.log(Object.keys(this.callbacks));\n },\n };\n\n on(\n action: string,\n cb: TDispatchCallback,\n help: string | React.ReactNode,\n onlyDevelop = false,\n ) {\n if (!isEnabled && onlyDevelop) return () => {};\n\n if (Object.keys(this.actions).includes(action))\n throw new Error(\n `The action ${action} is a reserved word for the dispatcher.`,\n );\n if (!this.callbacks[action]) this.callbacks[action] = [];\n const actionMethod = Object.assign(cb, {\n help: () => {\n if (typeof help === 'string') console.info(help);\n },\n });\n this.callbacks[action].push(actionMethod);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this[action] = Object.assign(\n (...props: unknown[]) => {\n this.emit(action, ...props);\n },\n {\n help: () => {\n if (typeof help === 'string') console.info(help);\n },\n },\n );\n return () => {\n this.off(action, cb);\n };\n\n // return () => {};\n }\n\n off(action: string, cb: TDispatchCallback) {\n this.callbacks[action] = this.callbacks[action].filter((current) => {\n return current !== cb;\n });\n }\n\n emit: TWindowDDispatch = (action, ...parameters) => {\n try {\n if (this.actions[action]) this.actions[action]();\n else {\n if ((this.callbacks[action] ?? []).length === 1)\n return this.callbacks[action]?.[0]?.(parameters);\n\n (this.callbacks[action] ?? []).forEach((cb) => {\n return cb(parameters);\n });\n }\n return null;\n } catch (e) {\n console.error('DD', e);\n }\n };\n})();\n\ndeclare global {\n interface Window {\n adt: typeof debugDispatcher;\n dd: typeof debugDispatcher & Record<string, () => unknown>;\n }\n}\n\nwindow.dd = debugDispatcher as typeof debugDispatcher &\n Record<string, () => unknown>;\nwindow.adt = debugDispatcher;\n"],"names":[],"mappings":"AAMA,MAAM,SAAY,GAAA,eAAA,CAAA;AAMX,SAAS,wBAA2B,GAAA;AACzC,EAAO,OAAA,SAAA,CAAA;AACT,CAAA;AASa,MAAA,eAAA,GAAkB,IAAK,MAAM,WAAY,CAAA;AAAA,EAAlB,WAAA,GAAA;AAClC,IAAA,IAAA,CAAA,SAAA,GAA+C,EAAC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 @@
1
+ type TCallback = (ev: KeyboardEvent) => unknown;
2
+ type TKey = {
3
+ key: string;
4
+ altKey?: boolean;
5
+ ctrlKey?: boolean;
6
+ shiftKey?: boolean;
7
+ };
8
+ type TShortcutBranch = {
9
+ key: TKey;
10
+ children: TShortcutBranch[];
11
+ callbacks: TCallback[];
12
+ fireEvenFromInputs?: boolean;
13
+ };
14
+ declare const shortcutController: {
15
+ history: TKey[];
16
+ candidates: TShortcutBranch[];
17
+ shortcuts: TShortcutBranch;
18
+ shortcutsStrings: string[];
19
+ categories: {
20
+ dev: string[];
21
+ };
22
+ parseKeyToString(key: string | TKey): string;
23
+ parseKey(keyString: string): TKey;
24
+ /**
25
+ * Para setear un shorcut se puede pasar un string representativo con la
26
+ * forma:
27
+ *
28
+ * **alt**?&**ctrl**?&**shift**?&**(\w)**
29
+ *
30
+ * Donde: alt? ctrl? shift? implica que cualquiera de esas palabras pueden o
31
+ * no aparecer y (\w) es una letra, símbolo o número.
32
+ *
33
+ * Puede aparecer cualquier tecla de control o no, pero el símbolo o letra
34
+ * debe aparecer.
35
+ *
36
+ * @param category
37
+ * Agrega un prefijo de teclas que se deben presionar antes del shortcut para
38
+ * que funcione, de forma que por ejemplo, todos los shortcuts de la categoría
39
+ * dev serán ejecutados solamente si antes se presionó shift&D
40
+ *
41
+ * @example
42
+ *
43
+ shortcutController.on(['shift&A', 'b', 'ctrl&c', 'alt&d'], (ev) => {
44
+ ev.preventDefault();
45
+ console.log('Abctrl+cd'),
46
+ }); // Este shortcut se ejecuta en desarrollo y producción
47
+
48
+ shortcutController.on('unshortcut'.split(''), (ev) => {
49
+ ev.preventDefault();
50
+ console.log('Abctrl+cd'),
51
+ }, 'dev'); // Este shortcut solo se ejecuta en desarrollo
52
+ */
53
+ on(keys: (string | TKey)[], callback: TCallback, category?: keyof typeof this.categories, fireEvenFromInputs?: boolean): void;
54
+ };
55
+
56
+ export { type TCallback, type TKey, type TShortcutBranch, shortcutController };
57
+ //# sourceMappingURL=shortcutController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcutController.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,152 @@
1
+ import { debugDispatcher, isDebugDispatcherEnabled } from './debugDispatcher.js';
2
+
3
+ const shortcutController = new class ShortcutController {
4
+ constructor() {
5
+ this.history = [];
6
+ this.candidates = [];
7
+ this.shortcuts = {
8
+ callbacks: [],
9
+ children: [],
10
+ key: { key: "" }
11
+ };
12
+ this.shortcutsStrings = [];
13
+ this.categories = {
14
+ dev: ["shift&D"]
15
+ };
16
+ document.addEventListener("keydown", (ev) => {
17
+ if (ev.key?.length !== 1 && ev.key !== "Escape")
18
+ return;
19
+ this.candidates = [
20
+ ...this.candidates.reduce(
21
+ (accumulated, current) => [
22
+ ...accumulated,
23
+ ...current.children.filter(
24
+ (child) => child.key.key === ev.key && child.key.altKey === ev.altKey && child.key.ctrlKey === ev.ctrlKey && child.key.shiftKey === ev.shiftKey
25
+ )
26
+ ],
27
+ []
28
+ ),
29
+ ...this.shortcuts.children.filter(
30
+ (current) => current.key.key === ev.key && current.key.altKey === ev.altKey && current.key.ctrlKey === ev.ctrlKey && current.key.shiftKey === ev.shiftKey
31
+ )
32
+ ];
33
+ this.candidates.forEach((current) => {
34
+ if (current.fireEvenFromInputs || !(!ev.key || ev.key.length > 1 || ["input", "textarea", "select"].includes(
35
+ ev.target.tagName?.toLowerCase()
36
+ ))) {
37
+ if (current.callbacks)
38
+ current.callbacks.forEach((cb) => cb(ev));
39
+ }
40
+ });
41
+ });
42
+ debugDispatcher.on(
43
+ "shortcuts",
44
+ () => {
45
+ console.info(this.shortcutsStrings);
46
+ console.info(this.shortcuts, this.history);
47
+ },
48
+ "Muestra los shortcuts registrados"
49
+ );
50
+ this.on(
51
+ "short".split(""),
52
+ () => {
53
+ this.shortcutsStrings.forEach((shortcut) => console.info(shortcut));
54
+ },
55
+ "dev"
56
+ );
57
+ }
58
+ parseKeyToString(key) {
59
+ if (typeof key === "string")
60
+ return key;
61
+ return `${key.altKey ? "alt&" : ""}${key.ctrlKey ? "ctrl&" : ""}${key.shiftKey ? "shift&" : ""}${key.key}`;
62
+ }
63
+ parseKey(keyString) {
64
+ const elements = keyString.split("&");
65
+ const altKey = elements.includes("alt");
66
+ const ctrlKey = elements.includes("ctrl");
67
+ const shiftKey = elements.includes("shift");
68
+ const key = elements.find(
69
+ (current) => current !== "shift" && current !== "alt" && current !== "ctrl"
70
+ );
71
+ if (!key)
72
+ throw new Error(`parseKey "${keyString}" does not have key.`);
73
+ return {
74
+ key,
75
+ altKey,
76
+ ctrlKey,
77
+ shiftKey
78
+ };
79
+ }
80
+ /**
81
+ * Para setear un shorcut se puede pasar un string representativo con la
82
+ * forma:
83
+ *
84
+ * **alt**?&**ctrl**?&**shift**?&**(\w)**
85
+ *
86
+ * Donde: alt? ctrl? shift? implica que cualquiera de esas palabras pueden o
87
+ * no aparecer y (\w) es una letra, símbolo o número.
88
+ *
89
+ * Puede aparecer cualquier tecla de control o no, pero el símbolo o letra
90
+ * debe aparecer.
91
+ *
92
+ * @param category
93
+ * Agrega un prefijo de teclas que se deben presionar antes del shortcut para
94
+ * que funcione, de forma que por ejemplo, todos los shortcuts de la categoría
95
+ * dev serán ejecutados solamente si antes se presionó shift&D
96
+ *
97
+ * @example
98
+ *
99
+ shortcutController.on(['shift&A', 'b', 'ctrl&c', 'alt&d'], (ev) => {
100
+ ev.preventDefault();
101
+ console.log('Abctrl+cd'),
102
+ }); // Este shortcut se ejecuta en desarrollo y producción
103
+
104
+ shortcutController.on('unshortcut'.split(''), (ev) => {
105
+ ev.preventDefault();
106
+ console.log('Abctrl+cd'),
107
+ }, 'dev'); // Este shortcut solo se ejecuta en desarrollo
108
+ */
109
+ on(keys, callback, category, fireEvenFromInputs) {
110
+ if (category === "dev" && !isDebugDispatcherEnabled())
111
+ return;
112
+ let container = this.shortcuts;
113
+ const actualKeys = category ? [...this.categories[category], ...keys] : keys;
114
+ if (this.shortcutsStrings.includes(
115
+ actualKeys.map((current) => this.parseKeyToString(current)).join("")
116
+ )) {
117
+ console.warn(
118
+ `The shortcut ${actualKeys.map((current) => this.parseKeyToString(current)).join(
119
+ ""
120
+ )} is being setted twice. The controller wont register more than one instance but this could be a hint if some unexpected behavior.`
121
+ );
122
+ return;
123
+ }
124
+ for (const key of actualKeys) {
125
+ const actualKey = typeof key === "string" ? this.parseKey(key) : key;
126
+ if (actualKey.key === "")
127
+ throw new Error(`Empty key ('') is not allowed`);
128
+ const keyContainer = container.children.find(
129
+ (current) => current.key.key === actualKey.key || current.key.key === "" && current.key.altKey === actualKey.altKey && current.key.ctrlKey === actualKey.ctrlKey && current.key.shiftKey === actualKey.shiftKey && current.fireEvenFromInputs === fireEvenFromInputs
130
+ );
131
+ if (keyContainer)
132
+ container = keyContainer;
133
+ else {
134
+ const newContainer = {
135
+ callbacks: [],
136
+ children: [],
137
+ key: actualKey,
138
+ fireEvenFromInputs
139
+ };
140
+ container.children.push(newContainer);
141
+ container = newContainer;
142
+ }
143
+ }
144
+ this.shortcutsStrings.push(
145
+ actualKeys.map((current) => this.parseKeyToString(current)).join("")
146
+ );
147
+ container.callbacks.push(callback);
148
+ }
149
+ }();
150
+
151
+ export { shortcutController };
152
+ //# sourceMappingURL=shortcutController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcutController.js","sources":["../../src/debug/shortcutController.ts"],"sourcesContent":["import { debugDispatcher, isDebugDispatcherEnabled } from './debugDispatcher';\n\nexport type TCallback = (ev: KeyboardEvent) => unknown;\n\nexport type TKey = {\n key: string;\n altKey?: boolean;\n ctrlKey?: boolean;\n shiftKey?: boolean;\n};\n\nexport type TShortcutBranch = {\n key: TKey;\n children: TShortcutBranch[];\n callbacks: TCallback[];\n fireEvenFromInputs?: boolean;\n};\n\nexport const shortcutController = new (class ShortcutController {\n history: TKey[] = [];\n\n candidates: TShortcutBranch[] = [];\n\n shortcuts: TShortcutBranch = {\n callbacks: [],\n children: [],\n key: { key: '' },\n };\n\n shortcutsStrings: string[] = [];\n\n categories = {\n dev: ['shift&D'],\n };\n\n constructor() {\n document.addEventListener('keydown', (ev) => {\n if (ev.key?.length !== 1 && ev.key !== 'Escape') return;\n this.candidates = [\n ...this.candidates.reduce<TShortcutBranch[]>(\n (accumulated, current) => [\n ...accumulated,\n ...current.children.filter(\n (child) =>\n child.key.key === ev.key &&\n child.key.altKey === ev.altKey &&\n child.key.ctrlKey === ev.ctrlKey &&\n child.key.shiftKey === ev.shiftKey,\n ),\n ],\n [],\n ),\n ...this.shortcuts.children.filter(\n (current) =>\n current.key.key === ev.key &&\n current.key.altKey === ev.altKey &&\n current.key.ctrlKey === ev.ctrlKey &&\n current.key.shiftKey === ev.shiftKey,\n ),\n ];\n this.candidates.forEach((current) => {\n if (\n current.fireEvenFromInputs ||\n !(\n !ev.key ||\n ev.key.length > 1 ||\n ['input', 'textarea', 'select'].includes(\n (ev.target as HTMLElement).tagName?.toLowerCase(),\n )\n )\n ) {\n if (current.callbacks) current.callbacks.forEach((cb) => cb(ev));\n }\n });\n });\n\n debugDispatcher.on(\n 'shortcuts',\n () => {\n console.info(this.shortcutsStrings);\n console.info(this.shortcuts, this.history);\n },\n 'Muestra los shortcuts registrados',\n );\n this.on(\n 'short'.split(''),\n () => {\n this.shortcutsStrings.forEach((shortcut) => console.info(shortcut));\n },\n 'dev',\n );\n }\n\n parseKeyToString(key: string | TKey) {\n if (typeof key === 'string') return key;\n\n return `${key.altKey ? 'alt&' : ''}${key.ctrlKey ? 'ctrl&' : ''}${\n key.shiftKey ? 'shift&' : ''\n }${key.key}`;\n }\n\n parseKey(keyString: string): TKey {\n const elements = keyString.split('&');\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const altKey = elements.includes('alt');\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const ctrlKey = elements.includes('ctrl');\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const shiftKey = elements.includes('shift');\n const key = elements.find(\n (current) =>\n current !== 'shift' && current !== 'alt' && current !== 'ctrl',\n );\n if (!key) throw new Error(`parseKey \"${keyString}\" does not have key.`);\n\n return {\n key,\n altKey,\n ctrlKey,\n shiftKey,\n };\n }\n\n /**\n * Para setear un shorcut se puede pasar un string representativo con la\n * forma:\n *\n * **alt**?&**ctrl**?&**shift**?&**(\\w)**\n *\n * Donde: alt? ctrl? shift? implica que cualquiera de esas palabras pueden o\n * no aparecer y (\\w) es una letra, símbolo o número.\n *\n * Puede aparecer cualquier tecla de control o no, pero el símbolo o letra\n * debe aparecer.\n *\n * @param category\n * Agrega un prefijo de teclas que se deben presionar antes del shortcut para\n * que funcione, de forma que por ejemplo, todos los shortcuts de la categoría\n * dev serán ejecutados solamente si antes se presionó shift&D\n *\n * @example\n *\n shortcutController.on(['shift&A', 'b', 'ctrl&c', 'alt&d'], (ev) => {\n ev.preventDefault();\n console.log('Abctrl+cd'),\n }); // Este shortcut se ejecuta en desarrollo y producción\n\n shortcutController.on('unshortcut'.split(''), (ev) => {\n ev.preventDefault();\n console.log('Abctrl+cd'),\n }, 'dev'); // Este shortcut solo se ejecuta en desarrollo\n */\n on(\n keys: (string | TKey)[],\n callback: TCallback,\n category?: keyof typeof this.categories,\n fireEvenFromInputs?: boolean,\n ) {\n if (category === 'dev' && !isDebugDispatcherEnabled()) return;\n\n let container = this.shortcuts;\n const actualKeys = category\n ? [...this.categories[category], ...keys]\n : keys;\n\n if (\n this.shortcutsStrings.includes(\n actualKeys.map((current) => this.parseKeyToString(current)).join(''),\n )\n ) {\n console.warn(\n `The shortcut ${actualKeys\n .map((current) => this.parseKeyToString(current))\n .join(\n '',\n )} is being setted twice. The controller wont register more than one instance but this could be a hint if some unexpected behavior.`,\n );\n return;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key of actualKeys) {\n const actualKey = typeof key === 'string' ? this.parseKey(key) : key;\n if (actualKey.key === '')\n throw new Error(`Empty key ('') is not allowed`);\n const keyContainer = container.children.find(\n (current) =>\n current.key.key === actualKey.key ||\n (current.key.key === '' &&\n current.key.altKey === actualKey.altKey &&\n current.key.ctrlKey === actualKey.ctrlKey &&\n current.key.shiftKey === actualKey.shiftKey &&\n current.fireEvenFromInputs === fireEvenFromInputs),\n );\n if (keyContainer) container = keyContainer;\n else {\n const newContainer = {\n callbacks: [],\n children: [],\n key: actualKey,\n fireEvenFromInputs,\n };\n container.children.push(newContainer);\n container = newContainer;\n }\n }\n this.shortcutsStrings.push(\n actualKeys.map((current) => this.parseKeyToString(current)).join(''),\n );\n container.callbacks.push(callback);\n }\n})();\n"],"names":[],"mappings":";;AAkBa,MAAA,kBAAA,GAAqB,IAAK,MAAM,kBAAmB,CAAA;AAAA,EAiB9D,WAAc,GAAA;AAhBd,IAAA,IAAA,CAAA,OAAA,GAAkB,EAAC,CAAA;AAEnB,IAAA,IAAA,CAAA,UAAA,GAAgC,EAAC,CAAA;AAEjC,IAA6B,IAAA,CAAA,SAAA,GAAA;AAAA,MAC3B,WAAW,EAAC;AAAA,MACZ,UAAU,EAAC;AAAA,MACX,GAAA,EAAK,EAAE,GAAA,EAAK,EAAG,EAAA;AAAA,KACjB,CAAA;AAEA,IAAA,IAAA,CAAA,gBAAA,GAA6B,EAAC,CAAA;AAE9B,IAAa,IAAA,CAAA,UAAA,GAAA;AAAA,MACX,GAAA,EAAK,CAAC,SAAS,CAAA;AAAA,KACjB,CAAA;AAGE,IAAS,QAAA,CAAA,gBAAA,CAAiB,SAAW,EAAA,CAAC,EAAO,KAAA;AAC3C,MAAA,IAAI,EAAG,CAAA,GAAA,EAAK,MAAW,KAAA,CAAA,IAAK,GAAG,GAAQ,KAAA,QAAA;AAAU,QAAA,OAAA;AACjD,MAAA,IAAA,CAAK,UAAa,GAAA;AAAA,QAChB,GAAG,KAAK,UAAW,CAAA,MAAA;AAAA,UACjB,CAAC,aAAa,OAAY,KAAA;AAAA,YACxB,GAAG,WAAA;AAAA,YACH,GAAG,QAAQ,QAAS,CAAA,MAAA;AAAA,cAClB,CAAC,UACC,KAAM,CAAA,GAAA,CA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