@a3s-lab/office 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +41 -1
  2. package/dist/0~1403.js +1 -1
  3. package/dist/0~4980.js +1 -1
  4. package/dist/0~5093.js +164 -5
  5. package/dist/0~7043.js +241 -241
  6. package/dist/0~7048.js +1 -1
  7. package/dist/0~7614.js +1 -1
  8. package/dist/0~document-editor.js +626 -12
  9. package/dist/0~presentation-editor.js +1 -1
  10. package/dist/0~spreadsheet-editor.js +1 -2
  11. package/dist/0~work-docx-export.js +396 -20
  12. package/dist/0~work-docx-import.js +7 -3
  13. package/dist/0~work-office-diagnostics.js +98 -4
  14. package/dist/0~work-pptx-export.js +1 -1
  15. package/dist/0~work-pptx-import.js +1 -1
  16. package/dist/0~work-presentation-charts.js +1 -1
  17. package/dist/1544.js +1 -1
  18. package/dist/4104.js +2 -2
  19. package/dist/4121.js +1510 -0
  20. package/dist/6282.js +220 -682
  21. package/dist/8715.js +1 -1
  22. package/dist/core.js +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/internal/features/work/editors/document-command-catalog.d.ts +9 -0
  25. package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +33 -2
  26. package/dist/internal/features/work/editors/document-font-dialog-run-border-model.d.ts +24 -0
  27. package/dist/internal/features/work/editors/document-font-dialog-run-border-section.d.ts +10 -0
  28. package/dist/internal/features/work/work-document-character-formatting.d.ts +4 -0
  29. package/dist/internal/features/work/work-document-format-changes.d.ts +5 -0
  30. package/dist/internal/features/work/work-document-legacy-text-effects.d.ts +27 -0
  31. package/dist/internal/features/work/work-document-run-border.d.ts +11 -0
  32. package/dist/internal/features/work/work-document-word-line-metrics.d.ts +5 -0
  33. package/dist/internal/features/work/work-docx-hidden-text-export.d.ts +1 -0
  34. package/dist/internal/features/work/work-docx-legacy-text-effects-diagnostics.d.ts +3 -0
  35. package/dist/internal/features/work/work-docx-legacy-text-effects-export.d.ts +18 -0
  36. package/dist/internal/features/work/work-docx-legacy-text-effects.d.ts +12 -0
  37. package/dist/internal/features/work/work-docx-run-border-diagnostics.d.ts +3 -0
  38. package/dist/internal/features/work/work-docx-run-border-export.d.ts +17 -0
  39. package/dist/internal/features/work/work-docx-run-border.d.ts +20 -0
  40. package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +6 -0
  41. package/dist/internal/features/work/work-docx-run-property-order.d.ts +2 -0
  42. package/dist/office-kernel.wasm +0 -0
  43. package/dist/styles.css +72 -0
  44. package/docs/latest/en/browser-editor-architecture.md +36 -0
  45. package/package.json +7 -1
  46. package/dist/5184.js +0 -649
  47. package/dist/9424.js +0 -16
@@ -11,7 +11,7 @@ import extension_underline from "@tiptap/extension-underline";
11
11
  import { EditorContent, useEditor } from "@tiptap/react";
12
12
  import starter_kit from "@tiptap/starter-kit";
13
13
  import { canUngroupPresentationElements, withPresentationDesign, withPresentationDesignMetadata, groupPresentationElements, expandPresentationGroupSelection, ungroupPresentationElements, presentationSlideViewFromDesign, canGroupPresentationElements, presentationSlideView, applyPresentationLayout, presentationSelectionUnits, remapPresentationGroupPaths } from "./0~1403.js";
14
- import { createOfficeId as createWorkId } from "./5184.js";
14
+ import { createOfficeId as createWorkId } from "./4121.js";
15
15
  import { OfficeTableInsertPopover, readOfficeFileAsDataUrl } from "./0~9445.js";
16
16
  import { normalizePresentationChartLegendPosition, presentationChartDataLabelPositions, presentationChartDataLabelText, normalizePresentationBubbleSizeRepresents, parsePresentationChartCategories, presentationChartXValues, withPresentationChartLayout, presentationChartTypeLabel, presentationChartAxes, withPresentationChartSeriesAnalysis, presentationChartUsesNumericXAxis, presentationChartSupportsSeriesMarkers, presentationChartBubbleSizes, createPresentationChartElement, parsePresentationChartValueDraft, normalizePresentationChartDataLabelPosition, presentationChartSupportsAxisTitles, withPresentationChartDataLabels, withPresentationChartType, createPresentationChartSeries, presentationChartErrorBarCount, normalizePresentationScatterStyle, withPresentationChartSeriesStyle, normalizePresentationBubbleScale, presentationChartDataLabelPositionLabel, presentationChartShowsLegend, presentationChartTrendlineCount, presentationChartHasDataLabels, normalizeDoughnutHoleSize, withPresentationChartAxes } from "./0~work-presentation-charts.js";
17
17
  import { spreadsheetChartSeriesLayout, workSpreadsheetChartSupportsGrouping, normalizeWorkSpreadsheetChartSmoothLines, workSpreadsheetChartAxisIsValueAxis, fitSpreadsheetTrendline, spreadsheetChartSeriesLegendColor, normalizeWorkSpreadsheetChartSeriesStyle, spreadsheetChartCategoryVisualIndex, errorBarSourceValues, normalizeWorkSpreadsheetErrorBars, workSpreadsheetChartSupportsTrendlines, normalizeWorkSpreadsheetChartLegendOverlay, normalizeWorkSpreadsheetChartGapWidth, spreadsheetChartCategoryLabelVisible, spreadsheetChartAxisLabelLayout, workSpreadsheetChartSupportsSmoothLines, workSpreadsheetChartGroupingIsStacked, normalizeWorkSpreadsheetChartGrouping, workSpreadsheetChartSupportsBarSpacing, workSpreadsheetChartSupportsErrorBars, spreadsheetChartSeriesLineStyle, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartSupportsSeriesAnalysis, workSpreadsheetChartAxisIsCategoryAxis, spreadsheetErrorBarAmounts, spreadsheetChartAxisValueRatio, spreadsheetChartAxisScale, normalizeWorkSpreadsheetChartOverlap, spreadsheetChartBarGeometry, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, spreadsheetChartAxisGridlinesVisible, normalizeWorkSpreadsheetTrendline, roundChartNumber, formatSpreadsheetChartAxisNumber, spreadsheetChartSeriesFillStyle } from "./8715.js";
@@ -7,11 +7,10 @@ import { convertSpanToShareString, genarate, indexToColumnChar, update as core_u
7
7
  import { freezeImportedSpreadsheetCell, withXlsxPatternFill, spreadsheetMatrixProfile, xlsxRichTextCellText, spreadsheetTextOrientationFromAngle, spreadsheetCellValueWithDiagonalBorder, xlsxSemanticColorMatchesValue, spreadsheetUnderlineCellValue, normalizeXlsxRichTextEditSource, attachSpreadsheetShownCommentCells, sameSpreadsheetHistoryValue, isSpreadsheetConditionalComparisonOperator, defaultSpreadsheetConditionalIconThresholds, normalizeXlsxRichTextCell, activeXlsxNativeFill, xlsxPatternFillTypes, normalizeSpreadsheetDateValidationBoundary, unlockedCellCount, editableRangeRequiresCredentials, spreadsheetTextOrientationChoiceFromCell, spreadsheetConditionalThresholdValue, withSheetProtection, defaultSpreadsheetColorScaleThresholds, protectedSheetCount, sameXlsxRichTextRunStyle, withSheetSelectionPermissions, spreadsheetTextOrientationFromCell, patchSpreadsheetRichTextFontRuns, readOfficeSpreadsheetCollaboration as readWorkOfficeSpreadsheetCollaboration, spreadsheetConditionalThresholdsEqual, spreadsheetVisibleTextRotationFromCell, spreadsheetTextOrientationFromChoice, normalizeXlsxSemanticColorOrigin, withoutEditableRange, isSpreadsheetTextOrientationId, normalizeSpreadsheetConditionalVisualOptions, withXlsxGradientFill, effectiveSpreadsheetPageSetup, normalizeXlsxPatternFill, normalizeXlsxRichTextColor, isHighSurrogate, xlsxNativeFillCellKeys, withEditableRange, createOfficeSpreadsheetCollaborationBinding as createWorkOfficeSpreadsheetCollaborationBinding, spreadsheetConditionalIconForValue, spreadsheetUnderlineStyle, sheetProtectionAuthority, normalizeXlsxGradientFill, xlsxGradientFillFallbackColor, editableRangeCellCount, registerDerivedSpreadsheetMatrix, deleteXlsxNativeFills, spreadsheetTextOrientationCellStyle, normalizeSpreadsheetConditionalIconSetFormat, defaultSpreadsheetDataBarOptions, normalizeSheetProtectionAuthority, spreadsheetProtectionKey, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, normalizeXlsxRichTextRun, spreadsheetDiagonalBorderFromCellValue, SPREADSHEET_CONDITIONAL_ICON_SETS, isLowSurrogate, spreadsheetConditionalComparisonNeedsUpperValue, drawSpreadsheetConditionalIcon, coalesceXlsxRichTextRuns, replaceOfficeSpreadsheetCollaboration as replaceWorkOfficeSpreadsheetCollaboration, validXlsxRichText, isSpreadsheetUnderlineStyle } from "./1544.js";
8
8
  import { workSpreadsheetChartSupportsGrouping, spreadsheetFormulaRangesForSelection, createSpreadsheetChartFromSelection, normalizeWorkSpreadsheetDataLabelPosition, normalizeSpreadsheetPrintTitleColumns, normalizeSpreadsheetPrintTitleRows, formulaHasStructuredReference, normalizeWorkSpreadsheetErrorBars, defaultPivotValueCaption, workSpreadsheetChartSupportsBarSpacing, normalizeWorkSpreadsheetChartGrouping, spreadsheetGridSize, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetScatterStyle, cloneSparseMatrix, spreadsheetPivotAggregationLabel, workSpreadsheetChartAxisIsCategoryAxis, reconcileSpreadsheetChartPreviews, normalizeWorkSpreadsheetChartAxes, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetChartLegendPosition, spreadsheetChartCount, workSpreadsheetChartTypeLabel, sparseArrayEntries, normalizeWorkSpreadsheetTrendline, effectiveSpreadsheetCalculationSettings, spreadsheetPivotIntersects, normalizeWorkSpreadsheetDataLabels, spreadsheetPivotOutputContains, normalizeSpreadsheetPrintArea, spreadsheetCellAddress, formatSpreadsheetCellRanges, normalizeWorkSpreadsheetChartLayout, spreadsheetFormulaRangeForCell, workSpreadsheetChartAxisIsValueAxis, normalizeWorkSpreadsheetChartSmoothLines, spreadsheetPivotFilterValueKey, normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetChartSeriesStyle, volatileSpreadsheetFormulaFunctions, sparseArrayIndexes, normalizeWorkSpreadsheetBubbleSizeRepresents, workSpreadsheetChartSupportsTrendlines, normalizeWorkSpreadsheetChartLegendOverlay, parseSpreadsheetChartReference, workSpreadsheetChartGroupingIsStacked, normalizeWorkSpreadsheetChartGapWidth, workSpreadsheetChartSupportsSmoothLines, refreshSpreadsheetPivotTables, createSpreadsheetPivotFromSelection, reconcileSpreadsheetPivots, spreadsheetPivotCount, sparseMatrixColumnCount, workSpreadsheetChartSupportsErrorBars, formulaHasExternalReference, isValidSpreadsheetDefinedName, spreadsheetPivotValidation, deleteSpreadsheetPivotTable, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartSupportsSeriesAnalysis, parseSpreadsheetCellRanges, spreadsheetPivotFilterItems, spreadsheetPivotFields, normalizeWorkSpreadsheetChartOverlap, spreadsheetFormulaRangeConflict, spreadsheetSheetsWithChartPreviews, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, workSpreadsheetChartSupportsAxes, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetRadarStyle } from "./8715.js";
9
9
  import { moveOfficeMenuFocus, stepOfficeZoom, useOfficeRemoteParticipants, Popover, officePresenceColor, useOfficePublishPresenceLocation, button_Button, icon_button_IconButton, moveOfficeGridMenuFocus, office_text_field_OfficeTextField, useDialogFocusScope, useOfficeEditorWheelZoom } from "./0~6090.js";
10
- import { normalizeCssColor } from "./9424.js";
10
+ import { isOfficeKernelSpreadsheetError, normalizeCssColor, OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, createOfficeId as createWorkId } from "./4121.js";
11
11
  import { useOfficeTaskPaneEscape, OfficeCheckbox, CommittedOfficeNumberField, useOfficeDialog, useOfficeTaskPaneModal, createOfficeKernelClient, officeFontFamilies, CollectionState, OfficeNumberField, handleOfficeTaskPaneKeyDown } from "./0~7048.js";
12
12
  import { isOfficeShortcutBlocked, OfficeColorPicker } from "./0~3635.js";
13
13
  import { createOfficeEditorExtension, useOfficeEditorRuntime, useOfficeEditorKeyboardShortcuts } from "./0~3557.js";
14
- import { OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, createOfficeId as createWorkId, isOfficeKernelSpreadsheetError } from "./5184.js";
15
14
  import { showToast } from "./6489.js";
16
15
  import { unsupportedSpreadsheetFormulaFunctions } from "./0~work-spreadsheet-formula-support.js";
17
16
  import { WorkspaceContextMenu, isWorkspaceContextMenuKeyboardEvent, WorkOfficeZoomControls, Tabs, WorkOfficeStatusBar, Dialog, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkOfficeRibbonGroup, WorkOfficeRibbonButton, WorkOfficePreviewBar } from "./0~4595.js";
@@ -1,6 +1,6 @@
1
1
  import jszip from "jszip";
2
- import { normalizeDocumentBookmarkName, normalizeDocumentEmphasisMark, DOCUMENT_STRIKE_STYLE_ATTRIBUTE, applyDocumentImageIdentityToElement, documentEmphasisMarkFromElement, DOCUMENT_PAGE_BORDER_EDGES, DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE, documentScriptFontSlotFromElement, normalizeDocumentColumns, createDocumentImageIdentityRegistry, serializeDocumentScriptFonts, documentCharacterSpacingTwipsFromElement, uniqueDocumentParagraphIdentity, documentCharacterPositionHalfPointsFromElement, normalizeDocumentTableVerticalAlign, documentTableColumnPercentagesFromElement, normalizeDocumentTextCase, documentTableCellMarginOverridesFromElement, applyDocumentTableRowIdentityToElement, normalizeDocumentBookmarksHtml, documentImageIdentityFromElement, documentTableGeometryFromElement, normalizeDocumentTableRowHeightRule, normalizeDocumentScriptFonts, documentNoteKey, normalizeDocumentHiddenText, normalizeDocumentParagraphBorders, normalizeDocumentTableBorderWidth, normalizeDocumentCharacterSpacingTwips, normalizeDocumentParagraphId, documentStrikeFormattingFromElement, normalizeDocumentTableBorderStyle, normalizeDocumentBookmarkReferencesHtml, documentCitationInstruction, parseDocumentParagraphBordersElement, documentImageWrapContourFromElement, documentImagePositionFromElement, normalizeDocumentCharacterScalePercent, documentScriptFontsFromElement, normalizeDocumentUnderlineStyle, documentPageMarginsForLayout, normalizeDocumentPageChrome, normalizeDocumentImageLayer, documentFontNameFromCssFamily, documentKerningThresholdHalfPointsFromElement, documentImageCropFromElement, documentBookmarkReferenceInstruction, normalizeDocumentPageBorders, documentImageLayerFromElement, parseDocumentScriptFonts, documentCaptionLabel, documentCaptionKind, applyDocumentParagraphIdentityToElement, isContourImageLayout, parseDocxThemeReference, normalizeDocumentImageIdentity, normalizeDocumentStrikeStyle, normalizeTableColor, createDocumentParagraphIdentityRegistry, documentCitationTags, docxDocumentFieldKind, documentTableBordersFromElement, documentSections, wrapsBesideImage, normalizeDocumentCharacterPositionHalfPoints, normalizeDocumentKerningThresholdHalfPoints, DocxThemePatchCollector, defaultDocumentImageWrapContour, normalizeDocumentParagraphIdentity, normalizeDocumentPaperSource, documentEquationFromElement, DOCUMENT_PARAGRAPH_BORDER_EDGES, parseDocumentCharacterFormatting, documentScriptFontFamily, documentUnderlineFormattingFromElement, documentParagraphIdentityFromElement, normalizeDocumentEquation, patchDocxThemeReferences, parseDocumentParagraphShadingElement, normalizeDocumentBookmarkNativeId, parseDocumentParagraphFormatting, DOCUMENT_PAGE_MARGIN_KEYS, uniqueDocumentImageIdentity, documentHiddenTextFromElement, documentTableRowIdentityFromElement, documentImageLayoutFromElement, documentScriptFontSlotFromHint, collectDocumentNotes, documentPageHorizontalMarginTwips, documentPageGeometryForLayout, normalizeDocumentScriptFontSlot, normalizeDocumentPageMargins, documentCharacterScalePercentFromElement, documentNoteKind } from "./6282.js";
3
- import { serializeUtf8Xml, directChildren, xmlNamespacePrefix, parseXml, decodeXmlBytes, descendants, resolvePartTarget, directChild, attribute as work_ooxml_package_attribute } from "./5184.js";
2
+ import { normalizeDocumentBookmarkName, normalizeDocumentEmphasisMark, DOCUMENT_STRIKE_STYLE_ATTRIBUTE, applyDocumentImageIdentityToElement, documentEmphasisMarkFromElement, DOCUMENT_PAGE_BORDER_EDGES, DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE, documentScriptFontSlotFromElement, normalizeDocumentColumns, createDocumentImageIdentityRegistry, serializeDocumentScriptFonts, documentCharacterSpacingTwipsFromElement, uniqueDocumentParagraphIdentity, documentCharacterPositionHalfPointsFromElement, normalizeDocumentTableVerticalAlign, documentTableColumnPercentagesFromElement, normalizeDocumentTextCase, documentTableCellMarginOverridesFromElement, applyDocumentTableRowIdentityToElement, normalizeDocumentBookmarksHtml, documentImageIdentityFromElement, documentTableGeometryFromElement, normalizeDocumentTableRowHeightRule, normalizeDocumentScriptFonts, documentNoteKey, DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE, normalizeDocumentHiddenText, documentLegacyTextEffectsConflict, normalizeDocumentTableBorderWidth, normalizeDocumentCharacterSpacingTwips, normalizeDocumentParagraphId, documentStrikeFormattingFromElement, normalizeDocumentTableBorderStyle, normalizeDocumentBookmarkReferencesHtml, documentCitationInstruction, documentImageWrapContourFromElement, documentImagePositionFromElement, normalizeDocumentCharacterScalePercent, documentScriptFontsFromElement, normalizeDocumentUnderlineStyle, documentPageMarginsForLayout, normalizeDocumentPageChrome, normalizeDocumentImageLayer, documentFontNameFromCssFamily, documentKerningThresholdHalfPointsFromElement, documentImageCropFromElement, documentBookmarkReferenceInstruction, normalizeDocumentPageBorders, documentImageLayerFromElement, normalizeDocumentLegacyTextEffects, documentCaptionLabel, documentCaptionKind, applyDocumentParagraphIdentityToElement, DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE, isContourImageLayout, parseDocumentScriptFonts, normalizeDocumentStrikeStyle, normalizeDocumentImageIdentity, createDocumentParagraphIdentityRegistry, documentCitationTags, docxDocumentFieldKind, normalizeTableColor, documentTableBordersFromElement, documentSections, wrapsBesideImage, normalizeDocumentCharacterPositionHalfPoints, normalizeDocumentKerningThresholdHalfPoints, defaultDocumentImageWrapContour, normalizeDocumentParagraphIdentity, normalizeDocumentPaperSource, DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE, documentEquationFromElement, documentLegacyTextEffectsFromElement, parseDocumentCharacterFormatting, documentScriptFontFamily, documentParagraphIdentityFromElement, DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE, normalizeDocumentEquation, documentUnderlineFormattingFromElement, normalizeDocumentBookmarkNativeId, parseDocumentParagraphShadingElement, DOCUMENT_PAGE_MARGIN_KEYS, uniqueDocumentImageIdentity, documentHiddenTextFromElement, parseDocumentParagraphFormatting, documentImageLayoutFromElement, documentScriptFontSlotFromHint, documentTableRowIdentityFromElement, documentPageHorizontalMarginTwips, collectDocumentNotes, documentPageGeometryForLayout, normalizeDocumentScriptFontSlot, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, documentCharacterScalePercentFromElement, normalizeDocumentPageMargins, normalizeDocumentLegacyTextEffect, documentNoteKind } from "./6282.js";
3
+ import { normalizeDocumentParagraphBorders, serializeUtf8Xml, DOCUMENT_PARAGRAPH_BORDER_EDGES, normalizeDocumentRunBorder, parseDocumentRunBorder, parseXml, decodeXmlBytes, parseDocxThemeReference, patchDocxThemeReferences, descendants, resolvePartTarget, attribute as work_ooxml_package_attribute, parseDocumentParagraphBordersElement, DOCUMENT_RUN_BORDER_ATTRIBUTE, directChildren, xmlNamespacePrefix, parseDocumentRunBorderElement, DocxThemePatchCollector, directChild } from "./4121.js";
4
4
  import { assignDocxNoteIds, patchDocxPageColor, normalizeDocxCommentId, assignDocxCommentThreads } from "./0~4980.js";
5
5
  import { paragraphTabStops, mergeDocxIgnorableExtensionsAtPairs, patchDocxBibliography, docxKerningThresholdValue, docxCharacterPositionValue, docxCharacterScaleValue, docxEmphasisMarkRunOptions, XMLNS_NAMESPACE as work_docx_settings_xml_XMLNS_NAMESPACE, paragraphAlignment, paragraphSpacingOptions, xmlNamespaceUri, hasNonWhitespaceXmlText, patchDocxExplicitZeroCharacterSpacing, cloneXmlElement, cssColorToHex, DocxParagraphDefaultCollapsedPatchCollector, assertXmlRoot, xmlDeclaredPrefix, paragraphIndent, domDirection, DOCX_WORDPROCESSING_NAMESPACES, paragraphBidirectional, XML_NAMESPACE as work_docx_settings_xml_XML_NAMESPACE, patchDocxParagraphDefaultCollapsed, xmlAttributeNamespace, dataBoolean, mergeDocxIgnorableExtensions, patchDocxExplicitZeroKerningThresholds, parseDocxColorSchemeMappingElement, paragraphPaginationOptions, DOCX_COLOR_SCHEME_MAPPING_ATTRIBUTES, xmlAttributeLocalName, cssFontSize, paragraphDirectionOptions, cssFontFamily, docxCharacterSpacingValue } from "./0~7043.js";
6
6
  import { normalizeDocumentHref } from "./0~work-document-links.js";
@@ -757,8 +757,7 @@ function hasAncestor(element, localName) {
757
757
  }
758
758
  return false;
759
759
  }
760
- const HIDDEN_TEXT_PART_PATTERN = /^word\/(?:document|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
761
- const WORD_RUN_PROPERTY_ORDER = [
760
+ const DOCX_RUN_PROPERTY_ORDER = [
762
761
  'rStyle',
763
762
  'rFonts',
764
763
  'b',
@@ -799,11 +798,12 @@ const WORD_RUN_PROPERTY_ORDER = [
799
798
  'specVanish',
800
799
  'rPrChange'
801
800
  ];
802
- const WORD_RUN_PROPERTY_RANK = new Map(WORD_RUN_PROPERTY_ORDER.map((name, index)=>[
801
+ const DOCX_RUN_PROPERTY_RANK = new Map(DOCX_RUN_PROPERTY_ORDER.map((name, index)=>[
803
802
  name,
804
803
  index
805
804
  ]));
806
- const VANISH_RANK = WORD_RUN_PROPERTY_RANK.get('vanish') ?? 0;
805
+ const HIDDEN_TEXT_PART_PATTERN = /^word\/(?:document|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
806
+ const VANISH_RANK = DOCX_RUN_PROPERTY_RANK.get('vanish') ?? 0;
807
807
  class DocxHiddenTextPatchCollector {
808
808
  patches = [];
809
809
  nextMarker = 1;
@@ -838,6 +838,9 @@ class DocxHiddenTextPatchCollector {
838
838
  this.markersByValueAndStyle.set(key, marker);
839
839
  return marker;
840
840
  }
841
+ lookup(marker) {
842
+ return marker ? this.patchesByMarker.get(marker) : void 0;
843
+ }
841
844
  originalStyle(style) {
842
845
  let current = style;
843
846
  const seen = new Set();
@@ -897,7 +900,7 @@ function insertHiddenTextProperty(document, properties, value) {
897
900
  if (!value) vanish.setAttributeNS(namespace, `${prefix}:val`, '0');
898
901
  const next = directChildren(properties).find((child)=>{
899
902
  if (!DOCX_WORDPROCESSING_NAMESPACES.has(child.namespaceURI ?? '')) return true;
900
- return (WORD_RUN_PROPERTY_RANK.get(child.localName) ?? 1 / 0) > VANISH_RANK;
903
+ return (DOCX_RUN_PROPERTY_RANK.get(child.localName) ?? 1 / 0) > VANISH_RANK;
901
904
  });
902
905
  properties.insertBefore(vanish, next ?? null);
903
906
  }
@@ -911,6 +914,128 @@ function setWordValue(element, value) {
911
914
  for (const attribute of Array.from(element.attributes))if ('val' === xmlAttributeLocalName(attribute) && DOCX_WORDPROCESSING_NAMESPACES.has(xmlAttributeNamespace(element, attribute) ?? '')) element.removeAttributeNode(attribute);
912
915
  element.setAttributeNS(namespace, `${prefix}:val`, value);
913
916
  }
917
+ const LEGACY_TEXT_EFFECTS_PART_PATTERN = /^word\/(?:document|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
918
+ class DocxLegacyTextEffectsPatchCollector {
919
+ patches = [];
920
+ nextMarker = 1;
921
+ occupied;
922
+ patchesByMarker = new Map();
923
+ markersByEffectsAndStyle = new Map();
924
+ constructor(source){
925
+ this.occupied = source;
926
+ }
927
+ marker(value, inheritedStyle) {
928
+ const effects = normalizeDocumentLegacyTextEffects(value);
929
+ if (!effects || !Object.keys(effects).length) throw new Error('Document contains invalid legacy text effects.');
930
+ const style = this.originalStyle(inheritedStyle);
931
+ const key = JSON.stringify([
932
+ DOCUMENT_LEGACY_TEXT_EFFECT_NAMES.map((name)=>effects[name] ?? null),
933
+ style ?? null
934
+ ]);
935
+ const existing = this.markersByEffectsAndStyle.get(key);
936
+ if (existing) return existing;
937
+ let marker = '';
938
+ do {
939
+ marker = `A3SOfficeLegacyTextEffects${String(this.nextMarker).padStart(8, '0')}`;
940
+ this.nextMarker += 1;
941
+ }while (this.occupied.includes(marker) || this.patches.some((patch)=>patch.marker === marker))
942
+ const patch = {
943
+ marker,
944
+ effects,
945
+ ...style ? {
946
+ style
947
+ } : {}
948
+ };
949
+ this.patches.push(patch);
950
+ this.patchesByMarker.set(marker, patch);
951
+ this.markersByEffectsAndStyle.set(key, marker);
952
+ return marker;
953
+ }
954
+ lookup(marker) {
955
+ return marker ? this.patchesByMarker.get(marker) : void 0;
956
+ }
957
+ originalStyle(style) {
958
+ let current = style;
959
+ const seen = new Set();
960
+ while(current && !seen.has(current)){
961
+ seen.add(current);
962
+ const patch = this.patchesByMarker.get(current);
963
+ if (!patch) break;
964
+ current = patch.style;
965
+ }
966
+ return current;
967
+ }
968
+ }
969
+ async function patchDocxLegacyTextEffects(buffer, patches) {
970
+ if (!patches.length) return buffer;
971
+ const byMarker = new Map();
972
+ for (const patch of patches){
973
+ const effects = normalizeDocumentLegacyTextEffects(patch.effects);
974
+ if (!patch.marker || !effects || !Object.keys(effects).length || byMarker.has(patch.marker)) throw new Error('Document contains invalid legacy text-effect patches.');
975
+ byMarker.set(patch.marker, {
976
+ ...patch,
977
+ effects
978
+ });
979
+ }
980
+ const archive = await jszip.loadAsync(buffer);
981
+ const applied = new Set();
982
+ for (const entry of Object.values(archive.files)){
983
+ if (entry.dir || !LEGACY_TEXT_EFFECTS_PART_PATTERN.test(entry.name)) continue;
984
+ const document = parseXml(decodeXmlBytes(await entry.async('uint8array'), `generated DOCX ${entry.name}`), `generated DOCX ${entry.name}`);
985
+ let changed = false;
986
+ for (const properties of descendants(document, 'rPr')){
987
+ if (!DOCX_WORDPROCESSING_NAMESPACES.has(properties.namespaceURI ?? '')) continue;
988
+ const markerStyles = directChildren(properties, 'rStyle').filter((style)=>{
989
+ if (!DOCX_WORDPROCESSING_NAMESPACES.has(style.namespaceURI ?? '')) return false;
990
+ const marker = work_docx_legacy_text_effects_export_wordValue(style);
991
+ return null !== marker && byMarker.has(marker);
992
+ });
993
+ if (!markerStyles.length) continue;
994
+ if (1 !== markerStyles.length) throw new Error('Generated DOCX legacy text-effect marker is duplicated in one run.');
995
+ const marker = work_docx_legacy_text_effects_export_wordValue(markerStyles[0]);
996
+ const patch = marker ? byMarker.get(marker) : void 0;
997
+ if (marker && patch) {
998
+ if (DOCUMENT_LEGACY_TEXT_EFFECT_NAMES.some((name)=>directChildren(properties, name).length > 0)) throw new Error('Generated DOCX legacy text-effect marker unexpectedly has a native value.');
999
+ if (patch.style) work_docx_legacy_text_effects_export_setWordValue(markerStyles[0], patch.style);
1000
+ else markerStyles[0].remove();
1001
+ for (const name of DOCUMENT_LEGACY_TEXT_EFFECT_NAMES){
1002
+ const value = patch.effects[name];
1003
+ if (void 0 !== value) insertLegacyTextEffectProperty(document, properties, name, value);
1004
+ }
1005
+ applied.add(marker);
1006
+ changed = true;
1007
+ }
1008
+ }
1009
+ if (changed) archive.file(entry.name, serializeUtf8Xml(document));
1010
+ }
1011
+ const missing = patches.filter((patch)=>!applied.has(patch.marker));
1012
+ if (missing.length) throw new Error(`DOCX legacy text-effect markers were not emitted: ${missing.map((patch)=>patch.marker).join(', ')}.`);
1013
+ return archive.generateAsync({
1014
+ type: 'arraybuffer'
1015
+ });
1016
+ }
1017
+ function insertLegacyTextEffectProperty(document, properties, name, value) {
1018
+ const namespace = properties.namespaceURI ?? '';
1019
+ const prefix = properties.prefix || 'w';
1020
+ const effect = document.createElementNS(namespace, `${prefix}:${name}`);
1021
+ if (!value) effect.setAttributeNS(namespace, `${prefix}:val`, '0');
1022
+ const rank = DOCX_RUN_PROPERTY_RANK.get(name) ?? 0;
1023
+ const next = directChildren(properties).find((child)=>{
1024
+ if (!DOCX_WORDPROCESSING_NAMESPACES.has(child.namespaceURI ?? '')) return true;
1025
+ return (DOCX_RUN_PROPERTY_RANK.get(child.localName) ?? 1 / 0) > rank;
1026
+ });
1027
+ properties.insertBefore(effect, next ?? null);
1028
+ }
1029
+ function work_docx_legacy_text_effects_export_wordValue(element) {
1030
+ const values = Array.from(element.attributes).filter((attribute)=>'val' === xmlAttributeLocalName(attribute) && DOCX_WORDPROCESSING_NAMESPACES.has(xmlAttributeNamespace(element, attribute) ?? ''));
1031
+ return 1 === values.length ? values[0].value : null;
1032
+ }
1033
+ function work_docx_legacy_text_effects_export_setWordValue(element, value) {
1034
+ const namespace = element.namespaceURI ?? '';
1035
+ const prefix = element.prefix || 'w';
1036
+ for (const attribute of Array.from(element.attributes))if ('val' === xmlAttributeLocalName(attribute) && DOCX_WORDPROCESSING_NAMESPACES.has(xmlAttributeNamespace(element, attribute) ?? '')) element.removeAttributeNode(attribute);
1037
+ element.setAttributeNS(namespace, `${prefix}:val`, value);
1038
+ }
914
1039
  const MATH_NAMESPACE = 'http://schemas.openxmlformats.org/officeDocument/2006/math';
915
1040
  const work_docx_equation_export_WORD_NAMESPACE = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
916
1041
  const WORD_DATE_UTC_NAMESPACE = 'http://schemas.microsoft.com/office/word/2023/wordml/word16du';
@@ -2375,9 +2500,10 @@ function appendFormattingProperties(document, properties, namespace, prefix, ser
2375
2500
  appendBooleanProperty(document, properties, namespace, prefix, byType, 'bold', 'bCs');
2376
2501
  appendBooleanProperty(document, properties, namespace, prefix, byType, 'italic', 'i');
2377
2502
  appendBooleanProperty(document, properties, namespace, prefix, byType, 'italic', 'iCs');
2378
- appendUnderlineProperty(document, properties, namespace, prefix, byType.get('underline'));
2379
- appendStrikeProperties(document, properties, namespace, prefix, byType.get('strike'));
2380
2503
  appendTextCaseProperties(document, properties, namespace, prefix, byType.get('textStyle'));
2504
+ appendStrikeProperties(document, properties, namespace, prefix, byType.get('strike'));
2505
+ appendLegacyTextEffectsProperties(document, properties, namespace, prefix, byType.get('textStyle'));
2506
+ appendSnapToGridProperty(document, properties, namespace, prefix, byType.get('textStyle'));
2381
2507
  appendHiddenTextProperty(document, properties, namespace, prefix, byType.get('textStyle'));
2382
2508
  appendColorProperty(document, properties, namespace, prefix, byType.get('textStyle'));
2383
2509
  appendCharacterSpacingProperty(document, properties, namespace, prefix, byType.get('textStyle'));
@@ -2386,10 +2512,61 @@ function appendFormattingProperties(document, properties, namespace, prefix, ser
2386
2512
  appendCharacterPositionProperty(document, properties, namespace, prefix, byType.get('textStyle'));
2387
2513
  appendFontSizeProperties(document, properties, namespace, prefix, byType.get('textStyle'));
2388
2514
  appendHighlightProperty(document, properties, namespace, prefix, byType.get('highlight'));
2389
- appendSnapToGridProperty(document, properties, namespace, prefix, byType.get('textStyle'));
2515
+ appendUnderlineProperty(document, properties, namespace, prefix, byType.get('underline'));
2516
+ appendRunBorderProperty(document, properties, namespace, prefix, byType.get('textStyle'));
2390
2517
  appendVerticalAlignProperty(document, properties, namespace, prefix, byType);
2391
2518
  appendEmphasisMarkProperty(document, properties, namespace, prefix, byType.get('textStyle'));
2392
2519
  }
2520
+ function appendRunBorderProperty(document, properties, namespace, prefix, mark) {
2521
+ const border = parseDocumentRunBorder(mark?.attrs?.runBorder);
2522
+ if (!border) return;
2523
+ const element = wordElement(document, namespace, prefix, 'bdr');
2524
+ work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'val', border.style);
2525
+ if (border.color) {
2526
+ work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'color', 'auto' === border.color.value ? 'auto' : border.color.value.slice(1).toUpperCase());
2527
+ if (border.color.theme) {
2528
+ work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'themeColor', border.color.theme.theme);
2529
+ if (border.color.theme.tint) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'themeTint', border.color.theme.tint);
2530
+ if (border.color.theme.shade) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'themeShade', border.color.theme.shade);
2531
+ }
2532
+ }
2533
+ if (void 0 !== border.size) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'sz', String(border.size));
2534
+ if (void 0 !== border.space) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'space', String(border.space));
2535
+ if (void 0 !== border.shadow) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'shadow', border.shadow ? '1' : '0');
2536
+ if (void 0 !== border.frame) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'frame', border.frame ? '1' : '0');
2537
+ properties.append(element);
2538
+ }
2539
+ function appendLegacyTextEffectsProperties(document, properties, namespace, prefix, mark) {
2540
+ const effects = {};
2541
+ const attributes = [
2542
+ [
2543
+ 'outline',
2544
+ 'legacyTextOutline'
2545
+ ],
2546
+ [
2547
+ 'shadow',
2548
+ 'legacyTextShadow'
2549
+ ],
2550
+ [
2551
+ 'emboss',
2552
+ 'legacyTextEmboss'
2553
+ ],
2554
+ [
2555
+ 'imprint',
2556
+ 'legacyTextImprint'
2557
+ ]
2558
+ ];
2559
+ for (const [effect, attribute] of attributes){
2560
+ const value = normalizeDocumentLegacyTextEffect(mark?.attrs?.[attribute]);
2561
+ if (null !== value) effects[effect] = value;
2562
+ }
2563
+ if (documentLegacyTextEffectsConflict(effects)) throw new Error('Document contains conflicting legacy text effects.');
2564
+ for (const name of DOCUMENT_LEGACY_TEXT_EFFECT_NAMES){
2565
+ const value = effects[name];
2566
+ if (void 0 !== value) if (value) properties.append(wordElement(document, namespace, prefix, name));
2567
+ else appendValuedProperty(document, properties, namespace, prefix, name, '0');
2568
+ }
2569
+ }
2393
2570
  function appendHiddenTextProperty(document, properties, namespace, prefix, mark) {
2394
2571
  const hiddenText = normalizeDocumentHiddenText(mark?.attrs?.hiddenText);
2395
2572
  if (null === hiddenText) return;
@@ -7671,6 +7848,110 @@ function setWordFontAttribute(element, name, value) {
7671
7848
  const prefix = element.prefix || 'w';
7672
7849
  element.setAttributeNS(namespace, `${prefix}:${name}`, value);
7673
7850
  }
7851
+ const work_docx_run_border_export_WORD_NAMESPACE = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
7852
+ class DocxRunBorderPatchCollector {
7853
+ patches = [];
7854
+ nextMarker = 1;
7855
+ usedColors;
7856
+ constructor(sourceHtml){
7857
+ this.usedColors = work_docx_run_border_export_sourceColors(sourceHtml);
7858
+ }
7859
+ marker(source) {
7860
+ const border = normalizeDocumentRunBorder(source);
7861
+ if (!border) return null;
7862
+ let marker = '';
7863
+ do {
7864
+ const value = 0xc00000 + this.nextMarker;
7865
+ if (value > 0xcfffff) throw new Error('DOCX character border marker space is exhausted.');
7866
+ marker = value.toString(16).padStart(6, '0').toUpperCase();
7867
+ this.nextMarker += 1;
7868
+ }while (this.usedColors.has(marker))
7869
+ this.usedColors.add(marker);
7870
+ this.patches.push({
7871
+ marker,
7872
+ border
7873
+ });
7874
+ return marker;
7875
+ }
7876
+ hasMarker(value) {
7877
+ const marker = value?.toUpperCase();
7878
+ return Boolean(marker && this.patches.some((patch)=>patch.marker === marker));
7879
+ }
7880
+ }
7881
+ function documentRunBorderDocxOptions(source, collector) {
7882
+ const marker = collector.marker(source);
7883
+ return marker ? {
7884
+ border: {
7885
+ style: 'single',
7886
+ color: marker,
7887
+ size: 2,
7888
+ space: 0
7889
+ }
7890
+ } : {};
7891
+ }
7892
+ async function patchDocxRunBorders(buffer, patches) {
7893
+ if (!patches.length) return buffer;
7894
+ const archive = await jszip.loadAsync(buffer);
7895
+ const byMarker = new Map(patches.map((patch)=>[
7896
+ patch.marker,
7897
+ patch
7898
+ ]));
7899
+ const applied = new Set();
7900
+ for (const entry of Object.values(archive.files)){
7901
+ if (entry.dir || !/^word\/(?:document|header\d+|footer\d+|footnotes|endnotes|comments)\.xml$/i.test(entry.name)) continue;
7902
+ const document = parseXml(await entry.async('text'), entry.name);
7903
+ let changed = false;
7904
+ for (const element of Array.from(document.getElementsByTagName('*'))){
7905
+ if ('bdr' !== element.localName || element.namespaceURI !== work_docx_run_border_export_WORD_NAMESPACE || element.parentElement?.localName !== 'rPr') continue;
7906
+ const marker = work_docx_run_border_export_wordAttribute(element, 'color')?.toUpperCase();
7907
+ const patch = marker ? byMarker.get(marker) : void 0;
7908
+ if (marker && patch) {
7909
+ replaceRunBorderAttributes(document, element, patch.border);
7910
+ applied.add(marker);
7911
+ changed = true;
7912
+ }
7913
+ }
7914
+ if (changed) archive.file(entry.name, serializeUtf8Xml(document));
7915
+ }
7916
+ const missing = patches.filter((patch)=>!applied.has(patch.marker));
7917
+ if (missing.length) throw new Error(`Generated DOCX is missing ${missing.length} character border marker(s).`);
7918
+ return archive.generateAsync({
7919
+ type: 'arraybuffer'
7920
+ });
7921
+ }
7922
+ function setDocxRunBorderAttributes(document, element, border) {
7923
+ work_docx_run_border_export_setWordAttribute(document, element, 'val', border.style);
7924
+ const color = border.color;
7925
+ if (color) {
7926
+ work_docx_run_border_export_setWordAttribute(document, element, 'color', 'auto' === color.value ? 'auto' : color.value.slice(1).toUpperCase());
7927
+ if (color.theme) {
7928
+ work_docx_run_border_export_setWordAttribute(document, element, 'themeColor', color.theme.theme);
7929
+ if (color.theme.tint) work_docx_run_border_export_setWordAttribute(document, element, 'themeTint', color.theme.tint);
7930
+ if (color.theme.shade) work_docx_run_border_export_setWordAttribute(document, element, 'themeShade', color.theme.shade);
7931
+ }
7932
+ }
7933
+ if (void 0 !== border.size) work_docx_run_border_export_setWordAttribute(document, element, 'sz', String(border.size));
7934
+ if (void 0 !== border.space) work_docx_run_border_export_setWordAttribute(document, element, 'space', String(border.space));
7935
+ if (void 0 !== border.shadow) work_docx_run_border_export_setWordAttribute(document, element, 'shadow', border.shadow ? '1' : '0');
7936
+ if (void 0 !== border.frame) work_docx_run_border_export_setWordAttribute(document, element, 'frame', border.frame ? '1' : '0');
7937
+ }
7938
+ function replaceRunBorderAttributes(document, element, border) {
7939
+ for (const attribute of Array.from(element.attributes))if ('xmlns' !== attribute.name && !attribute.name.startsWith('xmlns:')) element.removeAttributeNode(attribute);
7940
+ element.replaceChildren();
7941
+ setDocxRunBorderAttributes(document, element, border);
7942
+ }
7943
+ function work_docx_run_border_export_sourceColors(source) {
7944
+ const colors = new Set();
7945
+ for (const match of source.matchAll(/#([0-9a-f]{6})\b/gi))if (match[1]) colors.add(match[1].toUpperCase());
7946
+ return colors;
7947
+ }
7948
+ function work_docx_run_border_export_wordAttribute(element, name) {
7949
+ return element.getAttributeNS(work_docx_run_border_export_WORD_NAMESPACE, name) ?? element.getAttribute(`w:${name}`);
7950
+ }
7951
+ function work_docx_run_border_export_setWordAttribute(document, element, name, value) {
7952
+ const prefix = xmlNamespacePrefix(document.documentElement, work_docx_run_border_export_WORD_NAMESPACE) ?? 'w';
7953
+ element.setAttributeNS(work_docx_run_border_export_WORD_NAMESPACE, `${prefix}:${name}`, value);
7954
+ }
7674
7955
  async function createDocxBlob(content, sourcePackage) {
7675
7956
  const docx = await import("docx");
7676
7957
  const normalizedContent = {
@@ -7707,6 +7988,10 @@ async function createDocxBlob(content, sourcePackage) {
7707
7988
  formattingChangePatches: new DocxRunFormattingChangePatchCollector(),
7708
7989
  runFontPatches: new DocxRunFontsPatchCollector(JSON.stringify(normalizedContent)),
7709
7990
  hiddenTextPatches: new DocxHiddenTextPatchCollector(JSON.stringify(normalizedContent)),
7991
+ legacyTextEffectsPatches: new DocxLegacyTextEffectsPatchCollector(JSON.stringify(normalizedContent)),
7992
+ runBorderPatches: new DocxRunBorderPatchCollector(JSON.stringify(normalizedContent)),
7993
+ usedRunBorderMarkers: new Set(),
7994
+ usedNativeTextEffectMarkers: new Set(),
7710
7995
  paragraphFormattingChangePatches: new DocxParagraphFormattingChangePatchCollector(),
7711
7996
  hasExplicitZeroCharacterSpacing: false,
7712
7997
  hasExplicitZeroKerningThreshold: false
@@ -7759,8 +8044,10 @@ async function createDocxBlob(content, sourcePackage) {
7759
8044
  const characterSpacingPatched = noteContext.hasExplicitZeroCharacterSpacing ? await patchDocxExplicitZeroCharacterSpacing(await packed.arrayBuffer()) : await packed.arrayBuffer();
7760
8045
  const kerningPatched = noteContext.hasExplicitZeroKerningThreshold ? await patchDocxExplicitZeroKerningThresholds(characterSpacingPatched) : characterSpacingPatched;
7761
8046
  const runFontsPatched = await patchDocxRunFonts(kerningPatched, noteContext.runFontPatches.patches);
7762
- const hiddenTextPatched = await patchDocxHiddenText(runFontsPatched, noteContext.hiddenTextPatches.patches);
7763
- const formattingChangesPatched = await patchDocxRunFormattingChanges(hiddenTextPatched, noteContext.formattingChangePatches.patches);
8047
+ const hiddenTextPatched = await patchDocxHiddenText(runFontsPatched, noteContext.hiddenTextPatches.patches.filter((patch)=>noteContext.usedNativeTextEffectMarkers.has(patch.marker)));
8048
+ const legacyTextEffectsPatched = await patchDocxLegacyTextEffects(hiddenTextPatched, noteContext.legacyTextEffectsPatches.patches.filter((patch)=>noteContext.usedNativeTextEffectMarkers.has(patch.marker)));
8049
+ const runBordersPatched = await patchDocxRunBorders(legacyTextEffectsPatched, noteContext.runBorderPatches.patches.filter((patch)=>noteContext.usedRunBorderMarkers.has(patch.marker)));
8050
+ const formattingChangesPatched = await patchDocxRunFormattingChanges(runBordersPatched, noteContext.formattingChangePatches.patches);
7764
8051
  const noteImageRelationshipsPatched = await patchDocxNoteImageRelationships(formattingChangesPatched);
7765
8052
  const commentMetadataPatched = await patchDocxCommentMetadata(noteImageRelationshipsPatched, commentThreads);
7766
8053
  const numberingPatched = await patchDocxNumberingRestartRules(commentMetadataPatched, noteContext.numberingRestartRules);
@@ -7787,6 +8074,64 @@ async function createDocxBlob(content, sourcePackage) {
7787
8074
  type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
7788
8075
  });
7789
8076
  }
8077
+ function docxNativeTextEffectState(style, context) {
8078
+ let current = style;
8079
+ let hiddenText;
8080
+ const legacyTextEffects = {};
8081
+ const seen = new Set();
8082
+ while(current && !seen.has(current)){
8083
+ seen.add(current);
8084
+ const hiddenPatch = context.hiddenTextPatches.lookup(current);
8085
+ if (hiddenPatch) {
8086
+ hiddenText ??= hiddenPatch.value;
8087
+ current = hiddenPatch.style;
8088
+ continue;
8089
+ }
8090
+ const legacyPatch = context.legacyTextEffectsPatches.lookup(current);
8091
+ if (legacyPatch) {
8092
+ for (const [name, value] of Object.entries(legacyPatch.effects)){
8093
+ const effect = name;
8094
+ if (void 0 === legacyTextEffects[effect]) legacyTextEffects[effect] = value;
8095
+ }
8096
+ current = legacyPatch.style;
8097
+ continue;
8098
+ }
8099
+ break;
8100
+ }
8101
+ return {
8102
+ ...current ? {
8103
+ baseStyle: current
8104
+ } : {},
8105
+ ...void 0 !== hiddenText ? {
8106
+ hiddenText
8107
+ } : {},
8108
+ legacyTextEffects
8109
+ };
8110
+ }
8111
+ function markDocxNativeTextEffectStyleUsed(style, context) {
8112
+ let current = style;
8113
+ const seen = new Set();
8114
+ while(current && !seen.has(current)){
8115
+ seen.add(current);
8116
+ const hiddenPatch = context.hiddenTextPatches.lookup(current);
8117
+ if (hiddenPatch) {
8118
+ context.usedNativeTextEffectMarkers.add(current);
8119
+ current = hiddenPatch.style;
8120
+ continue;
8121
+ }
8122
+ const legacyPatch = context.legacyTextEffectsPatches.lookup(current);
8123
+ if (legacyPatch) {
8124
+ context.usedNativeTextEffectMarkers.add(current);
8125
+ current = legacyPatch.style;
8126
+ continue;
8127
+ }
8128
+ break;
8129
+ }
8130
+ }
8131
+ function markDocxRunBorderUsed(border, context) {
8132
+ const marker = border?.color?.toUpperCase();
8133
+ if (context.runBorderPatches.hasMarker(marker)) context.usedRunBorderMarkers.add(marker);
8134
+ }
7790
8135
  function work_docx_export_sectionProperties(layout, docx) {
7791
8136
  const landscape = 'landscape' === layout.orientation;
7792
8137
  const dimensions = documentPageGeometryForLayout(layout);
@@ -7956,6 +8301,8 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
7956
8301
  const visit = async (node, inherited = {}, revision)=>{
7957
8302
  if (node.nodeType === Node.TEXT_NODE) {
7958
8303
  if (!node.textContent) return [];
8304
+ markDocxNativeTextEffectStyleUsed(inherited.style, noteContext);
8305
+ markDocxRunBorderUsed(inherited.border, noteContext);
7959
8306
  if (revision?.kind === 'insertion') return [
7960
8307
  new docx.InsertedTextRun({
7961
8308
  ...inherited,
@@ -8026,7 +8373,18 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
8026
8373
  const explicitKerningThreshold = documentKerningThresholdHalfPointsFromElement(node);
8027
8374
  const explicitEmphasisMark = documentEmphasisMarkFromElement(node);
8028
8375
  const explicitHiddenText = documentHiddenTextFromElement(node);
8376
+ const hasExplicitLegacyTextEffects = 'span' === tag && [
8377
+ DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE,
8378
+ DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE,
8379
+ DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE,
8380
+ DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE
8381
+ ].some((attribute)=>node.hasAttribute(attribute));
8382
+ const explicitLegacyTextEffects = hasExplicitLegacyTextEffects ? documentLegacyTextEffectsFromElement(node) : {};
8383
+ if (hasExplicitLegacyTextEffects && !explicitLegacyTextEffects) throw new Error('Document contains invalid legacy text effects.');
8029
8384
  const explicitCharacterPosition = documentCharacterPositionHalfPointsFromElement(node);
8385
+ const hasExplicitRunBorder = 'span' === tag && (node.hasAttribute(DOCUMENT_RUN_BORDER_ATTRIBUTE) || Boolean(node.style.borderStyle));
8386
+ const explicitRunBorder = hasExplicitRunBorder ? parseDocumentRunBorderElement(node) : null;
8387
+ if (hasExplicitRunBorder && !explicitRunBorder) throw new Error('Document contains an invalid character border.');
8030
8388
  if (0 === explicitCharacterSpacing) noteContext.hasExplicitZeroCharacterSpacing = true;
8031
8389
  if (0 === explicitKerningThreshold) noteContext.hasExplicitZeroKerningThreshold = true;
8032
8390
  const characterSpacing = null === explicitCharacterSpacing ? inherited.characterSpacing : docxCharacterSpacingValue(explicitCharacterSpacing);
@@ -8035,13 +8393,26 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
8035
8393
  const position = null === explicitCharacterPosition ? inherited.position : docxCharacterPositionValue(explicitCharacterPosition);
8036
8394
  const emphasisMark = null === explicitEmphasisMark ? inherited.emphasisMark : docxEmphasisMarkRunOptions(explicitEmphasisMark);
8037
8395
  const textCaseOptions = docxTextCaseRunOptions(explicitTextCase, inherited);
8038
- const hiddenTextStyle = null === explicitHiddenText ? inherited.style : noteContext.hiddenTextPatches.marker(explicitHiddenText, inherited.style);
8396
+ const inheritedNativeTextEffects = docxNativeTextEffectState(inherited.style, noteContext);
8397
+ const legacyTextEffects = {
8398
+ ...inheritedNativeTextEffects.legacyTextEffects,
8399
+ ...explicitLegacyTextEffects ?? {}
8400
+ };
8401
+ if (documentLegacyTextEffectsConflict(legacyTextEffects)) throw new Error('Document contains conflicting legacy text effects.');
8402
+ const hiddenText = null === explicitHiddenText ? inheritedNativeTextEffects.hiddenText : explicitHiddenText;
8403
+ let nativeTextEffectStyle = inherited.style;
8404
+ if (hasExplicitLegacyTextEffects || null !== explicitHiddenText) {
8405
+ nativeTextEffectStyle = inheritedNativeTextEffects.baseStyle;
8406
+ if (Object.keys(legacyTextEffects).length) nativeTextEffectStyle = noteContext.legacyTextEffectsPatches.marker(legacyTextEffects, nativeTextEffectStyle);
8407
+ if (void 0 !== hiddenText) nativeTextEffectStyle = noteContext.hiddenTextPatches.marker(hiddenText, nativeTextEffectStyle);
8408
+ }
8039
8409
  const underline = docxUnderlineRunOptions(node, inherited.underline, noteContext.themePatches);
8040
8410
  const strike = docxStrikeRunOptions(node, inherited);
8041
8411
  const scriptFontMarker = noteContext.runFontPatches.marker(documentScriptFontsFromElement(node), documentScriptFontSlotFromElement(node), node.style.fontFamily);
8412
+ const runBorder = explicitRunBorder ? documentRunBorderDocxOptions(explicitRunBorder, noteContext.runBorderPatches).border : inherited.border;
8042
8413
  const style = {
8043
8414
  ...inherited,
8044
- style: hiddenTextStyle,
8415
+ style: nativeTextEffectStyle,
8045
8416
  bold: inherited.bold || 'strong' === tag || 'b' === tag,
8046
8417
  italics: inherited.italics || 'em' === tag || 'i' === tag,
8047
8418
  underline,
@@ -8058,6 +8429,7 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
8058
8429
  kern,
8059
8430
  position,
8060
8431
  emphasisMark,
8432
+ border: runBorder,
8061
8433
  shading: themeFillMarker ? {
8062
8434
  fill: themeFillMarker
8063
8435
  } : resolvedShading,
@@ -8065,12 +8437,16 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
8065
8437
  rightToLeft: void 0 === direction ? inherited.rightToLeft : 'rtl' === direction,
8066
8438
  ...textCaseOptions
8067
8439
  };
8068
- if ('br' === tag) return [
8069
- new docx.TextRun({
8070
- ...style,
8071
- break: 1
8072
- })
8073
- ];
8440
+ if ('br' === tag) {
8441
+ markDocxNativeTextEffectStyleUsed(style.style, noteContext);
8442
+ markDocxRunBorderUsed(style.border, noteContext);
8443
+ return [
8444
+ new docx.TextRun({
8445
+ ...style,
8446
+ break: 1
8447
+ })
8448
+ ];
8449
+ }
8074
8450
  if ('img' === tag) return [
8075
8451
  await imageToDocx(node, docx, noteContext.imageCropPatches, noteContext.imageWrapPatches, noteContext.imageLayerPatches, noteContext.imageIdentityPatches)
8076
8452
  ];
@@ -1,7 +1,7 @@
1
1
  import jszip from "jszip";
2
- import { contentTypeForPart, directChildren, bytesToDataUrl, OoxmlPackage, firstDescendant, descendants, directChild, attribute as work_ooxml_package_attribute } from "./5184.js";
3
- import { normalizeDocumentBookmarkName, renderDocumentTableCellMarginOverrides, applyDocumentImageIdentityToElement, documentCharacterPositionDomAttributes, createDocumentImageIdentityRegistry, normalizeDocumentColumns, documentStrikeDomAttributes, normalizeDocumentImageWrapContour, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, normalizeDocumentBookmarksHtml, applyDocumentTableRowIdentityToElement, normalizeDocumentCaptionsHtml, documentCharacterSpacingDomAttributes, normalizeDocumentImageAlignment, normalizeDocumentParagraphId, 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, applyDocumentParagraphIdentityToElement, documentKerningDomAttributes, docxDocumentFieldKind, serializeDocxThemeReference, renderDocumentTableBorders, docxBookmarkReferenceTarget, normalizeDocumentImagePosition, wrapsBesideImage, documentPageChromeLegacyFields, documentParagraphShadingDomAttributes, documentCharacterScaleDomAttributes, documentParagraphBordersDomAttributes, DEFAULT_DOCUMENT_TABLE_GEOMETRY, documentSectionDomAttributes, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, normalizeDocumentParagraphIdentity, documentPageMarginBody, normalizeDocumentTableRowIdentity, normalizeDocumentBookmarkNativeId, uniqueDocumentImageIdentity, applyDocumentTableGeometryToElement, normalizeDocumentImageCrop, documentContentLayoutProperties, documentEmphasisMarkDomAttributes } from "./6282.js";
4
- import { markDocxRunFormattingIntoState, applyImportedDocxParagraphSpacingMarkers, hasImportedDocxParagraphDirectionMarkers, hasImportedDocxParagraphIndentMarkers, resolveDocxParagraphBordersForParagraph, applyImportedDocxParagraphShadingMarkers, markDocxParagraphSpacing, docxCaptionBookmark, docxFieldResultText, createDocxParagraphStyleResolver, docxTableCellStyleLayers, createImportedDocxRunFormattingMarkerState, parseDocxPaperSource, hasImportedDocxParagraphSpacingMarkers, docxTablePropertySources, parseDocxPageMargins, parseDirectDocxParagraphShading, markDocxPackageEquations, parseDocxPageGeometry, markDocxParagraphIndents, docxCaptionReferenceTarget, applyImportedDocxEquationMarkers, hasImportedDocxParagraphPaginationMarkers, createDocxTableStyleResolver, hasImportedDocxParagraphShadingMarkers, isDocxEquationLikeRoot, importedDocxStrike, docxTableRunPropertySources, inspectDocxPageMarginSettings, hasImportedDocxRunFormattingMarkers, applyImportedDocxParagraphFormattingChangeMarkers, hasImportedDocxParagraphTabStopMarkers, docxCaptionSequenceKind, applyImportedDocxRunFormattingMarkers, markDocxParagraphAlignments, markDocxParagraphDirections, hasImportedDocxParagraphBorderMarkers, hasImportedDocxParagraphFormattingChangeMarkers, resolveDocxHiddenText, docxEquationHtml, docxFieldOccurrences, hasImportedDocxParagraphAlignmentMarkers, markDocxParagraphTabStops, applyImportedDocxParagraphIndentMarkers, resolveDocxTableStyleResolver, applyImportedDocxParagraphDirectionMarkers, applyImportedDocxParagraphAlignmentMarkers, markDocxParagraphPagination, importedDocxUnderline, markDocxParagraphBorders, applyImportedDocxParagraphTabStopMarkers, docxFieldOccurrenceIsInlineEditable, applyImportedDocxParagraphBorderMarkers, applyImportedDocxParagraphPaginationMarkers, docxRunPropertySources, markDocxParagraphFormattingChanges, markDocxParagraphShading, parseDocxPageBorders } from "./0~5093.js";
2
+ import { documentRunBorderDomAttributes, contentTypeForPart, directChildren, bytesToDataUrl, OoxmlPackage, firstDescendant, documentParagraphBordersDomAttributes, descendants, directChild, attribute as work_ooxml_package_attribute, serializeDocxThemeReference } from "./4121.js";
3
+ import { normalizeDocumentBookmarkName, renderDocumentTableCellMarginOverrides, applyDocumentImageIdentityToElement, documentCharacterPositionDomAttributes, createDocumentImageIdentityRegistry, normalizeDocumentColumns, documentStrikeDomAttributes, normalizeDocumentImageWrapContour, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, normalizeDocumentBookmarksHtml, applyDocumentTableRowIdentityToElement, normalizeDocumentCaptionsHtml, documentCharacterSpacingDomAttributes, normalizeDocumentImageAlignment, normalizeDocumentParagraphId, 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, applyDocumentParagraphIdentityToElement, documentKerningDomAttributes, docxDocumentFieldKind, renderDocumentTableBorders, docxBookmarkReferenceTarget, normalizeDocumentImagePosition, wrapsBesideImage, documentPageChromeLegacyFields, documentParagraphShadingDomAttributes, documentCharacterScaleDomAttributes, DEFAULT_DOCUMENT_TABLE_GEOMETRY, documentSectionDomAttributes, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, normalizeDocumentParagraphIdentity, documentPageMarginBody, documentLegacyTextEffectsDomAttributes, normalizeDocumentTableRowIdentity, normalizeDocumentBookmarkNativeId, uniqueDocumentImageIdentity, applyDocumentTableGeometryToElement, normalizeDocumentImageCrop, documentContentLayoutProperties, documentEmphasisMarkDomAttributes } from "./6282.js";
4
+ import { markDocxRunFormattingIntoState, applyImportedDocxParagraphSpacingMarkers, hasImportedDocxParagraphDirectionMarkers, hasImportedDocxParagraphIndentMarkers, resolveDocxParagraphBordersForParagraph, applyImportedDocxParagraphShadingMarkers, markDocxParagraphSpacing, docxCaptionBookmark, docxFieldResultText, createDocxParagraphStyleResolver, docxTableCellStyleLayers, createImportedDocxRunFormattingMarkerState, parseDocxPaperSource, resolveDocxLegacyTextEffects, hasImportedDocxParagraphSpacingMarkers, docxTablePropertySources, parseDocxPageMargins, parseDirectDocxParagraphShading, markDocxPackageEquations, parseDocxPageGeometry, markDocxParagraphIndents, resolveDocxRunBorder, docxCaptionReferenceTarget, applyImportedDocxEquationMarkers, hasImportedDocxParagraphPaginationMarkers, createDocxTableStyleResolver, hasImportedDocxParagraphShadingMarkers, isDocxEquationLikeRoot, importedDocxStrike, docxTableRunPropertySources, inspectDocxPageMarginSettings, hasImportedDocxRunFormattingMarkers, applyImportedDocxParagraphFormattingChangeMarkers, hasImportedDocxParagraphTabStopMarkers, docxCaptionSequenceKind, applyImportedDocxRunFormattingMarkers, markDocxParagraphAlignments, markDocxParagraphDirections, hasImportedDocxParagraphBorderMarkers, hasImportedDocxParagraphFormattingChangeMarkers, resolveDocxHiddenText, docxEquationHtml, docxFieldOccurrences, hasImportedDocxParagraphAlignmentMarkers, markDocxParagraphTabStops, applyImportedDocxParagraphIndentMarkers, resolveDocxTableStyleResolver, applyImportedDocxParagraphTabStopMarkers, applyImportedDocxParagraphDirectionMarkers, applyImportedDocxParagraphAlignmentMarkers, importedDocxUnderline, markDocxParagraphBorders, markDocxParagraphPagination, docxFieldOccurrenceIsInlineEditable, applyImportedDocxParagraphBorderMarkers, applyImportedDocxParagraphPaginationMarkers, docxRunPropertySources, markDocxParagraphFormattingChanges, markDocxParagraphShading, parseDocxPageBorders } from "./0~5093.js";
5
5
  import { readDocxBibliography, XMLNS_NAMESPACE, docxCharacterScalePercentFromProperties, docxCharacterSpacingTwipsFromProperties, parseBoundedDocxInteger, xmlAttributeLocalName, resolveDocxEmphasisMark, createDocxThemeResolver, docxCharacterPositionHalfPointsFromProperties, docxThemeColor, parseDocxParagraphDefaultCollapsed, resolveDocxKerningThresholdHalfPoints, resolveDocxThemeResolver, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace } from "./0~7043.js";
6
6
  import { importDocxPageColor, importedDocumentNoteId } from "./0~4980.js";
7
7
  const WORD_NAMESPACE = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
@@ -1824,6 +1824,10 @@ async function runHtml(run, field, context) {
1824
1824
  if (void 0 !== emphasisMark) content = `<span${htmlAttributes(documentEmphasisMarkDomAttributes(emphasisMark))}>${content}</span>`;
1825
1825
  const hiddenText = resolveDocxHiddenText(propertySources);
1826
1826
  if (void 0 !== hiddenText) content = `<span${htmlAttributes(documentHiddenTextDomAttributes(hiddenText))}>${content}</span>`;
1827
+ const legacyTextEffects = resolveDocxLegacyTextEffects(propertySources);
1828
+ if (legacyTextEffects) content = `<span${htmlAttributes(documentLegacyTextEffectsDomAttributes(legacyTextEffects))}>${content}</span>`;
1829
+ const runBorder = resolveDocxRunBorder(propertySources, context.theme).border;
1830
+ if (runBorder) content = `<span${htmlAttributes(documentRunBorderDomAttributes(runBorder))}>${content}</span>`;
1827
1831
  const characterSpacing = docxCharacterSpacingTwipsFromProperties(properties ?? run);
1828
1832
  if (void 0 !== characterSpacing) content = `<span${htmlAttributes(documentCharacterSpacingDomAttributes(characterSpacing))}>${content}</span>`;
1829
1833
  const color = work_ooxml_package_attribute(directChild(properties ?? run, 'color') ?? run, 'val');