@vandenberghinc/volt 1.1.26 → 1.1.28

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 (502) hide show
  1. package/backend/dist/cjs/{blacklist.d.ts → backend/src/blacklist.d.ts} +5 -3
  2. package/backend/dist/cjs/{blacklist.js → backend/src/blacklist.js} +8 -5
  3. package/backend/dist/cjs/{cli.js → backend/src/cli.js} +29 -47
  4. package/backend/dist/cjs/backend/src/database/collection.d.ts +1543 -0
  5. package/backend/dist/cjs/backend/src/database/collection.js +3042 -0
  6. package/backend/dist/cjs/backend/src/database/database.d.ts +66 -0
  7. package/backend/dist/cjs/{database → backend/src/database}/database.js +48 -43
  8. package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +6 -0
  9. package/backend/dist/cjs/backend/src/database/filters/filters.js +15 -0
  10. package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +223 -0
  11. package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +15 -0
  12. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +443 -0
  13. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +15 -0
  14. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
  15. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +15 -0
  16. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
  17. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +15 -0
  18. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
  19. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +15 -0
  20. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
  21. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +15 -0
  22. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  23. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +15 -0
  24. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
  25. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +355 -0
  26. package/backend/dist/cjs/backend/src/database/flatten.d.ts +75 -0
  27. package/backend/dist/cjs/{logger.js → backend/src/database/flatten.js} +18 -7
  28. package/backend/dist/cjs/backend/src/database/flatten_test.js +175 -0
  29. package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +461 -0
  30. package/backend/dist/cjs/backend/src/database/quota/quota.js +1014 -0
  31. package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +534 -0
  32. package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +1087 -0
  33. package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +293 -0
  34. package/backend/dist/cjs/backend/src/database/quota/safe_int.js +573 -0
  35. package/backend/dist/{esm → cjs/backend/src}/endpoint.d.ts +69 -46
  36. package/backend/dist/cjs/{endpoint.js → backend/src/endpoint.js} +87 -101
  37. package/backend/dist/cjs/backend/src/errors/index.d.ts +7 -0
  38. package/backend/dist/cjs/backend/src/errors/index.js +25 -0
  39. package/backend/dist/{esm/utils.d.ts → cjs/backend/src/errors/internal_external.d.ts} +14 -22
  40. package/backend/dist/cjs/backend/src/errors/internal_external.js +85 -0
  41. package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +38 -0
  42. package/backend/dist/cjs/{mutex.js → backend/src/errors/invalid_usage_error.js} +20 -37
  43. package/backend/dist/cjs/backend/src/errors/system_error.d.ts +230 -0
  44. package/backend/dist/cjs/backend/src/errors/system_error.js +393 -0
  45. package/backend/dist/cjs/backend/src/events.d.ts +54 -0
  46. package/backend/dist/cjs/backend/src/events.js +15 -0
  47. package/backend/dist/cjs/{frontend.js → backend/src/frontend.js} +1 -1
  48. package/backend/dist/cjs/{image_endpoint.d.ts → backend/src/image_endpoint.d.ts} +16 -1
  49. package/backend/dist/cjs/{image_endpoint.js → backend/src/image_endpoint.js} +3 -5
  50. package/backend/dist/cjs/backend/src/logger.d.ts +5 -0
  51. package/backend/dist/cjs/backend/src/logger.js +15 -0
  52. package/backend/dist/cjs/backend/src/meta.d.ts +64 -0
  53. package/backend/dist/cjs/{meta.js → backend/src/meta.js} +9 -12
  54. package/backend/dist/cjs/backend/src/payments/paddle.d.ts +326 -0
  55. package/backend/dist/cjs/{payments → backend/src/payments}/paddle.js +377 -327
  56. package/backend/dist/cjs/backend/src/plugins/browser.d.ts +1 -0
  57. package/backend/dist/cjs/backend/src/plugins/browser.js +15 -0
  58. package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +248 -0
  59. package/backend/dist/cjs/backend/src/plugins/mail/mail.js +379 -0
  60. package/backend/dist/{esm → cjs/backend/src}/plugins/mail/ui.d.ts +23 -0
  61. package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +1 -0
  62. package/backend/dist/cjs/backend/src/rate_limit.d.ts +145 -0
  63. package/backend/dist/cjs/backend/src/rate_limit.js +549 -0
  64. package/backend/dist/cjs/{route.d.ts → backend/src/route.d.ts} +3 -10
  65. package/backend/dist/cjs/{route.js → backend/src/route.js} +23 -21
  66. package/backend/dist/cjs/backend/src/server.d.ts +485 -0
  67. package/backend/dist/cjs/{server.js → backend/src/server.js} +688 -873
  68. package/backend/dist/cjs/backend/src/splash_screen.d.ts +80 -0
  69. package/backend/dist/cjs/{splash_screen.js → backend/src/splash_screen.js} +24 -3
  70. package/backend/dist/cjs/backend/src/status.d.ts +74 -0
  71. package/backend/dist/cjs/{status.js → backend/src/status.js} +64 -64
  72. package/backend/dist/cjs/backend/src/stream.d.ts +376 -0
  73. package/backend/dist/cjs/{stream.js → backend/src/stream.js} +299 -276
  74. package/backend/dist/cjs/backend/src/users.d.ts +807 -0
  75. package/backend/dist/cjs/backend/src/users.js +1971 -0
  76. package/backend/dist/cjs/backend/src/utils.d.ts +16 -0
  77. package/backend/dist/cjs/{utils.js → backend/src/utils.js} +14 -77
  78. package/backend/dist/{esm → cjs/backend/src}/view.d.ts +33 -11
  79. package/backend/dist/cjs/backend/src/view.js +508 -0
  80. package/backend/dist/{esm → cjs/backend/src}/volt.d.ts +10 -1
  81. package/backend/dist/cjs/{volt.js → backend/src/volt.js} +8 -5
  82. package/backend/dist/cjs/frontend/src/modules/request.d.ts +70 -0
  83. package/backend/dist/cjs/frontend/src/modules/request.js +99 -0
  84. package/backend/dist/esm/{blacklist.d.ts → backend/src/blacklist.d.ts} +5 -3
  85. package/backend/dist/esm/{blacklist.js → backend/src/blacklist.js} +9 -6
  86. package/backend/dist/esm/{cli.js → backend/src/cli.js} +43 -60
  87. package/backend/dist/esm/backend/src/database/collection.d.ts +1543 -0
  88. package/backend/dist/esm/backend/src/database/collection.js +3510 -0
  89. package/backend/dist/esm/backend/src/database/database.d.ts +66 -0
  90. package/backend/dist/esm/{database → backend/src/database}/database.js +62 -103
  91. package/backend/dist/esm/backend/src/database/document.d.ts +1 -0
  92. package/backend/dist/esm/backend/src/database/document.js +558 -0
  93. package/backend/dist/esm/backend/src/database/filters/filters.d.ts +6 -0
  94. package/backend/dist/esm/backend/src/database/filters/filters.js +1 -0
  95. package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +223 -0
  96. package/backend/dist/esm/backend/src/database/filters/strict_filter.js +3 -0
  97. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +1 -0
  98. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +505 -0
  99. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +1 -0
  100. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +712 -0
  101. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
  102. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +5 -0
  103. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
  104. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +44 -0
  105. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
  106. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +5 -0
  107. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
  108. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +1 -0
  109. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  110. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +5 -0
  111. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
  112. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +405 -0
  113. package/backend/dist/esm/backend/src/database/flatten.d.ts +75 -0
  114. package/backend/dist/esm/backend/src/database/flatten.js +22 -0
  115. package/backend/dist/esm/backend/src/database/flatten_test.d.ts +1 -0
  116. package/backend/dist/esm/backend/src/database/flatten_test.js +174 -0
  117. package/backend/dist/esm/backend/src/database/quota/quota.d.ts +461 -0
  118. package/backend/dist/esm/backend/src/database/quota/quota.js +1118 -0
  119. package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +534 -0
  120. package/backend/dist/esm/backend/src/database/quota/quota_v1.js +1242 -0
  121. package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +293 -0
  122. package/backend/dist/esm/backend/src/database/quota/safe_int.js +602 -0
  123. package/backend/dist/{cjs → esm/backend/src}/endpoint.d.ts +69 -46
  124. package/backend/dist/esm/{endpoint.js → backend/src/endpoint.js} +136 -127
  125. package/backend/dist/esm/backend/src/errors/index.d.ts +7 -0
  126. package/backend/dist/esm/backend/src/errors/index.js +7 -0
  127. package/backend/dist/{cjs/utils.d.ts → esm/backend/src/errors/internal_external.d.ts} +14 -22
  128. package/backend/dist/esm/backend/src/errors/internal_external.js +70 -0
  129. package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +38 -0
  130. package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +30 -0
  131. package/backend/dist/esm/backend/src/errors/system_error.d.ts +230 -0
  132. package/backend/dist/esm/backend/src/errors/system_error.js +402 -0
  133. package/backend/dist/esm/backend/src/events.d.ts +54 -0
  134. package/backend/dist/esm/backend/src/events.js +5 -0
  135. package/backend/dist/esm/{frontend.js → backend/src/frontend.js} +1 -1
  136. package/backend/dist/esm/{image_endpoint.d.ts → backend/src/image_endpoint.d.ts} +16 -1
  137. package/backend/dist/esm/{image_endpoint.js → backend/src/image_endpoint.js} +16 -20
  138. package/backend/dist/esm/backend/src/logger.d.ts +5 -0
  139. package/backend/dist/esm/backend/src/logger.js +8 -0
  140. package/backend/dist/esm/backend/src/meta.d.ts +64 -0
  141. package/backend/dist/esm/{meta.js → backend/src/meta.js} +15 -54
  142. package/backend/dist/esm/backend/src/payments/paddle.d.ts +326 -0
  143. package/backend/dist/esm/{payments → backend/src/payments}/paddle.js +417 -452
  144. package/backend/dist/esm/backend/src/plugins/browser.d.ts +1 -0
  145. package/backend/dist/esm/backend/src/plugins/browser.js +170 -0
  146. package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +248 -0
  147. package/backend/dist/esm/backend/src/plugins/mail/mail.js +389 -0
  148. package/backend/dist/{cjs → esm/backend/src}/plugins/mail/ui.d.ts +23 -0
  149. package/backend/dist/esm/{plugins → backend/src/plugins}/mail/ui.js +3 -6
  150. package/backend/dist/esm/backend/src/plugins/pdf.d.ts +1 -0
  151. package/backend/dist/esm/{plugins → backend/src/plugins}/pdf.js +3 -3
  152. package/backend/dist/esm/backend/src/rate_limit.d.ts +145 -0
  153. package/backend/dist/esm/backend/src/rate_limit.js +667 -0
  154. package/backend/dist/esm/{route.d.ts → backend/src/route.d.ts} +3 -10
  155. package/backend/dist/esm/{route.js → backend/src/route.js} +26 -21
  156. package/backend/dist/esm/backend/src/server.d.ts +485 -0
  157. package/backend/dist/esm/{server.js → backend/src/server.js} +891 -1441
  158. package/backend/dist/esm/backend/src/splash_screen.d.ts +80 -0
  159. package/backend/dist/esm/{splash_screen.js → backend/src/splash_screen.js} +42 -55
  160. package/backend/dist/esm/backend/src/status.d.ts +74 -0
  161. package/backend/dist/esm/backend/src/status.js +199 -0
  162. package/backend/dist/esm/backend/src/stream.d.ts +376 -0
  163. package/backend/dist/esm/{stream.js → backend/src/stream.js} +327 -292
  164. package/backend/dist/esm/backend/src/users.d.ts +809 -0
  165. package/backend/dist/esm/backend/src/users.js +2140 -0
  166. package/backend/dist/esm/backend/src/utils.d.ts +16 -0
  167. package/backend/dist/esm/{utils.js → backend/src/utils.js} +20 -81
  168. package/backend/dist/{cjs → esm/backend/src}/view.d.ts +33 -11
  169. package/backend/dist/esm/{view.js → backend/src/view.js} +266 -86
  170. package/backend/dist/{cjs → esm/backend/src}/volt.d.ts +10 -1
  171. package/backend/dist/esm/{volt.js → backend/src/volt.js} +7 -4
  172. package/backend/dist/esm/frontend/src/modules/request.d.ts +70 -0
  173. package/backend/dist/esm/frontend/src/modules/request.js +117 -0
  174. package/frontend/dist/backend/src/database/collection.d.ts +1543 -0
  175. package/frontend/dist/backend/src/database/collection.js +3510 -0
  176. package/frontend/dist/backend/src/database/database.d.ts +66 -0
  177. package/frontend/dist/backend/src/database/database.js +196 -0
  178. package/frontend/dist/backend/src/database/filters/filters.d.ts +6 -0
  179. package/frontend/dist/backend/src/database/filters/filters.js +1 -0
  180. package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +223 -0
  181. package/frontend/dist/backend/src/database/filters/strict_filter.js +3 -0
  182. package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  183. package/frontend/dist/backend/src/database/filters/strict_update_filter.js +5 -0
  184. package/frontend/dist/backend/src/database/flatten.d.ts +75 -0
  185. package/frontend/dist/backend/src/database/flatten.js +22 -0
  186. package/frontend/dist/backend/src/endpoint.d.ts +204 -0
  187. package/frontend/dist/backend/src/endpoint.js +570 -0
  188. package/frontend/dist/backend/src/errors/index.d.ts +7 -0
  189. package/frontend/dist/backend/src/errors/index.js +7 -0
  190. package/frontend/dist/backend/src/errors/internal_external.d.ts +38 -0
  191. package/frontend/dist/backend/src/errors/internal_external.js +70 -0
  192. package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +38 -0
  193. package/frontend/dist/backend/src/errors/invalid_usage_error.js +30 -0
  194. package/frontend/dist/backend/src/errors/system_error.d.ts +230 -0
  195. package/frontend/dist/backend/src/errors/system_error.js +402 -0
  196. package/frontend/dist/backend/src/events.d.ts +54 -0
  197. package/frontend/dist/backend/src/events.js +5 -0
  198. package/frontend/dist/backend/src/frontend.d.ts +11 -0
  199. package/frontend/dist/backend/src/frontend.js +12 -0
  200. package/frontend/dist/backend/src/image_endpoint.d.ts +39 -0
  201. package/frontend/dist/backend/src/image_endpoint.js +202 -0
  202. package/frontend/dist/backend/src/meta.d.ts +64 -0
  203. package/frontend/dist/backend/src/meta.js +110 -0
  204. package/frontend/dist/backend/src/payments/paddle.d.ts +326 -0
  205. package/frontend/dist/backend/src/payments/paddle.js +2256 -0
  206. package/frontend/dist/backend/src/plugins/mail/mail.d.ts +248 -0
  207. package/frontend/dist/backend/src/plugins/mail/mail.js +389 -0
  208. package/{backend/dist/esm/plugins/mail.d.ts → frontend/dist/backend/src/plugins/mail/ui.d.ts} +23 -0
  209. package/{backend/dist/esm/plugins/mail.js → frontend/dist/backend/src/plugins/mail/ui.js} +3 -6
  210. package/frontend/dist/backend/src/rate_limit.d.ts +145 -0
  211. package/frontend/dist/backend/src/rate_limit.js +673 -0
  212. package/frontend/dist/backend/src/route.d.ts +35 -0
  213. package/frontend/dist/backend/src/route.js +212 -0
  214. package/frontend/dist/backend/src/server.d.ts +485 -0
  215. package/frontend/dist/backend/src/server.js +2670 -0
  216. package/frontend/dist/backend/src/splash_screen.d.ts +80 -0
  217. package/frontend/dist/backend/src/splash_screen.js +135 -0
  218. package/frontend/dist/backend/src/status.d.ts +74 -0
  219. package/frontend/dist/backend/src/status.js +199 -0
  220. package/frontend/dist/backend/src/stream.d.ts +376 -0
  221. package/frontend/dist/backend/src/stream.js +1007 -0
  222. package/frontend/dist/backend/src/users.d.ts +807 -0
  223. package/frontend/dist/backend/src/users.js +2118 -0
  224. package/frontend/dist/backend/src/utils.d.ts +16 -0
  225. package/frontend/dist/backend/src/utils.js +241 -0
  226. package/frontend/dist/backend/src/view.d.ts +162 -0
  227. package/frontend/dist/backend/src/view.js +720 -0
  228. package/frontend/dist/frontend/src/elements/base.d.ts +4414 -0
  229. package/frontend/dist/{elements → frontend/src/elements}/base.js +3624 -260
  230. package/frontend/dist/frontend/src/elements/module.d.ts +95 -0
  231. package/frontend/dist/{elements → frontend/src/elements}/module.js +53 -52
  232. package/frontend/dist/frontend/src/elements/types.d.ts +52 -0
  233. package/frontend/dist/frontend/src/elements/types.js +5 -0
  234. package/frontend/dist/frontend/src/modules/attachment.d.ts +126 -0
  235. package/frontend/dist/frontend/src/modules/attachment.js +306 -0
  236. package/frontend/dist/frontend/src/modules/auth.d.ts +44 -0
  237. package/frontend/dist/frontend/src/modules/auth.js +80 -0
  238. package/frontend/dist/{modules → frontend/src/modules}/color.js +2 -2
  239. package/frontend/dist/frontend/src/modules/compression.d.ts +39 -0
  240. package/frontend/dist/frontend/src/modules/compression.js +102 -0
  241. package/frontend/dist/frontend/src/modules/cookies.d.ts +44 -0
  242. package/frontend/dist/frontend/src/modules/cookies.js +143 -0
  243. package/frontend/dist/frontend/src/modules/events.d.ts +31 -0
  244. package/frontend/dist/frontend/src/modules/events.js +74 -0
  245. package/frontend/dist/frontend/src/modules/google.d.ts +23 -0
  246. package/frontend/dist/frontend/src/modules/google.js +52 -0
  247. package/frontend/dist/frontend/src/modules/meta.d.ts +14 -0
  248. package/frontend/dist/{modules → frontend/src/modules}/meta.js +9 -7
  249. package/frontend/dist/{modules → frontend/src/modules}/paddle.d.ts +37 -134
  250. package/frontend/dist/{modules → frontend/src/modules}/paddle.js +620 -568
  251. package/frontend/dist/frontend/src/modules/request.d.ts +70 -0
  252. package/frontend/dist/frontend/src/modules/request.js +117 -0
  253. package/frontend/dist/frontend/src/modules/settings.d.ts +3 -0
  254. package/frontend/dist/frontend/src/modules/settings.js +5 -0
  255. package/frontend/dist/frontend/src/modules/statics.d.ts +21 -0
  256. package/frontend/dist/{modules → frontend/src/modules}/statics.js +15 -18
  257. package/frontend/dist/frontend/src/modules/support.d.ts +30 -0
  258. package/frontend/dist/frontend/src/modules/support.js +53 -0
  259. package/frontend/dist/{modules → frontend/src/modules}/theme.d.ts +67 -0
  260. package/frontend/dist/{modules → frontend/src/modules}/theme.js +68 -38
  261. package/frontend/dist/frontend/src/modules/themes.d.ts +12 -0
  262. package/frontend/dist/frontend/src/modules/themes.js +22 -0
  263. package/frontend/dist/frontend/src/modules/user.d.ts +164 -0
  264. package/frontend/dist/frontend/src/modules/user.js +268 -0
  265. package/frontend/dist/frontend/src/modules/utils.d.ts +176 -0
  266. package/frontend/dist/frontend/src/modules/utils.js +569 -0
  267. package/frontend/dist/frontend/src/types/gradient.d.ts +29 -0
  268. package/frontend/dist/{types → frontend/src/types}/gradient.js +14 -18
  269. package/frontend/dist/frontend/src/ui/border_button.d.ts +94 -0
  270. package/frontend/dist/{ui → frontend/src/ui}/border_button.js +7 -13
  271. package/frontend/dist/frontend/src/ui/button.d.ts +28 -0
  272. package/frontend/dist/{ui → frontend/src/ui}/button.js +21 -12
  273. package/frontend/dist/frontend/src/ui/canvas.d.ts +138 -0
  274. package/frontend/dist/{ui → frontend/src/ui}/canvas.js +88 -55
  275. package/frontend/dist/frontend/src/ui/checkbox.d.ts +74 -0
  276. package/frontend/dist/{ui → frontend/src/ui}/checkbox.js +80 -41
  277. package/frontend/dist/{ui → frontend/src/ui}/code.d.ts +73 -6
  278. package/frontend/dist/{ui → frontend/src/ui}/code.js +55 -52
  279. package/frontend/dist/{ui → frontend/src/ui}/context_menu.d.ts +4 -0
  280. package/frontend/dist/{ui → frontend/src/ui}/context_menu.js +12 -17
  281. package/frontend/dist/{ui → frontend/src/ui}/css.d.ts +4 -0
  282. package/frontend/dist/{ui → frontend/src/ui}/css.js +3 -3
  283. package/frontend/dist/{ui → frontend/src/ui}/divider.d.ts +4 -0
  284. package/frontend/dist/{ui → frontend/src/ui}/divider.js +3 -3
  285. package/frontend/dist/{ui → frontend/src/ui}/dropdown.d.ts +57 -2
  286. package/frontend/dist/{ui → frontend/src/ui}/dropdown.js +87 -94
  287. package/frontend/dist/{ui → frontend/src/ui}/for_each.d.ts +4 -0
  288. package/frontend/dist/{ui → frontend/src/ui}/for_each.js +3 -3
  289. package/frontend/dist/{ui → frontend/src/ui}/form.d.ts +6 -2
  290. package/frontend/dist/{ui → frontend/src/ui}/form.js +10 -7
  291. package/frontend/dist/frontend/src/ui/frame_modes.d.ts +37 -0
  292. package/frontend/dist/{ui → frontend/src/ui}/frame_modes.js +16 -22
  293. package/frontend/dist/{ui → frontend/src/ui}/google_map.d.ts +4 -0
  294. package/frontend/dist/{ui → frontend/src/ui}/google_map.js +4 -4
  295. package/frontend/dist/{ui → frontend/src/ui}/gradient.d.ts +4 -0
  296. package/frontend/dist/{ui → frontend/src/ui}/gradient.js +3 -3
  297. package/frontend/dist/{ui → frontend/src/ui}/image.d.ts +4 -0
  298. package/frontend/dist/{ui → frontend/src/ui}/image.js +5 -5
  299. package/frontend/dist/frontend/src/ui/input.d.ts +392 -0
  300. package/frontend/dist/{ui → frontend/src/ui}/input.js +346 -360
  301. package/frontend/dist/{ui → frontend/src/ui}/link.d.ts +4 -0
  302. package/frontend/dist/{ui → frontend/src/ui}/link.js +3 -3
  303. package/frontend/dist/{ui → frontend/src/ui}/list.d.ts +4 -0
  304. package/frontend/dist/{ui → frontend/src/ui}/list.js +12 -6
  305. package/frontend/dist/frontend/src/ui/loader_button.d.ts +80 -0
  306. package/frontend/dist/{ui → frontend/src/ui}/loader_button.js +35 -47
  307. package/frontend/dist/frontend/src/ui/loaders.d.ts +57 -0
  308. package/frontend/dist/{ui → frontend/src/ui}/loaders.js +11 -11
  309. package/frontend/dist/{ui → frontend/src/ui}/popup.d.ts +11 -6
  310. package/frontend/dist/{ui → frontend/src/ui}/popup.js +32 -18
  311. package/frontend/dist/frontend/src/ui/pseudo.d.ts +44 -0
  312. package/frontend/dist/{ui → frontend/src/ui}/pseudo.js +84 -8
  313. package/frontend/dist/{ui → frontend/src/ui}/scroller.d.ts +14 -2
  314. package/frontend/dist/{ui → frontend/src/ui}/scroller.js +37 -43
  315. package/frontend/dist/{ui → frontend/src/ui}/slider.d.ts +5 -1
  316. package/frontend/dist/{ui → frontend/src/ui}/slider.js +4 -4
  317. package/frontend/dist/{ui → frontend/src/ui}/spacer.d.ts +4 -0
  318. package/frontend/dist/{ui → frontend/src/ui}/spacer.js +3 -3
  319. package/frontend/dist/{ui → frontend/src/ui}/span.d.ts +4 -0
  320. package/frontend/dist/{ui → frontend/src/ui}/span.js +3 -3
  321. package/frontend/dist/{ui → frontend/src/ui}/stack.d.ts +4 -0
  322. package/frontend/dist/{ui → frontend/src/ui}/stack.js +3 -9
  323. package/frontend/dist/frontend/src/ui/steps.d.ts +131 -0
  324. package/frontend/dist/{ui → frontend/src/ui}/steps.js +30 -45
  325. package/frontend/dist/{ui → frontend/src/ui}/style.d.ts +4 -0
  326. package/frontend/dist/{ui → frontend/src/ui}/style.js +3 -3
  327. package/frontend/dist/{ui → frontend/src/ui}/switch.d.ts +5 -1
  328. package/frontend/dist/{ui → frontend/src/ui}/switch.js +4 -4
  329. package/frontend/dist/{ui → frontend/src/ui}/table.d.ts +4 -0
  330. package/frontend/dist/{ui → frontend/src/ui}/table.js +6 -6
  331. package/frontend/dist/{ui → frontend/src/ui}/tabs.d.ts +45 -3
  332. package/frontend/dist/{ui → frontend/src/ui}/tabs.js +65 -40
  333. package/frontend/dist/{ui → frontend/src/ui}/text.d.ts +4 -0
  334. package/frontend/dist/{ui → frontend/src/ui}/text.js +3 -3
  335. package/frontend/dist/frontend/src/ui/title.d.ts +91 -0
  336. package/frontend/dist/frontend/src/ui/title.js +272 -0
  337. package/frontend/dist/{ui → frontend/src/ui}/view.d.ts +4 -0
  338. package/frontend/dist/{ui → frontend/src/ui}/view.js +3 -3
  339. package/frontend/dist/{volt.d.ts → frontend/src/volt.d.ts} +3 -0
  340. package/frontend/dist/{volt.js → frontend/src/volt.js} +4 -0
  341. package/frontend/tools/bundle_d_ts.js +71 -0
  342. package/frontend/tools/convert_to_jsdoc_input.txt +9452 -0
  343. package/frontend/tools/convert_to_jsdoc_output.txt +7626 -0
  344. package/frontend/tools/convert_to_jsdoc_tmp.js +345 -0
  345. package/package.json +11 -12
  346. package/backend/dist/cjs/database/collection.d.ts +0 -160
  347. package/backend/dist/cjs/database/collection.js +0 -842
  348. package/backend/dist/cjs/database/database.d.ts +0 -121
  349. package/backend/dist/cjs/database/document.d.ts +0 -131
  350. package/backend/dist/cjs/database/document.js +0 -224
  351. package/backend/dist/cjs/database.d.ts +0 -502
  352. package/backend/dist/cjs/database.js +0 -2248
  353. package/backend/dist/cjs/logger.d.ts +0 -3
  354. package/backend/dist/cjs/meta.d.ts +0 -50
  355. package/backend/dist/cjs/mutex.d.ts +0 -24
  356. package/backend/dist/cjs/payments/paddle.d.ts +0 -160
  357. package/backend/dist/cjs/plugins/browser.d.ts +0 -36
  358. package/backend/dist/cjs/plugins/browser.js +0 -198
  359. package/backend/dist/cjs/plugins/css.d.ts +0 -11
  360. package/backend/dist/cjs/plugins/css.js +0 -80
  361. package/backend/dist/cjs/plugins/mail.d.ts +0 -277
  362. package/backend/dist/cjs/plugins/mail.js +0 -1370
  363. package/backend/dist/cjs/plugins/ts/compiler.d.ts +0 -139
  364. package/backend/dist/cjs/plugins/ts/compiler.js +0 -750
  365. package/backend/dist/cjs/plugins/ts/preprocessing.d.ts +0 -14
  366. package/backend/dist/cjs/plugins/ts/preprocessing.js +0 -440
  367. package/backend/dist/cjs/rate_limit.d.ts +0 -63
  368. package/backend/dist/cjs/rate_limit.js +0 -348
  369. package/backend/dist/cjs/request.deprc.d.ts +0 -48
  370. package/backend/dist/cjs/request.deprc.js +0 -572
  371. package/backend/dist/cjs/response.deprc.d.ts +0 -55
  372. package/backend/dist/cjs/response.deprc.js +0 -275
  373. package/backend/dist/cjs/server.d.ts +0 -342
  374. package/backend/dist/cjs/splash_screen.d.ts +0 -35
  375. package/backend/dist/cjs/status.d.ts +0 -61
  376. package/backend/dist/cjs/stream.d.ts +0 -79
  377. package/backend/dist/cjs/users.d.ts +0 -111
  378. package/backend/dist/cjs/users.js +0 -1817
  379. package/backend/dist/cjs/view.js +0 -352
  380. package/backend/dist/cjs/vinc.dev.d.ts +0 -3
  381. package/backend/dist/cjs/vinc.dev.js +0 -7
  382. package/backend/dist/css/adyen.css +0 -92
  383. package/backend/dist/css/volt.css +0 -70
  384. package/backend/dist/esm/database/collection.d.ts +0 -160
  385. package/backend/dist/esm/database/collection.js +0 -1328
  386. package/backend/dist/esm/database/database.d.ts +0 -121
  387. package/backend/dist/esm/database/document.d.ts +0 -131
  388. package/backend/dist/esm/database/document.js +0 -247
  389. package/backend/dist/esm/database.d.ts +0 -502
  390. package/backend/dist/esm/database.js +0 -2423
  391. package/backend/dist/esm/file_watcher.js +0 -329
  392. package/backend/dist/esm/logger.d.ts +0 -3
  393. package/backend/dist/esm/logger.js +0 -11
  394. package/backend/dist/esm/meta.d.ts +0 -50
  395. package/backend/dist/esm/mutex.d.ts +0 -24
  396. package/backend/dist/esm/mutex.js +0 -48
  397. package/backend/dist/esm/payments/paddle.d.ts +0 -160
  398. package/backend/dist/esm/plugins/browser.d.ts +0 -36
  399. package/backend/dist/esm/plugins/browser.js +0 -176
  400. package/backend/dist/esm/plugins/css.d.ts +0 -11
  401. package/backend/dist/esm/plugins/css.js +0 -90
  402. package/backend/dist/esm/plugins/ts/compiler.d.ts +0 -139
  403. package/backend/dist/esm/plugins/ts/compiler.js +0 -1194
  404. package/backend/dist/esm/plugins/ts/preprocessing.d.ts +0 -14
  405. package/backend/dist/esm/plugins/ts/preprocessing.js +0 -726
  406. package/backend/dist/esm/rate_limit.d.ts +0 -63
  407. package/backend/dist/esm/rate_limit.js +0 -417
  408. package/backend/dist/esm/request.deprc.d.ts +0 -48
  409. package/backend/dist/esm/request.deprc.js +0 -572
  410. package/backend/dist/esm/response.deprc.d.ts +0 -55
  411. package/backend/dist/esm/response.deprc.js +0 -275
  412. package/backend/dist/esm/server.d.ts +0 -342
  413. package/backend/dist/esm/splash_screen.d.ts +0 -35
  414. package/backend/dist/esm/status.d.ts +0 -61
  415. package/backend/dist/esm/status.js +0 -197
  416. package/backend/dist/esm/stream.d.ts +0 -79
  417. package/backend/dist/esm/users.d.ts +0 -111
  418. package/backend/dist/esm/users.js +0 -1935
  419. package/backend/dist/esm/vinc.dev.d.ts +0 -3
  420. package/backend/dist/esm/vinc.dev.js +0 -7
  421. package/frontend/dist/elements/base.d.ts +0 -9889
  422. package/frontend/dist/elements/module.d.ts +0 -30
  423. package/frontend/dist/modules/array.d.ts +0 -94
  424. package/frontend/dist/modules/array.js +0 -634
  425. package/frontend/dist/modules/auth.d.ts +0 -46
  426. package/frontend/dist/modules/auth.js +0 -139
  427. package/frontend/dist/modules/colors.d.ts +0 -1
  428. package/frontend/dist/modules/colors.js +0 -417
  429. package/frontend/dist/modules/compression.d.ts +0 -6
  430. package/frontend/dist/modules/compression.js +0 -999
  431. package/frontend/dist/modules/cookies.d.ts +0 -18
  432. package/frontend/dist/modules/cookies.js +0 -167
  433. package/frontend/dist/modules/date.d.ts +0 -142
  434. package/frontend/dist/modules/date.js +0 -493
  435. package/frontend/dist/modules/events.d.ts +0 -8
  436. package/frontend/dist/modules/events.js +0 -91
  437. package/frontend/dist/modules/google.d.ts +0 -11
  438. package/frontend/dist/modules/google.js +0 -54
  439. package/frontend/dist/modules/meta.d.ts +0 -10
  440. package/frontend/dist/modules/mutex.d.ts +0 -7
  441. package/frontend/dist/modules/mutex.js +0 -51
  442. package/frontend/dist/modules/number.d.ts +0 -16
  443. package/frontend/dist/modules/number.js +0 -23
  444. package/frontend/dist/modules/object.d.ts +0 -52
  445. package/frontend/dist/modules/object.js +0 -383
  446. package/frontend/dist/modules/scheme.d.ts +0 -227
  447. package/frontend/dist/modules/scheme.js +0 -531
  448. package/frontend/dist/modules/settings.d.ts +0 -3
  449. package/frontend/dist/modules/settings.js +0 -4
  450. package/frontend/dist/modules/statics.d.ts +0 -5
  451. package/frontend/dist/modules/string.d.ts +0 -124
  452. package/frontend/dist/modules/string.js +0 -745
  453. package/frontend/dist/modules/support.d.ts +0 -19
  454. package/frontend/dist/modules/support.js +0 -103
  455. package/frontend/dist/modules/themes.d.ts +0 -8
  456. package/frontend/dist/modules/themes.js +0 -18
  457. package/frontend/dist/modules/user.d.ts +0 -59
  458. package/frontend/dist/modules/user.js +0 -280
  459. package/frontend/dist/modules/utils.d.ts +0 -87
  460. package/frontend/dist/modules/utils.js +0 -923
  461. package/frontend/dist/types/gradient.d.ts +0 -12
  462. package/frontend/dist/ui/border_button.d.ts +0 -152
  463. package/frontend/dist/ui/button.d.ts +0 -21
  464. package/frontend/dist/ui/canvas.d.ts +0 -56
  465. package/frontend/dist/ui/checkbox.d.ts +0 -52
  466. package/frontend/dist/ui/frame_modes.d.ts +0 -25
  467. package/frontend/dist/ui/input.d.ts +0 -241
  468. package/frontend/dist/ui/loader_button.d.ts +0 -93
  469. package/frontend/dist/ui/loaders.d.ts +0 -57
  470. package/frontend/dist/ui/pseudo.d.ts +0 -16
  471. package/frontend/dist/ui/steps.d.ts +0 -59
  472. package/frontend/dist/ui/title.d.ts +0 -21
  473. package/frontend/dist/ui/title.js +0 -121
  474. package/frontend/examples/dashboard/dashboard.ts +0 -776
  475. /package/backend/dist/cjs/{cli.d.ts → backend/src/cli.d.ts} +0 -0
  476. /package/backend/dist/cjs/{file_watcher.d.ts → backend/src/database/document.d.ts} +0 -0
  477. /package/backend/dist/cjs/{file_watcher.js → backend/src/database/document.js} +0 -0
  478. /package/backend/dist/cjs/{plugins/pdf.d.ts → backend/src/database/filters/strict_filter_test.d.ts} +0 -0
  479. /package/backend/dist/{esm/file_watcher.d.ts → cjs/backend/src/database/filters/strict_filter_test_v0.d.ts} +0 -0
  480. /package/backend/dist/{esm/plugins/pdf.d.ts → cjs/backend/src/database/flatten_test.d.ts} +0 -0
  481. /package/backend/dist/cjs/{frontend.d.ts → backend/src/frontend.d.ts} +0 -0
  482. /package/backend/dist/cjs/{plugins → backend/src/plugins}/communication.d.ts +0 -0
  483. /package/backend/dist/cjs/{plugins → backend/src/plugins}/communication.js +0 -0
  484. /package/backend/dist/cjs/{plugins → backend/src/plugins}/mail/ui.js +0 -0
  485. /package/backend/dist/cjs/{plugins → backend/src/plugins}/pdf.js +0 -0
  486. /package/backend/dist/cjs/{plugins → backend/src/plugins}/thread_monitor.d.ts +0 -0
  487. /package/backend/dist/cjs/{plugins → backend/src/plugins}/thread_monitor.js +0 -0
  488. /package/backend/dist/cjs/{vinc.d.ts → backend/src/vinc.d.ts} +0 -0
  489. /package/backend/dist/cjs/{vinc.js → backend/src/vinc.js} +0 -0
  490. /package/backend/dist/esm/{cli.d.ts → backend/src/cli.d.ts} +0 -0
  491. /package/backend/dist/esm/{frontend.d.ts → backend/src/frontend.d.ts} +0 -0
  492. /package/backend/dist/esm/{plugins → backend/src/plugins}/communication.d.ts +0 -0
  493. /package/backend/dist/esm/{plugins → backend/src/plugins}/communication.js +0 -0
  494. /package/backend/dist/esm/{plugins → backend/src/plugins}/thread_monitor.d.ts +0 -0
  495. /package/backend/dist/esm/{plugins → backend/src/plugins}/thread_monitor.js +0 -0
  496. /package/backend/dist/esm/{vinc.d.ts → backend/src/vinc.d.ts} +0 -0
  497. /package/backend/dist/esm/{vinc.js → backend/src/vinc.js} +0 -0
  498. /package/frontend/dist/{elements → frontend/src/elements}/register_element.d.ts +0 -0
  499. /package/frontend/dist/{elements → frontend/src/elements}/register_element.js +0 -0
  500. /package/frontend/dist/{modules → frontend/src/modules}/color.d.ts +0 -0
  501. /package/frontend/dist/{ui → frontend/src/ui}/ui.d.ts +0 -0
  502. /package/frontend/dist/{ui → frontend/src/ui}/ui.js +0 -0
@@ -1,923 +0,0 @@
1
- /*
2
- * Author: Daan van den Bergh
3
- * Copyright: © 2022 - 2024 Daan van den Bergh.
4
- */
5
- // Utils module.
6
- const Utils = {
7
- is_apple: navigator.vendor.includes('Apple'),
8
- is_safari: navigator.vendor.includes('Apple'),
9
- /* @docs:
10
- @nav: Frontend
11
- @chapter: Utils
12
- @title: Check if value is a string
13
- @desc: Determine whether the provided value is a string.
14
- @param:
15
- @name: value
16
- @description The value to check.
17
- @type: any
18
- @return:
19
- @description Returns true if the value is a string, otherwise false.
20
- @type: boolean
21
- */
22
- is_string(value) {
23
- return typeof value === 'string' || value instanceof String;
24
- },
25
- /* @docs:
26
- @nav: Frontend
27
- @chapter: Utils
28
- @title: Check if value is numeric
29
- @desc: Determine whether the provided value is a finite number.
30
- @param:
31
- @name: value
32
- @description The value to check.
33
- @type: any
34
- @return:
35
- @description Returns true if the value is a finite number, otherwise false.
36
- @type: boolean
37
- */
38
- is_numeric(value) {
39
- return typeof value === 'number' && Number.isFinite(value);
40
- },
41
- /* @docs:
42
- @nav: Frontend
43
- @chapter: Utils
44
- @title: Check if value is an integer
45
- @desc: Determine whether the provided value is an integer.
46
- @param:
47
- @name: value
48
- @description The value to check.
49
- @type: any
50
- @return:
51
- @description Returns true if the value is an integer, otherwise false.
52
- @type: boolean
53
- */
54
- is_int(value) {
55
- return typeof value === 'number' && Number.isInteger(value);
56
- },
57
- /* @docs:
58
- @nav: Frontend
59
- @chapter: Utils
60
- @title: Check if value is a float
61
- @desc: Determine whether the provided value is a floating-point number.
62
- @param:
63
- @name: value
64
- @description The value to check.
65
- @type: any
66
- @return:
67
- @description Returns true if the value is a float, otherwise false.
68
- @type: boolean
69
- */
70
- is_float(value) {
71
- return typeof value === 'number' && !Number.isNaN(value) && !Number.isInteger(value);
72
- },
73
- /* @docs:
74
- @nav: Frontend
75
- @chapter: Utils
76
- @title: Check if value is a function
77
- @desc: Determine whether the provided value is a function.
78
- @param:
79
- @name: value
80
- @description The value to check.
81
- @type: any
82
- @return:
83
- @description Returns true if the value is a function, otherwise false.
84
- @type: boolean
85
- */
86
- is_func(value) {
87
- return typeof value === 'function';
88
- },
89
- /* @docs:
90
- @nav: Frontend
91
- @chapter: Utils
92
- @title: Check if value is an array
93
- @desc: Determine whether the provided value is an array.
94
- @param:
95
- @name: value
96
- @description The value to check.
97
- @type: any
98
- @return:
99
- @description Returns true if the value is an array, otherwise false.
100
- @type: boolean
101
- */
102
- is_array(value) {
103
- return Array.isArray(value);
104
- },
105
- /* @docs:
106
- @nav: Frontend
107
- @chapter: Utils
108
- @title: Check if value is an object
109
- @desc: Determine whether the provided value is a non-array object.
110
- @param:
111
- @name: value
112
- @description The value to check.
113
- @type: any
114
- @return:
115
- @description Returns true if the value is an object and not an array, otherwise false.
116
- @type: boolean
117
- */
118
- is_obj(value) {
119
- return value != null && typeof value === 'object' && !Array.isArray(value);
120
- },
121
- /* @docs:
122
- @nav: Frontend
123
- @chapter: Utils
124
- @title: Check if number is even
125
- @desc: Determine whether the provided number is even.
126
- @param:
127
- @name: number
128
- @description The number to check.
129
- @type: number
130
- @return:
131
- @description Returns true if the number is even, otherwise false.
132
- @type: boolean
133
- */
134
- is_even(number) {
135
- return number % 2 === 0;
136
- },
137
- /* @docs:
138
- @nav: Frontend
139
- @chapter: Utils
140
- @title: Is Mobile
141
- @desc: Check if the user agent is a mobile device.
142
- */
143
- is_mobile() {
144
- return (!!navigator.userAgent.match(/Android/i) ||
145
- !!navigator.userAgent.match(/webOS/i) ||
146
- !!navigator.userAgent.match(/iPhone/i) ||
147
- !!navigator.userAgent.match(/iPad/i) ||
148
- !!navigator.userAgent.match(/iPod/i) ||
149
- !!navigator.userAgent.match(/BlackBerry/i) ||
150
- !!navigator.userAgent.match(/Windows Phone/i));
151
- },
152
- /* @docs:
153
- @nav: Frontend
154
- @chapter: Utils
155
- @title: Make Immutable
156
- @desc:
157
- Make all objects of an array or object immutable. All nested objects will also be made immutable recursively.
158
- @param:
159
- @name: object
160
- @desc: The array or object to freeze.
161
- @type: array | object
162
- */
163
- make_immutable(object) {
164
- if (Array.isArray(object)) {
165
- object.forEach((item, index) => {
166
- if (item !== null && typeof item === "object") {
167
- object[index] = Utils.make_immutable(item);
168
- }
169
- });
170
- Object.freeze(object);
171
- }
172
- else if (object !== null && typeof object === "object") {
173
- Object.keys(object).forEach((key) => {
174
- if (object[key] !== null && typeof object[key] === "object") {
175
- object[key] = Utils.make_immutable(object[key]);
176
- }
177
- });
178
- Object.freeze(object);
179
- }
180
- return object;
181
- },
182
- /* @docs:
183
- @nav: Frontend
184
- @chapter: Utils
185
- @title: Is child
186
- @desc:
187
- Check if an element is a direct child of an element or the parent element itself.
188
- @param:
189
- @name: parent
190
- @desc: The parent element to test.
191
- @type: Node | Element
192
- @param:
193
- @name: target
194
- @desc: The target element to test.
195
- @type: Node | Element
196
- */
197
- is_child(parent, target) {
198
- for (let i = 0; i < parent.children.length; i++) {
199
- if (target === parent.children[i]) {
200
- return true;
201
- }
202
- }
203
- return false;
204
- },
205
- /* @docs:
206
- @nav: Frontend
207
- @chapter: Utils
208
- @title: Is child recursively
209
- @desc:
210
- Check if an element is a recursively nested child of an element or the parent element itself.
211
- @param:
212
- @name: parent
213
- @desc: The parent element to test.
214
- @type: Node | Element
215
- @param:
216
- @name: target
217
- @desc: The target element to test.
218
- @type: Node | Element
219
- @param:
220
- @name: stop_node
221
- @desc: A node at which to stop checking if target is a parent of the current element.
222
- @type: Node | Element | null
223
- */
224
- is_nested_child(parent, target, stop_node = null) {
225
- let e = target instanceof Element ? target : null;
226
- while (e != null) {
227
- if (e === parent) {
228
- return true;
229
- }
230
- else if (e === stop_node) {
231
- return false;
232
- }
233
- e = e.parentElement;
234
- }
235
- return false;
236
- },
237
- // Equals.
238
- // eq(x, y) { return x == y; }
239
- // not_eq(x, y) { return x != y; }
240
- // Greater than.
241
- // gt(x, y) { return x > y; }
242
- // gt_eq(x, y) { return x >= y; }
243
- // Lesser than.
244
- // lt(x, y) { return x < y; }
245
- // lt_eq(x, y) { return x <= y; }
246
- /* @docs:
247
- @nav: Frontend
248
- @chapter: Utils
249
- @title: Round to decimals
250
- @desc: Round a number to a specified number of decimal places.
251
- @param:
252
- @name: value
253
- @desc: The number to round.
254
- @type: number
255
- @name: decimals
256
- @desc: The number of decimal places.
257
- @type: number
258
- @return:
259
- @desc: The rounded number.
260
- @type: number
261
- */
262
- round(value, decimals) {
263
- const factor = 10 ** decimals;
264
- return Math.round(value * factor) / factor;
265
- },
266
- /* @docs:
267
- @nav: Frontend
268
- @chapter: Utils
269
- @title: Get device width
270
- @desc: Get the width of the device's viewport.
271
- @return:
272
- @desc: The width of the device's viewport.
273
- @type: number
274
- */
275
- device_width() {
276
- return (window.innerWidth > 0) ? window.innerWidth : screen.width;
277
- },
278
- /* @docs:
279
- @nav: Frontend
280
- @chapter: Utils
281
- @title: Get device height
282
- @desc: Get the height of the device's viewport.
283
- @return:
284
- @desc: The height of the device's viewport.
285
- @type: number
286
- */
287
- device_height() {
288
- return (window.innerHeight > 0) ? window.innerHeight : screen.height;
289
- },
290
- /* @docs:
291
- @nav: Frontend
292
- @chapter: Utils
293
- @title: Get endpoint
294
- @desc: Get the endpoint sub URL of a full domain URL. When parameter "url" is undefined, it uses the current URL.
295
- @param:
296
- @name: url
297
- @desc: The full domain URL.
298
- @type: string | null
299
- @return:
300
- @desc: The endpoint sub URL.
301
- @type: string
302
- */
303
- endpoint(url = null) {
304
- if (url == null) {
305
- return Utils.endpoint(window.location.href);
306
- }
307
- else {
308
- // Strip http:// or https://
309
- let endpoint = url.replace(/^https?:\/\//, "");
310
- // Remove domain.
311
- const firstSlash = endpoint.indexOf('/');
312
- endpoint = firstSlash !== -1 ? endpoint.substring(firstSlash) : '/';
313
- // Strip query.
314
- const queryIndex = endpoint.indexOf("?");
315
- if (queryIndex !== -1) {
316
- endpoint = endpoint.substring(0, queryIndex);
317
- }
318
- // Clean.
319
- endpoint = endpoint.replaceAll("//", "/");
320
- // Remove trailing slashes.
321
- if (endpoint.length === 0) {
322
- return '/';
323
- }
324
- else {
325
- while (endpoint.length > 1 && endpoint.endsWith('/')) {
326
- endpoint = endpoint.slice(0, -1);
327
- }
328
- }
329
- return endpoint;
330
- }
331
- },
332
- // Get style name for vendor prefix.
333
- // get_vendor_prefix_property(property: string, style: CSSStyleDeclaration): string {
334
- // if (Utils.vendor_prefix_cache[property]) {
335
- // return Utils.vendor_prefix_cache[property];
336
- // }
337
- // const vendors = ['webkit', 'moz', 'ms', 'o'];
338
- // for (let i = 0; i < vendors.length; i++) {
339
- // let vendor_property = "-";
340
- // vendor_property += vendors[i];
341
- // vendor_property += "-";
342
- // vendor_property += property;
343
- // if (property in style) {
344
- // Utils.vendor_prefix_cache[property] = vendor_property;
345
- // return vendor_property;
346
- // }
347
- // }
348
- // Utils.vendor_prefix_cache[property] = property;
349
- // return property;
350
- // }
351
- /* @docs:
352
- @nav: Frontend
353
- @chapter: Utils
354
- @title: Redirect
355
- @desc: Redirect to a specified URL, optionally forcing the redirect even if the endpoint is the same.
356
- @param:
357
- @name: url
358
- @desc: The URL to redirect to.
359
- @type: string
360
- @name: forced
361
- @desc: Whether to force the redirect even if the current endpoint is the same as the target URL.
362
- @type: boolean
363
- */
364
- redirect(url, forced = false) {
365
- if (forced || Utils.endpoint() !== url) {
366
- window.location.href = url;
367
- }
368
- },
369
- /* @docs:
370
- @nav: Frontend
371
- @chapter: Utils
372
- @title: Delay
373
- @desc: Delay the execution of a function by a specified number of milliseconds.
374
- @param:
375
- @name: mseconds
376
- @desc: The number of milliseconds to delay.
377
- @type: number
378
- @name: func
379
- @desc: The function to execute after the delay.
380
- @type: () => void
381
- */
382
- delay(mseconds, func) {
383
- setTimeout(() => func(), mseconds);
384
- },
385
- /* @docs:
386
- @nav: Frontend
387
- @chapter: Utils
388
- @title: Get URL parameter
389
- @desc: Get a URL parameter by name, with an optional default value.
390
- @param:
391
- @name: name
392
- @desc: The name of the URL parameter.
393
- @type: string
394
- @name: def
395
- @desc: The default value to return if the parameter is not found.
396
- @type: any | null
397
- @return:
398
- @desc: The value of the URL parameter or the default value.
399
- @type: any | null
400
- */
401
- url_param(name, def = null) {
402
- const params = new URLSearchParams(window.location.search);
403
- const param = params.get(name);
404
- if (param == null || param === "") {
405
- return def;
406
- }
407
- switch (param.toLowerCase()) {
408
- case "true": return true;
409
- case "false": return false;
410
- case "null": return null;
411
- default: return param;
412
- }
413
- },
414
- /* @docs:
415
- @nav: Frontend
416
- @chapter: Utils
417
- @title: URL Encode
418
- @desc: Encode an object into a URL-encoded query string.
419
- @param:
420
- @name: params
421
- @desc: The parameters to encode.
422
- @type: Record<string, any>
423
- @return:
424
- @desc: The URL-encoded query string.
425
- @type: string
426
- */
427
- url_encode(params) {
428
- const encodedParams = [];
429
- Object.keys(params).forEach((key) => {
430
- const encodedKey = encodeURIComponent(key);
431
- const encodedValue = encodeURIComponent(params[key]);
432
- encodedParams.push(`${encodedKey}=${encodedValue}`);
433
- });
434
- return encodedParams.join('&');
435
- },
436
- /* @docs:
437
- @nav: Frontend
438
- @chapter: Utils
439
- @title: Copy to Clipboard
440
- @desc: Copy text to the clipboard.
441
- @param:
442
- @name: text
443
- @desc: The text to copy.
444
- @type: string
445
- @return:
446
- @desc: A Promise that resolves when the text is copied.
447
- @type: Promise<void>
448
- */
449
- async copy_to_clipboard(text) {
450
- return new Promise((resolve, reject) => {
451
- navigator.clipboard.writeText(text)
452
- .then(() => {
453
- resolve();
454
- })
455
- .catch((err) => {
456
- reject(err);
457
- });
458
- });
459
- },
460
- // Get the brightness of a hex color (0.0 white 1.0 dark).
461
- // @deprecated moved to `Colors`
462
- hex_brightness(color) {
463
- // Remove the hash symbol if present
464
- color = color.replace(/^#/, '');
465
- // Convert hex to RGB
466
- const bigint = parseInt(color, 16);
467
- const r = (bigint >> 16) & 255;
468
- const g = (bigint >> 8) & 255;
469
- const b = bigint & 255;
470
- // Calculate perceived brightness using the relative luminance formula
471
- const brightness = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
472
- return brightness;
473
- },
474
- // Hex to rgbA.
475
- // @deprecated moved to `Colors`
476
- hex_to_rgb(hex) {
477
- let index = hex.indexOf("#");
478
- if (index !== -1) {
479
- hex = hex.substr(index + 1);
480
- }
481
- let r = parseInt(hex.substring(0, 2), 16);
482
- let g = parseInt(hex.substring(2, 4), 16);
483
- let b = parseInt(hex.substring(4, 6), 16);
484
- let a = 1;
485
- if (hex.length > 6) {
486
- a = parseInt(hex.substring(6, 8)) / 100;
487
- }
488
- return { r, g, b, a };
489
- },
490
- /* @docs:
491
- @nav: Frontend
492
- @chapter: Utils
493
- @title: Deep copy
494
- @desc: Perform a deep copy on any type, it does not support classes, only primitive objects.
495
- @param:
496
- @name: obj
497
- @desc: The object to deep copy.
498
- @type: any
499
- @return:
500
- @desc: The deep copied object.
501
- @type: any
502
- */
503
- deep_copy(obj) {
504
- if (Array.isArray(obj)) {
505
- const copy = [];
506
- obj.forEach((item) => {
507
- copy.push(Utils.deep_copy(item));
508
- });
509
- return copy;
510
- }
511
- else if (obj !== null && obj instanceof String) {
512
- return new String(obj.toString());
513
- }
514
- else if (obj !== null && typeof obj === "object") {
515
- const copy = {};
516
- const keys = Object.keys(obj);
517
- const values = Object.values(obj);
518
- for (let i = 0; i < keys.length; i++) {
519
- copy[keys[i]] = Utils.deep_copy(values[i]);
520
- }
521
- return copy;
522
- }
523
- else {
524
- return obj;
525
- }
526
- },
527
- /** New request method. */
528
- async request(options) {
529
- const { method = 'GET', url = null, data = null, json = true, credentials = "same-origin", headers = {}, } = options;
530
- // — prepare headers —
531
- if (json && data != null && !headers['Content-Type']) {
532
- headers['Content-Type'] = 'application/json';
533
- }
534
- // — build URL + body —
535
- let finalUrl = url;
536
- let body;
537
- if (data != null && typeof data === 'object') {
538
- if (method.toUpperCase() === 'GET') {
539
- finalUrl = `${url}?${new URLSearchParams(data).toString()}`;
540
- }
541
- else {
542
- body = JSON.stringify(data);
543
- }
544
- }
545
- else if (data != null) {
546
- body = String(data);
547
- }
548
- const init = { method, credentials, headers };
549
- if (body !== undefined)
550
- init.body = body;
551
- try {
552
- const response = await fetch(finalUrl, init);
553
- const status = response.status;
554
- // — parse payload once —
555
- let payload;
556
- const clone = response.clone(); // @dev.
557
- if (json) {
558
- try {
559
- payload = await response.json();
560
- }
561
- catch (e) {
562
- // malformed JSON still counts as a “success” fetch
563
- console.log("[debug] Unable to parse a json from response:", await clone.text(), "- Error: ", JSON.stringify(e, null, 4));
564
- console.log("[debug] Response:", response);
565
- return {
566
- status,
567
- error: { message: `Failed to parse JSON response: ${e.message}` },
568
- };
569
- }
570
- }
571
- else {
572
- try {
573
- payload = await response.text();
574
- }
575
- catch (e) {
576
- return {
577
- status,
578
- error: { message: `Failed to parse text response: ${e.message}` },
579
- };
580
- }
581
- }
582
- // console.log("Payload", json, payload)
583
- // — handle HTTP errors (4xx/5xx) by resolving with an error object —
584
- if (!response.ok) {
585
- // if server wrapped its error in { error: { message, type?, invalid_fields? }, … }
586
- if (payload &&
587
- typeof payload === 'object' &&
588
- typeof payload.error === 'object' &&
589
- typeof payload.error.message === 'string') {
590
- return {
591
- status,
592
- error: {
593
- message: payload.error.message,
594
- type: payload.error.type,
595
- invalid_fields: payload.error.invalid_fields,
596
- },
597
- data: payload.data,
598
- };
599
- }
600
- // otherwise fall back to a generic single‐message error
601
- const msg = typeof payload === 'string'
602
- ? payload
603
- : payload?.error?.toString() ?? JSON.stringify(payload);
604
- return {
605
- status,
606
- error: { message: msg },
607
- };
608
- }
609
- // — 2xx: success —
610
- return { status, data: payload };
611
- }
612
- catch (networkErr) {
613
- // genuine network / system failure
614
- throw networkErr;
615
- }
616
- },
617
- // @deprecated.
618
- /* @docs:
619
- @nav: Frontend
620
- @chapter: Utils
621
- @title: Request
622
- @desc: Make an HTTP request with the specified options.
623
- @param:
624
- @name: options
625
- @desc: The request options.
626
- @type: {
627
- method?: string,
628
- url?: string | null,
629
- data?: any,
630
- json?: boolean,
631
- credentials?: 'include' | 'same-origin' | 'omit',
632
- headers?: Record<string, string>,
633
- }
634
- @return:
635
- @desc: A Promise that resolves with the response data.
636
- @type: Promise<any>
637
- */
638
- request_v1(options) {
639
- const { method = "GET", url = null, data = null, json = true, credentials = "same-origin", headers = {}, } = options;
640
- // Set headers.
641
- // Host and User-Agent headers are restricted and set by the browser itself.
642
- if (json && data !== null && headers['Content-Type'] == null) {
643
- headers['Content-Type'] = 'application/json';
644
- }
645
- // Handle data.
646
- let finalUrl = url;
647
- let bodyData = data !== null ? data : undefined;
648
- if (data !== null && typeof data === "object") {
649
- if (method.toUpperCase() === "GET") {
650
- finalUrl = `${url}?${new URLSearchParams(data).toString()}`;
651
- bodyData = undefined;
652
- }
653
- else {
654
- // Stringify.
655
- bodyData = JSON.stringify(data);
656
- }
657
- }
658
- // Define options.
659
- const fetchOptions = {
660
- method,
661
- credentials,
662
- headers,
663
- body: bodyData,
664
- };
665
- return new Promise((resolve, reject) => {
666
- fetch(finalUrl, fetchOptions)
667
- .then(response => {
668
- // Handle error code.
669
- if (!response.ok) {
670
- // Parse as json.
671
- if (json) {
672
- const clone = response.clone();
673
- response.json().then(data => {
674
- if (data.status === undefined) {
675
- data.status = response.status;
676
- }
677
- reject(data);
678
- }).catch(err => {
679
- clone.text()
680
- .then(data => {
681
- reject({
682
- error: data,
683
- status: response.status
684
- });
685
- })
686
- .catch(text_err => {
687
- reject({
688
- error: err,
689
- status: response.status
690
- });
691
- });
692
- });
693
- }
694
- // Reject.
695
- else {
696
- reject({
697
- error: response.statusText,
698
- status: response.status
699
- });
700
- }
701
- return; // stop.
702
- }
703
- // Successful response.
704
- if (json) {
705
- response.json().then(data => {
706
- resolve(data);
707
- }).catch(err => {
708
- console.log("Response:", response);
709
- reject({
710
- error: 'Failed to parse JSON response: ' + err.message,
711
- status: response.status
712
- });
713
- });
714
- }
715
- else {
716
- response.text().then(data => {
717
- resolve(data);
718
- }).catch(err => {
719
- console.log("Response:", response);
720
- reject({
721
- error: 'Failed to parse text response: ' + err.message,
722
- status: response.status
723
- });
724
- });
725
- }
726
- })
727
- .catch(error => {
728
- reject({ error: error.message }); // Reject with error message if fetch fails
729
- });
730
- });
731
- },
732
- /*
733
- request(options: {
734
- method?: string,
735
- url?: string | null,
736
- data?: any,
737
- async?: boolean,
738
- success?: (status: number, data: any) => void,
739
- error?: (status: number, error: any) => void,
740
- before?: () => void,
741
- }): Promise<any> {
742
- // Original commented out implementation.
743
- }
744
- */
745
- /* @docs:
746
- @nav: Frontend
747
- @chapter: Utils
748
- @title: On load
749
- @desc: Execute a function when the content is loaded, optionally handling a splash screen.
750
- @param:
751
- @name: func
752
- @desc: The function to execute when the content is loaded.
753
- @type: () => HTMLElement | Promise<HTMLElement> | null
754
- @return:
755
- @desc: void
756
- @type: void
757
- */
758
- async on_load(func) {
759
- // document.addEventListener("DOMContentLoaded", async () => {
760
- const splash = document.getElementById("__volt_splash_screen");
761
- if (splash != null) {
762
- splash.remove();
763
- }
764
- let e = func();
765
- if (e instanceof Promise) {
766
- try {
767
- e = await e;
768
- }
769
- catch (err) {
770
- console.error(err);
771
- return;
772
- }
773
- }
774
- if (e != null && e instanceof HTMLElement) {
775
- document.body.appendChild(e);
776
- }
777
- // });
778
- },
779
- /**
780
- * @deprecated Use vlib.VDate instead.
781
- * @docs:
782
-
783
- @nav: Frontend
784
- @chapter: Utils
785
- @title: Unix to Date
786
- @desc: Convert a Unix timestamp in seconds or milliseconds to the user's date format.
787
- @param:
788
- @name: unix
789
- @desc: The Unix timestamp.
790
- @type: number
791
- @name: mseconds
792
- @desc: Optional. Whether the Unix timestamp is in milliseconds.
793
- @type: boolean | null
794
- @return:
795
- @desc: The formatted date string.
796
- @type: string
797
- */
798
- unix_to_date(unix, mseconds = null) {
799
- // Guess msec or sec.
800
- if (mseconds === null) {
801
- // As of now, Unix time in milliseconds is 13 digits and in seconds is 10 digits
802
- const str = unix.toString();
803
- if (str.length === 13) {
804
- mseconds = true;
805
- }
806
- else if (str.length === 10) {
807
- mseconds = false;
808
- }
809
- else {
810
- // Future-proofing: When second-based timestamps eventually reach 11 digits
811
- if (str.length > 10 && str.length < 13) {
812
- // Check if adding three zeroes (to simulate milliseconds) results in a plausible future date
813
- // This is a rough estimation and might not be accurate
814
- const futureCheck = new Date(parseInt(str + "000", 10));
815
- if (futureCheck.getFullYear() > new Date().getFullYear() && futureCheck.getFullYear() < 3000) {
816
- mseconds = false;
817
- }
818
- }
819
- }
820
- }
821
- // Format.
822
- const date = new Date(mseconds ? unix : unix * 1000);
823
- const lang = navigator.language || navigator.userLanguage;
824
- const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
825
- let options = {
826
- year: "numeric",
827
- month: "2-digit",
828
- day: "2-digit",
829
- timeZone: tz,
830
- };
831
- const date_format = new Intl.DateTimeFormat(lang, options).format(date);
832
- options = {
833
- hour: "2-digit",
834
- minute: "2-digit",
835
- second: "2-digit",
836
- hour12: lang.toLowerCase().includes("en"),
837
- timeZone: tz,
838
- };
839
- const time_format = new Intl.DateTimeFormat(lang, options).format(date);
840
- return `${date_format} ${time_format}`;
841
- },
842
- /* @docs:
843
- @nav: Frontend
844
- @chapter: Utils
845
- @title: Debounce
846
- @desc: Create a debounced version of a function that delays invoking it until after a specified delay.
847
- @param:
848
- @name: delay
849
- @desc: The number of milliseconds to delay.
850
- @type: number
851
- @name: func
852
- @desc: The function to debounce.
853
- @type: (...args: any[]) => void
854
- @return:
855
- @desc: The debounced function.
856
- @type: (...args: any[]) => void
857
- */
858
- debounce(delay, func) {
859
- let timeout;
860
- return function (...args) {
861
- if (timeout !== undefined) {
862
- clearTimeout(timeout);
863
- }
864
- timeout = window.setTimeout(() => func.apply(this, args), delay);
865
- };
866
- },
867
- // Create the on render observer.
868
- on_render_observer: new ResizeObserver((entries, observer) => {
869
- entries.forEach(entry => {
870
- const target = entry.target;
871
- if (!target.rendered) {
872
- target._on_render_callbacks.iterate((func) => { func(entry.target); });
873
- target.rendered = true;
874
- Utils.on_render_observer.unobserve(entry.target);
875
- }
876
- });
877
- }),
878
- // Create the on resize observer.
879
- on_resize_observer: new ResizeObserver((entries, observer) => {
880
- entries.forEach(entry => {
881
- entry.target._on_resize_callbacks.iterate((func) => { func(entry.target); });
882
- });
883
- }),
884
- // Aggregate multiple classes into a single class, can be used to extend more than one class.
885
- // aggregate(
886
- // BaseClass: new (...args: any[]) => any,
887
- // ...Mixins: Array<new (...args: any[]) => any>
888
- // ) {
889
- // class AggregatedClass extends BaseClass {
890
- // constructor(...args: any[]) {
891
- // super(...args);
892
- // // Additional initialization if needed
893
- // }
894
- // }
895
- // // Copy methods and properties from mixin classes to the AggregatedClass prototype
896
- // Mixins.forEach(MixinClass => {
897
- // // Copy instance methods and properties
898
- // Object.getOwnPropertyNames(MixinClass.prototype).forEach(name => {
899
- // if (name !== 'constructor') {
900
- // Object.defineProperty(
901
- // AggregatedClass.prototype,
902
- // name,
903
- // Object.getOwnPropertyDescriptor(MixinClass.prototype, name)!
904
- // );
905
- // }
906
- // });
907
- // // Copy static methods and properties if needed
908
- // Object.getOwnPropertyNames(MixinClass).forEach(name => {
909
- // if (name !== 'prototype' && name !== 'name' && name !== 'length') {
910
- // Object.defineProperty(
911
- // AggregatedClass,
912
- // name,
913
- // Object.getOwnPropertyDescriptor(MixinClass, name)!
914
- // );
915
- // }
916
- // });
917
- // });
918
- // return AggregatedClass;
919
- // },
920
- };
921
- // Export.
922
- export { Utils };
923
- export { Utils as utils }; // also export as lowercase for compatibility.