@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,53 +1,91 @@
1
- # Jupyter widgets / ipywidgets
1
+ # Jupyter widgets, AnyWidget, and Voilá
2
2
 
3
3
  ## Token mapping
4
4
 
5
- ipywidgets exposes limited style/layout objects rather than a complete design-token system. Use semantic Python constants and apply them consistently to `Layout`/`style` objects; use notebook/custom CSS only when the environment is controlled. Do not expect broad theming across JupyterLab/classic/VS Code/nbconvert contexts.
6
-
7
- ## Layout and responsive idioms
8
-
9
- Compose boxes/grids intentionally but accept host frontend constraints. Notebook cells are document flow, not application windows. Width/height/responsive behavior differs across frontends. Keep controls close to the output they affect and preserve reading order in the notebook narrative.
10
-
11
- ## Typography/custom fonts
12
-
13
- Notebook/frontend typography is host-controlled. Do not fight it globally. Use heading hierarchy, concise labels, units, captions, and formatted output. Charts need their own legible typography/color decisions.
5
+ Classic `ipywidgets` exposes limited `Layout`/`style` objects rather than a full token system; define semantic Python constants once and reuse them instead of repeating raw hex colors. When building custom interactive surfaces, prefer **AnyWidget** so CSS custom properties can align with host themes (`--jp-layout-color0`, `--vscode-editor-background`) with clean fallbacks rather than hardcoding light-only colors.
6
+
7
+ ## AnyWidget (modern cross-frontend custom widget standard)
8
+
9
+ Use `anywidget` (`anywidget.AnyWidget` + `traitlets` + standard ES modules) instead of legacy `cookiecutter-ipywidgets` / Webpack extensions. A single AnyWidget works across **JupyterLab, Jupyter Notebook, VS Code, Google Colab, marimo (`mo.ui.anywidget`), Solara, Panel, and Shiny** with zero frontend bundler required for simple widgets and hot-module reload during development:
10
+
11
+ ```python
12
+ import anywidget
13
+ import traitlets
14
+
15
+ class RangeFilterWidget(anywidget.AnyWidget):
16
+ _esm = """
17
+ function render({ model, el }) {
18
+ const root = document.createElement("div");
19
+ root.className = "rf-wrap";
20
+ const input = document.createElement("input");
21
+ input.type = "range";
22
+ input.min = "0";
23
+ input.max = "100";
24
+ input.value = String(model.get("threshold"));
25
+ input.setAttribute("aria-label", "Score threshold");
26
+ const out = document.createElement("output");
27
+ const sync = () => {
28
+ input.value = String(model.get("threshold"));
29
+ out.textContent = `${model.get("threshold")}%`;
30
+ };
31
+ input.addEventListener("change", () => {
32
+ model.set("threshold", Number(input.value));
33
+ model.save_changes();
34
+ });
35
+ model.on("change:threshold", sync);
36
+ sync();
37
+ root.append(input, out);
38
+ el.append(root);
39
+ return () => root.remove();
40
+ }
41
+ export default { render };
42
+ """
43
+ _css = """
44
+ .rf-wrap { display: flex; gap: 0.75rem; align-items: center; }
45
+ .rf-wrap output { font-variant-numeric: tabular-nums; }
46
+ """
47
+ threshold = traitlets.Int(50).tag(sync=True)
48
+ ```
14
49
 
15
- ## Motion/reduced motion
50
+ For larger widgets, point `_esm = pathlib.Path(__file__).parent / "static" / "widget.js"` and `_css = ...` so AnyWidget hot-reloads edits without restarting the kernel. Always return a cleanup function from `render()` to detach listeners and prevent memory leaks on cell re-execution.
16
51
 
17
- Use progress/trait updates truthfully. Decorative motion is inappropriate in most notebook contexts and host support varies. Long computations need interrupt/cancel guidance because kernel interruption is user-visible behavior.
52
+ ## Voilá standalone serving
18
53
 
19
- ## Accessibility specifics
54
+ Turn a notebook of `ipywidgets` / `AnyWidget` outputs into a standalone web app with **Voilá** (`voila dashboard.ipynb`). Voilá executes cells in a dedicated per-user kernel, strips code cells by default, and blocks arbitrary code execution from the browser:
20
55
 
21
- Notebook frontend accessibility varies and is actively evolving. Use real labels/descriptions, logical output order, text alternatives/data tables for charts, keyboard verification, and no color-only meaning. Custom widgets must implement frontend semantics deliberately; do not assume Python trait names are exposed accessibly.
56
+ - Pass `--theme=dark` (or a custom template with `--template=...`), `--strip_sources=True`, and `--pool_size=2` (pre-warmed kernels for faster first load) in deployment commands.
57
+ - Explicitly design for cold-start progress, kernel disconnect/idle culling, and narrow viewport reflow—a notebook that fits a wide JupyterLab cell often overflows in Voilá's standalone template.
58
+ - Never embed warehouse secrets in notebook cell outputs or widget synced traits, because synced traits serialize directly to the browser.
22
59
 
23
- ## States idiom
60
+ ## Layout, motion, and accessibility
24
61
 
25
- Trait synchronization (`observe`, `link`, `unlink`) and kernel/frontend lifecycle are the state model. Handle kernel restart/disconnect, stale widget state, expensive computation interruption, missing data, empty results, validation errors, and duplicated output. Preserve user-entered state in traits deliberately.
62
+ Notebook cells live in document flow, not full-screen windows. Keep controls adjacent to the output they modify, use `HBox`/`VBox`/`GridBox` or AnyWidget flex/grid CSS that wraps cleanly, and avoid relying on fixed pixel widths. Keep progress indicators truthful and document kernel interrupt behavior for long jobs. Give every `ipywidgets` control a clear `description` and every AnyWidget DOM element explicit ARIA roles/labels, keyboard focus, and a text/table summary beneath custom canvas/SVG visuals.
26
63
 
27
- ## Forms idiom
64
+ ## States and forms idiom
28
65
 
29
- Use labeled controls, constrained numeric/date/text widgets, validation after meaningful interaction, explicit run/apply buttons for costly work, and input preservation. Do not couple expensive computation directly to every slider movement without throttling/apply semantics.
66
+ Trait synchronization (`observe`, `link`, `dlink`, `model.on("change:...")`) defines the state model. Handle kernel restart/disconnect, stale widget outputs after re-running cells out of order, empty results, and validation errors cleanly. Attach expensive computations to explicit Run/Apply buttons (`Button.on_click`) or `change` (release) events rather than firing on every `continuous_update=True` slider drag.
30
67
 
31
68
  ## Do/don't pairs
32
69
 
33
70
  | Do | Don't |
34
71
  |---|---|
35
- | semantic constants reused across layout/style | raw styling copied per widget |
36
- | explicit Apply/Run control for expensive analysis | retraining/requerying on every slider tick |
37
- | narrative headings/help adjacent to controls | disconnected control panel far from output |
38
- | text/table summary under chart | color-only chart as sole answer |
39
- | graceful kernel-restart/missing-state behavior | assuming widget state survives every frontend action |
72
+ | `AnyWidget` ESM + `traitlets` with `render()` cleanup | Legacy Webpack/npm JupyterLab extension boilerplate for simple widgets |
73
+ | `continuous_update=False` or explicit Apply button for heavy jobs | Re-running SQL/ML on every slider pixel tick |
74
+ | Return cleanup callbacks from AnyWidget `render()` | Leaking DOM listeners or intervals on every cell re-run |
75
+ | Serve end-user dashboards via Voilá with `--strip_sources=True` | Sharing raw editable notebooks with non-technical operators |
76
+ | Host-aware CSS vars with fallbacks in `_css` | Hardcoding light-only colors that clash in dark JupyterLab/VS Code |
40
77
 
41
78
  ## Known traps
42
79
 
43
- Frontend differences (JupyterLab/classic/VS Code/Colab/nbconvert), kernel disconnect/restart, widget state serialization, custom widget extension complexity, limited theming, accessibility variability, hidden mutable kernel state, accidental expensive recompute loops.
80
+ Frontend divergence across JupyterLab, VS Code, Colab, and Voilá; out-of-order cell execution leaving orphaned observers; memory leaks when `render()` omits cleanup; secrets serialized in `.tag(sync=True)` traits; and Voilá cold-start delays without kernel pooling.
44
81
 
45
82
  ## Verification commands
46
83
 
47
84
  ```sh
48
- python -m pytest
49
85
  python -m compileall .
50
- jupyter lab 2>/dev/null || jupyter notebook 2>/dev/null || true
86
+ python -m pytest
87
+ jupyter lab
88
+ voila dashboard.ipynb --no-browser --strip_sources=True
51
89
  ```
52
90
 
53
- Verify in every target frontend claimed. Static notebook export is evidence only of static rendering, not interactive widget behavior.
91
+ Verify widgets in every target frontend claimed (JupyterLab, VS Code, Voilá) for `rendered` evidence; `pytest` and static `nbconvert` HTML export provide `static` evidence only and do not verify live trait synchronization.
@@ -1,63 +1,102 @@
1
1
  # NiceGUI
2
2
 
3
- Evidence: current docs confirm `ui.colors(...)`, app-wide `app.colors(...)`, `ui.dark_mode()`, and `ui.add_head_html` for custom CSS/HTML.
4
-
5
3
  ## Token mapping
6
4
 
7
- Use app/page color configuration first:
5
+ Configure Quasar palette tokens globally with `app.colors(...)` or per page with `ui.colors(...)`, pair with `ui.dark_mode()` (`None` follows system preference), and add scoped semantic CSS variables via `ui.add_head_html` only when Quasar/Tailwind utility classes are insufficient:
8
6
 
9
7
  ```python
10
- app.colors(primary='#0074ca', brand='#0074ca')
11
- ui.colors(primary='#0074ca')
12
- dark = ui.dark_mode() # None means auto
13
- ```
14
-
15
- Use Quasar/Tailwind-style classes deliberately and inject scoped CSS with `ui.add_head_html` only when supported configuration is insufficient.
16
-
17
- ## Layout and responsive idioms
18
-
19
- NiceGUI is component/server driven. Use rows/columns/cards/expansion/tabs/pages by task flow, but verify actual responsive DOM. Shared/global page state and per-user state must be separated explicitly. Avoid fixed-width desktop dashboard assumptions.
20
-
21
- ## Typography/custom fonts
22
-
23
- Use CSS/font assets through documented HTML/head mechanisms. Because output is web DOM, fallback/loading/script coverage remain relevant. Do not hide typography inside ad hoc inline styles everywhere.
8
+ from nicegui import app, ui
24
9
 
25
- ## Motion/reduced motion
10
+ app.colors(primary="#0074ca", secondary="#0f766e", positive="#15803d", negative="#b91c1c")
11
+ ui.add_head_html("<style>.num { font-variant-numeric: tabular-nums; }</style>", shared=True)
12
+ ```
26
13
 
27
- Use CSS/Quasar motion sparingly and honor `prefers-reduced-motion`. Server push/update latency is interaction feedback; use immediate local pending state where possible.
14
+ ## Page isolation, storage scopes, refreshables, and async offloading
28
15
 
29
- ## Accessibility specifics
16
+ Always use `@ui.page(...)` for multi-user apps. Top-level auto-index scripts share one UI tree across every connected browser, leaking selections and form input between users.
30
17
 
31
- Quasar components provide baseline semantics, but labels/aria/focus/keyboard behavior still need inspection. Dynamic server-side updates need status/error visibility. `ui.add_head_html` can add meta/CSS but cannot repair missing semantic structure by itself.
18
+ | Storage scope | Persistence | Isolation | Requirement / use case |
19
+ |---|---|---|---|
20
+ | `app.storage.user` | Server JSON/Redis + signed cookie | Per user across tabs & reloads | Requires `storage_secret=...` in `ui.run()`; preferences, theme, auth user ID |
21
+ | `app.storage.tab` | Server memory (TTL) | Per browser tab across reloads | Active tab filters, draft wizard state |
22
+ | `app.storage.client` | Server memory | Single websocket connection | Ephemeral view objects cleared on refresh |
23
+ | `app.storage.general` | Server JSON/Redis | Shared across all users | Global feature flags, shared reference metadata only |
32
24
 
33
- ## States idiom
25
+ ```python
26
+ from nicegui import app, run, ui
27
+
28
+ @ui.page("/reports")
29
+ async def reports_page():
30
+ ui.dark_mode().bind_value(app.storage.user, "dark_mode")
31
+ region = app.storage.tab.setdefault("region", "EMEA")
32
+ state = {"rows": [], "loading": False, "error": None}
33
+
34
+ @ui.refreshable
35
+ def results_panel():
36
+ if state["loading"]:
37
+ ui.spinner(size="lg")
38
+ return
39
+ if state["error"]:
40
+ ui.label(f"Load failed: {state['error']}").classes("text-negative")
41
+ return
42
+ if not state["rows"]:
43
+ ui.label("No rows match the selected region.")
44
+ return
45
+ ui.aggrid({"columnDefs": [{"field": "order_id"}, {"field": "amount"}], "rowData": state["rows"]})
46
+
47
+ async def load_data():
48
+ state["loading"], state["error"] = True, None
49
+ results_panel.refresh()
50
+ try:
51
+ # Offload blocking DB I/O or heavy CPU work off the asyncio event loop
52
+ state["rows"] = await run.io_bound(query_warehouse, app.storage.tab["region"])
53
+ except Exception as exc:
54
+ state["error"] = str(exc)
55
+ finally:
56
+ state["loading"] = False
57
+ results_panel.refresh()
58
+
59
+ with ui.header().classes("items-center justify-between"):
60
+ ui.label("Operations Reports").classes("text-h6")
61
+ ui.switch("Dark").bind_value(app.storage.user, "dark_mode")
62
+
63
+ with ui.row().classes("w-full items-end gap-4"):
64
+ ui.select(["EMEA", "AMER", "APAC"], label="Region", value=region).bind_value(app.storage.tab, "region")
65
+ ui.button("Refresh", on_click=load_data)
66
+
67
+ results_panel()
68
+ await load_data()
69
+
70
+ ui.run(storage_secret="replace-with-env-secret")
71
+ ```
34
72
 
35
- Understand page lifecycle, shared objects, background tasks, timers, and websocket/client state. Explicitly model loading/error/empty/offline/disconnected states. Avoid mutating shared global UI objects across users. Background work needs cancellation/timeout/error propagation.
73
+ - Use `run.io_bound(fn, ...)` for blocking network/database calls and `run.cpu_bound(fn, ...)` for heavy NumPy/Pandas compute so websocket heartbeats never freeze and clients do not disconnect.
74
+ - Use `@ui.refreshable` (calling `.refresh()`) to update only the affected DOM subtree instead of clearing and rebuilding the entire page.
36
75
 
37
- ## Forms idiom
76
+ ## Layout, typography, motion, and accessibility
38
77
 
39
- Use labeled inputs, validation rules where supported, correct props/types, preservation across server events, and explicit submit behavior. Do not run expensive actions on every keystroke unless intentionally debounced/designed.
78
+ Compose responsive layouts with `ui.header`, `ui.left_drawer`, `ui.row().classes("flex-wrap")`, `ui.grid`, and `ui.card` rather than fixed pixel containers. Honor `prefers-reduced-motion` in custom CSS. Quasar provides baseline ARIA, but verify labels, focus order, dark-mode contrast, and websocket disconnect banners in the rendered DOM.
40
79
 
41
80
  ## Do/don't pairs
42
81
 
43
82
  | Do | Don't |
44
83
  |---|---|
45
- | `app.colors(primary=...)` or page-level `ui.colors` intentionally | injecting global CSS that fights Quasar unpredictably |
46
- | `ui.dark_mode()` auto/manual behavior explicit | assuming dark mode exists because browser prefers it |
47
- | stable classes plus scoped `ui.add_head_html` CSS | brittle generated-selector hacks |
48
- | per-user page/state ownership | shared mutable globals leaking across sessions |
49
- | visible reconnect/error state | silent websocket failure while UI appears live |
84
+ | `@ui.page(...)` with `app.storage.tab` / `app.storage.user` | Auto-index top-level UI leaking controls across every connected user |
85
+ | `await run.io_bound(...)` / `run.cpu_bound(...)` for slow work | Blocking the asyncio loop and causing websocket timeouts |
86
+ | `@ui.refreshable` for scoped dynamic regions | Calling `container.clear()` across unrelated input widgets |
87
+ | `ui.aggrid` / `ui.table` with empty and error branches | Rendering an empty grid silently when a query raises |
88
+ | Explicit `storage_secret` from env for `app.storage.user` | Hardcoding secrets or storing private user data in `app.storage.general` |
50
89
 
51
90
  ## Known traps
52
91
 
53
- Shared-state leakage, server-client synchronization gaps, dark-mode precedence confusion, custom CSS instability, background task lifecycle, browser disconnect/reconnect state, mobile layout assumptions, injected HTML/security risk.
92
+ Accidental shared auto-index pages, blocking the event loop on synchronous DB calls, forgetting `storage_secret`, storing unserializable objects in `app.storage.user`, websocket disconnect without user feedback, and unsafe raw HTML passed to `ui.html(..., sanitize=False)`.
54
93
 
55
94
  ## Verification commands
56
95
 
57
96
  ```sh
58
- python main.py
59
- python -m pytest
60
97
  python -m compileall .
98
+ python -m pytest
99
+ python main.py
61
100
  ```
62
101
 
63
- Rendered evidence requires actual browser inspection including resize, dark mode, keyboard, disconnect/reconnect, and multi-client behavior where relevant.
102
+ Use `nicegui.testing` pytest fixtures: the lightweight `user` fixture (`User`) validates simulated DOM interactions and event handlers quickly (`static`/simulated evidence), while the `screen` fixture (`Screen`, browser-backed) or Playwright verifies real rendering, dark mode, responsive wrap, and reconnect behavior (`rendered` evidence).
@@ -1,27 +1,72 @@
1
1
  # Observable Framework
2
2
 
3
- ## Token mapping
4
-
5
- Keep generated DTCG values in version-controlled static assets/modules and map them once into CSS custom properties, shared JavaScript style objects, and chart scales. `observablehq.config.js`/`.ts` can define project-level structure such as `title` and `pages`; inspect the installed version before depending on newer theme/config keys. Prefer a project stylesheet and semantic custom properties over repeating hex values in Markdown/JS blocks:
3
+ ## Token mapping and config theming
4
+
5
+ Configure built-in light/dark paired themes and custom stylesheets in `observablehq.config.js` (or `.ts`), then map semantic tokens once into CSS custom properties and shared JS chart scales:
6
+
7
+ ```js
8
+ // observablehq.config.js
9
+ export default {
10
+ title: "Operations Telemetry",
11
+ theme: ["air", "near-midnight"], // paired light/dark built-in themes
12
+ style: "custom-tokens.css",
13
+ pages: [
14
+ { name: "Overview", path: "/overview" },
15
+ { name: "Regional Breakdown", path: "/regions" },
16
+ ],
17
+ };
18
+ ```
6
19
 
7
20
  ```css
21
+ /* src/custom-tokens.css */
8
22
  :root {
9
23
  --pc-action: oklch(55% 0.15 250);
10
24
  --pc-surface-raised: oklch(98% 0.01 250);
11
25
  }
12
26
  ```
13
27
 
14
- ## Layout and responsive idioms
28
+ ## Polyglot data loaders, DuckDB-Wasm, `view(Inputs.*)`, and `resize()`
29
+
30
+ Observable Framework executes **polyglot data loaders** at build/dev time (`src/data/orders.parquet.py`, `src/data/metrics.json.sh`, `src/data/forecast.csv.R`) and streams their stdout to static files. Warehouse credentials stay server/CI-side, never in the browser bundle.
15
31
 
16
- Framework pages are Markdown/HTML documents with executable JavaScript blocks. Use normal document flow first, then CSS grid/flex containers for dense dashboards. Design cards/panels from the data-reading task rather than copying a generic SaaS grid. Test narrow embeds, wide monitors, print/export where relevant, and sidebar/table-of-contents behavior configured for the project.
32
+ In Markdown pages, pair **`FileAttachment(...)`** (always with a static string literal path) with **`DuckDBClient.of(...)`**, reactive **`view(Inputs.*)`**, and **`resize((width) => Plot.plot(...))`** so charts fit any container width without horizontal overflow:
33
+
34
+ ````markdown
35
+ ```js
36
+ const db = await DuckDBClient.of({
37
+ orders: FileAttachment("data/orders.parquet"),
38
+ });
39
+ const region = view(Inputs.select(["ALL", "EMEA", "AMER", "APAC"], { label: "Region" }));
40
+ ```
17
41
 
18
- ## Typography/custom fonts
42
+ ```js
43
+ const rows = await db.sql`
44
+ SELECT order_date, SUM(revenue) AS revenue
45
+ FROM orders
46
+ WHERE ${region === "ALL" ? sql`TRUE` : sql`region = ${region}`}
47
+ GROUP BY order_date
48
+ ORDER BY order_date
49
+ `;
50
+ ```
19
51
 
20
- Load fonts deliberately through static assets/stylesheet with fallback metrics and licensing checked. Data labels often need tabular numerals; long SQL/category labels need wrapping/truncation rules. Do not let chart type become the only readable text on the page.
52
+ ```js
53
+ display(
54
+ rows.length === 0
55
+ ? html`<p class="empty-state">No orders found for ${region}.</p>`
56
+ : resize((width) =>
57
+ Plot.plot({
58
+ width,
59
+ y: { grid: true, label: "Revenue (USD)" },
60
+ marks: [Plot.lineY(rows, { x: "order_date", y: "revenue", tip: true })],
61
+ })
62
+ )
63
+ );
64
+ ```
65
+ ````
21
66
 
22
- ## Motion/reduced motion
67
+ ## Layout, typography, motion, and accessibility
23
68
 
24
- Observable Framework output is browser UI, so CSS/JS motion must honor `prefers-reduced-motion`. Keep transitions purposeful and do not animate every chart update:
69
+ Use Framework's built-in `.grid` / `.grid-cols-2` / `.card` utilities or normal document flow with CSS Grid; design panels around the analytical reading path rather than uniform card mosaics. Set `font-variant-numeric: tabular-nums` on KPIs and tables. Honor `prefers-reduced-motion` for custom transitions:
25
70
 
26
71
  ```css
27
72
  @media (prefers-reduced-motion: reduce) {
@@ -29,39 +74,32 @@ Observable Framework output is browser UI, so CSS/JS motion must honor `prefers-
29
74
  }
30
75
  ```
31
76
 
32
- ## Accessibility specifics
33
-
34
- Use real headings, labels, buttons, links, tables, and form controls in Markdown/HTML. Treat canvas/SVG charts as inaccessible until given text summaries, table alternatives, keyboard/focus behavior where interactive, and non-color encoding. Verify Plot/custom SVG aria behavior rather than assuming it.
35
-
36
- ## States idiom
37
-
38
- Data loaders create static snapshots at build time; surface freshness, build failure, empty result sets, runtime fetch failure, permissions, and stale-cache state explicitly. `FileAttachment("name.json")` must use a static literal path and is only a handle until `.json()`, `.csv()`, or another contents method is invoked. Runtime `fetch`/WebSocket behavior needs loading/offline/error states separate from build-time loader behavior.
77
+ Use semantic Markdown headings and `Inputs.table` / prose summaries alongside every SVG/Canvas plot so keyboard and screen-reader users are not locked out of critical numbers.
39
78
 
40
- ## Forms idiom
79
+ ## States and forms idiom
41
80
 
42
- Use labeled native inputs/selects and preserve user selections across navigation where expected. Validate numeric/date/query parameters before use, show active filters in text, and never let malformed input become unsafe SQL or a misleading chart.
81
+ Surface build-time snapshot timestamps visibly (emit a `generated_at` field from the loader). Distinguish build-time loader errors, empty filtered query results, and runtime `fetch`/WebSocket failures cleanly. Validate any client-side SQL parameters via parameterized `db.sql` templates—never string-concatenate untrusted input into SQL.
43
82
 
44
83
  ## Do/don't pairs
45
84
 
46
85
  | Do | Don't |
47
86
  |---|---|
48
- | `FileAttachment("quakes.json").json()` | dynamically constructing a `FileAttachment` path that static analysis cannot resolve |
49
- | polyglot data loaders for reproducible snapshots | giving every browser direct warehouse credentials |
50
- | visible data timestamp/build provenance | silently stale dashboard numbers |
51
- | text summary plus accessible table | a color-only canvas chart as the sole evidence |
52
- | semantic CSS custom properties | hex literals scattered through Markdown JS blocks |
87
+ | `FileAttachment("data/orders.parquet")` static literal path | Dynamically built `FileAttachment(path)` strings that break static bundling |
88
+ | `resize((width) => Plot.plot({ width, ... }))` | Fixed `width: 960` charts overflowing narrow viewports |
89
+ | Polyglot loaders (`.parquet.py`, `.json.sh`) keeping secrets in CI | Shipping warehouse API keys into client-side `fetch()` calls |
90
+ | `DuckDBClient.of(...)` with Parquet extracts for multi-MB tables | Shipping giant uncompressed JSON blobs into the browser |
91
+ | Paired `theme: ["air", "near-midnight"]` + semantic CSS vars | Hardcoding hex values inside every Markdown JS block |
53
92
 
54
93
  ## Known traps
55
94
 
56
- Static snapshot freshness, accidentally exposing secrets to client code, unstable custom selectors, oversized serialized data, chart accessibility gaps, notebook-vs-app mental model confusion, runtime/build data divergence, Markdown pages that look correct while loader output is empty.
95
+ Dynamic `FileAttachment` paths failing build resolution, stale static snapshots without freshness timestamps, large CSV/JSON payloads instead of Parquet, secrets accidentally committed in client modules, fixed-width plots clipping on mobile, and missing empty-result checks.
57
96
 
58
97
  ## Verification commands
59
98
 
60
99
  ```sh
61
- cat observablehq.config.js 2>/dev/null || cat observablehq.config.ts
62
- cat package.json
100
+ ls observablehq.config.*
63
101
  npm run build
64
102
  npm run dev
65
103
  ```
66
104
 
67
- Exact scripts vary by template; inspect `package.json`. Browser inspection of the built/preview page is rendered evidence; a successful build is only static evidence.
105
+ `npm run build` executes data loaders and verifies static compilation (`static` evidence); inspect the served build across desktop/narrow widths, light/dark themes, and interactive `Inputs.*` filters in a real browser for `rendered` evidence.
@@ -1,53 +1,99 @@
1
1
  # Panel / HoloViz
2
2
 
3
- ## Token mapping
3
+ ## Token mapping and component layer
4
4
 
5
- Use Panel theme/config/template mechanisms before custom CSS. Depending project version, configure theme on template/extension and inject scoped stylesheets through documented extension/assets mechanisms. Keep Plotly/HoloViews/Bokeh figure themes synchronized with page semantic tokens; figure defaults are a common mismatch.
5
+ Use **Panel Material UI (`panel_material_ui` / `pmui`)** or Panel's native templates (`pn.template.FastListTemplate`, `MaterialTemplate`) with explicit light/dark palette configuration before writing custom CSS. Synchronize Bokeh/HoloViews/Plotly figure themes explicitly so dark surfaces never frame bright white default plots.
6
6
 
7
- ## Layout and responsive idioms
7
+ ```python
8
+ import panel as pn
9
+ import panel_material_ui as pmui
8
10
 
9
- Use `Row`, `Column`, `GridSpec`/template layouts and sizing modes intentionally (`stretch_width`, fixed, responsive). Panel dashboards often fail because resize behavior was never specified. Sidebar/main/template structure should reflect task hierarchy rather than exposing every control at once.
11
+ pn.extension("tabulator") # load only extensions actually used
12
+ ```
13
+
14
+ ## Reactive expressions (`pn.rx`), caching, chat, and Material UI idioms
15
+
16
+ Prefer **`pn.rx(...)`** reactive expressions over verbose `@pn.depends` boilerplate, scope caches with **`per_session=True`** whenever user permissions or private filters apply, and use **`pn.chat.ChatInterface`** for streaming AI/data assistants:
17
+
18
+ ```python
19
+ import panel as pn
20
+ import panel_material_ui as pmui
21
+ import pandas as pd
22
+
23
+ pn.extension("tabulator")
24
+
25
+ @pn.cache(per_session=True, ttl=300)
26
+ def load_orders(region: str) -> pd.DataFrame:
27
+ return query_region_orders(region)
28
+
29
+ region = pmui.Select(label="Region", options=["EMEA", "AMER", "APAC"], value="EMEA")
30
+ orders_rx = pn.rx(load_orders)(region)
10
31
 
11
- ## Typography/custom fonts
32
+ def render_table(df: pd.DataFrame):
33
+ if df.empty:
34
+ return pn.pane.Alert("No orders match the active filter.", alert_type="info")
35
+ return pn.widgets.Tabulator(df, pagination="remote", page_size=25, sizing_mode="stretch_width")
12
36
 
13
- Use template/global CSS/font configuration deliberately. Visualization libraries may require separate font settings; test rendering/export contexts. Keep dense scientific labels legible and localized units/formats explicit.
37
+ async def respond(contents: str, user: str, instance: pn.chat.ChatInterface):
38
+ partial = ""
39
+ async for chunk in stream_analyst_reply(contents, region.value):
40
+ partial += chunk
41
+ yield partial
14
42
 
15
- ## Motion/reduced motion
43
+ chat = pn.chat.ChatInterface(callback=respond, sizing_mode="stretch_both")
16
44
 
17
- Panel interaction is callback/server driven. Use loading spinners/indicators and busy state truthfully; decorative motion is secondary. Any custom CSS/JS animation must honor reduced motion.
45
+ page = pmui.Page(
46
+ title="Operations Console",
47
+ sidebar=[region],
48
+ main=[
49
+ pn.bind(render_table, orders_rx),
50
+ chat,
51
+ ],
52
+ )
53
+ page.servable()
54
+ ```
55
+
56
+ ## Pyodide / WebAssembly static deployment
18
57
 
19
- ## Accessibility specifics
58
+ For serverless public demos or documentation embeds, compile Panel apps to client-side Pyodide with:
20
59
 
21
- Use labels/names/help text, keyboard-operable widgets, semantic ordering, chart alternatives/summaries, and visible focus. DOM output is web-backed but accessibility varies across widget/type; inspect actual output rather than assuming Bokeh/Panel abstractions guarantee semantics.
60
+ ```sh
61
+ panel convert app.py --to pyodide-worker --out dist
62
+ ```
22
63
 
23
- ## States idiom
64
+ - Verify every dependency ships a pure-Python or Pyodide wheel.
65
+ - Strip all server secrets and warehouse credentials—code and bundled data ship directly to the browser.
66
+ - Provide explicit initial loading copy while Pyodide boots and downloads packages.
24
67
 
25
- Understand parameter/`param` dependencies, reactive functions, session state, caching, and async tasks. Render empty data, missing file/model, backend exception, stale cache, busy state, offline/disconnect state, and permission failure explicitly. Avoid hidden global mutable state across sessions.
68
+ ## Layout, motion, and accessibility
26
69
 
27
- ## Forms idiom
70
+ Set explicit `sizing_mode` (`"stretch_width"`, `"stretch_both"`, or fixed width where tabular alignment demands it) on every pane and widget—unspecified sizing modes are the top cause of clipped Panel dashboards. Use `pn.param.loading_indicator` / `loading=True` truthfully during callbacks, honor `prefers-reduced-motion` in custom CSS, and pair HoloViews/Bokeh canvases with text summaries or Tabulator data views for keyboard and screen-reader users.
28
71
 
29
- Use widgets with names/labels/help, validation bounds/types, explicit apply/submit controls for expensive computation, and input preservation. Parameterized forms should not recompute expensively on every tiny adjustment unless designed.
72
+ ## States and forms idiom
73
+
74
+ Keep per-user mutable state inside session callbacks or `pn.state.cache` keyed by session, never global mutable lists. For expensive parameter sweeps, bind a `pmui.Button` (or `pn.bind(..., watch=...)` with explicit trigger) instead of recomputing on every slider drag. Surface empty results, backend exceptions, and websocket disconnect states visibly.
30
75
 
31
76
  ## Do/don't pairs
32
77
 
33
78
  | Do | Don't |
34
79
  |---|---|
35
- | deliberate sizing mode per pane | fixed notebook-sized layout pasted into production dashboard |
36
- | explicit busy/error state around expensive callbacks | silent spinner or stale plot after backend failure |
37
- | semantic page CSS plus synchronized figure theme | default white plot floating inside custom dark UI |
38
- | apply button for costly parameter sweeps | recompute on every slider tick unintentionally |
39
- | per-session state ownership | global mutable cache leaking user-specific data |
80
+ | `pn.rx(...)` reactive expressions with clear data flow | Deeply tangled `@pn.depends` side-effect chains |
81
+ | `@pn.cache(per_session=True, ttl=...)` for user-scoped queries | Global `@pn.cache` leaking one tenant's DataFrame to another |
82
+ | `panel_material_ui` (`pmui.Page`) with synced light/dark plot themes | Default white Bokeh/Plotly plots inside a dark template |
83
+ | Explicit `sizing_mode="stretch_width"` per pane | Fixed notebook pixel widths pasted into production apps |
84
+ | `panel convert --to pyodide-worker` only for secret-free apps | Exporting apps containing DB credentials to WASM |
40
85
 
41
86
  ## Known traps
42
87
 
43
- Resize/sizing behavior, template/version differences, disconnected sessions, callback ordering, hidden global state, plot theme mismatch, expensive recompute loops, notebook-vs-server behavior divergence, dense expert UI becoming inaccessible through clutter.
88
+ Missing `sizing_mode`, cross-user leaks in global `@pn.cache`, forgetting `pn.extension("tabulator")` before serving, blocking Tornado's event loop with heavy synchronous I/O, Bokeh/Panel dark-mode theme mismatch, and notebook behavior diverging from `panel serve`.
44
89
 
45
90
  ## Verification commands
46
91
 
47
92
  ```sh
48
- panel serve app.py
49
- python -m pytest
50
93
  python -m compileall .
94
+ python -m pytest
95
+ panel serve app.py --autoreload
96
+ panel convert app.py --to pyodide-worker --out dist
51
97
  ```
52
98
 
53
- Rendered evidence requires browser inspection at multiple widths/session states; notebook rendering alone is insufficient.
99
+ Browser inspection across desktop/narrow widths, dark/light themes, and live filter updates gives `rendered` evidence; notebook preview and `pytest` alone are `static`/logic evidence.