@vandenberghinc/volt 1.2.5 → 1.2.6

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 (489) hide show
  1. package/frontend/assets/admin/admin.png +0 -0
  2. package/frontend/assets/admin/password.webp +0 -0
  3. package/frontend/assets/icons/arrow.v1.webp +0 -0
  4. package/frontend/assets/icons/copy.webp +0 -0
  5. package/frontend/assets/payments/arrow.long.webp +0 -0
  6. package/frontend/assets/payments/arrow.long2.webp +0 -0
  7. package/frontend/assets/payments/cancelled.webp +0 -0
  8. package/frontend/assets/payments/check.sign.webp +0 -0
  9. package/frontend/assets/payments/check.webp +0 -0
  10. package/frontend/assets/payments/close.webp +0 -0
  11. package/frontend/assets/payments/error.webp +0 -0
  12. package/frontend/assets/payments/exclamation.webp +0 -0
  13. package/frontend/assets/payments/minus.webp +0 -0
  14. package/frontend/assets/payments/party.webp +0 -0
  15. package/frontend/assets/payments/plus.webp +0 -0
  16. package/frontend/assets/payments/shopping_cart.webp +0 -0
  17. package/frontend/assets/payments/trash.webp +0 -0
  18. package/package.json +5 -1
  19. package/.libris/config.json +0 -82
  20. package/backend/dist/cjs/backend/src/blacklist.d.ts +0 -12
  21. package/backend/dist/cjs/backend/src/blacklist.js +0 -78
  22. package/backend/dist/cjs/backend/src/cli.d.ts +0 -2
  23. package/backend/dist/cjs/backend/src/cli.js +0 -198
  24. package/backend/dist/cjs/backend/src/database/collection.d.ts +0 -1765
  25. package/backend/dist/cjs/backend/src/database/collection.js +0 -3301
  26. package/backend/dist/cjs/backend/src/database/database.d.ts +0 -92
  27. package/backend/dist/cjs/backend/src/database/database.js +0 -170
  28. package/backend/dist/cjs/backend/src/database/document.d.ts +0 -1
  29. package/backend/dist/cjs/backend/src/database/document.js +0 -15
  30. package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +0 -6
  31. package/backend/dist/cjs/backend/src/database/filters/filters.js +0 -15
  32. package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +0 -223
  33. package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +0 -15
  34. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.d.ts +0 -1
  35. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +0 -443
  36. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.d.ts +0 -1
  37. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +0 -15
  38. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +0 -50
  39. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +0 -15
  40. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +0 -76
  41. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +0 -15
  42. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +0 -75
  43. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +0 -15
  44. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +0 -219
  45. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +0 -15
  46. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +0 -165
  47. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +0 -15
  48. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +0 -5
  49. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +0 -355
  50. package/backend/dist/cjs/backend/src/database/flatten.d.ts +0 -78
  51. package/backend/dist/cjs/backend/src/database/flatten.js +0 -53
  52. package/backend/dist/cjs/backend/src/database/flatten_test.d.ts +0 -1
  53. package/backend/dist/cjs/backend/src/database/flatten_test.js +0 -175
  54. package/backend/dist/cjs/backend/src/database/quota/quoata_v2.d.ts +0 -533
  55. package/backend/dist/cjs/backend/src/database/quota/quoata_v2.js +0 -1046
  56. package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +0 -551
  57. package/backend/dist/cjs/backend/src/database/quota/quota.js +0 -1108
  58. package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +0 -534
  59. package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +0 -1087
  60. package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +0 -412
  61. package/backend/dist/cjs/backend/src/database/quota/safe_int.js +0 -745
  62. package/backend/dist/cjs/backend/src/endpoint.d.ts +0 -346
  63. package/backend/dist/cjs/backend/src/endpoint.js +0 -468
  64. package/backend/dist/cjs/backend/src/errors/index.d.ts +0 -7
  65. package/backend/dist/cjs/backend/src/errors/index.js +0 -25
  66. package/backend/dist/cjs/backend/src/errors/internal_external.d.ts +0 -52
  67. package/backend/dist/cjs/backend/src/errors/internal_external.js +0 -95
  68. package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +0 -41
  69. package/backend/dist/cjs/backend/src/errors/invalid_usage_error.js +0 -47
  70. package/backend/dist/cjs/backend/src/errors/system_error.d.ts +0 -261
  71. package/backend/dist/cjs/backend/src/errors/system_error.js +0 -436
  72. package/backend/dist/cjs/backend/src/events.d.ts +0 -97
  73. package/backend/dist/cjs/backend/src/events.js +0 -15
  74. package/backend/dist/cjs/backend/src/frontend.d.ts +0 -11
  75. package/backend/dist/cjs/backend/src/frontend.js +0 -37
  76. package/backend/dist/cjs/backend/src/image_endpoint.d.ts +0 -44
  77. package/backend/dist/cjs/backend/src/image_endpoint.js +0 -185
  78. package/backend/dist/cjs/backend/src/index.d.ts +0 -23
  79. package/backend/dist/cjs/backend/src/index.js +0 -70
  80. package/backend/dist/cjs/backend/src/logger.d.ts +0 -5
  81. package/backend/dist/cjs/backend/src/logger.js +0 -15
  82. package/backend/dist/cjs/backend/src/meta.d.ts +0 -112
  83. package/backend/dist/cjs/backend/src/meta.js +0 -181
  84. package/backend/dist/cjs/backend/src/payments/paddle.d.ts +0 -329
  85. package/backend/dist/cjs/backend/src/payments/paddle.js +0 -1996
  86. package/backend/dist/cjs/backend/src/payments/stripe/checkout.d.ts +0 -113
  87. package/backend/dist/cjs/backend/src/payments/stripe/checkout.js +0 -295
  88. package/backend/dist/cjs/backend/src/payments/stripe/customers.d.ts +0 -17
  89. package/backend/dist/cjs/backend/src/payments/stripe/customers.js +0 -164
  90. package/backend/dist/cjs/backend/src/payments/stripe/error.d.ts +0 -74
  91. package/backend/dist/cjs/backend/src/payments/stripe/error.js +0 -64
  92. package/backend/dist/cjs/backend/src/payments/stripe/events.d.ts +0 -155
  93. package/backend/dist/cjs/backend/src/payments/stripe/events.js +0 -15
  94. package/backend/dist/cjs/backend/src/payments/stripe/meters.d.ts +0 -105
  95. package/backend/dist/cjs/backend/src/payments/stripe/meters.js +0 -230
  96. package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.d.ts +0 -58
  97. package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.js +0 -109
  98. package/backend/dist/cjs/backend/src/payments/stripe/products.d.ts +0 -519
  99. package/backend/dist/cjs/backend/src/payments/stripe/products.js +0 -650
  100. package/backend/dist/cjs/backend/src/payments/stripe/stripe.d.ts +0 -215
  101. package/backend/dist/cjs/backend/src/payments/stripe/stripe.js +0 -468
  102. package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.d.ts +0 -172
  103. package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.js +0 -557
  104. package/backend/dist/cjs/backend/src/payments/stripe/utils.d.ts +0 -63
  105. package/backend/dist/cjs/backend/src/payments/stripe/utils.js +0 -118
  106. package/backend/dist/cjs/backend/src/payments/stripe/webhooks.d.ts +0 -105
  107. package/backend/dist/cjs/backend/src/payments/stripe/webhooks.js +0 -627
  108. package/backend/dist/cjs/backend/src/plugins/browser.d.ts +0 -1
  109. package/backend/dist/cjs/backend/src/plugins/browser.js +0 -15
  110. package/backend/dist/cjs/backend/src/plugins/communication.d.ts +0 -70
  111. package/backend/dist/cjs/backend/src/plugins/communication.js +0 -196
  112. package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +0 -255
  113. package/backend/dist/cjs/backend/src/plugins/mail/mail.js +0 -381
  114. package/backend/dist/cjs/backend/src/plugins/mail/ui.d.ts +0 -297
  115. package/backend/dist/cjs/backend/src/plugins/mail/ui.js +0 -1370
  116. package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +0 -1
  117. package/backend/dist/cjs/backend/src/plugins/pdf.js +0 -1456
  118. package/backend/dist/cjs/backend/src/plugins/thread_monitor.d.ts +0 -18
  119. package/backend/dist/cjs/backend/src/plugins/thread_monitor.js +0 -116
  120. package/backend/dist/cjs/backend/src/rate_limit.d.ts +0 -148
  121. package/backend/dist/cjs/backend/src/rate_limit.js +0 -543
  122. package/backend/dist/cjs/backend/src/route.d.ts +0 -39
  123. package/backend/dist/cjs/backend/src/route.js +0 -172
  124. package/backend/dist/cjs/backend/src/server.d.ts +0 -502
  125. package/backend/dist/cjs/backend/src/server.js +0 -1713
  126. package/backend/dist/cjs/backend/src/server.old.d.ts +0 -594
  127. package/backend/dist/cjs/backend/src/server.old.js +0 -2058
  128. package/backend/dist/cjs/backend/src/splash_screen.d.ts +0 -93
  129. package/backend/dist/cjs/backend/src/splash_screen.js +0 -119
  130. package/backend/dist/cjs/backend/src/status.d.ts +0 -89
  131. package/backend/dist/cjs/backend/src/status.js +0 -211
  132. package/backend/dist/cjs/backend/src/stream.d.ts +0 -494
  133. package/backend/dist/cjs/backend/src/stream.js +0 -1370
  134. package/backend/dist/cjs/backend/src/users.d.ts +0 -926
  135. package/backend/dist/cjs/backend/src/users.js +0 -2223
  136. package/backend/dist/cjs/backend/src/utils.d.ts +0 -22
  137. package/backend/dist/cjs/backend/src/utils.js +0 -626
  138. package/backend/dist/cjs/backend/src/view.d.ts +0 -115
  139. package/backend/dist/cjs/backend/src/view.js +0 -519
  140. package/backend/dist/cjs/backend/src/vinc.d.ts +0 -6
  141. package/backend/dist/cjs/backend/src/vinc.js +0 -40
  142. package/backend/dist/cjs/backend/src/volt.d.ts +0 -24
  143. package/backend/dist/cjs/backend/src/volt.js +0 -72
  144. package/backend/dist/cjs/frontend/src/modules/request.d.ts +0 -70
  145. package/backend/dist/cjs/frontend/src/modules/request.js +0 -99
  146. package/backend/dist/cjs/package.json +0 -1
  147. package/backend/dist/esm/backend/src/blacklist.d.ts +0 -12
  148. package/backend/dist/esm/backend/src/blacklist.js +0 -52
  149. package/backend/dist/esm/backend/src/cli.d.ts +0 -2
  150. package/backend/dist/esm/backend/src/cli.js +0 -211
  151. package/backend/dist/esm/backend/src/database/collection.d.ts +0 -1765
  152. package/backend/dist/esm/backend/src/database/collection.js +0 -3779
  153. package/backend/dist/esm/backend/src/database/database.d.ts +0 -92
  154. package/backend/dist/esm/backend/src/database/database.js +0 -214
  155. package/backend/dist/esm/backend/src/database/document.d.ts +0 -1
  156. package/backend/dist/esm/backend/src/database/document.js +0 -558
  157. package/backend/dist/esm/backend/src/database/filters/filters.d.ts +0 -6
  158. package/backend/dist/esm/backend/src/database/filters/filters.js +0 -1
  159. package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +0 -223
  160. package/backend/dist/esm/backend/src/database/filters/strict_filter.js +0 -3
  161. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +0 -1
  162. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +0 -505
  163. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +0 -1
  164. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +0 -712
  165. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +0 -50
  166. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +0 -5
  167. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +0 -76
  168. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +0 -44
  169. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +0 -75
  170. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +0 -5
  171. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +0 -219
  172. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +0 -1
  173. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +0 -165
  174. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +0 -5
  175. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +0 -5
  176. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +0 -415
  177. package/backend/dist/esm/backend/src/database/flatten.d.ts +0 -78
  178. package/backend/dist/esm/backend/src/database/flatten.js +0 -22
  179. package/backend/dist/esm/backend/src/database/flatten_test.d.ts +0 -1
  180. package/backend/dist/esm/backend/src/database/flatten_test.js +0 -174
  181. package/backend/dist/esm/backend/src/database/quota/quoata_v2.d.ts +0 -533
  182. package/backend/dist/esm/backend/src/database/quota/quoata_v2.js +0 -1155
  183. package/backend/dist/esm/backend/src/database/quota/quota.d.ts +0 -551
  184. package/backend/dist/esm/backend/src/database/quota/quota.js +0 -1219
  185. package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +0 -534
  186. package/backend/dist/esm/backend/src/database/quota/quota_v1.js +0 -1242
  187. package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +0 -412
  188. package/backend/dist/esm/backend/src/database/quota/safe_int.js +0 -810
  189. package/backend/dist/esm/backend/src/endpoint.d.ts +0 -346
  190. package/backend/dist/esm/backend/src/endpoint.js +0 -479
  191. package/backend/dist/esm/backend/src/errors/index.d.ts +0 -7
  192. package/backend/dist/esm/backend/src/errors/index.js +0 -7
  193. package/backend/dist/esm/backend/src/errors/internal_external.d.ts +0 -52
  194. package/backend/dist/esm/backend/src/errors/internal_external.js +0 -86
  195. package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +0 -41
  196. package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +0 -33
  197. package/backend/dist/esm/backend/src/errors/system_error.d.ts +0 -261
  198. package/backend/dist/esm/backend/src/errors/system_error.js +0 -444
  199. package/backend/dist/esm/backend/src/events.d.ts +0 -97
  200. package/backend/dist/esm/backend/src/events.js +0 -5
  201. package/backend/dist/esm/backend/src/frontend.d.ts +0 -11
  202. package/backend/dist/esm/backend/src/frontend.js +0 -12
  203. package/backend/dist/esm/backend/src/image_endpoint.d.ts +0 -44
  204. package/backend/dist/esm/backend/src/image_endpoint.js +0 -196
  205. package/backend/dist/esm/backend/src/index.d.ts +0 -23
  206. package/backend/dist/esm/backend/src/index.js +0 -26
  207. package/backend/dist/esm/backend/src/logger.d.ts +0 -5
  208. package/backend/dist/esm/backend/src/logger.js +0 -8
  209. package/backend/dist/esm/backend/src/meta.d.ts +0 -112
  210. package/backend/dist/esm/backend/src/meta.js +0 -152
  211. package/backend/dist/esm/backend/src/payments/paddle.d.ts +0 -329
  212. package/backend/dist/esm/backend/src/payments/paddle.js +0 -2276
  213. package/backend/dist/esm/backend/src/payments/stripe/checkout.d.ts +0 -113
  214. package/backend/dist/esm/backend/src/payments/stripe/checkout.js +0 -356
  215. package/backend/dist/esm/backend/src/payments/stripe/customers.d.ts +0 -17
  216. package/backend/dist/esm/backend/src/payments/stripe/customers.js +0 -193
  217. package/backend/dist/esm/backend/src/payments/stripe/error.d.ts +0 -74
  218. package/backend/dist/esm/backend/src/payments/stripe/error.js +0 -51
  219. package/backend/dist/esm/backend/src/payments/stripe/events.d.ts +0 -155
  220. package/backend/dist/esm/backend/src/payments/stripe/events.js +0 -5
  221. package/backend/dist/esm/backend/src/payments/stripe/meters.d.ts +0 -105
  222. package/backend/dist/esm/backend/src/payments/stripe/meters.js +0 -318
  223. package/backend/dist/esm/backend/src/payments/stripe/payment_methods.d.ts +0 -58
  224. package/backend/dist/esm/backend/src/payments/stripe/payment_methods.js +0 -135
  225. package/backend/dist/esm/backend/src/payments/stripe/products.d.ts +0 -519
  226. package/backend/dist/esm/backend/src/payments/stripe/products.js +0 -896
  227. package/backend/dist/esm/backend/src/payments/stripe/stripe.d.ts +0 -215
  228. package/backend/dist/esm/backend/src/payments/stripe/stripe.js +0 -464
  229. package/backend/dist/esm/backend/src/payments/stripe/subscriptions.d.ts +0 -172
  230. package/backend/dist/esm/backend/src/payments/stripe/subscriptions.js +0 -754
  231. package/backend/dist/esm/backend/src/payments/stripe/utils.d.ts +0 -63
  232. package/backend/dist/esm/backend/src/payments/stripe/utils.js +0 -131
  233. package/backend/dist/esm/backend/src/payments/stripe/webhooks.d.ts +0 -105
  234. package/backend/dist/esm/backend/src/payments/stripe/webhooks.js +0 -752
  235. package/backend/dist/esm/backend/src/plugins/browser.d.ts +0 -1
  236. package/backend/dist/esm/backend/src/plugins/browser.js +0 -170
  237. package/backend/dist/esm/backend/src/plugins/communication.d.ts +0 -70
  238. package/backend/dist/esm/backend/src/plugins/communication.js +0 -169
  239. package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +0 -255
  240. package/backend/dist/esm/backend/src/plugins/mail/mail.js +0 -396
  241. package/backend/dist/esm/backend/src/plugins/mail/ui.d.ts +0 -297
  242. package/backend/dist/esm/backend/src/plugins/mail/ui.js +0 -1400
  243. package/backend/dist/esm/backend/src/plugins/pdf.d.ts +0 -1
  244. package/backend/dist/esm/backend/src/plugins/pdf.js +0 -1694
  245. package/backend/dist/esm/backend/src/plugins/thread_monitor.d.ts +0 -18
  246. package/backend/dist/esm/backend/src/plugins/thread_monitor.js +0 -120
  247. package/backend/dist/esm/backend/src/rate_limit.d.ts +0 -148
  248. package/backend/dist/esm/backend/src/rate_limit.js +0 -667
  249. package/backend/dist/esm/backend/src/route.d.ts +0 -39
  250. package/backend/dist/esm/backend/src/route.js +0 -222
  251. package/backend/dist/esm/backend/src/server.d.ts +0 -502
  252. package/backend/dist/esm/backend/src/server.js +0 -2034
  253. package/backend/dist/esm/backend/src/server.old.d.ts +0 -594
  254. package/backend/dist/esm/backend/src/server.old.js +0 -2630
  255. package/backend/dist/esm/backend/src/splash_screen.d.ts +0 -93
  256. package/backend/dist/esm/backend/src/splash_screen.js +0 -156
  257. package/backend/dist/esm/backend/src/status.d.ts +0 -89
  258. package/backend/dist/esm/backend/src/status.js +0 -213
  259. package/backend/dist/esm/backend/src/stream.d.ts +0 -494
  260. package/backend/dist/esm/backend/src/stream.js +0 -1611
  261. package/backend/dist/esm/backend/src/users.d.ts +0 -926
  262. package/backend/dist/esm/backend/src/users.js +0 -2423
  263. package/backend/dist/esm/backend/src/utils.d.ts +0 -22
  264. package/backend/dist/esm/backend/src/utils.js +0 -463
  265. package/backend/dist/esm/backend/src/view.d.ts +0 -115
  266. package/backend/dist/esm/backend/src/view.js +0 -584
  267. package/backend/dist/esm/backend/src/vinc.d.ts +0 -6
  268. package/backend/dist/esm/backend/src/vinc.js +0 -6
  269. package/backend/dist/esm/backend/src/volt.d.ts +0 -24
  270. package/backend/dist/esm/backend/src/volt.js +0 -27
  271. package/backend/dist/esm/frontend/src/modules/request.d.ts +0 -70
  272. package/backend/dist/esm/frontend/src/modules/request.js +0 -117
  273. package/backend/old/file_watcher.ts +0 -359
  274. package/backend/old/request.deprc.js +0 -626
  275. package/backend/old/response.deprc.js +0 -354
  276. package/frontend/dist/backend/src/database/collection.d.ts +0 -1765
  277. package/frontend/dist/backend/src/database/collection.js +0 -3779
  278. package/frontend/dist/backend/src/database/database.d.ts +0 -92
  279. package/frontend/dist/backend/src/database/database.js +0 -214
  280. package/frontend/dist/backend/src/database/filters/filters.d.ts +0 -6
  281. package/frontend/dist/backend/src/database/filters/filters.js +0 -1
  282. package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +0 -223
  283. package/frontend/dist/backend/src/database/filters/strict_filter.js +0 -3
  284. package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +0 -165
  285. package/frontend/dist/backend/src/database/filters/strict_update_filter.js +0 -5
  286. package/frontend/dist/backend/src/database/flatten.d.ts +0 -78
  287. package/frontend/dist/backend/src/database/flatten.js +0 -22
  288. package/frontend/dist/backend/src/endpoint.d.ts +0 -346
  289. package/frontend/dist/backend/src/endpoint.js +0 -479
  290. package/frontend/dist/backend/src/errors/index.d.ts +0 -7
  291. package/frontend/dist/backend/src/errors/index.js +0 -7
  292. package/frontend/dist/backend/src/errors/internal_external.d.ts +0 -52
  293. package/frontend/dist/backend/src/errors/internal_external.js +0 -86
  294. package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +0 -41
  295. package/frontend/dist/backend/src/errors/invalid_usage_error.js +0 -33
  296. package/frontend/dist/backend/src/errors/system_error.d.ts +0 -261
  297. package/frontend/dist/backend/src/errors/system_error.js +0 -444
  298. package/frontend/dist/backend/src/events.d.ts +0 -97
  299. package/frontend/dist/backend/src/events.js +0 -5
  300. package/frontend/dist/backend/src/frontend.d.ts +0 -11
  301. package/frontend/dist/backend/src/frontend.js +0 -12
  302. package/frontend/dist/backend/src/image_endpoint.d.ts +0 -44
  303. package/frontend/dist/backend/src/image_endpoint.js +0 -196
  304. package/frontend/dist/backend/src/meta.d.ts +0 -112
  305. package/frontend/dist/backend/src/meta.js +0 -152
  306. package/frontend/dist/backend/src/payments/paddle.d.ts +0 -329
  307. package/frontend/dist/backend/src/payments/paddle.js +0 -2276
  308. package/frontend/dist/backend/src/payments/stripe/checkout.d.ts +0 -113
  309. package/frontend/dist/backend/src/payments/stripe/checkout.js +0 -356
  310. package/frontend/dist/backend/src/payments/stripe/customers.d.ts +0 -17
  311. package/frontend/dist/backend/src/payments/stripe/customers.js +0 -193
  312. package/frontend/dist/backend/src/payments/stripe/error.d.ts +0 -74
  313. package/frontend/dist/backend/src/payments/stripe/error.js +0 -51
  314. package/frontend/dist/backend/src/payments/stripe/events.d.ts +0 -155
  315. package/frontend/dist/backend/src/payments/stripe/events.js +0 -5
  316. package/frontend/dist/backend/src/payments/stripe/meters.d.ts +0 -105
  317. package/frontend/dist/backend/src/payments/stripe/meters.js +0 -318
  318. package/frontend/dist/backend/src/payments/stripe/payment_methods.d.ts +0 -58
  319. package/frontend/dist/backend/src/payments/stripe/payment_methods.js +0 -135
  320. package/frontend/dist/backend/src/payments/stripe/products.d.ts +0 -519
  321. package/frontend/dist/backend/src/payments/stripe/products.js +0 -896
  322. package/frontend/dist/backend/src/payments/stripe/stripe.d.ts +0 -215
  323. package/frontend/dist/backend/src/payments/stripe/stripe.js +0 -464
  324. package/frontend/dist/backend/src/payments/stripe/subscriptions.d.ts +0 -172
  325. package/frontend/dist/backend/src/payments/stripe/subscriptions.js +0 -754
  326. package/frontend/dist/backend/src/payments/stripe/utils.d.ts +0 -63
  327. package/frontend/dist/backend/src/payments/stripe/utils.js +0 -131
  328. package/frontend/dist/backend/src/payments/stripe/webhooks.d.ts +0 -105
  329. package/frontend/dist/backend/src/payments/stripe/webhooks.js +0 -752
  330. package/frontend/dist/backend/src/plugins/mail/mail.d.ts +0 -255
  331. package/frontend/dist/backend/src/plugins/mail/mail.js +0 -396
  332. package/frontend/dist/backend/src/plugins/mail/ui.d.ts +0 -297
  333. package/frontend/dist/backend/src/plugins/mail/ui.js +0 -1400
  334. package/frontend/dist/backend/src/rate_limit.d.ts +0 -148
  335. package/frontend/dist/backend/src/rate_limit.js +0 -667
  336. package/frontend/dist/backend/src/route.d.ts +0 -39
  337. package/frontend/dist/backend/src/route.js +0 -222
  338. package/frontend/dist/backend/src/server.d.ts +0 -502
  339. package/frontend/dist/backend/src/server.js +0 -2034
  340. package/frontend/dist/backend/src/splash_screen.d.ts +0 -93
  341. package/frontend/dist/backend/src/splash_screen.js +0 -156
  342. package/frontend/dist/backend/src/status.d.ts +0 -89
  343. package/frontend/dist/backend/src/status.js +0 -213
  344. package/frontend/dist/backend/src/stream.d.ts +0 -494
  345. package/frontend/dist/backend/src/stream.js +0 -1611
  346. package/frontend/dist/backend/src/users.d.ts +0 -926
  347. package/frontend/dist/backend/src/users.js +0 -2423
  348. package/frontend/dist/backend/src/utils.d.ts +0 -22
  349. package/frontend/dist/backend/src/utils.js +0 -463
  350. package/frontend/dist/backend/src/view.d.ts +0 -115
  351. package/frontend/dist/backend/src/view.js +0 -584
  352. package/frontend/dist/frontend/src/elements/base.d.ts +0 -3743
  353. package/frontend/dist/frontend/src/elements/base.js +0 -12151
  354. package/frontend/dist/frontend/src/elements/module.d.ts +0 -95
  355. package/frontend/dist/frontend/src/elements/module.js +0 -216
  356. package/frontend/dist/frontend/src/elements/register_element.d.ts +0 -3
  357. package/frontend/dist/frontend/src/elements/register_element.js +0 -22
  358. package/frontend/dist/frontend/src/elements/resize_query_manager.d.ts +0 -0
  359. package/frontend/dist/frontend/src/elements/resize_query_manager.js +0 -150
  360. package/frontend/dist/frontend/src/elements/types.d.ts +0 -52
  361. package/frontend/dist/frontend/src/elements/types.js +0 -5
  362. package/frontend/dist/frontend/src/index.d.ts +0 -21
  363. package/frontend/dist/frontend/src/index.js +0 -29
  364. package/frontend/dist/frontend/src/modules/attachment.d.ts +0 -126
  365. package/frontend/dist/frontend/src/modules/attachment.js +0 -306
  366. package/frontend/dist/frontend/src/modules/auth.d.ts +0 -44
  367. package/frontend/dist/frontend/src/modules/auth.js +0 -80
  368. package/frontend/dist/frontend/src/modules/color.d.ts +0 -160
  369. package/frontend/dist/frontend/src/modules/color.js +0 -316
  370. package/frontend/dist/frontend/src/modules/compression.d.ts +0 -39
  371. package/frontend/dist/frontend/src/modules/compression.js +0 -102
  372. package/frontend/dist/frontend/src/modules/cookies.d.ts +0 -44
  373. package/frontend/dist/frontend/src/modules/cookies.js +0 -143
  374. package/frontend/dist/frontend/src/modules/events.d.ts +0 -31
  375. package/frontend/dist/frontend/src/modules/events.js +0 -79
  376. package/frontend/dist/frontend/src/modules/google.d.ts +0 -23
  377. package/frontend/dist/frontend/src/modules/google.js +0 -52
  378. package/frontend/dist/frontend/src/modules/meta.d.ts +0 -14
  379. package/frontend/dist/frontend/src/modules/meta.js +0 -48
  380. package/frontend/dist/frontend/src/modules/paddle.d.ts +0 -1207
  381. package/frontend/dist/frontend/src/modules/paddle.js +0 -2594
  382. package/frontend/dist/frontend/src/modules/request.d.ts +0 -70
  383. package/frontend/dist/frontend/src/modules/request.js +0 -117
  384. package/frontend/dist/frontend/src/modules/settings.d.ts +0 -3
  385. package/frontend/dist/frontend/src/modules/settings.js +0 -5
  386. package/frontend/dist/frontend/src/modules/statics.d.ts +0 -21
  387. package/frontend/dist/frontend/src/modules/statics.js +0 -43
  388. package/frontend/dist/frontend/src/modules/stripe/cart.d.ts +0 -112
  389. package/frontend/dist/frontend/src/modules/stripe/cart.js +0 -321
  390. package/frontend/dist/frontend/src/modules/stripe/checkout.d.ts +0 -7
  391. package/frontend/dist/frontend/src/modules/stripe/checkout.js +0 -37
  392. package/frontend/dist/frontend/src/modules/stripe/index.m.d.ts +0 -6
  393. package/frontend/dist/frontend/src/modules/stripe/index.m.js +0 -6
  394. package/frontend/dist/frontend/src/modules/stripe/payments.d.ts +0 -58
  395. package/frontend/dist/frontend/src/modules/stripe/payments.js +0 -92
  396. package/frontend/dist/frontend/src/modules/support.d.ts +0 -30
  397. package/frontend/dist/frontend/src/modules/support.js +0 -53
  398. package/frontend/dist/frontend/src/modules/theme.d.ts +0 -133
  399. package/frontend/dist/frontend/src/modules/theme.js +0 -406
  400. package/frontend/dist/frontend/src/modules/themes.d.ts +0 -12
  401. package/frontend/dist/frontend/src/modules/themes.js +0 -22
  402. package/frontend/dist/frontend/src/modules/user.d.ts +0 -164
  403. package/frontend/dist/frontend/src/modules/user.js +0 -270
  404. package/frontend/dist/frontend/src/modules/utils.d.ts +0 -176
  405. package/frontend/dist/frontend/src/modules/utils.js +0 -569
  406. package/frontend/dist/frontend/src/types/gradient.d.ts +0 -29
  407. package/frontend/dist/frontend/src/types/gradient.js +0 -79
  408. package/frontend/dist/frontend/src/ui/border_button.d.ts +0 -94
  409. package/frontend/dist/frontend/src/ui/border_button.js +0 -228
  410. package/frontend/dist/frontend/src/ui/button.d.ts +0 -241
  411. package/frontend/dist/frontend/src/ui/button.js +0 -682
  412. package/frontend/dist/frontend/src/ui/canvas.d.ts +0 -138
  413. package/frontend/dist/frontend/src/ui/canvas.js +0 -444
  414. package/frontend/dist/frontend/src/ui/checkbox.d.ts +0 -74
  415. package/frontend/dist/frontend/src/ui/checkbox.js +0 -321
  416. package/frontend/dist/frontend/src/ui/code.d.ts +0 -235
  417. package/frontend/dist/frontend/src/ui/code.js +0 -1007
  418. package/frontend/dist/frontend/src/ui/context_menu.d.ts +0 -36
  419. package/frontend/dist/frontend/src/ui/context_menu.js +0 -205
  420. package/frontend/dist/frontend/src/ui/css.d.ts +0 -16
  421. package/frontend/dist/frontend/src/ui/css.js +0 -48
  422. package/frontend/dist/frontend/src/ui/divider.d.ts +0 -15
  423. package/frontend/dist/frontend/src/ui/divider.js +0 -78
  424. package/frontend/dist/frontend/src/ui/dropdown.d.ts +0 -176
  425. package/frontend/dist/frontend/src/ui/dropdown.js +0 -481
  426. package/frontend/dist/frontend/src/ui/for_each.d.ts +0 -37
  427. package/frontend/dist/frontend/src/ui/for_each.js +0 -92
  428. package/frontend/dist/frontend/src/ui/form.d.ts +0 -34
  429. package/frontend/dist/frontend/src/ui/form.js +0 -233
  430. package/frontend/dist/frontend/src/ui/frame_modes.d.ts +0 -37
  431. package/frontend/dist/frontend/src/ui/frame_modes.js +0 -108
  432. package/frontend/dist/frontend/src/ui/google_map.d.ts +0 -24
  433. package/frontend/dist/frontend/src/ui/google_map.js +0 -106
  434. package/frontend/dist/frontend/src/ui/gradient.d.ts +0 -25
  435. package/frontend/dist/frontend/src/ui/gradient.js +0 -131
  436. package/frontend/dist/frontend/src/ui/image.d.ts +0 -111
  437. package/frontend/dist/frontend/src/ui/image.js +0 -576
  438. package/frontend/dist/frontend/src/ui/input.d.ts +0 -392
  439. package/frontend/dist/frontend/src/ui/input.js +0 -1201
  440. package/frontend/dist/frontend/src/ui/link.d.ts +0 -25
  441. package/frontend/dist/frontend/src/ui/link.js +0 -140
  442. package/frontend/dist/frontend/src/ui/list.d.ts +0 -37
  443. package/frontend/dist/frontend/src/ui/list.js +0 -170
  444. package/frontend/dist/frontend/src/ui/loader_button.d.ts +0 -80
  445. package/frontend/dist/frontend/src/ui/loader_button.js +0 -193
  446. package/frontend/dist/frontend/src/ui/loaders.d.ts +0 -57
  447. package/frontend/dist/frontend/src/ui/loaders.js +0 -157
  448. package/frontend/dist/frontend/src/ui/popup.d.ts +0 -94
  449. package/frontend/dist/frontend/src/ui/popup.js +0 -510
  450. package/frontend/dist/frontend/src/ui/pseudo.d.ts +0 -44
  451. package/frontend/dist/frontend/src/ui/pseudo.js +0 -154
  452. package/frontend/dist/frontend/src/ui/scroller.d.ts +0 -105
  453. package/frontend/dist/frontend/src/ui/scroller.js +0 -1253
  454. package/frontend/dist/frontend/src/ui/slider.d.ts +0 -45
  455. package/frontend/dist/frontend/src/ui/slider.js +0 -217
  456. package/frontend/dist/frontend/src/ui/spacer.d.ts +0 -15
  457. package/frontend/dist/frontend/src/ui/spacer.js +0 -78
  458. package/frontend/dist/frontend/src/ui/span.d.ts +0 -15
  459. package/frontend/dist/frontend/src/ui/span.js +0 -73
  460. package/frontend/dist/frontend/src/ui/stack.d.ts +0 -66
  461. package/frontend/dist/frontend/src/ui/stack.js +0 -335
  462. package/frontend/dist/frontend/src/ui/steps.d.ts +0 -131
  463. package/frontend/dist/frontend/src/ui/steps.js +0 -308
  464. package/frontend/dist/frontend/src/ui/style.d.ts +0 -17
  465. package/frontend/dist/frontend/src/ui/style.js +0 -73
  466. package/frontend/dist/frontend/src/ui/switch.d.ts +0 -69
  467. package/frontend/dist/frontend/src/ui/switch.js +0 -357
  468. package/frontend/dist/frontend/src/ui/table.d.ts +0 -100
  469. package/frontend/dist/frontend/src/ui/table.js +0 -405
  470. package/frontend/dist/frontend/src/ui/tabs.d.ts +0 -111
  471. package/frontend/dist/frontend/src/ui/tabs.js +0 -424
  472. package/frontend/dist/frontend/src/ui/text.d.ts +0 -15
  473. package/frontend/dist/frontend/src/ui/text.js +0 -83
  474. package/frontend/dist/frontend/src/ui/title.d.ts +0 -91
  475. package/frontend/dist/frontend/src/ui/title.js +0 -272
  476. package/frontend/dist/frontend/src/ui/ui.d.ts +0 -35
  477. package/frontend/dist/frontend/src/ui/ui.js +0 -38
  478. package/frontend/dist/frontend/src/ui/view.d.ts +0 -15
  479. package/frontend/dist/frontend/src/ui/view.js +0 -88
  480. package/frontend/dist/frontend/src/volt.d.ts +0 -20
  481. package/frontend/dist/frontend/src/volt.js +0 -27
  482. package/frontend/examples/theme/theme.ts +0 -58
  483. package/frontend/tools/bundle_d_ts.js +0 -71
  484. package/frontend/tools/convert_to_jsdoc_input.txt +0 -9452
  485. package/frontend/tools/convert_to_jsdoc_output.txt +0 -7626
  486. package/frontend/tools/convert_to_jsdoc_tmp.js +0 -345
  487. package/frontend/tools/scan_mixed_imports.js +0 -69
  488. /package/frontend/{dist/frontend/src/css → css}/adyen.css +0 -0
  489. /package/frontend/{dist/frontend/src/css → css}/volt.css +0 -0
@@ -1,1456 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var stdin_exports = {};
15
- module.exports = __toCommonJS(stdin_exports);
16
- const import_meta = {};
17
- const { vlib, vhighlight } = require("../vinc.js");
18
- const { jsPDF } = require("jspdf");
19
- const libfs = require("fs");
20
- const PDF = {
21
- // Use pixels instead of points (NOT ADVISED).
22
- // use_pixels: false,
23
- // Get opacity from hex as a floating number 0/1, returns `null` on no opacity.
24
- hex_opacity(hex) {
25
- if (typeof hex !== "string" && hex instanceof String === false || hex.charAt(0) !== "#" || hex.length <= 7) {
26
- return null;
27
- }
28
- const opacity = parseInt(hex.slice(-2)) / 100;
29
- return isNaN(opacity) ? null : opacity;
30
- },
31
- // Convert hex to rgb(a), since pdfkit does not support a hex with opacity.
32
- hex_to_rgb(hex) {
33
- if (typeof hex !== "string" && hex instanceof String === false) {
34
- return hex;
35
- }
36
- if (hex.charAt(0) !== "#") {
37
- return hex;
38
- }
39
- hex = hex.slice(1);
40
- let alpha = 1;
41
- if (hex.length > 6) {
42
- alpha = parseInt(hex.slice(-2)) / 100;
43
- hex = hex.slice(0, -2);
44
- }
45
- const bigint = parseInt(hex, 16);
46
- const r = bigint >> 16 & 255;
47
- const g = bigint >> 8 & 255;
48
- const b = bigint & 255;
49
- if (alpha != 1) {
50
- return [r, g, b, alpha];
51
- }
52
- return [r, g, b];
53
- },
54
- hex_to_cmyk(hex) {
55
- if (typeof hex !== "string" && hex instanceof String === false) {
56
- return hex;
57
- }
58
- if (hex.charAt(0) !== "#") {
59
- return hex;
60
- }
61
- hex = hex.slice(1);
62
- let alpha = 1;
63
- if (hex.length > 6) {
64
- alpha = parseInt(hex.slice(-2)) / 100;
65
- hex = hex.slice(0, -2);
66
- }
67
- const bigint = parseInt(hex, 16);
68
- let r = bigint >> 16 & 255;
69
- let g = bigint >> 8 & 255;
70
- let b = bigint & 255;
71
- var computedC = 0;
72
- var computedM = 0;
73
- var computedY = 0;
74
- var computedK = 0;
75
- r = parseInt(("" + r).replace(/\s/g, ""), 10);
76
- g = parseInt(("" + g).replace(/\s/g, ""), 10);
77
- b = parseInt(("" + b).replace(/\s/g, ""), 10);
78
- if (r == null || g == null || b == null || isNaN(r) || isNaN(g) || isNaN(b)) {
79
- console.error("Please enter numeric RGB values!");
80
- return;
81
- }
82
- if (r < 0 || g < 0 || b < 0 || r > 255 || g > 255 || b > 255) {
83
- console.error("RGB values must be in the range 0 to 255.");
84
- return;
85
- }
86
- if (r == 0 && g == 0 && b == 0) {
87
- computedK = 1;
88
- return [0, 0, 0, 1];
89
- }
90
- computedC = 1 - r / 255;
91
- computedM = 1 - g / 255;
92
- computedY = 1 - b / 255;
93
- var minCMY = Math.min(computedC, Math.min(computedM, computedY));
94
- computedC = Math.round((computedC - minCMY) / (1 - minCMY) * 100);
95
- computedM = Math.round((computedM - minCMY) / (1 - minCMY) * 100);
96
- computedY = Math.round((computedY - minCMY) / (1 - minCMY) * 100);
97
- computedK = Math.round(minCMY * 100);
98
- return [computedC, computedM, computedY, computedK];
99
- }
100
- };
101
- class Computed {
102
- static ids = 0;
103
- constructor({
104
- start_x,
105
- start_y,
106
- resume_x,
107
- resume_y,
108
- inner_width = 0,
109
- // inner width without padding or margin.
110
- inner_height = 0,
111
- // inner height without padding or margin.
112
- is_absolute = false,
113
- is_wrapped = false,
114
- start_page = 0,
115
- end_page = 0,
116
- _padding,
117
- _margin
118
- }) {
119
- this.start_x = start_x;
120
- this.start_y = start_y;
121
- this.resume_x = resume_x;
122
- this.resume_y = resume_y;
123
- this.inner_width = inner_width;
124
- this.inner_height = inner_height;
125
- this.is_absolute = is_absolute;
126
- this.is_wrapped = is_wrapped;
127
- this.start_page = start_page;
128
- this.end_page = end_page;
129
- this.allow_force_same_page = true;
130
- this._margin = _margin;
131
- this._padding = _padding;
132
- ++Computed.ids;
133
- this._id = Computed.ids;
134
- }
135
- // Get end x/y.
136
- get end_x() {
137
- return this.start_x + this._margin[1] + this._margin[3] + this._padding[1] + this._padding[3] + this.inner_width;
138
- }
139
- get end_y() {
140
- return this.start_y + this._margin[0] + this._margin[2] + this._padding[0] + this._padding[2] + this.inner_height;
141
- }
142
- // Start and end x/y from AFTER the margin.
143
- get margin_start_x() {
144
- return this.start_x + this._margin[3];
145
- }
146
- get margin_end_x() {
147
- return this.end_x - this._margin[1];
148
- }
149
- get margin_start_y() {
150
- return this.start_y + this._margin[0];
151
- }
152
- get margin_end_y() {
153
- return this.end_y - this._margin[2];
154
- }
155
- // Start and end x/y from AFTER the padding and margin.
156
- get padding_start_x() {
157
- return this.start_x + this._margin[3] + this._padding[3];
158
- }
159
- get padding_end_x() {
160
- return this.end_x - this._margin[1] - this._padding[1];
161
- }
162
- get padding_start_y() {
163
- return this.start_y + this._margin[0] + this._padding[0];
164
- }
165
- get padding_end_y() {
166
- return this.end_y - this._margin[2] - this._padding[2];
167
- }
168
- // As string for debugging.
169
- toString() {
170
- return {
171
- id: this._id,
172
- start_x: this.start_x,
173
- start_y: this.start_y,
174
- resume_x: this.resume_x,
175
- resume_y: this.resume_y,
176
- inner_width: this.inner_width,
177
- inner_height: this.inner_height,
178
- is_absolute: this.is_absolute,
179
- is_wrapped: this.is_wrapped,
180
- start_page: this.start_page,
181
- end_page: this.end_page,
182
- _margin: this._margin,
183
- _padding: this._padding,
184
- end_x: this.end_x,
185
- end_y: this.end_y,
186
- margin_start_x: this.margin_start_x,
187
- margin_end_x: this.margin_end_x,
188
- margin_start_y: this.margin_start_y,
189
- margin_end_y: this.margin_end_y,
190
- padding_start_x: this.padding_start_x,
191
- padding_end_x: this.padding_end_x,
192
- padding_start_y: this.padding_start_y,
193
- padding_end_y: this.padding_end_y
194
- };
195
- }
196
- }
197
- function CreateVElementClass({ type, is_text = false, is_img = false, is_hstack = false, is_stack = false }) {
198
- class E {
199
- // ---------------------------------------------------------
200
- // Constructor.
201
- constructor(...children2) {
202
- this.type = type;
203
- this._parent = null;
204
- this._children = [];
205
- this._text = null;
206
- this._img = null;
207
- this._options = {};
208
- this._calls = {};
209
- this._id = null;
210
- this._width = void 0;
211
- this._height = void 0;
212
- this._stretch = void 0;
213
- this._margin = [0, 0, 0, 0];
214
- this._padding = [0, 0, 0, 0];
215
- this._position = [null, null, null, null];
216
- this._background = null;
217
- this._border_radius = null;
218
- this._border_color = null;
219
- this._border_width = 1;
220
- this._font = null;
221
- this._font_weight = null;
222
- this._href = null;
223
- this._force_same_page = false;
224
- this._page = void 0;
225
- this._valign = void 0;
226
- this.is_text = is_text;
227
- this.is_img = is_img;
228
- this.is_hstack = is_hstack;
229
- this.is_stack = is_stack;
230
- this.append(...children2);
231
- }
232
- copy() {
233
- const copy = new this.constructor(this._children);
234
- copy.type = this.type;
235
- copy._parent = this._parent;
236
- copy._children = this._children;
237
- copy._text = this._text;
238
- copy._img = this._img;
239
- copy._style = this._options;
240
- copy._calls = this._calls;
241
- copy._id = this._id;
242
- copy._width = this._width;
243
- copy._height = this._height;
244
- copy._stretch = this.stretch;
245
- copy._margin = this._margin;
246
- copy._padding = this._padding;
247
- copy._position = this._position;
248
- copy._background = this._background;
249
- copy._border_radius = this._border_radius;
250
- copy._border_color = this._border_color;
251
- copy._border_width = this._border_width;
252
- copy._font = this._font;
253
- copy._font_weight = this._font_weight;
254
- copy._href = this._href;
255
- copy._force_same_page = this._force_same_page;
256
- copy._page = this._page;
257
- copy._valign = this._valign;
258
- return copy;
259
- }
260
- // ---------------------------------------------------------
261
- // System.
262
- // Set doc styling.
263
- _set_styling(doc) {
264
- this._restore = {};
265
- Object.keys(this._calls).iterate((func) => {
266
- if (func === "setFont") {
267
- return null;
268
- }
269
- this._restore[func] = doc["g" + func.substr(1)]();
270
- if (Array.isArray(this._calls[func])) {
271
- doc[func](...this._calls[func]);
272
- } else {
273
- doc[func](this._calls[func]);
274
- }
275
- });
276
- if (this._font != null || this._font_weight != null) {
277
- const font = doc.getFont();
278
- this._restore.setFont = [font.fontName, font.fontStyle];
279
- doc.setFont(this._font || doc.fontName, this._font_weight || doc.fontStyle);
280
- }
281
- }
282
- // Restore doc styling.
283
- _restore_styling(doc) {
284
- Object.keys(this._restore).iterate((func) => {
285
- if (Array.isArray(this._restore[func])) {
286
- doc[func](...this._restore[func]);
287
- } else {
288
- doc[func](this._restore[func]);
289
- }
290
- });
291
- }
292
- // Check if the _text attr contains whitespace.
293
- _has_whitespace() {
294
- if (!this.is_text) {
295
- return false;
296
- }
297
- for (let i = 0; i < this._text.length; i++) {
298
- const c = this._text.charAt(i);
299
- if (c === " " || c === " ") {
300
- return true;
301
- }
302
- }
303
- return false;
304
- }
305
- // Compute.
306
- _compute(doc, x2, y2, page, refresh = false) {
307
- if (refresh === false && this._computed !== void 0) {
308
- return this._computed;
309
- }
310
- if (this.type === "PDF" && doc == null) {
311
- this._create_doc();
312
- doc = this._doc;
313
- x2 = 0;
314
- y2 = 0;
315
- page = 1;
316
- refresh = true;
317
- }
318
- if (this._initialize !== void 0) {
319
- this._initialize();
320
- }
321
- if (this._text != null) {
322
- this._text = this._text.toString();
323
- }
324
- const is_absolute = this._position[0] != null || this._position[1] != null || this._position[2] != null || this._position[3] != null;
325
- if (this._page != null) {
326
- if (!is_absolute) {
327
- throw Error(`Only absolute positioned elements may define an explicit page using "page()".`);
328
- }
329
- page = this._page;
330
- }
331
- let computed = new Computed({
332
- start_x: x2,
333
- start_y: y2,
334
- resume_x: x2,
335
- resume_y: y2,
336
- start_page: page,
337
- end_page: page,
338
- is_absolute,
339
- _margin: this._margin,
340
- _padding: this._padding
341
- });
342
- if (this.type === "Page") {
343
- computed.start_x = doc._volt_margin_left;
344
- computed.start_y = doc._volt_margin_top;
345
- ++page;
346
- ++computed.start_page;
347
- ++computed.end_page;
348
- }
349
- let is_absolute_right = false;
350
- let is_absolute_bottom = false;
351
- if (computed.is_absolute) {
352
- if (this._position[1] != null && this._position[3] != null) {
353
- computed.start_x = this._position[3];
354
- this._width = doc._volt_page_width - this._position[1] - this._position[3];
355
- } else if (this._position[1] != null) {
356
- computed.start_x = doc._volt_page_width - this._position[1] - this._margin[1] - this._margin[3] - this._padding[1] - this._padding[3];
357
- is_absolute_right = true;
358
- } else if (this._position[3] != null) {
359
- computed.start_x = this._position[3];
360
- }
361
- if (this._position[0] != null && this._position[2] != null) {
362
- computed.start_y = this._position[0];
363
- this._height = doc._volt_page_height - this._position[0] - this._position[2];
364
- } else if (this._position[0] != null) {
365
- computed.start_y = this._position[0];
366
- } else if (this._position[2] != null) {
367
- computed.start_y = doc._volt_page_height - this._position[2] - this._margin[0] - this._margin[2] - this._padding[0] - this._padding[2];
368
- is_absolute_bottom = true;
369
- }
370
- }
371
- if (typeof this._width === "string" && this._width.last() === "%") {
372
- if (this._parent != null && this._parent._max_width != null) {
373
- this._width = Math.max(0, this._parent._max_width * (parseInt(this._width.slice(0, -1)) / 100) - (this._margin[1] + this._margin[3] + this._padding[1] + this._padding[3]));
374
- } else {
375
- delete this._width;
376
- }
377
- }
378
- if (this._parent == null || this._parent._max_x != null) {
379
- this._max_x = doc._volt_page_width - doc._volt_margin_right;
380
- } else {
381
- this._max_x = this._parent._max_x;
382
- }
383
- if (this._width != null) {
384
- this._max_x = Math.min(x2 + this._width, this._max_x);
385
- }
386
- this._max_x -= this._margin[1] - this._padding[1];
387
- this._max_width = parseInt(this._max_x - x2);
388
- this._set_styling(doc);
389
- if (this.is_text || this.is_img) {
390
- let width2 = 0, height2 = 0, dimensions;
391
- const has_whitespace = this._has_whitespace();
392
- if (this.is_img) {
393
- if (this._width == null) {
394
- throw Error('A defined width is required for an "Image" element.');
395
- }
396
- if (this._height == null) {
397
- throw Error('A defined height is required for an "Image" element.');
398
- }
399
- }
400
- if (this._width != null) {
401
- width2 = this._width;
402
- } else if (this.is_text) {
403
- let no_spaces = "", space_count = 0;
404
- for (let i = 0; i < this._text.length; i++) {
405
- const c = this._text.charAt(i);
406
- if (c === " ") {
407
- ++space_count;
408
- } else if (c === " ") {
409
- space_count += 8;
410
- } else {
411
- no_spaces += c;
412
- }
413
- }
414
- dimensions = doc.getTextDimensions(no_spaces);
415
- width2 = dimensions.w + doc.getStringUnitWidth(" ") * doc.getFontSize() * space_count;
416
- }
417
- if (width2 > this._max_width) {
418
- width2 = this._max_width;
419
- if (this._width != null) {
420
- this._width = width2;
421
- }
422
- if (this.is_text && !has_whitespace && width2 < this._parent._max_width) {
423
- this._restore_styling(doc);
424
- const computed2 = this._compute(doc, this._parent._wrap_x, this._parent._wrap_y, page, true);
425
- computed2.has_wrapped = true;
426
- return computed2;
427
- }
428
- }
429
- if (this._font_weight === "bold") {
430
- width2 *= 1.04;
431
- }
432
- if (this._height != null) {
433
- height2 = this._height;
434
- } else if (this.is_text) {
435
- if (dimensions === void 0) {
436
- dimensions = doc.getTextDimensions(this._text);
437
- }
438
- if (!has_whitespace && width2 < this._parent._max_width) {
439
- height2 = 1 * (dimensions.h * doc.getLineHeightFactor());
440
- } else {
441
- const lines = doc.splitTextToSize(this._text, width2);
442
- height2 = lines.length * (dimensions.h * doc.getLineHeightFactor());
443
- }
444
- height2 += dimensions.h * doc.getLineHeightFactor() * 0.15;
445
- }
446
- computed.inner_width = width2;
447
- computed.inner_height = height2;
448
- } else {
449
- let max_child_x = 0, max_child_y = 0;
450
- let x3 = computed.padding_start_x;
451
- let y3 = computed.padding_start_y;
452
- let child_page = page;
453
- let stretch_children = [], row_children = [];
454
- this._wrap_x = x3;
455
- const apply_vertical_alignment = (children2) => {
456
- const is_center = this._valign === "center";
457
- const is_trailing = this._valign === "trailing";
458
- if (!is_center && !is_trailing) {
459
- return;
460
- }
461
- let max_height = 0;
462
- children2.iterate((child) => {
463
- const height2 = child._computed.inner_height + child._computed._padding[0] + child._computed._padding[2];
464
- if (!child._computed.is_absolute && height2 > max_height) {
465
- max_height = height2;
466
- }
467
- });
468
- children2.iterate((child) => {
469
- if (!child._computed.is_absolute) {
470
- const height2 = child._computed.inner_height + child._computed._padding[0] + child._computed._padding[2];
471
- if (is_center) {
472
- child._computed.start_y += (max_height - height2) / 2;
473
- } else if (is_trailing) {
474
- child._computed.start_y += max_height - height2;
475
- }
476
- }
477
- });
478
- };
479
- this._children.iterate((child) => {
480
- const is_stack3 = child.is_stack;
481
- child._parent = this;
482
- let response = child._compute(doc, x3, y3, child_page, refresh);
483
- if (response.end_page > computed.end_page) {
484
- apply_vertical_alignment(row_children);
485
- row_children = [];
486
- stretch_children = [];
487
- child_page = response.end_page;
488
- computed.end_page = response.end_page;
489
- if (this.is_hstack) {
490
- x3 = response.resume_x;
491
- y3 = doc._volt_margin_top;
492
- if (response.has_wrapped || response.resume_x >= this._max_x) {
493
- x3 = response.has_wrapped ? response.resume_x : this._wrap_x;
494
- y3 = this._wrap_y === void 0 ? response.resume_y : this._wrap_y;
495
- }
496
- } else {
497
- x3 = this._wrap_x;
498
- y3 = response.resume_y;
499
- }
500
- max_child_x = x3;
501
- max_child_y = y3;
502
- } else if (this.is_hstack) {
503
- x3 = response.resume_x;
504
- if (response.has_wrapped || response.resume_x >= this._max_x) {
505
- x3 = response.has_wrapped ? response.resume_x : this._wrap_x;
506
- y3 = this._wrap_y === void 0 ? response.resume_y : this._wrap_y;
507
- }
508
- } else {
509
- y3 = response.resume_y;
510
- }
511
- if (response.resume_y > max_child_y) {
512
- max_child_y = response.resume_y;
513
- this._wrap_y = max_child_y;
514
- }
515
- if (response.resume_x > max_child_x) {
516
- max_child_x = response.resume_x;
517
- }
518
- if (child._stretch) {
519
- stretch_children.append(child);
520
- }
521
- row_children.append(child);
522
- });
523
- apply_vertical_alignment(row_children);
524
- if (stretch_children.length > 0) {
525
- if (this.is_hstack) {
526
- const step = (this._max_x - max_child_x) / stretch_children.length;
527
- let incr_x = 0;
528
- row_children.iterate((child) => {
529
- child._computed.start_x += incr_x;
530
- if (child._stretch) {
531
- child._computed.inner_width += step;
532
- incr_x += step;
533
- console.log("Stretch:", child.type, child._text, step);
534
- }
535
- });
536
- } else {
537
- }
538
- }
539
- if (this._width == null) {
540
- computed.inner_width = Math.max(0, max_child_x - computed.padding_start_x);
541
- } else {
542
- computed.inner_width = Math.max(this._width, max_child_x - computed.padding_start_x);
543
- }
544
- if (this._height == null) {
545
- computed.inner_height = Math.max(0, max_child_y - computed.padding_start_y);
546
- } else {
547
- computed.inner_height = Math.max(this._height, max_child_y - computed.padding_start_y);
548
- }
549
- }
550
- if (is_absolute_right) {
551
- computed.start_x -= computed.inner_width;
552
- }
553
- if (is_absolute_bottom) {
554
- computed.start_y -= computed.inner_height;
555
- }
556
- if (!computed.is_absolute) {
557
- computed.resume_x = computed.end_x;
558
- computed.resume_y = computed.end_y;
559
- }
560
- if (!is_absolute && computed.resume_y > doc._volt_page_height - doc._volt_margin_bottom && (this.is_text || this.is_img)) {
561
- if (this.is_text) {
562
- const line_height_factor = doc.getLineHeightFactor();
563
- const dimensions = doc.getTextDimensions(this._text);
564
- let lines = doc.splitTextToSize(this._text, computed.inner_width);
565
- const get_break_index = (max_height) => {
566
- let i, height2;
567
- for (i = 0; i < lines.length; i++) {
568
- height2 = (i + 1) * (dimensions.h * line_height_factor);
569
- height2 += dimensions.h * line_height_factor * 0.15;
570
- if (height2 >= max_height) {
571
- return i - 1;
572
- }
573
- }
574
- return i;
575
- };
576
- if (computed.padding_start_y + dimensions.h > doc._volt_page_height - doc._volt_margin_bottom) {
577
- this._restore_styling(doc);
578
- return this._compute(doc, this._parent._wrap_x, doc._volt_margin_top, page + 1, true);
579
- }
580
- this._restore_styling(doc);
581
- let remaining_text = this._text;
582
- const sub_texts = [];
583
- let child_page = page;
584
- for (let i = 0; i < 1e5; i++) {
585
- const max_height = i === 0 ? doc._volt_page_height - doc._volt_margin_bottom - computed.padding_start_y : doc._volt_page_height - doc._volt_margin_bottom - doc._volt_margin_top;
586
- const break_index = get_break_index(max_height);
587
- const is_last = break_index == lines.length;
588
- if (break_index === 0) {
589
- ++child_page;
590
- continue;
591
- }
592
- const copy = this.copy();
593
- copy._parent = this._parent;
594
- if (!is_last) {
595
- copy._margin[3] = 0;
596
- copy._padding[3] = 0;
597
- }
598
- if (i > 0) {
599
- copy._margin[0] = 0;
600
- copy._padding[0] = 0;
601
- }
602
- copy._text = lines.slice(0, break_index).join("\n");
603
- lines = lines.slice(break_index);
604
- if (i > 0) {
605
- ++child_page;
606
- }
607
- copy._compute(doc, i === 0 ? computed.start_x : this._parent._wrap_x, i === 0 ? computed.start_y : doc._volt_margin_top, child_page, true);
608
- sub_texts.append(copy);
609
- if (is_last) {
610
- break;
611
- }
612
- }
613
- this._parent.insert_before(this, sub_texts);
614
- this._parent.remove_child(this);
615
- return sub_texts.last()._computed;
616
- } else if (this.is_img && fits_on_one_page) {
617
- this._restore_styling(doc);
618
- return this._compute(doc, this._parent._wrap_x, doc._volt_margin_top, page + 1, true);
619
- }
620
- }
621
- const is_stack2 = this.is_stack;
622
- if (!is_absolute && is_stack2 && this._force_same_page && computed.start_page !== computed.end_page && computed.end_y - computed.start_y <= doc._volt_page_height - doc._volt_margin_bottom - doc._volt_margin_top) {
623
- this._restore_styling(doc);
624
- return this._compute(doc, this._parent._wrap_x, doc._volt_margin_top, page + 1, true);
625
- }
626
- this._restore_styling(doc);
627
- console.log(this.type, this._text, computed.start_y);
628
- this._computed = computed;
629
- return this._computed;
630
- }
631
- // Build element.
632
- _build(doc) {
633
- if (this.type === "PDF") {
634
- this._create_doc();
635
- doc = this._doc;
636
- this._compute(doc, 0, 0, 1, true);
637
- }
638
- const computed = this._computed;
639
- if (this.type === "PDF") {
640
- for (let i = 0; i < computed.end_page - 1; i++) {
641
- doc.addPage();
642
- }
643
- }
644
- doc.setPage(computed.start_page);
645
- this._set_styling(doc);
646
- if (typeof this._background === "string" || typeof this._border_color === "string") {
647
- let x2 = computed.margin_start_x, rect_width = computed.margin_end_x - computed.margin_start_x;
648
- let y2, rect_height;
649
- let color;
650
- for (let i = computed.start_page; i <= computed.end_page; i++) {
651
- doc.setPage(i);
652
- if (computed.start_page === computed.end_page) {
653
- y2 = computed.margin_start_y;
654
- rect_height = computed.margin_end_y - computed.margin_start_y;
655
- } else if (i === computed.start_page) {
656
- y2 = computed.margin_start_y;
657
- rect_height = doc._volt_page_height - doc._volt_margin_bottom - computed.margin_start_y;
658
- } else if (i === computed.end_page) {
659
- y2 = doc._volt_margin_top;
660
- rect_height = computed.margin_end_y - doc._volt_margin_bottom;
661
- } else {
662
- y2 = doc._volt_margin_top;
663
- rect_height = doc._volt_page_height - doc._volt_margin_bottom - doc._volt_margin_top;
664
- }
665
- let border_radius = this._border_radius;
666
- if (typeof border_radius === "string" && border_radius.last() === "%") {
667
- border_radius = Math.min(rect_width, rect_height) * (parseInt(border_radius.slice(0, -1)) / 100);
668
- }
669
- if (typeof this._background === "string") {
670
- color = PDF.hex_to_rgb(this._background);
671
- let restore = false;
672
- if (Array.isArray(color)) {
673
- if (color.length === 4) {
674
- restore = true;
675
- doc.saveGraphicsState();
676
- doc.setGState(new doc.GState({ opacity: color[3] }));
677
- --color.length;
678
- }
679
- doc.setFillColor(...color);
680
- } else {
681
- doc.setFillColor(color);
682
- }
683
- if (border_radius != null) {
684
- doc.roundedRect(x2, y2, rect_width, rect_height, border_radius, border_radius, "F");
685
- } else {
686
- doc.rect(x2, y2, rect_width, rect_height, "F");
687
- }
688
- if (restore) {
689
- doc.restoreGraphicsState();
690
- }
691
- }
692
- if (typeof this._border_color === "string") {
693
- doc.setLineWidth(this._border_width === void 0 ? 1 : this._border_width);
694
- color = PDF.hex_to_rgb(this._border_color);
695
- let restore = false;
696
- if (Array.isArray(color)) {
697
- if (color.length === 4) {
698
- restore = true;
699
- doc.saveGraphicsState();
700
- doc.setGState(new doc.GState({ "stroke-opacity": color[3] }));
701
- --color.length;
702
- }
703
- doc.setDrawColor(...color);
704
- } else {
705
- doc.setDrawColor(color);
706
- }
707
- if (border_radius != null) {
708
- doc.roundedRect(x2, y2, rect_width, rect_height, border_radius, border_radius, "S");
709
- } else {
710
- doc.rect(x2, y2, rect_width, rect_height, "S");
711
- }
712
- if (restore) {
713
- doc.restoreGraphicsState();
714
- }
715
- }
716
- }
717
- this._restore_styling(doc);
718
- doc.setPage(computed.start_page);
719
- this._set_styling(doc);
720
- }
721
- if (this._id != null) {
722
- doc._volt_ids[this._id] = computed.start_page;
723
- }
724
- if (this.is_text || this.is_img) {
725
- if (this._href != null) {
726
- if (this._href.startsWith("http")) {
727
- doc.link(x, y, width, height, this._href);
728
- } else {
729
- doc._volt_hrefs.append({
730
- page: computed.start_page,
731
- href: this._href,
732
- args: [x, y, width, height]
733
- });
734
- }
735
- }
736
- if (this.is_text) {
737
- const font_size = doc.getFontSize();
738
- let x2 = computed.padding_start_x;
739
- let y2 = computed.padding_start_y + font_size;
740
- if (this._options.align === "right") {
741
- x2 += computed.inner_width;
742
- }
743
- y2 -= font_size * 0.05;
744
- doc.text(this._text, x2, y2, this._options);
745
- } else if (this.is_img) {
746
- doc.addImage(libfs.readFileSync(this._img).toString("base64"), new vlib.Path(this._img).extension().slice(1).toUpperCase(), computed.padding_start_x, computed.padding_start_y, this._width, this._height);
747
- }
748
- } else if (this._children.length > 0) {
749
- this._children.iterate((child) => {
750
- child._build(doc);
751
- });
752
- }
753
- this._restore_styling(doc);
754
- if (this.type === "PDF") {
755
- }
756
- }
757
- // ---------------------------------------------------------
758
- // Functions.
759
- // As string.
760
- toString(indent = 0) {
761
- let indent_str = "";
762
- for (let i = 0; i < indent; i++) {
763
- indent_str += " ";
764
- }
765
- if (this.children.length > 0) {
766
- let str = `${indent_str}${this.type}(
767
- `;
768
- str += this._children.iterate_append((c) => c.toString(indent + 4)).join(",\n");
769
- str += `
770
- ${indent_str})`;
771
- return str;
772
- } else if (this.type === "Text") {
773
- return `${indent_str}${this.type}("${this._text}")`;
774
- } else if (this.type === "Image") {
775
- return `${indent_str}${this.type}("${this._img}")`;
776
- } else {
777
- return `${indent_str}${this.type}()`;
778
- }
779
- }
780
- // Get/set text.
781
- text(val) {
782
- if (val === void 0) {
783
- return this._text;
784
- }
785
- this._text = val;
786
- return this;
787
- }
788
- // Get/set children.
789
- get children() {
790
- return this._children;
791
- }
792
- set children(val) {
793
- this._children = val;
794
- }
795
- // Append.
796
- append(...children2) {
797
- for (let i = 0; i < children2.length; i++) {
798
- if (children2[i] == null) {
799
- continue;
800
- } else if (Array.isArray(children2[i])) {
801
- this.append(...children2[i]);
802
- } else if (typeof children2[i] === "string") {
803
- this._children.append(PDF.Text(children2[i]));
804
- } else if (typeof children2[i] !== "object") {
805
- this._children.append(PDF.Text(children2[i].toString()));
806
- } else {
807
- this._children.append(children2[i]);
808
- }
809
- }
810
- return this;
811
- }
812
- // Insert before.
813
- insert_before(relative, child) {
814
- const children2 = [];
815
- this._children.iterate((x2) => {
816
- if (x2 === relative) {
817
- if (Array.isArray(child)) {
818
- children2.append(...child);
819
- } else {
820
- children2.append(child);
821
- }
822
- }
823
- children2.append(x2);
824
- });
825
- this._children = children2;
826
- return this;
827
- }
828
- // Insert after.
829
- insert_after(relative, child) {
830
- const children2 = [];
831
- this._children.iterate((x2) => {
832
- children2.append(x2);
833
- if (x2 === relative) {
834
- if (Array.isArray(child)) {
835
- children2.append(...child);
836
- } else {
837
- children2.append(child);
838
- }
839
- }
840
- });
841
- this._children = children2;
842
- return this;
843
- }
844
- // Remove child.
845
- remove_child(child) {
846
- this._children = this._children.drop(child);
847
- return this;
848
- }
849
- // Remove children.
850
- remove_children() {
851
- this._children = [];
852
- return this;
853
- }
854
- // id.
855
- id(val) {
856
- if (val === void 0) {
857
- return this._id;
858
- }
859
- this._id = val;
860
- return this;
861
- }
862
- // Href.
863
- href(val) {
864
- if (val === void 0) {
865
- return this._href;
866
- }
867
- this._href = val;
868
- return this;
869
- }
870
- // Force same page for HStacks.
871
- force_same_page(val) {
872
- if (val === void 0) {
873
- return this._force_same_page;
874
- }
875
- this._force_same_page = val;
876
- return this;
877
- }
878
- // Set start page.
879
- page(val) {
880
- if (val === void 0) {
881
- return this._page;
882
- }
883
- this._page = val;
884
- return this;
885
- }
886
- // Margin, 1, 2 or 4 args.
887
- margin(...values) {
888
- if (values.length === 0) {
889
- return this._margin;
890
- } else {
891
- if (values.length === 1) {
892
- this._margin = [values[0], values[0], values[0], values[0]];
893
- } else if (values.length === 2) {
894
- this._margin = [values[0], values[1], values[0], values[1]];
895
- } else if (values.length === 4) {
896
- this._margin = [values[0], values[1], values[2], values[3]];
897
- } else {
898
- console.error('Invalid number of arguments for function "margin()".');
899
- }
900
- }
901
- return this;
902
- }
903
- margin_top(val) {
904
- if (val === void 0) {
905
- return this._margin[0];
906
- }
907
- this._margin[0] = val;
908
- return this;
909
- }
910
- margin_right(val) {
911
- if (val === void 0) {
912
- return this._margin[1];
913
- }
914
- this._margin[1] = val;
915
- return this;
916
- }
917
- margin_bottom(val) {
918
- if (val === void 0) {
919
- return this._margin[2];
920
- }
921
- this._margin[2] = val;
922
- return this;
923
- }
924
- margin_left(val) {
925
- if (val === void 0) {
926
- return this._margin[3];
927
- }
928
- this._margin[3] = val;
929
- return this;
930
- }
931
- // Padding, 1, 2 or 4 args.
932
- padding(...values) {
933
- if (values.length === 0) {
934
- return this._padding;
935
- } else {
936
- if (values.length === 1) {
937
- this._padding = [values[0], values[0], values[0], values[0]];
938
- } else if (values.length === 2) {
939
- this._padding = [values[0], values[1], values[0], values[1]];
940
- } else if (values.length === 4) {
941
- this._padding = [values[0], values[1], values[2], values[3]];
942
- } else {
943
- console.error('Invalid number of arguments for function "padding()".');
944
- }
945
- }
946
- return this;
947
- }
948
- padding_top(val) {
949
- if (val === void 0) {
950
- return this._padding[0];
951
- }
952
- this._padding[0] = val;
953
- return this;
954
- }
955
- padding_right(val) {
956
- if (val === void 0) {
957
- return this._padding[1];
958
- }
959
- this._padding[1] = val;
960
- return this;
961
- }
962
- padding_bottom(val) {
963
- if (val === void 0) {
964
- return this._padding[2];
965
- }
966
- this._padding[2] = val;
967
- return this;
968
- }
969
- padding_left(val) {
970
- if (val === void 0) {
971
- return this._padding[3];
972
- }
973
- this._padding[3] = val;
974
- return this;
975
- }
976
- // Position, 1 or 4 args.
977
- position(...values) {
978
- if (values.length === 0) {
979
- return this._position;
980
- } else if (values.length === 1) {
981
- this._position = [values[0], values[0], values[0], values[0]];
982
- } else if (values.length === 4) {
983
- if (values[0] != null) {
984
- this._position[0] = values[0];
985
- }
986
- if (values[1] != null) {
987
- this._position[1] = values[1];
988
- }
989
- if (values[2] != null) {
990
- this._position[2] = values[2];
991
- }
992
- if (values[3] != null) {
993
- this._position[3] = values[3];
994
- }
995
- } else {
996
- console.error('Invalid number of arguments for function "position()".');
997
- }
998
- return this;
999
- }
1000
- top(val) {
1001
- if (val === void 0) {
1002
- return this._position[0];
1003
- }
1004
- this._position[0] = val;
1005
- return this;
1006
- }
1007
- right(val) {
1008
- if (val === void 0) {
1009
- return this._position[1];
1010
- }
1011
- this._position[1] = val;
1012
- return this;
1013
- }
1014
- bottom(val) {
1015
- if (val === void 0) {
1016
- return this._position[2];
1017
- }
1018
- this._position[2] = val;
1019
- return this;
1020
- }
1021
- left(val) {
1022
- if (val === void 0) {
1023
- return this._position[3];
1024
- }
1025
- this._position[3] = val;
1026
- return this;
1027
- }
1028
- // Align.
1029
- align(val) {
1030
- if (val === void 0) {
1031
- return this._options.align;
1032
- }
1033
- this._options.align = val;
1034
- return this;
1035
- }
1036
- leading() {
1037
- return this.align("left");
1038
- }
1039
- center() {
1040
- return this.align("center");
1041
- }
1042
- trailing() {
1043
- return this.align("right");
1044
- }
1045
- justify() {
1046
- return this.align("justify");
1047
- }
1048
- // Width.
1049
- width(val) {
1050
- if (val == void 0) {
1051
- return this._width;
1052
- }
1053
- this._width = val;
1054
- return this;
1055
- }
1056
- // Height.
1057
- height(val) {
1058
- if (val == void 0) {
1059
- return this._height;
1060
- }
1061
- if (typeof val === "string" && val.last() === "%") {
1062
- throw Error('Function "height()" does not accept relative percentages.');
1063
- }
1064
- this._height = val;
1065
- return this;
1066
- }
1067
- // Stretch.
1068
- stretch(val) {
1069
- if (val == void 0) {
1070
- return this._stretch;
1071
- }
1072
- this._stretch = val;
1073
- return this;
1074
- }
1075
- // Font family.
1076
- font_family(val) {
1077
- if (val === void 0) {
1078
- return this._font;
1079
- }
1080
- this._font = val;
1081
- return this;
1082
- }
1083
- // Font size.
1084
- font_size(val) {
1085
- if (val === void 0) {
1086
- return this._calls.setFontSize;
1087
- }
1088
- this._calls.setFontSize = val;
1089
- return this;
1090
- }
1091
- // Font weight, the suffix for the font so: Helvetica-"Bold", can be lowercase.
1092
- // Suffix might depend per font.
1093
- font_weight(val) {
1094
- if (val === void 0) {
1095
- return this._font_weight;
1096
- }
1097
- this._font_weight = val;
1098
- return this;
1099
- }
1100
- // Color.
1101
- color(val) {
1102
- if (val === void 0) {
1103
- return this._calls.setTextColor;
1104
- }
1105
- this._calls.setTextColor = val;
1106
- return this;
1107
- }
1108
- // Background.
1109
- background(val) {
1110
- if (val === void 0) {
1111
- return this._background;
1112
- }
1113
- this._background = val;
1114
- return this;
1115
- }
1116
- // Border radius.
1117
- border_radius(val) {
1118
- if (val === void 0) {
1119
- return this._border_radius;
1120
- }
1121
- this._border_radius = val;
1122
- return this;
1123
- }
1124
- // Border color.
1125
- border_color(val) {
1126
- if (val === void 0) {
1127
- return this._border_color;
1128
- }
1129
- this._border_color = val;
1130
- return this;
1131
- }
1132
- // Border width.
1133
- border_width(val) {
1134
- if (val === void 0) {
1135
- return this._border_width;
1136
- }
1137
- this._border_width = val;
1138
- return this;
1139
- }
1140
- // Align (for images mainly).
1141
- align_vertical(val) {
1142
- if (val === void 0) {
1143
- return this._valign;
1144
- }
1145
- this._valign = val;
1146
- return this;
1147
- }
1148
- leading_vertical() {
1149
- return this.align_vertical("leading");
1150
- }
1151
- center_vertical() {
1152
- return this.align_vertical("center");
1153
- }
1154
- trailing_vertical() {
1155
- return this.align_vertical("trailing");
1156
- }
1157
- }
1158
- return E;
1159
- }
1160
- class PDFElement extends CreateVElementClass({
1161
- type: "PDF",
1162
- is_stack: true
1163
- }) {
1164
- // Constructor.
1165
- constructor(...children2) {
1166
- super(...children2);
1167
- this._margin = [50, 50, 50, 50];
1168
- this._is_built = false;
1169
- this._fonts = [];
1170
- this.add_font("Menlo", "normal", `${import_meta.dirname}/fonts/Menlo-Regular.ttf`);
1171
- this.add_font("Menlo", "bold", `${import_meta.dirname}/fonts/Menlo-Bold.ttf`);
1172
- }
1173
- // Create a document.
1174
- _create_doc() {
1175
- this._doc = new jsPDF("p", "pt", "a4");
1176
- this._doc._volt_margin_top = this._margin[0];
1177
- this._doc._volt_margin_right = this._margin[1];
1178
- this._doc._volt_margin_bottom = this._margin[2];
1179
- this._doc._volt_margin_left = this._margin[3];
1180
- this._doc._volt_page_width = this._doc.getPageWidth();
1181
- this._doc._volt_page_height = this._doc.getPageHeight();
1182
- this._doc._volt_ids = {};
1183
- this._doc._volt_hrefs = [];
1184
- this._fonts.iterate((item) => {
1185
- this._doc.addFileToVFS(item.file_name, item.base64);
1186
- this._doc.addFont(item.file_name, item.name, item.style);
1187
- });
1188
- return this._doc;
1189
- }
1190
- // Build.
1191
- build() {
1192
- this._build();
1193
- this._is_built = true;
1194
- return this;
1195
- }
1196
- // Get max page.
1197
- max_page() {
1198
- if (this._computed === void 0) {
1199
- this._compute();
1200
- }
1201
- return this._computed.end_page;
1202
- }
1203
- // Iterate pages.
1204
- iterate_pages(callback) {
1205
- this._compute(void 0, void 0, void 0, void 0, true);
1206
- for (let i = 1; i <= this._computed.end_page; i++) {
1207
- callback(i);
1208
- }
1209
- return this;
1210
- }
1211
- // Number pages.
1212
- number_pages({
1213
- align = "right",
1214
- // left, center, right
1215
- margin = 12.5,
1216
- font_size = 6,
1217
- color = "black"
1218
- }) {
1219
- this.iterate_pages((page) => {
1220
- const text = PDF.Text(`Page ${page}`).color(color).font_size(font_size).position(null, align === "right" ? margin : null, margin, align === "left" ? margin : null).page(page);
1221
- this.append(text);
1222
- });
1223
- return this;
1224
- }
1225
- // Add font.
1226
- add_font(name = "Menlo", style = "normal", path = "Menlo-Regular.ttf") {
1227
- this._fonts.append({
1228
- name,
1229
- style,
1230
- file_name: new vlib.Path(path).name(),
1231
- base64: Buffer.from(libfs.readFileSync(path)).toString("base64")
1232
- });
1233
- return this;
1234
- }
1235
- // Save.
1236
- save(path) {
1237
- if (!this._is_built) {
1238
- this.build();
1239
- }
1240
- libfs.writeFileSync(path, this._doc.output(), "binary");
1241
- }
1242
- // Get as bytes.
1243
- async bytes() {
1244
- if (!this._is_built) {
1245
- this.build();
1246
- }
1247
- const stream = this._doc.pipe(blobstream());
1248
- return new Promise((resolve, reject) => {
1249
- stream.on("finish", () => {
1250
- const bytes = stream.toBuffer();
1251
- resolve(bytes);
1252
- });
1253
- stream.on("error", (error) => {
1254
- reject(error);
1255
- });
1256
- });
1257
- }
1258
- // Get as blob stream.
1259
- stream() {
1260
- if (!this._is_built) {
1261
- this.build();
1262
- }
1263
- return this._doc.pipe(blobstream());
1264
- }
1265
- }
1266
- ;
1267
- PDF.PDFElement = PDFElement;
1268
- PDF.PDF = function PDF2(...args) {
1269
- return new PDFElement(...args);
1270
- };
1271
- PDF.PageElement = class PageElement extends CreateVElementClass({
1272
- type: "Page",
1273
- is_stack: true
1274
- }) {
1275
- // Constructor.
1276
- constructor(...children2) {
1277
- super(...children2);
1278
- }
1279
- };
1280
- PDF.Page = function Page(...args) {
1281
- return new PDF.PageElement(...args);
1282
- };
1283
- PDF.VStackElement = class VStackElement extends CreateVElementClass({
1284
- type: "VStack",
1285
- is_stack: true
1286
- }) {
1287
- // Constructor.
1288
- constructor(...children2) {
1289
- super(...children2);
1290
- }
1291
- };
1292
- PDF.VStack = function VStack(...args) {
1293
- return new PDF.VStackElement(...args);
1294
- };
1295
- PDF.HStackElement = class HStackElement extends CreateVElementClass({
1296
- type: "HStack",
1297
- is_stack: true,
1298
- is_hstack: true
1299
- }) {
1300
- // Constructor.
1301
- constructor(...children2) {
1302
- super(...children2);
1303
- }
1304
- };
1305
- PDF.HStack = function HStack(...args) {
1306
- return new PDF.HStackElement(...args);
1307
- };
1308
- PDF.TextElement = class TextElement extends CreateVElementClass({
1309
- type: "Text",
1310
- is_text: true
1311
- }) {
1312
- // Constructor.
1313
- constructor(text = "") {
1314
- super();
1315
- this._text = text;
1316
- }
1317
- };
1318
- PDF.Text = function Text(...args) {
1319
- return new PDF.TextElement(...args);
1320
- };
1321
- PDF.ImageElement = class ImageElement extends CreateVElementClass({
1322
- type: "Image",
1323
- is_img: true
1324
- }) {
1325
- // Constructor.
1326
- constructor(img) {
1327
- super();
1328
- this._img = img;
1329
- }
1330
- };
1331
- PDF.Image = function Image(...args) {
1332
- return new PDF.ImageElement(...args);
1333
- };
1334
- PDF.CodeBlockElement = class CodeBlockElement extends CreateVElementClass({
1335
- type: "CodeBlock",
1336
- is_stack: true
1337
- }) {
1338
- static menlo_initialized = false;
1339
- // Constructor.
1340
- constructor(language2, code) {
1341
- super();
1342
- this._language = language2;
1343
- this._code = code;
1344
- this._initialized = false;
1345
- this._calls.setFontSize = 6;
1346
- this._padding = [12.5, 5, 12.5, 5];
1347
- this._background = "#00000005";
1348
- this._border_radius = 5;
1349
- this._border_color = "#00000020";
1350
- this._border_width = 0.5;
1351
- this._font = "Menlo";
1352
- }
1353
- copy() {
1354
- const copy = super.copy();
1355
- copy._language = this.language;
1356
- copy._code = this.code;
1357
- copy._initialized = this._initialized;
1358
- return copy;
1359
- }
1360
- // Initialize.
1361
- _initialize() {
1362
- if (this._initialized) {
1363
- return this;
1364
- }
1365
- const tokenizer = vhighlight.init_tokenizer(this._language);
1366
- if (tokenizer == null) {
1367
- throw Error(`Language "${language}" is not a supported code language for "PDF.CodeBlock".`);
1368
- }
1369
- tokenizer.code = this._code;
1370
- const tokens = tokenizer.tokenize();
1371
- this._children = [];
1372
- this._children.append(CodeBlockElement.build_tokens(tokens));
1373
- this._initialized = true;
1374
- return this;
1375
- }
1376
- // Build tokens.
1377
- static build_tokens(tokens) {
1378
- const token_classes = {
1379
- comment: (text) => {
1380
- return PDF.Text(text).color("#818C97");
1381
- },
1382
- comment_keyword: (text) => {
1383
- return PDF.Text(text).color("#818C97").font_weight("bold");
1384
- },
1385
- comment_codeblock: (text) => {
1386
- return PDF.Text(text).color("#818C97").font_weight("italic").background("#FFFFFF10").border_radius(5);
1387
- },
1388
- url: (text) => {
1389
- return PDF.Text(text).color("#818C97");
1390
- },
1391
- string: (text) => {
1392
- return PDF.Text(text).color("#D6C986");
1393
- },
1394
- numeric: (text) => {
1395
- return PDF.Text(text).color("#D6C986");
1396
- },
1397
- keyword: (text) => {
1398
- return PDF.Text(text).color("#EE8378").font_weight("bold");
1399
- },
1400
- operator: (text) => {
1401
- return PDF.Text(text).color("#EE8378").font_weight("bold");
1402
- },
1403
- preprocessor: (text) => {
1404
- return PDF.Text(text).color("#EE8378");
1405
- },
1406
- type_def: (text) => {
1407
- return PDF.Text(text).color("#C78BF0");
1408
- },
1409
- type: (text) => {
1410
- return PDF.Text(text).color("#5795F3");
1411
- },
1412
- parameter: (text) => {
1413
- return PDF.Text(text).color("#F9AE58");
1414
- }
1415
- };
1416
- if (tokens.length === 0) {
1417
- return null;
1418
- }
1419
- if (Array.isArray(tokens[0])) {
1420
- tokens.iterate((line_tokens) => {
1421
- const hstack = PDF.HStack();
1422
- line_tokens.iterate((token) => {
1423
- if (token.is_line_break) {
1424
- return null;
1425
- }
1426
- const token_class = token_classes[token.token];
1427
- if (token_class == null) {
1428
- hstack.append(PDF.Text(token.data));
1429
- } else {
1430
- hstack.append(token_class(token.data));
1431
- }
1432
- });
1433
- children.append(hstack);
1434
- });
1435
- return children;
1436
- } else {
1437
- const hstack = PDF.HStack();
1438
- tokens.iterate((token) => {
1439
- if (token.is_line_break) {
1440
- return null;
1441
- }
1442
- const token_class = token_classes[token.token];
1443
- if (token_class == null) {
1444
- hstack.append(PDF.Text(token.data));
1445
- } else {
1446
- hstack.append(token_class(token.data));
1447
- }
1448
- });
1449
- return hstack;
1450
- }
1451
- }
1452
- };
1453
- PDF.CodeBlock = function CodeBlock(...args) {
1454
- return new PDF.CodeBlockElement(...args);
1455
- };
1456
- module.exports = PDF;