@vandenberghinc/volt 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/.vrepo +28 -0
  2. package/.vscode/tasks.json +87 -0
  3. package/README.md +67 -0
  4. package/backend/dist/cjs/blacklist.d.ts +10 -0
  5. package/backend/dist/cjs/blacklist.js +53 -0
  6. package/backend/dist/cjs/cli.d.ts +2 -0
  7. package/backend/dist/cjs/cli.js +263 -0
  8. package/backend/dist/cjs/database.d.ts +364 -0
  9. package/backend/dist/cjs/database.js +1962 -0
  10. package/backend/dist/cjs/endpoint.d.ts +57 -0
  11. package/backend/dist/cjs/endpoint.js +425 -0
  12. package/backend/dist/cjs/file_watcher.d.ts +44 -0
  13. package/backend/dist/cjs/file_watcher.js +348 -0
  14. package/backend/dist/cjs/frontend.d.ts +13 -0
  15. package/backend/dist/cjs/frontend.js +30 -0
  16. package/backend/dist/cjs/image_endpoint.d.ts +24 -0
  17. package/backend/dist/cjs/image_endpoint.js +210 -0
  18. package/backend/dist/cjs/logger.d.ts +5 -0
  19. package/backend/dist/cjs/logger.js +16 -0
  20. package/backend/dist/cjs/meta.d.ts +50 -0
  21. package/backend/dist/cjs/meta.js +153 -0
  22. package/backend/dist/cjs/mutex.d.ts +24 -0
  23. package/backend/dist/cjs/mutex.js +52 -0
  24. package/backend/dist/cjs/package.json +1 -0
  25. package/backend/dist/cjs/payments/paddle.d.ts +161 -0
  26. package/backend/dist/cjs/payments/paddle.js +2301 -0
  27. package/backend/dist/cjs/plugins/browser.d.ts +36 -0
  28. package/backend/dist/cjs/plugins/browser.js +183 -0
  29. package/backend/dist/cjs/plugins/communication.d.ts +70 -0
  30. package/backend/dist/cjs/plugins/communication.js +177 -0
  31. package/backend/dist/cjs/plugins/css.d.ts +10 -0
  32. package/backend/dist/cjs/plugins/css.js +71 -0
  33. package/backend/dist/cjs/plugins/mail.d.ts +277 -0
  34. package/backend/dist/cjs/plugins/mail.js +1419 -0
  35. package/backend/dist/cjs/plugins/pdf.d.ts +757 -0
  36. package/backend/dist/cjs/plugins/pdf.js +1694 -0
  37. package/backend/dist/cjs/plugins/thread_monitor.d.ts +18 -0
  38. package/backend/dist/cjs/plugins/thread_monitor.js +127 -0
  39. package/backend/dist/cjs/plugins/ts/compiler.d.ts +132 -0
  40. package/backend/dist/cjs/plugins/ts/compiler.js +944 -0
  41. package/backend/dist/cjs/plugins/ts/preprocessing.d.ts +14 -0
  42. package/backend/dist/cjs/plugins/ts/preprocessing.js +762 -0
  43. package/backend/dist/cjs/rate_limit.d.ts +65 -0
  44. package/backend/dist/cjs/rate_limit.js +463 -0
  45. package/backend/dist/cjs/request.deprc.d.ts +48 -0
  46. package/backend/dist/cjs/request.deprc.js +572 -0
  47. package/backend/dist/cjs/response.deprc.d.ts +55 -0
  48. package/backend/dist/cjs/response.deprc.js +275 -0
  49. package/backend/dist/cjs/server.d.ts +311 -0
  50. package/backend/dist/cjs/server.js +3475 -0
  51. package/backend/dist/cjs/splash_screen.d.ts +35 -0
  52. package/backend/dist/cjs/splash_screen.js +152 -0
  53. package/backend/dist/cjs/status.d.ts +60 -0
  54. package/backend/dist/cjs/status.js +199 -0
  55. package/backend/dist/cjs/stream.d.ts +75 -0
  56. package/backend/dist/cjs/stream.js +954 -0
  57. package/backend/dist/cjs/users.d.ts +111 -0
  58. package/backend/dist/cjs/users.js +1945 -0
  59. package/backend/dist/cjs/utils.d.ts +27 -0
  60. package/backend/dist/cjs/utils.js +329 -0
  61. package/backend/dist/cjs/view.d.ts +52 -0
  62. package/backend/dist/cjs/view.js +568 -0
  63. package/backend/dist/cjs/vinc.d.ts +2 -0
  64. package/backend/dist/cjs/vinc.dev.d.ts +2 -0
  65. package/backend/dist/cjs/vinc.dev.js +42 -0
  66. package/backend/dist/cjs/vinc.js +42 -0
  67. package/backend/dist/cjs/volt.d.ts +15 -0
  68. package/backend/dist/cjs/volt.js +64 -0
  69. package/backend/dist/css/adyen.css +92 -0
  70. package/backend/dist/css/volt.css +65 -0
  71. package/backend/dist/esm/blacklist.d.ts +10 -0
  72. package/backend/dist/esm/blacklist.js +49 -0
  73. package/backend/dist/esm/cli.d.ts +2 -0
  74. package/backend/dist/esm/cli.js +228 -0
  75. package/backend/dist/esm/database.d.ts +364 -0
  76. package/backend/dist/esm/database.js +1957 -0
  77. package/backend/dist/esm/endpoint.d.ts +57 -0
  78. package/backend/dist/esm/endpoint.js +421 -0
  79. package/backend/dist/esm/file_watcher.d.ts +44 -0
  80. package/backend/dist/esm/file_watcher.js +313 -0
  81. package/backend/dist/esm/frontend.d.ts +13 -0
  82. package/backend/dist/esm/frontend.js +27 -0
  83. package/backend/dist/esm/image_endpoint.d.ts +24 -0
  84. package/backend/dist/esm/image_endpoint.js +206 -0
  85. package/backend/dist/esm/logger.d.ts +5 -0
  86. package/backend/dist/esm/logger.js +13 -0
  87. package/backend/dist/esm/meta.d.ts +50 -0
  88. package/backend/dist/esm/meta.js +149 -0
  89. package/backend/dist/esm/mutex.d.ts +24 -0
  90. package/backend/dist/esm/mutex.js +48 -0
  91. package/backend/dist/esm/payments/paddle.d.ts +161 -0
  92. package/backend/dist/esm/payments/paddle.js +2261 -0
  93. package/backend/dist/esm/plugins/browser.d.ts +36 -0
  94. package/backend/dist/esm/plugins/browser.js +176 -0
  95. package/backend/dist/esm/plugins/communication.d.ts +70 -0
  96. package/backend/dist/esm/plugins/communication.js +169 -0
  97. package/backend/dist/esm/plugins/css.d.ts +10 -0
  98. package/backend/dist/esm/plugins/css.js +64 -0
  99. package/backend/dist/esm/plugins/mail.d.ts +277 -0
  100. package/backend/dist/esm/plugins/mail.js +1403 -0
  101. package/backend/dist/esm/plugins/pdf.d.ts +757 -0
  102. package/backend/dist/esm/plugins/pdf.js +1694 -0
  103. package/backend/dist/esm/plugins/thread_monitor.d.ts +18 -0
  104. package/backend/dist/esm/plugins/thread_monitor.js +120 -0
  105. package/backend/dist/esm/plugins/ts/compiler.d.ts +132 -0
  106. package/backend/dist/esm/plugins/ts/compiler.js +907 -0
  107. package/backend/dist/esm/plugins/ts/preprocessing.d.ts +14 -0
  108. package/backend/dist/esm/plugins/ts/preprocessing.js +724 -0
  109. package/backend/dist/esm/rate_limit.d.ts +65 -0
  110. package/backend/dist/esm/rate_limit.js +425 -0
  111. package/backend/dist/esm/request.deprc.d.ts +48 -0
  112. package/backend/dist/esm/request.deprc.js +572 -0
  113. package/backend/dist/esm/response.deprc.d.ts +55 -0
  114. package/backend/dist/esm/response.deprc.js +275 -0
  115. package/backend/dist/esm/server.d.ts +311 -0
  116. package/backend/dist/esm/server.js +3435 -0
  117. package/backend/dist/esm/splash_screen.d.ts +35 -0
  118. package/backend/dist/esm/splash_screen.js +148 -0
  119. package/backend/dist/esm/status.d.ts +60 -0
  120. package/backend/dist/esm/status.js +196 -0
  121. package/backend/dist/esm/stream.d.ts +75 -0
  122. package/backend/dist/esm/stream.js +947 -0
  123. package/backend/dist/esm/users.d.ts +111 -0
  124. package/backend/dist/esm/users.js +1908 -0
  125. package/backend/dist/esm/utils.d.ts +27 -0
  126. package/backend/dist/esm/utils.js +324 -0
  127. package/backend/dist/esm/view.d.ts +52 -0
  128. package/backend/dist/esm/view.js +561 -0
  129. package/backend/dist/esm/vinc.d.ts +2 -0
  130. package/backend/dist/esm/vinc.dev.d.ts +2 -0
  131. package/backend/dist/esm/vinc.dev.js +6 -0
  132. package/backend/dist/esm/vinc.js +6 -0
  133. package/backend/dist/esm/volt.d.ts +15 -0
  134. package/backend/dist/esm/volt.js +23 -0
  135. package/backend/dist/esm-dev/blacklist.d.ts +10 -0
  136. package/backend/dist/esm-dev/blacklist.js +49 -0
  137. package/backend/dist/esm-dev/cli.d.ts +2 -0
  138. package/backend/dist/esm-dev/cli.js +228 -0
  139. package/backend/dist/esm-dev/database.d.ts +364 -0
  140. package/backend/dist/esm-dev/database.js +1957 -0
  141. package/backend/dist/esm-dev/endpoint.d.ts +57 -0
  142. package/backend/dist/esm-dev/endpoint.js +421 -0
  143. package/backend/dist/esm-dev/file_watcher.d.ts +44 -0
  144. package/backend/dist/esm-dev/file_watcher.js +313 -0
  145. package/backend/dist/esm-dev/frontend.d.ts +13 -0
  146. package/backend/dist/esm-dev/frontend.js +27 -0
  147. package/backend/dist/esm-dev/image_endpoint.d.ts +24 -0
  148. package/backend/dist/esm-dev/image_endpoint.js +206 -0
  149. package/backend/dist/esm-dev/logger.d.ts +5 -0
  150. package/backend/dist/esm-dev/logger.js +13 -0
  151. package/backend/dist/esm-dev/meta.d.ts +50 -0
  152. package/backend/dist/esm-dev/meta.js +149 -0
  153. package/backend/dist/esm-dev/mutex.d.ts +24 -0
  154. package/backend/dist/esm-dev/mutex.js +48 -0
  155. package/backend/dist/esm-dev/payments/paddle.d.ts +161 -0
  156. package/backend/dist/esm-dev/payments/paddle.js +2261 -0
  157. package/backend/dist/esm-dev/plugins/browser.d.ts +36 -0
  158. package/backend/dist/esm-dev/plugins/browser.js +176 -0
  159. package/backend/dist/esm-dev/plugins/communication.d.ts +70 -0
  160. package/backend/dist/esm-dev/plugins/communication.js +169 -0
  161. package/backend/dist/esm-dev/plugins/css.d.ts +10 -0
  162. package/backend/dist/esm-dev/plugins/css.js +64 -0
  163. package/backend/dist/esm-dev/plugins/mail.d.ts +277 -0
  164. package/backend/dist/esm-dev/plugins/mail.js +1403 -0
  165. package/backend/dist/esm-dev/plugins/pdf.d.ts +757 -0
  166. package/backend/dist/esm-dev/plugins/pdf.js +1694 -0
  167. package/backend/dist/esm-dev/plugins/thread_monitor.d.ts +18 -0
  168. package/backend/dist/esm-dev/plugins/thread_monitor.js +120 -0
  169. package/backend/dist/esm-dev/plugins/ts/compiler.d.ts +132 -0
  170. package/backend/dist/esm-dev/plugins/ts/compiler.js +907 -0
  171. package/backend/dist/esm-dev/plugins/ts/preprocessing.d.ts +14 -0
  172. package/backend/dist/esm-dev/plugins/ts/preprocessing.js +724 -0
  173. package/backend/dist/esm-dev/rate_limit.d.ts +65 -0
  174. package/backend/dist/esm-dev/rate_limit.js +425 -0
  175. package/backend/dist/esm-dev/request.deprc.d.ts +48 -0
  176. package/backend/dist/esm-dev/request.deprc.js +572 -0
  177. package/backend/dist/esm-dev/response.deprc.d.ts +55 -0
  178. package/backend/dist/esm-dev/response.deprc.js +275 -0
  179. package/backend/dist/esm-dev/server.d.ts +311 -0
  180. package/backend/dist/esm-dev/server.js +3435 -0
  181. package/backend/dist/esm-dev/splash_screen.d.ts +35 -0
  182. package/backend/dist/esm-dev/splash_screen.js +148 -0
  183. package/backend/dist/esm-dev/status.d.ts +60 -0
  184. package/backend/dist/esm-dev/status.js +196 -0
  185. package/backend/dist/esm-dev/stream.d.ts +75 -0
  186. package/backend/dist/esm-dev/stream.js +947 -0
  187. package/backend/dist/esm-dev/users.d.ts +111 -0
  188. package/backend/dist/esm-dev/users.js +1908 -0
  189. package/backend/dist/esm-dev/utils.d.ts +27 -0
  190. package/backend/dist/esm-dev/utils.js +324 -0
  191. package/backend/dist/esm-dev/view.d.ts +52 -0
  192. package/backend/dist/esm-dev/view.js +561 -0
  193. package/backend/dist/esm-dev/vinc.d.ts +2 -0
  194. package/backend/dist/esm-dev/vinc.dev.d.ts +2 -0
  195. package/backend/dist/esm-dev/vinc.dev.js +6 -0
  196. package/backend/dist/esm-dev/vinc.js +6 -0
  197. package/backend/dist/esm-dev/volt.d.ts +15 -0
  198. package/backend/dist/esm-dev/volt.js +23 -0
  199. package/backend/src/blacklist.ts +69 -0
  200. package/backend/src/cli.js +245 -0
  201. package/backend/src/database.ts +2241 -0
  202. package/backend/src/endpoint.ts +494 -0
  203. package/backend/src/file_watcher.ts +359 -0
  204. package/backend/src/frontend.ts +35 -0
  205. package/backend/src/globals.d.ts +8 -0
  206. package/backend/src/image_endpoint.ts +258 -0
  207. package/backend/src/logger.ts +18 -0
  208. package/backend/src/meta.ts +202 -0
  209. package/backend/src/mutex.ts +51 -0
  210. package/backend/src/payments/paddle.ts +2659 -0
  211. package/backend/src/plugins/browser.ts +188 -0
  212. package/backend/src/plugins/communication.ts +204 -0
  213. package/backend/src/plugins/css.ts +84 -0
  214. package/backend/src/plugins/fonts/Menlo-Bold.ttf +0 -0
  215. package/backend/src/plugins/fonts/Menlo-Regular.ttf +0 -0
  216. package/backend/src/plugins/mail.ts +1720 -0
  217. package/backend/src/plugins/pdf.js +1932 -0
  218. package/backend/src/plugins/thread_monitor.ts +164 -0
  219. package/backend/src/plugins/ts/compiler.ts +1242 -0
  220. package/backend/src/plugins/ts/preprocessing.ts +812 -0
  221. package/backend/src/rate_limit.ts +503 -0
  222. package/backend/src/request.deprc.js +626 -0
  223. package/backend/src/response.deprc.js +354 -0
  224. package/backend/src/server.ts +4149 -0
  225. package/backend/src/splash_screen.ts +192 -0
  226. package/backend/src/status.ts +199 -0
  227. package/backend/src/stream.ts +1070 -0
  228. package/backend/src/users.ts +2077 -0
  229. package/backend/src/utils.ts +359 -0
  230. package/backend/src/view.ts +655 -0
  231. package/backend/src/vinc.dev.js +6 -0
  232. package/backend/src/vinc.ts +6 -0
  233. package/backend/src/volt.js +25 -0
  234. package/backend/tsconfig.cjs.json +29 -0
  235. package/backend/tsconfig.esm.dev.json +34 -0
  236. package/backend/tsconfig.esm.json +30 -0
  237. package/backend/tsconfig.json +2 -0
  238. package/frontend/compile.js +436 -0
  239. package/frontend/dist/elements/base.d.ts +9891 -0
  240. package/frontend/dist/elements/base.js +8818 -0
  241. package/frontend/dist/elements/module.d.ts +16 -0
  242. package/frontend/dist/elements/module.js +178 -0
  243. package/frontend/dist/modules/array.d.ts +37 -0
  244. package/frontend/dist/modules/array.js +284 -0
  245. package/frontend/dist/modules/auth.d.ts +45 -0
  246. package/frontend/dist/modules/auth.js +138 -0
  247. package/frontend/dist/modules/colors.d.ts +26 -0
  248. package/frontend/dist/modules/colors.js +340 -0
  249. package/frontend/dist/modules/compression.d.ts +6 -0
  250. package/frontend/dist/modules/compression.js +999 -0
  251. package/frontend/dist/modules/cookies.d.ts +17 -0
  252. package/frontend/dist/modules/cookies.js +166 -0
  253. package/frontend/dist/modules/date.d.ts +142 -0
  254. package/frontend/dist/modules/date.js +493 -0
  255. package/frontend/dist/modules/events.d.ts +7 -0
  256. package/frontend/dist/modules/events.js +90 -0
  257. package/frontend/dist/modules/google.d.ts +10 -0
  258. package/frontend/dist/modules/google.js +53 -0
  259. package/frontend/dist/modules/meta.d.ts +9 -0
  260. package/frontend/dist/modules/meta.js +45 -0
  261. package/frontend/dist/modules/mutex.d.ts +8 -0
  262. package/frontend/dist/modules/mutex.js +52 -0
  263. package/frontend/dist/modules/number.d.ts +12 -0
  264. package/frontend/dist/modules/number.js +8 -0
  265. package/frontend/dist/modules/object.d.ts +50 -0
  266. package/frontend/dist/modules/object.js +147 -0
  267. package/frontend/dist/modules/paddle.d.ts +1403 -0
  268. package/frontend/dist/modules/paddle.js +2641 -0
  269. package/frontend/dist/modules/scheme.d.ts +207 -0
  270. package/frontend/dist/modules/scheme.js +649 -0
  271. package/frontend/dist/modules/settings.d.ts +3 -0
  272. package/frontend/dist/modules/settings.js +4 -0
  273. package/frontend/dist/modules/statics.d.ts +4 -0
  274. package/frontend/dist/modules/statics.js +45 -0
  275. package/frontend/dist/modules/string.d.ts +163 -0
  276. package/frontend/dist/modules/string.js +291 -0
  277. package/frontend/dist/modules/support.d.ts +18 -0
  278. package/frontend/dist/modules/support.js +102 -0
  279. package/frontend/dist/modules/themes.d.ts +8 -0
  280. package/frontend/dist/modules/themes.js +17 -0
  281. package/frontend/dist/modules/user.d.ts +58 -0
  282. package/frontend/dist/modules/user.js +279 -0
  283. package/frontend/dist/modules/utils.d.ts +58 -0
  284. package/frontend/dist/modules/utils.js +1159 -0
  285. package/frontend/dist/types/gradient.d.ts +12 -0
  286. package/frontend/dist/types/gradient.js +79 -0
  287. package/frontend/dist/ui/border_button.d.ts +177 -0
  288. package/frontend/dist/ui/border_button.js +235 -0
  289. package/frontend/dist/ui/button.d.ts +42 -0
  290. package/frontend/dist/ui/button.js +114 -0
  291. package/frontend/dist/ui/canvas.d.ts +56 -0
  292. package/frontend/dist/ui/canvas.js +411 -0
  293. package/frontend/dist/ui/checkbox.d.ts +72 -0
  294. package/frontend/dist/ui/checkbox.js +277 -0
  295. package/frontend/dist/ui/code.d.ts +232 -0
  296. package/frontend/dist/ui/code.js +977 -0
  297. package/frontend/dist/ui/color.d.ts +1 -0
  298. package/frontend/dist/ui/color.js +110 -0
  299. package/frontend/dist/ui/context_menu.d.ts +30 -0
  300. package/frontend/dist/ui/context_menu.js +211 -0
  301. package/frontend/dist/ui/css.d.ts +10 -0
  302. package/frontend/dist/ui/css.js +44 -0
  303. package/frontend/dist/ui/divider.d.ts +18 -0
  304. package/frontend/dist/ui/divider.js +82 -0
  305. package/frontend/dist/ui/dropdown.d.ts +115 -0
  306. package/frontend/dist/ui/dropdown.js +446 -0
  307. package/frontend/dist/ui/for_each.d.ts +38 -0
  308. package/frontend/dist/ui/for_each.js +97 -0
  309. package/frontend/dist/ui/form.d.ts +25 -0
  310. package/frontend/dist/ui/form.js +227 -0
  311. package/frontend/dist/ui/frame_modes.d.ts +28 -0
  312. package/frontend/dist/ui/frame_modes.js +116 -0
  313. package/frontend/dist/ui/google_map.d.ts +31 -0
  314. package/frontend/dist/ui/google_map.js +111 -0
  315. package/frontend/dist/ui/gradient.d.ts +24 -0
  316. package/frontend/dist/ui/gradient.js +115 -0
  317. package/frontend/dist/ui/image.d.ts +138 -0
  318. package/frontend/dist/ui/image.js +570 -0
  319. package/frontend/dist/ui/input.d.ts +316 -0
  320. package/frontend/dist/ui/input.js +1187 -0
  321. package/frontend/dist/ui/link.d.ts +39 -0
  322. package/frontend/dist/ui/link.js +146 -0
  323. package/frontend/dist/ui/list.d.ts +33 -0
  324. package/frontend/dist/ui/list.js +161 -0
  325. package/frontend/dist/ui/loader_button.d.ts +108 -0
  326. package/frontend/dist/ui/loader_button.js +207 -0
  327. package/frontend/dist/ui/loaders.d.ts +60 -0
  328. package/frontend/dist/ui/loaders.js +150 -0
  329. package/frontend/dist/ui/popup.d.ts +84 -0
  330. package/frontend/dist/ui/popup.js +331 -0
  331. package/frontend/dist/ui/pseudo.d.ts +16 -0
  332. package/frontend/dist/ui/pseudo.js +81 -0
  333. package/frontend/dist/ui/scroller.d.ts +131 -0
  334. package/frontend/dist/ui/scroller.js +1251 -0
  335. package/frontend/dist/ui/slider.d.ts +35 -0
  336. package/frontend/dist/ui/slider.js +203 -0
  337. package/frontend/dist/ui/spacer.d.ts +20 -0
  338. package/frontend/dist/ui/spacer.js +83 -0
  339. package/frontend/dist/ui/span.d.ts +11 -0
  340. package/frontend/dist/ui/span.js +75 -0
  341. package/frontend/dist/ui/stack.d.ts +123 -0
  342. package/frontend/dist/ui/stack.js +344 -0
  343. package/frontend/dist/ui/steps.d.ts +72 -0
  344. package/frontend/dist/ui/steps.js +306 -0
  345. package/frontend/dist/ui/style.d.ts +12 -0
  346. package/frontend/dist/ui/style.js +78 -0
  347. package/frontend/dist/ui/switch.d.ts +44 -0
  348. package/frontend/dist/ui/switch.js +280 -0
  349. package/frontend/dist/ui/table.d.ts +118 -0
  350. package/frontend/dist/ui/table.js +411 -0
  351. package/frontend/dist/ui/tabs.d.ts +85 -0
  352. package/frontend/dist/ui/tabs.js +392 -0
  353. package/frontend/dist/ui/text.d.ts +19 -0
  354. package/frontend/dist/ui/text.js +88 -0
  355. package/frontend/dist/ui/theme.d.ts +25 -0
  356. package/frontend/dist/ui/theme.js +237 -0
  357. package/frontend/dist/ui/title.d.ts +36 -0
  358. package/frontend/dist/ui/title.js +127 -0
  359. package/frontend/dist/ui/ui.d.ts +38 -0
  360. package/frontend/dist/ui/ui.js +41 -0
  361. package/frontend/dist/ui/view.d.ts +25 -0
  362. package/frontend/dist/ui/view.js +93 -0
  363. package/frontend/dist/volt.d.ts +22 -0
  364. package/frontend/dist/volt.js +27 -0
  365. package/frontend/exports.json +1340 -0
  366. package/frontend/src/css/adyen.css +92 -0
  367. package/frontend/src/css/volt.css +65 -0
  368. package/frontend/src/elements/base.ts +16790 -0
  369. package/frontend/src/elements/module.ts +184 -0
  370. package/frontend/src/elements/types.d.ts +155 -0
  371. package/frontend/src/modules/array.ts +366 -0
  372. package/frontend/src/modules/auth.ts +188 -0
  373. package/frontend/src/modules/colors.ts +449 -0
  374. package/frontend/src/modules/compression.ts +67 -0
  375. package/frontend/src/modules/cookies.ts +182 -0
  376. package/frontend/src/modules/date.js +535 -0
  377. package/frontend/src/modules/date.ts +583 -0
  378. package/frontend/src/modules/events.ts +96 -0
  379. package/frontend/src/modules/google.ts +60 -0
  380. package/frontend/src/modules/meta.ts +59 -0
  381. package/frontend/src/modules/mutex.ts +59 -0
  382. package/frontend/src/modules/number.ts +20 -0
  383. package/frontend/src/modules/object.ts +212 -0
  384. package/frontend/src/modules/paddle.ts +2990 -0
  385. package/frontend/src/modules/scheme.ts +740 -0
  386. package/frontend/src/modules/settings.ts +5 -0
  387. package/frontend/src/modules/statics.ts +47 -0
  388. package/frontend/src/modules/string.ts +500 -0
  389. package/frontend/src/modules/support.ts +118 -0
  390. package/frontend/src/modules/themes.ts +24 -0
  391. package/frontend/src/modules/user.ts +321 -0
  392. package/frontend/src/modules/utils.ts +1260 -0
  393. package/frontend/src/static/admin/admin.png +0 -0
  394. package/frontend/src/static/admin/password.webp +0 -0
  395. package/frontend/src/static/icons/copy.webp +0 -0
  396. package/frontend/src/static/payments/arrow.long.webp +0 -0
  397. package/frontend/src/static/payments/arrow.long2.webp +0 -0
  398. package/frontend/src/static/payments/cancelled.webp +0 -0
  399. package/frontend/src/static/payments/check.sign.webp +0 -0
  400. package/frontend/src/static/payments/check.webp +0 -0
  401. package/frontend/src/static/payments/close.webp +0 -0
  402. package/frontend/src/static/payments/error.webp +0 -0
  403. package/frontend/src/static/payments/exclamation.webp +0 -0
  404. package/frontend/src/static/payments/minus.webp +0 -0
  405. package/frontend/src/static/payments/party.webp +0 -0
  406. package/frontend/src/static/payments/plus.webp +0 -0
  407. package/frontend/src/static/payments/shopping_cart.webp +0 -0
  408. package/frontend/src/static/payments/trash.webp +0 -0
  409. package/frontend/src/types/global.d.ts +4 -0
  410. package/frontend/src/types/gradient.ts +87 -0
  411. package/frontend/src/ui/any_element.d.ts +5 -0
  412. package/frontend/src/ui/border_button.ts +320 -0
  413. package/frontend/src/ui/button.ts +62 -0
  414. package/frontend/src/ui/canvas.ts +431 -0
  415. package/frontend/src/ui/checkbox.ts +284 -0
  416. package/frontend/src/ui/code.ts +1049 -0
  417. package/frontend/src/ui/color.ts +117 -0
  418. package/frontend/src/ui/context_menu.ts +194 -0
  419. package/frontend/src/ui/css.ts +57 -0
  420. package/frontend/src/ui/divider.ts +28 -0
  421. package/frontend/src/ui/dropdown.ts +503 -0
  422. package/frontend/src/ui/for_each.ts +71 -0
  423. package/frontend/src/ui/form.ts +208 -0
  424. package/frontend/src/ui/frame_modes.ts +140 -0
  425. package/frontend/src/ui/google_map.ts +70 -0
  426. package/frontend/src/ui/gradient.ts +73 -0
  427. package/frontend/src/ui/image.ts +587 -0
  428. package/frontend/src/ui/input.ts +1284 -0
  429. package/frontend/src/ui/link.ts +77 -0
  430. package/frontend/src/ui/list.ts +88 -0
  431. package/frontend/src/ui/loader_button.ts +192 -0
  432. package/frontend/src/ui/loaders.ts +126 -0
  433. package/frontend/src/ui/popup.ts +370 -0
  434. package/frontend/src/ui/pseudo.ts +33 -0
  435. package/frontend/src/ui/scroller.ts +1324 -0
  436. package/frontend/src/ui/slider.ts +215 -0
  437. package/frontend/src/ui/spacer.ts +29 -0
  438. package/frontend/src/ui/span.ts +23 -0
  439. package/frontend/src/ui/stack.ts +238 -0
  440. package/frontend/src/ui/steps.ts +334 -0
  441. package/frontend/src/ui/style.ts +26 -0
  442. package/frontend/src/ui/switch.ts +286 -0
  443. package/frontend/src/ui/table.ts +323 -0
  444. package/frontend/src/ui/tabs.ts +441 -0
  445. package/frontend/src/ui/text.ts +38 -0
  446. package/frontend/src/ui/theme.ts +279 -0
  447. package/frontend/src/ui/title.ts +64 -0
  448. package/frontend/src/ui/ui.ts +47 -0
  449. package/frontend/src/ui/view.ts +44 -0
  450. package/frontend/src/volt.ts +31 -0
  451. package/package.json +58 -0
@@ -0,0 +1,1284 @@
1
+ /*
2
+ * Author: Daan van den Bergh
3
+ * Copyright: © 2022 - 2024 Daan van den Bergh.
4
+ */
5
+
6
+ // Imports.
7
+ import { Elements, VElementTagMap, VInputElement, VTextAreaElement } from "../elements/module.js"
8
+ import { Utils } from "../modules/utils.js"
9
+ import { HStack, HStackElement, VStack, VStackElement } from "./stack"
10
+ import { Text, TextElement } from "./text"
11
+ import { ImageMask, ImageMaskElement } from "./image"
12
+ import { GradientBorder, GradientBorderElement } from "./gradient"
13
+ import { Scroller, ScrollerElement } from "./scroller"
14
+ import { Divider } from "./divider"
15
+
16
+ // Input.
17
+ @Elements.register
18
+ export class InputElement extends VElementTagMap.input {
19
+
20
+ static default_style = {
21
+ "margin": "0px 0px 0px 0px",
22
+ "padding": "2.5px 5px 2.5px 5px",
23
+ "font": "inherit",
24
+ "color": "inherit",
25
+ "background": "none",
26
+ "outline": "none",
27
+ "border": "none",
28
+ "border-radius": "10px",
29
+ "text-align": "start",
30
+ "white-space": "nowrap",
31
+ };
32
+ static default_attributes = {
33
+ "spellcheck": "false",
34
+ "autocorrect": "off",
35
+ "autocapitalize": "none",
36
+ };
37
+
38
+ // Attributes.
39
+ private _e!: HTMLInputElement;
40
+
41
+ // Constructor.
42
+ constructor(placeholder?: string, type: string = "text", value?: string) {
43
+
44
+ // Initialize base class.
45
+ super({
46
+ derived: InputElement,
47
+ });
48
+
49
+ // Safari does not render images correctly for custom elements.
50
+ if (Utils.is_safari) {
51
+ this.attachShadow({ mode: 'open' });
52
+ this._e = document.createElement("input");
53
+ this._e.style.font = "inherit";
54
+ this._e.style.color = "inherit";
55
+ this._e.style.background = "none";
56
+ this._e.style.border = "none";
57
+ this._e.style.outline = "none";
58
+ this._e.style.whiteSpace = "nowrap";
59
+ this._e.style.width = "100%";
60
+ this._e.style.padding = InputElement.default_style.padding;
61
+ (this as any).shadowRoot.appendChild(this._e);
62
+ this.padding("0")
63
+ }
64
+
65
+ // Set src.
66
+ this.placeholder(placeholder ?? "");
67
+ this.type(type ?? "text");
68
+ this.value(value ?? "");
69
+ }
70
+
71
+ // Alias functions.
72
+ value(): string;
73
+ value(val: string | number): this;
74
+ value(val?: string | number): this | string { if (this._e === undefined) { return super.value(val as any); } if (val == null) { return this._e.getAttribute("value") ?? ""; } this._e.setAttribute("value", val.toString()); return this; }
75
+ required(): boolean;
76
+ required(val: boolean): this;
77
+ required(val?: boolean): this | boolean { if (this._e === undefined) { return super.required(val as any); } if (val == null) { return this._e.getAttribute("required") === "true"; } if (!val) { this._e.removeAttribute("required"); } else { this._e.setAttribute("required", val as any); } return this; }
78
+ type(): string;
79
+ type(val: string): this;
80
+ type(val?: string): this | string { if (this._e === undefined) { return super.type(val as any); } if (val == null) { return this._e.getAttribute("type") ?? ""; } this._e.setAttribute("type", val as any); return this; }
81
+ placeholder(): string;
82
+ placeholder(val: string): this;
83
+ placeholder(val?: string): this | string { if (this._e === undefined) { return super.placeholder(val as any); } if (val == null) { return this._e.getAttribute("placeholder") ?? ""; } this._e.setAttribute("placeholder", val as any); return this; }
84
+ resize(): string;
85
+ resize(val: string): this;
86
+ resize(val?: string): this | string { if (this._e === undefined) { return super.resize(val as any); } if (val == null) { return this._e.getAttribute("resize") ?? ""; } this._e.setAttribute("resize", val as any); return this; }
87
+ padding(): string;
88
+ padding(value: undefstrnr): this;
89
+ padding(top_bottom: undefstrnr, left_right: undefstrnr): this;
90
+ padding(top: undefstrnr, right: undefstrnr, bottom: undefstrnr, left: undefstrnr): this;
91
+ padding(...values) {
92
+ if (this._e === undefined) { return super.padding(...values as [number, string]); }
93
+ if (values.length === 0) {
94
+ return this._e.style.padding;
95
+ } else if (values.length === 1) {
96
+ this._e.style.padding = this.pad_numeric(values[0]);
97
+ } else if (values.length === 2) {
98
+ if (values[0] != null) {
99
+ this._e.style.paddingTop = this.pad_numeric(values[0]);
100
+ }
101
+ if (values[1] != null) {
102
+ this._e.style.paddingRight = this.pad_numeric(values[1]);
103
+ }
104
+ if (values[0] != null) {
105
+ this._e.style.paddingBottom = this.pad_numeric(values[0]);
106
+ }
107
+ if (values[1] != null) {
108
+ this._e.style.paddingLeft = this.pad_numeric(values[1]);
109
+ }
110
+ } else if (values.length === 4) {
111
+ this._e.style.paddingTop = this.pad_numeric(values[0]);
112
+ if (values[1] != null) {
113
+ this._e.style.paddingRight = this.pad_numeric(values[1]);
114
+ }
115
+ if (values[2] != null) {
116
+ this._e.style.paddingBottom = this.pad_numeric(values[2]);
117
+ }
118
+ if (values[3] != null) {
119
+ this._e.style.paddingLeft = this.pad_numeric(values[3]);
120
+ }
121
+ } else {
122
+ console.error("Invalid number of arguments for function \"padding()\".");
123
+ }
124
+ return this;
125
+ }
126
+ }
127
+ export const Input = Elements.wrapper(InputElement);
128
+ export const NullInput = Elements.create_null(InputElement);
129
+ declare module './any_element.d.ts' { interface AnyElementMap { InputElement: InputElement }}
130
+
131
+ // InputBox.
132
+ @Elements.register
133
+ export class InputBoxElement extends VElementTagMap.textarea {
134
+
135
+ static default_style = {
136
+ "margin": "0px 0px 0px 0px",
137
+ "padding": "2.5px 5px 2.5px 5px",
138
+ "height": "20px",
139
+ "font": "inherit",
140
+ "color": "inherit",
141
+ "background": "none",
142
+ "outline": "none",
143
+ "border": "none",
144
+ "border-radius": "10px",
145
+ "text-align": "start",
146
+ "white-space": "wrap",
147
+ "resize": "none",
148
+ }
149
+ static default_attributes = {
150
+ "spellcheck": "false",
151
+ "autocorrect": "off",
152
+ "autocapitalize": "none",
153
+ }
154
+
155
+ // Attributes.
156
+ public _e?: HTMLTextAreaElement;
157
+
158
+ // Constructor.
159
+ constructor(placeholder?: string) {
160
+
161
+ // Initialize base class.
162
+ super({
163
+ derived: InputBoxElement,
164
+ });
165
+
166
+ // Safari does not render images correctly for custom elements.
167
+ if (Utils.is_safari) {
168
+ this.attachShadow({ mode: 'open' });
169
+ this._e = document.createElement("textarea");
170
+ this._e.style.font = "inherit";
171
+ this._e.style.color = "inherit";
172
+ this._e.style.background = "none";
173
+ this._e.style.border = "none";
174
+ this._e.style.outline = "none";
175
+ this._e.style.width = "100%";
176
+ this._e.style.height = "100%";
177
+ this._e.style.margin = "0";
178
+ this._e.style.padding = InputBoxElement.default_style.padding;
179
+ (this as any).shadowRoot.appendChild(this._e);
180
+ this.padding("0")
181
+ }
182
+
183
+ // Set src.
184
+ this.placeholder(placeholder ?? "");
185
+ }
186
+
187
+ // Alias functions.
188
+ value(): string;
189
+ value(val: string | number): this;
190
+ value(val?: string | number): this | string { if (this._e === undefined) { return super.value(val as any); } if (val == null) { return this._e.getAttribute("value") ?? ""; } this._e.setAttribute("value", val.toString()); return this; }
191
+ required(): boolean;
192
+ required(val: boolean): this;
193
+ required(val?: boolean): this | boolean { if (this._e === undefined) { return super.required(val as any); } if (val == null) { return this._e.getAttribute("required") === "true"; } if (!val) { this._e.removeAttribute("required"); } else { this._e.setAttribute("required", val as any); } return this; }
194
+ type(): string;
195
+ type(val: string): this;
196
+ type(val?: string): this | string { if (this._e === undefined) { return super.type(val as any); } if (val == null) { return this._e.getAttribute("type") ?? ""; } this._e.setAttribute("type", val as any); return this; }
197
+ placeholder(): string;
198
+ placeholder(val: string): this;
199
+ placeholder(val?: string): this | string { if (this._e === undefined) { return super.placeholder(val as any); } if (val == null) { return this._e.getAttribute("placeholder") ?? ""; } this._e.setAttribute("placeholder", val as any); return this; }
200
+ resize(): string;
201
+ resize(val: string): this;
202
+ resize(val?: string): this | string { if (this._e === undefined) { return super.resize(val as any); } if (val == null) { return this._e.getAttribute("resize") ?? ""; } this._e.setAttribute("resize", val as any); return this; }
203
+ padding(): string;
204
+ padding(value: undefstrnr): this;
205
+ padding(top_bottom: undefstrnr, left_right: undefstrnr): this;
206
+ padding(top: undefstrnr, right: undefstrnr, bottom: undefstrnr, left: undefstrnr): this;
207
+ padding(...values) {
208
+ if (this._e === undefined) { return super.padding(...values as [number, string]); }
209
+ if (values.length === 0) {
210
+ return this._e.style.padding;
211
+ } else if (values.length === 1) {
212
+ this._e.style.padding = this.pad_numeric(values[0]);
213
+ } else if (values.length === 2) {
214
+ if (values[0] != null) {
215
+ this._e.style.paddingTop = this.pad_numeric(values[0]);
216
+ }
217
+ if (values[1] != null) {
218
+ this._e.style.paddingRight = this.pad_numeric(values[1]);
219
+ }
220
+ if (values[0] != null) {
221
+ this._e.style.paddingBottom = this.pad_numeric(values[0]);
222
+ }
223
+ if (values[1] != null) {
224
+ this._e.style.paddingLeft = this.pad_numeric(values[1]);
225
+ }
226
+ } else if (values.length === 4) {
227
+ this._e.style.paddingTop = this.pad_numeric(values[0]);
228
+ if (values[1] != null) {
229
+ this._e.style.paddingRight = this.pad_numeric(values[1]);
230
+ }
231
+ if (values[2] != null) {
232
+ this._e.style.paddingBottom = this.pad_numeric(values[2]);
233
+ }
234
+ if (values[3] != null) {
235
+ this._e.style.paddingLeft = this.pad_numeric(values[3]);
236
+ }
237
+ } else {
238
+ console.error("Invalid number of arguments for function \"padding()\".");
239
+ }
240
+ return this;
241
+ }
242
+ }
243
+ export const InputBox = Elements.wrapper(InputBoxElement);
244
+ export const NullInputBox = Elements.create_null(InputBoxElement);
245
+ declare module './any_element.d.ts' { interface AnyElementMap { InputBoxElement: InputBoxElement }}
246
+
247
+ // Extended input.
248
+ @Elements.register
249
+ export class ExtendedInputElement extends VStackElement {
250
+
251
+ static default_style = {
252
+ ...VStackElement.default_style,
253
+ "color": "inherit",
254
+ "font-size": "16px",
255
+ // Custom.
256
+ "--input-padding": "12px 6px",
257
+ "--input-border-radius": "5px",
258
+ "--input-border-color": "gray",
259
+ "--input-background": "transparent",
260
+ "--image-mask-color": "#000",
261
+ "--image-size": "20px",
262
+ "--image-margin-right": "10px",
263
+ "--image-margin-left": "5px",
264
+ "--image-alt": "VWeb",
265
+ "--focus-color": "#8EB8EB",
266
+ "--missing-color": "#E8454E",
267
+ }
268
+
269
+ #macro ElementKeyboardEvent ((element: this, event: KeyboardEvent) => any)
270
+ #macro ElementEvent ((element: this, event: Event) => any)
271
+
272
+ public _focus_color: string;
273
+ public _missing_color: string;
274
+ public _mask_color: string;
275
+ public _initial_border_color: string;
276
+ public _missing: boolean;
277
+
278
+ // @ts-expect-error
279
+ public label: TextElement;
280
+ public image: ImageMaskElement;
281
+ public input: (InputElement | InputBoxElement);
282
+ public input_border: GradientBorderElement;
283
+ public container: HStackElement;
284
+ public error: TextElement;
285
+
286
+ // @todo add readonly func
287
+
288
+ // Constructor.
289
+ constructor({
290
+ label = undefined,
291
+ image = undefined,
292
+ alt = undefined,
293
+ placeholder = "Input",
294
+ id = undefined,
295
+ readonly = false,
296
+ required = false,
297
+ type = "text",
298
+ value = undefined,
299
+ }: {
300
+ label?: string,
301
+ image?: string,
302
+ alt?: string,
303
+ placeholder?: string,
304
+ id?: string,
305
+ readonly?: boolean,
306
+ required?: boolean,
307
+ type?: string,
308
+ value?: string,
309
+ }) {
310
+
311
+ // Initialize super.
312
+ super();
313
+ this._init_derived({
314
+ derived: ExtendedInputElement,
315
+ })
316
+
317
+ // Set id.
318
+ if (id != null) {
319
+ this.id(id);
320
+ }
321
+
322
+ // Attributes.
323
+ this.element_type = "ExtendedInput";
324
+ this._focus_color = ExtendedInputElement.default_style["--focus-color"];
325
+ this._missing_color = ExtendedInputElement.default_style["--missing-color"];
326
+ this._mask_color = ExtendedInputElement.default_style["--image-mask-color"];
327
+ this._initial_border_color = "black";
328
+ this._missing = false;
329
+
330
+ // Set default styling.
331
+ this.styles(ExtendedInputElement.default_style);
332
+
333
+ // Title element.
334
+ this.label = Text(label)
335
+ .parent(this)
336
+ .font_size("inherit")
337
+ .margin(0, 0, 5, 0)
338
+ .color("inherit")
339
+ .width("fit-content")
340
+ .ellipsis_overflow(true)
341
+ if (label == null) {
342
+ this.label.hide();
343
+ }
344
+
345
+ // Title element.
346
+ this.image = ImageMask(image)
347
+ .parent(this)
348
+ .mask_color(this._mask_color)
349
+ .frame(ExtendedInputElement.default_style["--image-size"], ExtendedInputElement.default_style["--image-size"])
350
+ .margin(0)
351
+ .margin_right(ExtendedInputElement.default_style["--image-margin-right"])
352
+ .margin_left(ExtendedInputElement.default_style["--image-margin-left"])
353
+ .alt(alt ? alt : ExtendedInputElement.default_style["--image-alt"]);
354
+ if (image == null) {
355
+ this.image.hide();
356
+ }
357
+
358
+ // Input element.
359
+ if (type === "box" || type === "area") {
360
+ this.input = InputBox(placeholder)
361
+ } else {
362
+ this.input = Input(placeholder, type)
363
+ }
364
+ (this.input as any)
365
+ .parent(this)
366
+ .color("inherit")
367
+ .readonly(readonly)
368
+ .font_size("inherit")
369
+ .font_weight("normal")
370
+ .margin(0)
371
+ .width("100%")
372
+ .stretch(true)
373
+ .padding(0, 5)
374
+ .line_height("1.6em")
375
+ .box_shadow("none")
376
+ .border("none")
377
+ .outline("none")
378
+ .z_index(1)
379
+ .border_radius(0) // is required.
380
+ // .on_focus(() => {
381
+ // if (this._missing !== true) {
382
+ // this.container.outline(`1px solid ${this._focus_color}`)
383
+ // this.container.box_shadow(`0 0 0 3px ${this._focus_color}80`)
384
+ // }
385
+ // })
386
+ // .on_blur(() => {
387
+ // if (this._missing !== true) {
388
+ // this.container.outline("0px solid transparent")
389
+ // this.container.box_shadow(`0 0 0 0px transparent`)
390
+ // }
391
+ // })
392
+ .on_focus(() => {
393
+ if (this._missing !== true) {
394
+ this.input_border.border_color(this._focus_color)
395
+ this.container.box_shadow(`0 0 0 3px ${this._focus_color}80`)
396
+ }
397
+ })
398
+ .on_blur(() => {
399
+ if (this._missing !== true) {
400
+ this.input_border.border_color(this._initial_border_color)
401
+ this.container.box_shadow(`0 0 0 0px transparent`)
402
+ }
403
+ })
404
+
405
+ // The input border to support gradients.
406
+ this.input_border = GradientBorder()
407
+ .z_index(0)
408
+ .position(0, 0, 0, 0)
409
+ .border_radius(ExtendedInputElement.default_style["--input-border-radius"])
410
+ .border_width(1)
411
+ .border_color(ExtendedInputElement.default_style["--input-border-color"])
412
+ .border_color("0px solid transparent")
413
+ .box_shadow(`0 0 0 0px transparent`)
414
+ .transition("background 200ms ease-in-out")
415
+
416
+ // The hstack container.
417
+ this.container = HStack(
418
+ VStack(
419
+ this.image,
420
+ )
421
+ .height("1.6em")
422
+ .center_vertical(),
423
+ this.input_border,
424
+ this.input,
425
+ )
426
+ .parent(this)
427
+ .position("relative")
428
+ .background(ExtendedInputElement.default_style["--input-background"])
429
+ .padding(ExtendedInputElement.default_style["--input-padding"])
430
+ .transition("box-shadow 0.2s ease-in-out")
431
+ .outline("0px solid transparent")
432
+ .box_shadow(`0 0 0 0px transparent`)
433
+ .width(100%)
434
+
435
+ // The error message.
436
+ this.error = Text("Incomplete field")
437
+ .color(this._missing_color)
438
+ .font_size("0.8em")
439
+ .margin(7.5, 0, 0, 2.5)
440
+ .padding(0)
441
+ .leading()
442
+ .hide()
443
+
444
+ // Set id.
445
+ if (id != null) {
446
+ this.id(id);
447
+ }
448
+
449
+ // Set required.
450
+ if (required) {
451
+ this.required(required);
452
+ }
453
+
454
+ // Append.
455
+ this.append(this.label, this.container, this.error);
456
+
457
+ // Set value.
458
+ if (value) {
459
+ this.value(value)
460
+ }
461
+ }
462
+
463
+ // Get the styling attributes.
464
+ // The values of the children that may have been changed by the custom funcs should be added.
465
+ styles() : Record<string, string>;
466
+ styles(style_dict: Record<string, any>) : this;
467
+ styles(style_dict?: Record<string, any>) : this | Record<string, string> {
468
+ if (style_dict == null) {
469
+ let styles = super.styles();
470
+ styles["--input-background"] = this.container.background();
471
+ styles["--input-padding"] = this.container.padding();
472
+ styles["--input-border-radius"] = this.container.border_radius();
473
+ styles["--input-border-color"] = this.container.border_color();
474
+ styles["--image-mask-color"] = this._mask_color;
475
+ styles["--image-size"] = this.image.width().toString();
476
+ styles["--image-margin-right"] = this.image.margin_right().toString();
477
+ styles["--image-margin-left"] = this.image.margin_left().toString();
478
+ styles["--image-alt"] = this.image.alt() || "VWeb";
479
+ styles["--focus-color"] = this._focus_color;
480
+ styles["--missing-color"] = this._missing_color;
481
+ return styles;
482
+ } else {
483
+ return super.styles(style_dict);
484
+ }
485
+ }
486
+
487
+ // Set default since it inherits an element.
488
+ set_default() : this {
489
+ return super.set_default(ExtendedInputElement);
490
+ }
491
+
492
+ // Set the focus color.
493
+ focus_color(): string;
494
+ focus_color(val: string): this;
495
+ focus_color(val?: string): string | this {
496
+ if (val == null) { return this._focus_color ?? ""; }
497
+ this._focus_color = val;
498
+ return this;
499
+ }
500
+
501
+ // Set the missing color.
502
+ missing_color(): string;
503
+ missing_color(val: string): this;
504
+ missing_color(val?: string): string | this {
505
+ if (val == null) { return this._missing_color ?? ""; }
506
+ this._missing_color = val;
507
+ this.error.color(this._missing_color);
508
+ return this;
509
+ }
510
+
511
+ // Set missing.
512
+ missing(): boolean;
513
+ missing(to: boolean, err?: string): this;
514
+ missing(to?: boolean, err: string = "Incomplete field"): boolean | this {
515
+ if (to == null) { return this._missing; }
516
+ else if (to === true) {
517
+ this._missing = true;
518
+ this.input_border.border_color(this._missing_color)
519
+ // this.container.outline(`1px solid ${this._missing_color}`)
520
+ this.container.box_shadow(`0 0 0 3px ${this._missing_color}80`)
521
+ // this.image.mask_color(this._missing_color)
522
+ this.error.show();
523
+ if (err) {
524
+ this.error.text(err);
525
+ }
526
+ } else {
527
+ this._missing = false;
528
+ this.input_border.border_color(this._initial_border_color)
529
+ // this.container.outline("0px solid transparent")
530
+ this.container.box_shadow(`0 0 0 0px transparent`)
531
+ // this.image.mask_color(this._mask_color)
532
+ this.error.hide();
533
+ }
534
+ return this;
535
+ }
536
+ set_error(err: string = "Incomplete field"): this {
537
+ return this.missing(true, err);
538
+ }
539
+
540
+ // Submit the item, throws an error when the item is not defined.
541
+ submit(): string {
542
+ const value = this.value();
543
+ console.log("id:", this.id(), "value:", value)
544
+ if (value == null || value === "") {
545
+ this.missing(true);
546
+ throw Error("Fill in all the required fields.");
547
+ }
548
+ this.missing(false);
549
+ return value;
550
+ }
551
+
552
+ // Set or get the mask color.
553
+ mask_color(): string;
554
+ mask_color(val: string): this;
555
+ mask_color(val?: string): this | string {
556
+ if (val == null) { return this._mask_color ?? ""; }
557
+ this._mask_color = val;
558
+ this.image.mask_color(this._mask_color);
559
+ return this;
560
+ }
561
+
562
+ // Show error.
563
+ show_error(err: string = "Incomplete field"): this {
564
+ this.missing(true, err);
565
+ return this;
566
+ }
567
+
568
+ // Hide error.
569
+ hide_error(): this {
570
+ this.missing(false);
571
+ return this;
572
+ }
573
+
574
+ // ---------------------------------------------------------
575
+ // Relay functions.
576
+
577
+ text(): string;
578
+ text(val: string): this;
579
+ text(val?: string): string | this { if (val == null) { return this.label.text(); } this.label.text(val); return this; }
580
+
581
+ value(): string;
582
+ value(val: string): this;
583
+ value(val?: string): string | this { if (val == null) { return this.input.value(); } this.input.value(val); return this; }
584
+
585
+ required(): boolean;
586
+ required(val: boolean): this;
587
+ required(val?: boolean): boolean | this { if (val == null) { return this.input.required(); } this.input.required(val); return this; }
588
+
589
+ on_enter(): undefined | ElementKeyboardEvent;
590
+ on_enter(val: ElementKeyboardEvent): this;
591
+ on_enter(val?: ElementKeyboardEvent): this | undefined | ElementKeyboardEvent {
592
+ if (val == null) { return this.input.on_enter() as undefined | ElementKeyboardEvent; }
593
+ this.input.on_enter((x, y) => val(this, y));
594
+ return this;
595
+ }
596
+
597
+ on_input(): undefined | ElementEvent;
598
+ on_input(val: ElementEvent): this;
599
+ on_input(val?: ElementEvent): undefined | ElementEvent | this {
600
+ if (val == null) { return this.input.on_input() as undefined | ElementEvent; }
601
+ this.input.on_input((x, y) => val(this, y));
602
+ return this;
603
+ }
604
+
605
+ border_radius(): string;
606
+ border_radius(val: string): this;
607
+ border_radius(val?: string): string | this { if (val == null) { return this.container.border_radius(); } this.container.border_radius(val); this.input_border.border_radius(val); return this; }
608
+
609
+ border_color(): string;
610
+ border_color(val: string): this;
611
+ border_color(val?: string): string | this {
612
+ if (val == null) { return this.container.border_color(); }
613
+ this._initial_border_color = val;
614
+ this.container.border_color(val);
615
+ this.input_border.border_color(val);
616
+ return this;
617
+ }
618
+
619
+ border_width(): string;
620
+ border_width(val: string): this;
621
+ border_width(val?: string): string | this { if (val == null) { return this.container.border_width(); } this.container.border_width(val); this.input_border.border_width(val); return this; }
622
+
623
+ border_style(): string;
624
+ border_style(val: string): this;
625
+ border_style(val?: string): string | this { if (val == null) { return this.container.border_style(); } this.container.border_style(val); this.input_border.border_style(val); return this; }
626
+
627
+ background(): string;
628
+ background(val: string): this;
629
+ background(val?: string): string | this { if (val == null) { return this.container.background(); } this.container.background(val); return this; }
630
+
631
+ padding(): string;
632
+ padding(value: undefstrnr): this;
633
+ padding(top_bottom: undefstrnr, left_right: undefstrnr): this;
634
+ padding(top: undefstrnr, right: undefstrnr, bottom: undefstrnr, left: undefstrnr): this;
635
+ padding(...values) {
636
+ if (values.length === 0 || (values.length === 1 && values[0] == null)) { return this.container.padding(); }
637
+ this.container.padding(...values as [number, string]);
638
+ return this;
639
+ }
640
+
641
+ border(): string;
642
+ border(value: string): this;
643
+ border(width: string | number, color: string): this;
644
+ border(width: string | number, style: string, color: string): this;
645
+ border(...args: (string | number)[]): this | string {
646
+ if (args.length === 0 || (args.length === 1 && args[0] == null)) { return this.input_border.border(); }
647
+ this.input_border.border(...args as [number, string]);
648
+ return this;
649
+ }
650
+ }
651
+ export const ExtendedInput = Elements.wrapper(ExtendedInputElement);
652
+ export const NullExtendedInput = Elements.create_null(ExtendedInputElement);
653
+ declare module './any_element.d.ts' { interface AnyElementMap { ExtendedInputElement: ExtendedInputElement }}
654
+
655
+ interface ExtendedSelectItem {
656
+ id: string;
657
+ text?: string;
658
+ image?: null;
659
+ stack?: HStackElement;
660
+ }
661
+ type ExtendedSelectOnChange = (element: ExtendedSelectElement, id: string) => any;
662
+
663
+ // Extended input.
664
+ @Elements.register
665
+ export class ExtendedSelectElement extends VStackElement {
666
+
667
+ static default_style = {
668
+ ...VStackElement.default_style,
669
+ "color": "inherit",
670
+ "font-size": "16px",
671
+ "background": "#FFFFFF",
672
+ // Custom.
673
+ "--input-padding": "12px 6px",
674
+ "--input-border-radius": "5px",
675
+ "--input-border-color": "gray",
676
+ "--image-mask-color": "#000",
677
+ "--image-size": "20px",
678
+ "--image-margin-right": "10px",
679
+ "--image-margin-left": "5px",
680
+ "--image-alt": "VWeb",
681
+ "--hover-bg": "#00000007",
682
+ "--focus-color": "#8EB8EB",
683
+ "--missing-color": "#E8454E",
684
+ }
685
+
686
+ public _focus_color: string;
687
+ public _missing_color: string;
688
+ public _mask_color: string;
689
+ public _border_color: string;
690
+ public _hover_bg: string;
691
+ public _missing: boolean;
692
+
693
+ public items: ExtendedSelectItem[];
694
+
695
+ // @ts-expect-error
696
+ public label: TextElement;
697
+ public image: ImageMaskElement;
698
+ public input: InputElement;
699
+ public container: HStackElement;
700
+ public error: TextElement;
701
+ public dropdown: ScrollerElement;
702
+
703
+ public _on_change_callback?: ExtendedSelectOnChange;
704
+
705
+ private _on_dropdown_close: any;
706
+
707
+ public _dropdown_height?: string | number;
708
+ public _value?: string;
709
+
710
+ // Constructor.
711
+ constructor({
712
+ label = undefined,
713
+ image = undefined,
714
+ alt = "",
715
+ placeholder = "Placeholder",
716
+ id = undefined,
717
+ required = false,
718
+ 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.
719
+ }: {
720
+ label?: string,
721
+ image?: string,
722
+ alt?: string,
723
+ placeholder?: string,
724
+ id?: string,
725
+ required?: boolean,
726
+ items: ExtendedSelectItem[] | Record<string, string> | Record<string, ExtendedSelectItem>,
727
+ }) {
728
+
729
+ // Initialize super.
730
+ super();
731
+ this._init_derived({
732
+ derived: ExtendedSelectElement,
733
+ })
734
+
735
+ // Arguments.
736
+ if (Array.isArray(items)) {
737
+ this.items = [];
738
+ items.iterate((item) => {
739
+ if (typeof item === "string") {
740
+ this.items.append({
741
+ id: item,
742
+ text: item,
743
+ })
744
+ } else {
745
+ if (item.text == null) {
746
+ item.text = item.id;
747
+ }
748
+ this.items.append(item)
749
+ }
750
+ });
751
+ } else if (typeof items === "object" && items != null) {
752
+ this.items = [];
753
+ Object.keys(items).iterate((key) => {
754
+ if (typeof items[key] === "string") {
755
+ this.items.append({
756
+ id: key,
757
+ text: items[key],
758
+ });
759
+ } else {
760
+ this.items.append({
761
+ ...items[key],
762
+ id: key,
763
+ });
764
+ }
765
+ })
766
+ } else {
767
+ throw Error(`Parameter "items" should be a defined value of type "array" or "object".`);
768
+ }
769
+
770
+ // Default attributes.
771
+ this.element_type = "ExtendedSelect";
772
+
773
+ // Attributes.
774
+ this._focus_color = ExtendedSelectElement.default_style["--focus-color"];
775
+ this._missing_color = ExtendedSelectElement.default_style["--missing-color"];
776
+ this._mask_color = ExtendedSelectElement.default_style["--image-mask-color"];
777
+ this._border_color = ExtendedSelectElement.default_style["--input-border-color"];
778
+ this._hover_bg = ExtendedSelectElement.default_style["--hover-bg"]
779
+ this._missing = false;
780
+
781
+ // Set default styling.
782
+ this.styles(ExtendedSelectElement.default_style);
783
+
784
+ // Title element.
785
+ this.label = Text(label)
786
+ .parent(this)
787
+ .font_size("inherit")
788
+ .margin(0, 0, 5, 0)
789
+ .color("inherit")
790
+ .width("fit-content")
791
+ .ellipsis_overflow(true)
792
+ if (label == null) {
793
+ this.label.hide();
794
+ }
795
+
796
+ // Title element.
797
+ this.image = ImageMask(image)
798
+ .parent(this)
799
+ .mask_color(this._mask_color)
800
+ .frame(ExtendedSelectElement.default_style["--image-size"], ExtendedSelectElement.default_style["--image-size"])
801
+ .margin(0)
802
+ .margin_right(ExtendedSelectElement.default_style["--image-margin-right"])
803
+ .margin_left(ExtendedSelectElement.default_style["--image-margin-left"])
804
+ .alt(alt ? alt : ExtendedSelectElement.default_style["--image-alt"]);
805
+ if (image == null) {
806
+ this.image.hide();
807
+ }
808
+
809
+ // Input element.
810
+ this.input = Input(placeholder)
811
+ .parent(this)
812
+ .color("inherit")
813
+ .readonly(true)
814
+ .font_size("inherit")
815
+ .margin(0)
816
+ .width("100%")
817
+ .stretch(true)
818
+ .outline("none")
819
+ .padding(0, 5)
820
+ .line_height("1.6em")
821
+ .box_shadow("none")
822
+ .cursor("pointer")
823
+ .border_radius(0) // is required
824
+ // .on_focus(() => {
825
+ // if (this._missing !== true) {
826
+ // this.container.outline(`1px solid ${this._focus_color}`)
827
+ // this.container.box_shadow(`0 0 0 3px ${this._focus_color}80`)
828
+ // }
829
+ // })
830
+ // .on_blur(() => {
831
+ // if (this._missing !== true) {
832
+ // this.container.outline("0px solid transparent")
833
+ // this.container.box_shadow(`0 0 0 0px transparent`)
834
+ // }
835
+ // })
836
+
837
+ // The hstack container.
838
+ this.container = HStack(
839
+ VStack(
840
+ this.image,
841
+ )
842
+ .height("1.6em")
843
+ .center_vertical(),
844
+ this.input,
845
+ )
846
+ .parent(this)
847
+ .background(ExtendedSelectElement.default_style["background"])
848
+ .padding(ExtendedSelectElement.default_style["--input-padding"])
849
+ .border_radius(ExtendedSelectElement.default_style["--input-border-radius"])
850
+ .border_width(1)
851
+ .border_style("solid")
852
+ .border_color(this._border_color)
853
+ .transition("outline 0.2s ease-in-out, box-shadow 0.2s ease-in-out")
854
+ .outline("0px solid transparent")
855
+ .box_shadow(`0 0 0 0px transparent`)
856
+ .width(100%)
857
+ .on_click(() => {
858
+ if (this.dropdown.is_hidden()) {
859
+ this.expand();
860
+ }
861
+ })
862
+
863
+ // The error message.
864
+ this.error = Text("Incomplete field")
865
+ .color(this._missing_color)
866
+ .font_size("0.8em")
867
+ .margin(7.5, 0, 0, 2.5)
868
+ .padding(0)
869
+ .leading()
870
+ .hide()
871
+
872
+ // The dropdown menu.
873
+ this.dropdown = Scroller()
874
+ .parent(this)
875
+ .position(0, null, null, null)
876
+ .background(ExtendedSelectElement.default_style["background"])
877
+ .border_radius(ExtendedSelectElement.default_style["--input-border-radius"])
878
+ .border_width(1)
879
+ .border_style("solid")
880
+ .border_color(this._border_color)
881
+ .box_shadow("0px 0px 5px #00000050")
882
+ .frame(100%, 100%)
883
+ .z_index(10)
884
+ .hide()
885
+
886
+ // Append.
887
+ this.append(this.label, this.container, this.error, this.dropdown);
888
+
889
+ // Styling.
890
+ this.position("relative")
891
+ this.overflow("visible");
892
+ super.background("none")
893
+
894
+ // Set id.
895
+ if (id != null) {
896
+ this.id(id);
897
+ }
898
+
899
+ // Set required.
900
+ if (required) {
901
+ this.required(required);
902
+ }
903
+
904
+ // On dropdown close event by mouse down.
905
+ this._on_dropdown_close = (event) => {
906
+ let parent = event.target.parentElement;
907
+ let stop = true;
908
+ for (let i = 0; i < 4; i++) {
909
+ if (parent == null) { break; }
910
+ else if (parent === this.dropdown) {
911
+ stop = false; break;
912
+ }
913
+ parent = parent.parentElement;
914
+ }
915
+ if (stop) {
916
+ this.dropdown.hide();
917
+ window.removeEventListener("mousedown", this._on_dropdown_close)
918
+ }
919
+ }
920
+ }
921
+
922
+ // Set dropdown height.
923
+ dropdown_height(): undefined | string | number;
924
+ dropdown_height(val: string | number): this;
925
+ dropdown_height(val?: string | number): this | undefined | string | number {
926
+ if (val === undefined) {
927
+ return this._dropdown_height;
928
+ }
929
+ this._dropdown_height = val;
930
+ return this;
931
+ }
932
+
933
+ // Get the styling attributes.
934
+ // The values of the children that may have been changed by the custom funcs should be added.
935
+ styles() : Record<string, string>;
936
+ styles(style_dict: Record<string, any>) : this;
937
+ styles(style_dict?: Record<string, any>) : this | Record<string, string> {
938
+ if (style_dict == null) {
939
+ let styles = super.styles();
940
+ styles["--input-padding"] = this.container.padding();
941
+ styles["--input-border-radius"] = this.container.border_radius();
942
+ styles["--input-border-color"] = this._border_color;
943
+ styles["--image-mask-color"] = this._mask_color;
944
+ styles["--image-size"] = this.image.width().toString();
945
+ styles["--image-margin-right"] = this.image.margin_right().toString();
946
+ styles["--image-margin-left"] = this.image.margin_left().toString();
947
+ styles["--image-alt"] = this.image.alt() || "VWeb";
948
+ styles["--focus-color"] = this._focus_color;
949
+ styles["--missing-color"] = this._missing_color;
950
+ return styles;
951
+ } else {
952
+ return super.styles(style_dict);
953
+ }
954
+ }
955
+
956
+ // Set default since it inherits an element.
957
+ set_default(): this {
958
+ return super.set_default(ExtendedSelectElement);
959
+ }
960
+
961
+ // Set the focus color.
962
+ focus_color(): string;
963
+ focus_color(val: string): this;
964
+ focus_color(val?: string): string | this {
965
+ if (val == null) { return this._focus_color ?? ""; }
966
+ this._focus_color = val;
967
+ return this;
968
+ }
969
+
970
+ // Set the missing color.
971
+ missing_color(): string;
972
+ missing_color(val: string): this;
973
+ missing_color(val?: string): string | this {
974
+ if (val == null) { return this._missing_color ?? ""; }
975
+ this._missing_color = val;
976
+ this.error.color(this._missing_color);
977
+ return this;
978
+ }
979
+
980
+ // Set missing.
981
+ missing(): boolean;
982
+ missing(to: boolean, err?: string): this;
983
+ missing(to?: boolean, err: string = "Incomplete field"): boolean | this {
984
+ if (to == null) { return this._missing; }
985
+ else if (to === true) {
986
+ this._missing = true;
987
+ this.container.outline(`1px solid ${this._missing_color}`)
988
+ this.container.box_shadow(`0 0 0 3px ${this._missing_color}80`)
989
+ this.image.mask_color(this._missing_color)
990
+ this.error.show();
991
+ if (err) {
992
+ this.error.text(err);
993
+ }
994
+ } else {
995
+ this._missing = false;
996
+ this.container.outline("0px solid transparent")
997
+ this.container.box_shadow(`0 0 0 0px transparent`)
998
+ this.image.mask_color(this._mask_color)
999
+ this.error.hide();
1000
+ }
1001
+ return this;
1002
+ }
1003
+ set_error(err: string = "Incomplete field"): this {
1004
+ return this.missing(true, err);
1005
+ }
1006
+
1007
+ // Submit the item, throws an error when the item is not defined.
1008
+ submit(): string {
1009
+ const value = this.value();
1010
+ if (value == null || value === "") {
1011
+ this.missing(true);
1012
+ throw Error("Fill in all the required fields.");
1013
+ }
1014
+ this.missing(false);
1015
+ return value;
1016
+ }
1017
+
1018
+ // Expand dropdown.
1019
+ expand(): this {
1020
+
1021
+ // Add event listener.
1022
+ window.addEventListener("mousedown", this._on_dropdown_close);
1023
+
1024
+ // Clear.
1025
+ this.dropdown.remove_children();
1026
+
1027
+ // Set top.
1028
+ // this.dropdown.top(this.label.clientHeight + this.container.clientHeight + (this.label.is_hidden() ? 0 : 5) + 5)
1029
+ this.dropdown.top(this.label.clientHeight + (this.label.is_hidden() ? 0 : 5))
1030
+
1031
+ // Search bar.
1032
+ const search = Input("Search")
1033
+ .color("inherit")
1034
+ .font_size("inherit")
1035
+ .margin(10)
1036
+ .padding(0)
1037
+ .width("calc(100% - 20px)")
1038
+ .outline("none")
1039
+ .box_shadow("none")
1040
+ .border_radius(0)
1041
+ .on_input((e, event) => {
1042
+ const query = e.value();
1043
+ if (query.length === 0) {
1044
+ content.inner_html("");
1045
+ this.items.iterate((item) => {
1046
+ content.append(item.stack);
1047
+ })
1048
+ } else {
1049
+ const results = Utils.fuzzy_search({
1050
+ query,
1051
+ targets: this.items,
1052
+ limit: undefined,
1053
+ case_match: false,
1054
+ allow_exceeding_chars: true,
1055
+ key: ["id", "text"],
1056
+ });
1057
+ content.inner_html("");
1058
+ results.iterate((item) => {
1059
+ content.append(item.stack);
1060
+ })
1061
+ }
1062
+ })
1063
+
1064
+ // The content.
1065
+ const content = VStack()
1066
+ .frame(100%)
1067
+ .padding(5, 0)
1068
+
1069
+ // Add children.
1070
+ let i = 0;
1071
+ let min_height;
1072
+ // this.dropdown.items = [];
1073
+ this.items.iterate((item) => {
1074
+
1075
+ // Image.
1076
+ let img;
1077
+ if (item.image != null) {
1078
+ img = ImageMask(item.image)
1079
+ .mask_color(this._mask_color)
1080
+ .frame(ExtendedSelectElement.default_style["--image-size"], ExtendedSelectElement.default_style["--image-size"])
1081
+ .margin(0)
1082
+ .margin_right(ExtendedSelectElement.default_style["--image-margin-right"])
1083
+ .margin_left(ExtendedSelectElement.default_style["--image-margin-left"])
1084
+ .alt(ExtendedSelectElement.default_style["--image-alt"])
1085
+ .pointer_events("none") // so target element of mouse down is easier.
1086
+ }
1087
+
1088
+ // Text.
1089
+ const text = Text(item.text)
1090
+ .color("inherit")
1091
+ .font_size("inherit")
1092
+ .white_space("pre")
1093
+ .margin(0)
1094
+ .width("100%")
1095
+ .stretch(true)
1096
+ .pointer_events("none") // so target element of mouse down is easier.
1097
+
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._hover_bg))
1114
+ .on_mouse_out((e) => e.background("transparent"))
1115
+
1116
+ // Update the item with the stack for searches.
1117
+ item.stack = stack;
1118
+
1119
+ // Append.
1120
+ content.append(stack);
1121
+
1122
+ // Increment.
1123
+ ++i;
1124
+
1125
+ })
1126
+
1127
+ // Show search bar or just show everything.
1128
+ if (this.items.length > 15) {
1129
+ this.dropdown.append(
1130
+ search,
1131
+ Divider()
1132
+ .margin(0)
1133
+ .background(this._border_color),
1134
+ content,
1135
+ );
1136
+ } else {
1137
+ this.dropdown.append(content);
1138
+ }
1139
+
1140
+ // Show dropdown.
1141
+ this.dropdown.show();
1142
+
1143
+ // Select
1144
+ if (this.items.length > 15) {
1145
+ search.select();
1146
+ }
1147
+
1148
+ // Set min height.
1149
+ if (this._dropdown_height !== undefined) {
1150
+ this.dropdown.fixed_height(this._dropdown_height);
1151
+ }
1152
+ else if (this.items.length > 15) {
1153
+ this.dropdown.fixed_height((this.dropdown.content.child(0).clientHeight) * Math.min(this.items.length, 10) + 10)
1154
+ }
1155
+ else {
1156
+ this.dropdown.fixed_height((this.dropdown.content.child(0).child(0).clientHeight) * Math.min(this.items.length, 10) + 10)
1157
+ }
1158
+ // this.dropdown.min_height((this.dropdown.content.child(0).clientHeight + 10) * Math.min(this.items.length, 10) + 10) // old.
1159
+
1160
+ // Response.
1161
+ return this;
1162
+ }
1163
+
1164
+ // Get or set the value, when it is being set it should be the id of one of the items otherwise nothing happens.
1165
+ value(): string;
1166
+ value(val: string): this;
1167
+ value(val?: string): string | this {
1168
+ if (val == null) { return this._value ?? ""; }
1169
+ this.items.iterate((item) => {
1170
+ if (item.id === val) {
1171
+ this._value = val;
1172
+ this.input.value(item.text ?? item.id);
1173
+ if (this._on_change_callback != null) {
1174
+ this._on_change_callback(this, val);
1175
+ }
1176
+ }
1177
+ })
1178
+ return this;
1179
+ }
1180
+
1181
+ // Styling.
1182
+ mask_color(): string;
1183
+ mask_color(val: string): this;
1184
+ mask_color(val?: string): string | this {
1185
+ if (val == null) { return this._mask_color; }
1186
+ this._mask_color = val;
1187
+ this.image.mask_color(this._mask_color);
1188
+ return this;
1189
+ }
1190
+
1191
+ background(): string;
1192
+ background(val: string): this;
1193
+ background(val?: string): string | this {
1194
+ if (val == null) { return this.background(); }
1195
+ this.container.background(val)
1196
+ this.dropdown.background(val)
1197
+ return this;
1198
+ }
1199
+
1200
+ border_radius(): string;
1201
+ border_radius(val: string | number): this;
1202
+ border_radius(val?: string | number): string | this {
1203
+ if (val == null) { return this.container.border_radius(); }
1204
+ this.container.border_radius(val);
1205
+ this.dropdown.border_radius(val);
1206
+ return this;
1207
+ }
1208
+
1209
+ border_color(): string;
1210
+ border_color(val: string): this;
1211
+ border_color(val?: string): string | this {
1212
+ if (val == null) { return this._border_color; }
1213
+ this._border_color = val;
1214
+ this.container.border_color(this._border_color);
1215
+ this.dropdown.border_color(this._border_color);
1216
+ return this;
1217
+ }
1218
+
1219
+ border_width(): string;
1220
+ border_width(val: number | string): this;
1221
+ border_width(val?: number | string): string | this {
1222
+ if (val == null) { return this.container.border_width(); }
1223
+ this.container.border_width(val);
1224
+ this.dropdown.border_width(val);
1225
+ return this;
1226
+ }
1227
+
1228
+ border_style(): string;
1229
+ border_style(val: string): this;
1230
+ border_style(val?: string): string | this {
1231
+ if (val == null) { return this.container.border_style(); }
1232
+ this.container.border_style(val);
1233
+ this.dropdown.border_style(val);
1234
+ return this;
1235
+ }
1236
+
1237
+ padding(): string;
1238
+ padding(value: undefstrnr): this;
1239
+ padding(top_bottom: undefstrnr, left_right: undefstrnr): this;
1240
+ padding(top: undefstrnr, right: undefstrnr, bottom: undefstrnr, left: undefstrnr): this;
1241
+ padding(...values) {
1242
+ if (values.length === 0 || (values.length === 1 && values[0] == null)) { return this.container.padding(); }
1243
+ this.container.padding(...values as [number, string]);
1244
+ this.dropdown.padding(...values as [number, string]);
1245
+ return this;
1246
+ }
1247
+
1248
+ border(): string;
1249
+ border(value: string): this;
1250
+ border(width: string | number, color: string): this;
1251
+ border(width: string | number, style: string, color: string): this;
1252
+ border(...args: (string | number)[]): this | string {
1253
+ if (args.length === 0 || (args.length === 1 && args[0] == null)) { return this.container.border(); }
1254
+ this.container.border(...args as [number, string]);
1255
+ this.dropdown.border(...args as [number, string]);
1256
+ return this;
1257
+ }
1258
+
1259
+ // On change event.
1260
+ // @ts-expect-error
1261
+ on_change() : undefined | ExtendedSelectOnChange;
1262
+ // @ts-expect-error
1263
+ on_change(callback: ExtendedSelectOnChange) : this;
1264
+ // @ts-expect-error
1265
+ on_change(callback?: ExtendedSelectOnChange) : undefined | ExtendedSelectOnChange | this {
1266
+ if (callback == null) { return this._on_change_callback; }
1267
+ this._on_change_callback = callback;
1268
+ return this;
1269
+ }
1270
+
1271
+ // ---------------------------------------------------------
1272
+ // Relay functions.
1273
+
1274
+ text(): string;
1275
+ text(val: string): this;
1276
+ text(val?: string): string | this { if (val == null) { return this.label.text(); } this.label.text(val); return this; }
1277
+
1278
+ required(): boolean;
1279
+ required(val: boolean): this;
1280
+ required(val?: boolean): boolean | this { if (val == null) { return this.input.required(); } this.input.required(val); return this; }
1281
+ }
1282
+ export const ExtendedSelect = Elements.wrapper(ExtendedSelectElement);
1283
+ export const NullExtendedSelect = Elements.create_null(ExtendedSelectElement);
1284
+ declare module './any_element.d.ts' { interface AnyElementMap { ExtendedSelectElement: ExtendedSelectElement }}