@adeu/core 1.19.1 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -75,6 +75,7 @@ declare class DocumentMapper {
75
75
  spans: TextSpan[];
76
76
  appendix_start_index: number;
77
77
  private _text_chunks;
78
+ private _plain_projection;
78
79
  constructor(doc: DocumentObject, clean_view?: boolean, original_view?: boolean);
79
80
  private _build_map;
80
81
  private _map_blocks;
@@ -86,6 +87,28 @@ declare class DocumentMapper {
86
87
  private _add_virtual_text;
87
88
  private _replace_smart_quotes;
88
89
  private _make_fuzzy_regex;
90
+ /**
91
+ * Returns [plain_text, offset_map] where plain_text is full_text with the
92
+ * VIRTUAL markdown style delimiters (bold/italic markers emitted around
93
+ * formatted runs) removed, and offset_map[i] is the full_text index of
94
+ * plain_text[i].
95
+ *
96
+ * Formatting run boundaries can fall mid-word (e.g. a paragraph projected
97
+ * as "**Al**pha"), where neither exact matching nor the whitespace-anchored
98
+ * fuzzy regex can find the plain target "Alpha". Matching against this
99
+ * projection and mapping the span back to full_text closes that gap (QA H2).
100
+ *
101
+ * Built lazily and invalidated by _build_map(): most batches never need it.
102
+ */
103
+ private _get_plain_projection;
104
+ /**
105
+ * Matches a markdown-stripped target against the plain projection and maps
106
+ * each hit back to a [start, length] span in full_text. Interior style
107
+ * markers end up inside the returned span (so "Alpha" over "**Al**pha"
108
+ * resolves to the "Al**pha" range); markers just outside the matched
109
+ * characters are excluded.
110
+ */
111
+ private _find_plain_projection_matches;
89
112
  find_match_index(target_text: string, is_regex?: boolean): [number, number];
90
113
  find_all_match_indices(target_text: string, is_regex?: boolean): [number, number][];
91
114
  find_target_runs(target_text: string): Run[];
@@ -207,6 +230,43 @@ declare class RedlineEngine {
207
230
  * escalating the regex further.
208
231
  */
209
232
  private _nearest_match_hint;
233
+ private static readonly _PREVIEW_WRAPPER_PAIRS;
234
+ /**
235
+ * Makes a fixed-width slice of the raw-view projection presentable: drops
236
+ * complete {>>...<<} meta blocks (annotations of pre-existing changes, not
237
+ * part of this edit) and any wrapper fragments the window boundary chopped
238
+ * in half. Without this, previews leak internal scaffolding like
239
+ * "[Chg:5 delete]" (QA H1). Mirrors the Python engine.
240
+ */
241
+ private static _tidy_preview_context;
242
+ /**
243
+ * Snapshots the document text around a resolved edit BEFORE anything is
244
+ * applied. Previews rendered after the batch mutates the DOM cannot slice
245
+ * full_text at the stored offsets: applied edits shift offsets and inject
246
+ * tracked-change markup, which produced garbled previews mixing unrelated
247
+ * edits and internal scaffolding (QA H1).
248
+ */
249
+ private _capture_preview_context;
250
+ /**
251
+ * Like _capture_preview_context, but snapshots the context around the
252
+ * ORIGINAL edit's full matched span (stashed by _pre_resolve_heuristic_edit),
253
+ * so the report preview can present the complete logical change of a
254
+ * compound modification instead of its first sub-edit.
255
+ */
256
+ private _capture_parent_preview_context;
257
+ /**
258
+ * Renders the preview from the edit's full matched span. The common
259
+ * prefix/suffix between matched and replacement text is moved into the
260
+ * surrounding context so the {--...--}{++...++} block shows the minimal
261
+ * complete change.
262
+ */
263
+ private _build_full_match_preview;
264
+ /**
265
+ * The "new text" a batch report should show for an edit. InsertTableRow has
266
+ * no new_text field — surface its cell contents instead of the misleading
267
+ * empty string the report used to print (QA M4).
268
+ */
269
+ private static _report_new_text;
210
270
  private _build_edit_context_previews;
211
271
  private _scan_existing_ids;
212
272
  private _get_heading_path_and_page;
@@ -328,6 +388,12 @@ declare class RedlineEngine {
328
388
  private _clean_wrapping_comments;
329
389
  private _delete_comments_in_element;
330
390
  validate_edits(edits: any[], index_offset?: number): string[];
391
+ /**
392
+ * Number of columns (w:tc elements) in the table row containing the text at
393
+ * [start, start+length) in `mapper`, or null if that text is not inside a
394
+ * table row.
395
+ */
396
+ private static _column_count_at;
331
397
  validate_review_actions(actions: any[]): string[];
332
398
  process_batch(changes: DocumentChange[], dry_run?: boolean): any;
333
399
  private _process_batch_internal;
package/dist/index.d.ts CHANGED
@@ -75,6 +75,7 @@ declare class DocumentMapper {
75
75
  spans: TextSpan[];
76
76
  appendix_start_index: number;
77
77
  private _text_chunks;
78
+ private _plain_projection;
78
79
  constructor(doc: DocumentObject, clean_view?: boolean, original_view?: boolean);
79
80
  private _build_map;
80
81
  private _map_blocks;
@@ -86,6 +87,28 @@ declare class DocumentMapper {
86
87
  private _add_virtual_text;
87
88
  private _replace_smart_quotes;
88
89
  private _make_fuzzy_regex;
90
+ /**
91
+ * Returns [plain_text, offset_map] where plain_text is full_text with the
92
+ * VIRTUAL markdown style delimiters (bold/italic markers emitted around
93
+ * formatted runs) removed, and offset_map[i] is the full_text index of
94
+ * plain_text[i].
95
+ *
96
+ * Formatting run boundaries can fall mid-word (e.g. a paragraph projected
97
+ * as "**Al**pha"), where neither exact matching nor the whitespace-anchored
98
+ * fuzzy regex can find the plain target "Alpha". Matching against this
99
+ * projection and mapping the span back to full_text closes that gap (QA H2).
100
+ *
101
+ * Built lazily and invalidated by _build_map(): most batches never need it.
102
+ */
103
+ private _get_plain_projection;
104
+ /**
105
+ * Matches a markdown-stripped target against the plain projection and maps
106
+ * each hit back to a [start, length] span in full_text. Interior style
107
+ * markers end up inside the returned span (so "Alpha" over "**Al**pha"
108
+ * resolves to the "Al**pha" range); markers just outside the matched
109
+ * characters are excluded.
110
+ */
111
+ private _find_plain_projection_matches;
89
112
  find_match_index(target_text: string, is_regex?: boolean): [number, number];
90
113
  find_all_match_indices(target_text: string, is_regex?: boolean): [number, number][];
91
114
  find_target_runs(target_text: string): Run[];
@@ -207,6 +230,43 @@ declare class RedlineEngine {
207
230
  * escalating the regex further.
208
231
  */
209
232
  private _nearest_match_hint;
233
+ private static readonly _PREVIEW_WRAPPER_PAIRS;
234
+ /**
235
+ * Makes a fixed-width slice of the raw-view projection presentable: drops
236
+ * complete {>>...<<} meta blocks (annotations of pre-existing changes, not
237
+ * part of this edit) and any wrapper fragments the window boundary chopped
238
+ * in half. Without this, previews leak internal scaffolding like
239
+ * "[Chg:5 delete]" (QA H1). Mirrors the Python engine.
240
+ */
241
+ private static _tidy_preview_context;
242
+ /**
243
+ * Snapshots the document text around a resolved edit BEFORE anything is
244
+ * applied. Previews rendered after the batch mutates the DOM cannot slice
245
+ * full_text at the stored offsets: applied edits shift offsets and inject
246
+ * tracked-change markup, which produced garbled previews mixing unrelated
247
+ * edits and internal scaffolding (QA H1).
248
+ */
249
+ private _capture_preview_context;
250
+ /**
251
+ * Like _capture_preview_context, but snapshots the context around the
252
+ * ORIGINAL edit's full matched span (stashed by _pre_resolve_heuristic_edit),
253
+ * so the report preview can present the complete logical change of a
254
+ * compound modification instead of its first sub-edit.
255
+ */
256
+ private _capture_parent_preview_context;
257
+ /**
258
+ * Renders the preview from the edit's full matched span. The common
259
+ * prefix/suffix between matched and replacement text is moved into the
260
+ * surrounding context so the {--...--}{++...++} block shows the minimal
261
+ * complete change.
262
+ */
263
+ private _build_full_match_preview;
264
+ /**
265
+ * The "new text" a batch report should show for an edit. InsertTableRow has
266
+ * no new_text field — surface its cell contents instead of the misleading
267
+ * empty string the report used to print (QA M4).
268
+ */
269
+ private static _report_new_text;
210
270
  private _build_edit_context_previews;
211
271
  private _scan_existing_ids;
212
272
  private _get_heading_path_and_page;
@@ -328,6 +388,12 @@ declare class RedlineEngine {
328
388
  private _clean_wrapping_comments;
329
389
  private _delete_comments_in_element;
330
390
  validate_edits(edits: any[], index_offset?: number): string[];
391
+ /**
392
+ * Number of columns (w:tc elements) in the table row containing the text at
393
+ * [start, start+length) in `mapper`, or null if that text is not inside a
394
+ * table row.
395
+ */
396
+ private static _column_count_at;
331
397
  validate_review_actions(actions: any[]): string[];
332
398
  process_batch(changes: DocumentChange[], dry_run?: boolean): any;
333
399
  private _process_batch_internal;