@stll/folio-core 0.44.0 → 0.46.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/__fixtures__/paragraphs.js +2 -2
- package/dist/ai-edits/apply.js +59 -19
- package/dist/ai-edits/headless.js +2 -1
- package/dist/compare/compare.js +2 -5
- package/dist/compare/content-alignment.js +78 -53
- package/dist/compare/inline-atoms.js +34 -20
- package/dist/compare/scenario.js +2 -5
- package/dist/compare/types.d.ts +9 -1
- package/dist/compare/types.js +12 -1
- package/dist/compat/eigenpal.d.ts +2 -1
- package/dist/compat/eigenpal.js +2 -1
- package/dist/content-controls/checkboxDisplay.d.ts +11 -0
- package/dist/content-controls/checkboxDisplay.js +40 -0
- package/dist/content-controls/findContentControls.js +3 -1
- package/dist/content-controls/mutateContentControls.js +21 -4
- package/dist/controller/contentControlWidgetController.d.ts +1 -0
- package/dist/controller/contentControlWidgetController.js +3 -0
- package/dist/controller/hiddenEditorApi.js +3 -1
- package/dist/controller/hiddenEditorManager.d.ts +1 -1
- package/dist/controller/hiddenEditorManager.js +6 -3
- package/dist/display-list/build/buildDisplayList.js +20 -1
- package/dist/display-list/build/imagePrimitives.d.ts +1 -1
- package/dist/display-list/build/imagePrimitives.js +3 -1
- package/dist/display-list/build/paragraphPrimitives.js +21 -2
- package/dist/display-list/dom/renderDisplayListToDom.js +18 -10
- package/dist/display-list/types.d.ts +17 -0
- package/dist/document-operations.js +14 -3
- package/dist/docx/attributeRemainder.d.ts +43 -0
- package/dist/docx/attributeRemainder.js +65 -0
- package/dist/docx/blockContentParser.d.ts +1 -1
- package/dist/docx/blockContentParser.js +87 -63
- package/dist/docx/blockPlainText.d.ts +3 -4
- package/dist/docx/blockPlainText.js +1 -0
- package/dist/docx/bookmarkPlacement.js +2 -0
- package/dist/docx/borderParser.js +5 -5
- package/dist/docx/commentAnchorIndex.d.ts +30 -0
- package/dist/docx/commentAnchorIndex.js +50 -0
- package/dist/docx/commentParser.d.ts +1 -1
- package/dist/docx/commentParser.js +78 -50
- package/dist/docx/commentRangeIntegrity.d.ts +16 -1
- package/dist/docx/commentRangeIntegrity.js +42 -1
- package/dist/docx/commentRangeJoin.d.ts +9 -0
- package/dist/docx/commentRangeJoin.js +33 -0
- package/dist/docx/commentReferenceCompletion.d.ts +9 -0
- package/dist/docx/commentReferenceCompletion.js +47 -0
- package/dist/docx/commentReferenceNormalization.js +1 -0
- package/dist/docx/commentReplyMarkers.js +11 -19
- package/dist/docx/commentThreadKey.d.ts +18 -0
- package/dist/docx/commentThreadKey.js +22 -0
- package/dist/docx/compatibility.js +1 -0
- package/dist/docx/containerChildren.d.ts +111 -0
- package/dist/docx/containerChildren.gen.d.ts +28 -0
- package/dist/docx/containerChildren.gen.js +246 -0
- package/dist/docx/containerChildren.js +103 -0
- package/dist/docx/diagramPreview.js +87 -27
- package/dist/docx/documentParser.d.ts +1 -1
- package/dist/docx/documentParser.js +3 -3
- package/dist/docx/ensureParaIds.js +17 -7
- package/dist/docx/fieldParser.d.ts +1 -1
- package/dist/docx/fieldParser.js +4 -4
- package/dist/docx/fieldState.d.ts +26 -0
- package/dist/docx/fieldState.js +53 -0
- package/dist/docx/footnoteParser.d.ts +1 -1
- package/dist/docx/graphicFrameLocks.d.ts +16 -4
- package/dist/docx/graphicFrameLocks.js +19 -6
- package/dist/docx/groupDrawingParser.js +3 -3
- package/dist/docx/headerFooterParser.js +1 -1
- package/dist/docx/headerFooterReferenceNormalization.js +1 -0
- package/dist/docx/hyperlinkParser.d.ts +27 -8
- package/dist/docx/hyperlinkParser.js +78 -20
- package/dist/docx/imageParser.d.ts +9 -1
- package/dist/docx/imageParser.js +91 -20
- package/dist/docx/imageRawXml.d.ts +14 -1
- package/dist/docx/imageRawXml.js +30 -6
- package/dist/docx/inlineWrapperContent.d.ts +85 -0
- package/dist/docx/inlineWrapperContent.js +84 -0
- package/dist/docx/mathToMathml.js +12 -14
- package/dist/docx/nonVisualDrawingProps.d.ts +34 -0
- package/dist/docx/nonVisualDrawingProps.js +46 -0
- package/dist/docx/normalizeBaseDirection.js +10 -1
- package/dist/docx/paraIdAttribute.d.ts +21 -0
- package/dist/docx/paraIdAttribute.js +64 -0
- package/dist/docx/paragraphParser.d.ts +1 -1
- package/dist/docx/paragraphParser.js +277 -168
- package/dist/docx/paragraphPropertySource.js +5 -1
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +1 -1
- package/dist/docx/paragraphTextBoxEnrichment.js +9 -52
- package/dist/docx/paragraphTraversal.js +7 -4
- package/dist/docx/parseWarningMessage.js +2 -1
- package/dist/docx/parser.js +2 -2
- package/dist/docx/preservedRunContent.d.ts +32 -0
- package/dist/docx/preservedRunContent.js +86 -0
- package/dist/docx/previewBudget.d.ts +64 -0
- package/dist/docx/previewBudget.js +88 -0
- package/dist/docx/renderedPageBreakNormalization.js +2 -4
- package/dist/docx/revisionIdNormalization.js +17 -5
- package/dist/docx/rezip.js +91 -36
- package/dist/docx/runParser.d.ts +1 -1
- package/dist/docx/runParser.js +16 -12
- package/dist/docx/sdtPropertiesPatch.js +24 -18
- package/dist/docx/sectionParser.js +8 -1
- package/dist/docx/sectionReferenceHistory.js +2 -2
- package/dist/docx/selectiveSave.js +6 -6
- package/dist/docx/selectiveXmlPatch.d.ts +46 -2
- package/dist/docx/selectiveXmlPatch.js +86 -39
- package/dist/docx/serializer/blockSdtSerializer.js +38 -26
- package/dist/docx/serializer/borderSerializer.d.ts +1 -1
- package/dist/docx/serializer/borderSerializer.js +15 -14
- package/dist/docx/serializer/commentSerializer.d.ts +41 -16
- package/dist/docx/serializer/commentSerializer.js +87 -92
- package/dist/docx/serializer/documentSerializer.js +8 -11
- package/dist/docx/serializer/fontTableSerializer.js +6 -6
- package/dist/docx/serializer/headerFooterSerializer.js +12 -14
- package/dist/docx/serializer/markupRangeAttributes.js +2 -2
- package/dist/docx/serializer/noteSerializer.js +8 -8
- package/dist/docx/serializer/numberingSerializer.js +7 -6
- package/dist/docx/serializer/paragraphSerializer.js +93 -72
- package/dist/docx/serializer/partNamespaces.js +2 -2
- package/dist/docx/serializer/runSerializer.js +73 -44
- package/dist/docx/serializer/sectionPropertiesSerializer.js +19 -14
- package/dist/docx/serializer/settingsSerializer.js +4 -3
- package/dist/docx/serializer/stylesSerializer.js +6 -6
- package/dist/docx/serializer/tableSerializer.js +28 -17
- package/dist/docx/serializer/textFormattingSerializer.js +29 -28
- package/dist/docx/serializer/themeSerializer.js +6 -6
- package/dist/docx/serializer/trackedChangeAttributes.js +2 -2
- package/dist/docx/serializer/xmlUtils.d.ts +1 -2
- package/dist/docx/serializer/xmlUtils.js +1 -13
- package/dist/docx/server/boundedArchive.d.ts +12 -0
- package/dist/docx/server/boundedArchive.js +20 -1
- package/dist/docx/server/createBilingualDocument.js +3 -1
- package/dist/docx/server/materializeYjsDocx.d.ts +1 -1
- package/dist/docx/server/materializeYjsDocx.js +9 -1
- package/dist/docx/server/migrateYjsAttrSchema.d.ts +55 -0
- package/dist/docx/server/migrateYjsAttrSchema.js +95 -0
- package/dist/docx/server/validateDocxConformance.js +22 -1
- package/dist/docx/shapeParser.js +12 -10
- package/dist/docx/tableParser.d.ts +1 -1
- package/dist/docx/tableParser.js +206 -85
- package/dist/docx/textBoxParser.d.ts +25 -2
- package/dist/docx/textBoxParser.js +59 -4
- package/dist/docx/unzip.d.ts +23 -0
- package/dist/docx/unzip.js +37 -26
- package/dist/docx/verbatimCapture.js +1 -1
- package/dist/docx/vmlImageParser.d.ts +17 -1
- package/dist/docx/vmlImageParser.js +20 -3
- package/dist/docx/vmlPreview.d.ts +1 -3
- package/dist/docx/vmlPreview.js +2 -30
- package/dist/docx/xmlEncoding.d.ts +5 -0
- package/dist/docx/xmlEncoding.js +12 -0
- package/dist/docx/xmlParser.d.ts +26 -2
- package/dist/docx/xmlParser.js +70 -27
- package/dist/docx/xmlResourceLimits.d.ts +89 -9
- package/dist/docx/xmlResourceLimits.js +105 -24
- package/dist/headless-layout.js +10 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +5 -2
- package/dist/internal/paragraphFormattingSerialization.js +3 -2
- package/dist/layout-bridge/convert/toFlowBlocks.js +102 -12
- package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
- package/dist/layout-engine/measure/tableCellFloating.js +2 -0
- package/dist/layout-engine/types.d.ts +23 -1
- package/dist/layout-painter/renderImage.d.ts +5 -1
- package/dist/layout-painter/renderImage.js +14 -6
- package/dist/layout-painter/renderPage.d.ts +2 -0
- package/dist/layout-painter/renderPage.js +4 -0
- package/dist/layout-painter/renderParagraph.d.ts +13 -1
- package/dist/layout-painter/renderParagraph.js +26 -6
- package/dist/managers/autoSaveCodec.d.ts +9 -1
- package/dist/managers/autoSaveCodec.js +14 -12
- package/dist/markdown/images.js +1 -4
- package/dist/markdown/renderBlock.js +1 -0
- package/dist/markdown/renderRuns.d.ts +1 -1
- package/dist/markdown/renderRuns.js +28 -5
- package/dist/markdown/renderTable.js +22 -5
- package/dist/markdown/trailers.js +4 -1
- package/dist/pdf/images.js +142 -6
- package/dist/prosemirror/attrs/index.d.ts +14 -3
- package/dist/prosemirror/attrs/index.js +224 -2
- package/dist/prosemirror/authoredTransformAttrs.d.ts +28 -0
- package/dist/prosemirror/authoredTransformAttrs.js +64 -0
- package/dist/prosemirror/commands/contentControls.js +10 -2
- package/dist/prosemirror/commands/image.d.ts +9 -2
- package/dist/prosemirror/commands/image.js +43 -28
- package/dist/prosemirror/commands/pageBreak.js +1 -1
- package/dist/prosemirror/commentReferenceAttrs.d.ts +8 -0
- package/dist/prosemirror/commentReferenceAttrs.js +33 -0
- package/dist/prosemirror/commentReferenceIntegrity.d.ts +47 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +43 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -13
- package/dist/prosemirror/conversion/fromProseDoc.js +338 -99
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +7 -9
- package/dist/prosemirror/conversion/toProseDoc.js +551 -327
- package/dist/prosemirror/extensions/StarterKit.js +8 -58
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -1
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +45 -27
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -1
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +5 -3
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +1 -0
- package/dist/prosemirror/extensions/markRegistry.d.ts +41 -0
- package/dist/prosemirror/extensions/markRegistry.js +75 -0
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +2 -3
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +18 -0
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +63 -0
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +47 -4
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +87 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +9 -7
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +20 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +32 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +67 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +60 -0
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +10 -2
- package/dist/prosemirror/extensions/nodes/TableExtension.js +3 -2
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +13 -5
- package/dist/prosemirror/inlineWrapperStack.d.ts +39 -0
- package/dist/prosemirror/inlineWrapperStack.js +75 -0
- package/dist/prosemirror/pageBreakRunProjection.d.ts +17 -7
- package/dist/prosemirror/pageBreakRunProjection.js +19 -9
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +6 -3
- package/dist/prosemirror/paragraphFormattingProvenance.js +12 -3
- package/dist/prosemirror/replacedAnnotations.d.ts +59 -0
- package/dist/prosemirror/replacedAnnotations.js +165 -0
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +3 -1
- package/dist/prosemirror/runFormattingInlineCarriers.js +5 -1
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/marks.d.ts +25 -1
- package/dist/prosemirror/schema/nodes.d.ts +139 -3
- package/dist/prosemirror/schema/nodes.js +16 -1
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
- package/dist/prosemirror/validation.js +16 -2
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +73 -0
- package/dist/prosemirror/yjsDocumentMetadata.js +171 -0
- package/dist/prosemirror/zeroWidthAnchors.js +2 -0
- package/dist/render-dom/commentAnchorAttributes.d.ts +37 -0
- package/dist/render-dom/commentAnchorAttributes.js +54 -0
- package/dist/server.d.ts +3 -1
- package/dist/server.js +3 -1
- package/dist/types/content.d.ts +2 -2
- package/dist/utils/base64.d.ts +36 -0
- package/dist/utils/base64.js +40 -0
- package/dist/utils/clipboard.d.ts +9 -1
- package/dist/utils/clipboard.js +29 -2
- package/dist/utils/findReplace.js +1 -1
- package/dist/utils/imageLuminance.d.ts +15 -0
- package/dist/utils/imageLuminance.js +32 -0
- package/dist/utils/mergeDocumentContent.js +7 -17
- package/dist/utils/replaceText.js +1 -0
- package/dist/utils/units.d.ts +10 -1
- package/dist/utils/units.js +12 -1
- package/dist/utils/urlSecurity.d.ts +8 -2
- package/dist/utils/urlSecurity.js +21 -3
- package/package.json +2 -2
- package/dist/docx/blockRangeMarkers.d.ts +0 -36
- package/dist/docx/blockRangeMarkers.js +0 -59
- package/dist/prosemirror/yjsParagraphSourceContract.d.ts +0 -9
- package/dist/prosemirror/yjsParagraphSourceContract.js +0 -26
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/render-dom/commentAnchorAttributes.ts
|
|
2
|
+
/**
|
|
3
|
+
* How a painted run advertises which comments it sits inside.
|
|
4
|
+
*
|
|
5
|
+
* Comment ranges overlap: a run covered by two `w:commentRangeStart` /
|
|
6
|
+
* `w:commentRangeEnd` pairs belongs to both, and hover styling, the active
|
|
7
|
+
* highlight and the sidebar anchor all have to see both memberships.
|
|
8
|
+
*
|
|
9
|
+
* `data-comment-id` carries the first id, which is what every existing reader
|
|
10
|
+
* scrolls to and what keeps a single-range run's DOM exactly as the painter
|
|
11
|
+
* emitted it before. `data-comment-ids` carries the whole membership and is
|
|
12
|
+
* written only when there is more than one id. Readers ask through the
|
|
13
|
+
* helpers here instead of reading either attribute, so the two spellings
|
|
14
|
+
* cannot come to answer differently.
|
|
15
|
+
*/
|
|
16
|
+
/** Attribute carrying the run's first comment id. */
|
|
17
|
+
const PRIMARY_ATTRIBUTE = "data-comment-id";
|
|
18
|
+
/** Attribute carrying every comment id the run is inside, space separated. */
|
|
19
|
+
const MEMBERSHIP_ATTRIBUTE = "data-comment-ids";
|
|
20
|
+
/** The painted anchors inside a container, whichever comment they belong to. */
|
|
21
|
+
const COMMENT_ANCHOR_SELECTOR = `[${PRIMARY_ATTRIBUTE}]`;
|
|
22
|
+
/** Record the comments a painted run sits inside. */
|
|
23
|
+
const writeCommentAnchorIds = (element, commentIds) => {
|
|
24
|
+
const primary = commentIds.at(0);
|
|
25
|
+
if (primary === void 0) return;
|
|
26
|
+
element.dataset["commentId"] = String(primary);
|
|
27
|
+
if (commentIds.length > 1) element.dataset["commentIds"] = commentIds.join(" ");
|
|
28
|
+
};
|
|
29
|
+
/** Every comment id a painted anchor sits inside, first id first. */
|
|
30
|
+
const commentAnchorIds = (element) => {
|
|
31
|
+
const membership = element.dataset["commentIds"];
|
|
32
|
+
if (membership !== void 0 && membership.length > 0) return membership.split(" ");
|
|
33
|
+
const primary = element.dataset["commentId"];
|
|
34
|
+
return primary === void 0 || primary.length === 0 ? [] : [primary];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Selector for every painted anchor inside one comment, optionally scoped.
|
|
38
|
+
*
|
|
39
|
+
* `comment.id` is typed as a number, but a controlled `comments` prop supplied
|
|
40
|
+
* by the host app is not runtime-checked, so the value is escaped before it is
|
|
41
|
+
* spliced into the selector.
|
|
42
|
+
*/
|
|
43
|
+
const commentAnchorSelector = (id, scope = "") => {
|
|
44
|
+
const value = CSS.escape(String(id));
|
|
45
|
+
return `${scope}[${PRIMARY_ATTRIBUTE}="${value}"], ${scope}[${MEMBERSHIP_ATTRIBUTE}~="${value}"]`;
|
|
46
|
+
};
|
|
47
|
+
/** First painted anchor per comment id, in one pass over `container`. */
|
|
48
|
+
const indexCommentAnchors = (container) => {
|
|
49
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
50
|
+
for (const element of container.querySelectorAll(COMMENT_ANCHOR_SELECTOR)) for (const id of commentAnchorIds(element)) if (!anchors.has(id)) anchors.set(id, element);
|
|
51
|
+
return anchors;
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { COMMENT_ANCHOR_SELECTOR, commentAnchorIds, commentAnchorSelector, indexCommentAnchors, writeCommentAnchorIds };
|
package/dist/server.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { CreateEmptyDocumentOptions, createEmptyDocument } from "./utils/createD
|
|
|
11
11
|
import { DocumentStyleCatalog, DocumentStyleCatalogEntry, ExtractDocumentStyleSetOptions, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, inspectDocumentStyles, inspectDocumentStylesFromDocx } from "./style-sets/extract.js";
|
|
12
12
|
import { STELLA_STYLE_SET_NAME, createStellaStyleDocumentPreset, createStellaStyleSet } from "./style-sets/stellaStyle.js";
|
|
13
13
|
import { DocumentPropertiesOptions, createDocx } from "./docx/rezip.js";
|
|
14
|
+
import { FOLIO_YJS_ATTR_SCHEMA_VERSION, FolioYjsAttrSchemaVersion, FolioYjsAttrSchemaVersionError } from "./prosemirror/yjsDocumentMetadata.js";
|
|
14
15
|
import { EnsureParaIdsError, EnsureParaIdsOptions, EnsureParaIdsResult, ensureParaIds } from "./docx/ensureParaIds.js";
|
|
15
16
|
import { FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FolioDocumentMetadataProperty, FolioDocumentPrivacyArchiveError, FolioDocumentPrivacyOptions, FolioDocumentPrivacyReport, FolioDocumentPrivacyTransform, InvalidFolioDocumentPrivacyOptionsError, RewriteDocxMetadataPrivacyResult, isFolioDocumentPrivacyTransform, rewriteDocxMetadataPrivacy } from "./docx/metadataPrivacy.js";
|
|
16
17
|
import { ParseOptions, parseDocx } from "./docx/parser.js";
|
|
@@ -26,6 +27,7 @@ import { docxToMarkdown } from "./docx/server/docxToMarkdown.js";
|
|
|
26
27
|
import { DocxParagraphSource, DocxTableRowKind, DocxTableRowPosition, ExtractedDocxParagraph, ExtractedDocxTableCell, ExtractedDocxTableCellParagraph, ExtractedDocxText, extractDocxText } from "./docx/server/extractDocxText.js";
|
|
27
28
|
import { FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FolioDocxInspectedXmlPart, FolioDocxPackageInspection, FolioDocxPackageInspectionError, FolioDocxPackageInspectionErrorCode, FolioDocxPackageInspectionLimits, FolioDocxPackagePart, FolioDocxPackagePartKind, InspectDocxPackageOptions, inspectDocxPackage } from "./docx/server/inspectDocxPackage.js";
|
|
28
29
|
import { FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, FolioYjsDocxMaterializationError, FolioYjsDocxMaterializationErrorCode, MaterializeYjsDocxOptions, materializeYjsDocx } from "./docx/server/materializeYjsDocx.js";
|
|
30
|
+
import { FOLIO_YJS_SNAPSHOT_MIGRATION_ERROR_CODES, FolioYjsSnapshotMigrationError, FolioYjsSnapshotMigrationErrorCode, FolioYjsSnapshotMigrationResult, migrateFolioYjsSnapshot } from "./docx/server/migrateYjsAttrSchema.js";
|
|
29
31
|
import { GenerateRedlineDocxOptions, GenerateRedlineDocxResult, GenerateRedlineUnprocessedStory, InvalidGenerateRedlineDocxOptionsError, generateRedlineDocx } from "./redline.js";
|
|
30
32
|
import { FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FolioBlockDiff, FolioBlockProperty, FolioCompareDocxVersionsOptions, FolioDocumentMetadataValue, FolioFormatProperty, FolioMetadataDiff, FolioStoryDiff, FolioVersionBlockHandle, FolioVersionChangeProperty, FolioVersionComparisonPrivacyTransform, FolioVersionComparisonScope, FolioVersionDiff, FolioVersionDiffPrivacyOptions, FolioVersionDiffPrivacyReport, FolioVersionDiffSegment, FolioVersionDiffSummaryCounts, InvalidFolioVersionComparisonOptionsError, applyFolioVersionDiffPrivacy, compareDocxVersions, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope } from "./version-comparison.js";
|
|
31
|
-
export { type ApplyDocxXmlPatchProposalArgs, type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, BILINGUAL_TABLE_LAYOUTS, type BilingualBorders, type BilingualParagraphRef, type BilingualRow, type BilingualRowKind, type BilingualTableLayout, type BilingualTableParagraphRef, type CreateBilingualDocumentOptions, type CreateBilingualDocumentResult, type CreateBilingualDocxOptions, type CreateBilingualDocxResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, DocxArchiveError, type DocxArchiveOptions, type DocxParagraphSource, type DocxTableRowKind, type DocxTableRowPosition, EnsureParaIdsError, type EnsureParaIdsOptions, type EnsureParaIdsResult, type EvaluateDocxXmlPatchProposalArgs, type ExtractDocumentStyleSetOptions, type ExtractedDocxParagraph, type ExtractedDocxTableCell, type ExtractedDocxTableCellParagraph, type ExtractedDocxText, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyDocumentOperationsToStoryOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioBlockProperty, type FolioCompareDocxVersionsOptions, type FolioContentParagraphKind, type FolioDocumentMetadataProperty, type FolioDocumentMetadataValue, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationBatchPrecondition, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationQueuedOperation, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, FolioDocumentPrivacyArchiveError, type FolioDocumentPrivacyOptions, type FolioDocumentPrivacyReport, type FolioDocumentPrivacyTransform, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioDocxConformanceCheck, type FolioDocxConformanceCheckId, type FolioDocxConformanceCheckStatus, type FolioDocxConformanceIssue, type FolioDocxConformanceIssueCode, type FolioDocxConformanceReport, type FolioDocxConformanceStatus, type FolioDocxInspectedXmlPart, type FolioDocxPackageInspection, FolioDocxPackageInspectionError, type FolioDocxPackageInspectionErrorCode, type FolioDocxPackageInspectionLimits, type FolioDocxPackagePart, type FolioDocxPackagePartKind, type FolioDocxPreparedXmlReplacement, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, type FolioDocxXmlPatchApplicationReceipt, type FolioDocxXmlPatchProposal, type FolioDocxXmlPatchProposalEvaluation, type FolioDocxXmlPatchProposalIssue, type FolioDocxXmlPatchProposalIssueCode, type FolioDocxXmlPatchProposalLimits, type FolioDocxXmlReplacement, type FolioEditableDocumentStoryHandle, type FolioFormatProperty, type FolioMetadataDiff, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioReviewedStory, type FolioReviewedView, type FolioStoryDiff, type FolioVersionBlockHandle, type FolioVersionChangeProperty, type FolioVersionComparisonPrivacyTransform, type FolioVersionComparisonScope, type FolioVersionDiff, type FolioVersionDiffPrivacyOptions, type FolioVersionDiffPrivacyReport, type FolioVersionDiffSegment, type FolioVersionDiffSummaryCounts, FolioYjsDocxMaterializationError, type FolioYjsDocxMaterializationErrorCode, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, type GenerateRedlineUnprocessedStory, HEADING_LEVELS, type HeadingLevel, type InspectDocxPackageOptions, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, type MaterializeYjsDocxOptions, type ParseOptions, type RewriteDocxMetadataPrivacyResult, STELLA_STYLE_SET_NAME, type TableCellSpec, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, type ValidateDocxConformanceOptions, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
|
|
33
|
+
export { type ApplyDocxXmlPatchProposalArgs, type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, BILINGUAL_TABLE_LAYOUTS, type BilingualBorders, type BilingualParagraphRef, type BilingualRow, type BilingualRowKind, type BilingualTableLayout, type BilingualTableParagraphRef, type CreateBilingualDocumentOptions, type CreateBilingualDocumentResult, type CreateBilingualDocxOptions, type CreateBilingualDocxResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, DocxArchiveError, type DocxArchiveOptions, type DocxParagraphSource, type DocxTableRowKind, type DocxTableRowPosition, EnsureParaIdsError, type EnsureParaIdsOptions, type EnsureParaIdsResult, type EvaluateDocxXmlPatchProposalArgs, type ExtractDocumentStyleSetOptions, type ExtractedDocxParagraph, type ExtractedDocxTableCell, type ExtractedDocxTableCellParagraph, type ExtractedDocxText, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_ATTR_SCHEMA_VERSION, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_SNAPSHOT_MIGRATION_ERROR_CODES, FOLIO_YJS_UPDATE_MAX_BYTES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyDocumentOperationsToStoryOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioBlockProperty, type FolioCompareDocxVersionsOptions, type FolioContentParagraphKind, type FolioDocumentMetadataProperty, type FolioDocumentMetadataValue, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationBatchPrecondition, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationQueuedOperation, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, FolioDocumentPrivacyArchiveError, type FolioDocumentPrivacyOptions, type FolioDocumentPrivacyReport, type FolioDocumentPrivacyTransform, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioDocxConformanceCheck, type FolioDocxConformanceCheckId, type FolioDocxConformanceCheckStatus, type FolioDocxConformanceIssue, type FolioDocxConformanceIssueCode, type FolioDocxConformanceReport, type FolioDocxConformanceStatus, type FolioDocxInspectedXmlPart, type FolioDocxPackageInspection, FolioDocxPackageInspectionError, type FolioDocxPackageInspectionErrorCode, type FolioDocxPackageInspectionLimits, type FolioDocxPackagePart, type FolioDocxPackagePartKind, type FolioDocxPreparedXmlReplacement, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, type FolioDocxXmlPatchApplicationReceipt, type FolioDocxXmlPatchProposal, type FolioDocxXmlPatchProposalEvaluation, type FolioDocxXmlPatchProposalIssue, type FolioDocxXmlPatchProposalIssueCode, type FolioDocxXmlPatchProposalLimits, type FolioDocxXmlReplacement, type FolioEditableDocumentStoryHandle, type FolioFormatProperty, type FolioMetadataDiff, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioReviewedStory, type FolioReviewedView, type FolioStoryDiff, type FolioVersionBlockHandle, type FolioVersionChangeProperty, type FolioVersionComparisonPrivacyTransform, type FolioVersionComparisonScope, type FolioVersionDiff, type FolioVersionDiffPrivacyOptions, type FolioVersionDiffPrivacyReport, type FolioVersionDiffSegment, type FolioVersionDiffSummaryCounts, type FolioYjsAttrSchemaVersion, FolioYjsAttrSchemaVersionError, FolioYjsDocxMaterializationError, type FolioYjsDocxMaterializationErrorCode, FolioYjsSnapshotMigrationError, type FolioYjsSnapshotMigrationErrorCode, type FolioYjsSnapshotMigrationResult, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, type GenerateRedlineUnprocessedStory, HEADING_LEVELS, type HeadingLevel, type InspectDocxPackageOptions, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, type MaterializeYjsDocxOptions, type ParseOptions, type RewriteDocxMetadataPrivacyResult, STELLA_STYLE_SET_NAME, type TableCellSpec, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, type ValidateDocxConformanceOptions, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, migrateFolioYjsSnapshot, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
|
package/dist/server.js
CHANGED
|
@@ -17,7 +17,9 @@ import { FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_I
|
|
|
17
17
|
import { extractDocxText } from "./docx/server/extractDocxText.js";
|
|
18
18
|
import { FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FolioDocxPackageInspectionError, inspectDocxPackage } from "./docx/server/inspectDocxPackage.js";
|
|
19
19
|
import { FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, FolioYjsDocxMaterializationError, materializeYjsDocx } from "./docx/server/materializeYjsDocx.js";
|
|
20
|
+
import { FOLIO_YJS_SNAPSHOT_MIGRATION_ERROR_CODES, FolioYjsSnapshotMigrationError, migrateFolioYjsSnapshot } from "./docx/server/migrateYjsAttrSchema.js";
|
|
20
21
|
import { FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, validateDocxConformance } from "./docx/server/validateDocxConformance.js";
|
|
22
|
+
import { FOLIO_YJS_ATTR_SCHEMA_VERSION, FolioYjsAttrSchemaVersionError } from "./prosemirror/yjsDocumentMetadata.js";
|
|
21
23
|
import { InvalidGenerateRedlineDocxOptionsError, generateRedlineDocx } from "./redline.js";
|
|
22
24
|
import { extractDocumentStyleSet, extractDocumentStyleSetFromDocx, inspectDocumentStyles, inspectDocumentStylesFromDocx } from "./style-sets/extract.js";
|
|
23
25
|
import { STELLA_STYLE_SET_NAME, createStellaStyleDocumentPreset, createStellaStyleSet } from "./style-sets/stellaStyle.js";
|
|
@@ -25,4 +27,4 @@ import { DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION } from "./style-set
|
|
|
25
27
|
import { deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
|
|
26
28
|
import { createEmptyDocument } from "./utils/createDocument.js";
|
|
27
29
|
import { FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, InvalidFolioVersionComparisonOptionsError, applyFolioVersionDiffPrivacy, compareDocxVersions, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope } from "./version-comparison.js";
|
|
28
|
-
export { BILINGUAL_TABLE_LAYOUTS, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DocxArchiveError, EnsureParaIdsError, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_UPDATE_MAX_BYTES, FolioDocumentPrivacyArchiveError, FolioDocumentStoryNotFoundError, FolioDocxPackageInspectionError, FolioDocxReviewer, FolioDocxXmlPatchApplicationError, FolioYjsDocxMaterializationError, HEADING_LEVELS, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
|
|
30
|
+
export { BILINGUAL_TABLE_LAYOUTS, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DocxArchiveError, EnsureParaIdsError, FOLIO_DOCUMENT_METADATA_PROPERTIES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FOLIO_YJS_ATTR_SCHEMA_VERSION, FOLIO_YJS_DOCX_MATERIALIZATION_ERROR_CODES, FOLIO_YJS_PROSEMIRROR_FRAGMENT_NAME, FOLIO_YJS_SNAPSHOT_MIGRATION_ERROR_CODES, FOLIO_YJS_UPDATE_MAX_BYTES, FolioDocumentPrivacyArchiveError, FolioDocumentStoryNotFoundError, FolioDocxPackageInspectionError, FolioDocxReviewer, FolioDocxXmlPatchApplicationError, FolioYjsAttrSchemaVersionError, FolioYjsDocxMaterializationError, FolioYjsSnapshotMigrationError, HEADING_LEVELS, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, materializeYjsDocx, migrateFolioYjsSnapshot, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
|
package/dist/types/content.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BlockContent,
|
|
2
|
-
export type { BlockContent,
|
|
1
|
+
import { BlockContent, BlockSdt, BookmarkEnd, BookmarkStart, BreakContent, Column, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, ComplexField, Deletion, DisplacedByCustomXml, DocumentBody, DrawingContent, DrawingRawXmlMode, Endnote, EndnotePosition, EndnoteProperties, Field, FieldCharContent, FieldType, FooterReference, Footnote, FootnotePosition, FootnoteProperties, HeaderFooter, HeaderFooterType, HeaderReference, Hyperlink, Image, ImageCrop, ImagePadding, ImagePosition, ImageSize, ImageTransform, ImageWrap, InlineSdt, Insertion, InstrTextContent, LineNumberRestart, MathEquation, MoveFrom, MoveFromRangeEnd, MoveFromRangeStart, MoveTo, MoveToRangeEnd, MoveToRangeStart, NoBreakHyphenContent, NoteNumberRestart, NoteReferenceContent, PageOrientation, Paragraph, ParagraphContent, ParagraphPropertyChange, PositionalTab, PreservedAttribute, PreservedBlock, PreservedInline, PropertyChangeInfo, Run, RunContent, RunPropertyChange, SdtProperties, SdtType, Section, SectionProperties, SectionStart, Shape, ShapeContent, ShapeFill, ShapeGeometryAdjustment, ShapeOutline, ShapeTextBody, ShapeType, SimpleField, SoftHyphenContent, SymbolContent, TabContent, Table, TableCell, TableCellBlock, TableCellPropertyChange, TableRow, TableRowPropertyChange, TableStructuralChangeInfo, TextBox, TextContent, TrackedChangeInfo, TrackedRunChange, TrackedRunContent, VerticalAlign } from "@stll/docx-core/model";
|
|
2
|
+
export type { BlockContent, BlockSdt, BookmarkEnd, BookmarkStart, BreakContent, Column, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, ComplexField, Deletion, DisplacedByCustomXml, DocumentBody, DrawingContent, DrawingRawXmlMode, Endnote, EndnotePosition, EndnoteProperties, Field, FieldCharContent, FieldType, FooterReference, Footnote, FootnotePosition, FootnoteProperties, HeaderFooter, HeaderFooterType, HeaderReference, Hyperlink, Image, ImageCrop, ImagePadding, ImagePosition, ImageSize, ImageTransform, ImageWrap, InlineSdt, Insertion, InstrTextContent, LineNumberRestart, MathEquation, MoveFrom, MoveFromRangeEnd, MoveFromRangeStart, MoveTo, MoveToRangeEnd, MoveToRangeStart, NoBreakHyphenContent, NoteNumberRestart, NoteReferenceContent, PageOrientation, Paragraph, ParagraphContent, ParagraphPropertyChange, PositionalTab, PreservedAttribute, PreservedBlock, PreservedInline, PropertyChangeInfo, Run, RunContent, RunPropertyChange, SdtProperties, SdtType, Section, SectionProperties, SectionStart, Shape, ShapeContent, ShapeFill, ShapeGeometryAdjustment, ShapeOutline, ShapeTextBody, ShapeType, SimpleField, SoftHyphenContent, SymbolContent, TabContent, Table, TableCell, TableCellBlock, TableCellPropertyChange, TableRow, TableRowPropertyChange, TableStructuralChangeInfo, TextBox, TextContent, TrackedChangeInfo, TrackedRunChange, TrackedRunContent, VerticalAlign };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/utils/base64.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The package's one bytes-to-base64 encoder.
|
|
4
|
+
*
|
|
5
|
+
* Every call site that spelled this itself got a different answer to the same
|
|
6
|
+
* two questions, and one of them got the first question wrong:
|
|
7
|
+
*
|
|
8
|
+
* - `btoa(new TextDecoder("latin1").decode(bytes))` is not a binary string.
|
|
9
|
+
* The Encoding standard maps the `latin1` label to windows-1252, so bytes
|
|
10
|
+
* 0x80-0x9F decode to characters outside Latin-1 and `btoa` throws
|
|
11
|
+
* `InvalidCharacterError` on them. Ordinary image bytes contain those values,
|
|
12
|
+
* so the browser path of that spelling fails on real input.
|
|
13
|
+
* - `String.fromCharCode(...chunk)` is correct but spreads a chunk's worth of
|
|
14
|
+
* arguments per call, and the intermediate binary string is as large as the
|
|
15
|
+
* input.
|
|
16
|
+
*
|
|
17
|
+
* Neither question has to be asked per call site, so it is asked here once.
|
|
18
|
+
* The runtime's own encoder answers it when the runtime has one, and the
|
|
19
|
+
* portable encoder below answers it when not; both produce canonical base64,
|
|
20
|
+
* so the choice is invisible in the output.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Encode into exactly one intermediate buffer: ASCII codes are written into a
|
|
24
|
+
* single array and decoded once, so a megabyte-scale input leaves the output
|
|
25
|
+
* string and nothing else.
|
|
26
|
+
*
|
|
27
|
+
* Exported because the runtimes the tests run on all carry a native encoder,
|
|
28
|
+
* and the fallback is the branch the browsers that lack one take.
|
|
29
|
+
*/
|
|
30
|
+
declare const encodeBase64Portable: (bytes: Uint8Array) => string;
|
|
31
|
+
/** Encode bytes as canonical, padded, standard-alphabet base64. */
|
|
32
|
+
declare const bytesToBase64: (bytes: Uint8Array) => string;
|
|
33
|
+
/** Encode bytes as a `data:` URL with the given media type. */
|
|
34
|
+
declare const bytesToDataUrl: (bytes: Uint8Array, mimeType: string) => string;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { bytesToBase64, bytesToDataUrl, encodeBase64Portable };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/utils/base64.ts
|
|
2
|
+
const BASE64_CODES = Uint8Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", (character) => character.charCodeAt(0));
|
|
3
|
+
const BASE64_PAD = 61;
|
|
4
|
+
/**
|
|
5
|
+
* Encode into exactly one intermediate buffer: ASCII codes are written into a
|
|
6
|
+
* single array and decoded once, so a megabyte-scale input leaves the output
|
|
7
|
+
* string and nothing else.
|
|
8
|
+
*
|
|
9
|
+
* Exported because the runtimes the tests run on all carry a native encoder,
|
|
10
|
+
* and the fallback is the branch the browsers that lack one take.
|
|
11
|
+
*/
|
|
12
|
+
const encodeBase64Portable = (bytes) => {
|
|
13
|
+
const groups = Math.ceil(bytes.length / 3);
|
|
14
|
+
const encoded = new Uint8Array(groups * 4);
|
|
15
|
+
let read = 0;
|
|
16
|
+
let write = 0;
|
|
17
|
+
for (; read + 2 < bytes.length; read += 3) {
|
|
18
|
+
const triple = bytes[read] << 16 | bytes[read + 1] << 8 | bytes[read + 2];
|
|
19
|
+
encoded[write] = BASE64_CODES[triple >> 18 & 63];
|
|
20
|
+
encoded[write + 1] = BASE64_CODES[triple >> 12 & 63];
|
|
21
|
+
encoded[write + 2] = BASE64_CODES[triple >> 6 & 63];
|
|
22
|
+
encoded[write + 3] = BASE64_CODES[triple & 63];
|
|
23
|
+
write += 4;
|
|
24
|
+
}
|
|
25
|
+
const remaining = bytes.length - read;
|
|
26
|
+
if (remaining > 0) {
|
|
27
|
+
const tail = bytes[read] << 16 | (remaining === 2 ? bytes[read + 1] << 8 : 0);
|
|
28
|
+
encoded[write] = BASE64_CODES[tail >> 18 & 63];
|
|
29
|
+
encoded[write + 1] = BASE64_CODES[tail >> 12 & 63];
|
|
30
|
+
encoded[write + 2] = remaining === 2 ? BASE64_CODES[tail >> 6 & 63] : BASE64_PAD;
|
|
31
|
+
encoded[write + 3] = BASE64_PAD;
|
|
32
|
+
}
|
|
33
|
+
return new TextDecoder().decode(encoded);
|
|
34
|
+
};
|
|
35
|
+
/** Encode bytes as canonical, padded, standard-alphabet base64. */
|
|
36
|
+
const bytesToBase64 = ("toBase64" in Uint8Array.prototype ? (bytes) => bytes.toBase64() : void 0) ?? encodeBase64Portable;
|
|
37
|
+
/** Encode bytes as a `data:` URL with the given media type. */
|
|
38
|
+
const bytesToDataUrl = (bytes, mimeType) => `data:${mimeType};base64,${bytesToBase64(bytes)}`;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { bytesToBase64, bytesToDataUrl, encodeBase64Portable };
|
|
@@ -51,9 +51,17 @@ declare const CLIPBOARD_TYPES: {
|
|
|
51
51
|
*/
|
|
52
52
|
type ClipboardDataLike = {
|
|
53
53
|
files?: FileList | readonly File[] | undefined;
|
|
54
|
+
getData?: ((format: string) => string) | undefined;
|
|
54
55
|
items?: DataTransferItemList | readonly DataTransferItem[] | undefined;
|
|
56
|
+
types?: ArrayLike<string> | undefined;
|
|
55
57
|
};
|
|
56
58
|
declare function getClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
|
|
59
|
+
/**
|
|
60
|
+
* Return image files only when the clipboard has no readable editor content.
|
|
61
|
+
* Rich HTML, internal payloads, and plain text must stay on the normal paste
|
|
62
|
+
* path; some applications include a rendered image beside that content.
|
|
63
|
+
*/
|
|
64
|
+
declare function getStandaloneClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
|
|
57
65
|
/**
|
|
58
66
|
* Copy runs to clipboard with formatting
|
|
59
67
|
*/
|
|
@@ -141,4 +149,4 @@ declare const _default: {
|
|
|
141
149
|
createClipboardHandlers: typeof createClipboardHandlers;
|
|
142
150
|
};
|
|
143
151
|
//#endregion
|
|
144
|
-
export { CLIPBOARD_TYPES, ClipboardContent, ClipboardOptions, INTERNAL_CLIPBOARD_TYPE, ParsedClipboardContent, cleanWordHtml, copyParagraphs, copyRuns, createClipboardHandlers, _default as default, getClipboardImageFiles, handlePasteEvent, htmlToRuns, isEditorHtml, isWordHtml, paragraphsToClipboardContent, parseClipboardHtml, readFromClipboard, runsToClipboardContent, sanitizeInboundClipboardHtml, writeToClipboard };
|
|
152
|
+
export { CLIPBOARD_TYPES, ClipboardContent, ClipboardOptions, INTERNAL_CLIPBOARD_TYPE, ParsedClipboardContent, cleanWordHtml, copyParagraphs, copyRuns, createClipboardHandlers, _default as default, getClipboardImageFiles, getStandaloneClipboardImageFiles, handlePasteEvent, htmlToRuns, isEditorHtml, isWordHtml, paragraphsToClipboardContent, parseClipboardHtml, readFromClipboard, runsToClipboardContent, sanitizeInboundClipboardHtml, writeToClipboard };
|
package/dist/utils/clipboard.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { htmlCommentEnd } from "./htmlComments.js";
|
|
2
2
|
import { stripXmlDeclarations } from "./stripXmlDeclarations.js";
|
|
3
|
+
import { sanitizeXmlCharacters } from "@stll/docx-core";
|
|
3
4
|
import createDOMPurify from "dompurify";
|
|
4
5
|
//#region src/utils/clipboard.ts
|
|
5
6
|
/**
|
|
@@ -92,6 +93,32 @@ function getClipboardImageFiles(clipboardData) {
|
|
|
92
93
|
for (const group of groups.values()) deduped.push(pickBest(group));
|
|
93
94
|
return deduped;
|
|
94
95
|
}
|
|
96
|
+
const ENGINE_CLIPBOARD_TYPES = [
|
|
97
|
+
INTERNAL_CLIPBOARD_TYPE,
|
|
98
|
+
CLIPBOARD_TYPES.HTML,
|
|
99
|
+
CLIPBOARD_TYPES.PLAIN
|
|
100
|
+
];
|
|
101
|
+
const hasEngineClipboardContent = (clipboardData) => {
|
|
102
|
+
if (!clipboardData.types || !clipboardData.getData) return false;
|
|
103
|
+
const availableTypes = new Set(Array.from(clipboardData.types));
|
|
104
|
+
for (const type of ENGINE_CLIPBOARD_TYPES) {
|
|
105
|
+
if (!availableTypes.has(type)) continue;
|
|
106
|
+
try {
|
|
107
|
+
if (clipboardData.getData(type) !== "") return true;
|
|
108
|
+
} catch {}
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Return image files only when the clipboard has no readable editor content.
|
|
114
|
+
* Rich HTML, internal payloads, and plain text must stay on the normal paste
|
|
115
|
+
* path; some applications include a rendered image beside that content.
|
|
116
|
+
*/
|
|
117
|
+
function getStandaloneClipboardImageFiles(clipboardData) {
|
|
118
|
+
const imageFiles = getClipboardImageFiles(clipboardData);
|
|
119
|
+
if (imageFiles.length === 0 || !clipboardData) return imageFiles;
|
|
120
|
+
return hasEngineClipboardContent(clipboardData) ? [] : imageFiles;
|
|
121
|
+
}
|
|
95
122
|
/**
|
|
96
123
|
* Copy runs to clipboard with formatting
|
|
97
124
|
*/
|
|
@@ -567,7 +594,7 @@ function createTextRun(text, formatting) {
|
|
|
567
594
|
...formatting !== void 0 ? { formatting } : {},
|
|
568
595
|
content: [{
|
|
569
596
|
type: "text",
|
|
570
|
-
text
|
|
597
|
+
text: sanitizeXmlCharacters(text)
|
|
571
598
|
}]
|
|
572
599
|
};
|
|
573
600
|
}
|
|
@@ -647,4 +674,4 @@ var clipboard_default = {
|
|
|
647
674
|
createClipboardHandlers
|
|
648
675
|
};
|
|
649
676
|
//#endregion
|
|
650
|
-
export { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, cleanWordHtml, copyParagraphs, copyRuns, createClipboardHandlers, clipboard_default as default, getClipboardImageFiles, handlePasteEvent, htmlToRuns, isEditorHtml, isWordHtml, paragraphsToClipboardContent, parseClipboardHtml, readFromClipboard, runsToClipboardContent, sanitizeInboundClipboardHtml, writeToClipboard };
|
|
677
|
+
export { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, cleanWordHtml, copyParagraphs, copyRuns, createClipboardHandlers, clipboard_default as default, getClipboardImageFiles, getStandaloneClipboardImageFiles, handlePasteEvent, htmlToRuns, isEditorHtml, isWordHtml, paragraphsToClipboardContent, parseClipboardHtml, readFromClipboard, runsToClipboardContent, sanitizeInboundClipboardHtml, writeToClipboard };
|
|
@@ -106,7 +106,7 @@ const getParagraphContentSearchProjection = (content) => {
|
|
|
106
106
|
if (content.type === "run") return getRunSearchProjection(content);
|
|
107
107
|
if (content.type === "hyperlink") return getHyperlinkSearchProjection(content);
|
|
108
108
|
if (content.type === "inlineSdt") return joinSearchProjections(content.content.map(getParagraphContentSearchProjection));
|
|
109
|
-
if (content.type === "simpleField") return joinSearchProjections(content.content.map(
|
|
109
|
+
if (content.type === "simpleField") return joinSearchProjections(content.content.map(getParagraphContentSearchProjection));
|
|
110
110
|
if (content.type === "complexField") return joinSearchProjections(content.fieldResult.map(getRunSearchProjection));
|
|
111
111
|
return {
|
|
112
112
|
text: "",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/utils/imageLuminance.d.ts
|
|
2
|
+
type ImageLuminance = {
|
|
3
|
+
brightness?: number | null;
|
|
4
|
+
contrast?: number | null;
|
|
5
|
+
};
|
|
6
|
+
/** Clamp a finite percentage to the range accepted by DrawingML `a:lum`. */
|
|
7
|
+
declare const normalizeImageLuminancePercent: (value: number) => number;
|
|
8
|
+
/**
|
|
9
|
+
* Convert DrawingML brightness and contrast percentages into Word's single
|
|
10
|
+
* linear per-channel transfer, expressed as CSS filters without an
|
|
11
|
+
* intermediate clamp changing the result.
|
|
12
|
+
*/
|
|
13
|
+
declare const imageLuminanceFilter: ({ brightness, contrast }: ImageLuminance) => string | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { ImageLuminance, imageLuminanceFilter, normalizeImageLuminancePercent };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/utils/imageLuminance.ts
|
|
2
|
+
const MAX_PERCENT = 100;
|
|
3
|
+
const HARD_STEP_SLOPE = 1e3;
|
|
4
|
+
/** Clamp a finite percentage to the range accepted by DrawingML `a:lum`. */
|
|
5
|
+
const normalizeImageLuminancePercent = (value) => Math.max(-100, Math.min(MAX_PERCENT, value));
|
|
6
|
+
const finitePercent = (value) => value == null || !Number.isFinite(value) ? 0 : normalizeImageLuminancePercent(value);
|
|
7
|
+
const styleNumber = (value) => {
|
|
8
|
+
const rounded = Math.round(value * 1e6) / 1e6;
|
|
9
|
+
return String(Object.is(rounded, -0) ? 0 : rounded);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Convert DrawingML brightness and contrast percentages into Word's single
|
|
13
|
+
* linear per-channel transfer, expressed as CSS filters without an
|
|
14
|
+
* intermediate clamp changing the result.
|
|
15
|
+
*/
|
|
16
|
+
const imageLuminanceFilter = ({ brightness, contrast }) => {
|
|
17
|
+
const bright = finitePercent(brightness) / MAX_PERCENT;
|
|
18
|
+
const contrastAmount = finitePercent(contrast) / MAX_PERCENT;
|
|
19
|
+
if (bright === 0 && contrastAmount === 0) return;
|
|
20
|
+
const slope = contrastAmount >= 0 ? Math.min(HARD_STEP_SLOPE, 1 / (1 - contrastAmount)) : Math.max(0, 1 + contrastAmount);
|
|
21
|
+
const pivot = .5 - bright / 2;
|
|
22
|
+
const intercept = pivot + bright - slope * pivot;
|
|
23
|
+
if (intercept >= 0) {
|
|
24
|
+
const brightnessAmount = slope + 2 * intercept;
|
|
25
|
+
if (brightnessAmount <= 0) return "brightness(0)";
|
|
26
|
+
return `contrast(${styleNumber(slope / brightnessAmount)}) brightness(${styleNumber(brightnessAmount)})`;
|
|
27
|
+
}
|
|
28
|
+
const contrastFactor = 1 - 2 * intercept;
|
|
29
|
+
return `brightness(${styleNumber(slope / contrastFactor)}) contrast(${styleNumber(contrastFactor)})`;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { imageLuminanceFilter, normalizeImageLuminancePercent };
|
|
@@ -91,6 +91,12 @@ function remapBlock(block, numIdRemap, abstractNumIdRemap) {
|
|
|
91
91
|
};
|
|
92
92
|
return block;
|
|
93
93
|
}
|
|
94
|
+
/** A cell holds no content control, so the walk stays inside its own union. */
|
|
95
|
+
function remapCellBlock(block, numIdRemap, abstractNumIdRemap) {
|
|
96
|
+
if (block.type === "paragraph") return remapParagraph(block, numIdRemap, abstractNumIdRemap);
|
|
97
|
+
if (block.type === "table") return remapTable(block, numIdRemap, abstractNumIdRemap);
|
|
98
|
+
return block;
|
|
99
|
+
}
|
|
94
100
|
function remapTable(table, numIdRemap, abstractNumIdRemap) {
|
|
95
101
|
return {
|
|
96
102
|
...table,
|
|
@@ -98,27 +104,11 @@ function remapTable(table, numIdRemap, abstractNumIdRemap) {
|
|
|
98
104
|
...row,
|
|
99
105
|
cells: row.cells.map((cell) => ({
|
|
100
106
|
...cell,
|
|
101
|
-
content: cell.content.map((item) =>
|
|
107
|
+
content: cell.content.map((item) => remapCellBlock(item, numIdRemap, abstractNumIdRemap))
|
|
102
108
|
}))
|
|
103
109
|
}))
|
|
104
110
|
};
|
|
105
111
|
}
|
|
106
|
-
/**
|
|
107
|
-
* `TableCell.content` is typed as `(Paragraph | Table)[]` — narrower than
|
|
108
|
-
* `BlockContent` — because folio's own DOCX parser flattens a `w:sdt` inside
|
|
109
|
-
* a cell into its `sdtContent` children (see `tableParser.ts`) rather than
|
|
110
|
-
* keeping a `blockSdt` wrapper. A hand-built `Document` is not bound by that
|
|
111
|
-
* invariant, so delegate to `remapBlock` (which fully handles paragraph,
|
|
112
|
-
* table, and container blocks, including nested tables) and only accept its
|
|
113
|
-
* result back into the cell when it is still a `Paragraph | Table` — an
|
|
114
|
-
* anomalous `blockSdt` (or any other shape `remapBlock` had to pass through
|
|
115
|
-
* unchanged) is left as-is rather than smuggled into a field the type system
|
|
116
|
-
* says can't hold it.
|
|
117
|
-
*/
|
|
118
|
-
function remapCellItem(item, numIdRemap, abstractNumIdRemap) {
|
|
119
|
-
const remapped = remapBlock(item, numIdRemap, abstractNumIdRemap);
|
|
120
|
-
return remapped.type === "blockSdt" ? item : remapped;
|
|
121
|
-
}
|
|
122
112
|
function remapParagraph(paragraph, numIdRemap, abstractNumIdRemap) {
|
|
123
113
|
const numId = paragraph.formatting?.numPr?.numId;
|
|
124
114
|
const remappedNumId = numId === void 0 ? void 0 : numIdRemap.get(numId);
|
package/dist/utils/units.d.ts
CHANGED
|
@@ -48,6 +48,15 @@ declare function emuToPixels(emu: number | undefined | null): number;
|
|
|
48
48
|
* floating-point drift (e.g. 52 px → 495299.99999999994) out of the document.
|
|
49
49
|
*/
|
|
50
50
|
declare function pixelsToEmu(px: number): number;
|
|
51
|
+
/**
|
|
52
|
+
* Convert EMUs to pixels for a stroke width.
|
|
53
|
+
*
|
|
54
|
+
* Strokes are sub-pixel, so unlike a box size they keep two decimals rather
|
|
55
|
+
* than rounding to whole pixels. The projection is still lossy: a consumer that
|
|
56
|
+
* has to write the document's own number back carries the authored EMU beside
|
|
57
|
+
* the pixels rather than converting these back.
|
|
58
|
+
*/
|
|
59
|
+
declare function emuToStrokePixels(emu: number): number;
|
|
51
60
|
/**
|
|
52
61
|
* Convert EMUs to twips. Twips are integer-typed in OOXML; round here.
|
|
53
62
|
*/
|
|
@@ -96,4 +105,4 @@ declare function clamp(value: number, min: number, max: number): number;
|
|
|
96
105
|
*/
|
|
97
106
|
declare function formatPx(px: number): string;
|
|
98
107
|
//#endregion
|
|
99
|
-
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
|
108
|
+
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToStrokePixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
package/dist/utils/units.js
CHANGED
|
@@ -68,6 +68,17 @@ function pixelsToEmu(px) {
|
|
|
68
68
|
return Math.round(px / 96 * EMUS_PER_INCH);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
+
* Convert EMUs to pixels for a stroke width.
|
|
72
|
+
*
|
|
73
|
+
* Strokes are sub-pixel, so unlike a box size they keep two decimals rather
|
|
74
|
+
* than rounding to whole pixels. The projection is still lossy: a consumer that
|
|
75
|
+
* has to write the document's own number back carries the authored EMU beside
|
|
76
|
+
* the pixels rather than converting these back.
|
|
77
|
+
*/
|
|
78
|
+
function emuToStrokePixels(emu) {
|
|
79
|
+
return roundPixels(emu / EMUS_PER_INCH * 96);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
71
82
|
* Convert EMUs to twips. Twips are integer-typed in OOXML; round here.
|
|
72
83
|
*/
|
|
73
84
|
function emuToTwips(emu) {
|
|
@@ -136,4 +147,4 @@ function formatPx(px) {
|
|
|
136
147
|
return `${roundPixels(px)}px`;
|
|
137
148
|
}
|
|
138
149
|
//#endregion
|
|
139
|
-
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
|
150
|
+
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToStrokePixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
|
@@ -2,6 +2,12 @@ import { sanitizeExternalUrl } from "@stll/docx-core";
|
|
|
2
2
|
//#region src/utils/urlSecurity.d.ts
|
|
3
3
|
declare function normalizeUserUrl(rawUrl: string): string;
|
|
4
4
|
declare function isAllowedUserUrl(rawUrl: string): boolean;
|
|
5
|
-
|
|
5
|
+
type AnchorTargetAttrs = {
|
|
6
|
+
target: string;
|
|
7
|
+
rel: string;
|
|
8
|
+
};
|
|
9
|
+
declare function anchorTargetAttrs(authoredFrame: string | undefined): AnchorTargetAttrs;
|
|
10
|
+
/** `window.open` features carrying the same guarantees as {@link ANCHOR_REL}. */
|
|
11
|
+
declare function windowFeaturesFor({ rel }: AnchorTargetAttrs): string;
|
|
6
12
|
//#endregion
|
|
7
|
-
export { isAllowedUserUrl, normalizeUserUrl, sanitizeExternalUrl,
|
|
13
|
+
export { AnchorTargetAttrs, anchorTargetAttrs, isAllowedUserUrl, normalizeUserUrl, sanitizeExternalUrl, windowFeaturesFor };
|
|
@@ -23,8 +23,26 @@ function normalizeUserUrl(rawUrl) {
|
|
|
23
23
|
function isAllowedUserUrl(rawUrl) {
|
|
24
24
|
return normalizeUserUrl(rawUrl) !== "";
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The `target` and `rel` one authored frame may produce on a DOM anchor.
|
|
28
|
+
*
|
|
29
|
+
* A `w:tgtFrame` is a frame name, and a named frame addresses another browsing
|
|
30
|
+
* context: honouring an arbitrary one would let a document reach a frame it did
|
|
31
|
+
* not create. Every anchor and every navigation folio produces goes through
|
|
32
|
+
* here, so the clamp and the `rel` that must accompany `_blank` are decided
|
|
33
|
+
* once. The authored name itself stays in the model and is written back on
|
|
34
|
+
* save; clamping it at parse rewrote the document.
|
|
35
|
+
*/
|
|
36
|
+
const ANCHOR_REL = "noopener noreferrer";
|
|
37
|
+
function anchorTargetAttrs(authoredFrame) {
|
|
38
|
+
return {
|
|
39
|
+
target: authoredFrame && ALLOWED_TARGETS.has(authoredFrame) ? authoredFrame : "_blank",
|
|
40
|
+
rel: ANCHOR_REL
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** `window.open` features carrying the same guarantees as {@link ANCHOR_REL}. */
|
|
44
|
+
function windowFeaturesFor({ rel }) {
|
|
45
|
+
return rel.replaceAll(" ", ",");
|
|
28
46
|
}
|
|
29
47
|
function findFirstPathSeparatorIndex(value) {
|
|
30
48
|
return [
|
|
@@ -44,4 +62,4 @@ function startsWithPortSuffix(value) {
|
|
|
44
62
|
return index > 0 && (index === value.length || "/?#".includes(value[index]));
|
|
45
63
|
}
|
|
46
64
|
//#endregion
|
|
47
|
-
export { isAllowedUserUrl, normalizeUserUrl, sanitizeExternalUrl,
|
|
65
|
+
export { anchorTargetAttrs, isAllowedUserUrl, normalizeUserUrl, sanitizeExternalUrl, windowFeaturesFor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "Headless, framework-neutral core of folio: the OOXML (.docx) parser, document model, ProseMirror integration, and page-layout engine. No React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document-model",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"perf": "bun scripts/profile-editor.ts"
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
|
-
"@stll/docx-core": "^0.
|
|
124
|
+
"@stll/docx-core": "^0.24.0",
|
|
125
125
|
"@stll/docx-utils": "^0.1.0",
|
|
126
126
|
"@stll/template-conditions": ">=0.4.0 <1.0.0",
|
|
127
127
|
"better-result": "3.0.1",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//#region src/docx/blockRangeMarkers.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Range markers that stand between two blocks.
|
|
4
|
-
*
|
|
5
|
-
* `w:body`, `w:tc`, a header and an SDT's content all admit
|
|
6
|
-
* `EG_RunLevelElts` and `EG_RangeMarkupElements` beside their paragraphs, and
|
|
7
|
-
* every block container dropped them: a `w:permStart` between two paragraphs
|
|
8
|
-
* is the whole of a document-protection range, so losing it removes the
|
|
9
|
-
* protection from the saved file without a word. folio models none of these,
|
|
10
|
-
* and their position is their meaning, so they are captured verbatim and
|
|
11
|
-
* replayed where they stood — the same treatment `w:sdt`'s sibling markers
|
|
12
|
-
* already get (MS-OE376 §2.5.2.30).
|
|
13
|
-
*
|
|
14
|
-
* Bookmarks are absent from the set on purpose: they are modelled, and the
|
|
15
|
-
* block containers already relocate them into the neighbouring paragraph.
|
|
16
|
-
*/
|
|
17
|
-
declare const isBlockRangeMarker: (localName: string) => boolean;
|
|
18
|
-
/** Hand the markers collected so far to the block they stood before. */
|
|
19
|
-
declare const attachPendingRangeMarkers: (block: {
|
|
20
|
-
rawMarkersBefore?: string;
|
|
21
|
-
}, pending: string[]) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Markers after the last block ride on it, since there is no block after them.
|
|
24
|
-
* With no block at all they are dropped: a container holding markers and no
|
|
25
|
-
* content has nothing for them to delimit.
|
|
26
|
-
*/
|
|
27
|
-
declare const attachTrailingRangeMarkers: (blocks: readonly {
|
|
28
|
-
rawMarkersAfter?: string;
|
|
29
|
-
}[], pending: string[]) => void;
|
|
30
|
-
/** Wrap a serialized block in the markup that stood around it. */
|
|
31
|
-
declare const withBlockRangeMarkers: (block: {
|
|
32
|
-
rawMarkersBefore?: string;
|
|
33
|
-
rawMarkersAfter?: string;
|
|
34
|
-
}, xml: string) => string;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { attachPendingRangeMarkers, attachTrailingRangeMarkers, isBlockRangeMarker, withBlockRangeMarkers };
|