@stll/folio-core 0.67.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.d.ts +9 -1
- package/dist/ai-edits/apply.js +94 -8
- package/dist/ai-edits/headless.d.ts +36 -21
- package/dist/ai-edits/headless.js +106 -36
- package/dist/ai-edits/index.d.ts +2 -2
- package/dist/ai-edits/newListNumbering.d.ts +14 -1
- package/dist/ai-edits/newListNumbering.js +24 -1
- package/dist/ai-edits/note-references.d.ts +6 -0
- package/dist/ai-edits/note-references.js +7 -1
- package/dist/ai-edits/pending-suggestions.js +2 -2
- package/dist/ai-edits/read.d.ts +19 -0
- package/dist/ai-edits/snapshot.d.ts +6 -0
- package/dist/ai-edits/snapshot.js +8 -3
- package/dist/ai-edits/types.d.ts +9 -1
- package/dist/ai-suggestions/apply.js +13 -4
- package/dist/compare/compare.js +2 -1
- package/dist/compare/inserted-resource-snapshot.d.ts +4 -1
- package/dist/compare/inserted-resource-snapshot.js +7 -3
- package/dist/controller/canonicalClipboard.js +31 -14
- package/dist/controller/canonicalComposition.js +35 -6
- package/dist/controller/canonicalInlineProjection.d.ts +35 -10
- package/dist/controller/canonicalInlineProjection.js +192 -28
- package/dist/controller/canonicalInput.d.ts +2 -1
- package/dist/controller/canonicalInput.js +32 -7
- package/dist/controller/canonicalListRendering.d.ts +2 -1
- package/dist/controller/canonicalListRendering.js +1 -1
- package/dist/controller/canonicalLockGuard.d.ts +23 -0
- package/dist/controller/canonicalLockGuard.js +133 -0
- package/dist/controller/canonicalProjectionBlocks.d.ts +79 -0
- package/dist/controller/canonicalProjectionBlocks.js +75 -0
- package/dist/controller/canonicalPublicOperations.d.ts +12 -4
- package/dist/controller/canonicalPublicOperations.js +676 -46
- package/dist/controller/canonicalSeedContent.d.ts +12 -0
- package/dist/controller/canonicalSeedContent.js +131 -0
- package/dist/controller/canonicalSession.d.ts +133 -21
- package/dist/controller/canonicalSession.js +738 -205
- package/dist/controller/canonicalSourceNormalization.d.ts +21 -0
- package/dist/controller/canonicalSourceNormalization.js +148 -0
- package/dist/controller/canonicalStoryEditor.d.ts +4 -3
- package/dist/controller/canonicalStoryEditor.js +20 -15
- package/dist/controller/canonicalStructure.d.ts +2 -1
- package/dist/controller/canonicalStructure.js +129 -7
- package/dist/controller/contentControlWidgetController.d.ts +5 -0
- package/dist/controller/contentControlWidgetController.js +13 -1
- package/dist/controller/folioEditor.js +4 -0
- package/dist/controller/headerFooterEditorManager.d.ts +7 -2
- package/dist/controller/headerFooterEditorManager.js +11 -6
- package/dist/controller/hiddenEditorApi.d.ts +17 -2
- package/dist/controller/hiddenEditorApi.js +4 -0
- package/dist/controller/hiddenEditorManager.d.ts +11 -3
- package/dist/controller/hiddenEditorManager.js +157 -48
- package/dist/controller/layoutPipeline.js +50 -16
- package/dist/controller/layoutSession.d.ts +3 -0
- package/dist/controller/layoutSession.js +3 -1
- package/dist/controller/noteEditorManager.d.ts +7 -2
- package/dist/controller/noteEditorManager.js +11 -6
- package/dist/display-list/build/pageFurniture.js +41 -19
- package/dist/display-list/build/tablePrimitives.js +23 -4
- package/dist/display-list/dom/renderDisplayListToDom.js +13 -11
- package/dist/document-operations.d.ts +9 -1
- package/dist/document-operations.js +4 -3
- package/dist/docx/blockContentParser.d.ts +7 -3
- package/dist/docx/blockContentParser.js +2 -3
- package/dist/docx/blockPlainText.js +2 -0
- package/dist/docx/bookmarkRangeJoin.d.ts +6 -0
- package/dist/docx/bookmarkRangeJoin.js +43 -0
- package/dist/docx/canonicalSave.js +11 -2
- package/dist/docx/canonicalSessionInput.d.ts +5 -1
- package/dist/docx/canonicalSessionInput.js +7 -2
- package/dist/docx/commentAnchorIndex.d.ts +40 -5
- package/dist/docx/commentAnchorIndex.js +94 -12
- package/dist/docx/commentRangeIntegrity.js +30 -24
- package/dist/docx/commentRangeJoin.d.ts +4 -0
- package/dist/docx/commentRangeJoin.js +26 -12
- package/dist/docx/commentReferenceCompletion.js +5 -4
- package/dist/docx/commentReferenceNormalization.js +40 -18
- package/dist/docx/compatibility.js +9 -2
- package/dist/docx/containerChildren.js +22 -1
- package/dist/docx/contentTypeRegistry.js +1 -1
- package/dist/docx/encryption/compoundFile.js +9 -1
- package/dist/docx/encryption/encryptionInfo.js +16 -2
- package/dist/docx/ensureParaIds.js +46 -7
- package/dist/docx/ensureUniqueControlIds.d.ts +25 -0
- package/dist/docx/ensureUniqueControlIds.js +110 -0
- package/dist/docx/headerFooterVerbatim.d.ts +7 -0
- package/dist/docx/headerFooterVerbatim.js +13 -2
- package/dist/docx/hostCommentThreads.d.ts +27 -0
- package/dist/docx/hostCommentThreads.js +72 -0
- package/dist/docx/hyperlinkParser.js +9 -2
- package/dist/docx/inlineWrapperContent.d.ts +8 -1
- package/dist/docx/inlineWrapperContent.js +9 -2
- package/dist/docx/listMarkerComputation.d.ts +35 -1
- package/dist/docx/listMarkerComputation.js +39 -1
- package/dist/docx/listModelNormalization.d.ts +44 -1
- package/dist/docx/listModelNormalization.js +226 -96
- package/dist/docx/listNumberingInstances.d.ts +1 -1
- package/dist/docx/listNumberingInstances.js +2 -2
- package/dist/docx/markupRangeMarker.d.ts +14 -0
- package/dist/docx/markupRangeMarker.js +15 -1
- package/dist/docx/metadataPrivacy.js +43 -22
- package/dist/docx/normalizeBaseDirection.js +3 -1
- package/dist/docx/numberingIds.d.ts +6 -0
- package/dist/docx/numberingIds.js +6 -1
- package/dist/docx/numberingReferenceNormalization.d.ts +4 -0
- package/dist/docx/numberingReferenceNormalization.js +12 -2
- package/dist/docx/paragraphParser.js +159 -48
- package/dist/docx/paragraphPropertySource.d.ts +29 -0
- package/dist/docx/paragraphPropertySource.js +106 -16
- package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
- package/dist/docx/paragraphTraversal.js +2 -0
- package/dist/docx/parseWarningMessage.js +2 -1
- package/dist/docx/parser.js +8 -0
- package/dist/docx/removeHeaderFooterParts.js +1 -1
- package/dist/docx/renderedPageBreakNormalization.js +1 -1
- package/dist/docx/reviewProvenanceDiagnostics.d.ts +7 -0
- package/dist/docx/reviewProvenanceDiagnostics.js +39 -0
- package/dist/docx/reviewResolutionProvenance.d.ts +29 -3
- package/dist/docx/reviewResolutionProvenance.js +171 -33
- package/dist/docx/rezip.d.ts +6 -0
- package/dist/docx/rezip.js +38 -21
- package/dist/docx/selectiveSave.js +6 -10
- package/dist/docx/selectiveXmlPatch.d.ts +5 -4
- package/dist/docx/selectiveXmlPatch.js +11 -7
- package/dist/docx/serializer/documentSerializer.js +5 -2
- package/dist/docx/serializer/headerFooterSerializer.js +3 -1
- package/dist/docx/serializer/markupRangeAttributes.d.ts +6 -1
- package/dist/docx/serializer/markupRangeAttributes.js +6 -1
- package/dist/docx/serializer/noteSerializer.d.ts +17 -4
- package/dist/docx/serializer/noteSerializer.js +23 -16
- package/dist/docx/serializer/paragraphSerializer.js +56 -12
- package/dist/docx/serializer/partNamespaces.d.ts +1 -1
- package/dist/docx/serializer/partNamespaces.js +1 -1
- package/dist/docx/serializer/runSerializer.d.ts +1 -3
- package/dist/docx/serializer/runSerializer.js +2 -2
- package/dist/docx/serializer/tableSerializer.d.ts +4 -0
- package/dist/docx/serializer/tableSerializer.js +4 -2
- package/dist/docx/server/applyDocxXmlPatchProposal.js +8 -4
- package/dist/docx/server/build.d.ts +1 -1
- package/dist/docx/server/createBilingualDocument.js +27 -5
- package/dist/docx/server/migrateYjsAttrSchema.js +4 -0
- package/dist/docx/sessionListPruning.d.ts +2 -0
- package/dist/docx/sessionListPruning.js +50 -0
- package/dist/docx/splitRevisionPieces.d.ts +10 -0
- package/dist/docx/splitRevisionPieces.js +14 -0
- package/dist/docx/storyBlockReplay.js +19 -2
- package/dist/docx/structuralXmlPatch.js +44 -11
- package/dist/docx/tableParser.d.ts +6 -2
- package/dist/docx/tableParser.js +2 -3
- package/dist/docx/textBoxContentParser.d.ts +11 -0
- package/dist/docx/textBoxContentParser.js +51 -0
- package/dist/docx/textBoxParser.d.ts +0 -5
- package/dist/docx/textBoxParser.js +1 -23
- package/dist/docx/verticalMergeProjection.js +1 -1
- package/dist/docx/xmlParser.d.ts +1 -1
- package/dist/docx/xmlParser.js +2 -3
- package/dist/fonts/fontsourceFaces.d.ts +2 -8
- package/dist/fonts/fontsourceFaces.js +1 -7
- package/dist/i18n/messages/ar.gen.js +3 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +51 -0
- package/dist/i18n/messages/catalogs.gen.js +51 -0
- package/dist/i18n/messages/cs.gen.js +3 -0
- package/dist/i18n/messages/de.gen.js +3 -0
- package/dist/i18n/messages/en.gen.js +3 -0
- package/dist/i18n/messages/es.gen.js +3 -0
- package/dist/i18n/messages/et.gen.js +3 -0
- package/dist/i18n/messages/fr.gen.js +3 -0
- package/dist/i18n/messages/he.gen.js +3 -0
- package/dist/i18n/messages/hi.gen.js +3 -0
- package/dist/i18n/messages/hu.gen.js +3 -0
- package/dist/i18n/messages/lt.gen.js +3 -0
- package/dist/i18n/messages/lv.gen.js +3 -0
- package/dist/i18n/messages/messages.gen.d.ts +3 -0
- package/dist/i18n/messages/pl.gen.js +3 -0
- package/dist/i18n/messages/pt-BR.gen.js +3 -0
- package/dist/i18n/messages/sk.gen.js +3 -0
- package/dist/i18n/messages/tr.gen.js +3 -0
- package/dist/i18n/messages/zh-CN.gen.js +3 -0
- package/dist/internal/acceptedBlockProjection.js +2 -0
- package/dist/internal/pageBreakRunDescendantIndex.d.ts +7 -2
- package/dist/internal/pageBreakRunDescendantIndex.js +12 -3
- package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +5 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +5 -0
- package/dist/internal/revisionResolutionInline.js +1 -2
- package/dist/internal/subtreeHolds.d.ts +12 -0
- package/dist/internal/subtreeHolds.js +25 -0
- package/dist/internal/wholeStoryRevisionResolution.js +1 -1
- package/dist/layout-bridge/cellSelectionHighlight.js +3 -3
- package/dist/layout-bridge/convert/flowBlockPostprocessing.js +20 -12
- package/dist/layout-bridge/convert/flowConversionShared.d.ts +15 -1
- package/dist/layout-bridge/convert/flowConversionShared.js +9 -1
- package/dist/layout-bridge/convert/paragraphAttrs.d.ts +15 -4
- package/dist/layout-bridge/convert/paragraphAttrs.js +11 -4
- package/dist/layout-bridge/convert/paragraphBlockCache.d.ts +26 -0
- package/dist/layout-bridge/convert/paragraphBlockCache.js +137 -0
- package/dist/layout-bridge/convert/paragraphConversion.d.ts +12 -2
- package/dist/layout-bridge/convert/paragraphConversion.js +37 -5
- package/dist/layout-bridge/convert/paragraphRuns.d.ts +2 -2
- package/dist/layout-bridge/convert/sectionBoundaries.js +16 -0
- package/dist/layout-bridge/convert/tableConversion.js +19 -8
- package/dist/layout-bridge/convert/toFlowBlocks.js +144 -15
- package/dist/layout-bridge/convert/topLevelConversion.d.ts +74 -0
- package/dist/layout-bridge/convert/topLevelConversion.js +109 -0
- package/dist/layout-bridge/dom/clickToPositionDom.js +41 -40
- package/dist/layout-bridge/dom/findBodyPmSpans.js +4 -3
- package/dist/layout-bridge/dom/findHfPmSpans.js +10 -15
- package/dist/layout-bridge/dom/imeCaretAnchor.d.ts +8 -0
- package/dist/layout-bridge/dom/imeCaretAnchor.js +71 -7
- package/dist/layout-bridge/dom/textStreamDom.js +3 -2
- package/dist/layout-bridge/engine/blockIndex.d.ts +7 -0
- package/dist/layout-bridge/engine/blockIndex.js +12 -0
- package/dist/layout-bridge/engine/hitTest.js +9 -10
- package/dist/layout-bridge/engine/selectionRects.js +6 -6
- package/dist/layout-bridge/headerFooterLayout.js +12 -11
- package/dist/layout-bridge/tableInsertHover.js +2 -1
- package/dist/layout-engine/footnoteContinuation.d.ts +36 -0
- package/dist/layout-engine/footnoteContinuation.js +210 -0
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +7 -2
- package/dist/layout-engine/measure/cache.d.ts +2 -0
- package/dist/layout-engine/measure/cache.js +16 -6
- package/dist/layout-engine/measure/measureParagraph.js +1 -1
- package/dist/layout-engine/measure/paragraphKeyMemo.d.ts +8 -0
- package/dist/layout-engine/measure/paragraphKeyMemo.js +92 -0
- package/dist/layout-engine/tableLayout.js +29 -5
- package/dist/layout-engine/tableRowBreak.d.ts +36 -0
- package/dist/layout-engine/tableRowBreak.js +43 -1
- package/dist/layout-engine/types.d.ts +42 -1
- package/dist/layout-painter/imageLayout.js +2 -1
- package/dist/layout-painter/pageShellStyles.d.ts +10 -0
- package/dist/layout-painter/pageShellStyles.js +32 -0
- package/dist/layout-painter/reconcileRenderedContent.d.ts +19 -0
- package/dist/layout-painter/reconcileRenderedContent.js +117 -0
- package/dist/layout-painter/renderFragment.js +4 -6
- package/dist/layout-painter/renderImage.js +2 -2
- package/dist/layout-painter/renderPage.d.ts +4 -4
- package/dist/layout-painter/renderPage.js +54 -46
- package/dist/layout-painter/renderParagraph.js +3 -3
- package/dist/layout-painter/renderTable.js +16 -16
- package/dist/layout-painter/renderTextBox.js +2 -2
- package/dist/layout-painter/sdtBoundary.js +3 -2
- package/dist/managers/AutoSaveManager.d.ts +5 -1
- package/dist/managers/FindReplaceManager.js +3 -10
- package/dist/markdown/escape.d.ts +20 -1
- package/dist/markdown/escape.js +43 -1
- package/dist/markdown/renderBlock.js +4 -1
- package/dist/markdown/renderParagraph.js +13 -27
- package/dist/markdown/renderTable.js +6 -2
- package/dist/markdown/trailers.js +1 -0
- package/dist/paged-layout/blockGeometry.js +3 -2
- package/dist/paged-layout/editorScrollRoot.d.ts +9 -0
- package/dist/paged-layout/editorScrollRoot.js +10 -1
- package/dist/paged-layout/rangeProjection.js +5 -4
- package/dist/paged-layout/scrollToPmPosition.js +3 -3
- package/dist/paged-layout/selectionViewportRect.d.ts +6 -0
- package/dist/paged-layout/selectionViewportRect.js +8 -2
- package/dist/pdf/images.d.ts +17 -1
- package/dist/pdf/images.js +22 -4
- package/dist/pdf/writePdf.js +4 -2
- package/dist/prosemirror/attrs/index.js +2 -0
- package/dist/prosemirror/canonicalCommands.d.ts +39 -1
- package/dist/prosemirror/canonicalTableCommands.d.ts +28 -0
- package/dist/prosemirror/canonicalTableCommands.js +362 -0
- package/dist/prosemirror/commands/comments.d.ts +30 -2
- package/dist/prosemirror/commands/comments.js +189 -18
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/index.d.ts +1 -1
- package/dist/prosemirror/commentIdAllocator.js +2 -2
- package/dist/prosemirror/commentRangeBoundaryAttrs.d.ts +6 -0
- package/dist/prosemirror/commentRangeBoundaryAttrs.js +9 -3
- package/dist/prosemirror/commentRecords.d.ts +137 -0
- package/dist/prosemirror/commentRecords.js +400 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +3 -4
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +85 -34
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +140 -4
- package/dist/prosemirror/conversion/toProseDoc.js +432 -76
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +23 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +61 -32
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +5 -4
- package/dist/prosemirror/extensions/marks/CommentExtension.js +8 -3
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.d.ts +4 -0
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.js +49 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +3 -1
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +12 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +32 -31
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +1 -1
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/listLabels.js +3 -2
- package/dist/prosemirror/listNumbering.d.ts +6 -0
- package/dist/prosemirror/listNumbering.js +12 -9
- package/dist/prosemirror/lockedControls.d.ts +13 -0
- package/dist/prosemirror/lockedControls.js +106 -0
- package/dist/prosemirror/markupViewProjection.js +1 -1
- package/dist/prosemirror/nativeSelection.d.ts +33 -0
- package/dist/prosemirror/nativeSelection.js +74 -0
- package/dist/prosemirror/noteReferenceReview.js +2 -2
- package/dist/prosemirror/numberedRefFields.d.ts +2 -0
- package/dist/prosemirror/numberedRefFields.js +16 -5
- package/dist/prosemirror/paragraphMarkJoin.d.ts +6 -8
- package/dist/prosemirror/paragraphMarkJoin.js +155 -16
- package/dist/prosemirror/plugins/contentControlWidgets.js +2 -2
- package/dist/prosemirror/plugins/documentNumbering.js +37 -15
- package/dist/prosemirror/plugins/suggestionMode.js +33 -10
- package/dist/prosemirror/plugins/templatePreviewValues.js +16 -1
- package/dist/prosemirror/rebaseParagraphRuns.js +1 -1
- package/dist/prosemirror/replacedAnnotations.js +1 -0
- package/dist/prosemirror/runFormattingFromMarks.d.ts +0 -1
- package/dist/prosemirror/runFormattingFromMarks.js +2 -4
- package/dist/prosemirror/runFormattingReconciliation.js +2 -2
- package/dist/prosemirror/runIdentityAcrossRevisions.d.ts +23 -1
- package/dist/prosemirror/runIdentityAcrossRevisions.js +57 -8
- package/dist/prosemirror/runPropertyChangeResolution.js +1 -2
- package/dist/prosemirror/runStyleFormatting.d.ts +14 -4
- package/dist/prosemirror/runStyleFormatting.js +16 -13
- package/dist/prosemirror/schema/marks.d.ts +13 -1
- package/dist/prosemirror/storyListNumbering.js +7 -2
- package/dist/prosemirror/styles/paragraphStyleCascade.js +2 -2
- package/dist/prosemirror/tableResize.d.ts +10 -9
- package/dist/prosemirror/tableResize.js +60 -49
- package/dist/prosemirror/textInput.d.ts +30 -1
- package/dist/prosemirror/textInput.js +144 -17
- package/dist/prosemirror/utils/visualLineNavigation.js +20 -18
- package/dist/prosemirror/validation.d.ts +19 -0
- package/dist/prosemirror/validation.js +79 -5
- package/dist/redline.js +23 -9
- package/dist/render-dom/HeaderFooterSelectionOverlay.js +5 -4
- package/dist/render-dom/RenderedDomContext.js +7 -6
- package/dist/server.d.ts +2 -2
- package/dist/style-sets/extract.js +2 -2
- package/dist/types/canonicalCapabilities.d.ts +38 -16
- package/dist/types/canonicalCapabilities.js +21 -18
- package/dist/utils/cssString.d.ts +7 -0
- package/dist/utils/cssString.js +9 -0
- package/dist/utils/findMatchView.js +4 -3
- package/dist/utils/fontResolver.js +4 -1
- package/dist/utils/formatToStyle.d.ts +1 -1
- package/dist/utils/mergeDocumentContent.js +2 -2
- package/dist/utils/paintedPositions.d.ts +60 -0
- package/dist/utils/paintedPositions.js +101 -0
- package/dist/utils/replaceText.d.ts +11 -0
- package/dist/utils/replaceText.js +39 -7
- package/dist/version-comparison.d.ts +9 -1
- package/dist/version-comparison.js +11 -5
- package/package.json +2 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { parseSplitResolutionPiece } from "./reviewResolutionProvenance.js";
|
|
2
|
+
// src/docx/splitRevisionPieces.ts
|
|
3
|
+
/**
|
|
4
|
+
* The pieces of changes and wrappers the serializer wrote as several
|
|
5
|
+
* elements around a lifted link, by the record each was read into. The
|
|
6
|
+
* paragraph parser puts them back together once a paragraph is read.
|
|
7
|
+
*/
|
|
8
|
+
const splitPieces = /* @__PURE__ */ new WeakMap();
|
|
9
|
+
/** Record that `record` was read from `node`, a piece of a split element. */
|
|
10
|
+
const tagSplitPiece = (node, record) => {
|
|
11
|
+
const split = parseSplitResolutionPiece(node);
|
|
12
|
+
if (split !== void 0) splitPieces.set(record, split);
|
|
13
|
+
};
|
|
14
|
+
export { splitPieces, tagSplitPiece };
|
|
@@ -7,6 +7,19 @@ import { escapeXmlAttribute } from "@stll/docx-core";
|
|
|
7
7
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
8
8
|
import { getXmlSourceRange, parseStreamingXmlWithSourceRanges } from "@stll/docx-core/xml";
|
|
9
9
|
// src/docx/storyBlockReplay.ts
|
|
10
|
+
/**
|
|
11
|
+
* What a block saves as, for telling whether it changed: the block without
|
|
12
|
+
* the list marker a paragraph's numbering computes, which no save writes. An
|
|
13
|
+
* edit elsewhere in the list renumbers it; the paragraph itself is unchanged
|
|
14
|
+
* and keeps its source.
|
|
15
|
+
*/
|
|
16
|
+
const savedFingerprint = (value) => {
|
|
17
|
+
if (value === null || value === void 0) return "null";
|
|
18
|
+
if (Array.isArray(value)) return `[${value.map(savedFingerprint).join(",")}]`;
|
|
19
|
+
if (typeof value !== "object") return JSON.stringify(value) ?? "null";
|
|
20
|
+
const paragraph = "type" in value && value.type === "paragraph";
|
|
21
|
+
return `{${Object.entries(value).filter(([key, entry]) => entry !== void 0 && !(paragraph && key === "listRendering")).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${savedFingerprint(entry)}`).join(",")}}`;
|
|
22
|
+
};
|
|
10
23
|
const BLOCK_ELEMENT_NAMES = {
|
|
11
24
|
paragraph: "p",
|
|
12
25
|
table: "tbl",
|
|
@@ -15,6 +28,8 @@ const BLOCK_ELEMENT_NAMES = {
|
|
|
15
28
|
preservedBlock: null,
|
|
16
29
|
bookmarkStart: "bookmarkStart",
|
|
17
30
|
bookmarkEnd: "bookmarkEnd",
|
|
31
|
+
commentRangeStart: "commentRangeStart",
|
|
32
|
+
commentRangeEnd: "commentRangeEnd",
|
|
18
33
|
moveFromRangeStart: "moveFromRangeStart",
|
|
19
34
|
moveFromRangeEnd: "moveFromRangeEnd",
|
|
20
35
|
moveToRangeStart: "moveToRangeStart",
|
|
@@ -141,7 +156,7 @@ const replayBlocks = ({ sourceXml, baselineContent, currentContent, serializedXm
|
|
|
141
156
|
mode: "generated"
|
|
142
157
|
}))) return null;
|
|
143
158
|
const generatedRoot = scope?.generatedRoot ?? generated.root;
|
|
144
|
-
const fingerprints = baselineContent.map(
|
|
159
|
+
const fingerprints = baselineContent.map(savedFingerprint);
|
|
145
160
|
const identities = /* @__PURE__ */ new Map();
|
|
146
161
|
const byFingerprint = /* @__PURE__ */ new Map();
|
|
147
162
|
for (const [index, block] of baselineContent.entries()) {
|
|
@@ -162,7 +177,7 @@ const replayBlocks = ({ sourceXml, baselineContent, currentContent, serializedXm
|
|
|
162
177
|
const used = /* @__PURE__ */ new Set();
|
|
163
178
|
const fragments = [];
|
|
164
179
|
for (const [index, block] of currentContent.entries()) {
|
|
165
|
-
const fingerprint =
|
|
180
|
+
const fingerprint = savedFingerprint(block);
|
|
166
181
|
const identity = paragraphIdentity(block);
|
|
167
182
|
let originalIndex = takeCandidate(identity === void 0 ? void 0 : identities.get(identity), used) ?? takeCandidate(byFingerprint.get(fingerprint), used);
|
|
168
183
|
if (originalIndex === void 0 && (block.type === "table" || block.type === "blockSdt" || block.type === "blockCustomXml") && !used.has(index)) {
|
|
@@ -308,6 +323,8 @@ const replayNestedBlock = ({ sourceXml, serializedXml, sourceElement, generatedE
|
|
|
308
323
|
case "preservedBlock":
|
|
309
324
|
case "bookmarkStart":
|
|
310
325
|
case "bookmarkEnd":
|
|
326
|
+
case "commentRangeStart":
|
|
327
|
+
case "commentRangeEnd":
|
|
311
328
|
case "moveFromRangeStart":
|
|
312
329
|
case "moveFromRangeEnd":
|
|
313
330
|
case "moveToRangeStart":
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { canonicalJson } from "../utils/canonicalJson.js";
|
|
2
2
|
import { parseDocumentBody } from "./documentParser.js";
|
|
3
|
+
import { parseMarkupRangeMarker } from "./markupRangeMarker.js";
|
|
3
4
|
import { paraIdAttribute } from "./paraIdAttribute.js";
|
|
4
5
|
import { spliceSupportsRootNamespaces, spliceXml } from "./selectiveXmlPatch.js";
|
|
5
6
|
import { materializeReplayFragment } from "./storyBlockReplay.js";
|
|
@@ -70,11 +71,17 @@ function* descendants(element) {
|
|
|
70
71
|
yield element;
|
|
71
72
|
for (const child of getChildElements(element)) yield* descendants(child);
|
|
72
73
|
}
|
|
73
|
-
/**
|
|
74
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Comment anchors a splice may carry: what the spliced body holds of them is
|
|
76
|
+
* checked against the serialized body afterwards.
|
|
77
|
+
*/
|
|
78
|
+
const COMMENT_ELEMENTS = /* @__PURE__ */ new Set([
|
|
75
79
|
"commentRangeStart",
|
|
76
80
|
"commentRangeEnd",
|
|
77
|
-
"commentReference"
|
|
81
|
+
"commentReference"
|
|
82
|
+
]);
|
|
83
|
+
/** Cross-paragraph ranges require a wider edit contract than paragraph identity. */
|
|
84
|
+
const RANGE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
78
85
|
"bookmarkStart",
|
|
79
86
|
"bookmarkEnd",
|
|
80
87
|
"permStart",
|
|
@@ -133,12 +140,23 @@ const buildStructuralDocumentPatch = ({ originalXml, serializedXml, changedIds }
|
|
|
133
140
|
} else if (!isWordElement(element, "tbl") && !isWordElement(element, "sectPr")) return null;
|
|
134
141
|
const sourceBody = parseDocumentBody(originalXml);
|
|
135
142
|
const currentBody = parseDocumentBody(serializedXml);
|
|
136
|
-
const barriers = (body) => (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
const barriers = (body) => body.content.filter((block) => block.type !== "paragraph");
|
|
144
|
+
const sourceBarriers = barriers(sourceBody);
|
|
145
|
+
const currentBarriers = barriers(currentBody);
|
|
146
|
+
if (sourceBarriers.length !== currentBarriers.length || canonicalJson({
|
|
147
|
+
finalSectionProperties: sourceBody.finalSectionProperties,
|
|
148
|
+
background: sourceBody.background
|
|
149
|
+
}) !== canonicalJson({
|
|
150
|
+
finalSectionProperties: currentBody.finalSectionProperties,
|
|
151
|
+
background: currentBody.background
|
|
152
|
+
})) return null;
|
|
153
|
+
const changedTables = /* @__PURE__ */ new Set();
|
|
154
|
+
for (const [index, block] of sourceBarriers.entries()) {
|
|
155
|
+
const next = currentBarriers[index];
|
|
156
|
+
if (canonicalJson(block) === canonicalJson(next)) continue;
|
|
157
|
+
if (block.type !== "table" || next?.type !== "table") return null;
|
|
158
|
+
changedTables.add(index);
|
|
159
|
+
}
|
|
142
160
|
const indexBlocks = (blocks) => {
|
|
143
161
|
let barrier = 0;
|
|
144
162
|
const indexed = /* @__PURE__ */ new Map();
|
|
@@ -148,6 +166,7 @@ const buildStructuralDocumentPatch = ({ originalXml, serializedXml, changedIds }
|
|
|
148
166
|
}
|
|
149
167
|
return indexed;
|
|
150
168
|
};
|
|
169
|
+
const barrierOf = (key) => key.startsWith("barrier:") ? Number(key.slice(8)) : -1;
|
|
151
170
|
const before = indexBlocks(source.blocks);
|
|
152
171
|
const after = indexBlocks(current.blocks);
|
|
153
172
|
const survivingBefore = [...before.keys()].filter((key) => after.has(key));
|
|
@@ -177,7 +196,7 @@ const buildStructuralDocumentPatch = ({ originalXml, serializedXml, changedIds }
|
|
|
177
196
|
continue;
|
|
178
197
|
}
|
|
179
198
|
const id = paraIdAttribute(block.element)?.toUpperCase();
|
|
180
|
-
const replacement = id !== void 0 && changed.has(id) ? fragmentFor(block) : originalXml.slice(original.start, original.end);
|
|
199
|
+
const replacement = id !== void 0 && changed.has(id) || changedTables.has(barrierOf(key)) ? fragmentFor(block) : originalXml.slice(original.start, original.end);
|
|
181
200
|
if (replacement === null) return null;
|
|
182
201
|
if (pending.length > 0 || replacement !== originalXml.slice(original.start, original.end)) splices.push({
|
|
183
202
|
start: original.start,
|
|
@@ -198,6 +217,20 @@ const buildStructuralDocumentPatch = ({ originalXml, serializedXml, changedIds }
|
|
|
198
217
|
originalRoot: source.root,
|
|
199
218
|
serializedRoot: current.root
|
|
200
219
|
})) return null;
|
|
201
|
-
|
|
220
|
+
const patched = spliceXml(originalXml, splices);
|
|
221
|
+
if (patched === null) return null;
|
|
222
|
+
const spliced = readBody(patched);
|
|
223
|
+
if (!spliced || commentAnchors(spliced.root) !== commentAnchors(current.root)) return null;
|
|
224
|
+
return patched;
|
|
225
|
+
};
|
|
226
|
+
/** The body's comment anchors in document order, each by kind and id. */
|
|
227
|
+
const commentAnchors = (root) => {
|
|
228
|
+
const anchors = [];
|
|
229
|
+
for (const element of descendants(root)) {
|
|
230
|
+
if (!WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(element) ?? "")) continue;
|
|
231
|
+
const name = getLocalName(element.name);
|
|
232
|
+
if (COMMENT_ELEMENTS.has(name)) anchors.push(`${name}:${parseMarkupRangeMarker(element).id}`);
|
|
233
|
+
}
|
|
234
|
+
return anchors.join(" ");
|
|
202
235
|
};
|
|
203
236
|
export { buildStructuralDocumentPatch };
|
|
@@ -147,8 +147,12 @@ export declare const CELL_CONTENT_HANDLERS: {
|
|
|
147
147
|
readonly tcPr: OwnedElsewhere<"block-content", "tcPr">;
|
|
148
148
|
readonly sectPr: "capture";
|
|
149
149
|
readonly altChunk: "capture";
|
|
150
|
-
readonly commentRangeEnd:
|
|
151
|
-
|
|
150
|
+
readonly commentRangeEnd: (child: XmlElement, walk: {
|
|
151
|
+
modelled: document_d_exports.BlockContent[];
|
|
152
|
+
}) => void;
|
|
153
|
+
readonly commentRangeStart: (child: XmlElement, walk: {
|
|
154
|
+
modelled: document_d_exports.BlockContent[];
|
|
155
|
+
}) => void;
|
|
152
156
|
readonly customXmlDelRangeEnd: "capture";
|
|
153
157
|
readonly customXmlDelRangeStart: "capture";
|
|
154
158
|
readonly customXmlInsRangeEnd: "capture";
|
package/dist/docx/tableParser.js
CHANGED
|
@@ -3,7 +3,7 @@ import { blockCustomXmlShell } from "./blockCustomXmlShell.js";
|
|
|
3
3
|
import { parseBookmarkEnd, parseBookmarkStart } from "./bookmarkParser.js";
|
|
4
4
|
import { parseBorderSpec } from "./borderParser.js";
|
|
5
5
|
import { CAPTURE, dispatchChildrenWithContext, keptUnless, ownedElsewhere, sequencePositions, withPreservedChildren } from "./containerChildren.js";
|
|
6
|
-
import { BLOCK_MOVE_RANGE_MARKER_HANDLERS } from "./markupRangeMarker.js";
|
|
6
|
+
import { BLOCK_COMMENT_RANGE_MARKER_HANDLERS, BLOCK_MOVE_RANGE_MARKER_HANDLERS } from "./markupRangeMarker.js";
|
|
7
7
|
import { parseParagraph } from "./paragraphParser.js";
|
|
8
8
|
import { enrichParagraphTextBoxes } from "./paragraphTextBoxEnrichment.js";
|
|
9
9
|
import { FloatingTableXSpecSchema, FloatingTableYSpecSchema, TableAlignmentSchema, TextDirectionSchema, narrowEnum } from "./parserEnums.js";
|
|
@@ -879,11 +879,10 @@ const CELL_CONTENT_HANDLERS = {
|
|
|
879
879
|
modelled.push(parseBookmarkEnd(child));
|
|
880
880
|
},
|
|
881
881
|
...BLOCK_MOVE_RANGE_MARKER_HANDLERS,
|
|
882
|
+
...BLOCK_COMMENT_RANGE_MARKER_HANDLERS,
|
|
882
883
|
tcPr: CELL_PROPERTIES_OWNER,
|
|
883
884
|
sectPr: CAPTURE,
|
|
884
885
|
altChunk: CAPTURE,
|
|
885
|
-
commentRangeEnd: CAPTURE,
|
|
886
|
-
commentRangeStart: CAPTURE,
|
|
887
886
|
customXmlDelRangeEnd: CAPTURE,
|
|
888
887
|
customXmlDelRangeStart: CAPTURE,
|
|
889
888
|
customXmlInsRangeEnd: CAPTURE,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { NumberingMap } from "./numberingParser.js";
|
|
3
|
+
import { XmlElement } from "./xmlParser.js";
|
|
4
|
+
import { PreviewLedger } from "./previewBudget.js";
|
|
5
|
+
import { StyleMap } from "./styleParser.js";
|
|
6
|
+
import { ParagraphParserFn, TableParserFn } from "./textBoxParser.js";
|
|
7
|
+
/**
|
|
8
|
+
* Parse text box content with provided parser functions
|
|
9
|
+
* This avoids circular dependencies by accepting parser functions as parameters
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseTextBoxContent(txbxContent: XmlElement | null, parseParagraph: ParagraphParserFn, parseTable: TableParserFn | null, styles: StyleMap | null, theme: document_d_exports.Theme | null, numbering: NumberingMap | null, rels: document_d_exports.RelationshipMap | null, media: Map<string, document_d_exports.MediaFile> | null, previews: PreviewLedger): document_d_exports.TableCellBlock[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { blockCustomXmlShell } from "./blockCustomXmlShell.js";
|
|
2
|
+
import { parseBookmarkEnd, parseBookmarkStart } from "./bookmarkParser.js";
|
|
3
|
+
import { captureSdtSiblingMarkers, parseSdtProperties } from "./sdtProperties.js";
|
|
4
|
+
import { captureVerbatimXml } from "./verbatimCapture.js";
|
|
5
|
+
import { WORDPROCESSINGML_NAMESPACE_URIS, findChildByLocalName, getChildElements } from "./xmlParser.js";
|
|
6
|
+
// src/docx/textBoxContentParser.ts
|
|
7
|
+
/**
|
|
8
|
+
* Parse text box content with provided parser functions
|
|
9
|
+
* This avoids circular dependencies by accepting parser functions as parameters
|
|
10
|
+
*/
|
|
11
|
+
function parseTextBoxContent(txbxContent, parseParagraph, parseTable, styles, theme, numbering, rels, media, previews) {
|
|
12
|
+
if (!txbxContent) return [];
|
|
13
|
+
const readBlocks = (container) => {
|
|
14
|
+
const blocks = [];
|
|
15
|
+
for (const child of getChildElements(container)) {
|
|
16
|
+
const name = child.name || "";
|
|
17
|
+
const colonIdx = name.indexOf(":");
|
|
18
|
+
const localName = colonIdx !== -1 ? name.slice(colonIdx + 1) : name;
|
|
19
|
+
const isWordElement = WORDPROCESSINGML_NAMESPACE_URIS.has(child.namespaceUri ?? "");
|
|
20
|
+
if (localName === "p") blocks.push(parseParagraph(child, styles, theme, numbering, rels, media, { previews }));
|
|
21
|
+
else if (localName === "tbl" && parseTable) {
|
|
22
|
+
const table = parseTable(child, styles, theme, numbering, rels, media, { previews });
|
|
23
|
+
if (table) blocks.push(table);
|
|
24
|
+
} else if (localName === "sdt" && isWordElement) {
|
|
25
|
+
const properties = parseSdtProperties(findChildByLocalName(child, "sdtPr"), findChildByLocalName(child, "sdtEndPr"));
|
|
26
|
+
const captured = captureSdtSiblingMarkers(child);
|
|
27
|
+
if (captured.before.length > 0) properties.rawSdtChildrenBeforeContent = captured.before;
|
|
28
|
+
if (captured.after.length > 0) properties.rawSdtChildrenAfterContent = captured.after;
|
|
29
|
+
const sdtContent = findChildByLocalName(child, "sdtContent");
|
|
30
|
+
blocks.push({
|
|
31
|
+
type: "blockSdt",
|
|
32
|
+
properties,
|
|
33
|
+
content: sdtContent ? readBlocks(sdtContent) : []
|
|
34
|
+
});
|
|
35
|
+
} else if (localName === "customXml" && isWordElement) blocks.push({
|
|
36
|
+
type: "blockCustomXml",
|
|
37
|
+
...blockCustomXmlShell(child),
|
|
38
|
+
content: readBlocks(child)
|
|
39
|
+
});
|
|
40
|
+
else if (localName === "bookmarkStart" && isWordElement) blocks.push(parseBookmarkStart(child));
|
|
41
|
+
else if (localName === "bookmarkEnd" && isWordElement) blocks.push(parseBookmarkEnd(child));
|
|
42
|
+
else blocks.push({
|
|
43
|
+
type: "preservedBlock",
|
|
44
|
+
xml: captureVerbatimXml(child)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return blocks;
|
|
48
|
+
};
|
|
49
|
+
return readBlocks(txbxContent);
|
|
50
|
+
}
|
|
51
|
+
export { parseTextBoxContent };
|
|
@@ -24,11 +24,6 @@ export type ParagraphParserFn = (node: XmlElement, styles: StyleMap | null, them
|
|
|
24
24
|
export type TableParserFn = (node: XmlElement, styles: StyleMap | null, theme: document_d_exports.Theme | null, numbering: NumberingMap | null, rels: document_d_exports.RelationshipMap | null, media: Map<string, document_d_exports.MediaFile> | null, options: {
|
|
25
25
|
previews: PreviewLedger;
|
|
26
26
|
}) => document_d_exports.Table | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Parse text box content with provided parser functions
|
|
29
|
-
* This avoids circular dependencies by accepting parser functions as parameters
|
|
30
|
-
*/
|
|
31
|
-
export declare function parseTextBoxContent(txbxContent: XmlElement | null, parseParagraph: ParagraphParserFn, parseTable: TableParserFn | null, styles: StyleMap | null, theme: document_d_exports.Theme | null, numbering: NumberingMap | null, rels: document_d_exports.RelationshipMap | null, media: Map<string, document_d_exports.MediaFile> | null, previews: PreviewLedger): (document_d_exports.Paragraph | document_d_exports.Table)[];
|
|
32
27
|
/**
|
|
33
28
|
* Check if a drawing element contains a text box
|
|
34
29
|
* Text boxes are shapes with wps:txbx content
|
|
@@ -77,28 +77,6 @@ function extractTextBoxContentElements(txbxContent) {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
* Parse text box content with provided parser functions
|
|
81
|
-
* This avoids circular dependencies by accepting parser functions as parameters
|
|
82
|
-
*/
|
|
83
|
-
function parseTextBoxContent(txbxContent, parseParagraph, parseTable, styles, theme, numbering, rels, media, previews) {
|
|
84
|
-
if (!txbxContent) return [];
|
|
85
|
-
const blocks = [];
|
|
86
|
-
const children = getChildElements(txbxContent);
|
|
87
|
-
for (const child of children) {
|
|
88
|
-
const name = child.name || "";
|
|
89
|
-
const colonIdx = name.indexOf(":");
|
|
90
|
-
const localName = colonIdx !== -1 ? name.slice(colonIdx + 1) : name;
|
|
91
|
-
if (localName === "p") {
|
|
92
|
-
const paragraph = parseParagraph(child, styles, theme, numbering, rels, media, { previews });
|
|
93
|
-
blocks.push(paragraph);
|
|
94
|
-
} else if (localName === "tbl" && parseTable) {
|
|
95
|
-
const table = parseTable(child, styles, theme, numbering, rels, media, { previews });
|
|
96
|
-
if (table) blocks.push(table);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return blocks;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
80
|
* The `wp:inline` or `wp:anchor` a drawing hangs off, resolved by namespace:
|
|
103
81
|
* the `wp` prefix is the producer's choice and a package free to bind the
|
|
104
82
|
* namespace elsewhere writes the same text box.
|
|
@@ -359,4 +337,4 @@ const scanRunForTextBoxDrawings = ({ xmlRun, claimedByRunParser }) => {
|
|
|
359
337
|
hasNonTextBoxContent
|
|
360
338
|
};
|
|
361
339
|
};
|
|
362
|
-
export { extractTextBoxContentElements, getTextBoxContentElement, getTextBoxDimensionsPx, getTextBoxHeightPx, getTextBoxMarginsPx, getTextBoxOutlineWidthPx, getTextBoxWidthPx, hasTextBoxContent, hasTextBoxFill, hasTextBoxOutline, isFloatingTextBox, isShapeTextBox, isTextBoxDrawing, parseTextBox,
|
|
340
|
+
export { extractTextBoxContentElements, getTextBoxContentElement, getTextBoxDimensionsPx, getTextBoxHeightPx, getTextBoxMarginsPx, getTextBoxOutlineWidthPx, getTextBoxWidthPx, hasTextBoxContent, hasTextBoxFill, hasTextBoxOutline, isFloatingTextBox, isShapeTextBox, isTextBoxDrawing, parseTextBox, parseTextBoxFromShape, resolveTextBoxFillColor, resolveTextBoxOutlineColor, scanRunForTextBoxDrawings };
|
|
@@ -105,7 +105,7 @@ function tableCellHasMeaningfulContent(cell) {
|
|
|
105
105
|
}
|
|
106
106
|
function blockHasMeaningfulContent(block) {
|
|
107
107
|
if (block.type === "preservedBlock") return true;
|
|
108
|
-
if (block.type === "bookmarkStart" || block.type === "bookmarkEnd" || block.type === "moveFromRangeStart" || block.type === "moveFromRangeEnd" || block.type === "moveToRangeStart" || block.type === "moveToRangeEnd") return true;
|
|
108
|
+
if (block.type === "bookmarkStart" || block.type === "bookmarkEnd" || block.type === "commentRangeStart" || block.type === "commentRangeEnd" || block.type === "moveFromRangeStart" || block.type === "moveFromRangeEnd" || block.type === "moveToRangeStart" || block.type === "moveToRangeEnd") return true;
|
|
109
109
|
if (block.type === "table") return block.rows.some((row) => row.cells.some((cell) => tableCellHasMeaningfulContent(cell)));
|
|
110
110
|
if (block.type === "blockSdt" || block.type === "blockCustomXml") return true;
|
|
111
111
|
return block.content.some(paragraphContentHasMeaningfulContent);
|
package/dist/docx/xmlParser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ParseContext } from "./parseContext.js";
|
|
2
2
|
import { XmlElement, XmlNamespaceScope } from "@stll/docx-core/xml";
|
|
3
3
|
/**
|
|
4
|
-
* Common OOXML namespace URIs
|
|
4
|
+
* Common OOXML namespace URIs, from `@stll/docx-core/xml/namespaces`.
|
|
5
5
|
*/
|
|
6
6
|
export declare const NAMESPACES: {
|
|
7
7
|
readonly w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
package/dist/docx/xmlParser.js
CHANGED
|
@@ -3,8 +3,7 @@ import { universalMeasureAs } from "./universalMeasure.js";
|
|
|
3
3
|
import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
|
|
4
4
|
import { PARSE_WARNING_CODES } from "@stll/docx-core/model";
|
|
5
5
|
import { XmlReadError, readXml } from "@stll/docx-core/xml";
|
|
6
|
-
import { EMPTY_NAMESPACE_SCOPE, attachXmlNamespaceContext, resolveNamespaceUri } from "@stll/docx-core/xml/namespaces";
|
|
7
|
-
import { OOXML_NS } from "@stll/docx-utils";
|
|
6
|
+
import { EMPTY_NAMESPACE_SCOPE, OOXML_NS, attachXmlNamespaceContext, resolveNamespaceUri } from "@stll/docx-core/xml/namespaces";
|
|
8
7
|
// src/docx/xmlParser.ts
|
|
9
8
|
/**
|
|
10
9
|
* XML Parser Utilities for OOXML
|
|
@@ -27,7 +26,7 @@ import { OOXML_NS } from "@stll/docx-utils";
|
|
|
27
26
|
* - pic: Pictures
|
|
28
27
|
*/
|
|
29
28
|
/**
|
|
30
|
-
* Common OOXML namespace URIs
|
|
29
|
+
* Common OOXML namespace URIs, from `@stll/docx-core/xml/namespaces`.
|
|
31
30
|
*/
|
|
32
31
|
const NAMESPACES = OOXML_NS;
|
|
33
32
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HeadlessFontSource } from "./headlessMeasure.js";
|
|
2
2
|
import { FONTSOURCE_PACKAGES } from "./bundledFonts.js";
|
|
3
|
+
import { cssString } from "../utils/cssString.js";
|
|
3
4
|
/**
|
|
4
5
|
* Where the face files come from: `null` when the family or file is absent.
|
|
5
6
|
* Each family is a directory laid out like its `@fontsource` package;
|
|
@@ -9,13 +10,6 @@ export type FontsourceFiles = {
|
|
|
9
10
|
/** Bytes of `<relativePath>` in the family directory `<packageName>`. */
|
|
10
11
|
readonly read: (packageName: string, relativePath: string) => Uint8Array | null;
|
|
11
12
|
};
|
|
12
|
-
/**
|
|
13
|
-
* A CSS `<string>` token, quoted and escaped. A family name comes from an
|
|
14
|
-
* authored document and is emitted into a `<style>` element, so the
|
|
15
|
-
* backslash is escaped first, then the quote, and line terminators become hex
|
|
16
|
-
* escapes, which CSS strings require.
|
|
17
|
-
*/
|
|
18
|
-
export declare const cssString: (value: string) => string;
|
|
19
13
|
export type FontsourceFontFaceCssOptions = {
|
|
20
14
|
/**
|
|
21
15
|
* Families to declare beyond the names the faces answer to directly. Pass a
|
|
@@ -36,4 +30,4 @@ export type FontsourceFaces = {
|
|
|
36
30
|
};
|
|
37
31
|
/** The `@fontsource` faces, read through `files` and cached per face. */
|
|
38
32
|
export declare const createFontsourceFaces: (files: FontsourceFiles) => FontsourceFaces;
|
|
39
|
-
export { FONTSOURCE_PACKAGES };
|
|
33
|
+
export { FONTSOURCE_PACKAGES, cssString };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { bytesToDataUrl } from "../utils/base64.js";
|
|
2
|
+
import { cssString } from "../utils/cssString.js";
|
|
2
3
|
import { FONT_MAPPING } from "../utils/fontLoader.js";
|
|
3
4
|
import { parseFontFamilyList, resolveFontFamily } from "../utils/fontResolver.js";
|
|
4
5
|
import { decodeText } from "../utils/textEncoding.js";
|
|
@@ -103,13 +104,6 @@ const subtractRanges = (subject, taken) => {
|
|
|
103
104
|
};
|
|
104
105
|
const hex = (codePoint) => codePoint.toString(16).toUpperCase().padStart(4, "0");
|
|
105
106
|
const formatRangeList = (ranges) => ranges.map(([first, last]) => first === last ? `U+${hex(first)}` : `U+${hex(first)}-${hex(last)}`).join(",");
|
|
106
|
-
/**
|
|
107
|
-
* A CSS `<string>` token, quoted and escaped. A family name comes from an
|
|
108
|
-
* authored document and is emitted into a `<style>` element, so the
|
|
109
|
-
* backslash is escaped first, then the quote, and line terminators become hex
|
|
110
|
-
* escapes, which CSS strings require.
|
|
111
|
-
*/
|
|
112
|
-
const cssString = (value) => `"${value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\A ").replaceAll("\r", "\\D ").replaceAll("\f", "\\C ")}"`;
|
|
113
107
|
const FACE_VARIANTS = [
|
|
114
108
|
{
|
|
115
109
|
weight: REGULAR_WEIGHT,
|
|
@@ -337,6 +337,8 @@ const messages = { "folio": {
|
|
|
337
337
|
"editSessionTakenOver": "فتح علامة تبويب أو نافذة أو جهاز آخر هذا المستند للتعديل، لذا تم تحرير هذه الجلسة. تم الحفاظ على التغييرات المحلية غير المحفوظة؛ أعد فتح المستند للمتابعة.",
|
|
338
338
|
"editor": {
|
|
339
339
|
"accessibleName": "محرر المستندات",
|
|
340
|
+
"changeUnavailable": "لا يمكن إجراء هذا التغيير هنا بعد.",
|
|
341
|
+
"contentLocked": "هذا الجزء من المستند مقفل.",
|
|
340
342
|
"editing": "تحرير",
|
|
341
343
|
"editingDescription": "تحرير المستند مباشرةً",
|
|
342
344
|
"outlineDepthAll": "كل المستويات",
|
|
@@ -632,6 +634,7 @@ const messages = { "folio": {
|
|
|
632
634
|
"watermark": "علامة مائية"
|
|
633
635
|
},
|
|
634
636
|
"trackedChanges": {
|
|
637
|
+
"heldByLock": "يمنع عنصر تحكم محتوى مقفل قبول هذا التغيير أو رفضه.",
|
|
635
638
|
"replaced": "تم الاستبدال",
|
|
636
639
|
"unknown": "غير معروف",
|
|
637
640
|
"with": "بـ"
|