@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
@@ -21,41 +21,140 @@ Use `next/font` where applicable, configure subsets/fallbacks/display behavior d
21
21
 
22
22
  ## Motion/reduced motion
23
23
 
24
- CSS handles simple transitions. For JS animation libraries, initialize only in client components and honor:
24
+ CSS handles simple transitions. Never read `window.matchMedia` synchronously at module scope or render time in SSR/RSC apps—subscribe inside `useSyncExternalStore` (with a safe server snapshot) or `useEffect` in a `'use client'` component:
25
25
 
26
26
  ```ts
27
- const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
27
+ 'use client';
28
+ import { useSyncExternalStore } from 'react';
29
+
30
+ const QUERY = '(prefers-reduced-motion: reduce)';
31
+
32
+ export function usePrefersReducedMotion(): boolean {
33
+ return useSyncExternalStore(
34
+ (onChange) => {
35
+ const mql = window.matchMedia(QUERY);
36
+ mql.addEventListener('change', onChange);
37
+ return () => mql.removeEventListener('change', onChange);
38
+ },
39
+ () => window.matchMedia(QUERY).matches,
40
+ () => false // SSR snapshot
41
+ );
42
+ }
28
43
  ```
29
44
 
30
- Cleanup listeners/animation frames in effects.
45
+ Clean up listeners, observers, and animation frames in effects or ref cleanup callbacks.
31
46
 
32
47
  ## Accessibility specifics
33
48
 
34
- React does not create semantics for you. Use real controls, label association with `htmlFor`/`id`, and manage focus after route transitions, dialog close, deletion, and error summary display. Next Link remains an anchor; do not use click handlers for navigation without href semantics. Hydration must not leave visible controls inert.
49
+ React does not create semantics for you. Use real controls, label association with `htmlFor`/`id` (use `useId()` for reusable components so SSR and client IDs match), and manage focus after route transitions, dialog close, deletion, and error summary display. Framework `<Link>` renders an anchor; do not use click handlers for navigation without `href` semantics. Hydration must not leave visible controls inert.
35
50
 
36
51
  ## States idiom
37
52
 
38
- Check the installed React/Next.js versions and router before using these examples. Server Actions and route-segment conventions here assume a compatible App Router; verify `useFormStatus` for the installed React version. Preserve existing Pages Router or client mutation patterns when a migration is out of scope.
53
+ Check the installed React/Next.js versions and router before using these examples. Server Actions and route-segment conventions here assume a compatible App Router; preserve existing Pages Router or client mutation patterns when a migration is out of scope.
39
54
 
40
- Use route-level `loading`/`error`/`not-found` plus component-level state deliberately; they are not substitutes for empty/partial/offline/optimistic states. Server Actions need pending indication, duplicate-submit protection, validation error return shape, input preservation, and rollback semantics. Cache freshness/revalidation must be visible when user decisions depend on stale data.
55
+ Use route-level `loading`/`error`/`not-found` plus component-level state deliberately; they are not substitutes for empty/partial/offline/optimistic states. Server Actions need pending indication, duplicate-submit protection, validation error return shape, input preservation, rollback semantics, and **explicit server-side authentication + authorization checks inside every action** (Server Actions are public HTTP endpoints—never assume UI gating or route middleware alone protects them).
41
56
 
42
57
  ## Forms idiom
43
58
 
44
- Use `<form action>` progressive enhancement where feasible. Correct `autocomplete`/`inputMode` are preserved in JSX capitalization (`autoComplete`, `inputMode`). Return field errors as data and associate them accessibly; do not rely on browser alert/toast alone. Preserve input on failed server validation.
59
+ Use `<form action>` progressive enhancement where feasible. Correct `autocomplete`/`inputMode` are preserved in JSX capitalization (`autoComplete`, `inputMode`). `useFormStatus` is imported from `'react-dom'` and **must be called in a child component rendered inside `<form>`** (calling it in the same component that renders `<form>` always returns `pending: false`). Return field errors as data and associate them accessibly; preserve input on failed server validation.
60
+
61
+ ## Modern React 19 / 19.2 idioms
62
+
63
+ - **Refs & cleanup**: pass `ref` directly as a regular prop (no `forwardRef` boilerplate) and return a cleanup function from callback refs (`ref={(node) => { ...; return () => cleanup(); }}`).
64
+ - **Async & mutations**: read promises/context conditionally with `use()`, pair `<form action>` with `useActionState` and `useOptimistic` (`state-architecture.md`), and keep render functions pure so **React Compiler** auto-memoizes safely without manual `useMemo`/`useCallback` clutter.
65
+ - **React 19.2 primitives**: use `<Activity mode={open ? 'visible' : 'hidden'}>` to preserve UI/form state in hidden tabs/panels without paying full active render cost, `useEffectEvent` to read latest props/callbacks inside `useEffect` without restarting subscriptions, and `<ViewTransition>` (where supported by the React release channel) for semantic state/route transitions gated by reduced-motion preferences.
66
+
67
+ ## Next.js 15 / 16 idioms
68
+
69
+ - **Async request APIs**: `params`, `searchParams`, `cookies()`, and `headers()` are asynchronous (`const { id } = await params`).
70
+ - **Explicit caching (`'use cache'`)**: do not assume implicit `fetch` caching. Opt into Cache Components / `'use cache'` with `cacheLife('hours')` and `cacheTag('invoices')`, and invalidate cleanly with `updateTag(...)` (immediate read-your-own-writes in Server Actions) or `revalidateTag(...)`.
71
+ - **Built-in flows & error boundaries**: use `next/form` (`<Form action="/search">`) for progressively enhanced GET navigation forms, `after(() => ...)` for non-blocking post-response logging/analytics, and `unauthorized()` / `forbidden()` paired with `unauthorized.tsx` / `forbidden.tsx` where enabled.
72
+ - **Request boundary**: in Next.js 16+, prefer `proxy.ts` (replacing `middleware.ts` naming) for lightweight request routing/header rewrites—and still verify auth/permissions inside Server Components, Route Handlers, and Server Actions.
73
+
74
+ ## React Router v7 (framework mode)
75
+
76
+ For Vite-native full-stack React with web-standard `Request`/`Response` semantics, configure explicit routes in `app/routes.ts` and import generated `./+types/<route>` (`Route.LoaderArgs`, `Route.ActionArgs`, `Route.ComponentProps`):
77
+
78
+ ```tsx
79
+ // app/routes/invoice.tsx
80
+ import type { Route } from './+types/invoice';
81
+ import { Form, useNavigation } from 'react-router';
82
+
83
+ export async function loader({ params, request }: Route.LoaderArgs) {
84
+ return loadInvoice(params.id, request);
85
+ }
86
+
87
+ // Optional client-side cache/offline layer; pair with HydrateFallback for SPA/client loads
88
+ export async function clientLoader({ serverLoader }: Route.ClientLoaderArgs) {
89
+ return serverLoader();
90
+ }
91
+
92
+ export async function action({ request, params }: Route.ActionArgs) {
93
+ const formData = await request.formData();
94
+ return updateInvoice(params.id, formData);
95
+ }
96
+
97
+ export function HydrateFallback() {
98
+ return <div role="status" aria-busy="true">Loading invoice…</div>;
99
+ }
100
+
101
+ export default function InvoiceRoute({ loaderData, actionData }: Route.ComponentProps) {
102
+ const busy = useNavigation().state === 'submitting';
103
+ return (
104
+ <Form method="post">
105
+ <button type="submit" disabled={busy}>{busy ? 'Saving…' : 'Save'}</button>
106
+ {actionData?.error && <p role="alert">{actionData.error}</p>}
107
+ </Form>
108
+ );
109
+ }
110
+ ```
111
+
112
+ Use `clientAction` when optimistic client caches must update before or alongside server mutations.
113
+
114
+ ## TanStack Router & TanStack Start
115
+
116
+ For end-to-end type-safe search params, nested loaders, and full-stack RPC server functions on Vite, validate URL state with `validateSearch`, guard auth/preload data in `beforeLoad`, and enforce validation + auth middleware on `createServerFn`:
117
+
118
+ ```tsx
119
+ import { createFileRoute, redirect } from '@tanstack/react-router';
120
+ import { createMiddleware, createServerFn } from '@tanstack/react-start';
121
+ import { z } from 'zod';
122
+
123
+ const authMiddleware = createMiddleware({ type: 'function' }).server(async ({ next }) => {
124
+ const session = await getSession();
125
+ if (!session) throw new Error('Unauthorized');
126
+ return next({ context: { userId: session.userId } });
127
+ });
128
+
129
+ const updateStatus = createServerFn({ method: 'POST' })
130
+ .middleware([authMiddleware])
131
+ .inputValidator(z.object({ id: z.string(), status: z.enum(['draft', 'sent']) }))
132
+ .handler(async ({ data, context }) => saveInvoiceStatus(context.userId, data));
133
+
134
+ export const Route = createFileRoute('/invoices')({
135
+ validateSearch: z.object({ page: z.number().int().min(1).catch(1), q: z.string().catch('') }),
136
+ beforeLoad: ({ context }) => {
137
+ if (!context.session) throw redirect({ to: '/login' });
138
+ },
139
+ loaderDeps: ({ search }) => ({ page: search.page, q: search.q }),
140
+ loader: ({ deps }) => fetchInvoices(deps),
141
+ });
142
+ ```
45
143
 
46
144
  ## Do/don't pairs
47
145
 
48
146
  | Do | Don't |
49
147
  |---|---|
50
148
  | `<Link href="/invoices/42">View invoice</Link>` | `<div onClick={() => router.push('/invoices/42')}>View invoice</div>` |
51
- | `useFormStatus().pending` to disable repeated submit and expose pending state | pretending submission is instant or allowing duplicate mutations |
52
- | narrow client component `<QtyStepper sku={sku} />` inside server page | converting the whole route to `'use client'` for one control |
53
- | `router.back()`/history-aware close semantics where appropriate | always routing users home after modal/drawer close |
54
- | preserve search params for filter/page/share state | storing shareable view state only in ephemeral component memory |
149
+ | Call `useFormStatus()` from `'react-dom'` inside a `<SubmitButton />` child of `<form>` | Call `useFormStatus()` in the same component that renders `<form>` (stays `pending: false`) |
150
+ | Check session & resource ownership inside every Server Action / `createServerFn` | Rely on UI hiding or `middleware.ts`/`proxy.ts` alone to secure mutations |
151
+ | Guard `window.matchMedia` in `useSyncExternalStore` (with server snapshot) or `useEffect` | Call `window.matchMedia(...)` unconditionally during render (crashes SSR) |
152
+ | Narrow `'use client'` leaf (`<QtyStepper sku={sku} />`) inside a Server Component | Convert the whole route to `'use client'` for one interactive control |
153
+ | Validate URL search params (`validateSearch` / `searchParams`) for filter/page/share state | Store shareable view state only in ephemeral component memory |
55
154
 
56
155
  ## Known traps
57
156
 
58
- Server/client serialization boundaries, stale closure state, effect-driven data fetching waterfalls, hydration mismatch from locale/date/random values, focus loss after route change, cache surprises, suspense fallback layout shift, controlled input cursor loss, accidental client-only accessibility gaps.
157
+ Server/client serialization boundaries, unauthenticated Server Actions, calling `useFormStatus` outside a `<form>` child, unguarded `window` reads in SSR, stale closure state, effect-driven data fetching waterfalls, hydration mismatch from locale/date/random values, focus loss after route change, cache tag omission, suspense fallback layout shift.
59
158
 
60
159
  ## Verification commands
61
160
 
@@ -66,4 +165,4 @@ npm run build
66
165
  npx playwright test
67
166
  ```
68
167
 
69
- Use the actual package manager/scripts. Inspect browser rendering and hydration timing when interaction quality matters.
168
+ Use the actual package manager/scripts. Inspect browser rendering and hydration timing in a real browser (`rendered`); typechecks and builds provide `static` evidence only.
@@ -0,0 +1,63 @@
1
+ # Creative rendering choices
2
+
3
+ ## Select by content
4
+
5
+ | Renderer | Strong fit | Cost / boundary |
6
+ |---|---|---|
7
+ | DOM/CSS | UI, small transitions, layout effects | Keep semantic state in HTML; avoid layout-heavy animation |
8
+ | SVG | Icons, diagrams, vector marks, path drawing, moderate object counts | DOM/SVG complexity grows with many animated nodes |
9
+ | Canvas 2D | Procedural drawing, simple particles, paint tools | App must provide semantics, focus, text/data alternative |
10
+ | **PixiJS v8** | Sprite/texture-heavy 2D scenes, particles, filters, batching | Adds a runtime and GPU memory; supports WebGPU + WebGL2 automatically |
11
+ | OGL / raw WebGL / `regl` | A compact shader or custom GPU surface | Lower-level lifecycle/compatibility work |
12
+ | Three.js / R3F / Babylon / Threlte / TresJS | 3D scene graphs, camera, lighting, loaders | Read [scene-architecture.md](scene-architecture.md) and [web-3d-engines.md](web-3d-engines.md) |
13
+ | **WebGPU** | Compute shaders, high-draw-call instancing, or modern GPU pipelines | Capability-detect first; ship WebGL2 or static fallback |
14
+
15
+ ## PixiJS v8 breaking-change initialization
16
+
17
+ PixiJS v8 **removed synchronous constructor options** and renamed `app.view` → **`app.canvas`**. Always construct `new Application()`, await `app.init({ preference: 'webgpu', ... })` (falls back to WebGL2 automatically), mount `app.canvas`, and call `app.destroy({ removeView: true }, { children: true, texture: true })` on unmount:
18
+
19
+ ```ts
20
+ import { Application } from 'pixi.js';
21
+
22
+ export async function mountPixiStage(container: HTMLElement) {
23
+ const app = new Application();
24
+ await app.init({
25
+ preference: 'webgpu',
26
+ resizeTo: container,
27
+ resolution: Math.min(window.devicePixelRatio || 1, 2),
28
+ autoDensity: true,
29
+ backgroundAlpha: 0,
30
+ });
31
+ container.appendChild(app.canvas);
32
+ return () => app.destroy({ removeView: true }, { children: true });
33
+ }
34
+ ```
35
+
36
+ Keep product UI, forms, and navigation in real DOM outside the Pixi canvas.
37
+
38
+ ## WebGL / WebGPU capability check & fallback
39
+
40
+ ```ts
41
+ export async function detectGpuBackend(): Promise<'webgpu' | 'webgl2' | 'none'> {
42
+ if ('gpu' in navigator) {
43
+ try {
44
+ const adapter = await navigator.gpu.requestAdapter();
45
+ if (adapter) return 'webgpu';
46
+ } catch {
47
+ // Fall through to WebGL2 check
48
+ }
49
+ }
50
+ const probe = document.createElement('canvas');
51
+ return probe.getContext('webgl2') ? 'webgl2' : 'none';
52
+ }
53
+ ```
54
+
55
+ - WebGPU requires a secure context (`https://` or `localhost`) and a valid `GPUAdapter`; never assume `'gpu' in navigator` means an adapter exists.
56
+ - Provide a deterministic static poster/SVG fallback when `'none'` is returned or GPU context fails.
57
+ - Do not treat a `<canvas>` tag as proof that WebGL/WebGPU initialized; verify rendered pixels and context state in a real browser (`rendered`).
58
+
59
+ ## Official references
60
+
61
+ - PixiJS v8 guides: https://pixijs.com/8.x/guides
62
+ - WebGL API: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API
63
+ - WebGPU API: https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API
@@ -0,0 +1,80 @@
1
+ # Real-time 3D performance
2
+
3
+ Set budgets during planning and measure on representative devices. A fixed FPS target is meaningless without device, refresh rate, viewport, scene, and throttling context.
4
+
5
+ ## Control the cost
6
+
7
+ - Cap device pixel ratio; full-resolution rendering at high-DPI can multiply fragment work.
8
+ - Bound triangles, draw calls, textures, render targets, lights, shadows, physics steps, and postprocessing passes.
9
+ - Prefer instancing for repeated meshes and LOD/culling for wide scenes.
10
+ - Use static environment maps or baked lighting where realtime lighting has no user-facing value.
11
+ - Lazy-load scene code and assets; show a poster before initialization.
12
+ - Pause when document hidden or scene offscreen; avoid idle animation on operational pages.
13
+ - Use lower quality presets for mobile/thermal pressure and expose a non-3D fallback.
14
+ - Dispose resources and test memory after route changes or repeated open/close.
15
+ - Avoid blanket `will-change: transform` on large lists; apply compositor promotion only to actively animating elements to prevent VRAM exhaustion.
16
+
17
+ ```ts
18
+ // Cap DPR, pause when offscreen or hidden, and handle WebGL context loss + restoration
19
+ const dpr = Math.min(window.devicePixelRatio || 1, 2);
20
+ renderer.setPixelRatio(dpr);
21
+
22
+ let visible = true;
23
+ let rafId = 0;
24
+
25
+ function tick(now: number) {
26
+ if (!visible || document.hidden) {
27
+ rafId = 0;
28
+ return;
29
+ }
30
+ renderFrame(now);
31
+ rafId = requestAnimationFrame(tick);
32
+ }
33
+
34
+ function startLoop() {
35
+ if (!rafId && visible && !document.hidden) rafId = requestAnimationFrame(tick);
36
+ }
37
+
38
+ const io = new IntersectionObserver(
39
+ ([entry]) => {
40
+ visible = entry.isIntersecting;
41
+ if (visible) startLoop();
42
+ },
43
+ { threshold: 0.01 },
44
+ );
45
+ io.observe(canvas);
46
+
47
+ const onVisibility = () => { if (!document.hidden) startLoop(); };
48
+ document.addEventListener('visibilitychange', onVisibility);
49
+
50
+ const onContextLost = (e: Event) => {
51
+ e.preventDefault();
52
+ cancelAnimationFrame(rafId);
53
+ rafId = 0;
54
+ };
55
+ const onContextRestored = () => {
56
+ rebuildGpuResources();
57
+ startLoop();
58
+ };
59
+ canvas.addEventListener('webglcontextlost', onContextLost);
60
+ canvas.addEventListener('webglcontextrestored', onContextRestored);
61
+
62
+ // On teardown:
63
+ // cancelAnimationFrame(rafId); io.disconnect();
64
+ // document.removeEventListener('visibilitychange', onVisibility);
65
+ // canvas.removeEventListener('webglcontextlost', onContextLost);
66
+ // canvas.removeEventListener('webglcontextrestored', onContextRestored);
67
+ // geometry.dispose(); material.dispose(); renderer.dispose();
68
+ ```
69
+
70
+ ## Evidence
71
+
72
+ Record device/GPU/browser, viewport, DPR, refresh rate, scene state, warm/cold cache, frame-time distribution or FPS sample, long tasks, GPU memory (`renderer.info.memory`), draw calls (`renderer.info.render.calls`), and whether capture was actual device or emulation (`rendered`). Do not compare numbers from unlike devices as if they were equivalent.
73
+
74
+ The visual-qa performance budget is the shared project-level floor; this guide adds scene-specific measurements. If device profiling is unavailable, label GPU/frame checks `not-checked` rather than inferring from a screenshot.
75
+
76
+ ## Official references
77
+
78
+ - WebGL best practices: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices
79
+ - Three.js manual: https://threejs.org/manual/
80
+ - R3F performance: https://r3f.docs.pmnd.rs/advanced/scaling-performance
@@ -0,0 +1,220 @@
1
+ # Rich text, code editors, playgrounds, and visual page builders
2
+
3
+ Never build a rich-text or code editor on raw `contenteditable` with `document.execCommand` (deprecated and inconsistent across browsers). Choose an engine with an explicit document model, predictable undo/redo, IME composition support, and keyboard/screen-reader accessibility.
4
+
5
+ ## Engine decision matrix
6
+
7
+ | Category | Tools | Document model | Best fit | Primary trade-off |
8
+ |---|---|---|---|---|
9
+ | **Rich-text core** | **ProseMirror**, **Tiptap** (v3), **BlockNote** | Immutable schema-validated node tree (ProseMirror) | Custom block/inline docs, Notion-like editors (**BlockNote** ships slash menus, drag handles, and Yjs blocks out of the box) | Bundle size & schema design discipline; SSR requires `immediatelyRender: false` |
10
+ | **React-first rich text** | **Lexical**, **Slate**, **Plate** | Double-buffered node tree (Lexical) or JSON AST (Slate/Plate) | React apps needing fine-grained custom nodes, mentions, slash commands, or shadcn-style blocks (Plate) | Lexical requires registering custom nodes upfront; Slate needs careful normalization & IME testing |
11
+ | **Full-featured turnkey** | **CKEditor 5**, **TinyMCE** | Proprietary rich model | CMS/enterprise forms needing turnkey tables, track changes, Word paste cleanup | Commercial licensing for advanced plugins; harder to restyle deeply |
12
+ | **Markdown / MDX** | **Milkdown** (ProseMirror-based), **MDXEditor** (Lexical-based) | Markdown AST + live WYSIWYG | Developer docs, Git-backed CMS, technical writing | Round-trip Markdown serialization edge cases with custom JSX/MDX |
13
+ | **Read-only syntax highlighting** | **Shiki** (`shiki`) | TextMate grammars → static HTML / CSS variables | Docs, changelogs, diff viewers, AI code blocks (0 KB client JS when rendered at build/SSR time) | Not an editable code editor—pair with CodeMirror 6 when editing is required |
14
+ | **Code editors** | **CodeMirror 6**, **Monaco Editor**, **Ace** | Line/rope immutable state (CM6) or VS Code text model (Monaco) | **CodeMirror 6**: lightweight, mobile-friendly, modular web apps; **Monaco**: desktop IDE features (TypeScript IntelliSense, diff editor, LSP) | Monaco is heavy (~2–4 MB + Web Workers) and weak on mobile touch; never bundle Monaco for a small JSON input or read-only snippet |
15
+ | **In-browser playgrounds** | **Sandpack**, **WebContainers** | Client bundler iframe (Sandpack) or WASM Node.js runtime (WebContainers) | **Sandpack**: live React/Vue/HTML sandboxes in docs; **WebContainers**: full Node CLI/dev-server in browser | WebContainers require `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp` headers |
16
+ | **Visual page builders** | **Puck**, **Craft.js**, **GrapesJS** | JSON component tree (Puck/Craft.js) or HTML/CSS canvas (GrapesJS) | **Puck**: React/Next.js apps rendering your own design-system components; **GrapesJS**: standalone HTML/email template builders | GrapesJS outputs arbitrary HTML/CSS that can drift from design tokens |
17
+
18
+ ## Rich-text implementation idioms
19
+
20
+ ### Standalone ProseMirror (`Schema` → `EditorState` → `Transaction` → `EditorView`)
21
+
22
+ Choose standalone **ProseMirror** (`prosemirror-model`, `prosemirror-state`, `prosemirror-view`, `prosemirror-history`, `prosemirror-keymap`) over wrapper frameworks when you need tight bundle control, framework-agnostic state ownership, or strict custom document invariants:
23
+
24
+ - Define a closed `Schema` (allowed nodes, marks, and content expressions) so invalid DOM structures cannot enter editor state.
25
+ - Route every mutation through an immutable `Transaction` (`state.tr`) inside `dispatchTransaction(tr)`, apply it via `view.state.apply(tr)`, update the view with `view.updateState(nextState)`, and call `view.destroy()` on unmount.
26
+
27
+ ```ts
28
+ import { Schema } from 'prosemirror-model';
29
+ import { EditorState, Transaction } from 'prosemirror-state';
30
+ import { EditorView } from 'prosemirror-view';
31
+ import { history, undo, redo } from 'prosemirror-history';
32
+ import { keymap } from 'prosemirror-keymap';
33
+ import { baseKeymap } from 'prosemirror-commands';
34
+
35
+ const schema = new Schema({
36
+ nodes: {
37
+ doc: { content: 'paragraph+' },
38
+ paragraph: { content: 'text*', toDOM: () => ['p', 0], parseDOM: [{ tag: 'p' }] },
39
+ text: { group: 'inline' },
40
+ },
41
+ marks: {
42
+ strong: { toDOM: () => ['strong', 0], parseDOM: [{ tag: 'strong' }] },
43
+ },
44
+ });
45
+
46
+ export function mountProseMirror(parent: HTMLElement, onDocChange: (json: unknown) => void) {
47
+ const state = EditorState.create({
48
+ schema,
49
+ plugins: [history(), keymap({ 'Mod-z': undo, 'Mod-Shift-z': redo }), keymap(baseKeymap)],
50
+ });
51
+
52
+ const view = new EditorView(parent, {
53
+ state,
54
+ attributes: { role: 'textbox', 'aria-multiline': 'true', 'aria-label': 'Document body' },
55
+ dispatchTransaction(tr: Transaction) {
56
+ const next = view.state.apply(tr);
57
+ view.updateState(next);
58
+ if (tr.docChanged) onDocChange(next.doc.toJSON());
59
+ },
60
+ });
61
+
62
+ return () => view.destroy();
63
+ }
64
+ ```
65
+
66
+ ### Tiptap v3 (ProseMirror) & BlockNote
67
+
68
+ - **SSR safety**: always set `immediatelyRender: false` in `useEditor()` inside Next.js/Remix/SSR apps so server and client HTML do not mismatch.
69
+ - **Undo/Redo footgun**: keep `StarterKit`'s built-in undo/redo **enabled** for single-user editors! Disable it (`undoRedo: false` in Tiptap v3) **only** when `@tiptap/extension-collaboration` (Yjs) owns history—copying `undoRedo: false` into a standalone editor silently breaks `Ctrl+Z` / `Cmd+Z`.
70
+ - **BlockNote**: use `@blocknote/react` (`useCreateBlockNote` + `<BlockNoteView>`) when a Notion-style block editor with slash menus, block drag handles, and optional Yjs sync is desired without assembling 15 Tiptap extensions by hand.
71
+ - **Persistence & XSS**: store canonical JSON (or sanitize HTML server-side with DOMPurify/allowlist before rendering read-only views).
72
+
73
+ ```tsx
74
+ 'use client';
75
+
76
+ import { useEditor, EditorContent } from '@tiptap/react';
77
+ import StarterKit from '@tiptap/starter-kit';
78
+ import Collaboration from '@tiptap/extension-collaboration';
79
+ import type * as Y from 'yjs';
80
+
81
+ export function DocumentEditor({ initialHtml, ydoc }: { initialHtml: string; ydoc?: Y.Doc }) {
82
+ const isCollaborative = Boolean(ydoc);
83
+ const editor = useEditor({
84
+ extensions: [
85
+ // ONLY disable built-in undoRedo when Yjs Collaboration provides history!
86
+ StarterKit.configure(isCollaborative ? { undoRedo: false } : {}),
87
+ ...(ydoc ? [Collaboration.configure({ document: ydoc })] : []),
88
+ ],
89
+ content: isCollaborative ? undefined : initialHtml,
90
+ immediatelyRender: false,
91
+ });
92
+
93
+ if (!editor) return null;
94
+ return <EditorContent editor={editor} />;
95
+ }
96
+ ```
97
+
98
+ ### Lexical
99
+
100
+ - Register every custom node class in `initialConfig.nodes` up front—unregistered nodes throw at runtime when parsed.
101
+ - Always pass `ErrorBoundary={LexicalErrorBoundary}` to `<RichTextPlugin>` and wrap every programmatic state mutation inside `editor.update(() => { ... })`.
102
+
103
+ ```tsx
104
+ import { LexicalComposer } from '@lexical/react/LexicalComposer';
105
+ import { RichTextPlugin } from '@lexical/react/RichTextPlugin';
106
+ import { ContentEditable } from '@lexical/react/ContentEditable';
107
+ import { HistoryPlugin } from '@lexical/react/HistoryPlugin';
108
+ import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
109
+
110
+ const initialConfig = {
111
+ namespace: 'NotesEditor',
112
+ onError(error: Error) {
113
+ throw error;
114
+ },
115
+ };
116
+
117
+ export function NotesEditor() {
118
+ return (
119
+ <LexicalComposer initialConfig={initialConfig}>
120
+ <RichTextPlugin
121
+ contentEditable={<ContentEditable aria-label="Document body" className="editor-input" />}
122
+ placeholder={<div className="editor-placeholder">Write a note…</div>}
123
+ ErrorBoundary={LexicalErrorBoundary}
124
+ />
125
+ <HistoryPlugin />
126
+ </LexicalComposer>
127
+ );
128
+ }
129
+ ```
130
+
131
+ ## Code editors and read-only highlighting
132
+
133
+ ### Shiki (read-only code blocks)
134
+
135
+ - Never ship CodeMirror or Monaco just to display read-only code snippets. Use **`shiki`** (`codeToHtml(code, { lang, themes: { light, dark } })`) at build time or inside Server Components / `.server.vue` / Astro for VS Code-accurate syntax highlighting with zero client JavaScript, using dual light/dark CSS variables so themes switch without re-highlighting.
136
+
137
+ ### CodeMirror 6
138
+
139
+ - Use `Compartment` to reconfigure dynamic settings (theme, language, `readOnly`, `tabSize`) via `view.dispatch({ effects: compartment.reconfigure(...) })` instead of destroying and recreating `EditorView` on every prop change (which loses undo history, scroll, and cursor selection).
140
+ - Always call `view.destroy()` on component unmount.
141
+
142
+ ```ts
143
+ import { Compartment, EditorState } from '@codemirror/state';
144
+ import { EditorView } from '@codemirror/view';
145
+
146
+ const tabSize = new Compartment();
147
+
148
+ const view = new EditorView({
149
+ state: EditorState.create({
150
+ doc: 'const x = 1;\n',
151
+ extensions: [tabSize.of(EditorState.tabSize.of(2))],
152
+ }),
153
+ parent: containerEl,
154
+ });
155
+
156
+ export function setTabSize(size: number) {
157
+ view.dispatch({ effects: tabSize.reconfigure(EditorState.tabSize.of(size)) });
158
+ }
159
+ ```
160
+
161
+ ### Monaco Editor
162
+
163
+ - Always lazy-load Monaco (`React.lazy` / dynamic `import()`) and configure its Web Workers (`MonacoEnvironment.getWorker`) so TypeScript/JSON language services do not run on the main thread.
164
+ - Dispose both the editor instance and created `ITextModel` instances on unmount to avoid multi-megabyte memory leaks.
165
+
166
+ ## Visual page builders & client-proof CMS authoring guardrails
167
+
168
+ - **Puck**: define a typed `Config` mapping component names to `fields` and `render`, author via `<Puck config={config} data={data} onPublish={save} />`, and render the published page cleanly on the server with `<Render config={config} data={data} />` without shipping editor chrome to end users.
169
+ - **Raw camera upload auto-transcode & focal-point crop**: non-technical editors routinely upload raw `10–15 MB` camera/phone photos (`4000×3000+` JPEG/PNG/HEIC). Enforce an upload/CDN pipeline (Sharp, Cloudflare Images, Sanity, Payload, Strapi, Imgix) that auto-rotates EXIF, strips sensitive GPS metadata, transcodes into responsive `AVIF`/`WebP` `srcset` widths, and honors **hotspot / focal-point coordinates** (`object-position: calc(var(--fp-x, 0.5) * 100%) calc(var(--fp-y, 0.5) * 100%)` or CDN `fp-x`/`fp-y` crop params) so portraits and product shots never get decapitated across card aspect ratios.
170
+ - **Word / Google Docs / Notion paste sanitization**: configure ProseMirror `editorProps.transformPastedHTML` (or Lexical `PASTE_COMMAND` + server allowlist) to strip inline `style="font-family: Calibri; color: #000000; font-size: 11pt"`, `<font>`, `MsoNormal` classes, arbitrary `<span>` soup, and accidental `<h1>` tags—converting pasted content cleanly into semantic `<h2>`–`<h4>`, `<p>`, `<ul>`/`<ol>`, `<blockquote>`, `<strong>`/`<em>`, and safe `<a>` nodes styled exclusively by design tokens.
171
+ - **Schema guardrails, alt-text enforcement & Draft Live Preview**: configure CMS field schemas (Sanity, Payload, Strapi, Contentful, Directus, Tina, Keystatic, Wagtail, Gutenberg) with soft/hard character limits and live counters on titles, card teasers, and SEO descriptions so long copy cannot shatter layouts; require explicit `alt` text (or an intentional `"Decorative"` checkbox emitting `alt=""`) before publishing media; and wire **Draft Mode / Live Preview** so editors inspect unpublished responsive pages in real templates prior to publish.
172
+
173
+ ```ts
174
+ // ProseMirror / Tiptap: strip Word & Google Docs inline style/font soup on paste
175
+ const cleanWordPaste = (html: string): string => {
176
+ const doc = new DOMParser().parseFromString(html, 'text/html');
177
+ doc.querySelectorAll('style, meta, link, script, xml, o\\:p').forEach((el) => el.remove());
178
+ doc.querySelectorAll('*').forEach((el) => {
179
+ el.removeAttribute('style');
180
+ el.removeAttribute('class');
181
+ el.removeAttribute('face');
182
+ el.removeAttribute('color');
183
+ el.removeAttribute('size');
184
+ if (el.tagName === 'H1') {
185
+ const h2 = doc.createElement('h2');
186
+ h2.innerHTML = el.innerHTML;
187
+ el.replaceWith(h2);
188
+ }
189
+ });
190
+ return doc.body.innerHTML;
191
+ };
192
+ ```
193
+
194
+ ## Accessibility, IME, and collaborative CRDT rules for editors
195
+
196
+ - Every editor must have an accessible name (`aria-label` or `aria-labelledby`) and a documented keyboard escape hatch from `Tab` indentation (for example, `Esc` then `Tab` or a visible toggle) so keyboard users are never trapped (WCAG 2.1.2).
197
+ - Toolbars must use roving `tabindex` (`role="toolbar"`) with `aria-pressed` on formatting toggles (`Bold`, `Italic`, `Code`).
198
+ - Never break IME composition (CJK/Vietnamese/accented input) by rewriting editor content synchronously on `keydown`/`input` during `isComposing`. For custom canvas or virtualized code editors in Chromium 121+, feature-detect the W3C **EditContext API** (`'EditContext' in window`) to decouple OS/IME composition (`textupdate`, `updateControlBounds`) from hidden DOM hacks, with a fallback for Safari/Firefox.
199
+ - **Collaborative rich text**: never roll ad-hoc string diffing or last-write-wins patches for concurrent document editing—use proven CRDT/OT engines (Yjs/YATA, Peritext-style rich-text mark CRDTs, or Fugue non-interleaving sequence CRDTs) so concurrent insertions at the same cursor do not corrupt or interleave characters.
200
+
201
+ ## Do/don't pairs
202
+
203
+ | Do | Don't |
204
+ |---|---|
205
+ | Set `immediatelyRender: false` in Tiptap `useEditor()` for SSR apps | Mount Tiptap immediately on the server and ship hydration mismatches |
206
+ | Disable `StarterKit` `undoRedo` **only** when Yjs Collaboration is attached | Copy `undoRedo: false` into a standalone single-user editor (silently breaks Undo/Redo) |
207
+ | Use **Shiki** (build/SSR) for read-only code blocks and CodeMirror 6 (`Compartment`) for editable inputs | Ship Monaco or CodeMirror just to highlight static code examples, or recreate `EditorView` on prop change |
208
+ | Lazy-load Monaco and configure Web Workers for desktop IDE surfaces | Bundle full Monaco synchronously into a mobile form or settings modal |
209
+ | Auto-transcode `10–15 MB` CMS uploads to AVIF/WebP `srcset` with focal-point crop, sanitize Word/Docs paste, and wire Draft Live Preview | Serve raw camera uploads directly, allow pasted `style="font-family: Calibri"` soup into production HTML, or publish blind without preview |
210
+ | Provide a `Tab` escape hatch and `role="toolbar"` roving focus | Trap keyboard focus inside `Tab`-indented editors |
211
+ | Sanitize persisted rich-text HTML or store structured JSON AST | Render unsanitized `dangerouslySetInnerHTML` from editor output |
212
+
213
+ ## Verification commands
214
+
215
+ ```sh
216
+ npm run build
217
+ npx playwright test
218
+ ```
219
+
220
+ Verify bundle chunk splitting (editor chunks lazy-loaded, `static`), and test typing, IME composition, undo/redo, Word/Google Docs paste cleanup, CMS focal-point crop, Draft Live Preview, and keyboard escape from `Tab` in a real browser (`rendered`).
@@ -0,0 +1,73 @@
1
+ # Rive and Lottie / dotLottie selection
2
+
3
+ ## Choose by behavior
4
+
5
+ | Need | Choose | Packages | Why |
6
+ |---|---|---|---|
7
+ | Interactive state machine, pointer-tracking rig, or data-bound vector animation | **Rive** | `@rive-app/react-canvas`, `@rive-app/canvas` (vanilla/Vue/Svelte), `@rive-app/webgl2` / `@rive-app/react-webgl2` (feathering / dense vector GPU scenes) | State machines and ViewModel Data Binding run in a compact WASM runtime without rebuilding timelines in JS |
8
+ | One-shot or looped vector illustration / empty-state graphic | **dotLottie** (`.lottie` archive) | `@lottiefiles/dotlottie-react`, `@lottiefiles/dotlottie-web` (WASM) | Compressed `.lottie` bundles with built-in theming/state support replace bloated legacy `lottie-web` JSON payloads |
9
+ | UI state, selection, validation, focus, or form feedback | Native DOM/CSS | N/A | Assistive tech and application state require semantic controls, not canvas pixels |
10
+ | Complex scroll choreography or path movement | GSAP / native CSS scroll timelines | `gsap` (`gsap.md`) | Timeline/scroll ownership is easier to inspect and synchronize with DOM |
11
+
12
+ ## Rive Data Binding (ViewModels) & dotLottie idioms
13
+
14
+ - **Rive Data Binding / ViewModels**: prefer Rive's **Data Binding (`autoBind: true` + `useViewModelInstanceString` / `Number` / `Boolean` / `Trigger`)** over brittle manual `useStateMachineInput` string lookups whenever the `.riv` asset defines a ViewModel. Keep application state authoritative; drive Rive properties from app state.
15
+ - **Rive cleanup & offscreen pause**: call `rive.cleanup()` on unmount in vanilla integrations (`useRive` handles disposal in React) and pause playback when hidden via `IntersectionObserver` or `prefers-reduced-motion`.
16
+ - **dotLottie reduced-motion & disposal**: pass `autoplay={!prefersReduced}` and call `dotLottie.pause(); dotLottie.setFrame(0);` (or render a static SVG/image fallback) under `prefers-reduced-motion: reduce`; call `dotLottie.destroy()` on unmount.
17
+
18
+ ```tsx
19
+ // Rive React: state machine + Data Binding (autoBind) + reduced-motion pause
20
+ import { useEffect } from 'react';
21
+ import { useRive, useViewModelInstanceNumber } from '@rive-app/react-canvas';
22
+
23
+ export function SyncGauge({ progress, reducedMotion }: { progress: number; reducedMotion: boolean }) {
24
+ const { rive, RiveComponent } = useRive({
25
+ src: '/animations/sync-gauge.riv',
26
+ artboard: 'Gauge',
27
+ stateMachines: 'State Machine 1',
28
+ autoBind: true,
29
+ autoplay: !reducedMotion,
30
+ });
31
+
32
+ const { setValue } = useViewModelInstanceNumber('progress', rive?.viewModelInstance);
33
+
34
+ useEffect(() => {
35
+ setValue(progress);
36
+ }, [progress, setValue]);
37
+
38
+ return (
39
+ <div role="img" aria-label={`Sync progress ${progress}%`}>
40
+ <RiveComponent />
41
+ </div>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ```tsx
47
+ // dotLottie React: compressed .lottie archive with reduced-motion guard
48
+ import { DotLottieReact } from '@lottiefiles/dotlottie-react';
49
+
50
+ export function EmptyArchiveGraphic({ reducedMotion }: { reducedMotion: boolean }) {
51
+ return (
52
+ <DotLottieReact
53
+ src="/animations/empty-archive.lottie"
54
+ loop={!reducedMotion}
55
+ autoplay={!reducedMotion}
56
+ aria-hidden="true"
57
+ />
58
+ );
59
+ }
60
+ ```
61
+
62
+ ## Integration checklist
63
+
64
+ - Keep application state authoritative; the animation reflects state and never replaces DOM controls or status text.
65
+ - Provide `aria-label` (for meaningful graphics) or `aria-hidden="true"` (for pure decoration alongside real DOM copy).
66
+ - Lazy-load WASM runtimes and `.riv`/`.lottie` files on routes/regions that need them, cache cleanly, and supply a static SVG/poster fallback if WASM or asset fetch fails.
67
+ - Pause offscreen loops (`IntersectionObserver` + `document.hidden`) and check asset provenance, embedded fonts/images, and licenses.
68
+
69
+ ## Official references
70
+
71
+ - Rive docs & Data Binding: https://rive.app/docs/
72
+ - Rive web runtimes: https://rive.app/docs/runtimes/web
73
+ - dotLottie web/React SDK: https://developers.lottiefiles.com/docs/dotlottie-player/dotlottie-web/