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