@quillmark/wasm 0.88.0 → 0.90.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/CHANGELOG.md +127 -0
- package/README.md +79 -27
- package/{bundler → backends/typst}/wasm.d.ts +60 -24
- package/{bundler → backends/typst}/wasm_bg.js +119 -55
- package/{bundler → backends/typst}/wasm_bg.wasm +0 -0
- package/{bundler → backends/typst}/wasm_bg.wasm.d.ts +6 -4
- package/core/wasm.d.ts +439 -0
- package/core/wasm.js +9 -0
- package/core/wasm_bg.js +1496 -0
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +62 -0
- package/package.json +13 -13
- package/runtime/runtime.d.ts +212 -0
- package/runtime/runtime.js +378 -0
- /package/{bundler → backends/typst}/wasm.js +0 -0
|
@@ -229,8 +229,8 @@ export class Document {
|
|
|
229
229
|
* insertion order); `body` defaults to `""`. Kind validity is checked by
|
|
230
230
|
* `pushCard` / `insertCard`, not here.
|
|
231
231
|
* @param {string} kind
|
|
232
|
-
* @param {Record<string, unknown>} fields
|
|
233
|
-
* @param {string
|
|
232
|
+
* @param {Record<string, unknown>} [fields]
|
|
233
|
+
* @param {string} [body]
|
|
234
234
|
* @returns {Card}
|
|
235
235
|
*/
|
|
236
236
|
static makeCard(kind, fields, body) {
|
|
@@ -798,7 +798,9 @@ export class Quill {
|
|
|
798
798
|
wasm.__wbg_quill_free(ptr, 0);
|
|
799
799
|
}
|
|
800
800
|
/**
|
|
801
|
-
* The
|
|
801
|
+
* The *declared* backend identifier (`config.backend`, e.g. `"typst"`).
|
|
802
|
+
* Intent, not a resolved capability — capability (`supportedFormats` /
|
|
803
|
+
* `supportsCanvas`) is read from the engine.
|
|
802
804
|
* @returns {string}
|
|
803
805
|
*/
|
|
804
806
|
get backendId() {
|
|
@@ -837,54 +839,41 @@ export class Quill {
|
|
|
837
839
|
}
|
|
838
840
|
}
|
|
839
841
|
/**
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
*
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
* @param {Document} doc
|
|
850
|
-
* @returns {RenderSession}
|
|
842
|
+
* Build a quill from a file tree. Pure — no backend, no engine; the
|
|
843
|
+
* declared backend is resolved later, at render time.
|
|
844
|
+
*
|
|
845
|
+
* Accepts either a `Map<string, Uint8Array>` or a plain object
|
|
846
|
+
* (`Record<string, Uint8Array>`). Plain objects are walked via
|
|
847
|
+
* `Object.entries` at the boundary; the Rust side sees a single
|
|
848
|
+
* canonical shape.
|
|
849
|
+
* @param {Map<string, Uint8Array>} tree
|
|
850
|
+
* @returns {Quill}
|
|
851
851
|
*/
|
|
852
|
-
|
|
852
|
+
static fromTree(tree) {
|
|
853
853
|
try {
|
|
854
854
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
855
|
-
|
|
856
|
-
wasm.quill_open(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
855
|
+
wasm.quill_fromTree(retptr, addHeapObject(tree));
|
|
857
856
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
858
857
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
859
858
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
860
859
|
if (r2) {
|
|
861
860
|
throw takeObject(r1);
|
|
862
861
|
}
|
|
863
|
-
return
|
|
862
|
+
return Quill.__wrap(r0);
|
|
864
863
|
} finally {
|
|
865
864
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
866
865
|
}
|
|
867
866
|
}
|
|
868
867
|
/**
|
|
869
|
-
*
|
|
870
|
-
*
|
|
871
|
-
*
|
|
868
|
+
* Identity snapshot of the `quill:` section of `Quill.yaml` plus any extra
|
|
869
|
+
* `quill:` keys. Pure config — the backend's output formats are a
|
|
870
|
+
* resolved-backend capability read from the engine
|
|
871
|
+
* (`Quillmark.supportedFormats`), not part of this snapshot.
|
|
872
|
+
* @returns {QuillMetadata}
|
|
872
873
|
*/
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
_assertClass(doc, Document);
|
|
877
|
-
wasm.quill_render(retptr, this.__wbg_ptr, doc.__wbg_ptr, isLikeNone(opts) ? 0 : addHeapObject(opts));
|
|
878
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
879
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
880
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
881
|
-
if (r2) {
|
|
882
|
-
throw takeObject(r1);
|
|
883
|
-
}
|
|
884
|
-
return takeObject(r0);
|
|
885
|
-
} finally {
|
|
886
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
887
|
-
}
|
|
874
|
+
get metadata() {
|
|
875
|
+
const ret = wasm.quill_metadata(this.__wbg_ptr);
|
|
876
|
+
return takeObject(ret);
|
|
888
877
|
}
|
|
889
878
|
/**
|
|
890
879
|
* Document schema for the quill: the user-fillable fields plus their
|
|
@@ -937,14 +926,21 @@ export class Quill {
|
|
|
937
926
|
return takeObject(ret);
|
|
938
927
|
}
|
|
939
928
|
/**
|
|
940
|
-
*
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
*
|
|
929
|
+
* Flatten this quill back into its canonical file tree — the inverse of
|
|
930
|
+
* [`fromTree`](Self::from_tree). Round-trips: `Quill.fromTree(q.toTree())`
|
|
931
|
+
* reproduces an equivalent quill.
|
|
932
|
+
*
|
|
933
|
+
* This is how a quill crosses a WASM linear-memory boundary as data: a
|
|
934
|
+
* `Quill` built in one build (e.g. the Typst-less `@quillmark/wasm/core`)
|
|
935
|
+
* cannot be passed to an engine in another (separate linear memories), so
|
|
936
|
+
* `@quillmark/wasm/runtime` re-feeds this tree to the backend build's
|
|
937
|
+
* `Quill.fromTree` on demand. Keys are `"/"`-joined relative paths,
|
|
938
|
+
* matching what `fromTree` accepts.
|
|
939
|
+
* @returns {Map<string, Uint8Array>}
|
|
944
940
|
*/
|
|
945
|
-
|
|
946
|
-
const ret = wasm.
|
|
947
|
-
return ret
|
|
941
|
+
toTree() {
|
|
942
|
+
const ret = wasm.quill_toTree(this.__wbg_ptr);
|
|
943
|
+
return takeObject(ret);
|
|
948
944
|
}
|
|
949
945
|
/**
|
|
950
946
|
* Validate `doc` against this quill's schema, returning every diagnostic
|
|
@@ -978,6 +974,10 @@ export class Quill {
|
|
|
978
974
|
}
|
|
979
975
|
if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
|
|
980
976
|
|
|
977
|
+
/**
|
|
978
|
+
* Render engine: a backend registry and render dispatcher. Render build only —
|
|
979
|
+
* the core build constructs and validates quills without it.
|
|
980
|
+
*/
|
|
981
981
|
export class Quillmark {
|
|
982
982
|
__destroy_into_raw() {
|
|
983
983
|
const ptr = this.__wbg_ptr;
|
|
@@ -996,30 +996,89 @@ export class Quillmark {
|
|
|
996
996
|
return this;
|
|
997
997
|
}
|
|
998
998
|
/**
|
|
999
|
-
*
|
|
1000
|
-
*
|
|
1001
|
-
*
|
|
1002
|
-
*
|
|
1003
|
-
* `Object.entries` at the boundary; the Rust side sees a single
|
|
1004
|
-
* canonical shape.
|
|
1005
|
-
* @param {Map<string, Uint8Array>} tree
|
|
1006
|
-
* @returns {Quill}
|
|
999
|
+
* Open an iterative render session for `doc` against `quill`'s backend.
|
|
1000
|
+
* @param {Quill} quill
|
|
1001
|
+
* @param {Document} doc
|
|
1002
|
+
* @returns {RenderSession}
|
|
1007
1003
|
*/
|
|
1008
|
-
quill
|
|
1004
|
+
open(quill, doc) {
|
|
1009
1005
|
try {
|
|
1010
1006
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1011
|
-
|
|
1007
|
+
_assertClass(quill, Quill);
|
|
1008
|
+
_assertClass(doc, Document);
|
|
1009
|
+
wasm.quillmark_open(retptr, this.__wbg_ptr, quill.__wbg_ptr, doc.__wbg_ptr);
|
|
1012
1010
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1013
1011
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1014
1012
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1015
1013
|
if (r2) {
|
|
1016
1014
|
throw takeObject(r1);
|
|
1017
1015
|
}
|
|
1018
|
-
return
|
|
1016
|
+
return RenderSession.__wrap(r0);
|
|
1019
1017
|
} finally {
|
|
1020
1018
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1021
1019
|
}
|
|
1022
1020
|
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Render `doc` against `quill` in one shot. Convenience over `open` +
|
|
1023
|
+
* `RenderSession.render`: an unset `output_format` falls back to the
|
|
1024
|
+
* backend's first supported format.
|
|
1025
|
+
* @param {Quill} quill
|
|
1026
|
+
* @param {Document} doc
|
|
1027
|
+
* @param {RenderOptions | null} [opts]
|
|
1028
|
+
* @returns {RenderResult}
|
|
1029
|
+
*/
|
|
1030
|
+
render(quill, doc, opts) {
|
|
1031
|
+
try {
|
|
1032
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1033
|
+
_assertClass(quill, Quill);
|
|
1034
|
+
_assertClass(doc, Document);
|
|
1035
|
+
wasm.quillmark_render(retptr, this.__wbg_ptr, quill.__wbg_ptr, doc.__wbg_ptr, isLikeNone(opts) ? 0 : addHeapObject(opts));
|
|
1036
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1037
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1038
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1039
|
+
if (r2) {
|
|
1040
|
+
throw takeObject(r1);
|
|
1041
|
+
}
|
|
1042
|
+
return takeObject(r0);
|
|
1043
|
+
} finally {
|
|
1044
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* The output formats `quill`'s backend can emit. Static capability —
|
|
1049
|
+
* resolves the backend but compiles nothing. Throws `UnsupportedBackend`
|
|
1050
|
+
* if no registered backend matches the quill's declared backend.
|
|
1051
|
+
* @param {Quill} quill
|
|
1052
|
+
* @returns {OutputFormat[]}
|
|
1053
|
+
*/
|
|
1054
|
+
supportedFormats(quill) {
|
|
1055
|
+
try {
|
|
1056
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1057
|
+
_assertClass(quill, Quill);
|
|
1058
|
+
wasm.quillmark_supportedFormats(retptr, this.__wbg_ptr, quill.__wbg_ptr);
|
|
1059
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1060
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1061
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1062
|
+
if (r2) {
|
|
1063
|
+
throw takeObject(r1);
|
|
1064
|
+
}
|
|
1065
|
+
return takeObject(r0);
|
|
1066
|
+
} finally {
|
|
1067
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* `true` iff `quill`'s backend can paint sessions to a canvas. Asked of
|
|
1072
|
+
* the real backend; `false` when the backend is unsupported or non-canvas.
|
|
1073
|
+
* Use as a precondition probe before mounting a canvas-based preview UI.
|
|
1074
|
+
* @param {Quill} quill
|
|
1075
|
+
* @returns {boolean}
|
|
1076
|
+
*/
|
|
1077
|
+
supportsCanvas(quill) {
|
|
1078
|
+
_assertClass(quill, Quill);
|
|
1079
|
+
const ret = wasm.quillmark_supportsCanvas(this.__wbg_ptr, quill.__wbg_ptr);
|
|
1080
|
+
return ret !== 0;
|
|
1081
|
+
}
|
|
1023
1082
|
}
|
|
1024
1083
|
if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
|
|
1025
1084
|
|
|
@@ -1146,7 +1205,8 @@ export class RenderSession {
|
|
|
1146
1205
|
}
|
|
1147
1206
|
}
|
|
1148
1207
|
/**
|
|
1149
|
-
* `true` iff `paint` and `pageSize` will succeed for this session.
|
|
1208
|
+
* `true` iff `paint` and `pageSize` will succeed for this session. The
|
|
1209
|
+
* backend's canvas capability, captured at open time.
|
|
1150
1210
|
* @returns {boolean}
|
|
1151
1211
|
*/
|
|
1152
1212
|
get supportsCanvas() {
|
|
@@ -1455,6 +1515,10 @@ export function __wbg_new_aa8d0fa9762c29bd() {
|
|
|
1455
1515
|
const ret = new Object();
|
|
1456
1516
|
return addHeapObject(ret);
|
|
1457
1517
|
}
|
|
1518
|
+
export function __wbg_new_from_slice_b5ea43e23f6008c0(arg0, arg1) {
|
|
1519
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1520
|
+
return addHeapObject(ret);
|
|
1521
|
+
}
|
|
1458
1522
|
export function __wbg_new_with_u8_clamped_array_and_sh_fe957411824b5158() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1459
1523
|
const ret = new ImageData(getClampedArrayU8FromWasm0(arg0, arg1), arg2 >>> 0, arg3 >>> 0);
|
|
1460
1524
|
return addHeapObject(ret);
|
|
Binary file
|
|
@@ -48,17 +48,19 @@ export const document_warnings: (a: number) => number;
|
|
|
48
48
|
export const init: () => void;
|
|
49
49
|
export const quill_backendId: (a: number, b: number) => void;
|
|
50
50
|
export const quill_blueprint: (a: number, b: number) => void;
|
|
51
|
+
export const quill_fromTree: (a: number, b: number) => void;
|
|
51
52
|
export const quill_metadata: (a: number) => number;
|
|
52
|
-
export const quill_open: (a: number, b: number, c: number) => void;
|
|
53
|
-
export const quill_render: (a: number, b: number, c: number, d: number) => void;
|
|
54
53
|
export const quill_schema: (a: number) => number;
|
|
55
54
|
export const quill_seedCard: (a: number, b: number, c: number) => number;
|
|
56
55
|
export const quill_seedDocument: (a: number) => number;
|
|
57
56
|
export const quill_seedMain: (a: number) => number;
|
|
58
|
-
export const
|
|
57
|
+
export const quill_toTree: (a: number) => number;
|
|
59
58
|
export const quill_validate: (a: number, b: number, c: number) => void;
|
|
60
59
|
export const quillmark_new: () => number;
|
|
61
|
-
export const
|
|
60
|
+
export const quillmark_open: (a: number, b: number, c: number, d: number) => void;
|
|
61
|
+
export const quillmark_render: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
62
|
+
export const quillmark_supportedFormats: (a: number, b: number, c: number) => void;
|
|
63
|
+
export const quillmark_supportsCanvas: (a: number, b: number) => number;
|
|
62
64
|
export const rendersession_backendId: (a: number, b: number) => void;
|
|
63
65
|
export const rendersession_pageCount: (a: number) => number;
|
|
64
66
|
export const rendersession_pageSize: (a: number, b: number, c: number) => void;
|