@quillmark/wasm 0.124.0 → 0.125.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.
@@ -142,6 +142,7 @@ export type {
142
142
  Revised,
143
143
  DocumentRevised,
144
144
  AnnotatedMarkdown,
145
+ DocumentAnchor,
145
146
  Imported,
146
147
  Assoc,
147
148
  IslandOp,
@@ -332,14 +333,30 @@ export interface FieldRegion {
332
333
  rect: [number, number, number, number];
333
334
  /**
334
335
  * The content slice this box covers: USV `[start, end)` into the field's
335
- * `Content` for content ink (one segment), absent for a scalar reference
336
- * site or widget. Consumers key segment highlights on it;
336
+ * `Content` for content ink (one segment), absent for a scalar's or a
337
+ * date's ink, a claim or a widget. Consumers key segment highlights on it;
337
338
  * {@link LiveSession.fieldBoxes} unions same-page segments for the
338
339
  * whole-field box.
339
340
  */
340
341
  span?: [number, number];
341
342
  }
342
343
 
344
+ /**
345
+ * One address a compiled document fills, and the region address a click
346
+ * reaches it through. A report, not a gate: a field a quill never prints is
347
+ * legitimately unreachable.
348
+ */
349
+ export interface FieldCoverage {
350
+ /** The field's canonical `DocPath` address, as {@link FieldRegion.field}. */
351
+ field: string;
352
+ /**
353
+ * The `DocPath` of the region reaching `field`: `field` itself, or the
354
+ * nearest enclosing address a region carries (a row claim reaching its
355
+ * cells, a whole array its elements). Absent where no click reaches it.
356
+ */
357
+ coveredBy?: string;
358
+ }
359
+
343
360
  /** Result of one render. */
344
361
  export interface RenderResult {
345
362
  artifacts: Artifact[];
@@ -415,8 +432,8 @@ export declare class Engine {
415
432
  * soon as this call returns.
416
433
  *
417
434
  * {@link RenderResult.warnings} carries every `quill.validate(doc)` warning
418
- * but `validation::declined_construct`, which the compile raises as
419
- * `backend::declined_construct`, then the compile's own. The load's (parse
435
+ * but `backend::declined_construct`, then the compile's own, a decline among
436
+ * them. The load's (parse
420
437
  * and `conform::*`) stay on `doc.warnings`, and a revise's on its receipt.
421
438
  * A {@link LiveSession} carries the compile's alone: read
422
439
  * `quill.validate(doc)` beside it.
@@ -494,22 +511,27 @@ export declare class LiveSession {
494
511
  * Empty for backends that place no schema fields.
495
512
  *
496
513
  * `field` is **not** unique: a content field surfaces its **first placement**
497
- * as one {@link FieldRegion} per page that placement touches, a scalar
498
- * referenced at several plate sites surfaces each site, and tracked content
499
- * plus a `field:`-bound widget yields both, widget first. Group by `field`.
500
- * Later placements of one content value are not enumerated; {@link fieldAt}
501
- * still resolves clicks on them.
514
+ * as one {@link FieldRegion} per page that placement touches, each claim on
515
+ * a field surfaces its own, and tracked content plus a `field:`-bound widget
516
+ * yields both, widget first. Group by `field`. Later placements of one value
517
+ * are not enumerated; {@link fieldAt} still resolves clicks on them.
502
518
  */
503
519
  regions(): FieldRegion[];
504
520
  /**
505
521
  * The whole-field highlight boxes for `field` (a canonical `DocPath` address,
506
522
  * as {@link regions} keys): one union rect per page over the field's
507
523
  * `span`-bearing content segments, the union {@link regions} leaves derived.
508
- * **Content only**: a field placed solely as a scalar reference or a bound
509
- * widget carries no `span` and returns `[]`, its box being a single
524
+ * **Content only**: a field placed solely as a scalar's ink, a claim or a
525
+ * bound widget carries no `span` and returns `[]`, its box being a single
510
526
  * {@link regions} rect. Reflects the current compile.
511
527
  */
512
528
  fieldBoxes(field: string): FieldRegion[];
529
+ /**
530
+ * Every address the current compile fills that a reader could want to
531
+ * click — each non-blank declared leaf, every roster member held or not —
532
+ * with the region reaching it. Reflects the current compile.
533
+ */
534
+ coverage(): FieldCoverage[];
513
535
  /**
514
536
  * The schema field whose content is under a point on `page`: the canonical
515
537
  * `DocPath` address to focus in the editor, or `undefined` off any field's
@@ -616,15 +638,18 @@ export declare class DocumentWriter {
616
638
  readonly document: Document;
617
639
  /**
618
640
  * Typed-commit one main-card field (strict coerce, mismatch throws now).
619
- * Throws `UnknownField` for a name the schema does not declare.
641
+ * Throws `UnknownField` for a name the schema does not declare. Returns a
642
+ * `parse::dropped_construct` warning per construct a `richtext` markdown
643
+ * string in the value dropped, at the string's path.
620
644
  */
621
- set(name: string, value: unknown): void;
645
+ set(name: string, value: unknown): Diagnostic[];
622
646
  /**
623
647
  * Typed-commit several main-card fields atomically: nothing is applied on
624
648
  * error (throws a {@link QuillmarkError} carrying one diagnostic per
625
649
  * offending field, including an `UnknownField` for each undeclared name).
650
+ * Returns `set`'s warnings for every field, in batch order.
626
651
  */
627
- setAll(fields: Record<string, unknown>): void;
652
+ setAll(fields: Record<string, unknown>): Diagnostic[];
628
653
  /**
629
654
  * Revise the main body from markdown; anchors rebase. Returns the
630
655
  * `Revised` receipt, its warnings at `main.body`: a body carries no field
@@ -660,8 +685,8 @@ export declare class DocumentWriter {
660
685
  * body from optional markdown, and place it. `at` omitted appends, a number
661
686
  * inserts at that index. Transactional: a rejected field (throwing a per-field
662
687
  * diagnostic bundle) or an invalid kind, body, or position leaves the document
663
- * untouched. Returns the body import's `parse::dropped_construct` warnings,
664
- * anchored at the placed card's body.
688
+ * untouched. Returns the fields' `parse::dropped_construct` warnings, then
689
+ * the body import's, anchored under the placed card.
665
690
  */
666
691
  addCard(kind: string, fields?: Record<string, unknown>, body?: string, at?: number): Diagnostic[];
667
692
  /** Remove the composable card at `index`, returning it (or `undefined`). */
@@ -691,8 +716,8 @@ export declare class CardWriter {
691
716
  * index.
692
717
  */
693
718
  readonly kind: string;
694
- set(name: string, value: unknown): void;
695
- setAll(fields: Record<string, unknown>): void;
719
+ set(name: string, value: unknown): Diagnostic[];
720
+ setAll(fields: Record<string, unknown>): Diagnostic[];
696
721
  /**
697
722
  * Revise this card's body from markdown (edit semantics), returning the
698
723
  * `Revised` receipt, its warnings at the card's body.
@@ -693,6 +693,13 @@ export class LiveSession {
693
693
  return this.#inner.fieldBoxes(field);
694
694
  }
695
695
 
696
+ /**
697
+ * @returns {import('./runtime.d.ts').FieldCoverage[]}
698
+ */
699
+ coverage() {
700
+ return this.#inner.coverage();
701
+ }
702
+
696
703
  /**
697
704
  * @param {number} page
698
705
  * @param {number} x
@@ -767,14 +774,14 @@ export class DocumentWriter {
767
774
  /**
768
775
  * @param {string} name
769
776
  * @param {unknown} value
770
- * @returns {void}
777
+ * @returns {import('../core/wasm.js').Diagnostic[]}
771
778
  */
772
779
  set(name, value) {
773
780
  return this.#doc._commitField(this.#quill, name, value);
774
781
  }
775
782
  /**
776
783
  * @param {Record<string, unknown>} fields
777
- * @returns {void}
784
+ * @returns {import('../core/wasm.js').Diagnostic[]}
778
785
  */
779
786
  setAll(fields) {
780
787
  return this.#doc._commitFields(this.#quill, MAIN_CARD_ADDR, fields);
@@ -855,14 +862,14 @@ export class CardWriter {
855
862
  /**
856
863
  * @param {string} name
857
864
  * @param {unknown} value
858
- * @returns {void}
865
+ * @returns {import('../core/wasm.js').Diagnostic[]}
859
866
  */
860
867
  set(name, value) {
861
868
  return this.#doc._commitField(this.#quill, { card: this.#index, field: name }, value);
862
869
  }
863
870
  /**
864
871
  * @param {Record<string, unknown>} fields
865
- * @returns {void}
872
+ * @returns {import('../core/wasm.js').Diagnostic[]}
866
873
  */
867
874
  setAll(fields) {
868
875
  return this.#doc._commitFields(this.#quill, { card: this.#index }, fields);