@vandenberghinc/volt 1.2.6 → 1.2.8

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 (472) hide show
  1. package/.libris/config.json +82 -0
  2. package/backend/dist/cjs/backend/src/blacklist.d.ts +12 -0
  3. package/backend/dist/cjs/backend/src/blacklist.js +78 -0
  4. package/backend/dist/cjs/backend/src/cli.d.ts +2 -0
  5. package/backend/dist/cjs/backend/src/cli.js +198 -0
  6. package/backend/dist/cjs/backend/src/database/collection.d.ts +1765 -0
  7. package/backend/dist/cjs/backend/src/database/collection.js +3301 -0
  8. package/backend/dist/cjs/backend/src/database/database.d.ts +92 -0
  9. package/backend/dist/cjs/backend/src/database/database.js +170 -0
  10. package/backend/dist/cjs/backend/src/database/document.d.ts +1 -0
  11. package/backend/dist/cjs/backend/src/database/document.js +15 -0
  12. package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +6 -0
  13. package/backend/dist/cjs/backend/src/database/filters/filters.js +15 -0
  14. package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +223 -0
  15. package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +15 -0
  16. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.d.ts +1 -0
  17. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +443 -0
  18. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.d.ts +1 -0
  19. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +15 -0
  20. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
  21. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +15 -0
  22. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
  23. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +15 -0
  24. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
  25. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +15 -0
  26. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
  27. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +15 -0
  28. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  29. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +15 -0
  30. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
  31. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +355 -0
  32. package/backend/dist/cjs/backend/src/database/flatten.d.ts +78 -0
  33. package/backend/dist/cjs/backend/src/database/flatten.js +53 -0
  34. package/backend/dist/cjs/backend/src/database/flatten_test.d.ts +1 -0
  35. package/backend/dist/cjs/backend/src/database/flatten_test.js +175 -0
  36. package/backend/dist/cjs/backend/src/database/quota/quoata_v2.d.ts +533 -0
  37. package/backend/dist/cjs/backend/src/database/quota/quoata_v2.js +1046 -0
  38. package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +551 -0
  39. package/backend/dist/cjs/backend/src/database/quota/quota.js +1108 -0
  40. package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +534 -0
  41. package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +1087 -0
  42. package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +412 -0
  43. package/backend/dist/cjs/backend/src/database/quota/safe_int.js +745 -0
  44. package/backend/dist/cjs/backend/src/endpoint.d.ts +346 -0
  45. package/backend/dist/cjs/backend/src/endpoint.js +468 -0
  46. package/backend/dist/cjs/backend/src/errors/index.d.ts +7 -0
  47. package/backend/dist/cjs/backend/src/errors/index.js +25 -0
  48. package/backend/dist/cjs/backend/src/errors/internal_external.d.ts +52 -0
  49. package/backend/dist/cjs/backend/src/errors/internal_external.js +95 -0
  50. package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +41 -0
  51. package/backend/dist/cjs/backend/src/errors/invalid_usage_error.js +47 -0
  52. package/backend/dist/cjs/backend/src/errors/system_error.d.ts +261 -0
  53. package/backend/dist/cjs/backend/src/errors/system_error.js +436 -0
  54. package/backend/dist/cjs/backend/src/events.d.ts +97 -0
  55. package/backend/dist/cjs/backend/src/events.js +15 -0
  56. package/backend/dist/cjs/backend/src/frontend.d.ts +13 -0
  57. package/backend/dist/cjs/backend/src/frontend.js +56 -0
  58. package/backend/dist/cjs/backend/src/image_endpoint.d.ts +44 -0
  59. package/backend/dist/cjs/backend/src/image_endpoint.js +185 -0
  60. package/backend/dist/cjs/backend/src/index.d.ts +23 -0
  61. package/backend/dist/cjs/backend/src/index.js +70 -0
  62. package/backend/dist/cjs/backend/src/logger.d.ts +5 -0
  63. package/backend/dist/cjs/backend/src/logger.js +15 -0
  64. package/backend/dist/cjs/backend/src/meta.d.ts +112 -0
  65. package/backend/dist/cjs/backend/src/meta.js +181 -0
  66. package/backend/dist/cjs/backend/src/payments/paddle.d.ts +329 -0
  67. package/backend/dist/cjs/backend/src/payments/paddle.js +1996 -0
  68. package/backend/dist/cjs/backend/src/payments/stripe/checkout.d.ts +113 -0
  69. package/backend/dist/cjs/backend/src/payments/stripe/checkout.js +295 -0
  70. package/backend/dist/cjs/backend/src/payments/stripe/customers.d.ts +17 -0
  71. package/backend/dist/cjs/backend/src/payments/stripe/customers.js +164 -0
  72. package/backend/dist/cjs/backend/src/payments/stripe/error.d.ts +74 -0
  73. package/backend/dist/cjs/backend/src/payments/stripe/error.js +64 -0
  74. package/backend/dist/cjs/backend/src/payments/stripe/events.d.ts +155 -0
  75. package/backend/dist/cjs/backend/src/payments/stripe/events.js +15 -0
  76. package/backend/dist/cjs/backend/src/payments/stripe/meters.d.ts +105 -0
  77. package/backend/dist/cjs/backend/src/payments/stripe/meters.js +230 -0
  78. package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.d.ts +58 -0
  79. package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.js +109 -0
  80. package/backend/dist/cjs/backend/src/payments/stripe/products.d.ts +519 -0
  81. package/backend/dist/cjs/backend/src/payments/stripe/products.js +650 -0
  82. package/backend/dist/cjs/backend/src/payments/stripe/stripe.d.ts +215 -0
  83. package/backend/dist/cjs/backend/src/payments/stripe/stripe.js +468 -0
  84. package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.d.ts +172 -0
  85. package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.js +557 -0
  86. package/backend/dist/cjs/backend/src/payments/stripe/utils.d.ts +63 -0
  87. package/backend/dist/cjs/backend/src/payments/stripe/utils.js +118 -0
  88. package/backend/dist/cjs/backend/src/payments/stripe/webhooks.d.ts +105 -0
  89. package/backend/dist/cjs/backend/src/payments/stripe/webhooks.js +627 -0
  90. package/backend/dist/cjs/backend/src/plugins/browser.d.ts +1 -0
  91. package/backend/dist/cjs/backend/src/plugins/browser.js +15 -0
  92. package/backend/dist/cjs/backend/src/plugins/communication.d.ts +70 -0
  93. package/backend/dist/cjs/backend/src/plugins/communication.js +196 -0
  94. package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +255 -0
  95. package/backend/dist/cjs/backend/src/plugins/mail/mail.js +381 -0
  96. package/backend/dist/cjs/backend/src/plugins/mail/ui.d.ts +297 -0
  97. package/backend/dist/cjs/backend/src/plugins/mail/ui.js +1370 -0
  98. package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +1 -0
  99. package/backend/dist/cjs/backend/src/plugins/pdf.js +1456 -0
  100. package/backend/dist/cjs/backend/src/plugins/thread_monitor.d.ts +18 -0
  101. package/backend/dist/cjs/backend/src/plugins/thread_monitor.js +116 -0
  102. package/backend/dist/cjs/backend/src/rate_limit.d.ts +148 -0
  103. package/backend/dist/cjs/backend/src/rate_limit.js +543 -0
  104. package/backend/dist/cjs/backend/src/route.d.ts +39 -0
  105. package/backend/dist/cjs/backend/src/route.js +172 -0
  106. package/backend/dist/cjs/backend/src/server.d.ts +502 -0
  107. package/backend/dist/cjs/backend/src/server.js +1710 -0
  108. package/backend/dist/cjs/backend/src/server.old.d.ts +594 -0
  109. package/backend/dist/cjs/backend/src/server.old.js +2058 -0
  110. package/backend/dist/cjs/backend/src/splash_screen.d.ts +93 -0
  111. package/backend/dist/cjs/backend/src/splash_screen.js +119 -0
  112. package/backend/dist/cjs/backend/src/status.d.ts +89 -0
  113. package/backend/dist/cjs/backend/src/status.js +211 -0
  114. package/backend/dist/cjs/backend/src/stream.d.ts +494 -0
  115. package/backend/dist/cjs/backend/src/stream.js +1370 -0
  116. package/backend/dist/cjs/backend/src/users.d.ts +926 -0
  117. package/backend/dist/cjs/backend/src/users.js +2223 -0
  118. package/backend/dist/cjs/backend/src/utils.d.ts +22 -0
  119. package/backend/dist/cjs/backend/src/utils.js +626 -0
  120. package/backend/dist/cjs/backend/src/view.d.ts +115 -0
  121. package/backend/dist/cjs/backend/src/view.js +519 -0
  122. package/backend/dist/cjs/backend/src/vinc.d.ts +6 -0
  123. package/backend/dist/cjs/backend/src/vinc.js +40 -0
  124. package/backend/dist/cjs/backend/src/volt.d.ts +24 -0
  125. package/backend/dist/cjs/backend/src/volt.js +72 -0
  126. package/backend/dist/cjs/frontend/src/modules/request.d.ts +70 -0
  127. package/backend/dist/cjs/frontend/src/modules/request.js +99 -0
  128. package/backend/dist/cjs/package.json +1 -0
  129. package/backend/dist/esm/backend/src/blacklist.d.ts +12 -0
  130. package/backend/dist/esm/backend/src/blacklist.js +52 -0
  131. package/backend/dist/esm/backend/src/cli.d.ts +2 -0
  132. package/backend/dist/esm/backend/src/cli.js +211 -0
  133. package/backend/dist/esm/backend/src/database/collection.d.ts +1765 -0
  134. package/backend/dist/esm/backend/src/database/collection.js +3779 -0
  135. package/backend/dist/esm/backend/src/database/database.d.ts +92 -0
  136. package/backend/dist/esm/backend/src/database/database.js +214 -0
  137. package/backend/dist/esm/backend/src/database/document.d.ts +1 -0
  138. package/backend/dist/esm/backend/src/database/document.js +558 -0
  139. package/backend/dist/esm/backend/src/database/filters/filters.d.ts +6 -0
  140. package/backend/dist/esm/backend/src/database/filters/filters.js +1 -0
  141. package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +223 -0
  142. package/backend/dist/esm/backend/src/database/filters/strict_filter.js +3 -0
  143. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +1 -0
  144. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +505 -0
  145. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +1 -0
  146. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +712 -0
  147. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
  148. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +5 -0
  149. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
  150. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +44 -0
  151. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
  152. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +5 -0
  153. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
  154. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +1 -0
  155. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  156. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +5 -0
  157. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
  158. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +415 -0
  159. package/backend/dist/esm/backend/src/database/flatten.d.ts +78 -0
  160. package/backend/dist/esm/backend/src/database/flatten.js +22 -0
  161. package/backend/dist/esm/backend/src/database/flatten_test.d.ts +1 -0
  162. package/backend/dist/esm/backend/src/database/flatten_test.js +174 -0
  163. package/backend/dist/esm/backend/src/database/quota/quoata_v2.d.ts +533 -0
  164. package/backend/dist/esm/backend/src/database/quota/quoata_v2.js +1155 -0
  165. package/backend/dist/esm/backend/src/database/quota/quota.d.ts +551 -0
  166. package/backend/dist/esm/backend/src/database/quota/quota.js +1219 -0
  167. package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +534 -0
  168. package/backend/dist/esm/backend/src/database/quota/quota_v1.js +1242 -0
  169. package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +412 -0
  170. package/backend/dist/esm/backend/src/database/quota/safe_int.js +810 -0
  171. package/backend/dist/esm/backend/src/endpoint.d.ts +346 -0
  172. package/backend/dist/esm/backend/src/endpoint.js +479 -0
  173. package/backend/dist/esm/backend/src/errors/index.d.ts +7 -0
  174. package/backend/dist/esm/backend/src/errors/index.js +7 -0
  175. package/backend/dist/esm/backend/src/errors/internal_external.d.ts +52 -0
  176. package/backend/dist/esm/backend/src/errors/internal_external.js +86 -0
  177. package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +41 -0
  178. package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +33 -0
  179. package/backend/dist/esm/backend/src/errors/system_error.d.ts +261 -0
  180. package/backend/dist/esm/backend/src/errors/system_error.js +444 -0
  181. package/backend/dist/esm/backend/src/events.d.ts +97 -0
  182. package/backend/dist/esm/backend/src/events.js +5 -0
  183. package/backend/dist/esm/backend/src/frontend.d.ts +13 -0
  184. package/backend/dist/esm/backend/src/frontend.js +23 -0
  185. package/backend/dist/esm/backend/src/image_endpoint.d.ts +44 -0
  186. package/backend/dist/esm/backend/src/image_endpoint.js +196 -0
  187. package/backend/dist/esm/backend/src/index.d.ts +23 -0
  188. package/backend/dist/esm/backend/src/index.js +26 -0
  189. package/backend/dist/esm/backend/src/logger.d.ts +5 -0
  190. package/backend/dist/esm/backend/src/logger.js +8 -0
  191. package/backend/dist/esm/backend/src/meta.d.ts +112 -0
  192. package/backend/dist/esm/backend/src/meta.js +152 -0
  193. package/backend/dist/esm/backend/src/payments/paddle.d.ts +329 -0
  194. package/backend/dist/esm/backend/src/payments/paddle.js +2276 -0
  195. package/backend/dist/esm/backend/src/payments/stripe/checkout.d.ts +113 -0
  196. package/backend/dist/esm/backend/src/payments/stripe/checkout.js +356 -0
  197. package/backend/dist/esm/backend/src/payments/stripe/customers.d.ts +17 -0
  198. package/backend/dist/esm/backend/src/payments/stripe/customers.js +193 -0
  199. package/backend/dist/esm/backend/src/payments/stripe/error.d.ts +74 -0
  200. package/backend/dist/esm/backend/src/payments/stripe/error.js +51 -0
  201. package/backend/dist/esm/backend/src/payments/stripe/events.d.ts +155 -0
  202. package/backend/dist/esm/backend/src/payments/stripe/events.js +5 -0
  203. package/backend/dist/esm/backend/src/payments/stripe/meters.d.ts +105 -0
  204. package/backend/dist/esm/backend/src/payments/stripe/meters.js +318 -0
  205. package/backend/dist/esm/backend/src/payments/stripe/payment_methods.d.ts +58 -0
  206. package/backend/dist/esm/backend/src/payments/stripe/payment_methods.js +135 -0
  207. package/backend/dist/esm/backend/src/payments/stripe/products.d.ts +519 -0
  208. package/backend/dist/esm/backend/src/payments/stripe/products.js +896 -0
  209. package/backend/dist/esm/backend/src/payments/stripe/stripe.d.ts +215 -0
  210. package/backend/dist/esm/backend/src/payments/stripe/stripe.js +464 -0
  211. package/backend/dist/esm/backend/src/payments/stripe/subscriptions.d.ts +172 -0
  212. package/backend/dist/esm/backend/src/payments/stripe/subscriptions.js +754 -0
  213. package/backend/dist/esm/backend/src/payments/stripe/utils.d.ts +63 -0
  214. package/backend/dist/esm/backend/src/payments/stripe/utils.js +131 -0
  215. package/backend/dist/esm/backend/src/payments/stripe/webhooks.d.ts +105 -0
  216. package/backend/dist/esm/backend/src/payments/stripe/webhooks.js +752 -0
  217. package/backend/dist/esm/backend/src/plugins/browser.d.ts +1 -0
  218. package/backend/dist/esm/backend/src/plugins/browser.js +170 -0
  219. package/backend/dist/esm/backend/src/plugins/communication.d.ts +70 -0
  220. package/backend/dist/esm/backend/src/plugins/communication.js +169 -0
  221. package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +255 -0
  222. package/backend/dist/esm/backend/src/plugins/mail/mail.js +396 -0
  223. package/backend/dist/esm/backend/src/plugins/mail/ui.d.ts +297 -0
  224. package/backend/dist/esm/backend/src/plugins/mail/ui.js +1400 -0
  225. package/backend/dist/esm/backend/src/plugins/pdf.d.ts +1 -0
  226. package/backend/dist/esm/backend/src/plugins/pdf.js +1694 -0
  227. package/backend/dist/esm/backend/src/plugins/thread_monitor.d.ts +18 -0
  228. package/backend/dist/esm/backend/src/plugins/thread_monitor.js +120 -0
  229. package/backend/dist/esm/backend/src/rate_limit.d.ts +148 -0
  230. package/backend/dist/esm/backend/src/rate_limit.js +667 -0
  231. package/backend/dist/esm/backend/src/route.d.ts +39 -0
  232. package/backend/dist/esm/backend/src/route.js +222 -0
  233. package/backend/dist/esm/backend/src/server.d.ts +502 -0
  234. package/backend/dist/esm/backend/src/server.js +2031 -0
  235. package/backend/dist/esm/backend/src/server.old.d.ts +594 -0
  236. package/backend/dist/esm/backend/src/server.old.js +2630 -0
  237. package/backend/dist/esm/backend/src/splash_screen.d.ts +93 -0
  238. package/backend/dist/esm/backend/src/splash_screen.js +156 -0
  239. package/backend/dist/esm/backend/src/status.d.ts +89 -0
  240. package/backend/dist/esm/backend/src/status.js +213 -0
  241. package/backend/dist/esm/backend/src/stream.d.ts +494 -0
  242. package/backend/dist/esm/backend/src/stream.js +1611 -0
  243. package/backend/dist/esm/backend/src/users.d.ts +926 -0
  244. package/backend/dist/esm/backend/src/users.js +2423 -0
  245. package/backend/dist/esm/backend/src/utils.d.ts +22 -0
  246. package/backend/dist/esm/backend/src/utils.js +463 -0
  247. package/backend/dist/esm/backend/src/view.d.ts +115 -0
  248. package/backend/dist/esm/backend/src/view.js +584 -0
  249. package/backend/dist/esm/backend/src/vinc.d.ts +6 -0
  250. package/backend/dist/esm/backend/src/vinc.js +6 -0
  251. package/backend/dist/esm/backend/src/volt.d.ts +24 -0
  252. package/backend/dist/esm/backend/src/volt.js +27 -0
  253. package/backend/dist/esm/frontend/src/modules/request.d.ts +70 -0
  254. package/backend/dist/esm/frontend/src/modules/request.js +117 -0
  255. package/backend/old/file_watcher.ts +359 -0
  256. package/backend/old/request.deprc.js +626 -0
  257. package/backend/old/response.deprc.js +354 -0
  258. package/frontend/dist/backend/src/database/collection.d.ts +1765 -0
  259. package/frontend/dist/backend/src/database/collection.js +3779 -0
  260. package/frontend/dist/backend/src/database/database.d.ts +92 -0
  261. package/frontend/dist/backend/src/database/database.js +214 -0
  262. package/frontend/dist/backend/src/database/filters/filters.d.ts +6 -0
  263. package/frontend/dist/backend/src/database/filters/filters.js +1 -0
  264. package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +223 -0
  265. package/frontend/dist/backend/src/database/filters/strict_filter.js +3 -0
  266. package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  267. package/frontend/dist/backend/src/database/filters/strict_update_filter.js +5 -0
  268. package/frontend/dist/backend/src/database/flatten.d.ts +78 -0
  269. package/frontend/dist/backend/src/database/flatten.js +22 -0
  270. package/frontend/dist/backend/src/endpoint.d.ts +346 -0
  271. package/frontend/dist/backend/src/endpoint.js +479 -0
  272. package/frontend/dist/backend/src/errors/index.d.ts +7 -0
  273. package/frontend/dist/backend/src/errors/index.js +7 -0
  274. package/frontend/dist/backend/src/errors/internal_external.d.ts +52 -0
  275. package/frontend/dist/backend/src/errors/internal_external.js +86 -0
  276. package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +41 -0
  277. package/frontend/dist/backend/src/errors/invalid_usage_error.js +33 -0
  278. package/frontend/dist/backend/src/errors/system_error.d.ts +261 -0
  279. package/frontend/dist/backend/src/errors/system_error.js +444 -0
  280. package/frontend/dist/backend/src/events.d.ts +97 -0
  281. package/frontend/dist/backend/src/events.js +5 -0
  282. package/frontend/dist/backend/src/frontend.d.ts +13 -0
  283. package/frontend/dist/backend/src/frontend.js +23 -0
  284. package/frontend/dist/backend/src/image_endpoint.d.ts +44 -0
  285. package/frontend/dist/backend/src/image_endpoint.js +196 -0
  286. package/frontend/dist/backend/src/meta.d.ts +112 -0
  287. package/frontend/dist/backend/src/meta.js +152 -0
  288. package/frontend/dist/backend/src/payments/paddle.d.ts +329 -0
  289. package/frontend/dist/backend/src/payments/paddle.js +2276 -0
  290. package/frontend/dist/backend/src/payments/stripe/checkout.d.ts +113 -0
  291. package/frontend/dist/backend/src/payments/stripe/checkout.js +356 -0
  292. package/frontend/dist/backend/src/payments/stripe/customers.d.ts +17 -0
  293. package/frontend/dist/backend/src/payments/stripe/customers.js +193 -0
  294. package/frontend/dist/backend/src/payments/stripe/error.d.ts +74 -0
  295. package/frontend/dist/backend/src/payments/stripe/error.js +51 -0
  296. package/frontend/dist/backend/src/payments/stripe/events.d.ts +155 -0
  297. package/frontend/dist/backend/src/payments/stripe/events.js +5 -0
  298. package/frontend/dist/backend/src/payments/stripe/meters.d.ts +105 -0
  299. package/frontend/dist/backend/src/payments/stripe/meters.js +318 -0
  300. package/frontend/dist/backend/src/payments/stripe/payment_methods.d.ts +58 -0
  301. package/frontend/dist/backend/src/payments/stripe/payment_methods.js +135 -0
  302. package/frontend/dist/backend/src/payments/stripe/products.d.ts +519 -0
  303. package/frontend/dist/backend/src/payments/stripe/products.js +896 -0
  304. package/frontend/dist/backend/src/payments/stripe/stripe.d.ts +215 -0
  305. package/frontend/dist/backend/src/payments/stripe/stripe.js +464 -0
  306. package/frontend/dist/backend/src/payments/stripe/subscriptions.d.ts +172 -0
  307. package/frontend/dist/backend/src/payments/stripe/subscriptions.js +754 -0
  308. package/frontend/dist/backend/src/payments/stripe/utils.d.ts +63 -0
  309. package/frontend/dist/backend/src/payments/stripe/utils.js +131 -0
  310. package/frontend/dist/backend/src/payments/stripe/webhooks.d.ts +105 -0
  311. package/frontend/dist/backend/src/payments/stripe/webhooks.js +752 -0
  312. package/frontend/dist/backend/src/plugins/mail/mail.d.ts +255 -0
  313. package/frontend/dist/backend/src/plugins/mail/mail.js +396 -0
  314. package/frontend/dist/backend/src/plugins/mail/ui.d.ts +297 -0
  315. package/frontend/dist/backend/src/plugins/mail/ui.js +1400 -0
  316. package/frontend/dist/backend/src/rate_limit.d.ts +148 -0
  317. package/frontend/dist/backend/src/rate_limit.js +667 -0
  318. package/frontend/dist/backend/src/route.d.ts +39 -0
  319. package/frontend/dist/backend/src/route.js +222 -0
  320. package/frontend/dist/backend/src/server.d.ts +502 -0
  321. package/frontend/dist/backend/src/server.js +2031 -0
  322. package/frontend/dist/backend/src/splash_screen.d.ts +93 -0
  323. package/frontend/dist/backend/src/splash_screen.js +156 -0
  324. package/frontend/dist/backend/src/status.d.ts +89 -0
  325. package/frontend/dist/backend/src/status.js +213 -0
  326. package/frontend/dist/backend/src/stream.d.ts +494 -0
  327. package/frontend/dist/backend/src/stream.js +1611 -0
  328. package/frontend/dist/backend/src/users.d.ts +926 -0
  329. package/frontend/dist/backend/src/users.js +2423 -0
  330. package/frontend/dist/backend/src/utils.d.ts +22 -0
  331. package/frontend/dist/backend/src/utils.js +463 -0
  332. package/frontend/dist/backend/src/view.d.ts +115 -0
  333. package/frontend/dist/backend/src/view.js +584 -0
  334. package/frontend/dist/frontend/src/css/adyen.css +92 -0
  335. package/frontend/dist/frontend/src/css/volt.css +75 -0
  336. package/frontend/dist/frontend/src/elements/base.d.ts +3743 -0
  337. package/frontend/dist/frontend/src/elements/base.js +12151 -0
  338. package/frontend/dist/frontend/src/elements/module.d.ts +95 -0
  339. package/frontend/dist/frontend/src/elements/module.js +216 -0
  340. package/frontend/dist/frontend/src/elements/register_element.d.ts +3 -0
  341. package/frontend/dist/frontend/src/elements/register_element.js +22 -0
  342. package/frontend/dist/frontend/src/elements/resize_query_manager.d.ts +0 -0
  343. package/frontend/dist/frontend/src/elements/resize_query_manager.js +150 -0
  344. package/frontend/dist/frontend/src/elements/types.d.ts +52 -0
  345. package/frontend/dist/frontend/src/elements/types.js +5 -0
  346. package/frontend/dist/frontend/src/index.d.ts +21 -0
  347. package/frontend/dist/frontend/src/index.js +29 -0
  348. package/frontend/dist/frontend/src/modules/attachment.d.ts +126 -0
  349. package/frontend/dist/frontend/src/modules/attachment.js +306 -0
  350. package/frontend/dist/frontend/src/modules/auth.d.ts +44 -0
  351. package/frontend/dist/frontend/src/modules/auth.js +80 -0
  352. package/frontend/dist/frontend/src/modules/color.d.ts +160 -0
  353. package/frontend/dist/frontend/src/modules/color.js +316 -0
  354. package/frontend/dist/frontend/src/modules/compression.d.ts +39 -0
  355. package/frontend/dist/frontend/src/modules/compression.js +102 -0
  356. package/frontend/dist/frontend/src/modules/cookies.d.ts +44 -0
  357. package/frontend/dist/frontend/src/modules/cookies.js +143 -0
  358. package/frontend/dist/frontend/src/modules/events.d.ts +31 -0
  359. package/frontend/dist/frontend/src/modules/events.js +79 -0
  360. package/frontend/dist/frontend/src/modules/google.d.ts +23 -0
  361. package/frontend/dist/frontend/src/modules/google.js +52 -0
  362. package/frontend/dist/frontend/src/modules/meta.d.ts +14 -0
  363. package/frontend/dist/frontend/src/modules/meta.js +48 -0
  364. package/frontend/dist/frontend/src/modules/paddle.d.ts +1207 -0
  365. package/frontend/dist/frontend/src/modules/paddle.js +2594 -0
  366. package/frontend/dist/frontend/src/modules/request.d.ts +70 -0
  367. package/frontend/dist/frontend/src/modules/request.js +117 -0
  368. package/frontend/dist/frontend/src/modules/settings.d.ts +3 -0
  369. package/frontend/dist/frontend/src/modules/settings.js +5 -0
  370. package/frontend/dist/frontend/src/modules/statics.d.ts +21 -0
  371. package/frontend/dist/frontend/src/modules/statics.js +43 -0
  372. package/frontend/dist/frontend/src/modules/stripe/cart.d.ts +112 -0
  373. package/frontend/dist/frontend/src/modules/stripe/cart.js +321 -0
  374. package/frontend/dist/frontend/src/modules/stripe/checkout.d.ts +7 -0
  375. package/frontend/dist/frontend/src/modules/stripe/checkout.js +37 -0
  376. package/frontend/dist/frontend/src/modules/stripe/index.m.d.ts +6 -0
  377. package/frontend/dist/frontend/src/modules/stripe/index.m.js +6 -0
  378. package/frontend/dist/frontend/src/modules/stripe/payments.d.ts +58 -0
  379. package/frontend/dist/frontend/src/modules/stripe/payments.js +92 -0
  380. package/frontend/dist/frontend/src/modules/support.d.ts +30 -0
  381. package/frontend/dist/frontend/src/modules/support.js +53 -0
  382. package/frontend/dist/frontend/src/modules/theme.d.ts +133 -0
  383. package/frontend/dist/frontend/src/modules/theme.js +406 -0
  384. package/frontend/dist/frontend/src/modules/themes.d.ts +12 -0
  385. package/frontend/dist/frontend/src/modules/themes.js +22 -0
  386. package/frontend/dist/frontend/src/modules/user.d.ts +164 -0
  387. package/frontend/dist/frontend/src/modules/user.js +270 -0
  388. package/frontend/dist/frontend/src/modules/utils.d.ts +176 -0
  389. package/frontend/dist/frontend/src/modules/utils.js +569 -0
  390. package/frontend/dist/frontend/src/types/gradient.d.ts +29 -0
  391. package/frontend/dist/frontend/src/types/gradient.js +79 -0
  392. package/frontend/dist/frontend/src/ui/border_button.d.ts +94 -0
  393. package/frontend/dist/frontend/src/ui/border_button.js +228 -0
  394. package/frontend/dist/frontend/src/ui/button.d.ts +241 -0
  395. package/frontend/dist/frontend/src/ui/button.js +682 -0
  396. package/frontend/dist/frontend/src/ui/canvas.d.ts +138 -0
  397. package/frontend/dist/frontend/src/ui/canvas.js +444 -0
  398. package/frontend/dist/frontend/src/ui/checkbox.d.ts +74 -0
  399. package/frontend/dist/frontend/src/ui/checkbox.js +321 -0
  400. package/frontend/dist/frontend/src/ui/code.d.ts +235 -0
  401. package/frontend/dist/frontend/src/ui/code.js +1007 -0
  402. package/frontend/dist/frontend/src/ui/context_menu.d.ts +36 -0
  403. package/frontend/dist/frontend/src/ui/context_menu.js +205 -0
  404. package/frontend/dist/frontend/src/ui/css.d.ts +16 -0
  405. package/frontend/dist/frontend/src/ui/css.js +48 -0
  406. package/frontend/dist/frontend/src/ui/divider.d.ts +15 -0
  407. package/frontend/dist/frontend/src/ui/divider.js +78 -0
  408. package/frontend/dist/frontend/src/ui/dropdown.d.ts +176 -0
  409. package/frontend/dist/frontend/src/ui/dropdown.js +481 -0
  410. package/frontend/dist/frontend/src/ui/for_each.d.ts +37 -0
  411. package/frontend/dist/frontend/src/ui/for_each.js +92 -0
  412. package/frontend/dist/frontend/src/ui/form.d.ts +34 -0
  413. package/frontend/dist/frontend/src/ui/form.js +233 -0
  414. package/frontend/dist/frontend/src/ui/frame_modes.d.ts +37 -0
  415. package/frontend/dist/frontend/src/ui/frame_modes.js +108 -0
  416. package/frontend/dist/frontend/src/ui/google_map.d.ts +24 -0
  417. package/frontend/dist/frontend/src/ui/google_map.js +106 -0
  418. package/frontend/dist/frontend/src/ui/gradient.d.ts +25 -0
  419. package/frontend/dist/frontend/src/ui/gradient.js +131 -0
  420. package/frontend/dist/frontend/src/ui/image.d.ts +111 -0
  421. package/frontend/dist/frontend/src/ui/image.js +576 -0
  422. package/frontend/dist/frontend/src/ui/input.d.ts +392 -0
  423. package/frontend/dist/frontend/src/ui/input.js +1201 -0
  424. package/frontend/dist/frontend/src/ui/link.d.ts +25 -0
  425. package/frontend/dist/frontend/src/ui/link.js +140 -0
  426. package/frontend/dist/frontend/src/ui/list.d.ts +37 -0
  427. package/frontend/dist/frontend/src/ui/list.js +170 -0
  428. package/frontend/dist/frontend/src/ui/loader_button.d.ts +80 -0
  429. package/frontend/dist/frontend/src/ui/loader_button.js +193 -0
  430. package/frontend/dist/frontend/src/ui/loaders.d.ts +57 -0
  431. package/frontend/dist/frontend/src/ui/loaders.js +157 -0
  432. package/frontend/dist/frontend/src/ui/popup.d.ts +94 -0
  433. package/frontend/dist/frontend/src/ui/popup.js +510 -0
  434. package/frontend/dist/frontend/src/ui/pseudo.d.ts +44 -0
  435. package/frontend/dist/frontend/src/ui/pseudo.js +154 -0
  436. package/frontend/dist/frontend/src/ui/scroller.d.ts +105 -0
  437. package/frontend/dist/frontend/src/ui/scroller.js +1253 -0
  438. package/frontend/dist/frontend/src/ui/slider.d.ts +45 -0
  439. package/frontend/dist/frontend/src/ui/slider.js +217 -0
  440. package/frontend/dist/frontend/src/ui/spacer.d.ts +15 -0
  441. package/frontend/dist/frontend/src/ui/spacer.js +78 -0
  442. package/frontend/dist/frontend/src/ui/span.d.ts +15 -0
  443. package/frontend/dist/frontend/src/ui/span.js +73 -0
  444. package/frontend/dist/frontend/src/ui/stack.d.ts +66 -0
  445. package/frontend/dist/frontend/src/ui/stack.js +335 -0
  446. package/frontend/dist/frontend/src/ui/steps.d.ts +131 -0
  447. package/frontend/dist/frontend/src/ui/steps.js +308 -0
  448. package/frontend/dist/frontend/src/ui/style.d.ts +17 -0
  449. package/frontend/dist/frontend/src/ui/style.js +73 -0
  450. package/frontend/dist/frontend/src/ui/switch.d.ts +69 -0
  451. package/frontend/dist/frontend/src/ui/switch.js +357 -0
  452. package/frontend/dist/frontend/src/ui/table.d.ts +100 -0
  453. package/frontend/dist/frontend/src/ui/table.js +405 -0
  454. package/frontend/dist/frontend/src/ui/tabs.d.ts +111 -0
  455. package/frontend/dist/frontend/src/ui/tabs.js +424 -0
  456. package/frontend/dist/frontend/src/ui/text.d.ts +15 -0
  457. package/frontend/dist/frontend/src/ui/text.js +83 -0
  458. package/frontend/dist/frontend/src/ui/title.d.ts +91 -0
  459. package/frontend/dist/frontend/src/ui/title.js +272 -0
  460. package/frontend/dist/frontend/src/ui/ui.d.ts +35 -0
  461. package/frontend/dist/frontend/src/ui/ui.js +38 -0
  462. package/frontend/dist/frontend/src/ui/view.d.ts +15 -0
  463. package/frontend/dist/frontend/src/ui/view.js +88 -0
  464. package/frontend/dist/frontend/src/volt.d.ts +20 -0
  465. package/frontend/dist/frontend/src/volt.js +27 -0
  466. package/frontend/examples/theme/theme.ts +58 -0
  467. package/frontend/tools/bundle_d_ts.js +71 -0
  468. package/frontend/tools/convert_to_jsdoc_input.txt +9452 -0
  469. package/frontend/tools/convert_to_jsdoc_output.txt +7626 -0
  470. package/frontend/tools/convert_to_jsdoc_tmp.js +345 -0
  471. package/frontend/tools/scan_mixed_imports.js +69 -0
  472. package/package.json +1 -5
@@ -0,0 +1,1201 @@
1
+ /**
2
+ * @author Daan van den Bergh
3
+ * @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
4
+ */
5
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
6
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
7
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
8
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
9
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
10
+ var _, done = false;
11
+ for (var i = decorators.length - 1; i >= 0; i--) {
12
+ var context = {};
13
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
14
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
15
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
16
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
17
+ if (kind === "accessor") {
18
+ if (result === void 0) continue;
19
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
20
+ if (_ = accept(result.get)) descriptor.get = _;
21
+ if (_ = accept(result.set)) descriptor.set = _;
22
+ if (_ = accept(result.init)) initializers.unshift(_);
23
+ }
24
+ else if (_ = accept(result)) {
25
+ if (kind === "field") initializers.unshift(_);
26
+ else descriptor[key] = _;
27
+ }
28
+ }
29
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
30
+ done = true;
31
+ };
32
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
33
+ var useValue = arguments.length > 2;
34
+ for (var i = 0; i < initializers.length; i++) {
35
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
36
+ }
37
+ return useValue ? value : void 0;
38
+ };
39
+ // External imports.
40
+ import * as vlib from "@vandenberghinc/vlib/frontend";
41
+ // Imports.
42
+ import { Elements, VElementTagMap } from "../elements/module.js";
43
+ import { Utils } from "../modules/utils.js";
44
+ import { HStack, VStack, VStackElement } from "./stack.js";
45
+ import { Text } from "./text.js";
46
+ import { ImageMask } from "./image.js";
47
+ import { GradientBorder } from "./gradient.js";
48
+ import { Scroller } from "./scroller.js";
49
+ import { Divider } from "./divider.js";
50
+ // Input.
51
+ let InputElement = (() => {
52
+ let _classDecorators = [Elements.create({
53
+ name: "InputElement",
54
+ default_style: {
55
+ "margin": "0px 0px 0px 0px",
56
+ "padding": "2.5px 5px 2.5px 5px",
57
+ "font": "inherit",
58
+ "color": "inherit",
59
+ "background": "none",
60
+ "outline": "none",
61
+ "border": "none",
62
+ "border-radius": "10px",
63
+ "text-align": "start",
64
+ "white-space": "nowrap",
65
+ },
66
+ default_attributes: {
67
+ "spellcheck": "false",
68
+ "autocorrect": "off",
69
+ "autocapitalize": "none",
70
+ },
71
+ })];
72
+ let _classDescriptor;
73
+ let _classExtraInitializers = [];
74
+ let _classThis;
75
+ let _classSuper = VElementTagMap.input;
76
+ var InputElement = class extends _classSuper {
77
+ static { _classThis = this; }
78
+ static {
79
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
80
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
81
+ InputElement = _classThis = _classDescriptor.value;
82
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
83
+ __runInitializers(_classThis, _classExtraInitializers);
84
+ }
85
+ // Attributes.
86
+ _e;
87
+ // Constructor.
88
+ constructor(placeholder, type = "text", value) {
89
+ // Initialize base class.
90
+ super({
91
+ derived: InputElement,
92
+ });
93
+ // Safari does not render images correctly for custom elements.
94
+ if (Utils.is_safari) {
95
+ this.attachShadow({ mode: 'open' });
96
+ this._e = document.createElement("input");
97
+ this._e.style.font = "inherit";
98
+ this._e.style.color = "inherit";
99
+ this._e.style.background = "none";
100
+ this._e.style.border = "none";
101
+ this._e.style.outline = "none";
102
+ this._e.style.whiteSpace = "nowrap";
103
+ this._e.style.width = "100%";
104
+ this._e.style.padding = InputElement.default_style.padding;
105
+ this.shadowRoot.appendChild(this._e);
106
+ this.padding("0");
107
+ }
108
+ // Set src.
109
+ this.placeholder(placeholder ?? "");
110
+ this.type(type ?? "text");
111
+ this.value(value ?? "");
112
+ }
113
+ value(val) {
114
+ if (this._e === undefined) {
115
+ return super.value(val);
116
+ }
117
+ if (val == null) {
118
+ return this._e.value ?? "";
119
+ }
120
+ this._e.value = val.toString();
121
+ // if (val == null) { return this._e.getAttribute("value") ?? ""; }
122
+ // this._e.setAttribute("value", val.toString());
123
+ return this;
124
+ }
125
+ required(val) { if (this._e === undefined) {
126
+ return super.required(val);
127
+ } if (val == null) {
128
+ return this._e.getAttribute("required") === "true";
129
+ } if (!val) {
130
+ this._e.removeAttribute("required");
131
+ }
132
+ else {
133
+ this._e.setAttribute("required", val);
134
+ } return this; }
135
+ type(val) { if (this._e === undefined) {
136
+ return super.type(val);
137
+ } if (val == null) {
138
+ return this._e.getAttribute("type") ?? "";
139
+ } this._e.setAttribute("type", val); return this; }
140
+ placeholder(val) { if (this._e === undefined) {
141
+ return super.placeholder(val);
142
+ } if (val == null) {
143
+ return this._e.getAttribute("placeholder") ?? "";
144
+ } this._e.setAttribute("placeholder", val); return this; }
145
+ resize(val) { if (this._e === undefined) {
146
+ return super.resize(val);
147
+ } if (val == null) {
148
+ return this._e.getAttribute("resize") ?? "";
149
+ } this._e.setAttribute("resize", val); return this; }
150
+ padding(...values) {
151
+ if (this._e === undefined) {
152
+ return super.padding(...values);
153
+ }
154
+ if (values.length === 0) {
155
+ return this._e.style.padding;
156
+ }
157
+ else if (values.length === 1) {
158
+ this._e.style.padding = this.pad_numeric(values[0]);
159
+ }
160
+ else if (values.length === 2) {
161
+ if (values[0] != null) {
162
+ this._e.style.paddingTop = this.pad_numeric(values[0]);
163
+ }
164
+ if (values[1] != null) {
165
+ this._e.style.paddingRight = this.pad_numeric(values[1]);
166
+ }
167
+ if (values[0] != null) {
168
+ this._e.style.paddingBottom = this.pad_numeric(values[0]);
169
+ }
170
+ if (values[1] != null) {
171
+ this._e.style.paddingLeft = this.pad_numeric(values[1]);
172
+ }
173
+ }
174
+ else if (values.length === 4) {
175
+ this._e.style.paddingTop = this.pad_numeric(values[0]);
176
+ if (values[1] != null) {
177
+ this._e.style.paddingRight = this.pad_numeric(values[1]);
178
+ }
179
+ if (values[2] != null) {
180
+ this._e.style.paddingBottom = this.pad_numeric(values[2]);
181
+ }
182
+ if (values[3] != null) {
183
+ this._e.style.paddingLeft = this.pad_numeric(values[3]);
184
+ }
185
+ }
186
+ else {
187
+ console.error("Invalid number of arguments for function \"padding()\".");
188
+ }
189
+ return this;
190
+ }
191
+ };
192
+ return InputElement = _classThis;
193
+ })();
194
+ export { InputElement };
195
+ export const Input = Elements.wrapper(InputElement);
196
+ export const NullInput = Elements.create_null(InputElement);
197
+ // InputBox.
198
+ let InputBoxElement = (() => {
199
+ let _classDecorators = [Elements.create({
200
+ name: "InputBoxElement",
201
+ default_style: {
202
+ "margin": "0px 0px 0px 0px",
203
+ "padding": "2.5px 5px 2.5px 5px",
204
+ "height": "20px",
205
+ "font": "inherit",
206
+ "color": "inherit",
207
+ "background": "none",
208
+ "outline": "none",
209
+ "border": "none",
210
+ "border-radius": "10px",
211
+ "text-align": "start",
212
+ "white-space": "wrap",
213
+ "resize": "none",
214
+ },
215
+ default_attributes: {
216
+ "spellcheck": "false",
217
+ "autocorrect": "off",
218
+ "autocapitalize": "none",
219
+ },
220
+ })];
221
+ let _classDescriptor;
222
+ let _classExtraInitializers = [];
223
+ let _classThis;
224
+ let _classSuper = VElementTagMap.textarea;
225
+ var InputBoxElement = class extends _classSuper {
226
+ static { _classThis = this; }
227
+ static {
228
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
229
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
230
+ InputBoxElement = _classThis = _classDescriptor.value;
231
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
232
+ __runInitializers(_classThis, _classExtraInitializers);
233
+ }
234
+ // Attributes.
235
+ _e;
236
+ // Constructor.
237
+ constructor(placeholder) {
238
+ // Initialize base class.
239
+ super({
240
+ derived: InputBoxElement,
241
+ });
242
+ // Safari does not render images correctly for custom elements.
243
+ if (Utils.is_safari) {
244
+ this.attachShadow({ mode: 'open' });
245
+ this._e = document.createElement("textarea");
246
+ this._e.style.font = "inherit";
247
+ this._e.style.color = "inherit";
248
+ this._e.style.background = "none";
249
+ this._e.style.border = "none";
250
+ this._e.style.outline = "none";
251
+ this._e.style.width = "100%";
252
+ this._e.style.height = "100%";
253
+ this._e.style.margin = "0";
254
+ this._e.style.padding = InputBoxElement.default_style.padding;
255
+ this.shadowRoot.appendChild(this._e);
256
+ this.padding("0");
257
+ }
258
+ // Set src.
259
+ this.placeholder(placeholder ?? "");
260
+ }
261
+ value(val) { if (this._e === undefined) {
262
+ return super.value(val);
263
+ } if (val == null) {
264
+ return this._e.getAttribute("value") ?? "";
265
+ } this._e.setAttribute("value", val.toString()); return this; }
266
+ required(val) { if (this._e === undefined) {
267
+ return super.required(val);
268
+ } if (val == null) {
269
+ return this._e.getAttribute("required") === "true";
270
+ } if (!val) {
271
+ this._e.removeAttribute("required");
272
+ }
273
+ else {
274
+ this._e.setAttribute("required", val);
275
+ } return this; }
276
+ type(val) { if (this._e === undefined) {
277
+ return super.type(val);
278
+ } if (val == null) {
279
+ return this._e.getAttribute("type") ?? "";
280
+ } this._e.setAttribute("type", val); return this; }
281
+ placeholder(val) { if (this._e === undefined) {
282
+ return super.placeholder(val);
283
+ } if (val == null) {
284
+ return this._e.getAttribute("placeholder") ?? "";
285
+ } this._e.setAttribute("placeholder", val); return this; }
286
+ resize(val) { if (this._e === undefined) {
287
+ return super.resize(val);
288
+ } if (val == null) {
289
+ return this._e.getAttribute("resize") ?? "";
290
+ } this._e.setAttribute("resize", val); return this; }
291
+ padding(...values) {
292
+ if (this._e === undefined) {
293
+ return super.padding(...values);
294
+ }
295
+ if (values.length === 0) {
296
+ return this._e.style.padding;
297
+ }
298
+ else if (values.length === 1) {
299
+ this._e.style.padding = this.pad_numeric(values[0]);
300
+ }
301
+ else if (values.length === 2) {
302
+ if (values[0] != null) {
303
+ this._e.style.paddingTop = this.pad_numeric(values[0]);
304
+ }
305
+ if (values[1] != null) {
306
+ this._e.style.paddingRight = this.pad_numeric(values[1]);
307
+ }
308
+ if (values[0] != null) {
309
+ this._e.style.paddingBottom = this.pad_numeric(values[0]);
310
+ }
311
+ if (values[1] != null) {
312
+ this._e.style.paddingLeft = this.pad_numeric(values[1]);
313
+ }
314
+ }
315
+ else if (values.length === 4) {
316
+ this._e.style.paddingTop = this.pad_numeric(values[0]);
317
+ if (values[1] != null) {
318
+ this._e.style.paddingRight = this.pad_numeric(values[1]);
319
+ }
320
+ if (values[2] != null) {
321
+ this._e.style.paddingBottom = this.pad_numeric(values[2]);
322
+ }
323
+ if (values[3] != null) {
324
+ this._e.style.paddingLeft = this.pad_numeric(values[3]);
325
+ }
326
+ }
327
+ else {
328
+ console.error("Invalid number of arguments for function \"padding()\".");
329
+ }
330
+ return this;
331
+ }
332
+ };
333
+ return InputBoxElement = _classThis;
334
+ })();
335
+ export { InputBoxElement };
336
+ export const InputBox = Elements.wrapper(InputBoxElement);
337
+ export const NullInputBox = Elements.create_null(InputBoxElement);
338
+ // Extended input.
339
+ let ExtendedInputElement = (() => {
340
+ let _classDecorators = [Elements.create({
341
+ name: "ExtendedInputElement",
342
+ default_style: {
343
+ ...VStackElement.default_style,
344
+ "color": "inherit",
345
+ "font-size": "16px",
346
+ },
347
+ })];
348
+ let _classDescriptor;
349
+ let _classExtraInitializers = [];
350
+ let _classThis;
351
+ let _classSuper = VStackElement;
352
+ var ExtendedInputElement = class extends _classSuper {
353
+ static { _classThis = this; }
354
+ static {
355
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
356
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
357
+ ExtendedInputElement = _classThis = _classDescriptor.value;
358
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
359
+ __runInitializers(_classThis, _classExtraInitializers);
360
+ }
361
+ copy_opts;
362
+ input_opts;
363
+ /** The label node, always defined even when `opts.label` is undefined, so the user can still style it. */
364
+ // @ts-expect-error
365
+ label;
366
+ /** The left image element created by the `opts.image` field. */
367
+ image;
368
+ /** The clickable copy node created by the `opts.copy` field. */
369
+ copyable;
370
+ /** The input element created by the `opts.input` field. */
371
+ input;
372
+ /** The (gradient) border element used for the input field. */
373
+ input_border;
374
+ /** The container element for the input field. */
375
+ container;
376
+ /** The error text element shown when the input is marked as missing. */
377
+ error_text;
378
+ /** Has error state. */
379
+ has_error = false;
380
+ /** Is focused state. */
381
+ is_focused = false;
382
+ /** Validation options. */
383
+ validation_entry;
384
+ // Constructor.
385
+ constructor({ label, image, placeholder = "Input", id, readonly = false, required = false, type = "text", value, copy, input, validate, }) {
386
+ // Initialize super.
387
+ super();
388
+ this._init({
389
+ derived: ExtendedInputElement,
390
+ });
391
+ // Cast image.
392
+ if (typeof image === "string") {
393
+ image = { url: image };
394
+ }
395
+ // Cast label.
396
+ if (typeof label === "string") {
397
+ label = { text: label };
398
+ }
399
+ // Direct attributes.
400
+ this.validation_entry = validate;
401
+ // Set id.
402
+ if (id != null) {
403
+ this.id(id);
404
+ }
405
+ // Set input options..
406
+ this.input_opts = {
407
+ ...(input ?? {}),
408
+ border: {
409
+ color: input?.border?.color ?? "gray",
410
+ hover: input?.border?.hover ?? "gray",
411
+ focused: input?.border?.focused ?? "#8EB8EB",
412
+ missing: input?.border?.missing ?? "#E8454E",
413
+ width: input?.border?.width ?? "1px",
414
+ radius: input?.border?.radius ?? "5px",
415
+ type: input?.border?.type ?? "full",
416
+ },
417
+ };
418
+ // Set copy options.
419
+ this.copy_opts = copy;
420
+ // Set default styling.
421
+ this.styles(ExtendedInputElement.default_style);
422
+ // Title element.
423
+ this.label = Text(label?.text)
424
+ .parent(this)
425
+ .font_size(label?.font_size ?? "inherit")
426
+ .margin(0, 0, label?.spacing ?? (input?.border?.type === "bottom" ? 12.5 : 7.5), 0)
427
+ .color(label?.color ?? "inherit");
428
+ if (!label) {
429
+ // always keep label present so uses can still style it with single-line code when needed.
430
+ this.label.hide();
431
+ }
432
+ else {
433
+ if (label.wrap) {
434
+ this.label
435
+ .width("fit-content")
436
+ .overflow_wrap("break-word") // or "anywhere" for more aggressive breaking
437
+ .hyphens("auto")
438
+ .display("inline-block") // so width constraints apply
439
+ .max_width(label.max_width ?? "100%"); // ensure there’s something to wrap to
440
+ }
441
+ else {
442
+ this.label.ellipsis_overflow(true)
443
+ .width("fit-content")
444
+ .max_width(label.max_width ?? "100%"); // ensure there’s something to wrap to
445
+ }
446
+ }
447
+ // Input left image.
448
+ this.image = !image ? undefined : ImageMask(image.url)
449
+ .parent(this)
450
+ .mask_color(image.color ?? "#000")
451
+ .square(image.size ?? 20)
452
+ .margin(0, 10, 0, 5)
453
+ .alt(image?.alt ?? "Volt");
454
+ // Copyable right image.
455
+ this.copyable = !this.copy_opts ? undefined : ImageMask(this.copy_opts.url)
456
+ .parent(this)
457
+ .mask_color(this.copy_opts?.color ?? image?.color ?? "#000")
458
+ .square(this.copy_opts.size ?? 20)
459
+ .margin(0, 5, 0, 10)
460
+ .alt(this.copy_opts?.alt ?? "Copy")
461
+ .on_click(() => {
462
+ if (this.copy_opts?.on_click) {
463
+ this.copy_opts.on_click(this.input.value());
464
+ }
465
+ })
466
+ .transition_mask("background 200ms ease-in-out")
467
+ .on_mouse_over_out(e => e.mask_color(this.copy_opts?.hover ?? image?.color ?? "#000"), e => e.mask_color(this.copy_opts?.color ?? image?.color ?? "#000"));
468
+ // Input element.
469
+ if (type === "box" || type === "area") {
470
+ this.input = InputBox(placeholder);
471
+ }
472
+ else {
473
+ this.input = Input(placeholder, type);
474
+ }
475
+ this.input
476
+ .parent(this)
477
+ .color("inherit")
478
+ .readonly(readonly)
479
+ .font_size("inherit")
480
+ .font_weight("normal")
481
+ .margin(0)
482
+ .width("100%")
483
+ .stretch(true)
484
+ // .padding(0, 5)
485
+ .padding(0)
486
+ .line_height("1.6em")
487
+ .box_shadow("none")
488
+ .border("none")
489
+ .outline("none")
490
+ .z_index(1)
491
+ .border_radius(0) // is required.
492
+ .on_focus(() => {
493
+ if (!this.has_error) {
494
+ this.is_focused = true;
495
+ this._set_border_color(this.input_opts.border.focused, true);
496
+ }
497
+ })
498
+ .on_blur(() => {
499
+ if (!this.has_error) {
500
+ this.is_focused = false;
501
+ this._set_border_color(this.input_opts.border.color);
502
+ }
503
+ });
504
+ // Set input height.
505
+ if (input?.height != null) {
506
+ console.log("Setting fixed height to", input.height);
507
+ this.input.fixed_height(input.height);
508
+ }
509
+ // The input border to support gradients.
510
+ this.input_border = GradientBorder()
511
+ .z_index(0)
512
+ .position(0, 0, 0, 0)
513
+ .border_width(this.input_opts.border.width)
514
+ .border_radius(this.input_opts.border.radius)
515
+ .border_color(this.input_opts.border.color)
516
+ .box_shadow(`0 0 0 0px transparent`)
517
+ .transition("background 200ms ease-in-out")
518
+ .pointer_events("none")
519
+ .parent(this);
520
+ if (this.input_opts.border.type === "bottom") {
521
+ this.input_border.hide();
522
+ }
523
+ // The hstack container.
524
+ this.container = HStack(!this.image ? undefined : VStack(this.image) // wrap in container for height.
525
+ .width("fit-content")
526
+ .height("1.6em")
527
+ .center_vertical(), this.input, !this.copyable ? undefined : VStack(this.copyable) // wrap in container for height.
528
+ .width("fit-content")
529
+ .height("1.6em")
530
+ .center_vertical(), this.input_border)
531
+ .parent(this)
532
+ .position("relative")
533
+ .background(input?.background ?? "transparent")
534
+ .padding((input?.padding ?? "12px 6px"))
535
+ .border_radius(this.input_opts.border.radius) // for outline when focused or missing etc.
536
+ .transition("box-shadow 0.2s ease-in-out")
537
+ .outline("0px solid transparent")
538
+ .box_shadow(`0 0 0 0px transparent`)
539
+ .width("100%")
540
+ .on_mouse_over_out((e) => {
541
+ if (!this.has_error && !this.is_focused) {
542
+ this._set_border_color(this.input_opts.border.hover);
543
+ }
544
+ }, (e) => {
545
+ if (!this.has_error && !this.is_focused) {
546
+ this._set_border_color(this.input_opts.border.color);
547
+ }
548
+ });
549
+ if (this.input_opts.border.type === "bottom") {
550
+ this._set_border_color(this.input_opts.border.color);
551
+ this.container.padding_left(0).padding_right(0);
552
+ }
553
+ // The error message.
554
+ this.error_text = Text("Incomplete field")
555
+ .color(this.input_opts.border.missing)
556
+ .font_size("0.8em")
557
+ .margin(7.5, 0, 0, 2.5)
558
+ .padding(0)
559
+ .leading()
560
+ .hide();
561
+ // Set id.
562
+ if (id != null) {
563
+ this.id(id);
564
+ }
565
+ // Set required.
566
+ this.required(required);
567
+ // Append.
568
+ this.append(this.label, this.container, this.error_text);
569
+ // Set value.
570
+ if (value) {
571
+ this.value(value);
572
+ }
573
+ }
574
+ /** Helper to set the border color. */
575
+ _set_border_color(color, set_outline = false) {
576
+ if (this.input_opts.border.type === "full") {
577
+ this.input_border.border_color(color);
578
+ if (set_outline) {
579
+ this.container.box_shadow(`0 0 0 3px ${color}80`);
580
+ }
581
+ else {
582
+ this.container.box_shadow(`0 0 0 0px transparent`);
583
+ }
584
+ }
585
+ else {
586
+ this.container.border_bottom(this.input_opts.border.width, color);
587
+ }
588
+ }
589
+ // Set the focus color.
590
+ focus_color(val) {
591
+ if (val == null) {
592
+ return (this.input_opts.border.focused ?? "");
593
+ }
594
+ this.input_opts.border.focused = val;
595
+ return this;
596
+ }
597
+ // Set default since it inherits an element.
598
+ set_default() {
599
+ return super.set_default(ExtendedInputElement);
600
+ }
601
+ /**
602
+ * Set the error state and message.
603
+ * Providing a truthy value will enable the error state and return the current instance for chaining.
604
+ * Providing a falsy value will disable the error state and return the current instance for chaining.
605
+ * Providing no value will return the current error message or `undefined` when no error is set.
606
+ */
607
+ error(err) {
608
+ if (err == null) {
609
+ return (this.has_error ? this.error_text.text() : undefined);
610
+ }
611
+ else if (err) {
612
+ this.has_error = true;
613
+ this._set_border_color(this.input_opts.border.missing, true);
614
+ // this.image.mask_color(this._border_opts.missing)
615
+ this.error_text.show();
616
+ this.error_text.text(err);
617
+ }
618
+ else {
619
+ this.has_error = false;
620
+ this._set_border_color(this.input_opts.border.color);
621
+ this.error_text.hide();
622
+ }
623
+ return this;
624
+ }
625
+ /** Remove the error state and mark as valid. */
626
+ valid() {
627
+ return this.error(false);
628
+ }
629
+ /** Submit the item, throws an error when the item is not defined. */
630
+ submit() {
631
+ // Get value.
632
+ const value = this.value();
633
+ if (value == null || value === "") {
634
+ this.error("Incomplete field");
635
+ throw Error("Fill in all the required fields.");
636
+ }
637
+ // Validate.
638
+ if (this.validation_entry) {
639
+ const res = vlib.Schema.validate_entry(value, this.validation_entry, { throw: false, field_type: "field" });
640
+ if (res.error) {
641
+ // use raw error for showing.
642
+ this.error(res.raw_error ?? "Invalid value");
643
+ // use full error for throwing.
644
+ throw Error(res.error);
645
+ }
646
+ }
647
+ // Success.
648
+ this.valid();
649
+ return value;
650
+ }
651
+ readonly(val) { if (val == null) {
652
+ return this.input.readonly();
653
+ } this.input.readonly(val); return this; }
654
+ text(val) { if (val == null) {
655
+ return this.label?.text() ?? "";
656
+ } this.label?.text(val); return this; }
657
+ value(val) {
658
+ if (val == null) {
659
+ return this.input.value();
660
+ }
661
+ this.input.value(val);
662
+ return this;
663
+ }
664
+ required(val) { if (val == null) {
665
+ return this.input.required();
666
+ } this.input.required(val); return this; }
667
+ on_enter(val) {
668
+ if (val == null) {
669
+ return this.input.on_enter();
670
+ }
671
+ this.input.on_enter((x, y) => val(this, y));
672
+ return this;
673
+ }
674
+ on_input(val) {
675
+ if (val == null) {
676
+ return this.input.on_input();
677
+ }
678
+ this.input.on_input((x, y) => val(this, y));
679
+ return this;
680
+ }
681
+ background(val) { if (val == null) {
682
+ return this.container.background();
683
+ } this.container.background(val); return this; }
684
+ padding(...values) {
685
+ if (values.length === 0 || (values.length === 1 && values[0] == null)) {
686
+ return this.container.padding();
687
+ }
688
+ this.container.padding(...values);
689
+ return this;
690
+ }
691
+ };
692
+ return ExtendedInputElement = _classThis;
693
+ })();
694
+ export { ExtendedInputElement };
695
+ export const ExtendedInput = Elements.wrapper(ExtendedInputElement);
696
+ export const NullExtendedInput = Elements.create_null(ExtendedInputElement);
697
+ // Extended input.
698
+ let ExtendedSelectElement = (() => {
699
+ let _classDecorators = [Elements.create({
700
+ name: "ExtendedSelectElement",
701
+ default_style: {
702
+ ...VStackElement.default_style,
703
+ "color": "inherit",
704
+ "font-size": "16px",
705
+ "background": "#FFFFFF",
706
+ }
707
+ })];
708
+ let _classDescriptor;
709
+ let _classExtraInitializers = [];
710
+ let _classThis;
711
+ let _classSuper = VStackElement;
712
+ var ExtendedSelectElement = class extends _classSuper {
713
+ static { _classThis = this; }
714
+ static {
715
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
716
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
717
+ ExtendedSelectElement = _classThis = _classDescriptor.value;
718
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
719
+ __runInitializers(_classThis, _classExtraInitializers);
720
+ }
721
+ /** The selectable items. */
722
+ items;
723
+ /** The label node. */
724
+ // @ts-expect-error
725
+ label;
726
+ /** The image node. */
727
+ image;
728
+ /** The input node (readonly) with the selected value. */
729
+ input;
730
+ /** The container node. */
731
+ container;
732
+ /** The error text node. */
733
+ error_text;
734
+ /** The dropdown scroller element. */
735
+ dropdown;
736
+ /** Has error state. */
737
+ has_error = false;
738
+ /** Is focused state. */
739
+ is_focused = false;
740
+ // Internal attributes.
741
+ input_opts;
742
+ image_opts;
743
+ _dropdown_item_hover;
744
+ _on_change_callback;
745
+ _on_dropdown_close;
746
+ _dropdown_height;
747
+ _value;
748
+ // Constructor.
749
+ constructor({ label = undefined, image = undefined, placeholder = "Placeholder", id = undefined, required = false, items = [{ id: "option", text: "Option", image: undefined }], // may also be an array with strings which will be used as the item's id and text.
750
+ dropdown, input, }) {
751
+ // Initialize super.
752
+ super();
753
+ this._init({
754
+ derived: ExtendedSelectElement,
755
+ });
756
+ // Cast image.
757
+ if (typeof image === "string") {
758
+ image = { url: image };
759
+ }
760
+ this.image_opts = image;
761
+ // Set input options..
762
+ this.input_opts = {
763
+ ...(input ?? {}),
764
+ border: {
765
+ color: input?.border?.color ?? "gray",
766
+ hover: input?.border?.hover ?? "gray",
767
+ focused: input?.border?.focused ?? "#8EB8EB",
768
+ missing: input?.border?.missing ?? "#E8454E",
769
+ width: input?.border?.width ?? "1px",
770
+ radius: input?.border?.radius ?? "5px",
771
+ type: input?.border?.type ?? "full",
772
+ },
773
+ };
774
+ // Arguments.
775
+ if (Array.isArray(items)) {
776
+ this.items = [];
777
+ for (const item of items) {
778
+ if (typeof item === "string") {
779
+ this.items.append({
780
+ id: item,
781
+ text: item,
782
+ });
783
+ }
784
+ else {
785
+ if (item.text == null) {
786
+ item.text = item.id;
787
+ }
788
+ this.items.append(item);
789
+ }
790
+ }
791
+ }
792
+ else if (typeof items === "object" && items != null) {
793
+ this.items = [];
794
+ for (const key of Object.keys(items)) {
795
+ if (typeof items[key] === "string") {
796
+ this.items.append({
797
+ id: key,
798
+ text: items[key],
799
+ });
800
+ }
801
+ else {
802
+ this.items.append({
803
+ ...items[key],
804
+ id: key,
805
+ });
806
+ }
807
+ }
808
+ }
809
+ else {
810
+ throw Error(`Parameter "items" should be a defined value of type "array" or "object".`);
811
+ }
812
+ // Attributes.
813
+ this._dropdown_item_hover = dropdown?.hover ?? "#00000007";
814
+ // Set default styling.
815
+ this.styles(ExtendedSelectElement.default_style);
816
+ // Title element.
817
+ this.label = Text(label)
818
+ .parent(this)
819
+ .font_size("inherit")
820
+ .margin(0, 0, 7.5, 0)
821
+ .color("inherit")
822
+ .width("fit-content")
823
+ .ellipsis_overflow(true);
824
+ if (label == null) {
825
+ this.label.hide();
826
+ }
827
+ // Title element.
828
+ this.image = !image ? undefined : ImageMask(image.url)
829
+ .parent(this)
830
+ .mask_color(image?.color ?? "#000")
831
+ .square(image?.size ?? 20)
832
+ .margin(0, 10, 0, 5)
833
+ .alt(image?.alt ?? "Volt");
834
+ // Input element.
835
+ this.input = Input(placeholder)
836
+ .parent(this)
837
+ .color("inherit")
838
+ .readonly(true)
839
+ .font_size("inherit")
840
+ .margin(0)
841
+ .width("100%")
842
+ .stretch(true)
843
+ .outline("none")
844
+ .padding(0, 5)
845
+ .line_height("1.6em")
846
+ .box_shadow("none")
847
+ .cursor("pointer")
848
+ .border_radius(0); // is required
849
+ // The hstack container.
850
+ this.container = HStack(!this.image ? undefined : VStack(this.image)
851
+ .width("fit-content")
852
+ .height("1.6em")
853
+ .center_vertical(), this.input)
854
+ .parent(this)
855
+ .background(input?.background ?? "transparent")
856
+ .padding((input?.padding ?? "12px 6px"))
857
+ .border_radius(this.input_opts.border.radius)
858
+ .border_width(this.input_opts.border.width)
859
+ .border_style("solid")
860
+ .transition("border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out")
861
+ .box_shadow(`0 0 0 0px transparent`)
862
+ .width("100%")
863
+ .on_mouse_over_out((e) => {
864
+ if (!this.has_error && !this.is_focused) {
865
+ this._set_border_color(this.input_opts.border.hover);
866
+ }
867
+ }, (e) => {
868
+ if (!this.has_error && !this.is_focused) {
869
+ this._set_border_color(this.input_opts.border.color);
870
+ }
871
+ })
872
+ .on_click(() => {
873
+ if (this.dropdown.is_hidden()) {
874
+ this.expand();
875
+ }
876
+ });
877
+ this._set_border_color(this.input_opts.border.color);
878
+ if (this.input_opts.border.type === "bottom") {
879
+ this.container.padding_left(0).padding_right(0);
880
+ }
881
+ // The error message.
882
+ this.error_text = Text("Incomplete field")
883
+ .color(this.input_opts.border.missing)
884
+ .font_size("0.8em")
885
+ .margin(7.5, 0, 0, 2.5)
886
+ .padding(0)
887
+ .leading()
888
+ .hide();
889
+ // The dropdown menu.
890
+ this.dropdown = Scroller()
891
+ .parent(this)
892
+ .position(0, null, null, null)
893
+ .background(ExtendedSelectElement.default_style["background"])
894
+ .border_radius(this.input_opts.border.radius)
895
+ .border_width(this.input_opts.border.width)
896
+ .border_style("solid")
897
+ .border_color(this.input_opts.border.color)
898
+ .box_shadow("0px 0px 5px #00000050")
899
+ .frame("100%", "100%")
900
+ .z_index(10)
901
+ .hide();
902
+ // Append.
903
+ this.append(this.label, this.container, this.error_text, this.dropdown);
904
+ // Styling.
905
+ this.position("relative");
906
+ this.overflow("visible");
907
+ super.background("none");
908
+ // Set id.
909
+ if (id != null) {
910
+ this.id(id);
911
+ }
912
+ // Set required.
913
+ if (required) {
914
+ this.required(required);
915
+ }
916
+ // On dropdown close event by mouse down.
917
+ this._on_dropdown_close = (event) => {
918
+ let parent = event.target.parentElement;
919
+ let stop = true;
920
+ for (let i = 0; i < 4; i++) {
921
+ if (parent == null) {
922
+ break;
923
+ }
924
+ else if (parent === this.dropdown) {
925
+ stop = false;
926
+ break;
927
+ }
928
+ parent = parent.parentElement;
929
+ }
930
+ if (stop) {
931
+ this.dropdown.hide();
932
+ window.removeEventListener("mousedown", this._on_dropdown_close);
933
+ // Unfocus.
934
+ if (!this.has_error) {
935
+ this.is_focused = false;
936
+ this._set_border_color(this.input_opts.border.color);
937
+ }
938
+ }
939
+ };
940
+ }
941
+ /** Helper to set the border color. */
942
+ _set_border_color(color, set_outline = false) {
943
+ if (this.input_opts.border.type === "full") {
944
+ this.container.border_color(color);
945
+ if (set_outline) {
946
+ this.container.box_shadow(`0 0 0 3px ${color}80`);
947
+ }
948
+ else {
949
+ this.container.box_shadow(`0 0 0 0px transparent`);
950
+ }
951
+ }
952
+ else {
953
+ this.container.border_bottom(this.input_opts.border.width, color);
954
+ }
955
+ }
956
+ focus_color(val) {
957
+ if (val == null) {
958
+ return this.input_opts.border.focused ?? "";
959
+ }
960
+ this.input_opts.border.focused = val;
961
+ return this;
962
+ }
963
+ error_color(val) {
964
+ if (val == null) {
965
+ return this.input_opts.border.missing ?? "";
966
+ }
967
+ this.input_opts.border.missing = val;
968
+ this.error_text.color(this.input_opts.border.missing);
969
+ return this;
970
+ }
971
+ dropdown_height(val) {
972
+ if (val === undefined) {
973
+ return this._dropdown_height;
974
+ }
975
+ this._dropdown_height = val;
976
+ return this;
977
+ }
978
+ /** Set default since it inherits an element. */
979
+ set_default() {
980
+ return super.set_default(ExtendedSelectElement);
981
+ }
982
+ /**
983
+ * Set the error state and message.
984
+ * Providing a truthy value will enable the error state and return the current instance for chaining.
985
+ * Providing a falsy value will disable the error state and return the current instance for chaining.
986
+ * Providing no value will return the current error message or `undefined` when no error is set.
987
+ */
988
+ error(err) {
989
+ if (err == null) {
990
+ return (this.has_error ? this.error_text.text() : undefined);
991
+ }
992
+ else if (err) {
993
+ this.has_error = true;
994
+ this._set_border_color(this.input_opts.border.missing, true);
995
+ this.image?.mask_color(this.input_opts.border.missing);
996
+ this.error_text.show();
997
+ if (err) {
998
+ this.error_text.text(err);
999
+ }
1000
+ }
1001
+ else {
1002
+ this.has_error = false;
1003
+ this._set_border_color(this.input_opts.border.color);
1004
+ this.image?.mask_color(this.image_opts?.color ?? "#000");
1005
+ this.error_text.hide();
1006
+ }
1007
+ return this;
1008
+ }
1009
+ /** Remove the error state and mark as valid. */
1010
+ valid() {
1011
+ return this.error(false);
1012
+ }
1013
+ /** Submit the item, throws an error when the item is not defined. */
1014
+ submit() {
1015
+ const value = this.value();
1016
+ if (value == null || value === "") {
1017
+ this.error("Incomplete field");
1018
+ throw Error("Fill in all the required fields.");
1019
+ }
1020
+ this.valid();
1021
+ return value;
1022
+ }
1023
+ /** Expand dropdown. */
1024
+ expand() {
1025
+ // Set focus.
1026
+ if (!this.has_error) {
1027
+ this.is_focused = true;
1028
+ this._set_border_color(this.input_opts.border.focused, true);
1029
+ }
1030
+ // Add event listener.
1031
+ window.addEventListener("mousedown", this._on_dropdown_close);
1032
+ // Clear.
1033
+ this.dropdown.remove_children();
1034
+ // Set top.
1035
+ // this.dropdown.top(this.label.clientHeight + this.container.clientHeight + (this.label.is_hidden() ? 0 : 5) + 5)
1036
+ this.dropdown.top(this.label.clientHeight + (this.label.is_hidden() ? 0 : 5));
1037
+ // Search bar.
1038
+ const search = Input("Search")
1039
+ .color("inherit")
1040
+ .font_size("inherit")
1041
+ .margin(10)
1042
+ .padding(0)
1043
+ .width("calc(100% - 20px)")
1044
+ .outline("none")
1045
+ .box_shadow("none")
1046
+ .border_radius(0)
1047
+ .on_input((e, event) => {
1048
+ const query = e.value();
1049
+ if (query.length === 0) {
1050
+ content.inner_html("");
1051
+ for (const item of this.items) {
1052
+ content.append(item.stack);
1053
+ }
1054
+ }
1055
+ else {
1056
+ const results = vlib.fuzzy.search({
1057
+ query,
1058
+ targets: this.items,
1059
+ limit: undefined,
1060
+ case_match: false,
1061
+ allow_exceeding_chars: true,
1062
+ key: ["id", "text"],
1063
+ });
1064
+ content.inner_html("");
1065
+ for (const item of results) {
1066
+ content.append(item.stack);
1067
+ }
1068
+ }
1069
+ });
1070
+ // The content.
1071
+ const content = VStack()
1072
+ .frame("100%")
1073
+ .padding(5, 0);
1074
+ // Add children.
1075
+ let i = 0;
1076
+ let min_height;
1077
+ // this.dropdown.items = [];
1078
+ for (const item of this.items) {
1079
+ // Image.
1080
+ let img;
1081
+ if (item.image != null) {
1082
+ img = ImageMask(item.image)
1083
+ .mask_color(this.image_opts?.color ?? "#000")
1084
+ .square(this.image_opts?.size ?? 20)
1085
+ .margin(0, 10, 0, 5)
1086
+ .alt(this.image_opts?.alt ?? "Volt")
1087
+ .pointer_events("none"); // so target element of mouse down is easier.
1088
+ }
1089
+ // Text.
1090
+ const text = Text(item.text)
1091
+ .color("inherit")
1092
+ .font_size("inherit")
1093
+ .white_space("pre")
1094
+ .margin(0)
1095
+ .width("100%")
1096
+ .stretch(true)
1097
+ .pointer_events("none"); // so target element of mouse down is easier.
1098
+ // Stack.
1099
+ const stack = HStack(img, text)
1100
+ .width("100%")
1101
+ .padding(5, 10)
1102
+ .background("transparent")
1103
+ .transition("background 0.2 ease-in-out")
1104
+ .on_click(() => {
1105
+ this.dropdown.hide();
1106
+ this._value = item.id;
1107
+ this.input.value(item.text ?? item.id);
1108
+ if (this._on_change_callback != null) {
1109
+ this._on_change_callback(this, item.id);
1110
+ }
1111
+ window.removeEventListener("mousedown", this._on_dropdown_close);
1112
+ })
1113
+ .on_mouse_over((e) => e.background(this._dropdown_item_hover))
1114
+ .on_mouse_out((e) => e.background("transparent"));
1115
+ // Update the item with the stack for searches.
1116
+ item.stack = stack;
1117
+ // Append.
1118
+ content.append(stack);
1119
+ // Increment.
1120
+ ++i;
1121
+ }
1122
+ // Show search bar or just show everything.
1123
+ if (this.items.length > 15) {
1124
+ this.dropdown.append(search, Divider()
1125
+ .margin(0)
1126
+ .background(this.input_opts.border.color), content);
1127
+ }
1128
+ else {
1129
+ this.dropdown.append(content);
1130
+ }
1131
+ // Show dropdown.
1132
+ this.dropdown.show();
1133
+ // Select
1134
+ if (this.items.length > 15) {
1135
+ search.select();
1136
+ }
1137
+ // Set min height.
1138
+ if (this._dropdown_height !== undefined) {
1139
+ this.dropdown.fixed_height(this._dropdown_height);
1140
+ }
1141
+ else if (this.items.length > 15) {
1142
+ this.dropdown.fixed_height((this.dropdown.content.child(0).clientHeight) * Math.min(this.items.length, 10) + 10);
1143
+ }
1144
+ else {
1145
+ this.dropdown.fixed_height((this.dropdown.content.child(0).child(0).clientHeight) * Math.min(this.items.length, 10) + 10);
1146
+ }
1147
+ // this.dropdown.min_height((this.dropdown.content.child(0).clientHeight + 10) * Math.min(this.items.length, 10) + 10) // old.
1148
+ // Response.
1149
+ return this;
1150
+ }
1151
+ value(val) {
1152
+ if (val == null) {
1153
+ return this._value ?? "";
1154
+ }
1155
+ for (const item of this.items) {
1156
+ if (item.id === val) {
1157
+ this._value = val;
1158
+ this.input.value(item.text ?? item.id);
1159
+ if (this._on_change_callback != null) {
1160
+ this._on_change_callback(this, val);
1161
+ }
1162
+ }
1163
+ }
1164
+ return this;
1165
+ }
1166
+ background(val) {
1167
+ if (val == null) {
1168
+ return this.background();
1169
+ }
1170
+ this.container.background(val);
1171
+ this.dropdown.background(val);
1172
+ return this;
1173
+ }
1174
+ padding(...values) {
1175
+ if (values.length === 0 || (values.length === 1 && values[0] == null)) {
1176
+ return this.container.padding();
1177
+ }
1178
+ this.container.padding(...values);
1179
+ this.dropdown.padding(...values);
1180
+ return this;
1181
+ }
1182
+ // @ts-expect-error
1183
+ on_change(callback) {
1184
+ if (callback == null) {
1185
+ return this._on_change_callback;
1186
+ }
1187
+ this._on_change_callback = callback;
1188
+ return this;
1189
+ }
1190
+ text(val) { if (val == null) {
1191
+ return this.label.text();
1192
+ } this.label.text(val); return this; }
1193
+ required(val) { if (val == null) {
1194
+ return this.input.required();
1195
+ } this.input.required(val); return this; }
1196
+ };
1197
+ return ExtendedSelectElement = _classThis;
1198
+ })();
1199
+ export { ExtendedSelectElement };
1200
+ export const ExtendedSelect = Elements.wrapper(ExtendedSelectElement);
1201
+ export const NullExtendedSelect = Elements.create_null(ExtendedSelectElement);