@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
package/dist/0~pdf-viewer.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { AnnotationPlugin, DocumentManagerPlugin, ExportPlugin, FormPlugin, HistoryPlugin, PDFViewer, PdfAnnotationSubtype, ScrollPlugin, SearchPlugin, ThumbnailPlugin, ViewportPlugin, ZoomMode, ZoomPlugin } from "@embedpdf/react-pdf-viewer";
|
|
4
4
|
import { AlertCircle, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Ellipsis, GalleryVerticalEnd, Highlighter, Loader2, Minus, MousePointer2, MoveHorizontal, Pencil, Plus, Redo2, Save, Scan, Search, SlidersHorizontal, Strikethrough, Trash2, Type, Underline, Undo2, X } from "lucide-react";
|
|
5
5
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { PdfErrorCode } from "@embedpdf/models";
|
|
6
7
|
import { readOfficePdfCollaborationSource as readWorkOfficePdfCollaborationSource, createOfficePdfCollaborationBinding as createWorkOfficePdfCollaborationBinding, assertPdfCollaborationSource as assertWorkOfficePdfCollaborationSource } from "./3818.js";
|
|
7
8
|
import { createOfficeEditorExtension, useOfficeEditorRuntime, useOfficeEditorKeyboardShortcuts } from "./0~3557.js";
|
|
8
9
|
import { isOfficeShortcutBlocked, OfficeColorPicker } from "./0~3635.js";
|
|
@@ -1233,6 +1234,10 @@ const PDF_THUMBNAIL_WINDOW_THRESHOLD = 48;
|
|
|
1233
1234
|
const PDF_THUMBNAIL_OVERSCAN = 5;
|
|
1234
1235
|
const PDF_THUMBNAIL_FALLBACK_VIEWPORT_HEIGHT = 720;
|
|
1235
1236
|
const PDF_THUMBNAIL_WINDOW_LIMIT = 32;
|
|
1237
|
+
const PDF_THUMBNAIL_CANCEL_REASON = Object.freeze({
|
|
1238
|
+
code: PdfErrorCode.Cancelled,
|
|
1239
|
+
message: 'PDF thumbnail rendering was cancelled.'
|
|
1240
|
+
});
|
|
1236
1241
|
function PdfThumbnailRail({ currentPage, mobileCloseButtonRef, mobileNavigationId, mobileNavigationModal = false, registry, totalPages, onCloseMobileNavigation, onSelectPage }) {
|
|
1237
1242
|
const viewportRef = useRef(null);
|
|
1238
1243
|
const pendingKeyboardFocusPageRef = useRef(null);
|
|
@@ -1269,7 +1274,7 @@ function PdfThumbnailRail({ currentPage, mobileCloseButtonRef, mobileNavigationI
|
|
|
1269
1274
|
const top = Math.max(0, pageTop - (viewportHeight - itemHeight) / 2);
|
|
1270
1275
|
if ('function' == typeof viewport.scrollTo) viewport.scrollTo({
|
|
1271
1276
|
top,
|
|
1272
|
-
behavior: 'smooth'
|
|
1277
|
+
behavior: totalPages > PDF_THUMBNAIL_WINDOW_THRESHOLD ? 'auto' : 'smooth'
|
|
1273
1278
|
});
|
|
1274
1279
|
else viewport.scrollTop = top;
|
|
1275
1280
|
}, [
|
|
@@ -1340,7 +1345,9 @@ function PdfThumbnailRail({ currentPage, mobileCloseButtonRef, mobileNavigationI
|
|
|
1340
1345
|
className: "work-pdf-thumbnail-rail",
|
|
1341
1346
|
"aria-label": "PDF 页面",
|
|
1342
1347
|
"data-pdf-page-count": totalPages,
|
|
1348
|
+
"data-pdf-thumbnail-mounted-count": pages.length,
|
|
1343
1349
|
"data-pdf-thumbnail-window-end": range.end,
|
|
1350
|
+
"data-pdf-thumbnail-window-limit": PDF_THUMBNAIL_WINDOW_LIMIT,
|
|
1344
1351
|
"data-pdf-thumbnail-window-start": range.start,
|
|
1345
1352
|
"data-pdf-thumbnail-windowed": range.windowed ? 'true' : 'false',
|
|
1346
1353
|
children: [
|
|
@@ -1456,7 +1463,8 @@ function usePdfThumbnailSource(registry, page) {
|
|
|
1456
1463
|
let objectUrl = null;
|
|
1457
1464
|
setSourceUrl(null);
|
|
1458
1465
|
setState('loading');
|
|
1459
|
-
|
|
1466
|
+
const request = requestPdfThumbnail(registry, page);
|
|
1467
|
+
request.result.then((blob)=>{
|
|
1460
1468
|
objectUrl = URL.createObjectURL(blob);
|
|
1461
1469
|
if (disposed) return void URL.revokeObjectURL(objectUrl);
|
|
1462
1470
|
setSourceUrl(objectUrl);
|
|
@@ -1466,6 +1474,7 @@ function usePdfThumbnailSource(registry, page) {
|
|
|
1466
1474
|
});
|
|
1467
1475
|
return ()=>{
|
|
1468
1476
|
disposed = true;
|
|
1477
|
+
request.abort();
|
|
1469
1478
|
if (objectUrl) URL.revokeObjectURL(objectUrl);
|
|
1470
1479
|
};
|
|
1471
1480
|
}, [
|
|
@@ -1477,14 +1486,36 @@ function usePdfThumbnailSource(registry, page) {
|
|
|
1477
1486
|
state
|
|
1478
1487
|
};
|
|
1479
1488
|
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1489
|
+
function requestPdfThumbnail(registry, page) {
|
|
1490
|
+
let aborted = false;
|
|
1491
|
+
let task = null;
|
|
1492
|
+
const result = registry.pluginsReady().then(()=>{
|
|
1493
|
+
if (aborted) throw thumbnailAbortError();
|
|
1494
|
+
const documentManager = registry.getPlugin(DocumentManagerPlugin.id)?.provides();
|
|
1495
|
+
const thumbnail = registry.getPlugin(ThumbnailPlugin.id)?.provides();
|
|
1496
|
+
const documentId = documentManager?.getActiveDocumentId();
|
|
1497
|
+
if (!documentId || !thumbnail) throw new Error('PDF thumbnail rendering is unavailable.');
|
|
1498
|
+
const devicePixelRatio = "u" < typeof window ? 1 : Math.min(2, Math.max(1, window.devicePixelRatio || 1));
|
|
1499
|
+
task = thumbnail.forDocument(documentId).renderThumb(page - 1, devicePixelRatio);
|
|
1500
|
+
if (aborted) {
|
|
1501
|
+
task.abort(PDF_THUMBNAIL_CANCEL_REASON);
|
|
1502
|
+
throw thumbnailAbortError();
|
|
1503
|
+
}
|
|
1504
|
+
return task.toPromise();
|
|
1505
|
+
});
|
|
1506
|
+
return {
|
|
1507
|
+
abort: ()=>{
|
|
1508
|
+
if (aborted) return;
|
|
1509
|
+
aborted = true;
|
|
1510
|
+
task?.abort(PDF_THUMBNAIL_CANCEL_REASON);
|
|
1511
|
+
},
|
|
1512
|
+
result
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
function thumbnailAbortError() {
|
|
1516
|
+
const error = new Error(PDF_THUMBNAIL_CANCEL_REASON.message);
|
|
1517
|
+
error.name = 'AbortError';
|
|
1518
|
+
return error;
|
|
1488
1519
|
}
|
|
1489
1520
|
function PdfThumbnailSpacer({ height, position }) {
|
|
1490
1521
|
if (height <= 0) return null;
|
|
@@ -10,7 +10,7 @@ import font_size from "@tiptap/extension-text-style/font-size";
|
|
|
10
10
|
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
|
-
import { canUngroupPresentationElements, withPresentationDesign, groupPresentationElements, expandPresentationGroupSelection, ungroupPresentationElements, canGroupPresentationElements, presentationSlideView, applyPresentationLayout, presentationSelectionUnits, remapPresentationGroupPaths } from "./0~1403.js";
|
|
13
|
+
import { canUngroupPresentationElements, withPresentationDesign, withPresentationDesignMetadata, groupPresentationElements, expandPresentationGroupSelection, ungroupPresentationElements, presentationSlideViewFromDesign, canGroupPresentationElements, presentationSlideView, applyPresentationLayout, presentationSelectionUnits, remapPresentationGroupPaths } from "./0~1403.js";
|
|
14
14
|
import { createOfficeId as createWorkId } from "./5184.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";
|
|
@@ -3572,8 +3572,8 @@ function drawRadarChart(context, chart, sourceRect) {
|
|
|
3572
3572
|
});
|
|
3573
3573
|
}
|
|
3574
3574
|
}
|
|
3575
|
-
function SlideCanvas({ content, slide, interactive, aspectRatio, showPlaceholders = false }) {
|
|
3576
|
-
const view = content ? presentationSlideView(content, slide) : void 0;
|
|
3575
|
+
function SlideCanvas({ content, designContent, slide, interactive, aspectRatio, showPlaceholders = false }) {
|
|
3576
|
+
const view = designContent ? presentationSlideViewFromDesign(designContent, slide) : content ? presentationSlideView(content, slide) : void 0;
|
|
3577
3577
|
const elements = [
|
|
3578
3578
|
...view?.inheritedElements.map((element)=>({
|
|
3579
3579
|
element,
|
|
@@ -5557,7 +5557,7 @@ function PresentationSlideThumbnail({ content, slide, index, selected, slideCoun
|
|
|
5557
5557
|
children: index + 1
|
|
5558
5558
|
}),
|
|
5559
5559
|
renderPreview ? /*#__PURE__*/ jsx(SlideCanvas, {
|
|
5560
|
-
|
|
5560
|
+
designContent: content,
|
|
5561
5561
|
slide: slide,
|
|
5562
5562
|
interactive: false,
|
|
5563
5563
|
aspectRatio: aspectRatio,
|
|
@@ -7984,7 +7984,9 @@ function PresentationEditingSurface({ initialSlide, autoFocus = true, collaborat
|
|
|
7984
7984
|
const restoreObjectFocus = useCallback(()=>restorePresentationWorkspaceFocus(presentationRootRef.current, ()=>workspaceFocusStateRef.current), []);
|
|
7985
7985
|
const imageInputRef = useRef(null);
|
|
7986
7986
|
const geometry = usePresentationGeometry(kernelWasmUrl, !preview);
|
|
7987
|
-
const designContent =
|
|
7987
|
+
const designContent = useMemo(()=>withPresentationDesignMetadata(content), [
|
|
7988
|
+
content
|
|
7989
|
+
]);
|
|
7988
7990
|
const selectedSlide = designContent.slides.find((slide)=>slide.id === selectedSlideId) ?? designContent.slides[0] ?? initialSlide;
|
|
7989
7991
|
const selectedLayout = designContent.layouts?.find((layout)=>layout.id === selectedSlide?.layoutId) ?? designContent.layouts?.[0];
|
|
7990
7992
|
const selectedMaster = designContent.masters?.find((master)=>master.id === selectedLayout?.masterId) ?? designContent.masters?.[0];
|
|
@@ -8058,7 +8060,7 @@ function PresentationEditingSurface({ initialSlide, autoFocus = true, collaborat
|
|
|
8058
8060
|
selectedElementId
|
|
8059
8061
|
]);
|
|
8060
8062
|
const toolbarSelectedElement = selectedElement ? selectedTextEditor && !selectedTextEditor.state.selection.empty ? presentationTextToolbarState(selectedTextEditor, selectedElement) : presentationElementToolbarState(selectedElement) : null;
|
|
8061
|
-
const slideView = selectedSlide ?
|
|
8063
|
+
const slideView = selectedSlide ? presentationSlideViewFromDesign(designContent, selectedSlide) : void 0;
|
|
8062
8064
|
const activeBackground = 'layout' === designMode ? selectedLayout?.background ?? selectedMaster?.background ?? '#ffffff' : 'master' === designMode ? selectedMaster?.background ?? '#ffffff' : slideView?.background ?? selectedSlide?.background ?? '#ffffff';
|
|
8063
8065
|
const inheritedElements = 'slide' === designMode ? slideView?.inheritedElements ?? [] : 'layout' === designMode ? selectedMaster?.elements.filter((element)=>!element.placeholder) ?? [] : [];
|
|
8064
8066
|
const placeholderGuides = 'slide' === designMode ? slideView?.placeholderElements.filter((definition)=>!activeElements.some((element)=>element.placeholder?.key === definition.placeholder?.key)) ?? [] : [];
|