@stll/folio-core 0.72.0 → 0.74.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 (244) hide show
  1. package/README.md +12 -6
  2. package/dist/ai-edits/applyTypes.d.ts +85 -0
  3. package/dist/ai-edits/applyTypes.js +24 -0
  4. package/dist/ai-edits/clean-text.d.ts +7 -1
  5. package/dist/ai-edits/clean-text.js +23 -2
  6. package/dist/ai-edits/finalSectionReview.d.ts +1 -1
  7. package/dist/ai-edits/headless.d.ts +29 -147
  8. package/dist/ai-edits/headless.js +215 -1639
  9. package/dist/ai-edits/index.d.ts +3 -3
  10. package/dist/ai-edits/index.js +2 -3
  11. package/dist/ai-edits/pending-suggestions.d.ts +14 -4
  12. package/dist/ai-edits/pending-suggestions.js +183 -90
  13. package/dist/ai-edits/pendingJoin.js +6 -1
  14. package/dist/ai-edits/retired-comment-receipts.d.ts +1 -1
  15. package/dist/ai-edits/snapshot.js +9 -4
  16. package/dist/ai-edits/table-cell-mutations.d.ts +1 -1
  17. package/dist/ai-edits/table-cell-mutations.js +2 -2
  18. package/dist/ai-edits/table-geometry.d.ts +1 -1
  19. package/dist/ai-edits/table-geometry.js +1 -1
  20. package/dist/ai-edits/table-row-column-mutations.d.ts +1 -1
  21. package/dist/ai-edits/table-row-column-mutations.js +1 -1
  22. package/dist/ai-edits/tableNodes.d.ts +38 -0
  23. package/dist/ai-edits/tableNodes.js +86 -0
  24. package/dist/ai-edits/tracked-batch-fidelity.d.ts +1 -1
  25. package/dist/ai-edits/tracked-batch-fidelity.js +1 -1
  26. package/dist/ai-edits/undefinedReferences.d.ts +7 -0
  27. package/dist/canonical/batchCommentReferences.js +1 -0
  28. package/dist/canonical/canonicalInlineGaps.d.ts +56 -0
  29. package/dist/canonical/canonicalInlineGaps.js +118 -0
  30. package/dist/canonical/canonicalInlineProjection.d.ts +4 -13
  31. package/dist/canonical/canonicalInlineProjection.js +5 -27
  32. package/dist/canonical/canonicalProjectionBlocks.d.ts +4 -4
  33. package/dist/canonical/canonicalPublicOperations.js +282 -75
  34. package/dist/canonical/canonicalSelection.js +1 -1
  35. package/dist/canonical/canonicalSession.d.ts +9 -1
  36. package/dist/canonical/canonicalSession.js +106 -33
  37. package/dist/compare/compare.d.ts +1 -1
  38. package/dist/compare/inline-atoms-model.d.ts +1 -1
  39. package/dist/compare/inline-atoms.d.ts +2 -2
  40. package/dist/compare/inline-provenance-model.d.ts +1 -1
  41. package/dist/compare/inline-provenance.d.ts +2 -2
  42. package/dist/compat/eigenpal.d.ts +3 -3
  43. package/dist/compat/eigenpal.js +2 -3
  44. package/dist/controller/autocompleteSuggestion.js +1 -1
  45. package/dist/controller/canonicalClipboard.d.ts +13 -3
  46. package/dist/controller/canonicalClipboard.js +186 -50
  47. package/dist/controller/canonicalClipboardResources.d.ts +9 -1
  48. package/dist/controller/canonicalClipboardResources.js +22 -2
  49. package/dist/controller/canonicalComposition.js +1 -1
  50. package/dist/controller/canonicalInput.js +1 -1
  51. package/dist/controller/canonicalPresence.js +1 -1
  52. package/dist/controller/canonicalReview.d.ts +1 -1
  53. package/dist/controller/canonicalReview.js +1 -1
  54. package/dist/controller/canonicalRoomAuthority.js +1 -1
  55. package/dist/controller/canonicalRoomWire.js +1 -1
  56. package/dist/controller/canonicalStructure.js +1 -1
  57. package/dist/controller/canonicalTabRoom.js +1 -1
  58. package/dist/controller/canonicalWatermark.d.ts +10 -0
  59. package/dist/controller/canonicalWatermark.js +37 -0
  60. package/dist/controller/canonicalYjsRoom.js +1 -1
  61. package/dist/controller/hiddenEditorApi.d.ts +1 -1
  62. package/dist/controller/hiddenEditorApi.js +2 -17
  63. package/dist/controller/hiddenEditorManager.d.ts +4 -3
  64. package/dist/controller/hiddenEditorManager.js +79 -23
  65. package/dist/document-operations.d.ts +1 -14
  66. package/dist/document-operations.js +1 -278
  67. package/dist/docx/canonicalSave.d.ts +1 -1
  68. package/dist/docx/canonicalSave.js +1 -1
  69. package/dist/docx/canonicalSessionInput.js +1 -1
  70. package/dist/docx/containerChildren.js +1 -1
  71. package/dist/docx/createDocx.d.ts +4 -0
  72. package/dist/docx/createDocx.js +6 -0
  73. package/dist/docx/paragraphParser.js +2 -2
  74. package/dist/docx/paragraphPropertySource.d.ts +1 -1
  75. package/dist/docx/parser.js +1 -1
  76. package/dist/docx/reviewResolutionProvenance.d.ts +3 -2
  77. package/dist/docx/reviewResolutionProvenance.js +31 -8
  78. package/dist/docx/revisionIdNormalization.js +30 -7
  79. package/dist/docx/rezip.d.ts +1 -1
  80. package/dist/docx/rezip.js +1 -1
  81. package/dist/docx/serializer/tableSerializer.js +4 -36
  82. package/dist/docx/server/templatePlan/apply.d.ts +15 -0
  83. package/dist/docx/server/templatePlan/apply.js +658 -0
  84. package/dist/docx/server/templatePlan/blocks.d.ts +97 -0
  85. package/dist/docx/server/templatePlan/blocks.js +355 -0
  86. package/dist/docx/server/templatePlan/builders.d.ts +72 -0
  87. package/dist/docx/server/templatePlan/builders.js +237 -0
  88. package/dist/docx/server/templatePlan/emit.d.ts +118 -0
  89. package/dist/docx/server/templatePlan/emit.js +466 -0
  90. package/dist/docx/server/templatePlan/emphasis.d.ts +62 -0
  91. package/dist/docx/server/templatePlan/emphasis.js +173 -0
  92. package/dist/docx/server/templatePlan/inspect.d.ts +22 -0
  93. package/dist/docx/server/templatePlan/inspect.js +230 -0
  94. package/dist/docx/server/templatePlan/labels.d.ts +45 -0
  95. package/dist/docx/server/templatePlan/labels.js +155 -0
  96. package/dist/docx/server/templatePlan/package.d.ts +34 -0
  97. package/dist/docx/server/templatePlan/package.js +99 -0
  98. package/dist/docx/server/templatePlan/plan.d.ts +145 -0
  99. package/dist/docx/server/templatePlan/plan.js +875 -0
  100. package/dist/docx/server/templatePlan/planShape.d.ts +9 -0
  101. package/dist/docx/server/templatePlan/planShape.js +180 -0
  102. package/dist/docx/server/templatePlan/resources.d.ts +41 -0
  103. package/dist/docx/server/templatePlan/resources.js +136 -0
  104. package/dist/docx/server/templatePlan/story.d.ts +128 -0
  105. package/dist/docx/server/templatePlan/story.js +440 -0
  106. package/dist/docx/server/templatePlan/types.d.ts +442 -0
  107. package/dist/docx/server/templatePlan/types.js +29 -0
  108. package/dist/docx/server/templatePlan/verify.d.ts +40 -0
  109. package/dist/docx/server/templatePlan/verify.js +976 -0
  110. package/dist/docx/server/templatePlan/xml.d.ts +74 -0
  111. package/dist/docx/server/templatePlan/xml.js +125 -0
  112. package/dist/docx/settingsHeaderFooterUpdate.d.ts +9 -0
  113. package/dist/docx/settingsHeaderFooterUpdate.js +45 -10
  114. package/dist/docx/structuralXmlPatch.js +9 -1
  115. package/dist/docx/tableGridXml.d.ts +30 -0
  116. package/dist/docx/tableGridXml.js +54 -0
  117. package/dist/docx/tableParser.js +7 -0
  118. package/dist/i18n/loadMessages.d.ts +5 -0
  119. package/dist/i18n/loadMessages.js +46 -0
  120. package/dist/i18n/locales.d.ts +3 -0
  121. package/dist/i18n/locales.js +17 -0
  122. package/dist/i18n/messages.d.ts +3 -2
  123. package/dist/i18n/messages.js +4 -16
  124. package/dist/index.d.ts +3 -3
  125. package/dist/index.js +2 -3
  126. package/dist/internal/clipboardTransformPlugin.d.ts +3 -0
  127. package/dist/internal/clipboardTransformPlugin.js +13 -0
  128. package/dist/internal/extensionRuntime.d.ts +7 -0
  129. package/dist/internal/extensionRuntime.js +28 -0
  130. package/dist/internal/starterKitExtensions.d.ts +20 -0
  131. package/dist/internal/starterKitExtensions.js +123 -0
  132. package/dist/internal/wholeStoryRevisionResolution.js +1 -1
  133. package/dist/managers/ContextMenuManager.js +2 -1
  134. package/dist/managers/editorShortcuts.d.ts +1 -1
  135. package/dist/prosemirror/anchoredTextBoxes.d.ts +1 -1
  136. package/dist/prosemirror/attrs/index.js +1 -1
  137. package/dist/prosemirror/canonicalCommands.d.ts +1 -1
  138. package/dist/prosemirror/canonicalSelectionRange.d.ts +1 -1
  139. package/dist/prosemirror/canonicalSelectionRange.js +1 -1
  140. package/dist/prosemirror/canonicalTableCommands.js +3 -3
  141. package/dist/prosemirror/commands/comments.js +4 -4
  142. package/dist/prosemirror/commands/contentControls.d.ts +1 -1
  143. package/dist/prosemirror/commands/contentControls.js +1 -1
  144. package/dist/prosemirror/commands/formatPainter.d.ts +1 -1
  145. package/dist/prosemirror/commands/formatting.d.ts +1 -1
  146. package/dist/prosemirror/commands/pastePlainText.d.ts +1 -1
  147. package/dist/prosemirror/commands/pastePlainText.js +2 -3
  148. package/dist/prosemirror/commands/replaceRangeText.js +1 -1
  149. package/dist/prosemirror/commands/sectionBreak.js +1 -1
  150. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -1
  151. package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +1 -1
  152. package/dist/prosemirror/commentRecords.d.ts +1 -1
  153. package/dist/prosemirror/commentRecords.js +2 -2
  154. package/dist/prosemirror/contentControlRevisions.d.ts +1 -1
  155. package/dist/prosemirror/conversion/fromProseDoc.d.ts +0 -5
  156. package/dist/prosemirror/conversion/fromProseDoc.js +2 -9
  157. package/dist/prosemirror/conversion/index.d.ts +2 -2
  158. package/dist/prosemirror/conversion/index.js +2 -2
  159. package/dist/prosemirror/documentStructureCounts.d.ts +24 -0
  160. package/dist/prosemirror/documentStructureCounts.js +76 -0
  161. package/dist/prosemirror/extensions/ExtensionManager.d.ts +1 -1
  162. package/dist/prosemirror/extensions/ExtensionManager.js +4 -22
  163. package/dist/prosemirror/extensions/StarterKit.d.ts +4 -27
  164. package/dist/prosemirror/extensions/StarterKit.js +29 -115
  165. package/dist/prosemirror/extensions/core/ParagraphExtension.js +1 -1
  166. package/dist/prosemirror/extensions/core/historyCommands.d.ts +16 -0
  167. package/dist/prosemirror/extensions/core/historyCommands.js +19 -0
  168. package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +1 -1
  169. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
  170. package/dist/prosemirror/extensions/features/ListExtension.js +7 -2
  171. package/dist/prosemirror/extensions/features/pastedCellSections.d.ts +1 -1
  172. package/dist/prosemirror/extensions/index.d.ts +2 -1
  173. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +8 -3
  174. package/dist/prosemirror/extensions/marks/markUtils.d.ts +1 -1
  175. package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
  176. package/dist/prosemirror/extensions/nodes/TableExtension.js +8 -41
  177. package/dist/prosemirror/extensions/types.d.ts +1 -1
  178. package/dist/prosemirror/findReplaceSelection.d.ts +1 -1
  179. package/dist/prosemirror/hyperlinkRemoval.d.ts +1 -1
  180. package/dist/prosemirror/hyperlinkRemoval.js +7 -2
  181. package/dist/prosemirror/index.d.ts +3 -3
  182. package/dist/prosemirror/index.js +3 -3
  183. package/dist/prosemirror/insertionGaps.d.ts +1 -1
  184. package/dist/prosemirror/keptRangeBoundaries.d.ts +1 -1
  185. package/dist/prosemirror/keptRangeBoundaries.js +1 -1
  186. package/dist/prosemirror/listNumbering.d.ts +1 -1
  187. package/dist/prosemirror/listNumbering.js +1 -1
  188. package/dist/prosemirror/lockedControls.d.ts +1 -1
  189. package/dist/prosemirror/markupViewProjection.d.ts +1 -1
  190. package/dist/prosemirror/noteReferenceOccurrences.d.ts +1 -1
  191. package/dist/prosemirror/noteReferenceOccurrences.js +1 -1
  192. package/dist/prosemirror/noteReferenceReview.d.ts +2 -56
  193. package/dist/prosemirror/noteReferenceReview.js +2 -243
  194. package/dist/prosemirror/{extensions/features/ParaIdAllocatorExtension.d.ts → paraIds.d.ts} +13 -23
  195. package/dist/prosemirror/paraIds.js +152 -0
  196. package/dist/prosemirror/paragraphChangeTrackerMeta.d.ts +97 -0
  197. package/dist/prosemirror/paragraphChangeTrackerMeta.js +87 -0
  198. package/dist/prosemirror/paragraphMarkJoin.d.ts +1 -1
  199. package/dist/prosemirror/paragraphPropertyCarry.d.ts +1 -1
  200. package/dist/prosemirror/pastedCommentCopies.d.ts +1 -1
  201. package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +1 -1
  202. package/dist/prosemirror/plugins/documentNumbering.d.ts +1 -1
  203. package/dist/prosemirror/plugins/documentNumbering.js +1 -1
  204. package/dist/prosemirror/plugins/documentStyles.js +1 -1
  205. package/dist/prosemirror/plugins/templateDirectives.d.ts +1 -1
  206. package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -1
  207. package/dist/prosemirror/rebaseParagraphRuns.d.ts +1 -1
  208. package/dist/prosemirror/rejoinRunCarriers.d.ts +1 -1
  209. package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
  210. package/dist/prosemirror/replacedAnnotations.js +17 -2
  211. package/dist/prosemirror/revisionCarriers.d.ts +1 -1
  212. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +1 -1
  213. package/dist/prosemirror/sectionMarkEdits.d.ts +1 -1
  214. package/dist/prosemirror/selectionBounds.d.ts +10 -0
  215. package/dist/prosemirror/selectionBounds.js +22 -0
  216. package/dist/prosemirror/storyListNumbering.d.ts +1 -1
  217. package/dist/prosemirror/suggestionCommands.d.ts +47 -0
  218. package/dist/prosemirror/suggestionCommands.js +31 -0
  219. package/dist/prosemirror/tableCellPaste.d.ts +1 -1
  220. package/dist/prosemirror/tableCellPaste.js +1 -1
  221. package/dist/prosemirror/tableGridMutation.d.ts +1 -1
  222. package/dist/prosemirror/tableRunIn.js +1 -1
  223. package/dist/prosemirror/textInput.d.ts +1 -1
  224. package/dist/prosemirror/textInput.js +1 -1
  225. package/dist/server.d.ts +7 -2
  226. package/dist/server.js +6 -1
  227. package/dist/types/canonicalCapabilities.d.ts +13 -92
  228. package/dist/types/canonicalCapabilities.js +11 -85
  229. package/package.json +4 -4
  230. package/dist/ai-edits/apply.d.ts +0 -202
  231. package/dist/ai-edits/apply.js +0 -6759
  232. package/dist/ai-edits/note-story-inventory.d.ts +0 -5
  233. package/dist/ai-edits/note-story-inventory.js +0 -10
  234. package/dist/ai-edits/revisionStretches.d.ts +0 -32
  235. package/dist/ai-edits/revisionStretches.js +0 -147
  236. package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -18
  237. package/dist/prosemirror/extensions/core/HistoryExtension.js +0 -122
  238. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +0 -408
  239. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +0 -135
  240. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +0 -566
  241. package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -92
  242. package/dist/prosemirror/plugins/suggestionMode.js +0 -1515
  243. package/dist/prosemirror/tablePositionedBookmarks.d.ts +0 -8
  244. package/dist/prosemirror/tablePositionedBookmarks.js +0 -80
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Raw OOXML helpers shared by the template plan modules: element tests by
3
+ * namespace and local name, source-range splicing, and the prefixes a part
4
+ * binds, so generated markup uses the spelling the part already declares.
5
+ */
6
+ import { XmlSplice, spliceXml } from "../../selectiveXmlPatch.js";
7
+ import { XmlElement } from "../../xmlParser.js";
8
+ import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
9
+ export declare const MARKUP_COMPATIBILITY_NAMESPACE: string;
10
+ export declare const MATH_NAMESPACE: string;
11
+ /** Whether `element` is the WordprocessingML element `localName`. */
12
+ export declare const isW: (element: XmlElement, localName: string) => boolean;
13
+ /** The WordprocessingML local name of `element`, or null for anything else. */
14
+ export declare const wName: (element: XmlElement) => string | null;
15
+ export declare const elementChildren: (element: XmlElement | null | undefined) => XmlElement[];
16
+ export declare const wChild: (element: XmlElement | null | undefined, localName: string) => XmlElement | null;
17
+ export declare const wChildren: (element: XmlElement | null | undefined, localName: string) => XmlElement[];
18
+ /** A WordprocessingML attribute, whatever prefix the part spells it with. */
19
+ export declare const wAttr: (element: XmlElement | null | undefined, localName: string) => string | null;
20
+ /** `w:val` of the child `localName`, or null when the child is absent. */
21
+ export declare const wChildVal: (element: XmlElement | null | undefined, localName: string) => string | null;
22
+ export declare const integerOrNull: (value: string | null) => number | null;
23
+ /**
24
+ * A length attribute in twentieths of a point: a plain number, or a
25
+ * universal measure (`1in`, `2.54cm`), which the schema allows in its place.
26
+ */
27
+ export declare const twipsOrNull: (value: string | null) => number | null;
28
+ /** The largest of `values`, or `floor` when none is larger. */
29
+ export declare const maxOf: (values: Iterable<number>, floor: number) => number;
30
+ /** A relationship attribute (`r:id`, `r:embed`, ...) by local name. */
31
+ export declare const relationshipAttr: (element: XmlElement, localName: string) => string | null;
32
+ export type XmlRange = {
33
+ start: number;
34
+ end: number;
35
+ };
36
+ /**
37
+ * The slice `[start, end)` of `xml` with the splices that lie inside it
38
+ * applied; null when the owner of part splices refuses the result.
39
+ */
40
+ export declare const sliceWithSplices: (xml: string, { start, end }: XmlRange, splices: readonly XmlSplice[]) => string | null;
41
+ export type RawPart = {
42
+ path: string;
43
+ xml: string;
44
+ /** The root element, parsed with source ranges. */
45
+ root: XmlElement;
46
+ };
47
+ /** Parse a part keeping every element's source range, or null when it is not XML. */
48
+ export declare const readRawPart: (path: string, xml: string) => RawPart | null;
49
+ export declare const rangeOf: (element: XmlElement) => XmlRange | null;
50
+ /**
51
+ * Where the content of `element` sits in its source: after the opening tag
52
+ * and before the closing one. Null for an element written self-closed.
53
+ */
54
+ export declare const innerRangeOf: (xml: string, element: XmlElement) => XmlRange | null;
55
+ /** The prefix `root` binds to one of `uris`, or null when it binds none. */
56
+ export declare const prefixFor: (root: XmlElement, uris: ReadonlySet<string>) => {
57
+ prefix: string;
58
+ uri: string;
59
+ } | null;
60
+ /** The prefixes generated markup uses inside one part. */
61
+ export type PartPrefixes = {
62
+ /** WordprocessingML prefix, e.g. `w`. */
63
+ w: string;
64
+ /** WordprocessingML namespace URI of the part. */
65
+ wUri: string;
66
+ /** Relationship attribute prefix and the declaration it needs, when the root has none. */
67
+ r: string;
68
+ rDeclaration: string;
69
+ };
70
+ /** Null when the part's root binds no prefix to WordprocessingML. */
71
+ export declare const partPrefixes: (root: XmlElement) => PartPrefixes | null;
72
+ /** Visit every element under `root` in document order, `root` included. */
73
+ export declare const walkElements: (root: XmlElement, visit: (element: XmlElement) => void) => void;
74
+ export { type XmlSplice, escapeXmlAttribute, escapeXmlText, spliceXml };
@@ -0,0 +1,125 @@
1
+ import { spliceXml } from "../../selectiveXmlPatch.js";
2
+ import { universalMeasureAs } from "../../universalMeasure.js";
3
+ import { NAMESPACES, OFFICE_RELATIONSHIP_NAMESPACE_URIS, WORDPROCESSINGML_NAMESPACE_URIS, getAttributeByNamespaceUri, getLocalName } from "../../xmlParser.js";
4
+ import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
5
+ import { getXmlSourceRange, parseStreamingXmlWithSourceRanges } from "@stll/docx-core/xml";
6
+ // src/docx/server/templatePlan/xml.ts
7
+ /**
8
+ * Raw OOXML helpers shared by the template plan modules: element tests by
9
+ * namespace and local name, source-range splicing, and the prefixes a part
10
+ * binds, so generated markup uses the spelling the part already declares.
11
+ */
12
+ const MARKUP_COMPATIBILITY_NAMESPACE = NAMESPACES.mc;
13
+ const MATH_NAMESPACE = NAMESPACES.m;
14
+ /** Whether `element` is the WordprocessingML element `localName`. */
15
+ const isW = (element, localName) => element.type === "element" && getLocalName(element.name) === localName && WORDPROCESSINGML_NAMESPACE_URIS.has(element.namespaceUri ?? "");
16
+ /** The WordprocessingML local name of `element`, or null for anything else. */
17
+ const wName = (element) => element.type === "element" && WORDPROCESSINGML_NAMESPACE_URIS.has(element.namespaceUri ?? "") ? getLocalName(element.name) : null;
18
+ const elementChildren = (element) => (element?.elements ?? []).filter((child) => child.type === "element");
19
+ const wChild = (element, localName) => elementChildren(element).find((child) => isW(child, localName)) ?? null;
20
+ const wChildren = (element, localName) => elementChildren(element).filter((child) => isW(child, localName));
21
+ /** A WordprocessingML attribute, whatever prefix the part spells it with. */
22
+ const wAttr = (element, localName) => getAttributeByNamespaceUri(element, WORDPROCESSINGML_NAMESPACE_URIS, localName);
23
+ /** `w:val` of the child `localName`, or null when the child is absent. */
24
+ const wChildVal = (element, localName) => wAttr(wChild(element, localName), "val");
25
+ const integerOrNull = (value) => {
26
+ if (value === null || !/^-?\d+$/u.test(value.trim())) return null;
27
+ const parsed = Number.parseInt(value, 10);
28
+ return Number.isSafeInteger(parsed) ? parsed : null;
29
+ };
30
+ /**
31
+ * A length attribute in twentieths of a point: a plain number, or a
32
+ * universal measure (`1in`, `2.54cm`), which the schema allows in its place.
33
+ */
34
+ const twipsOrNull = (value) => integerOrNull(value) ?? (value === null ? null : universalMeasureAs(value.trim(), "twips") ?? null);
35
+ /** The largest of `values`, or `floor` when none is larger. */
36
+ const maxOf = (values, floor) => {
37
+ let max = floor;
38
+ for (const value of values) if (value > max) max = value;
39
+ return max;
40
+ };
41
+ /** A relationship attribute (`r:id`, `r:embed`, ...) by local name. */
42
+ const relationshipAttr = (element, localName) => getAttributeByNamespaceUri(element, OFFICE_RELATIONSHIP_NAMESPACE_URIS, localName);
43
+ /**
44
+ * The slice `[start, end)` of `xml` with the splices that lie inside it
45
+ * applied; null when the owner of part splices refuses the result.
46
+ */
47
+ const sliceWithSplices = (xml, { start, end }, splices) => spliceXml(xml.slice(start, end), splices.filter((splice) => splice.start >= start && splice.end <= end).map((splice) => ({
48
+ start: splice.start - start,
49
+ end: splice.end - start,
50
+ newXml: splice.newXml
51
+ })));
52
+ /** Parse a part keeping every element's source range, or null when it is not XML. */
53
+ const readRawPart = (path, xml) => {
54
+ const parsed = parseStreamingXmlWithSourceRanges(xml);
55
+ if (parsed.status !== "parsed") return null;
56
+ const root = elementChildren(parsed.value).at(0);
57
+ return root === void 0 ? null : {
58
+ path,
59
+ xml,
60
+ root
61
+ };
62
+ };
63
+ const rangeOf = (element) => getXmlSourceRange(element) ?? null;
64
+ /**
65
+ * Where the content of `element` sits in its source: after the opening tag
66
+ * and before the closing one. Null for an element written self-closed.
67
+ */
68
+ const innerRangeOf = (xml, element) => {
69
+ const range = rangeOf(element);
70
+ if (range === null) return null;
71
+ if (xml.slice(range.end - 2, range.end) === "/>") return null;
72
+ const close = xml.lastIndexOf("</", range.end - 1);
73
+ let open = -1;
74
+ let quote = "";
75
+ for (let index = range.start; index < range.end; index += 1) {
76
+ const char = xml[index];
77
+ if (quote !== "") {
78
+ if (char === quote) quote = "";
79
+ } else if (char === "\"" || char === "'") quote = char;
80
+ else if (char === ">") {
81
+ open = index + 1;
82
+ break;
83
+ }
84
+ }
85
+ return open === -1 || close < open ? null : {
86
+ start: open,
87
+ end: close
88
+ };
89
+ };
90
+ /** The prefix `root` binds to one of `uris`, or null when it binds none. */
91
+ const prefixFor = (root, uris) => {
92
+ for (const [name, value] of Object.entries(root.attributes ?? {})) if (name.startsWith("xmlns:") && value !== void 0 && uris.has(String(value))) return {
93
+ prefix: name.slice(6),
94
+ uri: String(value)
95
+ };
96
+ return null;
97
+ };
98
+ const FALLBACK_RELATIONSHIP_PREFIX = "folioR";
99
+ /** Null when the part's root binds no prefix to WordprocessingML. */
100
+ const partPrefixes = (root) => {
101
+ const w = prefixFor(root, WORDPROCESSINGML_NAMESPACE_URIS);
102
+ if (w === null) return null;
103
+ const r = prefixFor(root, OFFICE_RELATIONSHIP_NAMESPACE_URIS);
104
+ return {
105
+ w: w.prefix,
106
+ wUri: w.uri,
107
+ r: r?.prefix ?? FALLBACK_RELATIONSHIP_PREFIX,
108
+ rDeclaration: r === null ? ` xmlns:${FALLBACK_RELATIONSHIP_PREFIX}="${NAMESPACES.r}"` : ""
109
+ };
110
+ };
111
+ /** Visit every element under `root` in document order, `root` included. */
112
+ const walkElements = (root, visit) => {
113
+ const stack = [root];
114
+ while (stack.length > 0) {
115
+ const element = stack.pop();
116
+ if (element === void 0 || element.type !== "element") continue;
117
+ visit(element);
118
+ const children = element.elements ?? [];
119
+ for (let index = children.length - 1; index >= 0; index -= 1) {
120
+ const child = children[index];
121
+ if (child !== void 0) stack.push(child);
122
+ }
123
+ }
124
+ };
125
+ export { MARKUP_COMPATIBILITY_NAMESPACE, MATH_NAMESPACE, elementChildren, escapeXmlAttribute, escapeXmlText, innerRangeOf, integerOrNull, isW, maxOf, partPrefixes, prefixFor, rangeOf, readRawPart, relationshipAttr, sliceWithSplices, spliceXml, twipsOrNull, wAttr, wChild, wChildVal, wChildren, wName, walkElements };
@@ -1,2 +1,11 @@
1
+ /** The on/off children of `w:settings` a caller may set without re-serializing the part. */
2
+ export type SettingsOnOffChild = "evenAndOddHeaders" | "updateFields";
3
+ /**
4
+ * Set (`true`), clear (`false`) or remove (`undefined`) one on/off child of
5
+ * `w:settings`, at its place in the schema's child order; the rest of the part
6
+ * keeps its bytes. Null means the source is malformed or outside the supported
7
+ * namespace profiles.
8
+ */
9
+ export declare const updateSettingsOnOffChild: (xml: string, localName: SettingsOnOffChild, enabled: boolean | undefined) => string | null;
1
10
  /** Null means the source is malformed or outside the supported namespace profiles. */
2
11
  export declare const updateEvenAndOddHeaders: (xml: string, enabled: boolean | undefined) => string | null;
@@ -1,14 +1,45 @@
1
1
  import { spliceXml } from "./selectiveXmlPatch.js";
2
- import { WORDPROCESSINGML_NAMESPACE_URIS, getChildElements, getLocalName, getNamespaceUri, parseXmlDocument } from "./xmlParser.js";
2
+ import { NAMESPACES, WORDPROCESSINGML_NAMESPACE_URIS, getChildElements, getLocalName, getNamespaceUri, parseXmlDocument } from "./xmlParser.js";
3
3
  import { panic } from "better-result";
4
4
  import { SETTINGS_CHILDREN } from "@stll/docx-core/schema";
5
5
  // src/docx/settingsHeaderFooterUpdate.ts
6
6
  /** Preserve producer settings while updating the document-wide header/footer switch. */
7
7
  const XML_TOKEN = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(?:"[^"]*"|'[^']*'|[^'">])*>/gu;
8
8
  const SETTINGS_CHILD_ORDINALS = new Map(SETTINGS_CHILDREN.map((name, index) => [name, index]));
9
- const EVEN_AND_ODD_HEADERS_ORDER = SETTINGS_CHILD_ORDINALS.get("evenAndOddHeaders");
10
- /** Null means the source is malformed or outside the supported namespace profiles. */
11
- const updateEvenAndOddHeaders = (xml, enabled) => {
9
+ /** The schema ordinals of the settings a compatibility wrapper may stand for. */
10
+ const wrappedOrdinals = (wrapper) => {
11
+ const ordinals = [];
12
+ for (const branch of getChildElements(wrapper)) for (const child of getChildElements(branch)) {
13
+ const ordinal = WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "") ? SETTINGS_CHILD_ORDINALS.get(getLocalName(child.name)) : void 0;
14
+ if (ordinal !== void 0) ordinals.push(ordinal);
15
+ }
16
+ return ordinals;
17
+ };
18
+ /**
19
+ * Where a child of `w:settings` sits relative to the flag at `childOrder`.
20
+ * A child of another namespace (the math properties, the schema library,
21
+ * later extensions) follows every on/off child. A compatibility wrapper sits
22
+ * where the settings it stands for sit; one that holds the flag itself, or
23
+ * settings on both sides of it, leaves the flag no place.
24
+ */
25
+ const placeOf = (child, childOrder) => {
26
+ const namespaceUri = getNamespaceUri(child) ?? "";
27
+ if (WORDPROCESSINGML_NAMESPACE_URIS.has(namespaceUri)) return (SETTINGS_CHILD_ORDINALS.get(getLocalName(child.name)) ?? -1) > childOrder ? "following" : "preceding";
28
+ if (namespaceUri !== NAMESPACES.mc) return "following";
29
+ const ordinals = wrappedOrdinals(child);
30
+ const before = ordinals.some((ordinal) => ordinal < childOrder);
31
+ const after = ordinals.some((ordinal) => ordinal > childOrder);
32
+ if (ordinals.includes(childOrder) || before && after) return "unplaceable";
33
+ return after ? "following" : "preceding";
34
+ };
35
+ /**
36
+ * Set (`true`), clear (`false`) or remove (`undefined`) one on/off child of
37
+ * `w:settings`, at its place in the schema's child order; the rest of the part
38
+ * keeps its bytes. Null means the source is malformed or outside the supported
39
+ * namespace profiles.
40
+ */
41
+ const updateSettingsOnOffChild = (xml, localName, enabled) => {
42
+ const childOrder = SETTINGS_CHILD_ORDINALS.get(localName);
12
43
  const root = parseXmlDocument(xml);
13
44
  if (!root || getLocalName(root.name) !== "settings" || !WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(root) ?? "")) return null;
14
45
  const children = getChildElements(root);
@@ -20,7 +51,7 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
20
51
  let rootOpenEnd = -1;
21
52
  let selfClosingRootStart = -1;
22
53
  let firstFollowingChildStart = -1;
23
- if (EVEN_AND_ODD_HEADERS_ORDER === void 0) panic("Generated CT_Settings schema does not define evenAndOddHeaders");
54
+ if (childOrder === void 0) return panic(`Generated CT_Settings schema does not define ${localName}`);
24
55
  for (const token of xml.matchAll(XML_TOKEN)) {
25
56
  const tag = token[0];
26
57
  if (tag.startsWith("<!") || tag.startsWith("<?")) continue;
@@ -32,7 +63,7 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
32
63
  if (stack.length === 1) {
33
64
  const child = children[childIndex++];
34
65
  if (!child || childStart < 0) return null;
35
- if (getLocalName(child.name) === "evenAndOddHeaders" && WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "")) spans.push({
66
+ if (getLocalName(child.name) === localName && WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "")) spans.push({
36
67
  start: childStart,
37
68
  end: token.index + tag.length,
38
69
  newXml: ""
@@ -49,11 +80,13 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
49
80
  if (stack.length === 1) {
50
81
  const child = children[childIndex];
51
82
  if (child?.name !== name) return null;
52
- if (firstFollowingChildStart < 0 && WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "") && (SETTINGS_CHILD_ORDINALS.get(getLocalName(child.name)) ?? -1) > EVEN_AND_ODD_HEADERS_ORDER) firstFollowingChildStart = token.index;
83
+ const place = placeOf(child, childOrder);
84
+ if (place === "unplaceable") return null;
85
+ if (firstFollowingChildStart < 0 && place === "following") firstFollowingChildStart = token.index;
53
86
  childStart = token.index;
54
87
  if (tag.endsWith("/>")) {
55
88
  childIndex += 1;
56
- if (getLocalName(child.name) === "evenAndOddHeaders" && WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "")) spans.push({
89
+ if (getLocalName(child.name) === localName && WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "")) spans.push({
57
90
  start: token.index,
58
91
  end: token.index + tag.length,
59
92
  newXml: ""
@@ -64,7 +97,7 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
64
97
  if (!tag.endsWith("/>")) stack.push(name);
65
98
  }
66
99
  if (stack.length !== 0 || childIndex !== children.length) return null;
67
- const flag = enabled === void 0 ? "" : `<folioW:evenAndOddHeaders xmlns:folioW="${getNamespaceUri(root)}"${enabled ? "" : " folioW:val=\"0\""}/>`;
100
+ const flag = enabled === void 0 ? "" : `<folioW:${localName} xmlns:folioW="${getNamespaceUri(root)}"${enabled ? "" : " folioW:val=\"0\""}/>`;
68
101
  if (selfClosingRootStart >= 0) {
69
102
  if (!flag) return xml;
70
103
  return spliceXml(xml, [{
@@ -86,4 +119,6 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
86
119
  }
87
120
  return spliceXml(xml, spans);
88
121
  };
89
- export { updateEvenAndOddHeaders };
122
+ /** Null means the source is malformed or outside the supported namespace profiles. */
123
+ const updateEvenAndOddHeaders = (xml, enabled) => updateSettingsOnOffChild(xml, "evenAndOddHeaders", enabled);
124
+ export { updateEvenAndOddHeaders, updateSettingsOnOffChild };
@@ -170,6 +170,14 @@ const rangeMarkers = (blocks) => [...indexBlocks(blocks)].map(([key, { element }
170
170
  for (const child of descendants(element)) if (WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "") && RANGE_MARKERS.has(getLocalName(child.name))) markers.push(rangeMarker(child));
171
171
  return markers;
172
172
  });
173
+ /** Verbatim captures: they keep the source's own spelling, not its meaning. */
174
+ const CAPTURE_KEYS = /* @__PURE__ */ new Set(["sourceXml", "gridSourceXml"]);
175
+ /** `value` without its verbatim captures, so a respelled source compares equal. */
176
+ const withoutCaptures = (value) => {
177
+ if (Array.isArray(value)) return value.map(withoutCaptures);
178
+ if (typeof value !== "object" || value === null) return value;
179
+ return Object.fromEntries(Object.entries(value).filter(([key]) => !CAPTURE_KEYS.has(key)).map(([key, field]) => [key, withoutCaptures(field)]));
180
+ };
173
181
  const decline = (reason) => ({
174
182
  type: "declined",
175
183
  reason
@@ -249,7 +257,7 @@ const buildStructuralDocumentPatch = ({ originalXml, serializedXml, changedIds,
249
257
  const changedTables = /* @__PURE__ */ new Set();
250
258
  for (const [index, block] of sourceBarriers.entries()) {
251
259
  const next = currentBarriers[index];
252
- if (canonicalJson(block) === canonicalJson(next)) continue;
260
+ if (canonicalJson(withoutCaptures(block)) === canonicalJson(withoutCaptures(next))) continue;
253
261
  if (block.type !== "table" || next?.type !== "table") return decline("structuralBarrierChanged");
254
262
  changedTables.add(index);
255
263
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The `w:tblGrid` a table's model writes when no capture stands in for it.
3
+ * The serializer writes it; the parser keeps a capture only when the source
4
+ * grid differs from it, so a table without one reads back as it was written.
5
+ */
6
+ import { document_d_exports } from "../types/document.js";
7
+ /**
8
+ * The most grid columns a table declares. Far above what any editor lays out,
9
+ * it bounds a grid built from a source's skipped-column
10
+ * and span counts, which a file can state at any size.
11
+ */
12
+ export declare const MAX_GRID_COLUMNS = 4096;
13
+ /**
14
+ * Columns the grid has to declare: the widest row's total of skipped columns
15
+ * and spans, because a grid narrower than a row leaves cells with no column
16
+ * to sit in. At most {@link MAX_GRID_COLUMNS}.
17
+ */
18
+ export declare const gridColumnCount: (table: document_d_exports.Table) => number;
19
+ /**
20
+ * `w:tblGrid` from the model.
21
+ *
22
+ * `w:tblGrid` is required on every `w:tbl` and `w:w` is optional on a
23
+ * `w:gridCol`, so a table whose column widths were never measured (one the
24
+ * comparison creates, say) still declares a grid, just without widths.
25
+ * `w:tblGridChange` records the grid a reviewer replaced. It is history, so
26
+ * no width in the model derives it, and a rebuilt grid that leaves it out
27
+ * accepts the reviewer's change without saying so. The schema declares it
28
+ * after every `w:gridCol`, so it is appended.
29
+ */
30
+ export declare const modelTableGrid: (table: document_d_exports.Table) => string;
@@ -0,0 +1,54 @@
1
+ import { intAttr } from "./serializer/xmlUtils.js";
2
+ // src/docx/tableGridXml.ts
3
+ /**
4
+ * The most grid columns a table declares. Far above what any editor lays out,
5
+ * it bounds a grid built from a source's skipped-column
6
+ * and span counts, which a file can state at any size.
7
+ */
8
+ const MAX_GRID_COLUMNS = 4096;
9
+ /**
10
+ * Columns the grid has to declare: the widest row's total of skipped columns
11
+ * and spans, because a grid narrower than a row leaves cells with no column
12
+ * to sit in. At most {@link MAX_GRID_COLUMNS}.
13
+ */
14
+ const gridColumnCount = (table) => {
15
+ let widest = 0;
16
+ for (const row of table.rows) {
17
+ let columns = (row.formatting?.gridBefore ?? 0) + (row.formatting?.gridAfter ?? 0);
18
+ for (const cell of row.cells) columns += cell.formatting?.gridSpan ?? 1;
19
+ widest = Math.max(widest, columns);
20
+ }
21
+ return Math.min(widest, MAX_GRID_COLUMNS);
22
+ };
23
+ /**
24
+ * Serialize `w:tblGridChange`: the grid a reviewer replaced, from the change's
25
+ * own record rather than from the bytes it arrived as.
26
+ *
27
+ * `w:w` is optional on a `w:gridCol`, so a column the snapshot recorded no
28
+ * measure for is written back without one; spelling it as a zero would claim a
29
+ * width the source never stated.
30
+ */
31
+ const serializeTableGridChange = ({ id, columnWidths }) => {
32
+ const columns = columnWidths.map((width) => width === void 0 ? "<w:gridCol/>" : `<w:gridCol w:w="${intAttr(width)}"/>`).join("");
33
+ return `<w:tblGridChange w:id="${intAttr(id)}"><w:tblGrid>${columns}</w:tblGrid></w:tblGridChange>`;
34
+ };
35
+ /**
36
+ * `w:tblGrid` from the model.
37
+ *
38
+ * `w:tblGrid` is required on every `w:tbl` and `w:w` is optional on a
39
+ * `w:gridCol`, so a table whose column widths were never measured (one the
40
+ * comparison creates, say) still declares a grid, just without widths.
41
+ * `w:tblGridChange` records the grid a reviewer replaced. It is history, so
42
+ * no width in the model derives it, and a rebuilt grid that leaves it out
43
+ * accepts the reviewer's change without saying so. The schema declares it
44
+ * after every `w:gridCol`, so it is appended.
45
+ */
46
+ const modelTableGrid = (table) => {
47
+ const change = table.formatting?.gridChange;
48
+ const gridChange = change === void 0 ? "" : serializeTableGridChange(change);
49
+ const columnWidths = table.columnWidths;
50
+ if (columnWidths && columnWidths.length > 0) return `<w:tblGrid>${columnWidths.map((w) => `<w:gridCol w:w="${intAttr(w)}"/>`).join("")}${gridChange}</w:tblGrid>`;
51
+ const columns = gridColumnCount(table);
52
+ return columns === 0 && gridChange === "" ? "<w:tblGrid/>" : `<w:tblGrid>${"<w:gridCol/>".repeat(columns)}${gridChange}</w:tblGrid>`;
53
+ };
54
+ export { MAX_GRID_COLUMNS, gridColumnCount, modelTableGrid };
@@ -11,6 +11,7 @@ import { standalonePreviewLedger } from "./previewBudget.js";
11
11
  import { captureSdtSiblingMarkers, parseSdtProperties } from "./sdtProperties.js";
12
12
  import { parseShading } from "./shadingParser.js";
13
13
  import { findChildAnySpelling } from "./strictNames.js";
14
+ import { modelTableGrid } from "./tableGridXml.js";
14
15
  import { TABLE_LOOK_FLAGS } from "./tableLook.js";
15
16
  import { isEmptyRowPropertiesAttribute, retainsEmptyRowProperties } from "./tableRowPropertyPresence.js";
16
17
  import { parsePropertyChangeInfo, parseTrackedChangeInfo } from "./trackedChangeInfo.js";
@@ -1359,6 +1360,12 @@ function parseTable(tblElement, styles, theme, numbering, rels, media, options)
1359
1360
  if (preservedChildren.length > 0) table.preserved = { children: preservedChildren };
1360
1361
  if (bookmarks.length > 0) table.bookmarks = bookmarks;
1361
1362
  inferImplicitSingleCellRowSpans(table, rowsWithGridOffsets);
1363
+ const captured = table.formatting;
1364
+ if (captured?.gridSourceXml !== void 0 && captured.gridSourceXml === modelTableGrid(table)) {
1365
+ const { gridSourceXml: _modelGrid, ...rest } = captured;
1366
+ if (Object.keys(rest).length > 0) table.formatting = rest;
1367
+ else delete table.formatting;
1368
+ }
1362
1369
  return table;
1363
1370
  }
1364
1371
  /**
@@ -0,0 +1,5 @@
1
+ import { FolioMessages } from "./messages.js";
2
+ /** Read English or a catalog that has already loaded. */
3
+ export declare const getLoadedFolioMessages: (locale: string) => FolioMessages | undefined;
4
+ /** Load just the catalog for the requested locale. */
5
+ export declare const loadFolioMessages: (locale: string) => Promise<FolioMessages>;
@@ -0,0 +1,46 @@
1
+ import { resolveFolioLocale } from "./locales.js";
2
+ import messages from "./messages/en.gen.js";
3
+ // src/i18n/loadMessages.ts
4
+ const loaders = {
5
+ ar: () => import("./messages/ar.gen.js"),
6
+ cs: () => import("./messages/cs.gen.js"),
7
+ de: () => import("./messages/de.gen.js"),
8
+ es: () => import("./messages/es.gen.js"),
9
+ et: () => import("./messages/et.gen.js"),
10
+ fr: () => import("./messages/fr.gen.js"),
11
+ he: () => import("./messages/he.gen.js"),
12
+ hi: () => import("./messages/hi.gen.js"),
13
+ hu: () => import("./messages/hu.gen.js"),
14
+ lt: () => import("./messages/lt.gen.js"),
15
+ lv: () => import("./messages/lv.gen.js"),
16
+ pl: () => import("./messages/pl.gen.js"),
17
+ "pt-BR": () => import("./messages/pt-BR.gen.js"),
18
+ sk: () => import("./messages/sk.gen.js"),
19
+ tr: () => import("./messages/tr.gen.js"),
20
+ "zh-CN": () => import("./messages/zh-CN.gen.js")
21
+ };
22
+ const catalogs = /* @__PURE__ */ new Map();
23
+ /** Read English or a catalog that has already loaded. */
24
+ const getLoadedFolioMessages = (locale) => {
25
+ const resolved = resolveFolioLocale(locale);
26
+ if (resolved === "en") return messages;
27
+ const cached = catalogs.get(resolved);
28
+ return cached instanceof Promise ? void 0 : cached;
29
+ };
30
+ /** Load just the catalog for the requested locale. */
31
+ const loadFolioMessages = (locale) => {
32
+ const resolved = resolveFolioLocale(locale);
33
+ if (resolved === "en") return Promise.resolve(messages);
34
+ const cached = catalogs.get(resolved);
35
+ if (cached !== void 0) return Promise.resolve(cached);
36
+ const pending = loaders[resolved]().then(({ messages }) => {
37
+ catalogs.set(resolved, messages);
38
+ return messages;
39
+ }, (error) => {
40
+ catalogs.delete(resolved);
41
+ throw error;
42
+ });
43
+ catalogs.set(resolved, pending);
44
+ return pending;
45
+ };
46
+ export { getLoadedFolioMessages, loadFolioMessages };
@@ -0,0 +1,3 @@
1
+ import { FolioLocale } from "./messages/locales.js";
2
+ export declare const isFolioLocale: (locale: string) => locale is FolioLocale;
3
+ export declare const resolveFolioLocale: (locale: string) => FolioLocale;
@@ -0,0 +1,17 @@
1
+ import { FOLIO_LOCALES } from "./messages/locales.js";
2
+ // src/i18n/locales.ts
3
+ const FOLIO_LOCALE_SET = new Set(FOLIO_LOCALES);
4
+ const isFolioLocale = (locale) => FOLIO_LOCALE_SET.has(locale);
5
+ const baseLanguageOf = (locale) => {
6
+ try {
7
+ return new Intl.Locale(locale).language;
8
+ } catch {
9
+ return null;
10
+ }
11
+ };
12
+ const resolveFolioLocale = (locale) => {
13
+ if (isFolioLocale(locale)) return locale;
14
+ const base = baseLanguageOf(locale);
15
+ return base !== null && isFolioLocale(base) ? base : "en";
16
+ };
17
+ export { isFolioLocale, resolveFolioLocale };
@@ -1,3 +1,5 @@
1
+ import { loadFolioMessages } from "./loadMessages.js";
2
+ import { isFolioLocale } from "./locales.js";
1
3
  import { FOLIO_LOCALES, FolioLocale } from "./messages/locales.js";
2
4
  type FolioMessageTree = {
3
5
  [key: string]: string | FolioMessageTree;
@@ -5,6 +7,5 @@ type FolioMessageTree = {
5
7
  export type FolioMessages = {
6
8
  folio: FolioMessageTree;
7
9
  };
8
- export declare const isFolioLocale: (locale: string) => locale is FolioLocale;
9
10
  export declare const getFolioMessages: (locale: string) => FolioMessages;
10
- export { FOLIO_LOCALES, type FolioLocale };
11
+ export { FOLIO_LOCALES, type FolioLocale, isFolioLocale, loadFolioMessages };
@@ -1,20 +1,8 @@
1
+ import { loadFolioMessages } from "./loadMessages.js";
2
+ import { isFolioLocale, resolveFolioLocale } from "./locales.js";
1
3
  import { CATALOGS as CATALOGS$1 } from "./messages/catalogs.gen.js";
2
4
  import { FOLIO_LOCALES } from "./messages/locales.js";
3
5
  // src/i18n/messages.ts
4
6
  const CATALOGS = CATALOGS$1;
5
- const FOLIO_LOCALE_SET = new Set(FOLIO_LOCALES);
6
- const isFolioLocale = (locale) => FOLIO_LOCALE_SET.has(locale);
7
- const baseLanguageOf = (locale) => {
8
- try {
9
- return new Intl.Locale(locale).language;
10
- } catch {
11
- return null;
12
- }
13
- };
14
- const getFolioMessages = (locale) => {
15
- if (isFolioLocale(locale)) return CATALOGS[locale];
16
- const base = baseLanguageOf(locale);
17
- if (base !== null && isFolioLocale(base)) return CATALOGS[base];
18
- return CATALOGS.en;
19
- };
20
- export { FOLIO_LOCALES, getFolioMessages, isFolioLocale };
7
+ const getFolioMessages = (locale) => CATALOGS[resolveFolioLocale(locale)];
8
+ export { FOLIO_LOCALES, getFolioMessages, isFolioLocale, loadFolioMessages };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FolioAIEditApplyOutcome, FolioRevisionStamp, FolioWordDiffOptions, applyFolioAIEditOperations } from "./ai-edits/apply.js";
1
+ import { FolioAIEditApplyOutcome, FolioRevisionStamp, FolioWordDiffOptions } from "./ai-edits/applyTypes.js";
2
2
  import "./ai-edits/index.js";
3
3
  import { createFolioAIEditSnapshot, hashFolioAIBlockText, isFolioAIContentBlock, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
4
4
  import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIBlockStructuralBoundary, FolioAIBlockTableLocation, FolioAIComment, FolioAIDiagnosticBlock, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditNormalization, FolioAIEditNormalizationCode, FolioAIEditOperation, FolioAIEditParagraphIdentity, FolioAIEditPrecondition, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAIInlineBooleanProperty, FolioAIInlineFormatting, FolioAIInlineFormattingPatch, FolioAIParagraphBlock, FolioAIParagraphSpacing, FolioAISignatureParty } from "./ai-edits/types.js";
@@ -13,7 +13,7 @@ import { FolioContentBlock, FolioContentContainerPathEntry, FolioContentFormatRa
13
13
  import { CompareContentOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FolioContentBlockProperty, FolioContentComparison, FolioContentComparisonError, FolioContentComparisonEvent, FolioContentComparisonLimit, FolioContentComparisonLimitError, FolioContentFormattingChange, FolioContentInlinePresentationProjectionError, FolioContentParagraphFormattingPatch, FolioContentStructuralChange, FolioContentTextSegment, InvalidFolioContentComparisonError, compareContent } from "./compare/content.js";
14
14
  import { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, CompareChange, CompareChangeLocation, CompareCompatibility, CompareDocxApplyError, CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, CompareFolioRequirement, CompareResult, CompareRevisionFormat, CompareUnsupportedPart, CompareUnsupportedReason, InvalidCompareDocxOptionsError } from "./compare/types.js";
15
15
  import { COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, CompareVerification, CompareVerificationCause, CompareVerificationFailure, CompareVerificationInvariant, FinalParagraphMarkRevision } from "./compare/verification.js";
16
- import { ApplyFolioDocumentOperationsOptions, 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, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationBatchInput, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationResultBase, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
16
+ 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, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationBatchInput, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationResultBase, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
17
17
  import { DocxCompatibility, DocxCompatibilityContext, DocxCompatibilityIssue, DocxCompatibilityLocation, DocxCompatibilityPart, DocxDrawingClassification, FolioDocxCompatibilityHost, FolioDocxCompatibilityProfile, InspectDocxCompatibilityOptions, inspectDocxCompatibility } from "./docx/compatibility.js";
18
18
  import { DRAWING_SAFETY_CLASSES, DrawingSafetyClass } from "./docx/imageRawXml.js";
19
19
  import { DocumentPropertiesOptions, createDocx } from "./docx/rezip.js";
@@ -47,4 +47,4 @@ import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
47
47
  import { OP_STORIES, OpStory, TextPosition } from "@stll/docx-core/ops";
48
48
  type Document = document_d_exports.Document;
49
49
  type DocxConformanceClass = document_d_exports.DocxConformanceClass;
50
- export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type BlockRect, COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareCompatibility, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type CompareFolioRequirement, type CompareResult, type CompareRevisionFormat, type CompareUnsupportedPart, type CompareUnsupportedReason, type CompareVerification, type CompareVerificationCause, type CompareVerificationFailure, type CompareVerificationInvariant, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_OUTLINE_DEPTH, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type DocxDrawingClassification, type DrawingSafetyClass, type EditorReadOnlyReason, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_CONTENT_COMPARISON_LIMITS, 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, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, type FinalParagraphMarkRevision, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIDiagnosticBlock, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditParagraphIdentity, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphBlock, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioAnonymizationMatch, type FolioAnonymizationTerm, type FolioAutocompleteApi, type FolioAutocompleteState, type FolioBlockId, type FolioContentBlock, type FolioContentBlockProperty, type FolioContentComparison, type FolioContentComparisonError, type FolioContentComparisonEvent, type FolioContentComparisonLimit, FolioContentComparisonLimitError, type FolioContentContainerPathEntry, type FolioContentFormatRange, type FolioContentFormattingChange, type FolioContentIdStability, type FolioContentInlineBooleanProperty, type FolioContentInlineComparisonResult, type FolioContentInlineFormatting, type FolioContentInlineFormattingPatch, FolioContentInlinePresentationProjectionError, type FolioContentLineSpacingRule, type FolioContentParagraphAlignment, type FolioContentParagraphFormattingPatch, type FolioContentParagraphKind, type FolioContentParagraphSpacing, type FolioContentRun, type FolioContentSnapshot, type FolioContentStatedNumbering, type FolioContentStructuralChange, type FolioContentTableLocation, type FolioContentTextSegment, type FolioDerivedFields, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationBatchInput, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type FolioFieldInsertion, type FolioRevisionStamp, type FolioUndefinedReferencePolicy, type FolioWordDiffOptions, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, type MarkdownOptions, type MarkdownResult, OP_STORIES, type OpStory, type OutlineDepth, type PositionalText, type ResolvedAnchor, type ReviewDisplayMode, STELLA_STYLE_SET_NAME, type TemplatePreviewHiddenRange, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, type TextPosition, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, buildEmbeddedFontFamilyMap, buildPositionalText, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, filterHeadingsByDepth, fromMarkdown, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, templateSlashMenuKey, toMarkdown, toMarkdownResult };
50
+ export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type ApplyResult, type BlockRect, COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareCompatibility, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type CompareFolioRequirement, type CompareResult, type CompareRevisionFormat, type CompareUnsupportedPart, type CompareUnsupportedReason, type CompareVerification, type CompareVerificationCause, type CompareVerificationFailure, type CompareVerificationInvariant, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_OUTLINE_DEPTH, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type DocxDrawingClassification, type DrawingSafetyClass, type EditorReadOnlyReason, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_CONTENT_COMPARISON_LIMITS, 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, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, type FinalParagraphMarkRevision, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIDiagnosticBlock, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditParagraphIdentity, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphBlock, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioAnonymizationMatch, type FolioAnonymizationTerm, type FolioAutocompleteApi, type FolioAutocompleteState, type FolioBlockId, type FolioContentBlock, type FolioContentBlockProperty, type FolioContentComparison, type FolioContentComparisonError, type FolioContentComparisonEvent, type FolioContentComparisonLimit, FolioContentComparisonLimitError, type FolioContentContainerPathEntry, type FolioContentFormatRange, type FolioContentFormattingChange, type FolioContentIdStability, type FolioContentInlineBooleanProperty, type FolioContentInlineComparisonResult, type FolioContentInlineFormatting, type FolioContentInlineFormattingPatch, FolioContentInlinePresentationProjectionError, type FolioContentLineSpacingRule, type FolioContentParagraphAlignment, type FolioContentParagraphFormattingPatch, type FolioContentParagraphKind, type FolioContentParagraphSpacing, type FolioContentRun, type FolioContentSnapshot, type FolioContentStatedNumbering, type FolioContentStructuralChange, type FolioContentTableLocation, type FolioContentTextSegment, type FolioDerivedFields, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationBatchInput, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type FolioFieldInsertion, type FolioRevisionStamp, type FolioUndefinedReferencePolicy, type FolioWordDiffOptions, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, type MarkdownOptions, type MarkdownResult, OP_STORIES, type OpStory, type OutlineDepth, type PositionalText, type ResolvedAnchor, type ReviewDisplayMode, STELLA_STYLE_SET_NAME, type TemplatePreviewHiddenRange, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, type TextPosition, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, applySuggestions, assertSupportedFolioDocumentOperationVersion, buildEmbeddedFontFamilyMap, buildPositionalText, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, filterHeadingsByDepth, fromMarkdown, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, templateSlashMenuKey, toMarkdown, toMarkdownResult };