@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.
Files changed (286) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +327 -0
  3. package/bin/cli.js +859 -0
  4. package/design-bridge/.env.example +5 -0
  5. package/design-bridge/bridge.js +196 -0
  6. package/design-bridge/lib/assets.js +367 -0
  7. package/design-bridge/lib/prompt.js +85 -0
  8. package/design-bridge/lib/server.js +66 -0
  9. package/design-bridge/lib/stitch.js +37 -0
  10. package/design-bridge/lib/tokens.js +82 -0
  11. package/design-bridge/package-lock.json +579 -0
  12. package/design-bridge/package.json +19 -0
  13. package/figma-bridge-plugin/README.md +97 -0
  14. package/figma-bridge-plugin/anthropic-chat-runner.js +192 -0
  15. package/figma-bridge-plugin/bridge-relay.js +2363 -0
  16. package/figma-bridge-plugin/chat-runner.js +459 -0
  17. package/figma-bridge-plugin/code.js +1528 -0
  18. package/figma-bridge-plugin/codex-runner.js +505 -0
  19. package/figma-bridge-plugin/component-schemas.js +110 -0
  20. package/figma-bridge-plugin/content-context.js +869 -0
  21. package/figma-bridge-plugin/create-button.js +216 -0
  22. package/figma-bridge-plugin/gemini-cli-runner.js +291 -0
  23. package/figma-bridge-plugin/gemini-runner.js +187 -0
  24. package/figma-bridge-plugin/html-to-figma.js +927 -0
  25. package/figma-bridge-plugin/knowledge-hub/.gitkeep +0 -0
  26. package/figma-bridge-plugin/knowledge-hub/uspec-references/anatomy-spec.md +159 -0
  27. package/figma-bridge-plugin/knowledge-hub/uspec-references/api-spec.md +162 -0
  28. package/figma-bridge-plugin/knowledge-hub/uspec-references/color-spec.md +148 -0
  29. package/figma-bridge-plugin/knowledge-hub/uspec-references/full-spec-template.md +314 -0
  30. package/figma-bridge-plugin/knowledge-hub/uspec-references/property-spec.md +175 -0
  31. package/figma-bridge-plugin/knowledge-hub/uspec-references/screen-reader-spec.md +180 -0
  32. package/figma-bridge-plugin/knowledge-hub/uspec-references/structure-spec.md +165 -0
  33. package/figma-bridge-plugin/manifest.json +21 -0
  34. package/figma-bridge-plugin/package-lock.json +1936 -0
  35. package/figma-bridge-plugin/package.json +20 -0
  36. package/figma-bridge-plugin/perplexity-runner.js +188 -0
  37. package/figma-bridge-plugin/references/SKILL.md +178 -0
  38. package/figma-bridge-plugin/references/anatomy-spec.md +159 -0
  39. package/figma-bridge-plugin/references/api-spec.md +162 -0
  40. package/figma-bridge-plugin/references/color-spec.md +148 -0
  41. package/figma-bridge-plugin/references/full-spec-template.md +314 -0
  42. package/figma-bridge-plugin/references/property-spec.md +175 -0
  43. package/figma-bridge-plugin/references/screen-reader-spec.md +180 -0
  44. package/figma-bridge-plugin/references/structure-spec.md +165 -0
  45. package/figma-bridge-plugin/shared-prompt-config.js +604 -0
  46. package/figma-bridge-plugin/spec-helpers/build-table.js +269 -0
  47. package/figma-bridge-plugin/spec-helpers/classify-elements.js +189 -0
  48. package/figma-bridge-plugin/spec-helpers/index.js +35 -0
  49. package/figma-bridge-plugin/spec-helpers/parse-figma-link.js +49 -0
  50. package/figma-bridge-plugin/spec-helpers/position-markers.js +158 -0
  51. package/figma-bridge-plugin/stitch-auth.js +322 -0
  52. package/figma-bridge-plugin/stitch-runner.js +1427 -0
  53. package/figma-bridge-plugin/token-resolver.js +107 -0
  54. package/figma-bridge-plugin/ui.html +4467 -0
  55. package/figma-intelligence-layer/.env.example +39 -0
  56. package/figma-intelligence-layer/docs/local-image-generation.md +60 -0
  57. package/figma-intelligence-layer/examples/comfyui-workflow-template.example.json +101 -0
  58. package/figma-intelligence-layer/jest.config.js +14 -0
  59. package/figma-intelligence-layer/mcp-config.json +19 -0
  60. package/figma-intelligence-layer/package-lock.json +5892 -0
  61. package/figma-intelligence-layer/package.json +48 -0
  62. package/figma-intelligence-layer/scripts/setup-comfyui-local.sh +67 -0
  63. package/figma-intelligence-layer/scripts/start-comfyui.sh +33 -0
  64. package/figma-intelligence-layer/src/index.ts +2233 -0
  65. package/figma-intelligence-layer/src/shared/auto-layout-validator.ts +404 -0
  66. package/figma-intelligence-layer/src/shared/cache.ts +187 -0
  67. package/figma-intelligence-layer/src/shared/color-operations.ts +533 -0
  68. package/figma-intelligence-layer/src/shared/color-utils.ts +138 -0
  69. package/figma-intelligence-layer/src/shared/component-script-builder.ts +413 -0
  70. package/figma-intelligence-layer/src/shared/component-templates.ts +2767 -0
  71. package/figma-intelligence-layer/src/shared/concept-taxonomy.ts +694 -0
  72. package/figma-intelligence-layer/src/shared/decision-log.ts +128 -0
  73. package/figma-intelligence-layer/src/shared/design-system-context.ts +568 -0
  74. package/figma-intelligence-layer/src/shared/design-system-intelligence.ts +131 -0
  75. package/figma-intelligence-layer/src/shared/design-system-matcher.ts +184 -0
  76. package/figma-intelligence-layer/src/shared/design-system-normalizers.ts +196 -0
  77. package/figma-intelligence-layer/src/shared/design-system-tokens.ts +295 -0
  78. package/figma-intelligence-layer/src/shared/dtcg-validator.ts +530 -0
  79. package/figma-intelligence-layer/src/shared/enrichment-pipeline.ts +671 -0
  80. package/figma-intelligence-layer/src/shared/figma-bridge.ts +1408 -0
  81. package/figma-intelligence-layer/src/shared/font-config.ts +126 -0
  82. package/figma-intelligence-layer/src/shared/icon-catalog.ts +360 -0
  83. package/figma-intelligence-layer/src/shared/icon-fetch.ts +80 -0
  84. package/figma-intelligence-layer/src/shared/prototype-script-builder.ts +162 -0
  85. package/figma-intelligence-layer/src/shared/response-compression.ts +440 -0
  86. package/figma-intelligence-layer/src/shared/semantic-token-catalog.ts +324 -0
  87. package/figma-intelligence-layer/src/shared/token-binder.ts +505 -0
  88. package/figma-intelligence-layer/src/shared/token-math.ts +427 -0
  89. package/figma-intelligence-layer/src/shared/token-naming.ts +468 -0
  90. package/figma-intelligence-layer/src/shared/token-utils.ts +420 -0
  91. package/figma-intelligence-layer/src/shared/types.ts +346 -0
  92. package/figma-intelligence-layer/src/shared/typography-presets.ts +94 -0
  93. package/figma-intelligence-layer/src/shared/unsplash.ts +165 -0
  94. package/figma-intelligence-layer/src/shared/vision-client.ts +607 -0
  95. package/figma-intelligence-layer/src/shared/vision-provider-anthropic.ts +334 -0
  96. package/figma-intelligence-layer/src/shared/vision-provider-openai.ts +446 -0
  97. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-handler.ts +782 -0
  98. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-renderer.ts +496 -0
  99. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotation-kit.ts +230 -0
  100. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/colorblind-sim.ts +66 -0
  101. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/index.ts +810 -0
  102. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-analyzer.ts +1191 -0
  103. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-figma-page.ts +1346 -0
  104. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.ts +148 -0
  105. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-figma-page.ts +499 -0
  106. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-report.ts +910 -0
  107. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-checker.ts +989 -0
  108. package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-criteria.ts +1160 -0
  109. package/figma-intelligence-layer/src/tools/phase1-vision/design-from-ref/index.ts +424 -0
  110. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/component-recognizer.ts +38 -0
  111. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/ds-matcher.ts +111 -0
  112. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/font-matcher.ts +114 -0
  113. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/icon-resolver.ts +103 -0
  114. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/index.ts +1060 -0
  115. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/layout-segmenter.ts +18 -0
  116. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/token-inferencer.ts +39 -0
  117. package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/vision-pipeline.ts +58 -0
  118. package/figma-intelligence-layer/src/tools/phase1-vision/sketch-to-design/index.ts +298 -0
  119. package/figma-intelligence-layer/src/tools/phase1-vision/visual-audit/index.ts +197 -0
  120. package/figma-intelligence-layer/src/tools/phase2-accuracy/component-audit/index.ts +494 -0
  121. package/figma-intelligence-layer/src/tools/phase2-accuracy/intent-translator/index.ts +356 -0
  122. package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/container-patterns.ts +123 -0
  123. package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/index.ts +663 -0
  124. package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/built-in-rules.yaml +56 -0
  125. package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/index.ts +614 -0
  126. package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/rule-engine.ts +113 -0
  127. package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/color-theory.ts +178 -0
  128. package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/index.ts +470 -0
  129. package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/index.ts +429 -0
  130. package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/token-override-maps.ts +226 -0
  131. package/figma-intelligence-layer/src/tools/phase3-generation/ai-image-insert/index.ts +535 -0
  132. package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/index.ts +660 -0
  133. package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/pattern-fingerprints.ts +209 -0
  134. package/figma-intelligence-layer/src/tools/phase3-generation/composition-builder/index.ts +540 -0
  135. package/figma-intelligence-layer/src/tools/phase3-generation/figma-animated-build.ts +391 -0
  136. package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/index.ts +2019 -0
  137. package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/screen-templates.ts +131 -0
  138. package/figma-intelligence-layer/src/tools/phase3-generation/prototype-map/index.ts +381 -0
  139. package/figma-intelligence-layer/src/tools/phase3-generation/prototype-wire/index.ts +565 -0
  140. package/figma-intelligence-layer/src/tools/phase3-generation/swarm-build/index.ts +764 -0
  141. package/figma-intelligence-layer/src/tools/phase3-generation/system-drift/index.ts +535 -0
  142. package/figma-intelligence-layer/src/tools/phase3-generation/unsplash-search/index.ts +84 -0
  143. package/figma-intelligence-layer/src/tools/phase3-generation/url-to-frame/index.ts +401 -0
  144. package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/css-animations.ts +68 -0
  145. package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/framer-motion.ts +78 -0
  146. package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/swift-animations.ts +93 -0
  147. package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/index.ts +596 -0
  148. package/figma-intelligence-layer/src/tools/phase4-sync/ci-check/index.ts +462 -0
  149. package/figma-intelligence-layer/src/tools/phase4-sync/export-tokens/index.ts +1470 -0
  150. package/figma-intelligence-layer/src/tools/phase4-sync/generate-component-code/index.ts +829 -0
  151. package/figma-intelligence-layer/src/tools/phase4-sync/handoff-spec/index.ts +702 -0
  152. package/figma-intelligence-layer/src/tools/phase4-sync/icon-library-sync/index.ts +483 -0
  153. package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/index.ts +501 -0
  154. package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/storybook-parser.ts +106 -0
  155. package/figma-intelligence-layer/src/tools/phase4-sync/watch-docs/index.ts +676 -0
  156. package/figma-intelligence-layer/src/tools/phase4-sync/webhook-listener/index.ts +560 -0
  157. package/figma-intelligence-layer/src/tools/phase5-governance/apg-doc/index.ts +1043 -0
  158. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/component-detection.ts +620 -0
  159. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/anatomy.ts +331 -0
  160. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/color-tokens.ts +77 -0
  161. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/properties.ts +54 -0
  162. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/snapshot.ts +287 -0
  163. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/spacing.ts +71 -0
  164. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/states.ts +43 -0
  165. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/typography.ts +71 -0
  166. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/index.ts +221 -0
  167. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts +166 -0
  168. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts +232 -0
  169. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/alert.ts +234 -0
  170. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar-group.ts +270 -0
  171. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar.ts +249 -0
  172. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/badge.ts +231 -0
  173. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/banner.ts +293 -0
  174. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/breadcrumb.ts +240 -0
  175. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/button.ts +243 -0
  176. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/calendar.ts +307 -0
  177. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/card.ts +143 -0
  178. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/checkbox.ts +227 -0
  179. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/chip.ts +233 -0
  180. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/combobox.ts +282 -0
  181. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/datepicker.ts +276 -0
  182. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/divider.ts +223 -0
  183. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/drawer.ts +255 -0
  184. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/dropdown-menu.ts +289 -0
  185. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/empty-state.ts +261 -0
  186. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/file-uploader.ts +290 -0
  187. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts +265 -0
  188. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/grid.ts +238 -0
  189. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/icon.ts +255 -0
  190. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts +128 -0
  191. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-edit.ts +286 -0
  192. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-message.ts +255 -0
  193. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/input.ts +330 -0
  194. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/link.ts +247 -0
  195. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/list.ts +250 -0
  196. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/menu.ts +247 -0
  197. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/modal.ts +144 -0
  198. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navbar.ts +264 -0
  199. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navigation.ts +251 -0
  200. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/number-input.ts +261 -0
  201. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/pagination.ts +248 -0
  202. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/popover.ts +270 -0
  203. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/progress.ts +251 -0
  204. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/radio.ts +142 -0
  205. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/range-slider.ts +282 -0
  206. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts +250 -0
  207. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts +258 -0
  208. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/segmented-control.ts +265 -0
  209. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/select.ts +319 -0
  210. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/skeleton.ts +256 -0
  211. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/slider.ts +232 -0
  212. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/spinner.ts +239 -0
  213. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/status-dot.ts +252 -0
  214. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/stepper.ts +270 -0
  215. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/table.ts +244 -0
  216. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tabs.ts +143 -0
  217. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tag.ts +243 -0
  218. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/textarea.ts +259 -0
  219. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts +293 -0
  220. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts +144 -0
  221. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toggle.ts +289 -0
  222. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toolbar.ts +267 -0
  223. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tooltip.ts +232 -0
  224. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/treeview.ts +257 -0
  225. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/typography.ts +319 -0
  226. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/legacy-compat.ts +121 -0
  227. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/anatomy-diagram.ts +430 -0
  228. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/figma-page.ts +312 -0
  229. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/json.ts +129 -0
  230. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/markdown.ts +78 -0
  231. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/visual-doc.ts +2333 -0
  232. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/accessibility.ts +100 -0
  233. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/anatomy.ts +32 -0
  234. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/color-tokens.ts +59 -0
  235. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/content-guidance.ts +18 -0
  236. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/design-tokens.ts +53 -0
  237. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/interaction-rules.ts +19 -0
  238. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/overview.ts +91 -0
  239. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/properties-api.ts +71 -0
  240. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/qa-criteria.ts +19 -0
  241. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/related-components.ts +110 -0
  242. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/responsive.ts +19 -0
  243. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/size-specs.ts +67 -0
  244. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/spacing-structure.ts +58 -0
  245. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/state-specs.ts +79 -0
  246. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/states.ts +50 -0
  247. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/type-hierarchy.ts +33 -0
  248. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/typography.ts +55 -0
  249. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/usage-guidelines.ts +73 -0
  250. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/variants.ts +81 -0
  251. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/types.ts +409 -0
  252. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/index.ts +198 -0
  253. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/renderer.ts +701 -0
  254. package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/types.ts +88 -0
  255. package/figma-intelligence-layer/src/tools/phase5-governance/decision-log/index.ts +135 -0
  256. package/figma-intelligence-layer/src/tools/phase5-governance/design-decision-log/index.ts +491 -0
  257. package/figma-intelligence-layer/src/tools/phase5-governance/ds-primitives/index.ts +416 -0
  258. package/figma-intelligence-layer/src/tools/phase5-governance/ds-scaffolder/index.ts +722 -0
  259. package/figma-intelligence-layer/src/tools/phase5-governance/ds-variables/index.ts +449 -0
  260. package/figma-intelligence-layer/src/tools/phase5-governance/health-report/index.ts +393 -0
  261. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/index.ts +406 -0
  262. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/figma-page.ts +292 -0
  263. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/json.ts +24 -0
  264. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/markdown.ts +172 -0
  265. package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/naming-guide.ts +409 -0
  266. package/figma-intelligence-layer/src/tools/phase5-governance/token-analytics/index.ts +594 -0
  267. package/figma-intelligence-layer/src/tools/phase5-governance/token-docs/index.ts +710 -0
  268. package/figma-intelligence-layer/src/tools/phase5-governance/token-migrate/index.ts +458 -0
  269. package/figma-intelligence-layer/src/tools/phase5-governance/token-naming/index.ts +134 -0
  270. package/figma-intelligence-layer/tests/apg-doc.test.ts +101 -0
  271. package/figma-intelligence-layer/tests/design-system-context.test.ts +152 -0
  272. package/figma-intelligence-layer/tests/design-system-matcher.test.ts +144 -0
  273. package/figma-intelligence-layer/tests/figma-bridge.test.ts +83 -0
  274. package/figma-intelligence-layer/tests/generate-image-and-insert.test.ts +56 -0
  275. package/figma-intelligence-layer/tests/screen-cloner-regression.test.ts +69 -0
  276. package/figma-intelligence-layer/tests/smoke.test.ts +174 -0
  277. package/figma-intelligence-layer/tests/spec-generator.test.ts +127 -0
  278. package/figma-intelligence-layer/tests/token-migrate.test.ts +21 -0
  279. package/figma-intelligence-layer/tests/token-naming.test.ts +30 -0
  280. package/figma-intelligence-layer/tsconfig.json +19 -0
  281. package/package.json +35 -0
  282. package/scripts/clean-existing-chunks.js +179 -0
  283. package/scripts/connect-ai-tool.js +490 -0
  284. package/scripts/convert-hub-pdfs.js +425 -0
  285. package/scripts/figma-mcp-status.js +349 -0
  286. package/scripts/register-codex-mcp.js +96 -0
@@ -0,0 +1,289 @@
1
+ /**
2
+ * dropdown-menu.ts — Gold-standard design knowledge for Dropdown Menu components
3
+ */
4
+ import type { ComponentKnowledge } from "../types.js";
5
+
6
+ export const dropdownMenuKnowledge: ComponentKnowledge = {
7
+ description:
8
+ "Button-triggered action menu | Displays a list of actions or options | Primary command palette for contextual operations",
9
+
10
+ stateSpecifications: [
11
+ {
12
+ state: "Closed",
13
+ visualChange: "Menu panel is hidden; trigger button appears in its default resting state",
14
+ opacity: "0",
15
+ cursorWeb: "pointer",
16
+ usage: "Default state — menu is not visible and the trigger button awaits interaction",
17
+ },
18
+ {
19
+ state: "Open",
20
+ visualChange: "Menu panel drops down from the trigger with a subtle entry animation; trigger button shows active/pressed styling",
21
+ opacity: "1",
22
+ cursorWeb: "default",
23
+ usage: "User has clicked the trigger button and the menu items are displayed for selection",
24
+ },
25
+ {
26
+ state: "Item Hover",
27
+ visualChange: "Hovered menu item receives a highlighted background fill; text color may shift for contrast",
28
+ opacity: "1",
29
+ cursorWeb: "pointer",
30
+ usage: "Mouse cursor enters a menu item's hit area; provides visual feedback before selection",
31
+ },
32
+ {
33
+ state: "Item Focus",
34
+ visualChange: "Focused menu item receives the same highlight as hover plus a focus ring indicator",
35
+ opacity: "1",
36
+ cursorWeb: "pointer",
37
+ usage: "Keyboard navigation (arrow keys) has moved focus to this menu item",
38
+ },
39
+ {
40
+ state: "Item Active",
41
+ visualChange: "Menu item background darkens one additional step to indicate press; subtle scale-down feedback",
42
+ opacity: "1",
43
+ cursorWeb: "pointer",
44
+ usage: "User is pressing down on a menu item before releasing to confirm selection",
45
+ },
46
+ {
47
+ state: "Item Disabled",
48
+ visualChange: "Menu item text and icon switch to muted/disabled tokens; no hover or focus highlight",
49
+ opacity: "0.4",
50
+ cursorWeb: "not-allowed",
51
+ usage: "Action is unavailable due to permissions, prerequisites, or current context",
52
+ },
53
+ {
54
+ state: "Trigger Focused",
55
+ visualChange: "2px focus ring offset by 2px from the trigger button edge, using $focus-ring token",
56
+ opacity: "1",
57
+ cursorWeb: "pointer",
58
+ usage: "Trigger button receives keyboard focus via Tab key navigation",
59
+ },
60
+ ],
61
+
62
+ propertyDescriptions: {
63
+ trigger: "The button element that opens the menu on click; typically renders with a chevron-down icon indicating expandability",
64
+ items: "Array of menu item objects, each containing label, optional icon, optional shortcut hint, disabled flag, and onClick handler",
65
+ placement: "Preferred position of the menu relative to its trigger — bottom-start, bottom-end, top-start, or top-end",
66
+ alignment: "Horizontal alignment of the menu panel relative to the trigger — 'start' aligns left edges, 'end' aligns right edges",
67
+ size: "Dimensional preset controlling item height, padding, and font size (Small, Medium, Large)",
68
+ closeOnSelect: "When true the menu closes automatically after an item is selected; default is true",
69
+ dividers: "Array of indices after which a visual separator/divider line is rendered between menu item groups",
70
+ groups: "Named groups of menu items rendered with a group label header and optional divider below",
71
+ maxHeight: "Maximum height of the menu panel before overflow scrolling activates; default is 300px",
72
+ onOpenChange: "Callback fired when the menu opens or closes; receives the new boolean open state",
73
+ disabled: "When true the trigger button is non-interactive: muted visuals, pointer-events none, aria-disabled='true'",
74
+ typeAhead: "When true, typing characters while the menu is open moves focus to matching items by label prefix",
75
+ },
76
+
77
+ sizeSpecifications: [
78
+ {
79
+ size: "Small",
80
+ height: "28px (per item)",
81
+ paddingLR: "8px",
82
+ fontSize: "12px",
83
+ iconSize: "16px",
84
+ borderRadius: "6px",
85
+ },
86
+ {
87
+ size: "Medium",
88
+ height: "36px (per item)",
89
+ paddingLR: "12px",
90
+ fontSize: "14px",
91
+ iconSize: "20px",
92
+ borderRadius: "8px",
93
+ },
94
+ {
95
+ size: "Large",
96
+ height: "44px (per item)",
97
+ paddingLR: "16px",
98
+ fontSize: "16px",
99
+ iconSize: "24px",
100
+ borderRadius: "10px",
101
+ },
102
+ ],
103
+
104
+ designTokenBindings: [
105
+ {
106
+ property: "Panel Background",
107
+ tokenName: "$menu-bg",
108
+ role: "Menu panel surface color elevated above the page",
109
+ fallback: "#FFFFFF",
110
+ },
111
+ {
112
+ property: "Panel Border",
113
+ tokenName: "$menu-border",
114
+ role: "Subtle border on the menu panel for definition against the page surface",
115
+ fallback: "#E5E7EB",
116
+ },
117
+ {
118
+ property: "Panel Shadow",
119
+ tokenName: "$shadow-menu",
120
+ role: "Elevation shadow giving the menu a floating appearance",
121
+ fallback: "0 4px 12px rgba(0,0,0,0.1)",
122
+ },
123
+ {
124
+ property: "Item Text",
125
+ tokenName: "$menu-item-text",
126
+ role: "Default text color for menu item labels",
127
+ fallback: "#1F2937",
128
+ },
129
+ {
130
+ property: "Item Icon",
131
+ tokenName: "$menu-item-icon",
132
+ role: "Default icon color for leading icons in menu items",
133
+ fallback: "#6B7280",
134
+ },
135
+ {
136
+ property: "Item Hover Background",
137
+ tokenName: "$menu-item-hover-bg",
138
+ role: "Background fill on menu item hover and keyboard focus",
139
+ fallback: "#F3F4F6",
140
+ },
141
+ {
142
+ property: "Item Active Background",
143
+ tokenName: "$menu-item-active-bg",
144
+ role: "Background fill on menu item press/active state",
145
+ fallback: "#E5E7EB",
146
+ },
147
+ {
148
+ property: "Item Disabled Text",
149
+ tokenName: "$menu-item-disabled-text",
150
+ role: "Muted text color for disabled menu items",
151
+ fallback: "#9CA3AF",
152
+ },
153
+ {
154
+ property: "Divider",
155
+ tokenName: "$menu-divider",
156
+ role: "Color for horizontal divider lines between item groups",
157
+ fallback: "#E5E7EB",
158
+ },
159
+ {
160
+ property: "Radius",
161
+ tokenName: "$radius-menu",
162
+ role: "Corner rounding applied to the menu panel",
163
+ fallback: "8px",
164
+ },
165
+ {
166
+ property: "Shortcut Text",
167
+ tokenName: "$menu-shortcut-text",
168
+ role: "Muted color for keyboard shortcut hints displayed alongside item labels",
169
+ fallback: "#9CA3AF",
170
+ },
171
+ {
172
+ property: "Focus Ring",
173
+ tokenName: "$focus-ring",
174
+ role: "Keyboard focus indicator ring for trigger and menu items",
175
+ fallback: "0 0 0 2px #FFFFFF, 0 0 0 4px #2E90FA",
176
+ },
177
+ ],
178
+
179
+ structureRules: [
180
+ "Dropdown menu consists of a trigger button and a floating menu panel rendered via a portal",
181
+ "Menu panel uses vertical Auto Layout with no gap — items stack edge-to-edge with internal padding",
182
+ "Each menu item is a horizontal Auto Layout row: optional leading icon, label text, spacer, optional shortcut hint, optional trailing icon",
183
+ "Dividers are 1px horizontal lines spanning the full width of the panel with vertical margin of 4px",
184
+ "Group headers are non-interactive label rows rendered in a smaller, muted font above their group items",
185
+ "Panel maximum height triggers vertical scrolling with a subtle scroll indicator at the overflow edge",
186
+ "Trigger button follows standard button structure with an appended chevron-down icon to signal expandability",
187
+ "Menu items have a minimum width matching the trigger button width; panel may be wider if items require it",
188
+ ],
189
+
190
+ typeHierarchyRules: [
191
+ "Menu item labels use font-weight Regular (400) at the size-appropriate font scale",
192
+ "Group header labels use font-weight Semi-Bold (600) at one step smaller than item labels",
193
+ "Keyboard shortcut hints use font-weight Regular (400) in monospace or the system UI font at a muted color",
194
+ "Text uses sentence case — 'Edit item', not 'Edit Item' or 'EDIT ITEM'",
195
+ "Destructive items (e.g., 'Delete') use $danger-text token color to signal risk",
196
+ ],
197
+
198
+ interactionRules: [
199
+ { event: "Click Trigger", trigger: "pointerup on trigger button", action: "Toggle menu open/closed; if opening, focus first non-disabled item" },
200
+ { event: "Arrow Down", trigger: "ArrowDown key while menu is open", action: "Move focus to the next non-disabled menu item; wrap to first item at end" },
201
+ { event: "Arrow Up", trigger: "ArrowUp key while menu is open", action: "Move focus to the previous non-disabled menu item; wrap to last item at start" },
202
+ { event: "Enter / Space", trigger: "Enter or Space on a focused menu item", action: "Select the item, fire its onClick handler, and close the menu if closeOnSelect is true" },
203
+ { event: "Escape", trigger: "Escape key while menu is open", action: "Close the menu and return focus to the trigger button" },
204
+ { event: "Tab", trigger: "Tab key while menu is open", action: "Close the menu and move focus to the next focusable element on the page" },
205
+ { event: "Type-Ahead", trigger: "Printable character typed while menu is open", action: "Move focus to the first item whose label starts with the typed character(s)" },
206
+ { event: "Click Outside", trigger: "pointerdown outside menu panel and trigger", action: "Close the menu without selecting any item" },
207
+ { event: "Hover Item", trigger: "pointerenter on a menu item", action: "Highlight the item and move roving focus to it" },
208
+ { event: "Home Key", trigger: "Home key while menu is open", action: "Move focus to the first non-disabled menu item" },
209
+ { event: "End Key", trigger: "End key while menu is open", action: "Move focus to the last non-disabled menu item" },
210
+ ],
211
+
212
+ contentGuidance: [
213
+ "Menu item labels should be concise action verbs or short verb phrases: 'Edit', 'Duplicate', 'Move to trash'",
214
+ "Group related actions together and separate groups with dividers for scannability",
215
+ "Place destructive actions (Delete, Remove) at the bottom of the menu, visually separated by a divider",
216
+ "Include keyboard shortcut hints alongside frequently used items to educate users about hotkeys",
217
+ "Leading icons should be consistent in style — do not mix filled and outlined icons in the same menu",
218
+ "Limit menu items to 8-10 maximum per menu; if more actions are needed, consider sub-menus or a command palette",
219
+ "Disabled items should remain visible with reduced opacity to indicate the action exists but is currently unavailable",
220
+ "Dropdown Menu is similar to Menu but is always attached to a specific trigger button; standalone menus use the Menu component",
221
+ ],
222
+
223
+ responsiveBehaviour: [
224
+ { breakpoint: "Mobile (<768px)", behavior: "Menu may convert to a bottom action sheet with larger touch targets (48px item height minimum)" },
225
+ { breakpoint: "Tablet (768-1023px)", behavior: "Standard floating menu with auto placement; panel width adjusts to content" },
226
+ { breakpoint: "Desktop (1024-1439px)", behavior: "Floating menu panel positioned below the trigger with standard offset" },
227
+ { breakpoint: "Ultra-wide (>=1440px)", behavior: "Menu panel size remains capped — does not scale with viewport width" },
228
+ ],
229
+
230
+ accessibilitySpec: {
231
+ intro:
232
+ "Dropdown menus implement the ARIA menu pattern and must support full keyboard navigation including arrow keys, type-ahead, and Escape dismissal.",
233
+ requirements: [
234
+ { requirement: "ARIA Role (Panel)", level: "A", notes: "Menu panel must use role='menu'; each item uses role='menuitem'" },
235
+ { requirement: "ARIA Expanded", level: "A", notes: "Trigger button sets aria-expanded='true' when menu is open, 'false' when closed" },
236
+ { requirement: "ARIA Has Popup", level: "A", notes: "Trigger button must include aria-haspopup='menu' to announce menu availability" },
237
+ { requirement: "ARIA Controls", level: "A", notes: "Trigger must reference the menu panel id via aria-controls" },
238
+ { requirement: "ARIA Disabled", level: "A", notes: "Disabled menu items use aria-disabled='true' and are skipped by arrow key navigation" },
239
+ { requirement: "Keyboard Arrow Navigation", level: "A", notes: "ArrowUp/ArrowDown moves focus between menu items; Home/End jumps to first/last" },
240
+ { requirement: "Type-Ahead Search", level: "AA", notes: "Typing characters moves focus to matching items by label prefix for efficient navigation" },
241
+ { requirement: "Escape Dismissal", level: "A", notes: "Escape key closes the menu and returns focus to the trigger button" },
242
+ { requirement: "Contrast Ratio", level: "AA", notes: "All menu item text meets 4.5:1 contrast against panel background; disabled text meets 3:1" },
243
+ { requirement: "Touch Target", level: "AA", notes: "Trigger and each menu item must have a 44x44px minimum touch area" },
244
+ { requirement: "Focus Management", level: "A", notes: "Opening the menu moves focus to the first item; closing returns focus to the trigger" },
245
+ ],
246
+ outro: [
247
+ "Test arrow key navigation with NVDA, VoiceOver, and JAWS to ensure each menu item is announced correctly",
248
+ "Verify that disabled items are announced as 'dimmed' or 'unavailable' by screen readers",
249
+ "Ensure type-ahead works with accented characters and does not conflict with global keyboard shortcuts",
250
+ ],
251
+ },
252
+
253
+ qaAcceptanceCriteria: [
254
+ { check: "Open on Click", platform: "Web", expectedResult: "Menu panel appears below trigger on click with correct alignment" },
255
+ { check: "Close on Select", platform: "Web", expectedResult: "Menu closes after item selection and fires the item's onClick handler" },
256
+ { check: "Close on Escape", platform: "Web", expectedResult: "Menu closes on Escape key; focus returns to trigger button" },
257
+ { check: "Close on Click Outside", platform: "Web", expectedResult: "Menu dismisses when clicking outside the panel" },
258
+ { check: "Arrow Key Navigation", platform: "Web", expectedResult: "ArrowDown/ArrowUp moves focus through items; wraps at boundaries" },
259
+ { check: "Disabled Item Skip", platform: "Web", expectedResult: "Arrow keys skip disabled items; disabled items show muted styling" },
260
+ { check: "Type-Ahead", platform: "Web", expectedResult: "Typing 'd' focuses the first item starting with 'D'" },
261
+ { check: "Dividers", platform: "Web", expectedResult: "Dividers render as 1px lines between item groups; not focusable" },
262
+ { check: "Screen Reader", platform: "Web", expectedResult: "Announces role='menu', item count, and current item on focus" },
263
+ { check: "Shortcut Hints", platform: "Web", expectedResult: "Keyboard shortcuts are displayed right-aligned and announced by screen readers" },
264
+ { check: "RTL Support", platform: "Web", expectedResult: "Menu alignment mirrors; icons and shortcuts swap sides in RTL locales" },
265
+ { check: "Mobile Adaptation", platform: "Mobile", expectedResult: "Converts to bottom action sheet below 768px with swipe-to-dismiss" },
266
+ { check: "Contrast", platform: "All", expectedResult: "All item text passes 4.5:1 contrast; disabled items pass 3:1 minimum" },
267
+ { check: "Visual Regression", platform: "All", expectedResult: "Menu renders pixel-perfect against baseline for each size and state" },
268
+ ],
269
+
270
+ dos: [
271
+ "Use a dropdown menu for a set of contextual actions triggered from a single button",
272
+ "Include a visual chevron or arrow icon on the trigger to indicate expandability",
273
+ "Group related actions together and separate groups with dividers for quick scanning",
274
+ "Implement full keyboard navigation including arrow keys, Home/End, and type-ahead",
275
+ "Place destructive actions last in the menu, visually distinguished with danger color tokens",
276
+ "Include keyboard shortcut hints to help power users learn hotkeys over time",
277
+ "Maintain consistent item heights and padding across all menu items within the same menu",
278
+ ],
279
+
280
+ donts: [
281
+ "Do not use a dropdown menu for navigation — use a Navigation Menu or link list instead",
282
+ "Do not open the menu on hover — hover-triggered menus cause accessibility and usability issues",
283
+ "Do not place more than 10 items in a single menu level — consider sub-menus or a command palette",
284
+ "Do not mix different item heights or icon sizes within the same menu",
285
+ "Do not remove Escape key dismissal — it is a WCAG requirement for menu patterns",
286
+ "Do not hide the trigger's expandability indicator (chevron) — users need to know it opens a menu",
287
+ "Do not use a dropdown menu for single-selection from options — use a Select component instead",
288
+ ],
289
+ };
@@ -0,0 +1,261 @@
1
+ /**
2
+ * empty-state.ts — Gold-standard design knowledge for Empty State components
3
+ */
4
+ import type { ComponentKnowledge } from "../types.js";
5
+
6
+ export const emptyStateKnowledge: ComponentKnowledge = {
7
+ description:
8
+ "Placeholder for zero-data views | Guides users toward their first action | Displays illustration, message, and CTA",
9
+
10
+ stateSpecifications: [
11
+ {
12
+ state: "Default",
13
+ visualChange: "Centered layout with illustration, heading, description text, and action button(s); all elements at full opacity",
14
+ opacity: "1",
15
+ cursorWeb: "default",
16
+ usage: "Primary state — displayed when a data list, table, or content area has no items to show",
17
+ },
18
+ {
19
+ state: "Action Hover",
20
+ visualChange: "Primary action button transitions to its hover state (darker background); secondary action shows underline or fill change",
21
+ opacity: "1",
22
+ cursorWeb: "pointer",
23
+ usage: "Mouse cursor enters the action button within the empty state — standard button hover behavior applies",
24
+ },
25
+ {
26
+ state: "Action Focus",
27
+ visualChange: "Action button receives a 2px focus ring offset by 2px using $focus-ring token",
28
+ opacity: "1",
29
+ cursorWeb: "pointer",
30
+ usage: "Action button receives keyboard focus via Tab key",
31
+ },
32
+ {
33
+ state: "Action Active",
34
+ visualChange: "Action button background darkens one additional step with subtle scale-down (0.98) for tactile feedback",
35
+ opacity: "1",
36
+ cursorWeb: "pointer",
37
+ usage: "User is pressing down on the action button before releasing",
38
+ },
39
+ {
40
+ state: "Loading",
41
+ visualChange: "Skeleton versions of heading and description pulse; illustration may show a simplified placeholder",
42
+ opacity: "0.6",
43
+ cursorWeb: "default",
44
+ usage: "The system is determining whether data exists — skeleton previews the eventual empty state layout",
45
+ },
46
+ {
47
+ state: "Error",
48
+ visualChange: "Illustration switches to an error graphic; heading and description communicate the failure; retry action is prominent",
49
+ opacity: "1",
50
+ cursorWeb: "default",
51
+ usage: "Data failed to load — the empty state communicates the error and provides a retry action",
52
+ },
53
+ ],
54
+
55
+ propertyDescriptions: {
56
+ illustration: "Optional visual element rendered above the heading — can be an SVG illustration, Lottie animation, or icon component",
57
+ heading: "Primary heading text that describes the empty state context — e.g., 'No projects yet' or 'Inbox is empty'",
58
+ description: "Supporting body text providing additional context and guidance — explains why the state is empty and what to do next",
59
+ primaryAction: "Main call-to-action button that initiates the first action — e.g., 'Create project', 'Upload file'",
60
+ secondaryAction: "Optional secondary action rendered below or beside the primary action — e.g., 'Learn more', 'Import data'",
61
+ size: "Layout preset controlling the overall dimensions and spacing — compact (200px), default (320px), or full (480px)",
62
+ alignment: "Horizontal alignment of the empty state content — center (default), left, or right",
63
+ illustrationSize: "Dimension override for the illustration — small (80px), medium (120px), or large (160px)",
64
+ variant: "Visual variant for different contexts — 'empty' (no data), 'search' (no results), 'error' (load failure), 'permission' (access denied)",
65
+ fullPage: "When true the empty state expands to fill the full viewport height, vertically centering all content",
66
+ },
67
+
68
+ sizeSpecifications: [
69
+ {
70
+ size: "Compact",
71
+ height: "200px (min)",
72
+ paddingLR: "16px",
73
+ fontSize: "14px (heading)",
74
+ iconSize: "48px (illustration)",
75
+ borderRadius: "0px",
76
+ },
77
+ {
78
+ size: "Default",
79
+ height: "320px (min)",
80
+ paddingLR: "24px",
81
+ fontSize: "18px (heading)",
82
+ iconSize: "80px (illustration)",
83
+ borderRadius: "0px",
84
+ },
85
+ {
86
+ size: "Full",
87
+ height: "480px (min)",
88
+ paddingLR: "32px",
89
+ fontSize: "24px (heading)",
90
+ iconSize: "120px (illustration)",
91
+ borderRadius: "0px",
92
+ },
93
+ ],
94
+
95
+ designTokenBindings: [
96
+ {
97
+ property: "Heading Color",
98
+ tokenName: "$empty-state-heading",
99
+ role: "Text color for the primary heading within the empty state",
100
+ fallback: "#1F2937",
101
+ },
102
+ {
103
+ property: "Description Color",
104
+ tokenName: "$empty-state-description",
105
+ role: "Muted text color for the supporting description paragraph",
106
+ fallback: "#6B7280",
107
+ },
108
+ {
109
+ property: "Illustration Color",
110
+ tokenName: "$empty-state-illustration",
111
+ role: "Primary color for monochrome illustrations or icon tint",
112
+ fallback: "#D1D5DB",
113
+ },
114
+ {
115
+ property: "Background",
116
+ tokenName: "$empty-state-bg",
117
+ role: "Optional background fill for the empty state container — often transparent to inherit parent surface",
118
+ fallback: "transparent",
119
+ },
120
+ {
121
+ property: "Primary Action BG",
122
+ tokenName: "$button-primary-bg",
123
+ role: "Background fill for the primary action button following standard button tokens",
124
+ fallback: "#2563EB",
125
+ },
126
+ {
127
+ property: "Primary Action Text",
128
+ tokenName: "$button-primary-text",
129
+ role: "Text color for the primary action button label",
130
+ fallback: "#FFFFFF",
131
+ },
132
+ {
133
+ property: "Secondary Action Text",
134
+ tokenName: "$button-tertiary-text",
135
+ role: "Text color for the secondary action link or tertiary button",
136
+ fallback: "#2563EB",
137
+ },
138
+ {
139
+ property: "Spacing Stack",
140
+ tokenName: "$spacing-lg",
141
+ role: "Vertical spacing between illustration, heading, description, and action elements",
142
+ fallback: "24px",
143
+ },
144
+ {
145
+ property: "Focus Ring",
146
+ tokenName: "$focus-ring",
147
+ role: "Keyboard focus indicator ring for the action button(s)",
148
+ fallback: "0 0 0 2px #FFFFFF, 0 0 0 4px #2E90FA",
149
+ },
150
+ {
151
+ property: "Skeleton Pulse",
152
+ tokenName: "$skeleton-pulse",
153
+ role: "Animation for skeleton loading state placeholders",
154
+ fallback: "pulse 1.5s ease-in-out infinite",
155
+ },
156
+ ],
157
+
158
+ structureRules: [
159
+ "Empty state uses vertical Auto Layout with center alignment on both axes",
160
+ "Element stacking order top-to-bottom: illustration, heading, description, action group",
161
+ "Action group uses horizontal Auto Layout with center alignment for primary + secondary buttons side by side",
162
+ "On compact size, action buttons may stack vertically if horizontal space is insufficient",
163
+ "Illustration is constrained to a maximum width/height matching the illustrationSize preset — preserves aspect ratio",
164
+ "The entire empty state block centers within its parent container — both horizontally and vertically when fullPage is true",
165
+ "Text content has a maxWidth of 480px to maintain comfortable reading line lengths regardless of container width",
166
+ "Spacing between elements follows the spacing token scale: illustration-to-heading uses $spacing-md, heading-to-description uses $spacing-sm, description-to-actions uses $spacing-lg",
167
+ "The container has no visible borders or background by default — it is a transparent compositional element",
168
+ ],
169
+
170
+ typeHierarchyRules: [
171
+ "Heading uses font-weight Semi-Bold (600) at the size-appropriate heading scale (14px compact, 18px default, 24px full)",
172
+ "Description uses font-weight Regular (400) at one step below the heading size with comfortable line height (1.5)",
173
+ "Action button labels follow standard button typography rules — Medium (500) weight, sentence case",
174
+ "Heading uses sentence case — 'No projects yet', not 'No Projects Yet'",
175
+ "Description may span 2-3 lines maximum — keep guidance concise and actionable",
176
+ ],
177
+
178
+ interactionRules: [
179
+ { event: "Click Primary Action", trigger: "pointerup on primary action button", action: "Fire the primaryAction onClick handler; typically navigates to creation flow or opens a modal" },
180
+ { event: "Click Secondary Action", trigger: "pointerup on secondary action button or link", action: "Fire the secondaryAction onClick handler; typically opens documentation or import flow" },
181
+ { event: "Hover Action", trigger: "pointerenter on action button", action: "Apply standard button hover state transition" },
182
+ { event: "Focus Action", trigger: "Tab key focuses the action button", action: "Show focus ring; announce button label to screen readers" },
183
+ { event: "Enter / Space", trigger: "Enter or Space on focused action button", action: "Fire the same action as a click on that button" },
184
+ { event: "Data Arrives", trigger: "Content data loads successfully with items", action: "Empty state is replaced by the actual content view; smooth crossfade transition recommended" },
185
+ { event: "Error Retry", trigger: "Click retry action in error variant", action: "Re-initiate the data fetch; show loading state while retrying" },
186
+ ],
187
+
188
+ contentGuidance: [
189
+ "Heading should clearly name what is empty — 'No projects yet' is better than 'Nothing here'",
190
+ "Description should explain why the area is empty and guide the user toward the primary action",
191
+ "Primary action label should be specific — 'Create your first project' is better than 'Get started'",
192
+ "Use a relevant illustration that matches the context — inbox icon for empty inbox, folder for empty file list",
193
+ "Keep illustration style consistent with the product's illustration system — do not mix 2D and 3D styles",
194
+ "Avoid negative language — 'Your inbox is waiting' is friendlier than 'You have no messages'",
195
+ "For search empty states, suggest adjusting filters or broadening the search query in the description text",
196
+ "Error variant should be honest about the failure and provide a clear retry path",
197
+ ],
198
+
199
+ responsiveBehaviour: [
200
+ { breakpoint: "Mobile (<768px)", behavior: "Use compact size; illustration scales down to 48px; action buttons stack vertically; full-width buttons" },
201
+ { breakpoint: "Tablet (768-1023px)", behavior: "Use default size; illustration at 80px; buttons inline with standard padding" },
202
+ { breakpoint: "Desktop (1024-1439px)", behavior: "Use default or full size depending on container; centered layout with 480px max text width" },
203
+ { breakpoint: "Ultra-wide (>=1440px)", behavior: "Empty state dimensions capped at full size preset — does not scale with viewport; remains centered" },
204
+ ],
205
+
206
+ accessibilitySpec: {
207
+ intro:
208
+ "Empty states must convey their message to all users including those using assistive technologies. The heading provides the accessible name, illustrations are decorative, and action buttons must be keyboard-accessible.",
209
+ requirements: [
210
+ { requirement: "Illustration Decorative", level: "A", notes: "Illustration/icon must use aria-hidden='true' and role='presentation' — it is decorative and the heading conveys the meaning" },
211
+ { requirement: "Heading as Accessible Name", level: "A", notes: "The heading should be an actual heading element (h2/h3) providing the accessible name for the empty state region" },
212
+ { requirement: "Region Landmark", level: "AA", notes: "Wrap the empty state in a region with aria-label matching the heading for screen reader landmark navigation" },
213
+ { requirement: "Action Buttons Focusable", level: "A", notes: "Primary and secondary action buttons must be reachable via Tab key and activatable with Enter/Space" },
214
+ { requirement: "Keyboard Activation", level: "A", notes: "Enter and Space keys must trigger the action buttons identically to a mouse click" },
215
+ { requirement: "Contrast Ratio", level: "AA", notes: "Heading text meets 4.5:1 contrast; description text meets 4.5:1 contrast; action buttons follow button contrast rules" },
216
+ { requirement: "Content Reflow", level: "AA", notes: "At 400% zoom the empty state reflows to a single-column stacked layout without horizontal scrolling" },
217
+ { requirement: "Animation Preference", level: "AAA", notes: "If the illustration is animated (Lottie), respect prefers-reduced-motion media query and provide a static fallback" },
218
+ ],
219
+ outro: [
220
+ "Test that screen readers announce the heading and description in sequence without the illustration interfering",
221
+ "Verify that the action button is the first focusable element within the empty state for efficient keyboard navigation",
222
+ "Ensure that when data arrives and the empty state is removed, focus is managed to avoid losing the user's position",
223
+ ],
224
+ },
225
+
226
+ qaAcceptanceCriteria: [
227
+ { check: "Visual Layout", platform: "All", expectedResult: "Illustration, heading, description, and actions stack vertically and center horizontally" },
228
+ { check: "Size Variants", platform: "All", expectedResult: "Compact, default, and full sizes render with correct dimensions, font sizes, and illustration sizes" },
229
+ { check: "Illustration Rendering", platform: "All", expectedResult: "SVG illustration renders at the correct size with proper aspect ratio; no distortion" },
230
+ { check: "Primary Action", platform: "Web", expectedResult: "Clicking the primary action button fires the callback; button follows standard hover/active states" },
231
+ { check: "Secondary Action", platform: "Web", expectedResult: "Secondary action renders as tertiary button or link; fires its callback on click" },
232
+ { check: "Keyboard Navigation", platform: "Web", expectedResult: "Tab focuses action buttons; Enter/Space activates them; focus ring is visible" },
233
+ { check: "Screen Reader", platform: "Web", expectedResult: "Illustration hidden; heading and description announced; action buttons labeled correctly" },
234
+ { check: "Error Variant", platform: "All", expectedResult: "Error illustration, error heading, and retry action render correctly" },
235
+ { check: "Search Variant", platform: "All", expectedResult: "Search-specific illustration and no-results message render with filter adjustment guidance" },
236
+ { check: "Responsive Reflow", platform: "Web", expectedResult: "Compact size on mobile; buttons stack vertically; text remains readable at all breakpoints" },
237
+ { check: "Content Transition", platform: "Web", expectedResult: "When data loads, empty state smoothly transitions out and content view appears" },
238
+ { check: "Contrast", platform: "All", expectedResult: "All text elements pass 4.5:1 contrast against the background surface" },
239
+ { check: "RTL Support", platform: "Web", expectedResult: "Text alignment and button order mirror correctly in RTL locales" },
240
+ ],
241
+
242
+ dos: [
243
+ "Use empty states to guide users toward their first action in a new or cleared-out view",
244
+ "Write clear, specific headings that name what is empty — context matters",
245
+ "Provide a prominent primary action that directly resolves the empty state",
246
+ "Match illustration style to the product's visual language for consistency",
247
+ "Include a secondary action (e.g., 'Learn more') for users who need guidance before acting",
248
+ "Use the appropriate variant (empty, search, error, permission) to match the context precisely",
249
+ "Keep description text to 2-3 lines — be concise and action-oriented",
250
+ ],
251
+
252
+ donts: [
253
+ "Do not use generic messages like 'Nothing to see here' or 'No data' — be specific and helpful",
254
+ "Do not omit the action button — an empty state without a CTA is a dead end for the user",
255
+ "Do not make illustrations the focal point at the expense of clear messaging — text is primary",
256
+ "Do not use animated illustrations without respecting prefers-reduced-motion",
257
+ "Do not reuse the same empty state illustration and message for every empty view — contextualize each one",
258
+ "Do not let the description text exceed 3 lines — truncate or simplify the guidance",
259
+ "Do not use negative or blame-oriented language — 'You haven't created anything' should be 'Create your first item'",
260
+ ],
261
+ };