@gmb/bitmark-parser 7.0.0 → 7.2.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 (42) hide show
  1. package/README.md +147 -11
  2. package/dist/browser/bitmark-parser.min.js +4 -4
  3. package/dist/browser/bitmark-parser.min.js.map +1 -1
  4. package/dist/browser/cjs/index.cjs +439 -67
  5. package/dist/browser/cjs/index.cjs.map +1 -1
  6. package/dist/browser/cjs/index.d.cts +320 -17
  7. package/dist/browser/esm/index.d.ts +320 -17
  8. package/dist/browser/esm/index.js +432 -67
  9. package/dist/browser/esm/index.js.map +1 -1
  10. package/dist/browser/esm/worker-entry.js +317 -29
  11. package/dist/browser/esm/worker-entry.js.map +1 -1
  12. package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
  13. package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
  14. package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
  15. package/dist/index.cjs +114 -38
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +315 -17
  18. package/dist/index.d.ts +315 -17
  19. package/dist/index.js +107 -38
  20. package/dist/index.js.map +1 -1
  21. package/dist/legacy.cjs +1 -1
  22. package/dist/legacy.cjs.map +1 -1
  23. package/dist/legacy.js +1 -1
  24. package/dist/legacy.js.map +1 -1
  25. package/dist/worker-entry.cjs.map +1 -1
  26. package/package.json +7 -7
  27. package/schema/bitmark.schema.json +30 -6
  28. package/wasm/bitmark_wasm.d.ts +43 -8
  29. package/wasm/bitmark_wasm.js +165 -19
  30. package/wasm/bitmark_wasm_bg.wasm +0 -0
  31. package/wasm/bitmark_wasm_bg.wasm.d.ts +4 -1
  32. package/wasm/package.json +1 -1
  33. package/wasm-bitmark-json/bitmark_json_wasm.d.ts +43 -8
  34. package/wasm-bitmark-json/bitmark_json_wasm.js +156 -10
  35. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
  36. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +4 -1
  37. package/wasm-bitmark-json/package.json +1 -1
  38. package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +43 -8
  39. package/wasm-browser-full/bitmark_browser_full_wasm.js +165 -19
  40. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
  41. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +4 -1
  42. package/wasm-browser-full/package.json +1 -1
@@ -46511,6 +46511,15 @@
46511
46511
  {
46512
46512
  "type": "object"
46513
46513
  },
46514
+ {
46515
+ "type": "array"
46516
+ },
46517
+ {
46518
+ "type": "number"
46519
+ },
46520
+ {
46521
+ "type": "boolean"
46522
+ },
46514
46523
  {
46515
46524
  "type": "null"
46516
46525
  }
@@ -47989,10 +47998,10 @@
47989
47998
  "example": {
47990
47999
  "anyOf": [
47991
48000
  {
47992
- "$ref": "#/$defs/bitmarkPlus"
48001
+ "type": "boolean"
47993
48002
  },
47994
48003
  {
47995
- "type": "boolean"
48004
+ "$ref": "#/$defs/bitmarkPlus"
47996
48005
  }
47997
48006
  ]
47998
48007
  },
@@ -50842,7 +50851,10 @@
50842
50851
  "isTemplateStripTheme": {
50843
50852
  "type": "boolean"
50844
50853
  },
50845
- "item": {
50854
+ "marginNumber": {
50855
+ "$ref": "#/$defs/bitmarkPlus"
50856
+ },
50857
+ "pageNumber": {
50846
50858
  "$ref": "#/$defs/bitmarkPlus"
50847
50859
  }
50848
50860
  },
@@ -51908,7 +51920,10 @@
51908
51920
  "isTemplateStripTheme": {
51909
51921
  "type": "boolean"
51910
51922
  },
51911
- "item": {
51923
+ "marginNumber": {
51924
+ "$ref": "#/$defs/bitmarkPlus"
51925
+ },
51926
+ "pageNumber": {
51912
51927
  "$ref": "#/$defs/bitmarkPlus"
51913
51928
  }
51914
51929
  },
@@ -53335,7 +53350,10 @@
53335
53350
  "isTemplateStripTheme": {
53336
53351
  "type": "boolean"
53337
53352
  },
53338
- "item": {
53353
+ "marginNumber": {
53354
+ "$ref": "#/$defs/bitmarkPlus"
53355
+ },
53356
+ "pageNumber": {
53339
53357
  "$ref": "#/$defs/bitmarkPlus"
53340
53358
  }
53341
53359
  },
@@ -53390,6 +53408,12 @@
53390
53408
  },
53391
53409
  "listItemIndent": {
53392
53410
  "type": "number"
53411
+ },
53412
+ "marginNumber": {
53413
+ "$ref": "#/$defs/bitmarkPlus"
53414
+ },
53415
+ "pageNumber": {
53416
+ "$ref": "#/$defs/bitmarkPlus"
53393
53417
  }
53394
53418
  },
53395
53419
  "type": "object"
@@ -60036,7 +60060,7 @@
60036
60060
  ]
60037
60061
  }
60038
60062
  },
60039
- "$id": "https://schema.getmorebrain.com/bitmark/7.0.0.schema.json",
60063
+ "$id": "https://schema.getmorebrain.com/bitmark/7.2.0.schema.json",
60040
60064
  "$schema": "https://json-schema.org/draft/2020-12/schema",
60041
60065
  "description": "Generated from bitmark.json by bitmark-schemagen (PLAN-117). Do not edit by hand.",
60042
60066
  "items": {
@@ -53,7 +53,11 @@ export function convert_text(input: string, direction: string, format: string, l
53
53
  * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
54
54
  *
55
55
  * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
56
- * `output_format_sel`: `"bitmark"` | `"json"` (default json).
56
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
57
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
58
+ * the opposite of the resolved input format. The whole-document outputs
59
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
60
+ * pipeline refuses them and that refusal is what throws.
57
61
  * `patch_json`: the patch entry array (empty string = no patches, i.e. a
58
62
  * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
59
63
  * runs sequentially. Returns the document text/JSON; throws on failure.
@@ -63,11 +67,14 @@ export function transform(input: string, input_format_sel: string, output_format
63
67
  * Resolve a patch document against `input` (bitmark or JSON) into the
64
68
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
65
69
  * reorder, drop and insert jobs from the one Rust implementation
66
- * (PLAN-179). Returns a JSON array of
70
+ * (PLAN-179). `input_format_sel` is the caller's input-format selector
71
+ * (`"auto"` | `"bitmark"` | `"json"`): the document is split under the SAME
72
+ * selection the planner already resolved, never re-sniffed (PLAN-187 D1).
73
+ * Returns a JSON array of
67
74
  * `{ "source": <original index> | null, "bit": <inner bit> | null,
68
75
  * "patch": [ … ] }`; throws on failure.
69
76
  */
70
- export function resolve_patch_document(input: string, patch_json: string): string;
77
+ export function resolve_patch_document(input: string, input_format_sel: string, patch_json: string): string;
71
78
  /**
72
79
  * Semantic diff of two documents (PLAN-179). Flat arguments like every
73
80
  * other export:
@@ -82,6 +89,33 @@ export function resolve_patch_document(input: string, patch_json: string): strin
82
89
  * failure.
83
90
  */
84
91
  export function diff(a: string, b: string, input_format_sel: string, output_format_sel: string, context: number, locate: boolean, similarity: number, bbox_tolerance: number, spaces_around_values: number): string;
92
+ /**
93
+ * The constructs valid at a position, as an LSP `CompletionList` (PLAN-196
94
+ * D7; contract `API-EDT-editor-services.tsp`). `line` / `character` are
95
+ * 0-based, `character` in `position_encoding` units (`"utf-16"`, the
96
+ * default, or `"utf-8"`); `include_deprecated` offers deprecated bits too;
97
+ * `trigger_character` is the character the editor sent as the trigger (LSP
98
+ * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
99
+ * trigger that opens nothing where the cursor is answers the empty list
100
+ * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
101
+ * "presence is the capability" signal `diff` uses. Throws when the line is
102
+ * past the text.
103
+ */
104
+ export function complete(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, trigger_character: string): string;
105
+ /**
106
+ * One item of the list `complete` returns at this position, its Markdown
107
+ * `documentation` filled in — LSP `completionItem/resolve` (PLAN-202):
108
+ * `complete` ships no documentation, an editor asks for the one item it is
109
+ * about to show. `label` and `kind` (the LSP `CompletionItemKind` number)
110
+ * name the item; the JSON `null` when the list has no such item. Arguments
111
+ * otherwise as `complete`.
112
+ */
113
+ export function resolve(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, label: string, kind: number): string;
114
+ /**
115
+ * The construct at a position, as an LSP `Hover` — or the JSON `null` when
116
+ * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
117
+ */
118
+ export function hover(input: string, line: number, character: number, position_encoding: string): string;
85
119
  /**
86
120
  * Register data with the parser process (PLAN-173 P12).
87
121
  *
@@ -102,14 +136,15 @@ export function register(data_type: string, data: string): void;
102
136
  *
103
137
  * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
104
138
  * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
105
- * `"text"` | `"lex"` (the token stream as JSON, bitmark input only) | a
106
- * mapping id.
139
+ * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
140
+ * `"diagnostics"` (the last three bitmark input only) | a mapping id.
107
141
  * `mode`: `"optimized"` (default) | `"full"`.
108
142
  * `mapping_report`: replace the output with a human-readable report of the
109
143
  * input→output mappings, including inputs that are NOT mapped (PLAN-147).
110
- * `position_encoding`: `"utf-16"` (default) | `"utf-8"` and `tokens_layout`:
111
- * `"lsp"` (default) | `"absolute"` — the `semantic-tokens` output's two
112
- * options (PLAN-193); `""` means the default, and every other output
144
+ * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
145
+ * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
146
+ * PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
147
+ * `semantic-tokens` layout; `""` means the default, and every other output
113
148
  * format ignores them.
114
149
  * Returns the converted text/JSON; throws on failure.
115
150
  */
@@ -295,7 +295,11 @@ module.exports.convert_text = function(input, direction, format, location) {
295
295
  * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
296
296
  *
297
297
  * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
298
- * `output_format_sel`: `"bitmark"` | `"json"` (default json).
298
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
299
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
300
+ * the opposite of the resolved input format. The whole-document outputs
301
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
302
+ * pipeline refuses them and that refusal is what throws.
299
303
  * `patch_json`: the patch entry array (empty string = no patches, i.e. a
300
304
  * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
301
305
  * runs sequentially. Returns the document text/JSON; throws on failure.
@@ -348,39 +352,45 @@ module.exports.transform = function(input, input_format_sel, output_format_sel,
348
352
  * Resolve a patch document against `input` (bitmark or JSON) into the
349
353
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
350
354
  * reorder, drop and insert jobs from the one Rust implementation
351
- * (PLAN-179). Returns a JSON array of
355
+ * (PLAN-179). `input_format_sel` is the caller's input-format selector
356
+ * (`"auto"` | `"bitmark"` | `"json"`): the document is split under the SAME
357
+ * selection the planner already resolved, never re-sniffed (PLAN-187 D1).
358
+ * Returns a JSON array of
352
359
  * `{ "source": <original index> | null, "bit": <inner bit> | null,
353
360
  * "patch": [ … ] }`; throws on failure.
354
361
  * @param {string} input
362
+ * @param {string} input_format_sel
355
363
  * @param {string} patch_json
356
364
  * @returns {string}
357
365
  */
358
- module.exports.resolve_patch_document = function(input, patch_json) {
359
- let deferred4_0;
360
- let deferred4_1;
366
+ module.exports.resolve_patch_document = function(input, input_format_sel, patch_json) {
367
+ let deferred5_0;
368
+ let deferred5_1;
361
369
  try {
362
370
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
363
371
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
364
372
  const len0 = WASM_VECTOR_LEN;
365
- const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
373
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
366
374
  const len1 = WASM_VECTOR_LEN;
367
- wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);
375
+ const ptr2 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
376
+ const len2 = WASM_VECTOR_LEN;
377
+ wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
368
378
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
369
379
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
370
380
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
371
381
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
372
- var ptr3 = r0;
373
- var len3 = r1;
382
+ var ptr4 = r0;
383
+ var len4 = r1;
374
384
  if (r3) {
375
- ptr3 = 0; len3 = 0;
385
+ ptr4 = 0; len4 = 0;
376
386
  throw takeObject(r2);
377
387
  }
378
- deferred4_0 = ptr3;
379
- deferred4_1 = len3;
380
- return getStringFromWasm0(ptr3, len3);
388
+ deferred5_0 = ptr4;
389
+ deferred5_1 = len4;
390
+ return getStringFromWasm0(ptr4, len4);
381
391
  } finally {
382
392
  wasm.__wbindgen_add_to_stack_pointer(16);
383
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
393
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
384
394
  }
385
395
  };
386
396
 
@@ -440,6 +450,141 @@ module.exports.diff = function(a, b, input_format_sel, output_format_sel, contex
440
450
  }
441
451
  };
442
452
 
453
+ /**
454
+ * The constructs valid at a position, as an LSP `CompletionList` (PLAN-196
455
+ * D7; contract `API-EDT-editor-services.tsp`). `line` / `character` are
456
+ * 0-based, `character` in `position_encoding` units (`"utf-16"`, the
457
+ * default, or `"utf-8"`); `include_deprecated` offers deprecated bits too;
458
+ * `trigger_character` is the character the editor sent as the trigger (LSP
459
+ * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
460
+ * trigger that opens nothing where the cursor is answers the empty list
461
+ * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
462
+ * "presence is the capability" signal `diff` uses. Throws when the line is
463
+ * past the text.
464
+ * @param {string} input
465
+ * @param {number} line
466
+ * @param {number} character
467
+ * @param {string} position_encoding
468
+ * @param {boolean} include_deprecated
469
+ * @param {string} trigger_character
470
+ * @returns {string}
471
+ */
472
+ module.exports.complete = function(input, line, character, position_encoding, include_deprecated, trigger_character) {
473
+ let deferred5_0;
474
+ let deferred5_1;
475
+ try {
476
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
477
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
478
+ const len0 = WASM_VECTOR_LEN;
479
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
480
+ const len1 = WASM_VECTOR_LEN;
481
+ const ptr2 = passStringToWasm0(trigger_character, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
482
+ const len2 = WASM_VECTOR_LEN;
483
+ wasm.complete(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2);
484
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
485
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
486
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
487
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
488
+ var ptr4 = r0;
489
+ var len4 = r1;
490
+ if (r3) {
491
+ ptr4 = 0; len4 = 0;
492
+ throw takeObject(r2);
493
+ }
494
+ deferred5_0 = ptr4;
495
+ deferred5_1 = len4;
496
+ return getStringFromWasm0(ptr4, len4);
497
+ } finally {
498
+ wasm.__wbindgen_add_to_stack_pointer(16);
499
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
500
+ }
501
+ };
502
+
503
+ /**
504
+ * One item of the list `complete` returns at this position, its Markdown
505
+ * `documentation` filled in — LSP `completionItem/resolve` (PLAN-202):
506
+ * `complete` ships no documentation, an editor asks for the one item it is
507
+ * about to show. `label` and `kind` (the LSP `CompletionItemKind` number)
508
+ * name the item; the JSON `null` when the list has no such item. Arguments
509
+ * otherwise as `complete`.
510
+ * @param {string} input
511
+ * @param {number} line
512
+ * @param {number} character
513
+ * @param {string} position_encoding
514
+ * @param {boolean} include_deprecated
515
+ * @param {string} label
516
+ * @param {number} kind
517
+ * @returns {string}
518
+ */
519
+ module.exports.resolve = function(input, line, character, position_encoding, include_deprecated, label, kind) {
520
+ let deferred5_0;
521
+ let deferred5_1;
522
+ try {
523
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
524
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
525
+ const len0 = WASM_VECTOR_LEN;
526
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
527
+ const len1 = WASM_VECTOR_LEN;
528
+ const ptr2 = passStringToWasm0(label, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
529
+ const len2 = WASM_VECTOR_LEN;
530
+ wasm.resolve(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2, kind);
531
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
532
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
533
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
534
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
535
+ var ptr4 = r0;
536
+ var len4 = r1;
537
+ if (r3) {
538
+ ptr4 = 0; len4 = 0;
539
+ throw takeObject(r2);
540
+ }
541
+ deferred5_0 = ptr4;
542
+ deferred5_1 = len4;
543
+ return getStringFromWasm0(ptr4, len4);
544
+ } finally {
545
+ wasm.__wbindgen_add_to_stack_pointer(16);
546
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
547
+ }
548
+ };
549
+
550
+ /**
551
+ * The construct at a position, as an LSP `Hover` — or the JSON `null` when
552
+ * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
553
+ * @param {string} input
554
+ * @param {number} line
555
+ * @param {number} character
556
+ * @param {string} position_encoding
557
+ * @returns {string}
558
+ */
559
+ module.exports.hover = function(input, line, character, position_encoding) {
560
+ let deferred4_0;
561
+ let deferred4_1;
562
+ try {
563
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
564
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
565
+ const len0 = WASM_VECTOR_LEN;
566
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
567
+ const len1 = WASM_VECTOR_LEN;
568
+ wasm.hover(retptr, ptr0, len0, line, character, ptr1, len1);
569
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
570
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
571
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
572
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
573
+ var ptr3 = r0;
574
+ var len3 = r1;
575
+ if (r3) {
576
+ ptr3 = 0; len3 = 0;
577
+ throw takeObject(r2);
578
+ }
579
+ deferred4_0 = ptr3;
580
+ deferred4_1 = len3;
581
+ return getStringFromWasm0(ptr3, len3);
582
+ } finally {
583
+ wasm.__wbindgen_add_to_stack_pointer(16);
584
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
585
+ }
586
+ };
587
+
443
588
  /**
444
589
  * Register data with the parser process (PLAN-173 P12).
445
590
  *
@@ -479,14 +624,15 @@ module.exports.register = function(data_type, data) {
479
624
  *
480
625
  * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
481
626
  * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
482
- * `"text"` | `"lex"` (the token stream as JSON, bitmark input only) | a
483
- * mapping id.
627
+ * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
628
+ * `"diagnostics"` (the last three bitmark input only) | a mapping id.
484
629
  * `mode`: `"optimized"` (default) | `"full"`.
485
630
  * `mapping_report`: replace the output with a human-readable report of the
486
631
  * input→output mappings, including inputs that are NOT mapped (PLAN-147).
487
- * `position_encoding`: `"utf-16"` (default) | `"utf-8"` and `tokens_layout`:
488
- * `"lsp"` (default) | `"absolute"` — the `semantic-tokens` output's two
489
- * options (PLAN-193); `""` means the default, and every other output
632
+ * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
633
+ * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
634
+ * PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
635
+ * `semantic-tokens` layout; `""` means the default, and every other output
490
636
  * format ignores them.
491
637
  * Returns the converted text/JSON; throws on failure.
492
638
  * @param {string} input
Binary file
@@ -3,16 +3,19 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
5
5
  export const canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
6
+ export const complete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
6
7
  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;
7
8
  export const convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
8
9
  export const count_bits: (a: number, b: number, c: number) => void;
9
10
  export const diff: (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;
11
+ export const hover: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
10
12
  export const info: (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;
11
13
  export const info_text_supported: () => number;
12
14
  export const is_bitmark: (a: number, b: number) => number;
13
15
  export const prettify: (a: number, b: number, c: number, d: number) => void;
14
16
  export const register: (a: number, b: number, c: number, d: number, e: number) => void;
15
- export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number) => void;
17
+ 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;
18
+ export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
16
19
  export const split_bits: (a: number, b: number, c: number) => void;
17
20
  export const split_json_bits: (a: number, b: number, c: number) => void;
18
21
  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;
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.0.0",
7
+ "version": "7.2.0",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",
@@ -51,7 +51,11 @@ export function register(data_type: string, data: string): void;
51
51
  * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
52
52
  *
53
53
  * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
54
- * `output_format_sel`: `"bitmark"` | `"json"` (default json).
54
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
55
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
56
+ * the opposite of the resolved input format. The whole-document outputs
57
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
58
+ * pipeline refuses them and that refusal is what throws.
55
59
  * `patch_json`: the patch entry array (empty string = no patches, i.e. a
56
60
  * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
57
61
  * runs sequentially. Returns the document text/JSON; throws on failure.
@@ -61,24 +65,55 @@ export function transform(input: string, input_format_sel: string, output_format
61
65
  * Resolve a patch document against `input` (bitmark or JSON) into the
62
66
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
63
67
  * reorder, drop and insert jobs from the one Rust implementation
64
- * (PLAN-179). Returns a JSON array of
68
+ * (PLAN-179). `input_format_sel` is the caller's input-format selector
69
+ * (`"auto"` | `"bitmark"` | `"json"`): the document is split under the SAME
70
+ * selection the planner already resolved, never re-sniffed (PLAN-187 D1).
71
+ * Returns a JSON array of
65
72
  * `{ "source": <original index> | null, "bit": <inner bit> | null,
66
73
  * "patch": [ … ] }`; throws on failure.
67
74
  */
68
- export function resolve_patch_document(input: string, patch_json: string): string;
75
+ export function resolve_patch_document(input: string, input_format_sel: string, patch_json: string): string;
76
+ /**
77
+ * The constructs valid at a position, as an LSP `CompletionList` (PLAN-196
78
+ * D7; contract `API-EDT-editor-services.tsp`). `line` / `character` are
79
+ * 0-based, `character` in `position_encoding` units (`"utf-16"`, the
80
+ * default, or `"utf-8"`); `include_deprecated` offers deprecated bits too;
81
+ * `trigger_character` is the character the editor sent as the trigger (LSP
82
+ * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
83
+ * trigger that opens nothing where the cursor is answers the empty list
84
+ * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
85
+ * "presence is the capability" signal `diff` uses. Throws when the line is
86
+ * past the text.
87
+ */
88
+ export function complete(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, trigger_character: string): string;
89
+ /**
90
+ * One item of the list `complete` returns at this position, its Markdown
91
+ * `documentation` filled in — LSP `completionItem/resolve` (PLAN-202):
92
+ * `complete` ships no documentation, an editor asks for the one item it is
93
+ * about to show. `label` and `kind` (the LSP `CompletionItemKind` number)
94
+ * name the item; the JSON `null` when the list has no such item. Arguments
95
+ * otherwise as `complete`.
96
+ */
97
+ export function resolve(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, label: string, kind: number): string;
98
+ /**
99
+ * The construct at a position, as an LSP `Hover` — or the JSON `null` when
100
+ * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
101
+ */
102
+ export function hover(input: string, line: number, character: number, position_encoding: string): string;
69
103
  /**
70
104
  * Convert between bitmark and JSON with explicit input/output formats + mode.
71
105
  *
72
106
  * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
73
107
  * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
74
- * `"text"` | `"lex"` (the token stream as JSON, bitmark input only) | a
75
- * mapping id.
108
+ * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
109
+ * `"diagnostics"` (the last three bitmark input only) | a mapping id.
76
110
  * `mode`: `"optimized"` (default) | `"full"`.
77
111
  * `mapping_report`: replace the output with a human-readable report of the
78
112
  * input→output mappings, including inputs that are NOT mapped (PLAN-147).
79
- * `position_encoding`: `"utf-16"` (default) | `"utf-8"` and `tokens_layout`:
80
- * `"lsp"` (default) | `"absolute"` — the `semantic-tokens` output's two
81
- * options (PLAN-193); `""` means the default, and every other output
113
+ * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
114
+ * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
115
+ * PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
116
+ * `semantic-tokens` layout; `""` means the default, and every other output
82
117
  * format ignores them.
83
118
  * Returns the converted text/JSON; throws on failure.
84
119
  */