nucleation 0.2.18 → 0.3.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 (125) hide show
  1. package/Autostack.d.ts +43 -0
  2. package/Autostack.mjs +134 -0
  3. package/BlockPos.d.ts +28 -0
  4. package/BlockPos.mjs +129 -0
  5. package/BlockState.d.ts +39 -0
  6. package/BlockState.mjs +134 -0
  7. package/Brush.d.ts +59 -0
  8. package/Brush.mjs +203 -0
  9. package/BuildingTool.d.ts +29 -0
  10. package/BuildingTool.mjs +74 -0
  11. package/ChunkMeshResult.d.ts +75 -0
  12. package/ChunkMeshResult.mjs +253 -0
  13. package/CircuitBuilder.d.ts +118 -0
  14. package/CircuitBuilder.mjs +516 -0
  15. package/DefinitionRegion.d.ts +274 -0
  16. package/DefinitionRegion.mjs +973 -0
  17. package/Diff.d.ts +88 -0
  18. package/Diff.mjs +316 -0
  19. package/Dimensions.d.ts +28 -0
  20. package/Dimensions.mjs +129 -0
  21. package/ExecutionMode.d.ts +42 -0
  22. package/ExecutionMode.mjs +127 -0
  23. package/Fingerprint.d.ts +44 -0
  24. package/Fingerprint.mjs +197 -0
  25. package/InterpolationSpace.d.ts +25 -0
  26. package/InterpolationSpace.mjs +73 -0
  27. package/IoLayout.d.ts +26 -0
  28. package/IoLayout.mjs +81 -0
  29. package/IoLayoutBuilder.d.ts +73 -0
  30. package/IoLayoutBuilder.mjs +315 -0
  31. package/IoType.d.ts +41 -0
  32. package/IoType.mjs +125 -0
  33. package/ItemModelConfig.d.ts +65 -0
  34. package/ItemModelConfig.mjs +223 -0
  35. package/ItemModelPackBuilder.d.ts +32 -0
  36. package/ItemModelPackBuilder.mjs +104 -0
  37. package/ItemModelResult.d.ts +72 -0
  38. package/ItemModelResult.mjs +268 -0
  39. package/ItemScale.d.ts +31 -0
  40. package/ItemScale.mjs +132 -0
  41. package/LayoutFunction.d.ts +52 -0
  42. package/LayoutFunction.mjs +159 -0
  43. package/MchprsWorld.d.ts +131 -0
  44. package/MchprsWorld.mjs +423 -0
  45. package/MeshBounds.d.ts +40 -0
  46. package/MeshBounds.mjs +180 -0
  47. package/MeshConfig.d.ts +101 -0
  48. package/MeshConfig.mjs +306 -0
  49. package/MeshJob.d.ts +44 -0
  50. package/MeshJob.mjs +116 -0
  51. package/MeshPhase.d.ts +38 -0
  52. package/MeshPhase.mjs +90 -0
  53. package/MeshProgress.d.ts +32 -0
  54. package/MeshProgress.mjs +133 -0
  55. package/MeshResult.d.ts +60 -0
  56. package/MeshResult.mjs +206 -0
  57. package/MultiMeshResult.d.ts +50 -0
  58. package/MultiMeshResult.mjs +166 -0
  59. package/Nbt.d.ts +50 -0
  60. package/Nbt.mjs +161 -0
  61. package/NucleationError.d.ts +36 -0
  62. package/NucleationError.mjs +104 -0
  63. package/OutputCondition.d.ts +45 -0
  64. package/OutputCondition.mjs +129 -0
  65. package/README.md +28 -197
  66. package/RawMeshExport.d.ts +74 -0
  67. package/RawMeshExport.mjs +243 -0
  68. package/RedstoneGraph.d.ts +58 -0
  69. package/RedstoneGraph.mjs +242 -0
  70. package/RegionBounds.d.ts +41 -0
  71. package/RegionBounds.mjs +181 -0
  72. package/RenderConfig.d.ts +66 -0
  73. package/RenderConfig.mjs +170 -0
  74. package/Renderer.d.ts +35 -0
  75. package/Renderer.mjs +139 -0
  76. package/ResourcePack.d.ts +105 -0
  77. package/ResourcePack.mjs +447 -0
  78. package/ResourcePackList.d.ts +32 -0
  79. package/ResourcePackList.mjs +96 -0
  80. package/Schematic.d.ts +655 -0
  81. package/Schematic.mjs +2647 -0
  82. package/SchematicBuilder.d.ts +103 -0
  83. package/SchematicBuilder.mjs +401 -0
  84. package/SchematicRegions.d.ts +93 -0
  85. package/SchematicRegions.mjs +411 -0
  86. package/Scripting.d.ts +40 -0
  87. package/Scripting.mjs +138 -0
  88. package/Sdf.d.ts +31 -0
  89. package/Sdf.mjs +107 -0
  90. package/Shape.d.ts +108 -0
  91. package/Shape.mjs +336 -0
  92. package/SortStrategy.d.ts +86 -0
  93. package/SortStrategy.mjs +272 -0
  94. package/Store.d.ts +83 -0
  95. package/Store.mjs +369 -0
  96. package/StoreIo.d.ts +71 -0
  97. package/StoreIo.mjs +292 -0
  98. package/TextureAtlas.d.ts +40 -0
  99. package/TextureAtlas.mjs +122 -0
  100. package/TextureInfo.d.ts +34 -0
  101. package/TextureInfo.mjs +148 -0
  102. package/TypedCircuitExecutor.d.ts +101 -0
  103. package/TypedCircuitExecutor.mjs +378 -0
  104. package/Value.d.ts +73 -0
  105. package/Value.mjs +275 -0
  106. package/WorldChunkView.d.ts +63 -0
  107. package/WorldChunkView.mjs +201 -0
  108. package/WorldSink.d.ts +50 -0
  109. package/WorldSink.mjs +177 -0
  110. package/WorldStream.d.ts +45 -0
  111. package/WorldStream.mjs +184 -0
  112. package/diplomat-runtime.d.ts +15 -0
  113. package/diplomat-runtime.mjs +774 -0
  114. package/diplomat-wasm.mjs +52 -0
  115. package/diplomat.config.mjs +6 -0
  116. package/index.d.ts +113 -0
  117. package/index.mjs +116 -0
  118. package/{nucleation_bg.wasm → nucleation.wasm} +0 -0
  119. package/package.json +19 -41
  120. package/LICENSE +0 -21
  121. package/api.js +0 -608
  122. package/nucleation-cdn-loader.js +0 -15
  123. package/nucleation-original.js +0 -8383
  124. package/nucleation.d.ts +0 -2947
  125. package/nucleation.js +0 -36
@@ -0,0 +1,315 @@
1
+ // generated by diplomat-tool
2
+ import { IoLayout } from "./IoLayout.mjs"
3
+ import { IoType } from "./IoType.mjs"
4
+ import { LayoutFunction } from "./LayoutFunction.mjs"
5
+ import { NucleationError } from "./NucleationError.mjs"
6
+ import wasm from "./diplomat-wasm.mjs";
7
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
8
+
9
+ const IoLayoutBuilder_box_destroy_registry = new FinalizationRegistry((ptr) => {
10
+ wasm.IoLayoutBuilder_destroy(ptr);
11
+ });
12
+
13
+ /**
14
+ * Builder for an {@link IoLayout}. `build` consumes it (PORTING rule 11).
15
+ */
16
+ export class IoLayoutBuilder {
17
+ // Internal ptr reference:
18
+ #ptr = null;
19
+
20
+ // Lifetimes are only to keep dependencies alive.
21
+ // Since JS won't garbage collect until there are no incoming edges.
22
+ #selfEdge = [];
23
+
24
+ #internalConstructor(symbol, ptr, selfEdge) {
25
+ if (symbol !== diplomatRuntime.internalConstructor) {
26
+ console.error("IoLayoutBuilder is an Opaque type. You cannot call its constructor.");
27
+ return;
28
+ }
29
+ this.#ptr = ptr;
30
+ this.#selfEdge = selfEdge;
31
+
32
+ // Are we being borrowed? If not, we can register.
33
+ if (this.#selfEdge.length === 0) {
34
+ IoLayoutBuilder_box_destroy_registry.register(this, this.#ptr);
35
+ }
36
+
37
+ return this;
38
+ }
39
+ /** @internal */
40
+ get ffiValue() {
41
+ return this.#ptr;
42
+ }
43
+
44
+
45
+ /**
46
+ * Create an empty layout builder.
47
+ */
48
+ static create() {
49
+
50
+ const result = wasm.IoLayoutBuilder_create();
51
+
52
+ try {
53
+ return new IoLayoutBuilder(diplomatRuntime.internalConstructor, result, []);
54
+ }
55
+
56
+ finally {
57
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Add an input. `positions` is flat `[x,y,z, x,y,z, ...]`.
63
+ */
64
+ addInput(name, ioType, layout, positions) {
65
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
66
+
67
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
68
+ const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
69
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
70
+
71
+
72
+ const result = wasm.IoLayoutBuilder_add_input(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, ioType.ffiValue, layout.ffiValue, positionsSlice.ptr);
73
+
74
+ try {
75
+ if (!diplomatReceive.resultFlag) {
76
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
77
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
78
+ }
79
+ }
80
+
81
+ finally {
82
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
83
+ functionCleanupArena.free();
84
+
85
+ diplomatReceive.free();
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Add an output. `positions` is flat `[x,y,z, x,y,z, ...]`.
91
+ */
92
+ addOutput(name, ioType, layout, positions) {
93
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
94
+
95
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
96
+ const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
97
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
98
+
99
+
100
+ const result = wasm.IoLayoutBuilder_add_output(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, ioType.ffiValue, layout.ffiValue, positionsSlice.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
+ }
108
+
109
+ finally {
110
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
111
+ functionCleanupArena.free();
112
+
113
+ diplomatReceive.free();
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Add an input with automatic layout inference.
119
+ */
120
+ addInputAuto(name, ioType, positions) {
121
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
122
+
123
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
124
+ const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
125
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
126
+
127
+
128
+ const result = wasm.IoLayoutBuilder_add_input_auto(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, ioType.ffiValue, positionsSlice.ptr);
129
+
130
+ try {
131
+ if (!diplomatReceive.resultFlag) {
132
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
133
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
134
+ }
135
+ }
136
+
137
+ finally {
138
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
139
+ functionCleanupArena.free();
140
+
141
+ diplomatReceive.free();
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Add an output with automatic layout inference.
147
+ */
148
+ addOutputAuto(name, ioType, positions) {
149
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
150
+
151
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
152
+ const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
153
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
154
+
155
+
156
+ const result = wasm.IoLayoutBuilder_add_output_auto(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, ioType.ffiValue, positionsSlice.ptr);
157
+
158
+ try {
159
+ if (!diplomatReceive.resultFlag) {
160
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
161
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
162
+ }
163
+ }
164
+
165
+ finally {
166
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
167
+ functionCleanupArena.free();
168
+
169
+ diplomatReceive.free();
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Add an input from a region given as flat block positions (sorted by
175
+ * the default YXZ strategy, matching the old region semantics).
176
+ */
177
+ addInputFromRegion(name, ioType, layout, regionPositions) {
178
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
179
+
180
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
181
+ const regionPositionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, regionPositions, "i32")));
182
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
183
+
184
+
185
+ const result = wasm.IoLayoutBuilder_add_input_from_region(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, ioType.ffiValue, layout.ffiValue, regionPositionsSlice.ptr);
186
+
187
+ try {
188
+ if (!diplomatReceive.resultFlag) {
189
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
190
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
191
+ }
192
+ }
193
+
194
+ finally {
195
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
196
+ functionCleanupArena.free();
197
+
198
+ diplomatReceive.free();
199
+ }
200
+ }
201
+
202
+ /**
203
+ * Add an input from a region (flat positions) with automatic layout
204
+ * inference.
205
+ */
206
+ addInputFromRegionAuto(name, ioType, regionPositions) {
207
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
208
+
209
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
210
+ const regionPositionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, regionPositions, "i32")));
211
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
212
+
213
+
214
+ const result = wasm.IoLayoutBuilder_add_input_from_region_auto(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, ioType.ffiValue, regionPositionsSlice.ptr);
215
+
216
+ try {
217
+ if (!diplomatReceive.resultFlag) {
218
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
219
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
220
+ }
221
+ }
222
+
223
+ finally {
224
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
225
+ functionCleanupArena.free();
226
+
227
+ diplomatReceive.free();
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Add an output from a region given as flat block positions.
233
+ */
234
+ addOutputFromRegion(name, ioType, layout, regionPositions) {
235
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
236
+
237
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
238
+ const regionPositionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, regionPositions, "i32")));
239
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
240
+
241
+
242
+ const result = wasm.IoLayoutBuilder_add_output_from_region(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, ioType.ffiValue, layout.ffiValue, regionPositionsSlice.ptr);
243
+
244
+ try {
245
+ if (!diplomatReceive.resultFlag) {
246
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
247
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
248
+ }
249
+ }
250
+
251
+ finally {
252
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
253
+ functionCleanupArena.free();
254
+
255
+ diplomatReceive.free();
256
+ }
257
+ }
258
+
259
+ /**
260
+ * Add an output from a region (flat positions) with automatic layout
261
+ * inference.
262
+ */
263
+ addOutputFromRegionAuto(name, ioType, regionPositions) {
264
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
265
+
266
+ const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
267
+ const regionPositionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, regionPositions, "i32")));
268
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
269
+
270
+
271
+ const result = wasm.IoLayoutBuilder_add_output_from_region_auto(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, ioType.ffiValue, regionPositionsSlice.ptr);
272
+
273
+ try {
274
+ if (!diplomatReceive.resultFlag) {
275
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
276
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
277
+ }
278
+ }
279
+
280
+ finally {
281
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
282
+ functionCleanupArena.free();
283
+
284
+ diplomatReceive.free();
285
+ }
286
+ }
287
+
288
+ /**
289
+ * Build the {@link IoLayout}. Consumes the builder (a second call returns
290
+ * `AlreadyConsumed`).
291
+ */
292
+ build() {
293
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
294
+
295
+
296
+ const result = wasm.IoLayoutBuilder_build(diplomatReceive.buffer, this.ffiValue);
297
+
298
+ try {
299
+ if (!diplomatReceive.resultFlag) {
300
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
301
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
302
+ }
303
+ return new IoLayout(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
304
+ }
305
+
306
+ finally {
307
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
308
+ diplomatReceive.free();
309
+ }
310
+ }
311
+
312
+ constructor(symbol, ptr, selfEdge) {
313
+ return this.#internalConstructor(...arguments)
314
+ }
315
+ }
package/IoType.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
3
+
4
+
5
+
6
+ /**
7
+ * The wire type of a circuit input/output (PORTING rule 10).
8
+ */
9
+ export class IoType {
10
+ /** @internal */
11
+ get ffiValue(): pointer;
12
+ /** @internal */
13
+ constructor();
14
+
15
+
16
+ /**
17
+ * Unsigned integer of `bits` bits (LSB-first bit order).
18
+ */
19
+ static unsignedInt(bits: number): IoType;
20
+
21
+ /**
22
+ * Signed integer of `bits` bits (two's complement, LSB-first).
23
+ */
24
+ static signedInt(bits: number): IoType;
25
+
26
+ /**
27
+ * 32-bit IEEE 754 float (crosses the wire as its 32 raw bits).
28
+ */
29
+ static float32(): IoType;
30
+
31
+ /**
32
+ * Single boolean (1 bit).
33
+ */
34
+ static boolean(): IoType;
35
+
36
+ /**
37
+ * Fixed-length ASCII string of `chars` characters (8 bits per char;
38
+ * shorter strings are zero-padded, longer ones truncated).
39
+ */
40
+ static ascii(chars: number): IoType;
41
+ }
package/IoType.mjs ADDED
@@ -0,0 +1,125 @@
1
+ // generated by diplomat-tool
2
+ import wasm from "./diplomat-wasm.mjs";
3
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
4
+
5
+ const IoType_box_destroy_registry = new FinalizationRegistry((ptr) => {
6
+ wasm.IoType_destroy(ptr);
7
+ });
8
+
9
+ /**
10
+ * The wire type of a circuit input/output (PORTING rule 10).
11
+ */
12
+ export class IoType {
13
+ // Internal ptr reference:
14
+ #ptr = null;
15
+
16
+ // Lifetimes are only to keep dependencies alive.
17
+ // Since JS won't garbage collect until there are no incoming edges.
18
+ #selfEdge = [];
19
+
20
+ #internalConstructor(symbol, ptr, selfEdge) {
21
+ if (symbol !== diplomatRuntime.internalConstructor) {
22
+ console.error("IoType is an Opaque type. You cannot call its constructor.");
23
+ return;
24
+ }
25
+ this.#ptr = ptr;
26
+ this.#selfEdge = selfEdge;
27
+
28
+ // Are we being borrowed? If not, we can register.
29
+ if (this.#selfEdge.length === 0) {
30
+ IoType_box_destroy_registry.register(this, this.#ptr);
31
+ }
32
+
33
+ return this;
34
+ }
35
+ /** @internal */
36
+ get ffiValue() {
37
+ return this.#ptr;
38
+ }
39
+
40
+
41
+ /**
42
+ * Unsigned integer of `bits` bits (LSB-first bit order).
43
+ */
44
+ static unsignedInt(bits) {
45
+
46
+ const result = wasm.IoType_unsigned_int(bits);
47
+
48
+ try {
49
+ return new IoType(diplomatRuntime.internalConstructor, result, []);
50
+ }
51
+
52
+ finally {
53
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Signed integer of `bits` bits (two's complement, LSB-first).
59
+ */
60
+ static signedInt(bits) {
61
+
62
+ const result = wasm.IoType_signed_int(bits);
63
+
64
+ try {
65
+ return new IoType(diplomatRuntime.internalConstructor, result, []);
66
+ }
67
+
68
+ finally {
69
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
70
+ }
71
+ }
72
+
73
+ /**
74
+ * 32-bit IEEE 754 float (crosses the wire as its 32 raw bits).
75
+ */
76
+ static float32() {
77
+
78
+ const result = wasm.IoType_float32();
79
+
80
+ try {
81
+ return new IoType(diplomatRuntime.internalConstructor, result, []);
82
+ }
83
+
84
+ finally {
85
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Single boolean (1 bit).
91
+ */
92
+ static boolean() {
93
+
94
+ const result = wasm.IoType_boolean();
95
+
96
+ try {
97
+ return new IoType(diplomatRuntime.internalConstructor, result, []);
98
+ }
99
+
100
+ finally {
101
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Fixed-length ASCII string of `chars` characters (8 bits per char;
107
+ * shorter strings are zero-padded, longer ones truncated).
108
+ */
109
+ static ascii(chars) {
110
+
111
+ const result = wasm.IoType_ascii(chars);
112
+
113
+ try {
114
+ return new IoType(diplomatRuntime.internalConstructor, result, []);
115
+ }
116
+
117
+ finally {
118
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
119
+ }
120
+ }
121
+
122
+ constructor(symbol, ptr, selfEdge) {
123
+ return this.#internalConstructor(...arguments)
124
+ }
125
+ }
@@ -0,0 +1,65 @@
1
+ // generated by diplomat-tool
2
+ import type { NucleationError } from "./NucleationError"
3
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
4
+
5
+
6
+
7
+ /**
8
+ * Item model generation configuration. Wraps {@link crate::meshing::ItemModelConfig}.
9
+ */
10
+ export class ItemModelConfig {
11
+ /** @internal */
12
+ get ffiValue(): pointer;
13
+ /** @internal */
14
+ constructor();
15
+
16
+
17
+ /**
18
+ * Create a config for a model named `model_name` (used in resource-pack
19
+ * file paths). Other options start at their defaults: namespace
20
+ * "nucleation", centered, 16px texture resolution, item "paper",
21
+ * custom model data "1", auto scale.
22
+ */
23
+ static create(modelName: string): ItemModelConfig;
24
+
25
+ /**
26
+ * Set the resource-pack namespace (default: "nucleation").
27
+ */
28
+ setNamespace(namespace: string): void;
29
+
30
+ /**
31
+ * Center the schematic within the model bounds (default: true).
32
+ */
33
+ setCenter(center: boolean): void;
34
+
35
+ /**
36
+ * Set the texture resolution in pixels per block face (default: 16).
37
+ */
38
+ setTextureResolution(resolution: number): void;
39
+
40
+ /**
41
+ * Set the Minecraft item the model binds to (default: "paper").
42
+ */
43
+ setItem(item: string): void;
44
+
45
+ /**
46
+ * Set the custom-model-data string used to select this model in game
47
+ * (default: "1").
48
+ */
49
+ setCustomModelData(cmd: string): void;
50
+
51
+ /**
52
+ * Uniform scale.
53
+ */
54
+ setScale(scale: number): void;
55
+
56
+ /**
57
+ * Per-axis scale.
58
+ */
59
+ setScaleXyz(sx: number, sy: number, sz: number): void;
60
+
61
+ /**
62
+ * Auto-fit scale.
63
+ */
64
+ setScaleAuto(): void;
65
+ }