@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,977 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Author: Daan van den Bergh
|
|
3
|
+
* Copyright: © 2022 - 2024 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
6
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
7
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
8
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
9
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
10
|
+
var _, done = false;
|
|
11
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12
|
+
var context = {};
|
|
13
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
14
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
15
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
16
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
17
|
+
if (kind === "accessor") {
|
|
18
|
+
if (result === void 0) continue;
|
|
19
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
20
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
21
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
22
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
23
|
+
}
|
|
24
|
+
else if (_ = accept(result)) {
|
|
25
|
+
if (kind === "field") initializers.unshift(_);
|
|
26
|
+
else descriptor[key] = _;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
30
|
+
done = true;
|
|
31
|
+
};
|
|
32
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
33
|
+
var useValue = arguments.length > 2;
|
|
34
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
35
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
36
|
+
}
|
|
37
|
+
return useValue ? value : void 0;
|
|
38
|
+
};
|
|
39
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
40
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
41
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
42
|
+
};
|
|
43
|
+
// @exports: CodeBlockElement, CodeBlock, CodePreElement, CodePre, CodeLineElement, CodeLine, MultiLanguageCodeBlockElement, MultiLanguageCodeBlock
|
|
44
|
+
// Imports.
|
|
45
|
+
import { Utils } from "../modules/utils.js";
|
|
46
|
+
import { Elements, VElementTagMap, VDiv } from "../elements/module.js";
|
|
47
|
+
import { Span } from "./span";
|
|
48
|
+
import { VStack, VStackElement, HStack } from "./stack";
|
|
49
|
+
import { ImageMask } from "./image";
|
|
50
|
+
import { ForEach } from "./for_each";
|
|
51
|
+
import { Spacer } from "./spacer";
|
|
52
|
+
import { Divider } from "./divider";
|
|
53
|
+
// import * as vhighlight from "/Users/administrator/persistance/private/dev/vinc/vhighlight"
|
|
54
|
+
import * as vhighlight from "../../../../vhighlight/dist/web";
|
|
55
|
+
// All codeblocks using languages.
|
|
56
|
+
const language_codeblocks = [];
|
|
57
|
+
// CodeBlock.
|
|
58
|
+
let CodeBlockElement = (() => {
|
|
59
|
+
var _a;
|
|
60
|
+
let _classDecorators = [(_a = Elements).register.bind(_a)];
|
|
61
|
+
let _classDescriptor;
|
|
62
|
+
let _classExtraInitializers = [];
|
|
63
|
+
let _classThis;
|
|
64
|
+
let _classSuper = VElementTagMap.code;
|
|
65
|
+
var CodeBlockElement = _classThis = class extends _classSuper {
|
|
66
|
+
// Constructor.
|
|
67
|
+
constructor(code_or_opts = {
|
|
68
|
+
code: "", // the code data.
|
|
69
|
+
language: undefined, // the language.
|
|
70
|
+
line_numbers: false, // enable line numbers.
|
|
71
|
+
line_divider: true, // enable the line divider, only an option when line numbers are enabled.
|
|
72
|
+
animate: false, // animate code writing.
|
|
73
|
+
delay: 25, // animation delay in milliseconds, only used when animatinos are enabled.
|
|
74
|
+
duration: undefined, // animation duration in milliseconds, only used when animatinos are enabled.
|
|
75
|
+
already_highlighted: false, // can be used to indicate the code is already highlighted.
|
|
76
|
+
opts: {}, // special args of the language's tokenizer constructor.
|
|
77
|
+
}) {
|
|
78
|
+
// Initialize base class.
|
|
79
|
+
super({
|
|
80
|
+
derived: CodeBlockElement,
|
|
81
|
+
});
|
|
82
|
+
// Attributes.
|
|
83
|
+
let code = code_or_opts;
|
|
84
|
+
this.language = undefined;
|
|
85
|
+
this.line_numbers = false;
|
|
86
|
+
this.line_divider = true;
|
|
87
|
+
this.animate = false;
|
|
88
|
+
this.delay = 25;
|
|
89
|
+
this.duration = undefined;
|
|
90
|
+
this.already_highlighted = false;
|
|
91
|
+
this.opts = {};
|
|
92
|
+
if (typeof code_or_opts === "object") {
|
|
93
|
+
if (code_or_opts.code !== undefined) {
|
|
94
|
+
code = code_or_opts.code;
|
|
95
|
+
}
|
|
96
|
+
if (code_or_opts.language !== undefined) {
|
|
97
|
+
this.language = code_or_opts.language;
|
|
98
|
+
}
|
|
99
|
+
if (code_or_opts.line_numbers !== undefined) {
|
|
100
|
+
this.line_numbers = code_or_opts.line_numbers;
|
|
101
|
+
}
|
|
102
|
+
if (code_or_opts.line_divider !== undefined) {
|
|
103
|
+
this.line_divider = code_or_opts.line_divider;
|
|
104
|
+
}
|
|
105
|
+
if (code_or_opts.already_highlighted !== undefined) {
|
|
106
|
+
this.already_highlighted = code_or_opts.already_highlighted;
|
|
107
|
+
}
|
|
108
|
+
if (code_or_opts.animate !== undefined) {
|
|
109
|
+
this.animate = code_or_opts.animate;
|
|
110
|
+
}
|
|
111
|
+
if (code_or_opts.delay !== undefined) {
|
|
112
|
+
this.delay = code_or_opts.delay;
|
|
113
|
+
}
|
|
114
|
+
if (code_or_opts.duration !== undefined) {
|
|
115
|
+
this.duration = code_or_opts.duration;
|
|
116
|
+
}
|
|
117
|
+
if (code_or_opts.opts !== undefined) {
|
|
118
|
+
this.opts = code_or_opts.opts;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Code per language.
|
|
122
|
+
if (typeof code === "object") {
|
|
123
|
+
console.warn("This behaviour is deprecated., use MultiLanguageCodeBlock instead.");
|
|
124
|
+
code = "";
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
code = code.trim();
|
|
128
|
+
}
|
|
129
|
+
// Code pre.
|
|
130
|
+
this.pre = CodePre(code)
|
|
131
|
+
.parent(this)
|
|
132
|
+
.color("inherit")
|
|
133
|
+
.font("inherit")
|
|
134
|
+
.background("none")
|
|
135
|
+
.border_radius(0)
|
|
136
|
+
.padding(0)
|
|
137
|
+
.margin(0)
|
|
138
|
+
.stretch(true)
|
|
139
|
+
.overflow("visible")
|
|
140
|
+
.line_height("inherit");
|
|
141
|
+
// Line numbers.
|
|
142
|
+
this.lines = VDiv()
|
|
143
|
+
.parent(this)
|
|
144
|
+
.color("var(--vhighlight-token-comment)")
|
|
145
|
+
.font("inherit")
|
|
146
|
+
.white_space("pre")
|
|
147
|
+
.line_height("inherit")
|
|
148
|
+
.flex_shrink(0)
|
|
149
|
+
.hide();
|
|
150
|
+
// Line numbers divider.
|
|
151
|
+
this.lines_divider = VDiv()
|
|
152
|
+
.parent(this)
|
|
153
|
+
.background("var(--vhighlight-token-comment)")
|
|
154
|
+
.fixed_width(0.5)
|
|
155
|
+
.flex_shrink(0)
|
|
156
|
+
.fixed_height("calc(100% - 6px)")
|
|
157
|
+
.margin(3, 10, 0, 10)
|
|
158
|
+
.hide();
|
|
159
|
+
// The content.
|
|
160
|
+
this.content = HStack(this.lines, this.lines_divider, this.pre)
|
|
161
|
+
.parent(this)
|
|
162
|
+
.padding(CodeBlockElement.default_style.padding)
|
|
163
|
+
.flex_wrap("nowrap")
|
|
164
|
+
.overflow("auto visible");
|
|
165
|
+
// Append code pre.
|
|
166
|
+
this.append(this.content);
|
|
167
|
+
// Set padding.
|
|
168
|
+
this.padding(0);
|
|
169
|
+
}
|
|
170
|
+
// Hide/show the scrollbar.
|
|
171
|
+
hide_scrollbar() {
|
|
172
|
+
this.content.classList.add("hide_scrollbar");
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
175
|
+
show_scrollbar() {
|
|
176
|
+
this.content.classList.remove("hide_scrollbar");
|
|
177
|
+
return this;
|
|
178
|
+
}
|
|
179
|
+
// Show.
|
|
180
|
+
show() {
|
|
181
|
+
this.style.display = "flex";
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
// Highlight code.
|
|
185
|
+
highlight({ code, // only required if the code was not provided by the constructor.
|
|
186
|
+
language, // code language, precedes element attribute "language".
|
|
187
|
+
line_numbers, // show line numbers.
|
|
188
|
+
line_divider, // show line numbers divider.
|
|
189
|
+
animate, // animate code writing.
|
|
190
|
+
delay, // animation delay in milliseconds, only used when animatinos are enabled.
|
|
191
|
+
duration, // animation duration in milliseconds, only used when animatinos are enabled.
|
|
192
|
+
opts, // special args of the language's tokenizer constructor.
|
|
193
|
+
} = {}) {
|
|
194
|
+
// Update attributes.
|
|
195
|
+
if (language == null) {
|
|
196
|
+
language = this.language;
|
|
197
|
+
}
|
|
198
|
+
if (line_numbers == null) {
|
|
199
|
+
line_numbers = this.line_numbers;
|
|
200
|
+
}
|
|
201
|
+
if (line_divider == null) {
|
|
202
|
+
line_divider = this.line_divider;
|
|
203
|
+
}
|
|
204
|
+
if (animate == null) {
|
|
205
|
+
animate = this.animate;
|
|
206
|
+
}
|
|
207
|
+
if (delay == null) {
|
|
208
|
+
delay = this.delay;
|
|
209
|
+
}
|
|
210
|
+
if (duration == null) {
|
|
211
|
+
duration = this.duration;
|
|
212
|
+
}
|
|
213
|
+
if (opts == null) {
|
|
214
|
+
opts = this.opts;
|
|
215
|
+
}
|
|
216
|
+
// Highlight.
|
|
217
|
+
this.pre.highlight({
|
|
218
|
+
code: code,
|
|
219
|
+
language: language,
|
|
220
|
+
animate: animate,
|
|
221
|
+
delay: delay,
|
|
222
|
+
duration: duration,
|
|
223
|
+
opts: opts,
|
|
224
|
+
_post_tokenized_callback: !line_numbers ? undefined : (tokens) => {
|
|
225
|
+
// Set line numbers.
|
|
226
|
+
this.lines.show();
|
|
227
|
+
this.lines_divider.show();
|
|
228
|
+
if (line_divider) {
|
|
229
|
+
this.lines_divider.fixed_width(1);
|
|
230
|
+
this.lines_divider.margin(3, 10, 0, 10);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
this.lines_divider.fixed_width(0);
|
|
234
|
+
this.lines_divider.margin(3, 12.5, 0, 12.5);
|
|
235
|
+
}
|
|
236
|
+
let html = "";
|
|
237
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
238
|
+
html += `${(i + 1)}\n`;
|
|
239
|
+
}
|
|
240
|
+
this.lines.innerHTML = html;
|
|
241
|
+
this.lines_divider.min_height(this.lines.offsetHeight - 6);
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
// Response.
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
__setFunctionName(_classThis, "CodeBlockElement");
|
|
249
|
+
(() => {
|
|
250
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
251
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
252
|
+
CodeBlockElement = _classThis = _classDescriptor.value;
|
|
253
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
254
|
+
})();
|
|
255
|
+
_classThis.default_style = {
|
|
256
|
+
"display": "flex",
|
|
257
|
+
"flex-direction": "column",
|
|
258
|
+
"margin": "0px 0px 0px 0px",
|
|
259
|
+
"padding": "15px 20px 15px 20px",
|
|
260
|
+
"text-align": "start",
|
|
261
|
+
"white-space": "pre",
|
|
262
|
+
"font-family": "'Menlo', 'Consolas', monospace",
|
|
263
|
+
"font-size": "13px",
|
|
264
|
+
"font-weight": "500",
|
|
265
|
+
"line-height": "18px",
|
|
266
|
+
"border-radius": "15px",
|
|
267
|
+
"color": "#FFFFFF",
|
|
268
|
+
"background": "#262F3D",
|
|
269
|
+
"overflow": "hidden", // only the content should scroll so the header remains fixed.
|
|
270
|
+
"width": "100%",
|
|
271
|
+
"min-width": "100%",
|
|
272
|
+
"--header-color": "inherit",
|
|
273
|
+
"--header-border": "#00000010",
|
|
274
|
+
"--header-background": "inherit",
|
|
275
|
+
"--selected-language-color": "inherit",
|
|
276
|
+
};
|
|
277
|
+
(() => {
|
|
278
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
279
|
+
})();
|
|
280
|
+
return CodeBlockElement = _classThis;
|
|
281
|
+
})();
|
|
282
|
+
export { CodeBlockElement };
|
|
283
|
+
export const CodeBlock = Elements.wrapper(CodeBlockElement);
|
|
284
|
+
export const NullCodeBlock = Elements.create_null(CodeBlockElement);
|
|
285
|
+
// CodePre.
|
|
286
|
+
let CodePreElement = (() => {
|
|
287
|
+
var _a;
|
|
288
|
+
let _classDecorators = [(_a = Elements).register.bind(_a)];
|
|
289
|
+
let _classDescriptor;
|
|
290
|
+
let _classExtraInitializers = [];
|
|
291
|
+
let _classThis;
|
|
292
|
+
let _classSuper = VElementTagMap.pre;
|
|
293
|
+
var CodePreElement = _classThis = class extends _classSuper {
|
|
294
|
+
// Constructor.
|
|
295
|
+
constructor(code = "") {
|
|
296
|
+
// Initialize base class.
|
|
297
|
+
super({
|
|
298
|
+
derived: CodePreElement,
|
|
299
|
+
});
|
|
300
|
+
this.tokens = null;
|
|
301
|
+
this.language = "";
|
|
302
|
+
// Attributes.
|
|
303
|
+
this.code = code;
|
|
304
|
+
// Set code.
|
|
305
|
+
if (this.code != null) {
|
|
306
|
+
while (this.code.length > 0 && this.code[this.code.length - 1] == "\n") {
|
|
307
|
+
this.code = this.code.slice(-this.code.length, -1);
|
|
308
|
+
}
|
|
309
|
+
this.text(this.code);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
// Animate writing.
|
|
313
|
+
// @note cant use attribute for highlighted code since that may be edited inside `highlight()` while the animation is still busy and otherwise highlight would need to be an sync func, but it has to return this, not a promise.
|
|
314
|
+
async animate_writing({ code, delay = 25, duration = undefined, }) {
|
|
315
|
+
// Check highlighted code.
|
|
316
|
+
if (code == null) {
|
|
317
|
+
throw Error(`The code must be highlighted first using "highlight()".`);
|
|
318
|
+
}
|
|
319
|
+
// Cancel animation.
|
|
320
|
+
await this.cancel_animation();
|
|
321
|
+
// Start animation.
|
|
322
|
+
this.innerHTML = "";
|
|
323
|
+
this.allow_animation = true;
|
|
324
|
+
this.animate_promise = new Promise((resolve) => {
|
|
325
|
+
// Set delay based on duration.
|
|
326
|
+
if (duration != null) {
|
|
327
|
+
delay = duration / code.length;
|
|
328
|
+
}
|
|
329
|
+
// Set the min height otherwise the height expands while scrolling while the writing is animated then this can created unwanted behviour when scrolling up.
|
|
330
|
+
const computed = window.getComputedStyle(this);
|
|
331
|
+
this.style.minHeight = `${parseFloat(computed.paddingTop) + parseFloat(computed.paddingBottom) + parseFloat(computed.lineHeight) * this.tokens.length}px`;
|
|
332
|
+
// Reset content.
|
|
333
|
+
this.innerHTML = "";
|
|
334
|
+
// Check html entity.
|
|
335
|
+
const check_html_entity = (index) => {
|
|
336
|
+
let entity = "&", entity_last_index;
|
|
337
|
+
for (let i = index + 1; i < index + 1 + 5; i++) {
|
|
338
|
+
entity += code.charAt(i);
|
|
339
|
+
if (code.charAt(i) === ";") {
|
|
340
|
+
entity_last_index = i;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return { entity, entity_last_index };
|
|
345
|
+
};
|
|
346
|
+
// Add char.
|
|
347
|
+
const add_char = (index) => {
|
|
348
|
+
// Stop.
|
|
349
|
+
if (this.allow_animation !== true) {
|
|
350
|
+
resolve(undefined);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
// Animation finished.
|
|
354
|
+
else if (index >= code.length) {
|
|
355
|
+
resolve(undefined);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
// Animate.
|
|
359
|
+
else {
|
|
360
|
+
// Span opening.
|
|
361
|
+
if (code.charAt(index) === '<') {
|
|
362
|
+
// Fins span open, close and code.
|
|
363
|
+
let span_index;
|
|
364
|
+
let span_open = "";
|
|
365
|
+
let span_close = "";
|
|
366
|
+
let span_code = "";
|
|
367
|
+
let open = true;
|
|
368
|
+
let first = true;
|
|
369
|
+
let recursive = false;
|
|
370
|
+
for (span_index = index; span_index < code.length; span_index++) {
|
|
371
|
+
if (this.allow_animation !== true) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
let char = code.charAt(span_index);
|
|
375
|
+
// Add html entities in one batch.
|
|
376
|
+
if (char === "&") {
|
|
377
|
+
let { entity, entity_last_index } = check_html_entity(span_index);
|
|
378
|
+
if (entity_last_index !== undefined) {
|
|
379
|
+
char = entity;
|
|
380
|
+
span_index = entity_last_index;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// Already open or start of opening.
|
|
384
|
+
if (char == '<' || open) {
|
|
385
|
+
open = true;
|
|
386
|
+
if (first) {
|
|
387
|
+
span_open += char;
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
span_close += char;
|
|
391
|
+
}
|
|
392
|
+
if (char == '>') {
|
|
393
|
+
open = false;
|
|
394
|
+
if (first) {
|
|
395
|
+
first = false;
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
// Animate span code writing.
|
|
399
|
+
let before = this.innerHTML;
|
|
400
|
+
let added_span_code = "";
|
|
401
|
+
const add_span_code = (index) => {
|
|
402
|
+
if (index < span_code.length) {
|
|
403
|
+
added_span_code += span_code[index];
|
|
404
|
+
let add = before;
|
|
405
|
+
add += span_open;
|
|
406
|
+
add += added_span_code;
|
|
407
|
+
add += span_close;
|
|
408
|
+
this.innerHTML = add;
|
|
409
|
+
setTimeout(() => add_span_code(index + 1), delay);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
recursive = true;
|
|
413
|
+
setTimeout(() => add_char(span_index + 1), delay);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
add_span_code(0);
|
|
417
|
+
// Stop.
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
// Add non span code.
|
|
422
|
+
else {
|
|
423
|
+
span_code += char;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (recursive === false && span_index === code.length) {
|
|
427
|
+
resolve(undefined);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// Non span code.
|
|
431
|
+
else {
|
|
432
|
+
// Set char.
|
|
433
|
+
let char = code.charAt(index);
|
|
434
|
+
// Add html entities in one batch.
|
|
435
|
+
if (char === "&") {
|
|
436
|
+
let { entity, entity_last_index } = check_html_entity(index);
|
|
437
|
+
if (entity_last_index !== undefined) {
|
|
438
|
+
char = entity;
|
|
439
|
+
index = entity_last_index;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
// Default.
|
|
443
|
+
this.innerHTML += char;
|
|
444
|
+
setTimeout(() => add_char(index + 1), delay);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
// Start animation.
|
|
449
|
+
add_char(0);
|
|
450
|
+
});
|
|
451
|
+
// Response.
|
|
452
|
+
return this.animate_promise;
|
|
453
|
+
}
|
|
454
|
+
// Cancel animation.
|
|
455
|
+
async cancel_animation() {
|
|
456
|
+
if (this.animate_promise != null) {
|
|
457
|
+
this.allow_animation = false;
|
|
458
|
+
await this.animate_promise;
|
|
459
|
+
this.animate_promise = null;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
// Highlight.
|
|
463
|
+
highlight({ code = undefined, // only required if the code was not provided by the constructor.
|
|
464
|
+
language = undefined, // code language, precedes element attribute "language".
|
|
465
|
+
animate = false, // animate code writing.
|
|
466
|
+
delay = 25, // animation delay in milliseconds, only used when animatinos are enabled.
|
|
467
|
+
duration = undefined, // animation duration in milliseconds, only used when animatinos are enabled.
|
|
468
|
+
opts = {}, // special args of the language's tokenizer constructor.
|
|
469
|
+
_post_tokenized_callback = undefined, } = {}) {
|
|
470
|
+
console.log("> Highlight");
|
|
471
|
+
// Vars.
|
|
472
|
+
if (code != null) {
|
|
473
|
+
this.code = code;
|
|
474
|
+
while (this.code.length > 0 && this.code[this.code.length - 1] == "\n") {
|
|
475
|
+
this.code = this.code.slice(-this.code.length, -1);
|
|
476
|
+
}
|
|
477
|
+
// this.code = this.code.replaceAll("<", "<").replaceAll(">", ">") // this causees errors when the CodeBlock uses multi languages for a single block.
|
|
478
|
+
this.innerHTML = code;
|
|
479
|
+
}
|
|
480
|
+
if (language != null) {
|
|
481
|
+
this.language = language;
|
|
482
|
+
}
|
|
483
|
+
// Stop when no language is defined.
|
|
484
|
+
if (this.language === "" || this.language == null) {
|
|
485
|
+
return this;
|
|
486
|
+
}
|
|
487
|
+
// Cancel previous animation.
|
|
488
|
+
this.cancel_animation()
|
|
489
|
+
.then(() => {
|
|
490
|
+
console.log("> Cancelled animation");
|
|
491
|
+
// Get tokenizer.
|
|
492
|
+
this.tokenizer = vhighlight.init_tokenizer(this.language, opts);
|
|
493
|
+
if (this.tokenizer == null) {
|
|
494
|
+
return this;
|
|
495
|
+
}
|
|
496
|
+
// Get the tokens.
|
|
497
|
+
this.tokenizer.code = this.code;
|
|
498
|
+
this.tokens = this.tokenizer.tokenize();
|
|
499
|
+
// Build the html.
|
|
500
|
+
const highlighted_code = this.tokenizer.build_html(this.tokens);
|
|
501
|
+
console.log("> Highlighted:", highlighted_code);
|
|
502
|
+
// Post tokenize callback.
|
|
503
|
+
if (_post_tokenized_callback != null) {
|
|
504
|
+
_post_tokenized_callback(this.tokens);
|
|
505
|
+
}
|
|
506
|
+
// Set code.
|
|
507
|
+
if (animate == true) {
|
|
508
|
+
this.animate_writing({ code: highlighted_code, delay, duration });
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
this.innerHTML = highlighted_code;
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
// Response.
|
|
515
|
+
return this;
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
__setFunctionName(_classThis, "CodePreElement");
|
|
519
|
+
(() => {
|
|
520
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
521
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
522
|
+
CodePreElement = _classThis = _classDescriptor.value;
|
|
523
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
524
|
+
})();
|
|
525
|
+
_classThis.default_style = {
|
|
526
|
+
"margin": "0px 0px 0px 0px",
|
|
527
|
+
"padding": "15px 20px 15px 20px",
|
|
528
|
+
"text-align": "start",
|
|
529
|
+
"white-space": "pre",
|
|
530
|
+
"font-family": "'Menlo', 'Consolas', monospace",
|
|
531
|
+
"font-size": "13px",
|
|
532
|
+
"font-weight": "500",
|
|
533
|
+
"line-height": "16px",
|
|
534
|
+
"border-radius": "15px",
|
|
535
|
+
"color": "#FFFFFF",
|
|
536
|
+
"background": "#262F3D",
|
|
537
|
+
"tab-size": 4,
|
|
538
|
+
"overflow": "scroll visible",
|
|
539
|
+
};
|
|
540
|
+
(() => {
|
|
541
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
542
|
+
})();
|
|
543
|
+
return CodePreElement = _classThis;
|
|
544
|
+
})();
|
|
545
|
+
export { CodePreElement };
|
|
546
|
+
export const CodePre = Elements.wrapper(CodePreElement);
|
|
547
|
+
export const NullCodePre = Elements.create_null(CodePreElement);
|
|
548
|
+
// CodeLine.
|
|
549
|
+
/* @docs:
|
|
550
|
+
@nav: Frontend
|
|
551
|
+
@chapter: Elements
|
|
552
|
+
@title: Code Line
|
|
553
|
+
@description: Create an inline code line element.
|
|
554
|
+
@param:
|
|
555
|
+
@name: text
|
|
556
|
+
@type: string
|
|
557
|
+
@descr: The code line content.
|
|
558
|
+
*/
|
|
559
|
+
let CodeLineElement = (() => {
|
|
560
|
+
var _a;
|
|
561
|
+
let _classDecorators = [(_a = Elements).register.bind(_a)];
|
|
562
|
+
let _classDescriptor;
|
|
563
|
+
let _classExtraInitializers = [];
|
|
564
|
+
let _classThis;
|
|
565
|
+
let _classSuper = VElementTagMap.span;
|
|
566
|
+
var CodeLineElement = _classThis = class extends _classSuper {
|
|
567
|
+
// Constructor.
|
|
568
|
+
constructor(text) {
|
|
569
|
+
// Initialize base class.
|
|
570
|
+
super({
|
|
571
|
+
derived: CodeLineElement,
|
|
572
|
+
});
|
|
573
|
+
// Set text.
|
|
574
|
+
if (text) {
|
|
575
|
+
this.inner_html(text);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
/* @docs:
|
|
579
|
+
@title: Fill
|
|
580
|
+
@descr: Fill a string with markdown style codeline elements.
|
|
581
|
+
*/
|
|
582
|
+
static fill(text, codeline_callback = () => CodeLine()) {
|
|
583
|
+
// Fill code line's.
|
|
584
|
+
if (text.indexOf("`") !== -1) {
|
|
585
|
+
const split = text.split("`");
|
|
586
|
+
let is_code = false;
|
|
587
|
+
let filled = "";
|
|
588
|
+
for (let i = 0; i < split.length; i++) {
|
|
589
|
+
if (is_code) {
|
|
590
|
+
filled += codeline_callback().inner_html(split[i]);
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
filled += split[i];
|
|
594
|
+
}
|
|
595
|
+
is_code = !is_code;
|
|
596
|
+
}
|
|
597
|
+
text = filled;
|
|
598
|
+
}
|
|
599
|
+
return text;
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
__setFunctionName(_classThis, "CodeLineElement");
|
|
603
|
+
(() => {
|
|
604
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
605
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
606
|
+
CodeLineElement = _classThis = _classDescriptor.value;
|
|
607
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
608
|
+
})();
|
|
609
|
+
_classThis.default_style = {
|
|
610
|
+
"font-family": "\"Menlo\", \"Consolas\", monospace",
|
|
611
|
+
"font-size": "0.90em",
|
|
612
|
+
"font-style": "italic",
|
|
613
|
+
"background": "#000000",
|
|
614
|
+
"color": "#FFFFFF",
|
|
615
|
+
"border-radius": "10px",
|
|
616
|
+
"white-space": "pre",
|
|
617
|
+
"padding": "2.5px 7.5px 2.5px 7.5px",
|
|
618
|
+
};
|
|
619
|
+
(() => {
|
|
620
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
621
|
+
})();
|
|
622
|
+
return CodeLineElement = _classThis;
|
|
623
|
+
})();
|
|
624
|
+
export { CodeLineElement };
|
|
625
|
+
export const CodeLine = Elements.wrapper(CodeLineElement);
|
|
626
|
+
export const NullCodeLine = Elements.create_null(CodeLineElement);
|
|
627
|
+
// Build a code pre that optionally has different code per navigation.
|
|
628
|
+
/* @docs:
|
|
629
|
+
@nav: Frontend
|
|
630
|
+
@chapter: Elements
|
|
631
|
+
@title: Multi Language Code Block
|
|
632
|
+
@description: Build a code pre that optionally has different code per navigation.
|
|
633
|
+
@param:
|
|
634
|
+
@name: code
|
|
635
|
+
@type: CodeObject
|
|
636
|
+
@descr: The array of code objects.
|
|
637
|
+
@attr:
|
|
638
|
+
@name: language
|
|
639
|
+
@descr: The language name.
|
|
640
|
+
@attr:
|
|
641
|
+
@name: title
|
|
642
|
+
@descr: The code title, when left undefined the language name will be used as title.
|
|
643
|
+
@attr:
|
|
644
|
+
@name: data
|
|
645
|
+
@descr: The code data.
|
|
646
|
+
@required: true
|
|
647
|
+
@param:
|
|
648
|
+
@name: highlight
|
|
649
|
+
@type: boolean
|
|
650
|
+
@descr: Highlight the code content.
|
|
651
|
+
*/
|
|
652
|
+
let MultiLanguageCodeBlockElement = (() => {
|
|
653
|
+
var _a;
|
|
654
|
+
let _classDecorators = [(_a = Elements).register.bind(_a)];
|
|
655
|
+
let _classDescriptor;
|
|
656
|
+
let _classExtraInitializers = [];
|
|
657
|
+
let _classThis;
|
|
658
|
+
let _classSuper = VStackElement;
|
|
659
|
+
var MultiLanguageCodeBlockElement = _classThis = class extends _classSuper {
|
|
660
|
+
// Constructor.
|
|
661
|
+
constructor(args) {
|
|
662
|
+
// Inherit.
|
|
663
|
+
super();
|
|
664
|
+
this._pre_nodes = [];
|
|
665
|
+
this._title_nodes = [];
|
|
666
|
+
this._init_derived({
|
|
667
|
+
derived: MultiLanguageCodeBlockElement,
|
|
668
|
+
});
|
|
669
|
+
// Specify.
|
|
670
|
+
let content, highlight = true;
|
|
671
|
+
if (typeof args === "object" && !Array.isArray(args) && args.content) {
|
|
672
|
+
({ content, highlight = true } = args);
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
content = args;
|
|
676
|
+
}
|
|
677
|
+
// Check code.
|
|
678
|
+
let code = [];
|
|
679
|
+
if (typeof content === "string") {
|
|
680
|
+
code = [{ language: "__unknown__", title: undefined, data: content }];
|
|
681
|
+
}
|
|
682
|
+
else if (typeof content === "object" && !Array.isArray(content)) {
|
|
683
|
+
code = [content];
|
|
684
|
+
}
|
|
685
|
+
else if (Array.isArray(content)) {
|
|
686
|
+
code = content;
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
console.error(`Invalid value type of code block "${typeof content}".`);
|
|
690
|
+
}
|
|
691
|
+
// Vars.
|
|
692
|
+
const main_this = this;
|
|
693
|
+
this._fg = MultiLanguageCodeBlockElement.default_style.color;
|
|
694
|
+
this._tint = MultiLanguageCodeBlockElement.default_style["--mlcb-tint"];
|
|
695
|
+
this._div_bg = MultiLanguageCodeBlockElement.default_style["--mlcb-div-bg"];
|
|
696
|
+
this._title_opac = typeof MultiLanguageCodeBlockElement.default_style["--mlcb-title-opac"] === "number"
|
|
697
|
+
? MultiLanguageCodeBlockElement.default_style["--mlcb-title-opac"]
|
|
698
|
+
: parseInt(MultiLanguageCodeBlockElement.default_style["--mlcb-title-opac"]);
|
|
699
|
+
// The header element.
|
|
700
|
+
this.header = HStack(
|
|
701
|
+
// Titles.
|
|
702
|
+
HStack(ForEach(code, (item, index) => {
|
|
703
|
+
const title = VStack(Span(item.title || item.language || "")
|
|
704
|
+
.font_size(12)
|
|
705
|
+
.line_height(12 + 2)
|
|
706
|
+
.font_weight(500)
|
|
707
|
+
.ellipsis_overflow(true), VStack()
|
|
708
|
+
.width("100%")
|
|
709
|
+
.height(2)
|
|
710
|
+
.border_radius(2)
|
|
711
|
+
.transition("background 300ms ease-in-out")
|
|
712
|
+
.background("transparent")
|
|
713
|
+
.assign_to_parent_as("divider")
|
|
714
|
+
.position(null, null, 0, null))
|
|
715
|
+
.transition("opacity 300ms ease-in-out")
|
|
716
|
+
.opacity(this._title_opac)
|
|
717
|
+
.padding(0, 2)
|
|
718
|
+
.flex_shrink(0)
|
|
719
|
+
.center_vertical()
|
|
720
|
+
.height("100%")
|
|
721
|
+
.position("relative")
|
|
722
|
+
.margin_right(20)
|
|
723
|
+
.on_mouse_over(() => {
|
|
724
|
+
if (this.header.selected !== index) {
|
|
725
|
+
title.opacity(1);
|
|
726
|
+
title.divider.opacity(this._title_opac).background(this._fg);
|
|
727
|
+
}
|
|
728
|
+
})
|
|
729
|
+
.on_mouse_out(() => {
|
|
730
|
+
if (this.header.selected !== index) {
|
|
731
|
+
title.opacity(this._title_opac);
|
|
732
|
+
title.divider.opacity(1).background("transparent");
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
if (code.length > 1) {
|
|
736
|
+
title.on_click(() => this.header.select(index));
|
|
737
|
+
}
|
|
738
|
+
this._title_nodes.append(title);
|
|
739
|
+
return title;
|
|
740
|
+
}))
|
|
741
|
+
.parent(this)
|
|
742
|
+
.height("100%")
|
|
743
|
+
.class("hide_scrollbar")
|
|
744
|
+
.wrap(false)
|
|
745
|
+
.overflow("visible")
|
|
746
|
+
// .flex("1 1 0"),
|
|
747
|
+
.width("100%"),
|
|
748
|
+
// Spacer.
|
|
749
|
+
code.length > 1 ? null : Spacer(),
|
|
750
|
+
// Copy image.
|
|
751
|
+
this._copy_img = ImageMask("/volt_static/icons/copy.webp")
|
|
752
|
+
.frame(15, 15)
|
|
753
|
+
.flex_shrink(0)
|
|
754
|
+
.margin(null, null, null, 10)
|
|
755
|
+
.mask_color(this._fg)
|
|
756
|
+
.transform("rotate(90deg)")
|
|
757
|
+
.opacity(this._title_opac)
|
|
758
|
+
.transition("opacity 250ms ease-in-out")
|
|
759
|
+
.on_mouse_over(e => e.opacity(1))
|
|
760
|
+
.on_mouse_out(e => e.opacity(this._title_opac))
|
|
761
|
+
.on_click(async () => {
|
|
762
|
+
if (this.header?.selected_code_pre?.textContent) {
|
|
763
|
+
Utils.copy_to_clipboard(this.header.selected_code_pre.textContent)
|
|
764
|
+
.then(() => {
|
|
765
|
+
// @ts-expect-error
|
|
766
|
+
if (typeof RESPONSE_STATUS !== "undefined") {
|
|
767
|
+
// @ts-expect-error
|
|
768
|
+
RESPONSE_STATUS.message("Copied to clipboard");
|
|
769
|
+
}
|
|
770
|
+
})
|
|
771
|
+
.catch((error) => {
|
|
772
|
+
console.error(error);
|
|
773
|
+
// @ts-expect-error
|
|
774
|
+
if (typeof RESPONSE_STATUS !== "undefined") {
|
|
775
|
+
// @ts-expect-error
|
|
776
|
+
RESPONSE_STATUS.error("Failed to the code to the clipboard");
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
}))
|
|
781
|
+
.width("100%")
|
|
782
|
+
.overflow("hidden")
|
|
783
|
+
.height(42.5)
|
|
784
|
+
.padding(0, 15, 0, 15)
|
|
785
|
+
.center_vertical()
|
|
786
|
+
.z_index(2)
|
|
787
|
+
.extend({
|
|
788
|
+
selected: null,
|
|
789
|
+
selected_lang: null,
|
|
790
|
+
selected_code_pre: null,
|
|
791
|
+
set_selected(index) {
|
|
792
|
+
// Do not check for already selected since it is used in func tint() to set divider tint.
|
|
793
|
+
// Set selected index.
|
|
794
|
+
this.selected = index;
|
|
795
|
+
this.selected_lang = code[index].language ?? "__unknown__";
|
|
796
|
+
this.selected_code_pre = main_this._pre_nodes[index];
|
|
797
|
+
// Set title.
|
|
798
|
+
main_this._title_nodes.iterate((i) => {
|
|
799
|
+
i.opacity(main_this._title_opac);
|
|
800
|
+
if (code.length > 1) {
|
|
801
|
+
i.divider
|
|
802
|
+
.opacity(1)
|
|
803
|
+
.background("transparent")
|
|
804
|
+
.remove_on_theme_updates();
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
main_this._title_nodes[index].opacity(1);
|
|
808
|
+
if (code.length > 1) {
|
|
809
|
+
main_this._title_nodes[index].divider.background(main_this._tint);
|
|
810
|
+
}
|
|
811
|
+
return this;
|
|
812
|
+
},
|
|
813
|
+
select(lang_or_index, recursive = true) {
|
|
814
|
+
// Extract lang and index.
|
|
815
|
+
let lang;
|
|
816
|
+
let index;
|
|
817
|
+
if (typeof lang_or_index === "string") {
|
|
818
|
+
for (let i = 0; i < code.length; i++) {
|
|
819
|
+
if (code[i].language === lang_or_index) {
|
|
820
|
+
lang = lang_or_index;
|
|
821
|
+
index = i;
|
|
822
|
+
break;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
// Nothing found.
|
|
826
|
+
if (index === undefined) {
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
else {
|
|
831
|
+
if (lang_or_index >= code.length) {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
index = lang_or_index;
|
|
835
|
+
lang = code[index].language || "__unknown__";
|
|
836
|
+
}
|
|
837
|
+
// Toggle code pre's.
|
|
838
|
+
if (recursive && lang !== "__unknown__") {
|
|
839
|
+
// localStorage.setItem("__ldoc_code_lang", lang);
|
|
840
|
+
this.select(index, false);
|
|
841
|
+
// LibrisUI.codeblock_lang_headers.iterate((h) => {
|
|
842
|
+
// if (h !== header) {
|
|
843
|
+
// h.select(lang, false)
|
|
844
|
+
// }
|
|
845
|
+
// })
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
this.set_selected(index);
|
|
849
|
+
for (let i = 0; i < main_this._pre_nodes.length; i++) {
|
|
850
|
+
if (i === index) {
|
|
851
|
+
main_this._pre_nodes[i].show();
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
main_this._pre_nodes[i].hide();
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return this;
|
|
859
|
+
}
|
|
860
|
+
});
|
|
861
|
+
// LibrisUI.codeblock_lang_headers.push(header);
|
|
862
|
+
// Add the code items.
|
|
863
|
+
this.content = HStack() // keep as hstack, for some reason the right side of the pre's will have padding as well then.
|
|
864
|
+
.width("100%")
|
|
865
|
+
.overflow("scroll");
|
|
866
|
+
let index = 0;
|
|
867
|
+
code.iterate((item) => {
|
|
868
|
+
if (item.data == null) {
|
|
869
|
+
console.error("Undefined codeblock data" + (item.language === "__unknown__" ? "" : ` for language ${item.language}`) + ".");
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
if (highlight) {
|
|
873
|
+
const tokenizer = vhighlight.init_tokenizer(item.language);
|
|
874
|
+
if (tokenizer) {
|
|
875
|
+
item.data = tokenizer.tokenize({ code: item.data, build_html: true });
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const pre = CodePre()
|
|
879
|
+
.padding(20, 20)
|
|
880
|
+
.margin(0)
|
|
881
|
+
.inner_html(item.data)
|
|
882
|
+
.overflow("visible")
|
|
883
|
+
.background("transparent")
|
|
884
|
+
.border_radius(0)
|
|
885
|
+
.stretch(true); // keep stretch, for some reason the right side of the pre's will have padding as well then.
|
|
886
|
+
pre.hide();
|
|
887
|
+
this._pre_nodes.append(pre);
|
|
888
|
+
this.content.append(pre);
|
|
889
|
+
++index;
|
|
890
|
+
});
|
|
891
|
+
// Main container (this).
|
|
892
|
+
this
|
|
893
|
+
.display("block")
|
|
894
|
+
.white_space("pre")
|
|
895
|
+
.class("hide_scrollbar")
|
|
896
|
+
.max_width("100%")
|
|
897
|
+
.border(1, this._div_bg)
|
|
898
|
+
.position("relative")
|
|
899
|
+
.append(this.header, this.divider = Divider()
|
|
900
|
+
.parent(this)
|
|
901
|
+
.background(this._div_bg)
|
|
902
|
+
.margin(0, 0, 0, 0), this.content);
|
|
903
|
+
// Select first item.
|
|
904
|
+
// @ts-ignore
|
|
905
|
+
this.header.select(0, false);
|
|
906
|
+
}
|
|
907
|
+
// Set default since it inherits another element.
|
|
908
|
+
set_default() {
|
|
909
|
+
return super.set_default(MultiLanguageCodeBlockElement);
|
|
910
|
+
}
|
|
911
|
+
styles(style_dict) {
|
|
912
|
+
if (style_dict == null) {
|
|
913
|
+
let styles = super.styles();
|
|
914
|
+
styles["--mlcb-tint"] = this._tint;
|
|
915
|
+
styles["--mlcb-div-bg"] = this._div_bg;
|
|
916
|
+
styles["--mlcb-title-opac"] = this._title_opac.toString();
|
|
917
|
+
return styles;
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
return super.styles(style_dict);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
color(value) {
|
|
924
|
+
if (value == null) {
|
|
925
|
+
return this._fg;
|
|
926
|
+
}
|
|
927
|
+
this._fg = value;
|
|
928
|
+
super.color(value);
|
|
929
|
+
this._copy_img.mask_color(value);
|
|
930
|
+
return this;
|
|
931
|
+
}
|
|
932
|
+
tint(value) {
|
|
933
|
+
if (value == null) {
|
|
934
|
+
return this._tint;
|
|
935
|
+
}
|
|
936
|
+
this._tint = value;
|
|
937
|
+
this.header.set_selected(this.header.selected); // set tint again.
|
|
938
|
+
return this;
|
|
939
|
+
}
|
|
940
|
+
divider_background(value) {
|
|
941
|
+
if (value == null) {
|
|
942
|
+
return this._div_bg;
|
|
943
|
+
}
|
|
944
|
+
this._div_bg = value;
|
|
945
|
+
this.divider.background(value);
|
|
946
|
+
return this;
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
__setFunctionName(_classThis, "MultiLanguageCodeBlockElement");
|
|
950
|
+
(() => {
|
|
951
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
952
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
953
|
+
MultiLanguageCodeBlockElement = _classThis = _classDescriptor.value;
|
|
954
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
955
|
+
})();
|
|
956
|
+
_classThis.default_style = {
|
|
957
|
+
...VStackElement.default_style,
|
|
958
|
+
"font-family": "'Menlo', 'Consolas', monospace",
|
|
959
|
+
"background": "black",
|
|
960
|
+
"color": "white",
|
|
961
|
+
"box-shadow": "0px 0px 5px #00000005",
|
|
962
|
+
"font-size": "13px",
|
|
963
|
+
"line-height": "18px",
|
|
964
|
+
"border-radius": "10px",
|
|
965
|
+
"tab-size": 4,
|
|
966
|
+
"--mlcb-tint": "white",
|
|
967
|
+
"--mlcb-div-bg": "grey",
|
|
968
|
+
"--mlcb-title-opac": 0.7,
|
|
969
|
+
};
|
|
970
|
+
(() => {
|
|
971
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
972
|
+
})();
|
|
973
|
+
return MultiLanguageCodeBlockElement = _classThis;
|
|
974
|
+
})();
|
|
975
|
+
export { MultiLanguageCodeBlockElement };
|
|
976
|
+
export const MultiLanguageCodeBlock = Elements.wrapper(MultiLanguageCodeBlockElement);
|
|
977
|
+
export const NullMultiLanguageCodeBlock = Elements.create_null(MultiLanguageCodeBlockElement);
|