@thanhnguyxn/pixelcraft 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +20 -0
- package/.antigravity-plugin/plugin.json +32 -0
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +22 -0
- package/.codex-plugin/plugin.json +45 -0
- package/.cursor-plugin/marketplace.json +17 -0
- package/.cursor-plugin/plugin.json +27 -0
- package/.devin-plugin/plugin.json +21 -0
- package/.github/plugin/marketplace.json +34 -0
- package/CHANGELOG.md +159 -0
- package/GEMINI.md +1 -0
- package/LICENSE +21 -0
- package/README.md +264 -2
- package/SECURITY.md +28 -0
- package/assets/README.md +28 -0
- package/assets/pixelcraft-logo-128.png +0 -0
- package/assets/pixelcraft-logo-256.png +0 -0
- package/assets/pixelcraft-logo-512.png +0 -0
- package/bin/pixelcraft.mjs +852 -0
- package/docs/ARCHITECTURE.md +105 -0
- package/docs/DESIGN-RATIONALE.md +191 -0
- package/docs/INSTALL.md +221 -0
- package/evals/README.md +37 -0
- package/evals/fixtures/3d-web-engineering.json +69 -0
- package/evals/fixtures/README.md +36 -0
- package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
- package/evals/fixtures/ai-ui-libraries.json +53 -0
- package/evals/fixtures/audio-visual-accessibility.json +69 -0
- package/evals/fixtures/auth-and-checkout-ui.json +53 -0
- package/evals/fixtures/brandkit-identity-governance.json +48 -0
- package/evals/fixtures/build-and-architecture.json +53 -0
- package/evals/fixtures/canvas-and-node-editors.json +53 -0
- package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
- package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
- package/evals/fixtures/component-systems.json +53 -0
- package/evals/fixtures/component-testing.json +53 -0
- package/evals/fixtures/constrained-voice-and-tv.json +43 -0
- package/evals/fixtures/creative-code-rendering.json +69 -0
- package/evals/fixtures/creative-reference-evidence.json +67 -0
- package/evals/fixtures/data-app-python-marimo.json +49 -0
- package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
- package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
- package/evals/fixtures/desktop-native-workspace.json +48 -0
- package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
- package/evals/fixtures/direction-prototype-complexity.json +29 -0
- package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
- package/evals/fixtures/document-rust-typst-invoice.json +49 -0
- package/evals/fixtures/document-typst-and-print-css.json +43 -0
- package/evals/fixtures/email-mjml-dark-mode.json +49 -0
- package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
- package/evals/fixtures/enterprise-data-ui.json +53 -0
- package/evals/fixtures/extended-tui-toolkits.json +53 -0
- package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
- package/evals/fixtures/file-upload-media-ui.json +53 -0
- package/evals/fixtures/finish-gate-anti-slop.json +30 -0
- package/evals/fixtures/forms-accessibility-negative.json +29 -0
- package/evals/fixtures/forms-validation.json +53 -0
- package/evals/fixtures/game-go-ebitengine.json +49 -0
- package/evals/fixtures/game-godot-gdscript.json +49 -0
- package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
- package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
- package/evals/fixtures/i18n-engineering.json +53 -0
- package/evals/fixtures/local-first-sync.json +53 -0
- package/evals/fixtures/lynxjs.json +53 -0
- package/evals/fixtures/maizzle-email.json +53 -0
- package/evals/fixtures/maps-geospatial.json +53 -0
- package/evals/fixtures/media-og-and-video-export.json +43 -0
- package/evals/fixtures/media-players.json +53 -0
- package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
- package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
- package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
- package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
- package/evals/fixtures/mobile-jetpack-compose.json +49 -0
- package/evals/fixtures/mobile-swiftui-ios.json +49 -0
- package/evals/fixtures/motion-engineering.json +69 -0
- package/evals/fixtures/pdfjs-and-pptx.json +53 -0
- package/evals/fixtures/plan-brownfield-evidence.json +28 -0
- package/evals/fixtures/plan-discovery-interview.json +31 -0
- package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
- package/evals/fixtures/reactive-data-apps.json +53 -0
- package/evals/fixtures/review-evidence-audit.json +43 -0
- package/evals/fixtures/rich-text-and-code-editors.json +53 -0
- package/evals/fixtures/scrollytelling-resilience.json +70 -0
- package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
- package/evals/fixtures/state-architecture.json +53 -0
- package/evals/fixtures/styling-ecosystem.json +53 -0
- package/evals/fixtures/token-tooling.json +53 -0
- package/evals/fixtures/tui-go-bubbletea.json +49 -0
- package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
- package/evals/fixtures/tui-rust-ratatui.json +49 -0
- package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
- package/evals/fixtures/visual-qa-task-evidence.json +29 -0
- package/evals/fixtures/web-3d-engines.json +53 -0
- package/evals/fixtures/web-php-laravel-filament.json +49 -0
- package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
- package/evals/fixtures/workflow-checkpoints.json +30 -0
- package/evals/pixelcraft-accessibility.md +74 -0
- package/evals/pixelcraft-brandkit.md +58 -0
- package/evals/pixelcraft-chat-ui.md +55 -0
- package/evals/pixelcraft-constrained.md +55 -0
- package/evals/pixelcraft-craft.md +76 -0
- package/evals/pixelcraft-data-apps.md +55 -0
- package/evals/pixelcraft-dataviz.md +59 -0
- package/evals/pixelcraft-desktop.md +55 -0
- package/evals/pixelcraft-direction.md +77 -0
- package/evals/pixelcraft-document.md +55 -0
- package/evals/pixelcraft-email.md +55 -0
- package/evals/pixelcraft-extensions.md +55 -0
- package/evals/pixelcraft-game-ui.md +59 -0
- package/evals/pixelcraft-handoff.md +57 -0
- package/evals/pixelcraft-media.md +55 -0
- package/evals/pixelcraft-mobile.md +59 -0
- package/evals/pixelcraft-patterns.md +73 -0
- package/evals/pixelcraft-plan.md +127 -0
- package/evals/pixelcraft-review.md +63 -0
- package/evals/pixelcraft-spatial.md +55 -0
- package/evals/pixelcraft-tokens.md +57 -0
- package/evals/pixelcraft-tui.md +55 -0
- package/evals/pixelcraft-ux.md +59 -0
- package/evals/pixelcraft-visual-qa.md +86 -0
- package/evals/pixelcraft-web.md +89 -0
- package/evals/pixelcraft.md +70 -0
- package/gemini-extension.json +6 -0
- package/install.ps1 +341 -0
- package/install.sh +512 -0
- package/package.json +91 -4
- package/plugin.json +29 -0
- package/scripts/build-adapters.mjs +288 -0
- package/scripts/build-release-archives.mjs +61 -0
- package/scripts/build-skill-zips.mjs +94 -0
- package/scripts/run-evals.mjs +397 -0
- package/scripts/sync-docs.mjs +381 -0
- package/scripts/test-build-adapters.mjs +61 -0
- package/scripts/test-cross-platform-qa.mjs +359 -0
- package/scripts/test-distribution.mjs +203 -0
- package/scripts/test-export-tokens.mjs +361 -0
- package/scripts/test-finish-gate.mjs +271 -0
- package/scripts/test-installers.mjs +216 -0
- package/scripts/test-release-archives.mjs +42 -0
- package/scripts/test-shoot.mjs +87 -0
- package/scripts/test-slop-scan.mjs +416 -0
- package/scripts/test-style-inventory.mjs +234 -0
- package/scripts/test-sync-docs.mjs +140 -0
- package/scripts/test-validate-skills.mjs +195 -0
- package/scripts/validate-skills.mjs +658 -0
- package/skills/pixelcraft/SKILL.md +155 -0
- package/skills/pixelcraft/references/design-brief.md +75 -0
- package/skills/pixelcraft/references/floor.md +90 -0
- package/skills/pixelcraft/references/report-template.md +49 -0
- package/skills/pixelcraft/references/stack-detection.md +226 -0
- package/skills/pixelcraft/references/surface-acceptance.md +52 -0
- package/skills/pixelcraft/references/workflow-checkpoints.md +71 -0
- package/skills/pixelcraft-accessibility/SKILL.md +54 -0
- package/skills/pixelcraft-accessibility/references/apg-patterns.md +64 -0
- package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
- package/skills/pixelcraft-accessibility/references/platforms.md +86 -0
- package/skills/pixelcraft-accessibility/references/verification.md +64 -0
- package/skills/pixelcraft-accessibility/references/wcag22-checks.md +99 -0
- package/skills/pixelcraft-brandkit/SKILL.md +127 -0
- package/skills/pixelcraft-brandkit/references/asset-pipeline.md +165 -0
- package/skills/pixelcraft-brandkit/references/brand-governance.md +82 -0
- package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
- package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
- package/skills/pixelcraft-brandkit/references/logo-methods.md +97 -0
- package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
- package/skills/pixelcraft-brandkit/references/prompt-template.md +87 -0
- package/skills/pixelcraft-brandkit/references/qa-checklist.md +93 -0
- package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
- package/skills/pixelcraft-chat-ui/SKILL.md +57 -0
- package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
- package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
- package/skills/pixelcraft-chat-ui/references/conversation-design.md +84 -0
- package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +77 -0
- package/skills/pixelcraft-chat-ui/references/slack-discord.md +80 -0
- package/skills/pixelcraft-constrained/SKILL.md +52 -0
- package/skills/pixelcraft-constrained/references/specialized-hardware.md +90 -0
- package/skills/pixelcraft-constrained/references/tv-wearables.md +134 -0
- package/skills/pixelcraft-constrained/references/voice-ui.md +104 -0
- package/skills/pixelcraft-craft/SKILL.md +58 -0
- package/skills/pixelcraft-craft/references/color.md +125 -0
- package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
- package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
- package/skills/pixelcraft-craft/references/layout.md +73 -0
- package/skills/pixelcraft-craft/references/motion.md +163 -0
- package/skills/pixelcraft-craft/references/typography.md +110 -0
- package/skills/pixelcraft-data-apps/SKILL.md +86 -0
- package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
- package/skills/pixelcraft-data-apps/references/dash.md +109 -0
- package/skills/pixelcraft-data-apps/references/evidence.md +90 -0
- package/skills/pixelcraft-data-apps/references/gradio.md +103 -0
- package/skills/pixelcraft-data-apps/references/julia-genie.md +89 -0
- package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +91 -0
- package/skills/pixelcraft-data-apps/references/nicegui.md +102 -0
- package/skills/pixelcraft-data-apps/references/observable-framework.md +105 -0
- package/skills/pixelcraft-data-apps/references/panel.md +99 -0
- package/skills/pixelcraft-data-apps/references/r-shiny.md +124 -0
- package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
- package/skills/pixelcraft-data-apps/references/reflex.md +116 -0
- package/skills/pixelcraft-data-apps/references/shiny.md +110 -0
- package/skills/pixelcraft-data-apps/references/streamlit.md +113 -0
- package/skills/pixelcraft-dataviz/SKILL.md +60 -0
- package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
- package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
- package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +107 -0
- package/skills/pixelcraft-dataviz/references/libraries.md +176 -0
- package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
- package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +92 -0
- package/skills/pixelcraft-desktop/SKILL.md +93 -0
- package/skills/pixelcraft-desktop/references/appkit.md +92 -0
- package/skills/pixelcraft-desktop/references/avalonia.md +95 -0
- package/skills/pixelcraft-desktop/references/cpp-gui.md +129 -0
- package/skills/pixelcraft-desktop/references/electron.md +96 -0
- package/skills/pixelcraft-desktop/references/go-gui.md +83 -0
- package/skills/pixelcraft-desktop/references/gtk.md +97 -0
- package/skills/pixelcraft-desktop/references/javafx-swing.md +81 -0
- package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +88 -0
- package/skills/pixelcraft-desktop/references/rust-gui.md +83 -0
- package/skills/pixelcraft-desktop/references/tauri.md +110 -0
- package/skills/pixelcraft-desktop/references/uno-platform.md +71 -0
- package/skills/pixelcraft-desktop/references/winui-wpf.md +98 -0
- package/skills/pixelcraft-desktop/references/working-context.md +84 -0
- package/skills/pixelcraft-direction/SKILL.md +120 -0
- package/skills/pixelcraft-direction/references/composition-library.md +84 -0
- package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
- package/skills/pixelcraft-direction/references/direction-card.md +64 -0
- package/skills/pixelcraft-direction/references/direction-scoring.md +76 -0
- package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
- package/skills/pixelcraft-direction/references/movements.md +71 -0
- package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
- package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
- package/skills/pixelcraft-direction/references/slop-fingerprints.md +83 -0
- package/skills/pixelcraft-direction/references/wildcards.md +47 -0
- package/skills/pixelcraft-document/SKILL.md +58 -0
- package/skills/pixelcraft-document/references/archetypes.md +106 -0
- package/skills/pixelcraft-document/references/pdf-tools.md +314 -0
- package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
- package/skills/pixelcraft-document/references/print-css.md +187 -0
- package/skills/pixelcraft-document/references/slides.md +198 -0
- package/skills/pixelcraft-email/SKILL.md +80 -0
- package/skills/pixelcraft-email/references/client-quirks.md +113 -0
- package/skills/pixelcraft-email/references/html-tables.md +114 -0
- package/skills/pixelcraft-email/references/maizzle.md +54 -0
- package/skills/pixelcraft-email/references/mjml.md +54 -0
- package/skills/pixelcraft-email/references/react-email.md +95 -0
- package/skills/pixelcraft-extensions/SKILL.md +56 -0
- package/skills/pixelcraft-extensions/references/browser-extensions.md +105 -0
- package/skills/pixelcraft-extensions/references/figma-office.md +106 -0
- package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
- package/skills/pixelcraft-extensions/references/raycast.md +98 -0
- package/skills/pixelcraft-extensions/references/vscode-webviews.md +100 -0
- package/skills/pixelcraft-game-ui/SKILL.md +80 -0
- package/skills/pixelcraft-game-ui/references/bevy.md +90 -0
- package/skills/pixelcraft-game-ui/references/godot.md +130 -0
- package/skills/pixelcraft-game-ui/references/hud-principles.md +67 -0
- package/skills/pixelcraft-game-ui/references/love2d.md +77 -0
- package/skills/pixelcraft-game-ui/references/monogame.md +68 -0
- package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
- package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +107 -0
- package/skills/pixelcraft-game-ui/references/unreal-umg.md +80 -0
- package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
- package/skills/pixelcraft-handoff/SKILL.md +50 -0
- package/skills/pixelcraft-handoff/references/design-translation.md +134 -0
- package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
- package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
- package/skills/pixelcraft-media/SKILL.md +49 -0
- package/skills/pixelcraft-media/references/banners-video.md +130 -0
- package/skills/pixelcraft-media/references/og-generation.md +154 -0
- package/skills/pixelcraft-media/references/social-cards.md +71 -0
- package/skills/pixelcraft-mobile/SKILL.md +86 -0
- package/skills/pixelcraft-mobile/references/dotnet-maui.md +91 -0
- package/skills/pixelcraft-mobile/references/flet.md +80 -0
- package/skills/pixelcraft-mobile/references/flutter.md +113 -0
- package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
- package/skills/pixelcraft-mobile/references/ionic-capacitor.md +87 -0
- package/skills/pixelcraft-mobile/references/jetpack-compose.md +129 -0
- package/skills/pixelcraft-mobile/references/kivy.md +82 -0
- package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +86 -0
- package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
- package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
- package/skills/pixelcraft-mobile/references/react-native-expo.md +106 -0
- package/skills/pixelcraft-mobile/references/swiftui.md +200 -0
- package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
- package/skills/pixelcraft-mobile/references/task-state-composition.md +85 -0
- package/skills/pixelcraft-mobile/references/uikit.md +92 -0
- package/skills/pixelcraft-patterns/SKILL.md +75 -0
- package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
- package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
- package/skills/pixelcraft-patterns/references/auth-onboarding.md +44 -0
- package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
- package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
- package/skills/pixelcraft-patterns/references/commerce.md +47 -0
- package/skills/pixelcraft-patterns/references/communication.md +45 -0
- package/skills/pixelcraft-patterns/references/creative-tools.md +42 -0
- package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
- package/skills/pixelcraft-patterns/references/dashboard-admin.md +35 -0
- package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
- package/skills/pixelcraft-patterns/references/marketing.md +44 -0
- package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
- package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
- package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
- package/skills/pixelcraft-patterns/references/pattern-selection.md +80 -0
- package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
- package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
- package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
- package/skills/pixelcraft-patterns/references/settings.md +51 -0
- package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
- package/skills/pixelcraft-plan/SKILL.md +103 -0
- package/skills/pixelcraft-plan/references/design-input.md +69 -0
- package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
- package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
- package/skills/pixelcraft-plan/references/plan-template.md +134 -0
- package/skills/pixelcraft-plan/references/repo-discovery.md +49 -0
- package/skills/pixelcraft-plan/references/stack-freshness.md +67 -0
- package/skills/pixelcraft-plan/references/stack-selection.md +98 -0
- package/skills/pixelcraft-review/SKILL.md +86 -0
- package/skills/pixelcraft-review/references/audit-report.md +69 -0
- package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
- package/skills/pixelcraft-review/references/heuristics.md +63 -0
- package/skills/pixelcraft-review/references/personas.md +53 -0
- package/skills/pixelcraft-review/references/polish.md +78 -0
- package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
- package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
- package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
- package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
- package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
- package/skills/pixelcraft-review/scripts/slop-scan.mjs +1233 -0
- package/skills/pixelcraft-spatial/SKILL.md +51 -0
- package/skills/pixelcraft-spatial/references/comfort-accessibility.md +39 -0
- package/skills/pixelcraft-spatial/references/platforms.md +147 -0
- package/skills/pixelcraft-tokens/SKILL.md +60 -0
- package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
- package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
- package/skills/pixelcraft-tokens/references/adoption.md +55 -0
- package/skills/pixelcraft-tokens/references/format.md +84 -0
- package/skills/pixelcraft-tokens/references/governance.md +80 -0
- package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
- package/skills/pixelcraft-tokens/references/theme-presets.md +122 -0
- package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
- package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +847 -0
- package/skills/pixelcraft-tui/SKILL.md +76 -0
- package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +79 -0
- package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
- package/skills/pixelcraft-tui/references/ink.md +109 -0
- package/skills/pixelcraft-tui/references/ratatui.md +102 -0
- package/skills/pixelcraft-tui/references/rich.md +82 -0
- package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
- package/skills/pixelcraft-tui/references/textual.md +108 -0
- package/skills/pixelcraft-ux/SKILL.md +56 -0
- package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
- package/skills/pixelcraft-ux/references/feedback-performance.md +50 -0
- package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
- package/skills/pixelcraft-ux/references/forms.md +151 -0
- package/skills/pixelcraft-ux/references/i18n.md +221 -0
- package/skills/pixelcraft-ux/references/laws.md +39 -0
- package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
- package/skills/pixelcraft-ux/references/state-matrix.md +53 -0
- package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
- package/skills/pixelcraft-ux/references/ux-writing.md +44 -0
- package/skills/pixelcraft-visual-qa/SKILL.md +96 -0
- package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
- package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +59 -0
- package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
- package/skills/pixelcraft-visual-qa/references/capture-email.md +38 -0
- package/skills/pixelcraft-visual-qa/references/capture-mobile.md +50 -0
- package/skills/pixelcraft-visual-qa/references/capture-terminal.md +35 -0
- package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
- package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
- package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
- package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
- package/skills/pixelcraft-visual-qa/references/performance-budgets.md +78 -0
- package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
- package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
- package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
- package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
- package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
- package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
- package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +174 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
- package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +668 -0
- package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1226 -0
- package/skills/pixelcraft-web/SKILL.md +132 -0
- package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
- package/skills/pixelcraft-web/references/adaptive-layout.md +69 -0
- package/skills/pixelcraft-web/references/angular.md +108 -0
- package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
- package/skills/pixelcraft-web/references/astro.md +113 -0
- package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
- package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
- package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
- package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
- package/skills/pixelcraft-web/references/clojurescript.md +88 -0
- package/skills/pixelcraft-web/references/component-systems.md +102 -0
- package/skills/pixelcraft-web/references/component-testing.md +170 -0
- package/skills/pixelcraft-web/references/creative-effects.md +59 -0
- package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
- package/skills/pixelcraft-web/references/elm.md +53 -0
- package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
- package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
- package/skills/pixelcraft-web/references/forms-validation.md +123 -0
- package/skills/pixelcraft-web/references/fsharp-fable.md +54 -0
- package/skills/pixelcraft-web/references/gsap.md +102 -0
- package/skills/pixelcraft-web/references/html-css.md +220 -0
- package/skills/pixelcraft-web/references/htmx-alpine.md +103 -0
- package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
- package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
- package/skills/pixelcraft-web/references/java-web.md +61 -0
- package/skills/pixelcraft-web/references/kotlin-web.md +57 -0
- package/skills/pixelcraft-web/references/leptos-yew.md +97 -0
- package/skills/pixelcraft-web/references/lit-web-components.md +63 -0
- package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
- package/skills/pixelcraft-web/references/media-players.md +104 -0
- package/skills/pixelcraft-web/references/motion-react.md +96 -0
- package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
- package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
- package/skills/pixelcraft-web/references/pwa.md +230 -0
- package/skills/pixelcraft-web/references/qwik.md +94 -0
- package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
- package/skills/pixelcraft-web/references/react-next.md +168 -0
- package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
- package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
- package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
- package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
- package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
- package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
- package/skills/pixelcraft-web/references/server-rendered.md +114 -0
- package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
- package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
- package/skills/pixelcraft-web/references/solid.md +111 -0
- package/skills/pixelcraft-web/references/state-architecture.md +107 -0
- package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
- package/skills/pixelcraft-web/references/svelte.md +111 -0
- package/skills/pixelcraft-web/references/tailwind.md +99 -0
- package/skills/pixelcraft-web/references/video-media.md +69 -0
- package/skills/pixelcraft-web/references/vue-nuxt.md +86 -0
- package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Godot 4 UI
|
|
2
|
+
|
|
3
|
+
## Token mapping and Theme architecture
|
|
4
|
+
|
|
5
|
+
Centralize semantic colors, fonts, font sizes, constants, and `StyleBox` assets in shared **`Theme`** resources (using `theme_type_variation` for semantic button/panel roles like `PrimaryButton` or `DangerBadge`), using scoped `add_theme_*_override` calls only for truly dynamic runtime state:
|
|
6
|
+
|
|
7
|
+
```gdscript
|
|
8
|
+
# Apply safe area, pause ownership, mouse pass-through, and Godot 4.5 AccessKit semantics
|
|
9
|
+
extends CanvasLayer
|
|
10
|
+
|
|
11
|
+
@onready var safe_margin: MarginContainer = $SafeMargin
|
|
12
|
+
@onready var pause_overlay: Control = $PauseOverlay
|
|
13
|
+
@onready var hud_banner: Label = $SafeMargin/HudBanner
|
|
14
|
+
@onready var resume_button: Button = $PauseOverlay/Panel/ResumeButton
|
|
15
|
+
|
|
16
|
+
func _ready() -> void:
|
|
17
|
+
# Pause menu stays responsive while SceneTree is paused
|
|
18
|
+
pause_overlay.process_mode = Node.PROCESS_MODE_WHEN_PAUSED
|
|
19
|
+
# Decorative HUD text must never swallow clicks or hover beneath it
|
|
20
|
+
hud_banner.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
21
|
+
# Godot 4.5+ AccessKit screen-reader semantics
|
|
22
|
+
resume_button.accessibility_name = tr("UI_RESUME_GAME")
|
|
23
|
+
resume_button.accessibility_description = tr("UI_RESUME_DESC")
|
|
24
|
+
_apply_safe_area()
|
|
25
|
+
get_viewport().size_changed.connect(_apply_safe_area)
|
|
26
|
+
|
|
27
|
+
func _apply_safe_area() -> void:
|
|
28
|
+
var safe := DisplayServer.get_display_safe_area()
|
|
29
|
+
var win_size := DisplayServer.window_get_size()
|
|
30
|
+
if win_size.x <= 0 or win_size.y <= 0:
|
|
31
|
+
return
|
|
32
|
+
safe_margin.add_theme_constant_override("margin_left", safe.position.x)
|
|
33
|
+
safe_margin.add_theme_constant_override("margin_top", safe.position.y)
|
|
34
|
+
safe_margin.add_theme_constant_override("margin_right", win_size.x - safe.end.x)
|
|
35
|
+
safe_margin.add_theme_constant_override("margin_bottom", win_size.y - safe.end.y)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Layout, `DisplayServer.get_display_safe_area()`, and `mouse_filter`
|
|
39
|
+
|
|
40
|
+
- Build layouts with containers (`VBoxContainer`, `HBoxContainer`, `GridContainer`, `MarginContainer`, `AspectRatioContainer`) and explicit `size_flags` / anchors rather than absolute pixel positions; separate gameplay HUD `CanvasLayer` from modal/menu `CanvasLayer` ordering.
|
|
41
|
+
- Query **`DisplayServer.get_display_safe_area()`** (and reconnect on viewport resize/orientation changes) to pad root HUD margins away from mobile notches, camera cutouts, and TV overscan.
|
|
42
|
+
- Configure **`Control.mouse_filter`** deliberately on every Control:
|
|
43
|
+
- `MOUSE_FILTER_STOP`: interactive buttons, modal backdrops, and clickable panels that intentionally consume pointer events;
|
|
44
|
+
- `MOUSE_FILTER_PASS`: scrollable/container wrappers that observe events while letting unhandled clicks bubble to parents;
|
|
45
|
+
- `MOUSE_FILTER_IGNORE`: decorative HUD labels, icons, vignettes, and non-interactive containers so they never block gameplay picking or clicks underneath.
|
|
46
|
+
|
|
47
|
+
## `CanvasItem.process_mode` and pause/state ownership
|
|
48
|
+
|
|
49
|
+
Set **`process_mode`** explicitly whenever pausing the `SceneTree` (`get_tree().paused = true`):
|
|
50
|
+
|
|
51
|
+
- `Node.PROCESS_MODE_PAUSABLE`: gameplay HUD tickers/animations that freeze while paused;
|
|
52
|
+
- `Node.PROCESS_MODE_WHEN_PAUSED`: pause menus and modal dialogs active only during pause;
|
|
53
|
+
- `Node.PROCESS_MODE_ALWAYS`: global audio/settings/system-notification layers and the pause-toggle controller itself.
|
|
54
|
+
|
|
55
|
+
Store the previously focused `Control` (`get_viewport().gui_get_focus_owner()`) before opening popups and call `grab_focus()` on close so controller focus is never orphaned.
|
|
56
|
+
|
|
57
|
+
## Typography and MSDF fonts
|
|
58
|
+
|
|
59
|
+
- Use dynamic `FontFile` (TTF/OTF/WOFF2) with explicit `fallbacks` arrays covering CJK, Arabic/RTL (Godot 4 includes HarfBuzz + ICU BiDi shaping), Cyrillic, and symbols; reserve bitmap fonts strictly for pixel-art games with verified locale coverage.
|
|
60
|
+
- **MSDF fonts**: enable `multichannel_signed_distance_field = true` on `FontFile` import settings for crisp UI scaling across 720p–4K and user HUD-scale sliders. Note that MSDF cannot represent overlapping variable-font contours or every complex script cleanly—verify CJK/Arabic/Indic rendering and keep raster dynamic fallback fonts where needed.
|
|
61
|
+
|
|
62
|
+
## Accessibility and Godot 4.5 AccessKit
|
|
63
|
+
|
|
64
|
+
- **Godot 4.5 native AccessKit**: Godot 4.5 integrates AccessKit for native screen-reader trees on supported desktop/mobile platforms. Set **`accessibility_name`**, **`accessibility_description`**, and semantic control types (`Button`, `CheckBox`, `HSlider`, `Label`) especially on icon-only buttons and custom-drawn `Control` nodes, and test on actual assistive technology (label untested platforms `not-checked`).
|
|
65
|
+
- Configure `focus_mode` (`FOCUS_ALL` for interactive controls, `FOCUS_NONE` for decorative nodes), explicit `focus_neighbor_*` overrides where spatial focus jumps erratically, visible `:focus` `StyleBox` states, `ui_accept`/`ui_cancel` InputMap parity, subtitles/scale/colorblind/reduced-motion settings, and conflict-aware remapping.
|
|
66
|
+
|
|
67
|
+
## Godot C# UI bindings
|
|
68
|
+
|
|
69
|
+
Godot C# (`Godot.NET.Sdk`) shares the exact same `Control`, `Theme`, `DisplayServer`, `ProcessMode`, `MouseFilter`, and Godot 4.5 AccessKit runtime as GDScript—enforce idiomatic C# binding hygiene:
|
|
70
|
+
|
|
71
|
+
- Prefer typed **`[Export]`** node properties over brittle string `GetNode<Button>("...")` paths.
|
|
72
|
+
- Subscribe with C# event delegates (`ResumeButton.Pressed += OnResumePressed;`) and unsubscribe in **`_ExitTree()`** when listening to longer-lived autoloads/viewports so freed UI nodes never leak or throw `ObjectDisposedException`; use **`Callable.From(...)`** when connecting dynamic/custom Godot signals.
|
|
73
|
+
- Maintain exact parity with GDScript for localization (`Tr("UI_RESUME_GAME")`), safe areas (`DisplayServer.GetDisplaySafeArea()`), `AddThemeConstantOverride(...)`, `ProcessModeEnum.WhenPaused`, and `MouseFilterEnum.Ignore`.
|
|
74
|
+
|
|
75
|
+
```csharp
|
|
76
|
+
using Godot;
|
|
77
|
+
|
|
78
|
+
public partial class HudController : CanvasLayer
|
|
79
|
+
{
|
|
80
|
+
[Export] public Control PauseOverlay { get; set; } = null!;
|
|
81
|
+
[Export] public Button ResumeButton { get; set; } = null!;
|
|
82
|
+
|
|
83
|
+
private Callable _resizeCallable;
|
|
84
|
+
|
|
85
|
+
public override void _Ready()
|
|
86
|
+
{
|
|
87
|
+
PauseOverlay.ProcessMode = ProcessModeEnum.WhenPaused;
|
|
88
|
+
ResumeButton.Text = Tr("UI_RESUME_GAME");
|
|
89
|
+
ResumeButton.Pressed += OnResumePressed;
|
|
90
|
+
|
|
91
|
+
_resizeCallable = Callable.From(ApplySafeArea);
|
|
92
|
+
GetViewport().Connect(Viewport.SignalName.SizeChanged, _resizeCallable);
|
|
93
|
+
ApplySafeArea();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public override void _ExitTree()
|
|
97
|
+
{
|
|
98
|
+
ResumeButton.Pressed -= OnResumePressed;
|
|
99
|
+
if (GetViewport().IsConnected(Viewport.SignalName.SizeChanged, _resizeCallable))
|
|
100
|
+
GetViewport().Disconnect(Viewport.SignalName.SizeChanged, _resizeCallable);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private void OnResumePressed() => GetTree().Paused = false;
|
|
104
|
+
private void ApplySafeArea() { /* apply DisplayServer.GetDisplaySafeArea() */ }
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Do/don't pairs
|
|
109
|
+
|
|
110
|
+
| Do | Don't |
|
|
111
|
+
|---|---|
|
|
112
|
+
| Shared `Theme` + `theme_type_variation` with scoped overrides | Duplicating `StyleBox` and font overrides across every `Control` |
|
|
113
|
+
| Set `mouse_filter = MOUSE_FILTER_IGNORE` on decorative HUD overlays and `process_mode = PROCESS_MODE_ALWAYS`/`WHEN_PAUSED` on pause UI | Leave default `MOUSE_FILTER_STOP` blocking clicks or freeze the pause menu when `get_tree().paused = true` |
|
|
114
|
+
| Apply `DisplayServer.get_display_safe_area()` and responsive containers | Hard-code 1920×1080 pixel coordinates that clip on notches or ultrawide screens |
|
|
115
|
+
| Set Godot 4.5 `accessibility_name`/`accessibility_description`, explicit `focus_neighbor_*`, and focus restoration | Ship icon-only controls with no accessible name or orphan focus on `queue_free()` |
|
|
116
|
+
| Enable MSDF selectively with dynamic fallback fonts tested on CJK/Arabic | Assume English editor glyphs cover localized player names or variable scales |
|
|
117
|
+
|
|
118
|
+
## Known traps
|
|
119
|
+
|
|
120
|
+
Default `MOUSE_FILTER_STOP` silently blocking clicks under full-rect containers, focus lost when freeing a focused node, `process_mode` freezing pause/unpause buttons, `Theme` item lookup confusion (theme values are not ordinary node properties), MSDF artifacts on complex overlapping glyphs, and controller/keyboard `ui_*` InputMap conflicts.
|
|
121
|
+
|
|
122
|
+
## Verification commands
|
|
123
|
+
|
|
124
|
+
Run the project's configured headless test runner (e.g., GUT or GdUnit4) preserving exit status and logs, then launch the affected scene in the target Godot runtime:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
godot --headless --path . --quit-after 1
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Inspect runtime screenshots, controller-only focus flows, `DisplayServer.get_display_safe_area()` / ultrawide / stretch-mode matrix, pseudo-localized CJK/Arabic fonts, Godot 4.5 AccessKit output on supported OS screen readers, and pause/interruption recovery (`rendered`).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Cross-engine HUD principles
|
|
2
|
+
|
|
3
|
+
## UI spatial taxonomy (diegetic, spatial, meta, non-diegetic)
|
|
4
|
+
|
|
5
|
+
Choose each HUD layer deliberately based on legibility vs immersion—never let world-space spectacle destroy survival-critical readability:
|
|
6
|
+
|
|
7
|
+
| Category | Exists in game story? | Exists in 3D space? | Examples & design rule |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| **Diegetic** | Yes | Yes | Ammo counter on weapon, cockpit dials, wrist health rig. High immersion, but vulnerable to motion blur, lighting, FOV, and low vision—always pair with a readable HUD/subtitle/audio fallback option. |
|
|
10
|
+
| **Spatial** | No | Yes | Floating enemy health bars, 3D objective waypoints, interaction prompts anchored to world objects. Apply distance scaling clamps and occlusion rules so overlapping markers never obscure targets. |
|
|
11
|
+
| **Meta** | Yes | No | Screen-edge blood/frost vignette, lens condensation, cracked visor. Never rely on meta effects alone for exact survival state (pair with clear numeric/icon/audio indicators and offer a reduced-effect toggle). |
|
|
12
|
+
| **Non-diegetic** | No | No | Classic 2D HUD bars, minimap, subtitle box, pause menus. Highest glanceability and accessibility; keep anchored cleanly inside safe zones without blocking the crosshair or action center. |
|
|
13
|
+
|
|
14
|
+
## Legibility under play
|
|
15
|
+
|
|
16
|
+
- Define criticality tiers: survival-critical, objective-critical, tactical/optional, ambient/flavor.
|
|
17
|
+
- Critical information must survive motion, particles, explosions, variable scene luminance, distance, low brightness, colorblindness, localization expansion, and streaming compression.
|
|
18
|
+
- Use multi-channel redundancy: color + distinct shape/icon + text/number + position + audio/haptic cue.
|
|
19
|
+
- Never cover the crosshair, objective path, or incoming threats with decorative panels or modal tutorial prompts.
|
|
20
|
+
|
|
21
|
+
## Dynamic input-glyph hot-swapping (`<= 1 frame`, zero layout jump)
|
|
22
|
+
|
|
23
|
+
- **Instant `<= 1 frame` hot-swap (`0` hysteresis timer lag)**: switch glyphs on the **very next rendered frame** across **Xbox**, **PlayStation (DualSense)**, **Nintendo Switch**, **Steam Deck**, **Keyboard + Mouse**, and **Touch** the moment an explicit button/key press or stick/mouse delta exceeding the hardware noise floor (`stick magnitude > 0.35`, `mouse delta > 4px`) occurs—filter stick drift by deadzone threshold, **never** by multi-second delay timers that leave stale icons onscreen.
|
|
24
|
+
- **Zero layout jump**: render button prompts inside fixed-dimension inline glyph slots or monospaced sprite atlases (`min-width` sized for wide keys like `[Space]` / `[LShift]`) so swapping `(A)` <-> `[Enter]` never reflows surrounding HUD or dialog text.
|
|
25
|
+
- **Manual override & live bindings**: provide a **Button Prompt Style** override (`Auto / Xbox / DualSense / Switch / Steam Deck / KBM`) in Settings and resolve glyphs from the player's **live remapped action bindings** rather than hardcoded `"Press [E]"` strings.
|
|
26
|
+
|
|
27
|
+
## Steam Deck Verified (`1280×800`, `16:10`), Safe Areas & Ultrawide Clamping
|
|
28
|
+
|
|
29
|
+
| Target surface | Resolution / aspect | Mandatory UI engineering contract |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| **Steam Deck Verified** | `1280×800` (`16:10` native) | **`>= 9px` absolute minimum glyph height / `12–14px` body target** at `1280×800`; **100% controller navigation from boot with zero external mouse-only launcher**; invoke Steam/OS virtual keyboard (`SteamUtils.ShowFloatingGamepadTextInput` / `DisplayServer.virtual_keyboard_show`) automatically on text-input focus; render native Steam Deck / gamepad glyphs and `16:10` without black bars or clipped sidebars |
|
|
32
|
+
| **10-Foot Console / Living-Room TV** | `1920×1080` / `3840×2160` (`16:9`) | **`>= 24–28px` body/HUD floor at `1080p`** (`>= 52px` at `4K`); keep all vital HUD/subtitle elements inside a **`90%` title-safe inset** (`5%` margin per edge) respecting overscan and OS achievement/party toast corners |
|
|
33
|
+
| **Ultrawide & Super-Ultrawide** | `21:9` (`3440×1440`) & `32:9` (`5120×1440`) | Clamp peripheral HUD anchors (health, minimap, ammo, objective feed) to a **centered `16:9` container** by default (with a `HUD Horizontal Bounds` slider `16:9 <-> Full`) while spanning world render and edge vignettes edge-to-edge—**never stretch 2D sprites, circular reticles, or minimap aspect ratios** |
|
|
34
|
+
|
|
35
|
+
## Console Lotcheck / TRC / XR Compliance & Game-Feel Polish
|
|
36
|
+
|
|
37
|
+
Design these certification and feel mechanics into core UI systems from day one (still label formal console submission `not-checked` unless verified against the NDA checklist):
|
|
38
|
+
|
|
39
|
+
- **Active controller disconnect auto-pause**: subscribe to hardware device-loss events (`InputSystem.onDeviceChange`, `Input.joy_connection_changed`, `PlatformUser` pairing); immediately **pause gameplay simulation and present a controller-reconnect modal** specifying which player slot disconnected.
|
|
40
|
+
- **Persistent active profile / gamertag**: display the signed-in player's gamertag/avatar on title, main menu, and profile-switching surfaces so save-data ownership is unambiguous.
|
|
41
|
+
- **Explicit autosave notice**: display a non-blocking **"Saving — do not turn off your system…"** indicator + animated icon **before and during** non-volatile storage writes, performing serialization asynchronously off the UI/render thread.
|
|
42
|
+
- **Menu input buffering (`100–150 ms`)**: queue `Confirm` / `Cancel` / `Tab` presses arriving during the final `100–150 ms` of a screen/tab transition instead of dropping player inputs during brief animations.
|
|
43
|
+
- **UI audio buses & `±3%` pitch modulation**: route UI audio to a dedicated **`UI` bus** decoupled from **`Master / Music / SFX / Voice`** volume faders, and randomize hover/tick/inventory SFX pitch by **`±3%` (`0.97–1.03`)** (with `>= 30–40 ms` retrigger cooldown) so rapid list scrolling never sounds robotic.
|
|
44
|
+
- **`0 B/frame` steady-state UI GC allocation**: preallocate text buffers (`TMP_Text.SetText`, reusable `StringBuilder`, pooled combat floaters, cached delegates) so active gameplay HUD updates allocate **`0 bytes/frame`** on the managed heap and never trigger GC frame spikes.
|
|
45
|
+
|
|
46
|
+
## HDR UI paper-white calibration
|
|
47
|
+
|
|
48
|
+
- Separate UI luminance from scene HDR specular peaks (`1,000–4,000 nits`). Render the UI layer at a calibrated **SDR paper-white target (`150–250 nits` default)** with a user-adjustable **HDR UI Brightness / Paper-White slider**, composited **after** scene tone-mapping, bloom, and chromatic aberration.
|
|
49
|
+
|
|
50
|
+
## Accessibility, photosensitivity & localization floor (XAG)
|
|
51
|
+
|
|
52
|
+
| Area | Concrete testable pattern |
|
|
53
|
+
|---|---|
|
|
54
|
+
| **HUD & distance scale (XAG 101)** | Independent **HUD Scale (`80%–150%+`)** and **Menu Text Size** presets (`>= 9px` floor / `12–14px` at `1280×800`; `>= 24–28px` at `1080p` TV) without clipping |
|
|
55
|
+
| **Contrast & colorblindness (XAG 102/103)** | `>= 4.5:1` text contrast over dynamic 3D scenes via dark scrim/plate; pair team/rarity/status colors with **distinct shapes, icons, patterns, or labels** + customizable palette |
|
|
56
|
+
| **Subtitles & captions (XAG 104)** | Scalable subtitle size, **independent background scrim opacity (`0–100%`)**, speaker labels + color tags, and directional `[Explosion — Left]` audio captions |
|
|
57
|
+
| **Full input remapping & motor assists (XAG 107/108)** | Remap every gameplay/UI action across gamepad & KBM with conflict resolution, one-button **Reset to Default**, **hold-to-toggle** (`Aim`, `Sprint`, `Crouch`, `Radial Wheel`), and QTE rapid-tap bypass |
|
|
58
|
+
| **Photosensitivity & motion (XAG 115)** | Hard cap luminance/red transitions at **`<= 3 Hz`** across HUD alerts, hit-flashes, and menus; independent **Camera Shake**, **Motion Blur**, ** Vignette**, and **Reduced UI Motion** toggles |
|
|
59
|
+
| **Localization** | Pseudo-localize early (`+35–40%` expansion for German/Finnish), bundle dynamic CJK/Arabic/RTL/Vietnamese/Cyrillic fallback font atlases, and pull dynamic action glyphs into localized templates |
|
|
60
|
+
|
|
61
|
+
## State hierarchy
|
|
62
|
+
|
|
63
|
+
Separate persistent HUD state, transient non-blocking pickups (mirrored permanently in the inventory/log), modal controller-disconnect/pause interruptions, subtitles, autosave indicators, and OS overlays with an explicit z-order and input-capture stack.
|
|
64
|
+
|
|
65
|
+
## Verification matrix
|
|
66
|
+
|
|
67
|
+
Record engine/version/target hardware, resolution matrix (`1280×800` Steam Deck, `1920×1080` TV, `3440×1440` `21:9`), `<= 1 frame` glyph hot-swap, controller-disconnect auto-pause, virtual keyboard trigger, `0 B/frame` profiler trace, audio bus separation, `<= 3 Hz` flash check, and localization/accessibility passes (`rendered`; mark uninspected console NDA checklists `not-checked`).
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# LÖVE2D (Lua)
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
5
|
+
Centralize palette, typography, spacing, and scale tokens in a Lua module (`theme.lua`) rather than scattering raw RGB tables across `love.draw()`. Preload fonts and glyph atlases deliberately in `love.load()` or on `love.resize()`.
|
|
6
|
+
|
|
7
|
+
## Layout, `love.window.getSafeArea()`, and Lua UI libraries
|
|
8
|
+
|
|
9
|
+
LÖVE2D is immediate-mode drawing with no built-in retained UI framework. Compute HUD bounds inside **`love.window.getSafeArea()`** (which returns usable `x, y, w, h` excluding mobile notches, Dynamic Island, and TV overscan) and recompute on `love.resize(w, h)`:
|
|
10
|
+
|
|
11
|
+
```lua
|
|
12
|
+
local ui = { safe = { x = 0, y = 0, w = 1280, h = 720 }, inputDevice = "kbm" }
|
|
13
|
+
|
|
14
|
+
function ui.updateSafeArea()
|
|
15
|
+
local x, y, w, h = love.window.getSafeArea()
|
|
16
|
+
ui.safe.x, ui.safe.y, ui.safe.w, ui.safe.h = x, y, w, h
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
function ui.detectGlyphFamily(joystick)
|
|
20
|
+
local name = (joystick:getName() or ""):lower()
|
|
21
|
+
if name:find("dualsense") or name:find("dualshock") or name:find("ps[45]") then
|
|
22
|
+
return "playstation"
|
|
23
|
+
elseif name:find("nintendo") or name:find("switch") or name:find("joy%-con") then
|
|
24
|
+
return "nintendo"
|
|
25
|
+
elseif name:find("steam") then
|
|
26
|
+
return "steamdeck"
|
|
27
|
+
end
|
|
28
|
+
return "xbox"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
function love.gamepadpressed(joystick, _button)
|
|
32
|
+
ui.inputDevice = ui.detectGlyphFamily(joystick)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
function love.keypressed(_key)
|
|
36
|
+
ui.inputDevice = "kbm"
|
|
37
|
+
end
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
When you need ready-made widgets instead of hand-drawn rects:
|
|
41
|
+
|
|
42
|
+
- **SUIT**: lightweight immediate-mode Lua widgets (`suit.Button`, `suit.Slider`, `suit.Input`) with minimal runtime footprint;
|
|
43
|
+
- **Slab**: ImGui-style retained debug/tool/settings windows in pure Lua (ideal for simulation HUDs, editors, and dev consoles);
|
|
44
|
+
- **FlexLove**: Flexbox-inspired responsive layout and styling in LÖVE for complex multi-resolution menus.
|
|
45
|
+
|
|
46
|
+
None of these provide automatic OS screen-reader semantics or console focus graphs—wire explicit keyboard/gamepad focus, focus restoration across state pops, and glyph swapping yourself.
|
|
47
|
+
|
|
48
|
+
## Typography, motion, accessibility, and states
|
|
49
|
+
|
|
50
|
+
- Use `love.graphics.newFont(path, size, hinting, dpiscale)` with explicit DPI scaling (`love.window.getDPIScale()`) and verify fallback/glyph coverage for non-Latin locales; pixel fonts need integer scaling to avoid shimmer.
|
|
51
|
+
- Clamp `dt` (`math.min(dt, 0.05)`), decouple game state from tween completion, and expose reduced-motion and flash-intensity sliders.
|
|
52
|
+
- Implement dynamic gamepad glyph detection via `love.joystickadded` / `love.gamepadpressed` + `joystick:getName()` (plus a manual glyph-style override in Settings for Steam Input or third-party controllers), and debounce stick drift so prompts do not flicker between controller and mouse.
|
|
53
|
+
- Use explicit state stacks (HUD / Pause / Settings / Remap / Loading / Error) that preserve selected index on push/pop; test `love.textinput` IME/virtual-keyboard limits before relying on freeform text forms.
|
|
54
|
+
|
|
55
|
+
## Do/don't pairs
|
|
56
|
+
|
|
57
|
+
| Do | Don't |
|
|
58
|
+
|---|---|
|
|
59
|
+
| Central `theme.lua` semantic palette and DPI-scaled fonts | Literal `{1, 0.2, 0.2}` RGB tables scattered through `love.draw()` |
|
|
60
|
+
| Layout HUD inside `love.window.getSafeArea()` and recompute on `love.resize` | Hard-code 1920×1080 coordinates that clip on notches or ultrawide displays |
|
|
61
|
+
| Swap prompt glyphs dynamically via `joystick:getName()` / last input event + Settings override | Hard-code `"Press E"` or Xbox-only prompts for PlayStation/Switch/Steam Deck players |
|
|
62
|
+
| Explicit keyboard/gamepad focus stack + reduced-flash/motion toggles | Mouse-only hitboxes or uncontrolled screen-shake/particles behind HUD text |
|
|
63
|
+
|
|
64
|
+
## Known traps
|
|
65
|
+
|
|
66
|
+
No built-in screen-reader/focus infrastructure, `dpiscale` blurry text on macOS/Retina displays, joystick analog drift flickering KBM/gamepad prompts, font glyph gaps in localized text, unbounded `dt` breaking tweens after alt-tab, and blocking asset loads freezing the loop.
|
|
67
|
+
|
|
68
|
+
## Verification commands
|
|
69
|
+
|
|
70
|
+
Run your configured linter without suppressing exit codes, then launch the game runtime:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
luacheck .
|
|
74
|
+
love .
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Test window resize, HiDPI scaling, safe-area inset simulation, controller-only menu traversal, gamepad/KBM prompt hot-swapping, localization glyph checks, and pause/interruption flows (`rendered`; label missing screen-reader integration honestly as `not-checked` / unsupported).
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# MonoGame (C#)
|
|
2
|
+
|
|
3
|
+
## UI libraries and typography stack
|
|
4
|
+
|
|
5
|
+
MonoGame ships a low-level 2D/3D loop (`SpriteBatch`) without a built-in retained UI layout engine. Do not hand-roll a brittle UI layout engine or rely exclusively on static compile-time `SpriteFont` bitmaps when shipping multi-resolution, localized games:
|
|
6
|
+
|
|
7
|
+
| Library | Best for | Key capabilities & constraints |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| **Gum UI** (`MonoGameGum`, featured by MonoGame) | visual layout + responsive Flexbox-like menus/HUDs | docking, stacking, nine-slice styling, visual Gum editor or code-first API, built-in gamepad focus/navigation support, localization hooks |
|
|
10
|
+
| **Myra** | retained C# / XAML-like desktop & game menus/dialogs | grids, scroll views, rich widgets, XML/MML markup, custom styles; wire explicit gamepad focus traversal for console/controller play |
|
|
11
|
+
| **FontStashSharp** | runtime dynamic TTF/OTF typography & global localization | rasterizes glyphs on demand from TTF/OTF with fallback font chains (**CJK, Arabic, Cyrillic, symbols, player names**), crisp arbitrary scaling, stroke/shadow effects—eliminates `SpriteFont` compile-time character-range limits |
|
|
12
|
+
|
|
13
|
+
```csharp
|
|
14
|
+
using FontStashSharp;
|
|
15
|
+
using Microsoft.Xna.Framework;
|
|
16
|
+
using Microsoft.Xna.Framework.Graphics;
|
|
17
|
+
|
|
18
|
+
// Semantic theme + FontStashSharp dynamic font system (supports runtime scaling & CJK/Unicode fallbacks)
|
|
19
|
+
public sealed class UiTheme
|
|
20
|
+
{
|
|
21
|
+
public Color ActionBg { get; init; } = new(15, 81, 50);
|
|
22
|
+
public Color TextPrimary { get; init; } = new(245, 247, 250);
|
|
23
|
+
public FontSystem PrimaryFont { get; }
|
|
24
|
+
|
|
25
|
+
public UiTheme(byte[] primaryTtf, byte[] cjkFallbackTtf)
|
|
26
|
+
{
|
|
27
|
+
PrimaryFont = new FontSystem();
|
|
28
|
+
PrimaryFont.AddFont(primaryTtf);
|
|
29
|
+
PrimaryFont.AddFont(cjkFallbackTtf);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public DynamicSpriteFont Body(float uiScale) => PrimaryFont.GetFont((int)(20 * uiScale));
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Token mapping, layout, and scaling
|
|
37
|
+
|
|
38
|
+
- Centralize semantic colors, font sizes, margins, and scale factors in a C# theme object or Gum style definitions—never scatter `Color.OrangeRed` literals across `Draw()`.
|
|
39
|
+
- Handle `Window.ClientSizeChanged`, virtual-resolution scaling vs crisp HiDPI native UI rendering, safe-area insets (`GraphicsDevice.Viewport.TitleSafeArea` on consoles/TVs plus ultrawide HUD clamping), and separate HUD, menu, modal, and debug layers.
|
|
40
|
+
|
|
41
|
+
## Input, accessibility, motion, and states
|
|
42
|
+
|
|
43
|
+
- MonoGame does not provide built-in OS UI automation/screen-reader trees—explicitly engineer keyboard/gamepad focus navigation, visible focus states, dynamic input-glyph swapping (`GamePad.GetCapabilities` / SDL controller type), conflict-aware remapping, subtitle scaling/backdrops, colorblind-safe icons/patterns, and reduced-motion/flash toggles.
|
|
44
|
+
- Use explicit state machines for loading, menu, pause, error, empty inventory, disconnect, death/respawn, and modal focus restoration; load assets asynchronously or progressively so frames do not freeze.
|
|
45
|
+
- Validate `Window.TextInput` IME/clipboard/virtual-keyboard limits before building complex text-entry forms.
|
|
46
|
+
|
|
47
|
+
## Do/don't pairs
|
|
48
|
+
|
|
49
|
+
| Do | Don't |
|
|
50
|
+
|---|---|
|
|
51
|
+
| Use **Gum UI** or **Myra** for non-trivial menus/HUDs and **FontStashSharp** for runtime TTF + CJK/Unicode fallback | Hand-roll complex nested layouts or ship static Latin-only `SpriteFont` atlases for localized titles |
|
|
52
|
+
| Centralize tokens in a semantic C# theme / Gum style sheet | Hard-code `Color.*` and pixel coordinates across `SpriteBatch.Draw` calls |
|
|
53
|
+
| Respect `Viewport.TitleSafeArea`, dynamic resize, and explicit controller focus graphs | Assume a fixed 1920×1080 backbuffer or mouse-only menu hitboxes |
|
|
54
|
+
| Expose HUD scale, subtitle backdrop, colorblind redundancy, and reduced-flash toggles | Leave accessibility/platform gaps undocumented or claim untested screen-reader support |
|
|
55
|
+
|
|
56
|
+
## Known traps
|
|
57
|
+
|
|
58
|
+
Static `SpriteFont` crashing or dropping glyphs on localized/player strings, blurry UI when scaling a low-res render target instead of rendering UI at native backbuffer resolution, missing controller focus restoration after closing Myra/custom dialogs, and un-clamped `gameTime.ElapsedGameTime` spiking UI tweens.
|
|
59
|
+
|
|
60
|
+
## Verification commands
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
dotnet test
|
|
64
|
+
dotnet build
|
|
65
|
+
dotnet run --project <GameProject>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Test backbuffer resize, ultrawide/handheld/TV `TitleSafeArea`, controller-only menu navigation, FontStashSharp localized glyph coverage, pause/interruption flows, and reduced-motion/flash settings (`rendered`).
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Unity uGUI (`Canvas`, `CanvasScaler`, `RectTransform`, `TextMeshPro`)
|
|
2
|
+
|
|
3
|
+
Use this reference for Unity's GameObject-based **uGUI** runtime (`UnityEngine.UI` + `TMPro`), especially for world-space/diegetic canvases, shader/particle-integrated HUDs, or projects already standardized on uGUI. For UXML/USS retained UI, read `references/unity-ui-toolkit.md`.
|
|
4
|
+
|
|
5
|
+
## Canvas dirty-rebuild splitting and batching
|
|
6
|
+
|
|
7
|
+
Modifying *any* `Graphic` (color, text, alpha) or `RectTransform` marks its parent `Canvas` dirty and forces a full geometry and layout rebuild (`Canvas.BuildBatch`, `Canvas.SendWillRenderCanvases`) across every sibling on that `Canvas`:
|
|
8
|
+
|
|
9
|
+
- **Split static vs dynamic Canvases**: isolate static backgrounds, frames, and rarely changing labels on one `Canvas`, and place high-frequency HUD widgets (health bars, cooldown timers, damage numbers, minimap markers) on separate nested sub-`Canvas` components (sub-Canvases break dirty propagation upward while inheriting scaling from the root `CanvasScaler`).
|
|
10
|
+
- **Disable `Raycast Target`** on all non-interactive `Image`, `RawImage`, and `TMP_Text` components to trim `GraphicRaycaster` cost and prevent invisible decorative overlays from eating clicks.
|
|
11
|
+
- **Avoid per-frame LayoutGroup churn**: disable `ContentSizeFitter` / `LayoutGroup` after one-time population when dynamic lists don't resize every frame, and use object pooling instead of `Instantiate`/`Destroy` for combat floaters or inventory slots.
|
|
12
|
+
- **Pack sprites into Sprite Atlases** and minimize `Mask` (stencil) vs `RectMask2D` (cheaper 2D clipping without extra stencil draw calls).
|
|
13
|
+
|
|
14
|
+
## `CanvasScaler`, `RectTransform`, and `Screen.safeArea`
|
|
15
|
+
|
|
16
|
+
- Set `CanvasScaler` to **`Scale With Screen Size`** with an explicit Reference Resolution (e.g., `1920×1080`) and deliberate `Screen Match Mode`:
|
|
17
|
+
- `Match Width Or Height` (typically `0.5` for balanced aspect scaling, or dynamic switching by aspect ratio);
|
|
18
|
+
- `Expand` when no edge clipping is allowed across ultrawide (21:9/32:9) and narrow (4:3/portrait) screens.
|
|
19
|
+
- Apply `Screen.safeArea` to a root child `RectTransform` at startup and on orientation/resolution changes so notches, Dynamic Island, and TV overscan never clip HUD anchors.
|
|
20
|
+
|
|
21
|
+
```csharp
|
|
22
|
+
using UnityEngine;
|
|
23
|
+
using UnityEngine.EventSystems;
|
|
24
|
+
|
|
25
|
+
public sealed class SafeAreaPanel : MonoBehaviour
|
|
26
|
+
{
|
|
27
|
+
private RectTransform _rect;
|
|
28
|
+
private Rect _lastSafeArea;
|
|
29
|
+
|
|
30
|
+
private void Awake() => _rect = (RectTransform)transform;
|
|
31
|
+
|
|
32
|
+
private void LateUpdate()
|
|
33
|
+
{
|
|
34
|
+
if (Screen.safeArea == _lastSafeArea) return;
|
|
35
|
+
_lastSafeArea = Screen.safeArea;
|
|
36
|
+
var min = _lastSafeArea.position;
|
|
37
|
+
var max = min + _lastSafeArea.size;
|
|
38
|
+
min.x /= Screen.width; min.y /= Screen.height;
|
|
39
|
+
max.x /= Screen.width; max.y /= Screen.height;
|
|
40
|
+
_rect.anchorMin = min;
|
|
41
|
+
_rect.anchorMax = max;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## `TextMeshPro` (`TMP_Text`) typography, Steam Deck floor, and `0 B/frame` GC
|
|
47
|
+
|
|
48
|
+
- Always use **`TextMeshPro` (`TMP_Text` / `TextMeshProUGUI`)**—never legacy `UnityEngine.UI.Text`.
|
|
49
|
+
- **SDF Atlases & Fallback Chains**: use static SDF atlases for fixed Latin HUD fonts and configure **Dynamic SDF + Multi-Atlas** fallback fonts in `TMP_Settings` (or per `TMP_FontAsset.fallbackFontAssetTable`) covering **CJK, Arabic/Hebrew (with RTL shaping plugin where needed), Cyrillic, Thai, Vietnamese, and user-generated names** so missing glyphs never render as empty squares.
|
|
50
|
+
- **`0 B/frame` steady-state UI GC**: call `tmpText.SetText("HP: {0} / {1}", hp, maxHp)` (or `SetCharArray` from a preallocated `char[]` buffer) instead of string interpolation (`$"HP: {hp}"`) inside `Update()`—steady-state gameplay HUD frames must record **`0 B` `GC.Alloc`** in Unity Profiler, and set `Image.preserveAspect = true` on 2D icons/reticles so `21:9` / `16:10` scaling never stretches sprites.
|
|
51
|
+
- **Steam Deck (`1280×800`) minimum size**: constrain `enableAutoSizing` with `fontSizeMin` keeping rendered glyph height **`>= 9px` (`12–14px` target) at `1280×800`** rather than letting German/Finnish strings shrink to unreadable `6–8px` microtext, and invoke `SteamUtils.ShowFloatingGamepadTextInput` when `TMP_InputField` is activated via gamepad.
|
|
52
|
+
|
|
53
|
+
## `EventSystem`, `InputSystemUIInputModule`, disconnect pause, and explicit `Selectable` navigation
|
|
54
|
+
|
|
55
|
+
- Pair `EventSystem` with Unity's **`InputSystemUIInputModule`** (replacing legacy `StandaloneInputModule`), mapping `Navigate`, `Submit`, `Cancel`, and `Point` cleanly to Input Actions, and subscribe to `InputSystem.onDeviceChange` (`InputDeviceChange.Disconnected`) to **auto-pause gameplay and open a reconnect modal** immediately when the active gamepad drops.
|
|
56
|
+
- Set **`Deselect On Background Click` = false** (or keep a focus guard) in controller-capable menus so an accidental mouse click on empty space never orphans gamepad focus.
|
|
57
|
+
- **Explicit `Selectable` Navigation**: Unity's `Navigation.Mode.Automatic` casts spatial rays that break on scroll views, non-uniform grids, and tabbed dialogs. Set `Navigation.Mode.Explicit` (`selectOnUp`, `selectOnDown`, `selectOnLeft`, `selectOnRight`) on grids/menus and restore `EventSystem.current.SetSelectedGameObject(previous)` when closing any modal:
|
|
58
|
+
|
|
59
|
+
```csharp
|
|
60
|
+
public sealed class ModalFocusGuard : MonoBehaviour
|
|
61
|
+
{
|
|
62
|
+
[SerializeField] private GameObject initialSelection;
|
|
63
|
+
private GameObject _previousSelection;
|
|
64
|
+
|
|
65
|
+
private void OnEnable()
|
|
66
|
+
{
|
|
67
|
+
_previousSelection = EventSystem.current?.currentSelectedGameObject;
|
|
68
|
+
if (initialSelection != null)
|
|
69
|
+
EventSystem.current?.SetSelectedGameObject(initialSelection);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private void OnDisable()
|
|
73
|
+
{
|
|
74
|
+
if (_previousSelection != null && _previousSelection.activeInHierarchy)
|
|
75
|
+
EventSystem.current?.SetSelectedGameObject(_previousSelection);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## World-space and diegetic Canvases
|
|
81
|
+
|
|
82
|
+
- Always assign the **`Event Camera`** on every `Render Mode: World Space` Canvas—leaving it null triggers expensive `Camera.main` lookups on raycasts.
|
|
83
|
+
- Scale world-space canvases in physical meters (e.g., `0.002`–`0.005`), disable raycasting on display-only nameplates, and route world-space UI to a separate camera/layer if bloom, motion blur, or depth-of-field degrades text contrast.
|
|
84
|
+
- Pair diegetic/world-space counters with a non-diegetic or accessibility HUD option for low-vision players.
|
|
85
|
+
|
|
86
|
+
## Do/don't pairs
|
|
87
|
+
|
|
88
|
+
| Do | Don't |
|
|
89
|
+
|---|---|
|
|
90
|
+
| Split static frames and per-frame animated HUD elements onto separate sub-Canvases | Put an entire HUD + animated damage numbers under one root `Canvas`, triggering full-tree dirty rebuilds every frame |
|
|
91
|
+
| Configure `CanvasScaler` (`Scale With Screen Size`) + `Screen.safeArea` root container | Design in `Constant Pixel Size` or assume fixed 16:9 1080p edges |
|
|
92
|
+
| Use `TextMeshPro` SDF + Dynamic fallback chains for CJK/Arabic and `SetText(...)` for zero-GC updates | Ship legacy `UI.Text`, Latin-only static atlases, or per-frame string allocations |
|
|
93
|
+
| Use `InputSystemUIInputModule`, `Navigation.Mode.Explicit`, and modal focus restoration | Rely on `Automatic` navigation across scroll views or drop gamepad focus on background clicks |
|
|
94
|
+
| Disable `Raycast Target` on decorative `Image`/`TMP_Text` and assign `Event Camera` on World Space Canvases | Leave `Raycast Target` enabled on every icon and background panel |
|
|
95
|
+
|
|
96
|
+
## Known traps
|
|
97
|
+
|
|
98
|
+
Full-Canvas dirty rebuild spikes from a single animated alpha/text element, `GraphicRaycaster` blocked by transparent decorative images, `TMP` missing CJK/RTL fallback glyphs, `Deselect On Background Click` breaking controller navigation, `ScrollRect` not auto-scrolling to keep keyboard/gamepad selected items in view, and post-processing bloom washing out World Space Canvas text.
|
|
99
|
+
|
|
100
|
+
## Verification commands
|
|
101
|
+
|
|
102
|
+
Run Unity EditMode and PlayMode tests without suppressing failures:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
Unity -batchmode -projectPath . -runTests -testPlatform EditMode && \
|
|
106
|
+
Unity -batchmode -projectPath . -runTests -testPlatform PlayMode
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Profile `Canvas.BuildBatch` and `Canvas.SendWillRenderCanvases` in Unity Profiler + Frame Debugger (`rendered`), walk every menu with controller-only input (`rendered`), and verify aspect-ratio (16:9, 21:9, 32:9, handheld, notched mobile) and pseudo-localized CJK/Arabic builds (`rendered`).
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Unity UI Toolkit
|
|
2
|
+
|
|
3
|
+
Use UI Toolkit (`UIDocument`, UXML, USS, `PanelSettings`) for CSS/Flexbox-inspired retained runtime menus, responsive HUDs, and shared editor/runtime UI in Unity 2022–Unity 6+. For GameObject-based `Canvas`/`TextMeshPro` UI, see `references/unity-ugui.md`.
|
|
4
|
+
|
|
5
|
+
## When to pick UI Toolkit vs uGUI
|
|
6
|
+
|
|
7
|
+
| Choose **UI Toolkit** (`unity-ui-toolkit.md`) | Choose **uGUI** (`unity-ugui.md`) |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Responsive Flexbox menus, settings, inventories, HUD overlays, and shared Editor/Runtime tooling | Complex world-space / diegetic 3D curved/shader UI or UI-integrated particle effects |
|
|
10
|
+
| Unity 6 runtime `DataBinding` and `.tss` theme-sheet swapping (dark / high-contrast / colorblind) | Heavy dependence on existing `TextMeshPro` / uGUI third-party asset packages |
|
|
11
|
+
| Teams comfortable with CSS-like selectors and clean data/view separation | Fine-grained custom `CanvasRenderer` mesh/material hacks |
|
|
12
|
+
|
|
13
|
+
## Token mapping and `PanelSettings` themes
|
|
14
|
+
|
|
15
|
+
Define semantic custom properties in USS and switch palettes cleanly via `ThemeStyleSheet` (`.tss`) on `PanelSettings`:
|
|
16
|
+
|
|
17
|
+
```css
|
|
18
|
+
:root {
|
|
19
|
+
--pc-color-action: rgb(0, 116, 202);
|
|
20
|
+
--pc-color-surface: rgba(16, 20, 28, 0.92);
|
|
21
|
+
--pc-text-primary: rgb(245, 247, 250);
|
|
22
|
+
}
|
|
23
|
+
.primary-action {
|
|
24
|
+
background-color: var(--pc-color-action);
|
|
25
|
+
color: var(--pc-text-primary);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Configure **`PanelSettings`** deliberately per overlay layer:
|
|
30
|
+
|
|
31
|
+
- set `Scale Mode` to `Scale With Screen Size` (with explicit Reference Resolution and Match ratio) or `Constant Physical Size` for touch targets;
|
|
32
|
+
- assign `Sort Order` across independent `UIDocument` panels (HUD < Menu < Modal < System Toast) rather than cramming unrelated trees into one document;
|
|
33
|
+
- attach a dedicated **`PanelTextSettings`** asset defining dynamic SDF font fallback chains;
|
|
34
|
+
- swap `PanelSettings.themeStyleSheet` (or root theme classes) for high-contrast, colorblind, or day/night modes.
|
|
35
|
+
|
|
36
|
+
## Unity 6 runtime Data Binding
|
|
37
|
+
|
|
38
|
+
In Unity 6+, replace manual per-frame `Update()` polling with declarative runtime **`DataBinding`** and **`[CreateProperty]`** (`Unity.Properties`):
|
|
39
|
+
|
|
40
|
+
```csharp
|
|
41
|
+
using Unity.Properties;
|
|
42
|
+
using UnityEngine;
|
|
43
|
+
using UnityEngine.UIElements;
|
|
44
|
+
|
|
45
|
+
public sealed class PlayerHudModel
|
|
46
|
+
{
|
|
47
|
+
[CreateProperty] public string HealthLabel => $"HP {CurrentHp} / {MaxHp}";
|
|
48
|
+
public int CurrentHp { get; set; } = 100;
|
|
49
|
+
public int MaxHp { get; set; } = 100;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public sealed class HudBinder : MonoBehaviour
|
|
53
|
+
{
|
|
54
|
+
[SerializeField] private UIDocument uiDocument;
|
|
55
|
+
private readonly PlayerHudModel _model = new();
|
|
56
|
+
|
|
57
|
+
private void OnEnable()
|
|
58
|
+
{
|
|
59
|
+
var label = uiDocument.rootVisualElement.Q<Label>("health-label");
|
|
60
|
+
label.dataSource = _model;
|
|
61
|
+
label.SetBinding("text", new DataBinding
|
|
62
|
+
{
|
|
63
|
+
dataSourcePath = new PropertyPath(nameof(PlayerHudModel.HealthLabel)),
|
|
64
|
+
bindingMode = BindingMode.ToTarget,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Prefer `BindingMode.ToTarget` for read-only HUD telemetry and `TwoWay` only for interactive settings controls; avoid reflection-heavy ad-hoc polling loops.
|
|
71
|
+
|
|
72
|
+
## Layout, typography, and motion
|
|
73
|
+
|
|
74
|
+
- Use UXML Flexbox (`flex-direction`, `flex-grow`, percentage/`min-*`/`max-*` bounds) plus runtime `Screen.safeArea` padding on the root container; test ultrawide, portrait, and handheld resolutions.
|
|
75
|
+
- Configure TextCore font assets with **SDF/atlas** memory budgets and dynamic fallback chains covering CJK, Arabic/RTL, Cyrillic, and extended Latin; never lock labels to fixed widths that clip German/Finnish expansions.
|
|
76
|
+
- Use USS `transition-*` or experimental animations purposefully, exposing an in-game reduced-motion/flash-reduction setting (never block gameplay state transitions on animation completion).
|
|
77
|
+
|
|
78
|
+
## Unity 6 Runtime Accessibility and focus navigation
|
|
79
|
+
|
|
80
|
+
- **Unity 6 Runtime Accessibility (`UnityEngine.Accessibility`)**: register accessible trees via `AssistiveSupport`, `AccessibilityHierarchy`, and `AccessibilityNode` to expose screen-reader semantics on supported platforms (iOS VoiceOver, Android TalkBack, desktop where enabled); verify actual assistive-tech announcement on target hardware and label unverified platforms `not-checked`.
|
|
81
|
+
- **Controller/keyboard focus**: set `focusable = true` only on actionable elements, configure `tabIndex` and `NavigationMoveEvent` overrides when spatial grids/modals need deterministic D-pad traversal, style `:focus` visibly (never rely solely on `:hover`), and restore `element.Focus()` after closing popups.
|
|
82
|
+
- Model interruption states (pause, disconnect, loading, error, death/respawn, pending purchase) and virtual keyboard/paste support on `TextField` forms.
|
|
83
|
+
|
|
84
|
+
## Do/don't pairs
|
|
85
|
+
|
|
86
|
+
| Do | Don't |
|
|
87
|
+
|---|---|
|
|
88
|
+
| Use USS custom properties and `PanelSettings` `.tss` themes | Hard-code inline colors across UXML and C# callbacks |
|
|
89
|
+
| Use Unity 6 `DataBinding` + `[CreateProperty]` for reactive HUD/menu state | Poll every label and allocate formatted strings inside `Update()` |
|
|
90
|
+
| Configure `PanelTextSettings` dynamic SDF/atlas fallbacks and flexible container bounds | Ship fixed-width labels or Latin-only font atlases that clip or show tofu boxes |
|
|
91
|
+
| Restore `.Focus()` explicitly after modal close and style `:focus` clearly | Let controller focus vanish into a hidden/removed `VisualElement` |
|
|
92
|
+
| Expose `UnityEngine.Accessibility` nodes + colorblind/subtitle/scale toggles | Claim screen-reader support from visual labels alone without testing on device |
|
|
93
|
+
|
|
94
|
+
## Known traps
|
|
95
|
+
|
|
96
|
+
USS syntax gaps compared to browser CSS (no CSS Grid, subset of selectors/shadows), `pickingMode = PickingMode.Position` on full-screen overlay containers blocking clicks underneath (set `PickingMode.Ignore` on non-interactive HUD wrappers), atlas/glyph memory bloat, editor UI Builder preview diverging from runtime `PanelSettings` scaling, and scene-unload focus loss.
|
|
97
|
+
|
|
98
|
+
## Verification commands
|
|
99
|
+
|
|
100
|
+
Run the Unity CLI test runner configured for the repository without suppressing exit codes:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
Unity -batchmode -projectPath . -runTests -testPlatform EditMode && \
|
|
104
|
+
Unity -batchmode -projectPath . -runTests -testPlatform PlayMode
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Verify runtime PlayMode/device screenshots, controller-only traversal, resolution/aspect/safe-area matrix, pseudo-localized CJK/Arabic glyph coverage, accessibility module checks on device (`rendered`), and UI Toolkit Debugger layout inspection (`static`/`rendered`).
|