@reearth/ezu 0.12.0 → 0.13.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.
- package/README.md +150 -3
- package/bundler/ezu.d.ts +517 -7
- package/bundler/ezu.js +1 -1
- package/bundler/ezu_bg.js +890 -11
- package/bundler/ezu_bg.wasm +0 -0
- package/bundler/ezu_bg.wasm.d.ts +38 -3
- package/nodejs/ezu.d.ts +517 -7
- package/nodejs/ezu.js +896 -11
- package/nodejs/ezu_bg.wasm +0 -0
- package/nodejs/ezu_bg.wasm.d.ts +38 -3
- package/package.json +1 -1
- package/simd/bundler/ezu.d.ts +517 -7
- package/simd/bundler/ezu.js +1 -1
- package/simd/bundler/ezu_bg.js +890 -11
- package/simd/bundler/ezu_bg.wasm +0 -0
- package/simd/bundler/ezu_bg.wasm.d.ts +38 -3
- package/simd/nodejs/ezu.d.ts +517 -7
- package/simd/nodejs/ezu.js +896 -11
- package/simd/nodejs/ezu_bg.wasm +0 -0
- package/simd/nodejs/ezu_bg.wasm.d.ts +38 -3
- package/simd/web/ezu.d.ts +555 -10
- package/simd/web/ezu.js +890 -11
- package/simd/web/ezu_bg.wasm +0 -0
- package/simd/web/ezu_bg.wasm.d.ts +38 -3
- package/simd/workerd/ezu.js +1 -1
- package/web/ezu.d.ts +555 -10
- package/web/ezu.js +890 -11
- package/web/ezu_bg.wasm +0 -0
- package/web/ezu_bg.wasm.d.ts +38 -3
- package/workerd/ezu.js +1 -1
package/nodejs/ezu.js
CHANGED
|
@@ -1,11 +1,133 @@
|
|
|
1
1
|
/* @ts-self-types="./ezu.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* What `renderFrame` hands each tile's `sources`: `bindSource` into the
|
|
5
|
+
* renderer the frame has taken for itself, for what that tile's set needs
|
|
6
|
+
* bound there.
|
|
7
|
+
*/
|
|
8
|
+
class FrameBinder {
|
|
9
|
+
static __wrap(ptr) {
|
|
10
|
+
const obj = Object.create(FrameBinder.prototype);
|
|
11
|
+
obj.__wbg_ptr = ptr;
|
|
12
|
+
FrameBinderFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
__destroy_into_raw() {
|
|
16
|
+
const ptr = this.__wbg_ptr;
|
|
17
|
+
this.__wbg_ptr = 0;
|
|
18
|
+
FrameBinderFinalization.unregister(this);
|
|
19
|
+
return ptr;
|
|
20
|
+
}
|
|
21
|
+
free() {
|
|
22
|
+
const ptr = this.__destroy_into_raw();
|
|
23
|
+
wasm.__wbg_framebinder_free(ptr, 0);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* `Renderer.bindSource`, for the sources bound into the renderer
|
|
27
|
+
* itself: the glyphs a tile turns out to need, or a font, sprite,
|
|
28
|
+
* brush or image. Throws `UnknownSource` for a tile-scoped source,
|
|
29
|
+
* which the frame renders from the returned set and would never read
|
|
30
|
+
* here, and `StaleBinder` once this tile's `sources` has returned (or
|
|
31
|
+
* its promise settled).
|
|
32
|
+
* @param {string} name
|
|
33
|
+
* @param {Uint8Array} bytes
|
|
34
|
+
* @param {object | null} [opts]
|
|
35
|
+
*/
|
|
36
|
+
bindSource(name, bytes, opts) {
|
|
37
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
38
|
+
const len0 = WASM_VECTOR_LEN;
|
|
39
|
+
const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc_command_export);
|
|
40
|
+
const len1 = WASM_VECTOR_LEN;
|
|
41
|
+
const ret = wasm.framebinder_bindSource(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
|
|
42
|
+
if (ret[1]) {
|
|
43
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (Symbol.dispose) FrameBinder.prototype[Symbol.dispose] = FrameBinder.prototype.free;
|
|
48
|
+
exports.FrameBinder = FrameBinder;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* What `frameFeatures` returns: features nodes' values gathered over the
|
|
52
|
+
* tiles of a frame a host renders itself, assembled into the pages
|
|
53
|
+
* `renderFrameWithFeatures` hands back.
|
|
54
|
+
*
|
|
55
|
+
* The Rust renderer's collector is handed each tile's values after the
|
|
56
|
+
* render; here the tile renders through the collector, so the values stay
|
|
57
|
+
* in the module rather than crossing to JS and back. It keeps the
|
|
58
|
+
* renderer that made it alive until it is finished or freed.
|
|
59
|
+
*/
|
|
60
|
+
class FrameFeatureCollector {
|
|
61
|
+
static __wrap(ptr) {
|
|
62
|
+
const obj = Object.create(FrameFeatureCollector.prototype);
|
|
63
|
+
obj.__wbg_ptr = ptr;
|
|
64
|
+
FrameFeatureCollectorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
65
|
+
return obj;
|
|
66
|
+
}
|
|
67
|
+
__destroy_into_raw() {
|
|
68
|
+
const ptr = this.__wbg_ptr;
|
|
69
|
+
this.__wbg_ptr = 0;
|
|
70
|
+
FrameFeatureCollectorFinalization.unregister(this);
|
|
71
|
+
return ptr;
|
|
72
|
+
}
|
|
73
|
+
free() {
|
|
74
|
+
const ptr = this.__destroy_into_raw();
|
|
75
|
+
wasm.__wbg_framefeaturecollector_free(ptr, 0);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The pages: one `{ node, geojson }` per entry of the request's
|
|
79
|
+
* `nodes`, in that order, as `renderFrameWithFeatures` hands them
|
|
80
|
+
* back. Tiles are read rows top to bottom, then left to right,
|
|
81
|
+
* whatever order they rendered in. The collector is used up.
|
|
82
|
+
* @returns {PageFeatures[]}
|
|
83
|
+
*/
|
|
84
|
+
finish() {
|
|
85
|
+
const ptr = this.__destroy_into_raw();
|
|
86
|
+
const ret = wasm.framefeaturecollector_finish(ptr);
|
|
87
|
+
if (ret[2]) {
|
|
88
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
89
|
+
}
|
|
90
|
+
return takeFromExternrefTable0(ret[0]);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* `renderTileWith` for one of the frame's tiles, also keeping what the
|
|
94
|
+
* collector's nodes held. Pass `tileSize: frame.tileSize` in `opts` to
|
|
95
|
+
* draw the tile `renderFrame` draws. Like `renderTileWith` it works
|
|
96
|
+
* while a `renderFrame` holds the renderer, and leaves the glyph
|
|
97
|
+
* budget to `trimGlyphs()`.
|
|
98
|
+
* @param {number} z
|
|
99
|
+
* @param {number} x
|
|
100
|
+
* @param {number} y
|
|
101
|
+
* @param {SourceSet} set
|
|
102
|
+
* @param {object | null} [opts]
|
|
103
|
+
* @returns {Uint8Array}
|
|
104
|
+
*/
|
|
105
|
+
renderTile(z, x, y, set, opts) {
|
|
106
|
+
_assertClass(set, SourceSet);
|
|
107
|
+
const ret = wasm.framefeaturecollector_renderTile(this.__wbg_ptr, z, x, y, set.__wbg_ptr, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
|
|
108
|
+
if (ret[3]) {
|
|
109
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
110
|
+
}
|
|
111
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
112
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
113
|
+
return v1;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (Symbol.dispose) FrameFeatureCollector.prototype[Symbol.dispose] = FrameFeatureCollector.prototype.free;
|
|
117
|
+
exports.FrameFeatureCollector = FrameFeatureCollector;
|
|
118
|
+
|
|
3
119
|
/**
|
|
4
120
|
* Buffered log sink that captures `tracing` events from the renderer.
|
|
5
121
|
*
|
|
6
122
|
* Construct once near the top of your bootstrap, then either set a
|
|
7
123
|
* callback for live forwarding (`onEvent(e => console.log(e))`) or
|
|
8
124
|
* `drainLines()` periodically to flush into a UI panel.
|
|
125
|
+
*
|
|
126
|
+
* It is the Go package's `InitLog` and `DrainLogs` (the pull side) and
|
|
127
|
+
* `WithLogger` (the push side) in one object. A class rather than two
|
|
128
|
+
* free functions, because a browser host also wants the structured
|
|
129
|
+
* records and the callback, which a wasip1 module's line buffer has no
|
|
130
|
+
* room for; a Rust host installs its own `tracing` subscriber instead.
|
|
9
131
|
*/
|
|
10
132
|
class LogSink {
|
|
11
133
|
__destroy_into_raw() {
|
|
@@ -103,6 +225,14 @@ exports.LogSink = LogSink;
|
|
|
103
225
|
|
|
104
226
|
/**
|
|
105
227
|
* Stateful WASM renderer.
|
|
228
|
+
*
|
|
229
|
+
* Every method takes `&self` and borrows the renderer inside, rather than
|
|
230
|
+
* letting wasm-bindgen hold a borrow for the length of the call:
|
|
231
|
+
* `renderFrame` awaits JS between its tiles, and the loads and read-only
|
|
232
|
+
* queries a tile's `sources` makes (`loadSource`, `sourceTile`, …) have to
|
|
233
|
+
* reach the same
|
|
234
|
+
* renderer while the frame is still rendering. The `Rc` is what the
|
|
235
|
+
* frame's promise keeps alive between tiles.
|
|
106
236
|
*/
|
|
107
237
|
class Renderer {
|
|
108
238
|
__destroy_into_raw() {
|
|
@@ -137,7 +267,7 @@ class Renderer {
|
|
|
137
267
|
* - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
|
|
138
268
|
* offset (centre `coord: [0, 0]`, the default). Layers are bound as
|
|
139
269
|
* `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
|
|
140
|
-
* (neighbours) when [`render_tile`] runs. Binding only the centre
|
|
270
|
+
* (neighbours) when [`render_tile`](Self::render_tile) runs. Binding only the centre
|
|
141
271
|
* degrades cross-tile label collision to centre-only at borders.
|
|
142
272
|
* - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
|
|
143
273
|
* offset. The centre tile is `coord: [0, 0]` (default). Decoding
|
|
@@ -194,11 +324,105 @@ class Renderer {
|
|
|
194
324
|
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
195
325
|
return v1;
|
|
196
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Go back to the render cache's default size. Throws
|
|
329
|
+
* `FrameInProgress` while a `renderFrame` holds the renderer.
|
|
330
|
+
*/
|
|
331
|
+
clearCacheBudget() {
|
|
332
|
+
const ret = wasm.renderer_clearCacheBudget(this.__wbg_ptr);
|
|
333
|
+
if (ret[1]) {
|
|
334
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Lift the cap `setGlyphBudget` put on the glyph bank, back to where a
|
|
339
|
+
* fresh renderer starts. It frees nothing: what is resident stays
|
|
340
|
+
* resident, and stops being trimmed. Throws `FrameInProgress` while a
|
|
341
|
+
* `renderFrame` holds the renderer.
|
|
342
|
+
*/
|
|
343
|
+
clearGlyphBudget() {
|
|
344
|
+
const ret = wasm.renderer_clearGlyphBudget(this.__wbg_ptr);
|
|
345
|
+
if (ret[1]) {
|
|
346
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
197
349
|
/**
|
|
198
350
|
* Drop every pending source binding. Call between tile renders.
|
|
199
351
|
*/
|
|
200
352
|
clearSources() {
|
|
201
|
-
wasm.renderer_clearSources(this.__wbg_ptr);
|
|
353
|
+
const ret = wasm.renderer_clearSources(this.__wbg_ptr);
|
|
354
|
+
if (ret[1]) {
|
|
355
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Go back to rendering at the style's own `tile-size`, undoing
|
|
360
|
+
* `setTileSize`.
|
|
361
|
+
*/
|
|
362
|
+
clearTileSize() {
|
|
363
|
+
const ret = wasm.renderer_clearTileSize(this.__wbg_ptr);
|
|
364
|
+
if (ret[1]) {
|
|
365
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Where a print frame sits on the tile grid: the zoom and tile size
|
|
370
|
+
* that meet `req`'s scale, and the tiles that cover it — the
|
|
371
|
+
* arithmetic `ezu frame` does before it renders anything, done by the
|
|
372
|
+
* same code, so a frame computed here is the one the CLI would render.
|
|
373
|
+
*
|
|
374
|
+
* `req` is `{ centerLon, centerLat, scale, dpi, width, height, zoom?,
|
|
375
|
+
* styleTileSize? }`: `scale` is the denominator (1000 for 1:1000),
|
|
376
|
+
* `width` and `height` the output size in pixels. `zoom` fixes the
|
|
377
|
+
* zoom, as the CLI's `--zoom` does; left out, the zoom chosen keeps
|
|
378
|
+
* the tile size nearest `styleTileSize`, which defaults to this
|
|
379
|
+
* renderer's style.
|
|
380
|
+
*
|
|
381
|
+
* The answer is `{ zoom, tileSize, scale, width, height, left, top,
|
|
382
|
+
* shift: [x, y], tilesX: [start, end], tilesY: [start, end] }`. Hand
|
|
383
|
+
* it to `renderFrame`, or render tiles `tilesX × tilesY` (end
|
|
384
|
+
* exclusive) at `zoom` and `tileSize` yourself: tile `(x, y)` lands
|
|
385
|
+
* with its top-left at `(x · tileSize − left, y · tileSize − top)`,
|
|
386
|
+
* cropped to `width × height`. `scale` is the denominator actually
|
|
387
|
+
* met, and `shift` how far rounding the frame onto whole pixels moved
|
|
388
|
+
* it.
|
|
389
|
+
*
|
|
390
|
+
* It changes nothing on the renderer. A request out of its domain (a
|
|
391
|
+
* non-positive scale, a latitude past the Mercator edge, a zero-sized
|
|
392
|
+
* output), a frame across the antimeridian, and a scale that needs a
|
|
393
|
+
* tile size outside 16..8192 px all throw `InvalidStyle`.
|
|
394
|
+
* @param {FrameRequest} req
|
|
395
|
+
* @returns {Frame}
|
|
396
|
+
*/
|
|
397
|
+
computeFrame(req) {
|
|
398
|
+
const ret = wasm.renderer_computeFrame(this.__wbg_ptr, req);
|
|
399
|
+
if (ret[2]) {
|
|
400
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
401
|
+
}
|
|
402
|
+
return takeFromExternrefTable0(ret[0]);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Start gathering what features nodes hold over `frame`'s page, for a
|
|
406
|
+
* host that renders the frame's tiles itself — with `tileSize` set to
|
|
407
|
+
* the frame's, say — rather than through `renderFrameWithFeatures`,
|
|
408
|
+
* which makes and drives one of its own. `request` is
|
|
409
|
+
* `renderFrameWithFeatures`'s `{ nodes: [{ node, key? }], coords? }`.
|
|
410
|
+
* Render each of the frame's tiles with the collector's `renderTile`,
|
|
411
|
+
* in any order, then `finish()`.
|
|
412
|
+
*
|
|
413
|
+
* It changes nothing about what the renderer draws, so it works while
|
|
414
|
+
* a `renderFrame` holds the renderer. Throws `InvalidStyle` for what
|
|
415
|
+
* `renderFrameWithFeatures` refuses, here, before anything renders.
|
|
416
|
+
* @param {Frame} frame
|
|
417
|
+
* @param {FrameFeatures} request
|
|
418
|
+
* @returns {FrameFeatureCollector}
|
|
419
|
+
*/
|
|
420
|
+
frameFeatures(frame, request) {
|
|
421
|
+
const ret = wasm.renderer_frameFeatures(this.__wbg_ptr, frame, request);
|
|
422
|
+
if (ret[2]) {
|
|
423
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
424
|
+
}
|
|
425
|
+
return FrameFeatureCollector.__wrap(ret[0]);
|
|
202
426
|
}
|
|
203
427
|
/**
|
|
204
428
|
* The style's declared `legend`, or `undefined` when it declares
|
|
@@ -218,6 +442,39 @@ class Renderer {
|
|
|
218
442
|
}
|
|
219
443
|
return takeFromExternrefTable0(ret[0]);
|
|
220
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* Decode a tile-scoped source's bytes — `mvt`, `pmtiles`, `dem`,
|
|
447
|
+
* `raster`, or a remote `geojson` document — once, into a
|
|
448
|
+
* `SourceData` that any number of `SourceSet`s can hold without
|
|
449
|
+
* decoding it again.
|
|
450
|
+
*
|
|
451
|
+
* A host rendering a block of tiles loads each tile it fetched once
|
|
452
|
+
* and binds it into the set of every tile it borders, rather than
|
|
453
|
+
* decoding it as the centre of one tile and again as a neighbour of
|
|
454
|
+
* each of the others. Nothing about what the renderer draws changes,
|
|
455
|
+
* so this works while a `renderFrame` holds the renderer, which is
|
|
456
|
+
* where a frame's callback loads its tiles.
|
|
457
|
+
*
|
|
458
|
+
* Throws `UnknownSource` if `name` is not declared, or is a kind bound
|
|
459
|
+
* into the renderer itself with `bindSource` (brush, image, sprite,
|
|
460
|
+
* font, glyphs), and the matching decode kind if the bytes do not
|
|
461
|
+
* parse. Unlike `bindSource`, a DEM or imagery tile is decoded here,
|
|
462
|
+
* so its decode error is thrown here and not from the render.
|
|
463
|
+
* @param {string} name
|
|
464
|
+
* @param {Uint8Array} bytes
|
|
465
|
+
* @returns {SourceData}
|
|
466
|
+
*/
|
|
467
|
+
loadSource(name, bytes) {
|
|
468
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
469
|
+
const len0 = WASM_VECTOR_LEN;
|
|
470
|
+
const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc_command_export);
|
|
471
|
+
const len1 = WASM_VECTOR_LEN;
|
|
472
|
+
const ret = wasm.renderer_loadSource(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
473
|
+
if (ret[2]) {
|
|
474
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
475
|
+
}
|
|
476
|
+
return SourceData.__wrap(ret[0]);
|
|
477
|
+
}
|
|
221
478
|
/**
|
|
222
479
|
* What this renderer is holding, in bytes, so a host can shed load
|
|
223
480
|
* *before* an allocation fails rather than after.
|
|
@@ -283,6 +540,21 @@ class Renderer {
|
|
|
283
540
|
}
|
|
284
541
|
return takeFromExternrefTable0(ret[0]);
|
|
285
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* `neededCodepoints` for the features in `set` rather than the ones
|
|
545
|
+
* bound to the renderer: what to bind into the glyphs sources before
|
|
546
|
+
* rendering from it.
|
|
547
|
+
* @param {SourceSet} set
|
|
548
|
+
* @returns {object}
|
|
549
|
+
*/
|
|
550
|
+
neededCodepointsIn(set) {
|
|
551
|
+
_assertClass(set, SourceSet);
|
|
552
|
+
const ret = wasm.renderer_neededCodepointsIn(this.__wbg_ptr, set.__wbg_ptr);
|
|
553
|
+
if (ret[2]) {
|
|
554
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
555
|
+
}
|
|
556
|
+
return takeFromExternrefTable0(ret[0]);
|
|
557
|
+
}
|
|
286
558
|
/**
|
|
287
559
|
* Glyph ranges the currently bound features can require, as
|
|
288
560
|
* `{ [glyphsSourceName]: number[] }` where each number is a range
|
|
@@ -322,6 +594,20 @@ class Renderer {
|
|
|
322
594
|
}
|
|
323
595
|
return takeFromExternrefTable0(ret[0]);
|
|
324
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* `neededGlyphRanges` for the features in `set` rather than the ones
|
|
599
|
+
* bound to the renderer.
|
|
600
|
+
* @param {SourceSet} set
|
|
601
|
+
* @returns {object}
|
|
602
|
+
*/
|
|
603
|
+
neededGlyphRangesIn(set) {
|
|
604
|
+
_assertClass(set, SourceSet);
|
|
605
|
+
const ret = wasm.renderer_neededGlyphRangesIn(this.__wbg_ptr, set.__wbg_ptr);
|
|
606
|
+
if (ret[2]) {
|
|
607
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
608
|
+
}
|
|
609
|
+
return takeFromExternrefTable0(ret[0]);
|
|
610
|
+
}
|
|
325
611
|
/**
|
|
326
612
|
* Build a renderer from a style JSON document.
|
|
327
613
|
* @param {string} style_json
|
|
@@ -353,13 +639,110 @@ class Renderer {
|
|
|
353
639
|
}
|
|
354
640
|
return takeFromExternrefTable0(ret[0]);
|
|
355
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* Render every tile `frame` covers and copy each one's share into one
|
|
644
|
+
* frame-sized buffer, which is what `ezu frame` does: the same tiles,
|
|
645
|
+
* at the same tile size, cropped the same way. Resolves to straight
|
|
646
|
+
* (un-premultiplied) RGBA, `width × height × 4` bytes, as
|
|
647
|
+
* `format: "rgba"` is.
|
|
648
|
+
*
|
|
649
|
+
* The tile data stays yours to fetch, tile by tile, but it is handed
|
|
650
|
+
* over as a value rather than bound: before each tile
|
|
651
|
+
* `sources({ z, x, y }, binder)` is called with the tile about to
|
|
652
|
+
* render, and the tile renders from the `SourceSet` it returns, as
|
|
653
|
+
* `renderTileWith` does — the tile itself, the neighbours
|
|
654
|
+
* `requestedNeighborOffsets` names, the ancestor `sourceTile` answers
|
|
655
|
+
* past a source's max-zoom. A frame's tiles border each other, so keep
|
|
656
|
+
* the `SourceData` `loadSource` gives you and put each one into the set
|
|
657
|
+
* of every tile that reads it: each fetched tile is then decoded once,
|
|
658
|
+
* not once per tile around it. The frame reads the set and leaves it
|
|
659
|
+
* yours; returning one set for several tiles is fine.
|
|
660
|
+
*
|
|
661
|
+
* `sources` may return a promise, which is awaited, so it can fetch.
|
|
662
|
+
* One that throws or rejects stops the frame with that error. It may
|
|
663
|
+
* be `null` for a style that needs no tile data. The binder binds into
|
|
664
|
+
* the renderer what a set turns out to need — the glyphs
|
|
665
|
+
* `neededCodepointsIn` lists for it — with `binder.bindSource`, which
|
|
666
|
+
* takes what `bindSource` does but refuses a tile-scoped source with
|
|
667
|
+
* `UnknownSource`, since the frame never reads bound tile data.
|
|
668
|
+
* Persistent sources (fonts, sprites, brushes, images) can equally be
|
|
669
|
+
* bound once, before the call. After each tile the glyph banks are
|
|
670
|
+
* trimmed to `setGlyphBudget`'s budget, as `renderTile` does.
|
|
671
|
+
*
|
|
672
|
+
* Until the promise settles the renderer is the frame's: everything
|
|
673
|
+
* that would change what it draws — `bindSource`, `clearSources`,
|
|
674
|
+
* `renderTile`, `trimGlyphs`, another `renderFrame` or
|
|
675
|
+
* `renderFrameWithFeatures`, `setStyle`, `setTileSize`,
|
|
676
|
+
* `clearTileSize`, `setGlyphBudget`, `clearGlyphBudget`,
|
|
677
|
+
* `setCacheBudget`, `clearCacheBudget` — throws `FrameInProgress`, so a request running while `sources` awaits
|
|
678
|
+
* cannot change the frame's tiles under it. `loadSource`,
|
|
679
|
+
* `renderTileWith` and the queries that only read (`sourceTile`,
|
|
680
|
+
* `requestedNeighborOffsets`, `neededCodepointsIn`, `boundSources`, …)
|
|
681
|
+
* still work. A binder binds only for its own tile and only while that
|
|
682
|
+
* tile's `sources` runs; kept and used later, it throws `StaleBinder`.
|
|
683
|
+
* The renderer is given back however the frame ends, and the frame
|
|
684
|
+
* binds no tile data, so it leaves none bound.
|
|
685
|
+
*
|
|
686
|
+
* The tiles render at `frame.tileSize` per render, so the renderer's
|
|
687
|
+
* own tile size is left as it was. `opts` takes `renderTile`'s
|
|
688
|
+
* `pad` and `params`; its `format` and `tileSize` must be left out
|
|
689
|
+
* (or match), since the frame fixes both.
|
|
690
|
+
*
|
|
691
|
+
* Tiles render one after another, row by row from the top.
|
|
692
|
+
* @param {Frame} frame
|
|
693
|
+
* @param {((tile: { z: number; x: number; y: number }, binder: FrameBinder) => SourceSet | Promise<SourceSet>) | null | undefined} sources
|
|
694
|
+
* @param {object | null} [opts]
|
|
695
|
+
* @returns {Promise<Uint8Array>}
|
|
696
|
+
*/
|
|
697
|
+
renderFrame(frame, sources, opts) {
|
|
698
|
+
const ret = wasm.renderer_renderFrame(this.__wbg_ptr, frame, isLikeNone(sources) ? 0 : addToExternrefTable0(sources), isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
|
|
699
|
+
return ret;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* `renderFrame`, also handing back what features nodes held over the
|
|
703
|
+
* whole page: resolves to `{ image, features }`, where `image` is the
|
|
704
|
+
* buffer `renderFrame` resolves to and `features` holds one
|
|
705
|
+
* `{ node, geojson }` per entry of `request.nodes`, in that order.
|
|
706
|
+
* `geojson` is a FeatureCollection as text, byte for byte the file
|
|
707
|
+
* `ezu frame --features` writes for the same style, data and frame.
|
|
708
|
+
*
|
|
709
|
+
* `request` is `{ nodes: [{ node, key? }], coords? }`. `key` names the
|
|
710
|
+
* properties that identify a feature across tiles — `["label-id",
|
|
711
|
+
* "part"]` for `label-boxes`: features whose key properties are all
|
|
712
|
+
* equal are written once, the first in reading order (rows top to
|
|
713
|
+
* bottom, then left to right), and the page is sorted by the key.
|
|
714
|
+
* Without one, every tile's features are written, so a feature several
|
|
715
|
+
* tiles see appears once per tile. `coords` is `"lonlat"` (the
|
|
716
|
+
* default), WGS84 to seven decimal places, or `"px"`, page pixels to
|
|
717
|
+
* two. Features wholly off the page are left out; one that reaches
|
|
718
|
+
* into it is written whole.
|
|
719
|
+
*
|
|
720
|
+
* The values are the ones each tile's render computed on its way to
|
|
721
|
+
* the pixels, so this costs no second evaluation. A name that is not
|
|
722
|
+
* a node of the style, or names one that produces something other
|
|
723
|
+
* than features, and a key that names no property, reject with
|
|
724
|
+
* `InvalidStyle` before anything renders.
|
|
725
|
+
* @param {Frame} frame
|
|
726
|
+
* @param {((tile: { z: number; x: number; y: number }, binder: FrameBinder) => SourceSet | Promise<SourceSet>) | null | undefined} sources
|
|
727
|
+
* @param {FrameFeatures} request
|
|
728
|
+
* @param {object | null} [opts]
|
|
729
|
+
* @returns {Promise<FrameWithFeatures>}
|
|
730
|
+
*/
|
|
731
|
+
renderFrameWithFeatures(frame, sources, request, opts) {
|
|
732
|
+
const ret = wasm.renderer_renderFrameWithFeatures(this.__wbg_ptr, frame, isLikeNone(sources) ? 0 : addToExternrefTable0(sources), request, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
|
|
733
|
+
return ret;
|
|
734
|
+
}
|
|
356
735
|
/**
|
|
357
736
|
* Render a single tile using whatever sources are currently bound.
|
|
358
737
|
*
|
|
359
738
|
* `opts` (JS object, all fields optional):
|
|
360
739
|
* - `format`: `"png"` (default) / `"webp"` / `"rgba"`
|
|
361
740
|
* - `tileSize`, `pad`: override the style's canvas size for this
|
|
362
|
-
* call (
|
|
741
|
+
* call, in style pixels (a larger tile draws finer)
|
|
742
|
+
* - `pixelRatio`: device pixels per style pixel, 1 to 4 (default 1).
|
|
743
|
+
* `2` renders a retina tile: twice the size, with every width, text
|
|
744
|
+
* size and blur doubled, the way `window.devicePixelRatio` scales
|
|
745
|
+
* a MapLibre map
|
|
363
746
|
* - `params`: `{ name: number | boolean | string }` — render-time
|
|
364
747
|
* overrides for the style's declared `params`, validated the same
|
|
365
748
|
* way the CLI's `--param` is. Omitted names keep their declared
|
|
@@ -380,6 +763,86 @@ class Renderer {
|
|
|
380
763
|
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
381
764
|
return v1;
|
|
382
765
|
}
|
|
766
|
+
/**
|
|
767
|
+
* The tile size renders use: the one `setTileSize` set, or else the
|
|
768
|
+
* style's `tile-size`. A `tileSize` in one render's options still wins
|
|
769
|
+
* over it.
|
|
770
|
+
* @returns {number}
|
|
771
|
+
*/
|
|
772
|
+
get renderTileSize() {
|
|
773
|
+
const ret = wasm.renderer_renderTileSize(this.__wbg_ptr);
|
|
774
|
+
return ret >>> 0;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Render a single tile from the tile data in `set`, as `renderTile`
|
|
778
|
+
* does from what is bound. Nothing tile-scoped that `bindSource` bound
|
|
779
|
+
* is read; the fonts, sprites, brushes, images and glyphs bound into
|
|
780
|
+
* the renderer are. `opts` is `renderTile`'s.
|
|
781
|
+
*
|
|
782
|
+
* It changes nothing a later render depends on, so it needs no
|
|
783
|
+
* `clearSources` and works while a `renderFrame` holds the renderer.
|
|
784
|
+
* It does not bring the glyph banks back under a budget set with
|
|
785
|
+
* `setGlyphBudget`, as `renderTile` does after each render; call
|
|
786
|
+
* `trimGlyphs()` when a batch of renders is done.
|
|
787
|
+
* @param {number} z
|
|
788
|
+
* @param {number} x
|
|
789
|
+
* @param {number} y
|
|
790
|
+
* @param {SourceSet} set
|
|
791
|
+
* @param {object | null} [opts]
|
|
792
|
+
* @returns {Uint8Array}
|
|
793
|
+
*/
|
|
794
|
+
renderTileWith(z, x, y, set, opts) {
|
|
795
|
+
_assertClass(set, SourceSet);
|
|
796
|
+
const ret = wasm.renderer_renderTileWith(this.__wbg_ptr, z, x, y, set.__wbg_ptr, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
|
|
797
|
+
if (ret[3]) {
|
|
798
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
799
|
+
}
|
|
800
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
801
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
802
|
+
return v1;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* `renderTileWith`, also handing back what each of `nodes` — ids of
|
|
806
|
+
* nodes that produce features — held when the render finished, in the
|
|
807
|
+
* order given: `{ image, features }`, where `image` is the bytes
|
|
808
|
+
* `renderTileWith` returns and `features` holds one
|
|
809
|
+
* `{ node, extent, geojson }` per name, `geojson` being a GeoJSON
|
|
810
|
+
* FeatureCollection as text — the shape `renderFrameWithFeatures` and
|
|
811
|
+
* the Go package hand back too.
|
|
812
|
+
*
|
|
813
|
+
* Each entry carries the node's id as `node` and the tile's size
|
|
814
|
+
* in geometry units as `extent`: coordinates run `0..extent` across
|
|
815
|
+
* the tile, `x` right and `y` down from its top-left corner. A node the
|
|
816
|
+
* render never reached — a branch a `switch` did not take — has no
|
|
817
|
+
* `extent` and no features. The values are the ones the render
|
|
818
|
+
* computed on its way to the pixels, so this costs no second
|
|
819
|
+
* evaluation.
|
|
820
|
+
*
|
|
821
|
+
* `nodes` is an array of ids, or `{ nodes, coords }` to write the
|
|
822
|
+
* geometry in other coordinates: `coords` is `"tile"` (the default,
|
|
823
|
+
* tile units as above), `"lonlat"` (WGS84, seven decimals) or `"px"`
|
|
824
|
+
* (the rendered tile's pixels from its top-left corner, two decimals,
|
|
825
|
+
* at the tile size the render drew at).
|
|
826
|
+
*
|
|
827
|
+
* Throws `InvalidStyle` before anything renders when a name is not a
|
|
828
|
+
* node of the style, or names one that produces something other than
|
|
829
|
+
* features, and for a `coords` it does not know.
|
|
830
|
+
* @param {number} z
|
|
831
|
+
* @param {number} x
|
|
832
|
+
* @param {number} y
|
|
833
|
+
* @param {SourceSet} set
|
|
834
|
+
* @param {string[] | TileFeatures} nodes
|
|
835
|
+
* @param {object | null} [opts]
|
|
836
|
+
* @returns {TileWithFeatures}
|
|
837
|
+
*/
|
|
838
|
+
renderTileWithFeatures(z, x, y, set, nodes, opts) {
|
|
839
|
+
_assertClass(set, SourceSet);
|
|
840
|
+
const ret = wasm.renderer_renderTileWithFeatures(this.__wbg_ptr, z, x, y, set.__wbg_ptr, nodes, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
|
|
841
|
+
if (ret[2]) {
|
|
842
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
843
|
+
}
|
|
844
|
+
return takeFromExternrefTable0(ret[0]);
|
|
845
|
+
}
|
|
383
846
|
/**
|
|
384
847
|
* Neighbour tile offsets the active style actually asks for from
|
|
385
848
|
* `source`, as an array of `[dx, dy]` pairs (never including the
|
|
@@ -418,6 +881,26 @@ class Renderer {
|
|
|
418
881
|
}
|
|
419
882
|
return takeFromExternrefTable0(ret[0]);
|
|
420
883
|
}
|
|
884
|
+
/**
|
|
885
|
+
* Let the render cache hold up to `bytes` of pixels instead of its
|
|
886
|
+
* default (8 MiB). The cache keeps intermediate results a later render
|
|
887
|
+
* can reuse — most of all what a world-anchored node computes, which
|
|
888
|
+
* every tile around it reads too — so a host rendering many
|
|
889
|
+
* neighbouring tiles with memory to spare renders them faster with
|
|
890
|
+
* more, and one in a memory-capped isolate can hold it to less.
|
|
891
|
+
* `memoryUsage().cacheBudget` reports it back.
|
|
892
|
+
*
|
|
893
|
+
* The cache starts empty at the new size, and keeps the size through
|
|
894
|
+
* `setStyle` and `setTileSize`. Throws `FrameInProgress` while a
|
|
895
|
+
* `renderFrame` holds the renderer.
|
|
896
|
+
* @param {number} bytes
|
|
897
|
+
*/
|
|
898
|
+
setCacheBudget(bytes) {
|
|
899
|
+
const ret = wasm.renderer_setCacheBudget(this.__wbg_ptr, bytes);
|
|
900
|
+
if (ret[1]) {
|
|
901
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
421
904
|
/**
|
|
422
905
|
* Cap the glyph bytes each bound fontstack keeps resident, in
|
|
423
906
|
* bytes. Unset, a fontstack keeps every range ever bound to it for
|
|
@@ -442,19 +925,24 @@ class Renderer {
|
|
|
442
925
|
* names exactly what to bind, and a host that re-binds every tile
|
|
443
926
|
* (rather than tracking what it sent) needs no other change.
|
|
444
927
|
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
928
|
+
* `clearGlyphBudget()` lifts the cap again. So does a budget of
|
|
929
|
+
* `0xFFFFFFFF` — the largest value this host can express, since an
|
|
930
|
+
* address here is 32 bits — which is what
|
|
447
931
|
* `memoryUsage().glyphBudget` reports as `Infinity`. A number that
|
|
448
932
|
* big cannot be a real ceiling: it is every byte the module could
|
|
449
933
|
* ever address.
|
|
450
934
|
* @param {number} bytes
|
|
451
935
|
*/
|
|
452
936
|
setGlyphBudget(bytes) {
|
|
453
|
-
wasm.renderer_setGlyphBudget(this.__wbg_ptr, bytes);
|
|
937
|
+
const ret = wasm.renderer_setGlyphBudget(this.__wbg_ptr, bytes);
|
|
938
|
+
if (ret[1]) {
|
|
939
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
940
|
+
}
|
|
454
941
|
}
|
|
455
942
|
/**
|
|
456
943
|
* Replace the active style. Returns the new node count. Invalidates
|
|
457
|
-
* the intermediate cache
|
|
944
|
+
* the intermediate cache, drops any pending source bindings, and
|
|
945
|
+
* goes back to the new style's own tile size.
|
|
458
946
|
* @param {string} style_json
|
|
459
947
|
* @returns {number}
|
|
460
948
|
*/
|
|
@@ -467,6 +955,30 @@ class Renderer {
|
|
|
467
955
|
}
|
|
468
956
|
return ret[0] >>> 0;
|
|
469
957
|
}
|
|
958
|
+
/**
|
|
959
|
+
* Render every tile at `size` px instead of the style's `tile-size`,
|
|
960
|
+
* without editing the style. `clearTileSize()` goes back to the
|
|
961
|
+
* style's, and so does `setStyle`.
|
|
962
|
+
*
|
|
963
|
+
* A print frame needs it: `computeFrame` meets the scale by choosing
|
|
964
|
+
* the tile size, and the frame's tiles must be drawn at exactly that
|
|
965
|
+
* size. It renders what the style with its `tile-size` edited would.
|
|
966
|
+
* Nothing you bind depends on it — `requestedNeighborOffsets` and
|
|
967
|
+
* `sourceTile` answer as before — and the intermediate cache, which is
|
|
968
|
+
* sized by the tile, is dropped when the size changes. `tileSize`
|
|
969
|
+
* keeps reporting the style's own, and a `tileSize` in one
|
|
970
|
+
* `renderTile`'s options still wins over this.
|
|
971
|
+
*
|
|
972
|
+
* Throws `InvalidStyle` for a size below 1 px: `0` is not "the
|
|
973
|
+
* style's", that is `clearTileSize`.
|
|
974
|
+
* @param {number} size
|
|
975
|
+
*/
|
|
976
|
+
setTileSize(size) {
|
|
977
|
+
const ret = wasm.renderer_setTileSize(this.__wbg_ptr, size);
|
|
978
|
+
if (ret[1]) {
|
|
979
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
470
982
|
/**
|
|
471
983
|
* The tile a host should actually fetch from `name` in order to draw
|
|
472
984
|
* `z/x/y`, as `{ z, x, y }`.
|
|
@@ -537,23 +1049,195 @@ class Renderer {
|
|
|
537
1049
|
return takeFromExternrefTable0(ret[0]);
|
|
538
1050
|
}
|
|
539
1051
|
/**
|
|
540
|
-
* `tile-size` declared by the current style
|
|
1052
|
+
* `tile-size` declared by the current style, whatever `setTileSize`
|
|
1053
|
+
* renders at.
|
|
541
1054
|
* @returns {number}
|
|
542
1055
|
*/
|
|
543
1056
|
get tileSize() {
|
|
544
1057
|
const ret = wasm.renderer_tileSize(this.__wbg_ptr);
|
|
545
1058
|
return ret >>> 0;
|
|
546
1059
|
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Bring every bound fontstack back under the budget `setGlyphBudget`
|
|
1062
|
+
* set; a no-op without one. `renderTile` does this after each render;
|
|
1063
|
+
* after `renderTileWith`, call it yourself once a batch is done.
|
|
1064
|
+
* Trimming can drop glyphs a frame bound for its next tile, so it
|
|
1065
|
+
* throws `FrameInProgress` while a `renderFrame` holds the renderer,
|
|
1066
|
+
* which trims after each of its tiles itself.
|
|
1067
|
+
*/
|
|
1068
|
+
trimGlyphs() {
|
|
1069
|
+
const ret = wasm.renderer_trimGlyphs(this.__wbg_ptr);
|
|
1070
|
+
if (ret[1]) {
|
|
1071
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* What building the current style's graph warned about: each names a
|
|
1076
|
+
* node that works but relies on something the style does not say out
|
|
1077
|
+
* loud. They are also logged when the style is built; this is for
|
|
1078
|
+
* reporting or checking them on your own terms. Follows `setStyle`.
|
|
1079
|
+
* @returns {string[]}
|
|
1080
|
+
*/
|
|
1081
|
+
get warnings() {
|
|
1082
|
+
const ret = wasm.renderer_warnings(this.__wbg_ptr);
|
|
1083
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1084
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
1085
|
+
return v1;
|
|
1086
|
+
}
|
|
547
1087
|
}
|
|
548
1088
|
if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
|
|
549
1089
|
exports.Renderer = Renderer;
|
|
550
1090
|
|
|
1091
|
+
/**
|
|
1092
|
+
* One tile-scoped payload — a vector tile, a DEM or imagery tile, a
|
|
1093
|
+
* GeoJSON document — decoded once by `Renderer.loadSource` and ready to
|
|
1094
|
+
* sit in any number of `SourceSet`s.
|
|
1095
|
+
*
|
|
1096
|
+
* A set keeps what it holds alive, so `free()` once the sets that need it
|
|
1097
|
+
* have it, or leave it to the garbage collector. It is not tied to the
|
|
1098
|
+
* renderer that loaded it: renderers in one module share a heap, and a
|
|
1099
|
+
* render checks that its style declares the source the way the data was
|
|
1100
|
+
* loaded for.
|
|
1101
|
+
*/
|
|
1102
|
+
class SourceData {
|
|
1103
|
+
static __wrap(ptr) {
|
|
1104
|
+
const obj = Object.create(SourceData.prototype);
|
|
1105
|
+
obj.__wbg_ptr = ptr;
|
|
1106
|
+
SourceDataFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1107
|
+
return obj;
|
|
1108
|
+
}
|
|
1109
|
+
__destroy_into_raw() {
|
|
1110
|
+
const ptr = this.__wbg_ptr;
|
|
1111
|
+
this.__wbg_ptr = 0;
|
|
1112
|
+
SourceDataFinalization.unregister(this);
|
|
1113
|
+
return ptr;
|
|
1114
|
+
}
|
|
1115
|
+
free() {
|
|
1116
|
+
const ptr = this.__destroy_into_raw();
|
|
1117
|
+
wasm.__wbg_sourcedata_free(ptr, 0);
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* The `sources.<name>` entry the data was loaded for.
|
|
1121
|
+
* @returns {string}
|
|
1122
|
+
*/
|
|
1123
|
+
get source() {
|
|
1124
|
+
let deferred1_0;
|
|
1125
|
+
let deferred1_1;
|
|
1126
|
+
try {
|
|
1127
|
+
const ret = wasm.sourcedata_source(this.__wbg_ptr);
|
|
1128
|
+
deferred1_0 = ret[0];
|
|
1129
|
+
deferred1_1 = ret[1];
|
|
1130
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1131
|
+
} finally {
|
|
1132
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
if (Symbol.dispose) SourceData.prototype[Symbol.dispose] = SourceData.prototype.free;
|
|
1137
|
+
exports.SourceData = SourceData;
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Every tile-scoped payload one render reads, each at its place in the
|
|
1141
|
+
* 3×3 neighbourhood: the binding table `bindSource` fills, as a value you
|
|
1142
|
+
* build per tile and hand to `renderTileWith`.
|
|
1143
|
+
*
|
|
1144
|
+
* A set says nothing about the tile it is for — offsets are relative — so
|
|
1145
|
+
* pairing each tile with its neighbourhood is yours to do. Fonts, sprites,
|
|
1146
|
+
* brushes, images and glyphs are not here: they belong to the renderer,
|
|
1147
|
+
* bound once with `bindSource` and read by every render.
|
|
1148
|
+
*/
|
|
1149
|
+
class SourceSet {
|
|
1150
|
+
static __wrap(ptr) {
|
|
1151
|
+
const obj = Object.create(SourceSet.prototype);
|
|
1152
|
+
obj.__wbg_ptr = ptr;
|
|
1153
|
+
SourceSetFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1154
|
+
return obj;
|
|
1155
|
+
}
|
|
1156
|
+
static __unwrap(jsValue) {
|
|
1157
|
+
if (!(jsValue instanceof SourceSet)) {
|
|
1158
|
+
return 0;
|
|
1159
|
+
}
|
|
1160
|
+
return jsValue.__destroy_into_raw();
|
|
1161
|
+
}
|
|
1162
|
+
__destroy_into_raw() {
|
|
1163
|
+
const ptr = this.__wbg_ptr;
|
|
1164
|
+
this.__wbg_ptr = 0;
|
|
1165
|
+
SourceSetFinalization.unregister(this);
|
|
1166
|
+
return ptr;
|
|
1167
|
+
}
|
|
1168
|
+
free() {
|
|
1169
|
+
const ptr = this.__destroy_into_raw();
|
|
1170
|
+
wasm.__wbg_sourceset_free(ptr, 0);
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Put `data` at `opts.coord` for its source, replacing what was
|
|
1174
|
+
* there. `opts` is `bindSource`'s `{ coord?: [dx, dy], sourceZoom? }`:
|
|
1175
|
+
* `sourceZoom` says the data is an ancestor's, to be resampled or
|
|
1176
|
+
* reprojected into the tile. The set shares the data rather than
|
|
1177
|
+
* copying it.
|
|
1178
|
+
*
|
|
1179
|
+
* Throws `UnknownSource` when the source already holds data of
|
|
1180
|
+
* another kind, and for the `coord` and `sourceZoom` `bindSource`
|
|
1181
|
+
* refuses.
|
|
1182
|
+
* @param {SourceData} data
|
|
1183
|
+
* @param {object | null} [opts]
|
|
1184
|
+
*/
|
|
1185
|
+
bind(data, opts) {
|
|
1186
|
+
_assertClass(data, SourceData);
|
|
1187
|
+
const ret = wasm.sourceset_bind(this.__wbg_ptr, data.__wbg_ptr, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
|
|
1188
|
+
if (ret[1]) {
|
|
1189
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* A copy of the set. It holds the same data, which is shared rather
|
|
1194
|
+
* than copied, so this costs a few references per entry.
|
|
1195
|
+
* @returns {SourceSet}
|
|
1196
|
+
*/
|
|
1197
|
+
clone() {
|
|
1198
|
+
const ret = wasm.sourceset_clone(this.__wbg_ptr);
|
|
1199
|
+
return SourceSet.__wrap(ret);
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Whether anything is bound for `source`.
|
|
1203
|
+
* @param {string} source
|
|
1204
|
+
* @returns {boolean}
|
|
1205
|
+
*/
|
|
1206
|
+
contains(source) {
|
|
1207
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
1208
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1209
|
+
const ret = wasm.sourceset_contains(this.__wbg_ptr, ptr0, len0);
|
|
1210
|
+
return ret !== 0;
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Whether nothing is bound at all.
|
|
1214
|
+
* @returns {boolean}
|
|
1215
|
+
*/
|
|
1216
|
+
isEmpty() {
|
|
1217
|
+
const ret = wasm.sourceset_isEmpty(this.__wbg_ptr);
|
|
1218
|
+
return ret !== 0;
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* An empty set: a render from it draws what the style draws with no
|
|
1222
|
+
* tile data at all.
|
|
1223
|
+
*/
|
|
1224
|
+
constructor() {
|
|
1225
|
+
const ret = wasm.sourceset_new();
|
|
1226
|
+
this.__wbg_ptr = ret;
|
|
1227
|
+
SourceSetFinalization.register(this, this.__wbg_ptr, this);
|
|
1228
|
+
return this;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
if (Symbol.dispose) SourceSet.prototype[Symbol.dispose] = SourceSet.prototype.free;
|
|
1232
|
+
exports.SourceSet = SourceSet;
|
|
1233
|
+
|
|
551
1234
|
/**
|
|
552
1235
|
* Wasm linear memory currently committed to this module, in bytes.
|
|
553
1236
|
*
|
|
554
1237
|
* This is the figure an isolate's memory cap applies to, and the one
|
|
555
1238
|
* to watch to shed load before an allocation fails — a refused
|
|
556
|
-
* `memory.grow` throws
|
|
1239
|
+
* `memory.grow` throws `OutOfMemory` (see the `oom` module) and ends the
|
|
1240
|
+
* instance.
|
|
557
1241
|
* It never falls: freed Rust values return to the allocator for reuse,
|
|
558
1242
|
* but wasm cannot hand pages back to the host. So a drop in demand
|
|
559
1243
|
* leaves the number where its peak left it, and only a fresh instance
|
|
@@ -569,6 +1253,33 @@ function heapBytes() {
|
|
|
569
1253
|
}
|
|
570
1254
|
exports.heapBytes = heapBytes;
|
|
571
1255
|
|
|
1256
|
+
/**
|
|
1257
|
+
* The number of node ops registered in this module. It is the smoke test
|
|
1258
|
+
* for the module's life-before-main constructors: zero means they never
|
|
1259
|
+
* ran, and every style is about to fail with "unknown op". The Go
|
|
1260
|
+
* package's `OpCount`; a Rust host reads the registry itself, through
|
|
1261
|
+
* `ezu::paint::nodes::default_registry()`.
|
|
1262
|
+
* @returns {number}
|
|
1263
|
+
*/
|
|
1264
|
+
function opCount() {
|
|
1265
|
+
const ret = wasm.opCount();
|
|
1266
|
+
return ret >>> 0;
|
|
1267
|
+
}
|
|
1268
|
+
exports.opCount = opCount;
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* Every registered node op, by name: which ops this build has, not just
|
|
1272
|
+
* how many. The Go package's `OpNames`.
|
|
1273
|
+
* @returns {string[]}
|
|
1274
|
+
*/
|
|
1275
|
+
function opNames() {
|
|
1276
|
+
const ret = wasm.opNames();
|
|
1277
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1278
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
1279
|
+
return v1;
|
|
1280
|
+
}
|
|
1281
|
+
exports.opNames = opNames;
|
|
1282
|
+
|
|
572
1283
|
/**
|
|
573
1284
|
* Whether the wasm binary was compiled with `+simd128`. Lets the demo
|
|
574
1285
|
* page label the renderer build accurately.
|
|
@@ -600,10 +1311,19 @@ function __wbg_get_imports() {
|
|
|
600
1311
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
601
1312
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
602
1313
|
},
|
|
1314
|
+
__wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
|
|
1315
|
+
const ret = typeof(arg0) === 'function';
|
|
1316
|
+
return ret;
|
|
1317
|
+
},
|
|
603
1318
|
__wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
|
|
604
1319
|
const ret = arg0 === null;
|
|
605
1320
|
return ret;
|
|
606
1321
|
},
|
|
1322
|
+
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
1323
|
+
const val = arg0;
|
|
1324
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1325
|
+
return ret;
|
|
1326
|
+
},
|
|
607
1327
|
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
608
1328
|
const ret = arg0 === undefined;
|
|
609
1329
|
return ret;
|
|
@@ -628,10 +1348,21 @@ function __wbg_get_imports() {
|
|
|
628
1348
|
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
629
1349
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
630
1350
|
},
|
|
1351
|
+
__wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
|
|
1352
|
+
arg0._wbg_cb_unref();
|
|
1353
|
+
},
|
|
1354
|
+
__wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
|
|
1355
|
+
const ret = arg0.call(arg1);
|
|
1356
|
+
return ret;
|
|
1357
|
+
}, arguments); },
|
|
631
1358
|
__wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
|
|
632
1359
|
const ret = arg0.call(arg1, arg2);
|
|
633
1360
|
return ret;
|
|
634
1361
|
}, arguments); },
|
|
1362
|
+
__wbg_call_e3b662382210db98: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1363
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
1364
|
+
return ret;
|
|
1365
|
+
}, arguments); },
|
|
635
1366
|
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
636
1367
|
let deferred0_0;
|
|
637
1368
|
let deferred0_1;
|
|
@@ -643,6 +1374,10 @@ function __wbg_get_imports() {
|
|
|
643
1374
|
wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
|
|
644
1375
|
}
|
|
645
1376
|
},
|
|
1377
|
+
__wbg_framebinder_new: function(arg0) {
|
|
1378
|
+
const ret = FrameBinder.__wrap(arg0);
|
|
1379
|
+
return ret;
|
|
1380
|
+
},
|
|
646
1381
|
__wbg_get_507a50627bffa49b: function(arg0, arg1) {
|
|
647
1382
|
const ret = arg0[arg1 >>> 0];
|
|
648
1383
|
return ret;
|
|
@@ -673,6 +1408,10 @@ function __wbg_get_imports() {
|
|
|
673
1408
|
const ret = Object.keys(arg0);
|
|
674
1409
|
return ret;
|
|
675
1410
|
},
|
|
1411
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
1412
|
+
const ret = arg0.length;
|
|
1413
|
+
return ret;
|
|
1414
|
+
},
|
|
676
1415
|
__wbg_length_370319915dc99107: function(arg0) {
|
|
677
1416
|
const ret = arg0.length;
|
|
678
1417
|
return ret;
|
|
@@ -685,6 +1424,10 @@ function __wbg_get_imports() {
|
|
|
685
1424
|
const ret = new Array();
|
|
686
1425
|
return ret;
|
|
687
1426
|
},
|
|
1427
|
+
__wbg_new_5e245ef5857d7f33: function(arg0, arg1) {
|
|
1428
|
+
const ret = new TypeError(getStringFromWasm0(arg0, arg1));
|
|
1429
|
+
return ret;
|
|
1430
|
+
},
|
|
688
1431
|
__wbg_new_b667d279fd5aa943: function(arg0, arg1) {
|
|
689
1432
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
690
1433
|
return ret;
|
|
@@ -693,6 +1436,32 @@ function __wbg_get_imports() {
|
|
|
693
1436
|
const ret = new Object();
|
|
694
1437
|
return ret;
|
|
695
1438
|
},
|
|
1439
|
+
__wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
|
|
1440
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1441
|
+
return ret;
|
|
1442
|
+
},
|
|
1443
|
+
__wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
|
|
1444
|
+
try {
|
|
1445
|
+
var state0 = {a: arg0, b: arg1};
|
|
1446
|
+
var cb0 = (arg0, arg1) => {
|
|
1447
|
+
const a = state0.a;
|
|
1448
|
+
state0.a = 0;
|
|
1449
|
+
try {
|
|
1450
|
+
return wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
1451
|
+
} finally {
|
|
1452
|
+
state0.a = a;
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
const ret = new Promise(cb0);
|
|
1456
|
+
return ret;
|
|
1457
|
+
} finally {
|
|
1458
|
+
state0.a = 0;
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
__wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
|
|
1462
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1463
|
+
return ret;
|
|
1464
|
+
},
|
|
696
1465
|
__wbg_now_86c0d4ba3fa605b8: function() {
|
|
697
1466
|
const ret = Date.now();
|
|
698
1467
|
return ret;
|
|
@@ -705,6 +1474,24 @@ function __wbg_get_imports() {
|
|
|
705
1474
|
const ret = arg0.push(arg1);
|
|
706
1475
|
return ret;
|
|
707
1476
|
},
|
|
1477
|
+
__wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
|
|
1478
|
+
const ret = arg0.queueMicrotask;
|
|
1479
|
+
return ret;
|
|
1480
|
+
},
|
|
1481
|
+
__wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
|
|
1482
|
+
queueMicrotask(arg0);
|
|
1483
|
+
},
|
|
1484
|
+
__wbg_reject_90df95b492dd8563: function(arg0) {
|
|
1485
|
+
const ret = Promise.reject(arg0);
|
|
1486
|
+
return ret;
|
|
1487
|
+
},
|
|
1488
|
+
__wbg_resolve_2191a4dfe481c25b: function(arg0) {
|
|
1489
|
+
const ret = Promise.resolve(arg0);
|
|
1490
|
+
return ret;
|
|
1491
|
+
},
|
|
1492
|
+
__wbg_set_4d7dd76f3dae2926: function(arg0, arg1, arg2) {
|
|
1493
|
+
arg0.set(getArrayU8FromWasm0(arg1, arg2));
|
|
1494
|
+
},
|
|
708
1495
|
__wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
|
|
709
1496
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
710
1497
|
return ret;
|
|
@@ -712,6 +1499,10 @@ function __wbg_get_imports() {
|
|
|
712
1499
|
__wbg_set_name_3bbc583faefa4193: function(arg0, arg1, arg2) {
|
|
713
1500
|
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
714
1501
|
},
|
|
1502
|
+
__wbg_sourceset_unwrap: function(arg0) {
|
|
1503
|
+
const ret = SourceSet.__unwrap(arg0);
|
|
1504
|
+
return ret;
|
|
1505
|
+
},
|
|
715
1506
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
716
1507
|
const ret = arg1.stack;
|
|
717
1508
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
@@ -719,12 +1510,45 @@ function __wbg_get_imports() {
|
|
|
719
1510
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
720
1511
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
721
1512
|
},
|
|
722
|
-
|
|
1513
|
+
__wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
|
|
1514
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1515
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1516
|
+
},
|
|
1517
|
+
__wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
|
|
1518
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1519
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1520
|
+
},
|
|
1521
|
+
__wbg_static_accessor_SELF_146583524fe1469b: function() {
|
|
1522
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1523
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1524
|
+
},
|
|
1525
|
+
__wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
|
|
1526
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1527
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1528
|
+
},
|
|
1529
|
+
__wbg_subarray_3ed232c8a6baee09: function(arg0, arg1, arg2) {
|
|
1530
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1531
|
+
return ret;
|
|
1532
|
+
},
|
|
1533
|
+
__wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
|
|
1534
|
+
const ret = arg0.then(arg1, arg2);
|
|
1535
|
+
return ret;
|
|
1536
|
+
},
|
|
1537
|
+
__wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
|
|
1538
|
+
const ret = arg0.then(arg1);
|
|
1539
|
+
return ret;
|
|
1540
|
+
},
|
|
1541
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1542
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 72, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1543
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___wasm_bindgen_40e41bdbc20eab45___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_40e41bdbc20eab45___JsError___true_);
|
|
1544
|
+
return ret;
|
|
1545
|
+
},
|
|
1546
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
723
1547
|
// Cast intrinsic for `F64 -> Externref`.
|
|
724
1548
|
const ret = arg0;
|
|
725
1549
|
return ret;
|
|
726
1550
|
},
|
|
727
|
-
|
|
1551
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
728
1552
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
729
1553
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
730
1554
|
return ret;
|
|
@@ -745,12 +1569,35 @@ function __wbg_get_imports() {
|
|
|
745
1569
|
};
|
|
746
1570
|
}
|
|
747
1571
|
|
|
1572
|
+
function wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___wasm_bindgen_40e41bdbc20eab45___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_40e41bdbc20eab45___JsError___true_(arg0, arg1, arg2) {
|
|
1573
|
+
const ret = wasm.wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___wasm_bindgen_40e41bdbc20eab45___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_40e41bdbc20eab45___JsError___true_(arg0, arg1, arg2);
|
|
1574
|
+
if (ret[1]) {
|
|
1575
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
function wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
|
|
1580
|
+
wasm.wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
const FrameBinderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1584
|
+
? { register: () => {}, unregister: () => {} }
|
|
1585
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_framebinder_free(ptr, 1));
|
|
1586
|
+
const FrameFeatureCollectorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1587
|
+
? { register: () => {}, unregister: () => {} }
|
|
1588
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_framefeaturecollector_free(ptr, 1));
|
|
748
1589
|
const LogSinkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
749
1590
|
? { register: () => {}, unregister: () => {} }
|
|
750
1591
|
: new FinalizationRegistry(ptr => wasm.__wbg_logsink_free(ptr, 1));
|
|
751
1592
|
const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
752
1593
|
? { register: () => {}, unregister: () => {} }
|
|
753
1594
|
: new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr, 1));
|
|
1595
|
+
const SourceDataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1596
|
+
? { register: () => {}, unregister: () => {} }
|
|
1597
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_sourcedata_free(ptr, 1));
|
|
1598
|
+
const SourceSetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1599
|
+
? { register: () => {}, unregister: () => {} }
|
|
1600
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_sourceset_free(ptr, 1));
|
|
754
1601
|
|
|
755
1602
|
function addToExternrefTable0(obj) {
|
|
756
1603
|
const idx = wasm.__externref_table_alloc_command_export();
|
|
@@ -758,6 +1605,16 @@ function addToExternrefTable0(obj) {
|
|
|
758
1605
|
return idx;
|
|
759
1606
|
}
|
|
760
1607
|
|
|
1608
|
+
function _assertClass(instance, klass) {
|
|
1609
|
+
if (!(instance instanceof klass)) {
|
|
1610
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1615
|
+
? { register: () => {}, unregister: () => {} }
|
|
1616
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure_command_export(state.a, state.b));
|
|
1617
|
+
|
|
761
1618
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
762
1619
|
ptr = ptr >>> 0;
|
|
763
1620
|
const mem = getDataViewMemory0();
|
|
@@ -807,6 +1664,34 @@ function isLikeNone(x) {
|
|
|
807
1664
|
return x === undefined || x === null;
|
|
808
1665
|
}
|
|
809
1666
|
|
|
1667
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
1668
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
1669
|
+
const real = (...args) => {
|
|
1670
|
+
|
|
1671
|
+
// First up with a closure we increment the internal reference
|
|
1672
|
+
// count. This ensures that the Rust closure environment won't
|
|
1673
|
+
// be deallocated while we're invoking it.
|
|
1674
|
+
state.cnt++;
|
|
1675
|
+
const a = state.a;
|
|
1676
|
+
state.a = 0;
|
|
1677
|
+
try {
|
|
1678
|
+
return f(a, state.b, ...args);
|
|
1679
|
+
} finally {
|
|
1680
|
+
state.a = a;
|
|
1681
|
+
real._wbg_cb_unref();
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
real._wbg_cb_unref = () => {
|
|
1685
|
+
if (--state.cnt === 0) {
|
|
1686
|
+
wasm.__wbindgen_destroy_closure_command_export(state.a, state.b);
|
|
1687
|
+
state.a = 0;
|
|
1688
|
+
CLOSURE_DTORS.unregister(state);
|
|
1689
|
+
}
|
|
1690
|
+
};
|
|
1691
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
1692
|
+
return real;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
810
1695
|
function passArray8ToWasm0(arg, malloc) {
|
|
811
1696
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
812
1697
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|