@thanhnguyxn/pixelcraft 0.0.0-stage → 0.2.0

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 (455) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.antigravity-plugin/plugin.json +32 -0
  3. package/.claude-plugin/marketplace.json +20 -0
  4. package/.claude-plugin/plugin.json +22 -0
  5. package/.codex-plugin/plugin.json +45 -0
  6. package/.cursor-plugin/marketplace.json +17 -0
  7. package/.cursor-plugin/plugin.json +27 -0
  8. package/.devin-plugin/plugin.json +21 -0
  9. package/.github/plugin/marketplace.json +34 -0
  10. package/CHANGELOG.md +159 -0
  11. package/GEMINI.md +1 -0
  12. package/LICENSE +21 -0
  13. package/README.md +264 -2
  14. package/SECURITY.md +28 -0
  15. package/assets/README.md +28 -0
  16. package/assets/pixelcraft-logo-128.png +0 -0
  17. package/assets/pixelcraft-logo-256.png +0 -0
  18. package/assets/pixelcraft-logo-512.png +0 -0
  19. package/bin/pixelcraft.mjs +852 -0
  20. package/docs/ARCHITECTURE.md +105 -0
  21. package/docs/DESIGN-RATIONALE.md +191 -0
  22. package/docs/INSTALL.md +221 -0
  23. package/evals/README.md +37 -0
  24. package/evals/fixtures/3d-web-engineering.json +69 -0
  25. package/evals/fixtures/README.md +36 -0
  26. package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
  27. package/evals/fixtures/ai-ui-libraries.json +53 -0
  28. package/evals/fixtures/audio-visual-accessibility.json +69 -0
  29. package/evals/fixtures/auth-and-checkout-ui.json +53 -0
  30. package/evals/fixtures/brandkit-identity-governance.json +48 -0
  31. package/evals/fixtures/build-and-architecture.json +53 -0
  32. package/evals/fixtures/canvas-and-node-editors.json +53 -0
  33. package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
  34. package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
  35. package/evals/fixtures/component-systems.json +53 -0
  36. package/evals/fixtures/component-testing.json +53 -0
  37. package/evals/fixtures/constrained-voice-and-tv.json +43 -0
  38. package/evals/fixtures/creative-code-rendering.json +69 -0
  39. package/evals/fixtures/creative-reference-evidence.json +67 -0
  40. package/evals/fixtures/data-app-python-marimo.json +49 -0
  41. package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
  42. package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
  43. package/evals/fixtures/desktop-native-workspace.json +48 -0
  44. package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
  45. package/evals/fixtures/direction-prototype-complexity.json +29 -0
  46. package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
  47. package/evals/fixtures/document-rust-typst-invoice.json +49 -0
  48. package/evals/fixtures/document-typst-and-print-css.json +43 -0
  49. package/evals/fixtures/email-mjml-dark-mode.json +49 -0
  50. package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
  51. package/evals/fixtures/enterprise-data-ui.json +53 -0
  52. package/evals/fixtures/extended-tui-toolkits.json +53 -0
  53. package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
  54. package/evals/fixtures/file-upload-media-ui.json +53 -0
  55. package/evals/fixtures/finish-gate-anti-slop.json +30 -0
  56. package/evals/fixtures/forms-accessibility-negative.json +29 -0
  57. package/evals/fixtures/forms-validation.json +53 -0
  58. package/evals/fixtures/game-go-ebitengine.json +49 -0
  59. package/evals/fixtures/game-godot-gdscript.json +49 -0
  60. package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
  61. package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
  62. package/evals/fixtures/i18n-engineering.json +53 -0
  63. package/evals/fixtures/local-first-sync.json +53 -0
  64. package/evals/fixtures/lynxjs.json +53 -0
  65. package/evals/fixtures/maizzle-email.json +53 -0
  66. package/evals/fixtures/maps-geospatial.json +53 -0
  67. package/evals/fixtures/media-og-and-video-export.json +43 -0
  68. package/evals/fixtures/media-players.json +53 -0
  69. package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
  70. package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
  71. package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
  72. package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
  73. package/evals/fixtures/mobile-jetpack-compose.json +49 -0
  74. package/evals/fixtures/mobile-swiftui-ios.json +49 -0
  75. package/evals/fixtures/motion-engineering.json +69 -0
  76. package/evals/fixtures/pdfjs-and-pptx.json +53 -0
  77. package/evals/fixtures/plan-brownfield-evidence.json +28 -0
  78. package/evals/fixtures/plan-discovery-interview.json +31 -0
  79. package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
  80. package/evals/fixtures/reactive-data-apps.json +53 -0
  81. package/evals/fixtures/review-evidence-audit.json +43 -0
  82. package/evals/fixtures/rich-text-and-code-editors.json +53 -0
  83. package/evals/fixtures/scrollytelling-resilience.json +70 -0
  84. package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
  85. package/evals/fixtures/state-architecture.json +53 -0
  86. package/evals/fixtures/styling-ecosystem.json +53 -0
  87. package/evals/fixtures/token-tooling.json +53 -0
  88. package/evals/fixtures/tui-go-bubbletea.json +49 -0
  89. package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
  90. package/evals/fixtures/tui-rust-ratatui.json +49 -0
  91. package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
  92. package/evals/fixtures/visual-qa-task-evidence.json +29 -0
  93. package/evals/fixtures/web-3d-engines.json +53 -0
  94. package/evals/fixtures/web-php-laravel-filament.json +49 -0
  95. package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
  96. package/evals/fixtures/workflow-checkpoints.json +30 -0
  97. package/evals/pixelcraft-accessibility.md +74 -0
  98. package/evals/pixelcraft-brandkit.md +58 -0
  99. package/evals/pixelcraft-chat-ui.md +55 -0
  100. package/evals/pixelcraft-constrained.md +55 -0
  101. package/evals/pixelcraft-craft.md +76 -0
  102. package/evals/pixelcraft-data-apps.md +55 -0
  103. package/evals/pixelcraft-dataviz.md +59 -0
  104. package/evals/pixelcraft-desktop.md +55 -0
  105. package/evals/pixelcraft-direction.md +77 -0
  106. package/evals/pixelcraft-document.md +55 -0
  107. package/evals/pixelcraft-email.md +55 -0
  108. package/evals/pixelcraft-extensions.md +55 -0
  109. package/evals/pixelcraft-game-ui.md +59 -0
  110. package/evals/pixelcraft-handoff.md +57 -0
  111. package/evals/pixelcraft-media.md +55 -0
  112. package/evals/pixelcraft-mobile.md +59 -0
  113. package/evals/pixelcraft-patterns.md +73 -0
  114. package/evals/pixelcraft-plan.md +127 -0
  115. package/evals/pixelcraft-review.md +63 -0
  116. package/evals/pixelcraft-spatial.md +55 -0
  117. package/evals/pixelcraft-tokens.md +57 -0
  118. package/evals/pixelcraft-tui.md +55 -0
  119. package/evals/pixelcraft-ux.md +59 -0
  120. package/evals/pixelcraft-visual-qa.md +86 -0
  121. package/evals/pixelcraft-web.md +89 -0
  122. package/evals/pixelcraft.md +70 -0
  123. package/gemini-extension.json +6 -0
  124. package/install.ps1 +341 -0
  125. package/install.sh +512 -0
  126. package/package.json +91 -4
  127. package/plugin.json +29 -0
  128. package/scripts/build-adapters.mjs +288 -0
  129. package/scripts/build-release-archives.mjs +61 -0
  130. package/scripts/build-skill-zips.mjs +94 -0
  131. package/scripts/run-evals.mjs +397 -0
  132. package/scripts/sync-docs.mjs +381 -0
  133. package/scripts/test-build-adapters.mjs +61 -0
  134. package/scripts/test-cross-platform-qa.mjs +359 -0
  135. package/scripts/test-distribution.mjs +203 -0
  136. package/scripts/test-export-tokens.mjs +361 -0
  137. package/scripts/test-finish-gate.mjs +271 -0
  138. package/scripts/test-installers.mjs +216 -0
  139. package/scripts/test-release-archives.mjs +42 -0
  140. package/scripts/test-shoot.mjs +87 -0
  141. package/scripts/test-slop-scan.mjs +416 -0
  142. package/scripts/test-style-inventory.mjs +234 -0
  143. package/scripts/test-sync-docs.mjs +140 -0
  144. package/scripts/test-validate-skills.mjs +195 -0
  145. package/scripts/validate-skills.mjs +658 -0
  146. package/skills/pixelcraft/SKILL.md +155 -0
  147. package/skills/pixelcraft/references/design-brief.md +75 -0
  148. package/skills/pixelcraft/references/floor.md +90 -0
  149. package/skills/pixelcraft/references/report-template.md +49 -0
  150. package/skills/pixelcraft/references/stack-detection.md +226 -0
  151. package/skills/pixelcraft/references/surface-acceptance.md +52 -0
  152. package/skills/pixelcraft/references/workflow-checkpoints.md +71 -0
  153. package/skills/pixelcraft-accessibility/SKILL.md +54 -0
  154. package/skills/pixelcraft-accessibility/references/apg-patterns.md +64 -0
  155. package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
  156. package/skills/pixelcraft-accessibility/references/platforms.md +86 -0
  157. package/skills/pixelcraft-accessibility/references/verification.md +64 -0
  158. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +99 -0
  159. package/skills/pixelcraft-brandkit/SKILL.md +127 -0
  160. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +165 -0
  161. package/skills/pixelcraft-brandkit/references/brand-governance.md +82 -0
  162. package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
  163. package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
  164. package/skills/pixelcraft-brandkit/references/logo-methods.md +97 -0
  165. package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
  166. package/skills/pixelcraft-brandkit/references/prompt-template.md +87 -0
  167. package/skills/pixelcraft-brandkit/references/qa-checklist.md +93 -0
  168. package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
  169. package/skills/pixelcraft-chat-ui/SKILL.md +57 -0
  170. package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
  171. package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
  172. package/skills/pixelcraft-chat-ui/references/conversation-design.md +84 -0
  173. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +77 -0
  174. package/skills/pixelcraft-chat-ui/references/slack-discord.md +80 -0
  175. package/skills/pixelcraft-constrained/SKILL.md +52 -0
  176. package/skills/pixelcraft-constrained/references/specialized-hardware.md +90 -0
  177. package/skills/pixelcraft-constrained/references/tv-wearables.md +134 -0
  178. package/skills/pixelcraft-constrained/references/voice-ui.md +104 -0
  179. package/skills/pixelcraft-craft/SKILL.md +58 -0
  180. package/skills/pixelcraft-craft/references/color.md +125 -0
  181. package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
  182. package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
  183. package/skills/pixelcraft-craft/references/layout.md +73 -0
  184. package/skills/pixelcraft-craft/references/motion.md +163 -0
  185. package/skills/pixelcraft-craft/references/typography.md +110 -0
  186. package/skills/pixelcraft-data-apps/SKILL.md +86 -0
  187. package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
  188. package/skills/pixelcraft-data-apps/references/dash.md +109 -0
  189. package/skills/pixelcraft-data-apps/references/evidence.md +90 -0
  190. package/skills/pixelcraft-data-apps/references/gradio.md +103 -0
  191. package/skills/pixelcraft-data-apps/references/julia-genie.md +89 -0
  192. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +91 -0
  193. package/skills/pixelcraft-data-apps/references/nicegui.md +102 -0
  194. package/skills/pixelcraft-data-apps/references/observable-framework.md +105 -0
  195. package/skills/pixelcraft-data-apps/references/panel.md +99 -0
  196. package/skills/pixelcraft-data-apps/references/r-shiny.md +124 -0
  197. package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
  198. package/skills/pixelcraft-data-apps/references/reflex.md +116 -0
  199. package/skills/pixelcraft-data-apps/references/shiny.md +110 -0
  200. package/skills/pixelcraft-data-apps/references/streamlit.md +113 -0
  201. package/skills/pixelcraft-dataviz/SKILL.md +60 -0
  202. package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
  203. package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
  204. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +107 -0
  205. package/skills/pixelcraft-dataviz/references/libraries.md +176 -0
  206. package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
  207. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +92 -0
  208. package/skills/pixelcraft-desktop/SKILL.md +93 -0
  209. package/skills/pixelcraft-desktop/references/appkit.md +92 -0
  210. package/skills/pixelcraft-desktop/references/avalonia.md +95 -0
  211. package/skills/pixelcraft-desktop/references/cpp-gui.md +129 -0
  212. package/skills/pixelcraft-desktop/references/electron.md +96 -0
  213. package/skills/pixelcraft-desktop/references/go-gui.md +83 -0
  214. package/skills/pixelcraft-desktop/references/gtk.md +97 -0
  215. package/skills/pixelcraft-desktop/references/javafx-swing.md +81 -0
  216. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +88 -0
  217. package/skills/pixelcraft-desktop/references/rust-gui.md +83 -0
  218. package/skills/pixelcraft-desktop/references/tauri.md +110 -0
  219. package/skills/pixelcraft-desktop/references/uno-platform.md +71 -0
  220. package/skills/pixelcraft-desktop/references/winui-wpf.md +98 -0
  221. package/skills/pixelcraft-desktop/references/working-context.md +84 -0
  222. package/skills/pixelcraft-direction/SKILL.md +120 -0
  223. package/skills/pixelcraft-direction/references/composition-library.md +84 -0
  224. package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
  225. package/skills/pixelcraft-direction/references/direction-card.md +64 -0
  226. package/skills/pixelcraft-direction/references/direction-scoring.md +76 -0
  227. package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
  228. package/skills/pixelcraft-direction/references/movements.md +71 -0
  229. package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
  230. package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
  231. package/skills/pixelcraft-direction/references/slop-fingerprints.md +83 -0
  232. package/skills/pixelcraft-direction/references/wildcards.md +47 -0
  233. package/skills/pixelcraft-document/SKILL.md +58 -0
  234. package/skills/pixelcraft-document/references/archetypes.md +106 -0
  235. package/skills/pixelcraft-document/references/pdf-tools.md +314 -0
  236. package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
  237. package/skills/pixelcraft-document/references/print-css.md +187 -0
  238. package/skills/pixelcraft-document/references/slides.md +198 -0
  239. package/skills/pixelcraft-email/SKILL.md +80 -0
  240. package/skills/pixelcraft-email/references/client-quirks.md +113 -0
  241. package/skills/pixelcraft-email/references/html-tables.md +114 -0
  242. package/skills/pixelcraft-email/references/maizzle.md +54 -0
  243. package/skills/pixelcraft-email/references/mjml.md +54 -0
  244. package/skills/pixelcraft-email/references/react-email.md +95 -0
  245. package/skills/pixelcraft-extensions/SKILL.md +56 -0
  246. package/skills/pixelcraft-extensions/references/browser-extensions.md +105 -0
  247. package/skills/pixelcraft-extensions/references/figma-office.md +106 -0
  248. package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
  249. package/skills/pixelcraft-extensions/references/raycast.md +98 -0
  250. package/skills/pixelcraft-extensions/references/vscode-webviews.md +100 -0
  251. package/skills/pixelcraft-game-ui/SKILL.md +80 -0
  252. package/skills/pixelcraft-game-ui/references/bevy.md +90 -0
  253. package/skills/pixelcraft-game-ui/references/godot.md +130 -0
  254. package/skills/pixelcraft-game-ui/references/hud-principles.md +67 -0
  255. package/skills/pixelcraft-game-ui/references/love2d.md +77 -0
  256. package/skills/pixelcraft-game-ui/references/monogame.md +68 -0
  257. package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
  258. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +107 -0
  259. package/skills/pixelcraft-game-ui/references/unreal-umg.md +80 -0
  260. package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
  261. package/skills/pixelcraft-handoff/SKILL.md +50 -0
  262. package/skills/pixelcraft-handoff/references/design-translation.md +134 -0
  263. package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
  264. package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
  265. package/skills/pixelcraft-media/SKILL.md +49 -0
  266. package/skills/pixelcraft-media/references/banners-video.md +130 -0
  267. package/skills/pixelcraft-media/references/og-generation.md +154 -0
  268. package/skills/pixelcraft-media/references/social-cards.md +71 -0
  269. package/skills/pixelcraft-mobile/SKILL.md +86 -0
  270. package/skills/pixelcraft-mobile/references/dotnet-maui.md +91 -0
  271. package/skills/pixelcraft-mobile/references/flet.md +80 -0
  272. package/skills/pixelcraft-mobile/references/flutter.md +113 -0
  273. package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
  274. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +87 -0
  275. package/skills/pixelcraft-mobile/references/jetpack-compose.md +129 -0
  276. package/skills/pixelcraft-mobile/references/kivy.md +82 -0
  277. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +86 -0
  278. package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
  279. package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
  280. package/skills/pixelcraft-mobile/references/react-native-expo.md +106 -0
  281. package/skills/pixelcraft-mobile/references/swiftui.md +200 -0
  282. package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
  283. package/skills/pixelcraft-mobile/references/task-state-composition.md +85 -0
  284. package/skills/pixelcraft-mobile/references/uikit.md +92 -0
  285. package/skills/pixelcraft-patterns/SKILL.md +75 -0
  286. package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
  287. package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
  288. package/skills/pixelcraft-patterns/references/auth-onboarding.md +44 -0
  289. package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
  290. package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
  291. package/skills/pixelcraft-patterns/references/commerce.md +47 -0
  292. package/skills/pixelcraft-patterns/references/communication.md +45 -0
  293. package/skills/pixelcraft-patterns/references/creative-tools.md +42 -0
  294. package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
  295. package/skills/pixelcraft-patterns/references/dashboard-admin.md +35 -0
  296. package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
  297. package/skills/pixelcraft-patterns/references/marketing.md +44 -0
  298. package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
  299. package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
  300. package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
  301. package/skills/pixelcraft-patterns/references/pattern-selection.md +80 -0
  302. package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
  303. package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
  304. package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
  305. package/skills/pixelcraft-patterns/references/settings.md +51 -0
  306. package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
  307. package/skills/pixelcraft-plan/SKILL.md +103 -0
  308. package/skills/pixelcraft-plan/references/design-input.md +69 -0
  309. package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
  310. package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
  311. package/skills/pixelcraft-plan/references/plan-template.md +134 -0
  312. package/skills/pixelcraft-plan/references/repo-discovery.md +49 -0
  313. package/skills/pixelcraft-plan/references/stack-freshness.md +67 -0
  314. package/skills/pixelcraft-plan/references/stack-selection.md +98 -0
  315. package/skills/pixelcraft-review/SKILL.md +86 -0
  316. package/skills/pixelcraft-review/references/audit-report.md +69 -0
  317. package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
  318. package/skills/pixelcraft-review/references/heuristics.md +63 -0
  319. package/skills/pixelcraft-review/references/personas.md +53 -0
  320. package/skills/pixelcraft-review/references/polish.md +78 -0
  321. package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
  322. package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
  323. package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
  324. package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
  325. package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
  326. package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
  327. package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
  328. package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
  329. package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
  330. package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
  331. package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
  332. package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
  333. package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
  334. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
  335. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
  336. package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
  337. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
  338. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
  339. package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
  340. package/skills/pixelcraft-review/scripts/slop-scan.mjs +1233 -0
  341. package/skills/pixelcraft-spatial/SKILL.md +51 -0
  342. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +39 -0
  343. package/skills/pixelcraft-spatial/references/platforms.md +147 -0
  344. package/skills/pixelcraft-tokens/SKILL.md +60 -0
  345. package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
  346. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
  347. package/skills/pixelcraft-tokens/references/adoption.md +55 -0
  348. package/skills/pixelcraft-tokens/references/format.md +84 -0
  349. package/skills/pixelcraft-tokens/references/governance.md +80 -0
  350. package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
  351. package/skills/pixelcraft-tokens/references/theme-presets.md +122 -0
  352. package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
  353. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +847 -0
  354. package/skills/pixelcraft-tui/SKILL.md +76 -0
  355. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +79 -0
  356. package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
  357. package/skills/pixelcraft-tui/references/ink.md +109 -0
  358. package/skills/pixelcraft-tui/references/ratatui.md +102 -0
  359. package/skills/pixelcraft-tui/references/rich.md +82 -0
  360. package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
  361. package/skills/pixelcraft-tui/references/textual.md +108 -0
  362. package/skills/pixelcraft-ux/SKILL.md +56 -0
  363. package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
  364. package/skills/pixelcraft-ux/references/feedback-performance.md +50 -0
  365. package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
  366. package/skills/pixelcraft-ux/references/forms.md +151 -0
  367. package/skills/pixelcraft-ux/references/i18n.md +221 -0
  368. package/skills/pixelcraft-ux/references/laws.md +39 -0
  369. package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
  370. package/skills/pixelcraft-ux/references/state-matrix.md +53 -0
  371. package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
  372. package/skills/pixelcraft-ux/references/ux-writing.md +44 -0
  373. package/skills/pixelcraft-visual-qa/SKILL.md +96 -0
  374. package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
  375. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +59 -0
  376. package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
  377. package/skills/pixelcraft-visual-qa/references/capture-email.md +38 -0
  378. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +50 -0
  379. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +35 -0
  380. package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
  381. package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
  382. package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
  383. package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
  384. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +78 -0
  385. package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
  386. package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
  387. package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
  388. package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
  389. package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
  390. package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
  391. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +174 -0
  392. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
  393. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
  394. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
  395. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
  396. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
  397. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
  398. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
  399. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +668 -0
  400. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1226 -0
  401. package/skills/pixelcraft-web/SKILL.md +132 -0
  402. package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
  403. package/skills/pixelcraft-web/references/adaptive-layout.md +69 -0
  404. package/skills/pixelcraft-web/references/angular.md +108 -0
  405. package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
  406. package/skills/pixelcraft-web/references/astro.md +113 -0
  407. package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
  408. package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
  409. package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
  410. package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
  411. package/skills/pixelcraft-web/references/clojurescript.md +88 -0
  412. package/skills/pixelcraft-web/references/component-systems.md +102 -0
  413. package/skills/pixelcraft-web/references/component-testing.md +170 -0
  414. package/skills/pixelcraft-web/references/creative-effects.md +59 -0
  415. package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
  416. package/skills/pixelcraft-web/references/elm.md +53 -0
  417. package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
  418. package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
  419. package/skills/pixelcraft-web/references/forms-validation.md +123 -0
  420. package/skills/pixelcraft-web/references/fsharp-fable.md +54 -0
  421. package/skills/pixelcraft-web/references/gsap.md +102 -0
  422. package/skills/pixelcraft-web/references/html-css.md +220 -0
  423. package/skills/pixelcraft-web/references/htmx-alpine.md +103 -0
  424. package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
  425. package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
  426. package/skills/pixelcraft-web/references/java-web.md +61 -0
  427. package/skills/pixelcraft-web/references/kotlin-web.md +57 -0
  428. package/skills/pixelcraft-web/references/leptos-yew.md +97 -0
  429. package/skills/pixelcraft-web/references/lit-web-components.md +63 -0
  430. package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
  431. package/skills/pixelcraft-web/references/media-players.md +104 -0
  432. package/skills/pixelcraft-web/references/motion-react.md +96 -0
  433. package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
  434. package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
  435. package/skills/pixelcraft-web/references/pwa.md +230 -0
  436. package/skills/pixelcraft-web/references/qwik.md +94 -0
  437. package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
  438. package/skills/pixelcraft-web/references/react-next.md +168 -0
  439. package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
  440. package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
  441. package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
  442. package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
  443. package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
  444. package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
  445. package/skills/pixelcraft-web/references/server-rendered.md +114 -0
  446. package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
  447. package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
  448. package/skills/pixelcraft-web/references/solid.md +111 -0
  449. package/skills/pixelcraft-web/references/state-architecture.md +107 -0
  450. package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
  451. package/skills/pixelcraft-web/references/svelte.md +111 -0
  452. package/skills/pixelcraft-web/references/tailwind.md +99 -0
  453. package/skills/pixelcraft-web/references/video-media.md +69 -0
  454. package/skills/pixelcraft-web/references/vue-nuxt.md +86 -0
  455. package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
@@ -0,0 +1,273 @@
1
+ # Styling and CSS ecosystem
2
+
3
+ Select the styling layer by runtime model, React Server Components (RSC) compatibility, theming contract, and team ownership—not habit. For Tailwind v4 CSS-first `@theme inline` rules, read [tailwind.md](tailwind.md); for pure native HTML/CSS features (`@layer`, Popover, Anchor Positioning, `@starting-style`, `oklch`), read [html-css.md](html-css.md).
4
+
5
+ ## Architecture decision matrix
6
+
7
+ | Model | Representative tools | Build-time CSS | RSC-safe | Best fit | Primary trade-off |
8
+ |---|---|---|---|---|---|
9
+ | Native CSS & Modules | CSS Modules, **Lightning CSS**, PostCSS | Yes | Yes | Any framework, minimal tooling, long-lived apps | Manual token/variant ergonomics unless paired with CVA |
10
+ | Preprocessors | Sass/SCSS (`@use`/`@forward`), Less | Yes | Yes | Existing SCSS/Bootstrap/Carbon codebases | Largely superseded by native CSS nesting, custom properties, and `@layer` for greenfield work |
11
+ | Utility / Token CSS | Tailwind CSS v4, UnoCSS, Open Props, Bootstrap, Bulma | Yes | Yes | Rapid composition, multi-surface products, server-rendered apps | Requires strict semantic token bridge to avoid utility soup |
12
+ | Zero-runtime CSS-in-TS | Panda CSS, vanilla-extract, **Pigment CSS**, Linaria (WyW-in-JS) | Yes | Yes | Type-safe design systems, strict token contracts, RSC apps (Pigment CSS for MUI v6/v7 RSC migrations) | Static-extraction constraints (no arbitrary runtime expressions) |
13
+ | Compiled Atomic JS | StyleX (`@stylexjs/stylex`), **Tamagui Web** | Yes | Yes | Meta-scale deterministic atomic CSS (StyleX); shared React Web + React Native UI with optimizing extraction (Tamagui) | Strict compiler/file rules and bundler plugin setup |
14
+ | Runtime CSS-in-JS | Emotion, styled-components | No (runtime injection) | No (`'use client'` + registry required) | Legacy React SPAs or MUI v5 / Chakra v2 maintenance | Serialization, hydration, and RSC overhead; avoid for new RSC apps |
15
+
16
+ Never stack two competing styling paradigms in the same surface (for example, Bootstrap + Tailwind or Emotion + Panda CSS) unless executing an explicit incremental migration behind `@layer`.
17
+
18
+ ## Zero-runtime build-time CSS-in-TS
19
+
20
+ ### Panda CSS
21
+
22
+ Panda CSS statically analyzes source files at build time and emits atomic CSS. Any value Panda cannot resolve statically produces a class name with **no emitted CSS** (silent failure).
23
+
24
+ - **Static extraction rule**: never pass runtime variables, dynamic object keys, spreads, or template literals (`red.${shade}`) into `css()`. Both branches of a ternary must be literal token values.
25
+ - **Dynamic values**: map runtime choices to precomputed `css()` objects, use `cva`/`sva` recipes, or declare `staticCss` in `defineConfig()` for dynamic recipe variants.
26
+ - **Theming**: define semantic tokens with `{ base, _dark }` conditions instead of runtime theme-switching Context.
27
+ - **Multi-part components**: use `sva()` and always list `slots` explicitly so typos fail at compile time instead of creating silent extra slots.
28
+
29
+ ```ts
30
+ // panda.config.ts (excerpt)
31
+ semanticTokens: {
32
+ colors: {
33
+ bg: {
34
+ canvas: { value: { base: '#ffffff', _dark: '#0a0a0a' } },
35
+ subtle: { value: { base: '#f5f5f5', _dark: '#1a1a1a' } },
36
+ },
37
+ },
38
+ },
39
+ staticCss: {
40
+ recipes: {
41
+ button: [{ size: ['sm', 'md'] }, { variant: ['*'] }],
42
+ },
43
+ }
44
+ ```
45
+
46
+ ```tsx
47
+ import { css, sva } from '../styled-system/css';
48
+
49
+ // Both ternary branches are statically extractable literals
50
+ const labelClass = css({ color: isActive ? 'text.default' : 'text.muted' });
51
+
52
+ // Multi-slot recipe with explicit slots
53
+ const card = sva({
54
+ slots: ['root', 'title', 'body'],
55
+ base: {
56
+ root: { rounded: 'lg', borderWidth: '1px', p: '4' },
57
+ title: { fontWeight: 'semibold', mb: '2' },
58
+ body: { color: 'text.muted' },
59
+ },
60
+ variants: {
61
+ size: {
62
+ sm: { root: { p: '3' }, title: { fontSize: 'sm' } },
63
+ md: { root: { p: '4' }, title: { fontSize: 'md' } },
64
+ },
65
+ },
66
+ defaultVariants: { size: 'md' },
67
+ });
68
+ ```
69
+
70
+ ### vanilla-extract
71
+
72
+ Styles live in `*.css.ts` files compiled to static `.css` bundles with locally scoped class names and CSS variables.
73
+
74
+ - **Code-split themes**: define a contract with `createThemeContract({ ...null })` and implement separate bundles with `createTheme(vars, values)`.
75
+ - **Component variants**: use `@vanilla-extract/recipes` (`recipe` + `RecipeVariants<typeof button>`) for typed variant matrices.
76
+ - **Atomic utilities**: use `@vanilla-extract/sprinkles` (`defineProperties` + `createSprinkles`). Always assign each `defineProperties(...)` call to a variable before passing it into `createSprinkles(...)`—inlining breaks TypeScript inference.
77
+ - **Runtime dynamic values**: use `assignInlineVars` from `@vanilla-extract/dynamic` to bind runtime props to typed CSS custom properties.
78
+
79
+ ```ts
80
+ // theme.css.ts
81
+ import { createThemeContract, createTheme, style } from '@vanilla-extract/css';
82
+ import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
83
+
84
+ export const vars = createThemeContract({
85
+ color: { brand: null, surface: null },
86
+ font: { body: null },
87
+ });
88
+
89
+ export const lightTheme = createTheme(vars, {
90
+ color: { brand: '#0f4c81', surface: '#ffffff' },
91
+ font: { body: 'system-ui, sans-serif' },
92
+ });
93
+
94
+ export const container = style({
95
+ background: vars.color.surface,
96
+ fontFamily: vars.font.body,
97
+ paddingInline: '1rem',
98
+ });
99
+
100
+ export const button = recipe({
101
+ base: { fontFamily: vars.font.body, borderRadius: '6px' },
102
+ variants: {
103
+ tone: {
104
+ brand: { background: vars.color.brand, color: '#ffffff' },
105
+ surface: { background: vars.color.surface, color: vars.color.brand },
106
+ },
107
+ },
108
+ });
109
+
110
+ export type ButtonVariants = RecipeVariants<typeof button>;
111
+ ```
112
+
113
+ ```tsx
114
+ import { assignInlineVars } from '@vanilla-extract/dynamic';
115
+ import { container, vars } from './theme.css';
116
+
117
+ <section className={container} style={assignInlineVars(vars, { color: { brand, surface }, font: { body } })} />
118
+ ```
119
+
120
+ ### Pigment CSS & Linaria (WyW-in-JS)
121
+
122
+ - **Pigment CSS (`@pigment-css/react`)**: build-time CSS-in-JS (built on WyW-in-JS) designed as an RSC-compatible migration target for Emotion/MUI teams (`styled`, `css`, `variants`, theme CSS variables). Dynamic styles must use `variants` or CSS custom properties rather than arbitrary runtime functions.
123
+ - **Linaria (`@linaria/core`, `@linaria/react`, `@wyw-in-js/vite`)**: extracts tagged template literals to static CSS and compiles dynamic prop interpolations into CSS custom properties applied via inline `style`. Any custom component wrapped with `styled(CustomCard)` that uses dynamic interpolations **must accept and forward both `className` and `style`**; dropping `style` silently breaks dynamic variables.
124
+
125
+ ## Atomic CSS compilers
126
+
127
+ ### StyleX (`@stylexjs/stylex`)
128
+
129
+ StyleX compiles co-located JS style objects into collision-free atomic CSS where last-applied style always wins deterministically.
130
+
131
+ - **Strict variable file rule**: `stylex.defineVars()` and `stylex.defineConsts()` **must** live in `*.stylex.ts` / `*.stylex.js` files as **named exports only** (no default exports and no other exports in that file). Keys starting with `--` emit unhashed custom property names.
132
+ - **Theming & composition**: apply themes created with `stylex.createTheme(vars, overrides)` directly alongside style objects inside `stylex.props(darkTheme, styles.root, isCompact && styles.compact)`.
133
+
134
+ ```ts
135
+ // tokens.stylex.ts (named exports only)
136
+ import * as stylex from '@stylexjs/stylex';
137
+
138
+ export const colors = stylex.defineVars({
139
+ text: '#111827',
140
+ surface: '#ffffff',
141
+ '--brand-accent': '#0f4c81',
142
+ });
143
+ ```
144
+
145
+ ```tsx
146
+ import * as stylex from '@stylexjs/stylex';
147
+ import { colors } from './tokens.stylex';
148
+
149
+ const darkTheme = stylex.createTheme(colors, {
150
+ text: '#f9fafb',
151
+ surface: '#0b0f14',
152
+ '--brand-accent': '#60a5fa',
153
+ });
154
+
155
+ const styles = stylex.create({
156
+ card: { backgroundColor: colors.surface, color: colors.text, padding: '16px' },
157
+ });
158
+
159
+ <article {...stylex.props(isDark && darkTheme, styles.card)} />
160
+ ```
161
+
162
+ ### Tamagui Web (`@tamagui/core` / `tamagui`)
163
+
164
+ Choose **Tamagui** when sharing styled primitives and design tokens across **React Web and React Native / Expo** (not for web-only projects where Tailwind v4, CSS Modules, or Panda CSS are simpler). Enable the build-time optimizing compiler (`@tamagui/vite-plugin` or `@tamagui/next-plugin`) so static style props flatten into atomic CSS classes and `<div>`/`<span>` tags instead of runtime style objects, and define tokens/themes centrally in `tamagui.config.ts`.
165
+
166
+ ### UnoCSS
167
+
168
+ UnoCSS is an on-demand atomic CSS engine configured in `uno.config.ts`.
169
+
170
+ - Use `presetWind4()` for Tailwind v4-compatible utilities, `shortcuts` for repeated semantic patterns, and `@unocss/transformer-directives` when CSS `@apply` / directives are needed.
171
+ - Because UnoCSS extracts utilities statically, declare runtime-constructed class names in `safelist` (either static arrays or a `(context) => ...` function reading `context.theme`).
172
+
173
+ ```ts
174
+ // uno.config.ts
175
+ import { defineConfig, presetWind4, transformerDirectives } from 'unocss';
176
+
177
+ export default defineConfig({
178
+ presets: [presetWind4()],
179
+ transformers: [transformerDirectives()],
180
+ shortcuts: {
181
+ 'btn-primary': 'px-4 py-2 rounded-md font-medium bg-action text-on-action',
182
+ },
183
+ safelist: [
184
+ (ctx) => Object.keys(ctx.theme.colors || {}).map((c) => `bg-${c}-500`),
185
+ ],
186
+ });
187
+ ```
188
+
189
+ ## Component variant & recipe APIs
190
+
191
+ When styling with Tailwind, UnoCSS, or CSS Modules, manage multi-axis component variants with a typed variant builder instead of nested template-string conditionals.
192
+
193
+ | Tool | Best fit | Built-in `tailwind-merge` | Multi-slot support |
194
+ |---|---|---|---|
195
+ | CVA (`class-variance-authority` v0.7 / `cva` v1) | Single-element primitives, CSS Modules, Tailwind | Via `defineConfig` (v1) or wrapper `cn()` (v0.7) | No (compose separate `cva` calls) |
196
+ | Tailwind Variants (`tailwind-variants`) | Multi-part Tailwind components (cards, modals, inputs) | Yes (`twMerge: true` + `createTV`) | First-class `slots` and `compoundSlots` |
197
+
198
+ - **CVA conflict resolution**: plain `cva` concatenates class strings without resolving conflicting Tailwind utilities. In `cva` v1 (`cva` package), import `defineConfig` from **`'cva'`** and wire `twMerge` (use `tailwind-merge` v3+ with Tailwind v4); in `class-variance-authority` v0.7, wrap the output in `cn(buttonVariants(...), className)`.
199
+
200
+ ```ts
201
+ // cva v1 (cva.config.ts)
202
+ import { defineConfig } from 'cva';
203
+ import { twMerge } from 'tailwind-merge';
204
+
205
+ export const { cva, cx: cn } = defineConfig({
206
+ hooks: {
207
+ onComplete: (className) => twMerge(className),
208
+ },
209
+ });
210
+ ```
211
+
212
+ ```ts
213
+ // tailwind-variants with custom token merge config + slots
214
+ import { createTV } from 'tailwind-variants';
215
+
216
+ export const tv = createTV({
217
+ twMergeConfig: {
218
+ extend: {
219
+ theme: { spacing: ['gap-grid'] },
220
+ },
221
+ },
222
+ });
223
+
224
+ export const card = tv({
225
+ slots: { base: 'rounded-xl p-4', header: 'font-semibold' },
226
+ variants: { elevated: { true: {}, false: {} } },
227
+ compoundSlots: [{ elevated: true, slots: ['base'], class: 'shadow-lg' }],
228
+ });
229
+ ```
230
+
231
+ ## CSS Modules, Lightning CSS, preprocessors, and token libraries
232
+
233
+ - **Lightning CSS + CSS Modules**: enable `css: { transformer: 'lightningcss' }` (and `build: { cssMinify: 'lightningcss' }`) in Vite for Rust-native CSS Modules, nesting, modern color/media-query lowering, vendor prefixing, and minification without a heavy PostCSS plugin chain:
234
+
235
+ ```ts
236
+ // vite.config.ts
237
+ import { defineConfig } from 'vite';
238
+
239
+ export default defineConfig({
240
+ css: { transformer: 'lightningcss' },
241
+ build: { cssMinify: 'lightningcss' },
242
+ });
243
+ ```
244
+
245
+ - **Sass / SCSS**: in existing SCSS codebases, use `@use` and `@forward` with explicit namespaces; do not add new legacy `@import` chains (deprecated in Dart Sass). Never use Sass `$variables` for runtime theme switching—emit CSS custom properties instead.
246
+ - **Open Props**: import only the packs you use (`@import "open-props/easings";`, `@import "open-props/sizes";`) or wire `postcss-jit-props` so unused custom properties are tree-shaken out of the production stylesheet.
247
+ - **Bootstrap / Bulma**: when maintaining apps built on them, override semantic Sass/CSS variables at the theme layer rather than fighting framework specificity with `!important` or layering Tailwind on top.
248
+
249
+ ## Runtime CSS-in-JS (Emotion, styled-components)
250
+
251
+ - **RSC boundary**: Emotion and styled-components rely on React Context and runtime `<style>` insertion. They cannot execute inside React Server Components without `'use client'` boundaries and an SSR style registry (`useServerInsertedHTML` in Next.js App Router).
252
+ - **Decision rule**: keep runtime CSS-in-JS only when extending an existing Emotion/styled-components codebase or a component library that mandates it. For greenfield RSC/SSR apps, choose CSS Modules + Lightning CSS, Tailwind v4, Panda CSS, vanilla-extract, Pigment CSS, or StyleX.
253
+
254
+ ## Do/don't pairs
255
+
256
+ | Do | Don't |
257
+ |---|---|
258
+ | Use literal tokens, `cva`/`sva`, or `staticCss` in Panda CSS | Pass `css({ color: \`red.${shade}\` })` or runtime spreads into Panda `css()` |
259
+ | Put `stylex.defineVars()` in `*.stylex.ts` as named exports only | Export components or default exports from a `*.stylex.ts` token file |
260
+ | Define `defineProperties()` variables before `createSprinkles()` | Inline `defineProperties()` calls inside `createSprinkles()` |
261
+ | Forward both `className` and `style` into Linaria `styled(Custom)` targets | Forward only `className` and silently drop dynamic CSS variables |
262
+ | Import `defineConfig` from `'cva'` (v1) and wire `twMerge` (v3 for Tailwind v4) | Import non-existent `'cva/config'` or concatenate conflicting Tailwind utilities |
263
+ | Enable `css: { transformer: 'lightningcss' }` in Vite for CSS Modules & native CSS | Add Sass + 6 PostCSS plugins solely for CSS nesting and autoprefixer |
264
+ | Use `postcss-jit-props` or selective `@import` packs with Open Props | Ship the entire unshaken Open Props bundle when using five tokens |
265
+ | Use Sass `@use`/`@forward` + CSS custom properties for runtime themes | Write new `@import` chains or bake dark mode into static Sass `$vars` |
266
+
267
+ ## Verification commands
268
+
269
+ ```sh
270
+ npm run build
271
+ ```
272
+
273
+ Inspect the built `.css` output (`static`) to confirm zero-runtime classes and custom properties were actually emitted (catching Panda/UnoCSS/Tamagui extraction misses), and verify computed styles across light/dark themes and component variants in a real browser (`rendered`).
@@ -0,0 +1,111 @@
1
+ # Svelte / SvelteKit
2
+
3
+ ## Token mapping
4
+
5
+ Import generated CSS variables in the root layout or global stylesheet:
6
+
7
+ ```svelte
8
+ <script>import '../tokens.css';</script>
9
+ ```
10
+
11
+ Use semantic variables inside component styles. Svelte scoped styles do not replace token architecture; use `:global()` only deliberately.
12
+
13
+ ## Layout and responsive idioms
14
+
15
+ Use layouts for persistent shell/navigation and pages for route-specific content. CSS remains first-class: grid/flex/container queries/logical properties. Svelte stores should represent shared state, not layout constants. Component-level adaptation belongs close to the component through CSS/container queries where possible.
16
+
17
+ ## Typography/custom fonts
18
+
19
+ Load fonts in `app.html`/root layout or font tooling with explicit fallbacks/subsets. Avoid hydrating text styling that causes font/layout jumps. Measure and hierarchy belong in CSS rather than ad hoc inline styles.
20
+
21
+ ## Motion/reduced motion
22
+
23
+ Svelte transitions (`transition:`, `in:`, `out:`, `animate:`) are concise but still need purpose. Read `prefersReducedMotion.current` from `svelte/motion` (SSR-safe reactive wrapper around `matchMedia('(prefers-reduced-motion: reduce)')`) to zero durations or swap spatial slides for subtle opacity fades; do not animate list reordering when it destroys orientation.
24
+
25
+ ## Accessibility specifics
26
+
27
+ Use real elements. Svelte compiler a11y warnings help but do not guarantee usable UX. Use `$props.id()` (Svelte 5.20+) to generate SSR-safe unique IDs for `<label for>` and `aria-describedby` inside reusable components. Manage focus after navigation/dialog/state removal, label form controls, and preserve keyboard behavior. `{@html}` is dangerous for untrusted content and bypasses semantic/control guarantees.
28
+
29
+ ## States idiom
30
+
31
+ SvelteKit `load` return shape, `error`, `status`, `$app/state` (`page`, `navigating`, `updated` — replacing legacy `$app/stores` in SvelteKit 2.12+), and form action results each represent distinct lifecycle states. Render loading/stale/empty/error explicitly. Progressive enhancement through `use:enhance` should preserve input, expose pending state, prevent duplicate submission, and handle rollback.
32
+
33
+ ## Forms idiom
34
+
35
+ Svelte `bind:value` does not replace labels or validation timing. Native `+page.server.ts` form actions (`export const actions = { ... } satisfies Actions`) returning `fail(400, { values, errors })` plus `use:enhance` (or SvelteKit Superforms for typed multi-field forms; see `forms-validation.md`) provide a resilient baseline. Use correct `autocomplete`/`inputmode` attributes and preserve invalid input returned by server actions.
36
+
37
+ ## Svelte 5 Runes, Attachments, and SvelteKit 2 idioms
38
+
39
+ - **Runes & Snippets**: use `$state`, `$derived` / `$derived.by`, `$effect`, `$props`, `$bindable`, and `{#snippet}` / `{@render children?.()}` instead of legacy `export let`, `$:`, and `<slot>`. Use standard DOM event attributes (`onclick={...}`, `onkeydown={...}`) rather than deprecated `on:click`.
40
+ - **Derived vs Effect**: compute derived values with `$derived(...)`—never `$effect(() => { derived = ... })`, which introduces extra render passes and feedback loops. Use `$effect` only for external DOM/observer/network synchronization with a cleanup return.
41
+ - **Performance & serialization**: use `$state.raw(...)` for large immutable arrays/objects (tables, GeoJSON, charts) that do not need deep proxy overhead, and `$state.snapshot(state)` before passing reactive state to `structuredClone`, Web Workers, `localStorage`, or third-party non-Svelte libraries.
42
+ - **Reactive collections & media**: use `svelte/reactivity` (`SvelteMap`, `SvelteSet`, `SvelteURLSearchParams`, `MediaQuery`) and `svelte/motion` (`prefersReducedMotion`) instead of manual store wrappers.
43
+ - **Attachments (`{@attach ...}`)**: in Svelte 5.29+, prefer `{@attach tooltip(opts)}` attachments over legacy `use:` actions—attachments run reactively inside an effect, return a cleanup function, and can be passed through component props via `createAttachmentKey()`.
44
+ - **SSR isolation for `.svelte.ts` modules**: create rune-backed state classes in `.svelte.ts`, instantiate them inside the root layout, and expose them via `setContext` / `getContext`—never export mutable module-level `$state` singletons in SvelteKit SSR, or user data will leak across concurrent requests.
45
+
46
+ ```svelte
47
+ <script lang="ts">
48
+ import { page } from '$app/state';
49
+ import { prefersReducedMotion } from 'svelte/motion';
50
+ import { MediaQuery } from 'svelte/reactivity';
51
+ import type { Snippet } from 'svelte';
52
+ import type { Attachment } from 'svelte/attachments';
53
+
54
+ let { value = $bindable(''), children }: { value?: string; children?: Snippet } = $props();
55
+ const fieldId = $props.id();
56
+ const isCompact = new MediaQuery('(max-width: 40rem)');
57
+ let trimmedLength = $derived(value.trim().length);
58
+
59
+ const focusOnMount: Attachment<HTMLInputElement> = (node) => {
60
+ if (!prefersReducedMotion.current) node.dataset.animated = 'true';
61
+ return () => { delete node.dataset.animated; };
62
+ };
63
+ </script>
64
+
65
+ <label for={fieldId}>Search ({page.url.pathname})</label>
66
+ <input id={fieldId} bind:value {@attach focusOnMount} data-compact={isCompact.current} />
67
+ {@render children?.()}
68
+ ```
69
+
70
+ ```ts
71
+ // src/routes/invoices/+page.server.ts
72
+ import { fail } from '@sveltejs/kit';
73
+ import type { Actions } from './$types';
74
+
75
+ export const actions = {
76
+ create: async ({ request, locals }) => {
77
+ if (!locals.user) return fail(401, { message: 'Sign in required.' });
78
+ const data = await request.formData();
79
+ const batch = String(data.get('batch') ?? '').trim();
80
+ if (!batch) return fail(400, { batch, error: 'Batch code is required.' });
81
+ return { ok: true };
82
+ }
83
+ } satisfies Actions;
84
+ ```
85
+
86
+ ## Do/don't pairs
87
+
88
+ | Do | Don't |
89
+ |---|---|
90
+ | `<a href="/invoice/42">View invoice</a>` | `<div onclick={() => goto('/invoice/42')}>View invoice</div>` (or deprecated `on:click`) |
91
+ | `export const actions = { create: async (...) => fail(400, { ... }) } satisfies Actions` | `export function actions(...)` (invalid SvelteKit export) or throwing raw 500s for validation |
92
+ | Instantiate `.svelte.ts` state per layout and share via `setContext`/`getContext` | Export mutable module-level `$state` in SvelteKit SSR (cross-request data leak) |
93
+ | Import `page`, `navigating`, `updated` from `$app/state` | Keep importing legacy `$app/stores` in new SvelteKit 2 code |
94
+ | `$props.id()` for `<label for>` + `aria-describedby` and `$state.snapshot()` for workers/APIs | Duplicate static IDs or passing raw `$state` proxies into `postMessage`/`structuredClone` |
95
+ | Stable keyed `{#each items as item (item.id)}` | Keyless list mutation causing focus/state reuse bugs |
96
+
97
+ ## Known traps
98
+
99
+ Cross-request SSR leaks from module-level `$state` in `.svelte.ts`, writing `export function actions` instead of `export const actions = { ... }`, deep-proxying large datasets without `$state.raw`, passing `$state` proxies to `structuredClone` without `$state.snapshot`, mixing legacy `on:`/`$:`/`$app/stores` with Svelte 5 runes, keyed each-block focus reuse, treating compiler a11y warnings as full WCAG coverage.
100
+
101
+ ## Verification commands
102
+
103
+ ```sh
104
+ npm run check
105
+ npm run lint
106
+ npm run test -- --run
107
+ npm run build
108
+ npx playwright test
109
+ ```
110
+
111
+ Use browser inspection for rendering/hydration evidence (`rendered`); `svelte-check` is `static` evidence only.
@@ -0,0 +1,99 @@
1
+ # Tailwind as styling layer (v4)
2
+
3
+ Tailwind is an implementation layer, not the design direction. Treat utility classes as compiled expressions of semantic decisions—not a replacement for tokens, hierarchy, or component intent.
4
+
5
+ ## Token mapping
6
+
7
+ These examples target v4. If the existing project uses v3, preserve its configuration and content discovery unless migration is in scope; verify the installed major before copying CSS directives.
8
+
9
+ Tailwind v4 is CSS-first. On Vite projects, use the native `@tailwindcss/vite` plugin instead of the PostCSS wrapper for faster builds. When mapping semantic CSS custom properties into Tailwind theme tokens, use **`@theme inline`**—not plain `@theme`—so utilities emit `var(--semantic-color-action)` directly at the element instead of binding an intermediate variable on `:root` that breaks scoped theme/mode overrides (such as `[data-theme="dark"]` or `.surface-inverted`):
10
+
11
+ ```css
12
+ @import "tailwindcss";
13
+ @import "./tokens.css";
14
+ @import "tw-animate-css";
15
+
16
+ /* Scan external UI packages or monorepo paths outside auto-detected git-tracked sources */
17
+ @source "../packages/ui/src";
18
+
19
+ /* Class/attribute dark-mode selector when not using prefers-color-scheme only */
20
+ @custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
21
+
22
+ @theme inline {
23
+ --color-action: var(--semantic-color-action);
24
+ --color-surface: var(--semantic-color-background);
25
+ --color-ink: var(--semantic-color-foreground);
26
+ --font-sans: var(--semantic-font-body);
27
+ }
28
+
29
+ /* Reusable semantic utilities participate in variants (hover:, md:, dark:) */
30
+ @utility prose-measure {
31
+ max-inline-size: 68ch;
32
+ text-wrap: pretty;
33
+ }
34
+ ```
35
+
36
+ Do not redefine a parallel raw palette in `@theme` when semantic variables already exist. Use `@theme` (without `inline`) only for static literal values you intend to resolve at `:root`.
37
+
38
+ ## v4 breaking defaults & ecosystem compatibility
39
+
40
+ Check these v4 changes whenever porting patterns or mixing older snippets:
41
+
42
+ - **Default `border-color` is `currentColor`** (was `gray-200` in v3) — always specify an explicit semantic border color (`border-subtle` / `border-line`) on `border`.
43
+ - **Default `ring` width is `1px` and `currentColor`** (was `3px` blue in v3) — use `ring-2 ring-action` explicitly when a thicker focus ring is intended.
44
+ - **`outline-hidden` replaces v3 `outline-none`** — `outline-hidden` keeps a transparent outline visible in Windows Forced Colors Mode; `outline-none` now sets `outline-style: none` and hides focus in forced colors.
45
+ - **Built-in container queries**: `@container`, `@container/sidebar`, `@md:`, `@max-sm:` work natively in v4 without `@tailwindcss/container-queries`.
46
+ - **Companion packages**: upgrade to `tailwind-merge` v3+ for v4 class deduplication, and use `tw-animate-css` instead of the deprecated v3 `tailwindcss-animate` JS plugin.
47
+
48
+ ## Layout and responsive idioms
49
+
50
+ Use grid/flex utilities and built-in `@container` queries (`@container` parent + `@md:grid-cols-[10rem_1fr]`) to express actual composition. Responsive prefixes (`sm:`, `md:`…) should implement restructuring decisions, not hide the absence of one. Prefer logical utilities (`ms-`, `me-`, `ps-`, `pe-`, `start-`, `end-`) when available. Extract repeated semantic patterns only when reuse is real; premature component abstraction can be worse than legible utilities.
51
+
52
+ ## Typography/custom fonts
53
+
54
+ Define font families/size/line-height roles in `@theme inline` or CSS. Avoid arbitrary values for every text size. Use measure utilities (`max-w-prose` or a custom `@utility`) deliberately and preserve fallback/subset behavior.
55
+
56
+ ## Motion/reduced motion
57
+
58
+ Use Tailwind motion utilities only for purposeful properties; never `transition-all`. Tailwind provides `motion-safe:` and `motion-reduce:` variants—use them to supply meaningful alternatives:
59
+
60
+ ```html
61
+ <div class="transition-opacity motion-reduce:transition-none">
62
+ ```
63
+
64
+ ## Accessibility specifics
65
+
66
+ Tailwind does not create semantics. Use real HTML controls, visible `focus-visible` styles, `outline-hidden` (never bare `outline-none` without a forced-colors-safe replacement), screen-reader utility only for content that truly should be visually hidden, and adequate contrast. Do not use `sr-only` to hide labels that sighted users also need.
67
+
68
+ ## States idiom
69
+
70
+ Use state variants intentionally: `hover:`, `focus-visible:`, `active:`, `disabled:`, `aria-*`, `data-*`, `dark:`, `forced-colors:`. Every interactive element still needs loading/error/empty/disabled semantics beyond styling.
71
+
72
+ ## Forms idiom
73
+
74
+ Utilities can accelerate layout but must not replace labels/input attributes. Preserve input sizing expansion, correct autocomplete/inputmode, error association, target size, and focus visibility. Ring utilities are a mechanism, not automatically an accessible focus design.
75
+
76
+ ## Do/don't pairs
77
+
78
+ | Do | Don't |
79
+ |---|---|
80
+ | `@theme inline { --color-surface: var(--semantic-color-background); }` | Plain `@theme` referencing `var(--...)` that freezes theme resolution at `:root` |
81
+ | `class="focus-visible:outline-2 focus-visible:outline-offset-2"` or `outline-hidden focus-visible:ring-2` | `class="outline-none"` (breaks Windows Forced Colors visibility in v4) |
82
+ | `class="border border-line"` with explicit semantic border color | Bare `class="border"` assuming v3's `gray-200` default |
83
+ | `class="transition-opacity motion-reduce:transition-none"` | `class="transition-all duration-500"` on everything |
84
+ | `ms-4`/`pe-2` and built-in `@container` (`@md:flex-row`) | physical `ml-4`/`pr-2` by reflex or installing obsolete `@tailwindcss/container-queries` |
85
+ | `tailwind-merge` v3 + `tw-animate-css` + `@tailwindcss/vite` | Mixing `tailwind-merge` v2 or `tailwindcss-animate` into a v4 build |
86
+
87
+ ## Known traps
88
+
89
+ Plain `@theme` freezing CSS variable aliases at `:root`, uncolored v4 `border` inheriting `currentColor`, `outline-none` erasing forced-colors focus indicators, missing `@source` for workspace UI packages, utility verbosity hiding architecture, arbitrary-value sprawl, dark-mode inversion, visual sameness mistaken for system consistency.
90
+
91
+ ## Verification commands
92
+
93
+ ```sh
94
+ npm run lint
95
+ npm run build
96
+ npx playwright test
97
+ ```
98
+
99
+ Inspect computed CSS and dark/scoped theme switching in a real browser (`rendered`); utility presence alone is only `static` evidence.
@@ -0,0 +1,69 @@
1
+ # Video and media experiences
2
+
3
+ For adaptive streaming (`hls.js`, Shaka Player, `dash.js`), DRM, and accessible player UI suites (Vidstack, Media Chrome, Mux Player, Video.js), read [media-players.md](media-players.md).
4
+
5
+ ## Media decision
6
+
7
+ Use a standard HTML `<video>` element when the user needs to watch a clip. Use a WebGL/WebGPU video texture only when mapping video onto 3D/shader geometry materially improves the experience. Use WebCodecs only for frame-level decode/encode pipelines (browser video editors, custom muxers) after checking codec and cross-browser support.
8
+
9
+ ## Delivery & codec `<source>` ordering
10
+
11
+ - Start with a `poster` and explicit `width`/`height` (or CSS `aspect-ratio`) to prevent layout shift.
12
+ - Order `<source>` tags from **most efficient modern codec to widest fallback** with explicit `codecs` parameters so browsers pick the best hardware-decoded stream without probing every file: **AV1** (`av01`) → **HEVC** (`hvc1` for Safari/Apple hardware decode) or **VP9** (`vp09`) → **H.264** (`avc1` universal fallback).
13
+ - Defer below-fold or interaction-triggered media (`preload="none"` or `"metadata"`).
14
+ - Require synchronized captions (`<track kind="captions">`) for prerecorded informative video (WCAG 1.2.2; see [accessibility-performance.md](accessibility-performance.md)).
15
+ - Honor autoplay policy: ambient video must be `muted playsinline`, skip/pause under `prefers-reduced-motion: reduce`, and always expose a visible pause control (WCAG 2.2.2).
16
+
17
+ ```html
18
+ <video
19
+ width="1280"
20
+ height="720"
21
+ poster="/media/preview-poster.webp"
22
+ preload="metadata"
23
+ playsinline
24
+ controls
25
+ >
26
+ <source src="/media/demo-av1.mp4" type='video/mp4; codecs="av01.0.08M.08"' />
27
+ <source src="/media/demo-hevc.mp4" type='video/mp4; codecs="hvc1.1.6.L93.B0"' />
28
+ <source src="/media/demo-vp9.webm" type='video/webm; codecs="vp09.00.41.08"' />
29
+ <source src="/media/demo-h264.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
30
+ <track kind="captions" src="/media/demo.en.vtt" srclang="en" label="English" default />
31
+ </video>
32
+ ```
33
+
34
+ ## Video textures & `requestVideoFrameCallback`
35
+
36
+ When uploading `<video>` frames to Canvas 2D, WebGL, or WebGPU textures, prefer **`video.requestVideoFrameCallback()`** (with a `requestAnimationFrame` fallback) so textures only re-upload when a **new decoded video frame arrives** instead of uploading duplicate 24/30 fps frames at 60/120 Hz:
37
+
38
+ ```ts
39
+ let handle = 0;
40
+ let cancelled = false;
41
+
42
+ function scheduleFrame(video: HTMLVideoElement, uploadTexture: () => void) {
43
+ if (cancelled) return;
44
+ if ('requestVideoFrameCallback' in video) {
45
+ handle = video.requestVideoFrameCallback(() => {
46
+ uploadTexture();
47
+ scheduleFrame(video, uploadTexture);
48
+ });
49
+ } else {
50
+ handle = requestAnimationFrame(() => {
51
+ if (video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) uploadTexture();
52
+ scheduleFrame(video, uploadTexture);
53
+ });
54
+ }
55
+ }
56
+
57
+ // Teardown:
58
+ // cancelled = true;
59
+ // if ('cancelVideoFrameCallback' in video) video.cancelVideoFrameCallback(handle);
60
+ // else cancelAnimationFrame(handle);
61
+ ```
62
+
63
+ - Set `video.crossOrigin = 'anonymous'` (with matching CORS headers on the media host) before uploading to WebGL/WebGPU textures, handle play promise rejections and decode stalls, and dispose GPU textures on unmount.
64
+ - Keep a static poster or normal `<video>` fallback when GPU contexts fail.
65
+
66
+ Official docs:
67
+ - HTMLVideoElement: https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement
68
+ - `requestVideoFrameCallback`: https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/requestVideoFrameCallback
69
+ - WebCodecs: https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API
@@ -0,0 +1,86 @@
1
+ # Vue / Nuxt
2
+
3
+ ## Token mapping
4
+
5
+ Import generated CSS variables globally or expose them through a typed theme/composable:
6
+
7
+ ```ts
8
+ import '~/assets/tokens.css';
9
+ export const semantic = { action: 'var(--semantic-color-action)' };
10
+ ```
11
+
12
+ In Nuxt, register global CSS in `nuxt.config` rather than importing it repeatedly in components.
13
+
14
+ ## Layout and responsive idioms
15
+
16
+ Use single-file components to scope behavior, not to replace CSS architecture. Layouts in `app/layouts/` (Nuxt 4) or `layouts/` (Nuxt 3) handle shell persistence; pages handle route content. Prefer CSS grid/flex/logical properties and composables only for genuinely reactive layout state. Avoid teleporting chrome without considering focus and server rendering.
17
+
18
+ ## Typography/custom fonts
19
+
20
+ Use **`@nuxt/fonts`** (automatic font metric fallbacks, self-hosting, subsetting) and **`@nuxt/image`** (`<NuxtImg>` / `<NuxtPicture>` with explicit dimensions and `preload` for LCP hero media) in Nuxt apps. In standalone Vue, configure font loading in `index.html`/Vite with explicit fallback stacks. Reactive font classes are rarely necessary; semantic CSS roles are cheaper.
21
+
22
+ ## Motion/reduced motion
23
+
24
+ Use Vue `<Transition>`/`<TransitionGroup>` for meaningful enter/leave state, with CSS classes honoring reduced motion. Query `useMediaQuery('(prefers-reduced-motion: reduce)')` (VueUse) or client-guarded `matchMedia` for JS animation. Do not animate every list mutation by default.
25
+
26
+ ## Accessibility specifics
27
+
28
+ Use native HTML inside components. `v-model` does not label inputs; explicit `label for`/`id` (use `useId()` in Vue 3.5+ for SSR-safe unique IDs) or wrapped labeling remains required. Manage focus after route changes, modal close, dynamic error insertion, and component removal. `<NuxtLink>` preserves anchor semantics; do not replace navigation with bare click handlers.
29
+
30
+ ## States idiom
31
+
32
+ Use `useAsyncData`/`useFetch` status/error/refresh deliberately: initial loading, refresh loading, stale data, empty result, server error, retry. Keep optimistic mutation rollback explicit. For SSR-safe shared state across components, always use **Nuxt `useState('key', () => ...)`** or **Pinia** (registered per SSR app instance)—never export mutable module-level `ref()` singletons that leak between concurrent server requests. Use **`callOnce()`** for one-time SSR-to-client initialization (such as bootstrapping Pinia store data without double-running on hydration).
33
+
34
+ ## Forms idiom
35
+
36
+ Use correct input attributes in templates; Vue attribute casing/hyphenation preserves native semantics. Validation libraries (VeeValidate, FormKit, or Nuxt UI `<UForm>` with Standard Schema) are optional—state timing and recovery matter more than schema existence. Preserve user input across failed submission and auth redirect.
37
+
38
+ ## Vue 3.5 / 3.6 and Nuxt 4 idioms
39
+
40
+ - **Vue 3.5+**: prefer `defineModel()` for two-way component bindings, `useTemplateRef('inputEl')` for typed DOM refs, **reactive props destructuring** (`const { count = 0 } = defineProps<{ count?: number }>()`—remains reactive without `toRefs`), and **`onWatcherCleanup()`** inside `watch`/`watchEffect` to abort stale `fetch` requests or clear timers cleanly.
41
+ - **Vue 3.6 Vapor Mode**: for high-frequency, low-overhead leaf components or large lists on Vue 3.6+, Vapor Mode compiles `<script setup vapor>` directly to fine-grained DOM operations without VDOM diffing—opt in selectively for measured hot paths while keeping standard SFCs where VDOM slots/libraries are required.
42
+ - **Pinia & Nuxt UI v3/v4**: use **Pinia** (`defineStore` setup syntax) for structured multi-route client state; when using **Nuxt UI v3/v4** (built on Reka UI + Tailwind Variants), map semantic design tokens through `app.config.ts` and `@theme inline` rather than overriding internal classes.
43
+ - **Nuxt 4 architecture**: application source lives under `app/` (`app/pages`, `app/layouts`, `app/components`, `app/composables`, `app/app.vue`), universal utilities under `shared/`, and Nitro endpoints under `server/`. `useAsyncData` / `useFetch` `data` is a **`shallowRef`** by default—replace the value immutably or opt into `{ deep: true }` explicitly. Use **`.server.vue`** components (Server Components / Nuxt Islands) to keep heavy static renderers (Markdown, syntax highlighters, charts) off the client bundle.
44
+
45
+ ```vue
46
+ <script setup lang="ts">
47
+ const { invoiceId } = defineProps<{ invoiceId: string }>();
48
+ const id = useId();
49
+ const note = defineModel<string>('note', { default: '' });
50
+
51
+ watch(
52
+ () => invoiceId,
53
+ (nextId, _prev, onCleanup) => {
54
+ const controller = new AbortController();
55
+ onCleanup(() => controller.abort());
56
+ void fetchAuditLog(nextId, controller.signal);
57
+ }
58
+ );
59
+ </script>
60
+ ```
61
+
62
+ ## Do/don't pairs
63
+
64
+ | Do | Don't |
65
+ |---|---|
66
+ | `<NuxtLink :to="`/invoice/${id}`">View invoice</NuxtLink>` | `<span @click="navigateTo(`/invoice/${id}`)">View invoice</span>` |
67
+ | `useState('filters', () => ({ ... }))` or Pinia store per request | Exporting a module-level `export const filters = ref(...)` in Nuxt SSR (cross-request state leak) |
68
+ | `await callOnce(() => store.bootstrap())` for SSR + hydration init | Running store bootstrap in setup without guarding against double execution |
69
+ | `const { status, error, refresh } = await useFetch(...)` rendered distinctly | Treating every non-success state as one spinner or mutating `shallowRef` fields in place |
70
+ | `<label :for="id">Search</label><input :id="id" v-model="q">` using `useId()` | Hardcoded duplicate IDs or `<input placeholder="Search">` without a label |
71
+ | `.server.vue` components for heavy read-only renderers | Shipping Markdown/syntax-highlighting libraries to the browser for static sections |
72
+
73
+ ## Known traps
74
+
75
+ Cross-request SSR state leaks from module-level `ref()`, mutating Nuxt 4 `shallowRef` `useAsyncData` results in place, mixing Nuxt 3 root `layouts/` with Nuxt 4 `app/layouts/`, SSR hydration mismatch from browser-only state, teleport focus traps, uncancelled watchers causing race conditions, auto-import magic hiding ownership.
76
+
77
+ ## Verification commands
78
+
79
+ ```sh
80
+ npm run lint
81
+ npm run test -- --run
82
+ npm run build
83
+ npx playwright test
84
+ ```
85
+
86
+ Run `npx nuxi analyze` interactively when inspecting client/server chunk sizes (`static`). Browser rendering and keyboard/screen-reader inspection remain required for visual/a11y claims (`rendered`).