@typbase/engine 0.2.1
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/LICENSE +661 -0
- package/engine.d.ts +569 -0
- package/engine.js +1387 -0
- package/engine_bg.wasm +0 -0
- package/package.json +20 -0
package/engine.d.ts
ADDED
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* A `#typbase.section(kind: ...)[...]` block. Ranges are raw source bytes;
|
|
5
|
+
* `content_start..content_end` is the markup inside the brackets.
|
|
6
|
+
*/
|
|
7
|
+
export interface SectionSpan {
|
|
8
|
+
kind: string;
|
|
9
|
+
content_start: number;
|
|
10
|
+
content_end: number;
|
|
11
|
+
full_start: number;
|
|
12
|
+
full_end: number;
|
|
13
|
+
title: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A file, source, or package the compiler asked for but the world does not
|
|
18
|
+
* have. Every compile returns the requests it accumulated; the caller
|
|
19
|
+
* resolves them (workspace source, blob bytes, package tarball) and recompiles.
|
|
20
|
+
*/
|
|
21
|
+
export type TypstRequest = { type: "source"; value: string } | { type: "file"; value: string } | { type: "package"; value: { namespace: string; name: string; version: string } };
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A notebook cell: one `// %%` marker line plus the content below it, up to
|
|
25
|
+
* the next marker or the end of the document. Ranges are UTF-16 offsets into
|
|
26
|
+
* the raw source, so they can be used as editor positions directly.
|
|
27
|
+
*/
|
|
28
|
+
export interface CellSpan {
|
|
29
|
+
/**
|
|
30
|
+
* Cell type from the marker label: `"markup"` or `"code"`.
|
|
31
|
+
*/
|
|
32
|
+
kind: string;
|
|
33
|
+
/**
|
|
34
|
+
* Marker line range, excluding the newline. Both zero on the implicit
|
|
35
|
+
* leading cell of a document whose first marker is not on line one.
|
|
36
|
+
*/
|
|
37
|
+
marker_start: number;
|
|
38
|
+
marker_end: number;
|
|
39
|
+
/**
|
|
40
|
+
* Content range. Blank lines below the content belong to the gap before
|
|
41
|
+
* the next marker and are excluded.
|
|
42
|
+
*/
|
|
43
|
+
content_start: number;
|
|
44
|
+
content_end: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An SVG frame with its corresponding source range.
|
|
49
|
+
*/
|
|
50
|
+
export interface SvgRangedFrame {
|
|
51
|
+
/**
|
|
52
|
+
* UTF-16 range in the source for this frame.
|
|
53
|
+
*/
|
|
54
|
+
range: { start: number; end: number };
|
|
55
|
+
/**
|
|
56
|
+
* The SVG render data.
|
|
57
|
+
*/
|
|
58
|
+
render: SvgFrameRender;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* One flattened source block. `map[i]` is the raw byte offset of plain byte
|
|
63
|
+
* `i`; FTS offsets in `plain` translate through it to editor positions.
|
|
64
|
+
*/
|
|
65
|
+
export interface FlattenedBlock {
|
|
66
|
+
kind: string;
|
|
67
|
+
plain: string;
|
|
68
|
+
range_start: number;
|
|
69
|
+
range_end: number;
|
|
70
|
+
map: number[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* One link call in a page source, in UTF-16 offsets.
|
|
75
|
+
*/
|
|
76
|
+
export interface LinkSpan {
|
|
77
|
+
/**
|
|
78
|
+
* The link form: `"page-link"`, `"embed"`, or `"url"`.
|
|
79
|
+
*/
|
|
80
|
+
kind: string;
|
|
81
|
+
/**
|
|
82
|
+
* The page reference: the id argument for `page-link` and `embed`, or the
|
|
83
|
+
* id part of a `typbase://page/<id>` URL.
|
|
84
|
+
*/
|
|
85
|
+
target: string;
|
|
86
|
+
/**
|
|
87
|
+
* UTF-16 range of the whole call.
|
|
88
|
+
*/
|
|
89
|
+
from: number;
|
|
90
|
+
to: number;
|
|
91
|
+
/**
|
|
92
|
+
* UTF-16 range of the target string's contents, inside the quotes.
|
|
93
|
+
*/
|
|
94
|
+
target_from: number;
|
|
95
|
+
target_to: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* One segment in the check report, labelled for humans.
|
|
100
|
+
*/
|
|
101
|
+
export interface CheckedSegment {
|
|
102
|
+
kind: string;
|
|
103
|
+
generated: boolean;
|
|
104
|
+
from: number;
|
|
105
|
+
from_end: number;
|
|
106
|
+
to: number;
|
|
107
|
+
to_end: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Rendered SVG data for a frame, including metadata.
|
|
112
|
+
*/
|
|
113
|
+
export interface SvgFrameRender {
|
|
114
|
+
/**
|
|
115
|
+
* SVG markup as a string.
|
|
116
|
+
*/
|
|
117
|
+
svg: string;
|
|
118
|
+
/**
|
|
119
|
+
* Width of the frame in points.
|
|
120
|
+
*/
|
|
121
|
+
width: number;
|
|
122
|
+
/**
|
|
123
|
+
* Height of the frame in points.
|
|
124
|
+
*/
|
|
125
|
+
height: number;
|
|
126
|
+
/**
|
|
127
|
+
* Offset from the left of the page in points.
|
|
128
|
+
*/
|
|
129
|
+
xOffset: number;
|
|
130
|
+
/**
|
|
131
|
+
* Hash of the frame items for change detection.
|
|
132
|
+
*/
|
|
133
|
+
yOffset: number;
|
|
134
|
+
/**
|
|
135
|
+
* Hash of the frame items for change detection.
|
|
136
|
+
*/
|
|
137
|
+
hash: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Result of SVG rendering, containing SVG frames and diagnostics.
|
|
142
|
+
*/
|
|
143
|
+
export interface SvgRender {
|
|
144
|
+
/**
|
|
145
|
+
* Rendered SVG frames for each chunk.
|
|
146
|
+
*/
|
|
147
|
+
frames: SvgRangedFrame[];
|
|
148
|
+
/**
|
|
149
|
+
* Rendered SVG frames for tooltips.
|
|
150
|
+
*/
|
|
151
|
+
tooltips: SvgRangedFrame[];
|
|
152
|
+
/**
|
|
153
|
+
* Diagnostics and warnings produced during rendering.
|
|
154
|
+
*/
|
|
155
|
+
diagnostics: TypstDiagnostic[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Result of `TypstState::check_index`: a self-test of the source maps.
|
|
160
|
+
*/
|
|
161
|
+
export interface IndexCheckReport {
|
|
162
|
+
/**
|
|
163
|
+
* True when every checked invariant held.
|
|
164
|
+
*/
|
|
165
|
+
ok: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* How many positions were sampled for each direction.
|
|
168
|
+
*/
|
|
169
|
+
checked: number;
|
|
170
|
+
/**
|
|
171
|
+
* Human-readable descriptions of failed invariants.
|
|
172
|
+
*/
|
|
173
|
+
mismatches: string[];
|
|
174
|
+
/**
|
|
175
|
+
* Every segment of the raw to pristine-synth map, for the debug lab.
|
|
176
|
+
*/
|
|
177
|
+
segments: CheckedSegment[];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Result of rendering a Typst document to HTML.
|
|
182
|
+
*/
|
|
183
|
+
export interface RenderHtmlResult {
|
|
184
|
+
/**
|
|
185
|
+
* The rendered HTML document, if successful.
|
|
186
|
+
*/
|
|
187
|
+
document: string | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Diagnostics and warnings produced during rendering.
|
|
190
|
+
*/
|
|
191
|
+
diagnostics: TypstDiagnostic[];
|
|
192
|
+
/**
|
|
193
|
+
* Requests the caller must satisfy before re-rendering (query JSON,
|
|
194
|
+
* embedded pages). The editor's `compileHTML` carries them too; the
|
|
195
|
+
* publish worker needs them on this path.
|
|
196
|
+
*/
|
|
197
|
+
requests: TypstRequest[];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* SVG export: one string per page, or a single merged document.
|
|
202
|
+
*/
|
|
203
|
+
export interface RenderSvgResult {
|
|
204
|
+
pages: string[];
|
|
205
|
+
diagnostics: TypstDiagnostic[];
|
|
206
|
+
requests: TypstRequest[];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface Autocomplete {
|
|
210
|
+
offset: number;
|
|
211
|
+
completions: TypstCompletion[];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface CheckResult {
|
|
215
|
+
diagnostics: TypstDiagnostic[];
|
|
216
|
+
requests: TypstRequest[];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface CompileHTMLResult {
|
|
220
|
+
frames: HTMLRangedFrame[];
|
|
221
|
+
diagnostics: TypstDiagnostic[];
|
|
222
|
+
requests: TypstRequest[];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface CompilePagedResult {
|
|
226
|
+
frames: SvgRangedFrame[];
|
|
227
|
+
tooltips: SvgRangedFrame[];
|
|
228
|
+
diagnostics: TypstDiagnostic[];
|
|
229
|
+
requests: TypstRequest[];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface HTMLFrameRender {
|
|
233
|
+
html: string;
|
|
234
|
+
hash: number;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface HTMLRangedFrame {
|
|
238
|
+
range: { start: number; end: number };
|
|
239
|
+
render: HTMLFrameRender;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface HTMLRenderResult {
|
|
243
|
+
frames: HTMLRangedFrame[];
|
|
244
|
+
diagnostics: TypstDiagnostic[];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface RenderPdfResult {
|
|
248
|
+
bytes: number[] | undefined;
|
|
249
|
+
diagnostics: TypstDiagnostic[];
|
|
250
|
+
requests: TypstRequest[];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface TypstCompletion {
|
|
254
|
+
type: TypstCompletionKind;
|
|
255
|
+
label: string;
|
|
256
|
+
apply: string | undefined;
|
|
257
|
+
detail: string | undefined;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface TypstDiagnostic {
|
|
261
|
+
range: { start: number; end: number };
|
|
262
|
+
severity: TypstDiagnosticSeverity;
|
|
263
|
+
message: string;
|
|
264
|
+
hints: string[];
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface TypstHighlight {
|
|
268
|
+
tag: string;
|
|
269
|
+
range: { start: number; end: number };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export type TypstCompletionKind = "syntax" | "func" | "type" | "param" | "constant" | "path" | "package" | "label" | "font" | "symbol";
|
|
273
|
+
|
|
274
|
+
export type TypstDiagnosticSeverity = "error" | "warning" | "info" | "hint";
|
|
275
|
+
|
|
276
|
+
export type TypstError = EcoString;
|
|
277
|
+
|
|
278
|
+
export type TypstJump = { type: "File"; position: number };
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
export class FileId {
|
|
282
|
+
private constructor();
|
|
283
|
+
free(): void;
|
|
284
|
+
[Symbol.dispose](): void;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export class Rgb {
|
|
288
|
+
free(): void;
|
|
289
|
+
[Symbol.dispose](): void;
|
|
290
|
+
constructor(r: number, g: number, b: number);
|
|
291
|
+
toString(): string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Colors handed to Typst as the `theme` dictionary. The slots mirror the
|
|
296
|
+
* app's resolved `ThemePaletteTokens` one to one (plus derived `on-*` text
|
|
297
|
+
* colors), so a single token set styles both the chrome and rendered pages.
|
|
298
|
+
* The dict keys in [`fmt::Display`] are the kebab-case token names Typst
|
|
299
|
+
* code reads. `overlay` stays chrome-only: it carries alpha and Rgb cannot.
|
|
300
|
+
*/
|
|
301
|
+
export class ThemeColors {
|
|
302
|
+
free(): void;
|
|
303
|
+
[Symbol.dispose](): void;
|
|
304
|
+
constructor(surface: Rgb, surface2: Rgb, surface3: Rgb, border: Rgb, border_strong: Rgb, text: Rgb, text_secondary: Rgb, accent: Rgb, accent_soft: Rgb, on_accent: Rgb, ok: Rgb, ok_soft: Rgb, warning: Rgb, warning_soft: Rgb, danger: Rgb, danger_soft: Rgb, on_danger: Rgb, info: Rgb, info_soft: Rgb, red: Rgb, orange: Rgb, yellow: Rgb, green: Rgb, cyan: Rgb, blue: Rgb, violet: Rgb, code: Rgb);
|
|
305
|
+
/**
|
|
306
|
+
* Generated tmTheme text, for writing into exported project bundles.
|
|
307
|
+
*/
|
|
308
|
+
tmTheme(): string;
|
|
309
|
+
/**
|
|
310
|
+
* Virtual path of `tmTheme`, with no leading slash.
|
|
311
|
+
*/
|
|
312
|
+
tmThemePath(): string;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Global state for Typst rendering and compilation in Typbase.
|
|
317
|
+
*
|
|
318
|
+
* Holds the world, all open source and space contexts, and manages the mapping
|
|
319
|
+
* between user/editor state and Typst's compilation model.
|
|
320
|
+
*/
|
|
321
|
+
export class TypstState {
|
|
322
|
+
free(): void;
|
|
323
|
+
[Symbol.dispose](): void;
|
|
324
|
+
autocomplete(id: FileId, raw_cursor_utf16: number, explicit: boolean): Autocomplete | undefined;
|
|
325
|
+
/**
|
|
326
|
+
* Diagnostics-only HTML pass: compile the pristine synth, no recovery.
|
|
327
|
+
*/
|
|
328
|
+
checkHTML(id: FileId, text: string, prelude: string): CheckResult;
|
|
329
|
+
/**
|
|
330
|
+
* Index mapping self-test for the debug lab. Builds the synth exactly
|
|
331
|
+
* like a compile would, then verifies map invariants: segments tile both
|
|
332
|
+
* spaces, both directions stay in bounds, and neither regresses.
|
|
333
|
+
*/
|
|
334
|
+
checkIndex(id: FileId, text: string, prelude: string): IndexCheckReport;
|
|
335
|
+
/**
|
|
336
|
+
* Diagnostics-only pass: compile the pristine synth, no recovery.
|
|
337
|
+
*/
|
|
338
|
+
checkPaged(id: FileId, text: string, prelude: string): CheckResult;
|
|
339
|
+
/**
|
|
340
|
+
* The editor's inline HTML render: one ranged frame for the whole note,
|
|
341
|
+
* with the frames renderer's block-blanking recovery. Publishing, export,
|
|
342
|
+
* and chat use `renderHtml` (see [`document`]) instead.
|
|
343
|
+
*/
|
|
344
|
+
compileHTML(id: FileId, text: string, prelude: string): CompileHTMLResult;
|
|
345
|
+
/**
|
|
346
|
+
* The editor's paged render: one SVG frame per source chunk, plus the
|
|
347
|
+
* tooltip frames and diagnostics the editor needs.
|
|
348
|
+
*/
|
|
349
|
+
compilePaged(id: FileId, text: string, prelude: string): CompilePagedResult;
|
|
350
|
+
createFileId(path: string): FileId;
|
|
351
|
+
createSourceId(path: string, space_id: string): FileId;
|
|
352
|
+
/**
|
|
353
|
+
* Clears Typst's global memoization caches. They make repeated compiles
|
|
354
|
+
* cheap but grow for the lifetime of the instance, so call this when
|
|
355
|
+
* memory matters more than speed, such as on a workspace switch.
|
|
356
|
+
*/
|
|
357
|
+
evictCaches(): void;
|
|
358
|
+
/**
|
|
359
|
+
* Evicts entries unused across two eviction rounds. The heap watchdog
|
|
360
|
+
* uses this while typing: per-keystroke entries age out, shared entries
|
|
361
|
+
* such as the library and fonts stay warm.
|
|
362
|
+
*/
|
|
363
|
+
evictCachesAged(max_age: number): void;
|
|
364
|
+
/**
|
|
365
|
+
* Extracts notebook cells (`// %%` markers) as UTF-16 spans, ready for
|
|
366
|
+
* CodeMirror positions. Pure syntax pass; no state needed.
|
|
367
|
+
*/
|
|
368
|
+
extractCells(text: string): CellSpan[];
|
|
369
|
+
/**
|
|
370
|
+
* Extracts the app's link calls (`typbase.page-link`, `typbase.embed`,
|
|
371
|
+
* and `typbase://page/` URLs) with UTF-16 ranges. Pure syntax pass; no
|
|
372
|
+
* state needed.
|
|
373
|
+
*/
|
|
374
|
+
extractLinks(text: string): LinkSpan[];
|
|
375
|
+
/**
|
|
376
|
+
* Extracts `#typbase.section` spans for the page doc's sections list.
|
|
377
|
+
*/
|
|
378
|
+
extractSections(text: string): SectionSpan[];
|
|
379
|
+
/**
|
|
380
|
+
* Plain-text flattening per block for the search index, plus the byte
|
|
381
|
+
* map back to raw source. Pure syntax pass; no state needed.
|
|
382
|
+
*/
|
|
383
|
+
flattenDocument(text: string): FlattenedBlock[];
|
|
384
|
+
highlight(id: FileId, text: string): TypstHighlight[];
|
|
385
|
+
hover(id: FileId, raw_cursor_utf16: number, side: number): string | undefined;
|
|
386
|
+
insertFile(id: FileId, bytes: Uint8Array): void;
|
|
387
|
+
insertSource(id: FileId, text: string): void;
|
|
388
|
+
installFont(bytes: Uint8Array): void;
|
|
389
|
+
installPackage(spec: string, data: Uint8Array): void;
|
|
390
|
+
jumpHTML(id: FileId, element: Uint32Array): TypstJump | undefined;
|
|
391
|
+
jumpPaged(id: FileId, x: number, y: number): TypstJump | undefined;
|
|
392
|
+
/**
|
|
393
|
+
* Current WASM heap size in bytes. The lab watches this to catch leaks;
|
|
394
|
+
* the wasm allocator rarely returns memory to the browser, so growth
|
|
395
|
+
* here usually means a compile loop.
|
|
396
|
+
*/
|
|
397
|
+
memoryBytes(): number;
|
|
398
|
+
constructor();
|
|
399
|
+
/**
|
|
400
|
+
* False when the shipped wasm build omits the pdf feature (the default).
|
|
401
|
+
*/
|
|
402
|
+
pdfAvailable(): boolean;
|
|
403
|
+
removeFile(id: FileId): void;
|
|
404
|
+
removePackage(spec: string): void;
|
|
405
|
+
/**
|
|
406
|
+
* Renders the whole note to one HTML document, with recovery. Used by
|
|
407
|
+
* publish, export, and chat; the editor's inline frames use
|
|
408
|
+
* `compileHTML` instead.
|
|
409
|
+
*/
|
|
410
|
+
renderHtml(id: FileId, text: string, prelude: string): RenderHtmlResult;
|
|
411
|
+
/**
|
|
412
|
+
* PDF publishing, compiled only when the `pdf` cargo feature is on.
|
|
413
|
+
* Returns the PDF bytes plus diagnostics; the caller uploads the bytes
|
|
414
|
+
* as a blob on `at.typbase.post`.
|
|
415
|
+
*/
|
|
416
|
+
renderPdf(id: FileId, text: string, prelude: string): RenderPdfResult;
|
|
417
|
+
/**
|
|
418
|
+
* SVG export of the paged document: one entry per page, or a single
|
|
419
|
+
* merged document. Uses the PDF page geometry so the sheets match the
|
|
420
|
+
* PDF export; the caller sets the page width through `resize`.
|
|
421
|
+
*/
|
|
422
|
+
renderSvg(id: FileId, text: string, prelude: string, merged: boolean): RenderSvgResult;
|
|
423
|
+
resize(id: FileId, width?: number | null, height?: number | null): boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Monotonic counter bumped on font/theme/config changes. Re-render
|
|
426
|
+
* decisions key on this, not on the file path alone.
|
|
427
|
+
*/
|
|
428
|
+
revision(): number;
|
|
429
|
+
setCodeFont(id: FileId, code_font?: string | null): void;
|
|
430
|
+
setFont(id: FileId, font: string): void;
|
|
431
|
+
/**
|
|
432
|
+
* The editor's line-height as a multiple of the text size. Frame crops
|
|
433
|
+
* move their top to the editor's line box so the rendered text sits on
|
|
434
|
+
* the same baseline as the source text.
|
|
435
|
+
*/
|
|
436
|
+
setLineHeightRatio(id: FileId, ratio: number): void;
|
|
437
|
+
setLocale(id: FileId, locale: string): void;
|
|
438
|
+
setMathFont(id: FileId, math_font?: string | null): void;
|
|
439
|
+
setTextSize(id: FileId, text_size: number): void;
|
|
440
|
+
setTheme(id: FileId, theme: ThemeColors): void;
|
|
441
|
+
/**
|
|
442
|
+
* The style block alone, for exports and the project mirror: the same
|
|
443
|
+
* text the engine prepends, minus the render-target page config.
|
|
444
|
+
*/
|
|
445
|
+
static stylePrelude(theme: ThemeColors, text_size: number, font: string, math_font: string | null | undefined, code_font: string | null | undefined, locale: string): string;
|
|
446
|
+
/**
|
|
447
|
+
* The stdlib source as shipped, for writing a compilable project to disk.
|
|
448
|
+
*/
|
|
449
|
+
typbaseLib(): string;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* True when the module was built by the dev profile.
|
|
454
|
+
*
|
|
455
|
+
* The two wasm tasks write the same `pkg/` directory, so a stray
|
|
456
|
+
* `engine:build-dev` edge in a release graph silently swaps the optimized
|
|
457
|
+
* engine for the unoptimized one. Release tooling can read this before
|
|
458
|
+
* publishing; custom sections cannot key that kind of check because wasm-opt
|
|
459
|
+
* and wasm-bindgen rewrite them.
|
|
460
|
+
*/
|
|
461
|
+
export function isDevelopmentBuild(): boolean;
|
|
462
|
+
|
|
463
|
+
export function start(): void;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Drains the allocation-failure flag without going through a `TypstState`
|
|
467
|
+
* handle.
|
|
468
|
+
*
|
|
469
|
+
* A trap inside a `&mut self` method leaves wasm-bindgen's borrow flag set
|
|
470
|
+
* (there is no unwinding and no `Drop`), so the method form of this call
|
|
471
|
+
* throws the aliasing error on the dead object exactly when the host needs
|
|
472
|
+
* the reason for the failure. This free function touches a static and a
|
|
473
|
+
* primitive only, so it works on a poisoned instance.
|
|
474
|
+
*/
|
|
475
|
+
export function takeOomGlobal(): boolean;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Drains the panic message without going through a `TypstState` handle.
|
|
479
|
+
* See [`take_oom_global`] for why the method form is not usable here.
|
|
480
|
+
*/
|
|
481
|
+
export function takePanicGlobal(): string | undefined;
|
|
482
|
+
|
|
483
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
484
|
+
|
|
485
|
+
export interface InitOutput {
|
|
486
|
+
readonly memory: WebAssembly.Memory;
|
|
487
|
+
readonly __wbg_fileid_free: (a: number, b: number) => void;
|
|
488
|
+
readonly __wbg_rgb_free: (a: number, b: number) => void;
|
|
489
|
+
readonly __wbg_themecolors_free: (a: number, b: number) => void;
|
|
490
|
+
readonly __wbg_typststate_free: (a: number, b: number) => void;
|
|
491
|
+
readonly isDevelopmentBuild: () => number;
|
|
492
|
+
readonly rgb_new: (a: number, b: number, c: number) => number;
|
|
493
|
+
readonly rgb_toString: (a: number, b: number) => void;
|
|
494
|
+
readonly start: () => void;
|
|
495
|
+
readonly takeOomGlobal: () => number;
|
|
496
|
+
readonly takePanicGlobal: (a: number) => void;
|
|
497
|
+
readonly themecolors_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number) => number;
|
|
498
|
+
readonly themecolors_tmTheme: (a: number, b: number) => void;
|
|
499
|
+
readonly themecolors_tmThemePath: (a: number, b: number) => void;
|
|
500
|
+
readonly typststate_autocomplete: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
501
|
+
readonly typststate_checkHTML: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
502
|
+
readonly typststate_checkIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
503
|
+
readonly typststate_checkPaged: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
504
|
+
readonly typststate_compileHTML: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
505
|
+
readonly typststate_compilePaged: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
506
|
+
readonly typststate_createFileId: (a: number, b: number, c: number) => number;
|
|
507
|
+
readonly typststate_createSourceId: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
508
|
+
readonly typststate_evictCaches: (a: number) => void;
|
|
509
|
+
readonly typststate_evictCachesAged: (a: number, b: number) => void;
|
|
510
|
+
readonly typststate_extractCells: (a: number, b: number, c: number, d: number) => void;
|
|
511
|
+
readonly typststate_extractLinks: (a: number, b: number, c: number, d: number) => void;
|
|
512
|
+
readonly typststate_extractSections: (a: number, b: number, c: number, d: number) => void;
|
|
513
|
+
readonly typststate_flattenDocument: (a: number, b: number, c: number, d: number) => void;
|
|
514
|
+
readonly typststate_highlight: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
515
|
+
readonly typststate_hover: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
516
|
+
readonly typststate_insertFile: (a: number, b: number, c: number, d: number) => void;
|
|
517
|
+
readonly typststate_insertSource: (a: number, b: number, c: number, d: number) => void;
|
|
518
|
+
readonly typststate_installFont: (a: number, b: number, c: number) => void;
|
|
519
|
+
readonly typststate_installPackage: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
520
|
+
readonly typststate_jumpHTML: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
521
|
+
readonly typststate_jumpPaged: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
522
|
+
readonly typststate_memoryBytes: (a: number) => number;
|
|
523
|
+
readonly typststate_new: () => number;
|
|
524
|
+
readonly typststate_pdfAvailable: (a: number) => number;
|
|
525
|
+
readonly typststate_removeFile: (a: number, b: number) => void;
|
|
526
|
+
readonly typststate_removePackage: (a: number, b: number, c: number, d: number) => void;
|
|
527
|
+
readonly typststate_renderHtml: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
528
|
+
readonly typststate_renderPdf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
529
|
+
readonly typststate_renderSvg: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
530
|
+
readonly typststate_resize: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
531
|
+
readonly typststate_revision: (a: number) => number;
|
|
532
|
+
readonly typststate_setCodeFont: (a: number, b: number, c: number, d: number) => void;
|
|
533
|
+
readonly typststate_setFont: (a: number, b: number, c: number, d: number) => void;
|
|
534
|
+
readonly typststate_setLineHeightRatio: (a: number, b: number, c: number) => void;
|
|
535
|
+
readonly typststate_setLocale: (a: number, b: number, c: number, d: number) => void;
|
|
536
|
+
readonly typststate_setMathFont: (a: number, b: number, c: number, d: number) => void;
|
|
537
|
+
readonly typststate_setTextSize: (a: number, b: number, c: number) => void;
|
|
538
|
+
readonly typststate_setTheme: (a: number, b: number, c: number) => void;
|
|
539
|
+
readonly typststate_stylePrelude: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
|
540
|
+
readonly typststate_typbaseLib: (a: number, b: number) => void;
|
|
541
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
542
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
543
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
544
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
545
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
546
|
+
readonly __wbindgen_start: () => void;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
553
|
+
* a precompiled `WebAssembly.Module`.
|
|
554
|
+
*
|
|
555
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
556
|
+
*
|
|
557
|
+
* @returns {InitOutput}
|
|
558
|
+
*/
|
|
559
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
563
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
564
|
+
*
|
|
565
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
566
|
+
*
|
|
567
|
+
* @returns {Promise<InitOutput>}
|
|
568
|
+
*/
|
|
569
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|