/* tslint:disable */ /* eslint-disable */ /** * Result of a one-shot export. */ export class ExportOnceResult { private constructor(); free(): void; [Symbol.dispose](): void; /** * The exported document. */ data: Uint8Array; /** * Compilation warnings as an array of diagnostic objects. */ warnings: any; } /** * Drop all fonts registered by the host. * * Templates that are already registered keep the fonts they were created with. */ export function clear_fonts(): void; /** * Compile the identified template with the given inputs. * * Calling this method requires a previous call to [`register_template`] with the same template * identifier. */ export function compile_template(template: string, json_inputs: any, blob_inputs: any, compilation_mode: any): string; /** * Configure automatic cache eviction after each compilation. * * # Parameters * * `max_age` (start value: 10) - Maximum age threshold, or null to disable: * - `null` - Disables cache eviction (cache never cleared) * - `0` - Clears all cache entries with every eviction * - `1` - Keeps only entries used since the last eviction * - `n` - Keeps entries used within the last n evictions */ export function configure_automatic_cache_eviction(max_age?: number | null): void; /** * Configure the coloring of compilation diagnostics. */ export function configure_diagnostic_color(ansi: boolean): void; /** * Return the sizes (in points) of every page of a compiled document as a JSON * array of `{ "width": number, "height": number }`. * * Calling this method requires a previous call to [`compile_template`] (or * [`register_template`]) that produced the given `document_id`. */ export function document_pages(document_id: string): string; /** * Manually evict the comemo cache with the given age threshold. * * This directly calls the underlying eviction with the specified age, * regardless of the configured default age. */ export function evict_cache(max_age: number): void; /** * Export the given document * * `page_range` is a `{ start?: number; end?: number }` object with 0-based, * inclusive bounds. If not set, the whole document is exported. * * Make sure to call `removeDocument` with the documentId afterwards, to free the memory. */ export function export_document(document_id: string, export_format: any, page_range: any): Uint8Array; /** * Compile and export the given template once, without keeping the template in the cache. * * `page_range` is a `{ start?: number; end?: number }` object with 0-based, * inclusive bounds. If not set, the whole document is exported. */ export function export_template_once(files: Uint8Array, json_inputs: any, blob_inputs: any, compilation_mode: any, export_format: any, page_range: any, limits: any): ExportOnceResult; /** * Load the raw bytes of the given file in the template. * * Calling this method requires a previous call to [`register_template`] with the same template * identifier. */ export function get_file(template: string, file: string): Uint8Array; /** * Load the source of the given file in the template. * * Calling this method requires a previous call to [`register_template`] with the same template * identifier. */ export function get_source(template: string, file: string): string; /** * Return the compilation warnings produced for the given document as an array * of diagnostic objects. Warnings are cleared when the document is removed. */ export function get_warnings(document_id: string): any; /** * Load the manifest of the given template. * * Calling this method requires a previous call to [`register_template`] with the same template * identifier. */ export function manifest(template: string): string; /** * Make fonts available to every template registered from now on. * * Data that holds no font Typst can read is ignored. Returns the number of font * faces that were added. */ export function register_fonts(fonts: Uint8Array[]): number; /** * Register the given template. This will read the template as a [`PackedTemplate`] and compile it * once with the given inputs. The Typst [`typst::World`] will be cached and reused for subsequent * calls to the other methods with the same template identifier. */ export function register_template(template: string, files: Uint8Array, json_inputs: any, blob_inputs: any, compilation_mode: any, limits: any): string; /** * All font faces currently registered, as `{ family, path }` objects. */ export function registered_fonts(): any; /** * Remove the document from the cache. */ export function remove_document(document_id: string): void; /** * Remove the world from the cache. * * The template will have to be registered again before it can be compiled again. */ export function remove_world(template_id: string): void; /** * Set the maximum log level for console output. * * Accepts `off`, `error`, `warn`, `info`, `debug`, or `trace`. The default is `warn`. */ export function set_log_level(level: string): void; /** * Enable or disable JSON schema validation for the given template. * * When enabled (the default), JSON inputs are validated against their schemas * before compilation. * * Calling this method requires a previous call to [`register_template`] with the same template * identifier. */ export function set_validate_inputs(template: string, validate: boolean): void; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_exportonceresult_free: (a: number, b: number) => void; readonly __wbg_get_exportonceresult_data: (a: number, b: number) => void; readonly __wbg_get_exportonceresult_warnings: (a: number) => number; readonly __wbg_set_exportonceresult_data: (a: number, b: number, c: number) => void; readonly __wbg_set_exportonceresult_warnings: (a: number, b: number) => void; readonly clear_fonts: () => void; readonly compile_template: (a: number, b: number, c: number, d: number, e: number, f: number) => void; readonly configure_automatic_cache_eviction: (a: number) => void; readonly configure_diagnostic_color: (a: number) => void; readonly document_pages: (a: number, b: number, c: number) => void; readonly evict_cache: (a: number) => void; readonly export_document: (a: number, b: number, c: number, d: number, e: number) => void; readonly export_template_once: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void; readonly get_file: (a: number, b: number, c: number, d: number, e: number) => void; readonly get_source: (a: number, b: number, c: number, d: number, e: number) => void; readonly get_warnings: (a: number, b: number, c: number) => void; readonly manifest: (a: number, b: number, c: number) => void; readonly register_fonts: (a: number, b: number) => number; readonly register_template: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void; readonly registered_fonts: (a: number) => void; readonly remove_document: (a: number, b: number, c: number) => void; readonly remove_world: (a: number, b: number, c: number) => void; readonly set_log_level: (a: number, b: number, c: number) => void; readonly set_validate_inputs: (a: number, b: number, c: number, d: number) => void; readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number; readonly rust_zstd_wasm_shim_free: (a: number) => void; readonly rust_zstd_wasm_shim_malloc: (a: number) => number; readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number; readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number; readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number; readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number; readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void; readonly __wbindgen_export: (a: number, b: number) => number; readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_export3: (a: number) => void; readonly __wbindgen_export4: (a: number, b: number, c: number) => void; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise;