@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,54 +1,124 @@
1
- # R Shiny (adjacent data-app ecosystem)
2
-
3
- This is not Python, but Shiny belongs in the same rapid data-app decision space. Do not force Python idioms onto reactive R code.
4
-
5
- ## Token mapping
6
-
7
- Use `bslib::bs_theme()` arguments (`bg`, `fg`, `primary`, `base_font`, `heading_font`) and Bootswatch only as a deliberate base. Add scoped custom CSS variables/rules for semantic roles; use `thematic` so plots inherit app colors/fonts where appropriate.
8
-
9
- ## Layout and responsive idioms
10
-
11
- Use `page_sidebar`, `page_navbar`, cards/layout columns and Bootstrap responsivity rather than absolute positioning. Sidebar is for controls, navigation for tasks—do not overload both. Validate narrow/embedded windows.
12
-
13
- ## Typography/custom fonts
14
-
15
- Configure `base_font`/`heading_font` or webfont helpers deliberately. Verify numeric legibility, fallback, localization, plot font matching, scaling.
16
-
17
- ## Motion/reduced motion
18
-
19
- Browser CSS controls most motion. Keep progress/spinner behavior truthful and honor `prefers-reduced-motion` in custom CSS. Reactive invalidation must not masquerade as progress.
20
-
21
- ## Accessibility specifics
22
-
23
- Use headings/landmarks/labels, alt text or text summaries for plots, non-color encodings, keyboard-reachable controls, accessible tables, focus management after dynamic UI. Shiny/Bootstrap maturity does not make arbitrary output accessible.
1
+ # R Shiny
2
+
3
+ Shiny for R belongs in the rapid data-app space with its own reactive idioms; do not force Python patterns onto R code.
4
+
5
+ ## Token mapping and bslib layout
6
+
7
+ Use `bslib::bs_theme(version = 5, ...)` paired with `thematic::thematic_shiny()` so ggplot2/lattice/base plots automatically inherit UI colors and fonts. Build responsive shells with `page_sidebar()`, `page_navbar()`, `layout_columns()`, `card(full_screen = TRUE)`, `value_box()`, and `input_dark_mode()`.
8
+
9
+ ## Modern R Shiny idioms (`bslib`, `ExtendedTask` + `mirai`, `bindCache`, `shinychat`/`ellmer`, modules)
10
+
11
+ ```r
12
+ library(shiny)
13
+ library(bslib)
14
+ library(mirai)
15
+ library(shinychat)
16
+ library(ellmer)
17
+
18
+ # Start background worker daemons once per R process for non-blocking tasks
19
+ daemons(2)
20
+ onStop(function() daemons(0))
21
+
22
+ # Reusable namespaced module isolating per-instance state
23
+ kpi_module_ui <- function(id) {
24
+ ns <- NS(id)
25
+ card(
26
+ full_screen = TRUE,
27
+ card_header("Regional summary"),
28
+ uiOutput(ns("summary_box"))
29
+ )
30
+ }
31
+
32
+ kpi_module_server <- function(id, region_reactive) {
33
+ moduleServer(id, function(input, output, session) {
34
+ cached_summary <- reactive({
35
+ req(region_reactive())
36
+ query_region_summary(region_reactive())
37
+ }) |> bindCache(region_reactive(), cache = "session") # use "session" for user-private data
38
+
39
+ output$summary_box <- renderUI({
40
+ df <- cached_summary()
41
+ validate(need(nrow(df) > 0, "No records match the selected region."))
42
+ value_box(title = "Total revenue", value = scales::dollar(sum(df$revenue)))
43
+ })
44
+ })
45
+ }
46
+
47
+ ui <- page_sidebar(
48
+ title = "Operations Console",
49
+ theme = bs_theme(version = 5, primary = "#005f73", bg = "#faf8f1", fg = "#161b24"),
50
+ sidebar = sidebar(
51
+ selectInput("region", "Region", choices = c("EMEA", "AMER", "APAC")),
52
+ input_task_button("run_sim", "Run Monte Carlo"),
53
+ input_dark_mode(id = "mode")
54
+ ),
55
+ layout_columns(
56
+ kpi_module_ui("kpi"),
57
+ card(card_header("Simulation"), tableOutput("sim_tbl")),
58
+ card(card_header("Analyst chat"), chat_ui("assistant"))
59
+ )
60
+ )
61
+
62
+ server <- function(input, output, session) {
63
+ kpi_module_server("kpi", reactive(input$region))
64
+
65
+ # Non-blocking background computation across sessions via ExtendedTask + mirai
66
+ sim_task <- ExtendedTask$new(function(region) {
67
+ mirai({ run_heavy_simulation(r) }, r = region)
68
+ }) |> bind_task_button("run_sim")
69
+
70
+ observeEvent(input$run_sim, {
71
+ sim_task$invoke(input$region)
72
+ })
73
+
74
+ output$sim_tbl <- renderTable({
75
+ res <- sim_task$result()
76
+ validate(need(nrow(res) > 0, "Simulation returned no rows."))
77
+ res
78
+ })
79
+
80
+ # Streaming LLM assistant with shinychat + ellmer
81
+ llm <- chat_openai(system_prompt = "Answer concise analytics questions.")
82
+ observeEvent(input$assistant_user_input, {
83
+ stream <- llm$stream_async(input$assistant_user_input)
84
+ chat_append("assistant", stream)
85
+ })
86
+ }
87
+
88
+ shinyApp(ui, server)
89
+ ```
24
90
 
25
- ## States idiom
91
+ ## Typography, motion, and accessibility
26
92
 
27
- Reactive dependencies need explicit empty/no-data/error/loading/permission/stale states. Use req/validate/showNotification/progress deliberately; distinguish no rows from query failure. Expensive work needs caching, invalidation, cancellation expectations, and multi-user isolation.
93
+ Set `base_font` and `heading_font` in `bs_theme()` (e.g., `font_google(...)` or locally hosted fonts for air-gapped deployments). Prefer `input_task_button` and `withProgress` over decorative motion, and honor `prefers-reduced-motion` in custom CSS. Provide labels for every input, use `validate(need(...))` so empty or invalid states display clear copy instead of blank containers, and add text/table alternatives alongside plots.
28
94
 
29
- ## Forms idiom
95
+ ## States and forms idiom
30
96
 
31
- Inputs require labels/help/format validation and preserve values across reactivity. Validate timing using dedicated validation patterns/packages or explicit server logic; never clear inputs because another reactive invalidates. Uploaded files need type/size/security feedback.
97
+ - Choose `bindCache(..., cache = "session")` for tenant- or user-private queries; reserve `cache = "app"` strictly for public/shared data.
98
+ - Encapsulate reusable panels with `NS(id)` + `moduleServer(id, ...)` to prevent input/output ID collisions.
99
+ - Never run heavy blocking R computations directly inside `renderPlot`/`observeEvent` on shared workers—offload them via `ExtendedTask` + `mirai`.
100
+ - Preserve form inputs across reactive updates (`shinyvalidate::InputValidator` for inline field validation) and validate uploaded files (`fileInput`) by size and MIME/extension before parsing.
32
101
 
33
102
  ## Do/don't pairs
34
103
 
35
104
  | Do | Don't |
36
105
  |---|---|
37
- | `bs_theme(primary = "#005f73", base_font = …)` | random CSS overriding autogenerated internals |
38
- | explicit `validate()` empty/error message | blank plot/table interpreted as zero data |
39
- | non-color plot encoding | color-only categorical meaning |
40
- | labeled upload/control input | relying on placeholder-like hints |
106
+ | `ExtendedTask` + `mirai` + `bind_task_button()` for slow R jobs | Blocking the single R process for every connected user |
107
+ | `bindCache(..., cache = "session")` for private user queries | Sharing user-specific rows in `cache = "app"` |
108
+ | `NS(id)` + `moduleServer()` for repeated panels | Copy-pasting global input IDs like `region1`, `region2` |
109
+ | `validate(need(nrow(df) > 0, "..."))` explicit empty/error copy | Bare `req()` silently leaving a blank card |
110
+ | `bs_theme(version = 5, ...)` + `thematic_shiny()` + `input_dark_mode()` | Hardcoded ggplot light theme clashing with dark mode |
41
111
 
42
112
  ## Known traps
43
113
 
44
- Reactive loops/invalidation storms, hidden cross-session leakage, long computation blocking worker process, plot/UI theme mismatch, unstable custom CSS, unstable deployment memory/timeouts, treating prototype security as production-ready.
114
+ Cross-session leakage from global variables or `cache = "app"`, blocking workers without `ExtendedTask`/`mirai`, reactive invalidation loops, un-namespaced IDs inside modules, forgetting `daemons(0)` cleanup on stop, and plot themes ignoring `input_dark_mode()`.
45
115
 
46
116
  ## Verification commands
47
117
 
48
118
  ```sh
49
119
  Rscript -e 'shiny::runApp()'
50
120
  Rscript -e 'testthat::test_dir("tests")'
51
- Rscript -e 'shinytest2::test_app()' 2>/dev/null || true
121
+ Rscript -e 'shinytest2::test_app()'
52
122
  ```
53
123
 
54
- Inspect real browser rendering, keyboard/focus, empty/error/large data, concurrent users, upload failure, timeout/memory behavior, responsive zoom/localization.
124
+ `testthat::test_dir("tests")` and `shiny::testServer()` verify reactive server logic (`static`/unit evidence); `shinytest2::test_app()` (requires `shinytest2` and Chromium) and interactive browser inspection across light/dark modes and narrow widths provide `rendered` evidence.
@@ -0,0 +1,186 @@
1
+ # Reactive Python data apps and notebooks (marimo, Solara, Mesop, Taipy)
2
+
3
+ When top-to-bottom script reruns or Jupyter's out-of-order hidden state cause bugs, choose a **reactive DAG, component-scoped, or scenario-driven Python framework**.
4
+
5
+ ## Framework decision matrix
6
+
7
+ | Framework | Execution model | Source format | Best fit | Primary trade-off |
8
+ |---|---|---|---|---|
9
+ | **marimo** | Reactive dependency DAG (cells re-run deterministically on input change) | Pure Git-friendly `.py` files (`@app.cell`) | Reproducible notebooks, DuckDB SQL exploration, zero-hidden-state web apps, WASM exports | Global variable names must be unique across cells; circular references are disallowed |
10
+ | **Solara** | React-like component tree (`@solara.component` + `solara.reactive`) over ipywidgets/Vuetify | Standard Python modules | Stateful multi-page data apps reusing Jupyter/AnyWidget/Altair/Plotly ecosystems | React hook rules (`use_state`, `use_effect`, `use_task`) differ from linear scripts |
11
+ | **Mesop** | Typed Python UI (`@me.stateclass` + `@me.page`) rendered with Angular Material components | Pure Python | Internal AI/ML eval tools and rapid Python-only web apps with zero JS build | Opinionated Material styling; custom JS requires web component wrappers |
12
+ | **Taipy** | Pipeline/scenario DAG (`taipy.Core`) + reactive GUI (`taipy.gui`) | Python + Builder (`tgb`) or Markdown | Enterprise operations, what-if scenario comparison, scheduled pipelines + dashboards | Heavier project architecture than lightweight single-file tools |
13
+
14
+ ## marimo idioms
15
+
16
+ - Bind widgets (`mo.ui.slider`, `mo.ui.table`, `mo.ui.dropdown`, `mo.ui.anywidget`) in one cell and read `.value` downstream. Set `debounce=True` on sliders driving SQL or ML queries.
17
+ - Query DataFrames and Parquet files directly with `mo.sql` (DuckDB engine), cache expensive steps with `@mo.cache` / `@mo.persistent_cache`, and reserve `mo.state` only for synced multi-control edits that a pure DAG cannot express.
18
+ - Configure notebook appearance via `marimo.App(width="medium", css_file="custom.css")` and serve end-user apps read-only with `marimo run app.py` or static Pyodide WASM via `marimo export html-wasm app.py -o dist --mode run`.
19
+
20
+ ```python
21
+ import marimo as mo
22
+ import altair as alt
23
+
24
+ threshold = mo.ui.slider(0.0, 1.0, step=0.05, value=0.5, debounce=True, label="Threshold")
25
+ filtered = mo.sql(f"SELECT region, score FROM scores_df WHERE score >= {threshold.value}")
26
+
27
+ @mo.cache
28
+ def expensive_summary(min_score: float):
29
+ return run_heavy_agg(min_score)
30
+
31
+ # Embed any AnyWidget bidirectionally inside the reactive DAG:
32
+ widget = mo.ui.anywidget(MyCustomAnyWidget(threshold=threshold.value))
33
+ ```
34
+
35
+ ## Solara idioms
36
+
37
+ Scope per-user reactive state with `solara.reactive` (for app/session stores) or `solara.use_state` (component-local), offload slow queries with `solara.use_task`, and map palette tokens through `solara.lab.theme`:
38
+
39
+ ```python
40
+ import solara
41
+ import solara.lab
42
+
43
+ solara.lab.theme.themes.light.primary = "#0074ca"
44
+ solara.lab.theme.dark = False
45
+ selected_region = solara.reactive("EMEA")
46
+
47
+ @solara.component
48
+ def Page():
49
+ task = solara.use_task(lambda: fetch_region_df(selected_region.value), dependencies=[selected_region.value])
50
+ with solara.AppLayout(title="Operations"):
51
+ with solara.Sidebar():
52
+ solara.Select(label="Region", value=selected_region, values=["EMEA", "AMER", "APAC"])
53
+ solara.lab.ThemeToggle()
54
+ if task.pending:
55
+ solara.ProgressLinear(True)
56
+ elif task.error:
57
+ solara.Error(f"Query failed: {task.exception}")
58
+ elif task.value.empty:
59
+ solara.Info("No records match the active filter.")
60
+ else:
61
+ solara.DataFrame(task.value)
62
+ ```
63
+
64
+ ## Mesop idioms
65
+
66
+ Declare all serializable session state in a `@me.stateclass`, define pages with `@me.page`, read Material theme tokens via `me.theme_var(...)` + `me.set_theme_mode("system")`, and stream generator yields directly from event handlers:
67
+
68
+ ```python
69
+ import mesop as me
70
+
71
+ @me.stateclass
72
+ class State:
73
+ prompt: str = ""
74
+ response: str = ""
75
+ loading: bool = False
76
+
77
+ def on_run(e: me.ClickEvent):
78
+ state = me.state(State)
79
+ state.loading = True
80
+ state.response = ""
81
+ yield
82
+ for chunk in stream_eval(state.prompt):
83
+ state.response += chunk
84
+ yield
85
+ state.loading = False
86
+
87
+ @me.page(path="/", title="Eval Bench")
88
+ def page():
89
+ state = me.state(State)
90
+ with me.box(style=me.Style(padding=me.Padding.all(24), background=me.theme_var("surface"))):
91
+ me.input(label="Prompt", on_blur=lambda e: setattr(me.state(State), "prompt", e.value))
92
+ me.button("Run eval", type="flat", on_click=on_run, disabled=state.loading)
93
+ if state.loading:
94
+ me.progress_spinner()
95
+ me.markdown(state.response or "_Enter a prompt and run evaluation._")
96
+ ```
97
+
98
+ ## Taipy idioms
99
+
100
+ Separate **scenario/pipeline configuration** (`taipy.Config`) from **GUI state** (`taipy.gui.builder` `tgb`), and theme globally with `stylekit`:
101
+
102
+ ```python
103
+ import taipy.gui.builder as tgb
104
+ from taipy.gui import Gui
105
+
106
+ threshold = 0.5
107
+ chart_df = load_initial_df()
108
+
109
+ def on_threshold_change(state):
110
+ state.chart_df = filter_df(state.threshold)
111
+
112
+ with tgb.Page() as page:
113
+ tgb.text("# Demand Forecast", mode="md")
114
+ tgb.slider("{threshold}", min=0.0, max=1.0, step=0.05, on_change=on_threshold_change)
115
+ tgb.chart("{chart_df}", x="date", y="demand", type="bar")
116
+
117
+ Gui(page=page).run(
118
+ stylekit={"color_primary": "#0074ca", "color_background_light": "#faf8f1"}
119
+ )
120
+ ```
121
+
122
+ For multi-user scenario workflows (`tp.create_scenario`, `tp.submit`), attach `tgb.scenario_selector` / `tgb.scenario` / `tgb.job_selector` so job status and data node lineage stay inspectable.
123
+
124
+ ## Polars & Narwhals dataframe-agnostic integration
125
+
126
+ Never serialize multi-million-row eager DataFrames into browser JSON, WebSockets, or widget props just to render a 12-bar chart or paginated table:
127
+
128
+ - **Polars lazy & streaming queries**: read Parquet/CSV lazily with `pl.scan_parquet(...)` (or `.lazy()`), push filter predicates, column projections, and `group_by().agg(...)` reductions down into Polars, and call `.collect(engine="streaming")` only on the bounded UI result set (e.g., aggregated bins or top-N rows + total count).
129
+ - **Narwhals (`narwhals`)**: wrap shared chart/table preparation helpers with `@nw.narwhalify` (or `nw.from_native(df)`) so one component accepts **Polars, Pandas, PyArrow, DuckDB, or Modin** natively without calling `.to_pandas()` copies that spike server RAM.
130
+
131
+ ```python
132
+ import narwhals as nw
133
+ import polars as pl
134
+ from narwhals.typing import IntoFrameT
135
+
136
+ # Push heavy filtering/aggregation into Polars streaming engine before touching UI
137
+ def query_region_totals(path: str, min_score: float) -> pl.DataFrame:
138
+ return (
139
+ pl.scan_parquet(path)
140
+ .filter(pl.col("score") >= min_score)
141
+ .group_by("region")
142
+ .agg(pl.len().alias("rows"), pl.col("score").mean().alias("avg_score"))
143
+ .sort("avg_score", descending=True)
144
+ .collect(engine="streaming")
145
+ )
146
+
147
+ # Dataframe-agnostic UI prep helper (works identically on Polars, Pandas, PyArrow, DuckDB)
148
+ @nw.narwhalify
149
+ def top_regions(df: IntoFrameT, limit: int = 10) -> IntoFrameT:
150
+ return df.sort("avg_score", descending=True).head(limit)
151
+ ```
152
+
153
+ - **Perceptual time-series downsampling (`Min-Max` / `LTTB`)**: when plotting `10k–1M+` telemetry rows, bucket timestamps into `~1,000–2,000` pixel-aligned windows using **`Min-Max` envelopes** (`group_by_dynamic` emitting `[first, min, max, last]` per bucket) or **`LTTB`**—never use `df.gather_every(n)` (`every-Nth` slicing), which drops incident spikes!
154
+ - **Preserve `0` vs `null` and freshness metadata**: never call `.fill_null(0)` before charting or table display unless missingness literally equals zero in domain math; compute `max(event_ts)` alongside the query so the UI renders an explicit `UTC`/local timezone and **Data Freshness / SLA Staleness badge**.
155
+
156
+ ## Do/don't pairs
157
+
158
+ | Do | Don't |
159
+ |---|---|
160
+ | `debounce=True` on marimo sliders driving SQL or ML cells | Recompute heavy DAG branches on every pixel of a drag |
161
+ | Keep marimo notebooks in Git as `.py` and run `marimo check` | Rely on hidden out-of-order execution state |
162
+ | Push filters, `Min-Max`/`LTTB` downsampling, and aggregations into Polars LazyFrame/streaming or DuckDB | Use `df.gather_every(n)` (erasing spikes), call `.fill_null(0)` blindly, or serialize raw million-row DataFrames over WebSockets |
163
+ | Offload slow Solara work to `solara.use_task` with error/pending UI | Block the Solara render function with synchronous network calls |
164
+ | Keep Mesop session state serializable in `@me.stateclass` | Mutate module-level globals shared across concurrent Mesop users |
165
+ | Style Taipy via `stylekit` and explicit `state.*` updates | Mutate global DataFrames without notifying `state` |
166
+
167
+ ## Verification commands
168
+
169
+ ```sh
170
+ # marimo
171
+ marimo check app.py
172
+ marimo run app.py
173
+ marimo export html-wasm app.py -o dist --mode run
174
+
175
+ # Solara
176
+ solara run app.py
177
+ python -m pytest
178
+
179
+ # Mesop
180
+ mesop app.py
181
+
182
+ # Taipy
183
+ taipy run app.py
184
+ ```
185
+
186
+ `marimo check` and `pytest` unit tests provide `static`/logic evidence; inspecting live filter updates, pending/error states, theme contrast, and narrow viewports in a real browser provides `rendered` evidence.
@@ -1,62 +1,116 @@
1
1
  # Reflex
2
2
 
3
- Evidence: current docs confirm `rx.App(theme=rx.theme(appearance="light", has_background=True, radius="large", accent_color="teal"))` and Radix Themes-based props.
4
-
5
3
  ## Token mapping
6
4
 
7
- Use `rx.theme` for global appearance/accent/radius and semantic style props/classes for local composition:
5
+ Configure global appearance, accent, gray scale, and radius on `rx.App(theme=rx.theme(...))` (backed by Radix Themes), and centralize semantic style tokens in a Python constants module rather than scattering inline style dicts across components:
8
6
 
9
7
  ```python
10
- app = rx.App(theme=rx.theme(appearance="light", radius="medium", accent_color="blue"))
8
+ import reflex as rx
9
+
10
+ app = rx.App(
11
+ theme=rx.theme(
12
+ appearance="inherit", # respects system light/dark or rx.color_mode
13
+ has_background=True,
14
+ radius="medium",
15
+ accent_color="blue",
16
+ gray_color="slate",
17
+ )
18
+ )
11
19
  ```
12
20
 
13
- Map DTCG semantic decisions into theme props plus a constrained style constants module. Do not scatter raw style dictionaries through every component.
14
-
15
- ## Layout and responsive idioms
16
-
17
- Reflex compiles to web UI; use responsive layout components/props and CSS-like semantics rather than desktop-only fixed widths. State-driven conditional rendering should preserve layout stability. Treat backend event latency as part of interaction design.
18
-
19
- ## Typography/custom fonts
20
-
21
- Use theme/head asset configuration deliberately. Font loading is web behavior even though authoring is Python; fallbacks/subsets/script coverage still matter.
22
-
23
- ## Motion/reduced motion
21
+ ## Reactive state, `@rx.event`, background tasks, and control flow
24
22
 
25
- Use web-level motion sparingly and honor `prefers-reduced-motion` in CSS/custom components. Backend roundtrips are not animation; immediate client feedback may be needed for responsive interaction.
23
+ Reflex compiles Python UI definitions into a React/Vite frontend paired with a FastAPI/WebSocket state backend. Always use Reflex's reactive primitives (`@rx.event`, `@rx.var(cache=True)`, `rx.foreach`, `rx.cond`, `rx.match`, `rx.ComponentState`) instead of plain Python `if`/`for` on state vars:
26
24
 
27
- ## Accessibility specifics
25
+ ```python
26
+ import reflex as rx
27
+
28
+ class MetricsState(rx.State):
29
+ region: str = "EMEA"
30
+ rows: list[dict[str, str]] = []
31
+ status: str = "idle" # "idle" | "loading" | "error" | "ready"
32
+ error_message: str = ""
33
+
34
+ @rx.var(cache=True)
35
+ def row_count(self) -> int:
36
+ return len(self.rows)
37
+
38
+ @rx.event
39
+ def set_region(self, value: str):
40
+ self.region = value
41
+
42
+ @rx.event(background=True)
43
+ async def refresh_rows(self):
44
+ async with self:
45
+ self.status = "loading"
46
+ self.error_message = ""
47
+ try:
48
+ data = await fetch_region_rows_async(self.region)
49
+ async with self:
50
+ self.rows = data
51
+ self.status = "ready"
52
+ except Exception as exc:
53
+ async with self:
54
+ self.error_message = str(exc)
55
+ self.status = "error"
56
+
57
+ def metrics_view() -> rx.Component:
58
+ return rx.vstack(
59
+ rx.hstack(
60
+ rx.select(["EMEA", "AMER", "APAC"], value=MetricsState.region, on_change=MetricsState.set_region),
61
+ rx.button("Load", on_click=MetricsState.refresh_rows, loading=MetricsState.status == "loading"),
62
+ ),
63
+ rx.match(
64
+ MetricsState.status,
65
+ ("loading", rx.spinner(size="3")),
66
+ ("error", rx.callout(MetricsState.error_message, color_scheme="red")),
67
+ (
68
+ "ready",
69
+ rx.cond(
70
+ MetricsState.row_count > 0,
71
+ rx.foreach(MetricsState.rows, lambda r: rx.text(f"{r['id']}: {r['total']}")),
72
+ rx.text("No records match the selected region."),
73
+ ),
74
+ ),
75
+ rx.text("Select a region and load data."),
76
+ ),
77
+ )
78
+ ```
28
79
 
29
- Reflex/Radix components provide useful primitives but still require names/labels/focus behavior. Dynamic server-driven updates need loading/error/status semantics and keyboard verification. Do not hide state behind color-only conditional styles.
80
+ - **`@rx.event`**: Mark every UI-invocable state method explicitly with `@rx.event` so backend state boundaries stay auditable and safe.
81
+ - **`@rx.event(background=True)`**: Offload slow I/O, LLM streaming, or warehouse queries to background tasks; mutate `self.*` strictly inside `async with self:` blocks so the client can stay interactive while work runs.
82
+ - **`@rx.var(cache=True)`**: Cache derived computed vars so expensive filters or aggregations only recompute when their tracked dependencies change.
83
+ - **`rx.ComponentState`**: Use `class FilterCard(rx.ComponentState)` when rendering multiple independent instances of a stateful widget (editable cards, modals, inline drawers) so each instance gets isolated state automatically without manual dictionary keys.
30
84
 
31
- ## States idiom
85
+ ## Layout, typography, motion, and accessibility
32
86
 
33
- Reflex state classes/vars define interaction truth. Explicitly model loading/error/empty/permission/offline/optimistic states. Understand backend state scope per user/session; never leak mutable global state. Event handlers need validation, error return paths, and duplicate-submit protection.
87
+ Use responsive Radix layout props (`columns=rx.breakpoints(initial="1", md="2", lg="3")`) rather than fixed desktop widths. Load custom fonts via `stylesheets=[...]` on `rx.App(...)` and respect `prefers-reduced-motion` in custom CSS. Verify real DOM labels, keyboard focus order, disabled/loading states, and contrast on Radix/custom components rather than assuming Python wrappers guarantee accessibility.
34
88
 
35
89
  ## Forms idiom
36
90
 
37
- Use form controls with labels/name/value binding and validation timing appropriate to backend events. Preserve input in state after failed validation. Correct input types/autocomplete behavior ultimately depend on generated DOM—inspect it.
91
+ Prefer `rx.form(..., on_submit=State.handle_submit)` for multi-field mutations so form inputs do not incur websocket roundtrips on every keystroke. Preserve failed drafts in state and show validation copy adjacent to the offending field rather than toast-only alerts.
38
92
 
39
93
  ## Do/don't pairs
40
94
 
41
95
  | Do | Don't |
42
96
  |---|---|
43
- | central typed state vars for form draft | hidden mutable module-global data shared across users |
44
- | explicit pending bool during backend mutation | allowing repeated double-submit while waiting |
45
- | theme-level semantic appearance | arbitrary inline style dictionaries repeated everywhere |
46
- | validation error text adjacent to field | toast-only backend failure |
47
- | inspect generated DOM/a11y behavior | assuming Python component abstraction guarantees browser semantics |
97
+ | `@rx.event` on handlers and `@rx.event(background=True)` for slow I/O | Blocking the default state lock with long synchronous queries |
98
+ | `rx.cond`, `rx.match`, `rx.foreach` over reactive `Var`s | Python `if State.flag:` or `for item in State.rows:` inside render |
99
+ | `@rx.var(cache=True)` for expensive derived values | Recomputing heavy aggregations on every unrelated state tick |
100
+ | `rx.ComponentState` for repeatable stateful widgets | Sharing one global state singleton across multiple widget instances |
101
+ | `rx.form(on_submit=...)` to batch edits | Sending websocket `on_change` events per keystroke on large forms |
48
102
 
49
103
  ## Known traps
50
104
 
51
- Backend roundtrip latency, state serialization limits, accidental shared mutable state, websocket/offline behavior, compile/runtime version mismatch, style prop sprawl, browser-only assumptions hidden in Python, generated DOM differing from expectation.
105
+ Mutating `self` outside `async with self:` inside a background event, placing unserializable database connections on `rx.State` (keep them module/pool-level or underscore-prefixed private backend vars), websocket disconnects without visible state, oversized state payloads serialized on every delta, and forgetting `cache=True` on heavy computed vars.
52
106
 
53
107
  ## Verification commands
54
108
 
55
109
  ```sh
56
- reflex run
57
- reflex export 2>/dev/null || true
58
- python -m pytest
59
110
  python -m compileall .
111
+ python -m pytest
112
+ reflex run
113
+ reflex export --frontend-only
60
114
  ```
61
115
 
62
- Inspect actual browser rendering/network behavior for visual/interaction evidence; Python compile success proves almost nothing about UX.
116
+ `reflex export` validates frontend compilation (`static`), and `pytest` checks state logic (`static`); inspect rendered browser views, responsive breakpoints, dark mode, and websocket state transitions for `rendered` evidence.