vibecodeagent 0.0.0-stage → 0.1.64

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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -2
  3. package/THIRD-PARTY-NOTICES.txt +1427 -0
  4. package/dist/agen.js +138895 -0
  5. package/dist/bin.js +1245 -0
  6. package/dist/daemon.js +163664 -0
  7. package/dist/node_modules/node-ensure/index.js +10 -0
  8. package/dist/node_modules/node-ensure/package.json +31 -0
  9. package/dist/node_modules/pdf-parse/lib/pdf-parse.js +102 -0
  10. package/dist/node_modules/pdf-parse/lib/pdf.js/v1.10.100/build/pdf.js +18538 -0
  11. package/dist/node_modules/pdf-parse/lib/pdf.js/v1.10.100/build/pdf.worker.js +45507 -0
  12. package/dist/node_modules/pdf-parse/package.json +49 -0
  13. package/dist/node_modules/sql.js/dist/sql-wasm.js +186 -0
  14. package/dist/node_modules/sql.js/dist/sql-wasm.wasm +0 -0
  15. package/dist/node_modules/sql.js/package.json +58 -0
  16. package/dist/resources/skills/builtin/.gitkeep +0 -0
  17. package/dist/resources/skills/builtin/NOTICE.md +35 -0
  18. package/dist/resources/skills/builtin/README.md +74 -0
  19. package/dist/resources/skills/builtin/backend-engineering/SKILL.md +102 -0
  20. package/dist/resources/skills/builtin/backend-engineering/references/api-contracts.md +320 -0
  21. package/dist/resources/skills/builtin/backend-engineering/references/auth-and-secrets.md +268 -0
  22. package/dist/resources/skills/builtin/backend-engineering/references/concurrency-and-jobs.md +386 -0
  23. package/dist/resources/skills/builtin/backend-engineering/references/data-modelling.md +367 -0
  24. package/dist/resources/skills/builtin/backend-engineering/references/deploy-and-config.md +228 -0
  25. package/dist/resources/skills/builtin/backend-engineering/references/migrations.md +320 -0
  26. package/dist/resources/skills/builtin/backend-engineering/references/observability.md +301 -0
  27. package/dist/resources/skills/builtin/backend-engineering/references/plan-template.md +152 -0
  28. package/dist/resources/skills/builtin/backend-engineering/references/review-audit.md +213 -0
  29. package/dist/resources/skills/builtin/backend-engineering/references/security.md +251 -0
  30. package/dist/resources/skills/builtin/backend-engineering/references/stack-go.md +238 -0
  31. package/dist/resources/skills/builtin/backend-engineering/references/stack-node.md +274 -0
  32. package/dist/resources/skills/builtin/backend-engineering/references/stack-python.md +296 -0
  33. package/dist/resources/skills/builtin/backend-engineering/references/testing-and-perf.md +298 -0
  34. package/dist/resources/skills/builtin/backend-engineering/references/validation-and-errors.md +266 -0
  35. package/dist/resources/skills/builtin/dasar-vibecode/SKILL.md +312 -0
  36. package/dist/resources/skills/builtin/excel-maker/SKILL.md +71 -0
  37. package/dist/resources/skills/builtin/frontend-design/SKILL.md +131 -0
  38. package/dist/resources/skills/builtin/frontend-design/data/app-interface.csv +33 -0
  39. package/dist/resources/skills/builtin/frontend-design/data/catalog-summary.json +78 -0
  40. package/dist/resources/skills/builtin/frontend-design/data/charts.csv +26 -0
  41. package/dist/resources/skills/builtin/frontend-design/data/colors.csv +193 -0
  42. package/dist/resources/skills/builtin/frontend-design/data/data-provenance.json +1348 -0
  43. package/dist/resources/skills/builtin/frontend-design/data/google-font-licenses.json +20185 -0
  44. package/dist/resources/skills/builtin/frontend-design/data/google-fonts.csv +1935 -0
  45. package/dist/resources/skills/builtin/frontend-design/data/icons.csv +106 -0
  46. package/dist/resources/skills/builtin/frontend-design/data/landing.csv +35 -0
  47. package/dist/resources/skills/builtin/frontend-design/data/motion.csv +18 -0
  48. package/dist/resources/skills/builtin/frontend-design/data/phosphor-icons-upstream.json +32582 -0
  49. package/dist/resources/skills/builtin/frontend-design/data/products.csv +193 -0
  50. package/dist/resources/skills/builtin/frontend-design/data/react-performance.csv +45 -0
  51. package/dist/resources/skills/builtin/frontend-design/data/stacks/angular.csv +51 -0
  52. package/dist/resources/skills/builtin/frontend-design/data/stacks/astro.csv +54 -0
  53. package/dist/resources/skills/builtin/frontend-design/data/stacks/avalonia.csv +57 -0
  54. package/dist/resources/skills/builtin/frontend-design/data/stacks/flutter.csv +53 -0
  55. package/dist/resources/skills/builtin/frontend-design/data/stacks/html-tailwind.csv +60 -0
  56. package/dist/resources/skills/builtin/frontend-design/data/stacks/javafx.csv +76 -0
  57. package/dist/resources/skills/builtin/frontend-design/data/stacks/jetpack-compose.csv +53 -0
  58. package/dist/resources/skills/builtin/frontend-design/data/stacks/laravel.csv +51 -0
  59. package/dist/resources/skills/builtin/frontend-design/data/stacks/nextjs.csv +62 -0
  60. package/dist/resources/skills/builtin/frontend-design/data/stacks/nuxt-ui.csv +71 -0
  61. package/dist/resources/skills/builtin/frontend-design/data/stacks/nuxtjs.csv +68 -0
  62. package/dist/resources/skills/builtin/frontend-design/data/stacks/react-native.csv +52 -0
  63. package/dist/resources/skills/builtin/frontend-design/data/stacks/react.csv +62 -0
  64. package/dist/resources/skills/builtin/frontend-design/data/stacks/shadcn.csv +69 -0
  65. package/dist/resources/skills/builtin/frontend-design/data/stacks/svelte.csv +56 -0
  66. package/dist/resources/skills/builtin/frontend-design/data/stacks/swiftui.csv +51 -0
  67. package/dist/resources/skills/builtin/frontend-design/data/stacks/threejs.csv +54 -0
  68. package/dist/resources/skills/builtin/frontend-design/data/stacks/uno.csv +60 -0
  69. package/dist/resources/skills/builtin/frontend-design/data/stacks/uwp.csv +56 -0
  70. package/dist/resources/skills/builtin/frontend-design/data/stacks/vue.csv +50 -0
  71. package/dist/resources/skills/builtin/frontend-design/data/stacks/winui.csv +60 -0
  72. package/dist/resources/skills/builtin/frontend-design/data/stacks/wpf.csv +57 -0
  73. package/dist/resources/skills/builtin/frontend-design/data/styles.csv +89 -0
  74. package/dist/resources/skills/builtin/frontend-design/data/typography.csv +75 -0
  75. package/dist/resources/skills/builtin/frontend-design/data/ui-reasoning.csv +193 -0
  76. package/dist/resources/skills/builtin/frontend-design/data/ux-guidelines.csv +120 -0
  77. package/dist/resources/skills/builtin/frontend-design/references/animation-patterns.md +705 -0
  78. package/dist/resources/skills/builtin/frontend-design/references/app-polish.md +117 -0
  79. package/dist/resources/skills/builtin/frontend-design/references/apple-fluid.md +278 -0
  80. package/dist/resources/skills/builtin/frontend-design/references/art-direction.md +280 -0
  81. package/dist/resources/skills/builtin/frontend-design/references/case-studies.md +599 -0
  82. package/dist/resources/skills/builtin/frontend-design/references/craft.md +128 -0
  83. package/dist/resources/skills/builtin/frontend-design/references/expo.md +251 -0
  84. package/dist/resources/skills/builtin/frontend-design/references/layout-systems.md +533 -0
  85. package/dist/resources/skills/builtin/frontend-design/references/libraries.md +72 -0
  86. package/dist/resources/skills/builtin/frontend-design/references/motion.md +222 -0
  87. package/dist/resources/skills/builtin/frontend-design/references/picker.md +197 -0
  88. package/dist/resources/skills/builtin/frontend-design/references/plan-template.md +73 -0
  89. package/dist/resources/skills/builtin/frontend-design/references/prototype.md +85 -0
  90. package/dist/resources/skills/builtin/frontend-design/references/recipes-expo.md +385 -0
  91. package/dist/resources/skills/builtin/frontend-design/references/recipes-web.md +421 -0
  92. package/dist/resources/skills/builtin/frontend-design/references/review-audit.md +107 -0
  93. package/dist/resources/skills/builtin/frontend-design/references/sonner.md +143 -0
  94. package/dist/resources/skills/builtin/frontend-design/references/technical-stack.md +543 -0
  95. package/dist/resources/skills/builtin/frontend-design/references/theming.md +60 -0
  96. package/dist/resources/skills/builtin/frontend-design/references/typography.md +393 -0
  97. package/dist/resources/skills/builtin/frontend-design/references/ux-rules.md +256 -0
  98. package/dist/resources/skills/builtin/frontend-design/references/vocabulary.md +169 -0
  99. package/dist/resources/skills/builtin/frontend-design/scripts/core.py +993 -0
  100. package/dist/resources/skills/builtin/frontend-design/scripts/design_system.py +1643 -0
  101. package/dist/resources/skills/builtin/frontend-design/scripts/reasoning_contract.py +123 -0
  102. package/dist/resources/skills/builtin/frontend-design/scripts/search.py +171 -0
  103. package/dist/resources/skills/builtin/frontend-design/scripts/validate_data.py +1091 -0
  104. package/dist/resources/skills/builtin/kerja-agentik/SKILL.md +117 -0
  105. package/dist/resources/skills/builtin/pdf-maker/SKILL.md +51 -0
  106. package/dist/resources/skills/builtin/tinjau-keamanan/SKILL.md +53 -0
  107. package/dist/resources/skills/builtin/word-maker/SKILL.md +58 -0
  108. package/dist/resources/skills/builtin/write-swift/SKILL.md +388 -0
  109. package/package.json +35 -4
@@ -0,0 +1,543 @@
1
+ # Technical Stack Reference
2
+
3
+ ## Table of Contents
4
+ 1. Core Technologies
5
+ 2. Animation Libraries
6
+ 3. Smooth Scrolling Solutions
7
+ 4. 3D & WebGL
8
+ 5. Build Tools & Frameworks
9
+ 6. Performance Optimization
10
+ 7. Deployment & Hosting
11
+
12
+ ---
13
+
14
+ ## 1. Core Technologies
15
+
16
+ ### CSS Approach
17
+
18
+ ```
19
+ METHODOLOGY
20
+ ├── CSS Custom Properties (required)
21
+ ├── Modern CSS (container queries, :has(), etc.)
22
+ ├── Utility-first OR Component-based (not mixed)
23
+ └── PostCSS for processing (autoprefixer, nesting)
24
+
25
+ RECOMMENDED STACK
26
+ ├── Plain CSS with custom properties
27
+ ├── Tailwind CSS (for rapid prototyping)
28
+ ├── CSS Modules (for React/Vue scoping)
29
+ └── Vanilla Extract (for type-safe CSS-in-JS)
30
+ ```
31
+
32
+ ### JavaScript Standards
33
+
34
+ ```javascript
35
+ // Modern JS features to use freely
36
+ const features = {
37
+ modules: true, // ES Modules
38
+ asyncAwait: true, // Async/await
39
+ optionalChaining: true, // obj?.prop
40
+ nullishCoalescing: true, // value ?? default
41
+ destructuring: true, // const { a, b } = obj
42
+ spreadOperator: true, // [...arr, newItem]
43
+ templateLiterals: true, // `${var}`
44
+ arrowFunctions: true, // () => {}
45
+ };
46
+
47
+ // Avoid
48
+ const avoid = {
49
+ var: true, // Use const/let
50
+ callbacks: 'Use promises/async',
51
+ jquery: 'Use native APIs',
52
+ };
53
+ ```
54
+
55
+ ---
56
+
57
+ ## 2. Animation Libraries
58
+
59
+ ### GSAP (GreenSock)
60
+
61
+ ```
62
+ THE INDUSTRY STANDARD
63
+ ├── Power: Most capable animation library
64
+ ├── Performance: Optimized for 60fps
65
+ ├── Ecosystem: ScrollTrigger, SplitText, MorphSVG
66
+ └── License: Free for most uses, paid for some plugins
67
+
68
+ INSTALLATION
69
+ npm install gsap
70
+
71
+ CORE PLUGINS (free)
72
+ ├── ScrollTrigger - scroll-based animations
73
+ ├── Observer - scroll/touch/pointer tracking
74
+ ├── Draggable - drag interactions
75
+ └── MotionPath - animate along SVG paths
76
+
77
+ CLUB PLUGINS (paid)
78
+ ├── SplitText - text splitting for animation
79
+ ├── MorphSVG - shape morphing
80
+ ├── DrawSVG - line drawing effects
81
+ ├── ScrollSmoother - smooth scroll + ScrollTrigger
82
+ └── Flip - layout animations
83
+ ```
84
+
85
+ ```javascript
86
+ // GSAP initialization pattern
87
+ import { gsap } from "gsap";
88
+ import { ScrollTrigger } from "gsap/ScrollTrigger";
89
+
90
+ gsap.registerPlugin(ScrollTrigger);
91
+
92
+ // Set defaults
93
+ gsap.defaults({
94
+ ease: "expo.out",
95
+ duration: 1
96
+ });
97
+
98
+ // Basic animation
99
+ gsap.to(".element", {
100
+ x: 100,
101
+ opacity: 1,
102
+ duration: 0.8
103
+ });
104
+
105
+ // Timeline
106
+ const tl = gsap.timeline();
107
+ tl.to(".first", { x: 100 })
108
+ .to(".second", { x: 100 }, "-=0.5") // overlap
109
+ .to(".third", { x: 100 }, "+=0.2"); // gap
110
+ ```
111
+
112
+ ### Motion (Framer Motion)
113
+
114
+ ```
115
+ REACT-SPECIFIC
116
+ ├── Declarative API
117
+ ├── Layout animations
118
+ ├── Gesture support
119
+ ├── Exit animations
120
+ └── Server-side rendering support
121
+
122
+ INSTALLATION
123
+ npm install motion
124
+ ```
125
+
126
+ ```jsx
127
+ // Motion usage
128
+ import { motion, AnimatePresence } from "motion/react";
129
+
130
+ // Basic animation
131
+ <motion.div
132
+ initial={{ opacity: 0, y: 20 }}
133
+ animate={{ opacity: 1, y: 0 }}
134
+ exit={{ opacity: 0 }}
135
+ transition={{ duration: 0.6, ease: [0.16, 1, 0.3, 1] }}
136
+ >
137
+ Content
138
+ </motion.div>
139
+
140
+ // Scroll-triggered
141
+ <motion.div
142
+ initial={{ opacity: 0 }}
143
+ whileInView={{ opacity: 1 }}
144
+ viewport={{ once: true, margin: "-100px" }}
145
+ >
146
+ Reveals on scroll
147
+ </motion.div>
148
+
149
+ // Layout animation
150
+ <motion.div layout>
151
+ {/* Animates when layout changes */}
152
+ </motion.div>
153
+ ```
154
+
155
+ ### Anime.js
156
+
157
+ ```
158
+ LIGHTWEIGHT ALTERNATIVE
159
+ ├── Size: ~17KB minified
160
+ ├── SVG morphing included
161
+ ├── Timeline support
162
+ └── Good for simpler projects
163
+
164
+ INSTALLATION
165
+ npm install animejs
166
+ ```
167
+
168
+ ```javascript
169
+ import anime from 'animejs';
170
+
171
+ anime({
172
+ targets: '.element',
173
+ translateX: 250,
174
+ rotate: '1turn',
175
+ duration: 800,
176
+ easing: 'easeOutExpo'
177
+ });
178
+
179
+ // Stagger
180
+ anime({
181
+ targets: '.grid-item',
182
+ translateY: [50, 0],
183
+ opacity: [0, 1],
184
+ delay: anime.stagger(100)
185
+ });
186
+ ```
187
+
188
+ ---
189
+
190
+ ## 3. Smooth Scrolling Solutions
191
+
192
+ ### Lenis (Recommended)
193
+
194
+ ```
195
+ MODERN & LIGHTWEIGHT
196
+ ├── Size: ~4KB gzipped
197
+ ├── Native scroll (accessibility preserved)
198
+ ├── GSAP integration
199
+ ├── Performant
200
+ └── Actively maintained by Studio Freight
201
+
202
+ INSTALLATION
203
+ npm install lenis
204
+ ```
205
+
206
+ ```javascript
207
+ import Lenis from 'lenis';
208
+
209
+ const lenis = new Lenis({
210
+ duration: 1.2,
211
+ easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
212
+ orientation: 'vertical',
213
+ gestureOrientation: 'vertical',
214
+ smoothWheel: true,
215
+ wheelMultiplier: 1,
216
+ touchMultiplier: 2,
217
+ infinite: false,
218
+ });
219
+
220
+ function raf(time) {
221
+ lenis.raf(time);
222
+ requestAnimationFrame(raf);
223
+ }
224
+
225
+ requestAnimationFrame(raf);
226
+
227
+ // GSAP integration
228
+ import { gsap } from 'gsap';
229
+ import { ScrollTrigger } from 'gsap/ScrollTrigger';
230
+
231
+ lenis.on('scroll', ScrollTrigger.update);
232
+
233
+ gsap.ticker.add((time) => {
234
+ lenis.raf(time * 1000);
235
+ });
236
+
237
+ gsap.ticker.lagSmoothing(0);
238
+ ```
239
+
240
+ ### Locomotive Scroll
241
+
242
+ ```
243
+ FEATURE-RICH
244
+ ├── Smooth scrolling
245
+ ├── Parallax effects built-in
246
+ ├── Data attributes for quick setup
247
+ ├── Horizontal scroll support
248
+ └── Heavier than Lenis
249
+
250
+ INSTALLATION
251
+ npm install locomotive-scroll
252
+ ```
253
+
254
+ ```javascript
255
+ import LocomotiveScroll from 'locomotive-scroll';
256
+
257
+ const scroll = new LocomotiveScroll({
258
+ el: document.querySelector('[data-scroll-container]'),
259
+ smooth: true,
260
+ multiplier: 1,
261
+ lerp: 0.1
262
+ });
263
+
264
+ // Data attribute usage
265
+ // <div data-scroll data-scroll-speed="2">Parallax element</div>
266
+ ```
267
+
268
+ ---
269
+
270
+ ## 4. 3D & WebGL
271
+
272
+ ### Three.js
273
+
274
+ ```
275
+ FULL 3D CAPABILITY
276
+ ├── Complete 3D engine
277
+ ├── Large ecosystem
278
+ ├── Extensive documentation
279
+ └── Performance-intensive
280
+
281
+ INSTALLATION
282
+ npm install three
283
+ ```
284
+
285
+ ```javascript
286
+ import * as THREE from 'three';
287
+
288
+ // Basic scene setup
289
+ const scene = new THREE.Scene();
290
+ const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
291
+ const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
292
+
293
+ renderer.setSize(window.innerWidth, window.innerHeight);
294
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
295
+ document.body.appendChild(renderer.domElement);
296
+
297
+ // Animation loop
298
+ function animate() {
299
+ requestAnimationFrame(animate);
300
+ renderer.render(scene, camera);
301
+ }
302
+ animate();
303
+ ```
304
+
305
+ ### React Three Fiber
306
+
307
+ ```
308
+ THREE.JS FOR REACT
309
+ ├── Declarative Three.js
310
+ ├── React ecosystem integration
311
+ ├── Easier state management
312
+ └── Drei helpers library
313
+
314
+ INSTALLATION
315
+ npm install @react-three/fiber @react-three/drei
316
+ ```
317
+
318
+ ```jsx
319
+ import { Canvas } from '@react-three/fiber';
320
+ import { OrbitControls, Environment } from '@react-three/drei';
321
+
322
+ function Scene() {
323
+ return (
324
+ <Canvas>
325
+ <ambientLight intensity={0.5} />
326
+ <mesh>
327
+ <boxGeometry />
328
+ <meshStandardMaterial color="orange" />
329
+ </mesh>
330
+ <OrbitControls />
331
+ <Environment preset="city" />
332
+ </Canvas>
333
+ );
334
+ }
335
+ ```
336
+
337
+ ### OGL
338
+
339
+ ```
340
+ LIGHTWEIGHT WEBGL
341
+ ├── Size: ~30KB
342
+ ├── Lower-level than Three.js
343
+ ├── Better for simple effects
344
+ └── Less overhead
345
+
346
+ INSTALLATION
347
+ npm install ogl
348
+ ```
349
+
350
+ ---
351
+
352
+ ## 5. Build Tools & Frameworks
353
+
354
+ ### Vite (Recommended for Simple Sites)
355
+
356
+ ```
357
+ FAST BUILD TOOL
358
+ ├── Instant dev server
359
+ ├── Native ES modules
360
+ ├── Optimized production builds
361
+ └── Framework agnostic
362
+
363
+ SETUP
364
+ npm create vite@latest
365
+ ```
366
+
367
+ ### Next.js (React Apps)
368
+
369
+ ```
370
+ REACT FRAMEWORK
371
+ ├── Server-side rendering
372
+ ├── Static site generation
373
+ ├── API routes
374
+ ├── Image optimization
375
+ └── File-based routing
376
+
377
+ SETUP
378
+ npx create-next-app@latest
379
+ ```
380
+
381
+ ### Astro (Content Sites)
382
+
383
+ ```
384
+ CONTENT-FOCUSED
385
+ ├── Zero JS by default
386
+ ├── Partial hydration
387
+ ├── Any framework components
388
+ ├── Excellent performance
389
+ └── Great for portfolios/marketing
390
+
391
+ SETUP
392
+ npm create astro@latest
393
+ ```
394
+
395
+ ### Nuxt (Vue Apps)
396
+
397
+ ```
398
+ VUE FRAMEWORK
399
+ ├── SSR/SSG
400
+ ├── Auto-imports
401
+ ├── File-based routing
402
+ └── Excellent DX
403
+
404
+ SETUP
405
+ npx nuxi@latest init
406
+ ```
407
+
408
+ ---
409
+
410
+ ## 6. Performance Optimization
411
+
412
+ ### Image Optimization
413
+
414
+ ```
415
+ FORMATS
416
+ ├── WebP: Primary format, 25-35% smaller than JPEG
417
+ ├── AVIF: Best compression, growing support
418
+ ├── SVG: Icons, logos, illustrations
419
+ └── JPEG/PNG: Fallbacks only
420
+
421
+ TOOLS
422
+ ├── Sharp (Node.js): npm install sharp
423
+ ├── Squoosh: squoosh.app (browser-based)
424
+ ├── ImageOptim: Desktop app (Mac)
425
+ └── SVGO: SVG optimization
426
+
427
+ RESPONSIVE IMAGES
428
+ <picture>
429
+ <source srcset="image.avif" type="image/avif">
430
+ <source srcset="image.webp" type="image/webp">
431
+ <img src="image.jpg" alt="Description" loading="lazy">
432
+ </picture>
433
+
434
+ SRCSET FOR RESOLUTION
435
+ <img
436
+ srcset="image-400.webp 400w, image-800.webp 800w, image-1200.webp 1200w"
437
+ sizes="(max-width: 600px) 400px, (max-width: 1200px) 800px, 1200px"
438
+ src="image-800.webp"
439
+ alt="Description"
440
+ loading="lazy"
441
+ >
442
+ ```
443
+
444
+ ### Font Optimization
445
+
446
+ ```html
447
+ <!-- Preload critical fonts -->
448
+ <link rel="preload" href="/fonts/display.woff2" as="font" type="font/woff2" crossorigin>
449
+
450
+ <!-- Font-display strategy -->
451
+ <style>
452
+ @font-face {
453
+ font-family: 'Display';
454
+ src: url('/fonts/display.woff2') format('woff2');
455
+ font-display: swap; /* or optional for non-critical */
456
+ unicode-range: U+0000-00FF; /* Subset to Latin */
457
+ }
458
+ </style>
459
+ ```
460
+
461
+ ### Code Splitting
462
+
463
+ ```javascript
464
+ // Dynamic imports
465
+ const HeavyComponent = lazy(() => import('./HeavyComponent'));
466
+
467
+ // Route-based splitting (Next.js automatic)
468
+ // Each page is a separate chunk
469
+
470
+ // Manual chunk with Vite
471
+ // vite.config.js
472
+ export default {
473
+ build: {
474
+ rollupOptions: {
475
+ output: {
476
+ manualChunks: {
477
+ vendor: ['gsap', 'three'],
478
+ },
479
+ },
480
+ },
481
+ },
482
+ };
483
+ ```
484
+
485
+ ### Critical CSS
486
+
487
+ ```javascript
488
+ // Extract critical CSS with Critters (Vite plugin)
489
+ // npm install critters
490
+ import critters from 'critters';
491
+
492
+ // Or inline critical styles manually
493
+ <style>
494
+ /* Above-the-fold styles inlined */
495
+ </style>
496
+ <link rel="preload" href="/styles.css" as="style" onload="this.rel='stylesheet'">
497
+ ```
498
+
499
+ ---
500
+
501
+ ## 7. Deployment & Hosting
502
+
503
+ ### Recommended Platforms
504
+
505
+ ```
506
+ STATIC SITES
507
+ ├── Vercel: Best for Next.js, excellent DX
508
+ ├── Netlify: Great for Jamstack, easy deploys
509
+ ├── Cloudflare Pages: Fast edge network
510
+ └── GitHub Pages: Free, simple static hosting
511
+
512
+ FULL-STACK
513
+ ├── Vercel: Serverless functions, edge middleware
514
+ ├── Railway: Containers, databases
515
+ ├── Render: Full infrastructure
516
+ └── AWS Amplify: AWS ecosystem
517
+
518
+ CDN FOR ASSETS
519
+ ├── Cloudflare: Free tier, global
520
+ ├── AWS CloudFront: Enterprise scale
521
+ ├── Bunny CDN: Cost-effective, fast
522
+ └── Imgix/Cloudinary: Image-specific CDN
523
+ ```
524
+
525
+ ### Performance Checklist
526
+
527
+ ```
528
+ PRE-LAUNCH
529
+ □ Images optimized (WebP/AVIF, lazy loaded)
530
+ □ Fonts subset and preloaded
531
+ □ CSS/JS minified and compressed
532
+ □ Gzip/Brotli compression enabled
533
+ □ HTTP/2 or HTTP/3 enabled
534
+ □ Cache headers configured
535
+ □ Critical CSS inlined
536
+ □ Unused CSS/JS removed
537
+
538
+ MONITORING
539
+ □ Lighthouse CI in deployment
540
+ □ Core Web Vitals tracking
541
+ □ Real User Monitoring (RUM)
542
+ □ Error tracking (Sentry, etc.)
543
+ ```
@@ -0,0 +1,60 @@
1
+ # Theming & Dark Mode
2
+
3
+ Dark mode is a second design, not a filter. Inverting the light palette produces the classic giveaways: vibrating pure-white text, shadows that read as stains, and accents that glow radioactive. This file is the implementation doctrine; the colour fundamentals (contrast numbers, semantic tokens, one accent) are in [craft.md](craft.md).
4
+
5
+ ## Architecture: switch at the token layer, nowhere else
6
+
7
+ Components never know which theme is active. They consume semantic tokens; the theme swaps the values.
8
+
9
+ ```css
10
+ :root {
11
+ color-scheme: light dark; /* native controls, scrollbars, form widgets follow */
12
+ --bg: #fafaf9;
13
+ --surface: #ffffff;
14
+ --text: #1c1917;
15
+ --text-muted: color-mix(in oklch, var(--text) 62%, transparent);
16
+ --border: rgb(0 0 0 / 0.1);
17
+ --accent: #e5484d;
18
+ }
19
+
20
+ [data-theme='dark'] {
21
+ --bg: #0d0d0c;
22
+ --surface: #1a1a19; /* elevation = LIGHTER surface, not shadow */
23
+ --text: #ededec; /* never #fff on near-black — it vibrates */
24
+ --border: rgb(255 255 255 / 0.12);
25
+ --accent: #e5757a; /* accents desaturate/lighten a step in dark */
26
+ }
27
+ ```
28
+
29
+ Three rules that follow from the architecture:
30
+
31
+ - **A component containing a raw hex is a theming bug** even if it looks right today — it is the surface that will be wrong in the other theme.
32
+ - **Two layers of tokens maximum**: primitive scales (`--gray-1..12`, optional) feeding semantic roles (`--bg`, `--surface`, `--text`, `--border`, `--danger`). Components touch only the semantic layer. Radix Colors ships this structure pre-solved, including contrast-checked pairs.
33
+ - **State variants derive, not invent**: hover/pressed come from `color-mix()` on the base token, so they track theme changes for free.
34
+
35
+ ## The three-state toggle, and no flash
36
+
37
+ Theme preference is a **three-state** choice — system / light / dark — and "system" is the default. A two-state toggle that ignores the OS setting fights the user's whole device.
38
+
39
+ - Store the *choice* (`system|light|dark`), resolve it to a theme at runtime, and re-resolve when `matchMedia('(prefers-color-scheme: dark)')` fires — a user's OS switching at sunset should carry the app with it.
40
+ - **Kill the flash of wrong theme**: the stored choice must be applied before first paint — an inline `<script>` in `<head>` that sets `data-theme` from `localStorage`, or a server cookie. In Next.js, `next-themes` does exactly this; don't hand-roll it there (see [libraries.md](libraries.md)).
41
+ - The toggle itself is a 100+/day-class control for people who use it and a rare one for everyone else: no animation on the swap beyond an instant repaint, or at most a ~150ms opacity ease. Theme-transition "wipes" are a marketing-page trick, not app UI.
42
+
43
+ ## What actually changes in dark
44
+
45
+ | Light habit | Dark replacement | Why |
46
+ |---|---|---|
47
+ | Elevation via `box-shadow` | Lighter surface per level, hairline border, at most a faint shadow | Shadows need light to read; on dark they read as dirt |
48
+ | `#000` text on `#fff` | `#ededec`-ish on `#0d0d0c`-ish | Pure pairs vibrate and cause halation |
49
+ | Saturated brand accent | Same hue, lighter and slightly desaturated | Saturated colors fluoresce on dark and fail contrast |
50
+ | Full-color imagery as-is | `filter: brightness(.9)` on large media, or dark-specific assets | A white-background photo becomes a flashlight |
51
+ | Colored text for emphasis | Weight/size for emphasis, color only for semantics | Colored text loses contrast fastest on dark |
52
+ | One border color everywhere | Border tokens per theme (light: black-alpha, dark: white-alpha) | An opaque gray border correct in light glows in dark |
53
+
54
+ Contrast still measures 4.5:1 for body text in both themes — dark mode changes the numbers you need, not the requirement. Test the dark palette at low screen brightness; that is where muted-on-dark combinations collapse.
55
+
56
+ `prefers-contrast: more` and `prefers-reduced-transparency: reduce` are the two companion queries: near-solid backgrounds with defined borders for the first, frostier/opaque surfaces (drop the `backdrop-filter`) for the second. Details for translucent materials live in [apple-fluid.md](apple-fluid.md) §12.
57
+
58
+ ## Beyond light/dark
59
+
60
+ The same token architecture carries brand themes, high-contrast themes, and density modes for free — each is just another value set for the same semantic roles. If a second brand palette is ever plausible, that is one more reason no component may hold a raw value. Charts and data-viz need their own token ramp (`--chart-1..n`) chosen for distinguishability in *both* themes — the default rainbow fails in dark first.