@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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* grid.ts — Gold-standard design knowledge for Grid layout components
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
+
|
|
6
|
+
export const gridKnowledge: ComponentKnowledge = {
|
|
7
|
+
description:
|
|
8
|
+
"CSS Grid-based layout container | Structures content in rows and columns | Purely presentational with no interactive states",
|
|
9
|
+
|
|
10
|
+
stateSpecifications: [
|
|
11
|
+
{
|
|
12
|
+
state: "Default",
|
|
13
|
+
visualChange: "Grid container renders its children according to the configured column, gap, and alignment properties; no visible chrome",
|
|
14
|
+
opacity: "1",
|
|
15
|
+
cursorWeb: "default",
|
|
16
|
+
usage: "Only state — the grid is a passive structural container with no interactive or visual state changes",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
state: "Empty",
|
|
20
|
+
visualChange: "Grid container renders with no children; may collapse to zero height or show a minimum height placeholder depending on implementation",
|
|
21
|
+
opacity: "1",
|
|
22
|
+
cursorWeb: "default",
|
|
23
|
+
usage: "No content has been placed in the grid — container remains in the DOM for layout stability",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
state: "Loading",
|
|
27
|
+
visualChange: "Grid cells display skeleton placeholders in the configured layout pattern to maintain visual structure during data fetch",
|
|
28
|
+
opacity: "0.6",
|
|
29
|
+
cursorWeb: "default",
|
|
30
|
+
usage: "Child content is being loaded — skeleton cells preview the eventual layout",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
|
|
34
|
+
propertyDescriptions: {
|
|
35
|
+
columns: "Number of equal-width columns in the grid — integer from 1 to 12; maps to CSS grid-template-columns: repeat(N, 1fr)",
|
|
36
|
+
gap: "Spacing between grid cells — Small (8px), Medium (16px), or Large (24px); applies equally to row and column gaps",
|
|
37
|
+
rowGap: "Overrides the vertical gap between grid rows independently of the column gap; useful for asymmetric spacing",
|
|
38
|
+
columnGap: "Overrides the horizontal gap between grid columns independently of the row gap",
|
|
39
|
+
alignItems: "Vertical alignment of items within their grid cells — start, center, end, stretch (default stretch)",
|
|
40
|
+
justifyItems: "Horizontal alignment of items within their grid cells — start, center, end, stretch (default stretch)",
|
|
41
|
+
responsive: "When true the grid automatically reduces columns at smaller breakpoints following the responsive rules",
|
|
42
|
+
minColumnWidth: "Minimum width for each column before the grid reflows to fewer columns — alternative to fixed column count",
|
|
43
|
+
autoRows: "Height of implicitly created rows — 'auto' (content-sized) or a fixed value like '200px' or 'minmax(100px, auto)'",
|
|
44
|
+
templateAreas: "Named grid areas for semantic placement of children — maps to CSS grid-template-areas property",
|
|
45
|
+
fullBleed: "When true the grid spans the full viewport width, breaking out of its parent container constraints",
|
|
46
|
+
dense: "When true enables CSS grid auto-flow: dense to fill gaps left by items spanning multiple columns",
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
sizeSpecifications: [
|
|
50
|
+
{
|
|
51
|
+
size: "Small Gap",
|
|
52
|
+
height: "N/A (container)",
|
|
53
|
+
paddingLR: "0px",
|
|
54
|
+
fontSize: "N/A",
|
|
55
|
+
iconSize: "N/A",
|
|
56
|
+
borderRadius: "0px",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
size: "Medium Gap",
|
|
60
|
+
height: "N/A (container)",
|
|
61
|
+
paddingLR: "0px",
|
|
62
|
+
fontSize: "N/A",
|
|
63
|
+
iconSize: "N/A",
|
|
64
|
+
borderRadius: "0px",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
size: "Large Gap",
|
|
68
|
+
height: "N/A (container)",
|
|
69
|
+
paddingLR: "0px",
|
|
70
|
+
fontSize: "N/A",
|
|
71
|
+
iconSize: "N/A",
|
|
72
|
+
borderRadius: "0px",
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
|
|
76
|
+
designTokenBindings: [
|
|
77
|
+
{
|
|
78
|
+
property: "Gap Small",
|
|
79
|
+
tokenName: "$spacing-sm",
|
|
80
|
+
role: "8px gap between grid cells in the small gap preset",
|
|
81
|
+
fallback: "8px",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
property: "Gap Medium",
|
|
85
|
+
tokenName: "$spacing-md",
|
|
86
|
+
role: "16px gap between grid cells in the medium gap preset",
|
|
87
|
+
fallback: "16px",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
property: "Gap Large",
|
|
91
|
+
tokenName: "$spacing-lg",
|
|
92
|
+
role: "24px gap between grid cells in the large gap preset",
|
|
93
|
+
fallback: "24px",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
property: "Gap Extra-Large",
|
|
97
|
+
tokenName: "$spacing-xl",
|
|
98
|
+
role: "32px gap between grid cells for wide-spacing layouts",
|
|
99
|
+
fallback: "32px",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
property: "Page Margin",
|
|
103
|
+
tokenName: "$grid-page-margin",
|
|
104
|
+
role: "Horizontal margin between the grid container and the viewport edge",
|
|
105
|
+
fallback: "24px",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
property: "Max Width",
|
|
109
|
+
tokenName: "$grid-max-width",
|
|
110
|
+
role: "Maximum width of the grid container — prevents overly wide layouts on ultra-wide screens",
|
|
111
|
+
fallback: "1280px",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
property: "Breakpoint SM",
|
|
115
|
+
tokenName: "$breakpoint-sm",
|
|
116
|
+
role: "Small breakpoint threshold for responsive column reduction",
|
|
117
|
+
fallback: "640px",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
property: "Breakpoint MD",
|
|
121
|
+
tokenName: "$breakpoint-md",
|
|
122
|
+
role: "Medium breakpoint threshold for responsive column reduction",
|
|
123
|
+
fallback: "768px",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
property: "Breakpoint LG",
|
|
127
|
+
tokenName: "$breakpoint-lg",
|
|
128
|
+
role: "Large breakpoint threshold for responsive column count",
|
|
129
|
+
fallback: "1024px",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
property: "Breakpoint XL",
|
|
133
|
+
tokenName: "$breakpoint-xl",
|
|
134
|
+
role: "Extra-large breakpoint threshold where the full column count applies",
|
|
135
|
+
fallback: "1280px",
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
|
|
139
|
+
structureRules: [
|
|
140
|
+
"Grid container is a block-level element using display: grid — never display: flex for grid layouts",
|
|
141
|
+
"Columns are defined via grid-template-columns: repeat(N, 1fr) where N is the columns property value",
|
|
142
|
+
"Gap applies to both row-gap and column-gap equally unless rowGap or columnGap overrides are provided",
|
|
143
|
+
"Grid children can span multiple columns using gridColumn: span N — the grid adjusts row wrapping accordingly",
|
|
144
|
+
"Page margin is applied as horizontal padding on the grid container — content stays within the maxWidth boundary",
|
|
145
|
+
"The grid container centers itself within its parent when maxWidth is less than available width using margin: 0 auto",
|
|
146
|
+
"Full-bleed items break out of the grid margin using negative margins equal to the page margin value",
|
|
147
|
+
"When responsive is true, the grid uses CSS clamp() or media queries to reduce columns at smaller viewports",
|
|
148
|
+
"Grid does not have visible borders, backgrounds, or decoration — it is purely a structural layout primitive",
|
|
149
|
+
],
|
|
150
|
+
|
|
151
|
+
typeHierarchyRules: [
|
|
152
|
+
"Grid does not impose typography rules — child components manage their own text styling",
|
|
153
|
+
"Headings within grid cells should follow the page's heading hierarchy — do not skip levels (h1 > h2 > h3)",
|
|
154
|
+
"Card titles in a grid should all be the same heading level for semantic consistency within the grid",
|
|
155
|
+
"Text alignment within grid cells should align with the justifyItems property for visual consistency",
|
|
156
|
+
],
|
|
157
|
+
|
|
158
|
+
interactionRules: [
|
|
159
|
+
{ event: "Resize Viewport", trigger: "Browser window resize event", action: "Reflow grid columns according to responsive breakpoint rules; gap values remain constant" },
|
|
160
|
+
{ event: "Content Overflow", trigger: "Child content exceeds cell bounds", action: "Cell stretches vertically to accommodate content; sibling cells in the same row align accordingly" },
|
|
161
|
+
{ event: "Column Span", trigger: "Child element specifies gridColumn: span N", action: "Item spans N columns; subsequent items reflow around it" },
|
|
162
|
+
{ event: "Dense Packing", trigger: "dense property enabled with variable-span items", action: "Grid auto-placement fills gaps left by spanning items, reducing whitespace" },
|
|
163
|
+
{ event: "Skeleton Load", trigger: "Data loading for grid children", action: "Skeleton placeholder cells render in the grid layout maintaining the expected visual structure" },
|
|
164
|
+
],
|
|
165
|
+
|
|
166
|
+
contentGuidance: [
|
|
167
|
+
"Use the grid for page-level layout, card grids, image galleries, and any repeating content arrangement",
|
|
168
|
+
"Choose column counts that create comfortable reading widths — 3-4 columns for cards, 2 columns for content-heavy layouts",
|
|
169
|
+
"Maintain consistent gap sizes across grids within the same page for visual rhythm",
|
|
170
|
+
"Avoid deeply nesting grids inside grids — one level of nesting is acceptable; two levels indicate overengineering",
|
|
171
|
+
"Use named grid areas (templateAreas) for complex page layouts where semantic placement is more readable than numeric spans",
|
|
172
|
+
"Grid is a layout primitive — it should not contain application logic or manage component state",
|
|
173
|
+
"For single-dimension layouts (a row of items or a column of items), prefer Flexbox over Grid",
|
|
174
|
+
],
|
|
175
|
+
|
|
176
|
+
responsiveBehaviour: [
|
|
177
|
+
{ breakpoint: "Mobile (<640px)", behavior: "Grid collapses to 1 column; all items stack vertically; gap remains consistent; page margin reduces to 16px" },
|
|
178
|
+
{ breakpoint: "Small Tablet (640-767px)", behavior: "Grid uses 2 columns for content that was 3+ columns; gap and alignment maintained" },
|
|
179
|
+
{ breakpoint: "Tablet (768-1023px)", behavior: "Grid uses approximately half the desktop column count (e.g., 6-column becomes 3-column)" },
|
|
180
|
+
{ breakpoint: "Desktop (1024-1279px)", behavior: "Grid uses the full specified column count; page margins and max-width apply normally" },
|
|
181
|
+
{ breakpoint: "Ultra-wide (>=1280px)", behavior: "Grid container width capped at maxWidth; centered on the viewport with auto margins" },
|
|
182
|
+
],
|
|
183
|
+
|
|
184
|
+
accessibilitySpec: {
|
|
185
|
+
intro:
|
|
186
|
+
"Grid is a purely structural layout component with no interactive role. Accessibility concerns are limited to ensuring the DOM order matches visual order and that grid children are properly accessible.",
|
|
187
|
+
requirements: [
|
|
188
|
+
{ requirement: "No ARIA Role", level: "A", notes: "Grid containers should not use role='grid' — that ARIA role is for interactive data grids (tables); layout grids use no role" },
|
|
189
|
+
{ requirement: "DOM Order", level: "A", notes: "Visual order of grid items must match DOM order — CSS grid ordering (order property) must not break reading/tab sequence" },
|
|
190
|
+
{ requirement: "Heading Hierarchy", level: "A", notes: "Headings within grid cells must follow the page heading hierarchy — no skipping levels" },
|
|
191
|
+
{ requirement: "Landmark Nesting", level: "A", notes: "Grid cells containing landmarks (nav, main, aside) must follow proper landmark nesting rules" },
|
|
192
|
+
{ requirement: "Content Reflow", level: "AA", notes: "At 400% zoom grid must reflow to a single column without horizontal scrolling (WCAG 1.4.10)" },
|
|
193
|
+
{ requirement: "Focus Order", level: "A", notes: "Tab order through grid children must follow a logical reading sequence (left-to-right, top-to-bottom for LTR)" },
|
|
194
|
+
{ requirement: "Spacing for Readability", level: "AAA", notes: "Gap spacing should allow clear visual separation between items for users with cognitive disabilities" },
|
|
195
|
+
],
|
|
196
|
+
outro: [
|
|
197
|
+
"Verify that CSS grid ordering (order, grid-row, grid-column) does not create a disconnect between DOM and visual order",
|
|
198
|
+
"Test at 200% and 400% zoom to ensure content reflows gracefully without overflow or overlap",
|
|
199
|
+
"Ensure that screen readers traverse grid children in the intended reading order",
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
qaAcceptanceCriteria: [
|
|
204
|
+
{ check: "Column Count", platform: "Web", expectedResult: "Grid renders the specified number of equal-width columns with correct fr units" },
|
|
205
|
+
{ check: "Gap Spacing", platform: "Web", expectedResult: "Row and column gaps match the specified token value (8/16/24px)" },
|
|
206
|
+
{ check: "Responsive Reflow", platform: "Web", expectedResult: "Grid reduces columns at each breakpoint threshold; single column on mobile" },
|
|
207
|
+
{ check: "Column Span", platform: "Web", expectedResult: "Items with gridColumn: span N correctly span multiple columns and reflow neighbors" },
|
|
208
|
+
{ check: "Alignment", platform: "Web", expectedResult: "alignItems and justifyItems correctly position children within their cells" },
|
|
209
|
+
{ check: "Max Width", platform: "Web", expectedResult: "Grid container does not exceed maxWidth; centers within viewport on ultra-wide screens" },
|
|
210
|
+
{ check: "Dense Packing", platform: "Web", expectedResult: "With dense enabled, gaps left by spanning items are filled by subsequent items" },
|
|
211
|
+
{ check: "DOM Order", platform: "Web", expectedResult: "Tab order matches visual order — no visual/DOM order mismatch" },
|
|
212
|
+
{ check: "Zoom Reflow", platform: "Web", expectedResult: "At 400% zoom grid reflows to single column without horizontal scrollbar" },
|
|
213
|
+
{ check: "Skeleton Loading", platform: "Web", expectedResult: "Skeleton placeholders render in the correct grid layout positions" },
|
|
214
|
+
{ check: "RTL Support", platform: "Web", expectedResult: "Grid items flow right-to-left in RTL locales; alignment properties mirror correctly" },
|
|
215
|
+
{ check: "Empty State", platform: "Web", expectedResult: "Empty grid renders without errors; may show minimum height or collapse gracefully" },
|
|
216
|
+
{ check: "Visual Regression", platform: "All", expectedResult: "Grid layout renders pixel-perfect against baseline for each column/gap configuration" },
|
|
217
|
+
],
|
|
218
|
+
|
|
219
|
+
dos: [
|
|
220
|
+
"Use Grid for two-dimensional layouts — rows and columns working together",
|
|
221
|
+
"Choose gap sizes from the spacing token scale for visual consistency with the rest of the design system",
|
|
222
|
+
"Use responsive breakpoints to reduce column counts progressively on smaller screens",
|
|
223
|
+
"Set a maxWidth on the grid container to prevent overly wide layouts on ultra-wide monitors",
|
|
224
|
+
"Use named grid areas for complex page-level layouts with semantically meaningful region names",
|
|
225
|
+
"Ensure DOM order matches visual order — avoid CSS order property when it breaks the reading sequence",
|
|
226
|
+
"Constrain the grid container with page margins that follow the design system spacing scale",
|
|
227
|
+
],
|
|
228
|
+
|
|
229
|
+
donts: [
|
|
230
|
+
"Do not use role='grid' on layout grids — role='grid' is reserved for interactive data grids and tables",
|
|
231
|
+
"Do not nest grids more than one level deep — flatten the layout or reconsider the information architecture",
|
|
232
|
+
"Do not use CSS grid for simple single-row or single-column layouts — use Flexbox instead",
|
|
233
|
+
"Do not use the CSS order property in ways that create a mismatch between visual and DOM/tab order",
|
|
234
|
+
"Do not apply decorative styles (backgrounds, borders, shadows) to the grid container itself — it is invisible chrome",
|
|
235
|
+
"Do not hardcode pixel widths for columns — use fractional units (1fr) for fluid, responsive behavior",
|
|
236
|
+
"Do not allow grid content to cause horizontal scrolling at any supported viewport width or zoom level",
|
|
237
|
+
],
|
|
238
|
+
};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* icon.ts — Gold-standard design knowledge for Icon components
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
+
|
|
6
|
+
export const iconKnowledge: ComponentKnowledge = {
|
|
7
|
+
description:
|
|
8
|
+
"Vector graphic primitive | Visual symbol | Non-interactive glyph used across all other components",
|
|
9
|
+
|
|
10
|
+
stateSpecifications: [
|
|
11
|
+
{
|
|
12
|
+
state: "Default",
|
|
13
|
+
visualChange: "Icon renders at specified size and color with full opacity",
|
|
14
|
+
opacity: "1",
|
|
15
|
+
cursorWeb: "default",
|
|
16
|
+
usage: "Standard icon display — inherits color from parent or uses explicit override",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
state: "Disabled",
|
|
20
|
+
visualChange: "Icon color shifts to disabled token; reduced opacity inherited from parent",
|
|
21
|
+
opacity: "0.4",
|
|
22
|
+
cursorWeb: "not-allowed",
|
|
23
|
+
usage: "Parent component is disabled — icon reflects that state passively",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
state: "Decorative",
|
|
27
|
+
visualChange: "Visually identical to Default but semantically hidden from assistive technology",
|
|
28
|
+
opacity: "1",
|
|
29
|
+
cursorWeb: "default",
|
|
30
|
+
usage: "Icon is purely ornamental and conveys no meaning beyond the adjacent text",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
state: "Informative",
|
|
34
|
+
visualChange: "Visually identical to Default but carries an accessible label for screen readers",
|
|
35
|
+
opacity: "1",
|
|
36
|
+
cursorWeb: "default",
|
|
37
|
+
usage: "Icon conveys meaning on its own without adjacent text — requires aria-label",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
state: "Inherited Hover",
|
|
41
|
+
visualChange: "Icon color may shift when parent element enters hover state — not self-triggered",
|
|
42
|
+
opacity: "1",
|
|
43
|
+
cursorWeb: "pointer",
|
|
44
|
+
usage: "Parent interactive element is hovered — icon inherits the color change",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
state: "Inherited Focus",
|
|
48
|
+
visualChange: "No visual change on the icon itself — focus ring is on the parent element",
|
|
49
|
+
opacity: "1",
|
|
50
|
+
cursorWeb: "default",
|
|
51
|
+
usage: "Parent interactive element is focused — icon remains visually unchanged",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
state: "High Contrast",
|
|
55
|
+
visualChange: "Icon color overridden to system foreground color in forced-colors mode",
|
|
56
|
+
opacity: "1",
|
|
57
|
+
cursorWeb: "default",
|
|
58
|
+
usage: "Windows High Contrast Mode — icon must remain visible against system background",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
propertyDescriptions: {
|
|
63
|
+
name: "Icon identifier matching the icon library glyph name (e.g., 'close', 'chevron-down', 'search')",
|
|
64
|
+
size: "Dimensional preset controlling the icon's width and height — xs through xl",
|
|
65
|
+
color: "Explicit color override; when omitted, the icon inherits currentColor from its parent",
|
|
66
|
+
decorative: "Boolean flag — when true, icon is aria-hidden and excluded from the accessibility tree",
|
|
67
|
+
label: "Accessible label for meaningful (non-decorative) icons — sets aria-label on the SVG element",
|
|
68
|
+
type: "Visual style variant — filled (solid shapes) or outlined (stroke-based paths)",
|
|
69
|
+
className: "Optional CSS class for custom styling overrides on the SVG wrapper element",
|
|
70
|
+
rotate: "Rotation angle in degrees — used for directional icons (chevrons, arrows) without needing separate glyphs",
|
|
71
|
+
flip: "Horizontal or vertical mirror — used for RTL layout support or directional variations",
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
sizeSpecifications: [
|
|
75
|
+
{
|
|
76
|
+
size: "Extra Small (xs)",
|
|
77
|
+
height: "16px",
|
|
78
|
+
paddingLR: "0px",
|
|
79
|
+
fontSize: "N/A",
|
|
80
|
+
iconSize: "16px",
|
|
81
|
+
borderRadius: "0px",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
size: "Small (sm)",
|
|
85
|
+
height: "20px",
|
|
86
|
+
paddingLR: "0px",
|
|
87
|
+
fontSize: "N/A",
|
|
88
|
+
iconSize: "20px",
|
|
89
|
+
borderRadius: "0px",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
size: "Medium (md)",
|
|
93
|
+
height: "24px",
|
|
94
|
+
paddingLR: "0px",
|
|
95
|
+
fontSize: "N/A",
|
|
96
|
+
iconSize: "24px",
|
|
97
|
+
borderRadius: "0px",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
size: "Large (lg)",
|
|
101
|
+
height: "32px",
|
|
102
|
+
paddingLR: "0px",
|
|
103
|
+
fontSize: "N/A",
|
|
104
|
+
iconSize: "32px",
|
|
105
|
+
borderRadius: "0px",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
size: "Extra Large (xl)",
|
|
109
|
+
height: "40px",
|
|
110
|
+
paddingLR: "0px",
|
|
111
|
+
fontSize: "N/A",
|
|
112
|
+
iconSize: "40px",
|
|
113
|
+
borderRadius: "0px",
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
|
|
117
|
+
designTokenBindings: [
|
|
118
|
+
{
|
|
119
|
+
property: "Default Color",
|
|
120
|
+
tokenName: "color/semantic/icon/default",
|
|
121
|
+
role: "Inherited icon color when no explicit override is set — maps to currentColor",
|
|
122
|
+
fallback: "#1D2939",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
property: "Primary Color",
|
|
126
|
+
tokenName: "color/semantic/icon/primary",
|
|
127
|
+
role: "Brand-primary icon color for emphasis or active state indicators",
|
|
128
|
+
fallback: "#2563EB",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
property: "Secondary Color",
|
|
132
|
+
tokenName: "color/semantic/icon/secondary",
|
|
133
|
+
role: "Muted icon color for supporting or de-emphasized icons",
|
|
134
|
+
fallback: "#667085",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
property: "Disabled Color",
|
|
138
|
+
tokenName: "color/semantic/icon/disabled",
|
|
139
|
+
role: "Icon color when parent component is in disabled state",
|
|
140
|
+
fallback: "#D0D5DD",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
property: "Inverse Color",
|
|
144
|
+
tokenName: "color/semantic/icon/inverse",
|
|
145
|
+
role: "Icon color on dark backgrounds or inverse surfaces",
|
|
146
|
+
fallback: "#FFFFFF",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
property: "Error Color",
|
|
150
|
+
tokenName: "color/semantic/icon/error",
|
|
151
|
+
role: "Semantic error icon color — used in validation, alerts, and destructive contexts",
|
|
152
|
+
fallback: "#F04438",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
property: "Success Color",
|
|
156
|
+
tokenName: "color/semantic/icon/success",
|
|
157
|
+
role: "Semantic success icon color — used in confirmation and positive feedback",
|
|
158
|
+
fallback: "#12B76A",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
|
|
162
|
+
structureRules: [
|
|
163
|
+
"Icon renders as an inline SVG element with width and height matching the size preset",
|
|
164
|
+
"SVG viewBox is always 0 0 24 24 (or source viewBox) — size is controlled by the outer width/height attributes",
|
|
165
|
+
"Icon aligns vertically with adjacent text using display: inline-flex and align-items: center on the parent",
|
|
166
|
+
"No wrapper div is required — the SVG element itself is the top-level node",
|
|
167
|
+
"Fill and stroke colors use currentColor by default, allowing CSS color inheritance from the parent",
|
|
168
|
+
"Icons must not include embedded text — all glyphs are vector paths for consistent rendering",
|
|
169
|
+
"RTL layouts flip horizontally-directional icons (arrows, chevrons) but not symmetric ones (close, search)",
|
|
170
|
+
],
|
|
171
|
+
|
|
172
|
+
typeHierarchyRules: [
|
|
173
|
+
"Icons are non-textual — they do not participate in the typographic hierarchy",
|
|
174
|
+
"When paired with a text label, the icon size should match the text line-height for vertical alignment",
|
|
175
|
+
"Icon size xs (16px) pairs with body-small (12-14px text); md (24px) pairs with body (14-16px text)",
|
|
176
|
+
"Icons used as standalone glyphs (no adjacent text) should be sized to match the expected visual weight of surrounding content",
|
|
177
|
+
],
|
|
178
|
+
|
|
179
|
+
interactionRules: [
|
|
180
|
+
{ event: "Click", trigger: "pointerup on icon", action: "No action — icons are non-interactive; click events are handled by the parent component" },
|
|
181
|
+
{ event: "Hover", trigger: "pointerenter on icon", action: "No hover state — icons inherit hover styling from the parent interactive element" },
|
|
182
|
+
{ event: "Parent Disabled", trigger: "Parent sets disabled state", action: "Icon color transitions to color/semantic/icon/disabled with opacity 0.4" },
|
|
183
|
+
{ event: "Color Inheritance", trigger: "Parent CSS color changes", action: "Icon fill updates to match currentColor automatically via SVG fill inheritance" },
|
|
184
|
+
{ event: "RTL Toggle", trigger: "Document direction changes to RTL", action: "Directional icons (arrows, chevrons) apply transform: scaleX(-1)" },
|
|
185
|
+
{ event: "Theme Change", trigger: "Color mode toggles (light/dark)", action: "Icon color tokens resolve to new theme values; SVG re-renders with updated fills" },
|
|
186
|
+
],
|
|
187
|
+
|
|
188
|
+
contentGuidance: [
|
|
189
|
+
"Use filled icons for primary actions and emphasis; use outlined icons for secondary or passive contexts",
|
|
190
|
+
"Pair every icon with a visible text label unless the icon is universally understood (close ×, search 🔍, home)",
|
|
191
|
+
"Maintain a consistent icon style (filled vs outlined) within a single UI surface — do not mix styles arbitrarily",
|
|
192
|
+
"Choose icons from the established icon library — do not introduce custom glyphs without design review",
|
|
193
|
+
"Use semantic color tokens (error, success) for status icons rather than arbitrary color overrides",
|
|
194
|
+
"Ensure icon metaphors are culturally appropriate and universally recognizable for the target audience",
|
|
195
|
+
],
|
|
196
|
+
|
|
197
|
+
responsiveBehaviour: [
|
|
198
|
+
{ breakpoint: "Mobile (<768px)", behavior: "Icons remain at their specified size; do not scale with viewport — touch targets are handled by the parent" },
|
|
199
|
+
{ breakpoint: "Tablet (768-1023px)", behavior: "Same icon sizes as desktop; no responsive scaling needed for vector graphics" },
|
|
200
|
+
{ breakpoint: "Desktop (1024-1439px)", behavior: "Standard icon rendering at specified size presets" },
|
|
201
|
+
{ breakpoint: "Ultra-wide (>=1440px)", behavior: "No scaling — icons are fixed-size elements that do not grow with viewport width" },
|
|
202
|
+
],
|
|
203
|
+
|
|
204
|
+
accessibilitySpec: {
|
|
205
|
+
intro:
|
|
206
|
+
"Icons must be categorized as either decorative (hidden from AT) or informative (labeled for AT). There is no middle ground.",
|
|
207
|
+
requirements: [
|
|
208
|
+
{ requirement: "Decorative aria-hidden", level: "A", notes: "Icons that duplicate adjacent text or are purely ornamental must have aria-hidden='true'" },
|
|
209
|
+
{ requirement: "Informative aria-label", level: "A", notes: "Icons conveying meaning without adjacent text must have role='img' and a descriptive aria-label" },
|
|
210
|
+
{ requirement: "Focusable false", level: "A", notes: "SVG elements must have focusable='false' to prevent IE/Edge from adding them to the tab order" },
|
|
211
|
+
{ requirement: "Title element avoided", level: "A", notes: "Do not use <title> inside SVG for labeling — use aria-label on the SVG element instead for consistent AT support" },
|
|
212
|
+
{ requirement: "Contrast", level: "AA", notes: "Informative icons must meet 3:1 non-text contrast ratio against their background" },
|
|
213
|
+
{ requirement: "High Contrast Mode", level: "AA", notes: "Icons must remain visible in Windows High Contrast Mode — use currentColor, not hardcoded fills" },
|
|
214
|
+
{ requirement: "Reduced Motion", level: "AAA", notes: "If icons have animated transitions (rotation, color fade), they must respect prefers-reduced-motion" },
|
|
215
|
+
],
|
|
216
|
+
outro: [
|
|
217
|
+
"Screen readers should either skip decorative icons entirely or announce informative icons with their aria-label",
|
|
218
|
+
"Never rely on an icon alone to convey critical information — always provide a text alternative or label",
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
qaAcceptanceCriteria: [
|
|
223
|
+
{ check: "Size Presets", platform: "All", expectedResult: "Icon renders at correct dimensions for each size preset (16/20/24/32/40px)" },
|
|
224
|
+
{ check: "Color Inheritance", platform: "All", expectedResult: "Icon inherits currentColor from parent when no explicit color prop is set" },
|
|
225
|
+
{ check: "Color Override", platform: "All", expectedResult: "Explicit color prop overrides inherited color and maps to correct design token" },
|
|
226
|
+
{ check: "Filled vs Outlined", platform: "All", expectedResult: "Type prop toggles between filled and outlined glyph variants correctly" },
|
|
227
|
+
{ check: "Decorative Hiding", platform: "Web", expectedResult: "Decorative icons have aria-hidden='true' and are absent from the accessibility tree" },
|
|
228
|
+
{ check: "Informative Labeling", platform: "Web", expectedResult: "Informative icons have role='img' and aria-label announced by screen readers" },
|
|
229
|
+
{ check: "RTL Flip", platform: "Web", expectedResult: "Directional icons (arrows, chevrons) mirror horizontally in RTL; symmetric icons remain unchanged" },
|
|
230
|
+
{ check: "Disabled State", platform: "All", expectedResult: "Icon color changes to disabled token and opacity reduces when parent is disabled" },
|
|
231
|
+
{ check: "Dark Mode", platform: "All", expectedResult: "All icon color tokens resolve correctly in dark mode; icons remain visible" },
|
|
232
|
+
{ check: "High Contrast", platform: "Web", expectedResult: "Icons use currentColor and remain visible in Windows High Contrast Mode" },
|
|
233
|
+
{ check: "SVG Rendering", platform: "All", expectedResult: "Icons render as crisp vector paths with no anti-aliasing artifacts at all size presets" },
|
|
234
|
+
],
|
|
235
|
+
|
|
236
|
+
dos: [
|
|
237
|
+
"Set decorative=true for icons that accompany visible text labels — they add no new information",
|
|
238
|
+
"Provide an aria-label for every standalone icon that conveys meaning without adjacent text",
|
|
239
|
+
"Use currentColor for fills to ensure icons inherit theme and state colors from parents",
|
|
240
|
+
"Match icon size to adjacent text line-height for consistent vertical alignment",
|
|
241
|
+
"Use the design system's icon library — maintain glyph consistency across the product",
|
|
242
|
+
"Apply transform: scaleX(-1) to directional icons in RTL layouts",
|
|
243
|
+
"Test all icons in both light and dark modes to verify token resolution",
|
|
244
|
+
],
|
|
245
|
+
|
|
246
|
+
donts: [
|
|
247
|
+
"Do not make icons interactive — wrap them in a button or link if they need click handling",
|
|
248
|
+
"Do not use <img> tags for icons — use inline SVG for color inheritance and scalability",
|
|
249
|
+
"Do not hardcode fill colors in SVG paths — use currentColor for theme compatibility",
|
|
250
|
+
"Do not mix filled and outlined icon styles within the same UI surface",
|
|
251
|
+
"Do not add focusable behavior to decorative icons — they must be invisible to keyboard navigation",
|
|
252
|
+
"Do not use icons as the sole means of conveying critical information without a text alternative",
|
|
253
|
+
"Do not resize icons with CSS transform: scale — use the size prop to maintain crisp rendering",
|
|
254
|
+
],
|
|
255
|
+
};
|
package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge base lookup — returns component-type-specific design knowledge
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
+
|
|
6
|
+
import { buttonKnowledge } from "./button.js";
|
|
7
|
+
import { checkboxKnowledge } from "./checkbox.js";
|
|
8
|
+
import { inputKnowledge } from "./input.js";
|
|
9
|
+
import { selectKnowledge } from "./select.js";
|
|
10
|
+
import { toggleKnowledge } from "./toggle.js";
|
|
11
|
+
import { radioKnowledge } from "./radio.js";
|
|
12
|
+
import { modalKnowledge } from "./modal.js";
|
|
13
|
+
import { tabsKnowledge } from "./tabs.js";
|
|
14
|
+
import { cardKnowledge } from "./card.js";
|
|
15
|
+
import { toastKnowledge } from "./toast.js";
|
|
16
|
+
import { accordionKnowledge } from "./accordion.js";
|
|
17
|
+
import { tooltipKnowledge } from "./tooltip.js";
|
|
18
|
+
import { sliderKnowledge } from "./slider.js";
|
|
19
|
+
import { alertKnowledge } from "./alert.js";
|
|
20
|
+
import { badgeKnowledge } from "./badge.js";
|
|
21
|
+
import { avatarKnowledge } from "./avatar.js";
|
|
22
|
+
import { chipKnowledge } from "./chip.js";
|
|
23
|
+
import { tableKnowledge } from "./table.js";
|
|
24
|
+
import { navigationKnowledge } from "./navigation.js";
|
|
25
|
+
import { progressKnowledge } from "./progress.js";
|
|
26
|
+
import { iconKnowledge } from "./icon.js";
|
|
27
|
+
import { linkKnowledge } from "./link.js";
|
|
28
|
+
import { menuKnowledge } from "./menu.js";
|
|
29
|
+
import { spinnerKnowledge } from "./spinner.js";
|
|
30
|
+
import { breadcrumbKnowledge } from "./breadcrumb.js";
|
|
31
|
+
import { tagKnowledge } from "./tag.js";
|
|
32
|
+
import { navbarKnowledge } from "./navbar.js";
|
|
33
|
+
import { textareaKnowledge } from "./textarea.js";
|
|
34
|
+
import { searchKnowledge } from "./search.js";
|
|
35
|
+
import { comboboxKnowledge } from "./combobox.js";
|
|
36
|
+
import { datepickerKnowledge } from "./datepicker.js";
|
|
37
|
+
import { numberInputKnowledge } from "./number-input.js";
|
|
38
|
+
import { formKnowledge } from "./form.js";
|
|
39
|
+
import { paginationKnowledge } from "./pagination.js";
|
|
40
|
+
import { listKnowledge } from "./list.js";
|
|
41
|
+
import { treeviewKnowledge } from "./treeview.js";
|
|
42
|
+
import { typographyKnowledge } from "./typography.js";
|
|
43
|
+
import { dividerKnowledge } from "./divider.js";
|
|
44
|
+
import { skeletonKnowledge } from "./skeleton.js";
|
|
45
|
+
import { popoverKnowledge } from "./popover.js";
|
|
46
|
+
import { dropdownMenuKnowledge } from "./dropdown-menu.js";
|
|
47
|
+
import { avatarGroupKnowledge } from "./avatar-group.js";
|
|
48
|
+
import { gridKnowledge } from "./grid.js";
|
|
49
|
+
import { emptyStateKnowledge } from "./empty-state.js";
|
|
50
|
+
import { bannerKnowledge } from "./banner.js";
|
|
51
|
+
import { drawerKnowledge } from "./drawer.js";
|
|
52
|
+
import { segmentedControlKnowledge } from "./segmented-control.js";
|
|
53
|
+
import { stepperKnowledge } from "./stepper.js";
|
|
54
|
+
import { fileUploaderKnowledge } from "./file-uploader.js";
|
|
55
|
+
import { inlineMessageKnowledge } from "./inline-message.js";
|
|
56
|
+
import { toolbarKnowledge } from "./toolbar.js";
|
|
57
|
+
import { calendarKnowledge } from "./calendar.js";
|
|
58
|
+
import { timePickerKnowledge } from "./time-picker.js";
|
|
59
|
+
import { rangeSliderKnowledge } from "./range-slider.js";
|
|
60
|
+
import { inlineEditKnowledge } from "./inline-edit.js";
|
|
61
|
+
import { statusDotKnowledge } from "./status-dot.js";
|
|
62
|
+
import { ratingKnowledge } from "./rating.js";
|
|
63
|
+
import { defaultKnowledge } from "./_default.js";
|
|
64
|
+
|
|
65
|
+
const KNOWLEDGE_MAP: Record<string, ComponentKnowledge> = {
|
|
66
|
+
button: buttonKnowledge,
|
|
67
|
+
checkbox: checkboxKnowledge,
|
|
68
|
+
input: inputKnowledge,
|
|
69
|
+
select: selectKnowledge,
|
|
70
|
+
toggle: toggleKnowledge,
|
|
71
|
+
radio: radioKnowledge,
|
|
72
|
+
modal: modalKnowledge,
|
|
73
|
+
tabs: tabsKnowledge,
|
|
74
|
+
card: cardKnowledge,
|
|
75
|
+
toast: toastKnowledge,
|
|
76
|
+
accordion: accordionKnowledge,
|
|
77
|
+
tooltip: tooltipKnowledge,
|
|
78
|
+
slider: sliderKnowledge,
|
|
79
|
+
alert: alertKnowledge,
|
|
80
|
+
badge: badgeKnowledge,
|
|
81
|
+
avatar: avatarKnowledge,
|
|
82
|
+
chip: chipKnowledge,
|
|
83
|
+
table: tableKnowledge,
|
|
84
|
+
navigation: navigationKnowledge,
|
|
85
|
+
progress: progressKnowledge,
|
|
86
|
+
icon: iconKnowledge,
|
|
87
|
+
link: linkKnowledge,
|
|
88
|
+
menu: menuKnowledge,
|
|
89
|
+
spinner: spinnerKnowledge,
|
|
90
|
+
breadcrumb: breadcrumbKnowledge,
|
|
91
|
+
tag: tagKnowledge,
|
|
92
|
+
navbar: navbarKnowledge,
|
|
93
|
+
textarea: textareaKnowledge,
|
|
94
|
+
search: searchKnowledge,
|
|
95
|
+
combobox: comboboxKnowledge,
|
|
96
|
+
datepicker: datepickerKnowledge,
|
|
97
|
+
numberinput: numberInputKnowledge,
|
|
98
|
+
form: formKnowledge,
|
|
99
|
+
pagination: paginationKnowledge,
|
|
100
|
+
list: listKnowledge,
|
|
101
|
+
treeview: treeviewKnowledge,
|
|
102
|
+
typography: typographyKnowledge,
|
|
103
|
+
divider: dividerKnowledge,
|
|
104
|
+
skeleton: skeletonKnowledge,
|
|
105
|
+
popover: popoverKnowledge,
|
|
106
|
+
dropdownmenu: dropdownMenuKnowledge,
|
|
107
|
+
avatargroup: avatarGroupKnowledge,
|
|
108
|
+
grid: gridKnowledge,
|
|
109
|
+
emptystate: emptyStateKnowledge,
|
|
110
|
+
banner: bannerKnowledge,
|
|
111
|
+
drawer: drawerKnowledge,
|
|
112
|
+
segmentedcontrol: segmentedControlKnowledge,
|
|
113
|
+
stepper: stepperKnowledge,
|
|
114
|
+
fileuploader: fileUploaderKnowledge,
|
|
115
|
+
inlinemessage: inlineMessageKnowledge,
|
|
116
|
+
toolbar: toolbarKnowledge,
|
|
117
|
+
calendar: calendarKnowledge,
|
|
118
|
+
timepicker: timePickerKnowledge,
|
|
119
|
+
rangeslider: rangeSliderKnowledge,
|
|
120
|
+
inlineedit: inlineEditKnowledge,
|
|
121
|
+
statusdot: statusDotKnowledge,
|
|
122
|
+
rating: ratingKnowledge,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export function getComponentKnowledge(type?: string): ComponentKnowledge {
|
|
126
|
+
if (!type) return defaultKnowledge;
|
|
127
|
+
return KNOWLEDGE_MAP[type] ?? defaultKnowledge;
|
|
128
|
+
}
|