@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,1720 @@
1
+ /*
2
+ * Author: Daan van den Bergh
3
+ * Copyright: © 2022 - 2024 Daan van den Bergh.
4
+ */
5
+
6
+ // ---------------------------------------------------------
7
+ // The HTML element server side for creating mails.
8
+ // Element.
9
+
10
+ // The class.
11
+ export class Element {
12
+
13
+ // ---------------------------------------------------------
14
+ // Attributes.
15
+
16
+ // static element_tag: string = tag; // must remain static.
17
+
18
+ type: string;
19
+ element_type: string;
20
+ tag: string;
21
+ _style: Record<string, string>;
22
+ _attrs: Record<string, any>;
23
+ classes: string[];
24
+ _inner_html: string | null;
25
+ children: any[];
26
+ _lang?: string;
27
+ _charset?: string;
28
+ _viewport?: string;
29
+ _title?: string;
30
+ _links?: (string | Record<string, string>)[];
31
+ _disabled?: boolean;
32
+
33
+ // ---------------------------------------------------------
34
+ // Constructor.
35
+
36
+ constructor({
37
+ type = "VElement",
38
+ tag = "div",
39
+ default_style = null,
40
+ default_attributes = null,
41
+ default_events = null,
42
+ }: {
43
+ type?: string;
44
+ tag?: string;
45
+ default_style?: Record<string, string> | null;
46
+ default_attributes?: Record<string, string> | null;
47
+ default_events?: Record<string, (event: Event) => any> | null;
48
+ }) {
49
+
50
+ // Arguments.
51
+ this.type = type;
52
+ this.element_type = type;
53
+ this.tag = tag;
54
+
55
+ // Attributes.
56
+ this._style = {};
57
+ this._attrs = {};
58
+ this.classes = [];
59
+ this._inner_html = null;
60
+ this.children = [];
61
+
62
+ // Assign default style.
63
+ if (default_style != null) {
64
+ Object.keys(default_style).forEach((key) => {
65
+ this._style[key] = default_style![key];
66
+ });
67
+ }
68
+
69
+ // Assign default attributes.
70
+ if (default_attributes != null) {
71
+ Object.keys(default_attributes).forEach((key) => {
72
+ this._attrs[key] = default_attributes![key];
73
+ });
74
+ }
75
+
76
+ // Assign default events.
77
+ if (default_events != null) {
78
+ Object.keys(default_events).forEach((key) => {
79
+ this._attrs[key] = default_events![key];
80
+ });
81
+ }
82
+
83
+ }
84
+
85
+ // ---------------------------------------------------------
86
+ // Utils.
87
+
88
+ // Pad a numeric with px.
89
+ pad_numeric(value: string | number, padding = "px"): string {
90
+ if (typeof value === "number") {
91
+ return value + padding;
92
+ }
93
+ return value;
94
+ }
95
+
96
+ // ---------------------------------------------------------
97
+ // Build functions.
98
+
99
+ // Build the html.
100
+ html(): string {
101
+ // Vars.
102
+ let html = "", tag;
103
+
104
+ // A default element.
105
+ if (this.tag !== "mail") {
106
+ tag = this.tag;
107
+ }
108
+ // The parent mail element.
109
+ else {
110
+ tag = "body";
111
+
112
+ // Build header.
113
+ html += "<!DOCTYPE html>";
114
+ html += `<html lang="${this._lang || "en"}" style="height: 100%;">`;
115
+ html += `<head>`;
116
+ html += `<meta charset="${this._charset || "UTF-8"}">`;
117
+ html += `<meta name="viewport" charset="${this._viewport || "width=device-width, initial-scale=1.0"}">`;
118
+ html += `<meta name="color-scheme" content="light">`;
119
+ html += `<meta name="supported-color-schemes" content="light">`;
120
+ html += `<title>${this._title || ""}"</title>`;
121
+ html += "<style type=\"text/css\">* {box-sizing:border-box;}</style>";
122
+
123
+ // Links.
124
+ if (this._links !== undefined) {
125
+ this._links.forEach((url) => {
126
+ if (typeof url === "string") {
127
+ html += `<link rel="stylesheet" href="${url}">`;
128
+ } else if (typeof url === "object") {
129
+ if (url.rel == null) {
130
+ url.rel = "stylesheet";
131
+ }
132
+ html += "<link";
133
+ Object.keys(url).forEach((key) => {
134
+ html += ` ${key}="${url[key]}"`;
135
+ });
136
+ html += ">";
137
+ } else {
138
+ throw Error("Invalid type for a css include, the valid value types are \"string\" and \"object\".");
139
+ }
140
+ });
141
+ }
142
+
143
+ // Close header.
144
+ html += `</head>`;
145
+
146
+ // Set presentation role.
147
+ if (this.children.length > 0 && this.children[0].tag === "table") {
148
+ this.children[0]._attrs.role = "presentation";
149
+ }
150
+ }
151
+
152
+ // Open.
153
+ html += "<";
154
+ html += tag;
155
+ html += " ";
156
+
157
+ // Classes.
158
+ if (this.classes.length > 0) {
159
+ html += "class=\"";
160
+ let i = 0;
161
+ this.classes.forEach((key) => {
162
+ html += key;
163
+ if (i < this.classes.length - 1) { html += " "; }
164
+ ++i;
165
+ });
166
+ html += "\" ";
167
+ }
168
+
169
+ // Style.
170
+ if (Object.keys(this._style).length > 0) {
171
+ html += "style=\"";
172
+ Object.keys(this._style).forEach((key) => {
173
+ html += `${key}:${this._style[key].replaceAll('"', '\'')};`;
174
+ });
175
+ html += "\"";
176
+ }
177
+
178
+ // Attributes.
179
+ Object.keys(this._attrs).forEach((key) => {
180
+ html += ` ${key}="${this._attrs[key]}"`;
181
+ });
182
+
183
+ // End opening.
184
+ html += ">\n";
185
+
186
+ // Add inner html.
187
+ if (this._inner_html != null) {
188
+ html += this._inner_html;
189
+ }
190
+
191
+ // Add children.
192
+ this.children.forEach((child) => {
193
+ html += child.html();
194
+ });
195
+
196
+ // Close.
197
+ html += "</";
198
+ html += this.tag;
199
+ html += "";
200
+ html += ">\n";
201
+
202
+ // The parent mail element.
203
+ if (this.tag === "mail") {
204
+ html += "</html>";
205
+ }
206
+
207
+ // Response.
208
+ return html;
209
+ }
210
+
211
+ // Add links to the main MailElement.
212
+ links(links: (string | Record<string, string>)[]): this {
213
+ if (this._links === undefined) {
214
+ this._links = [];
215
+ }
216
+ this._links = this._links.concat(links);
217
+ return this;
218
+ }
219
+
220
+ // ---------------------------------------------------------
221
+ // Default funcs.
222
+
223
+ /* @docs:
224
+ * @title: Background Color
225
+ * @description: Get or set the background color of the element.
226
+ * @funcs: 3
227
+ * @parameter:
228
+ * @name: value
229
+ * @description: The color value to set.
230
+ * @type: string
231
+ * @returns: The current value when getting, or the element instance when setting.
232
+ */
233
+ background_color(): string | undefined;
234
+ background_color(value: string): this;
235
+ background_color(value?: string): this | string | undefined {
236
+ if (value == null) return this._style["background-color"];
237
+ this._style["background-color"] = value;
238
+ return this;
239
+ }
240
+
241
+ /* @docs:
242
+ * @title: Display
243
+ * @description: Get or set the display property.
244
+ * @funcs: 3
245
+ */
246
+ display(): string | undefined;
247
+ display(value: string): this;
248
+ display(value?: string): this | string | undefined {
249
+ if (value == null) return this._style["display"];
250
+ this._style["display"] = value;
251
+ return this;
252
+ }
253
+
254
+ /* @docs:
255
+ * @title: Background Image
256
+ * @description: Get or set the background image.
257
+ * @funcs: 3
258
+ */
259
+ background_image(): string | undefined;
260
+ background_image(value: string): this;
261
+ background_image(value?: string): this | string | undefined {
262
+ if (value == null) return this._style["background-image"];
263
+ this._style["background-image"] = value;
264
+ return this;
265
+ }
266
+
267
+ background_repeat(): string | undefined;
268
+ background_repeat(value: string): this;
269
+ background_repeat(value?: string): this | string | undefined {
270
+ if (value == null) return this._style["background-repeat"];
271
+ this._style["background-repeat"] = value;
272
+ return this;
273
+ }
274
+
275
+ border_top(): string | undefined;
276
+ border_top(value: string): this;
277
+ border_top(value?: string): this | string | undefined {
278
+ if (value == null) return this._style["border-top"];
279
+ this._style["border-top"] = value;
280
+ return this;
281
+ }
282
+
283
+ border_bottom(): string | undefined;
284
+ border_bottom(value: string): this;
285
+ border_bottom(value?: string): this | string | undefined {
286
+ if (value == null) return this._style["border-bottom"];
287
+ this._style["border-bottom"] = value;
288
+ return this;
289
+ }
290
+
291
+ border_right(): string | undefined;
292
+ border_right(value: string): this;
293
+ border_right(value?: string): this | string | undefined {
294
+ if (value == null) return this._style["border-right"];
295
+ this._style["border-right"] = value;
296
+ return this;
297
+ }
298
+
299
+ border_left(): string | undefined;
300
+ border_left(value: string): this;
301
+ border_left(value?: string): this | string | undefined {
302
+ if (value == null) return this._style["border-left"];
303
+ this._style["border-left"] = value;
304
+ return this;
305
+ }
306
+
307
+ border_color(): string | undefined;
308
+ border_color(value: string): this;
309
+ border_color(value?: string): this | string | undefined {
310
+ if (value == null) return this._style["border-color"];
311
+ this._style["border-color"] = value;
312
+ return this;
313
+ }
314
+
315
+ border_style(): string | undefined;
316
+ border_style(value: string): this;
317
+ border_style(value?: string): this | string | undefined {
318
+ if (value == null) return this._style["border-style"];
319
+ this._style["border-style"] = value;
320
+ return this;
321
+ }
322
+
323
+ cursor(): string | undefined;
324
+ cursor(value: string): this;
325
+ cursor(value?: string): this | string | undefined {
326
+ if (value == null) return this._style["cursor"];
327
+ this._style["cursor"] = value;
328
+ return this;
329
+ }
330
+
331
+ justify_items(): string | undefined;
332
+ justify_items(value: string): this;
333
+ justify_items(value?: string): this | string | undefined {
334
+ if (value == null) return this._style["justify-items"];
335
+ this._style["justify-items"] = value;
336
+ return this;
337
+ }
338
+
339
+ letter_spacing(): string | undefined;
340
+ letter_spacing(value: string): this;
341
+ letter_spacing(value?: string): this | string | undefined {
342
+ if (value == null) return this._style["letter-spacing"];
343
+ this._style["letter-spacing"] = value;
344
+ return this;
345
+ }
346
+
347
+ line_height(): string | undefined;
348
+ line_height(value: string): this;
349
+ line_height(value?: string): this | string | undefined {
350
+ if (value == null) return this._style["line-height"];
351
+ this._style["line-height"] = value;
352
+ return this;
353
+ }
354
+
355
+ outline(): string | undefined;
356
+ outline(value: string): this;
357
+ outline(value?: string): this | string | undefined {
358
+ if (value == null) return this._style["outline"];
359
+ this._style["outline"] = value;
360
+ return this;
361
+ }
362
+
363
+ overflow(): string | undefined;
364
+ overflow(value: string): this;
365
+ overflow(value?: string): this | string | undefined {
366
+ if (value == null) return this._style["overflow"];
367
+ this._style["overflow"] = value;
368
+ return this;
369
+ }
370
+
371
+ overflow_x(): string | undefined;
372
+ overflow_x(value: string): this;
373
+ overflow_x(value?: string): this | string | undefined {
374
+ if (value == null) return this._style["overflow-x"];
375
+ this._style["overflow-x"] = value;
376
+ return this;
377
+ }
378
+
379
+ overflow_y(): string | undefined;
380
+ overflow_y(value: string): this;
381
+ overflow_y(value?: string): this | string | undefined {
382
+ if (value == null) return this._style["overflow-y"];
383
+ this._style["overflow-y"] = value;
384
+ return this;
385
+ }
386
+
387
+ text_align(): string | undefined;
388
+ text_align(value: string): this;
389
+ text_align(value?: string): this | string | undefined {
390
+ if (value == null) return this._style["text-align"];
391
+ this._style["text-align"] = value;
392
+ return this;
393
+ }
394
+
395
+ text_align_last(): string | undefined;
396
+ text_align_last(value: string): this;
397
+ text_align_last(value?: string): this | string | undefined {
398
+ if (value == null) return this._style["text-align-last"];
399
+ this._style["text-align-last"] = value;
400
+ return this;
401
+ }
402
+
403
+ text_decoration(): string | undefined;
404
+ text_decoration(value: string): this;
405
+ text_decoration(value?: string): this | string | undefined {
406
+ if (value == null) return this._style["text-decoration"];
407
+ this._style["text-decoration"] = value;
408
+ return this;
409
+ }
410
+
411
+ text_decoration_color(): string | undefined;
412
+ text_decoration_color(value: string): this;
413
+ text_decoration_color(value?: string): this | string | undefined {
414
+ if (value == null) return this._style["text-decoration-color"];
415
+ this._style["text-decoration-color"] = value;
416
+ return this;
417
+ }
418
+
419
+ text_wrap(): string | undefined;
420
+ text_wrap(value: string): this;
421
+ text_wrap(value?: string): this | string | undefined {
422
+ if (value == null) return this._style["text-wrap"];
423
+ this._style["text-wrap"] = value;
424
+ return this;
425
+ }
426
+
427
+ white_space(): string | undefined;
428
+ white_space(value: string): this;
429
+ white_space(value?: string): this | string | undefined {
430
+ if (value == null) return this._style["white-space"];
431
+ this._style["white-space"] = value;
432
+ return this;
433
+ }
434
+
435
+ overflow_wrap(): string | undefined;
436
+ overflow_wrap(value: string): this;
437
+ overflow_wrap(value?: string): this | string | undefined {
438
+ if (value == null) return this._style["overflow-wrap"];
439
+ this._style["overflow-wrap"] = value;
440
+ return this;
441
+ }
442
+
443
+ word_wrap(): string | undefined;
444
+ word_wrap(value: string): this;
445
+ word_wrap(value?: string): this | string | undefined {
446
+ if (value == null) return this._style["word-wrap"];
447
+ this._style["word-wrap"] = value;
448
+ return this;
449
+ }
450
+
451
+ box_shadow(): string | undefined;
452
+ box_shadow(value: string): this;
453
+ box_shadow(value?: string): this | string | undefined {
454
+ if (value == null) return this._style["box-shadow"];
455
+ this._style["box-shadow"] = value;
456
+ return this;
457
+ }
458
+
459
+ drop_shadow(): string | undefined;
460
+ drop_shadow(value: string): this;
461
+ drop_shadow(value?: string): this | string | undefined {
462
+ if (value == null) return this._style["drop-shadow"];
463
+ this._style["drop-shadow"] = value;
464
+ return this;
465
+ }
466
+
467
+ // Group 2: Numeric padding functions
468
+ font_size(): string | undefined;
469
+ font_size(value: string | number): this;
470
+ font_size(value?: string | number): this | string | undefined {
471
+ if (value == null) return this._style["font-size"];
472
+ this._style["font-size"] = this.pad_numeric(value);
473
+ return this;
474
+ }
475
+
476
+ font(): string | undefined;
477
+ font(value: string | number): this;
478
+ font(value?: string | number): this | string | undefined {
479
+ if (value == null) return this._style["font"];
480
+ this._style["font"] = this.pad_numeric(value);
481
+ return this;
482
+ }
483
+
484
+ font_family(): string | undefined;
485
+ font_family(value: string | number): this;
486
+ font_family(value?: string | number): this | string | undefined {
487
+ if (value == null) return this._style["font-family"];
488
+ this._style["font-family"] = this.pad_numeric(value);
489
+ return this;
490
+ }
491
+
492
+ font_style(): string | undefined;
493
+ font_style(value: string | number): this;
494
+ font_style(value?: string | number): this | string | undefined {
495
+ if (value == null) return this._style["font-style"];
496
+ this._style["font-style"] = this.pad_numeric(value);
497
+ return this;
498
+ }
499
+
500
+ font_weight(): string | undefined;
501
+ font_weight(value: string | number): this;
502
+ font_weight(value?: string | number): this | string | undefined {
503
+ if (value == null) return this._style["font-weight"];
504
+ this._style["font-weight"] = this.pad_numeric(value);
505
+ return this;
506
+ }
507
+
508
+ width(): string | undefined;
509
+ width(value: string | number): this;
510
+ width(value?: string | number): this | string | undefined {
511
+ if (value == null) return this._style["width"];
512
+ this._style["width"] = this.pad_numeric(value);
513
+ return this;
514
+ }
515
+
516
+ min_width(): string | undefined;
517
+ min_width(value: string | number): this;
518
+ min_width(value?: string | number): this | string | undefined {
519
+ if (value == null) return this._style["min-width"];
520
+ this._style["min-width"] = this.pad_numeric(value);
521
+ return this;
522
+ }
523
+
524
+ max_width(): string | undefined;
525
+ max_width(value: string | number): this;
526
+ max_width(value?: string | number): this | string | undefined {
527
+ if (value == null) return this._style["max-width"];
528
+ this._style["max-width"] = this.pad_numeric(value);
529
+ return this;
530
+ }
531
+
532
+ height(): string | undefined;
533
+ height(value: string | number): this;
534
+ height(value?: string | number): this | string | undefined {
535
+ if (value == null) return this._style["height"];
536
+ this._style["height"] = this.pad_numeric(value);
537
+ return this;
538
+ }
539
+
540
+ min_height(): string | undefined;
541
+ min_height(value: string | number): this;
542
+ min_height(value?: string | number): this | string | undefined {
543
+ if (value == null) return this._style["min-height"];
544
+ this._style["min-height"] = this.pad_numeric(value);
545
+ return this;
546
+ }
547
+
548
+ max_height(): string | undefined;
549
+ max_height(value: string | number): this;
550
+ max_height(value?: string | number): this | string | undefined {
551
+ if (value == null) return this._style["max-height"];
552
+ this._style["max-height"] = this.pad_numeric(value);
553
+ return this;
554
+ }
555
+
556
+ margin_top(): string | undefined;
557
+ margin_top(value: string | number): this;
558
+ margin_top(value?: string | number): this | string | undefined {
559
+ if (value == null) return this._style["margin-top"];
560
+ this._style["margin-top"] = this.pad_numeric(value);
561
+ return this;
562
+ }
563
+
564
+ margin_bottom(): string | undefined;
565
+ margin_bottom(value: string | number): this;
566
+ margin_bottom(value?: string | number): this | string | undefined {
567
+ if (value == null) return this._style["margin-bottom"];
568
+ this._style["margin-bottom"] = this.pad_numeric(value);
569
+ return this;
570
+ }
571
+
572
+ margin_right(): string | undefined;
573
+ margin_right(value: string | number): this;
574
+ margin_right(value?: string | number): this | string | undefined {
575
+ if (value == null) return this._style["margin-right"];
576
+ this._style["margin-right"] = this.pad_numeric(value);
577
+ return this;
578
+ }
579
+
580
+ margin_left(): string | undefined;
581
+ margin_left(value: string | number): this;
582
+ margin_left(value?: string | number): this | string | undefined {
583
+ if (value == null) return this._style["margin-left"];
584
+ this._style["margin-left"] = this.pad_numeric(value);
585
+ return this;
586
+ }
587
+
588
+ padding_top(): string | undefined;
589
+ padding_top(value: string | number): this;
590
+ padding_top(value?: string | number): this | string | undefined {
591
+ if (value == null) return this._style["padding-top"];
592
+ this._style["padding-top"] = this.pad_numeric(value);
593
+ return this;
594
+ }
595
+
596
+ padding_bottom(): string | undefined;
597
+ padding_bottom(value: string | number): this;
598
+ padding_bottom(value?: string | number): this | string | undefined {
599
+ if (value == null) return this._style["padding-bottom"];
600
+ this._style["padding-bottom"] = this.pad_numeric(value);
601
+ return this;
602
+ }
603
+
604
+ padding_right(): string | undefined;
605
+ padding_right(value: string | number): this;
606
+ padding_right(value?: string | number): this | string | undefined {
607
+ if (value == null) return this._style["padding-right"];
608
+ this._style["padding-right"] = this.pad_numeric(value);
609
+ return this;
610
+ }
611
+
612
+ padding_left(): string | undefined;
613
+ padding_left(value: string | number): this;
614
+ padding_left(value?: string | number): this | string | undefined {
615
+ if (value == null) return this._style["padding-left"];
616
+ this._style["padding-left"] = this.pad_numeric(value);
617
+ return this;
618
+ }
619
+
620
+ border_width(): string | undefined;
621
+ border_width(value: string | number): this;
622
+ border_width(value?: string | number): this | string | undefined {
623
+ if (value == null) return this._style["border-width"];
624
+ this._style["border-width"] = this.pad_numeric(value);
625
+ return this;
626
+ }
627
+
628
+ // Group 3: Browser prefixed properties
629
+ align_items(): string | undefined;
630
+ align_items(value: string): this;
631
+ align_items(value?: string): this | string | undefined {
632
+ if (value == null) return this._style["align-items"];
633
+ this._style["align-items"] = value;
634
+ this._style["-ms-align-items"] = value;
635
+ this._style["-webkit-align-items"] = value;
636
+ this._style["-moz-align-items"] = value;
637
+ return this;
638
+ }
639
+
640
+ align_content(): string | undefined;
641
+ align_content(value: string): this;
642
+ align_content(value?: string): this | string | undefined {
643
+ if (value == null) return this._style["align-content"];
644
+ this._style["align-content"] = value;
645
+ this._style["-ms-align-content"] = value;
646
+ this._style["-webkit-align-content"] = value;
647
+ this._style["-moz-align-content"] = value;
648
+ return this;
649
+ }
650
+
651
+ background_size(): string | undefined;
652
+ background_size(value: string): this;
653
+ background_size(value?: string): this | string | undefined {
654
+ if (value == null) return this._style["background-size"];
655
+ this._style["background-size"] = value;
656
+ this._style["-ms-background-size"] = value;
657
+ this._style["-webkit-background-size"] = value;
658
+ this._style["-moz-background-size"] = value;
659
+ return this;
660
+ }
661
+
662
+ box_sizing(): string | undefined;
663
+ box_sizing(value: string): this;
664
+ box_sizing(value?: string): this | string | undefined {
665
+ if (value == null) return this._style["box-sizing"];
666
+ this._style["box-sizing"] = value;
667
+ this._style["-ms-box-sizing"] = value;
668
+ this._style["-webkit-box-sizing"] = value;
669
+ this._style["-moz-box-sizing"] = value;
670
+ return this;
671
+ }
672
+
673
+ flex(): string | undefined;
674
+ flex(value: string): this;
675
+ flex(value?: string): this | string | undefined {
676
+ if (value == null) return this._style["flex"];
677
+ this._style["flex"] = value;
678
+ this._style["-ms-flex"] = value;
679
+ this._style["-webkit-flex"] = value;
680
+ this._style["-moz-flex"] = value;
681
+ return this;
682
+ }
683
+
684
+ flex_grow(): string | undefined;
685
+ flex_grow(value: string): this;
686
+ flex_grow(value?: string): this | string | undefined {
687
+ if (value == null) return this._style["flex-grow"];
688
+ this._style["flex-grow"] = value;
689
+ this._style["-ms-flex-grow"] = value;
690
+ this._style["-webkit-flex-grow"] = value;
691
+ this._style["-moz-flex-grow"] = value;
692
+ return this;
693
+ }
694
+
695
+ flex_shrink(): string | undefined;
696
+ flex_shrink(value: string): this;
697
+ flex_shrink(value?: string): this | string | undefined {
698
+ if (value == null) return this._style["flex-shrink"];
699
+ this._style["flex-shrink"] = value;
700
+ this._style["-ms-flex-shrink"] = value;
701
+ this._style["-webkit-flex-shrink"] = value;
702
+ this._style["-moz-flex-shrink"] = value;
703
+ return this;
704
+ }
705
+
706
+ justify_content(): string | undefined;
707
+ justify_content(value: string): this;
708
+ justify_content(value?: string): this | string | undefined {
709
+ if (value == null) return this._style["justify-content"];
710
+ this._style["justify-content"] = value;
711
+ this._style["-ms-justify-content"] = value;
712
+ this._style["-webkit-justify-content"] = value;
713
+ this._style["-moz-justify-content"] = value;
714
+ return this;
715
+ }
716
+
717
+ mask(): string | undefined;
718
+ mask(value: string): this;
719
+ mask(value?: string): this | string | undefined {
720
+ if (value == null) return this._style["mask"];
721
+ this._style["mask"] = value;
722
+ this._style["-ms-mask"] = value;
723
+ this._style["-webkit-mask"] = value;
724
+ this._style["-moz-mask"] = value;
725
+ return this;
726
+ }
727
+
728
+ user_select(): string | undefined;
729
+ user_select(value: string): this;
730
+ user_select(value?: string): this | string | undefined {
731
+ if (value == null) return this._style["user-select"];
732
+ this._style["user-select"] = value;
733
+ this._style["-ms-user-select"] = value;
734
+ this._style["-webkit-user-select"] = value;
735
+ this._style["-moz-user-select"] = value;
736
+ return this;
737
+ }
738
+
739
+ // ---------------------------------------------------------
740
+ // Edit the element.
741
+
742
+ // Style the element.
743
+ styles(styles: Record<string, string>): this {
744
+ Object.keys(styles).forEach((key) => {
745
+ this._style[key] = styles[key];
746
+ });
747
+ return this;
748
+ }
749
+
750
+ // Add attributes to the element.
751
+ attrs(attrs: Record<string, string>): this {
752
+ Object.keys(attrs).forEach((key) => {
753
+ this._attrs[key] = attrs[key];
754
+ });
755
+ return this;
756
+ }
757
+
758
+ // Add events to the element.
759
+ events(events: Record<string, (event: Event) => void>): this {
760
+ Object.keys(events).forEach((key) => {
761
+ this._attrs[key] = events[key] as unknown as string;
762
+ });
763
+ return this;
764
+ }
765
+
766
+ // Add class.
767
+ add_class(name: string): this {
768
+ if (this.classes.includes(name) === false) {
769
+ this.classes.push(name);
770
+ }
771
+ return this;
772
+ }
773
+
774
+ // Remove class.
775
+ remove_class(name: string): this {
776
+ this.classes = this.classes.filter((cls) => cls !== name);
777
+ return this;
778
+ }
779
+
780
+ // Append a child.
781
+ append(...children: (Element | any[] | Function | none)[]): this {
782
+ children.forEach((child) => {
783
+ // Skip undefined.
784
+ if (child == null) {
785
+ return;
786
+ }
787
+ // Array.
788
+ else if (Array.isArray(child)) {
789
+ this.append(...child);
790
+ }
791
+ // Execute function.
792
+ else if (typeof child === "function") {
793
+ this.append(child(this));
794
+ }
795
+ // Default.
796
+ else {
797
+ this.children.push(child);
798
+ }
799
+ });
800
+ return this;
801
+ }
802
+
803
+ // Inner html.
804
+ inner_html(): string | null;
805
+ inner_html(value: string): this;
806
+ inner_html(value?: string): this | string | null {
807
+ if (value == null) { return this._inner_html; }
808
+ this._inner_html = value;
809
+ return this;
810
+ }
811
+
812
+ // ---------------------------------------------------------
813
+ // Styling.
814
+
815
+ // Center the data.
816
+ center(): this {
817
+ switch (this.tag) {
818
+ case "table": case "tr": case "td":
819
+ this._attrs["align"] = "center";
820
+ return this;
821
+ default:
822
+ this._style["text-align"] = "center";
823
+ return this;
824
+ }
825
+ }
826
+
827
+ // Padding, 1 or 4 args.
828
+ padding(): string;
829
+ padding(value: string | number): this;
830
+ padding(top_bottom: string | number, left_right: string | number): this;
831
+ padding(top: string | number, right: string | number, bottom: string | number, left: string | number): this;
832
+ padding(...values: (string | number)[]): string | this {
833
+ if (values.length === 0) {
834
+ return this._style.padding;
835
+ } else if (values.length === 1) {
836
+ this._style.padding = this.pad_numeric(values[0]!);
837
+ } else if (values.length === 2) {
838
+ if (values[0] != null) {
839
+ this._style["padding-top"] = this.pad_numeric(values[0]!);
840
+ }
841
+ if (values[1] != null) {
842
+ this._style["padding-right"] = this.pad_numeric(values[1]!);
843
+ }
844
+ if (values[0] != null) {
845
+ this._style["padding-bottom"] = this.pad_numeric(values[0]!);
846
+ }
847
+ if (values[1] != null) {
848
+ this._style["padding-left"] = this.pad_numeric(values[1]!);
849
+ }
850
+ } else if (values.length === 4) {
851
+ this._style["padding-top"] = this.pad_numeric(values[0]!);
852
+ if (values[1] != null) {
853
+ this._style["padding-right"] = this.pad_numeric(values[1]!);
854
+ }
855
+ if (values[2] != null) {
856
+ this._style["padding-bottom"] = this.pad_numeric(values[2]!);
857
+ }
858
+ if (values[3] != null) {
859
+ this._style["padding-left"] = this.pad_numeric(values[3]!);
860
+ }
861
+ } else {
862
+ console.error("Invalid number of arguments for function \"padding()\".");
863
+ }
864
+ return this;
865
+ }
866
+
867
+ // Margin, 1 or 4 args.
868
+ margin(): string | undefined;
869
+ margin(value: string | number): this;
870
+ margin(value: none | string | number, value2: none | string | number): this;
871
+ margin(value: none | string | number, value2: none | string | number, value3: none | string | number, value4: none | string | number): this;
872
+ margin(...values: any[]): this | string | undefined {
873
+ if (values.length === 0) {
874
+ return this._style.margin;
875
+ } else if (values.length === 1) {
876
+ this._style.margin = this.pad_numeric(values[0]!);
877
+ } else if (values.length === 2) {
878
+ this._style["margin-top"] = this.pad_numeric(values[0]!);
879
+ if (values[1] != null) {
880
+ this._style["margin-left"] = this.pad_numeric(values[1]!);
881
+ }
882
+ if (values[0] != null) {
883
+ this._style["margin-bottom"] = this.pad_numeric(values[0]!);
884
+ }
885
+ if (values[1] != null) {
886
+ this._style["margin-left"] = this.pad_numeric(values[1]!);
887
+ }
888
+ } else if (values.length === 4) {
889
+ this._style["margin-top"] = this.pad_numeric(values[0]!);
890
+ if (values[1] != null) {
891
+ this._style["margin-left"] = this.pad_numeric(values[1]!);
892
+ }
893
+ if (values[2] != null) {
894
+ this._style["margin-bottom"] = this.pad_numeric(values[2]!);
895
+ }
896
+ if (values[3] != null) {
897
+ this._style["margin-left"] = this.pad_numeric(values[3]!);
898
+ }
899
+ } else {
900
+ console.error("Invalid number of arguments for function \"margin()\".");
901
+ }
902
+ return this;
903
+ }
904
+
905
+ // Specify the width or height of the element
906
+ fixed_width(): string | undefined;
907
+ fixed_width(value: string | number): this;
908
+ fixed_width(value?: string | number): this | string | undefined {
909
+ if (value == null) { return this._style["min-width"]; }
910
+ value = this.pad_numeric(value);
911
+ this._style["width"] = value; // also required for for example image masks.
912
+ this._style["min-width"] = value;
913
+ this._style["max-width"] = value;
914
+ return this;
915
+ }
916
+ fixed_height(): string | undefined;
917
+ fixed_height(value: string | number): this;
918
+ fixed_height(value?: string | number): this | string | undefined {
919
+ if (value == null) { return this._style.height; }
920
+ value = this.pad_numeric(value);
921
+ this._style["height"] = value; // also required for for example image masks.
922
+ this._style["min-height"] = value;
923
+ this._style["max-height"] = value;
924
+ return this;
925
+ }
926
+
927
+ // Frame.
928
+ frame(width: string | number | undefined, height: string | number | undefined): this {
929
+ if (width != null) {
930
+ this.width(width);
931
+ }
932
+ if (height != null) {
933
+ this.height(height);
934
+ }
935
+ return this;
936
+ }
937
+ min_frame(width: string | number | undefined, height: string | number | undefined): this {
938
+ if (width != null) {
939
+ this.min_width(width);
940
+ }
941
+ if (height != null) {
942
+ this.min_height(height);
943
+ }
944
+ return this;
945
+ }
946
+ max_frame(width: string | number | undefined, height: string | number | undefined): this {
947
+ if (width != null) {
948
+ this.max_width(width);
949
+ }
950
+ if (height != null) {
951
+ this.max_height(height);
952
+ }
953
+ return this;
954
+ }
955
+ fixed_frame(width: string | number | undefined, height: string | number | undefined): this {
956
+ if (width != null) {
957
+ width = this.pad_numeric(width);
958
+ this._style.width = width; // also required for for example image masks.
959
+ this._style["min-width"] = width;
960
+ this._style["max-width"] = width;
961
+ }
962
+ if (height != null) {
963
+ height = this.pad_numeric(height);
964
+ this._style.height = height; // also required for for example image masks.
965
+ this._style["min-height"] = height;
966
+ this._style["max-height"] = height;
967
+ }
968
+ return this;
969
+ }
970
+
971
+ // Color.
972
+ color(): string | undefined;
973
+ color(value: string): this;
974
+ color(value?: string): this | string | undefined {
975
+ if (value == null) { return this._style.color; }
976
+ if (value.startsWith("linear-gradient(") || value.startsWith("radial-gradient(")) {
977
+ this._style["background-image"] = value;
978
+ this._style["background-clip"] = "text";
979
+ this._style["-webkit-background-clip"] = "text";
980
+ this._style.color = "transparent";
981
+ } else {
982
+ this._style.color = value;
983
+ }
984
+ return this;
985
+ }
986
+
987
+ // Border, 1 till 3 args.
988
+ border(): string | undefined;
989
+ border(a: string): this;
990
+ border(a: string | number, b: string | number): this;
991
+ border(a: string | number, b: string | number, c: string | number): this;
992
+ border(...values: (string | number)[]): this | string | undefined {
993
+ if (values.length === 0) {
994
+ return this._style.border;
995
+ } else if (values.length === 1) {
996
+ this._style.border = values[0].toString();
997
+ } else if (values.length === 2) {
998
+ this._style.border = `${this.pad_numeric(values[0])} solid ${values[1]}`;
999
+ } else if (values.length === 3) {
1000
+ this._style.border = `${this.pad_numeric(values[0])} ${values[1]} ${values[2]}`;
1001
+ } else {
1002
+ console.error("Invalid number of arguments for function \"border()\".");
1003
+ }
1004
+ return this;
1005
+ }
1006
+
1007
+ // Border radius.
1008
+ border_radius(): string | undefined;
1009
+ border_radius(value: string | number): this;
1010
+ border_radius(value?: string | number): this | string | undefined {
1011
+ if (value == null) { return this._style["border-radius"]; }
1012
+ const paddedValue = this.pad_numeric(value);
1013
+ this._style["border-radius"] = paddedValue;
1014
+ this._style["-ms-border-radius"] = paddedValue;
1015
+ this._style["-webkit-border-radius"] = paddedValue;
1016
+ this._style["-moz-border-radius"] = paddedValue;
1017
+ return this;
1018
+ }
1019
+
1020
+ // A shorthand property for all the background-* properties.
1021
+ background(): string | undefined;
1022
+ background(value: string): this;
1023
+ background(value?: string): this | string | undefined {
1024
+ if (value == null) { return this._style.background; }
1025
+ if (typeof value === "string" && (value.startsWith("linear-gradient") || value.startsWith("radial-gradient"))) {
1026
+ this._style.background = value;
1027
+ this._style["background-image"] = value;
1028
+ this._style["background-repeat"] = "no-repeat";
1029
+ this._style["background-size"] = "cover";
1030
+ } else {
1031
+ this._style.background = value;
1032
+ }
1033
+ return this;
1034
+ }
1035
+
1036
+ // Set text ellipsis overflow.
1037
+ ellipsis_overflow(): boolean | undefined;
1038
+ ellipsis_overflow(to: boolean): this;
1039
+ ellipsis_overflow(to: boolean | undefined = true): this | boolean | undefined {
1040
+ if (to == null) {
1041
+ return this._style["text-overflow"] === "ellipsis";
1042
+ } else if (to === true) {
1043
+ this._style["text-overflow"] = "ellipsis";
1044
+ this._style["white-space"] = "nowrap";
1045
+ this._style.overflow = "hidden";
1046
+ this._style["text-wrap"] = "wrap";
1047
+ this._style["overflow-wrap"] = "break-word";
1048
+ } else if (to === false) {
1049
+ this._style["text-overflow"] = "default";
1050
+ this._style["white-space"] = "default";
1051
+ this._style.overflow = "default";
1052
+ this._style["text-wrap"] = "default";
1053
+ this._style["overflow-wrap"] = "default";
1054
+ }
1055
+ return this;
1056
+ }
1057
+
1058
+ // ---------------------------------------------------------
1059
+ // Events.
1060
+
1061
+ // Script to be run when the element is being clicked
1062
+ on_click(): ((e: this, t: Event) => void) | undefined;
1063
+ on_click(callback: (e: this, t: Event) => void): this;
1064
+ on_click(callback?: (e: this, t: Event) => void): this | ((e: this, t: Event) => void) | undefined {
1065
+ if (callback == null) {
1066
+ return this._attrs.onclick as unknown as (e: this, t: Event) => void;
1067
+ }
1068
+ this._style.cursor = "pointer";
1069
+ const e = this;
1070
+ this._attrs.onclick = (t: Event) => {
1071
+ if (this._disabled !== true) {
1072
+ callback(e, t);
1073
+ }
1074
+ };
1075
+ return this;
1076
+ }
1077
+
1078
+ // ---------------------------------------------------------
1079
+ // Edit the mail object.
1080
+
1081
+ lang(): string | undefined;
1082
+ lang(value: string): this;
1083
+ lang(value?: string): this | string | undefined {
1084
+ if (value == null) { return this._lang; }
1085
+ this._lang = value;
1086
+ return this;
1087
+ }
1088
+ charset(): string | undefined;
1089
+ charset(value: string): this;
1090
+ charset(value?: string): this | string | undefined {
1091
+ if (value == null) { return this._charset; }
1092
+ this._charset = value;
1093
+ return this;
1094
+ }
1095
+ viewport(): string | undefined;
1096
+ viewport(value: string): this;
1097
+ viewport(value?: string): this | string | undefined {
1098
+ if (value == null) { return this._viewport; }
1099
+ this._viewport = value;
1100
+ return this;
1101
+ }
1102
+ title(): string | undefined;
1103
+ title(value: string): this;
1104
+ title(value?: string): this | string | undefined {
1105
+ if (value == null) { return this._title; }
1106
+ this._title = value;
1107
+ return this;
1108
+ }
1109
+ }
1110
+
1111
+ // Create a constructor wrapper.
1112
+ function wrapper<T extends new (...args: any[]) => any>(
1113
+ constructor: T
1114
+ ): <Extensions extends object = {}>(...args: ConstructorParameters<T>) => InstanceType<T> & Extensions {
1115
+ return <Extensions extends object = {}>(...args: ConstructorParameters<T>) => new constructor(...args) as InstanceType<T> & Extensions;
1116
+ }
1117
+
1118
+ // Create a shared null element mainly for typescript types.
1119
+ function create_null<T extends new (...args: any[]) => any>(target_class: T): <Extensions extends object = {}>() => InstanceType<T> & Extensions {
1120
+ let instance: T | undefined;
1121
+ return <Extensions extends object = {}>(): InstanceType<T> & Extensions => {
1122
+ if (instance === undefined) {
1123
+ instance = new target_class();
1124
+ }
1125
+ return instance as unknown as InstanceType<T> & Extensions;
1126
+ };
1127
+ }
1128
+
1129
+ // ---------------------------------------------------------
1130
+ // Title.
1131
+
1132
+ export class TitleElement extends Element {
1133
+
1134
+ // Constructor.
1135
+ constructor(text?: string) {
1136
+
1137
+ // Initialize base class.
1138
+ super({
1139
+ type: "Title",
1140
+ tag: "h1",
1141
+ default_style: {
1142
+ "margin": "0px 0px 0px 0px",
1143
+ "color": "inherit",
1144
+ "white-space": "wrap",
1145
+ "text-align": "inherit",
1146
+ "font-size": "26px",
1147
+ "line-height": "1.2em",
1148
+ },
1149
+ });
1150
+
1151
+ // Set text.
1152
+ if (text) { this._inner_html = text; }
1153
+ }
1154
+ }
1155
+ export const Title = wrapper(TitleElement);
1156
+ export const NullTitle = create_null(TitleElement);
1157
+
1158
+ // ---------------------------------------------------------
1159
+ // Subtitle.
1160
+
1161
+ export class SubtitleElement extends Element {
1162
+
1163
+ // Constructor.
1164
+ constructor(text?: string) {
1165
+
1166
+ // Initialize base class.
1167
+ super({
1168
+ type: "Subtitle",
1169
+ tag: "h2",
1170
+ default_style: {
1171
+ "margin": "0px",
1172
+ "color": "inherit",
1173
+ "white-space": "wrap",
1174
+ "text-align": "inherit",
1175
+ "font-size": "22px",
1176
+ "line-height": "1.2em",
1177
+ },
1178
+ });
1179
+
1180
+ // Set text.
1181
+ if (text) { this._inner_html = text; }
1182
+ }
1183
+ }
1184
+ export const Subtitle = wrapper(SubtitleElement);
1185
+ export const NullSubtitle = create_null(SubtitleElement);
1186
+
1187
+
1188
+ // ---------------------------------------------------------
1189
+ // Text.
1190
+
1191
+ export class TextElement extends Element {
1192
+
1193
+ // Constructor.
1194
+ constructor(text?: string) {
1195
+
1196
+ // Initialize base class.
1197
+ super({
1198
+ type: "Text",
1199
+ tag: "p",
1200
+ default_style: {
1201
+ "margin": "0px",
1202
+ "padding": "0px",
1203
+ "font-size": "18px",
1204
+ "line-height": "1.4em",
1205
+ "color": "inherit",
1206
+ "text-align": "inherit",
1207
+ "white-space": "wrap",
1208
+ },
1209
+ });
1210
+
1211
+ // Set text.
1212
+ if (text) { this._inner_html = text; }
1213
+ }
1214
+ }
1215
+ export const Text = wrapper(TextElement);
1216
+ export const NullText = create_null(TextElement);
1217
+
1218
+ // ---------------------------------------------------------
1219
+ // Image.
1220
+
1221
+ export class ImageElement extends Element {
1222
+
1223
+ // Constructor.
1224
+ constructor(src?: string) {
1225
+
1226
+ // Initialize base class.
1227
+ super({
1228
+ type: "Image",
1229
+ tag: "img",
1230
+ default_style: {
1231
+ "margin": "0px",
1232
+ "padding": "0px",
1233
+ "object-fit": "cover",
1234
+ },
1235
+ });
1236
+
1237
+ // Set src.
1238
+ if (src) { this._attrs.src = src; }
1239
+ }
1240
+ }
1241
+ export const Image = wrapper(ImageElement);
1242
+ export const NullImageElement = create_null(ImageElement);
1243
+
1244
+ // ---------------------------------------------------------
1245
+ // ImageMask.
1246
+
1247
+ export class ImageMaskElement extends Element {
1248
+ mask_child: VStackElement;
1249
+ _src?: string;
1250
+
1251
+ // Constructor.
1252
+ constructor(src?: string) {
1253
+
1254
+ // Initialize base class.
1255
+ super({
1256
+ type: "ImageMask",
1257
+ tag: "div",
1258
+ default_style: {
1259
+ "margin": "0px",
1260
+ "padding": "0px",
1261
+ "object-fit": "cover",
1262
+ "display": "inline-block",
1263
+ },
1264
+ });
1265
+
1266
+ // Append child.
1267
+ this.mask_child = VStack()
1268
+ .width("100%")
1269
+ .height("100%")
1270
+ .background("black");
1271
+ if (src != null) {
1272
+ this.mask_child.mask(`url('${src}') no-repeat center/contain`);
1273
+ }
1274
+ this.append(this.mask_child);
1275
+
1276
+ // Set src.
1277
+ if (src) { this.src(src); }
1278
+ }
1279
+
1280
+ // Image color.
1281
+ mask_color(): string | undefined;
1282
+ mask_color(value: string): this;
1283
+ mask_color(value?: string): this | string | undefined {
1284
+ if (value == null) {
1285
+ return this.mask_child._style.background;
1286
+ }
1287
+ this.mask_child._style.background = value;
1288
+ return this;
1289
+ }
1290
+
1291
+ // Override src.
1292
+ src(): string | undefined;
1293
+ src(value: string): this;
1294
+ src(value?: string): this | string | undefined {
1295
+ if (value == null) {
1296
+ return this._src;
1297
+ }
1298
+ this.mask_child.mask(`url('${value}') no-repeat center/contain`);
1299
+ this._src = value;
1300
+ return this;
1301
+ }
1302
+
1303
+ // Override mask.
1304
+ mask(): string | undefined;
1305
+ mask(value: string): this;
1306
+ mask(value?: string): this | string | undefined {
1307
+ if (value == null) {
1308
+ return this.mask_child.mask();
1309
+ }
1310
+ this.mask_child.mask(value);
1311
+ return this;
1312
+ }
1313
+ }
1314
+ export const ImageMask = wrapper(ImageMaskElement);
1315
+ export const NullImageMaskElement = create_null(ImageMaskElement);
1316
+
1317
+ // ---------------------------------------------------------
1318
+ // VStack.
1319
+
1320
+ export class VStackElement extends Element {
1321
+
1322
+ // Constructor.
1323
+ constructor(...children: any[]) {
1324
+
1325
+ // Initialize base class.
1326
+ super({
1327
+ type: "VStack",
1328
+ tag: "div",
1329
+ });
1330
+
1331
+ // Add children.
1332
+ this.append(...children);
1333
+
1334
+ }
1335
+ }
1336
+ export const VStack = wrapper(VStackElement);
1337
+ export const NullVStackElement = create_null(VStackElement);
1338
+
1339
+ // ---------------------------------------------------------
1340
+ // Divider.
1341
+
1342
+ export class DividerElement extends Element {
1343
+
1344
+ // Constructor.
1345
+ constructor(text?: string) {
1346
+
1347
+ // Initialize base class.
1348
+ super({
1349
+ type: "Divider",
1350
+ tag: "div",
1351
+ default_style: {
1352
+ "margin": "0px",
1353
+ "padding": "0px",
1354
+ "width": "100%",
1355
+ "height": "1px",
1356
+ "min-height": "1px",
1357
+ // "background": "black",
1358
+ },
1359
+ });
1360
+
1361
+ // Set text.
1362
+ if (text) { this._inner_html = text; }
1363
+ }
1364
+ }
1365
+ export const Divider = wrapper(DividerElement);
1366
+ export const NullDividerElement = create_null(DividerElement);
1367
+
1368
+ // ---------------------------------------------------------
1369
+ // Table data.
1370
+
1371
+ export class TableDataElement extends Element {
1372
+
1373
+ // Constructor.
1374
+ constructor(...children: any[]) {
1375
+
1376
+ // Initialize base class.
1377
+ super({
1378
+ type: "TableData",
1379
+ tag: "td",
1380
+ default_style: {
1381
+ "width": "100%",
1382
+ },
1383
+ default_attributes: {
1384
+ }
1385
+ });
1386
+
1387
+ // Add children.
1388
+ this.append(...children);
1389
+ }
1390
+
1391
+ // Center the data.
1392
+ center(): this {
1393
+ this.attrs({ align: "center" });
1394
+ return this;
1395
+ }
1396
+
1397
+ // Vertically center.
1398
+ center_vertical(): this {
1399
+ this._style["vertical-align"] = "middle";
1400
+ return this;
1401
+ }
1402
+ leading_vertical(): this {
1403
+ this._style["vertical-align"] = "top";
1404
+ return this;
1405
+ }
1406
+ trailing_vertical(): this {
1407
+ this._style["vertical-align"] = "bottom";
1408
+ return this;
1409
+ }
1410
+ }
1411
+ export const TableData = wrapper(TableDataElement);
1412
+ export const NullTableDataElement = create_null(TableDataElement);
1413
+
1414
+ // ---------------------------------------------------------
1415
+ // Table row.
1416
+
1417
+ export class TableRowElement extends Element {
1418
+ private current_cell!: TableDataElement;
1419
+ private _wrap: boolean = false;
1420
+
1421
+ // Constructor.
1422
+ constructor(...children: any[]) {
1423
+
1424
+ // Initialize base class.
1425
+ super({
1426
+ type: "TableRow",
1427
+ tag: "tr",
1428
+ default_style: {
1429
+ "width": "100%",
1430
+ },
1431
+ default_attributes: {
1432
+ }
1433
+ });
1434
+
1435
+ // Add children.
1436
+ this.append(...children);
1437
+ }
1438
+
1439
+ // Append.
1440
+ append(...children: any[]): this {
1441
+ for (let i = 0; i < children.length; i++) {
1442
+ const child = children[i];
1443
+
1444
+ // Skip undefined.
1445
+ if (child == null) {
1446
+ continue;
1447
+ }
1448
+
1449
+ // Array.
1450
+ else if (Array.isArray(child)) {
1451
+ this.append(...child);
1452
+ }
1453
+
1454
+ // Execute function.
1455
+ else if (typeof child === "function") {
1456
+ this.append(child(this));
1457
+ }
1458
+
1459
+ // Table data.
1460
+ else if (child instanceof TableDataElement) {
1461
+ this.current_cell = child;
1462
+ this.children.push(child);
1463
+ }
1464
+
1465
+ // Default.
1466
+ else {
1467
+ if (this.current_cell == null) {
1468
+ this.current_cell = TableData();
1469
+ this.children.push(this.current_cell);
1470
+ if (this._attrs["align"] === "center") {
1471
+ this.current_cell.attrs({ align: "center" });
1472
+ }
1473
+ if (this._style["vertical-align"] === "middle") {
1474
+ this.current_cell._style["align"] = "middle";
1475
+ }
1476
+ }
1477
+ if ((child._style.display == null || child._style.display === "") && this._wrap === true) {
1478
+ if (child.tag === "p" || child.tag === "h1" || child.tag === "h2") {
1479
+ child._style.display = "inline";
1480
+ } else {
1481
+ child._style.display = "inline-block";
1482
+ }
1483
+ }
1484
+ this.current_cell.append(child);
1485
+ }
1486
+ }
1487
+ return this;
1488
+ }
1489
+
1490
+ // Wrap side by side.
1491
+ wrap(): boolean;
1492
+ wrap(value: boolean): this;
1493
+ wrap(value?: boolean): this | boolean {
1494
+ if (value == null) { return this._wrap; }
1495
+ this._wrap = value;
1496
+ const set_display_inline = (child: any) => {
1497
+ if (child instanceof TableDataElement) {
1498
+ child.children.forEach(set_display_inline);
1499
+ } else {
1500
+ if ((child._style.display == null || child._style.display === "") && this._wrap === true) {
1501
+ if (child.tag === "p" || child.tag === "h1" || child.tag === "h2") {
1502
+ child._style.display = "inline";
1503
+ } else {
1504
+ child._style.display = "inline-block";
1505
+ }
1506
+ }
1507
+ else if ((child._style.display === "inline" || child._style.display === "inline-block") && this._wrap === false) {
1508
+ child._style.display = "default";
1509
+ }
1510
+ }
1511
+ };
1512
+ this.children.forEach(set_display_inline);
1513
+ return this;
1514
+ }
1515
+
1516
+ // Center.
1517
+ center(): this {
1518
+ this._attrs["align"] = "center";
1519
+ this.children.forEach((child) => {
1520
+ if (child instanceof TableDataElement) {
1521
+ child.attrs({ align: "center" });
1522
+ }
1523
+ });
1524
+ return this;
1525
+ }
1526
+
1527
+ // Vertically center.
1528
+ center_vertical(): this {
1529
+ this._style["vertical-align"] = "middle";
1530
+ this.children.forEach((child) => {
1531
+ child._style["vertical-align"] = "middle";
1532
+ if (child instanceof TableDataElement) {
1533
+ child.children.forEach((nested: any) => {
1534
+ nested._style["vertical-align"] = "middle";
1535
+ });
1536
+ }
1537
+ });
1538
+ return this;
1539
+ }
1540
+ leading_vertical(): this {
1541
+ this._style["vertical-align"] = "top";
1542
+ this.children.forEach((child) => {
1543
+ child._style["vertical-align"] = "top";
1544
+ if (child instanceof TableDataElement) {
1545
+ child.children.forEach((nested: any) => {
1546
+ nested._style["vertical-align"] = "top";
1547
+ });
1548
+ }
1549
+ });
1550
+ return this;
1551
+ }
1552
+ trailing_vertical(): this {
1553
+ this._style["vertical-align"] = "bottom";
1554
+ this.children.forEach((child) => {
1555
+ child._style["vertical-align"] = "bottom";
1556
+ if (child instanceof TableDataElement) {
1557
+ child.children.forEach((nested: any) => {
1558
+ nested._style["vertical-align"] = "bottom";
1559
+ });
1560
+ }
1561
+ });
1562
+ return this;
1563
+ }
1564
+ }
1565
+ export const TableRow = wrapper(TableRowElement);
1566
+ export const NullTableRowElement = create_null(TableRowElement);
1567
+
1568
+ // ---------------------------------------------------------
1569
+ // Table, automatically inserts table rows and optionally table data's when the appended object is not already a table data.
1570
+
1571
+ export class TableElement extends Element {
1572
+ public current_cell?: TableDataElement;
1573
+ public current_row: TableRowElement;
1574
+
1575
+ // Constructor.
1576
+ constructor(...children: any[]) {
1577
+
1578
+ // Initialize base class.
1579
+ super({
1580
+ type: "Stack",
1581
+ tag: "table",
1582
+ default_style: {
1583
+ "width": "100%",
1584
+ },
1585
+ default_attributes: {
1586
+ "cellspacing": "0",
1587
+ "cellpadding": "0",
1588
+ "border": "0" ,
1589
+ }
1590
+ });
1591
+
1592
+ // Add children.
1593
+ this.current_row = TableRow();
1594
+ this.children.append(this.current_row);
1595
+ this.append(...children);
1596
+ }
1597
+
1598
+ // Add a row.
1599
+ row(...children: any[]): this {
1600
+ this.current_row = TableRow();
1601
+ this.children.push(this.current_row);
1602
+ this.current_cell = undefined;
1603
+ this.append(...children);
1604
+ return this;
1605
+ }
1606
+
1607
+ // Append.
1608
+ append(...children: any[]): this {
1609
+ for (let i = 0; i < children.length; i++) {
1610
+ const child = children[i];
1611
+
1612
+ // Skip undefined.
1613
+ if (child == null) {
1614
+ continue;
1615
+ }
1616
+
1617
+ // Array.
1618
+ else if (Array.isArray(child)) {
1619
+ this.append(...child);
1620
+ }
1621
+
1622
+ // Execute function.
1623
+ else if (typeof child === "function") {
1624
+ this.append(child(this));
1625
+ }
1626
+
1627
+ // Table row.
1628
+ else if (child instanceof TableRowElement) {
1629
+ this.current_row = child;
1630
+ this.children.push(child);
1631
+ }
1632
+
1633
+ // Default.
1634
+ else {
1635
+ if (this.current_row == null) {
1636
+ this.current_row = TableRow();
1637
+ this.children.push(this.current_row);
1638
+ }
1639
+ this.current_row.append(child);
1640
+ }
1641
+ }
1642
+ return this;
1643
+ }
1644
+ }
1645
+ export const Table = wrapper(TableElement);
1646
+ export const NullTableElement = create_null(TableElement);
1647
+
1648
+ // ---------------------------------------------------------
1649
+ // CSS.
1650
+
1651
+ export class CSSElement extends Element {
1652
+
1653
+ // Constructor.
1654
+ constructor(style?: string) {
1655
+
1656
+ // Initialize base class.
1657
+ super({
1658
+ type: "CSS",
1659
+ tag: "style",
1660
+ });
1661
+
1662
+ // Add inner html.
1663
+ if (style) { this._inner_html = style; }
1664
+ }
1665
+ }
1666
+ export const CSS = wrapper(CSSElement);
1667
+ export const NullCSSElement = create_null(CSSElement);
1668
+
1669
+ // ---------------------------------------------------------
1670
+ // Mail.
1671
+
1672
+ export class MailElement extends Element {
1673
+ private _subject?: string;
1674
+
1675
+ // Constructor.
1676
+ constructor(...children: any[]) {
1677
+
1678
+ // Initialize base class.
1679
+ super({
1680
+ type: "Mail",
1681
+ tag: "mail",
1682
+ default_style: {
1683
+ "width": "100% !important",
1684
+ "min-height": "100% !important",
1685
+ "box-sizing": "border-box",
1686
+ "padding": "0px", // this is required, sometimes it glitches and makes it scrolling without zero padding.
1687
+ "margin": "0px",
1688
+ },
1689
+ });
1690
+
1691
+ // Add children.
1692
+ this.append(...children);
1693
+ }
1694
+
1695
+ // Set the mail's subject.
1696
+ subject(): string | undefined;
1697
+ subject(subj: string): this;
1698
+ subject(subj?: string): this | string | undefined {
1699
+ if (subj == null) {
1700
+ return this._subject
1701
+ }
1702
+ this._subject = subj
1703
+ return this
1704
+ }
1705
+ }
1706
+ export const Mail = wrapper(MailElement);
1707
+ export const NullMailElement = create_null(MailElement);
1708
+
1709
+
1710
+
1711
+
1712
+
1713
+
1714
+
1715
+
1716
+
1717
+
1718
+
1719
+
1720
+