@bovinphang/frontend-craft 2.6.0 → 2.8.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/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +72 -1
- package/CHANGELOG.zh-CN.md +71 -1
- package/README.md +10 -6
- package/README.openclaw.md +100 -42
- package/README.openclaw.zh-CN.md +100 -42
- package/README.zh-CN.md +10 -6
- package/agents/fec-architect.md +70 -70
- package/agents/fec-code-reviewer.md +82 -82
- package/agents/fec-debugger.md +20 -20
- package/agents/fec-design-token-mapper.md +36 -36
- package/agents/fec-doc-updater.md +13 -13
- package/agents/fec-e2e-runner.md +45 -45
- package/agents/fec-figma-implementer.md +59 -59
- package/agents/fec-performance-optimizer.md +128 -128
- package/agents/fec-refactor-cleaner.md +14 -14
- package/agents/fec-security-reviewer.md +66 -67
- package/agents/fec-test-planner.md +27 -27
- package/agents/fec-typescript-reviewer.md +88 -88
- package/agents/fec-ui-checker.md +74 -74
- package/commands/fec-debug.md +19 -19
- package/commands/fec-doc-sync.md +11 -11
- package/commands/fec-init.md +37 -38
- package/commands/fec-plan.md +58 -58
- package/commands/fec-refactor-clean.md +11 -11
- package/commands/fec-review.md +41 -41
- package/commands/fec-scaffold.md +41 -41
- package/commands/fec-tdd.md +13 -13
- package/dist/bin/frontend-craft.js +29 -27
- package/docs/example-prompts.md +84 -69
- package/docs/ja-JP/README.md +56 -52
- package/docs/ko-KR/README.md +45 -41
- package/docs/project-structure.md +19 -7
- package/docs/superpowers/plans/2026-05-29-fec-debug.md +491 -0
- package/docs/superpowers/specs/2026-05-29-fec-debug-design.md +340 -0
- package/docs/zh-CN/example-prompts.md +84 -69
- package/docs/zh-CN/project-structure.md +14 -5
- package/docs/zh-TW/README.md +33 -29
- package/localized/zh-CN/agents/fec-architect.md +125 -0
- package/localized/zh-CN/agents/fec-code-reviewer.md +152 -0
- package/localized/zh-CN/agents/fec-debugger.md +44 -0
- package/localized/zh-CN/agents/fec-design-token-mapper.md +75 -0
- package/localized/zh-CN/agents/fec-doc-updater.md +30 -0
- package/localized/zh-CN/agents/fec-e2e-runner.md +107 -0
- package/localized/zh-CN/agents/fec-figma-implementer.md +104 -0
- package/localized/zh-CN/agents/fec-performance-optimizer.md +293 -0
- package/localized/zh-CN/agents/fec-refactor-cleaner.md +32 -0
- package/localized/zh-CN/agents/fec-security-reviewer.md +116 -0
- package/localized/zh-CN/agents/fec-test-planner.md +50 -0
- package/localized/zh-CN/agents/fec-typescript-reviewer.md +142 -0
- package/localized/zh-CN/agents/fec-ui-checker.md +120 -0
- package/localized/zh-CN/commands/fec-debug.md +30 -0
- package/localized/zh-CN/commands/fec-doc-sync.md +19 -0
- package/localized/zh-CN/commands/fec-init.md +70 -0
- package/localized/zh-CN/commands/fec-plan.md +94 -0
- package/localized/zh-CN/commands/fec-refactor-clean.md +19 -0
- package/localized/zh-CN/commands/fec-review.md +66 -0
- package/localized/zh-CN/commands/fec-scaffold.md +205 -0
- package/localized/zh-CN/commands/fec-tdd.md +21 -0
- package/localized/zh-CN/skills/TEMPLATE.md +155 -0
- package/localized/zh-CN/skills/eval_queries.json +1013 -0
- package/localized/zh-CN/skills/fec-accessibility-check/SKILL.md +39 -0
- package/localized/zh-CN/skills/fec-accessibility-check/references/report-template.md +23 -0
- package/localized/zh-CN/skills/fec-accessibility-check/references/screen-reader-testing.md +33 -0
- package/localized/zh-CN/skills/fec-alchemy/SKILL.md +74 -0
- package/localized/zh-CN/skills/fec-alchemy/assets/absorption-plan-template.md +47 -0
- package/localized/zh-CN/skills/fec-alchemy/assets/intake-template.md +55 -0
- package/localized/zh-CN/skills/fec-alchemy/assets/review-checklist.md +31 -0
- package/localized/zh-CN/skills/fec-alchemy/references/methodology.md +94 -0
- package/localized/zh-CN/skills/fec-alchemy/references/originality-and-licensing.md +57 -0
- package/localized/zh-CN/skills/fec-api-integration/SKILL.md +78 -0
- package/localized/zh-CN/skills/fec-api-integration/references/integration-patterns.md +80 -0
- package/localized/zh-CN/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
- package/localized/zh-CN/skills/fec-browser-storage/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-browser-storage/references/storage-patterns.md +65 -0
- package/localized/zh-CN/skills/fec-canvas-threejs/SKILL.md +66 -0
- package/localized/zh-CN/skills/fec-canvas-threejs/references/rendering-patterns.md +67 -0
- package/localized/zh-CN/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +67 -0
- package/localized/zh-CN/skills/fec-code-review/SKILL.md +143 -0
- package/localized/zh-CN/skills/fec-code-review/references/report-template.md +29 -0
- package/localized/zh-CN/skills/fec-component-testing/SKILL.md +119 -0
- package/localized/zh-CN/skills/fec-data-fetching/SKILL.md +62 -0
- package/localized/zh-CN/skills/fec-data-fetching/references/query-patterns.md +103 -0
- package/localized/zh-CN/skills/fec-debug-framework/SKILL.md +157 -0
- package/localized/zh-CN/skills/fec-debug-framework/references/report-template.md +58 -0
- package/localized/zh-CN/skills/fec-dependency-upgrade/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +56 -0
- package/localized/zh-CN/skills/fec-doc-sync/SKILL.md +39 -0
- package/localized/zh-CN/skills/fec-drawio-studio/SKILL.md +73 -0
- package/localized/zh-CN/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
- package/localized/zh-CN/skills/fec-drawio-studio/data/brand-icons.json +878 -0
- package/localized/zh-CN/skills/fec-drawio-studio/data/shape-index.json +83570 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/data-residency.md +27 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
- package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
- package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
- package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
- package/localized/zh-CN/skills/fec-drawio-studio/styles/schema.json +112 -0
- package/localized/zh-CN/skills/fec-e2e-testing/SKILL.md +42 -0
- package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
- package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
- package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
- package/localized/zh-CN/skills/fec-e2e-testing/references/playwright-patterns.md +95 -0
- package/localized/zh-CN/skills/fec-form-handling/SKILL.md +76 -0
- package/localized/zh-CN/skills/fec-form-handling/references/advanced-form-patterns.md +101 -0
- package/localized/zh-CN/skills/fec-image-generation/SKILL.md +80 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
- package/localized/zh-CN/skills/fec-image-generation/references/artifact-routing.md +80 -0
- package/localized/zh-CN/skills/fec-image-generation/references/diagram-workflows.md +74 -0
- package/localized/zh-CN/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
- package/localized/zh-CN/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
- package/localized/zh-CN/skills/fec-implement-from-design/SKILL.md +129 -0
- package/localized/zh-CN/skills/fec-implement-from-design/references/design-plan-template.md +36 -0
- package/localized/zh-CN/skills/fec-legacy-to-modern-migration/SKILL.md +46 -0
- package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
- package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +41 -0
- package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
- package/localized/zh-CN/skills/fec-legacy-web-standard/SKILL.md +35 -0
- package/localized/zh-CN/skills/fec-legacy-web-standard/references/legacy-patterns.md +85 -0
- package/localized/zh-CN/skills/fec-list-virtualization/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-list-virtualization/references/virtualization-patterns.md +80 -0
- package/localized/zh-CN/skills/fec-monorepo-project-standard/SKILL.md +142 -0
- package/localized/zh-CN/skills/fec-motion-interaction/SKILL.md +73 -0
- package/localized/zh-CN/skills/fec-motion-interaction/references/motion-patterns.md +112 -0
- package/localized/zh-CN/skills/fec-nextjs-project-standard/SKILL.md +123 -0
- package/localized/zh-CN/skills/fec-nuxt-project-standard/SKILL.md +122 -0
- package/localized/zh-CN/skills/fec-performance-optimization/SKILL.md +80 -0
- package/localized/zh-CN/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
- package/localized/zh-CN/skills/fec-performance-optimization/references/report-template.md +59 -0
- package/localized/zh-CN/skills/fec-pwa-implementation/SKILL.md +35 -0
- package/localized/zh-CN/skills/fec-pwa-implementation/references/manifest-and-icons.md +53 -0
- package/localized/zh-CN/skills/fec-pwa-implementation/references/service-worker-workbox.md +68 -0
- package/localized/zh-CN/skills/fec-react-project-standard/SKILL.md +91 -0
- package/localized/zh-CN/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
- package/localized/zh-CN/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
- package/localized/zh-CN/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
- package/localized/zh-CN/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
- package/localized/zh-CN/skills/fec-refactor-clean/SKILL.md +51 -0
- package/localized/zh-CN/skills/fec-refactor-clean/references/report-template.md +42 -0
- package/localized/zh-CN/skills/fec-responsive-layout/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-responsive-layout/references/responsive-layout-patterns.md +70 -0
- package/localized/zh-CN/skills/fec-route-protection/SKILL.md +135 -0
- package/localized/zh-CN/skills/fec-security-review/SKILL.md +38 -0
- package/localized/zh-CN/skills/fec-security-review/references/report-template.md +27 -0
- package/localized/zh-CN/skills/fec-security-review/references/security-checklist.md +64 -0
- package/localized/zh-CN/skills/fec-source-driven-development/SKILL.md +87 -0
- package/localized/zh-CN/skills/fec-state-management/SKILL.md +140 -0
- package/localized/zh-CN/skills/fec-state-management/references/state-patterns.md +109 -0
- package/localized/zh-CN/skills/fec-storybook-component-doc/SKILL.md +37 -0
- package/localized/zh-CN/skills/fec-storybook-component-doc/references/story-patterns.md +118 -0
- package/localized/zh-CN/skills/fec-svg-animation/SKILL.md +148 -0
- package/localized/zh-CN/skills/fec-tailwind-design-system/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +59 -0
- package/localized/zh-CN/skills/fec-tdd-workflow/SKILL.md +52 -0
- package/localized/zh-CN/skills/fec-testing-strategy/SKILL.md +45 -0
- package/localized/zh-CN/skills/fec-typescript-project-standard/SKILL.md +54 -0
- package/{skills/fec-typescript-type-safety → localized/zh-CN/skills/fec-typescript-project-standard}/references/type-safety-patterns.md +1 -1
- package/{skills/fec-typescript-type-safety/SKILL.md → localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety.md} +5 -14
- package/localized/zh-CN/skills/fec-ui-design/SKILL.md +108 -0
- package/localized/zh-CN/skills/fec-ui-design/data/product-rules.json +231 -0
- package/localized/zh-CN/skills/fec-ui-design/data/stack-ui-rules.json +146 -0
- package/localized/zh-CN/skills/fec-ui-design/data/style-archetypes.json +373 -0
- package/localized/zh-CN/skills/fec-ui-design/data/ux-quality-rules.json +203 -0
- package/localized/zh-CN/skills/fec-ui-design/references/design-intelligence.md +97 -0
- package/localized/zh-CN/skills/fec-ui-design/references/master-page-overrides.md +30 -0
- package/localized/zh-CN/skills/fec-ui-design/references/pre-delivery-checklist.md +39 -0
- package/localized/zh-CN/skills/fec-ui-design/scripts/design-system.mjs +648 -0
- package/localized/zh-CN/skills/fec-validation-fix/SKILL.md +51 -0
- package/localized/zh-CN/skills/fec-validation-fix/references/report-template.md +43 -0
- package/localized/zh-CN/skills/fec-vite-project-standard/SKILL.md +83 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/SKILL.md +58 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +162 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-project-structure.md +176 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/SKILL.md +61 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/references/content-plan.md +38 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/references/theme-system.md +36 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
- package/localized/zh-CN/skills/fec-web-workers/SKILL.md +35 -0
- package/localized/zh-CN/skills/fec-web-workers/references/advanced-workers.md +54 -0
- package/localized/zh-CN/skills/fec-web-workers/references/basic-worker.md +67 -0
- package/localized/zh-CN/skills/metadata.json +1646 -0
- package/localized/zh-CN/skills/relations.json +755 -0
- package/localized/zh-CN/templates/claude/CLAUDE.md +106 -0
- package/localized/zh-CN/templates/claude/settings.json +62 -0
- package/localized/zh-CN/templates/codex/AGENTS.md +105 -0
- package/localized/zh-CN/templates/codex/config.toml +32 -0
- package/localized/zh-CN/templates/openclaw/AGENTS.md +101 -0
- package/localized/zh-CN/templates/openclaw/OPENCLAW-CONFIG.md +12 -0
- package/localized/zh-CN/templates/shared/rules/fec-agent-workflow.md +54 -0
- package/localized/zh-CN/templates/shared/rules/fec-api-layer.md +99 -0
- package/localized/zh-CN/templates/shared/rules/fec-ci-cd.md +40 -0
- package/localized/zh-CN/templates/shared/rules/fec-code-comments.md +33 -0
- package/localized/zh-CN/templates/shared/rules/fec-design-system.md +72 -0
- package/localized/zh-CN/templates/shared/rules/fec-error-handling.md +56 -0
- package/localized/zh-CN/templates/shared/rules/fec-git-conventions.md +73 -0
- package/localized/zh-CN/templates/shared/rules/fec-i18n.md +64 -0
- package/localized/zh-CN/templates/shared/rules/fec-naming-conventions.md +120 -0
- package/localized/zh-CN/templates/shared/rules/fec-performance.md +101 -0
- package/localized/zh-CN/templates/shared/rules/fec-react.md +82 -0
- package/localized/zh-CN/templates/shared/rules/fec-refactoring.md +47 -0
- package/localized/zh-CN/templates/shared/rules/fec-rendering-patterns.md +40 -0
- package/localized/zh-CN/templates/shared/rules/fec-responsive-design.md +50 -0
- package/localized/zh-CN/templates/shared/rules/fec-source-driven-development.md +31 -0
- package/localized/zh-CN/templates/shared/rules/fec-state-management.md +60 -0
- package/localized/zh-CN/templates/shared/rules/fec-testing.md +98 -0
- package/localized/zh-CN/templates/shared/rules/fec-typescript.md +112 -0
- package/localized/zh-CN/templates/shared/rules/fec-vue.md +64 -0
- package/localized/zh-CN/templates/shared/rules/fec-working-modes.md +50 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -3
- package/skills/TEMPLATE.md +74 -74
- package/skills/eval_queries.json +717 -619
- package/skills/fec-accessibility-check/SKILL.md +21 -21
- package/skills/fec-accessibility-check/references/report-template.md +12 -12
- package/skills/fec-accessibility-check/references/screen-reader-testing.md +24 -24
- package/skills/fec-alchemy/SKILL.md +50 -50
- package/skills/fec-alchemy/assets/absorption-plan-template.md +32 -32
- package/skills/fec-alchemy/assets/intake-template.md +55 -55
- package/skills/fec-alchemy/assets/review-checklist.md +23 -23
- package/skills/fec-alchemy/references/methodology.md +66 -66
- package/skills/fec-alchemy/references/originality-and-licensing.md +42 -42
- package/skills/fec-api-integration/SKILL.md +61 -61
- package/skills/fec-api-integration/references/integration-patterns.md +30 -30
- package/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
- package/skills/fec-browser-storage/SKILL.md +16 -16
- package/skills/fec-browser-storage/references/storage-patterns.md +16 -16
- package/skills/fec-canvas-threejs/SKILL.md +21 -21
- package/skills/fec-canvas-threejs/references/rendering-patterns.md +10 -10
- package/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +37 -37
- package/skills/fec-code-review/SKILL.md +94 -94
- package/skills/fec-code-review/references/report-template.md +13 -13
- package/skills/fec-component-testing/SKILL.md +39 -39
- package/skills/fec-data-fetching/SKILL.md +16 -16
- package/skills/fec-data-fetching/references/query-patterns.md +27 -27
- package/skills/fec-debug-framework/SKILL.md +95 -95
- package/skills/fec-debug-framework/references/report-template.md +34 -34
- package/skills/fec-dependency-upgrade/SKILL.md +17 -17
- package/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +31 -31
- package/skills/fec-doc-sync/SKILL.md +23 -23
- package/skills/fec-drawio-studio/SKILL.md +73 -0
- package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
- package/skills/fec-drawio-studio/data/brand-icons.json +878 -0
- package/skills/fec-drawio-studio/data/shape-index.json +83570 -0
- package/skills/fec-drawio-studio/references/data-residency.md +27 -0
- package/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
- package/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
- package/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
- package/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
- package/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
- package/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
- package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
- package/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
- package/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
- package/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
- package/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
- package/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
- package/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
- package/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
- package/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
- package/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
- package/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
- package/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
- package/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
- package/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
- package/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
- package/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
- package/skills/fec-drawio-studio/styles/schema.json +112 -0
- package/skills/fec-e2e-testing/SKILL.md +24 -22
- package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
- package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
- package/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
- package/skills/fec-e2e-testing/references/playwright-patterns.md +6 -6
- package/skills/fec-form-handling/SKILL.md +21 -21
- package/skills/fec-form-handling/references/advanced-form-patterns.md +41 -41
- package/skills/fec-image-generation/SKILL.md +81 -0
- package/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
- package/skills/fec-image-generation/references/artifact-routing.md +80 -0
- package/skills/fec-image-generation/references/diagram-workflows.md +74 -0
- package/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
- package/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
- package/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
- package/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
- package/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
- package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
- package/skills/fec-implement-from-design/SKILL.md +81 -74
- package/skills/fec-implement-from-design/references/design-plan-template.md +16 -16
- package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -173
- package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
- package/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +37 -37
- package/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
- package/skills/fec-legacy-web-standard/SKILL.md +17 -17
- package/skills/fec-legacy-web-standard/references/legacy-patterns.md +16 -16
- package/skills/fec-list-virtualization/SKILL.md +16 -16
- package/skills/fec-list-virtualization/references/virtualization-patterns.md +31 -31
- package/skills/fec-monorepo-project-standard/SKILL.md +52 -52
- package/skills/fec-motion-interaction/SKILL.md +51 -44
- package/skills/fec-motion-interaction/references/motion-patterns.md +11 -11
- package/skills/fec-nextjs-project-standard/SKILL.md +64 -58
- package/skills/fec-nuxt-project-standard/SKILL.md +57 -57
- package/skills/fec-performance-optimization/SKILL.md +54 -50
- package/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
- package/skills/fec-performance-optimization/references/report-template.md +34 -28
- package/skills/fec-pwa-implementation/SKILL.md +17 -17
- package/skills/fec-pwa-implementation/references/manifest-and-icons.md +12 -12
- package/skills/fec-pwa-implementation/references/service-worker-workbox.md +13 -13
- package/skills/fec-react-project-standard/SKILL.md +72 -64
- package/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
- package/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
- package/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
- package/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
- package/skills/fec-refactor-clean/SKILL.md +30 -30
- package/skills/fec-refactor-clean/references/report-template.md +23 -23
- package/skills/fec-responsive-layout/SKILL.md +17 -17
- package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +39 -28
- package/skills/fec-route-protection/SKILL.md +26 -26
- package/skills/fec-security-review/SKILL.md +20 -20
- package/skills/fec-security-review/references/report-template.md +12 -12
- package/skills/fec-security-review/references/security-checklist.md +27 -27
- package/skills/fec-source-driven-development/SKILL.md +66 -40
- package/skills/fec-state-management/SKILL.md +34 -34
- package/skills/fec-state-management/references/state-patterns.md +19 -19
- package/skills/fec-storybook-component-doc/SKILL.md +19 -19
- package/skills/fec-storybook-component-doc/references/story-patterns.md +12 -12
- package/skills/fec-svg-animation/SKILL.md +32 -32
- package/skills/fec-tailwind-design-system/SKILL.md +17 -17
- package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +36 -32
- package/skills/fec-tdd-workflow/SKILL.md +28 -28
- package/skills/fec-testing-strategy/SKILL.md +29 -29
- package/skills/fec-typescript-project-standard/SKILL.md +54 -0
- package/skills/fec-typescript-project-standard/references/type-safety-patterns.md +102 -0
- package/skills/fec-typescript-project-standard/references/type-safety.md +148 -0
- package/skills/fec-ui-design/SKILL.md +90 -72
- package/skills/fec-ui-design/data/style-archetypes.json +40 -0
- package/skills/fec-ui-design/data/ux-quality-rules.json +35 -0
- package/skills/fec-ui-design/references/design-intelligence.md +81 -21
- package/skills/fec-ui-design/references/master-page-overrides.md +15 -15
- package/skills/fec-ui-design/references/pre-delivery-checklist.md +38 -32
- package/skills/fec-ui-design/scripts/design-system.mjs +119 -1
- package/skills/fec-validation-fix/SKILL.md +26 -26
- package/skills/fec-validation-fix/references/report-template.md +25 -25
- package/skills/fec-vite-project-standard/SKILL.md +39 -39
- package/skills/fec-vue3-project-standard/SKILL.md +39 -30
- package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +163 -0
- package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
- package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +177 -0
- package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
- package/skills/fec-web-video-presentation/SKILL.md +61 -0
- package/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
- package/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
- package/skills/fec-web-video-presentation/references/content-plan.md +38 -0
- package/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
- package/skills/fec-web-video-presentation/references/theme-system.md +36 -0
- package/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
- package/skills/fec-web-workers/SKILL.md +16 -16
- package/skills/fec-web-workers/references/advanced-workers.md +13 -13
- package/skills/fec-web-workers/references/basic-worker.md +8 -8
- package/skills/metadata.json +402 -220
- package/skills/relations.json +120 -25
- package/templates/claude/CLAUDE.md +60 -60
- package/templates/codex/AGENTS.md +76 -76
- package/templates/codex/config.toml +4 -4
- package/templates/openclaw/AGENTS.md +68 -68
- package/templates/openclaw/OPENCLAW-CONFIG.md +8 -8
- package/templates/shared/rules/fec-agent-workflow.md +40 -40
- package/templates/shared/rules/fec-api-layer.md +52 -52
- package/templates/shared/rules/fec-ci-cd.md +29 -117
- package/templates/shared/rules/fec-code-comments.md +22 -22
- package/templates/shared/rules/fec-design-system.md +65 -241
- package/templates/shared/rules/fec-error-handling.md +41 -185
- package/templates/shared/rules/fec-git-conventions.md +42 -42
- package/templates/shared/rules/fec-i18n.md +48 -96
- package/templates/shared/rules/fec-naming-conventions.md +91 -91
- package/templates/shared/rules/fec-performance.md +78 -78
- package/templates/shared/rules/fec-react.md +58 -58
- package/templates/shared/rules/fec-refactoring.md +34 -30
- package/templates/shared/rules/fec-rendering-patterns.md +40 -183
- package/templates/shared/rules/fec-responsive-design.md +37 -214
- package/templates/shared/rules/fec-source-driven-development.md +22 -22
- package/templates/shared/rules/fec-state-management.md +45 -148
- package/templates/shared/rules/fec-testing.md +64 -64
- package/templates/shared/rules/fec-typescript.md +98 -341
- package/templates/shared/rules/fec-vue.md +42 -42
- package/templates/shared/rules/fec-working-modes.md +34 -34
- package/skills/fec-e2e-testing/references/e2e-advanced.md +0 -176
- package/skills/fec-react-project-standard/references/react-project-details.md +0 -642
- package/skills/fec-vue3-project-standard/references/vue3-project-details.md +0 -547
|
@@ -1,227 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Responsive design rules
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This document should be used whenever the task involves mobile adaptation, responsive layout, multi-device compatibility, touch targets or viewport behavior. This article only retains project-resident constraints; layout mode, container query, responsive tables, media and validation details are left to `fec-responsive-layout`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Core Principles
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
7
|
+
- **Mobile First**: Start designing for small screens and work your way up to large screens.
|
|
8
|
+
- **Content Priority**: Small screens give priority to core tasks, key operations and feedback, and secondary content is folded, postponed or entered into the detail layer.
|
|
9
|
+
- **Touch Friendly**: All interactive elements must adapt to finger operations, and key functions cannot rely solely on hover.
|
|
10
|
+
- **Performance first**: The mobile network and device performance are weak, so first-screen resources, charts, animations, and large lists should be restrained.
|
|
11
|
+
- **Container Aware**: Reusable components will first adapt to the container in which they are located, instead of assuming full page breakpoints.
|
|
12
|
+
- **Stable size**: Toolbars, table columns, checkerboards, card grids and counters need stable constraints to avoid layout jumps caused by state changes.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Breakpoints and container strategies
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| **Large** | 1280px | 桌面显示器 | `xl:` | 宽屏优化 |
|
|
22
|
-
| **XLarge** | 1536px | 超宽屏 | `2xl:` | 最大内容宽度 |
|
|
16
|
+
- Default validation for 375px, 768px, 1024px, 1440px, and breakpoint intermediate values.
|
|
17
|
+
- Use mobile-first `min-width` breakpoint; do not write the desktop style first and then use `max-width` to supplement the mobile version.
|
|
18
|
+
- Tailwind prefixes are used from smallest to largest: default → `sm:` → `md:` → `lg:` → `xl:` → `2xl:`.
|
|
19
|
+
- Page-level structures can use breakpoints; reusable components that will be placed into sidebars, pop-ups, cards, or main content areas preferentially use container queries.
|
|
20
|
+
- `min-width: 0`, `minmax()`, `aspect-ratio` and explicit overflow strategies must be taken into account when grid/flex children contain long text, charts, code, media or tables.
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
## Touch target to interact with mobile terminal
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
flex-direction: column;
|
|
32
|
-
gap: 12px;
|
|
33
|
-
}
|
|
24
|
+
- When space permits, interaction targets such as buttons, links, and close buttons must be at least 44x44px; compact tool interfaces must be at least operable.
|
|
25
|
+
- Avoid input box font size below 16px to prevent iOS Safari from automatically scaling.
|
|
26
|
+
- Fixed bottom bar, action bar, drawer and dialog box must consider safe area and virtual keyboard.
|
|
27
|
+
- Hover-only messages must have click, focus, or permanent visible alternatives.
|
|
28
|
+
- After switching between horizontal and vertical screens, the main operation, focus position, scroll container and error prompts should still be accessible.
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
@media (min-width: 768px) {
|
|
37
|
-
.container {
|
|
38
|
-
padding: 24px;
|
|
39
|
-
flex-direction: row;
|
|
40
|
-
gap: 24px;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
30
|
+
## Data intensive area
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
margin: 0 auto;
|
|
49
|
-
padding: 32px;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
```
|
|
32
|
+
- Tables, lists, boards, editors and canvases can be partially scrolled horizontally, but the page as a whole should not have unintentional horizontal overflow.
|
|
33
|
+
- Data-intensive views on the mobile terminal need to define column priorities first: main identification, status and main operations are retained first; low-priority fields enter details, expand rows or drawers.
|
|
34
|
+
- Small screens must still retain the ability to sort, filter, paging, and select.
|
|
35
|
+
- Virtual scrolling only solves the problem of DOM quantity and cannot replace information hierarchy design.
|
|
53
36
|
|
|
54
|
-
|
|
37
|
+
## Responsive media
|
|
55
38
|
|
|
56
|
-
|
|
39
|
+
- Images and videos must have stable size, `aspect-ratio` or container constraints to avoid pushing the layout after loading.
|
|
40
|
+
- Use `srcset`, `sizes`, `picture` or frame picture components when multi-size resources are needed to avoid downloading large desktop images on mobile devices.
|
|
41
|
+
- Media cropping must preserve the main information and do not crop out key areas of products, people, graphics or status to fill the card.
|
|
57
42
|
|
|
58
|
-
|
|
59
|
-
<!-- 移动端: 单列, 小间距 | Tablet: 双列 | Desktop: 三列 -->
|
|
60
|
-
<div
|
|
61
|
-
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6 lg:gap-8"
|
|
62
|
-
>
|
|
63
|
-
<!-- 卡片: 移动端小字, Desktop 大字 -->
|
|
64
|
-
<div class="p-4 md:p-6 text-sm md:text-base">...</div>
|
|
65
|
-
</div>
|
|
43
|
+
## Checklist
|
|
66
44
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
**关键约定**:
|
|
75
|
-
|
|
76
|
-
- 始终使用 `min-width` 媒体查询(mobile-first),不用 `max-width`
|
|
77
|
-
- Tailwind 前缀从小到大:`sm:` → `md:` → `lg:` → `xl:`
|
|
78
|
-
- 不要在桌面端写默认样式然后用 `max-width` 覆盖移动端
|
|
79
|
-
|
|
80
|
-
## 触摸目标
|
|
81
|
-
|
|
82
|
-
| 元素 | 最小尺寸 | 说明 |
|
|
83
|
-
| ----------- | --------- | --------------------------- |
|
|
84
|
-
| 按钮 | 44×44px | WCAG 2.2 触摸目标要求 |
|
|
85
|
-
| 链接 | 44×44px | 可通过 padding 扩大点击区域 |
|
|
86
|
-
| 表单输入 | 44px 高度 | 避免 iOS 自动缩放 |
|
|
87
|
-
| 复选框/单选 | 24×24px | 最小可见尺寸 |
|
|
88
|
-
| 关闭按钮 | 44×44px | 模态框、Toast 的关闭按钮 |
|
|
89
|
-
|
|
90
|
-
```css
|
|
91
|
-
/* 扩大点击区域(视觉尺寸不变) */
|
|
92
|
-
.icon-button {
|
|
93
|
-
width: 24px;
|
|
94
|
-
height: 24px;
|
|
95
|
-
padding: 10px; /* 实际点击区域 44×44 */
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/* 表单输入 — 避免 iOS 缩放 */
|
|
99
|
-
input,
|
|
100
|
-
select,
|
|
101
|
-
textarea {
|
|
102
|
-
font-size: 16px; /* < 16px 时 iOS Safari 会自动缩放页面 */
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## 布局模式
|
|
107
|
-
|
|
108
|
-
### Container Query
|
|
109
|
-
|
|
110
|
-
当组件会出现在侧栏、弹窗、卡片和主内容区等不同容器时,优先使用容器查询:
|
|
111
|
-
|
|
112
|
-
```css
|
|
113
|
-
.summary-panel {
|
|
114
|
-
container-type: inline-size;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
@container (min-width: 42rem) {
|
|
118
|
-
.summary-panel__body {
|
|
119
|
-
display: grid;
|
|
120
|
-
grid-template-columns: 16rem minmax(0, 1fr);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Flex/Grid 子项包含长文本、图表、代码或表格时,记得设置 `min-width: 0`。
|
|
126
|
-
|
|
127
|
-
### Stack → Row
|
|
128
|
-
|
|
129
|
-
移动端纵向堆叠,桌面端横向排列:
|
|
130
|
-
|
|
131
|
-
```html
|
|
132
|
-
<div class="flex flex-col md:flex-row gap-4">
|
|
133
|
-
<div class="flex-1">主内容</div>
|
|
134
|
-
<div class="md:w-64 md:flex-shrink-0">侧边栏</div>
|
|
135
|
-
</div>
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 响应式表格
|
|
139
|
-
|
|
140
|
-
```html
|
|
141
|
-
<!-- 小屏横向滚动 -->
|
|
142
|
-
<div class="overflow-x-auto">
|
|
143
|
-
<table class="min-w-full">
|
|
144
|
-
...
|
|
145
|
-
</table>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<!-- 或:移动端卡片式布局 -->
|
|
149
|
-
<div class="hidden md:block">
|
|
150
|
-
<table>
|
|
151
|
-
...
|
|
152
|
-
</table>
|
|
153
|
-
</div>
|
|
154
|
-
<div class="md:hidden">
|
|
155
|
-
<!-- 每行变为卡片 -->
|
|
156
|
-
</div>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
移动端数据密集视图需先定义列优先级:主标识、状态和主操作优先保留;低优先级字段进入详情、展开行或抽屉。
|
|
160
|
-
|
|
161
|
-
### 响应式图片
|
|
162
|
-
|
|
163
|
-
```html
|
|
164
|
-
<!-- srcset 按设备像素比加载 -->
|
|
165
|
-
<img
|
|
166
|
-
src="/img/hero-800.jpg"
|
|
167
|
-
srcset="
|
|
168
|
-
/img/hero-400.jpg 400w,
|
|
169
|
-
/img/hero-800.jpg 800w,
|
|
170
|
-
/img/hero-1200.jpg 1200w
|
|
171
|
-
"
|
|
172
|
-
sizes="(max-width: 768px) 100vw, 800px"
|
|
173
|
-
alt="描述"
|
|
174
|
-
loading="lazy"
|
|
175
|
-
/>
|
|
176
|
-
|
|
177
|
-
<!-- picture 元素按断点切换 -->
|
|
178
|
-
<picture>
|
|
179
|
-
<source
|
|
180
|
-
media="(min-width: 1024px)"
|
|
181
|
-
srcset="/img/hero-desktop.webp"
|
|
182
|
-
type="image/webp"
|
|
183
|
-
/>
|
|
184
|
-
<source
|
|
185
|
-
media="(min-width: 768px)"
|
|
186
|
-
srcset="/img/hero-tablet.webp"
|
|
187
|
-
type="image/webp"
|
|
188
|
-
/>
|
|
189
|
-
<img src="/img/hero-mobile.webp" alt="描述" loading="lazy" />
|
|
190
|
-
</picture>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## 移动端交互注意
|
|
194
|
-
|
|
195
|
-
- **悬停不可靠**: 移动端无 hover 状态,不要将关键功能隐藏在 hover 中(如 tooltip 改为点击触发)
|
|
196
|
-
- **键盘弹出**: 移动端虚拟键盘会缩小可视区域,固定定位元素需注意位置调整
|
|
197
|
-
- **滚动性能**: 使用 `-webkit-overflow-scrolling: touch`(iOS)或 `overscroll-behavior` 优化滚动体验
|
|
198
|
-
- **安全区域**: 适配 iPhone 刘海/底部横条,使用 `env(safe-area-inset-*)`:
|
|
199
|
-
|
|
200
|
-
```css
|
|
201
|
-
.app-content {
|
|
202
|
-
padding-top: env(safe-area-inset-top);
|
|
203
|
-
padding-bottom: env(safe-area-inset-bottom);
|
|
204
|
-
padding-left: env(safe-area-inset-left);
|
|
205
|
-
padding-right: env(safe-area-inset-right);
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
## 测试策略
|
|
210
|
-
|
|
211
|
-
- 使用 Chrome DevTools Device Mode 测试主流设备
|
|
212
|
-
- 优先在真实设备上测试(iOS Safari / Android Chrome)
|
|
213
|
-
- 测试方向切换(横屏 / 竖屏)
|
|
214
|
-
- 测试不同网络条件(3G / 4G / 弱网)
|
|
215
|
-
- 不要假设桌面端是"默认",移动端优先验证
|
|
216
|
-
|
|
217
|
-
## 检查清单
|
|
218
|
-
|
|
219
|
-
- [ ] 375px 宽度下布局正常,无水平溢出
|
|
220
|
-
- [ ] 所有交互元素 ≥ 44×44px(触摸目标)
|
|
221
|
-
- [ ] 输入框 font-size ≥ 16px(避免 iOS 缩放)
|
|
222
|
-
- [ ] 无 hover 依赖的关键功能
|
|
223
|
-
- [ ] 图片使用 srcset / picture 按设备加载
|
|
224
|
-
- [ ] iPhone 安全区域适配(safe-area-inset)
|
|
225
|
-
- [ ] 内容在断点间平滑过渡,无突变
|
|
226
|
-
- [ ] 断点中间值、横竖屏切换和虚拟键盘弹出不遮挡主操作
|
|
227
|
-
- [ ] 数据密集区域有列优先级或局部滚动策略
|
|
45
|
+
- [ ] 320-375px No horizontal overflow at page level.
|
|
46
|
+
- [ ] The reading order is reasonable after breakpoint switching, and the main operation is not hidden.
|
|
47
|
+
- [ ] Touch target, input font size, safe area, virtual keyboard and horizontal and vertical screen behaviors have been verified.
|
|
48
|
+
- [ ] loading, empty, error, disabled, hover/focus, long translation text and large numbers will not break the fixed format control.
|
|
49
|
+
- [ ] Column priority, partial scrolling, or mobile summary strategies for data-intensive areas.
|
|
50
|
+
- [ ] The size of first-screen media is stable, and non-first-screen media will not slow down the main path of the mobile terminal.
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Source-driven development rules
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
When an implementation relies on a framework, library, browser, runtime, build tool, or platform behavior, confirm the source of truth before writing code or reviewing conclusions.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Fact source priority
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
2.
|
|
9
|
-
3. Web
|
|
10
|
-
4.
|
|
7
|
+
1. README, configuration, testing, templates and existing implementations within the project.
|
|
8
|
+
2. Official documents, source code, type definitions, release notes, migration guide.
|
|
9
|
+
3. Web standards, browser compatibility data, and platform documentation.
|
|
10
|
+
4. Issues, discussions, blogs and third-party articles are only used as clues.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Usage scenarios
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
14
|
+
- New versions of frameworks, routing, rendering modes, caching, build configurations, browser APIs.
|
|
15
|
+
- Public interfaces, component APIs, design system tokens, CLI commands, and plugin metadata.
|
|
16
|
+
- Dependency upgrade, migration, obsolete API replacement, cross-runtime compatibility.
|
|
17
|
+
- Version-sensitive judgments related to security, performance, and accessibility.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Output requirements
|
|
20
20
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
21
|
+
- Write down the source, version or project facts, decision conclusion, scope of influence and verification method.
|
|
22
|
+
- If the current status of the project conflicts with official recommendations, explain the cause of the conflict and the gradual migration strategy.
|
|
23
|
+
- Do not copy long external documents; only keep necessary conclusions, links or file paths within the project.
|
|
24
|
+
- Mark uncertainties and matters requiring confirmation from the user/team when they cannot be verified.
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Anti-pattern
|
|
27
27
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
28
|
+
- Use version-sensitive APIs from memory.
|
|
29
|
+
- Replace official documentation with outdated tutorials.
|
|
30
|
+
- Overturn the stable project agreement in order to pursue new projects.
|
|
31
|
+
- Scatter external library behavior assumptions throughout components instead of centralizing them in the adaptation layer.
|
|
@@ -1,163 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Status management specifications
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This document stipulates that the front-end status belongs to the bottom line. State manifests, Store shape examples, URL states, persistence adapters, and SSR isolation details are left to `fec-state-management`; request caching details are left to the data fetch workflow; and form fields and validation are left to the form workflow.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
| ------------ | -------------------------------- | ------------------- |
|
|
7
|
-
| 组件 UI 状态 | modal 开关、tab 索引、hover 状态 | 组件内 state |
|
|
8
|
-
| 表单状态 | 输入值、校验错误 | 表单库或组件 state |
|
|
9
|
-
| 服务端数据 | 用户列表、订单详情 | 数据请求库缓存 |
|
|
10
|
-
| 全局业务状态 | 当前用户、权限、主题 | 全局 Store |
|
|
11
|
-
| URL 状态 | 当前页码、筛选条件、排序 | 路由参数 / 搜索参数 |
|
|
5
|
+
## Status classification
|
|
12
6
|
|
|
13
|
-
|
|
7
|
+
| Type | Example | Default Attribution |
|
|
8
|
+
| ---- | ---- | -------- |
|
|
9
|
+
| Local UI state | modal switch, tab, expand row, hover editing state | In-component state / ref |
|
|
10
|
+
| Form status | Input value, dirty field, validation error, submitting | Form library or form component |
|
|
11
|
+
| Server status | List, details, paging results, remote errors | Request cache library |
|
|
12
|
+
| URL status | Search terms, filter, sort, page number, selected tab | Routing parameters / search params |
|
|
13
|
+
| Global client status | Login users, topics, permission snapshots, shopping cart drafts | Global store |
|
|
14
|
+
| Browser persistent state | Preferences, non-sensitive drafts, offline queues | Storage layer + state adapter |
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
- **单一数据源**: 同一份数据只在一个地方维护
|
|
17
|
-
- **派生优于同步**: 可计算的值用 computed / useMemo,而不是手动同步多个 state
|
|
18
|
-
- **最小状态**: 不存储可以从已有状态推导的值
|
|
16
|
+
## Core Principles
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
- **Own first, choose library later**: Don’t choose Redux, Zustand, Pinia or Context first; determine the unique owner of each state first.
|
|
19
|
+
- **Nearest Management**: The state is placed in the nearest common ancestor that needs it.
|
|
20
|
+
- **Single Data Source**: The same data is maintained in only one place.
|
|
21
|
+
- **Derivation is better than synchronization**: Values that can be derived from props, server state, URL or existing state, do not save a new copy.
|
|
22
|
+
- **Minimum global state**: The global store only saves client state that is truly cross-page, cross-feature, or requires unified action.
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
## React state boundaries
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
- Use `useState` / `useReducer` for single components or small subtrees.
|
|
27
|
+
- Low-frequency global configuration, theme or dependency injection can use Context; large objects that change frequently should not be placed in Context.
|
|
28
|
+
- For moderately complex business states, Zustand, Jotai or existing warehouse solutions can be used; for large and strict action flows, Redux Toolkit can be used.
|
|
29
|
+
- Server-side data uses the request cache library and is not copied to the global store.
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
const [state, dispatch] = useReducer(formReducer, initialState);
|
|
30
|
-
```
|
|
31
|
+
## Vue state boundary
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
- Use `ref` / `reactive` / `computed` for local state.
|
|
34
|
+
- Use `provide/inject` for local cross-level context.
|
|
35
|
+
- Global business status uses Pinia or the existing store of the project.
|
|
36
|
+
- Server-side data is first managed using the request library or composable and is not written to Pinia intact.
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
## URL and persistent state
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
login: async (credentials) => {
|
|
40
|
-
const user = await authApi.login(credentials);
|
|
41
|
-
set({ user });
|
|
42
|
-
},
|
|
43
|
-
logout: () => set({ user: null }),
|
|
44
|
-
}));
|
|
45
|
-
```
|
|
40
|
+
- When searching, filtering, sorting, paging, selecting tabs, etc., the view state that needs to be shared or refreshed should be given priority to the URL.
|
|
41
|
+
- Browser persistence only saves stable preferences or non-sensitive drafts, and clearly identifies field whitelists, version numbers, migration paths, expiration policies, and sensitive field exclusions.
|
|
42
|
+
- In SSR scenarios, do not create a single instance store with user data at the top level of the module; each request requires an independent instance.
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
## Anti-pattern
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
- Put all state into global store.
|
|
47
|
+
- Store UI temporary state or each field of the form in the store.
|
|
48
|
+
- Manually synchronize multiple copies of the same data instead of deriving from source state.
|
|
49
|
+
- Store the server response intact in the global store without requesting the cache library.
|
|
50
|
+
- Use Context / provide to carry large objects that change frequently, resulting in large-scale re-rendering.
|
|
51
|
+
- Persistent tokens, permission details, personal sensitive data or unversioned large objects.
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
const { data, isLoading, error } = useQuery({
|
|
53
|
-
queryKey: ["users", params],
|
|
54
|
-
queryFn: () => fetchUsers(params),
|
|
55
|
-
staleTime: 5 * 60 * 1000,
|
|
56
|
-
});
|
|
57
|
-
```
|
|
53
|
+
## Checklist
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const form = reactive({ name: "", email: "" });
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### 全局状态(Pinia)
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
export const useAuthStore = defineStore("auth", () => {
|
|
72
|
-
const user = ref<User | null>(null);
|
|
73
|
-
|
|
74
|
-
async function login(credentials: LoginParams) {
|
|
75
|
-
user.value = await authApi.login(credentials);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function logout() {
|
|
79
|
-
user.value = null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const isLoggedIn = computed(() => user.value !== null);
|
|
83
|
-
|
|
84
|
-
return { user: readonly(user), isLoggedIn, login, logout };
|
|
85
|
-
});
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### 服务端状态
|
|
89
|
-
|
|
90
|
-
<!-- 请根据项目实际选型调整:VueQuery / 自定义 composable -->
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
const { data, isLoading, error } = useQuery({
|
|
94
|
-
queryKey: ["users", params],
|
|
95
|
-
queryFn: () => fetchUsers(toValue(params)),
|
|
96
|
-
});
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## 选型决策矩阵
|
|
100
|
-
|
|
101
|
-
### React 全局状态管理选型
|
|
102
|
-
|
|
103
|
-
| 维度 | Context API | Zustand | Redux Toolkit | Jotai |
|
|
104
|
-
| -------------- | -------------------------------------- | -------------------------------------- | ------------------------------- | ------------------- |
|
|
105
|
-
| **适用场景** | 全局常量(主题、语言、用户信息) | 复杂业务状态(购物车、Dashboard 筛选) | 大型应用,需要严格的状态流控制 | 细粒度原子状态 |
|
|
106
|
-
| **重渲染性能** | ❌ 任何 value 变化导致所有消费者重渲染 | ✅ 通过 selector 精确订阅 | ✅ connect/useSelector 精确订阅 | ✅ 原子级订阅 |
|
|
107
|
-
| **样板代码** | 少(Provider + createContext) | 极少(一个 create 调用) | 多(slice / action / selector) | 极少(atom) |
|
|
108
|
-
| **DevTools** | ❌ 无 | ✅ Redux DevTools(中间件) | ✅ Redux DevTools | ✅ 专用 DevTools |
|
|
109
|
-
| **TypeScript** | ⚠️ 需手动类型标注 | ✅ 自动推导 | ✅ 自动推导 | ✅ 自动推导 |
|
|
110
|
-
| **中间件** | ❌ | ✅(persist / devtools / immer) | ✅(thunk / listener) | ✅ |
|
|
111
|
-
| **Provider** | ✅ 必须包裹 | ❌ 不需要(外部 store) | ✅ Provider | ❌(可选 Provider) |
|
|
112
|
-
|
|
113
|
-
**推荐决策流程**:
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
状态是否跨组件共享?
|
|
117
|
-
├── 否 → useState / useReducer(本地状态)
|
|
118
|
-
└── 是
|
|
119
|
-
├── 值是否几乎不变?(主题、语言、配置)
|
|
120
|
-
│ └── 是 → Context API
|
|
121
|
-
│
|
|
122
|
-
├── 是否需要严格状态流 + 时间旅行调试?
|
|
123
|
-
│ └── 是 → Redux Toolkit
|
|
124
|
-
│
|
|
125
|
-
├── 状态是否高度关联、需要集中管理?
|
|
126
|
-
│ └── 是 → Zustand
|
|
127
|
-
│
|
|
128
|
-
└── 状态是否独立、需要细粒度订阅?
|
|
129
|
-
└── 是 → Jotai
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Vue 全局状态管理选型
|
|
133
|
-
|
|
134
|
-
| 维度 | provide/inject | Pinia |
|
|
135
|
-
| -------------- | ---------------------------------- | ---------------- |
|
|
136
|
-
| **适用场景** | 局部跨层级传递(主题、表单上下文) | 全局业务状态 |
|
|
137
|
-
| **响应式** | ✅(传入 reactive/ref) | ✅ |
|
|
138
|
-
| **DevTools** | ❌ | ✅ Vue DevTools |
|
|
139
|
-
| **TypeScript** | ⚠️ 需 InjectionKey | ✅ 自动推导 |
|
|
140
|
-
| **SSR 安全** | ⚠️ 需注意作用域 | ✅ 内置 SSR 支持 |
|
|
141
|
-
|
|
142
|
-
**Vue 选型结论**:Pinia 是 Vue 3 官方推荐,新项目直接使用。provide/inject 仅用于局部上下文传递。
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## 反模式
|
|
147
|
-
|
|
148
|
-
- 将所有状态都放进全局 store(应优先本地状态)
|
|
149
|
-
- 在 store 中存放 UI 临时状态(modal 开关、表单输入等)
|
|
150
|
-
- 手动同步多份相同数据而不是用计算属性
|
|
151
|
-
- 在组件中直接修改 store 的内部数据(应通过 action / mutation)
|
|
152
|
-
- 将服务端响应原封不动存入全局 store 而不用请求缓存库
|
|
153
|
-
- 过度使用 Context / provide 替代 props 传递
|
|
154
|
-
- 用 Context 管理频繁更新的状态(导致全量消费者重渲染,应改用 Zustand/Pinia)
|
|
155
|
-
|
|
156
|
-
## 检查清单
|
|
157
|
-
|
|
158
|
-
- [ ] 每个状态都有明确的归属(本地 / 全局 / URL / 服务端缓存)
|
|
159
|
-
- [ ] 可派生的值没有被存为独立 state
|
|
160
|
-
- [ ] 全局 store 仅包含真正需要跨组件共享的数据
|
|
161
|
-
- [ ] 服务端数据通过请求库管理,而非手动存入 store
|
|
162
|
-
- [ ] URL 状态(搜索、分页、筛选)与路由参数同步
|
|
163
|
-
- [ ] Context 仅用于低频变更的全局值(主题、语言、用户信息)
|
|
55
|
+
- [ ] Each state has a clear ownership: local / form / server cache / URL / global store / browser persistence.
|
|
56
|
+
- [ ] Derivable values are not stored as independent state.
|
|
57
|
+
- [ ] The global store only contains data that is truly shared across boundaries.
|
|
58
|
+
- [ ] Server-side data is managed through the request library, and refreshes, rollbacks, permission changes, and error states can still be recovered.
|
|
59
|
+
- [ ] URL state is synchronized with route parameters, and refresh and share behavior is as expected.
|
|
60
|
+
- [ ] Persistence status has whitelist, version, migration and sensitive field exclusions.
|