nextworks 0.2.0-alpha.2 → 0.2.0-alpha.20

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.
Files changed (145) hide show
  1. package/README.md +280 -228
  2. package/dist/cli_manifests/blocks_manifest.json +193 -194
  3. package/dist/commands/blocks.d.ts +3 -0
  4. package/dist/commands/blocks.d.ts.map +1 -1
  5. package/dist/commands/blocks.js +128 -19
  6. package/dist/commands/blocks.js.map +1 -1
  7. package/dist/commands/doctor.d.ts +136 -0
  8. package/dist/commands/doctor.d.ts.map +1 -0
  9. package/dist/commands/doctor.js +696 -0
  10. package/dist/commands/doctor.js.map +1 -0
  11. package/dist/commands/remove-blocks.d.ts +4 -1
  12. package/dist/commands/remove-blocks.d.ts.map +1 -1
  13. package/dist/commands/remove-blocks.js +24 -6
  14. package/dist/commands/remove-blocks.js.map +1 -1
  15. package/dist/index.js +125 -4
  16. package/dist/index.js.map +1 -1
  17. package/dist/kits/blocks/.nextworks/docs/BLOCKS_QUICKSTART.md +104 -194
  18. package/dist/kits/blocks/.nextworks/docs/BLOCKS_README.md +115 -75
  19. package/dist/kits/blocks/.nextworks/docs/THEME_GUIDE.md +269 -251
  20. package/dist/kits/blocks/app/templates/digitalagency/PresetThemeVars.tsx +80 -80
  21. package/dist/kits/blocks/app/templates/digitalagency/README.md +42 -36
  22. package/dist/kits/blocks/app/templates/digitalagency/components/About.tsx +71 -99
  23. package/dist/kits/blocks/app/templates/digitalagency/components/CTA.tsx +40 -74
  24. package/dist/kits/blocks/app/templates/digitalagency/components/Contact.tsx +123 -227
  25. package/dist/kits/blocks/app/templates/digitalagency/components/Footer.tsx +89 -89
  26. package/dist/kits/blocks/app/templates/digitalagency/components/Hero.tsx +83 -90
  27. package/dist/kits/blocks/app/templates/digitalagency/components/Navbar.tsx +121 -168
  28. package/dist/kits/blocks/app/templates/digitalagency/components/NetworkPattern.tsx +288 -297
  29. package/dist/kits/blocks/app/templates/digitalagency/components/Portfolio.tsx +157 -157
  30. package/dist/kits/blocks/app/templates/digitalagency/components/Pricing.tsx +114 -114
  31. package/dist/kits/blocks/app/templates/digitalagency/components/Process.tsx +59 -59
  32. package/dist/kits/blocks/app/templates/digitalagency/components/Services.tsx +55 -55
  33. package/dist/kits/blocks/app/templates/digitalagency/components/Team.tsx +28 -28
  34. package/dist/kits/blocks/app/templates/digitalagency/components/Testimonials.tsx +65 -65
  35. package/dist/kits/blocks/app/templates/digitalagency/page.tsx +38 -38
  36. package/dist/kits/blocks/app/templates/gallery/PresetThemeVars.tsx +130 -85
  37. package/dist/kits/blocks/app/templates/gallery/page.tsx +357 -303
  38. package/dist/kits/blocks/app/templates/productlaunch/PresetThemeVars.tsx +75 -74
  39. package/dist/kits/blocks/app/templates/productlaunch/README.md +62 -55
  40. package/dist/kits/blocks/app/templates/productlaunch/components/About.tsx +84 -178
  41. package/dist/kits/blocks/app/templates/productlaunch/components/CTA.tsx +50 -93
  42. package/dist/kits/blocks/app/templates/productlaunch/components/Contact.tsx +231 -231
  43. package/dist/kits/blocks/app/templates/productlaunch/components/FAQ.tsx +86 -93
  44. package/dist/kits/blocks/app/templates/productlaunch/components/Features.tsx +83 -84
  45. package/dist/kits/blocks/app/templates/productlaunch/components/Footer.tsx +132 -132
  46. package/dist/kits/blocks/app/templates/productlaunch/components/Hero.tsx +88 -89
  47. package/dist/kits/blocks/app/templates/productlaunch/components/Navbar.tsx +116 -162
  48. package/dist/kits/blocks/app/templates/productlaunch/components/Pricing.tsx +106 -106
  49. package/dist/kits/blocks/app/templates/productlaunch/components/ProcessTimeline.tsx +110 -110
  50. package/dist/kits/blocks/app/templates/productlaunch/components/ServicesGrid.tsx +68 -68
  51. package/dist/kits/blocks/app/templates/productlaunch/components/Team.tsx +104 -104
  52. package/dist/kits/blocks/app/templates/productlaunch/components/Testimonials.tsx +90 -89
  53. package/dist/kits/blocks/app/templates/productlaunch/components/TrustBadges.tsx +76 -76
  54. package/dist/kits/blocks/app/templates/productlaunch/page.tsx +43 -43
  55. package/dist/kits/blocks/app/templates/saasdashboard/PresetThemeVars.tsx +80 -80
  56. package/dist/kits/blocks/app/templates/saasdashboard/README.md +44 -38
  57. package/dist/kits/blocks/app/templates/saasdashboard/components/Contact.tsx +129 -176
  58. package/dist/kits/blocks/app/templates/saasdashboard/components/Dashboard.tsx +293 -293
  59. package/dist/kits/blocks/app/templates/saasdashboard/components/FAQ.tsx +55 -55
  60. package/dist/kits/blocks/app/templates/saasdashboard/components/Features.tsx +90 -91
  61. package/dist/kits/blocks/app/templates/saasdashboard/components/Footer.tsx +77 -77
  62. package/dist/kits/blocks/app/templates/saasdashboard/components/Hero.tsx +104 -105
  63. package/dist/kits/blocks/app/templates/saasdashboard/components/Hero_mask.tsx +126 -127
  64. package/dist/kits/blocks/app/templates/saasdashboard/components/Navbar.tsx +117 -159
  65. package/dist/kits/blocks/app/templates/saasdashboard/components/Pricing.tsx +90 -90
  66. package/dist/kits/blocks/app/templates/saasdashboard/components/SmoothScroll.tsx +96 -97
  67. package/dist/kits/blocks/app/templates/saasdashboard/components/Testimonials.tsx +72 -72
  68. package/dist/kits/blocks/app/templates/saasdashboard/components/TrustBadges.tsx +53 -53
  69. package/dist/kits/blocks/app/templates/saasdashboard/page.tsx +39 -39
  70. package/dist/kits/blocks/components/enhanced-theme-provider.tsx +195 -183
  71. package/dist/kits/blocks/components/providers/BlocksAppProviders.tsx +27 -27
  72. package/dist/kits/blocks/components/sections/About.tsx +291 -291
  73. package/dist/kits/blocks/components/sections/CTA.tsx +257 -258
  74. package/dist/kits/blocks/components/sections/CommandShowcase.tsx +517 -0
  75. package/dist/kits/blocks/components/sections/Contact.tsx +267 -267
  76. package/dist/kits/blocks/components/sections/FAQ.tsx +214 -225
  77. package/dist/kits/blocks/components/sections/FeaturedProjectShowcase.tsx +687 -0
  78. package/dist/kits/blocks/components/sections/Features.tsx +268 -270
  79. package/dist/kits/blocks/components/sections/Footer.tsx +302 -302
  80. package/dist/kits/blocks/components/sections/HeroMotion.tsx +308 -308
  81. package/dist/kits/blocks/components/sections/HeroOverlay.tsx +358 -358
  82. package/dist/kits/blocks/components/sections/HeroProductDemo.tsx +246 -0
  83. package/dist/kits/blocks/components/sections/HeroSplit.tsx +352 -352
  84. package/dist/kits/blocks/components/sections/HeroWithVideo.tsx +495 -0
  85. package/dist/kits/blocks/components/sections/Navbar.tsx +352 -353
  86. package/dist/kits/blocks/components/sections/PortfolioSimple.tsx +549 -550
  87. package/dist/kits/blocks/components/sections/Pricing.tsx +264 -264
  88. package/dist/kits/blocks/components/sections/ProcessTimeline.tsx +325 -325
  89. package/dist/kits/blocks/components/sections/ProjectDeepDive.tsx +805 -0
  90. package/dist/kits/blocks/components/sections/SelectedWorkRail.tsx +485 -0
  91. package/dist/kits/blocks/components/sections/ServicesGrid.tsx +210 -210
  92. package/dist/kits/blocks/components/sections/Team.tsx +309 -309
  93. package/dist/kits/blocks/components/sections/Testimonials.tsx +158 -158
  94. package/dist/kits/blocks/components/sections/TrustBadges.tsx +162 -162
  95. package/dist/kits/blocks/components/sections/product-demo/ApprovalInboxPanel.tsx +128 -0
  96. package/dist/kits/blocks/components/sections/product-demo/DemoStage.tsx +519 -0
  97. package/dist/kits/blocks/components/sections/product-demo/DemoWindow.tsx +140 -0
  98. package/dist/kits/blocks/components/sections/product-demo/KnowledgePanel.tsx +130 -0
  99. package/dist/kits/blocks/components/sections/product-demo/RunConsolePanel.tsx +430 -0
  100. package/dist/kits/blocks/components/sections/product-demo/TaskListPanel.tsx +302 -0
  101. package/dist/kits/blocks/components/sections/product-demo/WorkflowStudioPanel.tsx +744 -0
  102. package/dist/kits/blocks/components/sections/product-demo/types.ts +262 -0
  103. package/dist/kits/blocks/components/theme-provider.tsx +1 -34
  104. package/dist/kits/blocks/components/ui/alert-dialog.tsx +134 -134
  105. package/dist/kits/blocks/components/ui/brand-node.tsx +121 -121
  106. package/dist/kits/blocks/components/ui/button.tsx +122 -122
  107. package/dist/kits/blocks/components/ui/card.tsx +95 -95
  108. package/dist/kits/blocks/components/ui/checkbox.tsx +30 -30
  109. package/dist/kits/blocks/components/ui/cta-button.tsx +125 -125
  110. package/dist/kits/blocks/components/ui/dropdown-menu.tsx +201 -201
  111. package/dist/kits/blocks/components/ui/feature-card.tsx +91 -91
  112. package/dist/kits/blocks/components/ui/input.tsx +27 -27
  113. package/dist/kits/blocks/components/ui/label.tsx +29 -29
  114. package/dist/kits/blocks/components/ui/pricing-card.tsx +120 -120
  115. package/dist/kits/blocks/components/ui/select.tsx +25 -25
  116. package/dist/kits/blocks/components/ui/skeleton.tsx +13 -13
  117. package/dist/kits/blocks/components/ui/table.tsx +98 -98
  118. package/dist/kits/blocks/components/ui/testimonial-card.tsx +108 -108
  119. package/dist/kits/blocks/components/ui/textarea.tsx +26 -26
  120. package/dist/kits/blocks/components/ui/theme-selector.tsx +243 -247
  121. package/dist/kits/blocks/components/ui/theme-toggle.tsx +74 -74
  122. package/dist/kits/blocks/components/ui/toaster.tsx +7 -7
  123. package/dist/kits/blocks/lib/themes.ts +400 -400
  124. package/dist/kits/blocks/lib/utils.ts +6 -9
  125. package/dist/kits/blocks/package-deps.json +40 -28
  126. package/dist/kits/blocks/tsconfig.json +11 -0
  127. package/dist/kits/blocks/tsconfig.tsbuildinfo +1 -0
  128. package/dist/utils/file-operations.d.ts +3 -1
  129. package/dist/utils/file-operations.d.ts.map +1 -1
  130. package/dist/utils/file-operations.js +84 -12
  131. package/dist/utils/file-operations.js.map +1 -1
  132. package/dist/utils/installation-tracker.d.ts +2 -2
  133. package/dist/utils/installation-tracker.d.ts.map +1 -1
  134. package/dist/utils/installation-tracker.js +11 -11
  135. package/dist/utils/installation-tracker.js.map +1 -1
  136. package/dist/utils/package-manager.d.ts +6 -0
  137. package/dist/utils/package-manager.d.ts.map +1 -0
  138. package/dist/utils/package-manager.js +58 -0
  139. package/dist/utils/package-manager.js.map +1 -0
  140. package/dist/utils/yarn-pnp.d.ts +6 -0
  141. package/dist/utils/yarn-pnp.d.ts.map +1 -0
  142. package/dist/utils/yarn-pnp.js +39 -0
  143. package/dist/utils/yarn-pnp.js.map +1 -0
  144. package/package.json +5 -2
  145. package/dist/kits/blocks/notes/THEME_GUIDE.md +0 -29
@@ -1,251 +1,269 @@
1
- # Theme System Guide
2
-
3
- This file is shipped with the Nextworks Blocks kit and lives under `.nextworks/docs/THEME_GUIDE.md` in your project.
4
-
5
- The content below is the canonical theme guide for projects using Nextworks Blocks.
6
-
7
- ---
8
-
9
- ## Overview
10
-
11
- This project now includes a comprehensive theming system that allows you to easily switch between different color schemes and have all components automatically adapt.
12
-
13
- ## How to Use
14
-
15
- ### 1. Basic Setup
16
-
17
- Your app is configured with the enhanced theme provider via `AppProviders` in your router entrypoint:
18
-
19
- - App Router: `app/layout.tsx`
20
- - Pages Router: `pages/_app.tsx`
21
-
22
- **Turbopack / Next 16 note (fonts + AppProviders)**
23
-
24
- As of the current alpha, shared packages intentionally avoid importing `next/font/*`.
25
- Fonts are instead configured directly in your app’s router entrypoint (the CLI patches this for you):
26
-
27
- - App Router: `app/layout.tsx`
28
- - Pages Router: `pages/_app.tsx`
29
- This avoids Turbopack dev issues related to internal Next font modules.
30
-
31
- If you ever see a font-related Turbopack error after upgrades or manual edits, re-run:
32
-
33
- ```bash
34
- npx nextworks@latest add blocks --sections --templates
35
- ```
36
-
37
- to re-apply the router entrypoint patch, and ensure your entrypoint contains a valid
38
- `import { ... } from "next/font/google";` plus the corresponding `const geistSans = ...` etc.
39
-
40
- The default theme variant is set to "monochrome".
41
-
42
- ### 2. Available Themes
43
-
44
- - **Monochrome** - Clean black and white theme
45
- - **Blue** - Professional blue color scheme
46
- - **Green** - Fresh green color scheme
47
- - **Purple** - Modern purple color scheme
48
- - **Orange** - Vibrant orange color scheme
49
- - **Default** - Standard shadCN theme
50
-
51
- ### 3. Using Theme-Aware Components
52
-
53
- #### Navbar2 Component
54
-
55
- ```tsx
56
- import { Navbar2 } from "@/components/sections/Navbar2";
57
-
58
- <Navbar2
59
- brand="My App"
60
- brandNode={<YourLogoComponent />}
61
- menuItems={[
62
- { label: "Home", href: "/" },
63
- { label: "About", href: "/about" },
64
- ]}
65
- ctaButton={{ label: "Get Started", href: "/signup" }}
66
- showThemeSelector={true}
67
- />;
68
- ```
69
-
70
- #### Theme Selector
71
-
72
- The `ThemeSelector` component is automatically included in Navbar2 and allows users to:
73
-
74
- - Switch between theme variants (monochrome, blue, green, etc.)
75
- - Toggle between light/dark modes
76
- - Use system preference
77
-
78
- ### 4. Converting Existing Components
79
-
80
- To make your existing components theme-aware, replace hardcoded colors with semantic classes:
81
-
82
- #### Before (Hardcoded Colors):
83
-
84
- ```tsx
85
- className = "bg-gray-50 dark:bg-gray-800 text-gray-800 dark:text-white";
86
- ```
87
-
88
- #### After (Theme-Aware):
89
-
90
- ```tsx
91
- className = "bg-background text-foreground";
92
- ```
93
-
94
- #### Common Replacements:
95
-
96
- - `text-gray-800 dark:text-white` → `text-foreground`
97
- - `bg-gray-50 dark:bg-gray-800` → `bg-background`
98
- - `border-gray-200 dark:border-gray-700` → `border-border`
99
- - `hover:bg-gray-100 dark:hover:bg-gray-700` → `hover:bg-accent`
100
- - `text-blue-600 dark:text-blue-500` → `text-primary`
101
-
102
- ### 5. Semantic Color Classes
103
-
104
- Use these semantic classes for consistent theming:
105
-
106
- - `text-primary` - Primary brand color
107
- - `text-secondary` - Secondary text color
108
- - `text-muted-foreground` - Muted text color
109
- - `bg-background` - Main background color
110
- - `bg-card` - Card background color
111
- - `bg-accent` - Accent background color
112
- - `border-border` - Border color
113
- - `ring-ring` - Focus ring color
114
-
115
- ### 6. Creating Custom Themes
116
-
117
- To create a custom theme, modify `lib/themes.ts`:
118
-
119
- ```ts
120
- export const themes: Record<ThemeVariant, ThemeConfig> = {
121
- // ... existing themes
122
- myCustomTheme: {
123
- name: "My Custom Theme",
124
- colors: {
125
- primary: "oklch(0.5 0.2 120)", // Custom green
126
- primaryForeground: "oklch(0.98 0 0)",
127
- // ... other colors
128
- },
129
- },
130
- };
131
- ```
132
-
133
- ### 7. Example Usage
134
-
135
- See the templates and `lib/themes.ts` for concrete examples of how themes are wired up.
136
-
137
- Template paths depend on your router:
138
-
139
- - App Router: `app/templates/*`
140
- - Pages Router: `pages/templates/*`
141
-
142
- ## Benefits
143
-
144
- 1. **Consistent Design**: All components automatically use the same color scheme
145
- 2. **Easy Customization**: Change the entire app's look by switching themes
146
- 3. **Accessibility**: Proper contrast ratios maintained across all themes
147
- 4. **Developer Experience**: No need to manually style each component
148
- 5. **User Choice**: Users can choose their preferred theme and light/dark mode
149
-
150
- ---
151
-
152
- ## Mixing tokens and local overrides
153
-
154
- Sometimes you want the speed and consistency of the Color Theme (tokens), but still make template-specific tweaks. This project supports three patterns:
155
-
156
- - Token-first: use semantic classes/variants everywhere (default behavior)
157
- - Hybrid: keep tokens for most things and override specific slots/elements
158
- - Full control: bypass tokens with unstyled primitives and fully custom classes
159
-
160
- ### 1) Prefer additive overrides first
161
-
162
- - Keep variant/size from tokens and add className for small tweaks.
163
- - Use component slot props for targeted overrides rather than global changes.
164
-
165
- Example: override only mobile link hover background in the shared Navbar from a preset, leaving everything else token-based.
166
-
167
- ```tsx
168
- // app/templates/productlaunch/components/Navbar.tsx
169
- mobileLinks: {
170
- className: "hover:bg-purple-50 dark:hover:bg-purple-900/20",
171
- },
172
- ```
173
-
174
- ### 2) Override focus ring colors locally
175
-
176
- Links in Navbar apply a token focus ring (`focus:ring-ring`). You can override it per preset by placing your ring utilities in `links.className` (these are merged last):
177
-
178
- ```tsx
179
- // app/templates/productlaunch/components/Navbar.tsx
180
- links: {
181
- className:
182
- "text-sm font-medium font-inter text-gray-800 dark:text-white hover:text-purple-700 dark:hover:text-purple-500 " +
183
- "focus:ring-purple-500 dark:focus:ring-purple-400",
184
- },
185
- ```
186
-
187
- ### 3) ThemeToggle with local styling
188
-
189
- `ThemeToggle` accepts `buttonProps` that forward to the internal `Button`. For small tweaks, keep token variants and just add classes. For full control, use `unstyled: true` to bypass tokens:
190
-
191
- ```tsx
192
- // app/templates/productlaunch/components/Navbar.tsx
193
- themeToggle: {
194
- buttonProps: {
195
- unstyled: true,
196
- className:
197
- "size-9 p-0 flex items-center justify-center rounded-md border border-gray-200 " +
198
- "bg-white text-gray-700 hover:bg-purple-50 hover:text-purple-700 " +
199
- "dark:border-gray-800 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-purple-900/20 " +
200
- "transition-colors focus:outline-none focus:ring-2 focus:ring-purple-500 dark:focus:ring-purple-400",
201
- },
202
- moonClassName: "text-gray-700 dark:text-gray-100",
203
- sunClassName: "text-gray-700 dark:text-gray-100",
204
- },
205
- ```
206
-
207
- ### 4) Unstyled escape hatch for primitives
208
-
209
- Shared primitives like `Button` support an `unstyled` prop to bypass tokenized CVA classes and allow complete consumer control:
210
-
211
- ```tsx
212
- // components/ui/button.tsx
213
- <Button unstyled className="rounded-md bg-purple-600 px-3 py-2 text-white ...">
214
- Click me
215
- </Button>
216
- ```
217
-
218
- Use this when a section must not be influenced by the global Color Theme.
219
-
220
- ### 5) Navbar accent via CSS variables (recommended for presets)
221
-
222
- Set a small set of CSS variables on the Navbar root in your preset, and internal elements (ThemeToggle, mobile links, focus rings) will read them automatically with fallbacks to tokens.
223
-
224
- Suggested variables:
225
-
226
- - `--navbar-accent`: icon/text accent color
227
- - `--navbar-hover-bg`: hover background color for toggle and mobile links
228
- - `--navbar-toggle-bg`: default background for the theme toggle button
229
- - `--navbar-ring`: focus ring color
230
- - `--navbar-border`: border color for theme toggle and similar controls
231
-
232
- Example in a preset:
233
-
234
- ```tsx
235
- // app/templates/productlaunch/components/Navbar.tsx
236
- nav: {
237
- className:
238
- "bg-white dark:bg-gray-900 text-gray-800 dark:text-white border-b border-gray-200 dark:border-gray-800 " +
239
- "[--navbar-accent:theme(colors.purple.600)] dark:[--navbar-accent:theme(colors.purple.400)] " +
240
- "[--navbar-hover-bg:theme(colors.purple.50)] dark:[--navbar-hover-bg:color-mix(in oklab,oklch(0.17 0.05 324) 20%, transparent)] " +
241
- "[--navbar-ring:theme(colors.purple.500)] dark:[--navbar-ring:theme(colors.purple.400)]",
242
- },
243
- ```
244
-
245
- After setting these, you generally don’t need to pass `themeToggle` overrides; the toggle and links will align to your preset accent automatically.
246
-
247
- Notes:
248
-
249
- - Consumer `className` is merged last, so your overrides win when conflicts exist.
250
- - Always include `dark:` variants when you override hover/focus to maintain dark mode parity.
251
- - Scope overrides narrowly (slots/elements) to avoid surprising global changes.
1
+ # Theme System Guide
2
+
3
+ This file is shipped with the Nextworks Blocks kit and lives under `.nextworks/docs/THEME_GUIDE.md` in your project.
4
+
5
+ The content below is the canonical theme guide for projects using Nextworks Blocks.
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This project now includes a comprehensive theming system that allows you to easily switch between different color schemes and have all components automatically adapt.
12
+
13
+ ## How to Use
14
+
15
+ ### 1. Basic Setup
16
+
17
+ Your app is configured with the enhanced theme provider via `AppProviders` in your router entrypoint:
18
+
19
+ - App Router: `app/layout.tsx`
20
+ - Pages Router: `pages/_app.tsx`
21
+
22
+ **Turbopack / Next 16 note (fonts + AppProviders)**
23
+
24
+ As of the current alpha, shared packages intentionally avoid importing `next/font/*`.
25
+ Fonts are instead configured directly in your app’s router entrypoint (the CLI patches this for you):
26
+
27
+ - App Router: `app/layout.tsx`
28
+ - Pages Router: `pages/_app.tsx`
29
+ This avoids Turbopack dev issues related to internal Next font modules.
30
+
31
+ If you ever see a font-related Turbopack error after upgrades or manual edits, re-run:
32
+
33
+ ```bash
34
+ npx nextworks@latest add blocks --templates
35
+ ```
36
+
37
+ to re-apply the router entrypoint patch, and ensure your entrypoint contains a valid
38
+ `import { ... } from "next/font/google";` plus the corresponding `const geistSans = ...` etc.
39
+
40
+ The default theme variant is set to "monochrome".
41
+
42
+ ### 2. Available Themes
43
+
44
+ - **Monochrome** - Clean black and white theme
45
+ - **Blue** - Professional blue color scheme
46
+ - **Green** - Fresh green color scheme
47
+ - **Purple** - Modern purple color scheme
48
+ - **Orange** - Vibrant orange color scheme
49
+ - **Default** - Standard shadCN theme
50
+
51
+ ### 3. Using Theme-Aware Components
52
+
53
+ #### Navbar2 Component
54
+
55
+ ```tsx
56
+ import { Navbar2 } from "@/components/sections/Navbar2";
57
+
58
+ <Navbar2
59
+ brand="My App"
60
+ brandNode={<YourLogoComponent />}
61
+ menuItems={[
62
+ { label: "Home", href: "/" },
63
+ { label: "About", href: "/about" },
64
+ ]}
65
+ ctaButton={{ label: "Get Started", href: "/signup" }}
66
+ showThemeSelector={true}
67
+ />;
68
+ ```
69
+
70
+ #### Theme Selector
71
+
72
+ The `ThemeSelector` component is automatically included in Navbar2 and allows users to:
73
+
74
+ - Switch between theme variants (monochrome, blue, green, etc.)
75
+ - Toggle between light/dark modes
76
+ - Use system preference
77
+
78
+ ### 4. Converting Existing Components
79
+
80
+ To make your existing components theme-aware, replace hardcoded colors with semantic classes:
81
+
82
+ #### Before (Hardcoded Colors):
83
+
84
+ ```tsx
85
+ className = "bg-gray-50 dark:bg-gray-800 text-gray-800 dark:text-white";
86
+ ```
87
+
88
+ #### After (Theme-Aware):
89
+
90
+ ```tsx
91
+ className = "bg-background text-foreground";
92
+ ```
93
+
94
+ #### Common Replacements:
95
+
96
+ - `text-gray-800 dark:text-white` → `text-foreground`
97
+ - `bg-gray-50 dark:bg-gray-800` → `bg-background`
98
+ - `border-gray-200 dark:border-gray-700` → `border-border`
99
+ - `hover:bg-gray-100 dark:hover:bg-gray-700` → `hover:bg-accent`
100
+ - `text-blue-600 dark:text-blue-500` → `text-primary`
101
+
102
+ ### 5. Semantic Color Classes
103
+
104
+ Use these semantic classes for consistent theming:
105
+
106
+ - `text-primary` - Primary brand color
107
+ - `text-secondary` - Secondary text color
108
+ - `text-muted-foreground` - Muted text color
109
+ - `bg-background` - Main background color
110
+ - `bg-card` - Card background color
111
+ - `bg-accent` - Accent background color
112
+ - `border-border` - Border color
113
+ - `ring-ring` - Focus ring color
114
+
115
+ ### 6. Creating Custom Themes
116
+
117
+ To create a custom theme, modify `lib/themes.ts`:
118
+
119
+ ```ts
120
+ export const themes: Record<ThemeVariant, ThemeConfig> = {
121
+ // ... existing themes
122
+ myCustomTheme: {
123
+ name: "My Custom Theme",
124
+ colors: {
125
+ primary: "oklch(0.5 0.2 120)", // Custom green
126
+ primaryForeground: "oklch(0.98 0 0)",
127
+ // ... other colors
128
+ },
129
+ },
130
+ };
131
+ ```
132
+
133
+ ### 7. Example Usage
134
+
135
+ See the templates and `lib/themes.ts` for concrete examples of how themes are wired up.
136
+
137
+ Template paths depend on your router:
138
+
139
+ - App Router: `app/templates/<template>/**`
140
+ - Pages Router:
141
+ - route entry file: `pages/templates/<template>/index.tsx`
142
+ - supporting template files: `components/templates/<template>/**`
143
+
144
+ ## Benefits
145
+
146
+ 1. **Consistent Design**: All components automatically use the same color scheme
147
+ 2. **Easy Customization**: Change the entire app's look by switching themes
148
+ 3. **Accessibility**: Proper contrast ratios maintained across all themes
149
+ 4. **Developer Experience**: No need to manually style each component
150
+ 5. **User Choice**: Users can choose their preferred theme and light/dark mode
151
+
152
+ ---
153
+
154
+ ## Mixing tokens and local overrides
155
+
156
+ Sometimes you want the speed and consistency of the Color Theme (tokens), but still make template-specific tweaks. This project supports three patterns:
157
+
158
+ - Token-first: use semantic classes/variants everywhere (default behavior)
159
+ - Hybrid: keep tokens for most things and override specific slots/elements
160
+ - Full control: bypass tokens with unstyled primitives and fully custom classes
161
+
162
+ ### 1) Prefer additive overrides first
163
+
164
+ - Keep variant/size from tokens and add className for small tweaks.
165
+ - Use component slot props for targeted overrides rather than global changes.
166
+
167
+ Example: override only mobile link hover background in the shared Navbar from a preset, leaving everything else token-based.
168
+
169
+ ```tsx
170
+ // App Router install:
171
+ // app/templates/productlaunch/components/Navbar.tsx
172
+ //
173
+ // Pages Router install:
174
+ // components/templates/productlaunch/components/Navbar.tsx
175
+ mobileLinks: {
176
+ className: "hover:bg-purple-50 dark:hover:bg-purple-900/20",
177
+ },
178
+ ```
179
+
180
+ ### 2) Override focus ring colors locally
181
+
182
+ Links in Navbar apply a token focus ring (`focus:ring-ring`). You can override it per preset by placing your ring utilities in `links.className` (these are merged last):
183
+
184
+ ```tsx
185
+ // App Router install:
186
+ // app/templates/productlaunch/components/Navbar.tsx
187
+ //
188
+ // Pages Router install:
189
+ // components/templates/productlaunch/components/Navbar.tsx
190
+ links: {
191
+ className:
192
+ "text-sm font-medium font-inter text-gray-800 dark:text-white hover:text-purple-700 dark:hover:text-purple-500 " +
193
+ "focus:ring-purple-500 dark:focus:ring-purple-400",
194
+ },
195
+ ```
196
+
197
+ ### 3) ThemeToggle with local styling
198
+
199
+ `ThemeToggle` accepts `buttonProps` that forward to the internal `Button`. For small tweaks, keep token variants and just add classes. For full control, use `unstyled: true` to bypass tokens:
200
+
201
+ ```tsx
202
+ // App Router install:
203
+ // app/templates/productlaunch/components/Navbar.tsx
204
+ //
205
+ // Pages Router install:
206
+ // components/templates/productlaunch/components/Navbar.tsx
207
+ themeToggle: {
208
+ buttonProps: {
209
+ unstyled: true,
210
+ className:
211
+ "size-9 p-0 flex items-center justify-center rounded-md border border-gray-200 " +
212
+ "bg-white text-gray-700 hover:bg-purple-50 hover:text-purple-700 " +
213
+ "dark:border-gray-800 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-purple-900/20 " +
214
+ "transition-colors focus:outline-none focus:ring-2 focus:ring-purple-500 dark:focus:ring-purple-400",
215
+ },
216
+ moonClassName: "text-gray-700 dark:text-gray-100",
217
+ sunClassName: "text-gray-700 dark:text-gray-100",
218
+ },
219
+ ```
220
+
221
+ ### 4) Unstyled escape hatch for primitives
222
+
223
+ Shared primitives like `Button` support an `unstyled` prop to bypass tokenized CVA classes and allow complete consumer control:
224
+
225
+ ```tsx
226
+ // components/ui/button.tsx
227
+ <Button unstyled className="rounded-md bg-purple-600 px-3 py-2 text-white ...">
228
+ Click me
229
+ </Button>
230
+ ```
231
+
232
+ Use this when a section must not be influenced by the global Color Theme.
233
+
234
+ ### 5) Navbar accent via CSS variables (recommended for presets)
235
+
236
+ Set a small set of CSS variables on the Navbar root in your preset, and internal elements (ThemeToggle, mobile links, focus rings) will read them automatically with fallbacks to tokens.
237
+
238
+ Suggested variables:
239
+
240
+ - `--navbar-accent`: icon/text accent color
241
+ - `--navbar-hover-bg`: hover background color for toggle and mobile links
242
+ - `--navbar-toggle-bg`: default background for the theme toggle button
243
+ - `--navbar-ring`: focus ring color
244
+ - `--navbar-border`: border color for theme toggle and similar controls
245
+
246
+ Example in a preset:
247
+
248
+ ```tsx
249
+ // App Router install:
250
+ // app/templates/productlaunch/components/Navbar.tsx
251
+ //
252
+ // Pages Router install:
253
+ // components/templates/productlaunch/components/Navbar.tsx
254
+ nav: {
255
+ className:
256
+ "bg-white dark:bg-gray-900 text-gray-800 dark:text-white border-b border-gray-200 dark:border-gray-800 " +
257
+ "[--navbar-accent:theme(colors.purple.600)] dark:[--navbar-accent:theme(colors.purple.400)] " +
258
+ "[--navbar-hover-bg:theme(colors.purple.50)] dark:[--navbar-hover-bg:color-mix(in oklab,oklch(0.17 0.05 324) 20%, transparent)] " +
259
+ "[--navbar-ring:theme(colors.purple.500)] dark:[--navbar-ring:theme(colors.purple.400)]",
260
+ },
261
+ ```
262
+
263
+ After setting these, you generally don’t need to pass `themeToggle` overrides; the toggle and links will align to your preset accent automatically.
264
+
265
+ Notes:
266
+
267
+ - Consumer `className` is merged last, so your overrides win when conflicts exist.
268
+ - Always include `dark:` variants when you override hover/focus to maintain dark mode parity.
269
+ - Scope overrides narrowly (slots/elements) to avoid surprising global changes.