@aventoapp/framework 0.1.0 → 0.2.1
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 +260 -0
- package/dist/index.js.map +1 -1
- package/dist/native/index.js.map +1 -1
- package/dist/offline/index.js +399 -0
- package/dist/offline/index.js.map +7 -0
- package/dist/server/index.js +75 -0
- package/dist/server/index.js.map +3 -3
- package/dist/server/workflow/index.js.map +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/web/index.js.map +1 -1
- package/package.json +10 -7
- package/schemas/Workflow.json +14 -14
- package/schemas/WorkflowHistory.json +22 -22
- package/schemas/WorkflowInstance.json +16 -16
- package/schemas/WorkflowState.json +18 -18
- package/schemas/WorkflowTransition.json +27 -27
- package/src/index.js +8 -8
- package/src/native/components/NativeAuthProvider.jsx +249 -249
- package/src/native/components/NativeDetail.jsx +270 -270
- package/src/native/components/NativeForm.jsx +543 -543
- package/src/native/components/NativeGrid.jsx +90 -90
- package/src/native/components/NativeJsonGrid.jsx +213 -213
- package/src/native/components/NativeJsonView.jsx +454 -454
- package/src/native/components/NativeJsonViewContext.js +17 -17
- package/src/native/components/NativeShell.jsx +68 -68
- package/src/native/components/NativeViewComponent.jsx +351 -351
- package/src/native/extensions/NativeExtensionRegistry.js +81 -81
- package/src/native/hooks/useNativeStore.js +72 -72
- package/src/native/index.js +15 -15
- package/src/native/layouts/NativeStackLayout.jsx +30 -30
- package/src/native/layouts/NativeTabLayout.jsx +96 -96
- package/src/native/storage.js +13 -13
- package/src/native/stores/NativeBaseStore.js +348 -348
- package/src/native/stores/NativeStoreContext.jsx +53 -53
- package/src/offline/clock.js +12 -0
- package/src/offline/coalesce.js +45 -0
- package/src/offline/diff.js +17 -0
- package/src/offline/idb.js +52 -0
- package/src/offline/index.js +13 -0
- package/src/offline/kit.js +121 -0
- package/src/offline/outbox.js +83 -0
- package/src/offline/store.js +26 -0
- package/src/offline/syncer.js +55 -0
- package/src/server/ai/capabilities-routes.js +106 -106
- package/src/server/ai/index.js +1 -1
- package/src/server/cache/MemoryCache.js +153 -153
- package/src/server/cache/index.js +2 -2
- package/src/server/cache/middleware.js +12 -12
- package/src/server/db/index.js +14 -14
- package/src/server/db/mongo.js +137 -137
- package/src/server/db/postgres.js +144 -144
- package/src/server/index.js +42 -38
- package/src/server/middleware/auth.js +682 -682
- package/src/server/middleware/can-flags.js +132 -132
- package/src/server/middleware/entityRoles.js +105 -105
- package/src/server/middleware/index.js +58 -58
- package/src/server/middleware/permissions.js +240 -240
- package/src/server/middleware/tenant.js +203 -203
- package/src/server/offline/field-lww.js +66 -0
- package/src/server/offline/index.js +1 -0
- package/src/server/realtime/EventBus.js +45 -45
- package/src/server/realtime/WebSocketServer.js +105 -105
- package/src/server/realtime/index.js +3 -3
- package/src/server/realtime/middleware.js +18 -18
- package/src/server/services/email-templates.js +157 -157
- package/src/server/services/email.js +78 -78
- package/src/server/services/index.js +15 -15
- package/src/server/services/storage.js +119 -119
- package/src/server/utils/index.js +16 -16
- package/src/server/utils/paginate.js +65 -65
- package/src/server/utils/query-builder.js +293 -293
- package/src/server/utils/route-loader.js +61 -61
- package/src/server/workflow/WorkflowEngine.js +494 -494
- package/src/server/workflow/index.js +2 -2
- package/src/server/workflow/workflow-routes.js +174 -174
- package/src/shared/index.js +10 -10
- package/src/shared/utils/field-accessor.js +108 -108
- package/src/shared/utils/index.js +7 -7
- package/src/shared/utils/validation-utils.js +83 -83
- package/src/web/components/AppRouter/AppRouter.jsx +130 -130
- package/src/web/components/AppRouter/index.js +1 -1
- package/src/web/components/AppShell/AppShell.jsx +101 -101
- package/src/web/components/AppShell/DefaultUserMenu.jsx +54 -54
- package/src/web/components/AppShell/ShellConfig.js +53 -53
- package/src/web/components/AppShell/index.js +3 -3
- package/src/web/components/AuthProvider.jsx +426 -426
- package/src/web/components/CardList/CardList.jsx +272 -272
- package/src/web/components/CardList/index.js +2 -2
- package/src/web/components/DetailView/DetailView.jsx +281 -281
- package/src/web/components/DetailView/index.js +2 -2
- package/src/web/components/Form/Form.jsx +300 -300
- package/src/web/components/Form/FormField.jsx +226 -226
- package/src/web/components/Form/index.js +3 -3
- package/src/web/components/Grid/Grid.jsx +304 -304
- package/src/web/components/Grid/index.js +2 -2
- package/src/web/components/IconRegistry/IconRegistry.jsx +127 -127
- package/src/web/components/IconRegistry/index.js +1 -1
- package/src/web/components/JsonView/JsonView.jsx +647 -647
- package/src/web/components/JsonView/ViewComponent.jsx +1045 -1045
- package/src/web/components/JsonView/ViewToolbar.jsx +141 -141
- package/src/web/components/JsonView/index.js +14 -14
- package/src/web/components/JsonView/layouts/SingleLayout.jsx +41 -41
- package/src/web/components/JsonView/layouts/SplitLayout.jsx +122 -122
- package/src/web/components/JsonView/layouts/TabLayout.jsx +112 -112
- package/src/web/components/JsonView/layouts/index.js +8 -8
- package/src/web/components/Layout.jsx +265 -265
- package/src/web/components/MobileLayout/MobileLayout.jsx +385 -385
- package/src/web/components/MobileLayout/index.js +1 -1
- package/src/web/components/Navigation/Navigation.jsx +248 -248
- package/src/web/components/Navigation/index.js +1 -1
- package/src/web/components/NotificationProvider.jsx +55 -55
- package/src/web/components/Pagination/InfiniteScroll.jsx +82 -82
- package/src/web/components/Pagination/Pagination.jsx +73 -73
- package/src/web/components/Pagination/index.js +8 -8
- package/src/web/components/SimpleList/SimpleList.jsx +177 -177
- package/src/web/components/SimpleList/index.js +2 -2
- package/src/web/components/TenantProvider.jsx +121 -121
- package/src/web/components/WorkflowActions/WorkflowActions.jsx +71 -71
- package/src/web/components/WorkflowActions/index.js +1 -1
- package/src/web/components/WorkflowField/WorkflowField.jsx +176 -176
- package/src/web/components/WorkflowField/index.js +2 -2
- package/src/web/components/WorkflowField/workflowColors.js +32 -32
- package/src/web/components/auth/DevTenantSelector.jsx +90 -90
- package/src/web/components/auth/ForgotPasswordForm.jsx +94 -94
- package/src/web/components/auth/RegisterForm.jsx +168 -168
- package/src/web/components/auth/ResetPasswordForm.jsx +121 -121
- package/src/web/components/auth/VerifyEmailView.jsx +85 -85
- package/src/web/components/auth/index.js +5 -5
- package/src/web/components/index.js +39 -39
- package/src/web/components/layouts/CardListLayout.jsx +68 -68
- package/src/web/components/layouts/FullscreenLayout.jsx +30 -30
- package/src/web/components/layouts/MobileStackLayout.jsx +28 -28
- package/src/web/components/layouts/WizardLayout.jsx +86 -86
- package/src/web/components/layouts/index.js +4 -4
- package/src/web/components/mobile/Badge.jsx +105 -105
- package/src/web/components/mobile/BadgeThemeEditor.jsx +104 -104
- package/src/web/components/mobile/EmptyState.jsx +30 -30
- package/src/web/components/mobile/QuickActionButton.jsx +77 -77
- package/src/web/components/mobile/ServerAutocomplete.jsx +123 -123
- package/src/web/components/mobile/StarRating.jsx +42 -42
- package/src/web/components/mobile/StatCard.jsx +65 -65
- package/src/web/components/mobile/index.js +7 -7
- package/src/web/extensions/ExtensionRegistry.js +79 -79
- package/src/web/extensions/index.js +7 -7
- package/src/web/hooks/index.js +15 -15
- package/src/web/hooks/useApi.js +76 -76
- package/src/web/hooks/useAuth.js +37 -37
- package/src/web/hooks/useDebouncedSave.js +158 -158
- package/src/web/hooks/useIsMobile.js +14 -14
- package/src/web/hooks/useOfflineQueue.js +99 -99
- package/src/web/hooks/useSelectionModel.js +143 -143
- package/src/web/hooks/useServerAutocomplete.js +146 -146
- package/src/web/hooks/useStore.js +107 -107
- package/src/web/hooks/useSubscription.js +130 -130
- package/src/web/hooks/useTenant.js +39 -39
- package/src/web/hooks/useTenantResolver.js +65 -65
- package/src/web/hooks/useUndoRedo.js +77 -77
- package/src/web/hooks/useViews.js +113 -113
- package/src/web/hooks/useWorkflow.js +190 -190
- package/src/web/index.js +117 -117
- package/src/web/stores/BaseStore.js +439 -439
- package/src/web/stores/StoreContext.jsx +93 -93
- package/src/web/stores/index.js +3 -3
- package/src/web/theme/index.js +3 -3
- package/src/web/theme/mui-theme.js +228 -228
- package/src/web/utils/formatTimeAgo.js +22 -22
- package/src/web/utils/index.js +1 -1
- package/src/web/views/ViewRegistry.js +235 -235
- package/src/web/views/index.js +2 -2
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StoreContext
|
|
3
|
-
*
|
|
4
|
-
* React context provider that injects auth/tenant contexts into all stores.
|
|
5
|
-
*/
|
|
6
|
-
import React, { createContext, useContext, useMemo, useRef } from 'react';
|
|
7
|
-
import { useAuth } from '../hooks/useAuth.js';
|
|
8
|
-
import { useTenant } from '../hooks/useTenant.js';
|
|
9
|
-
|
|
10
|
-
export const StoreContext = createContext(null);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* StoreProvider component
|
|
14
|
-
*
|
|
15
|
-
* Wraps the app to provide store access with automatic auth/tenant integration.
|
|
16
|
-
*
|
|
17
|
-
* @param {Object} props
|
|
18
|
-
* @param {Object} props.stores - Object mapping store names to store instances
|
|
19
|
-
* @param {React.ReactNode} props.children
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* import { taskStore } from './stores/task.store';
|
|
23
|
-
*
|
|
24
|
-
* const stores = { task: taskStore };
|
|
25
|
-
*
|
|
26
|
-
* function App() {
|
|
27
|
-
* return (
|
|
28
|
-
* <AuthProvider>
|
|
29
|
-
* <TenantProvider>
|
|
30
|
-
* <StoreProvider stores={stores}>
|
|
31
|
-
* <MyApp />
|
|
32
|
-
* </StoreProvider>
|
|
33
|
-
* </TenantProvider>
|
|
34
|
-
* </AuthProvider>
|
|
35
|
-
* );
|
|
36
|
-
* }
|
|
37
|
-
*/
|
|
38
|
-
export function StoreProvider({ stores = {}, children }) {
|
|
39
|
-
const { getAuthHeader } = useAuth();
|
|
40
|
-
const { getTenantHeader } = useTenant();
|
|
41
|
-
|
|
42
|
-
// Keep stable references
|
|
43
|
-
const storesRef = useRef(stores);
|
|
44
|
-
const getAuthHeaderRef = useRef(getAuthHeader);
|
|
45
|
-
const getTenantHeaderRef = useRef(getTenantHeader);
|
|
46
|
-
|
|
47
|
-
// Update refs when values change
|
|
48
|
-
getAuthHeaderRef.current = getAuthHeader;
|
|
49
|
-
getTenantHeaderRef.current = getTenantHeader;
|
|
50
|
-
|
|
51
|
-
// Initialize all stores with context injectors synchronously so they are
|
|
52
|
-
// ready before child useEffect hooks fire (child effects run before parent effects).
|
|
53
|
-
const initializedRef = useRef(false);
|
|
54
|
-
if (!initializedRef.current) {
|
|
55
|
-
Object.values(storesRef.current).forEach(store => {
|
|
56
|
-
if (store && typeof store._initialize === 'function') {
|
|
57
|
-
store._initialize(
|
|
58
|
-
() => getAuthHeaderRef.current(),
|
|
59
|
-
() => getTenantHeaderRef.current()
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
initializedRef.current = true;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Context value with getStore accessor
|
|
67
|
-
const contextValue = useMemo(() => ({
|
|
68
|
-
stores: storesRef.current,
|
|
69
|
-
getStore: (name) => storesRef.current[name] || null
|
|
70
|
-
}), []);
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<StoreContext.Provider value={contextValue}>
|
|
74
|
-
{children}
|
|
75
|
-
</StoreContext.Provider>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Hook to access the store context
|
|
81
|
-
* @returns {Object} Store context with getStore function
|
|
82
|
-
*/
|
|
83
|
-
export function useStoreContext() {
|
|
84
|
-
const context = useContext(StoreContext);
|
|
85
|
-
|
|
86
|
-
if (context === null) {
|
|
87
|
-
throw new Error('useStoreContext must be used within a StoreProvider');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return context;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export default StoreProvider;
|
|
1
|
+
/**
|
|
2
|
+
* StoreContext
|
|
3
|
+
*
|
|
4
|
+
* React context provider that injects auth/tenant contexts into all stores.
|
|
5
|
+
*/
|
|
6
|
+
import React, { createContext, useContext, useMemo, useRef } from 'react';
|
|
7
|
+
import { useAuth } from '../hooks/useAuth.js';
|
|
8
|
+
import { useTenant } from '../hooks/useTenant.js';
|
|
9
|
+
|
|
10
|
+
export const StoreContext = createContext(null);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* StoreProvider component
|
|
14
|
+
*
|
|
15
|
+
* Wraps the app to provide store access with automatic auth/tenant integration.
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} props
|
|
18
|
+
* @param {Object} props.stores - Object mapping store names to store instances
|
|
19
|
+
* @param {React.ReactNode} props.children
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { taskStore } from './stores/task.store';
|
|
23
|
+
*
|
|
24
|
+
* const stores = { task: taskStore };
|
|
25
|
+
*
|
|
26
|
+
* function App() {
|
|
27
|
+
* return (
|
|
28
|
+
* <AuthProvider>
|
|
29
|
+
* <TenantProvider>
|
|
30
|
+
* <StoreProvider stores={stores}>
|
|
31
|
+
* <MyApp />
|
|
32
|
+
* </StoreProvider>
|
|
33
|
+
* </TenantProvider>
|
|
34
|
+
* </AuthProvider>
|
|
35
|
+
* );
|
|
36
|
+
* }
|
|
37
|
+
*/
|
|
38
|
+
export function StoreProvider({ stores = {}, children }) {
|
|
39
|
+
const { getAuthHeader } = useAuth();
|
|
40
|
+
const { getTenantHeader } = useTenant();
|
|
41
|
+
|
|
42
|
+
// Keep stable references
|
|
43
|
+
const storesRef = useRef(stores);
|
|
44
|
+
const getAuthHeaderRef = useRef(getAuthHeader);
|
|
45
|
+
const getTenantHeaderRef = useRef(getTenantHeader);
|
|
46
|
+
|
|
47
|
+
// Update refs when values change
|
|
48
|
+
getAuthHeaderRef.current = getAuthHeader;
|
|
49
|
+
getTenantHeaderRef.current = getTenantHeader;
|
|
50
|
+
|
|
51
|
+
// Initialize all stores with context injectors synchronously so they are
|
|
52
|
+
// ready before child useEffect hooks fire (child effects run before parent effects).
|
|
53
|
+
const initializedRef = useRef(false);
|
|
54
|
+
if (!initializedRef.current) {
|
|
55
|
+
Object.values(storesRef.current).forEach(store => {
|
|
56
|
+
if (store && typeof store._initialize === 'function') {
|
|
57
|
+
store._initialize(
|
|
58
|
+
() => getAuthHeaderRef.current(),
|
|
59
|
+
() => getTenantHeaderRef.current()
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
initializedRef.current = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Context value with getStore accessor
|
|
67
|
+
const contextValue = useMemo(() => ({
|
|
68
|
+
stores: storesRef.current,
|
|
69
|
+
getStore: (name) => storesRef.current[name] || null
|
|
70
|
+
}), []);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<StoreContext.Provider value={contextValue}>
|
|
74
|
+
{children}
|
|
75
|
+
</StoreContext.Provider>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Hook to access the store context
|
|
81
|
+
* @returns {Object} Store context with getStore function
|
|
82
|
+
*/
|
|
83
|
+
export function useStoreContext() {
|
|
84
|
+
const context = useContext(StoreContext);
|
|
85
|
+
|
|
86
|
+
if (context === null) {
|
|
87
|
+
throw new Error('useStoreContext must be used within a StoreProvider');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return context;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default StoreProvider;
|
package/src/web/stores/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Web Stores
|
|
2
|
-
export { BaseStore } from './BaseStore.js';
|
|
3
|
-
export { StoreProvider, StoreContext, useStoreContext } from './StoreContext.jsx';
|
|
1
|
+
// Web Stores
|
|
2
|
+
export { BaseStore } from './BaseStore.js';
|
|
3
|
+
export { StoreProvider, StoreContext, useStoreContext } from './StoreContext.jsx';
|
package/src/web/theme/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Theme exports
|
|
2
|
-
export { aventoTheme, createAventoTheme, mobileThemeOverrides } from './mui-theme.js';
|
|
3
|
-
export { default as theme } from './mui-theme.js';
|
|
1
|
+
// Theme exports
|
|
2
|
+
export { aventoTheme, createAventoTheme, mobileThemeOverrides } from './mui-theme.js';
|
|
3
|
+
export { default as theme } from './mui-theme.js';
|
|
@@ -1,228 +1,228 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Avento MUI Theme Configuration
|
|
3
|
-
*
|
|
4
|
-
* Default theme for apps built with the Avento framework.
|
|
5
|
-
* Can be customized by apps using createTheme with overrides.
|
|
6
|
-
*/
|
|
7
|
-
import { createTheme } from '@mui/material/styles';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Default color palette
|
|
11
|
-
*/
|
|
12
|
-
const palette = {
|
|
13
|
-
primary: {
|
|
14
|
-
main: '#1976d2',
|
|
15
|
-
light: '#42a5f5',
|
|
16
|
-
dark: '#1565c0',
|
|
17
|
-
contrastText: '#ffffff'
|
|
18
|
-
},
|
|
19
|
-
secondary: {
|
|
20
|
-
main: '#9c27b0',
|
|
21
|
-
light: '#ba68c8',
|
|
22
|
-
dark: '#7b1fa2',
|
|
23
|
-
contrastText: '#ffffff'
|
|
24
|
-
},
|
|
25
|
-
error: {
|
|
26
|
-
main: '#d32f2f',
|
|
27
|
-
light: '#ef5350',
|
|
28
|
-
dark: '#c62828'
|
|
29
|
-
},
|
|
30
|
-
warning: {
|
|
31
|
-
main: '#ed6c02',
|
|
32
|
-
light: '#ff9800',
|
|
33
|
-
dark: '#e65100'
|
|
34
|
-
},
|
|
35
|
-
info: {
|
|
36
|
-
main: '#0288d1',
|
|
37
|
-
light: '#03a9f4',
|
|
38
|
-
dark: '#01579b'
|
|
39
|
-
},
|
|
40
|
-
success: {
|
|
41
|
-
main: '#2e7d32',
|
|
42
|
-
light: '#4caf50',
|
|
43
|
-
dark: '#1b5e20'
|
|
44
|
-
},
|
|
45
|
-
background: {
|
|
46
|
-
default: '#f5f5f5',
|
|
47
|
-
paper: '#ffffff'
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Default typography
|
|
53
|
-
*/
|
|
54
|
-
const typography = {
|
|
55
|
-
fontFamily: [
|
|
56
|
-
'-apple-system',
|
|
57
|
-
'BlinkMacSystemFont',
|
|
58
|
-
'"Segoe UI"',
|
|
59
|
-
'Roboto',
|
|
60
|
-
'"Helvetica Neue"',
|
|
61
|
-
'Arial',
|
|
62
|
-
'sans-serif'
|
|
63
|
-
].join(','),
|
|
64
|
-
h1: {
|
|
65
|
-
fontSize: '2.5rem',
|
|
66
|
-
fontWeight: 500
|
|
67
|
-
},
|
|
68
|
-
h2: {
|
|
69
|
-
fontSize: '2rem',
|
|
70
|
-
fontWeight: 500
|
|
71
|
-
},
|
|
72
|
-
h3: {
|
|
73
|
-
fontSize: '1.75rem',
|
|
74
|
-
fontWeight: 500
|
|
75
|
-
},
|
|
76
|
-
h4: {
|
|
77
|
-
fontSize: '1.5rem',
|
|
78
|
-
fontWeight: 500
|
|
79
|
-
},
|
|
80
|
-
h5: {
|
|
81
|
-
fontSize: '1.25rem',
|
|
82
|
-
fontWeight: 500
|
|
83
|
-
},
|
|
84
|
-
h6: {
|
|
85
|
-
fontSize: '1rem',
|
|
86
|
-
fontWeight: 500
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Default component overrides
|
|
92
|
-
*/
|
|
93
|
-
const components = {
|
|
94
|
-
MuiButton: {
|
|
95
|
-
styleOverrides: {
|
|
96
|
-
root: {
|
|
97
|
-
textTransform: 'none',
|
|
98
|
-
borderRadius: 8
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
defaultProps: {
|
|
102
|
-
disableElevation: true
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
MuiCard: {
|
|
106
|
-
styleOverrides: {
|
|
107
|
-
root: {
|
|
108
|
-
borderRadius: 12
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
MuiPaper: {
|
|
113
|
-
styleOverrides: {
|
|
114
|
-
rounded: {
|
|
115
|
-
borderRadius: 12
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
MuiTextField: {
|
|
120
|
-
defaultProps: {
|
|
121
|
-
variant: 'outlined',
|
|
122
|
-
size: 'small'
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
MuiAppBar: {
|
|
126
|
-
defaultProps: {
|
|
127
|
-
elevation: 0
|
|
128
|
-
},
|
|
129
|
-
styleOverrides: {
|
|
130
|
-
root: {
|
|
131
|
-
borderBottom: '1px solid rgba(0, 0, 0, 0.12)'
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
MuiDrawer: {
|
|
136
|
-
styleOverrides: {
|
|
137
|
-
paper: {
|
|
138
|
-
borderRight: '1px solid rgba(0, 0, 0, 0.12)'
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Create the default Avento theme
|
|
146
|
-
*/
|
|
147
|
-
export const aventoTheme = createTheme({
|
|
148
|
-
palette,
|
|
149
|
-
typography,
|
|
150
|
-
components,
|
|
151
|
-
shape: {
|
|
152
|
-
borderRadius: 8
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Mobile-friendly component overrides.
|
|
158
|
-
* Can be used standalone or auto-applied via createAventoTheme({ mobile: true }).
|
|
159
|
-
*/
|
|
160
|
-
export function mobileThemeOverrides() {
|
|
161
|
-
return {
|
|
162
|
-
MuiButton: {
|
|
163
|
-
styleOverrides: {
|
|
164
|
-
root: {
|
|
165
|
-
minHeight: 48,
|
|
166
|
-
textTransform: 'none',
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
MuiBottomNavigationAction: {
|
|
171
|
-
styleOverrides: {
|
|
172
|
-
root: {
|
|
173
|
-
minWidth: 56,
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Deep-merge component overrides (two levels: component key -> sub-keys).
|
|
182
|
-
*/
|
|
183
|
-
function mergeComponentOverrides(base, additions) {
|
|
184
|
-
const merged = { ...base };
|
|
185
|
-
for (const [key, value] of Object.entries(additions)) {
|
|
186
|
-
if (merged[key]) {
|
|
187
|
-
merged[key] = {
|
|
188
|
-
...merged[key],
|
|
189
|
-
...value,
|
|
190
|
-
styleOverrides: {
|
|
191
|
-
...merged[key].styleOverrides,
|
|
192
|
-
...value.styleOverrides,
|
|
193
|
-
...(merged[key].styleOverrides?.root && value.styleOverrides?.root
|
|
194
|
-
? { root: { ...merged[key].styleOverrides.root, ...value.styleOverrides.root } }
|
|
195
|
-
: {}),
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
} else {
|
|
199
|
-
merged[key] = value;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return merged;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Create a custom theme with Avento defaults
|
|
207
|
-
*
|
|
208
|
-
* @param {Object} options - Theme options to merge with defaults
|
|
209
|
-
* @param {boolean} options.mobile - When true, auto-applies mobileThemeOverrides()
|
|
210
|
-
* @returns {Theme} MUI theme object
|
|
211
|
-
*/
|
|
212
|
-
export function createAventoTheme(options = {}) {
|
|
213
|
-
let mergedComponents = { ...components, ...options.components };
|
|
214
|
-
|
|
215
|
-
if (options.mobile) {
|
|
216
|
-
mergedComponents = mergeComponentOverrides(mergedComponents, mobileThemeOverrides());
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return createTheme({
|
|
220
|
-
palette: { ...palette, ...options.palette },
|
|
221
|
-
typography: { ...typography, ...options.typography },
|
|
222
|
-
components: mergedComponents,
|
|
223
|
-
shape: { borderRadius: 8, ...options.shape },
|
|
224
|
-
...options
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export default aventoTheme;
|
|
1
|
+
/**
|
|
2
|
+
* Avento MUI Theme Configuration
|
|
3
|
+
*
|
|
4
|
+
* Default theme for apps built with the Avento framework.
|
|
5
|
+
* Can be customized by apps using createTheme with overrides.
|
|
6
|
+
*/
|
|
7
|
+
import { createTheme } from '@mui/material/styles';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Default color palette
|
|
11
|
+
*/
|
|
12
|
+
const palette = {
|
|
13
|
+
primary: {
|
|
14
|
+
main: '#1976d2',
|
|
15
|
+
light: '#42a5f5',
|
|
16
|
+
dark: '#1565c0',
|
|
17
|
+
contrastText: '#ffffff'
|
|
18
|
+
},
|
|
19
|
+
secondary: {
|
|
20
|
+
main: '#9c27b0',
|
|
21
|
+
light: '#ba68c8',
|
|
22
|
+
dark: '#7b1fa2',
|
|
23
|
+
contrastText: '#ffffff'
|
|
24
|
+
},
|
|
25
|
+
error: {
|
|
26
|
+
main: '#d32f2f',
|
|
27
|
+
light: '#ef5350',
|
|
28
|
+
dark: '#c62828'
|
|
29
|
+
},
|
|
30
|
+
warning: {
|
|
31
|
+
main: '#ed6c02',
|
|
32
|
+
light: '#ff9800',
|
|
33
|
+
dark: '#e65100'
|
|
34
|
+
},
|
|
35
|
+
info: {
|
|
36
|
+
main: '#0288d1',
|
|
37
|
+
light: '#03a9f4',
|
|
38
|
+
dark: '#01579b'
|
|
39
|
+
},
|
|
40
|
+
success: {
|
|
41
|
+
main: '#2e7d32',
|
|
42
|
+
light: '#4caf50',
|
|
43
|
+
dark: '#1b5e20'
|
|
44
|
+
},
|
|
45
|
+
background: {
|
|
46
|
+
default: '#f5f5f5',
|
|
47
|
+
paper: '#ffffff'
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Default typography
|
|
53
|
+
*/
|
|
54
|
+
const typography = {
|
|
55
|
+
fontFamily: [
|
|
56
|
+
'-apple-system',
|
|
57
|
+
'BlinkMacSystemFont',
|
|
58
|
+
'"Segoe UI"',
|
|
59
|
+
'Roboto',
|
|
60
|
+
'"Helvetica Neue"',
|
|
61
|
+
'Arial',
|
|
62
|
+
'sans-serif'
|
|
63
|
+
].join(','),
|
|
64
|
+
h1: {
|
|
65
|
+
fontSize: '2.5rem',
|
|
66
|
+
fontWeight: 500
|
|
67
|
+
},
|
|
68
|
+
h2: {
|
|
69
|
+
fontSize: '2rem',
|
|
70
|
+
fontWeight: 500
|
|
71
|
+
},
|
|
72
|
+
h3: {
|
|
73
|
+
fontSize: '1.75rem',
|
|
74
|
+
fontWeight: 500
|
|
75
|
+
},
|
|
76
|
+
h4: {
|
|
77
|
+
fontSize: '1.5rem',
|
|
78
|
+
fontWeight: 500
|
|
79
|
+
},
|
|
80
|
+
h5: {
|
|
81
|
+
fontSize: '1.25rem',
|
|
82
|
+
fontWeight: 500
|
|
83
|
+
},
|
|
84
|
+
h6: {
|
|
85
|
+
fontSize: '1rem',
|
|
86
|
+
fontWeight: 500
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Default component overrides
|
|
92
|
+
*/
|
|
93
|
+
const components = {
|
|
94
|
+
MuiButton: {
|
|
95
|
+
styleOverrides: {
|
|
96
|
+
root: {
|
|
97
|
+
textTransform: 'none',
|
|
98
|
+
borderRadius: 8
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
defaultProps: {
|
|
102
|
+
disableElevation: true
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
MuiCard: {
|
|
106
|
+
styleOverrides: {
|
|
107
|
+
root: {
|
|
108
|
+
borderRadius: 12
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
MuiPaper: {
|
|
113
|
+
styleOverrides: {
|
|
114
|
+
rounded: {
|
|
115
|
+
borderRadius: 12
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
MuiTextField: {
|
|
120
|
+
defaultProps: {
|
|
121
|
+
variant: 'outlined',
|
|
122
|
+
size: 'small'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
MuiAppBar: {
|
|
126
|
+
defaultProps: {
|
|
127
|
+
elevation: 0
|
|
128
|
+
},
|
|
129
|
+
styleOverrides: {
|
|
130
|
+
root: {
|
|
131
|
+
borderBottom: '1px solid rgba(0, 0, 0, 0.12)'
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
MuiDrawer: {
|
|
136
|
+
styleOverrides: {
|
|
137
|
+
paper: {
|
|
138
|
+
borderRight: '1px solid rgba(0, 0, 0, 0.12)'
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Create the default Avento theme
|
|
146
|
+
*/
|
|
147
|
+
export const aventoTheme = createTheme({
|
|
148
|
+
palette,
|
|
149
|
+
typography,
|
|
150
|
+
components,
|
|
151
|
+
shape: {
|
|
152
|
+
borderRadius: 8
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Mobile-friendly component overrides.
|
|
158
|
+
* Can be used standalone or auto-applied via createAventoTheme({ mobile: true }).
|
|
159
|
+
*/
|
|
160
|
+
export function mobileThemeOverrides() {
|
|
161
|
+
return {
|
|
162
|
+
MuiButton: {
|
|
163
|
+
styleOverrides: {
|
|
164
|
+
root: {
|
|
165
|
+
minHeight: 48,
|
|
166
|
+
textTransform: 'none',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
MuiBottomNavigationAction: {
|
|
171
|
+
styleOverrides: {
|
|
172
|
+
root: {
|
|
173
|
+
minWidth: 56,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Deep-merge component overrides (two levels: component key -> sub-keys).
|
|
182
|
+
*/
|
|
183
|
+
function mergeComponentOverrides(base, additions) {
|
|
184
|
+
const merged = { ...base };
|
|
185
|
+
for (const [key, value] of Object.entries(additions)) {
|
|
186
|
+
if (merged[key]) {
|
|
187
|
+
merged[key] = {
|
|
188
|
+
...merged[key],
|
|
189
|
+
...value,
|
|
190
|
+
styleOverrides: {
|
|
191
|
+
...merged[key].styleOverrides,
|
|
192
|
+
...value.styleOverrides,
|
|
193
|
+
...(merged[key].styleOverrides?.root && value.styleOverrides?.root
|
|
194
|
+
? { root: { ...merged[key].styleOverrides.root, ...value.styleOverrides.root } }
|
|
195
|
+
: {}),
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
} else {
|
|
199
|
+
merged[key] = value;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return merged;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Create a custom theme with Avento defaults
|
|
207
|
+
*
|
|
208
|
+
* @param {Object} options - Theme options to merge with defaults
|
|
209
|
+
* @param {boolean} options.mobile - When true, auto-applies mobileThemeOverrides()
|
|
210
|
+
* @returns {Theme} MUI theme object
|
|
211
|
+
*/
|
|
212
|
+
export function createAventoTheme(options = {}) {
|
|
213
|
+
let mergedComponents = { ...components, ...options.components };
|
|
214
|
+
|
|
215
|
+
if (options.mobile) {
|
|
216
|
+
mergedComponents = mergeComponentOverrides(mergedComponents, mobileThemeOverrides());
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return createTheme({
|
|
220
|
+
palette: { ...palette, ...options.palette },
|
|
221
|
+
typography: { ...typography, ...options.typography },
|
|
222
|
+
components: mergedComponents,
|
|
223
|
+
shape: { borderRadius: 8, ...options.shape },
|
|
224
|
+
...options
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export default aventoTheme;
|