cyberia 2.8.885
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/.dockerignore +15 -0
- package/.env.development +45 -0
- package/.env.production +50 -0
- package/.env.test +45 -0
- package/.github/workflows/engine-cyberia.cd.yml +31 -0
- package/.github/workflows/engine-cyberia.ci.yml +60 -0
- package/.github/workflows/ghpkg.ci.yml +87 -0
- package/.github/workflows/npmpkg.ci.yml +72 -0
- package/.github/workflows/publish.ci.yml +84 -0
- package/.github/workflows/publish.cyberia.ci.yml +84 -0
- package/.github/workflows/pwa-microservices-template-page.cd.yml +72 -0
- package/.github/workflows/pwa-microservices-template-test.ci.yml +33 -0
- package/.github/workflows/release.cd.yml +37 -0
- package/.nycrc +9 -0
- package/.prettierignore +13 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +51 -0
- package/.vscode/settings.json +87 -0
- package/AUTHORS.md +21 -0
- package/CHANGELOG.md +205 -0
- package/Dockerfile +28 -0
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/bin/build.js +209 -0
- package/bin/cron.js +47 -0
- package/bin/cyberia.js +145 -0
- package/bin/db.js +199 -0
- package/bin/deploy.js +1293 -0
- package/bin/file.js +197 -0
- package/bin/hwt.js +49 -0
- package/bin/index.js +145 -0
- package/bin/ssl.js +63 -0
- package/bin/util.js +80 -0
- package/bin/vs.js +74 -0
- package/cli.md +714 -0
- package/conf.js +204 -0
- package/deployment.yaml +138 -0
- package/jsconfig.json +7 -0
- package/jsdoc.json +32 -0
- package/manifests/deployment/adminer/deployment.yaml +32 -0
- package/manifests/deployment/adminer/kustomization.yaml +7 -0
- package/manifests/deployment/adminer/service.yaml +13 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +167 -0
- package/manifests/deployment/dd-default-development/proxy.yaml +46 -0
- package/manifests/deployment/dd-test-development/deployment.yaml +174 -0
- package/manifests/deployment/dd-test-development/proxy.yaml +51 -0
- package/manifests/deployment/fastapi/backend-deployment.yml +120 -0
- package/manifests/deployment/fastapi/backend-service.yml +19 -0
- package/manifests/deployment/fastapi/frontend-deployment.yml +54 -0
- package/manifests/deployment/fastapi/frontend-service.yml +15 -0
- package/manifests/deployment/fastapi/initial_data.sh +56 -0
- package/manifests/deployment/kafka/deployment.yaml +69 -0
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
- package/manifests/deployment/spark/spark-pi-py.yaml +21 -0
- package/manifests/deployment/tensorflow/tf-gpu-test.yaml +65 -0
- package/manifests/envoy-service-nodeport.yaml +23 -0
- package/manifests/grafana/deployment.yaml +57 -0
- package/manifests/grafana/kustomization.yaml +7 -0
- package/manifests/grafana/pvc.yaml +12 -0
- package/manifests/grafana/service.yaml +14 -0
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/kubeadm-calico-config.yaml +119 -0
- package/manifests/kubelet-config.yaml +65 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/manifests/lxd/lxd-admin-profile.yaml +17 -0
- package/manifests/lxd/lxd-preseed.yaml +30 -0
- package/manifests/lxd/underpost-setup.sh +163 -0
- package/manifests/mariadb/config.yaml +10 -0
- package/manifests/mariadb/kustomization.yaml +9 -0
- package/manifests/mariadb/pv.yaml +12 -0
- package/manifests/mariadb/pvc.yaml +10 -0
- package/manifests/mariadb/secret.yaml +8 -0
- package/manifests/mariadb/service.yaml +10 -0
- package/manifests/mariadb/statefulset.yaml +56 -0
- package/manifests/mariadb/storage-class.yaml +10 -0
- package/manifests/mongodb/backup-access.yaml +16 -0
- package/manifests/mongodb/backup-cronjob.yaml +42 -0
- package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
- package/manifests/mongodb/configmap.yaml +26 -0
- package/manifests/mongodb/headless-service.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/mongodb/statefulset.yaml +126 -0
- package/manifests/mongodb/storage-class.yaml +9 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/mysql/kustomization.yaml +7 -0
- package/manifests/mysql/pv-pvc.yaml +27 -0
- package/manifests/mysql/statefulset.yaml +55 -0
- package/manifests/postgresql/configmap.yaml +9 -0
- package/manifests/postgresql/kustomization.yaml +10 -0
- package/manifests/postgresql/pv.yaml +15 -0
- package/manifests/postgresql/pvc.yaml +13 -0
- package/manifests/postgresql/service.yaml +10 -0
- package/manifests/postgresql/statefulset.yaml +37 -0
- package/manifests/prometheus/deployment.yaml +82 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +11 -0
- package/manifests/valkey/statefulset.yaml +38 -0
- package/nodemon.json +6 -0
- package/package.json +118 -0
- package/proxy.yaml +35 -0
- package/scripts/device-scan.sh +43 -0
- package/scripts/gpu-diag.sh +19 -0
- package/scripts/maas-setup.sh +120 -0
- package/scripts/nat-iptables.sh +26 -0
- package/scripts/nvim.sh +91 -0
- package/scripts/snap-clean.sh +26 -0
- package/scripts/ssh-cluster-info.sh +14 -0
- package/scripts/ssl.sh +164 -0
- package/src/api/blockchain/blockchain.controller.js +51 -0
- package/src/api/blockchain/blockchain.model.js +90 -0
- package/src/api/blockchain/blockchain.router.js +21 -0
- package/src/api/blockchain/blockchain.service.js +24 -0
- package/src/api/core/core.controller.js +69 -0
- package/src/api/core/core.model.js +11 -0
- package/src/api/core/core.router.js +24 -0
- package/src/api/core/core.service.js +35 -0
- package/src/api/crypto/crypto.controller.js +51 -0
- package/src/api/crypto/crypto.model.js +23 -0
- package/src/api/crypto/crypto.router.js +20 -0
- package/src/api/crypto/crypto.service.js +64 -0
- package/src/api/default/default.controller.js +74 -0
- package/src/api/default/default.model.js +20 -0
- package/src/api/default/default.router.js +27 -0
- package/src/api/default/default.service.js +40 -0
- package/src/api/document/document.controller.js +66 -0
- package/src/api/document/document.model.js +51 -0
- package/src/api/document/document.router.js +24 -0
- package/src/api/document/document.service.js +133 -0
- package/src/api/file/file.controller.js +67 -0
- package/src/api/file/file.model.js +19 -0
- package/src/api/file/file.router.js +22 -0
- package/src/api/file/file.service.js +100 -0
- package/src/api/instance/instance.controller.js +69 -0
- package/src/api/instance/instance.model.js +40 -0
- package/src/api/instance/instance.router.js +34 -0
- package/src/api/instance/instance.service.js +70 -0
- package/src/api/ipfs/ipfs.controller.js +51 -0
- package/src/api/ipfs/ipfs.model.js +17 -0
- package/src/api/ipfs/ipfs.router.js +20 -0
- package/src/api/ipfs/ipfs.service.js +25 -0
- package/src/api/object-layer/README.md +85 -0
- package/src/api/object-layer/object-layer.controller.js +69 -0
- package/src/api/object-layer/object-layer.model.js +181 -0
- package/src/api/object-layer/object-layer.router.js +29 -0
- package/src/api/object-layer/object-layer.service.js +49 -0
- package/src/api/test/test.controller.js +59 -0
- package/src/api/test/test.model.js +14 -0
- package/src/api/test/test.router.js +21 -0
- package/src/api/test/test.service.js +35 -0
- package/src/api/user/postman_collection.json +216 -0
- package/src/api/user/user.build.js +16 -0
- package/src/api/user/user.controller.js +35 -0
- package/src/api/user/user.model.js +100 -0
- package/src/api/user/user.router.js +400 -0
- package/src/api/user/user.service.js +500 -0
- package/src/api.js +23 -0
- package/src/cli/baremetal.js +1310 -0
- package/src/cli/cloud-init.js +548 -0
- package/src/cli/cluster.js +834 -0
- package/src/cli/cron.js +95 -0
- package/src/cli/db.js +414 -0
- package/src/cli/deploy.js +661 -0
- package/src/cli/env.js +101 -0
- package/src/cli/fs.js +256 -0
- package/src/cli/image.js +156 -0
- package/src/cli/index.js +436 -0
- package/src/cli/lxd.js +402 -0
- package/src/cli/monitor.js +260 -0
- package/src/cli/repository.js +274 -0
- package/src/cli/run.js +728 -0
- package/src/cli/script.js +85 -0
- package/src/cli/secrets.js +71 -0
- package/src/cli/ssh.js +46 -0
- package/src/cli/test.js +159 -0
- package/src/client/Cyberia.index.js +50 -0
- package/src/client/CyberiaAdmin.index.js +34 -0
- package/src/client/CyberiaPortal.index.js +36 -0
- package/src/client/Default.index.js +84 -0
- package/src/client/components/core/404.js +20 -0
- package/src/client/components/core/500.js +20 -0
- package/src/client/components/core/Account.js +326 -0
- package/src/client/components/core/AgGrid.js +191 -0
- package/src/client/components/core/Alert.js +77 -0
- package/src/client/components/core/Auth.js +342 -0
- package/src/client/components/core/Badge.js +32 -0
- package/src/client/components/core/Blockchain.js +41 -0
- package/src/client/components/core/Blog.js +9 -0
- package/src/client/components/core/BtnIcon.js +111 -0
- package/src/client/components/core/CalendarCore.js +464 -0
- package/src/client/components/core/Chat.js +64 -0
- package/src/client/components/core/ColorPalette.js +5267 -0
- package/src/client/components/core/CommonJs.js +1010 -0
- package/src/client/components/core/Content.js +196 -0
- package/src/client/components/core/Css.js +1099 -0
- package/src/client/components/core/CssCore.js +882 -0
- package/src/client/components/core/D3Chart.js +44 -0
- package/src/client/components/core/Docs.js +376 -0
- package/src/client/components/core/DropDown.js +223 -0
- package/src/client/components/core/EventsUI.js +133 -0
- package/src/client/components/core/FileExplorer.js +707 -0
- package/src/client/components/core/FullScreen.js +36 -0
- package/src/client/components/core/Input.js +383 -0
- package/src/client/components/core/JoyStick.js +80 -0
- package/src/client/components/core/Keyboard.js +73 -0
- package/src/client/components/core/LoadingAnimation.js +159 -0
- package/src/client/components/core/LogIn.js +190 -0
- package/src/client/components/core/LogOut.js +63 -0
- package/src/client/components/core/Logger.js +29 -0
- package/src/client/components/core/Modal.js +2494 -0
- package/src/client/components/core/NotificationManager.js +84 -0
- package/src/client/components/core/ObjectLayerEngine.js +1229 -0
- package/src/client/components/core/ObjectLayerEngineModal.js +443 -0
- package/src/client/components/core/Pagination.js +207 -0
- package/src/client/components/core/Panel.js +772 -0
- package/src/client/components/core/PanelForm.js +627 -0
- package/src/client/components/core/Polyhedron.js +162 -0
- package/src/client/components/core/Recover.js +207 -0
- package/src/client/components/core/Responsive.js +82 -0
- package/src/client/components/core/RichText.js +43 -0
- package/src/client/components/core/Router.js +317 -0
- package/src/client/components/core/Scroll.js +76 -0
- package/src/client/components/core/SignUp.js +125 -0
- package/src/client/components/core/SocketIo.js +74 -0
- package/src/client/components/core/Stream.js +113 -0
- package/src/client/components/core/ToggleSwitch.js +101 -0
- package/src/client/components/core/ToolTip.js +90 -0
- package/src/client/components/core/Translate.js +522 -0
- package/src/client/components/core/Validator.js +115 -0
- package/src/client/components/core/VanillaJs.js +423 -0
- package/src/client/components/core/Wallet.js +106 -0
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Webhook.js +25 -0
- package/src/client/components/core/Worker.js +371 -0
- package/src/client/components/core/windowGetDimensions.js +269 -0
- package/src/client/components/cyberia/BagCyberia.js +1253 -0
- package/src/client/components/cyberia/BiomeCyberia.js +130 -0
- package/src/client/components/cyberia/CharacterCyberia.js +321 -0
- package/src/client/components/cyberia/CommonCyberia.js +1834 -0
- package/src/client/components/cyberia/CssCyberia.js +816 -0
- package/src/client/components/cyberia/ElementPreviewCyberia.js +183 -0
- package/src/client/components/cyberia/ElementsCyberia.js +146 -0
- package/src/client/components/cyberia/InteractionPanelCyberia.js +1043 -0
- package/src/client/components/cyberia/JoyStickCyberia.js +53 -0
- package/src/client/components/cyberia/LogInCyberia.js +68 -0
- package/src/client/components/cyberia/LogOutCyberia.js +24 -0
- package/src/client/components/cyberia/MainUserCyberia.js +424 -0
- package/src/client/components/cyberia/MapCyberia.js +160 -0
- package/src/client/components/cyberia/MatrixCyberia.js +147 -0
- package/src/client/components/cyberia/MenuCyberia.js +575 -0
- package/src/client/components/cyberia/PixiCyberia.js +1639 -0
- package/src/client/components/cyberia/PointAndClickMovementCyberia.js +146 -0
- package/src/client/components/cyberia/QuestCyberia.js +1420 -0
- package/src/client/components/cyberia/RoutesCyberia.js +47 -0
- package/src/client/components/cyberia/SettingsCyberia.js +16 -0
- package/src/client/components/cyberia/SignUpCyberia.js +14 -0
- package/src/client/components/cyberia/SkillCyberia.js +124 -0
- package/src/client/components/cyberia/SocketIoCyberia.js +211 -0
- package/src/client/components/cyberia/TileCyberia.js +685 -0
- package/src/client/components/cyberia/TranslateCyberia.js +96 -0
- package/src/client/components/cyberia/UniverseCyberia.js +14 -0
- package/src/client/components/cyberia/WebhookCyberia.js +13 -0
- package/src/client/components/cyberia/WikiCyberia.js +144 -0
- package/src/client/components/cyberia/WorldCyberia.js +680 -0
- package/src/client/components/cyberia-admin/BiomeCyberiaAdmin.js +978 -0
- package/src/client/components/cyberia-admin/CommonCyberiaAdmin.js +29 -0
- package/src/client/components/cyberia-admin/CssCyberiaAdmin.js +15 -0
- package/src/client/components/cyberia-admin/ElementsCyberiaAdmin.js +38 -0
- package/src/client/components/cyberia-admin/InstanceEngineCyberiaAdmin.js +180 -0
- package/src/client/components/cyberia-admin/LogInCyberiaAdmin.js +34 -0
- package/src/client/components/cyberia-admin/LogOutCyberiaAdmin.js +24 -0
- package/src/client/components/cyberia-admin/MenuCyberiaAdmin.js +660 -0
- package/src/client/components/cyberia-admin/RoutesCyberiaAdmin.js +57 -0
- package/src/client/components/cyberia-admin/ServerCyberiaAdmin.js +129 -0
- package/src/client/components/cyberia-admin/SettingsCyberiaAdmin.js +16 -0
- package/src/client/components/cyberia-admin/SignUpCyberiaAdmin.js +11 -0
- package/src/client/components/cyberia-admin/SocketIoCyberiaAdmin.js +53 -0
- package/src/client/components/cyberia-admin/TranslateCyberiaAdmin.js +7 -0
- package/src/client/components/cyberia-biome/CityCyberiaBiome.js +209 -0
- package/src/client/components/cyberia-biome/CityInteriorCyberiaBiome.js +253 -0
- package/src/client/components/cyberia-biome/ColorChaosCyberiaBiome.js +26 -0
- package/src/client/components/cyberia-biome/ForestCyberiaBiome.js +191 -0
- package/src/client/components/cyberia-biome/GridBaseCyberiaBiome.js +364 -0
- package/src/client/components/cyberia-biome/SeedCityCyberiaBiome.js +347 -0
- package/src/client/components/cyberia-biome/ShopCyberiaBiome.js +12 -0
- package/src/client/components/cyberia-biome/SpaceCyberiaBiome.js +58 -0
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +29 -0
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +132 -0
- package/src/client/components/cyberia-portal/ElementsCyberiaPortal.js +38 -0
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +18 -0
- package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +12 -0
- package/src/client/components/cyberia-portal/MenuCyberiaPortal.js +487 -0
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +45 -0
- package/src/client/components/cyberia-portal/ServerCyberiaPortal.js +136 -0
- package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +16 -0
- package/src/client/components/cyberia-portal/SignUpCyberiaPortal.js +11 -0
- package/src/client/components/cyberia-portal/SocketIoCyberiaPortal.js +52 -0
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +12 -0
- package/src/client/components/default/CommonDefault.js +29 -0
- package/src/client/components/default/CssDefault.js +27 -0
- package/src/client/components/default/ElementsDefault.js +38 -0
- package/src/client/components/default/LogInDefault.js +14 -0
- package/src/client/components/default/LogOutDefault.js +10 -0
- package/src/client/components/default/MenuDefault.js +743 -0
- package/src/client/components/default/RoutesDefault.js +48 -0
- package/src/client/components/default/SettingsDefault.js +16 -0
- package/src/client/components/default/SignUpDefault.js +9 -0
- package/src/client/components/default/SocketIoDefault.js +54 -0
- package/src/client/components/default/TranslateDefault.js +7 -0
- package/src/client/public/default/android-chrome-144x144.png +0 -0
- package/src/client/public/default/android-chrome-192x192.png +0 -0
- package/src/client/public/default/android-chrome-256x256.png +0 -0
- package/src/client/public/default/android-chrome-36x36.png +0 -0
- package/src/client/public/default/android-chrome-384x384.png +0 -0
- package/src/client/public/default/android-chrome-48x48.png +0 -0
- package/src/client/public/default/android-chrome-512x512.png +0 -0
- package/src/client/public/default/android-chrome-72x72.png +0 -0
- package/src/client/public/default/android-chrome-96x96.png +0 -0
- package/src/client/public/default/apple-touch-icon-1024x1024.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
- package/src/client/public/default/apple-touch-icon-167x167.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
- package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1125x2436.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1136x640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1170x2532.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1179x2556.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2208.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2688.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1284x2778.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1290x2796.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1334x750.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1488x2266.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1536x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1620x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1640x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2224.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2388.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1792x828.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x1536.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x2732.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1620.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2208x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2224x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2266x1488.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2388x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2436x1125.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2532x1170.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2556x1179.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2688x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2732x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2778x1284.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2796x1290.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-640x1136.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-750x1334.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-828x1792.png +0 -0
- package/src/client/public/default/assets/background/dark.jpg +0 -0
- package/src/client/public/default/assets/background/dark.svg +557 -0
- package/src/client/public/default/assets/background/white.jpg +0 -0
- package/src/client/public/default/assets/background/white0-min.jpg +0 -0
- package/src/client/public/default/assets/background/white0.jpg +0 -0
- package/src/client/public/default/assets/logo/base-icon.png +0 -0
- package/src/client/public/default/assets/logo/underpost.gif +0 -0
- package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-default-avatar.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
- package/src/client/public/default/browserconfig.xml +12 -0
- package/src/client/public/default/favicon-16x16.png +0 -0
- package/src/client/public/default/favicon-32x32.png +0 -0
- package/src/client/public/default/favicon-48x48.png +0 -0
- package/src/client/public/default/favicon.ico +0 -0
- package/src/client/public/default/manifest.webmanifest +69 -0
- package/src/client/public/default/mstile-144x144.png +0 -0
- package/src/client/public/default/mstile-150x150.png +0 -0
- package/src/client/public/default/mstile-310x150.png +0 -0
- package/src/client/public/default/mstile-310x310.png +0 -0
- package/src/client/public/default/mstile-70x70.png +0 -0
- package/src/client/public/default/plantuml/client-conf.svg +1 -0
- package/src/client/public/default/plantuml/client-schema.svg +1 -0
- package/src/client/public/default/plantuml/cron-conf.svg +1 -0
- package/src/client/public/default/plantuml/cron-schema.svg +1 -0
- package/src/client/public/default/plantuml/server-conf.svg +1 -0
- package/src/client/public/default/plantuml/server-schema.svg +1 -0
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
- package/src/client/public/default/safari-pinned-tab.svg +24 -0
- package/src/client/public/default/site.webmanifest +69 -0
- package/src/client/public/default/sitemap +148 -0
- package/src/client/public/default/yandex-browser-50x50.png +0 -0
- package/src/client/public/default/yandex-browser-manifest.json +9 -0
- package/src/client/public/doc/favicon.ico +0 -0
- package/src/client/public/doc/sitemap +148 -0
- package/src/client/public/test/favicon.ico +0 -0
- package/src/client/public/test/sitemap +148 -0
- package/src/client/services/blockchain/blockchain.service.js +73 -0
- package/src/client/services/core/core.service.js +165 -0
- package/src/client/services/crypto/crypto.service.js +73 -0
- package/src/client/services/default/default.management.js +450 -0
- package/src/client/services/default/default.service.js +98 -0
- package/src/client/services/document/document.service.js +97 -0
- package/src/client/services/file/file.service.js +72 -0
- package/src/client/services/instance/instance.management.js +78 -0
- package/src/client/services/instance/instance.service.js +97 -0
- package/src/client/services/ipfs/ipfs.service.js +73 -0
- package/src/client/services/object-layer/object-layer.service.js +93 -0
- package/src/client/services/test/test.service.js +73 -0
- package/src/client/services/user/user.management.js +56 -0
- package/src/client/services/user/user.service.js +108 -0
- package/src/client/ssr/Render.js +237 -0
- package/src/client/ssr/body/404.js +73 -0
- package/src/client/ssr/body/500.js +72 -0
- package/src/client/ssr/body/CacheControl.js +114 -0
- package/src/client/ssr/body/CyberiaDefaultSplashScreen.js +90 -0
- package/src/client/ssr/body/CyberiaSplashScreenLore.js +424 -0
- package/src/client/ssr/body/DefaultSplashScreen.js +90 -0
- package/src/client/ssr/email/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/email/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/head/Css.js +241 -0
- package/src/client/ssr/head/CyberiaAdminScripts.js +6 -0
- package/src/client/ssr/head/CyberiaPortalScripts.js +6 -0
- package/src/client/ssr/head/CyberiaScripts.js +6 -0
- package/src/client/ssr/head/DefaultScripts.js +6 -0
- package/src/client/ssr/head/Microdata.js +11 -0
- package/src/client/ssr/head/Production.js +1 -0
- package/src/client/ssr/head/Pwa.js +146 -0
- package/src/client/ssr/head/Seo.js +15 -0
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/offline/Maintenance.js +63 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +67 -0
- package/src/client/ssr/pages/404.js +12 -0
- package/src/client/ssr/pages/500.js +12 -0
- package/src/client/ssr/pages/Test.js +198 -0
- package/src/client/ssr/pages/maintenance.js +14 -0
- package/src/client/ssr/pages/offline.js +21 -0
- package/src/client/sw/default.sw.js +108 -0
- package/src/client/sw/template.sw.js +84 -0
- package/src/client.build.js +22 -0
- package/src/client.dev.js +24 -0
- package/src/db/DataBaseProvider.js +98 -0
- package/src/db/mariadb/MariaDB.js +66 -0
- package/src/db/mongo/MongooseDB.js +70 -0
- package/src/index.js +198 -0
- package/src/mailer/EmailRender.js +116 -0
- package/src/mailer/MailerProvider.js +213 -0
- package/src/monitor.js +24 -0
- package/src/proxy.js +22 -0
- package/src/runtime/express/Express.js +256 -0
- package/src/runtime/lampp/Dockerfile +50 -0
- package/src/runtime/lampp/Lampp.js +343 -0
- package/src/server/auth.js +689 -0
- package/src/server/backup.js +96 -0
- package/src/server/client-build-docs.js +205 -0
- package/src/server/client-build-live.js +109 -0
- package/src/server/client-build.js +690 -0
- package/src/server/client-dev-server.js +87 -0
- package/src/server/client-formatted.js +87 -0
- package/src/server/client-icons.js +108 -0
- package/src/server/conf.js +1071 -0
- package/src/server/crypto.js +210 -0
- package/src/server/dns.js +276 -0
- package/src/server/downloader.js +74 -0
- package/src/server/json-schema.js +77 -0
- package/src/server/logger.js +197 -0
- package/src/server/network.js +72 -0
- package/src/server/object-layer.js +294 -0
- package/src/server/peer.js +69 -0
- package/src/server/process.js +171 -0
- package/src/server/proxy.js +110 -0
- package/src/server/runtime.js +170 -0
- package/src/server/ssr.js +127 -0
- package/src/server/start.js +161 -0
- package/src/server/tls.js +251 -0
- package/src/server/valkey.js +293 -0
- package/src/server.js +25 -0
- package/src/ws/IoInterface.js +139 -0
- package/src/ws/IoServer.js +88 -0
- package/src/ws/core/channels/core.ws.chat.js +23 -0
- package/src/ws/core/channels/core.ws.mailer.js +35 -0
- package/src/ws/core/channels/core.ws.stream.js +31 -0
- package/src/ws/core/core.ws.connection.js +62 -0
- package/src/ws/core/core.ws.emit.js +53 -0
- package/src/ws/core/core.ws.server.js +76 -0
- package/src/ws/core/management/core.ws.chat.js +8 -0
- package/src/ws/core/management/core.ws.mailer.js +16 -0
- package/src/ws/core/management/core.ws.stream.js +8 -0
- package/src/ws/cyberia/channels/cyberia.ws.bot.js +56 -0
- package/src/ws/cyberia/channels/cyberia.ws.skill.js +51 -0
- package/src/ws/cyberia/channels/cyberia.ws.user.js +437 -0
- package/src/ws/cyberia/cyberia.ws.connection.js +36 -0
- package/src/ws/cyberia/cyberia.ws.emit.js +14 -0
- package/src/ws/cyberia/cyberia.ws.server.js +67 -0
- package/src/ws/cyberia/management/cyberia.ws.bot.js +669 -0
- package/src/ws/cyberia/management/cyberia.ws.skill.js +441 -0
- package/src/ws/cyberia/management/cyberia.ws.user.js +188 -0
- package/src/ws/default/channels/default.ws.main.js +16 -0
- package/src/ws/default/default.ws.connection.js +22 -0
- package/src/ws/default/default.ws.emit.js +14 -0
- package/src/ws/default/default.ws.server.js +20 -0
- package/src/ws/default/management/default.ws.main.js +8 -0
- package/test/api.test.js +53 -0
- package/test/crypto.test.js +117 -0
|
@@ -0,0 +1,1099 @@
|
|
|
1
|
+
import { getId, newInstance, range, rgbToHex, s4, splitEveryXChar } from './CommonJs.js';
|
|
2
|
+
import { CssCoreDark, CssCoreLight } from './CssCore.js';
|
|
3
|
+
import { DropDown } from './DropDown.js';
|
|
4
|
+
import { Modal } from './Modal.js';
|
|
5
|
+
import { Translate } from './Translate.js';
|
|
6
|
+
import { append, htmls, s, sa } from './VanillaJs.js';
|
|
7
|
+
import { getProxyPath } from './Router.js';
|
|
8
|
+
|
|
9
|
+
let ThemesScope = [];
|
|
10
|
+
|
|
11
|
+
// https://css.github.io/csso/csso.html
|
|
12
|
+
// https://www.fontspace.com/
|
|
13
|
+
// https://www.1001fonts.com/
|
|
14
|
+
|
|
15
|
+
const Css = {
|
|
16
|
+
// Menu button container transition styles
|
|
17
|
+
menuButtonContainer: () => css`
|
|
18
|
+
.main-btn-menu {
|
|
19
|
+
transition: all 0.2s ease-in-out;
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.main-btn-menu::after {
|
|
24
|
+
content: '';
|
|
25
|
+
position: absolute;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
left: 50%;
|
|
28
|
+
width: 0;
|
|
29
|
+
height: 2px;
|
|
30
|
+
background: currentColor;
|
|
31
|
+
transition: all 0.2s ease-in-out;
|
|
32
|
+
transform: translateX(-50%);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.main-btn-menu:hover::after {
|
|
36
|
+
width: 60%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.main-btn-menu.active {
|
|
40
|
+
background: rgba(255, 255, 255, 0.1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.main-btn-menu.active::after {
|
|
44
|
+
width: 80%;
|
|
45
|
+
background: currentColor;
|
|
46
|
+
}
|
|
47
|
+
`,
|
|
48
|
+
|
|
49
|
+
loadThemes: async function (themes = []) {
|
|
50
|
+
ThemesScope = [];
|
|
51
|
+
for (const themeOptions of themes) addTheme(themeOptions);
|
|
52
|
+
// if (!ThemesScope.find((t) => t.dark)) addTheme(CssCoreDark);
|
|
53
|
+
// if (!ThemesScope.find((t) => !t.dark)) addTheme(CssCoreLight);
|
|
54
|
+
if (ThemesScope.length === 0) {
|
|
55
|
+
addTheme(CssCoreLight);
|
|
56
|
+
addTheme(CssCoreDark);
|
|
57
|
+
}
|
|
58
|
+
const localStorageTheme = localStorage.getItem('_theme');
|
|
59
|
+
if (localStorageTheme && Themes[localStorageTheme]) {
|
|
60
|
+
const themeOption = ThemesScope.find((t) => t.theme === localStorageTheme);
|
|
61
|
+
if (themeOption) return await this.Init(themeOption);
|
|
62
|
+
}
|
|
63
|
+
await this.Init();
|
|
64
|
+
},
|
|
65
|
+
Init: async function (options) {
|
|
66
|
+
if (!options) options = ThemesScope[0];
|
|
67
|
+
const { theme } = options;
|
|
68
|
+
|
|
69
|
+
// Inject menu button container styles
|
|
70
|
+
const styleId = 'menu-btn-container-styles';
|
|
71
|
+
if (!document.getElementById(styleId)) {
|
|
72
|
+
const style = document.createElement('style');
|
|
73
|
+
style.id = styleId;
|
|
74
|
+
style.textContent = this.menuButtonContainer();
|
|
75
|
+
document.head.appendChild(style);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return await Themes[theme](options);
|
|
79
|
+
},
|
|
80
|
+
RenderSetting: async function () {
|
|
81
|
+
return html` <div class="in section-mp">
|
|
82
|
+
${await DropDown.Render({
|
|
83
|
+
id: 'settings-theme',
|
|
84
|
+
value: Css.currentTheme,
|
|
85
|
+
label: html`${Translate.Render('theme')}`,
|
|
86
|
+
data: ThemesScope.map((themeOption) => {
|
|
87
|
+
return {
|
|
88
|
+
display: html`<i class="fa-solid fa-brush"></i> ${themeOption.theme}`,
|
|
89
|
+
value: themeOption.theme,
|
|
90
|
+
onClick: async () => await Themes[themeOption.theme](),
|
|
91
|
+
};
|
|
92
|
+
}),
|
|
93
|
+
})}
|
|
94
|
+
</div>`;
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const barLabels = (options) => {
|
|
99
|
+
return {
|
|
100
|
+
img: {
|
|
101
|
+
close: html`<img
|
|
102
|
+
class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
|
|
103
|
+
src="${getProxyPath()}assets/icons/close.png"
|
|
104
|
+
/>`,
|
|
105
|
+
maximize: html`<img
|
|
106
|
+
class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
|
|
107
|
+
src="${getProxyPath()}assets/icons/maximize.png"
|
|
108
|
+
/>`,
|
|
109
|
+
minimize: html`<img
|
|
110
|
+
class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
|
|
111
|
+
src="${getProxyPath()}assets/icons/minimize.png"
|
|
112
|
+
/>`,
|
|
113
|
+
restore: html`<img
|
|
114
|
+
class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
|
|
115
|
+
src="${getProxyPath()}assets/icons/restore.png"
|
|
116
|
+
/>`,
|
|
117
|
+
menu: html`<img
|
|
118
|
+
class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
|
|
119
|
+
src="${getProxyPath()}assets/icons/menu.png"
|
|
120
|
+
/>`,
|
|
121
|
+
},
|
|
122
|
+
fontawesome: {
|
|
123
|
+
close: html`<i class="fa-solid fa-xmark ${options.iconClass ? options.iconClass : ''}"></i>`,
|
|
124
|
+
maximize: html`<i class="fa-regular fa-square ${options.iconClass ? options.iconClass : ''}"></i>`,
|
|
125
|
+
minimize: html`<i class="fa-solid fa-window-minimize ${options.iconClass ? options.iconClass : ''}"></i>`,
|
|
126
|
+
restore: html`<i class="fa-regular fa-window-restore ${options.iconClass ? options.iconClass : ''}"></i>`,
|
|
127
|
+
menu: html`<i class="fa-solid fa-bars ${options.iconClass ? options.iconClass : ''}"></i>`,
|
|
128
|
+
},
|
|
129
|
+
default: {
|
|
130
|
+
close: html`X`,
|
|
131
|
+
maximize: html`▢`,
|
|
132
|
+
minimize: html`_`,
|
|
133
|
+
restore: html`□`,
|
|
134
|
+
menu: html`≡`,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const barConfig = (options) => {
|
|
140
|
+
const { barButtonsIconTheme } = options;
|
|
141
|
+
return {
|
|
142
|
+
buttons: {
|
|
143
|
+
close: {
|
|
144
|
+
disabled: false,
|
|
145
|
+
label: barLabels(options)[barButtonsIconTheme].close,
|
|
146
|
+
},
|
|
147
|
+
maximize: {
|
|
148
|
+
disabled: false,
|
|
149
|
+
label: barLabels(options)[barButtonsIconTheme].maximize,
|
|
150
|
+
},
|
|
151
|
+
minimize: {
|
|
152
|
+
disabled: false,
|
|
153
|
+
label: barLabels(options)[barButtonsIconTheme].minimize,
|
|
154
|
+
},
|
|
155
|
+
restore: {
|
|
156
|
+
disabled: false,
|
|
157
|
+
label: barLabels(options)[barButtonsIconTheme].restore,
|
|
158
|
+
},
|
|
159
|
+
menu: {
|
|
160
|
+
disabled: true,
|
|
161
|
+
label: barLabels(options)[barButtonsIconTheme].menu,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const renderDefaultWindowsModalButtonContent = (options) => {
|
|
168
|
+
const { barButtonsIconTheme, htmlRender } = options;
|
|
169
|
+
const barConfigInstance = barConfig(options);
|
|
170
|
+
if (htmlRender)
|
|
171
|
+
Object.keys(Modal.Data).map((idModal) => {
|
|
172
|
+
if (s(`.btn-minimize-${idModal}`)) htmls(`.btn-minimize-${idModal}`, barConfigInstance.buttons.minimize.label);
|
|
173
|
+
if (s(`.btn-restore-${idModal}`)) htmls(`.btn-restore-${idModal}`, barConfigInstance.buttons.restore.label);
|
|
174
|
+
if (s(`.btn-maximize-${idModal}`)) htmls(`.btn-maximize-${idModal}`, barConfigInstance.buttons.maximize.label);
|
|
175
|
+
if (s(`.btn-close-${idModal}`)) htmls(`.btn-close-${idModal}`, barConfigInstance.buttons.close.label);
|
|
176
|
+
if (s(`.btn-menu-${idModal}`)) htmls(`.btn-menu-${idModal}`, barConfigInstance.buttons.menu.label);
|
|
177
|
+
});
|
|
178
|
+
return { barConfig: barConfigInstance };
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
let darkTheme = true;
|
|
182
|
+
const ThemeEvents = {};
|
|
183
|
+
const TriggerThemeEvents = () => {
|
|
184
|
+
localStorage.setItem('_theme', Css.currentTheme);
|
|
185
|
+
Object.keys(ThemeEvents).map((keyEvent) => ThemeEvents[keyEvent]());
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const Themes = {};
|
|
189
|
+
|
|
190
|
+
const addTheme = (options) => {
|
|
191
|
+
ThemesScope.push(options);
|
|
192
|
+
Themes[options.theme] = async (barOptions) => {
|
|
193
|
+
if (!options.dark) options.dark = false;
|
|
194
|
+
if (!options.barButtonsIconTheme) options.barButtonsIconTheme = 'fontawesome';
|
|
195
|
+
const htmlRender = Css.currentTheme !== options.theme;
|
|
196
|
+
if (htmlRender) {
|
|
197
|
+
Css.currentTheme = options.theme;
|
|
198
|
+
darkTheme = options.dark;
|
|
199
|
+
let render = '';
|
|
200
|
+
if (!['core', 'css-core'].includes(options.theme))
|
|
201
|
+
render += darkTheme ? await CssCoreDark.render() : await CssCoreLight.render();
|
|
202
|
+
render += await options.render();
|
|
203
|
+
render += await subThemeManager.render();
|
|
204
|
+
htmls('.theme', render);
|
|
205
|
+
TriggerThemeEvents();
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
...renderDefaultWindowsModalButtonContent({
|
|
209
|
+
barButtonsIconTheme: options.barButtonsIconTheme,
|
|
210
|
+
htmlRender,
|
|
211
|
+
...barOptions,
|
|
212
|
+
}),
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const borderChar = (px, color, selectors, hover = false) => {
|
|
218
|
+
if (selectors) {
|
|
219
|
+
return selectors
|
|
220
|
+
.map(
|
|
221
|
+
(selector) => html`
|
|
222
|
+
<style>
|
|
223
|
+
${selector}${hover ? ':hover' : ''} {
|
|
224
|
+
text-shadow: ${px}px -${px}px ${px}px ${color}, -${px}px ${px}px ${px}px ${color},
|
|
225
|
+
-${px}px -${px}px ${px}px ${color}, ${px}px ${px}px ${px}px ${color};
|
|
226
|
+
}
|
|
227
|
+
</style>
|
|
228
|
+
`,
|
|
229
|
+
)
|
|
230
|
+
.join('');
|
|
231
|
+
}
|
|
232
|
+
return html`
|
|
233
|
+
text-shadow: ${px}px -${px}px ${px}px ${color}, -${px}px ${px}px ${px}px ${color}, -${px}px -${px}px ${px}px
|
|
234
|
+
${color}, ${px}px ${px}px ${px}px ${color};
|
|
235
|
+
`;
|
|
236
|
+
};
|
|
237
|
+
const boxShadow = ({ selector }) => html`
|
|
238
|
+
${darkTheme
|
|
239
|
+
? html`
|
|
240
|
+
<style>
|
|
241
|
+
${selector} {
|
|
242
|
+
box-shadow: 0 4px 8px 0 rgba(255, 255, 255, 0.1), 0 6px 20px 0 rgba(255, 255, 255, 0.08);
|
|
243
|
+
}
|
|
244
|
+
${selector}:hover {
|
|
245
|
+
box-shadow: 0 8px 16px 0 rgba(255, 255, 255, 0.15), 0 10px 30px 0 rgba(255, 255, 255, 0.1);
|
|
246
|
+
}
|
|
247
|
+
</style>
|
|
248
|
+
`
|
|
249
|
+
: html`
|
|
250
|
+
<style>
|
|
251
|
+
${selector} {
|
|
252
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
253
|
+
}
|
|
254
|
+
${selector}:hover {
|
|
255
|
+
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 10px 30px 0 rgba(0, 0, 0, 0.3);
|
|
256
|
+
}
|
|
257
|
+
</style>
|
|
258
|
+
`}
|
|
259
|
+
`;
|
|
260
|
+
const renderMediaQuery = (mediaData) => {
|
|
261
|
+
// first limit should be '0'
|
|
262
|
+
return html`
|
|
263
|
+
${mediaData
|
|
264
|
+
.map(
|
|
265
|
+
(mediaState) => html`
|
|
266
|
+
<style>
|
|
267
|
+
@media only screen and (min-width: ${mediaState.limit}px) {
|
|
268
|
+
${mediaState.css}
|
|
269
|
+
}
|
|
270
|
+
</style>
|
|
271
|
+
`,
|
|
272
|
+
)
|
|
273
|
+
.join('')}
|
|
274
|
+
`;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const renderStatus = (status, options) => {
|
|
278
|
+
switch (status) {
|
|
279
|
+
case 'success':
|
|
280
|
+
return html`<div class="${options?.class ? options.class : 'abs center'}">
|
|
281
|
+
<i style="color: green" class="fa-solid fa-check"></i>
|
|
282
|
+
</div>`;
|
|
283
|
+
case 'error':
|
|
284
|
+
return html`<div class="${options?.class ? options.class : 'abs center'}">
|
|
285
|
+
<i style="color: red" class="fa-solid fa-xmark"></i>
|
|
286
|
+
</div>`;
|
|
287
|
+
case 'warning':
|
|
288
|
+
return html`<div class="${options?.class ? options.class : 'abs center'}">
|
|
289
|
+
<i style="color: yellow" class="fa-solid fa-triangle-exclamation"></i>
|
|
290
|
+
</div>`;
|
|
291
|
+
default:
|
|
292
|
+
return html``;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const dynamicColTokens = {};
|
|
297
|
+
|
|
298
|
+
const dynamicCol = (options = { containerSelector: '', id: '', type: '', limit: 900 }) => {
|
|
299
|
+
const { containerSelector, id } = options;
|
|
300
|
+
const limitCol = options?.limit ? options.limit : 900;
|
|
301
|
+
if (!(id in dynamicColTokens)) dynamicColTokens[id] = {};
|
|
302
|
+
dynamicColTokens[id].options = options;
|
|
303
|
+
if (dynamicColTokens[id].observer) dynamicColTokens[id].observer.disconnect();
|
|
304
|
+
setTimeout(() => {
|
|
305
|
+
dynamicColTokens[id].observer = new ResizeObserver(() => {
|
|
306
|
+
if (s(`.${containerSelector}`)) {
|
|
307
|
+
switch (options.type) {
|
|
308
|
+
case 'a-50-b-50':
|
|
309
|
+
if (s(`.${containerSelector}`).offsetWidth < limitCol)
|
|
310
|
+
htmls(
|
|
311
|
+
`.style-${id}-col`,
|
|
312
|
+
css`
|
|
313
|
+
.${id}-col-a, .${id}-col-b {
|
|
314
|
+
width: 100%;
|
|
315
|
+
}
|
|
316
|
+
`,
|
|
317
|
+
);
|
|
318
|
+
else
|
|
319
|
+
htmls(
|
|
320
|
+
`.style-${id}-col`,
|
|
321
|
+
css`
|
|
322
|
+
.${id}-col-a {
|
|
323
|
+
width: 50%;
|
|
324
|
+
}
|
|
325
|
+
.${id}-col-b {
|
|
326
|
+
width: 50%;
|
|
327
|
+
}
|
|
328
|
+
`,
|
|
329
|
+
);
|
|
330
|
+
break;
|
|
331
|
+
|
|
332
|
+
default:
|
|
333
|
+
if (s(`.${containerSelector}`).offsetWidth < 900)
|
|
334
|
+
htmls(
|
|
335
|
+
`.style-${id}-col`,
|
|
336
|
+
css`
|
|
337
|
+
.${id}-col-a, .${id}-col-b {
|
|
338
|
+
width: 100%;
|
|
339
|
+
}
|
|
340
|
+
`,
|
|
341
|
+
);
|
|
342
|
+
else
|
|
343
|
+
htmls(
|
|
344
|
+
`.style-${id}-col`,
|
|
345
|
+
css`
|
|
346
|
+
.${id}-col-a {
|
|
347
|
+
width: 30%;
|
|
348
|
+
}
|
|
349
|
+
.${id}-col-b {
|
|
350
|
+
width: 70%;
|
|
351
|
+
}
|
|
352
|
+
`,
|
|
353
|
+
);
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
} else {
|
|
357
|
+
dynamicColTokens[id].observer.disconnect();
|
|
358
|
+
delete dynamicColTokens[id];
|
|
359
|
+
if (s(`.style-${id}-col`)) s(`.style-${id}-col`).remove();
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
dynamicColTokens[id].observer.observe(s(`.${containerSelector}`));
|
|
363
|
+
});
|
|
364
|
+
return html` <style class="style-${id}-col"></style>`;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
const renderBubbleDialog = async function (
|
|
368
|
+
options = {
|
|
369
|
+
id: '',
|
|
370
|
+
html: async () => '',
|
|
371
|
+
classSelectors,
|
|
372
|
+
triangleType: 'down',
|
|
373
|
+
trianglePositionCss: '',
|
|
374
|
+
triangleCss: '',
|
|
375
|
+
triangleDim: 0,
|
|
376
|
+
bubbleCss: '',
|
|
377
|
+
},
|
|
378
|
+
) {
|
|
379
|
+
const { id, html } = options;
|
|
380
|
+
let cssTrianglePosition = `
|
|
381
|
+
bottom: -45px;
|
|
382
|
+
left: 5px;
|
|
383
|
+
`;
|
|
384
|
+
let whiteTriangleStyle = `top: 43%`;
|
|
385
|
+
let blackTriangleStyle = ``;
|
|
386
|
+
switch (options.triangleType) {
|
|
387
|
+
case 'right':
|
|
388
|
+
cssTrianglePosition = `
|
|
389
|
+
right: -40px;
|
|
390
|
+
top: 5px;
|
|
391
|
+
`;
|
|
392
|
+
blackTriangleStyle = `
|
|
393
|
+
top: 43%;
|
|
394
|
+
left: 57%;
|
|
395
|
+
`;
|
|
396
|
+
break;
|
|
397
|
+
|
|
398
|
+
default:
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
if (options.trianglePositionCss) cssTrianglePosition = options.trianglePositionCss;
|
|
402
|
+
return html` <div
|
|
403
|
+
class="${options?.classSelectors ? options.classSelectors : 'inl'} bubble-dialog bubble-dialog-${id}"
|
|
404
|
+
${options.bubbleCss ? `style='${options.bubbleCss}'` : ''}
|
|
405
|
+
>
|
|
406
|
+
<style class="style-bubble-dialog-triangle-${id}">
|
|
407
|
+
.bubble-dialog-triangle-${id} {
|
|
408
|
+
width: ${options.triangleDim ? options.triangleDim : 60}px;
|
|
409
|
+
height: ${options.triangleDim ? options.triangleDim : 60}px;
|
|
410
|
+
/* border: 2px solid red; */
|
|
411
|
+
box-sizing: border-box;
|
|
412
|
+
${cssTrianglePosition}
|
|
413
|
+
}
|
|
414
|
+
</style>
|
|
415
|
+
<div class="abs bubble-dialog-triangle bubble-dialog-triangle-${id}">
|
|
416
|
+
<div class="abs center" style="${blackTriangleStyle}">
|
|
417
|
+
${triangle[options?.triangleType ? options.triangleType : 'down']({
|
|
418
|
+
dim: 25,
|
|
419
|
+
id: id + '-triangle-black',
|
|
420
|
+
color: 'black',
|
|
421
|
+
classList: 'inl',
|
|
422
|
+
customStyle: options.triangleCss,
|
|
423
|
+
})}
|
|
424
|
+
</div>
|
|
425
|
+
<div class="abs center" style="${whiteTriangleStyle}">
|
|
426
|
+
${triangle[options?.triangleType ? options.triangleType : 'down']({
|
|
427
|
+
dim: 24,
|
|
428
|
+
id: id + '-triangle-white',
|
|
429
|
+
color: 'white',
|
|
430
|
+
classList: 'inl',
|
|
431
|
+
customStyle: options.triangleCss,
|
|
432
|
+
})}
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
${await html()}
|
|
436
|
+
</div>`;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
const typeWriter = async function ({ id, html, seconds, endHideBlink, container }) {
|
|
440
|
+
if (!seconds) seconds = 2;
|
|
441
|
+
return new Promise((resolve) => {
|
|
442
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function
|
|
443
|
+
// https://www.w3schools.com/cssref/css3_pr_animation-fill-mode.php
|
|
444
|
+
const typingAnimationTransitionStyle = [
|
|
445
|
+
`1s linear`,
|
|
446
|
+
`${seconds}s steps(${html.split(' ').length * 6}, end)`,
|
|
447
|
+
`1s forwards`,
|
|
448
|
+
];
|
|
449
|
+
const render = html`
|
|
450
|
+
<style class="style-${id}">
|
|
451
|
+
.tw-${id}-typed-out {
|
|
452
|
+
overflow: hidden;
|
|
453
|
+
border-right: 0.15em solid orange;
|
|
454
|
+
white-space: nowrap;
|
|
455
|
+
animation: typing-${id} ${typingAnimationTransitionStyle[1]}, blink-caret-${id} 0.5s step-end infinite;
|
|
456
|
+
animation-fill-mode: forwards;
|
|
457
|
+
width: 0;
|
|
458
|
+
}
|
|
459
|
+
</style>
|
|
460
|
+
<style>
|
|
461
|
+
.tw-${id}-container {
|
|
462
|
+
}
|
|
463
|
+
@keyframes typing-${id} {
|
|
464
|
+
from {
|
|
465
|
+
width: 0;
|
|
466
|
+
}
|
|
467
|
+
to {
|
|
468
|
+
width: 100%;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
@keyframes blink-caret-${id} {
|
|
473
|
+
from,
|
|
474
|
+
to {
|
|
475
|
+
border-color: transparent;
|
|
476
|
+
}
|
|
477
|
+
50% {
|
|
478
|
+
border-color: orange;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
</style>
|
|
482
|
+
<div class="inl tw-${id}-container">
|
|
483
|
+
<div class="tw-${id}-typed-out">${html}</div>
|
|
484
|
+
</div>
|
|
485
|
+
`;
|
|
486
|
+
htmls(`.${container}`, render);
|
|
487
|
+
setTimeout(() => {
|
|
488
|
+
if (endHideBlink && s(`.style-${id}`)) s(`.style-${id}`).remove();
|
|
489
|
+
resolve(render);
|
|
490
|
+
}, seconds * 1000);
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
const renderCssAttr = (options) =>
|
|
495
|
+
`${
|
|
496
|
+
options && options.style
|
|
497
|
+
? Object.keys(options.style)
|
|
498
|
+
.map((keyStyle) => `${keyStyle}: ${options.style[keyStyle]};`)
|
|
499
|
+
.join(`\n`)
|
|
500
|
+
: ''
|
|
501
|
+
}`;
|
|
502
|
+
|
|
503
|
+
const renderStyleTag = (styleSelector = 'style-abc', selector, options) =>
|
|
504
|
+
html`<style class="${styleSelector}">
|
|
505
|
+
${selector} { ${renderCssAttr(options)} }
|
|
506
|
+
</style>`;
|
|
507
|
+
|
|
508
|
+
function getTranslate3d(el) {
|
|
509
|
+
const values = el.style.transform.split(/\w+\(|\);?/);
|
|
510
|
+
if (!values[1] || !values[1].length) {
|
|
511
|
+
return [];
|
|
512
|
+
}
|
|
513
|
+
return values[1].split(/,\s?/g);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const dashRange = ({ selector, color }) => {
|
|
517
|
+
return html`
|
|
518
|
+
<style>
|
|
519
|
+
.${selector} {
|
|
520
|
+
background: linear-gradient(90deg, ${color} 50%, transparent 50%),
|
|
521
|
+
linear-gradient(90deg, ${color} 50%, transparent 50%), linear-gradient(0deg, ${color} 50%, transparent 50%),
|
|
522
|
+
linear-gradient(0deg, ${color} 50%, transparent 50%);
|
|
523
|
+
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
|
|
524
|
+
background-size: 16px 4px, 16px 4px, 4px 16px, 4px 16px;
|
|
525
|
+
background-position: 0% 0%, 100% 100%, 0% 100%, 100% 0px;
|
|
526
|
+
border-radius: 5px;
|
|
527
|
+
padding: 10px;
|
|
528
|
+
animation: ${selector}_dash_range 5s linear infinite;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
@keyframes ${selector}_dash_range {
|
|
532
|
+
to {
|
|
533
|
+
background-position: 100% 0%, 0% 100%, 0% 0%, 100% 100%;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
</style>
|
|
537
|
+
`;
|
|
538
|
+
};
|
|
539
|
+
const triangle = {
|
|
540
|
+
up: ({ id, dim, color, classList, customStyle }) => {
|
|
541
|
+
return html`<style class="style-${id}">
|
|
542
|
+
.arrow-up-${id} {
|
|
543
|
+
width: 0;
|
|
544
|
+
height: 0;
|
|
545
|
+
border-left: ${dim}px solid transparent;
|
|
546
|
+
border-right: ${dim}px solid transparent;
|
|
547
|
+
border-bottom: ${dim}px solid ${color};
|
|
548
|
+
}
|
|
549
|
+
</style>
|
|
550
|
+
<div
|
|
551
|
+
class="arrow-up-${id} ${classList}"
|
|
552
|
+
${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
|
|
553
|
+
></div>`;
|
|
554
|
+
},
|
|
555
|
+
down: ({ id, dim, color, classList, customStyle }) => {
|
|
556
|
+
return html`<style class="style-${id}">
|
|
557
|
+
.arrow-down-${id} {
|
|
558
|
+
width: 0;
|
|
559
|
+
height: 0;
|
|
560
|
+
border-left: ${dim}px solid transparent;
|
|
561
|
+
border-right: ${dim}px solid transparent;
|
|
562
|
+
border-top: ${dim}px solid ${color};
|
|
563
|
+
}
|
|
564
|
+
</style>
|
|
565
|
+
<div
|
|
566
|
+
class="arrow-down-${id} ${classList}"
|
|
567
|
+
${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
|
|
568
|
+
></div>`;
|
|
569
|
+
},
|
|
570
|
+
right: ({ id, dim, color, classList, customStyle }) => {
|
|
571
|
+
return html` <style class="style-${id}">
|
|
572
|
+
.arrow-right-${id} {
|
|
573
|
+
width: 0;
|
|
574
|
+
height: 0;
|
|
575
|
+
border-top: ${dim}px solid transparent;
|
|
576
|
+
border-bottom: ${dim}px solid transparent;
|
|
577
|
+
border-left: ${dim}px solid ${color};
|
|
578
|
+
}
|
|
579
|
+
</style>
|
|
580
|
+
<div
|
|
581
|
+
class="arrow-right-${id} ${classList}"
|
|
582
|
+
${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
|
|
583
|
+
></div>`;
|
|
584
|
+
},
|
|
585
|
+
left: ({ id, dim, color, classList, customStyle }) => {
|
|
586
|
+
return html`<style class="style-${id}">
|
|
587
|
+
.arrow-left-${id} {
|
|
588
|
+
width: 0;
|
|
589
|
+
height: 0;
|
|
590
|
+
border-top: ${dim}px solid transparent;
|
|
591
|
+
border-bottom: ${dim}px solid transparent;
|
|
592
|
+
border-right: ${dim}px solid ${color};
|
|
593
|
+
}
|
|
594
|
+
</style>
|
|
595
|
+
<div
|
|
596
|
+
class="arrow-left-${id} ${classList}"
|
|
597
|
+
${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
|
|
598
|
+
></div>`;
|
|
599
|
+
},
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
const getSectionsStringData = (offsetWidth, text) => {
|
|
603
|
+
const sectionsIndex = [];
|
|
604
|
+
const everyXChar = parseInt(offsetWidth / 4);
|
|
605
|
+
const phraseArray = text
|
|
606
|
+
.split('.')
|
|
607
|
+
.map((t) => splitEveryXChar(t + '.', everyXChar, ['.', ' ']))
|
|
608
|
+
.flat()
|
|
609
|
+
.filter((p) => p !== '.' && p.trim());
|
|
610
|
+
|
|
611
|
+
let currentIndex = [0];
|
|
612
|
+
let pi = -1;
|
|
613
|
+
for (const p of phraseArray) {
|
|
614
|
+
pi++;
|
|
615
|
+
if (p.indexOf('.') !== -1) {
|
|
616
|
+
currentIndex.push(newInstance(pi));
|
|
617
|
+
sectionsIndex.push(newInstance(currentIndex));
|
|
618
|
+
if (phraseArray[pi + 1]) currentIndex = [newInstance(pi + 1)];
|
|
619
|
+
else currentIndex = [];
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
if (currentIndex[0] && !currentIndex[1]) {
|
|
623
|
+
currentIndex[1] = phraseArray.length - 1;
|
|
624
|
+
sectionsIndex.push(newInstance(currentIndex));
|
|
625
|
+
}
|
|
626
|
+
return { phraseArray, sectionsIndex };
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
const typeWriteSectionsString = ({ container, phraseArray, rangeArraySectionIndex }) =>
|
|
630
|
+
new Promise((resolve) => {
|
|
631
|
+
let cumulativeSeconds = 0;
|
|
632
|
+
for (const index of range(...rangeArraySectionIndex)) {
|
|
633
|
+
const subIdSalt = s4() + s4() + s4();
|
|
634
|
+
const seconds = phraseArray[index].trim().length * 0.05;
|
|
635
|
+
append(`.${container}`, html` <div class="${container}-${subIdSalt}"></div> `);
|
|
636
|
+
setTimeout(async () => {
|
|
637
|
+
if (s(`.${container}-${subIdSalt}`)) {
|
|
638
|
+
append(`.${container}-${subIdSalt}`, html` <div class="render-typeWriter-${container}-${subIdSalt}"></div> `);
|
|
639
|
+
await typeWriter({
|
|
640
|
+
id: `typeWriter-${index}-${container}`,
|
|
641
|
+
html: phraseArray[index].trim(),
|
|
642
|
+
endHideBlink: index < rangeArraySectionIndex[1],
|
|
643
|
+
seconds,
|
|
644
|
+
container: `render-typeWriter-${container}-${subIdSalt}`,
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
if (index === rangeArraySectionIndex[1]) resolve();
|
|
648
|
+
}, cumulativeSeconds * 1000);
|
|
649
|
+
cumulativeSeconds += seconds;
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
const cssBrowserCodes = ['webkit', 'moz', 'ms', 'o'];
|
|
654
|
+
|
|
655
|
+
const scrollBarLightRender = () => {
|
|
656
|
+
return cssBrowserCodes
|
|
657
|
+
.map(
|
|
658
|
+
(b) =>
|
|
659
|
+
html`<style>
|
|
660
|
+
::-` +
|
|
661
|
+
b +
|
|
662
|
+
`-scrollbar {
|
|
663
|
+
width: 5px;
|
|
664
|
+
height: 5px;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/* Track */
|
|
668
|
+
::-` +
|
|
669
|
+
b +
|
|
670
|
+
`-scrollbar-track {
|
|
671
|
+
background: none !important;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/* Handle */
|
|
675
|
+
::-` +
|
|
676
|
+
b +
|
|
677
|
+
`-scrollbar-thumb {
|
|
678
|
+
background: #15151557;
|
|
679
|
+
border-radius: 3px;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/* Handle on hover */
|
|
683
|
+
::-` +
|
|
684
|
+
b +
|
|
685
|
+
`-scrollbar-thumb:hover {
|
|
686
|
+
background: #4d4d4dbb;
|
|
687
|
+
}
|
|
688
|
+
</style>`,
|
|
689
|
+
)
|
|
690
|
+
.join('');
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
function adjustHex(hex, factor = 0.1, options = {}) {
|
|
694
|
+
if (typeof hex !== 'string') throw new TypeError('hex must be a string');
|
|
695
|
+
if (typeof factor !== 'number') throw new TypeError('factor must be a number');
|
|
696
|
+
|
|
697
|
+
// normalize factor: allow -100..100 or -1..1
|
|
698
|
+
if (factor > 1 && factor <= 100) factor = factor / 100;
|
|
699
|
+
if (factor < -1 && factor >= -100) factor = factor / 100;
|
|
700
|
+
factor = Math.max(-1, Math.min(1, factor));
|
|
701
|
+
|
|
702
|
+
const mode = options.mode === 'hsl' ? 'hsl' : 'mix';
|
|
703
|
+
|
|
704
|
+
// normalize hex
|
|
705
|
+
let h = hex.replace(/^#/, '').trim();
|
|
706
|
+
if (!(h.length === 3 || h.length === 6)) throw new Error('Invalid hex format');
|
|
707
|
+
if (h.length === 3)
|
|
708
|
+
h = h
|
|
709
|
+
.split('')
|
|
710
|
+
.map((c) => c + c)
|
|
711
|
+
.join('');
|
|
712
|
+
|
|
713
|
+
const r = parseInt(h.slice(0, 2), 16);
|
|
714
|
+
const g = parseInt(h.slice(2, 4), 16);
|
|
715
|
+
const b = parseInt(h.slice(4, 6), 16);
|
|
716
|
+
|
|
717
|
+
const clamp = (v, a = 0, z = 255) => Math.max(a, Math.min(z, v));
|
|
718
|
+
|
|
719
|
+
const rgbToHex = (rr, gg, bb) =>
|
|
720
|
+
'#' +
|
|
721
|
+
[rr, gg, bb]
|
|
722
|
+
.map((v) => Math.round(v).toString(16).padStart(2, '0'))
|
|
723
|
+
.join('')
|
|
724
|
+
.toLowerCase();
|
|
725
|
+
|
|
726
|
+
if (mode === 'mix') {
|
|
727
|
+
// positive: mix toward white (255); negative: mix toward black (0)
|
|
728
|
+
const mixChannel = (c) => {
|
|
729
|
+
if (factor >= 0) {
|
|
730
|
+
return clamp(Math.round(c + (255 - c) * factor));
|
|
731
|
+
} else {
|
|
732
|
+
const a = Math.abs(factor);
|
|
733
|
+
return clamp(Math.round(c * (1 - a)));
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
return rgbToHex(mixChannel(r), mixChannel(g), mixChannel(b));
|
|
737
|
+
} else {
|
|
738
|
+
// HSL mode: convert rgb to hsl, adjust L by factor, convert back
|
|
739
|
+
const rgbToHsl = (r, g, b) => {
|
|
740
|
+
r /= 255;
|
|
741
|
+
g /= 255;
|
|
742
|
+
b /= 255;
|
|
743
|
+
const max = Math.max(r, g, b),
|
|
744
|
+
min = Math.min(r, g, b);
|
|
745
|
+
let h = 0,
|
|
746
|
+
s = 0,
|
|
747
|
+
l = (max + min) / 2;
|
|
748
|
+
if (max !== min) {
|
|
749
|
+
const d = max - min;
|
|
750
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
751
|
+
switch (max) {
|
|
752
|
+
case r:
|
|
753
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
754
|
+
break;
|
|
755
|
+
case g:
|
|
756
|
+
h = (b - r) / d + 2;
|
|
757
|
+
break;
|
|
758
|
+
case b:
|
|
759
|
+
h = (r - g) / d + 4;
|
|
760
|
+
break;
|
|
761
|
+
}
|
|
762
|
+
h /= 6;
|
|
763
|
+
}
|
|
764
|
+
return { h, s, l };
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
const hslToRgb = (h, s, l) => {
|
|
768
|
+
let r, g, b;
|
|
769
|
+
if (s === 0) {
|
|
770
|
+
r = g = b = l;
|
|
771
|
+
} else {
|
|
772
|
+
const hue2rgb = (p, q, t) => {
|
|
773
|
+
if (t < 0) t += 1;
|
|
774
|
+
if (t > 1) t -= 1;
|
|
775
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
776
|
+
if (t < 1 / 2) return q;
|
|
777
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
778
|
+
return p;
|
|
779
|
+
};
|
|
780
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
781
|
+
const p = 2 * l - q;
|
|
782
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
783
|
+
g = hue2rgb(p, q, h);
|
|
784
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
785
|
+
}
|
|
786
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
const { h: hh, s: ss, l: ll } = rgbToHsl(r, g, b);
|
|
790
|
+
// add factor to lightness (factor already normalized -1..1)
|
|
791
|
+
let newL = ll + factor;
|
|
792
|
+
newL = Math.max(0, Math.min(1, newL));
|
|
793
|
+
const { r: r2, g: g2, b: b2 } = hslToRgb(hh, ss, newL);
|
|
794
|
+
return rgbToHex(r2, g2, b2);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// Convenience helpers:
|
|
799
|
+
function lightenHex(hex, percentOr01 = 0.1, options = {}) {
|
|
800
|
+
return adjustHex(hex, Math.abs(percentOr01), options);
|
|
801
|
+
}
|
|
802
|
+
function darkenHex(hex, percentOr01 = 0.1, options = {}) {
|
|
803
|
+
return adjustHex(hex, -Math.abs(percentOr01), options);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
const subThemeManager = {
|
|
807
|
+
render: async function () {
|
|
808
|
+
if (darkTheme && this.renderDark) {
|
|
809
|
+
return await this.renderDark();
|
|
810
|
+
} else if (!darkTheme && this.renderLight) {
|
|
811
|
+
return await this.renderLight();
|
|
812
|
+
}
|
|
813
|
+
return html``;
|
|
814
|
+
},
|
|
815
|
+
lightColor: null,
|
|
816
|
+
setLightTheme: function (color) {
|
|
817
|
+
this.lightColor = color;
|
|
818
|
+
this.renderLight = async function () {
|
|
819
|
+
return html`<style>
|
|
820
|
+
button:hover,
|
|
821
|
+
.a-btn:hover,
|
|
822
|
+
.main-btn-menu-active {
|
|
823
|
+
color: ${this.lightColor};
|
|
824
|
+
background-color: ${lightenHex(this.lightColor, 0.8)};
|
|
825
|
+
}
|
|
826
|
+
.main-sub-btn-active {
|
|
827
|
+
color: ${this.lightColor};
|
|
828
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
829
|
+
}
|
|
830
|
+
.main-sub-btn-active:hover {
|
|
831
|
+
color: ${this.lightColor};
|
|
832
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
833
|
+
}
|
|
834
|
+
</style>`;
|
|
835
|
+
};
|
|
836
|
+
},
|
|
837
|
+
darkColor: null,
|
|
838
|
+
setDarkTheme: function (color) {
|
|
839
|
+
this.darkColor = color;
|
|
840
|
+
this.renderDark = async function () {
|
|
841
|
+
return html`<style>
|
|
842
|
+
button:hover,
|
|
843
|
+
.a-btn:hover,
|
|
844
|
+
.main-btn-menu-active {
|
|
845
|
+
color: ${lightenHex(this.darkColor, 0.8)};
|
|
846
|
+
background-color: ${darkenHex(this.darkColor, 0.75)};
|
|
847
|
+
}
|
|
848
|
+
.main-sub-btn-active {
|
|
849
|
+
color: ${lightenHex(this.darkColor, 0.8)};
|
|
850
|
+
background-color: rgba(255, 255, 255, 0.3);
|
|
851
|
+
}
|
|
852
|
+
.main-sub-btn-active:hover {
|
|
853
|
+
color: ${lightenHex(this.darkColor, 0.8)};
|
|
854
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
855
|
+
}
|
|
856
|
+
</style>`;
|
|
857
|
+
};
|
|
858
|
+
},
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
const scrollBarDarkRender = () => {
|
|
862
|
+
return cssBrowserCodes
|
|
863
|
+
.map(
|
|
864
|
+
(b) =>
|
|
865
|
+
html`<style>
|
|
866
|
+
::-` +
|
|
867
|
+
b +
|
|
868
|
+
`-scrollbar {
|
|
869
|
+
width: 8px;
|
|
870
|
+
height: 8px;
|
|
871
|
+
/* line-height: 1em; */
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/* Track */
|
|
875
|
+
::-` +
|
|
876
|
+
b +
|
|
877
|
+
`-scrollbar-track {
|
|
878
|
+
background: none !important;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/* Handle */
|
|
882
|
+
::-` +
|
|
883
|
+
b +
|
|
884
|
+
`-scrollbar-thumb {
|
|
885
|
+
background: #74747457;
|
|
886
|
+
border-radius: 4px;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/* Handle on hover */
|
|
890
|
+
::-` +
|
|
891
|
+
b +
|
|
892
|
+
`-scrollbar-thumb:hover {
|
|
893
|
+
background: #98989857;
|
|
894
|
+
}
|
|
895
|
+
</style>`,
|
|
896
|
+
)
|
|
897
|
+
.join('');
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
const renderWave = ({ id }) => {
|
|
901
|
+
return html`
|
|
902
|
+
<style>
|
|
903
|
+
.wave-animation-container-${id} {
|
|
904
|
+
height: 200px;
|
|
905
|
+
}
|
|
906
|
+
.wave-animation-container-${id} {
|
|
907
|
+
background: linear-gradient(
|
|
908
|
+
315deg,
|
|
909
|
+
rgba(101, 0, 94, 1) 3%,
|
|
910
|
+
rgba(60, 132, 206, 1) 38%,
|
|
911
|
+
rgba(48, 238, 226, 1) 68%,
|
|
912
|
+
rgba(255, 25, 25, 1) 98%
|
|
913
|
+
);
|
|
914
|
+
animation: gradient-${id} 15s ease infinite;
|
|
915
|
+
background-size: 400% 400%;
|
|
916
|
+
overflow: hidden;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
@keyframes gradient-${id} {
|
|
920
|
+
0% {
|
|
921
|
+
background-position: 0% 0%;
|
|
922
|
+
}
|
|
923
|
+
50% {
|
|
924
|
+
background-position: 100% 100%;
|
|
925
|
+
}
|
|
926
|
+
100% {
|
|
927
|
+
background-position: 0% 0%;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
.wave-${id} {
|
|
932
|
+
background: rgb(255 255 255 / 25%);
|
|
933
|
+
border-radius: 1000% 1000% 0 0;
|
|
934
|
+
width: 200%;
|
|
935
|
+
height: 12em;
|
|
936
|
+
animation: wave-${id} 10s -3s linear infinite;
|
|
937
|
+
opacity: 0.8;
|
|
938
|
+
bottom: 0;
|
|
939
|
+
left: 0;
|
|
940
|
+
top: 30%;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
.wave-${id}:nth-of-type(2) {
|
|
944
|
+
animation: wave-${id} 18s linear reverse infinite;
|
|
945
|
+
opacity: 0.8;
|
|
946
|
+
top: 50%;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
.wave-${id}:nth-of-type(3) {
|
|
950
|
+
animation: wave-${id} 20s -1s reverse infinite;
|
|
951
|
+
opacity: 0.9;
|
|
952
|
+
top: 70%;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
@keyframes wave-${id} {
|
|
956
|
+
2% {
|
|
957
|
+
transform: translateX(1);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
25% {
|
|
961
|
+
transform: translateX(-25%);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
50% {
|
|
965
|
+
transform: translateX(-50%);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
75% {
|
|
969
|
+
transform: translateX(-25%);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
100% {
|
|
973
|
+
transform: translateX(1);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
</style>
|
|
977
|
+
<div class="in wave-animation-container-${id} ${id}">
|
|
978
|
+
<div class="in wave-${id}"></div>
|
|
979
|
+
<div class="abs wave-${id}"></div>
|
|
980
|
+
<div class="abs wave-${id}"></div>
|
|
981
|
+
</div>
|
|
982
|
+
`;
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
const cssTokensEffect = {};
|
|
986
|
+
const cssTokensContainer = {};
|
|
987
|
+
const cssEffect = async (containerSelector, event) => {
|
|
988
|
+
// Array.from(event.target.classList)
|
|
989
|
+
let offsetX, offsetY;
|
|
990
|
+
if (Array.from(event.srcElement.classList).includes('ripple') && cssTokensContainer[containerSelector]) {
|
|
991
|
+
offsetX = cssTokensContainer[containerSelector].lastOffsetX;
|
|
992
|
+
offsetY = cssTokensContainer[containerSelector].lastOffsetY;
|
|
993
|
+
} else {
|
|
994
|
+
cssTokensContainer[containerSelector] = { lastOffsetX: event.offsetX, lastOffsetY: event.offsetY };
|
|
995
|
+
offsetX = event.offsetX;
|
|
996
|
+
offsetY = event.offsetY;
|
|
997
|
+
}
|
|
998
|
+
const element = s(containerSelector);
|
|
999
|
+
// element.style.overflow = 'hidden';
|
|
1000
|
+
const id = getId(cssTokensEffect, 'btn-effect-');
|
|
1001
|
+
cssTokensEffect[id] = { containerSelector, event };
|
|
1002
|
+
append(containerSelector, html`<span class="abs ${id} ripple" style="display: none"></span>`);
|
|
1003
|
+
const circle = s(`.${id}`);
|
|
1004
|
+
circle.style.width = circle.style.height = `40px`;
|
|
1005
|
+
circle.style.left = `${offsetX}px`;
|
|
1006
|
+
circle.style.top = `${offsetY}px`;
|
|
1007
|
+
circle.style.display = null;
|
|
1008
|
+
setTimeout(() => {
|
|
1009
|
+
circle.remove();
|
|
1010
|
+
delete cssTokensEffect[id];
|
|
1011
|
+
}, 600);
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
const imageShimmer = () => html`<div
|
|
1015
|
+
class="abs center ssr-shimmer-search-box"
|
|
1016
|
+
style="${renderCssAttr({
|
|
1017
|
+
style: {
|
|
1018
|
+
width: '95%',
|
|
1019
|
+
height: '95%',
|
|
1020
|
+
'border-radius': '10px',
|
|
1021
|
+
overflow: 'hidden',
|
|
1022
|
+
},
|
|
1023
|
+
})}"
|
|
1024
|
+
>
|
|
1025
|
+
<div
|
|
1026
|
+
class="abs center"
|
|
1027
|
+
style="${renderCssAttr({
|
|
1028
|
+
style: {
|
|
1029
|
+
'font-size': '70px',
|
|
1030
|
+
color: `#bababa`,
|
|
1031
|
+
},
|
|
1032
|
+
})}"
|
|
1033
|
+
>
|
|
1034
|
+
<i class="fa-solid fa-photo-film"></i>
|
|
1035
|
+
</div>
|
|
1036
|
+
</div>`;
|
|
1037
|
+
|
|
1038
|
+
const renderChessPattern = (patternSize = 20) =>
|
|
1039
|
+
`background: repeating-conic-gradient(#808080 0 25%, #0000 0 50%) 50% / ${patternSize}px ${patternSize}px`;
|
|
1040
|
+
|
|
1041
|
+
const extractBackgroundImageUrl = (element) => {
|
|
1042
|
+
const style = window.getComputedStyle(element);
|
|
1043
|
+
const imageString = style.backgroundImage;
|
|
1044
|
+
const foundUrlRaw = imageString.match(/^url\(?(.+)\)$/i)[1];
|
|
1045
|
+
if (!foundUrlRaw) return null;
|
|
1046
|
+
const foundUrl = foundUrlRaw.replace(/^['|"| ]*/, '').replace(/['" ]*$/, '');
|
|
1047
|
+
if (!foundUrl) return null;
|
|
1048
|
+
return foundUrl;
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
const simpleIconsRender = (selector) => {
|
|
1052
|
+
sa(selector).forEach((el) => {
|
|
1053
|
+
el.src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(window.getComputedStyle(s('html')).color)}`;
|
|
1054
|
+
});
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
const styleFactory = (payload, plain = '') => `style="${renderCssAttr({ style: payload })} ${plain}"`;
|
|
1058
|
+
|
|
1059
|
+
export {
|
|
1060
|
+
Css,
|
|
1061
|
+
Themes,
|
|
1062
|
+
barLabels,
|
|
1063
|
+
barConfig,
|
|
1064
|
+
borderChar,
|
|
1065
|
+
renderMediaQuery,
|
|
1066
|
+
renderDefaultWindowsModalButtonContent,
|
|
1067
|
+
renderStatus,
|
|
1068
|
+
dynamicCol,
|
|
1069
|
+
dynamicColTokens,
|
|
1070
|
+
boxShadow,
|
|
1071
|
+
addTheme,
|
|
1072
|
+
darkTheme,
|
|
1073
|
+
ThemeEvents,
|
|
1074
|
+
TriggerThemeEvents,
|
|
1075
|
+
ThemesScope,
|
|
1076
|
+
renderBubbleDialog,
|
|
1077
|
+
typeWriter,
|
|
1078
|
+
renderStyleTag,
|
|
1079
|
+
renderCssAttr,
|
|
1080
|
+
getTranslate3d,
|
|
1081
|
+
dashRange,
|
|
1082
|
+
triangle,
|
|
1083
|
+
getSectionsStringData,
|
|
1084
|
+
typeWriteSectionsString,
|
|
1085
|
+
cssBrowserCodes,
|
|
1086
|
+
scrollBarDarkRender,
|
|
1087
|
+
scrollBarLightRender,
|
|
1088
|
+
renderWave,
|
|
1089
|
+
cssEffect,
|
|
1090
|
+
imageShimmer,
|
|
1091
|
+
simpleIconsRender,
|
|
1092
|
+
extractBackgroundImageUrl,
|
|
1093
|
+
renderChessPattern,
|
|
1094
|
+
subThemeManager,
|
|
1095
|
+
lightenHex,
|
|
1096
|
+
darkenHex,
|
|
1097
|
+
adjustHex,
|
|
1098
|
+
styleFactory,
|
|
1099
|
+
};
|