@apia/util 2.0.11 → 3.0.2

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 (270) hide show
  1. package/dist/index.d.ts +1865 -68
  2. package/dist/index.js +2650 -62
  3. package/dist/index.js.map +1 -1
  4. package/package.json +4 -3
  5. package/dist/animate/index.d.ts +0 -4
  6. package/dist/animate/index.d.ts.map +0 -1
  7. package/dist/animate/index.js +0 -24
  8. package/dist/animate/index.js.map +0 -1
  9. package/dist/array/arrayOrArray.d.ts +0 -4
  10. package/dist/array/arrayOrArray.d.ts.map +0 -1
  11. package/dist/array/arrayOrArray.js +0 -8
  12. package/dist/array/arrayOrArray.js.map +0 -1
  13. package/dist/array/getIndex.d.ts +0 -14
  14. package/dist/array/getIndex.d.ts.map +0 -1
  15. package/dist/array/getIndex.js +0 -12
  16. package/dist/array/getIndex.js.map +0 -1
  17. package/dist/crypto/decrypt.d.ts +0 -4
  18. package/dist/crypto/decrypt.d.ts.map +0 -1
  19. package/dist/crypto/decrypt.js +0 -16
  20. package/dist/crypto/decrypt.js.map +0 -1
  21. package/dist/crypto/encrypt.d.ts +0 -4
  22. package/dist/crypto/encrypt.d.ts.map +0 -1
  23. package/dist/crypto/encrypt.js +0 -13
  24. package/dist/crypto/encrypt.js.map +0 -1
  25. package/dist/crypto/generateKey.js +0 -11
  26. package/dist/crypto/generateKey.js.map +0 -1
  27. package/dist/date/apiaDateToStandarFormat.d.ts +0 -4
  28. package/dist/date/apiaDateToStandarFormat.d.ts.map +0 -1
  29. package/dist/date/apiaDateToStandarFormat.js +0 -12
  30. package/dist/date/apiaDateToStandarFormat.js.map +0 -1
  31. package/dist/date/dateToApiaFormat.d.ts +0 -4
  32. package/dist/date/dateToApiaFormat.d.ts.map +0 -1
  33. package/dist/date/dateToApiaFormat.js +0 -9
  34. package/dist/date/dateToApiaFormat.js.map +0 -1
  35. package/dist/date/getDateFormat.d.ts +0 -11
  36. package/dist/date/getDateFormat.d.ts.map +0 -1
  37. package/dist/date/getDateFormat.js +0 -20
  38. package/dist/date/getDateFormat.js.map +0 -1
  39. package/dist/debug/debugDispatcher.d.ts +0 -36
  40. package/dist/debug/debugDispatcher.d.ts.map +0 -1
  41. package/dist/debug/debugDispatcher.js +0 -75
  42. package/dist/debug/debugDispatcher.js.map +0 -1
  43. package/dist/debug/shortcutController.d.ts +0 -57
  44. package/dist/debug/shortcutController.d.ts.map +0 -1
  45. package/dist/debug/shortcutController.js +0 -152
  46. package/dist/debug/shortcutController.js.map +0 -1
  47. package/dist/documents/downloadStringAsDoc.d.ts +0 -8
  48. package/dist/documents/downloadStringAsDoc.d.ts.map +0 -1
  49. package/dist/documents/downloadStringAsDoc.js +0 -12
  50. package/dist/documents/downloadStringAsDoc.js.map +0 -1
  51. package/dist/documents/downloadUrl.d.ts +0 -20
  52. package/dist/documents/downloadUrl.d.ts.map +0 -1
  53. package/dist/documents/downloadUrl.js +0 -18
  54. package/dist/documents/downloadUrl.js.map +0 -1
  55. package/dist/documents/openAndReadFile.d.ts +0 -4
  56. package/dist/documents/openAndReadFile.d.ts.map +0 -1
  57. package/dist/documents/openAndReadFile.js +0 -29
  58. package/dist/documents/openAndReadFile.js.map +0 -1
  59. package/dist/dom/autoDisconnectMutationObserver.d.ts +0 -17
  60. package/dist/dom/autoDisconnectMutationObserver.d.ts.map +0 -1
  61. package/dist/dom/autoDisconnectMutationObserver.js +0 -35
  62. package/dist/dom/autoDisconnectMutationObserver.js.map +0 -1
  63. package/dist/dom/customEvents.d.ts +0 -40
  64. package/dist/dom/customEvents.d.ts.map +0 -1
  65. package/dist/dom/customEvents.js +0 -34
  66. package/dist/dom/customEvents.js.map +0 -1
  67. package/dist/dom/enableChildrenFocus.d.ts +0 -18
  68. package/dist/dom/enableChildrenFocus.d.ts.map +0 -1
  69. package/dist/dom/enableChildrenFocus.js +0 -26
  70. package/dist/dom/enableChildrenFocus.js.map +0 -1
  71. package/dist/dom/findOffsetRelativeToScrollParent.d.ts +0 -7
  72. package/dist/dom/findOffsetRelativeToScrollParent.d.ts.map +0 -1
  73. package/dist/dom/findOffsetRelativeToScrollParent.js +0 -19
  74. package/dist/dom/findOffsetRelativeToScrollParent.js.map +0 -1
  75. package/dist/dom/findScrollContainer.d.ts +0 -8
  76. package/dist/dom/findScrollContainer.d.ts.map +0 -1
  77. package/dist/dom/findScrollContainer.js +0 -9
  78. package/dist/dom/findScrollContainer.js.map +0 -1
  79. package/dist/dom/getFocusSelector.d.ts +0 -25
  80. package/dist/dom/getFocusSelector.d.ts.map +0 -1
  81. package/dist/dom/getFocusSelector.js +0 -30
  82. package/dist/dom/getFocusSelector.js.map +0 -1
  83. package/dist/dom/getSpecificParent.d.ts +0 -23
  84. package/dist/dom/getSpecificParent.d.ts.map +0 -1
  85. package/dist/dom/getSpecificParent.js +0 -19
  86. package/dist/dom/getSpecificParent.js.map +0 -1
  87. package/dist/dom/isChild.d.ts +0 -13
  88. package/dist/dom/isChild.d.ts.map +0 -1
  89. package/dist/dom/isChild.js +0 -8
  90. package/dist/dom/isChild.js.map +0 -1
  91. package/dist/dom/scrollParentIntoElement.d.ts +0 -9
  92. package/dist/dom/scrollParentIntoElement.d.ts.map +0 -1
  93. package/dist/dom/scrollParentIntoElement.js +0 -24
  94. package/dist/dom/scrollParentIntoElement.js.map +0 -1
  95. package/dist/dom/url.d.ts +0 -18
  96. package/dist/dom/url.d.ts.map +0 -1
  97. package/dist/dom/url.js +0 -52
  98. package/dist/dom/url.js.map +0 -1
  99. package/dist/dom/usePanAndZoom.d.ts +0 -14
  100. package/dist/dom/usePanAndZoom.d.ts.map +0 -1
  101. package/dist/dom/usePanAndZoom.js +0 -111
  102. package/dist/dom/usePanAndZoom.js.map +0 -1
  103. package/dist/encoding/index.d.ts +0 -8
  104. package/dist/encoding/index.d.ts.map +0 -1
  105. package/dist/encoding/index.js +0 -12
  106. package/dist/encoding/index.js.map +0 -1
  107. package/dist/events/BouncingEmitter.d.ts +0 -67
  108. package/dist/events/BouncingEmitter.d.ts.map +0 -1
  109. package/dist/events/BouncingEmitter.js +0 -72
  110. package/dist/events/BouncingEmitter.js.map +0 -1
  111. package/dist/events/EventEmitter.d.ts +0 -47
  112. package/dist/events/EventEmitter.d.ts.map +0 -1
  113. package/dist/events/EventEmitter.js +0 -75
  114. package/dist/events/EventEmitter.js.map +0 -1
  115. package/dist/events/StatefulEmitter.d.ts +0 -44
  116. package/dist/events/StatefulEmitter.d.ts.map +0 -1
  117. package/dist/events/StatefulEmitter.js +0 -57
  118. package/dist/events/StatefulEmitter.js.map +0 -1
  119. package/dist/events/types.d.ts +0 -29
  120. package/dist/events/types.d.ts.map +0 -1
  121. package/dist/focus/focusController.d.ts +0 -108
  122. package/dist/focus/focusController.d.ts.map +0 -1
  123. package/dist/focus/focusController.js +0 -295
  124. package/dist/focus/focusController.js.map +0 -1
  125. package/dist/focus/globalFocus.d.ts +0 -24
  126. package/dist/focus/globalFocus.d.ts.map +0 -1
  127. package/dist/focus/globalFocus.js +0 -87
  128. package/dist/focus/globalFocus.js.map +0 -1
  129. package/dist/history/History.d.ts +0 -81
  130. package/dist/history/History.d.ts.map +0 -1
  131. package/dist/history/History.js +0 -122
  132. package/dist/history/History.js.map +0 -1
  133. package/dist/hooks/useCombinedRefs.d.ts +0 -18
  134. package/dist/hooks/useCombinedRefs.d.ts.map +0 -1
  135. package/dist/hooks/useCombinedRefs.js +0 -20
  136. package/dist/hooks/useCombinedRefs.js.map +0 -1
  137. package/dist/hooks/useDebouncedCallback.d.ts +0 -7
  138. package/dist/hooks/useDebouncedCallback.d.ts.map +0 -1
  139. package/dist/hooks/useDebouncedCallback.js +0 -21
  140. package/dist/hooks/useDebouncedCallback.js.map +0 -1
  141. package/dist/hooks/useLatest.d.ts +0 -13
  142. package/dist/hooks/useLatest.d.ts.map +0 -1
  143. package/dist/hooks/useLatest.js +0 -10
  144. package/dist/hooks/useLatest.js.map +0 -1
  145. package/dist/hooks/useMount.d.ts +0 -6
  146. package/dist/hooks/useMount.d.ts.map +0 -1
  147. package/dist/hooks/useMount.js +0 -14
  148. package/dist/hooks/useMount.js.map +0 -1
  149. package/dist/hooks/usePrevious.d.ts +0 -6
  150. package/dist/hooks/usePrevious.d.ts.map +0 -1
  151. package/dist/hooks/usePrevious.js +0 -12
  152. package/dist/hooks/usePrevious.js.map +0 -1
  153. package/dist/hooks/useShallowMemo.d.ts +0 -9
  154. package/dist/hooks/useShallowMemo.d.ts.map +0 -1
  155. package/dist/hooks/useShallowMemo.js +0 -42
  156. package/dist/hooks/useShallowMemo.js.map +0 -1
  157. package/dist/hooks/useStateRef.d.ts +0 -10
  158. package/dist/hooks/useStateRef.d.ts.map +0 -1
  159. package/dist/hooks/useStateRef.js +0 -11
  160. package/dist/hooks/useStateRef.js.map +0 -1
  161. package/dist/hooks/useSubscription.d.ts +0 -31
  162. package/dist/hooks/useSubscription.d.ts.map +0 -1
  163. package/dist/hooks/useSubscription.js +0 -21
  164. package/dist/hooks/useSubscription.js.map +0 -1
  165. package/dist/hooks/useUnmount.d.ts +0 -4
  166. package/dist/hooks/useUnmount.d.ts.map +0 -1
  167. package/dist/hooks/useUnmount.js +0 -10
  168. package/dist/hooks/useUnmount.js.map +0 -1
  169. package/dist/hooks/useUpdateEffect.d.ts +0 -10
  170. package/dist/hooks/useUpdateEffect.d.ts.map +0 -1
  171. package/dist/hooks/useUpdateEffect.js +0 -16
  172. package/dist/hooks/useUpdateEffect.js.map +0 -1
  173. package/dist/imperative/makeImperativeComponent.d.ts +0 -56
  174. package/dist/imperative/makeImperativeComponent.d.ts.map +0 -1
  175. package/dist/imperative/makeImperativeComponent.js +0 -43
  176. package/dist/imperative/makeImperativeComponent.js.map +0 -1
  177. package/dist/imperative/makeSingleImperativeComponent.d.ts +0 -15
  178. package/dist/imperative/makeSingleImperativeComponent.d.ts.map +0 -1
  179. package/dist/imperative/makeSingleImperativeComponent.js +0 -31
  180. package/dist/imperative/makeSingleImperativeComponent.js.map +0 -1
  181. package/dist/imperative/types.d.ts +0 -22
  182. package/dist/imperative/types.d.ts.map +0 -1
  183. package/dist/imperative/types.js +0 -8
  184. package/dist/imperative/types.js.map +0 -1
  185. package/dist/imperative/useImperativeComponentEvents.d.ts +0 -6
  186. package/dist/imperative/useImperativeComponentEvents.d.ts.map +0 -1
  187. package/dist/imperative/useImperativeComponentEvents.js +0 -35
  188. package/dist/imperative/useImperativeComponentEvents.js.map +0 -1
  189. package/dist/imperative/useImperativeIdentifierContext.d.ts +0 -14
  190. package/dist/imperative/useImperativeIdentifierContext.d.ts.map +0 -1
  191. package/dist/imperative/useImperativeIdentifierContext.js +0 -10
  192. package/dist/imperative/useImperativeIdentifierContext.js.map +0 -1
  193. package/dist/labels/formatMessage.d.ts +0 -19
  194. package/dist/labels/formatMessage.d.ts.map +0 -1
  195. package/dist/labels/formatMessage.js +0 -13
  196. package/dist/labels/formatMessage.js.map +0 -1
  197. package/dist/labels/getLabel.d.ts +0 -34
  198. package/dist/labels/getLabel.d.ts.map +0 -1
  199. package/dist/labels/getLabel.js +0 -18
  200. package/dist/labels/getLabel.js.map +0 -1
  201. package/dist/number/index.d.ts +0 -29
  202. package/dist/number/index.d.ts.map +0 -1
  203. package/dist/number/index.js +0 -43
  204. package/dist/number/index.js.map +0 -1
  205. package/dist/objects/getValueByPath.d.ts +0 -23
  206. package/dist/objects/getValueByPath.d.ts.map +0 -1
  207. package/dist/objects/getValueByPath.js +0 -19
  208. package/dist/objects/getValueByPath.js.map +0 -1
  209. package/dist/objects/setValueByPath.d.ts +0 -33
  210. package/dist/objects/setValueByPath.d.ts.map +0 -1
  211. package/dist/objects/setValueByPath.js +0 -35
  212. package/dist/objects/setValueByPath.js.map +0 -1
  213. package/dist/propsStore/propsStore.d.ts +0 -42
  214. package/dist/propsStore/propsStore.d.ts.map +0 -1
  215. package/dist/propsStore/propsStore.js +0 -157
  216. package/dist/propsStore/propsStore.js.map +0 -1
  217. package/dist/propsStore/types.d.ts +0 -24
  218. package/dist/propsStore/types.d.ts.map +0 -1
  219. package/dist/propsStore/usePropsSelector.d.ts +0 -67
  220. package/dist/propsStore/usePropsSelector.d.ts.map +0 -1
  221. package/dist/propsStore/usePropsSelector.js +0 -92
  222. package/dist/propsStore/usePropsSelector.js.map +0 -1
  223. package/dist/screenLock/screenLocker.d.ts +0 -60
  224. package/dist/screenLock/screenLocker.d.ts.map +0 -1
  225. package/dist/screenLock/screenLocker.js +0 -95
  226. package/dist/screenLock/screenLocker.js.map +0 -1
  227. package/dist/states/useDebouncedState.d.ts +0 -10
  228. package/dist/states/useDebouncedState.d.ts.map +0 -1
  229. package/dist/states/useDebouncedState.js +0 -22
  230. package/dist/states/useDebouncedState.js.map +0 -1
  231. package/dist/states/useDomState.d.ts +0 -86
  232. package/dist/states/useDomState.d.ts.map +0 -1
  233. package/dist/states/useDomState.js +0 -35
  234. package/dist/states/useDomState.js.map +0 -1
  235. package/dist/storage/StatefulStore.d.ts +0 -205
  236. package/dist/storage/StatefulStore.d.ts.map +0 -1
  237. package/dist/storage/StatefulStore.js +0 -301
  238. package/dist/storage/StatefulStore.js.map +0 -1
  239. package/dist/storage/persistentStorage.d.ts +0 -12
  240. package/dist/storage/persistentStorage.d.ts.map +0 -1
  241. package/dist/storage/persistentStorage.js +0 -28
  242. package/dist/storage/persistentStorage.js.map +0 -1
  243. package/dist/storage/useLocalStorage.d.ts +0 -7
  244. package/dist/storage/useLocalStorage.d.ts.map +0 -1
  245. package/dist/storage/useLocalStorage.js +0 -40
  246. package/dist/storage/useLocalStorage.js.map +0 -1
  247. package/dist/string/alignment.d.ts +0 -25
  248. package/dist/string/alignment.d.ts.map +0 -1
  249. package/dist/string/alignment.js +0 -26
  250. package/dist/string/alignment.js.map +0 -1
  251. package/dist/string/ucfirst.d.ts +0 -4
  252. package/dist/string/ucfirst.d.ts.map +0 -1
  253. package/dist/string/ucfirst.js +0 -6
  254. package/dist/string/ucfirst.js.map +0 -1
  255. package/dist/typeGuards/toBoolean.d.ts +0 -26
  256. package/dist/typeGuards/toBoolean.d.ts.map +0 -1
  257. package/dist/typeGuards/toBoolean.js +0 -11
  258. package/dist/typeGuards/toBoolean.js.map +0 -1
  259. package/dist/types/apia/common.d.ts +0 -114
  260. package/dist/types/apia/common.d.ts.map +0 -1
  261. package/dist/types/apia/date.d.ts +0 -4
  262. package/dist/types/apia/date.d.ts.map +0 -1
  263. package/dist/types/apia/forms.d.ts +0 -221
  264. package/dist/types/apia/forms.d.ts.map +0 -1
  265. package/dist/types/misc.d.ts +0 -9
  266. package/dist/types/misc.d.ts.map +0 -1
  267. package/dist/xml/parseXmlAsync.d.ts +0 -4
  268. package/dist/xml/parseXmlAsync.d.ts.map +0 -1
  269. package/dist/xml/parseXmlAsync.js +0 -58
  270. package/dist/xml/parseXmlAsync.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apia/util",
3
- "version": "2.0.11",
3
+ "version": "3.0.2",
4
4
  "sideEffects": false,
5
5
  "author": "Alexis Leite <alexisleite@live.com>",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "@types/file-saver": "^2.0.5",
18
18
  "@types/lodash-es": "^4.17.12",
19
19
  "@types/xml2js": "^0.4.11",
20
- "typescript": "^5.4.2"
20
+ "typescript": "^5.3.2"
21
21
  },
22
22
  "dependencies": {
23
23
  "crypto-js": "4.1.1"
@@ -37,9 +37,10 @@
37
37
  "stream-browserify": "^3.0.0",
38
38
  "timers": "^0.1.1",
39
39
  "timers-browserify": "^2.0.12",
40
+ "typescript": "5.3.2",
40
41
  "xml2js": "^0.5.0"
41
42
  },
42
- "gitHead": "2baba9f15d947ff574605579b8593604886f690f",
43
+ "gitHead": "1be67c2956d7c0964b4e8a18173af7cde3fc534e",
43
44
  "repository": {
44
45
  "type": "git",
45
46
  "url": "http://corp-gitlab-01.domst.st.net/products/apia/ApiaNPMPackages.git",
@@ -1,4 +0,0 @@
1
- declare function animate(duration: number, callback: (progress: number) => unknown, onFinish?: () => unknown): () => void;
2
-
3
- export { animate };
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/animate/index.ts"],"sourcesContent":["import { addBoundary } from '../number';\r\n\r\nexport function animate(\r\n duration: number,\r\n callback: (progress: number) => unknown,\r\n onFinish?: () => unknown,\r\n) {\r\n let initialTime: number | undefined = undefined;\r\n let suscription: number;\r\n\r\n function innerAnimate(current: number) {\r\n if (initialTime === undefined) initialTime = current;\r\n\r\n const ellapsed = current - initialTime;\r\n const progress = ellapsed / duration;\r\n\r\n callback(addBoundary(progress, 0, 1));\r\n if (progress < 1) suscription = window.requestAnimationFrame(innerAnimate);\r\n else onFinish?.();\r\n }\r\n\r\n suscription = window.requestAnimationFrame(innerAnimate);\r\n\r\n return () => {\r\n window.cancelAnimationFrame(suscription);\r\n };\r\n}\r\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;;;;"}
@@ -1,4 +0,0 @@
1
- declare function arrayOrArray<T>(o: T | T[] | undefined): T[];
2
-
3
- export { arrayOrArray as default };
4
- //# sourceMappingURL=arrayOrArray.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayOrArray.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayOrArray.js","sources":["../../src/array/arrayOrArray.ts"],"sourcesContent":["export default function arrayOrArray<T>(o: T | T[] | undefined): T[] {\r\n if (o === undefined) return [];\r\n\r\n return (Array.isArray(o) ? o : [o]) as T[];\r\n}\r\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;;;;"}
@@ -1,14 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"getIndex.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"getIndex.js","sources":["../../src/array/getIndex.ts"],"sourcesContent":["import isFunction from 'lodash-es/isFunction';\r\n\r\n/**\r\n * This function gets an array of elements of any kind and an array of\r\n * functions which will be called to test conditions and will return element\r\n * whose index equals the matching condition's index\r\n *\r\n * @param arr An array of elements of any kind\r\n * @param conditions An array of conditions, which will be tested in order to determine which index of the array will be returned\r\n * @param defaultIndex The return value in case that no condition matches\r\n * @returns An element of the array if any of the conditions matches or the defaultIndex otherwise\r\n */\r\nexport function getIndex<T = unknown>(\r\n arr: T[],\r\n conditions: (boolean | (() => boolean))[],\r\n defaultIndex?: number,\r\n): T {\r\n for (let i = 0; i < conditions.length; i++) {\r\n if (\r\n (typeof conditions[i] === 'boolean' && conditions[i]) ||\r\n (isFunction(conditions[i]) && (conditions[i] as () => boolean)())\r\n )\r\n return arr[i];\r\n }\r\n return arr[defaultIndex ?? -1];\r\n}\r\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;;;;"}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"decrypt.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"decrypt.js","sources":["../../src/crypto/decrypt.ts"],"sourcesContent":["import { generateKey } from './generateKey';\r\n\r\nexport const decrypt = async (\r\n salt: string,\r\n iv: string,\r\n passPhrase: string,\r\n cipherText: string,\r\n keySize: number,\r\n iterationCount: number,\r\n) => {\r\n const CryptoJS = (await import('crypto-js')).default;\r\n const key = await generateKey(salt, passPhrase, keySize, iterationCount);\r\n const cipherParams = CryptoJS.lib.CipherParams.create({\r\n ciphertext: CryptoJS.enc.Base64.parse(cipherText),\r\n });\r\n const decrypted = CryptoJS.AES.decrypt(cipherParams, key, {\r\n iv: CryptoJS.enc.Hex.parse(iv),\r\n });\r\n return decrypted.toString(CryptoJS.enc.Utf8);\r\n};\r\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;;;;"}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"encrypt.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"encrypt.js","sources":["../../src/crypto/encrypt.ts"],"sourcesContent":["import { generateKey } from './generateKey';\r\n\r\nexport const encrypt = async (\r\n salt: string,\r\n iv: string,\r\n passPhrase: string,\r\n plainText: string,\r\n keySize: number,\r\n iterationCount: number,\r\n) => {\r\n const CryptoJS = (await import('crypto-js')).default;\r\n const key = await generateKey(salt, passPhrase, keySize, iterationCount);\r\n const encrypted = CryptoJS.AES.encrypt(plainText, key, {\r\n iv: CryptoJS.enc.Hex.parse(iv),\r\n });\r\n return encrypted.ciphertext.toString(CryptoJS.enc.Base64);\r\n};\r\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;;;;"}
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateKey.js","sources":["../../src/crypto/generateKey.ts"],"sourcesContent":["export const generateKey = async (\r\n salt: string,\r\n passPhrase: string,\r\n keySize: number,\r\n iterationCount: number,\r\n) => {\r\n const CryptoJS = (await import('crypto-js')).default;\r\n const key = CryptoJS.PBKDF2(passPhrase, CryptoJS.enc.Hex.parse(salt), {\r\n keySize: keySize / 32,\r\n iterations: iterationCount,\r\n });\r\n return key;\r\n};\r\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;;;;"}
@@ -1,4 +0,0 @@
1
- declare function apiaDateToStandarFormat(date: string): string;
2
-
3
- export { apiaDateToStandarFormat };
4
- //# sourceMappingURL=apiaDateToStandarFormat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiaDateToStandarFormat.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiaDateToStandarFormat.js","sources":["../../src/date/apiaDateToStandarFormat.ts"],"sourcesContent":["import dayjs from 'dayjs';\r\nimport { getDateFormat } from './getDateFormat';\r\n\r\nexport function apiaDateToStandarFormat(date: string) {\r\n const newDate = dayjs(date, getDateFormat());\r\n if (!newDate.isValid()) return '';\r\n return newDate.format('YYYY-MM-DD');\r\n}\r\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;;;;"}
@@ -1,4 +0,0 @@
1
- declare function dateToApiaFormat(date: string | Date): string;
2
-
3
- export { dateToApiaFormat };
4
- //# sourceMappingURL=dateToApiaFormat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dateToApiaFormat.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"dateToApiaFormat.js","sources":["../../src/date/dateToApiaFormat.ts"],"sourcesContent":["import dayjs from 'dayjs';\r\nimport { getDateFormat } from './getDateFormat';\r\n\r\nexport function dateToApiaFormat(date: string | Date) {\r\n return dayjs(date).format(getDateFormat());\r\n}\r\n"],"names":[],"mappings":";;;AAGO,SAAS,iBAAiB,IAAqB,EAAA;AACpD,EAAA,OAAO,KAAM,CAAA,IAAI,CAAE,CAAA,MAAA,CAAO,eAAe,CAAA,CAAA;AAC3C;;;;"}
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDateFormat.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDateFormat.js","sources":["../../src/date/getDateFormat.ts"],"sourcesContent":["import dayjs from 'dayjs';\r\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\r\nimport { TDateFormat } from '../types/apia/date';\r\n\r\ndayjs.extend(customParseFormat);\r\n\r\ndeclare global {\r\n interface Window {\r\n DATE_FORMAT: string;\r\n }\r\n}\r\n\r\nexport const DEFAULT_DATE_FORMAT: TDateFormat = 'DD/MM/YYYY';\r\n\r\nexport const getDateFormat = (): TDateFormat => {\r\n switch (window.DATE_FORMAT) {\r\n case 'm/d/Y':\r\n return 'MM/DD/YYYY';\r\n case 'd/m/Y':\r\n return DEFAULT_DATE_FORMAT;\r\n case 'Y/m/d':\r\n return 'YYYY/MM/DD';\r\n default:\r\n return 'DD/MM/YYYY';\r\n }\r\n};\r\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;;;;"}
@@ -1,36 +0,0 @@
1
- import React__default from 'react';
2
-
3
- /**
4
- * Indica si el debugDispatcher fue activado, lo que en muchos casos indica que
5
- * estamos en ambiente de desarrollo
6
- */
7
- declare function isDebugDispatcherEnabled(): boolean;
8
- /**
9
- * El debug dispatcher solamente debería activarse en modo desarrollo. Este
10
- * control solamente puede hacerse desde la aplicación principal, por ello, para
11
- * activar el debugDispatcher se exporta este método que debe llamarse cuando
12
- * sea correcto.
13
- */
14
- declare function enableDebugDispatcher(): void;
15
- type TWindowDDispatch = (action: string, ...parameters: unknown[]) => void;
16
- type TDispatchCallback = (parameters: unknown[]) => unknown;
17
- interface IStoredCallback {
18
- (parameters: unknown[]): unknown;
19
- help: () => void;
20
- }
21
- declare const debugDispatcher: {
22
- callbacks: Record<string, IStoredCallback[]>;
23
- actions: Record<string, () => void>;
24
- on(action: string, cb: TDispatchCallback, help: string | React__default.ReactNode, onlyDevelop?: boolean): () => void;
25
- off(action: string, cb: TDispatchCallback): void;
26
- emit: TWindowDDispatch;
27
- };
28
- declare global {
29
- interface Window {
30
- adt: typeof debugDispatcher;
31
- dd: typeof debugDispatcher & Record<string, () => unknown>;
32
- }
33
- }
34
-
35
- export { type TDispatchCallback, debugDispatcher, enableDebugDispatcher, isDebugDispatcherEnabled };
36
- //# sourceMappingURL=debugDispatcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debugDispatcher.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,75 +0,0 @@
1
- let isEnabled = false;
2
- function isDebugDispatcherEnabled() {
3
- return isEnabled;
4
- }
5
- function enableDebugDispatcher() {
6
- isEnabled = true;
7
- }
8
- const debugDispatcher = new class DDispatcher {
9
- constructor() {
10
- this.callbacks = {};
11
- this.actions = {
12
- shout: () => {
13
- console.log(Object.keys(this.callbacks));
14
- }
15
- };
16
- this.emit = (action, ...parameters) => {
17
- try {
18
- if (this.actions[action])
19
- this.actions[action]();
20
- else {
21
- if ((this.callbacks[action] ?? []).length === 1)
22
- return this.callbacks[action]?.[0]?.(parameters);
23
- (this.callbacks[action] ?? []).forEach((cb) => {
24
- return cb(parameters);
25
- });
26
- }
27
- return null;
28
- } catch (e) {
29
- console.error("DD", e);
30
- }
31
- };
32
- }
33
- on(action, cb, help, onlyDevelop = false) {
34
- if (!isEnabled && onlyDevelop)
35
- return () => {
36
- };
37
- if (Object.keys(this.actions).includes(action))
38
- throw new Error(
39
- `The action ${action} is a reserved word for the dispatcher.`
40
- );
41
- if (!this.callbacks[action])
42
- this.callbacks[action] = [];
43
- const actionMethod = Object.assign(cb, {
44
- help: () => {
45
- if (typeof help === "string")
46
- console.info(help);
47
- }
48
- });
49
- this.callbacks[action].push(actionMethod);
50
- this[action] = Object.assign(
51
- (...props) => {
52
- this.emit(action, ...props);
53
- },
54
- {
55
- help: () => {
56
- if (typeof help === "string")
57
- console.info(help);
58
- }
59
- }
60
- );
61
- return () => {
62
- this.off(action, cb);
63
- };
64
- }
65
- off(action, cb) {
66
- this.callbacks[action] = this.callbacks[action].filter((current) => {
67
- return current !== cb;
68
- });
69
- }
70
- }();
71
- window.dd = debugDispatcher;
72
- window.adt = debugDispatcher;
73
-
74
- export { debugDispatcher, enableDebugDispatcher, isDebugDispatcherEnabled };
75
- //# sourceMappingURL=debugDispatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debugDispatcher.js","sources":["../../src/debug/debugDispatcher.ts"],"sourcesContent":["/* eslint-disable comment-length/limit-multi-line-comments */\r\nimport React from 'react';\r\n\r\nlet isEnabled = false;\r\n\r\n/**\r\n * Indica si el debugDispatcher fue activado, lo que en muchos casos indica que\r\n * estamos en ambiente de desarrollo\r\n */\r\nexport function isDebugDispatcherEnabled() {\r\n return isEnabled;\r\n}\r\n\r\n/**\r\n * El debug dispatcher solamente debería activarse en modo desarrollo. Este\r\n * control solamente puede hacerse desde la aplicación principal, por ello, para\r\n * activar el debugDispatcher se exporta este método que debe llamarse cuando\r\n * sea correcto.\r\n */\r\nexport function enableDebugDispatcher() {\r\n isEnabled = true;\r\n}\r\n\r\ntype TWindowDDispatch = (action: string, ...parameters: unknown[]) => void;\r\nexport type TDispatchCallback = (parameters: unknown[]) => unknown;\r\ninterface IStoredCallback {\r\n (parameters: unknown[]): unknown;\r\n help: () => void;\r\n}\r\n\r\nexport const debugDispatcher = new (class DDispatcher {\r\n callbacks: Record<string, IStoredCallback[]> = {};\r\n\r\n actions: Record<string, () => void> = {\r\n shout: () => {\r\n console.log(Object.keys(this.callbacks));\r\n },\r\n };\r\n\r\n on(\r\n action: string,\r\n cb: TDispatchCallback,\r\n help: string | React.ReactNode,\r\n onlyDevelop = false,\r\n ) {\r\n if (!isEnabled && onlyDevelop) return () => {};\r\n\r\n if (Object.keys(this.actions).includes(action))\r\n throw new Error(\r\n `The action ${action} is a reserved word for the dispatcher.`,\r\n );\r\n if (!this.callbacks[action]) this.callbacks[action] = [];\r\n const actionMethod = Object.assign(cb, {\r\n help: () => {\r\n if (typeof help === 'string') console.info(help);\r\n },\r\n });\r\n this.callbacks[action].push(actionMethod);\r\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\r\n // @ts-expect-error\r\n this[action] = Object.assign(\r\n (...props: unknown[]) => {\r\n this.emit(action, ...props);\r\n },\r\n {\r\n help: () => {\r\n if (typeof help === 'string') console.info(help);\r\n },\r\n },\r\n );\r\n return () => {\r\n this.off(action, cb);\r\n };\r\n\r\n // return () => {};\r\n }\r\n\r\n off(action: string, cb: TDispatchCallback) {\r\n this.callbacks[action] = this.callbacks[action].filter((current) => {\r\n return current !== cb;\r\n });\r\n }\r\n\r\n emit: TWindowDDispatch = (action, ...parameters) => {\r\n try {\r\n if (this.actions[action]) this.actions[action]();\r\n else {\r\n if ((this.callbacks[action] ?? []).length === 1)\r\n return this.callbacks[action]?.[0]?.(parameters);\r\n\r\n (this.callbacks[action] ?? []).forEach((cb) => {\r\n return cb(parameters);\r\n });\r\n }\r\n return null;\r\n } catch (e) {\r\n console.error('DD', e);\r\n }\r\n };\r\n})();\r\n\r\ndeclare global {\r\n interface Window {\r\n adt: typeof debugDispatcher;\r\n dd: typeof debugDispatcher & Record<string, () => unknown>;\r\n }\r\n}\r\n\r\nwindow.dd = debugDispatcher as typeof debugDispatcher &\r\n Record<string, () => unknown>;\r\nwindow.adt = debugDispatcher;\r\n"],"names":[],"mappings":"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"}
@@ -1,57 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"shortcutController.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}