create-react-admin-template 0.0.0-stage → 0.1.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/README.md +46 -2
- package/bin/create.mjs +5 -0
- package/package.json +22 -4
- package/template/.dockerignore +12 -0
- package/template/.editorconfig +12 -0
- package/template/.env +14 -0
- package/template/.env.development +5 -0
- package/template/.env.production +2 -0
- package/template/.env.test +5 -0
- package/template/.github/workflows/ci.yml +40 -0
- package/template/.gitlab-ci.yml +208 -0
- package/template/.husky/commit-msg +1 -0
- package/template/.husky/pre-commit +1 -0
- package/template/.nvmrc +1 -0
- package/template/.prettierignore +11 -0
- package/template/.prettierrc +47 -0
- package/template/Dockerfile +16 -0
- package/template/README.md +372 -0
- package/template/build/advancedTable.ts +103 -0
- package/template/build/environment.ts +150 -0
- package/template/commitlint.config.js +32 -0
- package/template/components.json +21 -0
- package/template/deploy/README.md +132 -0
- package/template/deploy/host-nginx/react-admin-api.conf +14 -0
- package/template/deploy/host-nginx/react-admin-web.conf +8 -0
- package/template/deploy/nginx.conf +38 -0
- package/template/docs/activity-status.md +217 -0
- package/template/docs/audit-logs.md +158 -0
- package/template/docs/authentication-adapters.md +219 -0
- package/template/docs/browser-security.md +58 -0
- package/template/docs/bundle-budgets.md +65 -0
- package/template/docs/component-source-governance.md +99 -0
- package/template/docs/data-masking.md +169 -0
- package/template/docs/enterprise-scaffold.md +208 -0
- package/template/docs/feature-data-template.md +227 -0
- package/template/docs/feature-flags.md +169 -0
- package/template/docs/file-capabilities.md +196 -0
- package/template/docs/locale-and-i18n.md +132 -0
- package/template/docs/mutation-idempotency.md +24 -0
- package/template/docs/optional-editors.md +203 -0
- package/template/docs/page-feedback.md +83 -0
- package/template/docs/query-data-conventions.md +178 -0
- package/template/docs/realtime-collaboration.md +140 -0
- package/template/docs/reporting-printing-templates.md +156 -0
- package/template/docs/scaffold-capability-roadmap.md +226 -0
- package/template/docs/scaffold-guide.md +443 -0
- package/template/docs/template-changelog.md +30 -0
- package/template/docs/template-versioning.md +26 -0
- package/template/docs/tenant-workspace-context.md +147 -0
- package/template/docs/unsaved-changes.md +58 -0
- package/template/docs/white-label.md +102 -0
- package/template/eslint.config.js +697 -0
- package/template/gitignore +39 -0
- package/template/index.html +26 -0
- package/template/knip.config.ts +42 -0
- package/template/lint-staged.config.js +8 -0
- package/template/package.json +133 -0
- package/template/pnpm-lock.yaml +8694 -0
- package/template/public/favicon.ico +0 -0
- package/template/public/logo.svg +1 -0
- package/template/public/runtime-config.json +49 -0
- package/template/scaffold.template.json +5 -0
- package/template/src/Application.tsx +114 -0
- package/template/src/api/ApiError.ts +33 -0
- package/template/src/api/activity/ActivityProvider.tsx +167 -0
- package/template/src/api/activity/access.ts +13 -0
- package/template/src/api/activity/errors.ts +17 -0
- package/template/src/api/activity/index.ts +67 -0
- package/template/src/api/activity/model.ts +227 -0
- package/template/src/api/activity/query.ts +163 -0
- package/template/src/api/activity/source.ts +16 -0
- package/template/src/api/activity/subscription.ts +292 -0
- package/template/src/api/activity/transports.ts +271 -0
- package/template/src/api/activity/types.ts +402 -0
- package/template/src/api/authClient.ts +134 -0
- package/template/src/api/authSession.ts +307 -0
- package/template/src/api/clients/configureApiClient.ts +62 -0
- package/template/src/api/clients/httpStatus.ts +4 -0
- package/template/src/api/config/services.json +7 -0
- package/template/src/api/demoAuthClient.ts +46 -0
- package/template/src/api/enums/EnumCatalogProvider.tsx +169 -0
- package/template/src/api/enums/EnumDictionary.ts +55 -0
- package/template/src/api/enums/access.ts +130 -0
- package/template/src/api/enums/catalog.ts +216 -0
- package/template/src/api/enums/errors.ts +21 -0
- package/template/src/api/enums/index.ts +48 -0
- package/template/src/api/enums/query.ts +82 -0
- package/template/src/api/enums/scope.ts +58 -0
- package/template/src/api/enums/types.ts +251 -0
- package/template/src/api/hooks/error.ts +198 -0
- package/template/src/api/hooks/index.ts +4 -0
- package/template/src/api/hooks/request.ts +99 -0
- package/template/src/api/hooks/requestId.ts +65 -0
- package/template/src/api/hooks/response.ts +22 -0
- package/template/src/api/hooks/types.ts +20 -0
- package/template/src/api/idempotency/index.ts +1 -0
- package/template/src/api/idempotency/key.ts +23 -0
- package/template/src/api/index.ts +14 -0
- package/template/src/api/metadata/MetadataProvider.tsx +37 -0
- package/template/src/api/metadata/index.ts +2 -0
- package/template/src/api/metadata/types.ts +30 -0
- package/template/src/api/parameters/GlobalParameterProvider.tsx +210 -0
- package/template/src/api/parameters/access.ts +117 -0
- package/template/src/api/parameters/catalog.ts +170 -0
- package/template/src/api/parameters/errors.ts +21 -0
- package/template/src/api/parameters/index.ts +53 -0
- package/template/src/api/parameters/query.ts +84 -0
- package/template/src/api/parameters/scope.ts +58 -0
- package/template/src/api/parameters/types.ts +214 -0
- package/template/src/api/query/index.ts +13 -0
- package/template/src/api/query/keys.ts +155 -0
- package/template/src/api/query/mutation.ts +48 -0
- package/template/src/api/query/react.ts +36 -0
- package/template/src/api/query/scope.ts +38 -0
- package/template/src/api/query/types.ts +147 -0
- package/template/src/api/types.ts +144 -0
- package/template/src/application/types.ts +52 -0
- package/template/src/auditLogs/errors.ts +17 -0
- package/template/src/auditLogs/export.ts +85 -0
- package/template/src/auditLogs/index.ts +54 -0
- package/template/src/auditLogs/model.ts +526 -0
- package/template/src/auditLogs/query.ts +113 -0
- package/template/src/auditLogs/react.ts +36 -0
- package/template/src/auditLogs/source.ts +51 -0
- package/template/src/auditLogs/types.ts +357 -0
- package/template/src/authentication/controller.ts +351 -0
- package/template/src/authentication/index.ts +8 -0
- package/template/src/authentication/redirect.ts +72 -0
- package/template/src/authentication/types.ts +300 -0
- package/template/src/bootstrap.tsx +96 -0
- package/template/src/components/AppDataTable/AppDataTable.tsx +74 -0
- package/template/src/components/AppDataTable/index.ts +2 -0
- package/template/src/components/AppDataTable/types.ts +27 -0
- package/template/src/components/AppDialog/AppConfirmDialog.tsx +44 -0
- package/template/src/components/AppDialog/AppDialog.tsx +113 -0
- package/template/src/components/AppDialog/index.ts +3 -0
- package/template/src/components/AppDialog/messages.tsx +22 -0
- package/template/src/components/AppDialog/types.ts +53 -0
- package/template/src/components/AppPageForm/AppPageForm.tsx +21 -0
- package/template/src/components/AppPageForm/PageForm.tsx +765 -0
- package/template/src/components/AppPageForm/SOURCE.md +26 -0
- package/template/src/components/AppPageForm/config.ts +253 -0
- package/template/src/components/AppPageForm/controller.ts +580 -0
- package/template/src/components/AppPageForm/index.ts +2 -0
- package/template/src/components/AppPageForm/messages.ts +90 -0
- package/template/src/components/AppPageForm/optionUtils.ts +91 -0
- package/template/src/components/AppPageForm/options.ts +397 -0
- package/template/src/components/AppPageForm/query.ts +44 -0
- package/template/src/components/AppPageForm/style.css +119 -0
- package/template/src/components/AppPageForm/types.ts +632 -0
- package/template/src/components/AppPageForm/validation.ts +233 -0
- package/template/src/components/AppTable/AppTable.tsx +26 -0
- package/template/src/components/AppTable/SOURCE.md +72 -0
- package/template/src/components/AppTable/cell/customCell/TableCellLayer.tsx +73 -0
- package/template/src/components/AppTable/cell/customCell/actions/ActionDropdownCell.tsx +104 -0
- package/template/src/components/AppTable/cell/customCell/cellLayer.ts +358 -0
- package/template/src/components/AppTable/cell/customCell/componentProps.ts +30 -0
- package/template/src/components/AppTable/cell/customCell/date/TemporalPickerEditor.tsx +54 -0
- package/template/src/components/AppTable/cell/customCell/index.ts +2 -0
- package/template/src/components/AppTable/cell/customCell/select/SelectCellEditor.tsx +225 -0
- package/template/src/components/AppTable/cell/customCell/tableCellLayer.css +20 -0
- package/template/src/components/AppTable/cell/customCell/tooltip/TooltipCell.tsx +45 -0
- package/template/src/components/AppTable/cell/customCell/types.ts +63 -0
- package/template/src/components/AppTable/cell/customCell/useCellLayerLifecycle.ts +111 -0
- package/template/src/components/AppTable/cell/frameworkCell/TableCellComponentLayer.tsx +40 -0
- package/template/src/components/AppTable/cell/frameworkCell/cellComponentSession.ts +203 -0
- package/template/src/components/AppTable/cell/frameworkCell/index.ts +3 -0
- package/template/src/components/AppTable/cell/index.ts +2 -0
- package/template/src/components/AppTable/columns/TableColumnEditor.tsx +257 -0
- package/template/src/components/AppTable/columns/index.ts +1 -0
- package/template/src/components/AppTable/columns/useTableColumnPreferenceActions.ts +85 -0
- package/template/src/components/AppTable/config/defaults.ts +46 -0
- package/template/src/components/AppTable/config/index.ts +2 -0
- package/template/src/components/AppTable/config/license.ts +39 -0
- package/template/src/components/AppTable/config/resolver.ts +25 -0
- package/template/src/components/AppTable/config/types.ts +377 -0
- package/template/src/components/AppTable/engine/bottom/index.ts +1 -0
- package/template/src/components/AppTable/engine/bottom/types.ts +14 -0
- package/template/src/components/AppTable/engine/cell/constants.ts +32 -0
- package/template/src/components/AppTable/engine/cell/customCell/actions/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/actions/renderer.ts +162 -0
- package/template/src/components/AppTable/engine/cell/customCell/date/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/date/renderer.ts +116 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/editorBounds.ts +57 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/editorTrigger.ts +46 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/index.ts +3 -0
- package/template/src/components/AppTable/engine/cell/customCell/editors/layerEditor.ts +244 -0
- package/template/src/components/AppTable/engine/cell/customCell/index.ts +7 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/columnRenderer.ts +245 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/confirmInput.ts +57 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/display.ts +78 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/index.ts +3 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/itemList.ts +60 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/links.ts +131 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/selection.ts +41 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/shared.ts +71 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/step.ts +37 -0
- package/template/src/components/AppTable/engine/cell/customCell/renderers/switch.ts +45 -0
- package/template/src/components/AppTable/engine/cell/customCell/select/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/select/renderer.ts +33 -0
- package/template/src/components/AppTable/engine/cell/customCell/tooltip/index.ts +1 -0
- package/template/src/components/AppTable/engine/cell/customCell/tooltip/tooltip.ts +94 -0
- package/template/src/components/AppTable/engine/cell/customCell/types.ts +82 -0
- package/template/src/components/AppTable/engine/cell/formatting.ts +355 -0
- package/template/src/components/AppTable/engine/cell/formula.ts +145 -0
- package/template/src/components/AppTable/engine/cell/index.ts +7 -0
- package/template/src/components/AppTable/engine/cell/multiSelect.ts +96 -0
- package/template/src/components/AppTable/engine/cell/options.ts +339 -0
- package/template/src/components/AppTable/engine/cell/types.ts +53 -0
- package/template/src/components/AppTable/engine/columns/column.ts +430 -0
- package/template/src/components/AppTable/engine/columns/config/columns.ts +33 -0
- package/template/src/components/AppTable/engine/columns/config/index.ts +4 -0
- package/template/src/components/AppTable/engine/columns/config/mutation.ts +138 -0
- package/template/src/components/AppTable/engine/columns/config/temporal.ts +11 -0
- package/template/src/components/AppTable/engine/columns/config/validation.ts +106 -0
- package/template/src/components/AppTable/engine/columns/constants.ts +6 -0
- package/template/src/components/AppTable/engine/columns/gridColumns.ts +332 -0
- package/template/src/components/AppTable/engine/columns/index.ts +4 -0
- package/template/src/components/AppTable/engine/columns/rendererPolicies.ts +129 -0
- package/template/src/components/AppTable/engine/component/resolver.ts +272 -0
- package/template/src/components/AppTable/engine/component/types.ts +384 -0
- package/template/src/components/AppTable/engine/config/constants.ts +33 -0
- package/template/src/components/AppTable/engine/config/grid/compiler.ts +65 -0
- package/template/src/components/AppTable/engine/config/grid/defaults.ts +82 -0
- package/template/src/components/AppTable/engine/config/grid/ownership.ts +35 -0
- package/template/src/components/AppTable/engine/config/grid/runtimeDelta.ts +34 -0
- package/template/src/components/AppTable/engine/config/grid/types.ts +30 -0
- package/template/src/components/AppTable/engine/pagination/config.ts +75 -0
- package/template/src/components/AppTable/engine/pagination/constants.ts +5 -0
- package/template/src/components/AppTable/engine/pagination/index.ts +3 -0
- package/template/src/components/AppTable/engine/pagination/types.ts +70 -0
- package/template/src/components/AppTable/engine/preference/index.ts +2 -0
- package/template/src/components/AppTable/engine/preference/preference.ts +535 -0
- package/template/src/components/AppTable/engine/preference/types.ts +28 -0
- package/template/src/components/AppTable/engine/right/index.ts +1 -0
- package/template/src/components/AppTable/engine/right/types.ts +18 -0
- package/template/src/components/AppTable/engine/search/config.ts +64 -0
- package/template/src/components/AppTable/engine/search/constants.ts +8 -0
- package/template/src/components/AppTable/engine/search/index.ts +7 -0
- package/template/src/components/AppTable/engine/search/localQuery.ts +145 -0
- package/template/src/components/AppTable/engine/search/query.ts +203 -0
- package/template/src/components/AppTable/engine/search/remoteQuery.ts +99 -0
- package/template/src/components/AppTable/engine/search/searchInteraction.ts +46 -0
- package/template/src/components/AppTable/engine/search/types.ts +155 -0
- package/template/src/components/AppTable/engine/selection/config.ts +13 -0
- package/template/src/components/AppTable/engine/selection/index.ts +4 -0
- package/template/src/components/AppTable/engine/selection/selection.ts +357 -0
- package/template/src/components/AppTable/engine/selection/selectionHeader.ts +88 -0
- package/template/src/components/AppTable/engine/selection/types.ts +66 -0
- package/template/src/components/AppTable/engine/shared/action.ts +11 -0
- package/template/src/components/AppTable/engine/shared/constants.ts +2 -0
- package/template/src/components/AppTable/engine/shared/decimal.ts +114 -0
- package/template/src/components/AppTable/engine/shared/feedback.ts +62 -0
- package/template/src/components/AppTable/engine/shared/index.ts +13 -0
- package/template/src/components/AppTable/engine/shared/interaction.ts +55 -0
- package/template/src/components/AppTable/engine/shared/messages.ts +161 -0
- package/template/src/components/AppTable/engine/shared/row.ts +32 -0
- package/template/src/components/AppTable/engine/shared/scheduler.ts +17 -0
- package/template/src/components/AppTable/engine/shared/tableKey.ts +31 -0
- package/template/src/components/AppTable/engine/shared/theme.ts +196 -0
- package/template/src/components/AppTable/engine/shared/treeRows.ts +155 -0
- package/template/src/components/AppTable/engine/shared/types.ts +58 -0
- package/template/src/components/AppTable/engine/shared/valueSnapshot.ts +46 -0
- package/template/src/components/AppTable/engine/summary/config/export.ts +117 -0
- package/template/src/components/AppTable/engine/summary/config/index.ts +3 -0
- package/template/src/components/AppTable/engine/summary/config/summary.ts +62 -0
- package/template/src/components/AppTable/engine/summary/config/types.ts +93 -0
- package/template/src/components/AppTable/engine/summary/constants.ts +13 -0
- package/template/src/components/AppTable/engine/summary/excelJs.ts +133 -0
- package/template/src/components/AppTable/engine/summary/export.ts +311 -0
- package/template/src/components/AppTable/engine/summary/index.ts +6 -0
- package/template/src/components/AppTable/engine/summary/selectionSum.ts +92 -0
- package/template/src/components/AppTable/engine/summary/summary.ts +457 -0
- package/template/src/components/AppTable/engine/table/clipboard/index.ts +1 -0
- package/template/src/components/AppTable/engine/table/clipboard/transfer.ts +9 -0
- package/template/src/components/AppTable/engine/table/controller/TableController.ts +802 -0
- package/template/src/components/AppTable/engine/table/controller/errors.ts +106 -0
- package/template/src/components/AppTable/engine/table/controller/index.ts +4 -0
- package/template/src/components/AppTable/engine/table/controller/latestAbortableTask.ts +33 -0
- package/template/src/components/AppTable/engine/table/controller/tableDataReplacement.ts +60 -0
- package/template/src/components/AppTable/engine/table/controller/tableDomainConfiguration.ts +94 -0
- package/template/src/components/AppTable/engine/table/controller/tableEditingCommands.ts +163 -0
- package/template/src/components/AppTable/engine/table/controller/tableGridHost.ts +324 -0
- package/template/src/components/AppTable/engine/table/controller/tableIdentity.ts +68 -0
- package/template/src/components/AppTable/engine/table/controller/tableMutationPipeline.ts +79 -0
- package/template/src/components/AppTable/engine/table/controller/tableQueryCoordinator.ts +187 -0
- package/template/src/components/AppTable/engine/table/controller/tableReportingCoordinator.ts +143 -0
- package/template/src/components/AppTable/engine/table/controller/tableSaveCoordinator.ts +227 -0
- package/template/src/components/AppTable/engine/table/controller/tableSaveValidation.ts +29 -0
- package/template/src/components/AppTable/engine/table/controller/tableSnapshot.ts +58 -0
- package/template/src/components/AppTable/engine/table/controller/types.ts +202 -0
- package/template/src/components/AppTable/engine/table/editing/baselineStore.ts +134 -0
- package/template/src/components/AppTable/engine/table/editing/changeSet.ts +492 -0
- package/template/src/components/AppTable/engine/table/editing/changeSetSettlement.ts +633 -0
- package/template/src/components/AppTable/engine/table/editing/commitResultIndex.ts +75 -0
- package/template/src/components/AppTable/engine/table/editing/constants.ts +15 -0
- package/template/src/components/AppTable/engine/table/editing/dirtyCellIndex.ts +96 -0
- package/template/src/components/AppTable/engine/table/editing/index.ts +6 -0
- package/template/src/components/AppTable/engine/table/editing/mutation.ts +173 -0
- package/template/src/components/AppTable/engine/table/editing/rowKey.ts +10 -0
- package/template/src/components/AppTable/engine/table/editing/types.ts +404 -0
- package/template/src/components/AppTable/engine/table/editing/validation.ts +452 -0
- package/template/src/components/AppTable/engine/table/grid/cellMeta.ts +90 -0
- package/template/src/components/AppTable/engine/table/grid/handsontable.ts +25 -0
- package/template/src/components/AppTable/engine/table/grid/handsontableExtensions.d.ts +26 -0
- package/template/src/components/AppTable/engine/table/grid/index.ts +5 -0
- package/template/src/components/AppTable/engine/table/grid/moduleRegistry.ts +39 -0
- package/template/src/components/AppTable/engine/table/grid/runtime.ts +31 -0
- package/template/src/components/AppTable/engine/table/grid/types.ts +25 -0
- package/template/src/components/AppTable/engine/table/hooks/fixedEndHooks.ts +44 -0
- package/template/src/components/AppTable/engine/table/hooks/gridHooks.ts +108 -0
- package/template/src/components/AppTable/engine/table/hooks/headerHooks.ts +103 -0
- package/template/src/components/AppTable/engine/table/hooks/index.ts +3 -0
- package/template/src/components/AppTable/engine/table/index.ts +6 -0
- package/template/src/components/AppTable/engine/table/layout/constants.ts +2 -0
- package/template/src/components/AppTable/engine/table/layout/dropdownMenu.ts +89 -0
- package/template/src/components/AppTable/engine/table/layout/fixedColumns.ts +44 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlay.ts +90 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlayAccessibility.ts +104 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlayRenderer.ts +690 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndOverlaySignature.ts +58 -0
- package/template/src/components/AppTable/engine/table/layout/fixedEndRuntime.ts +137 -0
- package/template/src/components/AppTable/engine/table/layout/handsontableDomAdapter.ts +40 -0
- package/template/src/components/AppTable/engine/table/layout/height.ts +72 -0
- package/template/src/components/AppTable/engine/table/layout/index.ts +14 -0
- package/template/src/components/AppTable/engine/table/layout/layoutScheduler.ts +60 -0
- package/template/src/components/AppTable/engine/table/layout/mergeCells.ts +146 -0
- package/template/src/components/AppTable/engine/table/layout/nestedHeaders.ts +271 -0
- package/template/src/components/AppTable/engine/table/layout/types.ts +10 -0
- package/template/src/components/AppTable/engine/toolbar/index.ts +1 -0
- package/template/src/components/AppTable/engine/toolbar/types.ts +56 -0
- package/template/src/components/AppTable/index.ts +11 -0
- package/template/src/components/AppTable/messages.ts +256 -0
- package/template/src/components/AppTable/pagination/TablePaginationBar.tsx +193 -0
- package/template/src/components/AppTable/pagination/index.ts +1 -0
- package/template/src/components/AppTable/pagination/paginationItems.ts +56 -0
- package/template/src/components/AppTable/preference/index.ts +1 -0
- package/template/src/components/AppTable/preference/useTablePreference.ts +208 -0
- package/template/src/components/AppTable/reporting/index.ts +1 -0
- package/template/src/components/AppTable/reporting/useTableReporting.ts +342 -0
- package/template/src/components/AppTable/search/TableSearchBar.tsx +301 -0
- package/template/src/components/AppTable/search/TableSearchConditionEditor.tsx +254 -0
- package/template/src/components/AppTable/search/TableSearchField.tsx +338 -0
- package/template/src/components/AppTable/search/TableSearchFields.tsx +65 -0
- package/template/src/components/AppTable/search/constants.ts +9 -0
- package/template/src/components/AppTable/search/index.ts +3 -0
- package/template/src/components/AppTable/search/tableSearchBar.css +164 -0
- package/template/src/components/AppTable/search/types.ts +7 -0
- package/template/src/components/AppTable/search/useTableQuery.ts +373 -0
- package/template/src/components/AppTable/selection/index.ts +1 -0
- package/template/src/components/AppTable/selection/useTableSelection.ts +188 -0
- package/template/src/components/AppTable/sensitiveData.tsx +41 -0
- package/template/src/components/AppTable/shared/styles.ts +2 -0
- package/template/src/components/AppTable/styles/index.css +6 -0
- package/template/src/components/AppTable/styles/tableComponent.css +297 -0
- package/template/src/components/AppTable/styles/theme.css +133 -0
- package/template/src/components/AppTable/table/components/TableComponent.tsx +567 -0
- package/template/src/components/AppTable/table/components/TableErrorFeedback.tsx +36 -0
- package/template/src/components/AppTable/table/components/TableGridViewport.tsx +85 -0
- package/template/src/components/AppTable/table/components/index.ts +2 -0
- package/template/src/components/AppTable/table/components/types.ts +90 -0
- package/template/src/components/AppTable/table/controller/configuration.ts +89 -0
- package/template/src/components/AppTable/table/controller/index.ts +2 -0
- package/template/src/components/AppTable/table/controller/useTableController.ts +155 -0
- package/template/src/components/AppTable/table/controller/useTableLifecycle.ts +97 -0
- package/template/src/components/AppTable/table/grid/index.ts +1 -0
- package/template/src/components/AppTable/table/grid/useTableGrid.ts +857 -0
- package/template/src/components/AppTable/table/grid/useTableGridRuntimeSettings.ts +49 -0
- package/template/src/components/AppTable/table/index.ts +4 -0
- package/template/src/components/AppTable/table/layout/TablePanels.tsx +389 -0
- package/template/src/components/AppTable/table/layout/index.ts +7 -0
- package/template/src/components/AppTable/table/layout/types.ts +3 -0
- package/template/src/components/AppTable/table/layout/useResizablePanel.ts +213 -0
- package/template/src/components/AppTable/table/layout/useTableAdaptiveHeight.ts +238 -0
- package/template/src/components/AppTable/table/layout/useTablePanels.ts +329 -0
- package/template/src/components/AppTable/table/layout/useTableTheme.ts +123 -0
- package/template/src/components/AppTable/toolbar/TableToolbar.tsx +336 -0
- package/template/src/components/AppTable/toolbar/index.ts +1 -0
- package/template/src/components/BrandLogo/BrandLogo.tsx +41 -0
- package/template/src/components/BrandLogo/index.ts +1 -0
- package/template/src/components/Can/Can.tsx +19 -0
- package/template/src/components/Can/index.ts +7 -0
- package/template/src/components/Can/types.ts +41 -0
- package/template/src/components/EnumBadge/EnumBadge.tsx +44 -0
- package/template/src/components/EnumBadge/index.ts +2 -0
- package/template/src/components/EnumBadge/types.ts +16 -0
- package/template/src/components/EnumText/EnumText.tsx +33 -0
- package/template/src/components/EnumText/index.ts +2 -0
- package/template/src/components/EnumText/types.ts +13 -0
- package/template/src/components/FilePreview/FilePreview.tsx +120 -0
- package/template/src/components/FilePreview/index.ts +11 -0
- package/template/src/components/FilePreview/preview.ts +88 -0
- package/template/src/components/FilePreview/types.ts +91 -0
- package/template/src/components/FileUpload/FileUpload.tsx +172 -0
- package/template/src/components/FileUpload/index.ts +2 -0
- package/template/src/components/FileUpload/types.ts +32 -0
- package/template/src/components/JsonEditor/JsonEditor.tsx +103 -0
- package/template/src/components/JsonEditor/index.ts +1 -0
- package/template/src/components/JsonEditor/types.ts +14 -0
- package/template/src/components/PageFeedback/PageFeedback.tsx +194 -0
- package/template/src/components/PageFeedback/index.ts +10 -0
- package/template/src/components/PageFeedback/types.ts +31 -0
- package/template/src/components/PasswordInput/PasswordInput.tsx +50 -0
- package/template/src/components/PasswordInput/index.ts +1 -0
- package/template/src/components/RouteDialog/RouteDialog.tsx +20 -0
- package/template/src/components/RouteDialog/index.ts +2 -0
- package/template/src/components/RouteDialog/types.ts +8 -0
- package/template/src/components/RouteDialog/useRouteDialogNavigation.ts +30 -0
- package/template/src/components/SensitiveData/SensitiveData.tsx +337 -0
- package/template/src/components/SensitiveData/index.ts +2 -0
- package/template/src/components/SensitiveData/types.ts +31 -0
- package/template/src/components/StatusBadge/StatusBadge.tsx +28 -0
- package/template/src/components/StatusBadge/index.ts +2 -0
- package/template/src/components/StatusBadge/statusBadgeStyles.ts +30 -0
- package/template/src/components/StatusBadge/types.ts +7 -0
- package/template/src/components/layout/AppHeader/AppHeader.tsx +57 -0
- package/template/src/components/layout/AppHeader/HeaderSearch.tsx +160 -0
- package/template/src/components/layout/AppHeader/HeaderUserMenu.tsx +59 -0
- package/template/src/components/layout/AppHeader/ThemeControls.tsx +44 -0
- package/template/src/components/layout/AppHeader/index.ts +1 -0
- package/template/src/components/layout/AppHeader/themeOptions.ts +13 -0
- package/template/src/components/layout/AppSidebar.tsx +268 -0
- package/template/src/components/layout/PageContainer.tsx +16 -0
- package/template/src/components/ui/avatar.tsx +108 -0
- package/template/src/components/ui/badge.tsx +47 -0
- package/template/src/components/ui/button.tsx +63 -0
- package/template/src/components/ui/card.tsx +60 -0
- package/template/src/components/ui/checkbox.tsx +31 -0
- package/template/src/components/ui/collapsible.tsx +33 -0
- package/template/src/components/ui/command.tsx +181 -0
- package/template/src/components/ui/dialog.tsx +157 -0
- package/template/src/components/ui/dropdown-menu.tsx +254 -0
- package/template/src/components/ui/form.tsx +141 -0
- package/template/src/components/ui/input.tsx +20 -0
- package/template/src/components/ui/label.tsx +23 -0
- package/template/src/components/ui/pagination.tsx +127 -0
- package/template/src/components/ui/popover.tsx +41 -0
- package/template/src/components/ui/select.tsx +187 -0
- package/template/src/components/ui/separator.tsx +25 -0
- package/template/src/components/ui/sheet.tsx +142 -0
- package/template/src/components/ui/sidebar.tsx +878 -0
- package/template/src/components/ui/skeleton.tsx +13 -0
- package/template/src/components/ui/sonner.tsx +33 -0
- package/template/src/components/ui/tooltip.tsx +54 -0
- package/template/src/config/RuntimeConfigErrorPage.tsx +48 -0
- package/template/src/config/appConfig.ts +126 -0
- package/template/src/config/buildInfo.ts +8 -0
- package/template/src/config/observabilityAdapter.ts +8 -0
- package/template/src/config/runtimeConfig.ts +360 -0
- package/template/src/config/types.ts +195 -0
- package/template/src/context/ThemeProvider.tsx +84 -0
- package/template/src/context/UnsavedChangesProvider.tsx +123 -0
- package/template/src/context/applicationScope.ts +39 -0
- package/template/src/context/types.ts +41 -0
- package/template/src/dataMasking/index.ts +14 -0
- package/template/src/dataMasking/masking.ts +139 -0
- package/template/src/dataMasking/types.ts +144 -0
- package/template/src/featureFlags/FeatureFlagProvider.tsx +143 -0
- package/template/src/featureFlags/FeatureGate.tsx +12 -0
- package/template/src/featureFlags/catalog.ts +140 -0
- package/template/src/featureFlags/errors.ts +17 -0
- package/template/src/featureFlags/index.ts +43 -0
- package/template/src/featureFlags/query.ts +103 -0
- package/template/src/featureFlags/registry.ts +149 -0
- package/template/src/featureFlags/scope.ts +27 -0
- package/template/src/featureFlags/types.ts +241 -0
- package/template/src/features/auth/AuthLayout.tsx +17 -0
- package/template/src/features/auth/index.ts +2 -0
- package/template/src/features/auth/signIn/components/UserAuthForm.tsx +121 -0
- package/template/src/features/auth/signIn/index.tsx +71 -0
- package/template/src/features/auth/signIn/messages.ts +37 -0
- package/template/src/features/auth/signIn/types.ts +4 -0
- package/template/src/features/errors/ForbiddenError.tsx +34 -0
- package/template/src/features/errors/GeneralError.tsx +46 -0
- package/template/src/features/errors/MaintenanceError.tsx +31 -0
- package/template/src/features/errors/NotFoundError.tsx +34 -0
- package/template/src/features/errors/RouteError.tsx +72 -0
- package/template/src/features/errors/UnauthorizedError.tsx +34 -0
- package/template/src/features/errors/index.ts +6 -0
- package/template/src/features/errors/messages.ts +56 -0
- package/template/src/features/home/index.tsx +107 -0
- package/template/src/features/home/messages.ts +59 -0
- package/template/src/features/showcase/AccessShowcasePage.tsx +284 -0
- package/template/src/features/showcase/AdvancedTableDemo.tsx +120 -0
- package/template/src/features/showcase/FeedbackShowcasePage.tsx +142 -0
- package/template/src/features/showcase/FileShowcasePage.tsx +110 -0
- package/template/src/features/showcase/FormShowcasePage.tsx +156 -0
- package/template/src/features/showcase/MetadataShowcasePage.tsx +241 -0
- package/template/src/features/showcase/ShowcasePageHeader.tsx +24 -0
- package/template/src/features/showcase/TableShowcasePage.tsx +436 -0
- package/template/src/features/showcase/accessMessages.ts +67 -0
- package/template/src/features/showcase/index.ts +6 -0
- package/template/src/features/showcase/messages.ts +192 -0
- package/template/src/files/download.ts +82 -0
- package/template/src/files/errors.ts +15 -0
- package/template/src/files/filename.ts +61 -0
- package/template/src/files/index.ts +38 -0
- package/template/src/files/types.ts +299 -0
- package/template/src/files/useFileTask.ts +153 -0
- package/template/src/files/useFileUpload.ts +117 -0
- package/template/src/files/validation.ts +109 -0
- package/template/src/layouts/AppLayout.tsx +37 -0
- package/template/src/lib/accessControl.ts +42 -0
- package/template/src/lib/navigationRedirect.ts +26 -0
- package/template/src/lib/utils.ts +6 -0
- package/template/src/locale/LocaleProvider.tsx +37 -0
- package/template/src/locale/context.ts +15 -0
- package/template/src/locale/formatters.ts +123 -0
- package/template/src/locale/hooks.ts +35 -0
- package/template/src/locale/index.ts +17 -0
- package/template/src/locale/messages.ts +151 -0
- package/template/src/locale/types.ts +167 -0
- package/template/src/main.tsx +5 -0
- package/template/src/observability/browser.ts +37 -0
- package/template/src/observability/consoleAdapter.ts +18 -0
- package/template/src/observability/index.ts +26 -0
- package/template/src/observability/observer.ts +118 -0
- package/template/src/observability/redaction.ts +85 -0
- package/template/src/observability/types.ts +119 -0
- package/template/src/optionalEditors/controller.ts +327 -0
- package/template/src/optionalEditors/errors.ts +21 -0
- package/template/src/optionalEditors/index.ts +35 -0
- package/template/src/optionalEditors/model.ts +253 -0
- package/template/src/optionalEditors/react.ts +89 -0
- package/template/src/optionalEditors/types.ts +254 -0
- package/template/src/permissions/index.ts +3 -0
- package/template/src/permissions/types.ts +5 -0
- package/template/src/permissions/usePermission.ts +16 -0
- package/template/src/realtimeCollaboration/controller.ts +355 -0
- package/template/src/realtimeCollaboration/errors.ts +20 -0
- package/template/src/realtimeCollaboration/index.ts +39 -0
- package/template/src/realtimeCollaboration/model.ts +212 -0
- package/template/src/realtimeCollaboration/react.ts +72 -0
- package/template/src/realtimeCollaboration/types.ts +251 -0
- package/template/src/reporting/errors.ts +21 -0
- package/template/src/reporting/generation.ts +87 -0
- package/template/src/reporting/index.ts +42 -0
- package/template/src/reporting/model.ts +373 -0
- package/template/src/reporting/print.ts +16 -0
- package/template/src/reporting/query.ts +50 -0
- package/template/src/reporting/react.ts +17 -0
- package/template/src/reporting/source.ts +13 -0
- package/template/src/reporting/types.ts +219 -0
- package/template/src/router/RootRouteLayout.tsx +11 -0
- package/template/src/router/authLifecycle.ts +39 -0
- package/template/src/router/config.ts +293 -0
- package/template/src/router/interceptors.ts +48 -0
- package/template/src/router/lazyRouteComponents.ts +78 -0
- package/template/src/router/messages.ts +48 -0
- package/template/src/router/navigation.ts +167 -0
- package/template/src/router/router.ts +66 -0
- package/template/src/router/searchSchemas.ts +9 -0
- package/template/src/router/types.ts +76 -0
- package/template/src/stores/authSessionStorage.ts +27 -0
- package/template/src/stores/authStore.ts +165 -0
- package/template/src/stores/types.ts +36 -0
- package/template/src/stores/uiPreferenceStore.ts +34 -0
- package/template/src/styles/index.css +141 -0
- package/template/src/styles/theme.css +213 -0
- package/template/src/tenantWorkspace/TenantWorkspaceProvider.tsx +102 -0
- package/template/src/tenantWorkspace/index.ts +33 -0
- package/template/src/tenantWorkspace/store.ts +184 -0
- package/template/src/tenantWorkspace/switch.ts +206 -0
- package/template/src/tenantWorkspace/types.ts +155 -0
- package/template/src/vite-env.d.ts +20 -0
- package/template/stylelint.config.js +28 -0
- package/template/tests/integration/Application.test.tsx +269 -0
- package/template/tests/integration/layout/AppHeader.test.tsx +182 -0
- package/template/tests/integration/layout/AppSidebar.test.tsx +121 -0
- package/template/tests/integration/layout/__screenshots__/AppHeader.test.tsx/AppHeader-command-search-hides-the-duplicate-header-trigger-when-the-desktop-sidebar-collapses-1.png +0 -0
- package/template/tests/integration/router/__screenshots__/config.test.ts/route-tree-authentication-boundaries-exposes-only-scaffold-navigation-metadata-1.png +0 -0
- package/template/tests/integration/router/config.test.ts +123 -0
- package/template/tests/integration/router/interceptors.test.ts +100 -0
- package/template/tests/setup/accessibility.ts +25 -0
- package/template/tests/setup/runtimeConfig.ts +3 -0
- package/template/tests/unit/api/ApiError.test.ts +25 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-clears-the-session-if-a-refresh-identity-loses-administrator-access-1.png +0 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-creates-a-session-from-the-generated-login-response-for-an-admin-1.png +0 -0
- package/template/tests/unit/api/__screenshots__/authSession.test.ts/administrator-authentication-rejects-and-revokes-the-generated-login-result-for-an-ordinary-user-1.png +0 -0
- package/template/tests/unit/api/activity/ActivityProvider.test.tsx +131 -0
- package/template/tests/unit/api/activity/__screenshots__/transports.test.ts/activity-transport-adapters-polls-sequentially-and-advances-the-last-event-ID-1.png +0 -0
- package/template/tests/unit/api/activity/modelAndQuery.test.ts +144 -0
- package/template/tests/unit/api/activity/subscription.test.ts +103 -0
- package/template/tests/unit/api/activity/transports.test.ts +145 -0
- package/template/tests/unit/api/authClient.test.ts +110 -0
- package/template/tests/unit/api/authSession.test.ts +289 -0
- package/template/tests/unit/api/clients/configureApiClient.test.ts +198 -0
- package/template/tests/unit/api/demoAuthClient.test.ts +47 -0
- package/template/tests/unit/api/enums/access.test.ts +107 -0
- package/template/tests/unit/api/enums/catalog.test.ts +200 -0
- package/template/tests/unit/api/enums/query.test.ts +110 -0
- package/template/tests/unit/api/enums/useEnum.test.tsx +98 -0
- package/template/tests/unit/api/enums/useEnumCatalog.test.tsx +68 -0
- package/template/tests/unit/api/hooks/error.test.ts +168 -0
- package/template/tests/unit/api/hooks/request.test.ts +170 -0
- package/template/tests/unit/api/hooks/response.test.ts +46 -0
- package/template/tests/unit/api/metadata/MetadataProvider.test.tsx +102 -0
- package/template/tests/unit/api/parameters/catalog.test.ts +147 -0
- package/template/tests/unit/api/parameters/query.test.ts +78 -0
- package/template/tests/unit/api/parameters/useGlobalParameter.test.tsx +89 -0
- package/template/tests/unit/api/query/queryPolicy.test.ts +245 -0
- package/template/tests/unit/api/query/useAppQueryScope.test.tsx +74 -0
- package/template/tests/unit/auditLogs/auditLogHooks.test.tsx +194 -0
- package/template/tests/unit/auditLogs/auditLogs.test.ts +199 -0
- package/template/tests/unit/authentication/__screenshots__/authentication.test.ts/authentication-controller-completes-Step-up-callbacks-without-creating-a-second-login-result-1.png +0 -0
- package/template/tests/unit/authentication/__screenshots__/authentication.test.ts/authentication-controller-moves-from-challenge-to-completion-without-retaining-tokens-in-snapshot-1.png +0 -0
- package/template/tests/unit/authentication/authentication.test.ts +376 -0
- package/template/tests/unit/components/AppDialog.test.tsx +225 -0
- package/template/tests/unit/components/AppTable.test.tsx +129 -0
- package/template/tests/unit/components/AppTableLayoutTransition.test.ts +118 -0
- package/template/tests/unit/components/AppTableLocalization.test.ts +58 -0
- package/template/tests/unit/components/AppTableSensitiveData.test.ts +35 -0
- package/template/tests/unit/components/AppTableUpgrade.test.tsx +179 -0
- package/template/tests/unit/components/AppTableUpgradeCore.test.ts +258 -0
- package/template/tests/unit/components/BrandLogo.test.tsx +24 -0
- package/template/tests/unit/components/Can.test.tsx +80 -0
- package/template/tests/unit/components/Dialog.test.tsx +56 -0
- package/template/tests/unit/components/EnumPresentation.test.tsx +64 -0
- package/template/tests/unit/components/FilePreviewEngine.test.ts +51 -0
- package/template/tests/unit/components/JsonEditor.test.tsx +47 -0
- package/template/tests/unit/components/LocalizedSharedComponents.test.tsx +36 -0
- package/template/tests/unit/components/OverlayLayer.test.tsx +151 -0
- package/template/tests/unit/components/PageFeedback.test.tsx +143 -0
- package/template/tests/unit/components/PageForm.test.tsx +272 -0
- package/template/tests/unit/components/PageFormCore.test.ts +74 -0
- package/template/tests/unit/components/PasswordInput.test.tsx +105 -0
- package/template/tests/unit/components/ScaffoldComponents.test.tsx +64 -0
- package/template/tests/unit/components/SensitiveData.test.tsx +151 -0
- package/template/tests/unit/components/StatusBadge.test.tsx +36 -0
- package/template/tests/unit/components/TableComponent.test.tsx +644 -0
- package/template/tests/unit/components/TableCore.test.ts +145 -0
- package/template/tests/unit/components/ThemeAccessibility.test.tsx +27 -0
- package/template/tests/unit/components/__screenshots__/BatchOperationDialog.test.tsx/confirms-a-batch-action-and-presents-partial-failure-details-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/PageForm.test.tsx/PageForm-writes-uploaded-values-through-the-public-file-field-and-resets-dirty-state-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/PasswordInput.test.tsx/PasswordInput-toggles-the-password-visibility-when-the-show-password-button-is-clicked-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-pins-trailing-action-columns-and-removes-their-header-menu-by-default-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-renders-shadcn-components-through-cellComponent-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-renders-the-toolbar-without-a-bottom-divider-1.png +0 -0
- package/template/tests/unit/components/__screenshots__/TableComponent.test.tsx/TableComponent-resyncs-adaptive-height-after-a-column-resize-changes-wrapped-row-height-1.png +0 -0
- package/template/tests/unit/config/RuntimeConfigErrorPage.test.tsx +23 -0
- package/template/tests/unit/config/appConfig.test.ts +98 -0
- package/template/tests/unit/config/appTableContracts.test.mjs +120 -0
- package/template/tests/unit/config/bundleBudget.test.mjs +190 -0
- package/template/tests/unit/config/componentGovernance.test.mjs +156 -0
- package/template/tests/unit/config/deployConfig.test.mjs +211 -0
- package/template/tests/unit/config/eslintConfig.test.mjs +101 -0
- package/template/tests/unit/config/featureBoundaries.test.mjs +126 -0
- package/template/tests/unit/config/npmPackage.test.mjs +37 -0
- package/template/tests/unit/config/releaseArtifact.test.mjs +105 -0
- package/template/tests/unit/config/runtimeConfig.test.ts +225 -0
- package/template/tests/unit/config/scaffoldCheck.test.mjs +53 -0
- package/template/tests/unit/config/scaffoldFeature.test.mjs +177 -0
- package/template/tests/unit/config/scaffoldInit.test.mjs +218 -0
- package/template/tests/unit/config/scaffoldProject.test.mjs +378 -0
- package/template/tests/unit/config/scaffoldTransaction.test.mjs +77 -0
- package/template/tests/unit/config/viteConfig.test.mjs +371 -0
- package/template/tests/unit/context/ThemeProvider.test.tsx +108 -0
- package/template/tests/unit/context/UnsavedChangesProvider.test.tsx +94 -0
- package/template/tests/unit/context/__screenshots__/ThemeProvider.test.tsx/ThemeProvider-uses-the-neutral-black-palette-for-the-app-and-scoped-table-theme-1.png +0 -0
- package/template/tests/unit/context/applicationScope.test.ts +62 -0
- package/template/tests/unit/dataMasking/dataMasking.test.ts +95 -0
- package/template/tests/unit/featureFlags/featureFlags.test.ts +169 -0
- package/template/tests/unit/featureFlags/useFeatureFlag.test.tsx +108 -0
- package/template/tests/unit/features/FeatureLocalization.test.tsx +54 -0
- package/template/tests/unit/features/RouteError.test.tsx +40 -0
- package/template/tests/unit/features/auth/signIn/UserAuthForm.test.tsx +79 -0
- package/template/tests/unit/features/auth/signIn/__screenshots__/UserAuthForm.test.tsx/UserAuthForm-passes-validated-values-to-onSubmit-1.png +0 -0
- package/template/tests/unit/features/auth/signIn/__screenshots__/UserAuthForm.test.tsx/UserAuthForm-shows-validation-messages-when-submitting-an-empty-form-1.png +0 -0
- package/template/tests/unit/files/fileHooks.test.tsx +130 -0
- package/template/tests/unit/files/files.test.ts +112 -0
- package/template/tests/unit/lib/accessControl.test.ts +69 -0
- package/template/tests/unit/locale/locale.test.tsx +90 -0
- package/template/tests/unit/observability/browser.test.ts +48 -0
- package/template/tests/unit/observability/observer.test.ts +115 -0
- package/template/tests/unit/optionalEditors/__screenshots__/useOptionalEditor.test.tsx/useOptionalEditor-fails-permission-precheck-before-loading-the-project-SDK-1.png +0 -0
- package/template/tests/unit/optionalEditors/__screenshots__/useOptionalEditor.test.tsx/useOptionalEditor-mounts-a-route-scoped-SDK-into-the-dedicated-host-with-permission-1.png +0 -0
- package/template/tests/unit/optionalEditors/optionalEditors.test.ts +313 -0
- package/template/tests/unit/optionalEditors/useOptionalEditor.test.tsx +141 -0
- package/template/tests/unit/realtimeCollaboration/collaboration.test.ts +240 -0
- package/template/tests/unit/realtimeCollaboration/useRealtimeCollaboration.test.tsx +115 -0
- package/template/tests/unit/reporting/reporting.test.ts +195 -0
- package/template/tests/unit/reporting/reportingHooks.test.tsx +203 -0
- package/template/tests/unit/router/authLifecycle.test.ts +55 -0
- package/template/tests/unit/router/navigation.test.ts +55 -0
- package/template/tests/unit/router/redirects.test.ts +22 -0
- package/template/tests/unit/scaffoldFeatureTemplate/featureTemplate.test.ts +42 -0
- package/template/tests/unit/scaffoldFeatureTemplate/publicContract.test.ts +28 -0
- package/template/tests/unit/scaffoldFeatureTemplate/queries.test.tsx +289 -0
- package/template/tests/unit/stores/authStore.test.ts +128 -0
- package/template/tests/unit/stores/uiPreferenceStore.test.ts +56 -0
- package/template/tests/unit/tenantWorkspace/tenantWorkspace.test.tsx +261 -0
- package/template/tools/bundle/budgets.json +48 -0
- package/template/tools/bundle/check.mjs +307 -0
- package/template/tools/component-governance/check.mjs +703 -0
- package/template/tools/component-governance/manifest.json +112 -0
- package/template/tools/deployment/browser-smoke.mjs +76 -0
- package/template/tools/deployment/browser-smoke.sh +141 -0
- package/template/tools/openapi/generate.mjs +268 -0
- package/template/tools/openapi/templates/README.md +14 -0
- package/template/tools/openapi/templates/base/README.md +7 -0
- package/template/tools/openapi/templates/base/data-contracts.eta +44 -0
- package/template/tools/openapi/templates/base/http-client.eta +3 -0
- package/template/tools/openapi/templates/base/http-clients/axios-http-client.eta +132 -0
- package/template/tools/openapi/templates/base/http-clients/fetch-http-client.eta +220 -0
- package/template/tools/openapi/templates/base/route-docs.eta +31 -0
- package/template/tools/openapi/templates/base/route-name.eta +43 -0
- package/template/tools/openapi/templates/base/route-type.eta +22 -0
- package/template/tools/openapi/templates/default/README.md +7 -0
- package/template/tools/openapi/templates/default/api.eta +67 -0
- package/template/tools/openapi/templates/default/http-client.eta +137 -0
- package/template/tools/openapi/templates/default/procedure-call.eta +99 -0
- package/template/tools/openapi/templates/default/route-docs.eta +40 -0
- package/template/tools/openapi/templates/default/route-types.eta +28 -0
- package/template/tools/openapi/templates/modular/README.md +7 -0
- package/template/tools/openapi/templates/modular/api.eta +28 -0
- package/template/tools/openapi/templates/modular/procedure-call.eta +99 -0
- package/template/tools/openapi/templates/modular/route-types.eta +18 -0
- package/template/tools/release/artifact.mjs +258 -0
- package/template/tools/scaffold/add-capability.mjs +409 -0
- package/template/tools/scaffold/capability-catalog.json +163 -0
- package/template/tools/scaffold/check.mjs +326 -0
- package/template/tools/scaffold/create-feature.mjs +444 -0
- package/template/tools/scaffold/create-project.mjs +482 -0
- package/template/tools/scaffold/init.example.json +64 -0
- package/template/tools/scaffold/init.mjs +419 -0
- package/template/tools/scaffold/lockfile.mjs +193 -0
- package/template/tools/scaffold/templates/feature/index.ts +19 -0
- package/template/tools/scaffold/templates/feature/model.ts +142 -0
- package/template/tools/scaffold/templates/feature/queries.ts +154 -0
- package/template/tools/scaffold/templates/feature/repository.ts +206 -0
- package/template/tools/scaffold/templates/feature/types.ts +168 -0
- package/template/tools/scaffold/workspace-transaction.mjs +111 -0
- package/template/tsconfig.app.json +31 -0
- package/template/tsconfig.json +12 -0
- package/template/tsconfig.node.json +24 -0
- package/template/vite.config.ts +121 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils'
|
|
2
|
+
|
|
3
|
+
function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
data-slot='skeleton'
|
|
7
|
+
className={cn('animate-pulse rounded-md bg-accent', className)}
|
|
8
|
+
{...props}
|
|
9
|
+
/>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Skeleton }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react'
|
|
2
|
+
import { Toaster as Sonner, type ToasterProps } from 'sonner'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { useTheme } from '@/context/ThemeProvider'
|
|
5
|
+
|
|
6
|
+
function Toaster({ ...objProps }: ToasterProps) {
|
|
7
|
+
const { strTheme } = useTheme()
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Sonner
|
|
11
|
+
theme={strTheme}
|
|
12
|
+
className='toaster group'
|
|
13
|
+
style={
|
|
14
|
+
{
|
|
15
|
+
'--normal-bg': 'var(--popover)',
|
|
16
|
+
'--normal-text': 'var(--popover-foreground)',
|
|
17
|
+
'--normal-border': 'var(--border)',
|
|
18
|
+
} as CSSProperties
|
|
19
|
+
}
|
|
20
|
+
{...objProps}
|
|
21
|
+
toastOptions={{
|
|
22
|
+
...objProps.toastOptions,
|
|
23
|
+
className: cn('pointer-events-none', objProps.toastOptions?.className),
|
|
24
|
+
style: {
|
|
25
|
+
...objProps.toastOptions?.style,
|
|
26
|
+
pointerEvents: 'none',
|
|
27
|
+
},
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Toaster }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from 'radix-ui'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
function TooltipProvider({
|
|
6
|
+
delayDuration = 0,
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
9
|
+
return (
|
|
10
|
+
<TooltipPrimitive.Provider
|
|
11
|
+
data-slot='tooltip-provider'
|
|
12
|
+
delayDuration={delayDuration}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function Tooltip({
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
21
|
+
return <TooltipPrimitive.Root data-slot='tooltip' {...props} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function TooltipTrigger({
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
27
|
+
return <TooltipPrimitive.Trigger data-slot='tooltip-trigger' {...props} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function TooltipContent({
|
|
31
|
+
className,
|
|
32
|
+
sideOffset = 0,
|
|
33
|
+
children,
|
|
34
|
+
...props
|
|
35
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
36
|
+
return (
|
|
37
|
+
<TooltipPrimitive.Portal>
|
|
38
|
+
<TooltipPrimitive.Content
|
|
39
|
+
data-slot='tooltip-content'
|
|
40
|
+
sideOffset={sideOffset}
|
|
41
|
+
className={cn(
|
|
42
|
+
'z-(--z-index-tooltip) w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
<TooltipPrimitive.Arrow className='z-(--z-index-tooltip) size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground' />
|
|
49
|
+
</TooltipPrimitive.Content>
|
|
50
|
+
</TooltipPrimitive.Portal>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { objBuildInfo } from '@/config/buildInfo'
|
|
2
|
+
|
|
3
|
+
export function RuntimeConfigErrorPage({
|
|
4
|
+
strCode,
|
|
5
|
+
strMessage,
|
|
6
|
+
}: {
|
|
7
|
+
/** 便于部署人员检索的稳定错误码。 */
|
|
8
|
+
strCode: string
|
|
9
|
+
/** 不包含配置值或凭据的故障说明。 */
|
|
10
|
+
strMessage: string
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<main className='flex min-h-screen items-center justify-center bg-background p-6 text-foreground'>
|
|
14
|
+
<section
|
|
15
|
+
aria-labelledby='runtime-config-error-title'
|
|
16
|
+
className='w-full max-w-xl rounded-xl border bg-card p-6 shadow-sm'
|
|
17
|
+
role='alert'
|
|
18
|
+
>
|
|
19
|
+
<p className='text-sm font-medium text-destructive'>启动失败</p>
|
|
20
|
+
<h1
|
|
21
|
+
className='mt-2 text-2xl font-semibold'
|
|
22
|
+
id='runtime-config-error-title'
|
|
23
|
+
>
|
|
24
|
+
应用运行时配置不可用
|
|
25
|
+
</h1>
|
|
26
|
+
<p className='mt-3 text-sm text-muted-foreground'>{strMessage}</p>
|
|
27
|
+
<dl className='mt-4 rounded-md bg-muted p-3 text-sm'>
|
|
28
|
+
<dt className='font-medium'>错误码</dt>
|
|
29
|
+
<dd className='mt-1 font-mono'>{strCode}</dd>
|
|
30
|
+
<dt className='mt-3 font-medium'>应用版本</dt>
|
|
31
|
+
<dd className='mt-1 font-mono'>
|
|
32
|
+
v{objBuildInfo.strVersion} · {objBuildInfo.strCommit.slice(0, 12)}
|
|
33
|
+
</dd>
|
|
34
|
+
</dl>
|
|
35
|
+
<p className='mt-4 text-sm text-muted-foreground'>
|
|
36
|
+
请检查部署环境中的 runtime-config.json,修正后重新加载。
|
|
37
|
+
</p>
|
|
38
|
+
<button
|
|
39
|
+
className='mt-6 inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'
|
|
40
|
+
onClick={() => window.location.reload()}
|
|
41
|
+
type='button'
|
|
42
|
+
>
|
|
43
|
+
重新加载
|
|
44
|
+
</button>
|
|
45
|
+
</section>
|
|
46
|
+
</main>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { objBuildInfo } from '@/config/buildInfo'
|
|
2
|
+
import { fnGetRuntimeConfig } from '@/config/runtimeConfig'
|
|
3
|
+
import type {
|
|
4
|
+
IAppConfig,
|
|
5
|
+
IRuntimeBrandPalette,
|
|
6
|
+
IRuntimeConfig,
|
|
7
|
+
} from '@/config/types'
|
|
8
|
+
|
|
9
|
+
function fnResolvePublicAssetUrl(strPath: string) {
|
|
10
|
+
if (/^(?:[a-z]+:)?\/\//i.test(strPath) || strPath.startsWith('data:')) {
|
|
11
|
+
return strPath
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return `${import.meta.env.BASE_URL}${strPath.replace(/^\/+/, '')}`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function fnCreateAppConfig(objRuntimeConfig: IRuntimeConfig): IAppConfig {
|
|
18
|
+
const strStorageNamespace = objRuntimeConfig.app.strStorageNamespace
|
|
19
|
+
|
|
20
|
+
return Object.freeze({
|
|
21
|
+
runtime: Object.freeze({
|
|
22
|
+
strMode: objRuntimeConfig.app.strMode,
|
|
23
|
+
}),
|
|
24
|
+
brand: Object.freeze({
|
|
25
|
+
strId: objRuntimeConfig.app.strBrandId,
|
|
26
|
+
strName: objRuntimeConfig.app.strTitle,
|
|
27
|
+
strDescription: objRuntimeConfig.app.strDescription,
|
|
28
|
+
strLogoUrl: fnResolvePublicAssetUrl(objRuntimeConfig.app.strLogoPath),
|
|
29
|
+
strDarkLogoUrl: fnResolvePublicAssetUrl(
|
|
30
|
+
objRuntimeConfig.app.strDarkLogoPath
|
|
31
|
+
),
|
|
32
|
+
strFaviconUrl: fnResolvePublicAssetUrl(
|
|
33
|
+
objRuntimeConfig.app.strFaviconPath
|
|
34
|
+
),
|
|
35
|
+
objTheme: Object.freeze({
|
|
36
|
+
objLight: Object.freeze({
|
|
37
|
+
...objRuntimeConfig.app.objTheme.objLight,
|
|
38
|
+
}),
|
|
39
|
+
objDark: Object.freeze({ ...objRuntimeConfig.app.objTheme.objDark }),
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
api: Object.freeze({
|
|
43
|
+
strBaseUrl: objRuntimeConfig.api.strBaseUrl,
|
|
44
|
+
}),
|
|
45
|
+
auth: Object.freeze({ ...objRuntimeConfig.auth }),
|
|
46
|
+
observability: Object.freeze({
|
|
47
|
+
bEnabled: objRuntimeConfig.observability.bEnabled,
|
|
48
|
+
}),
|
|
49
|
+
locale: Object.freeze({ ...objRuntimeConfig.locale }),
|
|
50
|
+
release: Object.freeze({
|
|
51
|
+
...objBuildInfo,
|
|
52
|
+
strEnvironment: objRuntimeConfig.observability.strEnvironment,
|
|
53
|
+
}),
|
|
54
|
+
navigation: Object.freeze({
|
|
55
|
+
strDefaultAuthenticatedPath: '/dashboard',
|
|
56
|
+
}),
|
|
57
|
+
storage: Object.freeze({
|
|
58
|
+
strAuthSessionKey: `${strStorageNamespace}.auth-session`,
|
|
59
|
+
strTenantWorkspaceKey: `${strStorageNamespace}.tenant-workspace`,
|
|
60
|
+
strThemeKey: `${strStorageNamespace}.theme`,
|
|
61
|
+
strUiPreferenceKey: `${strStorageNamespace}.ui-preferences`,
|
|
62
|
+
}),
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** 应用模块统一消费的已校验运行时配置。 */
|
|
67
|
+
export const objAppConfig: IAppConfig = fnCreateAppConfig(fnGetRuntimeConfig())
|
|
68
|
+
|
|
69
|
+
function fnApplyBrandPaletteVariables(
|
|
70
|
+
strMode: 'dark' | 'light',
|
|
71
|
+
objPalette: IRuntimeBrandPalette
|
|
72
|
+
) {
|
|
73
|
+
const objRoot = document.documentElement
|
|
74
|
+
objRoot.style.setProperty(
|
|
75
|
+
`--brand-${strMode}-primary`,
|
|
76
|
+
objPalette.strPrimaryColor
|
|
77
|
+
)
|
|
78
|
+
objRoot.style.setProperty(
|
|
79
|
+
`--brand-${strMode}-primary-foreground`,
|
|
80
|
+
objPalette.strPrimaryForegroundColor
|
|
81
|
+
)
|
|
82
|
+
objRoot.style.setProperty(
|
|
83
|
+
`--brand-${strMode}-secondary`,
|
|
84
|
+
objPalette.strSecondaryColor
|
|
85
|
+
)
|
|
86
|
+
objRoot.style.setProperty(
|
|
87
|
+
`--brand-${strMode}-secondary-foreground`,
|
|
88
|
+
objPalette.strSecondaryForegroundColor
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** 将已校验的品牌语义色同步到根节点;不接受任意 CSS 名称或值。 */
|
|
93
|
+
export function fnApplyAppBrandTheme(bIsDarkTheme: boolean) {
|
|
94
|
+
const objPalette = bIsDarkTheme
|
|
95
|
+
? objAppConfig.brand.objTheme.objDark
|
|
96
|
+
: objAppConfig.brand.objTheme.objLight
|
|
97
|
+
fnApplyBrandPaletteVariables('light', objAppConfig.brand.objTheme.objLight)
|
|
98
|
+
fnApplyBrandPaletteVariables('dark', objAppConfig.brand.objTheme.objDark)
|
|
99
|
+
document
|
|
100
|
+
.querySelector('meta[name="theme-color"]')
|
|
101
|
+
?.setAttribute('content', objPalette.strBrowserThemeColor)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** 将运行时品牌同步到浏览器文档元数据。 */
|
|
105
|
+
export function fnApplyAppDocumentMetadata() {
|
|
106
|
+
document.documentElement.dataset.brand = objAppConfig.brand.strId
|
|
107
|
+
document.title = objAppConfig.brand.strName
|
|
108
|
+
document
|
|
109
|
+
.querySelector('meta[name="title"]')
|
|
110
|
+
?.setAttribute('content', objAppConfig.brand.strName)
|
|
111
|
+
document
|
|
112
|
+
.querySelector('meta[name="description"]')
|
|
113
|
+
?.setAttribute('content', objAppConfig.brand.strDescription)
|
|
114
|
+
const arrIconLinks = Array.from(
|
|
115
|
+
document.querySelectorAll<HTMLLinkElement>('link[rel~="icon"]')
|
|
116
|
+
)
|
|
117
|
+
if (arrIconLinks.length === 0) {
|
|
118
|
+
const objIconLink = document.createElement('link')
|
|
119
|
+
objIconLink.rel = 'icon'
|
|
120
|
+
document.head.append(objIconLink)
|
|
121
|
+
arrIconLinks.push(objIconLink)
|
|
122
|
+
}
|
|
123
|
+
for (const objIconLink of arrIconLinks) {
|
|
124
|
+
objIconLink.setAttribute('href', objAppConfig.brand.strFaviconUrl)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type {
|
|
3
|
+
IRuntimeApplicationConfig,
|
|
4
|
+
IRuntimeBrandPalette,
|
|
5
|
+
IRuntimeConfig,
|
|
6
|
+
TRuntimeConfigErrorCode,
|
|
7
|
+
} from '@/config/types'
|
|
8
|
+
|
|
9
|
+
const strRuntimeConfigPath = `${import.meta.env.BASE_URL}runtime-config.json`
|
|
10
|
+
|
|
11
|
+
function fnIsHttpOrRelativeUrl(strValue: string) {
|
|
12
|
+
try {
|
|
13
|
+
const objUrl = new URL(strValue, 'https://runtime-config.invalid')
|
|
14
|
+
return (
|
|
15
|
+
['http:', 'https:'].includes(objUrl.protocol) &&
|
|
16
|
+
!objUrl.username &&
|
|
17
|
+
!objUrl.password
|
|
18
|
+
)
|
|
19
|
+
} catch {
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function fnIsBrandAssetLocation(strValue: string) {
|
|
25
|
+
if (strValue.startsWith('data:')) {
|
|
26
|
+
return /^data:image\/(?:gif|jpeg|png|webp);base64,[a-z0-9+/]+={0,2}$/i.test(
|
|
27
|
+
strValue
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
return strValue.length <= 2048 && fnIsHttpOrRelativeUrl(strValue)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function fnIsIanaTimeZone(strValue: string) {
|
|
34
|
+
try {
|
|
35
|
+
new Intl.DateTimeFormat('en-US', { timeZone: strValue }).format()
|
|
36
|
+
return true
|
|
37
|
+
} catch {
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const objDefaultLightBrandPalette: IRuntimeBrandPalette = {
|
|
43
|
+
strPrimaryColor: '#4068d5',
|
|
44
|
+
strPrimaryForegroundColor: '#ffffff',
|
|
45
|
+
strSecondaryColor: '#49beff',
|
|
46
|
+
strSecondaryForegroundColor: '#102a43',
|
|
47
|
+
strBrowserThemeColor: '#ffffff',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const objDefaultDarkBrandPalette: IRuntimeBrandPalette = {
|
|
51
|
+
strPrimaryColor: '#8aadff',
|
|
52
|
+
strPrimaryForegroundColor: '#0f172a',
|
|
53
|
+
strSecondaryColor: '#49beff',
|
|
54
|
+
strSecondaryForegroundColor: '#102a43',
|
|
55
|
+
strBrowserThemeColor: '#000000',
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function fnGetRelativeLuminance(strColor: string) {
|
|
59
|
+
const objMatch = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(strColor)
|
|
60
|
+
if (!objMatch) return 0
|
|
61
|
+
const arrChannels = objMatch.slice(1).map((strChannel) => {
|
|
62
|
+
const nChannel = Number.parseInt(strChannel, 16) / 255
|
|
63
|
+
return nChannel <= 0.04045
|
|
64
|
+
? nChannel / 12.92
|
|
65
|
+
: ((nChannel + 0.055) / 1.055) ** 2.4
|
|
66
|
+
})
|
|
67
|
+
return (
|
|
68
|
+
0.2126 * arrChannels[0] + 0.7152 * arrChannels[1] + 0.0722 * arrChannels[2]
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function fnGetContrastRatio(strBackground: string, strForeground: string) {
|
|
73
|
+
const nBackground = fnGetRelativeLuminance(strBackground)
|
|
74
|
+
const nForeground = fnGetRelativeLuminance(strForeground)
|
|
75
|
+
const nLighter = Math.max(nBackground, nForeground)
|
|
76
|
+
const nDarker = Math.min(nBackground, nForeground)
|
|
77
|
+
return (nLighter + 0.05) / (nDarker + 0.05)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const objHexColorSchema = z
|
|
81
|
+
.string()
|
|
82
|
+
.trim()
|
|
83
|
+
.regex(/^#[a-f\d]{6}$/i)
|
|
84
|
+
const objRuntimeBrandPaletteSchema = z
|
|
85
|
+
.object({
|
|
86
|
+
strPrimaryColor: objHexColorSchema,
|
|
87
|
+
strPrimaryForegroundColor: objHexColorSchema,
|
|
88
|
+
strSecondaryColor: objHexColorSchema,
|
|
89
|
+
strSecondaryForegroundColor: objHexColorSchema,
|
|
90
|
+
strBrowserThemeColor: objHexColorSchema,
|
|
91
|
+
})
|
|
92
|
+
.strict()
|
|
93
|
+
.superRefine((objPalette, objContext) => {
|
|
94
|
+
const arrPairs = [
|
|
95
|
+
{
|
|
96
|
+
strBackground: objPalette.strPrimaryColor,
|
|
97
|
+
strForeground: objPalette.strPrimaryForegroundColor,
|
|
98
|
+
strPath: 'strPrimaryForegroundColor',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
strBackground: objPalette.strSecondaryColor,
|
|
102
|
+
strForeground: objPalette.strSecondaryForegroundColor,
|
|
103
|
+
strPath: 'strSecondaryForegroundColor',
|
|
104
|
+
},
|
|
105
|
+
]
|
|
106
|
+
for (const objPair of arrPairs) {
|
|
107
|
+
if (
|
|
108
|
+
fnGetContrastRatio(objPair.strBackground, objPair.strForeground) < 4.5
|
|
109
|
+
) {
|
|
110
|
+
objContext.addIssue({
|
|
111
|
+
code: 'custom',
|
|
112
|
+
message: '品牌背景色与前景色的对比度必须达到 WCAG AA 4.5:1。',
|
|
113
|
+
path: [objPair.strPath],
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
const objRuntimeBrandThemeSchema = z
|
|
120
|
+
.object({
|
|
121
|
+
objLight: objRuntimeBrandPaletteSchema,
|
|
122
|
+
objDark: objRuntimeBrandPaletteSchema,
|
|
123
|
+
})
|
|
124
|
+
.strict()
|
|
125
|
+
.superRefine((objTheme, objContext) => {
|
|
126
|
+
const arrModes = [
|
|
127
|
+
{
|
|
128
|
+
objPalette: objTheme.objLight,
|
|
129
|
+
strBackground: '#ffffff',
|
|
130
|
+
strPath: 'objLight',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
objPalette: objTheme.objDark,
|
|
134
|
+
strBackground: '#000000',
|
|
135
|
+
strPath: 'objDark',
|
|
136
|
+
},
|
|
137
|
+
]
|
|
138
|
+
for (const objMode of arrModes) {
|
|
139
|
+
if (
|
|
140
|
+
fnGetContrastRatio(
|
|
141
|
+
objMode.objPalette.strPrimaryColor,
|
|
142
|
+
objMode.strBackground
|
|
143
|
+
) < 4.5
|
|
144
|
+
) {
|
|
145
|
+
objContext.addIssue({
|
|
146
|
+
code: 'custom',
|
|
147
|
+
message:
|
|
148
|
+
'品牌主色作为链接和强调文本时必须与页面背景达到 WCAG AA 4.5:1。',
|
|
149
|
+
path: [objMode.strPath, 'strPrimaryColor'],
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
.default({
|
|
155
|
+
objLight: objDefaultLightBrandPalette,
|
|
156
|
+
objDark: objDefaultDarkBrandPalette,
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
const objRuntimeApplicationSchema = z
|
|
160
|
+
.object({
|
|
161
|
+
strBrandId: z
|
|
162
|
+
.string()
|
|
163
|
+
.trim()
|
|
164
|
+
.regex(/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/i)
|
|
165
|
+
.optional(),
|
|
166
|
+
strTitle: z.string().trim().min(1),
|
|
167
|
+
strDescription: z.string().trim().min(1),
|
|
168
|
+
strLogoPath: z
|
|
169
|
+
.string()
|
|
170
|
+
.trim()
|
|
171
|
+
.min(1)
|
|
172
|
+
.max(500_000)
|
|
173
|
+
.refine(fnIsBrandAssetLocation),
|
|
174
|
+
strDarkLogoPath: z
|
|
175
|
+
.string()
|
|
176
|
+
.trim()
|
|
177
|
+
.min(1)
|
|
178
|
+
.max(500_000)
|
|
179
|
+
.refine(fnIsBrandAssetLocation)
|
|
180
|
+
.optional(),
|
|
181
|
+
strFaviconPath: z
|
|
182
|
+
.string()
|
|
183
|
+
.trim()
|
|
184
|
+
.min(1)
|
|
185
|
+
.max(500_000)
|
|
186
|
+
.refine(fnIsBrandAssetLocation)
|
|
187
|
+
.optional(),
|
|
188
|
+
strStorageNamespace: z
|
|
189
|
+
.string()
|
|
190
|
+
.trim()
|
|
191
|
+
.regex(/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/i),
|
|
192
|
+
strMode: z.enum(['connected', 'demo']),
|
|
193
|
+
objTheme: objRuntimeBrandThemeSchema,
|
|
194
|
+
})
|
|
195
|
+
.strict()
|
|
196
|
+
|
|
197
|
+
const objRuntimeApiSchema = z
|
|
198
|
+
.object({
|
|
199
|
+
strBaseUrl: z
|
|
200
|
+
.string()
|
|
201
|
+
.trim()
|
|
202
|
+
.refine((strValue) => !strValue || fnIsHttpOrRelativeUrl(strValue))
|
|
203
|
+
.transform((strValue) => strValue.replace(/\/+$/, '')),
|
|
204
|
+
})
|
|
205
|
+
.strict()
|
|
206
|
+
|
|
207
|
+
const objRuntimeAuthSchema = z
|
|
208
|
+
.object({
|
|
209
|
+
strAudience: z.string().trim().min(1),
|
|
210
|
+
strClientId: z.string().trim().min(1),
|
|
211
|
+
strScope: z.string().trim().min(1),
|
|
212
|
+
strSessionStorage: z.enum(['memory', 'session']),
|
|
213
|
+
strSignInPath: z.string().trim().min(1).refine(fnIsHttpOrRelativeUrl),
|
|
214
|
+
strRefreshPath: z.string().trim().min(1).refine(fnIsHttpOrRelativeUrl),
|
|
215
|
+
strSignOutPath: z.string().trim().min(1).refine(fnIsHttpOrRelativeUrl),
|
|
216
|
+
})
|
|
217
|
+
.strict()
|
|
218
|
+
|
|
219
|
+
const objRuntimeObservabilitySchema = z
|
|
220
|
+
.object({
|
|
221
|
+
bEnabled: z.boolean(),
|
|
222
|
+
strEnvironment: z
|
|
223
|
+
.string()
|
|
224
|
+
.trim()
|
|
225
|
+
.regex(/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/i),
|
|
226
|
+
})
|
|
227
|
+
.strict()
|
|
228
|
+
|
|
229
|
+
const objRuntimeLocaleSchema = z
|
|
230
|
+
.object({
|
|
231
|
+
strLocale: z.enum(['en-US', 'zh-CN']),
|
|
232
|
+
strTimeZone: z.string().trim().min(1).refine(fnIsIanaTimeZone),
|
|
233
|
+
})
|
|
234
|
+
.strict()
|
|
235
|
+
|
|
236
|
+
const objRuntimeConfigSchema = z
|
|
237
|
+
.object({
|
|
238
|
+
nSchemaVersion: z.literal(1),
|
|
239
|
+
app: objRuntimeApplicationSchema,
|
|
240
|
+
api: objRuntimeApiSchema,
|
|
241
|
+
auth: objRuntimeAuthSchema,
|
|
242
|
+
locale: objRuntimeLocaleSchema.default({
|
|
243
|
+
strLocale: 'zh-CN',
|
|
244
|
+
strTimeZone: 'Asia/Shanghai',
|
|
245
|
+
}),
|
|
246
|
+
observability: objRuntimeObservabilitySchema.default({
|
|
247
|
+
bEnabled: false,
|
|
248
|
+
strEnvironment: 'local',
|
|
249
|
+
}),
|
|
250
|
+
})
|
|
251
|
+
.strict()
|
|
252
|
+
|
|
253
|
+
let objLoadedRuntimeConfig: IRuntimeConfig | undefined
|
|
254
|
+
|
|
255
|
+
export class RuntimeConfigError extends Error {
|
|
256
|
+
constructor(
|
|
257
|
+
readonly strCode: TRuntimeConfigErrorCode,
|
|
258
|
+
strMessage: string
|
|
259
|
+
) {
|
|
260
|
+
super(strMessage)
|
|
261
|
+
this.name = 'RuntimeConfigError'
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** 校验来自部署环境的公开运行时配置,并冻结全部层级。 */
|
|
266
|
+
export function fnParseRuntimeConfig(objInput: unknown): IRuntimeConfig {
|
|
267
|
+
const objResult = objRuntimeConfigSchema.safeParse(objInput)
|
|
268
|
+
|
|
269
|
+
if (!objResult.success) {
|
|
270
|
+
const strIssues = objResult.error.issues
|
|
271
|
+
.map(
|
|
272
|
+
(objIssue) =>
|
|
273
|
+
`${objIssue.path.join('.') || 'root'}: ${objIssue.message}`
|
|
274
|
+
)
|
|
275
|
+
.join('; ')
|
|
276
|
+
throw new RuntimeConfigError(
|
|
277
|
+
'invalid_config',
|
|
278
|
+
`runtime-config.json 配置不符合契约:${strIssues}`
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const objParsedConfig = objResult.data
|
|
283
|
+
const objApplicationConfig: IRuntimeApplicationConfig = {
|
|
284
|
+
...objParsedConfig.app,
|
|
285
|
+
strBrandId:
|
|
286
|
+
objParsedConfig.app.strBrandId ?? objParsedConfig.app.strStorageNamespace,
|
|
287
|
+
strDarkLogoPath:
|
|
288
|
+
objParsedConfig.app.strDarkLogoPath ?? objParsedConfig.app.strLogoPath,
|
|
289
|
+
strFaviconPath: objParsedConfig.app.strFaviconPath ?? 'favicon.ico',
|
|
290
|
+
}
|
|
291
|
+
const objConfig: IRuntimeConfig = {
|
|
292
|
+
...objParsedConfig,
|
|
293
|
+
app: objApplicationConfig,
|
|
294
|
+
}
|
|
295
|
+
return Object.freeze({
|
|
296
|
+
...objConfig,
|
|
297
|
+
app: Object.freeze({
|
|
298
|
+
...objConfig.app,
|
|
299
|
+
objTheme: Object.freeze({
|
|
300
|
+
objLight: Object.freeze({ ...objConfig.app.objTheme.objLight }),
|
|
301
|
+
objDark: Object.freeze({ ...objConfig.app.objTheme.objDark }),
|
|
302
|
+
}),
|
|
303
|
+
}),
|
|
304
|
+
api: Object.freeze(objConfig.api),
|
|
305
|
+
auth: Object.freeze(objConfig.auth),
|
|
306
|
+
locale: Object.freeze(objConfig.locale),
|
|
307
|
+
observability: Object.freeze(objConfig.observability),
|
|
308
|
+
})
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** 在加载应用模块前获取并校验运行时配置。 */
|
|
312
|
+
export async function fnLoadRuntimeConfig(
|
|
313
|
+
fnFetch: typeof fetch = fetch
|
|
314
|
+
): Promise<IRuntimeConfig> {
|
|
315
|
+
let objResponse: Response
|
|
316
|
+
|
|
317
|
+
try {
|
|
318
|
+
objResponse = await fnFetch(strRuntimeConfigPath, {
|
|
319
|
+
cache: 'no-store',
|
|
320
|
+
credentials: 'same-origin',
|
|
321
|
+
headers: { Accept: 'application/json' },
|
|
322
|
+
})
|
|
323
|
+
} catch {
|
|
324
|
+
throw new RuntimeConfigError(
|
|
325
|
+
'load_failed',
|
|
326
|
+
`无法加载 ${strRuntimeConfigPath},请检查部署文件和网络。`
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (!objResponse.ok) {
|
|
331
|
+
throw new RuntimeConfigError(
|
|
332
|
+
'load_failed',
|
|
333
|
+
`无法加载 ${strRuntimeConfigPath}(HTTP ${objResponse.status})。`
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
let objInput: unknown
|
|
338
|
+
try {
|
|
339
|
+
objInput = await objResponse.json()
|
|
340
|
+
} catch {
|
|
341
|
+
throw new RuntimeConfigError(
|
|
342
|
+
'invalid_json',
|
|
343
|
+
`${strRuntimeConfigPath} 不是有效的 JSON。`
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
objLoadedRuntimeConfig = fnParseRuntimeConfig(objInput)
|
|
348
|
+
return objLoadedRuntimeConfig
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** 仅供运行时配置加载完成后的应用模块读取。 */
|
|
352
|
+
export function fnGetRuntimeConfig(): IRuntimeConfig {
|
|
353
|
+
if (!objLoadedRuntimeConfig) {
|
|
354
|
+
throw new RuntimeConfigError(
|
|
355
|
+
'not_initialized',
|
|
356
|
+
'应用模块加载前必须先初始化运行时配置。'
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
return objLoadedRuntimeConfig
|
|
360
|
+
}
|