@a3s-lab/office 0.38.1 → 0.40.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 (32) hide show
  1. package/README.md +18 -4
  2. package/dist/{0~7240.js → 0~2330.js} +897 -641
  3. package/dist/0~5024.js +240 -240
  4. package/dist/0~7828.js +51 -29
  5. package/dist/0~document-editor.js +1 -0
  6. package/dist/0~presentation-editor.js +264 -118
  7. package/dist/0~work-docx-export.js +1023 -922
  8. package/dist/0~work-docx-import.js +13 -4
  9. package/dist/0~work-office-diagnostics.js +96 -94
  10. package/dist/0~work-pptx-import.js +1 -1
  11. package/dist/0~work-presentation-transition.js +38 -0
  12. package/dist/4121.js +42 -9
  13. package/dist/4174.js +497 -233
  14. package/dist/4560.js +124 -9
  15. package/dist/internal/features/work/editors/presentation-animation-panel.d.ts +9 -7
  16. package/dist/internal/features/work/editors/presentation-command-types.d.ts +10 -10
  17. package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +6 -4
  18. package/dist/internal/features/work/editors/use-presentation-animation-commands.d.ts +7 -7
  19. package/dist/internal/features/work/work-document-format-change-tracking.d.ts +1 -1
  20. package/dist/internal/features/work/work-document-numbering-change-tracking.d.ts +7 -0
  21. package/dist/internal/features/work/work-document-numbering-changes.d.ts +29 -0
  22. package/dist/internal/features/work/work-docx-import.d.ts +7 -5
  23. package/dist/internal/features/work/work-docx-list-export.d.ts +1 -0
  24. package/dist/internal/features/work/work-docx-numbering-change-export.d.ts +13 -0
  25. package/dist/internal/features/work/work-docx-numbering-change-import.d.ts +17 -0
  26. package/dist/internal/features/work/work-presentation-animation.d.ts +6 -2
  27. package/dist/internal/features/work/work-presentation-clipboard.d.ts +0 -5
  28. package/dist/internal/features/work/work-types.d.ts +8 -4
  29. package/dist/office-kernel.wasm +0 -0
  30. package/dist/styles.css +162 -26
  31. package/package.json +8 -5
  32. package/dist/0~5809.js +0 -123
package/dist/4560.js CHANGED
@@ -1,6 +1,117 @@
1
+ import { createOfficeId as createWorkId } from "./4121.js";
1
2
  import { initializeWorkOfficeCollaborationMetadata, assertWorkOfficeCollaborationEditable, OfficeCollaborationError as WorkOfficeCollaborationError, readOfficeCollaborationMetadata as readWorkOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer, markWorkOfficeCollaborationInitialized, assertWorkOfficeCollaborationOrigin } from "./9787.js";
2
3
  import { workOfficeCollaborationJsonEqual, canonicalWorkOfficeCollaborationJson, isWorkOfficeCollaborationRecord, cloneWorkOfficeCollaborationJson } from "./4650.js";
3
4
  import * as __rspack_external_yjs from "yjs";
5
+ function createWorkSlideAnimation(elementId, effect, previous) {
6
+ return normalizeWorkSlideAnimation({
7
+ id: previous?.id ?? createWorkId('slide-animation'),
8
+ elementId,
9
+ effect,
10
+ trigger: previous?.trigger ?? 'on-click',
11
+ durationMs: previous?.durationMs ?? 500,
12
+ delayMs: previous?.delayMs ?? 0,
13
+ direction: isFlyAnimationEffect(effect) ? previous?.direction ?? 'left' : void 0
14
+ });
15
+ }
16
+ function normalizeWorkSlideAnimation(animation) {
17
+ return {
18
+ ...animation,
19
+ durationMs: boundedInteger(animation.durationMs, 100, 60000),
20
+ delayMs: boundedInteger(animation.delayMs, 0, 60000),
21
+ direction: isFlyAnimationEffect(animation.effect) ? normalizeWorkSlideAnimationDirection(animation.direction) : void 0
22
+ };
23
+ }
24
+ function workSlideAnimationClass(effect) {
25
+ return 'disappear' === effect || 'fade-out' === effect || 'fly-out' === effect || 'zoom-out' === effect ? 'exit' : 'entrance';
26
+ }
27
+ function workSlideAnimationEffectMatchesClass(effect, animationClass) {
28
+ return workSlideAnimationClass(effect) === animationClass;
29
+ }
30
+ function workSlideAnimationForElement(slide, elementId, animationClass) {
31
+ if (!elementId) return;
32
+ return slide.animations?.find((animation)=>animation.elementId === elementId && workSlideAnimationClass(animation.effect) === animationClass);
33
+ }
34
+ function workSlideAnimationIndex(slide, animationId) {
35
+ if (!animationId) return -1;
36
+ return slide.animations?.findIndex((animation)=>animation.id === animationId) ?? -1;
37
+ }
38
+ function workSlideAnimationCues(animations) {
39
+ const cues = [];
40
+ let current;
41
+ for (const raw of animations ?? []){
42
+ const animation = normalizeWorkSlideAnimation(raw);
43
+ if (!current || 'on-click' === animation.trigger) {
44
+ current = {
45
+ automatic: 'on-click' !== animation.trigger,
46
+ items: [],
47
+ totalDurationMs: 0
48
+ };
49
+ cues.push(current);
50
+ }
51
+ const previous = current.items.at(-1);
52
+ const baseStart = 'after-previous' === animation.trigger ? previous?.endOffsetMs ?? 0 : 'with-previous' === animation.trigger ? previous?.startOffsetMs ?? 0 : 0;
53
+ const startOffsetMs = baseStart + animation.delayMs;
54
+ const endOffsetMs = startOffsetMs + animation.durationMs;
55
+ current.items.push({
56
+ animation,
57
+ startOffsetMs,
58
+ endOffsetMs
59
+ });
60
+ current.totalDurationMs = Math.max(current.totalDurationMs, endOffsetMs);
61
+ }
62
+ return cues;
63
+ }
64
+ function initialWorkSlideAnimationCueIndex(cues) {
65
+ return cues[0]?.automatic ? 0 : -1;
66
+ }
67
+ function workSlideAnimationSequenceIssue(animations) {
68
+ const classTargets = new Set();
69
+ for (const animation of animations ?? []){
70
+ const key = `${animation.elementId}\u0000${workSlideAnimationClass(animation.effect)}`;
71
+ if (classTargets.has(key)) return 'duplicate-class';
72
+ classTargets.add(key);
73
+ }
74
+ for (const cue of workSlideAnimationCues(animations)){
75
+ const rangesByTarget = new Map();
76
+ for (const item of cue.items){
77
+ const ranges = rangesByTarget.get(item.animation.elementId) ?? [];
78
+ if (ranges.some((range)=>item.startOffsetMs < range.endOffsetMs && item.endOffsetMs > range.startOffsetMs)) return 'overlapping-target';
79
+ ranges.push(item);
80
+ rangesByTarget.set(item.animation.elementId, ranges);
81
+ }
82
+ }
83
+ }
84
+ function removeWorkSlideAnimationsForElements(slide, elementIds) {
85
+ const animations = slide.animations?.filter((animation)=>!elementIds.has(animation.elementId));
86
+ if (animations?.length === slide.animations?.length) return slide;
87
+ return {
88
+ ...slide,
89
+ animations: animations?.length ? animations : void 0
90
+ };
91
+ }
92
+ function remapWorkSlideAnimations(animations, elementIds) {
93
+ const remapped = (animations ?? []).flatMap((animation)=>{
94
+ const elementId = elementIds.get(animation.elementId);
95
+ return elementId ? [
96
+ {
97
+ ...animation,
98
+ id: createWorkId('slide-animation'),
99
+ elementId
100
+ }
101
+ ] : [];
102
+ });
103
+ return remapped.length ? remapped : void 0;
104
+ }
105
+ function normalizeWorkSlideAnimationDirection(direction) {
106
+ return 'right' === direction || 'up' === direction || 'down' === direction ? direction : 'left';
107
+ }
108
+ function isFlyAnimationEffect(effect) {
109
+ return 'fly-in' === effect || 'fly-out' === effect;
110
+ }
111
+ function boundedInteger(value, minimum, maximum) {
112
+ const finite = Number.isFinite(value) ? Math.round(value) : minimum;
113
+ return Math.min(maximum, Math.max(minimum, finite));
114
+ }
4
115
  function validateWorkOfficePresentationContent(content) {
5
116
  if (!content || 'presentation' !== content.type) invalidWorkOfficePresentationInput('a Presentation content value');
6
117
  const result = {
@@ -50,30 +161,34 @@ function validateSlide(value) {
50
161
  function validateSlideAnimations(value, slide) {
51
162
  if (!Array.isArray(value) || value.length > 256) invalidWorkOfficePresentationInput("an array of at most 256 slide animations");
52
163
  const animationIds = new Set();
53
- const targetIds = new Set();
164
+ const classTargetIds = new Set();
54
165
  const elementIds = new Set(slide.elements.map((element)=>element.id));
55
- return value.map((item)=>{
166
+ const animations = value.map((item)=>{
56
167
  const record = requiredInputRecord(item, 'slide animation');
57
168
  const animation = validateJsonRecord(record, 'slide animation');
58
169
  animation.id = requiredIdentifier(record.id, 'slide animation');
59
170
  animation.elementId = requiredIdentifier(record.elementId, 'slide animation element');
60
171
  if (animationIds.has(animation.id)) invalidWorkOfficePresentationInput(`a unique slide animation ID; '${animation.id}' is repeated`);
61
172
  if (!elementIds.has(animation.elementId)) invalidWorkOfficePresentationInput(`slide animation '${animation.id}' to reference an existing element`);
62
- if (targetIds.has(animation.elementId)) invalidWorkOfficePresentationInput(`at most one entrance animation for element '${animation.elementId}'`);
63
- if ('appear' !== record.effect && 'fade' !== record.effect && 'fly-in' !== record.effect && 'zoom' !== record.effect) invalidWorkOfficePresentationInput('a supported slide entrance animation effect');
173
+ if ('appear' !== record.effect && 'fade' !== record.effect && 'fly-in' !== record.effect && 'zoom' !== record.effect && 'disappear' !== record.effect && 'fade-out' !== record.effect && 'fly-out' !== record.effect && 'zoom-out' !== record.effect) invalidWorkOfficePresentationInput('a supported slide entrance or exit animation effect');
64
174
  animation.effect = record.effect;
175
+ const animationClass = workSlideAnimationClass(animation.effect);
176
+ const classTargetId = `${animation.elementId}\u0000${animationClass}`;
177
+ if (classTargetIds.has(classTargetId)) invalidWorkOfficePresentationInput(`at most one ${animationClass} animation for element '${animation.elementId}'`);
65
178
  if ('on-click' !== record.trigger && 'with-previous' !== record.trigger && 'after-previous' !== record.trigger) invalidWorkOfficePresentationInput('a supported slide animation trigger');
66
179
  animation.trigger = record.trigger;
67
180
  animation.durationMs = requiredIntegerInRange(record.durationMs, 100, 60000, 'slide animation duration');
68
181
  animation.delayMs = requiredIntegerInRange(record.delayMs, 0, 60000, 'slide animation delay');
69
- if ('fly-in' === animation.effect) {
70
- if ('left' !== record.direction && 'right' !== record.direction && 'up' !== record.direction && 'down' !== record.direction) invalidWorkOfficePresentationInput('a direction for each fly-in animation');
182
+ if ('fly-in' === animation.effect || 'fly-out' === animation.effect) {
183
+ if ('left' !== record.direction && 'right' !== record.direction && 'up' !== record.direction && 'down' !== record.direction) invalidWorkOfficePresentationInput('a direction for each fly-in or fly-out animation');
71
184
  animation.direction = record.direction;
72
- } else if (void 0 !== record.direction) invalidWorkOfficePresentationInput('slide animation directions only on fly-in effects');
185
+ } else if (void 0 !== record.direction) invalidWorkOfficePresentationInput('slide animation directions only on fly-in or fly-out effects');
73
186
  animationIds.add(animation.id);
74
- targetIds.add(animation.elementId);
187
+ classTargetIds.add(classTargetId);
75
188
  return animation;
76
189
  });
190
+ if ('overlapping-target' === workSlideAnimationSequenceIssue(animations)) invalidWorkOfficePresentationInput('animations for one element to avoid overlapping inside one playback cue');
191
+ return animations;
77
192
  }
78
193
  function validateMaster(value) {
79
194
  const record = requiredInputRecord(value, 'presentation master');
@@ -857,4 +972,4 @@ function assertInitializedPresentationSession(session) {
857
972
  if (metadata?.initialized) return;
858
973
  throw new WorkOfficeCollaborationError('office.collaboration.not_initialized', 'The Presentation collaboration session has not been initialized.');
859
974
  }
860
- export { createWorkOfficePresentationCollaborationBinding as createOfficePresentationCollaborationBinding, initializeWorkOfficePresentationCollaboration as initializeOfficePresentationCollaboration, readWorkOfficePresentationCollaboration as readOfficePresentationCollaboration, replaceWorkOfficePresentationCollaboration as replaceOfficePresentationCollaboration };
975
+ export { createWorkOfficePresentationCollaborationBinding as createOfficePresentationCollaborationBinding, createWorkSlideAnimation, initialWorkSlideAnimationCueIndex, initializeWorkOfficePresentationCollaboration as initializeOfficePresentationCollaboration, normalizeWorkSlideAnimation, readWorkOfficePresentationCollaboration as readOfficePresentationCollaboration, remapWorkSlideAnimations, removeWorkSlideAnimationsForElements, replaceWorkOfficePresentationCollaboration as replaceOfficePresentationCollaboration, workSlideAnimationClass, workSlideAnimationCues, workSlideAnimationEffectMatchesClass, workSlideAnimationForElement, workSlideAnimationIndex, workSlideAnimationSequenceIssue };
@@ -1,11 +1,13 @@
1
- import type { WorkSlideAnimation, WorkSlideAnimationEffect } from '../work-types';
2
- export declare function PresentationAnimationPanel({ animation, canMove, canPreview, editable, onMove, onPreview, onSetEffect, onUpdate, }: {
3
- animation: WorkSlideAnimation | undefined;
4
- canMove: (direction: -1 | 1) => boolean;
1
+ import type { WorkSlideAnimation, WorkSlideAnimationClass, WorkSlideAnimationEffect } from '../work-types';
2
+ export declare function PresentationAnimationPanel({ animations, canMove, canPreview, canUpdate, editable, elementId, onMove, onPreview, onSetEffect, onUpdate, }: {
3
+ animations: Record<WorkSlideAnimationClass, WorkSlideAnimation | undefined>;
4
+ canMove: (animationClass: WorkSlideAnimationClass, direction: -1 | 1) => boolean;
5
5
  canPreview: boolean;
6
+ canUpdate: (animationClass: WorkSlideAnimationClass, patch: Partial<WorkSlideAnimation>) => boolean;
6
7
  editable: boolean;
7
- onMove: (direction: -1 | 1) => void;
8
+ elementId: string | undefined;
9
+ onMove: (animationClass: WorkSlideAnimationClass, direction: -1 | 1) => void;
8
10
  onPreview: () => void;
9
- onSetEffect: (effect: WorkSlideAnimationEffect | undefined) => void;
10
- onUpdate: (patch: Partial<WorkSlideAnimation>) => void;
11
+ onSetEffect: (animationClass: WorkSlideAnimationClass, effect: WorkSlideAnimationEffect | undefined) => void;
12
+ onUpdate: (animationClass: WorkSlideAnimationClass, patch: Partial<WorkSlideAnimation>) => void;
11
13
  }): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import type { OfficeKernelPresentationAlignment } from '../../../kernel/office-kernel-protocol';
2
- import type { WorkPresentationContent, WorkSlideAnimation, WorkSlideAnimationEffect, WorkSlideElement, WorkSlideTransition, WorkSlideTextRun } from '../work-types';
2
+ import type { WorkPresentationContent, WorkSlideAnimation, WorkSlideAnimationClass, WorkSlideAnimationEffect, WorkSlideElement, WorkSlideTransition, WorkSlideTextRun } from '../work-types';
3
3
  import type { OfficeEditorCanCommands } from './office-editor-extension';
4
4
  import type { PresentationDesignMode } from './presentation-editor-types';
5
5
  import type { PresentationDistribution } from './presentation-selection';
@@ -37,7 +37,7 @@ export interface PresentationEditorCommands {
37
37
  groupElements: () => boolean;
38
38
  instantiatePlaceholder: (definition: WorkSlideElement) => PresentationCommandResult;
39
39
  locatePresentationComment: (slideId: string, commentId: string) => PresentationCommandResult;
40
- moveEntranceAnimation: (direction: -1 | 1) => PresentationCommandResult;
40
+ moveAnimation: (animationClass: WorkSlideAnimationClass, direction: -1 | 1) => PresentationCommandResult;
41
41
  nudgeSelection: (key: string, distance: number) => boolean;
42
42
  openComment: (commentId: string) => PresentationCommandResult;
43
43
  pasteSelection: () => boolean;
@@ -52,7 +52,7 @@ export interface PresentationEditorCommands {
52
52
  selectSlide: (slideId: string, returnToSlideMode?: boolean) => PresentationCommandResult;
53
53
  setPresentationContent: (content: WorkPresentationContent) => PresentationCommandResult;
54
54
  setBackground: (color: string) => PresentationCommandResult;
55
- setEntranceAnimation: (effect: WorkSlideAnimationEffect | undefined) => PresentationCommandResult;
55
+ setAnimation: (animationClass: WorkSlideAnimationClass, effect: WorkSlideAnimationEffect | undefined) => PresentationCommandResult;
56
56
  setPresentationLayoutBackground: (color: string | undefined) => PresentationCommandResult;
57
57
  setPresentationMasterBackground: (color: string) => PresentationCommandResult;
58
58
  setTransition: (transition: WorkSlideTransition | undefined) => PresentationCommandResult;
@@ -69,7 +69,7 @@ export interface PresentationEditorCommands {
69
69
  updateElement: (patch: Partial<WorkSlideElement>, options?: {
70
70
  restoreTextFocus?: boolean;
71
71
  }) => PresentationCommandResult;
72
- updateEntranceAnimation: (patch: Partial<WorkSlideAnimation>) => PresentationCommandResult;
72
+ updateAnimation: (animationClass: WorkSlideAnimationClass, patch: Partial<WorkSlideAnimation>) => PresentationCommandResult;
73
73
  updateNotes: (notes: string) => PresentationCommandResult;
74
74
  updatePresentationComment: (slideId: string, commentId: string, text: string) => PresentationCommandResult;
75
75
  updateTextElement: (elementId: string, value: {
@@ -112,14 +112,14 @@ export interface PresentationSlideCommandPort {
112
112
  updateNotes: (notes: string) => PresentationCommandResult;
113
113
  }
114
114
  export interface PresentationAnimationCommandPort {
115
- canMoveEntranceAnimation: (direction: -1 | 1) => boolean;
115
+ canMoveAnimation: (animationClass: WorkSlideAnimationClass, direction: -1 | 1) => boolean;
116
116
  canPreviewAnimations: boolean;
117
- canSetEntranceAnimation: boolean;
118
- canUpdateEntranceAnimation: boolean;
119
- moveEntranceAnimation: (direction: -1 | 1) => PresentationCommandResult;
117
+ canSetAnimation: boolean;
118
+ canUpdateAnimation: (animationClass: WorkSlideAnimationClass, patch: Partial<WorkSlideAnimation>) => boolean;
119
+ moveAnimation: (animationClass: WorkSlideAnimationClass, direction: -1 | 1) => PresentationCommandResult;
120
120
  previewAnimations: () => PresentationCommandResult;
121
- setEntranceAnimation: (effect: WorkSlideAnimationEffect | undefined) => PresentationCommandResult;
122
- updateEntranceAnimation: (patch: Partial<WorkSlideAnimation>) => PresentationCommandResult;
121
+ setAnimation: (animationClass: WorkSlideAnimationClass, effect: WorkSlideAnimationEffect | undefined) => PresentationCommandResult;
122
+ updateAnimation: (animationClass: WorkSlideAnimationClass, patch: Partial<WorkSlideAnimation>) => PresentationCommandResult;
123
123
  }
124
124
  export interface PresentationInsertCommandPort {
125
125
  enabled: boolean;
@@ -1,5 +1,6 @@
1
1
  import { type WorkPresentationDesignContent } from '../work-presentation-layouts';
2
- import type { WorkPresentationContent, WorkSlide, WorkSlideAnimation, WorkSlideElement } from '../work-types';
2
+ import { type WorkSlideAnimationCueItem } from '../work-presentation-animation';
3
+ import type { WorkPresentationContent, WorkSlide, WorkSlideElement } from '../work-types';
3
4
  export declare function SlideCanvas({ content, designContent, slide, interactive, aspectRatio, animationCueIndex, showPlaceholders, }: {
4
5
  content?: WorkPresentationContent;
5
6
  designContent?: WorkPresentationDesignContent;
@@ -21,9 +22,10 @@ export declare function EditableSlideTable({ element, onChange, }: {
21
22
  }): import("react").JSX.Element | null;
22
23
  export declare function slideElementStyle(element: WorkSlideElement): React.CSSProperties;
23
24
  interface SlideElementAnimationPlayback {
24
- animation: WorkSlideAnimation;
25
- startOffsetMs: number;
26
- state: 'finished' | 'pending' | 'playing';
25
+ animations: WorkSlideAnimationCueItem[];
26
+ finallyVisible: boolean;
27
+ initiallyVisible: boolean;
28
+ state: 'hidden' | 'playing' | 'visible';
27
29
  }
28
30
  export declare function slideTextStyle(element: WorkSlideElement): React.CSSProperties;
29
31
  export declare function SlideElementTextPreview({ element, showPlaceholder, }: {
@@ -1,11 +1,11 @@
1
- import type { WorkPresentationContent, WorkSlide, WorkSlideAnimation, WorkSlideAnimationEffect } from '../work-types';
1
+ import type { WorkPresentationContent, WorkSlide, WorkSlideAnimation, WorkSlideAnimationClass, WorkSlideAnimationEffect } from '../work-types';
2
2
  export interface PresentationAnimationCommands {
3
- canMoveEntranceAnimation: (direction: -1 | 1) => boolean;
4
- canSetEntranceAnimation: boolean;
5
- canUpdateEntranceAnimation: boolean;
6
- moveEntranceAnimation: (direction: -1 | 1) => boolean;
7
- setEntranceAnimation: (effect: WorkSlideAnimationEffect | undefined) => boolean;
8
- updateEntranceAnimation: (patch: Partial<WorkSlideAnimation>) => boolean;
3
+ canMoveAnimation: (animationClass: WorkSlideAnimationClass, direction: -1 | 1) => boolean;
4
+ canSetAnimation: boolean;
5
+ canUpdateAnimation: (animationClass: WorkSlideAnimationClass, patch: Partial<WorkSlideAnimation>) => boolean;
6
+ moveAnimation: (animationClass: WorkSlideAnimationClass, direction: -1 | 1) => boolean;
7
+ setAnimation: (animationClass: WorkSlideAnimationClass, effect: WorkSlideAnimationEffect | undefined) => boolean;
8
+ updateAnimation: (animationClass: WorkSlideAnimationClass, patch: Partial<WorkSlideAnimation>) => boolean;
9
9
  }
10
10
  export declare function usePresentationAnimationCommands({ content, onChange, selectedElementId, selectedSlide, }: {
11
11
  content: WorkPresentationContent;
@@ -3,7 +3,7 @@ import type { EditorState, PluginKey, Transaction } from '@tiptap/pm/state';
3
3
  import type { WorkDocumentChangeIdentity } from './work-document-changes';
4
4
  interface DocumentFormattingChangeTrackingOptions {
5
5
  isTracking: () => boolean;
6
- createChange: (kind: 'formatting' | 'paragraph-formatting') => WorkDocumentChangeIdentity;
6
+ createChange: (kind: 'formatting' | 'paragraph-formatting' | 'numbering') => WorkDocumentChangeIdentity;
7
7
  }
8
8
  export declare function trackDocumentFormattingTransaction(transaction: Transaction, state: EditorState, type: ProseMirrorMark['type'], options: DocumentFormattingChangeTrackingOptions, pluginKey: PluginKey): void;
9
9
  export {};
@@ -0,0 +1,7 @@
1
+ import type { EditorState, Transaction } from '@tiptap/pm/state';
2
+ import type { WorkDocumentChangeIdentity } from './work-document-changes';
3
+ interface DocumentNumberingChangeTrackingOptions {
4
+ createChange: () => WorkDocumentChangeIdentity;
5
+ }
6
+ export declare function trackDocumentNumberingChangeTransaction(transaction: Transaction, state: EditorState, options: DocumentNumberingChangeTrackingOptions): boolean;
7
+ export {};
@@ -0,0 +1,29 @@
1
+ export type DocumentNumberingChangeType = 'a' | 'A' | 'i' | 'I' | null;
2
+ export interface DocumentNumberingChangeSnapshot {
3
+ start: number;
4
+ type: DocumentNumberingChangeType;
5
+ officeNumberingId: string | null;
6
+ officeAbstractNumberingId: string | null;
7
+ officeNumberingLevel: string | null;
8
+ officeNumberingFormat: string | null;
9
+ officeNumberingText: string | null;
10
+ officeNumberingSuffix: string | null;
11
+ officeNumberingAlignment: string | null;
12
+ officeNumberingIndentLeft: string | null;
13
+ officeNumberingIndentRight: string | null;
14
+ officeNumberingIndentStart: string | null;
15
+ officeNumberingIndentEnd: string | null;
16
+ officeNumberingIndentHanging: string | null;
17
+ officeNumberingIndentFirstLine: string | null;
18
+ officeNumberingRestartAfterLevel: string | null;
19
+ level: number;
20
+ originalFormat: number;
21
+ originalSuffix: string;
22
+ }
23
+ export declare const DOCUMENT_NUMBERING_CHANGE_ATTRIBUTES: readonly ["numberingChangeKind", "numberingChangeId", "numberingChangeActorId", "numberingChangeAuthor", "numberingChangeDate", "numberingChangeBefore"];
24
+ export declare function serializeDocumentNumberingChange(attributes: Record<string, unknown>): string;
25
+ export declare function parseDocumentNumberingChange(value: unknown): DocumentNumberingChangeSnapshot | null;
26
+ export declare function restoredDocumentNumberingAttributes(attributes: Record<string, unknown>, serialized: unknown): Record<string, unknown> | null;
27
+ export declare function clearDocumentNumberingChangeAttributes(attributes: Record<string, unknown>): Record<string, unknown>;
28
+ export declare function numberingFormatFromType(type: DocumentNumberingChangeType): number;
29
+ export declare function numberingTypeFromFormat(format: number): DocumentNumberingChangeType | undefined;
@@ -5,22 +5,23 @@ import { type ImportedDocxCitationMarkers } from './work-docx-citation-import';
5
5
  import { type ImportedDocxCommentMarkers } from './work-docx-comment-import';
6
6
  import { type ImportedDocxEquationMarkers } from './work-docx-equation-import';
7
7
  import { type ImportedDocxFieldMarkers } from './work-docx-field-import';
8
- import { type ImportedDocxIndexMarkers } from './work-docx-index-import';
9
- import { type ImportedDocxTableOfContentsMarkers } from './work-docx-table-of-contents-import';
10
8
  import { type ImportedDocxImageLayoutMarkers } from './work-docx-image-layout-import';
9
+ import { type ImportedDocxIndexMarkers } from './work-docx-index-import';
11
10
  import { type ImportedDocxListMarkers } from './work-docx-list-import';
11
+ import { type ImportedDocxNumberingChangeMarkers } from './work-docx-numbering-change-import';
12
12
  import { type ImportedDocxParagraphAlignmentMarkers } from './work-docx-paragraph-alignment-import';
13
+ import { type ImportedDocxParagraphBorderMarkers } from './work-docx-paragraph-borders-import';
13
14
  import { type ImportedDocxParagraphDirectionMarkers } from './work-docx-paragraph-direction-import';
14
- import { type ImportedDocxParagraphIdentityMarkers } from './work-docx-paragraph-identity-import';
15
15
  import { type ImportedDocxParagraphFormattingChangeMarkers } from './work-docx-paragraph-format-change-import';
16
+ import { type ImportedDocxParagraphIdentityMarkers } from './work-docx-paragraph-identity-import';
16
17
  import { type ImportedDocxParagraphIndentMarkers } from './work-docx-paragraph-indent-import';
17
18
  import { type ImportedDocxParagraphPaginationMarkers } from './work-docx-paragraph-pagination-import';
18
- import { type ImportedDocxParagraphBorderMarkers } from './work-docx-paragraph-borders-import';
19
19
  import { type ImportedDocxParagraphShadingMarkers } from './work-docx-paragraph-shading-import';
20
20
  import { type ImportedDocxParagraphSpacingMarkers } from './work-docx-paragraph-spacing-import';
21
21
  import { type ImportedDocxRunFormattingMarkers } from './work-docx-run-formatting-import';
22
22
  import { type ImportedDocxParagraphTabStopMarkers } from './work-docx-tab-stop-import';
23
23
  import { type ImportedDocxTableCellMarkers } from './work-docx-table-cell-import';
24
+ import { type ImportedDocxTableOfContentsMarkers } from './work-docx-table-of-contents-import';
24
25
  import { type ImportedDocxTableRowMarkers } from './work-docx-table-row-import';
25
26
  import { type ImportedDocxTableSizingMarkers } from './work-docx-table-sizing-import';
26
27
  import { OoxmlPackage } from './work-ooxml-package';
@@ -43,6 +44,7 @@ export interface PreparedDocxImport {
43
44
  equationMarkers: ImportedDocxEquationMarkers;
44
45
  citationMarkers: ImportedDocxCitationMarkers;
45
46
  listMarkers: ImportedDocxListMarkers;
47
+ numberingChangeMarkers: ImportedDocxNumberingChangeMarkers;
46
48
  imageLayoutMarkers: ImportedDocxImageLayoutMarkers;
47
49
  paragraphIdentityMarkers: ImportedDocxParagraphIdentityMarkers;
48
50
  paragraphFormattingChangeMarkers: ImportedDocxParagraphFormattingChangeMarkers;
@@ -62,6 +64,6 @@ export interface PreparedDocxImport {
62
64
  trackChanges: boolean;
63
65
  }
64
66
  export declare function prepareDocxImport(buffer: ArrayBuffer, sourcePackage?: OoxmlPackage): Promise<PreparedDocxImport>;
65
- export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, tableOfContentsMarkers?: ImportedDocxTableOfContentsMarkers, indexMarkers?: ImportedDocxIndexMarkers, equationMarkers?: ImportedDocxEquationMarkers, citationMarkers?: ImportedDocxCitationMarkers, listMarkers?: ImportedDocxListMarkers, imageLayoutMarkers?: ImportedDocxImageLayoutMarkers, paragraphIdentityMarkers?: ImportedDocxParagraphIdentityMarkers, paragraphFormattingChangeMarkers?: ImportedDocxParagraphFormattingChangeMarkers, paragraphAlignmentMarkers?: ImportedDocxParagraphAlignmentMarkers, runFormattingMarkers?: ImportedDocxRunFormattingMarkers, paragraphDirectionMarkers?: ImportedDocxParagraphDirectionMarkers, paragraphIndentMarkers?: ImportedDocxParagraphIndentMarkers, paragraphSpacingMarkers?: ImportedDocxParagraphSpacingMarkers, paragraphBorderMarkers?: ImportedDocxParagraphBorderMarkers, paragraphShadingMarkers?: ImportedDocxParagraphShadingMarkers, paragraphPaginationMarkers?: ImportedDocxParagraphPaginationMarkers, bibliography?: WorkDocumentContent['bibliography'], tabStopMarkers?: ImportedDocxParagraphTabStopMarkers, tableCellMarkers?: ImportedDocxTableCellMarkers, tableRowMarkers?: ImportedDocxTableRowMarkers, tableSizingMarkers?: ImportedDocxTableSizingMarkers): string;
67
+ export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, tableOfContentsMarkers?: ImportedDocxTableOfContentsMarkers, indexMarkers?: ImportedDocxIndexMarkers, equationMarkers?: ImportedDocxEquationMarkers, citationMarkers?: ImportedDocxCitationMarkers, listMarkers?: ImportedDocxListMarkers, numberingChangeMarkers?: ImportedDocxNumberingChangeMarkers, imageLayoutMarkers?: ImportedDocxImageLayoutMarkers, paragraphIdentityMarkers?: ImportedDocxParagraphIdentityMarkers, paragraphFormattingChangeMarkers?: ImportedDocxParagraphFormattingChangeMarkers, paragraphAlignmentMarkers?: ImportedDocxParagraphAlignmentMarkers, runFormattingMarkers?: ImportedDocxRunFormattingMarkers, paragraphDirectionMarkers?: ImportedDocxParagraphDirectionMarkers, paragraphIndentMarkers?: ImportedDocxParagraphIndentMarkers, paragraphSpacingMarkers?: ImportedDocxParagraphSpacingMarkers, paragraphBorderMarkers?: ImportedDocxParagraphBorderMarkers, paragraphShadingMarkers?: ImportedDocxParagraphShadingMarkers, paragraphPaginationMarkers?: ImportedDocxParagraphPaginationMarkers, bibliography?: WorkDocumentContent['bibliography'], tabStopMarkers?: ImportedDocxParagraphTabStopMarkers, tableCellMarkers?: ImportedDocxTableCellMarkers, tableRowMarkers?: ImportedDocxTableRowMarkers, tableSizingMarkers?: ImportedDocxTableSizingMarkers): string;
66
68
  export declare function readDocxLayout(buffer: ArrayBuffer): Promise<ImportedDocumentLayout>;
67
69
  export {};
@@ -12,6 +12,7 @@ export interface DocxListExportContext {
12
12
  numberingSourceIdentities: Array<DocxSourceNumberingIdentity | null>;
13
13
  paragraphBorderPatches?: DocxParagraphBorderPatchCollector;
14
14
  themePatches?: DocxThemePatchCollector;
15
+ numberingChangeMarker?: (list: HTMLElement, itemIndex: number) => string | null;
15
16
  }
16
17
  type InlineRuns = (element: HTMLElement) => Promise<ParagraphChild[]>;
17
18
  export declare function listToDocxParagraphs(list: HTMLElement, docx: typeof import('docx'), context: DocxListExportContext, inlineRuns: InlineRuns, depth?: number): Promise<Array<InstanceType<typeof docx.Paragraph>>>;
@@ -0,0 +1,13 @@
1
+ interface DocxNumberingChangePatch {
2
+ marker: string;
3
+ id: number;
4
+ author: string;
5
+ date: string;
6
+ original: string;
7
+ }
8
+ export declare class DocxNumberingChangePatchCollector {
9
+ readonly patches: DocxNumberingChangePatch[];
10
+ register(list: HTMLElement, itemIndex: number, id: number): string | null;
11
+ }
12
+ export declare function patchDocxNumberingChanges(buffer: ArrayBuffer, patches: readonly DocxNumberingChangePatch[]): Promise<ArrayBuffer>;
13
+ export {};
@@ -0,0 +1,17 @@
1
+ export interface ImportedDocxNumberingChangeGroup {
2
+ markers: string[];
3
+ id: string;
4
+ author: string;
5
+ date: string;
6
+ start: number;
7
+ level: number;
8
+ format: number;
9
+ suffix: string;
10
+ }
11
+ export interface ImportedDocxNumberingChangeMarkers {
12
+ groups: ImportedDocxNumberingChangeGroup[];
13
+ }
14
+ export declare function markDocxNumberingChanges(document: Document): ImportedDocxNumberingChangeMarkers;
15
+ export declare function applyImportedDocxNumberingChangeMarkers(document: Document, markers: ImportedDocxNumberingChangeMarkers): void;
16
+ export declare function hasImportedDocxNumberingChangeMarkers(markers: ImportedDocxNumberingChangeMarkers): boolean;
17
+ export declare function isSupportedDocxNumberingChange(change: Element): boolean;
@@ -1,4 +1,4 @@
1
- import type { WorkSlide, WorkSlideAnimation, WorkSlideAnimationEffect } from './work-types';
1
+ import type { WorkSlide, WorkSlideAnimation, WorkSlideAnimationClass, WorkSlideAnimationEffect } from './work-types';
2
2
  export { WORK_SLIDE_ANIMATION_LIMIT, WORK_SLIDE_ANIMATION_MAX_DELAY_MS, WORK_SLIDE_ANIMATION_MAX_DURATION_MS, WORK_SLIDE_ANIMATION_MIN_DURATION_MS, } from './work-presentation-animation-constraints';
3
3
  export interface WorkSlideAnimationCueItem {
4
4
  animation: WorkSlideAnimation;
@@ -10,11 +10,15 @@ export interface WorkSlideAnimationCue {
10
10
  items: WorkSlideAnimationCueItem[];
11
11
  totalDurationMs: number;
12
12
  }
13
+ export type WorkSlideAnimationSequenceIssue = 'duplicate-class' | 'overlapping-target';
13
14
  export declare function createWorkSlideAnimation(elementId: string, effect: WorkSlideAnimationEffect, previous?: WorkSlideAnimation): WorkSlideAnimation;
14
15
  export declare function normalizeWorkSlideAnimation(animation: WorkSlideAnimation): WorkSlideAnimation;
15
- export declare function workSlideAnimationForElement(slide: WorkSlide, elementId: string | undefined): WorkSlideAnimation | undefined;
16
+ export declare function workSlideAnimationClass(effect: WorkSlideAnimationEffect): WorkSlideAnimationClass;
17
+ export declare function workSlideAnimationEffectMatchesClass(effect: WorkSlideAnimationEffect, animationClass: WorkSlideAnimationClass): boolean;
18
+ export declare function workSlideAnimationForElement(slide: WorkSlide, elementId: string | undefined, animationClass: WorkSlideAnimationClass): WorkSlideAnimation | undefined;
16
19
  export declare function workSlideAnimationIndex(slide: WorkSlide, animationId: string | undefined): number;
17
20
  export declare function workSlideAnimationCues(animations: readonly WorkSlideAnimation[] | undefined): WorkSlideAnimationCue[];
18
21
  export declare function initialWorkSlideAnimationCueIndex(cues: readonly WorkSlideAnimationCue[]): number;
22
+ export declare function workSlideAnimationSequenceIssue(animations: readonly WorkSlideAnimation[] | undefined): WorkSlideAnimationSequenceIssue | undefined;
19
23
  export declare function removeWorkSlideAnimationsForElements(slide: WorkSlide, elementIds: ReadonlySet<string>): WorkSlide;
20
24
  export declare function remapWorkSlideAnimations(animations: readonly WorkSlideAnimation[] | undefined, elementIds: ReadonlyMap<string, string>): WorkSlideAnimation[] | undefined;
@@ -1,10 +1,6 @@
1
1
  import type { WorkSlide, WorkSlideAnimation, WorkSlideElement } from './work-types';
2
2
  export declare const PRESENTATION_OBJECT_OFFSET_STEP = 5;
3
3
  export type WorkPresentationClipboardPayload = {
4
- kind: 'element';
5
- element: WorkSlideElement;
6
- animation?: WorkSlideAnimation;
7
- } | {
8
4
  kind: 'elements';
9
5
  elements: WorkSlideElement[];
10
6
  animations?: WorkSlideAnimation[];
@@ -20,7 +16,6 @@ export interface WorkPresentationElementPaste {
20
16
  animations?: WorkSlideAnimation[];
21
17
  elements: WorkSlideElement[];
22
18
  }
23
- export declare function copyPresentationElement(element: WorkSlideElement, animation?: WorkSlideAnimation): void;
24
19
  export declare function copyPresentationElements(elements: readonly WorkSlideElement[], animations?: readonly WorkSlideAnimation[]): void;
25
20
  export declare function copyPresentationSlide(slide: WorkSlide): void;
26
21
  export declare function takePresentationClipboard(): WorkPresentationClipboardRead | null;
@@ -106,7 +106,7 @@ export interface WorkDocumentContent {
106
106
  comments?: WorkDocumentComment[];
107
107
  bibliography?: WorkDocumentBibliography;
108
108
  }
109
- export type WorkDocumentChangeKind = 'insertion' | 'deletion' | 'formatting' | 'paragraph-formatting';
109
+ export type WorkDocumentChangeKind = 'insertion' | 'deletion' | 'formatting' | 'paragraph-formatting' | 'numbering';
110
110
  export type WorkDocumentChangeDecisionAction = 'accept' | 'reject';
111
111
  /**
112
112
  * Immutable audit record created when an editor accepts or rejects one
@@ -589,12 +589,16 @@ export interface WorkSlideTransition {
589
589
  advanceOnClick: boolean;
590
590
  advanceAfterMs?: number;
591
591
  }
592
- export type WorkSlideAnimationEffect = 'appear' | 'fade' | 'fly-in' | 'zoom';
592
+ export type WorkSlideAnimationClass = 'entrance' | 'exit';
593
+ export type WorkSlideEntranceAnimationEffect = 'appear' | 'fade' | 'fly-in' | 'zoom';
594
+ export type WorkSlideExitAnimationEffect = 'disappear' | 'fade-out' | 'fly-out' | 'zoom-out';
595
+ export type WorkSlideAnimationEffect = WorkSlideEntranceAnimationEffect | WorkSlideExitAnimationEffect;
593
596
  export type WorkSlideAnimationTrigger = 'on-click' | 'with-previous' | 'after-previous';
594
597
  export type WorkSlideAnimationDirection = 'left' | 'right' | 'up' | 'down';
595
598
  /**
596
- * One bounded entrance animation applied to one slide-owned element.
597
- * Array order on `WorkSlide.animations` is the canonical playback order.
599
+ * One bounded entrance or exit animation applied to one slide-owned element.
600
+ * An element may own at most one animation from each class. Array order on
601
+ * `WorkSlide.animations` is the canonical playback order.
598
602
  */
599
603
  export interface WorkSlideAnimation {
600
604
  id: string;
Binary file