@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.
Files changed (443) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +898 -0
  3. package/dist/apps/design-system-dashboard/scoring/accessibility.d.ts +14 -0
  4. package/dist/apps/design-system-dashboard/scoring/accessibility.d.ts.map +1 -0
  5. package/dist/apps/design-system-dashboard/scoring/accessibility.js +278 -0
  6. package/dist/apps/design-system-dashboard/scoring/accessibility.js.map +1 -0
  7. package/dist/apps/design-system-dashboard/scoring/component-metadata.d.ts +29 -0
  8. package/dist/apps/design-system-dashboard/scoring/component-metadata.d.ts.map +1 -0
  9. package/dist/apps/design-system-dashboard/scoring/component-metadata.js +358 -0
  10. package/dist/apps/design-system-dashboard/scoring/component-metadata.js.map +1 -0
  11. package/dist/apps/design-system-dashboard/scoring/consistency.d.ts +14 -0
  12. package/dist/apps/design-system-dashboard/scoring/consistency.d.ts.map +1 -0
  13. package/dist/apps/design-system-dashboard/scoring/consistency.js +342 -0
  14. package/dist/apps/design-system-dashboard/scoring/consistency.js.map +1 -0
  15. package/dist/apps/design-system-dashboard/scoring/coverage.d.ts +14 -0
  16. package/dist/apps/design-system-dashboard/scoring/coverage.d.ts.map +1 -0
  17. package/dist/apps/design-system-dashboard/scoring/coverage.js +231 -0
  18. package/dist/apps/design-system-dashboard/scoring/coverage.js.map +1 -0
  19. package/dist/apps/design-system-dashboard/scoring/engine.d.ts +27 -0
  20. package/dist/apps/design-system-dashboard/scoring/engine.d.ts.map +1 -0
  21. package/dist/apps/design-system-dashboard/scoring/engine.js +93 -0
  22. package/dist/apps/design-system-dashboard/scoring/engine.js.map +1 -0
  23. package/dist/apps/design-system-dashboard/scoring/naming-semantics.d.ts +14 -0
  24. package/dist/apps/design-system-dashboard/scoring/naming-semantics.d.ts.map +1 -0
  25. package/dist/apps/design-system-dashboard/scoring/naming-semantics.js +309 -0
  26. package/dist/apps/design-system-dashboard/scoring/naming-semantics.js.map +1 -0
  27. package/dist/apps/design-system-dashboard/scoring/token-architecture.d.ts +14 -0
  28. package/dist/apps/design-system-dashboard/scoring/token-architecture.d.ts.map +1 -0
  29. package/dist/apps/design-system-dashboard/scoring/token-architecture.js +350 -0
  30. package/dist/apps/design-system-dashboard/scoring/token-architecture.js.map +1 -0
  31. package/dist/apps/design-system-dashboard/scoring/types.d.ts +89 -0
  32. package/dist/apps/design-system-dashboard/scoring/types.d.ts.map +1 -0
  33. package/dist/apps/design-system-dashboard/scoring/types.js +41 -0
  34. package/dist/apps/design-system-dashboard/scoring/types.js.map +1 -0
  35. package/dist/apps/design-system-dashboard/server.d.ts +24 -0
  36. package/dist/apps/design-system-dashboard/server.d.ts.map +1 -0
  37. package/dist/apps/design-system-dashboard/server.js +160 -0
  38. package/dist/apps/design-system-dashboard/server.js.map +1 -0
  39. package/dist/apps/token-browser/server.d.ts +26 -0
  40. package/dist/apps/token-browser/server.d.ts.map +1 -0
  41. package/dist/apps/token-browser/server.js +137 -0
  42. package/dist/apps/token-browser/server.js.map +1 -0
  43. package/dist/browser/base.d.ts +58 -0
  44. package/dist/browser/base.d.ts.map +1 -0
  45. package/dist/browser/base.js +6 -0
  46. package/dist/browser/base.js.map +1 -0
  47. package/dist/browser/local.d.ts +87 -0
  48. package/dist/browser/local.d.ts.map +1 -0
  49. package/dist/browser/local.js +318 -0
  50. package/dist/browser/local.js.map +1 -0
  51. package/dist/cloudflare/apps/design-system-dashboard/scoring/accessibility.js +277 -0
  52. package/dist/cloudflare/apps/design-system-dashboard/scoring/component-metadata.js +357 -0
  53. package/dist/cloudflare/apps/design-system-dashboard/scoring/consistency.js +341 -0
  54. package/dist/cloudflare/apps/design-system-dashboard/scoring/coverage.js +230 -0
  55. package/dist/cloudflare/apps/design-system-dashboard/scoring/engine.js +92 -0
  56. package/dist/cloudflare/apps/design-system-dashboard/scoring/naming-semantics.js +308 -0
  57. package/dist/cloudflare/apps/design-system-dashboard/scoring/token-architecture.js +349 -0
  58. package/dist/cloudflare/apps/design-system-dashboard/scoring/types.js +40 -0
  59. package/dist/cloudflare/apps/design-system-dashboard/server.js +159 -0
  60. package/dist/cloudflare/apps/token-browser/server.js +136 -0
  61. package/dist/cloudflare/browser-manager.js +157 -0
  62. package/dist/cloudflare/core/accessibility-tools.js +361 -0
  63. package/dist/cloudflare/core/annotation-tools.js +230 -0
  64. package/dist/cloudflare/core/cloud-websocket-connector.js +419 -0
  65. package/dist/cloudflare/core/cloud-websocket-relay.js +198 -0
  66. package/dist/cloudflare/core/comment-tools.js +292 -0
  67. package/dist/cloudflare/core/config.js +153 -0
  68. package/dist/cloudflare/core/console-monitor.js +427 -0
  69. package/dist/cloudflare/core/deep-component-tools.js +128 -0
  70. package/dist/cloudflare/core/design-code-tools.js +2793 -0
  71. package/dist/cloudflare/core/design-system-manifest.js +265 -0
  72. package/dist/cloudflare/core/design-system-tools.js +882 -0
  73. package/dist/cloudflare/core/diagnose-tool.js +100 -0
  74. package/dist/cloudflare/core/diff/changelog-formatter.js +275 -0
  75. package/dist/cloudflare/core/diff/diff-engine.js +334 -0
  76. package/dist/cloudflare/core/diff/property-compare.js +36 -0
  77. package/dist/cloudflare/core/diff/version-cache.js +74 -0
  78. package/dist/cloudflare/core/enrichment/enrichment-service.js +374 -0
  79. package/dist/cloudflare/core/enrichment/index.js +7 -0
  80. package/dist/cloudflare/core/enrichment/relationship-mapper.js +351 -0
  81. package/dist/cloudflare/core/enrichment/style-resolver.js +346 -0
  82. package/dist/cloudflare/core/figjam-tools.js +547 -0
  83. package/dist/cloudflare/core/figma-api.js +509 -0
  84. package/dist/cloudflare/core/figma-connector.js +7 -0
  85. package/dist/cloudflare/core/figma-reconstruction-spec.js +402 -0
  86. package/dist/cloudflare/core/figma-style-extractor.js +311 -0
  87. package/dist/cloudflare/core/figma-tools.js +3302 -0
  88. package/dist/cloudflare/core/identity.js +96 -0
  89. package/dist/cloudflare/core/library-tools.js +580 -0
  90. package/dist/cloudflare/core/logger.js +53 -0
  91. package/dist/cloudflare/core/port-discovery.js +935 -0
  92. package/dist/cloudflare/core/resolve-package-root.js +11 -0
  93. package/dist/cloudflare/core/slides-tools.js +714 -0
  94. package/dist/cloudflare/core/slot-tools.js +334 -0
  95. package/dist/cloudflare/core/snippet-injector.js +96 -0
  96. package/dist/cloudflare/core/tokens/alias-resolver.js +205 -0
  97. package/dist/cloudflare/core/tokens/config.js +294 -0
  98. package/dist/cloudflare/core/tokens/dialect.js +232 -0
  99. package/dist/cloudflare/core/tokens/figma-converter.js +323 -0
  100. package/dist/cloudflare/core/tokens/formatters/css-vars.js +338 -0
  101. package/dist/cloudflare/core/tokens/formatters/dtcg.js +376 -0
  102. package/dist/cloudflare/core/tokens/formatters/index.js +45 -0
  103. package/dist/cloudflare/core/tokens/formatters/json.js +205 -0
  104. package/dist/cloudflare/core/tokens/formatters/less.js +4 -0
  105. package/dist/cloudflare/core/tokens/formatters/scss.js +258 -0
  106. package/dist/cloudflare/core/tokens/formatters/stubs.js +13 -0
  107. package/dist/cloudflare/core/tokens/formatters/style-dictionary-v3.js +213 -0
  108. package/dist/cloudflare/core/tokens/formatters/tailwind-v3.js +237 -0
  109. package/dist/cloudflare/core/tokens/formatters/tailwind-v4.js +335 -0
  110. package/dist/cloudflare/core/tokens/formatters/tokens-studio.js +256 -0
  111. package/dist/cloudflare/core/tokens/formatters/ts-module.js +198 -0
  112. package/dist/cloudflare/core/tokens/index.js +16 -0
  113. package/dist/cloudflare/core/tokens/parsers/css-vars.js +4 -0
  114. package/dist/cloudflare/core/tokens/parsers/dtcg.js +280 -0
  115. package/dist/cloudflare/core/tokens/parsers/index.js +138 -0
  116. package/dist/cloudflare/core/tokens/parsers/json.js +7 -0
  117. package/dist/cloudflare/core/tokens/parsers/scss.js +4 -0
  118. package/dist/cloudflare/core/tokens/parsers/stubs.js +20 -0
  119. package/dist/cloudflare/core/tokens/parsers/style-dictionary-v3.js +4 -0
  120. package/dist/cloudflare/core/tokens/parsers/tailwind-v3.js +4 -0
  121. package/dist/cloudflare/core/tokens/parsers/tailwind-v4.js +4 -0
  122. package/dist/cloudflare/core/tokens/parsers/tokens-studio.js +4 -0
  123. package/dist/cloudflare/core/tokens/schemas.js +152 -0
  124. package/dist/cloudflare/core/tokens/transforms/color.js +12 -0
  125. package/dist/cloudflare/core/tokens/transforms/index.js +29 -0
  126. package/dist/cloudflare/core/tokens/transforms/size.js +7 -0
  127. package/dist/cloudflare/core/tokens/types.js +18 -0
  128. package/dist/cloudflare/core/tokens-tools.js +1788 -0
  129. package/dist/cloudflare/core/types/design-code.js +4 -0
  130. package/dist/cloudflare/core/types/enriched.js +5 -0
  131. package/dist/cloudflare/core/types/index.js +4 -0
  132. package/dist/cloudflare/core/variable-resolver.js +85 -0
  133. package/dist/cloudflare/core/version-tools.js +1199 -0
  134. package/dist/cloudflare/core/websocket-connector.js +436 -0
  135. package/dist/cloudflare/core/websocket-server.js +956 -0
  136. package/dist/cloudflare/core/write-tools.js +2506 -0
  137. package/dist/cloudflare/index.js +3010 -0
  138. package/dist/core/accessibility-tools.d.ts +21 -0
  139. package/dist/core/accessibility-tools.d.ts.map +1 -0
  140. package/dist/core/accessibility-tools.js +362 -0
  141. package/dist/core/accessibility-tools.js.map +1 -0
  142. package/dist/core/annotation-tools.d.ts +14 -0
  143. package/dist/core/annotation-tools.d.ts.map +1 -0
  144. package/dist/core/annotation-tools.js +231 -0
  145. package/dist/core/annotation-tools.js.map +1 -0
  146. package/dist/core/comment-tools.d.ts +11 -0
  147. package/dist/core/comment-tools.d.ts.map +1 -0
  148. package/dist/core/comment-tools.js +293 -0
  149. package/dist/core/comment-tools.js.map +1 -0
  150. package/dist/core/config.d.ts +17 -0
  151. package/dist/core/config.d.ts.map +1 -0
  152. package/dist/core/config.js +154 -0
  153. package/dist/core/config.js.map +1 -0
  154. package/dist/core/console-monitor.d.ts +82 -0
  155. package/dist/core/console-monitor.d.ts.map +1 -0
  156. package/dist/core/console-monitor.js +428 -0
  157. package/dist/core/console-monitor.js.map +1 -0
  158. package/dist/core/deep-component-tools.d.ts +14 -0
  159. package/dist/core/deep-component-tools.d.ts.map +1 -0
  160. package/dist/core/deep-component-tools.js +129 -0
  161. package/dist/core/deep-component-tools.js.map +1 -0
  162. package/dist/core/design-code-tools.d.ts +116 -0
  163. package/dist/core/design-code-tools.d.ts.map +1 -0
  164. package/dist/core/design-code-tools.js +2794 -0
  165. package/dist/core/design-code-tools.js.map +1 -0
  166. package/dist/core/design-system-manifest.d.ts +273 -0
  167. package/dist/core/design-system-manifest.d.ts.map +1 -0
  168. package/dist/core/design-system-manifest.js +266 -0
  169. package/dist/core/design-system-manifest.js.map +1 -0
  170. package/dist/core/design-system-tools.d.ts +67 -0
  171. package/dist/core/design-system-tools.d.ts.map +1 -0
  172. package/dist/core/design-system-tools.js +883 -0
  173. package/dist/core/design-system-tools.js.map +1 -0
  174. package/dist/core/diagnose-tool.d.ts +41 -0
  175. package/dist/core/diagnose-tool.d.ts.map +1 -0
  176. package/dist/core/diagnose-tool.js +101 -0
  177. package/dist/core/diagnose-tool.js.map +1 -0
  178. package/dist/core/diff/changelog-formatter.d.ts +35 -0
  179. package/dist/core/diff/changelog-formatter.d.ts.map +1 -0
  180. package/dist/core/diff/changelog-formatter.js +276 -0
  181. package/dist/core/diff/changelog-formatter.js.map +1 -0
  182. package/dist/core/diff/diff-engine.d.ts +127 -0
  183. package/dist/core/diff/diff-engine.d.ts.map +1 -0
  184. package/dist/core/diff/diff-engine.js +335 -0
  185. package/dist/core/diff/diff-engine.js.map +1 -0
  186. package/dist/core/diff/property-compare.d.ts +19 -0
  187. package/dist/core/diff/property-compare.d.ts.map +1 -0
  188. package/dist/core/diff/property-compare.js +37 -0
  189. package/dist/core/diff/property-compare.js.map +1 -0
  190. package/dist/core/diff/version-cache.d.ts +40 -0
  191. package/dist/core/diff/version-cache.d.ts.map +1 -0
  192. package/dist/core/diff/version-cache.js +75 -0
  193. package/dist/core/diff/version-cache.js.map +1 -0
  194. package/dist/core/enrichment/enrichment-service.d.ts +52 -0
  195. package/dist/core/enrichment/enrichment-service.d.ts.map +1 -0
  196. package/dist/core/enrichment/enrichment-service.js +375 -0
  197. package/dist/core/enrichment/enrichment-service.js.map +1 -0
  198. package/dist/core/enrichment/index.d.ts +8 -0
  199. package/dist/core/enrichment/index.d.ts.map +1 -0
  200. package/dist/core/enrichment/index.js +8 -0
  201. package/dist/core/enrichment/index.js.map +1 -0
  202. package/dist/core/enrichment/relationship-mapper.d.ts +106 -0
  203. package/dist/core/enrichment/relationship-mapper.d.ts.map +1 -0
  204. package/dist/core/enrichment/relationship-mapper.js +352 -0
  205. package/dist/core/enrichment/relationship-mapper.js.map +1 -0
  206. package/dist/core/enrichment/style-resolver.d.ts +85 -0
  207. package/dist/core/enrichment/style-resolver.d.ts.map +1 -0
  208. package/dist/core/enrichment/style-resolver.js +347 -0
  209. package/dist/core/enrichment/style-resolver.js.map +1 -0
  210. package/dist/core/figjam-tools.d.ts +8 -0
  211. package/dist/core/figjam-tools.d.ts.map +1 -0
  212. package/dist/core/figjam-tools.js +548 -0
  213. package/dist/core/figjam-tools.js.map +1 -0
  214. package/dist/core/figma-api.d.ts +254 -0
  215. package/dist/core/figma-api.d.ts.map +1 -0
  216. package/dist/core/figma-api.js +510 -0
  217. package/dist/core/figma-api.js.map +1 -0
  218. package/dist/core/figma-connector.d.ts +214 -0
  219. package/dist/core/figma-connector.d.ts.map +1 -0
  220. package/dist/core/figma-connector.js +8 -0
  221. package/dist/core/figma-connector.js.map +1 -0
  222. package/dist/core/figma-desktop-connector.d.ts +312 -0
  223. package/dist/core/figma-desktop-connector.d.ts.map +1 -0
  224. package/dist/core/figma-desktop-connector.js +1298 -0
  225. package/dist/core/figma-desktop-connector.js.map +1 -0
  226. package/dist/core/figma-reconstruction-spec.d.ts +166 -0
  227. package/dist/core/figma-reconstruction-spec.d.ts.map +1 -0
  228. package/dist/core/figma-reconstruction-spec.js +403 -0
  229. package/dist/core/figma-reconstruction-spec.js.map +1 -0
  230. package/dist/core/figma-style-extractor.d.ts +76 -0
  231. package/dist/core/figma-style-extractor.d.ts.map +1 -0
  232. package/dist/core/figma-style-extractor.js +312 -0
  233. package/dist/core/figma-style-extractor.js.map +1 -0
  234. package/dist/core/figma-tools.d.ts +22 -0
  235. package/dist/core/figma-tools.d.ts.map +1 -0
  236. package/dist/core/figma-tools.js +3303 -0
  237. package/dist/core/figma-tools.js.map +1 -0
  238. package/dist/core/identity.d.ts +41 -0
  239. package/dist/core/identity.d.ts.map +1 -0
  240. package/dist/core/identity.js +97 -0
  241. package/dist/core/identity.js.map +1 -0
  242. package/dist/core/library-tools.d.ts +17 -0
  243. package/dist/core/library-tools.d.ts.map +1 -0
  244. package/dist/core/library-tools.js +581 -0
  245. package/dist/core/library-tools.js.map +1 -0
  246. package/dist/core/logger.d.ts +22 -0
  247. package/dist/core/logger.d.ts.map +1 -0
  248. package/dist/core/logger.js +54 -0
  249. package/dist/core/logger.js.map +1 -0
  250. package/dist/core/port-discovery.d.ts +211 -0
  251. package/dist/core/port-discovery.d.ts.map +1 -0
  252. package/dist/core/port-discovery.js +936 -0
  253. package/dist/core/port-discovery.js.map +1 -0
  254. package/dist/core/resolve-package-root.d.ts +2 -0
  255. package/dist/core/resolve-package-root.d.ts.map +1 -0
  256. package/dist/core/resolve-package-root.js +12 -0
  257. package/dist/core/resolve-package-root.js.map +1 -0
  258. package/dist/core/slides-tools.d.ts +8 -0
  259. package/dist/core/slides-tools.d.ts.map +1 -0
  260. package/dist/core/slides-tools.js +715 -0
  261. package/dist/core/slides-tools.js.map +1 -0
  262. package/dist/core/slot-tools.d.ts +7 -0
  263. package/dist/core/slot-tools.d.ts.map +1 -0
  264. package/dist/core/slot-tools.js +335 -0
  265. package/dist/core/slot-tools.js.map +1 -0
  266. package/dist/core/snippet-injector.d.ts +24 -0
  267. package/dist/core/snippet-injector.d.ts.map +1 -0
  268. package/dist/core/snippet-injector.js +97 -0
  269. package/dist/core/snippet-injector.js.map +1 -0
  270. package/dist/core/tokens/alias-resolver.d.ts +97 -0
  271. package/dist/core/tokens/alias-resolver.d.ts.map +1 -0
  272. package/dist/core/tokens/alias-resolver.js +206 -0
  273. package/dist/core/tokens/alias-resolver.js.map +1 -0
  274. package/dist/core/tokens/config.d.ts +380 -0
  275. package/dist/core/tokens/config.d.ts.map +1 -0
  276. package/dist/core/tokens/config.js +295 -0
  277. package/dist/core/tokens/config.js.map +1 -0
  278. package/dist/core/tokens/dialect.d.ts +107 -0
  279. package/dist/core/tokens/dialect.d.ts.map +1 -0
  280. package/dist/core/tokens/dialect.js +233 -0
  281. package/dist/core/tokens/dialect.js.map +1 -0
  282. package/dist/core/tokens/figma-converter.d.ts +102 -0
  283. package/dist/core/tokens/figma-converter.d.ts.map +1 -0
  284. package/dist/core/tokens/figma-converter.js +324 -0
  285. package/dist/core/tokens/figma-converter.js.map +1 -0
  286. package/dist/core/tokens/formatters/css-vars.d.ts +24 -0
  287. package/dist/core/tokens/formatters/css-vars.d.ts.map +1 -0
  288. package/dist/core/tokens/formatters/css-vars.js +339 -0
  289. package/dist/core/tokens/formatters/css-vars.js.map +1 -0
  290. package/dist/core/tokens/formatters/dtcg.d.ts +28 -0
  291. package/dist/core/tokens/formatters/dtcg.d.ts.map +1 -0
  292. package/dist/core/tokens/formatters/dtcg.js +377 -0
  293. package/dist/core/tokens/formatters/dtcg.js.map +1 -0
  294. package/dist/core/tokens/formatters/index.d.ts +30 -0
  295. package/dist/core/tokens/formatters/index.d.ts.map +1 -0
  296. package/dist/core/tokens/formatters/index.js +46 -0
  297. package/dist/core/tokens/formatters/index.js.map +1 -0
  298. package/dist/core/tokens/formatters/json.d.ts +37 -0
  299. package/dist/core/tokens/formatters/json.d.ts.map +1 -0
  300. package/dist/core/tokens/formatters/json.js +206 -0
  301. package/dist/core/tokens/formatters/json.js.map +1 -0
  302. package/dist/core/tokens/formatters/less.d.ts +4 -0
  303. package/dist/core/tokens/formatters/less.d.ts.map +1 -0
  304. package/dist/core/tokens/formatters/less.js +5 -0
  305. package/dist/core/tokens/formatters/less.js.map +1 -0
  306. package/dist/core/tokens/formatters/scss.d.ts +26 -0
  307. package/dist/core/tokens/formatters/scss.d.ts.map +1 -0
  308. package/dist/core/tokens/formatters/scss.js +259 -0
  309. package/dist/core/tokens/formatters/scss.js.map +1 -0
  310. package/dist/core/tokens/formatters/stubs.d.ts +9 -0
  311. package/dist/core/tokens/formatters/stubs.d.ts.map +1 -0
  312. package/dist/core/tokens/formatters/stubs.js +14 -0
  313. package/dist/core/tokens/formatters/stubs.js.map +1 -0
  314. package/dist/core/tokens/formatters/style-dictionary-v3.d.ts +45 -0
  315. package/dist/core/tokens/formatters/style-dictionary-v3.d.ts.map +1 -0
  316. package/dist/core/tokens/formatters/style-dictionary-v3.js +214 -0
  317. package/dist/core/tokens/formatters/style-dictionary-v3.js.map +1 -0
  318. package/dist/core/tokens/formatters/tailwind-v3.d.ts +37 -0
  319. package/dist/core/tokens/formatters/tailwind-v3.d.ts.map +1 -0
  320. package/dist/core/tokens/formatters/tailwind-v3.js +238 -0
  321. package/dist/core/tokens/formatters/tailwind-v3.js.map +1 -0
  322. package/dist/core/tokens/formatters/tailwind-v4.d.ts +41 -0
  323. package/dist/core/tokens/formatters/tailwind-v4.d.ts.map +1 -0
  324. package/dist/core/tokens/formatters/tailwind-v4.js +336 -0
  325. package/dist/core/tokens/formatters/tailwind-v4.js.map +1 -0
  326. package/dist/core/tokens/formatters/tokens-studio.d.ts +44 -0
  327. package/dist/core/tokens/formatters/tokens-studio.d.ts.map +1 -0
  328. package/dist/core/tokens/formatters/tokens-studio.js +257 -0
  329. package/dist/core/tokens/formatters/tokens-studio.js.map +1 -0
  330. package/dist/core/tokens/formatters/ts-module.d.ts +35 -0
  331. package/dist/core/tokens/formatters/ts-module.d.ts.map +1 -0
  332. package/dist/core/tokens/formatters/ts-module.js +199 -0
  333. package/dist/core/tokens/formatters/ts-module.js.map +1 -0
  334. package/dist/core/tokens/index.d.ts +18 -0
  335. package/dist/core/tokens/index.d.ts.map +1 -0
  336. package/dist/core/tokens/index.js +17 -0
  337. package/dist/core/tokens/index.js.map +1 -0
  338. package/dist/core/tokens/parsers/css-vars.d.ts +3 -0
  339. package/dist/core/tokens/parsers/css-vars.d.ts.map +1 -0
  340. package/dist/core/tokens/parsers/css-vars.js +5 -0
  341. package/dist/core/tokens/parsers/css-vars.js.map +1 -0
  342. package/dist/core/tokens/parsers/dtcg.d.ts +21 -0
  343. package/dist/core/tokens/parsers/dtcg.d.ts.map +1 -0
  344. package/dist/core/tokens/parsers/dtcg.js +281 -0
  345. package/dist/core/tokens/parsers/dtcg.js.map +1 -0
  346. package/dist/core/tokens/parsers/index.d.ts +37 -0
  347. package/dist/core/tokens/parsers/index.d.ts.map +1 -0
  348. package/dist/core/tokens/parsers/index.js +139 -0
  349. package/dist/core/tokens/parsers/index.js.map +1 -0
  350. package/dist/core/tokens/parsers/json.d.ts +4 -0
  351. package/dist/core/tokens/parsers/json.d.ts.map +1 -0
  352. package/dist/core/tokens/parsers/json.js +8 -0
  353. package/dist/core/tokens/parsers/json.js.map +1 -0
  354. package/dist/core/tokens/parsers/scss.d.ts +3 -0
  355. package/dist/core/tokens/parsers/scss.d.ts.map +1 -0
  356. package/dist/core/tokens/parsers/scss.js +5 -0
  357. package/dist/core/tokens/parsers/scss.js.map +1 -0
  358. package/dist/core/tokens/parsers/stubs.d.ts +15 -0
  359. package/dist/core/tokens/parsers/stubs.d.ts.map +1 -0
  360. package/dist/core/tokens/parsers/stubs.js +21 -0
  361. package/dist/core/tokens/parsers/stubs.js.map +1 -0
  362. package/dist/core/tokens/parsers/style-dictionary-v3.d.ts +3 -0
  363. package/dist/core/tokens/parsers/style-dictionary-v3.d.ts.map +1 -0
  364. package/dist/core/tokens/parsers/style-dictionary-v3.js +5 -0
  365. package/dist/core/tokens/parsers/style-dictionary-v3.js.map +1 -0
  366. package/dist/core/tokens/parsers/tailwind-v3.d.ts +3 -0
  367. package/dist/core/tokens/parsers/tailwind-v3.d.ts.map +1 -0
  368. package/dist/core/tokens/parsers/tailwind-v3.js +5 -0
  369. package/dist/core/tokens/parsers/tailwind-v3.js.map +1 -0
  370. package/dist/core/tokens/parsers/tailwind-v4.d.ts +3 -0
  371. package/dist/core/tokens/parsers/tailwind-v4.d.ts.map +1 -0
  372. package/dist/core/tokens/parsers/tailwind-v4.js +5 -0
  373. package/dist/core/tokens/parsers/tailwind-v4.js.map +1 -0
  374. package/dist/core/tokens/parsers/tokens-studio.d.ts +3 -0
  375. package/dist/core/tokens/parsers/tokens-studio.d.ts.map +1 -0
  376. package/dist/core/tokens/parsers/tokens-studio.js +5 -0
  377. package/dist/core/tokens/parsers/tokens-studio.js.map +1 -0
  378. package/dist/core/tokens/schemas.d.ts +155 -0
  379. package/dist/core/tokens/schemas.d.ts.map +1 -0
  380. package/dist/core/tokens/schemas.js +153 -0
  381. package/dist/core/tokens/schemas.js.map +1 -0
  382. package/dist/core/tokens/transforms/color.d.ts +9 -0
  383. package/dist/core/tokens/transforms/color.d.ts.map +1 -0
  384. package/dist/core/tokens/transforms/color.js +13 -0
  385. package/dist/core/tokens/transforms/color.js.map +1 -0
  386. package/dist/core/tokens/transforms/index.d.ts +36 -0
  387. package/dist/core/tokens/transforms/index.d.ts.map +1 -0
  388. package/dist/core/tokens/transforms/index.js +30 -0
  389. package/dist/core/tokens/transforms/index.js.map +1 -0
  390. package/dist/core/tokens/transforms/size.d.ts +7 -0
  391. package/dist/core/tokens/transforms/size.d.ts.map +1 -0
  392. package/dist/core/tokens/transforms/size.js +8 -0
  393. package/dist/core/tokens/transforms/size.js.map +1 -0
  394. package/dist/core/tokens/types.d.ts +284 -0
  395. package/dist/core/tokens/types.d.ts.map +1 -0
  396. package/dist/core/tokens/types.js +19 -0
  397. package/dist/core/tokens/types.js.map +1 -0
  398. package/dist/core/tokens-tools.d.ts +285 -0
  399. package/dist/core/tokens-tools.d.ts.map +1 -0
  400. package/dist/core/tokens-tools.js +1789 -0
  401. package/dist/core/tokens-tools.js.map +1 -0
  402. package/dist/core/types/design-code.d.ts +271 -0
  403. package/dist/core/types/design-code.d.ts.map +1 -0
  404. package/dist/core/types/design-code.js +5 -0
  405. package/dist/core/types/design-code.js.map +1 -0
  406. package/dist/core/types/enriched.d.ts +213 -0
  407. package/dist/core/types/enriched.d.ts.map +1 -0
  408. package/dist/core/types/enriched.js +6 -0
  409. package/dist/core/types/enriched.js.map +1 -0
  410. package/dist/core/types/index.d.ts +104 -0
  411. package/dist/core/types/index.d.ts.map +1 -0
  412. package/dist/core/types/index.js +5 -0
  413. package/dist/core/types/index.js.map +1 -0
  414. package/dist/core/variable-resolver.d.ts +45 -0
  415. package/dist/core/variable-resolver.d.ts.map +1 -0
  416. package/dist/core/variable-resolver.js +86 -0
  417. package/dist/core/variable-resolver.js.map +1 -0
  418. package/dist/core/version-tools.d.ts +59 -0
  419. package/dist/core/version-tools.d.ts.map +1 -0
  420. package/dist/core/version-tools.js +1200 -0
  421. package/dist/core/version-tools.js.map +1 -0
  422. package/dist/core/websocket-connector.d.ts +247 -0
  423. package/dist/core/websocket-connector.d.ts.map +1 -0
  424. package/dist/core/websocket-connector.js +437 -0
  425. package/dist/core/websocket-connector.js.map +1 -0
  426. package/dist/core/websocket-server.d.ts +290 -0
  427. package/dist/core/websocket-server.d.ts.map +1 -0
  428. package/dist/core/websocket-server.js +957 -0
  429. package/dist/core/websocket-server.js.map +1 -0
  430. package/dist/core/write-tools.d.ts +7 -0
  431. package/dist/core/write-tools.d.ts.map +1 -0
  432. package/dist/core/write-tools.js +2507 -0
  433. package/dist/core/write-tools.js.map +1 -0
  434. package/dist/local.d.ts +105 -0
  435. package/dist/local.d.ts.map +1 -0
  436. package/dist/local.js +3314 -0
  437. package/dist/local.js.map +1 -0
  438. package/figma-desktop-bridge/README.md +365 -0
  439. package/figma-desktop-bridge/code.js +7359 -0
  440. package/figma-desktop-bridge/icon.png +0 -0
  441. package/figma-desktop-bridge/manifest.json +67 -0
  442. package/figma-desktop-bridge/ui.html +2783 -0
  443. 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;I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pC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,SAAS,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,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;AACH,MAAM,UAAU,+BAA+B,CAC7C,OAA8B,EAC9B,OAAuB,EAAE;IAEzB,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,qEAAqE;IACrE,MAAM,YAAY,GAAG,IAAI,GAAG,EAAyB,CAAC;IACtD,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,SAAS;QAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAE7D,yEAAyE;IACzE,uEAAuE;IACvE,qEAAqE;IACrE,qEAAqE;IACrE,wEAAwE;IACxE,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACrD,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,WAAW;QAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAE1E,gCAAgC;IAChC,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM;QAClD,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC,CAAC,OAAO,CAAC,WAAW,CAA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CAAC;IACvB,OAAO,GAAG,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,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"}