@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
@@ -249,36 +249,180 @@ function takeObject(idx) {
249
249
  return ret;
250
250
  }
251
251
  /**
252
- * Register data with the parser process (PLAN-173 P12).
253
- *
254
- * `data_type`: `"translations"` today. One verb rather than one function per
255
- * registerable thing — the same discriminated-options idiom as `info`.
252
+ * One bit's template (PLAN-225 D8): `format` is `text` (plain bitmark),
253
+ * `snippet` (LSP snippet) or `json` (the slot model with both renderings);
254
+ * `full` lists every tag and every attachable resource chain instead of
255
+ * the normal template; `include_deprecated` keeps deprecated tags. Throws
256
+ * for an unknown bit. ABSENT on a variant built without `template` — the
257
+ * "presence is the capability" signal `diff` uses.
258
+ * @param {string} bit
259
+ * @param {string} format
260
+ * @param {boolean} full
261
+ * @param {boolean} include_deprecated
262
+ * @param {boolean} pretty
263
+ * @param {number} indent
264
+ * @returns {string}
265
+ */
266
+ module.exports.template = function(bit, format, full, include_deprecated, pretty, indent) {
267
+ let deferred4_0;
268
+ let deferred4_1;
269
+ try {
270
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
271
+ const ptr0 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
272
+ const len0 = WASM_VECTOR_LEN;
273
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
274
+ const len1 = WASM_VECTOR_LEN;
275
+ wasm.template(retptr, ptr0, len0, ptr1, len1, full, include_deprecated, pretty, indent);
276
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
277
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
278
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
279
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
280
+ var ptr3 = r0;
281
+ var len3 = r1;
282
+ if (r3) {
283
+ ptr3 = 0; len3 = 0;
284
+ throw takeObject(r2);
285
+ }
286
+ deferred4_0 = ptr3;
287
+ deferred4_1 = len3;
288
+ return getStringFromWasm0(ptr3, len3);
289
+ } finally {
290
+ wasm.__wbindgen_add_to_stack_pointer(16);
291
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
292
+ }
293
+ };
294
+
295
+ /**
296
+ * Pretty-print a compact JSON string with the given indent. Used to format a
297
+ * document recombined on the JS side (the per-bit hook path) so its output
298
+ * matches the in-Rust recombination byte-for-byte.
299
+ * @param {string} json
300
+ * @param {number} indent
301
+ * @returns {string}
302
+ */
303
+ module.exports.prettify = function(json, indent) {
304
+ let deferred2_0;
305
+ let deferred2_1;
306
+ try {
307
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
308
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
309
+ const len0 = WASM_VECTOR_LEN;
310
+ wasm.prettify(retptr, ptr0, len0, indent);
311
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
312
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
313
+ deferred2_0 = r0;
314
+ deferred2_1 = r1;
315
+ return getStringFromWasm0(r0, r1);
316
+ } finally {
317
+ wasm.__wbindgen_add_to_stack_pointer(16);
318
+ wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
319
+ }
320
+ };
321
+
322
+ /**
323
+ * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
256
324
  *
257
- * `data` is the file's own text. Semantics are REPLACE: a second call
258
- * supersedes the first entirely, and the built-in table (where the variant
259
- * bakes one) stays underneath. Throws on bad data — like every other
260
- * fallible export (PLAN-192 D1).
325
+ * `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
326
+ * `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
327
+ * inline marks; anything else is treated as plain text (textToAst only).
328
+ * `location`: `"body"` (default) or `"tag"`.
329
+ * Returns the converted fragment; throws on failure.
330
+ * @param {string} input
331
+ * @param {string} direction
332
+ * @param {string} format
333
+ * @param {string} location
334
+ * @returns {string}
335
+ */
336
+ module.exports.convert_text = function(input, direction, format, location) {
337
+ let deferred6_0;
338
+ let deferred6_1;
339
+ try {
340
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
341
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
342
+ const len0 = WASM_VECTOR_LEN;
343
+ const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
344
+ const len1 = WASM_VECTOR_LEN;
345
+ const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
346
+ const len2 = WASM_VECTOR_LEN;
347
+ const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
348
+ const len3 = WASM_VECTOR_LEN;
349
+ wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
350
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
351
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
352
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
353
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
354
+ var ptr5 = r0;
355
+ var len5 = r1;
356
+ if (r3) {
357
+ ptr5 = 0; len5 = 0;
358
+ throw takeObject(r2);
359
+ }
360
+ deferred6_0 = ptr5;
361
+ deferred6_1 = len5;
362
+ return getStringFromWasm0(ptr5, len5);
363
+ } finally {
364
+ wasm.__wbindgen_add_to_stack_pointer(16);
365
+ wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
366
+ }
367
+ };
368
+
369
+ /**
370
+ * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
261
371
  *
262
- * Available in EVERY variant, including those that bake nothing: that is
263
- * exactly where a consumer must supply the file themselves.
264
- * @param {string} data_type
265
- * @param {string} data
372
+ * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
373
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
374
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
375
+ * the opposite of the resolved input format. The whole-document outputs
376
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
377
+ * pipeline refuses them and that refusal is what throws.
378
+ * `patch_json`: the patch entry array (empty string = no patches, i.e. a
379
+ * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
380
+ * runs sequentially. Returns `{ "data": <document text/JSON>, "diagnostics":
381
+ * [ { "path", "kind", "message" } ] }` — the diagnostics are the entries the
382
+ * pipeline skipped (PLAN-209 T9; `kind` is the error contract's identifier,
383
+ * e.g. `patch-index-out-of-range`); throws on failure.
384
+ * @param {string} input
385
+ * @param {string} input_format_sel
386
+ * @param {string} output_format_sel
387
+ * @param {string} mode
388
+ * @param {string} patch_json
389
+ * @param {boolean} pretty
390
+ * @param {number} indent
391
+ * @param {number} spaces_around_values
392
+ * @returns {string}
266
393
  */
267
- module.exports.register = function(data_type, data) {
394
+ module.exports.transform = function(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
395
+ let deferred7_0;
396
+ let deferred7_1;
268
397
  try {
269
398
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
270
- const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
399
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
271
400
  const len0 = WASM_VECTOR_LEN;
272
- const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
401
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
273
402
  const len1 = WASM_VECTOR_LEN;
274
- wasm.register(retptr, ptr0, len0, ptr1, len1);
403
+ const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
404
+ const len2 = WASM_VECTOR_LEN;
405
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
406
+ const len3 = WASM_VECTOR_LEN;
407
+ const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
408
+ const len4 = WASM_VECTOR_LEN;
409
+ wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);
275
410
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
276
411
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
277
- if (r1) {
278
- throw takeObject(r0);
412
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
413
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
414
+ var ptr6 = r0;
415
+ var len6 = r1;
416
+ if (r3) {
417
+ ptr6 = 0; len6 = 0;
418
+ throw takeObject(r2);
279
419
  }
420
+ deferred7_0 = ptr6;
421
+ deferred7_1 = len6;
422
+ return getStringFromWasm0(ptr6, len6);
280
423
  } finally {
281
424
  wasm.__wbindgen_add_to_stack_pointer(16);
425
+ wasm.__wbindgen_export_2(deferred7_0, deferred7_1, 1);
282
426
  }
283
427
  };
284
428
 
@@ -336,18 +480,20 @@ module.exports.resolve_patch_document = function(input, input_format_sel, patch_
336
480
  * `trigger_character` is the character the editor sent as the trigger (LSP
337
481
  * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
338
482
  * trigger that opens nothing where the cursor is answers the empty list
339
- * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
340
- * "presence is the capability" signal `diff` uses. Throws when the line is
341
- * past the text.
483
+ * (PLAN-203 D1); `bit_template` makes a bit-type item insert the bit's
484
+ * normal template as a snippet (PLAN-225 D9). ABSENT on a variant built
485
+ * without `editor` — the same "presence is the capability" signal `diff`
486
+ * uses. Throws when the line is past the text.
342
487
  * @param {string} input
343
488
  * @param {number} line
344
489
  * @param {number} character
345
490
  * @param {string} position_encoding
346
491
  * @param {boolean} include_deprecated
347
492
  * @param {string} trigger_character
493
+ * @param {boolean} bit_template
348
494
  * @returns {string}
349
495
  */
350
- module.exports.complete = function(input, line, character, position_encoding, include_deprecated, trigger_character) {
496
+ module.exports.complete = function(input, line, character, position_encoding, include_deprecated, trigger_character, bit_template) {
351
497
  let deferred5_0;
352
498
  let deferred5_1;
353
499
  try {
@@ -358,7 +504,7 @@ module.exports.complete = function(input, line, character, position_encoding, in
358
504
  const len1 = WASM_VECTOR_LEN;
359
505
  const ptr2 = passStringToWasm0(trigger_character, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
360
506
  const len2 = WASM_VECTOR_LEN;
361
- wasm.complete(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2);
507
+ wasm.complete(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2, bit_template);
362
508
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
363
509
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
364
510
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -390,11 +536,12 @@ module.exports.complete = function(input, line, character, position_encoding, in
390
536
  * @param {number} character
391
537
  * @param {string} position_encoding
392
538
  * @param {boolean} include_deprecated
539
+ * @param {boolean} bit_template
393
540
  * @param {string} label
394
541
  * @param {number} kind
395
542
  * @returns {string}
396
543
  */
397
- module.exports.resolve = function(input, line, character, position_encoding, include_deprecated, label, kind) {
544
+ module.exports.resolve = function(input, line, character, position_encoding, include_deprecated, bit_template, label, kind) {
398
545
  let deferred5_0;
399
546
  let deferred5_1;
400
547
  try {
@@ -405,7 +552,7 @@ module.exports.resolve = function(input, line, character, position_encoding, inc
405
552
  const len1 = WASM_VECTOR_LEN;
406
553
  const ptr2 = passStringToWasm0(label, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
407
554
  const len2 = WASM_VECTOR_LEN;
408
- wasm.resolve(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2, kind);
555
+ wasm.resolve(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, bit_template, ptr2, len2, kind);
409
556
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
410
557
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
411
558
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -463,6 +610,66 @@ module.exports.hover = function(input, line, character, position_encoding) {
463
610
  }
464
611
  };
465
612
 
613
+ /**
614
+ * Every authorable bit's `normal` and `full` template as one JSON object
615
+ * keyed by bit name (PLAN-225 D8); `include_deprecated` admits deprecated
616
+ * bits and tags.
617
+ * @param {boolean} include_deprecated
618
+ * @param {boolean} pretty
619
+ * @param {number} indent
620
+ * @returns {string}
621
+ */
622
+ module.exports.template_all = function(include_deprecated, pretty, indent) {
623
+ let deferred1_0;
624
+ let deferred1_1;
625
+ try {
626
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
627
+ wasm.template_all(retptr, include_deprecated, pretty, indent);
628
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
629
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
630
+ deferred1_0 = r0;
631
+ deferred1_1 = r1;
632
+ return getStringFromWasm0(r0, r1);
633
+ } finally {
634
+ wasm.__wbindgen_add_to_stack_pointer(16);
635
+ wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
636
+ }
637
+ };
638
+
639
+ /**
640
+ * Register data with the parser process (PLAN-173 P12).
641
+ *
642
+ * `data_type`: `"translations"` today. One verb rather than one function per
643
+ * registerable thing — the same discriminated-options idiom as `info`.
644
+ *
645
+ * `data` is the file's own text. Semantics are REPLACE: a second call
646
+ * supersedes the first entirely, and the built-in table (where the variant
647
+ * bakes one) stays underneath. Throws on bad data — like every other
648
+ * fallible export (PLAN-192 D1).
649
+ *
650
+ * Available in EVERY variant, including those that bake nothing: that is
651
+ * exactly where a consumer must supply the file themselves.
652
+ * @param {string} data_type
653
+ * @param {string} data
654
+ */
655
+ module.exports.register = function(data_type, data) {
656
+ try {
657
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
658
+ const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
659
+ const len0 = WASM_VECTOR_LEN;
660
+ const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
661
+ const len1 = WASM_VECTOR_LEN;
662
+ wasm.register(retptr, ptr0, len0, ptr1, len1);
663
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
664
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
665
+ if (r1) {
666
+ throw takeObject(r0);
667
+ }
668
+ } finally {
669
+ wasm.__wbindgen_add_to_stack_pointer(16);
670
+ }
671
+ };
672
+
466
673
  /**
467
674
  * Re-emit input in its own format in canonical form at `mode`.
468
675
  *
@@ -573,6 +780,29 @@ module.exports.split_bits = function(input, position_encoding) {
573
780
  }
574
781
  };
575
782
 
783
+ /**
784
+ * The version of this wasm (the crate version, kept in lockstep with the npm
785
+ * package). The browser entry checks it against its own before using the
786
+ * module, so a wrapper never drives another release's wasm (PLAN-224 D2).
787
+ * @returns {string}
788
+ */
789
+ module.exports.version = function() {
790
+ let deferred1_0;
791
+ let deferred1_1;
792
+ try {
793
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
794
+ wasm.version(retptr);
795
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
796
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
797
+ deferred1_0 = r0;
798
+ deferred1_1 = r1;
799
+ return getStringFromWasm0(r0, r1);
800
+ } finally {
801
+ wasm.__wbindgen_add_to_stack_pointer(16);
802
+ wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
803
+ }
804
+ };
805
+
576
806
  /**
577
807
  * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
578
808
  * used across the API so a JS caller can resolve `"auto"` consistently.
@@ -621,140 +851,6 @@ module.exports.split_json_bits = function(input) {
621
851
  }
622
852
  };
623
853
 
624
- /**
625
- * Pretty-print a compact JSON string with the given indent. Used to format a
626
- * document recombined on the JS side (the per-bit hook path) so its output
627
- * matches the in-Rust recombination byte-for-byte.
628
- * @param {string} json
629
- * @param {number} indent
630
- * @returns {string}
631
- */
632
- module.exports.prettify = function(json, indent) {
633
- let deferred2_0;
634
- let deferred2_1;
635
- try {
636
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
637
- const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
638
- const len0 = WASM_VECTOR_LEN;
639
- wasm.prettify(retptr, ptr0, len0, indent);
640
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
641
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
642
- deferred2_0 = r0;
643
- deferred2_1 = r1;
644
- return getStringFromWasm0(r0, r1);
645
- } finally {
646
- wasm.__wbindgen_add_to_stack_pointer(16);
647
- wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
648
- }
649
- };
650
-
651
- /**
652
- * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
653
- *
654
- * `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
655
- * `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
656
- * inline marks; anything else is treated as plain text (textToAst only).
657
- * `location`: `"body"` (default) or `"tag"`.
658
- * Returns the converted fragment; throws on failure.
659
- * @param {string} input
660
- * @param {string} direction
661
- * @param {string} format
662
- * @param {string} location
663
- * @returns {string}
664
- */
665
- module.exports.convert_text = function(input, direction, format, location) {
666
- let deferred6_0;
667
- let deferred6_1;
668
- try {
669
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
670
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
671
- const len0 = WASM_VECTOR_LEN;
672
- const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
673
- const len1 = WASM_VECTOR_LEN;
674
- const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
675
- const len2 = WASM_VECTOR_LEN;
676
- const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
677
- const len3 = WASM_VECTOR_LEN;
678
- wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
679
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
680
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
681
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
682
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
683
- var ptr5 = r0;
684
- var len5 = r1;
685
- if (r3) {
686
- ptr5 = 0; len5 = 0;
687
- throw takeObject(r2);
688
- }
689
- deferred6_0 = ptr5;
690
- deferred6_1 = len5;
691
- return getStringFromWasm0(ptr5, len5);
692
- } finally {
693
- wasm.__wbindgen_add_to_stack_pointer(16);
694
- wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
695
- }
696
- };
697
-
698
- /**
699
- * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
700
- *
701
- * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
702
- * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
703
- * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
704
- * the opposite of the resolved input format. The whole-document outputs
705
- * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
706
- * pipeline refuses them and that refusal is what throws.
707
- * `patch_json`: the patch entry array (empty string = no patches, i.e. a
708
- * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
709
- * runs sequentially. Returns `{ "data": <document text/JSON>, "diagnostics":
710
- * [ { "path", "kind", "message" } ] }` — the diagnostics are the entries the
711
- * pipeline skipped (PLAN-209 T9; `kind` is the error contract's identifier,
712
- * e.g. `patch-index-out-of-range`); throws on failure.
713
- * @param {string} input
714
- * @param {string} input_format_sel
715
- * @param {string} output_format_sel
716
- * @param {string} mode
717
- * @param {string} patch_json
718
- * @param {boolean} pretty
719
- * @param {number} indent
720
- * @param {number} spaces_around_values
721
- * @returns {string}
722
- */
723
- module.exports.transform = function(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
724
- let deferred7_0;
725
- let deferred7_1;
726
- try {
727
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
728
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
729
- const len0 = WASM_VECTOR_LEN;
730
- const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
731
- const len1 = WASM_VECTOR_LEN;
732
- const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
733
- const len2 = WASM_VECTOR_LEN;
734
- const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
735
- const len3 = WASM_VECTOR_LEN;
736
- const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
737
- const len4 = WASM_VECTOR_LEN;
738
- wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);
739
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
740
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
741
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
742
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
743
- var ptr6 = r0;
744
- var len6 = r1;
745
- if (r3) {
746
- ptr6 = 0; len6 = 0;
747
- throw takeObject(r2);
748
- }
749
- deferred7_0 = ptr6;
750
- deferred7_1 = len6;
751
- return getStringFromWasm0(ptr6, len6);
752
- } finally {
753
- wasm.__wbindgen_add_to_stack_pointer(16);
754
- wasm.__wbindgen_export_2(deferred7_0, deferred7_1, 1);
755
- }
756
- };
757
-
758
854
  /**
759
855
  * Convert between bitmark and JSON with explicit input/output formats + mode.
760
856
  *
@@ -933,8 +1029,8 @@ class ConvertDetails {
933
1029
  }
934
1030
  }
935
1031
  /**
936
- * The bit spans, flat `[index, start, end, …]`; `undefined` when not
937
- * asked for.
1032
+ * The bit spans, flat `[index, inputStart, inputEnd, outputStart,
1033
+ * outputEnd, …]` (PLAN-223 F5); `undefined` when not asked for.
938
1034
  * @returns {Uint32Array | undefined}
939
1035
  */
940
1036
  bit_spans() {
@@ -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;
@@ -17,12 +17,15 @@ export const info: (a: number, b: number, c: number, d: number, e: number, f: nu
17
17
  export const is_bitmark: (a: number, b: number) => number;
18
18
  export const prettify: (a: number, b: number, c: number, d: number) => void;
19
19
  export const register: (a: number, b: number, c: number, d: number, e: number) => void;
20
- 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;
20
+ 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;
21
21
  export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
22
22
  export const split_bits: (a: number, b: number, c: number, d: number, e: number) => void;
23
23
  export const split_json_bits: (a: number, b: number, c: number) => void;
24
+ export const template: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
25
+ export const template_all: (a: number, b: number, c: number, d: number) => void;
24
26
  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;
25
27
  export const unbreakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
28
+ export const version: (a: number) => void;
26
29
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
27
30
  export const __wbindgen_export_0: (a: number, b: number) => number;
28
31
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
@@ -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",
@@ -45,6 +45,29 @@ export function info(info_type: string, format: string, bit: string, pretty: boo
45
45
  * variant name.
46
46
  */
47
47
  export function info_text_supported(): boolean;
48
+ /**
49
+ * Split a JSON document (a top-level array of bit envelopes) into its per-bit
50
+ * envelope objects, returned as a JSON array string. Lets a JS caller iterate
51
+ * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
52
+ * Throws if the input is not a JSON array of bits.
53
+ */
54
+ export function split_json_bits(input: string): string;
55
+ /**
56
+ * Pretty-print a compact JSON string with the given indent. Used to format a
57
+ * document recombined on the JS side (the per-bit hook path) so its output
58
+ * matches the in-Rust recombination byte-for-byte.
59
+ */
60
+ export function prettify(json: string, indent: number): string;
61
+ /**
62
+ * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
63
+ *
64
+ * `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
65
+ * `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
66
+ * inline marks; anything else is treated as plain text (textToAst only).
67
+ * `location`: `"body"` (default) or `"tag"`.
68
+ * Returns the converted fragment; throws on failure.
69
+ */
70
+ export function convert_text(input: string, direction: string, format: string, location: string): string;
48
71
  /**
49
72
  * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
50
73
  *
@@ -96,11 +119,12 @@ export function diff(a: string, b: string, input_format_sel: string, output_form
96
119
  * `trigger_character` is the character the editor sent as the trigger (LSP
97
120
  * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
98
121
  * trigger that opens nothing where the cursor is answers the empty list
99
- * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
100
- * "presence is the capability" signal `diff` uses. Throws when the line is
101
- * past the text.
122
+ * (PLAN-203 D1); `bit_template` makes a bit-type item insert the bit's
123
+ * normal template as a snippet (PLAN-225 D9). ABSENT on a variant built
124
+ * without `editor` — the same "presence is the capability" signal `diff`
125
+ * uses. Throws when the line is past the text.
102
126
  */
103
- export function complete(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, trigger_character: string): string;
127
+ export function complete(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, trigger_character: string, bit_template: boolean): string;
104
128
  /**
105
129
  * One item of the list `complete` returns at this position, its Markdown
106
130
  * `documentation` filled in — LSP `completionItem/resolve` (PLAN-202):
@@ -109,12 +133,27 @@ export function complete(input: string, line: number, character: number, positio
109
133
  * name the item; the JSON `null` when the list has no such item. Arguments
110
134
  * otherwise as `complete`.
111
135
  */
112
- export function resolve(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, label: string, kind: number): string;
136
+ export function resolve(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, bit_template: boolean, label: string, kind: number): string;
113
137
  /**
114
138
  * The construct at a position, as an LSP `Hover` — or the JSON `null` when
115
139
  * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
116
140
  */
117
141
  export function hover(input: string, line: number, character: number, position_encoding: string): string;
142
+ /**
143
+ * One bit's template (PLAN-225 D8): `format` is `text` (plain bitmark),
144
+ * `snippet` (LSP snippet) or `json` (the slot model with both renderings);
145
+ * `full` lists every tag and every attachable resource chain instead of
146
+ * the normal template; `include_deprecated` keeps deprecated tags. Throws
147
+ * for an unknown bit. ABSENT on a variant built without `template` — the
148
+ * "presence is the capability" signal `diff` uses.
149
+ */
150
+ export function template(bit: string, format: string, full: boolean, include_deprecated: boolean, pretty: boolean, indent: number): string;
151
+ /**
152
+ * Every authorable bit's `normal` and `full` template as one JSON object
153
+ * keyed by bit name (PLAN-225 D8); `include_deprecated` admits deprecated
154
+ * bits and tags.
155
+ */
156
+ export function template_all(include_deprecated: boolean, pretty: boolean, indent: number): string;
118
157
  /**
119
158
  * Register data with the parser process (PLAN-173 P12).
120
159
  *
@@ -152,34 +191,17 @@ export function count_bits(input: string): string;
152
191
  * feed a worker pool).
153
192
  */
154
193
  export function split_bits(input: string, position_encoding: string): string;
194
+ /**
195
+ * The version of this wasm (the crate version, kept in lockstep with the npm
196
+ * package). The browser entry checks it against its own before using the
197
+ * module, so a wrapper never drives another release's wasm (PLAN-224 D2).
198
+ */
199
+ export function version(): string;
155
200
  /**
156
201
  * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
157
202
  * used across the API so a JS caller can resolve `"auto"` consistently.
158
203
  */
159
204
  export function is_bitmark(input: string): boolean;
160
- /**
161
- * Split a JSON document (a top-level array of bit envelopes) into its per-bit
162
- * envelope objects, returned as a JSON array string. Lets a JS caller iterate
163
- * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
164
- * Throws if the input is not a JSON array of bits.
165
- */
166
- export function split_json_bits(input: string): string;
167
- /**
168
- * Pretty-print a compact JSON string with the given indent. Used to format a
169
- * document recombined on the JS side (the per-bit hook path) so its output
170
- * matches the in-Rust recombination byte-for-byte.
171
- */
172
- export function prettify(json: string, indent: number): string;
173
- /**
174
- * Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
175
- *
176
- * `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
177
- * `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
178
- * inline marks; anything else is treated as plain text (textToAst only).
179
- * `location`: `"body"` (default) or `"tag"`.
180
- * Returns the converted fragment; throws on failure.
181
- */
182
- export function convert_text(input: string, direction: string, format: string, location: string): string;
183
205
  /**
184
206
  * Convert between bitmark and JSON with explicit input/output formats + mode.
185
207
  *
@@ -219,8 +241,8 @@ export class ConvertDetails {
219
241
  */
220
242
  bit_spans_encoding(): string | undefined;
221
243
  /**
222
- * The bit spans, flat `[index, start, end, …]`; `undefined` when not
223
- * asked for.
244
+ * The bit spans, flat `[index, inputStart, inputEnd, outputStart,
245
+ * outputEnd, …]` (PLAN-223 F5); `undefined` when not asked for.
224
246
  */
225
247
  bit_spans(): Uint32Array | undefined;
226
248
  /**