@a3s-lab/office 0.32.0 → 0.33.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 +59 -7
- package/dist/0~3539.js +2 -2
- package/dist/0~3557.js +1 -1
- package/dist/0~3635.js +1 -1
- package/dist/0~7048.js +1 -2
- package/dist/{0~6090.js → 0~8136.js} +71 -2
- package/dist/{0~4595.js → 0~9073.js} +3 -72
- package/dist/0~9445.js +1 -1
- package/dist/0~document-editor.js +2 -2
- package/dist/0~markdown-editor.js +2 -2
- package/dist/0~pdf-page-organization-engine.js +187 -0
- package/dist/0~pdf-viewer.js +1014 -30
- package/dist/0~presentation-editor.js +2 -2
- package/dist/0~spreadsheet-editor.js +2 -2
- package/dist/core.d.ts +1 -0
- package/dist/internal/features/work/editors/pdf-editor-extensions.d.ts +11 -0
- package/dist/internal/features/work/editors/pdf-page-organization-engine.d.ts +2 -0
- package/dist/internal/features/work/editors/pdf-page-organization-plan.d.ts +10 -0
- package/dist/internal/features/work/editors/pdf-page-organization-types.d.ts +68 -0
- package/dist/internal/features/work/editors/pdf-page-organization-worker-client.d.ts +2 -0
- package/dist/internal/features/work/editors/pdf-page-organization-worker-protocol.d.ts +13 -0
- package/dist/internal/features/work/editors/pdf-page-organization.d.ts +3 -0
- package/dist/internal/features/work/editors/pdf-page-organization.worker.d.ts +1 -0
- package/dist/internal/features/work/editors/pdf-page-organizer-dialog.d.ts +17 -0
- package/dist/internal/features/work/editors/pdf-thumbnail-rail.d.ts +4 -0
- package/dist/internal/features/work/editors/pdf-toolbar.d.ts +2 -1
- package/dist/internal/features/work/editors/pdf-viewer.d.ts +3 -1
- package/dist/internal/features/work/editors/use-pdf-page-organization.d.ts +38 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/pdf-page-organization.worker.js +19667 -0
- package/dist/pdf-page-organization.worker.js.LICENSE.txt +14 -0
- package/dist/react.d.ts +1 -0
- package/dist/styles.css +315 -0
- package/dist/vue.d.ts +3 -1
- package/dist/vue.js +2 -0
- package/dist/web-component.d.ts +3 -1
- package/dist/web-component.js +9 -0
- package/docs/latest/en/browser-editor-architecture.md +29 -6
- package/package.json +5 -1
|
@@ -15,9 +15,9 @@ 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";
|
|
18
|
-
import { officePresenceColorStyle, office_text_field_OfficeTextArea, stepOfficeZoom, useOfficeEditorWheelZoom, useOfficeRemoteParticipants, button_Button, useOfficePublishPresenceLocation, CommittedOfficeTextArea, CommittedOfficeTextField, office_text_field_OfficeTextField, useDialogFocusScope, icon_button_IconButton, office_text_field_OfficeFileInput } from "./0~
|
|
18
|
+
import { officePresenceColorStyle, office_text_field_OfficeTextArea, stepOfficeZoom, useOfficeEditorWheelZoom, useOfficeRemoteParticipants, button_Button, useOfficePublishPresenceLocation, CommittedOfficeTextArea, CommittedOfficeTextField, office_text_field_OfficeTextField, useDialogFocusScope, icon_button_IconButton, office_text_field_OfficeFileInput } from "./0~8136.js";
|
|
19
19
|
import { useOfficeTaskPaneEscape, normalizeOfficeFontFamily, OfficeCheckbox, CommittedOfficeNumberField, useOfficeTaskPaneModal, officeFontFamilyLabel, useOfficeDialog, officeFontFamilies, CollectionState, createOfficeKernelClient, OfficeNumberField, handleOfficeTaskPaneKeyDown } from "./0~7048.js";
|
|
20
|
-
import { WorkspaceContextMenu, isWorkspaceContextMenuKeyboardEvent, WorkOfficeZoomControls, WorkOfficeStatusBar, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkOfficeRibbonGroup, WorkOfficePreviewBar, WorkOfficeRibbonButton } from "./0~
|
|
20
|
+
import { WorkspaceContextMenu, isWorkspaceContextMenuKeyboardEvent, WorkOfficeZoomControls, WorkOfficeStatusBar, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkOfficeRibbonGroup, WorkOfficePreviewBar, WorkOfficeRibbonButton } from "./0~9073.js";
|
|
21
21
|
import { presentationAgentProposalTargets, SpreadsheetChartSeriesStyleEditor, applyPresentationAgentProposalChanges, normalizeOptionalOfficeNumber, SpreadsheetErrorBarEditor, useOfficeHistory, presentationNotesProposalTarget, presentationAgentSelection, SpreadsheetTrendlineEditor, presentationAgentMenuItems } from "./0~3539.js";
|
|
22
22
|
import { createOfficeEditorExtension, useOfficeEditorRuntime, useOfficeEditorKeyboardShortcuts } from "./0~3557.js";
|
|
23
23
|
import { isOfficeShortcutBlocked, OfficeColorPicker } from "./0~3635.js";
|
|
@@ -7,14 +7,14 @@ import { convertSpanToShareString, genarate, indexToColumnChar, update as core_u
|
|
|
7
7
|
import { freezeImportedSpreadsheetCell, normalizeXlsxSemanticColorOrigin, spreadsheetMatrixProfile, withXlsxPatternFill, withoutEditableRange, normalizeSpreadsheetConditionalVisualOptions, xlsxSemanticColorMatchesValue, withXlsxGradientFill, effectiveSpreadsheetPageSetup, attachSpreadsheetShownCommentCells, normalizeXlsxPatternFill, withEditableRange, sameSpreadsheetHistoryValue, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconForValue, defaultSpreadsheetConditionalIconThresholds, xlsxPatternFillTypes, sheetProtectionAuthority, normalizeXlsxGradientFill, xlsxGradientFillFallbackColor, editableRangeCellCount, unlockedCellCount, registerDerivedSpreadsheetMatrix, editableRangeRequiresCredentials, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, normalizeSpreadsheetConditionalIconSetFormat, defaultSpreadsheetDataBarOptions, spreadsheetConditionalThresholdValue, normalizeSheetProtectionAuthority, withSheetProtection, spreadsheetProtectionKey, defaultSpreadsheetColorScaleThresholds, protectedSheetCount, SPREADSHEET_CONDITIONAL_ICON_SETS, withSheetSelectionPermissions, spreadsheetConditionalComparisonNeedsUpperValue, drawSpreadsheetConditionalIcon, spreadsheetConditionalThresholdsEqual } from "./9333.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 { spreadsheetTextOrientationFromChoice, isSpreadsheetTextOrientationId, xlsxRichTextCellText, spreadsheetTextOrientationFromAngle, spreadsheetCellValueWithDiagonalBorder, spreadsheetUnderlineCellValue, normalizeSpreadsheetDataValidationErrorStyle, normalizeXlsxRichTextEditSource, normalizeXlsxRichTextColor, isHighSurrogate, xlsxNativeFillCellKeys, createOfficeSpreadsheetCollaborationBinding as createWorkOfficeSpreadsheetCollaborationBinding, boundedSpreadsheetDataValidationText, normalizeSpreadsheetDateValidationBoundary, normalizeXlsxRichTextCell, activeXlsxNativeFill, spreadsheetUnderlineStyle, deleteXlsxNativeFills, spreadsheetTextOrientationCellStyle, spreadsheetTextOrientationChoiceFromCell, normalizeXlsxRichTextRun, spreadsheetDiagonalBorderFromCellValue, sameXlsxRichTextRunStyle, isLowSurrogate, spreadsheetTextOrientationFromCell, coalesceXlsxRichTextRuns, patchSpreadsheetRichTextFontRuns, replaceOfficeSpreadsheetCollaboration as replaceWorkOfficeSpreadsheetCollaboration, validXlsxRichText, readOfficeSpreadsheetCollaboration as readWorkOfficeSpreadsheetCollaboration, isSpreadsheetUnderlineStyle, spreadsheetVisibleTextRotationFromCell } from "./3266.js";
|
|
10
|
-
import { moveOfficeMenuFocus, stepOfficeZoom, useOfficeRemoteParticipants, Popover, officePresenceColor, useOfficePublishPresenceLocation, button_Button, icon_button_IconButton, moveOfficeGridMenuFocus, office_text_field_OfficeTextField, useDialogFocusScope, useOfficeEditorWheelZoom } from "./0~
|
|
10
|
+
import { moveOfficeMenuFocus, stepOfficeZoom, useOfficeRemoteParticipants, Popover, Dialog, officePresenceColor, useOfficePublishPresenceLocation, button_Button, icon_button_IconButton, moveOfficeGridMenuFocus, office_text_field_OfficeTextField, useDialogFocusScope, useOfficeEditorWheelZoom } from "./0~8136.js";
|
|
11
11
|
import { isOfficeKernelSpreadsheetError, normalizeCssColor, OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, createOfficeId as createWorkId } from "./4121.js";
|
|
12
12
|
import { useOfficeTaskPaneEscape, OfficeCheckbox, CommittedOfficeNumberField, useOfficeDialog, useOfficeTaskPaneModal, createOfficeKernelClient, officeFontFamilies, CollectionState, OfficeNumberField, handleOfficeTaskPaneKeyDown } from "./0~7048.js";
|
|
13
13
|
import { isOfficeShortcutBlocked, OfficeColorPicker } from "./0~3635.js";
|
|
14
14
|
import { createOfficeEditorExtension, useOfficeEditorRuntime, useOfficeEditorKeyboardShortcuts } from "./0~3557.js";
|
|
15
15
|
import { showToast } from "./6489.js";
|
|
16
16
|
import { unsupportedSpreadsheetFormulaFunctions } from "./0~work-spreadsheet-formula-support.js";
|
|
17
|
-
import { WorkspaceContextMenu, isWorkspaceContextMenuKeyboardEvent, WorkOfficeZoomControls, Tabs, WorkOfficeStatusBar,
|
|
17
|
+
import { WorkspaceContextMenu, isWorkspaceContextMenuKeyboardEvent, WorkOfficeZoomControls, Tabs, WorkOfficeStatusBar, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkOfficeRibbonGroup, WorkOfficeRibbonButton, WorkOfficePreviewBar } from "./0~9073.js";
|
|
18
18
|
import { useOfficeDraft, InlineNotice } from "./0~345.js";
|
|
19
19
|
import { spreadsheetAgentMenuItems, SpreadsheetChartSeriesStyleEditor, normalizeOptionalOfficeNumber, normalizeRequiredOfficeNumber, SpreadsheetErrorBarEditor, useOfficeHistory, spreadsheetAgentSelection, SpreadsheetTrendlineEditor, applySpreadsheetAgentProposalChanges } from "./0~3539.js";
|
|
20
20
|
import { useOfficeEditorFocusOrigin, useOfficeCollaborationLocationNavigator, StateView } from "./432.js";
|
package/dist/core.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { decodeWorkDocumentSnapshot as decodeDocumentSnapshot, encodeWorkDocumen
|
|
|
27
27
|
export { applyWorkDocumentSource as applyDocumentSource, projectWorkDocumentSource as projectDocumentSource, WORK_DOCUMENT_SOURCE_MEDIA_TYPE as DOCUMENT_SOURCE_MEDIA_TYPE, WORK_DOCUMENT_SOURCE_SCHEMA as DOCUMENT_SOURCE_SCHEMA, WORK_DOCUMENT_SOURCE_VERSION as DOCUMENT_SOURCE_VERSION, type WorkDocumentSource as DocumentSource, } from './internal/features/work/work-document-source';
|
|
28
28
|
export type { WorkGetMarkdownSelectionMenuItems as GetMarkdownSelectionMenuItems, WorkMarkdownSelectionCommandFailure as MarkdownSelectionCommandFailure, WorkMarkdownSelectionCommandResult as MarkdownSelectionCommandResult, WorkMarkdownSelectionCommands as MarkdownSelectionCommands, WorkMarkdownSelectionContext as MarkdownSelectionContext, WorkMarkdownSelectionMenuIcon as MarkdownSelectionMenuIcon, WorkMarkdownSelectionMenuItem as MarkdownSelectionMenuItem, WorkMarkdownSelectionSnapshot as MarkdownSelectionSnapshot, } from './internal/features/work/work-markdown-selection-menu';
|
|
29
29
|
export { exportWorkArtifactPdf as downloadArtifactPdf, type WorkPdfExportOptions as PdfExportOptions, workPdfPagesForExport as pdfPagesForExport, } from './internal/features/work/work-pdf-export';
|
|
30
|
+
export type { PdfPageOrganizationExport } from './internal/features/work/editors/use-pdf-page-organization';
|
|
30
31
|
export { defaultPptxRuntimeUrl } from './internal/features/work/work-presentation-file-io';
|
|
31
32
|
export { forgetWorkSourceBlob as forgetSourceBlob, readWorkSourceBlob as readSourceBlob, rememberWorkSourceBlob as registerSourceBlob, } from './internal/features/work/work-repository';
|
|
32
33
|
export { createWorkArtifact as createArtifact, createWorkId as createOfficeId, WORK_TEMPLATES as officeTemplates, } from './internal/features/work/work-templates';
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import type { PdfAnnotationController, PdfAnnotationToolId } from './pdf-annotation-controller';
|
|
2
2
|
import type { PdfViewerController } from './pdf-viewer-controller';
|
|
3
|
+
import type { PdfPageOrganizationController } from './use-pdf-page-organization';
|
|
3
4
|
import { type OfficeEditorCanCommands, type OfficeEditorExtension } from './office-editor-extension';
|
|
4
5
|
export interface PdfEditorCommands {
|
|
5
6
|
clearSearch: () => void;
|
|
6
7
|
deleteAnnotationSelection: () => void;
|
|
7
8
|
fitPage: () => void;
|
|
8
9
|
fitWidth: () => void;
|
|
10
|
+
deletePages: (pageIndexes: number[]) => Promise<boolean>;
|
|
11
|
+
extractPages: (pageIndexes: number[]) => Promise<boolean>;
|
|
9
12
|
goToPage: (page: number) => void;
|
|
10
13
|
nextPage: () => void;
|
|
11
14
|
nextSearchResult: () => void;
|
|
15
|
+
insertBlankPage: (index: number) => Promise<boolean>;
|
|
16
|
+
mergePages: (index: number, source: Blob) => Promise<boolean>;
|
|
17
|
+
openPageOrganizer: () => void;
|
|
12
18
|
previousPage: () => void;
|
|
13
19
|
previousSearchResult: () => void;
|
|
14
20
|
redo: () => void;
|
|
21
|
+
reorderPages: (pageOrder: number[]) => Promise<boolean>;
|
|
22
|
+
rotatePages: (pageIndexes: number[], degrees: 90 | 180 | 270) => Promise<boolean>;
|
|
15
23
|
save: () => Promise<void>;
|
|
16
24
|
search: (query: string) => void;
|
|
17
25
|
setAnnotationColor: (color: string) => void;
|
|
18
26
|
setAnnotationOpacity: (opacity: number) => void;
|
|
19
27
|
setAnnotationStrokeWidth: (strokeWidth: number) => void;
|
|
20
28
|
selectAnnotationTool: (toolId: PdfAnnotationToolId | null) => void;
|
|
29
|
+
splitPages: (splitAfterPageIndexes: number[]) => Promise<boolean>;
|
|
21
30
|
undo: () => void;
|
|
22
31
|
zoomIn: () => void;
|
|
23
32
|
zoomOut: () => void;
|
|
@@ -27,6 +36,8 @@ export interface PdfEditorCommandContext {
|
|
|
27
36
|
annotation: PdfAnnotationController;
|
|
28
37
|
editable: boolean;
|
|
29
38
|
focusSearch: () => void;
|
|
39
|
+
openPageOrganizer: () => void;
|
|
40
|
+
pages: PdfPageOrganizationController;
|
|
30
41
|
save: {
|
|
31
42
|
enabled: boolean;
|
|
32
43
|
execute: () => Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PdfPageOrganizationSize } from './pdf-page-organization-types';
|
|
2
|
+
export declare function validatedPdfPageIndexes(pageIndexes: readonly number[], pageCount: number, options?: {
|
|
3
|
+
allowEmpty?: boolean;
|
|
4
|
+
preserveOrder?: boolean;
|
|
5
|
+
}): number[];
|
|
6
|
+
export declare function validatedPdfPageOrder(pageOrder: readonly number[], pageCount: number): number[];
|
|
7
|
+
export declare function reorderedPdfPageIndexes(pageCount: number, pageIndexes: readonly number[], targetIndex: number): number[];
|
|
8
|
+
export declare function validatedPdfInsertionIndex(index: number, pageCount: number): number;
|
|
9
|
+
export declare function validatedPdfPageSize(size: PdfPageOrganizationSize | undefined): PdfPageOrganizationSize;
|
|
10
|
+
export declare function validatedPdfSplitBoundaries(splitAfterPageIndexes: readonly number[], pageCount: number): number[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare const PDF_PAGE_ORGANIZATION_MAX_SOURCE_BYTES: number;
|
|
2
|
+
export declare const PDF_PAGE_ORGANIZATION_MAX_IMPORT_BYTES: number;
|
|
3
|
+
export declare const PDF_PAGE_ORGANIZATION_MAX_PAGES = 4096;
|
|
4
|
+
export declare const PDF_PAGE_ORGANIZATION_MIN_PAGE_POINTS = 18;
|
|
5
|
+
export declare const PDF_PAGE_ORGANIZATION_MAX_PAGE_POINTS = 14400;
|
|
6
|
+
export type PdfPageOrganizationErrorCode = 'pdf.pages.duplicate-index' | 'pdf.pages.empty-document' | 'pdf.pages.encrypted-source' | 'pdf.pages.invalid-index' | 'pdf.pages.invalid-order' | 'pdf.pages.invalid-page-size' | 'pdf.pages.invalid-source' | 'pdf.pages.invalid-split' | 'pdf.pages.missing-import' | 'pdf.pages.page-limit' | 'pdf.pages.risky-import' | 'pdf.pages.risky-structure' | 'pdf.pages.signed-source' | 'pdf.pages.source-limit' | 'pdf.pages.unsupported-rotation';
|
|
7
|
+
export declare class PdfPageOrganizationError extends Error {
|
|
8
|
+
readonly code: PdfPageOrganizationErrorCode;
|
|
9
|
+
constructor(code: PdfPageOrganizationErrorCode, message: string);
|
|
10
|
+
}
|
|
11
|
+
export interface PdfPageOrganizationSize {
|
|
12
|
+
height: number;
|
|
13
|
+
width: number;
|
|
14
|
+
}
|
|
15
|
+
export type PdfPageOrganizationMutation = {
|
|
16
|
+
degrees: 90 | 180 | 270;
|
|
17
|
+
kind: 'rotate';
|
|
18
|
+
pageIndexes: number[];
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'delete';
|
|
21
|
+
pageIndexes: number[];
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'reorder';
|
|
24
|
+
pageOrder: number[];
|
|
25
|
+
} | {
|
|
26
|
+
index: number;
|
|
27
|
+
kind: 'insert-blank';
|
|
28
|
+
size?: PdfPageOrganizationSize;
|
|
29
|
+
} | {
|
|
30
|
+
index: number;
|
|
31
|
+
kind: 'merge';
|
|
32
|
+
};
|
|
33
|
+
export type PdfPageOrganizationExportOperation = {
|
|
34
|
+
kind: 'extract';
|
|
35
|
+
pageIndexes: number[];
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'split';
|
|
38
|
+
splitAfterPageIndexes: number[];
|
|
39
|
+
};
|
|
40
|
+
export type PdfPageOrganizationSource = ArrayBuffer | Uint8Array;
|
|
41
|
+
export type PdfPageOrganizationJob = {
|
|
42
|
+
importSource?: PdfPageOrganizationSource;
|
|
43
|
+
kind: 'mutate';
|
|
44
|
+
mutation: PdfPageOrganizationMutation;
|
|
45
|
+
source: PdfPageOrganizationSource;
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'export';
|
|
48
|
+
operation: PdfPageOrganizationExportOperation;
|
|
49
|
+
source: PdfPageOrganizationSource;
|
|
50
|
+
};
|
|
51
|
+
export interface PdfPageOrganizationDiagnostic {
|
|
52
|
+
code: 'pdf.pages.catalog-not-copied';
|
|
53
|
+
message: string;
|
|
54
|
+
}
|
|
55
|
+
export interface PdfPageOrganizationExportFile {
|
|
56
|
+
pageCount: number;
|
|
57
|
+
source: Uint8Array;
|
|
58
|
+
}
|
|
59
|
+
export type PdfPageOrganizationResult = {
|
|
60
|
+
diagnostics: PdfPageOrganizationDiagnostic[];
|
|
61
|
+
kind: 'mutated';
|
|
62
|
+
pageCount: number;
|
|
63
|
+
source: Uint8Array;
|
|
64
|
+
} | {
|
|
65
|
+
diagnostics: PdfPageOrganizationDiagnostic[];
|
|
66
|
+
files: PdfPageOrganizationExportFile[];
|
|
67
|
+
kind: 'exported';
|
|
68
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PdfPageOrganizationErrorCode, PdfPageOrganizationJob, PdfPageOrganizationResult } from './pdf-page-organization-types';
|
|
2
|
+
export interface PdfPageOrganizationWorkerRequest {
|
|
3
|
+
job: PdfPageOrganizationJob;
|
|
4
|
+
kind: 'run';
|
|
5
|
+
}
|
|
6
|
+
export type PdfPageOrganizationWorkerResponse = {
|
|
7
|
+
kind: 'success';
|
|
8
|
+
result: PdfPageOrganizationResult;
|
|
9
|
+
} | {
|
|
10
|
+
code: PdfPageOrganizationErrorCode;
|
|
11
|
+
kind: 'failure';
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { applyPdfPageOrganizationJob } from './pdf-page-organization-engine';
|
|
2
|
+
export { reorderedPdfPageIndexes, validatedPdfInsertionIndex, validatedPdfPageIndexes, validatedPdfPageOrder, validatedPdfPageSize, validatedPdfSplitBoundaries, } from './pdf-page-organization-plan';
|
|
3
|
+
export * from './pdf-page-organization-types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PluginRegistry } from '@embedpdf/react-pdf-viewer';
|
|
2
|
+
import type { PdfEditorCanCommands, PdfEditorCommands } from './pdf-editor-extensions';
|
|
3
|
+
import type { PdfPageOrganizationControllerError, PdfPageOrganizationControllerState } from './use-pdf-page-organization';
|
|
4
|
+
export interface PdfPageOrganizerDialogProps {
|
|
5
|
+
busy: boolean;
|
|
6
|
+
can: PdfEditorCanCommands;
|
|
7
|
+
commands: PdfEditorCommands;
|
|
8
|
+
currentPage: number;
|
|
9
|
+
diagnostics: PdfPageOrganizationControllerState['diagnostics'];
|
|
10
|
+
error: PdfPageOrganizationControllerError | null;
|
|
11
|
+
registry: PluginRegistry;
|
|
12
|
+
restoreFocusTarget: () => HTMLElement | null;
|
|
13
|
+
totalPages: number;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
onDismissError: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function PdfPageOrganizerDialog({ busy, can, commands, currentPage, diagnostics, error, registry, restoreFocusTarget, totalPages, onClose, onDismissError, }: PdfPageOrganizerDialogProps): import("react").JSX.Element;
|
|
@@ -23,4 +23,8 @@ export declare function calculatePdfThumbnailRange({ anchorIndex, itemHeight, to
|
|
|
23
23
|
totalPages: number;
|
|
24
24
|
viewportHeight: number;
|
|
25
25
|
}): PdfThumbnailRange;
|
|
26
|
+
export declare function usePdfThumbnailSource(registry: PluginRegistry, page: number): {
|
|
27
|
+
sourceUrl: string | null;
|
|
28
|
+
state: 'error' | 'loading' | 'ready';
|
|
29
|
+
};
|
|
26
30
|
export {};
|
|
@@ -9,11 +9,12 @@ interface PdfPageNavigationControl {
|
|
|
9
9
|
onOpen: () => void;
|
|
10
10
|
toggleRef: RefObject<HTMLButtonElement | null>;
|
|
11
11
|
}
|
|
12
|
-
export declare function PdfToolbar({ annotationState, can, commands, editable, pageNavigation, saveAvailable, saveLabel, saveState, searchInputRef, state, }: {
|
|
12
|
+
export declare function PdfToolbar({ annotationState, can, commands, editable, pageOrganizationAvailable, pageNavigation, saveAvailable, saveLabel, saveState, searchInputRef, state, }: {
|
|
13
13
|
annotationState: PdfAnnotationControllerState;
|
|
14
14
|
can: PdfEditorCanCommands;
|
|
15
15
|
commands: PdfEditorCommands;
|
|
16
16
|
editable: boolean;
|
|
17
|
+
pageOrganizationAvailable?: boolean;
|
|
17
18
|
pageNavigation?: PdfPageNavigationControl;
|
|
18
19
|
saveAvailable?: boolean;
|
|
19
20
|
saveLabel: string;
|
|
@@ -2,6 +2,7 @@ import { type UISchema } from '@embedpdf/react-pdf-viewer';
|
|
|
2
2
|
import type { WorkOfficeCollaborationSession } from '../../../collaboration/office-collaboration';
|
|
3
3
|
import type { WorkPdfCollaborationContent } from '../../../collaboration/office-pdf-collaboration-types';
|
|
4
4
|
import type { PdfEvidenceOverlay, PdfEvidenceRegion } from './pdf-evidence-contract';
|
|
5
|
+
import { type PdfPageOrganizationExport } from './use-pdf-page-organization';
|
|
5
6
|
export declare const a3sPdfUiSchema: UISchema;
|
|
6
7
|
export interface PdfViewerProps {
|
|
7
8
|
collaboration?: WorkOfficeCollaborationSession;
|
|
@@ -11,6 +12,7 @@ export interface PdfViewerProps {
|
|
|
11
12
|
onCollaborationChange?: (content: WorkPdfCollaborationContent) => void;
|
|
12
13
|
onEvidenceRegionSelect?: (region: PdfEvidenceRegion) => void;
|
|
13
14
|
onPageChange?: (pageNumber: number) => void;
|
|
15
|
+
onPageExport?: (files: readonly PdfPageOrganizationExport[]) => boolean | Promise<boolean>;
|
|
14
16
|
onSave?: (pdf: Blob) => Promise<boolean>;
|
|
15
17
|
saveLabel?: string;
|
|
16
18
|
selectedEvidenceRegionId?: string;
|
|
@@ -18,4 +20,4 @@ export interface PdfViewerProps {
|
|
|
18
20
|
wasmUrl?: string;
|
|
19
21
|
worker?: boolean;
|
|
20
22
|
}
|
|
21
|
-
export declare function PdfViewer({ collaboration, evidenceOverlay, fileName, loadSource, onCollaborationChange, onEvidenceRegionSelect, onPageChange, onSave, saveLabel, selectedEvidenceRegionId, sourceKey, wasmUrl, worker, }: PdfViewerProps): import("react").JSX.Element;
|
|
23
|
+
export declare function PdfViewer({ collaboration, evidenceOverlay, fileName, loadSource, onCollaborationChange, onEvidenceRegionSelect, onPageChange, onPageExport, onSave, saveLabel, selectedEvidenceRegionId, sourceKey, wasmUrl, worker, }: PdfViewerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PdfPageOrganizationDiagnostic, PdfPageOrganizationErrorCode, PdfPageOrganizationExportOperation, PdfPageOrganizationJob, PdfPageOrganizationMutation, PdfPageOrganizationResult } from './pdf-page-organization';
|
|
2
|
+
export interface PdfPageOrganizationExport {
|
|
3
|
+
fileName: string;
|
|
4
|
+
pageCount: number;
|
|
5
|
+
pdf: Blob;
|
|
6
|
+
}
|
|
7
|
+
export interface PdfPageOrganizationControllerError {
|
|
8
|
+
code: PdfPageOrganizationErrorCode;
|
|
9
|
+
message: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PdfPageOrganizationControllerState {
|
|
12
|
+
available: boolean;
|
|
13
|
+
busy: boolean;
|
|
14
|
+
canRedo: boolean;
|
|
15
|
+
canUndo: boolean;
|
|
16
|
+
diagnostics: readonly PdfPageOrganizationDiagnostic[];
|
|
17
|
+
error: PdfPageOrganizationControllerError | null;
|
|
18
|
+
revision: number;
|
|
19
|
+
}
|
|
20
|
+
export interface PdfPageOrganizationController {
|
|
21
|
+
state: PdfPageOrganizationControllerState;
|
|
22
|
+
dismissError: () => void;
|
|
23
|
+
exportPages: (operation: PdfPageOrganizationExportOperation) => Promise<boolean>;
|
|
24
|
+
mutate: (mutation: PdfPageOrganizationMutation, importSource?: Blob) => Promise<boolean>;
|
|
25
|
+
redo: () => void;
|
|
26
|
+
undo: () => void;
|
|
27
|
+
}
|
|
28
|
+
interface UsePdfPageOrganizationOptions {
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
fileName: string;
|
|
31
|
+
onExport?: (files: readonly PdfPageOrganizationExport[]) => boolean | Promise<boolean>;
|
|
32
|
+
readCurrentSource: () => Promise<Blob>;
|
|
33
|
+
replaceSource: (source: Blob) => void;
|
|
34
|
+
resetKey?: string;
|
|
35
|
+
}
|
|
36
|
+
type RunPdfPageOrganizationJob = (job: PdfPageOrganizationJob, signal?: AbortSignal) => Promise<PdfPageOrganizationResult>;
|
|
37
|
+
export declare function usePdfPageOrganization(options: UsePdfPageOrganizationOptions, runJob?: RunPdfPageOrganizationJob): PdfPageOrganizationController;
|
|
38
|
+
export {};
|
package/dist/office-kernel.wasm
CHANGED
|
Binary file
|