@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
@@ -1,6 +1,6 @@
1
- # SVG banners and motion media
1
+ # SVG banners, programmatic video, and vector motion export
2
2
 
3
- Vector banners and video frames share one problem: they are consumed through crops, scaling, compression, and platform UI outside the author's control. Build from real content and validate the exported artifact.
3
+ Vector banners, video loops, and motion graphics are consumed through crops, scaling, platform recompression, and host UI overlays outside the author's control. Build deterministically from real content and inspect the exported artifact.
4
4
 
5
5
  ## SVG banners and posters
6
6
 
@@ -8,105 +8,123 @@ SVG is ideal for deterministic banners because it is scalable, inspectable, and
8
8
 
9
9
  Rules:
10
10
 
11
- - use a correct `viewBox` and explicit width/height/export mapping;
11
+ - set an explicit `viewBox` plus width/height and export mapping;
12
12
  - include `<title>` and `<desc>` when SVG is inline in HTML; raster exports need platform alt text instead;
13
- - do not assume viewer fonts. Embed/convert text deliberately or ship/export with licensed font assets;
14
- - verify text wrapping yourself—ordinary SVG text does not flow like HTML;
15
- - avoid external images/fonts/scripts in untrusted or crawler-facing SVG; SVG can carry active content depending on serving context;
16
- - sanitize user-controlled SVG before serving it;
17
- - simplify paths enough for file size but preserve sharp edges at target scale;
18
- - test light/dark embedding contexts; transparent art can disappear or halo.
13
+ - do not assume viewer fonts—embed/convert text deliberately or export with bundled licensed fonts;
14
+ - verify text wrapping manually because ordinary SVG `<text>` does not reflow like HTML;
15
+ - strip scripts, foreignObject, and untrusted external URLs from crawler-facing or user-supplied SVG;
16
+ - test light and dark embedding contexts (`prefers-color-scheme` or solid backing) so transparent art never disappears or halos.
19
17
 
20
- For repository banners/docs, export PNG/WebP fallbacks where inline SVG is not supported. Preserve the source SVG and exact export preset.
18
+ For repository banners/docs, export PNG/WebP fallbacks where inline SVG is blocked, preserving the source SVG and exact export command.
21
19
 
22
20
  ## Aspect-ratio variants
23
21
 
24
- Design a system, not one cropped master:
22
+ Design a system rather than center-cropping one master:
25
23
 
26
- | Ratio | Typical frame | Role |
24
+ | Ratio | Typical frame | Role & mandatory safe inset |
27
25
  |---|---:|---|
28
- | 16:9 | 1920×1080 or 1280×720 | presentation, landscape video, docs |
29
- | 1:1 | 1080×1080 | square feed/embed |
30
- | 9:16 | 1080×1920 | story/short vertical video |
31
- | 2:1 | 1280×640 | GitHub social-preview baseline |
26
+ | 16:9 | 1920×1080 or 1280×720 | presentation, YouTube, landscape video, docs (`5–10%` edge inset; YouTube bottom-right duration badge clear) |
27
+ | 1:1 | 1080×1080 | square feed/embed (`>= 80 px` edge inset) |
28
+ | 9:16 | 1080×1920 | Reels / TikTok / Shorts: keep titles, faces, and burned-in captions clear of **`top >= 150–220 px`**, **`bottom >= 320–420 px`**, and **`right >= 120–160 px`** (`>= 60 px` left) |
29
+ | 1.91:1 / 2:1 | 1200×630 / 1280×640 | universal OG (`1000×500` center safe zone) / GitHub social preview |
32
30
 
33
- Recompose hierarchy for each ratio: square favors centered single-anchor compositions; vertical needs stacked hierarchy and platform-overlay awareness; landscape supports lateral sequencing. Do not blindly center-crop every frame.
31
+ Recompose hierarchy per ratio: never center-crop a `16:9` master into `9:16`—vertical feeds require stacking subject + open captions inside the `top 220 px .. bottom 1500 px`, `left 60 px .. right 920 px` clear corridor so TikTok/Reels/Shorts chrome never occludes copy.
34
32
 
35
- ## Remotion
33
+ ## Remotion (v4+)
36
34
 
37
- Remotion renders videos from React components using frames and composition metadata. Core shape:
35
+ Remotion renders deterministic video from React components using frame-driven state (`useCurrentFrame()`, `useVideoConfig()`, `spring()`, `interpolate()`).
38
36
 
39
- ```jsx
40
- import { Composition } from 'remotion';
37
+ ```tsx
38
+ import { Composition, OffthreadVideo, staticFile } from 'remotion';
39
+ import { TransitionSeries, linearTiming } from '@remotion/transitions';
40
+ import { fade } from '@remotion/transitions/fade';
41
+ import { loadFont } from '@remotion/google-fonts/Inter';
42
+
43
+ const { fontFamily } = loadFont('normal', { weights: ['600', '700'], subsets: ['latin'] });
41
44
 
42
45
  export const Root = () => (
43
46
  <Composition
44
- id="LaunchCard"
45
- component={LaunchCard}
46
- durationInFrames={150}
47
+ id="ReleaseHighlight"
48
+ component={ReleaseHighlight}
49
+ durationInFrames={180}
47
50
  fps={30}
48
51
  width={1920}
49
52
  height={1080}
50
- defaultProps={{ title: 'Pixelcraft' }}
53
+ defaultProps={{ title: 'Pixelcraft v2', clip: staticFile('demo.mp4') }}
51
54
  />
52
55
  );
53
56
  ```
54
57
 
55
- Inside a component use hooks/utilities such as `useCurrentFrame()`, `useVideoConfig()`, `spring()`, `interpolate()`, `Sequence`, `Img`, `Audio`, `Video`/`OffthreadVideo`, and `staticFile()` according to the installed version. Render locally/CI through the documented CLI or `renderMedia()` programmatic API.
56
-
57
- Rules:
58
+ Remotion v4+ production rules:
58
59
 
59
- - derive every visual state deterministically from frame/config/props;
60
- - pin `fps`, duration, dimensions, and output codec/container;
61
- - use `calculateMetadata` when dimensions/duration depend on props/data;
62
- - avoid browser-only APIs/random time/network state unless explicitly controlled;
63
- - preload or bundle fonts/assets; do not depend on unstable remote media;
64
- - test audio sync, dropped frames, alpha/transparent output, color space, and render concurrency;
65
- - keep captions as timed data rather than burned-in decoration only; supply caption files where platform supports them.
60
+ - **`<OffthreadVideo>` vs `<Video>`**: prefer `<OffthreadVideo>` during headless/server renders—it decodes exact frames via native FFmpeg outside Chromium's `<video>` element, preventing dropped frames, seek drift, and browser codec mismatches; use `<Video>` primarily inside interactive browser `<Player>` previews.
61
+ - **Interactive preview (`@remotion/player`)**: embed `<Player>` in web apps for real-time parameter previewing and scrubbing without invoking server rendering on every edit.
62
+ - **Cloud rendering**: scale batch/user-generated exports with **Remotion Lambda** (AWS Lambda distributed chunk rendering) or **Remotion Cloud Run** rather than blocking web request threads.
63
+ - **Official v4 packages**: use `@remotion/transitions` (`<TransitionSeries>`), `@remotion/captions` (SRT/WebVTT parsing + timed captions), and `@remotion/google-fonts` (deterministic font loading before frame 0).
64
+ - Derive every pixel strictly from `frame` and props; never use `Date.now()`, `Math.random()` without `random(seed)`, or unawaited CSS transitions (`transition: all`) which desync during frame-by-frame capture.
66
65
 
67
- ## Motion Canvas
66
+ ## Motion Canvas and Revideo
68
67
 
69
- Motion Canvas uses generator-based TypeScript scenes and a visual editor/player model. Typical scene style:
68
+ **Motion Canvas** uses generator-based TypeScript scenes with a visual timeline editor; **Revideo** is the maintained headless-first fork of Motion Canvas built for CLI/server-side programmatic rendering, parameterized scenes, audio tracks, and cloud video pipelines.
70
69
 
71
70
  ```tsx
72
- import { makeScene2D, Rect, Txt } from '@motion-canvas/2d';
73
- import { all, createRef, waitFor } from '@motion-canvas/core';
71
+ import { makeScene2D, Txt } from '@motion-canvas/2d';
72
+ import { createRef, waitFor } from '@motion-canvas/core';
74
73
 
75
74
  export default makeScene2D(function* (view) {
76
75
  const title = createRef<Txt>();
77
- view.add(<Txt ref={title} fill="white" fontSize={96}>Pixelcraft</Txt>);
78
- yield* title().opacity(1, 0.5);
79
- yield* waitFor(1);
76
+ const subtitle = createRef<Txt>();
77
+ // Frame 0 (0.0s) MUST render a legible title/poster immediately when autoplay is disabled
78
+ view.add(
79
+ <>
80
+ <Txt ref={title} fill="#f8fafc" fontSize={84} y={-26} opacity={1}>Pixelcraft v2</Txt>
81
+ <Txt ref={subtitle} fill="#94a3b8" fontSize={36} y={42} opacity={0}>Studio-Grade Motion</Txt>
82
+ </>,
83
+ );
84
+ yield* waitFor(0.2);
85
+ yield* subtitle().opacity(1, 0.45);
86
+ yield* waitFor(1.2);
80
87
  });
81
88
  ```
82
89
 
83
- Exact imports/animation helpers depend on version. Rules:
90
+ - Pick **Motion Canvas** for author-driven visual editing and technical explainer animations; pick **Revideo** (`@revideo/2d`, `@revideo/core`, `@revideo/renderer`) when you need headless CI/server video generation from the same generator paradigm;
91
+ - **Never start frame `0` (`0.0s`) empty or at `opacity={0}`**: paused embeds, reduced-motion fallbacks, and social feed scrubbers display `0.0s` whenever no external poster overrides it—render a legible title/poster state at `0.0s` before secondary transitions;
92
+ - use signals/layout references rather than visual guesses, pin project resolution/fps, and verify fonts in both editor and headless render.
84
93
 
85
- - use signals/layout references rather than visual guesses for alignment;
86
- - treat project settings (resolution/framerate/duration) as the artifact contract;
87
- - verify fonts in both editor preview and final render;
88
- - test deterministic output by rerendering the same revision;
89
- - use motion to establish object constancy or sequence—not constant floating decoration.
94
+ ## FFmpeg export pipeline
95
+
96
+ Standardize web and social video exports with explicit pixel format, container atom ordering, codec budget, loudness normalization, and caption tracks:
97
+
98
+ ```sh
99
+ # 1. Universal H.264 MP4 (Safari/QuickTime/iOS safe + fast web start + -14 LUFS social/web loudness)
100
+ ffmpeg -i input.mov -i captions.vtt \
101
+ -c:v libx264 -crf 20 -preset slow -pix_fmt yuv420p \
102
+ -c:a aac -b:a 160k -af "loudnorm=I=-14:TP=-1.5:LRA=11" \
103
+ -c:s mov_text -metadata:s:s:0 language=eng \
104
+ -movflags +faststart output.mp4
105
+
106
+ # 2. Compact web loop replacing heavy animated GIFs (VP9 WebM + H.264 MP4 fallback)
107
+ ffmpeg -i source.mov -an -c:v libvpx-vp9 -crf 32 -b:v 0 -pix_fmt yuv420p loop.webm
108
+ ffmpeg -i source.mov -an -c:v libx264 -crf 22 -pix_fmt yuv420p -movflags +faststart loop.mp4
109
+ ```
90
110
 
91
- ## Captions, sound, and accessibility
111
+ Critical FFmpeg rules:
92
112
 
93
- - never rely on sound for essential meaning;
94
- - provide captions/subtitles where the platform supports them; burned-in text must remain inside safe zones;
95
- - avoid flashing/strobing content and rapid full-screen luminance changes;
96
- - preserve color-independent meaning and sufficient contrast;
97
- - provide meaningful title/alt/context where the host platform supports it;
98
- - respect reduced-motion expectations in embeds and avoid autoplay sound.
113
+ - **`-pix_fmt yuv420p` is mandatory for H.264 compatibility**: default `yuv444p` / 10-bit output renders black or fails to open in Safari, QuickTime, and iOS;
114
+ - **`-movflags +faststart`**: relocates the MP4 `moov` atom to the start of the file so browsers begin playback immediately instead of downloading the entire file first;
115
+ - **Codec ladder**: use H.264 (`libx264`, `-crf 18–23`) as the universal baseline; add VP9 (`libvpx-vp9`) or AV1 (`libsvtav1`) `<source>` variants for bandwidth-heavy loops where target decoders support them;
116
+ - **Audio loudness (`loudnorm`)**: normalize social and web video feeds (YouTube, Reels, TikTok, Shorts, X, LinkedIn) to `loudnorm=I=-14:TP=-1.5:LRA=11` (`-14 LUFS` integrated loudness, `-1.5 dBTP` true-peak ceiling); use `-16 LUFS` only for Apple Podcasts and spoken-word mobile audio;
117
+ - **Captions**: mux WebVTT/SRT soft tracks (`-c:s mov_text` for MP4) AND keep burned-in open captions inside vertical/feed safe zones for muted social autoplay;
118
+ - **MP4/WebM loops over heavy GIFs**: replace multi-megabyte GIFs with muted looping `<video autoplay loop muted playsinline poster="first-frame.webp">` (typically 5–10× smaller with full 24-bit color and 60 fps); use GIF only on surfaces that disallow video embeds.
99
119
 
100
- ## Export verification
120
+ ## Lottie (`dotLottie`) and Rive vector export pipelines
101
121
 
102
- - inspect exact dimensions/frame rate/duration/codec/container/file size/audio sample rate;
103
- - inspect first/middle/last frames and motion-critical transitions;
104
- - test on device/feed scale and in light/dark contexts;
105
- - validate transparency/background behavior;
106
- - compare audio loudness/sync when audio exists;
107
- - test compression artifacts in the target platform or label platform verification `not-checked`;
108
- - keep deterministic seeds/settings and source assets under version control where licensing permits.
122
+ - **Lottie (`dotLottie`, `.lottie`)**: package JSON animations + bitmap assets/themes into a compressed `.lottie` archive rather than shipping bloated raw `.json`. Strip unsupported After Effects expressions, merge/track-matte glitches, and verify playback in the exact target player (`@lottiefiles/dotlottie-web`, iOS/Android native).
123
+ - **Rive (`.riv`)**: export compact binary `.riv` files with explicit artboard bounds, state-machine inputs, embedded fonts (or vector outlines), and a static reduced-motion state/poster image. Never hide critical UI copy exclusively inside opaque vector animation files without accessible text equivalents.
109
124
 
110
- ## Anti-slop warnings
125
+ ## Captions, sound, and export verification
111
126
 
112
- Reject endless floating gradients, fake product UI flying in depth without purpose, particles/sparkles replacing content, unreadable kinetic typography, cinematic trailers for mundane documentation updates, and logo animations with no information value. Motion should answer: what changed, where did it come from, what should the viewer understand next?
127
+ - Never rely on sound for essential meaning; avoid flashing/strobing luminance changes (>3 flashes/sec);
128
+ - keep burned-in captions inside platform safe zones and supply sidecar WebVTT/SRT where supported;
129
+ - inspect exported `ffprobe` metadata (dimensions, `pix_fmt`, fps, duration, codecs, bitrate, audio sample rate, byte size) (`static`) and inspect first/middle/last frames plus key transitions on light/dark backgrounds and mobile feed scale (`rendered`);
130
+ - reject endless floating gradients, fake tilted UI fly-throughs, sparkles replacing substance, and unreadable kinetic typography.
@@ -1,35 +1,34 @@
1
- # Satori, `@vercel/og`, and `ImageResponse`
1
+ # OG and programmatic image generation pipelines
2
2
 
3
- These tools are not browsers. They implement constrained JSX/CSS layout pipelines for deterministic image generation. Check the exact installed package/version because upstream Satori evolves independently from Vercel/Next wrappers.
3
+ Choose the generator for layout complexity, script shaping (Latin vs Arabic/Indic/CJK), output format (PNG/WebP/AVIF), latency budget, and runtime environment (Node.js, Rust, Edge, or headless browser).
4
4
 
5
5
  ## Pipeline boundaries
6
6
 
7
- | Tool | Output/model | Critical boundary |
8
- |---|---|---|
9
- | Satori | JSX/element tree → SVG string | requires explicit fonts; subset of HTML/CSS; no React state/effects; no guarantee of pixel-perfect browser parity |
10
- | `@vercel/og` | JSX/CSS → PNG through Satori + Resvg | Vercel documents only flexbox plus a subset of CSS; maximum bundle size 500 KB; TTF/OTF/WOFF fonts only |
11
- | Next.js `ImageResponse` (`next/og`) | route-level image response using `@vercel/og` | current Next docs repeat the flex-only/CSS-subset and 500 KB limits; import path changed from `next/server` to `next/og` in v14 |
7
+ | Tool | Output / model | Best for | Critical boundaries |
8
+ |---|---|---|---|
9
+ | **Takumi** (`@takumi-rs/image-response` / Rust) | Rust high-speed JSX/Tailwind → PNG/WebP/AVIF | fast dynamic OG cards needing **CSS Grid**, Flexbox, WOFF2 fonts, and WebP/AVIF output | native Rust binding (Node.js/server runtime or WASM build); verify CSS support per pinned version |
10
+ | **Next.js `ImageResponse` (`next/og`)** | JSX/CSS → PNG via Satori + Resvg | Next.js App Router `opengraph-image.tsx` routes | Next.js 15/16 defaults to **Node.js runtime** (`runtime = 'nodejs'`), lifting the 500 KB Edge limit and enabling `fs.readFile`; Edge Runtime (`runtime = 'edge'`) keeps the 500 KB bundle cap; Flexbox-only + TTF/OTF/WOFF fonts |
11
+ | **`@vercel/og`** | JSX/CSS → PNG via Satori + Resvg | Vercel Edge / serverless functions | 500 KB Edge bundle cap including JSX/fonts/assets; Flexbox-only subset; TTF/OTF/WOFF only (no WOFF2) |
12
+ | **Satori + `@resvg/resvg-js`** | JSX → SVG string → PNG buffer | framework-agnostic Node/CI/Astro/Remix OG generation | explicit font buffers required; no system fallback; handle emoji/CJK via `loadAdditionalAsset` |
13
+ | **Sharp** (`sharp`) | libvips raster compositing, resize, WebP/AVIF/PNG | compositing SVG/PNG badges, multi-crop social variants, strict byte budgets (WhatsApp <300 KB, GitHub <1 MB) | not an HTML/CSS layout engine; pair with SVG/Satori/Takumi |
14
+ | **`@napi-rs/canvas` / `skia-canvas`** | Rust/Skia 2D Canvas API in Node.js | custom generative art, pixel-exact charts, dense data badges without HTML layout | manual text wrapping and coordinate layout |
15
+ | **Playwright HTML-to-screenshot** | full Chromium render → PNG/JPEG/WebP | complex **Arabic/Indic/CJK bidirectional shaping**, full CSS Grid/subgrid, SVG filters, rich web components | high memory/cold-start latency; pre-render at build time or cache aggressively behind CDN |
12
16
 
13
- Upstream Satori's README describes a broader/evolving layout implementation. That does not override the narrower documented `@vercel/og`/`ImageResponse` contract. If a project calls Satori directly, inspect the pinned Satori version and feature table rather than assuming either the old or new limit.
17
+ ## Next.js 15/16 `ImageResponse` (Node.js runtime)
14
18
 
15
- ## Required constraints for Vercel/Next generation
19
+ In Next.js 15/16, `opengraph-image.tsx` and Route Handlers default to the **Node.js runtime** (`export const runtime = 'nodejs'`), which lifts the legacy 500 KB Edge bundle cap and allows reading local font assets directly via `node:fs/promises`:
16
20
 
17
- - use `display: flex` layouts; do not depend on CSS grid;
18
- - use only the documented supported CSS subset;
19
- - maximum bundle size is 500 KB including JSX/CSS/fonts/images/assets;
20
- - font data must be supplied explicitly as `Buffer`/`ArrayBuffer`;
21
- - supported font formats are TTF, OTF, and WOFF—not WOFF2; TTF/OTF are preferred for parsing speed;
22
- - every text style needs matching family/weight/style font data;
23
- - images need explicit dimensions and reliable data/URLs; prefer inline/buffer data where latency/reliability matters;
24
- - JSX must be pure/static: no hooks/state/effects/browser DOM assumptions.
25
-
26
- ## Font loading pattern
27
-
28
- ```jsx
21
+ ```tsx
29
22
  import { ImageResponse } from 'next/og';
23
+ import { readFile } from 'node:fs/promises';
24
+ import { join } from 'node:path';
30
25
 
31
- export async function GET() {
32
- const fontData = await fetch(new URL('./Inter-Bold.ttf', import.meta.url)).then((res) => res.arrayBuffer());
26
+ export const runtime = 'nodejs'; // default in Next.js 15/16; lifts 500 KB Edge cap
27
+ export const size = { width: 1200, height: 630 };
28
+ export const contentType = 'image/png';
29
+
30
+ export default async function Image() {
31
+ const interBold = await readFile(join(process.cwd(), 'assets/fonts/Inter-Bold.ttf'));
33
32
 
34
33
  return new ImageResponse(
35
34
  (
@@ -38,70 +37,118 @@ export async function GET() {
38
37
  width: '100%',
39
38
  height: '100%',
40
39
  display: 'flex',
41
- alignItems: 'center',
42
- padding: 80,
43
- background: '#101820',
44
- color: 'white',
40
+ flexDirection: 'column',
41
+ justifyContent: 'space-between',
42
+ padding: 72,
43
+ background: '#0f172a',
44
+ color: '#f8fafc',
45
45
  fontFamily: 'Inter',
46
46
  }}
47
47
  >
48
- Pixelcraft
48
+ <div style={{ fontSize: 64, fontWeight: 700, lineHeight: 1.1 }}>Pixelcraft</div>
49
+ <div style={{ fontSize: 28, color: '#cbd5e1' }}>Portable UI craft across every surface</div>
49
50
  </div>
50
51
  ),
51
52
  {
52
- width: 1200,
53
- height: 630,
54
- fonts: [
55
- {
56
- name: 'Inter',
57
- data: fontData,
58
- weight: 700,
59
- style: 'normal',
60
- },
61
- ],
53
+ ...size,
54
+ fonts: [{ name: 'Inter', data: interBold, weight: 700, style: 'normal' }],
62
55
  },
63
56
  );
64
57
  }
65
58
  ```
66
59
 
67
- Exact behavior depends on runtime/framework. Do not fetch secrets or unbounded remote URLs. Cache font bytes deliberately; font loading can dominate cold-start time and bundle size.
60
+ If you explicitly opt into `export const runtime = 'edge'`, enforce the 500 KB total bundle cap and load fonts via `fetch(new URL('./Inter-Bold.ttf', import.meta.url))`.
61
+
62
+ ## Satori + `@resvg/resvg-js` (`loadAdditionalAsset` & `tw` caveats)
68
63
 
69
- ## Satori direct-use pattern
64
+ Use Satori directly with `@resvg/resvg-js` when you want deterministic Node/CI generation outside Vercel/Next:
70
65
 
71
- ```js
66
+ ```ts
72
67
  import satori from 'satori';
68
+ import { Resvg } from '@resvg/resvg-js';
69
+ import { readFile } from 'node:fs/promises';
70
+
71
+ const interBold = await readFile('./assets/Inter-Bold.ttf');
73
72
 
74
73
  const svg = await satori(element, {
75
74
  width: 1200,
76
75
  height: 630,
77
- fonts: [{ name: 'Inter', data: interBuffer, weight: 700, style: 'normal' }],
76
+ fonts: [{ name: 'Inter', data: interBold, weight: 700, style: 'normal' }],
77
+ // On-demand emoji (Twemoji SVG data URI) or CJK subset fonts without bloating the base bundle
78
+ loadAdditionalAsset: async (code, segment) => {
79
+ if (code === 'emoji') {
80
+ return await loadLocalTwemojiDataUri(segment);
81
+ }
82
+ return '';
83
+ },
84
+ });
85
+
86
+ // Satori already converts glyphs to vector paths; disable system font scanning for speed & determinism
87
+ const resvg = new Resvg(svg, {
88
+ fitTo: { mode: 'width', value: 1200 },
89
+ font: { loadSystemFonts: false },
78
90
  });
91
+ const pngBuffer = resvg.render().asPng();
79
92
  ```
80
93
 
81
- Satori returns SVG. Convert to PNG with an explicit rasterizer such as Sharp/librsvg or Resvg depending on the environment; verify text rasterization and bundled native/runtime dependencies. `@vercel/og` already performs its own PNG pipeline.
94
+ Satori caveats:
82
95
 
83
- ## Layout guidance
96
+ - **`tw` prop**: Satori's built-in Tailwind `tw="..."` prop parses a constrained Tailwind v3-era subset (no CSS Grid, no Tailwind v4 `oklch()` / CSS variables, no responsive breakpoints or arbitrary pseudo-selectors). Prefer explicit `style` objects or inspect rendered PNG bytes whenever using `tw`.
97
+ - **`loadAdditionalAsset`**: use for Twemoji/OpenMoji SVG data URIs or on-demand CJK/Arabic subset fonts so missing glyphs never render as tofu boxes; pin local or allowlisted assets rather than making uncached per-request external fetches.
98
+ - **No implicit system fallback**: every weight (`400`, `700`) and style (`normal`, `italic`) used in JSX needs a matching buffer in `fonts`.
84
99
 
85
- - compose with nested flex rows/columns and absolute positioning where supported;
86
- - avoid external stylesheets/selectors/media queries/pseudo-elements unless the pinned renderer explicitly supports them;
87
- - do not rely on system fonts; there is no implicit system font fallback in Satori-style rendering;
88
- - test emoji/CJK/RTL/Indic scripts explicitly—font coverage and shaping are renderer/font dependent;
89
- - keep text wrapping deterministic by constraining width/height and using explicit ellipsis/truncation strategy where supported;
90
- - test missing image/font/fetch failure states; a broken OG route should fail visibly in monitoring rather than emit a blank card.
100
+ ## Takumi (Rust JSX/Tailwind → PNG/WebP/AVIF)
91
101
 
92
- ## Security and performance
102
+ Use **Takumi** (`@takumi-rs/image-response` or native Rust crate) when you need Satori-style JSX authoring with **CSS Grid**, **WOFF2** font support, native **WebP/AVIF** compression, and multi-millisecond Rust throughput:
103
+
104
+ ```tsx
105
+ import { ImageResponse } from '@takumi-rs/image-response';
106
+
107
+ export async function renderCard(title: string) {
108
+ return new ImageResponse(
109
+ (
110
+ <div className="grid grid-cols-12 h-full w-full bg-[#0f172a] text-white p-16 gap-8">
111
+ <div className="col-span-8 flex flex-col justify-center">
112
+ <h1 className="text-6xl font-bold leading-tight">{title}</h1>
113
+ </div>
114
+ </div>
115
+ ),
116
+ // Use 'png' (or JPEG via Sharp) for universal og:image chat unfurlers (Zalo, iMessage, Slack, LinkedIn); reserve 'webp'/'avif' for in-app <img>/<picture>
117
+ { width: 1200, height: 630, format: 'png' },
118
+ );
119
+ }
120
+ ```
121
+
122
+ ## Sharp composite and unfurler-safe `< 300 KB` pipeline
123
+
124
+ Use **Sharp** to composite generated overlays inside the **center `1000×500` safe zone** of a `1200×630` card and emit universally decodable **JPEG (`mozjpeg`) or palette-quantized PNG** under `< 200–300 KB` so Zalo, WhatsApp, iMessage, Slack, X, and LinkedIn unfurlers never drop the preview:
125
+
126
+ ```ts
127
+ import sharp from 'sharp';
128
+
129
+ await sharp('base-1200x630.png')
130
+ .composite([{ input: svgOverlayBuffer, top: 65, left: 100 }]) // 1000x500 center safe zone
131
+ .jpeg({ quality: 84, mozjpeg: true }) // or .png({ palette: true, compressionLevel: 9 }) for flat UI cards
132
+ .toFile('og-card.jpg');
133
+ ```
134
+
135
+ ## `@napi-rs/canvas` / `skia-canvas` and Playwright HTML-to-screenshot
136
+
137
+ - **`@napi-rs/canvas` / `skia-canvas`**: choose for procedural visualizations, sparklines, and canvas-native graphics where explicit `ctx.measureText` + Skia rendering outperform HTML boxes. Register fonts via `GlobalFonts.registerFromPath(...)` / `FontLibrary.use(...)`.
138
+ - **Playwright HTML-to-screenshot**: choose when cards require **complex Arabic/RTL, Devanagari/Indic, Thai, or mixed CJK bidirectional shaping**, full CSS Grid/subgrid, `backdrop-filter`, or real rendered UI components:
139
+
140
+ ```ts
141
+ await page.setViewportSize({ width: 1200, height: 630 });
142
+ await page.setContent(safeHtml, { waitUntil: 'networkidle' });
143
+ await page.evaluate(() => document.fonts.ready);
144
+ await page.screenshot({ path: 'og-ar.png', type: 'png' });
145
+ ```
93
146
 
94
- - treat user-controlled text as untrusted input; do not interpolate raw HTML/script behavior;
95
- - constrain remote asset domains and timeouts;
96
- - cache immutable generated assets by content/input hash;
97
- - measure cold/warm latency and memory, especially font parsing/rasterization;
98
- - do not expose private data in public preview images or metadata.
147
+ Never render untrusted user HTML directly in Playwright—escape text strictly, block internal network requests (SSRF protection), and cache by content hash.
99
148
 
100
- ## Verification
149
+ ## Security, caching, and verification
101
150
 
102
- 1. inspect generated bytes/dimensions/content type;
103
- 2. render/compare light/dark and crop-scale thumbnails;
104
- 3. verify actual text shaping/wrapping for target scripts;
105
- 4. test missing font/image/network failure;
106
- 5. validate platform crawler can fetch the absolute URL;
107
- 6. record whether layout behavior was checked against Satori direct use, `@vercel/og`, or Next `ImageResponse`—their contracts are not identical.
151
+ - Treat user-supplied titles/handles as untrusted text; bound character length and sanitize/escape before templating;
152
+ - constrain remote image domains and timeouts (or inline buffers) so slow external hosts never stall crawlers;
153
+ - cache generated OG images immutably by content/version hash (`Cache-Control: public, max-age=31536000, immutable`);
154
+ - inspect generated byte size, exact dimensions, `Content-Type`, thumbnail legibility at 25–33% scale, and target script shaping (`rendered`); record which renderer produced the image.
@@ -1,72 +1,71 @@
1
1
  # Social cards, frames, and platform safe zones
2
2
 
3
- Platform behavior changes often and varies by client. Treat dimensions below as production baselines, then validate with current platform documentation/debuggers before release. Do not copy third-party size lists as immutable truth.
3
+ Platform behavior changes frequently and varies by client. Treat dimensions and constraints below as production baselines, then validate with current platform debuggers/previews before release.
4
4
 
5
5
  ## Working size table
6
6
 
7
7
  | Placement | Working frame | Ratio / constraint | Practical guidance |
8
8
  |---|---:|---|---|
9
- | Open Graph default | 1200×630 | 1.91:1 | safest general `og:image` baseline; PNG/JPEG/WebP depending platform support |
10
- | Facebook/Meta link preview | 1200×630 baseline | about 1.91:1 | use absolute HTTPS URL; inspect Sharing Debugger/cache behavior |
11
- | LinkedIn link preview | 1200×627 baseline | close to 1.91:1 | minor crop difference means edge text is unsafe |
12
- | X/Twitter large card | 1200×600 baseline | 2:1 target | supply accurate `twitter:card`/image metadata; verify current card type |
13
- | square thumbnail fallback | 1200×1200 or platform-specific square | 1:1 | use only when platform/card type explicitly favors square |
14
- | GitHub repository social preview | 1280×640 recommended; 640×320 minimum | exactly 2:1; PNG/JPG/GIF under 1 MB | upload in repository Settings → General → Social preview; keep essential content in a conservative central safe area |
15
- | video/presentation landscape | 1920×1080 | 16:9 | standard video/slide frame; edges still need inset |
16
- | vertical short video/story | 1080×1920 | 9:16 | platform UI overlays top/bottom/side; use platform-specific safe templates |
17
- | square feed/video | 1080×1080 | 1:1 | validate feed crop and compression |
18
-
19
- File-size/type limits are platform-specific. GitHub's documented repository preview rules are the most concrete here: recommended 1280×640, minimum 640×320, PNG/JPG/GIF, under 1 MB. For other platforms, confirm current crawler/card documentation instead of inventing exact cache or file-size guarantees.
20
-
21
- ## Safe-area design
22
-
23
- No single rectangle is universally safe. Apply layered protection:
24
-
25
- 1. keep logos/text at least 5% of frame width/height away from edges;
26
- 2. keep essential content inside the central horizontal band for landscape cards;
27
- 3. for GitHub's 2:1 preview, treat the central region—approximately the middle half of width and height—as the must-survive zone and inspect actual shares;
28
- 4. for vertical video, consult current platform UI overlays because buttons/captions/progress bars cover different regions;
29
- 5. export crop/contact-sheet variants rather than inspecting only the master frame.
30
-
31
- Never put critical meaning in corners. Corners are the first casualty of cropping, overlay badges, player chrome, rounded masks, and compression artifacts.
32
-
33
- ## Thumbnail legibility
34
-
35
- Design at final dimensions but inspect scaled down. Practical rules:
36
-
37
- - one short headline or product name; usually fewer than ~8 words unless the brand requires more;
38
- - minimum effective type size is whatever remains readable at feed scale—test at 25–33% display size, not just 100%;
39
- - prefer high x-height, sturdy weight, generous letterspacing, and strong contrast;
40
- - avoid thin strokes, dense code/screenshots, small chart axes, texture behind text, and multi-line legal copy;
41
- - use one dominant visual anchor: product artifact, diagram, mark, number, or distinctive composition;
42
- - test light/dark feed backgrounds because transparent PNG edges/halos can fail.
43
-
44
- ## Metadata and delivery
45
-
46
- - use absolute HTTPS URLs for `og:image`/Twitter metadata;
47
- - include accurate `og:title`, `og:description`, canonical URL, image dimensions/alt metadata where supported;
48
- - ensure crawler access: no authentication, robots block, broken redirect, intermittent certificate, or hotlink protection;
49
- - serve correct content type/cache headers and keep the URL stable when appropriate;
50
- - social platforms cache aggressively. Debugging/refresh tools and deployment sequencing matter; changing pixels at the same URL may not propagate immediately;
51
- - localization needs separate metadata/assets only when the platform/link resolution can actually select them.
9
+ | Open Graph default (`og:image`) | 1200×630 | 1.91:1 | safest general baseline; PNG/JPEG/WebP depending on client support |
10
+ | YouTube thumbnail | 1280×720 | 16:9; JPG/PNG/WebP under 2 MB | keep critical text/faces out of the **bottom-right duration timestamp overlay zone** (~20% width × 15% height); validate legibility at mobile feed width (~160px) |
11
+ | X / Twitter large card | 1200×600 (or 1200×630) | 2:1 / 1.91:1; under 5 MB | set `twitter:card="summary_large_image"` + `twitter:image:alt`; verify crop at 2:1 |
12
+ | Facebook / Meta & LinkedIn | 1200×630 / 1200×627 | ~1.91:1 | use absolute HTTPS URL; minor vertical crop difference makes edge text unsafe |
13
+ | Bluesky | 1200×630 | 1.91:1; blob limit ~1 MB | AT Protocol card crawler fetches `og:image` and re-encodes to JPEG/WebP; requires public unauthenticated fetch |
14
+ | Mastodon / Fediverse | 1200×630 | 1.91:1 | federated instances crawl/cache independently and crop across web/Ivory/Elk clients; set `og:image:alt` and optional `fediverse:creator` |
15
+ | Discord | 1200×630 | 1.91:1 | include `twitter:card="summary_large_image"`—without it Discord often shrinks `og:image` to a small right-aligned square thumbnail; `<meta name="theme-color">` sets the embed accent stripe |
16
+ | Slack | 1200×630 | 1.91:1; `< 1 MB` fast crawl | unfurls `og:title`/`og:description`/`og:image` (PNG/JPEG safest); supports `twitter:label1`/`twitter:data1` metadata rows |
17
+ | **Zalo** (chat & Official Account) | 1200×630 | 1.91:1; **`< 300 KB–500 KB`**, PNG/JPEG | Zalo link crawler caches `og:image` aggressively, requires fast public HTTPS TTFB (`< 2 s`), and frequently drops `svg`/`webp` or oversized PNGs—keep copy in the **center `1000×500` safe zone** so 1:1 / mobile chat list crops survive |
18
+ | WhatsApp | 1200×630 (or 1:1) | **strict `< 300 KB`** (target `< 200 KB`) | exceeding ~300 KB or slow TTFB causes WhatsApp to drop the thumbnail silently; declare `og:image:width`, `og:image:height`, `og:image:type`, and serve optimized **JPEG or indexed PNG** |
19
+ | Telegram | 1200×630 | 1.91:1; `< 1 MB` | uses `og:image` + `twitter:card="summary_large_image"`; refresh stale caches with `@WebpageBot` |
20
+ | iMessage / Apple Rich Links | 1200×630 | 1.91:1; `< 1 MB` PNG/JPEG | Apple `LPLinkMetadata` requires `og:image` (`>= 300px` wide so it does not collapse to a small icon; SVG `og:image` is ignored) plus `apple-touch-icon` |
21
+ | GitHub repository social preview | 1280×640 rec.; 640×320 min | exactly 2:1; PNG/JPG/GIF under 1 MB | upload in Settings → General → Social preview; keep essential content inside the central `1000×500` safe zone |
22
+ | Video / presentation landscape | 1920×1080 | 16:9 | standard video/slide frame; inset edges 5–10% |
23
+ | Vertical short video (`Reels / TikTok / Shorts`) | 1080×1920 | 9:16 | strict UI exclusion margins: **`top >= 150–220 px`**, **`bottom >= 320–420 px`**, **`right >= 120–160 px`** |
24
+ | Square feed / thumbnail fallback | 1080×1080 or 1200×1200 | 1:1 | use only when the platform/card type favors square |
25
+
26
+ ## Safe-area & `9:16` exclusion-zone geometry
27
+
28
+ No single rectangle is universally safe. Lock layout guides to exact pixel coordinates:
29
+
30
+ 1. **`1200×630` (`1.91:1`) universal OG safe zone (`1000×500` center box)**: inset at least **`100 px` left/right and `65 px` top/bottom** (`1000×500` inner box) so X (`2:1` `1200×600`), LinkedIn (`1200×627`), iMessage rounded bubbles, Slack, and Zalo mobile previews never clip headlines or brand marks;
31
+ 2. **`1080×1920` (`9:16`) Reels / TikTok / YouTube Shorts exclusion zones**: host chrome covers three edges simultaneously—keep all headlines, speaker faces, and burned-in captions strictly clear of:
32
+ - **`top >= 150–220 px`** (status bar, notch, search/live header),
33
+ - **`bottom >= 320–420 px`** (account handle, expandable multi-line caption, audio marquee, shop/CTA pill, scrub bar),
34
+ - **`right >= 120–160 px`** (vertical avatar, like, comment, bookmark, and share icon rail), plus `>= 60 px` left margin;
35
+ 3. **YouTube `1280×720` thumbnails**: leave the bottom-right `~260×110 px` clear of words or faces for the duration timestamp badge;
36
+ 4. export a crop & overlay contact sheet (`1200×630` + `1000×500` box, `2:1`, `9:16` UI mask, and `25%` thumbnail scale) rather than inspecting only the raw 100% canvas.
37
+
38
+ ## Thumbnail legibility (`150–300 px` downscale check)
39
+
40
+ Design at final dimensions, then verify scaled down:
41
+
42
+ - one short headline or product name (typically `<= 6–8` words);
43
+ - test readability when downscaled to **`150–300 px` thumbnail width** (`25–33%` scale) in **both light and dark social feeds**;
44
+ - prefer high x-height, sturdy weight, generous tracking, and strong foreground/background contrast;
45
+ - avoid thin strokes, dense code screenshots, tiny chart axes, busy textures behind text, and legal footnotes;
46
+ - use one dominant visual anchor: real product detail, simplified diagram, decisive metric, or recognizable mark;
47
+ - test light and dark host feed backgrounds so transparent PNG edges never halo or vanish.
48
+
49
+ ## Metadata, format fallbacks, byte budgets, and delivery
50
+
51
+ - **Absolute `https://` + PNG/JPEG `og:image` compatibility**: **never point `og:image` or `twitter:image` at an `.svg`** (all major social/chat crawlers reject SVG for security), and **prefer optimized `.png` or `.jpg` over `.webp`/`.avif`** for `og:image` because Zalo, older Outlook/Slack unfurlers, LinkedIn edge scrapers, and enterprise link-preview proxies still drop WebP/AVIF thumbnails silently;
52
+ - include `og:title`, `og:description`, `og:image`, `og:image:secure_url`, `og:image:width` (`1200`), `og:image:height` (`630`), `og:image:type` (`image/png` or `image/jpeg`), `og:image:alt`, `twitter:card="summary_large_image"`, and `twitter:image:alt`;
53
+ - keep **WhatsApp / Zalo** OG assets **`< 200–300 KB`** (`< 1 MB` across Slack/iMessage/X/LinkedIn/Bluesky) with crawler response **`< 1.5–2.0 s`** (no auth wall, `robots.txt` block on `/og/*`, or slow cold-start timeouts);
54
+ - cache-bust via versioned path/query (`/og/v2/post-slug.png`) when updating artwork because Zalo, LinkedIn, Telegram (`@WebpageBot`), Slack, and iMessage cache unfurls aggressively.
52
55
 
53
56
  ## Composition patterns
54
57
 
55
- Useful patterns:
56
-
57
- - **artifact-first:** product screenshot/interface detail cropped intentionally and enlarged;
58
+ - **artifact-first:** real product interface cropped intentionally and enlarged;
58
59
  - **statement-first:** short claim/name in editorial typography with one supporting visual motif;
59
- - **system-first:** diagram/map/flow simplified to one readable idea;
60
- - **identity-first:** strong logo/wordmark only when recognition already exists.
60
+ - **system-first:** architecture/flow diagram simplified to one readable idea;
61
+ - **identity-first:** bold mark/wordmark only when audience recognition already exists.
61
62
 
62
- Anti-slop pattern: centered logo over gradient, floating glass browser frame, random sparkle/rocket, fake user avatars, “Do more with less” copy, tiny feature checklist, and unrelated stock imagery. Distinctiveness should come from the subject's real material and disciplined scale contrast.
63
+ Anti-slop: centered logo over purple-blue gradient, floating glass browser chrome, random rocket/sparkle clip art, fake avatars, tiny feature checklists, and unrelated stock photos.
63
64
 
64
- ## Verification matrix
65
+ ## Verification matrix & required deliverables
65
66
 
66
- - inspect exported file dimensions/type/bytes;
67
- - inspect at 100%, feed scale, and mobile density;
68
- - inspect light/dark feed backgrounds;
69
- - test crawler/debugger/share preview when available;
70
- - verify compression/crop in target client or label it `not-checked`;
71
- - confirm alt text/metadata/link destination;
72
- - retain source file/export preset for repeatable updates.
67
+ - inspect exported file dimensions, MIME type, exact byte count against target caps (WhatsApp/Zalo `< 300 KB`, GitHub `< 1 MB`, YouTube `< 2 MB`), and attach a complete **asset license table** (fonts, photos, icons, audio/music, AI provenance) (`static`);
68
+ - inspect at `100%` and **`150–300 px` downscaled thumbnail width** on **both light and dark social feed backgrounds** (`rendered`);
69
+ - verify YouTube bottom-right safe zone and `2:1` / `1.91:1` / `1:1` / `9:16` crop overlays (`rendered`);
70
+ - capture **live share-debugger / unfurl previews (`Facebook`, `X`, `LinkedIn`, `Zalo`)** (`rendered`, or explicitly label unhosted/offline platforms `not-checked`);
71
+ - confirm `og:image:alt`, `twitter:card`, absolute HTTPS URLs, and reproducible export preset (`static`).