@sarjallab09/figma-intelligence 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +26 -0
- package/README.md +327 -0
- package/bin/cli.js +859 -0
- package/design-bridge/.env.example +5 -0
- package/design-bridge/bridge.js +196 -0
- package/design-bridge/lib/assets.js +367 -0
- package/design-bridge/lib/prompt.js +85 -0
- package/design-bridge/lib/server.js +66 -0
- package/design-bridge/lib/stitch.js +37 -0
- package/design-bridge/lib/tokens.js +82 -0
- package/design-bridge/package-lock.json +579 -0
- package/design-bridge/package.json +19 -0
- package/figma-bridge-plugin/README.md +97 -0
- package/figma-bridge-plugin/anthropic-chat-runner.js +192 -0
- package/figma-bridge-plugin/bridge-relay.js +2363 -0
- package/figma-bridge-plugin/chat-runner.js +459 -0
- package/figma-bridge-plugin/code.js +1528 -0
- package/figma-bridge-plugin/codex-runner.js +505 -0
- package/figma-bridge-plugin/component-schemas.js +110 -0
- package/figma-bridge-plugin/content-context.js +869 -0
- package/figma-bridge-plugin/create-button.js +216 -0
- package/figma-bridge-plugin/gemini-cli-runner.js +291 -0
- package/figma-bridge-plugin/gemini-runner.js +187 -0
- package/figma-bridge-plugin/html-to-figma.js +927 -0
- package/figma-bridge-plugin/knowledge-hub/.gitkeep +0 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/anatomy-spec.md +159 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/api-spec.md +162 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/color-spec.md +148 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/full-spec-template.md +314 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/property-spec.md +175 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/screen-reader-spec.md +180 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/structure-spec.md +165 -0
- package/figma-bridge-plugin/manifest.json +21 -0
- package/figma-bridge-plugin/package-lock.json +1936 -0
- package/figma-bridge-plugin/package.json +20 -0
- package/figma-bridge-plugin/perplexity-runner.js +188 -0
- package/figma-bridge-plugin/references/SKILL.md +178 -0
- package/figma-bridge-plugin/references/anatomy-spec.md +159 -0
- package/figma-bridge-plugin/references/api-spec.md +162 -0
- package/figma-bridge-plugin/references/color-spec.md +148 -0
- package/figma-bridge-plugin/references/full-spec-template.md +314 -0
- package/figma-bridge-plugin/references/property-spec.md +175 -0
- package/figma-bridge-plugin/references/screen-reader-spec.md +180 -0
- package/figma-bridge-plugin/references/structure-spec.md +165 -0
- package/figma-bridge-plugin/shared-prompt-config.js +604 -0
- package/figma-bridge-plugin/spec-helpers/build-table.js +269 -0
- package/figma-bridge-plugin/spec-helpers/classify-elements.js +189 -0
- package/figma-bridge-plugin/spec-helpers/index.js +35 -0
- package/figma-bridge-plugin/spec-helpers/parse-figma-link.js +49 -0
- package/figma-bridge-plugin/spec-helpers/position-markers.js +158 -0
- package/figma-bridge-plugin/stitch-auth.js +322 -0
- package/figma-bridge-plugin/stitch-runner.js +1427 -0
- package/figma-bridge-plugin/token-resolver.js +107 -0
- package/figma-bridge-plugin/ui.html +4467 -0
- package/figma-intelligence-layer/.env.example +39 -0
- package/figma-intelligence-layer/docs/local-image-generation.md +60 -0
- package/figma-intelligence-layer/examples/comfyui-workflow-template.example.json +101 -0
- package/figma-intelligence-layer/jest.config.js +14 -0
- package/figma-intelligence-layer/mcp-config.json +19 -0
- package/figma-intelligence-layer/package-lock.json +5892 -0
- package/figma-intelligence-layer/package.json +48 -0
- package/figma-intelligence-layer/scripts/setup-comfyui-local.sh +67 -0
- package/figma-intelligence-layer/scripts/start-comfyui.sh +33 -0
- package/figma-intelligence-layer/src/index.ts +2233 -0
- package/figma-intelligence-layer/src/shared/auto-layout-validator.ts +404 -0
- package/figma-intelligence-layer/src/shared/cache.ts +187 -0
- package/figma-intelligence-layer/src/shared/color-operations.ts +533 -0
- package/figma-intelligence-layer/src/shared/color-utils.ts +138 -0
- package/figma-intelligence-layer/src/shared/component-script-builder.ts +413 -0
- package/figma-intelligence-layer/src/shared/component-templates.ts +2767 -0
- package/figma-intelligence-layer/src/shared/concept-taxonomy.ts +694 -0
- package/figma-intelligence-layer/src/shared/decision-log.ts +128 -0
- package/figma-intelligence-layer/src/shared/design-system-context.ts +568 -0
- package/figma-intelligence-layer/src/shared/design-system-intelligence.ts +131 -0
- package/figma-intelligence-layer/src/shared/design-system-matcher.ts +184 -0
- package/figma-intelligence-layer/src/shared/design-system-normalizers.ts +196 -0
- package/figma-intelligence-layer/src/shared/design-system-tokens.ts +295 -0
- package/figma-intelligence-layer/src/shared/dtcg-validator.ts +530 -0
- package/figma-intelligence-layer/src/shared/enrichment-pipeline.ts +671 -0
- package/figma-intelligence-layer/src/shared/figma-bridge.ts +1408 -0
- package/figma-intelligence-layer/src/shared/font-config.ts +126 -0
- package/figma-intelligence-layer/src/shared/icon-catalog.ts +360 -0
- package/figma-intelligence-layer/src/shared/icon-fetch.ts +80 -0
- package/figma-intelligence-layer/src/shared/prototype-script-builder.ts +162 -0
- package/figma-intelligence-layer/src/shared/response-compression.ts +440 -0
- package/figma-intelligence-layer/src/shared/semantic-token-catalog.ts +324 -0
- package/figma-intelligence-layer/src/shared/token-binder.ts +505 -0
- package/figma-intelligence-layer/src/shared/token-math.ts +427 -0
- package/figma-intelligence-layer/src/shared/token-naming.ts +468 -0
- package/figma-intelligence-layer/src/shared/token-utils.ts +420 -0
- package/figma-intelligence-layer/src/shared/types.ts +346 -0
- package/figma-intelligence-layer/src/shared/typography-presets.ts +94 -0
- package/figma-intelligence-layer/src/shared/unsplash.ts +165 -0
- package/figma-intelligence-layer/src/shared/vision-client.ts +607 -0
- package/figma-intelligence-layer/src/shared/vision-provider-anthropic.ts +334 -0
- package/figma-intelligence-layer/src/shared/vision-provider-openai.ts +446 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-handler.ts +782 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-renderer.ts +496 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotation-kit.ts +230 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/colorblind-sim.ts +66 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/index.ts +810 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-analyzer.ts +1191 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-figma-page.ts +1346 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.ts +148 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-figma-page.ts +499 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-report.ts +910 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-checker.ts +989 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-criteria.ts +1160 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/design-from-ref/index.ts +424 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/component-recognizer.ts +38 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/ds-matcher.ts +111 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/font-matcher.ts +114 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/icon-resolver.ts +103 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/index.ts +1060 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/layout-segmenter.ts +18 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/token-inferencer.ts +39 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/vision-pipeline.ts +58 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/sketch-to-design/index.ts +298 -0
- package/figma-intelligence-layer/src/tools/phase1-vision/visual-audit/index.ts +197 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/component-audit/index.ts +494 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/intent-translator/index.ts +356 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/container-patterns.ts +123 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/index.ts +663 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/built-in-rules.yaml +56 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/index.ts +614 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/rule-engine.ts +113 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/color-theory.ts +178 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/index.ts +470 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/index.ts +429 -0
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/token-override-maps.ts +226 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/ai-image-insert/index.ts +535 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/index.ts +660 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/pattern-fingerprints.ts +209 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/composition-builder/index.ts +540 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/figma-animated-build.ts +391 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/index.ts +2019 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/screen-templates.ts +131 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-map/index.ts +381 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-wire/index.ts +565 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/swarm-build/index.ts +764 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/system-drift/index.ts +535 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/unsplash-search/index.ts +84 -0
- package/figma-intelligence-layer/src/tools/phase3-generation/url-to-frame/index.ts +401 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/css-animations.ts +68 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/framer-motion.ts +78 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/swift-animations.ts +93 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/index.ts +596 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/ci-check/index.ts +462 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/export-tokens/index.ts +1470 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/generate-component-code/index.ts +829 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/handoff-spec/index.ts +702 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/icon-library-sync/index.ts +483 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/index.ts +501 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/storybook-parser.ts +106 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/watch-docs/index.ts +676 -0
- package/figma-intelligence-layer/src/tools/phase4-sync/webhook-listener/index.ts +560 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/apg-doc/index.ts +1043 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/component-detection.ts +620 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/anatomy.ts +331 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/color-tokens.ts +77 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/properties.ts +54 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/snapshot.ts +287 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/spacing.ts +71 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/states.ts +43 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/typography.ts +71 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/index.ts +221 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts +166 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts +232 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/alert.ts +234 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar-group.ts +270 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar.ts +249 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/badge.ts +231 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/banner.ts +293 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/breadcrumb.ts +240 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/button.ts +243 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/calendar.ts +307 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/card.ts +143 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/checkbox.ts +227 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/chip.ts +233 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/combobox.ts +282 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/datepicker.ts +276 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/divider.ts +223 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/drawer.ts +255 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/dropdown-menu.ts +289 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/empty-state.ts +261 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/file-uploader.ts +290 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts +265 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/grid.ts +238 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/icon.ts +255 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts +128 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-edit.ts +286 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-message.ts +255 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/input.ts +330 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/link.ts +247 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/list.ts +250 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/menu.ts +247 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/modal.ts +144 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navbar.ts +264 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navigation.ts +251 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/number-input.ts +261 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/pagination.ts +248 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/popover.ts +270 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/progress.ts +251 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/radio.ts +142 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/range-slider.ts +282 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts +250 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts +258 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/segmented-control.ts +265 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/select.ts +319 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/skeleton.ts +256 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/slider.ts +232 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/spinner.ts +239 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/status-dot.ts +252 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/stepper.ts +270 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/table.ts +244 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tabs.ts +143 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tag.ts +243 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/textarea.ts +259 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts +293 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts +144 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toggle.ts +289 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toolbar.ts +267 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tooltip.ts +232 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/treeview.ts +257 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/typography.ts +319 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/legacy-compat.ts +121 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/anatomy-diagram.ts +430 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/figma-page.ts +312 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/json.ts +129 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/markdown.ts +78 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/visual-doc.ts +2333 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/accessibility.ts +100 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/anatomy.ts +32 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/color-tokens.ts +59 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/content-guidance.ts +18 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/design-tokens.ts +53 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/interaction-rules.ts +19 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/overview.ts +91 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/properties-api.ts +71 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/qa-criteria.ts +19 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/related-components.ts +110 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/responsive.ts +19 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/size-specs.ts +67 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/spacing-structure.ts +58 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/state-specs.ts +79 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/states.ts +50 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/type-hierarchy.ts +33 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/typography.ts +55 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/usage-guidelines.ts +73 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/variants.ts +81 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/types.ts +409 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/index.ts +198 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/renderer.ts +701 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/types.ts +88 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/decision-log/index.ts +135 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/design-decision-log/index.ts +491 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-primitives/index.ts +416 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-scaffolder/index.ts +722 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-variables/index.ts +449 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/health-report/index.ts +393 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/index.ts +406 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/figma-page.ts +292 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/json.ts +24 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/markdown.ts +172 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/naming-guide.ts +409 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/token-analytics/index.ts +594 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/token-docs/index.ts +710 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/token-migrate/index.ts +458 -0
- package/figma-intelligence-layer/src/tools/phase5-governance/token-naming/index.ts +134 -0
- package/figma-intelligence-layer/tests/apg-doc.test.ts +101 -0
- package/figma-intelligence-layer/tests/design-system-context.test.ts +152 -0
- package/figma-intelligence-layer/tests/design-system-matcher.test.ts +144 -0
- package/figma-intelligence-layer/tests/figma-bridge.test.ts +83 -0
- package/figma-intelligence-layer/tests/generate-image-and-insert.test.ts +56 -0
- package/figma-intelligence-layer/tests/screen-cloner-regression.test.ts +69 -0
- package/figma-intelligence-layer/tests/smoke.test.ts +174 -0
- package/figma-intelligence-layer/tests/spec-generator.test.ts +127 -0
- package/figma-intelligence-layer/tests/token-migrate.test.ts +21 -0
- package/figma-intelligence-layer/tests/token-naming.test.ts +30 -0
- package/figma-intelligence-layer/tsconfig.json +19 -0
- package/package.json +35 -0
- package/scripts/clean-existing-chunks.js +179 -0
- package/scripts/connect-ai-tool.js +490 -0
- package/scripts/convert-hub-pdfs.js +425 -0
- package/scripts/figma-mcp-status.js +349 -0
- package/scripts/register-codex-mcp.js +96 -0
package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* time-picker.ts — Gold-standard design knowledge for Time Picker components
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
+
|
|
6
|
+
export const timePickerKnowledge: ComponentKnowledge = {
|
|
7
|
+
description:
|
|
8
|
+
"Time selection input | Combobox-driven time chooser | Supports 12h and 24h formats with configurable intervals",
|
|
9
|
+
|
|
10
|
+
stateSpecifications: [
|
|
11
|
+
{
|
|
12
|
+
state: "Default",
|
|
13
|
+
visualChange: "Input field shows placeholder or current value; dropdown is closed; clock icon visible",
|
|
14
|
+
opacity: "1",
|
|
15
|
+
cursorWeb: "text",
|
|
16
|
+
usage: "Resting state — field is interactive and ready for input or dropdown activation",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
state: "Focused",
|
|
20
|
+
visualChange: "Input field border changes to primary color; focus ring appears; dropdown may open automatically",
|
|
21
|
+
opacity: "1",
|
|
22
|
+
cursorWeb: "text",
|
|
23
|
+
usage: "Input field has received keyboard focus via Tab or click — ready for typing or arrow navigation",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
state: "Open",
|
|
27
|
+
visualChange: "Dropdown list of time options is visible below/above the input; currently highlighted option has a tint",
|
|
28
|
+
opacity: "1",
|
|
29
|
+
cursorWeb: "default",
|
|
30
|
+
usage: "Dropdown is expanded showing available time slots for selection",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
state: "Error",
|
|
34
|
+
visualChange: "Input border turns red/error color; error icon appears; inline error message shown below the field",
|
|
35
|
+
opacity: "1",
|
|
36
|
+
cursorWeb: "text",
|
|
37
|
+
usage: "Entered time is invalid, outside the allowed range, or in an incorrect format",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
state: "Disabled",
|
|
41
|
+
visualChange: "Input field background and text are muted; clock icon is desaturated; no interaction possible",
|
|
42
|
+
opacity: "0.4",
|
|
43
|
+
cursorWeb: "not-allowed",
|
|
44
|
+
usage: "Time selection is unavailable — field is non-interactive",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
state: "Read-Only",
|
|
48
|
+
visualChange: "Input displays the value but has no editable cursor; border may be removed or subtle",
|
|
49
|
+
opacity: "1",
|
|
50
|
+
cursorWeb: "default",
|
|
51
|
+
usage: "Time value is displayed but cannot be changed — used in review or summary contexts",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
state: "Hover",
|
|
55
|
+
visualChange: "Input border shifts to a slightly darker shade; subtle background change",
|
|
56
|
+
opacity: "1",
|
|
57
|
+
cursorWeb: "text",
|
|
58
|
+
usage: "Mouse cursor enters the input field area",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
propertyDescriptions: {
|
|
63
|
+
value: "Currently selected time as a string (e.g. '14:30' or '2:30 PM') or Date object; controlled by parent",
|
|
64
|
+
format: "Time format — '12h' for AM/PM display or '24h' for military time; affects both input and dropdown",
|
|
65
|
+
minuteStep: "Interval between time options in the dropdown — 1, 5, 10, 15, 30, or 60 minutes",
|
|
66
|
+
minTime: "Earliest selectable time — options before this are disabled or hidden in the dropdown",
|
|
67
|
+
maxTime: "Latest selectable time — options after this are disabled or hidden in the dropdown",
|
|
68
|
+
size: "Dimensional preset — Small, Medium, or Large — controlling input height, padding, and font size",
|
|
69
|
+
placeholder: "Placeholder text shown when no value is set — typically the format hint: 'HH:MM' or 'hh:mm AM/PM'",
|
|
70
|
+
onChange: "Callback invoked when the time value changes, receiving the new time value",
|
|
71
|
+
disabled: "When true, the time picker is non-interactive; visuals are muted; no dropdown opens",
|
|
72
|
+
readOnly: "When true, the value is displayed but not editable; useful for display-only contexts",
|
|
73
|
+
label: "Visible label text associated with the time picker; positioned above the input field",
|
|
74
|
+
error: "Error message string; when set, the field enters error state with red border and error text below",
|
|
75
|
+
clearable: "When true, shows a clear (X) button inside the input to reset the value to empty",
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
sizeSpecifications: [
|
|
79
|
+
{
|
|
80
|
+
size: "Small",
|
|
81
|
+
height: "32px",
|
|
82
|
+
paddingLR: "10px",
|
|
83
|
+
fontSize: "12px",
|
|
84
|
+
iconSize: "16px",
|
|
85
|
+
borderRadius: "6px",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
size: "Medium",
|
|
89
|
+
height: "40px",
|
|
90
|
+
paddingLR: "12px",
|
|
91
|
+
fontSize: "14px",
|
|
92
|
+
iconSize: "20px",
|
|
93
|
+
borderRadius: "8px",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
size: "Large",
|
|
97
|
+
height: "48px",
|
|
98
|
+
paddingLR: "14px",
|
|
99
|
+
fontSize: "16px",
|
|
100
|
+
iconSize: "24px",
|
|
101
|
+
borderRadius: "10px",
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
|
|
105
|
+
designTokenBindings: [
|
|
106
|
+
{
|
|
107
|
+
property: "Input Background",
|
|
108
|
+
tokenName: "$time-picker-input-bg",
|
|
109
|
+
role: "Background fill of the time input field",
|
|
110
|
+
fallback: "#FFFFFF",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
property: "Input Border",
|
|
114
|
+
tokenName: "$time-picker-input-border",
|
|
115
|
+
role: "Border color of the input field in default state",
|
|
116
|
+
fallback: "#D0D5DD",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
property: "Input Focus Border",
|
|
120
|
+
tokenName: "$time-picker-focus-border",
|
|
121
|
+
role: "Border color when the input is focused",
|
|
122
|
+
fallback: "#2563EB",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
property: "Input Text",
|
|
126
|
+
tokenName: "$time-picker-text",
|
|
127
|
+
role: "Text color for the entered or selected time value",
|
|
128
|
+
fallback: "#101828",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
property: "Placeholder Text",
|
|
132
|
+
tokenName: "$time-picker-placeholder",
|
|
133
|
+
role: "Placeholder text color when no value is set",
|
|
134
|
+
fallback: "#98A2B3",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
property: "Clock Icon",
|
|
138
|
+
tokenName: "$time-picker-icon",
|
|
139
|
+
role: "Clock icon color inside the input field",
|
|
140
|
+
fallback: "#667085",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
property: "Dropdown Background",
|
|
144
|
+
tokenName: "$time-picker-dropdown-bg",
|
|
145
|
+
role: "Background fill of the time options dropdown",
|
|
146
|
+
fallback: "#FFFFFF",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
property: "Dropdown Shadow",
|
|
150
|
+
tokenName: "$shadow-dropdown",
|
|
151
|
+
role: "Elevation shadow on the time options dropdown",
|
|
152
|
+
fallback: "0 4px 16px rgba(0, 0, 0, 0.12)",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
property: "Option Hover",
|
|
156
|
+
tokenName: "$time-picker-option-hover-bg",
|
|
157
|
+
role: "Background tint on a hovered time option in the dropdown",
|
|
158
|
+
fallback: "#F2F4F7",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
property: "Option Selected",
|
|
162
|
+
tokenName: "$time-picker-option-selected-bg",
|
|
163
|
+
role: "Background fill for the currently selected time option",
|
|
164
|
+
fallback: "#EFF8FF",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
property: "Error Border",
|
|
168
|
+
tokenName: "$time-picker-error-border",
|
|
169
|
+
role: "Input border color in error state",
|
|
170
|
+
fallback: "#F04438",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
property: "Error Text",
|
|
174
|
+
tokenName: "$time-picker-error-text",
|
|
175
|
+
role: "Error message text color below the input",
|
|
176
|
+
fallback: "#D92D20",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
property: "Focus Ring",
|
|
180
|
+
tokenName: "$focus-ring",
|
|
181
|
+
role: "Keyboard focus indicator on the input field",
|
|
182
|
+
fallback: "0 0 0 2px #FFFFFF, 0 0 0 4px #2E90FA",
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
|
|
186
|
+
structureRules: [
|
|
187
|
+
"Input field uses horizontal Auto Layout: optional label above → input container (icon + text + clear button) → error message below",
|
|
188
|
+
"Clock icon is positioned at the trailing end (right in LTR) of the input field",
|
|
189
|
+
"Clear button (X) appears between the text and clock icon when clearable is true and a value is set",
|
|
190
|
+
"Dropdown panel is positioned below the input by default; flips above if insufficient viewport space below",
|
|
191
|
+
"Dropdown is a scrollable list of time options at the configured minuteStep intervals",
|
|
192
|
+
"Each dropdown option is a single-line text item showing the formatted time (e.g. '2:30 PM' or '14:30')",
|
|
193
|
+
"Dropdown width matches the input field width at minimum; may be slightly wider for comfortable padding",
|
|
194
|
+
"The currently selected option is scrolled into view when the dropdown opens",
|
|
195
|
+
"AM/PM period selector (12h format) may appear as a separate column or as part of each option text",
|
|
196
|
+
],
|
|
197
|
+
|
|
198
|
+
typeHierarchyRules: [
|
|
199
|
+
"Input text uses Regular weight (400) — the time value should be clearly readable without emphasis",
|
|
200
|
+
"Label text uses Medium weight (500) positioned above the input with $spacing-xs gap",
|
|
201
|
+
"Dropdown option text uses Regular weight (400); selected option may use Medium weight (500)",
|
|
202
|
+
"Error message text uses Regular weight (400) at 12px below the input field",
|
|
203
|
+
"Placeholder text uses Regular weight (400) in a muted color — shows format hint like 'HH:MM'",
|
|
204
|
+
],
|
|
205
|
+
|
|
206
|
+
interactionRules: [
|
|
207
|
+
{ event: "Click Input", trigger: "Click/tap on the input field or clock icon", action: "Focus the input; optionally open the time dropdown" },
|
|
208
|
+
{ event: "Type Time", trigger: "User types a time value directly into the input", action: "Parse the input; validate against format, minTime, maxTime; fire onChange if valid" },
|
|
209
|
+
{ event: "Open Dropdown", trigger: "Click clock icon or press Down arrow when focused", action: "Display the dropdown list; scroll the selected or nearest option into view" },
|
|
210
|
+
{ event: "Select Option", trigger: "Click/tap on a time option in the dropdown", action: "Set the value; close the dropdown; fire onChange; return focus to input" },
|
|
211
|
+
{ event: "Arrow Down", trigger: "Down arrow while dropdown is open", action: "Move highlight to the next time option; scroll if needed" },
|
|
212
|
+
{ event: "Arrow Up", trigger: "Up arrow while dropdown is open", action: "Move highlight to the previous time option; scroll if needed" },
|
|
213
|
+
{ event: "Enter", trigger: "Enter key while an option is highlighted", action: "Select the highlighted option; close the dropdown; fire onChange" },
|
|
214
|
+
{ event: "Escape", trigger: "Escape key while dropdown is open", action: "Close the dropdown without changing the value; return focus to input" },
|
|
215
|
+
{ event: "Tab", trigger: "Tab key while dropdown is open", action: "Select the highlighted option (if any); close the dropdown; move focus to the next field" },
|
|
216
|
+
{ event: "Clear", trigger: "Click the clear (X) button", action: "Reset the value to empty; fire onChange with null/empty; keep focus on input" },
|
|
217
|
+
],
|
|
218
|
+
|
|
219
|
+
contentGuidance: [
|
|
220
|
+
"Use the format that matches user expectations: 12h (AM/PM) for US audiences, 24h for most international audiences",
|
|
221
|
+
"Set a reasonable minuteStep — 15 or 30 minutes for appointments; 5 or 1 for precise time entry",
|
|
222
|
+
"Show the format hint as placeholder text: 'HH:MM AM/PM' or 'HH:MM' so users know the expected input",
|
|
223
|
+
"Display the currently selected time in a clearly formatted style matching the chosen format",
|
|
224
|
+
"Error messages should be specific: 'Select a time between 9:00 AM and 5:00 PM' not 'Invalid time'",
|
|
225
|
+
"Label the field clearly: 'Start time', 'Meeting time' — not just 'Time'",
|
|
226
|
+
"When used alongside a date picker, place the time picker to the right of or below the date field",
|
|
227
|
+
],
|
|
228
|
+
|
|
229
|
+
responsiveBehaviour: [
|
|
230
|
+
{ breakpoint: "Mobile (<768px)", behavior: "Input expands to full container width; dropdown fills available width; touch targets are 44px minimum; consider native time input on supported mobile browsers" },
|
|
231
|
+
{ breakpoint: "Tablet (768-1023px)", behavior: "Standard input width; dropdown positioned below with sufficient padding from viewport edges" },
|
|
232
|
+
{ breakpoint: "Desktop (1024-1439px)", behavior: "Compact input width; dropdown opens below or above based on viewport space" },
|
|
233
|
+
{ breakpoint: "Ultra-wide (>=1440px)", behavior: "Input and dropdown sizes remain fixed; no scaling with viewport width" },
|
|
234
|
+
],
|
|
235
|
+
|
|
236
|
+
accessibilitySpec: {
|
|
237
|
+
intro:
|
|
238
|
+
"Time pickers combine text input with a dropdown listbox. The combobox pattern requires proper ARIA roles on the input and list, keyboard navigation for the dropdown, and clear announcements of the selected time.",
|
|
239
|
+
requirements: [
|
|
240
|
+
{ requirement: "Combobox Role", level: "A", notes: "Input must have role='combobox' with aria-expanded indicating dropdown visibility" },
|
|
241
|
+
{ requirement: "Listbox Role", level: "A", notes: "Dropdown list must have role='listbox' with each option having role='option'" },
|
|
242
|
+
{ requirement: "Active Descendant", level: "A", notes: "Use aria-activedescendant on the input to indicate the currently highlighted option in the dropdown" },
|
|
243
|
+
{ requirement: "Label Association", level: "A", notes: "Input must be associated with its label via for/id or aria-labelledby" },
|
|
244
|
+
{ requirement: "Keyboard Navigation", level: "A", notes: "Arrow keys navigate the dropdown; Enter selects; Escape closes without selecting" },
|
|
245
|
+
{ requirement: "Error State", level: "A", notes: "When in error, input must have aria-invalid='true' and aria-describedby pointing to the error message" },
|
|
246
|
+
{ requirement: "Contrast", level: "AA", notes: "Input text and dropdown option text must meet 4.5:1 contrast; borders and icons must meet 3:1 non-text contrast" },
|
|
247
|
+
{ requirement: "Touch Target", level: "AA", notes: "Input field and each dropdown option must have a minimum 44px height on touch devices" },
|
|
248
|
+
{ requirement: "Autocomplete", level: "AA", notes: "Typing in the input should filter or scroll to matching time options for faster selection" },
|
|
249
|
+
],
|
|
250
|
+
outro: [
|
|
251
|
+
"Test with screen readers to verify combobox role, expanded state, option labels, and selected state are announced",
|
|
252
|
+
"Verify that arrow key navigation within the dropdown does not scroll the background page",
|
|
253
|
+
"Ensure that the time format (12h/24h) is consistent between the input display and the dropdown options",
|
|
254
|
+
],
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
qaAcceptanceCriteria: [
|
|
258
|
+
{ check: "Default Render", platform: "All", expectedResult: "Input shows placeholder with clock icon; dropdown is closed" },
|
|
259
|
+
{ check: "Dropdown Open", platform: "All", expectedResult: "Clicking input or clock icon opens dropdown; selected/nearest option is scrolled into view" },
|
|
260
|
+
{ check: "Option Selection", platform: "All", expectedResult: "Clicking an option sets the value, closes dropdown, and fires onChange" },
|
|
261
|
+
{ check: "12h Format", platform: "All", expectedResult: "Times display with AM/PM suffix; dropdown shows 12-hour formatted options" },
|
|
262
|
+
{ check: "24h Format", platform: "All", expectedResult: "Times display in 00:00-23:59 range; dropdown shows 24-hour formatted options" },
|
|
263
|
+
{ check: "Minute Step", platform: "All", expectedResult: "Dropdown options are spaced by the configured minuteStep interval" },
|
|
264
|
+
{ check: "Min/Max Time", platform: "All", expectedResult: "Options outside minTime-maxTime range are disabled or hidden" },
|
|
265
|
+
{ check: "Keyboard Navigation", platform: "Web", expectedResult: "Arrow keys navigate dropdown; Enter selects; Escape closes; Tab selects and moves focus" },
|
|
266
|
+
{ check: "Type-Ahead", platform: "Web", expectedResult: "Typing in the input filters or scrolls the dropdown to matching times" },
|
|
267
|
+
{ check: "Error State", platform: "All", expectedResult: "Red border, error icon, and error message render; aria-invalid is true" },
|
|
268
|
+
{ check: "Disabled State", platform: "All", expectedResult: "Input and icon are muted; no dropdown opens; not focusable" },
|
|
269
|
+
{ check: "Clear Button", platform: "All", expectedResult: "Clear X button resets value; fires onChange with empty; keeps focus on input" },
|
|
270
|
+
{ check: "Screen Reader", platform: "Web", expectedResult: "Announces combobox role, expanded state, active option, and selected value" },
|
|
271
|
+
{ check: "RTL Support", platform: "Web", expectedResult: "Clock icon moves to left; text alignment and dropdown position adjust for RTL" },
|
|
272
|
+
],
|
|
273
|
+
|
|
274
|
+
dos: [
|
|
275
|
+
"Use the combobox ARIA pattern with role='combobox' on the input and role='listbox' on the dropdown",
|
|
276
|
+
"Support both typed input and dropdown selection for maximum flexibility",
|
|
277
|
+
"Display a clear format hint as placeholder text so users know the expected input format",
|
|
278
|
+
"Scroll the dropdown to the selected or nearest time option when opening",
|
|
279
|
+
"Validate input in real-time and show specific error messages for invalid entries",
|
|
280
|
+
"Use consistent time formatting between the input display and dropdown options",
|
|
281
|
+
"Pair with a date picker when both date and time are needed, with clear labeling for each",
|
|
282
|
+
],
|
|
283
|
+
|
|
284
|
+
donts: [
|
|
285
|
+
"Do not use a time picker for selecting durations — use a duration input or number fields instead",
|
|
286
|
+
"Do not default to 12h format for international audiences — respect locale conventions",
|
|
287
|
+
"Do not use a minuteStep smaller than 1 — sub-minute precision is rarely needed in UI",
|
|
288
|
+
"Do not auto-close the dropdown on scroll — users may need to scroll through many options",
|
|
289
|
+
"Do not omit the label — an unlabeled time picker is ambiguous (start time? end time?)",
|
|
290
|
+
"Do not use a calendar or date grid for time selection — the dropdown list is the standard pattern",
|
|
291
|
+
"Do not make dropdown options smaller than 32px height — touch targets must be comfortable",
|
|
292
|
+
],
|
|
293
|
+
};
|
package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { ComponentKnowledge } from "../types.js";
|
|
2
|
+
|
|
3
|
+
export const toastKnowledge: ComponentKnowledge = {
|
|
4
|
+
description:
|
|
5
|
+
"Transient notification | Status feedback message | Auto-dismissing alert",
|
|
6
|
+
|
|
7
|
+
stateSpecifications: [
|
|
8
|
+
{ state: "Info", visualChange: "Blue left accent bar, info icon, neutral background", opacity: "1", cursorWeb: "default", usage: "General informational message — e.g. 'Settings updated'" },
|
|
9
|
+
{ state: "Success", visualChange: "Green left accent bar, checkmark icon", opacity: "1", cursorWeb: "default", usage: "Positive outcome confirmation — e.g. 'File saved'" },
|
|
10
|
+
{ state: "Warning", visualChange: "Yellow left accent bar, warning triangle icon", opacity: "1", cursorWeb: "default", usage: "Non-critical issue requiring awareness — e.g. 'Storage nearly full'" },
|
|
11
|
+
{ state: "Error", visualChange: "Red left accent bar, error icon", opacity: "1", cursorWeb: "default", usage: "Failure or critical issue — e.g. 'Upload failed'" },
|
|
12
|
+
{ state: "Entering", visualChange: "Toast slides in from edge with fade, stacking offset applied", opacity: "0→1", cursorWeb: "default", usage: "Transition state when toast appears" },
|
|
13
|
+
{ state: "Dismissing", visualChange: "Toast slides out and fades, siblings animate to close gap", opacity: "1→0", cursorWeb: "default", usage: "Auto-dismiss timer expired or user manually closed" },
|
|
14
|
+
{ state: "Paused", visualChange: "Timer bar freezes, toast remains visible", opacity: "1", cursorWeb: "default", usage: "Hover or focus pauses the auto-dismiss countdown" },
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
propertyDescriptions: {
|
|
18
|
+
variant: "Semantic type — info, success, warning, or error — controls color and icon",
|
|
19
|
+
title: "Short bold heading summarizing the notification",
|
|
20
|
+
message: "Optional body text providing additional detail about the event",
|
|
21
|
+
duration: "Auto-dismiss delay in milliseconds; 0 means persistent until manually closed",
|
|
22
|
+
position: "Screen anchor — top-right, top-center, bottom-right, bottom-center, bottom-left",
|
|
23
|
+
hasCloseButton: "Shows an X icon allowing manual dismissal before auto-dismiss",
|
|
24
|
+
actionLabel: "Optional text button inside the toast for a follow-up action (e.g. 'Undo')",
|
|
25
|
+
onAction: "Callback fired when the user clicks the action button",
|
|
26
|
+
stacking: "How multiple toasts arrange — stack (vertical list) or replace (latest wins)",
|
|
27
|
+
maxVisible: "Maximum number of toasts shown simultaneously before older ones collapse",
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
sizeSpecifications: [
|
|
31
|
+
{ size: "compact", height: "40px", paddingLR: "12px", fontSize: "12px", iconSize: "16px", borderRadius: "4px" },
|
|
32
|
+
{ size: "default", height: "auto (min 48px)", paddingLR: "16px", fontSize: "14px", iconSize: "20px", borderRadius: "6px" },
|
|
33
|
+
{ size: "wide", height: "auto (min 48px)", paddingLR: "16px", fontSize: "14px", iconSize: "20px", borderRadius: "6px" },
|
|
34
|
+
{ size: "full-width", height: "auto (min 48px)", paddingLR: "24px", fontSize: "14px", iconSize: "20px", borderRadius: "0px" },
|
|
35
|
+
{ size: "mobile", height: "auto (min 56px)", paddingLR: "16px", fontSize: "16px", iconSize: "24px", borderRadius: "8px" },
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
designTokenBindings: [
|
|
39
|
+
{ property: "surface-bg", tokenName: "color/layer/01", role: "Toast container background", fallback: "#FFFFFF" },
|
|
40
|
+
{ property: "info-accent", tokenName: "color/support/info", role: "Left border and icon for info variant", fallback: "#0043CE" },
|
|
41
|
+
{ property: "success-accent", tokenName: "color/support/success", role: "Left border and icon for success variant", fallback: "#198038" },
|
|
42
|
+
{ property: "warning-accent", tokenName: "color/support/warning", role: "Left border and icon for warning variant", fallback: "#F1C21B" },
|
|
43
|
+
{ property: "error-accent", tokenName: "color/support/error", role: "Left border and icon for error variant", fallback: "#DA1E28" },
|
|
44
|
+
{ property: "title-text", tokenName: "color/text/primary", role: "Toast title text", fallback: "#161616" },
|
|
45
|
+
{ property: "shadow", tokenName: "shadow/raised/03", role: "Drop shadow for floating toast", fallback: "0 4px 12px rgba(0,0,0,0.15)" },
|
|
46
|
+
],
|
|
47
|
+
|
|
48
|
+
structureRules: [
|
|
49
|
+
"Toast container uses position:fixed and is placed outside the main content flow",
|
|
50
|
+
"Each toast has a 4px left accent bar indicating the semantic variant color",
|
|
51
|
+
"Internal layout is a horizontal row: accent bar → icon → content (title + message) → action → close",
|
|
52
|
+
"Stacked toasts offset vertically with 8px gap; newest toast appears at the top of the stack",
|
|
53
|
+
"A progress bar at the bottom of the toast visualizes the remaining auto-dismiss time",
|
|
54
|
+
"Toast container has z-index higher than modals to ensure visibility above all layers",
|
|
55
|
+
"Maximum width is 400px (default) or 100vw on mobile; minimum width is 280px",
|
|
56
|
+
],
|
|
57
|
+
|
|
58
|
+
typeHierarchyRules: [
|
|
59
|
+
"Title uses body-compact-01 (14px) in semibold weight for quick scanning",
|
|
60
|
+
"Message uses body-compact-01 (14px) in regular weight, text-secondary color",
|
|
61
|
+
"Action button label uses body-compact-01 (14px) in the interactive color, underlined",
|
|
62
|
+
"Title is limited to a single line; truncate with ellipsis if too long",
|
|
63
|
+
"Message is limited to 2 lines; longer content should use a different notification pattern",
|
|
64
|
+
"Timestamp (if shown) uses label-01 (12px) in text-helper color",
|
|
65
|
+
"Ensure title and message have at least 4.5:1 contrast against the toast surface",
|
|
66
|
+
],
|
|
67
|
+
|
|
68
|
+
interactionRules: [
|
|
69
|
+
{ event: "timer:expire", trigger: "Auto-dismiss duration elapses", action: "Animate toast out and remove from DOM; shift stack positions" },
|
|
70
|
+
{ event: "click:close", trigger: "User clicks the close icon button", action: "Immediately dismiss the toast with exit animation" },
|
|
71
|
+
{ event: "click:action", trigger: "User clicks the action button (e.g. 'Undo')", action: "Fire onAction callback and dismiss the toast" },
|
|
72
|
+
{ event: "hover", trigger: "Pointer enters the toast surface", action: "Pause the auto-dismiss timer; freeze progress bar" },
|
|
73
|
+
{ event: "hover:leave", trigger: "Pointer leaves the toast surface", action: "Resume the auto-dismiss timer from where it paused" },
|
|
74
|
+
{ event: "focus", trigger: "Keyboard focus enters the toast (close button or action)", action: "Pause auto-dismiss timer to give the user time to interact" },
|
|
75
|
+
{ event: "swipe:horizontal", trigger: "User swipes the toast left or right (mobile)", action: "Dismiss the toast in the swipe direction with slide animation" },
|
|
76
|
+
],
|
|
77
|
+
|
|
78
|
+
contentGuidance: [
|
|
79
|
+
"Title should be a concise past-tense statement — 'Message sent' not 'Your message has been sent successfully'",
|
|
80
|
+
"Message body is optional; omit it if the title alone is sufficient",
|
|
81
|
+
"Action labels should be single verbs or short phrases — 'Undo', 'View', 'Retry'",
|
|
82
|
+
"Avoid technical jargon in error toasts — 'Could not save file' not 'ENOSPC: disk quota exceeded'",
|
|
83
|
+
"Do not use toasts for critical errors that require user action — use an inline alert or modal instead",
|
|
84
|
+
"Success toasts are often sufficient with just a title and no body text",
|
|
85
|
+
"Warning toasts should suggest what the user can do to resolve the issue",
|
|
86
|
+
],
|
|
87
|
+
|
|
88
|
+
responsiveBehaviour: [
|
|
89
|
+
{ breakpoint: "≥ 1056px (lg)", behavior: "Toasts anchor to top-right corner with 16px margin; max-width 400px" },
|
|
90
|
+
{ breakpoint: "672–1055px (md)", behavior: "Toasts anchor to top-center; width adapts up to 400px" },
|
|
91
|
+
{ breakpoint: "< 672px (sm)", behavior: "Toasts span full width at top or bottom of viewport with 8px margin" },
|
|
92
|
+
{ breakpoint: "Reduced motion", behavior: "Skip slide/fade animation; toast appears and disappears instantly" },
|
|
93
|
+
{ breakpoint: "Multiple toasts", behavior: "Stack up to maxVisible; excess toasts show as a collapsed count badge" },
|
|
94
|
+
],
|
|
95
|
+
|
|
96
|
+
accessibilitySpec: {
|
|
97
|
+
intro:
|
|
98
|
+
"Toasts must announce their content to screen readers without stealing focus from the user's current task. They rely on ARIA live regions to push announcements into the screen reader queue.",
|
|
99
|
+
requirements: [
|
|
100
|
+
{ requirement: "Toast container must use role='status' and aria-live='polite' for non-critical messages", level: "A", notes: "Info and success variants use polite to avoid interrupting the user" },
|
|
101
|
+
{ requirement: "Error toasts must use role='alert' and aria-live='assertive'", level: "A", notes: "Assertive ensures the error is announced immediately" },
|
|
102
|
+
{ requirement: "Close button must have aria-label='Dismiss notification' or equivalent", level: "A", notes: "Icon-only button requires a text label for screen readers" },
|
|
103
|
+
{ requirement: "Action button must be keyboard focusable and have a descriptive label", level: "A", notes: "Avoid generic labels like 'Click here'" },
|
|
104
|
+
{ requirement: "Auto-dismiss timer must pause when the toast receives keyboard focus", level: "A", notes: "WCAG 2.2.1 Timing Adjustable — user must have enough time to read" },
|
|
105
|
+
{ requirement: "Toast must not depend on color alone for status — icon shape must differ per variant", level: "A", notes: "Checkmark for success, triangle for warning, circle-x for error" },
|
|
106
|
+
{ requirement: "Focus must not move to the toast automatically — it should be announced in-place", level: "AA", notes: "Moving focus would disorient users in the middle of a task" },
|
|
107
|
+
],
|
|
108
|
+
outro: [
|
|
109
|
+
"Test that VoiceOver announces 'File saved' when a success toast appears without moving focus",
|
|
110
|
+
"Verify error toasts interrupt the current screen reader output via assertive announcement",
|
|
111
|
+
"Confirm that hover and focus both pause the dismiss timer independently",
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
qaAcceptanceCriteria: [
|
|
116
|
+
{ check: "Toast appears and auto-dismisses after configured duration", platform: "All", expectedResult: "Toast visible for duration, then animates out" },
|
|
117
|
+
{ check: "Hover pauses auto-dismiss timer", platform: "Web", expectedResult: "Progress bar freezes; timer resumes on mouse leave" },
|
|
118
|
+
{ check: "Close button dismisses immediately", platform: "All", expectedResult: "Toast removed with exit animation" },
|
|
119
|
+
{ check: "Action button fires callback and dismisses", platform: "All", expectedResult: "Callback executes; toast disappears" },
|
|
120
|
+
{ check: "Multiple toasts stack correctly", platform: "All", expectedResult: "Toasts offset vertically with 8px gap; oldest at bottom" },
|
|
121
|
+
{ check: "Error toast uses assertive live region", platform: "Web", expectedResult: "Screen reader announces error immediately" },
|
|
122
|
+
{ check: "Swipe dismisses on mobile", platform: "Mobile", expectedResult: "Horizontal swipe removes toast with slide animation" },
|
|
123
|
+
],
|
|
124
|
+
|
|
125
|
+
dos: [
|
|
126
|
+
"Use aria-live='polite' for info/success and 'assertive' for error toasts",
|
|
127
|
+
"Pause the auto-dismiss timer on hover and keyboard focus",
|
|
128
|
+
"Provide an action button for reversible actions — e.g. 'Undo' after deletion",
|
|
129
|
+
"Use distinct icons per variant so status is not communicated by color alone",
|
|
130
|
+
"Cap the visible stack at 3–5 toasts to avoid overwhelming the viewport",
|
|
131
|
+
"Position toasts away from primary navigation and form fields",
|
|
132
|
+
"Use a progress bar to show remaining time before auto-dismiss",
|
|
133
|
+
],
|
|
134
|
+
|
|
135
|
+
donts: [
|
|
136
|
+
"Don't use toasts for critical errors that require immediate user action — use a modal or inline alert",
|
|
137
|
+
"Don't set auto-dismiss duration below 4 seconds — users need time to read",
|
|
138
|
+
"Don't stack more than 5 toasts — older toasts should collapse or be replaced",
|
|
139
|
+
"Don't move focus to the toast — it disrupts the user's current workflow",
|
|
140
|
+
"Don't use toasts for content that needs to persist — use a banner instead",
|
|
141
|
+
"Don't omit the close button on persistent (duration: 0) toasts",
|
|
142
|
+
"Don't use identical toast messages in rapid succession — debounce duplicate events",
|
|
143
|
+
],
|
|
144
|
+
};
|