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