@a3s-lab/office 0.26.0 → 0.28.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 (87) hide show
  1. package/README.md +89 -2
  2. package/dist/0~4595.js +16 -2
  3. package/dist/0~5093.js +563 -201
  4. package/dist/0~6090.js +77 -77
  5. package/dist/{0~2805.js → 0~7043.js} +305 -2
  6. package/dist/0~document-editor.js +2633 -976
  7. package/dist/0~spreadsheet-editor.js +1324 -378
  8. package/dist/0~work-docx-export.js +737 -17
  9. package/dist/0~work-docx-import.js +173 -98
  10. package/dist/0~work-office-diagnostics.js +250 -5
  11. package/dist/{164.js → 1544.js} +1083 -785
  12. package/dist/4104.js +145 -29
  13. package/dist/5184.js +13 -0
  14. package/dist/6282.js +1898 -345
  15. package/dist/core.js +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/internal/features/work/editors/document-command-catalog.d.ts +102 -0
  18. package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +111 -0
  19. package/dist/internal/features/work/editors/document-font-dialog-script-font-model.d.ts +18 -0
  20. package/dist/internal/features/work/editors/document-font-dialog.d.ts +9 -0
  21. package/dist/internal/features/work/editors/document-home-ribbon.d.ts +2 -1
  22. package/dist/internal/features/work/editors/document-page-chrome-editor.d.ts +6 -0
  23. package/dist/internal/features/work/editors/document-page-chrome-ribbon.d.ts +2 -1
  24. package/dist/internal/features/work/editors/document-strike-ribbon.d.ts +7 -0
  25. package/dist/internal/features/work/editors/document-text-case-ribbon.d.ts +4 -0
  26. package/dist/internal/features/work/editors/document-toolbar.d.ts +3 -1
  27. package/dist/internal/features/work/editors/document-underline-ribbon.d.ts +9 -0
  28. package/dist/internal/features/work/editors/document-wps-shortcuts.d.ts +1 -0
  29. package/dist/internal/features/work/editors/spreadsheet-cell-fill-format.d.ts +11 -0
  30. package/dist/internal/features/work/editors/spreadsheet-cell-format.d.ts +2 -1
  31. package/dist/internal/features/work/editors/spreadsheet-format-cells-dialog-model.d.ts +13 -2
  32. package/dist/internal/features/work/editors/spreadsheet-format-cells-fill-panel.d.ts +13 -0
  33. package/dist/internal/features/work/editors/spreadsheet-format-cells-fill-preview.d.ts +6 -0
  34. package/dist/internal/features/work/editors/spreadsheet-format-painter.d.ts +1 -1
  35. package/dist/internal/features/work/editors/work-office-chrome.d.ts +9 -1
  36. package/dist/internal/features/work/work-document-character-formatting.d.ts +16 -1
  37. package/dist/internal/features/work/work-document-character-position.d.ts +9 -0
  38. package/dist/internal/features/work/work-document-character-scale.d.ts +8 -0
  39. package/dist/internal/features/work/work-document-character-spacing.d.ts +8 -0
  40. package/dist/internal/features/work/work-document-emphasis.d.ts +7 -0
  41. package/dist/internal/features/work/work-document-equations.d.ts +2 -1
  42. package/dist/internal/features/work/work-document-format-changes.d.ts +20 -2
  43. package/dist/internal/features/work/work-document-hidden-text.d.ts +5 -0
  44. package/dist/internal/features/work/work-document-kerning.d.ts +10 -0
  45. package/dist/internal/features/work/work-document-legacy-text-effects.d.ts +27 -0
  46. package/dist/internal/features/work/work-document-script-font-extension.d.ts +2 -0
  47. package/dist/internal/features/work/work-document-script-fonts.d.ts +51 -0
  48. package/dist/internal/features/work/work-document-strike.d.ts +21 -0
  49. package/dist/internal/features/work/work-document-text-case.d.ts +10 -0
  50. package/dist/internal/features/work/work-document-underline.d.ts +37 -0
  51. package/dist/internal/features/work/work-document-word-line-metrics.d.ts +16 -0
  52. package/dist/internal/features/work/work-docx-character-position.d.ts +2 -0
  53. package/dist/internal/features/work/work-docx-character-scale.d.ts +2 -0
  54. package/dist/internal/features/work/work-docx-character-spacing.d.ts +4 -0
  55. package/dist/internal/features/work/work-docx-emphasis-diagnostics.d.ts +3 -0
  56. package/dist/internal/features/work/work-docx-emphasis.d.ts +14 -0
  57. package/dist/internal/features/work/work-docx-hidden-text-diagnostics.d.ts +3 -0
  58. package/dist/internal/features/work/work-docx-hidden-text-export.d.ts +17 -0
  59. package/dist/internal/features/work/work-docx-hidden-text.d.ts +11 -0
  60. package/dist/internal/features/work/work-docx-kerning-diagnostics.d.ts +3 -0
  61. package/dist/internal/features/work/work-docx-kerning.d.ts +14 -0
  62. package/dist/internal/features/work/work-docx-legacy-text-effects-diagnostics.d.ts +3 -0
  63. package/dist/internal/features/work/work-docx-legacy-text-effects-export.d.ts +18 -0
  64. package/dist/internal/features/work/work-docx-legacy-text-effects.d.ts +12 -0
  65. package/dist/internal/features/work/work-docx-run-fonts-diagnostics.d.ts +3 -0
  66. package/dist/internal/features/work/work-docx-run-fonts-export.d.ts +14 -0
  67. package/dist/internal/features/work/work-docx-run-fonts.d.ts +13 -0
  68. package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +27 -2
  69. package/dist/internal/features/work/work-docx-run-property-order.d.ts +2 -0
  70. package/dist/internal/features/work/work-docx-run-script-font-import.d.ts +9 -0
  71. package/dist/internal/features/work/work-docx-strike.d.ts +8 -0
  72. package/dist/internal/features/work/work-docx-theme-reference.d.ts +1 -1
  73. package/dist/internal/features/work/work-docx-twips.d.ts +6 -0
  74. package/dist/internal/features/work/work-docx-underline.d.ts +3 -0
  75. package/dist/internal/features/work/work-spreadsheet-gradient-fill-canvas.d.ts +10 -0
  76. package/dist/internal/features/work/work-spreadsheet-native-fill-canvas.d.ts +8 -0
  77. package/dist/internal/features/work/work-spreadsheet-pattern-fill-canvas.d.ts +8 -0
  78. package/dist/internal/features/work/work-xlsx-cell-style-origin.d.ts +2 -1
  79. package/dist/internal/features/work/work-xlsx-cell-style-writer.d.ts +3 -0
  80. package/dist/internal/features/work/work-xlsx-cell-styles.d.ts +4 -0
  81. package/dist/internal/features/work/work-xlsx-gradient-fill.d.ts +31 -0
  82. package/dist/internal/features/work/work-xlsx-native-fill.d.ts +17 -0
  83. package/dist/internal/features/work/work-xlsx-pattern-fill.d.ts +21 -0
  84. package/dist/office-kernel.wasm +0 -0
  85. package/dist/styles.css +809 -78
  86. package/docs/latest/en/browser-editor-architecture.md +24 -0
  87. package/package.json +35 -1
package/README.md CHANGED
@@ -110,7 +110,7 @@ baseline rather than one specific release.
110
110
 
111
111
  | Capability | A3S Office today | Traditional Office baseline |
112
112
  | --- | --- | --- |
113
- | Text, paragraphs, lists, and styles | **Supported** — structured editing, formatting, clipboard, format painter, and undo/redo | Mature authoring with a broader long-tail style catalog |
113
+ | Text, paragraphs, lists, and styles | **Supported** — structured editing, independent native ASCII, high ANSI, East Asian, and complex-script font slots with direct/theme identity, native all-caps and small-caps effects, exact DOCX character scale plus signed spacing, half-point kerning thresholds, all five native East Asian emphasis marks, native hidden text with explicit visible resets, four independent native outline/shadow/emboss/imprint effects with conflict-safe authoring, and baseline position in one advanced font dialog, all 18 native DOCX underline values with direct or theme color identity, independent native single/double strikethrough with explicit resets, formatting revisions, clipboard, format painter, and undo/redo | Mature authoring with a broader long-tail style and typography catalog |
114
114
  | Page layout and rendering | **Partial** — sections, margins, page size, columns, headers/footers, fields, and live pagination | Desktop-grade pagination, print layout, and vector output |
115
115
  | Tables, pictures, and equations | **Partial** — rich table geometry, floating pictures, crop/wrap, and structured OMML | Broader drawings, text boxes, charts, WordArt, and SmartArt |
116
116
  | Comments, revisions, and collaboration | **Partial** — comments, suggestions, text/format revisions, decisions, Yjs presence, and host relay contracts | Full revision families plus integrated sharing and review services |
@@ -124,7 +124,7 @@ baseline rather than one specific release.
124
124
  | Capability | A3S Office today | Traditional Office baseline |
125
125
  | --- | --- | --- |
126
126
  | Cells, sheets, navigation, and history | **Supported** — multiple sheets, sparse editing, search, clipboard, four-direction fill, exact formula/value copy from above, and undo/redo | Mature grid workflows across desktop and web |
127
- | Formatting and style rendering | **Partial** — native fonts, colors, borders, alignment, number formats, cell styles, static date/time entry, contrast-safe font preview, native XLSX rich-text runs, selected-text font formatting, direct formula-bar/F2 insertion or deletion, and bounded authenticated formatted-HTML paste | Disjoint multi-edit rich-text authoring, themes, locale formats, and advanced style effects |
127
+ | Formatting and style rendering | **Partial** — native fonts, colors, borders, alignment, number formats, cell styles, all 17 native non-solid OOXML pattern fills, native linear/path XLSX gradients, and one Format Cells surface that authors none, solid, pattern, or gradient fills with exact geometry and 2–256 ordered stops; static date/time entry, contrast-safe font preview, native XLSX rich-text runs, selected-text font formatting, direct formula-bar/F2 insertion or deletion, and bounded authenticated formatted-HTML paste | Disjoint multi-edit rich-text authoring, broader themes, locale formats, and advanced style effects |
128
128
  | Ribbon and shortcuts | **Partial** — common Office-style Home/Data/View commands, grid-scoped shortcuts, and focused Font-dialog aliases | Larger command catalog and platform-specific accelerators |
129
129
  | Formulas and recalculation | **Partial** — dependency-aware calculation and common formula paths | Wider functions, arrays, volatile semantics, and calculation parity |
130
130
  | Tables, pivots, charts, and rules | **Partial** — native tables, pivots, charts, conditional formatting, and validation | Calculated columns, slicers, pivot charts, advanced rules, and analysis |
@@ -577,6 +577,38 @@ Protection ranges, passwordless editable ranges, and conditional formatting
577
577
  also remain compact and round-trip through native XLSX records without
578
578
  allocating every covered cell.
579
579
 
580
+ Native XLSX pattern fills retain all 17 non-solid OOXML pattern identities plus
581
+ their foreground and background RGB, theme, indexed, automatic, and tint color
582
+ origins. Canvas draws them only for visible cells, behind text and below table
583
+ or conditional-format fills. Format Painter, Paste Special Formats, unrelated
584
+ formatting, Yjs collaboration, export, and reopen preserve the metadata; a new
585
+ solid fill, No Fill, Clear Formats, or built-in Cell Style intentionally clears
586
+ it. Malformed patterns fail closed, and semantic palette conflicts export
587
+ literal RGB instead of a false theme or indexed reference.
588
+
589
+ Format Cells now authors every native pattern through one typed fill model.
590
+ Users can switch between none, solid, all 17 pattern types, and gradients while
591
+ retaining inactive drafts, preview the exact Canvas result, and edit pattern
592
+ foreground/background colors. Apply publishes one controlled workbook update
593
+ and one Undo record; export and reopen retain the authored native pattern.
594
+
595
+ Native XLSX gradient fills retain linear angles, path inner-rectangle geometry,
596
+ two through 256 ordered stops, and each stop's RGB, theme, indexed, automatic,
597
+ or tint identity. Fortune projects the first stop into `bg`; metadata remains
598
+ active only while that projection matches. Visible linear fills use Canvas
599
+ gradients, while path fills use at most 96 clipped rectangular contours, so
600
+ off-viewport cells do no work and rendering stays bounded. Format Painter,
601
+ Paste Special Formats, unrelated edits, Yjs collaboration, export, and reopen
602
+ preserve the fill. Explicit fills and format resets clear it, malformed input
603
+ fails closed, and semantic palette conflicts fall back to literal RGB.
604
+
605
+ The same Format Cells Fill tab authors linear or path gradients without a
606
+ second style state. It exposes exact angle or inner-rectangle geometry, 2–256
607
+ ordered stops, midpoint insertion with interpolated color, stop removal and
608
+ editing, mixed-selection safeguards, and a live native Canvas preview. Invalid
609
+ stop order or path geometry blocks Apply before mutation; an accepted Apply
610
+ remains one controlled update and one Undo record.
611
+
580
612
  Worksheet Tables/ListObjects live in `sheet.tables` as semantic records with
581
613
  stable IDs, workbook-unique names, zero-based ranges, ordered columns, filters,
582
614
  header/totals flags, and built-in style identity. XLSX import and export keep
@@ -647,6 +679,59 @@ Changed, duplicate, namespace-spoofed, relationship-bound, or semantic drawing
647
679
  branches stay disconnected; generated geometry and media remain authoritative,
648
680
  while legacy VML, shapes, and SmartArt normalize.
649
681
 
682
+ Native Writer fonts retain the four independent WordprocessingML `w:rFonts`
683
+ slots: `ascii`, `hAnsi`, `eastAsia`, and `cs`, together with their theme
684
+ references and script hint. Mixed-script runs become bounded semantic spans so
685
+ Latin, high ANSI, East Asian, and complex-script text each use the correct
686
+ resolved browser family without rewriting the native source identity. The
687
+ shared `Cmd/Ctrl+D` dialog exposes separate Latin, East Asian, and complex-text
688
+ font controls, preserves untouched mixed selections, supports Follow style,
689
+ uses one transaction and Undo record for combined character changes, and
690
+ renders a script-aware preview. The Home font menu intentionally applies one
691
+ all-text choice to all four slots. Body text, page chrome, notes, formatting
692
+ revisions, strict/transitional import, exact export, and reopen share the typed
693
+ model; malformed, duplicate, oversized, child-bearing, text-bearing, unknown,
694
+ or namespace-spoofed `w:rFonts` data fails closed and is diagnosed.
695
+
696
+ Native Writer text also authors and reopens all five WordprocessingML `w:em`
697
+ values: `none`, `dot`, `comma`, `circle`, and `underDot`. The shared
698
+ `Cmd/Ctrl+D` advanced font dialog keeps mixed selections untouched until an
699
+ explicit choice, distinguishes removing direct formatting from writing an
700
+ explicit `none` inheritance reset, restores focus and selection, and commits
701
+ with the other character settings in one transaction and one Undo record. Body
702
+ text, headers, footers, footnotes, endnotes, inherited styles, Format Painter,
703
+ formatting revisions, strict/transitional import, export, and reopen retain the
704
+ typed value. The DOM projects it through `data-office-emphasis-mark` and CSS
705
+ `text-emphasis-*`; paragraphs with visible marks use browser-authoritative line
706
+ measurement so their out-of-line glyph extents are not approximated by the
707
+ Worker/WASM shaper. No dedicated shortcut is invented.
708
+
709
+ Native Writer hidden text retains three distinct states: inherited formatting,
710
+ native `w:vanish`, and an explicit `w:vanish w:val="0"` visible reset. The
711
+ shared `Cmd/Ctrl+D` dialog preserves mixed selections until the checkbox is
712
+ edited, while the standard `Cmd/Ctrl+Shift+H` command toggles the same typed
713
+ mark and produces one Undo record. Body text, page chrome, footnotes, endnotes,
714
+ Format Painter, formatting revisions, strict/transitional style inheritance,
715
+ exact DOCX export, and reopen retain the value. Hidden text is suppressed by
716
+ default; the View ribbon can reveal it only on editable Writer surfaces with a
717
+ dotted underline. Read-only preview and detached PDF capture always suppress
718
+ it. Unchanged comment XML remains source-preserved without claiming rich
719
+ comment-text editing, and affected paragraphs use browser-authoritative line
720
+ measurement so invisible glyphs never distort Worker/WASM pagination.
721
+
722
+ Native Writer outline, shadow, emboss, and imprint retain four independent
723
+ nullable TextStyle properties backed by exact `w:outline`, `w:shadow`,
724
+ `w:emboss`, and `w:imprint` values. Missing properties continue style
725
+ inheritance and explicit false values remain native resets. Outline and shadow
726
+ can be enabled together; emboss and imprint are mutually exclusive with every
727
+ other enabled effect. The shared `Cmd/Ctrl+D` dialog exposes four independently
728
+ mixed checkboxes, clears conflicts in the same transaction, and creates one
729
+ Undo record. Body text, page chrome, notes, Format Painter, formatting
730
+ revisions, strict/transitional import, exact export, and reopen share the same
731
+ model. CSS provides bounded browser and PDF paint projections while eligible
732
+ paragraphs remain on the Worker/WASM layout path. The Playground's **文字效果**
733
+ template demonstrates all four effects and the conflict-safe transition.
734
+
650
735
  Supported native OMML equations now survive as bounded structured objects in
651
736
  the document body, headers, footers, footnotes, and endnotes. Inline and display
652
737
  math, Unicode runs with literal/normal-text semantics, math script/style,
@@ -1347,6 +1432,8 @@ without hard-coded return URLs.
1347
1432
 
1348
1433
  - [Live Playground](https://a3s-lab.github.io/Office/)
1349
1434
  - [Documentation center](https://a3s-lab.github.io/Office/docs/)
1435
+ - [A3S Office 0.28.0 documentation](https://a3s-lab.github.io/Office/docs/0.28.0/)
1436
+ - [A3S Office 0.27.0 documentation](https://a3s-lab.github.io/Office/docs/0.27.0/)
1350
1437
  - [A3S Office 0.26.0 documentation](https://a3s-lab.github.io/Office/docs/0.26.0/)
1351
1438
  - [A3S Office 0.25.0 documentation](https://a3s-lab.github.io/Office/docs/0.25.0/)
1352
1439
  - [A3S Office 0.24.0 documentation](https://a3s-lab.github.io/Office/docs/0.24.0/)
package/dist/0~4595.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Fragment as jsx_runtime_Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Fragment, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { createPortal } from "react-dom";
4
- import { Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Eye, Minus, Plus, X } from "lucide-react";
4
+ import { ArrowUpRight, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Eye, Minus, Plus, X } from "lucide-react";
5
5
  import { WorkOfficeCollaborationParticipants, moveOfficeMenuFocus, useDialogFocusScope, icon_button_IconButton, Popover, matchesAriaKeyShortcuts, officeOverlayPortalRoot } from "./0~6090.js";
6
6
  const CONTEXT_MENU_MARGIN = 8;
7
7
  const CONTEXT_MENU_TAB_STOP_SELECTOR = 'a[href]:not([tabindex="-1"]), button:not(:disabled):not([tabindex="-1"]), input:not(:disabled):not([type="hidden"]):not([tabindex="-1"]), select:not(:disabled):not([tabindex="-1"]), textarea:not(:disabled):not([tabindex="-1"]), [contenteditable="true"]:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])';
@@ -1164,11 +1164,12 @@ function WorkOfficeFileMenu({ actions }) {
1164
1164
  })
1165
1165
  });
1166
1166
  }
1167
- function WorkOfficeRibbonGroup({ label, priority = 'normal', children }) {
1167
+ function WorkOfficeRibbonGroup({ label, priority = 'normal', dialogLauncher, children }) {
1168
1168
  return /*#__PURE__*/ jsxs("section", {
1169
1169
  className: "work-office-ribbon-group",
1170
1170
  "aria-label": label,
1171
1171
  "data-priority": priority,
1172
+ "data-has-dialog-launcher": dialogLauncher ? 'true' : void 0,
1172
1173
  children: [
1173
1174
  /*#__PURE__*/ jsx("div", {
1174
1175
  children: children
@@ -1176,6 +1177,19 @@ function WorkOfficeRibbonGroup({ label, priority = 'normal', children }) {
1176
1177
  /*#__PURE__*/ jsx("span", {
1177
1178
  "aria-hidden": "true",
1178
1179
  children: label
1180
+ }),
1181
+ dialogLauncher && /*#__PURE__*/ jsx("button", {
1182
+ type: "button",
1183
+ className: "work-office-ribbon-dialog-launcher",
1184
+ "aria-label": dialogLauncher.label,
1185
+ "aria-keyshortcuts": dialogLauncher.ariaKeyShortcuts,
1186
+ title: dialogLauncher.shortcut ? `${dialogLauncher.label}(${dialogLauncher.shortcut})` : dialogLauncher.label,
1187
+ onMouseDown: (event)=>event.preventDefault(),
1188
+ onClick: dialogLauncher.onClick,
1189
+ children: /*#__PURE__*/ jsx(ArrowUpRight, {
1190
+ size: 9,
1191
+ "aria-hidden": "true"
1192
+ })
1179
1193
  })
1180
1194
  ]
1181
1195
  });