@sarjallab09/figma-intelligence 1.0.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/LICENSE +26 -0
- package/README.md +327 -0
- package/bin/cli.js +859 -0
- package/design-bridge/.env.example +5 -0
- package/design-bridge/bridge.js +196 -0
- package/design-bridge/lib/assets.js +367 -0
- package/design-bridge/lib/prompt.js +85 -0
- package/design-bridge/lib/server.js +66 -0
- package/design-bridge/lib/stitch.js +37 -0
- package/design-bridge/lib/tokens.js +82 -0
- package/design-bridge/package-lock.json +579 -0
- package/design-bridge/package.json +19 -0
- package/figma-bridge-plugin/README.md +97 -0
- package/figma-bridge-plugin/anthropic-chat-runner.js +192 -0
- package/figma-bridge-plugin/bridge-relay.js +2363 -0
- package/figma-bridge-plugin/chat-runner.js +459 -0
- package/figma-bridge-plugin/code.js +1528 -0
- package/figma-bridge-plugin/codex-runner.js +505 -0
- package/figma-bridge-plugin/component-schemas.js +110 -0
- package/figma-bridge-plugin/content-context.js +869 -0
- package/figma-bridge-plugin/create-button.js +216 -0
- package/figma-bridge-plugin/gemini-cli-runner.js +291 -0
- package/figma-bridge-plugin/gemini-runner.js +187 -0
- package/figma-bridge-plugin/html-to-figma.js +927 -0
- package/figma-bridge-plugin/knowledge-hub/.gitkeep +0 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/anatomy-spec.md +159 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/api-spec.md +162 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/color-spec.md +148 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/full-spec-template.md +314 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/property-spec.md +175 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/screen-reader-spec.md +180 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/structure-spec.md +165 -0
- package/figma-bridge-plugin/manifest.json +21 -0
- package/figma-bridge-plugin/package-lock.json +1936 -0
- package/figma-bridge-plugin/package.json +20 -0
- package/figma-bridge-plugin/perplexity-runner.js +188 -0
- package/figma-bridge-plugin/references/SKILL.md +178 -0
- package/figma-bridge-plugin/references/anatomy-spec.md +159 -0
- package/figma-bridge-plugin/references/api-spec.md +162 -0
- package/figma-bridge-plugin/references/color-spec.md +148 -0
- package/figma-bridge-plugin/references/full-spec-template.md +314 -0
- package/figma-bridge-plugin/references/property-spec.md +175 -0
- package/figma-bridge-plugin/references/screen-reader-spec.md +180 -0
- package/figma-bridge-plugin/references/structure-spec.md +165 -0
- package/figma-bridge-plugin/shared-prompt-config.js +604 -0
- package/figma-bridge-plugin/spec-helpers/build-table.js +269 -0
- package/figma-bridge-plugin/spec-helpers/classify-elements.js +189 -0
- package/figma-bridge-plugin/spec-helpers/index.js +35 -0
- package/figma-bridge-plugin/spec-helpers/parse-figma-link.js +49 -0
- package/figma-bridge-plugin/spec-helpers/position-markers.js +158 -0
- package/figma-bridge-plugin/stitch-auth.js +322 -0
- package/figma-bridge-plugin/stitch-runner.js +1427 -0
- package/figma-bridge-plugin/token-resolver.js +107 -0
- package/figma-bridge-plugin/ui.html +4467 -0
- package/figma-intelligence-layer/.env.example +39 -0
- package/figma-intelligence-layer/docs/local-image-generation.md +60 -0
- package/figma-intelligence-layer/examples/comfyui-workflow-template.example.json +101 -0
- package/figma-intelligence-layer/jest.config.js +14 -0
- package/figma-intelligence-layer/mcp-config.json +19 -0
- package/figma-intelligence-layer/package-lock.json +5892 -0
- package/figma-intelligence-layer/package.json +48 -0
- package/figma-intelligence-layer/scripts/setup-comfyui-local.sh +67 -0
- package/figma-intelligence-layer/scripts/start-comfyui.sh +33 -0
- package/figma-intelligence-layer/src/index.ts +2233 -0
- package/figma-intelligence-layer/src/shared/auto-layout-validator.ts +404 -0
- package/figma-intelligence-layer/src/shared/cache.ts +187 -0
- package/figma-intelligence-layer/src/shared/color-operations.ts +533 -0
- package/figma-intelligence-layer/src/shared/color-utils.ts +138 -0
- package/figma-intelligence-layer/src/shared/component-script-builder.ts +413 -0
- package/figma-intelligence-layer/src/shared/component-templates.ts +2767 -0
- package/figma-intelligence-layer/src/shared/concept-taxonomy.ts +694 -0
- package/figma-intelligence-layer/src/shared/decision-log.ts +128 -0
- package/figma-intelligence-layer/src/shared/design-system-context.ts +568 -0
- package/figma-intelligence-layer/src/shared/design-system-intelligence.ts +131 -0
- package/figma-intelligence-layer/src/shared/design-system-matcher.ts +184 -0
- package/figma-intelligence-layer/src/shared/design-system-normalizers.ts +196 -0
- package/figma-intelligence-layer/src/shared/design-system-tokens.ts +295 -0
- package/figma-intelligence-layer/src/shared/dtcg-validator.ts +530 -0
- package/figma-intelligence-layer/src/shared/enrichment-pipeline.ts +671 -0
- package/figma-intelligence-layer/src/shared/figma-bridge.ts +1408 -0
- package/figma-intelligence-layer/src/shared/font-config.ts +126 -0
- package/figma-intelligence-layer/src/shared/icon-catalog.ts +360 -0
- package/figma-intelligence-layer/src/shared/icon-fetch.ts +80 -0
- package/figma-intelligence-layer/src/shared/prototype-script-builder.ts +162 -0
- package/figma-intelligence-layer/src/shared/response-compression.ts +440 -0
- package/figma-intelligence-layer/src/shared/semantic-token-catalog.ts +324 -0
- package/figma-intelligence-layer/src/shared/token-binder.ts +505 -0
- package/figma-intelligence-layer/src/shared/token-math.ts +427 -0
- package/figma-intelligence-layer/src/shared/token-naming.ts +468 -0
- package/figma-intelligence-layer/src/shared/token-utils.ts +420 -0
- package/figma-intelligence-layer/src/shared/types.ts +346 -0
- package/figma-intelligence-layer/src/shared/typography-presets.ts +94 -0
- package/figma-intelligence-layer/src/shared/unsplash.ts +165 -0
- package/figma-intelligence-layer/src/shared/vision-client.ts +607 -0
- package/figma-intelligence-layer/src/shared/vision-provider-anthropic.ts +334 -0
- package/figma-intelligence-layer/src/shared/vision-provider-openai.ts +446 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-handler.ts +782 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-renderer.ts +496 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotation-kit.ts +230 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/colorblind-sim.ts +66 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/index.ts +810 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-analyzer.ts +1191 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-figma-page.ts +1346 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.ts +148 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-figma-page.ts +499 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-report.ts +910 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-checker.ts +989 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-criteria.ts +1160 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/design-from-ref/index.ts +424 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/component-recognizer.ts +38 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/ds-matcher.ts +111 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/font-matcher.ts +114 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/icon-resolver.ts +103 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/index.ts +1060 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/layout-segmenter.ts +18 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/token-inferencer.ts +39 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/vision-pipeline.ts +58 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/sketch-to-design/index.ts +298 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/visual-audit/index.ts +197 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/component-audit/index.ts +494 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/intent-translator/index.ts +356 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/container-patterns.ts +123 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/index.ts +663 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/built-in-rules.yaml +56 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/index.ts +614 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/rule-engine.ts +113 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/color-theory.ts +178 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/index.ts +470 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/index.ts +429 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/token-override-maps.ts +226 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/ai-image-insert/index.ts +535 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/index.ts +660 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/pattern-fingerprints.ts +209 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/composition-builder/index.ts +540 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/figma-animated-build.ts +391 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/index.ts +2019 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/screen-templates.ts +131 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-map/index.ts +381 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-wire/index.ts +565 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/swarm-build/index.ts +764 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/system-drift/index.ts +535 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/unsplash-search/index.ts +84 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/url-to-frame/index.ts +401 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/css-animations.ts +68 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/framer-motion.ts +78 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/swift-animations.ts +93 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/index.ts +596 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/ci-check/index.ts +462 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/export-tokens/index.ts +1470 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/generate-component-code/index.ts +829 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/handoff-spec/index.ts +702 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/icon-library-sync/index.ts +483 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/index.ts +501 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/storybook-parser.ts +106 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/watch-docs/index.ts +676 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/webhook-listener/index.ts +560 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/apg-doc/index.ts +1043 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/component-detection.ts +620 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/anatomy.ts +331 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/color-tokens.ts +77 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/properties.ts +54 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/snapshot.ts +287 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/spacing.ts +71 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/states.ts +43 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/typography.ts +71 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/index.ts +221 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts +166 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts +232 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/alert.ts +234 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar-group.ts +270 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar.ts +249 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/badge.ts +231 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/banner.ts +293 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/breadcrumb.ts +240 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/button.ts +243 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/calendar.ts +307 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/card.ts +143 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/checkbox.ts +227 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/chip.ts +233 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/combobox.ts +282 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/datepicker.ts +276 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/divider.ts +223 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/drawer.ts +255 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/dropdown-menu.ts +289 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/empty-state.ts +261 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/file-uploader.ts +290 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts +265 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/grid.ts +238 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/icon.ts +255 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts +128 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-edit.ts +286 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-message.ts +255 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/input.ts +330 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/link.ts +247 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/list.ts +250 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/menu.ts +247 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/modal.ts +144 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navbar.ts +264 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navigation.ts +251 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/number-input.ts +261 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/pagination.ts +248 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/popover.ts +270 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/progress.ts +251 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/radio.ts +142 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/range-slider.ts +282 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts +250 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts +258 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/segmented-control.ts +265 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/select.ts +319 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/skeleton.ts +256 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/slider.ts +232 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/spinner.ts +239 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/status-dot.ts +252 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/stepper.ts +270 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/table.ts +244 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tabs.ts +143 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tag.ts +243 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/textarea.ts +259 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts +293 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts +144 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toggle.ts +289 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toolbar.ts +267 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tooltip.ts +232 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/treeview.ts +257 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/typography.ts +319 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/legacy-compat.ts +121 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/anatomy-diagram.ts +430 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/figma-page.ts +312 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/json.ts +129 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/markdown.ts +78 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/visual-doc.ts +2333 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/accessibility.ts +100 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/anatomy.ts +32 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/color-tokens.ts +59 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/content-guidance.ts +18 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/design-tokens.ts +53 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/interaction-rules.ts +19 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/overview.ts +91 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/properties-api.ts +71 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/qa-criteria.ts +19 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/related-components.ts +110 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/responsive.ts +19 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/size-specs.ts +67 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/spacing-structure.ts +58 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/state-specs.ts +79 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/states.ts +50 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/type-hierarchy.ts +33 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/typography.ts +55 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/usage-guidelines.ts +73 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/variants.ts +81 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/types.ts +409 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/index.ts +198 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/renderer.ts +701 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/types.ts +88 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/decision-log/index.ts +135 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/design-decision-log/index.ts +491 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-primitives/index.ts +416 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-scaffolder/index.ts +722 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-variables/index.ts +449 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/health-report/index.ts +393 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/index.ts +406 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/figma-page.ts +292 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/json.ts +24 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/markdown.ts +172 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/naming-guide.ts +409 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/token-analytics/index.ts +594 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/token-docs/index.ts +710 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/token-migrate/index.ts +458 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/token-naming/index.ts +134 -0
- package/figma-intelligence-layer/tests/apg-doc.test.ts +101 -0
- package/figma-intelligence-layer/tests/design-system-context.test.ts +152 -0
- package/figma-intelligence-layer/tests/design-system-matcher.test.ts +144 -0
- package/figma-intelligence-layer/tests/figma-bridge.test.ts +83 -0
- package/figma-intelligence-layer/tests/generate-image-and-insert.test.ts +56 -0
- package/figma-intelligence-layer/tests/screen-cloner-regression.test.ts +69 -0
- package/figma-intelligence-layer/tests/smoke.test.ts +174 -0
- package/figma-intelligence-layer/tests/spec-generator.test.ts +127 -0
- package/figma-intelligence-layer/tests/token-migrate.test.ts +21 -0
- package/figma-intelligence-layer/tests/token-naming.test.ts +30 -0
- package/figma-intelligence-layer/tsconfig.json +19 -0
- package/package.json +35 -0
- package/scripts/clean-existing-chunks.js +179 -0
- package/scripts/connect-ai-tool.js +490 -0
- package/scripts/convert-hub-pdfs.js +425 -0
- package/scripts/figma-mcp-status.js +349 -0
- package/scripts/register-codex-mcp.js +96 -0
package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rating.ts — Gold-standard design knowledge for Rating components
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
+
|
|
6
|
+
export const ratingKnowledge: ComponentKnowledge = {
|
|
7
|
+
description:
|
|
8
|
+
"Star-based rating input and display | Supports full and half-star precision | Read-only and interactive modes",
|
|
9
|
+
|
|
10
|
+
stateSpecifications: [
|
|
11
|
+
{
|
|
12
|
+
state: "Default",
|
|
13
|
+
visualChange: "Stars rendered with filled/empty styling reflecting the current value; unfilled stars use $rating-empty token",
|
|
14
|
+
opacity: "1",
|
|
15
|
+
cursorWeb: "pointer",
|
|
16
|
+
usage: "Resting interactive state — user can click or hover to set a rating",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
state: "Hover",
|
|
20
|
+
visualChange: "Stars up to and including the hovered star highlight with $rating-hover token; remaining stars stay empty",
|
|
21
|
+
opacity: "1",
|
|
22
|
+
cursorWeb: "pointer",
|
|
23
|
+
usage: "Mouse cursor enters a star's hit area, providing preview of the potential rating",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
state: "Active",
|
|
27
|
+
visualChange: "Clicked star and all preceding stars fill with $rating-filled token; value updates immediately",
|
|
28
|
+
opacity: "1",
|
|
29
|
+
cursorWeb: "pointer",
|
|
30
|
+
usage: "User clicks or taps to commit a rating value",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
state: "ReadOnly",
|
|
34
|
+
visualChange: "Stars reflect the set value but have no hover or click interactions; no cursor change",
|
|
35
|
+
opacity: "1",
|
|
36
|
+
cursorWeb: "default",
|
|
37
|
+
usage: "Display-only mode — shows an existing rating without allowing modification",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
state: "Disabled",
|
|
41
|
+
visualChange: "All stars use $rating-disabled token; muted appearance with reduced opacity",
|
|
42
|
+
opacity: "0.4",
|
|
43
|
+
cursorWeb: "not-allowed",
|
|
44
|
+
usage: "Rating input is unavailable due to permissions or form state",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
state: "Focus",
|
|
48
|
+
visualChange: "2px focus ring around the currently focused star using $focus-ring token",
|
|
49
|
+
opacity: "1",
|
|
50
|
+
cursorWeb: "pointer",
|
|
51
|
+
usage: "Star receives keyboard focus via Tab or arrow key navigation",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
state: "Half-Star",
|
|
55
|
+
visualChange: "Star is split vertically — left half filled with $rating-filled, right half with $rating-empty",
|
|
56
|
+
opacity: "1",
|
|
57
|
+
cursorWeb: "pointer",
|
|
58
|
+
usage: "Half-star precision enabled; mouse position on left/right half determines the value",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
propertyDescriptions: {
|
|
63
|
+
value: "Current rating value as a number (e.g. 3, 3.5); determines how many stars are filled",
|
|
64
|
+
max: "Maximum number of stars displayed; defaults to 5; valid range is 1-10",
|
|
65
|
+
size: "Dimensional preset controlling star size and gap between stars (sm, md, lg)",
|
|
66
|
+
readOnly: "When true the component displays the rating without interactive behavior — no hover, click, or keyboard input",
|
|
67
|
+
precision: "Rating granularity — 'full' allows whole-star increments only; 'half' allows half-star increments (e.g. 3.5)",
|
|
68
|
+
onChange: "Callback function invoked when the user selects a new rating value; receives the numeric value as argument",
|
|
69
|
+
label: "Accessible text label describing what is being rated (e.g. 'Product rating', 'Service quality')",
|
|
70
|
+
disabled: "When true the rating input is non-interactive with muted visuals and aria-disabled='true'",
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
sizeSpecifications: [
|
|
74
|
+
{
|
|
75
|
+
size: "Small",
|
|
76
|
+
height: "16px",
|
|
77
|
+
paddingLR: "0px",
|
|
78
|
+
fontSize: "12px",
|
|
79
|
+
iconSize: "16px",
|
|
80
|
+
borderRadius: "0px",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
size: "Medium",
|
|
84
|
+
height: "24px",
|
|
85
|
+
paddingLR: "0px",
|
|
86
|
+
fontSize: "14px",
|
|
87
|
+
iconSize: "24px",
|
|
88
|
+
borderRadius: "0px",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
size: "Large",
|
|
92
|
+
height: "32px",
|
|
93
|
+
paddingLR: "0px",
|
|
94
|
+
fontSize: "16px",
|
|
95
|
+
iconSize: "32px",
|
|
96
|
+
borderRadius: "0px",
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
|
|
100
|
+
designTokenBindings: [
|
|
101
|
+
{
|
|
102
|
+
property: "Filled Star",
|
|
103
|
+
tokenName: "$rating-filled",
|
|
104
|
+
role: "Fill color for active/selected stars",
|
|
105
|
+
fallback: "#F59E0B",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
property: "Empty Star",
|
|
109
|
+
tokenName: "$rating-empty",
|
|
110
|
+
role: "Fill or stroke color for unselected stars",
|
|
111
|
+
fallback: "#D0D5DD",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
property: "Hover Star",
|
|
115
|
+
tokenName: "$rating-hover",
|
|
116
|
+
role: "Preview highlight color when hovering over a star",
|
|
117
|
+
fallback: "#FBBF24",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
property: "Disabled Star",
|
|
121
|
+
tokenName: "$rating-disabled",
|
|
122
|
+
role: "Muted fill color for stars in the disabled state",
|
|
123
|
+
fallback: "#E4E7EC",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
property: "Value Text",
|
|
127
|
+
tokenName: "$rating-text",
|
|
128
|
+
role: "Color for the optional numeric value display (e.g. '4.5')",
|
|
129
|
+
fallback: "#344054",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
property: "Focus Ring",
|
|
133
|
+
tokenName: "$focus-ring",
|
|
134
|
+
role: "Keyboard focus indicator around the active star",
|
|
135
|
+
fallback: "0 0 0 2px #FFFFFF, 0 0 0 4px #2E90FA",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
property: "Font Family",
|
|
139
|
+
tokenName: "$font-family-sans",
|
|
140
|
+
role: "Typeface for the optional numeric value label",
|
|
141
|
+
fallback: "Inter, system-ui, sans-serif",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
property: "Transition",
|
|
145
|
+
tokenName: "$transition-interactive",
|
|
146
|
+
role: "Smooth color transitions for hover and selection feedback",
|
|
147
|
+
fallback: "150ms ease-in-out",
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
|
|
151
|
+
structureRules: [
|
|
152
|
+
"Container uses horizontal Auto Layout with center vertical alignment",
|
|
153
|
+
"Each star is an individual interactive element (radio) within a radiogroup container",
|
|
154
|
+
"Gap between stars is 2px (sm), 4px (md), or 6px (lg) based on the size prop",
|
|
155
|
+
"Half-star precision splits each star into two hit areas (left half and right half)",
|
|
156
|
+
"Optional numeric value text (e.g. '4.5') renders after the last star with $spacing-sm gap",
|
|
157
|
+
"Star icons use a filled variant for selected and a stroked/outlined variant for empty",
|
|
158
|
+
"Touch targets for each star must be at least 44x44px — add transparent padding if the star is smaller",
|
|
159
|
+
"Container width is determined by (starSize * max) + (gap * (max - 1)) plus optional value text",
|
|
160
|
+
],
|
|
161
|
+
|
|
162
|
+
typeHierarchyRules: [
|
|
163
|
+
"Numeric value text uses Regular (400) weight — the stars themselves convey emphasis",
|
|
164
|
+
"Value text font size matches the size prop's fontSize specification",
|
|
165
|
+
"Value text displays one decimal place when precision is 'half' (e.g. '3.5'), whole number when 'full'",
|
|
166
|
+
"No bold, underline, or uppercase styling on the value text",
|
|
167
|
+
],
|
|
168
|
+
|
|
169
|
+
interactionRules: [
|
|
170
|
+
{ event: "Click / Tap", trigger: "pointerup on a star", action: "Set the rating value to the clicked star's position; fire onChange callback" },
|
|
171
|
+
{ event: "Hover", trigger: "pointerenter on a star", action: "Preview-highlight all stars up to and including the hovered star" },
|
|
172
|
+
{ event: "Hover Exit", trigger: "pointerleave from the container", action: "Revert star highlights back to the committed value" },
|
|
173
|
+
{ event: "Half-Star Hover", trigger: "Pointer in left half of a star (precision='half')", action: "Preview-highlight up to the half-star position (e.g. 3.5)" },
|
|
174
|
+
{ event: "Focus", trigger: "Tab key into the radiogroup", action: "Focus the star matching the current value (or first star if no value)" },
|
|
175
|
+
{ event: "Arrow Right", trigger: "Right arrow key while focused", action: "Move focus and value to the next star (increment by 1 or 0.5 based on precision)" },
|
|
176
|
+
{ event: "Arrow Left", trigger: "Left arrow key while focused", action: "Move focus and value to the previous star (decrement by 1 or 0.5 based on precision)" },
|
|
177
|
+
{ event: "Keydown Enter/Space", trigger: "Enter or Space while a star is focused", action: "Commit the focused star's value; fire onChange callback" },
|
|
178
|
+
],
|
|
179
|
+
|
|
180
|
+
contentGuidance: [
|
|
181
|
+
"Always provide a visible or accessible label describing what is being rated ('Rate this product')",
|
|
182
|
+
"Use a consistent max value within the same interface — mixing 5-star and 10-star scales is confusing",
|
|
183
|
+
"Display the numeric value alongside stars when precision matters (e.g. product reviews)",
|
|
184
|
+
"In read-only mode, consider showing the count of ratings alongside the average (e.g. '4.5 (238 reviews)')",
|
|
185
|
+
"Avoid using rating components for binary choices — use a thumbs up/down or toggle instead",
|
|
186
|
+
],
|
|
187
|
+
|
|
188
|
+
responsiveBehaviour: [
|
|
189
|
+
{ breakpoint: "Mobile (<768px)", behavior: "Stars maintain minimum 44px touch targets; may use lg size for easier tapping" },
|
|
190
|
+
{ breakpoint: "Tablet (768-1023px)", behavior: "Standard rendering; md size is typical" },
|
|
191
|
+
{ breakpoint: "Desktop (1024-1439px)", behavior: "Standard rendering; sm or md size depending on context (inline vs. standalone)" },
|
|
192
|
+
{ breakpoint: "Ultra-wide (>=1440px)", behavior: "Star sizes remain fixed — do not scale with viewport width" },
|
|
193
|
+
],
|
|
194
|
+
|
|
195
|
+
accessibilitySpec: {
|
|
196
|
+
intro:
|
|
197
|
+
"Rating components must be fully operable via keyboard and correctly announced by screen readers. The star metaphor is visual — assistive tech needs explicit value context.",
|
|
198
|
+
requirements: [
|
|
199
|
+
{ requirement: "Role (Group)", level: "A", notes: "Container must use role='radiogroup' with an accessible label describing what is being rated" },
|
|
200
|
+
{ requirement: "Role (Star)", level: "A", notes: "Each star must use role='radio' with aria-checked indicating whether it is selected" },
|
|
201
|
+
{ requirement: "Accessible Name", level: "A", notes: "Each star needs aria-label (e.g. '3 out of 5 stars'); the group needs aria-label (e.g. 'Product rating')" },
|
|
202
|
+
{ requirement: "Keyboard Navigation", level: "A", notes: "Left/Right arrow keys move between stars; Enter/Space commits the selection" },
|
|
203
|
+
{ requirement: "Contrast Ratio", level: "AA", notes: "Filled stars vs. background must meet 3:1 non-text contrast; empty stars must be distinguishable from background" },
|
|
204
|
+
{ requirement: "Focus Indicator", level: "AA", notes: "Currently focused star must show a visible 2px focus ring meeting 3:1 contrast against adjacent colors" },
|
|
205
|
+
{ requirement: "Touch Target", level: "AA", notes: "Each star's hit area must be at least 44x44px (WCAG 2.5.5)" },
|
|
206
|
+
{ requirement: "Read-Only Announcement", level: "A", notes: "In read-only mode, announce the current value (e.g. 'Rated 4 out of 5 stars') without interactive roles" },
|
|
207
|
+
],
|
|
208
|
+
outro: [
|
|
209
|
+
"When the rating changes, announce the new value via an aria-live region (e.g. '3 out of 5 stars selected')",
|
|
210
|
+
"In read-only mode, use aria-readonly='true' and remove interactive roles to prevent confusing screen reader users",
|
|
211
|
+
"Test with VoiceOver, NVDA, and JAWS to ensure consistent star-by-star announcement behavior",
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
qaAcceptanceCriteria: [
|
|
216
|
+
{ check: "Visual Regression", platform: "All", expectedResult: "Stars render at correct size with proper filled/empty styling for each value" },
|
|
217
|
+
{ check: "Hover Preview", platform: "Web", expectedResult: "Hovering over a star highlights all stars up to that position; reverts on mouse leave" },
|
|
218
|
+
{ check: "Half-Star Precision", platform: "Web", expectedResult: "With precision='half', left-half hover shows half-star; clicking commits the half value" },
|
|
219
|
+
{ check: "Keyboard Navigation", platform: "Web", expectedResult: "Left/Right arrows move focus and value between stars; wrapping behavior at edges" },
|
|
220
|
+
{ check: "Keyboard Activation", platform: "Web", expectedResult: "Enter and Space commit the focused star's value; onChange fires correctly" },
|
|
221
|
+
{ check: "Screen Reader", platform: "Web", expectedResult: "Announces role='radiogroup', each star as role='radio', and current value (e.g. '3 out of 5')" },
|
|
222
|
+
{ check: "Read-Only Mode", platform: "All", expectedResult: "Stars display value but are not interactive; no hover, click, or keyboard response" },
|
|
223
|
+
{ check: "Disabled State", platform: "All", expectedResult: "Muted visuals; pointer-events none; aria-disabled='true'; not focusable" },
|
|
224
|
+
{ check: "Touch Target", platform: "Mobile", expectedResult: "Each star has at least 44x44px hit area even at sm size" },
|
|
225
|
+
{ check: "Contrast", platform: "All", expectedResult: "Filled stars pass 3:1 non-text contrast; value text passes 4.5:1 text contrast" },
|
|
226
|
+
{ check: "RTL Support", platform: "Web", expectedResult: "Stars render right-to-left; arrow key directions are logically reversed" },
|
|
227
|
+
{ check: "Value Display", platform: "All", expectedResult: "Optional numeric value shows correct decimal precision next to stars" },
|
|
228
|
+
{ check: "Max Prop", platform: "All", expectedResult: "Changing max updates the number of rendered stars; value is clamped to max" },
|
|
229
|
+
],
|
|
230
|
+
|
|
231
|
+
dos: [
|
|
232
|
+
"Use role='radiogroup' for the container and role='radio' for each star",
|
|
233
|
+
"Provide aria-label on each star describing its position (e.g. '3 out of 5 stars')",
|
|
234
|
+
"Support keyboard navigation with Left/Right arrow keys for star selection",
|
|
235
|
+
"Show a visible focus ring on the currently focused star",
|
|
236
|
+
"Use half-star precision for review systems where granularity matters",
|
|
237
|
+
"Display the numeric average alongside stars in read-only summaries",
|
|
238
|
+
"Ensure each star's touch target is at least 44x44px on mobile",
|
|
239
|
+
],
|
|
240
|
+
|
|
241
|
+
donts: [
|
|
242
|
+
"Do not use the rating component for binary (yes/no) feedback — use a toggle instead",
|
|
243
|
+
"Do not allow more than 10 stars — higher counts are overwhelming and imprecise",
|
|
244
|
+
"Do not rely solely on star color to distinguish filled from empty — use fill vs. outline treatment",
|
|
245
|
+
"Do not remove the focus indicator — keyboard users must see which star is focused",
|
|
246
|
+
"Do not hard-code star colors — always use $rating-filled, $rating-empty, and $rating-hover tokens",
|
|
247
|
+
"Do not fire onChange on hover — only fire on explicit click, tap, or keyboard commit",
|
|
248
|
+
"Do not mix different max values in the same interface (e.g. 5-star and 10-star side by side)",
|
|
249
|
+
],
|
|
250
|
+
};
|
package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* search.ts — Gold-standard design knowledge for Search input components
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
+
|
|
6
|
+
export const searchKnowledge: ComponentKnowledge = {
|
|
7
|
+
description:
|
|
8
|
+
"Search input with clear and results | Filters content in real-time | Supports debounce, suggestions, and loading states",
|
|
9
|
+
|
|
10
|
+
stateSpecifications: [
|
|
11
|
+
{
|
|
12
|
+
state: "Default",
|
|
13
|
+
visualChange: "Field displays search icon on the left and placeholder text in muted color",
|
|
14
|
+
opacity: "1",
|
|
15
|
+
cursorWeb: "text",
|
|
16
|
+
usage: "Resting state — search field is interactive and ready for query input",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
state: "Focused",
|
|
20
|
+
visualChange: "Border transitions to focus color; 2px focus ring appears; cursor blinks inside the field",
|
|
21
|
+
opacity: "1",
|
|
22
|
+
cursorWeb: "text",
|
|
23
|
+
usage: "User clicks into the field or navigates via Tab key",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
state: "Searching",
|
|
27
|
+
visualChange: "Search icon replaced by a loading spinner; field remains interactive for query refinement",
|
|
28
|
+
opacity: "1",
|
|
29
|
+
cursorWeb: "text",
|
|
30
|
+
usage: "Query has been submitted and results are being fetched or filtered",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
state: "Results",
|
|
34
|
+
visualChange: "Suggestion dropdown appears below the field showing matching results; clear button visible",
|
|
35
|
+
opacity: "1",
|
|
36
|
+
cursorWeb: "text",
|
|
37
|
+
usage: "Search has returned matching results displayed in a dropdown or inline list",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
state: "NoResults",
|
|
41
|
+
visualChange: "Dropdown shows an empty-state message; field retains query text with clear button visible",
|
|
42
|
+
opacity: "1",
|
|
43
|
+
cursorWeb: "text",
|
|
44
|
+
usage: "Search query returned zero matching results",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
state: "Disabled",
|
|
48
|
+
visualChange: "Background and border switch to disabled tokens; search icon is muted; no interaction possible",
|
|
49
|
+
opacity: "0.4",
|
|
50
|
+
cursorWeb: "not-allowed",
|
|
51
|
+
usage: "Search functionality is unavailable due to permissions or system state",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
propertyDescriptions: {
|
|
56
|
+
placeholder: "Hint text displayed when the field is empty; typically 'Search...' or a context-specific prompt like 'Search components'",
|
|
57
|
+
value: "The current search query string; controlled or uncontrolled depending on framework usage",
|
|
58
|
+
size: "Dimensional preset controlling height, padding, font-size, and icon-size (Small, Medium, Large)",
|
|
59
|
+
onSearch: "Callback fired when the user submits a search query via Enter key or after debounce completes",
|
|
60
|
+
debounceMs: "Delay in milliseconds before onSearch fires after the user stops typing; default is 300ms",
|
|
61
|
+
clearable: "When true, a clear button (X icon) appears on the right side when the field has a value",
|
|
62
|
+
loading: "When true, the search icon is replaced by a spinner to indicate an in-progress query",
|
|
63
|
+
suggestions: "Array of suggestion items displayed in a dropdown below the field when results are available",
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
sizeSpecifications: [
|
|
67
|
+
{
|
|
68
|
+
size: "Small",
|
|
69
|
+
height: "32px",
|
|
70
|
+
paddingLR: "12px",
|
|
71
|
+
fontSize: "12px",
|
|
72
|
+
iconSize: "16px",
|
|
73
|
+
borderRadius: "6px",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
size: "Medium",
|
|
77
|
+
height: "40px",
|
|
78
|
+
paddingLR: "16px",
|
|
79
|
+
fontSize: "14px",
|
|
80
|
+
iconSize: "20px",
|
|
81
|
+
borderRadius: "8px",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
size: "Large",
|
|
85
|
+
height: "48px",
|
|
86
|
+
paddingLR: "20px",
|
|
87
|
+
fontSize: "16px",
|
|
88
|
+
iconSize: "24px",
|
|
89
|
+
borderRadius: "10px",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
|
|
93
|
+
designTokenBindings: [
|
|
94
|
+
{
|
|
95
|
+
property: "Background",
|
|
96
|
+
tokenName: "$field-bg",
|
|
97
|
+
role: "Default field background color",
|
|
98
|
+
fallback: "#FFFFFF",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
property: "Border",
|
|
102
|
+
tokenName: "$field-border",
|
|
103
|
+
role: "Default field border color",
|
|
104
|
+
fallback: "#D0D5DD",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
property: "Search Icon",
|
|
108
|
+
tokenName: "$icon-secondary",
|
|
109
|
+
role: "Magnifying glass icon color in default state",
|
|
110
|
+
fallback: "#667085",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
property: "Clear Icon",
|
|
114
|
+
tokenName: "$icon-tertiary",
|
|
115
|
+
role: "Clear (X) button icon color",
|
|
116
|
+
fallback: "#98A2B3",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
property: "Loading Indicator",
|
|
120
|
+
tokenName: "$icon-interactive",
|
|
121
|
+
role: "Spinner color during searching state",
|
|
122
|
+
fallback: "#2E90FA",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
property: "Focus Ring",
|
|
126
|
+
tokenName: "$focus-ring",
|
|
127
|
+
role: "Keyboard and click focus indicator ring",
|
|
128
|
+
fallback: "0 0 0 2px #FFFFFF, 0 0 0 4px #2E90FA",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
property: "Text Color",
|
|
132
|
+
tokenName: "$field-text",
|
|
133
|
+
role: "User-entered query text color",
|
|
134
|
+
fallback: "#1D2939",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
property: "Placeholder",
|
|
138
|
+
tokenName: "$field-placeholder",
|
|
139
|
+
role: "Placeholder hint text color",
|
|
140
|
+
fallback: "#98A2B3",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
property: "Dropdown Background",
|
|
144
|
+
tokenName: "$overlay-bg",
|
|
145
|
+
role: "Suggestion dropdown background color",
|
|
146
|
+
fallback: "#FFFFFF",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
property: "Dropdown Shadow",
|
|
150
|
+
tokenName: "$shadow-lg",
|
|
151
|
+
role: "Elevation shadow on the suggestion dropdown",
|
|
152
|
+
fallback: "0 4px 16px rgba(0,0,0,0.12)",
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
|
|
156
|
+
structureRules: [
|
|
157
|
+
"Container uses horizontal Auto Layout with center vertical alignment",
|
|
158
|
+
"Search icon is the first child, followed by the text input, then optional clear button or spinner",
|
|
159
|
+
"Spacing between icon and input uses the $spacing-xs token (4px default)",
|
|
160
|
+
"Clear button appears only when the field has a non-empty value; it replaces the spinner when both could apply",
|
|
161
|
+
"Suggestion dropdown is absolutely positioned below the field with a 4px gap ($spacing-xs)",
|
|
162
|
+
"Dropdown uses vertical Auto Layout; each suggestion item is a full-width row with horizontal padding matching the field",
|
|
163
|
+
"Touch target for the clear button is at least 44x44px regardless of visual icon size",
|
|
164
|
+
"Field width defaults to fill-container; a max-width of 600px is recommended for standalone search bars",
|
|
165
|
+
],
|
|
166
|
+
|
|
167
|
+
typeHierarchyRules: [
|
|
168
|
+
"Query text uses Regular (400) weight at the size-appropriate font size",
|
|
169
|
+
"Placeholder text uses the same font size and weight as query text but in the placeholder color token",
|
|
170
|
+
"Suggestion items use Regular (400) weight; matched query substring is highlighted with Medium (500) weight",
|
|
171
|
+
"Empty-state message ('No results found') uses Regular (400) weight in the secondary text color",
|
|
172
|
+
],
|
|
173
|
+
|
|
174
|
+
interactionRules: [
|
|
175
|
+
{ event: "Click", trigger: "pointerdown inside field bounds", action: "Place cursor at click position; enter focused state" },
|
|
176
|
+
{ event: "Focus", trigger: "Tab key or focus()", action: "Show focus ring; place cursor at end of query text" },
|
|
177
|
+
{ event: "Blur", trigger: "Focus moves away from field and dropdown", action: "Remove focus ring; close suggestion dropdown after a short delay" },
|
|
178
|
+
{ event: "Input", trigger: "Keypress while focused", action: "Update value; reset debounce timer; show clear button if value is non-empty" },
|
|
179
|
+
{ event: "Debounce Complete", trigger: "No input for debounceMs duration", action: "Fire onSearch handler; enter searching state if async" },
|
|
180
|
+
{ event: "Enter Key", trigger: "Enter key while focused", action: "Immediately fire onSearch handler bypassing debounce; select highlighted suggestion if dropdown is open" },
|
|
181
|
+
{ event: "Clear Click", trigger: "Click on clear (X) button", action: "Reset value to empty string; fire onSearch with empty value; return focus to input" },
|
|
182
|
+
{ event: "Escape Key", trigger: "Escape key while focused", action: "Close suggestion dropdown; if no dropdown, clear the field value" },
|
|
183
|
+
{ event: "Arrow Down", trigger: "ArrowDown while dropdown is open", action: "Move highlight to the next suggestion item; wrap to first item at end" },
|
|
184
|
+
{ event: "Arrow Up", trigger: "ArrowUp while dropdown is open", action: "Move highlight to the previous suggestion item; wrap to last item at start" },
|
|
185
|
+
],
|
|
186
|
+
|
|
187
|
+
contentGuidance: [
|
|
188
|
+
"Placeholder should indicate what can be searched: 'Search components...', 'Find a team member...'",
|
|
189
|
+
"Keep placeholder text concise — no more than 4-5 words",
|
|
190
|
+
"Empty-state message should be helpful: 'No results for \"query\" — try a different search term'",
|
|
191
|
+
"Suggestion items should highlight the matching substring to help users scan results quickly",
|
|
192
|
+
"Avoid instructional text like 'Type to search' — the search icon already communicates the purpose",
|
|
193
|
+
"If the search scope is limited, indicate it in the placeholder: 'Search in Documents'",
|
|
194
|
+
],
|
|
195
|
+
|
|
196
|
+
responsiveBehaviour: [
|
|
197
|
+
{ breakpoint: "Mobile (<768px)", behavior: "Search field expands to full width; may collapse to an icon-only trigger that expands on tap" },
|
|
198
|
+
{ breakpoint: "Tablet (768-1023px)", behavior: "Search field uses a constrained width within the header or toolbar; dropdown matches field width" },
|
|
199
|
+
{ breakpoint: "Desktop (1024-1439px)", behavior: "Standard sizing; dropdown may extend wider than the field to accommodate longer suggestion text" },
|
|
200
|
+
{ breakpoint: "Ultra-wide (>=1440px)", behavior: "Max-width cap of 600px prevents overly wide search fields; dropdown width matches field" },
|
|
201
|
+
],
|
|
202
|
+
|
|
203
|
+
accessibilitySpec: {
|
|
204
|
+
intro:
|
|
205
|
+
"Search inputs must be discoverable and operable for all users. Proper ARIA roles, autocomplete semantics, and keyboard navigation are essential for suggestion dropdowns.",
|
|
206
|
+
requirements: [
|
|
207
|
+
{ requirement: "Role", level: "A", notes: "Use role='searchbox' on the input element or type='search' on a native <input> element" },
|
|
208
|
+
{ requirement: "Autocomplete", level: "A", notes: "Set aria-autocomplete='list' when suggestions are provided; 'none' when there are no suggestions" },
|
|
209
|
+
{ requirement: "Expanded State", level: "A", notes: "Set aria-expanded='true' on the input when the suggestion dropdown is visible; 'false' when closed" },
|
|
210
|
+
{ requirement: "Active Descendant", level: "A", notes: "Use aria-activedescendant to indicate the currently highlighted suggestion for screen readers" },
|
|
211
|
+
{ requirement: "Clear Button Label", level: "A", notes: "Clear button must have aria-label='Clear search' since it uses only an icon with no visible text" },
|
|
212
|
+
{ requirement: "Focusable", level: "A", notes: "Field must be reachable via Tab key; disabled state removes from tab order" },
|
|
213
|
+
{ requirement: "Contrast Ratio", level: "AA", notes: "Text-to-background: 4.5:1 minimum; icons must meet 3:1 non-text contrast" },
|
|
214
|
+
{ requirement: "Keyboard Navigation", level: "A", notes: "ArrowUp/Down navigates suggestions; Enter selects; Escape closes dropdown" },
|
|
215
|
+
],
|
|
216
|
+
outro: [
|
|
217
|
+
"Ensure the suggestion dropdown is announced by screen readers when it appears and when results change",
|
|
218
|
+
"Use aria-live='polite' on a status region to announce result counts: '5 results available'",
|
|
219
|
+
"Never trap keyboard focus inside the search field — Tab must always move to the next interactive element",
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
qaAcceptanceCriteria: [
|
|
224
|
+
{ check: "Visual Regression", platform: "All", expectedResult: "Search field renders pixel-perfect against baseline for each size and state" },
|
|
225
|
+
{ check: "Focus State", platform: "Web", expectedResult: "Focus ring visible on Tab; cursor blinks inside field; hidden on mouse click (focus-visible)" },
|
|
226
|
+
{ check: "Searching State", platform: "Web", expectedResult: "Spinner replaces search icon; field remains editable; spinner animates smoothly" },
|
|
227
|
+
{ check: "Clear Button", platform: "Web", expectedResult: "X button appears when value is non-empty; clicking clears value and returns focus to input" },
|
|
228
|
+
{ check: "Debounce", platform: "Web", expectedResult: "onSearch fires only after debounceMs of inactivity; rapid typing does not trigger multiple calls" },
|
|
229
|
+
{ check: "Suggestion Dropdown", platform: "Web", expectedResult: "Dropdown appears with results; keyboard navigation works; Enter selects item" },
|
|
230
|
+
{ check: "No Results", platform: "Web", expectedResult: "Empty-state message displays in dropdown; field retains query text" },
|
|
231
|
+
{ check: "Disabled State", platform: "All", expectedResult: "Muted visuals; pointer-events none; aria-disabled='true'; not focusable via Tab" },
|
|
232
|
+
{ check: "Screen Reader", platform: "Web", expectedResult: "Announces role 'searchbox', accessible name, expanded state, and active suggestion" },
|
|
233
|
+
{ check: "Keyboard Shortcuts", platform: "Web", expectedResult: "Enter submits; Escape closes dropdown or clears; ArrowUp/Down navigates suggestions" },
|
|
234
|
+
{ check: "Touch Target", platform: "Mobile", expectedResult: "Clear button hit area is at least 44x44px; field height meets minimum touch target" },
|
|
235
|
+
{ check: "Contrast", platform: "All", expectedResult: "All text passes 4.5:1 contrast; icons pass 3:1 non-text contrast" },
|
|
236
|
+
{ check: "RTL Support", platform: "Web", expectedResult: "Search icon moves to right; clear button moves to left; text aligns right" },
|
|
237
|
+
],
|
|
238
|
+
|
|
239
|
+
dos: [
|
|
240
|
+
"Use a visible search icon to clearly communicate the field's purpose",
|
|
241
|
+
"Provide a clear button when the field has a value so users can easily reset",
|
|
242
|
+
"Use debouncing to prevent excessive API calls during rapid typing",
|
|
243
|
+
"Show a loading indicator when search results are being fetched asynchronously",
|
|
244
|
+
"Highlight matching text within suggestion items to aid scanning",
|
|
245
|
+
"Use an appropriate placeholder that indicates the search scope",
|
|
246
|
+
"Ensure the suggestion dropdown is dismissible via Escape key and clicking outside",
|
|
247
|
+
],
|
|
248
|
+
|
|
249
|
+
donts: [
|
|
250
|
+
"Do not require the user to press Enter to initiate a search — support live filtering with debounce",
|
|
251
|
+
"Do not show a suggestion dropdown with zero items — show an empty-state message instead",
|
|
252
|
+
"Do not hide the search icon in the default state — it is the primary affordance for the field's purpose",
|
|
253
|
+
"Do not use a search field for navigation — use a navigation menu or command palette instead",
|
|
254
|
+
"Do not fire search on every keystroke without debouncing — this causes performance issues and excessive API calls",
|
|
255
|
+
"Do not override design token colors with hard-coded hex values",
|
|
256
|
+
"Do not make the suggestion dropdown wider than the viewport on mobile — constrain to field width",
|
|
257
|
+
],
|
|
258
|
+
};
|