@a3s-lab/office 0.37.0 → 0.37.1

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 (53) hide show
  1. package/README.md +6 -1
  2. package/dist/0~3557.js +2 -1
  3. package/dist/0~3635.js +4 -1
  4. package/dist/0~9073.js +7 -2
  5. package/dist/0~presentation-editor.js +45 -9
  6. package/dist/0~spreadsheet-editor.js +13345 -10343
  7. package/dist/{3266.js → 5416.js} +1139 -15
  8. package/dist/9333.js +1 -1
  9. package/dist/core.d.ts +1 -0
  10. package/dist/core.js +112 -26
  11. package/dist/index.js +1 -1
  12. package/dist/internal/features/work/editors/office-shortcuts.d.ts +1 -0
  13. package/dist/internal/features/work/editors/spreadsheet-auto-filter-command.d.ts +3 -0
  14. package/dist/internal/features/work/editors/spreadsheet-auto-filter-condition-dialog-model.d.ts +27 -0
  15. package/dist/internal/features/work/editors/spreadsheet-auto-filter-condition-dialog.d.ts +17 -0
  16. package/dist/internal/features/work/editors/spreadsheet-auto-filter-menu.d.ts +10 -0
  17. package/dist/internal/features/work/editors/spreadsheet-auto-filter.d.ts +16 -4
  18. package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +1 -0
  19. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +9 -0
  20. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +13 -1
  21. package/dist/internal/features/work/editors/spreadsheet-current-region.d.ts +12 -0
  22. package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +3 -0
  23. package/dist/internal/features/work/editors/spreadsheet-sort-appearance.d.ts +45 -0
  24. package/dist/internal/features/work/editors/spreadsheet-sort-collation.d.ts +8 -0
  25. package/dist/internal/features/work/editors/spreadsheet-sort-command.d.ts +3 -0
  26. package/dist/internal/features/work/editors/spreadsheet-sort-custom-list-editor.d.ts +8 -0
  27. package/dist/internal/features/work/editors/spreadsheet-sort-custom-list-store.d.ts +13 -0
  28. package/dist/internal/features/work/editors/spreadsheet-sort-custom-list.d.ts +26 -0
  29. package/dist/internal/features/work/editors/spreadsheet-sort-dialog.d.ts +9 -0
  30. package/dist/internal/features/work/editors/spreadsheet-sort-matrix.d.ts +4 -0
  31. package/dist/internal/features/work/editors/spreadsheet-sort-options-dialog.d.ts +7 -0
  32. package/dist/internal/features/work/editors/spreadsheet-sort-order-controls.d.ts +16 -0
  33. package/dist/internal/features/work/editors/spreadsheet-sort-range-dialog.d.ts +7 -0
  34. package/dist/internal/features/work/editors/spreadsheet-sort.d.ts +138 -0
  35. package/dist/internal/features/work/editors/use-spreadsheet-auto-filter.d.ts +12 -3
  36. package/dist/internal/features/work/editors/use-spreadsheet-sort.d.ts +26 -0
  37. package/dist/internal/features/work/editors/work-office-chrome.d.ts +3 -0
  38. package/dist/internal/features/work/work-spreadsheet-auto-filter.d.ts +14 -0
  39. package/dist/internal/features/work/work-spreadsheet-dynamic-filter.d.ts +7 -0
  40. package/dist/internal/features/work/work-spreadsheet-filter-contract.d.ts +3 -0
  41. package/dist/internal/features/work/work-spreadsheet-wildcard.d.ts +7 -0
  42. package/dist/internal/features/work/work-types.d.ts +31 -7
  43. package/dist/internal/features/work/work-xlsx-interop.d.ts +2 -1
  44. package/dist/internal/features/work/work-xlsx-table-filters.d.ts +3 -1
  45. package/dist/office-kernel.wasm +0 -0
  46. package/dist/styles.css +544 -20
  47. package/dist/vue.d.ts +3 -1
  48. package/dist/vue.js +2 -0
  49. package/dist/web-component.d.ts +3 -1
  50. package/dist/web-component.js +9 -0
  51. package/dist/work-spreadsheet-package-scan.worker.js +2 -1
  52. package/docs/latest/en/browser-editor-architecture.md +128 -0
  53. package/package.json +21 -1
@@ -3985,6 +3985,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
3985
3985
  }
3986
3986
  const IMPORTED_WORKSHEET_ELEMENTS = new Set([
3987
3987
  'pane',
3988
+ 'autoFilter',
3988
3989
  'dataValidation',
3989
3990
  'conditionalFormatting',
3990
3991
  'sheetProtection',
@@ -4012,7 +4013,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
4012
4013
  'rowBreaks',
4013
4014
  'colBreaks'
4014
4015
  ]);
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
+ const WORKSHEET_SCAN_PATTERN = /<(?:[A-Za-z_][\w.-]*:)?(?:(cols|f|pane|autoFilter|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
4017
  function scanXlsxWorksheetXml(source) {
4017
4018
  let hasDirectCellStyles = false;
4018
4019
  let hasDiagnosticFeatures = false;
@@ -1439,6 +1439,134 @@ changes, and table renames; and `totalsRowFunction`, `totalsRowLabel`, and
1439
1439
  protected, overlapping, AutoFilter, unsafe, external, and over-budget targets
1440
1440
  fail closed. Slicers and external/query tables remain open gates.
1441
1441
 
1442
+ Value-based multi-key Custom Sort is now owned by a separate
1443
+ `spreadsheetSort` editor extension rather than the row/column structure
1444
+ extension. The command freezes one continuous selection, derives a header
1445
+ candidate, and validates up to 64 unique keys before cloning and stably sorting
1446
+ complete cell rows or columns. A nested Traditional Office-compatible Sort Options dialog
1447
+ selects top-to-bottom column keys or left-to-right row keys; the latter disables
1448
+ header retention because every selected column moves. The same normalized
1449
+ options select Simplified Chinese pinyin or stroke collation and optional case
1450
+ sensitivity. A key is a closed union
1451
+ of ascending/descending value order, an explicit custom sequence, or an
1452
+ effective cell-color, font-color, or conditional-icon target with axis-aware
1453
+ first/last placement. The
1454
+ `spreadsheet-sort-custom-list` model owns
1455
+ normalization, duplicate and size guards, seven immutable month/weekday lists,
1456
+ and rank matching; the validated request clones custom entries so command
1457
+ execution has no dependency on mutable UI state. The browser adapters own a
1458
+ bounded user-list registry and never writes preferences into controlled
1459
+ workbook content. Without a store it remains scoped to the mounted session.
1460
+ The optional typed `SpreadsheetSortCustomListStore` synchronously loads and
1461
+ saves canonical lists through a host-selected local backend. The provided
1462
+ `LocalStorageSpreadsheetSortCustomListStore` accepts an injected Storage
1463
+ object, uses a versioned key, and validates, deduplicates, and caps reads at 32
1464
+ lists. Corrupt reads fail closed; a rejected write visibly downgrades the new
1465
+ list to session scope. A stored list precedes an identical request-carried
1466
+ session copy so persistence identity remains stable. The separate
1467
+ `spreadsheet-sort-appearance` model snapshots direct native styles plus
1468
+ calculated conditional-format output, preserves no-fill/automatic identities,
1469
+ and declines to flatten native patterns or gradients into one color. The
1470
+ command reconstructs that snapshot from controlled sheet state and the live
1471
+ range immediately before execution, then validates its shape and target
1472
+ identities. The `spreadsheet-sort-collation` boundary compiles one local
1473
+ `Intl.Collator` per request, keeps numeric text lexical, behavior-probes the
1474
+ requested order instead of trusting runtime-specific resolved labels, and fails
1475
+ closed when that order is unavailable. A direction-neutral matrix engine transposes only its bounded item
1476
+ view, then uses one stable comparator for both orientations. Relative formula
1477
+ references are translated along the moved row or column axis with the same
1478
+ bounded reference engine used by Paste Special, while absolute references stay
1479
+ fixed.
1480
+ One accepted operation crosses the Fortune boundary as one range write and one
1481
+ controlled Undo record. Table, worksheet-AutoFilter, hyperlink-map,
1482
+ imported-formula-metadata, and border-sidecar intersections fail closed because
1483
+ those models still own coordinates outside the cell matrix. Moving large sorts,
1484
+ large aggregate/rank scans, remaining advanced filter predicates, full custom-list preference
1485
+ management, and structural sidecar reconciliation into the Worker/WASM kernel
1486
+ remains Stage 3 work.
1487
+ Direct host focus of the native grid now enters the same bounded focus observer
1488
+ used by ribbon commands. If a controlled workbook update replaces the focused
1489
+ Fortune overlay, focus transfers to its connected replacement; deliberate
1490
+ pointer, Tab, or active text-editor movement still cancels restoration.
1491
+
1492
+ Worksheet AutoFilter conditions now have a separate A3S-owned model and typed
1493
+ `spreadsheetAutoFilter` command extension. A versioned condition payload lives
1494
+ inside each Fortune filter column only as the grid projection; the controlled
1495
+ sheet, absolute header column, exact filter range, and editable state are
1496
+ reauthenticated before mutation. The pure evaluator reads dense or sparse cells
1497
+ and derives one hidden-row set per column. Their union drives Fortune row
1498
+ visibility, while an explicit overlap marker keeps independently hidden rows
1499
+ separate when a criterion is replaced or removed. This gives one source of
1500
+ truth for multi-column ownership instead of inferring provenance from the
1501
+ combined `config.rowhidden` map.
1502
+
1503
+ Same-column custom conditions use a separate fixed pair inside the closed
1504
+ filter union. Each item is a nonrecursive single-value predicate and the pair
1505
+ has one explicit AND/OR discriminator. The evaluator composes exactly two
1506
+ matchers, collaboration validation rejects any nested or differently sized
1507
+ condition array, and the dialog cannot attach a second condition to range,
1508
+ blank, Top/Bottom, or dynamic families.
1509
+
1510
+ Wildcard expressions are two additional nonrecursive custom-condition
1511
+ variants, so existing equality and other text operands remain literal. A pure
1512
+ compiler tokenizes `*`, `?`, and `~` once per criterion, normalizes literal
1513
+ segments and cell text with NFKC plus the existing locale-pinned lowercase
1514
+ folding, and evaluates the token sequence without executing or interpolating
1515
+ user text. The same 32,767-character operand ceiling is enforced by the dialog,
1516
+ model, command, and collaboration boundaries. Literal-only spans use ordered
1517
+ substring search; long fixed-width candidate scans switch to a bounded bitset
1518
+ matcher instead of quadratically rescanning late mismatches.
1519
+
1520
+ Top/Bottom criteria take a separate aggregate path before the per-cell matcher.
1521
+ The evaluator gathers finite numeric values from the filter column, converts a
1522
+ percentage to `ceil(n * percent / 100)` items, sorts in the requested direction,
1523
+ and uses the selected boundary as a comparison threshold. Every equal boundary
1524
+ value remains visible, while text, Boolean, blank, and nonfinite cells do not
1525
+ enter the ranking domain. Dense and sparse cell readers share this path, and
1526
+ the resulting hidden-row set remains one independently owned column entry.
1527
+
1528
+ Dynamic criteria use a separate pure compiler with an explicit local-clock
1529
+ context. Above/below-average consumes the column as an iterable, calculates one
1530
+ finite numeric mean, and returns a strict matcher without retaining the column.
1531
+ Date families compile one inclusive-start/exclusive-end serial interval and do
1532
+ not pre-read the column. They accept imported `Date` objects or finite numeric
1533
+ cells explicitly marked `ct.t='d'`, recover SheetJS local-date serials across
1534
+ time zones, reject the fictional serial 60, and never classify an unformatted
1535
+ number as a date. Relative weeks begin on Sunday; calendar month and quarter
1536
+ families classify independently of year. Column profiling is cached per
1537
+ immutable sheet and keeps typed dates out of numeric rank actions. The editor
1538
+ uses the current local clock, while model tests inject a deterministic clock.
1539
+ The controlled model still normalizes dates to the 1900 system; source-level
1540
+ 1904 retention remains an explicit import boundary.
1541
+
1542
+ The same closed `WorkSpreadsheetFilterCriteria` union now serves worksheet and
1543
+ table native OOXML. Package scan and import read only the worksheet root's
1544
+ direct `<autoFilter>` child, hydrate supported criteria, and retain imported
1545
+ unsupported typed criteria without pretending to evaluate them. Export patches
1546
+ the generated worksheet element with native `<filterColumn>` children. General
1547
+ two-item `<customFilters and="1|0">` groups, arbitrary positive/negative
1548
+ wildcard expressions, negative prefix/suffix forms, and
1549
+ `<top10 top="..." percent="..." val="..."/>` criteria round-trip through the
1550
+ shared worksheet/table path. Imported native dynamic filters are recomputed
1551
+ from current cells and emitted as native `<dynamicFilter>` elements. Canonical
1552
+ edge-star patterns still normalize to
1553
+ the narrower contains, begins-with, or ends-with variants. The
1554
+ React adapter owns only vendor-menu discovery, the accessible condition dialog,
1555
+ short-lived selection preservation, and focus restoration; unsafe vendor sort
1556
+ items are not exposed because they bypass typed sort and structural guards.
1557
+
1558
+ Partial-range planning is a separate controlled concern. The shared
1559
+ `spreadsheet-current-region` model reads dense `data` and sparse `celldata`
1560
+ without materializing worksheet dimensions, so AutoFilter and Sort cannot
1561
+ derive different bounds. The command layer creates exact and expanded
1562
+ candidates and evaluates mutation and structural guards independently. The
1563
+ React adapter owns only the accessible warning/custom-dialog transition and a
1564
+ short-lived authorization containing the frozen sort request plus its original
1565
+ selection. The command accepts an expanded destination only while the live
1566
+ selection still matches that origin; stale host state therefore fails closed.
1567
+ The header heuristic likewise reads raw non-formula text instead of formatted
1568
+ display strings, keeping numeric and formula result rows in the data body.
1569
+
1442
1570
  Exit criteria: scrolling and selection do not scale with total row count;
1443
1571
  incremental recalculation touches only affected dependency subgraphs; XLSX
1444
1572
  fixtures preserve formulas, styles, names, validation, conditional formatting,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a3s-lab/office",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "Open-source collaborative browser editors for documents, Markdown, spreadsheets, presentations, and PDFs.",
5
5
  "keywords": [
6
6
  "office",
@@ -104,6 +104,12 @@
104
104
  "playground:visual:spreadsheet-data-validation": "playwright test visual-tests/spreadsheet-data-validation.functional.spec.ts --config playwright.config.ts",
105
105
  "playground:visual:spreadsheet-date-time": "playwright test visual-tests/spreadsheet-date-time.functional.spec.ts --config playwright.config.ts",
106
106
  "playground:visual:spreadsheet-copy-from-above": "playwright test visual-tests/spreadsheet-copy-from-above.functional.spec.ts --config playwright.config.ts",
107
+ "playground:visual:spreadsheet-custom-sort": "playwright test visual-tests/spreadsheet-custom-sort.functional.spec.ts --config playwright.config.ts",
108
+ "playground:visual:spreadsheet-custom-list-sort": "playwright test visual-tests/spreadsheet-custom-list-sort.functional.spec.ts --config playwright.config.ts",
109
+ "playground:visual:spreadsheet-appearance-sort": "playwright test visual-tests/spreadsheet-appearance-sort.functional.spec.ts --config playwright.config.ts",
110
+ "playground:visual:spreadsheet-row-sort": "playwright test visual-tests/spreadsheet-row-sort.functional.spec.ts --config playwright.config.ts",
111
+ "playground:visual:spreadsheet-text-sort": "playwright test visual-tests/spreadsheet-text-sort.functional.spec.ts --config playwright.config.ts",
112
+ "playground:visual:spreadsheet-sort-range": "playwright test visual-tests/spreadsheet-sort-range.functional.spec.ts --config playwright.config.ts",
107
113
  "playground:visual:spreadsheet-font-dialog-shortcuts": "playwright test visual-tests/spreadsheet-font-dialog-shortcuts.functional.spec.ts --config playwright.config.ts",
108
114
  "playground:visual:spreadsheet-diagonal-borders": "playwright test visual-tests/spreadsheet-diagonal-borders.functional.spec.ts --config playwright.config.ts",
109
115
  "playground:visual:spreadsheet-font-colors-shortcuts": "playwright test visual-tests/spreadsheet-font-colors-shortcuts.functional.spec.ts --config playwright.config.ts",
@@ -137,6 +143,8 @@
137
143
  "test:e2e:pdf-page-organization:check": "a3s-test check tests/e2e/pdf-page-organization.acl --json",
138
144
  "test:e2e:presentation-animation": "A3S_TEST_SUITE=tests/e2e/presentation-animation.acl bash scripts/run-a3s-test-web-gate.sh",
139
145
  "test:e2e:presentation-animation:check": "a3s-test check tests/e2e/presentation-animation.acl --json",
146
+ "test:e2e:presentation-chinese-ime": "A3S_TEST_SUITE=tests/e2e/presentation-chinese-ime.acl bash scripts/run-a3s-test-web-gate.sh",
147
+ "test:e2e:presentation-chinese-ime:check": "a3s-test check tests/e2e/presentation-chinese-ime.acl --json",
140
148
  "test:e2e:large-presentation": "bun .a3s-test/performance/generate-fixtures.ts --presentations-only && a3s-test run tests/e2e/presentation-large-windowing.acl --json",
141
149
  "test:e2e:large-presentation:check": "a3s-test check tests/e2e/presentation-large-windowing.acl --json",
142
150
  "test:e2e:initial-focus": "a3s-test run tests/e2e/office-editor-initial-focus.acl --json",
@@ -181,6 +189,18 @@
181
189
  "test:e2e:spreadsheet-table:check": "a3s-test check tests/e2e/spreadsheet-table.acl --json",
182
190
  "test:e2e:spreadsheet-table-totals": "a3s-test run tests/e2e/spreadsheet-table-totals.acl --json",
183
191
  "test:e2e:spreadsheet-table-totals:check": "a3s-test check tests/e2e/spreadsheet-table-totals.acl --json",
192
+ "test:e2e:spreadsheet-custom-sort": "A3S_TEST_SUITE=tests/e2e/spreadsheet-custom-sort.acl bash scripts/run-a3s-test-web-gate.sh",
193
+ "test:e2e:spreadsheet-custom-sort:check": "a3s-test check tests/e2e/spreadsheet-custom-sort.acl --json",
194
+ "test:e2e:spreadsheet-custom-list-sort": "A3S_TEST_SUITE=tests/e2e/spreadsheet-custom-list-sort.acl bash scripts/run-a3s-test-web-gate.sh",
195
+ "test:e2e:spreadsheet-custom-list-sort:check": "a3s-test check tests/e2e/spreadsheet-custom-list-sort.acl --json",
196
+ "test:e2e:spreadsheet-appearance-sort": "A3S_TEST_SUITE=tests/e2e/spreadsheet-appearance-sort.acl bash scripts/run-a3s-test-web-gate.sh",
197
+ "test:e2e:spreadsheet-appearance-sort:check": "a3s-test check tests/e2e/spreadsheet-appearance-sort.acl --json",
198
+ "test:e2e:spreadsheet-row-sort": "A3S_TEST_SUITE=tests/e2e/spreadsheet-row-sort.acl bash scripts/run-a3s-test-web-gate.sh",
199
+ "test:e2e:spreadsheet-row-sort:check": "a3s-test check tests/e2e/spreadsheet-row-sort.acl --json",
200
+ "test:e2e:spreadsheet-text-sort": "A3S_TEST_SUITE=tests/e2e/spreadsheet-text-sort.acl bash scripts/run-a3s-test-web-gate.sh",
201
+ "test:e2e:spreadsheet-text-sort:check": "a3s-test check tests/e2e/spreadsheet-text-sort.acl --json",
202
+ "test:e2e:spreadsheet-sort-range": "A3S_TEST_SUITE=tests/e2e/spreadsheet-sort-range.acl bash scripts/run-a3s-test-web-gate.sh",
203
+ "test:e2e:spreadsheet-sort-range:check": "a3s-test check tests/e2e/spreadsheet-sort-range.acl --json",
184
204
  "test:e2e:spreadsheet-cell-fill": "a3s-test run tests/e2e/spreadsheet-cell-fill.acl --json",
185
205
  "test:e2e:spreadsheet-cell-fill:check": "a3s-test check tests/e2e/spreadsheet-cell-fill.acl --json",
186
206
  "test:e2e:spreadsheet-auto-sum": "a3s-test run tests/e2e/spreadsheet-auto-sum.acl --json",