@open-pencil/scene-graph 0.17.0-beta.7 → 0.18.0-beta.1

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 (423) hide show
  1. package/dist/behaviours/index.d.ts +3 -2
  2. package/dist/behaviours/index.js +2 -1
  3. package/dist/behaviours/kinds.d.ts.map +1 -1
  4. package/dist/behaviours/kinds.js +15 -8
  5. package/dist/behaviours/kinds.js.map +1 -1
  6. package/dist/behaviours/model.d.ts +2 -2
  7. package/dist/behaviours/model.d.ts.map +1 -1
  8. package/dist/behaviours/model.js.map +1 -1
  9. package/dist/behaviours/schema.d.ts +136 -1
  10. package/dist/behaviours/schema.d.ts.map +1 -1
  11. package/dist/behaviours/schema.js +17 -2
  12. package/dist/behaviours/schema.js.map +1 -1
  13. package/dist/behaviours/spec.d.ts.map +1 -1
  14. package/dist/behaviours/spec.js +4 -0
  15. package/dist/behaviours/spec.js.map +1 -1
  16. package/dist/behaviours/transition.d.ts +23 -0
  17. package/dist/behaviours/transition.d.ts.map +1 -0
  18. package/dist/behaviours/transition.js +36 -0
  19. package/dist/behaviours/transition.js.map +1 -0
  20. package/dist/checkpoint.d.ts.map +1 -1
  21. package/dist/checkpoint.js +2 -0
  22. package/dist/checkpoint.js.map +1 -1
  23. package/dist/color/index.d.ts +12 -9
  24. package/dist/color/index.d.ts.map +1 -1
  25. package/dist/color/index.js +15 -25
  26. package/dist/color/index.js.map +1 -1
  27. package/dist/color/management.d.ts +51 -23
  28. package/dist/color/management.d.ts.map +1 -1
  29. package/dist/color/management.js +154 -149
  30. package/dist/color/management.js.map +1 -1
  31. package/dist/color/okhcl.d.ts +28 -10
  32. package/dist/color/okhcl.d.ts.map +1 -1
  33. package/dist/color/okhcl.js +56 -40
  34. package/dist/color/okhcl.js.map +1 -1
  35. package/dist/color/schema.d.ts +6 -1
  36. package/dist/color/schema.d.ts.map +1 -1
  37. package/dist/color/schema.js +10 -1
  38. package/dist/color/schema.js.map +1 -1
  39. package/dist/constraints.d.ts.map +1 -1
  40. package/dist/constraints.js +2 -1
  41. package/dist/constraints.js.map +1 -1
  42. package/dist/copy.d.ts +7 -1
  43. package/dist/copy.d.ts.map +1 -1
  44. package/dist/copy.js +22 -1
  45. package/dist/copy.js.map +1 -1
  46. package/dist/corners.d.ts +3 -1
  47. package/dist/corners.d.ts.map +1 -1
  48. package/dist/corners.js +3 -1
  49. package/dist/corners.js.map +1 -1
  50. package/dist/css/grid.js +1 -1
  51. package/dist/css/index.d.ts +3 -2
  52. package/dist/css/index.js +3 -2
  53. package/dist/css/motion.d.ts +12 -0
  54. package/dist/css/motion.d.ts.map +1 -0
  55. package/dist/css/motion.js +60 -0
  56. package/dist/css/motion.js.map +1 -0
  57. package/dist/css/shadows.d.ts +4 -3
  58. package/dist/css/shadows.d.ts.map +1 -1
  59. package/dist/css/shadows.js +8 -18
  60. package/dist/css/shadows.js.map +1 -1
  61. package/dist/css/values.d.ts +6 -3
  62. package/dist/css/values.d.ts.map +1 -1
  63. package/dist/css/values.js +23 -5
  64. package/dist/css/values.js.map +1 -1
  65. package/dist/fields/index.d.ts +2 -2
  66. package/dist/fields/index.js +2 -2
  67. package/dist/fields/layout.d.ts +3 -1
  68. package/dist/fields/layout.d.ts.map +1 -1
  69. package/dist/fields/layout.js +9 -1
  70. package/dist/fields/layout.js.map +1 -1
  71. package/dist/figjam/palette.js +1 -1
  72. package/dist/font-style.d.ts.map +1 -1
  73. package/dist/font-style.js +7 -3
  74. package/dist/font-style.js.map +1 -1
  75. package/dist/generated/index.d.ts +6 -2
  76. package/dist/generated/index.d.ts.map +1 -1
  77. package/dist/generated/index.js +14 -4
  78. package/dist/generated/index.js.map +1 -1
  79. package/dist/geometry.d.ts +6 -1
  80. package/dist/geometry.d.ts.map +1 -1
  81. package/dist/geometry.js +10 -2
  82. package/dist/geometry.js.map +1 -1
  83. package/dist/graph.d.ts +29 -4
  84. package/dist/graph.d.ts.map +1 -1
  85. package/dist/graph.js +59 -9
  86. package/dist/graph.js.map +1 -1
  87. package/dist/group-bounds.d.ts +5 -2
  88. package/dist/group-bounds.d.ts.map +1 -1
  89. package/dist/group-bounds.js +38 -8
  90. package/dist/group-bounds.js.map +1 -1
  91. package/dist/hit-test.d.ts.map +1 -1
  92. package/dist/hit-test.js +19 -8
  93. package/dist/hit-test.js.map +1 -1
  94. package/dist/index.d.ts +2 -2
  95. package/dist/index.js +2 -2
  96. package/dist/instances/content-size.js +1 -1
  97. package/dist/instances/fields.d.ts +2 -2
  98. package/dist/instances/fields.d.ts.map +1 -1
  99. package/dist/instances/fields.js +2 -0
  100. package/dist/instances/fields.js.map +1 -1
  101. package/dist/instances/index.d.ts.map +1 -1
  102. package/dist/instances/index.js +50 -11
  103. package/dist/instances/index.js.map +1 -1
  104. package/dist/instances/sync.js +67 -7
  105. package/dist/instances/sync.js.map +1 -1
  106. package/dist/layout/flow.d.ts +16 -0
  107. package/dist/layout/flow.d.ts.map +1 -0
  108. package/dist/layout/flow.js +34 -0
  109. package/dist/layout/flow.js.map +1 -0
  110. package/dist/layout/index.d.ts +4 -3
  111. package/dist/layout/index.js +4 -3
  112. package/dist/layout/keywords.d.ts.map +1 -1
  113. package/dist/layout/keywords.js +7 -1
  114. package/dist/layout/keywords.js.map +1 -1
  115. package/dist/layout/sizing.d.ts +9 -1
  116. package/dist/layout/sizing.d.ts.map +1 -1
  117. package/dist/layout/sizing.js +17 -1
  118. package/dist/layout/sizing.js.map +1 -1
  119. package/dist/layout/spacing.d.ts +7 -1
  120. package/dist/layout/spacing.d.ts.map +1 -1
  121. package/dist/layout/spacing.js +10 -1
  122. package/dist/layout/spacing.js.map +1 -1
  123. package/dist/mesh/geometry.d.ts +83 -0
  124. package/dist/mesh/geometry.d.ts.map +1 -0
  125. package/dist/mesh/geometry.js +441 -0
  126. package/dist/mesh/geometry.js.map +1 -0
  127. package/dist/mesh/index.d.ts +4 -0
  128. package/dist/mesh/index.js +4 -0
  129. package/dist/mesh/model.d.ts +28 -0
  130. package/dist/mesh/model.d.ts.map +1 -0
  131. package/dist/mesh/model.js +40 -0
  132. package/dist/mesh/model.js.map +1 -0
  133. package/dist/mesh/schema.d.ts +191 -0
  134. package/dist/mesh/schema.d.ts.map +1 -0
  135. package/dist/mesh/schema.js +56 -0
  136. package/dist/mesh/schema.js.map +1 -0
  137. package/dist/mutation-impact.d.ts +2 -0
  138. package/dist/mutation-impact.d.ts.map +1 -1
  139. package/dist/mutation-impact.js +18 -7
  140. package/dist/mutation-impact.js.map +1 -1
  141. package/dist/node-defaults.d.ts +3 -1
  142. package/dist/node-defaults.d.ts.map +1 -1
  143. package/dist/node-defaults.js +22 -6
  144. package/dist/node-defaults.js.map +1 -1
  145. package/dist/paints/index.d.ts +5 -3
  146. package/dist/paints/index.js +5 -3
  147. package/dist/paints/pattern.d.ts +5 -1
  148. package/dist/paints/pattern.d.ts.map +1 -1
  149. package/dist/paints/pattern.js +33 -1
  150. package/dist/paints/pattern.js.map +1 -1
  151. package/dist/paints/shows.d.ts +4 -1
  152. package/dist/paints/shows.d.ts.map +1 -1
  153. package/dist/paints/shows.js +8 -1
  154. package/dist/paints/shows.js.map +1 -1
  155. package/dist/paints/solid.d.ts +11 -0
  156. package/dist/paints/solid.d.ts.map +1 -0
  157. package/dist/paints/solid.js +18 -0
  158. package/dist/paints/solid.js.map +1 -0
  159. package/dist/paints/stills.d.ts +74 -0
  160. package/dist/paints/stills.d.ts.map +1 -0
  161. package/dist/paints/stills.js +113 -0
  162. package/dist/paints/stills.js.map +1 -0
  163. package/dist/plugin-data/field.d.ts.map +1 -1
  164. package/dist/plugin-data/field.js +2 -0
  165. package/dist/plugin-data/field.js.map +1 -1
  166. package/dist/plugin-data/fields.d.ts +67 -0
  167. package/dist/plugin-data/fields.d.ts.map +1 -1
  168. package/dist/plugin-data/fields.js +12 -7
  169. package/dist/plugin-data/fields.js.map +1 -1
  170. package/dist/resize.d.ts +10 -3
  171. package/dist/resize.d.ts.map +1 -1
  172. package/dist/resize.js +34 -3
  173. package/dist/resize.js.map +1 -1
  174. package/dist/scaling/index.d.ts +2 -2
  175. package/dist/scaling/index.js +2 -2
  176. package/dist/scaling/node.d.ts +2 -1
  177. package/dist/scaling/node.d.ts.map +1 -1
  178. package/dist/scaling/node.js +27 -7
  179. package/dist/scaling/node.js.map +1 -1
  180. package/dist/shaders/index.d.ts +2 -3
  181. package/dist/shaders/index.js +2 -3
  182. package/dist/shaders/model.d.ts +3 -11
  183. package/dist/shaders/model.d.ts.map +1 -1
  184. package/dist/shaders/model.js +13 -36
  185. package/dist/shaders/model.js.map +1 -1
  186. package/dist/shaders/schema.d.ts +1 -1
  187. package/dist/shaders/schema.js +1 -1
  188. package/dist/shaders/schema.js.map +1 -1
  189. package/dist/shape-with-text/document.js +276 -0
  190. package/dist/shape-with-text/document.js.map +1 -0
  191. package/dist/shape-with-text/geometry.d.ts +13 -1
  192. package/dist/shape-with-text/geometry.d.ts.map +1 -1
  193. package/dist/shape-with-text/geometry.js +103 -41
  194. package/dist/shape-with-text/geometry.js.map +1 -1
  195. package/dist/shape-with-text/index.d.ts +2 -2
  196. package/dist/shape-with-text/index.js +2 -2
  197. package/dist/shared-style-index.d.ts +21 -0
  198. package/dist/shared-style-index.d.ts.map +1 -0
  199. package/dist/shared-style-index.js +72 -0
  200. package/dist/shared-style-index.js.map +1 -0
  201. package/dist/shared-styles.d.ts +3 -3
  202. package/dist/shared-styles.d.ts.map +1 -1
  203. package/dist/shared-styles.js +16 -7
  204. package/dist/shared-styles.js.map +1 -1
  205. package/dist/slides/drop.d.ts +32 -0
  206. package/dist/slides/drop.d.ts.map +1 -0
  207. package/dist/slides/drop.js +81 -0
  208. package/dist/slides/drop.js.map +1 -0
  209. package/dist/slides/index.d.ts +56 -0
  210. package/dist/slides/index.d.ts.map +1 -0
  211. package/dist/slides/index.js +134 -0
  212. package/dist/slides/index.js.map +1 -0
  213. package/dist/slides/motion.d.ts +55 -0
  214. package/dist/slides/motion.d.ts.map +1 -0
  215. package/dist/slides/motion.js +142 -0
  216. package/dist/slides/motion.js.map +1 -0
  217. package/dist/slides/playback.d.ts +59 -0
  218. package/dist/slides/playback.d.ts.map +1 -0
  219. package/dist/slides/playback.js +188 -0
  220. package/dist/slides/playback.js.map +1 -0
  221. package/dist/slides/types.d.ts +62 -0
  222. package/dist/slides/types.d.ts.map +1 -0
  223. package/dist/slides/types.js +39 -0
  224. package/dist/slides/types.js.map +1 -0
  225. package/dist/statuses/workflow.js +1 -1
  226. package/dist/text/direction.d.ts +6 -3
  227. package/dist/text/direction.d.ts.map +1 -1
  228. package/dist/text/direction.js +12 -12
  229. package/dist/text/direction.js.map +1 -1
  230. package/dist/text/index.d.ts +2 -1
  231. package/dist/text/index.js +3 -2
  232. package/dist/text/name.d.ts +22 -0
  233. package/dist/text/name.d.ts.map +1 -0
  234. package/dist/text/name.js +38 -0
  235. package/dist/text/name.js.map +1 -0
  236. package/dist/text/references.d.ts.map +1 -1
  237. package/dist/text/references.js +1 -2
  238. package/dist/text/references.js.map +1 -1
  239. package/dist/thumbnail.d.ts +23 -0
  240. package/dist/thumbnail.d.ts.map +1 -0
  241. package/dist/thumbnail.js +47 -0
  242. package/dist/thumbnail.js.map +1 -0
  243. package/dist/transfer/apply.d.ts.map +1 -1
  244. package/dist/transfer/apply.js +14 -3
  245. package/dist/transfer/apply.js.map +1 -1
  246. package/dist/transfer/copied.d.ts +6 -1
  247. package/dist/transfer/copied.d.ts.map +1 -1
  248. package/dist/transfer/copied.js +2 -2
  249. package/dist/transfer/copied.js.map +1 -1
  250. package/dist/transfer/dependencies.d.ts +4 -1
  251. package/dist/transfer/dependencies.d.ts.map +1 -1
  252. package/dist/transfer/dependencies.js +10 -1
  253. package/dist/transfer/dependencies.js.map +1 -1
  254. package/dist/transfer/history.js +2 -0
  255. package/dist/transfer/history.js.map +1 -1
  256. package/dist/transfer/identity.js +18 -3
  257. package/dist/transfer/identity.js.map +1 -1
  258. package/dist/transfer/index.d.ts +2 -1
  259. package/dist/transfer/index.js +4 -3
  260. package/dist/transfer/library.d.ts +45 -0
  261. package/dist/transfer/library.d.ts.map +1 -0
  262. package/dist/transfer/library.js +102 -0
  263. package/dist/transfer/library.js.map +1 -0
  264. package/dist/transfer/nodes.d.ts.map +1 -1
  265. package/dist/transfer/nodes.js +9 -0
  266. package/dist/transfer/nodes.js.map +1 -1
  267. package/dist/transfer/plan.d.ts +9 -0
  268. package/dist/transfer/plan.d.ts.map +1 -1
  269. package/dist/transfer/plan.js +51 -6
  270. package/dist/transfer/plan.js.map +1 -1
  271. package/dist/transfer/remove.js +7 -1
  272. package/dist/transfer/remove.js.map +1 -1
  273. package/dist/transfer/validation.js +8 -4
  274. package/dist/transfer/validation.js.map +1 -1
  275. package/dist/transfer/variables.d.ts.map +1 -1
  276. package/dist/transfer/variables.js +2 -1
  277. package/dist/transfer/variables.js.map +1 -1
  278. package/dist/types.d.ts +91 -13
  279. package/dist/types.d.ts.map +1 -1
  280. package/dist/types.js +33 -1
  281. package/dist/types.js.map +1 -1
  282. package/dist/variables/bindings.d.ts +11 -6
  283. package/dist/variables/bindings.d.ts.map +1 -1
  284. package/dist/variables/bindings.js +162 -38
  285. package/dist/variables/bindings.js.map +1 -1
  286. package/dist/variables/easing.d.ts +48 -0
  287. package/dist/variables/easing.d.ts.map +1 -0
  288. package/dist/variables/easing.js +321 -0
  289. package/dist/variables/easing.js.map +1 -0
  290. package/dist/variables/formula/index.d.ts +4 -2
  291. package/dist/variables/formula/index.d.ts.map +1 -1
  292. package/dist/variables/formula/index.js +26 -9
  293. package/dist/variables/formula/index.js.map +1 -1
  294. package/dist/variables/formula/parse.js +1 -1
  295. package/dist/variables/formula/schema.js +1 -1
  296. package/dist/variables/formula/signatures.d.ts +2 -2
  297. package/dist/variables/formula/signatures.d.ts.map +1 -1
  298. package/dist/variables/formula/signatures.js.map +1 -1
  299. package/dist/variables/formula/tree.d.ts +2 -2
  300. package/dist/variables/formula/tree.d.ts.map +1 -1
  301. package/dist/variables/formula/tree.js.map +1 -1
  302. package/dist/variables/index.d.ts +22 -5
  303. package/dist/variables/index.d.ts.map +1 -1
  304. package/dist/variables/index.js +67 -17
  305. package/dist/variables/index.js.map +1 -1
  306. package/dist/variables/lookup.js +1 -1
  307. package/dist/variables/lookup.js.map +1 -1
  308. package/dist/variables/motion.d.ts +46 -0
  309. package/dist/variables/motion.d.ts.map +1 -0
  310. package/dist/variables/motion.js +107 -0
  311. package/dist/variables/motion.js.map +1 -0
  312. package/dist/variables/paints.d.ts +10 -2
  313. package/dist/variables/paints.d.ts.map +1 -1
  314. package/dist/variables/paints.js +24 -10
  315. package/dist/variables/paints.js.map +1 -1
  316. package/dist/variables/resolution.d.ts.map +1 -1
  317. package/dist/variables/resolution.js +10 -9
  318. package/dist/variables/resolution.js.map +1 -1
  319. package/dist/variables/schema.d.ts +59 -1
  320. package/dist/variables/schema.d.ts.map +1 -1
  321. package/dist/variables/schema.js +36 -1
  322. package/dist/variables/schema.js.map +1 -1
  323. package/dist/variables/style-bindings.d.ts +23 -0
  324. package/dist/variables/style-bindings.d.ts.map +1 -0
  325. package/dist/variables/style-bindings.js +83 -0
  326. package/dist/variables/style-bindings.js.map +1 -0
  327. package/package.json +21 -2
  328. package/src/behaviours/index.ts +1 -0
  329. package/src/behaviours/kinds.ts +5 -1
  330. package/src/behaviours/model.ts +2 -2
  331. package/src/behaviours/schema.ts +19 -2
  332. package/src/behaviours/spec.ts +5 -0
  333. package/src/behaviours/transition.ts +46 -0
  334. package/src/checkpoint.ts +2 -0
  335. package/src/color/index.ts +15 -24
  336. package/src/color/management.ts +144 -168
  337. package/src/color/okhcl.ts +62 -43
  338. package/src/color/schema.ts +13 -0
  339. package/src/constraints.ts +2 -1
  340. package/src/copy.ts +29 -0
  341. package/src/corners.ts +3 -0
  342. package/src/css/index.ts +2 -0
  343. package/src/css/motion.ts +51 -0
  344. package/src/css/shadows.ts +8 -23
  345. package/src/css/values.ts +34 -4
  346. package/src/fields/layout.ts +9 -0
  347. package/src/font-style.ts +8 -3
  348. package/src/generated/index.ts +15 -3
  349. package/src/geometry.ts +13 -1
  350. package/src/graph.ts +72 -9
  351. package/src/group-bounds.ts +54 -13
  352. package/src/hit-test.ts +13 -8
  353. package/src/instances/fields.ts +2 -0
  354. package/src/instances/index.ts +71 -12
  355. package/src/instances/sync.ts +93 -11
  356. package/src/layout/flow.ts +34 -0
  357. package/src/layout/index.ts +1 -0
  358. package/src/layout/keywords.ts +7 -1
  359. package/src/layout/sizing.ts +30 -0
  360. package/src/layout/spacing.ts +12 -0
  361. package/src/mesh/geometry.ts +433 -0
  362. package/src/mesh/index.ts +3 -0
  363. package/src/mesh/model.ts +50 -0
  364. package/src/mesh/schema.ts +81 -0
  365. package/src/mutation-impact.ts +23 -7
  366. package/src/node-defaults.ts +22 -5
  367. package/src/paints/index.ts +2 -0
  368. package/src/paints/pattern.ts +55 -0
  369. package/src/paints/shows.ts +9 -0
  370. package/src/paints/solid.ts +10 -0
  371. package/src/paints/stills.ts +182 -0
  372. package/src/plugin-data/field.ts +3 -0
  373. package/src/plugin-data/fields.ts +15 -2
  374. package/src/resize.ts +32 -20
  375. package/src/scaling/index.ts +1 -1
  376. package/src/scaling/node.ts +43 -6
  377. package/src/shaders/index.ts +0 -1
  378. package/src/shaders/model.ts +19 -49
  379. package/src/shaders/schema.ts +1 -1
  380. package/src/shape-with-text/document.ts +175 -0
  381. package/src/shape-with-text/geometry.ts +99 -27
  382. package/src/shared-style-index.ts +106 -0
  383. package/src/shared-styles.ts +21 -14
  384. package/src/slides/drop.ts +94 -0
  385. package/src/slides/index.ts +125 -0
  386. package/src/slides/motion.ts +169 -0
  387. package/src/slides/playback.ts +200 -0
  388. package/src/slides/types.ts +94 -0
  389. package/src/text/direction.ts +13 -23
  390. package/src/text/index.ts +1 -0
  391. package/src/text/name.ts +39 -0
  392. package/src/text/references.ts +3 -3
  393. package/src/thumbnail.ts +52 -0
  394. package/src/transfer/apply.ts +16 -3
  395. package/src/transfer/copied.ts +7 -2
  396. package/src/transfer/dependencies.ts +10 -1
  397. package/src/transfer/history.ts +2 -0
  398. package/src/transfer/identity.ts +34 -2
  399. package/src/transfer/index.ts +6 -0
  400. package/src/transfer/library.ts +153 -0
  401. package/src/transfer/nodes.ts +20 -0
  402. package/src/transfer/plan.ts +96 -10
  403. package/src/transfer/remove.ts +6 -2
  404. package/src/transfer/validation.ts +15 -7
  405. package/src/transfer/variables.ts +8 -2
  406. package/src/types.ts +115 -11
  407. package/src/variables/bindings.ts +260 -36
  408. package/src/variables/easing.ts +282 -0
  409. package/src/variables/formula/index.ts +33 -14
  410. package/src/variables/formula/signatures.ts +6 -2
  411. package/src/variables/formula/tree.ts +3 -3
  412. package/src/variables/index.ts +90 -37
  413. package/src/variables/lookup.ts +1 -1
  414. package/src/variables/motion.ts +151 -0
  415. package/src/variables/paints.ts +29 -7
  416. package/src/variables/resolution.ts +11 -5
  417. package/src/variables/schema.ts +41 -0
  418. package/src/variables/style-bindings.ts +137 -0
  419. package/dist/shaders/still.d.ts +0 -18
  420. package/dist/shaders/still.d.ts.map +0 -1
  421. package/dist/shaders/still.js +0 -36
  422. package/dist/shaders/still.js.map +0 -1
  423. package/src/shaders/still.ts +0 -41
@@ -1,4 +1,5 @@
1
1
  import { semanticTransferReferences } from "./nodes.js";
2
+ import { leaveHeldCollections } from "./apply.js";
2
3
  //#region src/transfer/remove.ts
3
4
  /** Refuse to remove transferred content that has acquired external dependents. */
4
5
  function removeGraphTransfer(graph, plan) {
@@ -18,9 +19,14 @@ function removeGraphTransfer(graph, plan) {
18
19
  }
19
20
  if (semanticTransferReferences(node).some(referencesOwned)) throw new Error(`Transferred content is referenced by ${node.id}`);
20
21
  }
21
- for (const variable of graph.variables.values()) if (!variables.has(variable.id) && referencesOwned(variable.valuesByMode)) throw new Error("Transferred variable has external aliases");
22
+ for (const variable of graph.variables.values()) {
23
+ if (variables.has(variable.id)) continue;
24
+ if (referencesOwned(variable.valuesByMode)) throw new Error("Transferred variable has external aliases");
25
+ if (collections.has(variable.collectionId)) throw new Error("Transferred collection holds non-owned variables");
26
+ }
22
27
  graph.withBufferedEvents(() => {
23
28
  for (const node of plan.nodes.toReversed()) graph.deleteNode(node.id);
29
+ leaveHeldCollections(graph, plan);
24
30
  for (const id of variables) {
25
31
  graph.willChangeVariable(id);
26
32
  graph.variables.delete(id);
@@ -1 +1 @@
1
- {"version":3,"file":"remove.js","names":[],"sources":["../../src/transfer/remove.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { GraphTransferPlan } from './apply'\nimport { semanticTransferReferences } from './nodes'\n\n/** Refuse to remove transferred content that has acquired external dependents. */\nexport function removeGraphTransfer(graph: SceneGraph, plan: GraphTransferPlan): void {\n const nodes = new Set(plan.nodes.map((node) => node.id))\n const variables = new Set(plan.variables.map((variable) => variable.id))\n const collections = new Set(plan.collections.map((collection) => collection.id))\n const referencesOwned = (value: unknown): boolean => {\n if (typeof value === 'string')\n return nodes.has(value) || variables.has(value) || collections.has(value)\n if (!value || typeof value !== 'object' || ArrayBuffer.isView(value)) return false\n if (value instanceof Map)\n return [...value].some(([key, item]) => referencesOwned(key) || referencesOwned(item))\n return Object.values(value).some(referencesOwned)\n }\n for (const node of graph.getAllNodes()) {\n if (nodes.has(node.id)) {\n if (node.childIds.some((id) => !nodes.has(id)))\n throw new Error('Transferred node has non-owned children')\n continue\n }\n if (semanticTransferReferences(node).some(referencesOwned))\n throw new Error(`Transferred content is referenced by ${node.id}`)\n }\n for (const variable of graph.variables.values()) {\n if (!variables.has(variable.id) && referencesOwned(variable.valuesByMode))\n throw new Error('Transferred variable has external aliases')\n }\n graph.withBufferedEvents(() => {\n for (const node of plan.nodes.toReversed()) graph.deleteNode(node.id)\n for (const id of variables) {\n graph.willChangeVariable(id)\n graph.variables.delete(id)\n }\n for (const id of collections) {\n graph.willChangeCollection(id)\n graph.variableCollections.delete(id)\n }\n })\n}\n"],"mappings":";;;AAKA,SAAgB,oBAAoB,OAAmB,MAA+B;CACpF,MAAM,QAAQ,IAAI,IAAI,KAAK,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a;GAC5B,MAAM,qBAAqB,EAAE;GAC7B,MAAM,oBAAoB,OAAO,EAAE;EACrC;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"remove.js","names":[],"sources":["../../src/transfer/remove.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { leaveHeldCollections, type GraphTransferPlan } from './apply'\nimport { semanticTransferReferences } from './nodes'\n\n/** Refuse to remove transferred content that has acquired external dependents. */\nexport function removeGraphTransfer(graph: SceneGraph, plan: GraphTransferPlan): void {\n const nodes = new Set(plan.nodes.map((node) => node.id))\n const variables = new Set(plan.variables.map((variable) => variable.id))\n const collections = new Set(plan.collections.map((collection) => collection.id))\n const referencesOwned = (value: unknown): boolean => {\n if (typeof value === 'string')\n return nodes.has(value) || variables.has(value) || collections.has(value)\n if (!value || typeof value !== 'object' || ArrayBuffer.isView(value)) return false\n if (value instanceof Map)\n return [...value].some(([key, item]) => referencesOwned(key) || referencesOwned(item))\n return Object.values(value).some(referencesOwned)\n }\n for (const node of graph.getAllNodes()) {\n if (nodes.has(node.id)) {\n if (node.childIds.some((id) => !nodes.has(id)))\n throw new Error('Transferred node has non-owned children')\n continue\n }\n if (semanticTransferReferences(node).some(referencesOwned))\n throw new Error(`Transferred content is referenced by ${node.id}`)\n }\n for (const variable of graph.variables.values()) {\n if (variables.has(variable.id)) continue\n if (referencesOwned(variable.valuesByMode))\n throw new Error('Transferred variable has external aliases')\n if (collections.has(variable.collectionId))\n throw new Error('Transferred collection holds non-owned variables')\n }\n graph.withBufferedEvents(() => {\n for (const node of plan.nodes.toReversed()) graph.deleteNode(node.id)\n leaveHeldCollections(graph, plan)\n for (const id of variables) {\n graph.willChangeVariable(id)\n graph.variables.delete(id)\n }\n for (const id of collections) {\n graph.willChangeCollection(id)\n graph.variableCollections.delete(id)\n }\n })\n}\n"],"mappings":";;;;AAKA,SAAgB,oBAAoB,OAAmB,MAA+B;CACpF,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,SAAS,KAAK,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B,MAAM,mBAAmB,EAAE;GAC3B,MAAM,UAAU,OAAO,EAAE;EAC3B;EACA,KAAK,MAAM,MAAM,aAAa;GAC5B,MAAM,qBAAqB,EAAE;GAC7B,MAAM,oBAAoB,OAAO,EAAE;EACrC;CACF,CAAC;AACH"}
@@ -1,6 +1,7 @@
1
1
  import { createDefaultNode } from "../node-defaults.js";
2
+ import { sharedStyleLayers } from "../shared-styles.js";
3
+ import { heldTransferCollections, variableIdentityReferences } from "./identity.js";
2
4
  import { prepareNodeTransfer } from "./nodes.js";
3
- import { variableIdentityReferences } from "./identity.js";
4
5
  //#region src/transfer/validation.ts
5
6
  /** Revalidate mutable plan references without allocating or registering destination nodes. */
6
7
  function validateTransferReferences(target, plan) {
@@ -14,13 +15,16 @@ function validateTransferReferences(target, plan) {
14
15
  properties.set(definition.id, definition.id);
15
16
  propertyTypes.set(definition.id, definition.type);
16
17
  }
17
- const collections = new Map(plan.collections.map((collection) => [collection.id, collection]));
18
+ const planCollections = [...plan.collections, ...heldTransferCollections(target, plan)];
19
+ const collections = new Map(planCollections.map((collection) => [collection.id, collection]));
20
+ const heldStyles = sharedStyleLayers(target);
21
+ for (const id of plan.reused.styles) if (!heldStyles.has(id)) throw new Error(`Missing reused transfer style ${id}`);
18
22
  const references = {
19
23
  nodes: identities,
20
- styles: new Map([...nodes.values()].flatMap((node) => node.sharedStyleType !== null && node.source.id ? [[node.source.id, node.source.id]] : [])),
24
+ styles: new Map([...plan.reused.styles.map((id) => [id, id]), ...[...nodes.values()].flatMap((node) => node.sharedStyleType !== null && node.source.id ? [[node.source.id, node.source.id]] : [])]),
21
25
  properties,
22
26
  propertyTypes,
23
- ...variableIdentityReferences(plan.variables, plan.collections)
27
+ ...variableIdentityReferences(plan.variables, planCollections, plan.reused.variables)
24
28
  };
25
29
  for (const node of nodes.values()) {
26
30
  prepareNodeTransfer(node, references);
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","names":[],"sources":["../../src/transfer/validation.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { createDefaultNode } from '../node-defaults'\nimport type { ComponentPropertyType } from '../types'\nimport type { GraphTransferPlan } from './apply'\nimport { variableIdentityReferences } from './identity'\nimport { prepareNodeTransfer } from './nodes'\n\n/** Revalidate mutable plan references without allocating or registering destination nodes. */\nexport function validateTransferReferences(target: SceneGraph, plan: GraphTransferPlan): void {\n const nodes = new Map(\n plan.nodes.map((entry) => [\n entry.id,\n createDefaultNode(() => entry.id, entry.type, entry.props)\n ])\n )\n const identities = new Map([...nodes.keys()].map((id) => [id, id]))\n const properties = new Map<string, string>()\n const propertyTypes = new Map<string, ComponentPropertyType>()\n for (const node of nodes.values())\n for (const definition of node.componentPropertyDefinitions) {\n const previous = propertyTypes.get(definition.id)\n if (previous && previous !== definition.type)\n throw new Error(`Conflicting transfer property ${definition.id}`)\n properties.set(definition.id, definition.id)\n propertyTypes.set(definition.id, definition.type)\n }\n const collections = new Map(plan.collections.map((collection) => [collection.id, collection]))\n const styles = new Map(\n [...nodes.values()].flatMap((node) =>\n node.sharedStyleType !== null && node.source.id ? [[node.source.id, node.source.id]] : []\n )\n )\n const references = {\n nodes: identities,\n styles,\n properties,\n propertyTypes,\n ...variableIdentityReferences(plan.variables, plan.collections)\n }\n for (const node of nodes.values()) {\n prepareNodeTransfer(node, references)\n for (const [collection, mode] of Object.entries(node.variableModes)) {\n if (!collections.get(collection)?.modes.some((entry) => entry.modeId === mode))\n throw new Error(`Invalid node variable mode ${node.id}`)\n }\n }\n const roots = new Set([...plan.rootIds, ...plan.dependencyPageIds])\n if (roots.size !== plan.rootIds.length + plan.dependencyPageIds.length)\n throw new Error('Repeated transfer root')\n for (const entry of plan.nodes) {\n if (roots.has(entry.id) === nodes.has(entry.parentId))\n throw new Error(`Invalid transfer root topology ${entry.id}`)\n if (\n plan.dependencyPageIds.includes(entry.id) &&\n (entry.type !== 'CANVAS' || !entry.props.internalOnly || entry.parentId !== target.rootId)\n )\n throw new Error(`Invalid transfer dependency page ${entry.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AAM,UAAU,MAAM,WAAW,IAAI,GAC3E,MAAM,IAAI,MAAM,8BAA8B,KAAK,IAAI;CAE7D;CACA,MAAM,wBAAQ,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,GAAG,KAAK,iBAAiB,CAAC;CAClE,IAAI,MAAM,SAAS,KAAK,QAAQ,SAAS,KAAK,kBAAkB,QAC9D,MAAM,IAAI,MAAM,wBAAwB;CAC1C,KAAK,MAAM,SAAS,KAAK,OAAO;EAC9B,IAAI,MAAM,IAAI,MAAM,EAAE,MAAM,MAAM,IAAI,MAAM,QAAQ,GAClD,MAAM,IAAI,MAAM,kCAAkC,MAAM,IAAI;EAC9D,IACE,KAAK,kBAAkB,SAAS,MAAM,EAAE,MACvC,MAAM,SAAS,YAAY,CAAC,MAAM,MAAM,gBAAgB,MAAM,aAAa,OAAO,SAEnF,MAAM,IAAI,MAAM,oCAAoC,MAAM,IAAI;CAClE;AACF"}
1
+ {"version":3,"file":"validation.js","names":[],"sources":["../../src/transfer/validation.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport { createDefaultNode } from '../node-defaults'\nimport { sharedStyleLayers } from '../shared-styles'\nimport type { ComponentPropertyType } from '../types'\nimport type { GraphTransferPlan } from './apply'\nimport { heldTransferCollections, variableIdentityReferences } from './identity'\nimport { prepareNodeTransfer } from './nodes'\n\n/** Revalidate mutable plan references without allocating or registering destination nodes. */\nexport function validateTransferReferences(target: SceneGraph, plan: GraphTransferPlan): void {\n const nodes = new Map(\n plan.nodes.map((entry) => [\n entry.id,\n createDefaultNode(() => entry.id, entry.type, entry.props)\n ])\n )\n const identities = new Map([...nodes.keys()].map((id) => [id, id]))\n const properties = new Map<string, string>()\n const propertyTypes = new Map<string, ComponentPropertyType>()\n for (const node of nodes.values())\n for (const definition of node.componentPropertyDefinitions) {\n const previous = propertyTypes.get(definition.id)\n if (previous && previous !== definition.type)\n throw new Error(`Conflicting transfer property ${definition.id}`)\n properties.set(definition.id, definition.id)\n propertyTypes.set(definition.id, definition.type)\n }\n const planCollections = [...plan.collections, ...heldTransferCollections(target, plan)]\n const collections = new Map(planCollections.map((collection) => [collection.id, collection]))\n const heldStyles = sharedStyleLayers(target)\n for (const id of plan.reused.styles)\n if (!heldStyles.has(id)) throw new Error(`Missing reused transfer style ${id}`)\n const styles = new Map([\n ...plan.reused.styles.map((id) => [id, id] as const),\n ...[...nodes.values()].flatMap((node) =>\n node.sharedStyleType !== null && node.source.id\n ? [[node.source.id, node.source.id] as const]\n : []\n )\n ])\n const references = {\n nodes: identities,\n styles,\n properties,\n propertyTypes,\n ...variableIdentityReferences(plan.variables, planCollections, plan.reused.variables)\n }\n for (const node of nodes.values()) {\n prepareNodeTransfer(node, references)\n for (const [collection, mode] of Object.entries(node.variableModes)) {\n if (!collections.get(collection)?.modes.some((entry) => entry.modeId === mode))\n throw new Error(`Invalid node variable mode ${node.id}`)\n }\n }\n const roots = new Set([...plan.rootIds, ...plan.dependencyPageIds])\n if (roots.size !== plan.rootIds.length + plan.dependencyPageIds.length)\n throw new Error('Repeated transfer root')\n for (const entry of plan.nodes) {\n if (roots.has(entry.id) === nodes.has(entry.parentId))\n throw new Error(`Invalid transfer root topology ${entry.id}`)\n if (\n plan.dependencyPageIds.includes(entry.id) &&\n (entry.type !== 'CANVAS' || !entry.props.internalOnly || entry.parentId !== target.rootId)\n )\n throw new Error(`Invalid transfer dependency page ${entry.id}`)\n }\n}\n"],"mappings":";;;;;;AASA,SAAgB,2BAA2B,QAAoB,MAA+B;CAC5F,MAAM,QAAQ,IAAI,IAChB,KAAK,MAAM,KAAK,UAAU,CACxB,MAAM,IACN,wBAAwB,MAAM,IAAI,MAAM,MAAM,MAAM,KAAK,CAC3D,CAAC,CACH;CACA,MAAM,aAAa,IAAI,IAAI,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;CAClE,MAAM,6BAAa,IAAI,IAAoB;CAC3C,MAAM,gCAAgB,IAAI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A8B,KAAK,IAAI;CAE7D;CACA,MAAM,wBAAQ,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,GAAG,KAAK,iBAAiB,CAAC;CAClE,IAAI,MAAM,SAAS,KAAK,QAAQ,SAAS,KAAK,kBAAkB,QAC9D,MAAM,IAAI,MAAM,wBAAwB;CAC1C,KAAK,MAAM,SAAS,KAAK,OAAO;EAC9B,IAAI,MAAM,IAAI,MAAM,EAAE,MAAM,MAAM,IAAI,MAAM,QAAQ,GAClD,MAAM,IAAI,MAAM,kCAAkC,MAAM,IAAI;EAC9D,IACE,KAAK,kBAAkB,SAAS,MAAM,EAAE,MACvC,MAAM,SAAS,YAAY,CAAC,MAAM,MAAM,gBAAgB,MAAM,aAAa,OAAO,SAEnF,MAAM,IAAI,MAAM,oCAAoC,MAAM,IAAI;CAClE;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"variables.d.ts","names":[],"sources":["../../src/transfer/variables.ts"],"mappings":";;;UAOiB;EACf,WAAW;EACX,aAAa;EACb,OAAO;;;iBAqCO,wBACd,oBAAoB,YACpB,sBAAsB,sBACtB,YAAY;EACT,WAAW;EAAY,aAAa;;;;;;;iBAyCzB,mBACd,QAAQ,YACR,KAAK,qBACL,eAAe,kBACf,UAAU,kCAAkC"}
1
+ {"version":3,"file":"variables.d.ts","names":[],"sources":["../../src/transfer/variables.ts"],"mappings":";;;UAOiB;EACf,WAAW;EACX,aAAa;EACb,OAAO;;;iBA2CO,wBACd,oBAAoB,YACpB,sBAAsB,sBACtB,YAAY;EACT,WAAW;EAAY,aAAa;;;;;;;iBAyCzB,mBACd,QAAQ,YACR,KAAK,qBACL,eAAe,kBACf,UAAU,kCAAkC"}
@@ -16,7 +16,8 @@ function assertResourceOwnership(variables, collections) {
16
16
  }
17
17
  for (const variable of variables) {
18
18
  const collection = sets.get(variable.collectionId);
19
- if (!collection?.variableIds.includes(variable.id)) throw new Error(`Missing collection membership for ${variable.id}`);
19
+ if (!collection) throw new Error(`Missing collection membership for ${variable.id}`);
20
+ if (collection.variableIds.includes(variable.id) === !!variable.deleted) throw new Error(variable.deleted ? `Deleted variable ${variable.id} listed in ${collection.id}` : `Missing collection membership for ${variable.id}`);
20
21
  const modes = new Set(collection.modes.map((mode) => mode.modeId));
21
22
  for (const mode of Object.keys(variable.valuesByMode)) if (!modes.has(mode)) throw new Error(`Unknown mode ${mode} for ${variable.id}`);
22
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"variables.js","names":["mapped"],"sources":["../../src/transfer/variables.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\n\nimport type { SceneGraph } from '../graph'\nimport type { Variable, VariableCollection, VariableValue } from '../types'\nimport { mapVariableValueReferences } from '../variables/value'\nimport { requireTransferReference as mapped } from './references'\n\nexport interface VariableTransferReferences {\n variables: ReadonlyMap<string, string>\n collections: ReadonlyMap<string, string>\n modes: ReadonlyMap<string, string>\n}\n\nfunction assertUniqueMappings(ids: ReadonlyMap<string, string>, kind: string): void {\n if (new Set(ids.values()).size !== ids.size)\n throw new Error(`Colliding ${kind} transfer mappings`)\n}\n\nfunction assertResourceOwnership(\n variables: readonly Variable[],\n collections: readonly VariableCollection[]\n): void {\n const sets = new Map(collections.map((collection) => [collection.id, collection]))\n const tokens = new Map(variables.map((variable) => [variable.id, variable]))\n if (sets.size !== collections.length || tokens.size !== variables.length)\n throw new Error('Duplicate source variable resource')\n for (const collection of collections) {\n const modes = new Set(collection.modes.map((mode) => mode.modeId))\n if (!modes.has(collection.defaultModeId) || modes.size !== collection.modes.length)\n throw new Error(`Invalid modes for collection ${collection.id}`)\n for (const id of collection.variableIds) {\n if (tokens.get(id)?.collectionId !== collection.id)\n throw new Error(`Invalid variable membership ${id} in ${collection.id}`)\n }\n }\n for (const variable of variables) {\n const collection = sets.get(variable.collectionId)\n if (!collection?.variableIds.includes(variable.id))\n throw new Error(`Missing collection membership for ${variable.id}`)\n const modes = new Set(collection.modes.map((mode) => mode.modeId))\n for (const mode of Object.keys(variable.valuesByMode)) {\n if (!modes.has(mode)) throw new Error(`Unknown mode ${mode} for ${variable.id}`)\n }\n }\n}\n\n/** Prepare isolated resource copies; never mutate the source or destination graph. */\nexport function prepareVariableTransfer(\n variables: readonly Variable[],\n collections: readonly VariableCollection[],\n references: VariableTransferReferences\n): { variables: Variable[]; collections: VariableCollection[] } {\n assertResourceOwnership(variables, collections)\n assertUniqueMappings(references.variables, 'variable')\n assertUniqueMappings(references.collections, 'collection')\n assertUniqueMappings(references.modes, 'mode')\n const value = (input: VariableValue): VariableValue =>\n mapVariableValueReferences(\n input,\n (id) => mapped(references.variables, id, 'variable alias'),\n (id) => references.modes.get(id) ?? id\n )\n return {\n collections: collections.map((collection) => ({\n ...structuredClone(collection),\n id: mapped(references.collections, collection.id, 'collection'),\n defaultModeId: mapped(references.modes, collection.defaultModeId, 'mode'),\n modes: collection.modes.map((mode) => ({\n ...mode,\n modeId: mapped(references.modes, mode.modeId, 'mode')\n })),\n variableIds: collection.variableIds.map((id) => mapped(references.variables, id, 'variable'))\n })),\n variables: variables.map((variable) => ({\n ...structuredClone(variable),\n id: mapped(references.variables, variable.id, 'variable'),\n collectionId: mapped(references.collections, variable.collectionId, 'collection'),\n valuesByMode: Object.fromEntries(\n Object.entries(variable.valuesByMode).map(([mode, input]) => [\n mapped(references.modes, mode, 'mode'),\n value(input)\n ])\n )\n }))\n }\n}\n\n/**\n * Copies the variables `ids` and the collections `collectionIds` into `target`, IDs kept. Each\n * collection comes from the first of its `sources` that has it, and its variables with it; a\n * variable it lacks there comes from the next. A collection keeps only the variables copied.\n */\nexport function copyVariableTables(\n target: SceneGraph,\n ids: ReadonlySet<string>,\n collectionIds: Iterable<string>,\n sources: (collectionId: string) => readonly SceneGraph[]\n): void {\n for (const collectionId of collectionIds) {\n const graphs = sources(collectionId)\n const first = <T>(read: (graph: SceneGraph) => T | undefined): T | undefined =>\n graphs.map(read).find((found) => found !== undefined)\n const collection = first((graph) => graph.variableCollections.get(collectionId))\n if (!collection) continue\n const members = uniq(\n graphs.flatMap((graph) => graph.variableCollections.get(collectionId)?.variableIds ?? [])\n ).filter((id) => ids.has(id))\n target.variableCollections.set(collectionId, {\n ...structuredClone(collection),\n variableIds: members\n })\n for (const id of members) {\n const variable = first((graph) => graph.variables.get(id))\n if (variable) target.variables.set(id, structuredClone(variable))\n }\n }\n}\n"],"mappings":";;;;AAaA,SAAS,qBAAqB,KAAkC,MAAoB;CAClF,IAAI,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,MACrC,MAAM,IAAI,MAAM,aAAa,KAAK,mBAAmB;AACzD;AAEA,SAAS,wBACP,WACA,aACM;CACN,MAAM,OAAO,IAAI,IAAI,YAAY,KAAK,eAAe,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;CACjF,MAAM,SAAS,IAAI,IAAI,UAAU,KAAK,aAAa,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC;CAC3E,IAAI,KAAK,SAAS,YAAY,UAAU,OAAO,SAAS,UAAU,QAChE,MAAM,IAAI,MAAM,oCAAoC;CACtD,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,QAAQ,IAAI,IAAI,WAAW,MAAM,KAAK,SAAS,KAAK,MAAM,CAAC;EACjE,IAAI,CAAC,MAAM,IAAI,WAAW,aAAa,KAAK,MAAM,SAAS,WAAW,MAAM,QAC1E,MAAM,IAAI,MAAM,gCAAgC,WAAW,IAAI;EACjE,KAAK,MAAM,MAAM,WAAW,aAC1B,IAAI,OAAO,IAAI,EAAE,CAAC,EAAE,iBAAiB,WAAW,IAC9C,MAAM,IAAI,MAAM,+BAA+B,GAAG,MAAM,WAAW,IAAI;CAE7E;CACA,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,aAAa,KAAK,IAAI,SAAS,YAAY;EACjD,IAAI,CAAC,YAAY,YAAY,SAAS,SAAS,EAAE,GAC/C,MAAM,IAAI,MAAM,qCAAqC,SAAS,IAAI;EACpE,MAAM,QAAQ,IAAI,IAAI,WAAW,MAA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,KAAK,MAAM,gBAAgB,eAAe;EACxC,MAAM,SAAS,QAAQ,YAAY;EACnC,MAAM,SAAY,SAChB,OAAO,IAAI,IAAI,CAAC,CAAC,MAAM,UAAU,UAAU,KAAA,CAAS;EACtD,MAAM,aAAa,OAAO,UAAU,MAAM,oBAAoB,IAAI,YAAY,CAAC;EAC/E,IAAI,CAAC,YAAY;EACjB,MAAM,UAAU,KACd,OAAO,SAAS,UAAU,MAAM,oBAAoB,IAAI,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC,CAC1F,CAAC,CAAC,QAAQ,OAAO,IAAI,IAAI,EAAE,CAAC;EAC5B,OAAO,oBAAoB,IAAI,cAAc;GAC3C,GAAG,gBAAgB,UAAU;GAC7B,aAAa;EACf,CAAC;EACD,KAAK,MAAM,MAAM,SAAS;GACxB,MAAM,WAAW,OAAO,UAAU,MAAM,UAAU,IAAI,EAAE,CAAC;GACzD,IAAI,UAAU,OAAO,UAAU,IAAI,IAAI,gBAAgB,QAAQ,CAAC;EAClE;CACF;AACF"}
1
+ {"version":3,"file":"variables.js","names":["mapped"],"sources":["../../src/transfer/variables.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\n\nimport type { SceneGraph } from '../graph'\nimport type { Variable, VariableCollection, VariableValue } from '../types'\nimport { mapVariableValueReferences } from '../variables/value'\nimport { requireTransferReference as mapped } from './references'\n\nexport interface VariableTransferReferences {\n variables: ReadonlyMap<string, string>\n collections: ReadonlyMap<string, string>\n modes: ReadonlyMap<string, string>\n}\n\nfunction assertUniqueMappings(ids: ReadonlyMap<string, string>, kind: string): void {\n if (new Set(ids.values()).size !== ids.size)\n throw new Error(`Colliding ${kind} transfer mappings`)\n}\n\nfunction assertResourceOwnership(\n variables: readonly Variable[],\n collections: readonly VariableCollection[]\n): void {\n const sets = new Map(collections.map((collection) => [collection.id, collection]))\n const tokens = new Map(variables.map((variable) => [variable.id, variable]))\n if (sets.size !== collections.length || tokens.size !== variables.length)\n throw new Error('Duplicate source variable resource')\n for (const collection of collections) {\n const modes = new Set(collection.modes.map((mode) => mode.modeId))\n if (!modes.has(collection.defaultModeId) || modes.size !== collection.modes.length)\n throw new Error(`Invalid modes for collection ${collection.id}`)\n for (const id of collection.variableIds) {\n if (tokens.get(id)?.collectionId !== collection.id)\n throw new Error(`Invalid variable membership ${id} in ${collection.id}`)\n }\n }\n for (const variable of variables) {\n const collection = sets.get(variable.collectionId)\n if (!collection) throw new Error(`Missing collection membership for ${variable.id}`)\n // A collection lists only its live variables; a deleted one still transfers with its bindings.\n if (collection.variableIds.includes(variable.id) === !!variable.deleted)\n throw new Error(\n variable.deleted\n ? `Deleted variable ${variable.id} listed in ${collection.id}`\n : `Missing collection membership for ${variable.id}`\n )\n const modes = new Set(collection.modes.map((mode) => mode.modeId))\n for (const mode of Object.keys(variable.valuesByMode)) {\n if (!modes.has(mode)) throw new Error(`Unknown mode ${mode} for ${variable.id}`)\n }\n }\n}\n\n/** Prepare isolated resource copies; never mutate the source or destination graph. */\nexport function prepareVariableTransfer(\n variables: readonly Variable[],\n collections: readonly VariableCollection[],\n references: VariableTransferReferences\n): { variables: Variable[]; collections: VariableCollection[] } {\n assertResourceOwnership(variables, collections)\n assertUniqueMappings(references.variables, 'variable')\n assertUniqueMappings(references.collections, 'collection')\n assertUniqueMappings(references.modes, 'mode')\n const value = (input: VariableValue): VariableValue =>\n mapVariableValueReferences(\n input,\n (id) => mapped(references.variables, id, 'variable alias'),\n (id) => references.modes.get(id) ?? id\n )\n return {\n collections: collections.map((collection) => ({\n ...structuredClone(collection),\n id: mapped(references.collections, collection.id, 'collection'),\n defaultModeId: mapped(references.modes, collection.defaultModeId, 'mode'),\n modes: collection.modes.map((mode) => ({\n ...mode,\n modeId: mapped(references.modes, mode.modeId, 'mode')\n })),\n variableIds: collection.variableIds.map((id) => mapped(references.variables, id, 'variable'))\n })),\n variables: variables.map((variable) => ({\n ...structuredClone(variable),\n id: mapped(references.variables, variable.id, 'variable'),\n collectionId: mapped(references.collections, variable.collectionId, 'collection'),\n valuesByMode: Object.fromEntries(\n Object.entries(variable.valuesByMode).map(([mode, input]) => [\n mapped(references.modes, mode, 'mode'),\n value(input)\n ])\n )\n }))\n }\n}\n\n/**\n * Copies the variables `ids` and the collections `collectionIds` into `target`, IDs kept. Each\n * collection comes from the first of its `sources` that has it, and its variables with it; a\n * variable it lacks there comes from the next. A collection keeps only the variables copied.\n */\nexport function copyVariableTables(\n target: SceneGraph,\n ids: ReadonlySet<string>,\n collectionIds: Iterable<string>,\n sources: (collectionId: string) => readonly SceneGraph[]\n): void {\n for (const collectionId of collectionIds) {\n const graphs = sources(collectionId)\n const first = <T>(read: (graph: SceneGraph) => T | undefined): T | undefined =>\n graphs.map(read).find((found) => found !== undefined)\n const collection = first((graph) => graph.variableCollections.get(collectionId))\n if (!collection) continue\n const members = uniq(\n graphs.flatMap((graph) => graph.variableCollections.get(collectionId)?.variableIds ?? [])\n ).filter((id) => ids.has(id))\n target.variableCollections.set(collectionId, {\n ...structuredClone(collection),\n variableIds: members\n })\n for (const id of members) {\n const variable = first((graph) => graph.variables.get(id))\n if (variable) target.variables.set(id, structuredClone(variable))\n }\n }\n}\n"],"mappings":";;;;AAaA,SAAS,qBAAqB,KAAkC,MAAoB;CAClF,IAAI,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,MACrC,MAAM,IAAI,MAAM,aAAa,KAAK,mBAAmB;AACzD;AAEA,SAAS,wBACP,WACA,aACM;CACN,MAAM,OAAO,IAAI,IAAI,YAAY,KAAK,eAAe,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;CACjF,MAAM,SAAS,IAAI,IAAI,UAAU,KAAK,aAAa,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC;CAC3E,IAAI,KAAK,SAAS,YAAY,UAAU,OAAO,SAAS,UAAU,QAChE,MAAM,IAAI,MAAM,oCAAoC;CACtD,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,QAAQ,IAAI,IAAI,WAAW,MAA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,IAAI,gBAAgB,QAAQ,CAAC;EAClE;CACF;AACF"}
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@ import { ExportFormatId } from "./export-format.js";
3
3
  import { CanvasGuide } from "./guides.js";
4
4
  import { InstanceOverrideState } from "./instances/overrides.js";
5
5
  import { ShapeWithTextType } from "./shape-with-text/kinds.js";
6
+ import { LayerAnimation, SlideSettings } from "./slides/types.js";
6
7
  //#region src/types.d.ts
7
8
  interface SceneGraphEvents {
8
9
  'node:created': (node: SceneNode) => void;
@@ -42,9 +43,13 @@ interface NodeChangeObserver {
42
43
  pause?: () => void;
43
44
  resume?: () => void;
44
45
  }
45
- type DocumentColorSpace = 'srgb' | 'display-p3';
46
- /** What a document is for, as Figma keeps design files and FigJam boards apart. */
47
- type DocumentKind = 'design' | 'board';
46
+ /**
47
+ * A color profile: the one a document's colors are stored in, or the one they are shown or
48
+ * exported in. Figma files are sRGB or Display P3.
49
+ */
50
+ type ColorProfile = 'srgb' | 'display-p3';
51
+ /** What a document is for, as Figma keeps design files, FigJam boards and Slides decks apart. */
52
+ type DocumentKind = 'design' | 'board' | 'slides';
48
53
  interface FigmaSourcePayload {
49
54
  rawSize: Vector | null;
50
55
  rawTransform: Matrix | null;
@@ -52,6 +57,11 @@ interface FigmaSourcePayload {
52
57
  layout: FigmaLayoutMetadata | null;
53
58
  symbolOverrides: unknown[];
54
59
  componentPropAssignments: unknown[];
60
+ /**
61
+ * An instance's saved assignments of slot content that no layer shows, as when its variant
62
+ * has no frame for the slot. Figma keeps them, and the content, for a variant that does.
63
+ */
64
+ hiddenSlotAssignments: unknown[];
55
65
  derivedSymbolData: unknown[];
56
66
  derivedSymbolDataLayoutVersion: number | null;
57
67
  uniformScaleFactor: number | null;
@@ -96,7 +106,12 @@ interface GeometryPath {
96
106
  windingRule: WindingRule;
97
107
  commandsBlob: Uint8Array;
98
108
  }
99
- type NodeType = 'CANVAS' | 'FRAME' | 'RECTANGLE' | 'ROUNDED_RECTANGLE' | 'ELLIPSE' | 'TEXT' | 'LINE' | 'STAR' | 'POLYGON' | 'VECTOR' | 'BOOLEAN_OPERATION' | 'GROUP' | 'SECTION' | 'COMPONENT' | 'COMPONENT_SET' | 'INSTANCE' | 'CONNECTOR' | 'SHAPE_WITH_TEXT' | 'STICKY';
109
+ type NodeType = 'CANVAS' | 'FRAME' | 'RECTANGLE' | 'ROUNDED_RECTANGLE' | 'ELLIPSE' | 'TEXT' | 'LINE' | 'STAR' | 'POLYGON' | 'VECTOR' | 'BOOLEAN_OPERATION' | 'GROUP' | 'SECTION' | 'COMPONENT' | 'COMPONENT_SET' | 'INSTANCE' | 'CONNECTOR' | 'SHAPE_WITH_TEXT' | 'STICKY' | 'SLIDE' | 'SLIDE_ROW' | 'SLIDE_GRID' |
110
+ /**
111
+ * A Figma shader's definition on the internal page, which a shader paint names: its library key,
112
+ * version and property definitions. OpenPencil keeps it for Figma and never draws it.
113
+ */
114
+ 'CODE_COMPONENT';
100
115
  type FillType = 'SOLID' | 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND' | 'IMAGE' | 'VIDEO' | 'PATTERN' | 'NOISE' | 'CUSTOM';
101
116
  type BlendMode = 'NORMAL' | 'DARKEN' | 'MULTIPLY' | 'LINEAR_BURN' | 'COLOR_BURN' | 'LIGHTEN' | 'SCREEN' | 'LINEAR_DODGE' | 'COLOR_DODGE' | 'OVERLAY' | 'SOFT_LIGHT' | 'HARD_LIGHT' | 'DIFFERENCE' | 'EXCLUSION' | 'HUE' | 'SATURATION' | 'COLOR' | 'LUMINOSITY' | 'PASS_THROUGH';
102
117
  type ImageScaleMode = 'FILL' | 'FIT' | 'CROP' | 'TILE';
@@ -108,6 +123,10 @@ interface GradientStop {
108
123
  position: number;
109
124
  }
110
125
  type GradientTransform = Matrix;
126
+ interface LibraryAssetRef {
127
+ key: string;
128
+ version?: string;
129
+ }
111
130
  /** Figma's adjustments of an image paint, each from -1 to 1; 0 leaves the image as it is. */
112
131
  interface ImageFilters {
113
132
  exposure?: number;
@@ -135,7 +154,7 @@ interface Fill {
135
154
  imageTransform?: GradientTransform;
136
155
  /** Clockwise turn of a Fill, Fit or Tile image, in multiples of 90°; a crop holds its own. */
137
156
  imageRotation?: number;
138
- /** An image's adjustments, kept and saved; the canvas does not draw them. */
157
+ /** An image's adjustments, in Figma's plugin API units. */
139
158
  filters?: ImageFilters;
140
159
  sourceNodeId?: string;
141
160
  scale?: number;
@@ -148,6 +167,8 @@ interface Fill {
148
167
  density?: number;
149
168
  noiseSize?: Vector;
150
169
  customEffectId?: string;
170
+ customEffectAssetRef?: LibraryAssetRef;
171
+ componentPropAssignments?: unknown[];
151
172
  }
152
173
  type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL' | 'TRIANGLE_FILLED' | 'DIAMOND_FILLED' | 'CIRCLE_FILLED';
153
174
  type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND';
@@ -283,7 +304,11 @@ interface ConnectorLabelPosition {
283
304
  offAxis: 'NONE' | 'ABOVE' | 'BELOW';
284
305
  }
285
306
  type TextAlignVertical = 'TOP' | 'CENTER' | 'BOTTOM';
286
- type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE';
307
+ /**
308
+ * How a text's letters are cased: as typed, re-cased, or drawn as small caps, which take the
309
+ * font's own small capitals for lower-case letters and, forced, for capitals too.
310
+ */
311
+ type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE' | 'SMALL_CAPS' | 'SMALL_CAPS_FORCED';
287
312
  type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH';
288
313
  type TextDecorationStyle = 'SOLID' | 'DOTTED' | 'WAVY';
289
314
  type LeadingTrim = 'NONE' | 'CAP_HEIGHT';
@@ -319,8 +344,11 @@ interface HyperlinkTarget {
319
344
  /** The text fields a range of characters can bind to a variable, as Figma lists them. */
320
345
  declare const TEXT_BINDABLE_FIELDS: readonly ["fontFamily", "fontSize", "fontStyle", "fontWeight", "letterSpacing", "lineHeight", "paragraphSpacing", "paragraphIndent"];
321
346
  type TextBindableField = (typeof TEXT_BINDABLE_FIELDS)[number];
322
- /** Variable IDs bound to text fields, by field. */
323
- type TextBoundVariables = Partial<Record<TextBindableField, string>>;
347
+ /**
348
+ * Variable IDs a range binds, by field: a `TextBindableField`, or the colour of one of the range's
349
+ * own fills, as `fills/0/color`, the way a layer names its paints' bindings.
350
+ */
351
+ type TextBoundVariables = Record<string, string>;
324
352
  /**
325
353
  * A line height or letter spacing as Figma keeps it: pixels, or a percent of the font size that
326
354
  * follows the size when it changes.
@@ -723,6 +751,10 @@ interface SceneNode {
723
751
  starInnerRadius: number;
724
752
  /** The FigJam kind a SHAPE_WITH_TEXT draws; its label is the node's own text. */
725
753
  shapeWithTextType: ShapeWithTextType;
754
+ /** What a slide keeps besides its layers; null on other layers. */
755
+ slide: SlideSettings | null;
756
+ /** How the layer comes onto or leaves the slide it is on while presenting; null for none. */
757
+ animation: LayerAnimation | null;
726
758
  /** The height a shape with text was given; it grows past it to fit its label. 0 is unset. */
727
759
  shapeUserHeight: number;
728
760
  /**
@@ -822,7 +854,40 @@ interface ComponentPropertyDefinition {
822
854
  description?: string;
823
855
  slotSettings?: SlotSettings;
824
856
  }
825
- type VariableType = 'COLOR' | 'FLOAT' | 'STRING' | 'BOOLEAN';
857
+ /** A TIMING variable holds a duration in seconds; an EASING one, an `Easing`. */
858
+ declare const VARIABLE_TYPES: readonly ["COLOR", "FLOAT", "STRING", "BOOLEAN", "EASING", "TIMING"];
859
+ type VariableType = (typeof VARIABLE_TYPES)[number];
860
+ /**
861
+ * The curves and springs an easing can be, by the names `.fig` files give them. `CUSTOM_CUBIC`
862
+ * and `CUSTOM_SPRING` hold the curve or spring they were given; the rest are presets, and
863
+ * `HOLD` jumps to the end without easing.
864
+ */
865
+ declare const EASING_CURVES: readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"];
866
+ type EasingCurve = (typeof EASING_CURVES)[number];
867
+ /** A CSS `cubic-bezier()`: the two control points between (0, 0) and (1, 1). */
868
+ interface CubicBezier {
869
+ x1: number;
870
+ y1: number;
871
+ x2: number;
872
+ y2: number;
873
+ }
874
+ /**
875
+ * A spring as its physics. `type` says how it is edited: by its bounce (`NORMALIZED`, the
876
+ * default) or by these three numbers (`PHYSICAL`), whose meaning `platform` sets.
877
+ */
878
+ interface Spring {
879
+ stiffness: number;
880
+ damping: number;
881
+ mass: number;
882
+ type?: 'NORMALIZED' | 'PHYSICAL';
883
+ platform?: 'IOS_WEB' | 'ANDROID';
884
+ }
885
+ /** An EASING variable's value: a curve or spring, and the numbers it holds as a file saves them. */
886
+ interface Easing {
887
+ easing: EasingCurve;
888
+ bezier?: CubicBezier;
889
+ spring?: Spring;
890
+ }
826
891
  interface VariableAlias {
827
892
  aliasId: string;
828
893
  }
@@ -832,7 +897,10 @@ interface VariableColorExpression {
832
897
  color: Color | VariableAlias;
833
898
  opacity: number | VariableAlias;
834
899
  }
835
- type VariableLiteral = Color | number | string | boolean;
900
+ type VariableLiteral = Color | number | string | boolean | Easing;
901
+ /** The types a formula computes with and gives; easings and timings are not among them. */
902
+ type VariableFormulaType = 'COLOR' | 'FLOAT' | 'STRING' | 'BOOLEAN';
903
+ type VariableFormulaLiteral = Color | number | string | boolean;
836
904
  /** The arithmetic, comparison, logic and conversions a formula combines values with. */
837
905
  declare const VARIABLE_FORMULA_OPERATORS: readonly ["add", "subtract", "multiply", "divide", "negate", "equal", "notEqual", "less", "lessOrEqual", "greater", "greaterOrEqual", "and", "or", "not", "text", "truthy", "if"];
838
906
  type VariableFormulaOperator = (typeof VARIABLE_FORMULA_OPERATORS)[number];
@@ -840,10 +908,10 @@ interface VariableFormulaOperation {
840
908
  operator: VariableFormulaOperator;
841
909
  operands: VariableFormulaNode[];
842
910
  }
843
- type VariableFormulaNode = VariableLiteral | VariableAlias | VariableFormulaOperation;
911
+ type VariableFormulaNode = VariableFormulaLiteral | VariableAlias | VariableFormulaOperation;
844
912
  interface VariableFormula {
845
913
  expression: 'FORMULA';
846
- type: VariableType;
914
+ type: VariableFormulaType;
847
915
  value: VariableFormulaNode;
848
916
  }
849
917
  /**
@@ -906,6 +974,11 @@ interface Variable {
906
974
  key?: string;
907
975
  /** Published library version (from NodeChange.version). Used for assetRef resolution in colorVar. */
908
976
  version?: string;
977
+ /**
978
+ * Deleted as Figma deletes a variable: gone from its collection's `variableIds` and from every
979
+ * list of variables, while layers bound to it still resolve it and the file keeps it.
980
+ */
981
+ deleted?: true;
909
982
  }
910
983
  /** Scalar numeric node fields accepted by numeric property controls; some may also be null. */
911
984
  type NumericNodeProperty = { [K in keyof SceneNode]-?: SceneNode[K] extends number | null ? number extends SceneNode[K] ? K : never : never; }[keyof SceneNode];
@@ -946,6 +1019,11 @@ interface VariableCollection {
946
1019
  key?: string;
947
1020
  /** Published library version, which references by key carry with it. */
948
1021
  version?: string;
1022
+ /**
1023
+ * Deleted as Figma deletes a collection: gone from every list of collections, with its variables
1024
+ * deleted too, while layers bound to them still resolve them and the file keeps them.
1025
+ */
1026
+ deleted?: true;
949
1027
  }
950
1028
  /** Whether a collection is a library's copy, which takes no variables or modes of the file's. */
951
1029
  declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>): boolean;
@@ -953,5 +1031,5 @@ declare function isLibraryCollection(collection: Pick<VariableCollection, 'key'>
953
1031
  declare const MODE_ATTRIBUTE_PATTERN: RegExp;
954
1032
  declare function isModeAttributeName(name: string): boolean;
955
1033
  //#endregion
956
- export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, DerivedTextGlyph, DocumentColorSpace, DocumentKind, DocumentRecordKind, Effect, EnabledLibraryBinding, ExportColorProfile, ExportSetting, ExportSize, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GlassEffectParams, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageFilters, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, NodeChangeObserver, NodeType, NoiseEffectParams, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, ProgressiveBlur, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SlotSettings, SourceLibraryPublication, SourceMetadata, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextLength, TextListType, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TextureEffectParams, TokenExpression, TokenUnit, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, Variable, VariableAlias, VariableCollection, VariableCollectionMode, VariableColorExpression, VariableFormula, VariableFormulaNode, VariableFormulaOperation, VariableFormulaOperator, VariableLiteral, VariableModeMap, VariableScope, VariableType, VariableUnsupportedExpression, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, isLibraryCollection, isModeAttributeName };
1034
+ export { ArcData, AxisSizingMode, BlendMode, CODE_SYNTAX_PLATFORMS, CharacterStyleOverride, CodeSyntaxPlatform, ColorProfile, CommentReply, CommentThread, ComponentPropertyDefinition, ComponentPropertyReference, ComponentPropertyReferenceField, ComponentPropertyType, ConnectorControlPoint, ConnectorEndpoint, ConnectorLabelPosition, ConnectorLineType, ConnectorMagnet, ConstraintType, CubicBezier, DerivedTextGlyph, DocumentKind, DocumentRecordKind, EASING_CURVES, Easing, EasingCurve, Effect, EnabledLibraryBinding, ExportColorProfile, ExportSetting, ExportSize, FigmaLayoutMetadata, FigmaSourcePayload, Fill, FillType, FontFeature, FontVariation, GeometryPath, GlassEffectParams, GradientStop, GradientTransform, GridPosition, GridTrack, GridTrackSizing, HandleMirroring, HyperlinkTarget, ImageFilters, ImageScaleMode, LayoutAlign, LayoutAlignSelf, LayoutCounterAlign, LayoutDirection, LayoutGrid, LayoutMode, LayoutSizing, LayoutWrap, LeadingTrim, LibraryAssetIdentity, LibraryAssetRef, LibraryAssetSource, MODE_ATTRIBUTE_PATTERN, MaskType, NodeChangeObserver, NodeType, NoiseEffectParams, NoiseType, NumericNodeProperty, PatternAlignment, PatternTileType, PluginDataEntry, PluginRelaunchDataEntry, ProgressiveBlur, SceneGraphEventHandlers, SceneGraphEvents, SceneNode, SharedStyle, SharedStyleKind, SharedStyleType, SlotSettings, SourceLibraryPublication, SourceMetadata, Spring, Stroke, StrokeCap, StrokeJoin, StyleRun, SymbolLink, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, TextAlignVertical, TextAutoResize, TextBindableField, TextBoundVariables, TextCase, TextDecoration, TextDecorationStyle, TextDirection, TextLength, TextListType, TextParagraphSpacingField, TextParagraphStyle, TextPathData, TextureEffectParams, TokenExpression, TokenUnit, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, VARIABLE_TYPES, Variable, VariableAlias, VariableCollection, VariableCollectionMode, VariableColorExpression, VariableFormula, VariableFormulaLiteral, VariableFormulaNode, VariableFormulaOperation, VariableFormulaOperator, VariableFormulaType, VariableLiteral, VariableModeMap, VariableScope, VariableType, VariableUnsupportedExpression, VariableValue, VariantPropSpec, VectorNetwork, VectorRegion, VectorSegment, VectorVertex, WindingRule, isLibraryCollection, isModeAttributeName };
957
1035
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;UAQiB;EACf,iBAAiB,MAAM;EACvB,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,wBAAwB,YAAY,SAAS,QAAQ;EACrD,iBAAiB,YAAY;EAC7B,oBAAoB,gBAAgB,4BAA4B;EAChE,mBACE,gBACA,kBACA,eACA;;KAIQ,0BAA0B;EACpC,UAAU,MAAM;EAChB,UAAU,YAAY,SAAS,QAAQ;EACvC,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,UAAU,YAAY;EACtB,aAAa,gBAAgB,4BAA4B;EACzD,YACE,gBACA,kBACA,eACA;;;KAKQ;;UAGK;;EAEf,SAAS,MAAM;;EAEf,UAAU,MAAM;;EAEhB,aAAa,MAAM;;;;;EAKnB,gBAAgB,MAAM,oBAAoB;;;;;EAK1C;EACA;;KAGU;;KAGA;UAEK;EACf,SAAS;EACT,cAAc;EACd,eAAe;EACf,QAAQ;EACR;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,KAAK;;KAGK;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA,kBAAkB;;UAGH;EACf;EACA;EACA,cAAc;EACd,YAAY;;UAGG;EACf,aAAa;EACb;;EAEA,QAAQ;;EAER;;UAGe;EACf,UAAU;EACV,UAAU;EACV,SAAS;;UAGM;EACf,aAAa;EACb,cAAc;;KAGJ;KAqBA;KAWA;KAoBA;KACA;KACA;KACA;UAEK;EACf,OAAO;EACP;;KAGU,oBAAoB;;UAGf;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf,MAAM;EACN,OAAO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;EAEZ;;EAEA;;EAEA,iBAAiB;;UAGF;EACf;EACA;EACA,OAAO;;UAGQ;EACf;EACA;EACA;;KAGU;;KAEA;;KAEA;KAEA;UAEK;EACf,QAAQ;EACR;;UAGe;EACf;EACA;EACA;EACA;;KAEU;KACA;KACA;KACA;UAEK;EACf;EACA;EACA;;;UAIe;EACf;EACA;;;KAIU;;;;;UAMK;EACf;EACA,QAAQ;;EAER;;EAEA,OAAO;;EAEP;;EAEA;EACA,eAAe;;EAEf;;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;EACA;;;;;;;UAQe;EACf,SAAS;EACT,gBAAgB;;EAEhB;EACA;;EAEA;;UAGe;;EAEf;EACA,cAAc;EACd;EACA;EACA;;EAEA;;;;;EAKA;;;;;;;EAOA;EACA;;;;;EAKA;;EAEA;;UAGe;EACf;EACA;EACA;;UAGe;EACf;EACA;;KAGU,sBAAsB,QAChC,oOAaE,qMAWA;UAGa;EACf;EACA;EACA;;UAGe;EACf,UAAU;EACV;EACA;;UAGe;EACf;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;;;UAIe;EACf;EACA;;EAEA,cAAc;;EAEd;;EAEA;EACA;EACA;;;UAIe;EACf;EACA;;EAEA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;EACA;;EAEA,cAAc;;EAEd;;EAEA;EACA;;EAEA;EACA;EACA;;EAEA;EACA,SAAS;;UAGM;EACf;EACA,MAAM;EACN;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA,QAAQ;;EAER,eAAe,QAAQ;EAEvB,OAAO;EACP,SAAS;EACT,SAAS;EACT,aAAa;EACb,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EAEA,WAAW;EAEX;EACA;EACA;EACA;EACA;;;;;EAKA;EACA;EACA,eAAe;EACf;EACA,mBAAmB;EACnB,gBAAgB;EAChB,UAAU;EACV,gBAAgB;EAChB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AAa;;KAGH;;KAGA;UAEK;EACf;EACA,OAAO;;;UAIQ;EACf;EACA;EACA;EACA;;EAEA;;;;;;UAOe;EACf;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA,eAAe;;KAGL;UACK;EACf;;;UAIe;EACf;EACA,OAAO,QAAQ;EACf,kBAAkB;;KAGR,kBAAkB;;cAEjB;KAmBD,kCAAkC;UAC7B;EACf,UAAU;EACV,UAAU;;KAEA,sBAAsB,kBAAkB,gBAAgB;UACnD;EACf;EACA,MAAM;EACN,OAAO;;;;;;;;UAQQ;EACf;;EAEA;EACA,OAAO;EACP;EACA;;KAEU,gBACR,kBACA,gBACA,0BACA,kBACA;KACQ,kBAAkB;;cAGjB;KAyBD,wBAAwB;cAEvB;KACD,6BAA6B;;;;;cAM5B;KACD,oBAAoB;;;;;;UAOf;EACf;EACA;;UAGe;EACf;EACA;EACA,MAAM;EACN;EACA,cAAc,eAAe;EAC7B;EACA;;EAEA,SAAS;;;;;EAKT,aAAa,QAAQ,OAAO;;EAE5B,OAAO;;EAEP,cAAc,eAAe;EAC7B,aAAa;;EAEb;;EAEA;;;KAIU,yBACT,WAAW,cAAc,UAAU,0CACjB,UAAU,KACvB,2BAGA;UAES;EACf;EACA;;;;;;EAMA;;;;;EAKA;;EAEA;;UAGe;EACf;EACA;;EAEA,OAAO;EACP;EACA;;;;;EAKA;EACA,aAAa;;;;;EAKb;;EAEA;;;iBAIc,oBAAoB,YAAY,KAAK;;cAKxC,wBAAsB;iBAEnB,oBAAoB"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;UASiB;EACf,iBAAiB,MAAM;EACvB,iBAAiB,YAAY,SAAS,QAAQ;EAC9C,wBAAwB,YAAY,SAAS,QAAQ;EACrD,iBAAiB,YAAY;EAC7B,oBAAoB,gBAAgB,4BAA4B;EAChE,mBACE,gBACA,kBACA,eACA;;KAIQ,0BAA0B;EACpC,UAAU,MAAM;EAChB,UAAU,YAAY,S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;UAC7B;EACf,UAAU;EACV,UAAU;;KAEA,sBAAsB,yBAAyB,gBAAgB;UAC1D;EACf;EACA,MAAM;EACN,OAAO;;;;;;;;UAQQ;EACf;;EAEA;EACA,OAAO;EACP;EACA;;KAEU,gBACR,kBACA,gBACA,0BACA,kBACA;KACQ,kBAAkB;;cAGjB;KAyBD,wBAAwB;cAEvB;KACD,6BAA6B;;;;;cAM5B;KACD,oBAAoB;;;;;;UAOf;EACf;EACA;;UAGe;EACf;EACA;EACA,MAAM;EACN;EACA,cAAc,eAAe;EAC7B;EACA;;EAEA,SAAS;;;;;EAKT,aAAa,QAAQ,OAAO;;EAE5B,OAAO;;EAEP,cAAc,eAAe;EAC7B,aAAa;;EAEb;;EAEA;;;;;EAKA;;;KAIU,yBACT,WAAW,cAAc,UAAU,0CACjB,UAAU,KACvB,2BAGA;UAES;EACf;EACA;;;;;;EAMA;;;;;EAKA;;EAEA;;UAGe;EACf;EACA;;EAEA,OAAO;EACP;EACA;;;;;EAKA;EACA,aAAa;;;;;EAKb;;EAEA;;;;;EAKA;;;iBAIc,oBAAoB,YAAY,KAAK;;cAKxC,wBAAsB;iBAEnB,oBAAoB"}
package/dist/types.js CHANGED
@@ -10,6 +10,38 @@ const TEXT_BINDABLE_FIELDS = [
10
10
  "paragraphSpacing",
11
11
  "paragraphIndent"
12
12
  ];
13
+ /** A TIMING variable holds a duration in seconds; an EASING one, an `Easing`. */
14
+ const VARIABLE_TYPES = [
15
+ "COLOR",
16
+ "FLOAT",
17
+ "STRING",
18
+ "BOOLEAN",
19
+ "EASING",
20
+ "TIMING"
21
+ ];
22
+ /**
23
+ * The curves and springs an easing can be, by the names `.fig` files give them. `CUSTOM_CUBIC`
24
+ * and `CUSTOM_SPRING` hold the curve or spring they were given; the rest are presets, and
25
+ * `HOLD` jumps to the end without easing.
26
+ */
27
+ const EASING_CURVES = [
28
+ "IN_CUBIC",
29
+ "OUT_CUBIC",
30
+ "INOUT_CUBIC",
31
+ "LINEAR",
32
+ "IN_BACK_CUBIC",
33
+ "OUT_BACK_CUBIC",
34
+ "INOUT_BACK_CUBIC",
35
+ "CUSTOM_CUBIC",
36
+ "SPRING",
37
+ "GENTLE_SPRING",
38
+ "CUSTOM_SPRING",
39
+ "SPRING_PRESET_ONE",
40
+ "SPRING_PRESET_TWO",
41
+ "SPRING_PRESET_THREE",
42
+ "HOLD",
43
+ "EASE_IN"
44
+ ];
13
45
  /** The arithmetic, comparison, logic and conversions a formula combines values with. */
14
46
  const VARIABLE_FORMULA_OPERATORS = [
15
47
  "add",
@@ -84,6 +116,6 @@ function isModeAttributeName(name) {
84
116
  return name.length <= 100 && MODE_ATTRIBUTE_PATTERN.test(name);
85
117
  }
86
118
  //#endregion
87
- export { CODE_SYNTAX_PLATFORMS, MODE_ATTRIBUTE_PATTERN, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, isLibraryCollection, isModeAttributeName };
119
+ export { CODE_SYNTAX_PLATFORMS, EASING_CURVES, MODE_ATTRIBUTE_PATTERN, TEXT_BINDABLE_FIELDS, TOKEN_UNITS, VARIABLE_FORMULA_OPERATORS, VARIABLE_SCOPES, VARIABLE_TYPES, isLibraryCollection, isModeAttributeName };
88
120
 
89
121
  //# sourceMappingURL=types.js.map