@stll/folio-core 0.4.0 → 0.6.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 (98) hide show
  1. package/dist/ai-edits/apply.d.ts +3 -9
  2. package/dist/ai-edits/apply.js +94 -14
  3. package/dist/ai-edits/blockRange.d.ts +33 -0
  4. package/dist/ai-edits/blockRange.js +58 -0
  5. package/dist/ai-edits/headless.d.ts +37 -4
  6. package/dist/ai-edits/headless.js +134 -16
  7. package/dist/ai-edits/index.d.ts +5 -3
  8. package/dist/ai-edits/index.js +3 -2
  9. package/dist/ai-edits/snapshot.d.ts +14 -2
  10. package/dist/ai-edits/snapshot.js +12 -1
  11. package/dist/ai-edits/types.d.ts +42 -3
  12. package/dist/compat/eigenpal.d.ts +3 -2
  13. package/dist/compat/eigenpal.js +6 -5
  14. package/dist/controller/layoutPipeline.d.ts +1 -0
  15. package/dist/controller/layoutPipeline.js +35 -137
  16. package/dist/controller/layoutScheduler.d.ts +2 -1
  17. package/dist/controller/layoutScheduler.js +6 -0
  18. package/dist/document-operations.d.ts +139 -0
  19. package/dist/document-operations.js +578 -0
  20. package/dist/docx/blockContentParser.js +17 -7
  21. package/dist/docx/encryption/agileDecryption.js +2 -1
  22. package/dist/docx/encryption/compoundFile.js +4 -2
  23. package/dist/docx/footnoteParser.d.ts +1 -17
  24. package/dist/docx/footnoteParser.js +1 -27
  25. package/dist/docx/groupDrawingParser.d.ts +8 -0
  26. package/dist/docx/groupDrawingParser.js +131 -0
  27. package/dist/docx/numberingParser.d.ts +3 -1
  28. package/dist/docx/numberingParser.js +8 -2
  29. package/dist/docx/paragraphParser.js +9 -3
  30. package/dist/docx/runParser.js +8 -1
  31. package/dist/docx/selectiveXmlPatch.js +4 -10
  32. package/dist/docx/serializer/numberingSerializer.js +3 -1
  33. package/dist/docx/settingsParser.d.ts +6 -3
  34. package/dist/docx/settingsParser.js +2 -0
  35. package/dist/docx/xmlParser.js +11 -4
  36. package/dist/i18n/messages/catalogs.gen.d.ts +1054 -34
  37. package/dist/i18n/messages/catalogs.gen.js +1122 -68
  38. package/dist/i18n/messages/messages.gen.d.ts +62 -2
  39. package/dist/index.d.ts +3 -2
  40. package/dist/index.js +6 -5
  41. package/dist/layout-bridge/convert/footnoteLayout.d.ts +37 -1
  42. package/dist/layout-bridge/convert/footnoteLayout.js +138 -14
  43. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +5 -7
  44. package/dist/layout-bridge/convert/headerFooterLayout.js +5 -7
  45. package/dist/layout-bridge/convert/toFlowBlocks.js +56 -19
  46. package/dist/layout-engine/index.d.ts +6 -5
  47. package/dist/layout-engine/index.js +143 -30
  48. package/dist/layout-engine/keep-together.d.ts +13 -8
  49. package/dist/layout-engine/keep-together.js +40 -25
  50. package/dist/layout-engine/layoutInstrumentation.d.ts +11 -1
  51. package/dist/layout-engine/layoutInstrumentation.js +10 -1
  52. package/dist/layout-engine/measure/measureBlocks.js +50 -18
  53. package/dist/layout-engine/measure/measureParagraph.js +61 -15
  54. package/dist/layout-engine/paginator.d.ts +2 -1
  55. package/dist/layout-engine/paginator.js +9 -3
  56. package/dist/layout-engine/textBoxGroup.d.ts +7 -0
  57. package/dist/layout-engine/textBoxGroup.js +8 -0
  58. package/dist/layout-engine/types.d.ts +30 -9
  59. package/dist/layout-engine/types.js +20 -2
  60. package/dist/layout-painter/renderPage.d.ts +15 -1
  61. package/dist/layout-painter/renderPage.js +27 -11
  62. package/dist/layout-painter/renderParagraph.js +18 -8
  63. package/dist/layout-painter/renderTable.js +10 -7
  64. package/dist/managers/DocumentLoaderManager.js +12 -5
  65. package/dist/model.js +1 -1
  66. package/dist/paged-layout/pageText.d.ts +14 -0
  67. package/dist/paged-layout/pageText.js +21 -0
  68. package/dist/prosemirror/attrs/index.js +2 -0
  69. package/dist/prosemirror/commands/comments.js +75 -5
  70. package/dist/prosemirror/commands/hyperlink.js +4 -2
  71. package/dist/prosemirror/commands/image.js +2 -1
  72. package/dist/prosemirror/commands/propertyChangeScope.d.ts +68 -0
  73. package/dist/prosemirror/commands/propertyChangeScope.js +242 -0
  74. package/dist/prosemirror/conversion/fromProseDoc.js +14 -3
  75. package/dist/prosemirror/conversion/toProseDoc.js +29 -8
  76. package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -0
  77. package/dist/prosemirror/extensions/features/ListExtension.js +6 -0
  78. package/dist/prosemirror/extensions/nodes/TableExtension.js +10 -11
  79. package/dist/prosemirror/findReplaceSelection.js +2 -1
  80. package/dist/prosemirror/schema/nodes.d.ts +10 -5
  81. package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
  82. package/dist/prosemirror/utils/tabCalculator.js +4 -2
  83. package/dist/redline.d.ts +20 -0
  84. package/dist/redline.js +127 -0
  85. package/dist/server.d.ts +7 -3
  86. package/dist/server.js +6 -2
  87. package/dist/symbols.d.ts +35 -0
  88. package/dist/symbols.js +512 -0
  89. package/dist/utils/clipboard.js +3 -3
  90. package/dist/utils/fontLoader.js +3 -0
  91. package/dist/utils/fontResolver.js +48 -1
  92. package/dist/utils/zoom.d.ts +21 -0
  93. package/dist/utils/zoom.js +21 -0
  94. package/dist/version-comparison.d.ts +92 -0
  95. package/dist/version-comparison.js +436 -0
  96. package/package.json +3 -3
  97. package/dist/paged-layout/headerFooterMargins.d.ts +0 -75
  98. package/dist/paged-layout/headerFooterMargins.js +0 -122
@@ -5,6 +5,8 @@ const DEFAULT_TAB_INTERVAL_TWIPS = 720;
5
5
  const TWIPS_PER_INCH = 1440;
6
6
  /** Pixels per inch (96 dpi standard for CSS) */
7
7
  const PIXELS_PER_INCH = 96;
8
+ /** Ignore sub-twip round trips when the cursor already occupies a tab stop. */
9
+ const TAB_POSITION_EPSILON_TWIPS = .01;
8
10
  /**
9
11
  * Convert twips to pixels
10
12
  * @param twips - Value in twips (1/1440 inch)
@@ -44,7 +46,7 @@ function computeTabStops(context) {
44
46
  leader: "none"
45
47
  });
46
48
  }
47
- let pos = maxExplicit > 0 ? Math.max(maxExplicit, leftIndent) : leftIndent;
49
+ let pos = Math.floor(Math.max(maxExplicit, leftIndent) / defaultTabInterval) * defaultTabInterval;
48
50
  const limitPos = leftIndent + 14400;
49
51
  while (pos < limitPos) {
50
52
  pos += defaultTabInterval;
@@ -84,7 +86,7 @@ function computeTabStops(context) {
84
86
  function calculateTabWidth(currentXPx, context, following = {}) {
85
87
  const { defaultTabInterval = 720 } = context;
86
88
  const currentXTwips = pixelsToTwips(currentXPx);
87
- const nextStop = computeTabStops(context).find((stop) => stop.pos > currentXTwips);
89
+ const nextStop = computeTabStops(context).find((stop) => stop.pos > currentXTwips + TAB_POSITION_EPSILON_TWIPS);
88
90
  if (!nextStop) {
89
91
  const defaultTabPx = twipsToPixels(defaultTabInterval);
90
92
  let tabWidth = defaultTabPx - currentXPx % defaultTabPx;
@@ -0,0 +1,20 @@
1
+ import { FolioAIEditApplyResult } from "./ai-edits/types.js";
2
+
3
+ //#region src/redline.d.ts
4
+ /** Options for {@link generateRedlineDocx}. */
5
+ type GenerateRedlineDocxOptions = {
6
+ /** Author recorded on the generated tracked changes. (default: `"folio compare"`) */author?: string;
7
+ };
8
+ /** Result of {@link generateRedlineDocx}. */
9
+ type GenerateRedlineDocxResult = FolioAIEditApplyResult & {
10
+ /** The redline `.docx`: the base document with base → revised tracked changes. */buffer: ArrayBuffer;
11
+ };
12
+ /**
13
+ * Compare `base` and `revised` and return the base document with every
14
+ * difference recorded as a tracked change. See the module doc comment for
15
+ * semantics and limitations; `skipped` reports any block the generator could
16
+ * not redline (e.g. additions with no anchor in an empty base document).
17
+ */
18
+ declare const generateRedlineDocx: (base: ArrayBuffer, revised: ArrayBuffer, options?: GenerateRedlineDocxOptions) => Promise<GenerateRedlineDocxResult>;
19
+ //#endregion
20
+ export { GenerateRedlineDocxOptions, GenerateRedlineDocxResult, generateRedlineDocx };
@@ -0,0 +1,127 @@
1
+ import { FolioDocxReviewer } from "./ai-edits/headless.js";
2
+ import { alignFolioBlocks } from "./version-comparison.js";
3
+ //#region src/redline.ts
4
+ /**
5
+ * Redline generator: compare two `.docx` buffers and produce a THIRD `.docx`
6
+ * whose differences are recorded as real Word tracked changes (`w:ins` /
7
+ * `w:del`), ready for review in Word or the folio editor — the
8
+ * document-producing counterpart to {@link compareDocxVersions}'s structured
9
+ * diff.
10
+ *
11
+ * The pipeline is a composition of existing machinery, not a new engine:
12
+ * the base buffer is opened in a headless {@link FolioDocxReviewer}, the two
13
+ * snapshots are aligned with {@link alignFolioBlocks} (the same three-pass
14
+ * alignment the comparer uses), each alignment event maps onto a
15
+ * tracked-changes {@link FolioAIEditOperation}, and the reviewer's shared
16
+ * apply path records them as redlines. Word-level minimality comes free:
17
+ * the apply engine word-diffs a `replaceBlock` and only marks the divergent
18
+ * tokens.
19
+ *
20
+ * ## Semantics and limitations
21
+ *
22
+ * - **As-accepted inputs.** Pending tracked changes in either input count as
23
+ * applied before comparison (mirroring {@link compareDocxVersions}): the
24
+ * base's own pending redlines are accepted in the output, so the tracked
25
+ * changes it carries are exactly base → revised. This is intentionally
26
+ * lossy about the inputs' own revision history and authorship.
27
+ * - **Text redlines only.** Format-only changes and relocated blocks are
28
+ * redlined as plain edits (a move becomes a delete + insert, like Word
29
+ * compare with move detection off); block-level formatting is carried via
30
+ * the revised block's `styleId` on inserted blocks.
31
+ * - **Anchoring.** Insertions anchor `before` the next surviving base block
32
+ * so consecutive additions keep their order; additions past the last base
33
+ * block anchor `after` it. A base document with no content blocks offers
34
+ * no anchor at all — such additions surface in `skipped` rather than
35
+ * silently vanishing.
36
+ */
37
+ /**
38
+ * For each event index, the base block id the next `revisedOnly` event
39
+ * should anchor before: the base side of the nearest later `pair` or
40
+ * `baseOnly` event, or `null` when only additions remain until the end of
41
+ * the document. One backward pass, so a long run of trailing additions
42
+ * (huge revised document vs. a small base) stays linear instead of
43
+ * re-scanning the tail per added block.
44
+ */
45
+ const nextBaseBlockIdByIndex = (events) => {
46
+ const nextIds = Array.from({ length: events.length });
47
+ let nextId = null;
48
+ for (let i = events.length - 1; i >= 0; i--) {
49
+ nextIds[i] = nextId;
50
+ const event = events[i];
51
+ if (event?.type === "pair") nextId = event.baseBlock.id;
52
+ else if (event?.type === "baseOnly") nextId = event.block.id;
53
+ }
54
+ return nextIds;
55
+ };
56
+ /**
57
+ * Compare `base` and `revised` and return the base document with every
58
+ * difference recorded as a tracked change. See the module doc comment for
59
+ * semantics and limitations; `skipped` reports any block the generator could
60
+ * not redline (e.g. additions with no anchor in an empty base document).
61
+ */
62
+ const generateRedlineDocx = async (base, revised, options = {}) => {
63
+ const [baseReviewer, revisedReviewer] = await Promise.all([FolioDocxReviewer.fromBuffer(base, { author: options.author ?? "folio compare" }), FolioDocxReviewer.fromBuffer(revised)]);
64
+ baseReviewer.acceptAll();
65
+ const baseSnapshot = baseReviewer.snapshot();
66
+ const revisedBlocks = revisedReviewer.snapshot().blocks;
67
+ const events = alignFolioBlocks(baseSnapshot.blocks, revisedBlocks);
68
+ const anchorIds = nextBaseBlockIdByIndex(events);
69
+ const operations = [];
70
+ let operationSeq = 0;
71
+ const nextOperationId = () => `redline-${++operationSeq}`;
72
+ /** Additions past the last base block, inserted after it in reverse so the final order matches the revised document. */
73
+ const trailingAdditions = [];
74
+ const lastBaseBlockId = baseSnapshot.blocks.at(-1)?.id ?? null;
75
+ events.forEach((event, eventIndex) => {
76
+ if (event.type === "pair") {
77
+ if (event.baseBlock.text !== event.revisedBlock.text) operations.push({
78
+ id: nextOperationId(),
79
+ type: "replaceBlock",
80
+ blockId: event.baseBlock.id,
81
+ text: event.revisedBlock.text
82
+ });
83
+ return;
84
+ }
85
+ if (event.type === "baseOnly") {
86
+ operations.push({
87
+ id: nextOperationId(),
88
+ type: "deleteBlock",
89
+ blockId: event.block.id
90
+ });
91
+ return;
92
+ }
93
+ const anchorId = anchorIds[eventIndex] ?? null;
94
+ if (anchorId === null) {
95
+ trailingAdditions.push({
96
+ text: event.block.text,
97
+ ...event.block.styleId !== void 0 && { styleId: event.block.styleId }
98
+ });
99
+ return;
100
+ }
101
+ operations.push({
102
+ id: nextOperationId(),
103
+ type: "insertBeforeBlock",
104
+ blockId: anchorId,
105
+ text: event.block.text,
106
+ ...event.block.styleId !== void 0 && { styleId: event.block.styleId }
107
+ });
108
+ });
109
+ for (const addition of trailingAdditions.toReversed()) operations.push({
110
+ id: nextOperationId(),
111
+ type: "insertAfterBlock",
112
+ blockId: lastBaseBlockId ?? "redline-unanchored",
113
+ text: addition.text,
114
+ ...addition.styleId !== void 0 && { styleId: addition.styleId }
115
+ });
116
+ const { applied, skipped } = baseReviewer.applyOperations(operations, {
117
+ mode: "tracked-changes",
118
+ snapshot: baseSnapshot
119
+ });
120
+ return {
121
+ buffer: await baseReviewer.toBuffer(),
122
+ applied,
123
+ skipped
124
+ };
125
+ };
126
+ //#endregion
127
+ export { generateRedlineDocx };
package/dist/server.d.ts CHANGED
@@ -1,8 +1,12 @@
1
- import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIComment, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditSnapshot } from "./ai-edits/types.js";
1
+ import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIComment, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditPrecondition, FolioAIEditSnapshot, FolioAIInlineFormatting, FolioAITextRangeHandle } from "./ai-edits/types.js";
2
+ import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationStatus, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
2
3
  import { FolioReviewChange, FolioReviewChangeKind } from "./ai-edits/read.js";
3
- import { ApplyFolioAIEditsToBufferOptions, ApplyFolioAIEditsToBufferResult, FolioApplyOperationsOptions, FolioDocxReviewer, FolioDocxReviewerOptions, FolioReviewChangeFilter, FolioReviewComment, FolioReviewCommentFilter, FolioReviewCommentReply, FolioReviewReplyInput, applyFolioAIEditsToBuffer } from "./ai-edits/headless.js";
4
+ import { ApplyFolioAIEditsToBufferOptions, ApplyFolioAIEditsToBufferResult, FolioApplyDocumentOperationsOptions, FolioApplyOperationsOptions, FolioDocumentStory, FolioDocumentStoryHandle, FolioDocxReviewer, FolioDocxReviewerOptions, FolioReviewChangeFilter, FolioReviewComment, FolioReviewCommentFilter, FolioReviewCommentReply, FolioReviewReplyInput, applyFolioAIEditsToBuffer } from "./ai-edits/headless.js";
5
+ import { createFolioAITextRangeHandle } from "./ai-edits/snapshot.js";
4
6
  import { DeriveBlockIdInput, FolioBlockId, deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
5
7
  import { CreateEmptyDocumentOptions, createEmptyDocument } from "./utils/createDocument.js";
6
8
  import { createDocx } from "./docx/rezip.js";
7
9
  import { CreateCommentReplyInput, replyToComment } from "./docx/replyToComment.js";
8
- export { type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, type DeriveBlockIdInput, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditSnapshot, type FolioApplyOperationsOptions, type FolioBlockId, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, applyFolioAIEditsToBuffer, createDocx, createEmptyDocument, deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId, replyToComment };
10
+ import { GenerateRedlineDocxOptions, GenerateRedlineDocxResult, generateRedlineDocx } from "./redline.js";
11
+ import { FolioBlockDiff, FolioFormatProperty, FolioVersionDiff, FolioVersionDiffSegment, compareDocxVersions } from "./version-comparison.js";
12
+ export { type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, type DeriveBlockIdInput, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineFormatting, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioFormatProperty, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioVersionDiff, type FolioVersionDiffSegment, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioAIEditsToBuffer, assertSupportedFolioDocumentOperationVersion, compareDocxVersions, createDocx, createEmptyDocument, createFolioAITextRangeHandle, deriveBlockId, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch, replyToComment };
package/dist/server.js CHANGED
@@ -1,6 +1,10 @@
1
+ import { deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
2
+ import { createFolioAITextRangeHandle } from "./ai-edits/snapshot.js";
3
+ import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
1
4
  import { createEmptyDocument } from "./utils/createDocument.js";
2
5
  import { createDocx } from "./docx/rezip.js";
3
- import { deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
4
6
  import { replyToComment } from "./docx/replyToComment.js";
5
7
  import { FolioDocxReviewer, applyFolioAIEditsToBuffer } from "./ai-edits/headless.js";
6
- export { FolioDocxReviewer, applyFolioAIEditsToBuffer, createDocx, createEmptyDocument, deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId, replyToComment };
8
+ import { compareDocxVersions } from "./version-comparison.js";
9
+ import { generateRedlineDocx } from "./redline.js";
10
+ export { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocxReviewer, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioAIEditsToBuffer, assertSupportedFolioDocumentOperationVersion, compareDocxVersions, createDocx, createEmptyDocument, createFolioAITextRangeHandle, deriveBlockId, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch, replyToComment };
@@ -0,0 +1,35 @@
1
+ //#region src/symbols.d.ts
2
+ /**
3
+ * Symbol catalog for the "Insert Symbol" dialog.
4
+ *
5
+ * Framework-neutral data + filtering shared by every folio adapter (React,
6
+ * Vue, ...), so the two never drift on which symbols they offer. Category
7
+ * display names are i18n keys (`dialogs.insertSymbol.categories.*`) resolved by
8
+ * each adapter's own translator; the `char`/`name` pairs are the raw catalog.
9
+ */
10
+ type SymbolEntry = {
11
+ /** The character to insert. */char: string; /** English descriptive name, used for search matching. */
12
+ name: string;
13
+ };
14
+ /** i18n message keys for the symbol-category display labels. */
15
+ type SymbolCategoryNameKey = "dialogs.insertSymbol.categories.common" | "dialogs.insertSymbol.categories.arrows" | "dialogs.insertSymbol.categories.math" | "dialogs.insertSymbol.categories.greek" | "dialogs.insertSymbol.categories.currency" | "dialogs.insertSymbol.categories.shapes";
16
+ type SymbolCategory = {
17
+ /** Stable category id (also the default active tab). */name: string; /** i18n key for the category's display label. */
18
+ nameKey: SymbolCategoryNameKey;
19
+ symbols: SymbolEntry[];
20
+ };
21
+ /** A catalog entry tagged with the category it belongs to (search results). */
22
+ type SymbolSearchEntry = SymbolEntry & {
23
+ category: string;
24
+ };
25
+ declare const SYMBOL_CATEGORIES: SymbolCategory[];
26
+ /** Every catalog symbol, flattened and tagged with its category. */
27
+ declare const ALL_SYMBOLS: SymbolSearchEntry[];
28
+ /**
29
+ * Symbols whose descriptive name contains `query` (case-insensitive), or whose
30
+ * character is exactly `query`. An empty/whitespace query returns `[]` so
31
+ * callers fall back to the active category.
32
+ */
33
+ declare function filterSymbols(query: string): SymbolSearchEntry[];
34
+ //#endregion
35
+ export { ALL_SYMBOLS, SYMBOL_CATEGORIES, SymbolCategory, SymbolCategoryNameKey, SymbolEntry, SymbolSearchEntry, filterSymbols };