@a3s-lab/office 0.12.0 → 0.13.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 +99 -6
- package/dist/0~1403.js +20 -12
- package/dist/0~2805.js +241 -241
- package/dist/0~4980.js +1 -1
- package/dist/0~5050.js +1 -20
- package/dist/0~5093.js +547 -547
- package/dist/0~7048.js +31 -29
- package/dist/0~document-editor.js +694 -90
- package/dist/0~pdf-viewer.js +41 -10
- package/dist/0~presentation-editor.js +8 -6
- package/dist/0~spreadsheet-editor.js +11528 -10094
- package/dist/0~work-document-import-worker-client.js +237 -0
- package/dist/0~work-docx-export.js +1 -1
- package/dist/0~work-docx-import.js +1 -1
- package/dist/0~work-docx-large-document-import.js +559 -0
- package/dist/0~work-office-diagnostics.js +46 -32
- package/dist/4104.js +4092 -3210
- package/dist/432.js +51 -7
- package/dist/4476.js +201 -7
- package/dist/5184.js +24 -2
- package/dist/{8928.js → 6282.js} +2338 -93
- package/dist/8715.js +895 -888
- package/dist/9356.js +3 -1
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -9
- package/dist/internal/features/work/editors/document-external-content.d.ts +1 -1
- package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +3 -1
- package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +3 -2
- package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +2 -1
- package/dist/internal/features/work/editors/presentation-workspace.d.ts +2 -1
- package/dist/internal/features/work/editors/spreadsheet-border-ribbon.d.ts +5 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-border-command.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +14 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-fill-command.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-fill.d.ts +12 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +14 -0
- package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +159 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +8 -4
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +8 -2
- package/dist/internal/features/work/editors/spreadsheet-home-format-ribbon.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-in-place-workbook-sync.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-operation-projection.d.ts +14 -0
- package/dist/internal/features/work/editors/spreadsheet-structure-selection.d.ts +7 -0
- package/dist/internal/features/work/editors/use-document-pagination.d.ts +5 -0
- package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +2 -1
- package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +2 -1
- package/dist/internal/features/work/spreadsheet-history-value.d.ts +1 -0
- package/dist/internal/features/work/spreadsheet-sparse.d.ts +6 -1
- package/dist/internal/features/work/work-document-chunk-geometry.d.ts +28 -0
- package/dist/internal/features/work/work-document-chunk-node.d.ts +23 -0
- package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
- package/dist/internal/features/work/work-document-html-fingerprint.d.ts +15 -0
- package/dist/internal/features/work/work-document-import-worker-client.d.ts +13 -0
- package/dist/internal/features/work/work-document-import-worker-protocol.d.ts +36 -0
- package/dist/internal/features/work/work-document-import.worker.d.ts +1 -0
- package/dist/internal/features/work/work-document-incremental-layout.d.ts +1 -1
- package/dist/internal/features/work/work-document-integrity-index.d.ts +14 -0
- package/dist/internal/features/work/work-document-lazy-block.d.ts +3 -0
- package/dist/internal/features/work/work-document-lazy-html.d.ts +21 -0
- package/dist/internal/features/work/work-document-lazy-model.d.ts +29 -0
- package/dist/internal/features/work/work-document-lazy-pagination-measurement.d.ts +3 -0
- package/dist/internal/features/work/work-document-lazy-preview.d.ts +21 -0
- package/dist/internal/features/work/work-document-lazy-update.d.ts +14 -0
- package/dist/internal/features/work/work-document-model.d.ts +18 -2
- package/dist/internal/features/work/work-document-page-surface-registry.d.ts +16 -0
- package/dist/internal/features/work/work-document-pagination-dom.d.ts +1 -0
- package/dist/internal/features/work/work-document-pagination-types.d.ts +1 -0
- package/dist/internal/features/work/work-document-pagination.d.ts +1 -1
- package/dist/internal/features/work/work-document-text-statistics.d.ts +25 -0
- package/dist/internal/features/work/work-document-windowing.d.ts +23 -0
- package/dist/internal/features/work/work-docx-large-document-import.d.ts +35 -0
- package/dist/internal/features/work/work-docx-large-document-parser.d.ts +29 -0
- package/dist/internal/features/work/work-file-import.d.ts +5 -0
- package/dist/internal/features/work/work-file-io.d.ts +3 -3
- package/dist/internal/features/work/work-file-kind.d.ts +5 -0
- package/dist/internal/features/work/work-office-diagnostics.d.ts +10 -1
- package/dist/internal/features/work/work-ooxml-package.d.ts +8 -0
- package/dist/internal/features/work/work-presentation-layouts.d.ts +7 -1
- package/dist/internal/features/work/work-repository.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-compatibility-summary.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-file-export.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-file-import.d.ts +3 -0
- package/dist/internal/features/work/work-spreadsheet-import-diagnostics.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-import-worker-client.d.ts +6 -0
- package/dist/internal/features/work/work-spreadsheet-import-worker-protocol.d.ts +32 -0
- package/dist/internal/features/work/work-spreadsheet-import.worker.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-matrix-profile.d.ts +64 -0
- package/dist/internal/features/work/work-spreadsheet-package-scan-worker-client.d.ts +6 -0
- package/dist/internal/features/work/work-spreadsheet-package-scan-worker-protocol.d.ts +49 -0
- package/dist/internal/features/work/work-spreadsheet-package-scan.worker.d.ts +1 -0
- package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -1
- package/dist/internal/features/work/work-xlsx-formulas.d.ts +2 -1
- package/dist/internal/features/work/work-xlsx-interop.d.ts +6 -5
- package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +2 -1
- package/dist/internal/features/work/work-xlsx-plain-fast-path.d.ts +54 -0
- package/dist/internal/features/work/work-xlsx-style-gate.d.ts +1 -0
- package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +12 -0
- package/dist/internal/features/work/work-xlsx-worksheet.d.ts +12 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/office-kernel.worker.js +31 -29
- package/dist/react.d.ts +7 -1
- package/dist/styles.css +440 -3
- package/dist/work-document-import.worker.js +558 -0
- package/dist/work-spreadsheet-import.worker.js +24745 -0
- package/dist/work-spreadsheet-import.worker.js.LICENSE.txt +3 -0
- package/dist/work-spreadsheet-package-scan.worker.js +4157 -0
- package/dist/work-spreadsheet-package-scan.worker.js.LICENSE.txt +11 -0
- package/docs/latest/en/browser-editor-architecture.md +351 -15
- package/package.json +19 -1
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
2
|
+
import { contentTypeForPart, directChildren, OoxmlPackage, parseXml, firstDescendant, descendants, directChild, xmlContainsAnyElement, attribute } from "./5184.js";
|
|
3
|
+
import { normalizeDocumentBookmarkName, docxBookmarkReferenceTarget, normalizeDocumentBookmarkNativeId, isDocumentParagraphArtBorderStyle, supportedDocxBookmarkReferenceInstruction, documentCitationTagsFromInstruction, docxDocumentFieldKind } from "./6282.js";
|
|
3
4
|
import { markDocxParagraphShading, inspectDocxPageSize, docxCaptionBookmark, hasInvalidDocxFieldStructure, inspectDocxPageMargins, inspectDocxPaperSource, createDocxParagraphStyleResolver, createDocxTableStyleResolver, docxFieldOccurrences, inspectDocxEquation, inspectDocxPageMarginSettings, markDocxParagraphBorders, isSupportedDocxParagraphFormattingChange, docxFieldOccurrenceIsInlineEditable, docxCaptionSequenceKind, inspectDocxPageBorders, isSupportedDocxRunFormattingChange, docxFieldInstructions, isSupportedDocxEquationPlacement } from "./0~5093.js";
|
|
4
5
|
import { normalizeDocumentHref } from "./0~work-document-links.js";
|
|
5
6
|
import { xmlAttributeLocalName, parseDocxParagraphDefaultCollapsed, readDocxBibliography, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace, createDocxThemeResolver } from "./0~2805.js";
|
|
6
|
-
import {
|
|
7
|
+
import { updateSpreadsheetWorksheetCompatibilitySummary, inspectXlsxPivotTables, isSupportedXlsxChartLegend, isSupportedXlsxChartPlotLayout, xlsxChartNodeUsesStackedGrouping, isSupportedXlsxChartSeriesFormatting, readXlsxFormulaFeaturesFromPackage, inspectXlsxHeaderFooterText, emptySpreadsheetWorksheetCompatibilitySummary, xlsxChartSeriesFormattingShapeProperties, MAX_XLSX_WORKSHEET_IMAGE_BYTES, isSupportedXlsxWorksheetImageContentType, xlsxWorksheetCellEntries, diagnoseXlsxProtection, isEditableXlsxPaperSizeCode, isSupportedXlsxCombinationChartNodes } from "./4104.js";
|
|
7
8
|
import { spreadsheetConditionalComparisonNeedsUpperValue, isSpreadsheetConditionalIconSetName, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconSetCount } from "./4476.js";
|
|
8
9
|
import { formulaHasStructuredReference, formulaHasExternalReference, parseSpreadsheetPrintTitles, volatileSpreadsheetFormulaFunctions, stripSpreadsheetSheetQualifier } from "./8715.js";
|
|
9
10
|
import { unsupportedSpreadsheetFormulaFunctions } from "./0~work-spreadsheet-formula-support.js";
|
|
11
|
+
var work_office_diagnostics_namespaceObject = {};
|
|
12
|
+
__webpack_require__.r(work_office_diagnostics_namespaceObject);
|
|
13
|
+
__webpack_require__.d(work_office_diagnostics_namespaceObject, {
|
|
14
|
+
analyzeDocxCompatibility: ()=>analyzeDocxCompatibility,
|
|
15
|
+
analyzeSpreadsheetCompatibility: ()=>analyzeSpreadsheetCompatibility
|
|
16
|
+
});
|
|
10
17
|
async function diagnoseDocxBookmarksAndLinks(archive, document) {
|
|
11
18
|
const starts = descendants(document, 'bookmarkStart');
|
|
12
19
|
const ends = descendants(document, 'bookmarkEnd');
|
|
@@ -1496,8 +1503,8 @@ function hasAdvancedDataBarVisuals(element) {
|
|
|
1496
1503
|
'axisColor'
|
|
1497
1504
|
].some((name)=>descendants(element, name).length > 0);
|
|
1498
1505
|
}
|
|
1499
|
-
async function diagnoseXlsxFormulas(archive) {
|
|
1500
|
-
const features = await readXlsxFormulaFeaturesFromPackage(archive);
|
|
1506
|
+
async function diagnoseXlsxFormulas(archive, importedFeatures, worksheetScans) {
|
|
1507
|
+
const features = importedFeatures ?? await readXlsxFormulaFeaturesFromPackage(archive, worksheetScans);
|
|
1501
1508
|
const formulas = Array.from(features.sheets.entries()).flatMap(([sheetName, sheet])=>sheet.formulas.map((formula)=>({
|
|
1502
1509
|
...formula,
|
|
1503
1510
|
sheetName
|
|
@@ -1608,8 +1615,8 @@ function work_xlsx_page_setup_diagnostics_issue(code, feature, message, severity
|
|
|
1608
1615
|
severity
|
|
1609
1616
|
};
|
|
1610
1617
|
}
|
|
1611
|
-
async function diagnoseXlsxPivots(archive) {
|
|
1612
|
-
const inspection = await inspectXlsxPivotTables(archive);
|
|
1618
|
+
async function diagnoseXlsxPivots(archive, importedInspection) {
|
|
1619
|
+
const inspection = importedInspection ?? await inspectXlsxPivotTables(archive);
|
|
1613
1620
|
const issues = [];
|
|
1614
1621
|
if (inspection.tables.length) issues.push({
|
|
1615
1622
|
code: 'xlsx.pivots',
|
|
@@ -1626,6 +1633,19 @@ async function diagnoseXlsxPivots(archive) {
|
|
|
1626
1633
|
});
|
|
1627
1634
|
return issues;
|
|
1628
1635
|
}
|
|
1636
|
+
const XLSX_DIAGNOSTIC_WORKSHEET_ELEMENTS = [
|
|
1637
|
+
'conditionalFormatting',
|
|
1638
|
+
'dataValidation',
|
|
1639
|
+
'sheetProtection',
|
|
1640
|
+
'protectedRange',
|
|
1641
|
+
'pageSetup',
|
|
1642
|
+
'pageMargins',
|
|
1643
|
+
'printOptions',
|
|
1644
|
+
'headerFooter',
|
|
1645
|
+
'pageSetUpPr',
|
|
1646
|
+
'rowBreaks',
|
|
1647
|
+
'colBreaks'
|
|
1648
|
+
];
|
|
1629
1649
|
async function analyzeDocxCompatibility(file, messages, sourcePackage) {
|
|
1630
1650
|
const issues = [
|
|
1631
1651
|
work_office_diagnostics_issue('docx.page-layout', 'Page layout', 'Per-section paper size, orientation, exact native page margins, one-to-six equal or custom-width columns, section breaks, and explicit page breaks are preserved; exact pagination and line wrapping may normalize.'),
|
|
@@ -1724,7 +1744,7 @@ async function analyzeDocxCompatibility(file, messages, sourcePackage) {
|
|
|
1724
1744
|
}
|
|
1725
1745
|
return report(file, 'DOCX', issues);
|
|
1726
1746
|
}
|
|
1727
|
-
async function analyzeSpreadsheetCompatibility(file, extension, workbook, sourcePackage) {
|
|
1747
|
+
async function analyzeSpreadsheetCompatibility(file, extension, workbook, sourcePackage, worksheetSummaries, importedMetadata) {
|
|
1728
1748
|
if ('csv' === extension) return null;
|
|
1729
1749
|
const sourceFormat = extension.toUpperCase();
|
|
1730
1750
|
const issues = [];
|
|
@@ -1745,47 +1765,37 @@ async function analyzeSpreadsheetCompatibility(file, extension, workbook, source
|
|
|
1745
1765
|
if (validPrintTitles.length < printTitles.length) issues.push(work_office_diagnostics_issue('sheet.print-titles.invalid', 'Print titles', 'One or more malformed print-title definitions remain in the original workbook only.'));
|
|
1746
1766
|
for (const [index, name] of workbook.SheetNames.entries()){
|
|
1747
1767
|
const worksheet = workbook.Sheets[name];
|
|
1748
|
-
inspectWorksheetModel(worksheet, name, issues, 'xlsx' === extension);
|
|
1768
|
+
inspectWorksheetModel(worksheet, name, issues, 'xlsx' === extension, worksheetSummaries?.get(name));
|
|
1749
1769
|
if ((workbook.Workbook?.Sheets?.[index]?.Hidden ?? 0) > 0) issues.push(work_office_diagnostics_issue('sheet.hidden', 'Hidden worksheets', 'Hidden worksheet state is preserved but can be changed by the editor.', 'info', name));
|
|
1750
1770
|
}
|
|
1751
1771
|
if ('xlsx' === extension) try {
|
|
1752
1772
|
const archive = void 0 === sourcePackage ? await OoxmlPackage.load(await file.arrayBuffer()) : sourcePackage;
|
|
1753
1773
|
if (!archive) throw new Error('The XLSX package could not be loaded.');
|
|
1754
|
-
await inspectXlsxPackage(archive, issues);
|
|
1774
|
+
await inspectXlsxPackage(archive, issues, importedMetadata);
|
|
1755
1775
|
} catch {
|
|
1756
1776
|
issues.push(work_office_diagnostics_issue('xlsx.inspect', 'Package inspection', 'Some XLSX features could not be inspected before conversion.'));
|
|
1757
1777
|
}
|
|
1758
1778
|
return issues.length ? report(file, sourceFormat, deduplicate(issues)) : null;
|
|
1759
1779
|
}
|
|
1760
|
-
function inspectWorksheetModel(worksheet, name, issues, nativeXlsxFormulaInspection) {
|
|
1780
|
+
function inspectWorksheetModel(worksheet, name, issues, nativeXlsxFormulaInspection, importedSummary) {
|
|
1761
1781
|
if (!worksheet) return;
|
|
1762
1782
|
if (worksheet['!autofilter']) issues.push(work_office_diagnostics_issue('sheet.filter', 'Filters', 'The auto-filter range and hidden rows are preserved; advanced active criteria may be normalized.', 'info', name));
|
|
1763
|
-
|
|
1764
|
-
let hasCommentThreads = false;
|
|
1765
|
-
let hasLinks = false;
|
|
1766
|
-
let hasArrayFormulas = false;
|
|
1767
|
-
let hasRichText = false;
|
|
1768
|
-
for (const [address, cell] of Object.entries(worksheet)){
|
|
1769
|
-
if (address.startsWith('!') || !cell || 'object' != typeof cell) continue;
|
|
1770
|
-
const source = cell;
|
|
1771
|
-
if (source.c?.length) {
|
|
1772
|
-
hasComments = true;
|
|
1773
|
-
if (source.c.length > 1 || source.c.some((comment)=>comment.T)) hasCommentThreads = true;
|
|
1774
|
-
}
|
|
1775
|
-
if (source.l?.Target) hasLinks = true;
|
|
1776
|
-
if (source.F) hasArrayFormulas = true;
|
|
1777
|
-
if (source.r) hasRichText = true;
|
|
1778
|
-
}
|
|
1783
|
+
const { hasArrayFormulas, hasComments, hasCommentThreads, hasLinks, hasRichText } = importedSummary ?? summarizeSpreadsheetWorksheet(worksheet);
|
|
1779
1784
|
if (hasComments) issues.push(work_office_diagnostics_issue('sheet.comments', 'Cell comments', 'Plain-text cell comments and one author are preserved and editable through the spreadsheet comment tools.', 'info', name));
|
|
1780
1785
|
if (hasCommentThreads) issues.push(work_office_diagnostics_issue('sheet.comment-threads', 'Comment threads', 'Multiple comment blocks and threaded replies are flattened into one editable legacy comment.', 'warning', name));
|
|
1781
1786
|
if (hasLinks) issues.push(work_office_diagnostics_issue('sheet.links', 'Cell hyperlinks', 'Web and in-workbook hyperlinks are preserved; advanced screen tips may be normalized.', 'info', name));
|
|
1782
1787
|
if (hasArrayFormulas && !nativeXlsxFormulaInspection) issues.push(work_office_diagnostics_issue('sheet.array-formula', 'Array formulas', 'Array-formula ranges may be recalculated as ordinary formulas.', 'warning', name));
|
|
1783
1788
|
if (hasRichText) issues.push(work_office_diagnostics_issue('sheet.rich-text', 'Rich cell text', 'Rich text inside a cell is converted to uniform text.', 'warning', name));
|
|
1784
1789
|
}
|
|
1785
|
-
|
|
1790
|
+
function summarizeSpreadsheetWorksheet(worksheet) {
|
|
1791
|
+
const summary = emptySpreadsheetWorksheetCompatibilitySummary();
|
|
1792
|
+
for (const { cell } of xlsxWorksheetCellEntries(worksheet))updateSpreadsheetWorksheetCompatibilitySummary(summary, cell);
|
|
1793
|
+
return summary;
|
|
1794
|
+
}
|
|
1795
|
+
async function inspectXlsxPackage(archive, issues, importedMetadata) {
|
|
1786
1796
|
issues.push(...await diagnoseXlsxCharts(archive));
|
|
1787
|
-
issues.push(...await diagnoseXlsxFormulas(archive));
|
|
1788
|
-
issues.push(...await diagnoseXlsxPivots(archive));
|
|
1797
|
+
issues.push(...await diagnoseXlsxFormulas(archive, importedMetadata?.formulaFeatures, importedMetadata?.worksheetScans));
|
|
1798
|
+
issues.push(...await diagnoseXlsxPivots(archive, importedMetadata?.pivotFeatures));
|
|
1789
1799
|
const drawingParts = archive.paths('xl/drawings/').filter((path)=>/^xl\/drawings\/drawing\d+\.xml$/i.test(path));
|
|
1790
1800
|
let preservedImages = 0;
|
|
1791
1801
|
let hasUnsupportedImages = false;
|
|
@@ -1837,7 +1847,11 @@ async function inspectXlsxPackage(archive, issues) {
|
|
|
1837
1847
|
}
|
|
1838
1848
|
for (const part of archive.paths('xl/worksheets/')){
|
|
1839
1849
|
if (!part.endsWith('.xml')) continue;
|
|
1840
|
-
const
|
|
1850
|
+
const scan = importedMetadata?.worksheetScans?.[part];
|
|
1851
|
+
if (scan && !scan.hasDiagnosticFeatures) continue;
|
|
1852
|
+
const source = await archive.text(part);
|
|
1853
|
+
if (!scan && !xmlContainsAnyElement(source, XLSX_DIAGNOSTIC_WORKSHEET_ELEMENTS)) continue;
|
|
1854
|
+
const worksheet = parseXml(source, part);
|
|
1841
1855
|
if (descendants(worksheet, 'conditionalFormatting').length) for (const diagnostic of diagnoseXlsxConditionalFormatting(worksheet, styles))issues.push(work_office_diagnostics_issue(diagnostic.code, 'Conditional formatting', diagnostic.message, diagnostic.severity));
|
|
1842
1856
|
if (descendants(worksheet, 'dataValidation').length) issues.push(work_office_diagnostics_issue('xlsx.validation', 'Data validation', 'Common list, numeric, date, and text-length rules are editable; custom formulas and very large ranges may be normalized.', 'info'));
|
|
1843
1857
|
if (descendants(worksheet, 'sheetProtection').length || descendants(worksheet, 'protectedRange').length) for (const diagnostic of diagnoseXlsxProtection(worksheet, styles))issues.push(work_office_diagnostics_issue(diagnostic.code, 'Sheet protection', diagnostic.message, diagnostic.severity));
|
|
@@ -1874,4 +1888,4 @@ function deduplicate(issues) {
|
|
|
1874
1888
|
return true;
|
|
1875
1889
|
});
|
|
1876
1890
|
}
|
|
1877
|
-
export {
|
|
1891
|
+
export { work_office_diagnostics_namespaceObject };
|