@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,82 @@
1
+ # File upload, drag-and-drop media, and client image pipeline UI
2
+
3
+ File upload is an error-prone, long-running interaction—not a bare `<input type="file">`. Design for **resumable progress, honest validation, keyboard/screen-reader access, clipboard paste, and memory-safe client previews**.
4
+
5
+ ## Tooling decision matrix
6
+
7
+ | Tool | Best fit | Built-in resumable (tus) / S3 | Primary trade-off |
8
+ |---|---|---|---|
9
+ | **Direct-to-S3 / Cloudflare R2 presigned PUT** | Most web apps uploading files to object storage without proxying bytes through serverless functions | Single PUT (or S3 multipart for >100 MB) | Requires short-lived signed URL endpoint, strict bucket CORS, and server completion/MIME verification |
10
+ | **UploadThing** | Full-stack TypeScript apps (Next.js, Astro, SvelteKit, Solid, Vue, Hono) wanting typed file routers + webhooks | Managed presigned uploads | Managed service coupling; still verify auth inside `middleware()` on every file router |
11
+ | **Standalone `tus-js-client`** | Large/unreliable-network resumable chunked uploads (`tus` protocol) with custom lightweight UI | Yes (`tus` resumable chunks + fingerprinting) | You own dropzone, file list, and preview UI |
12
+ | **Uppy** (`@uppy/core`, `@uppy/tus`, `@uppy/aws-s3`, `@uppy/dashboard`) | Production multi-file uploads needing pause/resume (`tus`), S3 multipart, webcam/cloud pickers | Yes | Larger bundle if importing full Dashboard + remote plugins; call `uppy.clear()` to reset and `uppy.destroy()` on unmount |
13
+ | **FilePond** | Polished single/multi-image uploads with built-in EXIF rotation, crop, resize, and async previews | Via adapter | Plugin licensing/ecosystem smaller than Uppy for cloud pickers |
14
+ | **react-dropzone** (or native `<input type="file">`) | Lightweight headless drop zones where you own 100% of upload state and styling | No (pair with presigned PUT or `tus-js-client`) | You must implement progress, retry, cancellation, and preview cleanup yourself |
15
+ | **File System Access API** (`showOpenFilePicker`, `showSaveFilePicker`) | Desktop-class local file editors (audio/video/code/design tools) | N/A (local disk) | Chromium-first; always feature-detect and fall back to `<input type="file">` + `<a download>` for Safari/Firefox |
16
+
17
+ ## Verified implementation idioms
18
+
19
+ ### Direct-to-S3 / R2 presigned PUT & standalone `tus-js-client`
20
+
21
+ - **Presigned PUT flow**: request a short-lived signed PUT URL (scoped to exact `contentType`, `contentLength` bounds, and authenticated user key) from your backend, upload bytes directly from the browser via `XMLHttpRequest` (for reliable upload progress events + `xhr.abort()` cancellation across all browsers), then notify your backend to verify the stored object's magic bytes and attach metadata. Never proxy multi-megabyte uploads through serverless API routes with tiny body limits.
22
+ - **Standalone `tus-js-client`**: use `new tus.Upload(file, { endpoint, retryDelays: [0, 1000, 3000, 5000], onProgress, onError, onSuccess })` and call `upload.abort()` on cancel or unmount.
23
+
24
+ ### Uppy restrictions & lifecycle
25
+
26
+ - Configure `restrictions` (`maxFileSize`, `maxTotalFileSize`, `maxNumberOfFiles`, `allowedFileTypes`) upfront so users get immediate feedback before uploading gigabytes.
27
+ - **Security rule**: Uppy's `allowedFileTypes` uses browser `File.type` and filename extensions—treat it as **client UX guidance only**, never authoritative server validation.
28
+ - Call `uppy.clear()` to reset between uploads and `uppy.destroy()` on component unmount (cancels active uploads and removes listeners).
29
+
30
+ ```ts
31
+ import Uppy from '@uppy/core';
32
+ import Tus from '@uppy/tus';
33
+
34
+ const uppy = new Uppy({
35
+ restrictions: {
36
+ maxFileSize: 50 * 1024 * 1024,
37
+ maxNumberOfFiles: 5,
38
+ allowedFileTypes: ['image/jpeg', 'image/png', 'image/webp', 'application/pdf'],
39
+ },
40
+ }).use(Tus, { endpoint: '/api/uploads/tus' });
41
+
42
+ // Cleanup on unmount:
43
+ // uppy.destroy();
44
+ ```
45
+
46
+ ### Previews, clipboard paste, and client-side image compression
47
+
48
+ - **Revoke object URLs**: every `URL.createObjectURL(file)` preview **must** be paired with `URL.revokeObjectURL(url)` on file removal or unmount to prevent multi-hundred-megabyte memory leaks.
49
+ - **Clipboard & drag-drop ergonomics**: support `paste` events (`clipboardData.items`) for screenshots in chat/ticket/editor surfaces, highlight the drop target cleanly on `dragenter`/`dragleave` (using a depth counter or `relatedTarget` check so child elements do not flicker), and always keep a real focusable `<button>` / `<input type="file">` trigger for keyboard and screen-reader users (WCAG 2.1.1 & 2.5.7).
50
+ - **Client-side resize/compress & Safari WebP caveat**: run `createImageBitmap()` + `OffscreenCanvas.convertToBlob(...)` inside a Web Worker so the UI stays responsive. **Safari silently ignores `{ type: 'image/webp' }` on Canvas/`OffscreenCanvas` and returns an uncompressed `image/png` blob instead** (often *larger* than the original photo). Always check `blob.type === 'image/webp'` and fall back to `'image/jpeg'` (or a WASM encoder like `@jsquash/webp`) when WebP encoding is unavailable:
51
+
52
+ ```ts
53
+ let blob = await offscreen.convertToBlob({ type: 'image/webp', quality: 0.85 });
54
+ if (blob.type !== 'image/webp') {
55
+ // Safari silent PNG fallback: re-encode as JPEG to avoid bloated PNG uploads
56
+ blob = await offscreen.convertToBlob({ type: 'image/jpeg', quality: 0.85 });
57
+ }
58
+ ```
59
+
60
+ ## Required upload states
61
+
62
+ Every upload surface must handle: **idle (limits stated upfront)**, **drag-over highlight**, **invalid type/size rejection (specific reason)**, **uploading (per-file progress + cancel)**, **paused/offline (resumable retry)**, **error (retry without re-picking file)**, and **complete (remove/replace action)**.
63
+
64
+ ## Do/don't pairs
65
+
66
+ | Do | Don't |
67
+ |---|---|
68
+ | Upload large binaries directly via S3/R2 presigned PUT, UploadThing, or `tus-js-client` | Proxy 100 MB user uploads through a serverless function with a 4 MB body limit |
69
+ | Check `blob.type === 'image/webp'` after `convertToBlob` and fall back to JPEG on Safari | Assume `convertToBlob({ type: 'image/webp' })` encodes WebP everywhere (Safari silently emits PNG) |
70
+ | State max file size and accepted formats visibly before selection | Reject a 120 MB upload only after a 3-minute transfer completes |
71
+ | Call `URL.revokeObjectURL(url)` when previews unmount or are removed | Leak blob URLs across repeated file selections |
72
+ | Keep a keyboard-focusable file picker trigger alongside drag-and-drop | Build a drag-only dropzone unreachable by keyboard or screen readers |
73
+ | Enforce authoritative MIME/magic-byte checks on the server | Trust client `allowedFileTypes` or `<input accept>` as security |
74
+
75
+ ## Verification commands
76
+
77
+ ```sh
78
+ npm run build
79
+ npx playwright test
80
+ ```
81
+
82
+ Verify file-picker keyboard activation, invalid-type rejection copy, progress/cancel/retry states, Safari JPEG fallback (`blob.type`), and `revokeObjectURL` cleanup in a real browser (`rendered`).
@@ -0,0 +1,123 @@
1
+ # Form frameworks and schema validation
2
+
3
+ Pair this engineering reference with `pixelcraft-ux` (`forms.md`) for UX rules. Choose a form framework by **rendering model (progressive server actions vs client SPA), framework ecosystem, and field-array/async-validation complexity**.
4
+
5
+ ## Form framework decision matrix
6
+
7
+ | Library | Frameworks | Validation & schema model | Best fit |
8
+ |---|---|---|---|
9
+ | **TanStack Form (v1)** | React, Vue, Solid, Svelte, Angular, Lit | Native **Standard Schema** (`Zod v3.24+/v4`, `Valibot`, `ArkType`, `Effect/Schema`) with `onBlur`/`onSubmit` + `onChangeAsyncDebounceMs` | Multi-framework or deeply typed TypeScript apps with nested/async validation |
10
+ | **React Hook Form (v7/v8)** | React | `@hookform/resolvers` (v5+ for Zod v4; `zodResolver`, `valibotResolver`, `yupResolver`, `ajvResolver`) | Client-heavy React forms needing minimal re-renders via uncontrolled `register()` |
11
+ | **Conform** | React (Next.js Server Actions, React Router v7) | `@conform-to/zod/v4` (`parseWithZod` / `getZodConstraint`) or `@conform-to/valibot` | Server-first forms requiring progressive enhancement, `FormData`, and auto-wired ARIA (`getFormProps`/`getInputProps`) |
12
+ | **SvelteKit Superforms** | Svelte 5 / SvelteKit 2 | `superValidate(zod4(schema))` / Valibot / ArkType adapters | Progressive SvelteKit `+page.server.ts` forms with full typed client/server sync and tainted-state guards |
13
+ | **Modular Forms** | Solid, Qwik, Preact | Fine-grained signals + Valibot / Zod adapters | Zero-VDOM and resumable frameworks where tiny bundle size and signal-level updates matter |
14
+ | **VeeValidate (v4)** | Vue 3 | `toTypedSchema(zod/valibot/yup)` + Composition API `useForm` / `defineField` | Vue 3 apps needing typed Composition API bindings and repeatable `useFieldArray` |
15
+ | **Formik** | React (legacy) | Yup / custom validate | Maintenance of existing codebases only; prefer TanStack Form, RHF, or Conform for greenfield |
16
+
17
+ ## Schema libraries, Standard Schema, and Zod v4 migration
18
+
19
+ Prefer **Standard Schema** (`standard-schema.dev` v1) compatible validators so form and server layers share one schema without custom glue:
20
+
21
+ - **Zod v4 (`zod` / `zod/v4-mini`)**: major perf and bundle improvements. Use top-level string format validators (**`z.email()`**, `z.url()`, `z.uuid()`) instead of deprecated `z.string().email()`, import **`zod/v4-mini`** (`z.string().check(z.minLength(3))`) when minimal client bundle size matters, and align adapters (**`@hookform/resolvers` v5+** for RHF and **`@conform-to/zod/v4`** for Conform—do not mix Zod v3 adapters with Zod v4 schemas).
22
+ - **Valibot**: modular tree-shakeable functions—strong default when client bundle budget is tight.
23
+ - **ArkType**: high-performance TypeScript-syntax runtime validation for dense/complex objects.
24
+ - **Ajv**: JSON Schema (Draft 2020-12) compliance when schemas are language-agnostic or contract-driven.
25
+ - **Yup**: legacy ecosystems already standardized on it.
26
+
27
+ ## Verified implementation patterns
28
+
29
+ ```tsx
30
+ // TanStack Form: validate onBlur/onSubmit (not premature first-keystroke), wire label + aria-describedby
31
+ import { useId } from 'react';
32
+ import { z } from 'zod';
33
+
34
+ const usernameSchema = z.string().min(3, 'Enter at least 3 characters');
35
+
36
+ <form.Field
37
+ name="username"
38
+ validators={{
39
+ onBlur: usernameSchema,
40
+ onSubmit: usernameSchema,
41
+ onChangeAsyncDebounceMs: 500,
42
+ onChangeAsync: ({ value, fieldApi }) => {
43
+ if (!fieldApi.state.meta.isTouched) return undefined;
44
+ return checkUsernameAvailable(value).then((ok) => (ok ? undefined : 'Username is already taken'));
45
+ },
46
+ }}
47
+ >
48
+ {(field) => {
49
+ const inputId = useId();
50
+ const errorId = `${inputId}-error`;
51
+ const showError =
52
+ (field.state.meta.isTouched || form.state.isSubmitted) && field.state.meta.errors.length > 0;
53
+ const errorText = showError
54
+ ? typeof field.state.meta.errors[0] === 'string'
55
+ ? field.state.meta.errors[0]
56
+ : field.state.meta.errors[0]?.message
57
+ : undefined;
58
+
59
+ return (
60
+ <div>
61
+ <label htmlFor={inputId}>Username</label>
62
+ <input
63
+ id={inputId}
64
+ name={field.name}
65
+ value={field.state.value}
66
+ autoComplete="username"
67
+ aria-invalid={showError || undefined}
68
+ aria-describedby={errorText ? errorId : undefined}
69
+ onBlur={field.handleBlur}
70
+ onChange={(e) => field.handleChange(e.target.value)}
71
+ />
72
+ {errorText && (
73
+ <p id={errorId} role="alert">
74
+ {errorText}
75
+ </p>
76
+ )}
77
+ </div>
78
+ );
79
+ }}
80
+ </form.Field>
81
+ ```
82
+
83
+ ```tsx
84
+ // React Hook Form: preserve record `id` with `keyName` and never use array `index` as key
85
+ const { fields } = useFieldArray({ control, name: 'items', keyName: 'key' });
86
+ // Render with key={field.key} (RHF v8 uses `field.key` by default; v7 defaults to `field.id`)
87
+ ```
88
+
89
+ ```ts
90
+ // Conform + Zod v4 + Next.js Server Action: single schema validates both client & server
91
+ 'use server';
92
+ import { parseWithZod } from '@conform-to/zod/v4';
93
+ import { z } from 'zod';
94
+
95
+ const profileSchema = z.object({ email: z.email('Enter a valid email address') });
96
+
97
+ export async function saveProfile(_prev: unknown, formData: FormData) {
98
+ const submission = parseWithZod(formData, { schema: profileSchema });
99
+ if (submission.status !== 'success') return submission.reply();
100
+ // persist and redirect or return clean status
101
+ }
102
+ ```
103
+
104
+ ## Multi-step, validation timing, server errors, and draft recovery
105
+
106
+ - **Inline validation timing ("reward early, punish late")**: do not show red error messages on the first keystroke while a user is still typing a valid value (empirical HCI evidence: Seckler et al., CHI '14). Trigger initial field errors on `onBlur` or submit, only render `role="alert"` after `isTouched` or submission, and clear errors promptly once the field becomes valid.
107
+ - **Multi-step wizards**: keep one typed parent schema (or per-step sub-schemas merged on final submit); validate only the active step on `Next`, allow stepping backward without losing values, and mirror step progress in URL/state.
108
+ - **Server validation errors**: map field-level backend errors back to their exact field (`setError` in RHF, `submission.reply({ fieldErrors })` in Conform, `setError` in Superforms) and focus the first invalid field or error summary while preserving every entered value.
109
+ - **Async validation**: always debounce (`300–500 ms`), cancel stale in-flight checks (`AbortSignal` / request token), and show pending state without blocking unrelated fields.
110
+ - **Synchronous submit lock & idempotent create/pay mutations**: guard `onSubmit` with a synchronous ref lock (`submittingRef.current = true` before the first `await`) plus `aria-busy="true"` and an `Idempotency-Key` header on create/billing mutations ([auth-and-checkout-ui.md](auth-and-checkout-ui.md)) so rapid double-Enter or double-click never creates duplicate records.
111
+ - **Autosave & `401` session-expiry draft preservation**: debounce draft writes to `IndexedDB`/Dexie (or `sessionStorage` for tiny non-sensitive payloads), snapshot dirty form values immediately if a submit fails with `401 Unauthorized` prior to re-authentication, clear the draft on confirmed `2xx` persistence, and offer explicit `Restore draft` / `Discard` recovery on return.
112
+
113
+ ## Do/don't pairs
114
+
115
+ | Do | Don't |
116
+ |---|---|
117
+ | Gate `role="alert"` on `isTouched \|\| isSubmitted` and bind `aria-describedby` to the error ID | Fire `onChange` errors on keystroke 1 or leave errors unlinked from the input |
118
+ | Key `useFieldArray` rows by generated `field.key` / `field.id` (`keyName: 'key'` if records have `id`) | Key repeatable form rows by array `index` (corrupts values on delete/reorder) |
119
+ | Match Zod v4 with `z.email()`, `@hookform/resolvers` v5+, and `@conform-to/zod/v4` | Mix Zod v4 schemas into outdated Zod v3 resolver subpaths |
120
+ | Share one Standard Schema between client form validation and server action/endpoint | Duplicate regexes manually in client inputs and backend handlers |
121
+ | Lock submit synchronously before `await`, attach `Idempotency-Key`, and snapshot drafts on `401` | Allow fast double-submits to create duplicate rows or lose long forms on session expiry |
122
+ | Use `defineField` in VeeValidate v4 to bind `aria-invalid` dynamically from field state | Use deprecated `defineComponentBinds` or omit `aria-invalid` / `aria-describedby` |
123
+ | Debounce async validators (`300–500 ms`) and ignore stale responses | Fire an API check on every keystroke without debounce or race protection |
@@ -0,0 +1,54 @@
1
+ # F# Fable: Feliz/Elmish
2
+
3
+ ## Token mapping
4
+
5
+ Use generated CSS variables/semantic classes through Feliz props or imported stylesheets. Keep theme selection in typed domain state when behavior depends on it, but do not duplicate visual constants as untraceable inline F# style lists.
6
+
7
+ ## Layout and responsive idioms
8
+
9
+ Feliz compiles F# to React/browser DOM. Use semantic HTML/CSS layout and explicit responsive behavior. Elmish Model–Update–Msg architecture owns application state; visual composition remains DOM truth.
10
+
11
+ ## Typography/custom fonts
12
+
13
+ Declare webfonts/assets in host HTML/CSS and use semantic classes. Type-safe CSS helpers help correctness but do not choose a voice, fallback chain, scaling behavior, or localization coverage for you.
14
+
15
+ ## Motion/reduced motion
16
+
17
+ Prefer CSS with `@media (prefers-reduced-motion: reduce)`. Use Fable browser interop (`Browser.Dom.window.matchMedia`) only when animation state must depend on the preference. Keep effectful subscriptions explicit in Elmish commands/subs.
18
+
19
+ ## Accessibility specifics
20
+
21
+ Feliz emits React elements; use semantic tags, labels, keyboard handlers, focus management, ARIA only when needed, and visible focus. F# type safety does not verify names/roles or prevent focus loss. Validate generated DOM rather than inferring from types.
22
+
23
+ ## States idiom
24
+
25
+ Elmish excels at explicit state machines. Model loading/empty/error/offline/permission/optimistic state in domain types and reject impossible combinations. Preserve input and validation context across failed commands/navigation.
26
+
27
+ ## Forms idiom
28
+
29
+ Use real forms/labels/types/autocomplete/inputmode and controlled input patterns that preserve cursor/IME composition. Validate at blur/submit boundaries, map server errors to fields, and never discard model input because a command failed.
30
+
31
+ ## Do/don't pairs
32
+
33
+ | Do | Don't |
34
+ |---|---|
35
+ | `Html.button [ prop.type' "submit"; prop.text "Save" ]` | clickable div with no keyboard semantics |
36
+ | explicit Elmish async union states | bool/Maybe combinations permitting impossible UI |
37
+ | `window.matchMedia` reduced-motion check | assuming React/Fable reads OS preference automatically |
38
+ | semantic CSS classes | long repeated inline style lists in every component |
39
+
40
+ ## Known traps
41
+
42
+ Interop impedance mismatch, bundle splitting/startup, typed model divergence from actual server contract, hot reload hiding initialization bugs, focus/caret behavior in controlled inputs, inaccessible imported React components.
43
+
44
+ ## Verification commands
45
+
46
+ ```sh
47
+ dotnet test
48
+ dotnet fable watch src --run npx vite
49
+ dotnet fable src --run npx vite build
50
+ npm test
51
+ npx playwright test
52
+ ```
53
+
54
+ Inspect generated DOM/accessibility tree, browser keyboard/focus behavior, offline/server failure, text scaling/localization, reduced-motion emulation, and production bundle behavior (`rendered`).
@@ -0,0 +1,102 @@
1
+ # GSAP implementation guide
2
+
3
+ Use GSAP when a timeline, coordinated sequence, SVG/plugin capability, or scroll choreography materially improves the interaction. It is not the default for every hover or state change.
4
+
5
+ ## Ownership and setup
6
+
7
+ - Register only the plugins used by the affected route/component (`gsap.registerPlugin(...)`).
8
+ - **GSAP 3.13+ licensing**: starting with GSAP 3.13 (via Webflow), all formerly paid Club GSAP plugins (**SplitText, DrawSVGPlugin, MorphSVGPlugin, ScrollSmoother, Flip, Observer, InertiaPlugin, ScrambleTextPlugin, Physics2DPlugin**) are **100% free** for personal and commercial projects (subject to Webflow's standard no-competing-visual-builder clause). Still check `package.json` on older GSAP ≤ 3.12 codebases before assuming plugin availability.
9
+ - Keep one animation system as the owner of a given element/property. Avoid GSAP and Motion both writing `transform` on the same node.
10
+ - Scope selectors and timelines to the component root and revert all tweens, timelines, ScrollTriggers, and `matchMedia` listeners on teardown.
11
+
12
+ ## Timeline and plugin matrix
13
+
14
+ Use labels for semantic beats such as `intro`, `reveal`, `detail`, `exit`. Keep timelines section-scoped rather than building one giant master timeline for an entire application.
15
+
16
+ | Tool | Use | Key idiom |
17
+ |---|---|---|
18
+ | `gsap.timeline` | Ordered or overlapping sequence with labels and explicit ownership | Attach to a scoped `useGSAP` / `gsap.context` / `gsap.matchMedia` |
19
+ | `ScrollTrigger` | Progress-linked scenes, pinning, scrub, snap, enter/leave callbacks | Define `start`/`end` in content terms; call `ScrollTrigger.refresh()` only after layout-affecting media/fonts settle |
20
+ | `SplitText` (3.13+) | Short headline/editorial text reveals with semantic preservation | Use `SplitText.create(el, { type: 'lines,words', mask: 'lines', autoSplit: true, aria: 'auto', onSplit(self) { ... } })` so screen readers read intact text and resize/font-load re-splits automatically |
21
+ | `Flip` | Smooth layout transitions across DOM/grid/flex changes | `const state = Flip.getState(targets); mutateDOM(); Flip.from(state, { duration: 0.45, ease: 'power2.out', absolute: true });` |
22
+ | `Observer` | Unified wheel/touch/pointer intent gestures | Normalize swipe/drag steps without breaking native page scroll unless explicitly scoped |
23
+ | `gsap.quickTo` | High-frequency pointer/cursor/magnetic tracking | Pre-allocate `const xTo = gsap.quickTo(el, 'x', { duration: 0.25, ease: 'power3' })` once instead of spawning tweens on every `pointermove` |
24
+ | `DrawSVGPlugin` / `MorphSVGPlugin` / `MotionPathPlugin` | SVG stroke progress, shape morphs, and path-aligned motion | Always preserve a legible static SVG fallback and accessible `<title>`/`aria-label` |
25
+ | `gsap.matchMedia` | Responsive and `prefers-reduced-motion` animation variants | Pass `scope` (`gsap.matchMedia(rootRef)` or inside `useGSAP(..., { scope: rootRef })`) so selectors stay component-scoped |
26
+
27
+ ## ScrollTrigger rules
28
+
29
+ - Use normal document flow and native scroll. Pin only when a persistent artifact needs chapter context.
30
+ - Test fast/reverse scroll, scrollbar drag, resize, short viewport height, and late-loading images/fonts.
31
+ - Avoid pinned nested scrollers and competing smooth-scroll engines (see [smooth-scroll.md](smooth-scroll.md) for Lenis / `ScrollSmoother` coordination).
32
+ - Do not make core content unreachable if ScrollTrigger fails or `prefers-reduced-motion: reduce` is enabled.
33
+
34
+ ## Scoped lifecycle & React (`@gsap/react`)
35
+
36
+ **Scoping trap**: calling `const mm = gsap.matchMedia()` *outside* `gsap.context(..., rootRef)` creates an unscoped `matchMedia` context—selector strings like `'.chapter-item'` inside `mm.add(...)` will query the entire `document` and animate other component instances! Pass `rootRef` directly to `gsap.matchMedia(rootRef)` (vanilla/Vue/Svelte/Solid) or use **`useGSAP`** from `@gsap/react` (which scopes both `gsap` and `gsap.matchMedia()` automatically and reverts cleanly under React Strict Mode):
37
+
38
+ ```tsx
39
+ // React: @gsap/react useGSAP (auto-scoped + Strict Mode safe cleanup)
40
+ import { useRef } from 'react';
41
+ import gsap from 'gsap';
42
+ import { ScrollTrigger } from 'gsap/ScrollTrigger';
43
+ import { SplitText } from 'gsap/SplitText';
44
+ import { useGSAP } from '@gsap/react';
45
+
46
+ gsap.registerPlugin(ScrollTrigger, SplitText);
47
+
48
+ export function EditorialChapter() {
49
+ const rootRef = useRef<HTMLElement>(null);
50
+
51
+ useGSAP(
52
+ () => {
53
+ const mm = gsap.matchMedia();
54
+ mm.add('(prefers-reduced-motion: no-preference)', () => {
55
+ SplitText.create('.chapter-heading', {
56
+ type: 'lines',
57
+ mask: 'lines',
58
+ autoSplit: true,
59
+ aria: 'auto',
60
+ onSplit(self) {
61
+ return gsap.from(self.lines, {
62
+ yPercent: 100,
63
+ stagger: 0.08,
64
+ duration: 0.55,
65
+ ease: 'power3.out',
66
+ scrollTrigger: { trigger: rootRef.current, start: 'top 80%', once: true },
67
+ });
68
+ },
69
+ });
70
+ });
71
+ },
72
+ { scope: rootRef },
73
+ );
74
+
75
+ return (
76
+ <section ref={rootRef}>
77
+ <h2 className="chapter-heading">Quarterly release notes</h2>
78
+ </section>
79
+ );
80
+ }
81
+ ```
82
+
83
+ ```ts
84
+ // Framework-agnostic (Vue / Svelte / Solid / Astro / Vanilla): pass scope to matchMedia(rootEl)
85
+ const mm = gsap.matchMedia(rootEl);
86
+ mm.add('(prefers-reduced-motion: no-preference)', () => {
87
+ const xTo = gsap.quickTo('.magnet-target', 'x', { duration: 0.25, ease: 'power3.out' });
88
+ const onMove = (e: PointerEvent) => xTo(gsap.utils.clamp(-12, 12, e.movementX));
89
+ rootEl.addEventListener('pointermove', onMove);
90
+ return () => rootEl.removeEventListener('pointermove', onMove);
91
+ });
92
+ // Teardown: mm.revert();
93
+ ```
94
+
95
+ ## Official references
96
+
97
+ - GSAP docs: https://gsap.com/docs/v3/
98
+ - ScrollTrigger: https://gsap.com/docs/v3/Plugins/ScrollTrigger/
99
+ - SplitText: https://gsap.com/docs/v3/Plugins/SplitText/
100
+ - Flip: https://gsap.com/docs/v3/Plugins/Flip/
101
+ - Observer: https://gsap.com/docs/v3/Plugins/Observer/
102
+ - React guidance (`@gsap/react`): https://gsap.com/resources/React/
@@ -0,0 +1,220 @@
1
+ # HTML + CSS
2
+
3
+ Evidence: WCAG 2.2, logical properties.
4
+
5
+ ## Token mapping
6
+
7
+ Use generated CSS variables verbatim in a semantic layer:
8
+
9
+ ```css
10
+ @import "./tokens.css";
11
+ :root { color-scheme: light dark; }
12
+ body { background: var(--semantic-color-background); color: var(--semantic-color-foreground); }
13
+ ```
14
+
15
+ Do not bypass semantic roles with primitive color variables in component rules. Keep primitive scales available for charts/illustration only.
16
+
17
+ ## Layout and responsive idioms
18
+
19
+ Use semantic HTML structure first, then CSS Grid for two-dimensional composition, flexbox for one-dimensional groups, container queries for component adaptation, and logical properties for direction-sensitive spacing. Prefer `clamp()` and intrinsic sizing over hard breakpoints alone. Restructure at narrow widths rather than scaling a desktop mockup.
20
+
21
+ For an editorial or commerce shell, separate the primary task or active state from the destination index. If inline navigation becomes a disclosure on touch, consider keeping booking, a cart count, or the current chapter exposed outside it. Keep the same destination and state across layouts. Test the closed and open menu at phone portrait and landscape: reach the primary action, dismiss the menu with the supported inputs, and confirm focus returns to its trigger. If the scene cannot fit in a shallow viewport, use a purposeful crop or a static composition instead of burying the action below empty scene space.
22
+
23
+ ## Typography, self-hosted WOFF2 & fallback metric matching
24
+
25
+ Self-host subsetted variable or static `.woff2` files (`<= 2–3` font files total on the critical path; preload only primary above-the-fold faces with `<link rel="preload" as="font" type="font/woff2" crossorigin>`). Pair `font-display: swap` (or `optional` on fast repeat-visit apps) with explicit `@font-face` metric overrides on a local system fallback so glyph swap causes **zero CLS**:
26
+
27
+ ```css
28
+ @font-face {
29
+ font-family: "Brand Sans";
30
+ src: url("/fonts/brand-sans-latin.woff2") format("woff2");
31
+ font-weight: 300 700;
32
+ font-display: swap;
33
+ }
34
+
35
+ @font-face {
36
+ font-family: "Brand Sans Fallback";
37
+ src: local("Inter"), local("Segoe UI"), local("Arial");
38
+ size-adjust: 101.4%;
39
+ ascent-override: 96%;
40
+ descent-override: 24%;
41
+ line-gap-override: 0%;
42
+ }
43
+
44
+ :root {
45
+ --font-sans: "Brand Sans", "Brand Sans Fallback", system-ui, sans-serif;
46
+ }
47
+ ```
48
+
49
+ Control reading measure with `max-inline-size: 65ch`–`75ch` rather than arbitrary wide containers.
50
+
51
+ ## Motion/reduced motion
52
+
53
+ Use CSS transitions/animations only for purposeful transform/opacity/state change. Gate motion:
54
+
55
+ ```css
56
+ @media (prefers-reduced-motion: no-preference) {
57
+ .panel { transition: opacity 160ms ease-out, translate 160ms ease-out; }
58
+ }
59
+ ```
60
+
61
+ JavaScript should query `matchMedia('(prefers-reduced-motion: reduce)')` when motion is imperative.
62
+
63
+ If a static poster replaces a decorative scene, make that decision before starting its JS, video, or GPU work when the task does not need it. Keep the poster and live semantic content independent of the scene bundle. A small or reduced-motion layout that looks static can still download and initialize the desktop effect.
64
+
65
+ ## Modern browser-native craft idioms
66
+
67
+ Use progressive, zero-dependency CSS and HTML capabilities before importing JS animation or positioning libraries:
68
+
69
+ - **Top-layer overlays (`[popover]` + `<dialog>`) with CSS Anchor Positioning**: let the browser manage top-layer stacking, light-dismiss (`<dialog closedby="any">`), and flip fallbacks instead of manual `z-index` ladders or JS positioning engines. Always reset `margin: 0` on anchored popovers because the UA stylesheet defaults `[popover]` to `margin: auto`, which centers it in the viewport and overrides anchor placement.
70
+ - **Invoker Commands (`commandfor` / `command`)**: open/close dialogs (`command="show-modal"`, `command="close"`) and toggle popovers declaratively from `<button commandfor="filters-dialog" command="show-modal">` without glue JS (fall back to `popovertarget` or a small click listener where older browsers are in scope).
71
+ - **Customizable `<select>`**: opt into `appearance: base-select` on `select` and `::picker(select)` when styled dropdowns need native keyboard navigation, form participation, and top-layer placement without building a custom ARIA listbox from scratch.
72
+ - **Exclusive accordions**: group native `<details name="faq-group">` elements so opening one closes siblings with zero JavaScript.
73
+ - **Discrete & intrinsic-size transitions**: combine `@starting-style` and `transition-behavior: allow-discrete` for `<dialog>`/`[popover]`, and use `interpolate-size: allow-keywords` or `calc-size(auto, size)` for smooth `height: 0` → `auto` disclosure reveals (gated behind reduced-motion checks).
74
+ - **Scroll-driven progress**: gate `animation-timeline: view()` / `scroll()` behind both `@supports (animation-timeline: view())` and `@media (prefers-reduced-motion: no-preference)`; keep the final layout readable without animation.
75
+ - **Scoped cascade & self-adapting slots**: organize resets/tokens/components/utilities with `@layer`, isolate subtree styling with `@scope (.card) to (.card-slot)`, use `container-type: inline-size` with `@container` queries, `:has()` for parent state styling, and `field-sizing: content` for auto-growing inputs/textareas.
76
+ - **Perceptual color & theme derivation**: use `light-dark(var(--light), var(--dark))` with `color-scheme: light dark`, `color-mix(in oklch, ...)` for state mixes, and relative color syntax (`oklch(from var(--semantic-color-action) calc(l - 0.08) c h)`) for predictable hover/active ramps.
77
+ - **Typographic rag & viewport stability**: apply `text-wrap: balance` on short headings, `text-wrap: pretty` on body copy, `svh`/`dvh` instead of `100vh` on mobile, and `scrollbar-gutter: stable` on scrolling regions.
78
+ - **Native navigation & prefetching**: prefer the **Navigation API** (`window.navigation`) over fragile `history.pushState`/`popstate` wrappers in modern SPA routers, and use `<script type="speculationrules">` (`prefetch`/`prerender` with `eagerness: "moderate"`) for near-instant MPA navigations instead of speculative JS fetches.
79
+
80
+ ```css
81
+ /* Cascade layering and semantic light/dark derivation */
82
+ @layer reset, tokens, base, components, utilities;
83
+
84
+ @layer tokens {
85
+ :root {
86
+ color-scheme: light dark;
87
+ --surface-raised: light-dark(oklch(99% 0.005 260), oklch(22% 0.01 260));
88
+ --action-hover: oklch(from var(--semantic-color-action) calc(l - 0.07) c h);
89
+ }
90
+ }
91
+
92
+ /* Native anchored popover with margin: 0 reset and discrete entry/exit transition */
93
+ .menu-trigger { anchor-name: --menu-btn; }
94
+
95
+ .menu-panel[popover] {
96
+ margin: 0;
97
+ position-anchor: --menu-btn;
98
+ position-area: block-end span-inline-end;
99
+ position-try-fallbacks: flip-block, flip-inline;
100
+ opacity: 0;
101
+ translate: 0 -4px;
102
+ scale: 0.98;
103
+ }
104
+
105
+ @media (prefers-reduced-motion: no-preference) {
106
+ .menu-panel[popover] {
107
+ transition:
108
+ opacity 150ms ease-out,
109
+ translate 150ms ease-out,
110
+ scale 150ms ease-out,
111
+ display 150ms ease-out allow-discrete,
112
+ overlay 150ms ease-out allow-discrete;
113
+ }
114
+ }
115
+
116
+ .menu-panel[popover]:popover-open {
117
+ opacity: 1;
118
+ translate: 0 0;
119
+ scale: 1;
120
+ }
121
+
122
+ @starting-style {
123
+ .menu-panel[popover]:popover-open {
124
+ opacity: 0;
125
+ translate: 0 -4px;
126
+ scale: 0.98;
127
+ }
128
+ }
129
+
130
+ /* Customizable native <select> (progressive enhancement) */
131
+ @supports (appearance: base-select) {
132
+ select.styled-select,
133
+ select.styled-select::picker(select) {
134
+ appearance: base-select;
135
+ }
136
+ }
137
+
138
+ /* Container-driven card adaptation and @scope isolation */
139
+ .card-slot { container-type: inline-size; }
140
+ @scope (.card) to (.card-slot) {
141
+ @container (inline-size >= 28rem) {
142
+ :scope { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 1rem; }
143
+ }
144
+ }
145
+ ```
146
+
147
+ ## Accessibility, skip links & cascade discipline
148
+
149
+ Native elements carry most semantics: `button`, `a`, `form`, `label`, `input`, `select`, `table`, headings, landmarks. Do not use positive `tabindex`; use DOM order. Use `<dialog>`/`[popover]`/`inert` patterns carefully and restore focus. Validate names/roles/status behavior in the accessibility tree.
150
+
151
+ - **Mandatory `Skip to main content` link**: render `<a class="skip-link" href="#main-content">Skip to main content</a>` as the very first focusable element inside `<body>`, visually clipped off-screen until `:focus-visible`, jumping directly to `<main id="main-content" tabindex="-1">` so keyboard and switch users bypass repetitive headers (WCAG 2.4.1).
152
+ - **Zero `!important` cascade sprawl**: govern specificity with an explicit `@layer reset, tokens, base, components, utilities;` declaration order and semantic tokens—never patch component rules with ad-hoc `!important` overrides.
153
+
154
+ ```css
155
+ .skip-link {
156
+ position: fixed;
157
+ inset-block-start: 0.75rem;
158
+ inset-inline-start: 0.75rem;
159
+ z-index: 9999;
160
+ padding: 0.625rem 1rem;
161
+ background: var(--semantic-color-background);
162
+ color: var(--semantic-color-foreground);
163
+ border: 2px solid var(--semantic-color-action);
164
+ translate: 0 -200%;
165
+ }
166
+ .skip-link:focus-visible { translate: 0 0; }
167
+ ```
168
+
169
+ ## States, custom `404` / `500` recovery routes & `@media print`
170
+
171
+ Use real elements/classes and server/client state consistently: `hidden`, `disabled`, `aria-disabled` only when focus must remain, `role="status"` for nonintrusive async completion, skeleton containers with stable dimensions, and explicit empty/error markup rather than blank containers.
172
+
173
+ - **Custom branded `404` & `500` recovery surfaces**: never leave default framework/CDN error screens in production. Ship a branded `404` route (states what is missing, preserves site search / top category links, and offers a clear primary return CTA with HTTP `404` status) and a zero-dependency static-safe `500` route / root error boundary (shows human recovery copy, retry button, support contact, and copyable request/correlation ID without relying on the broken API).
174
+ - **Print stylesheet (`@media print`)**: provide clean print styling for articles, documentation, invoices, order receipts, and booking confirmations—hide navbars, footers, sticky toolbars, cookie banners, and chat launchers; force high-contrast black ink on white paper even if the user is in dark mode; expand scroll containers; and prevent page-break slicing across tables, receipts, and code blocks:
175
+
176
+ ```css
177
+ @media print {
178
+ @page { margin: 15mm; }
179
+ :root, body { background: #fff; color: #000; color-scheme: light; }
180
+ header, nav, footer, aside, .skip-link, [data-print-hidden], dialog, [popover] { display: none; }
181
+ main { max-inline-size: none; padding: 0; overflow: visible; }
182
+ table, figure, pre, blockquote, .invoice-summary { break-inside: avoid; }
183
+ h1, h2, h3 { break-after: avoid; }
184
+ }
185
+ ```
186
+
187
+ ## Forms idiom
188
+
189
+ Use one persistent `label`, correct `type`, `inputmode`, `autocomplete`, spellcheck/autocapitalize settings, constraint validation only where appropriate, and server error association through text near the field plus summary for complex forms. Never block paste.
190
+
191
+ ## Do/don't pairs
192
+
193
+ | Do | Don't |
194
+ |---|---|
195
+ | `<button type="button">Save draft</button>` | `<div onclick="save()">Save draft</div>` |
196
+ | Render `<a class="skip-link" href="#main-content">` first in `<body>` and order CSS via `@layer` | Force keyboard users through 25 nav links or fight specificity with `!important` |
197
+ | Self-host `<= 2–3` subsetted `.woff2` files with `@font-face` `size-adjust` / `ascent-override` | Load 6 unsubsetted Google Font weights that shift layout on swap |
198
+ | Ship branded `404`/`500` recovery routes and `@media print` rules for receipts/articles/docs | Leave raw stack traces/framework `404`s or print dark-mode navbars over invoices |
199
+ | `margin-inline-start: var(--space-4);` | `margin-left: var(--space-4);` for direction-neutral layout |
200
+ | Gate decorative/parallax motion inside `@media (prefers-reduced-motion: no-preference)` while keeping subtle functional opacity/progress feedback | Global `* { animation: none !important; transition: none !important; }` that kills progress spinners, focus feedback, and state transitions |
201
+ | Reset `margin: 0` on anchored `[popover]` panels using `position-anchor` | Omit `margin: 0` and let UA `margin: auto` recenter the popover off its anchor |
202
+ | `<label for="email">Email</label><input id="email" autocomplete="email">` | `<input placeholder="Email">` as the only label |
203
+ | `grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);` | fixed pixel columns that overflow/clip localized content |
204
+
205
+ ## Known traps
206
+
207
+ `100vh` on mobile browsers, missing `margin: 0` on anchored `[popover]`, sticky/fixed chrome obscuring focus, unguarded `appearance: base-select` without checking older browser fallback, specificity wars solved better by `@layer`, missing `Skip to main content` link, broken dark-mode printouts, autofocus as a substitute for flow design, duplicated IDs from reused fragments, logical/physical mismatch in charts and media controls.
208
+
209
+ ## Verification commands
210
+
211
+ Use the project's actual toolchain; typical commands:
212
+
213
+ ```sh
214
+ npx playwright test
215
+ npx axe <url-or-file>
216
+ npx lighthouse <url> --only-categories=accessibility,performance
217
+ npm run test -- --run
218
+ ```
219
+
220
+ Rendered evidence requires a real browser/device or trace/screenshot inspection, not merely a successful build.