@muloka/figma-console-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +898 -0
- package/dist/apps/design-system-dashboard/scoring/accessibility.d.ts +14 -0
- package/dist/apps/design-system-dashboard/scoring/accessibility.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/accessibility.js +278 -0
- package/dist/apps/design-system-dashboard/scoring/accessibility.js.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/component-metadata.d.ts +29 -0
- package/dist/apps/design-system-dashboard/scoring/component-metadata.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/component-metadata.js +358 -0
- package/dist/apps/design-system-dashboard/scoring/component-metadata.js.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/consistency.d.ts +14 -0
- package/dist/apps/design-system-dashboard/scoring/consistency.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/consistency.js +342 -0
- package/dist/apps/design-system-dashboard/scoring/consistency.js.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/coverage.d.ts +14 -0
- package/dist/apps/design-system-dashboard/scoring/coverage.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/coverage.js +231 -0
- package/dist/apps/design-system-dashboard/scoring/coverage.js.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/engine.d.ts +27 -0
- package/dist/apps/design-system-dashboard/scoring/engine.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/engine.js +93 -0
- package/dist/apps/design-system-dashboard/scoring/engine.js.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/naming-semantics.d.ts +14 -0
- package/dist/apps/design-system-dashboard/scoring/naming-semantics.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/naming-semantics.js +309 -0
- package/dist/apps/design-system-dashboard/scoring/naming-semantics.js.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/token-architecture.d.ts +14 -0
- package/dist/apps/design-system-dashboard/scoring/token-architecture.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/token-architecture.js +350 -0
- package/dist/apps/design-system-dashboard/scoring/token-architecture.js.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/types.d.ts +89 -0
- package/dist/apps/design-system-dashboard/scoring/types.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/scoring/types.js +41 -0
- package/dist/apps/design-system-dashboard/scoring/types.js.map +1 -0
- package/dist/apps/design-system-dashboard/server.d.ts +24 -0
- package/dist/apps/design-system-dashboard/server.d.ts.map +1 -0
- package/dist/apps/design-system-dashboard/server.js +160 -0
- package/dist/apps/design-system-dashboard/server.js.map +1 -0
- package/dist/apps/token-browser/server.d.ts +26 -0
- package/dist/apps/token-browser/server.d.ts.map +1 -0
- package/dist/apps/token-browser/server.js +137 -0
- package/dist/apps/token-browser/server.js.map +1 -0
- package/dist/browser/base.d.ts +58 -0
- package/dist/browser/base.d.ts.map +1 -0
- package/dist/browser/base.js +6 -0
- package/dist/browser/base.js.map +1 -0
- package/dist/browser/local.d.ts +87 -0
- package/dist/browser/local.d.ts.map +1 -0
- package/dist/browser/local.js +318 -0
- package/dist/browser/local.js.map +1 -0
- package/dist/cloudflare/apps/design-system-dashboard/scoring/accessibility.js +277 -0
- package/dist/cloudflare/apps/design-system-dashboard/scoring/component-metadata.js +357 -0
- package/dist/cloudflare/apps/design-system-dashboard/scoring/consistency.js +341 -0
- package/dist/cloudflare/apps/design-system-dashboard/scoring/coverage.js +230 -0
- package/dist/cloudflare/apps/design-system-dashboard/scoring/engine.js +92 -0
- package/dist/cloudflare/apps/design-system-dashboard/scoring/naming-semantics.js +308 -0
- package/dist/cloudflare/apps/design-system-dashboard/scoring/token-architecture.js +349 -0
- package/dist/cloudflare/apps/design-system-dashboard/scoring/types.js +40 -0
- package/dist/cloudflare/apps/design-system-dashboard/server.js +159 -0
- package/dist/cloudflare/apps/token-browser/server.js +136 -0
- package/dist/cloudflare/browser-manager.js +157 -0
- package/dist/cloudflare/core/accessibility-tools.js +361 -0
- package/dist/cloudflare/core/annotation-tools.js +230 -0
- package/dist/cloudflare/core/cloud-websocket-connector.js +419 -0
- package/dist/cloudflare/core/cloud-websocket-relay.js +198 -0
- package/dist/cloudflare/core/comment-tools.js +292 -0
- package/dist/cloudflare/core/config.js +153 -0
- package/dist/cloudflare/core/console-monitor.js +427 -0
- package/dist/cloudflare/core/deep-component-tools.js +128 -0
- package/dist/cloudflare/core/design-code-tools.js +2793 -0
- package/dist/cloudflare/core/design-system-manifest.js +265 -0
- package/dist/cloudflare/core/design-system-tools.js +882 -0
- package/dist/cloudflare/core/diagnose-tool.js +100 -0
- package/dist/cloudflare/core/diff/changelog-formatter.js +275 -0
- package/dist/cloudflare/core/diff/diff-engine.js +334 -0
- package/dist/cloudflare/core/diff/property-compare.js +36 -0
- package/dist/cloudflare/core/diff/version-cache.js +74 -0
- package/dist/cloudflare/core/enrichment/enrichment-service.js +374 -0
- package/dist/cloudflare/core/enrichment/index.js +7 -0
- package/dist/cloudflare/core/enrichment/relationship-mapper.js +351 -0
- package/dist/cloudflare/core/enrichment/style-resolver.js +346 -0
- package/dist/cloudflare/core/figjam-tools.js +547 -0
- package/dist/cloudflare/core/figma-api.js +509 -0
- package/dist/cloudflare/core/figma-connector.js +7 -0
- package/dist/cloudflare/core/figma-reconstruction-spec.js +402 -0
- package/dist/cloudflare/core/figma-style-extractor.js +311 -0
- package/dist/cloudflare/core/figma-tools.js +3302 -0
- package/dist/cloudflare/core/identity.js +96 -0
- package/dist/cloudflare/core/library-tools.js +580 -0
- package/dist/cloudflare/core/logger.js +53 -0
- package/dist/cloudflare/core/port-discovery.js +935 -0
- package/dist/cloudflare/core/resolve-package-root.js +11 -0
- package/dist/cloudflare/core/slides-tools.js +714 -0
- package/dist/cloudflare/core/slot-tools.js +334 -0
- package/dist/cloudflare/core/snippet-injector.js +96 -0
- package/dist/cloudflare/core/tokens/alias-resolver.js +205 -0
- package/dist/cloudflare/core/tokens/config.js +294 -0
- package/dist/cloudflare/core/tokens/dialect.js +232 -0
- package/dist/cloudflare/core/tokens/figma-converter.js +323 -0
- package/dist/cloudflare/core/tokens/formatters/css-vars.js +338 -0
- package/dist/cloudflare/core/tokens/formatters/dtcg.js +376 -0
- package/dist/cloudflare/core/tokens/formatters/index.js +45 -0
- package/dist/cloudflare/core/tokens/formatters/json.js +205 -0
- package/dist/cloudflare/core/tokens/formatters/less.js +4 -0
- package/dist/cloudflare/core/tokens/formatters/scss.js +258 -0
- package/dist/cloudflare/core/tokens/formatters/stubs.js +13 -0
- package/dist/cloudflare/core/tokens/formatters/style-dictionary-v3.js +213 -0
- package/dist/cloudflare/core/tokens/formatters/tailwind-v3.js +237 -0
- package/dist/cloudflare/core/tokens/formatters/tailwind-v4.js +335 -0
- package/dist/cloudflare/core/tokens/formatters/tokens-studio.js +256 -0
- package/dist/cloudflare/core/tokens/formatters/ts-module.js +198 -0
- package/dist/cloudflare/core/tokens/index.js +16 -0
- package/dist/cloudflare/core/tokens/parsers/css-vars.js +4 -0
- package/dist/cloudflare/core/tokens/parsers/dtcg.js +280 -0
- package/dist/cloudflare/core/tokens/parsers/index.js +138 -0
- package/dist/cloudflare/core/tokens/parsers/json.js +7 -0
- package/dist/cloudflare/core/tokens/parsers/scss.js +4 -0
- package/dist/cloudflare/core/tokens/parsers/stubs.js +20 -0
- package/dist/cloudflare/core/tokens/parsers/style-dictionary-v3.js +4 -0
- package/dist/cloudflare/core/tokens/parsers/tailwind-v3.js +4 -0
- package/dist/cloudflare/core/tokens/parsers/tailwind-v4.js +4 -0
- package/dist/cloudflare/core/tokens/parsers/tokens-studio.js +4 -0
- package/dist/cloudflare/core/tokens/schemas.js +152 -0
- package/dist/cloudflare/core/tokens/transforms/color.js +12 -0
- package/dist/cloudflare/core/tokens/transforms/index.js +29 -0
- package/dist/cloudflare/core/tokens/transforms/size.js +7 -0
- package/dist/cloudflare/core/tokens/types.js +18 -0
- package/dist/cloudflare/core/tokens-tools.js +1788 -0
- package/dist/cloudflare/core/types/design-code.js +4 -0
- package/dist/cloudflare/core/types/enriched.js +5 -0
- package/dist/cloudflare/core/types/index.js +4 -0
- package/dist/cloudflare/core/variable-resolver.js +85 -0
- package/dist/cloudflare/core/version-tools.js +1199 -0
- package/dist/cloudflare/core/websocket-connector.js +436 -0
- package/dist/cloudflare/core/websocket-server.js +956 -0
- package/dist/cloudflare/core/write-tools.js +2506 -0
- package/dist/cloudflare/index.js +3010 -0
- package/dist/core/accessibility-tools.d.ts +21 -0
- package/dist/core/accessibility-tools.d.ts.map +1 -0
- package/dist/core/accessibility-tools.js +362 -0
- package/dist/core/accessibility-tools.js.map +1 -0
- package/dist/core/annotation-tools.d.ts +14 -0
- package/dist/core/annotation-tools.d.ts.map +1 -0
- package/dist/core/annotation-tools.js +231 -0
- package/dist/core/annotation-tools.js.map +1 -0
- package/dist/core/comment-tools.d.ts +11 -0
- package/dist/core/comment-tools.d.ts.map +1 -0
- package/dist/core/comment-tools.js +293 -0
- package/dist/core/comment-tools.js.map +1 -0
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +154 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/console-monitor.d.ts +82 -0
- package/dist/core/console-monitor.d.ts.map +1 -0
- package/dist/core/console-monitor.js +428 -0
- package/dist/core/console-monitor.js.map +1 -0
- package/dist/core/deep-component-tools.d.ts +14 -0
- package/dist/core/deep-component-tools.d.ts.map +1 -0
- package/dist/core/deep-component-tools.js +129 -0
- package/dist/core/deep-component-tools.js.map +1 -0
- package/dist/core/design-code-tools.d.ts +116 -0
- package/dist/core/design-code-tools.d.ts.map +1 -0
- package/dist/core/design-code-tools.js +2794 -0
- package/dist/core/design-code-tools.js.map +1 -0
- package/dist/core/design-system-manifest.d.ts +273 -0
- package/dist/core/design-system-manifest.d.ts.map +1 -0
- package/dist/core/design-system-manifest.js +266 -0
- package/dist/core/design-system-manifest.js.map +1 -0
- package/dist/core/design-system-tools.d.ts +67 -0
- package/dist/core/design-system-tools.d.ts.map +1 -0
- package/dist/core/design-system-tools.js +883 -0
- package/dist/core/design-system-tools.js.map +1 -0
- package/dist/core/diagnose-tool.d.ts +41 -0
- package/dist/core/diagnose-tool.d.ts.map +1 -0
- package/dist/core/diagnose-tool.js +101 -0
- package/dist/core/diagnose-tool.js.map +1 -0
- package/dist/core/diff/changelog-formatter.d.ts +35 -0
- package/dist/core/diff/changelog-formatter.d.ts.map +1 -0
- package/dist/core/diff/changelog-formatter.js +276 -0
- package/dist/core/diff/changelog-formatter.js.map +1 -0
- package/dist/core/diff/diff-engine.d.ts +127 -0
- package/dist/core/diff/diff-engine.d.ts.map +1 -0
- package/dist/core/diff/diff-engine.js +335 -0
- package/dist/core/diff/diff-engine.js.map +1 -0
- package/dist/core/diff/property-compare.d.ts +19 -0
- package/dist/core/diff/property-compare.d.ts.map +1 -0
- package/dist/core/diff/property-compare.js +37 -0
- package/dist/core/diff/property-compare.js.map +1 -0
- package/dist/core/diff/version-cache.d.ts +40 -0
- package/dist/core/diff/version-cache.d.ts.map +1 -0
- package/dist/core/diff/version-cache.js +75 -0
- package/dist/core/diff/version-cache.js.map +1 -0
- package/dist/core/enrichment/enrichment-service.d.ts +52 -0
- package/dist/core/enrichment/enrichment-service.d.ts.map +1 -0
- package/dist/core/enrichment/enrichment-service.js +375 -0
- package/dist/core/enrichment/enrichment-service.js.map +1 -0
- package/dist/core/enrichment/index.d.ts +8 -0
- package/dist/core/enrichment/index.d.ts.map +1 -0
- package/dist/core/enrichment/index.js +8 -0
- package/dist/core/enrichment/index.js.map +1 -0
- package/dist/core/enrichment/relationship-mapper.d.ts +106 -0
- package/dist/core/enrichment/relationship-mapper.d.ts.map +1 -0
- package/dist/core/enrichment/relationship-mapper.js +352 -0
- package/dist/core/enrichment/relationship-mapper.js.map +1 -0
- package/dist/core/enrichment/style-resolver.d.ts +85 -0
- package/dist/core/enrichment/style-resolver.d.ts.map +1 -0
- package/dist/core/enrichment/style-resolver.js +347 -0
- package/dist/core/enrichment/style-resolver.js.map +1 -0
- package/dist/core/figjam-tools.d.ts +8 -0
- package/dist/core/figjam-tools.d.ts.map +1 -0
- package/dist/core/figjam-tools.js +548 -0
- package/dist/core/figjam-tools.js.map +1 -0
- package/dist/core/figma-api.d.ts +254 -0
- package/dist/core/figma-api.d.ts.map +1 -0
- package/dist/core/figma-api.js +510 -0
- package/dist/core/figma-api.js.map +1 -0
- package/dist/core/figma-connector.d.ts +214 -0
- package/dist/core/figma-connector.d.ts.map +1 -0
- package/dist/core/figma-connector.js +8 -0
- package/dist/core/figma-connector.js.map +1 -0
- package/dist/core/figma-desktop-connector.d.ts +312 -0
- package/dist/core/figma-desktop-connector.d.ts.map +1 -0
- package/dist/core/figma-desktop-connector.js +1298 -0
- package/dist/core/figma-desktop-connector.js.map +1 -0
- package/dist/core/figma-reconstruction-spec.d.ts +166 -0
- package/dist/core/figma-reconstruction-spec.d.ts.map +1 -0
- package/dist/core/figma-reconstruction-spec.js +403 -0
- package/dist/core/figma-reconstruction-spec.js.map +1 -0
- package/dist/core/figma-style-extractor.d.ts +76 -0
- package/dist/core/figma-style-extractor.d.ts.map +1 -0
- package/dist/core/figma-style-extractor.js +312 -0
- package/dist/core/figma-style-extractor.js.map +1 -0
- package/dist/core/figma-tools.d.ts +22 -0
- package/dist/core/figma-tools.d.ts.map +1 -0
- package/dist/core/figma-tools.js +3303 -0
- package/dist/core/figma-tools.js.map +1 -0
- package/dist/core/identity.d.ts +41 -0
- package/dist/core/identity.d.ts.map +1 -0
- package/dist/core/identity.js +97 -0
- package/dist/core/identity.js.map +1 -0
- package/dist/core/library-tools.d.ts +17 -0
- package/dist/core/library-tools.d.ts.map +1 -0
- package/dist/core/library-tools.js +581 -0
- package/dist/core/library-tools.js.map +1 -0
- package/dist/core/logger.d.ts +22 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +54 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/port-discovery.d.ts +211 -0
- package/dist/core/port-discovery.d.ts.map +1 -0
- package/dist/core/port-discovery.js +936 -0
- package/dist/core/port-discovery.js.map +1 -0
- package/dist/core/resolve-package-root.d.ts +2 -0
- package/dist/core/resolve-package-root.d.ts.map +1 -0
- package/dist/core/resolve-package-root.js +12 -0
- package/dist/core/resolve-package-root.js.map +1 -0
- package/dist/core/slides-tools.d.ts +8 -0
- package/dist/core/slides-tools.d.ts.map +1 -0
- package/dist/core/slides-tools.js +715 -0
- package/dist/core/slides-tools.js.map +1 -0
- package/dist/core/slot-tools.d.ts +7 -0
- package/dist/core/slot-tools.d.ts.map +1 -0
- package/dist/core/slot-tools.js +335 -0
- package/dist/core/slot-tools.js.map +1 -0
- package/dist/core/snippet-injector.d.ts +24 -0
- package/dist/core/snippet-injector.d.ts.map +1 -0
- package/dist/core/snippet-injector.js +97 -0
- package/dist/core/snippet-injector.js.map +1 -0
- package/dist/core/tokens/alias-resolver.d.ts +97 -0
- package/dist/core/tokens/alias-resolver.d.ts.map +1 -0
- package/dist/core/tokens/alias-resolver.js +206 -0
- package/dist/core/tokens/alias-resolver.js.map +1 -0
- package/dist/core/tokens/config.d.ts +380 -0
- package/dist/core/tokens/config.d.ts.map +1 -0
- package/dist/core/tokens/config.js +295 -0
- package/dist/core/tokens/config.js.map +1 -0
- package/dist/core/tokens/dialect.d.ts +107 -0
- package/dist/core/tokens/dialect.d.ts.map +1 -0
- package/dist/core/tokens/dialect.js +233 -0
- package/dist/core/tokens/dialect.js.map +1 -0
- package/dist/core/tokens/figma-converter.d.ts +102 -0
- package/dist/core/tokens/figma-converter.d.ts.map +1 -0
- package/dist/core/tokens/figma-converter.js +324 -0
- package/dist/core/tokens/figma-converter.js.map +1 -0
- package/dist/core/tokens/formatters/css-vars.d.ts +24 -0
- package/dist/core/tokens/formatters/css-vars.d.ts.map +1 -0
- package/dist/core/tokens/formatters/css-vars.js +339 -0
- package/dist/core/tokens/formatters/css-vars.js.map +1 -0
- package/dist/core/tokens/formatters/dtcg.d.ts +28 -0
- package/dist/core/tokens/formatters/dtcg.d.ts.map +1 -0
- package/dist/core/tokens/formatters/dtcg.js +377 -0
- package/dist/core/tokens/formatters/dtcg.js.map +1 -0
- package/dist/core/tokens/formatters/index.d.ts +30 -0
- package/dist/core/tokens/formatters/index.d.ts.map +1 -0
- package/dist/core/tokens/formatters/index.js +46 -0
- package/dist/core/tokens/formatters/index.js.map +1 -0
- package/dist/core/tokens/formatters/json.d.ts +37 -0
- package/dist/core/tokens/formatters/json.d.ts.map +1 -0
- package/dist/core/tokens/formatters/json.js +206 -0
- package/dist/core/tokens/formatters/json.js.map +1 -0
- package/dist/core/tokens/formatters/less.d.ts +4 -0
- package/dist/core/tokens/formatters/less.d.ts.map +1 -0
- package/dist/core/tokens/formatters/less.js +5 -0
- package/dist/core/tokens/formatters/less.js.map +1 -0
- package/dist/core/tokens/formatters/scss.d.ts +26 -0
- package/dist/core/tokens/formatters/scss.d.ts.map +1 -0
- package/dist/core/tokens/formatters/scss.js +259 -0
- package/dist/core/tokens/formatters/scss.js.map +1 -0
- package/dist/core/tokens/formatters/stubs.d.ts +9 -0
- package/dist/core/tokens/formatters/stubs.d.ts.map +1 -0
- package/dist/core/tokens/formatters/stubs.js +14 -0
- package/dist/core/tokens/formatters/stubs.js.map +1 -0
- package/dist/core/tokens/formatters/style-dictionary-v3.d.ts +45 -0
- package/dist/core/tokens/formatters/style-dictionary-v3.d.ts.map +1 -0
- package/dist/core/tokens/formatters/style-dictionary-v3.js +214 -0
- package/dist/core/tokens/formatters/style-dictionary-v3.js.map +1 -0
- package/dist/core/tokens/formatters/tailwind-v3.d.ts +37 -0
- package/dist/core/tokens/formatters/tailwind-v3.d.ts.map +1 -0
- package/dist/core/tokens/formatters/tailwind-v3.js +238 -0
- package/dist/core/tokens/formatters/tailwind-v3.js.map +1 -0
- package/dist/core/tokens/formatters/tailwind-v4.d.ts +41 -0
- package/dist/core/tokens/formatters/tailwind-v4.d.ts.map +1 -0
- package/dist/core/tokens/formatters/tailwind-v4.js +336 -0
- package/dist/core/tokens/formatters/tailwind-v4.js.map +1 -0
- package/dist/core/tokens/formatters/tokens-studio.d.ts +44 -0
- package/dist/core/tokens/formatters/tokens-studio.d.ts.map +1 -0
- package/dist/core/tokens/formatters/tokens-studio.js +257 -0
- package/dist/core/tokens/formatters/tokens-studio.js.map +1 -0
- package/dist/core/tokens/formatters/ts-module.d.ts +35 -0
- package/dist/core/tokens/formatters/ts-module.d.ts.map +1 -0
- package/dist/core/tokens/formatters/ts-module.js +199 -0
- package/dist/core/tokens/formatters/ts-module.js.map +1 -0
- package/dist/core/tokens/index.d.ts +18 -0
- package/dist/core/tokens/index.d.ts.map +1 -0
- package/dist/core/tokens/index.js +17 -0
- package/dist/core/tokens/index.js.map +1 -0
- package/dist/core/tokens/parsers/css-vars.d.ts +3 -0
- package/dist/core/tokens/parsers/css-vars.d.ts.map +1 -0
- package/dist/core/tokens/parsers/css-vars.js +5 -0
- package/dist/core/tokens/parsers/css-vars.js.map +1 -0
- package/dist/core/tokens/parsers/dtcg.d.ts +21 -0
- package/dist/core/tokens/parsers/dtcg.d.ts.map +1 -0
- package/dist/core/tokens/parsers/dtcg.js +281 -0
- package/dist/core/tokens/parsers/dtcg.js.map +1 -0
- package/dist/core/tokens/parsers/index.d.ts +37 -0
- package/dist/core/tokens/parsers/index.d.ts.map +1 -0
- package/dist/core/tokens/parsers/index.js +139 -0
- package/dist/core/tokens/parsers/index.js.map +1 -0
- package/dist/core/tokens/parsers/json.d.ts +4 -0
- package/dist/core/tokens/parsers/json.d.ts.map +1 -0
- package/dist/core/tokens/parsers/json.js +8 -0
- package/dist/core/tokens/parsers/json.js.map +1 -0
- package/dist/core/tokens/parsers/scss.d.ts +3 -0
- package/dist/core/tokens/parsers/scss.d.ts.map +1 -0
- package/dist/core/tokens/parsers/scss.js +5 -0
- package/dist/core/tokens/parsers/scss.js.map +1 -0
- package/dist/core/tokens/parsers/stubs.d.ts +15 -0
- package/dist/core/tokens/parsers/stubs.d.ts.map +1 -0
- package/dist/core/tokens/parsers/stubs.js +21 -0
- package/dist/core/tokens/parsers/stubs.js.map +1 -0
- package/dist/core/tokens/parsers/style-dictionary-v3.d.ts +3 -0
- package/dist/core/tokens/parsers/style-dictionary-v3.d.ts.map +1 -0
- package/dist/core/tokens/parsers/style-dictionary-v3.js +5 -0
- package/dist/core/tokens/parsers/style-dictionary-v3.js.map +1 -0
- package/dist/core/tokens/parsers/tailwind-v3.d.ts +3 -0
- package/dist/core/tokens/parsers/tailwind-v3.d.ts.map +1 -0
- package/dist/core/tokens/parsers/tailwind-v3.js +5 -0
- package/dist/core/tokens/parsers/tailwind-v3.js.map +1 -0
- package/dist/core/tokens/parsers/tailwind-v4.d.ts +3 -0
- package/dist/core/tokens/parsers/tailwind-v4.d.ts.map +1 -0
- package/dist/core/tokens/parsers/tailwind-v4.js +5 -0
- package/dist/core/tokens/parsers/tailwind-v4.js.map +1 -0
- package/dist/core/tokens/parsers/tokens-studio.d.ts +3 -0
- package/dist/core/tokens/parsers/tokens-studio.d.ts.map +1 -0
- package/dist/core/tokens/parsers/tokens-studio.js +5 -0
- package/dist/core/tokens/parsers/tokens-studio.js.map +1 -0
- package/dist/core/tokens/schemas.d.ts +155 -0
- package/dist/core/tokens/schemas.d.ts.map +1 -0
- package/dist/core/tokens/schemas.js +153 -0
- package/dist/core/tokens/schemas.js.map +1 -0
- package/dist/core/tokens/transforms/color.d.ts +9 -0
- package/dist/core/tokens/transforms/color.d.ts.map +1 -0
- package/dist/core/tokens/transforms/color.js +13 -0
- package/dist/core/tokens/transforms/color.js.map +1 -0
- package/dist/core/tokens/transforms/index.d.ts +36 -0
- package/dist/core/tokens/transforms/index.d.ts.map +1 -0
- package/dist/core/tokens/transforms/index.js +30 -0
- package/dist/core/tokens/transforms/index.js.map +1 -0
- package/dist/core/tokens/transforms/size.d.ts +7 -0
- package/dist/core/tokens/transforms/size.d.ts.map +1 -0
- package/dist/core/tokens/transforms/size.js +8 -0
- package/dist/core/tokens/transforms/size.js.map +1 -0
- package/dist/core/tokens/types.d.ts +284 -0
- package/dist/core/tokens/types.d.ts.map +1 -0
- package/dist/core/tokens/types.js +19 -0
- package/dist/core/tokens/types.js.map +1 -0
- package/dist/core/tokens-tools.d.ts +285 -0
- package/dist/core/tokens-tools.d.ts.map +1 -0
- package/dist/core/tokens-tools.js +1789 -0
- package/dist/core/tokens-tools.js.map +1 -0
- package/dist/core/types/design-code.d.ts +271 -0
- package/dist/core/types/design-code.d.ts.map +1 -0
- package/dist/core/types/design-code.js +5 -0
- package/dist/core/types/design-code.js.map +1 -0
- package/dist/core/types/enriched.d.ts +213 -0
- package/dist/core/types/enriched.d.ts.map +1 -0
- package/dist/core/types/enriched.js +6 -0
- package/dist/core/types/enriched.js.map +1 -0
- package/dist/core/types/index.d.ts +104 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +5 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/variable-resolver.d.ts +45 -0
- package/dist/core/variable-resolver.d.ts.map +1 -0
- package/dist/core/variable-resolver.js +86 -0
- package/dist/core/variable-resolver.js.map +1 -0
- package/dist/core/version-tools.d.ts +59 -0
- package/dist/core/version-tools.d.ts.map +1 -0
- package/dist/core/version-tools.js +1200 -0
- package/dist/core/version-tools.js.map +1 -0
- package/dist/core/websocket-connector.d.ts +247 -0
- package/dist/core/websocket-connector.d.ts.map +1 -0
- package/dist/core/websocket-connector.js +437 -0
- package/dist/core/websocket-connector.js.map +1 -0
- package/dist/core/websocket-server.d.ts +290 -0
- package/dist/core/websocket-server.d.ts.map +1 -0
- package/dist/core/websocket-server.js +957 -0
- package/dist/core/websocket-server.js.map +1 -0
- package/dist/core/write-tools.d.ts +7 -0
- package/dist/core/write-tools.d.ts.map +1 -0
- package/dist/core/write-tools.js +2507 -0
- package/dist/core/write-tools.js.map +1 -0
- package/dist/local.d.ts +105 -0
- package/dist/local.d.ts.map +1 -0
- package/dist/local.js +3314 -0
- package/dist/local.js.map +1 -0
- package/figma-desktop-bridge/README.md +365 -0
- package/figma-desktop-bridge/code.js +7359 -0
- package/figma-desktop-bridge/icon.png +0 -0
- package/figma-desktop-bridge/manifest.json +67 -0
- package/figma-desktop-bridge/ui.html +2783 -0
- package/package.json +103 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert Figma's variables API response into our canonical TokenDocument.
|
|
3
|
+
*
|
|
4
|
+
* Input: the shape produced by `formatVariables()` in src/core/figma-api.ts
|
|
5
|
+
* (an object with `collections` and `variables` arrays, matching either the
|
|
6
|
+
* REST API's response or the Desktop Bridge plugin's `getLocalVariablesAsync`
|
|
7
|
+
* normalized payload).
|
|
8
|
+
*
|
|
9
|
+
* Output: a TokenDocument with one TokenSet per collection, paths derived
|
|
10
|
+
* from Figma variable names (slash-separated → path arrays), values
|
|
11
|
+
* normalized to our TokenValue shape, and Figma IDs preserved in
|
|
12
|
+
* $extensions["figma-console-mcp"] for round-trip non-destructiveness.
|
|
13
|
+
*/
|
|
14
|
+
import type { TokenDocument } from "./types.js";
|
|
15
|
+
/**
|
|
16
|
+
* Shape of Figma's variable collection as returned by formatVariables(). We
|
|
17
|
+
* use a narrow structural type rather than importing the existing `any`
|
|
18
|
+
* shape from figma-api.ts.
|
|
19
|
+
*/
|
|
20
|
+
interface FigmaCollection {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
key?: string;
|
|
24
|
+
modes: Array<{
|
|
25
|
+
modeId: string;
|
|
26
|
+
name: string;
|
|
27
|
+
}>;
|
|
28
|
+
variableIds: string[];
|
|
29
|
+
}
|
|
30
|
+
interface FigmaVariable {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
key?: string;
|
|
34
|
+
resolvedType: "COLOR" | "FLOAT" | "STRING" | "BOOLEAN" | "TIMING" | "EASING";
|
|
35
|
+
variableCollectionId: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
scopes?: string[];
|
|
38
|
+
/** Per-platform code syntax (WEB / ANDROID / iOS → string). */
|
|
39
|
+
codeSyntax?: Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Per-mode values. Each value is either a literal or a `{ type: "VARIABLE_ALIAS", id }`
|
|
42
|
+
* pointing at another variable.
|
|
43
|
+
*/
|
|
44
|
+
valuesByMode: Record<string, FigmaValue>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Config-2026 EASING variable value shape. `bezierValues` is present for
|
|
48
|
+
* bezier-based easings; spring easings carry `springValues` instead (and no
|
|
49
|
+
* usable bezier).
|
|
50
|
+
*/
|
|
51
|
+
interface FigmaEasingValue {
|
|
52
|
+
easingType?: string;
|
|
53
|
+
bezierValues?: {
|
|
54
|
+
p1x: number;
|
|
55
|
+
p1y: number;
|
|
56
|
+
p2x: number;
|
|
57
|
+
p2y: number;
|
|
58
|
+
};
|
|
59
|
+
springValues?: {
|
|
60
|
+
mass?: number;
|
|
61
|
+
stiffness?: number;
|
|
62
|
+
damping?: number;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
type FigmaValue = {
|
|
66
|
+
r: number;
|
|
67
|
+
g: number;
|
|
68
|
+
b: number;
|
|
69
|
+
a?: number;
|
|
70
|
+
} | number | string | boolean | FigmaEasingValue | VariableAlias;
|
|
71
|
+
interface VariableAlias {
|
|
72
|
+
type: "VARIABLE_ALIAS";
|
|
73
|
+
id: string;
|
|
74
|
+
}
|
|
75
|
+
export interface FigmaVariablesPayload {
|
|
76
|
+
collections: FigmaCollection[];
|
|
77
|
+
variables: FigmaVariable[];
|
|
78
|
+
}
|
|
79
|
+
export interface ConvertOptions {
|
|
80
|
+
/** Figma file key. Stored in document metadata. */
|
|
81
|
+
figmaFileKey?: string;
|
|
82
|
+
/** ISO timestamp to stamp the exportedAt field. Defaults to now. */
|
|
83
|
+
exportedAt?: string;
|
|
84
|
+
/** MCP version string. */
|
|
85
|
+
mcpVersion?: string;
|
|
86
|
+
/** Filter to specific collection IDs. Undefined or empty means all. */
|
|
87
|
+
collectionIds?: string[];
|
|
88
|
+
/** Filter to specific mode names. Undefined means all. */
|
|
89
|
+
modes?: string[] | "all";
|
|
90
|
+
/** Optional prefix that gets stripped from variable names on conversion. */
|
|
91
|
+
stripPrefix?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface ConvertResult {
|
|
94
|
+
document: TokenDocument;
|
|
95
|
+
warnings: string[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Convert a Figma variables payload to our canonical TokenDocument.
|
|
99
|
+
*/
|
|
100
|
+
export declare function convertFigmaVariablesToDocument(payload: FigmaVariablesPayload, opts?: ConvertOptions): ConvertResult;
|
|
101
|
+
export {};
|
|
102
|
+
//# sourceMappingURL=figma-converter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figma-converter.d.ts","sourceRoot":"","sources":["../../../src/core/tokens/figma-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAEV,aAAa,EAId,MAAM,YAAY,CAAC;AAIpB;;;;GAIG;AACH,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7E,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;I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0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,qBAAqB,EAC9B,IAAI,GAAE,cAAmB,GACxB,aAAa,CA4Cf"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert Figma's variables API response into our canonical TokenDocument.
|
|
3
|
+
*
|
|
4
|
+
* Input: the shape produced by `formatVariables()` in src/core/figma-api.ts
|
|
5
|
+
* (an object with `collections` and `variables` arrays, matching either the
|
|
6
|
+
* REST API's response or the Desktop Bridge plugin's `getLocalVariablesAsync`
|
|
7
|
+
* normalized payload).
|
|
8
|
+
*
|
|
9
|
+
* Output: a TokenDocument with one TokenSet per collection, paths derived
|
|
10
|
+
* from Figma variable names (slash-separated → path arrays), values
|
|
11
|
+
* normalized to our TokenValue shape, and Figma IDs preserved in
|
|
12
|
+
* $extensions["figma-console-mcp"] for round-trip non-destructiveness.
|
|
13
|
+
*/
|
|
14
|
+
import { slugifySetName } from "./alias-resolver.js";
|
|
15
|
+
import { stripRawColorFromValues } from "./dialect.js";
|
|
16
|
+
/**
|
|
17
|
+
* Convert a Figma variables payload to our canonical TokenDocument.
|
|
18
|
+
*/
|
|
19
|
+
export function convertFigmaVariablesToDocument(payload, opts = {}) {
|
|
20
|
+
const warnings = [];
|
|
21
|
+
// Build a variable index for alias resolution: variableId → variable
|
|
22
|
+
const variableById = new Map();
|
|
23
|
+
for (const v of payload.variables)
|
|
24
|
+
variableById.set(v.id, v);
|
|
25
|
+
// Collection name lookup — alias references must carry the owning set so
|
|
26
|
+
// same-path tokens across collections don't misresolve (and so emitted
|
|
27
|
+
// DTCG references point at the actual set group in the output tree).
|
|
28
|
+
// Built over ALL collections (not just the filtered ones) because an
|
|
29
|
+
// alias can target a variable in a collection outside the export scope.
|
|
30
|
+
const collectionNameById = new Map();
|
|
31
|
+
for (const c of payload.collections)
|
|
32
|
+
collectionNameById.set(c.id, c.name);
|
|
33
|
+
// Filter collections per scope.
|
|
34
|
+
const wantedCollections = opts.collectionIds?.length
|
|
35
|
+
? payload.collections.filter((c) => opts.collectionIds.includes(c.id))
|
|
36
|
+
: payload.collections;
|
|
37
|
+
const sets = wantedCollections.map((collection) => convertCollection(collection, payload.variables, variableById, collectionNameById, opts, warnings));
|
|
38
|
+
return {
|
|
39
|
+
document: {
|
|
40
|
+
$schema: "https://figma-console-mcp.southleft.com/schemas/dtcg-extended-v1.json",
|
|
41
|
+
sets,
|
|
42
|
+
meta: {
|
|
43
|
+
figmaFileKey: opts.figmaFileKey,
|
|
44
|
+
exportedAt: opts.exportedAt ?? new Date().toISOString(),
|
|
45
|
+
mcpVersion: opts.mcpVersion,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
warnings,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function convertCollection(collection, allVariables, variableById, collectionNameById, opts, warnings) {
|
|
52
|
+
// Mode filter: keep only modes the caller wants, intersected with what
|
|
53
|
+
// the collection actually has.
|
|
54
|
+
const wantedModes = !opts.modes || opts.modes === "all"
|
|
55
|
+
? collection.modes
|
|
56
|
+
: collection.modes.filter((m) => opts.modes.includes(m.name));
|
|
57
|
+
// Variables in this collection.
|
|
58
|
+
const collectionVars = allVariables.filter((v) => v.variableCollectionId === collection.id);
|
|
59
|
+
const tokens = collectionVars.map((variable) => convertVariable(variable, wantedModes, variableById, collectionNameById, opts, warnings));
|
|
60
|
+
return {
|
|
61
|
+
name: collection.name,
|
|
62
|
+
modes: wantedModes.map((m) => m.name),
|
|
63
|
+
tokens,
|
|
64
|
+
meta: {
|
|
65
|
+
figmaCollectionId: collection.id,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Derive a variable's token path from its Figma name. Strips the configured
|
|
71
|
+
* prefix, splits on "/", and for TIMING/EASING variables drops the trailing
|
|
72
|
+
* type segment Figma appends to Config-2026 motion variables (e.g.
|
|
73
|
+
* "motion/duration/quick/Timing" → ["motion", "duration", "quick"]).
|
|
74
|
+
*/
|
|
75
|
+
function variableTokenPath(variable, opts) {
|
|
76
|
+
let name = variable.name;
|
|
77
|
+
if (opts.stripPrefix && name.startsWith(opts.stripPrefix)) {
|
|
78
|
+
name = name.slice(opts.stripPrefix.length);
|
|
79
|
+
}
|
|
80
|
+
const segments = name.split("/").filter(Boolean);
|
|
81
|
+
let strippedTypeSuffix = false;
|
|
82
|
+
if ((variable.resolvedType === "TIMING" || variable.resolvedType === "EASING") &&
|
|
83
|
+
segments.length > 1 &&
|
|
84
|
+
/^(timing|easing)$/i.test(segments[segments.length - 1])) {
|
|
85
|
+
segments.pop();
|
|
86
|
+
strippedTypeSuffix = true;
|
|
87
|
+
}
|
|
88
|
+
return { path: segments, strippedTypeSuffix };
|
|
89
|
+
}
|
|
90
|
+
function convertVariable(variable, wantedModes, variableById, collectionNameById, opts, warnings) {
|
|
91
|
+
// Derive the hierarchical path from the Figma variable name. Figma uses
|
|
92
|
+
// slashes to indicate grouping: "color/brand/primary" → ["color", "brand", "primary"].
|
|
93
|
+
const { path, strippedTypeSuffix } = variableTokenPath(variable, opts);
|
|
94
|
+
// Map resolvedType to TokenType.
|
|
95
|
+
const type = mapResolvedType(variable.resolvedType, variable.name, warnings);
|
|
96
|
+
// Convert each (mode → value) pair to our TokenValue shape, filtered by
|
|
97
|
+
// the wanted modes. Spring easings can't be expressed in DTCG — their
|
|
98
|
+
// parameters get stashed per-mode in the token's extensions.
|
|
99
|
+
const values = {};
|
|
100
|
+
const springByMode = {};
|
|
101
|
+
for (const mode of wantedModes) {
|
|
102
|
+
const rawValue = variable.valuesByMode[mode.modeId];
|
|
103
|
+
if (rawValue === undefined) {
|
|
104
|
+
warnings.push(`Variable "${variable.name}" has no value for mode "${mode.name}" (${mode.modeId}); skipping that mode.`);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
values[mode.name] = convertValue(rawValue, variable, mode.name, variableById, collectionNameById, opts, warnings, (spring) => {
|
|
108
|
+
springByMode[mode.name] = spring;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
path,
|
|
113
|
+
type,
|
|
114
|
+
description: variable.description || undefined,
|
|
115
|
+
values,
|
|
116
|
+
extensions: {
|
|
117
|
+
"figma-console-mcp": {
|
|
118
|
+
variableId: variable.id,
|
|
119
|
+
collectionId: variable.variableCollectionId,
|
|
120
|
+
// The Figma-native type is what import needs to decide writability
|
|
121
|
+
// — TIMING/EASING variables cannot be written via the Plugin API,
|
|
122
|
+
// and FLOAT variables whose token type is "duration" (name-inferred)
|
|
123
|
+
// must NOT be mistaken for TIMING.
|
|
124
|
+
figmaResolvedType: variable.resolvedType,
|
|
125
|
+
// Preserve the original variable name when the token path dropped
|
|
126
|
+
// the trailing "Timing"/"Easing" segment, so round-trip can
|
|
127
|
+
// reconstruct it.
|
|
128
|
+
...(strippedTypeSuffix ? { figmaName: variable.name } : {}),
|
|
129
|
+
...(Object.keys(springByMode).length > 0 ? { spring: springByMode } : {}),
|
|
130
|
+
// Scopes: stash only when NON-default. ["ALL_SCOPES"] (Figma's
|
|
131
|
+
// default) and empty/absent arrays are omitted so pre-existing
|
|
132
|
+
// exports stay byte-identical. codeSyntax: stash only when
|
|
133
|
+
// non-empty, same reasoning.
|
|
134
|
+
...(hasNonDefaultScopes(variable.scopes)
|
|
135
|
+
? { scopes: [...variable.scopes] }
|
|
136
|
+
: {}),
|
|
137
|
+
...(variable.codeSyntax && Object.keys(variable.codeSyntax).length > 0
|
|
138
|
+
? { codeSyntax: { ...variable.codeSyntax } }
|
|
139
|
+
: {}),
|
|
140
|
+
lastSyncedAt: new Date().toISOString(),
|
|
141
|
+
// We snapshot the synced value so future merge calls can detect
|
|
142
|
+
// two-sided conflicts. rawColor is transient render-time data and
|
|
143
|
+
// must not leak into serialized extensions (legacy output stays
|
|
144
|
+
// byte-identical).
|
|
145
|
+
lastSyncedValue: stripRawColorFromValues({ ...values }),
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* True when a variable's scopes array is meaningfully restrictive — i.e.
|
|
152
|
+
* present, non-empty, and not just the default ["ALL_SCOPES"].
|
|
153
|
+
*/
|
|
154
|
+
function hasNonDefaultScopes(scopes) {
|
|
155
|
+
if (!Array.isArray(scopes) || scopes.length === 0)
|
|
156
|
+
return false;
|
|
157
|
+
return !(scopes.length === 1 && scopes[0] === "ALL_SCOPES");
|
|
158
|
+
}
|
|
159
|
+
function mapResolvedType(resolvedType, variableName, warnings) {
|
|
160
|
+
switch (resolvedType) {
|
|
161
|
+
case "COLOR":
|
|
162
|
+
return "color";
|
|
163
|
+
case "FLOAT":
|
|
164
|
+
// Figma FLOAT covers both pure numbers and dimensions. We default to
|
|
165
|
+
// "dimension" because the typical FLOAT variable represents spacing,
|
|
166
|
+
// sizing, or radius — all dimensions. A future enhancement could
|
|
167
|
+
// sniff the variable name (e.g. "opacity/*" → "number") for better
|
|
168
|
+
// type fidelity.
|
|
169
|
+
return inferFloatType(variableName);
|
|
170
|
+
case "STRING":
|
|
171
|
+
return inferStringType(variableName);
|
|
172
|
+
case "BOOLEAN":
|
|
173
|
+
return "boolean";
|
|
174
|
+
case "TIMING":
|
|
175
|
+
// Config-2026 motion duration variables — plain numbers in SECONDS.
|
|
176
|
+
return "duration";
|
|
177
|
+
case "EASING":
|
|
178
|
+
// Config-2026 easing variables — bezier (or spring) curve objects.
|
|
179
|
+
return "cubicBezier";
|
|
180
|
+
default: {
|
|
181
|
+
const _exhaustive = resolvedType;
|
|
182
|
+
warnings.push(`Unknown resolvedType "${_exhaustive}" for variable "${variableName}"; treating as string.`);
|
|
183
|
+
return "string";
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function inferFloatType(variableName) {
|
|
188
|
+
const lower = variableName.toLowerCase();
|
|
189
|
+
if (lower.includes("opacity") || lower.includes("alpha"))
|
|
190
|
+
return "number";
|
|
191
|
+
if (lower.includes("font-weight") || lower.includes("weight"))
|
|
192
|
+
return "fontWeight";
|
|
193
|
+
if (lower.includes("duration") || lower.includes("delay"))
|
|
194
|
+
return "duration";
|
|
195
|
+
// Default: treat numeric variables as dimensions (px values).
|
|
196
|
+
return "dimension";
|
|
197
|
+
}
|
|
198
|
+
function inferStringType(variableName) {
|
|
199
|
+
const lower = variableName.toLowerCase();
|
|
200
|
+
if (lower.includes("font-family") || lower.includes("font/family"))
|
|
201
|
+
return "fontFamily";
|
|
202
|
+
return "string";
|
|
203
|
+
}
|
|
204
|
+
function convertValue(rawValue, variable, modeName, variableById, collectionNameById, opts, warnings, onSpring) {
|
|
205
|
+
const resolvedType = variable.resolvedType;
|
|
206
|
+
// Alias references: convert variable ID → path-based reference for DTCG.
|
|
207
|
+
if (isVariableAlias(rawValue)) {
|
|
208
|
+
const target = variableById.get(rawValue.id);
|
|
209
|
+
if (!target) {
|
|
210
|
+
// Cross-library alias — target is in a published library this file
|
|
211
|
+
// consumes, not in the local variable set. Preserve the original
|
|
212
|
+
// Figma variable ID in the reference syntax so round-trip can
|
|
213
|
+
// recover it AND formatters can detect this is unresolvable (vs a
|
|
214
|
+
// genuine local-path alias).
|
|
215
|
+
warnings.push(`Alias to unknown variable ID ${rawValue.id} (likely a cross-library reference). Original ID preserved in reference for round-trip.`);
|
|
216
|
+
return { reference: `{__library:${rawValue.id}}` };
|
|
217
|
+
}
|
|
218
|
+
// The DTCG alias path uses dots, QUALIFIED by the target's set group
|
|
219
|
+
// (`{<set-slug>.color.brand.primary}`). The set qualifier does two
|
|
220
|
+
// jobs: (1) same-path tokens in different collections resolve to the
|
|
221
|
+
// right target instead of "whichever set was indexed last", and
|
|
222
|
+
// (2) the emitted DTCG reference points at the actual location in the
|
|
223
|
+
// output tree (tokens nest under the slugified set group), so
|
|
224
|
+
// external DTCG tools like Style Dictionary v4 can resolve it.
|
|
225
|
+
const targetPath = variableTokenPath(target, opts).path;
|
|
226
|
+
const dotPath = targetPath.join(".");
|
|
227
|
+
const targetCollectionName = collectionNameById.get(target.variableCollectionId);
|
|
228
|
+
if (!targetCollectionName) {
|
|
229
|
+
warnings.push(`Alias target "${target.name}" belongs to unknown collection ${target.variableCollectionId} — emitting an unqualified reference.`);
|
|
230
|
+
return { reference: `{${dotPath}}` };
|
|
231
|
+
}
|
|
232
|
+
return { reference: `{${slugifySetName(targetCollectionName)}.${dotPath}}` };
|
|
233
|
+
}
|
|
234
|
+
// Literal values per type.
|
|
235
|
+
if (resolvedType === "COLOR") {
|
|
236
|
+
if (typeof rawValue === "object" && rawValue !== null && "r" in rawValue) {
|
|
237
|
+
// The hex string stays the literal (legacy dialect + back-compat), but
|
|
238
|
+
// we also carry the raw full-precision floats so the 2025.10 dialect
|
|
239
|
+
// can emit `components` without round-tripping through 8-bit hex.
|
|
240
|
+
// `rawColor` is transient — see TokenValue.rawColor in types.ts.
|
|
241
|
+
return {
|
|
242
|
+
literal: rgbaToHex(rawValue),
|
|
243
|
+
rawColor: {
|
|
244
|
+
r: rawValue.r,
|
|
245
|
+
g: rawValue.g,
|
|
246
|
+
b: rawValue.b,
|
|
247
|
+
a: rawValue.a ?? 1,
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
warnings.push(`COLOR value isn't an RGB object: ${JSON.stringify(rawValue)}`);
|
|
252
|
+
return { literal: String(rawValue) };
|
|
253
|
+
}
|
|
254
|
+
if (resolvedType === "FLOAT") {
|
|
255
|
+
return { literal: typeof rawValue === "number" ? rawValue : Number(rawValue) };
|
|
256
|
+
}
|
|
257
|
+
if (resolvedType === "BOOLEAN") {
|
|
258
|
+
return { literal: Boolean(rawValue) };
|
|
259
|
+
}
|
|
260
|
+
if (resolvedType === "TIMING") {
|
|
261
|
+
// Figma TIMING values are plain numbers in SECONDS. DTCG duration uses
|
|
262
|
+
// the structured `{ value, unit }` form — emit milliseconds.
|
|
263
|
+
if (typeof rawValue === "number") {
|
|
264
|
+
return { literal: { value: rawValue * 1000, unit: "ms" } };
|
|
265
|
+
}
|
|
266
|
+
warnings.push(`TIMING value for "${variable.name}" (mode "${modeName}") isn't a number: ${JSON.stringify(rawValue)} — emitting as string.`);
|
|
267
|
+
return { literal: String(rawValue) };
|
|
268
|
+
}
|
|
269
|
+
if (resolvedType === "EASING") {
|
|
270
|
+
const easing = rawValue;
|
|
271
|
+
const b = easing?.bezierValues;
|
|
272
|
+
if (b &&
|
|
273
|
+
typeof b.p1x === "number" &&
|
|
274
|
+
typeof b.p1y === "number" &&
|
|
275
|
+
typeof b.p2x === "number" &&
|
|
276
|
+
typeof b.p2y === "number") {
|
|
277
|
+
// DTCG cubicBezier: [p1x, p1y, p2x, p2y].
|
|
278
|
+
return { literal: [b.p1x, b.p1y, b.p2x, b.p2y] };
|
|
279
|
+
}
|
|
280
|
+
if (easing && typeof easing === "object" && easing.springValues) {
|
|
281
|
+
// Spring easings have no bezier representation — DTCG cannot express
|
|
282
|
+
// springs. Emit a standard "ease" bezier as a usable approximation
|
|
283
|
+
// and preserve the spring parameters in the token's
|
|
284
|
+
// figma-console-mcp extensions for round-trip.
|
|
285
|
+
warnings.push(`EASING variable "${variable.name}" (mode "${modeName}") is a spring (${easing.easingType ?? "unknown type"}) — DTCG cannot represent springs. Emitted a fallback cubicBezier; spring parameters preserved in $extensions["figma-console-mcp"].spring.`);
|
|
286
|
+
onSpring({
|
|
287
|
+
easingType: easing.easingType,
|
|
288
|
+
springValues: easing.springValues,
|
|
289
|
+
});
|
|
290
|
+
return { literal: [0.25, 0.1, 0.25, 1.0] };
|
|
291
|
+
}
|
|
292
|
+
warnings.push(`EASING value for "${variable.name}" (mode "${modeName}") has no usable bezierValues or springValues: ${JSON.stringify(rawValue)} — emitting as string.`);
|
|
293
|
+
return { literal: String(rawValue) };
|
|
294
|
+
}
|
|
295
|
+
// STRING and fallthrough.
|
|
296
|
+
return { literal: typeof rawValue === "string" ? rawValue : String(rawValue) };
|
|
297
|
+
}
|
|
298
|
+
function isVariableAlias(value) {
|
|
299
|
+
return (typeof value === "object" &&
|
|
300
|
+
value !== null &&
|
|
301
|
+
"type" in value &&
|
|
302
|
+
value.type === "VARIABLE_ALIAS");
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Convert Figma's `{r, g, b, a}` floats (0–1 range) to a hex string. Returns
|
|
306
|
+
* `#RRGGBB` when alpha is 1 (or absent), `#RRGGBBAA` when alpha < 1.
|
|
307
|
+
*/
|
|
308
|
+
function rgbaToHex(rgba) {
|
|
309
|
+
const r = clampByte(rgba.r);
|
|
310
|
+
const g = clampByte(rgba.g);
|
|
311
|
+
const b = clampByte(rgba.b);
|
|
312
|
+
const a = rgba.a ?? 1;
|
|
313
|
+
const hex = `#${byteToHex(r)}${byteToHex(g)}${byteToHex(b)}`;
|
|
314
|
+
if (a >= 1)
|
|
315
|
+
return hex;
|
|
316
|
+
return `${hex}${byteToHex(clampByte(a))}`;
|
|
317
|
+
}
|
|
318
|
+
function clampByte(f) {
|
|
319
|
+
return Math.max(0, Math.min(255, Math.round(f * 255)));
|
|
320
|
+
}
|
|
321
|
+
function byteToHex(byte) {
|
|
322
|
+
return byte.toString(16).padStart(2, "0").toUpperCase();
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=figma-converter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figma-converter.js","sourceRoot":"","sources":["../../../src/core/tokens/figma-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAiFvD;;GAEG;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WAAW,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS custom properties formatter.
|
|
3
|
+
*
|
|
4
|
+
* Converts a TokenDocument to one or more CSS files containing `:root { ... }`
|
|
5
|
+
* (and optionally per-mode selectors like `.dark { ... }`). The first
|
|
6
|
+
* "real" non-DTCG output, completing the canonical-to-runtime pipeline.
|
|
7
|
+
*
|
|
8
|
+
* Behavior:
|
|
9
|
+
* - Each token becomes a CSS custom property. Path joined with `-`,
|
|
10
|
+
* optionally prefixed. `color/primary` → `--color-primary`.
|
|
11
|
+
* - Aliases resolve to `var(--target-token)` so CSS cascading still works.
|
|
12
|
+
* - Composite tokens (typography, shadow) expand into multiple primitive
|
|
13
|
+
* custom properties since CSS doesn't natively express composites.
|
|
14
|
+
* - Single-mode tokens go in `:root`.
|
|
15
|
+
* - Multi-mode tokens emit per-mode selectors. Heuristic: a mode named
|
|
16
|
+
* `Light`/`Default` becomes `:root`; `Dark` becomes `.dark` (Tailwind
|
|
17
|
+
* convention); other modes become `[data-theme="<name>"]`.
|
|
18
|
+
* - splitByMode emits one file per mode with just that mode's values.
|
|
19
|
+
* - splitByCollection emits one file per set.
|
|
20
|
+
*/
|
|
21
|
+
import type { TokenDocument } from "../types.js";
|
|
22
|
+
import type { FormatOptions, FormatResult } from "./index.js";
|
|
23
|
+
export declare function formatCssVars(doc: TokenDocument, opts: FormatOptions): FormatResult;
|
|
24
|
+
//# sourceMappingURL=css-vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-vars.d.ts","sourceRoot":"","sources":["../../../../src/core/tokens/formatters/css-vars.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAS,aAAa,EAAwB,MAAM,aAAa,CAAC;AAE9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,aAAa,CAC3B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,aAAa,GAClB,YAAY,CAiEd"}
|