@quillmark/wasm 0.131.0 → 0.133.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 +122 -0
- package/README.md +15 -7
- package/THIRD_PARTY_LICENSES.md +13 -13
- package/core/wasm.d.ts +116 -28
- package/core/wasm.js +181 -26
- package/core/wasm_bg.wasm +0 -0
- package/core/wasm_bg.wasm.d.ts +8 -2
- package/package.json +1 -1
- package/render/wasm.d.ts +121 -28
- package/render/wasm.js +181 -26
- package/render/wasm_bg.wasm +0 -0
- package/render/wasm_bg.wasm.d.ts +8 -2
- package/runtime/runtime.d.ts +11 -1
- package/runtime/runtime.js +7 -20
- package/sbom.cdx.json +110 -68
package/core/wasm.js
CHANGED
|
@@ -444,8 +444,9 @@ export class Document {
|
|
|
444
444
|
* The newest storage version this build writes via
|
|
445
445
|
* [`toStored`](Document::to_stored): a document spelling a font mark, a
|
|
446
446
|
* `table` element, a merged table cell or a table head 0.130 cannot draw
|
|
447
|
-
* carries it, every other the tag before it, which a 0.130 build reads.
|
|
448
|
-
* every
|
|
447
|
+
* carries it, every other the tag before it, which a 0.130 build reads.
|
|
448
|
+
* The tag advances only when the wire format changes, not on every
|
|
449
|
+
* release.
|
|
449
450
|
* @returns {string}
|
|
450
451
|
*/
|
|
451
452
|
static currentStorageVersion() {
|
|
@@ -713,8 +714,9 @@ export class Document {
|
|
|
713
714
|
/**
|
|
714
715
|
* **Overwrite** the content value at `addr` with exactly `rt`: value
|
|
715
716
|
* semantics, so the identity anchors of any previous value are gone. By
|
|
716
|
-
* anchor fate `overwrite` destroys, [`revise`](Document::revise)
|
|
717
|
-
*
|
|
717
|
+
* anchor fate `overwrite` destroys, [`revise`](Document::revise) and
|
|
718
|
+
* [`reviseContent`](Document::revise_content) rebase, and
|
|
719
|
+
* [`applyChange`](Document::apply_change) preserves. An absent
|
|
718
720
|
* `addr.field` targets the body, an absent `addr.card` the main card.
|
|
719
721
|
*
|
|
720
722
|
* Throws on an out-of-range card, a malformed field name, or an `rt` that is
|
|
@@ -903,6 +905,40 @@ export class Document {
|
|
|
903
905
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
904
906
|
}
|
|
905
907
|
}
|
|
908
|
+
/**
|
|
909
|
+
* **Revise** the richtext value at `addr` to `rt`, keeping each stored prose
|
|
910
|
+
* anchor whose id `rt` does not hold: the content twin of
|
|
911
|
+
* [`revise`](Document::revise), for a value built elsewhere such as a
|
|
912
|
+
* merge's projection. Diffs `rt` against the current value, carries those
|
|
913
|
+
* anchors through the diff, and returns the
|
|
914
|
+
* `Revised` receipt, whose `delta` an editor bridge maps its own positions
|
|
915
|
+
* through and whose `warnings` is empty. `rt`'s own anchors and island ids
|
|
916
|
+
* land as they are. An absent `addr.field` targets the body, an absent
|
|
917
|
+
* `addr.card` the main card; an absent field diffs from empty. Richtext
|
|
918
|
+
* only: a `text` field takes `overwrite`.
|
|
919
|
+
*
|
|
920
|
+
* Throws on an out-of-range card, a malformed field name, a present
|
|
921
|
+
* non-content field value, or an `rt` that is not a canonical content
|
|
922
|
+
* object.
|
|
923
|
+
* @param {Addr | string} addr
|
|
924
|
+
* @param {Content} rt
|
|
925
|
+
* @returns {Revised}
|
|
926
|
+
*/
|
|
927
|
+
reviseContent(addr, rt) {
|
|
928
|
+
try {
|
|
929
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
930
|
+
wasm.document_reviseContent(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(rt));
|
|
931
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
932
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
933
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
934
|
+
if (r2) {
|
|
935
|
+
throw takeObject(r1);
|
|
936
|
+
}
|
|
937
|
+
return takeObject(r0);
|
|
938
|
+
} finally {
|
|
939
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
906
942
|
/**
|
|
907
943
|
* **Revise** the richtext value at `addr` from a markdown string: the
|
|
908
944
|
* default write path. Imports the markdown, diffs it against the current
|
|
@@ -1238,35 +1274,38 @@ export class Quill {
|
|
|
1238
1274
|
}
|
|
1239
1275
|
}
|
|
1240
1276
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
*
|
|
1277
|
+
* JSON Schema (draft 2020-12) of the quill's authoring document: the
|
|
1278
|
+
* shape `fromAuthoring` takes and `toAuthoring` returns, every content
|
|
1279
|
+
* leaf a Markdown or literal string, each card kind under `$defs`
|
|
1280
|
+
* selected by `kind`.
|
|
1281
|
+
* @returns {Record<string, unknown>}
|
|
1244
1282
|
*/
|
|
1245
|
-
get
|
|
1246
|
-
let deferred1_0;
|
|
1247
|
-
let deferred1_1;
|
|
1283
|
+
get authoringSchema() {
|
|
1248
1284
|
try {
|
|
1249
1285
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1250
|
-
wasm.
|
|
1286
|
+
wasm.quill_authoringSchema(retptr, this.__wbg_ptr);
|
|
1251
1287
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1252
1288
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1289
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1290
|
+
if (r2) {
|
|
1291
|
+
throw takeObject(r1);
|
|
1292
|
+
}
|
|
1293
|
+
return takeObject(r0);
|
|
1256
1294
|
} finally {
|
|
1257
1295
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1258
|
-
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
1259
1296
|
}
|
|
1260
1297
|
}
|
|
1261
1298
|
/**
|
|
1299
|
+
* The *declared* backend identifier (e.g. `"typst"`): intent, not a
|
|
1300
|
+
* resolved capability. Capability is read from the engine.
|
|
1262
1301
|
* @returns {string}
|
|
1263
1302
|
*/
|
|
1264
|
-
get
|
|
1303
|
+
get backendId() {
|
|
1265
1304
|
let deferred1_0;
|
|
1266
1305
|
let deferred1_1;
|
|
1267
1306
|
try {
|
|
1268
1307
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1269
|
-
wasm.
|
|
1308
|
+
wasm.quill_backendId(retptr, this.__wbg_ptr);
|
|
1270
1309
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1271
1310
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1272
1311
|
deferred1_0 = r0;
|
|
@@ -1310,7 +1349,7 @@ export class Quill {
|
|
|
1310
1349
|
* The empty document: a main card carrying this quill's `$quill` and
|
|
1311
1350
|
* `$kind: main`, no field committed, no composable card, no body. The
|
|
1312
1351
|
* type-minimal valid input, and the document a plate is bound to render
|
|
1313
|
-
* (the
|
|
1352
|
+
* (the plate contract). `new Document(ref)` is the same document
|
|
1314
1353
|
* reached by spelling the reference.
|
|
1315
1354
|
* @returns {Document}
|
|
1316
1355
|
*/
|
|
@@ -1319,25 +1358,63 @@ export class Quill {
|
|
|
1319
1358
|
return Document.__wrap(ret);
|
|
1320
1359
|
}
|
|
1321
1360
|
/**
|
|
1322
|
-
* The quill's example document, `undefined` when
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
* parse or its `$quill` is not this quill's bare name.
|
|
1361
|
+
* The quill's example document, `undefined` when no slot or body declares
|
|
1362
|
+
* an example: the seeded document with every declared `example` committed
|
|
1363
|
+
* as its cell's value and each kind's `body.example` as its body. A
|
|
1364
|
+
* filled-in page whose values are made up to show the quill in use, never
|
|
1365
|
+
* kept.
|
|
1328
1366
|
* @returns {Document | undefined}
|
|
1329
1367
|
*/
|
|
1330
1368
|
exampleDocument() {
|
|
1369
|
+
const ret = wasm.quill_exampleDocument(this.__wbg_ptr);
|
|
1370
|
+
return ret === 0 ? undefined : Document.__wrap(ret);
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* A document from an authoring document, conformed against this quill:
|
|
1374
|
+
* the JSON twin of `parse`. A `null` is absent; the document carries this
|
|
1375
|
+
* quill's `$quill`. A value the schema refuses lands with a `conform::*`
|
|
1376
|
+
* warning on `doc.warnings`, and `validate` reports the rest at document
|
|
1377
|
+
* paths. Throws, with every error found, on a value that is not the
|
|
1378
|
+
* authoring document's shape (`authoring::invalid_shape`) or a name or
|
|
1379
|
+
* kind no card can store (`edit::*`).
|
|
1380
|
+
* @param {AuthoringDocument} value
|
|
1381
|
+
* @returns {Document}
|
|
1382
|
+
*/
|
|
1383
|
+
fromAuthoring(value) {
|
|
1331
1384
|
try {
|
|
1332
1385
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1333
|
-
wasm.
|
|
1386
|
+
wasm.quill_fromAuthoring(retptr, this.__wbg_ptr, addHeapObject(value));
|
|
1334
1387
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1335
1388
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1336
1389
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1337
1390
|
if (r2) {
|
|
1338
1391
|
throw takeObject(r1);
|
|
1339
1392
|
}
|
|
1340
|
-
return
|
|
1393
|
+
return Document.__wrap(r0);
|
|
1394
|
+
} finally {
|
|
1395
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Read a `.quill` bundle, the zip archive holding one quill's file tree.
|
|
1400
|
+
* Pure, as [`fromTree`](Self::from_tree) is. A bundle outside the format
|
|
1401
|
+
* throws one `quill::bundle_*` diagnostic.
|
|
1402
|
+
* @param {Uint8Array} bytes
|
|
1403
|
+
* @returns {Quill}
|
|
1404
|
+
*/
|
|
1405
|
+
static fromBundle(bytes) {
|
|
1406
|
+
try {
|
|
1407
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1408
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1409
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1410
|
+
wasm.quill_fromBundle(retptr, ptr0, len0);
|
|
1411
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1412
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1413
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1414
|
+
if (r2) {
|
|
1415
|
+
throw takeObject(r1);
|
|
1416
|
+
}
|
|
1417
|
+
return Quill.__wrap(r0);
|
|
1341
1418
|
} finally {
|
|
1342
1419
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1343
1420
|
}
|
|
@@ -1498,6 +1575,53 @@ export class Quill {
|
|
|
1498
1575
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1499
1576
|
}
|
|
1500
1577
|
}
|
|
1578
|
+
/**
|
|
1579
|
+
* `doc` as an authoring document: every field in the values form (each
|
|
1580
|
+
* content leaf its codec's text), every body as Markdown, each card
|
|
1581
|
+
* `{kind, fields, body}`. Sparse: an absent or `null` field stays absent. A
|
|
1582
|
+
* content leaf that decodes under neither encoding exports as stored.
|
|
1583
|
+
* @param {Document} doc
|
|
1584
|
+
* @returns {AuthoringDocument}
|
|
1585
|
+
*/
|
|
1586
|
+
toAuthoring(doc) {
|
|
1587
|
+
try {
|
|
1588
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1589
|
+
_assertClass(doc, Document);
|
|
1590
|
+
wasm.quill_toAuthoring(retptr, this.__wbg_ptr, doc.__wbg_ptr);
|
|
1591
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1592
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1593
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1594
|
+
if (r2) {
|
|
1595
|
+
throw takeObject(r1);
|
|
1596
|
+
}
|
|
1597
|
+
return takeObject(r0);
|
|
1598
|
+
} finally {
|
|
1599
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* This quill's file tree as a `.quill` bundle, the bytes
|
|
1604
|
+
* [`fromBundle`](Self::from_bundle) reads.
|
|
1605
|
+
* @returns {Uint8Array}
|
|
1606
|
+
*/
|
|
1607
|
+
toBundle() {
|
|
1608
|
+
try {
|
|
1609
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1610
|
+
wasm.quill_toBundle(retptr, this.__wbg_ptr);
|
|
1611
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1612
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1613
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1614
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1615
|
+
if (r3) {
|
|
1616
|
+
throw takeObject(r2);
|
|
1617
|
+
}
|
|
1618
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1619
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1620
|
+
return v1;
|
|
1621
|
+
} finally {
|
|
1622
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1501
1625
|
/**
|
|
1502
1626
|
* Flatten this quill back into its canonical file tree, the inverse of
|
|
1503
1627
|
* [`fromTree`](Self::from_tree). Keys are `"/"`-joined relative paths.
|
|
@@ -1799,6 +1923,30 @@ export function mapPos(delta, pos, assoc) {
|
|
|
1799
1923
|
}
|
|
1800
1924
|
}
|
|
1801
1925
|
|
|
1926
|
+
/**
|
|
1927
|
+
* The canonical form of `rt`: the content `overwrite` stores from it, read
|
|
1928
|
+
* without a document. Normalizing rewrites structure, never the text, so the
|
|
1929
|
+
* answer's `text` is `rt.text`. Throws where `overwrite` would, with the same
|
|
1930
|
+
* error under this verb's name.
|
|
1931
|
+
* @param {Content} rt
|
|
1932
|
+
* @returns {Content}
|
|
1933
|
+
*/
|
|
1934
|
+
export function normalize(rt) {
|
|
1935
|
+
try {
|
|
1936
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1937
|
+
wasm.normalize(retptr, addHeapObject(rt));
|
|
1938
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1939
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1940
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1941
|
+
if (r2) {
|
|
1942
|
+
throw takeObject(r1);
|
|
1943
|
+
}
|
|
1944
|
+
return takeObject(r0);
|
|
1945
|
+
} finally {
|
|
1946
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1802
1950
|
/**
|
|
1803
1951
|
* Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
|
|
1804
1952
|
* `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
|
|
@@ -2329,6 +2477,13 @@ function isLikeNone(x) {
|
|
|
2329
2477
|
return x === undefined || x === null;
|
|
2330
2478
|
}
|
|
2331
2479
|
|
|
2480
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
2481
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
2482
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
2483
|
+
WASM_VECTOR_LEN = arg.length;
|
|
2484
|
+
return ptr;
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2332
2487
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
2333
2488
|
if (realloc === undefined) {
|
|
2334
2489
|
const buf = cachedTextEncoder.encode(arg);
|
package/core/wasm_bg.wasm
CHANGED
|
Binary file
|
package/core/wasm_bg.wasm.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export const document_removeExt: (a: number, b: number, c: number) => void;
|
|
|
39
39
|
export const document_removeField: (a: number, b: number, c: number) => void;
|
|
40
40
|
export const document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
41
41
|
export const document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
42
|
+
export const document_reviseContent: (a: number, b: number, c: number, d: number) => void;
|
|
42
43
|
export const document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
43
44
|
export const document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
44
45
|
export const document_storageVersionOf: (a: number, b: number, c: number) => void;
|
|
@@ -58,13 +59,16 @@ export const isInline: (a: number, b: number) => void;
|
|
|
58
59
|
export const isPlain: (a: number, b: number) => void;
|
|
59
60
|
export const mapMarks: (a: number, b: number, c: number) => void;
|
|
60
61
|
export const mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
62
|
+
export const normalize: (a: number, b: number) => void;
|
|
61
63
|
export const parseDocPath: (a: number, b: number, c: number) => void;
|
|
62
64
|
export const quill__resolve: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
65
|
+
export const quill_authoringSchema: (a: number, b: number) => void;
|
|
63
66
|
export const quill_backendId: (a: number, b: number) => void;
|
|
64
|
-
export const quill_blueprint: (a: number, b: number) => void;
|
|
65
67
|
export const quill_conform: (a: number, b: number, c: number) => void;
|
|
66
68
|
export const quill_emptyDocument: (a: number) => number;
|
|
67
|
-
export const quill_exampleDocument: (a: number
|
|
69
|
+
export const quill_exampleDocument: (a: number) => number;
|
|
70
|
+
export const quill_fromAuthoring: (a: number, b: number, c: number) => void;
|
|
71
|
+
export const quill_fromBundle: (a: number, b: number, c: number) => void;
|
|
68
72
|
export const quill_fromTree: (a: number, b: number) => void;
|
|
69
73
|
export const quill_metadata: (a: number, b: number) => void;
|
|
70
74
|
export const quill_parse: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -72,6 +76,8 @@ export const quill_schema: (a: number, b: number) => void;
|
|
|
72
76
|
export const quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
73
77
|
export const quill_seedDocument: (a: number) => number;
|
|
74
78
|
export const quill_seedMain: (a: number, b: number) => void;
|
|
79
|
+
export const quill_toAuthoring: (a: number, b: number, c: number) => void;
|
|
80
|
+
export const quill_toBundle: (a: number, b: number) => void;
|
|
75
81
|
export const quill_toTree: (a: number) => number;
|
|
76
82
|
export const quill_validate: (a: number, b: number, c: number) => void;
|
|
77
83
|
export const quill_warnings: (a: number, b: number) => void;
|
package/package.json
CHANGED
package/render/wasm.d.ts
CHANGED
|
@@ -80,8 +80,7 @@ export type ContentLineKind =
|
|
|
80
80
|
| { kind: "para" }
|
|
81
81
|
| { kind: "heading"; attrs: { level: number } }
|
|
82
82
|
| { kind: "code"; attrs?: { lang?: string } }
|
|
83
|
-
| { kind: "rule" }
|
|
84
|
-
| { kind: "term" };
|
|
83
|
+
| { kind: "rule" };
|
|
85
84
|
|
|
86
85
|
/** An ancestor block a line nests inside, outermost first. Closed like
|
|
87
86
|
* `ContentLine.kind`.
|
|
@@ -110,14 +109,7 @@ export type ContentContainer =
|
|
|
110
109
|
attrs: { ordered: boolean; start: number; ordinal: number; checked?: boolean };
|
|
111
110
|
instance?: number;
|
|
112
111
|
}
|
|
113
|
-
| { container: "quote"; instance?: number }
|
|
114
|
-
| { container: "description"; instance?: number }
|
|
115
|
-
| { container: "element"; attrs: ElementAttrs; instance?: number };
|
|
116
|
-
|
|
117
|
-
/** A carrier element's name and attributes, one bag: `$name` is the part of
|
|
118
|
-
* its `qm-<name>` tag after the prefix, and every other key an attribute as
|
|
119
|
-
* written. */
|
|
120
|
-
export type ElementAttrs = { $name: string; [attr: string]: string };
|
|
112
|
+
| { container: "quote"; instance?: number };
|
|
121
113
|
|
|
122
114
|
/** A mark over char range `[start, end)` into `Content.text`. `type` is a
|
|
123
115
|
* closed set, so `type === "link"` narrows `attrs` to `{ url: string }` with no
|
|
@@ -251,9 +243,10 @@ export interface Delta {
|
|
|
251
243
|
}
|
|
252
244
|
|
|
253
245
|
/**
|
|
254
|
-
* The receipt of a
|
|
246
|
+
* The receipt of a revise (`revise`, `reviseContent`, `writer.reviseBody`,
|
|
255
247
|
* `writer.reviseField`): the text `delta`, and one `parse::dropped_construct`
|
|
256
|
-
* warning per construct
|
|
248
|
+
* warning per construct a markdown import dropped, anchored at the revised
|
|
249
|
+
* address. `reviseContent` imports nothing, so its `warnings` is empty.
|
|
257
250
|
*/
|
|
258
251
|
export interface Revised {
|
|
259
252
|
delta: Delta;
|
|
@@ -365,7 +358,9 @@ export type LineOp =
|
|
|
365
358
|
*
|
|
366
359
|
* A `table` has no inline placement: markdown writes it as a block, so an
|
|
367
360
|
* `insert` whose `at` is not an empty line throws, as does a `set` retyping an
|
|
368
|
-
* inline island into one.
|
|
361
|
+
* inline island into one. A table already sharing its line, as a `join` or an
|
|
362
|
+
* `overwrite` of merged edits leaves one, stays there and takes its `set`;
|
|
363
|
+
* markdown writes it on a line of its own.
|
|
369
364
|
*/
|
|
370
365
|
export type IslandOp =
|
|
371
366
|
| ({ op: "set" } & ContentIsland)
|
|
@@ -532,6 +527,11 @@ export interface QuillCardUi {
|
|
|
532
527
|
export interface QuillCardBody {
|
|
533
528
|
/** When false, consumers must not accept or store body content for this card kind. Defaults to true. */
|
|
534
529
|
enabled?: boolean;
|
|
530
|
+
/** What the body holds, for the writer. Never beside `enabled: false`. */
|
|
531
|
+
description?: string;
|
|
532
|
+
/** A made-up body in markdown, which `exampleDocument()` commits. Never
|
|
533
|
+
* beside `enabled: false`. */
|
|
534
|
+
example?: string;
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
export type QuillFieldType = "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "text" | "richtext" | "enum" | "matrix";
|
|
@@ -539,7 +539,8 @@ export type QuillFieldType = "number" | "integer" | "boolean" | "array" | "objec
|
|
|
539
539
|
/** Schema entry for a single field declared in a quill's `Quill.yaml`.
|
|
540
540
|
*
|
|
541
541
|
* `default` is the value an unanswered cell renders. An absent field without a
|
|
542
|
-
* `default` blank-fills.
|
|
542
|
+
* `default` blank-fills. `example` is a made-up value of the same type, which
|
|
543
|
+
* answers no cell: `exampleDocument()` commits it.
|
|
543
544
|
*/
|
|
544
545
|
export interface QuillFieldSchema {
|
|
545
546
|
/** A trailing `?` marks the cell optional: unanswered, it renders `none`
|
|
@@ -551,6 +552,7 @@ export interface QuillFieldSchema {
|
|
|
551
552
|
title?: string;
|
|
552
553
|
description?: string;
|
|
553
554
|
default?: unknown;
|
|
555
|
+
example?: unknown;
|
|
554
556
|
/** The closed set of allowed values. Required on `type: "enum"`, and valid
|
|
555
557
|
* nowhere else. */
|
|
556
558
|
values?: string[];
|
|
@@ -615,6 +617,26 @@ export interface QuillSchema {
|
|
|
615
617
|
card_kinds?: Record<string, QuillCardSchema>;
|
|
616
618
|
}
|
|
617
619
|
|
|
620
|
+
/**
|
|
621
|
+
* One card of an `AuthoringDocument`: its kind, its fields in the values form,
|
|
622
|
+
* and its body as Markdown. `null` anywhere a value goes is absent.
|
|
623
|
+
*/
|
|
624
|
+
export interface AuthoringCard {
|
|
625
|
+
kind: string;
|
|
626
|
+
fields?: Record<string, unknown> | null;
|
|
627
|
+
body?: string | null;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* The JSON a model reads and writes, described by `Quill.authoringSchema`:
|
|
632
|
+
* the main card's fields and body, and the composable cards in order.
|
|
633
|
+
*/
|
|
634
|
+
export interface AuthoringDocument {
|
|
635
|
+
fields?: Record<string, unknown> | null;
|
|
636
|
+
body?: string | null;
|
|
637
|
+
cards?: AuthoringCard[] | null;
|
|
638
|
+
}
|
|
639
|
+
|
|
618
640
|
/**
|
|
619
641
|
* Identity snapshot mirroring the `quill:` section of `Quill.yaml`. The schema
|
|
620
642
|
* lives on `Quill.schema`; output formats are a resolved-backend capability read
|
|
@@ -774,6 +796,11 @@ export interface RenderOptions {
|
|
|
774
796
|
* document-space even when `pages` selects a subset.
|
|
775
797
|
*/
|
|
776
798
|
regions?: boolean;
|
|
799
|
+
/**
|
|
800
|
+
* The PDF document title, over the plate's own and then the quill's
|
|
801
|
+
* `description`. A blank title counts as absent; ignored for PNG and SVG.
|
|
802
|
+
*/
|
|
803
|
+
title?: string;
|
|
777
804
|
}
|
|
778
805
|
|
|
779
806
|
export interface RenderResult {
|
|
@@ -838,8 +865,9 @@ export class Document {
|
|
|
838
865
|
* The newest storage version this build writes via
|
|
839
866
|
* [`toStored`](Document::to_stored): a document spelling a font mark, a
|
|
840
867
|
* `table` element, a merged table cell or a table head 0.130 cannot draw
|
|
841
|
-
* carries it, every other the tag before it, which a 0.130 build reads.
|
|
842
|
-
* every
|
|
868
|
+
* carries it, every other the tag before it, which a 0.130 build reads.
|
|
869
|
+
* The tag advances only when the wire format changes, not on every
|
|
870
|
+
* release.
|
|
843
871
|
*/
|
|
844
872
|
static currentStorageVersion(): string;
|
|
845
873
|
/**
|
|
@@ -920,8 +948,9 @@ export class Document {
|
|
|
920
948
|
/**
|
|
921
949
|
* **Overwrite** the content value at `addr` with exactly `rt`: value
|
|
922
950
|
* semantics, so the identity anchors of any previous value are gone. By
|
|
923
|
-
* anchor fate `overwrite` destroys, [`revise`](Document::revise)
|
|
924
|
-
*
|
|
951
|
+
* anchor fate `overwrite` destroys, [`revise`](Document::revise) and
|
|
952
|
+
* [`reviseContent`](Document::revise_content) rebase, and
|
|
953
|
+
* [`applyChange`](Document::apply_change) preserves. An absent
|
|
925
954
|
* `addr.field` targets the body, an absent `addr.card` the main card.
|
|
926
955
|
*
|
|
927
956
|
* Throws on an out-of-range card, a malformed field name, or an `rt` that is
|
|
@@ -968,6 +997,23 @@ export class Document {
|
|
|
968
997
|
* or `undefined`; drops `$seed` entirely once empty. Sibling kinds survive.
|
|
969
998
|
*/
|
|
970
999
|
removeSeedOverlay(card_kind: string): any;
|
|
1000
|
+
/**
|
|
1001
|
+
* **Revise** the richtext value at `addr` to `rt`, keeping each stored prose
|
|
1002
|
+
* anchor whose id `rt` does not hold: the content twin of
|
|
1003
|
+
* [`revise`](Document::revise), for a value built elsewhere such as a
|
|
1004
|
+
* merge's projection. Diffs `rt` against the current value, carries those
|
|
1005
|
+
* anchors through the diff, and returns the
|
|
1006
|
+
* `Revised` receipt, whose `delta` an editor bridge maps its own positions
|
|
1007
|
+
* through and whose `warnings` is empty. `rt`'s own anchors and island ids
|
|
1008
|
+
* land as they are. An absent `addr.field` targets the body, an absent
|
|
1009
|
+
* `addr.card` the main card; an absent field diffs from empty. Richtext
|
|
1010
|
+
* only: a `text` field takes `overwrite`.
|
|
1011
|
+
*
|
|
1012
|
+
* Throws on an out-of-range card, a malformed field name, a present
|
|
1013
|
+
* non-content field value, or an `rt` that is not a canonical content
|
|
1014
|
+
* object.
|
|
1015
|
+
*/
|
|
1016
|
+
reviseContent(addr: Addr | string, rt: Content): Revised;
|
|
971
1017
|
/**
|
|
972
1018
|
* **Revise** the richtext value at `addr` from a markdown string: the
|
|
973
1019
|
* default write path. Imports the markdown, diffs it against the current
|
|
@@ -1255,19 +1301,34 @@ export class Quill {
|
|
|
1255
1301
|
* The empty document: a main card carrying this quill's `$quill` and
|
|
1256
1302
|
* `$kind: main`, no field committed, no composable card, no body. The
|
|
1257
1303
|
* type-minimal valid input, and the document a plate is bound to render
|
|
1258
|
-
* (the
|
|
1304
|
+
* (the plate contract). `new Document(ref)` is the same document
|
|
1259
1305
|
* reached by spelling the reference.
|
|
1260
1306
|
*/
|
|
1261
1307
|
emptyDocument(): Document;
|
|
1262
1308
|
/**
|
|
1263
|
-
* The quill's example document, `undefined` when
|
|
1264
|
-
*
|
|
1265
|
-
*
|
|
1266
|
-
*
|
|
1267
|
-
*
|
|
1268
|
-
* parse or its `$quill` is not this quill's bare name.
|
|
1309
|
+
* The quill's example document, `undefined` when no slot or body declares
|
|
1310
|
+
* an example: the seeded document with every declared `example` committed
|
|
1311
|
+
* as its cell's value and each kind's `body.example` as its body. A
|
|
1312
|
+
* filled-in page whose values are made up to show the quill in use, never
|
|
1313
|
+
* kept.
|
|
1269
1314
|
*/
|
|
1270
1315
|
exampleDocument(): Document | undefined;
|
|
1316
|
+
/**
|
|
1317
|
+
* A document from an authoring document, conformed against this quill:
|
|
1318
|
+
* the JSON twin of `parse`. A `null` is absent; the document carries this
|
|
1319
|
+
* quill's `$quill`. A value the schema refuses lands with a `conform::*`
|
|
1320
|
+
* warning on `doc.warnings`, and `validate` reports the rest at document
|
|
1321
|
+
* paths. Throws, with every error found, on a value that is not the
|
|
1322
|
+
* authoring document's shape (`authoring::invalid_shape`) or a name or
|
|
1323
|
+
* kind no card can store (`edit::*`).
|
|
1324
|
+
*/
|
|
1325
|
+
fromAuthoring(value: AuthoringDocument): Document;
|
|
1326
|
+
/**
|
|
1327
|
+
* Read a `.quill` bundle, the zip archive holding one quill's file tree.
|
|
1328
|
+
* Pure, as [`fromTree`](Self::from_tree) is. A bundle outside the format
|
|
1329
|
+
* throws one `quill::bundle_*` diagnostic.
|
|
1330
|
+
*/
|
|
1331
|
+
static fromBundle(bytes: Uint8Array): Quill;
|
|
1271
1332
|
/**
|
|
1272
1333
|
* Build a quill from a file tree. Pure: the declared backend is resolved
|
|
1273
1334
|
* later, at render time. Accepts a `Map<string, Uint8Array>` or a plain
|
|
@@ -1310,6 +1371,18 @@ export class Quill {
|
|
|
1310
1371
|
* `$kind: main` card of [`seedDocument`](Self::seed_document) alone.
|
|
1311
1372
|
*/
|
|
1312
1373
|
seedMain(): Card;
|
|
1374
|
+
/**
|
|
1375
|
+
* `doc` as an authoring document: every field in the values form (each
|
|
1376
|
+
* content leaf its codec's text), every body as Markdown, each card
|
|
1377
|
+
* `{kind, fields, body}`. Sparse: an absent or `null` field stays absent. A
|
|
1378
|
+
* content leaf that decodes under neither encoding exports as stored.
|
|
1379
|
+
*/
|
|
1380
|
+
toAuthoring(doc: Document): AuthoringDocument;
|
|
1381
|
+
/**
|
|
1382
|
+
* This quill's file tree as a `.quill` bundle, the bytes
|
|
1383
|
+
* [`fromBundle`](Self::from_bundle) reads.
|
|
1384
|
+
*/
|
|
1385
|
+
toBundle(): Uint8Array;
|
|
1313
1386
|
/**
|
|
1314
1387
|
* Flatten this quill back into its canonical file tree, the inverse of
|
|
1315
1388
|
* [`fromTree`](Self::from_tree). Keys are `"/"`-joined relative paths.
|
|
@@ -1327,12 +1400,18 @@ export class Quill {
|
|
|
1327
1400
|
* backend's `backend::declined_construct`.
|
|
1328
1401
|
*/
|
|
1329
1402
|
validate(doc: Document): Diagnostic[];
|
|
1403
|
+
/**
|
|
1404
|
+
* JSON Schema (draft 2020-12) of the quill's authoring document: the
|
|
1405
|
+
* shape `fromAuthoring` takes and `toAuthoring` returns, every content
|
|
1406
|
+
* leaf a Markdown or literal string, each card kind under `$defs`
|
|
1407
|
+
* selected by `kind`.
|
|
1408
|
+
*/
|
|
1409
|
+
readonly authoringSchema: Record<string, unknown>;
|
|
1330
1410
|
/**
|
|
1331
1411
|
* The *declared* backend identifier (e.g. `"typst"`): intent, not a
|
|
1332
1412
|
* resolved capability. Capability is read from the engine.
|
|
1333
1413
|
*/
|
|
1334
1414
|
readonly backendId: string;
|
|
1335
|
-
readonly blueprint: string;
|
|
1336
1415
|
/**
|
|
1337
1416
|
* Identity snapshot of the `quill:` section of `Quill.yaml`. Pure config:
|
|
1338
1417
|
* output formats are a resolved-backend capability read from
|
|
@@ -1432,6 +1511,14 @@ export function mapMarks(content: Content, bundle: ChangeBundle): ContentMark[];
|
|
|
1432
1511
|
*/
|
|
1433
1512
|
export function mapPos(delta: Delta, pos: number, assoc: Assoc): number;
|
|
1434
1513
|
|
|
1514
|
+
/**
|
|
1515
|
+
* The canonical form of `rt`: the content `overwrite` stores from it, read
|
|
1516
|
+
* without a document. Normalizing rewrites structure, never the text, so the
|
|
1517
|
+
* answer's `text` is `rt.text`. Throws where `overwrite` would, with the same
|
|
1518
|
+
* error under this verb's name.
|
|
1519
|
+
*/
|
|
1520
|
+
export function normalize(rt: Content): Content;
|
|
1521
|
+
|
|
1435
1522
|
/**
|
|
1436
1523
|
* Parse a canonical document-model `Diagnostic.path` (`cards.<kind>[<i>].<field>`,
|
|
1437
1524
|
* `main.body`, `recipients[0].name`) into structured `DocPathSeg` segments, so
|
|
@@ -1500,6 +1587,7 @@ export interface InitOutput {
|
|
|
1500
1587
|
readonly document_removeField: (a: number, b: number, c: number) => void;
|
|
1501
1588
|
readonly document_removeSeedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
1502
1589
|
readonly document_revise: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1590
|
+
readonly document_reviseContent: (a: number, b: number, c: number, d: number) => void;
|
|
1503
1591
|
readonly document_seedOverlay: (a: number, b: number, c: number, d: number) => void;
|
|
1504
1592
|
readonly document_setQuillRef: (a: number, b: number, c: number, d: number) => void;
|
|
1505
1593
|
readonly document_storageVersionOf: (a: number, b: number, c: number) => void;
|
|
@@ -1537,13 +1625,16 @@ export interface InitOutput {
|
|
|
1537
1625
|
readonly livesession_warnings: (a: number, b: number) => void;
|
|
1538
1626
|
readonly mapMarks: (a: number, b: number, c: number) => void;
|
|
1539
1627
|
readonly mapPos: (a: number, b: number, c: number, d: number) => void;
|
|
1628
|
+
readonly normalize: (a: number, b: number) => void;
|
|
1540
1629
|
readonly parseDocPath: (a: number, b: number, c: number) => void;
|
|
1541
1630
|
readonly quill__resolve: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1631
|
+
readonly quill_authoringSchema: (a: number, b: number) => void;
|
|
1542
1632
|
readonly quill_backendId: (a: number, b: number) => void;
|
|
1543
|
-
readonly quill_blueprint: (a: number, b: number) => void;
|
|
1544
1633
|
readonly quill_conform: (a: number, b: number, c: number) => void;
|
|
1545
1634
|
readonly quill_emptyDocument: (a: number) => number;
|
|
1546
|
-
readonly quill_exampleDocument: (a: number
|
|
1635
|
+
readonly quill_exampleDocument: (a: number) => number;
|
|
1636
|
+
readonly quill_fromAuthoring: (a: number, b: number, c: number) => void;
|
|
1637
|
+
readonly quill_fromBundle: (a: number, b: number, c: number) => void;
|
|
1547
1638
|
readonly quill_fromTree: (a: number, b: number) => void;
|
|
1548
1639
|
readonly quill_metadata: (a: number, b: number) => void;
|
|
1549
1640
|
readonly quill_parse: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -1551,6 +1642,8 @@ export interface InitOutput {
|
|
|
1551
1642
|
readonly quill_seedCard: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1552
1643
|
readonly quill_seedDocument: (a: number) => number;
|
|
1553
1644
|
readonly quill_seedMain: (a: number, b: number) => void;
|
|
1645
|
+
readonly quill_toAuthoring: (a: number, b: number, c: number) => void;
|
|
1646
|
+
readonly quill_toBundle: (a: number, b: number) => void;
|
|
1554
1647
|
readonly quill_toTree: (a: number) => number;
|
|
1555
1648
|
readonly quill_validate: (a: number, b: number, c: number) => void;
|
|
1556
1649
|
readonly quill_warnings: (a: number, b: number) => void;
|