@drghaliasri/butex 7.0.4 → 7.1.1

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.
@@ -905,6 +905,26 @@ declare class Document2CommandError extends Error {
905
905
  /** Apply one validated command to canonical JSON without mutating caller input. */
906
906
  declare function applyDocument2Command(json: Document2Json, commandInput: Document2Command): Document2Json;
907
907
 
908
+ type Document2DiffChunkKind = 'added' | 'removed' | 'context';
909
+ type Document2DiffChunk = {
910
+ kind: Document2DiffChunkKind;
911
+ text: string;
912
+ };
913
+ type Document2Diff = {
914
+ version: 1;
915
+ changed: boolean;
916
+ truncated: boolean;
917
+ chunks: Document2DiffChunk[];
918
+ };
919
+ /**
920
+ * Compare two persisted Document2 documents using canonical Document2 import/export
921
+ * semantics and jsdiff's maintained JSON diff implementation.
922
+ *
923
+ * Generated editor identity sidecars are intentionally excluded so equivalent
924
+ * legacy documents do not differ merely because normalization assigned new IDs.
925
+ */
926
+ declare function diffDocument2(before: Document2Json, after: Document2Json): Document2Diff;
927
+
908
928
  type Document2OutlineKind = 'section' | 'subsection' | 'subsubsection' | 'paragraph' | 'list' | 'table' | 'figure' | 'bibliography' | 'raw';
909
929
  type Document2OutlineEntry = {
910
930
  id: string;
@@ -1123,4 +1143,4 @@ declare function document2Preview(document: Document2Node, output?: Document2Mat
1123
1143
  */
1124
1144
  declare function document2Latex(document: Document2Node, options?: Document2LatexOptions): string;
1125
1145
 
1126
- export { type ArabicDigitsMapping, type ArabicXeLatexPreambleOptions, BUTEX_BASMALA, BUTEX_BASMALA_LINE1, BUTEX_BASMALA_LINE2, BUTEX_BASMALA_SALAWAT, BUTEX_CLOSING_HAMDALA, type BibliographyBlock2, type BlockSelectionRange, type BlockSelectionState, type CiteToken2, DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH, DEFAULT_HIJRI_DATE, DEFAULT_REFERENCE_FIELD_SEPARATOR, type Document2Anchor, type Document2Block, type Document2BlockJson, type Document2BlockMetadata, type Document2CitationIndexEntry, type Document2Command, Document2CommandError, type Document2CommandErrorCode, type Document2CrossReferenceIndexEntry, type Document2Diagnostic, type Document2Direction, type Document2HijriDate, type Document2HistoryStacks, type Document2ImageAssetRef, type Document2IndexedLabel, type Document2InlineAnchor, type Document2InlineIdsJson, type Document2InlineTokenIdJson, type Document2InlineTokenInput, type Document2Json, type Document2KeyError, type Document2KeyNamespace, type Document2LabelEntry, type Document2LabelKind, type Document2LatexOptions, type Document2ListItemAnchor, type Document2MathObjectJson, type Document2MathOutput, type Document2Meta, type Document2MetaProp, type Document2Node, type Document2OutlineEntry, type Document2OutlineKind, type Document2Preview, type Document2PreviewOptions, type Document2ReferenceAnchor, type Document2ReferenceIndex, type Document2TextBlockKind, Document2ValidationError, type Document2ValidationIssue, type Document2ValidationIssueCode, type Document2ValidationResult, type FloatMeta2, type FloatMetaPatch, type FormatCiteLabelOptions, type FormatFloatCaptionTitleOptions, HIJRI_MONTH_IDS, HIJRI_YEAR_MAX, HIJRI_YEAR_MIN, type HijriMonthId, type ImageBlock2, type ImportDocument2Options, type InlineField2, type InlineToken2, type ListBlock2, type ListItem2, type MathIsland2, type MathObject2Json, type MathToken2, type PreviewBlock2, type PreviewInline2, type RawBlock2, type RawMathObject2Json, type RefToken2, type Reference2, type Reference2Json, type ReferenceFieldSeparator, type TableBlock2, type TextBlock2, type TextFormatSpan2Json, type TextStyle2, type TextToken2, absoluteHttpHref, addDocument2ImageBlock, addDocument2ListBlock, addDocument2ListItem, addDocument2Reference, addDocument2TableBlock, addDocument2TextBlock, applyDocument2Command, applyFloatMetaPatch, arabicXeLatexPreambleCmd, arabicXeLatexPreambleFont, arabicXeLatexPreamblePkg, bibliographyEntryBody, bibliographyEntryLatex, butexBasmalaDisplayLatex, butexBasmalaDisplayTex, butexBasmalaTitlingPreamble, butexDiwaniDisplayLatex, butexDiwaniDisplayTex, butexInColumnMaketitleHook, butexMaghribiDisplayLatex, butexMaghribiDisplayTex, citeTokenLatex, clearDocument2ImageAsset, cloneDocument2Meta, cloneDocument2Node, collectDocument2Labels, createDocument2History, createEmptyArabicEquationSession, createEmptyDocument2, createEmptyEquationSession, createEmptyReference2, createInlineField2, defaultFloatMeta, detectInlineSpans2, detectMathSpans2, document2HasAbstract, document2HasMaketitle, document2HasTitleStack, document2HistoryCanRedo, document2HistoryCanUndo, document2KeyError, document2Latex, document2Outline, document2Preview, emptyBlockSelection, emptyDocument2Meta, ensureDocument2BibliographyBlock, extendBlockSelectionFromAnchor, fillDocument2MetaGaps, findFirstInlineField, formatBibliographyNumber, formatCiteLabel, formatFloatCaptionPreview, formatFloatCaptionTitle, formatHijriDate, formatRefLabel, fromDocumentJson2, getArabicXeLatexPreamble, getDocument2ReferenceIndex, getDocument2References, hasXeLatexUnsupportedEmoji, hijriMonthLabel, inlineFieldLatex, insertCiteTokenAtCaret, insertDocument2BlockAfter, insertMathToken, insertMathTokenAtCaret, insertRefTokenAtCaret, isDocument2Valid, isDuplicateDocument2Key, isValidDocument2Key, labelNumberMap, mathNodeFromArabicSession, mathNodeFromSession, mathSourceFromArabicSession, mathSourceFromSession, mathTokenSourceForSide, mathTokenToArabicEditorSession, mathTokenToEditorSession, mergeDocument2Meta, moveDocument2BlockById, moveDocument2BlockRange, moveDocument2Reference, normalizeBlockSelection, normalizeDocument2HijriDate, normalizeDocument2Key, normalizeDocument2Meta, normalizeReferenceFieldSeparator, parseCiteKeys, parseFloatMetaFromJson, parseRefKeys, pushDocument2Snapshot, refTokenLatex, referenceFromJson, referenceNumberMap, remapSelectionAfterRangeMove, removeCiteTokenById, removeDocument2BlockById, removeDocument2BlockRange, removeDocument2ListItem, removeDocument2Reference, removeMathTokenById, removeRefTokenById, replaceMathTokenFromSession, resolveCiteNumbers, restoreDocument2Redo, restoreDocument2Undo, setDocument2References, stripDisplayMathDelimiters, toDocumentJson2, toggleBlockInSelection, toggleTextTokenStyle, updateCiteTokenKeys, updateDocument2ImageAsset, updateDocument2ImageMeta, updateDocument2ImageValue, updateDocument2Meta, updateDocument2Reference, updateDocument2TableMeta, updateDocument2TextBlockCentered, updateMathTokenLabel, updateRefTokenKeys, updateTextToken, validateDocument2 };
1146
+ export { type ArabicDigitsMapping, type ArabicXeLatexPreambleOptions, BUTEX_BASMALA, BUTEX_BASMALA_LINE1, BUTEX_BASMALA_LINE2, BUTEX_BASMALA_SALAWAT, BUTEX_CLOSING_HAMDALA, type BibliographyBlock2, type BlockSelectionRange, type BlockSelectionState, type CiteToken2, DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH, DEFAULT_HIJRI_DATE, DEFAULT_REFERENCE_FIELD_SEPARATOR, type Document2Anchor, type Document2Block, type Document2BlockJson, type Document2BlockMetadata, type Document2CitationIndexEntry, type Document2Command, Document2CommandError, type Document2CommandErrorCode, type Document2CrossReferenceIndexEntry, type Document2Diagnostic, type Document2Diff, type Document2DiffChunk, type Document2DiffChunkKind, type Document2Direction, type Document2HijriDate, type Document2HistoryStacks, type Document2ImageAssetRef, type Document2IndexedLabel, type Document2InlineAnchor, type Document2InlineIdsJson, type Document2InlineTokenIdJson, type Document2InlineTokenInput, type Document2Json, type Document2KeyError, type Document2KeyNamespace, type Document2LabelEntry, type Document2LabelKind, type Document2LatexOptions, type Document2ListItemAnchor, type Document2MathObjectJson, type Document2MathOutput, type Document2Meta, type Document2MetaProp, type Document2Node, type Document2OutlineEntry, type Document2OutlineKind, type Document2Preview, type Document2PreviewOptions, type Document2ReferenceAnchor, type Document2ReferenceIndex, type Document2TextBlockKind, Document2ValidationError, type Document2ValidationIssue, type Document2ValidationIssueCode, type Document2ValidationResult, type FloatMeta2, type FloatMetaPatch, type FormatCiteLabelOptions, type FormatFloatCaptionTitleOptions, HIJRI_MONTH_IDS, HIJRI_YEAR_MAX, HIJRI_YEAR_MIN, type HijriMonthId, type ImageBlock2, type ImportDocument2Options, type InlineField2, type InlineToken2, type ListBlock2, type ListItem2, type MathIsland2, type MathObject2Json, type MathToken2, type PreviewBlock2, type PreviewInline2, type RawBlock2, type RawMathObject2Json, type RefToken2, type Reference2, type Reference2Json, type ReferenceFieldSeparator, type TableBlock2, type TextBlock2, type TextFormatSpan2Json, type TextStyle2, type TextToken2, absoluteHttpHref, addDocument2ImageBlock, addDocument2ListBlock, addDocument2ListItem, addDocument2Reference, addDocument2TableBlock, addDocument2TextBlock, applyDocument2Command, applyFloatMetaPatch, arabicXeLatexPreambleCmd, arabicXeLatexPreambleFont, arabicXeLatexPreamblePkg, bibliographyEntryBody, bibliographyEntryLatex, butexBasmalaDisplayLatex, butexBasmalaDisplayTex, butexBasmalaTitlingPreamble, butexDiwaniDisplayLatex, butexDiwaniDisplayTex, butexInColumnMaketitleHook, butexMaghribiDisplayLatex, butexMaghribiDisplayTex, citeTokenLatex, clearDocument2ImageAsset, cloneDocument2Meta, cloneDocument2Node, collectDocument2Labels, createDocument2History, createEmptyArabicEquationSession, createEmptyDocument2, createEmptyEquationSession, createEmptyReference2, createInlineField2, defaultFloatMeta, detectInlineSpans2, detectMathSpans2, diffDocument2, document2HasAbstract, document2HasMaketitle, document2HasTitleStack, document2HistoryCanRedo, document2HistoryCanUndo, document2KeyError, document2Latex, document2Outline, document2Preview, emptyBlockSelection, emptyDocument2Meta, ensureDocument2BibliographyBlock, extendBlockSelectionFromAnchor, fillDocument2MetaGaps, findFirstInlineField, formatBibliographyNumber, formatCiteLabel, formatFloatCaptionPreview, formatFloatCaptionTitle, formatHijriDate, formatRefLabel, fromDocumentJson2, getArabicXeLatexPreamble, getDocument2ReferenceIndex, getDocument2References, hasXeLatexUnsupportedEmoji, hijriMonthLabel, inlineFieldLatex, insertCiteTokenAtCaret, insertDocument2BlockAfter, insertMathToken, insertMathTokenAtCaret, insertRefTokenAtCaret, isDocument2Valid, isDuplicateDocument2Key, isValidDocument2Key, labelNumberMap, mathNodeFromArabicSession, mathNodeFromSession, mathSourceFromArabicSession, mathSourceFromSession, mathTokenSourceForSide, mathTokenToArabicEditorSession, mathTokenToEditorSession, mergeDocument2Meta, moveDocument2BlockById, moveDocument2BlockRange, moveDocument2Reference, normalizeBlockSelection, normalizeDocument2HijriDate, normalizeDocument2Key, normalizeDocument2Meta, normalizeReferenceFieldSeparator, parseCiteKeys, parseFloatMetaFromJson, parseRefKeys, pushDocument2Snapshot, refTokenLatex, referenceFromJson, referenceNumberMap, remapSelectionAfterRangeMove, removeCiteTokenById, removeDocument2BlockById, removeDocument2BlockRange, removeDocument2ListItem, removeDocument2Reference, removeMathTokenById, removeRefTokenById, replaceMathTokenFromSession, resolveCiteNumbers, restoreDocument2Redo, restoreDocument2Undo, setDocument2References, stripDisplayMathDelimiters, toDocumentJson2, toggleBlockInSelection, toggleTextTokenStyle, updateCiteTokenKeys, updateDocument2ImageAsset, updateDocument2ImageMeta, updateDocument2ImageValue, updateDocument2Meta, updateDocument2Reference, updateDocument2TableMeta, updateDocument2TextBlockCentered, updateMathTokenLabel, updateRefTokenKeys, updateTextToken, validateDocument2 };
@@ -905,6 +905,26 @@ declare class Document2CommandError extends Error {
905
905
  /** Apply one validated command to canonical JSON without mutating caller input. */
906
906
  declare function applyDocument2Command(json: Document2Json, commandInput: Document2Command): Document2Json;
907
907
 
908
+ type Document2DiffChunkKind = 'added' | 'removed' | 'context';
909
+ type Document2DiffChunk = {
910
+ kind: Document2DiffChunkKind;
911
+ text: string;
912
+ };
913
+ type Document2Diff = {
914
+ version: 1;
915
+ changed: boolean;
916
+ truncated: boolean;
917
+ chunks: Document2DiffChunk[];
918
+ };
919
+ /**
920
+ * Compare two persisted Document2 documents using canonical Document2 import/export
921
+ * semantics and jsdiff's maintained JSON diff implementation.
922
+ *
923
+ * Generated editor identity sidecars are intentionally excluded so equivalent
924
+ * legacy documents do not differ merely because normalization assigned new IDs.
925
+ */
926
+ declare function diffDocument2(before: Document2Json, after: Document2Json): Document2Diff;
927
+
908
928
  type Document2OutlineKind = 'section' | 'subsection' | 'subsubsection' | 'paragraph' | 'list' | 'table' | 'figure' | 'bibliography' | 'raw';
909
929
  type Document2OutlineEntry = {
910
930
  id: string;
@@ -1123,4 +1143,4 @@ declare function document2Preview(document: Document2Node, output?: Document2Mat
1123
1143
  */
1124
1144
  declare function document2Latex(document: Document2Node, options?: Document2LatexOptions): string;
1125
1145
 
1126
- export { type ArabicDigitsMapping, type ArabicXeLatexPreambleOptions, BUTEX_BASMALA, BUTEX_BASMALA_LINE1, BUTEX_BASMALA_LINE2, BUTEX_BASMALA_SALAWAT, BUTEX_CLOSING_HAMDALA, type BibliographyBlock2, type BlockSelectionRange, type BlockSelectionState, type CiteToken2, DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH, DEFAULT_HIJRI_DATE, DEFAULT_REFERENCE_FIELD_SEPARATOR, type Document2Anchor, type Document2Block, type Document2BlockJson, type Document2BlockMetadata, type Document2CitationIndexEntry, type Document2Command, Document2CommandError, type Document2CommandErrorCode, type Document2CrossReferenceIndexEntry, type Document2Diagnostic, type Document2Direction, type Document2HijriDate, type Document2HistoryStacks, type Document2ImageAssetRef, type Document2IndexedLabel, type Document2InlineAnchor, type Document2InlineIdsJson, type Document2InlineTokenIdJson, type Document2InlineTokenInput, type Document2Json, type Document2KeyError, type Document2KeyNamespace, type Document2LabelEntry, type Document2LabelKind, type Document2LatexOptions, type Document2ListItemAnchor, type Document2MathObjectJson, type Document2MathOutput, type Document2Meta, type Document2MetaProp, type Document2Node, type Document2OutlineEntry, type Document2OutlineKind, type Document2Preview, type Document2PreviewOptions, type Document2ReferenceAnchor, type Document2ReferenceIndex, type Document2TextBlockKind, Document2ValidationError, type Document2ValidationIssue, type Document2ValidationIssueCode, type Document2ValidationResult, type FloatMeta2, type FloatMetaPatch, type FormatCiteLabelOptions, type FormatFloatCaptionTitleOptions, HIJRI_MONTH_IDS, HIJRI_YEAR_MAX, HIJRI_YEAR_MIN, type HijriMonthId, type ImageBlock2, type ImportDocument2Options, type InlineField2, type InlineToken2, type ListBlock2, type ListItem2, type MathIsland2, type MathObject2Json, type MathToken2, type PreviewBlock2, type PreviewInline2, type RawBlock2, type RawMathObject2Json, type RefToken2, type Reference2, type Reference2Json, type ReferenceFieldSeparator, type TableBlock2, type TextBlock2, type TextFormatSpan2Json, type TextStyle2, type TextToken2, absoluteHttpHref, addDocument2ImageBlock, addDocument2ListBlock, addDocument2ListItem, addDocument2Reference, addDocument2TableBlock, addDocument2TextBlock, applyDocument2Command, applyFloatMetaPatch, arabicXeLatexPreambleCmd, arabicXeLatexPreambleFont, arabicXeLatexPreamblePkg, bibliographyEntryBody, bibliographyEntryLatex, butexBasmalaDisplayLatex, butexBasmalaDisplayTex, butexBasmalaTitlingPreamble, butexDiwaniDisplayLatex, butexDiwaniDisplayTex, butexInColumnMaketitleHook, butexMaghribiDisplayLatex, butexMaghribiDisplayTex, citeTokenLatex, clearDocument2ImageAsset, cloneDocument2Meta, cloneDocument2Node, collectDocument2Labels, createDocument2History, createEmptyArabicEquationSession, createEmptyDocument2, createEmptyEquationSession, createEmptyReference2, createInlineField2, defaultFloatMeta, detectInlineSpans2, detectMathSpans2, document2HasAbstract, document2HasMaketitle, document2HasTitleStack, document2HistoryCanRedo, document2HistoryCanUndo, document2KeyError, document2Latex, document2Outline, document2Preview, emptyBlockSelection, emptyDocument2Meta, ensureDocument2BibliographyBlock, extendBlockSelectionFromAnchor, fillDocument2MetaGaps, findFirstInlineField, formatBibliographyNumber, formatCiteLabel, formatFloatCaptionPreview, formatFloatCaptionTitle, formatHijriDate, formatRefLabel, fromDocumentJson2, getArabicXeLatexPreamble, getDocument2ReferenceIndex, getDocument2References, hasXeLatexUnsupportedEmoji, hijriMonthLabel, inlineFieldLatex, insertCiteTokenAtCaret, insertDocument2BlockAfter, insertMathToken, insertMathTokenAtCaret, insertRefTokenAtCaret, isDocument2Valid, isDuplicateDocument2Key, isValidDocument2Key, labelNumberMap, mathNodeFromArabicSession, mathNodeFromSession, mathSourceFromArabicSession, mathSourceFromSession, mathTokenSourceForSide, mathTokenToArabicEditorSession, mathTokenToEditorSession, mergeDocument2Meta, moveDocument2BlockById, moveDocument2BlockRange, moveDocument2Reference, normalizeBlockSelection, normalizeDocument2HijriDate, normalizeDocument2Key, normalizeDocument2Meta, normalizeReferenceFieldSeparator, parseCiteKeys, parseFloatMetaFromJson, parseRefKeys, pushDocument2Snapshot, refTokenLatex, referenceFromJson, referenceNumberMap, remapSelectionAfterRangeMove, removeCiteTokenById, removeDocument2BlockById, removeDocument2BlockRange, removeDocument2ListItem, removeDocument2Reference, removeMathTokenById, removeRefTokenById, replaceMathTokenFromSession, resolveCiteNumbers, restoreDocument2Redo, restoreDocument2Undo, setDocument2References, stripDisplayMathDelimiters, toDocumentJson2, toggleBlockInSelection, toggleTextTokenStyle, updateCiteTokenKeys, updateDocument2ImageAsset, updateDocument2ImageMeta, updateDocument2ImageValue, updateDocument2Meta, updateDocument2Reference, updateDocument2TableMeta, updateDocument2TextBlockCentered, updateMathTokenLabel, updateRefTokenKeys, updateTextToken, validateDocument2 };
1146
+ export { type ArabicDigitsMapping, type ArabicXeLatexPreambleOptions, BUTEX_BASMALA, BUTEX_BASMALA_LINE1, BUTEX_BASMALA_LINE2, BUTEX_BASMALA_SALAWAT, BUTEX_CLOSING_HAMDALA, type BibliographyBlock2, type BlockSelectionRange, type BlockSelectionState, type CiteToken2, DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH, DEFAULT_HIJRI_DATE, DEFAULT_REFERENCE_FIELD_SEPARATOR, type Document2Anchor, type Document2Block, type Document2BlockJson, type Document2BlockMetadata, type Document2CitationIndexEntry, type Document2Command, Document2CommandError, type Document2CommandErrorCode, type Document2CrossReferenceIndexEntry, type Document2Diagnostic, type Document2Diff, type Document2DiffChunk, type Document2DiffChunkKind, type Document2Direction, type Document2HijriDate, type Document2HistoryStacks, type Document2ImageAssetRef, type Document2IndexedLabel, type Document2InlineAnchor, type Document2InlineIdsJson, type Document2InlineTokenIdJson, type Document2InlineTokenInput, type Document2Json, type Document2KeyError, type Document2KeyNamespace, type Document2LabelEntry, type Document2LabelKind, type Document2LatexOptions, type Document2ListItemAnchor, type Document2MathObjectJson, type Document2MathOutput, type Document2Meta, type Document2MetaProp, type Document2Node, type Document2OutlineEntry, type Document2OutlineKind, type Document2Preview, type Document2PreviewOptions, type Document2ReferenceAnchor, type Document2ReferenceIndex, type Document2TextBlockKind, Document2ValidationError, type Document2ValidationIssue, type Document2ValidationIssueCode, type Document2ValidationResult, type FloatMeta2, type FloatMetaPatch, type FormatCiteLabelOptions, type FormatFloatCaptionTitleOptions, HIJRI_MONTH_IDS, HIJRI_YEAR_MAX, HIJRI_YEAR_MIN, type HijriMonthId, type ImageBlock2, type ImportDocument2Options, type InlineField2, type InlineToken2, type ListBlock2, type ListItem2, type MathIsland2, type MathObject2Json, type MathToken2, type PreviewBlock2, type PreviewInline2, type RawBlock2, type RawMathObject2Json, type RefToken2, type Reference2, type Reference2Json, type ReferenceFieldSeparator, type TableBlock2, type TextBlock2, type TextFormatSpan2Json, type TextStyle2, type TextToken2, absoluteHttpHref, addDocument2ImageBlock, addDocument2ListBlock, addDocument2ListItem, addDocument2Reference, addDocument2TableBlock, addDocument2TextBlock, applyDocument2Command, applyFloatMetaPatch, arabicXeLatexPreambleCmd, arabicXeLatexPreambleFont, arabicXeLatexPreamblePkg, bibliographyEntryBody, bibliographyEntryLatex, butexBasmalaDisplayLatex, butexBasmalaDisplayTex, butexBasmalaTitlingPreamble, butexDiwaniDisplayLatex, butexDiwaniDisplayTex, butexInColumnMaketitleHook, butexMaghribiDisplayLatex, butexMaghribiDisplayTex, citeTokenLatex, clearDocument2ImageAsset, cloneDocument2Meta, cloneDocument2Node, collectDocument2Labels, createDocument2History, createEmptyArabicEquationSession, createEmptyDocument2, createEmptyEquationSession, createEmptyReference2, createInlineField2, defaultFloatMeta, detectInlineSpans2, detectMathSpans2, diffDocument2, document2HasAbstract, document2HasMaketitle, document2HasTitleStack, document2HistoryCanRedo, document2HistoryCanUndo, document2KeyError, document2Latex, document2Outline, document2Preview, emptyBlockSelection, emptyDocument2Meta, ensureDocument2BibliographyBlock, extendBlockSelectionFromAnchor, fillDocument2MetaGaps, findFirstInlineField, formatBibliographyNumber, formatCiteLabel, formatFloatCaptionPreview, formatFloatCaptionTitle, formatHijriDate, formatRefLabel, fromDocumentJson2, getArabicXeLatexPreamble, getDocument2ReferenceIndex, getDocument2References, hasXeLatexUnsupportedEmoji, hijriMonthLabel, inlineFieldLatex, insertCiteTokenAtCaret, insertDocument2BlockAfter, insertMathToken, insertMathTokenAtCaret, insertRefTokenAtCaret, isDocument2Valid, isDuplicateDocument2Key, isValidDocument2Key, labelNumberMap, mathNodeFromArabicSession, mathNodeFromSession, mathSourceFromArabicSession, mathSourceFromSession, mathTokenSourceForSide, mathTokenToArabicEditorSession, mathTokenToEditorSession, mergeDocument2Meta, moveDocument2BlockById, moveDocument2BlockRange, moveDocument2Reference, normalizeBlockSelection, normalizeDocument2HijriDate, normalizeDocument2Key, normalizeDocument2Meta, normalizeReferenceFieldSeparator, parseCiteKeys, parseFloatMetaFromJson, parseRefKeys, pushDocument2Snapshot, refTokenLatex, referenceFromJson, referenceNumberMap, remapSelectionAfterRangeMove, removeCiteTokenById, removeDocument2BlockById, removeDocument2BlockRange, removeDocument2ListItem, removeDocument2Reference, removeMathTokenById, removeRefTokenById, replaceMathTokenFromSession, resolveCiteNumbers, restoreDocument2Redo, restoreDocument2Undo, setDocument2References, stripDisplayMathDelimiters, toDocumentJson2, toggleBlockInSelection, toggleTextTokenStyle, updateCiteTokenKeys, updateDocument2ImageAsset, updateDocument2ImageMeta, updateDocument2ImageValue, updateDocument2Meta, updateDocument2Reference, updateDocument2TableMeta, updateDocument2TextBlockCentered, updateMathTokenLabel, updateRefTokenKeys, updateTextToken, validateDocument2 };
package/dist/document2.js CHANGED
@@ -69,6 +69,7 @@ __export(public_exports, {
69
69
  defaultFloatMeta: () => defaultFloatMeta,
70
70
  detectInlineSpans2: () => detectInlineSpans2,
71
71
  detectMathSpans2: () => detectMathSpans2,
72
+ diffDocument2: () => diffDocument2,
72
73
  document2HasAbstract: () => document2HasAbstract,
73
74
  document2HasMaketitle: () => document2HasMaketitle,
74
75
  document2HasTitleStack: () => document2HasTitleStack,
@@ -2149,6 +2150,14 @@ var ATOMIC_COMMANDS = {
2149
2150
  arabicLabel: "\u0646\u0640\u0640\u0640\u0640\u0640\u0647\u0627",
2150
2151
  title: "\u062D\u062F"
2151
2152
  },
2153
+ arg: {
2154
+ id: "arg",
2155
+ category: "limits_series",
2156
+ englishTex: "\\arg",
2157
+ arabicTex: "\\ararg",
2158
+ arabicLabel: "\u062D\u062C",
2159
+ title: "\u062D\u062C\u0629"
2160
+ },
2152
2161
  max: {
2153
2162
  id: "max",
2154
2163
  category: "limits_series",
@@ -7236,6 +7245,104 @@ function applyDocument2Command(json, commandInput) {
7236
7245
  return toDocumentJson2(document2);
7237
7246
  }
7238
7247
 
7248
+ // src/document2/diff.ts
7249
+ var import_diff = require("diff");
7250
+ var MAX_TOTAL_TEXT_CHARS = 16e3;
7251
+ var MAX_CHANGED_CHUNK_CHARS = 4e3;
7252
+ var MAX_CONTEXT_CHUNK_CHARS = 600;
7253
+ var TRUNCATION_MARKER = "\n\u2026\n";
7254
+ var IDENTITY_KEYS = /* @__PURE__ */ new Set(["id", "inline_ids", "caption_inline_ids", "cell_inline_ids"]);
7255
+ function comparisonValue(value, key) {
7256
+ if (key && IDENTITY_KEYS.has(key)) {
7257
+ return void 0;
7258
+ }
7259
+ if (Array.isArray(value)) {
7260
+ return value.map((entry) => comparisonValue(entry));
7261
+ }
7262
+ if (value && typeof value === "object") {
7263
+ const result = {};
7264
+ for (const childKey of Object.keys(value).sort()) {
7265
+ const child = comparisonValue(value[childKey], childKey);
7266
+ if (child !== void 0) {
7267
+ result[childKey] = child;
7268
+ }
7269
+ }
7270
+ return result;
7271
+ }
7272
+ return value;
7273
+ }
7274
+ function normalizedComparisonDocument(document2) {
7275
+ return comparisonValue(toDocumentJson2(fromDocumentJson2(document2)));
7276
+ }
7277
+ function withoutFinalNewline(value) {
7278
+ return value.endsWith("\n") ? value.slice(0, -1) : value;
7279
+ }
7280
+ function shorten(text, limit, mode) {
7281
+ if (text.length <= limit) {
7282
+ return { text, truncated: false };
7283
+ }
7284
+ if (limit <= TRUNCATION_MARKER.length) {
7285
+ return { text: text.slice(0, Math.max(0, limit)), truncated: true };
7286
+ }
7287
+ const available = limit - TRUNCATION_MARKER.length;
7288
+ if (mode === "head") {
7289
+ return { text: `${text.slice(0, available)}${TRUNCATION_MARKER}`, truncated: true };
7290
+ }
7291
+ if (mode === "tail") {
7292
+ return { text: `${TRUNCATION_MARKER}${text.slice(text.length - available)}`, truncated: true };
7293
+ }
7294
+ const head = Math.ceil(available / 2);
7295
+ const tail = available - head;
7296
+ return {
7297
+ text: `${text.slice(0, head)}${TRUNCATION_MARKER}${text.slice(text.length - tail)}`,
7298
+ truncated: true
7299
+ };
7300
+ }
7301
+ function diffDocument2(before, after) {
7302
+ const beforeComparable = normalizedComparisonDocument(before);
7303
+ const afterComparable = normalizedComparisonDocument(after);
7304
+ const parts = (0, import_diff.diffJson)(beforeComparable, afterComparable);
7305
+ const changed = parts.some((part) => part.added === true || part.removed === true);
7306
+ if (!changed) {
7307
+ return { version: 1, changed: false, truncated: false, chunks: [] };
7308
+ }
7309
+ const chunks = [];
7310
+ let truncated = false;
7311
+ let totalTextChars = 0;
7312
+ const append = (kind, rawText, limit, mode) => {
7313
+ const cleaned = withoutFinalNewline(rawText);
7314
+ if (cleaned.length === 0) return;
7315
+ const perChunk = shorten(cleaned, limit, mode);
7316
+ truncated ||= perChunk.truncated;
7317
+ const remaining = MAX_TOTAL_TEXT_CHARS - totalTextChars;
7318
+ if (remaining <= 0) {
7319
+ truncated = true;
7320
+ return;
7321
+ }
7322
+ const withinBudget = shorten(perChunk.text, remaining, mode);
7323
+ truncated ||= withinBudget.truncated;
7324
+ if (withinBudget.text.length === 0) return;
7325
+ chunks.push({ kind, text: withinBudget.text });
7326
+ totalTextChars += withinBudget.text.length;
7327
+ };
7328
+ parts.forEach((part, index) => {
7329
+ if (part.added) {
7330
+ append("added", part.value, MAX_CHANGED_CHUNK_CHARS, "both");
7331
+ return;
7332
+ }
7333
+ if (part.removed) {
7334
+ append("removed", part.value, MAX_CHANGED_CHUNK_CHARS, "both");
7335
+ return;
7336
+ }
7337
+ const previousChanged = index > 0 && (parts[index - 1]?.added === true || parts[index - 1]?.removed === true);
7338
+ const nextChanged = index + 1 < parts.length && (parts[index + 1]?.added === true || parts[index + 1]?.removed === true);
7339
+ if (!previousChanged && !nextChanged) return;
7340
+ const mode = previousChanged && nextChanged ? "both" : previousChanged ? "head" : "tail";
7341
+ append("context", part.value, MAX_CONTEXT_CHUNK_CHARS, mode);
7342
+ });
7343
+ return { version: 1, changed: true, truncated, chunks };
7344
+ }
7345
+
7239
7346
  // src/document2/outline.ts
7240
7347
  var EXCERPT_LIMIT = 160;
7241
7348
  function normalizeExcerpt(value) {
@@ -7601,6 +7708,7 @@ ${fontCommands}
7601
7708
  \newcommand{\arprod}[0]{\text{جـــذ}}
7602
7709
 
7603
7710
  \newcommand{\arlim}[0]{\text{نـــــها}}
7711
+ \newcommand{\ararg}[0]{\text{حج}}
7604
7712
  \newcommand{\armax}[0]{\text{أكبر}}
7605
7713
  \newcommand{\armin}[0]{\text{أصغر}}
7606
7714
  \newcommand{\arsup}[0]{\text{أعلى}}
@@ -8568,6 +8676,7 @@ function document2Latex2(document2, options = {}) {
8568
8676
  defaultFloatMeta,
8569
8677
  detectInlineSpans2,
8570
8678
  detectMathSpans2,
8679
+ diffDocument2,
8571
8680
  document2HasAbstract,
8572
8681
  document2HasMaketitle,
8573
8682
  document2HasTitleStack,