@jmruthers/pace-core 0.6.4 → 0.6.6
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/CHANGELOG.md +104 -0
- package/README.md +5 -403
- package/core-usage-manifest.json +93 -0
- package/cursor-rules/00-pace-core-compliance.mdc +128 -26
- package/cursor-rules/01-standards-compliance.mdc +49 -8
- package/cursor-rules/02-project-structure.mdc +6 -0
- package/cursor-rules/03-solid-principles.mdc +2 -0
- package/cursor-rules/04-testing-standards.mdc +2 -0
- package/cursor-rules/05-bug-reports-and-features.mdc +2 -0
- package/cursor-rules/06-code-quality.mdc +2 -0
- package/cursor-rules/07-tech-stack-compliance.mdc +2 -0
- package/cursor-rules/08-markup-quality.mdc +52 -27
- package/cursor-rules/09-rbac-compliance.mdc +462 -0
- package/cursor-rules/10-error-handling-patterns.mdc +179 -0
- package/cursor-rules/11-performance-optimization.mdc +169 -0
- package/cursor-rules/12-ci-cd-integration.mdc +150 -0
- package/dist/{AuthService-Cb34EQs3.d.ts → AuthService-DmfO5rGS.d.ts} +10 -0
- package/dist/{DataTable-BMRU8a1j.d.ts → DataTable-2N_tqbfq.d.ts} +1 -1
- package/dist/DataTable-LRJL4IRV.js +15 -0
- package/dist/{PublicPageProvider-DEMpysFR.d.ts → PublicPageProvider-BBH6Vqg7.d.ts} +72 -139
- package/dist/UnifiedAuthProvider-ZT6TIGM7.js +7 -0
- package/dist/api-Y4MQWOFW.js +4 -0
- package/dist/audit-MYQXYZFU.js +3 -0
- package/dist/{chunk-J36DSWQK.js → chunk-2HGJFNAH.js} +8 -28
- package/dist/{chunk-OEWDTMG7.js → chunk-3O3WHILE.js} +38 -121
- package/dist/{chunk-M43Y4SSO.js → chunk-3QC3KRHK.js} +1 -14
- package/dist/{chunk-DGUM43GV.js → chunk-3RG5ZIWI.js} +1 -4
- package/dist/{chunk-QXHPKYJV.js → chunk-4SXLQIZO.js} +1 -26
- package/dist/chunk-4T7OBVTU.js +62 -0
- package/dist/{chunk-E66EQZE6.js → chunk-6GLLNA6U.js} +3 -9
- package/dist/{chunk-ZSAAAMVR.js → chunk-6QYDGKQY.js} +1 -4
- package/dist/{chunk-NN6WWZ5U.js → chunk-7TYHROIV.js} +579 -563
- package/dist/{chunk-M7MPQISP.js → chunk-A55DK444.js} +9 -16
- package/dist/{chunk-63FOKYGO.js → chunk-AHU7G2R5.js} +2 -11
- package/dist/{chunk-L4OXEN46.js → chunk-BVP2BCJF.js} +2 -16
- package/dist/chunk-C7NSAPTL.js +1 -0
- package/dist/{chunk-YKRAFF5K.js → chunk-FENMYN2U.js} +73 -149
- package/dist/{chunk-AVMLPIM7.js → chunk-FTCRZOG2.js} +284 -432
- package/dist/{chunk-G37KK66H.js → chunk-FYHN4DD5.js} +60 -19
- package/dist/{chunk-VBXEHIUJ.js → chunk-HF6O3O37.js} +6 -88
- package/dist/{chunk-I6DAQMWX.js → chunk-LAZMKTTF.js} +930 -891
- package/dist/{chunk-5EC5MEWX.js → chunk-MAGBIDNS.js} +77 -222
- package/dist/chunk-MBADTM7L.js +64 -0
- package/dist/chunk-OHIK3MIO.js +994 -0
- package/dist/{chunk-6SOIHG6Z.js → chunk-S7DKJPLT.js} +115 -44
- package/dist/{chunk-FMUCXFII.js → chunk-SD6WQY43.js} +1 -5
- package/dist/{chunk-PWLANIRT.js → chunk-TTRFSOKR.js} +1 -7
- package/dist/{chunk-5DRSZLL2.js → chunk-UH3NTO3F.js} +1 -6
- package/dist/{chunk-FFQEQTNW.js → chunk-UIYSCEV7.js} +134 -45
- package/dist/{chunk-3LPHPB62.js → chunk-ZFYPMX46.js} +271 -87
- package/dist/{chunk-7JPAB3T5.js → chunk-ZS5VO5JB.js} +1989 -1283
- package/dist/components.d.ts +6 -6
- package/dist/components.js +57 -267
- package/dist/{database.generated-CzIvgcPu.d.ts → database.generated-CcnC_DRc.d.ts} +4795 -3691
- package/dist/eslint-rules/index.cjs +22 -0
- package/dist/eslint-rules/rules/compliance.cjs +348 -0
- package/dist/eslint-rules/rules/components.cjs +113 -0
- package/dist/eslint-rules/rules/imports.cjs +102 -0
- package/dist/eslint-rules/rules/rbac.cjs +790 -0
- package/dist/eslint-rules/utils/helpers.cjs +42 -0
- package/dist/eslint-rules/utils/manifest-loader.cjs +75 -0
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +62 -270
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/index.d.ts +36 -26
- package/dist/index.js +87 -690
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +8 -35
- package/dist/rbac/eslint-rules.d.ts +46 -44
- package/dist/rbac/eslint-rules.js +7 -4
- package/dist/rbac/index.d.ts +124 -594
- package/dist/rbac/index.js +14 -207
- package/dist/styles/index.js +2 -12
- package/dist/theming/runtime.js +3 -19
- package/dist/{timezone-CHhWg6b4.d.ts → timezone-BZe_eUxx.d.ts} +175 -1
- package/dist/{types-CkbwOr4Y.d.ts → types-B-K_5VnO.d.ts} +4 -0
- package/dist/types-t9H8qKRw.d.ts +55 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +7 -94
- package/dist/{usePublicRouteParams-i3qtoBgg.d.ts → usePublicRouteParams-COZ28Mvq.d.ts} +9 -9
- package/dist/utils.d.ts +24 -117
- package/dist/utils.js +54 -392
- package/docs/README.md +16 -6
- package/docs/api/README.md +4 -402
- package/docs/api/modules.md +454 -930
- package/docs/api-reference/components.md +3 -1
- package/docs/api-reference/deprecated.md +31 -6
- package/docs/api-reference/rpc-functions.md +78 -3
- package/docs/best-practices/accessibility.md +6 -3
- package/docs/getting-started/cursor-rules.md +3 -23
- package/docs/getting-started/dependencies.md +650 -0
- package/docs/getting-started/installation-guide.md +20 -7
- package/docs/getting-started/quick-start.md +23 -12
- package/docs/implementation-guides/permission-enforcement.md +4 -0
- package/docs/rbac/MIGRATION_GUIDE.md +819 -0
- package/docs/rbac/RBAC_CONTRACT.md +724 -0
- package/docs/rbac/README.md +12 -3
- package/docs/rbac/edge-functions-guide.md +376 -0
- package/docs/rbac/secure-client-protection.md +0 -34
- package/docs/standards/00-pace-core-compliance.md +967 -0
- package/docs/standards/01-standards-compliance.md +188 -0
- package/docs/standards/02-project-structure.md +985 -0
- package/docs/standards/03-solid-principles.md +39 -0
- package/docs/standards/04-testing-standards.md +36 -0
- package/docs/standards/05-bug-reports-and-features.md +27 -0
- package/docs/standards/{04-code-style-standard.md → 06-code-quality.md} +2 -0
- package/docs/standards/07-tech-stack-compliance.md +30 -0
- package/docs/standards/08-markup-quality.md +345 -0
- package/docs/standards/{07-rbac-and-rls-standard.md → 09-rbac-compliance.md} +149 -54
- package/docs/standards/10-error-handling-patterns.md +401 -0
- package/docs/standards/11-performance-optimization.md +348 -0
- package/docs/standards/12-ci-cd-integration.md +370 -0
- package/docs/standards/ALIGNMENT_REVIEW_SUMMARY.md +192 -0
- package/docs/standards/README.md +62 -33
- package/docs/troubleshooting/organisation-context-setup.md +42 -19
- package/eslint-config-pace-core.cjs +20 -4
- package/package.json +31 -21
- package/scripts/audit/audit-compliance.cjs +1295 -0
- package/scripts/audit/audit-components.cjs +260 -0
- package/scripts/audit/audit-dependencies.cjs +395 -0
- package/scripts/audit/audit-rbac.cjs +954 -0
- package/scripts/audit/audit-standards.cjs +1268 -0
- package/scripts/audit/index.cjs +1898 -194
- package/scripts/install-cursor-rules.cjs +259 -8
- package/scripts/validate-master.js +1 -1
- package/src/__tests__/fixtures/supabase.ts +1 -1
- package/src/__tests__/helpers/__tests__/component-test-utils.test.tsx +1 -1
- package/src/__tests__/helpers/__tests__/optimized-test-setup.test.ts +1 -1
- package/src/__tests__/helpers/__tests__/supabaseMock.test.ts +1 -1
- package/src/__tests__/helpers/__tests__/test-utils.test.tsx +3 -3
- package/src/__tests__/helpers/component-test-utils.tsx +1 -1
- package/src/__tests__/helpers/supabaseMock.ts +2 -2
- package/src/__tests__/public-recipe-view.test.ts +38 -9
- package/src/components/Button/Button.tsx +5 -1
- package/src/components/ContextSelector/ContextSelector.tsx +42 -39
- package/src/components/DataTable/__tests__/keyboard.test.tsx +15 -2
- package/src/components/DataTable/components/DataTableBody.tsx +55 -31
- package/src/components/DataTable/components/DataTableCore.tsx +186 -13
- package/src/components/DataTable/components/DataTableLayout.tsx +30 -5
- package/src/components/DataTable/components/EditFields.tsx +23 -3
- package/src/components/DataTable/components/EditableRow.tsx +7 -2
- package/src/components/DataTable/components/ImportModal.tsx +4 -6
- package/src/components/DataTable/components/RowComponent.tsx +12 -0
- package/src/components/DataTable/components/ViewRowModal.tsx +4 -4
- package/src/components/DataTable/components/__tests__/ImportModal.test.tsx +455 -96
- package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +122 -58
- package/src/components/DataTable/components/hooks/usePermissionTracking.ts +0 -4
- package/src/components/DataTable/core/DataTableContext.tsx +1 -1
- package/src/components/DataTable/hooks/__tests__/useDataTableState.test.ts +51 -47
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +24 -21
- package/src/components/DataTable/hooks/useDataTableState.ts +125 -9
- package/src/components/DataTable/hooks/useTableColumns.ts +40 -2
- package/src/components/DataTable/hooks/useTableHandlers.ts +11 -0
- package/src/components/DataTable/types.ts +5 -0
- package/src/components/DateTimeField/DateTimeField.tsx +20 -20
- package/src/components/DateTimeField/README.md +5 -2
- package/src/components/Dialog/Dialog.test.tsx +361 -318
- package/src/components/Dialog/Dialog.tsx +1154 -323
- package/src/components/Dialog/index.ts +3 -3
- package/src/components/FileDisplay/FileDisplay.test.tsx +45 -2
- package/src/components/FileDisplay/FileDisplay.tsx +28 -22
- package/src/components/Form/Form.test.tsx +9 -10
- package/src/components/Form/Form.tsx +369 -9
- package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +28 -28
- package/src/components/InactivityWarningModal/InactivityWarningModal.tsx +40 -54
- package/src/components/LoginForm/LoginForm.tsx +2 -2
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +14 -13
- package/src/components/NavigationMenu/NavigationMenu.tsx +2 -2
- package/src/components/NavigationMenu/useNavigationFiltering.ts +11 -21
- package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +6 -4
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +30 -41
- package/src/components/PaceAppLayout/README.md +10 -9
- package/src/components/PaceAppLayout/test-setup.tsx +40 -31
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +108 -61
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +27 -3
- package/src/components/PasswordChange/PasswordChangeForm.test.tsx +61 -0
- package/src/components/PasswordChange/PasswordChangeForm.tsx +20 -13
- package/src/components/PublicLayout/PublicLayout.test.tsx +7 -3
- package/src/components/PublicLayout/PublicPageLayout.tsx +5 -8
- package/src/components/Select/Select.tsx +23 -21
- package/src/components/Select/types.ts +1 -1
- package/src/components/UserMenu/UserMenu.test.tsx +38 -6
- package/src/components/UserMenu/UserMenu.tsx +39 -34
- package/src/components/index.ts +3 -4
- package/src/eslint-rules/index.cjs +22 -0
- package/src/eslint-rules/rules/compliance.cjs +348 -0
- package/src/eslint-rules/rules/components.cjs +113 -0
- package/src/eslint-rules/rules/imports.cjs +102 -0
- package/src/eslint-rules/rules/rbac.cjs +790 -0
- package/src/eslint-rules/utils/helpers.cjs +42 -0
- package/src/eslint-rules/utils/manifest-loader.cjs +75 -0
- package/src/hooks/__tests__/hooks.integration.test.tsx +6 -8
- package/src/hooks/__tests__/useAppConfig.unit.test.ts +129 -67
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +149 -67
- package/src/hooks/__tests__/usePublicEvent.test.ts +149 -79
- package/src/hooks/__tests__/usePublicEvent.unit.test.ts +158 -109
- package/src/hooks/__tests__/useSessionDraft.test.ts +163 -0
- package/src/hooks/__tests__/useSessionRestoration.unit.test.tsx +10 -5
- package/src/hooks/public/usePublicEvent.ts +62 -190
- package/src/hooks/public/usePublicEventLogo.test.ts +70 -17
- package/src/hooks/public/usePublicEventLogo.ts +19 -9
- package/src/hooks/useAppConfig.ts +26 -24
- package/src/hooks/useEventTheme.test.ts +211 -233
- package/src/hooks/useEventTheme.ts +19 -28
- package/src/hooks/useEvents.ts +11 -7
- package/src/hooks/useKeyboardShortcuts.ts +1 -1
- package/src/hooks/useOrganisationPermissions.ts +9 -11
- package/src/hooks/useOrganisations.ts +13 -7
- package/src/hooks/useQueryCache.ts +0 -1
- package/src/hooks/useSessionDraft.ts +380 -0
- package/src/hooks/useSessionRestoration.ts +3 -1
- package/src/icons/index.ts +27 -0
- package/src/index.ts +16 -1
- package/src/providers/OrganisationProvider.tsx +23 -14
- package/src/providers/services/EventServiceProvider.tsx +1 -24
- package/src/providers/services/UnifiedAuthProvider.tsx +5 -48
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +3 -0
- package/src/rbac/README.md +20 -20
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +7 -457
- package/src/rbac/__tests__/auth-rbac.e2e.test.tsx +33 -7
- package/src/rbac/adapters.tsx +7 -295
- package/src/rbac/api.test.ts +44 -56
- package/src/rbac/api.ts +10 -17
- package/src/rbac/cache-invalidation.ts +0 -1
- package/src/rbac/compliance/index.ts +10 -0
- package/src/rbac/compliance/pattern-detector.ts +553 -0
- package/src/rbac/compliance/runtime-compliance.ts +22 -0
- package/src/rbac/components/AccessDenied.tsx +150 -0
- package/src/rbac/components/NavigationGuard.tsx +12 -20
- package/src/rbac/components/PagePermissionGuard.tsx +4 -24
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +21 -8
- package/src/rbac/components/index.ts +3 -41
- package/src/rbac/eslint-rules.js +1 -1
- package/src/rbac/hooks/index.ts +0 -3
- package/src/rbac/hooks/permissions/index.ts +0 -3
- package/src/rbac/hooks/permissions/useAccessLevel.ts +4 -8
- package/src/rbac/hooks/usePermissions.ts +0 -3
- package/src/rbac/hooks/useRBAC.test.ts +21 -3
- package/src/rbac/hooks/useRBAC.ts +4 -3
- package/src/rbac/hooks/useResolvedScope.test.ts +57 -47
- package/src/rbac/hooks/useResolvedScope.ts +58 -140
- package/src/rbac/hooks/useResourcePermissions.test.ts +241 -60
- package/src/rbac/hooks/useResourcePermissions.ts +182 -63
- package/src/rbac/hooks/useRoleManagement.test.ts +65 -22
- package/src/rbac/hooks/useRoleManagement.ts +147 -19
- package/src/rbac/hooks/useSecureSupabase.ts +4 -8
- package/src/rbac/index.ts +7 -9
- package/src/rbac/permissions.ts +17 -17
- package/src/rbac/utils/contextValidator.ts +45 -7
- package/src/services/AuthService.ts +132 -23
- package/src/services/EventService.ts +4 -97
- package/src/services/InactivityService.ts +155 -58
- package/src/services/OrganisationService.ts +7 -44
- package/src/services/__tests__/OrganisationService.test.ts +26 -8
- package/src/services/base/BaseService.ts +0 -3
- package/src/styles/core.css +4 -0
- package/src/types/database.generated.ts +4733 -3809
- package/src/utils/__tests__/organisationContext.unit.test.ts +9 -10
- package/src/utils/context/organisationContext.test.ts +13 -28
- package/src/utils/context/organisationContext.ts +21 -52
- package/src/utils/dynamic/dynamicUtils.ts +1 -1
- package/src/utils/file-reference/index.ts +39 -15
- package/src/utils/formatting/formatDateTime.test.ts +3 -2
- package/src/utils/formatting/formatTime.test.ts +3 -2
- package/src/utils/google-places/loadGoogleMapsScript.ts +29 -4
- package/src/utils/index.ts +4 -1
- package/src/utils/persistence/__tests__/keyDerivation.test.ts +135 -0
- package/src/utils/persistence/__tests__/sensitiveFieldDetection.test.ts +123 -0
- package/src/utils/persistence/keyDerivation.ts +304 -0
- package/src/utils/persistence/sensitiveFieldDetection.ts +212 -0
- package/src/utils/security/secureStorage.ts +5 -5
- package/src/utils/storage/helpers.ts +3 -3
- package/src/utils/supabase/createBaseClient.ts +147 -0
- package/src/utils/timezone/timezone.test.ts +1 -2
- package/src/utils/timezone/timezone.ts +1 -1
- package/src/utils/validation/csrf.ts +4 -4
- package/cursor-rules/CHANGELOG.md +0 -119
- package/cursor-rules/README.md +0 -192
- package/dist/DataTable-E7YQZD7D.js +0 -175
- package/dist/DataTable-E7YQZD7D.js.map +0 -1
- package/dist/UnifiedAuthProvider-QPXO24B4.js +0 -18
- package/dist/UnifiedAuthProvider-QPXO24B4.js.map +0 -1
- package/dist/api-6LVZTHDS.js +0 -52
- package/dist/api-6LVZTHDS.js.map +0 -1
- package/dist/audit-V53FV5AG.js +0 -17
- package/dist/audit-V53FV5AG.js.map +0 -1
- package/dist/chunk-36LVWXB2.js +0 -227
- package/dist/chunk-36LVWXB2.js.map +0 -1
- package/dist/chunk-3LPHPB62.js.map +0 -1
- package/dist/chunk-5DRSZLL2.js.map +0 -1
- package/dist/chunk-5EC5MEWX.js.map +0 -1
- package/dist/chunk-63FOKYGO.js.map +0 -1
- package/dist/chunk-6SOIHG6Z.js.map +0 -1
- package/dist/chunk-7JPAB3T5.js.map +0 -1
- package/dist/chunk-ATKZM7RX.js +0 -2053
- package/dist/chunk-ATKZM7RX.js.map +0 -1
- package/dist/chunk-AVMLPIM7.js.map +0 -1
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-E66EQZE6.js.map +0 -1
- package/dist/chunk-FFQEQTNW.js.map +0 -1
- package/dist/chunk-FMUCXFII.js.map +0 -1
- package/dist/chunk-G37KK66H.js.map +0 -1
- package/dist/chunk-I6DAQMWX.js.map +0 -1
- package/dist/chunk-J36DSWQK.js.map +0 -1
- package/dist/chunk-KQCRWDSA.js +0 -1
- package/dist/chunk-KQCRWDSA.js.map +0 -1
- package/dist/chunk-L4OXEN46.js.map +0 -1
- package/dist/chunk-LMC26NLJ.js +0 -84
- package/dist/chunk-LMC26NLJ.js.map +0 -1
- package/dist/chunk-M43Y4SSO.js.map +0 -1
- package/dist/chunk-M7MPQISP.js.map +0 -1
- package/dist/chunk-NN6WWZ5U.js.map +0 -1
- package/dist/chunk-OEWDTMG7.js.map +0 -1
- package/dist/chunk-PWLANIRT.js.map +0 -1
- package/dist/chunk-QXHPKYJV.js.map +0 -1
- package/dist/chunk-VBXEHIUJ.js.map +0 -1
- package/dist/chunk-YKRAFF5K.js.map +0 -1
- package/dist/chunk-ZSAAAMVR.js.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/contextValidator-OOPCLPZW.js +0 -9
- package/dist/contextValidator-OOPCLPZW.js.map +0 -1
- package/dist/eslint-rules/pace-core-compliance.cjs +0 -510
- package/dist/hooks.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/providers.js.map +0 -1
- package/dist/rbac/eslint-rules.js.map +0 -1
- package/dist/rbac/index.js.map +0 -1
- package/dist/styles/index.js.map +0 -1
- package/dist/theming/runtime.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/docs/standards/01-architecture-standard.md +0 -44
- package/docs/standards/02-api-and-rpc-standard.md +0 -39
- package/docs/standards/03-component-standard.md +0 -32
- package/docs/standards/05-security-standard.md +0 -44
- package/docs/standards/06-testing-and-docs-standard.md +0 -29
- package/docs/standards/pace-core-compliance.md +0 -432
- package/scripts/audit/core/checks/accessibility.cjs +0 -197
- package/scripts/audit/core/checks/api-usage.cjs +0 -191
- package/scripts/audit/core/checks/bundle.cjs +0 -142
- package/scripts/audit/core/checks/compliance.cjs +0 -2706
- package/scripts/audit/core/checks/config.cjs +0 -54
- package/scripts/audit/core/checks/coverage.cjs +0 -84
- package/scripts/audit/core/checks/dependencies.cjs +0 -994
- package/scripts/audit/core/checks/documentation.cjs +0 -268
- package/scripts/audit/core/checks/environment.cjs +0 -116
- package/scripts/audit/core/checks/error-handling.cjs +0 -340
- package/scripts/audit/core/checks/forms.cjs +0 -172
- package/scripts/audit/core/checks/heuristics.cjs +0 -68
- package/scripts/audit/core/checks/hooks.cjs +0 -334
- package/scripts/audit/core/checks/imports.cjs +0 -244
- package/scripts/audit/core/checks/performance.cjs +0 -325
- package/scripts/audit/core/checks/routes.cjs +0 -117
- package/scripts/audit/core/checks/state.cjs +0 -130
- package/scripts/audit/core/checks/structure.cjs +0 -65
- package/scripts/audit/core/checks/style.cjs +0 -584
- package/scripts/audit/core/checks/testing.cjs +0 -122
- package/scripts/audit/core/checks/typescript.cjs +0 -61
- package/scripts/audit/core/scanner.cjs +0 -199
- package/scripts/audit/core/utils.cjs +0 -137
- package/scripts/audit/reporters/console.cjs +0 -151
- package/scripts/audit/reporters/json.cjs +0 -54
- package/scripts/audit/reporters/markdown.cjs +0 -124
- package/scripts/audit-consuming-app.cjs +0 -86
- package/src/eslint-rules/pace-core-compliance.cjs +0 -510
- package/src/eslint-rules/pace-core-compliance.js +0 -638
- package/src/rbac/components/EnhancedNavigationMenu.test.tsx +0 -555
- package/src/rbac/components/EnhancedNavigationMenu.tsx +0 -293
- package/src/rbac/components/NavigationProvider.test.tsx +0 -481
- package/src/rbac/components/NavigationProvider.tsx +0 -345
- package/src/rbac/components/PagePermissionProvider.test.tsx +0 -476
- package/src/rbac/components/PagePermissionProvider.tsx +0 -279
- package/src/rbac/components/PermissionEnforcer.tsx +0 -312
- package/src/rbac/components/RoleBasedRouter.tsx +0 -440
- package/src/rbac/components/SecureDataProvider.test.tsx +0 -543
- package/src/rbac/components/SecureDataProvider.tsx +0 -339
- package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +0 -620
- package/src/rbac/components/__tests__/NavigationProvider.test.tsx +0 -726
- package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +0 -661
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +0 -881
- package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +0 -783
- package/src/rbac/components/__tests__/SecureDataProvider.fixed.test.tsx +0 -645
- package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +0 -659
- package/src/rbac/hooks/permissions/useCachedPermissions.ts +0 -79
- package/src/rbac/hooks/permissions/useHasAllPermissions.ts +0 -90
- package/src/rbac/hooks/permissions/useHasAnyPermission.ts +0 -90
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Architecture & SOLID Standard
|
|
2
|
+
|
|
3
|
+
**🤖 Cursor Rule**: See [03-solid-principles.mdc](../../cursor-rules/03-solid-principles.mdc) for AI-optimized directives that automatically enforce SOLID principles.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
Define the core architectural principles and SOLID expectations for pace-core and consuming apps so components, APIs, and utilities evolve consistently and sustainably.
|
|
7
|
+
|
|
8
|
+
## Architectural Principles
|
|
9
|
+
- Composition over complexity
|
|
10
|
+
- Separation of concerns
|
|
11
|
+
- Domain-agnostic core
|
|
12
|
+
- Extensible, stable APIs
|
|
13
|
+
- Secure by default
|
|
14
|
+
- Performance-conscious
|
|
15
|
+
|
|
16
|
+
## SOLID Principles (Cursor enforcement)
|
|
17
|
+
- **Single Responsibility**: Each module has one reason to change; extract complex logic to hooks/services.
|
|
18
|
+
- **Open/Closed**: Extend via composition/configuration, avoid modifying shared primitives.
|
|
19
|
+
- **Liskov Substitution**: Derived types/components must satisfy the base contract.
|
|
20
|
+
- **Interface Segregation**: Prefer focused interfaces/props over catch-all configs.
|
|
21
|
+
- **Dependency Inversion**: Depend on abstractions (types/interfaces); inject implementations.
|
|
22
|
+
|
|
23
|
+
## Performance & RLS Boundaries
|
|
24
|
+
- **RLS helper use**: Policies must rely on helper functions (no subqueries) to avoid N+1/per-row overhead.
|
|
25
|
+
- **Test migrations**: Verify DB migrations for performance regressions and timeouts.
|
|
26
|
+
- **Monitor queries**: Use EXPLAIN/Advisors to ensure policies don’t introduce InitPlan nodes.
|
|
27
|
+
|
|
28
|
+
## In/Out of Scope
|
|
29
|
+
**In scope**: UI primitives, generic hooks, shared API patterns, error-handling conventions, RPC shape conventions.
|
|
30
|
+
**Out of scope**: App/domain-specific logic, app-specific styling, business workflows.
|
|
31
|
+
|
|
32
|
+
## Precedence
|
|
33
|
+
1) Security 2) API/RPC 3) Components 4) Code Style 5) Testing 6) Documentation.
|
|
34
|
+
|
|
35
|
+
## Cursor Checklist
|
|
36
|
+
- Changes fit boundaries (no domain logic in core primitives).
|
|
37
|
+
- Follow SOLID guidance above.
|
|
38
|
+
- Prefer additive changes; avoid breaking contracts.
|
|
39
|
+
- Keep helpers small, pure, and typed.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Testing & Documentation Standard
|
|
2
|
+
|
|
3
|
+
**🤖 Cursor Rule**: See [04-testing-standards.mdc](../../cursor-rules/04-testing-standards.mdc) for AI-optimized directives that automatically enforce testing standards.
|
|
4
|
+
|
|
5
|
+
## Testing Strategy
|
|
6
|
+
- Unit tests for utils & hooks
|
|
7
|
+
- Integration tests for components
|
|
8
|
+
- Few meaningful E2E tests (in consuming apps)
|
|
9
|
+
- Coverage: ≥90% utils, ≥70% components
|
|
10
|
+
|
|
11
|
+
## Test Structure
|
|
12
|
+
- Colocated tests (*.test.ts/tsx)
|
|
13
|
+
- Use RTL + userEvent
|
|
14
|
+
- Avoid unnecessary mocks
|
|
15
|
+
|
|
16
|
+
## Documentation Requirements
|
|
17
|
+
- Component READMEs
|
|
18
|
+
- API docs
|
|
19
|
+
- Standards directory
|
|
20
|
+
|
|
21
|
+
## Required Sections (for every component/API doc)
|
|
22
|
+
- Overview
|
|
23
|
+
- API/Props
|
|
24
|
+
- Examples
|
|
25
|
+
- A11y notes
|
|
26
|
+
- Edge cases
|
|
27
|
+
|
|
28
|
+
## When to update docs
|
|
29
|
+
- New component or API surface: add README + API entry with all required sections.
|
|
30
|
+
- Behavior/prop change: update README/API entry and add migration notes if breaking.
|
|
31
|
+
- Bug fix: document the fixed behavior when it changes user-facing expectations.
|
|
32
|
+
|
|
33
|
+
## Cursor Checklist
|
|
34
|
+
- Update docs after API or behavior changes (follow \"When to update docs\").
|
|
35
|
+
- Ensure tests cover critical paths
|
|
36
|
+
- Use RTL patterns only
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Bug Reports and Feature Requests
|
|
2
|
+
|
|
3
|
+
**🤖 Cursor Rule**: See [05-bug-reports-and-features.mdc](../../cursor-rules/05-bug-reports-and-features.mdc) for AI-optimized templates and guidance.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
Standardize how issues and feature requests are captured for pace-core and consuming apps.
|
|
7
|
+
|
|
8
|
+
## Bug Report Template
|
|
9
|
+
- Description of bug and expected vs actual behavior.
|
|
10
|
+
- Steps to reproduce (minimal, ordered).
|
|
11
|
+
- Minimal reproduction (link/snippet).
|
|
12
|
+
- Environment (pace-core version, React, Node, browser, OS).
|
|
13
|
+
- Error messages/logs.
|
|
14
|
+
- Additional context (screenshots/video).
|
|
15
|
+
|
|
16
|
+
## Feature Request Template
|
|
17
|
+
- Feature description and problem statement.
|
|
18
|
+
- Proposed solution/API.
|
|
19
|
+
- Use case with real scenario.
|
|
20
|
+
- Alternatives considered.
|
|
21
|
+
- Example code snippet.
|
|
22
|
+
- Additional context/mockups.
|
|
23
|
+
|
|
24
|
+
## Cursor Checklist
|
|
25
|
+
- Confirm issue belongs to pace-core vs consuming app.
|
|
26
|
+
- Include minimal reproduction and environment.
|
|
27
|
+
- Use templates above when drafting issues.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# TypeScript & Code Style Standard
|
|
2
2
|
|
|
3
|
+
**🤖 Cursor Rule**: See [06-code-quality.mdc](../../cursor-rules/06-code-quality.mdc) for AI-optimized directives that automatically enforce code quality standards.
|
|
4
|
+
|
|
3
5
|
## TypeScript Rules
|
|
4
6
|
- No any
|
|
5
7
|
- Prefer discriminated unions
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Tech Stack & API/RPC Standard
|
|
2
|
+
|
|
3
|
+
**🤖 Cursor Rule**: See [07-tech-stack-compliance.mdc](../../cursor-rules/07-tech-stack-compliance.mdc) for AI-optimized directives that automatically enforce tech stack compliance.
|
|
4
|
+
|
|
5
|
+
## Required Stack
|
|
6
|
+
- **React 19+**, functional components only.
|
|
7
|
+
- **TypeScript 5+** with `strict` enabled.
|
|
8
|
+
- **Vite** for tooling; use `import.meta.env`.
|
|
9
|
+
- **Tailwind v4** CSS-first with `app.css` scaffold (see 08-markup-quality).
|
|
10
|
+
- **Supabase** via secure clients/hooks (`useSecureSupabase`); never bypass RLS.
|
|
11
|
+
- **TanStack Query** for server state.
|
|
12
|
+
- **React Hook Form + Zod** (prefer `useZodForm` from pace-core) for forms.
|
|
13
|
+
|
|
14
|
+
## API & RPC Rules
|
|
15
|
+
- Naming: `<family>_<domain>_<verb>` (e.g., `data_cake_dishes_list`, `app_cake_dish_create`, `_bulk` for bulk).
|
|
16
|
+
- Shape:
|
|
17
|
+
```ts
|
|
18
|
+
type ApiResult<T> =
|
|
19
|
+
| { ok: true; data: T }
|
|
20
|
+
| { ok: false; error: ApiError };
|
|
21
|
+
```
|
|
22
|
+
- Read RPCs never mutate; writes idempotent when possible.
|
|
23
|
+
- Never accept dynamic SQL; enforce RLS + tenant boundaries; errors must be user-safe.
|
|
24
|
+
- Deprecation: mark with `@deprecated`; retirement window = 2 stable releases.
|
|
25
|
+
|
|
26
|
+
## Cursor Checklist
|
|
27
|
+
- Use the required stack (React 19+, TS strict, Vite, Tailwind v4 scaffold, Supabase secure client, TanStack Query, RHF + Zod).
|
|
28
|
+
- Enforce ApiResult shape and naming rules.
|
|
29
|
+
- Do not bypass RLS; avoid overlapping/redundant RPCs.
|
|
30
|
+
- Ensure idempotency for writes; avoid dynamic SQL.
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# Styling Standard for Consuming Apps
|
|
2
|
+
|
|
3
|
+
**🤖 Cursor Rule**: See [08-markup-quality.mdc](../../cursor-rules/08-markup-quality.mdc) for AI-optimized directives that automatically enforce markup quality (this rule is ALWAYS APPLIED).
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This standard defines the **REQUIRED** configuration for consuming apps to properly use pace-core styling. Adhering to this standard ensures:
|
|
8
|
+
|
|
9
|
+
- ✅ pace-core components render with correct styles
|
|
10
|
+
- ✅ Colors, typography, and spacing work correctly
|
|
11
|
+
- ✅ Tailwind v4 content scanning works properly
|
|
12
|
+
- ✅ Consistent styling across all PACE suite applications
|
|
13
|
+
|
|
14
|
+
## Component & Markup Guidance (aligns with Cursor rules)
|
|
15
|
+
- Components should be stateless when possible, fully typed, and accessibility-first.
|
|
16
|
+
- Prefer semantic HTML elements; use `<div>` only when no semantic element fits or when required by a library.
|
|
17
|
+
- Use React Fragments for grouping instead of wrapper nodes; keep markup minimal and avoid wrappers solely for styling.
|
|
18
|
+
- No inline styles; rely on pace-core variants and Tailwind utilities (layout/spacing) using theme tokens (`main-*`, `sec-*`, `acc-*`, semantic tokens).
|
|
19
|
+
- No arbitrary Tailwind colors or bracket syntax—use approved theme tokens only.
|
|
20
|
+
- Apply layout utilities to existing semantic parents or pace-core layout components.
|
|
21
|
+
|
|
22
|
+
### Component Principles
|
|
23
|
+
- Stateless when possible; keep surface area small and composable.
|
|
24
|
+
- Accessible by default with correct roles, keyboard support, and visible focus.
|
|
25
|
+
- UI primitives only; never add domain logic or data fetching inside components.
|
|
26
|
+
- Support controlled + uncontrolled usage where applicable.
|
|
27
|
+
|
|
28
|
+
### Testing Expectations
|
|
29
|
+
- Use React Testing Library + userEvent.
|
|
30
|
+
- Test key interactions; snapshots only for simple components.
|
|
31
|
+
- Keep components small—move non-UI logic to hooks/services.
|
|
32
|
+
|
|
33
|
+
## ⚠️ CRITICAL: Required Configuration
|
|
34
|
+
|
|
35
|
+
**Without proper configuration, pace-core components will appear unstyled or with incorrect styling.**
|
|
36
|
+
|
|
37
|
+
## Two-File CSS Architecture
|
|
38
|
+
|
|
39
|
+
pace-core uses a two-file CSS architecture:
|
|
40
|
+
|
|
41
|
+
1. **`@jmruthers/pace-core/styles/core.css`** - Core foundation (fonts, resets, typography, component styles)
|
|
42
|
+
2. **`src/app.css`** - App-specific configuration (color palettes, source directives)
|
|
43
|
+
|
|
44
|
+
## Required File: `src/app.css`
|
|
45
|
+
|
|
46
|
+
**MUST** create `src/app.css` in your consuming app with the following structure:
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
@import "tailwindcss";
|
|
50
|
+
|
|
51
|
+
/* @source directives for Tailwind v4 content scanning */
|
|
52
|
+
/* CRITICAL: Paths are relative to the CSS file location (src/app.css) */
|
|
53
|
+
@source "./**/*.{js,ts,jsx,tsx}";
|
|
54
|
+
@source "../node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}";
|
|
55
|
+
|
|
56
|
+
/* Import pace-core CSS files so Tailwind processes them */
|
|
57
|
+
/* CRITICAL: Must use package path, not /src/styles/ path */
|
|
58
|
+
@import "@jmruthers/pace-core/styles/core.css";
|
|
59
|
+
|
|
60
|
+
@theme static {
|
|
61
|
+
/* Your app's color palettes here */
|
|
62
|
+
/* See Color Palette Requirements below */
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## ⚠️ CRITICAL: @source Directive Paths
|
|
67
|
+
|
|
68
|
+
**The @source directive paths are relative to the CSS file location, not the project root.**
|
|
69
|
+
|
|
70
|
+
Since `app.css` is in `src/app.css`, the paths MUST be:
|
|
71
|
+
|
|
72
|
+
### ✅ CORRECT Patterns
|
|
73
|
+
|
|
74
|
+
```css
|
|
75
|
+
/* For app source files (relative to src/) */
|
|
76
|
+
@source "./**/*.{js,ts,jsx,tsx}";
|
|
77
|
+
|
|
78
|
+
/* For pace-core (one level up from src/ to project root, then into node_modules) */
|
|
79
|
+
@source "../node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}";
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### ❌ WRONG Patterns
|
|
83
|
+
|
|
84
|
+
```css
|
|
85
|
+
/* ❌ WRONG: Two levels up for node_modules (only needed if app.css is nested deeper) */
|
|
86
|
+
@source "../../node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}";
|
|
87
|
+
|
|
88
|
+
/* ❌ WRONG: Using ../src/ when app.css is already in src/ */
|
|
89
|
+
@source "../src/**/*.{js,ts,jsx,tsx}";
|
|
90
|
+
|
|
91
|
+
/* ❌ WRONG: Using ./src/ when app.css is already in src/ */
|
|
92
|
+
@source "./src/**/*.{js,ts,jsx,tsx}";
|
|
93
|
+
|
|
94
|
+
/* ❌ WRONG: Using project root paths (paths are relative to CSS file) */
|
|
95
|
+
@source "./node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}";
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Path Resolution Logic
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Project Structure:
|
|
102
|
+
your-app/
|
|
103
|
+
├── src/
|
|
104
|
+
│ └── app.css ← CSS file is here
|
|
105
|
+
├── node_modules/
|
|
106
|
+
│ └── @jmruthers/
|
|
107
|
+
│ └── pace-core/
|
|
108
|
+
│ └── src/ ← pace-core source is here
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**From `src/app.css`:**
|
|
112
|
+
- To scan app source: `./**/*.{js,ts,jsx,tsx}` (current directory = src/)
|
|
113
|
+
- To scan pace-core: `../node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}` (up one level to project root, then into node_modules)
|
|
114
|
+
|
|
115
|
+
## ⚠️ CRITICAL: CSS Import Path
|
|
116
|
+
|
|
117
|
+
**MUST** use the package path, not the source path:
|
|
118
|
+
|
|
119
|
+
### ✅ CORRECT
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
@import "@jmruthers/pace-core/styles/core.css";
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### ❌ WRONG
|
|
126
|
+
|
|
127
|
+
```css
|
|
128
|
+
/* ❌ WRONG: Don't use /src/styles/ path */
|
|
129
|
+
@import "@jmruthers/pace-core/src/styles/core.css";
|
|
130
|
+
|
|
131
|
+
/* ❌ WRONG: Don't import in main.tsx (import in app.css instead) */
|
|
132
|
+
/* In main.tsx: */
|
|
133
|
+
import '@jmruthers/pace-core/styles/core.css'; /* ❌ WRONG */
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Required Color Palettes
|
|
137
|
+
|
|
138
|
+
**MUST** define three complete color palettes in `@theme static`:
|
|
139
|
+
|
|
140
|
+
```css
|
|
141
|
+
@theme static {
|
|
142
|
+
/* Main palette - Primary brand color (all shades 50-950 required) */
|
|
143
|
+
--color-main-raw: oklch(0.58 0.23 300);
|
|
144
|
+
--color-main-50: oklch(0.98 0.003 300);
|
|
145
|
+
--color-main-100: oklch(0.96 0.014 300);
|
|
146
|
+
--color-main-200: oklch(0.927 0.033 300);
|
|
147
|
+
--color-main-300: oklch(0.881 0.059 300);
|
|
148
|
+
--color-main-400: oklch(0.822 0.093 300);
|
|
149
|
+
--color-main-500: oklch(0.75 0.133 300);
|
|
150
|
+
--color-main-600: oklch(0.665 0.182 300);
|
|
151
|
+
--color-main-700: oklch(0.58 0.23 300);
|
|
152
|
+
--color-main-800: oklch(0.456 0.158 300);
|
|
153
|
+
--color-main-900: oklch(0.332 0.099 300);
|
|
154
|
+
--color-main-950: oklch(0.195 0.047 300);
|
|
155
|
+
|
|
156
|
+
/* Secondary palette - Supporting color (all shades 50-950 required) */
|
|
157
|
+
--color-sec-raw: oklch(0.675 0.169 244.75);
|
|
158
|
+
--color-sec-50: oklch(0.98 0.003 244.75);
|
|
159
|
+
--color-sec-100: oklch(0.96 0.014 244.75);
|
|
160
|
+
--color-sec-200: oklch(0.927 0.032 244.75);
|
|
161
|
+
--color-sec-300: oklch(0.881 0.057 244.75);
|
|
162
|
+
--color-sec-400: oklch(0.822 0.089 244.75);
|
|
163
|
+
--color-sec-500: oklch(0.75 0.128 244.75);
|
|
164
|
+
--color-sec-600: oklch(0.675 0.169 244.75);
|
|
165
|
+
--color-sec-700: oklch(0.567 0.134 244.75);
|
|
166
|
+
--color-sec-800: oklch(0.456 0.101 244.75);
|
|
167
|
+
--color-sec-900: oklch(0.332 0.068 244.75);
|
|
168
|
+
--color-sec-950: oklch(0.195 0.037 244.75);
|
|
169
|
+
|
|
170
|
+
/* Accent palette - Highlight color (all shades 50-950 required) */
|
|
171
|
+
--color-acc-raw: oklch(0.64 0.23 7.385);
|
|
172
|
+
--color-acc-50: oklch(0.98 0.003 7.385);
|
|
173
|
+
--color-acc-100: oklch(0.96 0.017 7.385);
|
|
174
|
+
--color-acc-200: oklch(0.927 0.039 7.385);
|
|
175
|
+
--color-acc-300: oklch(0.881 0.069 7.385);
|
|
176
|
+
--color-acc-400: oklch(0.822 0.109 7.385);
|
|
177
|
+
--color-acc-500: oklch(0.75 0.157 7.385);
|
|
178
|
+
--color-acc-600: oklch(0.64 0.23 7.385);
|
|
179
|
+
--color-acc-700: oklch(0.567 0.193 7.385);
|
|
180
|
+
--color-acc-800: oklch(0.456 0.142 7.385);
|
|
181
|
+
--color-acc-900: oklch(0.332 0.092 7.385);
|
|
182
|
+
--color-acc-950: oklch(0.195 0.047 7.385);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**All shades (50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950) plus `-raw` are REQUIRED.**
|
|
187
|
+
|
|
188
|
+
## Required Import in Entry Point (and avoiding duplicate imports)
|
|
189
|
+
|
|
190
|
+
**MUST** import `app.css` in your entry point (e.g., `src/main.tsx`):
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
// src/main.tsx
|
|
194
|
+
import './app.css'; // ✅ CORRECT - Import app.css which imports core.css once
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**DO NOT** import `core.css` directly in `main.tsx`, `App.tsx`, or any other entry surface. Double-importing `core.css` leads to stylesheet duplication and ordering issues.
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
// ❌ WRONG - Don't import core.css directly (app.css already does it)
|
|
201
|
+
import '@jmruthers/pace-core/styles/core.css';
|
|
202
|
+
import './app.css';
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Multi-entry decision tree
|
|
206
|
+
|
|
207
|
+
When you have additional entry points (storybook, tests, preview servers):
|
|
208
|
+
- If the entry point renders your React tree, **import only `app.css`** there as well.
|
|
209
|
+
- If you need raw styles for non-React tooling, **import `@jmruthers/pace-core/styles/core.css` once** in that tool-specific stylesheet, never alongside `app.css`.
|
|
210
|
+
- If you are unsure, default to a single `app.css` import and remove any extra `core.css` imports.
|
|
211
|
+
|
|
212
|
+
## Styling & Markup Rules (aligns with Cursor)
|
|
213
|
+
|
|
214
|
+
- **No inline styles**: Do not use `style={{ ... }}` except when a third-party library strictly requires it. Prefer pace-core variants + Tailwind utilities.
|
|
215
|
+
- **Use theme tokens only**: Avoid arbitrary Tailwind colors (`text-gray-500`, `bg-red-500`) and bracket syntax (`bg-[oklch(...)]`). Use `main-*`, `sec-*`, `acc-*`, or semantic tokens like `text-foreground`.
|
|
216
|
+
- **Semantic-first markup**: Prefer semantic HTML elements. Use `<div>` only when no semantic element fits or when required by a library; otherwise use semantic tags or React fragments.
|
|
217
|
+
- **Minimal wrappers**: Avoid extra wrapper elements just for styling—apply layout classes to existing semantic parents or use pace-core layout components.
|
|
218
|
+
- **Typography**: Rely on pace-core typography defaults; only add utilities when they reference approved theme tokens (e.g., `text-main-700`).
|
|
219
|
+
|
|
220
|
+
## Complete Example
|
|
221
|
+
|
|
222
|
+
### `src/app.css`
|
|
223
|
+
|
|
224
|
+
```css
|
|
225
|
+
@import "tailwindcss";
|
|
226
|
+
|
|
227
|
+
/* @source directives for Tailwind v4 content scanning */
|
|
228
|
+
@source "./**/*.{js,ts,jsx,tsx}";
|
|
229
|
+
@source "../node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}";
|
|
230
|
+
|
|
231
|
+
/* Import pace-core CSS files so Tailwind processes them */
|
|
232
|
+
@import "@jmruthers/pace-core/styles/core.css";
|
|
233
|
+
|
|
234
|
+
@theme static {
|
|
235
|
+
/* Your app's color palettes */
|
|
236
|
+
--color-main-raw: oklch(0.58 0.23 300);
|
|
237
|
+
--color-main-50: oklch(0.98 0.003 300);
|
|
238
|
+
/* ... continue through 950 for main, sec, and acc */
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### `src/main.tsx`
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import { createRoot } from 'react-dom/client';
|
|
246
|
+
import App from './App';
|
|
247
|
+
import './app.css'; // ✅ Import app.css (which imports core.css)
|
|
248
|
+
|
|
249
|
+
createRoot(document.getElementById('root')!).render(<App />);
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Verification Checklist
|
|
253
|
+
|
|
254
|
+
Before committing, verify:
|
|
255
|
+
|
|
256
|
+
- [ ] `src/app.css` exists and follows the structure above
|
|
257
|
+
- [ ] `@source` directives use correct paths (relative to `src/app.css`)
|
|
258
|
+
- [ ] `@import "@jmruthers/pace-core/styles/core.css";` is in `app.css` (not in `main.tsx`)
|
|
259
|
+
- [ ] All three color palettes (main, sec, acc) are defined with all shades (50-950)
|
|
260
|
+
- [ ] `app.css` is imported in `main.tsx` (not `core.css`)
|
|
261
|
+
- [ ] No duplicate imports of `core.css`
|
|
262
|
+
|
|
263
|
+
## Common Mistakes
|
|
264
|
+
|
|
265
|
+
### ❌ Mistake 1: Wrong @source Paths
|
|
266
|
+
|
|
267
|
+
```css
|
|
268
|
+
/* ❌ WRONG */
|
|
269
|
+
@source "../../node_modules/@jmruthers/pace-core/src/**/*.{js,ts,jsx,tsx}";
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Fix:** Use `../node_modules/` (one level up, not two)
|
|
273
|
+
|
|
274
|
+
### ❌ Mistake 2: Importing core.css in main.tsx
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
// ❌ WRONG
|
|
278
|
+
import '@jmruthers/pace-core/styles/core.css';
|
|
279
|
+
import './app.css';
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Fix:** Only import `app.css` in `main.tsx`. The `app.css` file imports `core.css`.
|
|
283
|
+
|
|
284
|
+
### ❌ Mistake 3: Using /src/styles/ Path
|
|
285
|
+
|
|
286
|
+
```css
|
|
287
|
+
/* ❌ WRONG */
|
|
288
|
+
@import "@jmruthers/pace-core/src/styles/core.css";
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Fix:** Use `@jmruthers/pace-core/styles/core.css` (package path, not source path)
|
|
292
|
+
|
|
293
|
+
### ❌ Mistake 4: Missing Color Shades
|
|
294
|
+
|
|
295
|
+
```css
|
|
296
|
+
/* ❌ WRONG - Missing shades */
|
|
297
|
+
@theme static {
|
|
298
|
+
--color-main-500: oklch(0.75 0.133 300);
|
|
299
|
+
/* Missing 50, 100, 200, etc. */
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Fix:** Include all shades (50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950) plus `-raw` for each palette
|
|
304
|
+
|
|
305
|
+
### ❌ Mistake 5: Wrong App Source Path
|
|
306
|
+
|
|
307
|
+
```css
|
|
308
|
+
/* ❌ WRONG - If app.css is in src/ */
|
|
309
|
+
@source "../src/**/*.{js,ts,jsx,tsx}";
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**Fix:** Use `./**/*.{js,ts,jsx,tsx}` when `app.css` is in `src/`
|
|
313
|
+
|
|
314
|
+
## Troubleshooting
|
|
315
|
+
|
|
316
|
+
### Components Appear Unstyled
|
|
317
|
+
|
|
318
|
+
1. **Check @source directives:** Verify paths are correct relative to `src/app.css`
|
|
319
|
+
2. **Check CSS import:** Ensure `@import "@jmruthers/pace-core/styles/core.css";` is in `app.css`
|
|
320
|
+
3. **Check app.css import:** Ensure `import './app.css';` is in `main.tsx`
|
|
321
|
+
4. **Clear build cache:** Delete `dist/`, `.vite/`, and rebuild
|
|
322
|
+
|
|
323
|
+
### Colors Don't Work
|
|
324
|
+
|
|
325
|
+
1. **Check color palettes:** Verify all shades (50-950) are defined for main, sec, and acc
|
|
326
|
+
2. **Check @theme static:** Ensure color variables are in `@theme static` block
|
|
327
|
+
3. **Check import order:** Ensure `core.css` is imported before `@theme static` in `app.css`
|
|
328
|
+
|
|
329
|
+
### Tailwind Classes Missing
|
|
330
|
+
|
|
331
|
+
1. **Check @source directives:** Verify pace-core source is being scanned
|
|
332
|
+
2. **Check build output:** Look for warnings about missing classes
|
|
333
|
+
3. **Verify package version:** Ensure you're using a recent version of pace-core
|
|
334
|
+
|
|
335
|
+
## Related Documentation
|
|
336
|
+
|
|
337
|
+
- [PACE Core Styling Guide](../styles/README.md) - Complete styling documentation
|
|
338
|
+
- [Project Structure Guide](./00-project-structure-guide.md) - File organization standards
|
|
339
|
+
- [Component Standard](./03-component-standard.md) - Component development standards
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
**Last Updated:** 2025-01-28
|
|
344
|
+
**Version:** 1.0.0
|
|
345
|
+
**Applies to:** All consuming apps using `@jmruthers/pace-core`
|