@gmb/bitmark-parser 7.7.0 → 7.9.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.
Files changed (45) hide show
  1. package/README.md +99 -21
  2. package/config/bitmark.json +532 -209
  3. package/dist/browser/bitmark-parser.min.js +6 -6
  4. package/dist/browser/bitmark-parser.min.js.map +1 -1
  5. package/dist/browser/cjs/index.cjs +533 -275
  6. package/dist/browser/cjs/index.cjs.map +1 -1
  7. package/dist/browser/cjs/index.d.cts +103 -22
  8. package/dist/browser/esm/index.d.ts +103 -22
  9. package/dist/browser/esm/index.js +532 -275
  10. package/dist/browser/esm/index.js.map +1 -1
  11. package/dist/browser/esm/worker-entry.js +494 -264
  12. package/dist/browser/esm/worker-entry.js.map +1 -1
  13. package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
  14. package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
  15. package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
  16. package/dist/index.cjs +43 -8
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +92 -20
  19. package/dist/index.d.ts +92 -20
  20. package/dist/index.js +42 -8
  21. package/dist/index.js.map +1 -1
  22. package/dist/legacy.cjs +19 -11
  23. package/dist/legacy.cjs.map +1 -1
  24. package/dist/legacy.d.cts +3 -1
  25. package/dist/legacy.d.ts +3 -1
  26. package/dist/legacy.js +19 -11
  27. package/dist/legacy.js.map +1 -1
  28. package/dist/worker-entry.cjs.map +1 -1
  29. package/package.json +7 -7
  30. package/schema/bitmark.schema.json +1 -1
  31. package/wasm/bitmark_wasm.d.ts +52 -30
  32. package/wasm/bitmark_wasm.js +209 -113
  33. package/wasm/bitmark_wasm_bg.wasm +0 -0
  34. package/wasm/bitmark_wasm_bg.wasm.d.ts +5 -2
  35. package/wasm/package.json +1 -1
  36. package/wasm-bitmark-json/bitmark_json_wasm.d.ts +73 -51
  37. package/wasm-bitmark-json/bitmark_json_wasm.js +257 -161
  38. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
  39. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +5 -2
  40. package/wasm-bitmark-json/package.json +1 -1
  41. package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +52 -30
  42. package/wasm-browser-full/bitmark_browser_full_wasm.js +209 -113
  43. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
  44. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +5 -2
  45. package/wasm-browser-full/package.json +1 -1
@@ -260,6 +260,115 @@ function takeObject(idx) {
260
260
  dropObject(idx);
261
261
  return ret;
262
262
  }
263
+ /**
264
+ * Split a JSON document (a top-level array of bit envelopes) into its per-bit
265
+ * envelope objects, returned as a JSON array string. Lets a JS caller iterate
266
+ * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
267
+ * Throws if the input is not a JSON array of bits.
268
+ * @param {string} input
269
+ * @returns {string}
270
+ */
271
+ module.exports.split_json_bits = function(input) {
272
+ let deferred3_0;
273
+ let deferred3_1;
274
+ try {
275
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
276
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
277
+ const len0 = WASM_VECTOR_LEN;
278
+ wasm.split_json_bits(retptr, ptr0, len0);
279
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
280
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
281
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
282
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
283
+ var ptr2 = r0;
284
+ var len2 = r1;
285
+ if (r3) {
286
+ ptr2 = 0; len2 = 0;
287
+ throw takeObject(r2);
288
+ }
289
+ deferred3_0 = ptr2;
290
+ deferred3_1 = len2;
291
+ return getStringFromWasm0(ptr2, len2);
292
+ } finally {
293
+ wasm.__wbindgen_add_to_stack_pointer(16);
294
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
295
+ }
296
+ };
297
+
298
+ /**
299
+ * Pretty-print a compact JSON string with the given indent. Used to format a
300
+ * document recombined on the JS side (the per-bit hook path) so its output
301
+ * matches the in-Rust recombination byte-for-byte.
302
+ * @param {string} json
303
+ * @param {number} indent
304
+ * @returns {string}
305
+ */
306
+ module.exports.prettify = function(json, indent) {
307
+ let deferred2_0;
308
+ let deferred2_1;
309
+ try {
310
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
311
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
312
+ const len0 = WASM_VECTOR_LEN;
313
+ wasm.prettify(retptr, ptr0, len0, indent);
314
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
315
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
316
+ deferred2_0 = r0;
317
+ deferred2_1 = r1;
318
+ return getStringFromWasm0(r0, r1);
319
+ } finally {
320
+ wasm.__wbindgen_add_to_stack_pointer(16);
321
+ wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
322
+ }
323
+ };
324
+
325
+ /**
326
+ * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
327
+ *
328
+ * `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
329
+ * `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
330
+ * inline marks; anything else is treated as plain text (textToAst only).
331
+ * `location`: `"body"` (default) or `"tag"`.
332
+ * Returns the converted fragment; throws on failure.
333
+ * @param {string} input
334
+ * @param {string} direction
335
+ * @param {string} format
336
+ * @param {string} location
337
+ * @returns {string}
338
+ */
339
+ module.exports.convert_text = function(input, direction, format, location) {
340
+ let deferred6_0;
341
+ let deferred6_1;
342
+ try {
343
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
344
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
345
+ const len0 = WASM_VECTOR_LEN;
346
+ const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
347
+ const len1 = WASM_VECTOR_LEN;
348
+ const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
349
+ const len2 = WASM_VECTOR_LEN;
350
+ const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
351
+ const len3 = WASM_VECTOR_LEN;
352
+ wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
353
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
354
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
355
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
356
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
357
+ var ptr5 = r0;
358
+ var len5 = r1;
359
+ if (r3) {
360
+ ptr5 = 0; len5 = 0;
361
+ throw takeObject(r2);
362
+ }
363
+ deferred6_0 = ptr5;
364
+ deferred6_1 = len5;
365
+ return getStringFromWasm0(ptr5, len5);
366
+ } finally {
367
+ wasm.__wbindgen_add_to_stack_pointer(16);
368
+ wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
369
+ }
370
+ };
371
+
263
372
  /**
264
373
  * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
265
374
  *
@@ -430,18 +539,20 @@ module.exports.diff = function(a, b, input_format_sel, output_format_sel, contex
430
539
  * `trigger_character` is the character the editor sent as the trigger (LSP
431
540
  * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
432
541
  * trigger that opens nothing where the cursor is answers the empty list
433
- * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
434
- * "presence is the capability" signal `diff` uses. Throws when the line is
435
- * past the text.
542
+ * (PLAN-203 D1); `bit_template` makes a bit-type item insert the bit's
543
+ * normal template as a snippet (PLAN-225 D9). ABSENT on a variant built
544
+ * without `editor` — the same "presence is the capability" signal `diff`
545
+ * uses. Throws when the line is past the text.
436
546
  * @param {string} input
437
547
  * @param {number} line
438
548
  * @param {number} character
439
549
  * @param {string} position_encoding
440
550
  * @param {boolean} include_deprecated
441
551
  * @param {string} trigger_character
552
+ * @param {boolean} bit_template
442
553
  * @returns {string}
443
554
  */
444
- module.exports.complete = function(input, line, character, position_encoding, include_deprecated, trigger_character) {
555
+ module.exports.complete = function(input, line, character, position_encoding, include_deprecated, trigger_character, bit_template) {
445
556
  let deferred5_0;
446
557
  let deferred5_1;
447
558
  try {
@@ -452,7 +563,7 @@ module.exports.complete = function(input, line, character, position_encoding, in
452
563
  const len1 = WASM_VECTOR_LEN;
453
564
  const ptr2 = passStringToWasm0(trigger_character, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
454
565
  const len2 = WASM_VECTOR_LEN;
455
- wasm.complete(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2);
566
+ wasm.complete(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2, bit_template);
456
567
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
457
568
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
458
569
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -484,11 +595,12 @@ module.exports.complete = function(input, line, character, position_encoding, in
484
595
  * @param {number} character
485
596
  * @param {string} position_encoding
486
597
  * @param {boolean} include_deprecated
598
+ * @param {boolean} bit_template
487
599
  * @param {string} label
488
600
  * @param {number} kind
489
601
  * @returns {string}
490
602
  */
491
- module.exports.resolve = function(input, line, character, position_encoding, include_deprecated, label, kind) {
603
+ module.exports.resolve = function(input, line, character, position_encoding, include_deprecated, bit_template, label, kind) {
492
604
  let deferred5_0;
493
605
  let deferred5_1;
494
606
  try {
@@ -499,7 +611,7 @@ module.exports.resolve = function(input, line, character, position_encoding, inc
499
611
  const len1 = WASM_VECTOR_LEN;
500
612
  const ptr2 = passStringToWasm0(label, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
501
613
  const len2 = WASM_VECTOR_LEN;
502
- wasm.resolve(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2, kind);
614
+ wasm.resolve(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, bit_template, ptr2, len2, kind);
503
615
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
504
616
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
505
617
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -557,6 +669,76 @@ module.exports.hover = function(input, line, character, position_encoding) {
557
669
  }
558
670
  };
559
671
 
672
+ /**
673
+ * One bit's template (PLAN-225 D8): `format` is `text` (plain bitmark),
674
+ * `snippet` (LSP snippet) or `json` (the slot model with both renderings);
675
+ * `full` lists every tag and every attachable resource chain instead of
676
+ * the normal template; `include_deprecated` keeps deprecated tags. Throws
677
+ * for an unknown bit. ABSENT on a variant built without `template` — the
678
+ * "presence is the capability" signal `diff` uses.
679
+ * @param {string} bit
680
+ * @param {string} format
681
+ * @param {boolean} full
682
+ * @param {boolean} include_deprecated
683
+ * @param {boolean} pretty
684
+ * @param {number} indent
685
+ * @returns {string}
686
+ */
687
+ module.exports.template = function(bit, format, full, include_deprecated, pretty, indent) {
688
+ let deferred4_0;
689
+ let deferred4_1;
690
+ try {
691
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
692
+ const ptr0 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
693
+ const len0 = WASM_VECTOR_LEN;
694
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
695
+ const len1 = WASM_VECTOR_LEN;
696
+ wasm.template(retptr, ptr0, len0, ptr1, len1, full, include_deprecated, pretty, indent);
697
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
698
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
699
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
700
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
701
+ var ptr3 = r0;
702
+ var len3 = r1;
703
+ if (r3) {
704
+ ptr3 = 0; len3 = 0;
705
+ throw takeObject(r2);
706
+ }
707
+ deferred4_0 = ptr3;
708
+ deferred4_1 = len3;
709
+ return getStringFromWasm0(ptr3, len3);
710
+ } finally {
711
+ wasm.__wbindgen_add_to_stack_pointer(16);
712
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
713
+ }
714
+ };
715
+
716
+ /**
717
+ * Every authorable bit's `normal` and `full` template as one JSON object
718
+ * keyed by bit name (PLAN-225 D8); `include_deprecated` admits deprecated
719
+ * bits and tags.
720
+ * @param {boolean} include_deprecated
721
+ * @param {boolean} pretty
722
+ * @param {number} indent
723
+ * @returns {string}
724
+ */
725
+ module.exports.template_all = function(include_deprecated, pretty, indent) {
726
+ let deferred1_0;
727
+ let deferred1_1;
728
+ try {
729
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
730
+ wasm.template_all(retptr, include_deprecated, pretty, indent);
731
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
732
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
733
+ deferred1_0 = r0;
734
+ deferred1_1 = r1;
735
+ return getStringFromWasm0(r0, r1);
736
+ } finally {
737
+ wasm.__wbindgen_add_to_stack_pointer(16);
738
+ wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
739
+ }
740
+ };
741
+
560
742
  /**
561
743
  * Register data with the parser process (PLAN-173 P12).
562
744
  *
@@ -702,125 +884,39 @@ module.exports.split_bits = function(input, position_encoding) {
702
884
  };
703
885
 
704
886
  /**
705
- * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
706
- * used across the API so a JS caller can resolve `"auto"` consistently.
707
- * @param {string} input
708
- * @returns {boolean}
709
- */
710
- module.exports.is_bitmark = function(input) {
711
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
712
- const len0 = WASM_VECTOR_LEN;
713
- const ret = wasm.is_bitmark(ptr0, len0);
714
- return ret !== 0;
715
- };
716
-
717
- /**
718
- * Split a JSON document (a top-level array of bit envelopes) into its per-bit
719
- * envelope objects, returned as a JSON array string. Lets a JS caller iterate
720
- * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
721
- * Throws if the input is not a JSON array of bits.
722
- * @param {string} input
723
- * @returns {string}
724
- */
725
- module.exports.split_json_bits = function(input) {
726
- let deferred3_0;
727
- let deferred3_1;
728
- try {
729
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
730
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
731
- const len0 = WASM_VECTOR_LEN;
732
- wasm.split_json_bits(retptr, ptr0, len0);
733
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
734
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
735
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
736
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
737
- var ptr2 = r0;
738
- var len2 = r1;
739
- if (r3) {
740
- ptr2 = 0; len2 = 0;
741
- throw takeObject(r2);
742
- }
743
- deferred3_0 = ptr2;
744
- deferred3_1 = len2;
745
- return getStringFromWasm0(ptr2, len2);
746
- } finally {
747
- wasm.__wbindgen_add_to_stack_pointer(16);
748
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
749
- }
750
- };
751
-
752
- /**
753
- * Pretty-print a compact JSON string with the given indent. Used to format a
754
- * document recombined on the JS side (the per-bit hook path) so its output
755
- * matches the in-Rust recombination byte-for-byte.
756
- * @param {string} json
757
- * @param {number} indent
887
+ * The version of this wasm (the crate version, kept in lockstep with the npm
888
+ * package). The browser entry checks it against its own before using the
889
+ * module, so a wrapper never drives another release's wasm (PLAN-224 D2).
758
890
  * @returns {string}
759
891
  */
760
- module.exports.prettify = function(json, indent) {
761
- let deferred2_0;
762
- let deferred2_1;
892
+ module.exports.version = function() {
893
+ let deferred1_0;
894
+ let deferred1_1;
763
895
  try {
764
896
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
765
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
766
- const len0 = WASM_VECTOR_LEN;
767
- wasm.prettify(retptr, ptr0, len0, indent);
897
+ wasm.version(retptr);
768
898
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
769
899
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
770
- deferred2_0 = r0;
771
- deferred2_1 = r1;
900
+ deferred1_0 = r0;
901
+ deferred1_1 = r1;
772
902
  return getStringFromWasm0(r0, r1);
773
903
  } finally {
774
904
  wasm.__wbindgen_add_to_stack_pointer(16);
775
- wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
905
+ wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
776
906
  }
777
907
  };
778
908
 
779
909
  /**
780
- * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
781
- *
782
- * `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
783
- * `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
784
- * inline marks; anything else is treated as plain text (textToAst only).
785
- * `location`: `"body"` (default) or `"tag"`.
786
- * Returns the converted fragment; throws on failure.
910
+ * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
911
+ * used across the API so a JS caller can resolve `"auto"` consistently.
787
912
  * @param {string} input
788
- * @param {string} direction
789
- * @param {string} format
790
- * @param {string} location
791
- * @returns {string}
913
+ * @returns {boolean}
792
914
  */
793
- module.exports.convert_text = function(input, direction, format, location) {
794
- let deferred6_0;
795
- let deferred6_1;
796
- try {
797
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
798
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
799
- const len0 = WASM_VECTOR_LEN;
800
- const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
801
- const len1 = WASM_VECTOR_LEN;
802
- const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
803
- const len2 = WASM_VECTOR_LEN;
804
- const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
805
- const len3 = WASM_VECTOR_LEN;
806
- wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
807
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
808
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
809
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
810
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
811
- var ptr5 = r0;
812
- var len5 = r1;
813
- if (r3) {
814
- ptr5 = 0; len5 = 0;
815
- throw takeObject(r2);
816
- }
817
- deferred6_0 = ptr5;
818
- deferred6_1 = len5;
819
- return getStringFromWasm0(ptr5, len5);
820
- } finally {
821
- wasm.__wbindgen_add_to_stack_pointer(16);
822
- wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
823
- }
915
+ module.exports.is_bitmark = function(input) {
916
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
917
+ const len0 = WASM_VECTOR_LEN;
918
+ const ret = wasm.is_bitmark(ptr0, len0);
919
+ return ret !== 0;
824
920
  };
825
921
 
826
922
  /**
@@ -1001,8 +1097,8 @@ class ConvertDetails {
1001
1097
  }
1002
1098
  }
1003
1099
  /**
1004
- * The bit spans, flat `[index, start, end, …]`; `undefined` when not
1005
- * asked for.
1100
+ * The bit spans, flat `[index, inputStart, inputEnd, outputStart,
1101
+ * outputEnd, …]` (PLAN-223 F5); `undefined` when not asked for.
1006
1102
  * @returns {Uint32Array | undefined}
1007
1103
  */
1008
1104
  bit_spans() {
Binary file
@@ -4,7 +4,7 @@ export const memory: WebAssembly.Memory;
4
4
  export const __wbg_convertdetails_free: (a: number, b: number) => void;
5
5
  export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
6
6
  export const canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
7
- export const complete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
7
+ export const complete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
8
8
  export const convert: (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) => void;
9
9
  export const convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
10
10
  export const convert_with_details: (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) => void;
@@ -19,12 +19,15 @@ export const info_text_supported: () => number;
19
19
  export const is_bitmark: (a: number, b: number) => number;
20
20
  export const prettify: (a: number, b: number, c: number, d: number) => void;
21
21
  export const register: (a: number, b: number, c: number, d: number, e: number) => void;
22
- export const resolve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
22
+ export const resolve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
23
23
  export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
24
24
  export const split_bits: (a: number, b: number, c: number, d: number, e: number) => void;
25
25
  export const split_json_bits: (a: number, b: number, c: number) => void;
26
+ export const template: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
27
+ export const template_all: (a: number, b: number, c: number, d: number) => void;
26
28
  export const transform: (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) => void;
27
29
  export const unbreakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
30
+ export const version: (a: number) => void;
28
31
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
29
32
  export const __wbindgen_export_0: (a: number, b: number) => number;
30
33
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
package/wasm/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Get More Brain Ltd <info@getmorebrain.com>"
5
5
  ],
6
6
  "description": "WebAssembly bindings for the bitmark parser",
7
- "version": "7.7.0",
7
+ "version": "7.9.0",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",
@@ -39,20 +39,47 @@ export function unbreakscape_text(input: string, format: string, location: strin
39
39
  */
40
40
  export function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number, include_deprecated: boolean, only_deprecated: boolean, full: boolean, language: string): string;
41
41
  /**
42
- * Register data with the parser process (PLAN-173 P12).
43
- *
44
- * `data_type`: `"translations"` today. One verb rather than one function per
45
- * registerable thing — the same discriminated-options idiom as `info`.
42
+ * One bit's template (PLAN-225 D8): `format` is `text` (plain bitmark),
43
+ * `snippet` (LSP snippet) or `json` (the slot model with both renderings);
44
+ * `full` lists every tag and every attachable resource chain instead of
45
+ * the normal template; `include_deprecated` keeps deprecated tags. Throws
46
+ * for an unknown bit. ABSENT on a variant built without `template` — the
47
+ * "presence is the capability" signal `diff` uses.
48
+ */
49
+ export function template(bit: string, format: string, full: boolean, include_deprecated: boolean, pretty: boolean, indent: number): string;
50
+ /**
51
+ * Pretty-print a compact JSON string with the given indent. Used to format a
52
+ * document recombined on the JS side (the per-bit hook path) so its output
53
+ * matches the in-Rust recombination byte-for-byte.
54
+ */
55
+ export function prettify(json: string, indent: number): string;
56
+ /**
57
+ * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
46
58
  *
47
- * `data` is the file's own text. Semantics are REPLACE: a second call
48
- * supersedes the first entirely, and the built-in table (where the variant
49
- * bakes one) stays underneath. Throws on bad data — like every other
50
- * fallible export (PLAN-192 D1).
59
+ * `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
60
+ * `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
61
+ * inline marks; anything else is treated as plain text (textToAst only).
62
+ * `location`: `"body"` (default) or `"tag"`.
63
+ * Returns the converted fragment; throws on failure.
64
+ */
65
+ export function convert_text(input: string, direction: string, format: string, location: string): string;
66
+ /**
67
+ * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
51
68
  *
52
- * Available in EVERY variant, including those that bake nothing: that is
53
- * exactly where a consumer must supply the file themselves.
69
+ * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
70
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
71
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
72
+ * the opposite of the resolved input format. The whole-document outputs
73
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
74
+ * pipeline refuses them and that refusal is what throws.
75
+ * `patch_json`: the patch entry array (empty string = no patches, i.e. a
76
+ * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
77
+ * runs sequentially. Returns `{ "data": <document text/JSON>, "diagnostics":
78
+ * [ { "path", "kind", "message" } ] }` — the diagnostics are the entries the
79
+ * pipeline skipped (PLAN-209 T9; `kind` is the error contract's identifier,
80
+ * e.g. `patch-index-out-of-range`); throws on failure.
54
81
  */
55
- export function register(data_type: string, data: string): void;
82
+ export function transform(input: string, input_format_sel: string, output_format_sel: string, mode: string, patch_json: string, pretty: boolean, indent: number, spaces_around_values: number): string;
56
83
  /**
57
84
  * Resolve a patch document against `input` (bitmark or JSON) into the
58
85
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
@@ -73,11 +100,12 @@ export function resolve_patch_document(input: string, input_format_sel: string,
73
100
  * `trigger_character` is the character the editor sent as the trigger (LSP
74
101
  * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
75
102
  * trigger that opens nothing where the cursor is answers the empty list
76
- * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
77
- * "presence is the capability" signal `diff` uses. Throws when the line is
78
- * past the text.
103
+ * (PLAN-203 D1); `bit_template` makes a bit-type item insert the bit's
104
+ * normal template as a snippet (PLAN-225 D9). ABSENT on a variant built
105
+ * without `editor` — the same "presence is the capability" signal `diff`
106
+ * uses. Throws when the line is past the text.
79
107
  */
80
- export function complete(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, trigger_character: string): string;
108
+ export function complete(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, trigger_character: string, bit_template: boolean): string;
81
109
  /**
82
110
  * One item of the list `complete` returns at this position, its Markdown
83
111
  * `documentation` filled in — LSP `completionItem/resolve` (PLAN-202):
@@ -86,12 +114,33 @@ export function complete(input: string, line: number, character: number, positio
86
114
  * name the item; the JSON `null` when the list has no such item. Arguments
87
115
  * otherwise as `complete`.
88
116
  */
89
- export function resolve(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, label: string, kind: number): string;
117
+ export function resolve(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, bit_template: boolean, label: string, kind: number): string;
90
118
  /**
91
119
  * The construct at a position, as an LSP `Hover` — or the JSON `null` when
92
120
  * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
93
121
  */
94
122
  export function hover(input: string, line: number, character: number, position_encoding: string): string;
123
+ /**
124
+ * Every authorable bit's `normal` and `full` template as one JSON object
125
+ * keyed by bit name (PLAN-225 D8); `include_deprecated` admits deprecated
126
+ * bits and tags.
127
+ */
128
+ export function template_all(include_deprecated: boolean, pretty: boolean, indent: number): string;
129
+ /**
130
+ * Register data with the parser process (PLAN-173 P12).
131
+ *
132
+ * `data_type`: `"translations"` today. One verb rather than one function per
133
+ * registerable thing — the same discriminated-options idiom as `info`.
134
+ *
135
+ * `data` is the file's own text. Semantics are REPLACE: a second call
136
+ * supersedes the first entirely, and the built-in table (where the variant
137
+ * bakes one) stays underneath. Throws on bad data — like every other
138
+ * fallible export (PLAN-192 D1).
139
+ *
140
+ * Available in EVERY variant, including those that bake nothing: that is
141
+ * exactly where a consumer must supply the file themselves.
142
+ */
143
+ export function register(data_type: string, data: string): void;
95
144
  /**
96
145
  * Re-emit input in its own format in canonical form at `mode`.
97
146
  *
@@ -114,6 +163,12 @@ export function count_bits(input: string): string;
114
163
  * feed a worker pool).
115
164
  */
116
165
  export function split_bits(input: string, position_encoding: string): string;
166
+ /**
167
+ * The version of this wasm (the crate version, kept in lockstep with the npm
168
+ * package). The browser entry checks it against its own before using the
169
+ * module, so a wrapper never drives another release's wasm (PLAN-224 D2).
170
+ */
171
+ export function version(): string;
117
172
  /**
118
173
  * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
119
174
  * used across the API so a JS caller can resolve `"auto"` consistently.
@@ -126,39 +181,6 @@ export function is_bitmark(input: string): boolean;
126
181
  * Throws if the input is not a JSON array of bits.
127
182
  */
128
183
  export function split_json_bits(input: string): string;
129
- /**
130
- * Pretty-print a compact JSON string with the given indent. Used to format a
131
- * document recombined on the JS side (the per-bit hook path) so its output
132
- * matches the in-Rust recombination byte-for-byte.
133
- */
134
- export function prettify(json: string, indent: number): string;
135
- /**
136
- * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
137
- *
138
- * `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
139
- * `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
140
- * inline marks; anything else is treated as plain text (textToAst only).
141
- * `location`: `"body"` (default) or `"tag"`.
142
- * Returns the converted fragment; throws on failure.
143
- */
144
- export function convert_text(input: string, direction: string, format: string, location: string): string;
145
- /**
146
- * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
147
- *
148
- * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
149
- * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
150
- * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
151
- * the opposite of the resolved input format. The whole-document outputs
152
- * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
153
- * pipeline refuses them and that refusal is what throws.
154
- * `patch_json`: the patch entry array (empty string = no patches, i.e. a
155
- * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
156
- * runs sequentially. Returns `{ "data": <document text/JSON>, "diagnostics":
157
- * [ { "path", "kind", "message" } ] }` — the diagnostics are the entries the
158
- * pipeline skipped (PLAN-209 T9; `kind` is the error contract's identifier,
159
- * e.g. `patch-index-out-of-range`); throws on failure.
160
- */
161
- export function transform(input: string, input_format_sel: string, output_format_sel: string, mode: string, patch_json: string, pretty: boolean, indent: number, spaces_around_values: number): string;
162
184
  /**
163
185
  * Convert between bitmark and JSON with explicit input/output formats + mode.
164
186
  *
@@ -198,8 +220,8 @@ export class ConvertDetails {
198
220
  */
199
221
  bit_spans_encoding(): string | undefined;
200
222
  /**
201
- * The bit spans, flat `[index, start, end, …]`; `undefined` when not
202
- * asked for.
223
+ * The bit spans, flat `[index, inputStart, inputEnd, outputStart,
224
+ * outputEnd, …]` (PLAN-223 F5); `undefined` when not asked for.
203
225
  */
204
226
  bit_spans(): Uint32Array | undefined;
205
227
  /**