@zajno/common 1.6.3 → 2.0.0-beta.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 (433) hide show
  1. package/.eslintrc.js +1 -1
  2. package/README.md +6 -1
  3. package/coverage/clover.xml +344 -1066
  4. package/coverage/coverage-final.json +31 -45
  5. package/coverage/lcov-report/__tests__/helpers/expect.ts.html +1 -1
  6. package/coverage/lcov-report/__tests__/helpers/index.html +1 -1
  7. package/coverage/lcov-report/__tests__/helpers/main.ts.html +1 -1
  8. package/coverage/lcov-report/async/arrays.ts.html +1 -1
  9. package/coverage/lcov-report/async/index.html +36 -21
  10. package/coverage/lcov-report/async/timeout.ts.html +59 -59
  11. package/coverage/lcov-report/dates/calc.ts.html +1 -1
  12. package/coverage/lcov-report/dates/convert.ts.html +1 -1
  13. package/coverage/lcov-report/dates/datex.ts.html +1 -1
  14. package/coverage/lcov-report/dates/format.ts.html +1 -1
  15. package/coverage/lcov-report/dates/index.html +1 -1
  16. package/coverage/lcov-report/dates/index.ts.html +1 -1
  17. package/coverage/lcov-report/dates/parse.ts.html +1 -1
  18. package/coverage/lcov-report/dates/period.ts.html +1 -1
  19. package/coverage/lcov-report/dates/shift.ts.html +1 -1
  20. package/coverage/lcov-report/dates/types.ts.html +1 -1
  21. package/coverage/lcov-report/dates/yearDate.ts.html +1 -1
  22. package/coverage/lcov-report/fields/index.html +1 -1
  23. package/coverage/lcov-report/fields/update.ts.html +1 -1
  24. package/coverage/lcov-report/functions/index.html +17 -17
  25. package/coverage/lcov-report/functions/safeCall.ts.html +13 -13
  26. package/coverage/lcov-report/index.html +119 -74
  27. package/coverage/lcov-report/lazy/index.html +1 -1
  28. package/coverage/lcov-report/lazy/promise.ts.html +1 -1
  29. package/coverage/lcov-report/lazy/singleton.ts.html +1 -1
  30. package/coverage/lcov-report/logger/batch.ts.html +1 -1
  31. package/coverage/lcov-report/logger/console.ts.html +1 -1
  32. package/coverage/lcov-report/logger/index.html +1 -1
  33. package/coverage/lcov-report/logger/index.ts.html +1 -1
  34. package/coverage/lcov-report/logger/named.ts.html +1 -1
  35. package/coverage/lcov-report/logger/proxy.ts.html +1 -1
  36. package/coverage/lcov-report/math/arrays.ts.html +1 -1
  37. package/coverage/lcov-report/math/calc.ts.html +1 -1
  38. package/coverage/lcov-report/math/distribution.ts.html +1 -1
  39. package/coverage/lcov-report/math/index.html +1 -1
  40. package/coverage/lcov-report/math/index.ts.html +1 -1
  41. package/coverage/lcov-report/observing/event.ts.html +1 -1
  42. package/coverage/lcov-report/observing/index.html +1 -1
  43. package/coverage/lcov-report/structures/helpers/enum.ts.html +1 -1
  44. package/coverage/lcov-report/structures/helpers/index.html +1 -1
  45. package/coverage/lcov-report/structures/index.html +1 -1
  46. package/coverage/lcov-report/structures/queue/index.html +24 -9
  47. package/coverage/lcov-report/structures/queue/parallel.ts.html +1 -1
  48. package/coverage/lcov-report/structures/queue/tasks.ts.html +358 -0
  49. package/coverage/lcov-report/structures/tempoCache.ts.html +1 -1
  50. package/coverage/lcov-report/types/comparator.ts.html +1 -1
  51. package/coverage/lcov-report/types/getter.ts.html +1 -1
  52. package/coverage/lcov-report/types/index.html +1 -1
  53. package/coverage/lcov-report/types/index.ts.html +1 -1
  54. package/coverage/lcov-report/validation/ValidationErrors.ts.html +1 -1
  55. package/coverage/lcov-report/validation/creditCard.ts.html +1 -1
  56. package/coverage/lcov-report/validation/helpers.ts.html +1 -1
  57. package/coverage/lcov-report/validation/index.html +1 -1
  58. package/coverage/lcov-report/validation/index.ts.html +1 -1
  59. package/coverage/lcov-report/validation/types.ts.html +1 -1
  60. package/coverage/lcov-report/validation/validators.ts.html +1 -1
  61. package/coverage/lcov-report/validation/wrappers.ts.html +1 -1
  62. package/coverage/lcov.info +863 -2381
  63. package/lib/fields/update.js +3 -3
  64. package/lib/fields/update.js.map +1 -1
  65. package/lib/{assert.d.ts → functions/assert.d.ts} +1 -1
  66. package/lib/functions/assert.d.ts.map +1 -0
  67. package/lib/{assert.js → functions/assert.js} +2 -2
  68. package/lib/functions/assert.js.map +1 -0
  69. package/lib/{disposer.d.ts → functions/disposer.d.ts} +0 -0
  70. package/lib/functions/disposer.d.ts.map +1 -0
  71. package/lib/{disposer.js → functions/disposer.js} +1 -1
  72. package/lib/functions/disposer.js.map +1 -0
  73. package/lib/functions/safeCall.d.ts +2 -0
  74. package/lib/functions/safeCall.d.ts.map +1 -0
  75. package/lib/{functions.js → functions/safeCall.js} +1 -1
  76. package/lib/functions/safeCall.js.map +1 -0
  77. package/lib/{throttle.d.ts → functions/throttle.d.ts} +0 -0
  78. package/lib/functions/throttle.d.ts.map +1 -0
  79. package/lib/{throttle.js → functions/throttle.js} +1 -1
  80. package/lib/functions/throttle.js.map +1 -0
  81. package/lib/lazy/light.d.ts +1 -1
  82. package/lib/lazy/light.d.ts.map +1 -1
  83. package/lib/lazy/promise.d.ts +1 -1
  84. package/lib/lazy/promise.d.ts.map +1 -1
  85. package/lib/lazy/singleton.d.ts +1 -1
  86. package/lib/lazy/singleton.d.ts.map +1 -1
  87. package/lib/math/arrays.d.ts +1 -0
  88. package/lib/math/arrays.d.ts.map +1 -1
  89. package/lib/math/arrays.js +13 -1
  90. package/lib/math/arrays.js.map +1 -1
  91. package/lib/{event.d.ts → observing/event.d.ts} +2 -3
  92. package/lib/observing/event.d.ts.map +1 -0
  93. package/lib/{event.js → observing/event.js} +2 -3
  94. package/lib/{event.js.map → observing/event.js.map} +1 -1
  95. package/lib/{throttledEvent.d.ts → observing/throttledEvent.d.ts} +0 -0
  96. package/lib/observing/throttledEvent.d.ts.map +1 -0
  97. package/lib/{throttledEvent.js → observing/throttledEvent.js} +1 -1
  98. package/lib/observing/throttledEvent.js.map +1 -0
  99. package/lib/{timer.d.ts → observing/timer.d.ts} +1 -1
  100. package/lib/observing/timer.d.ts.map +1 -0
  101. package/lib/{timer.js → observing/timer.js} +0 -0
  102. package/lib/observing/timer.js.map +1 -0
  103. package/lib/{abstractions/services/storage.d.ts → storage/abstractions.d.ts} +3 -2
  104. package/lib/storage/abstractions.d.ts.map +1 -0
  105. package/lib/{services/localization → storage}/abstractions.js +0 -0
  106. package/lib/storage/abstractions.js.map +1 -0
  107. package/lib/storage/asyncWrapper.d.ts +10 -0
  108. package/lib/storage/asyncWrapper.d.ts.map +1 -0
  109. package/lib/storage/asyncWrapper.js +24 -0
  110. package/lib/storage/asyncWrapper.js.map +1 -0
  111. package/lib/storage/index.d.ts +2 -0
  112. package/lib/storage/index.d.ts.map +1 -0
  113. package/lib/storage/index.js +5 -0
  114. package/lib/storage/index.js.map +1 -0
  115. package/lib/{services/storage/index.d.ts → storage/keyStorage.d.ts} +2 -10
  116. package/lib/storage/keyStorage.d.ts.map +1 -0
  117. package/lib/{services/storage/index.js → storage/keyStorage.js} +2 -22
  118. package/lib/storage/keyStorage.js.map +1 -0
  119. package/lib/{enumHelper.d.ts → structures/helpers/enum.d.ts} +1 -1
  120. package/lib/structures/helpers/enum.d.ts.map +1 -0
  121. package/lib/{enumHelper.js → structures/helpers/enum.js} +1 -1
  122. package/lib/structures/helpers/enum.js.map +1 -0
  123. package/lib/{nameHelper.d.ts → structures/helpers/name.d.ts} +5 -5
  124. package/lib/structures/helpers/name.d.ts.map +1 -0
  125. package/lib/{nameHelper.js → structures/helpers/name.js} +7 -6
  126. package/lib/structures/helpers/name.js.map +1 -0
  127. package/lib/structures/linkedList.d.ts +39 -0
  128. package/lib/structures/linkedList.d.ts.map +1 -0
  129. package/lib/structures/linkedList.js +82 -0
  130. package/lib/structures/linkedList.js.map +1 -0
  131. package/lib/{pool.d.ts → structures/pool.d.ts} +1 -1
  132. package/lib/structures/pool.d.ts.map +1 -0
  133. package/lib/{pool.js → structures/pool.js} +2 -2
  134. package/lib/structures/pool.js.map +1 -0
  135. package/lib/{queue → structures/queue}/parallel.d.ts +3 -3
  136. package/lib/structures/queue/parallel.d.ts.map +1 -0
  137. package/lib/{queue → structures/queue}/parallel.js +2 -2
  138. package/lib/structures/queue/parallel.js.map +1 -0
  139. package/lib/{queue → structures/queue}/tasks.d.ts +1 -1
  140. package/lib/structures/queue/tasks.d.ts.map +1 -0
  141. package/lib/{queue → structures/queue}/tasks.js +0 -0
  142. package/lib/structures/queue/tasks.js.map +1 -0
  143. package/lib/{tempoCache.d.ts → structures/tempoCache.d.ts} +0 -0
  144. package/lib/structures/tempoCache.d.ts.map +1 -0
  145. package/lib/{tempoCache.js → structures/tempoCache.js} +0 -0
  146. package/lib/structures/tempoCache.js.map +1 -0
  147. package/lib/types/comparator.d.ts +5 -0
  148. package/lib/types/comparator.d.ts.map +1 -0
  149. package/lib/types/comparator.js +8 -0
  150. package/lib/types/comparator.js.map +1 -0
  151. package/lib/types/deep.d.ts +9 -0
  152. package/lib/types/deep.d.ts.map +1 -0
  153. package/lib/{viewModels/types.js → types/deep.js} +1 -1
  154. package/lib/types/deep.js.map +1 -0
  155. package/lib/types/functions.d.ts +7 -0
  156. package/lib/types/functions.d.ts.map +1 -0
  157. package/lib/{abstractions/services/storage.js → types/functions.js} +1 -1
  158. package/lib/types/functions.js.map +1 -0
  159. package/lib/types/getter.d.ts +5 -0
  160. package/lib/types/getter.d.ts.map +1 -0
  161. package/lib/{types.js → types/getter.js} +2 -6
  162. package/lib/types/getter.js.map +1 -0
  163. package/lib/{ident.d.ts → types/ident.d.ts} +0 -0
  164. package/lib/types/ident.d.ts.map +1 -0
  165. package/lib/{ident.js → types/ident.js} +0 -0
  166. package/lib/types/ident.js.map +1 -0
  167. package/lib/types/index.d.ts +8 -0
  168. package/lib/types/index.d.ts.map +1 -0
  169. package/lib/types/index.js +7 -0
  170. package/lib/types/index.js.map +1 -0
  171. package/lib/validation/ValidationErrors.d.ts +1 -1
  172. package/lib/validation/ValidationErrors.d.ts.map +1 -1
  173. package/lib/validation/ValidationErrors.js +2 -2
  174. package/lib/validation/ValidationErrors.js.map +1 -1
  175. package/lib/{emails.d.ts → validation/emails.d.ts} +0 -0
  176. package/lib/validation/emails.d.ts.map +1 -0
  177. package/lib/{emails.js → validation/emails.js} +0 -0
  178. package/lib/validation/emails.js.map +1 -0
  179. package/package.json +16 -16
  180. package/src/async/__tests__/timeout.test.ts +1 -1
  181. package/src/fields/update.ts +1 -1
  182. package/src/{assert.ts → functions/assert.ts} +2 -2
  183. package/src/{disposer.ts → functions/disposer.ts} +1 -1
  184. package/src/functions/safeCall.ts +6 -0
  185. package/src/{throttle.ts → functions/throttle.ts} +1 -1
  186. package/src/lazy/__tests__/lazy.test.ts +1 -48
  187. package/src/lazy/light.ts +1 -1
  188. package/src/lazy/promise.ts +1 -1
  189. package/src/lazy/singleton.ts +1 -1
  190. package/src/math/arrays.ts +13 -0
  191. package/src/{event.ts → observing/event.ts} +3 -4
  192. package/src/{throttledEvent.ts → observing/throttledEvent.ts} +1 -1
  193. package/src/{timer.ts → observing/timer.ts} +1 -1
  194. package/src/{abstractions/services/storage.ts → storage/abstractions.ts} +3 -1
  195. package/src/storage/asyncWrapper.ts +24 -0
  196. package/src/storage/index.ts +2 -0
  197. package/src/{services/storage/index.ts → storage/keyStorage.ts} +1 -24
  198. package/src/{__tests__ → structures/__tests__}/enumHelper.test.ts +1 -1
  199. package/src/{__tests__ → structures/__tests__}/tempoCache.test.ts +1 -1
  200. package/src/{enumHelper.ts → structures/helpers/enum.ts} +0 -0
  201. package/src/{nameHelper.ts → structures/helpers/name.ts} +4 -4
  202. package/src/structures/linkedList.ts +129 -0
  203. package/src/{pool.ts → structures/pool.ts} +2 -2
  204. package/src/{queue → structures/queue}/__tests__/parallel.test.ts +2 -2
  205. package/src/{queue → structures/queue}/__tests__/tasks.test.ts +2 -2
  206. package/src/{queue → structures/queue}/parallel.ts +2 -2
  207. package/src/{queue → structures/queue}/tasks.ts +1 -1
  208. package/src/{tempoCache.ts → structures/tempoCache.ts} +0 -0
  209. package/src/types/comparator.ts +6 -0
  210. package/src/types/deep.ts +18 -0
  211. package/src/types/functions.ts +8 -0
  212. package/src/types/getter.ts +14 -0
  213. package/src/{ident.ts → types/ident.ts} +0 -0
  214. package/src/types/index.ts +9 -0
  215. package/src/validation/ValidationErrors.ts +1 -1
  216. package/src/{emails.ts → validation/emails.ts} +0 -0
  217. package/tsconfig.build.json +10 -0
  218. package/tsconfig.json +0 -1
  219. package/yarn.lock +467 -370
  220. package/lib/abstractions/services/storage.d.ts.map +0 -1
  221. package/lib/abstractions/services/storage.js.map +0 -1
  222. package/lib/assert.d.ts.map +0 -1
  223. package/lib/assert.js.map +0 -1
  224. package/lib/cache.d.ts +0 -36
  225. package/lib/cache.d.ts.map +0 -1
  226. package/lib/cache.js +0 -165
  227. package/lib/cache.js.map +0 -1
  228. package/lib/deepPartial.d.ts +0 -4
  229. package/lib/deepPartial.d.ts.map +0 -1
  230. package/lib/deepPartial.js +0 -3
  231. package/lib/deepPartial.js.map +0 -1
  232. package/lib/disposer.d.ts.map +0 -1
  233. package/lib/disposer.js.map +0 -1
  234. package/lib/emails.d.ts.map +0 -1
  235. package/lib/emails.js.map +0 -1
  236. package/lib/enumHelper.d.ts.map +0 -1
  237. package/lib/enumHelper.js.map +0 -1
  238. package/lib/event.d.ts.map +0 -1
  239. package/lib/functions.d.ts +0 -9
  240. package/lib/functions.d.ts.map +0 -1
  241. package/lib/functions.js.map +0 -1
  242. package/lib/ident.d.ts.map +0 -1
  243. package/lib/ident.js.map +0 -1
  244. package/lib/lazy/index.d.ts +0 -10
  245. package/lib/lazy/index.d.ts.map +0 -1
  246. package/lib/lazy/index.js +0 -23
  247. package/lib/lazy/index.js.map +0 -1
  248. package/lib/lazy/observable.d.ts +0 -9
  249. package/lib/lazy/observable.d.ts.map +0 -1
  250. package/lib/lazy/observable.js +0 -31
  251. package/lib/lazy/observable.js.map +0 -1
  252. package/lib/lazy.light.d.ts +0 -2
  253. package/lib/lazy.light.d.ts.map +0 -1
  254. package/lib/lazy.light.js +0 -8
  255. package/lib/lazy.light.js.map +0 -1
  256. package/lib/nameHelper.d.ts.map +0 -1
  257. package/lib/nameHelper.js.map +0 -1
  258. package/lib/observersMap.d.ts +0 -22
  259. package/lib/observersMap.d.ts.map +0 -1
  260. package/lib/observersMap.js +0 -93
  261. package/lib/observersMap.js.map +0 -1
  262. package/lib/observingCache.d.ts +0 -32
  263. package/lib/observingCache.d.ts.map +0 -1
  264. package/lib/observingCache.js +0 -128
  265. package/lib/observingCache.js.map +0 -1
  266. package/lib/pool.d.ts.map +0 -1
  267. package/lib/pool.js.map +0 -1
  268. package/lib/queue/parallel.d.ts.map +0 -1
  269. package/lib/queue/parallel.js.map +0 -1
  270. package/lib/queue/tasks.d.ts.map +0 -1
  271. package/lib/queue/tasks.js.map +0 -1
  272. package/lib/services/localization/LocalaziedValidationErrors.d.ts +0 -9
  273. package/lib/services/localization/LocalaziedValidationErrors.d.ts.map +0 -1
  274. package/lib/services/localization/LocalaziedValidationErrors.js +0 -27
  275. package/lib/services/localization/LocalaziedValidationErrors.js.map +0 -1
  276. package/lib/services/localization/LocalizationManager.d.ts +0 -18
  277. package/lib/services/localization/LocalizationManager.d.ts.map +0 -1
  278. package/lib/services/localization/LocalizationManager.js +0 -58
  279. package/lib/services/localization/LocalizationManager.js.map +0 -1
  280. package/lib/services/localization/abstractions.d.ts +0 -12
  281. package/lib/services/localization/abstractions.d.ts.map +0 -1
  282. package/lib/services/localization/abstractions.js.map +0 -1
  283. package/lib/services/localization/defaultShape.d.ts +0 -26
  284. package/lib/services/localization/defaultShape.d.ts.map +0 -1
  285. package/lib/services/localization/defaultShape.js +0 -28
  286. package/lib/services/localization/defaultShape.js.map +0 -1
  287. package/lib/services/localization/index.d.ts +0 -5
  288. package/lib/services/localization/index.d.ts.map +0 -1
  289. package/lib/services/localization/index.js +0 -10
  290. package/lib/services/localization/index.js.map +0 -1
  291. package/lib/services/storage/index.d.ts.map +0 -1
  292. package/lib/services/storage/index.js.map +0 -1
  293. package/lib/services/storage/web/localStorage.d.ts +0 -13
  294. package/lib/services/storage/web/localStorage.d.ts.map +0 -1
  295. package/lib/services/storage/web/localStorage.js +0 -29
  296. package/lib/services/storage/web/localStorage.js.map +0 -1
  297. package/lib/services/storage/web/sessionStorage.d.ts +0 -13
  298. package/lib/services/storage/web/sessionStorage.d.ts.map +0 -1
  299. package/lib/services/storage/web/sessionStorage.js +0 -29
  300. package/lib/services/storage/web/sessionStorage.js.map +0 -1
  301. package/lib/services/storage/web/webStorage.d.ts +0 -9
  302. package/lib/services/storage/web/webStorage.d.ts.map +0 -1
  303. package/lib/services/storage/web/webStorage.js +0 -24
  304. package/lib/services/storage/web/webStorage.js.map +0 -1
  305. package/lib/tempoCache.d.ts.map +0 -1
  306. package/lib/tempoCache.js.map +0 -1
  307. package/lib/throttle.d.ts.map +0 -1
  308. package/lib/throttle.js.map +0 -1
  309. package/lib/throttledEvent.d.ts.map +0 -1
  310. package/lib/throttledEvent.js.map +0 -1
  311. package/lib/timeHelper.d.ts +0 -7
  312. package/lib/timeHelper.d.ts.map +0 -1
  313. package/lib/timeHelper.js +0 -37
  314. package/lib/timeHelper.js.map +0 -1
  315. package/lib/timer.d.ts.map +0 -1
  316. package/lib/timer.js.map +0 -1
  317. package/lib/transitionObserver.d.ts +0 -36
  318. package/lib/transitionObserver.d.ts.map +0 -1
  319. package/lib/transitionObserver.js +0 -153
  320. package/lib/transitionObserver.js.map +0 -1
  321. package/lib/types.d.ts +0 -17
  322. package/lib/types.d.ts.map +0 -1
  323. package/lib/types.js.map +0 -1
  324. package/lib/unsubscriber.d.ts +0 -2
  325. package/lib/unsubscriber.d.ts.map +0 -1
  326. package/lib/unsubscriber.js +0 -12
  327. package/lib/unsubscriber.js.map +0 -1
  328. package/lib/validation/ValidationErrorsLocalization.d.ts +0 -27
  329. package/lib/validation/ValidationErrorsLocalization.d.ts.map +0 -1
  330. package/lib/validation/ValidationErrorsLocalization.js +0 -26
  331. package/lib/validation/ValidationErrorsLocalization.js.map +0 -1
  332. package/lib/viewModels/CommonModel.d.ts +0 -13
  333. package/lib/viewModels/CommonModel.d.ts.map +0 -1
  334. package/lib/viewModels/CommonModel.js +0 -38
  335. package/lib/viewModels/CommonModel.js.map +0 -1
  336. package/lib/viewModels/FlagModel.d.ts +0 -22
  337. package/lib/viewModels/FlagModel.d.ts.map +0 -1
  338. package/lib/viewModels/FlagModel.js +0 -52
  339. package/lib/viewModels/FlagModel.js.map +0 -1
  340. package/lib/viewModels/InitializableModel.d.ts +0 -6
  341. package/lib/viewModels/InitializableModel.d.ts.map +0 -1
  342. package/lib/viewModels/InitializableModel.js +0 -23
  343. package/lib/viewModels/InitializableModel.js.map +0 -1
  344. package/lib/viewModels/LoadingModel.d.ts +0 -17
  345. package/lib/viewModels/LoadingModel.d.ts.map +0 -1
  346. package/lib/viewModels/LoadingModel.js +0 -42
  347. package/lib/viewModels/LoadingModel.js.map +0 -1
  348. package/lib/viewModels/MultiSelectModel.d.ts +0 -47
  349. package/lib/viewModels/MultiSelectModel.d.ts.map +0 -1
  350. package/lib/viewModels/MultiSelectModel.js +0 -144
  351. package/lib/viewModels/MultiSelectModel.js.map +0 -1
  352. package/lib/viewModels/NumberModel.d.ts +0 -19
  353. package/lib/viewModels/NumberModel.d.ts.map +0 -1
  354. package/lib/viewModels/NumberModel.js +0 -38
  355. package/lib/viewModels/NumberModel.js.map +0 -1
  356. package/lib/viewModels/PromptModal.d.ts +0 -31
  357. package/lib/viewModels/PromptModal.d.ts.map +0 -1
  358. package/lib/viewModels/PromptModal.js +0 -57
  359. package/lib/viewModels/PromptModal.js.map +0 -1
  360. package/lib/viewModels/SelectModel.d.ts +0 -35
  361. package/lib/viewModels/SelectModel.d.ts.map +0 -1
  362. package/lib/viewModels/SelectModel.js +0 -118
  363. package/lib/viewModels/SelectModel.js.map +0 -1
  364. package/lib/viewModels/TextModel.d.ts +0 -41
  365. package/lib/viewModels/TextModel.d.ts.map +0 -1
  366. package/lib/viewModels/TextModel.js +0 -98
  367. package/lib/viewModels/TextModel.js.map +0 -1
  368. package/lib/viewModels/Validatable.d.ts +0 -26
  369. package/lib/viewModels/Validatable.d.ts.map +0 -1
  370. package/lib/viewModels/Validatable.js +0 -81
  371. package/lib/viewModels/Validatable.js.map +0 -1
  372. package/lib/viewModels/ValueModel.d.ts +0 -12
  373. package/lib/viewModels/ValueModel.d.ts.map +0 -1
  374. package/lib/viewModels/ValueModel.js +0 -29
  375. package/lib/viewModels/ValueModel.js.map +0 -1
  376. package/lib/viewModels/ValuesCollector.d.ts +0 -26
  377. package/lib/viewModels/ValuesCollector.d.ts.map +0 -1
  378. package/lib/viewModels/ValuesCollector.js +0 -51
  379. package/lib/viewModels/ValuesCollector.js.map +0 -1
  380. package/lib/viewModels/index.d.ts +0 -12
  381. package/lib/viewModels/index.d.ts.map +0 -1
  382. package/lib/viewModels/index.js +0 -15
  383. package/lib/viewModels/index.js.map +0 -1
  384. package/lib/viewModels/types.d.ts +0 -19
  385. package/lib/viewModels/types.d.ts.map +0 -1
  386. package/lib/viewModels/types.js.map +0 -1
  387. package/lib/viewModels/wrappers.d.ts +0 -12
  388. package/lib/viewModels/wrappers.d.ts.map +0 -1
  389. package/lib/viewModels/wrappers.js +0 -43
  390. package/lib/viewModels/wrappers.js.map +0 -1
  391. package/src/__tests__/observingCache.test.ts +0 -127
  392. package/src/__tests__/transitionObserver.test.ts +0 -219
  393. package/src/cache.ts +0 -181
  394. package/src/deepPartial.ts +0 -4
  395. package/src/functions.ts +0 -14
  396. package/src/lazy/index.ts +0 -33
  397. package/src/lazy/observable.ts +0 -37
  398. package/src/lazy.light.ts +0 -8
  399. package/src/observersMap.ts +0 -105
  400. package/src/observingCache.ts +0 -160
  401. package/src/services/localization/LocalaziedValidationErrors.ts +0 -18
  402. package/src/services/localization/LocalizationManager.ts +0 -53
  403. package/src/services/localization/abstractions.ts +0 -16
  404. package/src/services/localization/defaultShape.ts +0 -26
  405. package/src/services/localization/index.ts +0 -6
  406. package/src/services/storage/web/localStorage.ts +0 -35
  407. package/src/services/storage/web/sessionStorage.ts +0 -35
  408. package/src/services/storage/web/webStorage.ts +0 -29
  409. package/src/timeHelper.ts +0 -39
  410. package/src/transitionObserver.ts +0 -183
  411. package/src/types.ts +0 -30
  412. package/src/unsubscriber.ts +0 -14
  413. package/src/validation/ValidationErrorsLocalization.ts +0 -27
  414. package/src/viewModels/CommonModel.ts +0 -45
  415. package/src/viewModels/FlagModel.ts +0 -70
  416. package/src/viewModels/InitializableModel.ts +0 -17
  417. package/src/viewModels/LoadingModel.ts +0 -52
  418. package/src/viewModels/MultiSelectModel.ts +0 -178
  419. package/src/viewModels/NumberModel.ts +0 -50
  420. package/src/viewModels/PromptModal.ts +0 -65
  421. package/src/viewModels/SelectModel.ts +0 -152
  422. package/src/viewModels/TextModel.ts +0 -127
  423. package/src/viewModels/Validatable.ts +0 -102
  424. package/src/viewModels/ValueModel.ts +0 -34
  425. package/src/viewModels/ValuesCollector.ts +0 -81
  426. package/src/viewModels/__tests__/common.test.ts +0 -107
  427. package/src/viewModels/__tests__/multiSelect.test.ts +0 -138
  428. package/src/viewModels/__tests__/select.test.ts +0 -71
  429. package/src/viewModels/__tests__/wrappers.test.ts +0 -79
  430. package/src/viewModels/index.ts +0 -15
  431. package/src/viewModels/types.ts +0 -23
  432. package/src/viewModels/wrappers.ts +0 -49
  433. package/tsconfig.eslint.json +0 -9
@@ -1,45 +0,0 @@
1
- import { action, makeObservable, observable } from 'mobx';
2
- import { Getter } from '../types';
3
- import { ValidatableModel } from './Validatable';
4
-
5
- export class CommonModel<T = any> extends ValidatableModel<T> {
6
-
7
- // observable[.ref]
8
- private _value: T;
9
-
10
- private _defaultValue: Getter<T> = null;
11
-
12
- constructor(v: Getter<T> = null, useRefObservable = true) {
13
- super();
14
- this._value = Getter.getValue(v) || null;
15
- this._defaultValue = v;
16
-
17
- makeObservable<CommonModel<T>, '_value'>(this, {
18
- _value: useRefObservable ? observable.ref : observable,
19
- setValue: action,
20
- });
21
- }
22
-
23
- protected get valueToValidate(): Readonly<T> {
24
- return this._value;
25
- }
26
-
27
- public get value() { return this._value; }
28
- public set value(v: T) {
29
- this.setValue(v);
30
- }
31
-
32
- // action
33
- public readonly setValue = (value: T) => {
34
- this._value = value;
35
-
36
- if (this._validateOnChange) {
37
- this.validate();
38
- }
39
- };
40
-
41
- reset = () => {
42
- this._value = Getter.getValue(this._defaultValue);
43
- super.reset();
44
- };
45
- }
@@ -1,70 +0,0 @@
1
- import { action, makeObservable, observable } from 'mobx';
2
- import { IResetableModel } from 'viewModels';
3
- import { ILabel, IValueModel } from './types';
4
-
5
- export interface IFlagModel extends IValueModel<boolean>, IResetableModel {
6
- toggle(): void;
7
- }
8
-
9
- export type IFlagModelReadonly = {
10
- readonly value: boolean;
11
- };
12
-
13
- export type ILabeledFlagModel = IFlagModel & ILabel<string>;
14
-
15
- export class FlagModel implements IFlagModel, IFlagModelReadonly {
16
-
17
- // @observable
18
- private _value: boolean = false;
19
-
20
- constructor(initial = false) {
21
- makeObservable<FlagModel, '_value'>(this, {
22
- _value: observable,
23
- setValue: action,
24
- setTrue: action,
25
- setFalse: action,
26
- toggle: action,
27
- reset: action,
28
- });
29
- this._value = initial;
30
- }
31
-
32
- get value() {
33
- return this._value;
34
- }
35
-
36
- set value(value: boolean) {
37
- this.setValue(value);
38
- }
39
-
40
- // @action
41
- public readonly setValue = (value: boolean) => {
42
- this._value = value;
43
- };
44
-
45
- get isDefault() { return this._value === false; }
46
-
47
- // @action
48
- setTrue = () => {
49
- const v = this.value;
50
- this.value = true;
51
- return !v;
52
- };
53
-
54
- // @action
55
- setFalse = () => {
56
- const v = this.value;
57
- this.value = false;
58
- return v;
59
- };
60
-
61
- // @action
62
- toggle = () => {
63
- this._value = !this._value;
64
- };
65
-
66
- // @action
67
- reset = () => {
68
- this._value = false;
69
- };
70
- }
@@ -1,17 +0,0 @@
1
- import NumberModel from './NumberModel';
2
-
3
- export class InitializableModel {
4
- private readonly _counter = new NumberModel(0);
5
-
6
- public get initializing() { return this._counter.value > 0; }
7
-
8
- protected async runOperation<T>(operation: () => Promise<T> | T): Promise<T> {
9
- try {
10
- this._counter.increment();
11
- const res = await operation();
12
- return res;
13
- } finally {
14
- this._counter.decrement();
15
- }
16
- }
17
- }
@@ -1,52 +0,0 @@
1
- import { NumberModel } from './NumberModel';
2
- import { IResetableModel, IValueModel } from './types';
3
-
4
- export class LoadingModel implements IValueModel<boolean>, IResetableModel {
5
-
6
- private readonly _number = new NumberModel(0);
7
-
8
- public get isLoading() { return this._number.value > 0; }
9
-
10
- public get value(): boolean { return this.isLoading; }
11
- public set value(v: boolean) {
12
- if (v) {
13
- this._number.increment();
14
- } else {
15
- this._number.decrement();
16
- }
17
- }
18
-
19
- public async useLoading<T>(cb: () => (T | Promise<T>)): Promise<T>;
20
- public async useLoading<T>(cb: () => (T | Promise<T>), exclusive: false): Promise<T>;
21
- public async useLoading<T>(cb: () => (T | Promise<T>), exclusive: true): Promise<T | false>;
22
- public async useLoading<T>(cb: () => (T | Promise<T>), exclusive: 'throw'): Promise<T>;
23
-
24
- public useLoading<T>(cb: () => (T | Promise<T>), exclusive: boolean | 'throw' = false): Promise<T | false> {
25
- return withLoading(this, cb, exclusive as any);
26
- }
27
-
28
- public reset = () => this._number.reset();
29
- }
30
-
31
- export function withLoading<T>(model: IValueModel<boolean>, cb: () => (T | Promise<T>)): Promise<T>;
32
- export function withLoading<T>(model: IValueModel<boolean>, cb: () => (T | Promise<T>), exclusive: false): Promise<T>;
33
- export function withLoading<T>(model: IValueModel<boolean>, cb: () => (T | Promise<T>), exclusive: true): Promise<T | false>;
34
- export function withLoading<T>(model: IValueModel<boolean>, cb: () => (T | Promise<T>), exclusive: 'throw'): Promise<T>;
35
-
36
- export async function withLoading<T>(this: void, model: IValueModel<boolean>, cb: () => (T | Promise<T>), exclusive: boolean | 'throw' = false): Promise<T | false> {
37
- if (exclusive && model.value) {
38
- if (exclusive === 'throw') {
39
- throw new Error('Operation cannot be started because another one is in progress already.');
40
- }
41
- return false;
42
- }
43
-
44
- model.value = true;
45
-
46
- try {
47
- const res = await cb();
48
- return res;
49
- } finally {
50
- model.value = false;
51
- }
52
- }
@@ -1,178 +0,0 @@
1
- import { createLazy } from '../lazy/light';
2
- import { action, computed, makeObservable, observable, reaction } from 'mobx';
3
- import { FlagModel, ILabeledFlagModel } from './FlagModel';
4
- import { ValidatableModel } from './Validatable';
5
- import { IValueModel } from './types';
6
- import { withLabel } from './wrappers';
7
- import { ICountableModel, IResetableModel } from 'viewModels';
8
- import { arraysCompareDistinct } from '../math';
9
-
10
- export class MultiSelect<T = any> extends ValidatableModel<ReadonlyArray<T>> implements IValueModel<readonly string[]>, IResetableModel, ICountableModel {
11
-
12
- // @observable
13
- private readonly _indexes = new Set<number>();
14
-
15
- public readonly opened = new FlagModel();
16
- private readonly _initial: number[] = null;
17
-
18
- private readonly _flags = createLazy(() => this.createFlags());
19
- private _indexesLocked = false;
20
-
21
- constructor(
22
- private readonly _items: readonly T[],
23
- private readonly _accessor: (item: T) => string,
24
- ...selected: number[]
25
- ) {
26
- super();
27
- makeObservable<MultiSelect<T>, '_indexes'>(this, {
28
- '_indexes': observable,
29
- selectedIndexes: computed,
30
- values: computed,
31
- selectedItems: computed,
32
- selectedValues: computed,
33
- isDefault: computed,
34
- selectItems: action,
35
- selectValues: action,
36
- setIndexSelected: action,
37
- });
38
- this._initial = selected;
39
- this.setInitialIndexes();
40
- }
41
-
42
- // @computed
43
- get selectedIndexes(): ReadonlyArray<number> { return Array.from(this._indexes); }
44
-
45
- get items(): ReadonlyArray<T> { return this._items; }
46
-
47
- get flags() { return this._flags.value; }
48
-
49
- // @computed
50
- get values(): ReadonlyArray<string> {
51
- return this._items.map(i => this._accessor(i));
52
- }
53
-
54
- // @computed
55
- get selectedItems(): ReadonlyArray<T> {
56
- return this.selectedIndexes.map(i => this._items[i]);
57
- }
58
-
59
- // @computed
60
- get selectedValues(): ReadonlyArray<string> {
61
- const values = this.values;
62
- return this.selectedIndexes.map(i => values[i]);
63
- }
64
-
65
- get value() { return this.selectedValues; }
66
- set value(v: readonly string[]) { this.selectValues(v); }
67
-
68
- isIndexSelected(index: number) { return this._indexes.has(index); }
69
- isValueSelected(value: string) { return this.selectedValues.includes(value); }
70
-
71
- get count() { return this._items.length; }
72
- get selectedCount() { return this._indexes.size; }
73
- get isEmpty() { return this.selectedCount === 0; }
74
-
75
- // @computed
76
- get isDefault() { return arraysCompareDistinct(this.selectedIndexes, this._initial)?.diff === 0; }
77
-
78
- protected get valueToValidate() { return this.selectedItems; }
79
-
80
- setItemSelected = (item: T, selected: boolean) => {
81
- const i = this.items.indexOf(item);
82
- if (i >= 0) {
83
- this.setIndexSelected(i, selected);
84
- }
85
- };
86
-
87
- selectItem = (item: T) => this.setItemSelected(item, true);
88
- deSelectItem = (item: T) => this.setItemSelected(item, false);
89
-
90
- // @action
91
- selectItems = (items: readonly T[]) => {
92
- items.forEach(this.selectItem);
93
- };
94
-
95
- setValueSelected = (value: string, selected: boolean) => {
96
- const i = this.values.indexOf(value);
97
- if (i >= 0) {
98
- this.setIndexSelected(i, selected);
99
- }
100
- };
101
-
102
- selectValue = (value: string) => this.setValueSelected(value, true);
103
- deSelectValue = (value: string) => this.setValueSelected(value, false);
104
-
105
- // @action
106
- selectValues = (values: readonly string[]) => {
107
- values.forEach(this.selectValue);
108
- };
109
-
110
- // @action
111
- setIndexSelected = (index: number, selected: boolean) => {
112
- if (this._indexesLocked) {
113
- return;
114
- }
115
-
116
- if (selected) {
117
- this._indexes.add(index);
118
- } else {
119
- this._indexes.delete(index);
120
- }
121
-
122
- if (this._validateOnChange) {
123
- this.validate();
124
- }
125
-
126
- if (!this._flags.hasValue) {
127
- return;
128
- }
129
-
130
- try {
131
- this._indexesLocked = true;
132
- this._flags.value[index].value = selected;
133
- } finally {
134
- this._indexesLocked = false;
135
- }
136
- };
137
-
138
- selectIndex = (index: number) => this.setIndexSelected(index, true);
139
- deSelectIndex = (index: number) => this.setIndexSelected(index, false);
140
-
141
- reset = () => {
142
- super.reset();
143
- this.setInitialIndexes();
144
- };
145
-
146
- private setInitialIndexes() {
147
- this._indexes.clear();
148
- this._initial.forEach(i => this._indexes.add(i));
149
-
150
- if (this._flags.hasValue) {
151
- this._flags.value.forEach((flag, index) => flag.value = this._indexes.has(index));
152
- }
153
- }
154
-
155
- private createFlags() {
156
- const flags: ReadonlyArray<ILabeledFlagModel> = this._items
157
- .map((item, index) => {
158
- const flag = withLabel(
159
- new FlagModel(this._indexes.has(index)),
160
- () => this._accessor(item),
161
- );
162
-
163
- // react on every flag is changed directly
164
- reaction(() => flag.value, isSelected => {
165
- this.setIndexSelected(index, isSelected);
166
- });
167
- return flag;
168
- });
169
- return flags;
170
- }
171
- }
172
-
173
- export class MultiSelectString<T extends string = string> extends MultiSelect<T> {
174
-
175
- constructor(items: ReadonlyArray<T>, ...selected: number[]) {
176
- super(items, v => v, ...selected);
177
- }
178
- }
@@ -1,50 +0,0 @@
1
- import { action, makeObservable, observable } from 'mobx';
2
- import { IResetableModel } from 'viewModels';
3
- import { IValueModel } from './types';
4
-
5
- export interface INumberModel extends IResetableModel {
6
- value: number;
7
- }
8
-
9
- export class NumberModel implements INumberModel, IValueModel<number> {
10
-
11
- // @observable
12
- private _value: number = 0;
13
-
14
- private _initial: number = 0;
15
-
16
- constructor(initial: number = 0) {
17
- makeObservable<NumberModel, '_value'>(this, {
18
- _value: observable,
19
- setValue: action,
20
- reset: action,
21
- increment: action,
22
- decrement: action,
23
- });
24
- this._initial = initial;
25
- this._value = this._initial;
26
- }
27
-
28
- get value() { return this._value; }
29
- set value(v: number) { this.setValue(v); }
30
-
31
- // @action
32
- public readonly setValue = (v: number) => {
33
- this._value = v;
34
- };
35
-
36
- get isDefault() { return this._value === this._initial; }
37
-
38
- // @action
39
- reset = () => {
40
- this._value = this._initial;
41
- };
42
-
43
- // @action
44
- increment = (d = 1) => this.value += d;
45
-
46
- // @action
47
- decrement = (d = 1) => this.value -= d;
48
- }
49
-
50
- export default NumberModel;
@@ -1,65 +0,0 @@
1
- import { observable, makeObservable, action } from 'mobx';
2
- import { FlagModel } from './FlagModel';
3
-
4
- export type BaseModalAction = {
5
- title?: string;
6
- message?: string;
7
- };
8
-
9
- export class ModalActionModel<T extends BaseModalAction = BaseModalAction> {
10
- public readonly isActive = new FlagModel();
11
-
12
- @observable.ref
13
- private _currentAction: T = null;
14
-
15
- constructor() {
16
- makeObservable(this);
17
- }
18
-
19
- get currentAction() { return this._currentAction; }
20
-
21
- @action
22
- public openModal = (action: T) => {
23
- this._currentAction = action;
24
- this.isActive.value = true;
25
- };
26
-
27
- @action
28
- public closeModal = () => {
29
- this.isActive.value = false;
30
- this._currentAction = null;
31
- };
32
-
33
- protected runAction = async (cb: () => Promise<void> | void, close = true, awaitAction = false) => {
34
- if (cb) {
35
- const promise = cb();
36
- if (awaitAction) {
37
- await promise;
38
- }
39
- }
40
-
41
- if (close) {
42
- this.closeModal();
43
- }
44
- };
45
- }
46
-
47
- export type PromptModalAction = BaseModalAction & {
48
- confirmText?: string;
49
- rejectText?: string;
50
- onConfirm?: () => Promise<void> | void;
51
- onReject?: () => Promise<void> | void;
52
- awaitActions?: boolean;
53
- modalImage?: any;
54
- confirmColor?: string;
55
- rejectColor?: string;
56
- };
57
-
58
- export class PromptModalViewModel extends ModalActionModel<PromptModalAction> {
59
- get confirmColor() { return this.currentAction.confirmColor; }
60
-
61
- get rejectColor() { return this.currentAction.rejectColor; }
62
-
63
- onConfirm = () => this.runAction(this.currentAction.onConfirm, true, this.currentAction.awaitActions);
64
- onReject = () => this.runAction(this.currentAction.onReject, true, this.currentAction.awaitActions);
65
- }
@@ -1,152 +0,0 @@
1
- import { observable, computed, makeObservable, reaction, action } from 'mobx';
2
- import { createLazy } from '../lazy/light';
3
- import { FlagModel, ILabeledFlagModel } from './FlagModel';
4
- import { ValidatableModel } from './Validatable';
5
- import { IValueModel } from './types';
6
- import { withLabel } from './wrappers';
7
- import { IResetableModel } from './types';
8
- import { Getter } from '../types';
9
-
10
- export class Select<T = any> extends ValidatableModel<T> implements IValueModel<string>, IResetableModel {
11
- // @observable
12
- private _index: number = undefined;
13
-
14
- private readonly _items: Getter<readonly T[]>;
15
-
16
- private _indexLocked = false;
17
- private _initialIndex: number = null;
18
-
19
- private readonly _flags = createLazy(() => this.createFlags());
20
-
21
- public readonly opened = new FlagModel();
22
-
23
- constructor(
24
- items: Getter<readonly T[]>,
25
- private readonly _accessor: (item: T) => string,
26
- initialIndex: number = 0,
27
- ) {
28
- super();
29
-
30
- this._items = items;
31
-
32
- makeObservable<Select<T>, '_index' | '_items'>(this, {
33
- '_index': observable,
34
- '_items': observable.ref,
35
- values: computed,
36
- items: computed,
37
- setIndex: action,
38
- });
39
-
40
- this._initialIndex = initialIndex;
41
- this._index = initialIndex;
42
- }
43
-
44
- protected get valueToValidate() { return this.selectedItem; }
45
-
46
- // @computed
47
- get values(): readonly string[] {
48
- return this.items.map(i => this._accessor(i));
49
- }
50
-
51
- get flags() {
52
- return this._flags.value;
53
- }
54
-
55
- // @computed
56
- get items(): readonly T[] {
57
- return Getter.getValue(this._items);
58
- }
59
-
60
- get value() { return this.selectedValue; }
61
- get selectedValue() {
62
- const vs = this.values;
63
- return vs.length ? vs[this._index] : null;
64
- }
65
-
66
- set value(v: string) { this.selectedValue = v; }
67
- set selectedValue(value: string) {
68
- const index = this.values.indexOf(value);
69
- if (index >= 0) {
70
- this.index = index;
71
- }
72
- }
73
-
74
- get selectedItem(): T {
75
- const items = this.items;
76
- return items.length ? items[this._index] : null;
77
- }
78
-
79
- set selectedItem(item: T) {
80
- const index = this.items.indexOf(item);
81
- if (index >= 0) {
82
- this.index = index;
83
- }
84
- }
85
-
86
- get isDefault() { return this._index === this._initialIndex; }
87
-
88
- get index() {
89
- return this._index;
90
- }
91
-
92
- set index(val: number) {
93
- this.setIndex(val);
94
- }
95
-
96
- // @action
97
- public setIndex = (val: number) => {
98
- if (this._indexLocked) {
99
- return;
100
- }
101
-
102
- this._index = val;
103
-
104
- if (this._validateOnChange) {
105
- this.validate();
106
- }
107
-
108
- // update all flags to be properly selected
109
- try {
110
- this._indexLocked = true;
111
-
112
- if (this._flags.hasValue) {
113
- this._flags.value.forEach((f, i) => f.value = (i === this._index));
114
- }
115
- } finally {
116
- this._indexLocked = false;
117
- }
118
- };
119
-
120
- public reset = () => {
121
- super.reset();
122
- this.index = this._initialIndex;
123
- };
124
-
125
- private createFlags() {
126
- const flags: ReadonlyArray<ILabeledFlagModel> = this.items
127
- .map((item, index) => {
128
- const flag: ILabeledFlagModel = withLabel(
129
- new FlagModel(index === this.index),
130
- () => this._accessor(item),
131
- );
132
-
133
- // react on every flag is changed directly
134
- reaction(() => flag.value, isSelected => {
135
- if (isSelected) {
136
- this.index = index;
137
- }
138
- });
139
-
140
- return flag;
141
- });
142
-
143
- return flags;
144
- }
145
- }
146
-
147
-
148
- export class SelectString<T extends string = string> extends Select<T> {
149
- constructor(items: readonly T[], initialIndex: number = 0) {
150
- super(items, v => v, initialIndex);
151
- }
152
- }