@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.
- package/.agents/plugins/marketplace.json +1 -1
- package/.antigravity-plugin/plugin.json +32 -0
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +15 -4
- package/.codex-plugin/plugin.json +45 -0
- package/.cursor-plugin/marketplace.json +17 -0
- package/.cursor-plugin/plugin.json +27 -0
- package/.devin-plugin/plugin.json +21 -0
- package/.github/plugin/marketplace.json +34 -0
- package/CHANGELOG.md +159 -0
- package/GEMINI.md +1 -0
- package/README.md +185 -328
- package/SECURITY.md +28 -0
- package/assets/pixelcraft-logo-128.png +0 -0
- package/assets/pixelcraft-logo-256.png +0 -0
- package/bin/pixelcraft.mjs +431 -23
- package/docs/ARCHITECTURE.md +40 -37
- package/docs/DESIGN-RATIONALE.md +51 -3
- package/docs/INSTALL.md +221 -0
- package/evals/README.md +16 -6
- package/evals/fixtures/3d-web-engineering.json +69 -0
- package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
- package/evals/fixtures/ai-ui-libraries.json +53 -0
- package/evals/fixtures/audio-visual-accessibility.json +69 -0
- package/evals/fixtures/auth-and-checkout-ui.json +53 -0
- package/evals/fixtures/brandkit-identity-governance.json +48 -0
- package/evals/fixtures/build-and-architecture.json +53 -0
- package/evals/fixtures/canvas-and-node-editors.json +53 -0
- package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
- package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
- package/evals/fixtures/component-systems.json +53 -0
- package/evals/fixtures/component-testing.json +53 -0
- package/evals/fixtures/constrained-voice-and-tv.json +43 -0
- package/evals/fixtures/creative-code-rendering.json +69 -0
- package/evals/fixtures/creative-reference-evidence.json +67 -0
- package/evals/fixtures/data-app-python-marimo.json +49 -0
- package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
- package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
- package/evals/fixtures/desktop-native-workspace.json +48 -0
- package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
- package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
- package/evals/fixtures/document-rust-typst-invoice.json +49 -0
- package/evals/fixtures/document-typst-and-print-css.json +43 -0
- package/evals/fixtures/email-mjml-dark-mode.json +49 -0
- package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
- package/evals/fixtures/enterprise-data-ui.json +53 -0
- package/evals/fixtures/extended-tui-toolkits.json +53 -0
- package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
- package/evals/fixtures/file-upload-media-ui.json +53 -0
- package/evals/fixtures/forms-validation.json +53 -0
- package/evals/fixtures/game-go-ebitengine.json +49 -0
- package/evals/fixtures/game-godot-gdscript.json +49 -0
- package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
- package/evals/fixtures/i18n-engineering.json +53 -0
- package/evals/fixtures/local-first-sync.json +53 -0
- package/evals/fixtures/lynxjs.json +53 -0
- package/evals/fixtures/maizzle-email.json +53 -0
- package/evals/fixtures/maps-geospatial.json +53 -0
- package/evals/fixtures/media-og-and-video-export.json +43 -0
- package/evals/fixtures/media-players.json +53 -0
- package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
- package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
- package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
- package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
- package/evals/fixtures/mobile-jetpack-compose.json +49 -0
- package/evals/fixtures/mobile-swiftui-ios.json +49 -0
- package/evals/fixtures/motion-engineering.json +69 -0
- package/evals/fixtures/pdfjs-and-pptx.json +53 -0
- package/evals/fixtures/plan-discovery-interview.json +31 -0
- package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
- package/evals/fixtures/reactive-data-apps.json +53 -0
- package/evals/fixtures/review-evidence-audit.json +43 -0
- package/evals/fixtures/rich-text-and-code-editors.json +53 -0
- package/evals/fixtures/scrollytelling-resilience.json +70 -0
- package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
- package/evals/fixtures/state-architecture.json +53 -0
- package/evals/fixtures/styling-ecosystem.json +53 -0
- package/evals/fixtures/token-tooling.json +53 -0
- package/evals/fixtures/tui-go-bubbletea.json +49 -0
- package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
- package/evals/fixtures/tui-rust-ratatui.json +49 -0
- package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
- package/evals/fixtures/web-3d-engines.json +53 -0
- package/evals/fixtures/web-php-laravel-filament.json +49 -0
- package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
- package/evals/pixelcraft-accessibility.md +17 -0
- package/evals/pixelcraft-craft.md +16 -0
- package/evals/pixelcraft-dataviz.md +3 -3
- package/evals/pixelcraft-direction.md +17 -0
- package/evals/pixelcraft-game-ui.md +3 -3
- package/evals/pixelcraft-mobile.md +3 -3
- package/evals/pixelcraft-patterns.md +16 -0
- package/evals/pixelcraft-plan.md +65 -3
- package/evals/pixelcraft-review.md +3 -3
- package/evals/pixelcraft-visual-qa.md +11 -5
- package/evals/pixelcraft-web.md +21 -3
- package/evals/pixelcraft.md +4 -4
- package/gemini-extension.json +3 -2
- package/install.ps1 +57 -11
- package/install.sh +82 -7
- package/package.json +32 -4
- package/plugin.json +6 -1
- package/scripts/build-adapters.mjs +11 -13
- package/scripts/run-evals.mjs +397 -0
- package/scripts/sync-docs.mjs +381 -0
- package/scripts/test-build-adapters.mjs +14 -1
- package/scripts/test-cross-platform-qa.mjs +359 -0
- package/scripts/test-distribution.mjs +86 -7
- package/scripts/test-export-tokens.mjs +259 -3
- package/scripts/test-finish-gate.mjs +133 -10
- package/scripts/test-installers.mjs +155 -6
- package/scripts/test-shoot.mjs +23 -1
- package/scripts/test-slop-scan.mjs +390 -3
- package/scripts/test-style-inventory.mjs +23 -0
- package/scripts/test-sync-docs.mjs +140 -0
- package/scripts/test-validate-skills.mjs +82 -4
- package/scripts/validate-skills.mjs +149 -3
- package/skills/pixelcraft/SKILL.md +67 -47
- package/skills/pixelcraft/references/design-brief.md +2 -2
- package/skills/pixelcraft/references/floor.md +36 -19
- package/skills/pixelcraft/references/report-template.md +25 -11
- package/skills/pixelcraft/references/stack-detection.md +138 -67
- package/skills/pixelcraft/references/surface-acceptance.md +33 -21
- package/skills/pixelcraft/references/workflow-checkpoints.md +49 -7
- package/skills/pixelcraft-accessibility/SKILL.md +34 -13
- package/skills/pixelcraft-accessibility/references/apg-patterns.md +13 -0
- package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
- package/skills/pixelcraft-accessibility/references/platforms.md +34 -6
- package/skills/pixelcraft-accessibility/references/verification.md +15 -10
- package/skills/pixelcraft-accessibility/references/wcag22-checks.md +38 -5
- package/skills/pixelcraft-brandkit/SKILL.md +42 -30
- package/skills/pixelcraft-brandkit/references/asset-pipeline.md +90 -50
- package/skills/pixelcraft-brandkit/references/brand-governance.md +29 -27
- package/skills/pixelcraft-brandkit/references/logo-methods.md +33 -34
- package/skills/pixelcraft-brandkit/references/prompt-template.md +53 -51
- package/skills/pixelcraft-brandkit/references/qa-checklist.md +7 -2
- package/skills/pixelcraft-brandkit/references/visual-modes.md +16 -16
- package/skills/pixelcraft-chat-ui/SKILL.md +31 -27
- package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
- package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
- package/skills/pixelcraft-chat-ui/references/conversation-design.md +12 -6
- package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +58 -68
- package/skills/pixelcraft-chat-ui/references/slack-discord.md +60 -76
- package/skills/pixelcraft-constrained/SKILL.md +21 -20
- package/skills/pixelcraft-constrained/references/specialized-hardware.md +69 -45
- package/skills/pixelcraft-constrained/references/tv-wearables.md +123 -73
- package/skills/pixelcraft-constrained/references/voice-ui.md +86 -45
- package/skills/pixelcraft-craft/SKILL.md +29 -15
- package/skills/pixelcraft-craft/references/color.md +62 -6
- package/skills/pixelcraft-craft/references/layout.md +32 -0
- package/skills/pixelcraft-craft/references/motion.md +99 -12
- package/skills/pixelcraft-craft/references/typography.md +48 -9
- package/skills/pixelcraft-data-apps/SKILL.md +50 -31
- package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
- package/skills/pixelcraft-data-apps/references/dash.md +87 -31
- package/skills/pixelcraft-data-apps/references/evidence.md +41 -26
- package/skills/pixelcraft-data-apps/references/gradio.md +65 -27
- package/skills/pixelcraft-data-apps/references/julia-genie.md +64 -29
- package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +65 -27
- package/skills/pixelcraft-data-apps/references/nicegui.md +73 -34
- package/skills/pixelcraft-data-apps/references/observable-framework.md +65 -27
- package/skills/pixelcraft-data-apps/references/panel.md +69 -23
- package/skills/pixelcraft-data-apps/references/r-shiny.md +104 -34
- package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
- package/skills/pixelcraft-data-apps/references/reflex.md +85 -31
- package/skills/pixelcraft-data-apps/references/shiny.md +84 -27
- package/skills/pixelcraft-data-apps/references/streamlit.md +73 -25
- package/skills/pixelcraft-dataviz/SKILL.md +21 -24
- package/skills/pixelcraft-dataviz/references/color-accessibility.md +2 -2
- package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +35 -25
- package/skills/pixelcraft-dataviz/references/libraries.md +165 -46
- package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
- package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +58 -65
- package/skills/pixelcraft-desktop/SKILL.md +61 -39
- package/skills/pixelcraft-desktop/references/appkit.md +60 -26
- package/skills/pixelcraft-desktop/references/avalonia.md +65 -29
- package/skills/pixelcraft-desktop/references/cpp-gui.md +104 -27
- package/skills/pixelcraft-desktop/references/electron.md +68 -26
- package/skills/pixelcraft-desktop/references/go-gui.md +59 -30
- package/skills/pixelcraft-desktop/references/gtk.md +74 -31
- package/skills/pixelcraft-desktop/references/javafx-swing.md +54 -25
- package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +57 -30
- package/skills/pixelcraft-desktop/references/rust-gui.md +59 -41
- package/skills/pixelcraft-desktop/references/tauri.md +80 -24
- package/skills/pixelcraft-desktop/references/uno-platform.md +42 -23
- package/skills/pixelcraft-desktop/references/winui-wpf.md +66 -26
- package/skills/pixelcraft-desktop/references/working-context.md +82 -3
- package/skills/pixelcraft-direction/SKILL.md +48 -82
- package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
- package/skills/pixelcraft-direction/references/direction-card.md +11 -1
- package/skills/pixelcraft-direction/references/direction-scoring.md +5 -1
- package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
- package/skills/pixelcraft-direction/references/movements.md +3 -0
- package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
- package/skills/pixelcraft-direction/references/slop-fingerprints.md +32 -7
- package/skills/pixelcraft-document/SKILL.md +27 -23
- package/skills/pixelcraft-document/references/archetypes.md +27 -4
- package/skills/pixelcraft-document/references/pdf-tools.md +241 -81
- package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
- package/skills/pixelcraft-document/references/print-css.md +96 -43
- package/skills/pixelcraft-document/references/slides.md +123 -27
- package/skills/pixelcraft-email/SKILL.md +42 -20
- package/skills/pixelcraft-email/references/client-quirks.md +101 -33
- package/skills/pixelcraft-email/references/html-tables.md +83 -22
- package/skills/pixelcraft-email/references/maizzle.md +54 -0
- package/skills/pixelcraft-email/references/mjml.md +13 -11
- package/skills/pixelcraft-email/references/react-email.md +76 -34
- package/skills/pixelcraft-extensions/SKILL.md +32 -27
- package/skills/pixelcraft-extensions/references/browser-extensions.md +91 -17
- package/skills/pixelcraft-extensions/references/figma-office.md +97 -14
- package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
- package/skills/pixelcraft-extensions/references/raycast.md +90 -11
- package/skills/pixelcraft-extensions/references/vscode-webviews.md +91 -17
- package/skills/pixelcraft-game-ui/SKILL.md +45 -26
- package/skills/pixelcraft-game-ui/references/bevy.md +69 -31
- package/skills/pixelcraft-game-ui/references/godot.md +100 -27
- package/skills/pixelcraft-game-ui/references/hud-principles.md +50 -21
- package/skills/pixelcraft-game-ui/references/love2d.md +53 -27
- package/skills/pixelcraft-game-ui/references/monogame.md +45 -29
- package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
- package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +69 -27
- package/skills/pixelcraft-game-ui/references/unreal-umg.md +53 -26
- package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
- package/skills/pixelcraft-handoff/SKILL.md +14 -13
- package/skills/pixelcraft-handoff/references/design-translation.md +40 -10
- package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
- package/skills/pixelcraft-media/SKILL.md +20 -23
- package/skills/pixelcraft-media/references/banners-video.md +83 -65
- package/skills/pixelcraft-media/references/og-generation.md +110 -63
- package/skills/pixelcraft-media/references/social-cards.md +57 -58
- package/skills/pixelcraft-mobile/SKILL.md +53 -36
- package/skills/pixelcraft-mobile/references/dotnet-maui.md +62 -34
- package/skills/pixelcraft-mobile/references/flet.md +53 -26
- package/skills/pixelcraft-mobile/references/flutter.md +76 -32
- package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
- package/skills/pixelcraft-mobile/references/ionic-capacitor.md +48 -26
- package/skills/pixelcraft-mobile/references/jetpack-compose.md +92 -24
- package/skills/pixelcraft-mobile/references/kivy.md +54 -31
- package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +53 -27
- package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
- package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
- package/skills/pixelcraft-mobile/references/react-native-expo.md +66 -31
- package/skills/pixelcraft-mobile/references/swiftui.md +158 -28
- package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
- package/skills/pixelcraft-mobile/references/task-state-composition.md +82 -2
- package/skills/pixelcraft-mobile/references/uikit.md +57 -23
- package/skills/pixelcraft-patterns/SKILL.md +30 -13
- package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
- package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
- package/skills/pixelcraft-patterns/references/auth-onboarding.md +32 -13
- package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
- package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
- package/skills/pixelcraft-patterns/references/commerce.md +35 -16
- package/skills/pixelcraft-patterns/references/communication.md +34 -15
- package/skills/pixelcraft-patterns/references/creative-tools.md +30 -17
- package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
- package/skills/pixelcraft-patterns/references/dashboard-admin.md +22 -18
- package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
- package/skills/pixelcraft-patterns/references/marketing.md +31 -19
- package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
- package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
- package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
- package/skills/pixelcraft-patterns/references/pattern-selection.md +8 -2
- package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
- package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
- package/skills/pixelcraft-patterns/references/settings.md +40 -12
- package/skills/pixelcraft-plan/SKILL.md +54 -18
- package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
- package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
- package/skills/pixelcraft-plan/references/plan-template.md +44 -9
- package/skills/pixelcraft-plan/references/repo-discovery.md +16 -9
- package/skills/pixelcraft-plan/references/stack-freshness.md +22 -5
- package/skills/pixelcraft-plan/references/stack-selection.md +65 -9
- package/skills/pixelcraft-review/SKILL.md +41 -19
- package/skills/pixelcraft-review/references/audit-report.md +20 -1
- package/skills/pixelcraft-review/references/heuristics.md +63 -18
- package/skills/pixelcraft-review/references/personas.md +41 -14
- package/skills/pixelcraft-review/references/polish.md +66 -26
- package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
- package/skills/pixelcraft-review/scripts/slop-scan.mjs +679 -32
- package/skills/pixelcraft-spatial/SKILL.md +16 -17
- package/skills/pixelcraft-spatial/references/comfort-accessibility.md +25 -84
- package/skills/pixelcraft-spatial/references/platforms.md +123 -53
- package/skills/pixelcraft-tokens/SKILL.md +18 -14
- package/skills/pixelcraft-tokens/assets/tokens.example.json +1 -1
- package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +1 -1
- package/skills/pixelcraft-tokens/references/format.md +39 -9
- package/skills/pixelcraft-tokens/references/governance.md +1 -1
- package/skills/pixelcraft-tokens/references/theme-presets.md +36 -8
- package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
- package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +637 -75
- package/skills/pixelcraft-tui/SKILL.md +41 -25
- package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +49 -30
- package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
- package/skills/pixelcraft-tui/references/ink.md +77 -28
- package/skills/pixelcraft-tui/references/ratatui.md +70 -30
- package/skills/pixelcraft-tui/references/rich.md +53 -33
- package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
- package/skills/pixelcraft-tui/references/textual.md +75 -34
- package/skills/pixelcraft-ux/SKILL.md +22 -12
- package/skills/pixelcraft-ux/references/feedback-performance.md +39 -19
- package/skills/pixelcraft-ux/references/forms.md +57 -3
- package/skills/pixelcraft-ux/references/i18n.md +50 -12
- package/skills/pixelcraft-ux/references/laws.md +35 -14
- package/skills/pixelcraft-ux/references/state-matrix.md +15 -1
- package/skills/pixelcraft-ux/references/ux-writing.md +1 -0
- package/skills/pixelcraft-visual-qa/SKILL.md +21 -7
- package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +28 -7
- package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
- package/skills/pixelcraft-visual-qa/references/capture-email.md +13 -9
- package/skills/pixelcraft-visual-qa/references/capture-mobile.md +20 -5
- package/skills/pixelcraft-visual-qa/references/capture-terminal.md +6 -2
- package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
- package/skills/pixelcraft-visual-qa/references/performance-budgets.md +25 -12
- package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
- package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
- package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
- package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
- package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
- package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +50 -11
- package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +214 -59
- package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +121 -49
- package/skills/pixelcraft-web/SKILL.md +105 -49
- package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
- package/skills/pixelcraft-web/references/adaptive-layout.md +52 -8
- package/skills/pixelcraft-web/references/angular.md +63 -16
- package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
- package/skills/pixelcraft-web/references/astro.md +64 -13
- package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
- package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
- package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
- package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
- package/skills/pixelcraft-web/references/clojurescript.md +52 -17
- package/skills/pixelcraft-web/references/component-systems.md +102 -0
- package/skills/pixelcraft-web/references/component-testing.md +170 -0
- package/skills/pixelcraft-web/references/creative-effects.md +59 -0
- package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
- package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
- package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
- package/skills/pixelcraft-web/references/forms-validation.md +123 -0
- package/skills/pixelcraft-web/references/fsharp-fable.md +3 -2
- package/skills/pixelcraft-web/references/gsap.md +102 -0
- package/skills/pixelcraft-web/references/html-css.md +144 -12
- package/skills/pixelcraft-web/references/htmx-alpine.md +68 -18
- package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
- package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
- package/skills/pixelcraft-web/references/java-web.md +27 -18
- package/skills/pixelcraft-web/references/kotlin-web.md +6 -2
- package/skills/pixelcraft-web/references/leptos-yew.md +62 -19
- package/skills/pixelcraft-web/references/lit-web-components.md +4 -2
- package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
- package/skills/pixelcraft-web/references/media-players.md +104 -0
- package/skills/pixelcraft-web/references/motion-react.md +96 -0
- package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
- package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
- package/skills/pixelcraft-web/references/pwa.md +6 -1
- package/skills/pixelcraft-web/references/qwik.md +51 -11
- package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
- package/skills/pixelcraft-web/references/react-next.md +112 -13
- package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
- package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
- package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
- package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
- package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
- package/skills/pixelcraft-web/references/server-rendered.md +106 -63
- package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
- package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
- package/skills/pixelcraft-web/references/solid.md +67 -16
- package/skills/pixelcraft-web/references/state-architecture.md +107 -0
- package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
- package/skills/pixelcraft-web/references/svelte.md +61 -11
- package/skills/pixelcraft-web/references/tailwind.md +40 -14
- package/skills/pixelcraft-web/references/video-media.md +69 -0
- package/skills/pixelcraft-web/references/vue-nuxt.md +37 -13
- package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
|
@@ -1,53 +1,91 @@
|
|
|
1
|
-
# Jupyter widgets
|
|
1
|
+
# Jupyter widgets, AnyWidget, and Voilá
|
|
2
2
|
|
|
3
3
|
## Token mapping
|
|
4
4
|
|
|
5
|
-
ipywidgets exposes limited style
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
52
|
+
## Voilá standalone serving
|
|
18
53
|
|
|
19
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
60
|
+
## Layout, motion, and accessibility
|
|
24
61
|
|
|
25
|
-
|
|
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
|
-
##
|
|
64
|
+
## States and forms idiom
|
|
28
65
|
|
|
29
|
-
|
|
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
|
-
|
|
|
36
|
-
| explicit Apply
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
14
|
+
## Page isolation, storage scopes, refreshables, and async offloading
|
|
28
15
|
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
76
|
+
## Layout, typography, motion, and accessibility
|
|
38
77
|
|
|
39
|
-
|
|
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
|
-
|
|
|
46
|
-
| `
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
67
|
+
## Layout, typography, motion, and accessibility
|
|
23
68
|
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
79
|
+
## States and forms idiom
|
|
41
80
|
|
|
42
|
-
|
|
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("
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
| semantic CSS
|
|
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
|
-
|
|
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
|
-
|
|
62
|
-
cat package.json
|
|
100
|
+
ls observablehq.config.*
|
|
63
101
|
npm run build
|
|
64
102
|
npm run dev
|
|
65
103
|
```
|
|
66
104
|
|
|
67
|
-
|
|
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
|
|
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
|
-
|
|
7
|
+
```python
|
|
8
|
+
import panel as pn
|
|
9
|
+
import panel_material_ui as pmui
|
|
8
10
|
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
+
chat = pn.chat.ChatInterface(callback=respond, sizing_mode="stretch_both")
|
|
16
44
|
|
|
17
|
-
|
|
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
|
-
|
|
58
|
+
For serverless public demos or documentation embeds, compile Panel apps to client-side Pyodide with:
|
|
20
59
|
|
|
21
|
-
|
|
60
|
+
```sh
|
|
61
|
+
panel convert app.py --to pyodide-worker --out dist
|
|
62
|
+
```
|
|
22
63
|
|
|
23
|
-
|
|
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
|
-
|
|
68
|
+
## Layout, motion, and accessibility
|
|
26
69
|
|
|
27
|
-
|
|
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
|
-
|
|
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
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
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
|
-
|
|
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
|
-
|
|
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.
|