@thanhnguyxn/pixelcraft 0.0.0-stage → 0.1.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/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +11 -0
- package/LICENSE +21 -0
- package/README.md +407 -2
- package/assets/README.md +28 -0
- package/assets/pixelcraft-logo-512.png +0 -0
- package/bin/pixelcraft.mjs +444 -0
- package/docs/ARCHITECTURE.md +102 -0
- package/docs/DESIGN-RATIONALE.md +143 -0
- package/evals/README.md +27 -0
- package/evals/fixtures/README.md +36 -0
- package/evals/fixtures/direction-prototype-complexity.json +29 -0
- package/evals/fixtures/finish-gate-anti-slop.json +30 -0
- package/evals/fixtures/forms-accessibility-negative.json +29 -0
- package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
- package/evals/fixtures/plan-brownfield-evidence.json +28 -0
- package/evals/fixtures/visual-qa-task-evidence.json +29 -0
- package/evals/fixtures/workflow-checkpoints.json +30 -0
- package/evals/pixelcraft-accessibility.md +57 -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 +60 -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 +60 -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 +57 -0
- package/evals/pixelcraft-plan.md +65 -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 +80 -0
- package/evals/pixelcraft-web.md +71 -0
- package/evals/pixelcraft.md +70 -0
- package/gemini-extension.json +5 -0
- package/install.ps1 +295 -0
- package/install.sh +437 -0
- package/package.json +63 -4
- package/plugin.json +24 -0
- package/scripts/build-adapters.mjs +290 -0
- package/scripts/build-release-archives.mjs +61 -0
- package/scripts/build-skill-zips.mjs +94 -0
- package/scripts/test-build-adapters.mjs +48 -0
- package/scripts/test-distribution.mjs +124 -0
- package/scripts/test-export-tokens.mjs +105 -0
- package/scripts/test-finish-gate.mjs +148 -0
- package/scripts/test-installers.mjs +67 -0
- package/scripts/test-release-archives.mjs +42 -0
- package/scripts/test-shoot.mjs +65 -0
- package/scripts/test-slop-scan.mjs +29 -0
- package/scripts/test-style-inventory.mjs +211 -0
- package/scripts/test-validate-skills.mjs +117 -0
- package/scripts/validate-skills.mjs +512 -0
- package/skills/pixelcraft/SKILL.md +135 -0
- package/skills/pixelcraft/references/design-brief.md +75 -0
- package/skills/pixelcraft/references/floor.md +73 -0
- package/skills/pixelcraft/references/report-template.md +35 -0
- package/skills/pixelcraft/references/stack-detection.md +155 -0
- package/skills/pixelcraft/references/surface-acceptance.md +40 -0
- package/skills/pixelcraft/references/workflow-checkpoints.md +29 -0
- package/skills/pixelcraft-accessibility/SKILL.md +33 -0
- package/skills/pixelcraft-accessibility/references/apg-patterns.md +51 -0
- package/skills/pixelcraft-accessibility/references/platforms.md +58 -0
- package/skills/pixelcraft-accessibility/references/verification.md +59 -0
- package/skills/pixelcraft-accessibility/references/wcag22-checks.md +66 -0
- package/skills/pixelcraft-brandkit/SKILL.md +115 -0
- package/skills/pixelcraft-brandkit/references/asset-pipeline.md +125 -0
- package/skills/pixelcraft-brandkit/references/brand-governance.md +80 -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 +98 -0
- package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
- package/skills/pixelcraft-brandkit/references/prompt-template.md +85 -0
- package/skills/pixelcraft-brandkit/references/qa-checklist.md +88 -0
- package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
- package/skills/pixelcraft-chat-ui/SKILL.md +53 -0
- package/skills/pixelcraft-chat-ui/references/conversation-design.md +78 -0
- package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +87 -0
- package/skills/pixelcraft-chat-ui/references/slack-discord.md +96 -0
- package/skills/pixelcraft-constrained/SKILL.md +51 -0
- package/skills/pixelcraft-constrained/references/specialized-hardware.md +66 -0
- package/skills/pixelcraft-constrained/references/tv-wearables.md +84 -0
- package/skills/pixelcraft-constrained/references/voice-ui.md +63 -0
- package/skills/pixelcraft-craft/SKILL.md +44 -0
- package/skills/pixelcraft-craft/references/color.md +69 -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 +41 -0
- package/skills/pixelcraft-craft/references/motion.md +76 -0
- package/skills/pixelcraft-craft/references/typography.md +71 -0
- package/skills/pixelcraft-data-apps/SKILL.md +67 -0
- package/skills/pixelcraft-data-apps/references/dash.md +53 -0
- package/skills/pixelcraft-data-apps/references/evidence.md +75 -0
- package/skills/pixelcraft-data-apps/references/gradio.md +65 -0
- package/skills/pixelcraft-data-apps/references/julia-genie.md +54 -0
- package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +53 -0
- package/skills/pixelcraft-data-apps/references/nicegui.md +63 -0
- package/skills/pixelcraft-data-apps/references/observable-framework.md +67 -0
- package/skills/pixelcraft-data-apps/references/panel.md +53 -0
- package/skills/pixelcraft-data-apps/references/r-shiny.md +54 -0
- package/skills/pixelcraft-data-apps/references/reflex.md +62 -0
- package/skills/pixelcraft-data-apps/references/shiny.md +53 -0
- package/skills/pixelcraft-data-apps/references/streamlit.md +65 -0
- package/skills/pixelcraft-dataviz/SKILL.md +63 -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 +97 -0
- package/skills/pixelcraft-dataviz/references/libraries.md +57 -0
- package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +99 -0
- package/skills/pixelcraft-desktop/SKILL.md +71 -0
- package/skills/pixelcraft-desktop/references/appkit.md +58 -0
- package/skills/pixelcraft-desktop/references/avalonia.md +59 -0
- package/skills/pixelcraft-desktop/references/cpp-gui.md +52 -0
- package/skills/pixelcraft-desktop/references/electron.md +54 -0
- package/skills/pixelcraft-desktop/references/go-gui.md +54 -0
- package/skills/pixelcraft-desktop/references/gtk.md +54 -0
- package/skills/pixelcraft-desktop/references/javafx-swing.md +52 -0
- package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +61 -0
- package/skills/pixelcraft-desktop/references/rust-gui.md +65 -0
- package/skills/pixelcraft-desktop/references/tauri.md +54 -0
- package/skills/pixelcraft-desktop/references/uno-platform.md +52 -0
- package/skills/pixelcraft-desktop/references/winui-wpf.md +58 -0
- package/skills/pixelcraft-desktop/references/working-context.md +5 -0
- package/skills/pixelcraft-direction/SKILL.md +154 -0
- package/skills/pixelcraft-direction/references/composition-library.md +84 -0
- package/skills/pixelcraft-direction/references/direction-card.md +54 -0
- package/skills/pixelcraft-direction/references/direction-scoring.md +72 -0
- package/skills/pixelcraft-direction/references/movements.md +68 -0
- package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
- package/skills/pixelcraft-direction/references/slop-fingerprints.md +58 -0
- package/skills/pixelcraft-direction/references/wildcards.md +47 -0
- package/skills/pixelcraft-document/SKILL.md +54 -0
- package/skills/pixelcraft-document/references/archetypes.md +83 -0
- package/skills/pixelcraft-document/references/pdf-tools.md +154 -0
- package/skills/pixelcraft-document/references/print-css.md +134 -0
- package/skills/pixelcraft-document/references/slides.md +102 -0
- package/skills/pixelcraft-email/SKILL.md +58 -0
- package/skills/pixelcraft-email/references/client-quirks.md +45 -0
- package/skills/pixelcraft-email/references/html-tables.md +53 -0
- package/skills/pixelcraft-email/references/mjml.md +52 -0
- package/skills/pixelcraft-email/references/react-email.md +53 -0
- package/skills/pixelcraft-extensions/SKILL.md +51 -0
- package/skills/pixelcraft-extensions/references/browser-extensions.md +31 -0
- package/skills/pixelcraft-extensions/references/figma-office.md +23 -0
- package/skills/pixelcraft-extensions/references/raycast.md +19 -0
- package/skills/pixelcraft-extensions/references/vscode-webviews.md +26 -0
- package/skills/pixelcraft-game-ui/SKILL.md +61 -0
- package/skills/pixelcraft-game-ui/references/bevy.md +52 -0
- package/skills/pixelcraft-game-ui/references/godot.md +57 -0
- package/skills/pixelcraft-game-ui/references/hud-principles.md +38 -0
- package/skills/pixelcraft-game-ui/references/love2d.md +51 -0
- package/skills/pixelcraft-game-ui/references/monogame.md +52 -0
- package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +65 -0
- package/skills/pixelcraft-game-ui/references/unreal-umg.md +53 -0
- package/skills/pixelcraft-handoff/SKILL.md +49 -0
- package/skills/pixelcraft-handoff/references/design-translation.md +104 -0
- package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
- package/skills/pixelcraft-media/SKILL.md +52 -0
- package/skills/pixelcraft-media/references/banners-video.md +112 -0
- package/skills/pixelcraft-media/references/og-generation.md +107 -0
- package/skills/pixelcraft-media/references/social-cards.md +72 -0
- package/skills/pixelcraft-mobile/SKILL.md +69 -0
- package/skills/pixelcraft-mobile/references/dotnet-maui.md +63 -0
- package/skills/pixelcraft-mobile/references/flet.md +53 -0
- package/skills/pixelcraft-mobile/references/flutter.md +69 -0
- package/skills/pixelcraft-mobile/references/ionic-capacitor.md +65 -0
- package/skills/pixelcraft-mobile/references/jetpack-compose.md +61 -0
- package/skills/pixelcraft-mobile/references/kivy.md +59 -0
- package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +60 -0
- package/skills/pixelcraft-mobile/references/react-native-expo.md +71 -0
- package/skills/pixelcraft-mobile/references/swiftui.md +70 -0
- package/skills/pixelcraft-mobile/references/task-state-composition.md +5 -0
- package/skills/pixelcraft-mobile/references/uikit.md +58 -0
- package/skills/pixelcraft-patterns/SKILL.md +58 -0
- package/skills/pixelcraft-patterns/references/auth-onboarding.md +25 -0
- package/skills/pixelcraft-patterns/references/commerce.md +28 -0
- package/skills/pixelcraft-patterns/references/communication.md +26 -0
- package/skills/pixelcraft-patterns/references/creative-tools.md +29 -0
- package/skills/pixelcraft-patterns/references/dashboard-admin.md +31 -0
- package/skills/pixelcraft-patterns/references/marketing.md +32 -0
- package/skills/pixelcraft-patterns/references/pattern-selection.md +74 -0
- package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
- package/skills/pixelcraft-patterns/references/settings.md +23 -0
- package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
- package/skills/pixelcraft-plan/SKILL.md +67 -0
- package/skills/pixelcraft-plan/references/design-input.md +69 -0
- package/skills/pixelcraft-plan/references/plan-template.md +99 -0
- package/skills/pixelcraft-plan/references/repo-discovery.md +42 -0
- package/skills/pixelcraft-plan/references/stack-freshness.md +50 -0
- package/skills/pixelcraft-plan/references/stack-selection.md +42 -0
- package/skills/pixelcraft-review/SKILL.md +64 -0
- package/skills/pixelcraft-review/references/audit-report.md +50 -0
- package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
- package/skills/pixelcraft-review/references/heuristics.md +18 -0
- package/skills/pixelcraft-review/references/personas.md +26 -0
- package/skills/pixelcraft-review/references/polish.md +38 -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-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 +586 -0
- package/skills/pixelcraft-spatial/SKILL.md +52 -0
- package/skills/pixelcraft-spatial/references/comfort-accessibility.md +98 -0
- package/skills/pixelcraft-spatial/references/platforms.md +77 -0
- package/skills/pixelcraft-tokens/SKILL.md +56 -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 +54 -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 +94 -0
- package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +285 -0
- package/skills/pixelcraft-tui/SKILL.md +60 -0
- package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +60 -0
- package/skills/pixelcraft-tui/references/ink.md +60 -0
- package/skills/pixelcraft-tui/references/ratatui.md +62 -0
- package/skills/pixelcraft-tui/references/rich.md +62 -0
- package/skills/pixelcraft-tui/references/textual.md +67 -0
- package/skills/pixelcraft-ux/SKILL.md +46 -0
- package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
- package/skills/pixelcraft-ux/references/feedback-performance.md +30 -0
- package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
- package/skills/pixelcraft-ux/references/forms.md +97 -0
- package/skills/pixelcraft-ux/references/i18n.md +183 -0
- package/skills/pixelcraft-ux/references/laws.md +18 -0
- package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
- package/skills/pixelcraft-ux/references/state-matrix.md +39 -0
- package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
- package/skills/pixelcraft-ux/references/ux-writing.md +43 -0
- package/skills/pixelcraft-visual-qa/SKILL.md +82 -0
- package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
- package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +38 -0
- package/skills/pixelcraft-visual-qa/references/capture-email.md +34 -0
- package/skills/pixelcraft-visual-qa/references/capture-mobile.md +35 -0
- package/skills/pixelcraft-visual-qa/references/capture-terminal.md +31 -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/performance-budgets.md +65 -0
- package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
- package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +135 -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 +513 -0
- package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1154 -0
- package/skills/pixelcraft-web/SKILL.md +76 -0
- package/skills/pixelcraft-web/references/adaptive-layout.md +25 -0
- package/skills/pixelcraft-web/references/angular.md +61 -0
- package/skills/pixelcraft-web/references/astro.md +62 -0
- package/skills/pixelcraft-web/references/clojurescript.md +53 -0
- package/skills/pixelcraft-web/references/elm.md +53 -0
- package/skills/pixelcraft-web/references/fsharp-fable.md +53 -0
- package/skills/pixelcraft-web/references/html-css.md +88 -0
- package/skills/pixelcraft-web/references/htmx-alpine.md +53 -0
- package/skills/pixelcraft-web/references/java-web.md +52 -0
- package/skills/pixelcraft-web/references/kotlin-web.md +53 -0
- package/skills/pixelcraft-web/references/leptos-yew.md +54 -0
- package/skills/pixelcraft-web/references/lit-web-components.md +61 -0
- package/skills/pixelcraft-web/references/pwa.md +225 -0
- package/skills/pixelcraft-web/references/qwik.md +54 -0
- package/skills/pixelcraft-web/references/react-next.md +69 -0
- package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
- package/skills/pixelcraft-web/references/server-rendered.md +71 -0
- package/skills/pixelcraft-web/references/solid.md +60 -0
- package/skills/pixelcraft-web/references/svelte.md +61 -0
- package/skills/pixelcraft-web/references/tailwind.md +73 -0
- package/skills/pixelcraft-web/references/vue-nuxt.md +62 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Leptos and Yew (Rust web)
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
5
|
+
Compile once to WASM but 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. Leptos/Yew theme state should be a signal/property mapped to a root class or `data-theme`.
|
|
6
|
+
|
|
7
|
+
## Layout and responsive idioms
|
|
8
|
+
|
|
9
|
+
Use HTML/CSS layout, semantic landmarks, container/media queries, and SSR/hydration boundaries deliberately. Leptos favors fine-grained signals; Yew uses component/function state and callbacks. Do not copy a virtual-DOM SPA architecture into either.
|
|
10
|
+
|
|
11
|
+
## Typography/custom fonts
|
|
12
|
+
|
|
13
|
+
Declare font files in static assets/root HTML with subset and fallback policy. Respect browser text scaling; verify WASM bundle/loading does not block readable initial HTML where SSR exists.
|
|
14
|
+
|
|
15
|
+
## Motion/reduced motion
|
|
16
|
+
|
|
17
|
+
Prefer CSS transitions/keyframes with `@media (prefers-reduced-motion: reduce)`. For Rust-side state use `web_sys::window().match_media("(prefers-reduced-motion: reduce)")`; in Leptos, `leptos_use::use_prefers_reduced_motion()` is available when using that utility crate. SSR must not assume a window object.
|
|
18
|
+
|
|
19
|
+
## Accessibility specifics
|
|
20
|
+
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
## States idiom
|
|
24
|
+
|
|
25
|
+
Use resources/futures/signals or Yew state hooks for loading/error/empty/offline/permission states. Preserve input across failed actions and make retry/cancellation explicit. Treat hydration mismatch as UX failure.
|
|
26
|
+
|
|
27
|
+
## Forms idiom
|
|
28
|
+
|
|
29
|
+
Use actual `<form>`, `<label>`, `<input>`, validation attributes, autocomplete/inputmode, and progressive enhancement where SSR routes exist. Controlled inputs must preserve composition/paste and report recoverable errors.
|
|
30
|
+
|
|
31
|
+
## Do/don't pairs
|
|
32
|
+
|
|
33
|
+
| Do | Don't |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `view! { <label for="email">"Email"</label><input id="email" type="email"> }` | clickable divs reconstructed in Rust |
|
|
36
|
+
| `match media` reduced-motion signal before custom motion | assuming WASM inherits OS behavior automatically |
|
|
37
|
+
| semantic CSS variables | hex literals embedded in every component |
|
|
38
|
+
| SSR resource error branch | spinner-only shell after hydration failure |
|
|
39
|
+
|
|
40
|
+
## Known traps
|
|
41
|
+
|
|
42
|
+
SSR/browser-only API mismatch, hydration mismatch, large WASM startup, focus loss across async replacement, weak font/ARIA inspection because Rust types compile, leaking browser globals into server rendering.
|
|
43
|
+
|
|
44
|
+
## Verification commands
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
cargo test
|
|
48
|
+
cargo clippy -- -D warnings
|
|
49
|
+
trunk serve # Yew/static WASM where applicable
|
|
50
|
+
cargo leptos watch # Leptos full-stack projects
|
|
51
|
+
npx playwright test # browser behavior
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Inspect pre-hydration HTML, post-hydration DOM/accessibility tree, network throttling/offline, keyboard-only flow, and reduced-motion emulation.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Lit / Web Components
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
5
|
+
Import generated CSS variables globally and consume them inside shadow DOM:
|
|
6
|
+
|
|
7
|
+
```css
|
|
8
|
+
:host { color: var(--semantic-color-foreground); }
|
|
9
|
+
button { background: var(--semantic-color-action); }
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
CSS custom properties pierce shadow boundaries; raw global selectors do not. Use `::part()` deliberately for documented customization rather than leaking internals.
|
|
13
|
+
|
|
14
|
+
## Layout and responsive idioms
|
|
15
|
+
|
|
16
|
+
Treat components as interoperable leaf/regional primitives. The page owns broad layout; components own internal structure. Use shadow DOM slots intentionally for composition and document slot expectations. Container queries are useful where supported; otherwise expose size/density variants explicitly.
|
|
17
|
+
|
|
18
|
+
## Typography/custom fonts
|
|
19
|
+
|
|
20
|
+
Fonts may inherit into shadow DOM but font loading remains document responsibility. Define typography through inherited/custom properties and do not hard-code one app's font inside reusable components. Document required CSS variables/parts.
|
|
21
|
+
|
|
22
|
+
## Motion/reduced motion
|
|
23
|
+
|
|
24
|
+
Keep animation local and purpose-driven. Read `matchMedia` inside the component or inherit a semantic reduced-motion flag; never force consumers into motion they cannot control. Cleanup event listeners/timers/observers in `disconnectedCallback`.
|
|
25
|
+
|
|
26
|
+
## Accessibility specifics
|
|
27
|
+
|
|
28
|
+
Shadow DOM does not automatically connect labels/IDs across boundaries. Use native elements inside shadow DOM, delegate focus where appropriate (`delegatesFocus` only with care), expose states/roles/ARIA deliberately, and test accessibility tree/focus order in real browsers. Form-associated custom elements require ElementInternals/form participation when acting as inputs.
|
|
29
|
+
|
|
30
|
+
## States idiom
|
|
31
|
+
|
|
32
|
+
Reflect meaningful public state through attributes/properties only when styling/interop requires it. Render loading/empty/error/disabled/invalid internally with stable layout and expose events rather than expecting parents to inspect internals. Preserve user input internally and externally across failed submission.
|
|
33
|
+
|
|
34
|
+
## Forms idiom
|
|
35
|
+
|
|
36
|
+
Native form controls inside shadow DOM do not automatically participate exactly like normal page inputs in every scenario. Use form-associated custom element APIs where needed, implement validation/value/reset/disabled semantics, and document constraints. Never let shadow boundary hide missing labels.
|
|
37
|
+
|
|
38
|
+
## Do/don't pairs
|
|
39
|
+
|
|
40
|
+
| Do | Don't |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `<button part="button">` or documented parts for customization | forcing consumers to reach into shadow internals |
|
|
43
|
+
| semantic custom property fallback `var(--pc-action, var(--semantic-color-action))` | hard-coding app-specific hex inside reusable component |
|
|
44
|
+
| `disconnectedCallback() { this.observer?.disconnect(); }` | leaking observers/listeners after removal |
|
|
45
|
+
| dispatch clear typed events such as `pc-change` | mutating parent/global state as hidden coupling |
|
|
46
|
+
| native `<input>`/ElementInternals when form behavior matters | div-based fake input with decorative shadow styling |
|
|
47
|
+
|
|
48
|
+
## Known traps
|
|
49
|
+
|
|
50
|
+
ARIA/label boundary issues, focus delegation confusion, duplicate IDs across shadow/light DOM, style encapsulation mistaken for token architecture, CSS part API sprawl, form participation gaps, SSR/declarative shadow DOM support differences, event composition/retargeting surprises.
|
|
51
|
+
|
|
52
|
+
## Verification commands
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npm run test -- --run
|
|
56
|
+
npm run build
|
|
57
|
+
npx playwright test
|
|
58
|
+
npx web-test-runner 2>/dev/null || true
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Test in real browsers because shadow DOM behavior and accessibility trees differ from shallow unit rendering.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Progressive web apps
|
|
2
|
+
|
|
3
|
+
A PWA is not merely “a website with a manifest.” Installation, offline behavior, push, storage, updates, platform integration, and browser UI each have separate support matrices. Feature-detect every capability; never infer it from a user-agent string.
|
|
4
|
+
|
|
5
|
+
## Manifest contract
|
|
6
|
+
|
|
7
|
+
Link the same manifest from every installable page:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<link rel="manifest" href="/manifest.webmanifest" />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Common members:
|
|
14
|
+
|
|
15
|
+
| Member | Meaning / UX rule |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `name` / `short_name` | full and constrained-space app names; Chromium installability requires at least one |
|
|
18
|
+
| `id` | stable app identity; changing it can create a distinct installed app in supporting browsers |
|
|
19
|
+
| `start_url` | URL opened on launch; keep it inside `scope`, stable, authenticated-state aware, and useful when offline |
|
|
20
|
+
| `scope` | URL space treated as in-app; navigation outside it may expose browser context UI |
|
|
21
|
+
| `display` | preferred presentation: `browser`, `minimal-ui`, `standalone`, or `fullscreen`; actual fallback/support varies |
|
|
22
|
+
| `display_override` | ordered advanced fallback such as `window-controls-overlay` before `standalone`; verify browser support |
|
|
23
|
+
| `icons` | install/home/task switcher icons; Chromium requires both 192px and 512px entries |
|
|
24
|
+
| `background_color` | launch/placeholder background before CSS loads; match real first paint to avoid flash |
|
|
25
|
+
| `theme_color` | surrounding OS/browser chrome color; also coordinate meta theme-color behavior |
|
|
26
|
+
| `description` / `screenshots` | richer install UI metadata in supporting browsers |
|
|
27
|
+
| `orientation` | only lock when the experience truly requires it; orientation locks are often hostile UX |
|
|
28
|
+
| `categories` / `lang` / `dir` | metadata/localization hints; implementation is incomplete or platform-dependent |
|
|
29
|
+
| `shortcuts` | launcher shortcuts to deep actions; URLs must stay in scope and handle auth/offline states |
|
|
30
|
+
| `share_target` | receive shares in supporting browsers; validate method/params and security/privacy behavior |
|
|
31
|
+
| `file_handlers` | register file-type handling where supported; browser/OS support is limited |
|
|
32
|
+
| `protocol_handlers` | register custom/web-safe protocol handling where supported; validate navigation/security |
|
|
33
|
+
| `launch_handler` | influence whether launch focuses an existing client or opens a new one; support varies |
|
|
34
|
+
| `prefer_related_applications` / `related_applications` | native-app preference can suppress web install promotion; for Chromium installability the preference must be absent or false |
|
|
35
|
+
|
|
36
|
+
Example:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"id": "/",
|
|
41
|
+
"name": "Example Workspace",
|
|
42
|
+
"short_name": "Workspace",
|
|
43
|
+
"start_url": "/?source=pwa",
|
|
44
|
+
"scope": "/",
|
|
45
|
+
"display": "standalone",
|
|
46
|
+
"background_color": "#ffffff",
|
|
47
|
+
"theme_color": "#102033",
|
|
48
|
+
"description": "Offline-capable project workspace.",
|
|
49
|
+
"icons": [
|
|
50
|
+
{ "src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png" },
|
|
51
|
+
{ "src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png" },
|
|
52
|
+
{ "src": "/icons/maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Maskable icons need content inside the platform's safe zone; verify adaptive masks rather than padding everything blindly.
|
|
58
|
+
|
|
59
|
+
## Installability criteria
|
|
60
|
+
|
|
61
|
+
Current Chromium criteria for firing `beforeinstallprompt`/showing browser install promotion include:
|
|
62
|
+
|
|
63
|
+
- app not already installed;
|
|
64
|
+
- user engagement heuristic: the user has clicked/tapped the page at least once and spent at least 30 seconds viewing it across visits;
|
|
65
|
+
- HTTPS or localhost/loopback in development;
|
|
66
|
+
- manifest with `name` or `short_name`;
|
|
67
|
+
- icons including 192px and 512px;
|
|
68
|
+
- `start_url`;
|
|
69
|
+
- `display` one of `fullscreen`, `standalone`, `minimal-ui`, or `window-controls-overlay` (or an appropriate `display_override` result);
|
|
70
|
+
- `prefer_related_applications` absent or false.
|
|
71
|
+
|
|
72
|
+
Other browsers differ. Some let users create shortcuts/install even when promotion criteria are not met. Service workers are central to offline UX, but current Chromium promotion criteria do not simply mean “register any service worker”; verify target-browser requirements instead of copying old checklist versions.
|
|
73
|
+
|
|
74
|
+
## Install prompt UX
|
|
75
|
+
|
|
76
|
+
`beforeinstallprompt` is a browser-owned opportunity, not permission to interrupt:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
let deferredInstallPrompt;
|
|
80
|
+
|
|
81
|
+
window.addEventListener('beforeinstallprompt', (event) => {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
deferredInstallPrompt = event;
|
|
84
|
+
showInstallAction.hidden = false;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
showInstallAction.addEventListener('click', async () => {
|
|
88
|
+
if (!deferredInstallPrompt) return;
|
|
89
|
+
deferredInstallPrompt.prompt();
|
|
90
|
+
const { outcome } = await deferredInstallPrompt.userChoice;
|
|
91
|
+
deferredInstallPrompt = null;
|
|
92
|
+
reportOutcomeHonestly(outcome);
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
UX rules:
|
|
97
|
+
|
|
98
|
+
- do not ask on first paint; wait until the user has experienced enough value to understand why installation matters;
|
|
99
|
+
- use an explicit, dismissible in-product action (“Install workspace”) rather than a modal ambush;
|
|
100
|
+
- explain the concrete benefit: offline access, launch behavior, file handling, shortcuts—not vague “better experience”;
|
|
101
|
+
- respect dismissal and do not reprompt aggressively;
|
|
102
|
+
- detect/display state using `appinstalled`, display-mode media queries, and navigator/standalone clues where applicable;
|
|
103
|
+
- handle unsupported browsers with an honest manual path, not a disabled fake button;
|
|
104
|
+
- never obstruct core use behind installation.
|
|
105
|
+
|
|
106
|
+
On iOS/iPadOS there is no `beforeinstallprompt` event for arbitrary Safari pages. If installation is truly useful, expose instructions only at a user-initiated/help moment (for example, Share → Add to Home Screen). Do not fake a native permission sheet.
|
|
107
|
+
|
|
108
|
+
## Offline-first UX states
|
|
109
|
+
|
|
110
|
+
Offline is a product state, not a failed page. Model these separately:
|
|
111
|
+
|
|
112
|
+
| State | Required UX |
|
|
113
|
+
|---|---|
|
|
114
|
+
| fast online | ordinary behavior; do not show false freshness confidence if data is cached |
|
|
115
|
+
| slow/degraded network | progressive loading, cancellation/timeouts, preserve input, avoid dead skeleton loops |
|
|
116
|
+
| offline with fresh cache | clear connectivity/status affordance only when relevant; full core functionality where designed |
|
|
117
|
+
| offline with stale cache | explicit “last updated”/staleness treatment and non-destructive refresh action |
|
|
118
|
+
| offline uncached route/action | useful fallback explaining what is unavailable and what remains possible |
|
|
119
|
+
| queued mutation | visible pending state, retry/inspect/cancel path, conflict behavior, durable ordering semantics |
|
|
120
|
+
| sync in progress | progress/failure state without blocking unrelated work |
|
|
121
|
+
| server failure while online | do not mislabel as user connectivity failure; expose status/retry/support appropriately |
|
|
122
|
+
| permission/login expiry | preserve unsent data where safe and explain auth recovery clearly |
|
|
123
|
+
|
|
124
|
+
Rules:
|
|
125
|
+
|
|
126
|
+
- preserve form input and locally created drafts across refresh/offline transitions;
|
|
127
|
+
- never silently drop or duplicate queued mutations;
|
|
128
|
+
- do not cache sensitive authenticated data merely because it is convenient; threat-model storage;
|
|
129
|
+
- expose content age/provenance where decisions depend on freshness;
|
|
130
|
+
- make retry idempotent and backoff deliberate;
|
|
131
|
+
- the browser `online` event/`navigator.onLine` is a hint, not proof that the service/API is reachable.
|
|
132
|
+
|
|
133
|
+
## Service worker caching strategies
|
|
134
|
+
|
|
135
|
+
Service workers are programmable network proxies. Registration and installation are separate lifecycle events, and the worker controlling future loads may not control the page that registered it until navigation/reload depending on lifecycle handling.
|
|
136
|
+
|
|
137
|
+
| Strategy | Best use | Risk |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| cache-first | versioned static assets/fonts/images that rarely change | stale forever if URL is not versioned; storage growth |
|
|
140
|
+
| network-first fallback-cache | timely API/page data where freshness matters but stale fallback is acceptable | slow timeout hurts UX; stale financial/medical/legal data can mislead |
|
|
141
|
+
| stale-while-revalidate | UI assets/data where instant response matters and eventual freshness is acceptable | user may see older state; mutation-sensitive data needs clear labeling |
|
|
142
|
+
| network-only | payments/auth/balances/high-integrity actions | no offline behavior |
|
|
143
|
+
| cache-only | deliberately precached immutable app shell/assets | fails when asset missing; wrong for dynamic truth |
|
|
144
|
+
| cache-then-network UI pattern | show cached content while validating freshness | visible state must say when refresh is in progress/completed/failed |
|
|
145
|
+
|
|
146
|
+
Implementation rules:
|
|
147
|
+
|
|
148
|
+
- precache only the minimum app shell; huge upfront caches harm install/storage;
|
|
149
|
+
- version cache names and delete obsolete caches during `activate`;
|
|
150
|
+
- do not cache opaque/cross-origin/authenticated responses without understanding scope and leakage;
|
|
151
|
+
- combine with correct HTTP caching; service-worker cache and HTTP cache are distinct layers;
|
|
152
|
+
- route requests by URL/method/headers deliberately; POST/mutations are not ordinary cacheable GETs;
|
|
153
|
+
- keep fallback pages/assets small and meaningful;
|
|
154
|
+
- test first visit before activation, repeat visit, update, offline reload, cache eviction, and multiple tabs.
|
|
155
|
+
|
|
156
|
+
## Push permission UX
|
|
157
|
+
|
|
158
|
+
Push is high-interruption capability. Permission must be earned in context:
|
|
159
|
+
|
|
160
|
+
1. explain what notifications will contain and why they matter before invoking permission;
|
|
161
|
+
2. trigger the permission request only from a clear user action such as subscribing to a specific topic;
|
|
162
|
+
3. offer topic/frequency/channel controls where possible rather than one binary all-or-nothing request;
|
|
163
|
+
4. handle `default`, `granted`, and `denied` states accurately; if denied, instruct users how to change browser/OS settings without nagging;
|
|
164
|
+
5. confirm subscription state in-product and provide unsubscribe/disable controls;
|
|
165
|
+
6. validate endpoint expiration, server VAPID keys, payload size/encryption, and retry behavior separately from visual permission;
|
|
166
|
+
7. do not use notification permission as a proxy for install permission—they are independent decisions.
|
|
167
|
+
|
|
168
|
+
On iOS/iPadOS 16.4+, standards-based Web Push is available to Home Screen web apps, and the permission request must be in response to direct user interaction. It is not generally equivalent to desktop-browser push support. Feature-detect Push API/Notification/service worker/installed-app context and treat unsupported paths as honest product states.
|
|
169
|
+
|
|
170
|
+
## Update-available flow
|
|
171
|
+
|
|
172
|
+
Service-worker updates occur when the browser detects a byte-different worker file. Keep the worker filename stable; changing its filename can prevent normal update detection. Typical lifecycle:
|
|
173
|
+
|
|
174
|
+
1. browser registers/checks worker;
|
|
175
|
+
2. new worker installs;
|
|
176
|
+
3. worker waits while old worker controls existing clients;
|
|
177
|
+
4. activation occurs after old clients release control or explicit lifecycle coordination;
|
|
178
|
+
5. page receives `controllerchange` if activation takes control.
|
|
179
|
+
|
|
180
|
+
UX-safe flow:
|
|
181
|
+
|
|
182
|
+
```js
|
|
183
|
+
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
|
184
|
+
if (!reloadingForUpdate) window.location.reload();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
newWorker.addEventListener('statechange', () => {
|
|
188
|
+
if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
|
|
189
|
+
showUpdateToast({ action: () => newWorker.postMessage({ type: 'SKIP_WAITING' }) });
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Rules:
|
|
195
|
+
|
|
196
|
+
- show an update action when a new version is waiting, but never force reload mid-form or during a critical transaction;
|
|
197
|
+
- make copy concrete (“Restart to use version …”), not generic alarm;
|
|
198
|
+
- coordinate multiple tabs/worker versions when data schemas change;
|
|
199
|
+
- consider cache/schema migration and incompatible client-server versions;
|
|
200
|
+
- expose offline/update failure and retry rather than an infinite spinner;
|
|
201
|
+
- test first install, byte-identical reload, byte-different update, user deferral, multi-tab behavior, and low-network interruption.
|
|
202
|
+
|
|
203
|
+
## iOS/iPadOS caveats
|
|
204
|
+
|
|
205
|
+
Apple platform behavior changes frequently. Verify the exact target version; do not treat Android/Desktop PWA behavior as portable.
|
|
206
|
+
|
|
207
|
+
- installation historically happens through Share → Add to Home Screen rather than Chromium-style programmatic prompts;
|
|
208
|
+
- web.dev installation documentation notes that only the standalone display mode is available on iOS/iPadOS;
|
|
209
|
+
- Apple devices can install the same PWA multiple times, and each installation has isolated storage/is treated as a separate app;
|
|
210
|
+
- web push requires Home Screen web apps on iOS/iPadOS 16.4+ and direct user interaction; browser tabs are not equivalent;
|
|
211
|
+
- background execution, lifecycle, storage persistence, cache eviction, badges, vibration, media, Bluetooth/USB, file handling, and advanced platform integrations have narrower/different support;
|
|
212
|
+
- viewport safe areas, home indicator, status-bar appearance, keyboard resizing, scrolling momentum, and fullscreen behavior must be physically tested;
|
|
213
|
+
- storage is not guaranteed permanent. Request persistence with `navigator.storage.persist()` where supported, but still design for eviction/loss;
|
|
214
|
+
- feature-detect APIs; Safari/WebKit version and installed-app context matter more than “iOS” as a label.
|
|
215
|
+
|
|
216
|
+
## Verification matrix
|
|
217
|
+
|
|
218
|
+
- Lighthouse/browser installability audit is a clue, not proof;
|
|
219
|
+
- inspect manifest JSON/network response, icon decoding, scope/start URL, screenshots, and maskable cropping;
|
|
220
|
+
- test Chromium desktop/mobile install prompt and at least one non-Chromium target;
|
|
221
|
+
- throttle network, go offline after first load/update, reload deep links, mutate/queue data, and recover;
|
|
222
|
+
- inspect Cache Storage/IndexedDB/quota/persistence;
|
|
223
|
+
- test push permission lifecycle and payload rendering;
|
|
224
|
+
- test update deferral/activation in multiple tabs;
|
|
225
|
+
- test real iPhone/iPad installed-home-screen behavior or mark it `not-checked`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Qwik
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
5
|
+
Import generated CSS variables in global/root styling and consume semantic variables in component CSS. Qwik's resumability favors small serialized state; keep token names static rather than generating dynamic unbounded style objects per interaction.
|
|
6
|
+
|
|
7
|
+
## Layout and responsive idioms
|
|
8
|
+
|
|
9
|
+
Use standard HTML/CSS first. Qwik components should remain small and lazily resumable; visual composition does not require hydration. Route layouts in Qwik City own persistent shell structure. Avoid putting large nonserializable objects into component state/props.
|
|
10
|
+
|
|
11
|
+
## Typography/custom fonts
|
|
12
|
+
|
|
13
|
+
Load fonts in document head/root layout with subset/fallback policy. Resumable HTML means typography can render before JS; preserve that advantage rather than delaying text behind client bootstrap.
|
|
14
|
+
|
|
15
|
+
## Motion/reduced motion
|
|
16
|
+
|
|
17
|
+
Use CSS where possible. Event handlers are lazy-loaded in Qwik, so motion tied to interaction can remain local through `$`/`useVisibleTask$` patterns. Honor `prefers-reduced-motion`; do not use visible-task initialization for content that can be static.
|
|
18
|
+
|
|
19
|
+
## Accessibility specifics
|
|
20
|
+
|
|
21
|
+
Resumability is not accessibility by itself. Initial HTML needs correct semantics, labels, landmarks, and focus order. Manage focus after lazy interaction, route transition, deletion, and dialog close. Anchor/button distinction remains mandatory.
|
|
22
|
+
|
|
23
|
+
## States idiom
|
|
24
|
+
|
|
25
|
+
Use `routeLoader$`, `routeAction$`, server state, resource tracking, and explicit pending/error/empty branches. Because Qwik serializes state into HTML, avoid secrets/nonserializable values and preserve input/error state across action failure.
|
|
26
|
+
|
|
27
|
+
## Forms idiom
|
|
28
|
+
|
|
29
|
+
Qwik City actions can progressively enhance forms. Use native labels/types/autocomplete/inputmode and return field errors without discarding values. Avoid converting every input into eager client-controlled state when native form semantics suffice.
|
|
30
|
+
|
|
31
|
+
## Do/don't pairs
|
|
32
|
+
|
|
33
|
+
| Do | Don't |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `<Link href="/invoice/42">View invoice</Link>` | click-only div calling navigation |
|
|
36
|
+
| local lazy handler `onClick$` for the control that needs it | eager global hydration mental model copied from SPA frameworks |
|
|
37
|
+
| serializable action state/error shape | storing class instances/functions/secrets in UI state |
|
|
38
|
+
| stable static layout before interaction | blank shell waiting for lazy behavior that content does not need |
|
|
39
|
+
| `useVisibleTask$` only for browser-visible side effects | running browser-only assumptions during SSR |
|
|
40
|
+
|
|
41
|
+
## Known traps
|
|
42
|
+
|
|
43
|
+
Serialization boundary violations, overuse of visible tasks, accidentally losing resumability benefits through broad client state, lazy focus management gaps, stale route data, confusing optimizer errors, CSS duplication across lazy chunks.
|
|
44
|
+
|
|
45
|
+
## Verification commands
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npm run lint
|
|
49
|
+
npm run test -- --run
|
|
50
|
+
npm run build
|
|
51
|
+
npx playwright test
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Inspect initial HTML before JS as well as post-interaction browser state; both are distinct evidence.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# React / Next.js
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
5
|
+
Import generated CSS variables at the app/root layout layer or map them into a typed theme object consumed by components:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import './tokens.css';
|
|
9
|
+
const theme = { action: 'var(--semantic-color-action)' };
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Do not duplicate hex values in component props when CSS variables already represent the semantic role. Server/client component boundaries must not turn token constants into unnecessary client bundles.
|
|
13
|
+
|
|
14
|
+
## Layout and responsive idioms
|
|
15
|
+
|
|
16
|
+
Use semantic HTML/CSS layout before component abstractions. In Next.js, keep static/content-heavy sections server-rendered and isolate client interactivity. Use route segments/layouts for shared structure; do not recreate shell chrome per page. Streaming/suspense boundaries should preserve stable layout rather than replacing the entire viewport with spinners.
|
|
17
|
+
|
|
18
|
+
## Typography/custom fonts
|
|
19
|
+
|
|
20
|
+
Use `next/font` where applicable, configure subsets/fallbacks/display behavior deliberately, and cover required scripts. React Native-style fixed pixel assumptions do not belong here; text must zoom/reflow in the browser.
|
|
21
|
+
|
|
22
|
+
## Motion/reduced motion
|
|
23
|
+
|
|
24
|
+
CSS handles simple transitions. For JS animation libraries, initialize only in client components and honor:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Cleanup listeners/animation frames in effects.
|
|
31
|
+
|
|
32
|
+
## Accessibility specifics
|
|
33
|
+
|
|
34
|
+
React does not create semantics for you. Use real controls, label association with `htmlFor`/`id`, and manage focus after route transitions, dialog close, deletion, and error summary display. Next Link remains an anchor; do not use click handlers for navigation without href semantics. Hydration must not leave visible controls inert.
|
|
35
|
+
|
|
36
|
+
## States idiom
|
|
37
|
+
|
|
38
|
+
Check the installed React/Next.js versions and router before using these examples. Server Actions and route-segment conventions here assume a compatible App Router; verify `useFormStatus` for the installed React version. Preserve existing Pages Router or client mutation patterns when a migration is out of scope.
|
|
39
|
+
|
|
40
|
+
Use route-level `loading`/`error`/`not-found` plus component-level state deliberately; they are not substitutes for empty/partial/offline/optimistic states. Server Actions need pending indication, duplicate-submit protection, validation error return shape, input preservation, and rollback semantics. Cache freshness/revalidation must be visible when user decisions depend on stale data.
|
|
41
|
+
|
|
42
|
+
## Forms idiom
|
|
43
|
+
|
|
44
|
+
Use `<form action>` progressive enhancement where feasible. Correct `autocomplete`/`inputMode` are preserved in JSX capitalization (`autoComplete`, `inputMode`). Return field errors as data and associate them accessibly; do not rely on browser alert/toast alone. Preserve input on failed server validation.
|
|
45
|
+
|
|
46
|
+
## Do/don't pairs
|
|
47
|
+
|
|
48
|
+
| Do | Don't |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `<Link href="/invoices/42">View invoice</Link>` | `<div onClick={() => router.push('/invoices/42')}>View invoice</div>` |
|
|
51
|
+
| `useFormStatus().pending` to disable repeated submit and expose pending state | pretending submission is instant or allowing duplicate mutations |
|
|
52
|
+
| narrow client component `<QtyStepper sku={sku} />` inside server page | converting the whole route to `'use client'` for one control |
|
|
53
|
+
| `router.back()`/history-aware close semantics where appropriate | always routing users home after modal/drawer close |
|
|
54
|
+
| preserve search params for filter/page/share state | storing shareable view state only in ephemeral component memory |
|
|
55
|
+
|
|
56
|
+
## Known traps
|
|
57
|
+
|
|
58
|
+
Server/client serialization boundaries, stale closure state, effect-driven data fetching waterfalls, hydration mismatch from locale/date/random values, focus loss after route change, cache surprises, suspense fallback layout shift, controlled input cursor loss, accidental client-only accessibility gaps.
|
|
59
|
+
|
|
60
|
+
## Verification commands
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
npm run lint
|
|
64
|
+
npm run test -- --run
|
|
65
|
+
npm run build
|
|
66
|
+
npx playwright test
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Use the actual package manager/scripts. Inspect browser rendering and hydration timing when interaction quality matters.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Scala.js Laminar
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
5
|
+
Use generated CSS variables/semantic classes in Laminar/Scala DOM Types. Reactive theme state can be a `Var`/signal controlling a root class, but visual constants belong in CSS/design-token assets rather than repeated inline styles.
|
|
6
|
+
|
|
7
|
+
## Layout and responsive idioms
|
|
8
|
+
|
|
9
|
+
Laminar has no virtual DOM; elements are real DOM with fine-grained Airstream updates. Use semantic HTML/CSS responsive layout and explicit ownership of dynamic nodes. Router state/deep links belong in URL-aware application state.
|
|
10
|
+
|
|
11
|
+
## Typography/custom fonts
|
|
12
|
+
|
|
13
|
+
Configure fonts in static HTML/CSS; verify fallback/subsets/scaling/localization. Use semantic type classes rather than inline font sizes in every element.
|
|
14
|
+
|
|
15
|
+
## Motion/reduced motion
|
|
16
|
+
|
|
17
|
+
Use CSS transitions/keyframes and `@media (prefers-reduced-motion: reduce)` first. Browser media query state can be read through scala-js-dom when reactive behavior depends on it. Do not use stream timing as decoration that masks state errors.
|
|
18
|
+
|
|
19
|
+
## Accessibility specifics
|
|
20
|
+
|
|
21
|
+
Scala DOM Types exposes HTML attributes/props/ARIA-like browser behavior, but type safety does not enforce semantics. Use labels, real buttons/links/forms, focus restoration after dynamic insertion/removal, keyboard paths, and visible focus. Validate the actual DOM/accessibility tree.
|
|
22
|
+
|
|
23
|
+
## States idiom
|
|
24
|
+
|
|
25
|
+
Airstream signals/events should model loading/empty/error/offline/stale/permission/optimistic states explicitly. Avoid sample/combine patterns that drop errors or leave stale data indistinguishable from current data. Preserve input across validation/server failure.
|
|
26
|
+
|
|
27
|
+
## Forms idiom
|
|
28
|
+
|
|
29
|
+
Use native forms/labels/types/autocomplete/inputmode. Controlled inputs need careful cursor/focus behavior because fine-grained updates may replace nodes. Validate at blur/submit and map server errors without clearing values.
|
|
30
|
+
|
|
31
|
+
## Do/don't pairs
|
|
32
|
+
|
|
33
|
+
| Do | Don't |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `label(forId := "email", "Email")` | placeholder-only input |
|
|
36
|
+
| real `button`/`form` elements | clickable divs driven by event streams |
|
|
37
|
+
| explicit async state ADT | unlabeled stale data after failed refresh |
|
|
38
|
+
| semantic class tokens | repeated inline color/style literals |
|
|
39
|
+
|
|
40
|
+
## Known traps
|
|
41
|
+
|
|
42
|
+
Unexpected element replacement causing focus loss, stream lifecycle leaks, missing keys in dynamic lists, Scala.js bundle size/compile-time hiding UX failure, exception paths that never surface in UI, imperative DOM interop divergence.
|
|
43
|
+
|
|
44
|
+
## Verification commands
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
sbt test
|
|
48
|
+
sbt fastLinkJS
|
|
49
|
+
sbt fullLinkJS
|
|
50
|
+
npx playwright test
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Inspect production/fast output differences, DOM/focus/accessibility behavior, offline/server failure, reduced motion, browser zoom/text scaling, localization expansion.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Server-rendered web: Rails/Hotwire, Laravel/Blade/Livewire, Django/Jinja, Phoenix/LiveView, Blazor, Go templ
|
|
2
|
+
|
|
3
|
+
The common discipline: the server owns initial semantic HTML, routing, validation, authorization, and most state. Progressive enhancement must not break URLs, forms, back/forward, refresh, or no-/limited-JS behavior.
|
|
4
|
+
|
|
5
|
+
## Token mapping
|
|
6
|
+
|
|
7
|
+
Import generated CSS variables in the base layout/asset pipeline. Do not duplicate token values across framework-specific CSS build systems. In component ecosystems (Livewire/Blazor/LiveView), pass semantic class names/state rather than raw visual constants.
|
|
8
|
+
|
|
9
|
+
## Rails + Hotwire
|
|
10
|
+
|
|
11
|
+
- Layout/response: Turbo Frames/Drive preserve shell navigation; fragments must have stable IDs and complete semantics in context.
|
|
12
|
+
- Forms: Rails form helpers generate labels/error associations only when used deliberately. Preserve input after validation failure and use status/pending behavior.
|
|
13
|
+
- Motion/a11y: Turbo replacement can destroy focus. Manage focus explicitly and honor reduced motion in CSS.
|
|
14
|
+
- Do: `<a href="/invoices/4" data-turbo-frame="_top">View invoice</a>`.
|
|
15
|
+
- Don't: swap a frame containing duplicate heading IDs or remove the element that had focus without restoration.
|
|
16
|
+
- Verify: `bin/rails test`, system tests/browser, `bin/rails test:system` where configured.
|
|
17
|
+
|
|
18
|
+
## Laravel Blade + Livewire
|
|
19
|
+
|
|
20
|
+
- Layout/response: Blade layouts own shell; Livewire components own interactive regions. Keep URLs/authorization consistent with server routes.
|
|
21
|
+
- Forms: use validation error bags adjacent to fields, preserve old input/model state, correct autocomplete/input types.
|
|
22
|
+
- Motion/a11y: Livewire DOM diffing can reuse elements/focus unexpectedly; use wire:key deliberately and explicit loading states (`wire:loading` with restraint).
|
|
23
|
+
- Do: `<button wire:click="save" wire:loading.attr="disabled">Save invoice</button>` plus visible status.
|
|
24
|
+
- Don't: silent background mutation or validation only as disappearing toast.
|
|
25
|
+
- Verify: `php artisan test`, Pest/PHPUnit, browser/Dusk where present.
|
|
26
|
+
|
|
27
|
+
## Django + Jinja/templates
|
|
28
|
+
|
|
29
|
+
- Layout/response: template inheritance owns shell; partials/fragments must remain valid in context. CSRF/auth behavior is core UX/security.
|
|
30
|
+
- Forms: Django form rendering can associate labels/errors, but customize deliberately rather than dumping `{{ form.as_p }}` without design. Preserve bound values after errors.
|
|
31
|
+
- Motion/a11y: enhancement fragments require focus/status ownership just like any DOM replacement.
|
|
32
|
+
- Do: render `form.field.errors` adjacent and use `label_tag` correctly.
|
|
33
|
+
- Don't: hide validation behind generic “invalid form” or lose posted values.
|
|
34
|
+
- Verify: `python manage.py test`, `python manage.py check`, browser tests where configured.
|
|
35
|
+
|
|
36
|
+
## Phoenix + LiveView
|
|
37
|
+
|
|
38
|
+
- Layout/response: LiveView state/diffing is powerful but must preserve URLs, focus, scroll, and process failure semantics. Dead-view initial render matters.
|
|
39
|
+
- Forms: `phx-change`/`phx-submit` validation must not be premature; assign errors visibly and preserve input. uploads need progress/failure/cancel behavior.
|
|
40
|
+
- Motion/a11y: LiveView patches can move/remove focus. JS hooks must clean up and honor reduced motion.
|
|
41
|
+
- Do: use `phx-disable-with` and explicit async_result/state assignment.
|
|
42
|
+
- Don't: use a spinner-only LV state or reconnect behavior that loses in-progress work silently.
|
|
43
|
+
- Verify: `mix test`, `mix format --check-formatted`, browser/LiveView tests.
|
|
44
|
+
|
|
45
|
+
## Blazor
|
|
46
|
+
|
|
47
|
+
- Layout/response: Server/prerendering/interactive modes have different hydration latency and circuit behavior. Preserve semantic initial HTML and do not leave visible controls dead while interactivity starts.
|
|
48
|
+
- Forms: `EditForm`/`Input*` components provide validation only when model annotations/custom logic are correct; use persistent labels and error summaries.
|
|
49
|
+
- Motion/a11y: circuit reconnect/dispose state matters; JS interop must honor reduced motion and clean up.
|
|
50
|
+
- Do: `<InputText id="email" @bind-Value="model.Email" autocomplete="email" />` with matching label/validation message.
|
|
51
|
+
- Don't: assume validation summary replaces adjacent recovery copy.
|
|
52
|
+
- Verify: `dotnet test`, `dotnet build`, browser Playwright/bUnit tests.
|
|
53
|
+
|
|
54
|
+
## Go templ/html/template
|
|
55
|
+
|
|
56
|
+
- Layout/response: compositional templates must produce valid complete HTML; use explicit template ownership to avoid duplicated IDs/headings in partials.
|
|
57
|
+
- Forms: handlers must preserve posted values/errors explicitly; use correct escaping and do not bypass html/template protections.
|
|
58
|
+
- Motion/a11y: any htmx/Alpine enhancement follows the hypermedia rules; server response status/fragment design owns state truth.
|
|
59
|
+
- Do: return a field-error partial containing the preserved value and recovery text.
|
|
60
|
+
- Don't: print raw validation structs as user copy or drop POST input on failure.
|
|
61
|
+
- Verify: `go test ./...`, `go vet ./...`, browser tests where configured.
|
|
62
|
+
|
|
63
|
+
## Cross-stack traps
|
|
64
|
+
|
|
65
|
+
- fragment swaps duplicating IDs/landmarks or destroying focus;
|
|
66
|
+
- hidden divergence between enhanced and no-JS behavior;
|
|
67
|
+
- validation rendered only in toast/console;
|
|
68
|
+
- cached fragments leaking user/session-specific data;
|
|
69
|
+
- timezone/locale rendering mismatch between server/client;
|
|
70
|
+
- CSRF/session expiry losing form input;
|
|
71
|
+
- pagination/filter state absent from URLs and therefore lost on back/share/refresh.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Solid / SolidStart
|
|
2
|
+
|
|
3
|
+
## Token mapping
|
|
4
|
+
|
|
5
|
+
Import generated CSS variables once at entry/root and consume semantic roles in CSS or style props:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import './tokens.css';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Fine-grained reactivity does not require fine-grained token duplication. Use typed constants only for names/roles, not copied raw colors.
|
|
12
|
+
|
|
13
|
+
## Layout and responsive idioms
|
|
14
|
+
|
|
15
|
+
Use CSS-first layout. `<Show>`, `<For>`, and `<Suspense>` control state rendering; they do not design layout. Solid's lack of VDOM means DOM structure and control flow are explicit—use that predictability rather than hiding conditionality inside broad wrappers.
|
|
16
|
+
|
|
17
|
+
## Typography/custom fonts
|
|
18
|
+
|
|
19
|
+
Load fonts in HTML entry/root route with explicit fallback behavior. Keep text as real DOM text; do not replace typography with canvas or SVG except for genuinely graphical content.
|
|
20
|
+
|
|
21
|
+
## Motion/reduced motion
|
|
22
|
+
|
|
23
|
+
Use CSS transitions/animations where possible. JS animation should be created inside lifecycle-aware code (`onMount`/`createEffect`) and honor `matchMedia('(prefers-reduced-motion: reduce)')`. Avoid retriggering effects because signals mutate too broadly.
|
|
24
|
+
|
|
25
|
+
## Accessibility specifics
|
|
26
|
+
|
|
27
|
+
Use native elements. Solid event/delegation patterns still require keyboard/focus semantics. `<For>` with keyed references preserves DOM identity; incorrect reuse can retain focus/selection in the wrong row. Manage focus when conditional branches mount/unmount controls.
|
|
28
|
+
|
|
29
|
+
## States idiom
|
|
30
|
+
|
|
31
|
+
Use resources: `resource.loading`, `resource.error`, `resource.latest`/`()` distinction, refetch/stale behavior, and mutation pending/rollback. Show empty and partial data explicitly. `<Suspense>` fallback should preserve structure rather than blanking a full route.
|
|
32
|
+
|
|
33
|
+
## Forms idiom
|
|
34
|
+
|
|
35
|
+
Use native forms where possible. Correct attributes (`for` in Solid is usually `for`/`htmlFor` depending version/plugin—follow project convention and generated DOM) must produce real label association. Server functions/actions need validation error shape and input preservation.
|
|
36
|
+
|
|
37
|
+
## Do/don't pairs
|
|
38
|
+
|
|
39
|
+
| Do | Don't |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `<A href="/invoice/42">View invoice</A>` | click-only `<div>` navigation |
|
|
42
|
+
| `<For each={items()}>{item => <Row item={item} />}</For>` with stable identity | index-only logic that reuses DOM/state incorrectly |
|
|
43
|
+
| narrow signal ownership near the state | one global mutable store with unclear invalidation |
|
|
44
|
+
| `createResource` state rendered explicitly | treating loading/error/empty as one falsey branch |
|
|
45
|
+
| cleanup animation/listener in `onCleanup` | assuming component teardown removes browser work automatically |
|
|
46
|
+
|
|
47
|
+
## Known traps
|
|
48
|
+
|
|
49
|
+
Signal dependency over-invalidation, destructuring props losing reactivity, DOM identity/focus reuse, SSR hydration mismatch, suspense layout collapse, hidden browser-only initialization, overuse of effects where derived state belongs.
|
|
50
|
+
|
|
51
|
+
## Verification commands
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npm run lint
|
|
55
|
+
npm run test -- --run
|
|
56
|
+
npm run build
|
|
57
|
+
npx playwright test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Rendered browser inspection is still required for hierarchy, focus, and motion evidence.
|