@a3s-lab/office 0.10.0 → 0.12.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/COLLABORATION_ROADMAP.md +22 -12
- package/README.md +40 -15
- package/dist/{0~4705.js → 0~5093.js} +959 -10
- package/dist/0~document-editor.js +1 -0
- package/dist/0~spreadsheet-editor.js +189 -104
- package/dist/0~work-docx-export.js +225 -6
- package/dist/0~work-docx-import.js +26 -755
- package/dist/0~work-office-diagnostics.js +12 -8
- package/dist/0~work-pptx-import.js +2 -2
- package/dist/4104.js +330 -122
- package/dist/4476.js +82 -65
- package/dist/8715.js +41 -3
- package/dist/8928.js +448 -137
- package/dist/9356.js +126 -8
- package/dist/core.d.ts +1 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +1 -0
- package/dist/internal/features/work/editors/use-spreadsheet-collaboration.d.ts +2 -1
- package/dist/internal/features/work/spreadsheet-sparse.d.ts +5 -0
- package/dist/internal/features/work/work-document-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-document-format-change-tracking.d.ts +1 -1
- package/dist/internal/features/work/work-document-paragraph-format-change-tracking.d.ts +7 -0
- package/dist/internal/features/work/work-document-paragraph-format-changes.d.ts +8 -0
- package/dist/internal/features/work/work-docx-import.d.ts +5 -2
- package/dist/internal/features/work/work-docx-paragraph-alignment-import.d.ts +1 -0
- package/dist/internal/features/work/work-docx-paragraph-borders-import.d.ts +1 -0
- package/dist/internal/features/work/work-docx-paragraph-direction-import.d.ts +1 -0
- package/dist/internal/features/work/work-docx-paragraph-format-change-export.d.ts +13 -0
- package/dist/internal/features/work/work-docx-paragraph-format-change-import.d.ts +17 -0
- package/dist/internal/features/work/work-docx-paragraph-indent-import.d.ts +1 -0
- package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +1 -0
- package/dist/internal/features/work/work-docx-paragraph-shading-import.d.ts +1 -0
- package/dist/internal/features/work/work-docx-paragraph-spacing-import.d.ts +1 -0
- package/dist/internal/features/work/work-docx-tab-stop-import.d.ts +1 -0
- package/dist/internal/features/work/work-file-data.d.ts +7 -1
- package/dist/internal/features/work/work-file-import.d.ts +28 -0
- package/dist/internal/features/work/work-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-markdown-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-office-diagnostics.d.ts +3 -2
- package/dist/internal/features/work/work-pptx-import.d.ts +1 -1
- package/dist/internal/features/work/work-presentation-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-spreadsheet-protection.d.ts +2 -0
- package/dist/internal/features/work/work-types.d.ts +23 -1
- package/dist/internal/features/work/work-xlsx-interop.d.ts +4 -14
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +8 -0
- package/docs/latest/en/browser-editor-architecture.md +18 -0
- package/package.json +10 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { descendants, directChildren, directChild, OoxmlPackage, attribute, firstDescendant, contentTypeForPart } from "./5184.js";
|
|
2
2
|
import { normalizeDocumentBookmarkName, docxBookmarkReferenceTarget, normalizeDocumentBookmarkNativeId, isDocumentParagraphArtBorderStyle, supportedDocxBookmarkReferenceInstruction, documentCitationTagsFromInstruction, docxDocumentFieldKind } from "./8928.js";
|
|
3
|
-
import { markDocxParagraphShading, inspectDocxPageSize, docxCaptionBookmark, hasInvalidDocxFieldStructure, inspectDocxPageMargins, inspectDocxPaperSource, createDocxParagraphStyleResolver, createDocxTableStyleResolver, docxFieldOccurrences, inspectDocxEquation, inspectDocxPageMarginSettings, markDocxParagraphBorders, docxFieldOccurrenceIsInlineEditable, docxCaptionSequenceKind, inspectDocxPageBorders, isSupportedDocxRunFormattingChange, docxFieldInstructions, isSupportedDocxEquationPlacement } from "./0~
|
|
3
|
+
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
4
|
import { normalizeDocumentHref } from "./0~work-document-links.js";
|
|
5
5
|
import { xmlAttributeLocalName, parseDocxParagraphDefaultCollapsed, readDocxBibliography, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace, createDocxThemeResolver } from "./0~2805.js";
|
|
6
6
|
import { isSupportedXlsxCombinationChartNodes, MAX_XLSX_WORKSHEET_IMAGE_BYTES, inspectXlsxPivotTables, isSupportedXlsxWorksheetImageContentType, isSupportedXlsxChartLegend, isSupportedXlsxChartPlotLayout, xlsxChartNodeUsesStackedGrouping, isSupportedXlsxChartSeriesFormatting, readXlsxFormulaFeaturesFromPackage, inspectXlsxHeaderFooterText, isEditableXlsxPaperSizeCode, diagnoseXlsxProtection, xlsxChartSeriesFormattingShapeProperties } from "./4104.js";
|
|
@@ -1626,14 +1626,15 @@ async function diagnoseXlsxPivots(archive) {
|
|
|
1626
1626
|
});
|
|
1627
1627
|
return issues;
|
|
1628
1628
|
}
|
|
1629
|
-
async function analyzeDocxCompatibility(file, messages) {
|
|
1629
|
+
async function analyzeDocxCompatibility(file, messages, sourcePackage) {
|
|
1630
1630
|
const issues = [
|
|
1631
1631
|
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.'),
|
|
1632
1632
|
work_office_diagnostics_issue('docx.package-state', 'OOXML package state', 'Source-backed export retains safe source-only parts byte-for-byte and reconnects their content types and relationships. Passive relationship-free extensions in settings XML, uniquely matched style or numbering identities, stable picture drawings, unchanged native-identity paragraphs, stable table, row, or cell scopes, and uniquely matched footnote, endnote, comment, or comment-thread records are preserved against the final package graph. Text-stable direct, supported-hyperlink-wrapped, and eligible static-content-control note and comment runs retain paragraph, table, wrapper, run, and run-property metadata; native note tables and DrawingML pictures remain editable, note image relationships and media targets are repaired and validated, bounded structured OMML equations remain atomically updateable in supported Word stories, uniquely matched table-bearing rich-text controls are reconstructed, safe web, mail, and internal note/comment links are rebound to collision-free final relationship IDs, and content-control ID collisions are rewritten. Native note, comment, and note-picture identities survive reorderings, comment durable IDs are rebound to regenerated paragraph IDs, and eligible source font-table metadata is retained. Generated Word semantics remain authoritative; source-only, changed-text or table structure, malformed, duplicate or cross-kind, active, unsupported wrappers, mixed-semantic, unsafe relationship-bound, legacy VML, non-picture drawings, or unsupported rich content may normalize.', 'info')
|
|
1633
1633
|
];
|
|
1634
1634
|
for (const message of messages)issues.push(work_office_diagnostics_issue(`docx.converter.${message.type}`, 'Document conversion', message.message, 'error' === message.type ? 'error' : 'warning'));
|
|
1635
1635
|
try {
|
|
1636
|
-
const archive = await OoxmlPackage.load(await file.arrayBuffer());
|
|
1636
|
+
const archive = void 0 === sourcePackage ? await OoxmlPackage.load(await file.arrayBuffer()) : sourcePackage;
|
|
1637
|
+
if (!archive) throw new Error('The DOCX package could not be loaded.');
|
|
1637
1638
|
const packagePaths = archive.paths('');
|
|
1638
1639
|
const normalizedPackagePaths = packagePaths.map((path)=>path.toLowerCase());
|
|
1639
1640
|
const document = archive.has('word/document.xml') ? await archive.xml('word/document.xml') : null;
|
|
@@ -1691,19 +1692,21 @@ async function analyzeDocxCompatibility(file, messages) {
|
|
|
1691
1692
|
...descendants(document, 'del')
|
|
1692
1693
|
];
|
|
1693
1694
|
const runFormattingRevisions = descendants(document, 'rPrChange');
|
|
1695
|
+
const paragraphFormattingRevisions = descendants(document, 'pPrChange');
|
|
1694
1696
|
const supportedRunFormattingRevisionCount = runFormattingRevisions.filter(isSupportedDocxRunFormattingChange).length;
|
|
1697
|
+
const supportedParagraphFormattingRevisionCount = paragraphFormattingRevisions.filter(isSupportedDocxParagraphFormattingChange).length;
|
|
1695
1698
|
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'));
|
|
1696
1699
|
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, subscript, superscript, font, size, color, highlight, and grid state. They remain reviewable in Work and round-trip as native w:rPrChange records.`, 'info'));
|
|
1697
|
-
if (
|
|
1700
|
+
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'));
|
|
1701
|
+
if (textRevisions.some((revision)=>!descendants(revision, 't').length && !descendants(revision, 'delText').length) || supportedRunFormattingRevisionCount !== runFormattingRevisions.length || supportedParagraphFormattingRevisionCount !== paragraphFormattingRevisions.length || [
|
|
1698
1702
|
'moveFrom',
|
|
1699
1703
|
'moveTo',
|
|
1700
|
-
'pPrChange',
|
|
1701
1704
|
'tblPrChange',
|
|
1702
1705
|
'trPrChange',
|
|
1703
1706
|
'tcPrChange',
|
|
1704
1707
|
'sectPrChange',
|
|
1705
1708
|
'numberingChange'
|
|
1706
|
-
].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
|
|
1709
|
+
].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.'));
|
|
1707
1710
|
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.'));
|
|
1708
1711
|
const sectionProperties = descendants(document, 'sectPr');
|
|
1709
1712
|
const columnProperties = descendants(document, 'cols');
|
|
@@ -1721,7 +1724,7 @@ async function analyzeDocxCompatibility(file, messages) {
|
|
|
1721
1724
|
}
|
|
1722
1725
|
return report(file, 'DOCX', issues);
|
|
1723
1726
|
}
|
|
1724
|
-
async function analyzeSpreadsheetCompatibility(file, extension, workbook) {
|
|
1727
|
+
async function analyzeSpreadsheetCompatibility(file, extension, workbook, sourcePackage) {
|
|
1725
1728
|
if ('csv' === extension) return null;
|
|
1726
1729
|
const sourceFormat = extension.toUpperCase();
|
|
1727
1730
|
const issues = [];
|
|
@@ -1746,7 +1749,8 @@ async function analyzeSpreadsheetCompatibility(file, extension, workbook) {
|
|
|
1746
1749
|
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));
|
|
1747
1750
|
}
|
|
1748
1751
|
if ('xlsx' === extension) try {
|
|
1749
|
-
const archive = await OoxmlPackage.load(await file.arrayBuffer());
|
|
1752
|
+
const archive = void 0 === sourcePackage ? await OoxmlPackage.load(await file.arrayBuffer()) : sourcePackage;
|
|
1753
|
+
if (!archive) throw new Error('The XLSX package could not be loaded.');
|
|
1750
1754
|
await inspectXlsxPackage(archive, issues);
|
|
1751
1755
|
} catch {
|
|
1752
1756
|
issues.push(work_office_diagnostics_issue('xlsx.inspect', 'Package inspection', 'Some XLSX features could not be inspected before conversion.'));
|
|
@@ -478,8 +478,8 @@ const EMU_PER_INCH = 914400;
|
|
|
478
478
|
const DEFAULT_SLIDE_WIDTH = 13.333;
|
|
479
479
|
const DEFAULT_SLIDE_HEIGHT = 7.5;
|
|
480
480
|
const MAX_EMBEDDED_IMAGE_BYTES = 11534336;
|
|
481
|
-
async function importPptxPresentation(file) {
|
|
482
|
-
const archive = await OoxmlPackage.load(await file.arrayBuffer());
|
|
481
|
+
async function importPptxPresentation(file, sourceBytes) {
|
|
482
|
+
const archive = await OoxmlPackage.load(sourceBytes ?? await file.arrayBuffer());
|
|
483
483
|
if (!archive.has('ppt/presentation.xml')) throw new Error('The selected file is not a valid PPTX presentation.');
|
|
484
484
|
const presentation = await archive.xml('ppt/presentation.xml');
|
|
485
485
|
const presentationRelationships = await archive.relationships('ppt/presentation.xml');
|