figma-inspect-cli 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 (430) hide show
  1. package/README.md +156 -0
  2. package/dist/bin/figma-inspect.d.ts +3 -0
  3. package/dist/bin/figma-inspect.d.ts.map +1 -0
  4. package/dist/bin/figma-inspect.js +19 -0
  5. package/dist/bin/figma-inspect.js.map +1 -0
  6. package/dist/cli/errors.d.ts +3 -0
  7. package/dist/cli/errors.d.ts.map +1 -0
  8. package/dist/cli/errors.js +3 -0
  9. package/dist/cli/errors.js.map +1 -0
  10. package/dist/cli/export-component-set.d.ts +21 -0
  11. package/dist/cli/export-component-set.d.ts.map +1 -0
  12. package/dist/cli/export-component-set.js +173 -0
  13. package/dist/cli/export-component-set.js.map +1 -0
  14. package/dist/cli/export-contract.d.ts +20 -0
  15. package/dist/cli/export-contract.d.ts.map +1 -0
  16. package/dist/cli/export-contract.js +48 -0
  17. package/dist/cli/export-contract.js.map +1 -0
  18. package/dist/cli/export-node-contract.d.ts +17 -0
  19. package/dist/cli/export-node-contract.d.ts.map +1 -0
  20. package/dist/cli/export-node-contract.js +93 -0
  21. package/dist/cli/export-node-contract.js.map +1 -0
  22. package/dist/cli/export-result.d.ts +17 -0
  23. package/dist/cli/export-result.d.ts.map +1 -0
  24. package/dist/cli/export-result.js +22 -0
  25. package/dist/cli/export-result.js.map +1 -0
  26. package/dist/cli/export-team-index.d.ts +18 -0
  27. package/dist/cli/export-team-index.d.ts.map +1 -0
  28. package/dist/cli/export-team-index.js +121 -0
  29. package/dist/cli/export-team-index.js.map +1 -0
  30. package/dist/cli/index.d.ts +3 -0
  31. package/dist/cli/index.d.ts.map +1 -0
  32. package/dist/cli/index.js +3 -0
  33. package/dist/cli/index.js.map +1 -0
  34. package/dist/cli/output.d.ts +13 -0
  35. package/dist/cli/output.d.ts.map +1 -0
  36. package/dist/cli/output.js +26 -0
  37. package/dist/cli/output.js.map +1 -0
  38. package/dist/cli/parse-args.d.ts +3 -0
  39. package/dist/cli/parse-args.d.ts.map +1 -0
  40. package/dist/cli/parse-args.js +790 -0
  41. package/dist/cli/parse-args.js.map +1 -0
  42. package/dist/cli/run-cli.d.ts +3 -0
  43. package/dist/cli/run-cli.d.ts.map +1 -0
  44. package/dist/cli/run-cli.js +416 -0
  45. package/dist/cli/run-cli.js.map +1 -0
  46. package/dist/cli/types.d.ts +114 -0
  47. package/dist/cli/types.d.ts.map +1 -0
  48. package/dist/cli/types.js +2 -0
  49. package/dist/cli/types.js.map +1 -0
  50. package/dist/cli/usage.d.ts +2 -0
  51. package/dist/cli/usage.d.ts.map +1 -0
  52. package/dist/cli/usage.js +75 -0
  53. package/dist/cli/usage.js.map +1 -0
  54. package/dist/figma-api/cache/cached-request.d.ts +8 -0
  55. package/dist/figma-api/cache/cached-request.d.ts.map +1 -0
  56. package/dist/figma-api/cache/cached-request.js +100 -0
  57. package/dist/figma-api/cache/cached-request.js.map +1 -0
  58. package/dist/figma-api/cache/constants.d.ts +5 -0
  59. package/dist/figma-api/cache/constants.d.ts.map +1 -0
  60. package/dist/figma-api/cache/constants.js +5 -0
  61. package/dist/figma-api/cache/constants.js.map +1 -0
  62. package/dist/figma-api/cache/extract-metadata.d.ts +3 -0
  63. package/dist/figma-api/cache/extract-metadata.d.ts.map +1 -0
  64. package/dist/figma-api/cache/extract-metadata.js +13 -0
  65. package/dist/figma-api/cache/extract-metadata.js.map +1 -0
  66. package/dist/figma-api/cache/index.d.ts +3 -0
  67. package/dist/figma-api/cache/index.d.ts.map +1 -0
  68. package/dist/figma-api/cache/index.js +3 -0
  69. package/dist/figma-api/cache/index.js.map +1 -0
  70. package/dist/figma-api/cache/store.d.ts +10 -0
  71. package/dist/figma-api/cache/store.d.ts.map +1 -0
  72. package/dist/figma-api/cache/store.js +53 -0
  73. package/dist/figma-api/cache/store.js.map +1 -0
  74. package/dist/figma-api/cache/types.d.ts +20 -0
  75. package/dist/figma-api/cache/types.d.ts.map +1 -0
  76. package/dist/figma-api/cache/types.js +2 -0
  77. package/dist/figma-api/cache/types.js.map +1 -0
  78. package/dist/figma-api/cache/url.d.ts +5 -0
  79. package/dist/figma-api/cache/url.d.ts.map +1 -0
  80. package/dist/figma-api/cache/url.js +20 -0
  81. package/dist/figma-api/cache/url.js.map +1 -0
  82. package/dist/figma-api/constants.d.ts +2 -0
  83. package/dist/figma-api/constants.d.ts.map +1 -0
  84. package/dist/figma-api/constants.js +2 -0
  85. package/dist/figma-api/constants.js.map +1 -0
  86. package/dist/figma-api/fetch-with-retry.d.ts +2 -0
  87. package/dist/figma-api/fetch-with-retry.d.ts.map +1 -0
  88. package/dist/figma-api/fetch-with-retry.js +48 -0
  89. package/dist/figma-api/fetch-with-retry.js.map +1 -0
  90. package/dist/figma-api/figma-api-error.d.ts +4 -0
  91. package/dist/figma-api/figma-api-error.d.ts.map +1 -0
  92. package/dist/figma-api/figma-api-error.js +7 -0
  93. package/dist/figma-api/figma-api-error.js.map +1 -0
  94. package/dist/figma-api/figma-request.d.ts +2 -0
  95. package/dist/figma-api/figma-request.d.ts.map +1 -0
  96. package/dist/figma-api/figma-request.js +21 -0
  97. package/dist/figma-api/figma-request.js.map +1 -0
  98. package/dist/figma-api/format-figma-error.d.ts +2 -0
  99. package/dist/figma-api/format-figma-error.d.ts.map +1 -0
  100. package/dist/figma-api/format-figma-error.js +24 -0
  101. package/dist/figma-api/format-figma-error.js.map +1 -0
  102. package/dist/figma-api/get-component-set.d.ts +4 -0
  103. package/dist/figma-api/get-component-set.d.ts.map +1 -0
  104. package/dist/figma-api/get-component-set.js +8 -0
  105. package/dist/figma-api/get-component-set.js.map +1 -0
  106. package/dist/figma-api/get-file-images.d.ts +4 -0
  107. package/dist/figma-api/get-file-images.d.ts.map +1 -0
  108. package/dist/figma-api/get-file-images.js +45 -0
  109. package/dist/figma-api/get-file-images.js.map +1 -0
  110. package/dist/figma-api/get-file-node.d.ts +3 -0
  111. package/dist/figma-api/get-file-node.d.ts.map +1 -0
  112. package/dist/figma-api/get-file-node.js +8 -0
  113. package/dist/figma-api/get-file-node.js.map +1 -0
  114. package/dist/figma-api/get-file.d.ts +3 -0
  115. package/dist/figma-api/get-file.d.ts.map +1 -0
  116. package/dist/figma-api/get-file.js +6 -0
  117. package/dist/figma-api/get-file.js.map +1 -0
  118. package/dist/figma-api/index.d.ts +11 -0
  119. package/dist/figma-api/index.d.ts.map +1 -0
  120. package/dist/figma-api/index.js +11 -0
  121. package/dist/figma-api/index.js.map +1 -0
  122. package/dist/figma-api/list-file-component-sets.d.ts +4 -0
  123. package/dist/figma-api/list-file-component-sets.d.ts.map +1 -0
  124. package/dist/figma-api/list-file-component-sets.js +8 -0
  125. package/dist/figma-api/list-file-component-sets.js.map +1 -0
  126. package/dist/figma-api/list-file-components.d.ts +5 -0
  127. package/dist/figma-api/list-file-components.d.ts.map +1 -0
  128. package/dist/figma-api/list-file-components.js +13 -0
  129. package/dist/figma-api/list-file-components.js.map +1 -0
  130. package/dist/figma-api/list-file-pages.d.ts +4 -0
  131. package/dist/figma-api/list-file-pages.d.ts.map +1 -0
  132. package/dist/figma-api/list-file-pages.js +10 -0
  133. package/dist/figma-api/list-file-pages.js.map +1 -0
  134. package/dist/figma-api/list-project-files.d.ts +4 -0
  135. package/dist/figma-api/list-project-files.d.ts.map +1 -0
  136. package/dist/figma-api/list-project-files.js +8 -0
  137. package/dist/figma-api/list-project-files.js.map +1 -0
  138. package/dist/figma-api/list-team-component-sets.d.ts +4 -0
  139. package/dist/figma-api/list-team-component-sets.d.ts.map +1 -0
  140. package/dist/figma-api/list-team-component-sets.js +19 -0
  141. package/dist/figma-api/list-team-component-sets.js.map +1 -0
  142. package/dist/figma-api/list-team-project-files.d.ts +4 -0
  143. package/dist/figma-api/list-team-project-files.d.ts.map +1 -0
  144. package/dist/figma-api/list-team-project-files.js +19 -0
  145. package/dist/figma-api/list-team-project-files.js.map +1 -0
  146. package/dist/figma-api/list-team-projects.d.ts +4 -0
  147. package/dist/figma-api/list-team-projects.d.ts.map +1 -0
  148. package/dist/figma-api/list-team-projects.js +8 -0
  149. package/dist/figma-api/list-team-projects.js.map +1 -0
  150. package/dist/figma-api/schemas.d.ts +95 -0
  151. package/dist/figma-api/schemas.d.ts.map +1 -0
  152. package/dist/figma-api/schemas.js +154 -0
  153. package/dist/figma-api/schemas.js.map +1 -0
  154. package/dist/figma-api/types.d.ts +60 -0
  155. package/dist/figma-api/types.d.ts.map +1 -0
  156. package/dist/figma-api/types.js +2 -0
  157. package/dist/figma-api/types.js.map +1 -0
  158. package/dist/inspect/component-set-context.d.ts +11 -0
  159. package/dist/inspect/component-set-context.d.ts.map +1 -0
  160. package/dist/inspect/component-set-context.js +71 -0
  161. package/dist/inspect/component-set-context.js.map +1 -0
  162. package/dist/inspect/component-set-lookup.d.ts +6 -0
  163. package/dist/inspect/component-set-lookup.d.ts.map +1 -0
  164. package/dist/inspect/component-set-lookup.js +40 -0
  165. package/dist/inspect/component-set-lookup.js.map +1 -0
  166. package/dist/inspect/component-set-pseudocode/asset-backed-contract.d.ts +3 -0
  167. package/dist/inspect/component-set-pseudocode/asset-backed-contract.d.ts.map +1 -0
  168. package/dist/inspect/component-set-pseudocode/asset-backed-contract.js +34 -0
  169. package/dist/inspect/component-set-pseudocode/asset-backed-contract.js.map +1 -0
  170. package/dist/inspect/component-set-pseudocode/assets-contract.d.ts +9 -0
  171. package/dist/inspect/component-set-pseudocode/assets-contract.d.ts.map +1 -0
  172. package/dist/inspect/component-set-pseudocode/assets-contract.js +4 -0
  173. package/dist/inspect/component-set-pseudocode/assets-contract.js.map +1 -0
  174. package/dist/inspect/component-set-pseudocode/baseline-contract.d.ts +17 -0
  175. package/dist/inspect/component-set-pseudocode/baseline-contract.d.ts.map +1 -0
  176. package/dist/inspect/component-set-pseudocode/baseline-contract.js +67 -0
  177. package/dist/inspect/component-set-pseudocode/baseline-contract.js.map +1 -0
  178. package/dist/inspect/component-set-pseudocode/build-pseudocode.d.ts +24 -0
  179. package/dist/inspect/component-set-pseudocode/build-pseudocode.d.ts.map +1 -0
  180. package/dist/inspect/component-set-pseudocode/build-pseudocode.js +83 -0
  181. package/dist/inspect/component-set-pseudocode/build-pseudocode.js.map +1 -0
  182. package/dist/inspect/component-set-pseudocode/index.d.ts +2 -0
  183. package/dist/inspect/component-set-pseudocode/index.d.ts.map +1 -0
  184. package/dist/inspect/component-set-pseudocode/index.js +2 -0
  185. package/dist/inspect/component-set-pseudocode/index.js.map +1 -0
  186. package/dist/inspect/component-set-pseudocode/infer.d.ts +4 -0
  187. package/dist/inspect/component-set-pseudocode/infer.d.ts.map +1 -0
  188. package/dist/inspect/component-set-pseudocode/infer.js +426 -0
  189. package/dist/inspect/component-set-pseudocode/infer.js.map +1 -0
  190. package/dist/inspect/component-set-pseudocode/meta-contract.d.ts +27 -0
  191. package/dist/inspect/component-set-pseudocode/meta-contract.d.ts.map +1 -0
  192. package/dist/inspect/component-set-pseudocode/meta-contract.js +136 -0
  193. package/dist/inspect/component-set-pseudocode/meta-contract.js.map +1 -0
  194. package/dist/inspect/component-set-pseudocode/slim-node-guards.d.ts +14 -0
  195. package/dist/inspect/component-set-pseudocode/slim-node-guards.d.ts.map +1 -0
  196. package/dist/inspect/component-set-pseudocode/slim-node-guards.js +28 -0
  197. package/dist/inspect/component-set-pseudocode/slim-node-guards.js.map +1 -0
  198. package/dist/inspect/component-set-pseudocode/structure-contract.d.ts +71 -0
  199. package/dist/inspect/component-set-pseudocode/structure-contract.d.ts.map +1 -0
  200. package/dist/inspect/component-set-pseudocode/structure-contract.js +281 -0
  201. package/dist/inspect/component-set-pseudocode/structure-contract.js.map +1 -0
  202. package/dist/inspect/component-set-pseudocode/structure-dsl.d.ts +3 -0
  203. package/dist/inspect/component-set-pseudocode/structure-dsl.d.ts.map +1 -0
  204. package/dist/inspect/component-set-pseudocode/structure-dsl.js +170 -0
  205. package/dist/inspect/component-set-pseudocode/structure-dsl.js.map +1 -0
  206. package/dist/inspect/component-set-pseudocode/types.d.ts +44 -0
  207. package/dist/inspect/component-set-pseudocode/types.d.ts.map +1 -0
  208. package/dist/inspect/component-set-pseudocode/types.js +2 -0
  209. package/dist/inspect/component-set-pseudocode/types.js.map +1 -0
  210. package/dist/inspect/component-set-pseudocode/universal.d.ts +14 -0
  211. package/dist/inspect/component-set-pseudocode/universal.d.ts.map +1 -0
  212. package/dist/inspect/component-set-pseudocode/universal.js +393 -0
  213. package/dist/inspect/component-set-pseudocode/universal.js.map +1 -0
  214. package/dist/inspect/component-set-spec/bound-variables.d.ts +14 -0
  215. package/dist/inspect/component-set-spec/bound-variables.d.ts.map +1 -0
  216. package/dist/inspect/component-set-spec/bound-variables.js +53 -0
  217. package/dist/inspect/component-set-spec/bound-variables.js.map +1 -0
  218. package/dist/inspect/component-set-spec/build-spec.d.ts +9 -0
  219. package/dist/inspect/component-set-spec/build-spec.d.ts.map +1 -0
  220. package/dist/inspect/component-set-spec/build-spec.js +102 -0
  221. package/dist/inspect/component-set-spec/build-spec.js.map +1 -0
  222. package/dist/inspect/component-set-spec/compact-spec.d.ts +3 -0
  223. package/dist/inspect/component-set-spec/compact-spec.d.ts.map +1 -0
  224. package/dist/inspect/component-set-spec/compact-spec.js +357 -0
  225. package/dist/inspect/component-set-spec/compact-spec.js.map +1 -0
  226. package/dist/inspect/component-set-spec/extract-slots.d.ts +5 -0
  227. package/dist/inspect/component-set-spec/extract-slots.d.ts.map +1 -0
  228. package/dist/inspect/component-set-spec/extract-slots.js +57 -0
  229. package/dist/inspect/component-set-spec/extract-slots.js.map +1 -0
  230. package/dist/inspect/component-set-spec/figma-node.d.ts +9 -0
  231. package/dist/inspect/component-set-spec/figma-node.d.ts.map +1 -0
  232. package/dist/inspect/component-set-spec/figma-node.js +31 -0
  233. package/dist/inspect/component-set-spec/figma-node.js.map +1 -0
  234. package/dist/inspect/component-set-spec/index.d.ts +2 -0
  235. package/dist/inspect/component-set-spec/index.d.ts.map +1 -0
  236. package/dist/inspect/component-set-spec/index.js +2 -0
  237. package/dist/inspect/component-set-spec/index.js.map +1 -0
  238. package/dist/inspect/component-set-spec/parse-props.d.ts +9 -0
  239. package/dist/inspect/component-set-spec/parse-props.d.ts.map +1 -0
  240. package/dist/inspect/component-set-spec/parse-props.js +96 -0
  241. package/dist/inspect/component-set-spec/parse-props.js.map +1 -0
  242. package/dist/inspect/component-set-spec/prop-name.d.ts +5 -0
  243. package/dist/inspect/component-set-spec/prop-name.d.ts.map +1 -0
  244. package/dist/inspect/component-set-spec/prop-name.js +26 -0
  245. package/dist/inspect/component-set-spec/prop-name.js.map +1 -0
  246. package/dist/inspect/component-set-spec/resolve-tokens.d.ts +4 -0
  247. package/dist/inspect/component-set-spec/resolve-tokens.d.ts.map +1 -0
  248. package/dist/inspect/component-set-spec/resolve-tokens.js +42 -0
  249. package/dist/inspect/component-set-spec/resolve-tokens.js.map +1 -0
  250. package/dist/inspect/component-set-spec/slim-context.d.ts +6 -0
  251. package/dist/inspect/component-set-spec/slim-context.d.ts.map +1 -0
  252. package/dist/inspect/component-set-spec/slim-context.js +2 -0
  253. package/dist/inspect/component-set-spec/slim-context.js.map +1 -0
  254. package/dist/inspect/component-set-spec/slim-node.d.ts +5 -0
  255. package/dist/inspect/component-set-spec/slim-node.d.ts.map +1 -0
  256. package/dist/inspect/component-set-spec/slim-node.js +393 -0
  257. package/dist/inspect/component-set-spec/slim-node.js.map +1 -0
  258. package/dist/inspect/component-set-spec/slim-text-export.d.ts +8 -0
  259. package/dist/inspect/component-set-spec/slim-text-export.d.ts.map +1 -0
  260. package/dist/inspect/component-set-spec/slim-text-export.js +74 -0
  261. package/dist/inspect/component-set-spec/slim-text-export.js.map +1 -0
  262. package/dist/inspect/component-set-spec/team-component-registry.d.ts +19 -0
  263. package/dist/inspect/component-set-spec/team-component-registry.d.ts.map +1 -0
  264. package/dist/inspect/component-set-spec/team-component-registry.js +96 -0
  265. package/dist/inspect/component-set-spec/team-component-registry.js.map +1 -0
  266. package/dist/inspect/component-set-spec/types.d.ts +127 -0
  267. package/dist/inspect/component-set-spec/types.d.ts.map +1 -0
  268. package/dist/inspect/component-set-spec/types.js +2 -0
  269. package/dist/inspect/component-set-spec/types.js.map +1 -0
  270. package/dist/inspect/component-set-spec/variable-registry.d.ts +8 -0
  271. package/dist/inspect/component-set-spec/variable-registry.d.ts.map +1 -0
  272. package/dist/inspect/component-set-spec/variable-registry.js +74 -0
  273. package/dist/inspect/component-set-spec/variable-registry.js.map +1 -0
  274. package/dist/inspect/component-set-spec/variant-axes.d.ts +2 -0
  275. package/dist/inspect/component-set-spec/variant-axes.d.ts.map +1 -0
  276. package/dist/inspect/component-set-spec/variant-axes.js +14 -0
  277. package/dist/inspect/component-set-spec/variant-axes.js.map +1 -0
  278. package/dist/inspect/contract/contract-format.d.ts +5 -0
  279. package/dist/inspect/contract/contract-format.d.ts.map +1 -0
  280. package/dist/inspect/contract/contract-format.js +26 -0
  281. package/dist/inspect/contract/contract-format.js.map +1 -0
  282. package/dist/inspect/contract/contract-lock.d.ts +75 -0
  283. package/dist/inspect/contract/contract-lock.d.ts.map +1 -0
  284. package/dist/inspect/contract/contract-lock.js +326 -0
  285. package/dist/inspect/contract/contract-lock.js.map +1 -0
  286. package/dist/inspect/contract/contract-schema.d.ts +51 -0
  287. package/dist/inspect/contract/contract-schema.d.ts.map +1 -0
  288. package/dist/inspect/contract/contract-schema.js +130 -0
  289. package/dist/inspect/contract/contract-schema.js.map +1 -0
  290. package/dist/inspect/contract/fingerprint.d.ts +9 -0
  291. package/dist/inspect/contract/fingerprint.d.ts.map +1 -0
  292. package/dist/inspect/contract/fingerprint.js +301 -0
  293. package/dist/inspect/contract/fingerprint.js.map +1 -0
  294. package/dist/inspect/contract/lock-metadata.d.ts +30 -0
  295. package/dist/inspect/contract/lock-metadata.d.ts.map +1 -0
  296. package/dist/inspect/contract/lock-metadata.js +101 -0
  297. package/dist/inspect/contract/lock-metadata.js.map +1 -0
  298. package/dist/inspect/contract/stable-stringify.d.ts +2 -0
  299. package/dist/inspect/contract/stable-stringify.d.ts.map +1 -0
  300. package/dist/inspect/contract/stable-stringify.js +14 -0
  301. package/dist/inspect/contract/stable-stringify.js.map +1 -0
  302. package/dist/inspect/contract/verify-component-contract.d.ts +19 -0
  303. package/dist/inspect/contract/verify-component-contract.d.ts.map +1 -0
  304. package/dist/inspect/contract/verify-component-contract.js +126 -0
  305. package/dist/inspect/contract/verify-component-contract.js.map +1 -0
  306. package/dist/inspect/errors.d.ts +4 -0
  307. package/dist/inspect/errors.d.ts.map +1 -0
  308. package/dist/inspect/errors.js +7 -0
  309. package/dist/inspect/errors.js.map +1 -0
  310. package/dist/inspect/export/assert-asset-exportable.d.ts +3 -0
  311. package/dist/inspect/export/assert-asset-exportable.d.ts.map +1 -0
  312. package/dist/inspect/export/assert-asset-exportable.js +45 -0
  313. package/dist/inspect/export/assert-asset-exportable.js.map +1 -0
  314. package/dist/inspect/export/export-nested-assets.d.ts +94 -0
  315. package/dist/inspect/export/export-nested-assets.d.ts.map +1 -0
  316. package/dist/inspect/export/export-nested-assets.js +333 -0
  317. package/dist/inspect/export/export-nested-assets.js.map +1 -0
  318. package/dist/inspect/export/export-node-preview.d.ts +24 -0
  319. package/dist/inspect/export/export-node-preview.d.ts.map +1 -0
  320. package/dist/inspect/export/export-node-preview.js +34 -0
  321. package/dist/inspect/export/export-node-preview.js.map +1 -0
  322. package/dist/inspect/export/export-variant-assets.d.ts +18 -0
  323. package/dist/inspect/export/export-variant-assets.d.ts.map +1 -0
  324. package/dist/inspect/export/export-variant-assets.js +127 -0
  325. package/dist/inspect/export/export-variant-assets.js.map +1 -0
  326. package/dist/inspect/export/normalize-exported-svg.d.ts +2 -0
  327. package/dist/inspect/export/normalize-exported-svg.d.ts.map +1 -0
  328. package/dist/inspect/export/normalize-exported-svg.js +15 -0
  329. package/dist/inspect/export/normalize-exported-svg.js.map +1 -0
  330. package/dist/inspect/export/rendered-image-bytes.d.ts +4 -0
  331. package/dist/inspect/export/rendered-image-bytes.d.ts.map +1 -0
  332. package/dist/inspect/export/rendered-image-bytes.js +24 -0
  333. package/dist/inspect/export/rendered-image-bytes.js.map +1 -0
  334. package/dist/inspect/export-contract-target.d.ts +7 -0
  335. package/dist/inspect/export-contract-target.d.ts.map +1 -0
  336. package/dist/inspect/export-contract-target.js +33 -0
  337. package/dist/inspect/export-contract-target.js.map +1 -0
  338. package/dist/inspect/fetch-file-entry.d.ts +4 -0
  339. package/dist/inspect/fetch-file-entry.d.ts.map +1 -0
  340. package/dist/inspect/fetch-file-entry.js +7 -0
  341. package/dist/inspect/fetch-file-entry.js.map +1 -0
  342. package/dist/inspect/fetch-file-node-entry.d.ts +4 -0
  343. package/dist/inspect/fetch-file-node-entry.d.ts.map +1 -0
  344. package/dist/inspect/fetch-file-node-entry.js +7 -0
  345. package/dist/inspect/fetch-file-node-entry.js.map +1 -0
  346. package/dist/inspect/figma-node-url.d.ts +3 -0
  347. package/dist/inspect/figma-node-url.d.ts.map +1 -0
  348. package/dist/inspect/figma-node-url.js +30 -0
  349. package/dist/inspect/figma-node-url.js.map +1 -0
  350. package/dist/inspect/get-node-component-set.d.ts +5 -0
  351. package/dist/inspect/get-node-component-set.d.ts.map +1 -0
  352. package/dist/inspect/get-node-component-set.js +10 -0
  353. package/dist/inspect/get-node-component-set.js.map +1 -0
  354. package/dist/inspect/index.d.ts +17 -0
  355. package/dist/inspect/index.d.ts.map +1 -0
  356. package/dist/inspect/index.js +17 -0
  357. package/dist/inspect/index.js.map +1 -0
  358. package/dist/inspect/list-all-component-sets.d.ts +3 -0
  359. package/dist/inspect/list-all-component-sets.d.ts.map +1 -0
  360. package/dist/inspect/list-all-component-sets.js +27 -0
  361. package/dist/inspect/list-all-component-sets.js.map +1 -0
  362. package/dist/inspect/list-component-set-properties.d.ts +4 -0
  363. package/dist/inspect/list-component-set-properties.d.ts.map +1 -0
  364. package/dist/inspect/list-component-set-properties.js +73 -0
  365. package/dist/inspect/list-component-set-properties.js.map +1 -0
  366. package/dist/inspect/node-contract/build-node-contract.d.ts +12 -0
  367. package/dist/inspect/node-contract/build-node-contract.d.ts.map +1 -0
  368. package/dist/inspect/node-contract/build-node-contract.js +212 -0
  369. package/dist/inspect/node-contract/build-node-contract.js.map +1 -0
  370. package/dist/inspect/node-contract/dependencies.d.ts +5 -0
  371. package/dist/inspect/node-contract/dependencies.d.ts.map +1 -0
  372. package/dist/inspect/node-contract/dependencies.js +84 -0
  373. package/dist/inspect/node-contract/dependencies.js.map +1 -0
  374. package/dist/inspect/node-contract/index.d.ts +6 -0
  375. package/dist/inspect/node-contract/index.d.ts.map +1 -0
  376. package/dist/inspect/node-contract/index.js +6 -0
  377. package/dist/inspect/node-contract/index.js.map +1 -0
  378. package/dist/inspect/node-contract/node-kind.d.ts +9 -0
  379. package/dist/inspect/node-contract/node-kind.d.ts.map +1 -0
  380. package/dist/inspect/node-contract/node-kind.js +31 -0
  381. package/dist/inspect/node-contract/node-kind.js.map +1 -0
  382. package/dist/inspect/node-contract/node-lock.d.ts +6 -0
  383. package/dist/inspect/node-contract/node-lock.d.ts.map +1 -0
  384. package/dist/inspect/node-contract/node-lock.js +181 -0
  385. package/dist/inspect/node-contract/node-lock.js.map +1 -0
  386. package/dist/inspect/node-contract/node-schema.d.ts +14 -0
  387. package/dist/inspect/node-contract/node-schema.d.ts.map +1 -0
  388. package/dist/inspect/node-contract/node-schema.js +137 -0
  389. package/dist/inspect/node-contract/node-schema.js.map +1 -0
  390. package/dist/inspect/node-contract/paths.d.ts +10 -0
  391. package/dist/inspect/node-contract/paths.d.ts.map +1 -0
  392. package/dist/inspect/node-contract/paths.js +29 -0
  393. package/dist/inspect/node-contract/paths.js.map +1 -0
  394. package/dist/inspect/node-contract/tokens.d.ts +4 -0
  395. package/dist/inspect/node-contract/tokens.d.ts.map +1 -0
  396. package/dist/inspect/node-contract/tokens.js +30 -0
  397. package/dist/inspect/node-contract/tokens.js.map +1 -0
  398. package/dist/inspect/node-contract/types.d.ts +84 -0
  399. package/dist/inspect/node-contract/types.d.ts.map +1 -0
  400. package/dist/inspect/node-contract/types.js +2 -0
  401. package/dist/inspect/node-contract/types.js.map +1 -0
  402. package/dist/inspect/node-contract/verify-node-contract.d.ts +20 -0
  403. package/dist/inspect/node-contract/verify-node-contract.d.ts.map +1 -0
  404. package/dist/inspect/node-contract/verify-node-contract.js +131 -0
  405. package/dist/inspect/node-contract/verify-node-contract.js.map +1 -0
  406. package/dist/inspect/resolve-team-component-set.d.ts +14 -0
  407. package/dist/inspect/resolve-team-component-set.d.ts.map +1 -0
  408. package/dist/inspect/resolve-team-component-set.js +77 -0
  409. package/dist/inspect/resolve-team-component-set.js.map +1 -0
  410. package/dist/inspect/schemas.d.ts +37 -0
  411. package/dist/inspect/schemas.d.ts.map +1 -0
  412. package/dist/inspect/schemas.js +79 -0
  413. package/dist/inspect/schemas.js.map +1 -0
  414. package/dist/inspect/team-index.d.ts +76 -0
  415. package/dist/inspect/team-index.d.ts.map +1 -0
  416. package/dist/inspect/team-index.js +361 -0
  417. package/dist/inspect/team-index.js.map +1 -0
  418. package/dist/inspect/types.d.ts +46 -0
  419. package/dist/inspect/types.d.ts.map +1 -0
  420. package/dist/inspect/types.js +2 -0
  421. package/dist/inspect/types.js.map +1 -0
  422. package/dist/test/fixtures.d.ts +3 -0
  423. package/dist/test/fixtures.d.ts.map +1 -0
  424. package/dist/test/fixtures.js +6 -0
  425. package/dist/test/fixtures.js.map +1 -0
  426. package/dist/zod/parse-valid-entries.d.ts +4 -0
  427. package/dist/zod/parse-valid-entries.d.ts.map +1 -0
  428. package/dist/zod/parse-valid-entries.js +20 -0
  429. package/dist/zod/parse-valid-entries.js.map +1 -0
  430. package/package.json +39 -0
@@ -0,0 +1,57 @@
1
+ import { isRecord, readChildren, readRecord, readString, } from "./figma-node.js";
2
+ export function instanceSlotKey(rawName) {
3
+ if (rawName.endsWith("Icon")) {
4
+ return "icon";
5
+ }
6
+ return rawName.charAt(0).toLowerCase() + rawName.slice(1);
7
+ }
8
+ function readComponentProperties(node) {
9
+ const raw = readRecord(node, "componentProperties");
10
+ if (!raw) {
11
+ return undefined;
12
+ }
13
+ const props = {};
14
+ for (const [key, value] of Object.entries(raw)) {
15
+ if (!isRecord(value)) {
16
+ continue;
17
+ }
18
+ const propValue = readString(value, "value");
19
+ if (propValue) {
20
+ props[instanceSlotKey(key)] = propValue;
21
+ }
22
+ }
23
+ return Object.keys(props).length > 0 ? props : undefined;
24
+ }
25
+ function collectNestedInstanceSlots(node, registry, slots) {
26
+ for (const child of readChildren(node)) {
27
+ if (readString(child, "type") !== "INSTANCE") {
28
+ collectNestedInstanceSlots(child, registry, slots);
29
+ continue;
30
+ }
31
+ const instanceName = readString(child, "name");
32
+ const componentId = readString(child, "componentId");
33
+ if (!instanceName) {
34
+ collectNestedInstanceSlots(child, registry, slots);
35
+ continue;
36
+ }
37
+ const slotKey = instanceSlotKey(instanceName);
38
+ if (!slots[slotKey]) {
39
+ slots[slotKey] = instanceName;
40
+ }
41
+ if (instanceName.endsWith("Icon") ||
42
+ registry?.isKnownComponent(instanceName, componentId)) {
43
+ continue;
44
+ }
45
+ collectNestedInstanceSlots(child, registry, slots);
46
+ }
47
+ }
48
+ export function extractInstanceSlots(node, registry) {
49
+ const fromProps = readComponentProperties(node);
50
+ if (fromProps) {
51
+ return fromProps;
52
+ }
53
+ const slots = {};
54
+ collectNestedInstanceSlots(node, registry, slots);
55
+ return Object.keys(slots).length > 0 ? slots : undefined;
56
+ }
57
+ //# sourceMappingURL=extract-slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-slots.js","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/extract-slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,iBAAiB,CAAC;AAGzB,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,OAAO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AC,CAAC;QACrD,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,0BAA0B,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YACnD,SAAS;QACX,CAAC;QAED,MAAM,OAAO,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YACpB,KAAK,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;QAChC,CAAC;QAED,IACE,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC7B,QAAQ,EAAE,gBAAgB,CAAC,YAAY,EAAE,WAAW,CAAC,EACrD,CAAC;YACD,SAAS;QACX,CAAC;QAED,0BAA0B,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAe,EACf,QAA2C;IAE3C,MAAM,SAAS,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,0BAA0B,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type FigmaNode = Record<string, unknown>;
2
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
3
+ export declare function readString(node: Record<string, unknown>, key: string): string | undefined;
4
+ export declare function readNumber(node: Record<string, unknown>, key: string): number | undefined;
5
+ export declare function readBoolean(node: Record<string, unknown>, key: string): boolean | undefined;
6
+ export declare function readArray(node: Record<string, unknown>, key: string): unknown[] | undefined;
7
+ export declare function readRecord(node: Record<string, unknown>, key: string): Record<string, unknown> | undefined;
8
+ export declare function readChildren(node: Record<string, unknown>): FigmaNode[];
9
+ //# sourceMappingURL=figma-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figma-node.d.ts","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/figma-node.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,OAAO,GAAG,SAAS,CAGrB;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,OAAO,EAAE,GAAG,SAAS,CAGvB;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAGrC;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,CAOvE"}
@@ -0,0 +1,31 @@
1
+ export function isRecord(value) {
2
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3
+ }
4
+ export function readString(node, key) {
5
+ const value = node[key];
6
+ return typeof value === "string" ? value : undefined;
7
+ }
8
+ export function readNumber(node, key) {
9
+ const value = node[key];
10
+ return typeof value === "number" ? value : undefined;
11
+ }
12
+ export function readBoolean(node, key) {
13
+ const value = node[key];
14
+ return typeof value === "boolean" ? value : undefined;
15
+ }
16
+ export function readArray(node, key) {
17
+ const value = node[key];
18
+ return Array.isArray(value) ? value : undefined;
19
+ }
20
+ export function readRecord(node, key) {
21
+ const value = node[key];
22
+ return isRecord(value) ? value : undefined;
23
+ }
24
+ export function readChildren(node) {
25
+ const children = readArray(node, "children");
26
+ if (!children) {
27
+ return [];
28
+ }
29
+ return children.filter(isRecord);
30
+ }
31
+ //# sourceMappingURL=figma-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figma-node.js","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/figma-node.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAA6B,EAC7B,GAAW;IAEX,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAA6B,EAC7B,GAAW;IAEX,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,IAA6B,EAC7B,GAAW;IAEX,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,IAA6B,EAC7B,GAAW;IAEX,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAA6B,EAC7B,GAAW;IAEX,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAA6B;IACxD,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC7C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { buildComponentSetSpecFromFile } from "./build-spec.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { buildComponentSetSpecFromFile } from "./build-spec.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ComponentSetPropDefinition } from "./types.js";
2
+ export interface ParsedComponentSetProps {
3
+ props: Record<string, ComponentSetPropDefinition>;
4
+ propIdToName: Map<string, string>;
5
+ baseVariant: Record<string, string>;
6
+ }
7
+ export declare function parseComponentSetProps(componentSet: Record<string, unknown>): ParsedComponentSetProps;
8
+ export declare function parseVariantName(name: string): Record<string, string>;
9
+ //# sourceMappingURL=parse-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-props.d.ts","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/parse-props.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IAClD,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AA6DD,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,uBAAuB,CA8BzB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBrE"}
@@ -0,0 +1,96 @@
1
+ import { isRecord, readArray, readBoolean, readRecord, readString, } from "./figma-node.js";
2
+ import { rawPropKey, resolvePropName } from "./prop-name.js";
3
+ function readSwapSet(definition) {
4
+ const preferredValues = readArray(definition, "preferredValues");
5
+ const first = preferredValues?.find(isRecord);
6
+ if (!first) {
7
+ return undefined;
8
+ }
9
+ const type = readString(first, "type");
10
+ if (type !== "COMPONENT_SET" && type !== "COMPONENT") {
11
+ return undefined;
12
+ }
13
+ return readString(first, "key");
14
+ }
15
+ function parseDefinition(definition) {
16
+ const type = readString(definition, "type");
17
+ if (!type) {
18
+ return undefined;
19
+ }
20
+ switch (type) {
21
+ case "BOOLEAN": {
22
+ return {
23
+ type: "boolean",
24
+ default: readBoolean(definition, "defaultValue"),
25
+ };
26
+ }
27
+ case "TEXT": {
28
+ return {
29
+ type: "text",
30
+ default: readString(definition, "defaultValue"),
31
+ };
32
+ }
33
+ case "INSTANCE_SWAP": {
34
+ return {
35
+ type: "instance",
36
+ default: readString(definition, "defaultValue"),
37
+ swapSet: readSwapSet(definition),
38
+ };
39
+ }
40
+ case "VARIANT": {
41
+ const options = readArray(definition, "variantOptions")
42
+ ?.map((option) => (typeof option === "string" ? option : undefined))
43
+ .filter((option) => option !== undefined);
44
+ return {
45
+ type: "variant",
46
+ default: readString(definition, "defaultValue"),
47
+ options,
48
+ };
49
+ }
50
+ default:
51
+ return undefined;
52
+ }
53
+ }
54
+ export function parseComponentSetProps(componentSet) {
55
+ const definitions = readRecord(componentSet, "componentPropertyDefinitions");
56
+ const props = {};
57
+ const propIdToName = new Map();
58
+ const baseVariant = {};
59
+ if (!definitions) {
60
+ return { props, propIdToName, baseVariant };
61
+ }
62
+ for (const [rawKey, rawDefinition] of Object.entries(definitions)) {
63
+ if (!isRecord(rawDefinition)) {
64
+ continue;
65
+ }
66
+ const parsed = parseDefinition(rawDefinition);
67
+ if (!parsed) {
68
+ continue;
69
+ }
70
+ const propName = resolvePropName(rawKey, parsed.type);
71
+ props[propName] = parsed;
72
+ propIdToName.set(rawKey, propName);
73
+ if (parsed.type === "variant" && typeof parsed.default === "string") {
74
+ baseVariant[rawPropKey(rawKey)] = parsed.default;
75
+ }
76
+ }
77
+ return { props, propIdToName, baseVariant };
78
+ }
79
+ export function parseVariantName(name) {
80
+ const variants = {};
81
+ for (const part of name.split(",")) {
82
+ const trimmed = part.trim();
83
+ const separator = trimmed.indexOf("=");
84
+ if (separator === -1) {
85
+ continue;
86
+ }
87
+ const key = trimmed.slice(0, separator).trim();
88
+ const value = trimmed.slice(separator + 1).trim();
89
+ if (key.length === 0 || value.length === 0) {
90
+ continue;
91
+ }
92
+ variants[key] = value;
93
+ }
94
+ return variants;
95
+ }
96
+ //# sourceMappingURL=parse-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-props.js","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/parse-props.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAS7D,SAAS,WAAW,CAAC,UAAmC;IACtD,MAAM,eAAe,GAAG,SAAS,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,IAAI,IAAI,KAAK,eAAe,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACrD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,eAAe,CACtB,UAAmC;IAEnC,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS,CAAC,CAAC,CAAC;YACf,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,WAAW,CAAC,UAAU,EAAE,cAAc,CAAC;aACjD,CAAC;QACJ,CAAC;QACD,KAAK,MAA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AAE,CAAC;QAClD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3C,SAAS;QACX,CAAC;QAED,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ComponentSetPropDefinition } from "./types.js";
2
+ export declare function rawPropKey(rawKey: string): string;
3
+ export declare function normalizePropName(raw: string): string;
4
+ export declare function resolvePropName(rawKey: string, type: ComponentSetPropDefinition["type"]): string;
5
+ //# sourceMappingURL=prop-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop-name.d.ts","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/prop-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAerD;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,GACvC,MAAM,CAMR"}
@@ -0,0 +1,26 @@
1
+ export function rawPropKey(rawKey) {
2
+ return rawKey.split("#")[0] ?? rawKey;
3
+ }
4
+ export function normalizePropName(raw) {
5
+ const base = rawPropKey(raw);
6
+ const words = base
7
+ .replace(/[^A-Za-z0-9_$]+/g, " ")
8
+ .trim()
9
+ .split(/\s+/)
10
+ .filter((word) => word.length > 0);
11
+ if (words.length === 0) {
12
+ return "value";
13
+ }
14
+ const [first = "value", ...rest] = words;
15
+ return [
16
+ first.charAt(0).toLowerCase() + first.slice(1),
17
+ ...rest.map((word) => word.charAt(0).toUpperCase() + word.slice(1)),
18
+ ].join("");
19
+ }
20
+ export function resolvePropName(rawKey, type) {
21
+ if (type === "variant") {
22
+ return rawPropKey(rawKey);
23
+ }
24
+ return normalizePropName(rawKey);
25
+ }
26
+ //# sourceMappingURL=prop-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop-name.js","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/prop-name.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,IAAI;SACf,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC;SAChC,IAAI,EAAE;SACN,KAAK,CAAC,KAAK,CAAC;SACZ,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IACzC,OAAO;QACL,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9C,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACpE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,MAAc,EACd,IAAwC;IAExC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ComponentSetSpec } from "./types.js";
2
+ import type { VariableRegistry } from "./variable-registry.js";
3
+ export declare function resolveSpecTokens(spec: ComponentSetSpec, registry: VariableRegistry): ComponentSetSpec;
4
+ //# sourceMappingURL=resolve-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-tokens.d.ts","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/resolve-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAwD/D,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,gBAAgB,GACzB,gBAAgB,CAKlB"}
@@ -0,0 +1,42 @@
1
+ function resolveVariableField(value, registry) {
2
+ const variable = value.variable;
3
+ if (typeof variable !== "string") {
4
+ return value;
5
+ }
6
+ const token = registry.resolve(variable);
7
+ if (!token) {
8
+ return value;
9
+ }
10
+ const { variable: _removed, ...rest } = value;
11
+ return { ...rest, token };
12
+ }
13
+ function resolveValue(value, registry) {
14
+ if (Array.isArray(value)) {
15
+ return value.map((entry) => resolveValue(entry, registry));
16
+ }
17
+ if (typeof value !== "object" || value === null) {
18
+ return value;
19
+ }
20
+ const resolved = resolveVariableField(value, registry);
21
+ const output = {};
22
+ for (const [key, entry] of Object.entries(resolved)) {
23
+ output[key] = resolveValue(entry, registry);
24
+ }
25
+ return output;
26
+ }
27
+ function resolveNode(node, registry) {
28
+ return resolveValue(node, registry);
29
+ }
30
+ function resolveVariant(variant, registry) {
31
+ return {
32
+ when: variant.when,
33
+ layout: resolveNode(variant.layout, registry),
34
+ };
35
+ }
36
+ export function resolveSpecTokens(spec, registry) {
37
+ return {
38
+ ...spec,
39
+ variants: spec.variants.map((variant) => resolveVariant(variant, registry)),
40
+ };
41
+ }
42
+ //# sourceMappingURL=resolve-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-tokens.js","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/resolve-tokens.ts"],"names":[],"mappings":"AAOA,SAAS,oBAAoB,CAC3B,KAA8B,EAC9B,QAA0B;IAE1B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC9C,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,YAAY,CAAC,KAAc,EAAE,QAA0B;IAC9D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,oBAAoB,CACnC,KAAgC,EAChC,QAAQ,CACT,CAAC;IACF,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,WAAW,CAAC,IAAc,EAAE,QAA0B;IAC7D,OAAO,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAa,CAAC;AAClD,CAAC;AAED,SAAS,cAAc,CACrB,OAA4B,EAC5B,QAA0B;IAE1B,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAsB,EACtB,QAA0B;IAE1B,OAAO;QACL,GAAG,IAAI;QACP,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KAC5E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { TeamComponentRegistry } from "./team-component-registry.js";
2
+ export interface SlimContext {
3
+ propIdToName: Map<string, string>;
4
+ teamComponents?: TeamComponentRegistry;
5
+ }
6
+ //# sourceMappingURL=slim-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slim-context.d.ts","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/slim-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=slim-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slim-context.js","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/slim-context.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { type FigmaNode } from "./figma-node.js";
2
+ import type { SlimContext } from "./slim-context.js";
3
+ import type { SlimNode } from "./types.js";
4
+ export declare function slimNode(node: FigmaNode, context: SlimContext): SlimNode | undefined;
5
+ //# sourceMappingURL=slim-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slim-node.d.ts","sourceRoot":"","sources":["../../../src/inspect/component-set-spec/slim-node.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,SAAS,EAQf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EASV,QAAQ,EAMT,MAAM,YAAY,CAAC;AAsfpB,wBAAgB,QAAQ,CACtB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,WAAW,GACnB,QAAQ,GAAG,SAAS,CAqDtB"}