@nextsparkjs/theme-default 0.1.0-beta.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/about/business.md +49 -0
- package/about/features.json +302 -0
- package/about/team.md +79 -0
- package/api/ai/chat/stream/route.ts +212 -0
- package/api/ai/orchestrator/route.ts +226 -0
- package/api/ai/single-agent/route.ts +291 -0
- package/api/ai/usage/route.ts +122 -0
- package/blocks/benefits/component.tsx +100 -0
- package/blocks/benefits/config.ts +11 -0
- package/blocks/benefits/examples.ts +85 -0
- package/blocks/benefits/fields.ts +156 -0
- package/blocks/benefits/schema.ts +33 -0
- package/blocks/cta-section/component.tsx +100 -0
- package/blocks/cta-section/config.ts +11 -0
- package/blocks/cta-section/examples.ts +41 -0
- package/blocks/cta-section/fields.ts +89 -0
- package/blocks/cta-section/index.ts +6 -0
- package/blocks/cta-section/schema.ts +32 -0
- package/blocks/cta-section/thumbnail.png +1 -0
- package/blocks/faq-accordion/component.tsx +156 -0
- package/blocks/faq-accordion/config.ts +11 -0
- package/blocks/faq-accordion/examples.ts +77 -0
- package/blocks/faq-accordion/fields.ts +119 -0
- package/blocks/faq-accordion/index.ts +6 -0
- package/blocks/faq-accordion/schema.ts +45 -0
- package/blocks/features-grid/component.tsx +112 -0
- package/blocks/features-grid/config.ts +11 -0
- package/blocks/features-grid/examples.ts +63 -0
- package/blocks/features-grid/fields.ts +97 -0
- package/blocks/features-grid/index.ts +6 -0
- package/blocks/features-grid/schema.ts +40 -0
- package/blocks/features-grid/thumbnail.png +1 -0
- package/blocks/hero/component.tsx +100 -0
- package/blocks/hero/config.ts +11 -0
- package/blocks/hero/examples.ts +35 -0
- package/blocks/hero/fields.ts +60 -0
- package/blocks/hero/index.ts +6 -0
- package/blocks/hero/schema.ts +32 -0
- package/blocks/hero/thumbnail.png +1 -0
- package/blocks/hero/thumbnail.png.txt +6 -0
- package/blocks/hero-with-form/component.tsx +232 -0
- package/blocks/hero-with-form/config.ts +11 -0
- package/blocks/hero-with-form/examples.ts +16 -0
- package/blocks/hero-with-form/fields.ts +207 -0
- package/blocks/hero-with-form/index.ts +6 -0
- package/blocks/hero-with-form/schema.ts +54 -0
- package/blocks/jumbotron/component.tsx +136 -0
- package/blocks/jumbotron/config.ts +11 -0
- package/blocks/jumbotron/examples.ts +36 -0
- package/blocks/jumbotron/fields.ts +202 -0
- package/blocks/jumbotron/index.ts +6 -0
- package/blocks/jumbotron/schema.ts +55 -0
- package/blocks/logo-cloud/component.tsx +154 -0
- package/blocks/logo-cloud/config.ts +11 -0
- package/blocks/logo-cloud/examples.ts +34 -0
- package/blocks/logo-cloud/fields.ts +133 -0
- package/blocks/logo-cloud/index.ts +6 -0
- package/blocks/logo-cloud/schema.ts +46 -0
- package/blocks/post-content/component.tsx +197 -0
- package/blocks/post-content/config.ts +11 -0
- package/blocks/post-content/examples.ts +33 -0
- package/blocks/post-content/fields.ts +165 -0
- package/blocks/post-content/index.ts +4 -0
- package/blocks/post-content/schema.ts +46 -0
- package/blocks/pricing-table/component.tsx +154 -0
- package/blocks/pricing-table/config.ts +11 -0
- package/blocks/pricing-table/examples.ts +96 -0
- package/blocks/pricing-table/fields.ts +161 -0
- package/blocks/pricing-table/index.ts +4 -0
- package/blocks/pricing-table/schema.ts +50 -0
- package/blocks/split-content/component.tsx +135 -0
- package/blocks/split-content/config.ts +11 -0
- package/blocks/split-content/examples.ts +38 -0
- package/blocks/split-content/fields.ts +198 -0
- package/blocks/split-content/index.ts +6 -0
- package/blocks/split-content/schema.ts +67 -0
- package/blocks/stats-counter/component.tsx +124 -0
- package/blocks/stats-counter/config.ts +11 -0
- package/blocks/stats-counter/examples.ts +61 -0
- package/blocks/stats-counter/fields.ts +134 -0
- package/blocks/stats-counter/index.ts +6 -0
- package/blocks/stats-counter/schema.ts +47 -0
- package/blocks/testimonials/component.tsx +114 -0
- package/blocks/testimonials/config.ts +11 -0
- package/blocks/testimonials/examples.ts +65 -0
- package/blocks/testimonials/fields.ts +105 -0
- package/blocks/testimonials/index.ts +6 -0
- package/blocks/testimonials/schema.ts +41 -0
- package/blocks/testimonials/thumbnail.png +1 -0
- package/blocks/text-content/component.tsx +97 -0
- package/blocks/text-content/config.ts +11 -0
- package/blocks/text-content/examples.ts +30 -0
- package/blocks/text-content/fields.ts +88 -0
- package/blocks/text-content/index.ts +6 -0
- package/blocks/text-content/schema.ts +30 -0
- package/blocks/text-content/thumbnail.png +1 -0
- package/blocks/timeline/component.tsx +267 -0
- package/blocks/timeline/config.ts +11 -0
- package/blocks/timeline/examples.ts +68 -0
- package/blocks/timeline/fields.ts +147 -0
- package/blocks/timeline/index.ts +6 -0
- package/blocks/timeline/schema.ts +49 -0
- package/blocks/video-hero/component.tsx +270 -0
- package/blocks/video-hero/config.ts +11 -0
- package/blocks/video-hero/examples.ts +24 -0
- package/blocks/video-hero/fields.ts +98 -0
- package/blocks/video-hero/index.ts +6 -0
- package/blocks/video-hero/schema.ts +39 -0
- package/components/ai-chat/ChatPanel.tsx +575 -0
- package/components/ai-chat/ConversationItem.tsx +266 -0
- package/components/ai-chat/ConversationSidebar.tsx +99 -0
- package/components/ai-chat/MarkdownRenderer.tsx +15 -0
- package/components/ai-chat/Message.tsx +42 -0
- package/components/ai-chat/MessageInput.tsx +49 -0
- package/components/ai-chat/MessageList.tsx +46 -0
- package/components/ai-chat/TypingIndicator.tsx +11 -0
- package/config/app.config.ts +367 -0
- package/config/billing.config.ts +349 -0
- package/config/dashboard.config.ts +506 -0
- package/config/dev.config.ts +104 -0
- package/config/features.config.ts +203 -0
- package/config/flows.config.ts +129 -0
- package/config/permissions.config.ts +245 -0
- package/config/theme.config.ts +74 -0
- package/docs/01-overview/01-introduction.md +335 -0
- package/docs/01-overview/02-customization.md +671 -0
- package/docs/02-features/01-components.md +155 -0
- package/docs/02-features/02-styling.md +139 -0
- package/docs/02-features/03-tasks-entity.md +407 -0
- package/docs/03-ai/01-overview.md +211 -0
- package/docs/03-ai/02-customization.md +436 -0
- package/entities/customers/customers.config.ts +75 -0
- package/entities/customers/customers.fields.ts +165 -0
- package/entities/customers/customers.service.ts +516 -0
- package/entities/customers/customers.types.ts +83 -0
- package/entities/customers/messages/en.json +66 -0
- package/entities/customers/messages/es.json +66 -0
- package/entities/customers/migrations/001_customers_table.sql +102 -0
- package/entities/customers/migrations/002_customers_metas.sql +92 -0
- package/entities/pages/messages/en.json +41 -0
- package/entities/pages/messages/es.json +41 -0
- package/entities/pages/migrations/001_pages_table.sql +112 -0
- package/entities/pages/migrations/002_pages_metas.sql +56 -0
- package/entities/pages/migrations/003_add_status.sql +50 -0
- package/entities/pages/pages-management.service.ts +610 -0
- package/entities/pages/pages.config.ts +94 -0
- package/entities/pages/pages.fields.ts +101 -0
- package/entities/pages/pages.service.ts +290 -0
- package/entities/pages/pages.types.ts +124 -0
- package/entities/posts/components/post-header.tsx +97 -0
- package/entities/posts/messages/en.json +55 -0
- package/entities/posts/messages/es.json +55 -0
- package/entities/posts/migrations/001_posts_table.sql +115 -0
- package/entities/posts/migrations/003_add_status.sql +44 -0
- package/entities/posts/migrations/004_entity_taxonomy_relations.sql +129 -0
- package/entities/posts/migrations/006_posts_metas.sql +56 -0
- package/entities/posts/posts.config.ts +101 -0
- package/entities/posts/posts.fields.ts +116 -0
- package/entities/posts/posts.service.ts +376 -0
- package/entities/posts/posts.types.ts +74 -0
- package/entities/tasks/messages/en.json +204 -0
- package/entities/tasks/messages/es.json +204 -0
- package/entities/tasks/migrations/001_tasks_table.sql +105 -0
- package/entities/tasks/migrations/002_task_metas.sql +85 -0
- package/entities/tasks/migrations/sample_data.json +77 -0
- package/entities/tasks/tasks.config.ts +79 -0
- package/entities/tasks/tasks.fields.ts +196 -0
- package/entities/tasks/tasks.service.ts +541 -0
- package/entities/tasks/tasks.types.ts +56 -0
- package/lib/hooks/useAiChat.ts +114 -0
- package/lib/hooks/useConversations.ts +376 -0
- package/lib/hooks/useOrchestratorChat.ts +122 -0
- package/lib/hooks/usePersistentChat.ts +315 -0
- package/lib/hooks/useStreamingChat.ts +127 -0
- package/lib/hooks/useTokenUsage.ts +63 -0
- package/lib/langchain/agents/customer-assistant.md +69 -0
- package/lib/langchain/agents/index.ts +61 -0
- package/lib/langchain/agents/orchestrator.md +59 -0
- package/lib/langchain/agents/page-assistant.md +85 -0
- package/lib/langchain/agents/single-agent.md +46 -0
- package/lib/langchain/agents/task-assistant.md +55 -0
- package/lib/langchain/config.ts +45 -0
- package/lib/langchain/handlers/customer-handler.ts +338 -0
- package/lib/langchain/handlers/page-handler.ts +232 -0
- package/lib/langchain/handlers/task-handler.ts +323 -0
- package/lib/langchain/langchain.config.ts +223 -0
- package/lib/langchain/observability.config.ts +30 -0
- package/lib/langchain/orchestrator.ts +562 -0
- package/lib/langchain/tools/customers.ts +176 -0
- package/lib/langchain/tools/index.ts +10 -0
- package/lib/langchain/tools/orchestrator.ts +92 -0
- package/lib/langchain/tools/pages.ts +289 -0
- package/lib/langchain/tools/tasks.ts +167 -0
- package/lib/scheduled-actions/billing.ts +149 -0
- package/lib/scheduled-actions/index.ts +170 -0
- package/lib/scheduled-actions/webhook.ts +231 -0
- package/lib/selectors.ts +197 -0
- package/messages/de/admin.json +219 -0
- package/messages/de/aiUsage.json +36 -0
- package/messages/de/buttons.json +19 -0
- package/messages/de/categories.json +35 -0
- package/messages/de/common.json +16 -0
- package/messages/de/dev.json +101 -0
- package/messages/de/docs.json +27 -0
- package/messages/de/entities.json +7 -0
- package/messages/de/features.json +119 -0
- package/messages/de/footer.json +22 -0
- package/messages/de/home.json +57 -0
- package/messages/de/index.ts +39 -0
- package/messages/de/mobileNav.json +13 -0
- package/messages/de/navigation.json +8 -0
- package/messages/de/observability.json +74 -0
- package/messages/de/posts.json +54 -0
- package/messages/de/pricing.json +102 -0
- package/messages/de/support.json +9 -0
- package/messages/de/teams.json +8 -0
- package/messages/en/admin.json +219 -0
- package/messages/en/aiUsage.json +36 -0
- package/messages/en/buttons.json +19 -0
- package/messages/en/categories.json +35 -0
- package/messages/en/common.json +16 -0
- package/messages/en/dev.json +106 -0
- package/messages/en/docs.json +27 -0
- package/messages/en/entities.json +7 -0
- package/messages/en/features.json +119 -0
- package/messages/en/footer.json +22 -0
- package/messages/en/home.json +57 -0
- package/messages/en/index.ts +39 -0
- package/messages/en/mobileNav.json +13 -0
- package/messages/en/navigation.json +8 -0
- package/messages/en/observability.json +74 -0
- package/messages/en/posts.json +54 -0
- package/messages/en/pricing.json +102 -0
- package/messages/en/support.json +9 -0
- package/messages/en/teams.json +8 -0
- package/messages/es/admin.json +219 -0
- package/messages/es/aiUsage.json +36 -0
- package/messages/es/buttons.json +19 -0
- package/messages/es/categories.json +35 -0
- package/messages/es/common.json +16 -0
- package/messages/es/dev.json +101 -0
- package/messages/es/docs.json +27 -0
- package/messages/es/entities.json +7 -0
- package/messages/es/features.json +119 -0
- package/messages/es/footer.json +22 -0
- package/messages/es/home.json +57 -0
- package/messages/es/index.ts +39 -0
- package/messages/es/mobileNav.json +13 -0
- package/messages/es/navigation.json +8 -0
- package/messages/es/observability.json +74 -0
- package/messages/es/posts.json +54 -0
- package/messages/es/pricing.json +102 -0
- package/messages/es/support.json +9 -0
- package/messages/es/teams.json +8 -0
- package/messages/fr/admin.json +219 -0
- package/messages/fr/aiUsage.json +36 -0
- package/messages/fr/buttons.json +19 -0
- package/messages/fr/categories.json +35 -0
- package/messages/fr/common.json +16 -0
- package/messages/fr/dev.json +101 -0
- package/messages/fr/docs.json +27 -0
- package/messages/fr/entities.json +7 -0
- package/messages/fr/features.json +119 -0
- package/messages/fr/footer.json +22 -0
- package/messages/fr/home.json +57 -0
- package/messages/fr/index.ts +39 -0
- package/messages/fr/mobileNav.json +13 -0
- package/messages/fr/navigation.json +8 -0
- package/messages/fr/observability.json +74 -0
- package/messages/fr/posts.json +54 -0
- package/messages/fr/pricing.json +102 -0
- package/messages/fr/support.json +9 -0
- package/messages/fr/teams.json +8 -0
- package/messages/it/admin.json +219 -0
- package/messages/it/aiUsage.json +36 -0
- package/messages/it/buttons.json +19 -0
- package/messages/it/categories.json +35 -0
- package/messages/it/common.json +16 -0
- package/messages/it/dev.json +101 -0
- package/messages/it/docs.json +27 -0
- package/messages/it/entities.json +7 -0
- package/messages/it/features.json +119 -0
- package/messages/it/footer.json +22 -0
- package/messages/it/home.json +57 -0
- package/messages/it/index.ts +39 -0
- package/messages/it/mobileNav.json +13 -0
- package/messages/it/navigation.json +8 -0
- package/messages/it/observability.json +74 -0
- package/messages/it/posts.json +54 -0
- package/messages/it/pricing.json +102 -0
- package/messages/it/support.json +9 -0
- package/messages/it/teams.json +8 -0
- package/messages/pt/admin.json +219 -0
- package/messages/pt/aiUsage.json +36 -0
- package/messages/pt/buttons.json +19 -0
- package/messages/pt/categories.json +35 -0
- package/messages/pt/common.json +16 -0
- package/messages/pt/dev.json +101 -0
- package/messages/pt/docs.json +27 -0
- package/messages/pt/entities.json +7 -0
- package/messages/pt/features.json +119 -0
- package/messages/pt/footer.json +22 -0
- package/messages/pt/home.json +57 -0
- package/messages/pt/index.ts +39 -0
- package/messages/pt/mobileNav.json +13 -0
- package/messages/pt/navigation.json +8 -0
- package/messages/pt/observability.json +74 -0
- package/messages/pt/posts.json +54 -0
- package/messages/pt/pricing.json +102 -0
- package/messages/pt/support.json +9 -0
- package/messages/pt/teams.json +8 -0
- package/migrations/089_add_editor_team_role.sql +39 -0
- package/migrations/090_demo_users_teams.sql +540 -0
- package/migrations/091_greek_teams_billing.sql +523 -0
- package/migrations/092_billing_sample_data.sql +774 -0
- package/migrations/093_pages_sample_data.sql +1158 -0
- package/migrations/094_posts_sample_data.sql +278 -0
- package/migrations/095_tasks_sample_data.sql +440 -0
- package/migrations/096_customers_sample_data.sql +358 -0
- package/migrations/097_scheduled_actions_sample_data.sql +111 -0
- package/package.json +22 -0
- package/public/docs/desktop-layout-example.png +0 -0
- package/styles/components.css +11 -0
- package/styles/globals.css +179 -0
- package/templates/(public)/blog/[slug]/page.tsx +65 -0
- package/templates/(public)/layout.tsx +25 -0
- package/templates/(public)/page.tsx +200 -0
- package/templates/(public)/support/page.tsx +321 -0
- package/templates/dashboard/(main)/agent-multi/page.tsx +63 -0
- package/templates/dashboard/(main)/agent-single/page.tsx +142 -0
- package/templates/dashboard/(main)/settings/ai-usage/page.tsx +157 -0
- package/templates/superadmin/ai-observability/[traceId]/page.tsx +27 -0
- package/templates/superadmin/ai-observability/page.tsx +17 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Theme Components
|
|
3
|
+
description: Overview of theme-specific components and patterns
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Theme Components
|
|
7
|
+
|
|
8
|
+
The default theme includes several pre-built components that extend the core component library.
|
|
9
|
+
|
|
10
|
+
## Navigation Components
|
|
11
|
+
|
|
12
|
+
### MainNavigation
|
|
13
|
+
|
|
14
|
+
The primary navigation component with responsive behavior:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { MainNavigation } from '@/contents/themes/default/components/navigation'
|
|
18
|
+
|
|
19
|
+
<MainNavigation />
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Features:
|
|
23
|
+
- Mobile hamburger menu
|
|
24
|
+
- Desktop horizontal navigation
|
|
25
|
+
- Active link highlighting
|
|
26
|
+
- Authentication-aware menu items
|
|
27
|
+
|
|
28
|
+
### UserMenu
|
|
29
|
+
|
|
30
|
+
User account dropdown with profile and settings:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { UserMenu } from '@/contents/themes/default/components/user-menu'
|
|
34
|
+
|
|
35
|
+
<UserMenu />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Layout Components
|
|
39
|
+
|
|
40
|
+
### DashboardLayout
|
|
41
|
+
|
|
42
|
+
Standard dashboard layout with sidebar and header:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { DashboardLayout } from '@/contents/themes/default/components/layouts'
|
|
46
|
+
|
|
47
|
+
export default function DashboardPage() {
|
|
48
|
+
return (
|
|
49
|
+
<DashboardLayout>
|
|
50
|
+
<h1>Dashboard Content</h1>
|
|
51
|
+
</DashboardLayout>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### AuthLayout
|
|
57
|
+
|
|
58
|
+
Centered layout for authentication pages:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { AuthLayout } from '@/contents/themes/default/components/layouts'
|
|
62
|
+
|
|
63
|
+
export default function LoginPage() {
|
|
64
|
+
return (
|
|
65
|
+
<AuthLayout>
|
|
66
|
+
<LoginForm />
|
|
67
|
+
</AuthLayout>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Component Guidelines
|
|
73
|
+
|
|
74
|
+
### Composition Over Modification
|
|
75
|
+
|
|
76
|
+
Always compose upward from core components. Never modify shadcn/ui components directly.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// ✅ CORRECT
|
|
80
|
+
import { Button } from '@/core/components/ui/button'
|
|
81
|
+
|
|
82
|
+
export function ThemeButton({ children, ...props }) {
|
|
83
|
+
return (
|
|
84
|
+
<Button {...props} className="theme-specific-styles">
|
|
85
|
+
{children}
|
|
86
|
+
</Button>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ❌ WRONG - Don't edit core/components/ui/button.tsx
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Accessibility First
|
|
94
|
+
|
|
95
|
+
All theme components must include:
|
|
96
|
+
- Proper ARIA labels
|
|
97
|
+
- Keyboard navigation support
|
|
98
|
+
- Screen reader compatibility
|
|
99
|
+
- Focus indicators
|
|
100
|
+
|
|
101
|
+
### Responsive Design
|
|
102
|
+
|
|
103
|
+
Use Tailwind's responsive prefixes:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
|
|
107
|
+
{/* Responsive grid */}
|
|
108
|
+
</div>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Layout Examples
|
|
112
|
+
|
|
113
|
+
### Desktop Layout
|
|
114
|
+
|
|
115
|
+
The theme provides a responsive desktop layout with a fixed sidebar and scrollable content area:
|
|
116
|
+
|
|
117
|
+

|
|
118
|
+
|
|
119
|
+
The layout adapts automatically to different screen sizes:
|
|
120
|
+
- **Desktop (≥1024px)**: Fixed sidebar navigation with expanded content area
|
|
121
|
+
- **Tablet (768px-1023px)**: Collapsible sidebar with full-width content
|
|
122
|
+
- **Mobile (<768px)**: Hidden sidebar with hamburger menu toggle
|
|
123
|
+
|
|
124
|
+
### Adding Images to Documentation
|
|
125
|
+
|
|
126
|
+
Images can be added to documentation by placing them in the appropriate directory:
|
|
127
|
+
|
|
128
|
+
**For theme documentation:**
|
|
129
|
+
```bash
|
|
130
|
+
# 1. Place image in theme's public/docs/ directory
|
|
131
|
+
contents/themes/default/public/docs/your-image.png
|
|
132
|
+
|
|
133
|
+
# 2. Run theme build (or automatic in dev mode)
|
|
134
|
+
npm run theme:build
|
|
135
|
+
|
|
136
|
+
# 3. Image is automatically copied to public/theme/docs/
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**For core documentation:**
|
|
140
|
+
```bash
|
|
141
|
+
# Place directly in public directory (no build step needed)
|
|
142
|
+
public/docs/core/assets/your-image.png
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Then reference them in markdown using absolute paths:
|
|
146
|
+
|
|
147
|
+
```markdown
|
|
148
|
+
# Theme docs
|
|
149
|
+

|
|
150
|
+
|
|
151
|
+
# Core docs
|
|
152
|
+

|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Important:** All theme public assets (including documentation images) must stay within `contents/themes/[THEME]/public/`. The build system automatically copies the entire `public/` directory to `/theme/`. This ensures all assets are theme-specific and change when switching themes.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Theme Styling
|
|
3
|
+
description: Comprehensive guide to styling in the default theme
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Theme Styling
|
|
7
|
+
|
|
8
|
+
The default theme uses a combination of Tailwind CSS v4, CSS variables, and custom styles to provide a flexible and maintainable styling system.
|
|
9
|
+
|
|
10
|
+
## Design Tokens
|
|
11
|
+
|
|
12
|
+
All design tokens are defined as CSS variables in `styles/globals.css`:
|
|
13
|
+
|
|
14
|
+
### Color System
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
:root {
|
|
18
|
+
/* Background colors */
|
|
19
|
+
--background: 0 0% 100%;
|
|
20
|
+
--foreground: 222.2 84% 4.9%;
|
|
21
|
+
|
|
22
|
+
/* Brand colors */
|
|
23
|
+
--primary: 222.2 47.4% 11.2%;
|
|
24
|
+
--primary-foreground: 210 40% 98%;
|
|
25
|
+
|
|
26
|
+
/* Semantic colors */
|
|
27
|
+
--destructive: 0 84.2% 60.2%;
|
|
28
|
+
--success: 142 76% 36%;
|
|
29
|
+
--warning: 38 92% 50%;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Spacing Scale
|
|
34
|
+
|
|
35
|
+
Follow Tailwind's default spacing scale:
|
|
36
|
+
- `xs`: 0.5rem (8px)
|
|
37
|
+
- `sm`: 0.75rem (12px)
|
|
38
|
+
- `md`: 1rem (16px)
|
|
39
|
+
- `lg`: 1.5rem (24px)
|
|
40
|
+
- `xl`: 2rem (32px)
|
|
41
|
+
|
|
42
|
+
### Typography
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
.text-xs { font-size: 0.75rem; }
|
|
46
|
+
.text-sm { font-size: 0.875rem; }
|
|
47
|
+
.text-base { font-size: 1rem; }
|
|
48
|
+
.text-lg { font-size: 1.125rem; }
|
|
49
|
+
.text-xl { font-size: 1.25rem; }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Dark Mode
|
|
53
|
+
|
|
54
|
+
Dark mode is automatically applied using CSS variables:
|
|
55
|
+
|
|
56
|
+
```css
|
|
57
|
+
.dark {
|
|
58
|
+
--background: 222.2 84% 4.9%;
|
|
59
|
+
--foreground: 210 40% 98%;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Components automatically adapt to dark mode without additional code.
|
|
64
|
+
|
|
65
|
+
## Custom Styles
|
|
66
|
+
|
|
67
|
+
### Component-Specific Styles
|
|
68
|
+
|
|
69
|
+
Create scoped styles in the component directory:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// components/custom-card/styles.css
|
|
73
|
+
.custom-card {
|
|
74
|
+
@apply rounded-lg border bg-card p-6 shadow-sm;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.custom-card-header {
|
|
78
|
+
@apply mb-4 border-b pb-4;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Global Theme Styles
|
|
83
|
+
|
|
84
|
+
Add global styles in `styles/theme.css`:
|
|
85
|
+
|
|
86
|
+
```css
|
|
87
|
+
/* Custom scrollbar */
|
|
88
|
+
::-webkit-scrollbar {
|
|
89
|
+
width: 8px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
::-webkit-scrollbar-thumb {
|
|
93
|
+
background: hsl(var(--muted-foreground));
|
|
94
|
+
border-radius: 4px;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Animation
|
|
99
|
+
|
|
100
|
+
### Built-in Animations
|
|
101
|
+
|
|
102
|
+
The theme includes several utility animations:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
<div className="animate-fade-in">Fades in</div>
|
|
106
|
+
<div className="animate-slide-up">Slides up</div>
|
|
107
|
+
<div className="animate-pulse">Pulses</div>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Custom Animations
|
|
111
|
+
|
|
112
|
+
Define custom animations in `tailwind.config.ts`:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
export default {
|
|
116
|
+
theme: {
|
|
117
|
+
extend: {
|
|
118
|
+
animation: {
|
|
119
|
+
'bounce-slow': 'bounce 3s infinite',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Performance
|
|
127
|
+
|
|
128
|
+
### CSS Optimization
|
|
129
|
+
|
|
130
|
+
- Use Tailwind's JIT mode for minimal bundle size
|
|
131
|
+
- Avoid inline styles when possible
|
|
132
|
+
- Leverage CSS variables for theme switching
|
|
133
|
+
|
|
134
|
+
### Best Practices
|
|
135
|
+
|
|
136
|
+
- Prefer Tailwind utilities over custom CSS
|
|
137
|
+
- Use `@apply` for repeated utility combinations
|
|
138
|
+
- Keep custom CSS to a minimum
|
|
139
|
+
- Always scope styles to avoid conflicts
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
# Tasks Entity
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The **Tasks** entity is the primary example entity included in the default theme. It demonstrates a complete entity implementation with full CRUD operations, metadata support, API access, and internationalization.
|
|
6
|
+
|
|
7
|
+
## Entity Configuration
|
|
8
|
+
|
|
9
|
+
### Basic Setup
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
{
|
|
13
|
+
slug: 'tasks',
|
|
14
|
+
enabled: true,
|
|
15
|
+
names: {
|
|
16
|
+
singular: 'task',
|
|
17
|
+
plural: 'Tasks'
|
|
18
|
+
},
|
|
19
|
+
icon: CheckSquare
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Access Configuration
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
access: {
|
|
27
|
+
public: false, // Not accessible without authentication
|
|
28
|
+
api: true, // External API access enabled
|
|
29
|
+
metadata: true, // Metadata system supported
|
|
30
|
+
shared: false // User-scoped (not shared between users)
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Implications:**
|
|
35
|
+
- Users must be authenticated to access tasks
|
|
36
|
+
- Tasks are available via API key
|
|
37
|
+
- Each task can have custom metadata
|
|
38
|
+
- Users only see their own tasks
|
|
39
|
+
|
|
40
|
+
### UI Features
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
ui: {
|
|
44
|
+
dashboard: {
|
|
45
|
+
showInMenu: true, // Appears in sidebar
|
|
46
|
+
showInTopbar: true // Quick access in topbar
|
|
47
|
+
},
|
|
48
|
+
public: {
|
|
49
|
+
hasArchivePage: false, // No public archive
|
|
50
|
+
hasSinglePage: false // No public detail page
|
|
51
|
+
},
|
|
52
|
+
features: {
|
|
53
|
+
searchable: true, // Full-text search enabled
|
|
54
|
+
sortable: true, // Column sorting
|
|
55
|
+
filterable: true, // Advanced filters
|
|
56
|
+
bulkOperations: true, // Select multiple tasks
|
|
57
|
+
importExport: false // No CSV import/export
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Permissions
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
permissions: {
|
|
66
|
+
read: ['admin', 'colaborator', 'member'],
|
|
67
|
+
create: ['admin', 'colaborator', 'member'],
|
|
68
|
+
update: ['admin', 'colaborator', 'member'],
|
|
69
|
+
delete: ['admin', 'colaborator', 'member']
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**All roles** can perform all operations on tasks.
|
|
74
|
+
|
|
75
|
+
## Fields
|
|
76
|
+
|
|
77
|
+
### Standard Fields
|
|
78
|
+
|
|
79
|
+
**Title:**
|
|
80
|
+
```typescript
|
|
81
|
+
{
|
|
82
|
+
name: 'title',
|
|
83
|
+
type: 'text',
|
|
84
|
+
label: 'Title',
|
|
85
|
+
required: true,
|
|
86
|
+
searchable: true,
|
|
87
|
+
sortable: true
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Description:**
|
|
92
|
+
```typescript
|
|
93
|
+
{
|
|
94
|
+
name: 'description',
|
|
95
|
+
type: 'textarea',
|
|
96
|
+
label: 'Description',
|
|
97
|
+
required: false
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Status:**
|
|
102
|
+
```typescript
|
|
103
|
+
{
|
|
104
|
+
name: 'status',
|
|
105
|
+
type: 'select',
|
|
106
|
+
label: 'Status',
|
|
107
|
+
options: [
|
|
108
|
+
{ value: 'pending', label: 'Pending' },
|
|
109
|
+
{ value: 'in_progress', label: 'In Progress' },
|
|
110
|
+
{ value: 'completed', label: 'Completed' }
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Priority:**
|
|
116
|
+
```typescript
|
|
117
|
+
{
|
|
118
|
+
name: 'priority',
|
|
119
|
+
type: 'select',
|
|
120
|
+
label: 'Priority',
|
|
121
|
+
options: [
|
|
122
|
+
{ value: 'low', label: 'Low' },
|
|
123
|
+
{ value: 'medium', label: 'Medium' },
|
|
124
|
+
{ value: 'high', label: 'High' }
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Database Schema
|
|
130
|
+
|
|
131
|
+
### Tasks Table
|
|
132
|
+
|
|
133
|
+
```sql
|
|
134
|
+
CREATE TABLE tasks (
|
|
135
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
136
|
+
title VARCHAR(255) NOT NULL,
|
|
137
|
+
description TEXT,
|
|
138
|
+
status VARCHAR(50) DEFAULT 'pending',
|
|
139
|
+
priority VARCHAR(50) DEFAULT 'medium',
|
|
140
|
+
user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
|
|
141
|
+
created_at TIMESTAMP DEFAULT NOW(),
|
|
142
|
+
updated_at TIMESTAMP DEFAULT NOW()
|
|
143
|
+
);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Tasks Metadata Table
|
|
147
|
+
|
|
148
|
+
```sql
|
|
149
|
+
CREATE TABLE tasks_metas (
|
|
150
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
151
|
+
entity_id UUID REFERENCES tasks(id) ON DELETE CASCADE,
|
|
152
|
+
meta_key VARCHAR(255) NOT NULL,
|
|
153
|
+
meta_value TEXT,
|
|
154
|
+
created_at TIMESTAMP DEFAULT NOW()
|
|
155
|
+
);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## API Endpoints
|
|
159
|
+
|
|
160
|
+
### List Tasks
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
GET /api/v1/tasks
|
|
164
|
+
Authorization: Bearer {API_KEY}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Query Parameters:**
|
|
168
|
+
- `search` - Full-text search
|
|
169
|
+
- `status` - Filter by status
|
|
170
|
+
- `priority` - Filter by priority
|
|
171
|
+
- `sort` - Sort by field (e.g., `sort=created_at:desc`)
|
|
172
|
+
- `limit` - Results per page
|
|
173
|
+
- `offset` - Pagination offset
|
|
174
|
+
|
|
175
|
+
### Get Single Task
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
GET /api/v1/tasks/{id}
|
|
179
|
+
Authorization: Bearer {API_KEY}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Create Task
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
POST /api/v1/tasks
|
|
186
|
+
Authorization: Bearer {API_KEY}
|
|
187
|
+
Content-Type: application/json
|
|
188
|
+
|
|
189
|
+
{
|
|
190
|
+
"title": "New Task",
|
|
191
|
+
"description": "Task description",
|
|
192
|
+
"status": "pending",
|
|
193
|
+
"priority": "high"
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Update Task
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
PUT /api/v1/tasks/{id}
|
|
201
|
+
Authorization: Bearer {API_KEY}
|
|
202
|
+
Content-Type: application/json
|
|
203
|
+
|
|
204
|
+
{
|
|
205
|
+
"title": "Updated Title",
|
|
206
|
+
"status": "completed"
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Delete Task
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
DELETE /api/v1/tasks/{id}
|
|
214
|
+
Authorization: Bearer {API_KEY}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Translations
|
|
218
|
+
|
|
219
|
+
### English (`messages/en.json`)
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"tasks": {
|
|
224
|
+
"title": "Tasks",
|
|
225
|
+
"singular": "Task",
|
|
226
|
+
"fields": {
|
|
227
|
+
"title": "Title",
|
|
228
|
+
"description": "Description",
|
|
229
|
+
"status": "Status",
|
|
230
|
+
"priority": "Priority"
|
|
231
|
+
},
|
|
232
|
+
"status": {
|
|
233
|
+
"pending": "Pending",
|
|
234
|
+
"in_progress": "In Progress",
|
|
235
|
+
"completed": "Completed"
|
|
236
|
+
},
|
|
237
|
+
"priority": {
|
|
238
|
+
"low": "Low",
|
|
239
|
+
"medium": "Medium",
|
|
240
|
+
"high": "High"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Spanish (`messages/es.json`)
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"tasks": {
|
|
251
|
+
"title": "Tareas",
|
|
252
|
+
"singular": "Tarea",
|
|
253
|
+
"fields": {
|
|
254
|
+
"title": "Título",
|
|
255
|
+
"description": "Descripción",
|
|
256
|
+
"status": "Estado",
|
|
257
|
+
"priority": "Prioridad"
|
|
258
|
+
},
|
|
259
|
+
"status": {
|
|
260
|
+
"pending": "Pendiente",
|
|
261
|
+
"in_progress": "En Progreso",
|
|
262
|
+
"completed": "Completada"
|
|
263
|
+
},
|
|
264
|
+
"priority": {
|
|
265
|
+
"low": "Baja",
|
|
266
|
+
"medium": "Media",
|
|
267
|
+
"high": "Alta"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Usage Examples
|
|
274
|
+
|
|
275
|
+
### In Components
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
import { useTranslations } from 'next-intl'
|
|
279
|
+
import { useEntityData } from '@/core/hooks/use-entity-data'
|
|
280
|
+
|
|
281
|
+
export function TasksList() {
|
|
282
|
+
const t = useTranslations('tasks')
|
|
283
|
+
const { data: tasks, isLoading } = useEntityData('tasks')
|
|
284
|
+
|
|
285
|
+
if (isLoading) return <div>Loading...</div>
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<div>
|
|
289
|
+
<h1>{t('title')}</h1>
|
|
290
|
+
{tasks.map(task => (
|
|
291
|
+
<div key={task.id}>
|
|
292
|
+
<h3>{task.title}</h3>
|
|
293
|
+
<p>{t(`status.${task.status}`)}</p>
|
|
294
|
+
</div>
|
|
295
|
+
))}
|
|
296
|
+
</div>
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### With Metadata
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
// Add metadata to task
|
|
305
|
+
await addMetadata('tasks', taskId, 'custom_field', 'custom_value')
|
|
306
|
+
|
|
307
|
+
// Get metadata
|
|
308
|
+
const metadata = await getMetadata('tasks', taskId, 'custom_field')
|
|
309
|
+
|
|
310
|
+
// Update metadata
|
|
311
|
+
await updateMetadata('tasks', taskId, 'custom_field', 'new_value')
|
|
312
|
+
|
|
313
|
+
// Delete metadata
|
|
314
|
+
await deleteMetadata('tasks', taskId, 'custom_field')
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Row Level Security (RLS)
|
|
318
|
+
|
|
319
|
+
### Policy: Users see only their tasks
|
|
320
|
+
|
|
321
|
+
```sql
|
|
322
|
+
CREATE POLICY "Users can only see their own tasks"
|
|
323
|
+
ON tasks FOR SELECT
|
|
324
|
+
USING (auth.uid() = user_id);
|
|
325
|
+
|
|
326
|
+
CREATE POLICY "Users can only create their own tasks"
|
|
327
|
+
ON tasks FOR INSERT
|
|
328
|
+
WITH CHECK (auth.uid() = user_id);
|
|
329
|
+
|
|
330
|
+
CREATE POLICY "Users can only update their own tasks"
|
|
331
|
+
ON tasks FOR UPDATE
|
|
332
|
+
USING (auth.uid() = user_id);
|
|
333
|
+
|
|
334
|
+
CREATE POLICY "Users can only delete their own tasks"
|
|
335
|
+
ON tasks FOR DELETE
|
|
336
|
+
USING (auth.uid() = user_id);
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Dashboard Integration
|
|
340
|
+
|
|
341
|
+
### Navigation Menu
|
|
342
|
+
|
|
343
|
+
Tasks automatically appear in:
|
|
344
|
+
- **Sidebar** - Full navigation entry
|
|
345
|
+
- **Topbar** - Quick access button
|
|
346
|
+
|
|
347
|
+
### Mobile Navigation
|
|
348
|
+
|
|
349
|
+
Configured in `app.config.ts`:
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
mobileNav: {
|
|
353
|
+
items: [
|
|
354
|
+
{
|
|
355
|
+
id: 'tasks',
|
|
356
|
+
labelKey: 'common.mobileNav.tasks',
|
|
357
|
+
href: '/dashboard/tasks',
|
|
358
|
+
icon: 'CheckSquare',
|
|
359
|
+
enabled: true,
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Customization
|
|
366
|
+
|
|
367
|
+
### Add Custom Fields
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
// entities/tasks/tasks.fields.ts
|
|
371
|
+
{
|
|
372
|
+
name: 'due_date',
|
|
373
|
+
type: 'date',
|
|
374
|
+
label: 'Due Date',
|
|
375
|
+
required: false,
|
|
376
|
+
sortable: true
|
|
377
|
+
}
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Change Permissions
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
// entities/tasks/tasks.config.ts
|
|
384
|
+
permissions: {
|
|
385
|
+
read: ['admin', 'colaborator', 'member'],
|
|
386
|
+
create: ['admin', 'colaborator'], // Only admin and colaborator
|
|
387
|
+
update: ['admin', 'colaborator'],
|
|
388
|
+
delete: ['admin'] // Only admin
|
|
389
|
+
}
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Disable API Access
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
access: {
|
|
396
|
+
public: false,
|
|
397
|
+
api: false, // Disable API access
|
|
398
|
+
metadata: true,
|
|
399
|
+
shared: false
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
## Next Steps
|
|
404
|
+
|
|
405
|
+
- **[Entity System](/docs/core/entities/introduction)** - Complete entity documentation
|
|
406
|
+
- **[API System](/docs/core/api/introduction)** - API reference
|
|
407
|
+
- **[Permissions](/docs/core/authentication/permissions-and-roles)** - Permission system
|