@vandenberghinc/volt 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.libris/config.json +82 -0
- package/backend/dist/cjs/backend/src/blacklist.d.ts +12 -0
- package/backend/dist/cjs/backend/src/blacklist.js +78 -0
- package/backend/dist/cjs/backend/src/cli.d.ts +2 -0
- package/backend/dist/cjs/backend/src/cli.js +198 -0
- package/backend/dist/cjs/backend/src/database/collection.d.ts +1765 -0
- package/backend/dist/cjs/backend/src/database/collection.js +3301 -0
- package/backend/dist/cjs/backend/src/database/database.d.ts +92 -0
- package/backend/dist/cjs/backend/src/database/database.js +170 -0
- package/backend/dist/cjs/backend/src/database/document.d.ts +1 -0
- package/backend/dist/cjs/backend/src/database/document.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +6 -0
- package/backend/dist/cjs/backend/src/database/filters/filters.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.d.ts +1 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +443 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.d.ts +1 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +355 -0
- package/backend/dist/cjs/backend/src/database/flatten.d.ts +78 -0
- package/backend/dist/cjs/backend/src/database/flatten.js +53 -0
- package/backend/dist/cjs/backend/src/database/flatten_test.d.ts +1 -0
- package/backend/dist/cjs/backend/src/database/flatten_test.js +175 -0
- package/backend/dist/cjs/backend/src/database/quota/quoata_v2.d.ts +533 -0
- package/backend/dist/cjs/backend/src/database/quota/quoata_v2.js +1046 -0
- package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +551 -0
- package/backend/dist/cjs/backend/src/database/quota/quota.js +1108 -0
- package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +534 -0
- package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +1087 -0
- package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +412 -0
- package/backend/dist/cjs/backend/src/database/quota/safe_int.js +745 -0
- package/backend/dist/cjs/backend/src/endpoint.d.ts +346 -0
- package/backend/dist/cjs/backend/src/endpoint.js +468 -0
- package/backend/dist/cjs/backend/src/errors/index.d.ts +7 -0
- package/backend/dist/cjs/backend/src/errors/index.js +25 -0
- package/backend/dist/cjs/backend/src/errors/internal_external.d.ts +52 -0
- package/backend/dist/cjs/backend/src/errors/internal_external.js +95 -0
- package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +41 -0
- package/backend/dist/cjs/backend/src/errors/invalid_usage_error.js +47 -0
- package/backend/dist/cjs/backend/src/errors/system_error.d.ts +261 -0
- package/backend/dist/cjs/backend/src/errors/system_error.js +436 -0
- package/backend/dist/cjs/backend/src/events.d.ts +97 -0
- package/backend/dist/cjs/backend/src/events.js +15 -0
- package/backend/dist/cjs/backend/src/frontend.d.ts +13 -0
- package/backend/dist/cjs/backend/src/frontend.js +56 -0
- package/backend/dist/cjs/backend/src/image_endpoint.d.ts +44 -0
- package/backend/dist/cjs/backend/src/image_endpoint.js +185 -0
- package/backend/dist/cjs/backend/src/index.d.ts +23 -0
- package/backend/dist/cjs/backend/src/index.js +70 -0
- package/backend/dist/cjs/backend/src/logger.d.ts +5 -0
- package/backend/dist/cjs/backend/src/logger.js +15 -0
- package/backend/dist/cjs/backend/src/meta.d.ts +112 -0
- package/backend/dist/cjs/backend/src/meta.js +181 -0
- package/backend/dist/cjs/backend/src/payments/paddle.d.ts +329 -0
- package/backend/dist/cjs/backend/src/payments/paddle.js +1996 -0
- package/backend/dist/cjs/backend/src/payments/stripe/checkout.d.ts +113 -0
- package/backend/dist/cjs/backend/src/payments/stripe/checkout.js +295 -0
- package/backend/dist/cjs/backend/src/payments/stripe/customers.d.ts +17 -0
- package/backend/dist/cjs/backend/src/payments/stripe/customers.js +164 -0
- package/backend/dist/cjs/backend/src/payments/stripe/error.d.ts +74 -0
- package/backend/dist/cjs/backend/src/payments/stripe/error.js +64 -0
- package/backend/dist/cjs/backend/src/payments/stripe/events.d.ts +155 -0
- package/backend/dist/cjs/backend/src/payments/stripe/events.js +15 -0
- package/backend/dist/cjs/backend/src/payments/stripe/meters.d.ts +105 -0
- package/backend/dist/cjs/backend/src/payments/stripe/meters.js +230 -0
- package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.d.ts +58 -0
- package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.js +109 -0
- package/backend/dist/cjs/backend/src/payments/stripe/products.d.ts +519 -0
- package/backend/dist/cjs/backend/src/payments/stripe/products.js +650 -0
- package/backend/dist/cjs/backend/src/payments/stripe/stripe.d.ts +215 -0
- package/backend/dist/cjs/backend/src/payments/stripe/stripe.js +468 -0
- package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.d.ts +172 -0
- package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.js +557 -0
- package/backend/dist/cjs/backend/src/payments/stripe/utils.d.ts +63 -0
- package/backend/dist/cjs/backend/src/payments/stripe/utils.js +118 -0
- package/backend/dist/cjs/backend/src/payments/stripe/webhooks.d.ts +105 -0
- package/backend/dist/cjs/backend/src/payments/stripe/webhooks.js +627 -0
- package/backend/dist/cjs/backend/src/plugins/browser.d.ts +1 -0
- package/backend/dist/cjs/backend/src/plugins/browser.js +15 -0
- package/backend/dist/cjs/backend/src/plugins/communication.d.ts +70 -0
- package/backend/dist/cjs/backend/src/plugins/communication.js +196 -0
- package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +255 -0
- package/backend/dist/cjs/backend/src/plugins/mail/mail.js +381 -0
- package/backend/dist/cjs/backend/src/plugins/mail/ui.d.ts +297 -0
- package/backend/dist/cjs/backend/src/plugins/mail/ui.js +1370 -0
- package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +1 -0
- package/backend/dist/cjs/backend/src/plugins/pdf.js +1456 -0
- package/backend/dist/cjs/backend/src/plugins/thread_monitor.d.ts +18 -0
- package/backend/dist/cjs/backend/src/plugins/thread_monitor.js +116 -0
- package/backend/dist/cjs/backend/src/rate_limit.d.ts +148 -0
- package/backend/dist/cjs/backend/src/rate_limit.js +543 -0
- package/backend/dist/cjs/backend/src/route.d.ts +39 -0
- package/backend/dist/cjs/backend/src/route.js +172 -0
- package/backend/dist/cjs/backend/src/server.d.ts +502 -0
- package/backend/dist/cjs/backend/src/server.js +1710 -0
- package/backend/dist/cjs/backend/src/server.old.d.ts +594 -0
- package/backend/dist/cjs/backend/src/server.old.js +2058 -0
- package/backend/dist/cjs/backend/src/splash_screen.d.ts +93 -0
- package/backend/dist/cjs/backend/src/splash_screen.js +119 -0
- package/backend/dist/cjs/backend/src/status.d.ts +89 -0
- package/backend/dist/cjs/backend/src/status.js +211 -0
- package/backend/dist/cjs/backend/src/stream.d.ts +494 -0
- package/backend/dist/cjs/backend/src/stream.js +1370 -0
- package/backend/dist/cjs/backend/src/users.d.ts +926 -0
- package/backend/dist/cjs/backend/src/users.js +2223 -0
- package/backend/dist/cjs/backend/src/utils.d.ts +22 -0
- package/backend/dist/cjs/backend/src/utils.js +626 -0
- package/backend/dist/cjs/backend/src/view.d.ts +115 -0
- package/backend/dist/cjs/backend/src/view.js +519 -0
- package/backend/dist/cjs/backend/src/vinc.d.ts +6 -0
- package/backend/dist/cjs/backend/src/vinc.js +40 -0
- package/backend/dist/cjs/backend/src/volt.d.ts +24 -0
- package/backend/dist/cjs/backend/src/volt.js +72 -0
- package/backend/dist/cjs/frontend/src/modules/request.d.ts +70 -0
- package/backend/dist/cjs/frontend/src/modules/request.js +99 -0
- package/backend/dist/cjs/package.json +1 -0
- package/backend/dist/esm/backend/src/blacklist.d.ts +12 -0
- package/backend/dist/esm/backend/src/blacklist.js +52 -0
- package/backend/dist/esm/backend/src/cli.d.ts +2 -0
- package/backend/dist/esm/backend/src/cli.js +211 -0
- package/backend/dist/esm/backend/src/database/collection.d.ts +1765 -0
- package/backend/dist/esm/backend/src/database/collection.js +3779 -0
- package/backend/dist/esm/backend/src/database/database.d.ts +92 -0
- package/backend/dist/esm/backend/src/database/database.js +214 -0
- package/backend/dist/esm/backend/src/database/document.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/document.js +558 -0
- package/backend/dist/esm/backend/src/database/filters/filters.d.ts +6 -0
- package/backend/dist/esm/backend/src/database/filters/filters.js +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter.js +3 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +505 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +712 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +44 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +415 -0
- package/backend/dist/esm/backend/src/database/flatten.d.ts +78 -0
- package/backend/dist/esm/backend/src/database/flatten.js +22 -0
- package/backend/dist/esm/backend/src/database/flatten_test.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/flatten_test.js +174 -0
- package/backend/dist/esm/backend/src/database/quota/quoata_v2.d.ts +533 -0
- package/backend/dist/esm/backend/src/database/quota/quoata_v2.js +1155 -0
- package/backend/dist/esm/backend/src/database/quota/quota.d.ts +551 -0
- package/backend/dist/esm/backend/src/database/quota/quota.js +1219 -0
- package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +534 -0
- package/backend/dist/esm/backend/src/database/quota/quota_v1.js +1242 -0
- package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +412 -0
- package/backend/dist/esm/backend/src/database/quota/safe_int.js +810 -0
- package/backend/dist/esm/backend/src/endpoint.d.ts +346 -0
- package/backend/dist/esm/backend/src/endpoint.js +479 -0
- package/backend/dist/esm/backend/src/errors/index.d.ts +7 -0
- package/backend/dist/esm/backend/src/errors/index.js +7 -0
- package/backend/dist/esm/backend/src/errors/internal_external.d.ts +52 -0
- package/backend/dist/esm/backend/src/errors/internal_external.js +86 -0
- package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +41 -0
- package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +33 -0
- package/backend/dist/esm/backend/src/errors/system_error.d.ts +261 -0
- package/backend/dist/esm/backend/src/errors/system_error.js +444 -0
- package/backend/dist/esm/backend/src/events.d.ts +97 -0
- package/backend/dist/esm/backend/src/events.js +5 -0
- package/backend/dist/esm/backend/src/frontend.d.ts +13 -0
- package/backend/dist/esm/backend/src/frontend.js +23 -0
- package/backend/dist/esm/backend/src/image_endpoint.d.ts +44 -0
- package/backend/dist/esm/backend/src/image_endpoint.js +196 -0
- package/backend/dist/esm/backend/src/index.d.ts +23 -0
- package/backend/dist/esm/backend/src/index.js +26 -0
- package/backend/dist/esm/backend/src/logger.d.ts +5 -0
- package/backend/dist/esm/backend/src/logger.js +8 -0
- package/backend/dist/esm/backend/src/meta.d.ts +112 -0
- package/backend/dist/esm/backend/src/meta.js +152 -0
- package/backend/dist/esm/backend/src/payments/paddle.d.ts +329 -0
- package/backend/dist/esm/backend/src/payments/paddle.js +2276 -0
- package/backend/dist/esm/backend/src/payments/stripe/checkout.d.ts +113 -0
- package/backend/dist/esm/backend/src/payments/stripe/checkout.js +356 -0
- package/backend/dist/esm/backend/src/payments/stripe/customers.d.ts +17 -0
- package/backend/dist/esm/backend/src/payments/stripe/customers.js +193 -0
- package/backend/dist/esm/backend/src/payments/stripe/error.d.ts +74 -0
- package/backend/dist/esm/backend/src/payments/stripe/error.js +51 -0
- package/backend/dist/esm/backend/src/payments/stripe/events.d.ts +155 -0
- package/backend/dist/esm/backend/src/payments/stripe/events.js +5 -0
- package/backend/dist/esm/backend/src/payments/stripe/meters.d.ts +105 -0
- package/backend/dist/esm/backend/src/payments/stripe/meters.js +318 -0
- package/backend/dist/esm/backend/src/payments/stripe/payment_methods.d.ts +58 -0
- package/backend/dist/esm/backend/src/payments/stripe/payment_methods.js +135 -0
- package/backend/dist/esm/backend/src/payments/stripe/products.d.ts +519 -0
- package/backend/dist/esm/backend/src/payments/stripe/products.js +896 -0
- package/backend/dist/esm/backend/src/payments/stripe/stripe.d.ts +215 -0
- package/backend/dist/esm/backend/src/payments/stripe/stripe.js +464 -0
- package/backend/dist/esm/backend/src/payments/stripe/subscriptions.d.ts +172 -0
- package/backend/dist/esm/backend/src/payments/stripe/subscriptions.js +754 -0
- package/backend/dist/esm/backend/src/payments/stripe/utils.d.ts +63 -0
- package/backend/dist/esm/backend/src/payments/stripe/utils.js +131 -0
- package/backend/dist/esm/backend/src/payments/stripe/webhooks.d.ts +105 -0
- package/backend/dist/esm/backend/src/payments/stripe/webhooks.js +752 -0
- package/backend/dist/esm/backend/src/plugins/browser.d.ts +1 -0
- package/backend/dist/esm/backend/src/plugins/browser.js +170 -0
- package/backend/dist/esm/backend/src/plugins/communication.d.ts +70 -0
- package/backend/dist/esm/backend/src/plugins/communication.js +169 -0
- package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +255 -0
- package/backend/dist/esm/backend/src/plugins/mail/mail.js +396 -0
- package/backend/dist/esm/backend/src/plugins/mail/ui.d.ts +297 -0
- package/backend/dist/esm/backend/src/plugins/mail/ui.js +1400 -0
- package/backend/dist/esm/backend/src/plugins/pdf.d.ts +1 -0
- package/backend/dist/esm/backend/src/plugins/pdf.js +1694 -0
- package/backend/dist/esm/backend/src/plugins/thread_monitor.d.ts +18 -0
- package/backend/dist/esm/backend/src/plugins/thread_monitor.js +120 -0
- package/backend/dist/esm/backend/src/rate_limit.d.ts +148 -0
- package/backend/dist/esm/backend/src/rate_limit.js +667 -0
- package/backend/dist/esm/backend/src/route.d.ts +39 -0
- package/backend/dist/esm/backend/src/route.js +222 -0
- package/backend/dist/esm/backend/src/server.d.ts +502 -0
- package/backend/dist/esm/backend/src/server.js +2031 -0
- package/backend/dist/esm/backend/src/server.old.d.ts +594 -0
- package/backend/dist/esm/backend/src/server.old.js +2630 -0
- package/backend/dist/esm/backend/src/splash_screen.d.ts +93 -0
- package/backend/dist/esm/backend/src/splash_screen.js +156 -0
- package/backend/dist/esm/backend/src/status.d.ts +89 -0
- package/backend/dist/esm/backend/src/status.js +213 -0
- package/backend/dist/esm/backend/src/stream.d.ts +494 -0
- package/backend/dist/esm/backend/src/stream.js +1611 -0
- package/backend/dist/esm/backend/src/users.d.ts +926 -0
- package/backend/dist/esm/backend/src/users.js +2423 -0
- package/backend/dist/esm/backend/src/utils.d.ts +22 -0
- package/backend/dist/esm/backend/src/utils.js +463 -0
- package/backend/dist/esm/backend/src/view.d.ts +115 -0
- package/backend/dist/esm/backend/src/view.js +584 -0
- package/backend/dist/esm/backend/src/vinc.d.ts +6 -0
- package/backend/dist/esm/backend/src/vinc.js +6 -0
- package/backend/dist/esm/backend/src/volt.d.ts +24 -0
- package/backend/dist/esm/backend/src/volt.js +27 -0
- package/backend/dist/esm/frontend/src/modules/request.d.ts +70 -0
- package/backend/dist/esm/frontend/src/modules/request.js +117 -0
- package/backend/old/file_watcher.ts +359 -0
- package/backend/old/request.deprc.js +626 -0
- package/backend/old/response.deprc.js +354 -0
- package/frontend/dist/backend/src/database/collection.d.ts +1765 -0
- package/frontend/dist/backend/src/database/collection.js +3779 -0
- package/frontend/dist/backend/src/database/database.d.ts +92 -0
- package/frontend/dist/backend/src/database/database.js +214 -0
- package/frontend/dist/backend/src/database/filters/filters.d.ts +6 -0
- package/frontend/dist/backend/src/database/filters/filters.js +1 -0
- package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/frontend/dist/backend/src/database/filters/strict_filter.js +3 -0
- package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/frontend/dist/backend/src/database/filters/strict_update_filter.js +5 -0
- package/frontend/dist/backend/src/database/flatten.d.ts +78 -0
- package/frontend/dist/backend/src/database/flatten.js +22 -0
- package/frontend/dist/backend/src/endpoint.d.ts +346 -0
- package/frontend/dist/backend/src/endpoint.js +479 -0
- package/frontend/dist/backend/src/errors/index.d.ts +7 -0
- package/frontend/dist/backend/src/errors/index.js +7 -0
- package/frontend/dist/backend/src/errors/internal_external.d.ts +52 -0
- package/frontend/dist/backend/src/errors/internal_external.js +86 -0
- package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +41 -0
- package/frontend/dist/backend/src/errors/invalid_usage_error.js +33 -0
- package/frontend/dist/backend/src/errors/system_error.d.ts +261 -0
- package/frontend/dist/backend/src/errors/system_error.js +444 -0
- package/frontend/dist/backend/src/events.d.ts +97 -0
- package/frontend/dist/backend/src/events.js +5 -0
- package/frontend/dist/backend/src/frontend.d.ts +13 -0
- package/frontend/dist/backend/src/frontend.js +23 -0
- package/frontend/dist/backend/src/image_endpoint.d.ts +44 -0
- package/frontend/dist/backend/src/image_endpoint.js +196 -0
- package/frontend/dist/backend/src/meta.d.ts +112 -0
- package/frontend/dist/backend/src/meta.js +152 -0
- package/frontend/dist/backend/src/payments/paddle.d.ts +329 -0
- package/frontend/dist/backend/src/payments/paddle.js +2276 -0
- package/frontend/dist/backend/src/payments/stripe/checkout.d.ts +113 -0
- package/frontend/dist/backend/src/payments/stripe/checkout.js +356 -0
- package/frontend/dist/backend/src/payments/stripe/customers.d.ts +17 -0
- package/frontend/dist/backend/src/payments/stripe/customers.js +193 -0
- package/frontend/dist/backend/src/payments/stripe/error.d.ts +74 -0
- package/frontend/dist/backend/src/payments/stripe/error.js +51 -0
- package/frontend/dist/backend/src/payments/stripe/events.d.ts +155 -0
- package/frontend/dist/backend/src/payments/stripe/events.js +5 -0
- package/frontend/dist/backend/src/payments/stripe/meters.d.ts +105 -0
- package/frontend/dist/backend/src/payments/stripe/meters.js +318 -0
- package/frontend/dist/backend/src/payments/stripe/payment_methods.d.ts +58 -0
- package/frontend/dist/backend/src/payments/stripe/payment_methods.js +135 -0
- package/frontend/dist/backend/src/payments/stripe/products.d.ts +519 -0
- package/frontend/dist/backend/src/payments/stripe/products.js +896 -0
- package/frontend/dist/backend/src/payments/stripe/stripe.d.ts +215 -0
- package/frontend/dist/backend/src/payments/stripe/stripe.js +464 -0
- package/frontend/dist/backend/src/payments/stripe/subscriptions.d.ts +172 -0
- package/frontend/dist/backend/src/payments/stripe/subscriptions.js +754 -0
- package/frontend/dist/backend/src/payments/stripe/utils.d.ts +63 -0
- package/frontend/dist/backend/src/payments/stripe/utils.js +131 -0
- package/frontend/dist/backend/src/payments/stripe/webhooks.d.ts +105 -0
- package/frontend/dist/backend/src/payments/stripe/webhooks.js +752 -0
- package/frontend/dist/backend/src/plugins/mail/mail.d.ts +255 -0
- package/frontend/dist/backend/src/plugins/mail/mail.js +396 -0
- package/frontend/dist/backend/src/plugins/mail/ui.d.ts +297 -0
- package/frontend/dist/backend/src/plugins/mail/ui.js +1400 -0
- package/frontend/dist/backend/src/rate_limit.d.ts +148 -0
- package/frontend/dist/backend/src/rate_limit.js +667 -0
- package/frontend/dist/backend/src/route.d.ts +39 -0
- package/frontend/dist/backend/src/route.js +222 -0
- package/frontend/dist/backend/src/server.d.ts +502 -0
- package/frontend/dist/backend/src/server.js +2031 -0
- package/frontend/dist/backend/src/splash_screen.d.ts +93 -0
- package/frontend/dist/backend/src/splash_screen.js +156 -0
- package/frontend/dist/backend/src/status.d.ts +89 -0
- package/frontend/dist/backend/src/status.js +213 -0
- package/frontend/dist/backend/src/stream.d.ts +494 -0
- package/frontend/dist/backend/src/stream.js +1611 -0
- package/frontend/dist/backend/src/users.d.ts +926 -0
- package/frontend/dist/backend/src/users.js +2423 -0
- package/frontend/dist/backend/src/utils.d.ts +22 -0
- package/frontend/dist/backend/src/utils.js +463 -0
- package/frontend/dist/backend/src/view.d.ts +115 -0
- package/frontend/dist/backend/src/view.js +584 -0
- package/frontend/dist/frontend/src/css/adyen.css +92 -0
- package/frontend/dist/frontend/src/css/volt.css +75 -0
- package/frontend/dist/frontend/src/elements/base.d.ts +3743 -0
- package/frontend/dist/frontend/src/elements/base.js +12151 -0
- package/frontend/dist/frontend/src/elements/module.d.ts +95 -0
- package/frontend/dist/frontend/src/elements/module.js +216 -0
- package/frontend/dist/frontend/src/elements/register_element.d.ts +3 -0
- package/frontend/dist/frontend/src/elements/register_element.js +22 -0
- package/frontend/dist/frontend/src/elements/resize_query_manager.d.ts +0 -0
- package/frontend/dist/frontend/src/elements/resize_query_manager.js +150 -0
- package/frontend/dist/frontend/src/elements/types.d.ts +52 -0
- package/frontend/dist/frontend/src/elements/types.js +5 -0
- package/frontend/dist/frontend/src/index.d.ts +21 -0
- package/frontend/dist/frontend/src/index.js +29 -0
- package/frontend/dist/frontend/src/modules/attachment.d.ts +126 -0
- package/frontend/dist/frontend/src/modules/attachment.js +306 -0
- package/frontend/dist/frontend/src/modules/auth.d.ts +44 -0
- package/frontend/dist/frontend/src/modules/auth.js +80 -0
- package/frontend/dist/frontend/src/modules/color.d.ts +160 -0
- package/frontend/dist/frontend/src/modules/color.js +316 -0
- package/frontend/dist/frontend/src/modules/compression.d.ts +39 -0
- package/frontend/dist/frontend/src/modules/compression.js +102 -0
- package/frontend/dist/frontend/src/modules/cookies.d.ts +44 -0
- package/frontend/dist/frontend/src/modules/cookies.js +143 -0
- package/frontend/dist/frontend/src/modules/events.d.ts +31 -0
- package/frontend/dist/frontend/src/modules/events.js +79 -0
- package/frontend/dist/frontend/src/modules/google.d.ts +23 -0
- package/frontend/dist/frontend/src/modules/google.js +52 -0
- package/frontend/dist/frontend/src/modules/meta.d.ts +14 -0
- package/frontend/dist/frontend/src/modules/meta.js +48 -0
- package/frontend/dist/frontend/src/modules/paddle.d.ts +1207 -0
- package/frontend/dist/frontend/src/modules/paddle.js +2594 -0
- package/frontend/dist/frontend/src/modules/request.d.ts +70 -0
- package/frontend/dist/frontend/src/modules/request.js +117 -0
- package/frontend/dist/frontend/src/modules/settings.d.ts +3 -0
- package/frontend/dist/frontend/src/modules/settings.js +5 -0
- package/frontend/dist/frontend/src/modules/statics.d.ts +21 -0
- package/frontend/dist/frontend/src/modules/statics.js +43 -0
- package/frontend/dist/frontend/src/modules/stripe/cart.d.ts +112 -0
- package/frontend/dist/frontend/src/modules/stripe/cart.js +321 -0
- package/frontend/dist/frontend/src/modules/stripe/checkout.d.ts +7 -0
- package/frontend/dist/frontend/src/modules/stripe/checkout.js +37 -0
- package/frontend/dist/frontend/src/modules/stripe/index.m.d.ts +6 -0
- package/frontend/dist/frontend/src/modules/stripe/index.m.js +6 -0
- package/frontend/dist/frontend/src/modules/stripe/payments.d.ts +58 -0
- package/frontend/dist/frontend/src/modules/stripe/payments.js +92 -0
- package/frontend/dist/frontend/src/modules/support.d.ts +30 -0
- package/frontend/dist/frontend/src/modules/support.js +53 -0
- package/frontend/dist/frontend/src/modules/theme.d.ts +133 -0
- package/frontend/dist/frontend/src/modules/theme.js +406 -0
- package/frontend/dist/frontend/src/modules/themes.d.ts +12 -0
- package/frontend/dist/frontend/src/modules/themes.js +22 -0
- package/frontend/dist/frontend/src/modules/user.d.ts +164 -0
- package/frontend/dist/frontend/src/modules/user.js +270 -0
- package/frontend/dist/frontend/src/modules/utils.d.ts +176 -0
- package/frontend/dist/frontend/src/modules/utils.js +569 -0
- package/frontend/dist/frontend/src/types/gradient.d.ts +29 -0
- package/frontend/dist/frontend/src/types/gradient.js +79 -0
- package/frontend/dist/frontend/src/ui/border_button.d.ts +94 -0
- package/frontend/dist/frontend/src/ui/border_button.js +228 -0
- package/frontend/dist/frontend/src/ui/button.d.ts +241 -0
- package/frontend/dist/frontend/src/ui/button.js +682 -0
- package/frontend/dist/frontend/src/ui/canvas.d.ts +138 -0
- package/frontend/dist/frontend/src/ui/canvas.js +444 -0
- package/frontend/dist/frontend/src/ui/checkbox.d.ts +74 -0
- package/frontend/dist/frontend/src/ui/checkbox.js +321 -0
- package/frontend/dist/frontend/src/ui/code.d.ts +235 -0
- package/frontend/dist/frontend/src/ui/code.js +1007 -0
- package/frontend/dist/frontend/src/ui/context_menu.d.ts +36 -0
- package/frontend/dist/frontend/src/ui/context_menu.js +205 -0
- package/frontend/dist/frontend/src/ui/css.d.ts +16 -0
- package/frontend/dist/frontend/src/ui/css.js +48 -0
- package/frontend/dist/frontend/src/ui/divider.d.ts +15 -0
- package/frontend/dist/frontend/src/ui/divider.js +78 -0
- package/frontend/dist/frontend/src/ui/dropdown.d.ts +176 -0
- package/frontend/dist/frontend/src/ui/dropdown.js +481 -0
- package/frontend/dist/frontend/src/ui/for_each.d.ts +37 -0
- package/frontend/dist/frontend/src/ui/for_each.js +92 -0
- package/frontend/dist/frontend/src/ui/form.d.ts +34 -0
- package/frontend/dist/frontend/src/ui/form.js +233 -0
- package/frontend/dist/frontend/src/ui/frame_modes.d.ts +37 -0
- package/frontend/dist/frontend/src/ui/frame_modes.js +108 -0
- package/frontend/dist/frontend/src/ui/google_map.d.ts +24 -0
- package/frontend/dist/frontend/src/ui/google_map.js +106 -0
- package/frontend/dist/frontend/src/ui/gradient.d.ts +25 -0
- package/frontend/dist/frontend/src/ui/gradient.js +131 -0
- package/frontend/dist/frontend/src/ui/image.d.ts +111 -0
- package/frontend/dist/frontend/src/ui/image.js +576 -0
- package/frontend/dist/frontend/src/ui/input.d.ts +392 -0
- package/frontend/dist/frontend/src/ui/input.js +1201 -0
- package/frontend/dist/frontend/src/ui/link.d.ts +25 -0
- package/frontend/dist/frontend/src/ui/link.js +140 -0
- package/frontend/dist/frontend/src/ui/list.d.ts +37 -0
- package/frontend/dist/frontend/src/ui/list.js +170 -0
- package/frontend/dist/frontend/src/ui/loader_button.d.ts +80 -0
- package/frontend/dist/frontend/src/ui/loader_button.js +193 -0
- package/frontend/dist/frontend/src/ui/loaders.d.ts +57 -0
- package/frontend/dist/frontend/src/ui/loaders.js +157 -0
- package/frontend/dist/frontend/src/ui/popup.d.ts +94 -0
- package/frontend/dist/frontend/src/ui/popup.js +510 -0
- package/frontend/dist/frontend/src/ui/pseudo.d.ts +44 -0
- package/frontend/dist/frontend/src/ui/pseudo.js +154 -0
- package/frontend/dist/frontend/src/ui/scroller.d.ts +105 -0
- package/frontend/dist/frontend/src/ui/scroller.js +1253 -0
- package/frontend/dist/frontend/src/ui/slider.d.ts +45 -0
- package/frontend/dist/frontend/src/ui/slider.js +217 -0
- package/frontend/dist/frontend/src/ui/spacer.d.ts +15 -0
- package/frontend/dist/frontend/src/ui/spacer.js +78 -0
- package/frontend/dist/frontend/src/ui/span.d.ts +15 -0
- package/frontend/dist/frontend/src/ui/span.js +73 -0
- package/frontend/dist/frontend/src/ui/stack.d.ts +66 -0
- package/frontend/dist/frontend/src/ui/stack.js +335 -0
- package/frontend/dist/frontend/src/ui/steps.d.ts +131 -0
- package/frontend/dist/frontend/src/ui/steps.js +308 -0
- package/frontend/dist/frontend/src/ui/style.d.ts +17 -0
- package/frontend/dist/frontend/src/ui/style.js +73 -0
- package/frontend/dist/frontend/src/ui/switch.d.ts +69 -0
- package/frontend/dist/frontend/src/ui/switch.js +357 -0
- package/frontend/dist/frontend/src/ui/table.d.ts +100 -0
- package/frontend/dist/frontend/src/ui/table.js +405 -0
- package/frontend/dist/frontend/src/ui/tabs.d.ts +111 -0
- package/frontend/dist/frontend/src/ui/tabs.js +424 -0
- package/frontend/dist/frontend/src/ui/text.d.ts +15 -0
- package/frontend/dist/frontend/src/ui/text.js +83 -0
- package/frontend/dist/frontend/src/ui/title.d.ts +91 -0
- package/frontend/dist/frontend/src/ui/title.js +272 -0
- package/frontend/dist/frontend/src/ui/ui.d.ts +35 -0
- package/frontend/dist/frontend/src/ui/ui.js +38 -0
- package/frontend/dist/frontend/src/ui/view.d.ts +15 -0
- package/frontend/dist/frontend/src/ui/view.js +88 -0
- package/frontend/dist/frontend/src/volt.d.ts +20 -0
- package/frontend/dist/frontend/src/volt.js +27 -0
- package/frontend/examples/theme/theme.ts +58 -0
- package/frontend/tools/bundle_d_ts.js +71 -0
- package/frontend/tools/convert_to_jsdoc_input.txt +9452 -0
- package/frontend/tools/convert_to_jsdoc_output.txt +7626 -0
- package/frontend/tools/convert_to_jsdoc_tmp.js +345 -0
- package/frontend/tools/scan_mixed_imports.js +69 -0
- package/package.json +1 -5
|
@@ -0,0 +1,1694 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
// ---------------------------------------------------------
|
|
6
|
+
// Imports.
|
|
7
|
+
const { vlib, vhighlight } = require("../vinc.js");
|
|
8
|
+
const { jsPDF } = require("jspdf");
|
|
9
|
+
const libfs = require("fs");
|
|
10
|
+
// ---------------------------------------------------------
|
|
11
|
+
// The mail object.
|
|
12
|
+
const PDF = {
|
|
13
|
+
// Use pixels instead of points (NOT ADVISED).
|
|
14
|
+
// use_pixels: false,
|
|
15
|
+
// Get opacity from hex as a floating number 0/1, returns `null` on no opacity.
|
|
16
|
+
hex_opacity(hex) {
|
|
17
|
+
if ((typeof hex !== "string" && hex instanceof String === false) ||
|
|
18
|
+
hex.charAt(0) !== "#" ||
|
|
19
|
+
hex.length <= 7) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const opacity = parseInt(hex.slice(-2)) / 100;
|
|
23
|
+
return isNaN(opacity) ? null : opacity;
|
|
24
|
+
},
|
|
25
|
+
// Convert hex to rgb(a), since pdfkit does not support a hex with opacity.
|
|
26
|
+
hex_to_rgb(hex) {
|
|
27
|
+
// Not a string.
|
|
28
|
+
if (typeof hex !== "string" && hex instanceof String === false) {
|
|
29
|
+
return hex;
|
|
30
|
+
}
|
|
31
|
+
// Not a hex.
|
|
32
|
+
if (hex.charAt(0) !== "#") {
|
|
33
|
+
return hex; // perhaps a normal color like "blue".
|
|
34
|
+
}
|
|
35
|
+
// Remove the hash (#).
|
|
36
|
+
hex = hex.slice(1);
|
|
37
|
+
// Parse alpha
|
|
38
|
+
let alpha = 1;
|
|
39
|
+
if (hex.length > 6) {
|
|
40
|
+
alpha = parseInt(hex.slice(-2)) / 100;
|
|
41
|
+
hex = hex.slice(0, -2);
|
|
42
|
+
}
|
|
43
|
+
// Parse the hex color.
|
|
44
|
+
const bigint = parseInt(hex, 16);
|
|
45
|
+
const r = (bigint >> 16) & 255;
|
|
46
|
+
const g = (bigint >> 8) & 255;
|
|
47
|
+
const b = bigint & 255;
|
|
48
|
+
// Return the rgb(a) color.
|
|
49
|
+
if (alpha != 1) {
|
|
50
|
+
return [r, g, b, alpha];
|
|
51
|
+
// return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
52
|
+
}
|
|
53
|
+
return [r, g, b];
|
|
54
|
+
// return `rgb(${r}, ${g}, ${b})`;
|
|
55
|
+
},
|
|
56
|
+
hex_to_cmyk(hex) {
|
|
57
|
+
// Remove the hash if present
|
|
58
|
+
// hex = hex.slice(1);
|
|
59
|
+
// // Convert hex to decimal
|
|
60
|
+
// const r = parseInt(hex.substring(0, 2), 16) / 255;
|
|
61
|
+
// const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
62
|
+
// const b = parseInt(hex.substring(4, 6), 16) / 255;
|
|
63
|
+
// // Calculate CMY
|
|
64
|
+
// let c = 1 - r;
|
|
65
|
+
// let m = 1 - g;
|
|
66
|
+
// let y = 1 - b;
|
|
67
|
+
// // Calculate K (black)
|
|
68
|
+
// let k = Math.min(c, m, y);
|
|
69
|
+
// // Adjust CMY values
|
|
70
|
+
// c = (c - k) / (1 - k);
|
|
71
|
+
// m = (m - k) / (1 - k);
|
|
72
|
+
// y = (y - k) / (1 - k);
|
|
73
|
+
// // Round values to make them more manageable
|
|
74
|
+
// c = Math.round(c * 100);
|
|
75
|
+
// m = Math.round(m * 100);
|
|
76
|
+
// y = Math.round(y * 100);
|
|
77
|
+
// k = Math.round(k * 100);
|
|
78
|
+
// return [c, m, y, k];
|
|
79
|
+
// Convert hex to decimal
|
|
80
|
+
// const r = parseInt(hex.substring(0, 2), 16) / 255;
|
|
81
|
+
// const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
82
|
+
// const b = parseInt(hex.substring(4, 6), 16) / 255;
|
|
83
|
+
// // Find the maximum of RGB
|
|
84
|
+
// const max = Math.max(r, g, b);
|
|
85
|
+
// // Calculate K (black)
|
|
86
|
+
// const k = 1 - max;
|
|
87
|
+
// // Calculate CMY, considering white (1) is subtracted from RGB
|
|
88
|
+
// const c = (1 - r - k) / (1 - k);
|
|
89
|
+
// const m = (1 - g - k) / (1 - k);
|
|
90
|
+
// const y = (1 - b - k) / (1 - k);
|
|
91
|
+
// // Round values to make them more manageable
|
|
92
|
+
// const cPercent = Math.round(c * 100);
|
|
93
|
+
// const mPercent = Math.round(m * 100);
|
|
94
|
+
// const yPercent = Math.round(y * 100);
|
|
95
|
+
// const kPercent = Math.round(k * 100);
|
|
96
|
+
// return [cPercent, mPercent, yPercent, kPercent];
|
|
97
|
+
// TO RGB.
|
|
98
|
+
// Not a string.
|
|
99
|
+
if (typeof hex !== "string" && hex instanceof String === false) {
|
|
100
|
+
return hex;
|
|
101
|
+
}
|
|
102
|
+
// Not a hex.
|
|
103
|
+
if (hex.charAt(0) !== "#") {
|
|
104
|
+
return hex; // perhaps a normal color like "blue".
|
|
105
|
+
}
|
|
106
|
+
// Remove the hash (#).
|
|
107
|
+
hex = hex.slice(1);
|
|
108
|
+
// Parse alpha
|
|
109
|
+
let alpha = 1;
|
|
110
|
+
if (hex.length > 6) {
|
|
111
|
+
alpha = parseInt(hex.slice(-2)) / 100;
|
|
112
|
+
hex = hex.slice(0, -2);
|
|
113
|
+
}
|
|
114
|
+
// Parse the hex color.
|
|
115
|
+
const bigint = parseInt(hex, 16);
|
|
116
|
+
let r = (bigint >> 16) & 255;
|
|
117
|
+
let g = (bigint >> 8) & 255;
|
|
118
|
+
let b = bigint & 255;
|
|
119
|
+
// TO CMYK.
|
|
120
|
+
var computedC = 0;
|
|
121
|
+
var computedM = 0;
|
|
122
|
+
var computedY = 0;
|
|
123
|
+
var computedK = 0;
|
|
124
|
+
//remove spaces from input RGB values, convert to int
|
|
125
|
+
r = parseInt(('' + r).replace(/\s/g, ''), 10);
|
|
126
|
+
g = parseInt(('' + g).replace(/\s/g, ''), 10);
|
|
127
|
+
b = parseInt(('' + b).replace(/\s/g, ''), 10);
|
|
128
|
+
if (r == null || g == null || b == null ||
|
|
129
|
+
isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
130
|
+
console.error('Please enter numeric RGB values!');
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (r < 0 || g < 0 || b < 0 || r > 255 || g > 255 || b > 255) {
|
|
134
|
+
console.error('RGB values must be in the range 0 to 255.');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// BLACK
|
|
138
|
+
if (r == 0 && g == 0 && b == 0) {
|
|
139
|
+
computedK = 1;
|
|
140
|
+
return [0, 0, 0, 1];
|
|
141
|
+
}
|
|
142
|
+
computedC = 1 - (r / 255);
|
|
143
|
+
computedM = 1 - (g / 255);
|
|
144
|
+
computedY = 1 - (b / 255);
|
|
145
|
+
var minCMY = Math.min(computedC, Math.min(computedM, computedY));
|
|
146
|
+
computedC = Math.round((computedC - minCMY) / (1 - minCMY) * 100);
|
|
147
|
+
computedM = Math.round((computedM - minCMY) / (1 - minCMY) * 100);
|
|
148
|
+
computedY = Math.round((computedY - minCMY) / (1 - minCMY) * 100);
|
|
149
|
+
computedK = Math.round(minCMY * 100);
|
|
150
|
+
// return [93, 2, 91, 6]
|
|
151
|
+
// return [0, 0, 0, 0]
|
|
152
|
+
return [computedC, computedM, computedY, computedK];
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
// ---------------------------------------------------------
|
|
156
|
+
// The pdf base element
|
|
157
|
+
// Element.
|
|
158
|
+
class Computed {
|
|
159
|
+
static ids = 0;
|
|
160
|
+
constructor({ start_x, start_y, resume_x, resume_y, inner_width = 0, // inner width without padding or margin.
|
|
161
|
+
inner_height = 0, // inner height without padding or margin.
|
|
162
|
+
is_absolute = false, is_wrapped = false, start_page = 0, end_page = 0, _padding, _margin, }) {
|
|
163
|
+
this.start_x = start_x;
|
|
164
|
+
this.start_y = start_y;
|
|
165
|
+
this.resume_x = resume_x;
|
|
166
|
+
this.resume_y = resume_y;
|
|
167
|
+
this.inner_width = inner_width;
|
|
168
|
+
this.inner_height = inner_height;
|
|
169
|
+
this.is_absolute = is_absolute;
|
|
170
|
+
this.is_wrapped = is_wrapped;
|
|
171
|
+
this.start_page = start_page;
|
|
172
|
+
this.end_page = end_page;
|
|
173
|
+
this.allow_force_same_page = true;
|
|
174
|
+
this._margin = _margin;
|
|
175
|
+
this._padding = _padding;
|
|
176
|
+
++Computed.ids;
|
|
177
|
+
this._id = Computed.ids;
|
|
178
|
+
}
|
|
179
|
+
// Get end x/y.
|
|
180
|
+
get end_x() { return this.start_x + this._margin[1] + this._margin[3] + this._padding[1] + this._padding[3] + this.inner_width; }
|
|
181
|
+
get end_y() { return this.start_y + this._margin[0] + this._margin[2] + this._padding[0] + this._padding[2] + this.inner_height; }
|
|
182
|
+
// Start and end x/y from AFTER the margin.
|
|
183
|
+
get margin_start_x() { return this.start_x + this._margin[3]; }
|
|
184
|
+
get margin_end_x() { return this.end_x - this._margin[1]; }
|
|
185
|
+
get margin_start_y() { return this.start_y + this._margin[0]; }
|
|
186
|
+
get margin_end_y() { return this.end_y - this._margin[2]; }
|
|
187
|
+
// Start and end x/y from AFTER the padding and margin.
|
|
188
|
+
get padding_start_x() { return this.start_x + this._margin[3] + this._padding[3]; }
|
|
189
|
+
get padding_end_x() { return this.end_x - this._margin[1] - this._padding[1]; }
|
|
190
|
+
get padding_start_y() { return this.start_y + this._margin[0] + this._padding[0]; }
|
|
191
|
+
get padding_end_y() { return this.end_y - this._margin[2] - this._padding[2]; }
|
|
192
|
+
// As string for debugging.
|
|
193
|
+
toString() {
|
|
194
|
+
return {
|
|
195
|
+
id: this._id,
|
|
196
|
+
start_x: this.start_x,
|
|
197
|
+
start_y: this.start_y,
|
|
198
|
+
resume_x: this.resume_x,
|
|
199
|
+
resume_y: this.resume_y,
|
|
200
|
+
inner_width: this.inner_width,
|
|
201
|
+
inner_height: this.inner_height,
|
|
202
|
+
is_absolute: this.is_absolute,
|
|
203
|
+
is_wrapped: this.is_wrapped,
|
|
204
|
+
start_page: this.start_page,
|
|
205
|
+
end_page: this.end_page,
|
|
206
|
+
_margin: this._margin,
|
|
207
|
+
_padding: this._padding,
|
|
208
|
+
end_x: this.end_x,
|
|
209
|
+
end_y: this.end_y,
|
|
210
|
+
margin_start_x: this.margin_start_x,
|
|
211
|
+
margin_end_x: this.margin_end_x,
|
|
212
|
+
margin_start_y: this.margin_start_y,
|
|
213
|
+
margin_end_y: this.margin_end_y,
|
|
214
|
+
padding_start_x: this.padding_start_x,
|
|
215
|
+
padding_end_x: this.padding_end_x,
|
|
216
|
+
padding_start_y: this.padding_start_y,
|
|
217
|
+
padding_end_y: this.padding_end_y,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function CreateVElementClass({ type, is_text = false, is_img = false, is_hstack = false, is_stack = false, }) {
|
|
222
|
+
class E {
|
|
223
|
+
// ---------------------------------------------------------
|
|
224
|
+
// Constructor.
|
|
225
|
+
constructor(...children) {
|
|
226
|
+
// Attributes.
|
|
227
|
+
this.type = type;
|
|
228
|
+
this._parent = null; // will be assigned by `_build().`
|
|
229
|
+
this._children = [];
|
|
230
|
+
this._text = null;
|
|
231
|
+
this._img = null;
|
|
232
|
+
this._options = {}; // for element options.
|
|
233
|
+
this._calls = {}; // for doc calls.
|
|
234
|
+
this._id = null;
|
|
235
|
+
this._width = undefined;
|
|
236
|
+
this._height = undefined;
|
|
237
|
+
this._stretch = undefined;
|
|
238
|
+
this._margin = [0, 0, 0, 0];
|
|
239
|
+
this._padding = [0, 0, 0, 0];
|
|
240
|
+
this._position = [null, null, null, null]; // absolute positioning.
|
|
241
|
+
this._background = null;
|
|
242
|
+
this._border_radius = null;
|
|
243
|
+
this._border_color = null;
|
|
244
|
+
this._border_width = 1;
|
|
245
|
+
this._font = null;
|
|
246
|
+
this._font_weight = null;
|
|
247
|
+
// this._wrap = true;
|
|
248
|
+
this._href = null;
|
|
249
|
+
this._force_same_page = false;
|
|
250
|
+
this._page = undefined;
|
|
251
|
+
this._valign = undefined;
|
|
252
|
+
// Static attributes but keep as member.
|
|
253
|
+
this.is_text = is_text;
|
|
254
|
+
this.is_img = is_img;
|
|
255
|
+
this.is_hstack = is_hstack;
|
|
256
|
+
this.is_stack = is_stack;
|
|
257
|
+
// Append.
|
|
258
|
+
this.append(...children);
|
|
259
|
+
}
|
|
260
|
+
copy() {
|
|
261
|
+
const copy = new this.constructor(this._children);
|
|
262
|
+
// Attributes.
|
|
263
|
+
copy.type = this.type;
|
|
264
|
+
copy._parent = this._parent;
|
|
265
|
+
copy._children = this._children;
|
|
266
|
+
copy._text = this._text;
|
|
267
|
+
copy._img = this._img;
|
|
268
|
+
copy._style = this._options;
|
|
269
|
+
copy._calls = this._calls;
|
|
270
|
+
copy._id = this._id;
|
|
271
|
+
copy._width = this._width;
|
|
272
|
+
copy._height = this._height;
|
|
273
|
+
copy._stretch = this.stretch;
|
|
274
|
+
copy._margin = this._margin;
|
|
275
|
+
copy._padding = this._padding;
|
|
276
|
+
copy._position = this._position;
|
|
277
|
+
copy._background = this._background;
|
|
278
|
+
copy._border_radius = this._border_radius;
|
|
279
|
+
copy._border_color = this._border_color;
|
|
280
|
+
copy._border_width = this._border_width;
|
|
281
|
+
copy._font = this._font;
|
|
282
|
+
copy._font_weight = this._font_weight;
|
|
283
|
+
// copy._wrap = this._wrap;
|
|
284
|
+
copy._href = this._href;
|
|
285
|
+
copy._force_same_page = this._force_same_page;
|
|
286
|
+
copy._page = this._page;
|
|
287
|
+
copy._valign = this._valign;
|
|
288
|
+
return copy;
|
|
289
|
+
}
|
|
290
|
+
// ---------------------------------------------------------
|
|
291
|
+
// System.
|
|
292
|
+
// Set doc styling.
|
|
293
|
+
_set_styling(doc) {
|
|
294
|
+
this._restore = {};
|
|
295
|
+
// Execute document calls.
|
|
296
|
+
Object.keys(this._calls).iterate((func) => {
|
|
297
|
+
if (func === "setFont") {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
// Cache.
|
|
301
|
+
this._restore[func] = doc["g" + func.substr(1)]();
|
|
302
|
+
// Array.
|
|
303
|
+
if (Array.isArray(this._calls[func])) {
|
|
304
|
+
doc[func](...this._calls[func]);
|
|
305
|
+
}
|
|
306
|
+
// Single arg.
|
|
307
|
+
else {
|
|
308
|
+
doc[func](this._calls[func]);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
// Font.
|
|
312
|
+
if (this._font != null || this._font_weight != null) {
|
|
313
|
+
const font = doc.getFont();
|
|
314
|
+
this._restore.setFont = [font.fontName, font.fontStyle];
|
|
315
|
+
doc.setFont(this._font || doc.fontName, this._font_weight || doc.fontStyle);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// Restore doc styling.
|
|
319
|
+
_restore_styling(doc) {
|
|
320
|
+
Object.keys(this._restore).iterate((func) => {
|
|
321
|
+
if (Array.isArray(this._restore[func])) {
|
|
322
|
+
doc[func](...this._restore[func]);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
doc[func](this._restore[func]);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
// Check if the _text attr contains whitespace.
|
|
330
|
+
_has_whitespace() {
|
|
331
|
+
if (!this.is_text) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
for (let i = 0; i < this._text.length; i++) {
|
|
335
|
+
const c = this._text.charAt(i);
|
|
336
|
+
if (c === " " || c === "\t") {
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
// Compute.
|
|
343
|
+
_compute(doc, x, y, page, refresh = false) {
|
|
344
|
+
// Cached.
|
|
345
|
+
if (refresh === false && this._computed !== undefined) {
|
|
346
|
+
return this._computed;
|
|
347
|
+
}
|
|
348
|
+
// Is PDF type.
|
|
349
|
+
if (this.type === "PDF" && doc == null) {
|
|
350
|
+
this._create_doc();
|
|
351
|
+
doc = this._doc;
|
|
352
|
+
x = 0; //doc._volt_margin_left;
|
|
353
|
+
y = 0; //doc._volt_margin_top;
|
|
354
|
+
page = 1;
|
|
355
|
+
refresh = true;
|
|
356
|
+
}
|
|
357
|
+
// Initialize.
|
|
358
|
+
if (this._initialize !== undefined) {
|
|
359
|
+
this._initialize();
|
|
360
|
+
}
|
|
361
|
+
// Convert text to string, since instance String is also not accepted by jspdf.
|
|
362
|
+
if (this._text != null) {
|
|
363
|
+
this._text = this._text.toString();
|
|
364
|
+
}
|
|
365
|
+
// --------------------------------------------------------------------------------
|
|
366
|
+
// Pre compute.
|
|
367
|
+
// Flags.
|
|
368
|
+
const is_absolute = this._position[0] != null || this._position[1] != null || this._position[2] != null || this._position[3] != null;
|
|
369
|
+
if (this._page != null) {
|
|
370
|
+
if (!is_absolute) {
|
|
371
|
+
throw Error(`Only absolute positioned elements may define an explicit page using "page()".`);
|
|
372
|
+
}
|
|
373
|
+
page = this._page;
|
|
374
|
+
}
|
|
375
|
+
let computed = new Computed({
|
|
376
|
+
start_x: x,
|
|
377
|
+
start_y: y,
|
|
378
|
+
resume_x: x,
|
|
379
|
+
resume_y: y,
|
|
380
|
+
start_page: page,
|
|
381
|
+
end_page: page,
|
|
382
|
+
is_absolute,
|
|
383
|
+
_margin: this._margin,
|
|
384
|
+
_padding: this._padding,
|
|
385
|
+
});
|
|
386
|
+
// Add page.
|
|
387
|
+
if (this.type === "Page") {
|
|
388
|
+
computed.start_x = doc._volt_margin_left;
|
|
389
|
+
computed.start_y = doc._volt_margin_top;
|
|
390
|
+
++page;
|
|
391
|
+
++computed.start_page;
|
|
392
|
+
++computed.end_page;
|
|
393
|
+
}
|
|
394
|
+
// Absolute positioning, ignore document margins!
|
|
395
|
+
let is_absolute_right = false;
|
|
396
|
+
let is_absolute_bottom = false;
|
|
397
|
+
if (computed.is_absolute) {
|
|
398
|
+
if (this._position[1] != null && this._position[3] != null) {
|
|
399
|
+
computed.start_x = this._position[3];
|
|
400
|
+
this._width = doc._volt_page_width - this._position[1] - this._position[3];
|
|
401
|
+
}
|
|
402
|
+
else if (this._position[1] != null) {
|
|
403
|
+
computed.start_x = doc._volt_page_width - this._position[1] - this._margin[1] - this._margin[3] - this._padding[1] - this._padding[3];
|
|
404
|
+
is_absolute_right = true;
|
|
405
|
+
}
|
|
406
|
+
else if (this._position[3] != null) {
|
|
407
|
+
computed.start_x = this._position[3];
|
|
408
|
+
}
|
|
409
|
+
if (this._position[0] != null && this._position[2] != null) {
|
|
410
|
+
computed.start_y = this._position[0];
|
|
411
|
+
this._height = doc._volt_page_height - this._position[0] - this._position[2];
|
|
412
|
+
}
|
|
413
|
+
else if (this._position[0] != null) {
|
|
414
|
+
computed.start_y = this._position[0];
|
|
415
|
+
}
|
|
416
|
+
else if (this._position[2] != null) {
|
|
417
|
+
computed.start_y = doc._volt_page_height - this._position[2] - this._margin[0] - this._margin[2] - this._padding[0] - this._padding[2];
|
|
418
|
+
is_absolute_bottom = true;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
// Set relative width.
|
|
422
|
+
if (typeof this._width === "string" && this._width.last() === "%") {
|
|
423
|
+
if (this._parent != null && this._parent._max_width != null) {
|
|
424
|
+
this._width = Math.max(0, this._parent._max_width * (parseInt(this._width.slice(0, -1)) / 100)
|
|
425
|
+
- (this._margin[1] + this._margin[3] + this._padding[1] + this._padding[3]));
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
delete this._width;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
// Calculate the max X (after padding and margin are added to x) (after calc relative width).
|
|
432
|
+
if (this._parent == null || this._parent._max_x != null) {
|
|
433
|
+
this._max_x = doc._volt_page_width - doc._volt_margin_right;
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
this._max_x = this._parent._max_x;
|
|
437
|
+
}
|
|
438
|
+
if (this._width != null) {
|
|
439
|
+
this._max_x = Math.min(x + this._width, this._max_x);
|
|
440
|
+
}
|
|
441
|
+
this._max_x -= (this._margin[1] - this._padding[1]);
|
|
442
|
+
// Calculate the max width (after padding and margin are added to x) (after calc relative width).
|
|
443
|
+
this._max_width = parseInt(this._max_x - x); // round down otherwise some text might overflow its background.
|
|
444
|
+
// --------------------------------------------------------------------------------
|
|
445
|
+
// Doc styling.
|
|
446
|
+
this._set_styling(doc);
|
|
447
|
+
// --------------------------------------------------------------------------------
|
|
448
|
+
// Calculate inner width and height.
|
|
449
|
+
// Add image / text.
|
|
450
|
+
if (this.is_text || this.is_img) {
|
|
451
|
+
// Vars.
|
|
452
|
+
let width = 0, height = 0, dimensions;
|
|
453
|
+
const has_whitespace = this._has_whitespace();
|
|
454
|
+
// Check width & height.
|
|
455
|
+
if (this.is_img) {
|
|
456
|
+
if (this._width == null) {
|
|
457
|
+
throw Error("A defined width is required for an \"Image\" element.");
|
|
458
|
+
}
|
|
459
|
+
if (this._height == null) {
|
|
460
|
+
throw Error("A defined height is required for an \"Image\" element.");
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// Check wrap.
|
|
464
|
+
if (this._width != null) {
|
|
465
|
+
width = this._width;
|
|
466
|
+
}
|
|
467
|
+
else if (this.is_text) {
|
|
468
|
+
let no_spaces = "", space_count = 0;
|
|
469
|
+
for (let i = 0; i < this._text.length; i++) {
|
|
470
|
+
const c = this._text.charAt(i);
|
|
471
|
+
if (c === " ") {
|
|
472
|
+
++space_count;
|
|
473
|
+
}
|
|
474
|
+
else if (c === "\t") {
|
|
475
|
+
space_count += 8;
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
no_spaces += c;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
dimensions = doc.getTextDimensions(no_spaces);
|
|
482
|
+
width = dimensions.w + (doc.getStringUnitWidth(" ") * doc.getFontSize() * space_count); // does not account for line breaks.
|
|
483
|
+
// width = dimensions.w / doc.internal.scaleFactor
|
|
484
|
+
}
|
|
485
|
+
if (width > this._max_width) {
|
|
486
|
+
width = this._max_width;
|
|
487
|
+
if (this._width != null) {
|
|
488
|
+
this._width = width;
|
|
489
|
+
} // prevent inifnite loop.
|
|
490
|
+
if (this.is_text && !has_whitespace && width < this._parent._max_width) {
|
|
491
|
+
this._restore_styling(doc);
|
|
492
|
+
const computed = this._compute(doc, this._parent._wrap_x, this._parent._wrap_y, page, true);
|
|
493
|
+
computed.has_wrapped = true;
|
|
494
|
+
return computed;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if (this._font_weight === "bold") {
|
|
498
|
+
width *= 1.04;
|
|
499
|
+
}
|
|
500
|
+
// Get height (must be after width in case of adjustments).
|
|
501
|
+
if (this._height != null) {
|
|
502
|
+
height = this._height;
|
|
503
|
+
}
|
|
504
|
+
else if (this.is_text) {
|
|
505
|
+
if (dimensions === undefined) {
|
|
506
|
+
dimensions = doc.getTextDimensions(this._text);
|
|
507
|
+
}
|
|
508
|
+
// let height_correction = false;
|
|
509
|
+
if (!has_whitespace && width < this._parent._max_width) {
|
|
510
|
+
height = 1 * (dimensions.h * doc.getLineHeightFactor());
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
const lines = doc.splitTextToSize(this._text, width);
|
|
514
|
+
height = lines.length * (dimensions.h * doc.getLineHeightFactor());
|
|
515
|
+
}
|
|
516
|
+
height += dimensions.h * doc.getLineHeightFactor() * 0.15; // small height correction since the default jspdf padding top is small and padding bottom is none.
|
|
517
|
+
// do not assign to this._height since that causes problems with `copy()` while splitting long text into sub texts.
|
|
518
|
+
}
|
|
519
|
+
// Adjust coordinates.
|
|
520
|
+
computed.inner_width = width;
|
|
521
|
+
computed.inner_height = height;
|
|
522
|
+
}
|
|
523
|
+
// Check children, also when length is 0, in order to add the width and height etc.
|
|
524
|
+
else {
|
|
525
|
+
// Vars.
|
|
526
|
+
let max_child_x = 0, max_child_y = 0;
|
|
527
|
+
let x = computed.padding_start_x;
|
|
528
|
+
let y = computed.padding_start_y;
|
|
529
|
+
let child_page = page;
|
|
530
|
+
let stretch_children = [], row_children = [];
|
|
531
|
+
this._wrap_x = x;
|
|
532
|
+
// Apply vertical alignment.
|
|
533
|
+
const apply_vertical_alignment = (children) => {
|
|
534
|
+
// Vars.
|
|
535
|
+
const is_center = this._valign === "center";
|
|
536
|
+
const is_trailing = this._valign === "trailing";
|
|
537
|
+
if (!is_center && !is_trailing) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
// Get highest child.
|
|
541
|
+
let max_height = 0;
|
|
542
|
+
children.iterate((child) => {
|
|
543
|
+
const height = child._computed.inner_height + child._computed._padding[0] + child._computed._padding[2];
|
|
544
|
+
if (!child._computed.is_absolute && height > max_height) {
|
|
545
|
+
max_height = height;
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
// Apply alignment.
|
|
549
|
+
children.iterate((child) => {
|
|
550
|
+
if (!child._computed.is_absolute) {
|
|
551
|
+
const height = child._computed.inner_height + child._computed._padding[0] + child._computed._padding[2];
|
|
552
|
+
if (is_center) {
|
|
553
|
+
child._computed.start_y += (max_height - height) / 2;
|
|
554
|
+
}
|
|
555
|
+
else if (is_trailing) {
|
|
556
|
+
child._computed.start_y += max_height - height;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
// Iterate.
|
|
562
|
+
this._children.iterate((child) => {
|
|
563
|
+
// Vars.
|
|
564
|
+
const is_stack = child.is_stack;
|
|
565
|
+
// Assign parent.
|
|
566
|
+
child._parent = this;
|
|
567
|
+
// Compute.
|
|
568
|
+
let response = child._compute(doc, x, y, child_page, refresh);
|
|
569
|
+
// New page.
|
|
570
|
+
if (response.end_page > computed.end_page) {
|
|
571
|
+
// Apply vertical alignment.
|
|
572
|
+
apply_vertical_alignment(row_children);
|
|
573
|
+
row_children = [];
|
|
574
|
+
// Reset stretch children.
|
|
575
|
+
stretch_children = [];
|
|
576
|
+
// Go to next page.
|
|
577
|
+
child_page = response.end_page;
|
|
578
|
+
computed.end_page = response.end_page;
|
|
579
|
+
if (this.is_hstack) {
|
|
580
|
+
x = response.resume_x;
|
|
581
|
+
y = doc._volt_margin_top;
|
|
582
|
+
// Wrap to new y.
|
|
583
|
+
if (response.has_wrapped || response.resume_x >= this._max_x) {
|
|
584
|
+
x = response.has_wrapped ? response.resume_x : this._wrap_x;
|
|
585
|
+
y = this._wrap_y === undefined ? response.resume_y : this._wrap_y;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
x = this._wrap_x;
|
|
590
|
+
y = response.resume_y;
|
|
591
|
+
}
|
|
592
|
+
max_child_x = x;
|
|
593
|
+
max_child_y = y;
|
|
594
|
+
}
|
|
595
|
+
// Increment X/Y.
|
|
596
|
+
else if (this.is_hstack) {
|
|
597
|
+
x = response.resume_x;
|
|
598
|
+
// Wrap to new y.
|
|
599
|
+
if (response.has_wrapped || response.resume_x >= this._max_x) {
|
|
600
|
+
x = response.has_wrapped ? response.resume_x : this._wrap_x;
|
|
601
|
+
y = this._wrap_y === undefined ? response.resume_y : this._wrap_y;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
// Resume on y.
|
|
605
|
+
else {
|
|
606
|
+
y = response.resume_y;
|
|
607
|
+
}
|
|
608
|
+
// Cache max y.
|
|
609
|
+
// Must be after increment x/y for wrapping.
|
|
610
|
+
if (response.resume_y > max_child_y) {
|
|
611
|
+
max_child_y = response.resume_y;
|
|
612
|
+
this._wrap_y = max_child_y;
|
|
613
|
+
}
|
|
614
|
+
if (response.resume_x > max_child_x) {
|
|
615
|
+
max_child_x = response.resume_x;
|
|
616
|
+
}
|
|
617
|
+
// Append stretch child.
|
|
618
|
+
if (child._stretch) {
|
|
619
|
+
stretch_children.append(child);
|
|
620
|
+
}
|
|
621
|
+
// Append row children.
|
|
622
|
+
row_children.append(child);
|
|
623
|
+
});
|
|
624
|
+
// Apply vertical alignment.
|
|
625
|
+
apply_vertical_alignment(row_children);
|
|
626
|
+
// Stretch.
|
|
627
|
+
if (stretch_children.length > 0) {
|
|
628
|
+
if (this.is_hstack) {
|
|
629
|
+
const step = (this._max_x - max_child_x) / stretch_children.length;
|
|
630
|
+
let incr_x = 0;
|
|
631
|
+
row_children.iterate((child) => {
|
|
632
|
+
child._computed.start_x += incr_x;
|
|
633
|
+
if (child._stretch) {
|
|
634
|
+
child._computed.inner_width += step;
|
|
635
|
+
incr_x += step;
|
|
636
|
+
console.log("Stretch:", child.type, child._text, step);
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
// still to do.
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
// @todo is still incorrect when one of the children creates a new page.
|
|
645
|
+
// Could fill "stretch" widths over here.
|
|
646
|
+
// Set X/Y to max of children.
|
|
647
|
+
if (this._width == null) {
|
|
648
|
+
computed.inner_width = Math.max(0, max_child_x - computed.padding_start_x);
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
computed.inner_width = Math.max(this._width, max_child_x - computed.padding_start_x);
|
|
652
|
+
}
|
|
653
|
+
if (this._height == null) {
|
|
654
|
+
computed.inner_height = Math.max(0, max_child_y - computed.padding_start_y);
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
computed.inner_height = Math.max(this._height, max_child_y - computed.padding_start_y);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
// --------------------------------------------------------------------------------
|
|
661
|
+
// Post compute.
|
|
662
|
+
// Decrement start x with width when an absolute right is used.
|
|
663
|
+
if (is_absolute_right) {
|
|
664
|
+
computed.start_x -= computed.inner_width;
|
|
665
|
+
}
|
|
666
|
+
// Decrement start y with height when an absolute bottom is used.
|
|
667
|
+
if (is_absolute_bottom) {
|
|
668
|
+
computed.start_y -= computed.inner_height;
|
|
669
|
+
}
|
|
670
|
+
// Set resume x/y.
|
|
671
|
+
if (!computed.is_absolute) {
|
|
672
|
+
computed.resume_x = computed.end_x;
|
|
673
|
+
computed.resume_y = computed.end_y;
|
|
674
|
+
}
|
|
675
|
+
// Check new page required for non stacks.
|
|
676
|
+
if (!is_absolute && computed.resume_y > doc._volt_page_height - doc._volt_margin_bottom &&
|
|
677
|
+
(this.is_text || this.is_img) // not for stacks.
|
|
678
|
+
) {
|
|
679
|
+
// For texts.
|
|
680
|
+
if (this.is_text) {
|
|
681
|
+
// Split text into lines.
|
|
682
|
+
const line_height_factor = doc.getLineHeightFactor();
|
|
683
|
+
const dimensions = doc.getTextDimensions(this._text);
|
|
684
|
+
let lines = doc.splitTextToSize(this._text, computed.inner_width);
|
|
685
|
+
const get_break_index = (max_height) => {
|
|
686
|
+
let i, height;
|
|
687
|
+
for (i = 0; i < lines.length; i++) {
|
|
688
|
+
height = (i + 1) * (dimensions.h * line_height_factor); // here i+1 is required or it will calc wrong and cause inf loop.
|
|
689
|
+
height += dimensions.h * line_height_factor * 0.15;
|
|
690
|
+
if (height >= max_height) {
|
|
691
|
+
return i - 1;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return i;
|
|
695
|
+
};
|
|
696
|
+
// When the text can not be split since there is not any space to split even a single line, then wrap the entire text to the new page.
|
|
697
|
+
if (computed.padding_start_y + dimensions.h > doc._volt_page_height - doc._volt_margin_bottom) {
|
|
698
|
+
this._restore_styling(doc);
|
|
699
|
+
return this._compute(doc, this._parent._wrap_x, doc._volt_margin_top, page + 1, true);
|
|
700
|
+
}
|
|
701
|
+
// Restore styling for new computations.
|
|
702
|
+
this._restore_styling(doc);
|
|
703
|
+
// Split text into multiple texts.
|
|
704
|
+
let remaining_text = this._text;
|
|
705
|
+
const sub_texts = [];
|
|
706
|
+
let child_page = page;
|
|
707
|
+
for (let i = 0; i < 100000; i++) {
|
|
708
|
+
// Get break index.
|
|
709
|
+
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;
|
|
710
|
+
const break_index = get_break_index(max_height);
|
|
711
|
+
const is_last = break_index == lines.length;
|
|
712
|
+
// Nothing fits.
|
|
713
|
+
if (break_index === 0) {
|
|
714
|
+
++child_page;
|
|
715
|
+
continue;
|
|
716
|
+
}
|
|
717
|
+
// Create copy.
|
|
718
|
+
const copy = this.copy();
|
|
719
|
+
copy._parent = this._parent;
|
|
720
|
+
// Remove bottom padding and margin.
|
|
721
|
+
if (!is_last) {
|
|
722
|
+
copy._margin[3] = 0;
|
|
723
|
+
copy._padding[3] = 0;
|
|
724
|
+
}
|
|
725
|
+
// Remove top padding.
|
|
726
|
+
if (i > 0) {
|
|
727
|
+
copy._margin[0] = 0;
|
|
728
|
+
copy._padding[0] = 0;
|
|
729
|
+
}
|
|
730
|
+
// Slice text.
|
|
731
|
+
copy._text = lines.slice(0, break_index).join("\n");
|
|
732
|
+
lines = lines.slice(break_index);
|
|
733
|
+
// Add page.
|
|
734
|
+
if (i > 0) {
|
|
735
|
+
++child_page;
|
|
736
|
+
}
|
|
737
|
+
// Recompute.
|
|
738
|
+
// process.exit(0)
|
|
739
|
+
copy._compute(doc, i === 0 ? computed.start_x : this._parent._wrap_x, i === 0 ? computed.start_y : doc._volt_margin_top, child_page, true);
|
|
740
|
+
// Append.
|
|
741
|
+
sub_texts.append(copy);
|
|
742
|
+
// Stop.
|
|
743
|
+
if (is_last) {
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
// Insert.
|
|
748
|
+
this._parent.insert_before(this, sub_texts);
|
|
749
|
+
this._parent.remove_child(this);
|
|
750
|
+
return sub_texts.last()._computed;
|
|
751
|
+
}
|
|
752
|
+
// For images that do fit on a single page.
|
|
753
|
+
else if (this.is_img && fits_on_one_page) {
|
|
754
|
+
this._restore_styling(doc);
|
|
755
|
+
return this._compute(doc, this._parent._wrap_x, doc._volt_margin_top, page + 1, true);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
// Check force same page for stacks.
|
|
759
|
+
const is_stack = this.is_stack;
|
|
760
|
+
if (!is_absolute &&
|
|
761
|
+
is_stack &&
|
|
762
|
+
this._force_same_page &&
|
|
763
|
+
computed.start_page !== computed.end_page &&
|
|
764
|
+
computed.end_y - computed.start_y <= doc._volt_page_height - doc._volt_margin_bottom - doc._volt_margin_top // must fit on one page.
|
|
765
|
+
) {
|
|
766
|
+
this._restore_styling(doc);
|
|
767
|
+
return this._compute(doc, this._parent._wrap_x, doc._volt_margin_top, page + 1, true);
|
|
768
|
+
}
|
|
769
|
+
// Restore func calls and font.
|
|
770
|
+
this._restore_styling(doc);
|
|
771
|
+
// Response.
|
|
772
|
+
console.log(this.type, this._text, computed.start_y);
|
|
773
|
+
this._computed = computed;
|
|
774
|
+
return this._computed;
|
|
775
|
+
}
|
|
776
|
+
// Build element.
|
|
777
|
+
_build(doc) {
|
|
778
|
+
// Is PDF type.
|
|
779
|
+
if (this.type === "PDF") {
|
|
780
|
+
this._create_doc();
|
|
781
|
+
doc = this._doc;
|
|
782
|
+
this._compute(doc, 0, 0, 1, true);
|
|
783
|
+
}
|
|
784
|
+
// Compute.
|
|
785
|
+
const computed = this._computed;
|
|
786
|
+
// Add all pages.
|
|
787
|
+
if (this.type === "PDF") {
|
|
788
|
+
for (let i = 0; i < computed.end_page - 1; i++) { // the first page is already added.
|
|
789
|
+
doc.addPage();
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
// Switch to page.
|
|
793
|
+
doc.setPage(computed.start_page);
|
|
794
|
+
// Set styling.
|
|
795
|
+
this._set_styling(doc);
|
|
796
|
+
// Add background.
|
|
797
|
+
if (typeof this._background === "string" || typeof this._border_color === "string") {
|
|
798
|
+
let x = computed.margin_start_x, rect_width = computed.margin_end_x - computed.margin_start_x;
|
|
799
|
+
let y, rect_height;
|
|
800
|
+
let color;
|
|
801
|
+
for (let i = computed.start_page; i <= computed.end_page; i++) {
|
|
802
|
+
doc.setPage(i);
|
|
803
|
+
// Only one page.
|
|
804
|
+
if (computed.start_page === computed.end_page) {
|
|
805
|
+
y = computed.margin_start_y;
|
|
806
|
+
rect_height = computed.margin_end_y - computed.margin_start_y;
|
|
807
|
+
}
|
|
808
|
+
// On first page.
|
|
809
|
+
else if (i === computed.start_page) {
|
|
810
|
+
y = computed.margin_start_y;
|
|
811
|
+
rect_height = (doc._volt_page_height - doc._volt_margin_bottom) - computed.margin_start_y;
|
|
812
|
+
}
|
|
813
|
+
// On last page.
|
|
814
|
+
else if (i === computed.end_page) {
|
|
815
|
+
y = doc._volt_margin_top; // - this._padding[0];
|
|
816
|
+
rect_height = computed.margin_end_y - doc._volt_margin_bottom; // + this._padding[2];
|
|
817
|
+
}
|
|
818
|
+
// In between pages.
|
|
819
|
+
else {
|
|
820
|
+
y = doc._volt_margin_top; // - this._padding[0];
|
|
821
|
+
rect_height = doc._volt_page_height - doc._volt_margin_bottom - doc._volt_margin_top; // + this._padding[2];
|
|
822
|
+
}
|
|
823
|
+
// Check percentage border radius.
|
|
824
|
+
let border_radius = this._border_radius;
|
|
825
|
+
if (typeof border_radius === "string" && border_radius.last() === "%") {
|
|
826
|
+
border_radius = Math.min(rect_width, rect_height) * (parseInt(border_radius.slice(0, -1)) / 100);
|
|
827
|
+
}
|
|
828
|
+
// Background color.
|
|
829
|
+
if (typeof this._background === "string") {
|
|
830
|
+
color = PDF.hex_to_rgb(this._background);
|
|
831
|
+
let restore = false;
|
|
832
|
+
if (Array.isArray(color)) {
|
|
833
|
+
if (color.length === 4) {
|
|
834
|
+
restore = true;
|
|
835
|
+
doc.saveGraphicsState();
|
|
836
|
+
doc.setGState(new doc.GState({ opacity: color[3] }));
|
|
837
|
+
--color.length;
|
|
838
|
+
}
|
|
839
|
+
doc.setFillColor(...color);
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
doc.setFillColor(color);
|
|
843
|
+
}
|
|
844
|
+
if (border_radius != null) {
|
|
845
|
+
doc.roundedRect(x, y, rect_width, rect_height, border_radius, border_radius, "F"); // fill.
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
doc.rect(x, y, rect_width, rect_height, "F"); // fill.
|
|
849
|
+
}
|
|
850
|
+
if (restore) {
|
|
851
|
+
doc.restoreGraphicsState();
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
// Border color.
|
|
855
|
+
if (typeof this._border_color === "string") {
|
|
856
|
+
doc.setLineWidth(this._border_width === undefined ? 1 : this._border_width);
|
|
857
|
+
color = PDF.hex_to_rgb(this._border_color);
|
|
858
|
+
let restore = false;
|
|
859
|
+
if (Array.isArray(color)) {
|
|
860
|
+
if (color.length === 4) {
|
|
861
|
+
restore = true;
|
|
862
|
+
doc.saveGraphicsState();
|
|
863
|
+
doc.setGState(new doc.GState({ "stroke-opacity": color[3] }));
|
|
864
|
+
--color.length;
|
|
865
|
+
}
|
|
866
|
+
doc.setDrawColor(...color);
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
doc.setDrawColor(color);
|
|
870
|
+
}
|
|
871
|
+
if (border_radius != null) {
|
|
872
|
+
doc.roundedRect(x, y, rect_width, rect_height, border_radius, border_radius, "S"); // stroke.
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
doc.rect(x, y, rect_width, rect_height, "S"); // stroke.
|
|
876
|
+
}
|
|
877
|
+
if (restore) {
|
|
878
|
+
doc.restoreGraphicsState();
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
// Restore.
|
|
883
|
+
this._restore_styling(doc);
|
|
884
|
+
doc.setPage(computed.start_page);
|
|
885
|
+
this._set_styling(doc);
|
|
886
|
+
}
|
|
887
|
+
// Id.
|
|
888
|
+
if (this._id != null) {
|
|
889
|
+
doc._volt_ids[this._id] = computed.start_page;
|
|
890
|
+
}
|
|
891
|
+
// Add image / text.
|
|
892
|
+
if (this.is_text || this.is_img) {
|
|
893
|
+
// Href.
|
|
894
|
+
if (this._href != null) {
|
|
895
|
+
if (this._href.startsWith("http")) {
|
|
896
|
+
doc.link(x, y, width, height, this._href);
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
doc._volt_hrefs.append({
|
|
900
|
+
page: computed.start_page,
|
|
901
|
+
href: this._href,
|
|
902
|
+
args: [x, y, width, height],
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
// Element.
|
|
907
|
+
if (this.is_text) {
|
|
908
|
+
// this._options.maxWidth = computed.inner_width; // sometimes jspdf's width calculation is just a tiny bit off which causes the text to wrap, so this line must remain commented out.
|
|
909
|
+
const font_size = doc.getFontSize();
|
|
910
|
+
let x = computed.padding_start_x;
|
|
911
|
+
let y = computed.padding_start_y + font_size;
|
|
912
|
+
if (this._options.align === "right") {
|
|
913
|
+
x += computed.inner_width;
|
|
914
|
+
}
|
|
915
|
+
y -= font_size * 0.05; // since default top padding is too large.
|
|
916
|
+
doc.text(this._text, x, y, this._options); // account for baseline y behaviour.
|
|
917
|
+
}
|
|
918
|
+
else if (this.is_img) {
|
|
919
|
+
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);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
// With children.
|
|
923
|
+
else if (this._children.length > 0) {
|
|
924
|
+
// Add children.
|
|
925
|
+
this._children.iterate((child) => {
|
|
926
|
+
child._build(doc);
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
// Restore func calls and font.
|
|
930
|
+
this._restore_styling(doc);
|
|
931
|
+
// End.
|
|
932
|
+
if (this.type === "PDF") {
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
// ---------------------------------------------------------
|
|
936
|
+
// Functions.
|
|
937
|
+
// As string.
|
|
938
|
+
toString(indent = 0) {
|
|
939
|
+
let indent_str = "";
|
|
940
|
+
for (let i = 0; i < indent; i++) {
|
|
941
|
+
indent_str += " ";
|
|
942
|
+
}
|
|
943
|
+
if (this.children.length > 0) {
|
|
944
|
+
let str = `${indent_str}${this.type}(\n`;
|
|
945
|
+
str += this._children.iterate_append((c) => c.toString(indent + 4)).join(",\n");
|
|
946
|
+
str += `\n${indent_str})`;
|
|
947
|
+
return str;
|
|
948
|
+
}
|
|
949
|
+
else if (this.type === "Text") {
|
|
950
|
+
return `${indent_str}${this.type}("${this._text}")`;
|
|
951
|
+
}
|
|
952
|
+
else if (this.type === "Image") {
|
|
953
|
+
return `${indent_str}${this.type}("${this._img}")`;
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
return `${indent_str}${this.type}()`;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
// Get/set text.
|
|
960
|
+
text(val) {
|
|
961
|
+
if (val === undefined) {
|
|
962
|
+
return this._text;
|
|
963
|
+
}
|
|
964
|
+
this._text = val;
|
|
965
|
+
return this;
|
|
966
|
+
}
|
|
967
|
+
// Get/set children.
|
|
968
|
+
get children() {
|
|
969
|
+
return this._children;
|
|
970
|
+
}
|
|
971
|
+
set children(val) {
|
|
972
|
+
this._children = val;
|
|
973
|
+
}
|
|
974
|
+
// Append.
|
|
975
|
+
append(...children) {
|
|
976
|
+
for (let i = 0; i < children.length; i++) {
|
|
977
|
+
if (children[i] == null) {
|
|
978
|
+
continue;
|
|
979
|
+
}
|
|
980
|
+
else if (Array.isArray(children[i])) {
|
|
981
|
+
this.append(...children[i]);
|
|
982
|
+
}
|
|
983
|
+
else if (typeof children[i] === "string") {
|
|
984
|
+
this._children.append(PDF.Text(children[i]));
|
|
985
|
+
}
|
|
986
|
+
else if (typeof children[i] !== "object") {
|
|
987
|
+
this._children.append(PDF.Text(children[i].toString()));
|
|
988
|
+
}
|
|
989
|
+
else {
|
|
990
|
+
this._children.append(children[i]);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
return this;
|
|
994
|
+
}
|
|
995
|
+
// Insert before.
|
|
996
|
+
insert_before(relative, child) {
|
|
997
|
+
const children = [];
|
|
998
|
+
this._children.iterate((x) => {
|
|
999
|
+
if (x === relative) {
|
|
1000
|
+
if (Array.isArray(child)) {
|
|
1001
|
+
children.append(...child);
|
|
1002
|
+
}
|
|
1003
|
+
else {
|
|
1004
|
+
children.append(child);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
children.append(x);
|
|
1008
|
+
});
|
|
1009
|
+
this._children = children;
|
|
1010
|
+
return this;
|
|
1011
|
+
}
|
|
1012
|
+
// Insert after.
|
|
1013
|
+
insert_after(relative, child) {
|
|
1014
|
+
const children = [];
|
|
1015
|
+
this._children.iterate((x) => {
|
|
1016
|
+
children.append(x);
|
|
1017
|
+
if (x === relative) {
|
|
1018
|
+
if (Array.isArray(child)) {
|
|
1019
|
+
children.append(...child);
|
|
1020
|
+
}
|
|
1021
|
+
else {
|
|
1022
|
+
children.append(child);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
this._children = children;
|
|
1027
|
+
return this;
|
|
1028
|
+
}
|
|
1029
|
+
// Remove child.
|
|
1030
|
+
remove_child(child) {
|
|
1031
|
+
this._children = this._children.drop(child);
|
|
1032
|
+
return this;
|
|
1033
|
+
}
|
|
1034
|
+
// Remove children.
|
|
1035
|
+
remove_children() {
|
|
1036
|
+
this._children = [];
|
|
1037
|
+
return this;
|
|
1038
|
+
}
|
|
1039
|
+
// id.
|
|
1040
|
+
id(val) {
|
|
1041
|
+
if (val === undefined) {
|
|
1042
|
+
return this._id;
|
|
1043
|
+
}
|
|
1044
|
+
this._id = val;
|
|
1045
|
+
return this;
|
|
1046
|
+
}
|
|
1047
|
+
// Href.
|
|
1048
|
+
href(val) {
|
|
1049
|
+
if (val === undefined) {
|
|
1050
|
+
return this._href;
|
|
1051
|
+
}
|
|
1052
|
+
this._href = val;
|
|
1053
|
+
return this;
|
|
1054
|
+
}
|
|
1055
|
+
// Force same page for HStacks.
|
|
1056
|
+
force_same_page(val) {
|
|
1057
|
+
if (val === undefined) {
|
|
1058
|
+
return this._force_same_page;
|
|
1059
|
+
}
|
|
1060
|
+
this._force_same_page = val;
|
|
1061
|
+
return this;
|
|
1062
|
+
}
|
|
1063
|
+
// Set start page.
|
|
1064
|
+
page(val) {
|
|
1065
|
+
if (val === undefined) {
|
|
1066
|
+
return this._page;
|
|
1067
|
+
}
|
|
1068
|
+
this._page = val;
|
|
1069
|
+
return this;
|
|
1070
|
+
}
|
|
1071
|
+
// Margin, 1, 2 or 4 args.
|
|
1072
|
+
margin(...values) {
|
|
1073
|
+
if (values.length === 0) {
|
|
1074
|
+
return this._margin;
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
if (values.length === 1) {
|
|
1078
|
+
this._margin = [values[0], values[0], values[0], values[0]];
|
|
1079
|
+
}
|
|
1080
|
+
else if (values.length === 2) {
|
|
1081
|
+
this._margin = [values[0], values[1], values[0], values[1]];
|
|
1082
|
+
}
|
|
1083
|
+
else if (values.length === 4) {
|
|
1084
|
+
this._margin = [values[0], values[1], values[2], values[3]];
|
|
1085
|
+
}
|
|
1086
|
+
else {
|
|
1087
|
+
console.error("Invalid number of arguments for function \"margin()\".");
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
return this;
|
|
1091
|
+
}
|
|
1092
|
+
margin_top(val) {
|
|
1093
|
+
if (val === undefined) {
|
|
1094
|
+
return this._margin[0];
|
|
1095
|
+
}
|
|
1096
|
+
this._margin[0] = val;
|
|
1097
|
+
return this;
|
|
1098
|
+
}
|
|
1099
|
+
margin_right(val) {
|
|
1100
|
+
if (val === undefined) {
|
|
1101
|
+
return this._margin[1];
|
|
1102
|
+
}
|
|
1103
|
+
this._margin[1] = val;
|
|
1104
|
+
return this;
|
|
1105
|
+
}
|
|
1106
|
+
margin_bottom(val) {
|
|
1107
|
+
if (val === undefined) {
|
|
1108
|
+
return this._margin[2];
|
|
1109
|
+
}
|
|
1110
|
+
this._margin[2] = val;
|
|
1111
|
+
return this;
|
|
1112
|
+
}
|
|
1113
|
+
margin_left(val) {
|
|
1114
|
+
if (val === undefined) {
|
|
1115
|
+
return this._margin[3];
|
|
1116
|
+
}
|
|
1117
|
+
this._margin[3] = val;
|
|
1118
|
+
return this;
|
|
1119
|
+
}
|
|
1120
|
+
// Padding, 1, 2 or 4 args.
|
|
1121
|
+
padding(...values) {
|
|
1122
|
+
if (values.length === 0) {
|
|
1123
|
+
return this._padding;
|
|
1124
|
+
}
|
|
1125
|
+
else {
|
|
1126
|
+
if (values.length === 1) {
|
|
1127
|
+
this._padding = [values[0], values[0], values[0], values[0]];
|
|
1128
|
+
}
|
|
1129
|
+
else if (values.length === 2) {
|
|
1130
|
+
this._padding = [values[0], values[1], values[0], values[1]];
|
|
1131
|
+
}
|
|
1132
|
+
else if (values.length === 4) {
|
|
1133
|
+
this._padding = [values[0], values[1], values[2], values[3]];
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
console.error("Invalid number of arguments for function \"padding()\".");
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
return this;
|
|
1140
|
+
}
|
|
1141
|
+
padding_top(val) {
|
|
1142
|
+
if (val === undefined) {
|
|
1143
|
+
return this._padding[0];
|
|
1144
|
+
}
|
|
1145
|
+
this._padding[0] = val;
|
|
1146
|
+
return this;
|
|
1147
|
+
}
|
|
1148
|
+
padding_right(val) {
|
|
1149
|
+
if (val === undefined) {
|
|
1150
|
+
return this._padding[1];
|
|
1151
|
+
}
|
|
1152
|
+
this._padding[1] = val;
|
|
1153
|
+
return this;
|
|
1154
|
+
}
|
|
1155
|
+
padding_bottom(val) {
|
|
1156
|
+
if (val === undefined) {
|
|
1157
|
+
return this._padding[2];
|
|
1158
|
+
}
|
|
1159
|
+
this._padding[2] = val;
|
|
1160
|
+
return this;
|
|
1161
|
+
}
|
|
1162
|
+
padding_left(val) {
|
|
1163
|
+
if (val === undefined) {
|
|
1164
|
+
return this._padding[3];
|
|
1165
|
+
}
|
|
1166
|
+
this._padding[3] = val;
|
|
1167
|
+
return this;
|
|
1168
|
+
}
|
|
1169
|
+
// Position, 1 or 4 args.
|
|
1170
|
+
position(...values) {
|
|
1171
|
+
if (values.length === 0) {
|
|
1172
|
+
return this._position;
|
|
1173
|
+
}
|
|
1174
|
+
else if (values.length === 1) {
|
|
1175
|
+
this._position = [values[0], values[0], values[0], values[0]];
|
|
1176
|
+
}
|
|
1177
|
+
else if (values.length === 4) {
|
|
1178
|
+
if (values[0] != null) {
|
|
1179
|
+
this._position[0] = values[0];
|
|
1180
|
+
}
|
|
1181
|
+
if (values[1] != null) {
|
|
1182
|
+
this._position[1] = values[1];
|
|
1183
|
+
}
|
|
1184
|
+
if (values[2] != null) {
|
|
1185
|
+
this._position[2] = values[2];
|
|
1186
|
+
}
|
|
1187
|
+
if (values[3] != null) {
|
|
1188
|
+
this._position[3] = values[3];
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
console.error("Invalid number of arguments for function \"position()\".");
|
|
1193
|
+
}
|
|
1194
|
+
return this;
|
|
1195
|
+
}
|
|
1196
|
+
top(val) {
|
|
1197
|
+
if (val === undefined) {
|
|
1198
|
+
return this._position[0];
|
|
1199
|
+
}
|
|
1200
|
+
this._position[0] = val;
|
|
1201
|
+
return this;
|
|
1202
|
+
}
|
|
1203
|
+
right(val) {
|
|
1204
|
+
if (val === undefined) {
|
|
1205
|
+
return this._position[1];
|
|
1206
|
+
}
|
|
1207
|
+
this._position[1] = val;
|
|
1208
|
+
return this;
|
|
1209
|
+
}
|
|
1210
|
+
bottom(val) {
|
|
1211
|
+
if (val === undefined) {
|
|
1212
|
+
return this._position[2];
|
|
1213
|
+
}
|
|
1214
|
+
this._position[2] = val;
|
|
1215
|
+
return this;
|
|
1216
|
+
}
|
|
1217
|
+
left(val) {
|
|
1218
|
+
if (val === undefined) {
|
|
1219
|
+
return this._position[3];
|
|
1220
|
+
}
|
|
1221
|
+
this._position[3] = val;
|
|
1222
|
+
return this;
|
|
1223
|
+
}
|
|
1224
|
+
// Align.
|
|
1225
|
+
align(val) {
|
|
1226
|
+
if (val === undefined) {
|
|
1227
|
+
return this._options.align;
|
|
1228
|
+
}
|
|
1229
|
+
this._options.align = val;
|
|
1230
|
+
return this;
|
|
1231
|
+
}
|
|
1232
|
+
leading() {
|
|
1233
|
+
return this.align("left");
|
|
1234
|
+
}
|
|
1235
|
+
center() {
|
|
1236
|
+
return this.align("center");
|
|
1237
|
+
}
|
|
1238
|
+
trailing() {
|
|
1239
|
+
return this.align("right");
|
|
1240
|
+
}
|
|
1241
|
+
justify() {
|
|
1242
|
+
return this.align("justify");
|
|
1243
|
+
}
|
|
1244
|
+
// Width.
|
|
1245
|
+
width(val) {
|
|
1246
|
+
if (val == undefined) {
|
|
1247
|
+
return this._width;
|
|
1248
|
+
}
|
|
1249
|
+
this._width = val;
|
|
1250
|
+
return this;
|
|
1251
|
+
}
|
|
1252
|
+
// Height.
|
|
1253
|
+
height(val) {
|
|
1254
|
+
if (val == undefined) {
|
|
1255
|
+
return this._height;
|
|
1256
|
+
}
|
|
1257
|
+
if (typeof val === "string" && val.last() === "%") {
|
|
1258
|
+
throw Error("Function \"height()\" does not accept relative percentages.");
|
|
1259
|
+
}
|
|
1260
|
+
this._height = val;
|
|
1261
|
+
return this;
|
|
1262
|
+
}
|
|
1263
|
+
// Stretch.
|
|
1264
|
+
stretch(val) {
|
|
1265
|
+
if (val == undefined) {
|
|
1266
|
+
return this._stretch;
|
|
1267
|
+
}
|
|
1268
|
+
this._stretch = val;
|
|
1269
|
+
return this;
|
|
1270
|
+
}
|
|
1271
|
+
// Font family.
|
|
1272
|
+
font_family(val) {
|
|
1273
|
+
if (val === undefined) {
|
|
1274
|
+
return this._font;
|
|
1275
|
+
}
|
|
1276
|
+
this._font = val;
|
|
1277
|
+
return this;
|
|
1278
|
+
}
|
|
1279
|
+
// Font size.
|
|
1280
|
+
font_size(val) {
|
|
1281
|
+
if (val === undefined) {
|
|
1282
|
+
return this._calls.setFontSize;
|
|
1283
|
+
}
|
|
1284
|
+
this._calls.setFontSize = val;
|
|
1285
|
+
return this;
|
|
1286
|
+
}
|
|
1287
|
+
// Font weight, the suffix for the font so: Helvetica-"Bold", can be lowercase.
|
|
1288
|
+
// Suffix might depend per font.
|
|
1289
|
+
font_weight(val) {
|
|
1290
|
+
if (val === undefined) {
|
|
1291
|
+
return this._font_weight;
|
|
1292
|
+
}
|
|
1293
|
+
this._font_weight = val;
|
|
1294
|
+
return this;
|
|
1295
|
+
}
|
|
1296
|
+
// Color.
|
|
1297
|
+
color(val) {
|
|
1298
|
+
if (val === undefined) {
|
|
1299
|
+
return this._calls.setTextColor;
|
|
1300
|
+
}
|
|
1301
|
+
this._calls.setTextColor = val;
|
|
1302
|
+
return this;
|
|
1303
|
+
}
|
|
1304
|
+
// Background.
|
|
1305
|
+
background(val) {
|
|
1306
|
+
if (val === undefined) {
|
|
1307
|
+
return this._background;
|
|
1308
|
+
}
|
|
1309
|
+
this._background = val;
|
|
1310
|
+
return this;
|
|
1311
|
+
}
|
|
1312
|
+
// Border radius.
|
|
1313
|
+
border_radius(val) {
|
|
1314
|
+
if (val === undefined) {
|
|
1315
|
+
return this._border_radius;
|
|
1316
|
+
}
|
|
1317
|
+
this._border_radius = val;
|
|
1318
|
+
return this;
|
|
1319
|
+
}
|
|
1320
|
+
// Border color.
|
|
1321
|
+
border_color(val) {
|
|
1322
|
+
if (val === undefined) {
|
|
1323
|
+
return this._border_color;
|
|
1324
|
+
}
|
|
1325
|
+
this._border_color = val;
|
|
1326
|
+
return this;
|
|
1327
|
+
}
|
|
1328
|
+
// Border width.
|
|
1329
|
+
border_width(val) {
|
|
1330
|
+
if (val === undefined) {
|
|
1331
|
+
return this._border_width;
|
|
1332
|
+
}
|
|
1333
|
+
this._border_width = val;
|
|
1334
|
+
return this;
|
|
1335
|
+
}
|
|
1336
|
+
// Align (for images mainly).
|
|
1337
|
+
align_vertical(val) {
|
|
1338
|
+
if (val === undefined) {
|
|
1339
|
+
return this._valign;
|
|
1340
|
+
}
|
|
1341
|
+
this._valign = val;
|
|
1342
|
+
return this;
|
|
1343
|
+
}
|
|
1344
|
+
leading_vertical() {
|
|
1345
|
+
return this.align_vertical("leading");
|
|
1346
|
+
}
|
|
1347
|
+
center_vertical() {
|
|
1348
|
+
return this.align_vertical("center");
|
|
1349
|
+
}
|
|
1350
|
+
trailing_vertical() {
|
|
1351
|
+
return this.align_vertical("trailing");
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
return E;
|
|
1355
|
+
}
|
|
1356
|
+
// ---------------------------------------------------------
|
|
1357
|
+
// PDF element.
|
|
1358
|
+
class PDFElement extends CreateVElementClass({
|
|
1359
|
+
type: "PDF",
|
|
1360
|
+
is_stack: true,
|
|
1361
|
+
}) {
|
|
1362
|
+
// Constructor.
|
|
1363
|
+
constructor(...children) {
|
|
1364
|
+
// Initialize base class.
|
|
1365
|
+
super(...children);
|
|
1366
|
+
// Attributes.
|
|
1367
|
+
this._margin = [50, 50, 50, 50];
|
|
1368
|
+
this._is_built = false;
|
|
1369
|
+
this._fonts = [];
|
|
1370
|
+
this.add_font("Menlo", "normal", `${import.meta.dirname}/fonts/Menlo-Regular.ttf`);
|
|
1371
|
+
this.add_font("Menlo", "bold", `${import.meta.dirname}/fonts/Menlo-Bold.ttf`);
|
|
1372
|
+
}
|
|
1373
|
+
// Create a document.
|
|
1374
|
+
_create_doc() {
|
|
1375
|
+
this._doc = new jsPDF("p", "pt", "a4"); // PDF.use_pixels ? "px" : "pt"
|
|
1376
|
+
this._doc._volt_margin_top = this._margin[0];
|
|
1377
|
+
this._doc._volt_margin_right = this._margin[1];
|
|
1378
|
+
this._doc._volt_margin_bottom = this._margin[2];
|
|
1379
|
+
this._doc._volt_margin_left = this._margin[3];
|
|
1380
|
+
this._doc._volt_page_width = this._doc.getPageWidth();
|
|
1381
|
+
this._doc._volt_page_height = this._doc.getPageHeight();
|
|
1382
|
+
this._doc._volt_ids = {}; // {$id: $page_nr}.
|
|
1383
|
+
this._doc._volt_hrefs = [];
|
|
1384
|
+
this._fonts.iterate((item) => {
|
|
1385
|
+
this._doc.addFileToVFS(item.file_name, item.base64);
|
|
1386
|
+
this._doc.addFont(item.file_name, item.name, item.style);
|
|
1387
|
+
});
|
|
1388
|
+
return this._doc;
|
|
1389
|
+
}
|
|
1390
|
+
// Build.
|
|
1391
|
+
build() {
|
|
1392
|
+
this._build(); // refresh in case any edits were made after `iterate_pages` or `switch_page`.
|
|
1393
|
+
this._is_built = true;
|
|
1394
|
+
return this;
|
|
1395
|
+
}
|
|
1396
|
+
// Get max page.
|
|
1397
|
+
max_page() {
|
|
1398
|
+
if (this._computed === undefined) {
|
|
1399
|
+
this._compute();
|
|
1400
|
+
}
|
|
1401
|
+
return this._computed.end_page;
|
|
1402
|
+
}
|
|
1403
|
+
// Iterate pages.
|
|
1404
|
+
iterate_pages(callback) {
|
|
1405
|
+
this._compute(undefined, undefined, undefined, undefined, true);
|
|
1406
|
+
for (let i = 1; i <= this._computed.end_page; i++) {
|
|
1407
|
+
callback(i);
|
|
1408
|
+
}
|
|
1409
|
+
return this;
|
|
1410
|
+
}
|
|
1411
|
+
// Number pages.
|
|
1412
|
+
number_pages({ align = "right", // left, center, right
|
|
1413
|
+
margin = 12.5, font_size = 6, color = "black", }) {
|
|
1414
|
+
this.iterate_pages((page) => {
|
|
1415
|
+
const text = PDF.Text(`Page ${page}`)
|
|
1416
|
+
.color(color)
|
|
1417
|
+
.font_size(font_size)
|
|
1418
|
+
.position(null, align === "right" ? margin : null, margin, align === "left" ? margin : null)
|
|
1419
|
+
.page(page);
|
|
1420
|
+
// if (align === "center") {
|
|
1421
|
+
// text.width("100%").center()
|
|
1422
|
+
// }
|
|
1423
|
+
this.append(text);
|
|
1424
|
+
});
|
|
1425
|
+
return this;
|
|
1426
|
+
}
|
|
1427
|
+
// Add font.
|
|
1428
|
+
add_font(name = "Menlo", style = "normal", path = "Menlo-Regular.ttf") {
|
|
1429
|
+
this._fonts.append({
|
|
1430
|
+
name,
|
|
1431
|
+
style,
|
|
1432
|
+
file_name: new vlib.Path(path).name(),
|
|
1433
|
+
base64: Buffer.from(libfs.readFileSync(path)).toString("base64"),
|
|
1434
|
+
});
|
|
1435
|
+
return this;
|
|
1436
|
+
}
|
|
1437
|
+
// Save.
|
|
1438
|
+
save(path) {
|
|
1439
|
+
if (!this._is_built) {
|
|
1440
|
+
this.build();
|
|
1441
|
+
}
|
|
1442
|
+
libfs.writeFileSync(path, this._doc.output(), "binary");
|
|
1443
|
+
}
|
|
1444
|
+
// Get as bytes.
|
|
1445
|
+
async bytes() {
|
|
1446
|
+
if (!this._is_built) {
|
|
1447
|
+
this.build();
|
|
1448
|
+
}
|
|
1449
|
+
const stream = this._doc.pipe(blobstream());
|
|
1450
|
+
return new Promise((resolve, reject) => {
|
|
1451
|
+
stream.on('finish', () => {
|
|
1452
|
+
const bytes = stream.toBuffer();
|
|
1453
|
+
resolve(bytes);
|
|
1454
|
+
});
|
|
1455
|
+
stream.on('error', (error) => {
|
|
1456
|
+
reject(error);
|
|
1457
|
+
});
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
// Get as blob stream.
|
|
1461
|
+
stream() {
|
|
1462
|
+
if (!this._is_built) {
|
|
1463
|
+
this.build();
|
|
1464
|
+
}
|
|
1465
|
+
return this._doc.pipe(blobstream());
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
;
|
|
1469
|
+
PDF.PDFElement = PDFElement;
|
|
1470
|
+
PDF.PDF = function PDF(...args) { return new PDFElement(...args); };
|
|
1471
|
+
// ---------------------------------------------------------
|
|
1472
|
+
// Page element.
|
|
1473
|
+
PDF.PageElement = class PageElement extends CreateVElementClass({
|
|
1474
|
+
type: "Page",
|
|
1475
|
+
is_stack: true,
|
|
1476
|
+
}) {
|
|
1477
|
+
// Constructor.
|
|
1478
|
+
constructor(...children) {
|
|
1479
|
+
// Initialize base class.
|
|
1480
|
+
super(...children);
|
|
1481
|
+
}
|
|
1482
|
+
};
|
|
1483
|
+
PDF.Page = function Page(...args) { return new PDF.PageElement(...args); };
|
|
1484
|
+
// ---------------------------------------------------------
|
|
1485
|
+
// VStack element.
|
|
1486
|
+
PDF.VStackElement = class VStackElement extends CreateVElementClass({
|
|
1487
|
+
type: "VStack",
|
|
1488
|
+
is_stack: true,
|
|
1489
|
+
}) {
|
|
1490
|
+
// Constructor.
|
|
1491
|
+
constructor(...children) {
|
|
1492
|
+
// Initialize base class.
|
|
1493
|
+
super(...children);
|
|
1494
|
+
}
|
|
1495
|
+
};
|
|
1496
|
+
PDF.VStack = function VStack(...args) { return new PDF.VStackElement(...args); };
|
|
1497
|
+
// ---------------------------------------------------------
|
|
1498
|
+
// HStack element.
|
|
1499
|
+
PDF.HStackElement = class HStackElement extends CreateVElementClass({
|
|
1500
|
+
type: "HStack",
|
|
1501
|
+
is_stack: true,
|
|
1502
|
+
is_hstack: true,
|
|
1503
|
+
}) {
|
|
1504
|
+
// Constructor.
|
|
1505
|
+
constructor(...children) {
|
|
1506
|
+
// Initialize base class.
|
|
1507
|
+
super(...children);
|
|
1508
|
+
}
|
|
1509
|
+
};
|
|
1510
|
+
PDF.HStack = function HStack(...args) { return new PDF.HStackElement(...args); };
|
|
1511
|
+
// ---------------------------------------------------------
|
|
1512
|
+
// Text element.
|
|
1513
|
+
PDF.TextElement = class TextElement extends CreateVElementClass({
|
|
1514
|
+
type: "Text",
|
|
1515
|
+
is_text: true,
|
|
1516
|
+
}) {
|
|
1517
|
+
// Constructor.
|
|
1518
|
+
constructor(text = "") {
|
|
1519
|
+
// Initialize base class.
|
|
1520
|
+
super();
|
|
1521
|
+
// Set text.
|
|
1522
|
+
this._text = text;
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
PDF.Text = function Text(...args) { return new PDF.TextElement(...args); };
|
|
1526
|
+
// ---------------------------------------------------------
|
|
1527
|
+
// Image element.
|
|
1528
|
+
PDF.ImageElement = class ImageElement extends CreateVElementClass({
|
|
1529
|
+
type: "Image",
|
|
1530
|
+
is_img: true,
|
|
1531
|
+
}) {
|
|
1532
|
+
// Constructor.
|
|
1533
|
+
constructor(img) {
|
|
1534
|
+
// Initialize base class.
|
|
1535
|
+
super();
|
|
1536
|
+
// Set text.
|
|
1537
|
+
this._img = img;
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
PDF.Image = function Image(...args) { return new PDF.ImageElement(...args); };
|
|
1541
|
+
// ---------------------------------------------------------
|
|
1542
|
+
// Code block.
|
|
1543
|
+
PDF.CodeBlockElement = class CodeBlockElement extends CreateVElementClass({
|
|
1544
|
+
type: "CodeBlock",
|
|
1545
|
+
is_stack: true,
|
|
1546
|
+
}) {
|
|
1547
|
+
static menlo_initialized = false;
|
|
1548
|
+
// Constructor.
|
|
1549
|
+
constructor(language, code) {
|
|
1550
|
+
// Initialize base class.
|
|
1551
|
+
super();
|
|
1552
|
+
this._language = language;
|
|
1553
|
+
this._code = code;
|
|
1554
|
+
this._initialized = false;
|
|
1555
|
+
this._calls.setFontSize = 6;
|
|
1556
|
+
this._padding = [12.5, 5, 12.5, 5];
|
|
1557
|
+
this._background = "#00000005";
|
|
1558
|
+
this._border_radius = 5;
|
|
1559
|
+
this._border_color = "#00000020";
|
|
1560
|
+
this._border_width = 0.5;
|
|
1561
|
+
this._font = "Menlo";
|
|
1562
|
+
}
|
|
1563
|
+
copy() {
|
|
1564
|
+
const copy = super.copy();
|
|
1565
|
+
copy._language = this.language;
|
|
1566
|
+
copy._code = this.code;
|
|
1567
|
+
copy._initialized = this._initialized;
|
|
1568
|
+
return copy;
|
|
1569
|
+
}
|
|
1570
|
+
// Initialize.
|
|
1571
|
+
_initialize() {
|
|
1572
|
+
// Already initialized.
|
|
1573
|
+
if (this._initialized) {
|
|
1574
|
+
return this;
|
|
1575
|
+
}
|
|
1576
|
+
// Tokenize.
|
|
1577
|
+
const tokenizer = vhighlight.init_tokenizer(this._language);
|
|
1578
|
+
if (tokenizer == null) {
|
|
1579
|
+
throw Error(`Language "${language}" is not a supported code language for "PDF.CodeBlock".`);
|
|
1580
|
+
}
|
|
1581
|
+
tokenizer.code = this._code;
|
|
1582
|
+
const tokens = tokenizer.tokenize();
|
|
1583
|
+
// Create children.
|
|
1584
|
+
this._children = [];
|
|
1585
|
+
this._children.append(CodeBlockElement.build_tokens(tokens));
|
|
1586
|
+
// Initialized.
|
|
1587
|
+
this._initialized = true;
|
|
1588
|
+
return this;
|
|
1589
|
+
}
|
|
1590
|
+
// Build tokens.
|
|
1591
|
+
static build_tokens(tokens) {
|
|
1592
|
+
// Create token classes.
|
|
1593
|
+
const token_classes = {
|
|
1594
|
+
comment: (text) => {
|
|
1595
|
+
return PDF.Text(text)
|
|
1596
|
+
.color("#818C97");
|
|
1597
|
+
},
|
|
1598
|
+
comment_keyword: (text) => {
|
|
1599
|
+
return PDF.Text(text)
|
|
1600
|
+
.color("#818C97")
|
|
1601
|
+
.font_weight("bold");
|
|
1602
|
+
},
|
|
1603
|
+
comment_codeblock: (text) => {
|
|
1604
|
+
return PDF.Text(text)
|
|
1605
|
+
.color("#818C97")
|
|
1606
|
+
.font_weight("italic")
|
|
1607
|
+
.background("#FFFFFF10")
|
|
1608
|
+
.border_radius(5);
|
|
1609
|
+
},
|
|
1610
|
+
url: (text) => {
|
|
1611
|
+
return PDF.Text(text)
|
|
1612
|
+
.color("#818C97");
|
|
1613
|
+
},
|
|
1614
|
+
string: (text) => {
|
|
1615
|
+
return PDF.Text(text)
|
|
1616
|
+
.color("#D6C986");
|
|
1617
|
+
},
|
|
1618
|
+
numeric: (text) => {
|
|
1619
|
+
return PDF.Text(text)
|
|
1620
|
+
.color("#D6C986");
|
|
1621
|
+
},
|
|
1622
|
+
keyword: (text) => {
|
|
1623
|
+
return PDF.Text(text)
|
|
1624
|
+
.color("#EE8378")
|
|
1625
|
+
.font_weight("bold");
|
|
1626
|
+
},
|
|
1627
|
+
operator: (text) => {
|
|
1628
|
+
return PDF.Text(text)
|
|
1629
|
+
.color("#EE8378")
|
|
1630
|
+
.font_weight("bold");
|
|
1631
|
+
},
|
|
1632
|
+
preprocessor: (text) => {
|
|
1633
|
+
return PDF.Text(text)
|
|
1634
|
+
.color("#EE8378");
|
|
1635
|
+
},
|
|
1636
|
+
type_def: (text) => {
|
|
1637
|
+
return PDF.Text(text)
|
|
1638
|
+
.color("#C78BF0");
|
|
1639
|
+
},
|
|
1640
|
+
type: (text) => {
|
|
1641
|
+
return PDF.Text(text)
|
|
1642
|
+
.color("#5795F3");
|
|
1643
|
+
},
|
|
1644
|
+
parameter: (text) => {
|
|
1645
|
+
return PDF.Text(text)
|
|
1646
|
+
.color("#F9AE58");
|
|
1647
|
+
},
|
|
1648
|
+
};
|
|
1649
|
+
// Build.
|
|
1650
|
+
if (tokens.length === 0) {
|
|
1651
|
+
return null;
|
|
1652
|
+
}
|
|
1653
|
+
if (Array.isArray(tokens[0])) {
|
|
1654
|
+
tokens.iterate((line_tokens) => {
|
|
1655
|
+
const hstack = PDF.HStack();
|
|
1656
|
+
line_tokens.iterate((token) => {
|
|
1657
|
+
if (token.is_line_break) {
|
|
1658
|
+
return null;
|
|
1659
|
+
}
|
|
1660
|
+
const token_class = token_classes[token.token];
|
|
1661
|
+
if (token_class == null) {
|
|
1662
|
+
hstack.append(PDF.Text(token.data));
|
|
1663
|
+
}
|
|
1664
|
+
else {
|
|
1665
|
+
hstack.append(token_class(token.data));
|
|
1666
|
+
}
|
|
1667
|
+
});
|
|
1668
|
+
children.append(hstack);
|
|
1669
|
+
});
|
|
1670
|
+
return children;
|
|
1671
|
+
}
|
|
1672
|
+
else {
|
|
1673
|
+
const hstack = PDF.HStack();
|
|
1674
|
+
tokens.iterate((token) => {
|
|
1675
|
+
if (token.is_line_break) {
|
|
1676
|
+
return null;
|
|
1677
|
+
}
|
|
1678
|
+
const token_class = token_classes[token.token];
|
|
1679
|
+
if (token_class == null) {
|
|
1680
|
+
hstack.append(PDF.Text(token.data));
|
|
1681
|
+
}
|
|
1682
|
+
else {
|
|
1683
|
+
hstack.append(token_class(token.data));
|
|
1684
|
+
}
|
|
1685
|
+
});
|
|
1686
|
+
return hstack;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
PDF.CodeBlock = function CodeBlock(...args) { return new PDF.CodeBlockElement(...args); };
|
|
1691
|
+
// ---------------------------------------------------------
|
|
1692
|
+
// Export.
|
|
1693
|
+
module.exports = PDF;
|
|
1694
|
+
export {};
|