@a3s-lab/office 0.13.0 → 0.14.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 (52) hide show
  1. package/README.md +40 -5
  2. package/dist/0~6090.js +63 -4
  3. package/dist/0~7048.js +14 -4
  4. package/dist/0~spreadsheet-editor.js +13936 -9125
  5. package/dist/4104.js +1094 -18
  6. package/dist/internal/features/work/editors/office-checkbox.d.ts +3 -2
  7. package/dist/internal/features/work/editors/office-menu-keyboard.d.ts +1 -0
  8. package/dist/internal/features/work/editors/spreadsheet-auto-sum-command.d.ts +3 -0
  9. package/dist/internal/features/work/editors/spreadsheet-auto-sum.d.ts +19 -0
  10. package/dist/internal/features/work/editors/spreadsheet-cell-border-per-cell.d.ts +5 -0
  11. package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +15 -1
  12. package/dist/internal/features/work/editors/spreadsheet-cell-format-command.d.ts +3 -0
  13. package/dist/internal/features/work/editors/spreadsheet-cell-format.d.ts +36 -0
  14. package/dist/internal/features/work/editors/spreadsheet-cell-mutation-guard.d.ts +4 -0
  15. package/dist/internal/features/work/editors/spreadsheet-cell-style-command.d.ts +3 -0
  16. package/dist/internal/features/work/editors/spreadsheet-cell-style-ribbon.d.ts +9 -0
  17. package/dist/internal/features/work/editors/spreadsheet-cell-style.d.ts +41 -0
  18. package/dist/internal/features/work/editors/spreadsheet-clipboard-shortcuts.d.ts +1 -0
  19. package/dist/internal/features/work/editors/spreadsheet-clipboard.d.ts +13 -0
  20. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +253 -0
  21. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +40 -0
  22. package/dist/internal/features/work/editors/spreadsheet-context-menu.d.ts +5 -15
  23. package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +3 -2
  24. package/dist/internal/features/work/editors/spreadsheet-format-cells-dialog-model.d.ts +86 -0
  25. package/dist/internal/features/work/editors/spreadsheet-format-cells-dialog-panels.d.ts +15 -0
  26. package/dist/internal/features/work/editors/spreadsheet-format-cells-dialog.d.ts +8 -0
  27. package/dist/internal/features/work/editors/spreadsheet-go-to.d.ts +24 -0
  28. package/dist/internal/features/work/editors/spreadsheet-keyboard-navigation.d.ts +4 -0
  29. package/dist/internal/features/work/editors/spreadsheet-navigation-command.d.ts +3 -0
  30. package/dist/internal/features/work/editors/spreadsheet-number-format-command.d.ts +24 -0
  31. package/dist/internal/features/work/editors/spreadsheet-number-format.d.ts +15 -3
  32. package/dist/internal/features/work/editors/spreadsheet-paste-special-cell.d.ts +17 -0
  33. package/dist/internal/features/work/editors/spreadsheet-paste-special-dialog.d.ts +9 -0
  34. package/dist/internal/features/work/editors/spreadsheet-paste-special-mode.d.ts +11 -0
  35. package/dist/internal/features/work/editors/spreadsheet-paste-special-plan.d.ts +4 -0
  36. package/dist/internal/features/work/editors/spreadsheet-paste-special-sheet.d.ts +23 -0
  37. package/dist/internal/features/work/editors/spreadsheet-paste-special-snapshot.d.ts +10 -0
  38. package/dist/internal/features/work/editors/spreadsheet-paste-special-types.d.ts +127 -0
  39. package/dist/internal/features/work/editors/spreadsheet-paste-special.d.ts +7 -0
  40. package/dist/internal/features/work/editors/use-spreadsheet-clipboard.d.ts +36 -0
  41. package/dist/internal/features/work/work-xlsx-cell-borders.d.ts +25 -0
  42. package/dist/internal/features/work/work-xlsx-cell-style-writer.d.ts +21 -0
  43. package/dist/internal/features/work/work-xlsx-cell-style-xml.d.ts +17 -0
  44. package/dist/internal/features/work/work-xlsx-cell-styles.d.ts +13 -0
  45. package/dist/internal/features/work/work-xlsx-colors.d.ts +6 -0
  46. package/dist/internal/features/work/work-xlsx-interop.d.ts +3 -1
  47. package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +1 -0
  48. package/dist/office-kernel.wasm +0 -0
  49. package/dist/styles.css +665 -1
  50. package/dist/work-spreadsheet-package-scan.worker.js +7 -3
  51. package/docs/latest/en/browser-editor-architecture.md +12 -1
  52. package/package.json +11 -3
package/README.md CHANGED
@@ -517,16 +517,24 @@ interaction model.
517
517
  selection-preserving undo/redo, deterministic Arrow, Enter, Tab, Home,
518
518
  PageUp/PageDown, row, column, and all-cells selection shortcuts, Cmd/Ctrl
519
519
  formatting through root-scoped capture before vendor grid listeners, an
520
- editor-owned Cmd/Ctrl+F search bar that finds displayed values, raw values,
521
- formulas, and sparse cells without opening browser Find, with a viewport-safe
522
- phone layout, touch-sized controls, and exact grid-focus restoration,
520
+ WPS-style Home and Editing Find and Select menu whose editor-owned
521
+ `Cmd/Ctrl+F` search finds displayed values, raw values, formulas, and sparse
522
+ cells without opening browser Find, plus view-only `Ctrl+G` and `F5` Go To
523
+ for direct, quoted cross-sheet, and named ranges without content updates,
524
+ Undo records, or sparse materialization, with a viewport-safe phone Find
525
+ layout, touch-sized controls, bounded validation, and exact focus restoration,
523
526
  desktop workbook task panes that become focus-contained phone dialogs with
524
527
  an inert workbook background and exact ribbon-invoker restoration,
525
528
  a WPS-familiar command catalog and tab order, quick-access Undo and Redo,
526
529
  a priority-aware adaptive and collapsible ribbon with temporary tab
527
530
  expansion, an executable Home clipboard group whose Paste, Cut, and Copy
528
531
  commands share the permission-resilient local fallback with their WPS
529
- shortcuts, a WPS-style Format Painter with single-use and double-click locked
532
+ shortcuts, a WPS-style Paste split command with quick All, Values, Formulas,
533
+ and Formatting actions plus `Cmd/Ctrl+Alt+V` Paste Special for ten content
534
+ modes, arithmetic operations, Skip blanks, Transpose, translated formula
535
+ references, rich same-editor styles/comments/validation/merges/column widths,
536
+ bounded TSV fallback, one-step Undo, and fail-closed protected or unsafe
537
+ targets, a WPS-style Format Painter with single-use and double-click locked
530
538
  sessions, cross-sheet range-pattern tiling, Escape cancellation, and native
531
539
  style-only writes, a Home and Font cell-border split control with side, all,
532
540
  outside, inside, horizontal, vertical, clear, and diagonal targets, ten
@@ -547,6 +555,31 @@ interaction model.
547
555
  relative-formula and style propagation, WPS `Cmd/Ctrl+D` and `Cmd/Ctrl+R`
548
556
  shortcuts, one-step history, protected-range preflight, a 50,000-target-cell
549
557
  guard, and sparse-row-safe execution,
558
+ a WPS AutoSum split command before Fill with Sum, Average, Count, Maximum,
559
+ and Minimum, the editor-scoped `Alt+=` Sum shortcut, contiguous source
560
+ inference above or left of a blank target, multi-formula totals rows and
561
+ columns, target-style preservation, merged/protected/read-only/pivot and
562
+ overwrite preflight, a 1,000-formula bound, sparse-safe native batches, and
563
+ one-step history,
564
+ Home and Number presets for General, Number, CNY Currency, Accounting,
565
+ Percentage, Short Date, Time, Scientific, Fraction, and Text, including the
566
+ seven standard `Cmd/Ctrl+Shift` format shortcuts, exact XLSX format-code
567
+ round trips, value/formula preservation, and one-step history, plus
568
+ 10,000-cell-bounded Increase/Decrease Decimal commands that retain every
569
+ cell's format family across mixed selections and commit one native batch,
570
+ a WPS-style Format Cells dialog under Home and Number with the editor-scoped
571
+ `Cmd/Ctrl+1` shortcut, functional Number, Alignment, Font, Border, Fill, and
572
+ Protection tabs, untouched mixed-value preservation, custom native number
573
+ codes, compact protection ranges, dense/sparse representation retention,
574
+ bounded blank-cell materialization, one controlled update and one Undo
575
+ record per Apply, and exact launcher or remounted-grid focus restoration,
576
+ a Home and Styles gallery with 17 WPS built-in cell styles grouped as Common,
577
+ Data and Model, and Titles and Totals, true native previews, two-dimensional
578
+ keyboard navigation, a 10,000-cell bound, blank-cell styling, per-cell border
579
+ semantics, current-style recognition without private markers, one-step
580
+ history, and direct XLSX font, fill, alignment, wrap, rotation, border, and
581
+ number-format XF round trips with theme, indexed, and tint colors normalized
582
+ to stable RGB,
550
583
  a View and Window Freeze Panes menu for current-cell, top-row, first-column,
551
584
  and unfreeze patterns with XLSX round trips, and visible F9 workbook
552
585
  recalculation,
@@ -557,7 +590,7 @@ interaction model.
557
590
  keyboard-operated cells and sheet tabs, direct type-to-edit,
558
591
  permission-resilient multi-cell cut/copy/paste, clear, F2 editing, and
559
592
  focus-safe Escape behavior, direct
560
- font-family, vertical-alignment, text-wrap, number/percent, and decimal
593
+ font-family, vertical-alignment, text-wrap, number-format, and decimal
561
594
  controls, charts, validation, protection, comments, and print settings.
562
595
  _XLSX, XLS, ODS, and CSV import; XLSX and PDF export._
563
596
  - **Presentation** — Typed slide scene graph, multi-selection, groups, object
@@ -1451,6 +1484,8 @@ without hard-coded return URLs.
1451
1484
 
1452
1485
  - [Live Playground](https://a3s-lab.github.io/Office/)
1453
1486
  - [Documentation center](https://a3s-lab.github.io/Office/docs/)
1487
+ - [A3S Office 0.14.0 documentation](https://a3s-lab.github.io/Office/docs/0.14.0/)
1488
+ - [A3S Office 0.13.1 documentation](https://a3s-lab.github.io/Office/docs/0.13.1/)
1454
1489
  - [A3S Office 0.13.0 documentation](https://a3s-lab.github.io/Office/docs/0.13.0/)
1455
1490
  - [A3S Office 0.12.0 documentation](https://a3s-lab.github.io/Office/docs/0.12.0/)
1456
1491
  - [A3S Office 0.11.0 documentation](https://a3s-lab.github.io/Office/docs/0.11.0/)
package/dist/0~6090.js CHANGED
@@ -1235,11 +1235,15 @@ const OFFICE_MENU_NAVIGATION_KEYS = [
1235
1235
  'Home',
1236
1236
  'End'
1237
1237
  ];
1238
+ const OFFICE_GRID_MENU_NAVIGATION_KEYS = [
1239
+ ...OFFICE_MENU_NAVIGATION_KEYS,
1240
+ 'ArrowLeft',
1241
+ 'ArrowRight'
1242
+ ];
1243
+ const OFFICE_MENU_BUTTON_SELECTOR = 'button[role="menuitem"]:not(:disabled), button[role="menuitemradio"]:not(:disabled), button[role="menuitemcheckbox"]:not(:disabled)';
1238
1244
  function moveOfficeMenuFocus(event) {
1239
1245
  if (!OFFICE_MENU_NAVIGATION_KEYS.includes(event.key)) return false;
1240
- const buttons = [
1241
- ...event.currentTarget.querySelectorAll('button[role="menuitem"]:not(:disabled), button[role="menuitemradio"]:not(:disabled), button[role="menuitemcheckbox"]:not(:disabled)')
1242
- ];
1246
+ const buttons = officeMenuButtons(event.currentTarget);
1243
1247
  if (!buttons.length) return false;
1244
1248
  event.preventDefault();
1245
1249
  const current = buttons.indexOf(document.activeElement);
@@ -1247,6 +1251,61 @@ function moveOfficeMenuFocus(event) {
1247
1251
  buttons[next]?.focus();
1248
1252
  return true;
1249
1253
  }
1254
+ function moveOfficeGridMenuFocus(event, columns) {
1255
+ if (!OFFICE_GRID_MENU_NAVIGATION_KEYS.includes(event.key)) return false;
1256
+ const buttons = officeMenuButtons(event.currentTarget);
1257
+ if (!buttons.length) return false;
1258
+ event.preventDefault();
1259
+ const currentButton = document.activeElement;
1260
+ const current = Math.max(0, buttons.indexOf(currentButton));
1261
+ if ('Home' === event.key || 'End' === event.key) {
1262
+ buttons['Home' === event.key ? 0 : buttons.length - 1]?.focus();
1263
+ return true;
1264
+ }
1265
+ if ('ArrowLeft' === event.key || 'ArrowRight' === event.key) {
1266
+ const delta = 'ArrowRight' === event.key ? 1 : -1;
1267
+ buttons[(current + delta + buttons.length) % buttons.length]?.focus();
1268
+ return true;
1269
+ }
1270
+ const groups = [
1271
+ ...event.currentTarget.querySelectorAll('[data-office-menu-grid]')
1272
+ ];
1273
+ const groupIndex = groups.findIndex((group)=>group.contains(currentButton));
1274
+ if (groupIndex < 0) {
1275
+ const delta = 'ArrowDown' === event.key ? columns : -columns;
1276
+ buttons[(current + delta + buttons.length) % buttons.length]?.focus();
1277
+ return true;
1278
+ }
1279
+ const groupButtons = officeMenuButtons(groups[groupIndex]);
1280
+ const localIndex = Math.max(0, groupButtons.indexOf(currentButton));
1281
+ const column = localIndex % columns;
1282
+ if ('ArrowDown' === event.key) {
1283
+ const nextRow = localIndex - column + columns;
1284
+ if (nextRow < groupButtons.length) {
1285
+ groupButtons[Math.min(nextRow + column, groupButtons.length - 1)]?.focus();
1286
+ return true;
1287
+ }
1288
+ const nextGroup = groups[(groupIndex + 1) % groups.length];
1289
+ const nextButtons = officeMenuButtons(nextGroup);
1290
+ nextButtons[Math.min(column, nextButtons.length - 1)]?.focus();
1291
+ return true;
1292
+ }
1293
+ const previousRow = localIndex - column - columns;
1294
+ if (previousRow >= 0) {
1295
+ groupButtons[previousRow + column]?.focus();
1296
+ return true;
1297
+ }
1298
+ const previousGroup = groups[(groupIndex - 1 + groups.length) % groups.length];
1299
+ const previousButtons = officeMenuButtons(previousGroup);
1300
+ const previousRowStart = Math.floor((previousButtons.length - 1) / columns) * columns;
1301
+ previousButtons[Math.min(previousRowStart + column, previousButtons.length - 1)]?.focus();
1302
+ return true;
1303
+ }
1304
+ function officeMenuButtons(root) {
1305
+ return [
1306
+ ...root.querySelectorAll(OFFICE_MENU_BUTTON_SELECTOR)
1307
+ ];
1308
+ }
1250
1309
  function stepOfficeZoom(zoom, direction, { minimum = 50, maximum = 200, step = 10 } = {}) {
1251
1310
  const delta = 'in' === direction ? step : -step;
1252
1311
  return Math.min(maximum, Math.max(minimum, Math.round(zoom + delta)));
@@ -1280,4 +1339,4 @@ function useOfficeEditorWheelZoom({ enabled = true, scopeRef, onZoomIn, onZoomOu
1280
1339
  scopeRef
1281
1340
  ]);
1282
1341
  }
1283
- export { CommittedOfficeTextArea, CommittedOfficeTextField, MarkdownSourcePresenceLayer, OfficePresenceAvatar, OfficeTiptapPresenceLayer, Popover, WorkOfficeCollaborationParticipants, button_Button, icon_button_IconButton, matchesAriaKeyShortcuts, matchesOfficeEditorKeyboardShortcut, moveOfficeMenuFocus, officeOverlayPortalRoot, officePresenceColor, officePresenceColorStyle, office_text_field_OfficeFileInput, office_text_field_OfficeTextArea, office_text_field_OfficeTextField, stepOfficeZoom, useDialogFocusScope, useOfficeEditorWheelZoom, useOfficePublishPresenceLocation, useOfficeRemoteParticipants };
1342
+ export { CommittedOfficeTextArea, CommittedOfficeTextField, MarkdownSourcePresenceLayer, OfficePresenceAvatar, OfficeTiptapPresenceLayer, Popover, WorkOfficeCollaborationParticipants, button_Button, icon_button_IconButton, matchesAriaKeyShortcuts, matchesOfficeEditorKeyboardShortcut, moveOfficeGridMenuFocus, moveOfficeMenuFocus, officeOverlayPortalRoot, officePresenceColor, officePresenceColorStyle, office_text_field_OfficeFileInput, office_text_field_OfficeTextArea, office_text_field_OfficeTextField, stepOfficeZoom, useDialogFocusScope, useOfficeEditorWheelZoom, useOfficePublishPresenceLocation, useOfficeRemoteParticipants };
package/dist/0~7048.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useId, useRef, useState } from "react";
3
- import { Check, ChevronDown, ChevronUp } from "lucide-react";
3
+ import { Check, ChevronDown, ChevronUp, Minus } from "lucide-react";
4
4
  import { Dialog } from "./0~4595.js";
5
5
  import { button_Button, office_text_field_OfficeTextField, office_text_field_OfficeTextArea } from "./0~6090.js";
6
6
  import { OFFICE_KERNEL_SPREADSHEET_MAX_ROWS as office_kernel_spreadsheet_protocol_OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, isOfficeKernelSpreadsheetError } from "./5184.js";
@@ -433,13 +433,21 @@ function safelyNormalizeOfficeNumberDraft(normalizeValue, draft) {
433
433
  return null;
434
434
  }
435
435
  }
436
- function OfficeCheckbox({ ariaLabel, checked, onCheckedChange, children, disabled = false, className = '' }) {
436
+ function OfficeCheckbox({ ariaLabel, checked, onCheckedChange, children, disabled = false, className = '', indeterminate = false }) {
437
+ const inputRef = useRef(null);
438
+ useEffect(()=>{
439
+ if (inputRef.current) inputRef.current.indeterminate = indeterminate;
440
+ }, [
441
+ indeterminate
442
+ ]);
437
443
  return /*#__PURE__*/ jsxs("label", {
438
- className: `work-office-checkbox ${checked ? 'checked' : ''} ${disabled ? 'disabled' : ''} ${className}`.trim(),
444
+ className: `work-office-checkbox ${checked ? 'checked' : ''} ${indeterminate ? 'indeterminate' : ''} ${disabled ? 'disabled' : ''} ${className}`.trim(),
439
445
  children: [
440
446
  /*#__PURE__*/ jsx("input", {
447
+ ref: inputRef,
441
448
  type: "checkbox",
442
449
  "aria-label": ariaLabel,
450
+ "aria-checked": indeterminate ? 'mixed' : checked,
443
451
  checked: checked,
444
452
  disabled: disabled,
445
453
  onChange: (event)=>onCheckedChange(event.target.checked)
@@ -447,7 +455,9 @@ function OfficeCheckbox({ ariaLabel, checked, onCheckedChange, children, disable
447
455
  /*#__PURE__*/ jsx("span", {
448
456
  className: "work-office-checkbox-box",
449
457
  "aria-hidden": "true",
450
- children: checked && /*#__PURE__*/ jsx(Check, {
458
+ children: indeterminate ? /*#__PURE__*/ jsx(Minus, {
459
+ size: 11
460
+ }) : checked && /*#__PURE__*/ jsx(Check, {
451
461
  size: 11
452
462
  })
453
463
  }),