@a3s-lab/office 0.24.0 → 0.26.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 (29) hide show
  1. package/README.md +3 -1
  2. package/dist/0~spreadsheet-editor.js +20305 -19251
  3. package/dist/0~work-office-diagnostics.js +2 -2
  4. package/dist/{5045.js → 164.js} +1135 -18
  5. package/dist/4104.js +46 -748
  6. package/dist/6282.js +221 -235
  7. package/dist/9424.js +16 -0
  8. package/dist/core.js +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +18 -9
  11. package/dist/internal/features/work/editors/spreadsheet-operation-projection.d.ts +6 -0
  12. package/dist/internal/features/work/editors/spreadsheet-rich-text-dom-selection.d.ts +11 -0
  13. package/dist/internal/features/work/editors/spreadsheet-rich-text-paste.d.ts +22 -0
  14. package/dist/internal/features/work/editors/spreadsheet-rich-text-selection-controller.d.ts +38 -0
  15. package/dist/internal/features/work/editors/spreadsheet-rich-text-selection-format.d.ts +26 -0
  16. package/dist/internal/features/work/work-css-color.d.ts +1 -0
  17. package/dist/internal/features/work/work-document-paragraph-shading.d.ts +1 -1
  18. package/dist/internal/features/work/work-xlsx-cell-style-origin.d.ts +1 -0
  19. package/dist/internal/features/work/work-xlsx-colors.d.ts +1 -1
  20. package/dist/internal/features/work/work-xlsx-interop.d.ts +2 -0
  21. package/dist/internal/features/work/work-xlsx-rich-text-edit.d.ts +28 -0
  22. package/dist/internal/features/work/work-xlsx-rich-text-model.d.ts +40 -0
  23. package/dist/internal/features/work/work-xlsx-rich-text.d.ts +41 -0
  24. package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +1 -0
  25. package/dist/internal/features/work/work-xlsx-worksheet.d.ts +5 -0
  26. package/dist/office-kernel.wasm +0 -0
  27. package/dist/work-spreadsheet-package-scan.worker.js +6 -2
  28. package/docs/latest/en/browser-editor-architecture.md +27 -0
  29. package/package.json +4 -1
package/dist/6282.js CHANGED
@@ -22,6 +22,7 @@ import font_family from "@tiptap/extension-text-style/font-family";
22
22
  import { TextStyle } from "@tiptap/extension-text-style";
23
23
  import extension_highlight from "@tiptap/extension-highlight";
24
24
  import { createOfficeId as createWorkId, parseXml, xmlNamespacePrefix } from "./5184.js";
25
+ import { normalizeCssColor } from "./9424.js";
25
26
  import { workOfficeCollaborationJsonEqual, canonicalWorkOfficeCollaborationJson, isWorkOfficeCollaborationRecord, cloneWorkOfficeCollaborationJson } from "./4650.js";
26
27
  import { assertWorkOfficeCollaborationEditable, markWorkOfficeCollaborationInitialized, assertWorkOfficeCollaborationOrigin, initializeWorkOfficeCollaborationMetadata, assertWorkOfficeCollaborationWritable, OfficeCollaborationError as WorkOfficeCollaborationError, readOfficeCollaborationMetadata as readWorkOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer } from "./9787.js";
27
28
  import * as __rspack_external_yjs from "yjs";
@@ -2359,241 +2360,6 @@ function setOptionalWordAttribute(document1, element, name, value) {
2359
2360
  if (value) setWordAttribute(document1, element, name, value);
2360
2361
  else element.removeAttributeNS(WORD_NAMESPACE, name);
2361
2362
  }
2362
- const DOCUMENT_PARAGRAPH_SHADING_PATTERNS = new Set([
2363
- 'nil',
2364
- 'clear',
2365
- 'solid',
2366
- 'horzStripe',
2367
- 'vertStripe',
2368
- 'reverseDiagStripe',
2369
- 'diagStripe',
2370
- 'horzCross',
2371
- 'diagCross',
2372
- 'thinHorzStripe',
2373
- 'thinVertStripe',
2374
- 'thinReverseDiagStripe',
2375
- 'thinDiagStripe',
2376
- 'thinHorzCross',
2377
- 'thinDiagCross',
2378
- 'pct5',
2379
- 'pct10',
2380
- 'pct12',
2381
- 'pct15',
2382
- 'pct20',
2383
- 'pct25',
2384
- 'pct30',
2385
- 'pct35',
2386
- 'pct37',
2387
- 'pct40',
2388
- 'pct45',
2389
- 'pct50',
2390
- 'pct55',
2391
- 'pct60',
2392
- 'pct62',
2393
- 'pct65',
2394
- 'pct70',
2395
- 'pct75',
2396
- 'pct80',
2397
- 'pct85',
2398
- 'pct87',
2399
- 'pct90',
2400
- 'pct95'
2401
- ]);
2402
- function normalizeDocumentParagraphShading(source) {
2403
- if (!source || 'object' != typeof source) return null;
2404
- const value = source;
2405
- const pattern = value.pattern;
2406
- if ('string' != typeof pattern || !DOCUMENT_PARAGRAPH_SHADING_PATTERNS.has(pattern)) return null;
2407
- const color = normalizeShadingColor(value.color);
2408
- const fill = normalizeShadingColor(value.fill);
2409
- if (void 0 !== value.color && !color || void 0 !== value.fill && !fill) return null;
2410
- return {
2411
- pattern: pattern,
2412
- ...color ? {
2413
- color
2414
- } : {},
2415
- ...fill ? {
2416
- fill
2417
- } : {}
2418
- };
2419
- }
2420
- function parseDocumentParagraphShading(source) {
2421
- if ('string' != typeof source) return normalizeDocumentParagraphShading(source);
2422
- if (!source.trim()) return null;
2423
- try {
2424
- return normalizeDocumentParagraphShading(JSON.parse(source));
2425
- } catch {
2426
- return null;
2427
- }
2428
- }
2429
- function serializeDocumentParagraphShading(source) {
2430
- const shading = normalizeDocumentParagraphShading(source);
2431
- if (!shading) return;
2432
- return JSON.stringify({
2433
- pattern: shading.pattern,
2434
- ...shading.color ? {
2435
- color: serializedShadingColor(shading.color)
2436
- } : {},
2437
- ...shading.fill ? {
2438
- fill: serializedShadingColor(shading.fill)
2439
- } : {}
2440
- });
2441
- }
2442
- function parseDocumentParagraphShadingElement(element) {
2443
- const semantic = parseDocumentParagraphShading(element.dataset.officeParagraphShading);
2444
- const background = normalizeCssColor(element.style.backgroundColor);
2445
- if (semantic) {
2446
- const presentation = documentParagraphShadingPresentation(semantic);
2447
- const expected = normalizeCssColor(presentation.backgroundColor);
2448
- if (background && expected && background !== expected) {
2449
- if ('transparent' === background) return {
2450
- pattern: 'nil'
2451
- };
2452
- if (paragraphShadingBackgroundUsesForeground(semantic)) return {
2453
- ...semantic,
2454
- color: {
2455
- value: background
2456
- }
2457
- };
2458
- return {
2459
- ...semantic,
2460
- fill: {
2461
- value: background
2462
- }
2463
- };
2464
- }
2465
- return semantic;
2466
- }
2467
- return background && 'transparent' !== background ? {
2468
- pattern: 'clear',
2469
- fill: {
2470
- value: background
2471
- }
2472
- } : null;
2473
- }
2474
- function documentParagraphShadingDomAttributes(source) {
2475
- const shading = normalizeDocumentParagraphShading(source);
2476
- const serialized = serializeDocumentParagraphShading(shading);
2477
- if (!shading || !serialized) return {};
2478
- const presentation = documentParagraphShadingPresentation(shading);
2479
- const styles = [
2480
- `background-color: ${presentation.backgroundColor}`,
2481
- presentation.backgroundImage ? `background-image: ${presentation.backgroundImage}` : '',
2482
- presentation.backgroundSize ? `background-size: ${presentation.backgroundSize}` : ''
2483
- ].filter(Boolean);
2484
- return {
2485
- 'data-office-paragraph-shading': serialized,
2486
- style: styles.join('; ')
2487
- };
2488
- }
2489
- function normalizeCssColor(source) {
2490
- const value = source?.trim().toLowerCase();
2491
- if (!value) return null;
2492
- if ('transparent' === value) return 'transparent';
2493
- const shortHex = /^#([0-9a-f]{3})$/i.exec(value);
2494
- if (shortHex?.[1]) return `#${Array.from(shortHex[1]).map((channel)=>`${channel}${channel}`).join('')}`;
2495
- if (/^#[0-9a-f]{6}$/i.test(value)) return value;
2496
- const rgb = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*([\d.]+))?\s*\)$/i.exec(value);
2497
- if (!rgb) return null;
2498
- const channels = rgb.slice(1, 4).map(Number);
2499
- if (channels.some((channel)=>channel < 0 || channel > 255)) return null;
2500
- if (void 0 !== rgb[4] && 0 === Number(rgb[4])) return 'transparent';
2501
- if (void 0 !== rgb[4] && 1 !== Number(rgb[4])) return null;
2502
- return `#${channels.map((channel)=>channel.toString(16).padStart(2, '0')).join('')}`;
2503
- }
2504
- function normalizeShadingColor(source) {
2505
- if (!source || 'object' != typeof source) return null;
2506
- const value = source;
2507
- const theme = parseDocxThemeReference('string' == typeof value.theme ? value.theme : value.theme ? JSON.stringify(value.theme) : void 0);
2508
- const direct = 'auto' === value.value ? 'auto' : 'string' == typeof value.value ? normalizeCssColor(value.value) : null;
2509
- const resolved = direct ?? theme?.resolved ?? null;
2510
- if (!resolved || 'transparent' === resolved) return null;
2511
- if (theme && resolved !== theme.resolved) return null;
2512
- return {
2513
- value: resolved,
2514
- ...theme ? {
2515
- theme
2516
- } : {}
2517
- };
2518
- }
2519
- function serializedShadingColor(color) {
2520
- const theme = serializeDocxThemeReference(color.theme ?? null);
2521
- return {
2522
- value: color.value,
2523
- ...theme ? {
2524
- theme: JSON.parse(theme)
2525
- } : {}
2526
- };
2527
- }
2528
- function documentParagraphShadingPresentation(shading) {
2529
- if ('nil' === shading.pattern) return {
2530
- backgroundColor: 'transparent'
2531
- };
2532
- const foreground = shadingColor(shading.color, '#000000');
2533
- const background = shadingColor(shading.fill, 'transparent');
2534
- if ('clear' === shading.pattern) return {
2535
- backgroundColor: background
2536
- };
2537
- if ('solid' === shading.pattern) return {
2538
- backgroundColor: foreground
2539
- };
2540
- const percentage = shadingPercentage(shading.pattern);
2541
- if (null !== percentage) {
2542
- const inverted = percentage > 50;
2543
- const dotColor = inverted ? background : foreground;
2544
- const baseColor = inverted ? foreground : background;
2545
- const density = Math.min(50, inverted ? 100 - percentage : percentage);
2546
- const spacing = Math.max(2, Math.round(9 - density / 7));
2547
- return {
2548
- backgroundColor: baseColor,
2549
- backgroundImage: `radial-gradient(circle, ${dotColor} 0 1px, transparent 1.2px)`,
2550
- backgroundSize: `${spacing}px ${spacing}px`
2551
- };
2552
- }
2553
- const thin = shading.pattern.startsWith('thin');
2554
- const width = thin ? 1 : 2;
2555
- const period = thin ? 7 : 6;
2556
- const stripe = (angle)=>`repeating-linear-gradient(${angle}deg, ${foreground} 0 ${width}px, transparent ${width}px ${period}px)`;
2557
- const angles = shadingPatternAngles(shading.pattern);
2558
- return {
2559
- backgroundColor: background,
2560
- backgroundImage: angles.map(stripe).join(', ')
2561
- };
2562
- }
2563
- function shadingColor(color, fallback) {
2564
- return color && 'auto' !== color.value ? color.value : fallback;
2565
- }
2566
- function shadingPercentage(pattern) {
2567
- const match = /^pct(\d+)$/.exec(pattern);
2568
- return match?.[1] ? Number(match[1]) : null;
2569
- }
2570
- function paragraphShadingBackgroundUsesForeground(shading) {
2571
- if ('solid' === shading.pattern) return true;
2572
- const percentage = shadingPercentage(shading.pattern);
2573
- return null !== percentage && percentage > 50;
2574
- }
2575
- function shadingPatternAngles(pattern) {
2576
- if (pattern.includes('HorzCross')) return [
2577
- 0,
2578
- 90
2579
- ];
2580
- if (pattern.includes('DiagCross')) return [
2581
- 45,
2582
- -45
2583
- ];
2584
- if (pattern.includes('VertStripe')) return [
2585
- 90
2586
- ];
2587
- if (pattern.includes('ReverseDiagStripe')) return [
2588
- -45
2589
- ];
2590
- if (pattern.includes('DiagStripe')) return [
2591
- 45
2592
- ];
2593
- return [
2594
- 0
2595
- ];
2596
- }
2597
2363
  const DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE = 'data-office-paragraph-borders';
2598
2364
  const DOCUMENT_PARAGRAPH_BORDER_EDGES = [
2599
2365
  'top',
@@ -7519,6 +7285,226 @@ function work_document_paragraph_identity_transactionMapping(transactions) {
7519
7285
  for (const transaction of transactions)mapping.appendMapping(transaction.mapping);
7520
7286
  return mapping;
7521
7287
  }
7288
+ const DOCUMENT_PARAGRAPH_SHADING_PATTERNS = new Set([
7289
+ 'nil',
7290
+ 'clear',
7291
+ 'solid',
7292
+ 'horzStripe',
7293
+ 'vertStripe',
7294
+ 'reverseDiagStripe',
7295
+ 'diagStripe',
7296
+ 'horzCross',
7297
+ 'diagCross',
7298
+ 'thinHorzStripe',
7299
+ 'thinVertStripe',
7300
+ 'thinReverseDiagStripe',
7301
+ 'thinDiagStripe',
7302
+ 'thinHorzCross',
7303
+ 'thinDiagCross',
7304
+ 'pct5',
7305
+ 'pct10',
7306
+ 'pct12',
7307
+ 'pct15',
7308
+ 'pct20',
7309
+ 'pct25',
7310
+ 'pct30',
7311
+ 'pct35',
7312
+ 'pct37',
7313
+ 'pct40',
7314
+ 'pct45',
7315
+ 'pct50',
7316
+ 'pct55',
7317
+ 'pct60',
7318
+ 'pct62',
7319
+ 'pct65',
7320
+ 'pct70',
7321
+ 'pct75',
7322
+ 'pct80',
7323
+ 'pct85',
7324
+ 'pct87',
7325
+ 'pct90',
7326
+ 'pct95'
7327
+ ]);
7328
+ function normalizeDocumentParagraphShading(source) {
7329
+ if (!source || 'object' != typeof source) return null;
7330
+ const value = source;
7331
+ const pattern = value.pattern;
7332
+ if ('string' != typeof pattern || !DOCUMENT_PARAGRAPH_SHADING_PATTERNS.has(pattern)) return null;
7333
+ const color = normalizeShadingColor(value.color);
7334
+ const fill = normalizeShadingColor(value.fill);
7335
+ if (void 0 !== value.color && !color || void 0 !== value.fill && !fill) return null;
7336
+ return {
7337
+ pattern: pattern,
7338
+ ...color ? {
7339
+ color
7340
+ } : {},
7341
+ ...fill ? {
7342
+ fill
7343
+ } : {}
7344
+ };
7345
+ }
7346
+ function parseDocumentParagraphShading(source) {
7347
+ if ('string' != typeof source) return normalizeDocumentParagraphShading(source);
7348
+ if (!source.trim()) return null;
7349
+ try {
7350
+ return normalizeDocumentParagraphShading(JSON.parse(source));
7351
+ } catch {
7352
+ return null;
7353
+ }
7354
+ }
7355
+ function serializeDocumentParagraphShading(source) {
7356
+ const shading = normalizeDocumentParagraphShading(source);
7357
+ if (!shading) return;
7358
+ return JSON.stringify({
7359
+ pattern: shading.pattern,
7360
+ ...shading.color ? {
7361
+ color: serializedShadingColor(shading.color)
7362
+ } : {},
7363
+ ...shading.fill ? {
7364
+ fill: serializedShadingColor(shading.fill)
7365
+ } : {}
7366
+ });
7367
+ }
7368
+ function parseDocumentParagraphShadingElement(element) {
7369
+ const semantic = parseDocumentParagraphShading(element.dataset.officeParagraphShading);
7370
+ const background = normalizeCssColor(element.style.backgroundColor);
7371
+ if (semantic) {
7372
+ const presentation = documentParagraphShadingPresentation(semantic);
7373
+ const expected = normalizeCssColor(presentation.backgroundColor);
7374
+ if (background && expected && background !== expected) {
7375
+ if ('transparent' === background) return {
7376
+ pattern: 'nil'
7377
+ };
7378
+ if (paragraphShadingBackgroundUsesForeground(semantic)) return {
7379
+ ...semantic,
7380
+ color: {
7381
+ value: background
7382
+ }
7383
+ };
7384
+ return {
7385
+ ...semantic,
7386
+ fill: {
7387
+ value: background
7388
+ }
7389
+ };
7390
+ }
7391
+ return semantic;
7392
+ }
7393
+ return background && 'transparent' !== background ? {
7394
+ pattern: 'clear',
7395
+ fill: {
7396
+ value: background
7397
+ }
7398
+ } : null;
7399
+ }
7400
+ function documentParagraphShadingDomAttributes(source) {
7401
+ const shading = normalizeDocumentParagraphShading(source);
7402
+ const serialized = serializeDocumentParagraphShading(shading);
7403
+ if (!shading || !serialized) return {};
7404
+ const presentation = documentParagraphShadingPresentation(shading);
7405
+ const styles = [
7406
+ `background-color: ${presentation.backgroundColor}`,
7407
+ presentation.backgroundImage ? `background-image: ${presentation.backgroundImage}` : '',
7408
+ presentation.backgroundSize ? `background-size: ${presentation.backgroundSize}` : ''
7409
+ ].filter(Boolean);
7410
+ return {
7411
+ 'data-office-paragraph-shading': serialized,
7412
+ style: styles.join('; ')
7413
+ };
7414
+ }
7415
+ function normalizeShadingColor(source) {
7416
+ if (!source || 'object' != typeof source) return null;
7417
+ const value = source;
7418
+ const theme = parseDocxThemeReference('string' == typeof value.theme ? value.theme : value.theme ? JSON.stringify(value.theme) : void 0);
7419
+ const direct = 'auto' === value.value ? 'auto' : 'string' == typeof value.value ? normalizeCssColor(value.value) : null;
7420
+ const resolved = direct ?? theme?.resolved ?? null;
7421
+ if (!resolved || 'transparent' === resolved) return null;
7422
+ if (theme && resolved !== theme.resolved) return null;
7423
+ return {
7424
+ value: resolved,
7425
+ ...theme ? {
7426
+ theme
7427
+ } : {}
7428
+ };
7429
+ }
7430
+ function serializedShadingColor(color) {
7431
+ const theme = serializeDocxThemeReference(color.theme ?? null);
7432
+ return {
7433
+ value: color.value,
7434
+ ...theme ? {
7435
+ theme: JSON.parse(theme)
7436
+ } : {}
7437
+ };
7438
+ }
7439
+ function documentParagraphShadingPresentation(shading) {
7440
+ if ('nil' === shading.pattern) return {
7441
+ backgroundColor: 'transparent'
7442
+ };
7443
+ const foreground = shadingColor(shading.color, '#000000');
7444
+ const background = shadingColor(shading.fill, 'transparent');
7445
+ if ('clear' === shading.pattern) return {
7446
+ backgroundColor: background
7447
+ };
7448
+ if ('solid' === shading.pattern) return {
7449
+ backgroundColor: foreground
7450
+ };
7451
+ const percentage = shadingPercentage(shading.pattern);
7452
+ if (null !== percentage) {
7453
+ const inverted = percentage > 50;
7454
+ const dotColor = inverted ? background : foreground;
7455
+ const baseColor = inverted ? foreground : background;
7456
+ const density = Math.min(50, inverted ? 100 - percentage : percentage);
7457
+ const spacing = Math.max(2, Math.round(9 - density / 7));
7458
+ return {
7459
+ backgroundColor: baseColor,
7460
+ backgroundImage: `radial-gradient(circle, ${dotColor} 0 1px, transparent 1.2px)`,
7461
+ backgroundSize: `${spacing}px ${spacing}px`
7462
+ };
7463
+ }
7464
+ const thin = shading.pattern.startsWith('thin');
7465
+ const width = thin ? 1 : 2;
7466
+ const period = thin ? 7 : 6;
7467
+ const stripe = (angle)=>`repeating-linear-gradient(${angle}deg, ${foreground} 0 ${width}px, transparent ${width}px ${period}px)`;
7468
+ const angles = shadingPatternAngles(shading.pattern);
7469
+ return {
7470
+ backgroundColor: background,
7471
+ backgroundImage: angles.map(stripe).join(', ')
7472
+ };
7473
+ }
7474
+ function shadingColor(color, fallback) {
7475
+ return color && 'auto' !== color.value ? color.value : fallback;
7476
+ }
7477
+ function shadingPercentage(pattern) {
7478
+ const match = /^pct(\d+)$/.exec(pattern);
7479
+ return match?.[1] ? Number(match[1]) : null;
7480
+ }
7481
+ function paragraphShadingBackgroundUsesForeground(shading) {
7482
+ if ('solid' === shading.pattern) return true;
7483
+ const percentage = shadingPercentage(shading.pattern);
7484
+ return null !== percentage && percentage > 50;
7485
+ }
7486
+ function shadingPatternAngles(pattern) {
7487
+ if (pattern.includes('HorzCross')) return [
7488
+ 0,
7489
+ 90
7490
+ ];
7491
+ if (pattern.includes('DiagCross')) return [
7492
+ 45,
7493
+ -45
7494
+ ];
7495
+ if (pattern.includes('VertStripe')) return [
7496
+ 90
7497
+ ];
7498
+ if (pattern.includes('ReverseDiagStripe')) return [
7499
+ -45
7500
+ ];
7501
+ if (pattern.includes('DiagStripe')) return [
7502
+ 45
7503
+ ];
7504
+ return [
7505
+ 0
7506
+ ];
7507
+ }
7522
7508
  const DOCUMENT_TABLE_ROW_ID_ATTRIBUTE = 'data-office-row-id';
7523
7509
  const DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE = 'data-office-row-text-id';
7524
7510
  const DocumentTableRowIdentity = Extension.create({
package/dist/9424.js ADDED
@@ -0,0 +1,16 @@
1
+ function normalizeCssColor(source) {
2
+ const value = source?.trim().toLowerCase();
3
+ if (!value) return null;
4
+ if ('transparent' === value) return 'transparent';
5
+ const shortHex = /^#([0-9a-f]{3})$/i.exec(value);
6
+ if (shortHex?.[1]) return `#${Array.from(shortHex[1]).map((channel)=>`${channel}${channel}`).join('')}`;
7
+ if (/^#[0-9a-f]{6}$/i.test(value)) return value;
8
+ const rgb = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*([\d.]+))?\s*\)$/i.exec(value);
9
+ if (!rgb) return null;
10
+ const channels = rgb.slice(1, 4).map(Number);
11
+ if (channels.some((channel)=>channel < 0 || channel > 255)) return null;
12
+ if (void 0 !== rgb[4] && 0 === Number(rgb[4])) return 'transparent';
13
+ if (void 0 !== rgb[4] && 1 !== Number(rgb[4])) return null;
14
+ return `#${channels.map((channel)=>channel.toString(16).padStart(2, '0')).join('')}`;
15
+ }
16
+ export { normalizeCssColor };
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 };
@@ -1,27 +1,28 @@
1
1
  import type { Cell, Selection, Sheet } from '@fortune-sheet/core';
2
2
  import type { SpreadsheetGridSize } from '../spreadsheet-sparse';
3
- import type { WorkSpreadsheetContent } from '../work-types';
4
3
  import type { SpreadsheetTextOrientationId } from '../work-spreadsheet-text-orientation';
4
+ import type { WorkSpreadsheetContent } from '../work-types';
5
5
  import { type OfficeEditorCanCommands, type OfficeEditorExtension } from './office-editor-extension';
6
6
  import type { SpreadsheetAutoSumFunction } from './spreadsheet-auto-sum';
7
- import { type SpreadsheetCellClearMode } from './spreadsheet-cell-clear';
8
7
  import type { SpreadsheetCellBorderFormat } from './spreadsheet-cell-border';
8
+ import { type SpreadsheetCellClearMode } from './spreadsheet-cell-clear';
9
+ import type { SpreadsheetCellFillDirection } from './spreadsheet-cell-fill';
9
10
  import type { SpreadsheetCellFormatRequest } from './spreadsheet-cell-format';
10
- import type { SpreadsheetFormatCellsOpenIntent } from './spreadsheet-format-cells-intent';
11
+ import { type SpreadsheetCellMergeCommand } from './spreadsheet-cell-merge';
11
12
  import type { SpreadsheetCellRange } from './spreadsheet-cell-range';
12
13
  import type { SpreadsheetCellStyleChoice } from './spreadsheet-cell-style';
13
- import type { SpreadsheetCellFillDirection } from './spreadsheet-cell-fill';
14
14
  import type { SpreadsheetCopyFromAboveKind } from './spreadsheet-copy-from-above';
15
- import { type SpreadsheetFontSizeDirection } from './spreadsheet-font-size-command';
16
- import { type SpreadsheetDateTimeKind } from './spreadsheet-date-time-command';
17
15
  import type { SpreadsheetDataValidationRequest, SpreadsheetDataValidationTarget } from './spreadsheet-data-validation';
18
- import { type SpreadsheetCellMergeCommand } from './spreadsheet-cell-merge';
16
+ import { type SpreadsheetDateTimeKind } from './spreadsheet-date-time-command';
17
+ import { type SpreadsheetFontSizeDirection } from './spreadsheet-font-size-command';
18
+ import type { SpreadsheetFormatCellsOpenIntent } from './spreadsheet-format-cells-intent';
19
19
  import type { SpreadsheetFormatPainterMode } from './spreadsheet-format-painter';
20
- import type { SpreadsheetHyperlinkCell, SpreadsheetHyperlinkRequest } from './spreadsheet-hyperlink';
21
20
  import { type SpreadsheetFreezePanePreset } from './spreadsheet-freeze-panes';
21
+ import type { SpreadsheetHyperlinkCell, SpreadsheetHyperlinkRequest } from './spreadsheet-hyperlink';
22
22
  import type { SpreadsheetKeyboardSelection, SpreadsheetSelectionMove, SpreadsheetSelectionScope } from './spreadsheet-keyboard-navigation';
23
- import type { SpreadsheetPasteContent } from './spreadsheet-paste-special';
24
23
  import { type SpreadsheetDecimalPlacesDirection } from './spreadsheet-number-format-command';
24
+ import type { SpreadsheetPasteContent } from './spreadsheet-paste-special';
25
+ import type { SpreadsheetRichTextToggleAttribute } from './spreadsheet-rich-text-selection-format';
25
26
  import { type SpreadsheetSheetMoveDirection } from './spreadsheet-sheet-model';
26
27
  import type { SpreadsheetTableDesignPatch, SpreadsheetTableRequest, SpreadsheetTableTarget } from './spreadsheet-table';
27
28
  export interface SpreadsheetWorkbookCommandPort {
@@ -147,6 +148,12 @@ export interface SpreadsheetNavigationCommandPort {
147
148
  export interface SpreadsheetFormulaBarCommandPort {
148
149
  setValue: (value: unknown) => void;
149
150
  }
151
+ export interface SpreadsheetRichTextFormatCommandPort {
152
+ apply: (attribute: keyof Cell, value: unknown) => boolean;
153
+ canApply: (attribute: keyof Cell, value: unknown) => boolean;
154
+ canToggle: (attribute: SpreadsheetRichTextToggleAttribute) => boolean;
155
+ toggle: (attribute: SpreadsheetRichTextToggleAttribute) => boolean;
156
+ }
150
157
  export interface SpreadsheetViewCommandPort {
151
158
  activateSheet: (sheetId: string) => boolean;
152
159
  }
@@ -195,6 +202,7 @@ export interface SpreadsheetEditorCommands {
195
202
  renameSheet: (sheetId: string, name: string) => boolean;
196
203
  redo: () => boolean;
197
204
  setCellFormat: (attribute: keyof Cell, value: unknown) => boolean;
205
+ toggleCellFormat: (attribute: SpreadsheetRichTextToggleAttribute) => boolean;
198
206
  setTextOrientation: (orientation: SpreadsheetTextOrientationId) => boolean;
199
207
  setSelectedCellBorders: (format: SpreadsheetCellBorderFormat) => boolean;
200
208
  setFreezePanes: (preset: SpreadsheetFreezePanePreset) => boolean;
@@ -228,6 +236,7 @@ export interface SpreadsheetCommandContext {
228
236
  history: SpreadsheetHistoryCommandPort | null;
229
237
  navigation: SpreadsheetNavigationCommandPort;
230
238
  onChange: (content: WorkSpreadsheetContent) => void;
239
+ richTextFormat?: SpreadsheetRichTextFormatCommandPort | null;
231
240
  selection: SpreadsheetCommandSelection | null;
232
241
  table: SpreadsheetTableCommandPort;
233
242
  targetSheetGridSize?: SpreadsheetGridSize | null;
@@ -5,6 +5,12 @@ export interface SpreadsheetOperationProjection {
5
5
  affectedCellCount: number;
6
6
  sheets: WorkSpreadsheetContent['sheets'];
7
7
  }
8
+ export interface SpreadsheetCellOperationCoordinate {
9
+ column: number;
10
+ row: number;
11
+ }
12
+ export declare function spreadsheetCellOperationKey(row: number, column: number): string;
13
+ export declare function spreadsheetCellOperationCoordinates(operations: readonly Op[]): Map<string, Map<string, SpreadsheetCellOperationCoordinate>> | null;
8
14
  /**
9
15
  * Reconciles a bounded Fortune operation batch against authenticated
10
16
  * controlled matrices. Only the outer matrix and affected rows/cells are
@@ -0,0 +1,11 @@
1
+ export interface SpreadsheetRichTextDomSelection {
2
+ editor: HTMLElement;
3
+ end: number;
4
+ start: number;
5
+ }
6
+ export declare function captureSpreadsheetRichTextDomSelection({ expandedOnly, root, target, }: {
7
+ expandedOnly?: boolean;
8
+ root: HTMLElement | null;
9
+ target?: EventTarget | null;
10
+ }): SpreadsheetRichTextDomSelection | null;
11
+ export declare function spreadsheetRichTextEditor(node: Node): HTMLElement | null;
@@ -0,0 +1,22 @@
1
+ import type { Cell, Selection } from '@fortune-sheet/core';
2
+ import type { WorkSpreadsheetContent, WorkSpreadsheetSheet } from '../work-types';
3
+ import type { SpreadsheetRichTextPasteIntent } from '../work-xlsx-rich-text-edit';
4
+ import { type XlsxRichTextRun } from '../work-xlsx-rich-text-model';
5
+ interface ParsedSpreadsheetRichTextClipboard {
6
+ runs: XlsxRichTextRun[];
7
+ text: string;
8
+ }
9
+ export declare function parseSpreadsheetRichTextClipboard(html: string, plainText: string): ParsedSpreadsheetRichTextClipboard | null;
10
+ export declare function captureSpreadsheetRichTextPaste({ clipboardData, content, root, selection, sheetId, target, }: {
11
+ clipboardData: Pick<DataTransfer, 'getData'>;
12
+ content: WorkSpreadsheetContent;
13
+ root: HTMLElement | null;
14
+ selection: Selection | null | undefined;
15
+ sheetId: string;
16
+ target: EventTarget | null;
17
+ }): boolean;
18
+ export declare function stageSpreadsheetRichTextPaste(sheet: WorkSpreadsheetSheet, row: number, column: number, sourceText: string, intent: SpreadsheetRichTextPasteIntent): void;
19
+ export declare function takeSpreadsheetRichTextPaste(sheet: WorkSpreadsheetSheet, row: number, column: number, current: Cell): SpreadsheetRichTextPasteIntent | undefined;
20
+ export declare function peekSpreadsheetRichTextPaste(sheet: WorkSpreadsheetSheet, row: number, column: number, current: Cell): SpreadsheetRichTextPasteIntent | undefined;
21
+ export declare function consumeSpreadsheetRichTextPaste(sheet: WorkSpreadsheetSheet, row: number, column: number): void;
22
+ export {};
@@ -0,0 +1,38 @@
1
+ import { type Cell, type Selection } from '@fortune-sheet/core';
2
+ import type { WorkSpreadsheetContent } from '../work-types';
3
+ import { type SpreadsheetRichTextToggleAttribute } from './spreadsheet-rich-text-selection-format';
4
+ interface SpreadsheetRichTextSelectionSnapshot {
5
+ column: number;
6
+ consumed: boolean;
7
+ editor: HTMLElement;
8
+ end: number;
9
+ root: HTMLElement;
10
+ row: number;
11
+ sheetId: string;
12
+ sourceCell: Cell;
13
+ start: number;
14
+ }
15
+ export interface SpreadsheetRichTextSelectionCapture {
16
+ content: WorkSpreadsheetContent;
17
+ root: HTMLElement | null;
18
+ selection: Selection | null | undefined;
19
+ sheetId: string;
20
+ }
21
+ export declare class SpreadsheetRichTextSelectionController {
22
+ private restoreTimer;
23
+ private snapshot;
24
+ capture(options: SpreadsheetRichTextSelectionCapture): boolean;
25
+ clear(): void;
26
+ canApply(content: WorkSpreadsheetContent, attribute: keyof Cell, value: unknown): boolean;
27
+ apply(content: WorkSpreadsheetContent, onChange: (content: WorkSpreadsheetContent) => void, attribute: keyof Cell, value: unknown): boolean;
28
+ canToggle(content: WorkSpreadsheetContent, attribute: SpreadsheetRichTextToggleAttribute): boolean;
29
+ toggle(content: WorkSpreadsheetContent, onChange: (content: WorkSpreadsheetContent) => void, attribute: SpreadsheetRichTextToggleAttribute): boolean;
30
+ private applyRequest;
31
+ restore(): boolean;
32
+ private cancelScheduledRestore;
33
+ private request;
34
+ private toggleRequest;
35
+ }
36
+ export declare function isSpreadsheetRichTextFormatPointerTarget(target: EventTarget | null): boolean;
37
+ export declare function captureSpreadsheetRichTextSelection({ content, root, selection, sheetId, }: SpreadsheetRichTextSelectionCapture): SpreadsheetRichTextSelectionSnapshot | null;
38
+ export {};