@reearth/ezu 0.4.0 → 0.4.2
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 +53 -3
- package/bundler/ezu.d.ts +38 -0
- package/bundler/ezu_bg.js +58 -0
- package/bundler/ezu_bg.wasm +0 -0
- package/bundler/ezu_bg.wasm.d.ts +2 -0
- package/nodejs/ezu.d.ts +38 -0
- package/nodejs/ezu.js +58 -0
- package/nodejs/ezu_bg.wasm +0 -0
- package/nodejs/ezu_bg.wasm.d.ts +2 -0
- package/package.json +59 -5
- package/simd/bundler/ezu.d.ts +176 -0
- package/simd/bundler/ezu.js +9 -0
- package/simd/bundler/ezu_bg.js +597 -0
- package/simd/bundler/ezu_bg.wasm +0 -0
- package/simd/bundler/ezu_bg.wasm.d.ts +34 -0
- package/simd/nodejs/ezu.d.ts +176 -0
- package/simd/nodejs/ezu.js +606 -0
- package/simd/nodejs/ezu_bg.wasm +0 -0
- package/simd/nodejs/ezu_bg.wasm.d.ts +34 -0
- package/simd/nodejs/package.json +1 -0
- package/simd/web/ezu.d.ts +235 -0
- package/simd/web/ezu.js +697 -0
- package/simd/web/ezu_bg.wasm +0 -0
- package/simd/web/ezu_bg.wasm.d.ts +34 -0
- package/simd/workerd/ezu.d.ts +3 -0
- package/simd/workerd/ezu.js +13 -0
- package/web/ezu.d.ts +40 -0
- package/web/ezu.js +58 -0
- package/web/ezu_bg.wasm +0 -0
- package/web/ezu_bg.wasm.d.ts +2 -0
- package/workerd/ezu.d.ts +3 -0
- package/workerd/ezu.js +13 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Buffered log sink that captures `tracing` events from the renderer.
|
|
6
|
+
*
|
|
7
|
+
* Construct once near the top of your bootstrap, then either set a
|
|
8
|
+
* callback for live forwarding (`onEvent(e => console.log(e))`) or
|
|
9
|
+
* `drainLines()` periodically to flush into a UI panel.
|
|
10
|
+
*/
|
|
11
|
+
export class LogSink {
|
|
12
|
+
free(): void;
|
|
13
|
+
[Symbol.dispose](): void;
|
|
14
|
+
/**
|
|
15
|
+
* Drop all buffered records without returning them.
|
|
16
|
+
*/
|
|
17
|
+
clear(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Drain every buffered record. Returns a JS array of structured
|
|
20
|
+
* objects `{ level, target, message, fields, timestampMs }`.
|
|
21
|
+
*/
|
|
22
|
+
drain(): Array<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Drain buffered records and return pre-formatted strings — the
|
|
25
|
+
* same shape the CLI prints. Convenient for `console.log(lines.join('\n'))`.
|
|
26
|
+
*/
|
|
27
|
+
drainLines(): string[];
|
|
28
|
+
/**
|
|
29
|
+
* `true` if no records are buffered.
|
|
30
|
+
*/
|
|
31
|
+
isEmpty(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Install (idempotently) the global tracing subscriber. `level` is
|
|
34
|
+
* an `EnvFilter` string — e.g. `"info"`, `"debug"`,
|
|
35
|
+
* `"info,ezu_graph::eval=debug"`. Honoured on first call only.
|
|
36
|
+
*/
|
|
37
|
+
constructor(level: string);
|
|
38
|
+
/**
|
|
39
|
+
* Set (or clear with `null` / `undefined`) the per-event JS
|
|
40
|
+
* callback. The callback receives a structured record object.
|
|
41
|
+
*
|
|
42
|
+
* No-op in multithreaded (`threads`) builds — events can originate
|
|
43
|
+
* on rayon worker threads, so live forwarding to a main-thread JS
|
|
44
|
+
* callback isn't available. Use `drain` / `drainLines` instead.
|
|
45
|
+
*/
|
|
46
|
+
onEvent(callback?: Function | null): void;
|
|
47
|
+
/**
|
|
48
|
+
* Resize the ring-buffer cap. Older entries are evicted FIFO once
|
|
49
|
+
* the buffer reaches the new cap. Default is 4096.
|
|
50
|
+
*/
|
|
51
|
+
setCapacity(cap: number): void;
|
|
52
|
+
/**
|
|
53
|
+
* Number of records currently buffered.
|
|
54
|
+
*/
|
|
55
|
+
readonly len: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Stateful WASM renderer.
|
|
60
|
+
*/
|
|
61
|
+
export class Renderer {
|
|
62
|
+
free(): void;
|
|
63
|
+
[Symbol.dispose](): void;
|
|
64
|
+
/**
|
|
65
|
+
* Bind raw tile bytes under a `sources.<name>` entry from the style.
|
|
66
|
+
* The renderer dispatches on the source's declared `type`:
|
|
67
|
+
*
|
|
68
|
+
* - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
|
|
69
|
+
* offset (centre `coord: [0, 0]`, the default). Layers are bound as
|
|
70
|
+
* `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
|
|
71
|
+
* (neighbours) when [`render_tile`] runs. Binding only the centre
|
|
72
|
+
* degrades cross-tile label collision to centre-only at borders.
|
|
73
|
+
* - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
|
|
74
|
+
* offset. The centre tile is `coord: [0, 0]` (default). Decoding
|
|
75
|
+
* and 3×3 stitching happen at render time once the tile id is known.
|
|
76
|
+
* - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
|
|
77
|
+
* projected per tile (and neighbour) at render time.
|
|
78
|
+
*
|
|
79
|
+
* `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
|
|
80
|
+
* `UnknownSource` if `name` doesn't match any entry in the style's
|
|
81
|
+
* `sources` block, `MvtDecode` if MVT bytes don't parse, and
|
|
82
|
+
* `DemDecode` for non-image DEM bytes (the decode itself runs at
|
|
83
|
+
* render time, but obvious cases are caught here).
|
|
84
|
+
*/
|
|
85
|
+
bindSource(name: string, bytes: Uint8Array, opts?: object | null): void;
|
|
86
|
+
/**
|
|
87
|
+
* Names of every source with at least one pending binding.
|
|
88
|
+
* Order matches the style's `sources` declaration order.
|
|
89
|
+
*/
|
|
90
|
+
boundSources(): string[];
|
|
91
|
+
/**
|
|
92
|
+
* Drop every pending source binding. Call between tile renders.
|
|
93
|
+
*/
|
|
94
|
+
clearSources(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Glyph ranges the currently bound features can require, as
|
|
97
|
+
* `{ [glyphsSourceName]: number[] }` where each number is a range
|
|
98
|
+
* start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
|
|
99
|
+
* `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
|
|
100
|
+
*
|
|
101
|
+
* This host cannot fetch glyph ranges lazily, so every range a
|
|
102
|
+
* tile's labels touch must be bound before `renderTile`. Rather than
|
|
103
|
+
* scraping every string in the MVT, call this after binding the
|
|
104
|
+
* vector sources and bind exactly the listed ranges.
|
|
105
|
+
*
|
|
106
|
+
* It is an over-approximation, deliberately: a range is listed if
|
|
107
|
+
* *any* feature in a text layer carries the codepoint in a property
|
|
108
|
+
* the layer's `text` expression reads, without evaluating filters,
|
|
109
|
+
* zoom ranges, or the expression itself, and it is listed for every
|
|
110
|
+
* fontstack in that layer's fallback chain. So it never omits a
|
|
111
|
+
* range a label needs, and it may name a few that go unused. Text
|
|
112
|
+
* layers that build their string from something other than a `get`
|
|
113
|
+
* of a feature property (a literal, a `concat` of formatted values)
|
|
114
|
+
* contribute their literal text where it is a plain string.
|
|
115
|
+
*/
|
|
116
|
+
neededGlyphRanges(): object;
|
|
117
|
+
/**
|
|
118
|
+
* Build a renderer from a style JSON document.
|
|
119
|
+
*/
|
|
120
|
+
constructor(style_json: string);
|
|
121
|
+
/**
|
|
122
|
+
* Render a single tile using whatever sources are currently bound.
|
|
123
|
+
*
|
|
124
|
+
* `opts` (JS object, all fields optional):
|
|
125
|
+
* - `format`: `"png"` (default) / `"webp"` / `"rgba"`
|
|
126
|
+
* - `tileSize`, `pad`: override the style's canvas size for this
|
|
127
|
+
* call (hi-DPI / preview)
|
|
128
|
+
* - `png`: `{ compression?: "fast" | "default" | "best" }`
|
|
129
|
+
*/
|
|
130
|
+
renderTile(z: number, x: number, y: number, opts?: object | null): Uint8Array;
|
|
131
|
+
/**
|
|
132
|
+
* Neighbour tile offsets the active style actually asks for from
|
|
133
|
+
* `source`, as an array of `[dx, dy]` pairs (never including the
|
|
134
|
+
* centre `[0, 0]`).
|
|
135
|
+
*
|
|
136
|
+
* Cross-tile label collision and edge-continuous DEM shading are the
|
|
137
|
+
* only things that read neighbours, and only for the sources they
|
|
138
|
+
* name. A host that fetches the full 3×3 window unconditionally
|
|
139
|
+
* therefore pays for up to eight tiles it will not look at; passing
|
|
140
|
+
* each offset from this list to `bindSource(name, bytes, { coord })`
|
|
141
|
+
* fetches exactly what the recipe needs. An empty array means the
|
|
142
|
+
* centre tile is enough.
|
|
143
|
+
*
|
|
144
|
+
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
145
|
+
*/
|
|
146
|
+
requestedNeighborOffsets(name: string): Array<any>;
|
|
147
|
+
/**
|
|
148
|
+
* Replace the active style. Returns the new node count. Invalidates
|
|
149
|
+
* the intermediate cache and drops any pending source bindings.
|
|
150
|
+
*/
|
|
151
|
+
setStyle(style_json: string): number;
|
|
152
|
+
/**
|
|
153
|
+
* Effective attribution declared by the style (document +
|
|
154
|
+
* sources), joined with ` | `. Upstream TileJSON / PMTiles
|
|
155
|
+
* metadata is the JS host's concern — merge it on that side.
|
|
156
|
+
*/
|
|
157
|
+
readonly attribution: string | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* `tile-size` declared by the current style.
|
|
160
|
+
*/
|
|
161
|
+
readonly tileSize: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Whether the wasm binary was compiled with `+simd128`. Lets the demo
|
|
166
|
+
* page label the renderer build accurately.
|
|
167
|
+
*/
|
|
168
|
+
export function simdEnabled(): boolean;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Whether this build supports multithreaded rendering (compiled with
|
|
172
|
+
* the `threads` feature). When `false`, `initThreadPool` is absent and
|
|
173
|
+
* `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
|
|
174
|
+
* the host can label the build.
|
|
175
|
+
*/
|
|
176
|
+
export function threadsEnabled(): boolean;
|
|
177
|
+
|
|
178
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
179
|
+
|
|
180
|
+
export interface InitOutput {
|
|
181
|
+
readonly memory: WebAssembly.Memory;
|
|
182
|
+
readonly __wbg_logsink_free: (a: number, b: number) => void;
|
|
183
|
+
readonly __wbg_renderer_free: (a: number, b: number) => void;
|
|
184
|
+
readonly logsink_clear: (a: number) => void;
|
|
185
|
+
readonly logsink_drain: (a: number) => any;
|
|
186
|
+
readonly logsink_drainLines: (a: number) => [number, number];
|
|
187
|
+
readonly logsink_isEmpty: (a: number) => number;
|
|
188
|
+
readonly logsink_len: (a: number) => number;
|
|
189
|
+
readonly logsink_new: (a: number, b: number) => [number, number, number];
|
|
190
|
+
readonly logsink_onEvent: (a: number, b: number) => void;
|
|
191
|
+
readonly logsink_setCapacity: (a: number, b: number) => void;
|
|
192
|
+
readonly renderer_attribution: (a: number) => [number, number];
|
|
193
|
+
readonly renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
194
|
+
readonly renderer_boundSources: (a: number) => [number, number];
|
|
195
|
+
readonly renderer_clearSources: (a: number) => void;
|
|
196
|
+
readonly renderer_neededGlyphRanges: (a: number) => [number, number, number];
|
|
197
|
+
readonly renderer_new: (a: number, b: number) => [number, number, number];
|
|
198
|
+
readonly renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
199
|
+
readonly renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
|
|
200
|
+
readonly renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
|
|
201
|
+
readonly renderer_tileSize: (a: number) => number;
|
|
202
|
+
readonly simdEnabled: () => number;
|
|
203
|
+
readonly threadsEnabled: () => number;
|
|
204
|
+
readonly __wbindgen_malloc_command_export: (a: number, b: number) => number;
|
|
205
|
+
readonly __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
|
|
206
|
+
readonly __wbindgen_exn_store_command_export: (a: number) => void;
|
|
207
|
+
readonly __externref_table_alloc_command_export: () => number;
|
|
208
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
209
|
+
readonly __wbindgen_free_command_export: (a: number, b: number, c: number) => void;
|
|
210
|
+
readonly __externref_drop_slice_command_export: (a: number, b: number) => void;
|
|
211
|
+
readonly __externref_table_dealloc_command_export: (a: number) => void;
|
|
212
|
+
readonly __wbindgen_start: () => void;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
219
|
+
* a precompiled `WebAssembly.Module`.
|
|
220
|
+
*
|
|
221
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
222
|
+
*
|
|
223
|
+
* @returns {InitOutput}
|
|
224
|
+
*/
|
|
225
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
229
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
230
|
+
*
|
|
231
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
232
|
+
*
|
|
233
|
+
* @returns {Promise<InitOutput>}
|
|
234
|
+
*/
|
|
235
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|