@vandenberghinc/volt 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vrepo +28 -0
- package/.vscode/tasks.json +87 -0
- package/README.md +67 -0
- package/backend/dist/cjs/blacklist.d.ts +10 -0
- package/backend/dist/cjs/blacklist.js +53 -0
- package/backend/dist/cjs/cli.d.ts +2 -0
- package/backend/dist/cjs/cli.js +263 -0
- package/backend/dist/cjs/database.d.ts +364 -0
- package/backend/dist/cjs/database.js +1962 -0
- package/backend/dist/cjs/endpoint.d.ts +57 -0
- package/backend/dist/cjs/endpoint.js +425 -0
- package/backend/dist/cjs/file_watcher.d.ts +44 -0
- package/backend/dist/cjs/file_watcher.js +348 -0
- package/backend/dist/cjs/frontend.d.ts +13 -0
- package/backend/dist/cjs/frontend.js +30 -0
- package/backend/dist/cjs/image_endpoint.d.ts +24 -0
- package/backend/dist/cjs/image_endpoint.js +210 -0
- package/backend/dist/cjs/logger.d.ts +5 -0
- package/backend/dist/cjs/logger.js +16 -0
- package/backend/dist/cjs/meta.d.ts +50 -0
- package/backend/dist/cjs/meta.js +153 -0
- package/backend/dist/cjs/mutex.d.ts +24 -0
- package/backend/dist/cjs/mutex.js +52 -0
- package/backend/dist/cjs/package.json +1 -0
- package/backend/dist/cjs/payments/paddle.d.ts +161 -0
- package/backend/dist/cjs/payments/paddle.js +2301 -0
- package/backend/dist/cjs/plugins/browser.d.ts +36 -0
- package/backend/dist/cjs/plugins/browser.js +183 -0
- package/backend/dist/cjs/plugins/communication.d.ts +70 -0
- package/backend/dist/cjs/plugins/communication.js +177 -0
- package/backend/dist/cjs/plugins/css.d.ts +10 -0
- package/backend/dist/cjs/plugins/css.js +71 -0
- package/backend/dist/cjs/plugins/mail.d.ts +277 -0
- package/backend/dist/cjs/plugins/mail.js +1419 -0
- package/backend/dist/cjs/plugins/pdf.d.ts +757 -0
- package/backend/dist/cjs/plugins/pdf.js +1694 -0
- package/backend/dist/cjs/plugins/thread_monitor.d.ts +18 -0
- package/backend/dist/cjs/plugins/thread_monitor.js +127 -0
- package/backend/dist/cjs/plugins/ts/compiler.d.ts +132 -0
- package/backend/dist/cjs/plugins/ts/compiler.js +944 -0
- package/backend/dist/cjs/plugins/ts/preprocessing.d.ts +14 -0
- package/backend/dist/cjs/plugins/ts/preprocessing.js +762 -0
- package/backend/dist/cjs/rate_limit.d.ts +65 -0
- package/backend/dist/cjs/rate_limit.js +463 -0
- package/backend/dist/cjs/request.deprc.d.ts +48 -0
- package/backend/dist/cjs/request.deprc.js +572 -0
- package/backend/dist/cjs/response.deprc.d.ts +55 -0
- package/backend/dist/cjs/response.deprc.js +275 -0
- package/backend/dist/cjs/server.d.ts +311 -0
- package/backend/dist/cjs/server.js +3475 -0
- package/backend/dist/cjs/splash_screen.d.ts +35 -0
- package/backend/dist/cjs/splash_screen.js +152 -0
- package/backend/dist/cjs/status.d.ts +60 -0
- package/backend/dist/cjs/status.js +199 -0
- package/backend/dist/cjs/stream.d.ts +75 -0
- package/backend/dist/cjs/stream.js +954 -0
- package/backend/dist/cjs/users.d.ts +111 -0
- package/backend/dist/cjs/users.js +1945 -0
- package/backend/dist/cjs/utils.d.ts +27 -0
- package/backend/dist/cjs/utils.js +329 -0
- package/backend/dist/cjs/view.d.ts +52 -0
- package/backend/dist/cjs/view.js +568 -0
- package/backend/dist/cjs/vinc.d.ts +2 -0
- package/backend/dist/cjs/vinc.dev.d.ts +2 -0
- package/backend/dist/cjs/vinc.dev.js +42 -0
- package/backend/dist/cjs/vinc.js +42 -0
- package/backend/dist/cjs/volt.d.ts +15 -0
- package/backend/dist/cjs/volt.js +64 -0
- package/backend/dist/css/adyen.css +92 -0
- package/backend/dist/css/volt.css +65 -0
- package/backend/dist/esm/blacklist.d.ts +10 -0
- package/backend/dist/esm/blacklist.js +49 -0
- package/backend/dist/esm/cli.d.ts +2 -0
- package/backend/dist/esm/cli.js +228 -0
- package/backend/dist/esm/database.d.ts +364 -0
- package/backend/dist/esm/database.js +1957 -0
- package/backend/dist/esm/endpoint.d.ts +57 -0
- package/backend/dist/esm/endpoint.js +421 -0
- package/backend/dist/esm/file_watcher.d.ts +44 -0
- package/backend/dist/esm/file_watcher.js +313 -0
- package/backend/dist/esm/frontend.d.ts +13 -0
- package/backend/dist/esm/frontend.js +27 -0
- package/backend/dist/esm/image_endpoint.d.ts +24 -0
- package/backend/dist/esm/image_endpoint.js +206 -0
- package/backend/dist/esm/logger.d.ts +5 -0
- package/backend/dist/esm/logger.js +13 -0
- package/backend/dist/esm/meta.d.ts +50 -0
- package/backend/dist/esm/meta.js +149 -0
- package/backend/dist/esm/mutex.d.ts +24 -0
- package/backend/dist/esm/mutex.js +48 -0
- package/backend/dist/esm/payments/paddle.d.ts +161 -0
- package/backend/dist/esm/payments/paddle.js +2261 -0
- package/backend/dist/esm/plugins/browser.d.ts +36 -0
- package/backend/dist/esm/plugins/browser.js +176 -0
- package/backend/dist/esm/plugins/communication.d.ts +70 -0
- package/backend/dist/esm/plugins/communication.js +169 -0
- package/backend/dist/esm/plugins/css.d.ts +10 -0
- package/backend/dist/esm/plugins/css.js +64 -0
- package/backend/dist/esm/plugins/mail.d.ts +277 -0
- package/backend/dist/esm/plugins/mail.js +1403 -0
- package/backend/dist/esm/plugins/pdf.d.ts +757 -0
- package/backend/dist/esm/plugins/pdf.js +1694 -0
- package/backend/dist/esm/plugins/thread_monitor.d.ts +18 -0
- package/backend/dist/esm/plugins/thread_monitor.js +120 -0
- package/backend/dist/esm/plugins/ts/compiler.d.ts +132 -0
- package/backend/dist/esm/plugins/ts/compiler.js +907 -0
- package/backend/dist/esm/plugins/ts/preprocessing.d.ts +14 -0
- package/backend/dist/esm/plugins/ts/preprocessing.js +724 -0
- package/backend/dist/esm/rate_limit.d.ts +65 -0
- package/backend/dist/esm/rate_limit.js +425 -0
- package/backend/dist/esm/request.deprc.d.ts +48 -0
- package/backend/dist/esm/request.deprc.js +572 -0
- package/backend/dist/esm/response.deprc.d.ts +55 -0
- package/backend/dist/esm/response.deprc.js +275 -0
- package/backend/dist/esm/server.d.ts +311 -0
- package/backend/dist/esm/server.js +3435 -0
- package/backend/dist/esm/splash_screen.d.ts +35 -0
- package/backend/dist/esm/splash_screen.js +148 -0
- package/backend/dist/esm/status.d.ts +60 -0
- package/backend/dist/esm/status.js +196 -0
- package/backend/dist/esm/stream.d.ts +75 -0
- package/backend/dist/esm/stream.js +947 -0
- package/backend/dist/esm/users.d.ts +111 -0
- package/backend/dist/esm/users.js +1908 -0
- package/backend/dist/esm/utils.d.ts +27 -0
- package/backend/dist/esm/utils.js +324 -0
- package/backend/dist/esm/view.d.ts +52 -0
- package/backend/dist/esm/view.js +561 -0
- package/backend/dist/esm/vinc.d.ts +2 -0
- package/backend/dist/esm/vinc.dev.d.ts +2 -0
- package/backend/dist/esm/vinc.dev.js +6 -0
- package/backend/dist/esm/vinc.js +6 -0
- package/backend/dist/esm/volt.d.ts +15 -0
- package/backend/dist/esm/volt.js +23 -0
- package/backend/dist/esm-dev/blacklist.d.ts +10 -0
- package/backend/dist/esm-dev/blacklist.js +49 -0
- package/backend/dist/esm-dev/cli.d.ts +2 -0
- package/backend/dist/esm-dev/cli.js +228 -0
- package/backend/dist/esm-dev/database.d.ts +364 -0
- package/backend/dist/esm-dev/database.js +1957 -0
- package/backend/dist/esm-dev/endpoint.d.ts +57 -0
- package/backend/dist/esm-dev/endpoint.js +421 -0
- package/backend/dist/esm-dev/file_watcher.d.ts +44 -0
- package/backend/dist/esm-dev/file_watcher.js +313 -0
- package/backend/dist/esm-dev/frontend.d.ts +13 -0
- package/backend/dist/esm-dev/frontend.js +27 -0
- package/backend/dist/esm-dev/image_endpoint.d.ts +24 -0
- package/backend/dist/esm-dev/image_endpoint.js +206 -0
- package/backend/dist/esm-dev/logger.d.ts +5 -0
- package/backend/dist/esm-dev/logger.js +13 -0
- package/backend/dist/esm-dev/meta.d.ts +50 -0
- package/backend/dist/esm-dev/meta.js +149 -0
- package/backend/dist/esm-dev/mutex.d.ts +24 -0
- package/backend/dist/esm-dev/mutex.js +48 -0
- package/backend/dist/esm-dev/payments/paddle.d.ts +161 -0
- package/backend/dist/esm-dev/payments/paddle.js +2261 -0
- package/backend/dist/esm-dev/plugins/browser.d.ts +36 -0
- package/backend/dist/esm-dev/plugins/browser.js +176 -0
- package/backend/dist/esm-dev/plugins/communication.d.ts +70 -0
- package/backend/dist/esm-dev/plugins/communication.js +169 -0
- package/backend/dist/esm-dev/plugins/css.d.ts +10 -0
- package/backend/dist/esm-dev/plugins/css.js +64 -0
- package/backend/dist/esm-dev/plugins/mail.d.ts +277 -0
- package/backend/dist/esm-dev/plugins/mail.js +1403 -0
- package/backend/dist/esm-dev/plugins/pdf.d.ts +757 -0
- package/backend/dist/esm-dev/plugins/pdf.js +1694 -0
- package/backend/dist/esm-dev/plugins/thread_monitor.d.ts +18 -0
- package/backend/dist/esm-dev/plugins/thread_monitor.js +120 -0
- package/backend/dist/esm-dev/plugins/ts/compiler.d.ts +132 -0
- package/backend/dist/esm-dev/plugins/ts/compiler.js +907 -0
- package/backend/dist/esm-dev/plugins/ts/preprocessing.d.ts +14 -0
- package/backend/dist/esm-dev/plugins/ts/preprocessing.js +724 -0
- package/backend/dist/esm-dev/rate_limit.d.ts +65 -0
- package/backend/dist/esm-dev/rate_limit.js +425 -0
- package/backend/dist/esm-dev/request.deprc.d.ts +48 -0
- package/backend/dist/esm-dev/request.deprc.js +572 -0
- package/backend/dist/esm-dev/response.deprc.d.ts +55 -0
- package/backend/dist/esm-dev/response.deprc.js +275 -0
- package/backend/dist/esm-dev/server.d.ts +311 -0
- package/backend/dist/esm-dev/server.js +3435 -0
- package/backend/dist/esm-dev/splash_screen.d.ts +35 -0
- package/backend/dist/esm-dev/splash_screen.js +148 -0
- package/backend/dist/esm-dev/status.d.ts +60 -0
- package/backend/dist/esm-dev/status.js +196 -0
- package/backend/dist/esm-dev/stream.d.ts +75 -0
- package/backend/dist/esm-dev/stream.js +947 -0
- package/backend/dist/esm-dev/users.d.ts +111 -0
- package/backend/dist/esm-dev/users.js +1908 -0
- package/backend/dist/esm-dev/utils.d.ts +27 -0
- package/backend/dist/esm-dev/utils.js +324 -0
- package/backend/dist/esm-dev/view.d.ts +52 -0
- package/backend/dist/esm-dev/view.js +561 -0
- package/backend/dist/esm-dev/vinc.d.ts +2 -0
- package/backend/dist/esm-dev/vinc.dev.d.ts +2 -0
- package/backend/dist/esm-dev/vinc.dev.js +6 -0
- package/backend/dist/esm-dev/vinc.js +6 -0
- package/backend/dist/esm-dev/volt.d.ts +15 -0
- package/backend/dist/esm-dev/volt.js +23 -0
- package/backend/src/blacklist.ts +69 -0
- package/backend/src/cli.js +245 -0
- package/backend/src/database.ts +2241 -0
- package/backend/src/endpoint.ts +494 -0
- package/backend/src/file_watcher.ts +359 -0
- package/backend/src/frontend.ts +35 -0
- package/backend/src/globals.d.ts +8 -0
- package/backend/src/image_endpoint.ts +258 -0
- package/backend/src/logger.ts +18 -0
- package/backend/src/meta.ts +202 -0
- package/backend/src/mutex.ts +51 -0
- package/backend/src/payments/paddle.ts +2659 -0
- package/backend/src/plugins/browser.ts +188 -0
- package/backend/src/plugins/communication.ts +204 -0
- package/backend/src/plugins/css.ts +84 -0
- package/backend/src/plugins/fonts/Menlo-Bold.ttf +0 -0
- package/backend/src/plugins/fonts/Menlo-Regular.ttf +0 -0
- package/backend/src/plugins/mail.ts +1720 -0
- package/backend/src/plugins/pdf.js +1932 -0
- package/backend/src/plugins/thread_monitor.ts +164 -0
- package/backend/src/plugins/ts/compiler.ts +1242 -0
- package/backend/src/plugins/ts/preprocessing.ts +812 -0
- package/backend/src/rate_limit.ts +503 -0
- package/backend/src/request.deprc.js +626 -0
- package/backend/src/response.deprc.js +354 -0
- package/backend/src/server.ts +4149 -0
- package/backend/src/splash_screen.ts +192 -0
- package/backend/src/status.ts +199 -0
- package/backend/src/stream.ts +1070 -0
- package/backend/src/users.ts +2077 -0
- package/backend/src/utils.ts +359 -0
- package/backend/src/view.ts +655 -0
- package/backend/src/vinc.dev.js +6 -0
- package/backend/src/vinc.ts +6 -0
- package/backend/src/volt.js +25 -0
- package/backend/tsconfig.cjs.json +29 -0
- package/backend/tsconfig.esm.dev.json +34 -0
- package/backend/tsconfig.esm.json +30 -0
- package/backend/tsconfig.json +2 -0
- package/frontend/compile.js +436 -0
- package/frontend/dist/elements/base.d.ts +9891 -0
- package/frontend/dist/elements/base.js +8818 -0
- package/frontend/dist/elements/module.d.ts +16 -0
- package/frontend/dist/elements/module.js +178 -0
- package/frontend/dist/modules/array.d.ts +37 -0
- package/frontend/dist/modules/array.js +284 -0
- package/frontend/dist/modules/auth.d.ts +45 -0
- package/frontend/dist/modules/auth.js +138 -0
- package/frontend/dist/modules/colors.d.ts +26 -0
- package/frontend/dist/modules/colors.js +340 -0
- package/frontend/dist/modules/compression.d.ts +6 -0
- package/frontend/dist/modules/compression.js +999 -0
- package/frontend/dist/modules/cookies.d.ts +17 -0
- package/frontend/dist/modules/cookies.js +166 -0
- package/frontend/dist/modules/date.d.ts +142 -0
- package/frontend/dist/modules/date.js +493 -0
- package/frontend/dist/modules/events.d.ts +7 -0
- package/frontend/dist/modules/events.js +90 -0
- package/frontend/dist/modules/google.d.ts +10 -0
- package/frontend/dist/modules/google.js +53 -0
- package/frontend/dist/modules/meta.d.ts +9 -0
- package/frontend/dist/modules/meta.js +45 -0
- package/frontend/dist/modules/mutex.d.ts +8 -0
- package/frontend/dist/modules/mutex.js +52 -0
- package/frontend/dist/modules/number.d.ts +12 -0
- package/frontend/dist/modules/number.js +8 -0
- package/frontend/dist/modules/object.d.ts +50 -0
- package/frontend/dist/modules/object.js +147 -0
- package/frontend/dist/modules/paddle.d.ts +1403 -0
- package/frontend/dist/modules/paddle.js +2641 -0
- package/frontend/dist/modules/scheme.d.ts +207 -0
- package/frontend/dist/modules/scheme.js +649 -0
- package/frontend/dist/modules/settings.d.ts +3 -0
- package/frontend/dist/modules/settings.js +4 -0
- package/frontend/dist/modules/statics.d.ts +4 -0
- package/frontend/dist/modules/statics.js +45 -0
- package/frontend/dist/modules/string.d.ts +163 -0
- package/frontend/dist/modules/string.js +291 -0
- package/frontend/dist/modules/support.d.ts +18 -0
- package/frontend/dist/modules/support.js +102 -0
- package/frontend/dist/modules/themes.d.ts +8 -0
- package/frontend/dist/modules/themes.js +17 -0
- package/frontend/dist/modules/user.d.ts +58 -0
- package/frontend/dist/modules/user.js +279 -0
- package/frontend/dist/modules/utils.d.ts +58 -0
- package/frontend/dist/modules/utils.js +1159 -0
- package/frontend/dist/types/gradient.d.ts +12 -0
- package/frontend/dist/types/gradient.js +79 -0
- package/frontend/dist/ui/border_button.d.ts +177 -0
- package/frontend/dist/ui/border_button.js +235 -0
- package/frontend/dist/ui/button.d.ts +42 -0
- package/frontend/dist/ui/button.js +114 -0
- package/frontend/dist/ui/canvas.d.ts +56 -0
- package/frontend/dist/ui/canvas.js +411 -0
- package/frontend/dist/ui/checkbox.d.ts +72 -0
- package/frontend/dist/ui/checkbox.js +277 -0
- package/frontend/dist/ui/code.d.ts +232 -0
- package/frontend/dist/ui/code.js +977 -0
- package/frontend/dist/ui/color.d.ts +1 -0
- package/frontend/dist/ui/color.js +110 -0
- package/frontend/dist/ui/context_menu.d.ts +30 -0
- package/frontend/dist/ui/context_menu.js +211 -0
- package/frontend/dist/ui/css.d.ts +10 -0
- package/frontend/dist/ui/css.js +44 -0
- package/frontend/dist/ui/divider.d.ts +18 -0
- package/frontend/dist/ui/divider.js +82 -0
- package/frontend/dist/ui/dropdown.d.ts +115 -0
- package/frontend/dist/ui/dropdown.js +446 -0
- package/frontend/dist/ui/for_each.d.ts +38 -0
- package/frontend/dist/ui/for_each.js +97 -0
- package/frontend/dist/ui/form.d.ts +25 -0
- package/frontend/dist/ui/form.js +227 -0
- package/frontend/dist/ui/frame_modes.d.ts +28 -0
- package/frontend/dist/ui/frame_modes.js +116 -0
- package/frontend/dist/ui/google_map.d.ts +31 -0
- package/frontend/dist/ui/google_map.js +111 -0
- package/frontend/dist/ui/gradient.d.ts +24 -0
- package/frontend/dist/ui/gradient.js +115 -0
- package/frontend/dist/ui/image.d.ts +138 -0
- package/frontend/dist/ui/image.js +570 -0
- package/frontend/dist/ui/input.d.ts +316 -0
- package/frontend/dist/ui/input.js +1187 -0
- package/frontend/dist/ui/link.d.ts +39 -0
- package/frontend/dist/ui/link.js +146 -0
- package/frontend/dist/ui/list.d.ts +33 -0
- package/frontend/dist/ui/list.js +161 -0
- package/frontend/dist/ui/loader_button.d.ts +108 -0
- package/frontend/dist/ui/loader_button.js +207 -0
- package/frontend/dist/ui/loaders.d.ts +60 -0
- package/frontend/dist/ui/loaders.js +150 -0
- package/frontend/dist/ui/popup.d.ts +84 -0
- package/frontend/dist/ui/popup.js +331 -0
- package/frontend/dist/ui/pseudo.d.ts +16 -0
- package/frontend/dist/ui/pseudo.js +81 -0
- package/frontend/dist/ui/scroller.d.ts +131 -0
- package/frontend/dist/ui/scroller.js +1251 -0
- package/frontend/dist/ui/slider.d.ts +35 -0
- package/frontend/dist/ui/slider.js +203 -0
- package/frontend/dist/ui/spacer.d.ts +20 -0
- package/frontend/dist/ui/spacer.js +83 -0
- package/frontend/dist/ui/span.d.ts +11 -0
- package/frontend/dist/ui/span.js +75 -0
- package/frontend/dist/ui/stack.d.ts +123 -0
- package/frontend/dist/ui/stack.js +344 -0
- package/frontend/dist/ui/steps.d.ts +72 -0
- package/frontend/dist/ui/steps.js +306 -0
- package/frontend/dist/ui/style.d.ts +12 -0
- package/frontend/dist/ui/style.js +78 -0
- package/frontend/dist/ui/switch.d.ts +44 -0
- package/frontend/dist/ui/switch.js +280 -0
- package/frontend/dist/ui/table.d.ts +118 -0
- package/frontend/dist/ui/table.js +411 -0
- package/frontend/dist/ui/tabs.d.ts +85 -0
- package/frontend/dist/ui/tabs.js +392 -0
- package/frontend/dist/ui/text.d.ts +19 -0
- package/frontend/dist/ui/text.js +88 -0
- package/frontend/dist/ui/theme.d.ts +25 -0
- package/frontend/dist/ui/theme.js +237 -0
- package/frontend/dist/ui/title.d.ts +36 -0
- package/frontend/dist/ui/title.js +127 -0
- package/frontend/dist/ui/ui.d.ts +38 -0
- package/frontend/dist/ui/ui.js +41 -0
- package/frontend/dist/ui/view.d.ts +25 -0
- package/frontend/dist/ui/view.js +93 -0
- package/frontend/dist/volt.d.ts +22 -0
- package/frontend/dist/volt.js +27 -0
- package/frontend/exports.json +1340 -0
- package/frontend/src/css/adyen.css +92 -0
- package/frontend/src/css/volt.css +65 -0
- package/frontend/src/elements/base.ts +16790 -0
- package/frontend/src/elements/module.ts +184 -0
- package/frontend/src/elements/types.d.ts +155 -0
- package/frontend/src/modules/array.ts +366 -0
- package/frontend/src/modules/auth.ts +188 -0
- package/frontend/src/modules/colors.ts +449 -0
- package/frontend/src/modules/compression.ts +67 -0
- package/frontend/src/modules/cookies.ts +182 -0
- package/frontend/src/modules/date.js +535 -0
- package/frontend/src/modules/date.ts +583 -0
- package/frontend/src/modules/events.ts +96 -0
- package/frontend/src/modules/google.ts +60 -0
- package/frontend/src/modules/meta.ts +59 -0
- package/frontend/src/modules/mutex.ts +59 -0
- package/frontend/src/modules/number.ts +20 -0
- package/frontend/src/modules/object.ts +212 -0
- package/frontend/src/modules/paddle.ts +2990 -0
- package/frontend/src/modules/scheme.ts +740 -0
- package/frontend/src/modules/settings.ts +5 -0
- package/frontend/src/modules/statics.ts +47 -0
- package/frontend/src/modules/string.ts +500 -0
- package/frontend/src/modules/support.ts +118 -0
- package/frontend/src/modules/themes.ts +24 -0
- package/frontend/src/modules/user.ts +321 -0
- package/frontend/src/modules/utils.ts +1260 -0
- package/frontend/src/static/admin/admin.png +0 -0
- package/frontend/src/static/admin/password.webp +0 -0
- package/frontend/src/static/icons/copy.webp +0 -0
- package/frontend/src/static/payments/arrow.long.webp +0 -0
- package/frontend/src/static/payments/arrow.long2.webp +0 -0
- package/frontend/src/static/payments/cancelled.webp +0 -0
- package/frontend/src/static/payments/check.sign.webp +0 -0
- package/frontend/src/static/payments/check.webp +0 -0
- package/frontend/src/static/payments/close.webp +0 -0
- package/frontend/src/static/payments/error.webp +0 -0
- package/frontend/src/static/payments/exclamation.webp +0 -0
- package/frontend/src/static/payments/minus.webp +0 -0
- package/frontend/src/static/payments/party.webp +0 -0
- package/frontend/src/static/payments/plus.webp +0 -0
- package/frontend/src/static/payments/shopping_cart.webp +0 -0
- package/frontend/src/static/payments/trash.webp +0 -0
- package/frontend/src/types/global.d.ts +4 -0
- package/frontend/src/types/gradient.ts +87 -0
- package/frontend/src/ui/any_element.d.ts +5 -0
- package/frontend/src/ui/border_button.ts +320 -0
- package/frontend/src/ui/button.ts +62 -0
- package/frontend/src/ui/canvas.ts +431 -0
- package/frontend/src/ui/checkbox.ts +284 -0
- package/frontend/src/ui/code.ts +1049 -0
- package/frontend/src/ui/color.ts +117 -0
- package/frontend/src/ui/context_menu.ts +194 -0
- package/frontend/src/ui/css.ts +57 -0
- package/frontend/src/ui/divider.ts +28 -0
- package/frontend/src/ui/dropdown.ts +503 -0
- package/frontend/src/ui/for_each.ts +71 -0
- package/frontend/src/ui/form.ts +208 -0
- package/frontend/src/ui/frame_modes.ts +140 -0
- package/frontend/src/ui/google_map.ts +70 -0
- package/frontend/src/ui/gradient.ts +73 -0
- package/frontend/src/ui/image.ts +587 -0
- package/frontend/src/ui/input.ts +1284 -0
- package/frontend/src/ui/link.ts +77 -0
- package/frontend/src/ui/list.ts +88 -0
- package/frontend/src/ui/loader_button.ts +192 -0
- package/frontend/src/ui/loaders.ts +126 -0
- package/frontend/src/ui/popup.ts +370 -0
- package/frontend/src/ui/pseudo.ts +33 -0
- package/frontend/src/ui/scroller.ts +1324 -0
- package/frontend/src/ui/slider.ts +215 -0
- package/frontend/src/ui/spacer.ts +29 -0
- package/frontend/src/ui/span.ts +23 -0
- package/frontend/src/ui/stack.ts +238 -0
- package/frontend/src/ui/steps.ts +334 -0
- package/frontend/src/ui/style.ts +26 -0
- package/frontend/src/ui/switch.ts +286 -0
- package/frontend/src/ui/table.ts +323 -0
- package/frontend/src/ui/tabs.ts +441 -0
- package/frontend/src/ui/text.ts +38 -0
- package/frontend/src/ui/theme.ts +279 -0
- package/frontend/src/ui/title.ts +64 -0
- package/frontend/src/ui/ui.ts +47 -0
- package/frontend/src/ui/view.ts +44 -0
- package/frontend/src/volt.ts +31 -0
- package/package.json +58 -0
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Author: Daan van den Bergh
|
|
3
|
+
* Copyright: © 2024 - 2024 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
import * as ts from 'typescript';
|
|
6
|
+
import { vlib } from "../../vinc.js";
|
|
7
|
+
import { vhighlight } from "../../vinc.js";
|
|
8
|
+
import { Utils } from "../../utils.js";
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
import { dirname } from 'path';
|
|
11
|
+
var __dirname = typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(new URL('./package.json', import.meta.url)));
|
|
12
|
+
export * as Preprocessing from "./preprocessing.js";
|
|
13
|
+
/*
|
|
14
|
+
* Preprocesses the input text, replacing non-string numeric literals
|
|
15
|
+
* suffixed with units and hex color codes with string literals.
|
|
16
|
+
*/
|
|
17
|
+
export function preprocess(path, input, opts = {}) {
|
|
18
|
+
const { macros = true, templates = undefined, } = opts;
|
|
19
|
+
// Initialize output and batch
|
|
20
|
+
let output = [];
|
|
21
|
+
let batch = [];
|
|
22
|
+
let State;
|
|
23
|
+
(function (State) {
|
|
24
|
+
State[State["code"] = 0] = "code";
|
|
25
|
+
State[State["string"] = 1] = "string";
|
|
26
|
+
State[State["comment"] = 2] = "comment";
|
|
27
|
+
State[State["regex"] = 3] = "regex";
|
|
28
|
+
})(State || (State = {}));
|
|
29
|
+
let state = State.code;
|
|
30
|
+
// Function to process the accumulated batch
|
|
31
|
+
const process_code_batch = () => {
|
|
32
|
+
let str = batch.join('')
|
|
33
|
+
// Replace numeric suffix to string.
|
|
34
|
+
.replace(/\b\d+(\.\d+)?(em\b|rem\b|px\b|vh\b|vw\b|%)/g, '"$&"')
|
|
35
|
+
// Replace hex colors.
|
|
36
|
+
.replace(/#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\b/g, '"$&"');
|
|
37
|
+
// Append the transformed segment to output
|
|
38
|
+
output.push(str);
|
|
39
|
+
// Clear the batch
|
|
40
|
+
batch = [];
|
|
41
|
+
};
|
|
42
|
+
// Process string batch.
|
|
43
|
+
const process_string_batch = () => {
|
|
44
|
+
let BaseIndentState;
|
|
45
|
+
(function (BaseIndentState) {
|
|
46
|
+
BaseIndentState[BaseIndentState["init"] = 0] = "init";
|
|
47
|
+
})(BaseIndentState || (BaseIndentState = {}));
|
|
48
|
+
let str = batch.join('')
|
|
49
|
+
// Dedent ``` code blocks.
|
|
50
|
+
.replace(/```([\s\S]*?)```/g, (match, code) => {
|
|
51
|
+
// console.log("===========================\nMatched\n"+ code)
|
|
52
|
+
// Remove leading and trailing empty lines
|
|
53
|
+
// Dont use trim() since that would also remove start indent.
|
|
54
|
+
code = code.replace(/^\s*\n|\s*$/g, '');
|
|
55
|
+
// Match the base indentation (4 spaces) from the first non-empty line
|
|
56
|
+
const base_indent_match = code.match(/^([ \t]+)/m);
|
|
57
|
+
if (!base_indent_match)
|
|
58
|
+
return '`' + code + '`'; // No base indent found
|
|
59
|
+
const base_indent = base_indent_match[1];
|
|
60
|
+
// Ensure base_indent contains only spaces
|
|
61
|
+
// if (/\t/.test(base_indent)) {
|
|
62
|
+
// throw new Error('Invalid indentation: Tabs are not allowed.');
|
|
63
|
+
// }
|
|
64
|
+
// Create a regex to remove the base_indent from the start of each line
|
|
65
|
+
const dedent_regex = new RegExp(`^${base_indent}`, 'gm');
|
|
66
|
+
// Dedent the code by removing base_indent
|
|
67
|
+
const dedented_code = code.replace(dedent_regex, '');
|
|
68
|
+
return `\`${dedented_code}\``;
|
|
69
|
+
});
|
|
70
|
+
// Append the transformed segment to output
|
|
71
|
+
output.push(str);
|
|
72
|
+
// Clear the batch
|
|
73
|
+
batch = [];
|
|
74
|
+
};
|
|
75
|
+
// Initialize the Iterator
|
|
76
|
+
new vhighlight.Iterator({
|
|
77
|
+
tokenizer: vhighlight.js,
|
|
78
|
+
language: vhighlight.js.language,
|
|
79
|
+
code: input,
|
|
80
|
+
callback(s) {
|
|
81
|
+
// Get new state.
|
|
82
|
+
let new_state;
|
|
83
|
+
if (s.is_str || s.is_template_literal) {
|
|
84
|
+
new_state = State.string;
|
|
85
|
+
}
|
|
86
|
+
else if (s.is_comment || s.is_multi_line_comment) {
|
|
87
|
+
new_state = State.comment;
|
|
88
|
+
}
|
|
89
|
+
else if (s.is_str) {
|
|
90
|
+
new_state = State.regex;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
new_state = State.code;
|
|
94
|
+
}
|
|
95
|
+
// Process new state.
|
|
96
|
+
if (new_state !== state) {
|
|
97
|
+
if (state === State.code) {
|
|
98
|
+
process_code_batch();
|
|
99
|
+
}
|
|
100
|
+
else if (state === State.string) {
|
|
101
|
+
process_string_batch();
|
|
102
|
+
}
|
|
103
|
+
state = new_state;
|
|
104
|
+
}
|
|
105
|
+
// Push character.
|
|
106
|
+
if (state === State.code || state === State.string) {
|
|
107
|
+
batch.push(s.char);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
output.push(s.char);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
}).iterate();
|
|
114
|
+
// Process any remaining batch after iteration
|
|
115
|
+
if (batch.length > 0) {
|
|
116
|
+
if (state === State.code) {
|
|
117
|
+
process_code_batch();
|
|
118
|
+
}
|
|
119
|
+
else if (state === State.string) {
|
|
120
|
+
process_string_batch();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
let content = output.join("");
|
|
124
|
+
// Apply plugins.
|
|
125
|
+
content = _global_interface_plugin(content);
|
|
126
|
+
// if (path.includes("ui.ts")) {
|
|
127
|
+
// console.log(content)
|
|
128
|
+
// }
|
|
129
|
+
// Process macros.
|
|
130
|
+
if (macros) {
|
|
131
|
+
content = _apply_macro_preprocessing(path, content);
|
|
132
|
+
}
|
|
133
|
+
// Fill templates.
|
|
134
|
+
if (templates !== undefined && Object.keys(templates.length > 0)) {
|
|
135
|
+
content = Utils.fill_templates(content, templates, true);
|
|
136
|
+
}
|
|
137
|
+
// Response.
|
|
138
|
+
return content;
|
|
139
|
+
}
|
|
140
|
+
// Split macro args `X, X` args.
|
|
141
|
+
function _split_macro_args(data) {
|
|
142
|
+
// Process args.
|
|
143
|
+
let args = [""];
|
|
144
|
+
const process_arg = () => {
|
|
145
|
+
let arg = args[args.length - 1].trim();
|
|
146
|
+
if ((arg.charAt(0) === "'" && arg.charAt(arg.length - 1) === "'") ||
|
|
147
|
+
(arg.charAt(0) === "\"" && arg.charAt(arg.length - 1) === "\"")) {
|
|
148
|
+
arg = arg.slice(1, -1);
|
|
149
|
+
}
|
|
150
|
+
args[args.length - 1] = arg;
|
|
151
|
+
};
|
|
152
|
+
// Iterate.
|
|
153
|
+
new vhighlight.Iterator({
|
|
154
|
+
tokenizer: vhighlight.js,
|
|
155
|
+
language: vhighlight.js.language,
|
|
156
|
+
code: data,
|
|
157
|
+
callback(state) {
|
|
158
|
+
if (state.char === "," &&
|
|
159
|
+
state.curly_depth === 0 &&
|
|
160
|
+
state.bracket_depth === 0 &&
|
|
161
|
+
state.parenth_depth === 0 &&
|
|
162
|
+
!state.is_str &&
|
|
163
|
+
!state.is_regex &&
|
|
164
|
+
!state.is_comment &&
|
|
165
|
+
!state.is_multi_line_comment) {
|
|
166
|
+
process_arg();
|
|
167
|
+
args.push("");
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
args[args.length - 1] += state.char;
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
}).iterate();
|
|
174
|
+
// Return empty array.
|
|
175
|
+
if (args.length === 1 && args[0] === "") {
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
178
|
+
// Process arg.
|
|
179
|
+
if (args.length > 0) {
|
|
180
|
+
process_arg();
|
|
181
|
+
}
|
|
182
|
+
// Return args.
|
|
183
|
+
return args;
|
|
184
|
+
}
|
|
185
|
+
/*
|
|
186
|
+
* Fill all #macro statements.
|
|
187
|
+
*/
|
|
188
|
+
function _apply_macro_preprocessing(path, data) {
|
|
189
|
+
// ----------------------------------------
|
|
190
|
+
// Extract macro statements.
|
|
191
|
+
let output = [], is_preprocessor = null;
|
|
192
|
+
const macros = {};
|
|
193
|
+
let iterator = new vhighlight.Iterator({
|
|
194
|
+
tokenizer: vhighlight.js,
|
|
195
|
+
language: vhighlight.js.language,
|
|
196
|
+
code: data,
|
|
197
|
+
allow_preprocessors: true,
|
|
198
|
+
callback(state) {
|
|
199
|
+
// End of preprocessor.
|
|
200
|
+
if (is_preprocessor !== undefined && !state.is_preprocessor) {
|
|
201
|
+
// Extract name & value.
|
|
202
|
+
let Modes;
|
|
203
|
+
(function (Modes) {
|
|
204
|
+
Modes[Modes["type"] = 0] = "type";
|
|
205
|
+
Modes[Modes["pre_name"] = 1] = "pre_name";
|
|
206
|
+
Modes[Modes["name"] = 2] = "name";
|
|
207
|
+
Modes[Modes["args"] = 3] = "args";
|
|
208
|
+
Modes[Modes["value"] = 4] = "value";
|
|
209
|
+
})(Modes || (Modes = {}));
|
|
210
|
+
;
|
|
211
|
+
let type = "", name = "", value = "", full = "", args = "", args_depth = [0, 0, 0];
|
|
212
|
+
let s = is_preprocessor, mode = Modes.type;
|
|
213
|
+
while (s != null && s != state) {
|
|
214
|
+
if (mode === Modes.type) {
|
|
215
|
+
if (s.is_whitespace) {
|
|
216
|
+
mode = Modes.pre_name;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
type += s.char;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else if (mode === Modes.pre_name && !s.is_whitespace) {
|
|
223
|
+
mode = Modes.name;
|
|
224
|
+
name += s.char;
|
|
225
|
+
}
|
|
226
|
+
else if (mode === Modes.name) {
|
|
227
|
+
if (s.char === "(") {
|
|
228
|
+
mode = Modes.args;
|
|
229
|
+
args_depth = [s.curly_depth, s.parenth_depth - 1, s.bracket_depth];
|
|
230
|
+
}
|
|
231
|
+
else if (s.is_whitespace &&
|
|
232
|
+
s.curly_depth === is_preprocessor.curly_depth &&
|
|
233
|
+
s.parenth_depth === is_preprocessor.parenth_depth &&
|
|
234
|
+
s.bracket_depth === is_preprocessor.bracket_depth) {
|
|
235
|
+
mode = Modes.value;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
name += s.char;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else if (mode === Modes.args) {
|
|
242
|
+
if (s.char === ")" &&
|
|
243
|
+
s.curly_depth === args_depth[0] &&
|
|
244
|
+
s.parenth_depth === args_depth[1] &&
|
|
245
|
+
s.bracket_depth === args_depth[2]) {
|
|
246
|
+
mode = Modes.name;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
args += s.char;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else if (mode === Modes.value) {
|
|
253
|
+
if (s.char === "\\" && s.next?.is_line_break) {
|
|
254
|
+
// skip.
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
value += s.char;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
full += s.char;
|
|
261
|
+
s = s.next;
|
|
262
|
+
}
|
|
263
|
+
if (type === "#macro") {
|
|
264
|
+
name = name.trim();
|
|
265
|
+
macros[name] = {
|
|
266
|
+
name,
|
|
267
|
+
value: value.trim(),
|
|
268
|
+
args: args.length === 0 ? [] : _split_macro_args(args),
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
output.push(full);
|
|
273
|
+
}
|
|
274
|
+
is_preprocessor = undefined;
|
|
275
|
+
}
|
|
276
|
+
// Start of preprocessor.
|
|
277
|
+
else if (state.is_preprocessor) {
|
|
278
|
+
if (is_preprocessor === undefined) {
|
|
279
|
+
is_preprocessor = state;
|
|
280
|
+
}
|
|
281
|
+
return; // dont add to new data.
|
|
282
|
+
}
|
|
283
|
+
output.push(state.char);
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
iterator.iterate();
|
|
287
|
+
data = output.join("");
|
|
288
|
+
// ----------------------------------------
|
|
289
|
+
// Fill macro statements.
|
|
290
|
+
output.length = 0;
|
|
291
|
+
let buff = [];
|
|
292
|
+
// Construct regex to match preprocessor variables
|
|
293
|
+
const macros_keys = Object.keys(macros);
|
|
294
|
+
const regex = new RegExp(`(\\#?|\\b)(${macros_keys.join("|")})(\\([^)]*\\)|\\b)`, 'g');
|
|
295
|
+
// Fill macro replacements.
|
|
296
|
+
const make_replacements = (buff) => {
|
|
297
|
+
return buff
|
|
298
|
+
.join('')
|
|
299
|
+
.replace(regex, (match, m1, m2, m3) => {
|
|
300
|
+
const macro = macros[m2];
|
|
301
|
+
if (macro == null) {
|
|
302
|
+
return match;
|
|
303
|
+
}
|
|
304
|
+
let value = "";
|
|
305
|
+
if (m1.charAt(0) !== "#") {
|
|
306
|
+
value = m1;
|
|
307
|
+
}
|
|
308
|
+
value += macro.value;
|
|
309
|
+
if (m3 && m3.charAt(0) === "(" && macro.args.length > 0) {
|
|
310
|
+
let args = _split_macro_args(m3.slice(1, -1));
|
|
311
|
+
for (let i = 0; i < macro.args.length; i++) {
|
|
312
|
+
value = value.replace(new RegExp(`\\b${macro.args[i]}\\b`, 'g'), args[i] ?? "");
|
|
313
|
+
}
|
|
314
|
+
return value;
|
|
315
|
+
}
|
|
316
|
+
return value;
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
// Iterator that processes the code
|
|
320
|
+
iterator = new vhighlight.Iterator({
|
|
321
|
+
tokenizer: vhighlight.js,
|
|
322
|
+
language: vhighlight.js.language,
|
|
323
|
+
code: data,
|
|
324
|
+
allow_preprocessors: true,
|
|
325
|
+
callback(state) {
|
|
326
|
+
// Accumulate real code into the buffer
|
|
327
|
+
if (!state.is_str && !state.is_regex && !state.is_comment && !state.is_multi_line_comment) {
|
|
328
|
+
buff.push(state.char);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
// Process code buff.
|
|
332
|
+
if (buff.length > 0) {
|
|
333
|
+
output.push(make_replacements(buff));
|
|
334
|
+
buff = [];
|
|
335
|
+
}
|
|
336
|
+
// Push non-code characters directly to output (strings, comments, etc.)
|
|
337
|
+
output.push(state.char);
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
// Run the iterator to process the code
|
|
342
|
+
iterator.iterate();
|
|
343
|
+
// Process code buff.
|
|
344
|
+
if (buff.length > 0) {
|
|
345
|
+
output.push(make_replacements(buff));
|
|
346
|
+
}
|
|
347
|
+
// Return the processed output as a joined string
|
|
348
|
+
return output.join('');
|
|
349
|
+
}
|
|
350
|
+
// Process all code sections.
|
|
351
|
+
// function _process_code_sections(path: string, data: string, callback: ((code: string) => string) | ((code: string) => string)[]): string {
|
|
352
|
+
// let batch: string[] = [];
|
|
353
|
+
// let is_code = true, start_index: number | undefined = undefined;
|
|
354
|
+
// new vhighlight.Iterator({
|
|
355
|
+
// tokenizer: vhighlight.js,
|
|
356
|
+
// code: data,
|
|
357
|
+
// callback(state) {
|
|
358
|
+
// if (
|
|
359
|
+
// state.is_str ||
|
|
360
|
+
// state.is_regex ||
|
|
361
|
+
// state.is_comment ||
|
|
362
|
+
// state.is_multi_line_comment
|
|
363
|
+
// ) {
|
|
364
|
+
// if (start_index !== undefined) {
|
|
365
|
+
// let code: string = data.slice(start_index, state.index);
|
|
366
|
+
// if (Array.isArray(callback)) {
|
|
367
|
+
// for (const c of callback) {
|
|
368
|
+
// code = c(code);
|
|
369
|
+
// }
|
|
370
|
+
// } else {
|
|
371
|
+
// code = callback(code);
|
|
372
|
+
// }
|
|
373
|
+
// batch.push(code);
|
|
374
|
+
// start_index = undefined;
|
|
375
|
+
// }
|
|
376
|
+
// batch.push(state.char);
|
|
377
|
+
// } else {
|
|
378
|
+
// if (start_index === undefined) {
|
|
379
|
+
// start_index = state.index;
|
|
380
|
+
// }
|
|
381
|
+
// }
|
|
382
|
+
// },
|
|
383
|
+
// }).iterate();
|
|
384
|
+
// if (start_index !== undefined) {
|
|
385
|
+
// let code: string = data.slice(start_index);
|
|
386
|
+
// if (Array.isArray(callback)) {
|
|
387
|
+
// for (const c of callback) {
|
|
388
|
+
// code = c(code);
|
|
389
|
+
// }
|
|
390
|
+
// } else {
|
|
391
|
+
// code = callback(code);
|
|
392
|
+
// }
|
|
393
|
+
// batch.push(code);
|
|
394
|
+
// }
|
|
395
|
+
// return batch.join("");
|
|
396
|
+
// }
|
|
397
|
+
/* Apply global interfaces. Only used as internal plugin for preprocess().
|
|
398
|
+
With this plugin interfaces can be placed anywhere inside a code file supporting the following syntax.
|
|
399
|
+
|
|
400
|
+
[interface myinterface {
|
|
401
|
+
...
|
|
402
|
+
}]
|
|
403
|
+
[export interface mynamespace.myothernamespace.myinterface {
|
|
404
|
+
...
|
|
405
|
+
}]
|
|
406
|
+
*/
|
|
407
|
+
function _global_interface_plugin(data) {
|
|
408
|
+
const prefix_output = [];
|
|
409
|
+
while (true) {
|
|
410
|
+
// Use a regex without brackets in the character class for clarity
|
|
411
|
+
// and ensure proper spacing handling.
|
|
412
|
+
const regex = /\[(\s*export)*\s*interface\s+([a-zA-Z0-9_.]+)\s*{/g;
|
|
413
|
+
const match = regex.exec(data);
|
|
414
|
+
if (match == null) {
|
|
415
|
+
break; // No more matches.
|
|
416
|
+
}
|
|
417
|
+
const start = match.index;
|
|
418
|
+
let end = -1;
|
|
419
|
+
let curly_start = -1;
|
|
420
|
+
let curly_end = -1;
|
|
421
|
+
// console.log("interface-plugin: Found global interface", match[0])
|
|
422
|
+
// Find closing ].
|
|
423
|
+
new vhighlight.Iterator({
|
|
424
|
+
tokenizer: vhighlight.js,
|
|
425
|
+
language: vhighlight.js.language,
|
|
426
|
+
code: data.slice(start + 1),
|
|
427
|
+
callback(s) {
|
|
428
|
+
if (match[0].includes("UI.ReturnResponseDataOptions")) {
|
|
429
|
+
// console.log(({char: s.char, curly_depth: s.curly_depth, bracket_depth: s.bracket_depth}));
|
|
430
|
+
}
|
|
431
|
+
if (curly_start === -1 && s.curly_depth === 1) {
|
|
432
|
+
// console.log({state: 1});
|
|
433
|
+
curly_start = start + 1 + s.index;
|
|
434
|
+
}
|
|
435
|
+
else if (curly_start !== -1 && curly_end === -1 && s.curly_depth === 0) {
|
|
436
|
+
// console.log({state: 2});
|
|
437
|
+
curly_end = start + 1 + s.index + 1;
|
|
438
|
+
}
|
|
439
|
+
else if (s.bracket_depth === -1) {
|
|
440
|
+
// console.log({state: 3});
|
|
441
|
+
end = start + 1 + s.index + 1;
|
|
442
|
+
return false; // stop iteration
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
// console.log({unmachted: true})
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
}).iterate();
|
|
449
|
+
// if (match[0].includes("UI.ReturnResponseDataOptions") && end === -1) {
|
|
450
|
+
// console.log("DATA:\n"+data)
|
|
451
|
+
// }
|
|
452
|
+
// If we found a closing brace successfully.
|
|
453
|
+
if (curly_end >= 0 && end !== -1) {
|
|
454
|
+
// console.log("interface-plugin: Found global interface", match[0], "proceed");
|
|
455
|
+
// Extract the interface body (excluding the initial '{' and final '}')
|
|
456
|
+
// 'start' points at 'i' of 'interface', so the '{' should be at some offset after that.
|
|
457
|
+
// We found 'end' where bracket_depth returned to -1, i.e., after the closing '}'.
|
|
458
|
+
// Adjust slicing as needed if off by one.
|
|
459
|
+
// Slice out the interface including 'interface ... { ... }'
|
|
460
|
+
// The interface block presumably starts at 'start' and ends at 'end'.
|
|
461
|
+
// We want the inside of the interface without the initial 'i' and final brace.
|
|
462
|
+
// If you want just the inside of the braces, ensure that start+1 and end-1 indices are correct.
|
|
463
|
+
// Push the interface code into prefix_output. Adjust indices if needed.
|
|
464
|
+
let export_statement = match[1] === undefined ? "" : "export ";
|
|
465
|
+
const names = match[2].split(".");
|
|
466
|
+
let closing_curlies = 0;
|
|
467
|
+
for (let i = 0; i < names.length; i++) {
|
|
468
|
+
if (i + 1 === names.length) {
|
|
469
|
+
prefix_output.push(export_statement, "interface ", names[i], " ", data.slice(curly_start, curly_end));
|
|
470
|
+
if (closing_curlies > 0) {
|
|
471
|
+
prefix_output.push("}".repeat(closing_curlies));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
export_statement = "export ";
|
|
476
|
+
prefix_output.push(export_statement, "namespace ", names[i], " { ");
|
|
477
|
+
++closing_curlies;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
prefix_output.push(";\n");
|
|
481
|
+
// Remove the interface from the original code.
|
|
482
|
+
data = (start > 0 ? data.slice(0, start) : "") + data.slice(end);
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
// console.log("interface-plugin: Found global interface", match[0], "dont proceed -",curly_end, end)
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (prefix_output.length > 0) {
|
|
490
|
+
return prefix_output.join("") + data;
|
|
491
|
+
}
|
|
492
|
+
return data;
|
|
493
|
+
}
|
|
494
|
+
// Variables.
|
|
495
|
+
const volt_frontend = new vlib.Path(`${__dirname}/../../../../../frontend/dist/`).abs().str();
|
|
496
|
+
let volt_exports = undefined;
|
|
497
|
+
// Detect unused volt frontend imports.
|
|
498
|
+
function detect_unused_imports(source_file) {
|
|
499
|
+
// Load volt exports.
|
|
500
|
+
if (volt_exports === undefined) {
|
|
501
|
+
volt_exports = new vlib.Path(`${__dirname}/../../../../../frontend/exports.json`).load_sync({ type: "object" });
|
|
502
|
+
volt_exports["ui/ui.ts"] = ["VoltUI"];
|
|
503
|
+
volt_exports["volt.ts"] = ["Volt"];
|
|
504
|
+
}
|
|
505
|
+
// Vars.
|
|
506
|
+
// const source_file = ts.createSourceFile(file_path, file_content, ts.ScriptTarget.Latest, true);
|
|
507
|
+
const imported_identifiers = new Set();
|
|
508
|
+
const declared_identifiers = new Set();
|
|
509
|
+
const used_identifiers = new Set();
|
|
510
|
+
// Helper function to recursively collect declared identifiers
|
|
511
|
+
function collect_declared_identifiers(name) {
|
|
512
|
+
if (ts.isIdentifier(name)) {
|
|
513
|
+
declared_identifiers.add(name.text);
|
|
514
|
+
}
|
|
515
|
+
else if (ts.isObjectBindingPattern(name) || ts.isArrayBindingPattern(name)) {
|
|
516
|
+
name.elements.forEach(element => {
|
|
517
|
+
if (ts.isBindingElement(element)) {
|
|
518
|
+
collect_declared_identifiers(element.name);
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
// First pass: Collect imported and declared identifiers
|
|
524
|
+
const visit_first_pass = (node) => {
|
|
525
|
+
if (ts.isImportDeclaration(node)) {
|
|
526
|
+
if (node.importClause) {
|
|
527
|
+
const { name, namedBindings } = node.importClause;
|
|
528
|
+
if (name)
|
|
529
|
+
imported_identifiers.add(name.text);
|
|
530
|
+
if (namedBindings) {
|
|
531
|
+
if (ts.isNamedImports(namedBindings)) {
|
|
532
|
+
namedBindings.elements.forEach(element => imported_identifiers.add(element.name.text));
|
|
533
|
+
}
|
|
534
|
+
else if (ts.isNamespaceImport(namedBindings)) {
|
|
535
|
+
imported_identifiers.add(namedBindings.name.text);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (ts.isVariableDeclaration(node) && node.name) {
|
|
541
|
+
collect_declared_identifiers(node.name);
|
|
542
|
+
}
|
|
543
|
+
else if (ts.isFunctionDeclaration(node) && node.name) {
|
|
544
|
+
declared_identifiers.add(node.name.text);
|
|
545
|
+
}
|
|
546
|
+
else if (ts.isClassDeclaration(node) && node.name) {
|
|
547
|
+
declared_identifiers.add(node.name.text);
|
|
548
|
+
}
|
|
549
|
+
if (ts.isIdentifier(node)) {
|
|
550
|
+
used_identifiers.add(node.text);
|
|
551
|
+
}
|
|
552
|
+
ts.forEachChild(node, visit_first_pass);
|
|
553
|
+
};
|
|
554
|
+
// Second pass: Collect used identifiers
|
|
555
|
+
// const visit_second_pass = (node: ts.Node) => {
|
|
556
|
+
// if (ts.isIdentifier(node)) {
|
|
557
|
+
// used_identifiers.add(node.text);
|
|
558
|
+
// }
|
|
559
|
+
// ts.forEachChild(node, visit_second_pass);
|
|
560
|
+
// };
|
|
561
|
+
ts.forEachChild(source_file, visit_first_pass);
|
|
562
|
+
// ts.forEachChild(source_file, visit_second_pass);
|
|
563
|
+
const used_names_set = new Set();
|
|
564
|
+
// Determine which classes/variables are used without being imported
|
|
565
|
+
const classes_to_check = new Set(Object.values(volt_exports).flat());
|
|
566
|
+
classes_to_check.forEach(class_name => {
|
|
567
|
+
if (used_identifiers.has(class_name) &&
|
|
568
|
+
!imported_identifiers.has(class_name) &&
|
|
569
|
+
!declared_identifiers.has(class_name)) {
|
|
570
|
+
used_names_set.add(class_name);
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
return Array.from(used_names_set);
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Apply volt frontend auto imports preprocessing
|
|
577
|
+
*/
|
|
578
|
+
export function volt_auto_imports(path, data) {
|
|
579
|
+
// Check auto import
|
|
580
|
+
if (data.includes("@volt-no-auto-import")) {
|
|
581
|
+
return undefined;
|
|
582
|
+
}
|
|
583
|
+
// console.log(path)
|
|
584
|
+
// Capture names.
|
|
585
|
+
const names = detect_unused_imports(ts.createSourceFile(path, data, ts.ScriptTarget.Latest, true));
|
|
586
|
+
// Create needed modules.
|
|
587
|
+
const names_per_module = {}, added_names = new Set;
|
|
588
|
+
for (const name of names) {
|
|
589
|
+
for (const m of Object.keys(volt_exports)) {
|
|
590
|
+
if (name === "VoltUI") {
|
|
591
|
+
names_per_module["VoltUI"] = [];
|
|
592
|
+
}
|
|
593
|
+
else if (name === "Volt") {
|
|
594
|
+
names_per_module["Volt"] = [];
|
|
595
|
+
}
|
|
596
|
+
else if (
|
|
597
|
+
// name !== "volt.ts" &&
|
|
598
|
+
!path.endsWith(m) &&
|
|
599
|
+
volt_exports[m].includes(name) &&
|
|
600
|
+
!added_names.has(name)) {
|
|
601
|
+
if (names_per_module[m] === undefined) {
|
|
602
|
+
names_per_module[m] = [];
|
|
603
|
+
}
|
|
604
|
+
names_per_module[m].push(name);
|
|
605
|
+
added_names.add(name);
|
|
606
|
+
// console.log(name, names_per_module[m])
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
// Add global types.
|
|
611
|
+
let prefix = `import "${volt_frontend}/modules/string.js"; ` +
|
|
612
|
+
`import "${volt_frontend}/modules/number.js"; ` +
|
|
613
|
+
`import "${volt_frontend}/modules/object.js"; ` +
|
|
614
|
+
`import "${volt_frontend}/modules/array.js"; `;
|
|
615
|
+
// Add ts code.
|
|
616
|
+
if (names.length > 0) {
|
|
617
|
+
for (const m of Object.keys(names_per_module)) {
|
|
618
|
+
if (m === "VoltUI") {
|
|
619
|
+
prefix += `import * as VoltUI from "${volt_frontend}/ui/ui.js"; `;
|
|
620
|
+
}
|
|
621
|
+
else if (m === "Volt") {
|
|
622
|
+
prefix += `import * as Volt from "${volt_frontend}/volt.js"; `;
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
prefix += `import { ${names_per_module[m].join(", ")} } from "${volt_frontend}/${m.slice(0, -3)}.js"; `;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
// Response.
|
|
630
|
+
return prefix + data;
|
|
631
|
+
}
|
|
632
|
+
// console.log("=========================\nOUTPUT\n"+
|
|
633
|
+
// preprocess("X", `
|
|
634
|
+
// tokenize({
|
|
635
|
+
// code = undefined,
|
|
636
|
+
// stop_callback = undefined,
|
|
637
|
+
// build_html = false,
|
|
638
|
+
// is_insert_tokens = false,
|
|
639
|
+
// state = undefined,
|
|
640
|
+
// }: TokenizeOptions = {}): string | Tokens {}
|
|
641
|
+
// [interface X.Y.TokenizeOptions {
|
|
642
|
+
// code?: string,
|
|
643
|
+
// stop_callback?: Function,
|
|
644
|
+
// build_html?: boolean,
|
|
645
|
+
// is_insert_tokens?: boolean,
|
|
646
|
+
// state?: TokenizerState,
|
|
647
|
+
// } ]
|
|
648
|
+
// [export interface X.Y.TokenizeOptions2 {
|
|
649
|
+
// code?: string,
|
|
650
|
+
// stop_callback?: Function,
|
|
651
|
+
// build_html?: boolean,
|
|
652
|
+
// is_insert_tokens?: boolean,
|
|
653
|
+
// state?: TokenizerState,
|
|
654
|
+
// } ]
|
|
655
|
+
// [interface TokenizeOptions3 {
|
|
656
|
+
// code?: string,
|
|
657
|
+
// stop_callback?: Function,
|
|
658
|
+
// build_html?: boolean,
|
|
659
|
+
// is_insert_tokens?: boolean,
|
|
660
|
+
// state?: TokenizerState,
|
|
661
|
+
// } ]
|
|
662
|
+
// tokenize({
|
|
663
|
+
// code = undefined,
|
|
664
|
+
// stop_callback = undefined,
|
|
665
|
+
// build_html = false,
|
|
666
|
+
// is_insert_tokens = false,
|
|
667
|
+
// state = undefined,
|
|
668
|
+
// }: string | Tokens;
|
|
669
|
+
// tokenize({
|
|
670
|
+
// code = undefined,
|
|
671
|
+
// stop_callback = undefined,
|
|
672
|
+
// build_html = false,
|
|
673
|
+
// is_insert_tokens = false,
|
|
674
|
+
// state = undefined,
|
|
675
|
+
// }: TokenizeOptions = {}): string | Tokens {
|
|
676
|
+
// // Rese
|
|
677
|
+
// `)
|
|
678
|
+
// );process.exit(1);
|
|
679
|
+
// console.log("=========================\nOUTPUT\n"+
|
|
680
|
+
// preprocess("X", `
|
|
681
|
+
// .inner_html(
|
|
682
|
+
// \`\`\`
|
|
683
|
+
// 1 Begin with installing the Libris Client via npm, offering seamless interaction through either the Libris Client API or the intuitive Libris CLI.
|
|
684
|
+
// <div style='height: 0.5em'></div>
|
|
685
|
+
// More information about installing libris can be found in the \${ThemeV2.Link("documentation", "/docs?id=getting_started/installation")}.
|
|
686
|
+
// \`\`\`
|
|
687
|
+
// ),
|
|
688
|
+
// .inner_html(
|
|
689
|
+
// \`\`\`
|
|
690
|
+
// 2 Begin with installing the Libris Client via npm, offering seamless interaction through either the Libris Client API or the intuitive Libris CLI.
|
|
691
|
+
// <div style='height: 0.5em'></div>
|
|
692
|
+
// More information about installing libris can be found in the \${ThemeV2.Link("documentation", "/docs?id=getting_started/installation")}.
|
|
693
|
+
// \`\`\`
|
|
694
|
+
// ),
|
|
695
|
+
// .inner_html(
|
|
696
|
+
// \`\`\`3 Begin with installing the Libris Client via npm, offering seamless interaction through either the Libris Client API or the intuitive Libris CLI.
|
|
697
|
+
// <div style='height: 0.5em'></div>
|
|
698
|
+
// More information about installing libris can be found in the \${ThemeV2.Link("documentation", "/docs?id=getting_started/installation")}.
|
|
699
|
+
// \`\`\`
|
|
700
|
+
// ),
|
|
701
|
+
// \`\`\`
|
|
702
|
+
// ---
|
|
703
|
+
// title: Lorem Ipsum
|
|
704
|
+
// name: lorem_ipsum.md
|
|
705
|
+
// ---
|
|
706
|
+
// # Lorem ipsum
|
|
707
|
+
// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
708
|
+
// \`\`\`
|
|
709
|
+
// \`\`\`
|
|
710
|
+
// {
|
|
711
|
+
// "name": "My Project", // The name of your project.
|
|
712
|
+
// "version": "1.1", // The documentation version.
|
|
713
|
+
// "include": [ // The source files you want to include, directories are allowed.
|
|
714
|
+
// "src/load.js"
|
|
715
|
+
// ],
|
|
716
|
+
// "documents": [
|
|
717
|
+
// "pages/lorem_ipsum.md" // The source path to the document.
|
|
718
|
+
// ],
|
|
719
|
+
// "output": "docs.html" // The output path of the generated HTML data.
|
|
720
|
+
// }
|
|
721
|
+
// \`\`\`
|
|
722
|
+
// `)
|
|
723
|
+
// );process.exit(1);
|
|
724
|
+
export default { preprocess, volt_auto_imports };
|