@team-codeme/crud-forge 0.0.0-stage → 1.0.0
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/.cursor/agents/generator-engineer.md +31 -0
- package/.cursor/agents/keycloak-engineer.md +33 -0
- package/.cursor/agents/qa-engineer.md +32 -0
- package/.cursor/agents/security-reviewer.md +30 -0
- package/.cursor/mcp.json +13 -0
- package/.cursor/rules/crudforge-precautions.mdc +16 -0
- package/.cursor/rules/playwright-browser.mdc +30 -0
- package/.cursor/rules/readme-todo-sync.mdc +13 -0
- package/.env.qa.example +19 -0
- package/.github/workflows/qa-live.yml +32 -0
- package/.github/workflows/qa.yml +27 -0
- package/.vscode/settings.json +32 -0
- package/QA/IAM-PLAN.md +25 -0
- package/QA/IAM-RESULTS.md +39 -0
- package/QA/IAM-TESTCASES.md +36 -0
- package/QA/IAM-TODO.md +7 -0
- package/QA/KEYCLOAK-BOOTSTRAP.md +105 -0
- package/QA/PLAN.md +43 -0
- package/QA/RESULTS.md +59 -0
- package/QA/TESTCASES.md +65 -0
- package/QA/TODO.md +14 -0
- package/QA/pmb-dev/README.md +49 -0
- package/QA/pmb-dev/config/config.yml +152 -0
- package/QA/pmb-dev/gdl/i.gdl +17 -0
- package/README.md +851 -2
- package/Todo.md +207 -0
- package/assets/branding/crudforge-logo.png +0 -0
- package/assets/branding/crudforge-mark.png +0 -0
- package/branding/poster-crudforge.jpg +0 -0
- package/chat/last-chat/Investigating Mock Data Configuration.md +428 -0
- package/cli.js +167 -0
- package/config/default-config.yml +245 -0
- package/docs/performance/README.md +217 -0
- package/docs/performance/after.json +111 -0
- package/docs/performance/before.json +111 -0
- package/docs/quality/README.md +276 -0
- package/e2e/crudforge.e2e.yml +47 -0
- package/e2e/crudforge.field-profile.yml +33 -0
- package/e2e/crudforge.iam-live.yml +124 -0
- package/e2e/crudforge.iam.yml +62 -0
- package/e2e/tests/field-profile.spec.js +152 -0
- package/e2e/tests/generated-crud.spec.js +251 -0
- package/e2e/tests/iam-live.spec.js +149 -0
- package/e2e/tests/iam-pack.spec.js +151 -0
- package/e2e/tests/list-state.spec.js +73 -0
- package/features.csv +27 -0
- package/fuse-starter-pack/branding/crudforge-mark-source.jpg +0 -0
- package/fuse-starter-pack/branding/crudforge-mark-source.png +0 -0
- package/fuse-starter-pack/branding/crudforge-mark.png +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark-source.jpg +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark-source.png +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/Dockerfile +14 -0
- package/fuse-starter-pack/fuse-v21.1/LICENSE.md +6 -0
- package/fuse-starter-pack/fuse-v21.1/README.md +59 -0
- package/fuse-starter-pack/fuse-v21.1/angular.json +113 -0
- package/fuse-starter-pack/fuse-v21.1/eslint.config.ts +150 -0
- package/fuse-starter-pack/fuse-v21.1/nginx.conf +23 -0
- package/fuse-starter-pack/fuse-v21.1/nginx.dev.conf +18 -0
- package/fuse-starter-pack/fuse-v21.1/package-lock.json +11513 -0
- package/fuse-starter-pack/fuse-v21.1/package.json +69 -0
- package/fuse-starter-pack/fuse-v21.1/postcss.config.json +5 -0
- package/fuse-starter-pack/fuse-v21.1/prettier.config.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/proxy.conf.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/proxy.dev.conf.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/favicon.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/Geist-Italic.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/Geist.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/GeistMono-Italic.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/GeistMono.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/i18n/en.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/i18n/es.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/ES.svg +79 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/US.svg +14 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/where-to-find-other-flags.txt +5 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/logo/logo-mark.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/logo/logo.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/push.sh +27 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.config.server.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.config.ts +64 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.routes.server.ts +8 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.routes.ts +39 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.ts +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/index.ts +1 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/lucide.ts +1 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/provider.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/index.ts +2 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/local-storage.ts +109 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/provider.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/index.ts +2 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/media.ts +64 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/provider.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/index.ts +3 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/models/theming.ts +13 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/palette.ts +209 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/provider.ts +24 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/theming.ts +129 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/transloco/transloco-http-loader.ts +12 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/data/navigation.ts +176 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/layout.ts +77 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/language-switcher.ts +91 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/navigation.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/notifications.ts +252 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/scheme-switcher.ts +58 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/sidebar.ts +31 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/user.ts +132 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/data/academy.ts +753 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/data/model.ts +27 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/features/course.ts +318 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/features/courses.ts +228 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/routes.ts +14 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/data/contacts.ts +4372 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/data/model.ts +34 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/features/contact.ts +239 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/features/contacts.ts +185 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/data/file-manager.ts +261 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/data/model.ts +12 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/features/file-manager.ts +131 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/routes.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/ui/list.ts +164 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/faq.ts +288 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/guide.ts +134 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/home.ts +219 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/support.ts +161 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/routes.ts +33 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/data/model.ts +18 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/data/notes.ts +324 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/features/note.ts +152 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/features/notes.ts +118 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/data/model.ts +17 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/data/tasks.ts +562 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/features/task.ts +195 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/features/tasks.ts +271 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/analytics.ts +1620 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/finance.ts +1065 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/project.ts +376 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/analytics/analytics.ts +1096 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/finance/finance.ts +658 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/project/budget-table.ts +188 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/project/project.ts +565 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/routes.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/changelog/changelog.ts +932 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/building.ts +33 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/development.ts +42 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/installation.ts +47 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/routes.ts +45 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/error/features/error-page.ts +70 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/error/routes.ts +21 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/notifications/features/notifications.ts +262 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/notifications/routes.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/account.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/notifications.ts +134 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/plan-and-billing.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/security.ts +211 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/team.ts +188 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/layout.ts +109 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/routes.ts +37 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/welcome/welcome.component.ts +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/routes.ts +95 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/forgot-password/forgot-password.html +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/forgot-password/forgot-password.ts +51 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/reset-password/reset-password.html +82 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/reset-password/reset-password.ts +69 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-in/sign-in.html +132 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-in/sign-in.ts +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-up/sign-up.html +183 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-up/sign-up.ts +56 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/routes.ts +34 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/features/coming-soon.ts +156 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/layout/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/modules/home/features/home.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/modules/home/routes.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/routes.ts +30 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.mock.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.prod.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/index.html +66 -0
- package/fuse-starter-pack/fuse-v21.1/src/main.server.ts +11 -0
- package/fuse-starter-pack/fuse-v21.1/src/main.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/server.ts +70 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/base/base.css +63 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/base/typography.css +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/a.css +18 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/input.css +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/kbd.css +55 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/material.css +1149 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/styles.css +31 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/theme.css +147 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/utilities.css +563 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/variants.css +4 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/third-party/lucide-icons.css +12 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.app.json +16 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.json +37 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.spec.json +10 -0
- package/generator/README.md +12 -0
- package/generator/issues/.gitkeep +0 -0
- package/package.json +56 -4
- package/playwright.config.js +29 -0
- package/playwright.field-profile.config.js +6 -0
- package/playwright.iam-live.config.js +31 -0
- package/playwright.iam.config.js +29 -0
- package/playwright.list-state.config.js +6 -0
- package/playwright.performance.config.js +1 -0
- package/run-config-tests.sh +5 -0
- package/scripts/e2e-paths.js +89 -0
- package/scripts/e2e-prepare-field-profile.js +17 -0
- package/scripts/e2e-prepare-iam-live.js +135 -0
- package/scripts/e2e-prepare-iam.js +65 -0
- package/scripts/e2e-prepare.js +72 -0
- package/scripts/e2e-serve-iam-live.js +28 -0
- package/scripts/e2e-serve-iam.js +28 -0
- package/scripts/e2e-serve.js +28 -0
- package/scripts/performance/generate.js +17 -0
- package/scripts/performance/measure.js +55 -0
- package/scripts/postinstall.js +9 -0
- package/scripts/prepare-quality-apps.js +34 -0
- package/scripts/run-config-tests.js +63 -0
- package/src/assets/logo-with-lable.jpeg +0 -0
- package/src/assets/logo.jpeg +0 -0
- package/src/commands/bootstrap.js +92 -0
- package/src/commands/doctor.js +403 -0
- package/src/commands/generate.js +301 -0
- package/src/commands/init-config.js +310 -0
- package/src/commands/keycloak-options.js +182 -0
- package/src/commands/validate.js +52 -0
- package/src/config/auth-config.js +183 -0
- package/src/config/default-values.js +235 -0
- package/src/config/env-refs.js +71 -0
- package/src/config/field-preferences.js +99 -0
- package/src/config/input-sources.js +104 -0
- package/src/config/load-config.js +166 -0
- package/src/config/proxy-routes.js +44 -0
- package/src/generator/access-control-tools.js +334 -0
- package/src/generator/ai-docs.js +691 -0
- package/src/generator/application-tests.js +252 -0
- package/src/generator/auth-pack.js +965 -0
- package/src/generator/embed-config.js +431 -0
- package/src/generator/entity-layout.js +30 -0
- package/src/generator/fuse-build.js +57 -0
- package/src/generator/fuse-runtime.js +344 -0
- package/src/generator/generated-banner.js +137 -0
- package/src/generator/index.js +874 -0
- package/src/generator/project-output.js +126 -0
- package/src/generator/team-pack.js +220 -0
- package/src/index.js +68 -0
- package/src/parser/gdl-parser.js +169 -0
- package/src/parser/jdl-parser.js +171 -0
- package/src/presets/pmb-test.js +139 -0
- package/src/presets/static-source.js +73 -0
- package/src/presets/store.js +96 -0
- package/src/provision/admin-service.js +148 -0
- package/src/provision/bootstrap.js +147 -0
- package/src/provision/http.js +123 -0
- package/src/provision/keycloak-admin-rest.js +335 -0
- package/src/provision/state.js +51 -0
- package/src/provision/token.js +52 -0
- package/src/templates/angular/auth/access-control.service.ts.ejs +179 -0
- package/src/templates/angular/auth/access-ctrl.pipe.ts.ejs +20 -0
- package/src/templates/angular/auth/auth.guard.ts.ejs +27 -0
- package/src/templates/angular/auth/auth.interceptor.ts.ejs +53 -0
- package/src/templates/angular/auth/auth.service.ts.ejs +594 -0
- package/src/templates/angular/auth/auth.utils.ts.ejs +28 -0
- package/src/templates/angular/auth/current-user.ts.ejs +24 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.css.ejs +95 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.html.ejs +33 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.ts.ejs +23 -0
- package/src/templates/angular/auth/fuse-account.ts.ejs +234 -0
- package/src/templates/angular/auth/fuse-user.ts.ejs +264 -0
- package/src/templates/angular/auth/has-permission.directive.ts.ejs +51 -0
- package/src/templates/angular/auth/index.ts.ejs +24 -0
- package/src/templates/angular/auth/keycloak-admin.service.ts.ejs +670 -0
- package/src/templates/angular/auth/landing.guard.ts.ejs +61 -0
- package/src/templates/angular/auth/no-auth.guard.ts.ejs +19 -0
- package/src/templates/angular/auth/permission-attribute.util.ts.ejs +182 -0
- package/src/templates/angular/auth/sign-in.ts.ejs +60 -0
- package/src/templates/angular/entity/_entity_.model.ts.ejs +64 -0
- package/src/templates/angular/entity/_entity_.routes.ts.ejs +9 -0
- package/src/templates/angular/entity/components/forms/form/_entity_-form.component.html.ejs +168 -0
- package/src/templates/angular/entity/components/forms/form/_entity_-form.component.ts.ejs +175 -0
- package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.html.ejs +10 -0
- package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.ts.ejs +86 -0
- package/src/templates/angular/entity/components/forms/update/_entity_-form.service.ts.ejs +136 -0
- package/src/templates/angular/entity/components/interaction/actions/_entity_-actions.component.html.ejs +68 -0
- package/src/templates/angular/entity/components/interaction/actions/_entity_-actions.component.ts.ejs +69 -0
- package/src/templates/angular/entity/components/interaction/filter/_entity_-filter.component.html.ejs +111 -0
- package/src/templates/angular/entity/components/interaction/filter/_entity_-filter.component.ts.ejs +102 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.css.ejs +33 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.html.ejs +29 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.ts.ejs +93 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.css.ejs +54 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.html.ejs +58 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.ts.ejs +47 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.html.ejs +419 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.scss.ejs +48 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.ts.ejs +592 -0
- package/src/templates/angular/entity/service/_entity_.service.ts.ejs +153 -0
- package/src/templates/angular/entity/settings/_entity_.settings.ts.ejs +49 -0
- package/src/templates/angular/enums/_enum_.model.ts.ejs +11 -0
- package/src/templates/angular/iam/change-password.component.html.ejs +39 -0
- package/src/templates/angular/iam/change-password.component.ts.ejs +44 -0
- package/src/templates/angular/iam/no-access.component.ts.ejs +17 -0
- package/src/templates/angular/iam/role-list.component.html.ejs +331 -0
- package/src/templates/angular/iam/role-list.component.scss.ejs +107 -0
- package/src/templates/angular/iam/role-list.component.ts.ejs +597 -0
- package/src/templates/angular/iam/role-management/role-header.component.html.ejs +51 -0
- package/src/templates/angular/iam/role-management/role-header.component.ts.ejs +45 -0
- package/src/templates/angular/iam/role-management/role-inheritance.component.html.ejs +15 -0
- package/src/templates/angular/iam/role-management/role-inheritance.component.ts.ejs +19 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.css.ejs +24 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.html.ejs +108 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.ts.ejs +122 -0
- package/src/templates/angular/iam/role-management/role-users.component.html.ejs +104 -0
- package/src/templates/angular/iam/role-management/role-users.component.ts.ejs +53 -0
- package/src/templates/angular/iam/role-management/user-select-dialog.component.html.ejs +113 -0
- package/src/templates/angular/iam/role-management/user-select-dialog.component.ts.ejs +157 -0
- package/src/templates/angular/iam/role-permission-matrix.component.html.ejs +355 -0
- package/src/templates/angular/iam/role-permission-matrix.component.scss.ejs +217 -0
- package/src/templates/angular/iam/role-permission-matrix.component.ts.ejs +800 -0
- package/src/templates/angular/iam/screen-catalog.ts.ejs +147 -0
- package/src/templates/angular/iam/shared/confirm-dialog.component.ts.ejs +83 -0
- package/src/templates/angular/iam/shared/matrix-hierarchy.util.ts.ejs +196 -0
- package/src/templates/angular/iam/shared/permission-matrix-sound.ts.ejs +59 -0
- package/src/templates/angular/iam/shared/role-display.util.ts.ejs +43 -0
- package/src/templates/angular/iam/shared/role-permission-skeleton.component.ts.ejs +54 -0
- package/src/templates/angular/iam/shared/screen-matrix.util.ts.ejs +554 -0
- package/src/templates/angular/iam/shared/screen-navigation-map.ts.ejs +187 -0
- package/src/templates/angular/iam/shared/screen-navigation.registry.ts.ejs +64 -0
- package/src/templates/angular/iam/shared/text-highlight.pipe.ts.ejs +39 -0
- package/src/templates/angular/iam/user-access-matrix.component.html.ejs +212 -0
- package/src/templates/angular/iam/user-access-matrix.component.scss.ejs +34 -0
- package/src/templates/angular/iam/user-access-matrix.component.ts.ejs +239 -0
- package/src/templates/angular/iam/user-detail.component.html.ejs +143 -0
- package/src/templates/angular/iam/user-detail.component.ts.ejs +108 -0
- package/src/templates/angular/iam/user-form.component.html.ejs +63 -0
- package/src/templates/angular/iam/user-form.component.ts.ejs +100 -0
- package/src/templates/angular/iam/user-list.component.html.ejs +369 -0
- package/src/templates/angular/iam/user-list.component.scss.ejs +242 -0
- package/src/templates/angular/iam/user-list.component.ts.ejs +446 -0
- package/src/templates/angular/iam/user-management.routes.ts.ejs +47 -0
- package/src/templates/angular/iam/user-permission-matrix.component.html.ejs +231 -0
- package/src/templates/angular/iam/user-permission-matrix.component.scss.ejs +216 -0
- package/src/templates/angular/iam/user-permission-matrix.component.ts.ejs +516 -0
- package/src/templates/angular/shared/base/audit-user-name.pipe.ts.ejs +69 -0
- package/src/templates/angular/shared/base/base-filter.component.ts.ejs +245 -0
- package/src/templates/angular/shared/base/base-form.component.ts.ejs +109 -0
- package/src/templates/angular/shared/base/base-list.component.ts.ejs +507 -0
- package/src/templates/angular/shared/base/filter-types.ts.ejs +55 -0
- package/src/templates/angular/shared/base/input-format.directive.ts.ejs +47 -0
- package/src/templates/angular/shared/base/input-format.ts.ejs +15 -0
- package/src/templates/angular/shared/confirm-with-input-dialog.component.ts.ejs +91 -0
- package/src/templates/angular/shared/confirmation-dialog.component.ts.ejs +80 -0
- package/src/templates/angular/shared/list-styles.css.ejs +103 -0
- package/src/templates/angular/shared/loading-overlay.component.ts.ejs +24 -0
- package/src/templates/angular/shared/resizable.directive.ts.ejs +115 -0
- package/src/templates/angular/shared/snackbar-styles.css.ejs +11 -0
- package/src/templates/fuse-packs/access-control-tools/access-control-sync.js +819 -0
- package/src/templates/fuse-packs/access-control-tools/build-rename-map.js +67 -0
- package/src/templates/fuse-packs/access-control-tools/inject-qa-ids.js +14 -0
- package/src/templates/fuse-packs/access-control-tools/lib/hierarchy-scanner.js +628 -0
- package/src/templates/fuse-packs/access-control-tools/lib/hierarchy-scanner.test.js +323 -0
- package/src/templates/fuse-packs/access-control-tools/lib/html-scanner.js +362 -0
- package/src/templates/fuse-packs/access-control-tools/lib/id-rules.duplicate.test.js +136 -0
- package/src/templates/fuse-packs/access-control-tools/lib/id-rules.js +1095 -0
- package/src/templates/fuse-packs/access-control-tools/lib/ts-component-index.js +482 -0
- package/src/templates/fuse-packs/access-control-tools/output/.gitkeep +0 -0
- package/src/templates/fuse-packs/access-control-tools/run.sh +223 -0
- package/src/templates/fuse-packs/access-control-tools/scan-access-control.js +14 -0
- package/src/templates/fuse-packs/iam-assets/sound/apple-play.mp3 +0 -0
- package/src/templates/fuse-packs/iam-assets/sound/remove.mp3 +0 -0
- package/src/templates/generator/README.md +12 -0
- package/src/templates/testing/ci.cjs +45 -0
- package/src/templates/testing/mock.cjs +149 -0
- package/src/templates/testing/playwright.config.cjs +25 -0
- package/src/templates/testing/serve.cjs +22 -0
- package/src/templates/testing/smoke.spec.cjs +180 -0
- package/src/utils/branding.js +39 -0
- package/src/utils/colors.js +18 -0
- package/src/utils/diff.js +109 -0
- package/src/utils/merger.js +115 -0
- package/src/validator/backend-diagnostics.js +30 -0
- package/src/validator/blueprint-validator.js +276 -0
- package/src/validator/diagnostics.js +608 -0
- package/src/validator/pattern.js +28 -0
- package/test/auth-interceptor.js +84 -0
- package/test/auth-provision-checks.js +297 -0
- package/test/field-preferences.js +145 -0
- package/test/fixtures/field-profile.gdl +7 -0
- package/test/fixtures/mock.jdl +17 -0
- package/test/fixtures/mock.png +0 -0
- package/test/fixtures/performance/config.yml +33 -0
- package/test/fixtures/performance/large.gdl +199 -0
- package/test/fixtures/performance/small.gdl +7 -0
- package/test/fixtures/quality/custom.yml +22 -0
- package/test/fixtures/quality/go-duck.yml +22 -0
- package/test/fixtures/quality/jhipster.yml +30 -0
- package/test/fixtures/quality/representative.gdl +14 -0
- package/test/list-state.js +138 -0
- package/test/micro-functions-layout.js +95 -0
- package/test/performance-generation.js +32 -0
- package/test/pmb-preset.js +127 -0
- package/test/project-workflow.js +111 -0
- package/test/quality-features.js +250 -0
- package/test/verify-commands.js +83 -0
- package/test/verify.js +959 -0
- package/test-files/GDL/example.gdl +15 -0
- package/test-files/JDL/example.jdl +15 -0
- package/test-files/config/crudforge.config.yml +127 -0
- package/test-run.sh +272 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EnvironmentProviders,
|
|
3
|
+
inject,
|
|
4
|
+
makeEnvironmentProviders,
|
|
5
|
+
provideAppInitializer,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { MatIconRegistry } from '@angular/material/icon';
|
|
8
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
9
|
+
import { lucideIcons } from './lucide';
|
|
10
|
+
|
|
11
|
+
export const provideIcons = (): EnvironmentProviders =>
|
|
12
|
+
makeEnvironmentProviders([
|
|
13
|
+
provideAppInitializer(() => {
|
|
14
|
+
const domSanitizer = inject(DomSanitizer);
|
|
15
|
+
const matIconRegistry = inject(MatIconRegistry);
|
|
16
|
+
|
|
17
|
+
// Lucide icons
|
|
18
|
+
matIconRegistry.addSvgIconSetLiteral(
|
|
19
|
+
domSanitizer.bypassSecurityTrustHtml(lucideIcons),
|
|
20
|
+
{ viewBox: '0 0 24 24' }
|
|
21
|
+
);
|
|
22
|
+
}),
|
|
23
|
+
]);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { isPlatformServer } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
inject,
|
|
4
|
+
Injectable,
|
|
5
|
+
makeStateKey,
|
|
6
|
+
PLATFORM_ID,
|
|
7
|
+
TransferState,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
|
|
10
|
+
const STORAGE_STATE_KEY = makeStateKey<[string, string][]>('APP_STORAGE_STATE');
|
|
11
|
+
|
|
12
|
+
@Injectable({ providedIn: 'root' })
|
|
13
|
+
export class LocalStorage {
|
|
14
|
+
// Dependencies
|
|
15
|
+
private transferState = inject(TransferState);
|
|
16
|
+
|
|
17
|
+
// State
|
|
18
|
+
private isServer = isPlatformServer(inject(PLATFORM_ID));
|
|
19
|
+
private storage = new Map<string, string>();
|
|
20
|
+
|
|
21
|
+
constructor() {
|
|
22
|
+
// Initialize the localStorage with the transfer state
|
|
23
|
+
if (!this.isServer) {
|
|
24
|
+
new Map(this.transferState.get(STORAGE_STATE_KEY, [])).forEach(
|
|
25
|
+
(value, key) => {
|
|
26
|
+
localStorage.setItem(key, value);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Updates the transfer state with the given map.
|
|
34
|
+
*/
|
|
35
|
+
private updateTransferState(map: Map<string, string>) {
|
|
36
|
+
this.transferState.set(STORAGE_STATE_KEY, Array.from(map.entries()));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns the number of key/value pairs.
|
|
41
|
+
*/
|
|
42
|
+
get length(): number {
|
|
43
|
+
return this.storage.size;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Sets the value of the pair identified by key to value,
|
|
48
|
+
* creating a new key/value pair if none existed for key previously.
|
|
49
|
+
*/
|
|
50
|
+
setItem(key: string, value: string): void {
|
|
51
|
+
if (this.isServer) {
|
|
52
|
+
this.storage.set(key, value);
|
|
53
|
+
this.updateTransferState(this.storage);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
localStorage.setItem(key, value);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns the current value associated with the given key,
|
|
62
|
+
* or null if the given key does not exist in the list associated
|
|
63
|
+
* with the object.
|
|
64
|
+
*/
|
|
65
|
+
getItem(key: string): string | null {
|
|
66
|
+
if (this.isServer) {
|
|
67
|
+
return this.storage.get(key) ?? null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return localStorage.getItem(key);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Removes the key/value pair with the given key,
|
|
75
|
+
* if a key/value pair with the given key exists.
|
|
76
|
+
*/
|
|
77
|
+
removeItem(key: string): void {
|
|
78
|
+
if (this.isServer) {
|
|
79
|
+
this.storage.delete(key);
|
|
80
|
+
this.updateTransferState(this.storage);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
localStorage.removeItem(key);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Removes all key/value pairs, if there are any.
|
|
89
|
+
*/
|
|
90
|
+
clear(): void {
|
|
91
|
+
if (this.isServer) {
|
|
92
|
+
this.storage.clear();
|
|
93
|
+
this.updateTransferState(this.storage);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
localStorage.clear();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Returns the name of the nth key in the list.
|
|
101
|
+
*/
|
|
102
|
+
key(index: number): string | null {
|
|
103
|
+
if (this.isServer) {
|
|
104
|
+
return Array.from(this.storage.keys())[index] ?? null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return localStorage.key(index);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EnvironmentProviders,
|
|
3
|
+
inject,
|
|
4
|
+
makeEnvironmentProviders,
|
|
5
|
+
provideAppInitializer,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { LocalStorage } from './local-storage';
|
|
8
|
+
|
|
9
|
+
export const provideLocalStorage = (): EnvironmentProviders =>
|
|
10
|
+
makeEnvironmentProviders([
|
|
11
|
+
// Initialize the LocalStorage
|
|
12
|
+
provideAppInitializer(() => {
|
|
13
|
+
inject(LocalStorage);
|
|
14
|
+
}),
|
|
15
|
+
]);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { MediaMatcher } from '@angular/cdk/layout';
|
|
2
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
3
|
+
import {
|
|
4
|
+
DestroyRef,
|
|
5
|
+
inject,
|
|
6
|
+
Injectable,
|
|
7
|
+
PLATFORM_ID,
|
|
8
|
+
signal,
|
|
9
|
+
Signal,
|
|
10
|
+
WritableSignal,
|
|
11
|
+
} from '@angular/core';
|
|
12
|
+
|
|
13
|
+
type MediaQueryObserver = {
|
|
14
|
+
matches: WritableSignal<boolean>;
|
|
15
|
+
handler: (event: MediaQueryListEvent) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
@Injectable({ providedIn: 'root' })
|
|
19
|
+
export class Media {
|
|
20
|
+
// Dependencies
|
|
21
|
+
private destroyRef = inject(DestroyRef);
|
|
22
|
+
private isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
23
|
+
private mediaMatcher = inject(MediaMatcher);
|
|
24
|
+
|
|
25
|
+
// State
|
|
26
|
+
private matchers = new Map<string, MediaQueryObserver>();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new media query observer signal for the given query.
|
|
30
|
+
*/
|
|
31
|
+
match(query: string): Signal<boolean> {
|
|
32
|
+
const existingMatcher = this.matchers.get(query);
|
|
33
|
+
if (existingMatcher) {
|
|
34
|
+
return existingMatcher.matches.asReadonly();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Create MediaQueryList for the query
|
|
38
|
+
const mql = this.mediaMatcher.matchMedia(query);
|
|
39
|
+
|
|
40
|
+
// Create new signal with initial matches value of the mql
|
|
41
|
+
const matches = signal(mql.matches);
|
|
42
|
+
|
|
43
|
+
// Create handler
|
|
44
|
+
const handler = (event: MediaQueryListEvent) => {
|
|
45
|
+
matches.set(event.matches);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Add listener and destroy handler
|
|
49
|
+
if (this.isBrowser) {
|
|
50
|
+
mql.addEventListener('change', handler);
|
|
51
|
+
this.destroyRef.onDestroy(() => {
|
|
52
|
+
mql.removeEventListener('change', handler);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Store the observer
|
|
57
|
+
this.matchers.set(query, {
|
|
58
|
+
matches,
|
|
59
|
+
handler,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return matches.asReadonly();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EnvironmentProviders,
|
|
3
|
+
inject,
|
|
4
|
+
makeEnvironmentProviders,
|
|
5
|
+
provideAppInitializer,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { Media } from './media';
|
|
8
|
+
|
|
9
|
+
export const provideMedia = (): EnvironmentProviders =>
|
|
10
|
+
makeEnvironmentProviders([
|
|
11
|
+
// Initialize the Media
|
|
12
|
+
provideAppInitializer(() => {
|
|
13
|
+
inject(Media);
|
|
14
|
+
}),
|
|
15
|
+
]);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TonalPalette } from '@/app/core/theming/palette';
|
|
2
|
+
|
|
3
|
+
export type Scheme = 'light' | 'dark' | 'system';
|
|
4
|
+
export type Colors = {
|
|
5
|
+
primary: string;
|
|
6
|
+
error: string;
|
|
7
|
+
};
|
|
8
|
+
export type ThemeConfig = Colors & Record<'scheme', Scheme>;
|
|
9
|
+
|
|
10
|
+
export type Theme = {
|
|
11
|
+
primary: TonalPalette;
|
|
12
|
+
error: TonalPalette;
|
|
13
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import chroma from 'chroma-js';
|
|
2
|
+
import { Hsluv } from 'hsluv';
|
|
3
|
+
|
|
4
|
+
type PaletteConfig = {
|
|
5
|
+
color: string;
|
|
6
|
+
hue?: number;
|
|
7
|
+
hues?: number[];
|
|
8
|
+
colorMode?: 'linear' | 'perceived';
|
|
9
|
+
h?: number;
|
|
10
|
+
s?: number;
|
|
11
|
+
lMin?: number;
|
|
12
|
+
lMax?: number;
|
|
13
|
+
mode?: 'hex' | 'p-3' | 'oklch' | 'hsl';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type Color = {
|
|
17
|
+
hue: number;
|
|
18
|
+
hex: string;
|
|
19
|
+
oklch: string;
|
|
20
|
+
h: number;
|
|
21
|
+
hScale: number;
|
|
22
|
+
s: number;
|
|
23
|
+
sScale: number;
|
|
24
|
+
l: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export class TonalPalette {
|
|
28
|
+
private readonly palette: Color[];
|
|
29
|
+
|
|
30
|
+
constructor(config: PaletteConfig) {
|
|
31
|
+
this.palette = this.generatePalette(config);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Chroma-js based implementation for stable palette generation.
|
|
36
|
+
* Uses HSLuv for perceived mode and direct HSL manipulation for linear mode.
|
|
37
|
+
* https://github.com/SimeonGriggs/tints.dev.
|
|
38
|
+
*/
|
|
39
|
+
private generatePalette(config: PaletteConfig): Color[] {
|
|
40
|
+
const { color } = config;
|
|
41
|
+
|
|
42
|
+
// Tweaks may be passed in, otherwise use defaults
|
|
43
|
+
const colorHue = config.hue ?? 600;
|
|
44
|
+
const hues = config.hues ?? [
|
|
45
|
+
0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950, 1000,
|
|
46
|
+
];
|
|
47
|
+
const colorMode = config.colorMode ?? 'perceived';
|
|
48
|
+
const h = config.h ?? 0;
|
|
49
|
+
const s = config.s ?? 0;
|
|
50
|
+
const lMin = config.lMin ?? 0;
|
|
51
|
+
const lMax = config.lMax ?? 100;
|
|
52
|
+
|
|
53
|
+
// Create base color from input
|
|
54
|
+
const baseColor = chroma(`${color}`);
|
|
55
|
+
const [baseH, baseS, baseL] = baseColor.hsl();
|
|
56
|
+
|
|
57
|
+
// Handle grayscale colors (NaN hue) by setting a default hue
|
|
58
|
+
const normalizedBaseH = isNaN(baseH) ? 0 : baseH;
|
|
59
|
+
|
|
60
|
+
// 1. Create hue scale
|
|
61
|
+
const colorHueIndex = hues.indexOf(colorHue);
|
|
62
|
+
if (colorHueIndex === -1) {
|
|
63
|
+
throw new Error(`Invalid color hue: ${colorHue}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const hueScale = hues.map((hue) => {
|
|
67
|
+
const diff = Math.abs(hues.indexOf(hue) - colorHueIndex);
|
|
68
|
+
const tweakValue = h ? diff * h : 0;
|
|
69
|
+
return { hue, tweak: tweakValue };
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// 2. Create saturation scale
|
|
73
|
+
const saturationScale = hues.map((hue) => {
|
|
74
|
+
const diff = Math.abs(hues.indexOf(hue) - colorHueIndex);
|
|
75
|
+
const tweakValue = s ? Math.round((diff + 1) * s * (1 + diff / 10)) : 0;
|
|
76
|
+
return { hue, tweak: Math.min(tweakValue, 100) };
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// 3. Create lightness distribution
|
|
80
|
+
const hsluv = new Hsluv();
|
|
81
|
+
hsluv.hex = `${color}`;
|
|
82
|
+
hsluv.hexToHsluv();
|
|
83
|
+
|
|
84
|
+
const lightnessValue = colorMode === 'linear' ? baseL * 100 : hsluv.hsluv_l;
|
|
85
|
+
|
|
86
|
+
// Create the three anchor points
|
|
87
|
+
const distributionAnchors = [
|
|
88
|
+
{ hue: 0, tweak: lMax },
|
|
89
|
+
{ hue: colorHue, tweak: lightnessValue },
|
|
90
|
+
{ hue: 1000, tweak: lMin },
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
// Interpolate for missing hues
|
|
94
|
+
const distributionScale = hues.map((hue) => {
|
|
95
|
+
// If it's an anchor point, use the anchor value
|
|
96
|
+
const anchor = distributionAnchors.find((a) => a.hue === hue);
|
|
97
|
+
if (anchor) {
|
|
98
|
+
return anchor;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Otherwise interpolate between anchor points
|
|
102
|
+
let leftAnchor, rightAnchor;
|
|
103
|
+
|
|
104
|
+
if (hue < colorHue) {
|
|
105
|
+
leftAnchor = distributionAnchors[0]; // 0
|
|
106
|
+
rightAnchor = distributionAnchors[1]; // hue
|
|
107
|
+
} else {
|
|
108
|
+
leftAnchor = distributionAnchors[1]; // hue
|
|
109
|
+
rightAnchor = distributionAnchors[2]; // 1000
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Linear interpolation
|
|
113
|
+
const range = rightAnchor.hue - leftAnchor.hue;
|
|
114
|
+
const position = hue - leftAnchor.hue;
|
|
115
|
+
const ratio = position / range;
|
|
116
|
+
const tweak =
|
|
117
|
+
leftAnchor.tweak + (rightAnchor.tweak - leftAnchor.tweak) * ratio;
|
|
118
|
+
|
|
119
|
+
return { hue, tweak: Math.round(tweak) };
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return hues.map((hue, hueIndex) => {
|
|
123
|
+
if (hue === colorHue) {
|
|
124
|
+
// Preserve exact input color
|
|
125
|
+
const inputColor = chroma(`${color.toUpperCase()}`);
|
|
126
|
+
const [finalH, finalS, finalL] = inputColor.hsl();
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
hue: hue,
|
|
130
|
+
hex: `${color.toUpperCase()}`,
|
|
131
|
+
oklch: inputColor.css('oklch'),
|
|
132
|
+
h: isNaN(finalH) ? 0 : finalH,
|
|
133
|
+
hScale: 0,
|
|
134
|
+
s: isNaN(finalS) ? 0 : finalS * 100,
|
|
135
|
+
sScale: (isNaN(finalS) ? 0 : finalS * 100) - 50,
|
|
136
|
+
l: isNaN(finalL) ? 0 : finalL * 100,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Get tweaks for this hue
|
|
141
|
+
const hTweak = hueScale[hueIndex].tweak;
|
|
142
|
+
const sTweak = saturationScale[hueIndex].tweak;
|
|
143
|
+
const lTweak = distributionScale[hueIndex].tweak;
|
|
144
|
+
|
|
145
|
+
let newColor: chroma.Color;
|
|
146
|
+
|
|
147
|
+
if (colorMode === 'linear') {
|
|
148
|
+
// Direct HSL manipulation for linear mode
|
|
149
|
+
const newH = (normalizedBaseH + hTweak) % 360;
|
|
150
|
+
const newS = Math.max(0, Math.min(100, baseS * 100 + sTweak));
|
|
151
|
+
const newL = Math.max(0, Math.min(100, lTweak));
|
|
152
|
+
|
|
153
|
+
newColor = chroma.hsl(newH, newS / 100, newL / 100);
|
|
154
|
+
} else {
|
|
155
|
+
// HSLuv for perceived mode
|
|
156
|
+
const hsluv = new Hsluv();
|
|
157
|
+
hsluv.hex = `${color}`;
|
|
158
|
+
hsluv.hexToHsluv();
|
|
159
|
+
|
|
160
|
+
// Handle grayscale colors in HSLuv (NaN hue)
|
|
161
|
+
const normalizedHsluvH = isNaN(hsluv.hsluv_h) ? 0 : hsluv.hsluv_h;
|
|
162
|
+
const newHsluvH = (normalizedHsluvH + hTweak) % 360;
|
|
163
|
+
const newHsluvS = Math.max(0, Math.min(100, hsluv.hsluv_s + sTweak));
|
|
164
|
+
const newHsluvL = Math.max(0, Math.min(100, lTweak));
|
|
165
|
+
|
|
166
|
+
hsluv.hsluv_h = newHsluvH;
|
|
167
|
+
hsluv.hsluv_s = newHsluvS;
|
|
168
|
+
hsluv.hsluv_l = newHsluvL;
|
|
169
|
+
hsluv.hsluvToHex();
|
|
170
|
+
|
|
171
|
+
newColor = chroma(hsluv.hex);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const [finalH, finalS, finalL] = newColor.hsl();
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
hue: hue,
|
|
178
|
+
hex: newColor.hex().toUpperCase(),
|
|
179
|
+
oklch: newColor.css('oklch'),
|
|
180
|
+
h: isNaN(finalH) ? 0 : finalH,
|
|
181
|
+
hScale: ((((hTweak + 180) % 360) - 180) / 180) * 50,
|
|
182
|
+
s: isNaN(finalS) ? 0 : finalS * 100,
|
|
183
|
+
sScale: (isNaN(finalS) ? 0 : finalS * 100) - 50,
|
|
184
|
+
l: isNaN(finalL) ? 0 : finalL * 100,
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Get all colors in the palette.
|
|
191
|
+
*/
|
|
192
|
+
colors(): Color[] {
|
|
193
|
+
return this.palette;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get a specific color by its hue.
|
|
198
|
+
* @param value
|
|
199
|
+
* @param format
|
|
200
|
+
*/
|
|
201
|
+
hue(value: number, format: 'hex' | 'oklch' = 'oklch'): string | null {
|
|
202
|
+
const color = this.palette.find((c) => c.hue === value);
|
|
203
|
+
if (!color) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return format === 'hex' ? color.hex : color.oklch;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EnvironmentProviders,
|
|
3
|
+
inject,
|
|
4
|
+
InjectionToken,
|
|
5
|
+
makeEnvironmentProviders,
|
|
6
|
+
provideAppInitializer,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import { ThemeConfig } from './models/theming';
|
|
9
|
+
import { Theming } from './theming';
|
|
10
|
+
|
|
11
|
+
export const THEME_CONFIG = new InjectionToken<ThemeConfig>('THEME_CONFIG');
|
|
12
|
+
|
|
13
|
+
export const provideTheming = (config: ThemeConfig): EnvironmentProviders =>
|
|
14
|
+
makeEnvironmentProviders([
|
|
15
|
+
{
|
|
16
|
+
provide: THEME_CONFIG,
|
|
17
|
+
useValue: config,
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
// Initialize the Theming
|
|
21
|
+
provideAppInitializer(() => {
|
|
22
|
+
inject(Theming);
|
|
23
|
+
}),
|
|
24
|
+
]);
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { DOCUMENT, isPlatformServer } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
effect,
|
|
5
|
+
inject,
|
|
6
|
+
Injectable,
|
|
7
|
+
PLATFORM_ID,
|
|
8
|
+
signal,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import { LocalStorage } from '@/app/core/local-storage/local-storage';
|
|
11
|
+
import { Media } from '@/app/core/media/media';
|
|
12
|
+
import { TonalPalette } from '@/app/core/theming/palette';
|
|
13
|
+
import { Scheme, Colors, Theme } from './models/theming';
|
|
14
|
+
import { THEME_CONFIG } from './provider';
|
|
15
|
+
|
|
16
|
+
@Injectable({ providedIn: 'root' })
|
|
17
|
+
export class Theming {
|
|
18
|
+
// Dependencies
|
|
19
|
+
private document = inject(DOCUMENT);
|
|
20
|
+
private isServer = isPlatformServer(inject(PLATFORM_ID));
|
|
21
|
+
private localStorage = inject(LocalStorage);
|
|
22
|
+
private media = inject(Media);
|
|
23
|
+
private themeConfig = inject(THEME_CONFIG);
|
|
24
|
+
|
|
25
|
+
// State
|
|
26
|
+
private prefersDarkMode = this.media.match('(prefers-color-scheme: dark)');
|
|
27
|
+
|
|
28
|
+
colors = signal<Colors>({
|
|
29
|
+
primary: this.themeConfig.primary,
|
|
30
|
+
error: this.themeConfig.error,
|
|
31
|
+
});
|
|
32
|
+
scheme = signal<Scheme>(
|
|
33
|
+
(this.localStorage.getItem('scheme') as Scheme) || this.themeConfig.scheme
|
|
34
|
+
);
|
|
35
|
+
theme = computed<Theme>(() => this.generateTheme(this.colors()));
|
|
36
|
+
|
|
37
|
+
isDark = computed(
|
|
38
|
+
() =>
|
|
39
|
+
this.scheme() === 'dark' ||
|
|
40
|
+
(this.scheme() === 'system' && this.prefersDarkMode)
|
|
41
|
+
);
|
|
42
|
+
isLight = computed(() => !this.isDark());
|
|
43
|
+
|
|
44
|
+
// DOM
|
|
45
|
+
private rootEl = this.document.documentElement;
|
|
46
|
+
private themeStyleEl = this.document.createElement('style');
|
|
47
|
+
|
|
48
|
+
constructor() {
|
|
49
|
+
// Append the themeStyleEl to the DOM
|
|
50
|
+
this.document.head.appendChild(this.themeStyleEl);
|
|
51
|
+
this.themeStyleEl.classList.add('theme-colors');
|
|
52
|
+
|
|
53
|
+
// Update scheme
|
|
54
|
+
effect(() => {
|
|
55
|
+
// Skip the server. Otherwise, the scheme will always be 'system' and
|
|
56
|
+
// the class will always be 'scheme-dark'.
|
|
57
|
+
if (this.isServer) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const scheme = this.scheme();
|
|
62
|
+
const prefersDarkMode = this.prefersDarkMode();
|
|
63
|
+
|
|
64
|
+
// Figure out if the scheme is 'dark'
|
|
65
|
+
const isDark =
|
|
66
|
+
scheme === 'dark' || (scheme === 'system' && prefersDarkMode);
|
|
67
|
+
|
|
68
|
+
// Add the 'dark' or 'light' class to the html element
|
|
69
|
+
this.rootEl.classList.toggle('scheme-dark', isDark);
|
|
70
|
+
this.rootEl.classList.toggle('scheme-light', !isDark);
|
|
71
|
+
|
|
72
|
+
// Store the scheme in local storage
|
|
73
|
+
this.localStorage.setItem('scheme', scheme);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Generate the theme for the first time
|
|
77
|
+
this.generateTheme(this.themeConfig);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Generates a theme using the provided theming configuration and
|
|
82
|
+
* applies it to the DOM by injecting CSS variables into a
|
|
83
|
+
* style element.
|
|
84
|
+
*/
|
|
85
|
+
private generateTheme(config: Colors): {
|
|
86
|
+
primary: TonalPalette;
|
|
87
|
+
error: TonalPalette;
|
|
88
|
+
} {
|
|
89
|
+
const primary = new TonalPalette({
|
|
90
|
+
color: config.primary,
|
|
91
|
+
});
|
|
92
|
+
const error = new TonalPalette({
|
|
93
|
+
color: config.error,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
this.themeStyleEl.textContent = `:root {
|
|
97
|
+
/* Primary */
|
|
98
|
+
--theme-color-primary-50: ${primary.hue(50)};
|
|
99
|
+
--theme-color-primary-100: ${primary.hue(100)};
|
|
100
|
+
--theme-color-primary-200: ${primary.hue(200)};
|
|
101
|
+
--theme-color-primary-300: ${primary.hue(300)};
|
|
102
|
+
--theme-color-primary-400: ${primary.hue(400)};
|
|
103
|
+
--theme-color-primary-500: ${primary.hue(500)};
|
|
104
|
+
--theme-color-primary-600: ${primary.hue(600)};
|
|
105
|
+
--theme-color-primary-700: ${primary.hue(700)};
|
|
106
|
+
--theme-color-primary-800: ${primary.hue(800)};
|
|
107
|
+
--theme-color-primary-900: ${primary.hue(900)};
|
|
108
|
+
--theme-color-primary-950: ${primary.hue(950)};
|
|
109
|
+
|
|
110
|
+
/* Error */
|
|
111
|
+
--theme-color-error-50: ${error.hue(50)};
|
|
112
|
+
--theme-color-error-100: ${error.hue(100)};
|
|
113
|
+
--theme-color-error-200: ${error.hue(200)};
|
|
114
|
+
--theme-color-error-300: ${error.hue(300)};
|
|
115
|
+
--theme-color-error-400: ${error.hue(400)};
|
|
116
|
+
--theme-color-error-500: ${error.hue(500)};
|
|
117
|
+
--theme-color-error-600: ${error.hue(600)};
|
|
118
|
+
--theme-color-error-700: ${error.hue(700)};
|
|
119
|
+
--theme-color-error-800: ${error.hue(800)};
|
|
120
|
+
--theme-color-error-900: ${error.hue(900)};
|
|
121
|
+
--theme-color-error-950: ${error.hue(950)};
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
primary,
|
|
126
|
+
error,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { inject, Injectable } from '@angular/core';
|
|
2
|
+
import { Translation, TranslocoLoader } from '@jsverse/transloco';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
|
|
5
|
+
@Injectable({ providedIn: 'root' })
|
|
6
|
+
export class TranslocoHttpLoader implements TranslocoLoader {
|
|
7
|
+
private http = inject(HttpClient);
|
|
8
|
+
|
|
9
|
+
getTranslation(lang: string) {
|
|
10
|
+
return this.http.get<Translation>(`/i18n/${lang}.json`);
|
|
11
|
+
}
|
|
12
|
+
}
|