@sarjallab09/figma-intelligence 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -36
- package/dist/bin/cli.js +2 -0
- package/dist/design-bridge/bridge.js +2 -0
- package/dist/figma-bridge-plugin/bridge-relay.js +2 -0
- package/dist/figma-bridge-plugin/code.js +1 -0
- package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package-lock.json +0 -3
- package/dist/figma-bridge-plugin/ui.html +4970 -0
- package/dist/figma-intelligence-layer/dist/index.js +2 -0
- package/dist/scripts/clean-existing-chunks.js +2 -0
- package/dist/scripts/connect-ai-tool.js +2 -0
- package/dist/scripts/convert-hub-pdfs.js +2 -0
- package/dist/scripts/figma-mcp-status.js +2 -0
- package/dist/scripts/register-codex-mcp.js +2 -0
- package/dist/scripts/test-copilot-chat.js +2 -0
- package/package.json +11 -8
- package/bin/cli.js +0 -859
- package/design-bridge/bridge.js +0 -196
- package/design-bridge/lib/assets.js +0 -367
- package/design-bridge/lib/prompt.js +0 -85
- package/design-bridge/lib/server.js +0 -66
- package/design-bridge/lib/stitch.js +0 -37
- package/design-bridge/lib/tokens.js +0 -82
- package/design-bridge/package-lock.json +0 -579
- package/figma-bridge-plugin/README.md +0 -97
- package/figma-bridge-plugin/anthropic-chat-runner.js +0 -192
- package/figma-bridge-plugin/bridge-relay.js +0 -2505
- package/figma-bridge-plugin/chat-runner.js +0 -485
- package/figma-bridge-plugin/code.js +0 -1534
- package/figma-bridge-plugin/codex-runner.js +0 -505
- package/figma-bridge-plugin/component-schemas.js +0 -110
- package/figma-bridge-plugin/content-context.js +0 -869
- package/figma-bridge-plugin/create-button.js +0 -216
- package/figma-bridge-plugin/gemini-cli-runner.js +0 -291
- package/figma-bridge-plugin/gemini-runner.js +0 -187
- package/figma-bridge-plugin/html-to-figma.js +0 -927
- package/figma-bridge-plugin/knowledge-hub/.gitkeep +0 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/anatomy-spec.md +0 -159
- package/figma-bridge-plugin/knowledge-hub/uspec-references/api-spec.md +0 -162
- package/figma-bridge-plugin/knowledge-hub/uspec-references/color-spec.md +0 -148
- package/figma-bridge-plugin/knowledge-hub/uspec-references/full-spec-template.md +0 -314
- package/figma-bridge-plugin/knowledge-hub/uspec-references/property-spec.md +0 -175
- package/figma-bridge-plugin/knowledge-hub/uspec-references/screen-reader-spec.md +0 -180
- package/figma-bridge-plugin/knowledge-hub/uspec-references/structure-spec.md +0 -165
- package/figma-bridge-plugin/perplexity-runner.js +0 -188
- package/figma-bridge-plugin/references/SKILL.md +0 -178
- package/figma-bridge-plugin/references/anatomy-spec.md +0 -159
- package/figma-bridge-plugin/references/api-spec.md +0 -162
- package/figma-bridge-plugin/references/color-spec.md +0 -148
- package/figma-bridge-plugin/references/full-spec-template.md +0 -314
- package/figma-bridge-plugin/references/property-spec.md +0 -175
- package/figma-bridge-plugin/references/screen-reader-spec.md +0 -180
- package/figma-bridge-plugin/references/structure-spec.md +0 -165
- package/figma-bridge-plugin/shared-prompt-config.js +0 -645
- package/figma-bridge-plugin/spec-helpers/build-table.js +0 -269
- package/figma-bridge-plugin/spec-helpers/classify-elements.js +0 -189
- package/figma-bridge-plugin/spec-helpers/index.js +0 -35
- package/figma-bridge-plugin/spec-helpers/parse-figma-link.js +0 -49
- package/figma-bridge-plugin/spec-helpers/position-markers.js +0 -158
- package/figma-bridge-plugin/stitch-auth.js +0 -322
- package/figma-bridge-plugin/stitch-runner.js +0 -1427
- package/figma-bridge-plugin/token-resolver.js +0 -107
- package/figma-bridge-plugin/ui.html +0 -4542
- package/figma-intelligence-layer/.env.example +0 -39
- package/figma-intelligence-layer/docs/local-image-generation.md +0 -60
- package/figma-intelligence-layer/examples/comfyui-workflow-template.example.json +0 -101
- package/figma-intelligence-layer/jest.config.js +0 -14
- package/figma-intelligence-layer/mcp-config.json +0 -19
- package/figma-intelligence-layer/package-lock.json +0 -5892
- package/figma-intelligence-layer/scripts/setup-comfyui-local.sh +0 -67
- package/figma-intelligence-layer/scripts/start-comfyui.sh +0 -33
- package/figma-intelligence-layer/src/index.ts +0 -2233
- package/figma-intelligence-layer/src/shared/auto-layout-validator.ts +0 -404
- package/figma-intelligence-layer/src/shared/cache.ts +0 -187
- package/figma-intelligence-layer/src/shared/color-operations.ts +0 -533
- package/figma-intelligence-layer/src/shared/color-utils.ts +0 -138
- package/figma-intelligence-layer/src/shared/component-script-builder.ts +0 -413
- package/figma-intelligence-layer/src/shared/component-templates.ts +0 -2767
- package/figma-intelligence-layer/src/shared/concept-taxonomy.ts +0 -694
- package/figma-intelligence-layer/src/shared/decision-log.ts +0 -128
- package/figma-intelligence-layer/src/shared/design-system-context.ts +0 -568
- package/figma-intelligence-layer/src/shared/design-system-intelligence.ts +0 -131
- package/figma-intelligence-layer/src/shared/design-system-matcher.ts +0 -184
- package/figma-intelligence-layer/src/shared/design-system-normalizers.ts +0 -196
- package/figma-intelligence-layer/src/shared/design-system-tokens.ts +0 -295
- package/figma-intelligence-layer/src/shared/dtcg-validator.ts +0 -530
- package/figma-intelligence-layer/src/shared/enrichment-pipeline.ts +0 -671
- package/figma-intelligence-layer/src/shared/figma-bridge.ts +0 -1418
- package/figma-intelligence-layer/src/shared/font-config.ts +0 -126
- package/figma-intelligence-layer/src/shared/icon-catalog.ts +0 -360
- package/figma-intelligence-layer/src/shared/icon-fetch.ts +0 -80
- package/figma-intelligence-layer/src/shared/prototype-script-builder.ts +0 -162
- package/figma-intelligence-layer/src/shared/response-compression.ts +0 -440
- package/figma-intelligence-layer/src/shared/semantic-token-catalog.ts +0 -324
- package/figma-intelligence-layer/src/shared/token-binder.ts +0 -505
- package/figma-intelligence-layer/src/shared/token-math.ts +0 -427
- package/figma-intelligence-layer/src/shared/token-naming.ts +0 -468
- package/figma-intelligence-layer/src/shared/token-utils.ts +0 -420
- package/figma-intelligence-layer/src/shared/types.ts +0 -346
- package/figma-intelligence-layer/src/shared/typography-presets.ts +0 -94
- package/figma-intelligence-layer/src/shared/unsplash.ts +0 -165
- package/figma-intelligence-layer/src/shared/vision-client.ts +0 -607
- package/figma-intelligence-layer/src/shared/vision-provider-anthropic.ts +0 -334
- package/figma-intelligence-layer/src/shared/vision-provider-openai.ts +0 -446
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-handler.ts +0 -782
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-renderer.ts +0 -496
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotation-kit.ts +0 -230
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/colorblind-sim.ts +0 -66
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/index.ts +0 -810
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-analyzer.ts +0 -1191
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-figma-page.ts +0 -1346
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.ts +0 -148
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-figma-page.ts +0 -499
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-report.ts +0 -910
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-checker.ts +0 -989
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-criteria.ts +0 -1160
- package/figma-intelligence-layer/src/tools/phase1-vision/design-from-ref/index.ts +0 -424
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/component-recognizer.ts +0 -38
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/ds-matcher.ts +0 -111
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/font-matcher.ts +0 -114
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/icon-resolver.ts +0 -103
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/index.ts +0 -1060
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/layout-segmenter.ts +0 -18
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/token-inferencer.ts +0 -39
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/vision-pipeline.ts +0 -58
- package/figma-intelligence-layer/src/tools/phase1-vision/sketch-to-design/index.ts +0 -298
- package/figma-intelligence-layer/src/tools/phase1-vision/visual-audit/index.ts +0 -197
- package/figma-intelligence-layer/src/tools/phase2-accuracy/component-audit/index.ts +0 -494
- package/figma-intelligence-layer/src/tools/phase2-accuracy/intent-translator/index.ts +0 -356
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/container-patterns.ts +0 -123
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/index.ts +0 -663
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/built-in-rules.yaml +0 -56
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/index.ts +0 -614
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/rule-engine.ts +0 -113
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/color-theory.ts +0 -178
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/index.ts +0 -470
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/index.ts +0 -429
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/token-override-maps.ts +0 -226
- package/figma-intelligence-layer/src/tools/phase3-generation/ai-image-insert/index.ts +0 -535
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/index.ts +0 -660
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/pattern-fingerprints.ts +0 -209
- package/figma-intelligence-layer/src/tools/phase3-generation/composition-builder/index.ts +0 -540
- package/figma-intelligence-layer/src/tools/phase3-generation/figma-animated-build.ts +0 -391
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/index.ts +0 -2019
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/screen-templates.ts +0 -131
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-map/index.ts +0 -381
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-wire/index.ts +0 -565
- package/figma-intelligence-layer/src/tools/phase3-generation/swarm-build/index.ts +0 -764
- package/figma-intelligence-layer/src/tools/phase3-generation/system-drift/index.ts +0 -535
- package/figma-intelligence-layer/src/tools/phase3-generation/unsplash-search/index.ts +0 -84
- package/figma-intelligence-layer/src/tools/phase3-generation/url-to-frame/index.ts +0 -401
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/css-animations.ts +0 -68
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/framer-motion.ts +0 -78
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/swift-animations.ts +0 -93
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/index.ts +0 -596
- package/figma-intelligence-layer/src/tools/phase4-sync/ci-check/index.ts +0 -462
- package/figma-intelligence-layer/src/tools/phase4-sync/export-tokens/index.ts +0 -1470
- package/figma-intelligence-layer/src/tools/phase4-sync/generate-component-code/index.ts +0 -829
- package/figma-intelligence-layer/src/tools/phase4-sync/handoff-spec/index.ts +0 -702
- package/figma-intelligence-layer/src/tools/phase4-sync/icon-library-sync/index.ts +0 -483
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/index.ts +0 -501
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/storybook-parser.ts +0 -106
- package/figma-intelligence-layer/src/tools/phase4-sync/watch-docs/index.ts +0 -676
- package/figma-intelligence-layer/src/tools/phase4-sync/webhook-listener/index.ts +0 -560
- package/figma-intelligence-layer/src/tools/phase5-governance/apg-doc/index.ts +0 -1043
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/component-detection.ts +0 -620
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/anatomy.ts +0 -331
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/color-tokens.ts +0 -77
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/properties.ts +0 -54
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/snapshot.ts +0 -287
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/spacing.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/states.ts +0 -43
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/typography.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/index.ts +0 -221
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts +0 -166
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/alert.ts +0 -234
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar-group.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar.ts +0 -249
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/badge.ts +0 -231
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/banner.ts +0 -293
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/breadcrumb.ts +0 -240
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/button.ts +0 -243
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/calendar.ts +0 -307
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/card.ts +0 -143
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/checkbox.ts +0 -227
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/chip.ts +0 -233
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/combobox.ts +0 -282
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/datepicker.ts +0 -276
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/divider.ts +0 -223
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/drawer.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/dropdown-menu.ts +0 -289
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/empty-state.ts +0 -261
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/file-uploader.ts +0 -290
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts +0 -265
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/grid.ts +0 -238
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/icon.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts +0 -128
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-edit.ts +0 -286
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-message.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/input.ts +0 -330
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/link.ts +0 -247
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/list.ts +0 -250
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/menu.ts +0 -247
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/modal.ts +0 -144
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navbar.ts +0 -264
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navigation.ts +0 -251
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/number-input.ts +0 -261
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/pagination.ts +0 -248
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/popover.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/progress.ts +0 -251
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/radio.ts +0 -142
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/range-slider.ts +0 -282
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts +0 -250
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts +0 -258
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/segmented-control.ts +0 -265
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/select.ts +0 -319
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/skeleton.ts +0 -256
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/slider.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/spinner.ts +0 -239
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/status-dot.ts +0 -252
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/stepper.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/table.ts +0 -244
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tabs.ts +0 -143
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tag.ts +0 -243
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/textarea.ts +0 -259
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts +0 -293
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts +0 -144
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toggle.ts +0 -289
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toolbar.ts +0 -267
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tooltip.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/treeview.ts +0 -257
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/typography.ts +0 -319
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/legacy-compat.ts +0 -121
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/anatomy-diagram.ts +0 -430
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/figma-page.ts +0 -312
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/json.ts +0 -129
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/markdown.ts +0 -78
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/visual-doc.ts +0 -2333
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/accessibility.ts +0 -100
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/anatomy.ts +0 -32
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/color-tokens.ts +0 -59
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/content-guidance.ts +0 -18
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/design-tokens.ts +0 -53
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/interaction-rules.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/overview.ts +0 -91
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/properties-api.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/qa-criteria.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/related-components.ts +0 -110
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/responsive.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/size-specs.ts +0 -67
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/spacing-structure.ts +0 -58
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/state-specs.ts +0 -79
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/states.ts +0 -50
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/type-hierarchy.ts +0 -33
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/typography.ts +0 -55
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/usage-guidelines.ts +0 -73
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/variants.ts +0 -81
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/types.ts +0 -409
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/index.ts +0 -198
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/renderer.ts +0 -701
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/types.ts +0 -88
- package/figma-intelligence-layer/src/tools/phase5-governance/decision-log/index.ts +0 -135
- package/figma-intelligence-layer/src/tools/phase5-governance/design-decision-log/index.ts +0 -491
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-primitives/index.ts +0 -416
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-scaffolder/index.ts +0 -722
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-variables/index.ts +0 -449
- package/figma-intelligence-layer/src/tools/phase5-governance/health-report/index.ts +0 -393
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/index.ts +0 -406
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/figma-page.ts +0 -292
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/json.ts +0 -24
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/markdown.ts +0 -172
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/naming-guide.ts +0 -409
- package/figma-intelligence-layer/src/tools/phase5-governance/token-analytics/index.ts +0 -594
- package/figma-intelligence-layer/src/tools/phase5-governance/token-docs/index.ts +0 -710
- package/figma-intelligence-layer/src/tools/phase5-governance/token-migrate/index.ts +0 -458
- package/figma-intelligence-layer/src/tools/phase5-governance/token-naming/index.ts +0 -134
- package/figma-intelligence-layer/tests/apg-doc.test.ts +0 -101
- package/figma-intelligence-layer/tests/design-system-context.test.ts +0 -152
- package/figma-intelligence-layer/tests/design-system-matcher.test.ts +0 -144
- package/figma-intelligence-layer/tests/figma-bridge.test.ts +0 -83
- package/figma-intelligence-layer/tests/generate-image-and-insert.test.ts +0 -56
- package/figma-intelligence-layer/tests/screen-cloner-regression.test.ts +0 -69
- package/figma-intelligence-layer/tests/smoke.test.ts +0 -174
- package/figma-intelligence-layer/tests/spec-generator.test.ts +0 -127
- package/figma-intelligence-layer/tests/token-migrate.test.ts +0 -21
- package/figma-intelligence-layer/tests/token-naming.test.ts +0 -30
- package/figma-intelligence-layer/tsconfig.json +0 -19
- package/scripts/clean-existing-chunks.js +0 -179
- package/scripts/connect-ai-tool.js +0 -490
- package/scripts/convert-hub-pdfs.js +0 -425
- package/scripts/figma-mcp-status.js +0 -349
- package/scripts/register-codex-mcp.js +0 -96
- /package/{design-bridge → dist/design-bridge}/.env.example +0 -0
- /package/{design-bridge → dist/design-bridge}/package.json +0 -0
- /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/manifest.json +0 -0
- /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package.json +0 -0
- /package/{figma-intelligence-layer → dist/figma-intelligence-layer}/package.json +0 -0
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* file-uploader.ts — Gold-standard design knowledge for File Uploader components
|
|
3
|
-
*/
|
|
4
|
-
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
-
|
|
6
|
-
export const fileUploaderKnowledge: ComponentKnowledge = {
|
|
7
|
-
description:
|
|
8
|
-
"File upload control | Drag-and-drop or button-triggered | Supports single and multi-file selection with progress feedback",
|
|
9
|
-
|
|
10
|
-
stateSpecifications: [
|
|
11
|
-
{
|
|
12
|
-
state: "Idle",
|
|
13
|
-
visualChange: "Dashed border container with upload icon, instructional text, and optional browse button",
|
|
14
|
-
opacity: "1",
|
|
15
|
-
cursorWeb: "pointer",
|
|
16
|
-
usage: "Default resting state — no files selected; ready to accept input via click or drag",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
state: "DragOver",
|
|
20
|
-
visualChange: "Border becomes solid and primary-colored; background shifts to a light tint; icon may animate upward",
|
|
21
|
-
opacity: "1",
|
|
22
|
-
cursorWeb: "copy",
|
|
23
|
-
usage: "User is dragging files over the drop zone — visual feedback confirms the area will accept the drop",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
state: "Uploading",
|
|
27
|
-
visualChange: "Progress bar appears below or beside each file entry; file name and size are shown; cancel action is available",
|
|
28
|
-
opacity: "1",
|
|
29
|
-
cursorWeb: "default",
|
|
30
|
-
usage: "Files are being transferred — progress percentage and/or indeterminate bar are displayed",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
state: "Complete",
|
|
34
|
-
visualChange: "File entry shows a success checkmark icon; progress bar reaches 100% then fades; remove action is available",
|
|
35
|
-
opacity: "1",
|
|
36
|
-
cursorWeb: "default",
|
|
37
|
-
usage: "File upload finished successfully — file is listed with its name, size, and type icon",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
state: "Error",
|
|
41
|
-
visualChange: "File entry shows error icon and red text describing the failure; retry and remove actions are available",
|
|
42
|
-
opacity: "1",
|
|
43
|
-
cursorWeb: "default",
|
|
44
|
-
usage: "Upload failed due to network error, file type rejection, or size limit exceeded",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
state: "Disabled",
|
|
48
|
-
visualChange: "Drop zone border and text are muted; drag-and-drop and click are non-functional",
|
|
49
|
-
opacity: "0.4",
|
|
50
|
-
cursorWeb: "not-allowed",
|
|
51
|
-
usage: "File uploading is temporarily unavailable — prerequisites not met or quota reached",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
state: "Focus",
|
|
55
|
-
visualChange: "2px focus ring around the drop zone or browse button; keyboard activation ready",
|
|
56
|
-
opacity: "1",
|
|
57
|
-
cursorWeb: "pointer",
|
|
58
|
-
usage: "Drop zone or browse button receives keyboard focus via Tab navigation",
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
|
|
62
|
-
propertyDescriptions: {
|
|
63
|
-
accept: "Comma-separated MIME types or file extensions that the uploader will accept (e.g. '.pdf,.png,image/*')",
|
|
64
|
-
maxSize: "Maximum file size in bytes — files exceeding this limit are rejected with an error message",
|
|
65
|
-
multiple: "When true, allows selecting and uploading multiple files at once; when false, only one file at a time",
|
|
66
|
-
type: "Upload trigger style — 'dropzone' shows a large drag-and-drop area; 'button' shows a compact upload button",
|
|
67
|
-
onUpload: "Callback invoked when files are selected or dropped, receiving the FileList or File array",
|
|
68
|
-
progress: "Upload progress percentage (0-100) for the current file or files; used to control the progress bar",
|
|
69
|
-
maxFiles: "Maximum number of files allowed in a multi-file upload session; prevents exceeding quota",
|
|
70
|
-
onRemove: "Callback invoked when a user removes a file from the upload list, receiving the file identifier",
|
|
71
|
-
disabled: "When true, the uploader is non-interactive — cannot accept clicks, drops, or keyboard activation",
|
|
72
|
-
label: "Accessible label for the upload control; used as aria-label on the trigger element",
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
sizeSpecifications: [
|
|
76
|
-
{
|
|
77
|
-
size: "Small (Button)",
|
|
78
|
-
height: "32px",
|
|
79
|
-
paddingLR: "12px",
|
|
80
|
-
fontSize: "12px",
|
|
81
|
-
iconSize: "16px",
|
|
82
|
-
borderRadius: "6px",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
size: "Medium (Button)",
|
|
86
|
-
height: "40px",
|
|
87
|
-
paddingLR: "16px",
|
|
88
|
-
fontSize: "14px",
|
|
89
|
-
iconSize: "20px",
|
|
90
|
-
borderRadius: "8px",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
size: "Dropzone",
|
|
94
|
-
height: "160px (min)",
|
|
95
|
-
paddingLR: "24px",
|
|
96
|
-
fontSize: "14px",
|
|
97
|
-
iconSize: "40px",
|
|
98
|
-
borderRadius: "8px",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
size: "Dropzone Compact",
|
|
102
|
-
height: "96px (min)",
|
|
103
|
-
paddingLR: "16px",
|
|
104
|
-
fontSize: "12px",
|
|
105
|
-
iconSize: "24px",
|
|
106
|
-
borderRadius: "8px",
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
|
|
110
|
-
designTokenBindings: [
|
|
111
|
-
{
|
|
112
|
-
property: "Dropzone Background",
|
|
113
|
-
tokenName: "$file-uploader-bg",
|
|
114
|
-
role: "Background fill of the drop zone area in idle state",
|
|
115
|
-
fallback: "#F9FAFB",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
property: "Dropzone Border",
|
|
119
|
-
tokenName: "$file-uploader-border",
|
|
120
|
-
role: "Dashed border around the drop zone in idle state",
|
|
121
|
-
fallback: "#D0D5DD",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
property: "DragOver Background",
|
|
125
|
-
tokenName: "$file-uploader-dragover-bg",
|
|
126
|
-
role: "Background tint when files are dragged over the drop zone",
|
|
127
|
-
fallback: "#EFF8FF",
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
property: "DragOver Border",
|
|
131
|
-
tokenName: "$file-uploader-dragover-border",
|
|
132
|
-
role: "Solid primary border during drag-over",
|
|
133
|
-
fallback: "#2563EB",
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
property: "Icon Color",
|
|
137
|
-
tokenName: "$file-uploader-icon",
|
|
138
|
-
role: "Upload icon color in the drop zone",
|
|
139
|
-
fallback: "#667085",
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
property: "Text Primary",
|
|
143
|
-
tokenName: "$file-uploader-text",
|
|
144
|
-
role: "Primary instructional text color (e.g. 'Drag files here')",
|
|
145
|
-
fallback: "#344054",
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
property: "Text Secondary",
|
|
149
|
-
tokenName: "$file-uploader-text-secondary",
|
|
150
|
-
role: "Secondary hint text color (e.g. 'or click to browse')",
|
|
151
|
-
fallback: "#667085",
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
property: "Progress Bar Fill",
|
|
155
|
-
tokenName: "$file-uploader-progress",
|
|
156
|
-
role: "Filled portion of the upload progress bar",
|
|
157
|
-
fallback: "#2563EB",
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
property: "Progress Bar Track",
|
|
161
|
-
tokenName: "$file-uploader-progress-track",
|
|
162
|
-
role: "Empty portion/background of the progress bar",
|
|
163
|
-
fallback: "#E4E7EC",
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
property: "Error Color",
|
|
167
|
-
tokenName: "$file-uploader-error",
|
|
168
|
-
role: "Error text and icon color for failed uploads",
|
|
169
|
-
fallback: "#F04438",
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
property: "Success Color",
|
|
173
|
-
tokenName: "$file-uploader-success",
|
|
174
|
-
role: "Success checkmark icon color for completed uploads",
|
|
175
|
-
fallback: "#12B76A",
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
property: "Focus Ring",
|
|
179
|
-
tokenName: "$focus-ring",
|
|
180
|
-
role: "Keyboard focus indicator on the drop zone or browse button",
|
|
181
|
-
fallback: "0 0 0 2px #FFFFFF, 0 0 0 4px #2E90FA",
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
|
|
185
|
-
structureRules: [
|
|
186
|
-
"Dropzone variant uses a centered vertical Auto Layout: icon → primary text → secondary text → optional browse button",
|
|
187
|
-
"Button variant renders as a standard button with an upload icon; file list appears below the button",
|
|
188
|
-
"File list entries are rendered below the drop zone in a vertical stack with consistent spacing",
|
|
189
|
-
"Each file entry contains: file type icon, file name, file size, progress bar (during upload), and action button (remove/cancel/retry)",
|
|
190
|
-
"Drop zone has a dashed border (border-style: dashed) with 2px width using the border token",
|
|
191
|
-
"The entire drop zone area is a click target that opens the native file picker",
|
|
192
|
-
"A hidden <input type='file'> element handles the actual file selection via the browser's native picker",
|
|
193
|
-
"Progress bars within file entries are 4px tall with rounded ends inside the file list item",
|
|
194
|
-
"File type icons are determined by MIME type: image files show a thumbnail preview; documents show a file icon",
|
|
195
|
-
],
|
|
196
|
-
|
|
197
|
-
typeHierarchyRules: [
|
|
198
|
-
"Primary instructional text uses Medium weight (500) at 14px: 'Drag and drop files here'",
|
|
199
|
-
"Secondary hint text uses Regular weight (400) at 12px: 'or click to browse'",
|
|
200
|
-
"File name in the file list uses Medium weight (500) at 14px — single line, truncate with ellipsis",
|
|
201
|
-
"File size uses Regular weight (400) at 12px in a muted color beside or below the file name",
|
|
202
|
-
"Error messages use Regular weight (400) at 12px in the error token color",
|
|
203
|
-
],
|
|
204
|
-
|
|
205
|
-
interactionRules: [
|
|
206
|
-
{ event: "Click (Dropzone)", trigger: "Click/tap anywhere on the drop zone", action: "Open the native file picker dialog with the configured accept and multiple settings" },
|
|
207
|
-
{ event: "Click (Browse)", trigger: "Click/tap on the 'Browse' button within the drop zone", action: "Open the native file picker dialog (same as clicking the drop zone)" },
|
|
208
|
-
{ event: "Drag Enter", trigger: "File(s) dragged over the drop zone boundary", action: "Transition to DragOver state; show visual feedback (solid border, tinted background)" },
|
|
209
|
-
{ event: "Drag Leave", trigger: "File(s) dragged outside the drop zone boundary", action: "Return to Idle state; remove DragOver visual treatment" },
|
|
210
|
-
{ event: "Drop", trigger: "File(s) released over the drop zone", action: "Validate files against accept/maxSize/maxFiles; start upload via onUpload; add entries to file list" },
|
|
211
|
-
{ event: "Remove File", trigger: "Click remove/X button on a file entry", action: "Remove the file from the list; fire onRemove; cancel upload if in progress" },
|
|
212
|
-
{ event: "Retry Upload", trigger: "Click retry button on an error file entry", action: "Re-attempt the upload for the failed file; transition back to Uploading state" },
|
|
213
|
-
{ event: "Cancel Upload", trigger: "Click cancel button during upload", action: "Abort the in-progress upload; remove the file entry or show cancelled state" },
|
|
214
|
-
{ event: "Keyboard Activate", trigger: "Enter or Space while drop zone or browse button is focused", action: "Open the native file picker dialog" },
|
|
215
|
-
],
|
|
216
|
-
|
|
217
|
-
contentGuidance: [
|
|
218
|
-
"Primary text should clearly state the action: 'Drag and drop your files here' or 'Upload a file'",
|
|
219
|
-
"Secondary text should indicate the alternative: 'or click to browse' or include format/size hints",
|
|
220
|
-
"Display accepted file types and size limits in the drop zone: 'PDF, PNG, JPG up to 10MB'",
|
|
221
|
-
"Show file size in human-readable format: '2.4 MB' not '2516582 bytes'",
|
|
222
|
-
"Error messages should be specific: 'File exceeds 10MB limit' not 'Upload failed'",
|
|
223
|
-
"Show a file count summary when multiple files are uploaded: '3 of 5 files uploaded'",
|
|
224
|
-
"Use thumbnails for image files to provide visual confirmation of the correct file selection",
|
|
225
|
-
],
|
|
226
|
-
|
|
227
|
-
responsiveBehaviour: [
|
|
228
|
-
{ breakpoint: "Mobile (<768px)", behavior: "Dropzone reduces to compact height; text simplifies to 'Tap to upload'; drag-and-drop still works for supported mobile browsers" },
|
|
229
|
-
{ breakpoint: "Tablet (768-1023px)", behavior: "Standard dropzone layout; file list entries may use a condensed row format" },
|
|
230
|
-
{ breakpoint: "Desktop (1024-1439px)", behavior: "Full dropzone with icon, primary/secondary text, and browse button; file list shows detailed entries" },
|
|
231
|
-
{ breakpoint: "Ultra-wide (>=1440px)", behavior: "Dropzone width remains capped at container max-width; does not expand to fill ultra-wide viewports" },
|
|
232
|
-
],
|
|
233
|
-
|
|
234
|
-
accessibilitySpec: {
|
|
235
|
-
intro:
|
|
236
|
-
"File uploaders combine drag-and-drop interaction with a traditional file picker. Keyboard and screen reader users must have equivalent access to all functionality, including file selection, progress monitoring, and file management.",
|
|
237
|
-
requirements: [
|
|
238
|
-
{ requirement: "Trigger Role", level: "A", notes: "The drop zone / browse button must have role='button' with a clear accessible name like 'Upload file'" },
|
|
239
|
-
{ requirement: "Keyboard Activation", level: "A", notes: "Enter and Space must open the native file picker dialog when the trigger is focused" },
|
|
240
|
-
{ requirement: "File Input", level: "A", notes: "The hidden <input type='file'> must have a proper label via aria-label or associated <label> element" },
|
|
241
|
-
{ requirement: "Progress Announcement", level: "A", notes: "Upload progress must be announced via role='progressbar' with aria-valuenow, aria-valuemin, and aria-valuemax" },
|
|
242
|
-
{ requirement: "File List", level: "A", notes: "Uploaded files must be in a list (role='list') with accessible names including file name and status" },
|
|
243
|
-
{ requirement: "Remove Action", level: "A", notes: "Remove buttons must have aria-label='Remove [filename]' for each file entry" },
|
|
244
|
-
{ requirement: "Error Announcement", level: "A", notes: "Upload errors must be announced via aria-live='assertive' or role='alert' with descriptive error text" },
|
|
245
|
-
{ requirement: "Contrast", level: "AA", notes: "Drop zone border, text, and icons must meet 4.5:1 text contrast and 3:1 non-text contrast against background" },
|
|
246
|
-
{ requirement: "Drag-and-Drop Alternative", level: "A", notes: "Drag-and-drop must not be the only means of uploading — the browse button/click provides the keyboard-accessible alternative" },
|
|
247
|
-
],
|
|
248
|
-
outro: [
|
|
249
|
-
"Test with screen readers to verify that file selection, upload progress, completion, and errors are all announced",
|
|
250
|
-
"Ensure that removing a file returns focus to the next file in the list, or to the upload trigger if the list is empty",
|
|
251
|
-
"Verify that drag-and-drop instructions are visible but not the only path — keyboard users rely on the click/button path",
|
|
252
|
-
],
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
qaAcceptanceCriteria: [
|
|
256
|
-
{ check: "Idle State", platform: "All", expectedResult: "Drop zone shows dashed border, upload icon, and instructional text" },
|
|
257
|
-
{ check: "DragOver State", platform: "Web", expectedResult: "Solid primary border and tinted background appear when files are dragged over" },
|
|
258
|
-
{ check: "File Selection", platform: "All", expectedResult: "Clicking drop zone or browse button opens the native file picker with correct accept filters" },
|
|
259
|
-
{ check: "File Drop", platform: "Web", expectedResult: "Dropping valid files starts upload; invalid files show immediate error in file list" },
|
|
260
|
-
{ check: "Upload Progress", platform: "All", expectedResult: "Progress bar fills from 0-100%; file name and size are visible" },
|
|
261
|
-
{ check: "Upload Complete", platform: "All", expectedResult: "Success checkmark shown; progress bar reaches 100%; remove action available" },
|
|
262
|
-
{ check: "Upload Error", platform: "All", expectedResult: "Error icon and message shown; retry and remove actions available" },
|
|
263
|
-
{ check: "Remove File", platform: "All", expectedResult: "File is removed from list; onRemove callback fires; focus moves appropriately" },
|
|
264
|
-
{ check: "Max Size Validation", platform: "All", expectedResult: "Files exceeding maxSize are rejected with descriptive error before upload begins" },
|
|
265
|
-
{ check: "Max Files Validation", platform: "All", expectedResult: "Additional files beyond maxFiles limit are rejected with appropriate message" },
|
|
266
|
-
{ check: "Keyboard Activation", platform: "Web", expectedResult: "Enter/Space opens file picker when drop zone is focused" },
|
|
267
|
-
{ check: "Screen Reader", platform: "Web", expectedResult: "Announces trigger role, progress percentage, completion, and errors" },
|
|
268
|
-
{ check: "Disabled State", platform: "All", expectedResult: "Drop zone is muted and non-interactive; no file picker opens on click or keyboard" },
|
|
269
|
-
],
|
|
270
|
-
|
|
271
|
-
dos: [
|
|
272
|
-
"Always provide a clickable alternative to drag-and-drop for keyboard and assistive technology users",
|
|
273
|
-
"Display accepted file types and size limits clearly within the drop zone",
|
|
274
|
-
"Show upload progress with a percentage or progress bar for each file",
|
|
275
|
-
"Provide clear error messages when files are rejected (wrong type, too large, too many)",
|
|
276
|
-
"Allow users to remove uploaded files and cancel in-progress uploads",
|
|
277
|
-
"Use file type icons or thumbnail previews to help users confirm correct file selection",
|
|
278
|
-
"Maintain the drop zone visible even after files are selected to allow additional uploads",
|
|
279
|
-
],
|
|
280
|
-
|
|
281
|
-
donts: [
|
|
282
|
-
"Do not rely solely on drag-and-drop — always include a browse button or click-to-upload",
|
|
283
|
-
"Do not auto-upload without user confirmation for sensitive or irreversible operations",
|
|
284
|
-
"Do not silently ignore invalid files — always show an error explaining why the file was rejected",
|
|
285
|
-
"Do not remove the file list when navigating away — preserve upload state if possible",
|
|
286
|
-
"Do not allow unlimited file uploads without a maxFiles or maxSize constraint",
|
|
287
|
-
"Do not use vague error messages like 'Upload failed' — specify the reason (size, type, network)",
|
|
288
|
-
"Do not make the drop zone smaller than 96px tall — it must be a clear, visible target",
|
|
289
|
-
],
|
|
290
|
-
};
|
package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* form.ts — Gold-standard design knowledge for Form wrapper/container components
|
|
3
|
-
*/
|
|
4
|
-
import type { ComponentKnowledge } from "../types.js";
|
|
5
|
-
|
|
6
|
-
export const formKnowledge: ComponentKnowledge = {
|
|
7
|
-
description:
|
|
8
|
-
"Form wrapper and container | Groups and validates field collections | Manages layout, submission, and error presentation",
|
|
9
|
-
|
|
10
|
-
stateSpecifications: [
|
|
11
|
-
{
|
|
12
|
-
state: "Default",
|
|
13
|
-
visualChange: "Form container renders with configured layout; all child fields in their default state; submit button enabled",
|
|
14
|
-
opacity: "1",
|
|
15
|
-
cursorWeb: "default",
|
|
16
|
-
usage: "Resting state — form is ready for user input with all fields editable",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
state: "Submitting",
|
|
20
|
-
visualChange: "Submit button enters loading state with spinner; all form fields become temporarily non-interactive; overlay may dim the form",
|
|
21
|
-
opacity: "1",
|
|
22
|
-
cursorWeb: "wait",
|
|
23
|
-
usage: "Form data is being sent to the server — prevents duplicate submissions and communicates progress",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
state: "Success",
|
|
27
|
-
visualChange: "Success banner or inline message appears at the top or bottom of the form; fields may reset or become read-only",
|
|
28
|
-
opacity: "1",
|
|
29
|
-
cursorWeb: "default",
|
|
30
|
-
usage: "Server has confirmed successful data submission; form may reset or transition to a confirmation view",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
state: "Error",
|
|
34
|
-
visualChange: "Form-level error banner appears at the top; individual fields with errors show their error states; focus moves to the first errored field",
|
|
35
|
-
opacity: "1",
|
|
36
|
-
cursorWeb: "default",
|
|
37
|
-
usage: "Validation has failed on one or more fields — either client-side on submit/blur/change, or server-side after submission",
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
propertyDescriptions: {
|
|
42
|
-
layout: "Arrangement of form fields — 'vertical' stacks fields top-to-bottom, 'horizontal' arranges fields side-by-side in a row",
|
|
43
|
-
labelPosition: "Placement of field labels relative to their inputs — 'top' (above), 'left' (inline start), or 'right' (inline end)",
|
|
44
|
-
requiredIndicator: "Visual marker for required fields — typically an asterisk (*) appended to the label, configurable as text or icon",
|
|
45
|
-
spacing: "Gap between consecutive form fields — uses spacing tokens ($spacing-sm, $spacing-md, $spacing-lg) based on density preset",
|
|
46
|
-
onSubmit: "Callback fired when the form is submitted; receives all field values; should handle async submission and error responses",
|
|
47
|
-
onReset: "Callback fired when the form is reset; restores all fields to their initial values and clears validation errors",
|
|
48
|
-
validateOn: "Timing of field validation — 'submit' validates only on form submission, 'blur' on field blur, 'change' on every value change",
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
sizeSpecifications: [
|
|
52
|
-
{
|
|
53
|
-
size: "Compact",
|
|
54
|
-
height: "12px",
|
|
55
|
-
paddingLR: "12px",
|
|
56
|
-
fontSize: "12px",
|
|
57
|
-
iconSize: "16px",
|
|
58
|
-
borderRadius: "6px",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
size: "Default",
|
|
62
|
-
height: "16px",
|
|
63
|
-
paddingLR: "16px",
|
|
64
|
-
fontSize: "14px",
|
|
65
|
-
iconSize: "20px",
|
|
66
|
-
borderRadius: "8px",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
size: "Spacious",
|
|
70
|
-
height: "24px",
|
|
71
|
-
paddingLR: "24px",
|
|
72
|
-
fontSize: "16px",
|
|
73
|
-
iconSize: "24px",
|
|
74
|
-
borderRadius: "10px",
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
|
|
78
|
-
designTokenBindings: [
|
|
79
|
-
{
|
|
80
|
-
property: "Form Background",
|
|
81
|
-
tokenName: "$form-bg",
|
|
82
|
-
role: "Background color for the form container; transparent by default to inherit page background",
|
|
83
|
-
fallback: "transparent",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
property: "Label Text",
|
|
87
|
-
tokenName: "$form-label-text",
|
|
88
|
-
role: "Text color for all field labels within the form",
|
|
89
|
-
fallback: "#344054",
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
property: "Label Font Weight",
|
|
93
|
-
tokenName: "$form-label-weight",
|
|
94
|
-
role: "Font weight for field labels — Medium for visual hierarchy",
|
|
95
|
-
fallback: "500",
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
property: "Required Indicator",
|
|
99
|
-
tokenName: "$form-required-indicator",
|
|
100
|
-
role: "Color for the required field marker (asterisk or icon)",
|
|
101
|
-
fallback: "#F04438",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
property: "Error Text",
|
|
105
|
-
tokenName: "$form-error-text",
|
|
106
|
-
role: "Text color for field-level and form-level error messages",
|
|
107
|
-
fallback: "#F04438",
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
property: "Error Banner Background",
|
|
111
|
-
tokenName: "$form-error-banner-bg",
|
|
112
|
-
role: "Background fill for the form-level error summary banner",
|
|
113
|
-
fallback: "#FEF3F2",
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
property: "Success Banner Background",
|
|
117
|
-
tokenName: "$form-success-banner-bg",
|
|
118
|
-
role: "Background fill for the form-level success confirmation banner",
|
|
119
|
-
fallback: "#ECFDF3",
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
property: "Helper Text",
|
|
123
|
-
tokenName: "$form-helper-text",
|
|
124
|
-
role: "Text color for supplementary guidance below individual fields",
|
|
125
|
-
fallback: "#667085",
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
property: "Section Divider",
|
|
129
|
-
tokenName: "$form-section-divider",
|
|
130
|
-
role: "Color for horizontal rules separating form sections or fieldsets",
|
|
131
|
-
fallback: "#EAECF0",
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
property: "Spacing Compact",
|
|
135
|
-
tokenName: "$spacing-sm",
|
|
136
|
-
role: "Gap between fields in compact density mode",
|
|
137
|
-
fallback: "12px",
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
property: "Spacing Default",
|
|
141
|
-
tokenName: "$spacing-md",
|
|
142
|
-
role: "Gap between fields in default density mode",
|
|
143
|
-
fallback: "16px",
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
property: "Spacing Spacious",
|
|
147
|
-
tokenName: "$spacing-lg",
|
|
148
|
-
role: "Gap between fields in spacious density mode",
|
|
149
|
-
fallback: "24px",
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
|
|
153
|
-
structureRules: [
|
|
154
|
-
"Form wraps child components (Input, Select, Checkbox, Radio, Textarea, Button) in a vertical or horizontal Auto Layout",
|
|
155
|
-
"Each field group consists of: label, input component, helper/error text — stacked vertically with $spacing-xs gap",
|
|
156
|
-
"Fieldset/legend pattern groups related fields into sections with a visible heading and optional divider",
|
|
157
|
-
"Required indicator (asterisk) is positioned immediately after the label text with no additional spacing",
|
|
158
|
-
"Form-level error banner is always the first visible child when present, positioned above all form fields",
|
|
159
|
-
"Submit and reset buttons are grouped in a horizontal row at the bottom of the form with $spacing-md gap between them",
|
|
160
|
-
"Primary action (submit) is placed on the right in LTR layouts, on the left in RTL layouts",
|
|
161
|
-
"Horizontal layout arranges fields in columns using CSS Grid or flex-wrap; each column has equal or specified width",
|
|
162
|
-
"Form container width defaults to 100% of its parent; max-width may be set to constrain overly wide forms",
|
|
163
|
-
"Inline validation error messages appear directly below their associated field, not in a distant location",
|
|
164
|
-
],
|
|
165
|
-
|
|
166
|
-
typeHierarchyRules: [
|
|
167
|
-
"Field labels use font-weight Medium (500) at the form's configured label font-size",
|
|
168
|
-
"Helper text uses font-weight Regular (400) at one step smaller than the label font-size",
|
|
169
|
-
"Error messages use font-weight Medium (500) at the same size as helper text for emphasis",
|
|
170
|
-
"Section headings (legend elements) use font-weight SemiBold (600) at one step larger than labels",
|
|
171
|
-
"All form text uses sentence case — never all-caps except for rare acronyms",
|
|
172
|
-
"Form-level error/success banner text uses font-weight Medium (500) at the label font-size",
|
|
173
|
-
],
|
|
174
|
-
|
|
175
|
-
interactionRules: [
|
|
176
|
-
{ event: "Submit", trigger: "Click submit button or press Enter in a single-line input", action: "Run all field validations; if valid, fire onSubmit and enter submitting state; if invalid, show errors and focus first errored field" },
|
|
177
|
-
{ event: "Reset", trigger: "Click reset button", action: "Restore all fields to initial values; clear all validation errors; fire onReset callback" },
|
|
178
|
-
{ event: "Field Blur", trigger: "Focus leaves a field (validateOn='blur')", action: "Validate the blurred field; show inline error if invalid; clear error if now valid" },
|
|
179
|
-
{ event: "Field Change", trigger: "Value changes in a field (validateOn='change')", action: "Validate the changed field in real-time; show or clear inline error immediately" },
|
|
180
|
-
{ event: "Tab Navigation", trigger: "Tab key cycles through form fields", action: "Move focus to the next focusable field in document order; skip disabled fields" },
|
|
181
|
-
{ event: "Enter Key", trigger: "Enter key in a text input", action: "Submit the form if it is a single-field form or if the input is the last field before the submit button" },
|
|
182
|
-
{ event: "Error Banner Click", trigger: "Click on an error in the form-level error summary", action: "Scroll to and focus the corresponding errored field" },
|
|
183
|
-
{ event: "Submission Success", trigger: "Server responds with success", action: "Exit submitting state; show success banner; optionally reset form or transition to confirmation" },
|
|
184
|
-
{ event: "Submission Failure", trigger: "Server responds with errors", action: "Exit submitting state; map server errors to fields; show form-level error banner; focus first errored field" },
|
|
185
|
-
],
|
|
186
|
-
|
|
187
|
-
contentGuidance: [
|
|
188
|
-
"Field labels should be concise and descriptive: 'Email address', 'Password', 'Company name'",
|
|
189
|
-
"Use consistent label placement (top, left, or right) throughout the entire form — never mix positions",
|
|
190
|
-
"Mark required fields with an asterisk (*) and include a legend explaining the indicator at the top of the form",
|
|
191
|
-
"Error messages should describe the problem and how to fix it: 'Enter a valid email address' not 'Invalid input'",
|
|
192
|
-
"Group related fields into logical sections with clear headings: 'Personal Information', 'Shipping Address'",
|
|
193
|
-
"Place the primary submit button at the bottom-right (LTR) with a clear action label: 'Create account', 'Save changes'",
|
|
194
|
-
"If a reset button is needed, style it as a secondary or tertiary variant to avoid accidental use",
|
|
195
|
-
"Helper text should provide examples or format guidance: 'e.g. john@example.com' or 'At least 8 characters'",
|
|
196
|
-
],
|
|
197
|
-
|
|
198
|
-
responsiveBehaviour: [
|
|
199
|
-
{ breakpoint: "Mobile (<768px)", behavior: "All fields stack vertically at full width; labels positioned above fields (top); submit button spans full width at 48px height" },
|
|
200
|
-
{ breakpoint: "Tablet (768-1023px)", behavior: "Two-column layout for related field pairs (first/last name); labels may be top or left depending on available width" },
|
|
201
|
-
{ breakpoint: "Desktop (1024-1439px)", behavior: "Multi-column layout with left-aligned labels for dense forms; inline buttons with standard padding" },
|
|
202
|
-
{ breakpoint: "Ultra-wide (>=1440px)", behavior: "Form max-width is capped (typically 720-960px) and centered to prevent overly wide layouts" },
|
|
203
|
-
],
|
|
204
|
-
|
|
205
|
-
accessibilitySpec: {
|
|
206
|
-
intro:
|
|
207
|
-
"Forms are the primary data collection pattern on the web. Proper semantic markup, label association, and error handling are essential for all users including those using assistive technology.",
|
|
208
|
-
requirements: [
|
|
209
|
-
{ requirement: "Form Element", level: "A", notes: "Use the native <form> element to enable implicit submission and provide landmarks for screen readers" },
|
|
210
|
-
{ requirement: "Label Association", level: "A", notes: "Every input must have a visible <label> with a matching for/id pair, or use aria-labelledby" },
|
|
211
|
-
{ requirement: "Required Fields", level: "A", notes: "Required fields must have aria-required='true' and a visible required indicator in the label" },
|
|
212
|
-
{ requirement: "Error Identification", level: "A", notes: "Each errored field must have aria-invalid='true' and aria-describedby pointing to its error message" },
|
|
213
|
-
{ requirement: "Error Suggestion", level: "AA", notes: "Error messages must describe the nature of the error and suggest how to correct it" },
|
|
214
|
-
{ requirement: "Form-Level Errors", level: "A", notes: "Form-level error summary uses aria-describedby on the form element or role='alert' for immediate announcement" },
|
|
215
|
-
{ requirement: "Fieldset/Legend", level: "A", notes: "Related field groups wrapped in <fieldset> with <legend> describing the group purpose" },
|
|
216
|
-
{ requirement: "Focus Management", level: "A", notes: "On validation failure, focus moves to the first errored field or the error summary banner" },
|
|
217
|
-
{ requirement: "Tab Order", level: "A", notes: "Fields follow a logical tab order matching the visual layout; no tab traps or skipped fields" },
|
|
218
|
-
{ requirement: "Contrast Ratio", level: "AA", notes: "Label and error text: 4.5:1 against background; required indicator: 3:1 non-text contrast" },
|
|
219
|
-
],
|
|
220
|
-
outro: [
|
|
221
|
-
"Ensure screen readers announce form-level success and error states via aria-live regions",
|
|
222
|
-
"Provide a clear path from the error summary to individual fields — each error item should be an anchor link",
|
|
223
|
-
"Do not rely solely on color to communicate errors — use icons, borders, and text in combination",
|
|
224
|
-
],
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
qaAcceptanceCriteria: [
|
|
228
|
-
{ check: "Visual Regression", platform: "All", expectedResult: "Form renders pixel-perfect against baseline for each layout mode and density preset" },
|
|
229
|
-
{ check: "Label Alignment", platform: "All", expectedResult: "Labels align consistently per labelPosition prop (top, left, right) across all fields" },
|
|
230
|
-
{ check: "Required Indicator", platform: "All", expectedResult: "Asterisk appears next to required field labels; legend explains the indicator" },
|
|
231
|
-
{ check: "Submit Validation", platform: "Web", expectedResult: "Clicking submit with empty required fields shows inline errors and focuses the first errored field" },
|
|
232
|
-
{ check: "Blur Validation", platform: "Web", expectedResult: "When validateOn='blur', leaving an invalid field shows its error message immediately" },
|
|
233
|
-
{ check: "Change Validation", platform: "Web", expectedResult: "When validateOn='change', error clears in real-time as user corrects the value" },
|
|
234
|
-
{ check: "Submitting State", platform: "Web", expectedResult: "Submit button shows spinner; fields become non-interactive; duplicate submissions prevented" },
|
|
235
|
-
{ check: "Success State", platform: "Web", expectedResult: "Success banner appears; form resets or transitions as configured" },
|
|
236
|
-
{ check: "Error Banner", platform: "Web", expectedResult: "Form-level error summary appears with links to each errored field; clicking a link focuses the field" },
|
|
237
|
-
{ check: "Keyboard Navigation", platform: "Web", expectedResult: "Tab cycles through all fields in visual order; Enter submits from text inputs" },
|
|
238
|
-
{ check: "Screen Reader", platform: "Web", expectedResult: "Announces form landmark, field labels, required state, error messages, and submission status" },
|
|
239
|
-
{ check: "Fieldset Grouping", platform: "Web", expectedResult: "Related fields grouped in fieldset with legend; screen readers announce the group name" },
|
|
240
|
-
{ check: "Reset Functionality", platform: "Web", expectedResult: "Reset button restores all fields to initial values and clears all errors" },
|
|
241
|
-
{ check: "Responsive Layout", platform: "All", expectedResult: "Fields stack vertically on mobile, multi-column on desktop; labels reposition per breakpoint" },
|
|
242
|
-
{ check: "Contrast", platform: "All", expectedResult: "Labels pass 4.5:1 contrast; error indicators pass 3:1 non-text contrast" },
|
|
243
|
-
{ check: "RTL Support", platform: "Web", expectedResult: "Labels, fields, and buttons mirror correctly in RTL locales; submit button moves to left" },
|
|
244
|
-
],
|
|
245
|
-
|
|
246
|
-
dos: [
|
|
247
|
-
"Use semantic <form>, <fieldset>, and <legend> elements for proper structure and screen reader support",
|
|
248
|
-
"Associate every input with a visible label — never rely on placeholder text alone as a label",
|
|
249
|
-
"Mark required fields consistently with both a visual indicator and aria-required='true'",
|
|
250
|
-
"Provide an error summary at the form level that links to individual errored fields",
|
|
251
|
-
"Focus the first errored field automatically when validation fails on submit",
|
|
252
|
-
"Use consistent spacing tokens between fields — never override with arbitrary pixel values",
|
|
253
|
-
"Place the primary action button at the form bottom with a descriptive verb label",
|
|
254
|
-
],
|
|
255
|
-
|
|
256
|
-
donts: [
|
|
257
|
-
"Do not use placeholder text as a substitute for labels — it disappears on input and fails accessibility",
|
|
258
|
-
"Do not disable the submit button to indicate validation errors — show the errors and let users correct them",
|
|
259
|
-
"Do not mix label positions (top/left/right) within the same form",
|
|
260
|
-
"Do not rely solely on color to indicate errors — always pair with icons and descriptive text",
|
|
261
|
-
"Do not reset the form on submission failure — preserve user input so they can correct errors",
|
|
262
|
-
"Do not validate on every keystroke without debouncing — it creates excessive noise for screen readers",
|
|
263
|
-
"Do not use generic error messages like 'This field is required' — be specific about what is expected",
|
|
264
|
-
],
|
|
265
|
-
};
|