@i7r.tech/moveby 0.0.0-stage → 0.0.21-ywc

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.
@@ -0,0 +1,39 @@
1
+ // The deep-parse fallback: parse and compile on a thread whose stack is sized for it.
2
+ //
3
+ // `compileSource` catches the RangeError a too-deep program raises on the main thread and
4
+ // hands the loaded texts of the program here. This file is plain JavaScript on purpose: a
5
+ // worker thread loads it before any TypeScript loader the parent registered can apply, so it
6
+ // sets up its own.
7
+
8
+ import { parentPort } from 'node:worker_threads';
9
+
10
+ // In a checkout the entry point is `src/index.ts`, and reading it needs the loader hooks
11
+ // that `tsx` provides. In a built package `./index.js` is plain JavaScript, and the first
12
+ // import already works. Either way `api` ends up as the front end of this same tree.
13
+ let api;
14
+ try {
15
+ api = await import('./index.js');
16
+ } catch {
17
+ const { register } = await import('tsx/esm/api');
18
+ register();
19
+ api = await import('./index.js');
20
+ }
21
+
22
+ parentPort.on('message', async (program) => {
23
+ try {
24
+ parentPort.postMessage(await api.compileLoaded(program));
25
+ } catch (error) {
26
+ parentPort.postMessage({
27
+ ok: false,
28
+ errors: [
29
+ {
30
+ message:
31
+ `the expression nests deeper than the compiler can read ` +
32
+ `(${error.message})`,
33
+ },
34
+ ],
35
+ warnings: [],
36
+ links: [],
37
+ });
38
+ }
39
+ });
@@ -0,0 +1,131 @@
1
+ /* @ts-self-types="./wasm_engine.d.ts" */
2
+
3
+ /**
4
+ * The TOOLING export (road-file, decisions 8 and 79; moveby-build, decision 82): `encode_track` for
5
+ * the build, in Node. It is the one export of the `tooling` flavor, and no page's `.wasm` has it. The
6
+ * four numbers after the records are the field grid. Then the sprite grid (empty, or four numbers),
7
+ * then the font (empty, or its header and its glyphs).
8
+ * @param {Int32Array} route
9
+ * @param {Float32Array} lane_records
10
+ * @param {Float32Array} field_records
11
+ * @param {number} cols
12
+ * @param {number} rows
13
+ * @param {number} px_width
14
+ * @param {number} px_height
15
+ * @param {Uint32Array} sprite_grid
16
+ * @param {Float32Array} font
17
+ * @returns {Uint8Array}
18
+ */
19
+ function encode_track_bytes(route, lane_records, field_records, cols, rows, px_width, px_height, sprite_grid, font) {
20
+ const ptr0 = passArray32ToWasm0(route, wasm.__wbindgen_malloc);
21
+ const len0 = WASM_VECTOR_LEN;
22
+ const ptr1 = passArrayF32ToWasm0(lane_records, wasm.__wbindgen_malloc);
23
+ const len1 = WASM_VECTOR_LEN;
24
+ const ptr2 = passArrayF32ToWasm0(field_records, wasm.__wbindgen_malloc);
25
+ const len2 = WASM_VECTOR_LEN;
26
+ const ptr3 = passArray32ToWasm0(sprite_grid, wasm.__wbindgen_malloc);
27
+ const len3 = WASM_VECTOR_LEN;
28
+ const ptr4 = passArrayF32ToWasm0(font, wasm.__wbindgen_malloc);
29
+ const len4 = WASM_VECTOR_LEN;
30
+ const ret = wasm.encode_track_bytes(ptr0, len0, ptr1, len1, ptr2, len2, cols, rows, px_width, px_height, ptr3, len3, ptr4, len4);
31
+ if (ret[3]) {
32
+ throw takeFromExternrefTable0(ret[2]);
33
+ }
34
+ var v6 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
35
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
36
+ return v6;
37
+ }
38
+ exports.encode_track_bytes = encode_track_bytes;
39
+ function __wbg_get_imports() {
40
+ const import0 = {
41
+ __proto__: null,
42
+ __wbg_Error_fdd633d4bb5dd76a: function(arg0, arg1) {
43
+ const ret = Error(getStringFromWasm0(arg0, arg1));
44
+ return ret;
45
+ },
46
+ __wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
47
+ throw new Error(getStringFromWasm0(arg0, arg1));
48
+ },
49
+ __wbindgen_init_externref_table: function() {
50
+ const table = wasm.__wbindgen_externrefs;
51
+ const offset = table.grow(4);
52
+ table.set(0, undefined);
53
+ table.set(offset + 0, undefined);
54
+ table.set(offset + 1, null);
55
+ table.set(offset + 2, true);
56
+ table.set(offset + 3, false);
57
+ },
58
+ };
59
+ return {
60
+ __proto__: null,
61
+ "./wasm_engine_bg.js": import0,
62
+ };
63
+ }
64
+
65
+ function getArrayU8FromWasm0(ptr, len) {
66
+ ptr = ptr >>> 0;
67
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
68
+ }
69
+
70
+ let cachedFloat32ArrayMemory0 = null;
71
+ function getFloat32ArrayMemory0() {
72
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
73
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
74
+ }
75
+ return cachedFloat32ArrayMemory0;
76
+ }
77
+
78
+ function getStringFromWasm0(ptr, len) {
79
+ return decodeText(ptr >>> 0, len);
80
+ }
81
+
82
+ let cachedUint32ArrayMemory0 = null;
83
+ function getUint32ArrayMemory0() {
84
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
85
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
86
+ }
87
+ return cachedUint32ArrayMemory0;
88
+ }
89
+
90
+ let cachedUint8ArrayMemory0 = null;
91
+ function getUint8ArrayMemory0() {
92
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
93
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
94
+ }
95
+ return cachedUint8ArrayMemory0;
96
+ }
97
+
98
+ function passArray32ToWasm0(arg, malloc) {
99
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
100
+ getUint32ArrayMemory0().set(arg, ptr / 4);
101
+ WASM_VECTOR_LEN = arg.length;
102
+ return ptr;
103
+ }
104
+
105
+ function passArrayF32ToWasm0(arg, malloc) {
106
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
107
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
108
+ WASM_VECTOR_LEN = arg.length;
109
+ return ptr;
110
+ }
111
+
112
+ function takeFromExternrefTable0(idx) {
113
+ const value = wasm.__wbindgen_externrefs.get(idx);
114
+ wasm.__externref_table_dealloc(idx);
115
+ return value;
116
+ }
117
+
118
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
119
+ cachedTextDecoder.decode();
120
+ function decodeText(ptr, len) {
121
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
122
+ }
123
+
124
+ let WASM_VECTOR_LEN = 0;
125
+
126
+ const wasmPath = `${__dirname}/wasm_engine_bg.wasm`;
127
+ const wasmBytes = require('fs').readFileSync(wasmPath);
128
+ const wasmModule = new WebAssembly.Module(wasmBytes);
129
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
130
+ let wasm = wasmInstance.exports;
131
+ wasm.__wbindgen_start();
Binary file
@@ -0,0 +1,330 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * The SHAPE of a lane divider (engine-lanes.v1.1 §4, lane-divider-type.md). `#[wasm_bindgen]` exports it to
6
+ * TS as a NUMERIC enum (`DividerPattern.Dashed = 0`, `Solid = 1`, `Double = 2`), so the JS config writes
7
+ * `dividerPattern: wasm.DividerPattern.Double`. The decoder reads that number through `TryFrom<u8>` (rejects
8
+ * out-of-range at the boundary — its validity IS the type, the `Side` precedent, no domain-error row). COLOUR
9
+ * and dash lengths are SEPARATE `LaneSpan` axes, not folded into this enum (option B of OQ#3).
10
+ */
11
+ export enum DividerPattern {
12
+ Dashed = 0,
13
+ Solid = 1,
14
+ Double = 2,
15
+ }
16
+
17
+ export class Engine {
18
+ private constructor();
19
+ free(): void;
20
+ [Symbol.dispose](): void;
21
+ /**
22
+ * The live viewport aspect (canvasW / canvasH), for the scenery vertex shader's `u_aspect` — the
23
+ * ONLY place project-in-shader lets aspect enter the scenery projection (never baked into
24
+ * `camera_basis`, so a stray second divide can't creep in). JS already knows this value locally (it
25
+ * computed it to call `set_aspect`); this getter exists so the scenery pass can read it back the
26
+ * same way every other per-frame uniform is read, off `&self`.
27
+ */
28
+ aspect(): number;
29
+ /**
30
+ * The per-frame camera basis for the scenery vertex shader's projection: `[pos.x,y,z, forward.x,y,z]`
31
+ * (6 floats — NOT the 12 a naive `{pos,forward,right,up}` flattening would send). `right` and
32
+ * world-`up` are deliberately NOT included: `Camera::right()` DERIVES right from forward
33
+ * (`(forward.z, 0, −forward.x)`, camera.rs) rather than storing it, and `Camera::project`'s `cy` is
34
+ * just `ray.y` (world-up is the constant (0,1,0), never dotted). Sending only the minimal
35
+ * independent basis means the GLSL `project()` must derive `right` the same way — which is exactly
36
+ * what keeps it an auditable line-for-line mirror of `Camera::project` (camera.rs) rather than a
37
+ * second copy that could silently drift out of orthogonality.
38
+ */
39
+ camera_basis(): Float32Array;
40
+ /**
41
+ * The focal length (`CAMERA_DEPTH`, consts.rs) for the scenery vertex shader's `u_cameraDepth`
42
+ * uniform — sent so a FOV change in Rust can't silently desync from a hardcoded GLSL literal (OQ4,
43
+ * project-in-shader.md; the same precedent `depth_bounds` already set for `u_scaleNear/Far`).
44
+ */
45
+ camera_depth(): number;
46
+ /**
47
+ * The JS entry of the frame's value block (lib-value-entry): check the staging block that
48
+ * `value_view` handed out; on success copy it into the live block and seat the camera from its
49
+ * slots 0 and 1 (decision 62). ALL-OR-NOTHING, like `set_value_block`: a bad value changes
50
+ * nothing — the live block AND the camera — so the next draw never mixes two frames' values and
51
+ * never rides a seat no good frame named. Returns −1 on success, else the first bad value's
52
+ * index in the block. A number only: the binding names the fault (`SCENE_VALUE`); the engine
53
+ * sends no prose across the seam.
54
+ */
55
+ commit_value_block(): number;
56
+ /**
57
+ * Per-frame dash anchor for the road vertex shader's `u_dashAnchor` — the largest whole number of
58
+ * FULL dash periods at or below the PLAYER's road-SURFACE distance (not horizontal `position`: the
59
+ * dash ruler is `surface_length`, the slant distance, so a climbing road's stripes don't
60
+ * foreshorten). Thin wrapper on the existing free `dash_anchor` (layers/road.rs) — not re-derived.
61
+ */
62
+ dash_anchor(): number;
63
+ /**
64
+ * The two perspective-scale bounds the depth map brackets: `[SCALE_NEAR, SCALE_FAR]`.
65
+ * The renderer feeds these to the vertex shader's `u_scaleNear` / `u_scaleFar` uniforms so
66
+ * the GLSL depth map reads the SAME source as the Rust `depth_ndc` mirror — no GLSL↔Rust
67
+ * constant can drift (unlike the DASH_* duplication). Static (derived from camera consts),
68
+ * so the renderer reads this ONCE and caches it — no per-frame marshalling. See depth-test.md.
69
+ */
70
+ depth_bounds(): Float32Array;
71
+ /**
72
+ * v1.1 (scenery-atlas-cells) — ATLAS-CELL field draw buckets from the last `fill_field_*`: a flat
73
+ * `[u0, v0, u1, v1, start_vertex, count]` per bucket (the sub-rect as a per-draw `u_cellRect` uniform +
74
+ * the vertex range). The renderer draws these with the fract-tile program on the SHARED atlas (NEAREST/
75
+ * no-mips). CACHED like `field_draw_ranges` — valid only after this frame's `fill_field_*`, empty before.
76
+ */
77
+ field_atlas_draw_ranges(): Float32Array;
78
+ /**
79
+ * Per-texture field draw buckets from the LAST `fill_field_*`: a flat `[texture_id, start_vertex,
80
+ * count, …]` triple per non-empty bucket, ascending by id (the renderer binds `registry[id]` then
81
+ * draws `count` verts from `start_vertex`, once per ground texture). **CACHED, not re-emitted** —
82
+ * a query whose validity depends on a prior `fill_field_*` (re-emitting would re-allocate a
83
+ * field-sized buffer every frame, the GC churn zero-copy kills): the CURRENT frame's buckets only
84
+ * after this frame's fill, **empty before the first fill**. Per-frame order:
85
+ * `seek → fill_field_and_view → bufferSubData → field_draw_ranges → bind+draw`.
86
+ */
87
+ field_draw_ranges(): Uint32Array;
88
+ fill_and_view(): Float32Array;
89
+ fill_field_and_view(): Float32Array;
90
+ fill_scenery_and_view(): Float32Array;
91
+ fill_text_and_view(): Float32Array;
92
+ /**
93
+ * The first asset of `rows` whose cell block does not fit the atlas grid of the track in
94
+ * `bytes`: its index among the rows' assets, or −1 when every one fits. A query: it builds
95
+ * nothing and consumes nothing. Construction refuses such an asset too (O12), with a code that
96
+ * names no asset; this lets the library name the record. `bytes` is a `Uint8Array`.
97
+ */
98
+ static first_asset_outside_grid(bytes: Uint8Array, rows: Rows): number;
99
+ /**
100
+ * Construction from the **X2 binary wire** (`config_wire`, engine-config-wire.md) — the byte twin of
101
+ * `new`'s JS-object path, coexisting with it (additive, non-breaking). Decodes the (possibly
102
+ * UNTRUSTED) blob into the SAME `EngineConfig` and runs the SAME `from_parts` — so the two
103
+ * constructors CONVERGE by construction: ONLY field EXTRACTION differs (a bounds-checked byte cursor
104
+ * vs `Reflect::get`); the O-table validation + sizing + build are shared verbatim. A byte fault
105
+ * crosses the seam as a short STABLE code (`WireError::code()`, e.g. `WIRE_TRUNCATED`) — never a
106
+ * panic, never an empty-as-success render (Core Principle 3 / PRINCIPLES §7). A fetched blob is
107
+ * untrusted (unlike the build-baked polyline), so this is adversarial hardening
108
+ * (feedback_build_time_input_not_untrusted). `bytes` is a `Uint8Array` at the JS seam.
109
+ */
110
+ static from_config_bytes(bytes: Uint8Array): Engine;
111
+ /**
112
+ * Construction from the track bytes AND the scene's placed rows (scene-wasm-handoff, decision
113
+ * 76). `rows` holds what a scene module declares: its assets, its objects and its labels. The
114
+ * track holds the rest — the route, the atlas grid, the font. The engine consumes `rows`. The
115
+ * track must declare no placed rows of its own, and must hold each section a row needs (the
116
+ * atlas grid for an asset or an object, the font for a label): else `SCENE_TRACK`. Then the same
117
+ * rules apply as for `from_config_bytes` (O12, O13, T6). `bytes` is a `Uint8Array`.
118
+ */
119
+ static from_config_bytes_with_rows(bytes: Uint8Array, rows: Rows): Engine;
120
+ /**
121
+ * The screen height (ndc_y ∈ [-1, 1]) of the visible horizon: the HIGHEST point of the road
122
+ * ribbon (centre + both edges) over the visible window, projected. On a climb that is the far
123
+ * end; on a crest, the crest; on a descent, a near sample. The renderer fills the GROUND
124
+ * background up to this line and paints SKY above it — so the off-road region the field cannot
125
+ * reach (depth-capped, and folded on the inside of a bend) reads as ground, not as the sharp-bend
126
+ * sky slivers. Per-frame (depends on `position`) but cheap: ~3 projects per window sample, all
127
+ * flops, no allocation. Returns 0.0 when nothing is visible (player past the track end).
128
+ */
129
+ horizon_ndc_y(): number;
130
+ /**
131
+ * The layers this track declares, as the track file's section tags, ascending: 1 ROUTE (always),
132
+ * 2 LANES, 3 FIELD, 4 SCENERY, 5 TEXT. A track built from a JS object answers the same way. The
133
+ * binding compares this list with the layers a page lists.
134
+ */
135
+ layers(): Uint8Array;
136
+ max_draw_bytes(): number;
137
+ max_field_draw_bytes(): number;
138
+ max_scenery_draw_bytes(): number;
139
+ max_text_draw_bytes(): number;
140
+ /**
141
+ * The near-clip margin (`NEAR_PLANE`, consts.rs) for the scenery vertex shader's `u_nearPlane`
142
+ * uniform — the shader's per-vertex `step(u_nearPlane, cz)` defense-in-depth twin of the
143
+ * authoritative per-corner cull `SceneryLayer::emit` already applies before emitting a card at all
144
+ * (a GLSL vertex invocation can't see its quad's sibling corners, so it can't reject "if ANY corner
145
+ * is unsafe" — only flag its OWN). Sent as a uniform, not a GLSL literal, for the same reason
146
+ * `camera_depth()` is (OQ4) — a `NEAR_PLANE` tune in Rust can't silently desync from the shader.
147
+ */
148
+ near_plane(): number;
149
+ position(): number;
150
+ /**
151
+ * Jump the vehicle to `meters` along the track, clamped to `[0, track_length]` — the timeline-scrub
152
+ * seam. The ONE way the playhead moves (lib-route-camera removed the integrator): a pure position
153
+ * setter (CQS command). A NaN target is ignored: the playhead keeps its position.
154
+ */
155
+ seek(meters: number): void;
156
+ /**
157
+ * Set the viewport aspect ratio (canvasW / canvasH). The binding calls this each frame from the live
158
+ * canvas size so the projection corrects ndc_x (aspect-ratio-correction RFC). Fail-soft on a
159
+ * degenerate value (non-finite / ≤ 0, e.g. a 0-height frame): keep the prior aspect rather than
160
+ * poison the projection with NaN/∞.
161
+ */
162
+ set_aspect(aspect: number): void;
163
+ /**
164
+ * Set the camera's ride offsets — `x` metres along the road's right vector, `y` metres above the
165
+ * route's surface (decisions 25–27, lib-route-camera). The camera's heading stays the road's
166
+ * tangent; only the eye's seat moves. A scene seats the camera through the value block:
167
+ * `commit_value_block` reads slots 0–1 (lib-value-entry, decision 62) and calls this. This
168
+ * method stays for a page with no scene; the last write of either wins, and a host that writes
169
+ * neither gets the centreline camera. Fail-soft on a non-finite value (either one): keep the
170
+ * prior offsets — a NaN here would put a NaN in the eye and garble every later frame (the
171
+ * `set_aspect` contract).
172
+ */
173
+ set_camera_offset(x: number, y: number): void;
174
+ /**
175
+ * The sky pass's horizontal parallax offset (`u_skyOffset`, sky-cloud.md Decision 5) — a pure
176
+ * function of the camera's YAW (heading), never the wall clock (Core Principle 13), so `cargo
177
+ * test` can pin it exactly like `horizon_ndc_y()`.
178
+ *
179
+ * `heading` is the track's absolute turn angle (θ, `track.rs`: `tangent_x = sin θ`, `κ > 0` = a
180
+ * right turn increases θ). A cloud "at infinity" in a FIXED world direction has true screen
181
+ * position `-CAMERA_DEPTH·tan(θ)/aspect` (the same `Camera::project` limit as any far point) — this
182
+ * uses the bounded first-order term `-sin(θ)` instead: identical SIGN (a right turn still yaws the
183
+ * cloud negative ⇒ left on screen, matching the shader's `p = v_uv - vec2(u_skyOffset, 0)`
184
+ * convention), no pole at θ = ±90°, and `sin`/`tan` agree to within 3% under 30° — comfortably
185
+ * inside the shipped route's heading swing (`lib_test.rs`'s `sky_parallax` mod pins it with a tripwire).
186
+ */
187
+ sky_parallax(): number;
188
+ /**
189
+ * Per-label text draw ranges from the LAST `fill_text_*`: a flat `[start_vertex, count, r, g, b, a]`
190
+ * 6-tuple per emitted label (road-anchored, depth-tested; `r,g,b,a` = the label's `u_color` —
191
+ * road labels carry a = 1.0, a placed label's `alpha` arrives in its record, lib-world-objects
192
+ * Decision 2). The renderer sets `u_color` and draws `count` verts from `start_vertex`. **CACHED, not re-emitted** (the
193
+ * `field_draw_ranges` idiom — re-emitting would re-allocate a text-sized buffer every frame): valid only
194
+ * after THIS frame's `fill_text_*`, **empty before the first fill**. Per-frame order:
195
+ * `seek → fill_text_and_view → bufferSubData → text_draw_ranges → draw`.
196
+ * sets `u_color` and draws `count` verts from `start_vertex`. **CACHED, not re-emitted** (the
197
+ * `field_draw_ranges` idiom — re-emitting would re-allocate a text-sized buffer every frame): valid only
198
+ * after THIS frame's `fill_text_*`, **empty before the first fill**. Per-frame order:
199
+ * `seek → fill_text_and_view → bufferSubData → text_draw_ranges → draw`.
200
+ */
201
+ text_draw_ranges(): Float32Array;
202
+ /**
203
+ * Total HORIZONTAL arc length of the loaded track (metres) — the upper bound of any field
204
+ * span's `end` (contract §3.1). Pure query (CQS): the table is built once at construction and
205
+ * is never empty (`from_parts`/`demo` guarantee ≥ 1 sample), so the index never underflows.
206
+ */
207
+ track_length(): number;
208
+ /**
209
+ * A `Float32Array` view of the frame's STAGING block (lib-value-entry) — the JS entry's write
210
+ * side. JavaScript writes one frame of values into it (`value_block_len()` long, the layout of
211
+ * `values`), then calls `commit_value_block`. A pure query (`&self`): it changes nothing. The
212
+ * view aliases WebAssembly memory and dies when that memory grows, so JavaScript takes a new
213
+ * view each frame (the `fill_*_and_view` contract). The block was sized by `install_layers`, so
214
+ * the view allocates nothing in WebAssembly memory.
215
+ */
216
+ value_view(): Float32Array;
217
+ }
218
+
219
+ /**
220
+ * The placed rows of a scene before the engine is built: the assets, the placed objects in the
221
+ * engine's record order, and the placed labels in theirs. Each method appends one row, so an index
222
+ * is the order of the calls. The arguments inside a call are positional.
223
+ */
224
+ export class Rows {
225
+ free(): void;
226
+ [Symbol.dispose](): void;
227
+ /**
228
+ * One asset: the atlas cell at its block's top-left, and the block's span in cells. Its index
229
+ * is the order of the `asset` calls — what an `image` call names, and what the scene module
230
+ * holds for it.
231
+ */
232
+ asset(cell: number, cols: number, rows: number): void;
233
+ /**
234
+ * One placed object, bound to the asset at index `asset`. Its record (9 values a frame) follows
235
+ * the order of the `image` calls.
236
+ */
237
+ image(asset: number): void;
238
+ /**
239
+ * No rows.
240
+ */
241
+ constructor();
242
+ /**
243
+ * One placed label with its text. Its record (9 values a frame) follows the order of the `text`
244
+ * calls.
245
+ */
246
+ text(text: string): void;
247
+ }
248
+
249
+ /**
250
+ * Which side(s) of the road a field span covers, in driving direction. `#[wasm_bindgen]` exports
251
+ * it to TS as a NUMERIC enum (`Side.Left = 0`, `Right = 1`, `Both = 2`), so the JS config writes
252
+ * `side: wasm.Side.Both`. The decoder reads that number and maps it through `TryFrom<u8>` below, which
253
+ * rejects an out-of-range value at the boundary (contract §5: `side` has no domain-error row; its
254
+ * validity IS the type).
255
+ */
256
+ export enum Side {
257
+ Left = 0,
258
+ Right = 1,
259
+ Both = 2,
260
+ }
261
+
262
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
263
+
264
+ export interface InitOutput {
265
+ readonly memory: WebAssembly.Memory;
266
+ readonly __wbg_engine_free: (a: number, b: number) => void;
267
+ readonly __wbg_rows_free: (a: number, b: number) => void;
268
+ readonly engine_aspect: (a: number) => number;
269
+ readonly engine_camera_basis: (a: number) => [number, number];
270
+ readonly engine_camera_depth: (a: number) => number;
271
+ readonly engine_commit_value_block: (a: number) => number;
272
+ readonly engine_dash_anchor: (a: number) => number;
273
+ readonly engine_depth_bounds: (a: number) => [number, number];
274
+ readonly engine_field_atlas_draw_ranges: (a: number) => [number, number];
275
+ readonly engine_field_draw_ranges: (a: number) => [number, number];
276
+ readonly engine_fill_and_view: (a: number) => any;
277
+ readonly engine_fill_field_and_view: (a: number) => any;
278
+ readonly engine_fill_scenery_and_view: (a: number) => any;
279
+ readonly engine_fill_text_and_view: (a: number) => any;
280
+ readonly engine_first_asset_outside_grid: (a: number, b: number, c: number) => [number, number, number];
281
+ readonly engine_from_config_bytes: (a: number, b: number) => [number, number, number];
282
+ readonly engine_from_config_bytes_with_rows: (a: number, b: number, c: number) => [number, number, number];
283
+ readonly engine_horizon_ndc_y: (a: number) => number;
284
+ readonly engine_layers: (a: number) => [number, number];
285
+ readonly engine_max_draw_bytes: (a: number) => number;
286
+ readonly engine_max_field_draw_bytes: (a: number) => number;
287
+ readonly engine_max_scenery_draw_bytes: (a: number) => number;
288
+ readonly engine_max_text_draw_bytes: (a: number) => number;
289
+ readonly engine_near_plane: (a: number) => number;
290
+ readonly engine_position: (a: number) => number;
291
+ readonly engine_seek: (a: number, b: number) => void;
292
+ readonly engine_set_aspect: (a: number, b: number) => void;
293
+ readonly engine_set_camera_offset: (a: number, b: number, c: number) => void;
294
+ readonly engine_sky_parallax: (a: number) => number;
295
+ readonly engine_text_draw_ranges: (a: number) => [number, number];
296
+ readonly engine_track_length: (a: number) => number;
297
+ readonly engine_value_view: (a: number) => any;
298
+ readonly rows_asset: (a: number, b: number, c: number, d: number) => void;
299
+ readonly rows_image: (a: number, b: number) => void;
300
+ readonly rows_new: () => number;
301
+ readonly rows_text: (a: number, b: number, c: number) => void;
302
+ readonly __wbindgen_externrefs: WebAssembly.Table;
303
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
304
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
305
+ readonly __externref_table_dealloc: (a: number) => void;
306
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
307
+ readonly __wbindgen_start: () => void;
308
+ }
309
+
310
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
311
+
312
+ /**
313
+ * Instantiates the given `module`, which can either be bytes or
314
+ * a precompiled `WebAssembly.Module`.
315
+ *
316
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
317
+ *
318
+ * @returns {InitOutput}
319
+ */
320
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
321
+
322
+ /**
323
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
324
+ * for everything else, calls `WebAssembly.instantiate` directly.
325
+ *
326
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
327
+ *
328
+ * @returns {Promise<InitOutput>}
329
+ */
330
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;