@thanhnguyxn/pixelcraft 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +20 -0
- package/.antigravity-plugin/plugin.json +32 -0
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +22 -0
- 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/LICENSE +21 -0
- package/README.md +264 -2
- package/SECURITY.md +28 -0
- package/assets/README.md +28 -0
- package/assets/pixelcraft-logo-128.png +0 -0
- package/assets/pixelcraft-logo-256.png +0 -0
- package/assets/pixelcraft-logo-512.png +0 -0
- package/bin/pixelcraft.mjs +852 -0
- package/docs/ARCHITECTURE.md +105 -0
- package/docs/DESIGN-RATIONALE.md +191 -0
- package/docs/INSTALL.md +221 -0
- package/evals/README.md +37 -0
- package/evals/fixtures/3d-web-engineering.json +69 -0
- package/evals/fixtures/README.md +36 -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/direction-prototype-complexity.json +29 -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/finish-gate-anti-slop.json +30 -0
- package/evals/fixtures/forms-accessibility-negative.json +29 -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/handoff-fidelity-tolerance.json +29 -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-brownfield-evidence.json +28 -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/visual-qa-task-evidence.json +29 -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/fixtures/workflow-checkpoints.json +30 -0
- package/evals/pixelcraft-accessibility.md +74 -0
- package/evals/pixelcraft-brandkit.md +58 -0
- package/evals/pixelcraft-chat-ui.md +55 -0
- package/evals/pixelcraft-constrained.md +55 -0
- package/evals/pixelcraft-craft.md +76 -0
- package/evals/pixelcraft-data-apps.md +55 -0
- package/evals/pixelcraft-dataviz.md +59 -0
- package/evals/pixelcraft-desktop.md +55 -0
- package/evals/pixelcraft-direction.md +77 -0
- package/evals/pixelcraft-document.md +55 -0
- package/evals/pixelcraft-email.md +55 -0
- package/evals/pixelcraft-extensions.md +55 -0
- package/evals/pixelcraft-game-ui.md +59 -0
- package/evals/pixelcraft-handoff.md +57 -0
- package/evals/pixelcraft-media.md +55 -0
- package/evals/pixelcraft-mobile.md +59 -0
- package/evals/pixelcraft-patterns.md +73 -0
- package/evals/pixelcraft-plan.md +127 -0
- package/evals/pixelcraft-review.md +63 -0
- package/evals/pixelcraft-spatial.md +55 -0
- package/evals/pixelcraft-tokens.md +57 -0
- package/evals/pixelcraft-tui.md +55 -0
- package/evals/pixelcraft-ux.md +59 -0
- package/evals/pixelcraft-visual-qa.md +86 -0
- package/evals/pixelcraft-web.md +89 -0
- package/evals/pixelcraft.md +70 -0
- package/gemini-extension.json +6 -0
- package/install.ps1 +341 -0
- package/install.sh +512 -0
- package/package.json +91 -4
- package/plugin.json +29 -0
- package/scripts/build-adapters.mjs +288 -0
- package/scripts/build-release-archives.mjs +61 -0
- package/scripts/build-skill-zips.mjs +94 -0
- package/scripts/run-evals.mjs +397 -0
- package/scripts/sync-docs.mjs +381 -0
- package/scripts/test-build-adapters.mjs +61 -0
- package/scripts/test-cross-platform-qa.mjs +359 -0
- package/scripts/test-distribution.mjs +203 -0
- package/scripts/test-export-tokens.mjs +361 -0
- package/scripts/test-finish-gate.mjs +271 -0
- package/scripts/test-installers.mjs +216 -0
- package/scripts/test-release-archives.mjs +42 -0
- package/scripts/test-shoot.mjs +87 -0
- package/scripts/test-slop-scan.mjs +416 -0
- package/scripts/test-style-inventory.mjs +234 -0
- package/scripts/test-sync-docs.mjs +140 -0
- package/scripts/test-validate-skills.mjs +195 -0
- package/scripts/validate-skills.mjs +658 -0
- package/skills/pixelcraft/SKILL.md +155 -0
- package/skills/pixelcraft/references/design-brief.md +75 -0
- package/skills/pixelcraft/references/floor.md +90 -0
- package/skills/pixelcraft/references/report-template.md +49 -0
- package/skills/pixelcraft/references/stack-detection.md +226 -0
- package/skills/pixelcraft/references/surface-acceptance.md +52 -0
- package/skills/pixelcraft/references/workflow-checkpoints.md +71 -0
- package/skills/pixelcraft-accessibility/SKILL.md +54 -0
- package/skills/pixelcraft-accessibility/references/apg-patterns.md +64 -0
- package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
- package/skills/pixelcraft-accessibility/references/platforms.md +86 -0
- package/skills/pixelcraft-accessibility/references/verification.md +64 -0
- package/skills/pixelcraft-accessibility/references/wcag22-checks.md +99 -0
- package/skills/pixelcraft-brandkit/SKILL.md +127 -0
- package/skills/pixelcraft-brandkit/references/asset-pipeline.md +165 -0
- package/skills/pixelcraft-brandkit/references/brand-governance.md +82 -0
- package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
- package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
- package/skills/pixelcraft-brandkit/references/logo-methods.md +97 -0
- package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
- package/skills/pixelcraft-brandkit/references/prompt-template.md +87 -0
- package/skills/pixelcraft-brandkit/references/qa-checklist.md +93 -0
- package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
- package/skills/pixelcraft-chat-ui/SKILL.md +57 -0
- 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 +84 -0
- package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +77 -0
- package/skills/pixelcraft-chat-ui/references/slack-discord.md +80 -0
- package/skills/pixelcraft-constrained/SKILL.md +52 -0
- package/skills/pixelcraft-constrained/references/specialized-hardware.md +90 -0
- package/skills/pixelcraft-constrained/references/tv-wearables.md +134 -0
- package/skills/pixelcraft-constrained/references/voice-ui.md +104 -0
- package/skills/pixelcraft-craft/SKILL.md +58 -0
- package/skills/pixelcraft-craft/references/color.md +125 -0
- package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
- package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
- package/skills/pixelcraft-craft/references/layout.md +73 -0
- package/skills/pixelcraft-craft/references/motion.md +163 -0
- package/skills/pixelcraft-craft/references/typography.md +110 -0
- package/skills/pixelcraft-data-apps/SKILL.md +86 -0
- package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
- package/skills/pixelcraft-data-apps/references/dash.md +109 -0
- package/skills/pixelcraft-data-apps/references/evidence.md +90 -0
- package/skills/pixelcraft-data-apps/references/gradio.md +103 -0
- package/skills/pixelcraft-data-apps/references/julia-genie.md +89 -0
- package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +91 -0
- package/skills/pixelcraft-data-apps/references/nicegui.md +102 -0
- package/skills/pixelcraft-data-apps/references/observable-framework.md +105 -0
- package/skills/pixelcraft-data-apps/references/panel.md +99 -0
- package/skills/pixelcraft-data-apps/references/r-shiny.md +124 -0
- package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
- package/skills/pixelcraft-data-apps/references/reflex.md +116 -0
- package/skills/pixelcraft-data-apps/references/shiny.md +110 -0
- package/skills/pixelcraft-data-apps/references/streamlit.md +113 -0
- package/skills/pixelcraft-dataviz/SKILL.md +60 -0
- package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
- package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
- package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +107 -0
- package/skills/pixelcraft-dataviz/references/libraries.md +176 -0
- package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
- package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +92 -0
- package/skills/pixelcraft-desktop/SKILL.md +93 -0
- package/skills/pixelcraft-desktop/references/appkit.md +92 -0
- package/skills/pixelcraft-desktop/references/avalonia.md +95 -0
- package/skills/pixelcraft-desktop/references/cpp-gui.md +129 -0
- package/skills/pixelcraft-desktop/references/electron.md +96 -0
- package/skills/pixelcraft-desktop/references/go-gui.md +83 -0
- package/skills/pixelcraft-desktop/references/gtk.md +97 -0
- package/skills/pixelcraft-desktop/references/javafx-swing.md +81 -0
- package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +88 -0
- package/skills/pixelcraft-desktop/references/rust-gui.md +83 -0
- package/skills/pixelcraft-desktop/references/tauri.md +110 -0
- package/skills/pixelcraft-desktop/references/uno-platform.md +71 -0
- package/skills/pixelcraft-desktop/references/winui-wpf.md +98 -0
- package/skills/pixelcraft-desktop/references/working-context.md +84 -0
- package/skills/pixelcraft-direction/SKILL.md +120 -0
- package/skills/pixelcraft-direction/references/composition-library.md +84 -0
- package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
- package/skills/pixelcraft-direction/references/direction-card.md +64 -0
- package/skills/pixelcraft-direction/references/direction-scoring.md +76 -0
- package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
- package/skills/pixelcraft-direction/references/movements.md +71 -0
- package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
- package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
- package/skills/pixelcraft-direction/references/slop-fingerprints.md +83 -0
- package/skills/pixelcraft-direction/references/wildcards.md +47 -0
- package/skills/pixelcraft-document/SKILL.md +58 -0
- package/skills/pixelcraft-document/references/archetypes.md +106 -0
- package/skills/pixelcraft-document/references/pdf-tools.md +314 -0
- package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
- package/skills/pixelcraft-document/references/print-css.md +187 -0
- package/skills/pixelcraft-document/references/slides.md +198 -0
- package/skills/pixelcraft-email/SKILL.md +80 -0
- package/skills/pixelcraft-email/references/client-quirks.md +113 -0
- package/skills/pixelcraft-email/references/html-tables.md +114 -0
- package/skills/pixelcraft-email/references/maizzle.md +54 -0
- package/skills/pixelcraft-email/references/mjml.md +54 -0
- package/skills/pixelcraft-email/references/react-email.md +95 -0
- package/skills/pixelcraft-extensions/SKILL.md +56 -0
- package/skills/pixelcraft-extensions/references/browser-extensions.md +105 -0
- package/skills/pixelcraft-extensions/references/figma-office.md +106 -0
- package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
- package/skills/pixelcraft-extensions/references/raycast.md +98 -0
- package/skills/pixelcraft-extensions/references/vscode-webviews.md +100 -0
- package/skills/pixelcraft-game-ui/SKILL.md +80 -0
- package/skills/pixelcraft-game-ui/references/bevy.md +90 -0
- package/skills/pixelcraft-game-ui/references/godot.md +130 -0
- package/skills/pixelcraft-game-ui/references/hud-principles.md +67 -0
- package/skills/pixelcraft-game-ui/references/love2d.md +77 -0
- package/skills/pixelcraft-game-ui/references/monogame.md +68 -0
- package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
- package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +107 -0
- package/skills/pixelcraft-game-ui/references/unreal-umg.md +80 -0
- package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
- package/skills/pixelcraft-handoff/SKILL.md +50 -0
- package/skills/pixelcraft-handoff/references/design-translation.md +134 -0
- package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
- package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
- package/skills/pixelcraft-media/SKILL.md +49 -0
- package/skills/pixelcraft-media/references/banners-video.md +130 -0
- package/skills/pixelcraft-media/references/og-generation.md +154 -0
- package/skills/pixelcraft-media/references/social-cards.md +71 -0
- package/skills/pixelcraft-mobile/SKILL.md +86 -0
- package/skills/pixelcraft-mobile/references/dotnet-maui.md +91 -0
- package/skills/pixelcraft-mobile/references/flet.md +80 -0
- package/skills/pixelcraft-mobile/references/flutter.md +113 -0
- package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
- package/skills/pixelcraft-mobile/references/ionic-capacitor.md +87 -0
- package/skills/pixelcraft-mobile/references/jetpack-compose.md +129 -0
- package/skills/pixelcraft-mobile/references/kivy.md +82 -0
- package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +86 -0
- 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 +106 -0
- package/skills/pixelcraft-mobile/references/swiftui.md +200 -0
- package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
- package/skills/pixelcraft-mobile/references/task-state-composition.md +85 -0
- package/skills/pixelcraft-mobile/references/uikit.md +92 -0
- package/skills/pixelcraft-patterns/SKILL.md +75 -0
- 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 +44 -0
- 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 +47 -0
- package/skills/pixelcraft-patterns/references/communication.md +45 -0
- package/skills/pixelcraft-patterns/references/creative-tools.md +42 -0
- package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
- package/skills/pixelcraft-patterns/references/dashboard-admin.md +35 -0
- package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
- package/skills/pixelcraft-patterns/references/marketing.md +44 -0
- 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 +80 -0
- 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/search-filtering.md +42 -0
- package/skills/pixelcraft-patterns/references/settings.md +51 -0
- package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
- package/skills/pixelcraft-plan/SKILL.md +103 -0
- package/skills/pixelcraft-plan/references/design-input.md +69 -0
- 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 +134 -0
- package/skills/pixelcraft-plan/references/repo-discovery.md +49 -0
- package/skills/pixelcraft-plan/references/stack-freshness.md +67 -0
- package/skills/pixelcraft-plan/references/stack-selection.md +98 -0
- package/skills/pixelcraft-review/SKILL.md +86 -0
- package/skills/pixelcraft-review/references/audit-report.md +69 -0
- package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
- package/skills/pixelcraft-review/references/heuristics.md +63 -0
- package/skills/pixelcraft-review/references/personas.md +53 -0
- package/skills/pixelcraft-review/references/polish.md +78 -0
- package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
- package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
- package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
- package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
- package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
- package/skills/pixelcraft-review/scripts/slop-scan.mjs +1233 -0
- package/skills/pixelcraft-spatial/SKILL.md +51 -0
- package/skills/pixelcraft-spatial/references/comfort-accessibility.md +39 -0
- package/skills/pixelcraft-spatial/references/platforms.md +147 -0
- package/skills/pixelcraft-tokens/SKILL.md +60 -0
- package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
- package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
- package/skills/pixelcraft-tokens/references/adoption.md +55 -0
- package/skills/pixelcraft-tokens/references/format.md +84 -0
- package/skills/pixelcraft-tokens/references/governance.md +80 -0
- package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
- package/skills/pixelcraft-tokens/references/theme-presets.md +122 -0
- package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
- package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +847 -0
- package/skills/pixelcraft-tui/SKILL.md +76 -0
- package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +79 -0
- package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
- package/skills/pixelcraft-tui/references/ink.md +109 -0
- package/skills/pixelcraft-tui/references/ratatui.md +102 -0
- package/skills/pixelcraft-tui/references/rich.md +82 -0
- package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
- package/skills/pixelcraft-tui/references/textual.md +108 -0
- package/skills/pixelcraft-ux/SKILL.md +56 -0
- package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
- package/skills/pixelcraft-ux/references/feedback-performance.md +50 -0
- package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
- package/skills/pixelcraft-ux/references/forms.md +151 -0
- package/skills/pixelcraft-ux/references/i18n.md +221 -0
- package/skills/pixelcraft-ux/references/laws.md +39 -0
- package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
- package/skills/pixelcraft-ux/references/state-matrix.md +53 -0
- package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
- package/skills/pixelcraft-ux/references/ux-writing.md +44 -0
- package/skills/pixelcraft-visual-qa/SKILL.md +96 -0
- package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
- package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +59 -0
- package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
- package/skills/pixelcraft-visual-qa/references/capture-email.md +38 -0
- package/skills/pixelcraft-visual-qa/references/capture-mobile.md +50 -0
- package/skills/pixelcraft-visual-qa/references/capture-terminal.md +35 -0
- package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
- package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
- package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
- package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
- package/skills/pixelcraft-visual-qa/references/performance-budgets.md +78 -0
- package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
- package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -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 +174 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
- package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +668 -0
- package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1226 -0
- package/skills/pixelcraft-web/SKILL.md +132 -0
- package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
- package/skills/pixelcraft-web/references/adaptive-layout.md +69 -0
- package/skills/pixelcraft-web/references/angular.md +108 -0
- package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
- package/skills/pixelcraft-web/references/astro.md +113 -0
- 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 +88 -0
- 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/elm.md +53 -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 +54 -0
- package/skills/pixelcraft-web/references/gsap.md +102 -0
- package/skills/pixelcraft-web/references/html-css.md +220 -0
- package/skills/pixelcraft-web/references/htmx-alpine.md +103 -0
- 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 +61 -0
- package/skills/pixelcraft-web/references/kotlin-web.md +57 -0
- package/skills/pixelcraft-web/references/leptos-yew.md +97 -0
- package/skills/pixelcraft-web/references/lit-web-components.md +63 -0
- 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 +230 -0
- package/skills/pixelcraft-web/references/qwik.md +94 -0
- package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
- package/skills/pixelcraft-web/references/react-next.md +168 -0
- 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/scala-laminar.md +53 -0
- package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
- package/skills/pixelcraft-web/references/server-rendered.md +114 -0
- 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 +111 -0
- 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 +111 -0
- package/skills/pixelcraft-web/references/tailwind.md +99 -0
- package/skills/pixelcraft-web/references/video-media.md +69 -0
- package/skills/pixelcraft-web/references/vue-nuxt.md +86 -0
- package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Gradio
|
|
2
|
+
|
|
3
|
+
## Version compatibility and breaking changes (Gradio 5 vs 6)
|
|
4
|
+
|
|
5
|
+
Check the installed `gradio` version before editing theme, CSS, or chat code:
|
|
6
|
+
|
|
7
|
+
- **Message-format chat history**: Use OpenAI-style message dicts (`{"role": "user" | "assistant", "content": ...}`) with `type="messages"` in Gradio 5 (`gr.Chatbot(type="messages")`, `gr.ChatInterface(..., type="messages")`). Legacy `[user, bot]` tuple history is deprecated in Gradio 5 and removed in Gradio 6 (where message dicts are the default).
|
|
8
|
+
- **`theme` and `css` placement**: In Gradio 5, pass `theme=` and `css=` to `gr.Blocks(theme=..., css=...)`. In **Gradio 6**, `theme`, `css`, `js`, and `head` move to `demo.launch(theme=..., css=...)`. Inspect the repo's `gradio` pin and existing entrypoints before choosing placement.
|
|
9
|
+
|
|
10
|
+
## Token mapping
|
|
11
|
+
|
|
12
|
+
Start with a prebuilt theme (`gr.themes.Base`, `Soft`, `Default`, `Monochrome`) and override semantic CSS variables with `.set(...)`. Attach stable `elem_id` or `elem_classes` hooks rather than targeting generated Svelte classes:
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import gradio as gr
|
|
16
|
+
|
|
17
|
+
theme = gr.themes.Soft(primary_hue="blue", neutral_hue="slate").set(
|
|
18
|
+
body_background_fill="#faf8f1",
|
|
19
|
+
loader_color="#0074ca",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
# Gradio 5: gr.Blocks(theme=theme, css=".result-panel { border-radius: 12px; }")
|
|
23
|
+
# Gradio 6: pass theme=theme and css=... to demo.launch(...)
|
|
24
|
+
with gr.Blocks() as demo:
|
|
25
|
+
out = gr.Markdown(elem_classes=["result-panel"])
|
|
26
|
+
|
|
27
|
+
demo.launch(theme=theme, css=".result-panel { border-radius: 12px; }")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Chat, dynamic rendering, multipage, and state idioms
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
import gradio as gr
|
|
34
|
+
|
|
35
|
+
def respond(message: str, history: list[dict]):
|
|
36
|
+
partial = ""
|
|
37
|
+
for token in stream_model(message, history):
|
|
38
|
+
partial += token
|
|
39
|
+
yield partial
|
|
40
|
+
|
|
41
|
+
with gr.Blocks() as demo:
|
|
42
|
+
prefs = gr.BrowserState({"temperature": 0.2}) # persisted in browser localStorage
|
|
43
|
+
session_cache = gr.State({}) # per-session server state
|
|
44
|
+
|
|
45
|
+
gr.ChatInterface(
|
|
46
|
+
fn=respond,
|
|
47
|
+
type="messages", # required in Gradio 5; default in Gradio 6
|
|
48
|
+
title="Model Evaluator",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
count = gr.Slider(1, 4, step=1, value=2, label="Candidate outputs")
|
|
52
|
+
|
|
53
|
+
@gr.render(inputs=count)
|
|
54
|
+
def render_candidates(n: int):
|
|
55
|
+
with gr.Row():
|
|
56
|
+
for i in range(int(n)):
|
|
57
|
+
gr.Textbox(label=f"Candidate {i + 1}", interactive=False)
|
|
58
|
+
|
|
59
|
+
with demo.route("Settings"):
|
|
60
|
+
gr.Markdown("## Evaluation settings")
|
|
61
|
+
gr.Slider(0.0, 1.0, value=0.2, label="Temperature")
|
|
62
|
+
|
|
63
|
+
demo.launch(ssr_mode=True, mcp_server=True)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- **`@gr.render`**: Dynamically generate components from reactive inputs instead of pre-allocating dozens of hidden widgets with `visible=False`.
|
|
67
|
+
- **Multipage (`demo.route(...)`)**: Split distinct workflows (inference vs benchmark settings) onto dedicated routes with automatic nav links instead of cramming tabs into one page.
|
|
68
|
+
- **`gr.BrowserState` vs `gr.State`**: Use `gr.BrowserState` for safe non-secret client preferences that survive reloads; use `gr.State` for ephemeral per-session server objects; never store credentials in `BrowserState`.
|
|
69
|
+
- **`ssr_mode=True` & `mcp_server=True`**: Enable `ssr_mode=True` when fast initial HTML paint matters (requires Node runtime); enable `mcp_server=True` when exposing typed Python functions (with docstrings and type hints) as MCP tools for agents.
|
|
70
|
+
- **Custom components**: Author custom components with the **Svelte 5** CLI workflow (`gradio cc create`, `gradio cc dev`, `gradio cc build`) rather than injecting fragile inline `<script>` hacks.
|
|
71
|
+
|
|
72
|
+
## Layout, motion, and accessibility
|
|
73
|
+
|
|
74
|
+
Group controls in `gr.Row`, `gr.Column`, `gr.Tabs`, and `gr.Accordion` along the input -> trigger -> output scan path. Use generator yields and `gr.Progress(track_tqdm=True)` for truthful long-running feedback; ensure custom CSS honors `prefers-reduced-motion`. Give every control a clear `label` and `info` text, keep media alt/captions present, and test narrow iframe and mobile widths.
|
|
75
|
+
|
|
76
|
+
## Forms and concurrency idiom
|
|
77
|
+
|
|
78
|
+
Make expensive inference triggers explicit (`gr.Button("Run", variant="primary")`) rather than firing on every slider tick. Configure `concurrency_limit` and `cancels=[run_event]` on `.click()` handlers so users can abort slow generations cleanly and queue backpressure stays visible. Validate file types/sizes before GPU work and preserve inputs on error (`gr.Error("...")`).
|
|
79
|
+
|
|
80
|
+
## Do/don't pairs
|
|
81
|
+
|
|
82
|
+
| Do | Don't |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `type="messages"` dict history (`{"role", "content"}`) | Deprecated `[user, bot]` tuple chat history |
|
|
85
|
+
| Match `theme`/`css` placement to installed Gradio 5 vs 6 | Pass Gradio 5 `Blocks(theme=...)` blindly on Gradio 6 |
|
|
86
|
+
| `@gr.render` for variable-length UI lists | Pre-creating 20 hidden components toggled with `visible=` |
|
|
87
|
+
| `elem_classes=["result-panel"]` stable CSS hooks | Scraping generated Svelte class hashes |
|
|
88
|
+
| Explicit Run + Cancel button with `concurrency_limit` | Triggering heavy inference on every slider drag |
|
|
89
|
+
| `gr.BrowserState` only for non-secret client prefs | Storing API keys or PII in `gr.BrowserState` |
|
|
90
|
+
|
|
91
|
+
## Known traps
|
|
92
|
+
|
|
93
|
+
Gradio 5/6 `Blocks` vs `launch` API mismatch, tuple-vs-messages `Chatbot` format errors, generator cancellation leaks, queue starvation without `concurrency_limit`, large media uploads exhausting memory, `ssr_mode=True` failing without Node, and mobile/iframe horizontal clipping.
|
|
94
|
+
|
|
95
|
+
## Verification commands
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
python -m compileall .
|
|
99
|
+
python -m pytest
|
|
100
|
+
python app.py
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Backend `pytest` checks verify handler logic (`static`); inspect rendered desktop/mobile/iframe views, streaming cancellation, and error paths in a browser for `rendered` evidence.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Julia Genie / Stipple
|
|
2
|
+
|
|
3
|
+
Genie and Stipple provide reactive Julia web/data-app infrastructure built over Vue/Quasar browser components. Keep reactive idioms native to Julia (`GenieFramework`) rather than porting Python patterns literally.
|
|
4
|
+
|
|
5
|
+
## Token mapping
|
|
6
|
+
|
|
7
|
+
Stipple renders Quasar/Vue components in the browser. Configure theme colors and typography through `public/css/` custom stylesheets (semantic CSS variables and Quasar brand overrides `--q-primary`, `--q-dark-page`) rather than mutating autogenerated component internals. Keep Plotly/Makie chart palettes synchronized with page tokens explicitly.
|
|
8
|
+
|
|
9
|
+
## Reactive `@app` idiom (`@in`, `@out`, `@private`, `@onchange`)
|
|
10
|
+
|
|
11
|
+
Declare every reactive variable's direction explicitly: `@in` is browser-writable, `@out` is server-to-browser read-only, and `@private` stays strictly server-side (never serialized over WebSocket to the browser).
|
|
12
|
+
|
|
13
|
+
```julia
|
|
14
|
+
module OpsApp
|
|
15
|
+
using GenieFramework, DataFrames, PlotlyBase
|
|
16
|
+
@genietools
|
|
17
|
+
|
|
18
|
+
@app begin
|
|
19
|
+
@in region = "EMEA"
|
|
20
|
+
@in run_trigger = false
|
|
21
|
+
@out regions = ["EMEA", "AMER", "APAC"]
|
|
22
|
+
@out loading = false
|
|
23
|
+
@out error_msg = ""
|
|
24
|
+
@out rows = DataTable(DataFrame(order_id = String[], revenue = Float64[]))
|
|
25
|
+
@private db_pool = init_db_pool() # never serialized to client
|
|
26
|
+
|
|
27
|
+
@onchange isready, region, run_trigger begin
|
|
28
|
+
loading = true
|
|
29
|
+
error_msg = ""
|
|
30
|
+
try
|
|
31
|
+
df = query_orders(db_pool, region)
|
|
32
|
+
rows = DataTable(df)
|
|
33
|
+
catch err
|
|
34
|
+
error_msg = sprint(showerror, err)
|
|
35
|
+
rows = DataTable(DataFrame(order_id = String[], revenue = Float64[]))
|
|
36
|
+
finally
|
|
37
|
+
loading = false
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
function ui()
|
|
43
|
+
[
|
|
44
|
+
row(class = "q-pa-md items-center q-gutter-md", [
|
|
45
|
+
select(:region, options = :regions, label = "Region", outlined = true),
|
|
46
|
+
btn("Refresh", color = "primary", @click("run_trigger = !run_trigger"), loading = :loading),
|
|
47
|
+
]),
|
|
48
|
+
p("{{error_msg}}", class = "text-negative q-px-md", @if("error_msg != ''")),
|
|
49
|
+
p("No orders match this region.", class = "q-px-md", @if("!loading && error_msg == '' && rows.data.length === 0")),
|
|
50
|
+
table(:rows, flat = true, bordered = true),
|
|
51
|
+
]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
@page("/", ui)
|
|
55
|
+
end
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Layout, typography, motion, and accessibility
|
|
59
|
+
|
|
60
|
+
Compose responsive views with Quasar flex/grid helpers (`row`, `cell`, `col-12 col-md-6`) instead of fixed pixel widths. Load custom fonts via `public/css/` with fallbacks and `tabular-nums` on numeric cells. Bind `loading = :loading` truthfully to server computation and honor `prefers-reduced-motion` in custom CSS. Because Stipple emits Vue/Quasar DOM, inspect actual browser labels, keyboard reach, focus order, contrast, and text/table alternatives for plots.
|
|
61
|
+
|
|
62
|
+
## States and concurrency idiom
|
|
63
|
+
|
|
64
|
+
- Keep mutable per-user state inside `@app` reactive models (instantiated per session); never mutate module-global `DataFrame`s shared across sessions.
|
|
65
|
+
- Keep database handles, tokens, and large intermediate matrices in `@private` fields so they never serialize over WebSocket.
|
|
66
|
+
- Offload long scientific/optimization runs with `Threads.@spawn` / async channels so WebSocket heartbeats remain responsive, and surface timeout/error branches cleanly.
|
|
67
|
+
|
|
68
|
+
## Do/don't pairs
|
|
69
|
+
|
|
70
|
+
| Do | Don't |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `@in` for user inputs, `@out` for read-only outputs, `@private` for server objects | Exposing server handles or large raw arrays as `@in`/`@out` |
|
|
73
|
+
| Explicit `loading`, `error_msg`, and empty-table UI branches | Leaving an empty table or stuck spinner when a query throws |
|
|
74
|
+
| Per-session `@app` state with `try/catch/finally` | Mutating module-level globals across concurrent sessions |
|
|
75
|
+
| Semantic CSS vars in `public/css/` synced with Plotly/Makie themes | Brittle overrides of generated Quasar internals |
|
|
76
|
+
|
|
77
|
+
## Known traps
|
|
78
|
+
|
|
79
|
+
Serializing huge DataFrames or secrets via `@out` instead of `@private`, blocking Genie worker threads on unspawned scientific compute, Julia first-plot/TTFX cold latency without precompilation/PackageCompiler, plot/dark-mode theme mismatch, and mutating shared module globals.
|
|
80
|
+
|
|
81
|
+
## Verification commands
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
julia --project -e 'using Pkg; Pkg.test()'
|
|
85
|
+
julia --project app.jl
|
|
86
|
+
npx playwright test
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`Pkg.test()` validates Julia data and handler logic (`static`/unit evidence); browser/Playwright inspection across narrow viewports, concurrent sessions, error paths, and reconnects provides `rendered` evidence.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Jupyter widgets, AnyWidget, and Voilá
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
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
|
+
```
|
|
49
|
+
|
|
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.
|
|
51
|
+
|
|
52
|
+
## Voilá standalone serving
|
|
53
|
+
|
|
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:
|
|
55
|
+
|
|
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.
|
|
59
|
+
|
|
60
|
+
## Layout, motion, and accessibility
|
|
61
|
+
|
|
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.
|
|
63
|
+
|
|
64
|
+
## States and forms idiom
|
|
65
|
+
|
|
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.
|
|
67
|
+
|
|
68
|
+
## Do/don't pairs
|
|
69
|
+
|
|
70
|
+
| Do | Don't |
|
|
71
|
+
|---|---|
|
|
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 |
|
|
77
|
+
|
|
78
|
+
## Known traps
|
|
79
|
+
|
|
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.
|
|
81
|
+
|
|
82
|
+
## Verification commands
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
python -m compileall .
|
|
86
|
+
python -m pytest
|
|
87
|
+
jupyter lab
|
|
88
|
+
voila dashboard.ipynb --no-browser --strip_sources=True
|
|
89
|
+
```
|
|
90
|
+
|
|
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.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# NiceGUI
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
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:
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from nicegui import app, ui
|
|
9
|
+
|
|
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
|
+
```
|
|
13
|
+
|
|
14
|
+
## Page isolation, storage scopes, refreshables, and async offloading
|
|
15
|
+
|
|
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.
|
|
17
|
+
|
|
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 |
|
|
24
|
+
|
|
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
|
+
```
|
|
72
|
+
|
|
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.
|
|
75
|
+
|
|
76
|
+
## Layout, typography, motion, and accessibility
|
|
77
|
+
|
|
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.
|
|
79
|
+
|
|
80
|
+
## Do/don't pairs
|
|
81
|
+
|
|
82
|
+
| Do | Don't |
|
|
83
|
+
|---|---|
|
|
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` |
|
|
89
|
+
|
|
90
|
+
## Known traps
|
|
91
|
+
|
|
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)`.
|
|
93
|
+
|
|
94
|
+
## Verification commands
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
python -m compileall .
|
|
98
|
+
python -m pytest
|
|
99
|
+
python main.py
|
|
100
|
+
```
|
|
101
|
+
|
|
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).
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Observable Framework
|
|
2
|
+
|
|
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
|
+
```
|
|
19
|
+
|
|
20
|
+
```css
|
|
21
|
+
/* src/custom-tokens.css */
|
|
22
|
+
:root {
|
|
23
|
+
--pc-action: oklch(55% 0.15 250);
|
|
24
|
+
--pc-surface-raised: oklch(98% 0.01 250);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
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.
|
|
31
|
+
|
|
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
|
+
```
|
|
41
|
+
|
|
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
|
+
```
|
|
51
|
+
|
|
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
|
+
````
|
|
66
|
+
|
|
67
|
+
## Layout, typography, motion, and accessibility
|
|
68
|
+
|
|
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:
|
|
70
|
+
|
|
71
|
+
```css
|
|
72
|
+
@media (prefers-reduced-motion: reduce) {
|
|
73
|
+
*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
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.
|
|
78
|
+
|
|
79
|
+
## States and forms idiom
|
|
80
|
+
|
|
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.
|
|
82
|
+
|
|
83
|
+
## Do/don't pairs
|
|
84
|
+
|
|
85
|
+
| Do | Don't |
|
|
86
|
+
|---|---|
|
|
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 |
|
|
92
|
+
|
|
93
|
+
## Known traps
|
|
94
|
+
|
|
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.
|
|
96
|
+
|
|
97
|
+
## Verification commands
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
ls observablehq.config.*
|
|
101
|
+
npm run build
|
|
102
|
+
npm run dev
|
|
103
|
+
```
|
|
104
|
+
|
|
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.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Panel / HoloViz
|
|
2
|
+
|
|
3
|
+
## Token mapping and component layer
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
```python
|
|
8
|
+
import panel as pn
|
|
9
|
+
import panel_material_ui as pmui
|
|
10
|
+
|
|
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)
|
|
31
|
+
|
|
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")
|
|
36
|
+
|
|
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
|
|
42
|
+
|
|
43
|
+
chat = pn.chat.ChatInterface(callback=respond, sizing_mode="stretch_both")
|
|
44
|
+
|
|
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
|
|
57
|
+
|
|
58
|
+
For serverless public demos or documentation embeds, compile Panel apps to client-side Pyodide with:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
panel convert app.py --to pyodide-worker --out dist
|
|
62
|
+
```
|
|
63
|
+
|
|
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.
|
|
67
|
+
|
|
68
|
+
## Layout, motion, and accessibility
|
|
69
|
+
|
|
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.
|
|
71
|
+
|
|
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.
|
|
75
|
+
|
|
76
|
+
## Do/don't pairs
|
|
77
|
+
|
|
78
|
+
| Do | Don't |
|
|
79
|
+
|---|---|
|
|
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 |
|
|
85
|
+
|
|
86
|
+
## Known traps
|
|
87
|
+
|
|
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`.
|
|
89
|
+
|
|
90
|
+
## Verification commands
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
python -m compileall .
|
|
94
|
+
python -m pytest
|
|
95
|
+
panel serve app.py --autoreload
|
|
96
|
+
panel convert app.py --to pyodide-worker --out dist
|
|
97
|
+
```
|
|
98
|
+
|
|
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.
|