@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
|
@@ -2,56 +2,175 @@
|
|
|
2
2
|
|
|
3
3
|
Library defaults are starting points, not design decisions. Verify current documentation for the exact version in the repository; APIs and accessibility support evolve.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Web and cross-platform charting libraries
|
|
6
|
+
|
|
7
|
+
| Library / ecosystem | Best use | Rendering / model | Practical notes |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| **D3.js (v7+)** | Custom, unconventional, tightly controlled browser visualization | ESM-only modular packages (`d3-scale`, `d3-shape`, `d3-array`) | Prefer **"D3 for math, framework for DOM"** in React/Svelte/Vue/Solid instead of mixing `d3.select()` DOM mutations with framework reconciliation. Own axes, transitions, keyboard focus, and text alternatives. |
|
|
10
|
+
| **Observable Plot** | Concise exploratory and production statistical graphics | Declarative marks over D3 scales (SVG) | Supports `ariaLabel`/`ariaDescription` and facets. Pair with `resize()` or ResizeObserver plus an explicit summary/table. |
|
|
11
|
+
| **Vega (standalone)** | Custom interactive visualization grammars beyond Vega-Lite | Full JSON dataflow grammar (SVG / Canvas) | Supports force, Voronoi, tree, and streaming signals/transforms that Vega-Lite omits. Keep dataflow specs validated and provide external keyboard/table access. |
|
|
12
|
+
| **Vega-Lite** | Portable declarative statistical chart specs | JSON grammar compiled to Vega (SVG / Canvas) | Excellent for cross-language reproducibility. Set explicit domains, titles, descriptions, and external focus/table equivalents. |
|
|
13
|
+
| **Apache ECharts** | Feature-complete product dashboards and large series | Canvas default; SVG renderer available | Enable `aria: { enabled: true, decal: { show: true } }` for descriptions and colorblind-safe patterns, then inspect actual DOM/Canvas output and external keyboard access. |
|
|
14
|
+
| **Chart.js** | Lightweight standard web charts (bar, line, radar, scatter) | Canvas 2D with tree-shakeable controllers/scales | Fast and small bundle, but Canvas content is opaque to screen readers—add explicit summary/table fallbacks and configure `responsive: true` inside a sized wrapper. |
|
|
15
|
+
| **Highcharts** | Enterprise/editorial charts requiring strong built-in accessibility | SVG + WebGL `boost` module | Commercial license for for-profit use. Its **`accessibility`** module (roving keyboard focus, screen-reader series descriptions, auto data tables, pattern fills) and **`sonification`** module are industry benchmarks. |
|
|
16
|
+
| **Recharts** | Conventional React charts | Declarative React SVG components | `ResponsiveContainer` requires an explicit parent height/width. Label collisions, tooltips, and keyboard accessibility require explicit implementation. |
|
|
17
|
+
| **Nivo** | Rich themed React charts (heatmaps, Sankey, Bump, Calendar) | React SVG / Canvas / HTML over D3 | Great aesthetic variety out of the box, but watch bundle size, responsive margin clipping, and missing keyboard navigation on Canvas variants. |
|
|
18
|
+
| **Tremor** | Rapid Tailwind/React operational KPIs and SaaS charts | React primitives over Recharts / Radix | Speeds up standard product analytics, but override default card/palette templates so dashboards do not collapse into generic SaaS slop. |
|
|
19
|
+
| **visx** | Custom React visualization primitives | Low-level SVG primitives, scales, shapes | D3-level control in idiomatic React without DOM conflicts. You own labels, responsive measurement, transitions, and ARIA semantics. |
|
|
20
|
+
| **uPlot** | High-frequency observability, metrics, and telemetry time series | Ultra-fast Canvas 2D (~50 KB) | Renders 100k+ points at 60 fps with minimal memory. Requires explicit container resize wiring, legend formatting, and external text/table access. |
|
|
21
|
+
| **TradingView Lightweight Charts** | Financial OHLC/candlestick, volume, and live price streams | Canvas 2D (Apache-2.0 with attribution) | Built for crosshair sync, time-scale zoom, and streaming ticks. Not for general categorical charts; pair with accessible price summary readouts. |
|
|
22
|
+
| **AntV (`G2 v5`, `G6 v5`, `X6`, `L7`)** | Unified grammar-of-graphics (`G2`), graphs (`G6`), editors (`X6`), geo (`L7`) | Canvas / SVG / WebGL | Strong enterprise coverage across charts, networks, and maps. Verify English/localized docs, bundle splitting, and accessibility wrappers. |
|
|
23
|
+
| **Plotly.js** | Scientific/engineering charts, 3D, WebGL scatter/heatmaps | Mixed SVG + WebGL (`scattergl`, `heatmapgl`) | Heavy full bundle—use partial bundles (`plotly.js-basic-dist-min`) when possible. Modebar and WebGL canvases require external keyboard and tabular access. |
|
|
24
|
+
|
|
25
|
+
## Python, R, Julia, native, and WASM-scale ecosystems
|
|
26
|
+
|
|
27
|
+
| Library / ecosystem | Best use | Rendering / model | Practical notes |
|
|
6
28
|
|---|---|---|---|
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
| **matplotlib** | Publication and static scientific graphics in Python | Raster / vector (`SVG`, `PDF`, `PNG`) | Set explicit `figsize`, DPI, `layout="constrained"`, units, and colorblind-safe colormaps. Static images always need alt text and underlying data access. |
|
|
30
|
+
| **Seaborn (`seaborn.objects`)** | Declarative statistical graphics in Python | Layered grammar (`so.Plot`) or statistical wrappers over matplotlib | Prefer `seaborn.objects` for composable multi-layer plots with explicit scales and themes instead of ad hoc axes mutation. |
|
|
31
|
+
| **Altair** | Declarative Python statistical visualization | Emits Vega-Lite JSON | Use vegafusion or URL/Parquet data transformers for large datasets instead of embedding 50 MB JSON inline in HTML/notebooks. |
|
|
32
|
+
| **Bokeh** | Interactive Python browser plots with linked brushing | Canvas / WebGL via `ColumnDataSource` + `CustomJS` | Powers Panel and standalone HTML exports; pair with external data summaries and keep light/dark themes synced with host pages. |
|
|
33
|
+
| **HoloViews / hvPlot / Datashader** | Declarative Python plots + million-to-billion-point rasterization | Multi-backend (Bokeh, Matplotlib, Plotly) + CPU/GPU Datashader rasterizer | Use **Datashader** (`rasterize=True` / `datashade=True`) whenever scatter or trajectory density causes overplotting or browser crashes; publish aggregation method and colorbar units. |
|
|
34
|
+
| **ggplot2 (R)** | Layered grammar of graphics and statistical figures | Static vector/grid graphics (`thematic` for Shiny) | Direct annotations and facets outperform detached legends. Interactive `girafe`/`plotly` conversions require separate focus and keyboard verification. |
|
|
35
|
+
| **Makie (Julia)** | High-performance scientific and publication visualization | `CairoMakie` (vector/static), `GLMakie` (GPU), `WGLMakie` (WebGL) | Pick backend by output: `CairoMakie` for PDF/SVG papers, `GLMakie`/`WGLMakie` for interactive exploration. Set explicit limits and colorbars. |
|
|
36
|
+
| **Swift Charts** | Native Apple-platform charts (iOS, macOS, watchOS, visionOS) | Declarative SwiftUI marks | Generates VoiceOver elements automatically; refine with `.accessibilityLabel` / `.accessibilityValue`, Dynamic Type, and chart scrolling. |
|
|
37
|
+
| **Vico (Compose)** | Jetpack Compose Android/KMP cartesian charts | Compose-native canvas/model | Add explicit `contentDescription` / semantics and an adjacent tabular readout; verify with TalkBack. |
|
|
38
|
+
| **FINOS Perspective** | Real-time streaming pivot tables and analytical charts | C++/Rust WebAssembly engine + virtualized grid & D3FC/canvas | Handles high-frequency streaming updates (financial blotters, logs) directly in browser workers; pair with keyboard-accessible view presets and CSV export. |
|
|
39
|
+
| **UW IDL Mosaic / DuckDB-Wasm** | Multi-million-row interactive cross-filtering in the browser or server | `vgplot` / `MosaicClient` SQL coordinator + materialized pre-aggregates | Eliminates browser lag on millions of rows by pushing brush/filter selections into DuckDB pre-aggregated data cubes. Verify Parquet/WASM load progress and empty-brush states. |
|
|
40
|
+
|
|
41
|
+
## D3 v7 modular idiom ("D3 for math, framework for DOM")
|
|
42
|
+
|
|
43
|
+
Import only the ESM submodules needed (`d3-scale`, `d3-array`, `d3-shape`) and let the host UI framework (React, Svelte, Vue, Solid, Lit) own DOM reconciliation, reactive updates, and ARIA attributes:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { scaleLinear, scaleBand } from 'd3-scale';
|
|
47
|
+
import { max } from 'd3-array';
|
|
48
|
+
|
|
49
|
+
// Pure layout computation reusable in React, Svelte, Vue, or server SVG rendering:
|
|
50
|
+
export function computeBarLayout(
|
|
51
|
+
data: { label: string; value: number }[],
|
|
52
|
+
width: number,
|
|
53
|
+
height: number,
|
|
54
|
+
) {
|
|
55
|
+
const x = scaleBand(data.map((d) => d.label), [48, width - 16]).padding(0.2);
|
|
56
|
+
const y = scaleLinear([0, max(data, (d) => d.value) ?? 0], [height - 28, 16]).nice();
|
|
57
|
+
return data.map((d) => ({
|
|
58
|
+
...d,
|
|
59
|
+
x: x(d.label) ?? 0,
|
|
60
|
+
y: y(d.value),
|
|
61
|
+
w: x.bandwidth(),
|
|
62
|
+
h: y(0) - y(d.value),
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Apache ECharts, Observable Plot, & Vega-Lite idioms
|
|
68
|
+
|
|
69
|
+
### Apache ECharts (`echarts/core` tree-shaking + `ResizeObserver` + `aria.decal`)
|
|
70
|
+
|
|
71
|
+
Never import the full `echarts` barrel (~1 MB+) in app bundles. Register only used charts/components from `echarts/core`, enable `aria: { enabled: true, decal: { show: true } }` for descriptions and colorblind-safe patterns, observe container resizes, and **always call `chart.dispose()` on unmount**:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import * as echarts from 'echarts/core';
|
|
75
|
+
import { BarChart } from 'echarts/charts';
|
|
76
|
+
import { AriaComponent, GridComponent, TooltipComponent } from 'echarts/components';
|
|
77
|
+
import { CanvasRenderer } from 'echarts/renderers';
|
|
78
|
+
|
|
79
|
+
echarts.use([BarChart, AriaComponent, GridComponent, TooltipComponent, CanvasRenderer]);
|
|
80
|
+
|
|
81
|
+
export function mountRevenueChart(el: HTMLElement, labels: string[], values: number[]) {
|
|
82
|
+
const chart = echarts.init(el);
|
|
83
|
+
chart.setOption({
|
|
84
|
+
aria: { enabled: true, decal: { show: true } },
|
|
85
|
+
tooltip: { trigger: 'axis' },
|
|
86
|
+
xAxis: { type: 'category', data: labels },
|
|
87
|
+
yAxis: { type: 'value' },
|
|
88
|
+
series: [{ name: 'Revenue (EUR)', type: 'bar', data: values }],
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const ro = new ResizeObserver(() => chart.resize());
|
|
92
|
+
ro.observe(el);
|
|
93
|
+
return () => {
|
|
94
|
+
ro.disconnect();
|
|
95
|
+
chart.dispose();
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Observable Plot (declarative marks, facets, `ariaLabel`, & resize)
|
|
101
|
+
|
|
102
|
+
Set `ariaLabel` / `ariaDescription` directly on `Plot.plot(...)`, use `fx`/`fy` facets for small multiples instead of spaghetti overlays, measure container width with `ResizeObserver` (or Observable Framework's `resize()`), and remove previous SVG elements before re-appending:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import * as Plot from '@observablehq/plot';
|
|
106
|
+
|
|
107
|
+
export function mountFacetPlot(el: HTMLElement, rows: { region: string; month: string; latencyMs: number }[]) {
|
|
108
|
+
const render = () => {
|
|
109
|
+
const chart = Plot.plot({
|
|
110
|
+
width: Math.max(320, el.clientWidth),
|
|
111
|
+
height: 260,
|
|
112
|
+
ariaLabel: 'Median latency by month faceted by region',
|
|
113
|
+
fx: { label: null },
|
|
114
|
+
y: { label: 'Latency (ms)', grid: true },
|
|
115
|
+
marks: [Plot.lineY(rows, { x: 'month', y: 'latencyMs', fx: 'region', tip: true }), Plot.ruleY([0])],
|
|
116
|
+
});
|
|
117
|
+
el.replaceChildren(chart);
|
|
118
|
+
};
|
|
119
|
+
render();
|
|
120
|
+
const ro = new ResizeObserver(render);
|
|
121
|
+
ro.observe(el);
|
|
122
|
+
return () => {
|
|
123
|
+
ro.disconnect();
|
|
124
|
+
el.replaceChildren();
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Vega-Lite (`vega-embed`, `"width": "container"`, signals, & fallback)
|
|
130
|
+
|
|
131
|
+
- Set `"width": "container"` inside single-view specs backed by a sized parent container; **trap**: Vega-Lite's `"width": "container"` does **not** apply to faceted/concatenated multi-view specs—compute explicit child widths on resize instead.
|
|
132
|
+
- Use `params` (interactive signals/selections) for brushing/filtering, call `result.finalize()` on unmount to clean up listeners/Canvas contexts, and pair with a collapsible summary table + keyboard filter controls because Vega canvases are not keyboard-navigable by default.
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import embed from 'vega-embed';
|
|
136
|
+
|
|
137
|
+
const res = await embed(el, {
|
|
138
|
+
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
|
|
139
|
+
description: 'Monthly error rate with interactive threshold slider',
|
|
140
|
+
width: 'container',
|
|
141
|
+
height: 240,
|
|
142
|
+
params: [{ name: 'maxErr', value: 5, bind: { input: 'range', min: 1, max: 10, step: 0.5, name: 'Threshold % ' } }],
|
|
143
|
+
data: { values: rows },
|
|
144
|
+
mark: 'bar',
|
|
145
|
+
encoding: {
|
|
146
|
+
x: { field: 'month', type: 'ordinal' },
|
|
147
|
+
y: { field: 'errorPct', type: 'quantitative', title: 'Error rate (%)' },
|
|
148
|
+
color: { condition: { test: 'datum.errorPct > maxErr', value: '#c92a2a' }, value: '#1971c2' },
|
|
149
|
+
},
|
|
150
|
+
}, { actions: { export: true, source: false, editor: false } });
|
|
151
|
+
// On unmount: res.finalize();
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## BI & observability plugin UI
|
|
155
|
+
|
|
156
|
+
- **Grafana Plugin UI (`@grafana/ui`, `@grafana/data`, & Grafana Scenes)**: read live host light/dark/high-contrast tokens through **`useTheme2()`** (`theme.colors.background.primary`, `theme.colors.text.primary`, `theme.spacing(2)`)—never hardcode colors that break when users toggle Grafana themes. Compose native panel/app UIs with `@grafana/ui` (`PanelChrome`, `Table`, `TimeSeries`) and build multi-panel dynamic observability apps using **Grafana Scenes** (`EmbeddedScene`, `SceneFlexLayout`, `SceneQueryRunner`, `SceneVariableSet`) so time ranges, template variables, query cancellation, and error/no-data states stay synchronized with Grafana.
|
|
157
|
+
- **Apache Superset & Metabase embedding boundaries**:
|
|
158
|
+
- Use official SDKs (**`@superset-ui/embedded-sdk`** with short-lived server-issued guest tokens, or **Metabase Embedding SDK** `@metabase/embedding-sdk-react` / signed JWT embeds) instead of fragile session-cookie `<iframe>` hacks.
|
|
159
|
+
- Enforce server-side **row-level security (RLS)** predicates inside the guest/JWT token so tenants can never tamper with client filter URLs; lock CSP `frame-ancestors`, handle token refresh/expiry cleanly, align theme tokens where supported, and never expose unauthenticated BI admin chrome inside customer products.
|
|
20
160
|
|
|
21
161
|
## Cross-ecosystem implementation rules
|
|
22
162
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- Preserve raw precision internally; round only at presentation.
|
|
29
|
-
|
|
30
|
-
### Themes and tokens
|
|
31
|
-
|
|
32
|
-
Map semantic tokens explicitly: surface, text, muted grid, categorical series, positive/negative, warning, selection, focus, missing data. Do not hardcode demo blues/purples into every chart. Dark-mode charts need rebalanced luminance and grid contrast rather than simple inversion.
|
|
33
|
-
|
|
34
|
-
### Resize/reflow
|
|
35
|
-
|
|
36
|
-
Measure container size, text length, orientation, density, and input modality. Rotate/collapse labels only when readable; otherwise use horizontal bars, fewer ticks, wrapping, small multiples, or interactive detail. Never solve narrow screens by shrinking font below readability.
|
|
37
|
-
|
|
38
|
-
### Export/print/static fallback
|
|
39
|
-
|
|
40
|
-
Define PNG/SVG/PDF/CSV export expectations. Canvas/WebGL output can become blank when print/export serialization is ignored; test it. Static exports need title, axis, direct labels/legend, source/freshness, and colorblind-safe encoding because hover is unavailable.
|
|
41
|
-
|
|
42
|
-
### Notebook/data-app embedding
|
|
43
|
-
|
|
44
|
-
Notebook rendering is not product accessibility. Streamlit/Gradio/Dash/Panel/Jupyter surfaces may isolate or serialize chart objects differently; verify keyboard focus, theme propagation, cache/update behavior, and whether figure data is duplicated into the page payload.
|
|
45
|
-
|
|
46
|
-
### Native mobile embedding
|
|
47
|
-
|
|
48
|
-
Respect platform text scaling, dynamic type, hit targets, haptics/feedback rules, dark mode, localization, and reduced motion. Do not embed a web chart merely because it exists when native accessibility/performance matters; conversely, document the bridge/accessibility cost when a webview is intentional.
|
|
163
|
+
- **Data contract**: Keep parsing, unit conversion, timezone normalization, null policy, and aggregation outside chart render components. Never let missing fields silently coerce to zero.
|
|
164
|
+
- **Themes and tokens**: Map semantic tokens explicitly (`surface`, `text`, `grid`, `categorical`, `positive/negative`, `missing`). Dark mode requires luminance rebalancing, not blind inversion.
|
|
165
|
+
- **Resize and reflow**: Measure containers with `ResizeObserver` (or native layout bounds). On narrow screens, switch to horizontal bars, fewer ticks, or small multiples rather than shrinking labels below readability.
|
|
166
|
+
- **Export and print**: Test PNG/SVG/PDF/CSV export—WebGL canvases can serialize blank unless `preserveDrawingBuffer` or vector export is handled. Static exports require titles, units, direct labels, and freshness timestamps.
|
|
167
|
+
- **Notebook and native embedding**: Notebook rendering is not product accessibility. Native apps should prefer Swift Charts/Vico over WebViews unless cross-platform sharing justifies the bridge and accessibility cost.
|
|
49
168
|
|
|
50
169
|
## Selection guidance
|
|
51
170
|
|
|
52
|
-
- Choose **D3/visx** for bespoke interactive
|
|
53
|
-
- Choose **Plot/Vega-Lite/Altair/ggplot2** for
|
|
54
|
-
- Choose **ECharts/Recharts/
|
|
55
|
-
- Choose **
|
|
56
|
-
- Choose **
|
|
57
|
-
- Choose
|
|
171
|
+
- Choose **D3 v7 (modular) / visx / standalone Vega** for bespoke interactive encodings when the team can own accessibility and layout.
|
|
172
|
+
- Choose **Observable Plot / Vega-Lite / Altair / Seaborn (`seaborn.objects`) / ggplot2** for reproducible statistical grammar.
|
|
173
|
+
- Choose **Highcharts / ECharts (`echarts/core`) / Chart.js / Recharts / Nivo / Tremor** for standard product dashboards (prefer Highcharts when turnkey chart accessibility and sonification are priorities and licensing fits).
|
|
174
|
+
- Choose **uPlot / TradingView Lightweight Charts** for high-frequency telemetry or financial time series, and **Grafana Scenes / `@grafana/ui`** for observability plugins inside Grafana.
|
|
175
|
+
- Choose **Datashader / FINOS Perspective / UW IDL Mosaic (DuckDB-Wasm)** when raw point counts or streaming rates exceed ordinary DOM/Canvas limits.
|
|
176
|
+
- Choose **matplotlib / CairoMakie** for print/publication vector precision, and **Swift Charts / Vico** for native mobile craft.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Maps and geospatial UI
|
|
2
|
+
|
|
3
|
+
Choose a mapping engine only when spatial location is essential—tables, ranked lists, or tile-grid cartograms often communicate regional comparisons better. When a map is justified, pick the engine by **tile format (vector vs raster), coordinate system (Web Mercator vs custom GIS CRS vs 3D WGS84 globe), feature count, and licensing**.
|
|
4
|
+
|
|
5
|
+
## Geospatial engine decision matrix
|
|
6
|
+
|
|
7
|
+
| Engine | Rendering | Best fit | Licensing / cost | Primary trade-off |
|
|
8
|
+
|---|---|---|---|---|
|
|
9
|
+
| **MapLibre GL JS (v5+)** | WebGL2 vector tiles + native globe projection | Open-source 2D/3D vector maps, custom basemap styles, self-hosted PMTiles/Protomaps | BSD-3 (bring your own tiles/styles) | Requires tile/style hosting or PMTiles setup |
|
|
10
|
+
| **Mapbox GL JS** | WebGL vector tiles + 3D terrain/globe | Commercial turnkey maps, geocoding, directions, Studio styling | Proprietary / metered map loads | Vendor lock-in and per-load billing |
|
|
11
|
+
| **Leaflet** | DOM/SVG or Canvas (`preferCanvas: true`) raster tiles | Lightweight store locators, simple markers/choropleths (< 5k features) | BSD-2 (open source) | Raster tiles blur on fractional zoom/rotation; DOM markers lag past ~1k points |
|
|
12
|
+
| **OpenLayers** | Canvas 2D / WebGL | Specialized GIS: custom projections (`proj4`), OGC WMS/WFS/WMTS/WCS, cadastral editing | BSD-2 (open source) | Steeper API surface for simple consumer maps |
|
|
13
|
+
| **deck.gl (v9+)** | WebGL2 / WebGPU GPU layers | 100k–10M+ points, trips, arcs, hexbin/heatmap aggregations overlaid on a basemap | MIT (open source) | Needs a basemap provider for geographic context |
|
|
14
|
+
| **kepler.gl** | Turnkey geospatial analytics workbench over deck.gl | Exploratory data-science map apps with built-in filters and time sliders | MIT (open source) | Heavy Redux-coupled app shell; oversized for simple embeds |
|
|
15
|
+
| **CesiumJS** | WebGL 3D WGS84 globe + 3D Tiles | Aerospace, urban digital twins, terrain draping, satellite orbits, photogrammetry | Apache-2.0 (Cesium ion assets metered) | Large bundle (~3–5 MB + workers) and high GPU/battery draw on mobile |
|
|
16
|
+
|
|
17
|
+
## Protomaps / PMTiles self-hosted vector tiles
|
|
18
|
+
|
|
19
|
+
Use **Protomaps / PMTiles** when you need zero-tile-server, cost-predictable vector maps served as a single static `.pmtiles` archive via HTTP Range requests (S3, Cloudflare R2, CDN). Always verify **glyph** (`.pbf` font stacks) and **sprite** URLs in style JSON—missing glyph endpoints cause every street and city label to vanish silently.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import maplibregl from 'maplibre-gl';
|
|
23
|
+
import { Protocol } from 'pmtiles';
|
|
24
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
25
|
+
|
|
26
|
+
const protocol = new Protocol();
|
|
27
|
+
maplibregl.addProtocol('pmtiles', protocol.tile);
|
|
28
|
+
|
|
29
|
+
const map = new maplibregl.Map({
|
|
30
|
+
container: 'map',
|
|
31
|
+
style: {
|
|
32
|
+
version: 8,
|
|
33
|
+
glyphs: 'https://cdn.example.com/fonts/{fontstack}/{range}.pbf',
|
|
34
|
+
sprite: 'https://cdn.example.com/sprites/v4/light',
|
|
35
|
+
sources: {
|
|
36
|
+
protomaps: {
|
|
37
|
+
type: 'vector',
|
|
38
|
+
url: 'pmtiles://https://cdn.example.com/tiles/region.pmtiles',
|
|
39
|
+
attribution: '© OpenStreetMap contributors',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
layers: [/* basemap fill, road, and symbol layers */],
|
|
43
|
+
},
|
|
44
|
+
center: [-122.4, 37.78],
|
|
45
|
+
zoom: 11,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## MapLibre GL JS + deck.gl interleaved idiom & WebGL2 constraint
|
|
50
|
+
|
|
51
|
+
- Wait for `style.load` / `load` before calling `map.setProjection({ type: 'globe' })`, `map.addSource()`, or `map.addLayer()`, and always call `map.remove()` on unmount to release the WebGL context.
|
|
52
|
+
- **WebGL2 vs WebGPU constraint**: `MapLibreOverlay({ interleaved: true })` shares MapLibre GL JS's **WebGL2** context so deck.gl layers can render *beneath* basemap labels via `beforeId`. Interleaved mode **does not work with WebGPU**—if using deck.gl v9+'s WebGPU backend, run `interleaved: false` (separate overlay canvas) or keep deck.gl on WebGL2 when label interleaving matters.
|
|
53
|
+
- For 100k+ animated or streaming points in deck.gl, pass binary `Float32Array` attribute buffers (`{ length, attributes: { getPosition: { value, size, offset, stride } } }`) instead of allocating JS objects per frame.
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { MapLibreOverlay } from '@deck.gl/maplibre';
|
|
57
|
+
import { ScatterplotLayer } from '@deck.gl/layers';
|
|
58
|
+
|
|
59
|
+
await map.once('load');
|
|
60
|
+
|
|
61
|
+
map.addControl(
|
|
62
|
+
new MapLibreOverlay({
|
|
63
|
+
interleaved: true, // requires sharing MapLibre's WebGL2 context (not WebGPU)
|
|
64
|
+
layers: [
|
|
65
|
+
new ScatterplotLayer({
|
|
66
|
+
id: 'sites',
|
|
67
|
+
data: sites,
|
|
68
|
+
getPosition: (d) => d.coords,
|
|
69
|
+
getFillColor: [15, 76, 129, 180],
|
|
70
|
+
getRadius: 200,
|
|
71
|
+
beforeId: 'places_locality', // keep city labels readable above data
|
|
72
|
+
}),
|
|
73
|
+
],
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Client-side spatial operations (`Turf.js`)
|
|
79
|
+
|
|
80
|
+
Use modular **Turf.js** packages (`@turf/bbox`, `@turf/boolean-point-in-polygon`, `@turf/buffer`, `@turf/distance`) for client-side viewport bounds, polygon filtering, geofence checks, and spatial joins on small-to-medium GeoJSON without round-tripping to PostGIS:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import bbox from '@turf/bbox';
|
|
84
|
+
import booleanPointInPolygon from '@turf/boolean-point-in-polygon';
|
|
85
|
+
|
|
86
|
+
const visibleSites = sitesGeoJson.features.filter((pt) => booleanPointInPolygon(pt, activeRegionPolygon));
|
|
87
|
+
const [minX, minY, maxX, maxY] = bbox({ type: 'FeatureCollection', features: visibleSites });
|
|
88
|
+
map.fitBounds([[minX, minY], [maxX, maxY]], { padding: 32 });
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Import individual `@turf/*` modules instead of the full `@turf/turf` umbrella package to avoid bloating bundles. For >50k complex polygons, offload spatial indexing to PostGIS, DuckDB Spatial, or a Web Worker.
|
|
92
|
+
|
|
93
|
+
## Leaflet & Mapbox GL JS idioms and traps
|
|
94
|
+
|
|
95
|
+
### Leaflet (`preferCanvas: true`, clustering, & StrictMode cleanup)
|
|
96
|
+
|
|
97
|
+
- **Vector & marker scale**: pass **`preferCanvas: true`** to `L.map(...)` whenever rendering hundreds of `L.circleMarker` / GeoJSON polygons so Leaflet renders on Canvas 2D instead of saturating the DOM with thousands of SVG nodes; use **`leaflet.markercluster`** (or `supercluster`) once pin counts exceed ~200 so overlapping pins remain tappable and readable.
|
|
98
|
+
- **Lifecycle & accessibility**: ensure the map container has an explicit CSS height (zero height renders a blank tile grid), call **`map.remove()`** on unmount (prevents React StrictMode `Map container is already initialized` crashes), provide explicit keyboard pan/zoom controls, and pair markers with a synchronized searchable/sortable location list so keyboard and screen-reader users can inspect every site.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import L from 'leaflet';
|
|
102
|
+
import 'leaflet/dist/leaflet.css';
|
|
103
|
+
|
|
104
|
+
export function mountLeafletMap(el: HTMLElement, sites: { name: string; lat: number; lng: number }[]) {
|
|
105
|
+
const map = L.map(el, { preferCanvas: true }).setView([37.78, -122.4], 11);
|
|
106
|
+
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
107
|
+
attribution: '© OpenStreetMap contributors',
|
|
108
|
+
maxZoom: 19,
|
|
109
|
+
}).addTo(map);
|
|
110
|
+
|
|
111
|
+
for (const site of sites) {
|
|
112
|
+
L.circleMarker([site.lat, site.lng], { radius: 6, color: '#0f4c81' })
|
|
113
|
+
.bindPopup(site.name)
|
|
114
|
+
.addTo(map);
|
|
115
|
+
}
|
|
116
|
+
return () => map.remove();
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Mapbox GL JS (scoped public tokens, contrast, & MapLibre parity)
|
|
121
|
+
|
|
122
|
+
- **Scoped public token only**: restrict browser access tokens (`pk.*`) by HTTP referrer / allowed URLs and public read scopes only—**never** bundle secret `sk.*` tokens into frontend code. Call `map.remove()` on unmount to avoid leaking WebGL contexts and triggering redundant metered map loads.
|
|
123
|
+
- **Projection & style contrast**: test data-overlay contrast across both light and dark Studio styles, `globe` vs `mercator` projections, and 3D terrain/fog settings—low-contrast basemap roads or atmospheric fog easily wash out thematic data layers.
|
|
124
|
+
- **MapLibre GL JS parity**: Mapbox GL JS and MapLibre GL JS share Style Spec roots (`addSource`, `addLayer`, expressions), but diverge on Mapbox v3 proprietary features (Standard Style `import` slots, Mapbox-hosted 3D lighting/config APIs, and commercial telemetry/billing). Keep custom data layers in standard GeoJSON/vector Style Spec expressions whenever preserving a future migration path to open-source MapLibre matters.
|
|
125
|
+
|
|
126
|
+
## CesiumJS 3D Tiles & lifecycle
|
|
127
|
+
|
|
128
|
+
Load 3D Tiles asynchronously via `await Cesium.Cesium3DTileset.fromUrl(url, { skipLevelOfDetail: true })` (never deprecated synchronous constructors) and call `viewer.destroy()` on unmount.
|
|
129
|
+
|
|
130
|
+
## Choropleth pitfalls, cartographic truthfulness & accessibility
|
|
131
|
+
|
|
132
|
+
- **Normalization**: Normalize counts by population, households, or area when comparing unequal regions; if mapping raw counts intentionally, label them explicitly as counts and consider proportional symbols instead.
|
|
133
|
+
- **Classification breaks**: Quantile, equal-interval, natural breaks (Jenks), and manual thresholds tell different stories—publish the classification method and break values in the legend.
|
|
134
|
+
- **Area distortion**: Large sparse regions visually overwhelm dense cities in Web Mercator or raw choropleths; use equal-area projections (D3/Observable Plot), globe projection, cartograms, or tile-grid maps when fair regional weight matters.
|
|
135
|
+
- **Missing vs zero data**: Give missing/no-data regions a distinct neutral fill or hatch pattern—never reuse the zero/minimum value color.
|
|
136
|
+
- **Boundaries & attribution**: Territory borders can be politically sensitive; select boundary datasets consciously for the product's legal/user context and display required attributions (OpenStreetMap, tile host, GIS agency) legibly.
|
|
137
|
+
- **Accessible alternative**: WebGL and Canvas maps are opaque to screen readers and hard for keyboard/tremor users—pair every data map with a searchable/sortable location list or ranking table, direct labels for key regions, keyboard pan/zoom controls, and visible focus rings (WCAG 2.1.1 & 2.5.7).
|
|
138
|
+
|
|
139
|
+
## Do/don't pairs
|
|
140
|
+
|
|
141
|
+
| Do | Don't |
|
|
142
|
+
|---|---|
|
|
143
|
+
| Call `map.remove()` / `viewer.destroy()` on unmount | Leak WebGL contexts (browsers cap ~8–16), double-init Leaflet, or inflate metered Mapbox loads |
|
|
144
|
+
| Set `preferCanvas: true` + marker clustering in Leaflet for >200 features | Mount 2,000 DOM/SVG markers in Leaflet without clustering or a list fallback |
|
|
145
|
+
| Restrict Mapbox GL JS `pk.*` tokens by referrer and verify style/projection contrast | Ship unrestricted/secret `sk.*` tokens or assume dark basemap labels stay legible under 3D fog |
|
|
146
|
+
| Keep deck.gl on WebGL2 when using `MapLibreOverlay({ interleaved: true })` | Assume WebGPU deck.gl layers can interleave into MapLibre's WebGL2 context |
|
|
147
|
+
| Self-host PMTiles with explicit `glyphs` and `sprite` URLs | Omit `glyphs` in style JSON and ship a map with missing labels |
|
|
148
|
+
| Give missing choropleth regions a distinct neutral/hatched treatment | Color missing regions identically to `0` |
|
|
149
|
+
| Import modular `@turf/bbox` / `@turf/boolean-point-in-polygon` | Pull the entire `@turf/turf` monolith for one distance check |
|
|
150
|
+
| Pair every interactive map with a keyboard-accessible ranking table/list | Trap critical location metrics inside hover-only pins |
|
|
151
|
+
|
|
152
|
+
## Verification commands
|
|
153
|
+
|
|
154
|
+
```sh
|
|
155
|
+
npm run build
|
|
156
|
+
npx playwright test
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Verify lazy bundle splitting and modular `@turf/*` imports (`static`), and inspect WebGL context cleanup across route transitions, glyph/label rendering, mobile touch pan/zoom (`touch-action`), missing-data styling, and keyboard/table fallback in a browser (`rendered`).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Real-time data, node graphs,
|
|
1
|
+
# Real-time data, node graphs, and rendering scale
|
|
2
2
|
|
|
3
3
|
## Real-time and streaming data
|
|
4
4
|
|
|
@@ -6,94 +6,87 @@ Define the temporal semantics before implementation:
|
|
|
6
6
|
|
|
7
7
|
| Question | Required design |
|
|
8
8
|
|---|---|
|
|
9
|
-
| What is
|
|
10
|
-
| Is data append-only or revised? |
|
|
11
|
-
| What cadence matters? |
|
|
12
|
-
| What happens on burst/backlog? |
|
|
13
|
-
| What happens disconnected? |
|
|
14
|
-
| Can users inspect history? |
|
|
9
|
+
| What is "now"? | Show event time versus ingestion/clock time; state timezone and latency. |
|
|
10
|
+
| Is data append-only or revised? | Make corrections/backfills visible rather than silently rewriting history. |
|
|
11
|
+
| What cadence matters? | Update at decision cadence, not raw socket cadence. |
|
|
12
|
+
| What happens on burst/backlog? | Aggregate, sample honestly, drop nonessential frames, or pause; never freeze silently. |
|
|
13
|
+
| What happens disconnected? | Mark last-known data stale with timestamp; preserve user context; reconnect/resume deliberately. |
|
|
14
|
+
| Can users inspect history? | Provide pause, time window, scrub/playback, or snapshot semantics. |
|
|
15
15
|
|
|
16
16
|
Implementation rules:
|
|
17
17
|
|
|
18
|
-
- Batch expensive rendering with `requestAnimationFrame`
|
|
19
|
-
- Bound memory with explicit
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Do not
|
|
23
|
-
- Keep
|
|
24
|
-
|
|
25
|
-
Anti-slop pattern: pulsing green “LIVE” dots, random walking demo data, counters that always increase, and sparklines generated only to fill empty space. These are fabricated evidence.
|
|
18
|
+
- Batch expensive rendering with `requestAnimationFrame` (or platform equivalent); never re-render the full chart on every WebSocket message.
|
|
19
|
+
- Bound memory with explicit ring buffers/sliding windows and document the retention policy.
|
|
20
|
+
- Throttle consumers and pause nonessential rendering when tabs/windows are hidden.
|
|
21
|
+
- Reserve stable numeric widths with `tabular-nums` so streaming counters never jitter layout.
|
|
22
|
+
- Do not flood screen-reader live regions on every tick; summarize consequential state changes at controlled intervals and provide a pause control.
|
|
23
|
+
- Keep badges truthful: "live", "paused", "stale", and "reconnecting" are separate visible states. Avoid pulsing green demo dots and random-walk fake telemetry.
|
|
26
24
|
|
|
27
25
|
## Node graphs and network diagrams
|
|
28
26
|
|
|
29
|
-
First
|
|
30
|
-
|
|
31
|
-
### React Flow (xyflow)
|
|
27
|
+
First clarify the **cross-skill boundary**: analytical topology, dependency, and network visualization (read/explore/cluster/trace) belongs in `pixelcraft-dataviz`. Interactive workflow/node-graph **editors** (automation builders, visual pipelines, canvas undo/redo, node inspector forms) coordinate with `pixelcraft-web` (interaction mechanics) and `pixelcraft-patterns` (creative tools, history/undo).
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
A force-directed hairball is rarely the right default—match the graph engine to node count and task:
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
| Graph engine | Rendering | Sweet spot | Best fit | Practical trade-off |
|
|
32
|
+
|---|---|---|---|---|
|
|
33
|
+
| **`@xyflow/react` v12 / `@xyflow/svelte`** | DOM/HTML nodes + SVG edges | < 1,500 visible nodes | Workflow/pipeline editors, custom rich node UIs, architecture diagrams | Rich DOM nodes slow down past ~1–2k simultaneous elements; pair with ELK/dagre layout |
|
|
34
|
+
| **Cytoscape.js** | Canvas 2D | 500–10k elements | Analytical network exploration, bioinformatics, compound graphs (`cose`, `breadthfirst`, `elk`) | Canvas is opaque to screen readers; requires external list/neighborhood text view |
|
|
35
|
+
| **AntV G6 (v5)** | Canvas 2D / WebGL / SVG | 1k–100k elements | Enterprise lineage, combo/nested graphs, radial/dagre/force layouts | Larger API surface; verify bundle splitting and accessibility wrappers |
|
|
36
|
+
| **Sigma.js (v3 + Graphology)** | WebGL | 10k–100k+ nodes/edges | Large interactive network exploration, citation/knowledge graphs | Custom WebGL shaders needed for non-standard node shapes; external search/table required |
|
|
37
|
+
| **Cosmograph** | WebGL / GPU force simulation | 100k–1M+ nodes/edges | Massive graph exploration and GPU-accelerated force layout | High GPU demand; always provide filtered subgraphs and non-visual summaries |
|
|
42
38
|
|
|
43
|
-
###
|
|
39
|
+
### `@xyflow/react` v12 & `@xyflow/svelte` rules
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
- Migrate legacy `reactflow` imports to `@xyflow/react` v12 (supports `colorMode="system" | "dark" | "light"`, SSR hydration with explicit node dimensions, and computed layout hooks) or `@xyflow/svelte` for Svelte 5 apps.
|
|
42
|
+
- Model controlled state (`nodes`, `edges`, `onNodesChange`, `onEdgesChange`) when selection, persistence, or undo matters.
|
|
43
|
+
- Compute deterministic initial layouts with **ELKjs** or **dagre** before mounting; call `fitView` once on initial load, not on every data mutation.
|
|
44
|
+
- Set `nodesFocusable` and `edgesFocusable`, configure permission-gated editing (`nodesDraggable`, `nodesConnectable`), and verify visible keyboard focus rings inside custom node DOM.
|
|
46
45
|
|
|
47
|
-
###
|
|
46
|
+
### Universal graph UX rules
|
|
48
47
|
|
|
49
|
-
- Label edge direction and meaning;
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
- Supply search/filter and path tracing for large graphs.
|
|
54
|
-
- Design empty/disconnected/cyclic/self-loop/permission-hidden-node states.
|
|
48
|
+
- Label edge direction and meaning; never add decorative arrows.
|
|
49
|
+
- Cluster or collapse dense neighborhoods with visible member counts and expand/collapse controls.
|
|
50
|
+
- Preserve zoom/pan and user-adjusted node positions across data refreshes.
|
|
51
|
+
- Always supply search/jump-to-node, shortest-path or neighbor highlighting, and explicit empty, disconnected, cyclic, and permission-redacted states.
|
|
55
52
|
|
|
56
53
|
## Maps and geospatial UI
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### MapLibre GL JS
|
|
61
|
-
|
|
62
|
-
MapLibre GL JS renders vector tiles using WebGL and style JSON. Verify tile/style/glyph/sprite URLs, attribution, licensing, offline behavior, and network failure. Vector text requires glyph resources; missing glyphs are a common cause of invisible labels. Treat the base map as data with a provider/license, not a decorative background.
|
|
63
|
-
|
|
64
|
-
### deck.gl
|
|
55
|
+
Use a map only when geography itself is the analytical key (otherwise prefer ranked bars, tables, or tile-grid cartograms). For full geospatial engine selection (MapLibre GL JS, Mapbox, Leaflet, OpenLayers, deck.gl WebGL2 interleaving, CesiumJS), self-hosted Protomaps/PMTiles, Turf.js client spatial ops, and choropleth pitfalls (normalization, breaks, missing-data fills, boundaries), read [maps-geospatial.md](maps-geospatial.md).
|
|
65
56
|
|
|
66
|
-
|
|
57
|
+
## Rendering and data-scale tiers
|
|
67
58
|
|
|
68
|
-
|
|
59
|
+
There is no single cutoff—measure on target hardware—but use this architectural ladder:
|
|
69
60
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
61
|
+
1. **SVG / DOM** (dozens to ~2,000 marks): Default when crisp typography, CSS theming, print export, and native accessibility matter most.
|
|
62
|
+
2. **Canvas 2D** (~2k to ~100k marks, or high-frequency time series): Use `uPlot`, `ECharts`, `Chart.js`, or `TradingView Lightweight Charts` with an external semantic summary/table.
|
|
63
|
+
3. **WebGL / GPU** (100k–10M+ points or dense graphs): Use `deck.gl`, `Sigma.js`, `Cosmograph`, `Plotly scattergl`, or `GLMakie` with binary typed arrays (`Float32Array`) and context cleanup on unmount.
|
|
64
|
+
4. **WASM & SQL pre-aggregation** (multi-million-row interactive filtering & streaming pivots):
|
|
65
|
+
- **UW IDL Mosaic + DuckDB-Wasm**: Materializes pre-aggregated data cubes so brushing/cross-filtering millions of rows stays sub-16ms in the browser.
|
|
66
|
+
- **FINOS Perspective**: C++/Rust WASM streaming engine for high-frequency financial blotters, virtualized pivots, and live views.
|
|
67
|
+
- **Datashader (Python)**: Server/GPU rasterization for billion-point distributions without browser overplotting.
|
|
68
|
+
5. **3D only when depth carries information** (terrain, molecular structures, physical digital twins, orbital trajectories)—never to embellish a 2D chart.
|
|
76
69
|
|
|
77
|
-
|
|
70
|
+
Canvas, WebGL, and WASM layers never waive accessibility: retain an offscreen/external semantic data summary, keyboard controls, and CSV/table access.
|
|
78
71
|
|
|
79
|
-
|
|
72
|
+
## Perceptual time-series downsampling (`LTTB` & `Min-Max` envelopes)
|
|
80
73
|
|
|
81
|
-
|
|
82
|
-
2. **Canvas 2D** when many repeating marks are redrawn as raster and semantic structure can live outside the canvas.
|
|
83
|
-
3. **WebGL/GPU** when sustained interactivity with tens/hundreds of thousands of points, images, particles, or GPU aggregation is required.
|
|
84
|
-
4. **3D only when spatial depth itself carries information** (molecular, terrain, volumetric, physical scene). Never use 3D merely to make a 2D chart look advanced.
|
|
74
|
+
Never downsample dense time-series (`10k–1M+` points) onto an `800–1600px` chart using naive `every-Nth` stride slicing (`rows[::step]` or `points.filter((_, i) => i % step === 0)`): stride slicing drops `99%` of samples blind to amplitude, **erasing single-tick P99 latency spikes, voltage transients, and flash crashes**.
|
|
85
75
|
|
|
86
|
-
|
|
76
|
+
| Method | Target budget | Guarantee & best fit |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| **`LTTB` (Largest-Triangle-Three-Buckets)** | `2×`–`4×` chart CSS pixel width (e.g. `1,500–3,000` points for a `1000px` plot) | Selects the actual observed point in each bucket maximizing triangular area with neighbors—preserving local extrema, slopes, and exact hoverable `(t, y)` coordinates without inventing synthetic averages |
|
|
79
|
+
| **Per-pixel `Min-Max` (M4) envelope** | `1` bucket per horizontal pixel (`[first, min, max, last]` or `[min, max]` band) | **Mathematically lossless visual hull**: every spike and drop across millions of rows renders inside the pixel column's vertical stroke; ideal for observability, oscilloscope, and financial tick series |
|
|
80
|
+
| **Zoom-triggered re-query** | Re-run `LTTB` / `Min-Max` on `[t_start, t_end]` in SQL/DuckDB/Polars |Brushing into a 5-minute incident window switches seamlessly from downsampled overview to raw unaggregated events, displaying a badge (`Downsampled · LTTB 2,000 pts` vs `Raw · 840 pts`) |
|
|
87
81
|
|
|
88
82
|
## Performance verification
|
|
89
83
|
|
|
90
|
-
Measure with realistic cardinality and device
|
|
84
|
+
Measure with realistic cardinality (`10k–1M+` points) and device constraints:
|
|
91
85
|
|
|
92
|
-
- initial parse/
|
|
93
|
-
- frame time during pan
|
|
94
|
-
-
|
|
95
|
-
- memory
|
|
96
|
-
- bundle
|
|
97
|
-
- battery/thermal behavior on mobile where relevant.
|
|
86
|
+
- initial parse, `LTTB` / `Min-Max` reduction, WASM/tile fetch, layout, and first-paint time;
|
|
87
|
+
- frame time during pan, zoom re-query, brush, hover, and filter changes;
|
|
88
|
+
- spike-preservation check: inject a single-sample `10×` outlier into a `100k`-point series and verify it remains visible at overview zoom (`rendered`);
|
|
89
|
+
- memory and WebGL context cleanup across route changes and reconnects;
|
|
90
|
+
- bundle, worker, and tile payload size plus mobile thermal/battery behavior.
|
|
98
91
|
|
|
99
|
-
|
|
92
|
+
Label measurements honestly as `rendered` or `not-checked`—a 20-row mock dataset proving 60 fps is not scale evidence.
|