@snaptrude/plugin-core 0.0.0-bimsvg-20260928124803

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 (383) hide show
  1. package/AGENTS.md +231 -0
  2. package/CHANGELOG.md +341 -0
  3. package/CLAUDE.md +11 -0
  4. package/api-manifest.json +9120 -0
  5. package/dist/api/analysis/daylight.d.ts +603 -0
  6. package/dist/api/analysis/daylight.d.ts.map +1 -0
  7. package/dist/api/analysis/heatmaps.d.ts +658 -0
  8. package/dist/api/analysis/heatmaps.d.ts.map +1 -0
  9. package/dist/api/analysis/illuminance.d.ts +145 -0
  10. package/dist/api/analysis/illuminance.d.ts.map +1 -0
  11. package/dist/api/analysis/index.d.ts +59 -0
  12. package/dist/api/analysis/index.d.ts.map +1 -0
  13. package/dist/api/analysis/shadows.d.ts +165 -0
  14. package/dist/api/analysis/shadows.d.ts.map +1 -0
  15. package/dist/api/analysis/solar.d.ts +249 -0
  16. package/dist/api/analysis/solar.d.ts.map +1 -0
  17. package/dist/api/analysis/sunlightHours.d.ts +208 -0
  18. package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
  19. package/dist/api/analysis/sunpath.d.ts +80 -0
  20. package/dist/api/analysis/sunpath.d.ts.map +1 -0
  21. package/dist/api/analysis/weather.d.ts +193 -0
  22. package/dist/api/analysis/weather.d.ts.map +1 -0
  23. package/dist/api/core/buildings.d.ts +427 -0
  24. package/dist/api/core/buildings.d.ts.map +1 -0
  25. package/dist/api/core/camera/index.d.ts +261 -0
  26. package/dist/api/core/camera/index.d.ts.map +1 -0
  27. package/dist/api/core/comment/index.d.ts +333 -0
  28. package/dist/api/core/comment/index.d.ts.map +1 -0
  29. package/dist/api/core/geom/create/index.d.ts +1073 -0
  30. package/dist/api/core/geom/create/index.d.ts.map +1 -0
  31. package/dist/api/core/geom/delete/index.d.ts +78 -0
  32. package/dist/api/core/geom/delete/index.d.ts.map +1 -0
  33. package/dist/api/core/geom/index.d.ts +33 -0
  34. package/dist/api/core/geom/index.d.ts.map +1 -0
  35. package/dist/api/core/geom/query/arc.d.ts +169 -0
  36. package/dist/api/core/geom/query/arc.d.ts.map +1 -0
  37. package/dist/api/core/geom/query/brep.d.ts +514 -0
  38. package/dist/api/core/geom/query/brep.d.ts.map +1 -0
  39. package/dist/api/core/geom/query/circle.d.ts +378 -0
  40. package/dist/api/core/geom/query/circle.d.ts.map +1 -0
  41. package/dist/api/core/geom/query/contour.d.ts +450 -0
  42. package/dist/api/core/geom/query/contour.d.ts.map +1 -0
  43. package/dist/api/core/geom/query/curve.d.ts +918 -0
  44. package/dist/api/core/geom/query/curve.d.ts.map +1 -0
  45. package/dist/api/core/geom/query/edge.d.ts +128 -0
  46. package/dist/api/core/geom/query/edge.d.ts.map +1 -0
  47. package/dist/api/core/geom/query/face.d.ts +363 -0
  48. package/dist/api/core/geom/query/face.d.ts.map +1 -0
  49. package/dist/api/core/geom/query/halfedge.d.ts +206 -0
  50. package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
  51. package/dist/api/core/geom/query/index.d.ts +61 -0
  52. package/dist/api/core/geom/query/index.d.ts.map +1 -0
  53. package/dist/api/core/geom/query/profile.d.ts +410 -0
  54. package/dist/api/core/geom/query/profile.d.ts.map +1 -0
  55. package/dist/api/core/geom/query/vertex.d.ts +187 -0
  56. package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
  57. package/dist/api/core/geom/update/contour.d.ts +272 -0
  58. package/dist/api/core/geom/update/contour.d.ts.map +1 -0
  59. package/dist/api/core/geom/update/curve.d.ts +180 -0
  60. package/dist/api/core/geom/update/curve.d.ts.map +1 -0
  61. package/dist/api/core/geom/update/index.d.ts +27 -0
  62. package/dist/api/core/geom/update/index.d.ts.map +1 -0
  63. package/dist/api/core/geom/update/profile.d.ts +329 -0
  64. package/dist/api/core/geom/update/profile.d.ts.map +1 -0
  65. package/dist/api/core/groups.d.ts +485 -0
  66. package/dist/api/core/groups.d.ts.map +1 -0
  67. package/dist/api/core/handles/index.d.ts +210 -0
  68. package/dist/api/core/handles/index.d.ts.map +1 -0
  69. package/dist/api/core/history/index.d.ts +78 -0
  70. package/dist/api/core/history/index.d.ts.map +1 -0
  71. package/dist/api/core/index.d.ts +97 -0
  72. package/dist/api/core/index.d.ts.map +1 -0
  73. package/dist/api/core/io/export/index.d.ts +134 -0
  74. package/dist/api/core/io/export/index.d.ts.map +1 -0
  75. package/dist/api/core/io/import/index.d.ts +455 -0
  76. package/dist/api/core/io/import/index.d.ts.map +1 -0
  77. package/dist/api/core/io/index.d.ts +40 -0
  78. package/dist/api/core/io/index.d.ts.map +1 -0
  79. package/dist/api/core/io/job/index.d.ts +139 -0
  80. package/dist/api/core/io/job/index.d.ts.map +1 -0
  81. package/dist/api/core/io/query/index.d.ts +74 -0
  82. package/dist/api/core/io/query/index.d.ts.map +1 -0
  83. package/dist/api/core/io/terrain/index.d.ts +341 -0
  84. package/dist/api/core/io/terrain/index.d.ts.map +1 -0
  85. package/dist/api/core/io/underlay/index.d.ts +805 -0
  86. package/dist/api/core/io/underlay/index.d.ts.map +1 -0
  87. package/dist/api/core/layers.d.ts +402 -0
  88. package/dist/api/core/layers.d.ts.map +1 -0
  89. package/dist/api/core/math/index.d.ts +18 -0
  90. package/dist/api/core/math/index.d.ts.map +1 -0
  91. package/dist/api/core/math/quat.d.ts +170 -0
  92. package/dist/api/core/math/quat.d.ts.map +1 -0
  93. package/dist/api/core/math/vec3.d.ts +174 -0
  94. package/dist/api/core/math/vec3.d.ts.map +1 -0
  95. package/dist/api/core/mode/index.d.ts +111 -0
  96. package/dist/api/core/mode/index.d.ts.map +1 -0
  97. package/dist/api/core/project/index.d.ts +466 -0
  98. package/dist/api/core/project/index.d.ts.map +1 -0
  99. package/dist/api/core/proposals/index.d.ts +531 -0
  100. package/dist/api/core/proposals/index.d.ts.map +1 -0
  101. package/dist/api/core/storeys/index.d.ts +265 -0
  102. package/dist/api/core/storeys/index.d.ts.map +1 -0
  103. package/dist/api/core/tags.d.ts +860 -0
  104. package/dist/api/core/tags.d.ts.map +1 -0
  105. package/dist/api/core/units/index.d.ts +175 -0
  106. package/dist/api/core/units/index.d.ts.map +1 -0
  107. package/dist/api/core/user.d.ts +44 -0
  108. package/dist/api/core/user.d.ts.map +1 -0
  109. package/dist/api/core/zoom/index.d.ts +49 -0
  110. package/dist/api/core/zoom/index.d.ts.map +1 -0
  111. package/dist/api/design/boolean/index.d.ts +168 -0
  112. package/dist/api/design/boolean/index.d.ts.map +1 -0
  113. package/dist/api/design/create/bulk-items.d.ts +185 -0
  114. package/dist/api/design/create/bulk-items.d.ts.map +1 -0
  115. package/dist/api/design/create/grids.d.ts +132 -0
  116. package/dist/api/design/create/grids.d.ts.map +1 -0
  117. package/dist/api/design/create/index.d.ts +1747 -0
  118. package/dist/api/design/create/index.d.ts.map +1 -0
  119. package/dist/api/design/create/opening-fields.d.ts +37 -0
  120. package/dist/api/design/create/opening-fields.d.ts.map +1 -0
  121. package/dist/api/design/delete/index.d.ts +70 -0
  122. package/dist/api/design/delete/index.d.ts.map +1 -0
  123. package/dist/api/design/dimensions.d.ts +427 -0
  124. package/dist/api/design/dimensions.d.ts.map +1 -0
  125. package/dist/api/design/doors/index.d.ts +470 -0
  126. package/dist/api/design/doors/index.d.ts.map +1 -0
  127. package/dist/api/design/edit/index.d.ts +49 -0
  128. package/dist/api/design/edit/index.d.ts.map +1 -0
  129. package/dist/api/design/erase/index.d.ts +160 -0
  130. package/dist/api/design/erase/index.d.ts.map +1 -0
  131. package/dist/api/design/family.d.ts +611 -0
  132. package/dist/api/design/family.d.ts.map +1 -0
  133. package/dist/api/design/furniture/index.d.ts +296 -0
  134. package/dist/api/design/furniture/index.d.ts.map +1 -0
  135. package/dist/api/design/grids.d.ts +237 -0
  136. package/dist/api/design/grids.d.ts.map +1 -0
  137. package/dist/api/design/index.d.ts +260 -0
  138. package/dist/api/design/index.d.ts.map +1 -0
  139. package/dist/api/design/lock.d.ts +67 -0
  140. package/dist/api/design/lock.d.ts.map +1 -0
  141. package/dist/api/design/materials/index.d.ts +551 -0
  142. package/dist/api/design/materials/index.d.ts.map +1 -0
  143. package/dist/api/design/query/geometry/index.d.ts +252 -0
  144. package/dist/api/design/query/geometry/index.d.ts.map +1 -0
  145. package/dist/api/design/query/grids.d.ts +287 -0
  146. package/dist/api/design/query/grids.d.ts.map +1 -0
  147. package/dist/api/design/query/index.d.ts +1318 -0
  148. package/dist/api/design/query/index.d.ts.map +1 -0
  149. package/dist/api/design/query/referenceLines.d.ts +45 -0
  150. package/dist/api/design/query/referenceLines.d.ts.map +1 -0
  151. package/dist/api/design/query/spaces.d.ts +394 -0
  152. package/dist/api/design/query/spaces.d.ts.map +1 -0
  153. package/dist/api/design/selection/index.d.ts +282 -0
  154. package/dist/api/design/selection/index.d.ts.map +1 -0
  155. package/dist/api/design/shared.d.ts +38 -0
  156. package/dist/api/design/shared.d.ts.map +1 -0
  157. package/dist/api/design/transform/index.d.ts +249 -0
  158. package/dist/api/design/transform/index.d.ts.map +1 -0
  159. package/dist/api/design/types/index.d.ts +181 -0
  160. package/dist/api/design/types/index.d.ts.map +1 -0
  161. package/dist/api/design/update/index.d.ts +803 -0
  162. package/dist/api/design/update/index.d.ts.map +1 -0
  163. package/dist/api/design/visibility.d.ts +126 -0
  164. package/dist/api/design/visibility.d.ts.map +1 -0
  165. package/dist/api/design/windows/index.d.ts +300 -0
  166. package/dist/api/design/windows/index.d.ts.map +1 -0
  167. package/dist/api/entity/buildableEnvelope.d.ts +265 -0
  168. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
  169. package/dist/api/entity/department.d.ts +1 -0
  170. package/dist/api/entity/department.d.ts.map +1 -0
  171. package/dist/api/entity/index.d.ts +28 -0
  172. package/dist/api/entity/index.d.ts.map +1 -0
  173. package/dist/api/entity/referenceLine.d.ts +210 -0
  174. package/dist/api/entity/referenceLine.d.ts.map +1 -0
  175. package/dist/api/entity/space.d.ts +846 -0
  176. package/dist/api/entity/space.d.ts.map +1 -0
  177. package/dist/api/entity/story.d.ts +476 -0
  178. package/dist/api/entity/story.d.ts.map +1 -0
  179. package/dist/api/index.d.ts +45 -0
  180. package/dist/api/index.d.ts.map +1 -0
  181. package/dist/api/presentation/aiInspiration.d.ts +2400 -0
  182. package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
  183. package/dist/api/presentation/annotate.d.ts +483 -0
  184. package/dist/api/presentation/annotate.d.ts.map +1 -0
  185. package/dist/api/presentation/diagrams.d.ts +184 -0
  186. package/dist/api/presentation/diagrams.d.ts.map +1 -0
  187. package/dist/api/presentation/drawings.d.ts +2900 -0
  188. package/dist/api/presentation/drawings.d.ts.map +1 -0
  189. package/dist/api/presentation/export.d.ts +126 -0
  190. package/dist/api/presentation/export.d.ts.map +1 -0
  191. package/dist/api/presentation/import.d.ts +164 -0
  192. package/dist/api/presentation/import.d.ts.map +1 -0
  193. package/dist/api/presentation/index.d.ts +114 -0
  194. package/dist/api/presentation/index.d.ts.map +1 -0
  195. package/dist/api/presentation/placedViews.d.ts +1232 -0
  196. package/dist/api/presentation/placedViews.d.ts.map +1 -0
  197. package/dist/api/presentation/shapes.d.ts +481 -0
  198. package/dist/api/presentation/shapes.d.ts.map +1 -0
  199. package/dist/api/presentation/sheets.d.ts +643 -0
  200. package/dist/api/presentation/sheets.d.ts.map +1 -0
  201. package/dist/api/presentation/slideshow.d.ts +125 -0
  202. package/dist/api/presentation/slideshow.d.ts.map +1 -0
  203. package/dist/api/presentation/tables.d.ts +81 -0
  204. package/dist/api/presentation/tables.d.ts.map +1 -0
  205. package/dist/api/presentation/viewPresets.d.ts +70 -0
  206. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  207. package/dist/api/presentation/views.d.ts +741 -0
  208. package/dist/api/presentation/views.d.ts.map +1 -0
  209. package/dist/api/program/adjacency.d.ts +155 -0
  210. package/dist/api/program/adjacency.d.ts.map +1 -0
  211. package/dist/api/program/areas.d.ts +450 -0
  212. package/dist/api/program/areas.d.ts.map +1 -0
  213. package/dist/api/program/classification.d.ts +135 -0
  214. package/dist/api/program/classification.d.ts.map +1 -0
  215. package/dist/api/program/cores.d.ts +78 -0
  216. package/dist/api/program/cores.d.ts.map +1 -0
  217. package/dist/api/program/departments.d.ts +487 -0
  218. package/dist/api/program/departments.d.ts.map +1 -0
  219. package/dist/api/program/index.d.ts +71 -0
  220. package/dist/api/program/index.d.ts.map +1 -0
  221. package/dist/api/program/labels.d.ts +355 -0
  222. package/dist/api/program/labels.d.ts.map +1 -0
  223. package/dist/api/program/layout.d.ts +398 -0
  224. package/dist/api/program/layout.d.ts.map +1 -0
  225. package/dist/api/program/metadata.d.ts +328 -0
  226. package/dist/api/program/metadata.d.ts.map +1 -0
  227. package/dist/api/program/metrics.d.ts +108 -0
  228. package/dist/api/program/metrics.d.ts.map +1 -0
  229. package/dist/api/program/site.d.ts +823 -0
  230. package/dist/api/program/site.d.ts.map +1 -0
  231. package/dist/api/program/spreadsheet.d.ts +2628 -0
  232. package/dist/api/program/spreadsheet.d.ts.map +1 -0
  233. package/dist/api/workspace/index.d.ts +552 -0
  234. package/dist/api/workspace/index.d.ts.map +1 -0
  235. package/dist/errors/codes.d.ts +34 -0
  236. package/dist/errors/codes.d.ts.map +1 -0
  237. package/dist/errors/envelope.d.ts +56 -0
  238. package/dist/errors/envelope.d.ts.map +1 -0
  239. package/dist/errors/index.d.ts +6 -0
  240. package/dist/errors/index.d.ts.map +1 -0
  241. package/dist/errors/plugin-error.d.ts +69 -0
  242. package/dist/errors/plugin-error.d.ts.map +1 -0
  243. package/dist/handles.d.ts +229 -0
  244. package/dist/handles.d.ts.map +1 -0
  245. package/dist/host-utils.d.ts +47 -0
  246. package/dist/host-utils.d.ts.map +1 -0
  247. package/dist/index.cjs +8836 -0
  248. package/dist/index.cjs.map +1 -0
  249. package/dist/index.d.ts +6 -0
  250. package/dist/index.d.ts.map +1 -0
  251. package/dist/index.js +7568 -0
  252. package/dist/index.js.map +1 -0
  253. package/dist/types.d.ts +16 -0
  254. package/dist/types.d.ts.map +1 -0
  255. package/package.json +41 -0
  256. package/scripts/generate-manifest.mjs +238 -0
  257. package/scripts/generate-manifest.test.mjs +292 -0
  258. package/src/api/analysis/daylight.ts +470 -0
  259. package/src/api/analysis/heatmaps.ts +683 -0
  260. package/src/api/analysis/illuminance.ts +155 -0
  261. package/src/api/analysis/index.ts +61 -0
  262. package/src/api/analysis/shadows.ts +183 -0
  263. package/src/api/analysis/solar.ts +237 -0
  264. package/src/api/analysis/sunlightHours.ts +211 -0
  265. package/src/api/analysis/sunpath.ts +83 -0
  266. package/src/api/analysis/weather.ts +179 -0
  267. package/src/api/core/buildings.ts +485 -0
  268. package/src/api/core/camera/index.ts +268 -0
  269. package/src/api/core/comment/index.ts +376 -0
  270. package/src/api/core/geom/create/index.ts +1204 -0
  271. package/src/api/core/geom/delete/index.ts +84 -0
  272. package/src/api/core/geom/index.ts +35 -0
  273. package/src/api/core/geom/query/arc.ts +169 -0
  274. package/src/api/core/geom/query/brep.ts +563 -0
  275. package/src/api/core/geom/query/circle.ts +404 -0
  276. package/src/api/core/geom/query/contour.ts +540 -0
  277. package/src/api/core/geom/query/curve.ts +1078 -0
  278. package/src/api/core/geom/query/edge.ts +130 -0
  279. package/src/api/core/geom/query/face.ts +403 -0
  280. package/src/api/core/geom/query/halfedge.ts +210 -0
  281. package/src/api/core/geom/query/index.ts +63 -0
  282. package/src/api/core/geom/query/profile.ts +473 -0
  283. package/src/api/core/geom/query/vertex.ts +205 -0
  284. package/src/api/core/geom/update/contour.ts +315 -0
  285. package/src/api/core/geom/update/curve.ts +209 -0
  286. package/src/api/core/geom/update/index.ts +29 -0
  287. package/src/api/core/geom/update/profile.ts +377 -0
  288. package/src/api/core/groups.ts +521 -0
  289. package/src/api/core/handles/index.ts +233 -0
  290. package/src/api/core/history/index.ts +84 -0
  291. package/src/api/core/index.ts +99 -0
  292. package/src/api/core/io/export/index.ts +126 -0
  293. package/src/api/core/io/import/index.ts +504 -0
  294. package/src/api/core/io/index.ts +42 -0
  295. package/src/api/core/io/job/index.ts +140 -0
  296. package/src/api/core/io/query/index.ts +71 -0
  297. package/src/api/core/io/terrain/index.ts +360 -0
  298. package/src/api/core/io/underlay/index.ts +705 -0
  299. package/src/api/core/layers.ts +333 -0
  300. package/src/api/core/math/index.ts +20 -0
  301. package/src/api/core/math/quat.ts +172 -0
  302. package/src/api/core/math/vec3.ts +179 -0
  303. package/src/api/core/mode/index.ts +108 -0
  304. package/src/api/core/project/index.ts +479 -0
  305. package/src/api/core/proposals/index.ts +569 -0
  306. package/src/api/core/storeys/index.ts +294 -0
  307. package/src/api/core/tags.ts +911 -0
  308. package/src/api/core/units/index.ts +164 -0
  309. package/src/api/core/user.ts +46 -0
  310. package/src/api/core/zoom/index.ts +51 -0
  311. package/src/api/design/boolean/index.ts +179 -0
  312. package/src/api/design/create/bulk-items.ts +186 -0
  313. package/src/api/design/create/grids.ts +137 -0
  314. package/src/api/design/create/index.ts +1954 -0
  315. package/src/api/design/create/opening-fields.ts +37 -0
  316. package/src/api/design/delete/index.ts +74 -0
  317. package/src/api/design/dimensions.ts +453 -0
  318. package/src/api/design/doors/index.ts +500 -0
  319. package/src/api/design/edit/index.ts +54 -0
  320. package/src/api/design/erase/index.ts +151 -0
  321. package/src/api/design/family.ts +646 -0
  322. package/src/api/design/furniture/index.ts +319 -0
  323. package/src/api/design/grids.ts +237 -0
  324. package/src/api/design/index.ts +274 -0
  325. package/src/api/design/lock.ts +69 -0
  326. package/src/api/design/materials/index.ts +608 -0
  327. package/src/api/design/query/geometry/index.ts +288 -0
  328. package/src/api/design/query/grids.ts +197 -0
  329. package/src/api/design/query/index.ts +1176 -0
  330. package/src/api/design/query/referenceLines.ts +52 -0
  331. package/src/api/design/query/spaces.ts +275 -0
  332. package/src/api/design/selection/index.ts +273 -0
  333. package/src/api/design/shared.ts +40 -0
  334. package/src/api/design/transform/index.ts +254 -0
  335. package/src/api/design/types/index.ts +156 -0
  336. package/src/api/design/update/index.ts +798 -0
  337. package/src/api/design/visibility.ts +143 -0
  338. package/src/api/design/windows/index.ts +333 -0
  339. package/src/api/entity/buildableEnvelope.ts +322 -0
  340. package/src/api/entity/department.ts +0 -0
  341. package/src/api/entity/index.ts +30 -0
  342. package/src/api/entity/referenceLine.ts +235 -0
  343. package/src/api/entity/space.ts +612 -0
  344. package/src/api/entity/story.ts +517 -0
  345. package/src/api/index.ts +47 -0
  346. package/src/api/presentation/aiInspiration.ts +1116 -0
  347. package/src/api/presentation/annotate.ts +417 -0
  348. package/src/api/presentation/diagrams.ts +194 -0
  349. package/src/api/presentation/drawings.ts +529 -0
  350. package/src/api/presentation/export.ts +133 -0
  351. package/src/api/presentation/import.ts +159 -0
  352. package/src/api/presentation/index.ts +129 -0
  353. package/src/api/presentation/placedViews.ts +1203 -0
  354. package/src/api/presentation/shapes.ts +274 -0
  355. package/src/api/presentation/sheets.ts +616 -0
  356. package/src/api/presentation/slideshow.ts +134 -0
  357. package/src/api/presentation/tables.ts +84 -0
  358. package/src/api/presentation/viewPresets.ts +83 -0
  359. package/src/api/presentation/views.ts +698 -0
  360. package/src/api/program/adjacency.ts +164 -0
  361. package/src/api/program/areas.ts +408 -0
  362. package/src/api/program/classification.ts +138 -0
  363. package/src/api/program/cores.ts +83 -0
  364. package/src/api/program/departments.ts +517 -0
  365. package/src/api/program/index.ts +73 -0
  366. package/src/api/program/labels.ts +332 -0
  367. package/src/api/program/layout.ts +422 -0
  368. package/src/api/program/metadata.ts +364 -0
  369. package/src/api/program/metrics.ts +120 -0
  370. package/src/api/program/site.ts +748 -0
  371. package/src/api/program/spreadsheet.ts +2698 -0
  372. package/src/api/workspace/index.ts +612 -0
  373. package/src/errors/codes.ts +136 -0
  374. package/src/errors/envelope.ts +75 -0
  375. package/src/errors/index.ts +21 -0
  376. package/src/errors/plugin-error.ts +134 -0
  377. package/src/handles.ts +282 -0
  378. package/src/host-utils.ts +68 -0
  379. package/src/index.ts +5 -0
  380. package/src/types.ts +16 -0
  381. package/test/errors.test.mjs +184 -0
  382. package/tsconfig.json +22 -0
  383. package/tsup.config.ts +12 -0
@@ -0,0 +1,233 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ // Type-only: src/handles.ts type-only-imports ArenaKind from this file, so the
4
+ // cycle stays purely type-level and is erased at emit.
5
+ import type { AnyArenaHandle } from "../../../handles"
6
+ import { Handle } from "../../../handles"
7
+
8
+ /**
9
+ * The 12 registry-arena handle kinds — the releasable families. Entity-style
10
+ * handles (component / material / underlay / terrain / importJob / comment) are
11
+ * raw engine ids with no arena entry and therefore no lifecycle: passing one to
12
+ * `release` is a silent no-op like any other unknown id.
13
+ */
14
+ export const ArenaKind = z.enum([
15
+ "vec3",
16
+ "quat",
17
+ "line",
18
+ "arc",
19
+ "circle",
20
+ "profile",
21
+ "contour",
22
+ "brep",
23
+ "face",
24
+ "edge",
25
+ "halfedge",
26
+ "vertex",
27
+ ])
28
+ export type ArenaKind = z.infer<typeof ArenaKind>
29
+
30
+ /** Max handles accepted by a single `release` / `endScope(retain)` call. */
31
+ export const RELEASE_BATCH_MAX = 10_000
32
+
33
+ /**
34
+ * An opaque token identifying a handle scope opened by
35
+ * {@linkcode PluginCoreHandlesApi.beginScope}. It is NOT an arena handle —
36
+ * it pins no memory, and `release(token)` is a silent no-op; only
37
+ * {@linkcode PluginCoreHandlesApi.endScope} consumes it.
38
+ */
39
+ export type ScopeToken = string
40
+
41
+ /**
42
+ * Handle lifecycle — free host-side handle registry entries the plugin no
43
+ * longer needs, individually ({@linkcode release}), by kind
44
+ * ({@linkcode releaseAll}), or as a mint-recording region
45
+ * ({@linkcode beginScope} / {@linkcode endScope}).
46
+ *
47
+ * Releasing is a handle-lifecycle operation only: it frees the registry entry
48
+ * (host memory + quota room) and makes the handle unresolvable. It never
49
+ * deletes engine-side geometry or scene entities.
50
+ *
51
+ * Accessed via `snaptrude.core.handles`.
52
+ */
53
+ export abstract class PluginCoreHandlesApi {
54
+ constructor() {}
55
+
56
+ /**
57
+ * Free arena handles in bulk. Unknown, foreign, or already-released ids are
58
+ * silent no-ops — there is no per-id result and no count, so responses can
59
+ * never be used as an existence oracle.
60
+ *
61
+ * @param handles The handles to release (max {@linkcode RELEASE_BATCH_MAX} per call)
62
+ * @returns Nothing
63
+ *
64
+ * # Example
65
+ * ```ts
66
+ * const faces = await snaptrude.core.geom.query.brep.listFaces(brep)
67
+ * // ... read what you need ...
68
+ * await snaptrude.core.handles.release(faces)
69
+ * ```
70
+ */
71
+ public abstract release(handles: ReadonlyArray<AnyArenaHandle>): PluginApiReturn<void>
72
+
73
+ /**
74
+ * Free every live arena handle of one kind, or ALL arena handles when the
75
+ * kind is omitted. Useful at batch boundaries — e.g. a poll loop that mints
76
+ * a fresh footprint contour per tick.
77
+ *
78
+ * @param kind Optional arena kind to restrict the sweep to
79
+ * @returns Nothing
80
+ *
81
+ * # Example
82
+ * ```ts
83
+ * const footprint = await snaptrude.design.query.spaces.getFootprint(space)
84
+ * // ... measure ...
85
+ * await snaptrude.core.handles.releaseAll("contour")
86
+ * ```
87
+ */
88
+ public abstract releaseAll(kind?: ArenaKind): PluginApiReturn<void>
89
+
90
+ /**
91
+ * Open a mint-recording scope: every arena handle MINTED after this call
92
+ * (fresh mints only — identity-deduped re-registrations of pre-existing
93
+ * objects are not captured) is freed when the matching
94
+ * {@linkcode endScope} runs. Scopes nest, up to 64 deep — always pair
95
+ * begin/end in try/finally.
96
+ *
97
+ * @returns The scope token to pass to {@linkcode endScope}
98
+ *
99
+ * # Example
100
+ * ```ts
101
+ * for (const space of spaces) {
102
+ * const scope = await snaptrude.core.handles.beginScope()
103
+ * try {
104
+ * const footprint = await snaptrude.design.query.spaces.getFootprint(space)
105
+ * const area = await snaptrude.core.geom.query.contour.getArea(footprint)
106
+ * } finally {
107
+ * await snaptrude.core.handles.endScope(scope) // footprint (and intermediates) freed
108
+ * }
109
+ * }
110
+ * ```
111
+ */
112
+ public abstract beginScope(): PluginApiReturn<ScopeToken>
113
+
114
+ /**
115
+ * Close a scope by its token and free every handle it recorded, except those
116
+ * listed in `retain`. Retained handles are promoted to the enclosing scope
117
+ * (if any), so nesting composes like block scopes. Closing is
118
+ * token-addressed: an out-of-order close (interleaved async tasks) frees
119
+ * only that scope's mints and leaves other open scopes intact. Always pair
120
+ * begin/end in try/finally so a thrown body cannot leak the scope.
121
+ *
122
+ * @param scope The token returned by the matching {@linkcode beginScope}
123
+ * @param retain Handles minted inside the scope that must survive it
124
+ * @returns Nothing
125
+ *
126
+ * # Example
127
+ * ```ts
128
+ * const scope = await snaptrude.core.handles.beginScope()
129
+ * const outline = await snaptrude.design.query.spaces.getFootprint(space)
130
+ * const outer = await snaptrude.core.geom.query.contour.getOuterProfile(outline)
131
+ * await snaptrude.core.handles.endScope(scope, [outer]) // outline freed, outer survives
132
+ * ```
133
+ */
134
+ public abstract endScope(
135
+ scope: ScopeToken,
136
+ retain?: ReadonlyArray<AnyArenaHandle>
137
+ ): PluginApiReturn<void>
138
+
139
+ /**
140
+ * Live handle-registry statistics for the calling plugin, plus the host
141
+ * page's JS heap usage (when the browser exposes it). Diagnostic surface for
142
+ * verifying that releases actually shrink host memory.
143
+ *
144
+ * @returns Arena entry counts, open scope depth, and host heap bytes
145
+ *
146
+ * # Example
147
+ * ```ts
148
+ * const before = await snaptrude.core.handles.stats()
149
+ * await snaptrude.core.handles.releaseAll("vec3")
150
+ * const after = await snaptrude.core.handles.stats()
151
+ * console.log(`freed ${before.values - after.values} value entries`)
152
+ * ```
153
+ */
154
+ public abstract stats(): PluginApiReturn<PluginHandlesStatsResult>
155
+ }
156
+
157
+ /**
158
+ * Wire-normalize one handle argument: a raw id string passes through; a live
159
+ * `Handle` instance (direct host callers — console harness, host-internal) or a
160
+ * structured-clone-stripped `{id}` / tagged `{__h}` shape collapses to its id.
161
+ * Deliberately shape-lax beyond that (non-empty string) — a malformed id is
162
+ * just an id that resolves nowhere (anti-oracle).
163
+ */
164
+ const handleIdWire = z.preprocess((v) => {
165
+ if (typeof v === "string") return v
166
+ if (v instanceof Handle) return v.id
167
+ if (v && typeof v === "object") {
168
+ const o = v as Record<string, unknown>
169
+ if (typeof o.__h === "string") return o.__h
170
+ if (typeof o.id === "string") return o.id
171
+ }
172
+ return v
173
+ }, z.string().min(1))
174
+
175
+ /**
176
+ * Arguments for {@linkcode PluginCoreHandlesApi.release}.
177
+ *
178
+ * | Property | Type | Description |
179
+ * |---|---|---|
180
+ * | `handles` | `string[]` | Handles to release (≤ {@linkcode RELEASE_BATCH_MAX}) |
181
+ */
182
+ export const PluginHandlesReleaseArgs = z.object({
183
+ handles: z.array(handleIdWire).max(RELEASE_BATCH_MAX),
184
+ })
185
+ export type PluginHandlesReleaseArgs = z.infer<typeof PluginHandlesReleaseArgs>
186
+
187
+ /**
188
+ * Arguments for {@linkcode PluginCoreHandlesApi.releaseAll}.
189
+ *
190
+ * | Property | Type | Description |
191
+ * |---|---|---|
192
+ * | `kind` | {@linkcode ArenaKind} (optional) | Restrict the sweep to one kind |
193
+ */
194
+ export const PluginHandlesReleaseAllArgs = z.object({
195
+ kind: ArenaKind.optional(),
196
+ })
197
+ export type PluginHandlesReleaseAllArgs = z.infer<typeof PluginHandlesReleaseAllArgs>
198
+
199
+ /**
200
+ * Arguments for {@linkcode PluginCoreHandlesApi.endScope}.
201
+ *
202
+ * | Property | Type | Description |
203
+ * |---|---|---|
204
+ * | `scope` | {@linkcode ScopeToken} | Token from the matching `beginScope` |
205
+ * | `retain` | `string[]` (optional) | Scope-minted handles that must survive |
206
+ */
207
+ export const PluginHandlesEndScopeArgs = z.object({
208
+ scope: z.string().regex(/^scope_[A-Za-z0-9_-]+$/, 'expected a "scope" token'),
209
+ retain: z.array(handleIdWire).max(RELEASE_BATCH_MAX).optional(),
210
+ })
211
+ export type PluginHandlesEndScopeArgs = z.infer<typeof PluginHandlesEndScopeArgs>
212
+
213
+ /**
214
+ * Result of {@linkcode PluginCoreHandlesApi.stats}.
215
+ *
216
+ * | Property | Type | Description |
217
+ * |---|---|---|
218
+ * | `resources` | `number` | Live resource-arena entries (profile/contour) |
219
+ * | `values` | `number` | Live value-arena entries (vec3/quat/line/arc/circle) |
220
+ * | `topology` | `number` | Live topology-arena entries (brep/face/edge/halfedge/vertex) |
221
+ * | `scopes` | `number` | Currently open handle scopes |
222
+ * | `hostHeapUsedBytes` | `number \| null` | Host page `usedJSHeapSize` (null where unsupported) |
223
+ * | `hostHeapTotalBytes` | `number \| null` | Host page `totalJSHeapSize` (null where unsupported) |
224
+ */
225
+ export const PluginHandlesStatsResult = z.object({
226
+ resources: z.number().int().nonnegative(),
227
+ values: z.number().int().nonnegative(),
228
+ topology: z.number().int().nonnegative(),
229
+ scopes: z.number().int().nonnegative(),
230
+ hostHeapUsedBytes: z.number().nullable(),
231
+ hostHeapTotalBytes: z.number().nullable(),
232
+ })
233
+ export type PluginHandlesStatsResult = z.infer<typeof PluginHandlesStatsResult>
@@ -0,0 +1,84 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+
4
+ /**
5
+ * Undo / redo of committed history entries.
6
+ *
7
+ * History steps operate on Snaptrude's command stack: {@linkcode PluginHistoryApi.undo}
8
+ * steps back over committed entries, {@linkcode PluginHistoryApi.redo} re-applies
9
+ * undone ones. Both take an optional step count (default 1) and report how many
10
+ * steps were actually applied — fewer than requested when the stack runs out.
11
+ *
12
+ * Accessed via `snaptrude.core.history`.
13
+ */
14
+ export abstract class PluginHistoryApi {
15
+ constructor() {}
16
+
17
+ /**
18
+ * Step back over committed history entries.
19
+ *
20
+ * @param steps - (Optional) The number of entries to undo (default 1).
21
+ * @returns A {@linkcode PluginHistoryStepResult} with `stepsApplied` — the
22
+ * entries actually undone (≤ `steps`; fewer if the undo stack ran out).
23
+ *
24
+ * @examplePrompt Undo my last change
25
+ * @examplePrompt Undo the last 3 actions
26
+ * @examplePrompt Revert what I just did to the model
27
+ * @examplePrompt Step back one change
28
+ * @examplePrompt Take back that last edit
29
+ *
30
+ * # Example
31
+ * ```ts
32
+ * await snaptrude.core.history.undo() // one step
33
+ * await snaptrude.core.history.undo(3) // up to three steps
34
+ * ```
35
+ */
36
+ public abstract undo(steps?: number): PluginApiReturn<PluginHistoryStepResult>
37
+
38
+ /**
39
+ * Step forward over previously undone entries. Symmetric with
40
+ * {@linkcode PluginHistoryApi.undo}.
41
+ *
42
+ * @param steps - (Optional) The number of entries to redo (default 1).
43
+ * @returns A {@linkcode PluginHistoryStepResult} with `stepsApplied` — the
44
+ * entries actually redone (≤ `steps`; fewer if the redo stack ran out).
45
+ *
46
+ * @examplePrompt Redo the change I just undid
47
+ * @examplePrompt Redo the last two undone actions
48
+ * @examplePrompt Bring back the edit I reverted
49
+ * @examplePrompt Step forward again in the history
50
+ *
51
+ * # Example
52
+ * ```ts
53
+ * await snaptrude.core.history.redo()
54
+ * await snaptrude.core.history.redo(2)
55
+ * ```
56
+ */
57
+ public abstract redo(steps?: number): PluginApiReturn<PluginHistoryStepResult>
58
+ }
59
+
60
+ /**
61
+ * Arguments for {@linkcode PluginHistoryApi.undo} / {@linkcode PluginHistoryApi.redo}.
62
+ *
63
+ * | Property | Type | Description |
64
+ * |---|---|---|
65
+ * | `steps` | `number?` | Number of history entries to step (positive integer). Defaults to 1. |
66
+ */
67
+ export const PluginHistoryStepArgs = z.object({
68
+ steps: z.number().int().positive().optional(),
69
+ })
70
+
71
+ export type PluginHistoryStepArgs = z.infer<typeof PluginHistoryStepArgs>
72
+
73
+ /**
74
+ * Result of {@linkcode PluginHistoryApi.undo} / {@linkcode PluginHistoryApi.redo}.
75
+ *
76
+ * | Property | Type | Description |
77
+ * |---|---|---|
78
+ * | `stepsApplied` | `number` | History entries actually stepped — `≤ steps`, fewer when the stack ran out. |
79
+ */
80
+ export const PluginHistoryStepResult = z.object({
81
+ stepsApplied: z.number().int().nonnegative(),
82
+ })
83
+
84
+ export type PluginHistoryStepResult = z.infer<typeof PluginHistoryStepResult>
@@ -0,0 +1,99 @@
1
+ import { PluginMathApi } from "./math"
2
+ import { PluginGeomApi } from "./geom"
3
+ import { PluginHistoryApi } from "./history"
4
+ import { PluginUnitsApi } from "./units"
5
+ import { PluginZoomApi } from "./zoom"
6
+ import { PluginProjectApi } from "./project"
7
+ import { PluginCommentApi } from "./comment"
8
+ import { PluginCoreGroupsApi } from "./groups"
9
+ import { PluginCoreBuildingsApi } from "./buildings"
10
+ import { PluginCoreLayersApi } from "./layers"
11
+ import { PluginCoreTagsApi } from "./tags"
12
+ import { PluginCoreIoApi } from "./io"
13
+ import { PluginCoreHandlesApi } from "./handles"
14
+ import { PluginCoreProposalsApi } from "./proposals"
15
+ import { PluginCameraApi } from "./camera"
16
+ import { PluginCoreStoreysApi } from "./storeys"
17
+ import { PluginCoreModeApi } from "./mode"
18
+ import { PluginUserApi } from "./user"
19
+
20
+ /**
21
+ * Core primitives and infrastructure used across the plugin API.
22
+ *
23
+ * - {@linkcode PluginCoreApi.math} — Vector and quaternion operations
24
+ * - {@linkcode PluginCoreApi.geom} — Geometry primitives (lines, arcs, curves, profiles)
25
+ * - {@linkcode PluginCoreApi.history} — Undo / redo of committed history entries
26
+ * - {@linkcode PluginCoreApi.units} — Unit-type queries and conversion
27
+ * - {@linkcode PluginCoreApi.zoom} — Camera zoom controls (extents / selection)
28
+ * - {@linkcode PluginCoreApi.camera} — Camera controls — position, standard views, 2D/3D mode
29
+ * - {@linkcode PluginCoreApi.user} — User locale — timezone & language
30
+ * - {@linkcode PluginCoreApi.project} — Project-level settings and info
31
+ * - {@linkcode PluginCoreApi.comment} — Comments: create, edit, resolve, tag, list
32
+ * - {@linkcode PluginCoreApi.groups} — Read & edit the group hierarchy
33
+ * - {@linkcode PluginCoreApi.buildings} — Read & edit buildings and their storeys
34
+ * - {@linkcode PluginCoreApi.storeys} — Create, read & edit storeys (floors)
35
+ * - {@linkcode PluginCoreApi.layers} — Read & toggle storey drawing/reference layers
36
+ * - {@linkcode PluginCoreApi.tags} — Tag catalog + assignment
37
+ * - {@linkcode PluginCoreApi.io} — Import files (image/pdf/cad/model/terrain), poll jobs, manage underlays
38
+ * - {@linkcode PluginCoreApi.handles} — Handle lifecycle: release, releaseAll, scopes
39
+ * - {@linkcode PluginCoreApi.proposals} — Design options: read, create, rename, switch, delete
40
+ */
41
+ export abstract class PluginCoreApi {
42
+ /** Vector and quaternion math utilities. See {@linkcode PluginMathApi}. */
43
+ public abstract math: PluginMathApi
44
+ /** Geometry primitives and constructors. See {@linkcode PluginGeomApi}. */
45
+ public abstract geom: PluginGeomApi
46
+ /** Undo / redo of committed history entries. See {@linkcode PluginHistoryApi}. */
47
+ public abstract history: PluginHistoryApi
48
+ /** Unit-type queries and conversion. See {@linkcode PluginUnitsApi}. */
49
+ public abstract units: PluginUnitsApi
50
+ /** Camera zoom controls. See {@linkcode PluginZoomApi}. */
51
+ public abstract zoom: PluginZoomApi
52
+ /** Camera controls — position, standard views, 2D/3D mode. See {@linkcode PluginCameraApi}. */
53
+ public abstract camera: PluginCameraApi
54
+ /** User locale — timezone & language. See {@linkcode PluginUserApi}. */
55
+ public abstract user: PluginUserApi
56
+ /** Project-level settings and info. See {@linkcode PluginProjectApi}. */
57
+ public abstract project: PluginProjectApi
58
+ /** Comments — create, edit, resolve, tag, list. See {@linkcode PluginCommentApi}. */
59
+ public abstract comment: PluginCommentApi
60
+ /** Groups — read & edit the group hierarchy. See {@linkcode PluginCoreGroupsApi}. */
61
+ public abstract groups: PluginCoreGroupsApi
62
+ /** Buildings — read & edit buildings and their storeys. See {@linkcode PluginCoreBuildingsApi}. */
63
+ public abstract buildings: PluginCoreBuildingsApi
64
+ /** Storeys — create, read & edit storeys (floors). See {@linkcode PluginCoreStoreysApi}. */
65
+ public abstract storeys: PluginCoreStoreysApi
66
+ /** Application mode — read & switch the editor's top-bar mode. See {@linkcode PluginCoreModeApi}. */
67
+ public abstract mode: PluginCoreModeApi
68
+ /** Layers — read & toggle storey drawing/reference layers. See {@linkcode PluginCoreLayersApi}. */
69
+ public abstract layers: PluginCoreLayersApi
70
+ /** Tags — tag catalog + assignment. See {@linkcode PluginCoreTagsApi}. */
71
+ public abstract tags: PluginCoreTagsApi
72
+ /** I/O — file import, import jobs, and underlay management. See {@linkcode PluginCoreIoApi}. */
73
+ public abstract io: PluginCoreIoApi
74
+ /** Handle lifecycle — release, releaseAll, and mint-recording scopes. See {@linkcode PluginCoreHandlesApi}. */
75
+ public abstract handles: PluginCoreHandlesApi
76
+ /** Proposals — design options: read, create, rename, switch, delete. See {@linkcode PluginCoreProposalsApi}. */
77
+ public abstract proposals: PluginCoreProposalsApi
78
+
79
+ constructor() {}
80
+ }
81
+
82
+ export * from "./math"
83
+ export * from "./geom"
84
+ export * from "./history"
85
+ export * from "./units"
86
+ export * from "./zoom"
87
+ export * from "./camera"
88
+ export * from "./user"
89
+ export * from "./project"
90
+ export * from "./comment"
91
+ export * from "./groups"
92
+ export * from "./buildings"
93
+ export * from "./storeys"
94
+ export * from "./mode"
95
+ export * from "./layers"
96
+ export * from "./tags"
97
+ export * from "./io"
98
+ export * from "./handles"
99
+ export * from "./proposals"
@@ -0,0 +1,126 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../../types"
3
+
4
+ /**
5
+ * Serialization format for {@link PluginCoreIoExportApi.model}.
6
+ *
7
+ * `glb` / `obj` serialize in the browser; `fbx` / `3ds` run the same server
8
+ * conversion the app's Export dialog uses and return a **zip** containing the
9
+ * converted file.
10
+ */
11
+ export const ExportModelFormat = z.enum(["glb", "obj", "fbx", "3ds"])
12
+ export type ExportModelFormat = z.infer<typeof ExportModelFormat>
13
+
14
+ /**
15
+ * What to export: the whole model (`"scene"`, default) or only the current
16
+ * selection (`"selection"`).
17
+ */
18
+ export const ExportScope = z.enum(["scene", "selection"])
19
+ export type ExportScope = z.infer<typeof ExportScope>
20
+
21
+ /**
22
+ * A serialized model file returned by {@link PluginCoreIoExportApi.model}.
23
+ *
24
+ * | Property | Type | Description |
25
+ * |---|---|---|
26
+ * | `fileName` | `string` | Suggested file name incl. extension (e.g. `"model.glb"`) |
27
+ * | `mimeType` | `string` | MIME type (`"model/gltf-binary"` for glb, `"text/plain"` for obj) |
28
+ * | `dataBase64` | `string` | The file's bytes, base64-encoded (decode to save/download) |
29
+ */
30
+ export const ExportedFile = z.object({
31
+ fileName: z.string(),
32
+ mimeType: z.string(),
33
+ dataBase64: z.string(),
34
+ })
35
+ export type ExportedFile = z.infer<typeof ExportedFile>
36
+
37
+ /**
38
+ * Model export — serialize the scene (or selection) to a downloadable 3D file.
39
+ *
40
+ * `core.io.export.model` hands you the file bytes as base64 — no download
41
+ * dialog opens; the plugin decides what to do with the result (save it, POST
42
+ * it, diff it). For a different export intent, see `presentation.export`
43
+ * (Present-mode layout sheets to PDF/PNG/JPG) and `program.spreadsheet.export`
44
+ * (the area-program / takeoff workbook). Four formats:
45
+ *
46
+ * - `"glb"` — binary glTF (`model/gltf-binary`); geometry + materials,
47
+ * serialized in the browser (nothing is uploaded).
48
+ * - `"obj"` — Wavefront OBJ text (`text/plain`); geometry only, serialized in
49
+ * the browser.
50
+ * - `"fbx"` / `"3ds"` — Autodesk FBX / 3D Studio; the scene is uploaded to the
51
+ * same `/exportmodel/` conversion service the app's Export dialog uses, and
52
+ * the call resolves once the converted artifact is fetched back — a **zip**
53
+ * (`application/zip`) containing the `.fbx`/`.3ds` file. Whole-scene only
54
+ * (`scope: "selection"` is rejected). Conversion runs on the server and is
55
+ * bounded by the per-call plugin timeout (60 s) — very large models may
56
+ * exceed it and reject with `TIMEOUT`.
57
+ *
58
+ * For the browser formats, only real model geometry is exported (walls, slabs,
59
+ * roofs, floors, doors, windows, furniture, staircases, masses, ceilings,
60
+ * mullions, beams, columns, terrain); UI helpers, hidden objects, and
61
+ * hidden-bucket objects are excluded — matching the app's GLB export. The
62
+ * server formats convert the full serialized scene (hidden-bucket objects
63
+ * excluded), exactly like the Export dialog. This is a **read**: it never
64
+ * mutates the model.
65
+ *
66
+ * > Server-backed BIM exports (RVT / IFC / DWG) are **not** exposed here — those
67
+ * > run as fire-and-forget Forge jobs that stream a browser download and return
68
+ * > no retrievable bytes. Use the app's Export menu for those.
69
+ *
70
+ * Accessed via `snaptrude.core.io.export`.
71
+ */
72
+ export abstract class PluginCoreIoExportApi {
73
+ constructor() {}
74
+
75
+ /**
76
+ * Export the model to a 3D file and return its bytes as base64.
77
+ *
78
+ * @param format - `"glb"` (binary glTF, geometry + materials), `"obj"`
79
+ * (Wavefront OBJ text, geometry only) — both serialized in the browser —
80
+ * or `"fbx"` / `"3ds"`, converted by the app's export service and returned
81
+ * as a zip containing the converted file.
82
+ * @param scope - `"scene"` (default) for the whole model, or `"selection"` for
83
+ * only the currently selected objects (browser formats only — `"fbx"`/`"3ds"`
84
+ * reject it). An empty selection yields an empty file.
85
+ * @returns an {@linkcode ExportedFile} — `{ fileName, mimeType, dataBase64 }`.
86
+ * @throws if the format is unsupported, `scope: "selection"` is combined with a
87
+ * server format, or the serialization/conversion fails.
88
+ *
89
+ * @examplePrompt Export the model as a GLB
90
+ * @examplePrompt Give me the whole scene as an OBJ file
91
+ * @examplePrompt Export just my selection to GLB
92
+ * @examplePrompt Download the model as an FBX file
93
+ * @examplePrompt Export the scene to 3DS for 3ds Max
94
+ *
95
+ * # Example
96
+ * ```ts
97
+ * const file = await snaptrude.core.io.export.model("glb")
98
+ * // decode base64 → bytes and save/download in the plugin UI
99
+ * const bytes = Uint8Array.from(atob(file.dataBase64), (c) => c.charCodeAt(0))
100
+ * const blob = new Blob([bytes], { type: file.mimeType })
101
+ * // ...offer blob for download as file.fileName
102
+ *
103
+ * // Only the current selection, as OBJ text:
104
+ * const obj = await snaptrude.core.io.export.model("obj", "selection")
105
+ * const text = atob(obj.dataBase64)
106
+ * ```
107
+ */
108
+ public abstract model(
109
+ format: ExportModelFormat,
110
+ scope?: ExportScope,
111
+ ): PluginApiReturn<ExportedFile>
112
+ }
113
+
114
+ /**
115
+ * Arguments for {@link PluginCoreIoExportApi.model}.
116
+ *
117
+ * | Property | Type | Description |
118
+ * |---|---|---|
119
+ * | `format` | {@link ExportModelFormat} | `"glb"`, `"obj"`, `"fbx"`, or `"3ds"` |
120
+ * | `scope` | {@link ExportScope} | `"scene"` (default) or `"selection"` (browser formats only) |
121
+ */
122
+ export const PluginExportModelArgs = z.object({
123
+ format: ExportModelFormat,
124
+ scope: ExportScope.optional(),
125
+ })
126
+ export type PluginExportModelArgs = z.infer<typeof PluginExportModelArgs>