bsmnt 0.2.9 → 0.2.10
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 +84 -146
- package/package.json +2 -2
- package/src/templates/next-default/README.md +28 -199
- package/src/templates/next-default/app/layout.tsx +2 -3
- package/src/templates/next-default/biome.json +1 -14
- package/src/templates/next-default/components/layout/theme/index.tsx +2 -5
- package/src/templates/next-default/components/layout/wrapper/index.tsx +1 -2
- package/src/templates/next-default/components/ui/README.md +2 -3
- package/src/templates/next-default/components/ui/image/index.tsx +3 -3
- package/src/templates/next-default/lib/README.md +3 -3
- package/src/templates/next-default/lib/hooks/use-device-detection.ts +3 -2
- package/src/templates/next-default/lib/hooks/use-media-breakpoint.ts +10 -3
- package/src/templates/next-default/lib/scripts/dev.ts +9 -29
- package/src/templates/next-default/lib/styles/README.md +7 -58
- package/src/templates/next-default/lib/styles/fonts.ts +7 -15
- package/src/templates/next-default/lib/styles/global.css +198 -0
- package/src/templates/next-default/lib/styles/index.css +3 -0
- package/src/templates/next-default/lib/styles/tokens.css +179 -0
- package/src/templates/next-default/lib/utils/global-css.d.ts +1 -0
- package/src/templates/next-default/lib/utils/viewport.ts +11 -5
- package/src/templates/next-default/next.config.ts +0 -1
- package/src/templates/next-default/package.json +10 -17
- package/src/templates/next-default/postcss.config.mjs +0 -14
- package/src/templates/next-default/tsconfig.tsbuildinfo +1 -0
- package/src/templates/next-experiments/README.md +29 -200
- package/src/templates/next-experiments/app/layout.tsx +2 -3
- package/src/templates/next-experiments/app/page.tsx +46 -39
- package/src/templates/next-experiments/biome.json +1 -14
- package/src/templates/next-experiments/components/layout/theme/index.tsx +2 -5
- package/src/templates/next-experiments/components/layout/wrapper/index.tsx +1 -2
- package/src/templates/next-experiments/components/ui/README.md +2 -3
- package/src/templates/next-experiments/components/ui/image/index.tsx +3 -2
- package/src/templates/next-experiments/lib/README.md +3 -3
- package/src/templates/next-experiments/lib/hooks/use-device-detection.ts +3 -2
- package/src/templates/next-experiments/lib/hooks/use-media-breakpoint.ts +10 -3
- package/src/templates/next-experiments/lib/scripts/dev.ts +9 -29
- package/src/templates/next-experiments/lib/styles/README.md +7 -58
- package/src/templates/next-experiments/lib/styles/fonts.ts +7 -15
- package/src/templates/next-experiments/lib/styles/global.css +198 -0
- package/src/templates/next-experiments/lib/styles/index.css +3 -0
- package/src/templates/next-experiments/lib/styles/tokens.css +179 -0
- package/src/templates/next-experiments/lib/utils/global-css.d.ts +1 -0
- package/src/templates/next-experiments/lib/utils/viewport.ts +11 -5
- package/src/templates/next-experiments/next.config.ts +0 -1
- package/src/templates/next-experiments/package.json +10 -21
- package/src/templates/next-experiments/postcss.config.mjs +0 -14
- package/src/templates/next-experiments/tsconfig.tsbuildinfo +1 -0
- package/src/templates/next-webgl/README.md +30 -200
- package/src/templates/next-webgl/app/layout.tsx +2 -3
- package/src/templates/next-webgl/biome.json +1 -14
- package/src/templates/next-webgl/components/layout/theme/index.tsx +2 -5
- package/src/templates/next-webgl/components/layout/wrapper/index.tsx +1 -2
- package/src/templates/next-webgl/components/ui/README.md +2 -3
- package/src/templates/next-webgl/components/ui/image/index.tsx +3 -3
- package/src/templates/next-webgl/lib/README.md +3 -3
- package/src/templates/next-webgl/lib/hooks/use-device-detection.ts +3 -2
- package/src/templates/next-webgl/lib/hooks/use-media-breakpoint.ts +10 -3
- package/src/templates/next-webgl/lib/scripts/dev.ts +9 -29
- package/src/templates/next-webgl/lib/styles/README.md +7 -58
- package/src/templates/next-webgl/lib/styles/fonts.ts +7 -15
- package/src/templates/next-webgl/lib/styles/global.css +198 -0
- package/src/templates/next-webgl/lib/styles/index.css +3 -0
- package/src/templates/next-webgl/lib/styles/tokens.css +179 -0
- package/src/templates/next-webgl/lib/utils/global-css.d.ts +1 -0
- package/src/templates/next-webgl/lib/utils/viewport.ts +11 -5
- package/src/templates/next-webgl/next.config.ts +0 -1
- package/src/templates/next-webgl/package.json +10 -19
- package/src/templates/next-webgl/postcss.config.mjs +0 -14
- package/src/templates/next-webgl/tsconfig.tsbuildinfo +1 -0
- package/src/templates/next-default/components/ui/image/image.module.css +0 -5
- package/src/templates/next-default/lib/scripts/generate-component.ts +0 -322
- package/src/templates/next-default/lib/scripts/generate-page.ts +0 -193
- package/src/templates/next-default/lib/scripts/generate.ts +0 -79
- package/src/templates/next-default/lib/store/app.ts +0 -11
- package/src/templates/next-default/lib/store/index.ts +0 -11
- package/src/templates/next-default/lib/styles/colors.ts +0 -63
- package/src/templates/next-default/lib/styles/config.ts +0 -34
- package/src/templates/next-default/lib/styles/css/global.css +0 -85
- package/src/templates/next-default/lib/styles/css/index.css +0 -6
- package/src/templates/next-default/lib/styles/css/reset.css +0 -166
- package/src/templates/next-default/lib/styles/css/root.css +0 -68
- package/src/templates/next-default/lib/styles/css/tailwind.css +0 -132
- package/src/templates/next-default/lib/styles/easings.ts +0 -21
- package/src/templates/next-default/lib/styles/index.ts +0 -12
- package/src/templates/next-default/lib/styles/layout.mjs +0 -27
- package/src/templates/next-default/lib/styles/scripts/README.md +0 -29
- package/src/templates/next-default/lib/styles/scripts/generate-root.ts +0 -57
- package/src/templates/next-default/lib/styles/scripts/generate-tailwind.ts +0 -162
- package/src/templates/next-default/lib/styles/scripts/postcss-functions.mjs +0 -168
- package/src/templates/next-default/lib/styles/scripts/setup-styles.ts +0 -24
- package/src/templates/next-default/lib/styles/scripts/utils.ts +0 -20
- package/src/templates/next-default/lib/styles/typography.ts +0 -36
- package/src/templates/next-default/lib/utils/css.d.ts +0 -21
- package/src/templates/next-default/lib/utils/math.test.ts +0 -221
- package/src/templates/next-default/lib/utils/strings.test.ts +0 -166
- package/src/templates/next-default/lib/utils/viewport.test.ts +0 -256
- package/src/templates/next-default/public/fonts/geist/Geist-Mono.woff2 +0 -0
- package/src/templates/next-experiments/components/ui/image/image.module.css +0 -5
- package/src/templates/next-experiments/lib/scripts/generate-component.ts +0 -322
- package/src/templates/next-experiments/lib/scripts/generate-page.ts +0 -193
- package/src/templates/next-experiments/lib/scripts/generate.ts +0 -79
- package/src/templates/next-experiments/lib/store/app.ts +0 -11
- package/src/templates/next-experiments/lib/store/index.ts +0 -11
- package/src/templates/next-experiments/lib/styles/colors.ts +0 -63
- package/src/templates/next-experiments/lib/styles/config.ts +0 -34
- package/src/templates/next-experiments/lib/styles/css/global.css +0 -85
- package/src/templates/next-experiments/lib/styles/css/index.css +0 -6
- package/src/templates/next-experiments/lib/styles/css/reset.css +0 -166
- package/src/templates/next-experiments/lib/styles/css/root.css +0 -68
- package/src/templates/next-experiments/lib/styles/css/tailwind.css +0 -132
- package/src/templates/next-experiments/lib/styles/easings.ts +0 -21
- package/src/templates/next-experiments/lib/styles/index.ts +0 -12
- package/src/templates/next-experiments/lib/styles/layout.mjs +0 -27
- package/src/templates/next-experiments/lib/styles/scripts/README.md +0 -29
- package/src/templates/next-experiments/lib/styles/scripts/generate-root.ts +0 -57
- package/src/templates/next-experiments/lib/styles/scripts/generate-tailwind.ts +0 -162
- package/src/templates/next-experiments/lib/styles/scripts/postcss-functions.mjs +0 -168
- package/src/templates/next-experiments/lib/styles/scripts/setup-styles.ts +0 -24
- package/src/templates/next-experiments/lib/styles/scripts/utils.ts +0 -20
- package/src/templates/next-experiments/lib/styles/typography.ts +0 -36
- package/src/templates/next-experiments/lib/utils/css.d.ts +0 -21
- package/src/templates/next-experiments/lib/utils/math.test.ts +0 -221
- package/src/templates/next-experiments/lib/utils/strings.test.ts +0 -166
- package/src/templates/next-experiments/lib/utils/viewport.test.ts +0 -256
- package/src/templates/next-experiments/public/fonts/geist/Geist-Mono.woff2 +0 -0
- package/src/templates/next-webgl/components/ui/image/image.module.css +0 -5
- package/src/templates/next-webgl/lib/scripts/generate-component.ts +0 -322
- package/src/templates/next-webgl/lib/scripts/generate-page.ts +0 -193
- package/src/templates/next-webgl/lib/scripts/generate.ts +0 -79
- package/src/templates/next-webgl/lib/store/app.ts +0 -11
- package/src/templates/next-webgl/lib/store/index.ts +0 -11
- package/src/templates/next-webgl/lib/styles/colors.ts +0 -63
- package/src/templates/next-webgl/lib/styles/config.ts +0 -34
- package/src/templates/next-webgl/lib/styles/css/global.css +0 -85
- package/src/templates/next-webgl/lib/styles/css/index.css +0 -6
- package/src/templates/next-webgl/lib/styles/css/reset.css +0 -166
- package/src/templates/next-webgl/lib/styles/css/root.css +0 -68
- package/src/templates/next-webgl/lib/styles/css/tailwind.css +0 -132
- package/src/templates/next-webgl/lib/styles/easings.ts +0 -21
- package/src/templates/next-webgl/lib/styles/index.ts +0 -12
- package/src/templates/next-webgl/lib/styles/layout.mjs +0 -27
- package/src/templates/next-webgl/lib/styles/scripts/README.md +0 -29
- package/src/templates/next-webgl/lib/styles/scripts/generate-root.ts +0 -57
- package/src/templates/next-webgl/lib/styles/scripts/generate-tailwind.ts +0 -162
- package/src/templates/next-webgl/lib/styles/scripts/postcss-functions.mjs +0 -168
- package/src/templates/next-webgl/lib/styles/scripts/setup-styles.ts +0 -24
- package/src/templates/next-webgl/lib/styles/scripts/utils.ts +0 -20
- package/src/templates/next-webgl/lib/styles/typography.ts +0 -36
- package/src/templates/next-webgl/lib/utils/css.d.ts +0 -21
- package/src/templates/next-webgl/lib/utils/math.test.ts +0 -221
- package/src/templates/next-webgl/lib/utils/strings.test.ts +0 -166
- package/src/templates/next-webgl/lib/utils/viewport.test.ts +0 -256
- package/src/templates/next-webgl/public/fonts/geist/Geist-Mono.woff2 +0 -0
|
@@ -1,221 +1,51 @@
|
|
|
1
|
-
# Basement Next Starter
|
|
1
|
+
# Basement Next WebGL Starter
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Tech Stack
|
|
6
|
-
|
|
7
|
-
| Technology | Version | Description |
|
|
8
|
-
|------------|---------|-------------|
|
|
9
|
-
| Next.js | 16.1 | App Router, Turbopack |
|
|
10
|
-
| React | 19 | React Compiler enabled |
|
|
11
|
-
| TypeScript | 5.9 | Strict mode, `noUncheckedIndexedAccess` |
|
|
12
|
-
| Tailwind CSS | 4 | CSS-first configuration |
|
|
13
|
-
| Biome | 2.3 | Linting and formatting |
|
|
14
|
-
| Bun | 1.3 | Package manager and runtime |
|
|
15
|
-
| Zustand | 5.0 | State management |
|
|
3
|
+
Minimal Next.js starter with Tailwind CSS, WebGL helpers, TypeScript, and Basement defaults.
|
|
16
4
|
|
|
17
5
|
## Quick Start
|
|
18
6
|
|
|
19
7
|
```bash
|
|
20
|
-
|
|
21
|
-
bunx degit basementstudio/next-starter my-project
|
|
22
|
-
|
|
23
|
-
# Install dependencies
|
|
24
|
-
cd my-project && bun install
|
|
25
|
-
|
|
26
|
-
# Start development
|
|
8
|
+
bun install
|
|
27
9
|
bun dev
|
|
28
10
|
```
|
|
29
11
|
|
|
30
|
-
Open [http://localhost:3000](http://localhost:3000) to see the result.
|
|
31
|
-
|
|
32
12
|
## Scripts
|
|
33
13
|
|
|
34
14
|
| Command | Description |
|
|
35
15
|
|---------|-------------|
|
|
36
|
-
| `bun dev` | Start development server
|
|
37
|
-
| `bun dev:https` | Start
|
|
16
|
+
| `bun dev` | Start the development server |
|
|
17
|
+
| `bun dev:https` | Start the development server with HTTPS |
|
|
38
18
|
| `bun build` | Build for production |
|
|
39
|
-
| `bun start` | Start production server |
|
|
40
|
-
| `bun
|
|
41
|
-
| `bun lint` | Run Biome
|
|
42
|
-
| `bun
|
|
43
|
-
| `bun
|
|
44
|
-
| `bun
|
|
45
|
-
| `bun test` | Run tests with Bun |
|
|
46
|
-
| `bun analyze` | Analyze bundle size |
|
|
19
|
+
| `bun start` | Start the production server |
|
|
20
|
+
| `bun lint` | Run Biome |
|
|
21
|
+
| `bun lint:fix` | Run Biome with fixes |
|
|
22
|
+
| `bun format` | Format the codebase |
|
|
23
|
+
| `bun typecheck` | Run TypeScript |
|
|
24
|
+
| `bun analyze` | Analyze the Next.js bundle |
|
|
47
25
|
|
|
48
26
|
## Project Structure
|
|
49
27
|
|
|
50
|
-
```
|
|
51
|
-
app/
|
|
52
|
-
├── api/ # API routes (draft-mode, revalidate)
|
|
53
|
-
├── layout.tsx # Root layout with metadata, fonts
|
|
54
|
-
├── page.tsx # Homepage
|
|
55
|
-
├── sitemap.ts # Dynamic sitemap generation
|
|
56
|
-
└── robots.ts # SEO robots.txt
|
|
57
|
-
|
|
28
|
+
```txt
|
|
29
|
+
app/
|
|
58
30
|
components/
|
|
59
|
-
|
|
60
|
-
│ ├── header/ # Navigation header
|
|
61
|
-
│ ├── footer/ # Page footer
|
|
62
|
-
│ ├── wrapper/ # Page wrapper with theme
|
|
63
|
-
│ └── theme/ # Theme context provider
|
|
64
|
-
└── ui/
|
|
65
|
-
├── image/ # Enhanced Next.js Image wrapper
|
|
66
|
-
└── link/ # Smart Link component
|
|
67
|
-
|
|
31
|
+
webgl/
|
|
68
32
|
lib/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
│ └── fonts.ts # Font loading (Geist Mono)
|
|
81
|
-
└── utils/ # Utility functions
|
|
82
|
-
├── easings.ts # 30+ animation easing functions
|
|
83
|
-
├── math.ts # Math utilities
|
|
84
|
-
├── strings.ts # String utilities
|
|
85
|
-
└── fetch.ts # Fetch utilities
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Features
|
|
89
|
-
|
|
90
|
-
### Design System
|
|
91
|
-
|
|
92
|
-
Pre-configured design tokens ready to use:
|
|
93
|
-
|
|
94
|
-
**Breakpoints:**
|
|
95
|
-
- `mobile`: 375px
|
|
96
|
-
- `tablet`: 620px
|
|
97
|
-
- `tablet-lg`: 1024px
|
|
98
|
-
- `desktop`: 1440px
|
|
99
|
-
- `desktop-large`: 1920px
|
|
100
|
-
|
|
101
|
-
**Grid:**
|
|
102
|
-
- Mobile: 4 columns
|
|
103
|
-
- Desktop: 12 columns
|
|
104
|
-
- Gap: 16px
|
|
105
|
-
|
|
106
|
-
**Colors:**
|
|
107
|
-
- Theme colors: `primary`, `secondary`, `contrast`
|
|
108
|
-
- Accent colors: `red`, `blue`, `green`, `violet`, `pink`
|
|
109
|
-
- Light/dark mode support
|
|
110
|
-
|
|
111
|
-
**Easings:**
|
|
112
|
-
30+ easing functions (quad, cubic, quart, quint, sine, expo, circ, back, elastic, bounce)
|
|
113
|
-
|
|
114
|
-
### Smart Components
|
|
115
|
-
|
|
116
|
-
**`<Image>`** - Enhanced Next.js Image wrapper:
|
|
117
|
-
- Automatic responsive sizes based on breakpoints
|
|
118
|
-
- Blur placeholder with shimmer effect
|
|
119
|
-
- Preload support for LCP images
|
|
120
|
-
- SVG handling
|
|
121
|
-
|
|
122
|
-
**`<Link>`** - Intelligent link component:
|
|
123
|
-
- Auto-detects external links (opens in new tab)
|
|
124
|
-
- Connection-aware prefetching (4G only, respects data saver)
|
|
125
|
-
- Falls back to button/div when no href
|
|
126
|
-
- Active state detection
|
|
127
|
-
|
|
128
|
-
**`<Wrapper>`** - Page layout component:
|
|
129
|
-
- Includes Header and Footer
|
|
130
|
-
- Theme provider integration
|
|
131
|
-
- Flexible content area
|
|
132
|
-
|
|
133
|
-
### Theme Support
|
|
134
|
-
|
|
135
|
-
Light/dark theme with CSS custom properties:
|
|
136
|
-
|
|
137
|
-
```tsx
|
|
138
|
-
import { Wrapper } from "@/components/layout/wrapper"
|
|
139
|
-
|
|
140
|
-
export default function Page() {
|
|
141
|
-
return (
|
|
142
|
-
<Wrapper theme="dark">
|
|
143
|
-
<section>Your content</section>
|
|
144
|
-
</Wrapper>
|
|
145
|
-
)
|
|
146
|
-
}
|
|
33
|
+
hooks/
|
|
34
|
+
integrations/
|
|
35
|
+
scripts/
|
|
36
|
+
store/
|
|
37
|
+
styles/
|
|
38
|
+
index.css
|
|
39
|
+
tokens.css
|
|
40
|
+
global.css
|
|
41
|
+
fonts.ts
|
|
42
|
+
cn.ts
|
|
43
|
+
utils/
|
|
147
44
|
```
|
|
148
45
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
```tsx
|
|
152
|
-
import { useTheme } from "@/components/layout/theme"
|
|
153
|
-
|
|
154
|
-
function Component() {
|
|
155
|
-
const { name, setThemeName } = useTheme()
|
|
156
|
-
// ...
|
|
157
|
-
}
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Performance Optimizations
|
|
161
|
-
|
|
162
|
-
- **React Compiler** - Automatic memoization (no manual `useMemo`/`useCallback`)
|
|
163
|
-
- **Turbopack** - Fast development builds
|
|
164
|
-
- **Bundle Analyzer** - `bun analyze` to inspect bundle size
|
|
165
|
-
- **Optimized Imports** - Auto-optimization for GSAP, Three.js, Lenis, Zustand
|
|
166
|
-
- **Security Headers** - CSP, HSTS, XSS protection pre-configured
|
|
167
|
-
- **Image Optimization** - AVIF, WebP with custom quality settings
|
|
168
|
-
|
|
169
|
-
### Developer Experience
|
|
170
|
-
|
|
171
|
-
- **Component Scaffolding** - `bun generate` to create components/hooks
|
|
172
|
-
- **HTTPS Dev Server** - `bun dev:https` for secure contexts
|
|
173
|
-
- **Strict TypeScript** - `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`
|
|
174
|
-
- **Biome** - Fast linting and formatting with custom rules
|
|
175
|
-
- **Tests** - Bun test runner with utilities
|
|
176
|
-
|
|
177
|
-
## Configuration
|
|
178
|
-
|
|
179
|
-
### Styles
|
|
180
|
-
|
|
181
|
-
Edit design tokens in `lib/styles/`:
|
|
182
|
-
|
|
183
|
-
- `colors.ts` - Theme and accent colors
|
|
184
|
-
- `layout.mjs` - Breakpoints, grid, spacing
|
|
185
|
-
- `typography.ts` - Font definitions
|
|
186
|
-
- `easings.ts` - CSS easing variables
|
|
187
|
-
|
|
188
|
-
After editing, regenerate CSS:
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
bun setup:styles
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### Next.js
|
|
195
|
-
|
|
196
|
-
Configuration in `next.config.ts`:
|
|
197
|
-
|
|
198
|
-
- React Compiler enabled
|
|
199
|
-
- Typed routes
|
|
200
|
-
- SVG loader (@svgr/webpack)
|
|
201
|
-
- Security headers
|
|
202
|
-
- Image optimization settings
|
|
203
|
-
|
|
204
|
-
## Deployment
|
|
205
|
-
|
|
206
|
-
### Vercel (Recommended)
|
|
207
|
-
|
|
208
|
-
[](https://vercel.com/new/clone?repository-url=https://github.com/basementstudio/next-starter)
|
|
209
|
-
|
|
210
|
-
### Other Platforms
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
bun build
|
|
214
|
-
bun start
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
The app runs on port 3000 by default.
|
|
218
|
-
|
|
219
|
-
## License
|
|
46
|
+
## Styling
|
|
220
47
|
|
|
221
|
-
|
|
48
|
+
- Import `@/lib/styles/index.css` once in `app/layout.tsx`.
|
|
49
|
+
- Edit `lib/styles/tokens.css` for theme variables, breakpoints, and custom Tailwind utilities.
|
|
50
|
+
- Edit `lib/styles/global.css` for reset rules and app-wide global styles.
|
|
51
|
+
- `lib/styles/fonts.ts` handles font variables.
|
|
@@ -2,10 +2,9 @@ import type { Metadata, Viewport } from "next";
|
|
|
2
2
|
import { Geist } from "next/font/google";
|
|
3
3
|
import { type PropsWithChildren, Suspense } from "react";
|
|
4
4
|
import { Link } from "@/components/ui/link";
|
|
5
|
-
import { themes } from "@/lib/styles/colors";
|
|
6
5
|
import { fontsVariable } from "@/lib/styles/fonts";
|
|
7
6
|
import AppData from "@/package.json";
|
|
8
|
-
import "@/lib/styles/
|
|
7
|
+
import "@/lib/styles/index.css";
|
|
9
8
|
import { cn } from "@/lib/styles/cn";
|
|
10
9
|
|
|
11
10
|
const APP_NAME = AppData.name;
|
|
@@ -74,7 +73,7 @@ export const metadata: Metadata = {
|
|
|
74
73
|
|
|
75
74
|
export const viewport: Viewport = {
|
|
76
75
|
colorScheme: "normal",
|
|
77
|
-
themeColor:
|
|
76
|
+
themeColor: "#000000",
|
|
78
77
|
};
|
|
79
78
|
|
|
80
79
|
export default async function Layout({ children }: PropsWithChildren) {
|
|
@@ -214,20 +214,7 @@
|
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
|
-
"includes": ["
|
|
218
|
-
"linter": {
|
|
219
|
-
"rules": {
|
|
220
|
-
"correctness": {
|
|
221
|
-
"noUnknownProperty": "off"
|
|
222
|
-
},
|
|
223
|
-
"style": {
|
|
224
|
-
"noDescendingSpecificity": "off"
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"includes": ["lib/styles/css/root.css"],
|
|
217
|
+
"includes": ["lib/styles/tokens.css"],
|
|
231
218
|
"linter": {
|
|
232
219
|
"rules": {
|
|
233
220
|
"suspicious": {
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { usePathname } from "next/navigation"
|
|
4
4
|
import { createContext, useContext, useEffect, useState } from "react"
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
export type ThemeName = "light" | "dark"
|
|
7
7
|
|
|
8
8
|
export const ThemeContext = createContext<{
|
|
9
9
|
name: ThemeName
|
|
10
|
-
theme: Themes[ThemeName]
|
|
11
10
|
setThemeName: (theme: ThemeName) => void
|
|
12
11
|
}>({
|
|
13
12
|
name: "light",
|
|
14
|
-
theme: themes.light,
|
|
15
13
|
setThemeName: () => {
|
|
16
14
|
void 0
|
|
17
15
|
},
|
|
@@ -55,7 +53,6 @@ export function Theme({
|
|
|
55
53
|
<ThemeContext.Provider
|
|
56
54
|
value={{
|
|
57
55
|
name: currentTheme,
|
|
58
|
-
theme: themes[currentTheme],
|
|
59
56
|
setThemeName: setCurrentTheme,
|
|
60
57
|
}}
|
|
61
58
|
>
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
import cn from "clsx"
|
|
7
7
|
import { Footer } from "@/components/layout/footer"
|
|
8
8
|
import { Header } from "@/components/layout/header"
|
|
9
|
-
import { Theme } from "@/components/layout/theme"
|
|
10
|
-
import type { ThemeName } from "@/lib/styles/config"
|
|
9
|
+
import { Theme, type ThemeName } from "@/components/layout/theme"
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Props for the Wrapper component.
|
|
@@ -65,9 +65,8 @@ import { Link } from '@/components/ui/link'
|
|
|
65
65
|
<Link href="/about">Internal</Link>
|
|
66
66
|
<Link href="https://example.com">External</Link>
|
|
67
67
|
|
|
68
|
-
// ✅
|
|
69
|
-
|
|
70
|
-
<div className={cn(s.wrapper, 'flex items-center')} />
|
|
68
|
+
// ✅ Tailwind only
|
|
69
|
+
<div className="flex items-center" />
|
|
71
70
|
```
|
|
72
71
|
|
|
73
72
|
## Related
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
import cn from "clsx"
|
|
10
10
|
import NextImage, { type ImageProps as NextImageProps } from "next/image"
|
|
11
11
|
import type { CSSProperties, Ref } from "react"
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
const DESKTOP_BREAKPOINT = 1440
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Enhanced Image component props extending Next.js Image.
|
|
@@ -166,8 +167,7 @@ export function Image({
|
|
|
166
167
|
}: ImageProps) {
|
|
167
168
|
// Generate responsive sizes if not provided
|
|
168
169
|
const finalSizes =
|
|
169
|
-
sizes ||
|
|
170
|
-
`(max-width: ${breakpoints.desktop}px) ${mobileSize}, ${desktopSize}`
|
|
170
|
+
sizes || `(max-width: ${DESKTOP_BREAKPOINT}px) ${mobileSize}, ${desktopSize}`
|
|
171
171
|
|
|
172
172
|
// Early return after hooks
|
|
173
173
|
if (!src) return null
|
|
@@ -27,7 +27,7 @@ import { colors, themes, breakpoints } from '@/lib/styles/config'
|
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
bun dev # Start dev server
|
|
30
|
-
bun
|
|
31
|
-
bun
|
|
32
|
-
bun
|
|
30
|
+
bun build # Create production build
|
|
31
|
+
bun lint:fix # Fix lint issues
|
|
32
|
+
bun typecheck # Run type checks
|
|
33
33
|
```
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from "react"
|
|
2
2
|
import { useMedia } from "react-use"
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const MOBILE_BREAKPOINT = 640
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Hook for detecting device capabilities and characteristics.
|
|
@@ -58,7 +59,7 @@ import { breakpoints } from "@/lib/styles/config"
|
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
61
|
export function useDeviceDetection() {
|
|
61
|
-
const isMobile = useMedia(`(max-width: ${
|
|
62
|
+
const isMobile = useMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`, true)
|
|
62
63
|
const isReducedMotion = useMedia("(prefers-reduced-motion: reduce)")
|
|
63
64
|
const [dpr, setDpr] = useState<number | undefined>(undefined)
|
|
64
65
|
const [isSafari, setIsSafari] = useState<boolean | undefined>(undefined)
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { useMedia } from "react-use"
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const BREAKPOINTS = {
|
|
4
|
+
"desktop-large": 1920,
|
|
5
|
+
desktop: 1440,
|
|
6
|
+
"tablet-lg": 1024,
|
|
7
|
+
tablet: 768,
|
|
8
|
+
mobile: 640,
|
|
9
|
+
} as const
|
|
3
10
|
|
|
4
11
|
/**
|
|
5
12
|
* Hook for detecting if the viewport is at a specific breakpoint.
|
|
@@ -8,8 +15,8 @@ import { breakpoints } from "@/lib/styles/config"
|
|
|
8
15
|
* @returns True if the viewport is at the breakpoint
|
|
9
16
|
*/
|
|
10
17
|
export function useMediaBreakpoint(
|
|
11
|
-
breakpoint: keyof typeof
|
|
18
|
+
breakpoint: keyof typeof BREAKPOINTS,
|
|
12
19
|
defaultState = false
|
|
13
20
|
) {
|
|
14
|
-
return useMedia(`(min-width: ${
|
|
21
|
+
return useMedia(`(min-width: ${BREAKPOINTS[breakpoint]}px)`, defaultState)
|
|
15
22
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cross-platform
|
|
3
|
-
* Replaces npm-run-all for running multiple processes simultaneously
|
|
4
|
-
* Works on Windows, macOS, and Linux using Bun's native APIs
|
|
2
|
+
* Cross-platform Next.js dev launcher.
|
|
5
3
|
*/
|
|
6
4
|
|
|
7
5
|
import { bunExecutable, colorEnv } from "./utils"
|
|
@@ -14,39 +12,21 @@ const nextDevArgs = [bunExecutable, "next", "dev"]
|
|
|
14
12
|
if (isHttps) nextDevArgs.push("--experimental-https")
|
|
15
13
|
if (isInspect) nextDevArgs.push("--inspect")
|
|
16
14
|
|
|
17
|
-
// Build environment with FORCE_COLOR
|
|
18
15
|
const devEnv = colorEnv()
|
|
19
16
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
stderr: "inherit",
|
|
27
|
-
env: devEnv,
|
|
28
|
-
}
|
|
29
|
-
),
|
|
30
|
-
|
|
31
|
-
// Next.js dev server
|
|
32
|
-
Bun.spawn(nextDevArgs, {
|
|
33
|
-
stdout: "inherit",
|
|
34
|
-
stderr: "inherit",
|
|
35
|
-
env: devEnv,
|
|
36
|
-
}),
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
// Handle graceful shutdown
|
|
17
|
+
const nextDevProcess = Bun.spawn(nextDevArgs, {
|
|
18
|
+
stdout: "inherit",
|
|
19
|
+
stderr: "inherit",
|
|
20
|
+
env: devEnv,
|
|
21
|
+
})
|
|
22
|
+
|
|
40
23
|
const cleanup = () => {
|
|
41
|
-
|
|
42
|
-
proc.kill()
|
|
43
|
-
}
|
|
24
|
+
nextDevProcess.kill()
|
|
44
25
|
process.exit(0)
|
|
45
26
|
}
|
|
46
27
|
|
|
47
28
|
process.on("SIGINT", cleanup)
|
|
48
29
|
process.on("SIGTERM", cleanup)
|
|
49
30
|
|
|
50
|
-
|
|
51
|
-
await Promise.race(processes.map((p) => p.exited))
|
|
31
|
+
await nextDevProcess.exited
|
|
52
32
|
cleanup()
|
|
@@ -1,64 +1,13 @@
|
|
|
1
1
|
# Styles
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Minimal Tailwind setup for the starter.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
```css
|
|
8
|
-
/* Viewport-relative sizing */
|
|
9
|
-
.element {
|
|
10
|
-
width: tovw(100); /* 6.94vw (100px at 1440px) */
|
|
11
|
-
width: tovw(100, 50); /* max(50px, 6.94vw) */
|
|
12
|
-
width: tovw(16, undefined, 'mobile'); /* 4.27vw (16px at 375px) */
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/* Relative units */
|
|
16
|
-
.text {
|
|
17
|
-
font-size: torem(24); /* 1.5rem (24px / 16px) */
|
|
18
|
-
padding: toem(16, 14); /* 1.14em (16px / 14px) */
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/* Grid columns */
|
|
22
|
-
.sidebar {
|
|
23
|
-
width: columns(3); /* Spans 3 columns + gaps */
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Custom Utilities (`dr-*`)
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
// Responsive sizing (scales with viewport)
|
|
31
|
-
<div className="dr-w-150 dr-h-100" />
|
|
32
|
-
|
|
33
|
-
// Column-based sizing
|
|
34
|
-
<div className="dr-w-col-4" /> {/* 4 columns wide */}
|
|
35
|
-
|
|
36
|
-
// Grid layout
|
|
37
|
-
<div className="dr-grid" /> {/* 4 cols mobile, 12 cols desktop */}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Breakpoints
|
|
41
|
-
|
|
42
|
-
```css
|
|
43
|
-
@media (--mobile) { /* <= 799px */ }
|
|
44
|
-
@media (--desktop) { /* >= 800px */ }
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Configuration
|
|
5
|
+
## Files
|
|
48
6
|
|
|
49
7
|
| File | Purpose |
|
|
50
8
|
|------|---------|
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
|
|
57
|
-
After changing config: `bun setup:styles`
|
|
58
|
-
|
|
59
|
-
## Generated Files (Don't Edit)
|
|
60
|
-
|
|
61
|
-
- `css/root.css` — CSS custom properties
|
|
62
|
-
- `css/tailwind.css` — Tailwind utilities
|
|
63
|
-
|
|
64
|
-
See [scripts/README.md](scripts/README.md) for generation details.
|
|
9
|
+
| `index.css` | Single stylesheet entrypoint imported by `app/layout.tsx` |
|
|
10
|
+
| `tokens.css` | Theme variables, breakpoints, and custom Tailwind utilities |
|
|
11
|
+
| `global.css` | Reset and global app styles |
|
|
12
|
+
| `fonts.ts` | Font variable setup |
|
|
13
|
+
| `cn.ts` | Tailwind class merging helper |
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Geist_Mono } from "next/font/google";
|
|
2
2
|
|
|
3
|
-
const mono =
|
|
4
|
-
|
|
5
|
-
{
|
|
6
|
-
path: "../../public/fonts/geist/Geist-Mono.woff2",
|
|
7
|
-
weight: "400",
|
|
8
|
-
style: "normal",
|
|
9
|
-
},
|
|
10
|
-
],
|
|
3
|
+
const mono = Geist_Mono({
|
|
4
|
+
subsets: ["latin"],
|
|
11
5
|
display: "swap",
|
|
12
6
|
variable: "--geist-mono",
|
|
13
|
-
preload: true,
|
|
14
|
-
adjustFontFallback: "Arial",
|
|
15
7
|
fallback: [
|
|
16
8
|
"ui-monospace",
|
|
17
9
|
"SFMono-Regular",
|
|
@@ -20,9 +12,9 @@ const mono = localFont({
|
|
|
20
12
|
"Menlo",
|
|
21
13
|
"monospace",
|
|
22
14
|
],
|
|
23
|
-
})
|
|
15
|
+
});
|
|
24
16
|
|
|
25
|
-
const fonts = [mono]
|
|
26
|
-
const fontsVariable = fonts.map((font) => font.variable).join(" ")
|
|
17
|
+
const fonts = [mono];
|
|
18
|
+
const fontsVariable = fonts.map((font) => font.variable).join(" ");
|
|
27
19
|
|
|
28
|
-
export { fontsVariable }
|
|
20
|
+
export { fontsVariable };
|