@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,503 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Author: Daan van den Bergh
|
|
3
|
+
* Copyright: © 2022 - 2024 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Imports.
|
|
7
|
+
import { Elements } from "../elements/module.js"
|
|
8
|
+
import { Utils } from "../modules/utils.js"
|
|
9
|
+
import { VStack, VStackElement, AnchorVStack, AnchorVStackElement, HStack, HStackElement, AnchorHStack, AnchorHStackElement } from "./stack"
|
|
10
|
+
import { ForEach } from "./for_each"
|
|
11
|
+
import { ImageMask, ImageMaskElement } from "./image"
|
|
12
|
+
import { Text } from "./text"
|
|
13
|
+
|
|
14
|
+
type DropdownCallback = (element: DropdownElement) => void;
|
|
15
|
+
|
|
16
|
+
// Dropdown element.
|
|
17
|
+
/* @docs:
|
|
18
|
+
@nav: Frontend
|
|
19
|
+
@chapter: Elements
|
|
20
|
+
@title: Dropdown element
|
|
21
|
+
@descr: Easily create a dropdown element.
|
|
22
|
+
@param:
|
|
23
|
+
@name: target
|
|
24
|
+
@descr: The target element for where the dropdown will be placed.
|
|
25
|
+
@type: Node
|
|
26
|
+
@param:
|
|
27
|
+
@name: animate
|
|
28
|
+
@descr: Enable animations.
|
|
29
|
+
@type: boolean
|
|
30
|
+
@param:
|
|
31
|
+
@name: duration
|
|
32
|
+
@descr: The animation duration in milliseconds.
|
|
33
|
+
@type: number
|
|
34
|
+
@param:
|
|
35
|
+
@name: side
|
|
36
|
+
@descr: Expand to the `"left"` or `"right"` side relative to the target element.
|
|
37
|
+
@type: string
|
|
38
|
+
@param:
|
|
39
|
+
@name: auto_remove
|
|
40
|
+
@descr: Auto remove the dropdown when it is closed.
|
|
41
|
+
@type: boolean
|
|
42
|
+
@param:
|
|
43
|
+
@name: use_target_min
|
|
44
|
+
@descr: Use the target element for a minimum width of the dropdown.
|
|
45
|
+
@type: boolean
|
|
46
|
+
@param:
|
|
47
|
+
@name: below_target
|
|
48
|
+
@descr: Place the dropdown below the target with by default an `y_offset` of `10`, unless `y_offset` is defined as `false`.
|
|
49
|
+
@type: boolean
|
|
50
|
+
@param:
|
|
51
|
+
@name: x_offset
|
|
52
|
+
@descr: The additional x offset of the dropdown's position, this value will be added the computed x position.
|
|
53
|
+
@type: number
|
|
54
|
+
@param:
|
|
55
|
+
@name: y_offset
|
|
56
|
+
@descr: The additional y offset of the dropdown's position, this value will be added the computed y position.
|
|
57
|
+
@type: number
|
|
58
|
+
@param:
|
|
59
|
+
@name: content
|
|
60
|
+
@descr: Optional content array to easily create a context-menu like dropdown menu.
|
|
61
|
+
@type: object[]
|
|
62
|
+
@attributes_type: Content
|
|
63
|
+
@attr:
|
|
64
|
+
@name: text
|
|
65
|
+
@descr: The content text.
|
|
66
|
+
@required: true
|
|
67
|
+
@type: string
|
|
68
|
+
@attr:
|
|
69
|
+
@name: image
|
|
70
|
+
@descr: The content image source.
|
|
71
|
+
@type: string
|
|
72
|
+
@attr:
|
|
73
|
+
@name: image_padding
|
|
74
|
+
@descr: The image padding.
|
|
75
|
+
@type: number
|
|
76
|
+
@attr:
|
|
77
|
+
@name: image_top
|
|
78
|
+
@descr: The image margin top.
|
|
79
|
+
@type: number
|
|
80
|
+
@attr:
|
|
81
|
+
@name: href
|
|
82
|
+
@descr: The href redirect on click.
|
|
83
|
+
@type: string
|
|
84
|
+
@attr:
|
|
85
|
+
@name: callback / on_click
|
|
86
|
+
@descr: The on click callback.
|
|
87
|
+
@type: function
|
|
88
|
+
@attr:
|
|
89
|
+
@name: on_click_redirect
|
|
90
|
+
@descr: The on click redirect function arguments.
|
|
91
|
+
@type: string
|
|
92
|
+
@attr:
|
|
93
|
+
@name: anchor
|
|
94
|
+
@descr: Flag indicating if the content node should be an anchor.
|
|
95
|
+
@type: boolean
|
|
96
|
+
@default: false
|
|
97
|
+
*/
|
|
98
|
+
@Elements.register
|
|
99
|
+
export class DropdownElement extends VStackElement {
|
|
100
|
+
|
|
101
|
+
// @ts-expect-error
|
|
102
|
+
public target: HTMLElement;
|
|
103
|
+
// @ts-expect-error
|
|
104
|
+
public animate: boolean;
|
|
105
|
+
// @ts-expect-error
|
|
106
|
+
public duration: number;
|
|
107
|
+
public side?: string;
|
|
108
|
+
public use_target_min: boolean;
|
|
109
|
+
public auto_remove: boolean;
|
|
110
|
+
public _min_width?: number;
|
|
111
|
+
public _max_width?: number;
|
|
112
|
+
public _min_height?: number;
|
|
113
|
+
public _max_height?: number;
|
|
114
|
+
public below_target: boolean;
|
|
115
|
+
public x_offset: number;
|
|
116
|
+
public y_offset: number;
|
|
117
|
+
|
|
118
|
+
public content_items: ((AnchorHStackElement | HStackElement) & { image: ImageMaskElement })[];
|
|
119
|
+
public on_expand_callback?: DropdownCallback;
|
|
120
|
+
public on_minimize_callback?: DropdownCallback;
|
|
121
|
+
|
|
122
|
+
public mouse_over_background: string;
|
|
123
|
+
public mouse_out_opacity: number;
|
|
124
|
+
public _content_padding: [any, any] | [any, any, any, any];
|
|
125
|
+
public _content_margin: [any, any] | [any, any, any, any];
|
|
126
|
+
|
|
127
|
+
public _frame_min_width: number = 0;
|
|
128
|
+
public _frame_min_height: number = 0;
|
|
129
|
+
public _frame_max_width: number = 0;
|
|
130
|
+
public _frame_max_height: number = 0;
|
|
131
|
+
|
|
132
|
+
public next_toggle_allowed?: number;
|
|
133
|
+
public expanded: boolean = false;
|
|
134
|
+
public animation_timeout: any;
|
|
135
|
+
public close_handler?: Function;
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
constructor({
|
|
139
|
+
target,
|
|
140
|
+
animate = true,
|
|
141
|
+
duration = 300,
|
|
142
|
+
side = "left",
|
|
143
|
+
auto_remove = false,
|
|
144
|
+
min_width = undefined,
|
|
145
|
+
max_width = undefined,
|
|
146
|
+
min_height = undefined,
|
|
147
|
+
max_height = undefined,
|
|
148
|
+
use_target_min = false,
|
|
149
|
+
below_target = false,
|
|
150
|
+
x_offset = undefined,
|
|
151
|
+
y_offset = undefined,
|
|
152
|
+
content = undefined,
|
|
153
|
+
}: {
|
|
154
|
+
target: HTMLElement,
|
|
155
|
+
animate?: boolean,
|
|
156
|
+
duration?: number,
|
|
157
|
+
side?: string,
|
|
158
|
+
auto_remove?: boolean,
|
|
159
|
+
min_width?: number,
|
|
160
|
+
max_width?: number,
|
|
161
|
+
min_height?: number,
|
|
162
|
+
max_height?: number,
|
|
163
|
+
use_target_min?: boolean,
|
|
164
|
+
below_target?: boolean,
|
|
165
|
+
x_offset?: number,
|
|
166
|
+
y_offset?: number,
|
|
167
|
+
content?: {
|
|
168
|
+
text: string,
|
|
169
|
+
image?: string,
|
|
170
|
+
image_padding?: number,
|
|
171
|
+
image_top?: number,
|
|
172
|
+
href?: string,
|
|
173
|
+
callback?: Function,
|
|
174
|
+
on_click?: Function,
|
|
175
|
+
on_click_redirect?: string,
|
|
176
|
+
anchor?: boolean,
|
|
177
|
+
},
|
|
178
|
+
}) {
|
|
179
|
+
|
|
180
|
+
// Base.
|
|
181
|
+
super();
|
|
182
|
+
this._init_derived({
|
|
183
|
+
derived: DropdownElement,
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
// Parameters.
|
|
187
|
+
this.target = target;
|
|
188
|
+
this.animate = animate;
|
|
189
|
+
this.duration = duration;
|
|
190
|
+
this.side = side;
|
|
191
|
+
this.use_target_min = use_target_min;
|
|
192
|
+
this.auto_remove = auto_remove;
|
|
193
|
+
this._min_width = min_width;
|
|
194
|
+
this._max_width = max_width;
|
|
195
|
+
this._min_height = min_height;
|
|
196
|
+
this._max_height = max_height;
|
|
197
|
+
this.below_target = below_target;
|
|
198
|
+
this.x_offset = x_offset ?? 0;
|
|
199
|
+
this.y_offset = y_offset ?? 0;
|
|
200
|
+
if (!this.animate) {
|
|
201
|
+
this.duration = 0;
|
|
202
|
+
}
|
|
203
|
+
if (this.below_target && y_offset == null) {
|
|
204
|
+
this.y_offset = 10;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Styling.
|
|
208
|
+
this
|
|
209
|
+
.hide()
|
|
210
|
+
.overflow("hidden")
|
|
211
|
+
.background("black")
|
|
212
|
+
.border_radius(10)
|
|
213
|
+
.padding(5, 15)
|
|
214
|
+
.border(1, "grey")
|
|
215
|
+
.z_index(10)
|
|
216
|
+
.position("absolute")
|
|
217
|
+
.box_shadow("0px 0px 5px #00000030")
|
|
218
|
+
.opacity(0)
|
|
219
|
+
.transition(this.animate ? `opacity ${this.duration * 0.8}ms ease-in, max-height ${this.duration}ms ease-in-out, max-width ${this.duration}ms ease-in-out` : "")
|
|
220
|
+
.max_width(0)
|
|
221
|
+
.max_height(0)
|
|
222
|
+
|
|
223
|
+
// Add content.
|
|
224
|
+
this.mouse_over_background = "#FFFFFF10";
|
|
225
|
+
this.mouse_out_opacity = 0.8;
|
|
226
|
+
this._content_padding = [7.5, 20];
|
|
227
|
+
this._content_margin = [2.5, 0];
|
|
228
|
+
this.content_items = [];
|
|
229
|
+
if (content) {
|
|
230
|
+
this.padding(10, 0)
|
|
231
|
+
this.append(ForEach(content, (item) => {
|
|
232
|
+
const element = (item.href || item.on_click_redirect || item.anchor) ? AnchorHStack<{image: ImageMaskElement}>() : HStack<{image: ImageMaskElement}>();
|
|
233
|
+
element.append(
|
|
234
|
+
item.image == null ? null : ImageMask(item.image)
|
|
235
|
+
.frame("1em", "1em")
|
|
236
|
+
.mask_color("white")
|
|
237
|
+
.margin_right("1em")
|
|
238
|
+
.flex_shrink(0)
|
|
239
|
+
.padding(item.image_padding == null ? 0 : item.image_padding)
|
|
240
|
+
.margin_top(item.image_top == null ? 0 : item.image_top)
|
|
241
|
+
.assign_to_parent_as("image"),
|
|
242
|
+
Text(item.text)
|
|
243
|
+
.color("white")
|
|
244
|
+
.font_size("inherit")
|
|
245
|
+
.wrap(false)
|
|
246
|
+
// .ellipsis_overflow(true)
|
|
247
|
+
)
|
|
248
|
+
.text_decoration("none")
|
|
249
|
+
.border("none")
|
|
250
|
+
.outline("none")
|
|
251
|
+
.padding(...(this._content_padding as [any, any]))
|
|
252
|
+
.margin(...(this._content_margin as [any, any]))
|
|
253
|
+
.transition("background 250ms ease-in-out, opacity 250ms ease-in-out")
|
|
254
|
+
.on_mouse_over(e => e.background(this.mouse_over_background).opacity(1))
|
|
255
|
+
element.on_mouse_out(e => e.background("transparent").opacity(this.mouse_out_opacity))
|
|
256
|
+
element.parent(this);
|
|
257
|
+
if (item.href) {
|
|
258
|
+
element.href(item.href)
|
|
259
|
+
} else if (Array.isArray(item.on_click)) {
|
|
260
|
+
element.on_click(...item.on_click);
|
|
261
|
+
} else if (item.on_click) {
|
|
262
|
+
element.on_click(item.on_click);
|
|
263
|
+
} else if (Array.isArray(item.on_click_redirect)) {
|
|
264
|
+
element.on_click(...item.on_click_redirect);
|
|
265
|
+
} else if (item.callback) {
|
|
266
|
+
element.on_click(item.callback);
|
|
267
|
+
}
|
|
268
|
+
this.content_items.append(element);
|
|
269
|
+
return element;
|
|
270
|
+
}))
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Get frame.
|
|
275
|
+
_get_frame(): void {
|
|
276
|
+
this.visibility("hidden");
|
|
277
|
+
this.show();
|
|
278
|
+
this.max_width("none")
|
|
279
|
+
this.max_height("none")
|
|
280
|
+
this.getBoundingClientRect();
|
|
281
|
+
if (this.use_target_min) {
|
|
282
|
+
this._frame_min_width = this.target.clientWidth;
|
|
283
|
+
this._frame_min_height = this.target.clientHeight;
|
|
284
|
+
} else {
|
|
285
|
+
this._frame_min_width = parseFloat(this.min_width() as any);
|
|
286
|
+
if (typeof this._frame_min_width !== "number") {
|
|
287
|
+
this._frame_min_width = 0;
|
|
288
|
+
}
|
|
289
|
+
if (this._min_width) {
|
|
290
|
+
this._frame_min_width = Math.max(this._frame_min_width, this._min_width)
|
|
291
|
+
}
|
|
292
|
+
this._frame_min_height = parseFloat(this.min_height() as any);
|
|
293
|
+
if (typeof this._frame_min_height !== "number") {
|
|
294
|
+
this._frame_min_height = 0;
|
|
295
|
+
}
|
|
296
|
+
if (this._min_height) {
|
|
297
|
+
this._frame_min_height = Math.max(this._frame_min_height, this._min_height)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
this._frame_max_width = Math.max(this._frame_min_width, this.clientWidth);
|
|
301
|
+
if (this._max_width) { this._frame_max_width = Math.min(this._frame_max_width, this._max_width); }
|
|
302
|
+
this.max_width(this._frame_max_width) // so height is accurate based on width.
|
|
303
|
+
this._frame_max_height = Math.max(this._frame_min_height, this.clientHeight);
|
|
304
|
+
if (this._max_height) { this._frame_max_height = Math.min(this._frame_max_height, this._max_height); }
|
|
305
|
+
this.hide();
|
|
306
|
+
this.visibility("visible");
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Toggle.
|
|
310
|
+
toggle(): this {
|
|
311
|
+
if (this.expanded) { return this.minimize(); }
|
|
312
|
+
return this.expand();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Expand dropdown.
|
|
316
|
+
expand(): this {
|
|
317
|
+
if (this.next_toggle_allowed !== undefined && Date.now() < this.next_toggle_allowed) { return this; }; // otherwise it goes glitchy.
|
|
318
|
+
if (this.expanded) { return this; }
|
|
319
|
+
this.expanded = true;
|
|
320
|
+
|
|
321
|
+
// Show.
|
|
322
|
+
clearTimeout(this.animation_timeout);
|
|
323
|
+
this.transition("");
|
|
324
|
+
this._get_frame();
|
|
325
|
+
this.max_width(this._frame_min_width)
|
|
326
|
+
this.max_height(this._frame_min_height)
|
|
327
|
+
this.opacity(0)
|
|
328
|
+
this.transition(this.animate ? `opacity ${this.duration * 0.8}ms ease-in, max-height ${this.duration}ms ease-in-out, max-width ${this.duration}ms ease-in-out` : "")
|
|
329
|
+
this.show().getBoundingClientRect();
|
|
330
|
+
const rect = this.target.getBoundingClientRect();
|
|
331
|
+
this
|
|
332
|
+
.position(
|
|
333
|
+
rect.top + this.y_offset + (this.below_target ? rect.height : 0),
|
|
334
|
+
this.side !== "left" ? (window.innerWidth - rect.right - this.x_offset) : undefined,
|
|
335
|
+
undefined,
|
|
336
|
+
this.side === "left" ? (rect.left + this.x_offset) : undefined
|
|
337
|
+
)
|
|
338
|
+
.opacity(1)
|
|
339
|
+
.max_width(this._frame_max_width)
|
|
340
|
+
.max_height(this._frame_max_height)
|
|
341
|
+
|
|
342
|
+
// Close handler.
|
|
343
|
+
if (this.close_handler == null) {
|
|
344
|
+
const _this_ = this;
|
|
345
|
+
this.close_handler = (event) => {
|
|
346
|
+
if (this.expanded && !this.is_nested_child(event.target) && !Utils.is_nested_child(this.target, event.target)) { // also prevent on click on target element, otherwise it does this open close buggy thing
|
|
347
|
+
this.minimize();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
document.body.addEventListener("mousedown", this.close_handler as any);
|
|
352
|
+
this.next_toggle_allowed = Date.now() + Math.max(100, this.duration);
|
|
353
|
+
|
|
354
|
+
// Callback.
|
|
355
|
+
if (this.on_expand_callback) {
|
|
356
|
+
this.on_expand_callback(this);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return this;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Minimize dropdown.
|
|
363
|
+
minimize(force: boolean = false): this {
|
|
364
|
+
if (!force && this.next_toggle_allowed !== undefined && Date.now() < this.next_toggle_allowed) { return this; }; // otherwise it goes glitchy.
|
|
365
|
+
if (!force && !this.expanded) { return this; }
|
|
366
|
+
this.expanded = false;
|
|
367
|
+
|
|
368
|
+
// Hide.
|
|
369
|
+
this
|
|
370
|
+
.max_width(this._frame_min_width)
|
|
371
|
+
.max_height(this._frame_min_height)
|
|
372
|
+
.opacity(0)
|
|
373
|
+
this.animation_timeout = setTimeout(() => {
|
|
374
|
+
if (this.auto_remove) {
|
|
375
|
+
this.remove();
|
|
376
|
+
} else {
|
|
377
|
+
this.hide()
|
|
378
|
+
}
|
|
379
|
+
}, this.duration)
|
|
380
|
+
document.body.removeEventListener("mousedown", this.close_handler as any);
|
|
381
|
+
this.next_toggle_allowed = Date.now() + Math.max(100, this.duration);
|
|
382
|
+
|
|
383
|
+
// Callback.
|
|
384
|
+
if (this.on_minimize_callback) {
|
|
385
|
+
this.on_minimize_callback(this);
|
|
386
|
+
}
|
|
387
|
+
return this;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// On expand.
|
|
391
|
+
on_expand(): undefined | DropdownCallback;
|
|
392
|
+
on_expand(callback: DropdownCallback): this;
|
|
393
|
+
on_expand(callback?: DropdownCallback): this | undefined | DropdownCallback {
|
|
394
|
+
if (callback == null) { return this.on_expand_callback; }
|
|
395
|
+
this.on_expand_callback = callback;
|
|
396
|
+
return this;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// On minimize.
|
|
400
|
+
on_minimize(): undefined | DropdownCallback;
|
|
401
|
+
on_minimize(callback: DropdownCallback): this;
|
|
402
|
+
on_minimize(callback?: DropdownCallback): this | undefined | DropdownCallback {
|
|
403
|
+
if (callback == null) { return this.on_minimize_callback; }
|
|
404
|
+
this.on_minimize_callback = callback;
|
|
405
|
+
return this;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/* @docs:
|
|
409
|
+
@title: Get or set font size.
|
|
410
|
+
@description: Should mainly be used to set the font size and image size on the content nodes created by the `content` parameter.
|
|
411
|
+
*/
|
|
412
|
+
font_size(): string
|
|
413
|
+
font_size(value: string | number): this;
|
|
414
|
+
font_size(value?: string | number): this | string {
|
|
415
|
+
if (value == null) { return super.font_size(); }
|
|
416
|
+
super.font_size(value);
|
|
417
|
+
// all font sizes are inherited or Xem based
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/* @docs:
|
|
422
|
+
@title: Get or set color.
|
|
423
|
+
@description: Should mainly be used to set the foreground color's on the content nodes created by the `content` parameter.
|
|
424
|
+
*/
|
|
425
|
+
color(): string;
|
|
426
|
+
color(value: string): this;
|
|
427
|
+
color(value?: string): string | this {
|
|
428
|
+
if (value == null) { return super.color(); }
|
|
429
|
+
super.color(value);
|
|
430
|
+
this.content_items.iterate(e => {
|
|
431
|
+
e.color(value);
|
|
432
|
+
if (e.image) {
|
|
433
|
+
e.image.mask_color(value);
|
|
434
|
+
}
|
|
435
|
+
})
|
|
436
|
+
return this;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* @docs:
|
|
440
|
+
@title: Iterate content nodes.
|
|
441
|
+
@description: Iterate content nodes created by the `content` parameter. When the callback returns any non null value the iteration will be stopped.
|
|
442
|
+
*/
|
|
443
|
+
iterate_content(callback: (element: AnchorHStackElement | HStackElement) => any): this {
|
|
444
|
+
this.content_items.iterate((node) => {callback(node)})
|
|
445
|
+
return this;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/* @docs:
|
|
449
|
+
@title: Set padding on content nodes.
|
|
450
|
+
@description: Set padding on the content nodes created by the `content` parameter.
|
|
451
|
+
*/
|
|
452
|
+
content_padding(): typeof this._content_padding;
|
|
453
|
+
content_padding(...args: typeof this._content_padding): this;
|
|
454
|
+
content_padding(...args: [] | typeof this._content_padding): this | typeof this._content_padding {
|
|
455
|
+
if (args == null || args.length === 0) { return this._content_padding; }
|
|
456
|
+
this._content_padding = args;
|
|
457
|
+
this.content_items.iterate((node) => { node.padding(...args as [any, any]); })
|
|
458
|
+
// this.content_items.iterate((node) => { node.padding(...(args as [number, string])); })
|
|
459
|
+
return this;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/* @docs:
|
|
463
|
+
@title: Set margin on content nodes.
|
|
464
|
+
@description: Set margin on the content nodes created by the `content` parameter.
|
|
465
|
+
*/
|
|
466
|
+
content_margin(): typeof this._content_margin;
|
|
467
|
+
content_margin(...args: typeof this._content_margin): this;
|
|
468
|
+
content_margin(...args: [] | typeof this._content_margin): this | typeof this._content_margin {
|
|
469
|
+
if (args == null || args.length === 0) { return this._content_margin; }
|
|
470
|
+
this._content_margin = args;
|
|
471
|
+
this.content_items.iterate((node) => { node.margin(...args as [any, any]); })
|
|
472
|
+
// this.content_items.iterate((node) => { node.margin(...(args as [number, string])); })
|
|
473
|
+
return this;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/* @docs:
|
|
477
|
+
@title: Set background on content nodes.
|
|
478
|
+
@description: Set the mouse over background from the content nodes created by the `content` parameter. In the mouse out event the background will always be `transparent`.
|
|
479
|
+
*/
|
|
480
|
+
content_background(): string;
|
|
481
|
+
content_background(value: string): this;
|
|
482
|
+
content_background(value?: string): string | this {
|
|
483
|
+
if (value == null) { return this.mouse_over_background; }
|
|
484
|
+
this.mouse_over_background = value;
|
|
485
|
+
return this;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/* @docs:
|
|
489
|
+
@title: Set opacity content nodes.
|
|
490
|
+
@description: Set opacity on the content nodes created by the `content` parameter. In the mouse over event the opacity will always be `1`.
|
|
491
|
+
*/
|
|
492
|
+
content_opacity(): number;
|
|
493
|
+
content_opacity(value: number): this;
|
|
494
|
+
content_opacity(value?: number): number | this {
|
|
495
|
+
if (value == null) { return this.mouse_out_opacity; }
|
|
496
|
+
this.mouse_out_opacity = value;
|
|
497
|
+
this.content_items.iterate((node) => { node.opacity(value); })
|
|
498
|
+
return this;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
export const Dropdown = Elements.wrapper(DropdownElement);
|
|
502
|
+
export const NullDropdown = Elements.create_null(DropdownElement);
|
|
503
|
+
declare module './any_element.d.ts' { interface AnyElementMap { DropdownElement: DropdownElement }}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Author: Daan van den Bergh
|
|
3
|
+
* Copyright: © 2022 - 2024 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Imports.
|
|
7
|
+
import { Elements, VElementTagMap } from "../elements/module.js"
|
|
8
|
+
|
|
9
|
+
// Marcros.
|
|
10
|
+
type ArrayCallback = ((item: any, index: number, is_last: boolean) => any);
|
|
11
|
+
type ArrayCallback1 = ((item: any, index: number) => any);
|
|
12
|
+
type ArrayCallback2 = ((item: any) => any);
|
|
13
|
+
type ObjectCallback = ((value: any, key: string, index: number, is_last: boolean) => any);
|
|
14
|
+
type ObjectCallback1 = ((value: any, key: string, index: number) => any);
|
|
15
|
+
type ObjectCallback2 = ((value: any, key: string) => any);
|
|
16
|
+
type ObjectCallback3 = ((value: any) => any);
|
|
17
|
+
|
|
18
|
+
// ForEach.
|
|
19
|
+
@Elements.register
|
|
20
|
+
export class ForEachElement extends VElementTagMap.section {
|
|
21
|
+
|
|
22
|
+
static default_style = {
|
|
23
|
+
"border": "none",
|
|
24
|
+
"outline": "none",
|
|
25
|
+
"background": "transparent",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Constructor.
|
|
29
|
+
constructor(items: Array<any>, func: ArrayCallback);
|
|
30
|
+
constructor(items: Array<any>, func: ArrayCallback1);
|
|
31
|
+
constructor(items: Array<any>, func: ArrayCallback2);
|
|
32
|
+
constructor(items: Record<string, any>, func: ObjectCallback);
|
|
33
|
+
constructor(items: Record<string, any>, func: ObjectCallback1);
|
|
34
|
+
constructor(items: Record<string, any>, func: ObjectCallback2);
|
|
35
|
+
constructor(items: Record<string, any>, func: ObjectCallback3);
|
|
36
|
+
constructor(items, func) {
|
|
37
|
+
|
|
38
|
+
// Initialize base class.
|
|
39
|
+
super({
|
|
40
|
+
derived: ForEachElement,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Iterate.
|
|
44
|
+
if (Array.isArray(items)) {
|
|
45
|
+
for (let i = 0; i < items.length; i++) {
|
|
46
|
+
this.append((func as ArrayCallback)(items[i], i, i === items.length - 1));
|
|
47
|
+
}
|
|
48
|
+
} else if (typeof items === "object") {
|
|
49
|
+
let index = 0;
|
|
50
|
+
const keys = Object.keys(items);
|
|
51
|
+
keys.iterate((key) => {
|
|
52
|
+
this.append((func as ObjectCallback)(key, items[key], index, index === keys.length - 1));
|
|
53
|
+
++index;
|
|
54
|
+
})
|
|
55
|
+
} else {
|
|
56
|
+
throw Error(`Parameter "items" has an invalid value type, the valid value types are "array" or "object".`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export const ForEach = Elements.wrapper(ForEachElement) as {
|
|
62
|
+
(items: Array<any>, func: ArrayCallback): ArrayCallback;
|
|
63
|
+
(items: Array<any>, func: ArrayCallback): ArrayCallback1;
|
|
64
|
+
(items: Array<any>, func: ArrayCallback): ArrayCallback2;
|
|
65
|
+
(items: Record<string, any>, func: ObjectCallback): ObjectCallback;
|
|
66
|
+
(items: Record<string, any>, func: ObjectCallback): ObjectCallback1;
|
|
67
|
+
(items: Record<string, any>, func: ObjectCallback): ObjectCallback2;
|
|
68
|
+
(items: Record<string, any>, func: ObjectCallback): ObjectCallback3;
|
|
69
|
+
};
|
|
70
|
+
export const NullForEach = Elements.create_null(ForEachElement);
|
|
71
|
+
declare module './any_element.d.ts' { interface AnyElementMap { ForEachElement: ForEachElement }}
|