@moondraft/import 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +34 -0
  3. package/README.md +36 -2
  4. package/SOURCE.md +394 -0
  5. package/dist/adapter/convert.d.ts +144 -0
  6. package/dist/adapter/convert.js +2811 -0
  7. package/dist/adapter/figma-descriptions.d.ts +7 -0
  8. package/dist/adapter/figma-descriptions.js +34 -0
  9. package/dist/adapter/figma-grids.d.ts +12 -0
  10. package/dist/adapter/figma-grids.js +175 -0
  11. package/dist/adapter/figma-handoff.d.ts +12 -0
  12. package/dist/adapter/figma-handoff.js +167 -0
  13. package/dist/adapter/figma-hyperlinks.d.ts +13 -0
  14. package/dist/adapter/figma-hyperlinks.js +77 -0
  15. package/dist/adapter/figma.d.ts +12 -0
  16. package/dist/adapter/figma.js +40 -0
  17. package/dist/adapter/file-components.d.ts +20 -0
  18. package/dist/adapter/file-components.js +352 -0
  19. package/dist/adapter/file-resources.d.ts +29 -0
  20. package/dist/adapter/file-resources.js +851 -0
  21. package/dist/adapter/image-crop.d.ts +18 -0
  22. package/dist/adapter/image-crop.js +30 -0
  23. package/dist/adapter/index.d.ts +6 -0
  24. package/dist/adapter/index.js +9 -0
  25. package/dist/adapter/link.d.ts +49 -0
  26. package/dist/adapter/link.js +892 -0
  27. package/dist/adapter/payload.d.ts +31 -0
  28. package/dist/adapter/payload.js +78 -0
  29. package/dist/adapter/shapes.d.ts +31 -0
  30. package/dist/adapter/shapes.js +75 -0
  31. package/dist/adapter/variables.d.ts +45 -0
  32. package/dist/adapter/variables.js +106 -0
  33. package/dist/figma-file.d.ts +38 -0
  34. package/dist/figma-file.js +97 -0
  35. package/dist/figma-worker.d.ts +11 -0
  36. package/dist/figma-worker.js +12 -0
  37. package/dist/figma.d.ts +26 -0
  38. package/dist/figma.js +230 -0
  39. package/dist/index.d.ts +29 -0
  40. package/dist/index.js +50 -0
  41. package/dist/report.d.ts +42 -0
  42. package/dist/report.js +142 -0
  43. package/dist/serialize.d.ts +7 -0
  44. package/dist/serialize.js +79 -0
  45. package/dist/svg.d.ts +33 -0
  46. package/dist/svg.js +44 -0
  47. package/dist/syntax.d.ts +8 -0
  48. package/dist/syntax.js +19 -0
  49. package/dist/taco/figma-import/clipboard.d.ts +25 -0
  50. package/dist/taco/figma-import/clipboard.js +87 -0
  51. package/dist/taco/figma-import/clipboardSize.d.ts +31 -0
  52. package/dist/taco/figma-import/clipboardSize.js +107 -0
  53. package/dist/taco/figma-import/container/compression.d.ts +9 -0
  54. package/dist/taco/figma-import/container/compression.js +174 -0
  55. package/dist/taco/figma-import/container/error.d.ts +15 -0
  56. package/dist/taco/figma-import/container/error.js +19 -0
  57. package/dist/taco/figma-import/container/kiwiContainer.d.ts +41 -0
  58. package/dist/taco/figma-import/container/kiwiContainer.js +61 -0
  59. package/dist/taco/figma-import/container/limits.d.ts +22 -0
  60. package/dist/taco/figma-import/container/limits.js +22 -0
  61. package/dist/taco/figma-import/container/zip.d.ts +14 -0
  62. package/dist/taco/figma-import/container/zip.js +154 -0
  63. package/dist/taco/figma-import/figFile.d.ts +34 -0
  64. package/dist/taco/figma-import/figFile.js +91 -0
  65. package/dist/taco/figma-import/figFileDocument.d.ts +25 -0
  66. package/dist/taco/figma-import/figFileDocument.js +100 -0
  67. package/dist/taco/figma-import/import/blobs.d.ts +10 -0
  68. package/dist/taco/figma-import/import/blobs.js +23 -0
  69. package/dist/taco/figma-import/import/carry.d.ts +24 -0
  70. package/dist/taco/figma-import/import/carry.js +66 -0
  71. package/dist/taco/figma-import/import/componentProps.d.ts +90 -0
  72. package/dist/taco/figma-import/import/componentProps.js +329 -0
  73. package/dist/taco/figma-import/import/componentSets.d.ts +85 -0
  74. package/dist/taco/figma-import/import/componentSets.js +647 -0
  75. package/dist/taco/figma-import/import/converters/effects.d.ts +31 -0
  76. package/dist/taco/figma-import/import/converters/effects.js +127 -0
  77. package/dist/taco/figma-import/import/converters/ellipse.d.ts +7 -0
  78. package/dist/taco/figma-import/import/converters/ellipse.js +54 -0
  79. package/dist/taco/figma-import/import/converters/exportSettings.d.ts +4 -0
  80. package/dist/taco/figma-import/import/converters/exportSettings.js +49 -0
  81. package/dist/taco/figma-import/import/converters/frame.d.ts +21 -0
  82. package/dist/taco/figma-import/import/converters/frame.js +63 -0
  83. package/dist/taco/figma-import/import/converters/gradient.d.ts +74 -0
  84. package/dist/taco/figma-import/import/converters/gradient.js +108 -0
  85. package/dist/taco/figma-import/import/converters/group.d.ts +19 -0
  86. package/dist/taco/figma-import/import/converters/group.js +30 -0
  87. package/dist/taco/figma-import/import/converters/image.d.ts +13 -0
  88. package/dist/taco/figma-import/import/converters/image.js +94 -0
  89. package/dist/taco/figma-import/import/converters/layout.d.ts +33 -0
  90. package/dist/taco/figma-import/import/converters/layout.js +187 -0
  91. package/dist/taco/figma-import/import/converters/line.d.ts +11 -0
  92. package/dist/taco/figma-import/import/converters/line.js +40 -0
  93. package/dist/taco/figma-import/import/converters/rectangle.d.ts +3 -0
  94. package/dist/taco/figma-import/import/converters/rectangle.js +11 -0
  95. package/dist/taco/figma-import/import/converters/section.d.ts +8 -0
  96. package/dist/taco/figma-import/import/converters/section.js +29 -0
  97. package/dist/taco/figma-import/import/converters/shared.d.ts +71 -0
  98. package/dist/taco/figma-import/import/converters/shared.js +372 -0
  99. package/dist/taco/figma-import/import/converters/text.d.ts +54 -0
  100. package/dist/taco/figma-import/import/converters/text.js +707 -0
  101. package/dist/taco/figma-import/import/converters/vector.d.ts +105 -0
  102. package/dist/taco/figma-import/import/converters/vector.js +609 -0
  103. package/dist/taco/figma-import/import/converters/vectorNetwork.d.ts +114 -0
  104. package/dist/taco/figma-import/import/converters/vectorNetwork.js +503 -0
  105. package/dist/taco/figma-import/import/fields.d.ts +15 -0
  106. package/dist/taco/figma-import/import/fields.js +29 -0
  107. package/dist/taco/figma-import/import/instances.d.ts +184 -0
  108. package/dist/taco/figma-import/import/instances.js +1530 -0
  109. package/dist/taco/figma-import/import/nestingCycles.d.ts +86 -0
  110. package/dist/taco/figma-import/import/nestingCycles.js +488 -0
  111. package/dist/taco/figma-import/import/slots.d.ts +56 -0
  112. package/dist/taco/figma-import/import/slots.js +96 -0
  113. package/dist/taco/figma-import/import/styles.d.ts +48 -0
  114. package/dist/taco/figma-import/import/styles.js +48 -0
  115. package/dist/taco/figma-import/import/tree.d.ts +66 -0
  116. package/dist/taco/figma-import/import/tree.js +194 -0
  117. package/dist/taco/figma-import/import/types.d.ts +232 -0
  118. package/dist/taco/figma-import/import/types.js +33 -0
  119. package/dist/taco/figma-import/import/variables.d.ts +137 -0
  120. package/dist/taco/figma-import/import/variables.js +769 -0
  121. package/dist/taco/figma-import/import/variantTrees.d.ts +20 -0
  122. package/dist/taco/figma-import/import/variantTrees.js +520 -0
  123. package/dist/taco/figma-import/import/walk.d.ts +207 -0
  124. package/dist/taco/figma-import/import/walk.js +1464 -0
  125. package/dist/taco/figma-import/index.d.ts +22 -0
  126. package/dist/taco/figma-import/index.js +13 -0
  127. package/dist/taco/figma-import/kiwi/byteReader.d.ts +37 -0
  128. package/dist/taco/figma-import/kiwi/byteReader.js +151 -0
  129. package/dist/taco/figma-import/kiwi/error.d.ts +14 -0
  130. package/dist/taco/figma-import/kiwi/error.js +29 -0
  131. package/dist/taco/figma-import/kiwi/limits.d.ts +18 -0
  132. package/dist/taco/figma-import/kiwi/limits.js +18 -0
  133. package/dist/taco/figma-import/kiwi/message.d.ts +12 -0
  134. package/dist/taco/figma-import/kiwi/message.js +147 -0
  135. package/dist/taco/figma-import/kiwi/schema.d.ts +42 -0
  136. package/dist/taco/figma-import/kiwi/schema.js +206 -0
  137. package/dist/taco/figma-import/kiwi/types.d.ts +46 -0
  138. package/dist/taco/figma-import/kiwi/types.js +18 -0
  139. package/dist/taco/model/agent-hidden-fields.d.ts +20 -0
  140. package/dist/taco/model/agent-hidden-fields.js +29 -0
  141. package/dist/taco/model/asset-users.d.ts +23 -0
  142. package/dist/taco/model/asset-users.js +128 -0
  143. package/dist/taco/model/auto-layout-lines.d.ts +32 -0
  144. package/dist/taco/model/auto-layout-lines.js +70 -0
  145. package/dist/taco/model/codec.d.ts +444 -0
  146. package/dist/taco/model/codec.js +5665 -0
  147. package/dist/taco/model/color.d.ts +11 -0
  148. package/dist/taco/model/color.js +61 -0
  149. package/dist/taco/model/comment-operations.d.ts +102 -0
  150. package/dist/taco/model/comment-operations.js +227 -0
  151. package/dist/taco/model/component-evaluation.d.ts +96 -0
  152. package/dist/taco/model/component-evaluation.js +555 -0
  153. package/dist/taco/model/component-expressions.d.ts +242 -0
  154. package/dist/taco/model/component-expressions.js +1082 -0
  155. package/dist/taco/model/component-properties.d.ts +111 -0
  156. package/dist/taco/model/component-properties.js +339 -0
  157. package/dist/taco/model/component-samples.d.ts +83 -0
  158. package/dist/taco/model/component-samples.js +290 -0
  159. package/dist/taco/model/component-validity.d.ts +85 -0
  160. package/dist/taco/model/component-validity.js +397 -0
  161. package/dist/taco/model/components.d.ts +155 -0
  162. package/dist/taco/model/components.js +505 -0
  163. package/dist/taco/model/connector-ends.d.ts +20 -0
  164. package/dist/taco/model/connector-ends.js +188 -0
  165. package/dist/taco/model/connector-geometry.d.ts +74 -0
  166. package/dist/taco/model/connector-geometry.js +293 -0
  167. package/dist/taco/model/corner-radii.d.ts +26 -0
  168. package/dist/taco/model/corner-radii.js +47 -0
  169. package/dist/taco/model/derivations.d.ts +81 -0
  170. package/dist/taco/model/derivations.js +151 -0
  171. package/dist/taco/model/export-settings.d.ts +53 -0
  172. package/dist/taco/model/export-settings.js +156 -0
  173. package/dist/taco/model/expressions/ast.d.ts +153 -0
  174. package/dist/taco/model/expressions/ast.js +6 -0
  175. package/dist/taco/model/expressions/cache.d.ts +23 -0
  176. package/dist/taco/model/expressions/cache.js +43 -0
  177. package/dist/taco/model/expressions/check.d.ts +72 -0
  178. package/dist/taco/model/expressions/check.js +517 -0
  179. package/dist/taco/model/expressions/completion.d.ts +61 -0
  180. package/dist/taco/model/expressions/completion.js +421 -0
  181. package/dist/taco/model/expressions/evaluate.d.ts +32 -0
  182. package/dist/taco/model/expressions/evaluate.js +519 -0
  183. package/dist/taco/model/expressions/forms.d.ts +84 -0
  184. package/dist/taco/model/expressions/forms.js +200 -0
  185. package/dist/taco/model/expressions/index.d.ts +14 -0
  186. package/dist/taco/model/expressions/index.js +17 -0
  187. package/dist/taco/model/expressions/lexer.d.ts +42 -0
  188. package/dist/taco/model/expressions/lexer.js +213 -0
  189. package/dist/taco/model/expressions/library.d.ts +33 -0
  190. package/dist/taco/model/expressions/library.js +117 -0
  191. package/dist/taco/model/expressions/names.d.ts +43 -0
  192. package/dist/taco/model/expressions/names.js +99 -0
  193. package/dist/taco/model/expressions/parser.d.ts +15 -0
  194. package/dist/taco/model/expressions/parser.js +438 -0
  195. package/dist/taco/model/expressions/rename.d.ts +34 -0
  196. package/dist/taco/model/expressions/rename.js +46 -0
  197. package/dist/taco/model/expressions/source.d.ts +15 -0
  198. package/dist/taco/model/expressions/source.js +161 -0
  199. package/dist/taco/model/expressions/types.d.ts +119 -0
  200. package/dist/taco/model/expressions/types.js +102 -0
  201. package/dist/taco/model/expressions/values.d.ts +97 -0
  202. package/dist/taco/model/expressions/values.js +160 -0
  203. package/dist/taco/model/geometry-limits.d.ts +16 -0
  204. package/dist/taco/model/geometry-limits.js +67 -0
  205. package/dist/taco/model/geometry.d.ts +47 -0
  206. package/dist/taco/model/geometry.js +193 -0
  207. package/dist/taco/model/group-bounds.d.ts +38 -0
  208. package/dist/taco/model/group-bounds.js +144 -0
  209. package/dist/taco/model/id-table.d.ts +37 -0
  210. package/dist/taco/model/id-table.js +80 -0
  211. package/dist/taco/model/index.d.ts +25 -0
  212. package/dist/taco/model/index.js +27 -0
  213. package/dist/taco/model/instance-resolver.d.ts +376 -0
  214. package/dist/taco/model/instance-resolver.js +1778 -0
  215. package/dist/taco/model/layer-syntax.d.ts +340 -0
  216. package/dist/taco/model/layer-syntax.js +3506 -0
  217. package/dist/taco/model/layout/constraints.d.ts +84 -0
  218. package/dist/taco/model/layout/constraints.js +445 -0
  219. package/dist/taco/model/layout/frame-layout.d.ts +46 -0
  220. package/dist/taco/model/layout/frame-layout.js +618 -0
  221. package/dist/taco/model/layout/node-sizing.d.ts +163 -0
  222. package/dist/taco/model/layout/node-sizing.js +486 -0
  223. package/dist/taco/model/legacy-connector-caps.d.ts +15 -0
  224. package/dist/taco/model/legacy-connector-caps.js +70 -0
  225. package/dist/taco/model/linear-call.d.ts +48 -0
  226. package/dist/taco/model/linear-call.js +58 -0
  227. package/dist/taco/model/new-nodes.d.ts +145 -0
  228. package/dist/taco/model/new-nodes.js +277 -0
  229. package/dist/taco/model/node-builder.d.ts +449 -0
  230. package/dist/taco/model/node-builder.js +2294 -0
  231. package/dist/taco/model/node-table-watch.d.ts +36 -0
  232. package/dist/taco/model/node-table-watch.js +63 -0
  233. package/dist/taco/model/node-transform.d.ts +39 -0
  234. package/dist/taco/model/node-transform.js +79 -0
  235. package/dist/taco/model/node-users-index.d.ts +10 -0
  236. package/dist/taco/model/node-users-index.js +82 -0
  237. package/dist/taco/model/operation-references.d.ts +80 -0
  238. package/dist/taco/model/operation-references.js +399 -0
  239. package/dist/taco/model/operations.d.ts +610 -0
  240. package/dist/taco/model/operations.js +2882 -0
  241. package/dist/taco/model/overlay-table.d.ts +71 -0
  242. package/dist/taco/model/overlay-table.js +171 -0
  243. package/dist/taco/model/override-remap.d.ts +69 -0
  244. package/dist/taco/model/override-remap.js +230 -0
  245. package/dist/taco/model/parent-table.d.ts +53 -0
  246. package/dist/taco/model/parent-table.js +193 -0
  247. package/dist/taco/model/problem-collector.d.ts +27 -0
  248. package/dist/taco/model/problem-collector.js +101 -0
  249. package/dist/taco/model/sha256.d.ts +10 -0
  250. package/dist/taco/model/sha256.js +79 -0
  251. package/dist/taco/model/shape-geometry.d.ts +96 -0
  252. package/dist/taco/model/shape-geometry.js +368 -0
  253. package/dist/taco/model/shared-node-table.d.ts +97 -0
  254. package/dist/taco/model/shared-node-table.js +546 -0
  255. package/dist/taco/model/slots.d.ts +113 -0
  256. package/dist/taco/model/slots.js +281 -0
  257. package/dist/taco/model/stroke-settings.d.ts +37 -0
  258. package/dist/taco/model/stroke-settings.js +90 -0
  259. package/dist/taco/model/svg-path-import.d.ts +89 -0
  260. package/dist/taco/model/svg-path-import.js +219 -0
  261. package/dist/taco/model/text-measurement.d.ts +142 -0
  262. package/dist/taco/model/text-measurement.js +846 -0
  263. package/dist/taco/model/text-reads.d.ts +66 -0
  264. package/dist/taco/model/text-reads.js +128 -0
  265. package/dist/taco/model/text-sizer.d.ts +358 -0
  266. package/dist/taco/model/text-sizer.js +996 -0
  267. package/dist/taco/model/theme-users.d.ts +59 -0
  268. package/dist/taco/model/theme-users.js +312 -0
  269. package/dist/taco/model/thumbnail.d.ts +15 -0
  270. package/dist/taco/model/thumbnail.js +34 -0
  271. package/dist/taco/model/types.d.ts +2369 -0
  272. package/dist/taco/model/types.js +366 -0
  273. package/dist/taco/model/unknown-property.d.ts +5 -0
  274. package/dist/taco/model/unknown-property.js +7 -0
  275. package/dist/taco/model/validated-documents.d.ts +22 -0
  276. package/dist/taco/model/validated-documents.js +22 -0
  277. package/dist/taco/model/variable-modes.d.ts +61 -0
  278. package/dist/taco/model/variable-modes.js +438 -0
  279. package/dist/taco/model/variable-references.d.ts +54 -0
  280. package/dist/taco/model/variable-references.js +183 -0
  281. package/dist/taco/model/variables.d.ts +24 -0
  282. package/dist/taco/model/variables.js +151 -0
  283. package/dist/taco/model/vector-network.d.ts +34 -0
  284. package/dist/taco/model/vector-network.js +411 -0
  285. package/dist/taco/svg-import/import-svg.d.ts +36 -0
  286. package/dist/taco/svg-import/import-svg.js +729 -0
  287. package/dist/taco/svg-import/index.d.ts +3 -0
  288. package/dist/taco/svg-import/index.js +3 -0
  289. package/dist/taco/svg-import/limits/limits.d.ts +79 -0
  290. package/dist/taco/svg-import/limits/limits.js +160 -0
  291. package/dist/taco/svg-import/paint/gradients.d.ts +64 -0
  292. package/dist/taco/svg-import/paint/gradients.js +429 -0
  293. package/dist/taco/svg-import/paint/paint.d.ts +32 -0
  294. package/dist/taco/svg-import/paint/paint.js +162 -0
  295. package/dist/taco/svg-import/paths/paths.d.ts +58 -0
  296. package/dist/taco/svg-import/paths/paths.js +205 -0
  297. package/dist/taco/svg-import/public-types.d.ts +279 -0
  298. package/dist/taco/svg-import/public-types.js +56 -0
  299. package/dist/taco/svg-import/report/report.d.ts +44 -0
  300. package/dist/taco/svg-import/report/report.js +79 -0
  301. package/dist/taco/svg-import/reuse/reuse.d.ts +99 -0
  302. package/dist/taco/svg-import/reuse/reuse.js +840 -0
  303. package/dist/taco/svg-import/shapes/shapes.d.ts +35 -0
  304. package/dist/taco/svg-import/shapes/shapes.js +386 -0
  305. package/dist/taco/svg-import/structure/effects.d.ts +26 -0
  306. package/dist/taco/svg-import/structure/effects.js +618 -0
  307. package/dist/taco/svg-import/structure/image.d.ts +24 -0
  308. package/dist/taco/svg-import/structure/image.js +495 -0
  309. package/dist/taco/svg-import/structure/walk.d.ts +85 -0
  310. package/dist/taco/svg-import/structure/walk.js +544 -0
  311. package/dist/taco/svg-import/style/color.d.ts +40 -0
  312. package/dist/taco/svg-import/style/color.js +275 -0
  313. package/dist/taco/svg-import/style/computed.d.ts +214 -0
  314. package/dist/taco/svg-import/style/computed.js +1534 -0
  315. package/dist/taco/svg-import/style/css.d.ts +127 -0
  316. package/dist/taco/svg-import/style/css.js +541 -0
  317. package/dist/taco/svg-import/style/media.d.ts +25 -0
  318. package/dist/taco/svg-import/style/media.js +307 -0
  319. package/dist/taco/svg-import/style/properties.d.ts +43 -0
  320. package/dist/taco/svg-import/style/properties.js +135 -0
  321. package/dist/taco/svg-import/style/selector-reach.d.ts +30 -0
  322. package/dist/taco/svg-import/style/selector-reach.js +169 -0
  323. package/dist/taco/svg-import/style/selector-validity.d.ts +14 -0
  324. package/dist/taco/svg-import/style/selector-validity.js +307 -0
  325. package/dist/taco/svg-import/text/text.d.ts +29 -0
  326. package/dist/taco/svg-import/text/text.js +545 -0
  327. package/dist/taco/svg-import/transform/matrix.d.ts +111 -0
  328. package/dist/taco/svg-import/transform/matrix.js +229 -0
  329. package/dist/taco/svg-import/tree/element-data.d.ts +52 -0
  330. package/dist/taco/svg-import/tree/element-data.js +155 -0
  331. package/dist/taco/svg-import/tree/elements.d.ts +36 -0
  332. package/dist/taco/svg-import/tree/elements.js +121 -0
  333. package/dist/taco/svg-import/units/length.d.ts +43 -0
  334. package/dist/taco/svg-import/units/length.js +125 -0
  335. package/dist/taco/svg-import/units/viewbox.d.ts +35 -0
  336. package/dist/taco/svg-import/units/viewbox.js +77 -0
  337. package/package.json +55 -4
@@ -0,0 +1,340 @@
1
+ import { type LayerSyntaxComponent } from "./node-builder.ts";
2
+ import type { DocumentOperation } from "./operations.ts";
3
+ import { type ComponentPropertyDefinition, type NodeId, type SceneNode, type VariableCollection } from "./types.ts";
4
+ /** A text of the tools that cannot be read or carried out; the message says what to write instead. */
5
+ export declare class LayerSyntaxError extends Error {
6
+ readonly missingLayerId: string | undefined;
7
+ /**
8
+ * @param missingLayerId For "There is no layer #id in the scope", the id: a caller that can look outside the scope
9
+ * (in the components) may say where the layer is instead.
10
+ */
11
+ constructor(message: string, missingLayerId?: string);
12
+ }
13
+ /**
14
+ * The components a text may call and a read may print: every component of the document, and the layers of those it
15
+ * names or shows, which an instance needs for its size and `over:{...}` for the names of its layers.
16
+ */
17
+ export interface LayerSyntaxComponents {
18
+ /** Every component of the document, as `document.inspect` lists them. */
19
+ readonly definitions: readonly LayerSyntaxComponent[];
20
+ /** A layer of a component, or undefined when it was not read. */
21
+ readonly node: (id: string) => SceneNode | undefined;
22
+ }
23
+ /**
24
+ * The document's variable collections, as the theme stores them (`DocumentTheme.variableCollections`), for
25
+ * `var('name')`: a build or a set names a variable by its name, and a read prints a bound property that way.
26
+ */
27
+ export type LayerSyntaxVariables = Readonly<Record<string, VariableCollection>>;
28
+ /**
29
+ * A value in the tool spelling: a colour and a lower-case word bare, any other string in single quotes with
30
+ * a quote inside written twice, lists in `(...)` and objects in `{...}`. It never prints a double quote or a
31
+ * backslash: a string holding a backslash is refused, as this syntax has no way to write one.
32
+ */
33
+ export declare function printLayerValue(value: unknown, where?: string): string;
34
+ /**
35
+ * Where a call or an argument of a source re-spelled on one line in the default spelling (`spellingWithPlaces`) was in the text as written: the
36
+ * editor reads the re-spelled source, so its refusals name places in it (`line 1, column 532`), which `writtenPlaces`
37
+ * turns back into the agent's line and column.
38
+ */
39
+ export interface WrittenPlace {
40
+ /** The column of the call or argument in the re-spelled source, from 1. */
41
+ readonly spelledColumn: number;
42
+ /** Its line and column in the text as written, from 1. */
43
+ readonly line: number;
44
+ readonly column: number;
45
+ }
46
+ /**
47
+ * `refusal`, an editor refusal of `node.build` sources re-spelled on one line, with each place it names in them
48
+ * (`at line 1, column 532`, `Line 1, column 532:`) turned back into the line and column of the text as written:
49
+ * `sources` holds the places of each source the change sent. A place that no source has, or that more than one has
50
+ * (one change with several sources), is left out, so that the call it names is what the refusal points to.
51
+ */
52
+ export declare function writtenPlaces(refusal: string, sources: readonly (readonly WrittenPlace[])[]): string;
53
+ /**
54
+ * A connector end attached to a layer that is not among the layers checked with it, for a host to check against that
55
+ * layer once it reads it (`connectorAttachmentRefusal`): `where` names the connector as a refusal does, `which` is
56
+ * `from` or `to`.
57
+ */
58
+ export interface ConnectorAttachment {
59
+ readonly where: string;
60
+ readonly which: "from" | "to";
61
+ readonly end: Readonly<Record<string, unknown>> & {
62
+ readonly nodeId: string;
63
+ };
64
+ }
65
+ /**
66
+ * Why the connector end `attachment` cannot attach to `target`, the layer it names, or undefined when it can: a layer
67
+ * without a frame (a path), which the editor cannot place an end on and so does not draw the connector; or a corner or
68
+ * edge (`vertex(n)`, `edge(n)`) the layer does not have, which the editor would place as an automatic end instead.
69
+ */
70
+ export declare function connectorAttachmentRefusal(attachment: ConnectorAttachment, target: SceneNode): string | undefined;
71
+ /** The shorthand a matcher names a layer by: the first of `headsOf`. */
72
+ export declare function layerSyntaxHead(node: SceneNode): string;
73
+ /**
74
+ * The components of a document as the layer syntax calls them, one line each in the form of a call: its call name, then
75
+ * its props by name with their defaults (an enum as its options, the default first; a prop named like another argument
76
+ * of an instance, or whose name is not a word, in `props:{...}`), as `forms.button(type:(normal, danger), text:'Button')`. A component that no call
77
+ * name names alone (its name has no letter or digit, or another component has the same call name) gets a line of its
78
+ * own saying so, with its id for `instance(componentId:...)`. Empty without components.
79
+ */
80
+ export declare function printLayerComponents(definitions: readonly LayerSyntaxComponent[]): string[];
81
+ /** Where `printLayerSource` finds the layers. */
82
+ export interface LayerSource {
83
+ /** The layer with this id, or undefined when it was not read. */
84
+ readonly node: (id: string) => SceneNode | undefined;
85
+ /**
86
+ * The runs of the text with this id, each by its paragraph's index and its index in the paragraph, whose `fontAssetId` the editor binds
87
+ * again for the face the run names when a step sends the run without it, as `document.read` marks them
88
+ * (`defaultFontAssetRuns`). Their `fontAssetId` is left out of the print; every other run keeps it.
89
+ */
90
+ readonly defaultFontAssetRuns?: (id: string) => readonly {
91
+ readonly paragraph: number;
92
+ readonly run: number;
93
+ }[] | undefined;
94
+ }
95
+ /**
96
+ * The layer `rootId` and the layers inside it as layer source in the tool spelling, on one line: one call
97
+ * per layer, `id` and `name` first, then the short arguments, then each other field that differs from what the call
98
+ * makes, by its model name, so that every layer prints and building the text makes the same layers
99
+ * (`build(print(x))` equals x, but for the x and y that auto layout places and the sizes that fill or hug, which
100
+ * layout sets again, and the `fontAssetId` of each run `defaultFontAssetRuns` lists, which the editor binds again).
101
+ * `parentAutoLayout` says whether the parent of `rootId` places it with auto layout, when known. `insideComponent` is the
102
+ * component whose layers `rootId` is among, when known, so that a slot frame prints its slot's name; without it a slot
103
+ * frame outside a printed component root prints its slot's name only when one component alone has a slot with its id.
104
+ * With `components`, an instance prints by its component's call name, its props by name and its overrides in
105
+ * `over:{...}` (`button(id:b1, name:'Buy', text:'Buy', over:{Label:{color:#ffffff}})`); without, or where that does not
106
+ * build it again, by its model fields (`instance(componentId:..., ...)`).
107
+ * Throws a LayerSyntaxError for a layer not read, a string with a backslash, or a layer the check finds is not built again.
108
+ */
109
+ export declare function printLayerSource(given: LayerSource, rootId: string, options?: {
110
+ readonly parentAutoLayout?: boolean;
111
+ readonly components?: LayerSyntaxComponents;
112
+ readonly variables?: LayerSyntaxVariables;
113
+ readonly slotDepth?: number;
114
+ readonly insideComponent?: LayerSyntaxComponent;
115
+ }): string;
116
+ /**
117
+ * A line for each frame with free layout, `rootId` or inside it, whose layers overflow it or leave space that is not
118
+ * the same on every side: the box around its layers and the space on each side, so that an agent sees the real
119
+ * bounds instead of guessing them. Frames for which `skip` is true (a page root) and frames whose layers were not all
120
+ * read get no line.
121
+ */
122
+ export declare function layerContentNotes(source: LayerSource, rootId: string, options?: {
123
+ readonly skip?: (id: string) => boolean;
124
+ }): string[];
125
+ /** The ids of a `read` text: one or more `#id`, separated by spaces, commas or `;`. */
126
+ export declare function readLayerIds(text: string): string[];
127
+ /**
128
+ * The ids of the components a `build` or `edit` text calls by name (any word before `(` that names a component) or names
129
+ * by id (`componentId:'<id>'` of an `instance(...)`), so
130
+ * that a host reads their layers before it reads the text with `readLayerBuild` or `planLayerEdit`. A text that cannot
131
+ * be read gives the components found before the place it cannot be read: the read of the text refuses it.
132
+ */
133
+ export declare function layerSyntaxComponentIds(text: string, definitions: readonly LayerSyntaxComponent[]): string[];
134
+ /** A `build` text, read: where the layers go, and their source. */
135
+ export interface LayerBuildCommand {
136
+ readonly parentId: string;
137
+ readonly index?: number;
138
+ /**
139
+ * The slot of the instance `parentId` the layers go into, by its name, from `slot:Name` after the parent: a host finds
140
+ * the slot property of that name and sends it as the `slot` of the `node.build`, and the editor fills the slot with a
141
+ * copy of its default content first when the instance does not fill it.
142
+ */
143
+ readonly slot?: string;
144
+ /** The layers in the default spelling, for a `node.build` the editor reads. */
145
+ readonly source: string;
146
+ /**
147
+ * The model fields that `-name` leaves out, by the id of the layer: the default spelling has no `-name`, so a host
148
+ * sends a `node.patch` with `remove` for each after the `node.build`, in the same change.
149
+ */
150
+ readonly removals: readonly {
151
+ readonly nodeId: NodeId;
152
+ readonly remove: readonly string[];
153
+ }[];
154
+ /**
155
+ * The layers the connector ends of the new layers attach to, other than the new layers themselves: a host checks
156
+ * that each exists, and refuses the build naming the ones that do not with the forms of a connector end
157
+ * (`connectorTargetRefusal`), before it applies it.
158
+ */
159
+ readonly attachedTo: readonly string[];
160
+ /**
161
+ * The connector ends of the new layers attached to those layers, for a host to check against each layer it reads
162
+ * (`connectorAttachmentRefusal`): a layer with no frame, or a corner or edge it does not have, is refused before the
163
+ * build is applied. Ends attached to new layers are checked already.
164
+ */
165
+ readonly attachments: readonly ConnectorAttachment[];
166
+ /** Each top-level layer on its own, in order: its source and the removals of its layers, for a host that sends one at a time. */
167
+ readonly layers: readonly {
168
+ readonly source: string;
169
+ readonly removals: readonly {
170
+ readonly nodeId: NodeId;
171
+ readonly remove: readonly string[];
172
+ }[];
173
+ readonly places: readonly WrittenPlace[];
174
+ }[];
175
+ /** Where each call and argument of `source` was in the text as written, for `writtenPlaces` to correct an editor refusal. */
176
+ readonly places: readonly WrittenPlace[];
177
+ }
178
+ /** The refusal of connector ends attached to layers the document does not have, with the forms to write. */
179
+ export declare function connectorTargetRefusal(missing: readonly string[]): string;
180
+ /**
181
+ * Reads a `build` text, `in #parent [at:index]; <layers>`, checks its layers as `buildNodes` would (without the
182
+ * document, so a rule about the parent is the editor's to refuse), and gives them in the default spelling for a
183
+ * `node.build`. Refusals name the line and column of the text as written.
184
+ */
185
+ export declare function readLayerBuild(text: string, options?: {
186
+ readonly components?: LayerSyntaxComponents;
187
+ readonly variables?: LayerSyntaxVariables;
188
+ }): LayerBuildCommand;
189
+ /** A slot of an instance as `build in #<instance id> slot:<name>;` names it: its property's id, and the path of the nested instance whose slot it is. */
190
+ export interface LayerSlotTarget {
191
+ readonly propertyId: string;
192
+ /** The layer ids from the instance's component down to the nested instance, as an override key; empty for its own slot. */
193
+ readonly path: readonly string[];
194
+ }
195
+ /**
196
+ * The slot `written` names on an instance of the component `componentId`: one of its own slots by name, or a slot of an
197
+ * instance nested in it as `<layer>.<slot>`, the layer named as `over:{...}` names it (`Footer.Actions`, or
198
+ * `Card.Footer.Actions` deeper). Throws a LayerSyntaxError that lists every slot it has when none matches. With the
199
+ * stored `instance`, a nested instance's slots are those of the component it shows, as the instance's overrides and
200
+ * props swap it (`components` holds that component's layers too); without it, those of the component stored.
201
+ */
202
+ export declare function layerSlotTarget(written: string, componentId: string, components: LayerSyntaxComponents | undefined, shown: string, instance?: SceneNode): LayerSlotTarget;
203
+ /** An `edit` text, read: the layer its matchers look in, when it names one, and its rules. */
204
+ export interface LayerEditCommand {
205
+ /** The layer from `in #id;`; without it the matchers look in every page. */
206
+ readonly scopeId?: string;
207
+ /** The rules, for `planLayerEdit`, with the place blanked out so that lines and columns are those of the text as written. */
208
+ readonly rules: string;
209
+ }
210
+ /** Reads an `edit` text: `[in #scope;]` then rules, as `set ...; add ...; move ...`. */
211
+ export declare function readLayerEdit(text: string): LayerEditCommand;
212
+ /** The verbs of Boolean operations, which combine the shapes of layers into one path. */
213
+ declare const BOOLEAN_VERBS: readonly ["union", "subtract", "intersect", "exclude"];
214
+ type BooleanVerb = (typeof BOOLEAN_VERBS)[number];
215
+ /** The layers to edit in: each root and the layers inside it. */
216
+ export interface LayerEditScope extends LayerSource {
217
+ readonly roots: readonly string[];
218
+ /** The scope as a message names it, as `the document` or `#card`. */
219
+ readonly shown: string;
220
+ /** The document's components, for matchers, sets and new layers that name them, and for the instances in the scope. */
221
+ readonly components?: LayerSyntaxComponents;
222
+ /** The document's variables, for `var('name')` in sets and new layers, and to keep or drop the bindings a set changes. */
223
+ readonly variables?: LayerSyntaxVariables;
224
+ /**
225
+ * The component the roots are inside, when they are below its root, so that a slot frame's name is read in its own
226
+ * component as `printLayerSource`'s `insideComponent` reads it.
227
+ */
228
+ readonly insideComponent?: LayerSyntaxComponent;
229
+ }
230
+ /**
231
+ * A `node.build` an `add` or `replace` sends: new layers in the default spelling, which the editor reads with the document.
232
+ * A set of `slots:{Name:( ... )}` on an instance sends one with `slot`, the instance and the slot property by their ids,
233
+ * and `emptySlot`: the editor empties the slot (giving it a host when it has none) and builds the layers in its host.
234
+ */
235
+ export type LayerEditBuild = {
236
+ readonly type: "node.build";
237
+ readonly parentId: NodeId;
238
+ readonly index: number;
239
+ readonly source: string;
240
+ readonly slot?: {
241
+ readonly instanceId: NodeId;
242
+ readonly propertyId: string;
243
+ readonly path?: readonly string[];
244
+ };
245
+ readonly emptySlot?: true;
246
+ };
247
+ /** A `component.convert` a `convert` sends: the frame becomes a component's root, and the editor puts an instance in its place. */
248
+ export type LayerEditConvert = {
249
+ readonly type: "component.convert";
250
+ readonly nodeId: NodeId;
251
+ readonly name?: string;
252
+ /** Copies of the frame that become instances of the new component in their places. */
253
+ readonly replace?: readonly NodeId[];
254
+ };
255
+ /**
256
+ * A `component.set-properties` a `prop` sends: every property the component is to have, in order; the editor writes them
257
+ * over the component's own and keeps the rest of its definition.
258
+ */
259
+ export type LayerEditProperties = {
260
+ readonly type: "component.set-properties";
261
+ readonly componentId: string;
262
+ readonly properties: readonly ComponentPropertyDefinition[];
263
+ /** The component's new validity expression, or null to remove it; left out, the expression stays. @since 0.35.0 */
264
+ readonly validity?: string | null;
265
+ };
266
+ /** A component a `prop` changed: its root, and its call as `read components` prints it once changed. */
267
+ export interface LayerEditPropsChange {
268
+ readonly rootId: NodeId;
269
+ readonly call: string;
270
+ }
271
+ /**
272
+ * A `node.outlineStroke` an `outline` sends: the editor turns the strokes of the layers into filled paths, as its Outline
273
+ * stroke command does. It is the first operation of the edit, as the editor reads the layers before the rest.
274
+ */
275
+ export type LayerEditOutline = {
276
+ readonly type: "node.outlineStroke";
277
+ readonly ids: readonly NodeId[];
278
+ };
279
+ /**
280
+ * A `node.boolean` a `union`, `subtract`, `intersect` or `exclude` sends: the editor combines the shapes of the layers into
281
+ * one path in the first layer's place. It is the first operation of the edit, as the editor reads the layers before the rest.
282
+ */
283
+ export type LayerEditBoolean = {
284
+ readonly type: "node.boolean";
285
+ readonly ids: readonly NodeId[];
286
+ readonly op: BooleanVerb;
287
+ };
288
+ /** What an edit changes: the operations, in order, and the layers they change. */
289
+ export interface LayerEditPlan {
290
+ /** The model's operations, and a `node.build` for the new layers of each `add` and `replace`, to apply as one change. */
291
+ readonly operations: readonly (DocumentOperation | LayerEditBuild | LayerEditConvert | LayerEditProperties | LayerEditOutline | LayerEditBoolean)[];
292
+ /** Each component whose props a `prop` changes, in order, once. */
293
+ readonly props: readonly LayerEditPropsChange[];
294
+ /** The layers whose fields a `set` changes, in order. */
295
+ readonly changed: readonly NodeId[];
296
+ /** The layers a `set` matched whose fields it left as they were, in order: they already held what it wrote. */
297
+ readonly unchanged: readonly NodeId[];
298
+ /** The layers a `move` moves, in order. */
299
+ readonly moved: readonly NodeId[];
300
+ /** The layers a `remove` or `replace` removes, in order, without the layers inside them. */
301
+ readonly removed: readonly NodeId[];
302
+ /** Every layer whose fields or whose list of layers inside it the edit changes: the frame to hold holds them all. */
303
+ readonly touched: readonly NodeId[];
304
+ /**
305
+ * The layers outside the scope that connector ends the edit attaches attach to: a host checks that each exists, and
306
+ * refuses the edit naming the ones that do not (`connectorTargetRefusal`), before it applies it.
307
+ */
308
+ readonly attachedTo: readonly string[];
309
+ /** For each `node.build` among the operations, in order, where its source's calls and arguments were in the text as written (`writtenPlaces`). */
310
+ readonly buildPlaces: readonly (readonly WrittenPlace[])[];
311
+ /**
312
+ * The connector ends the edit attaches to layers outside the scope, for a host to check against each layer it reads
313
+ * (`connectorAttachmentRefusal`) before it applies the edit. Ends attached to layers in the scope are checked already.
314
+ */
315
+ readonly attachments: readonly ConnectorAttachment[];
316
+ }
317
+ /**
318
+ * The operations of edit rules in a scope, separated by `;`, `,` or line breaks:
319
+ * - `set <layer> { k:v, -k }` writes fields: each write goes through the writer of its short argument, or is merged
320
+ * into the model field of that name as `node.patch` merges; what is not written is kept, and `-key` removes.
321
+ * - `add <parent> [at:<index>] [<layers>]`, `add before:<layer> [<layers>]` and `add after:<layer> [<layers>]` put new
322
+ * layers inside a layer (on top without at:) or next to one, as a `node.build` the editor reads.
323
+ * - `move <layer> before:<layer>`, `after:<layer>`, `in:<parent> [at:<index>]` or `at:<index>` is a `node.move`.
324
+ * - `remove <layer>` is a `node.remove`; `replace <layer> [<layers>]` a `node.remove` and a `node.build` in its place.
325
+ * - `outline <layer>` (or `outline all <layer>`) is a `node.outlineStroke` of the layers, which must come before every other
326
+ * rule (outline rules one after another make one); later rules cannot match the layers or the layers inside them.
327
+ * - `union #a #b ...` (or `subtract`, `intersect`, `exclude`) is a `node.boolean` of the layers, which must be the first rule
328
+ * and the only Boolean one; later rules cannot match the layers.
329
+ * - `convert <frame> to component(name:'<name>') [replace #<copy> ...]` is a `component.convert`: the frame becomes a
330
+ * component's root and the editor puts an instance of it in its place, and in the place of each copy; later rules of the
331
+ * same edit cannot match the frame, the copies or the layers inside them. The frame may be one an earlier rule adds.
332
+ * A matcher is `#id`, or a kind of layer as the printer names it (`*` for any) with filters compared with the printed
333
+ * values (`text(size:12)`); it must match exactly one layer, or one or more after `all` (set, add, remove, replace).
334
+ * Rules apply in order to a working copy; a later rule cannot match a layer an earlier one adds. The sets between two
335
+ * rules that change layers inside layers become one `node.patch` per layer, or a `node.replace` where a field inside an
336
+ * object is removed. Throws a LayerSyntaxError for a text it cannot read, an empty or ambiguous match (listing the
337
+ * layers and the right form), a field the layer does not take and a place that cannot be.
338
+ */
339
+ export declare function planLayerEdit(text: string, scope: LayerEditScope): LayerEditPlan;
340
+ export {};