@jmruthers/pace-core 0.5.76 → 0.5.78
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 +8 -0
- package/dist/{RBACService-C4udt_Zp.d.ts → AuthService-Df3IozMG.d.ts} +10 -118
- package/dist/{DataTable-ntgmhO2W.d.ts → DataTable-BE0OXZKQ.d.ts} +9 -2
- package/dist/{DataTable-4GAVPIEG.js → DataTable-ETGVF4Y5.js} +50 -13
- package/dist/{PublicLoadingSpinner-BiNER8F5.d.ts → PublicLoadingSpinner-CnUaz0vG.d.ts} +5 -2
- package/dist/{UnifiedAuthProvider-Bj6YCf7c.d.ts → UnifiedAuthProvider-B391Aqum.d.ts} +42 -45
- package/dist/{UnifiedAuthProvider-3NKDOSOK.js → UnifiedAuthProvider-P5SOJAQ6.js} +4 -5
- package/dist/{api-DDMUKIUD.js → api-KG4A2X7P.js} +9 -3
- package/dist/{audit-6TOCAMKO.js → audit-65VNHEV2.js} +2 -2
- package/dist/{chunk-K34IM5CT.js → chunk-2OGV6IRV.js} +196 -626
- package/dist/chunk-2OGV6IRV.js.map +1 -0
- package/dist/{chunk-NTNILOBC.js → chunk-5BO3MI5Y.js} +4 -4
- package/dist/{chunk-XLZ7U46Z.js → chunk-CVMVPYAL.js} +9 -60
- package/dist/chunk-CVMVPYAL.js.map +1 -0
- package/dist/{chunk-URUTVZ7N.js → chunk-FL4ZCQLD.js} +2 -2
- package/dist/{chunk-LW7MMEAQ.js → chunk-FT2M4R4F.js} +2 -2
- package/dist/{chunk-5BSLGBYI.js → chunk-JCQZ6LA7.js} +2 -8
- package/dist/{chunk-5BSLGBYI.js.map → chunk-JCQZ6LA7.js.map} +1 -1
- package/dist/{chunk-KHJS6VIA.js → chunk-LRQ6RBJC.js} +157 -112
- package/dist/chunk-LRQ6RBJC.js.map +1 -0
- package/dist/{chunk-WN6XJWOS.js → chunk-MNJXXD6C.js} +274 -743
- package/dist/chunk-MNJXXD6C.js.map +1 -0
- package/dist/{chunk-KK73ZB4E.js → chunk-PTR5PMPE.js} +153 -132
- package/dist/chunk-PTR5PMPE.js.map +1 -0
- package/dist/{chunk-B2WTCLCV.js → chunk-Q7APDV6H.js} +18 -8
- package/dist/chunk-Q7APDV6H.js.map +1 -0
- package/dist/{chunk-A4FUBC7B.js → chunk-QGVSOUJ2.js} +2 -4
- package/dist/{chunk-A4FUBC7B.js.map → chunk-QGVSOUJ2.js.map} +1 -1
- package/dist/{chunk-FGMFQSHX.js → chunk-S63MFSY6.js} +500 -551
- package/dist/chunk-S63MFSY6.js.map +1 -0
- package/dist/{chunk-AFGTSUAD.js → chunk-VSOKOFRF.js} +4 -4
- package/dist/chunk-WUXCWRL6.js +20 -0
- package/dist/chunk-WUXCWRL6.js.map +1 -0
- package/dist/{chunk-Y6TXWPJO.js → chunk-YVVGHRGI.js} +105 -31
- package/dist/chunk-YVVGHRGI.js.map +1 -0
- package/dist/{chunk-M5IWZRBT.js → chunk-ZMNXIJP4.js} +2187 -981
- package/dist/chunk-ZMNXIJP4.js.map +1 -0
- package/dist/components.d.ts +6 -6
- package/dist/components.js +14 -18
- package/dist/components.js.map +1 -1
- package/dist/{database-C3Szpi5J.d.ts → database-BXAfr2Y_.d.ts} +18 -0
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +8 -9
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +19 -27
- package/dist/index.js +21 -29
- package/dist/index.js.map +1 -1
- package/dist/{organisation-BtshODVF.d.ts → organisation-D6qRDtbF.d.ts} +1 -1
- package/dist/providers.d.ts +7 -21
- package/dist/providers.js +3 -10
- package/dist/rbac/index.d.ts +71 -221
- package/dist/rbac/index.js +15 -16
- package/dist/{types-CGX9Vyf5.d.ts → types-BDg1mAGG.d.ts} +36 -6
- package/dist/types.d.ts +3 -3
- package/dist/types.js +61 -18
- package/dist/types.js.map +1 -1
- package/dist/{unified-CM7T0aTK.d.ts → unified-DQ4VcT7H.d.ts} +1 -1
- package/dist/{usePublicRouteParams-B-CumWRc.d.ts → usePublicRouteParams-BlgwXweB.d.ts} +3 -3
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +52 -9
- package/dist/utils.js.map +1 -1
- package/docs/CONTENT_AUDIT_REPORT.md +253 -0
- package/docs/DOCUMENTATION_AUDIT.md +172 -0
- package/docs/README.md +142 -147
- package/docs/STYLE_GUIDE.md +37 -0
- package/docs/api/classes/ColumnFactory.md +17 -17
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +4 -4
- package/docs/api/classes/MissingUserContextError.md +4 -4
- package/docs/api/classes/OrganisationContextRequiredError.md +4 -4
- package/docs/api/classes/PermissionDeniedError.md +5 -5
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +8 -8
- package/docs/api/classes/RBACCache.md +35 -5
- package/docs/api/classes/RBACEngine.md +49 -20
- package/docs/api/classes/RBACError.md +4 -4
- package/docs/api/classes/RBACNotInitializedError.md +4 -4
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +4 -4
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +11 -0
- package/docs/api/interfaces/DataTableAction.md +65 -29
- package/docs/api/interfaces/DataTableColumn.md +36 -23
- package/docs/api/interfaces/DataTableProps.md +80 -38
- package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
- package/docs/api/interfaces/EmptyStateConfig.md +5 -5
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +11 -11
- package/docs/api/interfaces/NavigationContextType.md +9 -9
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +7 -7
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +16 -3
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +2 -2
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +2 -2
- package/docs/api/interfaces/RouteConfig.md +2 -2
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +94 -521
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +16 -16
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +11 -11
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +251 -269
- package/docs/api-reference/components.md +193 -0
- package/docs/api-reference/hooks.md +265 -0
- package/docs/api-reference/providers.md +6 -0
- package/docs/api-reference/types.md +6 -0
- package/docs/api-reference/utilities.md +207 -0
- package/docs/architecture/README.md +6 -0
- package/docs/{database-schema-requirements.md → architecture/database-schema-requirements.md} +6 -0
- package/docs/architecture/rbac-security-architecture.md +258 -0
- package/docs/architecture/services.md +9 -1
- package/docs/best-practices/README.md +6 -0
- package/docs/best-practices/accessibility.md +6 -0
- package/docs/{common-patterns.md → best-practices/common-patterns.md} +6 -0
- package/docs/best-practices/deployment.md +6 -0
- package/docs/best-practices/performance.md +475 -2
- package/docs/best-practices/security.md +6 -0
- package/docs/best-practices/testing.md +6 -0
- package/docs/core-concepts/authentication.md +6 -0
- package/docs/core-concepts/events.md +6 -0
- package/docs/core-concepts/organisations.md +6 -0
- package/docs/core-concepts/permissions.md +6 -0
- package/docs/core-concepts/rbac-system.md +8 -0
- package/docs/documentation-index.md +121 -182
- package/docs/{consuming-app-vite-config.md → getting-started/consuming-app-vite-config.md} +6 -0
- package/docs/getting-started/documentation-index.md +40 -0
- package/docs/getting-started/examples/README.md +878 -35
- package/docs/{faq.md → getting-started/faq.md} +7 -1
- package/docs/getting-started/installation-guide.md +6 -0
- package/docs/{quick-reference.md → getting-started/quick-reference.md} +6 -0
- package/docs/implementation-guides/app-layout.md +6 -0
- package/docs/implementation-guides/authentication.md +1021 -0
- package/docs/implementation-guides/component-styling.md +6 -0
- package/docs/implementation-guides/data-tables.md +1264 -2076
- package/docs/implementation-guides/dynamic-colors.md +6 -0
- package/docs/implementation-guides/event-theming-summary.md +6 -0
- package/docs/{file-reference-system.md → implementation-guides/file-reference-system.md} +6 -0
- package/docs/implementation-guides/file-upload-storage.md +6 -0
- package/docs/implementation-guides/forms.md +6 -0
- package/docs/implementation-guides/inactivity-tracking.md +6 -0
- package/docs/implementation-guides/navigation.md +6 -0
- package/docs/implementation-guides/organisation-security.md +6 -0
- package/docs/implementation-guides/permission-enforcement.md +6 -0
- package/docs/implementation-guides/public-pages-advanced.md +6 -0
- package/docs/implementation-guides/public-pages.md +6 -0
- package/docs/migration/MIGRATION_GUIDE.md +827 -351
- package/docs/migration/README.md +7 -1
- package/docs/migration/organisation-context-timing-fix.md +6 -0
- package/docs/migration/rbac-migration.md +44 -1
- package/docs/migration/service-architecture.md +6 -0
- package/docs/migration/v0.4.15-tailwind-scanning.md +6 -0
- package/docs/migration/v0.4.16-css-first-approach.md +6 -0
- package/docs/migration/v0.4.17-source-path-fix.md +6 -0
- package/docs/rbac/README-rbac-rls-integration.md +6 -0
- package/docs/rbac/README.md +6 -0
- package/docs/rbac/advanced-patterns.md +6 -0
- package/docs/rbac/api-reference.md +7 -1
- package/docs/rbac/breaking-changes-v3.md +222 -0
- package/docs/rbac/examples/rbac-rls-integration-example.md +6 -0
- package/docs/rbac/examples.md +6 -0
- package/docs/rbac/getting-started.md +6 -0
- package/docs/rbac/migration-guide.md +260 -0
- package/docs/rbac/quick-start.md +70 -13
- package/docs/rbac/rbac-rls-integration.md +6 -0
- package/docs/rbac/super-admin-guide.md +6 -0
- package/docs/rbac/troubleshooting.md +6 -0
- package/docs/security/README.md +6 -0
- package/docs/security/checklist.md +6 -0
- package/docs/styles/README.md +7 -1
- package/docs/{usage.md → styles/usage.md} +6 -0
- package/docs/testing/README.md +6 -0
- package/docs/{visual-testing.md → testing/visual-testing.md} +6 -0
- package/docs/troubleshooting/README.md +387 -5
- package/docs/troubleshooting/cake-page-permission-guard-issue-summary.md +6 -0
- package/docs/troubleshooting/common-issues.md +6 -0
- package/docs/troubleshooting/database-view-compatibility.md +6 -0
- package/docs/troubleshooting/organisation-context-setup.md +6 -0
- package/docs/troubleshooting/react-hooks-issue-analysis.md +6 -0
- package/docs/troubleshooting/styling-issues.md +6 -0
- package/docs/troubleshooting/tailwind-content-scanning.md +6 -0
- package/package.json +1 -1
- package/src/__tests__/helpers/__tests__/test-providers.test.tsx +2 -1
- package/src/__tests__/helpers/test-providers.tsx +3 -53
- package/src/components/DataTable/DataTable.test.tsx +319 -0
- package/src/components/DataTable/DataTable.tsx +32 -11
- package/src/components/DataTable/__tests__/{DataTable.comprehensive.test.tsx → DataTable.comprehensive.test.tsx.skip} +6 -4
- package/src/components/DataTable/__tests__/{DataTable.test.tsx → DataTable.test.tsx.skip} +6 -4
- package/src/components/DataTable/__tests__/DataTableCore.test.tsx +31 -9
- package/src/components/DataTable/__tests__/a11y.basic.test.tsx +601 -0
- package/src/components/DataTable/__tests__/keyboard.test.tsx +615 -0
- package/src/components/DataTable/__tests__/pagination.modes.test.tsx +639 -0
- package/src/components/DataTable/__tests__/ssr.strict-mode.test.tsx.skip +330 -0
- package/src/components/DataTable/components/AccessDeniedPage.tsx +2 -2
- package/src/components/DataTable/components/ActionButtons.tsx +88 -104
- package/src/components/DataTable/components/DataTableCore.tsx +309 -337
- package/src/components/DataTable/components/DataTableErrorBoundary.tsx +4 -2
- package/src/components/DataTable/components/DataTableModals.tsx +22 -1
- package/src/components/DataTable/components/EditableRow.tsx +69 -84
- package/src/components/DataTable/components/EmptyState.tsx +5 -1
- package/src/components/DataTable/components/ImportModal.tsx +65 -36
- package/src/components/DataTable/components/PaginationControls.tsx +40 -100
- package/src/components/DataTable/components/UnifiedTableBody.tsx +125 -148
- package/src/components/DataTable/context/DataTableContext.tsx +1 -1
- package/src/components/DataTable/core/ColumnFactory.ts +5 -0
- package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +12 -10
- package/src/components/DataTable/examples/HierarchicalExample.tsx +1 -1
- package/src/components/DataTable/examples/InitialPageSizeExample.tsx +1 -0
- package/src/components/DataTable/examples/PerformanceExample.tsx +1 -0
- package/src/components/DataTable/hooks/__tests__/useColumnOrderPersistence.test.ts +1 -5
- package/src/components/DataTable/hooks/__tests__/useColumnVisibilityPersistence.test.ts +167 -0
- package/src/components/DataTable/hooks/index.ts +7 -0
- package/src/components/DataTable/hooks/useColumnOrderPersistence.ts +32 -15
- package/src/components/DataTable/hooks/useColumnVisibilityPersistence.ts +102 -0
- package/src/components/DataTable/hooks/useDataTableConfiguration.ts +89 -0
- package/src/components/DataTable/hooks/useDataTableDataPipeline.ts +117 -0
- package/src/components/DataTable/hooks/useDataTablePermissions.ts +71 -27
- package/src/components/DataTable/hooks/useDataTableState.ts +39 -11
- package/src/components/DataTable/hooks/useEffectiveColumnOrder.ts +33 -0
- package/src/components/DataTable/hooks/useHierarchicalState.ts +15 -1
- package/src/components/DataTable/hooks/useKeyboardNavigation.ts +447 -0
- package/src/components/DataTable/hooks/useServerSideDataEffect.ts +94 -0
- package/src/components/DataTable/hooks/useTableColumns.ts +10 -7
- package/src/components/DataTable/hooks/useTableHandlers.ts +174 -0
- package/src/components/DataTable/index.ts +12 -3
- package/src/components/DataTable/types.ts +129 -9
- package/src/components/DataTable/utils/__tests__/exportUtils.test.ts +159 -22
- package/src/components/DataTable/utils/__tests__/flexibleImport.test.ts +111 -0
- package/src/components/DataTable/utils/__tests__/rowUtils.test.ts +15 -29
- package/src/components/DataTable/utils/a11yUtils.ts +244 -0
- package/src/components/DataTable/utils/debugTools.ts +609 -0
- package/src/components/DataTable/utils/exportUtils.ts +114 -16
- package/src/components/DataTable/utils/flexibleImport.ts +202 -32
- package/src/components/DataTable/utils/hierarchicalUtils.ts +1 -1
- package/src/components/DataTable/utils/index.ts +2 -0
- package/src/components/DataTable/utils/paginationUtils.ts +350 -0
- package/src/components/DataTable/utils/rowUtils.ts +6 -5
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +19 -24
- package/src/components/NavigationMenu/NavigationMenu.tsx +19 -8
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +1 -23
- package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +56 -6
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +137 -13
- package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +1 -1
- package/src/components/Select/Select.tsx +1 -0
- package/src/components/examples/PermissionExample.tsx +173 -0
- package/src/examples/CorrectPublicPageImplementation.tsx +301 -0
- package/src/examples/PublicEventPage.tsx +274 -0
- package/src/examples/PublicPageApp.tsx +308 -0
- package/src/examples/PublicPageUsageExample.tsx +216 -0
- package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +12 -1
- package/src/hooks/__tests__/useOrganisationSecurity.unit.test.tsx +129 -17
- package/src/hooks/__tests__/useRBAC.unit.test.ts +151 -846
- package/src/hooks/useOrganisationPermissions.test.ts +42 -18
- package/src/hooks/useOrganisationPermissions.ts +12 -6
- package/src/hooks/useOrganisationSecurity.test.ts +138 -85
- package/src/hooks/useOrganisationSecurity.ts +41 -10
- package/src/index.ts +0 -1
- package/src/providers/AuthProvider.simplified.tsx +880 -0
- package/src/providers/UnifiedAuthProvider.test.simple.tsx +8 -8
- package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +29 -19
- package/src/providers/index.ts +0 -1
- package/src/providers/services/EventServiceProvider.tsx +19 -15
- package/src/providers/services/InactivityServiceProvider.tsx +19 -15
- package/src/providers/services/OrganisationServiceProvider.tsx +19 -15
- package/src/providers/services/UnifiedAuthProvider.tsx +156 -127
- package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +1 -1
- package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +3 -3
- package/src/rbac/README.md +1 -1
- package/src/rbac/__tests__/adapters.comprehensive.test.tsx +25 -27
- package/src/rbac/__tests__/auth-rbac-security.integration.test.tsx +313 -0
- package/src/rbac/__tests__/engine.comprehensive.test.ts +114 -348
- package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +28 -110
- package/src/rbac/__tests__/rbac-engine-simplified.test.ts +33 -85
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +2 -2
- package/src/rbac/adapters.tsx +26 -69
- package/src/rbac/api.test.ts +90 -27
- package/src/rbac/api.ts +61 -10
- package/src/rbac/audit.test.ts +33 -38
- package/src/rbac/audit.ts +21 -6
- package/src/rbac/cache.ts +33 -1
- package/src/rbac/components/NavigationGuard.tsx +11 -11
- package/src/rbac/components/NavigationProvider.test.tsx +11 -5
- package/src/rbac/components/NavigationProvider.tsx +37 -13
- package/src/rbac/components/PagePermissionGuard.tsx +111 -50
- package/src/rbac/components/PagePermissionProvider.tsx +5 -5
- package/src/rbac/components/PermissionEnforcer.tsx +11 -11
- package/src/rbac/components/RoleBasedRouter.tsx +5 -5
- package/src/rbac/components/SecureDataProvider.tsx +5 -5
- package/src/rbac/components/__tests__/NavigationGuard.test.tsx +8 -8
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +14 -14
- package/src/rbac/components/__tests__/PermissionEnforcer.test.tsx +12 -12
- package/src/rbac/components/__tests__/RoleBasedRouter.test.tsx +6 -6
- package/src/rbac/engine.test.simple.ts +19 -13
- package/src/rbac/engine.test.ts +1 -0
- package/src/rbac/engine.ts +330 -766
- package/src/rbac/errors.ts +156 -0
- package/src/rbac/hooks/usePermissions.ts +32 -10
- package/src/rbac/hooks/useRBAC.test.ts +126 -512
- package/src/rbac/hooks/useRBAC.ts +147 -193
- package/src/rbac/hooks/useResolvedScope.ts +12 -0
- package/src/rbac/index.ts +7 -4
- package/src/rbac/security.ts +109 -18
- package/src/rbac/types.ts +12 -1
- package/src/services/AuthService.ts +2 -15
- package/src/services/EventService.ts +43 -46
- package/src/services/OrganisationService.ts +51 -31
- package/src/services/__tests__/AuthService.test.ts +1 -1
- package/src/services/__tests__/EventService.test.ts +1 -1
- package/src/services/__tests__/OrganisationService.test.ts +1 -1
- package/src/services/base/BaseService.ts +8 -0
- package/src/styles/base.css +208 -0
- package/src/styles/semantic.css +24 -0
- package/src/types/database.generated.ts +7347 -0
- package/src/types/database.ts +20 -0
- package/src/utils/logger.ts +179 -0
- package/src/utils/organisationContext.ts +11 -4
- package/src/utils/storage/__tests__/helpers.unit.test.ts +6 -2
- package/dist/appNameResolver-UURKN7NF.js +0 -22
- package/dist/audit-6TOCAMKO.js.map +0 -1
- package/dist/chunk-B2WTCLCV.js.map +0 -1
- package/dist/chunk-FGMFQSHX.js.map +0 -1
- package/dist/chunk-K34IM5CT.js.map +0 -1
- package/dist/chunk-KHJS6VIA.js.map +0 -1
- package/dist/chunk-KK73ZB4E.js.map +0 -1
- package/dist/chunk-M5IWZRBT.js.map +0 -1
- package/dist/chunk-ULBI5JGB.js +0 -109
- package/dist/chunk-ULBI5JGB.js.map +0 -1
- package/dist/chunk-WN6XJWOS.js.map +0 -1
- package/dist/chunk-XLZ7U46Z.js.map +0 -1
- package/dist/chunk-Y6TXWPJO.js.map +0 -1
- package/docs/DOCUMENTATION_CHECKLIST.md +0 -281
- package/docs/TERMINOLOGY.md +0 -231
- package/docs/api/interfaces/RBACContextType.md +0 -468
- package/docs/api/interfaces/RBACProviderProps.md +0 -107
- package/docs/best-practices/performance-expansion.md +0 -473
- package/docs/breaking-changes.md +0 -179
- package/docs/consuming-app-example.md +0 -290
- package/docs/documentation-templates.md +0 -539
- package/docs/examples/navigation-menu-auth-fix.md +0 -344
- package/docs/getting-started/examples/basic-auth-app.md +0 -520
- package/docs/getting-started/examples/full-featured-app.md +0 -616
- package/docs/getting-started/quick-start.md +0 -376
- package/docs/implementation-guides/datatable-filtering.md +0 -313
- package/docs/implementation-guides/datatable-rbac-usage.md +0 -317
- package/docs/implementation-guides/hierarchical-datatable.md +0 -850
- package/docs/implementation-guides/large-datasets.md +0 -281
- package/docs/implementation-guides/performance.md +0 -403
- package/docs/migration/quick-migration-guide.md +0 -320
- package/docs/migration-guide.md +0 -193
- package/docs/migration-guides/unified-auth-provider-mandatory-timeouts.md +0 -226
- package/docs/performance/README.md +0 -551
- package/docs/style-guide.md +0 -964
- package/docs/troubleshooting/authentication-issues.md +0 -334
- package/docs/troubleshooting/debugging.md +0 -1117
- package/docs/troubleshooting/migration.md +0 -918
- package/src/__tests__/hooks/usePermissions.test.ts +0 -261
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.rbac.test.tsx +0 -574
- package/src/hooks/__tests__/ServiceHooks.test.tsx +0 -613
- package/src/hooks/services/__tests__/useServiceHooks.test.tsx +0 -137
- package/src/hooks/services/usePermissions.ts +0 -70
- package/src/hooks/services/useRBACService.ts +0 -30
- package/src/hooks/usePermissionCheck.ts +0 -150
- package/src/providers/__tests__/ServiceProviders.test.tsx +0 -477
- package/src/providers/services/RBACServiceProvider.tsx +0 -79
- package/src/rbac/__tests__/integration.authflow.test.tsx +0 -119
- package/src/rbac/__tests__/integration.navigation.test.tsx +0 -69
- package/src/rbac/__tests__/integration.securedata.test.tsx +0 -92
- package/src/rbac/__tests__/integration.smoke.test.tsx +0 -73
- package/src/rbac/providers/RBACProvider.tsx +0 -645
- package/src/rbac/providers/__tests__/RBACProvider.integration.test.tsx +0 -688
- package/src/rbac/providers/__tests__/RBACProvider.test.tsx +0 -1186
- package/src/rbac/providers/index.ts +0 -11
- package/src/services/RBACService.ts +0 -522
- package/src/services/__tests__/RBACService.test.ts +0 -492
- package/src/services/interfaces/IRBACService.ts +0 -62
- package/src/utils/appNameResolver.test 2.ts +0 -494
- /package/dist/{DataTable-4GAVPIEG.js.map → DataTable-ETGVF4Y5.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-3NKDOSOK.js.map → UnifiedAuthProvider-P5SOJAQ6.js.map} +0 -0
- /package/dist/{api-DDMUKIUD.js.map → api-KG4A2X7P.js.map} +0 -0
- /package/dist/{appNameResolver-UURKN7NF.js.map → audit-65VNHEV2.js.map} +0 -0
- /package/dist/{chunk-NTNILOBC.js.map → chunk-5BO3MI5Y.js.map} +0 -0
- /package/dist/{chunk-URUTVZ7N.js.map → chunk-FL4ZCQLD.js.map} +0 -0
- /package/dist/{chunk-LW7MMEAQ.js.map → chunk-FT2M4R4F.js.map} +0 -0
- /package/dist/{chunk-AFGTSUAD.js.map → chunk-VSOKOFRF.js.map} +0 -0
- /package/docs/{app.css.example → styles/app.css.example} +0 -0
|
@@ -1,16 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Performance Best Practices
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
> **📚 Complete Performance Guide** | [← Back to Documentation](./README.md) | [Installation Guide](../getting-started/installation-guide.md)
|
|
10
|
+
|
|
11
|
+
Performance is crucial for user experience. This comprehensive guide provides all performance optimization techniques for `@jmruthers/pace-core` applications, from basic strategies to advanced optimization.
|
|
4
12
|
|
|
5
13
|
## Overview
|
|
6
14
|
|
|
7
|
-
Performance optimization in `@jmruthers/pace-core`
|
|
15
|
+
Performance optimization in `@jmruthers/pace-core` covers:
|
|
8
16
|
|
|
9
17
|
- **Component Rendering**: Minimizing unnecessary re-renders
|
|
10
18
|
- **Data Fetching**: Efficient data loading and caching
|
|
11
19
|
- **Bundle Size**: Optimizing package size and tree shaking
|
|
12
20
|
- **Memory Management**: Preventing memory leaks
|
|
13
21
|
- **Network Optimization**: Reducing API calls and payload size
|
|
22
|
+
- **Advanced Techniques**: Code splitting, lazy loading, and optimization tools
|
|
14
23
|
|
|
15
24
|
## Component Performance
|
|
16
25
|
|
|
@@ -786,4 +795,468 @@ function checkPerformanceBudget(metrics) {
|
|
|
786
795
|
}
|
|
787
796
|
```
|
|
788
797
|
|
|
798
|
+
## Advanced Performance Techniques
|
|
799
|
+
|
|
800
|
+
### Bundle Optimization
|
|
801
|
+
|
|
802
|
+
#### Tree Shaking
|
|
803
|
+
|
|
804
|
+
**Goal**: Minimize bundle size by eliminating unused code.
|
|
805
|
+
|
|
806
|
+
**Implementation**:
|
|
807
|
+
```typescript
|
|
808
|
+
// ✅ Good - Named exports for tree shaking
|
|
809
|
+
export { Button } from './Button';
|
|
810
|
+
export { Card } from './Card';
|
|
811
|
+
export { DataTable } from './DataTable';
|
|
812
|
+
|
|
813
|
+
// ❌ Bad - Default exports reduce tree shaking
|
|
814
|
+
export default { Button, Card, DataTable };
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
**Verify Tree Shaking**:
|
|
818
|
+
```bash
|
|
819
|
+
# Check bundle size
|
|
820
|
+
npm run build
|
|
821
|
+
npx vite-bundle-visualizer
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
#### Dynamic Imports
|
|
825
|
+
|
|
826
|
+
**Use Case**: Load components only when needed.
|
|
827
|
+
|
|
828
|
+
```tsx
|
|
829
|
+
import React, { Suspense, lazy } from 'react';
|
|
830
|
+
|
|
831
|
+
// Lazy load heavy components
|
|
832
|
+
const DataTable = lazy(() => import('@jmruthers/pace-core').then(m => ({ default: m.DataTable })));
|
|
833
|
+
const ChartEditor = lazy(() => import('./components/ChartEditor'));
|
|
834
|
+
|
|
835
|
+
function App() {
|
|
836
|
+
return (
|
|
837
|
+
<Suspense fallback={<LoadingSpinner />}>
|
|
838
|
+
<DataTable data={data} columns={columns} />
|
|
839
|
+
</Suspense>
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
#### Analysis Tools
|
|
845
|
+
|
|
846
|
+
```bash
|
|
847
|
+
# Install analyzer
|
|
848
|
+
npm install -D vite-bundle-visualizer
|
|
849
|
+
|
|
850
|
+
# Analyze bundle
|
|
851
|
+
npx vite-bundle-visualizer dist/stats.html
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
### Advanced Component Memoization
|
|
855
|
+
|
|
856
|
+
#### React.memo for Expensive Components
|
|
857
|
+
|
|
858
|
+
```tsx
|
|
859
|
+
import React from 'react';
|
|
860
|
+
import { Card } from '@jmruthers/pace-core';
|
|
861
|
+
|
|
862
|
+
interface UserCardProps {
|
|
863
|
+
user: User;
|
|
864
|
+
onEdit: (userId: string) => void;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// Memoize expensive components
|
|
868
|
+
const UserCard = React.memo(({ user, onEdit }: UserCardProps) => {
|
|
869
|
+
return (
|
|
870
|
+
<Card className="p-4">
|
|
871
|
+
<h3>{user.name}</h3>
|
|
872
|
+
<p>{user.email}</p>
|
|
873
|
+
<button onClick={() => onEdit(user.id)}>Edit</button>
|
|
874
|
+
</Card>
|
|
875
|
+
);
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
// Custom comparison function for complex props
|
|
879
|
+
const ComplexComponent = React.memo(
|
|
880
|
+
({ data, config }: { data: any[]; config: any }) => {
|
|
881
|
+
return <DataTable data={data} columns={config.columns} />;
|
|
882
|
+
},
|
|
883
|
+
(prevProps, nextProps) => {
|
|
884
|
+
// Only re-render if data length or config changed
|
|
885
|
+
return (
|
|
886
|
+
prevProps.data.length === nextProps.data.length &&
|
|
887
|
+
JSON.stringify(prevProps.config) === JSON.stringify(nextProps.config)
|
|
888
|
+
);
|
|
889
|
+
}
|
|
890
|
+
);
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
#### useMemo for Expensive Calculations
|
|
894
|
+
|
|
895
|
+
```tsx
|
|
896
|
+
import { useMemo } from 'react';
|
|
897
|
+
import { DataTable } from '@jmruthers/pace-core';
|
|
898
|
+
|
|
899
|
+
function ExpensiveDataProcessor({ rawData }: { rawData: any[] }) {
|
|
900
|
+
// Memoize expensive data processing
|
|
901
|
+
const processedData = useMemo(() => {
|
|
902
|
+
return rawData.map(item => ({
|
|
903
|
+
...item,
|
|
904
|
+
// Expensive calculations
|
|
905
|
+
score: calculateComplexScore(item),
|
|
906
|
+
category: categorizeItem(item),
|
|
907
|
+
processed: true
|
|
908
|
+
}));
|
|
909
|
+
}, [rawData]);
|
|
910
|
+
|
|
911
|
+
// Memoize column configuration
|
|
912
|
+
const columns = useMemo(() => [
|
|
913
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
914
|
+
{ accessorKey: 'score', header: 'Score' },
|
|
915
|
+
{ accessorKey: 'category', header: 'Category' }
|
|
916
|
+
], []);
|
|
917
|
+
|
|
918
|
+
return <DataTable data={processedData} columns={columns} />;
|
|
919
|
+
}
|
|
920
|
+
```
|
|
921
|
+
|
|
922
|
+
### Memory Management
|
|
923
|
+
|
|
924
|
+
#### Preventing Memory Leaks
|
|
925
|
+
|
|
926
|
+
```tsx
|
|
927
|
+
import { useEffect, useRef } from 'react';
|
|
928
|
+
|
|
929
|
+
function DataFetcher() {
|
|
930
|
+
const isMountedRef = useRef(true);
|
|
931
|
+
|
|
932
|
+
useEffect(() => {
|
|
933
|
+
const fetchData = async () => {
|
|
934
|
+
try {
|
|
935
|
+
const data = await api.getData();
|
|
936
|
+
if (isMountedRef.current) {
|
|
937
|
+
setData(data);
|
|
938
|
+
}
|
|
939
|
+
} catch (error) {
|
|
940
|
+
if (isMountedRef.current) {
|
|
941
|
+
setError(error);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
fetchData();
|
|
947
|
+
|
|
948
|
+
return () => {
|
|
949
|
+
isMountedRef.current = false;
|
|
950
|
+
};
|
|
951
|
+
}, []);
|
|
952
|
+
|
|
953
|
+
// Cleanup subscriptions
|
|
954
|
+
useEffect(() => {
|
|
955
|
+
const subscription = eventBus.subscribe('dataUpdate', handleUpdate);
|
|
956
|
+
|
|
957
|
+
return () => {
|
|
958
|
+
subscription.unsubscribe();
|
|
959
|
+
};
|
|
960
|
+
}, []);
|
|
961
|
+
}
|
|
962
|
+
```
|
|
963
|
+
|
|
964
|
+
#### Efficient State Updates
|
|
965
|
+
|
|
966
|
+
```tsx
|
|
967
|
+
import { useCallback, useReducer } from 'react';
|
|
968
|
+
|
|
969
|
+
// Use reducer for complex state
|
|
970
|
+
function dataReducer(state: any, action: any) {
|
|
971
|
+
switch (action.type) {
|
|
972
|
+
case 'SET_DATA':
|
|
973
|
+
return { ...state, data: action.payload };
|
|
974
|
+
case 'UPDATE_ITEM':
|
|
975
|
+
return {
|
|
976
|
+
...state,
|
|
977
|
+
data: state.data.map(item =>
|
|
978
|
+
item.id === action.id ? { ...item, ...action.updates } : item
|
|
979
|
+
)
|
|
980
|
+
};
|
|
981
|
+
case 'DELETE_ITEM':
|
|
982
|
+
return {
|
|
983
|
+
...state,
|
|
984
|
+
data: state.data.filter(item => item.id !== action.id)
|
|
985
|
+
};
|
|
986
|
+
default:
|
|
987
|
+
return state;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
function OptimizedDataManager() {
|
|
992
|
+
const [state, dispatch] = useReducer(dataReducer, { data: [], loading: false });
|
|
993
|
+
|
|
994
|
+
// Memoize dispatch functions
|
|
995
|
+
const updateItem = useCallback((id: string, updates: any) => {
|
|
996
|
+
dispatch({ type: 'UPDATE_ITEM', id, updates });
|
|
997
|
+
}, []);
|
|
998
|
+
|
|
999
|
+
const deleteItem = useCallback((id: string) => {
|
|
1000
|
+
dispatch({ type: 'DELETE_ITEM', id });
|
|
1001
|
+
}, []);
|
|
1002
|
+
|
|
1003
|
+
return (
|
|
1004
|
+
<DataTable
|
|
1005
|
+
data={state.data}
|
|
1006
|
+
onUpdate={updateItem}
|
|
1007
|
+
onDelete={deleteItem}
|
|
1008
|
+
/>
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
### Network Optimization
|
|
1014
|
+
|
|
1015
|
+
#### Request Deduplication
|
|
1016
|
+
|
|
1017
|
+
```tsx
|
|
1018
|
+
import { useMemo } from 'react';
|
|
1019
|
+
|
|
1020
|
+
// Deduplicate identical requests
|
|
1021
|
+
const requestCache = new Map();
|
|
1022
|
+
|
|
1023
|
+
function useOptimizedFetch(url: string, options: any) {
|
|
1024
|
+
const cacheKey = useMemo(() =>
|
|
1025
|
+
`${url}-${JSON.stringify(options)}`,
|
|
1026
|
+
[url, options]
|
|
1027
|
+
);
|
|
1028
|
+
|
|
1029
|
+
const fetchData = useCallback(async () => {
|
|
1030
|
+
if (requestCache.has(cacheKey)) {
|
|
1031
|
+
return requestCache.get(cacheKey);
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
const promise = fetch(url, options).then(res => res.json());
|
|
1035
|
+
requestCache.set(cacheKey, promise);
|
|
1036
|
+
|
|
1037
|
+
// Clear cache after 5 minutes
|
|
1038
|
+
setTimeout(() => {
|
|
1039
|
+
requestCache.delete(cacheKey);
|
|
1040
|
+
}, 5 * 60 * 1000);
|
|
1041
|
+
|
|
1042
|
+
return promise;
|
|
1043
|
+
}, [cacheKey]);
|
|
1044
|
+
|
|
1045
|
+
return fetchData;
|
|
1046
|
+
}
|
|
1047
|
+
```
|
|
1048
|
+
|
|
1049
|
+
#### Batch API Calls
|
|
1050
|
+
|
|
1051
|
+
```tsx
|
|
1052
|
+
import { useCallback } from 'react';
|
|
1053
|
+
|
|
1054
|
+
function useBatchRequests() {
|
|
1055
|
+
const batchRequests = useCallback(async (requests: any[]) => {
|
|
1056
|
+
// Group requests by endpoint
|
|
1057
|
+
const groupedRequests = requests.reduce((groups, request) => {
|
|
1058
|
+
const key = request.endpoint;
|
|
1059
|
+
if (!groups[key]) groups[key] = [];
|
|
1060
|
+
groups[key].push(request);
|
|
1061
|
+
return groups;
|
|
1062
|
+
}, {});
|
|
1063
|
+
|
|
1064
|
+
// Execute batches in parallel
|
|
1065
|
+
const results = await Promise.all(
|
|
1066
|
+
Object.entries(groupedRequests).map(([endpoint, batch]) =>
|
|
1067
|
+
api.batchRequest(endpoint, batch)
|
|
1068
|
+
)
|
|
1069
|
+
);
|
|
1070
|
+
|
|
1071
|
+
return results.flat();
|
|
1072
|
+
}, []);
|
|
1073
|
+
|
|
1074
|
+
return batchRequests;
|
|
1075
|
+
}
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
### Code Splitting Strategies
|
|
1079
|
+
|
|
1080
|
+
#### Route-Based Splitting
|
|
1081
|
+
|
|
1082
|
+
```tsx
|
|
1083
|
+
import { lazy, Suspense } from 'react';
|
|
1084
|
+
import { Routes, Route } from 'react-router-dom';
|
|
1085
|
+
|
|
1086
|
+
// Lazy load route components
|
|
1087
|
+
const Dashboard = lazy(() => import('./pages/Dashboard'));
|
|
1088
|
+
const Users = lazy(() => import('./pages/Users'));
|
|
1089
|
+
const Settings = lazy(() => import('./pages/Settings'));
|
|
1090
|
+
|
|
1091
|
+
function App() {
|
|
1092
|
+
return (
|
|
1093
|
+
<Suspense fallback={<LoadingSpinner />}>
|
|
1094
|
+
<Routes>
|
|
1095
|
+
<Route path="/" element={<Dashboard />} />
|
|
1096
|
+
<Route path="/users" element={<Users />} />
|
|
1097
|
+
<Route path="/settings" element={<Settings />} />
|
|
1098
|
+
</Routes>
|
|
1099
|
+
</Suspense>
|
|
1100
|
+
);
|
|
1101
|
+
}
|
|
1102
|
+
```
|
|
1103
|
+
|
|
1104
|
+
#### Feature-Based Splitting
|
|
1105
|
+
|
|
1106
|
+
```tsx
|
|
1107
|
+
import { lazy, Suspense } from 'react';
|
|
1108
|
+
import { useCan } from '@jmruthers/pace-core';
|
|
1109
|
+
|
|
1110
|
+
// Lazy load admin features
|
|
1111
|
+
const AdminPanel = lazy(() => import('./AdminPanel'));
|
|
1112
|
+
const UserManagement = lazy(() => import('./UserManagement'));
|
|
1113
|
+
|
|
1114
|
+
function App() {
|
|
1115
|
+
const { hasPermission } = useCan();
|
|
1116
|
+
|
|
1117
|
+
return (
|
|
1118
|
+
<div>
|
|
1119
|
+
<MainContent />
|
|
1120
|
+
|
|
1121
|
+
{hasPermission('admin:access') && (
|
|
1122
|
+
<Suspense fallback={<div>Loading admin features...</div>}>
|
|
1123
|
+
<AdminPanel />
|
|
1124
|
+
</Suspense>
|
|
1125
|
+
)}
|
|
1126
|
+
|
|
1127
|
+
{hasPermission('users:manage') && (
|
|
1128
|
+
<Suspense fallback={<div>Loading user management...</div>}>
|
|
1129
|
+
<UserManagement />
|
|
1130
|
+
</Suspense>
|
|
1131
|
+
)}
|
|
1132
|
+
</div>
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
```
|
|
1136
|
+
|
|
1137
|
+
### Performance Monitoring
|
|
1138
|
+
|
|
1139
|
+
#### Real-Time Performance Tracking
|
|
1140
|
+
|
|
1141
|
+
```tsx
|
|
1142
|
+
import { useEffect } from 'react';
|
|
1143
|
+
|
|
1144
|
+
function usePerformanceMonitor() {
|
|
1145
|
+
useEffect(() => {
|
|
1146
|
+
// Monitor Core Web Vitals
|
|
1147
|
+
const observer = new PerformanceObserver((list) => {
|
|
1148
|
+
for (const entry of list.getEntries()) {
|
|
1149
|
+
console.log('Performance metric:', {
|
|
1150
|
+
name: entry.name,
|
|
1151
|
+
value: entry.value,
|
|
1152
|
+
startTime: entry.startTime
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1156
|
+
|
|
1157
|
+
observer.observe({ entryTypes: ['measure', 'navigation'] });
|
|
1158
|
+
|
|
1159
|
+
return () => observer.disconnect();
|
|
1160
|
+
}, []);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// Usage in components
|
|
1164
|
+
function MyComponent() {
|
|
1165
|
+
usePerformanceMonitor();
|
|
1166
|
+
|
|
1167
|
+
return <div>Component content</div>;
|
|
1168
|
+
}
|
|
1169
|
+
```
|
|
1170
|
+
|
|
1171
|
+
#### Bundle Size Monitoring
|
|
1172
|
+
|
|
1173
|
+
```bash
|
|
1174
|
+
# Add to package.json scripts
|
|
1175
|
+
{
|
|
1176
|
+
"scripts": {
|
|
1177
|
+
"analyze": "npm run build && npx vite-bundle-visualizer",
|
|
1178
|
+
"size-check": "npm run build && npx bundlesize"
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
# Monitor bundle size
|
|
1183
|
+
npm run analyze
|
|
1184
|
+
```
|
|
1185
|
+
|
|
1186
|
+
### Performance Testing
|
|
1187
|
+
|
|
1188
|
+
#### Automated Performance Tests
|
|
1189
|
+
|
|
1190
|
+
```typescript
|
|
1191
|
+
// performance.test.ts
|
|
1192
|
+
import { render, screen } from '@testing-library/react';
|
|
1193
|
+
import { performance } from 'perf_hooks';
|
|
1194
|
+
|
|
1195
|
+
describe('Performance Tests', () => {
|
|
1196
|
+
test('DataTable renders within performance budget', async () => {
|
|
1197
|
+
const start = performance.now();
|
|
1198
|
+
|
|
1199
|
+
render(<DataTable data={largeDataset} columns={columns} />);
|
|
1200
|
+
|
|
1201
|
+
await screen.findByRole('table');
|
|
1202
|
+
|
|
1203
|
+
const end = performance.now();
|
|
1204
|
+
const renderTime = end - start;
|
|
1205
|
+
|
|
1206
|
+
// Should render within 100ms
|
|
1207
|
+
expect(renderTime).toBeLessThan(100);
|
|
1208
|
+
});
|
|
1209
|
+
|
|
1210
|
+
test('Component re-renders are optimized', () => {
|
|
1211
|
+
let renderCount = 0;
|
|
1212
|
+
|
|
1213
|
+
const TestComponent = () => {
|
|
1214
|
+
renderCount++;
|
|
1215
|
+
return <div>Test</div>;
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
const { rerender } = render(<TestComponent />);
|
|
1219
|
+
|
|
1220
|
+
// Re-render with same props
|
|
1221
|
+
rerender(<TestComponent />);
|
|
1222
|
+
|
|
1223
|
+
// Should not cause unnecessary re-renders
|
|
1224
|
+
expect(renderCount).toBe(1);
|
|
1225
|
+
});
|
|
1226
|
+
});
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
## Performance Checklist
|
|
1230
|
+
|
|
1231
|
+
### Development Phase
|
|
1232
|
+
- [ ] Use React.memo for expensive components
|
|
1233
|
+
- [ ] Implement useCallback for event handlers
|
|
1234
|
+
- [ ] Use useMemo for expensive calculations
|
|
1235
|
+
- [ ] Implement proper cleanup in useEffect
|
|
1236
|
+
- [ ] Use dynamic imports for large components
|
|
1237
|
+
- [ ] Optimize bundle with tree shaking
|
|
1238
|
+
|
|
1239
|
+
### Production Phase
|
|
1240
|
+
- [ ] Enable production optimizations
|
|
1241
|
+
- [ ] Monitor Core Web Vitals
|
|
1242
|
+
- [ ] Implement performance budgets
|
|
1243
|
+
- [ ] Set up performance monitoring
|
|
1244
|
+
- [ ] Test with real data volumes
|
|
1245
|
+
- [ ] Optimize images and assets
|
|
1246
|
+
|
|
1247
|
+
### Monitoring Phase
|
|
1248
|
+
- [ ] Track bundle size over time
|
|
1249
|
+
- [ ] Monitor render performance
|
|
1250
|
+
- [ ] Watch for memory leaks
|
|
1251
|
+
- [ ] Analyze user experience metrics
|
|
1252
|
+
- [ ] Set up performance alerts
|
|
1253
|
+
- [ ] Regular performance audits
|
|
1254
|
+
|
|
1255
|
+
## Related Documentation
|
|
1256
|
+
|
|
1257
|
+
- [Data Tables Performance](../implementation-guides/data-tables.md#performance-optimization) - DataTable-specific optimizations
|
|
1258
|
+
- [Authentication Performance](../implementation-guides/authentication.md#performance) - Auth-related performance
|
|
1259
|
+
- [Best Practices Overview](./README.md) - General best practices
|
|
1260
|
+
- [Troubleshooting Performance Issues](../troubleshooting/README.md#performance-issues) - Performance debugging
|
|
1261
|
+
|
|
789
1262
|
For more information about optimizing your application, see the [Security Guide](./security.md) and [Testing Guide](./testing.md).
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Security Best Practices
|
|
2
8
|
|
|
3
9
|
Security is a critical aspect of any application. This guide provides comprehensive security best practices for using `@jmruthers/pace-core` in your applications.
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Testing Best Practices
|
|
2
8
|
|
|
3
9
|
Comprehensive testing is essential for maintaining code quality and preventing regressions. This guide provides testing strategies and patterns for `@jmruthers/pace-core` applications.
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Authentication
|
|
2
8
|
|
|
3
9
|
> **📚 Core Concepts** | [← Back to Documentation](../README.md) | [Quick Start](../getting-started/quick-start.md) | [RBAC](../rbac/README.md)
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastUpdated: 2025-10-29T22:43:00+11:00
|
|
3
|
+
version: 0.5.76
|
|
4
|
+
reviewedBy: content-audit
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# RBAC System
|
|
2
8
|
|
|
3
9
|
> **📚 New Developer?** Start with the [Installation](../getting-started/installation.md) guide, then [Quick Start](../getting-started/quick-start.md) to build your first app.
|
|
@@ -6,6 +12,8 @@ PACE Core provides a comprehensive Role-Based Access Control (RBAC) system that
|
|
|
6
12
|
|
|
7
13
|
> **🔄 Migrating?** If you're upgrading from the legacy RBAC system, see the [Migration Guide](../migration/rbac-migration.md) for step-by-step instructions.
|
|
8
14
|
|
|
15
|
+
> **⚠️ IMPORTANT**: You **must** call `setupRBAC()` before using any RBAC features. See the [Quick Start Guide](../rbac/quick-start.md) for setup instructions.
|
|
16
|
+
|
|
9
17
|
## Overview
|
|
10
18
|
|
|
11
19
|
The RBAC system provides:
|