@a3s-lab/office 0.26.0 → 0.27.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 (81) hide show
  1. package/README.md +75 -2
  2. package/dist/0~4595.js +16 -2
  3. package/dist/0~5093.js +463 -201
  4. package/dist/0~6090.js +77 -77
  5. package/dist/{0~2805.js → 0~7043.js} +305 -2
  6. package/dist/0~document-editor.js +2451 -985
  7. package/dist/0~spreadsheet-editor.js +1324 -378
  8. package/dist/0~work-docx-export.js +492 -10
  9. package/dist/0~work-docx-import.js +171 -98
  10. package/dist/0~work-office-diagnostics.js +198 -4
  11. package/dist/{164.js → 1544.js} +1083 -785
  12. package/dist/4104.js +145 -29
  13. package/dist/6282.js +1774 -384
  14. package/dist/core.js +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/internal/features/work/editors/document-command-catalog.d.ts +102 -0
  17. package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +83 -0
  18. package/dist/internal/features/work/editors/document-font-dialog-script-font-model.d.ts +18 -0
  19. package/dist/internal/features/work/editors/document-font-dialog.d.ts +9 -0
  20. package/dist/internal/features/work/editors/document-home-ribbon.d.ts +2 -1
  21. package/dist/internal/features/work/editors/document-page-chrome-editor.d.ts +6 -0
  22. package/dist/internal/features/work/editors/document-page-chrome-ribbon.d.ts +2 -1
  23. package/dist/internal/features/work/editors/document-strike-ribbon.d.ts +7 -0
  24. package/dist/internal/features/work/editors/document-text-case-ribbon.d.ts +4 -0
  25. package/dist/internal/features/work/editors/document-toolbar.d.ts +3 -1
  26. package/dist/internal/features/work/editors/document-underline-ribbon.d.ts +9 -0
  27. package/dist/internal/features/work/editors/document-wps-shortcuts.d.ts +1 -0
  28. package/dist/internal/features/work/editors/spreadsheet-cell-fill-format.d.ts +11 -0
  29. package/dist/internal/features/work/editors/spreadsheet-cell-format.d.ts +2 -1
  30. package/dist/internal/features/work/editors/spreadsheet-format-cells-dialog-model.d.ts +13 -2
  31. package/dist/internal/features/work/editors/spreadsheet-format-cells-fill-panel.d.ts +13 -0
  32. package/dist/internal/features/work/editors/spreadsheet-format-cells-fill-preview.d.ts +6 -0
  33. package/dist/internal/features/work/editors/spreadsheet-format-painter.d.ts +1 -1
  34. package/dist/internal/features/work/editors/work-office-chrome.d.ts +9 -1
  35. package/dist/internal/features/work/work-document-character-formatting.d.ts +16 -1
  36. package/dist/internal/features/work/work-document-character-position.d.ts +9 -0
  37. package/dist/internal/features/work/work-document-character-scale.d.ts +8 -0
  38. package/dist/internal/features/work/work-document-character-spacing.d.ts +8 -0
  39. package/dist/internal/features/work/work-document-emphasis.d.ts +7 -0
  40. package/dist/internal/features/work/work-document-equations.d.ts +2 -1
  41. package/dist/internal/features/work/work-document-format-changes.d.ts +16 -2
  42. package/dist/internal/features/work/work-document-hidden-text.d.ts +5 -0
  43. package/dist/internal/features/work/work-document-kerning.d.ts +10 -0
  44. package/dist/internal/features/work/work-document-script-font-extension.d.ts +2 -0
  45. package/dist/internal/features/work/work-document-script-fonts.d.ts +51 -0
  46. package/dist/internal/features/work/work-document-strike.d.ts +21 -0
  47. package/dist/internal/features/work/work-document-text-case.d.ts +10 -0
  48. package/dist/internal/features/work/work-document-underline.d.ts +37 -0
  49. package/dist/internal/features/work/work-document-word-line-metrics.d.ts +12 -0
  50. package/dist/internal/features/work/work-docx-character-position.d.ts +2 -0
  51. package/dist/internal/features/work/work-docx-character-scale.d.ts +2 -0
  52. package/dist/internal/features/work/work-docx-character-spacing.d.ts +4 -0
  53. package/dist/internal/features/work/work-docx-emphasis-diagnostics.d.ts +3 -0
  54. package/dist/internal/features/work/work-docx-emphasis.d.ts +14 -0
  55. package/dist/internal/features/work/work-docx-hidden-text-diagnostics.d.ts +3 -0
  56. package/dist/internal/features/work/work-docx-hidden-text-export.d.ts +16 -0
  57. package/dist/internal/features/work/work-docx-hidden-text.d.ts +11 -0
  58. package/dist/internal/features/work/work-docx-kerning-diagnostics.d.ts +3 -0
  59. package/dist/internal/features/work/work-docx-kerning.d.ts +14 -0
  60. package/dist/internal/features/work/work-docx-run-fonts-diagnostics.d.ts +3 -0
  61. package/dist/internal/features/work/work-docx-run-fonts-export.d.ts +14 -0
  62. package/dist/internal/features/work/work-docx-run-fonts.d.ts +13 -0
  63. package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +23 -2
  64. package/dist/internal/features/work/work-docx-run-script-font-import.d.ts +9 -0
  65. package/dist/internal/features/work/work-docx-strike.d.ts +8 -0
  66. package/dist/internal/features/work/work-docx-theme-reference.d.ts +1 -1
  67. package/dist/internal/features/work/work-docx-twips.d.ts +6 -0
  68. package/dist/internal/features/work/work-docx-underline.d.ts +3 -0
  69. package/dist/internal/features/work/work-spreadsheet-gradient-fill-canvas.d.ts +10 -0
  70. package/dist/internal/features/work/work-spreadsheet-native-fill-canvas.d.ts +8 -0
  71. package/dist/internal/features/work/work-spreadsheet-pattern-fill-canvas.d.ts +8 -0
  72. package/dist/internal/features/work/work-xlsx-cell-style-origin.d.ts +2 -1
  73. package/dist/internal/features/work/work-xlsx-cell-style-writer.d.ts +3 -0
  74. package/dist/internal/features/work/work-xlsx-cell-styles.d.ts +4 -0
  75. package/dist/internal/features/work/work-xlsx-gradient-fill.d.ts +31 -0
  76. package/dist/internal/features/work/work-xlsx-native-fill.d.ts +17 -0
  77. package/dist/internal/features/work/work-xlsx-pattern-fill.d.ts +21 -0
  78. package/dist/office-kernel.wasm +0 -0
  79. package/dist/styles.css +770 -80
  80. package/docs/latest/en/browser-editor-architecture.md +10 -0
  81. package/package.json +32 -1
@@ -1,5 +1,10 @@
1
1
  import type { Mark, Schema } from '@tiptap/pm/model';
2
2
  import type { Transaction } from '@tiptap/pm/state';
3
+ import { type WorkDocumentEmphasisMark } from './work-document-emphasis';
4
+ import { type WorkDocumentTextCase } from './work-document-text-case';
5
+ import { type WorkDocumentUnderlineFormatting } from './work-document-underline';
6
+ import { type WorkDocumentStrikeFormatting } from './work-document-strike';
7
+ import { type WorkDocumentScriptFontSlot, type WorkDocumentScriptFonts } from './work-document-script-fonts';
3
8
  export declare const DOCUMENT_CHARACTER_FORMAT_MARKS: readonly ["bold", "italic", "underline", "strike", "subscript", "superscript", "textStyle", "highlight"];
4
9
  export type DocumentCharacterFormatMarkName = (typeof DOCUMENT_CHARACTER_FORMAT_MARKS)[number];
5
10
  export interface DocumentCharacterFormatMark {
@@ -13,11 +18,19 @@ export declare function restoreDocumentCharacterFormatting(transaction: Transact
13
18
  export declare function importedDocumentCharacterFormatting(formatting: {
14
19
  bold?: boolean;
15
20
  italic?: boolean;
16
- underline?: boolean;
17
- strike?: boolean;
21
+ underline?: WorkDocumentUnderlineFormatting;
22
+ strike?: WorkDocumentStrikeFormatting;
18
23
  subscript?: boolean;
19
24
  superscript?: boolean;
20
25
  fontFamily?: string;
26
+ scriptFonts?: WorkDocumentScriptFonts;
27
+ scriptFontSlot?: WorkDocumentScriptFontSlot;
28
+ characterScalePercent?: number;
29
+ characterPositionHalfPoints?: number;
30
+ characterSpacingTwips?: number;
31
+ kerningThresholdHalfPoints?: number;
32
+ emphasisMark?: WorkDocumentEmphasisMark;
33
+ hiddenText?: boolean;
21
34
  wordLineHeightFactor?: number;
22
35
  wordSnapToGrid?: boolean;
23
36
  fontSize?: number;
@@ -25,4 +38,5 @@ export declare function importedDocumentCharacterFormatting(formatting: {
25
38
  backgroundColor?: string;
26
39
  themeColor?: string;
27
40
  themeFill?: string;
41
+ textCase?: WorkDocumentTextCase;
28
42
  }): string;
@@ -0,0 +1,5 @@
1
+ export declare const DOCUMENT_HIDDEN_TEXT_ATTRIBUTE = "data-office-hidden-text";
2
+ export declare const documentHiddenTextKeyboardShortcut = "Mod-Shift-h";
3
+ export declare function normalizeDocumentHiddenText(value: unknown): boolean | null;
4
+ export declare function documentHiddenTextFromElement(element: HTMLElement): boolean | null;
5
+ export declare function documentHiddenTextDomAttributes(value: unknown): Record<string, string>;
@@ -0,0 +1,10 @@
1
+ export declare const DOCUMENT_KERNING_THRESHOLD_ATTRIBUTE = "data-office-kerning-threshold-half-points";
2
+ export declare const DOCUMENT_KERNING_THRESHOLD_MIN_HALF_POINTS = 0;
3
+ export declare const DOCUMENT_KERNING_THRESHOLD_MAX_HALF_POINTS = 3277;
4
+ export declare const DOCUMENT_KERNING_DEFAULT_THRESHOLD_HALF_POINTS = 24;
5
+ export declare function normalizeDocumentKerningThresholdHalfPoints(value: unknown): number | null;
6
+ export declare function documentKerningThresholdPoints(value: unknown): number | null;
7
+ export declare function documentKerningIsEffective(thresholdValue: unknown, fontSizeValue: unknown): boolean;
8
+ export declare function documentKerningDomAttributes(thresholdValue: unknown, fontSizeValue?: unknown): Record<string, string>;
9
+ export declare function documentKerningThresholdHalfPointsFromElement(element: HTMLElement): number | null;
10
+ export declare function documentKerningFontSizePoints(value: unknown): number;
@@ -0,0 +1,2 @@
1
+ import { Extension } from '@tiptap/core';
2
+ export declare const DocumentScriptFontFormatting: Extension<any, any>;
@@ -0,0 +1,51 @@
1
+ export type WorkDocumentScriptFontSlot = 'ascii' | 'highAnsi' | 'eastAsia' | 'complexScript';
2
+ export type WorkDocumentScriptFontHint = 'default' | 'eastAsia' | 'cs';
3
+ export type WorkDocumentThemeFont = 'majorEastAsia' | 'majorBidi' | 'majorAscii' | 'majorHAnsi' | 'minorEastAsia' | 'minorBidi' | 'minorAscii' | 'minorHAnsi';
4
+ export interface WorkDocumentScriptFontFace {
5
+ /** Exact direct w:rFonts value, when present. */
6
+ name?: string;
7
+ /** Exact theme reference, when present. */
8
+ theme?: WorkDocumentThemeFont;
9
+ /** Browser-resolved family retained independently from source identity. */
10
+ resolved?: string;
11
+ }
12
+ export interface WorkDocumentScriptFonts {
13
+ ascii?: WorkDocumentScriptFontFace;
14
+ highAnsi?: WorkDocumentScriptFontFace;
15
+ eastAsia?: WorkDocumentScriptFontFace;
16
+ complexScript?: WorkDocumentScriptFontFace;
17
+ hint?: WorkDocumentScriptFontHint;
18
+ }
19
+ export interface WorkDocumentScriptFontSegment {
20
+ from: number;
21
+ to: number;
22
+ slot: WorkDocumentScriptFontSlot;
23
+ }
24
+ export interface WorkDocumentScriptFontPatch {
25
+ latin?: string | null;
26
+ eastAsia?: string | null;
27
+ complexScript?: string | null;
28
+ }
29
+ export declare const DOCUMENT_SCRIPT_FONTS_ATTRIBUTE = "data-office-script-fonts";
30
+ export declare const DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE = "data-office-script-font-slot";
31
+ export declare function normalizeDocumentScriptFonts(source: unknown): WorkDocumentScriptFonts | null;
32
+ export declare function serializeDocumentScriptFonts(source: unknown): string | null;
33
+ export declare function parseDocumentScriptFonts(source: string | null | undefined): WorkDocumentScriptFonts | null;
34
+ export declare function documentScriptFontsFromElement(element: HTMLElement): WorkDocumentScriptFonts | null;
35
+ export declare function documentScriptFontSlotFromElement(element: HTMLElement): WorkDocumentScriptFontSlot | null;
36
+ export declare function documentScriptFontsDomAttributes(source: unknown, slot: unknown): Record<string, string>;
37
+ export declare function documentScriptFontFamily(source: unknown, slot: WorkDocumentScriptFontSlot): string | undefined;
38
+ export declare function documentScriptFontFallbackSlots(slot: WorkDocumentScriptFontSlot): readonly WorkDocumentScriptFontSlot[];
39
+ export declare function documentScriptFontFamilyForRendering(source: unknown, slot: WorkDocumentScriptFontSlot, currentFontFamily?: unknown): string | undefined;
40
+ export declare function documentScriptFontDirectFamily(source: unknown, slot: WorkDocumentScriptFontSlot): string | null;
41
+ export declare function documentScriptFontsForAllText(fontFamily: unknown): WorkDocumentScriptFonts | null;
42
+ export declare function patchDocumentScriptFonts(source: unknown, patch: WorkDocumentScriptFontPatch, fallbackFontFamily?: unknown): WorkDocumentScriptFonts | null;
43
+ export declare function documentScriptFontSegments(text: string, hint?: WorkDocumentScriptFontHint, forceComplexScript?: boolean): WorkDocumentScriptFontSegment[];
44
+ export declare function normalizeDocumentScriptFontSlot(value: unknown): WorkDocumentScriptFontSlot | null;
45
+ export declare function normalizeDocumentScriptFontHint(value: unknown): WorkDocumentScriptFontHint | null;
46
+ export declare function normalizeDocumentThemeFont(value: unknown): WorkDocumentThemeFont | null;
47
+ export declare function documentScriptFontSlotFromHint(hint: WorkDocumentScriptFontHint | undefined): WorkDocumentScriptFontSlot;
48
+ export declare function documentFontNameFromCssFamily(value: unknown): string | null;
49
+ export declare function cssDocumentFontFamily(value: unknown): string | null;
50
+ export declare function normalizeDocumentFontName(value: unknown): string | null;
51
+ export declare const scriptFontSlots: readonly ["ascii", "highAnsi", "eastAsia", "complexScript"];
@@ -0,0 +1,21 @@
1
+ import { type Editor } from '@tiptap/core';
2
+ export declare const workDocumentStrikeStyles: readonly ["none", "single", "double"];
3
+ export type WorkDocumentStrikeStyle = (typeof workDocumentStrikeStyles)[number];
4
+ export interface WorkDocumentStrikeFormatting {
5
+ style: WorkDocumentStrikeStyle;
6
+ }
7
+ export declare const DOCUMENT_STRIKE_STYLE_ATTRIBUTE = "data-office-strike-style";
8
+ declare module '@tiptap/core' {
9
+ interface Commands<ReturnType> {
10
+ documentStrike: {
11
+ setDocumentStrike: (style: WorkDocumentStrikeStyle) => ReturnType;
12
+ toggleDocumentStrikeStyle: (style: Exclude<WorkDocumentStrikeStyle, 'none'>) => ReturnType;
13
+ };
14
+ }
15
+ }
16
+ export declare const DocumentStrike: import("@tiptap/core").Mark<import("@tiptap/extension-strike").StrikeOptions, any>;
17
+ export declare function normalizeDocumentStrikeStyle(value: unknown): WorkDocumentStrikeStyle | null;
18
+ export declare function documentStrikeStyle(editor: Editor): WorkDocumentStrikeStyle;
19
+ export declare function documentStrikeFormatting(editor: Editor): WorkDocumentStrikeFormatting | null;
20
+ export declare function documentStrikeFormattingFromElement(element: HTMLElement): WorkDocumentStrikeFormatting | null;
21
+ export declare function documentStrikeDomAttributes(formatting: WorkDocumentStrikeFormatting): Record<string, string>;
@@ -0,0 +1,10 @@
1
+ export type WorkDocumentTextCase = 'none' | 'all-caps' | 'small-caps';
2
+ export declare const DOCUMENT_TEXT_CASE_ATTRIBUTE = "data-office-text-case";
3
+ export declare const documentTextCaseKeyboardShortcuts: {
4
+ readonly allCaps: "Mod-Shift-a";
5
+ readonly smallCaps: "Mod-Shift-k";
6
+ };
7
+ export declare function normalizeDocumentTextCase(value: unknown): WorkDocumentTextCase | null;
8
+ export declare function documentTextCaseFromWordFlags(allCaps: boolean | undefined, smallCaps: boolean | undefined): WorkDocumentTextCase | null;
9
+ export declare function applyDocumentTextCaseStyle(element: HTMLElement, textCase: WorkDocumentTextCase): void;
10
+ export declare function documentTextCaseCss(textCase: WorkDocumentTextCase): string;
@@ -0,0 +1,37 @@
1
+ import { type Editor } from '@tiptap/core';
2
+ import { type DocxThemeColorReference } from './work-docx-theme-reference';
3
+ export declare const workDocumentUnderlineStyles: readonly ["none", "single", "words", "double", "thick", "dotted", "dottedHeavy", "dash", "dashedHeavy", "dashLong", "dashLongHeavy", "dotDash", "dashDotHeavy", "dotDotDash", "dashDotDotHeavy", "wave", "wavyHeavy", "wavyDouble"];
4
+ export type WorkDocumentUnderlineStyle = (typeof workDocumentUnderlineStyles)[number];
5
+ export interface WorkDocumentUnderlineFormatting {
6
+ style: WorkDocumentUnderlineStyle;
7
+ color?: string;
8
+ themeColor?: DocxThemeColorReference;
9
+ }
10
+ export interface WorkDocumentUnderlineCommandOptions {
11
+ color?: string | null;
12
+ themeColor?: DocxThemeColorReference | string | null;
13
+ }
14
+ export declare const DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE = "data-office-underline-style";
15
+ export declare const DOCUMENT_UNDERLINE_COLOR_ATTRIBUTE = "data-office-underline-color";
16
+ export declare const DOCUMENT_UNDERLINE_THEME_COLOR_ATTRIBUTE = "data-office-underline-theme-color";
17
+ export declare const documentUnderlineKeyboardShortcuts: {
18
+ readonly double: "Mod-Shift-d";
19
+ readonly words: "Mod-Shift-w";
20
+ };
21
+ declare module '@tiptap/core' {
22
+ interface Commands<ReturnType> {
23
+ documentUnderline: {
24
+ setDocumentUnderline: (style: WorkDocumentUnderlineStyle, options?: WorkDocumentUnderlineCommandOptions) => ReturnType;
25
+ setDocumentUnderlineColor: (color: string | null, themeColor?: DocxThemeColorReference | string | null) => ReturnType;
26
+ toggleDocumentUnderlineStyle: (style: Exclude<WorkDocumentUnderlineStyle, 'none'>) => ReturnType;
27
+ };
28
+ }
29
+ }
30
+ export declare const DocumentUnderline: import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any>;
31
+ export declare function normalizeDocumentUnderlineStyle(value: unknown): WorkDocumentUnderlineStyle | null;
32
+ export declare function normalizeDocumentUnderlineColor(value: unknown): string | null;
33
+ export declare function documentUnderlineStyle(editor: Editor): WorkDocumentUnderlineStyle;
34
+ export declare function documentUnderlineColor(editor: Editor): string | null;
35
+ export declare function documentUnderlineFormatting(editor: Editor): WorkDocumentUnderlineFormatting | null;
36
+ export declare function documentUnderlineFormattingFromElement(element: HTMLElement): WorkDocumentUnderlineFormatting | null;
37
+ export declare function documentUnderlineDomAttributes(formatting: WorkDocumentUnderlineFormatting): Record<string, string>;
@@ -1,9 +1,21 @@
1
+ import { type WorkDocumentEmphasisMark } from './work-document-emphasis';
2
+ import { type WorkDocumentTextCase } from './work-document-text-case';
3
+ import { type WorkDocumentScriptFontSlot } from './work-document-script-fonts';
1
4
  export declare const DOCUMENT_WORD_DEFAULT_SINGLE_LINE_HEIGHT = 1.15;
2
5
  declare module '@tiptap/extension-text-style' {
3
6
  interface TextStyleAttributes {
7
+ characterScalePercent?: number | null;
8
+ characterPositionHalfPoints?: number | null;
9
+ characterSpacingTwips?: number | null;
10
+ emphasisMark?: WorkDocumentEmphasisMark | null;
11
+ hiddenText?: boolean | null;
12
+ kerningThresholdHalfPoints?: number | null;
13
+ scriptFonts?: string | null;
14
+ scriptFontSlot?: WorkDocumentScriptFontSlot | null;
4
15
  wordLineHeightFactor?: number | null;
5
16
  wordSnapToGrid?: boolean | null;
6
17
  themeColor?: string | null;
18
+ textCase?: WorkDocumentTextCase | null;
7
19
  }
8
20
  }
9
21
  export declare function documentWordLineHeightFactor(fontFamily: unknown): number;
@@ -0,0 +1,2 @@
1
+ export declare function docxCharacterPositionValue(value: unknown): string | undefined;
2
+ export declare function docxCharacterPositionHalfPointsFromProperties(properties: Element | null | undefined): number | undefined;
@@ -0,0 +1,2 @@
1
+ export declare function docxCharacterScaleValue(value: unknown): number | undefined;
2
+ export declare function docxCharacterScalePercentFromProperties(properties: Element | null | undefined): number | undefined;
@@ -0,0 +1,4 @@
1
+ export declare const DOCX_EXPLICIT_ZERO_CHARACTER_SPACING_SENTINEL: number;
2
+ export declare function docxCharacterSpacingValue(value: unknown): number | undefined;
3
+ export declare function docxCharacterSpacingTwipsFromProperties(properties: Element | null | undefined): number | undefined;
4
+ export declare function patchDocxExplicitZeroCharacterSpacing(buffer: ArrayBuffer): Promise<ArrayBuffer>;
@@ -0,0 +1,3 @@
1
+ import { type OoxmlPackage } from './work-ooxml-package';
2
+ import type { WorkCompatibilityIssue } from './work-types';
3
+ export declare function diagnoseDocxEmphasisMarks(archive: OoxmlPackage, document: Document): Promise<WorkCompatibilityIssue[]>;
@@ -0,0 +1,14 @@
1
+ import type { IRunOptions } from 'docx';
2
+ import { type WorkDocumentEmphasisMark } from './work-document-emphasis';
3
+ export type DocxEmphasisMarkInspection = {
4
+ status: 'absent';
5
+ } | {
6
+ status: 'invalid';
7
+ } | {
8
+ status: 'valid';
9
+ value: WorkDocumentEmphasisMark;
10
+ };
11
+ export declare function docxEmphasisMarkFromProperties(properties: Element | null | undefined): WorkDocumentEmphasisMark | undefined;
12
+ export declare function resolveDocxEmphasisMark(propertySources: readonly Element[]): WorkDocumentEmphasisMark | undefined;
13
+ export declare function inspectDocxEmphasisMark(properties: Element | null | undefined): DocxEmphasisMarkInspection;
14
+ export declare function docxEmphasisMarkRunOptions(value: unknown): IRunOptions['emphasisMark'] | undefined;
@@ -0,0 +1,3 @@
1
+ import { type OoxmlPackage } from './work-ooxml-package';
2
+ import type { WorkCompatibilityIssue } from './work-types';
3
+ export declare function diagnoseDocxHiddenText(archive: OoxmlPackage, document: Document): Promise<WorkCompatibilityIssue[]>;
@@ -0,0 +1,16 @@
1
+ export interface DocxHiddenTextPatch {
2
+ marker: string;
3
+ style?: string;
4
+ value: boolean;
5
+ }
6
+ export declare class DocxHiddenTextPatchCollector {
7
+ readonly patches: DocxHiddenTextPatch[];
8
+ private nextMarker;
9
+ private readonly occupied;
10
+ private readonly patchesByMarker;
11
+ private readonly markersByValueAndStyle;
12
+ constructor(source: string);
13
+ marker(value: boolean, inheritedStyle?: string): string;
14
+ private originalStyle;
15
+ }
16
+ export declare function patchDocxHiddenText(buffer: ArrayBuffer, patches: readonly DocxHiddenTextPatch[]): Promise<ArrayBuffer>;
@@ -0,0 +1,11 @@
1
+ export type DocxHiddenTextInspection = {
2
+ status: 'absent';
3
+ } | {
4
+ status: 'invalid';
5
+ } | {
6
+ status: 'valid';
7
+ value: boolean;
8
+ };
9
+ export declare function inspectDocxHiddenText(properties: Element | null | undefined): DocxHiddenTextInspection;
10
+ export declare function docxHiddenTextFromProperties(properties: Element | null | undefined): boolean | undefined;
11
+ export declare function resolveDocxHiddenText(propertySources: readonly Element[]): boolean | undefined;
@@ -0,0 +1,3 @@
1
+ import { type OoxmlPackage } from './work-ooxml-package';
2
+ import type { WorkCompatibilityIssue } from './work-types';
3
+ export declare function diagnoseDocxKerning(archive: OoxmlPackage, document: Document): Promise<WorkCompatibilityIssue[]>;
@@ -0,0 +1,14 @@
1
+ export declare const DOCX_EXPLICIT_ZERO_KERNING_THRESHOLD_SENTINEL: number;
2
+ export type DocxKerningThresholdInspection = {
3
+ status: 'absent';
4
+ } | {
5
+ status: 'invalid';
6
+ } | {
7
+ status: 'valid';
8
+ value: number;
9
+ };
10
+ export declare function docxKerningThresholdValue(value: unknown): number | undefined;
11
+ export declare function docxKerningThresholdHalfPointsFromProperties(properties: Element | null | undefined): number | undefined;
12
+ export declare function resolveDocxKerningThresholdHalfPoints(propertySources: readonly Element[]): number | undefined;
13
+ export declare function inspectDocxKerningThresholdHalfPoints(properties: Element | null | undefined): DocxKerningThresholdInspection;
14
+ export declare function patchDocxExplicitZeroKerningThresholds(buffer: ArrayBuffer): Promise<ArrayBuffer>;
@@ -0,0 +1,3 @@
1
+ import { type OoxmlPackage } from './work-ooxml-package';
2
+ import type { WorkCompatibilityIssue } from './work-types';
3
+ export declare function diagnoseDocxRunFonts(archive: OoxmlPackage, document: Document): Promise<WorkCompatibilityIssue[]>;
@@ -0,0 +1,14 @@
1
+ import { type WorkDocumentScriptFonts } from './work-document-script-fonts';
2
+ export interface DocxRunFontsPatch {
3
+ marker: string;
4
+ fonts: WorkDocumentScriptFonts;
5
+ }
6
+ export declare class DocxRunFontsPatchCollector {
7
+ readonly patches: DocxRunFontsPatch[];
8
+ private nextMarker;
9
+ private readonly occupied;
10
+ private readonly markersByFonts;
11
+ constructor(source: string);
12
+ marker(source: unknown, slot: unknown, currentFontFamily: string): string | null;
13
+ }
14
+ export declare function patchDocxRunFonts(buffer: ArrayBuffer, patches: readonly DocxRunFontsPatch[]): Promise<ArrayBuffer>;
@@ -0,0 +1,13 @@
1
+ import { type WorkDocumentScriptFonts } from './work-document-script-fonts';
2
+ import { type DocxThemeResolver } from './work-docx-theme';
3
+ export type InspectedDocxRunFonts = {
4
+ status: 'absent';
5
+ } | {
6
+ status: 'invalid';
7
+ } | {
8
+ status: 'valid';
9
+ value: WorkDocumentScriptFonts | null;
10
+ };
11
+ export declare function inspectDocxRunFonts(properties: Element | null | undefined, theme?: DocxThemeResolver): InspectedDocxRunFonts;
12
+ export declare function resolveDocxRunFonts(propertySources: readonly Element[], theme: DocxThemeResolver): WorkDocumentScriptFonts | null;
13
+ export declare function parseDocxRunFontsElement(element: Element | undefined, theme?: DocxThemeResolver): WorkDocumentScriptFonts | null | undefined;
@@ -1,15 +1,28 @@
1
1
  import { type DocxParagraphStyleSource } from './work-docx-paragraph-styles';
2
2
  import { type DocxThemeSource } from './work-docx-theme';
3
3
  import { type DocxTableStyleSource } from './work-docx-table-styles';
4
+ import { type WorkDocumentEmphasisMark } from './work-document-emphasis';
4
5
  import { type DocxThemeColorReference } from './work-docx-theme-reference';
6
+ import { type WorkDocumentTextCase } from './work-document-text-case';
7
+ import { type WorkDocumentUnderlineFormatting } from './work-document-underline';
8
+ import { type WorkDocumentStrikeFormatting } from './work-document-strike';
9
+ import { type WorkDocumentScriptFontSlot, type WorkDocumentScriptFonts } from './work-document-script-fonts';
5
10
  export interface ImportedDocxRunFormatting {
6
11
  bold?: boolean;
7
12
  italic?: boolean;
8
- underline?: boolean;
9
- strike?: boolean;
13
+ underline?: WorkDocumentUnderlineFormatting;
14
+ strike?: WorkDocumentStrikeFormatting;
10
15
  subscript?: boolean;
11
16
  superscript?: boolean;
17
+ characterScalePercent?: number;
18
+ characterPositionHalfPoints?: number;
19
+ characterSpacingTwips?: number;
20
+ kerningThresholdHalfPoints?: number;
21
+ emphasisMark?: WorkDocumentEmphasisMark;
22
+ hiddenText?: boolean;
12
23
  fontFamily?: string;
24
+ scriptFonts?: WorkDocumentScriptFonts;
25
+ scriptFontSlot?: WorkDocumentScriptFontSlot;
13
26
  wordLineHeightFactor?: number;
14
27
  wordSnapToGrid?: boolean;
15
28
  fontSize?: number;
@@ -17,6 +30,7 @@ export interface ImportedDocxRunFormatting {
17
30
  backgroundColor?: string;
18
31
  themeColor?: DocxThemeColorReference;
19
32
  themeFill?: DocxThemeColorReference;
33
+ textCase?: WorkDocumentTextCase;
20
34
  }
21
35
  export interface ImportedDocxRunFormattingMarker {
22
36
  startMarker: string;
@@ -33,7 +47,14 @@ export interface ImportedDocxRunFormattingChange {
33
47
  export interface ImportedDocxRunFormattingMarkers {
34
48
  runs: ImportedDocxRunFormattingMarker[];
35
49
  }
50
+ export interface ImportedDocxRunFormattingMarkerState {
51
+ markers: ImportedDocxRunFormattingMarkers;
52
+ nextMarker: number;
53
+ occupiedText: string;
54
+ }
36
55
  export declare function markDocxRunFormatting(document: Document, styleSource?: DocxParagraphStyleSource, themeSource?: DocxThemeSource, tableStyleSource?: DocxTableStyleSource): ImportedDocxRunFormattingMarkers;
56
+ export declare function createImportedDocxRunFormattingMarkerState(documents: readonly Document[]): ImportedDocxRunFormattingMarkerState;
57
+ export declare function markDocxRunFormattingIntoState(document: Document, state: ImportedDocxRunFormattingMarkerState, styleSource?: DocxParagraphStyleSource, themeSource?: DocxThemeSource, tableStyleSource?: DocxTableStyleSource): void;
37
58
  export declare function applyImportedDocxRunFormattingMarkers(document: Document, markers: ImportedDocxRunFormattingMarkers): void;
38
59
  export declare function hasImportedDocxRunFormattingMarkers(markers: ImportedDocxRunFormattingMarkers): boolean;
39
60
  export declare function isSupportedDocxRunFormattingChange(change: Element): boolean;
@@ -0,0 +1,9 @@
1
+ import type { ImportedDocxRunFormatting, ImportedDocxRunFormattingChange, ImportedDocxRunFormattingMarkerState } from './work-docx-run-formatting-import';
2
+ import type { WorkDocumentScriptFontSegment, WorkDocumentScriptFontSlot } from './work-document-script-fonts';
3
+ interface DocxRunFormattingMarkers {
4
+ endMarker: string;
5
+ startMarker: string;
6
+ }
7
+ export declare function directDocxRunText(run: Element): string;
8
+ export declare function markSegmentedDocxRunFormatting(run: Element, state: ImportedDocxRunFormattingMarkerState, segments: readonly WorkDocumentScriptFontSegment[], formattingFor: (text: string, slot: WorkDocumentScriptFontSlot) => ImportedDocxRunFormatting, changeFor: (text: string, slot: WorkDocumentScriptFontSlot) => ImportedDocxRunFormattingChange | undefined, createMarkers: () => DocxRunFormattingMarkers): void;
9
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { WorkDocumentStrikeFormatting } from './work-document-strike';
2
+ export interface ImportedDocxStrikeFlags {
3
+ double?: boolean;
4
+ single?: boolean;
5
+ }
6
+ export declare function importedDocxStrikeFlags(properties: Element): ImportedDocxStrikeFlags;
7
+ export declare function importedDocxStrike(properties: Element): WorkDocumentStrikeFormatting | undefined;
8
+ export declare function resolvedDocxStrikeFormatting(single: boolean | undefined, double: boolean | undefined, materializeNone?: boolean): WorkDocumentStrikeFormatting | undefined;
@@ -4,7 +4,7 @@ export interface DocxThemeColorReference {
4
4
  tint?: string;
5
5
  shade?: string;
6
6
  }
7
- type DocxThemePatchKind = 'color' | 'fill' | 'border' | 'shadingColor';
7
+ type DocxThemePatchKind = 'color' | 'fill' | 'border' | 'shadingColor' | 'underline';
8
8
  interface DocxThemePatch {
9
9
  kind: DocxThemePatchKind;
10
10
  marker: string;
@@ -5,6 +5,12 @@ export declare function parseDocxTwipsMeasure(source: string, options: {
5
5
  signed: boolean;
6
6
  strict: boolean;
7
7
  }): number | null;
8
+ export declare function parseDocxHalfPointsMeasure(source: string, options: {
9
+ minimum: number;
10
+ maximum: number;
11
+ signed: boolean;
12
+ strict: boolean;
13
+ }): number | null;
8
14
  export declare function parseBoundedDocxInteger(source: string, options: {
9
15
  minimum: number;
10
16
  maximum: number;
@@ -0,0 +1,3 @@
1
+ import { type WorkDocumentUnderlineFormatting } from './work-document-underline';
2
+ import { type DocxThemeResolver } from './work-docx-theme';
3
+ export declare function importedDocxUnderline(element: Element, theme?: DocxThemeResolver): WorkDocumentUnderlineFormatting;
@@ -0,0 +1,10 @@
1
+ import type { XlsxGradientFill } from './work-xlsx-gradient-fill';
2
+ export interface SpreadsheetGradientFillBounds {
3
+ endX: number;
4
+ endY: number;
5
+ startX: number;
6
+ startY: number;
7
+ }
8
+ type SpreadsheetGradientFillRect = CanvasRenderingContext2D['fillRect'];
9
+ export declare function drawSpreadsheetGradientFill(context: CanvasRenderingContext2D, bounds: SpreadsheetGradientFillBounds, fill: XlsxGradientFill, fillRect?: SpreadsheetGradientFillRect): void;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { XlsxNativeFill } from './work-xlsx-native-fill';
2
+ /**
3
+ * Fortune Sheet paints a cell background immediately after beforeRenderCell.
4
+ * Intercepting only that first viewport paint keeps native fills behind text
5
+ * and avoids any fill work for cells outside the visible Canvas.
6
+ */
7
+ export declare function beginSpreadsheetNativeFillRender(fill: XlsxNativeFill | undefined, context: CanvasRenderingContext2D): void;
8
+ export declare function finishSpreadsheetNativeFillRender(context: CanvasRenderingContext2D): void;
@@ -0,0 +1,8 @@
1
+ import type { XlsxPatternFill } from './work-xlsx-pattern-fill';
2
+ export interface SpreadsheetPatternFillBounds {
3
+ endX: number;
4
+ endY: number;
5
+ startX: number;
6
+ startY: number;
7
+ }
8
+ export declare function drawSpreadsheetPatternFillOverlay(context: CanvasRenderingContext2D, bounds: SpreadsheetPatternFillBounds, fill: XlsxPatternFill): void;
@@ -41,5 +41,6 @@ export declare function xlsxColorElementMatchesOrigin(element: Element | undefin
41
41
  export declare function applyXlsxSemanticColorOrigin(element: Element, origin: XlsxSemanticColorOrigin): void;
42
42
  export declare function xlsxSemanticColorOriginKey(origin: XlsxSemanticColorOrigin | undefined): string;
43
43
  export declare function xlsxSemanticColorOriginSupported(origin: XlsxSemanticColorOrigin, palette: XlsxSemanticPalette | undefined): boolean;
44
- export declare function prepareXlsxSemanticPalette(styles: Document, theme: Document | null, origins: Iterable<XlsxCellStyleOrigin>): PreparedXlsxSemanticPalette;
44
+ export declare function prepareXlsxSemanticPalette(styles: Document, theme: Document | null, colors: Iterable<XlsxSemanticColorOrigin>): PreparedXlsxSemanticPalette;
45
+ export declare function xlsxCellStyleOriginSemanticColors(origin: XlsxCellStyleOrigin): XlsxSemanticColorOrigin[];
45
46
  export declare function normalizeXlsxSemanticColorOrigin(value: unknown): XlsxSemanticColorOrigin | undefined;
@@ -18,6 +18,9 @@ export declare class XlsxDirectCellStyleWriter {
18
18
  styleId(baseStyleId: number, cell: Cell, border?: XlsxCellBorder): number;
19
19
  private fontId;
20
20
  private fillId;
21
+ private gradientFillId;
22
+ private exportGradientFill;
23
+ private fillColorElement;
21
24
  private borderId;
22
25
  private updateCounts;
23
26
  }
@@ -2,11 +2,15 @@ import type { Cell, Sheet } from '@fortune-sheet/core';
2
2
  import { type XlsxCellBorder } from './work-xlsx-cell-borders';
3
3
  import { type XlsxDirectCellStyleWriter } from './work-xlsx-cell-style-writer';
4
4
  import { type XlsxCellStyleOrigin } from './work-xlsx-cell-style-origin';
5
+ import { type XlsxGradientFill } from './work-xlsx-gradient-fill';
6
+ import { type XlsxPatternFill } from './work-xlsx-pattern-fill';
5
7
  export { XlsxDirectCellStyleWriter } from './work-xlsx-cell-style-writer';
6
8
  export interface XlsxDirectCellStyle {
7
9
  border?: XlsxCellBorder;
8
10
  column: number;
11
+ gradientFill?: XlsxGradientFill;
9
12
  origin?: XlsxCellStyleOrigin;
13
+ patternFill?: XlsxPatternFill;
10
14
  row: number;
11
15
  style: Partial<Cell>;
12
16
  }
@@ -0,0 +1,31 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import { type XlsxSemanticColorOrigin } from './work-xlsx-cell-style-origin';
3
+ import { type XlsxColorResolver } from './work-xlsx-colors';
4
+ export declare const XLSX_GRADIENT_FILL_CELL_KEY: "a3sXlsxGradientFill";
5
+ export declare const MAX_XLSX_GRADIENT_STOPS = 256;
6
+ export interface XlsxGradientStop {
7
+ color: string;
8
+ colorOrigin?: XlsxSemanticColorOrigin;
9
+ position: number;
10
+ }
11
+ export type XlsxGradientFill = {
12
+ degree: number;
13
+ stops: XlsxGradientStop[];
14
+ type: 'linear';
15
+ } | {
16
+ bottom: number;
17
+ left: number;
18
+ right: number;
19
+ stops: XlsxGradientStop[];
20
+ top: number;
21
+ type: 'path';
22
+ };
23
+ export declare function readXlsxGradientFill(element: Element | undefined, colors: XlsxColorResolver): XlsxGradientFill | undefined;
24
+ export declare function withXlsxGradientFill(cell: Cell, fill: XlsxGradientFill | undefined): Cell;
25
+ export declare function deleteXlsxGradientFill(cell: Cell): void;
26
+ export declare function xlsxGradientFill(cell: Cell | null | undefined): XlsxGradientFill | undefined;
27
+ export declare function activeXlsxGradientFill(cell: Cell | null | undefined): XlsxGradientFill | undefined;
28
+ export declare function normalizeXlsxGradientFill(value: unknown): XlsxGradientFill | undefined;
29
+ export declare function xlsxGradientFillFallbackColor(fill: XlsxGradientFill): string;
30
+ export declare function xlsxGradientFillSemanticColors(fill: XlsxGradientFill | undefined): XlsxSemanticColorOrigin[];
31
+ export declare function xlsxGradientFillKey(fill: XlsxGradientFill | undefined): string;
@@ -0,0 +1,17 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import { type XlsxGradientFill } from './work-xlsx-gradient-fill';
3
+ import { type XlsxPatternFill } from './work-xlsx-pattern-fill';
4
+ import type { XlsxSemanticColorOrigin } from './work-xlsx-cell-style-origin';
5
+ export declare const xlsxNativeFillCellKeys: readonly ["a3sXlsxPatternFill", "a3sXlsxGradientFill"];
6
+ export type XlsxNativeFillCellKey = (typeof xlsxNativeFillCellKeys)[number];
7
+ export type XlsxNativeFill = {
8
+ kind: 'gradient';
9
+ value: XlsxGradientFill;
10
+ } | {
11
+ kind: 'pattern';
12
+ value: XlsxPatternFill;
13
+ };
14
+ export declare function activeXlsxNativeFill(cell: Cell | null | undefined): XlsxNativeFill | undefined;
15
+ export declare function deleteXlsxNativeFills(cell: Cell): void;
16
+ export declare function xlsxNativeFillSemanticColors(fill: XlsxNativeFill | undefined): XlsxSemanticColorOrigin[];
17
+ export declare function xlsxNativeFillKey(fill: XlsxNativeFill | undefined): string;
@@ -0,0 +1,21 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import { type XlsxSemanticColorOrigin } from './work-xlsx-cell-style-origin';
3
+ import { type XlsxColorResolver } from './work-xlsx-colors';
4
+ export declare const XLSX_PATTERN_FILL_CELL_KEY: "a3sXlsxPatternFill";
5
+ export declare const xlsxPatternFillTypes: readonly ["darkDown", "darkGray", "darkGrid", "darkHorizontal", "darkTrellis", "darkUp", "darkVertical", "gray0625", "gray125", "lightDown", "lightGray", "lightGrid", "lightHorizontal", "lightTrellis", "lightUp", "lightVertical", "mediumGray"];
6
+ export type XlsxPatternFillType = (typeof xlsxPatternFillTypes)[number];
7
+ export interface XlsxPatternFill {
8
+ backgroundColor: string;
9
+ backgroundColorOrigin?: XlsxSemanticColorOrigin;
10
+ foregroundColor: string;
11
+ foregroundColorOrigin?: XlsxSemanticColorOrigin;
12
+ patternType: XlsxPatternFillType;
13
+ }
14
+ export declare function readXlsxPatternFill(pattern: Element | undefined, colors: XlsxColorResolver): XlsxPatternFill | undefined;
15
+ export declare function withXlsxPatternFill(cell: Cell, fill: XlsxPatternFill | undefined): Cell;
16
+ export declare function deleteXlsxPatternFill(cell: Cell): void;
17
+ export declare function xlsxPatternFill(cell: Cell | null | undefined): XlsxPatternFill | undefined;
18
+ export declare function activeXlsxPatternFill(cell: Cell | null | undefined): XlsxPatternFill | undefined;
19
+ export declare function normalizeXlsxPatternFill(value: unknown): XlsxPatternFill | undefined;
20
+ export declare function xlsxPatternFillSemanticColors(fill: XlsxPatternFill | undefined): XlsxSemanticColorOrigin[];
21
+ export declare function xlsxPatternFillKey(fill: XlsxPatternFill | undefined): string;
Binary file