@almadar/orb 4.0.0 → 4.0.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 +57 -19
- package/bin/{almadar → orb} +30 -24
- package/package.json +10 -10
- package/scripts/postinstall.js +25 -15
- package/shells/almadar-shell/LICENSE +72 -21
- package/shells/almadar-shell/README.md +1 -1
- package/shells/almadar-shell/package.json +27 -6
- package/shells/almadar-shell/packages/client/eslint.config.cjs +34 -1
- package/shells/almadar-shell/packages/client/package.json +34 -26
- package/shells/almadar-shell/packages/client/src/App.tsx +26 -2
- package/shells/almadar-shell/packages/client/src/config/firebase.ts +23 -2
- package/shells/almadar-shell/packages/client/src/config/mockAuth.ts +257 -0
- package/shells/almadar-shell/packages/client/src/features/auth/AuthContext.tsx +16 -3
- package/shells/almadar-shell/packages/client/src/features/auth/authService.ts +28 -7
- package/shells/almadar-shell/packages/client/src/features/auth/components/PersonaSwitcher.tsx +50 -0
- package/shells/almadar-shell/packages/client/src/features/auth/components/ProtectedRoute.tsx +9 -0
- package/shells/almadar-shell/packages/client/src/features/auth/index.ts +2 -1
- package/shells/almadar-shell/packages/client/src/features/auth/types.ts +18 -2
- package/shells/almadar-shell/packages/client/src/index.css +4 -20
- package/shells/almadar-shell/packages/client/src/main.tsx +1 -3
- package/shells/almadar-shell/packages/client/tailwind-preset.cjs +259 -0
- package/shells/almadar-shell/packages/client/tailwind.config.js +21 -2
- package/shells/almadar-shell/packages/client/vite.config.ts +1 -0
- package/shells/almadar-shell/packages/server/eslint.config.cjs +4 -0
- package/shells/almadar-shell/packages/server/package.json +13 -8
- package/shells/almadar-shell/packages/server/pnpm-lock.yaml +4723 -0
- package/shells/almadar-shell/packages/server/src/app.ts +58 -3
- package/shells/almadar-shell/packages/server/src/hooks-providers.ts +11 -0
- package/shells/almadar-shell/packages/server/src/index.ts +41 -2
- package/shells/almadar-shell/packages/server/src/services/clients.ts +17 -0
- package/shells/almadar-shell/packages/server/src/sse.ts +20 -0
- package/shells/almadar-shell/packages/server/src/types/express.d.ts +3 -7
- package/shells/almadar-shell/packages/server/tsconfig.json +0 -1
- package/shells/almadar-shell/packages/shared/package.json +1 -0
- package/shells/almadar-shell/packages/shared/pnpm-lock.yaml +22 -0
- package/shells/almadar-shell/pnpm-lock.yaml +4110 -2183
- package/shells/almadar-shell-hono/LICENSE +72 -0
- package/shells/almadar-shell-hono/README.md +25 -0
- package/shells/almadar-shell-hono/locales/en.json +120 -0
- package/shells/almadar-shell-hono/package.json +37 -0
- package/shells/almadar-shell-hono/packages/client/eslint.config.cjs +23 -0
- package/shells/almadar-shell-hono/packages/client/index.html +13 -0
- package/shells/almadar-shell-hono/packages/client/package-lock.json +9750 -0
- package/shells/almadar-shell-hono/packages/client/package.json +61 -0
- package/shells/almadar-shell-hono/packages/client/postcss.config.js +6 -0
- package/shells/almadar-shell-hono/packages/client/src/App.tsx +81 -0
- package/shells/almadar-shell-hono/packages/client/src/config/firebase.ts +58 -0
- package/shells/almadar-shell-hono/packages/client/src/features/auth/AuthContext.tsx +144 -0
- package/shells/almadar-shell-hono/packages/client/src/features/auth/authService.ts +86 -0
- package/shells/almadar-shell-hono/packages/client/src/features/auth/components/Login.tsx +218 -0
- package/shells/almadar-shell-hono/packages/client/src/features/auth/components/ProtectedRoute.tsx +36 -0
- package/shells/almadar-shell-hono/packages/client/src/features/auth/components/UserProfile.tsx +68 -0
- package/shells/almadar-shell-hono/packages/client/src/features/auth/components/index.ts +3 -0
- package/shells/almadar-shell-hono/packages/client/src/features/auth/index.ts +13 -0
- package/shells/almadar-shell-hono/packages/client/src/features/auth/types.ts +24 -0
- package/shells/almadar-shell-hono/packages/client/src/index.css +35 -0
- package/shells/almadar-shell-hono/packages/client/src/main.tsx +8 -0
- package/shells/almadar-shell-hono/packages/client/src/navigation/index.ts +55 -0
- package/shells/almadar-shell-hono/packages/client/src/pages/index.ts +12 -0
- package/shells/almadar-shell-hono/packages/client/tailwind-preset.cjs +259 -0
- package/shells/almadar-shell-hono/packages/client/tailwind.config.js +24 -0
- package/shells/almadar-shell-hono/packages/client/tsconfig.json +33 -0
- package/shells/almadar-shell-hono/packages/client/vite.config.ts +50 -0
- package/shells/almadar-shell-hono/packages/server/eslint.config.cjs +19 -0
- package/shells/almadar-shell-hono/packages/server/package.json +38 -0
- package/shells/almadar-shell-hono/packages/server/pnpm-lock.yaml +4665 -0
- package/shells/almadar-shell-hono/packages/server/src/app.ts +70 -0
- package/shells/almadar-shell-hono/packages/server/src/hooks-providers.ts +11 -0
- package/shells/almadar-shell-hono/packages/server/src/index.ts +70 -0
- package/shells/almadar-shell-hono/packages/server/src/routes.ts +12 -0
- package/shells/almadar-shell-hono/packages/server/src/serve.ts +47 -0
- package/shells/almadar-shell-hono/packages/server/src/services/clients.ts +17 -0
- package/shells/almadar-shell-hono/packages/server/src/sse.ts +20 -0
- package/shells/almadar-shell-hono/packages/server/tsconfig.json +22 -0
- package/shells/almadar-shell-hono/packages/shared/package.json +25 -0
- package/shells/almadar-shell-hono/packages/shared/pnpm-lock.yaml +919 -0
- package/shells/almadar-shell-hono/packages/shared/src/index.ts +2 -0
- package/shells/almadar-shell-hono/packages/shared/tsconfig.json +17 -0
- package/shells/almadar-shell-hono/packages/shared/tsup.config.ts +10 -0
- package/shells/almadar-shell-hono/pnpm-lock.yaml +12532 -0
- package/shells/almadar-shell-hono/pnpm-workspace.yaml +2 -0
- package/shells/almadar-shell-hono/tsup.config.ts +13 -0
- package/shells/almadar-shell-hono/turbo.json +17 -0
- package/shells/almadar-shell-hono/vitest.config.ts +8 -0
- package/shells/orb-shell/README.md +1 -1
- package/shells/orb-shell/package.json +1 -1
- package/shells/orb-shell/packages/client/package-lock.json +11390 -0
- package/shells/orb-shell/packages/client/package.json +1 -1
- package/shells/orb-shell/packages/client/tailwind.config.js +1 -1
- package/shells/orb-shell/packages/server/package-lock.json +6323 -0
- package/shells/orb-shell/packages/shared/package-lock.json +24 -0
- package/shells/orb-shell/pnpm-lock.yaml +196 -10
- /package/shells/orb-shell/packages/client/{tailwind-preset.js → tailwind-preset.cjs} +0 -0
package/shells/almadar-shell-hono/packages/client/src/features/auth/components/ProtectedRoute.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Navigate } from 'react-router-dom';
|
|
3
|
+
import { useAuthContext } from '../AuthContext';
|
|
4
|
+
import { isAuthEnabled } from '../../../config/firebase';
|
|
5
|
+
|
|
6
|
+
interface ProtectedRouteProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ children }) => {
|
|
11
|
+
const { user, loading } = useAuthContext();
|
|
12
|
+
|
|
13
|
+
if (loading) {
|
|
14
|
+
return (
|
|
15
|
+
<div className="min-h-screen flex items-center justify-center">
|
|
16
|
+
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600" />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Auth-disabled mode (no Firebase config): nothing can sign in, so
|
|
22
|
+
// gating would strand every route on /login — pass straight through.
|
|
23
|
+
// Checked after `loading` so a configured-but-initializing Firebase
|
|
24
|
+
// still shows the spinner instead of flashing protected content.
|
|
25
|
+
if (!isAuthEnabled()) {
|
|
26
|
+
return <>{children}</>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!user) {
|
|
30
|
+
return <Navigate to="/login" replace />;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return <>{children}</>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default ProtectedRoute;
|
package/shells/almadar-shell-hono/packages/client/src/features/auth/components/UserProfile.tsx
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { useAuthContext } from '../AuthContext';
|
|
3
|
+
|
|
4
|
+
const UserProfile: React.FC = () => {
|
|
5
|
+
const { user, loading, signOut } = useAuthContext();
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const handleClickOutside = (e: MouseEvent) => {
|
|
11
|
+
if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);
|
|
12
|
+
};
|
|
13
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
14
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
15
|
+
}, []);
|
|
16
|
+
|
|
17
|
+
if (!user) return null;
|
|
18
|
+
|
|
19
|
+
const handleSignOut = async () => {
|
|
20
|
+
setOpen(false);
|
|
21
|
+
await signOut();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div ref={ref} className="relative">
|
|
26
|
+
<button
|
|
27
|
+
onClick={() => setOpen(!open)}
|
|
28
|
+
className="flex items-center space-x-2 hover:opacity-80 transition-opacity"
|
|
29
|
+
>
|
|
30
|
+
{user.photoURL ? (
|
|
31
|
+
<img
|
|
32
|
+
className="h-8 w-8 rounded-full ring-2 ring-gray-200 dark:ring-gray-700"
|
|
33
|
+
src={user.photoURL}
|
|
34
|
+
alt={user.displayName || 'User'}
|
|
35
|
+
/>
|
|
36
|
+
) : (
|
|
37
|
+
<div className="h-8 w-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center text-sm font-medium text-gray-600 dark:text-gray-300">
|
|
38
|
+
{(user.displayName || user.email || 'U')[0].toUpperCase()}
|
|
39
|
+
</div>
|
|
40
|
+
)}
|
|
41
|
+
</button>
|
|
42
|
+
|
|
43
|
+
{open && (
|
|
44
|
+
<div className="absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white dark:bg-gray-800 ring-1 ring-black/5 dark:ring-white/10 z-50">
|
|
45
|
+
<div className="px-4 py-3 border-b border-gray-100 dark:border-gray-700">
|
|
46
|
+
<p className="text-sm font-medium text-gray-900 dark:text-gray-100 truncate">
|
|
47
|
+
{user.displayName || 'User'}
|
|
48
|
+
</p>
|
|
49
|
+
<p className="text-sm text-gray-500 dark:text-gray-400 truncate">
|
|
50
|
+
{user.email}
|
|
51
|
+
</p>
|
|
52
|
+
</div>
|
|
53
|
+
<div className="py-1">
|
|
54
|
+
<button
|
|
55
|
+
onClick={handleSignOut}
|
|
56
|
+
disabled={loading}
|
|
57
|
+
className="w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50"
|
|
58
|
+
>
|
|
59
|
+
Sign Out
|
|
60
|
+
</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default UserProfile;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Context
|
|
2
|
+
export { AuthProvider, useAuthContext } from './AuthContext';
|
|
3
|
+
|
|
4
|
+
// Components
|
|
5
|
+
export { default as Login } from './components/Login';
|
|
6
|
+
export { default as UserProfile } from './components/UserProfile';
|
|
7
|
+
export { default as ProtectedRoute } from './components/ProtectedRoute';
|
|
8
|
+
|
|
9
|
+
// Service
|
|
10
|
+
export { authService } from './authService';
|
|
11
|
+
|
|
12
|
+
// Types
|
|
13
|
+
export type { AuthContextType, LoginCredentials, SignUpCredentials } from './types';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { User } from 'firebase/auth';
|
|
2
|
+
|
|
3
|
+
export interface LoginCredentials {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SignUpCredentials extends LoginCredentials {
|
|
9
|
+
displayName?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AuthContextType {
|
|
13
|
+
user: User | null;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
error: string | null;
|
|
16
|
+
signInWithGoogle: () => Promise<void>;
|
|
17
|
+
signOut: () => Promise<void>;
|
|
18
|
+
signInWithEmail: (email: string, password: string) => Promise<void>;
|
|
19
|
+
signUpWithEmail: (email: string, password: string, displayName?: string) => Promise<void>;
|
|
20
|
+
sendSignInLinkToEmail: (email: string) => Promise<void>;
|
|
21
|
+
signInWithEmailLink: (email: string, emailLink: string) => Promise<void>;
|
|
22
|
+
isSignInWithEmailLink: (emailLink: string) => boolean;
|
|
23
|
+
clearError: () => void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* Import Almadar theme - @import must precede @tailwind directives */
|
|
2
|
+
@import '@almadar/ui/themes/almadar.css';
|
|
3
|
+
|
|
4
|
+
@tailwind base;
|
|
5
|
+
@tailwind components;
|
|
6
|
+
@tailwind utilities;
|
|
7
|
+
|
|
8
|
+
/* Page-level layout: padding and max-width for main content area */
|
|
9
|
+
.ui-slot-main {
|
|
10
|
+
padding: 1.5rem 1rem;
|
|
11
|
+
max-width: 80rem;
|
|
12
|
+
margin-left: auto;
|
|
13
|
+
margin-right: auto;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@media (min-width: 768px) {
|
|
17
|
+
.ui-slot-main {
|
|
18
|
+
padding: 1.5rem 1.5rem;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (min-width: 1024px) {
|
|
23
|
+
.ui-slot-main {
|
|
24
|
+
padding: 2rem 2rem;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Global transition baseline: smooth state changes on interactive elements */
|
|
29
|
+
button,
|
|
30
|
+
a,
|
|
31
|
+
[role="button"],
|
|
32
|
+
[data-entity-row],
|
|
33
|
+
[data-interactive] {
|
|
34
|
+
transition: all var(--transition-normal, 250ms) var(--transition-timing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
35
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Module for Compiled Shells
|
|
3
|
+
*
|
|
4
|
+
* Re-exports schema-driven navigation from @almadar/ui/renderer.
|
|
5
|
+
* This module provides unified navigation that:
|
|
6
|
+
* - Finds pages by path pattern (supports :id params)
|
|
7
|
+
* - Switches active page via NavigationContext
|
|
8
|
+
* - Fires INIT events with merged payload (route params + explicit)
|
|
9
|
+
* - Optionally updates browser URL via history.pushState
|
|
10
|
+
*
|
|
11
|
+
* Usage in generated pages:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { useNavigateTo, useInitPayload } from '../navigation';
|
|
14
|
+
*
|
|
15
|
+
* function InspectionsPage() {
|
|
16
|
+
* const navigateTo = useNavigateTo();
|
|
17
|
+
* const initPayload = useInitPayload();
|
|
18
|
+
*
|
|
19
|
+
* const handleRowClick = (item) => {
|
|
20
|
+
* navigateTo(`/inspection/${item.id}`, { id: item.id });
|
|
21
|
+
* };
|
|
22
|
+
*
|
|
23
|
+
* // Use initPayload for INIT event handling
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
// Re-export all navigation utilities from @almadar/ui/renderer
|
|
31
|
+
export {
|
|
32
|
+
// Context and Provider
|
|
33
|
+
NavigationProvider,
|
|
34
|
+
useNavigation,
|
|
35
|
+
useNavigateTo,
|
|
36
|
+
useNavigationState,
|
|
37
|
+
useInitPayload,
|
|
38
|
+
useActivePage,
|
|
39
|
+
useNavigationId,
|
|
40
|
+
// Path utilities
|
|
41
|
+
matchPath,
|
|
42
|
+
extractRouteParams,
|
|
43
|
+
pathMatches,
|
|
44
|
+
// Page finding utilities
|
|
45
|
+
findPageByPath,
|
|
46
|
+
findPageByName,
|
|
47
|
+
getDefaultPage,
|
|
48
|
+
getAllPages,
|
|
49
|
+
} from '@almadar/ui/renderer';
|
|
50
|
+
|
|
51
|
+
export type {
|
|
52
|
+
NavigationState,
|
|
53
|
+
NavigationContextValue,
|
|
54
|
+
NavigationProviderProps,
|
|
55
|
+
} from '@almadar/ui/renderer';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pages Placeholder
|
|
3
|
+
*
|
|
4
|
+
* This directory receives generated page components:
|
|
5
|
+
* - Route pages from OrbitalSchema
|
|
6
|
+
* - Layout components
|
|
7
|
+
*
|
|
8
|
+
* DO NOT EDIT - Contents are overwritten by compiler
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// {{GENERATED_PAGE_EXPORTS}}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @almadar/ui Tailwind Preset
|
|
3
|
+
*
|
|
4
|
+
* Provides the complete Almadar design token system as a Tailwind preset.
|
|
5
|
+
* Includes a safelist for CSS-variable-based arbitrary classes that use
|
|
6
|
+
* bracket notation (Tailwind can't extract these from source scanning).
|
|
7
|
+
*
|
|
8
|
+
* Note: @almadar/ui dist content scanning is handled by tailwind.config.js
|
|
9
|
+
* in the shell template, not here. The config resolves the dist path via
|
|
10
|
+
* require.resolve('@almadar/ui') which works regardless of hoisting.
|
|
11
|
+
*
|
|
12
|
+
* Usage in tailwind.config.js:
|
|
13
|
+
* presets: [require('@almadar/ui/tailwind-preset')]
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** @type {import('tailwindcss').Config} */
|
|
17
|
+
module.exports = {
|
|
18
|
+
darkMode: 'class',
|
|
19
|
+
safelist: [
|
|
20
|
+
// Standard utilities used via dynamic className from .orb schemas
|
|
21
|
+
'p-4', 'p-6', 'p-8',
|
|
22
|
+
'px-4', 'px-6', 'py-4', 'py-6',
|
|
23
|
+
'mx-auto',
|
|
24
|
+
'w-full',
|
|
25
|
+
'max-w-sm', 'max-w-md', 'max-w-lg', 'max-w-xl', 'max-w-2xl', 'max-w-3xl', 'max-w-4xl', 'max-w-5xl', 'max-w-6xl', 'max-w-7xl',
|
|
26
|
+
'min-h-screen',
|
|
27
|
+
'gap-1', 'gap-2', 'gap-3', 'gap-4', 'gap-6', 'gap-8',
|
|
28
|
+
'grid-cols-1', 'grid-cols-2', 'grid-cols-3', 'grid-cols-4',
|
|
29
|
+
'sm:grid-cols-2', 'md:grid-cols-2', 'md:grid-cols-3', 'lg:grid-cols-3', 'lg:grid-cols-4',
|
|
30
|
+
'text-center', 'text-left', 'text-right',
|
|
31
|
+
// CSS variable-based classes from @almadar/ui components
|
|
32
|
+
'accent-[var(--color-foreground)]',
|
|
33
|
+
'accent-[var(--color-primary)]',
|
|
34
|
+
'active:bg-[var(--color-muted)]',
|
|
35
|
+
'active:bg-[var(--color-primary)]',
|
|
36
|
+
'active:scale-[var(--active-scale)]',
|
|
37
|
+
'active:shadow-[var(--shadow-active)]',
|
|
38
|
+
'active:text-[var(--color-primary-foreground)]',
|
|
39
|
+
'bg-[var(--color-accent)]',
|
|
40
|
+
'bg-[var(--color-background)]',
|
|
41
|
+
'bg-[var(--color-border)]',
|
|
42
|
+
'bg-[var(--color-card)]',
|
|
43
|
+
'bg-[var(--color-error)]',
|
|
44
|
+
'bg-[var(--color-foreground)]',
|
|
45
|
+
'bg-[var(--color-info)]',
|
|
46
|
+
'bg-[var(--color-muted)]',
|
|
47
|
+
'bg-[var(--color-muted-foreground)]',
|
|
48
|
+
':bg-[var(--color-primary)]',
|
|
49
|
+
'bg-[var(--color-primary)]',
|
|
50
|
+
'bg-[var(--color-primary-foreground)]',
|
|
51
|
+
'bg-[var(--color-secondary)]',
|
|
52
|
+
'bg-[var(--color-success)]',
|
|
53
|
+
'bg-[var(--color-surface)]',
|
|
54
|
+
'bg-[var(--color-table-header)]',
|
|
55
|
+
'bg-[var(--color-warning)]',
|
|
56
|
+
'border-b-[length:var(--border-width)]',
|
|
57
|
+
'border-b-[var(--color-foreground)]',
|
|
58
|
+
'border-b-[var(--color-primary)]',
|
|
59
|
+
'border-[length:var(--border-width)]',
|
|
60
|
+
'border-[length:var(--border-width-thin)]',
|
|
61
|
+
'border-l-[length:var(--border-width)]',
|
|
62
|
+
'border-l-[var(--color-foreground)]',
|
|
63
|
+
'border-l-[var(--color-primary)]',
|
|
64
|
+
'border-r-[length:var(--border-width)]',
|
|
65
|
+
'border-r-[var(--color-foreground)]',
|
|
66
|
+
'border-r-[var(--color-primary)]',
|
|
67
|
+
'border-t-[length:var(--border-width)]',
|
|
68
|
+
'border-t-[var(--color-foreground)]',
|
|
69
|
+
'border-t-[var(--color-primary)]',
|
|
70
|
+
'border-[var(--color-accent)]',
|
|
71
|
+
':border-[var(--color-border)]',
|
|
72
|
+
'border-[var(--color-border)]',
|
|
73
|
+
'border-[var(--color-card)]',
|
|
74
|
+
'border-[var(--color-error)]',
|
|
75
|
+
'border-[var(--color-foreground)]',
|
|
76
|
+
'border-[var(--color-info)]',
|
|
77
|
+
':border-[var(--color-primary)]',
|
|
78
|
+
'border-[var(--color-primary)]',
|
|
79
|
+
'border-[var(--color-success)]',
|
|
80
|
+
'border-[var(--color-table-border)]',
|
|
81
|
+
'border-[var(--color-warning)]',
|
|
82
|
+
'border-x-[length:var(--border-width)]',
|
|
83
|
+
'checked:bg-[var(--color-primary)]',
|
|
84
|
+
'dark:bg-[var(--color-background)]',
|
|
85
|
+
'dark:bg-[var(--color-card)]',
|
|
86
|
+
'dark:bg-[var(--color-foreground)]',
|
|
87
|
+
'dark:bg-[var(--color-muted)]',
|
|
88
|
+
'dark:border-[var(--color-border)]',
|
|
89
|
+
'dark:hover:bg-[var(--color-error)]',
|
|
90
|
+
'dark:hover:bg-[var(--color-muted)]',
|
|
91
|
+
'dark:text-[var(--color-error)]',
|
|
92
|
+
'dark:text-[var(--color-foreground)]',
|
|
93
|
+
'dark:text-[var(--color-muted-foreground)]',
|
|
94
|
+
'disabled:bg-[var(--color-muted)]',
|
|
95
|
+
'disabled:text-[var(--color-muted-foreground)]',
|
|
96
|
+
'duration-[var(--transition-fast)]',
|
|
97
|
+
'duration-[var(--transition-normal)]',
|
|
98
|
+
'fill-[var(--color-warning)]',
|
|
99
|
+
'focus:bg-[var(--color-card)]',
|
|
100
|
+
'focus:bg-[var(--color-muted)]',
|
|
101
|
+
'focus:border-[var(--color-error)]',
|
|
102
|
+
'focus:border-[var(--color-primary)]',
|
|
103
|
+
'focus:border-[var(--color-ring)]',
|
|
104
|
+
'focus:ring-[length:var(--focus-ring-width)]',
|
|
105
|
+
'focus:ring-offset-[length:var(--focus-ring-offset)]',
|
|
106
|
+
'focus:ring-[var(--color-error)]',
|
|
107
|
+
'focus:ring-[var(--color-ring)]',
|
|
108
|
+
'font-[var(--font-weight-bold)]',
|
|
109
|
+
'font-[var(--font-weight-medium)]',
|
|
110
|
+
'from-[var(--color-muted)]',
|
|
111
|
+
'group-hover:bg-[var(--color-foreground)]',
|
|
112
|
+
'group-hover:text-[var(--color-foreground)]',
|
|
113
|
+
'group-hover:text-[var(--color-muted-foreground)]',
|
|
114
|
+
'hover:bg-[var(--color-error)]',
|
|
115
|
+
'hover:bg-[var(--color-muted)]',
|
|
116
|
+
'hover:bg-[var(--color-muted-foreground)]',
|
|
117
|
+
'hover:bg-[var(--color-primary)]',
|
|
118
|
+
'hover:bg-[var(--color-primary-hover)]',
|
|
119
|
+
'hover:bg-[var(--color-secondary-hover)]',
|
|
120
|
+
'hover:bg-[var(--color-success)]',
|
|
121
|
+
'hover:bg-[var(--color-surface)]',
|
|
122
|
+
'hover:bg-[var(--color-surface-hover)]',
|
|
123
|
+
'hover:bg-[var(--color-table-row-hover)]',
|
|
124
|
+
'hover:bg-[var(--color-warning)]',
|
|
125
|
+
'hover:border-[var(--color-border)]',
|
|
126
|
+
'hover:border-[var(--color-border-hover)]',
|
|
127
|
+
'hover:border-[var(--color-muted-foreground)]',
|
|
128
|
+
'hover:border-[var(--color-primary)]',
|
|
129
|
+
'hover:ring-[var(--color-ring)]',
|
|
130
|
+
'hover:shadow-[var(--shadow-hover)]',
|
|
131
|
+
'hover:shadow-[var(--shadow-sm)]',
|
|
132
|
+
'hover:text-[var(--color-error)]',
|
|
133
|
+
'hover:text-[var(--color-error-foreground)]',
|
|
134
|
+
'hover:text-[var(--color-foreground)]',
|
|
135
|
+
'hover:text-[var(--color-primary)]',
|
|
136
|
+
'hover:text-[var(--color-success-foreground)]',
|
|
137
|
+
'hover:text-[var(--color-warning-foreground)]',
|
|
138
|
+
'peer-focus:ring-[var(--color-error)]',
|
|
139
|
+
'peer-focus:ring-[var(--color-ring)]',
|
|
140
|
+
'placeholder:text-[var(--color-muted-foreground)]',
|
|
141
|
+
'placeholder:text-[var(--color-placeholder)]',
|
|
142
|
+
'ring-[var(--color-accent)]',
|
|
143
|
+
'ring-[var(--color-error)]',
|
|
144
|
+
'ring-[var(--color-info)]',
|
|
145
|
+
'ring-[var(--color-muted-foreground)]',
|
|
146
|
+
'ring-[var(--color-primary)]',
|
|
147
|
+
'ring-[var(--color-success)]',
|
|
148
|
+
'ring-[var(--color-warning)]',
|
|
149
|
+
'rounded-l-[var(--radius-sm)]',
|
|
150
|
+
'rounded-r-[var(--radius-sm)]',
|
|
151
|
+
'rounded-t-[var(--radius-lg)]',
|
|
152
|
+
'rounded-t-[var(--radius-sm)]',
|
|
153
|
+
'rounded-[var(--radius-full)]',
|
|
154
|
+
'rounded-[var(--radius-lg)]',
|
|
155
|
+
'rounded-[var(--radius-md)]',
|
|
156
|
+
'rounded-[var(--radius-sm)]',
|
|
157
|
+
'rounded-[var(--radius-xl)]',
|
|
158
|
+
'shadow-[var(--shadow-lg)]',
|
|
159
|
+
'shadow-[var(--shadow-main)]',
|
|
160
|
+
'shadow-[var(--shadow-sm)]',
|
|
161
|
+
'text-[var(--color-accent)]',
|
|
162
|
+
'text-[var(--color-accent-foreground)]',
|
|
163
|
+
'text-[var(--color-background)]',
|
|
164
|
+
'text-[var(--color-card-foreground)]',
|
|
165
|
+
'text-[var(--color-error)]',
|
|
166
|
+
'text-[var(--color-error-foreground)]',
|
|
167
|
+
'text-[var(--color-foreground)]',
|
|
168
|
+
'text-[var(--color-info)]',
|
|
169
|
+
'text-[var(--color-info-foreground)]',
|
|
170
|
+
'text-[var(--color-muted)]',
|
|
171
|
+
'text-[var(--color-muted-foreground)]',
|
|
172
|
+
'text-[var(--color-primary)]',
|
|
173
|
+
':text-[var(--color-primary-foreground)]',
|
|
174
|
+
'text-[var(--color-primary-foreground)]',
|
|
175
|
+
'text-[var(--color-secondary-foreground)]',
|
|
176
|
+
'text-[var(--color-success)]',
|
|
177
|
+
'text-[var(--color-warning)]',
|
|
178
|
+
'text-[var(--color-warning-foreground)]',
|
|
179
|
+
'to-[var(--color-accent)]',
|
|
180
|
+
],
|
|
181
|
+
theme: {
|
|
182
|
+
fontFamily: {
|
|
183
|
+
sans: ['var(--font-family)', 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
|
184
|
+
mono: ['var(--font-family-mono, ui-monospace)', 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'monospace'],
|
|
185
|
+
},
|
|
186
|
+
extend: {
|
|
187
|
+
colors: {
|
|
188
|
+
primary: {
|
|
189
|
+
DEFAULT: 'var(--color-primary)',
|
|
190
|
+
foreground: 'var(--color-primary-foreground)',
|
|
191
|
+
hover: 'var(--color-primary-hover)',
|
|
192
|
+
},
|
|
193
|
+
secondary: {
|
|
194
|
+
DEFAULT: 'var(--color-secondary)',
|
|
195
|
+
foreground: 'var(--color-secondary-foreground)',
|
|
196
|
+
hover: 'var(--color-secondary-hover)',
|
|
197
|
+
},
|
|
198
|
+
muted: {
|
|
199
|
+
DEFAULT: 'var(--color-muted)',
|
|
200
|
+
foreground: 'var(--color-muted-foreground)',
|
|
201
|
+
},
|
|
202
|
+
accent: {
|
|
203
|
+
DEFAULT: 'var(--color-accent)',
|
|
204
|
+
foreground: 'var(--color-accent-foreground)',
|
|
205
|
+
},
|
|
206
|
+
background: 'var(--color-background)',
|
|
207
|
+
foreground: 'var(--color-foreground)',
|
|
208
|
+
card: {
|
|
209
|
+
DEFAULT: 'var(--color-card)',
|
|
210
|
+
foreground: 'var(--color-card-foreground)',
|
|
211
|
+
},
|
|
212
|
+
surface: 'var(--color-surface)',
|
|
213
|
+
border: 'var(--color-border)',
|
|
214
|
+
input: 'var(--color-input)',
|
|
215
|
+
ring: 'var(--color-ring)',
|
|
216
|
+
error: {
|
|
217
|
+
DEFAULT: 'var(--color-error)',
|
|
218
|
+
foreground: 'var(--color-error-foreground)',
|
|
219
|
+
},
|
|
220
|
+
success: {
|
|
221
|
+
DEFAULT: 'var(--color-success)',
|
|
222
|
+
foreground: 'var(--color-success-foreground)',
|
|
223
|
+
},
|
|
224
|
+
warning: {
|
|
225
|
+
DEFAULT: 'var(--color-warning)',
|
|
226
|
+
foreground: 'var(--color-warning-foreground)',
|
|
227
|
+
},
|
|
228
|
+
info: {
|
|
229
|
+
DEFAULT: 'var(--color-info)',
|
|
230
|
+
foreground: 'var(--color-info-foreground)',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
borderRadius: {
|
|
234
|
+
none: 'var(--radius-none, 0)',
|
|
235
|
+
sm: 'var(--radius-sm)',
|
|
236
|
+
md: 'var(--radius-md)',
|
|
237
|
+
lg: 'var(--radius-lg)',
|
|
238
|
+
xl: 'var(--radius-xl)',
|
|
239
|
+
full: 'var(--radius-full)',
|
|
240
|
+
},
|
|
241
|
+
boxShadow: {
|
|
242
|
+
sm: 'var(--shadow-sm)',
|
|
243
|
+
DEFAULT: 'var(--shadow-main)',
|
|
244
|
+
lg: 'var(--shadow-lg)',
|
|
245
|
+
inner: 'var(--shadow-inner)',
|
|
246
|
+
},
|
|
247
|
+
fontWeight: {
|
|
248
|
+
normal: 'var(--font-weight-normal, 400)',
|
|
249
|
+
medium: 'var(--font-weight-medium, 500)',
|
|
250
|
+
bold: 'var(--font-weight-bold, 600)',
|
|
251
|
+
},
|
|
252
|
+
transitionDuration: {
|
|
253
|
+
fast: 'var(--transition-fast, 150ms)',
|
|
254
|
+
normal: 'var(--transition-normal, 250ms)',
|
|
255
|
+
slow: 'var(--transition-slow, 400ms)',
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
import { dirname, join } from 'path';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
// Resolve @almadar/ui dist regardless of node_modules hoisting
|
|
6
|
+
const uiEntry = require.resolve('@almadar/ui');
|
|
7
|
+
const uiDist = join(dirname(uiEntry), '..', '**', '*.js');
|
|
8
|
+
|
|
9
|
+
/** @type {import('tailwindcss').Config} */
|
|
10
|
+
export default {
|
|
11
|
+
// Single source of truth for Layer 1 + Layer 2 token mappings is
|
|
12
|
+
// @almadar/ui's published preset. Don't fork a local copy — it goes
|
|
13
|
+
// stale silently and breaks look variants without any build error.
|
|
14
|
+
presets: [require('@almadar/ui/tailwind-preset')],
|
|
15
|
+
content: [
|
|
16
|
+
"./index.html",
|
|
17
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
18
|
+
uiDist,
|
|
19
|
+
],
|
|
20
|
+
theme: {
|
|
21
|
+
extend: {},
|
|
22
|
+
},
|
|
23
|
+
plugins: [],
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
+
"types": ["vite/client"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"strict": true,
|
|
16
|
+
"noUnusedLocals": false,
|
|
17
|
+
"noUnusedParameters": false,
|
|
18
|
+
"noFallthroughCasesInSwitch": true,
|
|
19
|
+
"baseUrl": ".",
|
|
20
|
+
"paths": {
|
|
21
|
+
"@/*": ["./src/*"],
|
|
22
|
+
"@generated/*": ["./src/generated/*"],
|
|
23
|
+
"@pages/*": ["./src/pages/*"],
|
|
24
|
+
"@app/shared": ["../shared/src/index.ts"],
|
|
25
|
+
"@app/shared/*": ["../shared/src/*"],
|
|
26
|
+
"@shared/*": ["../shared/src/*"],
|
|
27
|
+
"@design-system": ["../../../design-system/index.ts"],
|
|
28
|
+
"@design-system/*": ["../../../design-system/*"]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"include": ["src", "../../../design-system/types"],
|
|
32
|
+
"exclude": ["node_modules", "dist", "src/**/__tests__", "src/**/*.stories.ts", "src/**/*.stories.tsx"]
|
|
33
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
export default defineConfig(({ mode }) => {
|
|
6
|
+
const env = loadEnv(mode, process.cwd(), '');
|
|
7
|
+
const backendUrl = env.VITE_API_URL || 'http://localhost:3030';
|
|
8
|
+
const wsUrl = backendUrl.replace('http://', 'ws://').replace('https://', 'wss://');
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
plugins: [react()],
|
|
12
|
+
|
|
13
|
+
resolve: {
|
|
14
|
+
alias: {
|
|
15
|
+
'@design-system': path.resolve(__dirname, '../../../design-system'),
|
|
16
|
+
'@': path.resolve(__dirname, './src'),
|
|
17
|
+
'@generated': path.resolve(__dirname, './src/generated'),
|
|
18
|
+
'@pages': path.resolve(__dirname, './src/pages'),
|
|
19
|
+
'@app/shared': path.resolve(__dirname, '../shared/src'),
|
|
20
|
+
'@shared': path.resolve(__dirname, '../shared/src'),
|
|
21
|
+
},
|
|
22
|
+
dedupe: ['react', 'react-dom', '@almadar/ui'],
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
server: {
|
|
26
|
+
host: true,
|
|
27
|
+
port: 5173,
|
|
28
|
+
proxy: {
|
|
29
|
+
'/api': {
|
|
30
|
+
target: backendUrl,
|
|
31
|
+
changeOrigin: true,
|
|
32
|
+
},
|
|
33
|
+
'/ws': {
|
|
34
|
+
target: wsUrl,
|
|
35
|
+
ws: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
build: {
|
|
41
|
+
outDir: 'dist',
|
|
42
|
+
sourcemap: true,
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
test: {
|
|
46
|
+
environment: 'jsdom',
|
|
47
|
+
globals: true,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const tsParser = require("@typescript-eslint/parser");
|
|
3
|
+
const almadarPlugin = require("@almadar/eslint-plugin");
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
{ ignores: ["dist/**", "node_modules/**", "**/*.test.ts"] },
|
|
7
|
+
{
|
|
8
|
+
files: ["src/**/*.ts"],
|
|
9
|
+
languageOptions: {
|
|
10
|
+
parser: tsParser,
|
|
11
|
+
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
|
|
12
|
+
},
|
|
13
|
+
plugins: { almadar: almadarPlugin },
|
|
14
|
+
rules: {
|
|
15
|
+
"almadar/no-as-any": "error",
|
|
16
|
+
"almadar/no-import-generated": "error",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|