@thanhnguyxn/pixelcraft 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (455) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.antigravity-plugin/plugin.json +32 -0
  3. package/.claude-plugin/marketplace.json +20 -0
  4. package/.claude-plugin/plugin.json +22 -0
  5. package/.codex-plugin/plugin.json +45 -0
  6. package/.cursor-plugin/marketplace.json +17 -0
  7. package/.cursor-plugin/plugin.json +27 -0
  8. package/.devin-plugin/plugin.json +21 -0
  9. package/.github/plugin/marketplace.json +34 -0
  10. package/CHANGELOG.md +159 -0
  11. package/GEMINI.md +1 -0
  12. package/LICENSE +21 -0
  13. package/README.md +264 -2
  14. package/SECURITY.md +28 -0
  15. package/assets/README.md +28 -0
  16. package/assets/pixelcraft-logo-128.png +0 -0
  17. package/assets/pixelcraft-logo-256.png +0 -0
  18. package/assets/pixelcraft-logo-512.png +0 -0
  19. package/bin/pixelcraft.mjs +852 -0
  20. package/docs/ARCHITECTURE.md +105 -0
  21. package/docs/DESIGN-RATIONALE.md +191 -0
  22. package/docs/INSTALL.md +221 -0
  23. package/evals/README.md +37 -0
  24. package/evals/fixtures/3d-web-engineering.json +69 -0
  25. package/evals/fixtures/README.md +36 -0
  26. package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
  27. package/evals/fixtures/ai-ui-libraries.json +53 -0
  28. package/evals/fixtures/audio-visual-accessibility.json +69 -0
  29. package/evals/fixtures/auth-and-checkout-ui.json +53 -0
  30. package/evals/fixtures/brandkit-identity-governance.json +48 -0
  31. package/evals/fixtures/build-and-architecture.json +53 -0
  32. package/evals/fixtures/canvas-and-node-editors.json +53 -0
  33. package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
  34. package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
  35. package/evals/fixtures/component-systems.json +53 -0
  36. package/evals/fixtures/component-testing.json +53 -0
  37. package/evals/fixtures/constrained-voice-and-tv.json +43 -0
  38. package/evals/fixtures/creative-code-rendering.json +69 -0
  39. package/evals/fixtures/creative-reference-evidence.json +67 -0
  40. package/evals/fixtures/data-app-python-marimo.json +49 -0
  41. package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
  42. package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
  43. package/evals/fixtures/desktop-native-workspace.json +48 -0
  44. package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
  45. package/evals/fixtures/direction-prototype-complexity.json +29 -0
  46. package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
  47. package/evals/fixtures/document-rust-typst-invoice.json +49 -0
  48. package/evals/fixtures/document-typst-and-print-css.json +43 -0
  49. package/evals/fixtures/email-mjml-dark-mode.json +49 -0
  50. package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
  51. package/evals/fixtures/enterprise-data-ui.json +53 -0
  52. package/evals/fixtures/extended-tui-toolkits.json +53 -0
  53. package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
  54. package/evals/fixtures/file-upload-media-ui.json +53 -0
  55. package/evals/fixtures/finish-gate-anti-slop.json +30 -0
  56. package/evals/fixtures/forms-accessibility-negative.json +29 -0
  57. package/evals/fixtures/forms-validation.json +53 -0
  58. package/evals/fixtures/game-go-ebitengine.json +49 -0
  59. package/evals/fixtures/game-godot-gdscript.json +49 -0
  60. package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
  61. package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
  62. package/evals/fixtures/i18n-engineering.json +53 -0
  63. package/evals/fixtures/local-first-sync.json +53 -0
  64. package/evals/fixtures/lynxjs.json +53 -0
  65. package/evals/fixtures/maizzle-email.json +53 -0
  66. package/evals/fixtures/maps-geospatial.json +53 -0
  67. package/evals/fixtures/media-og-and-video-export.json +43 -0
  68. package/evals/fixtures/media-players.json +53 -0
  69. package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
  70. package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
  71. package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
  72. package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
  73. package/evals/fixtures/mobile-jetpack-compose.json +49 -0
  74. package/evals/fixtures/mobile-swiftui-ios.json +49 -0
  75. package/evals/fixtures/motion-engineering.json +69 -0
  76. package/evals/fixtures/pdfjs-and-pptx.json +53 -0
  77. package/evals/fixtures/plan-brownfield-evidence.json +28 -0
  78. package/evals/fixtures/plan-discovery-interview.json +31 -0
  79. package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
  80. package/evals/fixtures/reactive-data-apps.json +53 -0
  81. package/evals/fixtures/review-evidence-audit.json +43 -0
  82. package/evals/fixtures/rich-text-and-code-editors.json +53 -0
  83. package/evals/fixtures/scrollytelling-resilience.json +70 -0
  84. package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
  85. package/evals/fixtures/state-architecture.json +53 -0
  86. package/evals/fixtures/styling-ecosystem.json +53 -0
  87. package/evals/fixtures/token-tooling.json +53 -0
  88. package/evals/fixtures/tui-go-bubbletea.json +49 -0
  89. package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
  90. package/evals/fixtures/tui-rust-ratatui.json +49 -0
  91. package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
  92. package/evals/fixtures/visual-qa-task-evidence.json +29 -0
  93. package/evals/fixtures/web-3d-engines.json +53 -0
  94. package/evals/fixtures/web-php-laravel-filament.json +49 -0
  95. package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
  96. package/evals/fixtures/workflow-checkpoints.json +30 -0
  97. package/evals/pixelcraft-accessibility.md +74 -0
  98. package/evals/pixelcraft-brandkit.md +58 -0
  99. package/evals/pixelcraft-chat-ui.md +55 -0
  100. package/evals/pixelcraft-constrained.md +55 -0
  101. package/evals/pixelcraft-craft.md +76 -0
  102. package/evals/pixelcraft-data-apps.md +55 -0
  103. package/evals/pixelcraft-dataviz.md +59 -0
  104. package/evals/pixelcraft-desktop.md +55 -0
  105. package/evals/pixelcraft-direction.md +77 -0
  106. package/evals/pixelcraft-document.md +55 -0
  107. package/evals/pixelcraft-email.md +55 -0
  108. package/evals/pixelcraft-extensions.md +55 -0
  109. package/evals/pixelcraft-game-ui.md +59 -0
  110. package/evals/pixelcraft-handoff.md +57 -0
  111. package/evals/pixelcraft-media.md +55 -0
  112. package/evals/pixelcraft-mobile.md +59 -0
  113. package/evals/pixelcraft-patterns.md +73 -0
  114. package/evals/pixelcraft-plan.md +127 -0
  115. package/evals/pixelcraft-review.md +63 -0
  116. package/evals/pixelcraft-spatial.md +55 -0
  117. package/evals/pixelcraft-tokens.md +57 -0
  118. package/evals/pixelcraft-tui.md +55 -0
  119. package/evals/pixelcraft-ux.md +59 -0
  120. package/evals/pixelcraft-visual-qa.md +86 -0
  121. package/evals/pixelcraft-web.md +89 -0
  122. package/evals/pixelcraft.md +70 -0
  123. package/gemini-extension.json +6 -0
  124. package/install.ps1 +341 -0
  125. package/install.sh +512 -0
  126. package/package.json +91 -4
  127. package/plugin.json +29 -0
  128. package/scripts/build-adapters.mjs +288 -0
  129. package/scripts/build-release-archives.mjs +61 -0
  130. package/scripts/build-skill-zips.mjs +94 -0
  131. package/scripts/run-evals.mjs +397 -0
  132. package/scripts/sync-docs.mjs +381 -0
  133. package/scripts/test-build-adapters.mjs +61 -0
  134. package/scripts/test-cross-platform-qa.mjs +359 -0
  135. package/scripts/test-distribution.mjs +203 -0
  136. package/scripts/test-export-tokens.mjs +361 -0
  137. package/scripts/test-finish-gate.mjs +271 -0
  138. package/scripts/test-installers.mjs +216 -0
  139. package/scripts/test-release-archives.mjs +42 -0
  140. package/scripts/test-shoot.mjs +87 -0
  141. package/scripts/test-slop-scan.mjs +416 -0
  142. package/scripts/test-style-inventory.mjs +234 -0
  143. package/scripts/test-sync-docs.mjs +140 -0
  144. package/scripts/test-validate-skills.mjs +195 -0
  145. package/scripts/validate-skills.mjs +658 -0
  146. package/skills/pixelcraft/SKILL.md +155 -0
  147. package/skills/pixelcraft/references/design-brief.md +75 -0
  148. package/skills/pixelcraft/references/floor.md +90 -0
  149. package/skills/pixelcraft/references/report-template.md +49 -0
  150. package/skills/pixelcraft/references/stack-detection.md +226 -0
  151. package/skills/pixelcraft/references/surface-acceptance.md +52 -0
  152. package/skills/pixelcraft/references/workflow-checkpoints.md +71 -0
  153. package/skills/pixelcraft-accessibility/SKILL.md +54 -0
  154. package/skills/pixelcraft-accessibility/references/apg-patterns.md +64 -0
  155. package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
  156. package/skills/pixelcraft-accessibility/references/platforms.md +86 -0
  157. package/skills/pixelcraft-accessibility/references/verification.md +64 -0
  158. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +99 -0
  159. package/skills/pixelcraft-brandkit/SKILL.md +127 -0
  160. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +165 -0
  161. package/skills/pixelcraft-brandkit/references/brand-governance.md +82 -0
  162. package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
  163. package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
  164. package/skills/pixelcraft-brandkit/references/logo-methods.md +97 -0
  165. package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
  166. package/skills/pixelcraft-brandkit/references/prompt-template.md +87 -0
  167. package/skills/pixelcraft-brandkit/references/qa-checklist.md +93 -0
  168. package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
  169. package/skills/pixelcraft-chat-ui/SKILL.md +57 -0
  170. package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
  171. package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
  172. package/skills/pixelcraft-chat-ui/references/conversation-design.md +84 -0
  173. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +77 -0
  174. package/skills/pixelcraft-chat-ui/references/slack-discord.md +80 -0
  175. package/skills/pixelcraft-constrained/SKILL.md +52 -0
  176. package/skills/pixelcraft-constrained/references/specialized-hardware.md +90 -0
  177. package/skills/pixelcraft-constrained/references/tv-wearables.md +134 -0
  178. package/skills/pixelcraft-constrained/references/voice-ui.md +104 -0
  179. package/skills/pixelcraft-craft/SKILL.md +58 -0
  180. package/skills/pixelcraft-craft/references/color.md +125 -0
  181. package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
  182. package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
  183. package/skills/pixelcraft-craft/references/layout.md +73 -0
  184. package/skills/pixelcraft-craft/references/motion.md +163 -0
  185. package/skills/pixelcraft-craft/references/typography.md +110 -0
  186. package/skills/pixelcraft-data-apps/SKILL.md +86 -0
  187. package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
  188. package/skills/pixelcraft-data-apps/references/dash.md +109 -0
  189. package/skills/pixelcraft-data-apps/references/evidence.md +90 -0
  190. package/skills/pixelcraft-data-apps/references/gradio.md +103 -0
  191. package/skills/pixelcraft-data-apps/references/julia-genie.md +89 -0
  192. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +91 -0
  193. package/skills/pixelcraft-data-apps/references/nicegui.md +102 -0
  194. package/skills/pixelcraft-data-apps/references/observable-framework.md +105 -0
  195. package/skills/pixelcraft-data-apps/references/panel.md +99 -0
  196. package/skills/pixelcraft-data-apps/references/r-shiny.md +124 -0
  197. package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
  198. package/skills/pixelcraft-data-apps/references/reflex.md +116 -0
  199. package/skills/pixelcraft-data-apps/references/shiny.md +110 -0
  200. package/skills/pixelcraft-data-apps/references/streamlit.md +113 -0
  201. package/skills/pixelcraft-dataviz/SKILL.md +60 -0
  202. package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
  203. package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
  204. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +107 -0
  205. package/skills/pixelcraft-dataviz/references/libraries.md +176 -0
  206. package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
  207. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +92 -0
  208. package/skills/pixelcraft-desktop/SKILL.md +93 -0
  209. package/skills/pixelcraft-desktop/references/appkit.md +92 -0
  210. package/skills/pixelcraft-desktop/references/avalonia.md +95 -0
  211. package/skills/pixelcraft-desktop/references/cpp-gui.md +129 -0
  212. package/skills/pixelcraft-desktop/references/electron.md +96 -0
  213. package/skills/pixelcraft-desktop/references/go-gui.md +83 -0
  214. package/skills/pixelcraft-desktop/references/gtk.md +97 -0
  215. package/skills/pixelcraft-desktop/references/javafx-swing.md +81 -0
  216. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +88 -0
  217. package/skills/pixelcraft-desktop/references/rust-gui.md +83 -0
  218. package/skills/pixelcraft-desktop/references/tauri.md +110 -0
  219. package/skills/pixelcraft-desktop/references/uno-platform.md +71 -0
  220. package/skills/pixelcraft-desktop/references/winui-wpf.md +98 -0
  221. package/skills/pixelcraft-desktop/references/working-context.md +84 -0
  222. package/skills/pixelcraft-direction/SKILL.md +120 -0
  223. package/skills/pixelcraft-direction/references/composition-library.md +84 -0
  224. package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
  225. package/skills/pixelcraft-direction/references/direction-card.md +64 -0
  226. package/skills/pixelcraft-direction/references/direction-scoring.md +76 -0
  227. package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
  228. package/skills/pixelcraft-direction/references/movements.md +71 -0
  229. package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
  230. package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
  231. package/skills/pixelcraft-direction/references/slop-fingerprints.md +83 -0
  232. package/skills/pixelcraft-direction/references/wildcards.md +47 -0
  233. package/skills/pixelcraft-document/SKILL.md +58 -0
  234. package/skills/pixelcraft-document/references/archetypes.md +106 -0
  235. package/skills/pixelcraft-document/references/pdf-tools.md +314 -0
  236. package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
  237. package/skills/pixelcraft-document/references/print-css.md +187 -0
  238. package/skills/pixelcraft-document/references/slides.md +198 -0
  239. package/skills/pixelcraft-email/SKILL.md +80 -0
  240. package/skills/pixelcraft-email/references/client-quirks.md +113 -0
  241. package/skills/pixelcraft-email/references/html-tables.md +114 -0
  242. package/skills/pixelcraft-email/references/maizzle.md +54 -0
  243. package/skills/pixelcraft-email/references/mjml.md +54 -0
  244. package/skills/pixelcraft-email/references/react-email.md +95 -0
  245. package/skills/pixelcraft-extensions/SKILL.md +56 -0
  246. package/skills/pixelcraft-extensions/references/browser-extensions.md +105 -0
  247. package/skills/pixelcraft-extensions/references/figma-office.md +106 -0
  248. package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
  249. package/skills/pixelcraft-extensions/references/raycast.md +98 -0
  250. package/skills/pixelcraft-extensions/references/vscode-webviews.md +100 -0
  251. package/skills/pixelcraft-game-ui/SKILL.md +80 -0
  252. package/skills/pixelcraft-game-ui/references/bevy.md +90 -0
  253. package/skills/pixelcraft-game-ui/references/godot.md +130 -0
  254. package/skills/pixelcraft-game-ui/references/hud-principles.md +67 -0
  255. package/skills/pixelcraft-game-ui/references/love2d.md +77 -0
  256. package/skills/pixelcraft-game-ui/references/monogame.md +68 -0
  257. package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
  258. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +107 -0
  259. package/skills/pixelcraft-game-ui/references/unreal-umg.md +80 -0
  260. package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
  261. package/skills/pixelcraft-handoff/SKILL.md +50 -0
  262. package/skills/pixelcraft-handoff/references/design-translation.md +134 -0
  263. package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
  264. package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
  265. package/skills/pixelcraft-media/SKILL.md +49 -0
  266. package/skills/pixelcraft-media/references/banners-video.md +130 -0
  267. package/skills/pixelcraft-media/references/og-generation.md +154 -0
  268. package/skills/pixelcraft-media/references/social-cards.md +71 -0
  269. package/skills/pixelcraft-mobile/SKILL.md +86 -0
  270. package/skills/pixelcraft-mobile/references/dotnet-maui.md +91 -0
  271. package/skills/pixelcraft-mobile/references/flet.md +80 -0
  272. package/skills/pixelcraft-mobile/references/flutter.md +113 -0
  273. package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
  274. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +87 -0
  275. package/skills/pixelcraft-mobile/references/jetpack-compose.md +129 -0
  276. package/skills/pixelcraft-mobile/references/kivy.md +82 -0
  277. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +86 -0
  278. package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
  279. package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
  280. package/skills/pixelcraft-mobile/references/react-native-expo.md +106 -0
  281. package/skills/pixelcraft-mobile/references/swiftui.md +200 -0
  282. package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
  283. package/skills/pixelcraft-mobile/references/task-state-composition.md +85 -0
  284. package/skills/pixelcraft-mobile/references/uikit.md +92 -0
  285. package/skills/pixelcraft-patterns/SKILL.md +75 -0
  286. package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
  287. package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
  288. package/skills/pixelcraft-patterns/references/auth-onboarding.md +44 -0
  289. package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
  290. package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
  291. package/skills/pixelcraft-patterns/references/commerce.md +47 -0
  292. package/skills/pixelcraft-patterns/references/communication.md +45 -0
  293. package/skills/pixelcraft-patterns/references/creative-tools.md +42 -0
  294. package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
  295. package/skills/pixelcraft-patterns/references/dashboard-admin.md +35 -0
  296. package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
  297. package/skills/pixelcraft-patterns/references/marketing.md +44 -0
  298. package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
  299. package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
  300. package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
  301. package/skills/pixelcraft-patterns/references/pattern-selection.md +80 -0
  302. package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
  303. package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
  304. package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
  305. package/skills/pixelcraft-patterns/references/settings.md +51 -0
  306. package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
  307. package/skills/pixelcraft-plan/SKILL.md +103 -0
  308. package/skills/pixelcraft-plan/references/design-input.md +69 -0
  309. package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
  310. package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
  311. package/skills/pixelcraft-plan/references/plan-template.md +134 -0
  312. package/skills/pixelcraft-plan/references/repo-discovery.md +49 -0
  313. package/skills/pixelcraft-plan/references/stack-freshness.md +67 -0
  314. package/skills/pixelcraft-plan/references/stack-selection.md +98 -0
  315. package/skills/pixelcraft-review/SKILL.md +86 -0
  316. package/skills/pixelcraft-review/references/audit-report.md +69 -0
  317. package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
  318. package/skills/pixelcraft-review/references/heuristics.md +63 -0
  319. package/skills/pixelcraft-review/references/personas.md +53 -0
  320. package/skills/pixelcraft-review/references/polish.md +78 -0
  321. package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
  322. package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
  323. package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
  324. package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
  325. package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
  326. package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
  327. package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
  328. package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
  329. package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
  330. package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
  331. package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
  332. package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
  333. package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
  334. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
  335. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
  336. package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
  337. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
  338. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
  339. package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
  340. package/skills/pixelcraft-review/scripts/slop-scan.mjs +1233 -0
  341. package/skills/pixelcraft-spatial/SKILL.md +51 -0
  342. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +39 -0
  343. package/skills/pixelcraft-spatial/references/platforms.md +147 -0
  344. package/skills/pixelcraft-tokens/SKILL.md +60 -0
  345. package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
  346. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
  347. package/skills/pixelcraft-tokens/references/adoption.md +55 -0
  348. package/skills/pixelcraft-tokens/references/format.md +84 -0
  349. package/skills/pixelcraft-tokens/references/governance.md +80 -0
  350. package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
  351. package/skills/pixelcraft-tokens/references/theme-presets.md +122 -0
  352. package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
  353. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +847 -0
  354. package/skills/pixelcraft-tui/SKILL.md +76 -0
  355. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +79 -0
  356. package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
  357. package/skills/pixelcraft-tui/references/ink.md +109 -0
  358. package/skills/pixelcraft-tui/references/ratatui.md +102 -0
  359. package/skills/pixelcraft-tui/references/rich.md +82 -0
  360. package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
  361. package/skills/pixelcraft-tui/references/textual.md +108 -0
  362. package/skills/pixelcraft-ux/SKILL.md +56 -0
  363. package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
  364. package/skills/pixelcraft-ux/references/feedback-performance.md +50 -0
  365. package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
  366. package/skills/pixelcraft-ux/references/forms.md +151 -0
  367. package/skills/pixelcraft-ux/references/i18n.md +221 -0
  368. package/skills/pixelcraft-ux/references/laws.md +39 -0
  369. package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
  370. package/skills/pixelcraft-ux/references/state-matrix.md +53 -0
  371. package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
  372. package/skills/pixelcraft-ux/references/ux-writing.md +44 -0
  373. package/skills/pixelcraft-visual-qa/SKILL.md +96 -0
  374. package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
  375. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +59 -0
  376. package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
  377. package/skills/pixelcraft-visual-qa/references/capture-email.md +38 -0
  378. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +50 -0
  379. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +35 -0
  380. package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
  381. package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
  382. package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
  383. package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
  384. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +78 -0
  385. package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
  386. package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
  387. package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
  388. package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
  389. package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
  390. package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
  391. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +174 -0
  392. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
  393. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
  394. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
  395. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
  396. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
  397. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
  398. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
  399. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +668 -0
  400. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1226 -0
  401. package/skills/pixelcraft-web/SKILL.md +132 -0
  402. package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
  403. package/skills/pixelcraft-web/references/adaptive-layout.md +69 -0
  404. package/skills/pixelcraft-web/references/angular.md +108 -0
  405. package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
  406. package/skills/pixelcraft-web/references/astro.md +113 -0
  407. package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
  408. package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
  409. package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
  410. package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
  411. package/skills/pixelcraft-web/references/clojurescript.md +88 -0
  412. package/skills/pixelcraft-web/references/component-systems.md +102 -0
  413. package/skills/pixelcraft-web/references/component-testing.md +170 -0
  414. package/skills/pixelcraft-web/references/creative-effects.md +59 -0
  415. package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
  416. package/skills/pixelcraft-web/references/elm.md +53 -0
  417. package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
  418. package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
  419. package/skills/pixelcraft-web/references/forms-validation.md +123 -0
  420. package/skills/pixelcraft-web/references/fsharp-fable.md +54 -0
  421. package/skills/pixelcraft-web/references/gsap.md +102 -0
  422. package/skills/pixelcraft-web/references/html-css.md +220 -0
  423. package/skills/pixelcraft-web/references/htmx-alpine.md +103 -0
  424. package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
  425. package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
  426. package/skills/pixelcraft-web/references/java-web.md +61 -0
  427. package/skills/pixelcraft-web/references/kotlin-web.md +57 -0
  428. package/skills/pixelcraft-web/references/leptos-yew.md +97 -0
  429. package/skills/pixelcraft-web/references/lit-web-components.md +63 -0
  430. package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
  431. package/skills/pixelcraft-web/references/media-players.md +104 -0
  432. package/skills/pixelcraft-web/references/motion-react.md +96 -0
  433. package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
  434. package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
  435. package/skills/pixelcraft-web/references/pwa.md +230 -0
  436. package/skills/pixelcraft-web/references/qwik.md +94 -0
  437. package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
  438. package/skills/pixelcraft-web/references/react-next.md +168 -0
  439. package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
  440. package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
  441. package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
  442. package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
  443. package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
  444. package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
  445. package/skills/pixelcraft-web/references/server-rendered.md +114 -0
  446. package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
  447. package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
  448. package/skills/pixelcraft-web/references/solid.md +111 -0
  449. package/skills/pixelcraft-web/references/state-architecture.md +107 -0
  450. package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
  451. package/skills/pixelcraft-web/references/svelte.md +111 -0
  452. package/skills/pixelcraft-web/references/tailwind.md +99 -0
  453. package/skills/pixelcraft-web/references/video-media.md +69 -0
  454. package/skills/pixelcraft-web/references/vue-nuxt.md +86 -0
  455. package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
@@ -0,0 +1,110 @@
1
+ # Typography, pairing, and expressive type
2
+
3
+ Evidence base: typographic craft traditions, platform font behavior, pairing practice, readability constraints, and localization requirements.
4
+
5
+ ## Voice before font
6
+
7
+ Choose a typographic voice from the direction: editorial, instrumental, humanist, technical, archival, playful, ceremonial, native/platform. “Clean” is not a voice. Do not default to Inter/Geist-like neutrality unless density, platform fit, script coverage, or existing brand continuity justify it.
8
+
9
+ | Voice | Pairing behavior | Best fit |
10
+ |---|---|---|
11
+ | editorial | high-contrast or text serif display + quiet body face + small metadata sans | publishing, culture, luxury, analysis |
12
+ | instrumental | legible grotesque + tabular monospace/data numerals | operations, measurement, finance, monitoring |
13
+ | humanist | open-aperture sans/serif, moderate contrast | health, education, trust-heavy consumer |
14
+ | technical | engineered sans/mono, precise numerals, compact metadata | developer, scientific, industrial |
15
+ | archival | durable text serif + caption/indexing system | museums, documents, history |
16
+ | playful | expressive display constrained to headings + highly readable body | games, children, casual commerce |
17
+ | native | system typeface/scale | high-frequency platform-conforming apps |
18
+
19
+ ## Pairing method
20
+
21
+ 1. Choose the **anchor** first: usually the body/UI face because it carries most reading.
22
+ 2. Add contrast only where it has a job: display voice, data voice, metadata voice, or code/log voice.
23
+ 3. Balance contrast with compatibility: comparable x-height/proportions often sit together better; contrast should come from structure, not clashing details.
24
+ 4. Assign explicit roles before naming fonts: display/title/heading/body/body-small/caption/control/data/code.
25
+ 5. Prefer one family with optical sizes/width/weight axes when hierarchy is more important than personality; use superfamilies when serif/sans/mono coordination is built in.
26
+ 6. Consult real specimens to understand scale/spacing/context, then design your own system; do not copy a pairing because it is fashionable.
27
+ 7. Limit active families/weights for performance and coherence. Two well-deployed faces beat five shallow ones.
28
+
29
+ ## Expressive techniques
30
+
31
+ | Technique | Use when | Rules | Caveat/slop risk |
32
+ |---|---|---|---|
33
+ | oversized display | short decisive copy can structure the page | set line breaks manually/responsively; reserve space; keep controls visibly subordinate | giant cropped word as generic award-site costume |
34
+ | width/weight contrast | same family needs strong hierarchy without extra fonts | compare condensed black display to regular-width text; test rendering across platforms | variable-font axis animation becomes the point rather than the message |
35
+ | serif display + sans interface | editorial authority plus operational clarity | display carries voice; UI controls stay boring/readable | cream/serif/orange neo-slop when detached from subject |
36
+ | mono data voice | measurement, provenance, logs, indexing | use mono for aligned numeric/categorical evidence, not as decoration | fake terminal aesthetic with no data |
37
+ | small-caps/metadata system | archival/editorial structure | use true small caps or carefully styled uppercase; consistent metadata grammar | meaningless uppercase eyebrow labels |
38
+ | kinetic/revealed type | short campaign statements | line/phrase-level reveal, once, selectable text | letter-by-letter animation that harms localization and reading |
39
+ | vertical/rotated type | culturally meaningful vertical writing or navigational furniture | vertical CJK requires real line-breaking/font review; Latin rotation only for labels/metadata | rotated text that becomes unreadable chrome |
40
+ | expressive numerals | scoreboards, indexes, finance, measurement | choose lining/tabular behavior intentionally; align decimal/degree/unit | oversized numerals implying fake metrics |
41
+
42
+ ## Scale, measure, and macro discipline
43
+
44
+ - **Intentional type palette cap:** use **at most 2 font families + 1 monospace** (`display` + `body/UI` + optional `code/data` mono) unless the user's brief explicitly justifies additional voices. Delete loaded weights/styles that lack a distinct semantic role.
45
+ - **Comfortable reading measure (`45–75ch`):** constrain continuous Latin prose columns to **`45–75ch`** (`60–70ch` sweet spot); never let body paragraphs span full desktop viewport width. Calibrate equivalent character density for CJK (`~30–42` fullwidth glyphs/line) and RTL scripts.
46
+ - **Scale & line-height:** dense UI scale ratio roughly `1.125–1.2`; editorial/persuasion roughly `1.25–1.4` (avoid twelve indistinguishable steps). Latin body line-height roughly `1.45–1.65`; tighten display while protecting ascenders and stacked diacritics (`ệ, ử`).
47
+ - **Unified icon & glyph language:** match icon stroke weight, cap/join geometry, corner radius, and `1cap`/optical sizing to the active typeface—never mix rounded cartoon icons, sharp hairline technical glyphs, and solid fills across the same toolbar or navigation chrome.
48
+ - **Optical size & tracking:** use `opsz` when available; avoid tracked-out lowercase; restrict subtle negative tracking (`-0.02em` to `-0.04em`) to large Latin display headlines—never body copy or scripts with combining marks/shaping. Preserve hanging punctuation and orphan/widow control where supported.
49
+
50
+ ## B6 — Cross-platform tabular numerals (`tnum`) & true minus (`U+2212`)
51
+
52
+ Proportional digits (`1` narrower than `8`) make live counters, timers, prices, progress readouts, scrubbers, and table columns jitter horizontally on every tick or row scan, while ASCII hyphen-minus (`-`, `U+002D`) sits too low and narrow beside `+`:
53
+
54
+ 1. **Lock tabular figures (`tnum`)** on every live counter, timer/stopwatch, financial/price readout, KPI delta, data-table numeric column, badge count, and playback/progress percentage. Keep proportional figures (`pnum`) only inside flowing narrative prose where vertical column alignment is irrelevant.
55
+ 2. **Render true typographic minus `−` (`U+2212`)** for negative numbers, currency deltas (`−$42.00`, `−3.4%`), coordinates, and axis ticks so negative signs match the width and crossbar height of `+` (while keeping input parsers tolerant of typed ASCII `-`, `U+002D`).
56
+
57
+ | Platform | Idiomatic tabular-numeral & minus implementation |
58
+ |---|---|
59
+ | **Web CSS / HTML** | `font-variant-numeric: tabular-nums lining-nums;` (fallback `font-feature-settings: "tnum" 1;`); format negative display values via `Intl.NumberFormat` or `U+2212` `−` |
60
+ | **SwiftUI / UIKit / AppKit** | `.monospacedDigit()` on `Text` / `UIFontDescriptor` `kNumberSpacingType: kMonospacedNumbersSelector`; `NumberFormatter` / `.number.sign(strategy:)` |
61
+ | **Jetpack Compose / Android** | `TextStyle(fontFeatureSettings = "tnum")` on `Text` (`android:fontFeatureSettings="tnum"` in Views) |
62
+ | **Flutter** | `TextStyle(fontFeatures: const [FontFeature.tabularFigures()])` (`dart:ui`) |
63
+ | **Desktop / Game / TUI** | Qt `QFont::setTag("tnum")` (`QFont::Tag("tnum")`), WinUI/WPF `Typography.NumeralAlignment="Tabular"`, Slint/Godot/Unity SDF OpenType `tnum` or fixed-advance digit kerning; TUI cells are intrinsically monospace |
64
+
65
+ ### Modern web typographic controls
66
+
67
+ Apply modern CSS typographic primitives progressively without breaking non-Latin scripts or CLS budgets:
68
+
69
+ - **Line wrapping:** use `text-wrap: balance` on short headings/titles (≤ 4–6 lines) to eliminate awkward single-word last lines, and `text-wrap: pretty` on body prose paragraphs to reduce orphans.
70
+ - **Optical cap-height alignment:** use `text-box-trim: trim-both` with `text-box-edge: cap alphabetic` (progressively, checking browser support) on buttons, badges, and tight headings so icons and uppercase labels optically center without magic pixel padding offsets.
71
+ - **Dark-mode halation via variable `GRAD` axis:** when a variable typeface provides a `GRAD` (grade) axis, reduce grade slightly in dark mode (`font-variation-settings: "GRAD" -25`) to soften light-on-dark stroke bloom without changing glyph advance widths or causing layout shift.
72
+ - **Zero-CLS fallback metrics:** pair webfont `@font-face` declarations with metric-matched fallback faces using `size-adjust`, `ascent-override`, `descent-override`, and `line-gap-override` so font swap never shifts headings or paragraphs.
73
+ - **Typographic vertical rhythm units:** use `cap` (cap height) to align inline icons with capitals, and `lh` / `rlh` (line-height / root line-height) for paragraph margins, vertical gaps, and list indents that automatically scale with font size and leading.
74
+
75
+ ```css
76
+ @font-face {
77
+ font-family: "EditorialFallback";
78
+ src: local("Georgia");
79
+ size-adjust: 104%;
80
+ ascent-override: 92%;
81
+ descent-override: 24%;
82
+ }
83
+ h1, h2 { text-wrap: balance; text-box-trim: trim-both; text-box-edge: cap alphabetic; }
84
+ p { text-wrap: pretty; margin-block-end: 1rlh; }
85
+ .inline-icon { height: 1cap; width: auto; }
86
+ @media (prefers-color-scheme: dark) {
87
+ body { font-variation-settings: "GRAD" -25; }
88
+ }
89
+ ```
90
+
91
+ ## International script floor
92
+
93
+ Declare fallback behavior per script, not just `sans-serif`: Latin extended/combining marks, Cyrillic, Greek, Arabic, Hebrew, Indic shaping, Thai/Lao/Khmer line breaking, CJK/Hangul, emoji/ZWJ, and numeric systems required by the audience. Do not fake bold/italic, do not put translated copy in Latin-only display fonts that silently fall back, and do not let expressive crop/tracking/masking damage shaping.
94
+
95
+ ## Platform transfer
96
+
97
+ Web: preload only critical files, reserve metrics/space, use `font-display` intentionally. iOS/macOS: Dynamic Type-compatible scaling. Android: respect sp scaling/type roles. Flutter/RN/Compose/SwiftUI: map semantic roles once rather than copying CSS pixels. TUI: weight/color/underline/inverse only; no assumed ligatures. Email: robust fallback stacks; custom fonts cannot carry meaning. Game UI: validate SDF/bitmap atlases, memory, localization glyphs, and viewing distance.
98
+
99
+ ## Rendered typography inventory
100
+
101
+ Measure what the browser actually rendered rather than counting only the authored scale. Record active families, weight/style faces, distinct rendered sizes, dominant line-heights, display letter-spacing, and maximum-to-minimum rendered size ratio. An earlier gallery corpus had medians of **2 active families**, **4 rendered sizes**, and a **4.6×** ratio. A later first-viewport sample with many canvas and media scenes had medians of **1 family** and **2 sizes** in the detectable DOM. Keep these cohorts separate: a first-screen DOM sample cannot count type painted into a graphic, and neither corpus sets a quota.
102
+
103
+ Audit rules:
104
+
105
+ - inventory every loaded/rendered family-weight-style face and delete faces without a hierarchy role;
106
+ - separate modular-step ratio from the observed display/body extreme ratio;
107
+ - remeasure the display and body roles at narrow and short heights; reduce display size or recompose when it consumes the task or produces poor wrapping, rather than chasing a fixed compression percentage. Test long localized copy and text zoom;
108
+ - verify display letter-spacing only at rendered sizes where it occurs; subtle negative tracking (`-0.02em` to `-0.04em`) belongs on large Latin display headlines, never on body copy or scripts with combining diacritics/shaping;
109
+ - preload at most 1–2 truly critical font files, choose `font-display` deliberately, subset required scripts, and never preload every weight or starve LCP media;
110
+ - canvas-rendered display type still needs semantic text and a fallback type specification.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: pixelcraft-data-apps
3
+ description: Translates Pixelcraft direction, tokens, UX, and floor requirements into data applications, AI/ML demos, dashboards, notebooks, BI reports, and internal tools in any language. Use for Streamlit, Gradio, Reflex, NiceGUI, Dash, Panel, Shiny for Python or R, Julia Genie/Stipple, marimo, Solara, Mesop, Taipy, Chainlit, FastHTML, Preswald, Jupyter ipywidgets, AnyWidget, Voila, Observable Framework, Evidence, and low-code internal tools (Retool, Appsmith, ToolJet, Budibase) including state/rerun behavior, theming limits, SQL freshness, and honest verification.
4
+ license: MIT
5
+ metadata:
6
+ version: 0.1.0
7
+ ---
8
+
9
+ # Pixelcraft data apps
10
+
11
+ Use this skill when the workload is a data app, AI/ML demo, dashboard, notebook surface, BI/reporting product, or internal operational tool—regardless of implementation language. The scope is the workload, not Python. Flet and Kivy are cross-platform application frameworks and route through `pixelcraft-mobile`; Qt/PySide belongs to `pixelcraft-desktop`; Textual/Rich belongs to `pixelcraft-tui`; Django/Jinja belongs to `pixelcraft-web`.
12
+
13
+ ## Surface craft
14
+
15
+ Keep active filters, data freshness, and the selected result visibly linked. Put stable summaries near the controls that change them; defer heavier details without replacing the working context. Test a slow query, an empty result, a changed filter, and a stale result. Do not copy a dashboard layout without its data provenance or rerun behavior.
16
+
17
+ ## Detection signals
18
+
19
+ Python imports/entry points (`st.*`, `gr.*`, `rx.*`, NiceGUI `ui.*`, Dash callbacks, Panel/HoloViz objects, Shiny UI/server, `marimo` `@app.cell`, `solara`, `mesop`, `taipy`, `chainlit` `@cl.*`, `fasthtml`, `preswald`, `anywidget`/`ipywidgets`, `voila`), `.streamlit/config.toml`, `.chainlit/config.toml`, `preswald.toml`, notebooks, R `DESCRIPTION`/`app.R` with Shiny/`bslib`, Julia `Project.toml` with Genie/Stipple, Observable `observablehq.config.*`/data loaders, Evidence `evidence.config.yaml`/`theme.yaml`/`pages`/`sources`, low-code exports/configs (Retool, Appsmith, ToolJet, Budibase), SQL/warehouse configs, and cache/data-loader definitions.
20
+
21
+ ## Translate direction with honest constraints
22
+
23
+ 1. Preserve the direction concept even when exact visual control is limited: hierarchy, real content, color posture, composition, copy, states, and data design still apply.
24
+ 2. Map tokens through the framework's supported theme layer first; use custom CSS/components only as scoped escape hatches.
25
+ 3. Understand rerun/session/callback/build semantics before designing interaction. Do not lose form state because a widget key, query lifecycle, or callback owner was careless.
26
+ 4. Prioritize data legibility, task flow, feedback, empty/error states, reproducibility, and trust over cosmetic pixel matching.
27
+ 5. Escape hatch order: native theme/config -> semantic component props/layout containers -> documented custom CSS/classes -> custom component/extension. Avoid brittle selectors where internals change across releases.
28
+
29
+ ## Platform-wide rules
30
+
31
+ - **Chart shell & interaction latency budgets**: render the **primary chart/dashboard shell in `< 1–2 s`** and keep **filter, hover, cross-filter, and brush responses within `100–200 ms`**; verify **concurrent multi-user session load** and **explicit query timeout + cancellation recovery** so slow warehouse queries never hang worker pools.
32
+ - **Truthful freshness, source attribution & metric definitions**: every query/view exposes progress, **explicit display timezone (`UTC` vs local)**, a **Data Freshness / SLA Staleness badge** (`Updated 12s ago` -> warning when lagging SLA), **visible data source attribution**, and **inline/popover metric definitions** (formula, denominator, exclusions).
33
+ - **Honest numeric, time-series & accessible chart fallbacks**: enforce right-aligned `tabular-nums`, **True Minus `U+2212` (`−`)**, explicit unit headers (`$ USD`, `ms`, `%`), **strict visual separation between `0` (measured zero) and `null / — / N/A` (missing)**, **`LTTB` / `Min-Max` envelope downsampling** on `10k–1M+` time-series, and a **screen-reader accessible data-table / text summary fallback + keyboard data-point navigation** for every chart.
34
+ - **Enterprise grid & URL-serialized state**: drive large tables via **server-side indexed cursor/keyset pagination** (`WHERE (ts, id) < (:c_ts, :c_id)` rather than slow high-offset `OFFSET`) and serialize active filters, sorts, date windows, and views into **shareable URL query parameters**.
35
+ - **OWASP CSV/XLSX security & PII masking/redaction**: neutralize **CSV/XLSX Formula Injection** by escaping/prefixing string cells starting with `=`, `+`, `-`, `@`, `\t`, or `\r`, **mask/redact PII by role on UI views, QA screenshots, and CSV/XLSX exports**, and stream large exports asynchronously rather than blocking worker RAM.
36
+ - **Safe internal-tool mutations & session isolation**: enforce **RBAC + database Row-Level Security (RLS)**, require a **`Diff / Confirm` impact modal** (`Before -> After` field preview + affected row count) before bulk updates/deletes, append every write to an immutable **Audit Log** (`actor`, `timestamp_utc`, `target`, `before -> after`), and isolate session caches/uploads strictly across concurrent users.
37
+
38
+ ## Anti-lazy-default & anti-slop guard
39
+
40
+ - **Do not reflexively default every Python/data workload to Streamlit or Gradio**: Streamlit's top-to-bottom script rerun model and Gradio's single-model demo layout excel at quick prototypes and ML inference demos, but **escalate** when the workload outgrows them:
41
+ - **Reactive notebooks & zero-hidden-state DAGs / WASM**: choose **marimo** (`@app.cell`, DuckDB `mo.sql`).
42
+ - **Concurrent multi-user reactive apps & long-running tasks**: choose **Shiny** (`ExtendedTask`), **Panel** (HoloViz / Datashader million-point streaming), or **Dash** (enterprise AG Grid + clientside/background callbacks).
43
+ - **Custom stateful web UI / full layout & auth control in Python**: choose **Reflex** or **NiceGUI**.
44
+ - **Fast read-heavy BI reports & scheduled SQL publications**: choose **Observable Framework** or **Evidence** (static/pre-built SQL snapshots with instant loads).
45
+ - **Reject untouched template slop**: do not ship default sidebar-filter dumps, unattributed KPI numbers without units/source/metric definitions/SLA freshness badges, naive `every-Nth` chart slicing, unredacted PII exports, unescaped CSVs, or unguarded bulk-delete buttons.
46
+
47
+ ## Common data-app failures
48
+
49
+ - uncontrolled reruns wiping input, primary chart shell stalling `> 2 s`, or concurrent multi-user load / slow queries exhausting workers without query timeouts;
50
+ - hidden state keys or SQL parameters colliding across pages/users;
51
+ - KPIs/charts missing source attribution, metric definitions, timezone, or SLA freshness badge, or `null` coerced to `0`;
52
+ - canvas/SVG charts lacking screen-reader data-table/summary fallbacks or keyboard data-point traversal;
53
+ - naive `every-Nth` downsampling hiding incident spikes, or `OFFSET 100000` pagination timing out;
54
+ - CSV/XLSX exports leaking unmasked PII or vulnerable to `=CMD|...` formula injection;
55
+ - internal admin tools executing bulk SQL mutations without RBAC, `Diff / Confirm` preview, or Audit Log writes.
56
+
57
+ ## Verification options
58
+
59
+ Unit tests (`AppTest`, `nicegui.testing.User`, `testthat`, `pytest`) validate callbacks, SQL, CSV escaping, PII masking, or RBAC (`static`) without proving visual or latency budgets (**Rule #0.3**: launch the app in a browser/runtime to measure `< 1–2 s` shell load, `100–200 ms` filter/brush response, keyboard/screen-reader table fallback, and concurrent/timeout behavior as `rendered` evidence). Label unavailable warehouse/load environments `not-checked`.
60
+
61
+ ## Pre-submit checklist
62
+
63
+ - [ ] zero `TODO`s, placeholder stubs, fabricated KPIs, or dead widget callbacks;
64
+ - [ ] framework choice matches **concurrent multi-user load**, rerun/DAG, and publishing needs, with **`< 1–2 s` primary chart shell**, **`100–200 ms` filter/hover/brush response**, and **query timeout/cancel recovery** verified;
65
+ - [ ] loading, empty, error, explicit timezone (`UTC`/local), **Data Freshness / SLA Staleness badge**, **visible data source attribution**, and **metric definitions** wired;
66
+ - [ ] heavy filtering/downsampling runs lazily (`LTTB` / `Min-Max`) with **indexed keyset/cursor pagination**, **URL-serialized filters**, right-aligned `tabular-nums`, **True Minus `U+2212` (`−`)**, unit headers, and strict **`0` vs `null / — / N/A`** separation;
67
+ - [ ] every chart provides a **screen-reader accessible data-table / text summary fallback + keyboard data-point navigation**;
68
+ - [ ] **PII masking/redaction** verified on UI, QA screenshots, and exports; CSV/XLSX exports neutralize formula injection (`=`, `+`, `-`, `@`, `\t`, `\r`); internal writes enforce **RBAC/RLS**, **`Diff / Confirm` modal**, and immutable **Audit Log**;
69
+ - [ ] **Checklist-Until-Passing Stop-Gate (`<HARD-GATE>`):** walk every checklist item above + run `slop-scan.mjs --fail-on p2`, `check-contrast.mjs`, runtime/query tests, and `check-acceptance.mjs .pixelcraft/acceptance.json` (`pixelcraft-review`) in a `Fix → Re-verify` loop until passing (`0` `fail`/`pending` rows, `rendered` evidence on visual/perf/a11y per `Rule #0.3`).
70
+
71
+ ## Framework routing
72
+
73
+ - Read [references/streamlit.md](references/streamlit.md) when building or auditing Streamlit apps (`.streamlit/config.toml`, `@st.fragment`, `st.navigation`, `AppTest`).
74
+ - Read [references/gradio.md](references/gradio.md) when building or auditing Gradio 5/6 demos, chat UIs, `@gr.render`, or MCP-exposed ML interfaces.
75
+ - Read [references/reflex.md](references/reflex.md) when building or auditing Reflex apps (`@rx.event`, background tasks, `rx.ComponentState`).
76
+ - Read [references/nicegui.md](references/nicegui.md) when building or auditing NiceGUI apps (`@ui.page`, `app.storage.*`, `run.io_bound`, `nicegui.testing`).
77
+ - Read [references/dash.md](references/dash.md) when building or auditing Plotly Dash 3 apps (`Patch`, clientside/background callbacks, Dash Pages, Mantine/AG Grid).
78
+ - Read [references/panel.md](references/panel.md) when building or auditing Panel/HoloViz apps (`pn.rx`, `panel-material-ui`, `ChatInterface`, Pyodide export).
79
+ - Read [references/shiny.md](references/shiny.md) when building or auditing Shiny for Python apps (`ui.Theme`, Express vs Core, `ExtendedTask`, `ui.Chat`, Shinylive).
80
+ - Read [references/reactive-data-apps.md](references/reactive-data-apps.md) when building or auditing reactive Python data apps and notebooks (`marimo`, `Solara`, `Mesop`, `Taipy`) or lazy **Polars / Narwhals** dataframe pipelines.
81
+ - Read [references/jupyter-widgets.md](references/jupyter-widgets.md) when building or auditing `ipywidgets`, `AnyWidget` ESM widgets, or `Voilá` standalone dashboards.
82
+ - Read [references/r-shiny.md](references/r-shiny.md) when building or auditing R Shiny apps (`bslib`, `ExtendedTask`+`mirai`, `bindCache`, `shinychat`/`ellmer`, modules).
83
+ - Read [references/julia-genie.md](references/julia-genie.md) when building or auditing Julia Genie/Stipple reactive data apps (`@app`, `@in`/`@out`/`@onchange`).
84
+ - Read [references/observable-framework.md](references/observable-framework.md) when building or auditing Observable Framework data documents (polyglot loaders, DuckDB-Wasm, `resize()`).
85
+ - Read [references/evidence.md](references/evidence.md) when building or auditing Evidence SQL/Markdown BI reports (Universal SQL, Svelte components, `npm run sources`).
86
+ - Read [references/ai-and-internal-data-apps.md](references/ai-and-internal-data-apps.md) when building or auditing Chainlit, FastHTML, Preswald, or low-code internal tools (Retool, Appsmith, ToolJet, Budibase).
@@ -0,0 +1,147 @@
1
+ # AI data apps and internal operational tools (Chainlit, FastHTML, Preswald, Low-Code)
2
+
3
+ Use this reference when building conversational Python AI apps (**Chainlit**), hypermedia Python web/data apps (**FastHTML**), browser-local SQL/Python data apps (**Preswald**), or **low-code internal operational tools** (**Retool**, **Appsmith**, **ToolJet**, **Budibase**). For app-owned multi-agent UX patterns and streaming chat anatomy, pair with `pixelcraft-chat-ui`.
4
+
5
+ ## Surface decision matrix
6
+
7
+ | Tool | Execution model | Primary strength | Primary constraint |
8
+ |---|---|---|---|
9
+ | **Chainlit** | Python async websocket server + React chat UI | Rapid LLM/RAG/agent chat apps with step traces, file uploads, feedback buttons, auth | Opinionated chat-first shell; heavy custom layouts need React Elements or custom CSS |
10
+ | **FastHTML** | Python ASGI (`Starlette`) + FT components + HTMX | Fast server-rendered HTML/hypermedia internal apps and dashboards with zero JS build | Complex client-side visual editors still need small JS islands or Web Components |
11
+ | **Preswald** | Python + SQL + DuckDB-WASM reactive runtime | Lightweight SQL/Python data apps deployable locally or as static browser WASM | Younger ecosystem; keep external warehouse secrets out of static WASM exports |
12
+ | **Retool / Appsmith / ToolJet / Budibase** | Visual canvas + query/transformer DAG + RBAC | Fast internal CRUD, approvals, SQL/REST admin panels, built-in SSO/audit logs | Vendor lock-in, hidden DAG coupling, strict sandbox boundaries for custom widgets |
13
+
14
+ ## Chainlit idioms
15
+
16
+ Configure appearance, custom CSS, file upload limits, and features in `.chainlit/config.toml` (`[UI] name`, `custom_css`, `default_theme`). Use `@cl.on_chat_start`, `@cl.on_message`, `cl.Step` (for tool/retrieval traces), and `msg.stream_token(...)` for truthful streaming:
17
+
18
+ ```python
19
+ import chainlit as cl
20
+
21
+ @cl.on_chat_start
22
+ async def on_start():
23
+ cl.user_session.set("history", [])
24
+ await cl.Message(content="Ready. Ask a question about regional orders.").send()
25
+
26
+ @cl.on_message
27
+ async def on_message(message: cl.Message):
28
+ async with cl.Step(name="SQL Warehouse Lookup", type="tool") as step:
29
+ step.input = message.content
30
+ rows = await run_parameterized_query(message.content)
31
+ step.output = f"Fetched {len(rows)} rows"
32
+
33
+ reply = cl.Message(content="")
34
+ await reply.send()
35
+ async for token in stream_answer(message.content, rows):
36
+ await reply.stream_token(token)
37
+ await reply.update()
38
+ ```
39
+
40
+ Keep per-user state in `cl.user_session` (never module globals), enable human feedback/auth callbacks before production deployment, and distinguish retrieval errors from empty data inside `cl.Step` output.
41
+
42
+ ## FastHTML (`python-fasthtml`) idioms
43
+
44
+ FastHTML builds semantic HTML directly in Python via FT tags (`Div`, `Form`, `Table`, `Input`) and **HTMX** attributes (`hx_post`, `hx_target`, `hx_swap`). Override or disable default PicoCSS when bringing a custom token stylesheet:
45
+
46
+ ```python
47
+ from fasthtml.common import *
48
+
49
+ app, rt = fast_app(pico=False, hdrs=(Link(rel="stylesheet", href="/tokens.css"),))
50
+
51
+ @rt("/")
52
+ def index():
53
+ return Titled(
54
+ "Order Lookup",
55
+ Form(
56
+ Label("Region", Input(name="region", value="EMEA", required=True)),
57
+ Button("Filter", type="submit"),
58
+ hx_post="/orders",
59
+ hx_target="#orders-panel",
60
+ hx_swap="innerHTML",
61
+ ),
62
+ Div(id="orders-panel", aria_live="polite"),
63
+ )
64
+
65
+ @rt("/orders", methods=["POST"])
66
+ def orders(region: str):
67
+ rows = query_orders(region)
68
+ if not rows:
69
+ return P("No orders match that region.", cls="empty-state")
70
+ return Table(
71
+ Thead(Tr(Th("Order ID"), Th("Amount"))),
72
+ Tbody(*[Tr(Td(r["id"]), Td(f"${r['amount']:,.2f}")) for r in rows]),
73
+ )
74
+ ```
75
+
76
+ Use server-side validation, CSRF/session middleware for mutations, explicit `aria-live="polite"` on HTMX target regions, and `hx-indicator` for slow queries.
77
+
78
+ ## Preswald idioms
79
+
80
+ Preswald pairs `preswald.toml` configuration (data sources, branding title/logo/primary color) with declarative Python (`connect()`, `query()`, `slider()`, `table()`, `plotly()`) powered by DuckDB:
81
+
82
+ ```python
83
+ from preswald import connect, query, slider, table, text
84
+
85
+ connect()
86
+ threshold = slider("Minimum revenue (USD)", min_val=0, max_val=10000, default=500)
87
+ df = query(f"SELECT order_id, region, revenue FROM orders WHERE revenue >= {int(threshold)}", "orders_csv")
88
+
89
+ text("# Regional Orders")
90
+ if df.empty:
91
+ text("No orders exceed the selected revenue threshold.")
92
+ else:
93
+ table(df, title="Matching orders")
94
+ ```
95
+
96
+ Coerce numeric filter inputs strictly before SQL formatting, verify source freshness, and avoid exporting private data or credentials in browser-side WASM builds.
97
+
98
+ ## Enterprise grid, export security, and safe mutations (internal tools & admin apps)
99
+
100
+ Operational data apps and low-code panels (Retool, Appsmith, ToolJet, Budibase, FastHTML, Reflex, Dash) touch live production tables—enforce enterprise data-grid, export, and write safety by default:
101
+
102
+ - **Indexed cursor/keyset pagination + URL-serialized views**: replace `OFFSET 50000` (which scans and discards 50k rows per page) with indexed keyset pagination (`WHERE (created_at, id) < (:cursor_ts, :cursor_id) ORDER BY created_at DESC, id DESC LIMIT 50`), and mirror active filters, sort keys, timezone (`UTC` vs local), and saved view IDs in the URL query string so operators can bookmark and share exact incident views.
103
+ - **OWASP CSV/XLSX Formula Injection neutralization + streaming exports**: user-controlled strings starting with `=`, `+`, `-`, `@`, `\t`, or `\r` execute as live formulas or `DDE` payloads when opened in Excel, LibreOffice Calc, or Google Sheets! Neutralize every string cell before CSV/XLSX serialization (while keeping genuine `int`/`float` negatives typed as numbers in XLSX), and stream exports (`> 10k` rows) via chunked/background workers instead of buffering whole tables in web worker RAM:
104
+
105
+ ```python
106
+ FORMULA_TRIGGERS = ("=", "+", "-", "@", "\t", "\r")
107
+
108
+ def sanitize_spreadsheet_cell(val: object) -> object:
109
+ # Keep real numbers numeric; neutralize untrusted strings that Excel/Sheets parse as formulas
110
+ if isinstance(val, (int, float)) or val is None:
111
+ return val
112
+ text = str(val)
113
+ if text.startswith(FORMULA_TRIGGERS):
114
+ return f"'{text}"
115
+ return text
116
+ ```
117
+
118
+ - **RBAC, Row-Level Security (RLS), `Diff / Confirm` modals, and Audit Logs**:
119
+ - Separate `development` / `staging` / `production` credentials and enforce both UI role gates **and** backend/database **Row-Level Security (RLS)** (hiding a button in UI never secures the endpoint).
120
+ - Gate every bulk update, refund, status override, or delete behind a **`Diff / Confirm` impact modal** showing exact affected row count, target scope, and `Before -> After` field diffs (requiring a typed reason or confirmation token for high-blast-radius actions).
121
+ - Record every mutation in an append-only **Audit Log** (`actor_id`, `role`, `timestamp_utc`, `entity_id`, `before_json`, `after_json`, `reason`, `request_id`).
122
+
123
+ ## Do/don't pairs
124
+
125
+ | Do | Don't |
126
+ |---|---|
127
+ | `cl.Step` + `cl.user_session` in Chainlit | Module-global conversation lists shared across users |
128
+ | FastHTML semantic HTML + `hx_indicator` + `aria_live` | Dropping raw unescaped user HTML via `NotStr()` |
129
+ | Indexed keyset/cursor pagination + URL-serialized filter/timezone state | `OFFSET 100000` queries or ephemeral filters lost on browser refresh |
130
+ | Prefix string cells starting with `=`, `+`, `-`, `@`, `\t`, `\r` on CSV/XLSX export and stream large downloads | Export raw user strings into CSV/XLSX where `=HYPERLINK(...)` or `=CMD|...` executes on open |
131
+ | Enforce backend RBAC/RLS + `Diff / Confirm` impact modal + immutable `who/when/before->after` Audit Log | Execute direct production bulk `UPDATE`/`DELETE` on a single unlogged button click |
132
+
133
+ ## Verification commands
134
+
135
+ ```sh
136
+ # Chainlit
137
+ chainlit run app.py -w
138
+
139
+ # FastHTML
140
+ python -m pytest
141
+ uvicorn main:app --reload
142
+
143
+ # Preswald
144
+ preswald run
145
+ ```
146
+
147
+ Run staging tests across each RBAC role (`viewer` vs `operator` vs `admin`), test CSV/XLSX export payloads containing `=1+1` and `@SUM(...)` (`static`), verify keyset pagination, URL filter reload, SLA staleness badges, and `Diff / Confirm` modals in a real browser (`rendered`), and inspect Audit Log writes (`static`/`rendered`).
@@ -0,0 +1,109 @@
1
+ # Plotly Dash
2
+
3
+ ## Dash 3 runtime, theming, and component ecosystem
4
+
5
+ Dash 3 runs on **React 18**, replaces the removed `app.run_server()` with **`app.run()`**, and introduces **`dash.hooks`** for reusable plugin/layout/callback lifecycle extensions.
6
+
7
+ - **Token mapping**: Place semantic CSS variables in `assets/tokens.css` (auto-served by Dash) or configure **Dash Mantine Components (`dash_mantine_components` / `dmc.MantineProvider`)** with a typed theme object rather than duplicating inline `style={...}` dicts. Always synchronize Plotly figure templates (`layout.template`) with light/dark page tokens.
8
+ - **High-density tables**: Prefer **Dash AG Grid (`dash_ag_grid.AgGrid`)** over legacy `dash_table.DataTable` for virtualized sorting, filtering, pinned columns, accessible keyboard grid navigation, and numeric formatting.
9
+ - **Multipage apps**: Enable **Dash Pages** (`Dash(__name__, use_pages=True)`) with `dash.register_page(__name__, path="/cohorts", name="Cohorts")` and render `dash.page_container` inside one shared shell.
10
+
11
+ ## Callbacks: Patch, clientside, background, and duplicate outputs
12
+
13
+ ```python
14
+ import dash
15
+ from dash import Dash, DiskcacheManager, Input, Output, Patch, State, callback, clientside_callback, dcc, html
16
+ import dash_mantine_components as dmc
17
+ import dash_ag_grid as dag
18
+ import diskcache
19
+
20
+ cache = diskcache.Cache("./.dash-cache")
21
+ app = Dash(__name__, use_pages=True, background_callback_manager=DiskcacheManager(cache))
22
+
23
+ app.layout = dmc.MantineProvider(
24
+ dmc.AppShell(
25
+ [
26
+ dmc.AppShellHeader(dmc.Group([dmc.Title("Ops Monitor", order=3), dmc.Switch(id="dark-toggle", label="Dark")])),
27
+ dmc.AppShellMain([
28
+ dmc.Button("Run heavy backfill", id="run-btn"),
29
+ dmc.Button("Cancel", id="cancel-btn", variant="outline"),
30
+ dmc.Progress(id="job-progress", value=0),
31
+ dcc.Graph(id="live-chart"),
32
+ dag.AgGrid(id="orders-grid", columnDefs=[{"field": "order_id"}, {"field": "amount"}], rowData=[]),
33
+ dash.page_container,
34
+ ]),
35
+ ]
36
+ )
37
+ )
38
+
39
+ # Partial update with Patch(): append a point without re-serializing the whole figure
40
+ @callback(Output("live-chart", "figure", allow_duplicate=True), Input("tick", "n_intervals"), prevent_initial_call=True)
41
+ def append_point(_):
42
+ patched = Patch()
43
+ patched["data"][0]["x"].append(next_ts())
44
+ patched["data"][0]["y"].append(next_value())
45
+ return patched
46
+
47
+ # Zero-roundtrip JS callback for instant UI responsiveness (theme switch, drawer toggle)
48
+ clientside_callback(
49
+ "checked => checked ? 'dark' : 'light'",
50
+ Output("mantine-provider", "forceColorScheme"),
51
+ Input("dark-toggle", "checked"),
52
+ )
53
+
54
+ # Non-blocking background callback with cancellation and real progress
55
+ @callback(
56
+ Output("orders-grid", "rowData"),
57
+ Input("run-btn", "n_clicks"),
58
+ background=True,
59
+ running=[(Output("run-btn", "disabled"), True, False)],
60
+ cancel=[Input("cancel-btn", "n_clicks")],
61
+ progress=[Output("job-progress", "value")],
62
+ prevent_initial_call=True,
63
+ )
64
+ def run_backfill(set_progress, _n):
65
+ rows = []
66
+ for pct, batch in fetch_batches():
67
+ rows.extend(batch)
68
+ set_progress(pct)
69
+ return rows
70
+
71
+ if __name__ == "__main__":
72
+ app.run(debug=True)
73
+ ```
74
+
75
+ - Use `dash.hooks.layout(...)` / `dash.hooks.error(...)` to attach cross-cutting banners, telemetry, or global error handling cleanly across pages.
76
+ - Always pair `Output(..., allow_duplicate=True)` with `prevent_initial_call=True` (or `"initial_duplicate"`) and document which callbacks write to the same target.
77
+
78
+ ## Typography, motion, and accessibility
79
+
80
+ Load custom fonts via `assets/` or `external_stylesheets` and configure `figure.layout.font` explicitly because Plotly SVGs do not inherit every page font role. Honor `prefers-reduced-motion` in `assets/*.css`. Use semantic HTML (`html.Main`, `html.Nav`, `html.Label`) or accessible `dmc` primitives, verify keyboard reach in AG Grid and modals, and pair Plotly charts with text summaries or expandable tables.
81
+
82
+ ## States and forms idiom
83
+
84
+ Keep user/session state in `dcc.Store(storage_type="session" | "memory")` (never mutable module globals), bound payload size, and surface empty datasets, callback errors, and offline states visibly rather than leaving an infinite loading spinner. Use `State(...)` + an explicit Apply button for multi-filter expensive queries.
85
+
86
+ ## Do/don't pairs
87
+
88
+ | Do | Don't |
89
+ |---|---|
90
+ | `app.run(debug=True)` in Dash 3 | Removed `app.run_server(...)` |
91
+ | `Patch()` for incremental chart/grid mutations | Re-serializing megabyte figure dicts on every tick |
92
+ | `clientside_callback` for theme toggles and pure UI state | Round-tripping to Python just to open a modal or flip dark mode |
93
+ | `background=True` with `running=`, `cancel=`, `progress=` | Blocking Gunicorn workers on 30-second queries |
94
+ | `dash_ag_grid.AgGrid` + `dash_mantine_components` | Nested raw `html.Div`s with repeated inline `style={...}` |
95
+ | `dcc.Store` per-session state | Mutating global Python lists/DataFrames across concurrent users |
96
+
97
+ ## Known traps
98
+
99
+ Calling removed `app.run_server()`, circular callback graphs, giant JSON payloads in `dcc.Store`, forgetting `prevent_initial_call` with `allow_duplicate=True`, uncancelled long background jobs, Plotly default light template clashing with dark mode, and silent callback exceptions leaving spinners stuck.
100
+
101
+ ## Verification commands
102
+
103
+ ```sh
104
+ python -m compileall .
105
+ python -m pytest
106
+ python app.py
107
+ ```
108
+
109
+ Use `dash.testing` (`dash_duo` with headless Chromium) or Playwright to inspect rendered callbacks, network payloads, dark mode, and keyboard navigation (`rendered` evidence); direct Python callback unit tests prove logic only (`static`).
@@ -0,0 +1,90 @@
1
+ # Evidence
2
+
3
+ ## Token mapping
4
+
5
+ Keep project settings in `evidence.config.yaml` and theme configuration in `theme.yaml` at the project root. Define paired light/dark palettes and color scales in `theme.yaml` before overriding individual components:
6
+
7
+ ```yaml
8
+ theme:
9
+ colors:
10
+ primary:
11
+ light: "#2563eb"
12
+ dark: "#3b82f6"
13
+ colorPalettes:
14
+ default:
15
+ light: ["#2563eb", "#0d9488", "#d97706", "#7c3aed"]
16
+ dark: ["#60a5fa", "#2dd4bf", "#fbbf24", "#a78bfa"]
17
+ ```
18
+
19
+ Verify exact theme keys against the installed `@evidence-dev/evidence` version because palette/theme schemas evolve across releases.
20
+
21
+ ## Layout and responsive idioms
22
+
23
+ Pages are Markdown files under `pages/`. `evidence.config.yaml` sets defaults such as layout width, navigation, and appearance. Evidence compiles SQL extracts from `sources/` into local Parquet files queried in the browser via **Universal SQL (DuckDB-Wasm)**. Compose operational reports around reading order and decision density rather than equal-height KPI cards. Test narrow screens, print/export views, shared filter URLs, and long dimension names.
24
+
25
+ ## Typography and numeric precision
26
+
27
+ Configure font families in `theme.yaml` where supported. Keep numeric format strings explicit (`fmt=usd0`, `fmt=pct1`, tabular alignment) and label time grain and timezone in headings or notes. Markdown prose is part of the product: document metric definitions, freshness timestamps, and caveats right beside the visuals.
28
+
29
+ ## Motion and reduced motion
30
+
31
+ Evidence renders Svelte browser UI. Any custom transitions must respect `prefers-reduced-motion`, and never rely on chart animation as the sole signal that filters or data updated.
32
+
33
+ ## Accessibility specifics
34
+
35
+ Use semantic Markdown heading levels (`h1` -> `h2` -> `h3`) and plain-language summaries around charts and tables. Validate keyboard reach and visible focus on inputs (`Dropdown`, `DateRange`, `ButtonGroup`), contrast in both light and dark modes, non-color chart encodings, and table column labels in the rendered DOM rather than assuming BI components are accessible by default.
36
+
37
+ ## States and Universal SQL idiom
38
+
39
+ SQL fenced blocks define named client-side DuckDB-Wasm queries; Svelte components consume them through `{query_name}` props and reactive `${inputs.*}` bindings. Handle empty results, source-build failure, stale Parquet snapshots, and missing permissions explicitly:
40
+
41
+ ````markdown
42
+ ```sql daily_orders
43
+ select
44
+ order_date,
45
+ region,
46
+ revenue_usd
47
+ from warehouse.daily_orders
48
+ where region like '${inputs.region.value}'
49
+ order by order_date desc
50
+ ```
51
+
52
+ <Dropdown data={regions} name=region value=region title="Region">
53
+ <DropdownOption value="%" valueLabel="All regions" />
54
+ </Dropdown>
55
+
56
+ {#if daily_orders.length === 0}
57
+ No orders match the selected region. Widen the filter or check the latest source build.
58
+ {:else}
59
+ <BarChart data={daily_orders} x=order_date y=revenue_usd yFmt=usd0 title="Daily revenue" />
60
+ <DataTable data={daily_orders} search=true rows=15 />
61
+ {/if}
62
+ ````
63
+
64
+ ## Forms and filter idiom
65
+
66
+ Use labeled Evidence input components (`Dropdown`, `DateRange`, `TextInput`, `ButtonGroup`). Reflect active filters in prose or headings, validate date/numeric bounds, and avoid constructing unquoted raw SQL identifiers from user text even against local DuckDB-Wasm snapshots.
67
+
68
+ ## Do/don't pairs
69
+
70
+ | Do | Don't |
71
+ |---|---|
72
+ | Svelte component syntax (`<DataTable data={daily_orders} />`) | Liquid/Markdoc syntax (`{% table data="daily_orders" /%}`) that fails to compile |
73
+ | Run `npm run sources` to refresh Parquet extracts before `npm run build` | Deploy stale `static/data` snapshots without checking source freshness |
74
+ | Version-controlled `evidence.config.yaml` and `theme.yaml` | Undocumented local-only theme or connector settings |
75
+ | `{#if query.length === 0}` empty states beside affected charts | Blank chart regions with no explanation |
76
+ | Visible last-built timestamp and source caveats | Implying live warehouse queries when serving static Universal SQL extracts |
77
+
78
+ ## Known traps
79
+
80
+ Warehouse credentials committed to `sources/*/connection.yaml` (use env vars), unbounded source queries bloating browser Parquet downloads, implicit timezone/date-grain mismatches between warehouse SQL and DuckDB-Wasm, SQL dialect differences across connectors, stale static builds, filter state confusion on narrow viewports, and prose diverging from SQL logic.
81
+
82
+ ## Verification commands
83
+
84
+ ```sh
85
+ npm run sources
86
+ npm run build
87
+ npm run dev
88
+ ```
89
+
90
+ `npm run sources` verifies connector extraction into Universal SQL / DuckDB-Wasm Parquet files (`static`/`data` evidence); `npm run build` validates Svelte/Markdown compilation (`static`); browser inspection across light/dark modes and narrow viewports is required for `rendered` evidence.