@a3s-lab/office 0.30.0 → 0.32.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 +25 -5
- package/dist/{0~7231.js → 0~4808.js} +190 -3
- package/dist/0~4980.js +1 -1
- package/dist/0~5050.js +10 -1
- package/dist/{0~7360.js → 0~7240.js} +245 -16
- package/dist/0~7614.js +1 -1
- package/dist/0~document-editor.js +1756 -178
- package/dist/0~spreadsheet-editor.js +2 -1
- package/dist/0~work-docx-export.js +215 -27
- package/dist/0~work-docx-import.js +27 -33
- package/dist/0~work-docx-large-document-import.js +1 -1
- package/dist/0~work-office-diagnostics.js +28 -7
- package/dist/0~work-pptx-import.js +1 -1
- package/dist/{1544.js → 3266.js} +17 -1862
- package/dist/4121.js +425 -11
- package/dist/4166.js +3848 -0
- package/dist/{6282.js → 4174.js} +812 -10
- package/dist/9333.js +1849 -0
- package/dist/core.js +5259 -4
- package/dist/index.js +3 -3
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +27 -0
- package/dist/internal/features/work/editors/document-compare-dialog.d.ts +14 -0
- package/dist/internal/features/work/editors/document-dom-selection.d.ts +7 -0
- package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -0
- package/dist/internal/features/work/editors/document-index-dialog.d.ts +10 -0
- package/dist/internal/features/work/editors/document-index-entry-dialog.d.ts +10 -0
- package/dist/internal/features/work/editors/document-references-ribbon.d.ts +19 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +6 -1
- package/dist/internal/features/work/editors/use-document-comparison.d.ts +9 -0
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +3 -0
- package/dist/internal/features/work/work-document-changes.d.ts +5 -0
- package/dist/internal/features/work/work-document-compare-diff.d.ts +38 -0
- package/dist/internal/features/work/work-document-compare-stability.d.ts +5 -0
- package/dist/internal/features/work/work-document-compare.d.ts +27 -0
- package/dist/internal/features/work/work-document-index-fields.d.ts +19 -0
- package/dist/internal/features/work/work-document-index-nodes.d.ts +32 -0
- package/dist/internal/features/work/work-document-index.d.ts +63 -0
- package/dist/internal/features/work/work-docx-import.d.ts +3 -1
- package/dist/internal/features/work/work-docx-index-export.d.ts +14 -0
- package/dist/internal/features/work/work-docx-index-import.d.ts +23 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +490 -0
- package/docs/latest/en/browser-editor-architecture.md +37 -0
- package/package.json +9 -3
- package/dist/4104.js +0 -9336
package/dist/index.js
CHANGED
|
@@ -2,14 +2,14 @@ var src_DOCUMENT_SNAPSHOT_VERSION = 1;
|
|
|
2
2
|
var src_DOCUMENT_SOURCE_VERSION = 1;
|
|
3
3
|
var src_OFFICE_COLLABORATION_VERSION = 1;
|
|
4
4
|
export { AGENT_PROPOSAL_PROTOCOL, OFFICE_NOTIFICATION_EVENT, createAgentProposalInstruction, createAgentProposalRequest, getAgentProposalStatus, subscribeOfficeNotifications } from "./6489.js";
|
|
5
|
-
export { DOCUMENT_SNAPSHOT_MEDIA_TYPE, DOCUMENT_SNAPSHOT_SCHEMA, DOCUMENT_SOURCE_MEDIA_TYPE, DOCUMENT_SOURCE_SCHEMA, OFFICE_COLLABORATION_DEFAULT_MAX_TRANSPORT_PAYLOAD_BYTES, OFFICE_COLLABORATION_MAX_TRANSPORT_PAYLOAD_BYTES, OFFICE_COLLABORATION_PRESENCE_FIELD, OFFICE_FILE_ACCEPT, applyDocumentSource, artifactExtension, artifactExtension as workArtifactExtension, artifactKindLabel, artifactKindLabel as workArtifactKindLabel, createArtifactBlob, createOfficeCollaborationPresence, createOfficeCollaborationTransportBinding, createPdfCollaborationContent, decodeDocumentSnapshot, defaultPptxRuntimeUrl, downloadArtifact, downloadArtifactPdf, encodeDocumentSnapshot,
|
|
5
|
+
export { DOCUMENT_SNAPSHOT_MEDIA_TYPE, DOCUMENT_SNAPSHOT_SCHEMA, DOCUMENT_SOURCE_MEDIA_TYPE, DOCUMENT_SOURCE_SCHEMA, OFFICE_COLLABORATION_DEFAULT_MAX_TRANSPORT_PAYLOAD_BYTES, OFFICE_COLLABORATION_MAX_TRANSPORT_PAYLOAD_BYTES, OFFICE_COLLABORATION_PRESENCE_FIELD, OFFICE_FILE_ACCEPT, applyDocumentSource, artifactExtension, artifactExtension as workArtifactExtension, artifactKindLabel, artifactKindLabel as workArtifactKindLabel, createArtifactBlob, createOfficeCollaborationPresence, createOfficeCollaborationTransportBinding, createPdfCollaborationContent, decodeDocumentSnapshot, defaultPptxRuntimeUrl, downloadArtifact, downloadArtifactPdf, encodeDocumentSnapshot, importOfficeFile, officeKindForFile, pdfPagesForExport, projectDocumentSource } from "./core.js";
|
|
6
6
|
export { DocumentEditor, MarkdownEditor, PDF_EVIDENCE_COORDINATE_BASIS, PdfViewer, PresentationEditor, SpreadsheetEditor, defaultDocumentArabicLayoutFontUrl, defaultDocumentHebrewLayoutFontUrl, defaultDocumentLatinLayoutFontUrl, defaultDocumentLayoutFontUrl, defaultDocumentLayoutFonts, defaultOfficeKernelWasmUrl, defaultPdfiumWasmUrl, preloadOfficeEditor } from "./432.js";
|
|
7
7
|
export { OFFICE_COLLABORATION_NAMESPACE, OFFICE_COLLABORATION_PROTOCOL, OfficeCollaborationError, createOfficeCollaborationSession, readOfficeCollaborationMetadata } from "./9787.js";
|
|
8
8
|
export { assertPdfCollaborationSource, createOfficePdfCollaborationBinding, initializeOfficePdfCollaboration, readOfficePdfCollaboration, readOfficePdfCollaborationSource, replaceOfficePdfCollaboration } from "./3818.js";
|
|
9
9
|
export { createArtifact, createOfficeId, officeTemplates } from "./4121.js";
|
|
10
|
-
export { createOfficeDocumentCollaborationBinding, initializeOfficeDocumentCollaboration, officeDocumentCollaborationFragment, readOfficeDocumentCollaboration } from "./
|
|
10
|
+
export { createOfficeDocumentCollaborationBinding, forgetSourceBlob, initializeOfficeDocumentCollaboration, officeDocumentCollaborationFragment, readOfficeDocumentCollaboration, readSourceBlob, registerSourceBlob } from "./4174.js";
|
|
11
11
|
export { createOfficeMarkdownCollaborationBinding, initializeOfficeMarkdownCollaboration, readOfficeMarkdownCollaboration, replaceOfficeMarkdownCollaboration } from "./2591.js";
|
|
12
12
|
export { createOfficePresentationCollaborationBinding, initializeOfficePresentationCollaboration, readOfficePresentationCollaboration, replaceOfficePresentationCollaboration } from "./4560.js";
|
|
13
|
-
export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./
|
|
13
|
+
export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./3266.js";
|
|
14
14
|
export { normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel } from "./8715.js";
|
|
15
15
|
export { src_DOCUMENT_SNAPSHOT_VERSION as DOCUMENT_SNAPSHOT_VERSION, src_DOCUMENT_SOURCE_VERSION as DOCUMENT_SOURCE_VERSION, src_OFFICE_COLLABORATION_VERSION as OFFICE_COLLABORATION_VERSION };
|
|
@@ -616,6 +616,33 @@ export declare const documentCommandCatalog: {
|
|
|
616
616
|
readonly group: "tableOfContents";
|
|
617
617
|
};
|
|
618
618
|
};
|
|
619
|
+
readonly markIndexEntry: {
|
|
620
|
+
readonly id: "references.markIndexEntry";
|
|
621
|
+
readonly label: "标记索引项";
|
|
622
|
+
readonly location: {
|
|
623
|
+
readonly area: "ribbon";
|
|
624
|
+
readonly tab: "references";
|
|
625
|
+
readonly group: "index";
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
readonly index: {
|
|
629
|
+
readonly id: "references.index";
|
|
630
|
+
readonly label: "插入或自定义索引";
|
|
631
|
+
readonly location: {
|
|
632
|
+
readonly area: "ribbon";
|
|
633
|
+
readonly tab: "references";
|
|
634
|
+
readonly group: "index";
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
readonly refreshIndex: {
|
|
638
|
+
readonly id: "references.refreshIndex";
|
|
639
|
+
readonly label: "更新索引";
|
|
640
|
+
readonly location: {
|
|
641
|
+
readonly area: "ribbon";
|
|
642
|
+
readonly tab: "references";
|
|
643
|
+
readonly group: "index";
|
|
644
|
+
};
|
|
645
|
+
};
|
|
619
646
|
readonly refreshFields: {
|
|
620
647
|
readonly id: "references.refreshFields";
|
|
621
648
|
readonly label: "更新域";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DocumentComparisonApplyResult, DocumentComparisonMode } from '../work-document-compare';
|
|
2
|
+
export interface DocumentCompareDialogRequest {
|
|
3
|
+
author: string;
|
|
4
|
+
file: File;
|
|
5
|
+
mode: DocumentComparisonMode;
|
|
6
|
+
}
|
|
7
|
+
export interface DocumentCompareDialogProps {
|
|
8
|
+
initialMode: DocumentComparisonMode;
|
|
9
|
+
restoreFocusTarget: () => HTMLElement | null;
|
|
10
|
+
onApplied: (result: DocumentComparisonApplyResult) => void;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
onSubmit: (request: DocumentCompareDialogRequest) => Promise<DocumentComparisonApplyResult>;
|
|
13
|
+
}
|
|
14
|
+
export declare function DocumentCompareDialog({ initialMode, restoreFocusTarget, onApplied, onClose, onSubmit, }: DocumentCompareDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* Reconciles a visible browser text selection before a capture-phase command
|
|
4
|
+
* snapshots editor state. Selection-change delivery can lag behind a keyboard
|
|
5
|
+
* shortcut under load, leaving ProseMirror with an older collapsed selection.
|
|
6
|
+
*/
|
|
7
|
+
export declare function synchronizeDocumentEditorSelectionFromDom(editor: Editor): boolean;
|
|
@@ -28,3 +28,4 @@ interface CustomSelectionMenuItem<Context> {
|
|
|
28
28
|
export declare function customSelectionMenuItems<Context>(items: readonly CustomSelectionMenuItem<Context>[], createAction: () => CustomSelectionAction<Context>): WorkspaceContextMenuItem[];
|
|
29
29
|
export declare function documentPageCount(editor: Editor): number;
|
|
30
30
|
export declare function documentCurrentPage(editor: Editor): number;
|
|
31
|
+
export declare function documentHasRefreshableFields(editor: Editor): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorkDocumentIndexOptions } from '../work-document-index';
|
|
2
|
+
export interface DocumentIndexDialogProps {
|
|
3
|
+
editing: boolean;
|
|
4
|
+
options: WorkDocumentIndexOptions;
|
|
5
|
+
restoreFocusTarget: () => HTMLElement | null;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
onOptionsChange: (options: WorkDocumentIndexOptions) => void;
|
|
8
|
+
onSubmit: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function DocumentIndexDialog({ editing, options, restoreFocusTarget, onCancel, onOptionsChange, onSubmit, }: DocumentIndexDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorkDocumentIndexEntryDraft } from '../work-document-index';
|
|
2
|
+
export interface DocumentIndexEntryDialogProps {
|
|
3
|
+
editing: boolean;
|
|
4
|
+
value: WorkDocumentIndexEntryDraft;
|
|
5
|
+
restoreFocusTarget: () => HTMLElement | null;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
onChange: (value: WorkDocumentIndexEntryDraft) => void;
|
|
8
|
+
onSubmit: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function DocumentIndexEntryDialog({ editing, value, restoreFocusTarget, onCancel, onChange, onSubmit, }: DocumentIndexEntryDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { WorkDocumentCaptionKind } from '../work-document-captions';
|
|
3
|
+
import type { WorkDocumentNoteKind } from '../work-document-notes';
|
|
4
|
+
export interface DocumentReferencesRibbonProps {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
citationsOpen: boolean;
|
|
7
|
+
citationSourceCount: number;
|
|
8
|
+
onInsertNote: (kind: WorkDocumentNoteKind) => void;
|
|
9
|
+
onInsertCaption: (kind: WorkDocumentCaptionKind) => void;
|
|
10
|
+
onInsertCrossReference: () => void;
|
|
11
|
+
onOpenTableOfContents: () => void;
|
|
12
|
+
onRefreshTableOfContents: () => void;
|
|
13
|
+
onOpenIndexEntry: () => void;
|
|
14
|
+
onOpenIndex: () => void;
|
|
15
|
+
onRefreshIndex: () => void;
|
|
16
|
+
onToggleCitations: () => void;
|
|
17
|
+
onRefreshFields: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function DocumentReferencesRibbon({ editor, citationsOpen, citationSourceCount, onInsertNote, onInsertCaption, onInsertCrossReference, onOpenTableOfContents, onRefreshTableOfContents, onOpenIndexEntry, onOpenIndex, onRefreshIndex, onToggleCitations, onRefreshFields, }: DocumentReferencesRibbonProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/core';
|
|
2
2
|
import type { WorkDocumentCaptionKind } from '../work-document-captions';
|
|
3
3
|
import { type WorkDocumentChange } from '../work-document-changes';
|
|
4
|
+
import type { DocumentComparisonMode } from '../work-document-compare';
|
|
4
5
|
import type { WorkDocumentFieldKind } from '../work-document-fields';
|
|
5
6
|
import type { WorkDocumentLayoutFont } from '../work-document-fonts';
|
|
6
7
|
import type { WorkDocumentNoteKind } from '../work-document-notes';
|
|
@@ -58,11 +59,14 @@ interface DocumentToolbarProps {
|
|
|
58
59
|
onInsertCaption: (kind: WorkDocumentCaptionKind) => void;
|
|
59
60
|
onInsertCrossReference: () => void;
|
|
60
61
|
onOpenTableOfContents: () => void;
|
|
62
|
+
onOpenIndexEntry: () => void;
|
|
63
|
+
onOpenIndex: () => void;
|
|
61
64
|
citationsOpen: boolean;
|
|
62
65
|
citationSourceCount: number;
|
|
63
66
|
onToggleCitations: () => void;
|
|
64
67
|
onInsertField: (kind: WorkDocumentFieldKind) => void;
|
|
65
68
|
onRefreshFields: () => void;
|
|
69
|
+
onRefreshIndex: () => void;
|
|
66
70
|
onRefreshTableOfContents: () => void;
|
|
67
71
|
canInsertComment: boolean;
|
|
68
72
|
onInsertComment: () => void;
|
|
@@ -77,9 +81,10 @@ interface DocumentToolbarProps {
|
|
|
77
81
|
onRibbonTabChange?: (tab: DocumentRibbonTabId) => boolean | undefined | Promise<boolean | undefined>;
|
|
78
82
|
onToggleTrackChanges: () => void;
|
|
79
83
|
onToggleChanges: () => void;
|
|
84
|
+
onOpenComparison: (mode: DocumentComparisonMode) => void;
|
|
80
85
|
onDecideChange?: (change: WorkDocumentChange, decision: 'accept' | 'reject') => boolean;
|
|
81
86
|
onOpenWordCount: () => void;
|
|
82
87
|
onOpenFindReplace: (mode: DocumentFindReplaceMode) => void;
|
|
83
88
|
}
|
|
84
|
-
export declare function DocumentToolbar({ editor, defaultRibbonCollapsed, reviewOnly, suggestionOnly, history, layoutOpen, layout, layoutFonts, navigationOpen, pageColor, showPageNumbers, showHiddenText, showRulers, spellcheckEnabled, viewMode, zoom, pageChromeEditor, pageChromeEditingPart, pageChromeShowPageNumber, onRequestImage, onPageChromeEditingPartChange, onClosePageChrome, onTogglePageChromePageNumber, onToggleLayout, onLayoutChange, onOpenLayout, onToggleNavigation, onTogglePageNumbers, onToggleHiddenText, onToggleRulers, onPageColorChange, onToggleSpellcheck, onViewModeChange, onZoomChange, onZoomFit, onInsertSection, onInsertNote, onInsertCaption, onInsertCrossReference, onOpenTableOfContents, citationsOpen, citationSourceCount, onToggleCitations, onInsertField, onRefreshFields, onRefreshTableOfContents, canInsertComment, onInsertComment, commentsOpen, commentCount, onToggleComments, trackChanges, changesOpen, changeCount, findReplaceMode, fileActions, onRibbonTabChange, onToggleTrackChanges, onToggleChanges, onDecideChange, onOpenWordCount, onOpenFindReplace, }: DocumentToolbarProps): import("react").JSX.Element;
|
|
89
|
+
export declare function DocumentToolbar({ editor, defaultRibbonCollapsed, reviewOnly, suggestionOnly, history, layoutOpen, layout, layoutFonts, navigationOpen, pageColor, showPageNumbers, showHiddenText, showRulers, spellcheckEnabled, viewMode, zoom, pageChromeEditor, pageChromeEditingPart, pageChromeShowPageNumber, onRequestImage, onPageChromeEditingPartChange, onClosePageChrome, onTogglePageChromePageNumber, onToggleLayout, onLayoutChange, onOpenLayout, onToggleNavigation, onTogglePageNumbers, onToggleHiddenText, onToggleRulers, onPageColorChange, onToggleSpellcheck, onViewModeChange, onZoomChange, onZoomFit, onInsertSection, onInsertNote, onInsertCaption, onInsertCrossReference, onOpenTableOfContents, onOpenIndexEntry, onOpenIndex, citationsOpen, citationSourceCount, onToggleCitations, onInsertField, onRefreshFields, onRefreshIndex, onRefreshTableOfContents, canInsertComment, onInsertComment, commentsOpen, commentCount, onToggleComments, trackChanges, changesOpen, changeCount, findReplaceMode, fileActions, onRibbonTabChange, onToggleTrackChanges, onToggleChanges, onOpenComparison, onDecideChange, onOpenWordCount, onOpenFindReplace, }: DocumentToolbarProps): import("react").JSX.Element;
|
|
85
90
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import { type DocumentComparisonMode } from '../work-document-compare';
|
|
3
|
+
export declare function useDocumentComparison({ editor, onApplied, }: {
|
|
4
|
+
editor: Editor | null;
|
|
5
|
+
onApplied: () => void;
|
|
6
|
+
}): {
|
|
7
|
+
dialog: import("react").JSX.Element | null;
|
|
8
|
+
open: (mode: DocumentComparisonMode) => void;
|
|
9
|
+
};
|
|
@@ -11,8 +11,11 @@ export interface DocumentInsertCommands {
|
|
|
11
11
|
insertField: (kind: WorkDocumentFieldKind) => void;
|
|
12
12
|
insertImage: (file: File) => Promise<void>;
|
|
13
13
|
insertNote: (kind: WorkDocumentNoteKind) => boolean;
|
|
14
|
+
openIndexEntry: () => void;
|
|
15
|
+
openIndex: () => void;
|
|
14
16
|
openTableOfContents: () => void;
|
|
15
17
|
refreshFields: () => boolean;
|
|
18
|
+
refreshIndex: () => boolean;
|
|
16
19
|
refreshTableOfContents: () => boolean;
|
|
17
20
|
}
|
|
18
21
|
export declare function useDocumentInsertCommands({ contentRef, editor, resolveFieldContext, }: {
|
|
@@ -36,3 +36,8 @@ declare module '@tiptap/core' {
|
|
|
36
36
|
}
|
|
37
37
|
export declare const DocumentChange: Mark<DocumentChangeOptions, any>;
|
|
38
38
|
export declare function collectDocumentChanges(document: ProseMirrorNode): WorkDocumentChange[];
|
|
39
|
+
/**
|
|
40
|
+
* Resolves every revision on an immutable document snapshot. A malformed
|
|
41
|
+
* formatting snapshot returns `null` instead of approximating the baseline.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveAllDocumentChanges(document: ProseMirrorNode, decision: 'accept' | 'reject'): ProseMirrorNode | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type DocumentSequenceDiff<T> = {
|
|
2
|
+
kind: 'equal';
|
|
3
|
+
left: T[];
|
|
4
|
+
right: T[];
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'delete';
|
|
7
|
+
left: T[];
|
|
8
|
+
right: [];
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'insert';
|
|
11
|
+
left: [];
|
|
12
|
+
right: T[];
|
|
13
|
+
};
|
|
14
|
+
export type DocumentSequenceAlignment<T> = {
|
|
15
|
+
kind: 'equal' | 'substitute';
|
|
16
|
+
left: T;
|
|
17
|
+
right: T;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'delete';
|
|
20
|
+
left: T;
|
|
21
|
+
right: null;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'insert';
|
|
24
|
+
left: null;
|
|
25
|
+
right: T;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Computes a deterministic LCS diff while bounding the allocated matrix.
|
|
29
|
+
* Callers can fall back to one replacement when the requested matrix is too
|
|
30
|
+
* large instead of allowing adversarial documents to allocate without limit.
|
|
31
|
+
*/
|
|
32
|
+
export declare function boundedDocumentSequenceDiff<T>(left: readonly T[], right: readonly T[], equal: (left: T, right: T) => boolean, maximumCells: number): DocumentSequenceDiff<T>[] | null;
|
|
33
|
+
/**
|
|
34
|
+
* Aligns document blocks with a weighted substitution cost. A substitution
|
|
35
|
+
* cost below two pairs related blocks; a cost of two or more prefers an
|
|
36
|
+
* explicit deletion plus insertion.
|
|
37
|
+
*/
|
|
38
|
+
export declare function boundedDocumentSequenceAlignment<T>(left: readonly T[], right: readonly T[], substitutionCost: (left: T, right: T) => number, maximumCells: number): DocumentSequenceAlignment<T>[] | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function stableJson(value: unknown): string;
|
|
2
|
+
export declare function stableHash(value: string): string;
|
|
3
|
+
export declare function wordParagraphId(value: string): string;
|
|
4
|
+
export declare function normalizedDate(value: string): string;
|
|
5
|
+
export declare function boundedMetadata(value: string, maximum: number): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Content, type Editor } from '@tiptap/core';
|
|
2
|
+
export type DocumentComparisonMode = 'compare' | 'combine';
|
|
3
|
+
export type DocumentComparisonDiagnosticCode = 'changed-complex-structure' | 'combine-baseline-mismatch' | 'combine-resolution-invalid' | 'combine-structural-revisions' | 'combine-without-revisions' | 'comparison-limit-exceeded' | 'current-revisions-present' | 'empty-structural-change' | 'invalid-revised-content' | 'revised-revisions-present' | 'section-layout-mismatch' | 'unsupported-inline-review-state';
|
|
4
|
+
export interface DocumentComparisonDiagnostic {
|
|
5
|
+
code: DocumentComparisonDiagnosticCode;
|
|
6
|
+
message: string;
|
|
7
|
+
section?: number;
|
|
8
|
+
block?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface DocumentComparisonSummary {
|
|
11
|
+
insertions: number;
|
|
12
|
+
deletions: number;
|
|
13
|
+
formatting: number;
|
|
14
|
+
paragraphFormatting: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DocumentComparisonOptions {
|
|
17
|
+
mode: DocumentComparisonMode;
|
|
18
|
+
author: string;
|
|
19
|
+
date: string;
|
|
20
|
+
sourceName: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DocumentComparisonApplyResult {
|
|
23
|
+
status: 'applied' | 'unchanged' | 'unsupported';
|
|
24
|
+
summary: DocumentComparisonSummary;
|
|
25
|
+
diagnostics: DocumentComparisonDiagnostic[];
|
|
26
|
+
}
|
|
27
|
+
export declare function applyDocumentComparison(editor: Editor, revisedContent: Content, options: DocumentComparisonOptions): DocumentComparisonApplyResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type WorkDocumentIndexEntryDraft, type WorkDocumentIndexOptions } from './work-document-index';
|
|
2
|
+
export type WorkDocumentIndexEntryInstructionResult = {
|
|
3
|
+
supported: true;
|
|
4
|
+
value: WorkDocumentIndexEntryDraft;
|
|
5
|
+
} | {
|
|
6
|
+
supported: false;
|
|
7
|
+
reason: 'not-index-entry' | 'invalid-instruction' | 'invalid-entry' | 'unsupported-switch';
|
|
8
|
+
};
|
|
9
|
+
export type WorkDocumentIndexInstructionResult = {
|
|
10
|
+
supported: true;
|
|
11
|
+
options: WorkDocumentIndexOptions;
|
|
12
|
+
} | {
|
|
13
|
+
supported: false;
|
|
14
|
+
reason: 'not-index' | 'invalid-instruction' | 'invalid-columns' | 'unsupported-switch';
|
|
15
|
+
};
|
|
16
|
+
export declare function parseDocumentIndexEntryInstruction(instruction: string): WorkDocumentIndexEntryInstructionResult;
|
|
17
|
+
export declare function documentIndexEntryInstruction(source: WorkDocumentIndexEntryDraft): string;
|
|
18
|
+
export declare function parseDocumentIndexInstruction(instruction: string): WorkDocumentIndexInstructionResult;
|
|
19
|
+
export declare function documentIndexInstruction(source: WorkDocumentIndexOptions): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Node, type CommandProps } from '@tiptap/core';
|
|
2
|
+
import { type WorkDocumentIndexBuildOptions, type WorkDocumentIndexEntry, type WorkDocumentIndexEntryDraft, type WorkDocumentIndexOptions } from './work-document-index';
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
documentIndexEntry: {
|
|
6
|
+
markDocumentIndexEntry: (value: WorkDocumentIndexEntryDraft) => ReturnType;
|
|
7
|
+
updateDocumentIndexEntry: (value: WorkDocumentIndexEntryDraft) => ReturnType;
|
|
8
|
+
};
|
|
9
|
+
documentIndex: {
|
|
10
|
+
insertDocumentIndex: (options?: WorkDocumentIndexOptions, buildOptions?: WorkDocumentIndexBuildOptions) => ReturnType;
|
|
11
|
+
updateDocumentIndex: (options: WorkDocumentIndexOptions, buildOptions?: WorkDocumentIndexBuildOptions) => ReturnType;
|
|
12
|
+
refreshDocumentIndexes: (buildOptions?: WorkDocumentIndexBuildOptions) => ReturnType;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export declare const DocumentIndexEntry: Node<any, any>;
|
|
17
|
+
export declare const DocumentIndex: Node<any, any>;
|
|
18
|
+
export declare function selectedDocumentIndexEntry(editor: {
|
|
19
|
+
state: CommandProps['state'];
|
|
20
|
+
}): WorkDocumentIndexEntry | null;
|
|
21
|
+
export declare function selectedDocumentIndexOptions(editor: {
|
|
22
|
+
state: CommandProps['state'];
|
|
23
|
+
}): WorkDocumentIndexOptions | null;
|
|
24
|
+
export declare function selectedDocumentIndexDraft(editor: {
|
|
25
|
+
state: CommandProps['state'];
|
|
26
|
+
}): WorkDocumentIndexEntryDraft | null;
|
|
27
|
+
export declare function documentHasIndexEntries(editor: {
|
|
28
|
+
state: CommandProps['state'];
|
|
29
|
+
}): boolean;
|
|
30
|
+
export declare function documentHasIndex(editor: {
|
|
31
|
+
state: CommandProps['state'];
|
|
32
|
+
}): boolean;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import type { WorkDocumentFieldContextResolver } from './work-document-fields';
|
|
3
|
+
export type WorkDocumentIndexLeader = 'dot' | 'dash' | 'underline' | 'none';
|
|
4
|
+
export type WorkDocumentIndexFormat = 'indented' | 'run-in';
|
|
5
|
+
export interface WorkDocumentIndexEntryDraft {
|
|
6
|
+
mainEntry: string;
|
|
7
|
+
subEntry: string;
|
|
8
|
+
crossReference: string;
|
|
9
|
+
pageBold: boolean;
|
|
10
|
+
pageItalic: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface WorkDocumentIndexEntry extends WorkDocumentIndexEntryDraft {
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkDocumentIndexPage {
|
|
16
|
+
pageNumber: number;
|
|
17
|
+
pageBold: boolean;
|
|
18
|
+
pageItalic: boolean;
|
|
19
|
+
targetIds: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface WorkDocumentIndexGeneratedEntry {
|
|
22
|
+
mainEntry: string;
|
|
23
|
+
subEntry: string;
|
|
24
|
+
crossReference: string;
|
|
25
|
+
pages: WorkDocumentIndexPage[];
|
|
26
|
+
}
|
|
27
|
+
export interface WorkDocumentIndexOptions {
|
|
28
|
+
columns: number;
|
|
29
|
+
format: WorkDocumentIndexFormat;
|
|
30
|
+
rightAlignPageNumbers: boolean;
|
|
31
|
+
leader: WorkDocumentIndexLeader;
|
|
32
|
+
}
|
|
33
|
+
export interface WorkDocumentIndexValue {
|
|
34
|
+
id: string;
|
|
35
|
+
options: WorkDocumentIndexOptions;
|
|
36
|
+
entries: WorkDocumentIndexGeneratedEntry[];
|
|
37
|
+
truncated: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface WorkDocumentIndexBuildOptions {
|
|
40
|
+
resolveContext?: WorkDocumentFieldContextResolver;
|
|
41
|
+
}
|
|
42
|
+
export declare const DEFAULT_DOCUMENT_INDEX_OPTIONS: WorkDocumentIndexOptions;
|
|
43
|
+
export declare const MAX_DOCUMENT_INDEX_ENTRIES = 512;
|
|
44
|
+
export declare const MAX_DOCUMENT_INDEX_MARKERS = 2048;
|
|
45
|
+
export declare const MAX_DOCUMENT_INDEX_TERM_LENGTH = 240;
|
|
46
|
+
export declare function normalizeDocumentIndexEntryDraft(source: Partial<WorkDocumentIndexEntryDraft> | null | undefined): WorkDocumentIndexEntryDraft | null;
|
|
47
|
+
export declare function normalizeDocumentIndexEntry(source: Partial<WorkDocumentIndexEntry> | null | undefined, fallbackId?: string): WorkDocumentIndexEntry | null;
|
|
48
|
+
export declare function normalizeDocumentIndexOptions(source: Partial<WorkDocumentIndexOptions> | null | undefined): WorkDocumentIndexOptions;
|
|
49
|
+
export declare function normalizeDocumentIndexValue(source: Omit<WorkDocumentIndexValue, 'truncated'> & {
|
|
50
|
+
truncated?: boolean;
|
|
51
|
+
}): WorkDocumentIndexValue;
|
|
52
|
+
export declare function buildDocumentIndexEntries(document: ProseMirrorNode, options?: WorkDocumentIndexBuildOptions): {
|
|
53
|
+
entries: WorkDocumentIndexGeneratedEntry[];
|
|
54
|
+
truncated: boolean;
|
|
55
|
+
};
|
|
56
|
+
export declare function documentIndexEntryHtml(source: Partial<WorkDocumentIndexEntry>): string;
|
|
57
|
+
export declare function documentIndexHtml(source: Omit<WorkDocumentIndexValue, 'truncated'> & {
|
|
58
|
+
truncated?: boolean;
|
|
59
|
+
}): string;
|
|
60
|
+
export declare function documentIndexEntryFromElement(element: HTMLElement, index?: number): WorkDocumentIndexEntry | null;
|
|
61
|
+
export declare function documentIndexValueFromElement(element: HTMLElement, index?: number): WorkDocumentIndexValue;
|
|
62
|
+
export declare function normalizeDocumentIndexesHtml(source: string): string;
|
|
63
|
+
export declare function indexLeader(value: unknown): WorkDocumentIndexLeader | null;
|
|
@@ -5,6 +5,7 @@ import { type ImportedDocxCitationMarkers } from './work-docx-citation-import';
|
|
|
5
5
|
import { type ImportedDocxCommentMarkers } from './work-docx-comment-import';
|
|
6
6
|
import { type ImportedDocxEquationMarkers } from './work-docx-equation-import';
|
|
7
7
|
import { type ImportedDocxFieldMarkers } from './work-docx-field-import';
|
|
8
|
+
import { type ImportedDocxIndexMarkers } from './work-docx-index-import';
|
|
8
9
|
import { type ImportedDocxTableOfContentsMarkers } from './work-docx-table-of-contents-import';
|
|
9
10
|
import { type ImportedDocxImageLayoutMarkers } from './work-docx-image-layout-import';
|
|
10
11
|
import { type ImportedDocxListMarkers } from './work-docx-list-import';
|
|
@@ -38,6 +39,7 @@ export interface PreparedDocxImport {
|
|
|
38
39
|
commentMarkers: ImportedDocxCommentMarkers;
|
|
39
40
|
fieldMarkers: ImportedDocxFieldMarkers;
|
|
40
41
|
tableOfContentsMarkers: ImportedDocxTableOfContentsMarkers;
|
|
42
|
+
indexMarkers: ImportedDocxIndexMarkers;
|
|
41
43
|
equationMarkers: ImportedDocxEquationMarkers;
|
|
42
44
|
citationMarkers: ImportedDocxCitationMarkers;
|
|
43
45
|
listMarkers: ImportedDocxListMarkers;
|
|
@@ -60,6 +62,6 @@ export interface PreparedDocxImport {
|
|
|
60
62
|
trackChanges: boolean;
|
|
61
63
|
}
|
|
62
64
|
export declare function prepareDocxImport(buffer: ArrayBuffer, sourcePackage?: OoxmlPackage): Promise<PreparedDocxImport>;
|
|
63
|
-
export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, tableOfContentsMarkers?: ImportedDocxTableOfContentsMarkers, equationMarkers?: ImportedDocxEquationMarkers, citationMarkers?: ImportedDocxCitationMarkers, listMarkers?: ImportedDocxListMarkers, imageLayoutMarkers?: ImportedDocxImageLayoutMarkers, paragraphIdentityMarkers?: ImportedDocxParagraphIdentityMarkers, paragraphFormattingChangeMarkers?: ImportedDocxParagraphFormattingChangeMarkers, paragraphAlignmentMarkers?: ImportedDocxParagraphAlignmentMarkers, runFormattingMarkers?: ImportedDocxRunFormattingMarkers, paragraphDirectionMarkers?: ImportedDocxParagraphDirectionMarkers, paragraphIndentMarkers?: ImportedDocxParagraphIndentMarkers, paragraphSpacingMarkers?: ImportedDocxParagraphSpacingMarkers, paragraphBorderMarkers?: ImportedDocxParagraphBorderMarkers, paragraphShadingMarkers?: ImportedDocxParagraphShadingMarkers, paragraphPaginationMarkers?: ImportedDocxParagraphPaginationMarkers, bibliography?: WorkDocumentContent['bibliography'], tabStopMarkers?: ImportedDocxParagraphTabStopMarkers, tableCellMarkers?: ImportedDocxTableCellMarkers, tableRowMarkers?: ImportedDocxTableRowMarkers, tableSizingMarkers?: ImportedDocxTableSizingMarkers): string;
|
|
65
|
+
export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, tableOfContentsMarkers?: ImportedDocxTableOfContentsMarkers, indexMarkers?: ImportedDocxIndexMarkers, equationMarkers?: ImportedDocxEquationMarkers, citationMarkers?: ImportedDocxCitationMarkers, listMarkers?: ImportedDocxListMarkers, imageLayoutMarkers?: ImportedDocxImageLayoutMarkers, paragraphIdentityMarkers?: ImportedDocxParagraphIdentityMarkers, paragraphFormattingChangeMarkers?: ImportedDocxParagraphFormattingChangeMarkers, paragraphAlignmentMarkers?: ImportedDocxParagraphAlignmentMarkers, runFormattingMarkers?: ImportedDocxRunFormattingMarkers, paragraphDirectionMarkers?: ImportedDocxParagraphDirectionMarkers, paragraphIndentMarkers?: ImportedDocxParagraphIndentMarkers, paragraphSpacingMarkers?: ImportedDocxParagraphSpacingMarkers, paragraphBorderMarkers?: ImportedDocxParagraphBorderMarkers, paragraphShadingMarkers?: ImportedDocxParagraphShadingMarkers, paragraphPaginationMarkers?: ImportedDocxParagraphPaginationMarkers, bibliography?: WorkDocumentContent['bibliography'], tabStopMarkers?: ImportedDocxParagraphTabStopMarkers, tableCellMarkers?: ImportedDocxTableCellMarkers, tableRowMarkers?: ImportedDocxTableRowMarkers, tableSizingMarkers?: ImportedDocxTableSizingMarkers): string;
|
|
64
66
|
export declare function readDocxLayout(buffer: ArrayBuffer): Promise<ImportedDocumentLayout>;
|
|
65
67
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileChild, ParagraphChild } from 'docx';
|
|
2
|
+
import { type WorkDocumentIndexGeneratedEntry, type WorkDocumentIndexOptions } from './work-document-index';
|
|
3
|
+
export interface DocxIndexPatch {
|
|
4
|
+
marker: string;
|
|
5
|
+
options: WorkDocumentIndexOptions;
|
|
6
|
+
entries: WorkDocumentIndexGeneratedEntry[];
|
|
7
|
+
}
|
|
8
|
+
export declare class DocxIndexPatchCollector {
|
|
9
|
+
readonly patches: DocxIndexPatch[];
|
|
10
|
+
add(element: HTMLElement): DocxIndexPatch;
|
|
11
|
+
}
|
|
12
|
+
export declare function docxDocumentIndex(element: HTMLElement, docx: typeof import('docx'), collector: DocxIndexPatchCollector): FileChild[];
|
|
13
|
+
export declare function docxIndexEntryRun(element: HTMLElement, docx: typeof import('docx')): ParagraphChild | null;
|
|
14
|
+
export declare function patchDocxIndexes(buffer: ArrayBuffer, patches: readonly DocxIndexPatch[]): Promise<ArrayBuffer>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type WorkDocumentIndexEntryDraft, type WorkDocumentIndexGeneratedEntry, type WorkDocumentIndexOptions } from './work-document-index';
|
|
2
|
+
import { type DocxFieldOccurrence } from './work-docx-field-instructions';
|
|
3
|
+
export interface ImportedDocxIndexMarkers {
|
|
4
|
+
entries: ImportedDocxIndexEntryMarker[];
|
|
5
|
+
indexes: ImportedDocxIndexMarker[];
|
|
6
|
+
}
|
|
7
|
+
export interface ImportedDocxIndexEntryMarker {
|
|
8
|
+
start: string;
|
|
9
|
+
end: string;
|
|
10
|
+
id: string;
|
|
11
|
+
value: WorkDocumentIndexEntryDraft;
|
|
12
|
+
}
|
|
13
|
+
export interface ImportedDocxIndexMarker {
|
|
14
|
+
marker: string;
|
|
15
|
+
id: string;
|
|
16
|
+
options: WorkDocumentIndexOptions;
|
|
17
|
+
entries: WorkDocumentIndexGeneratedEntry[];
|
|
18
|
+
}
|
|
19
|
+
export declare function markDocxIndexes(document: Document): ImportedDocxIndexMarkers;
|
|
20
|
+
export declare function applyImportedDocxIndexMarkers(document: Document, markers: ImportedDocxIndexMarkers): void;
|
|
21
|
+
export declare function hasImportedDocxIndexMarkers(markers: ImportedDocxIndexMarkers): boolean;
|
|
22
|
+
export declare function supportedDocxIndexEntryField(field: DocxFieldOccurrence): boolean;
|
|
23
|
+
export declare function supportedDocxIndexField(field: DocxFieldOccurrence): boolean;
|
package/dist/office-kernel.wasm
CHANGED
|
Binary file
|