@sarjallab09/figma-intelligence 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -36
- package/dist/bin/cli.js +2 -0
- package/dist/design-bridge/bridge.js +2 -0
- package/dist/figma-bridge-plugin/bridge-relay.js +2 -0
- package/dist/figma-bridge-plugin/code.js +1 -0
- package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package-lock.json +0 -3
- package/dist/figma-bridge-plugin/ui.html +4970 -0
- package/dist/figma-intelligence-layer/dist/index.js +2 -0
- package/dist/scripts/clean-existing-chunks.js +2 -0
- package/dist/scripts/connect-ai-tool.js +2 -0
- package/dist/scripts/convert-hub-pdfs.js +2 -0
- package/dist/scripts/figma-mcp-status.js +2 -0
- package/dist/scripts/register-codex-mcp.js +2 -0
- package/dist/scripts/test-copilot-chat.js +2 -0
- package/package.json +11 -8
- package/bin/cli.js +0 -859
- package/design-bridge/bridge.js +0 -196
- package/design-bridge/lib/assets.js +0 -367
- package/design-bridge/lib/prompt.js +0 -85
- package/design-bridge/lib/server.js +0 -66
- package/design-bridge/lib/stitch.js +0 -37
- package/design-bridge/lib/tokens.js +0 -82
- package/design-bridge/package-lock.json +0 -579
- package/figma-bridge-plugin/README.md +0 -97
- package/figma-bridge-plugin/anthropic-chat-runner.js +0 -192
- package/figma-bridge-plugin/bridge-relay.js +0 -2505
- package/figma-bridge-plugin/chat-runner.js +0 -485
- package/figma-bridge-plugin/code.js +0 -1534
- package/figma-bridge-plugin/codex-runner.js +0 -505
- package/figma-bridge-plugin/component-schemas.js +0 -110
- package/figma-bridge-plugin/content-context.js +0 -869
- package/figma-bridge-plugin/create-button.js +0 -216
- package/figma-bridge-plugin/gemini-cli-runner.js +0 -291
- package/figma-bridge-plugin/gemini-runner.js +0 -187
- package/figma-bridge-plugin/html-to-figma.js +0 -927
- package/figma-bridge-plugin/knowledge-hub/.gitkeep +0 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/anatomy-spec.md +0 -159
- package/figma-bridge-plugin/knowledge-hub/uspec-references/api-spec.md +0 -162
- package/figma-bridge-plugin/knowledge-hub/uspec-references/color-spec.md +0 -148
- package/figma-bridge-plugin/knowledge-hub/uspec-references/full-spec-template.md +0 -314
- package/figma-bridge-plugin/knowledge-hub/uspec-references/property-spec.md +0 -175
- package/figma-bridge-plugin/knowledge-hub/uspec-references/screen-reader-spec.md +0 -180
- package/figma-bridge-plugin/knowledge-hub/uspec-references/structure-spec.md +0 -165
- package/figma-bridge-plugin/perplexity-runner.js +0 -188
- package/figma-bridge-plugin/references/SKILL.md +0 -178
- package/figma-bridge-plugin/references/anatomy-spec.md +0 -159
- package/figma-bridge-plugin/references/api-spec.md +0 -162
- package/figma-bridge-plugin/references/color-spec.md +0 -148
- package/figma-bridge-plugin/references/full-spec-template.md +0 -314
- package/figma-bridge-plugin/references/property-spec.md +0 -175
- package/figma-bridge-plugin/references/screen-reader-spec.md +0 -180
- package/figma-bridge-plugin/references/structure-spec.md +0 -165
- package/figma-bridge-plugin/shared-prompt-config.js +0 -645
- package/figma-bridge-plugin/spec-helpers/build-table.js +0 -269
- package/figma-bridge-plugin/spec-helpers/classify-elements.js +0 -189
- package/figma-bridge-plugin/spec-helpers/index.js +0 -35
- package/figma-bridge-plugin/spec-helpers/parse-figma-link.js +0 -49
- package/figma-bridge-plugin/spec-helpers/position-markers.js +0 -158
- package/figma-bridge-plugin/stitch-auth.js +0 -322
- package/figma-bridge-plugin/stitch-runner.js +0 -1427
- package/figma-bridge-plugin/token-resolver.js +0 -107
- package/figma-bridge-plugin/ui.html +0 -4542
- package/figma-intelligence-layer/.env.example +0 -39
- package/figma-intelligence-layer/docs/local-image-generation.md +0 -60
- package/figma-intelligence-layer/examples/comfyui-workflow-template.example.json +0 -101
- package/figma-intelligence-layer/jest.config.js +0 -14
- package/figma-intelligence-layer/mcp-config.json +0 -19
- package/figma-intelligence-layer/package-lock.json +0 -5892
- package/figma-intelligence-layer/scripts/setup-comfyui-local.sh +0 -67
- package/figma-intelligence-layer/scripts/start-comfyui.sh +0 -33
- package/figma-intelligence-layer/src/index.ts +0 -2233
- package/figma-intelligence-layer/src/shared/auto-layout-validator.ts +0 -404
- package/figma-intelligence-layer/src/shared/cache.ts +0 -187
- package/figma-intelligence-layer/src/shared/color-operations.ts +0 -533
- package/figma-intelligence-layer/src/shared/color-utils.ts +0 -138
- package/figma-intelligence-layer/src/shared/component-script-builder.ts +0 -413
- package/figma-intelligence-layer/src/shared/component-templates.ts +0 -2767
- package/figma-intelligence-layer/src/shared/concept-taxonomy.ts +0 -694
- package/figma-intelligence-layer/src/shared/decision-log.ts +0 -128
- package/figma-intelligence-layer/src/shared/design-system-context.ts +0 -568
- package/figma-intelligence-layer/src/shared/design-system-intelligence.ts +0 -131
- package/figma-intelligence-layer/src/shared/design-system-matcher.ts +0 -184
- package/figma-intelligence-layer/src/shared/design-system-normalizers.ts +0 -196
- package/figma-intelligence-layer/src/shared/design-system-tokens.ts +0 -295
- package/figma-intelligence-layer/src/shared/dtcg-validator.ts +0 -530
- package/figma-intelligence-layer/src/shared/enrichment-pipeline.ts +0 -671
- package/figma-intelligence-layer/src/shared/figma-bridge.ts +0 -1418
- package/figma-intelligence-layer/src/shared/font-config.ts +0 -126
- package/figma-intelligence-layer/src/shared/icon-catalog.ts +0 -360
- package/figma-intelligence-layer/src/shared/icon-fetch.ts +0 -80
- package/figma-intelligence-layer/src/shared/prototype-script-builder.ts +0 -162
- package/figma-intelligence-layer/src/shared/response-compression.ts +0 -440
- package/figma-intelligence-layer/src/shared/semantic-token-catalog.ts +0 -324
- package/figma-intelligence-layer/src/shared/token-binder.ts +0 -505
- package/figma-intelligence-layer/src/shared/token-math.ts +0 -427
- package/figma-intelligence-layer/src/shared/token-naming.ts +0 -468
- package/figma-intelligence-layer/src/shared/token-utils.ts +0 -420
- package/figma-intelligence-layer/src/shared/types.ts +0 -346
- package/figma-intelligence-layer/src/shared/typography-presets.ts +0 -94
- package/figma-intelligence-layer/src/shared/unsplash.ts +0 -165
- package/figma-intelligence-layer/src/shared/vision-client.ts +0 -607
- package/figma-intelligence-layer/src/shared/vision-provider-anthropic.ts +0 -334
- package/figma-intelligence-layer/src/shared/vision-provider-openai.ts +0 -446
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-handler.ts +0 -782
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-renderer.ts +0 -496
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotation-kit.ts +0 -230
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/colorblind-sim.ts +0 -66
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/index.ts +0 -810
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-analyzer.ts +0 -1191
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-figma-page.ts +0 -1346
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.ts +0 -148
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-figma-page.ts +0 -499
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-report.ts +0 -910
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-checker.ts +0 -989
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-criteria.ts +0 -1160
- package/figma-intelligence-layer/src/tools/phase1-vision/design-from-ref/index.ts +0 -424
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/component-recognizer.ts +0 -38
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/ds-matcher.ts +0 -111
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/font-matcher.ts +0 -114
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/icon-resolver.ts +0 -103
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/index.ts +0 -1060
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/layout-segmenter.ts +0 -18
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/token-inferencer.ts +0 -39
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/vision-pipeline.ts +0 -58
- package/figma-intelligence-layer/src/tools/phase1-vision/sketch-to-design/index.ts +0 -298
- package/figma-intelligence-layer/src/tools/phase1-vision/visual-audit/index.ts +0 -197
- package/figma-intelligence-layer/src/tools/phase2-accuracy/component-audit/index.ts +0 -494
- package/figma-intelligence-layer/src/tools/phase2-accuracy/intent-translator/index.ts +0 -356
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/container-patterns.ts +0 -123
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/index.ts +0 -663
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/built-in-rules.yaml +0 -56
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/index.ts +0 -614
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/rule-engine.ts +0 -113
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/color-theory.ts +0 -178
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/index.ts +0 -470
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/index.ts +0 -429
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/token-override-maps.ts +0 -226
- package/figma-intelligence-layer/src/tools/phase3-generation/ai-image-insert/index.ts +0 -535
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/index.ts +0 -660
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/pattern-fingerprints.ts +0 -209
- package/figma-intelligence-layer/src/tools/phase3-generation/composition-builder/index.ts +0 -540
- package/figma-intelligence-layer/src/tools/phase3-generation/figma-animated-build.ts +0 -391
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/index.ts +0 -2019
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/screen-templates.ts +0 -131
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-map/index.ts +0 -381
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-wire/index.ts +0 -565
- package/figma-intelligence-layer/src/tools/phase3-generation/swarm-build/index.ts +0 -764
- package/figma-intelligence-layer/src/tools/phase3-generation/system-drift/index.ts +0 -535
- package/figma-intelligence-layer/src/tools/phase3-generation/unsplash-search/index.ts +0 -84
- package/figma-intelligence-layer/src/tools/phase3-generation/url-to-frame/index.ts +0 -401
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/css-animations.ts +0 -68
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/framer-motion.ts +0 -78
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/swift-animations.ts +0 -93
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/index.ts +0 -596
- package/figma-intelligence-layer/src/tools/phase4-sync/ci-check/index.ts +0 -462
- package/figma-intelligence-layer/src/tools/phase4-sync/export-tokens/index.ts +0 -1470
- package/figma-intelligence-layer/src/tools/phase4-sync/generate-component-code/index.ts +0 -829
- package/figma-intelligence-layer/src/tools/phase4-sync/handoff-spec/index.ts +0 -702
- package/figma-intelligence-layer/src/tools/phase4-sync/icon-library-sync/index.ts +0 -483
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/index.ts +0 -501
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/storybook-parser.ts +0 -106
- package/figma-intelligence-layer/src/tools/phase4-sync/watch-docs/index.ts +0 -676
- package/figma-intelligence-layer/src/tools/phase4-sync/webhook-listener/index.ts +0 -560
- package/figma-intelligence-layer/src/tools/phase5-governance/apg-doc/index.ts +0 -1043
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/component-detection.ts +0 -620
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/anatomy.ts +0 -331
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/color-tokens.ts +0 -77
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/properties.ts +0 -54
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/snapshot.ts +0 -287
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/spacing.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/states.ts +0 -43
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/typography.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/index.ts +0 -221
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts +0 -166
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/alert.ts +0 -234
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar-group.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar.ts +0 -249
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/badge.ts +0 -231
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/banner.ts +0 -293
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/breadcrumb.ts +0 -240
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/button.ts +0 -243
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/calendar.ts +0 -307
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/card.ts +0 -143
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/checkbox.ts +0 -227
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/chip.ts +0 -233
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/combobox.ts +0 -282
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/datepicker.ts +0 -276
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/divider.ts +0 -223
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/drawer.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/dropdown-menu.ts +0 -289
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/empty-state.ts +0 -261
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/file-uploader.ts +0 -290
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts +0 -265
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/grid.ts +0 -238
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/icon.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts +0 -128
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-edit.ts +0 -286
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-message.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/input.ts +0 -330
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/link.ts +0 -247
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/list.ts +0 -250
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/menu.ts +0 -247
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/modal.ts +0 -144
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navbar.ts +0 -264
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navigation.ts +0 -251
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/number-input.ts +0 -261
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/pagination.ts +0 -248
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/popover.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/progress.ts +0 -251
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/radio.ts +0 -142
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/range-slider.ts +0 -282
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts +0 -250
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts +0 -258
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/segmented-control.ts +0 -265
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/select.ts +0 -319
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/skeleton.ts +0 -256
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/slider.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/spinner.ts +0 -239
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/status-dot.ts +0 -252
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/stepper.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/table.ts +0 -244
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tabs.ts +0 -143
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tag.ts +0 -243
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/textarea.ts +0 -259
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts +0 -293
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts +0 -144
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toggle.ts +0 -289
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toolbar.ts +0 -267
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tooltip.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/treeview.ts +0 -257
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/typography.ts +0 -319
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/legacy-compat.ts +0 -121
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/anatomy-diagram.ts +0 -430
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/figma-page.ts +0 -312
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/json.ts +0 -129
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/markdown.ts +0 -78
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/visual-doc.ts +0 -2333
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/accessibility.ts +0 -100
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/anatomy.ts +0 -32
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/color-tokens.ts +0 -59
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/content-guidance.ts +0 -18
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/design-tokens.ts +0 -53
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/interaction-rules.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/overview.ts +0 -91
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/properties-api.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/qa-criteria.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/related-components.ts +0 -110
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/responsive.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/size-specs.ts +0 -67
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/spacing-structure.ts +0 -58
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/state-specs.ts +0 -79
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/states.ts +0 -50
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/type-hierarchy.ts +0 -33
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/typography.ts +0 -55
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/usage-guidelines.ts +0 -73
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/variants.ts +0 -81
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/types.ts +0 -409
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/index.ts +0 -198
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/renderer.ts +0 -701
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/types.ts +0 -88
- package/figma-intelligence-layer/src/tools/phase5-governance/decision-log/index.ts +0 -135
- package/figma-intelligence-layer/src/tools/phase5-governance/design-decision-log/index.ts +0 -491
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-primitives/index.ts +0 -416
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-scaffolder/index.ts +0 -722
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-variables/index.ts +0 -449
- package/figma-intelligence-layer/src/tools/phase5-governance/health-report/index.ts +0 -393
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/index.ts +0 -406
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/figma-page.ts +0 -292
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/json.ts +0 -24
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/markdown.ts +0 -172
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/naming-guide.ts +0 -409
- package/figma-intelligence-layer/src/tools/phase5-governance/token-analytics/index.ts +0 -594
- package/figma-intelligence-layer/src/tools/phase5-governance/token-docs/index.ts +0 -710
- package/figma-intelligence-layer/src/tools/phase5-governance/token-migrate/index.ts +0 -458
- package/figma-intelligence-layer/src/tools/phase5-governance/token-naming/index.ts +0 -134
- package/figma-intelligence-layer/tests/apg-doc.test.ts +0 -101
- package/figma-intelligence-layer/tests/design-system-context.test.ts +0 -152
- package/figma-intelligence-layer/tests/design-system-matcher.test.ts +0 -144
- package/figma-intelligence-layer/tests/figma-bridge.test.ts +0 -83
- package/figma-intelligence-layer/tests/generate-image-and-insert.test.ts +0 -56
- package/figma-intelligence-layer/tests/screen-cloner-regression.test.ts +0 -69
- package/figma-intelligence-layer/tests/smoke.test.ts +0 -174
- package/figma-intelligence-layer/tests/spec-generator.test.ts +0 -127
- package/figma-intelligence-layer/tests/token-migrate.test.ts +0 -21
- package/figma-intelligence-layer/tests/token-naming.test.ts +0 -30
- package/figma-intelligence-layer/tsconfig.json +0 -19
- package/scripts/clean-existing-chunks.js +0 -179
- package/scripts/connect-ai-tool.js +0 -490
- package/scripts/convert-hub-pdfs.js +0 -425
- package/scripts/figma-mcp-status.js +0 -349
- package/scripts/register-codex-mcp.js +0 -96
- /package/{design-bridge → dist/design-bridge}/.env.example +0 -0
- /package/{design-bridge → dist/design-bridge}/package.json +0 -0
- /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/manifest.json +0 -0
- /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package.json +0 -0
- /package/{figma-intelligence-layer → dist/figma-intelligence-layer}/package.json +0 -0
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* figma_component_spec — Unified component specification generator
|
|
3
|
-
*
|
|
4
|
-
* Replaces both figma_generate_spec and figma_component_doc with a single,
|
|
5
|
-
* modular tool that follows the uSpec pattern: deterministic data extraction
|
|
6
|
-
* from real Figma components + AI-structured output. Content is never fabricated.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { decisionLog } from "../../../shared/decision-log.js";
|
|
10
|
-
|
|
11
|
-
// ─── Extractors ─────────────────────────────────────────────────────────────
|
|
12
|
-
import { resolveTargetNodeId, captureSnapshot } from "./extractors/snapshot.js";
|
|
13
|
-
import { extractAnatomy } from "./extractors/anatomy.js";
|
|
14
|
-
import { extractProperties } from "./extractors/properties.js";
|
|
15
|
-
import { extractStates } from "./extractors/states.js";
|
|
16
|
-
import { extractSpacing } from "./extractors/spacing.js";
|
|
17
|
-
import { extractColorTokens } from "./extractors/color-tokens.js";
|
|
18
|
-
import { extractTypography } from "./extractors/typography.js";
|
|
19
|
-
|
|
20
|
-
// ─── Component Detection ────────────────────────────────────────────────────
|
|
21
|
-
import { detectComponentType } from "./component-detection.js";
|
|
22
|
-
|
|
23
|
-
// ─── Knowledge Base ────────────────────────────────────────────────────────
|
|
24
|
-
import { getComponentKnowledge } from "./knowledge/index.js";
|
|
25
|
-
|
|
26
|
-
// ─── Section Builders ───────────────────────────────────────────────────────
|
|
27
|
-
import { buildOverviewSection } from "./sections/overview.js";
|
|
28
|
-
import { buildAnatomySection } from "./sections/anatomy.js";
|
|
29
|
-
import { buildVariantsSection } from "./sections/variants.js";
|
|
30
|
-
import { buildStatesSection } from "./sections/states.js";
|
|
31
|
-
import { buildStateSpecsSection } from "./sections/state-specs.js";
|
|
32
|
-
import { buildPropertiesSection } from "./sections/properties-api.js";
|
|
33
|
-
import { buildSizeSpecsSection } from "./sections/size-specs.js";
|
|
34
|
-
import { buildSpacingSection } from "./sections/spacing-structure.js";
|
|
35
|
-
import { buildColorTokensSection } from "./sections/color-tokens.js";
|
|
36
|
-
import { buildDesignTokensSection } from "./sections/design-tokens.js";
|
|
37
|
-
import { buildTypographySection } from "./sections/typography.js";
|
|
38
|
-
import { buildTypeHierarchySection } from "./sections/type-hierarchy.js";
|
|
39
|
-
import { buildInteractionRulesSection } from "./sections/interaction-rules.js";
|
|
40
|
-
import { buildContentGuidanceSection } from "./sections/content-guidance.js";
|
|
41
|
-
import { buildResponsiveSection } from "./sections/responsive.js";
|
|
42
|
-
import { buildAccessibilitySection } from "./sections/accessibility.js";
|
|
43
|
-
import { buildQaCriteriaSection } from "./sections/qa-criteria.js";
|
|
44
|
-
import { buildUsageSection } from "./sections/usage-guidelines.js";
|
|
45
|
-
import { buildRelatedSection } from "./sections/related-components.js";
|
|
46
|
-
|
|
47
|
-
// ─── Renderers ──────────────────────────────────────────────────────────────
|
|
48
|
-
import { renderMarkdown } from "./renderers/markdown.js";
|
|
49
|
-
import { renderVisualDoc } from "./renderers/visual-doc.js";
|
|
50
|
-
import { renderJson } from "./renderers/json.js";
|
|
51
|
-
|
|
52
|
-
// ─── Types ──────────────────────────────────────────────────────────────────
|
|
53
|
-
import type {
|
|
54
|
-
ComponentSpecArgs,
|
|
55
|
-
ComponentSpecResult,
|
|
56
|
-
ComponentSpec,
|
|
57
|
-
ExtractionResult,
|
|
58
|
-
SpecSectionOutput,
|
|
59
|
-
SpecSection,
|
|
60
|
-
ALL_SECTIONS as AllSectionsType,
|
|
61
|
-
} from "./types.js";
|
|
62
|
-
import { ALL_SECTIONS } from "./types.js";
|
|
63
|
-
|
|
64
|
-
// ─── Re-exports for apg-doc compatibility ───────────────────────────────────
|
|
65
|
-
export { resolveTargetNodeId, captureSnapshot } from "./extractors/snapshot.js";
|
|
66
|
-
export { createDocumentationPages, formatDocumentReport } from "./legacy-compat.js";
|
|
67
|
-
export type {
|
|
68
|
-
NodeSnapshot,
|
|
69
|
-
SnapshotNode,
|
|
70
|
-
GeneratedDocumentSection,
|
|
71
|
-
GeneratedDocument,
|
|
72
|
-
} from "./types.js";
|
|
73
|
-
|
|
74
|
-
// ─── Section builder map ────────────────────────────────────────────────────
|
|
75
|
-
|
|
76
|
-
type SectionBuilder = (data: ExtractionResult) => SpecSectionOutput | null;
|
|
77
|
-
|
|
78
|
-
const SECTION_BUILDERS: Record<SpecSection, SectionBuilder> = {
|
|
79
|
-
overview: buildOverviewSection,
|
|
80
|
-
anatomy: buildAnatomySection,
|
|
81
|
-
variants: buildVariantsSection,
|
|
82
|
-
states: buildStatesSection,
|
|
83
|
-
"state-specs": buildStateSpecsSection,
|
|
84
|
-
properties: buildPropertiesSection,
|
|
85
|
-
"size-specs": buildSizeSpecsSection,
|
|
86
|
-
spacing: buildSpacingSection,
|
|
87
|
-
"color-tokens": buildColorTokensSection,
|
|
88
|
-
"design-tokens": buildDesignTokensSection,
|
|
89
|
-
typography: buildTypographySection,
|
|
90
|
-
"type-hierarchy": buildTypeHierarchySection,
|
|
91
|
-
"interaction-rules": buildInteractionRulesSection,
|
|
92
|
-
"content-guidance": buildContentGuidanceSection,
|
|
93
|
-
responsive: buildResponsiveSection,
|
|
94
|
-
accessibility: buildAccessibilitySection,
|
|
95
|
-
"qa-criteria": buildQaCriteriaSection,
|
|
96
|
-
usage: buildUsageSection,
|
|
97
|
-
related: buildRelatedSection,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// ─── Main Handler ───────────────────────────────────────────────────────────
|
|
101
|
-
|
|
102
|
-
export async function componentSpecHandler(args: ComponentSpecArgs): Promise<ComponentSpecResult> {
|
|
103
|
-
// 1. Resolve target node
|
|
104
|
-
const nodeId = await resolveTargetNodeId(args);
|
|
105
|
-
|
|
106
|
-
// 2. Capture base snapshot
|
|
107
|
-
let snapshot;
|
|
108
|
-
try {
|
|
109
|
-
snapshot = await captureSnapshot(nodeId);
|
|
110
|
-
} catch (err) {
|
|
111
|
-
throw new Error(
|
|
112
|
-
`figma_component_spec: Could not read component data. Ensure Figma is open with the bridge plugin running. ` +
|
|
113
|
-
`Original error: ${err instanceof Error ? err.message : String(err)}`
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// 3. Detect component type and load knowledge
|
|
118
|
-
const { type: componentType, guidance: typeGuidance } = detectComponentType(snapshot);
|
|
119
|
-
const knowledge = getComponentKnowledge(componentType);
|
|
120
|
-
|
|
121
|
-
// 4. Run all extractions — use allSettled so one failure doesn't crash the rest
|
|
122
|
-
const settled = await Promise.allSettled([
|
|
123
|
-
extractAnatomy(nodeId),
|
|
124
|
-
extractSpacing(nodeId),
|
|
125
|
-
extractColorTokens(nodeId),
|
|
126
|
-
extractTypography(nodeId),
|
|
127
|
-
]);
|
|
128
|
-
|
|
129
|
-
const anatomyResult = settled[0].status === "fulfilled" ? settled[0].value : { elements: [] };
|
|
130
|
-
const spacingResult = settled[1].status === "fulfilled" ? settled[1].value : [];
|
|
131
|
-
const colorTokensResult = settled[2].status === "fulfilled" ? settled[2].value : [];
|
|
132
|
-
const typographyResult = settled[3].status === "fulfilled" ? settled[3].value : [];
|
|
133
|
-
|
|
134
|
-
const propertiesResult = extractProperties(snapshot);
|
|
135
|
-
const statesResult = extractStates(snapshot);
|
|
136
|
-
|
|
137
|
-
// 5. Assemble extraction result
|
|
138
|
-
const extraction: ExtractionResult = {
|
|
139
|
-
snapshot,
|
|
140
|
-
anatomy: anatomyResult,
|
|
141
|
-
properties: propertiesResult,
|
|
142
|
-
states: statesResult,
|
|
143
|
-
spacing: spacingResult,
|
|
144
|
-
colorTokens: colorTokensResult,
|
|
145
|
-
typography: typographyResult,
|
|
146
|
-
componentType,
|
|
147
|
-
typeGuidance,
|
|
148
|
-
knowledge,
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// 6. Build requested sections
|
|
152
|
-
const requestedSections = args.sections || ALL_SECTIONS;
|
|
153
|
-
const sections: SpecSectionOutput[] = [];
|
|
154
|
-
|
|
155
|
-
for (const sectionId of requestedSections) {
|
|
156
|
-
const builder = SECTION_BUILDERS[sectionId];
|
|
157
|
-
if (!builder) continue;
|
|
158
|
-
const result = builder(extraction);
|
|
159
|
-
if (result) sections.push(result);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// 7. Assemble spec
|
|
163
|
-
const spec: ComponentSpec = {
|
|
164
|
-
componentName: snapshot.name,
|
|
165
|
-
description: knowledge.description,
|
|
166
|
-
nodeId: snapshot.id,
|
|
167
|
-
nodeType: snapshot.type,
|
|
168
|
-
componentType,
|
|
169
|
-
sections,
|
|
170
|
-
extraction,
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// 8. Render outputs
|
|
174
|
-
let markdown: string | undefined;
|
|
175
|
-
let figmaPageId: string | undefined;
|
|
176
|
-
const warnings: string[] = [];
|
|
177
|
-
|
|
178
|
-
if (args.outputFormat === "markdown" || args.outputFormat === "all") {
|
|
179
|
-
markdown = renderMarkdown(spec);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (args.outputFormat === "figma-page" || args.outputFormat === "all") {
|
|
183
|
-
try {
|
|
184
|
-
figmaPageId = await renderVisualDoc(spec, args.pageName);
|
|
185
|
-
} catch (err) {
|
|
186
|
-
const errMsg = err instanceof Error ? err.message : String(err);
|
|
187
|
-
warnings.push(`Figma page rendering failed: ${errMsg}`);
|
|
188
|
-
// Still return markdown so the user gets something useful
|
|
189
|
-
if (!markdown) {
|
|
190
|
-
markdown = renderMarkdown(spec);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// 9. Log decision
|
|
196
|
-
const logEntry = await decisionLog.log({
|
|
197
|
-
tool: "figma_component_spec",
|
|
198
|
-
nodeIds: figmaPageId ? [snapshot.id, figmaPageId] : [snapshot.id],
|
|
199
|
-
rationale: `Generated component spec for ${snapshot.name} (${snapshot.type}). Type: ${componentType || "unknown"}. Sections: ${sections.length}. Variants: ${propertiesResult.variantAxes.length}. States: ${statesResult.states.length}.${warnings.length > 0 ? ` Warnings: ${warnings.join("; ")}` : ""}`,
|
|
200
|
-
tokens: snapshot.tokenAliases,
|
|
201
|
-
reversible: true,
|
|
202
|
-
metadata: {
|
|
203
|
-
outputFormat: args.outputFormat,
|
|
204
|
-
componentType,
|
|
205
|
-
sectionCount: sections.length,
|
|
206
|
-
variantAxisCount: propertiesResult.variantAxes.length,
|
|
207
|
-
stateCount: statesResult.states.length,
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
// Transform spec to structured JSON format for output
|
|
212
|
-
const jsonSpec = renderJson(spec) as ComponentSpec & { component: string; description: string; sections: Record<string, unknown> };
|
|
213
|
-
|
|
214
|
-
return {
|
|
215
|
-
spec: jsonSpec,
|
|
216
|
-
markdown,
|
|
217
|
-
figmaPageId,
|
|
218
|
-
logEntryId: logEntry.id,
|
|
219
|
-
warnings: warnings.length > 0 ? warnings : undefined,
|
|
220
|
-
};
|
|
221
|
-
}
|
package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* _default.ts — Fallback knowledge for unknown/unrecognized component types
|
|
3
|
-
*/
|
|
4
|
-
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
-
|
|
6
|
-
export const defaultKnowledge: ComponentKnowledge = {
|
|
7
|
-
description:
|
|
8
|
-
"UI component | Reusable interface element | Design system building block",
|
|
9
|
-
|
|
10
|
-
stateSpecifications: [
|
|
11
|
-
{
|
|
12
|
-
state: "Default",
|
|
13
|
-
visualChange: "Base appearance with standard styling",
|
|
14
|
-
opacity: "1",
|
|
15
|
-
cursorWeb: "default",
|
|
16
|
-
usage: "Resting state when no interaction is occurring",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
state: "Hover",
|
|
20
|
-
visualChange: "Subtle visual emphasis to indicate interactivity",
|
|
21
|
-
opacity: "1",
|
|
22
|
-
cursorWeb: "pointer",
|
|
23
|
-
usage: "Mouse cursor enters the interactive area",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
state: "Disabled",
|
|
27
|
-
visualChange: "Reduced contrast, muted colors",
|
|
28
|
-
opacity: "0.4",
|
|
29
|
-
cursorWeb: "not-allowed",
|
|
30
|
-
usage: "Component is non-interactive due to current context",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
state: "Focus",
|
|
34
|
-
visualChange: "Visible focus ring or outline",
|
|
35
|
-
opacity: "1",
|
|
36
|
-
cursorWeb: "default",
|
|
37
|
-
usage: "Component receives keyboard focus",
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
propertyDescriptions: {
|
|
42
|
-
disabled:
|
|
43
|
-
"When true the component is non-interactive and visually muted",
|
|
44
|
-
children: "Content rendered inside the component",
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
sizeSpecifications: [
|
|
48
|
-
{
|
|
49
|
-
size: "Small",
|
|
50
|
-
height: "32px",
|
|
51
|
-
paddingLR: "8px",
|
|
52
|
-
fontSize: "12px",
|
|
53
|
-
iconSize: "16px",
|
|
54
|
-
borderRadius: "4px",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
size: "Medium",
|
|
58
|
-
height: "40px",
|
|
59
|
-
paddingLR: "12px",
|
|
60
|
-
fontSize: "14px",
|
|
61
|
-
iconSize: "20px",
|
|
62
|
-
borderRadius: "6px",
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
size: "Large",
|
|
66
|
-
height: "48px",
|
|
67
|
-
paddingLR: "16px",
|
|
68
|
-
fontSize: "16px",
|
|
69
|
-
iconSize: "24px",
|
|
70
|
-
borderRadius: "8px",
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
|
|
74
|
-
designTokenBindings: [
|
|
75
|
-
{
|
|
76
|
-
property: "Background",
|
|
77
|
-
tokenName: "$surface-default",
|
|
78
|
-
role: "Component background fill",
|
|
79
|
-
fallback: "#FFFFFF",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
property: "Border",
|
|
83
|
-
tokenName: "$border-default",
|
|
84
|
-
role: "Component border color",
|
|
85
|
-
fallback: "#D0D5DD",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
property: "Text Color",
|
|
89
|
-
tokenName: "$text-primary",
|
|
90
|
-
role: "Primary text content",
|
|
91
|
-
fallback: "#101828",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
property: "Focus Ring",
|
|
95
|
-
tokenName: "$focus-ring",
|
|
96
|
-
role: "Visible keyboard focus indicator",
|
|
97
|
-
fallback: "0 0 0 2px #2E90FA",
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
|
|
101
|
-
structureRules: [
|
|
102
|
-
"Use Auto Layout for all internal arrangement",
|
|
103
|
-
"Respect consistent padding and spacing tokens",
|
|
104
|
-
"Ensure minimum 44x44px touch target on interactive elements",
|
|
105
|
-
"Keep the layer tree flat; avoid unnecessary nesting",
|
|
106
|
-
],
|
|
107
|
-
|
|
108
|
-
typeHierarchyRules: [
|
|
109
|
-
"Use the design system's type scale — do not hard-code font sizes",
|
|
110
|
-
"Maintain consistent line-height across label text",
|
|
111
|
-
"Sentence case for UI labels unless the system specifies otherwise",
|
|
112
|
-
],
|
|
113
|
-
|
|
114
|
-
interactionRules: [
|
|
115
|
-
{ event: "Click / Tap", trigger: "pointerdown + pointerup inside bounds", action: "Trigger primary action" },
|
|
116
|
-
{ event: "Focus", trigger: "Tab key or programmatic focus", action: "Show focus indicator" },
|
|
117
|
-
{ event: "Blur", trigger: "Focus leaves component", action: "Remove focus indicator" },
|
|
118
|
-
],
|
|
119
|
-
|
|
120
|
-
contentGuidance: [
|
|
121
|
-
"Keep text labels concise and action-oriented where applicable",
|
|
122
|
-
"Use placeholder text sparingly — prefer visible labels",
|
|
123
|
-
"Ensure all decorative icons have empty alt text; meaningful icons need descriptive alt text",
|
|
124
|
-
],
|
|
125
|
-
|
|
126
|
-
responsiveBehaviour: [
|
|
127
|
-
{ breakpoint: "Mobile (<768px)", behavior: "Stack elements vertically; increase touch targets" },
|
|
128
|
-
{ breakpoint: "Desktop (>=1024px)", behavior: "Use standard sizing and horizontal layouts" },
|
|
129
|
-
],
|
|
130
|
-
|
|
131
|
-
accessibilitySpec: {
|
|
132
|
-
intro:
|
|
133
|
-
"All components must meet WCAG 2.1 AA. Verify keyboard access, screen reader announcements, and color contrast.",
|
|
134
|
-
requirements: [
|
|
135
|
-
{ requirement: "Focusable", level: "A", notes: "Must be reachable via Tab key when interactive" },
|
|
136
|
-
{ requirement: "Contrast Ratio", level: "AA", notes: "Text: 4.5:1 minimum; large text and UI controls: 3:1" },
|
|
137
|
-
{ requirement: "Screen Reader", level: "A", notes: "Announce role, name, and state to assistive technology" },
|
|
138
|
-
],
|
|
139
|
-
outro: [
|
|
140
|
-
"Test with at least one screen reader (VoiceOver, NVDA, or JAWS)",
|
|
141
|
-
"Never rely on color alone to convey meaning",
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
qaAcceptanceCriteria: [
|
|
146
|
-
{ check: "Visual Regression", platform: "All", expectedResult: "No unintended visual changes from baseline" },
|
|
147
|
-
{ check: "Keyboard Navigation", platform: "Web", expectedResult: "All interactive elements reachable and operable via keyboard" },
|
|
148
|
-
{ check: "Screen Reader", platform: "Web", expectedResult: "Role, name, and state announced correctly" },
|
|
149
|
-
{ check: "Disabled State", platform: "All", expectedResult: "Non-interactive appearance; no event firing" },
|
|
150
|
-
{ check: "Contrast", platform: "All", expectedResult: "Meets WCAG AA contrast ratios" },
|
|
151
|
-
],
|
|
152
|
-
|
|
153
|
-
dos: [
|
|
154
|
-
"Follow the design system's spacing and color tokens",
|
|
155
|
-
"Provide visible focus indicators for keyboard users",
|
|
156
|
-
"Test across supported breakpoints",
|
|
157
|
-
"Use semantic HTML elements where possible",
|
|
158
|
-
],
|
|
159
|
-
|
|
160
|
-
donts: [
|
|
161
|
-
"Do not override token values with hard-coded colors",
|
|
162
|
-
"Do not remove focus outlines without providing an alternative",
|
|
163
|
-
"Do not rely solely on hover states for critical information",
|
|
164
|
-
"Do not nest interactive elements inside other interactive elements",
|
|
165
|
-
],
|
|
166
|
-
};
|
package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* accordion.ts — Gold-standard design knowledge for Accordion components
|
|
3
|
-
*/
|
|
4
|
-
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
-
|
|
6
|
-
export const accordionKnowledge: ComponentKnowledge = {
|
|
7
|
-
description:
|
|
8
|
-
"Expandable content panel | Progressive disclosure control | Collapsible section container",
|
|
9
|
-
|
|
10
|
-
stateSpecifications: [
|
|
11
|
-
{
|
|
12
|
-
state: "Collapsed",
|
|
13
|
-
visualChange: "Header visible with chevron pointing right/down; content panel height is 0 with overflow hidden",
|
|
14
|
-
opacity: "1",
|
|
15
|
-
cursorWeb: "pointer",
|
|
16
|
-
usage: "Default resting state — content is hidden to reduce cognitive load",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
state: "Expanded",
|
|
20
|
-
visualChange: "Chevron rotates 90° (or 180°); content panel animates to full intrinsic height",
|
|
21
|
-
opacity: "1",
|
|
22
|
-
cursorWeb: "pointer",
|
|
23
|
-
usage: "User has activated the header to reveal the section content",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
state: "Hover",
|
|
27
|
-
visualChange: "Header background shifts to hover token; chevron may gain subtle color change",
|
|
28
|
-
opacity: "1",
|
|
29
|
-
cursorWeb: "pointer",
|
|
30
|
-
usage: "Mouse cursor enters the clickable header region",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
state: "Focus",
|
|
34
|
-
visualChange: "2px focus ring around the header trigger element, offset by 2px",
|
|
35
|
-
opacity: "1",
|
|
36
|
-
cursorWeb: "pointer",
|
|
37
|
-
usage: "Header receives keyboard focus via Tab key navigation",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
state: "Disabled",
|
|
41
|
-
visualChange: "Header text and chevron switch to muted tokens; no expand/collapse interaction",
|
|
42
|
-
opacity: "0.4",
|
|
43
|
-
cursorWeb: "not-allowed",
|
|
44
|
-
usage: "Section content is unavailable or irrelevant in the current context",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
state: "Active",
|
|
48
|
-
visualChange: "Header background darkens momentarily on click/tap before expand animation begins",
|
|
49
|
-
opacity: "1",
|
|
50
|
-
cursorWeb: "pointer",
|
|
51
|
-
usage: "Mouse button is held down or touch press is in progress on the header",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
|
|
55
|
-
propertyDescriptions: {
|
|
56
|
-
title: "Visible heading text rendered in the accordion header; should clearly describe the hidden content",
|
|
57
|
-
expanded: "Boolean controlling whether the content panel is currently visible; supports controlled and uncontrolled modes",
|
|
58
|
-
disabled: "When true the header is non-interactive; content cannot be toggled open or closed",
|
|
59
|
-
allowMultiple: "When true, multiple panels can be open simultaneously; when false, opening one closes the others (exclusive mode)",
|
|
60
|
-
iconPosition: "Controls whether the expand/collapse chevron appears on the left or right side of the header",
|
|
61
|
-
size: "Dimensional preset controlling header height, padding, and font-size (Small, Medium, Large)",
|
|
62
|
-
onToggle: "Callback fired when the expanded state changes; receives the panel index and new expanded boolean",
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
sizeSpecifications: [
|
|
66
|
-
{
|
|
67
|
-
size: "Small",
|
|
68
|
-
height: "36px",
|
|
69
|
-
paddingLR: "12px",
|
|
70
|
-
fontSize: "13px",
|
|
71
|
-
iconSize: "16px",
|
|
72
|
-
borderRadius: "6px",
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
size: "Medium",
|
|
76
|
-
height: "48px",
|
|
77
|
-
paddingLR: "16px",
|
|
78
|
-
fontSize: "14px",
|
|
79
|
-
iconSize: "20px",
|
|
80
|
-
borderRadius: "8px",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
size: "Large",
|
|
84
|
-
height: "56px",
|
|
85
|
-
paddingLR: "20px",
|
|
86
|
-
fontSize: "16px",
|
|
87
|
-
iconSize: "24px",
|
|
88
|
-
borderRadius: "10px",
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
|
|
92
|
-
designTokenBindings: [
|
|
93
|
-
{
|
|
94
|
-
property: "Header Background",
|
|
95
|
-
tokenName: "$accordion-header-bg",
|
|
96
|
-
role: "Fill color for the clickable header region",
|
|
97
|
-
fallback: "#F9FAFB",
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
property: "Header Text",
|
|
101
|
-
tokenName: "$accordion-header-text",
|
|
102
|
-
role: "Title label color in the header",
|
|
103
|
-
fallback: "#101828",
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
property: "Chevron Color",
|
|
107
|
-
tokenName: "$accordion-icon-color",
|
|
108
|
-
role: "Fill/stroke color for the expand/collapse indicator icon",
|
|
109
|
-
fallback: "#667085",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
property: "Border",
|
|
113
|
-
tokenName: "$accordion-border",
|
|
114
|
-
role: "Divider line between accordion items",
|
|
115
|
-
fallback: "#E4E7EC",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
property: "Content Background",
|
|
119
|
-
tokenName: "$accordion-content-bg",
|
|
120
|
-
role: "Fill color for the expanded content region",
|
|
121
|
-
fallback: "#FFFFFF",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
property: "Focus Ring",
|
|
125
|
-
tokenName: "$focus-ring",
|
|
126
|
-
role: "Keyboard focus indicator on the header trigger",
|
|
127
|
-
fallback: "0 0 0 2px #FFFFFF, 0 0 0 4px #2E90FA",
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
property: "Transition",
|
|
131
|
-
tokenName: "$transition-expand",
|
|
132
|
-
role: "Animation timing for expand/collapse height transition",
|
|
133
|
-
fallback: "250ms ease-in-out",
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
|
|
137
|
-
structureRules: [
|
|
138
|
-
"Each accordion item consists of a header (trigger) and a content panel (region) as sibling elements",
|
|
139
|
-
"Header uses horizontal Auto Layout with space-between to position title and chevron",
|
|
140
|
-
"Content panel uses vertical Auto Layout; height animates between 0 and intrinsic height",
|
|
141
|
-
"Chevron icon rotates via CSS transform — no icon swap between states",
|
|
142
|
-
"Adjacent accordion items are separated by a 1px border using $accordion-border token",
|
|
143
|
-
"Content panel includes internal padding separate from the header padding for visual breathing room",
|
|
144
|
-
"The outer container clips overflow to prevent content from leaking during animation",
|
|
145
|
-
],
|
|
146
|
-
|
|
147
|
-
typeHierarchyRules: [
|
|
148
|
-
"Header title uses font-weight Semi-Bold (600) to distinguish from body content",
|
|
149
|
-
"Content text uses Regular weight (400) and the body font-size one step smaller than the header",
|
|
150
|
-
"Title text uses sentence case — capitalize only the first word",
|
|
151
|
-
"Long titles truncate with ellipsis; never wrap to a second line in the header",
|
|
152
|
-
"Nested content may include any block-level elements (paragraphs, lists, images)",
|
|
153
|
-
],
|
|
154
|
-
|
|
155
|
-
interactionRules: [
|
|
156
|
-
{ event: "Click / Tap", trigger: "pointerup on header", action: "Toggle expanded state; fire onToggle callback" },
|
|
157
|
-
{ event: "Hover", trigger: "pointerenter on header", action: "Transition header to hover background token" },
|
|
158
|
-
{ event: "Focus", trigger: "Tab key to header", action: "Show focus ring on the header trigger element" },
|
|
159
|
-
{ event: "Keydown Enter", trigger: "Enter key while header focused", action: "Toggle expanded state (same as click)" },
|
|
160
|
-
{ event: "Keydown Space", trigger: "Space key while header focused", action: "Toggle expanded state; prevent page scroll" },
|
|
161
|
-
{ event: "Arrow Down", trigger: "Down arrow while header focused", action: "Move focus to the next accordion header in the group" },
|
|
162
|
-
{ event: "Arrow Up", trigger: "Up arrow while header focused", action: "Move focus to the previous accordion header in the group" },
|
|
163
|
-
],
|
|
164
|
-
|
|
165
|
-
contentGuidance: [
|
|
166
|
-
"Header titles should be concise and descriptive — summarize the hidden content in 2-5 words",
|
|
167
|
-
"Content should be meaningful enough to justify hiding — avoid hiding single lines of text",
|
|
168
|
-
"Use accordions for progressive disclosure when content volume would overwhelm the page",
|
|
169
|
-
"Group related content into logical sections; each panel should cover one distinct topic",
|
|
170
|
-
"Avoid nesting accordions within accordions — use a flat hierarchy or a different pattern",
|
|
171
|
-
"Consider starting with one panel expanded if the content is frequently needed",
|
|
172
|
-
],
|
|
173
|
-
|
|
174
|
-
responsiveBehaviour: [
|
|
175
|
-
{ breakpoint: "Mobile (<768px)", behavior: "Accordion fills full width; header padding reduces to compact preset; touch target 48px min" },
|
|
176
|
-
{ breakpoint: "Tablet (768-1023px)", behavior: "Accordion may span full width or sit within a card container; same interaction model" },
|
|
177
|
-
{ breakpoint: "Desktop (1024-1439px)", behavior: "Accordion may be constrained to a max-width column; content area has generous padding" },
|
|
178
|
-
{ breakpoint: "Ultra-wide (>=1440px)", behavior: "Max-width capped; accordion does not stretch beyond readable line length (~720px)" },
|
|
179
|
-
],
|
|
180
|
-
|
|
181
|
-
accessibilitySpec: {
|
|
182
|
-
intro:
|
|
183
|
-
"Accordions rely on the disclosure pattern (heading + region) to be accessible. Proper ARIA roles and keyboard support are essential.",
|
|
184
|
-
requirements: [
|
|
185
|
-
{ requirement: "Heading + Button", level: "A", notes: "Header must use a heading element wrapping a button; the button controls expand/collapse" },
|
|
186
|
-
{ requirement: "aria-expanded", level: "A", notes: "The trigger button must have aria-expanded='true' when open and 'false' when closed" },
|
|
187
|
-
{ requirement: "aria-controls", level: "A", notes: "The trigger button must reference the content panel ID via aria-controls" },
|
|
188
|
-
{ requirement: "role='region'", level: "A", notes: "The content panel should have role='region' and aria-labelledby pointing to the header" },
|
|
189
|
-
{ requirement: "Keyboard Navigation", level: "A", notes: "Enter and Space toggle; arrow keys move between headers in a group" },
|
|
190
|
-
{ requirement: "Contrast", level: "AA", notes: "Header text must meet 4.5:1 contrast; chevron icon must meet 3:1 non-text contrast" },
|
|
191
|
-
{ requirement: "Motion", level: "AAA", notes: "Expand/collapse animation must respect prefers-reduced-motion and collapse instantly when set" },
|
|
192
|
-
],
|
|
193
|
-
outro: [
|
|
194
|
-
"Screen readers should announce the heading level, expanded state, and panel content when expanded",
|
|
195
|
-
"Focus must remain on the header trigger after toggling — never move focus into the content automatically",
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
qaAcceptanceCriteria: [
|
|
200
|
-
{ check: "Expand Animation", platform: "Web", expectedResult: "Content panel smoothly animates from 0 to full height within 250ms" },
|
|
201
|
-
{ check: "Collapse Animation", platform: "Web", expectedResult: "Content panel smoothly animates to 0 height; no content flash or jump" },
|
|
202
|
-
{ check: "Chevron Rotation", platform: "All", expectedResult: "Chevron rotates smoothly on toggle; points right when collapsed, down when expanded" },
|
|
203
|
-
{ check: "Exclusive Mode", platform: "All", expectedResult: "When allowMultiple=false, opening one panel closes all others" },
|
|
204
|
-
{ check: "Multi-Open Mode", platform: "All", expectedResult: "When allowMultiple=true, multiple panels can remain open simultaneously" },
|
|
205
|
-
{ check: "Keyboard Navigation", platform: "Web", expectedResult: "Tab focuses header; Enter/Space toggles; Arrow keys move between headers" },
|
|
206
|
-
{ check: "Screen Reader", platform: "Web", expectedResult: "Announces heading level, button role, expanded/collapsed state" },
|
|
207
|
-
{ check: "Disabled Panel", platform: "All", expectedResult: "Header appears muted; click and keyboard have no effect; aria-disabled='true'" },
|
|
208
|
-
{ check: "Reduced Motion", platform: "Web", expectedResult: "Animation disabled when prefers-reduced-motion: reduce is set" },
|
|
209
|
-
{ check: "Overflow Content", platform: "Web", expectedResult: "Long content scrolls within panel or extends panel height without clipping" },
|
|
210
|
-
{ check: "Focus Ring", platform: "Web", expectedResult: "Visible focus ring on header when navigated via keyboard" },
|
|
211
|
-
],
|
|
212
|
-
|
|
213
|
-
dos: [
|
|
214
|
-
"Use accordions to organize lengthy content into scannable sections",
|
|
215
|
-
"Provide clear, descriptive header titles so users can find content without expanding",
|
|
216
|
-
"Allow multiple panels open when users need to compare content across sections",
|
|
217
|
-
"Use exclusive mode (single open) when context switching is acceptable and screen space is limited",
|
|
218
|
-
"Respect prefers-reduced-motion by disabling expand/collapse animation",
|
|
219
|
-
"Maintain consistent spacing between accordion items using design tokens",
|
|
220
|
-
"Include a visible border or separator between items for clear visual grouping",
|
|
221
|
-
],
|
|
222
|
-
|
|
223
|
-
donts: [
|
|
224
|
-
"Do not nest accordions inside other accordions — flatten the hierarchy instead",
|
|
225
|
-
"Do not use accordions for only one or two items — use a simple disclosure or show the content directly",
|
|
226
|
-
"Do not hide critical actions or required form fields inside collapsed panels",
|
|
227
|
-
"Do not auto-collapse panels when the user scrolls — let the user control visibility",
|
|
228
|
-
"Do not use expand/collapse animations longer than 300ms — they feel sluggish",
|
|
229
|
-
"Do not override the chevron icon with unrelated iconography — keep the affordance clear",
|
|
230
|
-
"Do not remove focus indicators from the header trigger",
|
|
231
|
-
],
|
|
232
|
-
};
|