@a3s-lab/office 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -7,6 +7,6 @@ export { createArtifact, createOfficeId, officeTemplates } from "./5184.js";
7
7
  export { createOfficeDocumentCollaborationBinding, initializeOfficeDocumentCollaboration, officeDocumentCollaborationFragment, readOfficeDocumentCollaboration } from "./6282.js";
8
8
  export { createOfficeMarkdownCollaborationBinding, initializeOfficeMarkdownCollaboration, readOfficeMarkdownCollaboration, replaceOfficeMarkdownCollaboration } from "./2591.js";
9
9
  export { createOfficePresentationCollaborationBinding, initializeOfficePresentationCollaboration, readOfficePresentationCollaboration, replaceOfficePresentationCollaboration } from "./4560.js";
10
- export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./5045.js";
10
+ export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./164.js";
11
11
  export { normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel } from "./8715.js";
12
12
  export { core_OFFICE_COLLABORATION_VERSION as OFFICE_COLLABORATION_VERSION };
package/dist/index.js CHANGED
@@ -10,6 +10,6 @@ export { createArtifact, createOfficeId, officeTemplates } from "./5184.js";
10
10
  export { createOfficeDocumentCollaborationBinding, initializeOfficeDocumentCollaboration, officeDocumentCollaborationFragment, readOfficeDocumentCollaboration } from "./6282.js";
11
11
  export { createOfficeMarkdownCollaborationBinding, initializeOfficeMarkdownCollaboration, readOfficeMarkdownCollaboration, replaceOfficeMarkdownCollaboration } from "./2591.js";
12
12
  export { createOfficePresentationCollaborationBinding, initializeOfficePresentationCollaboration, readOfficePresentationCollaboration, replaceOfficePresentationCollaboration } from "./4560.js";
13
- export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./5045.js";
13
+ export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./164.js";
14
14
  export { normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel } from "./8715.js";
15
15
  export { src_DOCUMENT_SNAPSHOT_VERSION as DOCUMENT_SNAPSHOT_VERSION, src_DOCUMENT_SOURCE_VERSION as DOCUMENT_SOURCE_VERSION, src_OFFICE_COLLABORATION_VERSION as OFFICE_COLLABORATION_VERSION };
@@ -42,3 +42,4 @@ export declare function applyXlsxSemanticColorOrigin(element: Element, origin: X
42
42
  export declare function xlsxSemanticColorOriginKey(origin: XlsxSemanticColorOrigin | undefined): string;
43
43
  export declare function xlsxSemanticColorOriginSupported(origin: XlsxSemanticColorOrigin, palette: XlsxSemanticPalette | undefined): boolean;
44
44
  export declare function prepareXlsxSemanticPalette(styles: Document, theme: Document | null, origins: Iterable<XlsxCellStyleOrigin>): PreparedXlsxSemanticPalette;
45
+ export declare function normalizeXlsxSemanticColorOrigin(value: unknown): XlsxSemanticColorOrigin | undefined;
@@ -2,5 +2,5 @@ export interface XlsxColorResolver {
2
2
  indexed: readonly string[];
3
3
  theme: readonly string[];
4
4
  }
5
- export declare function createXlsxColorResolver(styles: Document, theme: Document | null): XlsxColorResolver;
5
+ export declare function createXlsxColorResolver(styles: Document | null, theme: Document | null): XlsxColorResolver;
6
6
  export declare function resolveXlsxColor(element: Element | undefined, resolver: XlsxColorResolver): string | undefined;
@@ -9,6 +9,7 @@ import { type XlsxManualPageBreaks } from './work-xlsx-page-breaks';
9
9
  import { type XlsxPageSetup } from './work-xlsx-page-setup';
10
10
  import { type XlsxProtectionFeatures } from './work-xlsx-protection';
11
11
  import { type XlsxWorksheetXmlScan } from './work-xlsx-worksheet-scan';
12
+ import { type XlsxRichTextCell } from './work-xlsx-rich-text';
12
13
  import type { WorkSpreadsheetTable } from './work-types';
13
14
  type FrozenPane = NonNullable<Sheet['frozen']>;
14
15
  export interface XlsxDataValidation {
@@ -26,6 +27,7 @@ export interface XlsxSheetFeatures {
26
27
  images: XlsxWorksheetImage[];
27
28
  charts: XlsxWorksheetChart[];
28
29
  tables: WorkSpreadsheetTable[];
30
+ richTextCells: XlsxRichTextCell[];
29
31
  }
30
32
  export type FortuneDataValidationItem = WorkSpreadsheetDataValidationItem;
31
33
  export declare function readXlsxSheetFeatures(buffer: ArrayBuffer): Promise<Map<string, XlsxSheetFeatures>>;
@@ -0,0 +1,55 @@
1
+ import type { Cell, Sheet } from '@fortune-sheet/core';
2
+ import { type SpreadsheetUnderlineCellValue, type SpreadsheetUnderlineStyle } from './work-spreadsheet-underline';
3
+ import { type XlsxCellStyleOrigin, type XlsxSemanticColorOrigin, type XlsxSemanticPalette } from './work-xlsx-cell-style-origin';
4
+ import { type XlsxColorResolver } from './work-xlsx-colors';
5
+ export declare const MAX_XLSX_RICH_TEXT_CELL_CHARACTERS = 32767;
6
+ export declare const MAX_XLSX_RICH_TEXT_RUNS_PER_CELL = 512;
7
+ export declare const MAX_XLSX_RICH_TEXT_CELLS = 10000;
8
+ export declare const MAX_XLSX_RICH_TEXT_RUNS = 100000;
9
+ export interface XlsxRichTextRun {
10
+ a3sXlsxColorOrigin?: XlsxSemanticColorOrigin;
11
+ bl?: 0 | 1;
12
+ cl?: 0 | 1;
13
+ fc?: string;
14
+ ff?: string;
15
+ fs?: number;
16
+ it?: 0 | 1;
17
+ un?: SpreadsheetUnderlineCellValue;
18
+ v: string;
19
+ }
20
+ export interface XlsxRichTextCell {
21
+ column: number;
22
+ row: number;
23
+ runs: XlsxRichTextRun[];
24
+ text: string;
25
+ }
26
+ export interface XlsxRichTextReadContext {
27
+ readonly colors: XlsxColorResolver;
28
+ readonly hasRichSharedStrings: boolean;
29
+ readonly sharedStrings: ReadonlyMap<number, readonly XlsxRichTextRun[]>;
30
+ remainingCells: number;
31
+ remainingRuns: number;
32
+ }
33
+ interface XlsxRichTextContextOptions {
34
+ sharedStrings: Document | null;
35
+ styles: Document | null;
36
+ theme: Document | null;
37
+ }
38
+ interface SpreadsheetRichTextFontPatch {
39
+ bold?: boolean;
40
+ fontColor?: string;
41
+ fontFamily?: string;
42
+ fontSize?: number;
43
+ italic?: boolean;
44
+ strike?: boolean;
45
+ underline?: SpreadsheetUnderlineStyle;
46
+ }
47
+ export declare function createXlsxRichTextReadContext(options: XlsxRichTextContextOptions): XlsxRichTextReadContext;
48
+ export declare function readXlsxRichTextCells(worksheet: Document, context: XlsxRichTextReadContext): XlsxRichTextCell[];
49
+ export declare function applyImportedXlsxRichText(cell: Cell, richText: XlsxRichTextCell | undefined): Cell;
50
+ export declare function patchSpreadsheetRichTextFontRuns(cell: Cell, patch: SpreadsheetRichTextFontPatch): Cell;
51
+ export declare function xlsxRichTextCellText(cell: Cell): string | null;
52
+ export declare function sheetHasXlsxRichTextCells(sheet: Sheet): boolean;
53
+ export declare function xlsxRichTextStyleOrigins(sheet: Sheet): XlsxCellStyleOrigin[];
54
+ export declare function writeXlsxRichTextCells(worksheet: Document, sheet: Sheet, semanticPalette?: XlsxSemanticPalette): void;
55
+ export {};
@@ -3,6 +3,7 @@ export interface XlsxWorksheetXmlScan {
3
3
  hasDiagnosticFeatures: boolean;
4
4
  hasFormulaFeatures: boolean;
5
5
  hasImportedFeatures: boolean;
6
+ hasRichTextCells: boolean;
6
7
  requiresSheetJsCellStyles: boolean;
7
8
  }
8
9
  /**
@@ -10,3 +10,8 @@ export interface XlsxWorksheetCellEntry {
10
10
  * materializing a second list of every worksheet cell.
11
11
  */
12
12
  export declare function xlsxWorksheetCellEntries(worksheet: WorkSheet): Generator<XlsxWorksheetCellEntry>;
13
+ export declare function xlsxCellAddress(row: number, column: number): string;
14
+ export declare function decodeXlsxCellAddress(address: string): {
15
+ column: number;
16
+ row: number;
17
+ } | null;
Binary file
@@ -4012,22 +4012,24 @@ https://github.com/nodeca/pako/blob/main/LICENSE
4012
4012
  'rowBreaks',
4013
4013
  'colBreaks'
4014
4014
  ]);
4015
- const WORKSHEET_SCAN_PATTERN = /<(?:[A-Za-z_][\w.-]*:)?(?:(cols|f|pane|dataValidation|conditionalFormatting|sheetProtection|protectedRange|rowBreaks|colBreaks|pageSetup|pageMargins|printOptions|headerFooter|pageSetUpPr|drawing|tableParts)(?=[\s/>])|(row)(?=[\s/>])[^>]*\s(?:collapsed|customFormat|customHeight|hidden|ht|outlineLevel|thickBot|thickTop)\s*=|(c)(?=[\s/>])[^>]*\ss\s*=)/g;
4015
+ const WORKSHEET_SCAN_PATTERN = /<(?:[A-Za-z_][\w.-]*:)?(?:(cols|f|pane|dataValidation|conditionalFormatting|sheetProtection|protectedRange|rowBreaks|colBreaks|pageSetup|pageMargins|printOptions|headerFooter|pageSetUpPr|drawing|tableParts)(?=[\s/>])|(row)(?=[\s/>])[^>]*\s(?:collapsed|customFormat|customHeight|hidden|ht|outlineLevel|thickBot|thickTop)\s*=|(c)(?=[\s/>])[^>]*\ss\s*=|(r)(?=[\s/>]))/g;
4016
4016
  function scanXlsxWorksheetXml(source) {
4017
4017
  let hasDirectCellStyles = false;
4018
4018
  let hasDiagnosticFeatures = false;
4019
4019
  let hasFormulaFeatures = false;
4020
4020
  let hasImportedFeatures = false;
4021
+ let hasRichTextCells = false;
4021
4022
  let requiresSheetJsCellStyles = false;
4022
4023
  WORKSHEET_SCAN_PATTERN.lastIndex = 0;
4023
4024
  for(let match = WORKSHEET_SCAN_PATTERN.exec(source); match;){
4024
4025
  const element = match[1];
4025
4026
  if (match[3]) hasDirectCellStyles = true;
4027
+ if (match[4]) hasRichTextCells = true;
4026
4028
  if (match[2] || match[3] || 'cols' === element) requiresSheetJsCellStyles = true;
4027
4029
  if ('f' === element) hasFormulaFeatures = true;
4028
4030
  if (element && IMPORTED_WORKSHEET_ELEMENTS.has(element)) hasImportedFeatures = true;
4029
4031
  if (element && DIAGNOSTIC_WORKSHEET_ELEMENTS.has(element)) hasDiagnosticFeatures = true;
4030
- if (hasDirectCellStyles && hasDiagnosticFeatures && hasFormulaFeatures && hasImportedFeatures && requiresSheetJsCellStyles) break;
4032
+ if (hasDirectCellStyles && hasDiagnosticFeatures && hasFormulaFeatures && hasImportedFeatures && hasRichTextCells && requiresSheetJsCellStyles) break;
4031
4033
  match = WORKSHEET_SCAN_PATTERN.exec(source);
4032
4034
  }
4033
4035
  WORKSHEET_SCAN_PATTERN.lastIndex = 0;
@@ -4036,6 +4038,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
4036
4038
  hasDiagnosticFeatures,
4037
4039
  hasFormulaFeatures,
4038
4040
  hasImportedFeatures,
4041
+ hasRichTextCells,
4039
4042
  requiresSheetJsCellStyles
4040
4043
  };
4041
4044
  }
@@ -4131,6 +4134,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
4131
4134
  hasDiagnosticFeatures: false,
4132
4135
  hasFormulaFeatures: false,
4133
4136
  hasImportedFeatures: false,
4137
+ hasRichTextCells: false,
4134
4138
  requiresSheetJsCellStyles: false
4135
4139
  };
4136
4140
  async function plainWorkbookPlan(zip, packagePaths) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a3s-lab/office",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "Open-source collaborative browser editors for documents, Markdown, spreadsheets, presentations, and PDFs.",
5
5
  "keywords": [
6
6
  "office",
@@ -95,6 +95,7 @@
95
95
  "playground:visual:spreadsheet-font-colors-shortcuts": "playwright test visual-tests/spreadsheet-font-colors-shortcuts.functional.spec.ts --config playwright.config.ts",
96
96
  "playground:visual:spreadsheet-hyperlink": "playwright test visual-tests/spreadsheet-hyperlink.functional.spec.ts --config playwright.config.ts",
97
97
  "playground:visual:spreadsheet-ribbon": "playwright test visual-tests/spreadsheet-ribbon.functional.spec.ts --config playwright.config.ts",
98
+ "playground:visual:spreadsheet-rich-text": "playwright test visual-tests/spreadsheet-rich-text.functional.spec.ts --config playwright.config.ts",
98
99
  "playground:visual:spreadsheet-underline": "playwright test visual-tests/spreadsheet-underline.functional.spec.ts --config playwright.config.ts",
99
100
  "playground:visual:spreadsheet-table": "playwright test visual-tests/spreadsheet-table.functional.spec.ts --config playwright.config.ts",
100
101
  "playground:visual:update": "playwright test --config playwright.config.ts --update-snapshots",
@@ -169,6 +170,8 @@
169
170
  "test:e2e:spreadsheet-copy-from-above:check": "a3s-test check tests/e2e/spreadsheet-copy-from-above.acl --json",
170
171
  "test:e2e:spreadsheet-font-dialog-shortcuts": "A3S_TEST_SUITE=tests/e2e/spreadsheet-font-dialog-shortcuts.acl bash scripts/run-a3s-test-web-gate.sh",
171
172
  "test:e2e:spreadsheet-font-dialog-shortcuts:check": "a3s-test check tests/e2e/spreadsheet-font-dialog-shortcuts.acl --json",
173
+ "test:e2e:spreadsheet-rich-text": "A3S_TEST_SUITE=tests/e2e/spreadsheet-rich-text.acl bash scripts/run-a3s-test-web-gate.sh",
174
+ "test:e2e:spreadsheet-rich-text:check": "a3s-test check tests/e2e/spreadsheet-rich-text.acl --json",
172
175
  "test:e2e:spreadsheet-hyperlink": "a3s-test run tests/e2e/spreadsheet-hyperlink.acl --json",
173
176
  "test:e2e:spreadsheet-hyperlink:check": "a3s-test check tests/e2e/spreadsheet-hyperlink.acl --json",
174
177
  "test:e2e:spreadsheet-maximum-sparse": "a3s-test run tests/e2e/spreadsheet-maximum-sparse.acl --json",