@thanhnguyxn/pixelcraft 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +20 -0
- package/.antigravity-plugin/plugin.json +32 -0
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +22 -0
- package/.codex-plugin/plugin.json +45 -0
- package/.cursor-plugin/marketplace.json +17 -0
- package/.cursor-plugin/plugin.json +27 -0
- package/.devin-plugin/plugin.json +21 -0
- package/.github/plugin/marketplace.json +34 -0
- package/CHANGELOG.md +159 -0
- package/GEMINI.md +1 -0
- package/LICENSE +21 -0
- package/README.md +264 -2
- package/SECURITY.md +28 -0
- package/assets/README.md +28 -0
- package/assets/pixelcraft-logo-128.png +0 -0
- package/assets/pixelcraft-logo-256.png +0 -0
- package/assets/pixelcraft-logo-512.png +0 -0
- package/bin/pixelcraft.mjs +852 -0
- package/docs/ARCHITECTURE.md +105 -0
- package/docs/DESIGN-RATIONALE.md +191 -0
- package/docs/INSTALL.md +221 -0
- package/evals/README.md +37 -0
- package/evals/fixtures/3d-web-engineering.json +69 -0
- package/evals/fixtures/README.md +36 -0
- package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
- package/evals/fixtures/ai-ui-libraries.json +53 -0
- package/evals/fixtures/audio-visual-accessibility.json +69 -0
- package/evals/fixtures/auth-and-checkout-ui.json +53 -0
- package/evals/fixtures/brandkit-identity-governance.json +48 -0
- package/evals/fixtures/build-and-architecture.json +53 -0
- package/evals/fixtures/canvas-and-node-editors.json +53 -0
- package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
- package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
- package/evals/fixtures/component-systems.json +53 -0
- package/evals/fixtures/component-testing.json +53 -0
- package/evals/fixtures/constrained-voice-and-tv.json +43 -0
- package/evals/fixtures/creative-code-rendering.json +69 -0
- package/evals/fixtures/creative-reference-evidence.json +67 -0
- package/evals/fixtures/data-app-python-marimo.json +49 -0
- package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
- package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
- package/evals/fixtures/desktop-native-workspace.json +48 -0
- package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
- package/evals/fixtures/direction-prototype-complexity.json +29 -0
- package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
- package/evals/fixtures/document-rust-typst-invoice.json +49 -0
- package/evals/fixtures/document-typst-and-print-css.json +43 -0
- package/evals/fixtures/email-mjml-dark-mode.json +49 -0
- package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
- package/evals/fixtures/enterprise-data-ui.json +53 -0
- package/evals/fixtures/extended-tui-toolkits.json +53 -0
- package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
- package/evals/fixtures/file-upload-media-ui.json +53 -0
- package/evals/fixtures/finish-gate-anti-slop.json +30 -0
- package/evals/fixtures/forms-accessibility-negative.json +29 -0
- package/evals/fixtures/forms-validation.json +53 -0
- package/evals/fixtures/game-go-ebitengine.json +49 -0
- package/evals/fixtures/game-godot-gdscript.json +49 -0
- package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
- package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
- package/evals/fixtures/i18n-engineering.json +53 -0
- package/evals/fixtures/local-first-sync.json +53 -0
- package/evals/fixtures/lynxjs.json +53 -0
- package/evals/fixtures/maizzle-email.json +53 -0
- package/evals/fixtures/maps-geospatial.json +53 -0
- package/evals/fixtures/media-og-and-video-export.json +43 -0
- package/evals/fixtures/media-players.json +53 -0
- package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
- package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
- package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
- package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
- package/evals/fixtures/mobile-jetpack-compose.json +49 -0
- package/evals/fixtures/mobile-swiftui-ios.json +49 -0
- package/evals/fixtures/motion-engineering.json +69 -0
- package/evals/fixtures/pdfjs-and-pptx.json +53 -0
- package/evals/fixtures/plan-brownfield-evidence.json +28 -0
- package/evals/fixtures/plan-discovery-interview.json +31 -0
- package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
- package/evals/fixtures/reactive-data-apps.json +53 -0
- package/evals/fixtures/review-evidence-audit.json +43 -0
- package/evals/fixtures/rich-text-and-code-editors.json +53 -0
- package/evals/fixtures/scrollytelling-resilience.json +70 -0
- package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
- package/evals/fixtures/state-architecture.json +53 -0
- package/evals/fixtures/styling-ecosystem.json +53 -0
- package/evals/fixtures/token-tooling.json +53 -0
- package/evals/fixtures/tui-go-bubbletea.json +49 -0
- package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
- package/evals/fixtures/tui-rust-ratatui.json +49 -0
- package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
- package/evals/fixtures/visual-qa-task-evidence.json +29 -0
- package/evals/fixtures/web-3d-engines.json +53 -0
- package/evals/fixtures/web-php-laravel-filament.json +49 -0
- package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
- package/evals/fixtures/workflow-checkpoints.json +30 -0
- package/evals/pixelcraft-accessibility.md +74 -0
- package/evals/pixelcraft-brandkit.md +58 -0
- package/evals/pixelcraft-chat-ui.md +55 -0
- package/evals/pixelcraft-constrained.md +55 -0
- package/evals/pixelcraft-craft.md +76 -0
- package/evals/pixelcraft-data-apps.md +55 -0
- package/evals/pixelcraft-dataviz.md +59 -0
- package/evals/pixelcraft-desktop.md +55 -0
- package/evals/pixelcraft-direction.md +77 -0
- package/evals/pixelcraft-document.md +55 -0
- package/evals/pixelcraft-email.md +55 -0
- package/evals/pixelcraft-extensions.md +55 -0
- package/evals/pixelcraft-game-ui.md +59 -0
- package/evals/pixelcraft-handoff.md +57 -0
- package/evals/pixelcraft-media.md +55 -0
- package/evals/pixelcraft-mobile.md +59 -0
- package/evals/pixelcraft-patterns.md +73 -0
- package/evals/pixelcraft-plan.md +127 -0
- package/evals/pixelcraft-review.md +63 -0
- package/evals/pixelcraft-spatial.md +55 -0
- package/evals/pixelcraft-tokens.md +57 -0
- package/evals/pixelcraft-tui.md +55 -0
- package/evals/pixelcraft-ux.md +59 -0
- package/evals/pixelcraft-visual-qa.md +86 -0
- package/evals/pixelcraft-web.md +89 -0
- package/evals/pixelcraft.md +70 -0
- package/gemini-extension.json +6 -0
- package/install.ps1 +341 -0
- package/install.sh +512 -0
- package/package.json +91 -4
- package/plugin.json +29 -0
- package/scripts/build-adapters.mjs +288 -0
- package/scripts/build-release-archives.mjs +61 -0
- package/scripts/build-skill-zips.mjs +94 -0
- package/scripts/run-evals.mjs +397 -0
- package/scripts/sync-docs.mjs +381 -0
- package/scripts/test-build-adapters.mjs +61 -0
- package/scripts/test-cross-platform-qa.mjs +359 -0
- package/scripts/test-distribution.mjs +203 -0
- package/scripts/test-export-tokens.mjs +361 -0
- package/scripts/test-finish-gate.mjs +271 -0
- package/scripts/test-installers.mjs +216 -0
- package/scripts/test-release-archives.mjs +42 -0
- package/scripts/test-shoot.mjs +87 -0
- package/scripts/test-slop-scan.mjs +416 -0
- package/scripts/test-style-inventory.mjs +234 -0
- package/scripts/test-sync-docs.mjs +140 -0
- package/scripts/test-validate-skills.mjs +195 -0
- package/scripts/validate-skills.mjs +658 -0
- package/skills/pixelcraft/SKILL.md +155 -0
- package/skills/pixelcraft/references/design-brief.md +75 -0
- package/skills/pixelcraft/references/floor.md +90 -0
- package/skills/pixelcraft/references/report-template.md +49 -0
- package/skills/pixelcraft/references/stack-detection.md +226 -0
- package/skills/pixelcraft/references/surface-acceptance.md +52 -0
- package/skills/pixelcraft/references/workflow-checkpoints.md +71 -0
- package/skills/pixelcraft-accessibility/SKILL.md +54 -0
- package/skills/pixelcraft-accessibility/references/apg-patterns.md +64 -0
- package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
- package/skills/pixelcraft-accessibility/references/platforms.md +86 -0
- package/skills/pixelcraft-accessibility/references/verification.md +64 -0
- package/skills/pixelcraft-accessibility/references/wcag22-checks.md +99 -0
- package/skills/pixelcraft-brandkit/SKILL.md +127 -0
- package/skills/pixelcraft-brandkit/references/asset-pipeline.md +165 -0
- package/skills/pixelcraft-brandkit/references/brand-governance.md +82 -0
- package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
- package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
- package/skills/pixelcraft-brandkit/references/logo-methods.md +97 -0
- package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
- package/skills/pixelcraft-brandkit/references/prompt-template.md +87 -0
- package/skills/pixelcraft-brandkit/references/qa-checklist.md +93 -0
- package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
- package/skills/pixelcraft-chat-ui/SKILL.md +57 -0
- package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
- package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
- package/skills/pixelcraft-chat-ui/references/conversation-design.md +84 -0
- package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +77 -0
- package/skills/pixelcraft-chat-ui/references/slack-discord.md +80 -0
- package/skills/pixelcraft-constrained/SKILL.md +52 -0
- package/skills/pixelcraft-constrained/references/specialized-hardware.md +90 -0
- package/skills/pixelcraft-constrained/references/tv-wearables.md +134 -0
- package/skills/pixelcraft-constrained/references/voice-ui.md +104 -0
- package/skills/pixelcraft-craft/SKILL.md +58 -0
- package/skills/pixelcraft-craft/references/color.md +125 -0
- package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
- package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
- package/skills/pixelcraft-craft/references/layout.md +73 -0
- package/skills/pixelcraft-craft/references/motion.md +163 -0
- package/skills/pixelcraft-craft/references/typography.md +110 -0
- package/skills/pixelcraft-data-apps/SKILL.md +86 -0
- package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
- package/skills/pixelcraft-data-apps/references/dash.md +109 -0
- package/skills/pixelcraft-data-apps/references/evidence.md +90 -0
- package/skills/pixelcraft-data-apps/references/gradio.md +103 -0
- package/skills/pixelcraft-data-apps/references/julia-genie.md +89 -0
- package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +91 -0
- package/skills/pixelcraft-data-apps/references/nicegui.md +102 -0
- package/skills/pixelcraft-data-apps/references/observable-framework.md +105 -0
- package/skills/pixelcraft-data-apps/references/panel.md +99 -0
- package/skills/pixelcraft-data-apps/references/r-shiny.md +124 -0
- package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
- package/skills/pixelcraft-data-apps/references/reflex.md +116 -0
- package/skills/pixelcraft-data-apps/references/shiny.md +110 -0
- package/skills/pixelcraft-data-apps/references/streamlit.md +113 -0
- package/skills/pixelcraft-dataviz/SKILL.md +60 -0
- package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
- package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
- package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +107 -0
- package/skills/pixelcraft-dataviz/references/libraries.md +176 -0
- package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
- package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +92 -0
- package/skills/pixelcraft-desktop/SKILL.md +93 -0
- package/skills/pixelcraft-desktop/references/appkit.md +92 -0
- package/skills/pixelcraft-desktop/references/avalonia.md +95 -0
- package/skills/pixelcraft-desktop/references/cpp-gui.md +129 -0
- package/skills/pixelcraft-desktop/references/electron.md +96 -0
- package/skills/pixelcraft-desktop/references/go-gui.md +83 -0
- package/skills/pixelcraft-desktop/references/gtk.md +97 -0
- package/skills/pixelcraft-desktop/references/javafx-swing.md +81 -0
- package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +88 -0
- package/skills/pixelcraft-desktop/references/rust-gui.md +83 -0
- package/skills/pixelcraft-desktop/references/tauri.md +110 -0
- package/skills/pixelcraft-desktop/references/uno-platform.md +71 -0
- package/skills/pixelcraft-desktop/references/winui-wpf.md +98 -0
- package/skills/pixelcraft-desktop/references/working-context.md +84 -0
- package/skills/pixelcraft-direction/SKILL.md +120 -0
- package/skills/pixelcraft-direction/references/composition-library.md +84 -0
- package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
- package/skills/pixelcraft-direction/references/direction-card.md +64 -0
- package/skills/pixelcraft-direction/references/direction-scoring.md +76 -0
- package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
- package/skills/pixelcraft-direction/references/movements.md +71 -0
- package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
- package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
- package/skills/pixelcraft-direction/references/slop-fingerprints.md +83 -0
- package/skills/pixelcraft-direction/references/wildcards.md +47 -0
- package/skills/pixelcraft-document/SKILL.md +58 -0
- package/skills/pixelcraft-document/references/archetypes.md +106 -0
- package/skills/pixelcraft-document/references/pdf-tools.md +314 -0
- package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
- package/skills/pixelcraft-document/references/print-css.md +187 -0
- package/skills/pixelcraft-document/references/slides.md +198 -0
- package/skills/pixelcraft-email/SKILL.md +80 -0
- package/skills/pixelcraft-email/references/client-quirks.md +113 -0
- package/skills/pixelcraft-email/references/html-tables.md +114 -0
- package/skills/pixelcraft-email/references/maizzle.md +54 -0
- package/skills/pixelcraft-email/references/mjml.md +54 -0
- package/skills/pixelcraft-email/references/react-email.md +95 -0
- package/skills/pixelcraft-extensions/SKILL.md +56 -0
- package/skills/pixelcraft-extensions/references/browser-extensions.md +105 -0
- package/skills/pixelcraft-extensions/references/figma-office.md +106 -0
- package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
- package/skills/pixelcraft-extensions/references/raycast.md +98 -0
- package/skills/pixelcraft-extensions/references/vscode-webviews.md +100 -0
- package/skills/pixelcraft-game-ui/SKILL.md +80 -0
- package/skills/pixelcraft-game-ui/references/bevy.md +90 -0
- package/skills/pixelcraft-game-ui/references/godot.md +130 -0
- package/skills/pixelcraft-game-ui/references/hud-principles.md +67 -0
- package/skills/pixelcraft-game-ui/references/love2d.md +77 -0
- package/skills/pixelcraft-game-ui/references/monogame.md +68 -0
- package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
- package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +107 -0
- package/skills/pixelcraft-game-ui/references/unreal-umg.md +80 -0
- package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
- package/skills/pixelcraft-handoff/SKILL.md +50 -0
- package/skills/pixelcraft-handoff/references/design-translation.md +134 -0
- package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
- package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
- package/skills/pixelcraft-media/SKILL.md +49 -0
- package/skills/pixelcraft-media/references/banners-video.md +130 -0
- package/skills/pixelcraft-media/references/og-generation.md +154 -0
- package/skills/pixelcraft-media/references/social-cards.md +71 -0
- package/skills/pixelcraft-mobile/SKILL.md +86 -0
- package/skills/pixelcraft-mobile/references/dotnet-maui.md +91 -0
- package/skills/pixelcraft-mobile/references/flet.md +80 -0
- package/skills/pixelcraft-mobile/references/flutter.md +113 -0
- package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
- package/skills/pixelcraft-mobile/references/ionic-capacitor.md +87 -0
- package/skills/pixelcraft-mobile/references/jetpack-compose.md +129 -0
- package/skills/pixelcraft-mobile/references/kivy.md +82 -0
- package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +86 -0
- package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
- package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
- package/skills/pixelcraft-mobile/references/react-native-expo.md +106 -0
- package/skills/pixelcraft-mobile/references/swiftui.md +200 -0
- package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
- package/skills/pixelcraft-mobile/references/task-state-composition.md +85 -0
- package/skills/pixelcraft-mobile/references/uikit.md +92 -0
- package/skills/pixelcraft-patterns/SKILL.md +75 -0
- package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
- package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
- package/skills/pixelcraft-patterns/references/auth-onboarding.md +44 -0
- package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
- package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
- package/skills/pixelcraft-patterns/references/commerce.md +47 -0
- package/skills/pixelcraft-patterns/references/communication.md +45 -0
- package/skills/pixelcraft-patterns/references/creative-tools.md +42 -0
- package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
- package/skills/pixelcraft-patterns/references/dashboard-admin.md +35 -0
- package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
- package/skills/pixelcraft-patterns/references/marketing.md +44 -0
- package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
- package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
- package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
- package/skills/pixelcraft-patterns/references/pattern-selection.md +80 -0
- package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
- package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
- package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
- package/skills/pixelcraft-patterns/references/settings.md +51 -0
- package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
- package/skills/pixelcraft-plan/SKILL.md +103 -0
- package/skills/pixelcraft-plan/references/design-input.md +69 -0
- package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
- package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
- package/skills/pixelcraft-plan/references/plan-template.md +134 -0
- package/skills/pixelcraft-plan/references/repo-discovery.md +49 -0
- package/skills/pixelcraft-plan/references/stack-freshness.md +67 -0
- package/skills/pixelcraft-plan/references/stack-selection.md +98 -0
- package/skills/pixelcraft-review/SKILL.md +86 -0
- package/skills/pixelcraft-review/references/audit-report.md +69 -0
- package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
- package/skills/pixelcraft-review/references/heuristics.md +63 -0
- package/skills/pixelcraft-review/references/personas.md +53 -0
- package/skills/pixelcraft-review/references/polish.md +78 -0
- package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
- package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
- package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
- package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
- package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
- package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
- package/skills/pixelcraft-review/scripts/slop-scan.mjs +1233 -0
- package/skills/pixelcraft-spatial/SKILL.md +51 -0
- package/skills/pixelcraft-spatial/references/comfort-accessibility.md +39 -0
- package/skills/pixelcraft-spatial/references/platforms.md +147 -0
- package/skills/pixelcraft-tokens/SKILL.md +60 -0
- package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
- package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
- package/skills/pixelcraft-tokens/references/adoption.md +55 -0
- package/skills/pixelcraft-tokens/references/format.md +84 -0
- package/skills/pixelcraft-tokens/references/governance.md +80 -0
- package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
- package/skills/pixelcraft-tokens/references/theme-presets.md +122 -0
- package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
- package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +847 -0
- package/skills/pixelcraft-tui/SKILL.md +76 -0
- package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +79 -0
- package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
- package/skills/pixelcraft-tui/references/ink.md +109 -0
- package/skills/pixelcraft-tui/references/ratatui.md +102 -0
- package/skills/pixelcraft-tui/references/rich.md +82 -0
- package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
- package/skills/pixelcraft-tui/references/textual.md +108 -0
- package/skills/pixelcraft-ux/SKILL.md +56 -0
- package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
- package/skills/pixelcraft-ux/references/feedback-performance.md +50 -0
- package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
- package/skills/pixelcraft-ux/references/forms.md +151 -0
- package/skills/pixelcraft-ux/references/i18n.md +221 -0
- package/skills/pixelcraft-ux/references/laws.md +39 -0
- package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
- package/skills/pixelcraft-ux/references/state-matrix.md +53 -0
- package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
- package/skills/pixelcraft-ux/references/ux-writing.md +44 -0
- package/skills/pixelcraft-visual-qa/SKILL.md +96 -0
- package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
- package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +59 -0
- package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
- package/skills/pixelcraft-visual-qa/references/capture-email.md +38 -0
- package/skills/pixelcraft-visual-qa/references/capture-mobile.md +50 -0
- package/skills/pixelcraft-visual-qa/references/capture-terminal.md +35 -0
- package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
- package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
- package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
- package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
- package/skills/pixelcraft-visual-qa/references/performance-budgets.md +78 -0
- package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
- package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
- package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
- package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
- package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
- package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
- package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +174 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
- package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
- package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +668 -0
- package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1226 -0
- package/skills/pixelcraft-web/SKILL.md +132 -0
- package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
- package/skills/pixelcraft-web/references/adaptive-layout.md +69 -0
- package/skills/pixelcraft-web/references/angular.md +108 -0
- package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
- package/skills/pixelcraft-web/references/astro.md +113 -0
- package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
- package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
- package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
- package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
- package/skills/pixelcraft-web/references/clojurescript.md +88 -0
- package/skills/pixelcraft-web/references/component-systems.md +102 -0
- package/skills/pixelcraft-web/references/component-testing.md +170 -0
- package/skills/pixelcraft-web/references/creative-effects.md +59 -0
- package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
- package/skills/pixelcraft-web/references/elm.md +53 -0
- package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
- package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
- package/skills/pixelcraft-web/references/forms-validation.md +123 -0
- package/skills/pixelcraft-web/references/fsharp-fable.md +54 -0
- package/skills/pixelcraft-web/references/gsap.md +102 -0
- package/skills/pixelcraft-web/references/html-css.md +220 -0
- package/skills/pixelcraft-web/references/htmx-alpine.md +103 -0
- package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
- package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
- package/skills/pixelcraft-web/references/java-web.md +61 -0
- package/skills/pixelcraft-web/references/kotlin-web.md +57 -0
- package/skills/pixelcraft-web/references/leptos-yew.md +97 -0
- package/skills/pixelcraft-web/references/lit-web-components.md +63 -0
- package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
- package/skills/pixelcraft-web/references/media-players.md +104 -0
- package/skills/pixelcraft-web/references/motion-react.md +96 -0
- package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
- package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
- package/skills/pixelcraft-web/references/pwa.md +230 -0
- package/skills/pixelcraft-web/references/qwik.md +94 -0
- package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
- package/skills/pixelcraft-web/references/react-next.md +168 -0
- package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
- package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
- package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
- package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
- package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
- package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
- package/skills/pixelcraft-web/references/server-rendered.md +114 -0
- package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
- package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
- package/skills/pixelcraft-web/references/solid.md +111 -0
- package/skills/pixelcraft-web/references/state-architecture.md +107 -0
- package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
- package/skills/pixelcraft-web/references/svelte.md +111 -0
- package/skills/pixelcraft-web/references/tailwind.md +99 -0
- package/skills/pixelcraft-web/references/video-media.md +69 -0
- package/skills/pixelcraft-web/references/vue-nuxt.md +86 -0
- package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Hypermedia & lightweight enhancement: htmx 2, Alpine.js, Datastar, Unpoly
|
|
2
|
+
|
|
3
|
+
## Choosing the hypermedia layer
|
|
4
|
+
|
|
5
|
+
| Tool | Primary model | Strengths | Watch-outs |
|
|
6
|
+
|---|---|---|---|
|
|
7
|
+
| **htmx 2.x** | HTML attributes driving HTTP partial swaps (`hx-get`/`hx-post`/`hx-swap`) | Tiny footprint, works with any server stack, progressive enhancement via `hx-boost` | Requires explicit focus/ID hygiene and extension packages for SSE/WS/morphing |
|
|
8
|
+
| **Alpine.js** | Declarative local client state (`x-data`, `x-show`, `x-transition`) | Ideal companion for menus, disclosures, tabs, and optimistic local UI | Default build uses `Function()` (needs `@alpinejs/csp` under strict CSP) |
|
|
9
|
+
| **Datastar** | SSE-driven hypermedia + fine-grained reactive client signals (`data-signals`, `data-on-click`) | Unified server-pushed DOM morphing (SSE `datastar-patch-elements`) + reactive signals (~15 KB) with no second client library | Requires SSE-capable server handlers and clear separation of server-authoritative vs client signals |
|
|
10
|
+
| **Unpoly** | Progressive multi-layer HTML navigation (modals/drawers/popups, preloading, compilers) | Built-in history, focus, layer stacks, and form validation conventions out of the box | Opinionated conventions (`up-target`, `up-layer`); heavier than bare htmx |
|
|
11
|
+
|
|
12
|
+
## Token mapping
|
|
13
|
+
|
|
14
|
+
Import generated CSS variables in the base template. Because hypermedia tools swap server-generated fragments, semantic CSS must apply consistently to both full pages and partial responses. Client state (`x-data` / `data-signals`) should toggle semantic classes or `data-*` attributes rather than embedding ad hoc hex/style values.
|
|
15
|
+
|
|
16
|
+
## Layout and responsive idioms
|
|
17
|
+
|
|
18
|
+
Server-driven hypermedia is a feature: design coherent full pages first, then partial enhancement. Use CSS for layout. Targets and swaps must preserve shell structure, scroll behavior, focus, headings, and meaningful URLs (`hx-push-url="true"` / Unpoly history) where appropriate. Alpine belongs to local interaction state, not accidental SPA architecture.
|
|
19
|
+
|
|
20
|
+
## Typography/custom fonts
|
|
21
|
+
|
|
22
|
+
Load fonts once in the base template. Partial responses inherit them; do not inject duplicate font/link tags through fragments. Maintain reading measure in server templates regardless of enhancement.
|
|
23
|
+
|
|
24
|
+
## Motion/reduced motion
|
|
25
|
+
|
|
26
|
+
Use CSS transitions/classes for swap/settle states. In **htmx 2**, `hx-swap="innerHTML transition:true"` opts into the View Transitions API—gate view-transition animations behind `@media (prefers-reduced-motion: no-preference)`. Alpine `x-transition` must also respect reduced motion. Avoid animating replacement in a way that hides content reordering or focus jumps.
|
|
27
|
+
|
|
28
|
+
## Accessibility specifics
|
|
29
|
+
|
|
30
|
+
Fragments must contain valid, complete semantics in context: labels, headings, buttons/links, and live regions where needed. Manage focus after `hx-swap`, especially when replacing the triggering element. Use **Idiomorph** (`hx-ext="morph" hx-swap="morph:outerHTML"`) or **`@alpinejs/morph`** when updating active regions so text-input focus, scroll position, and `<video>` playback survive server updates. Alpine `x-cloak` avoids flash-of-uninitialized behavior but must not hide essential content if JS fails.
|
|
31
|
+
|
|
32
|
+
## htmx 2.x, Alpine plugins, Datastar, and Unpoly idioms
|
|
33
|
+
|
|
34
|
+
- **htmx 2.x specifics**:
|
|
35
|
+
- Use **`hx-on:*`** (e.g., `hx-on::after-request="if(event.detail.successful) this.reset()"`) instead of legacy v1 `hx-on` syntax.
|
|
36
|
+
- Install standalone extension packages (**`htmx-ext-sse`**, **`htmx-ext-ws`**, **`idiomorph`**) rather than assuming v1 built-in extensions.
|
|
37
|
+
- Prevent duplicate form/button mutations with **`hx-disabled-elt="this"`** (or `hx-disabled-elt="find button[type='submit']"`) alongside a visible `htmx-indicator`.
|
|
38
|
+
- Use **`hx-swap="morph"`** (via Idiomorph) when re-rendering forms/lists where preserving DOM identity and focus matters.
|
|
39
|
+
- **Alpine.js official plugins**:
|
|
40
|
+
- **`@alpinejs/csp`**: required when your Content-Security-Policy forbids `'unsafe-eval'`; register component methods via `Alpine.data(...)` instead of inline JS expressions.
|
|
41
|
+
- **`@alpinejs/focus`**: apply `x-trap.inert.noscroll="open"` on modal dialogs to trap focus and mark background siblings `inert`.
|
|
42
|
+
- **`@alpinejs/anchor`**: anchor popovers/dropdowns to triggers when CSS Anchor Positioning browser coverage is insufficient.
|
|
43
|
+
- **`@alpinejs/morph`**: morph server HTML into Alpine trees without resetting child `x-data` state.
|
|
44
|
+
- **Datastar**: bind reactive UI state with `data-signals` and stream DOM patches over SSE (`@get('/events')`) so server-driven updates morph cleanly into place while keeping client-only micro-interactions (toggles, computed previews) instant.
|
|
45
|
+
- **Unpoly**: lean on `up-layer="new modal"` / `up-dismissable` for accessible server-rendered dialogs and `up-preload` for fast MPA links, keeping fallback routes valid as standalone pages.
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<!-- htmx 2: duplicate-submit lock, Idiomorph focus-safe swap, hx-on:* cleanup -->
|
|
49
|
+
<form
|
|
50
|
+
action="/invoices"
|
|
51
|
+
method="post"
|
|
52
|
+
hx-post="/invoices"
|
|
53
|
+
hx-target="#invoice-section"
|
|
54
|
+
hx-swap="morph:outerHTML transition:true"
|
|
55
|
+
hx-disabled-elt="find button[type='submit']"
|
|
56
|
+
hx-on::after-request="if(event.detail.successful) this.reset()"
|
|
57
|
+
>
|
|
58
|
+
<label for="inv-title">Title</label>
|
|
59
|
+
<input id="inv-title" name="title" required autocomplete="off">
|
|
60
|
+
<button type="submit">
|
|
61
|
+
Save invoice
|
|
62
|
+
<span class="htmx-indicator" aria-hidden="true">…</span>
|
|
63
|
+
</button>
|
|
64
|
+
</form>
|
|
65
|
+
|
|
66
|
+
<!-- Alpine + @alpinejs/focus modal dialog -->
|
|
67
|
+
<div x-data="{ open: false }" @keydown.escape.window="open = false">
|
|
68
|
+
<button type="button" @click="open = true">Filter</button>
|
|
69
|
+
<div x-show="open" x-trap.inert.noscroll="open" role="dialog" aria-modal="true" aria-labelledby="filter-heading">
|
|
70
|
+
<h2 id="filter-heading">Filter invoices</h2>
|
|
71
|
+
<button type="button" @click="open = false">Close</button>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## States & Forms idiom
|
|
77
|
+
|
|
78
|
+
Return real HTML error/empty/partial fragments from the server—not bare 422 JSON with a generic toast. Configure htmx `responseHandling` (v2) or return swap-enabled 422 error fragments so validation errors render adjacent to inputs while preserving submitted values. Out-of-band swaps (`hx-swap-oob`) need clear ID ownership and zero duplicated IDs.
|
|
79
|
+
|
|
80
|
+
## Do/don't pairs
|
|
81
|
+
|
|
82
|
+
| Do | Don't |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `<a href="/invoices" hx-boost="true">Invoices</a>` | `<span hx-get="/invoices">Invoices</span>` pretending to be navigation |
|
|
85
|
+
| `hx-disabled-elt="this"` + visible `htmx-indicator` | Silent background mutation allowing rapid duplicate POSTs |
|
|
86
|
+
| `hx-swap="morph"` (Idiomorph) when preserving focus/form inputs | Blind `outerHTML` swap over an active input that drops keyboard focus |
|
|
87
|
+
| `@alpinejs/csp` + `Alpine.data(...)` under strict CSP headers | Relaxing CSP with `'unsafe-eval'` just to keep inline Alpine expressions |
|
|
88
|
+
| `@alpinejs/focus` `x-trap.inert.noscroll` or native `<dialog>` | Unmanaged `x-show` modal that lets Tab escape into the page behind it |
|
|
89
|
+
| Render validation fragment with preserved values and adjacent errors | Returning only `422` with a disappearing toast or clearing the form |
|
|
90
|
+
|
|
91
|
+
## Known traps
|
|
92
|
+
|
|
93
|
+
Forgetting that htmx 2 ignores 4xx/5xx swaps unless configured (`responseHandling` / 422 swap rule), missing separate `htmx-ext-sse`/`htmx-ext-ws`/`idiomorph` packages in htmx 2, invalid nested HTML after swaps, focus disappearing with replaced triggers, duplicated IDs across OOB swaps, Alpine CSP errors without `@alpinejs/csp`, breaking the no-JS baseline.
|
|
94
|
+
|
|
95
|
+
## Verification commands
|
|
96
|
+
|
|
97
|
+
Run the owning server framework's test suite and browser E2E suite without suppressing failures:
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
npm test && npx playwright test
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Test both no-JS/full-page behavior and enhanced fragment/SSE behavior in a real browser (`rendered`); both are separate evidence.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Internationalization and localization engineering
|
|
2
|
+
|
|
3
|
+
Internationalization is not string replacement. Ship locale-aware formatting (`Intl`), ICU plurals/selects, lazy-loaded translation chunks, explicit fallback chains, locale routing, RTL layout mirroring, and script-appropriate font fallback. For UX copy expansion, pseudo-localization, and RTL layout checks, see `pixelcraft-ux`.
|
|
4
|
+
|
|
5
|
+
## Library decision matrix
|
|
6
|
+
|
|
7
|
+
| Library | Model | Message format | Best fit | Primary trade-off |
|
|
8
|
+
|---|---|---|---|---|
|
|
9
|
+
| **`next-intl`** | Next.js App Router native RSC + client (`getTranslations`/`useTranslations`) + typed locale routing | **ICU MessageFormat** | Next.js App Router apps needing static/dynamic RSC i18n, locale prefix routing, and minimal client payload | Next.js-specific; avoid passing entire message catalogs into `<NextIntlClientProvider>` |
|
|
10
|
+
| **i18next** (`react-i18next`) | Runtime key/namespace lookup + backend plugins | i18next JSON (`_one`/`_other` CLDR) or ICU plugin | Multi-framework apps, CMS/TMS-driven runtime loading, React Native | Requires explicit `fallbackLng` (defaults to `false` in v27+) and `intl-pluralrules` polyfill on Hermes |
|
|
11
|
+
| **FormatJS / React Intl** | Runtime / pre-compiled AST | Standard **ICU MessageFormat** | Enterprise React apps needing strict ICU plurals, selects, and `Intl` skeletons | Larger runtime unless pre-compiling ASTs at build time |
|
|
12
|
+
| **Lingui** (v5+) | Compile-time macros + compiled `.po`/JSON catalogs | **ICU MessageFormat** (via macros) | React/RSC/Vite/Next.js apps wanting tiny runtime + clean source-text IDs | Requires Babel/SWC macro plugin + `lingui extract` / `lingui compile` pipeline |
|
|
13
|
+
| **Paraglide JS** | Compiler-first ESM functions | Compiled JS functions (`m.greeting(...)`) | Vite, SvelteKit, Astro, React Router apps prioritizing tree-shaking & type safety | Rebuild/compile step when messages change; best for static/build-time catalogs |
|
|
14
|
+
| **Vue I18n** (v11) | Framework-native Composition API (`legacy: false`) | Vue I18n / linked messages + `Intl` formats | Vue 3 / Nuxt (`@nuxtjs/i18n`) apps | Must set `legacy: false` for Composition API `useI18n()` |
|
|
15
|
+
| **Angular `@angular/localize`** | Compile-time AOT bundle-per-locale | XLIFF / JSON + ICU | Angular apps prioritizing zero runtime translation overhead | Switching locale reloads the app to the target locale bundle |
|
|
16
|
+
|
|
17
|
+
## Implementation idioms
|
|
18
|
+
|
|
19
|
+
### `next-intl` (Next.js App Router)
|
|
20
|
+
|
|
21
|
+
- Keep translations on the server via `await getTranslations('Checkout')` in Server Components (zero translation bytes sent to client). When Client Components need strings, pass only the specific namespace subset into `<NextIntlClientProvider messages={pick(messages, ['Checkout'])}>` and configure `defineRouting` + `createNavigation` for locale-prefixed `<Link>` / `redirect`.
|
|
22
|
+
|
|
23
|
+
### i18next (namespaces, lazy loading, fallback chains)
|
|
24
|
+
|
|
25
|
+
- Split translations by route/feature namespace and lazy-load via `i18next-resources-to-backend` or `i18next-http-backend` so the initial bundle does not ship every locale.
|
|
26
|
+
- Always configure `fallbackLng` explicitly (including regional/script fallbacks like `'zh-Hant': ['zh-Hans', 'en']`). Since i18next v24, pluralization depends on `Intl.PluralRules` with no legacy fallback; polyfill `import 'intl-pluralrules'` on runtimes lacking it (such as React Native Hermes).
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import i18next from 'i18next';
|
|
30
|
+
import resourcesToBackend from 'i18next-resources-to-backend';
|
|
31
|
+
|
|
32
|
+
i18next
|
|
33
|
+
.use(resourcesToBackend((lng: string, ns: string) => import(`./locales/${lng}/${ns}.json`)))
|
|
34
|
+
.init({
|
|
35
|
+
fallbackLng: {
|
|
36
|
+
'zh-Hant': ['zh-Hans', 'en'],
|
|
37
|
+
default: ['en'],
|
|
38
|
+
},
|
|
39
|
+
ns: ['common'],
|
|
40
|
+
defaultNS: 'common',
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### FormatJS / React Intl (ICU MessageFormat & `Intl` skeletons)
|
|
45
|
+
|
|
46
|
+
- Always include the required `other` branch in ICU `{plural}` and `{select}` expressions (omitting `other` throws at runtime).
|
|
47
|
+
- Let the formatter own currency symbols, decimal separators, and placement (`::currency/USD` or `intl.formatNumber`)—never concatenate `$` or `%` in template strings.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
intl.formatMessage(
|
|
51
|
+
{
|
|
52
|
+
id: 'cart.summary',
|
|
53
|
+
defaultMessage:
|
|
54
|
+
'{count, plural, one {# item} other {# items}} — total {total, number, ::currency/USD}',
|
|
55
|
+
},
|
|
56
|
+
{ count, total },
|
|
57
|
+
);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Lingui v5+ (macros, lazy catalogs, RSC)
|
|
61
|
+
|
|
62
|
+
- Import macros from `@lingui/core/macro` (`t`, `plural`, `select`, `msg`) and `@lingui/react/macro` (`Trans`, `useLingui`)—not the deprecated `@lingui/macro`.
|
|
63
|
+
- Never call `t` / `plural` / `select` at module top level (they freeze to the initial locale); use `msg` for module-level descriptors and translate with `i18n._(descriptor)` inside render.
|
|
64
|
+
- Lazy-load compiled catalogs with `i18n.loadAndActivate({ locale, messages })`. In React Server Components, call `setI18n` from `@lingui/react/server` in every page and layout.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { i18n } from '@lingui/core';
|
|
68
|
+
|
|
69
|
+
export async function dynamicActivate(locale: string) {
|
|
70
|
+
const { messages } = await import(`./locales/${locale}/messages.mjs`);
|
|
71
|
+
i18n.loadAndActivate({ locale, messages });
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Paraglide JS & Vue I18n
|
|
76
|
+
|
|
77
|
+
- **Paraglide JS**: configure `paraglideVitePlugin({ project, outdir, strategy: ['url', 'cookie', 'baseLocale'] })`, call tree-shaken `m.greeting({ name })`, and switch locales via `setLocale('de')`.
|
|
78
|
+
- **Vue I18n**: initialize `createI18n({ legacy: false, locale, fallbackLocale })`, lazy-load locale JSON in `router.beforeEach` via `i18n.global.setLocaleMessage(locale, mod.default)`, and sync `<html lang>` and `dir`.
|
|
79
|
+
|
|
80
|
+
## Locale routing, RTL, bidirectional isolation, and script/font fallback
|
|
81
|
+
|
|
82
|
+
- **Document attributes & `hreflang` (`x-default`)**: update both `<html lang="ar">` and `<html dir="rtl">` (or `dir="ltr"`) whenever the active locale changes; on every SEO-indexed localized route, emit a self-referencing `<link rel="canonical" href="https://example.com/vi/pricing">`, reciprocal `<link rel="alternate" hreflang="vi" href="...">` links for every translated locale, and an explicit `<link rel="alternate" hreflang="x-default" href="https://example.com/pricing">` fallback URL.
|
|
83
|
+
- **Mixed-direction isolation (Unicode UAX #9)**: wrap interpolated user-generated or unknown-direction text (usernames, product titles, file paths) in `<bdi>` or set `dir="auto"` / `unicode-bidi: isolate` (never legacy `unicode-bidi: embed`) so opposite-direction characters do not bleed into surrounding punctuation and numbers.
|
|
84
|
+
- **Logical CSS & selective mirroring**: use CSS logical properties (`margin-inline-start`, `padding-inline-end`, `inset-inline-start`, `text-align: start`). Mirror directional navigation icons (back/forward arrows, chevrons) in RTL, but **never** mirror clocks, media playback scrubbers, checkmarks, or mathematical/time-series graphs.
|
|
85
|
+
- **Locale-aware formatting (`Intl.*` + `Temporal`)**: use `Intl.DateTimeFormat`, `Intl.NumberFormat`, `Intl.RelativeTimeFormat`, **`Intl.DurationFormat`** (`new Intl.DurationFormat(locale, { style: 'short' }).format({ hours: 1, minutes: 25 })`), `Intl.ListFormat`, and `Intl.Collator` instead of hardcoded `MM/DD/YYYY`, `"1h 25m"`, `.toFixed(2)`, or `.sort()`. For calendar-date and timezone/DST arithmetic, prefer **`Temporal`** (`Temporal.PlainDate`, `Temporal.ZonedDateTime`, backed by `temporal-polyfill` where native `Temporal` is not yet shipped) instead of error-prone legacy `Date` mutation. Track **Unicode MessageFormat 2 (LDML Part 9 / TC39 `Intl.MessageFormat`)** as the evolving standard successor to ICU MessageFormat 1.
|
|
86
|
+
- **Font and script fallback**: pair Latin display/body fonts with explicit script-specific fallbacks (`@font-face` with `unicode-range` for Arabic, Devanagari, Thai, CJK) and increase `line-height` slightly for tall/diacritic scripts (Arabic, Vietnamese, Thai) so ascenders/descenders do not clip.
|
|
87
|
+
|
|
88
|
+
## Do/don't pairs
|
|
89
|
+
|
|
90
|
+
| Do | Don't |
|
|
91
|
+
|---|---|
|
|
92
|
+
| Use ICU `{plural}` / `{select}` with an `other` branch | Concatenate `count + (count === 1 ? ' item' : ' items')` (breaks Slavic/Arabic plural rules) |
|
|
93
|
+
| Format dates, currencies, durations (`Intl.DurationFormat`), lists, and sorting with `Intl.*` + `Temporal` | Hardcode `$`, `MM/DD/YYYY`, `"2h 15m"`, or fragile `Date` timezone math |
|
|
94
|
+
| Lazy-load per-locale / per-namespace translation chunks (or keep them in RSC via `next-intl`) | Bundle all 15 language JSON files into the initial client chunk |
|
|
95
|
+
| Use `msg` at module scope in Lingui and `@lingui/core/macro` imports | Call `t` at module top level or import deprecated `@lingui/macro` |
|
|
96
|
+
| Sync `<html lang>` + `<html dir>` and use CSS logical properties | Use physical `left`/`right` margins or flip media scrubbers in RTL |
|
|
97
|
+
| Configure `fallbackLng` explicitly in i18next v27+ and `legacy: false` in Vue I18n | Assume i18next defaults to `'en'` or use Vue I18n legacy mode with `useI18n()` |
|
|
98
|
+
|
|
99
|
+
## Verification commands
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
npm run build
|
|
103
|
+
npx playwright test
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Verify that unused locale chunks are split out of the initial bundle (`static`), and test pseudo-localized / long-string locales (e.g. German +35% width), RTL (`ar`/`he`), and CJK/Vietnamese diacritic rendering in a real browser (`rendered`).
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Micro-interaction, search, icon, font, and image primitives
|
|
2
|
+
|
|
3
|
+
Stop hand-rolling fragile command palettes, swipeable drawers, toast queues, carousels, date grids, split panes, or search highlighters from scratch. Use native HTML primitives where sufficient (`<dialog>`, `[popover]`, `<input type="date">`, CSS Scroll Snap) and vetted, accessible libraries when interaction physics, keyboard navigation, or search ranking exceeds native HTML.
|
|
4
|
+
|
|
5
|
+
## Micro-interaction primitives
|
|
6
|
+
|
|
7
|
+
| Primitive | Recommended libraries | Core capabilities & accessibility contract | Avoid hand-rolling when |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| **Command palette** | **`cmdk`** (React), **`kbar`** (React) | ARIA `combobox` + `listbox`, `aria-activedescendant`, keyboard Arrow/Home/End/Enter/Esc, focus restoration to trigger, `shouldFilter={false}` for async server search, nested shortcut actions (`kbar`) | Any `⌘K`/`Ctrl+K` launcher, action menu, or multi-source quick-switcher |
|
|
10
|
+
| **Drawer / bottom sheet** | **`vaul`** (React; Radix Dialog core) | Touch velocity & drag physics, `snapPoints` / `activeSnapPoint`, `Escape` dismiss, inert background, focus trap & restoration, `prefers-reduced-motion` instant snap | Mobile sheets, filter drawers, or gesture-dismissible trays |
|
|
11
|
+
| **Toast notifications** | **`sonner`** (React; `vue-sonner`, `svelte-sonner`) | Stacked expansion, pause-on-hover and pause-on-focus, `aria-live="polite"`, swipe dismiss, built-in `action` button for reversible **Undo** flows | Any transient feedback; **never** put blocking form validation or critical errors solely inside an auto-dismissing toast |
|
|
12
|
+
| **Carousels** | **Embla Carousel** (default), **Splide**, **Swiper** | **Embla**: ~7 KB headless physics, plugin ecosystem, zero CSS lock-in; **Splide**: zero-dep with built-in accessible live-region controls; **Swiper**: heavy feature set (3D coverflow, virtual slides, synced thumbs) | Media galleries or horizontal shelves needing keyboard Prev/Next, `role="region" aria-roledescription="carousel"`, pauseable autoplay, and `prefers-reduced-motion` instant jumps |
|
|
13
|
+
| **Date pickers** | **`react-day-picker`** (v9), **React Aria `DatePicker`** | `locale` + `timeZone` support, single/range/multiple selection, full keyboard calendar grid (`Arrow`, `PageUp`/`PageDown`, `Home`/`End`), screen-reader date announcements | Date ranges, disabled-date calendars, or multi-locale pickers (use native `<input type="date">` for simple single dates like birthdates) |
|
|
14
|
+
| **Split panes** | **`react-resizable-panels`** | Keyboard-resizable `role="separator"` handles (`Arrow`, `Home`/`End`), `minSize`/`maxSize`/collapsible constraints, `autoSaveId` persisted layout without hydration flash | IDE panes, master-detail inspectors, or diff views |
|
|
15
|
+
|
|
16
|
+
### Command palette (`cmdk`) + Undo toast (`sonner`) idiom
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
'use client';
|
|
20
|
+
|
|
21
|
+
import { useEffect, useRef, useState } from 'react';
|
|
22
|
+
import { Command } from 'cmdk';
|
|
23
|
+
import { toast } from 'sonner';
|
|
24
|
+
|
|
25
|
+
export function QuickSearch({ open, onOpenChange }: { open: boolean; onOpenChange: (v: boolean) => void }) {
|
|
26
|
+
const [query, setQuery] = useState('');
|
|
27
|
+
const [items, setItems] = useState<{ id: string; title: string }[]>([]);
|
|
28
|
+
const [status, setStatus] = useState<'idle' | 'loading' | 'error'>('idle');
|
|
29
|
+
const abortRef = useRef<AbortController | null>(null);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!open) return;
|
|
33
|
+
abortRef.current?.abort();
|
|
34
|
+
const controller = new AbortController();
|
|
35
|
+
abortRef.current = controller;
|
|
36
|
+
|
|
37
|
+
const timer = setTimeout(async () => {
|
|
38
|
+
setStatus('loading');
|
|
39
|
+
try {
|
|
40
|
+
const res = await fetch(`/api/search?q=${encodeURIComponent(query)}`, { signal: controller.signal });
|
|
41
|
+
if (!res.ok) throw new Error('Search request failed');
|
|
42
|
+
setItems(await res.json());
|
|
43
|
+
setStatus('idle');
|
|
44
|
+
} catch (err) {
|
|
45
|
+
if ((err as Error).name !== 'AbortError') setStatus('error');
|
|
46
|
+
}
|
|
47
|
+
}, 150);
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
controller.abort();
|
|
52
|
+
};
|
|
53
|
+
}, [open, query]);
|
|
54
|
+
|
|
55
|
+
function archiveItem(item: { id: string; title: string }) {
|
|
56
|
+
onOpenChange(false);
|
|
57
|
+
toast(`Archived "${item.title}"`, {
|
|
58
|
+
action: { label: 'Undo', onClick: () => fetch(`/api/items/${item.id}/restore`, { method: 'POST' }) },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Command.Dialog open={open} onOpenChange={onOpenChange} label="Global search" shouldFilter={false}>
|
|
64
|
+
<Command.Input value={query} onValueChange={setQuery} placeholder="Search invoices or actions…" />
|
|
65
|
+
<Command.List>
|
|
66
|
+
{status === 'loading' && <Command.Loading>Searching…</Command.Loading>}
|
|
67
|
+
{status === 'error' && <div role="alert">Search failed. Retry or check your connection.</div>}
|
|
68
|
+
{status === 'idle' && items.length === 0 && (
|
|
69
|
+
<Command.Empty>
|
|
70
|
+
No results for “{query}”.{' '}
|
|
71
|
+
<button type="button" onClick={() => setQuery('')}>Clear search</button>
|
|
72
|
+
</Command.Empty>
|
|
73
|
+
)}
|
|
74
|
+
{items.map((item) => (
|
|
75
|
+
<Command.Item key={item.id} value={item.id} onSelect={() => archiveItem(item)}>
|
|
76
|
+
{item.title}
|
|
77
|
+
</Command.Item>
|
|
78
|
+
))}
|
|
79
|
+
</Command.List>
|
|
80
|
+
</Command.Dialog>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Accessible carousel (`Embla`) & drawer (`vaul`) guardrails
|
|
86
|
+
|
|
87
|
+
- **Embla Carousel**: pair `useEmblaCarousel({ loop: false, duration: prefersReducedMotion ? 0 : 25 })` with explicit Previous/Next `<button>` controls, a visible slide indicator (`aria-current="true"`), and a live announcement (`aria-live="polite"`) only when the user explicitly advances slides—never auto-advance without a Pause button (WCAG 2.2.2).
|
|
88
|
+
- **Vaul Drawer**: always provide `<Drawer.Title>` and `<Drawer.Description>` (visually hidden only when redundant) so screen readers announce the dialog name; set `repositionInputs` thoughtfully on iOS Safari keyboards; respect `prefers-reduced-motion` by disabling spring overshoots.
|
|
89
|
+
- **Resizable panels**: give every `<PanelResizeHandle>` an explicit `aria-label` (e.g., `aria-label="Resize sidebar"`) and a visible `:focus-visible` indicator with at least a 4px interactive hit target.
|
|
90
|
+
|
|
91
|
+
### Global single-key hotkey guard & Safe-Triangle cascading menus
|
|
92
|
+
|
|
93
|
+
- **Single-key shortcut guard**: global single-key shortcuts (`/`, `,`, `c`, `?`, `j`/`k`, `e`) **must ignore** events whenever an IME composition is active (`event.isComposing || event.keyCode === 229`), a system modifier (`metaKey`, `ctrlKey`, `altKey`) is held, or focus resides inside `<input>`, `<textarea>`, `<select>`, `[contenteditable="true"]`, `[contenteditable="plaintext-only"]`, or `[role="textbox"]` (including across Shadow DOM via `event.composedPath()`):
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
export function shouldIgnoreSingleKeyHotkey(event: KeyboardEvent): boolean {
|
|
97
|
+
if (event.defaultPrevented || event.isComposing || event.keyCode === 229) return true;
|
|
98
|
+
if (event.metaKey || event.ctrlKey || event.altKey) return true;
|
|
99
|
+
for (const node of event.composedPath()) {
|
|
100
|
+
if (!(node instanceof HTMLElement)) continue;
|
|
101
|
+
if (node.isContentEditable) return true;
|
|
102
|
+
const tag = node.tagName;
|
|
103
|
+
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return true;
|
|
104
|
+
if (node.getAttribute('role') === 'textbox' || node.getAttribute('role') === 'combobox') return true;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- **Safe-Triangle submenu pointer corridor**: cascading hover/pointer submenus (`Menu.Sub` in `@base-ui/react`, `radix-ui`, Ariakit, or `useHover(context, { handleClose: safePolygon() })` in `@floating-ui/react`) must maintain a diagonal pointer corridor between the parent item's exit point and the submenu's near/far corners (`~75–150 ms` intent window) so diagonal mouse movement never collapses the submenu mid-flight, while keeping `ArrowRight`/`ArrowLeft`/`Escape` keyboard parity intact.
|
|
111
|
+
|
|
112
|
+
## Search UI engineering
|
|
113
|
+
|
|
114
|
+
Choose the search architecture by **index size, freshness, hosting budget, and ranking needs**:
|
|
115
|
+
|
|
116
|
+
| Engine / UI layer | Execution model | Best fit | Critical constraints |
|
|
117
|
+
|---|---|---|---|
|
|
118
|
+
| **Pagefind** | Build-time static WASM index chunked on demand | Astro, static docs, marketing sites, blogs (0 backend cost, scales to tens of thousands of pages) | Static build-time freshness only; run `npx pagefind --site dist` in build pipeline |
|
|
119
|
+
| **Orama** | In-browser or edge JS/TS full-text + vector hybrid | Interactive client/edge search, local-first docs, semantic + keyword blending | Budget serialized index download size for large corpora |
|
|
120
|
+
| **Fuse.js** | Lightweight client fuzzy matching | Small in-memory datasets (< ~5,000 short records) like command palettes or local filter lists | Main-thread CPU degrades sharply on large text bodies—move to a Web Worker or Pagefind/Orama beyond small sets |
|
|
121
|
+
| **Algolia InstantSearch** | Hosted typo-tolerant search + UI widgets/hooks | E-commerce catalogs, multi-facet directories, instant federated search | Metered hosted billing; keep public search-only API key strictly scoped |
|
|
122
|
+
| **Meilisearch** / **Typesense** | Self-hosted or cloud open-source engines + InstantSearch adapters (`instant-meilisearch`, `typesense-instantsearch-adapter`) | Fast typo-tolerant faceted search with predictable infrastructure costs and InstantSearch UI parity | Enforce tenant/filter security via server-issued scoped search keys, never expose master keys |
|
|
123
|
+
|
|
124
|
+
### Mandatory search UX contract
|
|
125
|
+
|
|
126
|
+
1. **Abort stale requests**: use `AbortController` (or monotonic request IDs) so a slow earlier query never overwrites a newer result set.
|
|
127
|
+
2. **Safe match highlighting**: render highlights from structured match indices/tokens into React/framework `<mark>` elements—never feed raw HTML strings into `dangerouslySetInnerHTML` without strict sanitization.
|
|
128
|
+
3. **URL synchronization**: sync query (`?q=`) and active facets to URL search params (`replaceState` while typing, `pushState` on facet toggles) so back/forward and shared links preserve results.
|
|
129
|
+
4. **Empty-result recovery**: state what was searched, show active filters that may have over-constrained the result, and offer a one-click reset or broader suggestion.
|
|
130
|
+
|
|
131
|
+
## Icon, font, and image craft
|
|
132
|
+
|
|
133
|
+
### Icons (`Lucide`, `Phosphor`, `Tabler`, `Iconify`)
|
|
134
|
+
|
|
135
|
+
- **Lucide**: clean 24px geometric 2px-stroke baseline for modern web apps.
|
|
136
|
+
- **Phosphor Icons**: 6 weights (`thin`, `light`, `regular`, `bold`, `fill`, `duotone`)—strong choice when brand tone or active-nav filled states need optical weight variation.
|
|
137
|
+
- **Tabler Icons**: 5,000+ crisp icons suited to technical, data, and operational dashboards.
|
|
138
|
+
- **Iconify**: unified schema across 150+ open sets—compile icons at build time (`unplugin-icons` / SVG sprites) rather than fetching icons at runtime from a third-party CDN on critical interactive controls.
|
|
139
|
+
- **Craft rules**: pick **one** icon library and consistent stroke weight per surface; tree-shake named imports (never import an entire icon barrel); mark decorative icons `aria-hidden="true"` and give icon-only buttons a concise `aria-label` or visually hidden text.
|
|
140
|
+
|
|
141
|
+
### Fonts (`Fontsource`)
|
|
142
|
+
|
|
143
|
+
- Prefer **`@fontsource-variable/*`** (or static `@fontsource/*`) self-hosted packages over third-party Google Fonts `<link>` tags: automatic unicode-range subsetting, same-origin HTTP/2+ caching, zero external DNS/TLS hop, and zero third-party IP leakage.
|
|
144
|
+
- Pair `font-display: swap` with metric-matched fallback stacks (`size-adjust`, `ascent-override`, `descent-override` or framework font helpers like `next/font`) to eliminate layout shift (CLS).
|
|
145
|
+
|
|
146
|
+
### Responsive images & low-byte placeholders (`Unpic`, `ThumbHash`, `BlurHash`)
|
|
147
|
+
|
|
148
|
+
- **Unpic** (`@unpic/react`, `@unpic/svelte`, `@unpic/vue`, `@unpic/astro`): detects major image CDNs (Cloudflare, Cloudinary, Imgix, Shopify, Vercel, Netlify) and emits responsive `srcset`, `sizes`, explicit `width`/`height`, and `priority` (`fetchPriority="high"`, `loading="eager"`) for LCP hero images without writing brittle URL math.
|
|
149
|
+
- **ThumbHash** (preferred over **BlurHash**): encodes aspect ratio, alpha channel, and richer color gradients in ~25 bytes (stored directly in the DB/API payload alongside the image URL) and decodes synchronously to an instant placeholder data URL with zero extra network round-trips.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
import { Image } from '@unpic/react';
|
|
153
|
+
import { thumbHashToDataURL } from 'thumbhash';
|
|
154
|
+
|
|
155
|
+
export function ProductPhoto({ src, alt, width, height, thumbhashBytes, isLcp }: {
|
|
156
|
+
src: string;
|
|
157
|
+
alt: string;
|
|
158
|
+
width: number;
|
|
159
|
+
height: number;
|
|
160
|
+
thumbhashBytes?: Uint8Array;
|
|
161
|
+
isLcp?: boolean;
|
|
162
|
+
}) {
|
|
163
|
+
const placeholder = thumbhashBytes ? thumbHashToDataURL(thumbhashBytes) : undefined;
|
|
164
|
+
return (
|
|
165
|
+
<Image
|
|
166
|
+
src={src}
|
|
167
|
+
alt={alt}
|
|
168
|
+
width={width}
|
|
169
|
+
height={height}
|
|
170
|
+
priority={isLcp}
|
|
171
|
+
background={placeholder}
|
|
172
|
+
sizes="(max-width: 768px) 100vw, 480px"
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Do/don't pairs
|
|
179
|
+
|
|
180
|
+
| Do | Don't |
|
|
181
|
+
|---|---|
|
|
182
|
+
| Use `cmdk`/`kbar`, `vaul`, `sonner`, Embla, `react-day-picker`, and `react-resizable-panels` when native HTML falls short | Hand-roll `keydown` command palettes, touch drag sheets, or custom toast timers from scratch |
|
|
183
|
+
| Set `shouldFilter={false}` in `cmdk` and abort stale fetches with `AbortController` | Mix client fuzzy filtering with async server results or let slow responses overwrite newer keystrokes |
|
|
184
|
+
| Use `sonner` with an Undo action for reversible non-blocking confirmations | Put form validation errors or critical failures only in auto-dismissing toasts |
|
|
185
|
+
| Use Pagefind (static SSG), Orama (in-browser/edge), or InstantSearch (Algolia/Meilisearch/Typesense) | Ship a 10 MB JSON blob into `Fuse.js` on the main thread |
|
|
186
|
+
| Compile/tree-shake one icon family (`Lucide`/`Phosphor`/`Tabler`/`unplugin-icons`) and self-host subsets with `Fontsource` | Mix three icon stroke styles, fetch icons from runtime CDNs on critical controls, or ship unsubsetted multi-MB font files |
|
|
187
|
+
| Emit responsive `srcset`/`sizes` + `priority` on LCP images (`Unpic`) and ~25-byte `ThumbHash` placeholders | Serve raw 4K PNGs with `loading="lazy"` on the LCP image or trigger CLS without `width`/`height` |
|
|
188
|
+
|
|
189
|
+
## Verification commands
|
|
190
|
+
|
|
191
|
+
```sh
|
|
192
|
+
npm run build
|
|
193
|
+
npx playwright test
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Inspect bundle chunk sizes and verify no whole-library icon barrels or raw JSON search indices bloat the initial payload (`static`). In a real browser, test `⌘K` open/filter/Esc focus restoration, swipeable drawer + keyboard dismissal, toast pause-on-focus + Undo, carousel keyboard/reduced-motion behavior, empty search recovery, and zero-CLS image/font loading (`rendered`).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Java web: Vaadin Flow / Hilla, Thymeleaf + htmx, JTE, Quarkus Qute
|
|
2
|
+
|
|
3
|
+
## Stack selection
|
|
4
|
+
|
|
5
|
+
| Stack | Rendering model | Best fit | Primary watch-out |
|
|
6
|
+
|---|---|---|---|
|
|
7
|
+
| **Vaadin Flow** | Server-side Java UI driving Web Components over XHR/WebSocket | Internal enterprise apps owned purely by Java teams | Stateful server session memory and disconnect/reconnect UX |
|
|
8
|
+
| **Vaadin Hilla** | React + TypeScript frontend + auto-generated typed RPC from Spring `@BrowserCallable` endpoints | Java/Spring Boot backends needing modern React/Vite UI and offline/client responsiveness | Treat frontend with full React/WCAG/token discipline; never bypass `@RolesAllowed` / `@AnonymousAllowed` on endpoints |
|
|
9
|
+
| **Spring Boot + Thymeleaf + htmx** | Server-rendered HTML templates + `htmx-spring-boot` (`@HxRequest`) fragment controllers | Public web apps, CRUD portals, progressive enhancement | Include `Vary: HX-Request` on dual full-page/fragment routes and wire Spring Security CSRF header |
|
|
10
|
+
| **JTE (Java Template Engine)** | Precompiled, type-safe `.jte` templates with contextual HTML/JS/CSS escaping | High-throughput Spring Boot / Javalin / Ktor server HTML with compile-time checking | Keep business logic out of templates; configure precompiled mode for production |
|
|
11
|
+
| **Quarkus Qute** | Build-time type-checked reactive templates (native-image friendly) | Quarkus microservices rendering HTML/htmx fragments with low memory footprint | Validate template parameter types at build time (`@CheckedTemplate`) |
|
|
12
|
+
|
|
13
|
+
## Token mapping
|
|
14
|
+
|
|
15
|
+
Vaadin Flow/Hilla: map semantic tokens to Lumo/Aura custom CSS properties (`--lumo-primary-color`, application semantic variables) in the application theme folder (`frontend/themes/<name>/styles.css`); do not restyle every component instance. Thymeleaf, JTE, and Qute: import generated CSS variables in the shared base layout and consume semantic classes rather than copying hex into Java or templates.
|
|
16
|
+
|
|
17
|
+
## Layout and responsive idioms
|
|
18
|
+
|
|
19
|
+
Vaadin Flow/Hilla routes and layouts produce real DOM/web components but still need intentional responsive CSS and narrow-viewport restructuring. Thymeleaf, JTE, and Qute are server-rendered HTML: design complete semantic pages first, compose fragments cleanly, and pair with htmx 2 (`htmx-alpine.md`) when partial updates improve task flow.
|
|
20
|
+
|
|
21
|
+
## Typography/custom fonts
|
|
22
|
+
|
|
23
|
+
Load fonts through static/theme CSS with explicit fallback/subsetting. Vaadin theme typography should use documented custom properties; Thymeleaf/JTE/Qute use ordinary CSS. Verify scaling/localization in a real browser.
|
|
24
|
+
|
|
25
|
+
## Motion/reduced motion
|
|
26
|
+
|
|
27
|
+
Use CSS `@media (prefers-reduced-motion: reduce)`. Vaadin component animation coverage varies by component/version—inspect overlays, drawers, dialogs, and progress bars in reduced-motion emulation and override in the theme stylesheet.
|
|
28
|
+
|
|
29
|
+
## Accessibility specifics
|
|
30
|
+
|
|
31
|
+
Vaadin provides WCAG-oriented component primitives, but application composition can still break labels, landmarks, focus order, dialogs, grids, and screen-reader flow. In Thymeleaf/JTE/Qute, accessibility is exactly the emitted HTML—manage server round-trip focus, error summaries, and `aria-live` updates after htmx fragment swaps.
|
|
32
|
+
|
|
33
|
+
## States & Forms idiom
|
|
34
|
+
|
|
35
|
+
- **Vaadin Flow**: model loading/error/empty/permission/offline/push/session-expiration explicitly; never leave dead controls after session disconnect. Pair `Binder` validators with visible persistent labels and non-color required indicators.
|
|
36
|
+
- **Vaadin Hilla**: annotate every `@BrowserCallable` service with explicit Spring Security rules (`@RolesAllowed`, `@PermitAll`), consume generated TypeScript models/hooks with `useForm` (Hilla React Form) or `forms-validation.md` idioms, and preserve input across validation failures.
|
|
37
|
+
- **Spring + Thymeleaf / JTE / Qute + htmx**: return full pages on normal requests and partial fragments on `@HxRequest` (with `Vary: HX-Request`), expose CSRF tokens via hidden inputs or `hx-headers`, return HTTP 422 error fragments preserving posted values, and keep filter/pagination state in URLs.
|
|
38
|
+
|
|
39
|
+
## Do/don't pairs
|
|
40
|
+
|
|
41
|
+
| Do | Don't |
|
|
42
|
+
|---|---|
|
|
43
|
+
| Vaadin Flow `new Button("Save invoice")` or semantic `<button type="submit">` | Click listener on a layout `Div` with no keyboard semantics |
|
|
44
|
+
| Explicit `@RolesAllowed` on every Vaadin Hilla `@BrowserCallable` endpoint | Assuming frontend route guards protect generated Hilla RPC endpoints |
|
|
45
|
+
| Spring `@HxRequest` + `Vary: HX-Request` returning semantic error fragments with preserved values | Caching partial htmx fragments under the same cache key as full pages or losing POST input |
|
|
46
|
+
| Precompiled JTE / `@CheckedTemplate` Qute with contextual auto-escaping | String-concatenated HTML or bypassing template escaping on user text |
|
|
47
|
+
| Semantic CSS theme variables in `styles.css` | Per-instance inline hex colors scattered across Java views/templates |
|
|
48
|
+
|
|
49
|
+
## Known traps
|
|
50
|
+
|
|
51
|
+
Missing Spring Security annotations on Hilla `@BrowserCallable` endpoints, caching htmx fragments without `Vary: HX-Request`, Vaadin session timeout leaving silent dead buttons, bypassing JTE/Qute/Thymeleaf escaping, grid density clipping at 200% zoom, CSRF failures on htmx `hx-post` requests.
|
|
52
|
+
|
|
53
|
+
## Verification commands
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
./mvnw verify
|
|
57
|
+
./gradlew test build
|
|
58
|
+
npx playwright test
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Inspect browser DOM/accessibility tree, session expiry/offline/push interruption, htmx no-JS + enhanced paths, keyboard/focus order, reduced motion, and zoom/localization behavior (`rendered`); Maven/Gradle builds and template checks are `static`.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Kotlin web: Compose Multiplatform Web and Kobweb
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
5
|
+
Kobweb uses Compose HTML/DOM concepts and Silk-style theme objects/CSS variables; map DTCG output into semantic theme singletons plus generated CSS. Compose Multiplatform Web may draw through its own rendering pipeline/canvas depending mode; decide whether DOM semantics or shared Compose rendering is intentional before styling.
|
|
6
|
+
|
|
7
|
+
## Layout and responsive idioms
|
|
8
|
+
|
|
9
|
+
Kobweb/Compose HTML: use real CSS grid/flex/media/container queries and semantic elements. Compose Web canvas: shared modifiers/layouts can reuse mobile knowledge but browser text selection, semantics, zoom, and deep links require explicit validation.
|
|
10
|
+
|
|
11
|
+
## Typography/custom fonts
|
|
12
|
+
|
|
13
|
+
Register webfont assets/stylesheet and map semantic type roles in Kotlin theme. Never assume mobile font assets behave identically in browser; verify fallback, FOUT/CLS, scaling, localization glyphs.
|
|
14
|
+
|
|
15
|
+
## Motion/reduced motion
|
|
16
|
+
|
|
17
|
+
Use CSS media queries in DOM mode. In Kotlin/browser interop read `window.matchMedia("(prefers-reduced-motion: reduce)")`; gate Compose animation specs/canvas effects accordingly. SSR or first paint must not depend on animation completion.
|
|
18
|
+
|
|
19
|
+
## Accessibility specifics
|
|
20
|
+
|
|
21
|
+
DOM-mode Kobweb can produce semantic HTML—use real tags/labels. Canvas-rendered Compose Web may expose weaker browser accessibility depending target/version; do not claim screen-reader parity without testing the actual rendering mode. Manage focus/routes and keyboard interaction.
|
|
22
|
+
|
|
23
|
+
## States idiom
|
|
24
|
+
|
|
25
|
+
Model routing, loading/error/empty/offline/permission states in Kotlin state holders. Keep URLs/deep links meaningful. Preserve input across navigation/server failure and avoid blank canvas while static content could render.
|
|
26
|
+
|
|
27
|
+
## Forms idiom
|
|
28
|
+
|
|
29
|
+
In DOM mode use `<form>`, labels, autocomplete/inputmode, constraint validation and server round-trip errors. In canvas/shared Compose mode verify paste, IME composition, keyboard type, focus traversal, browser autofill limitations, and validation timing honestly.
|
|
30
|
+
|
|
31
|
+
## Do/don't pairs
|
|
32
|
+
|
|
33
|
+
| Do | Don't |
|
|
34
|
+
|---|---|
|
|
35
|
+
| choose Kobweb DOM for semantic content/forms | choosing canvas Compose merely to reuse mobile code |
|
|
36
|
+
| `window.matchMedia("(prefers-reduced-motion: reduce)")` | assuming Compose honors web reduced motion automatically |
|
|
37
|
+
| semantic Kotlin theme object | scattered `Color(0xff…)` constants |
|
|
38
|
+
| real URL/form fallback | blank WASM canvas with no useful failure state |
|
|
39
|
+
|
|
40
|
+
## Known traps
|
|
41
|
+
|
|
42
|
+
Confusing DOM-based Kobweb / Compose HTML with Skiko canvas-rendered Compose Multiplatform Web (`wasmJs` / `js`), WasmGC browser support and WASM startup size, browser semantics/autofill/SEO gaps on canvas targets, duplicate routing ownership, font/glyph mismatch, thinking Kotlin type safety implies accessibility.
|
|
43
|
+
|
|
44
|
+
## Verification commands
|
|
45
|
+
|
|
46
|
+
Run the task matching the project's configured Kotlin target (`wasmJs` for modern Compose Multiplatform Web WasmGC targets, `js` for Kotlin/JS and Kobweb):
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
./gradlew build
|
|
50
|
+
./gradlew wasmJsBrowserTest
|
|
51
|
+
./gradlew wasmJsBrowserDevelopmentRun
|
|
52
|
+
./gradlew jsBrowserTest
|
|
53
|
+
./gradlew jsBrowserDevelopmentRun
|
|
54
|
+
npx playwright test
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Inspect initial HTML/DOM versus canvas pixels, keyboard/focus/accessibility tree, network failure, WASM/JS bundle size, browser zoom/text scaling, reduced motion, and back/deep-link behavior (`rendered`).
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Rust web: Leptos, Dioxus Web, Yew, and Axum + Askama/Maud + htmx
|
|
2
|
+
|
|
3
|
+
## Stack selection
|
|
4
|
+
|
|
5
|
+
| Stack | Rendering model | Best fit | Primary trade-off |
|
|
6
|
+
|---|---|---|---|
|
|
7
|
+
| **Leptos (0.7 / 0.8)** | Fine-grained signals + SSR + `#[island]` selective hydration + `#[server]` RPC | Full-stack Rust apps needing reactive client UI with minimal WASM hydration | Requires disciplined SSR/hydrate feature gating (`#[cfg(feature = "ssr")]`) |
|
|
8
|
+
| **Dioxus Web (0.6 / 0.7)** | `rsx!` macros, `use_signal`/`use_resource`, Dioxus Fullstack `#[server]` | Teams sharing Rust UI across web, desktop, and mobile | Virtual-DOM diffing + larger initial WASM download if full-page hydrated |
|
|
9
|
+
| **Yew** | Component/hook VDOM compiled to WASM | Existing Yew SPAs and client-side WASM tools | Heavier VDOM/WASM footprint; smaller SSR/islands ecosystem than Leptos |
|
|
10
|
+
| **Axum + Askama / Maud + htmx** | Zero-WASM server-rendered HTML templates + htmx partial swaps | Content, admin, and form-heavy Rust web apps prioritizing instant first load | Rich offline/canvas interactions still require small targeted JS or WASM islands |
|
|
11
|
+
|
|
12
|
+
## Token mapping
|
|
13
|
+
|
|
14
|
+
Compile once to WASM (or render templates from Axum) and style real DOM with CSS. Import generated CSS variables in root HTML/CSS; consume semantic classes/custom properties rather than generating inline hex from Rust. Theme state should be a signal or cookie/header mapped to a root class or `data-theme`.
|
|
15
|
+
|
|
16
|
+
## Layout and responsive idioms
|
|
17
|
+
|
|
18
|
+
Use HTML/CSS layout, semantic landmarks, container/media queries, and SSR/hydration boundaries deliberately. In **Leptos 0.7/0.8**, annotate only interactive subtrees with `#[island]` when `islands` mode is enabled so static markup never ships WASM code. Do not copy a monolithic SPA bundle when islands or Axum + Askama/Maud + htmx suffice.
|
|
19
|
+
|
|
20
|
+
## Typography/custom fonts
|
|
21
|
+
|
|
22
|
+
Declare font files in static assets/root HTML with subset and fallback policy. Respect browser text scaling; verify WASM loading does not block readable initial HTML where SSR exists.
|
|
23
|
+
|
|
24
|
+
## Motion/reduced motion
|
|
25
|
+
|
|
26
|
+
Prefer CSS transitions/keyframes with `@media (prefers-reduced-motion: reduce)`. For Rust-side state use `web_sys::window().and_then(|w| w.match_media("(prefers-reduced-motion: reduce)").ok().flatten())`; in Leptos, `leptos_use::use_prefers_reduced_motion()` wraps this safely. Never assume `window()` exists during SSR.
|
|
27
|
+
|
|
28
|
+
## Accessibility specifics
|
|
29
|
+
|
|
30
|
+
Rust/WASM has no automatic accessibility advantage. Emit semantic HTML/ARIA attributes exactly as browser markup; manage focus after hydration/navigation; keep keyboard behavior and labels in generated DOM. Canvas/SVG widgets need explicit text alternatives/focus semantics.
|
|
31
|
+
|
|
32
|
+
## Modern Leptos 0.7/0.8, Dioxus Web, and Axum + Askama/Maud idioms
|
|
33
|
+
|
|
34
|
+
- **Leptos 0.7 / 0.8**: signals no longer take a `Scope` (`cx`) argument—use **`let (count, set_count) = signal(0);`** or **`let count = RwSignal::new(0);`** with `.get()`/`.set()`/`.update(...)`. Mark interactive islands with **`#[island]`**, define typed server RPCs with **`#[server]`** (`ServerFn`), and bind progressive HTML forms with **`<ActionForm action=save_action>`** so submissions work even before WASM loads.
|
|
35
|
+
- **Dioxus Web (0.6 / 0.7)**: use `rsx!`, `use_signal`, `use_memo`, and `use_resource` for async states (`None` loading, `Some(Err(...))` error, `Some(Ok(...))` data), plus `#[server]` functions in Dioxus Fullstack (`dx serve --platform web`).
|
|
36
|
+
- **Axum + Askama / Maud + htmx**: render compile-time checked HTML via Askama (`#[derive(Template)]`) or Maud (`html! { ... }`), return full pages on normal requests and fragments when the `HX-Request` header is present (with `Vary: HX-Request`), and follow `htmx-alpine.md` swap/focus hygiene.
|
|
37
|
+
|
|
38
|
+
```rust
|
|
39
|
+
// Leptos 0.7/0.8: #[server] + #[island] + <ActionForm> + RwSignal::new
|
|
40
|
+
use leptos::prelude::*;
|
|
41
|
+
|
|
42
|
+
#[server(SaveNote, "/api")]
|
|
43
|
+
pub async fn save_note(title: String) -> Result<String, ServerFnError> {
|
|
44
|
+
if title.trim().is_empty() {
|
|
45
|
+
return Err(ServerFnError::new("Title is required."));
|
|
46
|
+
}
|
|
47
|
+
Ok(title)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[island]
|
|
51
|
+
pub fn NoteComposer() -> impl IntoView {
|
|
52
|
+
let save = ServerAction::<SaveNote>::new();
|
|
53
|
+
let title = RwSignal::new(String::new());
|
|
54
|
+
let pending = save.pending();
|
|
55
|
+
|
|
56
|
+
view! {
|
|
57
|
+
<ActionForm action=save>
|
|
58
|
+
<label for="note-title">"Title"</label>
|
|
59
|
+
<input id="note-title" name="title" bind:value=title required />
|
|
60
|
+
<button type="submit" disabled=move || pending.get()>
|
|
61
|
+
{move || if pending.get() { "Saving…" } else { "Save note" }}
|
|
62
|
+
</button>
|
|
63
|
+
</ActionForm>
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## States & Forms idiom
|
|
69
|
+
|
|
70
|
+
Use resources/futures/signals (`Resource`, `use_resource`, `ActionForm`) or Axum HTTP 422 fragments for loading/error/empty/offline/permission states. Preserve input across failed actions and make retry/cancellation explicit. Treat hydration mismatch as UX failure.
|
|
71
|
+
|
|
72
|
+
## Do/don't pairs
|
|
73
|
+
|
|
74
|
+
| Do | Don't |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `RwSignal::new(...)` / `signal(...)`, `#[island]`, and `<ActionForm>` in Leptos 0.7/0.8 | Copy obsolete Leptos 0.5 `create_signal(cx, ...)` code or hydrate entire static pages |
|
|
77
|
+
| Choose Axum + Askama/Maud + htmx when zero-WASM fast SSR fits the UI | Ship a multi-megabyte WASM bundle just to render CRUD forms |
|
|
78
|
+
| `view! { <label for="email">"Email"</label><input id="email" type="email" autocomplete="email" /> }` | Clickable `<div>`s reconstructed in Rust |
|
|
79
|
+
| Guard `web_sys::window()` behind client-only branches or `leptos_use` | Panic during SSR by unwrapping `window()` unconditionally |
|
|
80
|
+
| Semantic CSS variables imported at document root | Hex literals embedded inside Rust view macros |
|
|
81
|
+
|
|
82
|
+
## Known traps
|
|
83
|
+
|
|
84
|
+
SSR/browser-only API mismatch, legacy Leptos `cx` scope signatures copied from old tutorials, unoptimized debug WASM sizes, hydration mismatch, focus loss across async replacement, assuming Rust type safety verifies ARIA/labels/contrast, missing `Vary: HX-Request` on Axum + htmx endpoints.
|
|
85
|
+
|
|
86
|
+
## Verification commands
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
cargo test
|
|
90
|
+
cargo clippy -- -D warnings
|
|
91
|
+
cargo leptos watch # Leptos full-stack projects
|
|
92
|
+
dx serve --platform web # Dioxus Web projects
|
|
93
|
+
trunk serve # Yew / static WASM projects
|
|
94
|
+
npx playwright test # browser behavior
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Inspect pre-hydration HTML (`static`/no-JS `rendered`), post-hydration DOM/accessibility tree, WASM payload under network throttling, keyboard-only flow, and reduced-motion emulation (`rendered`).
|