nucleation 0.10.21 → 0.10.23

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 (314) hide show
  1. package/BlockPos.mjs +1 -0
  2. package/Dimensions.mjs +1 -0
  3. package/FieldRange.mjs +1 -0
  4. package/ItemScale.mjs +1 -0
  5. package/MeshBounds.mjs +1 -0
  6. package/MeshProgress.mjs +1 -0
  7. package/README.md +12 -0
  8. package/RegionBounds.mjs +1 -0
  9. package/Schematic.d.mts +32 -0
  10. package/Schematic.d.ts +32 -0
  11. package/Schematic.mjs +100 -0
  12. package/SdfBounds.mjs +1 -0
  13. package/SdfNormal.mjs +1 -0
  14. package/TextureInfo.mjs +1 -0
  15. package/diplomat-runtime.mjs +19 -14
  16. package/nucleation.wasm +0 -0
  17. package/package.json +7 -2
  18. package/renderer/AnimationEffect.d.mts +44 -0
  19. package/renderer/AnimationEffect.d.ts +44 -0
  20. package/renderer/AnimationEffect.mjs +204 -0
  21. package/renderer/Autostack.d.mts +43 -0
  22. package/renderer/Autostack.d.ts +43 -0
  23. package/renderer/Autostack.mjs +134 -0
  24. package/renderer/BlockPos.d.mts +28 -0
  25. package/renderer/BlockPos.d.ts +28 -0
  26. package/renderer/BlockPos.mjs +130 -0
  27. package/renderer/BlockState.d.mts +39 -0
  28. package/renderer/BlockState.d.ts +39 -0
  29. package/renderer/BlockState.mjs +134 -0
  30. package/renderer/Blocks.d.mts +91 -0
  31. package/renderer/Blocks.d.ts +91 -0
  32. package/renderer/Blocks.mjs +308 -0
  33. package/renderer/Brush.d.mts +99 -0
  34. package/renderer/Brush.d.ts +99 -0
  35. package/renderer/Brush.mjs +335 -0
  36. package/renderer/BuildAnimation.d.mts +179 -0
  37. package/renderer/BuildAnimation.d.ts +179 -0
  38. package/renderer/BuildAnimation.mjs +1148 -0
  39. package/renderer/BuildingTool.d.mts +46 -0
  40. package/renderer/BuildingTool.d.ts +46 -0
  41. package/renderer/BuildingTool.mjs +121 -0
  42. package/renderer/CellExecutor.d.mts +51 -0
  43. package/renderer/CellExecutor.d.ts +51 -0
  44. package/renderer/CellExecutor.mjs +171 -0
  45. package/renderer/CellularSdfConfig.d.mts +22 -0
  46. package/renderer/CellularSdfConfig.d.ts +22 -0
  47. package/renderer/CellularSdfConfig.mjs +69 -0
  48. package/renderer/ChunkMeshResult.d.mts +75 -0
  49. package/renderer/ChunkMeshResult.d.ts +75 -0
  50. package/renderer/ChunkMeshResult.mjs +253 -0
  51. package/renderer/CircuitBuilder.d.mts +118 -0
  52. package/renderer/CircuitBuilder.d.ts +118 -0
  53. package/renderer/CircuitBuilder.mjs +516 -0
  54. package/renderer/Curve3D.d.mts +27 -0
  55. package/renderer/Curve3D.d.ts +27 -0
  56. package/renderer/Curve3D.mjs +101 -0
  57. package/renderer/DefinitionRegion.d.mts +274 -0
  58. package/renderer/DefinitionRegion.d.ts +274 -0
  59. package/renderer/DefinitionRegion.mjs +973 -0
  60. package/renderer/Design.d.mts +348 -0
  61. package/renderer/Design.d.ts +348 -0
  62. package/renderer/Design.mjs +1334 -0
  63. package/renderer/Diff.d.mts +88 -0
  64. package/renderer/Diff.d.ts +88 -0
  65. package/renderer/Diff.mjs +316 -0
  66. package/renderer/Dimensions.d.mts +28 -0
  67. package/renderer/Dimensions.d.ts +28 -0
  68. package/renderer/Dimensions.mjs +130 -0
  69. package/renderer/DistanceField.d.mts +39 -0
  70. package/renderer/DistanceField.d.ts +39 -0
  71. package/renderer/DistanceField.mjs +114 -0
  72. package/renderer/ExecutionMode.d.mts +42 -0
  73. package/renderer/ExecutionMode.d.ts +42 -0
  74. package/renderer/ExecutionMode.mjs +127 -0
  75. package/renderer/Field3.d.mts +40 -0
  76. package/renderer/Field3.d.ts +40 -0
  77. package/renderer/Field3.mjs +160 -0
  78. package/renderer/FieldProgram.d.mts +40 -0
  79. package/renderer/FieldProgram.d.ts +40 -0
  80. package/renderer/FieldProgram.mjs +167 -0
  81. package/renderer/FieldProgramBinaryOp.d.mts +42 -0
  82. package/renderer/FieldProgramBinaryOp.d.ts +42 -0
  83. package/renderer/FieldProgramBinaryOp.mjs +118 -0
  84. package/renderer/FieldProgramBuilder.d.mts +104 -0
  85. package/renderer/FieldProgramBuilder.d.ts +104 -0
  86. package/renderer/FieldProgramBuilder.mjs +486 -0
  87. package/renderer/FieldProgramDistanceKind.d.mts +26 -0
  88. package/renderer/FieldProgramDistanceKind.d.ts +26 -0
  89. package/renderer/FieldProgramDistanceKind.mjs +78 -0
  90. package/renderer/FieldProgramUnaryOp.d.mts +34 -0
  91. package/renderer/FieldProgramUnaryOp.d.ts +34 -0
  92. package/renderer/FieldProgramUnaryOp.mjs +102 -0
  93. package/renderer/FieldProgramValueType.d.mts +25 -0
  94. package/renderer/FieldProgramValueType.d.ts +25 -0
  95. package/renderer/FieldProgramValueType.mjs +75 -0
  96. package/renderer/FieldRange.d.mts +15 -0
  97. package/renderer/FieldRange.d.ts +15 -0
  98. package/renderer/FieldRange.mjs +109 -0
  99. package/renderer/Fingerprint.d.mts +44 -0
  100. package/renderer/Fingerprint.d.ts +44 -0
  101. package/renderer/Fingerprint.mjs +197 -0
  102. package/renderer/GeneratedChunk.d.mts +35 -0
  103. package/renderer/GeneratedChunk.d.ts +35 -0
  104. package/renderer/GeneratedChunk.mjs +178 -0
  105. package/renderer/GeneratedChunkCoverage.d.mts +25 -0
  106. package/renderer/GeneratedChunkCoverage.d.ts +25 -0
  107. package/renderer/GeneratedChunkCoverage.mjs +75 -0
  108. package/renderer/GeneratedChunkOverlayMode.d.mts +24 -0
  109. package/renderer/GeneratedChunkOverlayMode.d.ts +24 -0
  110. package/renderer/GeneratedChunkOverlayMode.mjs +72 -0
  111. package/renderer/GeneratedWorldStream.d.mts +28 -0
  112. package/renderer/GeneratedWorldStream.d.ts +28 -0
  113. package/renderer/GeneratedWorldStream.mjs +86 -0
  114. package/renderer/Geo.d.mts +41 -0
  115. package/renderer/Geo.d.ts +41 -0
  116. package/renderer/Geo.mjs +121 -0
  117. package/renderer/Hdl.d.mts +56 -0
  118. package/renderer/Hdl.d.ts +56 -0
  119. package/renderer/Hdl.mjs +163 -0
  120. package/renderer/InterpolationSpace.d.mts +25 -0
  121. package/renderer/InterpolationSpace.d.ts +25 -0
  122. package/renderer/InterpolationSpace.mjs +73 -0
  123. package/renderer/IoLayout.d.mts +26 -0
  124. package/renderer/IoLayout.d.ts +26 -0
  125. package/renderer/IoLayout.mjs +81 -0
  126. package/renderer/IoLayoutBuilder.d.mts +73 -0
  127. package/renderer/IoLayoutBuilder.d.ts +73 -0
  128. package/renderer/IoLayoutBuilder.mjs +315 -0
  129. package/renderer/IoType.d.mts +41 -0
  130. package/renderer/IoType.d.ts +41 -0
  131. package/renderer/IoType.mjs +125 -0
  132. package/renderer/ItemModelConfig.d.mts +65 -0
  133. package/renderer/ItemModelConfig.d.ts +65 -0
  134. package/renderer/ItemModelConfig.mjs +223 -0
  135. package/renderer/ItemModelPackBuilder.d.mts +32 -0
  136. package/renderer/ItemModelPackBuilder.d.ts +32 -0
  137. package/renderer/ItemModelPackBuilder.mjs +104 -0
  138. package/renderer/ItemModelResult.d.mts +72 -0
  139. package/renderer/ItemModelResult.d.ts +72 -0
  140. package/renderer/ItemModelResult.mjs +268 -0
  141. package/renderer/ItemScale.d.mts +31 -0
  142. package/renderer/ItemScale.d.ts +31 -0
  143. package/renderer/ItemScale.mjs +133 -0
  144. package/renderer/LayoutFunction.d.mts +52 -0
  145. package/renderer/LayoutFunction.d.ts +52 -0
  146. package/renderer/LayoutFunction.mjs +159 -0
  147. package/renderer/MchprsWorld.d.mts +131 -0
  148. package/renderer/MchprsWorld.d.ts +131 -0
  149. package/renderer/MchprsWorld.mjs +423 -0
  150. package/renderer/MeshBounds.d.mts +40 -0
  151. package/renderer/MeshBounds.d.ts +40 -0
  152. package/renderer/MeshBounds.mjs +181 -0
  153. package/renderer/MeshConfig.d.mts +101 -0
  154. package/renderer/MeshConfig.d.ts +101 -0
  155. package/renderer/MeshConfig.mjs +306 -0
  156. package/renderer/MeshJob.d.mts +44 -0
  157. package/renderer/MeshJob.d.ts +44 -0
  158. package/renderer/MeshJob.mjs +116 -0
  159. package/renderer/MeshPhase.d.mts +38 -0
  160. package/renderer/MeshPhase.d.ts +38 -0
  161. package/renderer/MeshPhase.mjs +90 -0
  162. package/renderer/MeshProgress.d.mts +32 -0
  163. package/renderer/MeshProgress.d.ts +32 -0
  164. package/renderer/MeshProgress.mjs +134 -0
  165. package/renderer/MeshResult.d.mts +76 -0
  166. package/renderer/MeshResult.d.ts +76 -0
  167. package/renderer/MeshResult.mjs +269 -0
  168. package/renderer/MultiMeshResult.d.mts +50 -0
  169. package/renderer/MultiMeshResult.d.ts +50 -0
  170. package/renderer/MultiMeshResult.mjs +166 -0
  171. package/renderer/Nbt.d.mts +50 -0
  172. package/renderer/Nbt.d.ts +50 -0
  173. package/renderer/Nbt.mjs +161 -0
  174. package/renderer/NucleationError.d.mts +53 -0
  175. package/renderer/NucleationError.d.ts +53 -0
  176. package/renderer/NucleationError.mjs +136 -0
  177. package/renderer/OutputCondition.d.mts +45 -0
  178. package/renderer/OutputCondition.d.ts +45 -0
  179. package/renderer/OutputCondition.mjs +129 -0
  180. package/renderer/Palette.d.mts +157 -0
  181. package/renderer/Palette.d.ts +157 -0
  182. package/renderer/Palette.mjs +487 -0
  183. package/renderer/PaletteBuilder.d.mts +119 -0
  184. package/renderer/PaletteBuilder.d.ts +119 -0
  185. package/renderer/PaletteBuilder.mjs +457 -0
  186. package/renderer/README.md +67 -0
  187. package/renderer/RawMeshExport.d.mts +74 -0
  188. package/renderer/RawMeshExport.d.ts +74 -0
  189. package/renderer/RawMeshExport.mjs +243 -0
  190. package/renderer/RedstoneGraph.d.mts +58 -0
  191. package/renderer/RedstoneGraph.d.ts +58 -0
  192. package/renderer/RedstoneGraph.mjs +242 -0
  193. package/renderer/RegionBounds.d.mts +41 -0
  194. package/renderer/RegionBounds.d.ts +41 -0
  195. package/renderer/RegionBounds.mjs +182 -0
  196. package/renderer/RenderConfig.d.mts +101 -0
  197. package/renderer/RenderConfig.d.ts +101 -0
  198. package/renderer/RenderConfig.mjs +271 -0
  199. package/renderer/Renderer.d.mts +51 -0
  200. package/renderer/Renderer.d.ts +51 -0
  201. package/renderer/Renderer.mjs +219 -0
  202. package/renderer/ResourcePack.d.mts +105 -0
  203. package/renderer/ResourcePack.d.ts +105 -0
  204. package/renderer/ResourcePack.mjs +447 -0
  205. package/renderer/ResourcePackList.d.mts +32 -0
  206. package/renderer/ResourcePackList.d.ts +32 -0
  207. package/renderer/ResourcePackList.mjs +96 -0
  208. package/renderer/Routing.d.mts +66 -0
  209. package/renderer/Routing.d.ts +66 -0
  210. package/renderer/Routing.mjs +220 -0
  211. package/renderer/Schematic.d.mts +977 -0
  212. package/renderer/Schematic.d.ts +977 -0
  213. package/renderer/Schematic.mjs +3820 -0
  214. package/renderer/SchematicBuilder.d.mts +103 -0
  215. package/renderer/SchematicBuilder.d.ts +103 -0
  216. package/renderer/SchematicBuilder.mjs +401 -0
  217. package/renderer/SchematicRegions.d.mts +93 -0
  218. package/renderer/SchematicRegions.d.ts +93 -0
  219. package/renderer/SchematicRegions.mjs +411 -0
  220. package/renderer/SchematicSplitResult.d.mts +26 -0
  221. package/renderer/SchematicSplitResult.d.ts +26 -0
  222. package/renderer/SchematicSplitResult.mjs +84 -0
  223. package/renderer/Scripting.d.mts +40 -0
  224. package/renderer/Scripting.d.ts +40 -0
  225. package/renderer/Scripting.mjs +138 -0
  226. package/renderer/Sdf.d.mts +234 -0
  227. package/renderer/Sdf.d.ts +234 -0
  228. package/renderer/Sdf.mjs +1234 -0
  229. package/renderer/SdfAxis.d.mts +25 -0
  230. package/renderer/SdfAxis.d.ts +25 -0
  231. package/renderer/SdfAxis.mjs +75 -0
  232. package/renderer/SdfBounds.d.mts +19 -0
  233. package/renderer/SdfBounds.d.ts +19 -0
  234. package/renderer/SdfBounds.mjs +161 -0
  235. package/renderer/SdfCellMode.d.mts +26 -0
  236. package/renderer/SdfCellMode.d.ts +26 -0
  237. package/renderer/SdfCellMode.mjs +78 -0
  238. package/renderer/SdfNormal.d.mts +16 -0
  239. package/renderer/SdfNormal.d.ts +16 -0
  240. package/renderer/SdfNormal.mjs +122 -0
  241. package/renderer/Shape.d.mts +143 -0
  242. package/renderer/Shape.d.ts +143 -0
  243. package/renderer/Shape.mjs +458 -0
  244. package/renderer/SortStrategy.d.mts +86 -0
  245. package/renderer/SortStrategy.d.ts +86 -0
  246. package/renderer/SortStrategy.mjs +272 -0
  247. package/renderer/Store.d.mts +83 -0
  248. package/renderer/Store.d.ts +83 -0
  249. package/renderer/Store.mjs +369 -0
  250. package/renderer/StoreIo.d.mts +71 -0
  251. package/renderer/StoreIo.d.ts +71 -0
  252. package/renderer/StoreIo.mjs +292 -0
  253. package/renderer/TextureAtlas.d.mts +40 -0
  254. package/renderer/TextureAtlas.d.ts +40 -0
  255. package/renderer/TextureAtlas.mjs +122 -0
  256. package/renderer/TextureInfo.d.mts +34 -0
  257. package/renderer/TextureInfo.d.ts +34 -0
  258. package/renderer/TextureInfo.mjs +149 -0
  259. package/renderer/TickSettleMode.d.mts +34 -0
  260. package/renderer/TickSettleMode.d.ts +34 -0
  261. package/renderer/TickSettleMode.mjs +84 -0
  262. package/renderer/TickSimulation.d.mts +572 -0
  263. package/renderer/TickSimulation.d.ts +572 -0
  264. package/renderer/TickSimulation.mjs +1299 -0
  265. package/renderer/TypedCircuitExecutor.d.mts +101 -0
  266. package/renderer/TypedCircuitExecutor.d.ts +101 -0
  267. package/renderer/TypedCircuitExecutor.mjs +378 -0
  268. package/renderer/Value.d.mts +73 -0
  269. package/renderer/Value.d.ts +73 -0
  270. package/renderer/Value.mjs +275 -0
  271. package/renderer/VideoConfig.d.mts +15 -0
  272. package/renderer/VideoConfig.d.ts +15 -0
  273. package/renderer/VideoConfig.mjs +44 -0
  274. package/renderer/VoxelModel.d.mts +34 -0
  275. package/renderer/VoxelModel.d.ts +34 -0
  276. package/renderer/VoxelModel.mjs +113 -0
  277. package/renderer/Voxelizer.d.mts +80 -0
  278. package/renderer/Voxelizer.d.ts +80 -0
  279. package/renderer/Voxelizer.mjs +261 -0
  280. package/renderer/WorldChunkView.d.mts +75 -0
  281. package/renderer/WorldChunkView.d.ts +75 -0
  282. package/renderer/WorldChunkView.mjs +224 -0
  283. package/renderer/WorldGenerator.d.mts +75 -0
  284. package/renderer/WorldGenerator.d.ts +75 -0
  285. package/renderer/WorldGenerator.mjs +255 -0
  286. package/renderer/WorldSink.d.mts +50 -0
  287. package/renderer/WorldSink.d.ts +50 -0
  288. package/renderer/WorldSink.mjs +177 -0
  289. package/renderer/WorldStream.d.mts +45 -0
  290. package/renderer/WorldStream.d.ts +45 -0
  291. package/renderer/WorldStream.mjs +184 -0
  292. package/renderer/WsPartitionHints.d.mts +29 -0
  293. package/renderer/WsPartitionHints.d.ts +29 -0
  294. package/renderer/WsPartitionHints.mjs +102 -0
  295. package/renderer/WsProfile.d.mts +46 -0
  296. package/renderer/WsProfile.d.ts +46 -0
  297. package/renderer/WsProfile.mjs +152 -0
  298. package/renderer/WsRunResult.d.mts +83 -0
  299. package/renderer/WsRunResult.d.ts +83 -0
  300. package/renderer/WsRunResult.mjs +326 -0
  301. package/renderer/WsSegmentJob.d.mts +28 -0
  302. package/renderer/WsSegmentJob.d.ts +28 -0
  303. package/renderer/WsSegmentJob.mjs +81 -0
  304. package/renderer/diplomat-runtime.d.mts +15 -0
  305. package/renderer/diplomat-runtime.d.ts +15 -0
  306. package/renderer/diplomat-runtime.mjs +779 -0
  307. package/renderer/diplomat-wasm.mjs +52 -0
  308. package/renderer/diplomat.config.mjs +5 -0
  309. package/renderer/index.d.mts +193 -0
  310. package/renderer/index.d.ts +193 -0
  311. package/renderer/index.mjs +196 -0
  312. package/renderer/nucleation.wasm +0 -0
  313. package/renderer/veneer/design.d.ts +167 -0
  314. package/renderer/veneer/design.mjs +480 -0
@@ -0,0 +1,121 @@
1
+ // generated by diplomat-tool
2
+ import { NucleationError } from "./NucleationError.mjs"
3
+ import { Schematic } from "./Schematic.mjs"
4
+ import wasm from "./diplomat-wasm.mjs";
5
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
6
+
7
+ const Geo_box_destroy_registry = new FinalizationRegistry((ptr) => {
8
+ wasm.Geo_destroy(ptr);
9
+ });
10
+
11
+ /**
12
+ * Namespace for the geodata entry points (no network — data goes in,
13
+ * blocks come out).
14
+ */
15
+ export class Geo {
16
+ // Internal ptr reference:
17
+ #ptr = null;
18
+
19
+ // Lifetimes are only to keep dependencies alive.
20
+ // Since JS won't garbage collect until there are no incoming edges.
21
+ #selfEdge = [];
22
+
23
+ #internalConstructor(symbol, ptr, selfEdge) {
24
+ if (symbol !== diplomatRuntime.internalConstructor) {
25
+ console.error("Geo is an Opaque type. You cannot call its constructor.");
26
+ return;
27
+ }
28
+ this.#ptr = ptr;
29
+ this.#selfEdge = selfEdge;
30
+
31
+ // Are we being borrowed? If not, we can register.
32
+ if (this.#selfEdge.length === 0) {
33
+ Geo_box_destroy_registry.register(this, this.#ptr);
34
+ }
35
+
36
+ return this;
37
+ }
38
+ /** @internal */
39
+ get ffiValue() {
40
+ return this.#ptr;
41
+ }
42
+
43
+
44
+ /**
45
+ * Extrude building footprints into a massed schematic. `buildings_json`
46
+ * is a JSON array of objects:
47
+ * `{"polygon": [[x, z], ...], "height": <blocks>, "block": "minecraft:...",
48
+ * "min_y": <optional base, default 1>}`. Footprints are stamped
49
+ * tallest-last, so overlaps keep the tallest occupant per column.
50
+ * `base_block` (empty string = none) lays a ground slab at y=0 under the
51
+ * whole extent. Errors `Parse` on bad JSON, `InvalidArgument` on non-UTF-8.
52
+ */
53
+ static extrudeFootprints(buildingsJson, baseBlock, name) {
54
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
55
+
56
+ const buildingsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, buildingsJson)));
57
+ const baseBlockSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, baseBlock)));
58
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
59
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
60
+
61
+
62
+ const result = wasm.Geo_extrude_footprints(diplomatReceive.buffer, buildingsJsonSlice.ptr, baseBlockSlice.ptr, nameSlice.ptr);
63
+
64
+ try {
65
+ if (!diplomatReceive.resultFlag) {
66
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
67
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
68
+ }
69
+ return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
70
+ }
71
+
72
+ finally {
73
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
74
+ functionCleanupArena.free();
75
+
76
+ diplomatReceive.free();
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Raise terrain from a heightmap. `heights_json` is a flat row-major
82
+ * JSON array of per-column heights (blocks); `width` is columns per row.
83
+ * `surface_blocks_json` is a JSON array of block names — one entry (the
84
+ * same surface everywhere) or one per column, row-major and the same
85
+ * length as `heights`, for elevation/slope banding. Each column's top
86
+ * `surface_depth` blocks are its surface block, the rest are
87
+ * `subsurface_block`. Errors `Parse` on bad JSON, `InvalidArgument` on a
88
+ * non-positive width, empty surface list, or non-UTF-8.
89
+ */
90
+ static heightmapTerrain(heightsJson, width, surfaceBlocksJson, subsurfaceBlock, surfaceDepth, name) {
91
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
92
+
93
+ const heightsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, heightsJson)));
94
+ const surfaceBlocksJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, surfaceBlocksJson)));
95
+ const subsurfaceBlockSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, subsurfaceBlock)));
96
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
97
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
98
+
99
+
100
+ const result = wasm.Geo_heightmap_terrain(diplomatReceive.buffer, heightsJsonSlice.ptr, width, surfaceBlocksJsonSlice.ptr, subsurfaceBlockSlice.ptr, surfaceDepth, nameSlice.ptr);
101
+
102
+ try {
103
+ if (!diplomatReceive.resultFlag) {
104
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
105
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
106
+ }
107
+ return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
108
+ }
109
+
110
+ finally {
111
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
112
+ functionCleanupArena.free();
113
+
114
+ diplomatReceive.free();
115
+ }
116
+ }
117
+
118
+ constructor(symbol, ptr, selfEdge) {
119
+ return this.#internalConstructor(...arguments)
120
+ }
121
+ }
@@ -0,0 +1,56 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { Schematic } from "./Schematic.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
+
6
+
7
+
8
+ /**
9
+ * Namespacing opaque for the HDL compiler entry points (static methods,
10
+ * like `Routing`).
11
+ */
12
+ export class Hdl {
13
+ /** @internal */
14
+ get ffiValue(): pointer;
15
+ /** @internal */
16
+ constructor();
17
+
18
+
19
+ /**
20
+ * Compile combinational BLIF text into a redstone PLA schematic.
21
+ *
22
+ * `blif` is yosys `write_blif` output (`.latch`/`.subckt` are
23
+ * rejected — combinational only). One floor lever per `.inputs` net
24
+ * drives the build; every signal has a dust probe. `bake=true`
25
+ * settles the build in the tick engine first and saves it at rest
26
+ * (needs the `mc-tick` feature, else errors).
27
+ *
28
+ * Probe/lever coordinates and stats come from `compile_blif_report`.
29
+ */
30
+ static compileBlif(blif: string, name: string, bake: boolean): Schematic;
31
+
32
+ /**
33
+ * Compile `blif` and write the JSON report: stats (`prims`,
34
+ * `levels`, `peephole_removed`, `blocks`, `bounds`), `inputs` (=
35
+ * lever drive order), `outputs` (each `{name, probe}` or `{name,
36
+ * const}`), `levers` (`{signal, pos}`), and `probes`
37
+ * (signal -> `[x, y, z]` dust cell, in the schematic's own
38
+ * coordinates).
39
+ */
40
+ static compileBlifReport(blif: string, name: string): string;
41
+
42
+ /**
43
+ * Compile `blif` and write its typed-cell contract as JSON — the
44
+ * `CellContract` file format (name, `io` with typed ports/buses,
45
+ * `physical` sidecar). Vector ports (`a[0..3]` or `a0..a3`) group
46
+ * into word buses (LSB = index 0); single bits are boolean. Input
47
+ * port positions are the drive levers, output positions the dust
48
+ * probes, in the same schematic coordinates as `compile_blif`.
49
+ *
50
+ * The `physical.delays_rt` table is ESTIMATED from levelization
51
+ * depth (2 redstone ticks per level), not measured; `paste_safe`
52
+ * is false until proven. Pair with `compile_blif` for the
53
+ * schematic: schematic + this contract = an executable typed cell.
54
+ */
55
+ static compileBlifContract(blif: string, name: string): string;
56
+ }
@@ -0,0 +1,56 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError.mjs"
3
+ import type { Schematic } from "./Schematic.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
5
+
6
+
7
+
8
+ /**
9
+ * Namespacing opaque for the HDL compiler entry points (static methods,
10
+ * like `Routing`).
11
+ */
12
+ export class Hdl {
13
+ /** @internal */
14
+ get ffiValue(): pointer;
15
+ /** @internal */
16
+ constructor();
17
+
18
+
19
+ /**
20
+ * Compile combinational BLIF text into a redstone PLA schematic.
21
+ *
22
+ * `blif` is yosys `write_blif` output (`.latch`/`.subckt` are
23
+ * rejected — combinational only). One floor lever per `.inputs` net
24
+ * drives the build; every signal has a dust probe. `bake=true`
25
+ * settles the build in the tick engine first and saves it at rest
26
+ * (needs the `mc-tick` feature, else errors).
27
+ *
28
+ * Probe/lever coordinates and stats come from `compile_blif_report`.
29
+ */
30
+ static compileBlif(blif: string, name: string, bake: boolean): Schematic;
31
+
32
+ /**
33
+ * Compile `blif` and write the JSON report: stats (`prims`,
34
+ * `levels`, `peephole_removed`, `blocks`, `bounds`), `inputs` (=
35
+ * lever drive order), `outputs` (each `{name, probe}` or `{name,
36
+ * const}`), `levers` (`{signal, pos}`), and `probes`
37
+ * (signal -> `[x, y, z]` dust cell, in the schematic's own
38
+ * coordinates).
39
+ */
40
+ static compileBlifReport(blif: string, name: string): string;
41
+
42
+ /**
43
+ * Compile `blif` and write its typed-cell contract as JSON — the
44
+ * `CellContract` file format (name, `io` with typed ports/buses,
45
+ * `physical` sidecar). Vector ports (`a[0..3]` or `a0..a3`) group
46
+ * into word buses (LSB = index 0); single bits are boolean. Input
47
+ * port positions are the drive levers, output positions the dust
48
+ * probes, in the same schematic coordinates as `compile_blif`.
49
+ *
50
+ * The `physical.delays_rt` table is ESTIMATED from levelization
51
+ * depth (2 redstone ticks per level), not measured; `paste_safe`
52
+ * is false until proven. Pair with `compile_blif` for the
53
+ * schematic: schematic + this contract = an executable typed cell.
54
+ */
55
+ static compileBlifContract(blif: string, name: string): string;
56
+ }
@@ -0,0 +1,163 @@
1
+ // generated by diplomat-tool
2
+ import { NucleationError } from "./NucleationError.mjs"
3
+ import { Schematic } from "./Schematic.mjs"
4
+ import wasm from "./diplomat-wasm.mjs";
5
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
6
+
7
+ const Hdl_box_destroy_registry = new FinalizationRegistry((ptr) => {
8
+ wasm.Hdl_destroy(ptr);
9
+ });
10
+
11
+ /**
12
+ * Namespacing opaque for the HDL compiler entry points (static methods,
13
+ * like `Routing`).
14
+ */
15
+ export class Hdl {
16
+ // Internal ptr reference:
17
+ #ptr = null;
18
+
19
+ // Lifetimes are only to keep dependencies alive.
20
+ // Since JS won't garbage collect until there are no incoming edges.
21
+ #selfEdge = [];
22
+
23
+ #internalConstructor(symbol, ptr, selfEdge) {
24
+ if (symbol !== diplomatRuntime.internalConstructor) {
25
+ console.error("Hdl is an Opaque type. You cannot call its constructor.");
26
+ return;
27
+ }
28
+ this.#ptr = ptr;
29
+ this.#selfEdge = selfEdge;
30
+
31
+ // Are we being borrowed? If not, we can register.
32
+ if (this.#selfEdge.length === 0) {
33
+ Hdl_box_destroy_registry.register(this, this.#ptr);
34
+ }
35
+
36
+ return this;
37
+ }
38
+ /** @internal */
39
+ get ffiValue() {
40
+ return this.#ptr;
41
+ }
42
+
43
+
44
+ /**
45
+ * Compile combinational BLIF text into a redstone PLA schematic.
46
+ *
47
+ * `blif` is yosys `write_blif` output (`.latch`/`.subckt` are
48
+ * rejected — combinational only). One floor lever per `.inputs` net
49
+ * drives the build; every signal has a dust probe. `bake=true`
50
+ * settles the build in the tick engine first and saves it at rest
51
+ * (needs the `mc-tick` feature, else errors).
52
+ *
53
+ * Probe/lever coordinates and stats come from `compile_blif_report`.
54
+ */
55
+ static compileBlif(blif, name, bake) {
56
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
57
+
58
+ const blifSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blif)));
59
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
60
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
61
+
62
+
63
+ const result = wasm.Hdl_compile_blif(diplomatReceive.buffer, blifSlice.ptr, nameSlice.ptr, bake);
64
+
65
+ try {
66
+ if (!diplomatReceive.resultFlag) {
67
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
68
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
69
+ }
70
+ return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
71
+ }
72
+
73
+ finally {
74
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
75
+ functionCleanupArena.free();
76
+
77
+ diplomatReceive.free();
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Compile `blif` and write the JSON report: stats (`prims`,
83
+ * `levels`, `peephole_removed`, `blocks`, `bounds`), `inputs` (=
84
+ * lever drive order), `outputs` (each `{name, probe}` or `{name,
85
+ * const}`), `levers` (`{signal, pos}`), and `probes`
86
+ * (signal -> `[x, y, z]` dust cell, in the schematic's own
87
+ * coordinates).
88
+ */
89
+ static compileBlifReport(blif, name) {
90
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
91
+
92
+ const blifSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blif)));
93
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
94
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
95
+
96
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
97
+
98
+
99
+ const result = wasm.Hdl_compile_blif_report(diplomatReceive.buffer, blifSlice.ptr, nameSlice.ptr, write.buffer);
100
+
101
+ try {
102
+ if (!diplomatReceive.resultFlag) {
103
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
104
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
105
+ }
106
+ return write.readString8();
107
+ }
108
+
109
+ finally {
110
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
111
+ functionCleanupArena.free();
112
+
113
+ diplomatReceive.free();
114
+ write.free();
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Compile `blif` and write its typed-cell contract as JSON — the
120
+ * `CellContract` file format (name, `io` with typed ports/buses,
121
+ * `physical` sidecar). Vector ports (`a[0..3]` or `a0..a3`) group
122
+ * into word buses (LSB = index 0); single bits are boolean. Input
123
+ * port positions are the drive levers, output positions the dust
124
+ * probes, in the same schematic coordinates as `compile_blif`.
125
+ *
126
+ * The `physical.delays_rt` table is ESTIMATED from levelization
127
+ * depth (2 redstone ticks per level), not measured; `paste_safe`
128
+ * is false until proven. Pair with `compile_blif` for the
129
+ * schematic: schematic + this contract = an executable typed cell.
130
+ */
131
+ static compileBlifContract(blif, name) {
132
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
133
+
134
+ const blifSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blif)));
135
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
136
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
137
+
138
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
139
+
140
+
141
+ const result = wasm.Hdl_compile_blif_contract(diplomatReceive.buffer, blifSlice.ptr, nameSlice.ptr, write.buffer);
142
+
143
+ try {
144
+ if (!diplomatReceive.resultFlag) {
145
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
146
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
147
+ }
148
+ return write.readString8();
149
+ }
150
+
151
+ finally {
152
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
153
+ functionCleanupArena.free();
154
+
155
+ diplomatReceive.free();
156
+ write.free();
157
+ }
158
+ }
159
+
160
+ constructor(symbol, ptr, selfEdge) {
161
+ return this.#internalConstructor(...arguments)
162
+ }
163
+ }
@@ -0,0 +1,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Color interpolation space for gradient brushes. The old ABI passed this as
8
+ * `space: c_int` (`1` = Oklab, anything else = RGB).
9
+ */
10
+ export class InterpolationSpace {
11
+
12
+ /** @internal */
13
+ static fromValue(value: InterpolationSpace | string): InterpolationSpace;
14
+
15
+ get value(): string;
16
+
17
+ /** @internal */
18
+ get ffiValue(): number;
19
+
20
+ static Rgb : InterpolationSpace;
21
+ static Oklab : InterpolationSpace;
22
+
23
+
24
+ constructor(value: InterpolationSpace | string );
25
+ }
@@ -0,0 +1,25 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * Color interpolation space for gradient brushes. The old ABI passed this as
8
+ * `space: c_int` (`1` = Oklab, anything else = RGB).
9
+ */
10
+ export class InterpolationSpace {
11
+
12
+ /** @internal */
13
+ static fromValue(value: InterpolationSpace | string): InterpolationSpace;
14
+
15
+ get value(): string;
16
+
17
+ /** @internal */
18
+ get ffiValue(): number;
19
+
20
+ static Rgb : InterpolationSpace;
21
+ static Oklab : InterpolationSpace;
22
+
23
+
24
+ constructor(value: InterpolationSpace | string );
25
+ }
@@ -0,0 +1,73 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+
6
+
7
+ /**
8
+ * Color interpolation space for gradient brushes. The old ABI passed this as
9
+ * `space: c_int` (`1` = Oklab, anything else = RGB).
10
+ */
11
+ export class InterpolationSpace {
12
+ #value = undefined;
13
+
14
+ static #values = new Map([
15
+ ["Rgb", 0],
16
+ ["Oklab", 1]
17
+ ]);
18
+
19
+ static getAllEntries() {
20
+ return InterpolationSpace.#values.entries();
21
+ }
22
+
23
+ #internalConstructor(value) {
24
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
25
+ // We pass in two internalConstructor arguments to create *new*
26
+ // instances of this type, otherwise the enums are treated as singletons.
27
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
28
+ this.#value = arguments[2];
29
+ return this;
30
+ }
31
+ return InterpolationSpace.#objectValues[arguments[1]];
32
+ }
33
+
34
+ if (value instanceof InterpolationSpace) {
35
+ return value;
36
+ }
37
+
38
+ let intVal = InterpolationSpace.#values.get(value);
39
+
40
+ // Nullish check, checks for null or undefined
41
+ if (intVal != null) {
42
+ return InterpolationSpace.#objectValues[intVal];
43
+ }
44
+
45
+ throw TypeError(value + " is not a InterpolationSpace and does not correspond to any of its enumerator values.");
46
+ }
47
+
48
+ /** @internal */
49
+ static fromValue(value) {
50
+ return new InterpolationSpace(value);
51
+ }
52
+
53
+ get value(){
54
+ return [...InterpolationSpace.#values.keys()][this.#value];
55
+ }
56
+
57
+ /** @internal */
58
+ get ffiValue(){
59
+ return this.#value;
60
+ }
61
+ static #objectValues = [
62
+ new InterpolationSpace(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
63
+ new InterpolationSpace(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
64
+ ];
65
+
66
+ static Rgb = InterpolationSpace.#objectValues[0];
67
+ static Oklab = InterpolationSpace.#objectValues[1];
68
+
69
+
70
+ constructor(value) {
71
+ return this.#internalConstructor(...arguments)
72
+ }
73
+ }
@@ -0,0 +1,26 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * An immutable IO layout. Wraps
8
+ * {@link crate::simulation::typed_executor::IoLayout}.
9
+ */
10
+ export class IoLayout {
11
+ /** @internal */
12
+ get ffiValue(): pointer;
13
+ /** @internal */
14
+ constructor();
15
+
16
+
17
+ /**
18
+ * Input names as a JSON array string.
19
+ */
20
+ inputNamesJson(): string;
21
+
22
+ /**
23
+ * Output names as a JSON array string.
24
+ */
25
+ outputNamesJson(): string;
26
+ }
@@ -0,0 +1,26 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * An immutable IO layout. Wraps
8
+ * {@link crate::simulation::typed_executor::IoLayout}.
9
+ */
10
+ export class IoLayout {
11
+ /** @internal */
12
+ get ffiValue(): pointer;
13
+ /** @internal */
14
+ constructor();
15
+
16
+
17
+ /**
18
+ * Input names as a JSON array string.
19
+ */
20
+ inputNamesJson(): string;
21
+
22
+ /**
23
+ * Output names as a JSON array string.
24
+ */
25
+ outputNamesJson(): string;
26
+ }
@@ -0,0 +1,81 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+ const IoLayout_box_destroy_registry = new FinalizationRegistry((ptr) => {
6
+ wasm.IoLayout_destroy(ptr);
7
+ });
8
+
9
+ /**
10
+ * An immutable IO layout. Wraps
11
+ * {@link crate::simulation::typed_executor::IoLayout}.
12
+ */
13
+ export class IoLayout {
14
+ // Internal ptr reference:
15
+ #ptr = null;
16
+
17
+ // Lifetimes are only to keep dependencies alive.
18
+ // Since JS won't garbage collect until there are no incoming edges.
19
+ #selfEdge = [];
20
+
21
+ #internalConstructor(symbol, ptr, selfEdge) {
22
+ if (symbol !== diplomatRuntime.internalConstructor) {
23
+ console.error("IoLayout is an Opaque type. You cannot call its constructor.");
24
+ return;
25
+ }
26
+ this.#ptr = ptr;
27
+ this.#selfEdge = selfEdge;
28
+
29
+ // Are we being borrowed? If not, we can register.
30
+ if (this.#selfEdge.length === 0) {
31
+ IoLayout_box_destroy_registry.register(this, this.#ptr);
32
+ }
33
+
34
+ return this;
35
+ }
36
+ /** @internal */
37
+ get ffiValue() {
38
+ return this.#ptr;
39
+ }
40
+
41
+
42
+ /**
43
+ * Input names as a JSON array string.
44
+ */
45
+ inputNamesJson() {
46
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
47
+
48
+ wasm.IoLayout_input_names_json(this.ffiValue, write.buffer);
49
+
50
+ try {
51
+ return write.readString8();
52
+ }
53
+
54
+ finally {
55
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
56
+ write.free();
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Output names as a JSON array string.
62
+ */
63
+ outputNamesJson() {
64
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
65
+
66
+ wasm.IoLayout_output_names_json(this.ffiValue, write.buffer);
67
+
68
+ try {
69
+ return write.readString8();
70
+ }
71
+
72
+ finally {
73
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
74
+ write.free();
75
+ }
76
+ }
77
+
78
+ constructor(symbol, ptr, selfEdge) {
79
+ return this.#internalConstructor(...arguments)
80
+ }
81
+ }