@a3s-lab/office 0.29.0 → 0.31.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.
Files changed (61) hide show
  1. package/README.md +117 -3
  2. package/dist/{0~7043.js → 0~4808.js} +347 -2
  3. package/dist/0~5050.js +10 -1
  4. package/dist/{0~5093.js → 0~7240.js} +465 -55
  5. package/dist/0~document-editor.js +1694 -187
  6. package/dist/0~spreadsheet-editor.js +183 -34
  7. package/dist/0~work-docx-export.js +507 -31
  8. package/dist/0~work-docx-import.js +41 -7
  9. package/dist/0~work-office-diagnostics.js +146 -5
  10. package/dist/1544.js +13 -1
  11. package/dist/4104.js +29 -6
  12. package/dist/4121.js +2340 -1
  13. package/dist/6282.js +1072 -1148
  14. package/dist/internal/features/work/editors/document-command-catalog.d.ts +45 -0
  15. package/dist/internal/features/work/editors/document-dom-selection.d.ts +7 -0
  16. package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -0
  17. package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +5 -2
  18. package/dist/internal/features/work/editors/document-font-dialog-run-shading-model.d.ts +23 -0
  19. package/dist/internal/features/work/editors/document-font-dialog-run-shading-section.d.ts +8 -0
  20. package/dist/internal/features/work/editors/document-index-dialog.d.ts +10 -0
  21. package/dist/internal/features/work/editors/document-index-entry-dialog.d.ts +10 -0
  22. package/dist/internal/features/work/editors/document-page-chrome-ribbon.d.ts +2 -1
  23. package/dist/internal/features/work/editors/document-proofing-dialog-model.d.ts +22 -0
  24. package/dist/internal/features/work/editors/document-proofing-dialog.d.ts +7 -0
  25. package/dist/internal/features/work/editors/document-references-ribbon.d.ts +19 -0
  26. package/dist/internal/features/work/editors/document-table-of-contents-dialog.d.ts +10 -0
  27. package/dist/internal/features/work/editors/document-toolbar.d.ts +6 -1
  28. package/dist/internal/features/work/editors/spreadsheet-data-validation.d.ts +7 -1
  29. package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +5 -0
  30. package/dist/internal/features/work/work-document-character-formatting.d.ts +8 -0
  31. package/dist/internal/features/work/work-document-format-changes.d.ts +6 -0
  32. package/dist/internal/features/work/work-document-highlight.d.ts +9 -0
  33. package/dist/internal/features/work/work-document-index-fields.d.ts +19 -0
  34. package/dist/internal/features/work/work-document-index-nodes.d.ts +32 -0
  35. package/dist/internal/features/work/work-document-index.d.ts +63 -0
  36. package/dist/internal/features/work/work-document-outline.d.ts +1 -0
  37. package/dist/internal/features/work/work-document-paragraph-shading.d.ts +6 -0
  38. package/dist/internal/features/work/work-document-proofing.d.ts +19 -0
  39. package/dist/internal/features/work/work-document-run-shading.d.ts +12 -0
  40. package/dist/internal/features/work/work-document-table-of-contents-node.d.ts +18 -0
  41. package/dist/internal/features/work/work-document-table-of-contents.d.ts +51 -0
  42. package/dist/internal/features/work/work-document-word-line-metrics.d.ts +3 -0
  43. package/dist/internal/features/work/work-docx-field-instructions.d.ts +1 -1
  44. package/dist/internal/features/work/work-docx-import.d.ts +5 -1
  45. package/dist/internal/features/work/work-docx-index-export.d.ts +14 -0
  46. package/dist/internal/features/work/work-docx-index-import.d.ts +23 -0
  47. package/dist/internal/features/work/work-docx-proofing-diagnostics.d.ts +3 -0
  48. package/dist/internal/features/work/work-docx-proofing.d.ts +38 -0
  49. package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +7 -0
  50. package/dist/internal/features/work/work-docx-run-shading-diagnostics.d.ts +3 -0
  51. package/dist/internal/features/work/work-docx-run-shading-export.d.ts +17 -0
  52. package/dist/internal/features/work/work-docx-run-shading.d.ts +20 -0
  53. package/dist/internal/features/work/work-docx-table-of-contents-export.d.ts +11 -0
  54. package/dist/internal/features/work/work-docx-table-of-contents-import.d.ts +15 -0
  55. package/dist/internal/features/work/work-spreadsheet-data-validation.d.ts +7 -0
  56. package/dist/internal/features/work/work-types.d.ts +9 -0
  57. package/dist/internal/kernel/office-kernel-protocol.d.ts +1 -0
  58. package/dist/office-kernel.wasm +0 -0
  59. package/dist/styles.css +607 -4
  60. package/docs/latest/en/browser-editor-architecture.md +64 -1
  61. package/package.json +15 -2
@@ -5,6 +5,8 @@ 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';
9
+ import { type ImportedDocxTableOfContentsMarkers } from './work-docx-table-of-contents-import';
8
10
  import { type ImportedDocxImageLayoutMarkers } from './work-docx-image-layout-import';
9
11
  import { type ImportedDocxListMarkers } from './work-docx-list-import';
10
12
  import { type ImportedDocxParagraphAlignmentMarkers } from './work-docx-paragraph-alignment-import';
@@ -36,6 +38,8 @@ export interface PreparedDocxImport {
36
38
  changeMarkers: ImportedDocxChangeMarkers;
37
39
  commentMarkers: ImportedDocxCommentMarkers;
38
40
  fieldMarkers: ImportedDocxFieldMarkers;
41
+ tableOfContentsMarkers: ImportedDocxTableOfContentsMarkers;
42
+ indexMarkers: ImportedDocxIndexMarkers;
39
43
  equationMarkers: ImportedDocxEquationMarkers;
40
44
  citationMarkers: ImportedDocxCitationMarkers;
41
45
  listMarkers: ImportedDocxListMarkers;
@@ -58,6 +62,6 @@ export interface PreparedDocxImport {
58
62
  trackChanges: boolean;
59
63
  }
60
64
  export declare function prepareDocxImport(buffer: ArrayBuffer, sourcePackage?: OoxmlPackage): Promise<PreparedDocxImport>;
61
- export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, 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;
62
66
  export declare function readDocxLayout(buffer: ArrayBuffer): Promise<ImportedDocumentLayout>;
63
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;
@@ -0,0 +1,3 @@
1
+ import { type OoxmlPackage } from './work-ooxml-package';
2
+ import type { WorkCompatibilityIssue } from './work-types';
3
+ export declare function diagnoseDocxProofing(archive: OoxmlPackage, document: Document): Promise<WorkCompatibilityIssue[]>;
@@ -0,0 +1,38 @@
1
+ import { type WorkDocumentProofingLanguages } from './work-document-proofing';
2
+ export interface DocxProofingLanguageOptions {
3
+ value?: string;
4
+ eastAsia?: string;
5
+ bidirectional?: string;
6
+ }
7
+ export type DocxProofingLanguagesInspection = {
8
+ status: 'absent';
9
+ spoofedCount: number;
10
+ } | {
11
+ status: 'invalid';
12
+ spoofedCount: number;
13
+ } | {
14
+ status: 'valid';
15
+ value: WorkDocumentProofingLanguages;
16
+ spoofedCount: number;
17
+ };
18
+ export type DocxNoProofInspection = {
19
+ status: 'absent';
20
+ spoofedCount: number;
21
+ } | {
22
+ status: 'invalid';
23
+ spoofedCount: number;
24
+ } | {
25
+ status: 'valid';
26
+ value: boolean;
27
+ spoofedCount: number;
28
+ };
29
+ export interface ResolvedDocxProofing {
30
+ languages: WorkDocumentProofingLanguages | undefined;
31
+ noProof: boolean | undefined;
32
+ invalidCount: number;
33
+ spoofedCount: number;
34
+ }
35
+ export declare function inspectDocxProofingLanguages(properties: Element | null | undefined): DocxProofingLanguagesInspection;
36
+ export declare function inspectDocxNoProof(properties: Element | null | undefined): DocxNoProofInspection;
37
+ export declare function resolveDocxProofing(propertySources: readonly Element[]): ResolvedDocxProofing;
38
+ export declare function documentProofingLanguageDocxOptions(source: unknown): DocxProofingLanguageOptions | undefined;
@@ -8,6 +8,9 @@ import { type WorkDocumentUnderlineFormatting } from './work-document-underline'
8
8
  import { type WorkDocumentStrikeFormatting } from './work-document-strike';
9
9
  import { type WorkDocumentScriptFontSlot, type WorkDocumentScriptFonts } from './work-document-script-fonts';
10
10
  import { type DocumentRunBorder } from './work-document-run-border';
11
+ import { type DocumentRunShading } from './work-document-run-shading';
12
+ import { type WorkDocumentHighlight } from './work-document-highlight';
13
+ import { type WorkDocumentProofingLanguages } from './work-document-proofing';
11
14
  export interface ImportedDocxRunFormatting {
12
15
  bold?: boolean;
13
16
  italic?: boolean;
@@ -33,10 +36,14 @@ export interface ImportedDocxRunFormatting {
33
36
  fontSize?: number;
34
37
  color?: string;
35
38
  backgroundColor?: string;
39
+ highlight?: WorkDocumentHighlight;
36
40
  themeColor?: DocxThemeColorReference;
37
41
  themeFill?: DocxThemeColorReference;
38
42
  textCase?: WorkDocumentTextCase;
39
43
  runBorder?: DocumentRunBorder;
44
+ runShading?: DocumentRunShading;
45
+ proofingLanguages?: WorkDocumentProofingLanguages;
46
+ noProof?: boolean;
40
47
  }
41
48
  export interface ImportedDocxRunFormattingMarker {
42
49
  startMarker: string;
@@ -0,0 +1,3 @@
1
+ import { type OoxmlPackage } from './work-ooxml-package';
2
+ import type { WorkCompatibilityIssue } from './work-types';
3
+ export declare function diagnoseDocxRunShading(archive: OoxmlPackage, document: Document): Promise<WorkCompatibilityIssue[]>;
@@ -0,0 +1,17 @@
1
+ import type { IRunOptions } from 'docx';
2
+ import { type DocumentRunShading } from './work-document-run-shading';
3
+ export interface DocxRunShadingPatch {
4
+ marker: string;
5
+ shading: DocumentRunShading;
6
+ }
7
+ export declare class DocxRunShadingPatchCollector {
8
+ readonly patches: DocxRunShadingPatch[];
9
+ private nextMarker;
10
+ private readonly usedColors;
11
+ constructor(sourceHtml: string);
12
+ marker(source: unknown): string | null;
13
+ hasMarker(value: string | null | undefined): value is string;
14
+ }
15
+ export declare function documentRunShadingDocxOptions(source: unknown, collector: DocxRunShadingPatchCollector): Pick<IRunOptions, 'shading'>;
16
+ export declare function patchDocxRunShading(buffer: ArrayBuffer, patches: readonly DocxRunShadingPatch[]): Promise<ArrayBuffer>;
17
+ export declare function setDocxRunShadingAttributes(document: Document, element: Element, source: unknown): boolean;
@@ -0,0 +1,20 @@
1
+ import type { DocumentRunShading } from './work-document-run-shading';
2
+ import { type DocxThemeSource } from './work-docx-theme';
3
+ export type DocxRunShadingInspection = {
4
+ status: 'absent';
5
+ spoofedCount: number;
6
+ } | {
7
+ status: 'invalid';
8
+ spoofedCount: number;
9
+ } | {
10
+ status: 'valid';
11
+ value: DocumentRunShading;
12
+ spoofedCount: number;
13
+ };
14
+ export interface ResolvedDocxRunShading {
15
+ shading: DocumentRunShading | undefined;
16
+ invalidCount: number;
17
+ spoofedCount: number;
18
+ }
19
+ export declare function inspectDocxRunShading(properties: Element | null | undefined, themeSource?: DocxThemeSource): DocxRunShadingInspection;
20
+ export declare function resolveDocxRunShading(propertySources: readonly Element[], themeSource?: DocxThemeSource): ResolvedDocxRunShading;
@@ -0,0 +1,11 @@
1
+ import { type WorkDocumentTableOfContentsEntry, type WorkDocumentTableOfContentsOptions } from './work-document-table-of-contents';
2
+ export interface DocxTableOfContentsPatch {
3
+ options: WorkDocumentTableOfContentsOptions;
4
+ entries: WorkDocumentTableOfContentsEntry[];
5
+ }
6
+ export declare class DocxTableOfContentsPatchCollector {
7
+ readonly patches: DocxTableOfContentsPatch[];
8
+ add(element: HTMLElement): DocxTableOfContentsPatch;
9
+ }
10
+ export declare function docxTableOfContents(element: HTMLElement, docx: typeof import('docx'), collector: DocxTableOfContentsPatchCollector): InstanceType<typeof docx.TableOfContents>;
11
+ export declare function patchDocxTableOfContents(buffer: ArrayBuffer, patches: readonly DocxTableOfContentsPatch[]): Promise<ArrayBuffer>;
@@ -0,0 +1,15 @@
1
+ import { type WorkDocumentTableOfContentsEntry, type WorkDocumentTableOfContentsOptions } from './work-document-table-of-contents';
2
+ import { type DocxFieldOccurrence } from './work-docx-field-instructions';
3
+ export interface ImportedDocxTableOfContentsMarkers {
4
+ tables: ImportedDocxTableOfContentsMarker[];
5
+ }
6
+ export interface ImportedDocxTableOfContentsMarker {
7
+ marker: string;
8
+ id: string;
9
+ options: WorkDocumentTableOfContentsOptions;
10
+ entries: WorkDocumentTableOfContentsEntry[];
11
+ }
12
+ export declare function markDocxTablesOfContents(document: Document): ImportedDocxTableOfContentsMarkers;
13
+ export declare function applyImportedDocxTableOfContentsMarkers(document: Document, markers: ImportedDocxTableOfContentsMarkers): void;
14
+ export declare function hasImportedDocxTableOfContentsMarkers(markers: ImportedDocxTableOfContentsMarkers): boolean;
15
+ export declare function supportedDocxTableOfContentsField(field: DocxFieldOccurrence): boolean;
@@ -1,2 +1,9 @@
1
+ import type { WorkSpreadsheetDataValidationErrorStyle } from './work-types';
2
+ export declare const SPREADSHEET_DATA_VALIDATION_TITLE_LIMIT = 32;
3
+ export declare const SPREADSHEET_DATA_VALIDATION_HINT_LIMIT = 255;
4
+ export declare const SPREADSHEET_DATA_VALIDATION_ERROR_LIMIT = 225;
5
+ export declare const SPREADSHEET_DATA_VALIDATION_ERROR_STYLES: readonly ["stop", "warning", "information"];
6
+ export declare function normalizeSpreadsheetDataValidationErrorStyle(value: unknown): WorkSpreadsheetDataValidationErrorStyle;
7
+ export declare function boundedSpreadsheetDataValidationText(value: unknown, limit: number): string;
1
8
  export declare function normalizeSpreadsheetDateValidationBoundary(value: string, uses1904DateSystem?: boolean): string | null;
2
9
  export declare function spreadsheetDateValidationFormula(value: string): string;
@@ -196,6 +196,7 @@ export interface WorkSpreadsheetCellRange {
196
196
  row: [number, number];
197
197
  column: [number, number];
198
198
  }
199
+ export type WorkSpreadsheetDataValidationErrorStyle = 'information' | 'stop' | 'warning';
199
200
  export interface WorkSpreadsheetDataValidationItem {
200
201
  type: string;
201
202
  type2: string;
@@ -204,8 +205,16 @@ export interface WorkSpreadsheetDataValidationItem {
204
205
  value2: string;
205
206
  validity: string;
206
207
  remote: boolean;
208
+ /** Defaults to true for legacy A3S artifacts. */
209
+ allowBlank?: boolean;
210
+ /** Product semantic; OOXML stores the inverse in `showDropDown`. */
211
+ showDropdownArrow?: boolean;
207
212
  prohibitInput: boolean;
213
+ errorStyle?: WorkSpreadsheetDataValidationErrorStyle;
214
+ errorTitle?: string;
215
+ errorMessage?: string;
208
216
  hintShow: boolean;
217
+ hintTitle?: string;
209
218
  hintValue: string;
210
219
  checked?: boolean;
211
220
  }
@@ -140,6 +140,7 @@ export interface OfficeKernelTextLayoutRun {
140
140
  fallbackFontIds?: string[];
141
141
  fontSize: number;
142
142
  lineHeight: number;
143
+ language?: string;
143
144
  letterSpacing?: number;
144
145
  ligatures?: boolean;
145
146
  kerning?: boolean;
Binary file