@a3s-lab/office 0.32.0 → 0.34.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 (57) hide show
  1. package/README.md +62 -8
  2. package/dist/0~3539.js +2 -2
  3. package/dist/0~3557.js +1 -1
  4. package/dist/0~3635.js +1 -1
  5. package/dist/0~5809.js +123 -0
  6. package/dist/0~7048.js +1 -2
  7. package/dist/{0~7614.js → 0~7828.js} +376 -5
  8. package/dist/{0~6090.js → 0~8136.js} +71 -2
  9. package/dist/{0~4595.js → 0~9073.js} +3 -72
  10. package/dist/0~9445.js +1 -1
  11. package/dist/0~document-editor.js +2 -2
  12. package/dist/0~markdown-editor.js +2 -2
  13. package/dist/0~pdf-page-organization-engine.js +187 -0
  14. package/dist/0~pdf-viewer.js +1018 -30
  15. package/dist/0~presentation-editor.js +580 -68
  16. package/dist/0~spreadsheet-editor.js +2 -2
  17. package/dist/0~work-pptx-export.js +50 -14
  18. package/dist/0~work-pptx-import.js +21 -9
  19. package/dist/4121.js +122 -1
  20. package/dist/4560.js +33 -0
  21. package/dist/core.d.ts +1 -0
  22. package/dist/internal/features/work/editors/pdf-editor-extensions.d.ts +11 -0
  23. package/dist/internal/features/work/editors/pdf-page-organization-engine.d.ts +2 -0
  24. package/dist/internal/features/work/editors/pdf-page-organization-plan.d.ts +10 -0
  25. package/dist/internal/features/work/editors/pdf-page-organization-types.d.ts +68 -0
  26. package/dist/internal/features/work/editors/pdf-page-organization-worker-client.d.ts +2 -0
  27. package/dist/internal/features/work/editors/pdf-page-organization-worker-protocol.d.ts +13 -0
  28. package/dist/internal/features/work/editors/pdf-page-organization.d.ts +3 -0
  29. package/dist/internal/features/work/editors/pdf-page-organization.worker.d.ts +1 -0
  30. package/dist/internal/features/work/editors/pdf-page-organizer-dialog.d.ts +17 -0
  31. package/dist/internal/features/work/editors/pdf-thumbnail-rail.d.ts +4 -0
  32. package/dist/internal/features/work/editors/pdf-toolbar.d.ts +2 -1
  33. package/dist/internal/features/work/editors/pdf-viewer.d.ts +3 -1
  34. package/dist/internal/features/work/editors/presentation-animation-panel.d.ts +11 -0
  35. package/dist/internal/features/work/editors/presentation-command-types.d.ts +16 -1
  36. package/dist/internal/features/work/editors/presentation-presenter-view.d.ts +2 -1
  37. package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +11 -3
  38. package/dist/internal/features/work/editors/use-pdf-page-organization.d.ts +38 -0
  39. package/dist/internal/features/work/editors/use-presentation-animation-commands.d.ts +15 -0
  40. package/dist/internal/features/work/work-pptx-animation.d.ts +13 -0
  41. package/dist/internal/features/work/work-pptx-groups.d.ts +4 -0
  42. package/dist/internal/features/work/work-presentation-animation-constraints.d.ts +4 -0
  43. package/dist/internal/features/work/work-presentation-animation.d.ts +20 -0
  44. package/dist/internal/features/work/work-presentation-clipboard.d.ts +10 -3
  45. package/dist/internal/features/work/work-types.d.ts +17 -0
  46. package/dist/office-kernel.wasm +0 -0
  47. package/dist/pdf-page-organization.worker.js +19667 -0
  48. package/dist/pdf-page-organization.worker.js.LICENSE.txt +14 -0
  49. package/dist/react.d.ts +1 -0
  50. package/dist/styles.css +438 -0
  51. package/dist/vue.d.ts +3 -1
  52. package/dist/vue.js +2 -0
  53. package/dist/web-component.d.ts +3 -1
  54. package/dist/web-component.js +9 -0
  55. package/docs/latest/en/browser-editor-architecture.md +29 -6
  56. package/package.json +8 -1
  57. package/dist/0~work-presentation-transition.js +0 -38
package/README.md CHANGED
@@ -56,22 +56,26 @@ workflows, and a separate Rust automation plane.
56
56
 
57
57
  ## Latest on `main`
58
58
 
59
- The `0.32.0` release plus the current `main` branch expose these capabilities
59
+ The `0.34.0` release plus the current `main` branch expose these capabilities
60
60
  as normal user-facing Playground templates, with matching implementation
61
61
  detail in the documentation:
62
62
 
63
63
  | Editor | Latest capability | Public entry |
64
64
  | --- | --- | --- |
65
+ | Presentation | Author, reorder, preview, collaborate on, and play ordered appear, fade, fly-in, and zoom entrance animations with on-click, with-previous, and after-previous triggers; the bounded subset round-trips through native PPTX timing trees | Playground **Latest capabilities → 入场动画** · [Presentation reference](docs/latest/en/components/presentation.mdx#entrance-animations) |
65
66
  | Writer | Compare the current document with an imported DOCX, HTML, or TXT version and generate deterministic insertion, deletion, character-formatting, and paragraph-formatting revisions; combine a reviewed copy only after exact baseline verification | Playground **Latest capabilities → 文档比较** · [Document reference](docs/latest/en/components/document.mdx#document-compare-and-combine) |
66
67
  | Writer | Insert, customize, navigate, and explicitly refresh a typed Table of Contents with heading and native outline levels 1–9, hyperlinks, page numbers, alignment, four leader styles, and native DOCX `TOC` round trips | Playground **Latest capabilities → 可更新目录** · [Document reference](docs/latest/en/components/document.mdx#native-table-of-contents) |
67
68
  | Writer | Mark primary and secondary index terms, cross-references, and bold/italic page numbers; insert, navigate, customize, and refresh a bounded native index with editable DOCX `XE` and `INDEX` round trips | Playground **Latest capabilities → 原生索引** · [Document reference](docs/latest/en/components/document.mdx#native-document-index) |
68
69
  | Writer | Native character shading with exact `w:shd` patterns, foreground/background color identity, explicit resets, authoring, and DOCX reopen | Playground **Latest capabilities → 字符底纹** · [Document reference](docs/latest/en/components/document.mdx#native-character-shading) |
69
70
  | Writer | Independent Latin, East Asian, and bidi proofing languages plus explicit `w:noProof` inclusion/exclusion | Playground **Latest capabilities → 校对语言** · [Document reference](docs/latest/en/components/document.mdx#native-proofing-languages) |
70
71
  | Spreadsheet | Complete common Data Validation input, blank/dropdown, and Stop/Warning/Information error settings with native XLSX round trips | Playground **Latest capabilities → 数据验证** · [Spreadsheet reference](docs/latest/en/components/spreadsheet.mdx#data-validation) |
72
+ | PDF | Insert, delete, rotate, reorder, extract, merge, and split pages through a dedicated Web Worker, with Blob-level Undo/Redo and independent binary reopen verification | Playground **Latest capabilities → 组织 PDF 页面** · [PDF reference](docs/latest/en/components/pdf.mdx#page-organization) |
71
73
 
72
- The same six entries remain available under **新建**. The highlighted strip
73
- exists so a capability is discoverable from the first Playground viewport
74
- instead of only through a deep documentation section or an `?e2e=` fixture.
74
+ All eight entries are reachable from the first Playground viewport. The seven
75
+ content templates also remain under **新建**; **组织 PDF 页面** opens the normal
76
+ PDF file workflow because page organization must operate on host-provided source
77
+ bytes. The highlighted strip keeps each capability discoverable without a deep
78
+ documentation section or an `?e2e=` fixture.
75
79
 
76
80
  ## See it working
77
81
 
@@ -108,9 +112,9 @@ The images below are committed visual-regression baselines from the real
108
112
  </td>
109
113
  <td width="50%" valign="top">
110
114
  <a href="visual-tests/__snapshots__/linux/desktop-1280/pdf.png">
111
- <img src="visual-tests/__snapshots__/linux/desktop-1280/pdf.png" alt="A3S Office PDF editor with search, annotation, save, and download controls">
115
+ <img src="visual-tests/__snapshots__/linux/desktop-1280/pdf.png" alt="A3S Office PDF editor with search, annotation, page organization, save, and download controls">
112
116
  </a>
113
- <br><sub><strong>PDF</strong> — PDFium rendering, forms, annotations, Yjs overlays, and save</sub>
117
+ <br><sub><strong>PDF</strong> — PDFium rendering, forms, annotations, page organization, Yjs overlays, and save</sub>
114
118
  </td>
115
119
  </tr>
116
120
  </table>
@@ -160,7 +164,7 @@ baseline rather than one specific release.
160
164
  | Text, shapes, tables, charts, and images | **Partial** — typed editable objects with native import/export paths | Broader shapes, connectors, effects, SmartArt, and embedded chart editing |
161
165
  | Masters and layouts | **Partial** — import/export inheritance with editable common paths | Full visual master, layout, and placeholder authoring |
162
166
  | Transitions and timings | **Partial** — fade, push, wipe, split, cut, and click/automatic advance | Broader transition catalog and timing controls |
163
- | Animations and media | **Gap** — no production animation timeline, trigger model, audio, video, or recording path | Object animation, motion paths, media editing, and recording |
167
+ | Animations and media | **Partial** — the Work scene model authors, validates, copies, collaborates on, previews, and plays ordered appear/fade/fly-in/zoom entrance cues with click/with-previous/after-previous triggers and bounded timing; this supported entrance subset round-trips through native PPTX timing trees | Exit/emphasis effects, motion paths, audio, video, recording, and broader PPTX preservation |
164
168
  | Slideshow and presenter workflows | **Supported** — current/beginning start, keyboard playback, notes, timer, and responsive presenter view | Rehearsal, recording, ink/laser, and richer multi-display controls |
165
169
  | Review and collaboration | **Partial** — comments, shared presence, remote object locations, and host transport | Threads, assignments, mentions, and integrated cloud review |
166
170
  | PPTX, print, PDF, and video | **Partial** — PPTX round trip plus slide/notes/handout PDF models; no video export | Broader print controls, vector fidelity, media preservation, and video export |
@@ -173,7 +177,7 @@ baseline rather than one specific release.
173
177
  | Search and text evidence | **Supported with boundaries** — browser search and bounded native text-layer evidence | Broader tagged-PDF reading order and accessibility extraction |
174
178
  | Annotations, forms, and save | **Supported** — common annotations, appearance controls, form filling, history, and save | Broader stamps, measurements, form authoring, scripts, and signatures |
175
179
  | Existing text, image, and object editing | **Gap** — no safe production content-stream editing path | Direct text/object editing with font and layout recovery |
176
- | Page organization | **Gap** — insert, delete, rotate, reorder, extract, merge, and split are not yet editable | Complete page organization workflows |
180
+ | Page organization | **Supported with boundaries** — insert, delete, rotate, reorder, extract, merge, and split run in a dedicated Worker, replace one complete Blob per mutation, and participate in Undo/Redo | Broader document-level catalog preservation and signed/encrypted-file workflows |
177
181
  | Compression, conversion, and OCR | **Gap / host boundary** — provider contracts are required for authoritative conversion and OCR | Integrated optimization, conversion, and scanned-document recognition |
178
182
  | Signatures, protection, and redaction | **Gap / host boundary** — trusted identity and destructive-content guarantees are required | E-signing, certificate validation, encryption, sanitization, and true redaction |
179
183
  | AI and real-time collaboration | **Host-owned** — typed page/text evidence, Yjs review records, presence, and provider-neutral ports | Typically bundled with account, storage, and model services |
@@ -433,6 +437,51 @@ viewer or pre-initialize the PDFium Worker. On the local reference machine it
433
437
  improved median shell mount by 41.6 ms but did not improve the viewer-ready
434
438
  median, so Worker initialization remains the measured boundary.
435
439
 
440
+ ### Organize and persist PDF pages
441
+
442
+ Providing `onSave` enables the page organizer. Every insert, delete, rotate,
443
+ reorder, or merge produces one replacement PDF `Blob` and one page-history
444
+ record; extract and split return separate files without changing the source.
445
+ Use `onPageExport` when the host should persist those derived files instead of
446
+ letting the viewer download them:
447
+
448
+ ```tsx
449
+ import type { PdfPageOrganizationExport } from '@a3s-lab/office/react';
450
+ import { PdfViewer } from '@a3s-lab/office/react';
451
+
452
+ async function persistPageExports(
453
+ files: readonly PdfPageOrganizationExport[],
454
+ ): Promise<boolean> {
455
+ await Promise.all(
456
+ files.map(({ fileName, pageCount, pdf }) =>
457
+ storage.put(fileName, pdf, { pageCount }),
458
+ ),
459
+ );
460
+ return true;
461
+ }
462
+
463
+ <PdfViewer
464
+ fileName="contract.pdf"
465
+ loadSource={() => storage.get('contract.pdf')}
466
+ onSave={async (pdf) => {
467
+ await storage.put('contract.pdf', pdf);
468
+ return true;
469
+ }}
470
+ onPageExport={persistPageExports}
471
+ />;
472
+ ```
473
+
474
+ Page jobs load lazily in a dedicated Web Worker. The primary PDF is limited to
475
+ 256 MiB, a merged PDF to 128 MiB, and every result to 4,096 pages. Toolbar
476
+ Undo/Redo consumes native annotation or form history first, then page history.
477
+ Signed or encrypted PDFs fail closed; delete, reorder, and merge also reject
478
+ forms, outlines, or tagged structures whose page references cannot be safely
479
+ rewritten. Extract and split surface a diagnostic when document-level catalog
480
+ objects are intentionally not copied. Page organization is unavailable while
481
+ `collaboration` or `evidenceOverlay` is active because those modes identify an
482
+ immutable source PDF. See the complete
483
+ [PDF page-organization contract](docs/latest/en/components/pdf.mdx#page-organization).
484
+
436
485
  ### Persist a structured document snapshot
437
486
 
438
487
  Hosts that round-trip controlled document values across a process or language
@@ -1547,6 +1596,9 @@ bun run lint
1547
1596
  bun run typecheck
1548
1597
  bun run test
1549
1598
  bun run build
1599
+ bun run test:e2e:pdf-page-organization:check
1600
+ bun run test:e2e:pdf-page-organization
1601
+ bun run playground:visual:pdf-page-organization
1550
1602
  bun run test:e2e:large-pdf:check
1551
1603
  bun run test:e2e:large-pdf
1552
1604
  bun run performance:pdf
@@ -1571,6 +1623,8 @@ without hard-coded return URLs.
1571
1623
 
1572
1624
  - [Live Playground](https://a3s-lab.github.io/Office/)
1573
1625
  - [Documentation center](https://a3s-lab.github.io/Office/docs/)
1626
+ - [A3S Office 0.34.0 documentation](https://a3s-lab.github.io/Office/docs/0.34.0/)
1627
+ - [A3S Office 0.33.0 documentation](https://a3s-lab.github.io/Office/docs/0.33.0/)
1574
1628
  - [A3S Office 0.32.0 documentation](https://a3s-lab.github.io/Office/docs/0.32.0/)
1575
1629
  - [A3S Office 0.31.0 documentation](https://a3s-lab.github.io/Office/docs/0.31.0/)
1576
1630
  - [A3S Office 0.30.0 documentation](https://a3s-lab.github.io/Office/docs/0.30.0/)
package/dist/0~3539.js CHANGED
@@ -6,8 +6,8 @@ import { effectiveSpreadsheetCalculationSettings, workSpreadsheetCombinationSeri
6
6
  import { presentationChartLegendPositionLabel, presentationChartShowsLegend, normalizePresentationChartLegendPosition, presentationChartUsesNumericXAxis, normalizePresentationBubbleSizeRepresents, normalizePresentationBubbleScale, presentationChartAxes, normalizePresentationChartDataLabels, presentationChartTypeLabel, presentationChartDataLabelPositionLabel, normalizePresentationScatterStyle } from "./0~work-presentation-charts.js";
7
7
  import { OfficeCheckbox, CommittedOfficeNumberField, CollectionState } from "./0~7048.js";
8
8
  import { OfficeColorPicker } from "./0~3635.js";
9
- import { OfficeSelect } from "./0~4595.js";
10
- import { office_text_field_OfficeTextField, CommittedOfficeTextField } from "./0~6090.js";
9
+ import { OfficeSelect } from "./0~9073.js";
10
+ import { office_text_field_OfficeTextField, CommittedOfficeTextField } from "./0~8136.js";
11
11
  function spreadsheetAgentMenuItems(selection, onAgentRequest, applyProposal) {
12
12
  return [
13
13
  {
package/dist/0~3557.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
2
- import { matchesOfficeEditorKeyboardShortcut } from "./0~6090.js";
2
+ import { matchesOfficeEditorKeyboardShortcut } from "./0~8136.js";
3
3
  const DEFAULT_EXTENSION_PRIORITY = 100;
4
4
  function createOfficeEditorExtension(config) {
5
5
  const name = config.name.trim();
package/dist/0~3635.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Ban, Check, ChevronDown } from "lucide-react";
3
3
  import { useEffect, useRef, useState } from "react";
4
- import { button_Button, Popover } from "./0~6090.js";
4
+ import { button_Button, Popover } from "./0~8136.js";
5
5
  const THEME_COLORS = [
6
6
  '#111827',
7
7
  '#1f2937',
package/dist/0~5809.js ADDED
@@ -0,0 +1,123 @@
1
+ import { createOfficeId as createWorkId } from "./4121.js";
2
+ function createWorkSlideAnimation(elementId, effect, previous) {
3
+ return normalizeWorkSlideAnimation({
4
+ id: previous?.id ?? createWorkId('slide-animation'),
5
+ elementId,
6
+ effect,
7
+ trigger: previous?.trigger ?? 'on-click',
8
+ durationMs: previous?.durationMs ?? 500,
9
+ delayMs: previous?.delayMs ?? 0,
10
+ direction: 'fly-in' === effect ? previous?.direction ?? 'left' : void 0
11
+ });
12
+ }
13
+ function normalizeWorkSlideAnimation(animation) {
14
+ return {
15
+ ...animation,
16
+ durationMs: boundedInteger(animation.durationMs, 100, 60000),
17
+ delayMs: boundedInteger(animation.delayMs, 0, 60000),
18
+ direction: 'fly-in' === animation.effect ? normalizeWorkSlideAnimationDirection(animation.direction) : void 0
19
+ };
20
+ }
21
+ function workSlideAnimationForElement(slide, elementId) {
22
+ if (!elementId) return;
23
+ return slide.animations?.find((animation)=>animation.elementId === elementId);
24
+ }
25
+ function workSlideAnimationIndex(slide, animationId) {
26
+ if (!animationId) return -1;
27
+ return slide.animations?.findIndex((animation)=>animation.id === animationId) ?? -1;
28
+ }
29
+ function workSlideAnimationCues(animations) {
30
+ const cues = [];
31
+ let current;
32
+ for (const raw of animations ?? []){
33
+ const animation = normalizeWorkSlideAnimation(raw);
34
+ if (!current || 'on-click' === animation.trigger) {
35
+ current = {
36
+ automatic: 'on-click' !== animation.trigger,
37
+ items: [],
38
+ totalDurationMs: 0
39
+ };
40
+ cues.push(current);
41
+ }
42
+ const previous = current.items.at(-1);
43
+ const baseStart = 'after-previous' === animation.trigger ? previous?.endOffsetMs ?? 0 : 'with-previous' === animation.trigger ? previous?.startOffsetMs ?? 0 : 0;
44
+ const startOffsetMs = baseStart + animation.delayMs;
45
+ const endOffsetMs = startOffsetMs + animation.durationMs;
46
+ current.items.push({
47
+ animation,
48
+ startOffsetMs,
49
+ endOffsetMs
50
+ });
51
+ current.totalDurationMs = Math.max(current.totalDurationMs, endOffsetMs);
52
+ }
53
+ return cues;
54
+ }
55
+ function initialWorkSlideAnimationCueIndex(cues) {
56
+ return cues[0]?.automatic ? 0 : -1;
57
+ }
58
+ function removeWorkSlideAnimationsForElements(slide, elementIds) {
59
+ const animations = slide.animations?.filter((animation)=>!elementIds.has(animation.elementId));
60
+ if (animations?.length === slide.animations?.length) return slide;
61
+ return {
62
+ ...slide,
63
+ animations: animations?.length ? animations : void 0
64
+ };
65
+ }
66
+ function remapWorkSlideAnimations(animations, elementIds) {
67
+ const remapped = (animations ?? []).flatMap((animation)=>{
68
+ const elementId = elementIds.get(animation.elementId);
69
+ return elementId ? [
70
+ {
71
+ ...animation,
72
+ id: createWorkId('slide-animation'),
73
+ elementId
74
+ }
75
+ ] : [];
76
+ });
77
+ return remapped.length ? remapped : void 0;
78
+ }
79
+ function normalizeWorkSlideAnimationDirection(direction) {
80
+ return 'right' === direction || 'up' === direction || 'down' === direction ? direction : 'left';
81
+ }
82
+ function boundedInteger(value, minimum, maximum) {
83
+ const finite = Number.isFinite(value) ? Math.round(value) : minimum;
84
+ return Math.min(maximum, Math.max(minimum, finite));
85
+ }
86
+ const CARDINAL_DIRECTIONS = new Set([
87
+ 'left',
88
+ 'right',
89
+ 'up',
90
+ 'down'
91
+ ]);
92
+ const SPLIT_DIRECTIONS = new Set([
93
+ 'in',
94
+ 'out'
95
+ ]);
96
+ function createWorkSlideTransition(type, previous) {
97
+ const common = {
98
+ type,
99
+ speed: previous?.speed ?? 'medium',
100
+ advanceOnClick: previous?.advanceOnClick ?? true,
101
+ advanceAfterMs: previous?.advanceAfterMs
102
+ };
103
+ if ('push' === type || 'wipe' === type) return {
104
+ ...common,
105
+ direction: previous?.direction && CARDINAL_DIRECTIONS.has(previous.direction) ? previous.direction : 'left'
106
+ };
107
+ if ('split' === type) return {
108
+ ...common,
109
+ direction: previous?.direction && SPLIT_DIRECTIONS.has(previous.direction) ? previous.direction : 'out',
110
+ orientation: previous?.orientation ?? 'horizontal'
111
+ };
112
+ return common;
113
+ }
114
+ function slideTransitionDurationMilliseconds(transition) {
115
+ if (transition?.speed === 'fast') return 500;
116
+ if (transition?.speed === 'slow') return 2000;
117
+ return 1000;
118
+ }
119
+ function workSlideTransitionsEqual(left, right) {
120
+ if (!left || !right) return left === right;
121
+ return left.type === right.type && left.speed === right.speed && left.direction === right.direction && left.orientation === right.orientation && left.advanceOnClick === right.advanceOnClick && left.advanceAfterMs === right.advanceAfterMs;
122
+ }
123
+ export { createWorkSlideAnimation, createWorkSlideTransition, initialWorkSlideAnimationCueIndex, normalizeWorkSlideAnimation, remapWorkSlideAnimations, removeWorkSlideAnimationsForElements, slideTransitionDurationMilliseconds, workSlideAnimationCues, workSlideAnimationForElement, workSlideAnimationIndex, workSlideTransitionsEqual };
package/dist/0~7048.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useId, useRef, useState } from "react";
3
3
  import { Check, ChevronDown, ChevronUp, Minus } from "lucide-react";
4
- import { Dialog } from "./0~4595.js";
5
- import { button_Button, office_text_field_OfficeTextField, office_text_field_OfficeTextArea } from "./0~6090.js";
4
+ import { button_Button, office_text_field_OfficeTextArea, office_text_field_OfficeTextField, Dialog } from "./0~8136.js";
6
5
  import { OFFICE_KERNEL_SPREADSHEET_MAX_ROWS as office_kernel_spreadsheet_protocol_OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, isOfficeKernelSpreadsheetError } from "./4121.js";
7
6
  function CollectionState({ children, icon, actions, tone = 'neutral', role, className = '' }) {
8
7
  return /*#__PURE__*/ jsxs("div", {