@a3s-lab/office 0.38.1 → 0.40.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/README.md +18 -4
- package/dist/{0~7240.js → 0~2330.js} +897 -641
- package/dist/0~5024.js +240 -240
- package/dist/0~7828.js +51 -29
- package/dist/0~document-editor.js +1 -0
- package/dist/0~presentation-editor.js +264 -118
- package/dist/0~work-docx-export.js +1023 -922
- package/dist/0~work-docx-import.js +13 -4
- package/dist/0~work-office-diagnostics.js +96 -94
- package/dist/0~work-pptx-import.js +1 -1
- package/dist/0~work-presentation-transition.js +38 -0
- package/dist/4121.js +42 -9
- package/dist/4174.js +497 -233
- package/dist/4560.js +124 -9
- package/dist/internal/features/work/editors/presentation-animation-panel.d.ts +9 -7
- package/dist/internal/features/work/editors/presentation-command-types.d.ts +10 -10
- package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +6 -4
- package/dist/internal/features/work/editors/use-presentation-animation-commands.d.ts +7 -7
- package/dist/internal/features/work/work-document-format-change-tracking.d.ts +1 -1
- package/dist/internal/features/work/work-document-numbering-change-tracking.d.ts +7 -0
- package/dist/internal/features/work/work-document-numbering-changes.d.ts +29 -0
- package/dist/internal/features/work/work-docx-import.d.ts +7 -5
- package/dist/internal/features/work/work-docx-list-export.d.ts +1 -0
- package/dist/internal/features/work/work-docx-numbering-change-export.d.ts +13 -0
- package/dist/internal/features/work/work-docx-numbering-change-import.d.ts +17 -0
- package/dist/internal/features/work/work-presentation-animation.d.ts +6 -2
- package/dist/internal/features/work/work-presentation-clipboard.d.ts +0 -5
- package/dist/internal/features/work/work-types.d.ts +8 -4
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +162 -26
- package/package.json +8 -5
- package/dist/0~5809.js +0 -123
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import jszip from "jszip";
|
|
2
2
|
import { documentRunBorderDomAttributes, contentTypeForPart, bytesToDataUrl, OoxmlPackage, normalizeDocumentIndexesHtml, firstDescendant, normalizeDocumentParagraphId, applyDocumentParagraphIdentityToElement, descendants, documentHighlightDomAttributes, attribute as work_ooxml_package_attribute, documentHighlightFromDocxValue, serializeDocxThemeReference, normalizeDocumentTableOfContentsHtml, directChildren, documentParagraphShadingDomAttributes, documentProofingDomAttributes, documentParagraphBordersDomAttributes, directChild, documentScriptFontSegments, normalizeDocumentParagraphIdentity, documentRunShadingDomAttributes } from "./4121.js";
|
|
3
3
|
import { normalizeDocumentBookmarkName, renderDocumentTableCellMarginOverrides, applyDocumentImageIdentityToElement, documentCharacterPositionDomAttributes, createDocumentImageIdentityRegistry, normalizeDocumentColumns, documentStrikeDomAttributes, normalizeDocumentImageWrapContour, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, normalizeDocumentBookmarksHtml, applyDocumentTableRowIdentityToElement, normalizeDocumentCaptionsHtml, documentCharacterSpacingDomAttributes, normalizeDocumentImageAlignment, applyDocumentImageLayerToElement, normalizeDocumentNotesHtml, normalizeDocumentBookmarkReferencesHtml, documentCitationTagsFromInstruction, applyDocumentImageWrapContourToElement, documentUnderlineDomAttributes, documentHiddenTextDomAttributes, normalizeDocumentPageChrome, normalizeDocumentImageLayoutOptions, applyDocumentImageCropToElement, documentPageMarginsForLayout, applyDocumentPageGeometry, createDocumentNoteElement, normalizeDocumentImageLayer, DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE, documentBookmarkReferenceInstruction, documentInitialSectionLayout, normalizeDocumentFieldsHtml, documentCaptionLabel, documentTableBordersFromElement, isContourImageLayout, normalizeDocumentCitationsHtml, normalizeDocumentImageIdentity, normalizeDocumentImageWrapSide, documentKerningDomAttributes, docxDocumentFieldKind, renderDocumentTableBorders, docxBookmarkReferenceTarget, normalizeDocumentImagePosition, wrapsBesideImage, documentPageChromeLegacyFields, documentCharacterScaleDomAttributes, DEFAULT_DOCUMENT_TABLE_GEOMETRY, documentSectionDomAttributes, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, documentPageMarginBody, documentLegacyTextEffectsDomAttributes, normalizeDocumentTableRowIdentity, normalizeDocumentBookmarkNativeId, documentOpenTypeDomAttributes, uniqueDocumentImageIdentity, applyDocumentTableGeometryToElement, normalizeDocumentImageCrop, documentContentLayoutProperties, documentEmphasisMarkDomAttributes } from "./4174.js";
|
|
4
|
-
import { hasImportedDocxIndexMarkers, markDocxRunFormattingIntoState, applyImportedDocxParagraphSpacingMarkers, hasImportedDocxParagraphDirectionMarkers, hasImportedDocxParagraphIndentMarkers, resolveDocxParagraphBordersForParagraph, applyImportedDocxParagraphShadingMarkers, markDocxParagraphSpacing, docxCaptionBookmark, docxFieldResultText, createDocxParagraphStyleResolver, docxTableCellStyleLayers, createImportedDocxRunFormattingMarkerState, parseDocxPaperSource, resolveDocxLegacyTextEffects, markDocxTablesOfContents, hasImportedDocxParagraphSpacingMarkers, applyImportedDocxIndexMarkers, applyImportedDocxTableOfContentsMarkers, markDocxIndexes, parseDocxPageMargins, docxTablePropertySources, parseDirectDocxParagraphShading, markDocxParagraphIndents, markDocxPackageEquations, resolveDocxRunBorder, parseDocxPageGeometry, docxCaptionReferenceTarget, applyImportedDocxEquationMarkers, hasImportedDocxParagraphPaginationMarkers, createDocxTableStyleResolver, hasImportedDocxParagraphShadingMarkers, isDocxEquationLikeRoot, importedDocxStrike, docxTableRunPropertySources, inspectDocxPageMarginSettings, hasImportedDocxRunFormattingMarkers,
|
|
4
|
+
import { hasImportedDocxIndexMarkers, markDocxRunFormattingIntoState, applyImportedDocxParagraphSpacingMarkers, hasImportedDocxParagraphDirectionMarkers, hasImportedDocxParagraphIndentMarkers, resolveDocxParagraphBordersForParagraph, applyImportedDocxNumberingChangeMarkers, applyImportedDocxParagraphShadingMarkers, markDocxParagraphSpacing, docxCaptionBookmark, docxFieldResultText, createDocxParagraphStyleResolver, docxTableCellStyleLayers, createImportedDocxRunFormattingMarkerState, parseDocxPaperSource, resolveDocxLegacyTextEffects, markDocxTablesOfContents, hasImportedDocxParagraphSpacingMarkers, applyImportedDocxIndexMarkers, applyImportedDocxTableOfContentsMarkers, markDocxIndexes, parseDocxPageMargins, docxTablePropertySources, parseDirectDocxParagraphShading, markDocxParagraphIndents, markDocxPackageEquations, resolveDocxRunBorder, parseDocxPageGeometry, docxCaptionReferenceTarget, applyImportedDocxEquationMarkers, hasImportedDocxParagraphPaginationMarkers, createDocxTableStyleResolver, hasImportedDocxParagraphShadingMarkers, isDocxEquationLikeRoot, importedDocxStrike, docxTableRunPropertySources, hasImportedDocxNumberingChangeMarkers, inspectDocxPageMarginSettings, hasImportedDocxRunFormattingMarkers, hasImportedDocxTableOfContentsMarkers, applyImportedDocxParagraphFormattingChangeMarkers, hasImportedDocxParagraphTabStopMarkers, resolveDocxRunShading, docxCaptionSequenceKind, applyImportedDocxRunFormattingMarkers, markDocxParagraphAlignments, markDocxParagraphDirections, hasImportedDocxParagraphBorderMarkers, hasImportedDocxParagraphFormattingChangeMarkers, resolveDocxHiddenText, docxEquationHtml, docxFieldOccurrences, hasImportedDocxParagraphAlignmentMarkers, markDocxParagraphTabStops, applyImportedDocxParagraphIndentMarkers, resolveDocxTableStyleResolver, applyImportedDocxParagraphDirectionMarkers, markDocxNumberingChanges, applyImportedDocxParagraphAlignmentMarkers, importedDocxUnderline, markDocxParagraphBorders, markDocxParagraphPagination, applyImportedDocxParagraphTabStopMarkers, applyImportedDocxParagraphPaginationMarkers, docxFieldOccurrenceIsInlineEditable, applyImportedDocxParagraphBorderMarkers, docxRunPropertySources, markDocxParagraphFormattingChanges, markDocxParagraphShading, parseDocxPageBorders } from "./0~2330.js";
|
|
5
5
|
import { readDocxBibliography, resolveDocxProofing, XMLNS_NAMESPACE, docxCharacterScalePercentFromProperties, docxCharacterSpacingTwipsFromProperties, parseBoundedDocxInteger, resolveDocxOpenTypeFeatures, xmlAttributeLocalName, resolveDocxEmphasisMark, createDocxThemeResolver, docxCharacterPositionHalfPointsFromProperties, docxThemeColor, parseDocxParagraphDefaultCollapsed, resolveDocxKerningThresholdHalfPoints, resolveDocxThemeResolver, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace } from "./0~5024.js";
|
|
6
6
|
import { importDocxPageColor, importedDocumentNoteId } from "./0~4980.js";
|
|
7
7
|
const WORD_NAMESPACE = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
|
|
@@ -2898,6 +2898,9 @@ async function prepareDocxImport(buffer, sourcePackage) {
|
|
|
2898
2898
|
listMarkers: {
|
|
2899
2899
|
lists: []
|
|
2900
2900
|
},
|
|
2901
|
+
numberingChangeMarkers: {
|
|
2902
|
+
groups: []
|
|
2903
|
+
},
|
|
2901
2904
|
imageLayoutMarkers: {
|
|
2902
2905
|
images: []
|
|
2903
2906
|
},
|
|
@@ -2964,6 +2967,7 @@ async function prepareDocxImport(buffer, sourcePackage) {
|
|
|
2964
2967
|
const citationMarkers = markDocxCitationFields(document);
|
|
2965
2968
|
const fieldMarkers = markDocxBodyFields(document);
|
|
2966
2969
|
const listMarkers = markDocxLists(document, numbering);
|
|
2970
|
+
const numberingChangeMarkers = markDocxNumberingChanges(document);
|
|
2967
2971
|
const imageLayoutMarkerState = createImportedDocxImageLayoutMarkerState();
|
|
2968
2972
|
const imageLayoutMarkers = markDocxImageLayouts(document, imageLayoutMarkerState);
|
|
2969
2973
|
const noteImageMarkers = await markDocxNoteImageLayouts(archive, imageLayoutMarkerState);
|
|
@@ -2996,10 +3000,10 @@ async function prepareDocxImport(buffer, sourcePackage) {
|
|
|
2996
3000
|
const tableCellMarkers = markDocxTableCells(document, theme, tableStyles);
|
|
2997
3001
|
const tableRowMarkers = markDocxTableRows(document);
|
|
2998
3002
|
const tableSizingMarkers = markDocxTableSizing(document, tableStyles);
|
|
2999
|
-
const trackChanges = Boolean(settings && firstDescendant(settings, 'trackRevisions')) || changeMarkers.changes.length > 0 || paragraphFormattingChangeMarkers.paragraphs.length > 0 || runFormattingMarkers.runs.some((run)=>Boolean(run.change));
|
|
3003
|
+
const trackChanges = Boolean(settings && firstDescendant(settings, 'trackRevisions')) || changeMarkers.changes.length > 0 || numberingChangeMarkers.groups.length > 0 || paragraphFormattingChangeMarkers.paragraphs.length > 0 || runFormattingMarkers.runs.some((run)=>Boolean(run.change));
|
|
3000
3004
|
const sectionElements = effectiveSectionProperties(document);
|
|
3001
3005
|
if (!sectionElements.length) return {
|
|
3002
|
-
conversionBuffer: hasImportedDocxCaptionMarkers(captionMarkers) || hasImportedDocxBookmarkMarkers(bookmarkMarkers) || hasImportedDocxChangeMarkers(changeMarkers) || hasImportedDocxCommentMarkers(commentMarkers) || hasImportedDocxCitationMarkers(citationMarkers) || hasImportedDocxFieldMarkers(fieldMarkers) || hasImportedDocxTableOfContentsMarkers(tableOfContentsMarkers) || hasImportedDocxIndexMarkers(indexMarkers) || equationMarkers.changed || hasImportedDocxListMarkers(listMarkers) || hasImportedDocxImageLayoutMarkers(imageLayoutMarkers) || hasImportedDocxParagraphIdentityMarkers(paragraphIdentityMarkers) || hasImportedDocxParagraphFormattingChangeMarkers(paragraphFormattingChangeMarkers) || hasImportedDocxParagraphAlignmentMarkers(paragraphAlignmentMarkers) || hasImportedDocxParagraphDirectionMarkers(paragraphDirectionMarkers) || hasImportedDocxParagraphIndentMarkers(paragraphIndentMarkers) || hasImportedDocxParagraphSpacingMarkers(paragraphSpacingMarkers) || hasImportedDocxParagraphBorderMarkers(paragraphBorderMarkers) || hasImportedDocxParagraphShadingMarkers(paragraphShadingMarkers) || hasImportedDocxParagraphPaginationMarkers(paragraphPaginationMarkers) || hasImportedDocxRunFormattingMarkers(runFormattingMarkers) || hasImportedDocxParagraphTabStopMarkers(tabStopMarkers) || hasImportedDocxTableCellMarkers(tableCellMarkers) || hasImportedDocxTableRowMarkers(tableRowMarkers) || hasImportedDocxTableSizingMarkers(tableSizingMarkers) ? await writeDocumentXml(buffer, document, equationMarkers.parts) : buffer,
|
|
3006
|
+
conversionBuffer: hasImportedDocxCaptionMarkers(captionMarkers) || hasImportedDocxBookmarkMarkers(bookmarkMarkers) || hasImportedDocxChangeMarkers(changeMarkers) || hasImportedDocxCommentMarkers(commentMarkers) || hasImportedDocxCitationMarkers(citationMarkers) || hasImportedDocxFieldMarkers(fieldMarkers) || hasImportedDocxTableOfContentsMarkers(tableOfContentsMarkers) || hasImportedDocxIndexMarkers(indexMarkers) || equationMarkers.changed || hasImportedDocxListMarkers(listMarkers) || hasImportedDocxNumberingChangeMarkers(numberingChangeMarkers) || hasImportedDocxImageLayoutMarkers(imageLayoutMarkers) || hasImportedDocxParagraphIdentityMarkers(paragraphIdentityMarkers) || hasImportedDocxParagraphFormattingChangeMarkers(paragraphFormattingChangeMarkers) || hasImportedDocxParagraphAlignmentMarkers(paragraphAlignmentMarkers) || hasImportedDocxParagraphDirectionMarkers(paragraphDirectionMarkers) || hasImportedDocxParagraphIndentMarkers(paragraphIndentMarkers) || hasImportedDocxParagraphSpacingMarkers(paragraphSpacingMarkers) || hasImportedDocxParagraphBorderMarkers(paragraphBorderMarkers) || hasImportedDocxParagraphShadingMarkers(paragraphShadingMarkers) || hasImportedDocxParagraphPaginationMarkers(paragraphPaginationMarkers) || hasImportedDocxRunFormattingMarkers(runFormattingMarkers) || hasImportedDocxParagraphTabStopMarkers(tabStopMarkers) || hasImportedDocxTableCellMarkers(tableCellMarkers) || hasImportedDocxTableRowMarkers(tableRowMarkers) || hasImportedDocxTableSizingMarkers(tableSizingMarkers) ? await writeDocumentXml(buffer, document, equationMarkers.parts) : buffer,
|
|
3003
3007
|
sections: [
|
|
3004
3008
|
{
|
|
3005
3009
|
id: 'document-section-1',
|
|
@@ -3017,6 +3021,7 @@ async function prepareDocxImport(buffer, sourcePackage) {
|
|
|
3017
3021
|
equationMarkers: equationMarkers.markers,
|
|
3018
3022
|
citationMarkers,
|
|
3019
3023
|
listMarkers,
|
|
3024
|
+
numberingChangeMarkers,
|
|
3020
3025
|
imageLayoutMarkers,
|
|
3021
3026
|
paragraphIdentityMarkers,
|
|
3022
3027
|
paragraphFormattingChangeMarkers,
|
|
@@ -3049,7 +3054,7 @@ async function prepareDocxImport(buffer, sourcePackage) {
|
|
|
3049
3054
|
}
|
|
3050
3055
|
if (sections.length > 1) addSectionMarkers(document, sectionElements);
|
|
3051
3056
|
return {
|
|
3052
|
-
conversionBuffer: sections.length > 1 || hasImportedDocxCaptionMarkers(captionMarkers) || hasImportedDocxBookmarkMarkers(bookmarkMarkers) || hasImportedDocxChangeMarkers(changeMarkers) || hasImportedDocxCommentMarkers(commentMarkers) || hasImportedDocxCitationMarkers(citationMarkers) || hasImportedDocxFieldMarkers(fieldMarkers) || hasImportedDocxTableOfContentsMarkers(tableOfContentsMarkers) || hasImportedDocxIndexMarkers(indexMarkers) || equationMarkers.changed || hasImportedDocxListMarkers(listMarkers) || hasImportedDocxImageLayoutMarkers(imageLayoutMarkers) || hasImportedDocxParagraphIdentityMarkers(paragraphIdentityMarkers) || hasImportedDocxParagraphFormattingChangeMarkers(paragraphFormattingChangeMarkers) || hasImportedDocxParagraphAlignmentMarkers(paragraphAlignmentMarkers) || hasImportedDocxParagraphDirectionMarkers(paragraphDirectionMarkers) || hasImportedDocxParagraphIndentMarkers(paragraphIndentMarkers) || hasImportedDocxParagraphSpacingMarkers(paragraphSpacingMarkers) || hasImportedDocxParagraphBorderMarkers(paragraphBorderMarkers) || hasImportedDocxParagraphShadingMarkers(paragraphShadingMarkers) || hasImportedDocxParagraphPaginationMarkers(paragraphPaginationMarkers) || hasImportedDocxRunFormattingMarkers(runFormattingMarkers) || hasImportedDocxParagraphTabStopMarkers(tabStopMarkers) || hasImportedDocxTableCellMarkers(tableCellMarkers) || hasImportedDocxTableRowMarkers(tableRowMarkers) || hasImportedDocxTableSizingMarkers(tableSizingMarkers) ? await writeDocumentXml(buffer, document, equationMarkers.parts) : buffer,
|
|
3057
|
+
conversionBuffer: sections.length > 1 || hasImportedDocxCaptionMarkers(captionMarkers) || hasImportedDocxBookmarkMarkers(bookmarkMarkers) || hasImportedDocxChangeMarkers(changeMarkers) || hasImportedDocxCommentMarkers(commentMarkers) || hasImportedDocxCitationMarkers(citationMarkers) || hasImportedDocxFieldMarkers(fieldMarkers) || hasImportedDocxTableOfContentsMarkers(tableOfContentsMarkers) || hasImportedDocxIndexMarkers(indexMarkers) || equationMarkers.changed || hasImportedDocxListMarkers(listMarkers) || hasImportedDocxNumberingChangeMarkers(numberingChangeMarkers) || hasImportedDocxImageLayoutMarkers(imageLayoutMarkers) || hasImportedDocxParagraphIdentityMarkers(paragraphIdentityMarkers) || hasImportedDocxParagraphFormattingChangeMarkers(paragraphFormattingChangeMarkers) || hasImportedDocxParagraphAlignmentMarkers(paragraphAlignmentMarkers) || hasImportedDocxParagraphDirectionMarkers(paragraphDirectionMarkers) || hasImportedDocxParagraphIndentMarkers(paragraphIndentMarkers) || hasImportedDocxParagraphSpacingMarkers(paragraphSpacingMarkers) || hasImportedDocxParagraphBorderMarkers(paragraphBorderMarkers) || hasImportedDocxParagraphShadingMarkers(paragraphShadingMarkers) || hasImportedDocxParagraphPaginationMarkers(paragraphPaginationMarkers) || hasImportedDocxRunFormattingMarkers(runFormattingMarkers) || hasImportedDocxParagraphTabStopMarkers(tabStopMarkers) || hasImportedDocxTableCellMarkers(tableCellMarkers) || hasImportedDocxTableRowMarkers(tableRowMarkers) || hasImportedDocxTableSizingMarkers(tableSizingMarkers) ? await writeDocumentXml(buffer, document, equationMarkers.parts) : buffer,
|
|
3053
3058
|
sections,
|
|
3054
3059
|
pageColor,
|
|
3055
3060
|
captionMarkers,
|
|
@@ -3062,6 +3067,7 @@ async function prepareDocxImport(buffer, sourcePackage) {
|
|
|
3062
3067
|
equationMarkers: equationMarkers.markers,
|
|
3063
3068
|
citationMarkers,
|
|
3064
3069
|
listMarkers,
|
|
3070
|
+
numberingChangeMarkers,
|
|
3065
3071
|
imageLayoutMarkers,
|
|
3066
3072
|
paragraphIdentityMarkers,
|
|
3067
3073
|
paragraphFormattingChangeMarkers,
|
|
@@ -3106,6 +3112,8 @@ function applyDocxSectionsToHtml(html, sections, captionMarkers = {
|
|
|
3106
3112
|
bibliographies: []
|
|
3107
3113
|
}, listMarkers = {
|
|
3108
3114
|
lists: []
|
|
3115
|
+
}, numberingChangeMarkers = {
|
|
3116
|
+
groups: []
|
|
3109
3117
|
}, imageLayoutMarkers = {
|
|
3110
3118
|
images: []
|
|
3111
3119
|
}, paragraphIdentityMarkers = {
|
|
@@ -3150,6 +3158,7 @@ function applyDocxSectionsToHtml(html, sections, captionMarkers = {
|
|
|
3150
3158
|
applyImportedDocxFieldMarkers(document, fieldMarkers);
|
|
3151
3159
|
applyImportedDocxEquationMarkers(document, equationMarkers);
|
|
3152
3160
|
applyImportedDocxListMarkers(document, listMarkers);
|
|
3161
|
+
applyImportedDocxNumberingChangeMarkers(document, numberingChangeMarkers);
|
|
3153
3162
|
applyImportedDocxImageLayoutMarkers(document, imageLayoutMarkers);
|
|
3154
3163
|
applyImportedDocxParagraphDirectionMarkers(document, paragraphDirectionMarkers);
|
|
3155
3164
|
applyImportedDocxParagraphIndentMarkers(document, paragraphIndentMarkers);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
2
2
|
import { contentTypeForPart, directChildren, OoxmlPackage, parseXml, firstDescendant, isDocumentParagraphArtBorderStyle, descendants, directChild, xmlContainsAnyElement, attribute, documentRunBorderIsVisible } from "./4121.js";
|
|
3
3
|
import { normalizeDocumentBookmarkName, docxBookmarkReferenceTarget, normalizeDocumentBookmarkNativeId, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, supportedDocxBookmarkReferenceInstruction, documentCitationTagsFromInstruction, docxDocumentFieldKind } from "./4174.js";
|
|
4
|
-
import { markDocxParagraphShading, inspectDocxPageSize, docxCaptionBookmark, hasInvalidDocxFieldStructure, inspectDocxLegacyTextEffects, inspectDocxPageMargins, inspectDocxPaperSource, createDocxParagraphStyleResolver, supportedDocxTableOfContentsField, docxFieldOccurrences, supportedDocxIndexEntryField, createDocxTableStyleResolver, inspectDocxEquation, inspectDocxPageMarginSettings,
|
|
4
|
+
import { markDocxParagraphShading, inspectDocxPageSize, isSupportedDocxNumberingChange, docxCaptionBookmark, hasInvalidDocxFieldStructure, inspectDocxLegacyTextEffects, inspectDocxPageMargins, inspectDocxPaperSource, createDocxParagraphStyleResolver, supportedDocxTableOfContentsField, docxFieldOccurrences, supportedDocxIndexEntryField, createDocxTableStyleResolver, inspectDocxEquation, inspectDocxPageMarginSettings, inspectDocxRunBorder, inspectDocxRunFonts, inspectDocxRunShading, markDocxParagraphBorders, isSupportedDocxParagraphFormattingChange, docxFieldOccurrenceIsInlineEditable, supportedDocxIndexField, docxCaptionSequenceKind, inspectDocxHiddenText, inspectDocxPageBorders, isSupportedDocxRunFormattingChange, docxFieldInstructions, isSupportedDocxEquationPlacement } from "./0~2330.js";
|
|
5
5
|
import { normalizeDocumentHref } from "./0~work-document-links.js";
|
|
6
6
|
import { xmlAttributeLocalName, resolveDocxOpenTypeFeatures, inspectDocxProofingLanguages, readDocxBibliography, inspectDocxEmphasisMark, createDocxThemeResolver, DOCX_WORD_2010_NAMESPACE, inspectDocxNoProof, parseDocxParagraphDefaultCollapsed, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace, inspectDocxKerningThresholdHalfPoints } from "./0~5024.js";
|
|
7
7
|
import { updateSpreadsheetWorksheetCompatibilitySummary, inspectXlsxPivotTables, isSupportedXlsxChartLegend, isSupportedXlsxChartPlotLayout, xlsxChartNodeUsesStackedGrouping, isSupportedXlsxChartSeriesFormatting, readXlsxFormulaFeaturesFromPackage, inspectXlsxHeaderFooterText, emptySpreadsheetWorksheetCompatibilitySummary, isSupportedXlsxWorksheetImageContentType, MAX_XLSX_WORKSHEET_IMAGE_BYTES, xlsxChartSeriesFormattingShapeProperties, diagnoseXlsxProtection, isEditableXlsxPaperSizeCode, isSupportedXlsxCombinationChartNodes } from "./4166.js";
|
|
@@ -262,53 +262,6 @@ async function diagnoseDocxCitations(archive, document) {
|
|
|
262
262
|
});
|
|
263
263
|
return issues;
|
|
264
264
|
}
|
|
265
|
-
const EQUATION_PART_PATTERN = /^word\/(?:header\d*|footer\d*|footnotes|endnotes)\.xml$/i;
|
|
266
|
-
const MAX_EDITABLE_EQUATIONS = 4096;
|
|
267
|
-
async function diagnoseDocxEquations(archive, document) {
|
|
268
|
-
const parts = document ? [
|
|
269
|
-
{
|
|
270
|
-
path: 'word/document.xml',
|
|
271
|
-
document
|
|
272
|
-
}
|
|
273
|
-
] : [];
|
|
274
|
-
for (const path of archive.paths('word/').filter((candidate)=>EQUATION_PART_PATTERN.test(candidate)))parts.push({
|
|
275
|
-
path,
|
|
276
|
-
document: await archive.xml(path)
|
|
277
|
-
});
|
|
278
|
-
let supported = 0;
|
|
279
|
-
let unsupported = 0;
|
|
280
|
-
let spoofed = 0;
|
|
281
|
-
for (const part of parts)for (const element of Array.from(part.document.querySelectorAll('*')).filter((candidate)=>'oMath' === candidate.localName || 'oMathPara' === candidate.localName)){
|
|
282
|
-
if (closestEquationRoot(element.parentElement)) continue;
|
|
283
|
-
const inspection = inspectDocxEquation(element);
|
|
284
|
-
if ('supported' === inspection.status && isSupportedDocxEquationPlacement(element)) supported += 1;
|
|
285
|
-
else if ('spoofed' === inspection.status) spoofed += 1;
|
|
286
|
-
else unsupported += 1;
|
|
287
|
-
}
|
|
288
|
-
const total = supported + unsupported + spoofed;
|
|
289
|
-
if (!total) return [];
|
|
290
|
-
const issues = [];
|
|
291
|
-
if (supported) issues.push(equationIssue('docx.equations', `${supported} native OMML equation(s) use the editable structured subset. Inline equations and display equations with left, right, center, or center-group paragraph justification, Unicode math runs with literal/normal-text semantics, six math scripts, four styles, manual breaks, alignment points, ordered core Word run formatting for fonts/theme references, emphasis, casing, strike, relief effects, legacy text animations, bounded line borders, proofing/grid flags, visibility, colors, bounded character spacing, horizontal scaling, kerning thresholds, signed baseline positions, half-point sizes, named highlights, patterned shading, bounded manual run widths with optional grouping IDs, explicit baseline/superscript/subscript run alignment, all five Word emphasis-mark values, underlines, script direction, languages, native-only East Asian typography with signed run IDs, two-lines-in-one brackets, rotation, and compression, inert paragraph-mark visibility resets, and Office 2010 text glow, shadow, reflection, text-outline, text-fill, 3D-scene, and 3D-property effects with bounded radii, offsets, outline widths, extrusion heights, and contour widths, exact direction and reflection opacity/position/fade geometry, signed scale and skew, rectangle and pen alignment, glow/shadow/outline/fill/extrusion/contour RGB or theme colors and ordered transform chains, none/solid/gradient outline and text fills with bounded stops and linear/path shading, preset dashes, round/bevel/miter joins, all camera, light-rig, bevel, and material presets, all light directions, exact optional rotation angles, ordered top/bottom bevel plus extrusion/contour color branches, all 16 ligature combinations, three numeral forms, three numeral-spacing modes, bounded Office 2010 stylistic-set lists, and explicit contextual-alternate controls with exact combined CSS OpenType projection and distinct clig/calt behavior, with exact direct RGB and default-black text fills projected to MathML while complex effects remain native metadata, and the same bounded Word formatting in ordered object-level control properties and native-only argument-slot control properties, bounded insertion, deletion, move-source, and move-destination provenance around those math controls, ordered fractions with four native types and a bar default, ordered right-side scripts with aligned sub/superscripts, left-side pre-sub/superscripts with empty script slots, radicals with optional degrees and canonical square-root slots, functions with required, optionally empty name/argument slots, canonical empty arguments across every supported construct, ordered argument/control properties, bounded relative argument sizes with Word-effective MathML script-level projection and native-only preservation elsewhere, and strictly aligned matrix-cell, equation-array-row, and delimiter-argument metadata, ordered n-ary operators with default integrals, canonical empty limit slots, and optional operand growth, combining accents, overbars and underbars, group characters with explicit character position and baseline justification, phantoms with visible or hidden bases, zeroed width/ascent/descent, and transparent spacing, border boxes with independently visible edges and four strike directions, semantic boxes with operator-emulation, no-break, differential-spacing, manual-break, and alignment properties, bounded rectangular matrices with ordered row-spacing, column-gap, and minimum-width controls, equation arrays with bounded rows, vertical base alignment, distribution, row-spacing, and alignment/spacer markers, lower and upper limit objects, ordered delimiters with distinct omitted/empty characters, bounded empty argument slots, growing or fixed sizing, and centered or content-matched shape, and their accessible MathML previews round-trip through body text, headers, footers, footnotes, and endnotes.`, 'info'));
|
|
292
|
-
if (unsupported || spoofed) issues.push(equationIssue('docx.equations.unsupported', `${unsupported + spoofed} equation-like object(s) use unsupported, malformed, misplaced, namespace-spoofed, relationship-bound, or ambiguous markup. They are flattened to bounded text instead of being treated as trusted structured OMML. Invalid or non-combining accent characters, malformed math-run, script, function, argument-property, or math-paragraph structures, unknown, duplicated, reordered, spoofed, out-of-range, or contradictory Word math-run casing, strike, relief, animation, line-border, visibility, geometry, manual-width, vertical-alignment, emphasis-mark, East Asian typography, paragraph-mark visibility, Office 2010 glow/shadow/outline/text-fill color transforms, glow/shadow/reflection geometry, outline fill/gradient/dash/join structure, text-fill wrapper/fill/gradient structure, 3D-scene camera/light structure, or 3D-property extrusion/contour/bevel/color structure, missing, malformed, or non-leaf Office 2010 ligature, numeral-form, or numeral-spacing values, malformed or over-limit stylistic-set containers, entries, IDs, or on/off values, malformed contextual-alternate leaves or on/off values, coordinate values, preset values, directions, or rotation angles, highlight, shading, object-control, or argument-control formatting, malformed control-revision identities, dates, children, or nesting, out-of-range or malformed argument sizes, invalid or contradictory fraction, radical, n-ary, delimiter, bar, group-character, phantom, border-box, box, or equation-array properties, malformed pre-script or lower/upper limit structures, malformed, duplicated, reordered, or out-of-range matrix spacing/gap properties, ragged or over-limit matrices, over-limit equation arrays, and nested Office Math remain outside the structured subset.`));
|
|
293
|
-
if (total > MAX_EDITABLE_EQUATIONS) issues.push(equationIssue('docx.equations.limit', `Only the first ${MAX_EDITABLE_EQUATIONS} valid equations enter the editable structured model; later equations are flattened to bounded text.`));
|
|
294
|
-
return issues;
|
|
295
|
-
}
|
|
296
|
-
function closestEquationRoot(element) {
|
|
297
|
-
let current = element;
|
|
298
|
-
while(current){
|
|
299
|
-
if ('oMath' === current.localName || 'oMathPara' === current.localName) return current;
|
|
300
|
-
current = current.parentElement;
|
|
301
|
-
}
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
function equationIssue(code, message, severity = 'warning') {
|
|
305
|
-
return {
|
|
306
|
-
code,
|
|
307
|
-
feature: 'Equations',
|
|
308
|
-
message,
|
|
309
|
-
severity
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
265
|
const EMPHASIS_DIAGNOSTIC_PART_PATTERN = /^word\/(?:document|styles|header\d*|footer\d*|footnotes|endnotes)\.xml$/i;
|
|
313
266
|
async function diagnoseDocxEmphasisMarks(archive, document) {
|
|
314
267
|
const parts = [
|
|
@@ -356,6 +309,53 @@ async function diagnoseDocxEmphasisMarks(archive, document) {
|
|
|
356
309
|
});
|
|
357
310
|
return issues;
|
|
358
311
|
}
|
|
312
|
+
const EQUATION_PART_PATTERN = /^word\/(?:header\d*|footer\d*|footnotes|endnotes)\.xml$/i;
|
|
313
|
+
const MAX_EDITABLE_EQUATIONS = 4096;
|
|
314
|
+
async function diagnoseDocxEquations(archive, document) {
|
|
315
|
+
const parts = document ? [
|
|
316
|
+
{
|
|
317
|
+
path: 'word/document.xml',
|
|
318
|
+
document
|
|
319
|
+
}
|
|
320
|
+
] : [];
|
|
321
|
+
for (const path of archive.paths('word/').filter((candidate)=>EQUATION_PART_PATTERN.test(candidate)))parts.push({
|
|
322
|
+
path,
|
|
323
|
+
document: await archive.xml(path)
|
|
324
|
+
});
|
|
325
|
+
let supported = 0;
|
|
326
|
+
let unsupported = 0;
|
|
327
|
+
let spoofed = 0;
|
|
328
|
+
for (const part of parts)for (const element of Array.from(part.document.querySelectorAll('*')).filter((candidate)=>'oMath' === candidate.localName || 'oMathPara' === candidate.localName)){
|
|
329
|
+
if (closestEquationRoot(element.parentElement)) continue;
|
|
330
|
+
const inspection = inspectDocxEquation(element);
|
|
331
|
+
if ('supported' === inspection.status && isSupportedDocxEquationPlacement(element)) supported += 1;
|
|
332
|
+
else if ('spoofed' === inspection.status) spoofed += 1;
|
|
333
|
+
else unsupported += 1;
|
|
334
|
+
}
|
|
335
|
+
const total = supported + unsupported + spoofed;
|
|
336
|
+
if (!total) return [];
|
|
337
|
+
const issues = [];
|
|
338
|
+
if (supported) issues.push(equationIssue('docx.equations', `${supported} native OMML equation(s) use the editable structured subset. Inline equations and display equations with left, right, center, or center-group paragraph justification, Unicode math runs with literal/normal-text semantics, six math scripts, four styles, manual breaks, alignment points, ordered core Word run formatting for fonts/theme references, emphasis, casing, strike, relief effects, legacy text animations, bounded line borders, proofing/grid flags, visibility, colors, bounded character spacing, horizontal scaling, kerning thresholds, signed baseline positions, half-point sizes, named highlights, patterned shading, bounded manual run widths with optional grouping IDs, explicit baseline/superscript/subscript run alignment, all five Word emphasis-mark values, underlines, script direction, languages, native-only East Asian typography with signed run IDs, two-lines-in-one brackets, rotation, and compression, inert paragraph-mark visibility resets, and Office 2010 text glow, shadow, reflection, text-outline, text-fill, 3D-scene, and 3D-property effects with bounded radii, offsets, outline widths, extrusion heights, and contour widths, exact direction and reflection opacity/position/fade geometry, signed scale and skew, rectangle and pen alignment, glow/shadow/outline/fill/extrusion/contour RGB or theme colors and ordered transform chains, none/solid/gradient outline and text fills with bounded stops and linear/path shading, preset dashes, round/bevel/miter joins, all camera, light-rig, bevel, and material presets, all light directions, exact optional rotation angles, ordered top/bottom bevel plus extrusion/contour color branches, all 16 ligature combinations, three numeral forms, three numeral-spacing modes, bounded Office 2010 stylistic-set lists, and explicit contextual-alternate controls with exact combined CSS OpenType projection and distinct clig/calt behavior, with exact direct RGB and default-black text fills projected to MathML while complex effects remain native metadata, and the same bounded Word formatting in ordered object-level control properties and native-only argument-slot control properties, bounded insertion, deletion, move-source, and move-destination provenance around those math controls, ordered fractions with four native types and a bar default, ordered right-side scripts with aligned sub/superscripts, left-side pre-sub/superscripts with empty script slots, radicals with optional degrees and canonical square-root slots, functions with required, optionally empty name/argument slots, canonical empty arguments across every supported construct, ordered argument/control properties, bounded relative argument sizes with Word-effective MathML script-level projection and native-only preservation elsewhere, and strictly aligned matrix-cell, equation-array-row, and delimiter-argument metadata, ordered n-ary operators with default integrals, canonical empty limit slots, and optional operand growth, combining accents, overbars and underbars, group characters with explicit character position and baseline justification, phantoms with visible or hidden bases, zeroed width/ascent/descent, and transparent spacing, border boxes with independently visible edges and four strike directions, semantic boxes with operator-emulation, no-break, differential-spacing, manual-break, and alignment properties, bounded rectangular matrices with ordered row-spacing, column-gap, and minimum-width controls, equation arrays with bounded rows, vertical base alignment, distribution, row-spacing, and alignment/spacer markers, lower and upper limit objects, ordered delimiters with distinct omitted/empty characters, bounded empty argument slots, growing or fixed sizing, and centered or content-matched shape, and their accessible MathML previews round-trip through body text, headers, footers, footnotes, and endnotes.`, 'info'));
|
|
339
|
+
if (unsupported || spoofed) issues.push(equationIssue('docx.equations.unsupported', `${unsupported + spoofed} equation-like object(s) use unsupported, malformed, misplaced, namespace-spoofed, relationship-bound, or ambiguous markup. They are flattened to bounded text instead of being treated as trusted structured OMML. Invalid or non-combining accent characters, malformed math-run, script, function, argument-property, or math-paragraph structures, unknown, duplicated, reordered, spoofed, out-of-range, or contradictory Word math-run casing, strike, relief, animation, line-border, visibility, geometry, manual-width, vertical-alignment, emphasis-mark, East Asian typography, paragraph-mark visibility, Office 2010 glow/shadow/outline/text-fill color transforms, glow/shadow/reflection geometry, outline fill/gradient/dash/join structure, text-fill wrapper/fill/gradient structure, 3D-scene camera/light structure, or 3D-property extrusion/contour/bevel/color structure, missing, malformed, or non-leaf Office 2010 ligature, numeral-form, or numeral-spacing values, malformed or over-limit stylistic-set containers, entries, IDs, or on/off values, malformed contextual-alternate leaves or on/off values, coordinate values, preset values, directions, or rotation angles, highlight, shading, object-control, or argument-control formatting, malformed control-revision identities, dates, children, or nesting, out-of-range or malformed argument sizes, invalid or contradictory fraction, radical, n-ary, delimiter, bar, group-character, phantom, border-box, box, or equation-array properties, malformed pre-script or lower/upper limit structures, malformed, duplicated, reordered, or out-of-range matrix spacing/gap properties, ragged or over-limit matrices, over-limit equation arrays, and nested Office Math remain outside the structured subset.`));
|
|
340
|
+
if (total > MAX_EDITABLE_EQUATIONS) issues.push(equationIssue('docx.equations.limit', `Only the first ${MAX_EDITABLE_EQUATIONS} valid equations enter the editable structured model; later equations are flattened to bounded text.`));
|
|
341
|
+
return issues;
|
|
342
|
+
}
|
|
343
|
+
function closestEquationRoot(element) {
|
|
344
|
+
let current = element;
|
|
345
|
+
while(current){
|
|
346
|
+
if ('oMath' === current.localName || 'oMathPara' === current.localName) return current;
|
|
347
|
+
current = current.parentElement;
|
|
348
|
+
}
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
function equationIssue(code, message, severity = 'warning') {
|
|
352
|
+
return {
|
|
353
|
+
code,
|
|
354
|
+
feature: 'Equations',
|
|
355
|
+
message,
|
|
356
|
+
severity
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
359
|
const HIDDEN_TEXT_DIAGNOSTIC_PART_PATTERN = /^word\/(?:document|styles|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
|
|
360
360
|
async function diagnoseDocxHiddenText(archive, document) {
|
|
361
361
|
const parts = [
|
|
@@ -992,6 +992,48 @@ async function diagnoseDocxProofing(archive, document) {
|
|
|
992
992
|
});
|
|
993
993
|
return issues;
|
|
994
994
|
}
|
|
995
|
+
const RUN_BORDER_PART_PATTERN = /^word\/(?:document|styles|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
|
|
996
|
+
async function diagnoseDocxRunBorders(archive, document) {
|
|
997
|
+
const themePath = archive.paths('word/theme/').find((path)=>/\/theme\d*\.xml$/i.test(path));
|
|
998
|
+
const themeDocument = themePath ? await archive.xml(themePath) : null;
|
|
999
|
+
const settingsDocument = archive.has('word/settings.xml') ? await archive.xml('word/settings.xml') : null;
|
|
1000
|
+
const theme = createDocxThemeResolver(themeDocument, settingsDocument);
|
|
1001
|
+
const parts = [
|
|
1002
|
+
document
|
|
1003
|
+
];
|
|
1004
|
+
for (const path of archive.paths('word/'))if ('word/document.xml' !== path.toLowerCase() && RUN_BORDER_PART_PATTERN.test(path)) parts.push(await archive.xml(path));
|
|
1005
|
+
let validCount = 0;
|
|
1006
|
+
let resetCount = 0;
|
|
1007
|
+
let invalidCount = 0;
|
|
1008
|
+
for (const part of parts){
|
|
1009
|
+
for (const properties of descendants(part, 'rPr').filter((element)=>DOCX_WORDPROCESSING_NAMESPACES.has(element.namespaceURI ?? ''))){
|
|
1010
|
+
if (!directChildren(properties, 'bdr').length) continue;
|
|
1011
|
+
const inspection = inspectDocxRunBorder(properties, theme);
|
|
1012
|
+
if ('valid' === inspection.status) {
|
|
1013
|
+
validCount += 1;
|
|
1014
|
+
if (!documentRunBorderIsVisible(inspection.value)) resetCount += 1;
|
|
1015
|
+
} else invalidCount += 1 + inspection.spoofedCount;
|
|
1016
|
+
}
|
|
1017
|
+
invalidCount += descendants(part, 'bdr').filter((element)=>{
|
|
1018
|
+
const parent = element.parentElement;
|
|
1019
|
+
return !parent || 'rPr' !== parent.localName || !DOCX_WORDPROCESSING_NAMESPACES.has(parent.namespaceURI ?? '');
|
|
1020
|
+
}).length;
|
|
1021
|
+
}
|
|
1022
|
+
const issues = [];
|
|
1023
|
+
if (validCount) issues.push({
|
|
1024
|
+
code: 'docx.run-borders',
|
|
1025
|
+
severity: 'info',
|
|
1026
|
+
feature: 'Character borders',
|
|
1027
|
+
message: `${validCount} native character border(s), including ${resetCount} explicit reset(s), were detected across document defaults, styles, body, page chrome, notes, comments, and formatting revisions. Writer preserves all 25 visible Word line styles plus nil and none, direct and theme colors, eighth-point widths, spacing, shadow, and frame semantics through editing, Format Painter, one-step Undo, and exact DOCX export. The browser and PDF paint is a bounded CSS approximation, and no non-standard shortcut is invented.`
|
|
1028
|
+
});
|
|
1029
|
+
if (invalidCount) issues.push({
|
|
1030
|
+
code: 'docx.run-borders.invalid',
|
|
1031
|
+
severity: 'warning',
|
|
1032
|
+
feature: 'Character borders',
|
|
1033
|
+
message: `${invalidCount} malformed, duplicated, misplaced, namespace-spoofed, text-bearing, child-bearing, extra-attribute, art-style, out-of-range, or unresolved-theme character border value(s) are normalized to explicit nil resets instead of enabling untrusted paint or inheriting stale formatting.`
|
|
1034
|
+
});
|
|
1035
|
+
return issues;
|
|
1036
|
+
}
|
|
995
1037
|
const RUN_FONT_DIAGNOSTIC_PART_PATTERN = /^word\/(?:document|styles|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
|
|
996
1038
|
async function diagnoseDocxRunFonts(archive, document) {
|
|
997
1039
|
const parts = [
|
|
@@ -1049,48 +1091,6 @@ async function diagnoseDocxRunFonts(archive, document) {
|
|
|
1049
1091
|
});
|
|
1050
1092
|
return issues;
|
|
1051
1093
|
}
|
|
1052
|
-
const RUN_BORDER_PART_PATTERN = /^word\/(?:document|styles|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
|
|
1053
|
-
async function diagnoseDocxRunBorders(archive, document) {
|
|
1054
|
-
const themePath = archive.paths('word/theme/').find((path)=>/\/theme\d*\.xml$/i.test(path));
|
|
1055
|
-
const themeDocument = themePath ? await archive.xml(themePath) : null;
|
|
1056
|
-
const settingsDocument = archive.has('word/settings.xml') ? await archive.xml('word/settings.xml') : null;
|
|
1057
|
-
const theme = createDocxThemeResolver(themeDocument, settingsDocument);
|
|
1058
|
-
const parts = [
|
|
1059
|
-
document
|
|
1060
|
-
];
|
|
1061
|
-
for (const path of archive.paths('word/'))if ('word/document.xml' !== path.toLowerCase() && RUN_BORDER_PART_PATTERN.test(path)) parts.push(await archive.xml(path));
|
|
1062
|
-
let validCount = 0;
|
|
1063
|
-
let resetCount = 0;
|
|
1064
|
-
let invalidCount = 0;
|
|
1065
|
-
for (const part of parts){
|
|
1066
|
-
for (const properties of descendants(part, 'rPr').filter((element)=>DOCX_WORDPROCESSING_NAMESPACES.has(element.namespaceURI ?? ''))){
|
|
1067
|
-
if (!directChildren(properties, 'bdr').length) continue;
|
|
1068
|
-
const inspection = inspectDocxRunBorder(properties, theme);
|
|
1069
|
-
if ('valid' === inspection.status) {
|
|
1070
|
-
validCount += 1;
|
|
1071
|
-
if (!documentRunBorderIsVisible(inspection.value)) resetCount += 1;
|
|
1072
|
-
} else invalidCount += 1 + inspection.spoofedCount;
|
|
1073
|
-
}
|
|
1074
|
-
invalidCount += descendants(part, 'bdr').filter((element)=>{
|
|
1075
|
-
const parent = element.parentElement;
|
|
1076
|
-
return !parent || 'rPr' !== parent.localName || !DOCX_WORDPROCESSING_NAMESPACES.has(parent.namespaceURI ?? '');
|
|
1077
|
-
}).length;
|
|
1078
|
-
}
|
|
1079
|
-
const issues = [];
|
|
1080
|
-
if (validCount) issues.push({
|
|
1081
|
-
code: 'docx.run-borders',
|
|
1082
|
-
severity: 'info',
|
|
1083
|
-
feature: 'Character borders',
|
|
1084
|
-
message: `${validCount} native character border(s), including ${resetCount} explicit reset(s), were detected across document defaults, styles, body, page chrome, notes, comments, and formatting revisions. Writer preserves all 25 visible Word line styles plus nil and none, direct and theme colors, eighth-point widths, spacing, shadow, and frame semantics through editing, Format Painter, one-step Undo, and exact DOCX export. The browser and PDF paint is a bounded CSS approximation, and no non-standard shortcut is invented.`
|
|
1085
|
-
});
|
|
1086
|
-
if (invalidCount) issues.push({
|
|
1087
|
-
code: 'docx.run-borders.invalid',
|
|
1088
|
-
severity: 'warning',
|
|
1089
|
-
feature: 'Character borders',
|
|
1090
|
-
message: `${invalidCount} malformed, duplicated, misplaced, namespace-spoofed, text-bearing, child-bearing, extra-attribute, art-style, out-of-range, or unresolved-theme character border value(s) are normalized to explicit nil resets instead of enabling untrusted paint or inheriting stale formatting.`
|
|
1091
|
-
});
|
|
1092
|
-
return issues;
|
|
1093
|
-
}
|
|
1094
1094
|
const RUN_SHADING_PART_PATTERN = /^word\/(?:document|styles|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
|
|
1095
1095
|
const VALID_SHADING_PARENTS = new Set([
|
|
1096
1096
|
'rPr',
|
|
@@ -2198,20 +2198,22 @@ async function analyzeDocxCompatibility(file, messages, sourcePackage) {
|
|
|
2198
2198
|
];
|
|
2199
2199
|
const runFormattingRevisions = descendants(document, 'rPrChange');
|
|
2200
2200
|
const paragraphFormattingRevisions = descendants(document, 'pPrChange');
|
|
2201
|
+
const numberingRevisions = descendants(document, 'numberingChange');
|
|
2201
2202
|
const supportedRunFormattingRevisionCount = runFormattingRevisions.filter(isSupportedDocxRunFormattingChange).length;
|
|
2202
2203
|
const supportedParagraphFormattingRevisionCount = paragraphFormattingRevisions.filter(isSupportedDocxParagraphFormattingChange).length;
|
|
2204
|
+
const supportedNumberingRevisionCount = numberingRevisions.filter(isSupportedDocxNumberingChange).length;
|
|
2203
2205
|
if (textRevisions.some((revision)=>descendants(revision, 't').length || descendants(revision, 'delText').length)) issues.push(work_office_diagnostics_issue('docx.revisions', 'Tracked changes', 'Body-text insertions and deletions preserve their author and date, remain reviewable in Work, and round-trip as native DOCX revisions.', 'info'));
|
|
2204
2206
|
if (supportedRunFormattingRevisionCount) issues.push(work_office_diagnostics_issue('docx.revisions.formatting', 'Character-formatting revisions', `${supportedRunFormattingRevisionCount} bounded character-formatting revision(s) preserve author, date, current formatting, and prior bold, italic, underline, strike, text case, hidden text, outline, shadow, emboss, imprint, subscript, superscript, font, size, color, highlight, character borders, character shading, character scale, spacing, kerning threshold, emphasis mark, baseline position, grid state, proofing languages, and explicit proofing state. They remain reviewable in Work and round-trip as native w:rPrChange records.`, 'info'));
|
|
2205
2207
|
if (supportedParagraphFormattingRevisionCount) issues.push(work_office_diagnostics_issue('docx.revisions.paragraph-formatting', 'Paragraph-formatting revisions', `${supportedParagraphFormattingRevisionCount} bounded paragraph-formatting revision(s) preserve author, date, current formatting, and prior alignment, direction, indentation, spacing, pagination, outline, tab-stop, border, shading, and collapsed state. They remain reviewable in Work and round-trip as native w:pPrChange records.`, 'info'));
|
|
2206
|
-
if (
|
|
2208
|
+
if (supportedNumberingRevisionCount) issues.push(work_office_diagnostics_issue('docx.revisions.numbering', 'Numbering revisions', `${supportedNumberingRevisionCount} bounded ordered-list numbering revision(s) preserve author, date, prior start, and common decimal, letter, or Roman formats. Contiguous list-item records remain reviewable as one Work change and round-trip as native w:numberingChange records.`, 'info'));
|
|
2209
|
+
if (textRevisions.some((revision)=>!descendants(revision, 't').length && !descendants(revision, 'delText').length) || supportedRunFormattingRevisionCount !== runFormattingRevisions.length || supportedParagraphFormattingRevisionCount !== paragraphFormattingRevisions.length || supportedNumberingRevisionCount !== numberingRevisions.length || [
|
|
2207
2210
|
'moveFrom',
|
|
2208
2211
|
'moveTo',
|
|
2209
2212
|
'tblPrChange',
|
|
2210
2213
|
'trPrChange',
|
|
2211
2214
|
'tcPrChange',
|
|
2212
|
-
'sectPrChange'
|
|
2213
|
-
|
|
2214
|
-
].some((name)=>descendants(document, name).length)) issues.push(work_office_diagnostics_issue('docx.revisions.structural', 'Structural revisions', 'Moved content plus unsupported character formatting, paragraph formatting, numbering, section, row, cell, and table-property revisions may be normalized; Work currently reviews body-text insertions/deletions and bounded character- and paragraph-formatting subsets.'));
|
|
2215
|
+
'sectPrChange'
|
|
2216
|
+
].some((name)=>descendants(document, name).length)) issues.push(work_office_diagnostics_issue('docx.revisions.structural', 'Structural revisions', 'Moved content plus unsupported character formatting, paragraph formatting, numbering, section, row, cell, and table-property revisions may be normalized; Work currently reviews body-text insertions/deletions and bounded character-, paragraph-, and ordered-list-numbering subsets.'));
|
|
2215
2217
|
if (captionDiagnostics.hasUnsupportedFields) issues.push(work_office_diagnostics_issue('docx.fields', 'Fields', 'Fields beyond supported body fields, citations, bibliographies, caption SEQ fields, and bookmark or caption REF fields are converted to their current displayed value.'));
|
|
2216
2218
|
const sectionProperties = descendants(document, 'sectPr');
|
|
2217
2219
|
const columnProperties = descendants(document, 'cols');
|
|
@@ -566,7 +566,7 @@ async function parseSlide(archive, slidePart, slideNumber, slideWidthEmu, slideH
|
|
|
566
566
|
addIssue(context, 'pptx.transition', 'Slide transitions', transition.transition ? 'Basic slide transitions and advance timing are preserved, editable, and replayed in presentation preview.' : 'This slide transition is not editable and remains in the original PPTX only.', transition.transition ? 'info' : 'warning');
|
|
567
567
|
for (const diagnostic of transition.diagnostics)addIssue(context, diagnostic.code, 'Slide transitions', diagnostic.message);
|
|
568
568
|
}
|
|
569
|
-
if (animationResult.animations.length) addIssue(context, 'pptx.animation', 'Animations', `${animationResult.animations.length} supported object entrance animation(s) are preserved, editable, replayed, and exported.`, 'info');
|
|
569
|
+
if (animationResult.animations.length) addIssue(context, 'pptx.animation', 'Animations', `${animationResult.animations.length} supported object entrance or exit animation(s) are preserved, editable, replayed, and exported.`, 'info');
|
|
570
570
|
for (const diagnostic of animationResult.diagnostics)addIssue(context, diagnostic.code, 'Animations', diagnostic.message);
|
|
571
571
|
for (const relationship of relationships.values())if (relationship.type.includes('/audio') || relationship.type.includes('/video') || relationship.type.includes('/media')) addIssue(context, 'pptx.media', 'Embedded media', 'Audio and video remain in the original file but are not playable yet.');
|
|
572
572
|
else if (relationship.type.endsWith('/oleObject') || relationship.type.endsWith('/package')) addIssue(context, 'pptx.ole', 'Embedded objects', 'Embedded Office or OLE objects remain in the original file only.');
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const CARDINAL_DIRECTIONS = new Set([
|
|
2
|
+
'left',
|
|
3
|
+
'right',
|
|
4
|
+
'up',
|
|
5
|
+
'down'
|
|
6
|
+
]);
|
|
7
|
+
const SPLIT_DIRECTIONS = new Set([
|
|
8
|
+
'in',
|
|
9
|
+
'out'
|
|
10
|
+
]);
|
|
11
|
+
function createWorkSlideTransition(type, previous) {
|
|
12
|
+
const common = {
|
|
13
|
+
type,
|
|
14
|
+
speed: previous?.speed ?? 'medium',
|
|
15
|
+
advanceOnClick: previous?.advanceOnClick ?? true,
|
|
16
|
+
advanceAfterMs: previous?.advanceAfterMs
|
|
17
|
+
};
|
|
18
|
+
if ('push' === type || 'wipe' === type) return {
|
|
19
|
+
...common,
|
|
20
|
+
direction: previous?.direction && CARDINAL_DIRECTIONS.has(previous.direction) ? previous.direction : 'left'
|
|
21
|
+
};
|
|
22
|
+
if ('split' === type) return {
|
|
23
|
+
...common,
|
|
24
|
+
direction: previous?.direction && SPLIT_DIRECTIONS.has(previous.direction) ? previous.direction : 'out',
|
|
25
|
+
orientation: previous?.orientation ?? 'horizontal'
|
|
26
|
+
};
|
|
27
|
+
return common;
|
|
28
|
+
}
|
|
29
|
+
function slideTransitionDurationMilliseconds(transition) {
|
|
30
|
+
if (transition?.speed === 'fast') return 500;
|
|
31
|
+
if (transition?.speed === 'slow') return 2000;
|
|
32
|
+
return 1000;
|
|
33
|
+
}
|
|
34
|
+
function workSlideTransitionsEqual(left, right) {
|
|
35
|
+
if (!left || !right) return left === right;
|
|
36
|
+
return left.type === right.type && left.speed === right.speed && left.direction === right.direction && left.orientation === right.orientation && left.advanceOnClick === right.advanceOnClick && left.advanceAfterMs === right.advanceAfterMs;
|
|
37
|
+
}
|
|
38
|
+
export { createWorkSlideTransition, slideTransitionDurationMilliseconds, workSlideTransitionsEqual };
|
package/dist/4121.js
CHANGED
|
@@ -2929,8 +2929,8 @@ const WORK_TEMPLATES = [
|
|
|
2929
2929
|
{
|
|
2930
2930
|
id: 'animated-deck',
|
|
2931
2931
|
kind: 'presentation',
|
|
2932
|
-
name: '
|
|
2933
|
-
description: '
|
|
2932
|
+
name: '进入与退出动画',
|
|
2933
|
+
description: '进入、退出、触发、计时、排序与放映预览',
|
|
2934
2934
|
accent: '#7657c8'
|
|
2935
2935
|
}
|
|
2936
2936
|
];
|
|
@@ -2967,7 +2967,7 @@ function initialTitle(templateId, kind) {
|
|
|
2967
2967
|
'data-validation': '数据验证示例',
|
|
2968
2968
|
'structured-references': '结构化引用示例',
|
|
2969
2969
|
'strategy-deck': '业务策略汇报',
|
|
2970
|
-
'animated-deck': '
|
|
2970
|
+
'animated-deck': '进入与退出动画示例'
|
|
2971
2971
|
};
|
|
2972
2972
|
if (titles[templateId]) return titles[templateId];
|
|
2973
2973
|
if ('document' === kind) return '无标题文字';
|
|
@@ -4115,9 +4115,9 @@ function animatedPresentation() {
|
|
|
4115
4115
|
slides: [
|
|
4116
4116
|
{
|
|
4117
4117
|
id: createWorkId('slide'),
|
|
4118
|
-
name: '
|
|
4118
|
+
name: '进入与退出',
|
|
4119
4119
|
background: '#17162b',
|
|
4120
|
-
notes: '
|
|
4120
|
+
notes: '从“动画”选项卡分别编辑进入与退出效果、触发方式、持续时间、延迟和顺序,再从头放映验证逐步播放。',
|
|
4121
4121
|
elements: [
|
|
4122
4122
|
{
|
|
4123
4123
|
id: titleId,
|
|
@@ -4126,7 +4126,7 @@ function animatedPresentation() {
|
|
|
4126
4126
|
y: 10,
|
|
4127
4127
|
width: 76,
|
|
4128
4128
|
height: 16,
|
|
4129
|
-
text: '
|
|
4129
|
+
text: '让对象按叙事顺序登场与退场',
|
|
4130
4130
|
fontSize: 34,
|
|
4131
4131
|
color: '#ffffff',
|
|
4132
4132
|
fill: 'transparent',
|
|
@@ -4140,7 +4140,7 @@ function animatedPresentation() {
|
|
|
4140
4140
|
y: 28,
|
|
4141
4141
|
width: 68,
|
|
4142
4142
|
height: 9,
|
|
4143
|
-
text: '
|
|
4143
|
+
text: '一次单击完成入场,再次单击依次退场',
|
|
4144
4144
|
fontSize: 16,
|
|
4145
4145
|
color: '#b9b7dc',
|
|
4146
4146
|
fill: 'transparent',
|
|
@@ -4154,7 +4154,7 @@ function animatedPresentation() {
|
|
|
4154
4154
|
y: 46,
|
|
4155
4155
|
width: 52,
|
|
4156
4156
|
height: 20,
|
|
4157
|
-
text: '
|
|
4157
|
+
text: '从左侧飞入,再向右侧飞出',
|
|
4158
4158
|
fontSize: 19,
|
|
4159
4159
|
color: '#211f35',
|
|
4160
4160
|
fill: '#d9d3ff',
|
|
@@ -4169,7 +4169,7 @@ function animatedPresentation() {
|
|
|
4169
4169
|
y: 46,
|
|
4170
4170
|
width: 26,
|
|
4171
4171
|
height: 20,
|
|
4172
|
-
text: '
|
|
4172
|
+
text: '最后缩放\n进入与退出',
|
|
4173
4173
|
fontSize: 17,
|
|
4174
4174
|
color: '#ffffff',
|
|
4175
4175
|
fill: '#7657c8',
|
|
@@ -4208,7 +4208,40 @@ function animatedPresentation() {
|
|
|
4208
4208
|
id: createWorkId('slide-animation'),
|
|
4209
4209
|
elementId: conclusionId,
|
|
4210
4210
|
effect: 'zoom',
|
|
4211
|
+
trigger: 'after-previous',
|
|
4212
|
+
durationMs: 650,
|
|
4213
|
+
delayMs: 0
|
|
4214
|
+
},
|
|
4215
|
+
{
|
|
4216
|
+
id: createWorkId('slide-animation'),
|
|
4217
|
+
elementId: titleId,
|
|
4218
|
+
effect: 'disappear',
|
|
4211
4219
|
trigger: 'on-click',
|
|
4220
|
+
durationMs: 300,
|
|
4221
|
+
delayMs: 0
|
|
4222
|
+
},
|
|
4223
|
+
{
|
|
4224
|
+
id: createWorkId('slide-animation'),
|
|
4225
|
+
elementId: subtitleId,
|
|
4226
|
+
effect: 'fade-out',
|
|
4227
|
+
trigger: 'with-previous',
|
|
4228
|
+
durationMs: 600,
|
|
4229
|
+
delayMs: 100
|
|
4230
|
+
},
|
|
4231
|
+
{
|
|
4232
|
+
id: createWorkId('slide-animation'),
|
|
4233
|
+
elementId: sequenceId,
|
|
4234
|
+
effect: 'fly-out',
|
|
4235
|
+
trigger: 'after-previous',
|
|
4236
|
+
durationMs: 700,
|
|
4237
|
+
delayMs: 150,
|
|
4238
|
+
direction: 'right'
|
|
4239
|
+
},
|
|
4240
|
+
{
|
|
4241
|
+
id: createWorkId('slide-animation'),
|
|
4242
|
+
elementId: conclusionId,
|
|
4243
|
+
effect: 'zoom-out',
|
|
4244
|
+
trigger: 'after-previous',
|
|
4212
4245
|
durationMs: 650,
|
|
4213
4246
|
delayMs: 0
|
|
4214
4247
|
}
|