@a3s-lab/office 0.19.0 → 0.20.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/README.md CHANGED
@@ -563,7 +563,10 @@ interaction model.
563
563
  per-cell mixed-size stepping, native rectangle compaction, a 10,000-cell
564
564
  bound, and one-step Undo, a WPS-style Underline split control with single,
565
565
  double, single-accounting, and double-accounting styles, exact Format Cells
566
- and XLSX round trips, and active-style-aware `Cmd/Ctrl+U` toggling, a
566
+ and XLSX round trips, active-style-aware `Cmd/Ctrl+U` toggling, and WPS
567
+ `Ctrl+2`, `Ctrl+3`, and `Ctrl+4` aliases for Bold, Italic, and Underline;
568
+ Automatic Color and No Fill remove direct text and background colors instead
569
+ of hard-coding replacements, a
567
570
  keyboard-accessible WPS Text Orientation menu with horizontal, both 45-degree
568
571
  angles, stacked vertical, rotate-up, and rotate-down choices, exact Fortune
569
572
  `rt` / `tr='3'` and OOXML 0–180 / 255 round trips, a 10,000-cell guard, and
@@ -613,8 +616,10 @@ interaction model.
613
616
  keyboard navigation, a 10,000-cell bound, blank-cell styling, per-cell border
614
617
  semantics, current-style recognition without private markers, one-step
615
618
  history, and direct XLSX font, fill, alignment, wrap, rotation, border, and
616
- number-format XF round trips with theme, indexed, and tint colors normalized
617
- to stable RGB,
619
+ number-format XF round trips; imported theme, indexed, automatic, and tint
620
+ identities for direct font, solid-fill, and border colors survive unrelated
621
+ edits and Yjs transport when the rendered RGB and palette slot still agree,
622
+ while changed or conflicting colors safely export as explicit RGB,
618
623
  a View and Window Freeze Panes menu for current-cell, top-row, first-column,
619
624
  and unfreeze patterns with XLSX round trips, and visible F9 workbook
620
625
  recalculation,
@@ -1528,6 +1533,7 @@ without hard-coded return URLs.
1528
1533
 
1529
1534
  - [Live Playground](https://a3s-lab.github.io/Office/)
1530
1535
  - [Documentation center](https://a3s-lab.github.io/Office/docs/)
1536
+ - [A3S Office 0.20.0 documentation](https://a3s-lab.github.io/Office/docs/0.20.0/)
1531
1537
  - [A3S Office 0.19.0 documentation](https://a3s-lab.github.io/Office/docs/0.19.0/)
1532
1538
  - [A3S Office 0.18.0 documentation](https://a3s-lab.github.io/Office/docs/0.18.0/)
1533
1539
  - [A3S Office 0.17.0 documentation](https://a3s-lab.github.io/Office/docs/0.17.0/)
package/dist/0~3635.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Check, ChevronDown } from "lucide-react";
2
+ import { Ban, Check, ChevronDown } from "lucide-react";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { button_Button, Popover } from "./0~6090.js";
5
5
  const THEME_COLORS = [
@@ -72,7 +72,7 @@ const OFFICE_COLORS = [
72
72
  ];
73
73
  const COLOR_GRID_COLUMNS = 10;
74
74
  const COLOR_GRID_COLUMNS_PROPERTY = '--work-office-color-grid-columns';
75
- function OfficeColorPicker({ ariaLabel, value, onValueChange, disabled = false, compact = false, className = '', triggerLabel, triggerIcon }) {
75
+ function OfficeColorPicker({ ariaLabel, value, onValueChange, disabled = false, compact = false, className = '', resetAction, triggerLabel, triggerIcon }) {
76
76
  const [draft, setDraft] = useState(value);
77
77
  const [open, setOpen] = useState(false);
78
78
  const [activeIndex, setActiveIndex] = useState(()=>Math.max(0, OFFICE_COLORS.indexOf(value.toLowerCase())));
@@ -186,6 +186,27 @@ function OfficeColorPicker({ ariaLabel, value, onValueChange, disabled = false,
186
186
  }),
187
187
  children: (close)=>/*#__PURE__*/ jsxs(Fragment, {
188
188
  children: [
189
+ resetAction ? /*#__PURE__*/ jsxs("button", {
190
+ type: "button",
191
+ className: "work-office-color-reset",
192
+ "data-kind": resetAction.kind,
193
+ onClick: ()=>{
194
+ close();
195
+ resetAction.onSelect();
196
+ },
197
+ children: [
198
+ /*#__PURE__*/ jsx("span", {
199
+ className: "work-office-color-reset-swatch",
200
+ "aria-hidden": "true",
201
+ children: 'none' === resetAction.kind ? /*#__PURE__*/ jsx(Ban, {
202
+ size: 13
203
+ }) : null
204
+ }),
205
+ /*#__PURE__*/ jsx("span", {
206
+ children: resetAction.label
207
+ })
208
+ ]
209
+ }) : null,
189
210
  /*#__PURE__*/ jsxs("div", {
190
211
  className: "work-office-color-palette",
191
212
  role: "listbox",
@@ -2756,10 +2756,11 @@ const spreadsheetCommandCatalog = {
2756
2756
  group: 'font'
2757
2757
  },
2758
2758
  shortcut: {
2759
- label: 'Cmd/Ctrl+B',
2760
- aria: 'Control+B Meta+B',
2759
+ label: 'Cmd/Ctrl+B 或 Ctrl+2',
2760
+ aria: 'Control+B Meta+B Control+2',
2761
2761
  editor: [
2762
- 'Mod-b'
2762
+ 'Mod-b',
2763
+ 'Control-2'
2763
2764
  ]
2764
2765
  }
2765
2766
  },
@@ -2772,10 +2773,11 @@ const spreadsheetCommandCatalog = {
2772
2773
  group: 'font'
2773
2774
  },
2774
2775
  shortcut: {
2775
- label: 'Cmd/Ctrl+I',
2776
- aria: 'Control+I Meta+I',
2776
+ label: 'Cmd/Ctrl+I 或 Ctrl+3',
2777
+ aria: 'Control+I Meta+I Control+3',
2777
2778
  editor: [
2778
- 'Mod-i'
2779
+ 'Mod-i',
2780
+ 'Control-3'
2779
2781
  ]
2780
2782
  }
2781
2783
  },
@@ -2788,10 +2790,11 @@ const spreadsheetCommandCatalog = {
2788
2790
  group: 'font'
2789
2791
  },
2790
2792
  shortcut: {
2791
- label: 'Cmd/Ctrl+U',
2792
- aria: 'Control+U Meta+U',
2793
+ label: 'Cmd/Ctrl+U 或 Ctrl+4',
2794
+ aria: 'Control+U Meta+U Control+4',
2793
2795
  editor: [
2794
- 'Mod-u'
2796
+ 'Mod-u',
2797
+ 'Control-4'
2795
2798
  ]
2796
2799
  }
2797
2800
  },
@@ -6614,15 +6617,18 @@ function createSpreadsheetKeyboardShortcutExtension() {
6614
6617
  name: 'spreadsheetKeyboardShortcuts',
6615
6618
  addKeyboardShortcuts: ()=>({
6616
6619
  'Mod-a': ({ can, commands }, event)=>selectSpreadsheetFormulaBarContents(event) || runSpreadsheetSelectionScopeShortcut(event, can.selectCellRange, commands.selectCellRange, 'all'),
6617
- 'Mod-b': ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'bl'),
6620
+ [spreadsheetCommandCatalog.bold.shortcut.editor["0"]]: ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'bl'),
6621
+ [spreadsheetCommandCatalog.bold.shortcut.editor["1"]]: ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'bl'),
6618
6622
  'Mod-c': ({ can, commands }, event)=>runSpreadsheetClipboardShortcut(event, can.copySelection, commands.copySelection),
6619
6623
  'Mod-d': ({ can, commands }, event)=>runSpreadsheetFillShortcut(event, can.fillSelectedCells, commands.fillSelectedCells, 'down'),
6620
- 'Mod-i': ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'it'),
6624
+ [spreadsheetCommandCatalog.italic.shortcut.editor["0"]]: ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'it'),
6625
+ [spreadsheetCommandCatalog.italic.shortcut.editor["1"]]: ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'it'),
6621
6626
  'Mod-r': ({ can, commands }, event)=>runSpreadsheetFillShortcut(event, can.fillSelectedCells, commands.fillSelectedCells, 'right'),
6622
6627
  'Mod-v': ({ can, commands }, event)=>runSpreadsheetClipboardShortcut(event, can.pasteSelection, commands.pasteSelection),
6623
6628
  [spreadsheetCommandCatalog.pasteSpecial.shortcut.editor["0"]]: ({ can, commands }, event)=>runSpreadsheetPasteSpecialShortcut(event, can.openPasteSpecial, commands.openPasteSpecial),
6624
6629
  'Mod-x': ({ can, commands }, event)=>runSpreadsheetClipboardShortcut(event, can.cutSelection, commands.cutSelection),
6625
- 'Mod-u': ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'un'),
6630
+ [spreadsheetCommandCatalog.underline.shortcut.editor["0"]]: ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'un'),
6631
+ [spreadsheetCommandCatalog.underline.shortcut.editor["1"]]: ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'un'),
6626
6632
  'Mod-5': ({ can, commands, context }, event)=>runSpreadsheetCellFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'cl'),
6627
6633
  [spreadsheetCommandCatalog.numberFormatGeneral.shortcut.editor["0"]]: ({ can, commands, context }, event)=>runSpreadsheetNumberFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'general'),
6628
6634
  [spreadsheetCommandCatalog.numberFormatNumber.shortcut.editor["0"]]: ({ can, commands, context }, event)=>runSpreadsheetNumberFormatShortcut(event, context, can.setCellFormat, commands.setCellFormat, 'number'),
@@ -10609,7 +10615,12 @@ function SpreadsheetFontRibbonGroup({ can, commands, toolbarCell }) {
10609
10615
  ariaLabel: "文字颜色",
10610
10616
  value: textColor,
10611
10617
  disabled: !can.setCellFormat('fc', textColor),
10612
- onValueChange: (value)=>commands.setCellFormat('fc', value)
10618
+ onValueChange: (value)=>commands.setCellFormat('fc', value),
10619
+ resetAction: {
10620
+ kind: 'automatic',
10621
+ label: '自动颜色',
10622
+ onSelect: ()=>commands.setCellFormat('fc', void 0)
10623
+ }
10613
10624
  }),
10614
10625
  /*#__PURE__*/ jsx(OfficeColorPicker, {
10615
10626
  compact: true,
@@ -10617,7 +10628,12 @@ function SpreadsheetFontRibbonGroup({ can, commands, toolbarCell }) {
10617
10628
  ariaLabel: "填充颜色",
10618
10629
  value: fillColor,
10619
10630
  disabled: !can.setCellFormat('bg', fillColor),
10620
- onValueChange: (value)=>commands.setCellFormat('bg', value)
10631
+ onValueChange: (value)=>commands.setCellFormat('bg', value),
10632
+ resetAction: {
10633
+ kind: 'none',
10634
+ label: '无填充',
10635
+ onSelect: ()=>commands.setCellFormat('bg', void 0)
10636
+ }
10621
10637
  }),
10622
10638
  /*#__PURE__*/ jsx(SpreadsheetBorderRibbon, {
10623
10639
  can: can,