@thanhnguyxn/pixelcraft 0.1.0 → 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 (376) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.antigravity-plugin/plugin.json +32 -0
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/.claude-plugin/plugin.json +15 -4
  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/README.md +185 -328
  13. package/SECURITY.md +28 -0
  14. package/assets/pixelcraft-logo-128.png +0 -0
  15. package/assets/pixelcraft-logo-256.png +0 -0
  16. package/bin/pixelcraft.mjs +431 -23
  17. package/docs/ARCHITECTURE.md +40 -37
  18. package/docs/DESIGN-RATIONALE.md +51 -3
  19. package/docs/INSTALL.md +221 -0
  20. package/evals/README.md +16 -6
  21. package/evals/fixtures/3d-web-engineering.json +69 -0
  22. package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
  23. package/evals/fixtures/ai-ui-libraries.json +53 -0
  24. package/evals/fixtures/audio-visual-accessibility.json +69 -0
  25. package/evals/fixtures/auth-and-checkout-ui.json +53 -0
  26. package/evals/fixtures/brandkit-identity-governance.json +48 -0
  27. package/evals/fixtures/build-and-architecture.json +53 -0
  28. package/evals/fixtures/canvas-and-node-editors.json +53 -0
  29. package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
  30. package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
  31. package/evals/fixtures/component-systems.json +53 -0
  32. package/evals/fixtures/component-testing.json +53 -0
  33. package/evals/fixtures/constrained-voice-and-tv.json +43 -0
  34. package/evals/fixtures/creative-code-rendering.json +69 -0
  35. package/evals/fixtures/creative-reference-evidence.json +67 -0
  36. package/evals/fixtures/data-app-python-marimo.json +49 -0
  37. package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
  38. package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
  39. package/evals/fixtures/desktop-native-workspace.json +48 -0
  40. package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
  41. package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
  42. package/evals/fixtures/document-rust-typst-invoice.json +49 -0
  43. package/evals/fixtures/document-typst-and-print-css.json +43 -0
  44. package/evals/fixtures/email-mjml-dark-mode.json +49 -0
  45. package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
  46. package/evals/fixtures/enterprise-data-ui.json +53 -0
  47. package/evals/fixtures/extended-tui-toolkits.json +53 -0
  48. package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
  49. package/evals/fixtures/file-upload-media-ui.json +53 -0
  50. package/evals/fixtures/forms-validation.json +53 -0
  51. package/evals/fixtures/game-go-ebitengine.json +49 -0
  52. package/evals/fixtures/game-godot-gdscript.json +49 -0
  53. package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
  54. package/evals/fixtures/i18n-engineering.json +53 -0
  55. package/evals/fixtures/local-first-sync.json +53 -0
  56. package/evals/fixtures/lynxjs.json +53 -0
  57. package/evals/fixtures/maizzle-email.json +53 -0
  58. package/evals/fixtures/maps-geospatial.json +53 -0
  59. package/evals/fixtures/media-og-and-video-export.json +43 -0
  60. package/evals/fixtures/media-players.json +53 -0
  61. package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
  62. package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
  63. package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
  64. package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
  65. package/evals/fixtures/mobile-jetpack-compose.json +49 -0
  66. package/evals/fixtures/mobile-swiftui-ios.json +49 -0
  67. package/evals/fixtures/motion-engineering.json +69 -0
  68. package/evals/fixtures/pdfjs-and-pptx.json +53 -0
  69. package/evals/fixtures/plan-discovery-interview.json +31 -0
  70. package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
  71. package/evals/fixtures/reactive-data-apps.json +53 -0
  72. package/evals/fixtures/review-evidence-audit.json +43 -0
  73. package/evals/fixtures/rich-text-and-code-editors.json +53 -0
  74. package/evals/fixtures/scrollytelling-resilience.json +70 -0
  75. package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
  76. package/evals/fixtures/state-architecture.json +53 -0
  77. package/evals/fixtures/styling-ecosystem.json +53 -0
  78. package/evals/fixtures/token-tooling.json +53 -0
  79. package/evals/fixtures/tui-go-bubbletea.json +49 -0
  80. package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
  81. package/evals/fixtures/tui-rust-ratatui.json +49 -0
  82. package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
  83. package/evals/fixtures/web-3d-engines.json +53 -0
  84. package/evals/fixtures/web-php-laravel-filament.json +49 -0
  85. package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
  86. package/evals/pixelcraft-accessibility.md +17 -0
  87. package/evals/pixelcraft-craft.md +16 -0
  88. package/evals/pixelcraft-dataviz.md +3 -3
  89. package/evals/pixelcraft-direction.md +17 -0
  90. package/evals/pixelcraft-game-ui.md +3 -3
  91. package/evals/pixelcraft-mobile.md +3 -3
  92. package/evals/pixelcraft-patterns.md +16 -0
  93. package/evals/pixelcraft-plan.md +65 -3
  94. package/evals/pixelcraft-review.md +3 -3
  95. package/evals/pixelcraft-visual-qa.md +11 -5
  96. package/evals/pixelcraft-web.md +21 -3
  97. package/evals/pixelcraft.md +4 -4
  98. package/gemini-extension.json +3 -2
  99. package/install.ps1 +57 -11
  100. package/install.sh +82 -7
  101. package/package.json +32 -4
  102. package/plugin.json +6 -1
  103. package/scripts/build-adapters.mjs +11 -13
  104. package/scripts/run-evals.mjs +397 -0
  105. package/scripts/sync-docs.mjs +381 -0
  106. package/scripts/test-build-adapters.mjs +14 -1
  107. package/scripts/test-cross-platform-qa.mjs +359 -0
  108. package/scripts/test-distribution.mjs +86 -7
  109. package/scripts/test-export-tokens.mjs +259 -3
  110. package/scripts/test-finish-gate.mjs +133 -10
  111. package/scripts/test-installers.mjs +155 -6
  112. package/scripts/test-shoot.mjs +23 -1
  113. package/scripts/test-slop-scan.mjs +390 -3
  114. package/scripts/test-style-inventory.mjs +23 -0
  115. package/scripts/test-sync-docs.mjs +140 -0
  116. package/scripts/test-validate-skills.mjs +82 -4
  117. package/scripts/validate-skills.mjs +149 -3
  118. package/skills/pixelcraft/SKILL.md +67 -47
  119. package/skills/pixelcraft/references/design-brief.md +2 -2
  120. package/skills/pixelcraft/references/floor.md +36 -19
  121. package/skills/pixelcraft/references/report-template.md +25 -11
  122. package/skills/pixelcraft/references/stack-detection.md +138 -67
  123. package/skills/pixelcraft/references/surface-acceptance.md +33 -21
  124. package/skills/pixelcraft/references/workflow-checkpoints.md +49 -7
  125. package/skills/pixelcraft-accessibility/SKILL.md +34 -13
  126. package/skills/pixelcraft-accessibility/references/apg-patterns.md +13 -0
  127. package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
  128. package/skills/pixelcraft-accessibility/references/platforms.md +34 -6
  129. package/skills/pixelcraft-accessibility/references/verification.md +15 -10
  130. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +38 -5
  131. package/skills/pixelcraft-brandkit/SKILL.md +42 -30
  132. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +90 -50
  133. package/skills/pixelcraft-brandkit/references/brand-governance.md +29 -27
  134. package/skills/pixelcraft-brandkit/references/logo-methods.md +33 -34
  135. package/skills/pixelcraft-brandkit/references/prompt-template.md +53 -51
  136. package/skills/pixelcraft-brandkit/references/qa-checklist.md +7 -2
  137. package/skills/pixelcraft-brandkit/references/visual-modes.md +16 -16
  138. package/skills/pixelcraft-chat-ui/SKILL.md +31 -27
  139. package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
  140. package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
  141. package/skills/pixelcraft-chat-ui/references/conversation-design.md +12 -6
  142. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +58 -68
  143. package/skills/pixelcraft-chat-ui/references/slack-discord.md +60 -76
  144. package/skills/pixelcraft-constrained/SKILL.md +21 -20
  145. package/skills/pixelcraft-constrained/references/specialized-hardware.md +69 -45
  146. package/skills/pixelcraft-constrained/references/tv-wearables.md +123 -73
  147. package/skills/pixelcraft-constrained/references/voice-ui.md +86 -45
  148. package/skills/pixelcraft-craft/SKILL.md +29 -15
  149. package/skills/pixelcraft-craft/references/color.md +62 -6
  150. package/skills/pixelcraft-craft/references/layout.md +32 -0
  151. package/skills/pixelcraft-craft/references/motion.md +99 -12
  152. package/skills/pixelcraft-craft/references/typography.md +48 -9
  153. package/skills/pixelcraft-data-apps/SKILL.md +50 -31
  154. package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
  155. package/skills/pixelcraft-data-apps/references/dash.md +87 -31
  156. package/skills/pixelcraft-data-apps/references/evidence.md +41 -26
  157. package/skills/pixelcraft-data-apps/references/gradio.md +65 -27
  158. package/skills/pixelcraft-data-apps/references/julia-genie.md +64 -29
  159. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +65 -27
  160. package/skills/pixelcraft-data-apps/references/nicegui.md +73 -34
  161. package/skills/pixelcraft-data-apps/references/observable-framework.md +65 -27
  162. package/skills/pixelcraft-data-apps/references/panel.md +69 -23
  163. package/skills/pixelcraft-data-apps/references/r-shiny.md +104 -34
  164. package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
  165. package/skills/pixelcraft-data-apps/references/reflex.md +85 -31
  166. package/skills/pixelcraft-data-apps/references/shiny.md +84 -27
  167. package/skills/pixelcraft-data-apps/references/streamlit.md +73 -25
  168. package/skills/pixelcraft-dataviz/SKILL.md +21 -24
  169. package/skills/pixelcraft-dataviz/references/color-accessibility.md +2 -2
  170. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +35 -25
  171. package/skills/pixelcraft-dataviz/references/libraries.md +165 -46
  172. package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
  173. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +58 -65
  174. package/skills/pixelcraft-desktop/SKILL.md +61 -39
  175. package/skills/pixelcraft-desktop/references/appkit.md +60 -26
  176. package/skills/pixelcraft-desktop/references/avalonia.md +65 -29
  177. package/skills/pixelcraft-desktop/references/cpp-gui.md +104 -27
  178. package/skills/pixelcraft-desktop/references/electron.md +68 -26
  179. package/skills/pixelcraft-desktop/references/go-gui.md +59 -30
  180. package/skills/pixelcraft-desktop/references/gtk.md +74 -31
  181. package/skills/pixelcraft-desktop/references/javafx-swing.md +54 -25
  182. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +57 -30
  183. package/skills/pixelcraft-desktop/references/rust-gui.md +59 -41
  184. package/skills/pixelcraft-desktop/references/tauri.md +80 -24
  185. package/skills/pixelcraft-desktop/references/uno-platform.md +42 -23
  186. package/skills/pixelcraft-desktop/references/winui-wpf.md +66 -26
  187. package/skills/pixelcraft-desktop/references/working-context.md +82 -3
  188. package/skills/pixelcraft-direction/SKILL.md +48 -82
  189. package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
  190. package/skills/pixelcraft-direction/references/direction-card.md +11 -1
  191. package/skills/pixelcraft-direction/references/direction-scoring.md +5 -1
  192. package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
  193. package/skills/pixelcraft-direction/references/movements.md +3 -0
  194. package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
  195. package/skills/pixelcraft-direction/references/slop-fingerprints.md +32 -7
  196. package/skills/pixelcraft-document/SKILL.md +27 -23
  197. package/skills/pixelcraft-document/references/archetypes.md +27 -4
  198. package/skills/pixelcraft-document/references/pdf-tools.md +241 -81
  199. package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
  200. package/skills/pixelcraft-document/references/print-css.md +96 -43
  201. package/skills/pixelcraft-document/references/slides.md +123 -27
  202. package/skills/pixelcraft-email/SKILL.md +42 -20
  203. package/skills/pixelcraft-email/references/client-quirks.md +101 -33
  204. package/skills/pixelcraft-email/references/html-tables.md +83 -22
  205. package/skills/pixelcraft-email/references/maizzle.md +54 -0
  206. package/skills/pixelcraft-email/references/mjml.md +13 -11
  207. package/skills/pixelcraft-email/references/react-email.md +76 -34
  208. package/skills/pixelcraft-extensions/SKILL.md +32 -27
  209. package/skills/pixelcraft-extensions/references/browser-extensions.md +91 -17
  210. package/skills/pixelcraft-extensions/references/figma-office.md +97 -14
  211. package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
  212. package/skills/pixelcraft-extensions/references/raycast.md +90 -11
  213. package/skills/pixelcraft-extensions/references/vscode-webviews.md +91 -17
  214. package/skills/pixelcraft-game-ui/SKILL.md +45 -26
  215. package/skills/pixelcraft-game-ui/references/bevy.md +69 -31
  216. package/skills/pixelcraft-game-ui/references/godot.md +100 -27
  217. package/skills/pixelcraft-game-ui/references/hud-principles.md +50 -21
  218. package/skills/pixelcraft-game-ui/references/love2d.md +53 -27
  219. package/skills/pixelcraft-game-ui/references/monogame.md +45 -29
  220. package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
  221. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +69 -27
  222. package/skills/pixelcraft-game-ui/references/unreal-umg.md +53 -26
  223. package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
  224. package/skills/pixelcraft-handoff/SKILL.md +14 -13
  225. package/skills/pixelcraft-handoff/references/design-translation.md +40 -10
  226. package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
  227. package/skills/pixelcraft-media/SKILL.md +20 -23
  228. package/skills/pixelcraft-media/references/banners-video.md +83 -65
  229. package/skills/pixelcraft-media/references/og-generation.md +110 -63
  230. package/skills/pixelcraft-media/references/social-cards.md +57 -58
  231. package/skills/pixelcraft-mobile/SKILL.md +53 -36
  232. package/skills/pixelcraft-mobile/references/dotnet-maui.md +62 -34
  233. package/skills/pixelcraft-mobile/references/flet.md +53 -26
  234. package/skills/pixelcraft-mobile/references/flutter.md +76 -32
  235. package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
  236. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +48 -26
  237. package/skills/pixelcraft-mobile/references/jetpack-compose.md +92 -24
  238. package/skills/pixelcraft-mobile/references/kivy.md +54 -31
  239. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +53 -27
  240. package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
  241. package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
  242. package/skills/pixelcraft-mobile/references/react-native-expo.md +66 -31
  243. package/skills/pixelcraft-mobile/references/swiftui.md +158 -28
  244. package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
  245. package/skills/pixelcraft-mobile/references/task-state-composition.md +82 -2
  246. package/skills/pixelcraft-mobile/references/uikit.md +57 -23
  247. package/skills/pixelcraft-patterns/SKILL.md +30 -13
  248. package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
  249. package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
  250. package/skills/pixelcraft-patterns/references/auth-onboarding.md +32 -13
  251. package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
  252. package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
  253. package/skills/pixelcraft-patterns/references/commerce.md +35 -16
  254. package/skills/pixelcraft-patterns/references/communication.md +34 -15
  255. package/skills/pixelcraft-patterns/references/creative-tools.md +30 -17
  256. package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
  257. package/skills/pixelcraft-patterns/references/dashboard-admin.md +22 -18
  258. package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
  259. package/skills/pixelcraft-patterns/references/marketing.md +31 -19
  260. package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
  261. package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
  262. package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
  263. package/skills/pixelcraft-patterns/references/pattern-selection.md +8 -2
  264. package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
  265. package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
  266. package/skills/pixelcraft-patterns/references/settings.md +40 -12
  267. package/skills/pixelcraft-plan/SKILL.md +54 -18
  268. package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
  269. package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
  270. package/skills/pixelcraft-plan/references/plan-template.md +44 -9
  271. package/skills/pixelcraft-plan/references/repo-discovery.md +16 -9
  272. package/skills/pixelcraft-plan/references/stack-freshness.md +22 -5
  273. package/skills/pixelcraft-plan/references/stack-selection.md +65 -9
  274. package/skills/pixelcraft-review/SKILL.md +41 -19
  275. package/skills/pixelcraft-review/references/audit-report.md +20 -1
  276. package/skills/pixelcraft-review/references/heuristics.md +63 -18
  277. package/skills/pixelcraft-review/references/personas.md +41 -14
  278. package/skills/pixelcraft-review/references/polish.md +66 -26
  279. package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
  280. package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
  281. package/skills/pixelcraft-review/scripts/slop-scan.mjs +679 -32
  282. package/skills/pixelcraft-spatial/SKILL.md +16 -17
  283. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +25 -84
  284. package/skills/pixelcraft-spatial/references/platforms.md +123 -53
  285. package/skills/pixelcraft-tokens/SKILL.md +18 -14
  286. package/skills/pixelcraft-tokens/assets/tokens.example.json +1 -1
  287. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +1 -1
  288. package/skills/pixelcraft-tokens/references/format.md +39 -9
  289. package/skills/pixelcraft-tokens/references/governance.md +1 -1
  290. package/skills/pixelcraft-tokens/references/theme-presets.md +36 -8
  291. package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
  292. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +637 -75
  293. package/skills/pixelcraft-tui/SKILL.md +41 -25
  294. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +49 -30
  295. package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
  296. package/skills/pixelcraft-tui/references/ink.md +77 -28
  297. package/skills/pixelcraft-tui/references/ratatui.md +70 -30
  298. package/skills/pixelcraft-tui/references/rich.md +53 -33
  299. package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
  300. package/skills/pixelcraft-tui/references/textual.md +75 -34
  301. package/skills/pixelcraft-ux/SKILL.md +22 -12
  302. package/skills/pixelcraft-ux/references/feedback-performance.md +39 -19
  303. package/skills/pixelcraft-ux/references/forms.md +57 -3
  304. package/skills/pixelcraft-ux/references/i18n.md +50 -12
  305. package/skills/pixelcraft-ux/references/laws.md +35 -14
  306. package/skills/pixelcraft-ux/references/state-matrix.md +15 -1
  307. package/skills/pixelcraft-ux/references/ux-writing.md +1 -0
  308. package/skills/pixelcraft-visual-qa/SKILL.md +21 -7
  309. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +28 -7
  310. package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
  311. package/skills/pixelcraft-visual-qa/references/capture-email.md +13 -9
  312. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +20 -5
  313. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +6 -2
  314. package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
  315. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +25 -12
  316. package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
  317. package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
  318. package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
  319. package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
  320. package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
  321. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +50 -11
  322. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +214 -59
  323. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +121 -49
  324. package/skills/pixelcraft-web/SKILL.md +105 -49
  325. package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
  326. package/skills/pixelcraft-web/references/adaptive-layout.md +52 -8
  327. package/skills/pixelcraft-web/references/angular.md +63 -16
  328. package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
  329. package/skills/pixelcraft-web/references/astro.md +64 -13
  330. package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
  331. package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
  332. package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
  333. package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
  334. package/skills/pixelcraft-web/references/clojurescript.md +52 -17
  335. package/skills/pixelcraft-web/references/component-systems.md +102 -0
  336. package/skills/pixelcraft-web/references/component-testing.md +170 -0
  337. package/skills/pixelcraft-web/references/creative-effects.md +59 -0
  338. package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
  339. package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
  340. package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
  341. package/skills/pixelcraft-web/references/forms-validation.md +123 -0
  342. package/skills/pixelcraft-web/references/fsharp-fable.md +3 -2
  343. package/skills/pixelcraft-web/references/gsap.md +102 -0
  344. package/skills/pixelcraft-web/references/html-css.md +144 -12
  345. package/skills/pixelcraft-web/references/htmx-alpine.md +68 -18
  346. package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
  347. package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
  348. package/skills/pixelcraft-web/references/java-web.md +27 -18
  349. package/skills/pixelcraft-web/references/kotlin-web.md +6 -2
  350. package/skills/pixelcraft-web/references/leptos-yew.md +62 -19
  351. package/skills/pixelcraft-web/references/lit-web-components.md +4 -2
  352. package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
  353. package/skills/pixelcraft-web/references/media-players.md +104 -0
  354. package/skills/pixelcraft-web/references/motion-react.md +96 -0
  355. package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
  356. package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
  357. package/skills/pixelcraft-web/references/pwa.md +6 -1
  358. package/skills/pixelcraft-web/references/qwik.md +51 -11
  359. package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
  360. package/skills/pixelcraft-web/references/react-next.md +112 -13
  361. package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
  362. package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
  363. package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
  364. package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
  365. package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
  366. package/skills/pixelcraft-web/references/server-rendered.md +106 -63
  367. package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
  368. package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
  369. package/skills/pixelcraft-web/references/solid.md +67 -16
  370. package/skills/pixelcraft-web/references/state-architecture.md +107 -0
  371. package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
  372. package/skills/pixelcraft-web/references/svelte.md +61 -11
  373. package/skills/pixelcraft-web/references/tailwind.md +40 -14
  374. package/skills/pixelcraft-web/references/video-media.md +69 -0
  375. package/skills/pixelcraft-web/references/vue-nuxt.md +37 -13
  376. package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
@@ -0,0 +1,104 @@
1
+ # Audio and video player engineering
2
+
3
+ Choose a media playback library by **streaming protocol (MP4/WebM vs HLS/DASH/MoQ), DRM requirement, custom UI ownership, and audio DSP/waveform needs**. Pair this reference with [video-media.md](video-media.md), [audio-reactive.md](audio-reactive.md), and [accessibility-performance.md](accessibility-performance.md). Never autoplay unmuted audio, and always include synchronized captions (`<track kind="captions">`) and keyboard-accessible controls (WCAG 1.2.2 & 2.1.1).
4
+
5
+ ## Player & audio engine decision matrix
6
+
7
+ | Category | Tools | Protocols / model | Best fit | Primary trade-off |
8
+ |---|---|---|---|---|
9
+ | **Modern accessible player UI** | **Vidstack** (`@vidstack/react`, Web Components), **Media Chrome** (`media-chrome`), **Mux Player** (`@mux/mux-player`) | Composable `<media-player>` / Web Components wrapping native `<video>`, `hls.js`, DASH, captions, ARIA, and Media Session | Custom-branded or turnkey accessible video/audio players across React, Vue, Svelte, Astro, or vanilla HTML | **Mux Player** ties to Mux delivery; **Media Chrome** gives full chrome ownership while delegating streaming engine (`<hls-video>`) |
10
+ | **Adaptive streaming engines** | **`hls.js`** (v1.7+), **Shaka Player** (v5+), **`dash.js`** | `hls.js`: HLS via MSE / iOS 17.1+ `ManagedMediaSource`; **Shaka**: DASH + HLS + MoQ + DRM (Widevine/FairPlay/PlayReady); **`dash.js`**: MPEG-DASH reference | Production adaptive-bitrate video/live streaming; Shaka when DRM or multi-protocol DASH+HLS is required | Safari/iOS needs careful `ManagedMediaSource` vs native HLS handling (AirPlay/FairPlay/older iOS < 17.1) |
11
+ | **Classic plugin-based player** | **Video.js** | Skinned `<video>` + VHS adaptive engine + broad ad/analytics plugin ecosystem | Existing enterprise/media sites reliant on Video.js IMA/analytics plugins | Heavier CSS/plugin footprint than Vidstack or Media Chrome |
12
+ | **Waveform audio UI** | **`wavesurfer.js`** (v7+) | `<audio>` MediaElement (default) or WebAudio backend + Canvas waveform | Podcasts, voice notes, audio editors, music previews | Decoding multi-hour files client-side burns RAM/CPU unless you pass pre-computed `peaks` + `duration` |
13
+ | **Game / UI sound effects** | **`Howler.js`** | Web Audio API with HTML5 Audio fallback + audio sprites | UI sound effects, game SFX, pooled spatial/layered playback | Not an adaptive streaming video/podcast player |
14
+ | **Interactive synthesis & DSP** | **`Tone.js`** (v15+) | Web Audio API graph, `Tone.Transport` scheduler, synths & effects | Web synthesizers, DAWs, generative/interactive music tools | Requires `await Tone.start()` inside a user gesture (`click`/`keydown`) before scheduling audio |
15
+
16
+ ## Verified implementation idioms
17
+
18
+ ### Media Chrome & Vidstack (framework-agnostic accessible chrome)
19
+
20
+ - **Media Chrome**: compose semantic Web Component controls (`<media-controller>`, `<media-play-button>`, `<media-time-range>`, `<media-captions-button>`, `<media-fullscreen-button>`) around any `<video>` or `<hls-video>` element—works identically in React, Vue, Svelte, Astro, Rails, or plain HTML and styles via CSS custom properties (`--media-control-background`, `--media-accent-color`).
21
+ - **Vidstack**: use `<MediaPlayer>` + `<MediaProvider>` + `<DefaultVideoLayout>` (or headless `<Controls>`) for built-in HLS integration, keyboard shortcuts, caption styling, thumbnail scrubbers, and Media Session wiring.
22
+
23
+ ```html
24
+ <!-- Media Chrome: custom-styled accessible player over semantic <video> -->
25
+ <media-controller style="--media-accent-color: var(--semantic-color-action);">
26
+ <video slot="media" src="/media/talk.mp4" poster="/media/talk-poster.webp" playsinline crossorigin>
27
+ <track kind="captions" src="/media/talk.en.vtt" srclang="en" label="English" default />
28
+ </video>
29
+ <media-control-bar>
30
+ <media-play-button></media-play-button>
31
+ <media-time-range></media-time-range>
32
+ <media-time-display showduration></media-time-display>
33
+ <media-mute-button></media-mute-button>
34
+ <media-captions-button></media-captions-button>
35
+ <media-fullscreen-button></media-fullscreen-button>
36
+ </media-control-bar>
37
+ </media-controller>
38
+ ```
39
+
40
+ ### `hls.js` + iOS 17.1+ `ManagedMediaSource` vs native HLS fallback
41
+
42
+ - Starting with **iOS/iPadOS 17.1**, Safari supports **`ManagedMediaSource` (MMS)**, so modern `hls.js` (`Hls.isSupported()`) can run MSE-style adaptive streaming on iPhone/iPad as well as desktop browsers!
43
+ - **Nuance**: keep the native `video.canPlayType('application/vnd.apple.mpegurl')` branch for **iOS < 17.1** and whenever **FairPlay DRM** or native **AirPlay** takes priority (note that `ManagedMediaSource` disables AirPlay unless you either prefer native HLS on Safari or attach a fallback `<source>`).
44
+ - Throttle `hls.recoverMediaError()` on fatal `MEDIA_ERROR` (e.g., 5-second cooldown) to avoid infinite reload loops, and always call `hls.destroy()` on unmount.
45
+
46
+ ```ts
47
+ import Hls from 'hls.js';
48
+
49
+ export function attachHls(video: HTMLVideoElement, manifestUrl: string, preferNativeAppleHls = false) {
50
+ const canPlayNative = Boolean(video.canPlayType('application/vnd.apple.mpegurl'));
51
+
52
+ if (!preferNativeAppleHls && Hls.isSupported()) {
53
+ const hls = new Hls();
54
+ let lastRecoverAt = 0;
55
+ hls.on(Hls.Events.ERROR, (_evt, data) => {
56
+ if (data.fatal && data.type === Hls.ErrorTypes.MEDIA_ERROR && Date.now() - lastRecoverAt > 5000) {
57
+ lastRecoverAt = Date.now();
58
+ hls.recoverMediaError();
59
+ }
60
+ });
61
+ hls.loadSource(manifestUrl);
62
+ hls.attachMedia(video);
63
+ return () => hls.destroy();
64
+ }
65
+
66
+ if (canPlayNative) {
67
+ video.src = manifestUrl;
68
+ }
69
+ return () => {
70
+ video.removeAttribute('src');
71
+ video.load();
72
+ };
73
+ }
74
+ ```
75
+
76
+ ### Shaka Player (v5+), `wavesurfer.js` (v7+), and `Tone.js` (v15+)
77
+
78
+ - **Shaka Player**: call `shaka.polyfill.installAll()` once, check `shaka.Player.isBrowserSupported()` (and `await shaka.Player.probeSupport()` when DRM/codecs are mandatory), attach with `await player.attach(video)`, and call `await player.destroy()` on unmount.
79
+ - **`wavesurfer.js`**: for long podcasts or streaming audio, pass **both** pre-computed `peaks` and `duration` to `WaveSurfer.create({ container, url, peaks, duration })` so the waveform renders immediately without decoding a 90-minute file into RAM. Call `wavesurfer.destroy()` on unmount.
80
+ - **`Tone.js`**: never schedule or trigger audio on mount—call `await Tone.start()` inside a user `click` or `keydown` handler first, and call `.dispose()` on synths/effects when unmounting.
81
+
82
+ ## Media accessibility & Media Session rules
83
+
84
+ - **Captions & transcripts**: attach `<track kind="captions" src="...vtt" srclang="en" label="English" default>` and follow WCAG 1.2.2 / 2.2.2 / 2.3.1 in [accessibility-performance.md](accessibility-performance.md).
85
+ - **Keyboard & OS controls**: verify Play/Pause, Seek (`ArrowLeft`/`ArrowRight`), Volume, Mute, Captions toggle, and Fullscreen are keyboard-operable with visible focus rings, and populate `navigator.mediaSession.metadata` + action handlers for lock-screen/hardware media keys where appropriate.
86
+
87
+ ## Do/don't pairs
88
+
89
+ | Do | Don't |
90
+ |---|---|
91
+ | Choose **Vidstack**, **Media Chrome**, or **Mux Player** for modern accessible player UI | Reach for stale unmaintained player skins or build mouse-only custom scrubbers |
92
+ | Handle both `Hls.isSupported()` (MSE + iOS 17.1+ `ManagedMediaSource`) and native Apple HLS fallback | Assume iOS never supports `hls.js`, or omit native fallback for older iOS / AirPlay / FairPlay |
93
+ | Throttle `hls.recoverMediaError()` and call `hls.destroy()` / `player.destroy()` / `wavesurfer.destroy()` / `synth.dispose()` on unmount | Leak media buffers, MSE decoders, or Web Audio nodes across route changes |
94
+ | Supply pre-computed `peaks` + `duration` to `wavesurfer.js` for long audio files | Force the browser to download and decode a 90-minute audio file just to draw a waveform |
95
+ | Unlock Web Audio with `await Tone.start()` inside a `click`/`keydown` listener | Call `triggerAttackRelease()` on mount while `AudioContext` is suspended |
96
+
97
+ ## Verification commands
98
+
99
+ ```sh
100
+ npm run build
101
+ npx playwright test
102
+ ```
103
+
104
+ Verify player chunk lazy-loading (`static`), and test Safari/iOS/Chromium HLS fallback, caption toggle, keyboard scrubbing, user-gesture audio unlock, and unmount cleanup in real browsers (`rendered`).
@@ -0,0 +1,96 @@
1
+ # Motion (`motion/react` & vanilla `motion`)
2
+
3
+ Use Motion for component-level state transitions, gestures, layout animation, presence, spring physics, and lightweight WAAPI-accelerated scroll/view animations.
4
+
5
+ ## Package & entry-point rules
6
+
7
+ - **Modern package**: install **`motion`** (replacing legacy `framer-motion`). Import React APIs from **`'motion/react'`** in `'use client'` modules, or **`'motion/react-client'`** when rendering simple motion elements inside Next.js / React Server Components without adding `'use client'` to a whole page. Confirm the installed package in `package.json` before editing an existing repo.
8
+ - **Bundle reduction (`LazyMotion` + `motion/react-m`)**: wrap your app or feature root in `<LazyMotion features={domAnimation} strict>` (or `domMax` when drag/layout projections are required) and import **`import * as m from 'motion/react-m'`** (`<m.div>`) instead of full `motion.div` to cut initial runtime size from ~34 KB to ~4.6 KB.
9
+ - **Non-React stacks (Vue, Svelte, Astro, Lit, server-rendered HTML)**: use vanilla **`motion`** (`animate`, `scroll`, `inView`, `spring`) built directly on Web Animations API / ScrollTimeline with minimal overhead.
10
+
11
+ ## Good fit vs boundaries
12
+
13
+ - **Use Motion** when component state drives animation, items move between layouts (`layout` / `layoutId`), dialogs/drawers need exit presence (`AnimatePresence`), or drag/pan/tap spring physics carry meaning.
14
+ - **Use CSS** for simple hover/focus/opacity transitions and native `<dialog>`/`[popover]` `@starting-style` reveals.
15
+ - **Use GSAP** (`gsap.md`) for multi-beat choreographed timelines, complex pinned ScrollTrigger sequences, and SplitText/DrawSVG/MorphSVG work.
16
+ - Never animate the same `transform`/style property with Motion and GSAP concurrently. Keep semantic state and focus restoration in application/DOM logic, never tied to animation completion alone.
17
+
18
+ ## Reduced-motion, layout, and presence rules
19
+
20
+ - **Critical `MotionConfig` trap**: `<MotionConfig reducedMotion="user">` disables declarative `animate`/`whileHover`/`whileInView` transform animations, **but it does NOT disable `MotionValue`-driven styles** (`useScroll`, `useTransform`, `useSpring`, `useMotionValue`). Always read **`useReducedMotion()`** explicitly to bypass springs, parallax, or transform `MotionValue`s when reduced motion is requested.
21
+ - **Layout animations without text distortion**: use **`layout="position"`** on cards/headers containing text so elements translate smoothly without non-uniform scale stretching; wrap sibling components that affect each other's layout (accordions, tab underlines with shared `layoutId`) inside **`<LayoutGroup>`**.
22
+ - **Presence & focus**: give direct children of **`<AnimatePresence mode="popLayout" | "wait">`** stable `key`s, and restore keyboard focus immediately on close rather than leaving focus trapped inside an exiting node.
23
+ - **Logical direction**: use logical origin (`transformOrigin: 'inline-start'` or directional CSS variables) instead of physical left/right so RTL progress indicators grow from the start edge.
24
+
25
+ ```tsx
26
+ 'use client';
27
+ import { LazyMotion, MotionConfig, domAnimation, useReducedMotion, useScroll, useSpring } from 'motion/react';
28
+ import * as m from 'motion/react-m';
29
+
30
+ export function ScrollMeter() {
31
+ const prefersReduced = useReducedMotion();
32
+ const { scrollYProgress } = useScroll();
33
+ const smoothScaleX = useSpring(scrollYProgress, { stiffness: 220, damping: 32 });
34
+
35
+ return (
36
+ <LazyMotion features={domAnimation} strict>
37
+ <MotionConfig reducedMotion="user">
38
+ <m.div
39
+ role="progressbar"
40
+ aria-label="Reading progress"
41
+ style={{
42
+ position: 'fixed',
43
+ insetBlockStart: 0,
44
+ insetInline: 0,
45
+ blockSize: '2px',
46
+ background: 'var(--semantic-color-action)',
47
+ transformOrigin: 'inline-start',
48
+ // Explicitly bypass spring/transform MotionValue when reduced motion is enabled
49
+ scaleX: prefersReduced ? scrollYProgress : smoothScaleX,
50
+ }}
51
+ />
52
+ </MotionConfig>
53
+ </LazyMotion>
54
+ );
55
+ }
56
+ ```
57
+
58
+ ```tsx
59
+ // AnimatePresence + LayoutGroup + layout="position" (prevents text stretch)
60
+ import { AnimatePresence, LayoutGroup, motion } from 'motion/react';
61
+
62
+ <LayoutGroup>
63
+ <AnimatePresence mode="popLayout">
64
+ {items.map((item) => (
65
+ <motion.li
66
+ key={item.id}
67
+ layout="position"
68
+ initial={{ opacity: 0 }}
69
+ animate={{ opacity: 1 }}
70
+ exit={{ opacity: 0 }}
71
+ >
72
+ {item.label}
73
+ </motion.li>
74
+ ))}
75
+ </AnimatePresence>
76
+ </LayoutGroup>
77
+ ```
78
+
79
+ ```ts
80
+ // Non-React vanilla Motion (Astro / Svelte / Vue / HTML): WAAPI-backed with reduced-motion guard
81
+ import { animate, inView } from 'motion';
82
+
83
+ const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
84
+ const stop = inView('.feature-row', (el) => {
85
+ if (reduced) return;
86
+ animate(el, { opacity: [0, 1], y: [12, 0] }, { duration: 0.35 });
87
+ });
88
+ // Cleanup: stop();
89
+ ```
90
+
91
+ ## Official references
92
+
93
+ - Motion documentation: https://motion.dev/docs
94
+ - Motion for React: https://motion.dev/docs/react
95
+ - LazyMotion bundle reduction: https://motion.dev/docs/react-reduce-bundle-size
96
+ - Vanilla Motion (`animate`/`scroll`/`inView`): https://motion.dev/docs/quick-start
@@ -0,0 +1,82 @@
1
+ # Motion recipe library
2
+
3
+ These recipes describe reusable behavior, not a visual template. Choose only what supports the product/story.
4
+
5
+ | Recipe | Sequence | Required fallback/test |
6
+ |---|---|---|
7
+ | Loader | Small brand mark/indicator reveals, then exits promptly after critical content is ready | Never block navigation; timeout/failure path; skip on reduced motion |
8
+ | Kinetic headline | Split short headline by line/word, masked reveal, then settle | Semantic unsplit text, selectable content, instant reduced-motion path |
9
+ | SVG stroke reveal | Draw a meaningful path as progress or narrative is explained | Static completed path and readable labels |
10
+ | Magnetic CTA | Pointer-relative translation capped to a small travel distance, with inner parallax | Ordinary button position on touch/keyboard; hit area remains aligned |
11
+ | Pointer parallax | Small transform response to pointer position | No layout shift; stop on touch, keyboard, and reduced motion |
12
+ | FLIP card/modal | Capture origin geometry, move one semantic object to destination, then restore focus on close | Focus trap/restore, Escape, scroll lock only while dialog is open |
13
+ | Navigation overlay | Open/close panel with clear focus transfer and staggered items | Keyboard, touch, Escape, no hover dependence |
14
+ | Pinned chapter | Persistent media/artifact changes as linear chapters enter | Linear reading path, direct links, short-height and reverse-scroll tests |
15
+ | Horizontal narrative | Track advances through a deliberate sequence while vertical page access remains obvious | Native sequential list/swipe alternative; keyboard controls if custom |
16
+ | Velocity marquee | Continuous track changes speed/direction with scroll velocity | Pause control, reduced-motion static strip, duplicated decorative text hidden from AT |
17
+ | Image reveal | Clip/mask or crossfade as image becomes relevant | Stable dimensions, low-motion fade/static image |
18
+ | Route transition | Brief continuity transition around route change | History/back, focus announcement, no blocked navigation |
19
+ | Elastic footer | One bounded footer mark responds to entering/leaving viewport | No constant loop; avoid bounce on operational pages |
20
+ | Progress indicator | Chapter or task progress tracks real completed/current state | Text or numeric equivalent; no false precision |
21
+ | Stateful icon | Small icon/shape communicates a real state transition | Semantic label/state remains outside the animation |
22
+
23
+ ## Choreography rules
24
+
25
+ - One primary signature movement plus at most two supporting movements at the same moment unless the story requires more.
26
+ - Put essential content and controls in the DOM and visible before nonessential choreography.
27
+ - Use stagger only where order carries meaning; arbitrary delays make interfaces feel slow.
28
+ - Do not randomize a motion on every render. Seed or stabilize randomized values for deterministic QA.
29
+ - Clamp pointer displacement and velocity; cancel stale tweens on repeated input.
30
+ - Use animation for cause/effect and state, not to conceal loading or fake activity.
31
+
32
+ ## Native CSS motion before JS runtimes
33
+
34
+ Prefer native browser primitives when the effect does not need JS physics or timeline callbacks:
35
+
36
+ - **CSS Scroll-Driven Animations** (`animation-timeline: view()` / `scroll()`): gate with `@supports (animation-timeline: view())` and `@media (prefers-reduced-motion: no-preference)`.
37
+ - **View Transitions API + Types + `view-transition-class`**:
38
+ - Use `@view-transition { navigation: auto; }` for cross-document MPA transitions and `document.startViewTransition({ update, types: ['slide-forward'] })` for directional SPA transitions; target transition modes cleanly in CSS with **`:active-view-transition-type(slide-forward)`** instead of toggling temporary classes on `<html>`.
39
+ - Use **`view-transition-class: card-item`** alongside unique `view-transition-name: card-42` values so every card shares one `::view-transition-group(.card-item)` animation rule without generating per-ID CSS.
40
+ - Always feature-detect `document.startViewTransition` and bypass or simplify to instant crossfade/update when `prefers-reduced-motion: reduce` is active.
41
+
42
+ ```css
43
+ @supports (animation-timeline: view()) {
44
+ @media (prefers-reduced-motion: no-preference) {
45
+ .reveal-plate {
46
+ animation: plate-rise linear both;
47
+ animation-timeline: view();
48
+ animation-range: entry 10% cover 35%;
49
+ }
50
+ }
51
+ }
52
+
53
+ @keyframes plate-rise {
54
+ from { opacity: 0; translate: 0 24px; }
55
+ to { opacity: 1; translate: 0 0; }
56
+ }
57
+
58
+ /* View Transition Types + shared view-transition-class */
59
+ .product-card { view-transition-class: product-card; }
60
+
61
+ @media (prefers-reduced-motion: no-preference) {
62
+ ::view-transition-group(.product-card) {
63
+ animation-duration: 240ms;
64
+ animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
65
+ }
66
+ html:active-view-transition-type(slide-forward)::view-transition-new(page-body) {
67
+ animation: slide-in-inline 220ms ease-out both;
68
+ }
69
+ }
70
+ ```
71
+
72
+ ```ts
73
+ // Feature-detected SPA View Transition with semantic transition type
74
+ export function transitionView(update: () => void, direction: 'slide-forward' | 'slide-back') {
75
+ const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
76
+ if (!document.startViewTransition || reduced) {
77
+ update();
78
+ return;
79
+ }
80
+ document.startViewTransition({ update, types: [direction] });
81
+ }
82
+ ```
@@ -0,0 +1,111 @@
1
+ # Lightweight & edge-first stacks: Preact, Deno Fresh 2, Hono JSX/RPC, RedwoodSDK, Waku
2
+
3
+ Choose a lightweight or edge-first web stack when bundle weight, cold-start latency, or Web Standards (`Request`/`Response`) portability outweigh the full Next.js/Nuxt ecosystem.
4
+
5
+ ## Stack decision matrix
6
+
7
+ | Stack | Runtime / Model | Client JS footprint | Best fit | Primary watch-out |
8
+ |---|---|---|---|---|
9
+ | **Preact + `@preact/signals`** | ~4 KB React-like VDOM + fine-grained signals | Tiny (~4–6 KB gzipped) | Embedded widgets, low-bandwidth SPAs, islands inside Astro/Fresh | Importing full React libraries via `preact/compat` can silently bloat bundles |
10
+ | **Deno Fresh 2.0** | Zero-JS-by-default SSR + selective Preact `islands/` on Deno/Vite | 0 KB on static/SSR pages; island-only JS | Edge-rendered Deno apps needing standard HTTP handlers + isolated interactive islands | Only JSON-serializable props cross into `islands/`; avoid hydrating whole layouts |
11
+ | **Hono JSX + Hono RPC (`hc`)** | Ultra-fast Web Standards router + server JSX + optional `hono/jsx/dom` client islands | 0 KB (server JSX) or tiny client island | Cloudflare Workers / Bun / Deno / Node full-stack apps wanting end-to-end typed RPC | `hono/jsx` is not React—do not copy React-specific hooks/libraries blindly |
12
+ | **RedwoodSDK** | Cloudflare Workers-native React Server Components + explicit routing + Server Functions | RSC payload + client leaves only | Edge-first React 19 apps tightly integrated with Workers/D1/Durable Objects | Explicit request/response & RSC boundary ownership; no magic file-router defaults |
13
+ | **Waku** | Minimal Vite-based React Server Components framework | RSC payload + client leaves only | Teams wanting React 19 RSC + Vite without Next.js framework coupling | Smaller plugin ecosystem than Next.js; verify deployment adapter early |
14
+
15
+ ## Token mapping
16
+
17
+ Import generated CSS variables once in the root HTML shell (`<link rel="stylesheet" href="/tokens.css" />` or Vite CSS entry). Keep semantic variables in CSS rather than passing raw hex strings across island or RSC serialization boundaries.
18
+
19
+ ## Preact + `@preact/signals` idioms
20
+
21
+ - Use **`@preact/signals`** (`signal`, `computed`, `effect`, `useSignal`, `useComputed`) for fine-grained updates: binding a signal directly into JSX text (`<span>{count}</span>`) updates the DOM text node without re-rendering the enclosing component.
22
+ - Prefer standard HTML attribute names (`class`, `for`) in native Preact; use `className`/`htmlFor` only when sharing source code with `preact/compat`.
23
+ - Clean up `effect()` subscriptions by returning a disposal callback, and avoid mutating signals during render.
24
+
25
+ ```tsx
26
+ import { computed, useSignal } from '@preact/signals';
27
+
28
+ export function QuantityControl({ unitPrice }: { unitPrice: number }) {
29
+ const qty = useSignal(1);
30
+ const total = computed(() => qty.value * unitPrice);
31
+
32
+ return (
33
+ <div class="qty-row">
34
+ <button type="button" onClick={() => { if (qty.value > 1) qty.value--; }} aria-label="Decrease quantity">−</button>
35
+ <output aria-live="polite">{qty}</output>
36
+ <button type="button" onClick={() => { qty.value++; }} aria-label="Increase quantity">+</button>
37
+ <span>Total: {total}</span>
38
+ </div>
39
+ );
40
+ }
41
+ ```
42
+
43
+ ## Deno Fresh 2.0 idioms
44
+
45
+ - Fresh 2.0 uses a composable middleware/route `App` (`new App().use(...).fsRoutes()`) with Vite support and Preact islands under `islands/`.
46
+ - Keep page routes and forms server-rendered with standard `Request`/`Response` handlers (`GET`/`POST`) that preserve submitted values and return HTTP 422 HTML with adjacent field errors on validation failure.
47
+ - Isolate browser-only interactivity in small `islands/*.tsx` components; pass only serializable data props and keep island fallback markup identical to initial SSR output to avoid CLS.
48
+
49
+ ## Hono JSX & Hono RPC (`hc`) idioms
50
+
51
+ - Render fast semantic HTML on the server using `hono/jsx` (`c.html(<Layout>...</Layout>)` or `renderToReadableStream` / `<Suspense>` streaming) and pair with htmx or tiny `hono/jsx/dom` client islands where interactivity is needed.
52
+ - Export the chained route type (`export type AppType = typeof routes`) and consume it on the client with **`hc<AppType>('/api')`** plus `@hono/zod-validator` (or Standard Schema validator) so API contracts stay end-to-end type-safe with zero codegen:
53
+
54
+ ```ts
55
+ // server.ts
56
+ import { Hono } from 'hono';
57
+ import { zValidator } from '@hono/zod-validator';
58
+ import { z } from 'zod';
59
+
60
+ const routes = new Hono().post(
61
+ '/api/invoices',
62
+ zValidator('json', z.object({ number: z.string().min(1) })),
63
+ (c) => c.json({ ok: true, number: c.req.valid('json').number }, 201)
64
+ );
65
+
66
+ export type AppType = typeof routes;
67
+
68
+ // client.ts
69
+ import { hc } from 'hono/client';
70
+ import type { AppType } from './server';
71
+
72
+ const client = hc<AppType>('/');
73
+ const res = await client.api.invoices.$post({ json: { number: 'INV-104' } });
74
+ ```
75
+
76
+ ## RedwoodSDK & Waku (minimal RSC) idioms
77
+
78
+ - Follow the React 19 RSC rules in `react-next.md`: keep data fetching and auth/authz checks in Server Components and Server Functions, mark only interactive leaves `'use client'`, and never read `window` during SSR.
79
+ - In **RedwoodSDK**, colocate request middleware (session/auth/CSRF) explicitly on route definitions (`defineApp([render(Document, [route('/invoices', [requireAuth, InvoicesPage])])])`).
80
+ - In **Waku**, specify static vs dynamic rendering explicitly (`getConfig = async () => ({ render: 'static' | 'dynamic' })`) so CDN-cacheable routes do not incur unnecessary per-request compute.
81
+
82
+ ## Do/don't pairs
83
+
84
+ | Do | Don't |
85
+ |---|---|
86
+ | Bind `@preact/signals` directly in JSX for high-frequency updates | Pull heavy React state libraries into Preact via `preact/compat` by habit |
87
+ | Keep Fresh 2 routes server-rendered and hydrate tiny `islands/` | Put entire page layouts inside `islands/` (negates zero-JS SSR) |
88
+ | Chain Hono routes (`const routes = app.get(...).post(...)`) so `typeof routes` preserves `hc<AppType>` inference | Register routes in separate unchained statements (`app.get(...)`) that erase `AppType` inference |
89
+ | Enforce auth/authz inside every Server Function / POST handler | Trust client-side route guards or unvalidated JSON payloads |
90
+ | Use semantic `<form>`, `<label>`, and `prefers-reduced-motion` CSS across all stacks | Assume minimal runtimes exempt the UI from WCAG 2.2 or full state coverage |
91
+
92
+ ## Known traps
93
+
94
+ Breaking `hc<AppType>` type inference by not chaining Hono routes, importing heavyweight React UI kits through `preact/compat` and losing the bundle win, passing non-serializable functions/classes into Fresh islands, unguarded `window`/`document` access in edge SSR runtimes (Cloudflare Workers / Deno Deploy), missing CSRF checks on form POST routes.
95
+
96
+ ## Verification commands
97
+
98
+ Use the stack's actual runtime/test runner:
99
+
100
+ ```sh
101
+ # Preact / Hono / Waku / RedwoodSDK (Node/Vite)
102
+ npm run typecheck && npm run test -- --run && npm run build
103
+
104
+ # Deno Fresh 2
105
+ deno check && deno test && deno task build
106
+
107
+ # Browser evidence (all stacks)
108
+ npx playwright test
109
+ ```
110
+
111
+ Typechecks and server handler tests provide `static`/HTTP evidence; verify hydration, islands, focus, and network error states in a real browser (`rendered`).
@@ -146,6 +146,7 @@ Service workers are programmable network proxies. Registration and installation
146
146
  Implementation rules:
147
147
 
148
148
  - precache only the minimum app shell; huge upfront caches harm install/storage;
149
+ - prefer **Serwist** or **Workbox** over hand-rolling raw `fetch` caches (see [build-and-architecture.md](build-and-architecture.md) for Serwist precaching, runtime routing, and `BackgroundSyncPlugin` setup);
149
150
  - version cache names and delete obsolete caches during `activate`;
150
151
  - do not cache opaque/cross-origin/authenticated responses without understanding scope and leakage;
151
152
  - combine with correct HTTP caching; service-worker cache and HTTP cache are distinct layers;
@@ -180,8 +181,12 @@ Service-worker updates occur when the browser detects a byte-different worker fi
180
181
  UX-safe flow:
181
182
 
182
183
  ```js
184
+ let reloadingForUpdate = false;
185
+
183
186
  navigator.serviceWorker.addEventListener('controllerchange', () => {
184
- if (!reloadingForUpdate) window.location.reload();
187
+ if (reloadingForUpdate) return;
188
+ reloadingForUpdate = true;
189
+ window.location.reload();
185
190
  });
186
191
 
187
192
  newWorker.addEventListener('statechange', () => {
@@ -14,33 +14,73 @@ Load fonts in document head/root layout with subset/fallback policy. Resumable H
14
14
 
15
15
  ## Motion/reduced motion
16
16
 
17
- Use CSS where possible. Event handlers are lazy-loaded in Qwik, so motion tied to interaction can remain local through `$`/`useVisibleTask$` patterns. Honor `prefers-reduced-motion`; do not use visible-task initialization for content that can be static.
17
+ Use CSS where possible. Event handlers are lazy-loaded in Qwik, so motion tied to interaction can remain local through `$` handlers. Honor `prefers-reduced-motion`; reserve `useVisibleTask$` strictly for unavoidable browser-only DOM/observer setup (canvas, third-party widgets) because it eagerly loads JS when scrolled into view and undercuts resumability.
18
18
 
19
19
  ## Accessibility specifics
20
20
 
21
- Resumability is not accessibility by itself. Initial HTML needs correct semantics, labels, landmarks, and focus order. Manage focus after lazy interaction, route transition, deletion, and dialog close. Anchor/button distinction remains mandatory.
21
+ Resumability is not accessibility by itself. Initial HTML needs correct semantics, labels, landmarks, and focus order. Use `useId()` for SSR-safe `<label for>` and `aria-describedby` wiring. Manage focus after lazy interaction, route transition, deletion, and dialog close. Anchor/button distinction remains mandatory.
22
22
 
23
23
  ## States idiom
24
24
 
25
- Use `routeLoader$`, `routeAction$`, server state, resource tracking, and explicit pending/error/empty branches. Because Qwik serializes state into HTML, avoid secrets/nonserializable values and preserve input/error state across action failure.
25
+ Use `routeLoader$`, `routeAction$`, `server$`, `useResource$` + `<Resource>`, and explicit pending/error/empty branches. Because Qwik serializes state into HTML, avoid secrets/nonserializable values (wrap unavoidable non-serializable handles with `noSerialize(...)`) and preserve input/error state across action failure.
26
+
27
+ ## Qwik 1.x vs Qwik 2.0 and task/resource idioms
28
+
29
+ Check `package.json` for the installed major before writing imports: **Qwik 2.0** moves core packages to **`@qwik.dev/core`** and **`@qwik.dev/router`** (replacing `@builder.io/qwik` and `@builder.io/qwik-city`).
30
+
31
+ - **`useTask$` vs `useVisibleTask$`**: default to **`useTask$`** for reactive state derivation and async work (runs during SSR and resumes on the client only when tracked signals change). Use **`useVisibleTask$`** only as a browser-only escape hatch (e.g., attaching ResizeObserver/canvas/chart instances) and return a cleanup function via `cleanup(() => ...)`.
32
+ - **`useResource$` + `<Resource>`**: use for streamed/reactive async data with explicit `onPending`, `onRejected`, and `onResolved` states.
33
+ - **`server$`**: define typed server-only RPC functions callable from event handlers without exposing server secrets or database code to the browser bundle.
34
+
35
+ ```tsx
36
+ import { component$, Resource, useResource$, useSignal, useTask$ } from '@qwik.dev/core';
37
+ import { server$ } from '@qwik.dev/router';
38
+
39
+ const searchInvoices = server$(async (query: string) => db.invoices.search(query));
40
+
41
+ export const InvoiceSearch = component$(() => {
42
+ const query = useSignal('');
43
+ const debounced = useSignal('');
44
+
45
+ useTask$(({ track, cleanup }) => {
46
+ const next = track(() => query.value);
47
+ const id = setTimeout(() => { debounced.value = next; }, 200);
48
+ cleanup(() => clearTimeout(id));
49
+ });
50
+
51
+ const results = useResource$<Invoice[]>(({ track }) => {
52
+ const q = track(() => debounced.value);
53
+ return searchInvoices(q);
54
+ });
55
+
56
+ return (
57
+ <Resource
58
+ value={results}
59
+ onPending={() => <p role="status" aria-busy="true">Searching…</p>}
60
+ onRejected={(err) => <p role="alert">Search failed: {err.message}</p>}
61
+ onResolved={(items) => (items.length ? <ul>{items.map((i) => <li key={i.id}>{i.number}</li>)}</ul> : <p>No matches.</p>)}
62
+ />
63
+ );
64
+ });
65
+ ```
26
66
 
27
67
  ## Forms idiom
28
68
 
29
- Qwik City actions can progressively enhance forms. Use native labels/types/autocomplete/inputmode and return field errors without discarding values. Avoid converting every input into eager client-controlled state when native form semantics suffice.
69
+ Qwik Router `routeAction$` + `<Form>` (or Modular Forms `@modular-forms/qwik`; see `forms-validation.md`) progressively enhance forms. Use native labels/types/autocomplete/inputmode and return field errors without discarding values. Avoid converting every input into eager client-controlled state when native form semantics suffice.
30
70
 
31
71
  ## Do/don't pairs
32
72
 
33
73
  | Do | Don't |
34
74
  |---|---|
35
- | `<Link href="/invoice/42">View invoice</Link>` | click-only div calling navigation |
36
- | local lazy handler `onClick$` for the control that needs it | eager global hydration mental model copied from SPA frameworks |
37
- | serializable action state/error shape | storing class instances/functions/secrets in UI state |
38
- | stable static layout before interaction | blank shell waiting for lazy behavior that content does not need |
39
- | `useVisibleTask$` only for browser-visible side effects | running browser-only assumptions during SSR |
75
+ | `<Link href="/invoice/42">View invoice</Link>` | Click-only `<div>` calling navigation |
76
+ | `useTask$` for reactive state and `useResource$` + `<Resource>` for async UI states | Reaching for `useVisibleTask$` for data fetching (breaks resumability and delays SSR) |
77
+ | `server$` / `routeAction$` with serializable error shapes | Storing class instances, functions, or secrets directly in `useStore`/`useSignal` |
78
+ | Match imports to installed major (`@qwik.dev/core` + `@qwik.dev/router` in v2) | Mixing v1 `@builder.io/qwik-city` and v2 `@qwik.dev/router` imports |
79
+ | Stable static layout before interaction | Blank shell waiting for lazy behavior that content does not need |
40
80
 
41
81
  ## Known traps
42
82
 
43
- Serialization boundary violations, overuse of visible tasks, accidentally losing resumability benefits through broad client state, lazy focus management gaps, stale route data, confusing optimizer errors, CSS duplication across lazy chunks.
83
+ Serialization boundary violations (missing `noSerialize` on DOM/library handles), overusing `useVisibleTask$` and throwing away resumability, leaking server-only code outside `server$`/`routeLoader$`, lazy focus management gaps, stale route data, CSS duplication across lazy chunks.
44
84
 
45
85
  ## Verification commands
46
86
 
@@ -51,4 +91,4 @@ npm run build
51
91
  npx playwright test
52
92
  ```
53
93
 
54
- Inspect initial HTML before JS as well as post-interaction browser state; both are distinct evidence.
94
+ Inspect initial HTML before JS (`static` / no-JS `rendered`) as well as post-interaction browser state (`rendered`); both are distinct evidence.
@@ -0,0 +1,69 @@
1
+ # React Three Fiber (R3F v9) integration
2
+
3
+ Use R3F as a renderer inside an existing React application, not as an alternate application architecture. Keep the DOM/scene boundary explicit. For non-React declarative 3D (Svelte Threlte, Vue TresJS) or Babylon.js/`<model-viewer>`, see [web-3d-engines.md](web-3d-engines.md).
4
+
5
+ ## Version & ecosystem compatibility
6
+
7
+ - **R3F v9 + React 19**: React 19 requires **`@react-three/fiber` v9+** (R3F v8 is strictly for React 18). Match `@react-three/drei`, `@react-three/postprocessing`, and `@react-three/rapier` majors to your installed React/R3F versions.
8
+ - **Postprocessing (`@react-three/postprocessing`)**: batch effects inside a single `<EffectComposer multisampling={0}>` (for example selective `<Bloom mipmapBlur luminanceThreshold={1} />` + `<ToneMapping mode={ToneMappingMode.ACES_FILMIC} />`) instead of stacking unmerged fullscreen shader passes.
9
+ - **Physics (`@react-three/rapier`)**: wrap physics bodies in `<Physics paused={reducedMotion || !visible}>` so WASM physics steps pause when offscreen or static, and keep collider meshes simpler than visual meshes (`colliders="hull"` / primitives).
10
+ - **WebGPU (`three/webgpu`)**: R3F v9 accepts an async `gl` factory (`gl={async (props) => { const r = new WebGPURenderer(props); await r.init(); return r; }}`) so scenes can opt into Three.js `WebGPURenderer` + TSL (`scene-architecture.md`) with WebGL2 fallback.
11
+
12
+ ## Component boundaries
13
+
14
+ - Place `<Canvas>` in a narrow `'use client'` component dynamically imported with `ssr: false` (or client-only lazy wrapper) when using server-rendered React/Next.js/React Router/TanStack Start.
15
+ - Keep SEO text, headings, buttons, pricing, product options, and accessible descriptions outside `<Canvas>`.
16
+ - Keep per-frame values in refs/mutable objects (`meshRef.current.rotation.y += delta`); **never** call `setState` inside `useFrame`.
17
+ - Memoize shared geometries/materials and avoid recreating loaders, vectors (`new THREE.Vector3()`), or callbacks inside `useFrame`.
18
+
19
+ ## Demand rendering & explicit `invalidate`
20
+
21
+ Default to `frameloop="demand"` for product viewers, configurators, and mostly static scenes so the GPU idles at 0% between interactions, and call **`useThree((s) => s.invalidate)`** whenever external state or an imperative animation requires a fresh frame:
22
+
23
+ ```tsx
24
+ 'use client';
25
+ import { useEffect, useRef } from 'react';
26
+ import { Canvas, useThree } from '@react-three/fiber';
27
+ import { OrbitControls } from '@react-three/drei';
28
+ import type * as THREE from 'three';
29
+
30
+ function ProductMesh({ finishColor }: { finishColor: string }) {
31
+ const meshRef = useRef<THREE.Mesh>(null);
32
+ const invalidate = useThree((s) => s.invalidate);
33
+
34
+ useEffect(() => {
35
+ invalidate(); // Request one new frame when finishColor changes under frameloop="demand"
36
+ }, [finishColor, invalidate]);
37
+
38
+ return (
39
+ <mesh ref={meshRef}>
40
+ <boxGeometry args={[1, 1, 1]} />
41
+ <meshStandardMaterial color={finishColor} />
42
+ </mesh>
43
+ );
44
+ }
45
+
46
+ export function ProductCanvas({ finishColor }: { finishColor: string }) {
47
+ return (
48
+ <Canvas dpr={[1, 2]} frameloop="demand" gl={{ antialias: true, powerPreference: 'high-performance' }}>
49
+ <ambientLight intensity={0.6} />
50
+ <directionalLight position={[4, 6, 4]} intensity={1.2} />
51
+ <ProductMesh finishColor={finishColor} />
52
+ <OrbitControls enableDamping makeDefault />
53
+ </Canvas>
54
+ );
55
+ }
56
+ ```
57
+
58
+ ## Interaction, SSR, and fallback
59
+
60
+ - Keep camera controls bounded (`minDistance`, `maxDistance`, `maxPolarAngle`) and expose a DOM "Reset view" button and keyboard controls for interactive viewers.
61
+ - Render a styled poster/image fallback inside `<Suspense fallback={...}>` and wrap `<Canvas>` in a React Error Boundary so WebGL/WebGPU unavailability degrades to a clean static product view.
62
+ - Never instantiate WebGL/WebGPU during SSR; seed any procedural geometry deterministically so visual QA is reproducible.
63
+
64
+ ## Official references
65
+
66
+ - R3F docs: https://r3f.docs.pmnd.rs/
67
+ - R3F hooks & `invalidate`: https://r3f.docs.pmnd.rs/api/hooks
68
+ - `@react-three/postprocessing`: https://react-postprocessing.docs.pmnd.rs/
69
+ - `@react-three/rapier`: https://github.com/pmndrs/react-three-rapier