@a3s-lab/office 0.11.0 → 0.13.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 (122) hide show
  1. package/README.md +121 -6
  2. package/dist/0~1403.js +20 -12
  3. package/dist/0~2805.js +241 -241
  4. package/dist/0~4980.js +1 -1
  5. package/dist/0~5050.js +1 -20
  6. package/dist/0~5093.js +547 -547
  7. package/dist/0~7048.js +31 -29
  8. package/dist/0~document-editor.js +694 -90
  9. package/dist/0~pdf-viewer.js +41 -10
  10. package/dist/0~presentation-editor.js +8 -6
  11. package/dist/0~spreadsheet-editor.js +4272 -2753
  12. package/dist/0~work-document-import-worker-client.js +237 -0
  13. package/dist/0~work-docx-export.js +1 -1
  14. package/dist/0~work-docx-import.js +3 -3
  15. package/dist/0~work-docx-large-document-import.js +559 -0
  16. package/dist/0~work-office-diagnostics.js +51 -35
  17. package/dist/0~work-pptx-import.js +2 -2
  18. package/dist/4104.js +4127 -3037
  19. package/dist/432.js +51 -7
  20. package/dist/4476.js +280 -69
  21. package/dist/5184.js +24 -2
  22. package/dist/{8928.js → 6282.js} +2338 -93
  23. package/dist/8715.js +1201 -1156
  24. package/dist/9356.js +128 -8
  25. package/dist/core.d.ts +1 -0
  26. package/dist/core.js +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -9
  29. package/dist/internal/features/work/editors/document-external-content.d.ts +1 -1
  30. package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +3 -1
  31. package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +3 -2
  32. package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +2 -1
  33. package/dist/internal/features/work/editors/presentation-workspace.d.ts +2 -1
  34. package/dist/internal/features/work/editors/spreadsheet-border-ribbon.d.ts +5 -0
  35. package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +10 -0
  36. package/dist/internal/features/work/editors/spreadsheet-cell-border-command.d.ts +3 -0
  37. package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +14 -0
  38. package/dist/internal/features/work/editors/spreadsheet-cell-fill-command.d.ts +3 -0
  39. package/dist/internal/features/work/editors/spreadsheet-cell-fill.d.ts +12 -0
  40. package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +14 -0
  41. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +159 -0
  42. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +8 -4
  43. package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +8 -1
  44. package/dist/internal/features/work/editors/spreadsheet-home-format-ribbon.d.ts +10 -0
  45. package/dist/internal/features/work/editors/spreadsheet-in-place-workbook-sync.d.ts +10 -0
  46. package/dist/internal/features/work/editors/spreadsheet-operation-projection.d.ts +14 -0
  47. package/dist/internal/features/work/editors/spreadsheet-structure-selection.d.ts +7 -0
  48. package/dist/internal/features/work/editors/use-document-pagination.d.ts +5 -0
  49. package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +2 -1
  50. package/dist/internal/features/work/editors/use-spreadsheet-collaboration.d.ts +2 -1
  51. package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +2 -1
  52. package/dist/internal/features/work/spreadsheet-history-value.d.ts +1 -0
  53. package/dist/internal/features/work/spreadsheet-sparse.d.ts +10 -0
  54. package/dist/internal/features/work/work-document-chunk-geometry.d.ts +28 -0
  55. package/dist/internal/features/work/work-document-chunk-node.d.ts +23 -0
  56. package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
  57. package/dist/internal/features/work/work-document-file-io.d.ts +2 -1
  58. package/dist/internal/features/work/work-document-html-fingerprint.d.ts +15 -0
  59. package/dist/internal/features/work/work-document-import-worker-client.d.ts +13 -0
  60. package/dist/internal/features/work/work-document-import-worker-protocol.d.ts +36 -0
  61. package/dist/internal/features/work/work-document-import.worker.d.ts +1 -0
  62. package/dist/internal/features/work/work-document-incremental-layout.d.ts +1 -1
  63. package/dist/internal/features/work/work-document-integrity-index.d.ts +14 -0
  64. package/dist/internal/features/work/work-document-lazy-block.d.ts +3 -0
  65. package/dist/internal/features/work/work-document-lazy-html.d.ts +21 -0
  66. package/dist/internal/features/work/work-document-lazy-model.d.ts +29 -0
  67. package/dist/internal/features/work/work-document-lazy-pagination-measurement.d.ts +3 -0
  68. package/dist/internal/features/work/work-document-lazy-preview.d.ts +21 -0
  69. package/dist/internal/features/work/work-document-lazy-update.d.ts +14 -0
  70. package/dist/internal/features/work/work-document-model.d.ts +18 -2
  71. package/dist/internal/features/work/work-document-page-surface-registry.d.ts +16 -0
  72. package/dist/internal/features/work/work-document-pagination-dom.d.ts +1 -0
  73. package/dist/internal/features/work/work-document-pagination-types.d.ts +1 -0
  74. package/dist/internal/features/work/work-document-pagination.d.ts +1 -1
  75. package/dist/internal/features/work/work-document-text-statistics.d.ts +25 -0
  76. package/dist/internal/features/work/work-document-windowing.d.ts +23 -0
  77. package/dist/internal/features/work/work-docx-import.d.ts +2 -1
  78. package/dist/internal/features/work/work-docx-large-document-import.d.ts +35 -0
  79. package/dist/internal/features/work/work-docx-large-document-parser.d.ts +29 -0
  80. package/dist/internal/features/work/work-file-data.d.ts +7 -1
  81. package/dist/internal/features/work/work-file-import.d.ts +33 -0
  82. package/dist/internal/features/work/work-file-io.d.ts +5 -4
  83. package/dist/internal/features/work/work-file-kind.d.ts +5 -0
  84. package/dist/internal/features/work/work-markdown-file-io.d.ts +2 -1
  85. package/dist/internal/features/work/work-office-diagnostics.d.ts +12 -2
  86. package/dist/internal/features/work/work-ooxml-package.d.ts +8 -0
  87. package/dist/internal/features/work/work-pptx-import.d.ts +1 -1
  88. package/dist/internal/features/work/work-presentation-file-io.d.ts +2 -1
  89. package/dist/internal/features/work/work-presentation-layouts.d.ts +7 -1
  90. package/dist/internal/features/work/work-repository.d.ts +1 -0
  91. package/dist/internal/features/work/work-spreadsheet-compatibility-summary.d.ts +10 -0
  92. package/dist/internal/features/work/work-spreadsheet-file-export.d.ts +2 -0
  93. package/dist/internal/features/work/work-spreadsheet-file-import.d.ts +3 -0
  94. package/dist/internal/features/work/work-spreadsheet-import-diagnostics.d.ts +2 -0
  95. package/dist/internal/features/work/work-spreadsheet-import-worker-client.d.ts +6 -0
  96. package/dist/internal/features/work/work-spreadsheet-import-worker-protocol.d.ts +32 -0
  97. package/dist/internal/features/work/work-spreadsheet-import.worker.d.ts +1 -0
  98. package/dist/internal/features/work/work-spreadsheet-matrix-profile.d.ts +64 -0
  99. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-client.d.ts +6 -0
  100. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-protocol.d.ts +49 -0
  101. package/dist/internal/features/work/work-spreadsheet-package-scan.worker.d.ts +1 -0
  102. package/dist/internal/features/work/work-spreadsheet-protection.d.ts +2 -0
  103. package/dist/internal/features/work/work-types.d.ts +22 -0
  104. package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -1
  105. package/dist/internal/features/work/work-xlsx-formulas.d.ts +2 -1
  106. package/dist/internal/features/work/work-xlsx-interop.d.ts +8 -17
  107. package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +2 -1
  108. package/dist/internal/features/work/work-xlsx-plain-fast-path.d.ts +54 -0
  109. package/dist/internal/features/work/work-xlsx-style-gate.d.ts +1 -0
  110. package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +12 -0
  111. package/dist/internal/features/work/work-xlsx-worksheet.d.ts +12 -0
  112. package/dist/office-kernel.wasm +0 -0
  113. package/dist/office-kernel.worker.js +31 -29
  114. package/dist/react.d.ts +7 -1
  115. package/dist/styles.css +440 -3
  116. package/dist/work-document-import.worker.js +558 -0
  117. package/dist/work-spreadsheet-import.worker.js +24745 -0
  118. package/dist/work-spreadsheet-import.worker.js.LICENSE.txt +3 -0
  119. package/dist/work-spreadsheet-package-scan.worker.js +4157 -0
  120. package/dist/work-spreadsheet-package-scan.worker.js.LICENSE.txt +11 -0
  121. package/docs/latest/en/browser-editor-architecture.md +351 -15
  122. package/package.json +26 -4
@@ -1,3 +1,4 @@
1
+ import type { WorkFileImportContext } from './work-file-import';
1
2
  import type { WorkArtifact } from './work-types';
2
- export declare function importWorkMarkdownFile(file: File): Promise<WorkArtifact>;
3
+ export declare function importWorkMarkdownFile(file: File, context?: WorkFileImportContext): Promise<WorkArtifact>;
3
4
  export declare function createWorkMarkdownBlob(artifact: WorkArtifact): Blob;
@@ -1,9 +1,19 @@
1
1
  import type { WorkBook } from 'xlsx';
2
+ import { OoxmlPackage } from './work-ooxml-package';
3
+ import { type SpreadsheetWorksheetCompatibilitySummary } from './work-spreadsheet-compatibility-summary';
2
4
  import type { WorkCompatibilityReport } from './work-types';
5
+ import type { XlsxFormulaFeatures } from './work-xlsx-formulas';
6
+ import type { XlsxPivotReadResult } from './work-xlsx-pivots';
7
+ import type { XlsxWorksheetXmlScan } from './work-xlsx-worksheet-scan';
3
8
  interface ConversionMessage {
4
9
  type: string;
5
10
  message: string;
6
11
  }
7
- export declare function analyzeDocxCompatibility(file: File, messages: ConversionMessage[]): Promise<WorkCompatibilityReport>;
8
- export declare function analyzeSpreadsheetCompatibility(file: File, extension: string, workbook: WorkBook): Promise<WorkCompatibilityReport | null>;
12
+ export interface SpreadsheetCompatibilityImportMetadata {
13
+ formulaFeatures?: XlsxFormulaFeatures | null;
14
+ pivotFeatures?: XlsxPivotReadResult | null;
15
+ worksheetScans?: Readonly<Record<string, XlsxWorksheetXmlScan>>;
16
+ }
17
+ export declare function analyzeDocxCompatibility(file: File, messages: ConversionMessage[], sourcePackage?: OoxmlPackage | null): Promise<WorkCompatibilityReport>;
18
+ export declare function analyzeSpreadsheetCompatibility(file: File, extension: string, workbook: WorkBook, sourcePackage?: OoxmlPackage | null, worksheetSummaries?: ReadonlyMap<string, SpreadsheetWorksheetCompatibilitySummary>, importedMetadata?: SpreadsheetCompatibilityImportMetadata): Promise<WorkCompatibilityReport | null>;
9
19
  export {};
@@ -6,6 +6,7 @@ export interface OoxmlRelationship {
6
6
  }
7
7
  export declare class OoxmlPackage {
8
8
  private readonly zip;
9
+ private readonly textCache;
9
10
  private constructor();
10
11
  static load(buffer: ArrayBuffer): Promise<OoxmlPackage>;
11
12
  has(partPath: string): boolean;
@@ -16,6 +17,13 @@ export declare class OoxmlPackage {
16
17
  relationships(sourcePart: string): Promise<Map<string, OoxmlRelationship>>;
17
18
  }
18
19
  export declare function parseXml(source: string, label?: string): Document;
20
+ /**
21
+ * Checks raw XML for selected element names before paying the cost of a full
22
+ * DOM tree. False positives are safe because they only select the slower
23
+ * parser path; the tag boundary prevents cell values and longer tag names
24
+ * from selecting it accidentally.
25
+ */
26
+ export declare function xmlContainsAnyElement(source: string, localNames: readonly string[]): boolean;
19
27
  export declare function attribute(element: Element, name: string): string | null;
20
28
  export declare function xmlNamespacePrefix(element: Element, namespace: string | null): string | null;
21
29
  export declare function directChildren(parent: ParentNode, localName?: string): Element[];
@@ -3,4 +3,4 @@ export interface PptxImportResult {
3
3
  content: WorkPresentationContent;
4
4
  compatibility: WorkCompatibilityReport;
5
5
  }
6
- export declare function importPptxPresentation(file: File): Promise<PptxImportResult>;
6
+ export declare function importPptxPresentation(file: File, sourceBytes?: ArrayBuffer): Promise<PptxImportResult>;
@@ -1,3 +1,4 @@
1
+ import type { WorkFileImportContext } from './work-file-import';
1
2
  import type { WorkArtifact } from './work-types';
2
3
  type PptxConstructor = typeof import('pptxgenjs').default;
3
4
  declare global {
@@ -9,7 +10,7 @@ export interface WorkPresentationExportOptions {
9
10
  pptxRuntimeUrl?: string;
10
11
  }
11
12
  export declare const defaultPptxRuntimeUrl: string;
12
- export declare function importWorkPresentationFile(file: File): Promise<WorkArtifact>;
13
+ export declare function importWorkPresentationFile(file: File, context?: WorkFileImportContext): Promise<WorkArtifact>;
13
14
  export declare function exportWorkPresentationArtifact(artifact: WorkArtifact, options?: WorkPresentationExportOptions): Promise<void>;
14
15
  export declare function createWorkPresentationBlob(artifact: WorkArtifact, options?: WorkPresentationExportOptions): Promise<Blob>;
15
16
  export {};
@@ -8,6 +8,12 @@ export interface WorkPresentationSlideView {
8
8
  master?: WorkPresentationMaster;
9
9
  layout?: WorkPresentationLayout;
10
10
  }
11
- export declare function withPresentationDesign(content: WorkPresentationContent): WorkPresentationContent;
11
+ export type WorkPresentationDesignContent = WorkPresentationContent & {
12
+ layouts: WorkPresentationLayout[];
13
+ masters: WorkPresentationMaster[];
14
+ };
15
+ export declare function withPresentationDesign(content: WorkPresentationContent): WorkPresentationDesignContent;
16
+ export declare function withPresentationDesignMetadata(content: WorkPresentationContent): WorkPresentationDesignContent;
12
17
  export declare function presentationSlideView(content: WorkPresentationContent, slide: WorkSlide): WorkPresentationSlideView;
18
+ export declare function presentationSlideViewFromDesign(designContent: WorkPresentationDesignContent, slide: WorkSlide): WorkPresentationSlideView;
13
19
  export declare function applyPresentationLayout(content: WorkPresentationContent, slideId: string, layoutId: string): WorkPresentationContent;
@@ -1,6 +1,7 @@
1
1
  import type { WorkArtifact } from './work-types';
2
2
  export declare function rememberWorkSourceBlob(artifactId: string, source: Blob): void;
3
3
  export declare function forgetWorkSourceBlob(artifactId: string): void;
4
+ export declare function moveWorkSourceBlob(sourceArtifactId: string, targetArtifactId: string): void;
4
5
  export declare function readWorkSourceBlob(artifact: WorkArtifact): Promise<Blob>;
5
6
  export declare function readVerifiedWorkSourceBytes(artifact: WorkArtifact): Promise<ArrayBuffer>;
6
7
  export declare function workSourceFingerprint(bytes: ArrayBuffer): Promise<string>;
@@ -0,0 +1,10 @@
1
+ import type { CellObject } from 'xlsx';
2
+ export interface SpreadsheetWorksheetCompatibilitySummary {
3
+ hasArrayFormulas: boolean;
4
+ hasComments: boolean;
5
+ hasCommentThreads: boolean;
6
+ hasLinks: boolean;
7
+ hasRichText: boolean;
8
+ }
9
+ export declare function emptySpreadsheetWorksheetCompatibilitySummary(): SpreadsheetWorksheetCompatibilitySummary;
10
+ export declare function updateSpreadsheetWorksheetCompatibilitySummary(summary: SpreadsheetWorksheetCompatibilitySummary, cell: CellObject): void;
@@ -0,0 +1,2 @@
1
+ import type { WorkArtifact } from './work-types';
2
+ export declare function createWorkSpreadsheetBlob(artifact: WorkArtifact): Promise<Blob>;
@@ -0,0 +1,3 @@
1
+ import type { WorkFileImportContext } from './work-file-import';
2
+ import type { WorkArtifact } from './work-types';
3
+ export declare function importWorkSpreadsheetFile(file: File, extension: string, context: WorkFileImportContext): Promise<WorkArtifact>;
@@ -0,0 +1,2 @@
1
+ export declare function spreadsheetImportNow(): number;
2
+ export declare function recordSpreadsheetImportMeasure(name: string, start: number, end: number, detail?: Record<string, unknown>): void;
@@ -0,0 +1,6 @@
1
+ import type { ParsingOptions, WorkBook } from 'xlsx';
2
+ /**
3
+ * Parses a workbook away from the UI thread when a dedicated Worker can be
4
+ * created. A null result asks the caller to use the synchronous fallback.
5
+ */
6
+ export declare function readSpreadsheetWorkbookInWorker(bytes: ArrayBuffer, options: ParsingOptions, signal?: AbortSignal): Promise<WorkBook | null>;
@@ -0,0 +1,32 @@
1
+ import type { CellObject, ParsingOptions, WorkBook } from 'xlsx';
2
+ export declare const SPREADSHEET_IMPORT_ROW_CHUNK_SIZE = 512;
3
+ export declare const SPREADSHEET_IMPORT_CELL_CHUNK_SIZE = 8192;
4
+ export interface SpreadsheetImportWorkerRequest {
5
+ bytes: ArrayBuffer;
6
+ kind: 'parse';
7
+ options: ParsingOptions;
8
+ }
9
+ export type SpreadsheetImportWorkbookMetadata = Omit<WorkBook, 'Sheets'>;
10
+ export type SpreadsheetImportDenseRow = Array<CellObject | undefined>;
11
+ export type SpreadsheetImportWorkerResponse = {
12
+ kind: 'workbook';
13
+ workbook: SpreadsheetImportWorkbookMetadata;
14
+ } | {
15
+ dense: boolean;
16
+ kind: 'worksheet';
17
+ name: string;
18
+ properties: Record<string, unknown>;
19
+ } | {
20
+ kind: 'rows';
21
+ name: string;
22
+ rows: Array<SpreadsheetImportDenseRow | undefined>;
23
+ startRow: number;
24
+ } | {
25
+ cells: Array<[address: string, cell: CellObject]>;
26
+ kind: 'cells';
27
+ name: string;
28
+ } | {
29
+ kind: 'success';
30
+ } | {
31
+ kind: 'failure';
32
+ };
@@ -0,0 +1,64 @@
1
+ import type { Cell, CellMatrix } from '@fortune-sheet/core';
2
+ export declare const SPREADSHEET_SHOWN_COMMENT_CELLS_PROPERTY = "__a3sShownCommentCells";
3
+ export interface SpreadsheetMatrixProfile {
4
+ columnCount: number;
5
+ formulaCells: readonly Readonly<{
6
+ column: number;
7
+ row: number;
8
+ }>[];
9
+ fortuneReady: boolean;
10
+ historyRoot: object;
11
+ historyState: object;
12
+ populatedCellCount: number;
13
+ protectionCellKey: string;
14
+ rowCount: number;
15
+ shownCommentCells: readonly Readonly<{
16
+ c: number;
17
+ r: number;
18
+ }>[];
19
+ }
20
+ export interface SpreadsheetMatrixCellChange {
21
+ column: number;
22
+ current: Cell | null | undefined;
23
+ previous: Cell | null | undefined;
24
+ row: number;
25
+ }
26
+ interface ImportedSpreadsheetMatrixOptions {
27
+ columnCount: number;
28
+ formulaCells: readonly Readonly<{
29
+ column: number;
30
+ row: number;
31
+ }>[];
32
+ fortuneReady: boolean;
33
+ populatedCellCount: number;
34
+ protectionCellKey: string;
35
+ rowCount: number;
36
+ shownCommentCells: readonly Readonly<{
37
+ c: number;
38
+ r: number;
39
+ }>[];
40
+ }
41
+ /**
42
+ * Freezes a package-owned import cell before it becomes controlled content.
43
+ * Fortune can then share the cell as an Immer base value without recursively
44
+ * freezing or cloning every populated cell during editor initialization.
45
+ */
46
+ export declare function freezeImportedSpreadsheetCell(cell: Cell): Cell;
47
+ /**
48
+ * Authenticates a normalized, package-owned matrix for clone-free projection.
49
+ * The registry is identity-based, so an edited or host-created matrix cannot
50
+ * accidentally inherit the optimization.
51
+ */
52
+ export declare function registerImportedSpreadsheetMatrix(data: CellMatrix, options: ImportedSpreadsheetMatrixOptions): void;
53
+ /**
54
+ * Carries import-time summaries across a bounded cell edit without rescanning
55
+ * the complete matrix. The source identity must have been authenticated by
56
+ * this package and must already be directly consumable by Fortune.
57
+ */
58
+ export declare function registerDerivedSpreadsheetMatrix(data: CellMatrix, source: CellMatrix, changes: readonly SpreadsheetMatrixCellChange[]): boolean;
59
+ export declare function spreadsheetMatrixProfile(data: CellMatrix | undefined): SpreadsheetMatrixProfile | undefined;
60
+ export declare function attachSpreadsheetShownCommentCells(data: CellMatrix, cells: readonly Readonly<{
61
+ c: number;
62
+ r: number;
63
+ }>[]): void;
64
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { SpreadsheetPackageScanResult } from './work-spreadsheet-package-scan-worker-protocol';
2
+ /**
3
+ * Decompresses and classifies worksheet XML away from the UI thread. A null
4
+ * result preserves the existing main-thread parser as a compatibility path.
5
+ */
6
+ export declare function scanSpreadsheetPackageInWorker(bytes: ArrayBuffer, signal?: AbortSignal, onFastPathCandidate?: () => void): Promise<SpreadsheetPackageScanResult | null>;
@@ -0,0 +1,49 @@
1
+ import type { CellMatrix } from '@fortune-sheet/core';
2
+ import type { WorkBook } from 'xlsx';
3
+ import type { SpreadsheetImportWorkbookMetadata } from './work-spreadsheet-import-worker-protocol';
4
+ import type { PlainXlsxCellChunk } from './work-xlsx-plain-fast-path';
5
+ import type { XlsxWorksheetXmlScan } from './work-xlsx-worksheet-scan';
6
+ export interface SpreadsheetPackageScanWorkerRequest {
7
+ bytes: ArrayBuffer;
8
+ kind: 'scan';
9
+ }
10
+ export interface SpreadsheetPackageScanResult {
11
+ plainWorksheets: Record<string, SpreadsheetPlainWorksheet> | null;
12
+ workbook: WorkBook | null;
13
+ worksheets: Record<string, XlsxWorksheetXmlScan>;
14
+ }
15
+ export interface SpreadsheetPlainWorksheet {
16
+ columnCount: number;
17
+ data: CellMatrix;
18
+ populatedCellCount: number;
19
+ rowCount: number;
20
+ }
21
+ export type SpreadsheetPackageScanWorkerResponse = {
22
+ kind: 'workbook';
23
+ workbook: SpreadsheetImportWorkbookMetadata;
24
+ } | {
25
+ columnCount: number;
26
+ kind: 'plain-worksheet-start';
27
+ name: string;
28
+ rowCount: number;
29
+ } | {
30
+ columnCount: number;
31
+ dense: true;
32
+ kind: 'worksheet';
33
+ name: string;
34
+ populatedCellCount: number;
35
+ properties: Record<string, unknown>;
36
+ rowCount: number;
37
+ } | {
38
+ chunk: PlainXlsxCellChunk;
39
+ kind: 'plain-cells';
40
+ name: string;
41
+ } | {
42
+ kind: 'fast-path-rejected';
43
+ } | {
44
+ fastPath: boolean;
45
+ kind: 'success';
46
+ worksheets: SpreadsheetPackageScanResult['worksheets'];
47
+ } | {
48
+ kind: 'failure';
49
+ };
@@ -27,6 +27,7 @@ export interface FortuneSheetProtectionAuthority {
27
27
  hintText: string;
28
28
  defaultSheetHintText: string;
29
29
  allowRangeList: FortuneSheetEditableRange[];
30
+ cellProtectionRanges: SpreadsheetCellProtectionRange[];
30
31
  xlsxAttributes?: Record<string, string>;
31
32
  }
32
33
  export interface SpreadsheetCellProtectionRange {
@@ -37,6 +38,7 @@ export interface SpreadsheetCellProtectionRange {
37
38
  export declare function defaultSheetProtectionAuthority(enabled?: boolean): FortuneSheetProtectionAuthority;
38
39
  export declare function sheetProtectionAuthority(sheet: Sheet): FortuneSheetProtectionAuthority;
39
40
  export declare function normalizeSheetProtectionAuthority(source: unknown): FortuneSheetProtectionAuthority;
41
+ export declare function importedSheetProtectionAuthority(authority: FortuneSheetProtectionAuthority | undefined, cellProtectionRanges: SpreadsheetCellProtectionRange[]): FortuneSheetProtectionAuthority | undefined;
40
42
  export declare function withSheetProtection(sheet: Sheet, enabled: boolean): Sheet;
41
43
  export declare function withSheetSelectionPermissions(sheet: Sheet, permissions: {
42
44
  selectLockedCells?: boolean;
@@ -192,11 +192,33 @@ export interface WorkSpreadsheetContent {
192
192
  pageBreaks?: WorkSpreadsheetPageBreaks[];
193
193
  pageSetups?: WorkSpreadsheetPageSetup[];
194
194
  }
195
+ export interface WorkSpreadsheetCellRange {
196
+ row: [number, number];
197
+ column: [number, number];
198
+ }
199
+ export interface WorkSpreadsheetDataValidationItem {
200
+ type: string;
201
+ type2: string;
202
+ rangeTxt: string;
203
+ value1: string;
204
+ value2: string;
205
+ validity: string;
206
+ remote: boolean;
207
+ prohibitInput: boolean;
208
+ hintShow: boolean;
209
+ hintValue: string;
210
+ checked?: boolean;
211
+ }
212
+ export interface WorkSpreadsheetDataValidationRange {
213
+ ranges: WorkSpreadsheetCellRange[];
214
+ item: WorkSpreadsheetDataValidationItem;
215
+ }
195
216
  export type WorkSpreadsheetSheet = Omit<Sheet, 'images'> & {
196
217
  images?: WorkSpreadsheetImage[];
197
218
  charts?: WorkSpreadsheetChart[];
198
219
  pivotTables?: WorkSpreadsheetPivotTable[];
199
220
  formulaMetadata?: WorkSpreadsheetFormulaMetadata;
221
+ dataValidationRanges?: WorkSpreadsheetDataValidationRange[];
200
222
  };
201
223
  export type WorkSpreadsheetPivotAggregation = 'sum' | 'count' | 'counta' | 'average' | 'max' | 'min' | 'product' | 'stdDev' | 'stdDevP' | 'var' | 'varP';
202
224
  export interface WorkSpreadsheetPivotValue {
@@ -1,3 +1,5 @@
1
1
  import type { OoxmlPackage } from './work-ooxml-package';
2
2
  import type { WorkCompatibilityIssue } from './work-types';
3
- export declare function diagnoseXlsxFormulas(archive: OoxmlPackage): Promise<WorkCompatibilityIssue[]>;
3
+ import { type XlsxFormulaFeatures } from './work-xlsx-formulas';
4
+ import type { XlsxWorksheetXmlScan } from './work-xlsx-worksheet-scan';
5
+ export declare function diagnoseXlsxFormulas(archive: OoxmlPackage, importedFeatures?: XlsxFormulaFeatures | null, worksheetScans?: Readonly<Record<string, XlsxWorksheetXmlScan>>): Promise<WorkCompatibilityIssue[]>;
@@ -2,6 +2,7 @@ import type { Cell } from '@fortune-sheet/core';
2
2
  import type { WorkSheet } from 'xlsx';
3
3
  import { OoxmlPackage } from './work-ooxml-package';
4
4
  import type { WorkSpreadsheetCalculationSettings, WorkSpreadsheetContent, WorkSpreadsheetFormulaMetadata, WorkSpreadsheetFormulaRange, WorkSpreadsheetSheet } from './work-types';
5
+ import type { XlsxWorksheetXmlScan } from './work-xlsx-worksheet-scan';
5
6
  export interface XlsxFormulaCell {
6
7
  address: string;
7
8
  formula: string;
@@ -29,7 +30,7 @@ type XlsxFormulaCellObject = {
29
30
  D?: boolean;
30
31
  };
31
32
  export declare function readXlsxFormulaFeatures(buffer: ArrayBuffer): Promise<XlsxFormulaFeatures>;
32
- export declare function readXlsxFormulaFeaturesFromPackage(archive: OoxmlPackage): Promise<XlsxFormulaFeatures>;
33
+ export declare function readXlsxFormulaFeaturesFromPackage(archive: OoxmlPackage, worksheetScans?: Readonly<Record<string, XlsxWorksheetXmlScan>>): Promise<XlsxFormulaFeatures>;
33
34
  export declare function createSpreadsheetFormulaMetadata(worksheet: WorkSheet, features: XlsxFormulaSheetFeatures | undefined): WorkSpreadsheetFormulaMetadata | undefined;
34
35
  export declare function createXlsxFormulaCell(cell: Cell, row: number, column: number, sheet: WorkSpreadsheetSheet): XlsxFormulaCellObject;
35
36
  export declare function createXlsxErrorCell(cell: Cell): {
@@ -1,11 +1,13 @@
1
1
  import type { Sheet } from '@fortune-sheet/core';
2
- import { type FortuneConditionalFormatRule } from './work-xlsx-conditional-format';
3
- import { type XlsxProtectionFeatures } from './work-xlsx-protection';
4
- import { type XlsxManualPageBreaks } from './work-xlsx-page-breaks';
2
+ import { OoxmlPackage } from './work-ooxml-package';
3
+ import type { WorkSpreadsheetContent, WorkSpreadsheetDataValidationItem } from './work-types';
5
4
  import { type XlsxWorksheetChart } from './work-xlsx-charts';
5
+ import { type FortuneConditionalFormatRule } from './work-xlsx-conditional-format';
6
6
  import { type XlsxWorksheetImage } from './work-xlsx-images';
7
+ import { type XlsxManualPageBreaks } from './work-xlsx-page-breaks';
7
8
  import { type XlsxPageSetup } from './work-xlsx-page-setup';
8
- import type { WorkSpreadsheetContent } from './work-types';
9
+ import { type XlsxProtectionFeatures } from './work-xlsx-protection';
10
+ import type { XlsxWorksheetXmlScan } from './work-xlsx-worksheet-scan';
9
11
  type FrozenPane = NonNullable<Sheet['frozen']>;
10
12
  export interface XlsxDataValidation {
11
13
  references: string[];
@@ -21,19 +23,8 @@ export interface XlsxSheetFeatures {
21
23
  images: XlsxWorksheetImage[];
22
24
  charts: XlsxWorksheetChart[];
23
25
  }
24
- export interface FortuneDataValidationItem {
25
- type: string;
26
- type2: string;
27
- rangeTxt: string;
28
- value1: string;
29
- value2: string;
30
- validity: string;
31
- remote: boolean;
32
- prohibitInput: boolean;
33
- hintShow: boolean;
34
- hintValue: string;
35
- checked?: boolean;
36
- }
26
+ export type FortuneDataValidationItem = WorkSpreadsheetDataValidationItem;
37
27
  export declare function readXlsxSheetFeatures(buffer: ArrayBuffer): Promise<Map<string, XlsxSheetFeatures>>;
28
+ export declare function readXlsxSheetFeaturesFromPackage(archive: OoxmlPackage, worksheetScans?: Readonly<Record<string, XlsxWorksheetXmlScan>>): Promise<Map<string, XlsxSheetFeatures>>;
38
29
  export declare function patchXlsxSheetFeatures(buffer: ArrayBuffer, content: WorkSpreadsheetContent): Promise<ArrayBuffer>;
39
30
  export {};
@@ -1,3 +1,4 @@
1
1
  import type { OoxmlPackage } from './work-ooxml-package';
2
2
  import type { WorkCompatibilityIssue } from './work-types';
3
- export declare function diagnoseXlsxPivots(archive: OoxmlPackage): Promise<WorkCompatibilityIssue[]>;
3
+ import { type XlsxPivotReadResult } from './work-xlsx-pivots';
4
+ export declare function diagnoseXlsxPivots(archive: OoxmlPackage, importedInspection?: XlsxPivotReadResult | null): Promise<WorkCompatibilityIssue[]>;
@@ -0,0 +1,54 @@
1
+ import type { SpreadsheetImportWorkbookMetadata } from './work-spreadsheet-import-worker-protocol';
2
+ export declare const PLAIN_XLSX_COLUMN_BITS = 14;
3
+ export declare const PLAIN_XLSX_COLUMN_MASK: number;
4
+ export declare const PLAIN_XLSX_CELL_CHUNK_SIZE = 4096;
5
+ export declare const PLAIN_XLSX_ROW_CHUNK_SIZE = 256;
6
+ export declare const PLAIN_XLSX_CELL_NUMBER = 0;
7
+ export declare const PLAIN_XLSX_CELL_BOOLEAN = 1;
8
+ export declare const PLAIN_XLSX_CELL_ERROR = 2;
9
+ export declare const PLAIN_XLSX_CELL_TEXT = 3;
10
+ export interface PlainXlsxPackageParts {
11
+ contentTypes: string;
12
+ packagePaths: readonly string[];
13
+ rootRelationships: string;
14
+ workbook: string;
15
+ workbookRelationships: string;
16
+ }
17
+ export interface PlainXlsxWorkbookSheet {
18
+ name: string;
19
+ partPath: string;
20
+ }
21
+ export interface PlainXlsxWorkbookPlan {
22
+ sheets: PlainXlsxWorkbookSheet[];
23
+ workbook: SpreadsheetImportWorkbookMetadata;
24
+ }
25
+ export interface PlainXlsxCellChunk {
26
+ coordinates: Uint32Array;
27
+ kinds: Uint8Array;
28
+ numericValues: Float64Array;
29
+ startRow: number;
30
+ textValues: string[];
31
+ }
32
+ export interface PlainXlsxWorksheetResult {
33
+ columnCount: number;
34
+ populatedCellCount: number;
35
+ properties: Record<string, unknown>;
36
+ rowCount: number;
37
+ }
38
+ export interface PlainXlsxRangeExtent {
39
+ columnCount: number;
40
+ rowCount: number;
41
+ }
42
+ /**
43
+ * Authenticates the deliberately small OOXML subset handled by the fast
44
+ * worksheet parser. Any package part or workbook construct outside this
45
+ * closed set returns null and leaves SheetJS as the authority.
46
+ */
47
+ export declare function createPlainXlsxWorkbookPlan(parts: PlainXlsxPackageParts): PlainXlsxWorkbookPlan | null;
48
+ /**
49
+ * Parses primitive dense cells with a low-allocation cursor. Row chunks may be
50
+ * emitted provisionally; callers must use them only when the final result is
51
+ * non-null because a later unsupported element invalidates the whole sheet.
52
+ */
53
+ export declare function streamPlainXlsxWorksheet(source: string, visit: (chunk: PlainXlsxCellChunk) => void, start?: (extent: PlainXlsxRangeExtent) => void): PlainXlsxWorksheetResult | null;
54
+ export declare function plainXlsxRangeExtent(reference: string): PlainXlsxRangeExtent | null;
@@ -0,0 +1 @@
1
+ export declare function xlsxWorksheetRequiresSheetJsCellStyles(source: string): boolean;
@@ -0,0 +1,12 @@
1
+ export interface XlsxWorksheetXmlScan {
2
+ hasDiagnosticFeatures: boolean;
3
+ hasFormulaFeatures: boolean;
4
+ hasImportedFeatures: boolean;
5
+ requiresSheetJsCellStyles: boolean;
6
+ }
7
+ /**
8
+ * Builds every worksheet gate in one pass over the decompressed XML. The
9
+ * scanner deliberately permits false positives because they only select the
10
+ * existing full parser path; a false negative could discard workbook state.
11
+ */
12
+ export declare function scanXlsxWorksheetXml(source: string): XlsxWorksheetXmlScan;
@@ -0,0 +1,12 @@
1
+ import type { CellObject, WorkSheet } from 'xlsx';
2
+ export interface XlsxWorksheetCellEntry {
3
+ address: string;
4
+ cell: CellObject;
5
+ column: number;
6
+ row: number;
7
+ }
8
+ /**
9
+ * Iterates both SheetJS sparse address maps and dense row arrays without
10
+ * materializing a second list of every worksheet cell.
11
+ */
12
+ export declare function xlsxWorksheetCellEntries(worksheet: WorkSheet): Generator<XlsxWorksheetCellEntry>;
Binary file