@sarjallab09/figma-intelligence 1.0.1 → 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 -2363
- package/figma-bridge-plugin/chat-runner.js +0 -459
- package/figma-bridge-plugin/code.js +0 -1528
- 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 -604
- 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 -4467
- 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 -1408
- 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,401 +0,0 @@
|
|
|
1
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
-
// URL to Frame
|
|
3
|
-
// Captures screenshots of a live URL at breakpoint widths using Playwright,
|
|
4
|
-
// feeds each screenshot through the screen-cloner pipeline, positions the
|
|
5
|
-
// resulting frames side-by-side, and optionally annotates with competitive
|
|
6
|
-
// analysis notes and a DS coverage gap report.
|
|
7
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
import { chromium, Browser, Page } from "playwright";
|
|
10
|
-
import { getBridge } from "../../../shared/figma-bridge.js";
|
|
11
|
-
import { VisionClient } from "../../../shared/vision-client.js";
|
|
12
|
-
import { decisionLog } from "../../../shared/decision-log.js";
|
|
13
|
-
import { screenClonerHandler } from "../../phase1-vision/screen-cloner/index.js";
|
|
14
|
-
|
|
15
|
-
// ─── Public types ─────────────────────────────────────────────────────────────
|
|
16
|
-
|
|
17
|
-
export type Breakpoint = "mobile" | "tablet" | "desktop";
|
|
18
|
-
|
|
19
|
-
export interface UrlToFrameArgs {
|
|
20
|
-
url: string;
|
|
21
|
-
breakpoints: Array<Breakpoint>;
|
|
22
|
-
cloneMode: "pixel" | "system" | "adaptive";
|
|
23
|
-
addCompetitorAnnotations?: boolean;
|
|
24
|
-
dsGapReport?: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface BreakpointCapture {
|
|
28
|
-
breakpoint: Breakpoint;
|
|
29
|
-
width: number;
|
|
30
|
-
frameId: string;
|
|
31
|
-
screenshot: string;
|
|
32
|
-
dsCoverage: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface DsGapEntry {
|
|
36
|
-
pattern: string;
|
|
37
|
-
breakpoint: Breakpoint;
|
|
38
|
-
hasEquivalent: boolean;
|
|
39
|
-
suggestedComponent: string | null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface UrlToFrameResult {
|
|
43
|
-
url: string;
|
|
44
|
-
captures: BreakpointCapture[];
|
|
45
|
-
frameIds: string[];
|
|
46
|
-
screenshotsTaken: number;
|
|
47
|
-
dsCoveragePercentage: number;
|
|
48
|
-
dsGapReport: DsGapEntry[] | null;
|
|
49
|
-
competitorAnnotations: string[] | null;
|
|
50
|
-
logEntryId: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// ─── Breakpoint widths ────────────────────────────────────────────────────────
|
|
54
|
-
|
|
55
|
-
const BREAKPOINT_WIDTHS: Record<Breakpoint, number> = {
|
|
56
|
-
mobile: 375,
|
|
57
|
-
tablet: 768,
|
|
58
|
-
desktop: 1440,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// ─── Playwright screenshot capture ───────────────────────────────────────────
|
|
62
|
-
|
|
63
|
-
async function captureScreenshot(
|
|
64
|
-
page: Page,
|
|
65
|
-
url: string,
|
|
66
|
-
width: number
|
|
67
|
-
): Promise<string> {
|
|
68
|
-
await page.setViewportSize({ width, height: 900 });
|
|
69
|
-
await page.goto(url, { waitUntil: "networkidle", timeout: 30000 });
|
|
70
|
-
|
|
71
|
-
// Let lazy-loaded content settle
|
|
72
|
-
await page.waitForTimeout(1200);
|
|
73
|
-
|
|
74
|
-
const buffer = await page.screenshot({
|
|
75
|
-
type: "png",
|
|
76
|
-
fullPage: false,
|
|
77
|
-
clip: { x: 0, y: 0, width, height: 900 },
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
return `data:image/png;base64,${buffer.toString("base64")}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// ─── Figma: reposition frames side by side ────────────────────────────────────
|
|
84
|
-
|
|
85
|
-
function buildRepositionScript(
|
|
86
|
-
frameIds: string[],
|
|
87
|
-
frameWidths: number[],
|
|
88
|
-
gap = 32
|
|
89
|
-
): string {
|
|
90
|
-
const frameData = JSON.stringify(
|
|
91
|
-
frameIds.map((id, i) => ({ id, width: frameWidths[i] }))
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
return `
|
|
95
|
-
(async () => {
|
|
96
|
-
const frameData = ${frameData};
|
|
97
|
-
const gap = ${gap};
|
|
98
|
-
let xOffset = 0;
|
|
99
|
-
|
|
100
|
-
for (const { id, width } of frameData) {
|
|
101
|
-
const node = await figma.getNodeByIdAsync(id);
|
|
102
|
-
if (node) {
|
|
103
|
-
node.x = xOffset;
|
|
104
|
-
node.y = 0;
|
|
105
|
-
}
|
|
106
|
-
xOffset += width + gap;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const nodes = [];
|
|
110
|
-
for (const d of frameData) {
|
|
111
|
-
const n = await figma.getNodeByIdAsync(d.id);
|
|
112
|
-
if (n) nodes.push(n);
|
|
113
|
-
}
|
|
114
|
-
if (nodes.length > 0) figma.viewport.scrollAndZoomIntoView(nodes);
|
|
115
|
-
return { repositioned: nodes.length };
|
|
116
|
-
})();
|
|
117
|
-
`.trim();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// ─── Figma: add sticky annotation ────────────────────────────────────────────
|
|
121
|
-
|
|
122
|
-
function buildAnnotationScript(frameId: string, text: string, xOffset: number): string {
|
|
123
|
-
return `
|
|
124
|
-
(async () => {
|
|
125
|
-
const frame = await figma.getNodeByIdAsync(${JSON.stringify(frameId)});
|
|
126
|
-
if (!frame) return;
|
|
127
|
-
|
|
128
|
-
const sticky = figma.createSticky();
|
|
129
|
-
sticky.text.characters = ${JSON.stringify(text.slice(0, 500))};
|
|
130
|
-
sticky.x = frame.x;
|
|
131
|
-
sticky.y = (frame.absoluteBoundingBox ? frame.absoluteBoundingBox.y + frame.absoluteBoundingBox.height : frame.y + 900) + 24;
|
|
132
|
-
figma.currentPage.appendChild(sticky);
|
|
133
|
-
return { stickyId: sticky.id };
|
|
134
|
-
})();
|
|
135
|
-
`.trim();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// ─── Vision analysis for competitor annotations ───────────────────────────────
|
|
139
|
-
|
|
140
|
-
async function analyzeForAnnotations(
|
|
141
|
-
screenshots: Array<{ breakpoint: Breakpoint; screenshot: string }>,
|
|
142
|
-
vision: VisionClient
|
|
143
|
-
): Promise<string[]> {
|
|
144
|
-
const annotations: string[] = [];
|
|
145
|
-
|
|
146
|
-
for (const { breakpoint, screenshot } of screenshots) {
|
|
147
|
-
const result = await vision.analyze(
|
|
148
|
-
screenshot,
|
|
149
|
-
`You are a competitive UX analyst reviewing this ${breakpoint} screenshot.
|
|
150
|
-
Identify:
|
|
151
|
-
1. Key UX patterns used (navigation, CTAs, information architecture)
|
|
152
|
-
2. Strengths of this design approach
|
|
153
|
-
3. Weaknesses or friction points
|
|
154
|
-
4. Notable techniques or innovations
|
|
155
|
-
|
|
156
|
-
Return a concise bullet-point analysis (max 6 bullets). Start each bullet with a category tag like [STRENGTH], [WEAKNESS], [PATTERN], or [TECHNIQUE].`
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
const prefix = `[${breakpoint.toUpperCase()} Competitive Analysis]\n`;
|
|
160
|
-
annotations.push(prefix + result.rawAnalysis);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return annotations;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// ─── DS gap analysis ─────────────────────────────────────────────────────────
|
|
167
|
-
|
|
168
|
-
async function computeDsGapReport(
|
|
169
|
-
screenshots: Array<{ breakpoint: Breakpoint; screenshot: string }>,
|
|
170
|
-
vision: VisionClient
|
|
171
|
-
): Promise<DsGapEntry[]> {
|
|
172
|
-
const gaps: DsGapEntry[] = [];
|
|
173
|
-
|
|
174
|
-
for (const { breakpoint, screenshot } of screenshots) {
|
|
175
|
-
const result = await vision.analyze(
|
|
176
|
-
screenshot,
|
|
177
|
-
`Analyze this UI screenshot and identify all distinct UI patterns/components present.
|
|
178
|
-
For each pattern, output a JSON array item:
|
|
179
|
-
{ "pattern": "pattern name", "category": "navigation|form|content|feedback|layout|data" }
|
|
180
|
-
|
|
181
|
-
Return ONLY a valid JSON array, no markdown.`
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
let patterns: Array<{ pattern: string; category: string }> = [];
|
|
185
|
-
try {
|
|
186
|
-
const jsonMatch = result.rawAnalysis.match(/```(?:json)?\n?([\s\S]*?)\n?```/);
|
|
187
|
-
patterns = JSON.parse(jsonMatch ? jsonMatch[1] : result.rawAnalysis);
|
|
188
|
-
} catch {
|
|
189
|
-
// If parsing fails, extract pattern names from raw analysis
|
|
190
|
-
const lines = result.rawAnalysis.split("\n").filter((l) => l.trim().length > 2);
|
|
191
|
-
patterns = lines.slice(0, 10).map((l) => ({
|
|
192
|
-
pattern: l.replace(/^[-*•]\s*/, "").trim(),
|
|
193
|
-
category: "content",
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
for (const { pattern } of patterns) {
|
|
198
|
-
// Heuristic: check if DS likely has an equivalent
|
|
199
|
-
const dsKeywords = [
|
|
200
|
-
"button",
|
|
201
|
-
"input",
|
|
202
|
-
"card",
|
|
203
|
-
"nav",
|
|
204
|
-
"modal",
|
|
205
|
-
"badge",
|
|
206
|
-
"tab",
|
|
207
|
-
"list",
|
|
208
|
-
"table",
|
|
209
|
-
"form",
|
|
210
|
-
"header",
|
|
211
|
-
"footer",
|
|
212
|
-
"icon",
|
|
213
|
-
"avatar",
|
|
214
|
-
"chip",
|
|
215
|
-
"toast",
|
|
216
|
-
"tooltip",
|
|
217
|
-
];
|
|
218
|
-
const lp = pattern.toLowerCase();
|
|
219
|
-
const hasEquivalent = dsKeywords.some((kw) => lp.includes(kw));
|
|
220
|
-
const suggestedComponent = hasEquivalent
|
|
221
|
-
? pattern
|
|
222
|
-
.split(" ")
|
|
223
|
-
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
224
|
-
.join("")
|
|
225
|
-
: null;
|
|
226
|
-
|
|
227
|
-
gaps.push({ pattern, breakpoint, hasEquivalent, suggestedComponent });
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return gaps;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// ─── Coverage calculation ─────────────────────────────────────────────────────
|
|
235
|
-
|
|
236
|
-
function computeCoveragePercentage(captures: BreakpointCapture[]): number {
|
|
237
|
-
if (captures.length === 0) return 0;
|
|
238
|
-
const avg = captures.reduce((sum, c) => sum + c.dsCoverage, 0) / captures.length;
|
|
239
|
-
return Math.round(avg * 100) / 100;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// ─── Main handler ─────────────────────────────────────────────────────────────
|
|
243
|
-
|
|
244
|
-
export async function urlToFrameHandler(
|
|
245
|
-
args: UrlToFrameArgs
|
|
246
|
-
): Promise<UrlToFrameResult> {
|
|
247
|
-
const {
|
|
248
|
-
url,
|
|
249
|
-
breakpoints,
|
|
250
|
-
cloneMode,
|
|
251
|
-
addCompetitorAnnotations = false,
|
|
252
|
-
dsGapReport = false,
|
|
253
|
-
} = args;
|
|
254
|
-
|
|
255
|
-
if (!url) throw new Error("urlToFrame: `url` is required.");
|
|
256
|
-
if (!breakpoints || breakpoints.length === 0) {
|
|
257
|
-
throw new Error("urlToFrame: `breakpoints` must be a non-empty array.");
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const bridge = await getBridge();
|
|
261
|
-
const vision = new VisionClient();
|
|
262
|
-
|
|
263
|
-
// 1. Launch Playwright and capture screenshots
|
|
264
|
-
let browser: Browser | null = null;
|
|
265
|
-
const rawScreenshots: Array<{
|
|
266
|
-
breakpoint: Breakpoint;
|
|
267
|
-
width: number;
|
|
268
|
-
screenshot: string;
|
|
269
|
-
}> = [];
|
|
270
|
-
|
|
271
|
-
try {
|
|
272
|
-
browser = await chromium.launch({ headless: true });
|
|
273
|
-
const context = await browser.newContext({
|
|
274
|
-
userAgent:
|
|
275
|
-
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
|
276
|
-
});
|
|
277
|
-
const page = await context.newPage();
|
|
278
|
-
|
|
279
|
-
for (const bp of breakpoints) {
|
|
280
|
-
const width = BREAKPOINT_WIDTHS[bp];
|
|
281
|
-
const screenshot = await captureScreenshot(page, url, width);
|
|
282
|
-
rawScreenshots.push({ breakpoint: bp, width, screenshot });
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
await context.close();
|
|
286
|
-
} catch (err) {
|
|
287
|
-
throw new Error(
|
|
288
|
-
`urlToFrame: Playwright capture failed — ${err instanceof Error ? err.message : String(err)}`
|
|
289
|
-
);
|
|
290
|
-
} finally {
|
|
291
|
-
if (browser) await browser.close();
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// 2. Run screen-cloner pipeline for each screenshot
|
|
295
|
-
const captures: BreakpointCapture[] = [];
|
|
296
|
-
|
|
297
|
-
for (const { breakpoint, width, screenshot } of rawScreenshots) {
|
|
298
|
-
try {
|
|
299
|
-
const clonerResult = await screenClonerHandler({
|
|
300
|
-
image: screenshot,
|
|
301
|
-
cloneMode,
|
|
302
|
-
frameWidth: width,
|
|
303
|
-
annotateUnmatched: false,
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
const dsCoverage =
|
|
307
|
-
clonerResult.zones > 0
|
|
308
|
-
? (clonerResult.matched / clonerResult.zones) * 100
|
|
309
|
-
: 0;
|
|
310
|
-
|
|
311
|
-
captures.push({
|
|
312
|
-
breakpoint,
|
|
313
|
-
width,
|
|
314
|
-
frameId: clonerResult.frameId,
|
|
315
|
-
screenshot,
|
|
316
|
-
dsCoverage: Math.round(dsCoverage * 10) / 10,
|
|
317
|
-
});
|
|
318
|
-
} catch (err) {
|
|
319
|
-
console.error(
|
|
320
|
-
`urlToFrame: screen-cloner failed for ${breakpoint}: ${err instanceof Error ? err.message : String(err)}`
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (captures.length === 0) {
|
|
326
|
-
throw new Error("urlToFrame: No frames were created — all screen-cloner calls failed.");
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// 3. Reposition frames side by side with 32px gap
|
|
330
|
-
const frameIds = captures.map((c) => c.frameId);
|
|
331
|
-
const frameWidths = captures.map((c) => c.width);
|
|
332
|
-
const repositionScript = buildRepositionScript(frameIds, frameWidths, 32);
|
|
333
|
-
await bridge.execute(repositionScript);
|
|
334
|
-
|
|
335
|
-
// 4. Optionally add competitor annotations
|
|
336
|
-
let competitorAnnotations: string[] | null = null;
|
|
337
|
-
if (addCompetitorAnnotations) {
|
|
338
|
-
const screenshotsForAnalysis = rawScreenshots.map((s) => ({
|
|
339
|
-
breakpoint: s.breakpoint,
|
|
340
|
-
screenshot: s.screenshot,
|
|
341
|
-
}));
|
|
342
|
-
competitorAnnotations = await analyzeForAnnotations(screenshotsForAnalysis, vision);
|
|
343
|
-
|
|
344
|
-
let xOffset = 0;
|
|
345
|
-
for (let i = 0; i < captures.length; i++) {
|
|
346
|
-
const annotation = competitorAnnotations[i] ?? "";
|
|
347
|
-
if (annotation) {
|
|
348
|
-
const annotationScript = buildAnnotationScript(
|
|
349
|
-
captures[i].frameId,
|
|
350
|
-
annotation,
|
|
351
|
-
xOffset
|
|
352
|
-
);
|
|
353
|
-
await bridge.execute(annotationScript);
|
|
354
|
-
}
|
|
355
|
-
xOffset += captures[i].width + 32;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// 5. Optionally compute DS gap report
|
|
360
|
-
let gapReport: DsGapEntry[] | null = null;
|
|
361
|
-
if (dsGapReport) {
|
|
362
|
-
const screenshotsForGap = rawScreenshots.map((s) => ({
|
|
363
|
-
breakpoint: s.breakpoint,
|
|
364
|
-
screenshot: s.screenshot,
|
|
365
|
-
}));
|
|
366
|
-
gapReport = await computeDsGapReport(screenshotsForGap, vision);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// 6. Compute overall DS coverage
|
|
370
|
-
const dsCoveragePercentage = computeCoveragePercentage(captures);
|
|
371
|
-
|
|
372
|
-
// 7. Log the decision
|
|
373
|
-
const logEntry = await decisionLog.log({
|
|
374
|
-
tool: "url-to-frame",
|
|
375
|
-
nodeIds: frameIds,
|
|
376
|
-
rationale: `Captured ${captures.length} breakpoint(s) from "${url}" and cloned into Figma frames using "${cloneMode}" mode. Breakpoints: ${captures.map((c) => `${c.breakpoint} (${c.width}px)`).join(", ")}. Overall DS coverage: ${dsCoveragePercentage}%. Competitor annotations: ${addCompetitorAnnotations}. DS gap report: ${dsGapReport}.`,
|
|
377
|
-
tokens: [],
|
|
378
|
-
reversible: true,
|
|
379
|
-
metadata: {
|
|
380
|
-
url,
|
|
381
|
-
breakpoints,
|
|
382
|
-
cloneMode,
|
|
383
|
-
addCompetitorAnnotations,
|
|
384
|
-
dsGapReport,
|
|
385
|
-
screenshotsTaken: captures.length,
|
|
386
|
-
dsCoveragePercentage,
|
|
387
|
-
gapEntries: gapReport?.length ?? 0,
|
|
388
|
-
},
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
return {
|
|
392
|
-
url,
|
|
393
|
-
captures,
|
|
394
|
-
frameIds,
|
|
395
|
-
screenshotsTaken: captures.length,
|
|
396
|
-
dsCoveragePercentage,
|
|
397
|
-
dsGapReport: gapReport,
|
|
398
|
-
competitorAnnotations,
|
|
399
|
-
logEntryId: logEntry.id,
|
|
400
|
-
};
|
|
401
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
-
// CSS Animations Code Generator
|
|
3
|
-
// Generates @keyframes and animation CSS from AnimationSpec entries.
|
|
4
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
import type { AnimationSpec } from "./framer-motion.js";
|
|
7
|
-
|
|
8
|
-
const EASING_CSS_MAP: Record<string, string> = {
|
|
9
|
-
EASE_IN: "cubic-bezier(0.4, 0, 1, 1)",
|
|
10
|
-
EASE_OUT: "cubic-bezier(0, 0, 0.2, 1)",
|
|
11
|
-
EASE_IN_OUT: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
12
|
-
LINEAR: "cubic-bezier(0, 0, 1, 1)",
|
|
13
|
-
SPRING: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
function getSlideAxis(type: string, dir: string): { axis: "x" | "y"; sign: number } {
|
|
17
|
-
const isOut = type === "SLIDE_OUT" || type === "MOVE_OUT";
|
|
18
|
-
if (dir === "LEFT") return { axis: "x", sign: isOut ? -1 : 1 };
|
|
19
|
-
if (dir === "RIGHT") return { axis: "x", sign: isOut ? 1 : -1 };
|
|
20
|
-
if (dir === "UP") return { axis: "y", sign: isOut ? -1 : 1 };
|
|
21
|
-
return { axis: "y", sign: isOut ? 1 : -1 };
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function generateCSS(specs: AnimationSpec[]): string {
|
|
25
|
-
const lines: string[] = [
|
|
26
|
-
"/* Generated by figma-intelligence-layer animation-specifier */",
|
|
27
|
-
"",
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
for (const spec of specs) {
|
|
31
|
-
const type = spec.type.toUpperCase();
|
|
32
|
-
const dir = spec.direction.toUpperCase();
|
|
33
|
-
const name = spec.name;
|
|
34
|
-
const durationMs = Math.round(spec.duration * 1000);
|
|
35
|
-
const easingCss = EASING_CSS_MAP[spec.easing] ?? "ease-in-out";
|
|
36
|
-
|
|
37
|
-
if (type === "DISSOLVE") {
|
|
38
|
-
lines.push(`@keyframes ${name}FadeIn {`);
|
|
39
|
-
lines.push(` from { opacity: 0; }`);
|
|
40
|
-
lines.push(` to { opacity: 1; }`);
|
|
41
|
-
lines.push(`}`);
|
|
42
|
-
lines.push(`.${name} { animation: ${name}FadeIn ${durationMs}ms ${easingCss} forwards; }`);
|
|
43
|
-
} else if (type === "SMART_ANIMATE") {
|
|
44
|
-
lines.push(`@keyframes ${name}Morph {`);
|
|
45
|
-
lines.push(` from { opacity: 0; transform: scale(0.95); }`);
|
|
46
|
-
lines.push(` to { opacity: 1; transform: scale(1); }`);
|
|
47
|
-
lines.push(`}`);
|
|
48
|
-
lines.push(`.${name} { animation: ${name}Morph ${durationMs}ms ${easingCss} forwards; }`);
|
|
49
|
-
} else if (["PUSH", "SLIDE_IN", "SLIDE_OUT", "MOVE_IN", "MOVE_OUT"].includes(type)) {
|
|
50
|
-
const { axis, sign } = getSlideAxis(type, dir);
|
|
51
|
-
const translateFn = axis === "x" ? "translateX" : "translateY";
|
|
52
|
-
lines.push(`@keyframes ${name}SlideIn {`);
|
|
53
|
-
lines.push(` from { opacity: 0; transform: ${translateFn}(${sign * 100}%); }`);
|
|
54
|
-
lines.push(` to { opacity: 1; transform: ${translateFn}(0); }`);
|
|
55
|
-
lines.push(`}`);
|
|
56
|
-
lines.push(`.${name} { animation: ${name}SlideIn ${durationMs}ms ${easingCss} forwards; }`);
|
|
57
|
-
} else {
|
|
58
|
-
lines.push(`@keyframes ${name} {`);
|
|
59
|
-
lines.push(` from { opacity: 0; }`);
|
|
60
|
-
lines.push(` to { opacity: 1; }`);
|
|
61
|
-
lines.push(`}`);
|
|
62
|
-
lines.push(`.${name} { animation: ${name} ${durationMs}ms ${easingCss} forwards; }`);
|
|
63
|
-
}
|
|
64
|
-
lines.push("");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return lines.join("\n");
|
|
68
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
-
// Framer Motion Code Generator
|
|
3
|
-
// Generates Framer Motion `Variants` objects from AnimationSpec entries.
|
|
4
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
export interface AnimationSpec {
|
|
7
|
-
name: string;
|
|
8
|
-
fromId: string;
|
|
9
|
-
toId: string;
|
|
10
|
-
duration: number;
|
|
11
|
-
easing: string;
|
|
12
|
-
easingValues: number[];
|
|
13
|
-
direction: string;
|
|
14
|
-
type: string;
|
|
15
|
-
isSpring: boolean;
|
|
16
|
-
springStiffness?: number;
|
|
17
|
-
springDamping?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function getClosedVariant(spec: AnimationSpec): Record<string, unknown> {
|
|
21
|
-
const closed: Record<string, unknown> = { opacity: 0 };
|
|
22
|
-
const type = spec.type.toUpperCase();
|
|
23
|
-
|
|
24
|
-
if (type === "SMART_ANIMATE") {
|
|
25
|
-
closed["scale"] = 0.96;
|
|
26
|
-
} else if (type === "PUSH" || type === "SLIDE_IN" || type === "MOVE_IN") {
|
|
27
|
-
const dir = spec.direction.toUpperCase();
|
|
28
|
-
if (dir === "LEFT") closed["x"] = -100;
|
|
29
|
-
else if (dir === "RIGHT") closed["x"] = 100;
|
|
30
|
-
else if (dir === "UP") closed["y"] = -100;
|
|
31
|
-
else closed["y"] = 100;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return closed;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function generateFramerMotion(specs: AnimationSpec[]): string {
|
|
38
|
-
const lines: string[] = [
|
|
39
|
-
"// Generated by figma-intelligence-layer animation-specifier",
|
|
40
|
-
'import { Variants } from "framer-motion";',
|
|
41
|
-
"",
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
for (const spec of specs) {
|
|
45
|
-
const varName = `${spec.name}Variants`;
|
|
46
|
-
const closedVariant = getClosedVariant(spec);
|
|
47
|
-
const openVariant: Record<string, unknown> = { opacity: 1 };
|
|
48
|
-
|
|
49
|
-
for (const key of Object.keys(closedVariant)) {
|
|
50
|
-
if (key !== "opacity" && key !== "scale") openVariant[key] = 0;
|
|
51
|
-
if (key === "scale") openVariant[key] = 1;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
let transition: Record<string, unknown>;
|
|
55
|
-
if (spec.isSpring) {
|
|
56
|
-
transition = {
|
|
57
|
-
type: "spring",
|
|
58
|
-
stiffness: spec.springStiffness ?? 300,
|
|
59
|
-
damping: spec.springDamping ?? 30,
|
|
60
|
-
};
|
|
61
|
-
} else {
|
|
62
|
-
transition = { duration: spec.duration, ease: spec.easingValues };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
lines.push(`export const ${varName}: Variants = {`);
|
|
66
|
-
lines.push(` closed: ${JSON.stringify(closedVariant)},`);
|
|
67
|
-
lines.push(` open: {`);
|
|
68
|
-
lines.push(` ...${JSON.stringify(openVariant)},`);
|
|
69
|
-
lines.push(` transition: ${JSON.stringify(transition)},`);
|
|
70
|
-
lines.push(` },`);
|
|
71
|
-
lines.push(`};`);
|
|
72
|
-
lines.push("");
|
|
73
|
-
lines.push(`// Usage: <motion.div variants={${varName}} initial="closed" animate="open" />`);
|
|
74
|
-
lines.push("");
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return lines.join("\n");
|
|
78
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
-
// Swift Animations Code Generator
|
|
3
|
-
// Generates SwiftUI and UIKit animation code from AnimationSpec entries.
|
|
4
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
import type { AnimationSpec } from "./framer-motion.js";
|
|
7
|
-
|
|
8
|
-
const EASING_SWIFT_MAP: Record<string, string> = {
|
|
9
|
-
EASE_IN: ".easeIn",
|
|
10
|
-
EASE_OUT: ".easeOut",
|
|
11
|
-
EASE_IN_OUT: ".easeInOut",
|
|
12
|
-
LINEAR: ".linear",
|
|
13
|
-
SPRING: ".spring(response: 0.4, dampingFraction: 0.7)",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export function generateSwift(specs: AnimationSpec[]): string {
|
|
17
|
-
const lines: string[] = [
|
|
18
|
-
"// Generated by figma-intelligence-layer animation-specifier",
|
|
19
|
-
"import SwiftUI",
|
|
20
|
-
"import UIKit",
|
|
21
|
-
"",
|
|
22
|
-
"// MARK: - SwiftUI Animations",
|
|
23
|
-
"",
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
for (const spec of specs) {
|
|
27
|
-
const type = spec.type.toUpperCase();
|
|
28
|
-
const dir = spec.direction.toUpperCase();
|
|
29
|
-
const swiftEasing = EASING_SWIFT_MAP[spec.easing] ?? ".easeInOut";
|
|
30
|
-
const durationStr = spec.duration.toFixed(3);
|
|
31
|
-
const name = spec.name;
|
|
32
|
-
|
|
33
|
-
lines.push(`// Transition: ${spec.fromId} → ${spec.toId}`);
|
|
34
|
-
|
|
35
|
-
if (spec.isSpring) {
|
|
36
|
-
lines.push(`func ${name}Animation(isVisible: Binding<Bool>) -> some View {`);
|
|
37
|
-
lines.push(` content`);
|
|
38
|
-
lines.push(` .opacity(isVisible.wrappedValue ? 1 : 0)`);
|
|
39
|
-
lines.push(` .animation(.spring(response: ${durationStr}, dampingFraction: 0.7), value: isVisible.wrappedValue)`);
|
|
40
|
-
lines.push(`}`);
|
|
41
|
-
} else if (type === "DISSOLVE") {
|
|
42
|
-
lines.push(`func ${name}Animation(isVisible: Binding<Bool>) -> some View {`);
|
|
43
|
-
lines.push(` content`);
|
|
44
|
-
lines.push(` .opacity(isVisible.wrappedValue ? 1 : 0)`);
|
|
45
|
-
lines.push(` .animation(.easeInOut(duration: ${durationStr}), value: isVisible.wrappedValue)`);
|
|
46
|
-
lines.push(`}`);
|
|
47
|
-
} else if (type === "SMART_ANIMATE") {
|
|
48
|
-
lines.push(`func ${name}Animation(isVisible: Binding<Bool>) -> some View {`);
|
|
49
|
-
lines.push(` content`);
|
|
50
|
-
lines.push(` .opacity(isVisible.wrappedValue ? 1 : 0)`);
|
|
51
|
-
lines.push(` .scaleEffect(isVisible.wrappedValue ? 1 : 0.95)`);
|
|
52
|
-
lines.push(` .animation(${swiftEasing}(duration: ${durationStr}), value: isVisible.wrappedValue)`);
|
|
53
|
-
lines.push(`}`);
|
|
54
|
-
} else if (["PUSH", "SLIDE_IN", "SLIDE_OUT", "MOVE_IN", "MOVE_OUT"].includes(type)) {
|
|
55
|
-
const isHorizontal = dir === "LEFT" || dir === "RIGHT";
|
|
56
|
-
const offsetEdge = dir === "LEFT" ? "-UIScreen.main.bounds.width"
|
|
57
|
-
: dir === "RIGHT" ? "UIScreen.main.bounds.width"
|
|
58
|
-
: dir === "UP" ? "-UIScreen.main.bounds.height"
|
|
59
|
-
: "UIScreen.main.bounds.height";
|
|
60
|
-
|
|
61
|
-
lines.push(`func ${name}Animation(isVisible: Binding<Bool>) -> some View {`);
|
|
62
|
-
lines.push(` content`);
|
|
63
|
-
lines.push(` .offset(${isHorizontal ? "x" : "y"}: isVisible.wrappedValue ? 0 : ${offsetEdge})`);
|
|
64
|
-
lines.push(` .opacity(isVisible.wrappedValue ? 1 : 0)`);
|
|
65
|
-
lines.push(` .animation(${swiftEasing}(duration: ${durationStr}), value: isVisible.wrappedValue)`);
|
|
66
|
-
lines.push(`}`);
|
|
67
|
-
} else {
|
|
68
|
-
lines.push(`func ${name}Animation(isVisible: Binding<Bool>) -> some View {`);
|
|
69
|
-
lines.push(` content`);
|
|
70
|
-
lines.push(` .opacity(isVisible.wrappedValue ? 1 : 0)`);
|
|
71
|
-
lines.push(` .animation(${swiftEasing}(duration: ${durationStr}), value: isVisible.wrappedValue)`);
|
|
72
|
-
lines.push(`}`);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
lines.push("");
|
|
76
|
-
|
|
77
|
-
// UIKit equivalent
|
|
78
|
-
lines.push(`// UIKit equivalent for ${name}`);
|
|
79
|
-
lines.push(`func ${name}UIKitAnimate(view: UIView, isShowing: Bool) {`);
|
|
80
|
-
if (spec.isSpring) {
|
|
81
|
-
lines.push(` let animator = UIViewPropertyAnimator(duration: ${durationStr}, dampingRatio: 0.7) {`);
|
|
82
|
-
} else {
|
|
83
|
-
lines.push(` let animator = UIViewPropertyAnimator(duration: ${durationStr}, curve: ${swiftEasing}) {`);
|
|
84
|
-
}
|
|
85
|
-
lines.push(` view.alpha = isShowing ? 1 : 0`);
|
|
86
|
-
lines.push(` }`);
|
|
87
|
-
lines.push(` animator.startAnimation()`);
|
|
88
|
-
lines.push(`}`);
|
|
89
|
-
lines.push("");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return lines.join("\n");
|
|
93
|
-
}
|