@a3s-lab/office 0.1.0 → 0.2.2

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.
Files changed (69) hide show
  1. package/README.md +101 -24
  2. package/dist/0~2582.js +485 -0
  3. package/dist/0~4595.js +14 -7
  4. package/dist/0~4750.js +939 -0
  5. package/dist/{0~work-document-paragraph-formatting.js → 0~5861.js} +174 -3
  6. package/dist/0~7048.js +8 -6
  7. package/dist/0~9512.js +7 -4
  8. package/dist/0~document-editor.js +3147 -531
  9. package/dist/0~markdown-editor.js +26 -1
  10. package/dist/0~presentation-editor.js +68 -12
  11. package/dist/0~spreadsheet-editor.js +37 -17
  12. package/dist/0~work-document-extensions.js +588 -13
  13. package/dist/0~work-document-model-codec.js +1 -1
  14. package/dist/0~work-docx-bibliography.js +1 -1
  15. package/dist/0~work-docx-export.js +116 -55
  16. package/dist/0~work-docx-import.js +766 -107
  17. package/dist/0~work-office-diagnostics.js +2 -2
  18. package/dist/{4704.js → 2881.js} +162 -71
  19. package/dist/4104.js +2 -62
  20. package/dist/internal/features/work/editors/document-comment-window.d.ts +37 -0
  21. package/dist/internal/features/work/editors/document-navigation-panel.d.ts +3 -1
  22. package/dist/internal/features/work/editors/document-navigation-window.d.ts +64 -0
  23. package/dist/internal/features/work/editors/document-outline-navigation.d.ts +11 -0
  24. package/dist/internal/features/work/editors/document-page-navigation.d.ts +11 -1
  25. package/dist/internal/features/work/editors/document-page-thumbnail.d.ts +31 -0
  26. package/dist/internal/features/work/editors/document-picture-properties-dialog-model.d.ts +28 -0
  27. package/dist/internal/features/work/editors/document-picture-properties-dialog.d.ts +4 -0
  28. package/dist/internal/features/work/editors/document-search-navigation.d.ts +12 -0
  29. package/dist/internal/features/work/editors/document-table-margins-popover.d.ts +4 -0
  30. package/dist/internal/features/work/editors/document-table-properties-dialog-model.d.ts +51 -0
  31. package/dist/internal/features/work/editors/document-table-properties-dialog-sections.d.ts +19 -0
  32. package/dist/internal/features/work/editors/document-table-properties-dialog.d.ts +8 -0
  33. package/dist/internal/features/work/editors/office-task-pane.d.ts +1 -1
  34. package/dist/internal/features/work/editors/presentation-chart-panel.d.ts +2 -1
  35. package/dist/internal/features/work/editors/presentation-comments-panel.d.ts +2 -1
  36. package/dist/internal/features/work/editors/spreadsheet-workbook-panel.d.ts +2 -1
  37. package/dist/internal/features/work/editors/use-document-pagination.d.ts +6 -0
  38. package/dist/internal/features/work/editors/use-presentation-review-commands.d.ts +1 -1
  39. package/dist/internal/features/work/work-document-image-layout.d.ts +11 -0
  40. package/dist/internal/features/work/work-document-page-capture.d.ts +15 -0
  41. package/dist/internal/features/work/work-document-paragraph-formatting.d.ts +4 -0
  42. package/dist/internal/features/work/work-document-section.d.ts +3 -1
  43. package/dist/internal/features/work/work-document-table-borders.d.ts +20 -0
  44. package/dist/internal/features/work/work-document-table-cell-formatting.d.ts +8 -5
  45. package/dist/internal/features/work/work-document-table-geometry.d.ts +41 -0
  46. package/dist/internal/features/work/work-document-table-property-changes.d.ts +25 -0
  47. package/dist/internal/features/work/work-document-table-sizing.d.ts +15 -2
  48. package/dist/internal/features/work/work-document-word-line-metrics.d.ts +11 -0
  49. package/dist/internal/features/work/work-docx-document-layout.d.ts +2 -0
  50. package/dist/internal/features/work/work-docx-paragraph-alignment-import.d.ts +2 -1
  51. package/dist/internal/features/work/work-docx-paragraph-direction-import.d.ts +2 -1
  52. package/dist/internal/features/work/work-docx-paragraph-indent-import.d.ts +2 -1
  53. package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +2 -1
  54. package/dist/internal/features/work/work-docx-paragraph-spacing-import.d.ts +3 -2
  55. package/dist/internal/features/work/work-docx-paragraph-styles.d.ts +2 -2
  56. package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +8 -1
  57. package/dist/internal/features/work/work-docx-tab-stop-import.d.ts +2 -1
  58. package/dist/internal/features/work/work-docx-table-cell-export.d.ts +1 -1
  59. package/dist/internal/features/work/work-docx-table-cell-import.d.ts +14 -4
  60. package/dist/internal/features/work/work-docx-table-sizing-export.d.ts +1 -1
  61. package/dist/internal/features/work/work-docx-table-sizing-import.d.ts +4 -3
  62. package/dist/internal/features/work/work-docx-table-styles.d.ts +22 -0
  63. package/dist/internal/features/work/work-types.d.ts +6 -0
  64. package/dist/office-kernel.wasm +0 -0
  65. package/dist/styles.css +1288 -233
  66. package/docs/{browser-editor-architecture.md → latest/en/browser-editor-architecture.md} +144 -35
  67. package/package.json +9 -5
  68. package/dist/0~6552.js +0 -787
  69. package/dist/0~8155.js +0 -299
@@ -0,0 +1,64 @@
1
+ import { type UIEventHandler } from 'react';
2
+ export declare const DOCUMENT_NAVIGATION_COLLECTION_WINDOW_THRESHOLD = 48;
3
+ export declare const DOCUMENT_NAVIGATION_COLLECTION_WINDOW_LIMIT = 32;
4
+ export declare const DOCUMENT_NAVIGATION_COLLECTION_WINDOW_OVERSCAN = 4;
5
+ export interface DocumentNavigationWindowRange {
6
+ end: number;
7
+ start: number;
8
+ windowed: boolean;
9
+ }
10
+ export interface DocumentNavigationWindowSpacerEntry {
11
+ end: number;
12
+ height: number;
13
+ kind: 'spacer';
14
+ position: 'after' | 'before' | 'between';
15
+ start: number;
16
+ }
17
+ export interface DocumentNavigationWindowItemEntry {
18
+ index: number;
19
+ kind: 'item';
20
+ }
21
+ export type DocumentNavigationWindowEntry = DocumentNavigationWindowItemEntry | DocumentNavigationWindowSpacerEntry;
22
+ export interface DocumentNavigationListHandle {
23
+ focusFirst: () => void;
24
+ focusLast: () => void;
25
+ }
26
+ export declare function useDocumentNavigationWindow<TViewport extends HTMLElement = HTMLElement>({ estimatedItemHeight, itemGap, keys, listPaddingTop, onRovingKeyChange, pinnedKeys, rovingKey, }: {
27
+ estimatedItemHeight: number;
28
+ itemGap: number;
29
+ keys: readonly string[];
30
+ listPaddingTop: number;
31
+ onRovingKeyChange: (key: string) => void;
32
+ pinnedKeys?: readonly (string | null | undefined)[];
33
+ rovingKey: string | null;
34
+ }): {
35
+ entries: DocumentNavigationWindowEntry[];
36
+ focusAt: (requestedIndex: number) => void;
37
+ mountedCount: number;
38
+ onItemFocus: (index: number) => void;
39
+ onScroll: UIEventHandler<HTMLElement>;
40
+ range: DocumentNavigationWindowRange;
41
+ registerItem: (key: string, element: HTMLElement | null) => void;
42
+ rovingIndex: number;
43
+ viewportRef: import("react").RefObject<TViewport | null>;
44
+ };
45
+ export declare function DocumentNavigationWindowSpacer({ entry, }: {
46
+ entry: DocumentNavigationWindowSpacerEntry;
47
+ }): import("react").JSX.Element;
48
+ export declare function calculateDocumentNavigationWindowRange({ anchorIndex, averageItemHeight, itemCount, limit, overscan, threshold, viewportHeight, }: {
49
+ anchorIndex: number;
50
+ averageItemHeight: number;
51
+ itemCount: number;
52
+ limit: number;
53
+ overscan: number;
54
+ threshold: number;
55
+ viewportHeight: number;
56
+ }): DocumentNavigationWindowRange;
57
+ export declare function documentNavigationItemStarts(itemHeights: readonly number[], itemGap: number): number[];
58
+ export declare function documentNavigationWindowIndices({ itemCount, pinnedIndices, range, }: {
59
+ itemCount: number;
60
+ pinnedIndices: readonly number[];
61
+ range: DocumentNavigationWindowRange;
62
+ }): number[];
63
+ export declare function documentNavigationWindowEntries(mountedIndices: readonly number[], itemStarts: readonly number[], itemCount: number, itemGap: number): DocumentNavigationWindowEntry[];
64
+ export declare function documentNavigationIndexAtOffset(itemStarts: readonly number[], offset: number, itemCount: number): number;
@@ -0,0 +1,11 @@
1
+ import type { WorkDocumentOutlineItem } from '../work-document-outline';
2
+ import { type DocumentNavigationListHandle } from './document-navigation-window';
3
+ export declare const DocumentOutlineNavigation: import("react").ForwardRefExoticComponent<{
4
+ activeItemId: string | null;
5
+ collapsedIds: ReadonlySet<string>;
6
+ items: readonly WorkDocumentOutlineItem[];
7
+ rovingId: string | null;
8
+ onNavigate: (position: number) => void;
9
+ onRovingIdChange: (itemId: string) => void;
10
+ onToggleCollapsed: (itemId: string) => void;
11
+ } & import("react").RefAttributes<DocumentNavigationListHandle>>;
@@ -1,4 +1,7 @@
1
1
  import type { WorkDocumentSectionLayout } from '../work-types';
2
+ import { type DocumentNavigationWindowRange } from './document-navigation-window';
3
+ import { type WorkDocumentPageThumbnailSource } from './document-page-thumbnail';
4
+ export declare const DOCUMENT_PAGE_WINDOW_LIMIT = 24;
2
5
  export interface DocumentNavigationPage {
3
6
  backgroundColor?: string;
4
7
  physicalPage: number;
@@ -7,8 +10,15 @@ export interface DocumentNavigationPage {
7
10
  previewText: string;
8
11
  selectionPosition: number;
9
12
  }
10
- export declare function DocumentPageNavigation({ currentPage, pages, onSelectPage, }: {
13
+ export declare function DocumentPageNavigation({ currentPage, pages, thumbnailSource, onSelectPage, }: {
11
14
  currentPage: number;
12
15
  pages: readonly DocumentNavigationPage[];
16
+ thumbnailSource?: WorkDocumentPageThumbnailSource;
13
17
  onSelectPage: (page: DocumentNavigationPage) => void | Promise<void>;
14
18
  }): import("react").JSX.Element;
19
+ export declare function calculateDocumentPageRange({ anchorIndex, averageItemHeight, pageCount, viewportHeight, }: {
20
+ anchorIndex: number;
21
+ averageItemHeight: number;
22
+ pageCount: number;
23
+ viewportHeight: number;
24
+ }): DocumentNavigationWindowRange;
@@ -0,0 +1,31 @@
1
+ export interface WorkDocumentPageThumbnailSource {
2
+ element: HTMLElement;
3
+ pageCount: number;
4
+ pageGap: number;
5
+ pageHeight: number;
6
+ pageWidth: number;
7
+ revision: string;
8
+ }
9
+ export interface DocumentPageCanvasRenderOptions {
10
+ backgroundColor: string;
11
+ fontReadyTimeout: 0;
12
+ height: number;
13
+ logging: false;
14
+ scale: number;
15
+ useCORS: true;
16
+ width: number;
17
+ windowHeight: number;
18
+ windowWidth: number;
19
+ }
20
+ export type DocumentPageCanvasRenderer = (element: HTMLElement, options: DocumentPageCanvasRenderOptions) => Promise<HTMLCanvasElement>;
21
+ export type DocumentPageThumbnailRenderer = (source: WorkDocumentPageThumbnailSource, pageIndex: number, targetPixelWidth: number) => Promise<string>;
22
+ export declare function DocumentPageThumbnail({ backgroundColor, fallbackText, orientation, pageIndex, priority, source, renderThumbnail, }: {
23
+ backgroundColor?: string;
24
+ fallbackText: string;
25
+ orientation: 'portrait' | 'landscape';
26
+ pageIndex: number;
27
+ priority?: boolean;
28
+ source?: WorkDocumentPageThumbnailSource;
29
+ renderThumbnail?: DocumentPageThumbnailRenderer;
30
+ }): import("react").JSX.Element;
31
+ export declare function renderDocumentPageThumbnail(source: WorkDocumentPageThumbnailSource, pageIndex: number, targetPixelWidth: number, renderCanvas?: DocumentPageCanvasRenderer): Promise<string>;
@@ -0,0 +1,28 @@
1
+ import type { WorkDocumentImageAlignment, WorkDocumentImageLayout, WorkDocumentImageProperties } from '../work-document-image-layout';
2
+ export declare const IMAGE_PIXELS_PER_CENTIMETER: number;
3
+ export interface DocumentPicturePropertiesSource {
4
+ properties: WorkDocumentImageProperties;
5
+ renderedWidth?: number;
6
+ renderedHeight?: number;
7
+ }
8
+ export interface DocumentPicturePropertiesDraft {
9
+ width: string;
10
+ height: string;
11
+ lockAspectRatio: boolean;
12
+ aspectRatio: number;
13
+ layout: WorkDocumentImageLayout;
14
+ alignment: WorkDocumentImageAlignment;
15
+ wrapDistance: string;
16
+ alternativeText: string;
17
+ }
18
+ export interface DocumentPicturePropertiesErrors {
19
+ width: string | null;
20
+ height: string | null;
21
+ wrapDistance: string | null;
22
+ }
23
+ export declare function createDocumentPicturePropertiesDraft(source: DocumentPicturePropertiesSource): DocumentPicturePropertiesDraft;
24
+ export declare function withDocumentPictureDimension(draft: DocumentPicturePropertiesDraft, dimension: 'height' | 'width', value: string): DocumentPicturePropertiesDraft;
25
+ export declare function withDocumentPictureAspectRatioLock(draft: DocumentPicturePropertiesDraft, lockAspectRatio: boolean): DocumentPicturePropertiesDraft;
26
+ export declare function documentPicturePropertiesErrors(draft: DocumentPicturePropertiesDraft): DocumentPicturePropertiesErrors;
27
+ export declare function hasDocumentPicturePropertiesErrors(errors: DocumentPicturePropertiesErrors): boolean;
28
+ export declare function documentPicturePropertyChanges(initial: DocumentPicturePropertiesDraft, current: DocumentPicturePropertiesDraft): Partial<WorkDocumentImageProperties> | null;
@@ -0,0 +1,4 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ export declare function DocumentPicturePropertiesControl({ editor, }: {
3
+ editor: Editor;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { type WorkDocumentOutlineItem } from '../work-document-outline';
2
+ import type { DocumentTextMatch } from '../work-document-search';
3
+ import { type DocumentNavigationListHandle } from './document-navigation-window';
4
+ export declare const DocumentSearchNavigation: import("react").ForwardRefExoticComponent<{
5
+ matches: readonly DocumentTextMatch[];
6
+ outline: readonly WorkDocumentOutlineItem[];
7
+ rovingId: string | null;
8
+ selectedMatchIndex: number;
9
+ onRovingIdChange: (resultId: string) => void;
10
+ onSelect: (match: DocumentTextMatch) => void;
11
+ } & import("react").RefAttributes<DocumentNavigationListHandle>>;
12
+ export declare function documentNavigationMatchId(match: DocumentTextMatch): string;
@@ -0,0 +1,4 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ export declare function DocumentTableMarginsPopover({ editor }: {
3
+ editor: Editor;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import type { DocumentTableCellFormat } from '../work-document-table-cell-formatting';
2
+ import type { DocumentTableAlignment, DocumentTableCellMarginSide, DocumentTablePreferredWidthType } from '../work-document-table-geometry';
3
+ import type { DocumentTableRowHeightRule, DocumentTableRowOptions } from '../work-document-table-row';
4
+ import type { DocumentTablePropertyChanges, DocumentTableSizingState } from '../work-document-table-sizing';
5
+ export declare const PIXELS_PER_CENTIMETER: number;
6
+ export type DocumentTablePropertiesTab = 'table' | 'row' | 'column' | 'cell';
7
+ export interface DocumentTablePropertiesDraft {
8
+ table: {
9
+ widthType: DocumentTablePreferredWidthType;
10
+ width: string;
11
+ alignment: DocumentTableAlignment;
12
+ indent: string;
13
+ };
14
+ row: {
15
+ heightEnabled: boolean;
16
+ height: string;
17
+ heightRule: DocumentTableRowHeightRule;
18
+ cantSplit: boolean;
19
+ repeatHeader: boolean;
20
+ };
21
+ column: {
22
+ width: string;
23
+ };
24
+ cell: {
25
+ verticalAlign: DocumentTableCellFormat['verticalAlign'];
26
+ useTableMargins: boolean;
27
+ margins: Record<DocumentTableCellMarginSide, string>;
28
+ };
29
+ }
30
+ export interface DocumentTablePropertiesSource {
31
+ sizing: DocumentTableSizingState;
32
+ rowOptions: DocumentTableRowOptions;
33
+ cellFormat: DocumentTableCellFormat;
34
+ canRepeatHeader: boolean;
35
+ renderedTableWidth?: number;
36
+ renderedRowHeight?: number;
37
+ renderedColumnWidth?: number;
38
+ renderedColumnWidths?: readonly number[];
39
+ }
40
+ export interface DocumentTablePropertiesErrors {
41
+ tableWidth: string | null;
42
+ tableIndent: string | null;
43
+ rowHeight: string | null;
44
+ columnWidth: string | null;
45
+ cellMargins: Partial<Record<DocumentTableCellMarginSide, string>>;
46
+ }
47
+ export declare function createDocumentTablePropertiesDraft(source: DocumentTablePropertiesSource): DocumentTablePropertiesDraft;
48
+ export declare function documentTablePropertiesErrors(draft: DocumentTablePropertiesDraft): DocumentTablePropertiesErrors;
49
+ export declare function hasDocumentTablePropertiesErrors(errors: DocumentTablePropertiesErrors): boolean;
50
+ export declare function draftForTableWidthType(current: DocumentTablePropertiesDraft, widthType: DocumentTablePreferredWidthType, renderedTableWidth: number | undefined): DocumentTablePropertiesDraft;
51
+ export declare function documentTablePropertyChanges(initial: DocumentTablePropertiesDraft, current: DocumentTablePropertiesDraft, source: Pick<DocumentTablePropertiesSource, 'canRepeatHeader' | 'cellFormat' | 'renderedColumnWidths' | 'sizing'>): DocumentTablePropertyChanges | null;
@@ -0,0 +1,19 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import type { DocumentTablePropertiesSource } from './document-table-properties-dialog-model';
3
+ import { type DocumentTablePropertiesDraft, type DocumentTablePropertiesErrors, type DocumentTablePropertiesTab } from './document-table-properties-dialog-model';
4
+ interface SectionProps {
5
+ draft: DocumentTablePropertiesDraft;
6
+ setDraft: Dispatch<SetStateAction<DocumentTablePropertiesDraft>>;
7
+ errors: DocumentTablePropertiesErrors;
8
+ source: DocumentTablePropertiesSource;
9
+ }
10
+ export declare function DocumentTablePropertiesTabs({ activeTab, idBase, onTabChange, }: {
11
+ activeTab: DocumentTablePropertiesTab;
12
+ idBase: string;
13
+ onTabChange: (tab: DocumentTablePropertiesTab) => void;
14
+ }): import("react").JSX.Element;
15
+ export declare function DocumentTablePropertiesPanel({ activeTab, idBase, ...props }: SectionProps & {
16
+ activeTab: DocumentTablePropertiesTab;
17
+ idBase: string;
18
+ }): import("react").JSX.Element;
19
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ export declare function DocumentTablePropertiesControl({ editor, renderedTableWidth, renderedRowHeight, renderedColumnWidth, renderedColumnWidths, }: {
3
+ editor: Editor;
4
+ renderedTableWidth?: number;
5
+ renderedRowHeight?: number;
6
+ renderedColumnWidth?: number;
7
+ renderedColumnWidths?: readonly number[];
8
+ }): import("react").JSX.Element;
@@ -3,5 +3,5 @@ export declare const OFFICE_TASK_PANE_MODAL_QUERY = "(max-width: 900px)";
3
3
  type OfficeTaskPaneClose = () => unknown;
4
4
  export declare function handleOfficeTaskPaneKeyDown(event: KeyboardEvent<HTMLElement>, onClose: OfficeTaskPaneClose): void;
5
5
  export declare function useOfficeTaskPaneEscape(active: boolean, onClose: OfficeTaskPaneClose): void;
6
- export declare function useOfficeTaskPaneModal(): boolean;
6
+ export declare function useOfficeTaskPaneModal(query?: string): boolean;
7
7
  export {};
@@ -1,7 +1,8 @@
1
1
  import type { WorkSlideChart } from '../work-types';
2
- export declare function PresentationChartPanel({ chart, onChange, onDelete, onClose, }: {
2
+ export declare function PresentationChartPanel({ chart, onChange, onDelete, onClose, restoreFocusTarget, }: {
3
3
  chart: WorkSlideChart;
4
4
  onChange: (chart: WorkSlideChart) => void;
5
5
  onDelete: () => void;
6
6
  onClose: () => void;
7
+ restoreFocusTarget?: () => HTMLElement | null;
7
8
  }): import("react").JSX.Element;
@@ -1,9 +1,10 @@
1
1
  import type { WorkSlide } from '../work-types';
2
2
  import type { PresentationEditorCommands } from './presentation-command-types';
3
3
  export type PresentationCommentsPanelCommands = Pick<PresentationEditorCommands, 'closeComments' | 'deletePresentationComment' | 'locatePresentationComment' | 'updatePresentationComment'>;
4
- export declare function PresentationCommentsPanel({ slides, activeCommentId, commands, }: {
4
+ export declare function PresentationCommentsPanel({ slides, activeCommentId, commands, restoreFocusTarget, }: {
5
5
  slides: WorkSlide[];
6
6
  activeCommentId: string | null;
7
7
  commands: PresentationCommentsPanelCommands;
8
+ restoreFocusTarget?: () => HTMLElement | null;
8
9
  }): import("react").JSX.Element;
9
10
  export declare function presentationCommentCount(slides: readonly WorkSlide[]): number;
@@ -10,7 +10,8 @@ interface SpreadsheetWorkbookPanelProps {
10
10
  selection?: Selection;
11
11
  can: Pick<SpreadsheetEditorCanCommands, 'recalculateFormula'>;
12
12
  commands: Pick<SpreadsheetEditorCommands, 'recalculateFormula' | 'setSpreadsheetContent'>;
13
+ restoreFocusTarget?: () => HTMLElement | null;
13
14
  onClose: () => void;
14
15
  }
15
- export declare function SpreadsheetWorkbookPanel({ id, content, view, activeSheetId, selection, can, commands, onClose, }: SpreadsheetWorkbookPanelProps): import("react").JSX.Element;
16
+ export declare function SpreadsheetWorkbookPanel({ id, content, view, activeSheetId, selection, can, commands, restoreFocusTarget, onClose, }: SpreadsheetWorkbookPanelProps): import("react").JSX.Element;
16
17
  export {};
@@ -23,6 +23,11 @@ export interface DocumentPaginationPageDescriptor {
23
23
  layout: WorkDocumentSectionLayout;
24
24
  pageChrome: ResolvedDocumentPageChrome;
25
25
  }
26
+ export interface DocumentPaginationPageDescriptorDerivation {
27
+ pages: DocumentPaginationPageDescriptor[];
28
+ reusedPageCount: number;
29
+ derivedPageCount: number;
30
+ }
26
31
  export interface UseDocumentPaginationOptions {
27
32
  editor: Editor | null;
28
33
  documentRevision: number;
@@ -43,4 +48,5 @@ export interface UseDocumentPaginationValue {
43
48
  }
44
49
  export declare function useDocumentPagination({ editor, documentRevision, enabled, layoutKey, page, selectionVersion, wasmUrl, layoutFonts, loadedLayoutFontIds, }: UseDocumentPaginationOptions): UseDocumentPaginationValue;
45
50
  export declare function documentPaginationPageDescriptors(layout: OfficeKernelLayoutResult, blocks: readonly MeasuredDocumentLayoutBlock[], documentNode?: ProseMirrorNode): DocumentPaginationPageDescriptor[];
51
+ export declare function deriveDocumentPaginationPageDescriptors(layout: OfficeKernelLayoutResult, blocks: readonly MeasuredDocumentLayoutBlock[], documentNode?: ProseMirrorNode, previousPages?: readonly DocumentPaginationPageDescriptor[], requestedReusedPageCount?: number): DocumentPaginationPageDescriptorDerivation;
46
52
  export declare function pageForPosition(pagination: DocumentPaginationResult, position: number): number;
@@ -14,7 +14,7 @@ export declare function usePresentationReviewCommands({ content, onChange, onCle
14
14
  onChange: (content: WorkPresentationContent) => void;
15
15
  onClearSelection: () => void;
16
16
  onCloseComments: () => void;
17
- onOpenComments: () => void;
17
+ onOpenComments: (invoker?: HTMLElement | null) => void;
18
18
  onSelectComment: (id: string | null) => void;
19
19
  onSelectSlide: (id: string) => void;
20
20
  selectedElement: WorkSlideElement | null;
@@ -6,12 +6,19 @@ export interface WorkDocumentImageLayoutOptions {
6
6
  alignment: WorkDocumentImageAlignment;
7
7
  wrapDistance: number;
8
8
  }
9
+ export interface WorkDocumentImageProperties extends WorkDocumentImageLayoutOptions {
10
+ width: number | null;
11
+ height: number | null;
12
+ lockAspectRatio: boolean;
13
+ alternativeText: string;
14
+ }
9
15
  export interface DocumentImageCommandOptions {
10
16
  restoreFocus?: boolean;
11
17
  }
12
18
  declare module '@tiptap/core' {
13
19
  interface Commands<ReturnType> {
14
20
  documentImage: {
21
+ setDocumentImageProperties: (value: Partial<WorkDocumentImageProperties>, options?: DocumentImageCommandOptions) => ReturnType;
15
22
  setDocumentImageAlternativeText: (alternativeText: string, options?: DocumentImageCommandOptions) => ReturnType;
16
23
  setDocumentImageLayoutOptions: (value: Partial<WorkDocumentImageLayoutOptions>, options?: DocumentImageCommandOptions) => ReturnType;
17
24
  };
@@ -19,6 +26,8 @@ declare module '@tiptap/core' {
19
26
  }
20
27
  export declare const DocumentImage: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
21
28
  export declare function documentImageLayoutOptions(editor: Editor): WorkDocumentImageLayoutOptions;
29
+ export declare function documentImageProperties(editor: Editor): WorkDocumentImageProperties;
30
+ export declare function setDocumentImageProperties(editor: Editor, value: Partial<WorkDocumentImageProperties>, options?: DocumentImageCommandOptions): boolean;
22
31
  export declare function setDocumentImageLayoutOptions(editor: Editor, value: Partial<WorkDocumentImageLayoutOptions>, options?: DocumentImageCommandOptions): boolean;
23
32
  export declare function setDocumentImageAlternativeText(editor: Editor, alternativeText: string, options?: DocumentImageCommandOptions): boolean;
24
33
  export declare function documentImageAlternativeText(editor: Editor): string;
@@ -27,3 +36,5 @@ export declare function normalizeDocumentImageLayoutOptions(value: Partial<Recor
27
36
  export declare function normalizeDocumentImageLayout(value: unknown): WorkDocumentImageLayout;
28
37
  export declare function normalizeDocumentImageAlignment(value: unknown): WorkDocumentImageAlignment;
29
38
  export declare function normalizeDocumentImageWrapDistance(value: unknown): number;
39
+ export declare function normalizeDocumentImageDimension(value: unknown): number | null;
40
+ export declare function normalizeDocumentImageLockAspectRatio(value: unknown): boolean;
@@ -0,0 +1,15 @@
1
+ export interface WorkLiveDocumentCaptureSurface {
2
+ element: HTMLElement;
3
+ pageCount: number;
4
+ pageGap: number;
5
+ pageHeight: number;
6
+ pageWidth: number;
7
+ }
8
+ export interface WorkLiveDocumentCapture {
9
+ backgroundColor: string;
10
+ host: HTMLDivElement;
11
+ snapshot: HTMLElement;
12
+ viewport: HTMLDivElement;
13
+ }
14
+ export declare function mountWorkLiveDocumentCapture(surface: WorkLiveDocumentCaptureSurface, firstPageIndex?: number, captureHeight?: number): WorkLiveDocumentCapture;
15
+ export declare function normalizeWorkLiveDocumentSnapshot(snapshot: HTMLElement): void;
@@ -3,6 +3,7 @@ export declare const DOCUMENT_INDENT_STEP_PX = 24;
3
3
  export declare const MAX_DOCUMENT_INDENT_LEVEL = 8;
4
4
  export declare const DOCUMENT_RULER_INDENT_STEP_PX = 6;
5
5
  export declare const MAX_DOCUMENT_INDENT_PX: number;
6
+ export declare const DOCUMENT_WORD_SINGLE_LINE_HEIGHT = 1.15;
6
7
  export interface DocumentParagraphIndent {
7
8
  left: number;
8
9
  right: number;
@@ -59,3 +60,6 @@ export declare function setDocumentParagraphSpacing(editor: Editor, spacing: Doc
59
60
  export declare function normalizeDocumentParagraphIndent(indent: DocumentParagraphIndent): DocumentParagraphIndent;
60
61
  export declare function normalizeDocumentParagraphDirection(value: unknown): DocumentParagraphDirection | null;
61
62
  export declare function clearDocumentFormatting(editor: Editor): boolean;
63
+ export declare function documentAutoLineHeight(value: unknown): number | null;
64
+ export declare function documentAutoLineLeadingShift(value: unknown): number | null;
65
+ export declare function renderDocumentAutoLineHeight(lineHeight: unknown, autoLineHeight?: unknown): Record<string, string>;
@@ -1,4 +1,4 @@
1
- import type { WorkDocumentContent, WorkDocumentSectionBreakType, WorkDocumentSectionLayout } from './work-types';
1
+ import type { WorkDocumentContent, WorkDocumentGridType, WorkDocumentSectionBreakType, WorkDocumentSectionLayout } from './work-types';
2
2
  export interface WorkDocumentSection {
3
3
  id: string;
4
4
  layout: WorkDocumentSectionLayout;
@@ -22,6 +22,8 @@ export interface DocumentSectionNodeAttributes {
22
22
  showPageNumbers: boolean;
23
23
  pageNumberStart: number | null;
24
24
  pageChrome: string;
25
+ documentGridType: WorkDocumentGridType | '';
26
+ documentGridLinePitch: number | null;
25
27
  }
26
28
  export declare function documentInitialSectionLayout(content: WorkDocumentContent): WorkDocumentSectionLayout;
27
29
  export declare function normalizeDocumentHtml(content: WorkDocumentContent): string;
@@ -0,0 +1,20 @@
1
+ import type { CommandProps } from '@tiptap/core';
2
+ export type DocumentTableBorderStyle = 'solid' | 'dashed' | 'dotted' | 'double' | 'none';
3
+ export type DocumentTableBorderEdge = 'top' | 'right' | 'bottom' | 'left';
4
+ export type DocumentTableBorderTarget = 'all' | 'outside' | 'inside' | 'top' | 'right' | 'bottom' | 'left' | 'insideHorizontal' | 'insideVertical';
5
+ export interface DocumentTableBorder {
6
+ color: string;
7
+ style: DocumentTableBorderStyle;
8
+ width: number;
9
+ }
10
+ export type DocumentTableCellBorders = Record<DocumentTableBorderEdge, DocumentTableBorder>;
11
+ export declare function uniformDocumentTableBorders(border: DocumentTableBorder): DocumentTableCellBorders;
12
+ export declare function documentTableBordersFromAttributes(attributes: Record<string, unknown>, fallback: DocumentTableBorder): DocumentTableCellBorders;
13
+ export declare function documentTableBordersFromElement(element: HTMLElement, fallback: DocumentTableBorder): DocumentTableCellBorders;
14
+ export declare function renderDocumentTableBorders(borders: DocumentTableCellBorders): Record<string, string>;
15
+ export declare function uniformDocumentTableBorder(borders: DocumentTableCellBorders): DocumentTableBorder | null;
16
+ export declare function normalizeDocumentTableBorder(value: unknown): DocumentTableBorder | null;
17
+ export declare function normalizeTableColor(value: string | null | undefined): string | null;
18
+ export declare function normalizeDocumentTableBorderStyle(value: string | null | undefined): DocumentTableBorderStyle | null;
19
+ export declare function normalizeDocumentTableBorderWidth(value: unknown): number | null;
20
+ export declare function setSelectedDocumentTableBorders({ dispatch, state }: CommandProps, target: DocumentTableBorderTarget, requestedBorder: DocumentTableBorder): boolean;
@@ -1,16 +1,21 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  import { type EditorState } from '@tiptap/pm/state';
3
+ import { type DocumentTableBorder, type DocumentTableBorderStyle, type DocumentTableBorderTarget, type DocumentTableCellBorders } from './work-document-table-borders';
4
+ import { type DocumentTableCellMarginOverrides } from './work-document-table-geometry';
5
+ export { documentTableBordersFromElement, normalizeDocumentTableBorder, normalizeDocumentTableBorderStyle, normalizeDocumentTableBorderWidth, normalizeTableColor, renderDocumentTableBorders, uniformDocumentTableBorder, uniformDocumentTableBorders, } from './work-document-table-borders';
6
+ export type { DocumentTableBorder, DocumentTableBorderEdge, DocumentTableBorderStyle, DocumentTableBorderTarget, DocumentTableCellBorders, } from './work-document-table-borders';
3
7
  export type DocumentTableVerticalAlign = 'top' | 'middle' | 'bottom';
4
8
  export type DocumentTableHorizontalAlign = 'left' | 'center' | 'right';
5
- export type DocumentTableBorderStyle = 'solid' | 'dashed' | 'dotted' | 'double' | 'none';
6
9
  export interface DocumentTableCellFormat {
7
10
  backgroundColor: string;
8
11
  verticalAlign: DocumentTableVerticalAlign;
9
12
  borderColor: string;
10
13
  borderStyle: DocumentTableBorderStyle;
11
14
  borderWidth: number;
15
+ borders: DocumentTableCellBorders;
16
+ margins: DocumentTableCellMarginOverrides | null;
12
17
  }
13
- export type DocumentTableCellFormatPatch = Partial<DocumentTableCellFormat>;
18
+ export type DocumentTableCellFormatPatch = Partial<Omit<DocumentTableCellFormat, 'borders'>>;
14
19
  export type DocumentTableStyleId = 'grid' | 'blueStripe' | 'greenStripe' | 'grayStripe' | 'clean';
15
20
  export interface DocumentTableStyleOption {
16
21
  id: DocumentTableStyleId;
@@ -31,6 +36,7 @@ declare module '@tiptap/core' {
31
36
  setDocumentTableCellFormat: (format: DocumentTableCellFormatPatch) => ReturnType;
32
37
  setDocumentTableHorizontalAlignment: (alignment: DocumentTableHorizontalAlign) => ReturnType;
33
38
  applyDocumentTableStyle: (style: DocumentTableStyleId) => ReturnType;
39
+ setDocumentTableBorders: (target: DocumentTableBorderTarget, border: DocumentTableBorder) => ReturnType;
34
40
  };
35
41
  }
36
42
  }
@@ -40,7 +46,4 @@ export declare const DocumentTableFormatting: Extension<any, any>;
40
46
  export declare function documentTableCellFormat(state: EditorState): DocumentTableCellFormat | null;
41
47
  export declare function documentTableHorizontalAlignment(state: EditorState): DocumentTableHorizontalAlign;
42
48
  export declare function activeDocumentTableStyle(state: EditorState): DocumentTableStyleId | null;
43
- export declare function normalizeTableColor(value: string | null | undefined): string | null;
44
49
  export declare function normalizeDocumentTableVerticalAlign(value: string | null | undefined): DocumentTableVerticalAlign | null;
45
- export declare function normalizeDocumentTableBorderStyle(value: string | null | undefined): DocumentTableBorderStyle | null;
46
- export declare function normalizeDocumentTableBorderWidth(value: unknown): number | null;
@@ -0,0 +1,41 @@
1
+ export type DocumentTableLayoutAlgorithm = 'autofit' | 'fixed';
2
+ export type DocumentTablePreferredWidthType = 'auto' | 'percent' | 'pixels';
3
+ export type DocumentTableAlignment = 'left' | 'center' | 'right';
4
+ export type DocumentTableLayoutMode = 'window' | 'contents' | 'fixed';
5
+ export type DocumentTableCellMarginSide = 'top' | 'right' | 'bottom' | 'left';
6
+ export interface DocumentTablePreferredWidth {
7
+ type: DocumentTablePreferredWidthType;
8
+ value: number | null;
9
+ }
10
+ export interface DocumentTableCellMargins {
11
+ top: number;
12
+ right: number;
13
+ bottom: number;
14
+ left: number;
15
+ }
16
+ export type DocumentTableCellMarginOverrides = Partial<DocumentTableCellMargins>;
17
+ export interface DocumentTableGeometry {
18
+ layout: DocumentTableLayoutAlgorithm;
19
+ width: DocumentTablePreferredWidth;
20
+ alignment: DocumentTableAlignment;
21
+ indent: number;
22
+ cellMargins: DocumentTableCellMargins;
23
+ }
24
+ export type DocumentTableProperties = Pick<DocumentTableGeometry, 'width' | 'alignment' | 'indent'>;
25
+ export declare const DEFAULT_DOCUMENT_TABLE_CELL_MARGINS: DocumentTableCellMargins;
26
+ export declare const DEFAULT_DOCUMENT_TABLE_GEOMETRY: DocumentTableGeometry;
27
+ export declare function normalizeDocumentTableGeometry(value: unknown, legacyLayoutMode?: unknown): DocumentTableGeometry;
28
+ export declare function normalizeDocumentTableLayoutMode(value: unknown): DocumentTableLayoutMode;
29
+ export declare function normalizeDocumentTableLayoutAlgorithm(value: unknown): DocumentTableLayoutAlgorithm | null;
30
+ export declare function normalizeDocumentTableAlignment(value: unknown): DocumentTableAlignment | null;
31
+ export declare function normalizeDocumentTableProperties(value: unknown): DocumentTableProperties | null;
32
+ export declare function normalizeDocumentTableCellMargins(value: unknown): DocumentTableCellMargins | null;
33
+ export declare function normalizeDocumentTableCellMarginOverrides(value: unknown): DocumentTableCellMarginOverrides | null;
34
+ export declare function documentTableLayoutMode(geometry: DocumentTableGeometry): DocumentTableLayoutMode;
35
+ export declare function documentTableGeometryForLayoutMode(mode: DocumentTableLayoutMode, current: DocumentTableGeometry, renderedTableWidth?: number): DocumentTableGeometry;
36
+ export declare function documentTableGeometryFromElement(table: HTMLElement): DocumentTableGeometry;
37
+ export declare function renderDocumentTableGeometry(value: unknown, legacyLayoutMode?: unknown): Record<string, string>;
38
+ export declare function applyDocumentTableGeometryToElement(table: HTMLElement, value: unknown, legacyLayoutMode?: unknown): void;
39
+ export declare function documentTableCellMarginOverridesFromElement(cell: HTMLElement): DocumentTableCellMarginOverrides | null;
40
+ export declare function renderDocumentTableCellMarginOverrides(value: unknown): Record<string, string>;
41
+ export declare function normalizeDocumentTablePreferredWidth(value: unknown): DocumentTablePreferredWidth | null;
@@ -0,0 +1,25 @@
1
+ import { type DocumentTableVerticalAlign } from './work-document-table-cell-formatting';
2
+ import { type DocumentTableCellMarginOverrides, type DocumentTableProperties } from './work-document-table-geometry';
3
+ import type { DocumentTableRowHeightRule } from './work-document-table-row';
4
+ export declare const MIN_DOCUMENT_TABLE_COLUMN_WIDTH = 25;
5
+ export declare const MIN_DOCUMENT_TABLE_ROW_HEIGHT = 12;
6
+ export declare const MAX_DOCUMENT_TABLE_DIMENSION = 4000;
7
+ export interface DocumentTablePropertyChanges {
8
+ table?: DocumentTableProperties;
9
+ row?: {
10
+ height: number | null;
11
+ heightRule: DocumentTableRowHeightRule;
12
+ cantSplit: boolean;
13
+ repeatHeader?: boolean;
14
+ };
15
+ column?: {
16
+ width: number;
17
+ renderedColumnWidths?: readonly number[];
18
+ };
19
+ cell?: {
20
+ verticalAlign: DocumentTableVerticalAlign;
21
+ margins: DocumentTableCellMarginOverrides | null;
22
+ };
23
+ }
24
+ export declare function normalizeDocumentTablePropertyChanges(value: unknown): DocumentTablePropertyChanges | null;
25
+ export declare function normalizeDocumentTableDimension(value: number, minimum: number): number | null;
@@ -1,12 +1,22 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  import { type EditorState } from '@tiptap/pm/state';
3
3
  import { type DocumentTableRowHeightRule } from './work-document-table-row';
4
- export type DocumentTableLayoutMode = 'window' | 'contents' | 'fixed';
4
+ import { type DocumentTableAlignment, type DocumentTableCellMargins, type DocumentTableLayoutAlgorithm, type DocumentTableLayoutMode, type DocumentTablePreferredWidthType, type DocumentTableProperties } from './work-document-table-geometry';
5
+ import { type DocumentTablePropertyChanges } from './work-document-table-property-changes';
6
+ export { normalizeDocumentTableGeometry, normalizeDocumentTableLayoutMode, } from './work-document-table-geometry';
7
+ export type { DocumentTableAlignment, DocumentTableCellMargins, DocumentTableGeometry, DocumentTableLayoutAlgorithm, DocumentTableLayoutMode, DocumentTablePreferredWidth, DocumentTablePreferredWidthType, DocumentTableProperties, } from './work-document-table-geometry';
8
+ export type { DocumentTablePropertyChanges } from './work-document-table-property-changes';
5
9
  export interface DocumentTableSizingState {
6
10
  columnWidth: number | null;
7
11
  rowHeight: number | null;
8
12
  rowHeightRule: DocumentTableRowHeightRule | null;
9
13
  layoutMode: DocumentTableLayoutMode;
14
+ layoutAlgorithm: DocumentTableLayoutAlgorithm;
15
+ preferredWidthType: DocumentTablePreferredWidthType;
16
+ preferredWidth: number | null;
17
+ alignment: DocumentTableAlignment;
18
+ indent: number;
19
+ cellMargins: DocumentTableCellMargins;
10
20
  selectedColumnCount: number;
11
21
  selectedRowCount: number;
12
22
  }
@@ -16,6 +26,10 @@ declare module '@tiptap/core' {
16
26
  setDocumentTableColumnWidth: (width: number, renderedColumnWidths?: readonly number[]) => ReturnType;
17
27
  setDocumentTableRowHeight: (height: number | null, rule?: DocumentTableRowHeightRule) => ReturnType;
18
28
  setDocumentTableLayoutMode: (mode: DocumentTableLayoutMode, renderedTableWidth?: number) => ReturnType;
29
+ setDocumentTableAlignment: (alignment: DocumentTableAlignment) => ReturnType;
30
+ setDocumentTableProperties: (properties: DocumentTableProperties) => ReturnType;
31
+ setDocumentTablePropertyChanges: (changes: DocumentTablePropertyChanges) => ReturnType;
32
+ setDocumentTableCellMargins: (margins: DocumentTableCellMargins) => ReturnType;
19
33
  distributeDocumentTableColumns: (renderedSelectionWidth?: number) => ReturnType;
20
34
  distributeDocumentTableRows: (renderedSelectionHeight?: number) => ReturnType;
21
35
  };
@@ -24,4 +38,3 @@ declare module '@tiptap/core' {
24
38
  export declare const DocumentTable: import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any>;
25
39
  export declare const DocumentTableSizing: Extension<any, any>;
26
40
  export declare function documentTableSizing(state: EditorState): DocumentTableSizingState | null;
27
- export declare function normalizeDocumentTableLayoutMode(value: unknown): DocumentTableLayoutMode;
@@ -0,0 +1,11 @@
1
+ export declare const DOCUMENT_WORD_DEFAULT_SINGLE_LINE_HEIGHT = 1.15;
2
+ declare module '@tiptap/extension-text-style' {
3
+ interface TextStyleAttributes {
4
+ wordLineHeightFactor?: number | null;
5
+ wordSnapToGrid?: boolean | null;
6
+ }
7
+ }
8
+ export declare function documentWordLineHeightFactor(fontFamily: unknown): number;
9
+ export declare function normalizedDocumentWordLineHeightFactor(value: unknown): number | null;
10
+ export declare const DocumentTextStyle: import("@tiptap/core").Mark<import("@tiptap/extension-text-style").TextStyleOptions, any>;
11
+ export declare const DocumentFontFamily: import("@tiptap/core").Extension<import("@tiptap/extension-text-style/font-family").FontFamilyOptions, any>;
@@ -0,0 +1,2 @@
1
+ import type { WorkDocumentSection } from './work-document-section';
2
+ export declare function patchDocxDocumentLayout(buffer: ArrayBuffer, sections: readonly WorkDocumentSection[]): Promise<ArrayBuffer>;