@file-viewer/assets-ppt 3.3.0 → 3.3.3

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 (109) hide show
  1. package/README.en.md +3 -1
  2. package/README.md +3 -1
  3. package/README.zh-CN.md +3 -1
  4. package/package.json +96 -9
  5. package/viewer/THIRD_PARTY_LICENSES.assets.json +837 -54
  6. package/viewer/file-viewer-asset-pack.json +20 -31
  7. package/viewer/vendor/ppt/LICENSE +160 -122
  8. package/viewer/vendor/ppt/NOTICE.md +30 -0
  9. package/viewer/vendor/ppt/README.md +86 -0
  10. package/viewer/vendor/ppt/dist/core/binary.d.ts +31 -0
  11. package/viewer/vendor/ppt/dist/core/binary.js +102 -0
  12. package/viewer/vendor/ppt/dist/core/cfb.d.ts +38 -0
  13. package/viewer/vendor/ppt/dist/core/cfb.js +208 -0
  14. package/viewer/vendor/ppt/dist/core/crypto.d.ts +12 -0
  15. package/viewer/vendor/ppt/dist/core/crypto.js +64 -0
  16. package/viewer/vendor/ppt/dist/core/errors.d.ts +5 -0
  17. package/viewer/vendor/ppt/dist/core/errors.js +5 -0
  18. package/viewer/vendor/ppt/dist/core/inflate.d.ts +11 -0
  19. package/viewer/vendor/ppt/dist/core/inflate.js +337 -0
  20. package/viewer/vendor/ppt/dist/core/pict.d.ts +14 -0
  21. package/viewer/vendor/ppt/dist/core/pict.js +472 -0
  22. package/viewer/vendor/ppt/dist/core/raster.d.ts +7 -0
  23. package/viewer/vendor/ppt/dist/core/raster.js +101 -0
  24. package/viewer/vendor/ppt/dist/core/tiff.d.ts +20 -0
  25. package/viewer/vendor/ppt/dist/core/tiff.js +254 -0
  26. package/viewer/vendor/ppt/dist/core/utils.d.ts +9 -0
  27. package/viewer/vendor/ppt/dist/core/utils.js +13 -0
  28. package/viewer/vendor/ppt/dist/core/vector-font.d.ts +12 -0
  29. package/viewer/vendor/ppt/dist/core/vector-font.js +29 -0
  30. package/viewer/vendor/ppt/dist/core/vector.d.ts +19 -0
  31. package/viewer/vendor/ppt/dist/core/vector.js +1570 -0
  32. package/viewer/vendor/ppt/dist/core/xml-text.d.ts +1 -0
  33. package/viewer/vendor/ppt/dist/core/xml-text.js +6 -0
  34. package/viewer/vendor/ppt/dist/index.d.ts +12 -0
  35. package/viewer/vendor/ppt/dist/index.js +8 -0
  36. package/viewer/vendor/ppt/dist/layout/measure.d.ts +15 -0
  37. package/viewer/vendor/ppt/dist/layout/measure.js +54 -0
  38. package/viewer/vendor/ppt/dist/layout/text-layout.d.ts +48 -0
  39. package/viewer/vendor/ppt/dist/layout/text-layout.js +272 -0
  40. package/viewer/vendor/ppt/dist/manifest.json +13 -0
  41. package/viewer/vendor/ppt/dist/playback/media.d.ts +11 -0
  42. package/viewer/vendor/ppt/dist/playback/media.js +37 -0
  43. package/viewer/vendor/ppt/dist/playback/navigation.d.ts +2 -0
  44. package/viewer/vendor/ppt/dist/playback/navigation.js +14 -0
  45. package/viewer/vendor/ppt/dist/playback/timeline.d.ts +47 -0
  46. package/viewer/vendor/ppt/dist/playback/timeline.js +154 -0
  47. package/viewer/vendor/ppt/dist/playback/transitions.d.ts +14 -0
  48. package/viewer/vendor/ppt/dist/playback/transitions.js +41 -0
  49. package/viewer/vendor/ppt/dist/ppt/animation.d.ts +3 -0
  50. package/viewer/vendor/ppt/dist/ppt/animation.js +67 -0
  51. package/viewer/vendor/ppt/dist/ppt/constants.d.ts +72 -0
  52. package/viewer/vendor/ppt/dist/ppt/constants.js +21 -0
  53. package/viewer/vendor/ppt/dist/ppt/drawing.d.ts +15 -0
  54. package/viewer/vendor/ppt/dist/ppt/drawing.js +508 -0
  55. package/viewer/vendor/ppt/dist/ppt/encryption.d.ts +14 -0
  56. package/viewer/vendor/ppt/dist/ppt/encryption.js +241 -0
  57. package/viewer/vendor/ppt/dist/ppt/extras.d.ts +14 -0
  58. package/viewer/vendor/ppt/dist/ppt/extras.js +225 -0
  59. package/viewer/vendor/ppt/dist/ppt/geometry.d.ts +29 -0
  60. package/viewer/vendor/ppt/dist/ppt/geometry.js +448 -0
  61. package/viewer/vendor/ppt/dist/ppt/headers-footers.d.ts +11 -0
  62. package/viewer/vendor/ppt/dist/ppt/headers-footers.js +97 -0
  63. package/viewer/vendor/ppt/dist/ppt/interactions.d.ts +12 -0
  64. package/viewer/vendor/ppt/dist/ppt/interactions.js +104 -0
  65. package/viewer/vendor/ppt/dist/ppt/parser.d.ts +12 -0
  66. package/viewer/vendor/ppt/dist/ppt/parser.js +356 -0
  67. package/viewer/vendor/ppt/dist/ppt/pictures.d.ts +10 -0
  68. package/viewer/vendor/ppt/dist/ppt/pictures.js +215 -0
  69. package/viewer/vendor/ppt/dist/ppt/records.d.ts +13 -0
  70. package/viewer/vendor/ppt/dist/ppt/records.js +49 -0
  71. package/viewer/vendor/ppt/dist/ppt/text.d.ts +19 -0
  72. package/viewer/vendor/ppt/dist/ppt/text.js +789 -0
  73. package/viewer/vendor/ppt/dist/pptjs.browser.js +9651 -0
  74. package/viewer/vendor/ppt/dist/pptjs.mjs +9663 -0
  75. package/viewer/vendor/ppt/dist/pptjs.worker.js +9650 -0
  76. package/viewer/vendor/ppt/dist/render/effects.d.ts +23 -0
  77. package/viewer/vendor/ppt/dist/render/effects.js +125 -0
  78. package/viewer/vendor/ppt/dist/render/fields.d.ts +11 -0
  79. package/viewer/vendor/ppt/dist/render/fields.js +176 -0
  80. package/viewer/vendor/ppt/dist/render/geometry.d.ts +11 -0
  81. package/viewer/vendor/ppt/dist/render/geometry.js +131 -0
  82. package/viewer/vendor/ppt/dist/render/safe.d.ts +12 -0
  83. package/viewer/vendor/ppt/dist/render/safe.js +48 -0
  84. package/viewer/vendor/ppt/dist/render/svg.d.ts +4 -0
  85. package/viewer/vendor/ppt/dist/render/svg.js +279 -0
  86. package/viewer/vendor/ppt/dist/render/text.d.ts +9 -0
  87. package/viewer/vendor/ppt/dist/render/text.js +181 -0
  88. package/viewer/vendor/ppt/dist/render/three-d.d.ts +32 -0
  89. package/viewer/vendor/ppt/dist/render/three-d.js +219 -0
  90. package/viewer/vendor/ppt/dist/render/wordart.d.ts +16 -0
  91. package/viewer/vendor/ppt/dist/render/wordart.js +214 -0
  92. package/viewer/vendor/ppt/dist/runtime.d.ts +125 -0
  93. package/viewer/vendor/ppt/dist/runtime.js +226 -0
  94. package/viewer/vendor/ppt/dist/types.d.ts +546 -0
  95. package/viewer/vendor/ppt/dist/types.js +1 -0
  96. package/viewer/vendor/ppt/dist/viewer.d.ts +3 -0
  97. package/viewer/vendor/ppt/dist/viewer.js +264 -0
  98. package/viewer/vendor/ppt/dist/worker-client.d.ts +25 -0
  99. package/viewer/vendor/ppt/dist/worker-client.js +61 -0
  100. package/viewer/vendor/ppt/dist/worker.d.ts +1 -0
  101. package/viewer/vendor/ppt/dist/worker.js +25 -0
  102. package/viewer/vendor/ppt/package.json +40 -52
  103. package/viewer/vendor/ppt/NOTICE +0 -229
  104. package/viewer/vendor/ppt/frame-cache.mjs +0 -731
  105. package/viewer/vendor/ppt/index.mjs +0 -941
  106. package/viewer/vendor/ppt/manifest.json +0 -44
  107. package/viewer/vendor/ppt/ppt-font-cjk.otf +0 -0
  108. package/viewer/vendor/ppt/ppt-native.wasm +0 -0
  109. package/viewer/vendor/ppt/worker.mjs +0 -1720
@@ -0,0 +1,154 @@
1
+ const bounded = (value, max = 86_399_000) => Math.max(0, Math.min(max, Number.isFinite(value) ? value : 0));
2
+ /** A click begins a step; withPrevious shares the prior start, afterPrevious follows its end. */
3
+ export function compileTimeline(effects) {
4
+ const steps = [];
5
+ let step, previous;
6
+ for (const effect of effects) {
7
+ if (!step || effect.trigger === 'click') {
8
+ step = { automatic: effect.trigger !== 'click', effects: [], durationMs: 0 };
9
+ steps.push(step);
10
+ previous = undefined;
11
+ }
12
+ const base = effect.trigger === 'afterPrevious' ? previous?.endMs ?? 0 : effect.trigger === 'withPrevious' ? previous?.startMs ?? 0 : 0;
13
+ const startMs = base + bounded(effect.delayMs), scheduled = { effect, startMs, endMs: startMs + bounded(effect.durationMs) };
14
+ step.effects.push(scheduled);
15
+ step.durationMs = Math.max(step.durationMs, scheduled.endMs);
16
+ previous = scheduled;
17
+ }
18
+ return steps;
19
+ }
20
+ export function effectKeyframes(effect, width, height, parent = [1, 0, 0, 1]) {
21
+ const entrance = effect.phase === 'entrance', exit = effect.phase === 'exit';
22
+ const visible = { opacity: 1, visibility: 'visible', transform: 'none' }, hidden = { opacity: 0, visibility: 'hidden', transform: 'none' };
23
+ if (effect.kind === 'appear')
24
+ return entrance ? [hidden, visible] : exit ? [visible, hidden] : [visible, visible];
25
+ if (effect.kind === 'fade')
26
+ return entrance ? [hidden, visible] : exit ? [visible, hidden] : [{ opacity: 1 }, { opacity: .35, offset: .5 }, { opacity: 1 }];
27
+ if (effect.kind === 'fly') {
28
+ const direction = effect.direction ?? 'left', dx = direction === 'left' ? -width : direction === 'right' ? width : 0, dy = direction === 'up' ? -height : direction === 'down' ? height : 0;
29
+ let x = dx, y = dy;
30
+ const [a, b, c, d] = parent;
31
+ if (parent.length === 4 && parent.every(Number.isFinite) && Math.abs(a * d - b * c) > 1e-9) {
32
+ const det = a * d - b * c;
33
+ x = (d * dx - c * dy) / det;
34
+ y = (-b * dx + a * dy) / det;
35
+ }
36
+ const clean = (value) => Math.abs(value) < 1e-8 ? 0 : Number(value.toFixed(6));
37
+ const away = { opacity: 0, visibility: 'hidden', transform: `translate(${clean(x)}px,${clean(y)}px)` };
38
+ return exit ? [visible, away] : [away, visible];
39
+ }
40
+ const from = Math.max(.001, Math.min(16, effect.fromScale ?? (entrance ? .01 : 1))), to = Math.max(.001, Math.min(16, effect.toScale ?? (exit ? .01 : 1)));
41
+ return [{ opacity: entrance ? 0 : 1, visibility: entrance ? 'hidden' : 'visible', transform: `scale(${from})` }, { opacity: exit ? 0 : 1, visibility: exit ? 'hidden' : 'visible', transform: `scale(${to})` }];
42
+ }
43
+ /** Owns only per-shape animation wrappers. Destroy always cancels finished promises safely. */
44
+ export class TimelinePlayer {
45
+ effects;
46
+ options;
47
+ steps;
48
+ stepIndex = 0;
49
+ effectIndex = 0;
50
+ animations = [];
51
+ generation = 0;
52
+ destroyed = false;
53
+ running = false;
54
+ paused = false;
55
+ enabled = true;
56
+ constructor(effects, options) {
57
+ this.effects = effects;
58
+ this.options = options;
59
+ this.steps = compileTimeline(effects);
60
+ this.reset();
61
+ }
62
+ get state() { return { enabled: this.enabled, playing: this.running && !this.paused, effectIndex: this.effectIndex, effectCount: this.effects.length }; }
63
+ notify() { this.options.onState?.(this.state); }
64
+ setVisibility(final) { const initial = new Map(); for (const effect of this.effects)
65
+ if (!initial.has(effect.targetShapeId))
66
+ initial.set(effect.targetShapeId, effect); for (const [id, effect] of initial) {
67
+ const target = this.options.resolveTarget(id);
68
+ if (target) {
69
+ target.style.opacity = !final && effect.phase === 'entrance' ? '0' : '';
70
+ target.style.visibility = !final && effect.phase === 'entrance' ? 'hidden' : '';
71
+ target.style.transform = '';
72
+ }
73
+ } }
74
+ reset() { if (this.destroyed)
75
+ return; this.cancelAnimations(); this.stepIndex = 0; this.effectIndex = 0; this.running = false; this.paused = false; this.setVisibility(false); this.notify(); }
76
+ cancelAnimations() { this.generation++; for (const animation of this.animations) {
77
+ animation.finished.catch(() => { });
78
+ animation.cancel();
79
+ } this.animations = []; }
80
+ play() { if (this.destroyed)
81
+ return; if (this.paused) {
82
+ this.paused = false;
83
+ for (const animation of this.animations)
84
+ animation.play();
85
+ this.notify();
86
+ return;
87
+ } if (!this.running)
88
+ this.advance(); }
89
+ startAutomatic() { if (!this.running && this.steps[this.stepIndex]?.automatic)
90
+ this.advance(); }
91
+ pause() { if (this.destroyed || !this.running)
92
+ return; this.paused = true; for (const animation of this.animations)
93
+ animation.pause(); this.notify(); }
94
+ /** Returns false when every effect has been consumed; the viewer may then change slides. */
95
+ advance() {
96
+ if (this.destroyed)
97
+ return false;
98
+ if (this.running) {
99
+ for (const animation of this.animations) {
100
+ try {
101
+ animation.finish();
102
+ }
103
+ catch { /* A zero-duration cancelled animation can already be idle. */ }
104
+ }
105
+ this.paused = false;
106
+ return true;
107
+ }
108
+ const step = this.steps[this.stepIndex++];
109
+ if (!step)
110
+ return false;
111
+ this.running = true;
112
+ this.paused = false;
113
+ const generation = ++this.generation;
114
+ const pending = [];
115
+ for (const scheduled of step.effects) {
116
+ const target = this.options.resolveTarget(scheduled.effect.targetShapeId);
117
+ if (!target)
118
+ continue;
119
+ target.style.transformBox = 'fill-box';
120
+ target.style.transformOrigin = 'center';
121
+ const parent = (target.getAttribute('data-ppt-parent') ?? '1 0 0 1').split(/\s+/).map(Number);
122
+ const keyframes = effectKeyframes(scheduled.effect, this.options.width, this.options.height, parent);
123
+ const duration = scheduled.effect.kind === 'appear' ? 0 : bounded(scheduled.effect.durationMs);
124
+ const final = () => { const last = keyframes[keyframes.length - 1]; target.style.opacity = String(last.opacity ?? ''); target.style.visibility = String(last.visibility ?? 'visible'); target.style.transform = String(last.transform ?? ''); };
125
+ if (typeof target.animate === 'function') {
126
+ const animation = target.animate(keyframes, { duration, delay: scheduled.startMs, fill: 'forwards', easing: 'linear' });
127
+ this.animations.push(animation);
128
+ pending.push(animation.finished.then(() => { if (this.destroyed || generation !== this.generation)
129
+ return; final(); animation.cancel(); }, () => { }));
130
+ }
131
+ else
132
+ final();
133
+ }
134
+ this.notify();
135
+ void Promise.all(pending).then(() => { if (this.destroyed || generation !== this.generation)
136
+ return; this.animations = []; this.running = false; this.effectIndex += step.effects.length; this.notify(); if (this.steps[this.stepIndex]?.automatic)
137
+ this.advance();
138
+ else if (this.stepIndex >= this.steps.length)
139
+ this.options.onDone?.(); });
140
+ return true;
141
+ }
142
+ destroy(showFinal = true) { if (this.destroyed)
143
+ return; this.destroyed = true; this.enabled = false; this.cancelAnimations(); this.running = false; if (showFinal) {
144
+ this.setVisibility(true);
145
+ for (const effect of this.effects) {
146
+ const target = this.options.resolveTarget(effect.targetShapeId);
147
+ if (target) {
148
+ target.style.transform = '';
149
+ target.style.transformOrigin = '';
150
+ target.style.transformBox = '';
151
+ }
152
+ }
153
+ } this.notify(); }
154
+ }
@@ -0,0 +1,14 @@
1
+ import type { PptSlide } from '../types.js';
2
+ export interface TransitionFrames {
3
+ incoming: Keyframe[];
4
+ outgoing?: Keyframe[];
5
+ durationMs: number;
6
+ }
7
+ export interface TransitionController {
8
+ (): void;
9
+ pause(): void;
10
+ play(): void;
11
+ }
12
+ /** MS-PPT SlideShowSlideInfoAtom subset: cut, fade, alpha-fade, cover, uncover, push, wipe. */
13
+ export declare function transitionFrames(transition: PptSlide['transition']): TransitionFrames | undefined;
14
+ export declare function runTransition(incoming: Element, outgoing: Element | undefined, transition: PptSlide['transition'], onDone: () => void): TransitionController;
@@ -0,0 +1,41 @@
1
+ /** MS-PPT SlideShowSlideInfoAtom subset: cut, fade, alpha-fade, cover, uncover, push, wipe. */
2
+ export function transitionFrames(transition) {
3
+ if (!transition || transition.type === 0)
4
+ return undefined;
5
+ const durationMs = Math.max(0, Math.min(10000, Number.isFinite(transition.duration) ? transition.duration : 500)), d = transition.direction ?? 0;
6
+ if ((transition.type === 6 || transition.type === 23) && d === 0)
7
+ return { incoming: [{ opacity: 0 }, { opacity: 1 }], durationMs };
8
+ if ([4, 7, 20].includes(transition.type) && Number.isInteger(d) && d >= 0 && d <= 3) {
9
+ const x = d === 0 ? -100 : d === 2 ? 100 : 0, y = d === 1 ? -100 : d === 3 ? 100 : 0;
10
+ const incoming = [{ transform: `translate(${-x}%,${-y}%)` }, { transform: 'none' }], outgoing = [{ transform: 'none' }, { transform: `translate(${x}%,${y}%)` }];
11
+ return { incoming: transition.type === 7 ? [{ opacity: 1 }, { opacity: 1 }] : incoming, outgoing: transition.type === 4 ? undefined : outgoing, durationMs };
12
+ }
13
+ if (transition.type === 10 && Number.isInteger(d) && d >= 0 && d <= 3) {
14
+ const clip = ['inset(0 0 0 100%)', 'inset(100% 0 0 0)', 'inset(0 100% 0 0)', 'inset(0 0 100% 0)'][d];
15
+ return { incoming: [{ clipPath: clip }, { clipPath: 'inset(0 0 0 0)' }], durationMs };
16
+ }
17
+ return undefined;
18
+ }
19
+ export function runTransition(incoming, outgoing, transition, onDone) {
20
+ const frames = transitionFrames(transition), animations = [];
21
+ let settled = false;
22
+ const complete = () => { if (settled)
23
+ return; settled = true; for (const animation of animations) {
24
+ animation.finished.catch(() => { });
25
+ animation.cancel();
26
+ } onDone(); };
27
+ const controller = Object.assign(complete, { pause() { if (!settled)
28
+ for (const animation of animations)
29
+ animation.pause(); }, play() { if (!settled)
30
+ for (const animation of animations)
31
+ animation.play(); } });
32
+ if (!frames || typeof incoming.animate !== 'function') {
33
+ complete();
34
+ return controller;
35
+ }
36
+ animations.push(incoming.animate(frames.incoming, { duration: frames.durationMs, fill: 'both', easing: 'linear' }));
37
+ if (outgoing && frames.outgoing && typeof outgoing.animate === 'function')
38
+ animations.push(outgoing.animate(frames.outgoing, { duration: frames.durationMs, fill: 'both', easing: 'linear' }));
39
+ void Promise.all(animations.map(animation => animation.finished.catch(() => { }))).then(complete);
40
+ return controller;
41
+ }
@@ -0,0 +1,3 @@
1
+ import type { Diagnostic, PptAnimationEffect, PptShape, RecordNode } from '../types.js';
2
+ /** MS-PPT 2.8.2 legacy whole-object builds. Modern TimeNode trees take precedence. */
3
+ export declare function parseLegacyAnimations(records: readonly RecordNode[], bytes: Uint8Array, shapes: readonly PptShape[], diagnostics: Diagnostic[], slideId: number, hasModernTiming?: boolean): PptAnimationEffect[];
@@ -0,0 +1,67 @@
1
+ import { walkRecords } from './records.js';
2
+ /** MS-PPT 2.8.2 legacy whole-object builds. Modern TimeNode trees take precedence. */
3
+ export function parseLegacyAnimations(records, bytes, shapes, diagnostics, slideId, hasModernTiming = false) {
4
+ if (hasModernTiming) {
5
+ diagnostics.push({ code: 'ANIMATION_MODERN_TIMING_UNSUPPORTED', severity: 'warning', message: 'The modern binary TimeNode tree is retained but is not executed; a legacy fallback is not substituted for its effects', slideId });
6
+ return [];
7
+ }
8
+ const byOffset = new Map();
9
+ for (const record of walkRecords(records))
10
+ byOffset.set(record.offset, record);
11
+ const result = [];
12
+ const warning = (code, message, shape, offset, details) => diagnostics.push({ code, severity: code === 'ANIMATION_DURATION_DEFAULT' ? 'info' : 'warning', message, shapeId: shape.id, slideId, offset, details });
13
+ const visit = (list) => {
14
+ for (const shape of list) {
15
+ if (shape.children)
16
+ visit(shape.children);
17
+ const node = shape.source ? byOffset.get(shape.source.offset) : undefined, client = node?.children.find(r => r.type === 0xF011);
18
+ if (!client)
19
+ continue;
20
+ const atom = [...walkRecords(client.children)].find(r => r.type === 0x0FF1);
21
+ if (!atom)
22
+ continue;
23
+ if (atom.length !== 28 || atom.version !== 1) {
24
+ warning('ANIMATION_ATOM_INVALID', 'Legacy animation atom has an invalid version or payload size', shape, atom.offset);
25
+ continue;
26
+ }
27
+ const v = new DataView(bytes.buffer, bytes.byteOffset + atom.dataOffset, 28), flags = v.getUint32(4, true), order = v.getInt16(16, true), build = v.getUint8(20), kind = v.getUint8(21), direction = v.getUint8(22), after = v.getUint8(23), sub = v.getUint8(24), automatic = (flags >>> 2 & 3) === 1;
28
+ if (build === 0)
29
+ continue;
30
+ if ([0, 2, 4, 6, 8, 10, 12, 14].some(shift => (flags >>> shift & 3) > 1)) {
31
+ warning('ANIMATION_FLAG_INVALID', 'A legacy animation two-bit Boolean contains an invalid value', shape, atom.offset);
32
+ continue;
33
+ }
34
+ if (build !== 1 || order < 0 || sub !== 0 || (flags & 3) !== 0) {
35
+ warning('ANIMATION_BUILD_UNSUPPORTED', 'Only forward, whole-object legacy builds with explicit ordering are mapped', shape, atom.offset, { build, order, subEffect: sub, reverse: flags & 3 });
36
+ continue;
37
+ }
38
+ if (shape.text && !shape.wordArt && (flags >>> 14 & 3) !== 1 && (shape.fill.kind !== 'none' || (shape.line?.width ?? 0) > 0)) {
39
+ warning('ANIMATION_TEXT_ONLY_UNSUPPORTED', 'This legacy build animates text independently of its visible shape background', shape, atom.offset);
40
+ continue;
41
+ }
42
+ let effect;
43
+ const base = { targetShapeId: shape.id, phase: 'entrance', trigger: automatic ? 'afterPrevious' : 'click', delayMs: automatic ? Math.max(0, v.getInt32(12, true)) : 0, durationMs: 500 };
44
+ if (kind === 0 && (direction === 0 || direction === 2))
45
+ effect = { ...base, kind: 'appear', durationMs: 0 };
46
+ else if (kind === 6 && direction === 0)
47
+ effect = { ...base, kind: 'fade' };
48
+ else if (kind === 12 && direction <= 3)
49
+ effect = { ...base, kind: 'fly', direction: ['left', 'up', 'right', 'down'][direction] };
50
+ else if (kind === 12 && direction >= 16 && direction <= 19)
51
+ effect = { ...base, kind: 'zoom', fromScale: [0, .5, 4, 1.5][direction - 16], toScale: 1 };
52
+ if (!effect) {
53
+ warning('ANIMATION_EFFECT_UNSUPPORTED', 'The legacy animation effect or direction is retained but has no playback mapping', shape, atom.offset, { effect: kind, direction });
54
+ continue;
55
+ }
56
+ result.push({ order, effect });
57
+ if (effect.durationMs)
58
+ warning('ANIMATION_DURATION_DEFAULT', 'The legacy record has no duration; this viewer uses a 500 ms application default', shape, atom.offset, { durationMs: 500 });
59
+ if (after !== 0)
60
+ warning('ANIMATION_AFTER_EFFECT_UNSUPPORTED', 'The legacy after-effect is not applied by the supported playback subset', shape, atom.offset, { afterEffect: after });
61
+ if ((flags >>> 4 & 3) === 1 || (flags >>> 6 & 3) === 1)
62
+ warning('ANIMATION_SOUND_MANUAL', 'Animation sound commands are retained; embedded media playback requires a user gesture', shape, atom.offset, { soundId: v.getUint32(8, true) });
63
+ }
64
+ };
65
+ visit(shapes);
66
+ return result.sort((a, b) => a.order - b.order).map(item => item.effect);
67
+ }
@@ -0,0 +1,72 @@
1
+ /** Record identifiers from Microsoft [MS-PPT] 2.13 and [MS-ODRAW]. */
2
+ export declare const RT: {
3
+ readonly Document: 1000;
4
+ readonly DocumentAtom: 1001;
5
+ readonly EndDocumentAtom: 1002;
6
+ readonly Slide: 1006;
7
+ readonly SlideAtom: 1007;
8
+ readonly Notes: 1008;
9
+ readonly NotesAtom: 1009;
10
+ readonly Environment: 1010;
11
+ readonly SlidePersistAtom: 1011;
12
+ readonly MainMaster: 1016;
13
+ readonly SSSlideInfoAtom: 1017;
14
+ readonly SlideViewInfo: 1018;
15
+ readonly VBAInfo: 1023;
16
+ readonly DocInfoList: 2000;
17
+ readonly PPDrawingGroup: 1035;
18
+ readonly PPDrawing: 1036;
19
+ readonly List: 2000;
20
+ readonly FontCollection: 2005;
21
+ readonly TextHeaderAtom: 3999;
22
+ readonly TextCharsAtom: 4000;
23
+ readonly StyleTextPropAtom: 4001;
24
+ readonly TextMasterStyleAtom: 4003;
25
+ readonly TextCharFormatAtom: 4004;
26
+ readonly TextParagraphFormatAtom: 4005;
27
+ readonly TextRulerAtom: 4006;
28
+ readonly TextBookmarkAtom: 4007;
29
+ readonly TextBytesAtom: 4008;
30
+ readonly TextSpecInfoAtom: 4010;
31
+ readonly DefaultRulerAtom: 4011;
32
+ readonly FontEntityAtom: 4023;
33
+ readonly CString: 4026;
34
+ readonly ExternalObjectList: 1033;
35
+ readonly ExternalObjectRefAtom: 3009;
36
+ readonly SlideListWithText: 4080;
37
+ readonly UserEditAtom: 4085;
38
+ readonly CurrentUserAtom: 4086;
39
+ readonly DateTimeMCAtom: 4087;
40
+ readonly HeadersFooters: 4057;
41
+ readonly HeadersFootersAtom: 4058;
42
+ readonly ColorSchemeAtom: 2032;
43
+ readonly PersistDirectoryAtom: 6002;
44
+ readonly PersistDirectoryFullBlock: 6001;
45
+ readonly OfficeArtClientTextBox: 61453;
46
+ readonly OfficeArtDggContainer: 61440;
47
+ readonly OfficeArtBStoreContainer: 61441;
48
+ readonly OfficeArtDgContainer: 61442;
49
+ readonly OfficeArtSpgrContainer: 61443;
50
+ readonly OfficeArtSpContainer: 61444;
51
+ readonly OfficeArtFSPGR: 61449;
52
+ readonly OfficeArtFSP: 61450;
53
+ readonly OfficeArtFOPT: 61451;
54
+ readonly OfficeArtClientAnchor: 61456;
55
+ readonly OfficeArtChildAnchor: 61455;
56
+ readonly OfficeArtClientData: 61457;
57
+ readonly OfficeArtFBSE: 61447;
58
+ readonly OfficeArtSecondaryFOPT: 61729;
59
+ readonly OfficeArtTertiaryFOPT: 61730;
60
+ readonly OutlineTextRefAtom: 3998;
61
+ readonly OEPlaceholderAtom: 3011;
62
+ };
63
+ export declare const DEFAULT_LIMITS: Readonly<{
64
+ maxFileBytes: number;
65
+ maxStreamBytes: number;
66
+ maxRecords: 1000000;
67
+ maxDepth: 64;
68
+ maxSlides: 10000;
69
+ maxShapes: 200000;
70
+ maxAssetBytes: number;
71
+ maxTextLength: number;
72
+ }>;
@@ -0,0 +1,21 @@
1
+ /** Record identifiers from Microsoft [MS-PPT] 2.13 and [MS-ODRAW]. */
2
+ export const RT = {
3
+ Document: 1000, DocumentAtom: 1001, EndDocumentAtom: 1002, Slide: 1006, SlideAtom: 1007,
4
+ Notes: 1008, NotesAtom: 1009, Environment: 1010, SlidePersistAtom: 1011, MainMaster: 1016,
5
+ SSSlideInfoAtom: 1017, SlideViewInfo: 1018, VBAInfo: 1023, DocInfoList: 2000,
6
+ PPDrawingGroup: 1035, PPDrawing: 1036, List: 2000, FontCollection: 2005,
7
+ TextHeaderAtom: 3999, TextCharsAtom: 4000, StyleTextPropAtom: 4001, TextMasterStyleAtom: 4003,
8
+ TextCharFormatAtom: 4004, TextParagraphFormatAtom: 4005, TextRulerAtom: 4006, TextBookmarkAtom: 4007,
9
+ TextBytesAtom: 4008, TextSpecInfoAtom: 4010, DefaultRulerAtom: 4011, FontEntityAtom: 4023,
10
+ CString: 4026, ExternalObjectList: 1033, ExternalObjectRefAtom: 3009,
11
+ SlideListWithText: 4080, UserEditAtom: 4085, CurrentUserAtom: 4086, DateTimeMCAtom: 4087,
12
+ HeadersFooters: 4057, HeadersFootersAtom: 4058, ColorSchemeAtom: 2032,
13
+ PersistDirectoryAtom: 6002, PersistDirectoryFullBlock: 6001, OfficeArtClientTextBox: 0xF00D,
14
+ OfficeArtDggContainer: 0xF000, OfficeArtBStoreContainer: 0xF001, OfficeArtDgContainer: 0xF002,
15
+ OfficeArtSpgrContainer: 0xF003, OfficeArtSpContainer: 0xF004, OfficeArtFSPGR: 0xF009,
16
+ OfficeArtFSP: 0xF00A, OfficeArtFOPT: 0xF00B, OfficeArtClientAnchor: 0xF010,
17
+ OfficeArtChildAnchor: 0xF00F, OfficeArtClientData: 0xF011, OfficeArtFBSE: 0xF007,
18
+ OfficeArtSecondaryFOPT: 0xF121, OfficeArtTertiaryFOPT: 0xF122,
19
+ OutlineTextRefAtom: 3998, OEPlaceholderAtom: 3011,
20
+ };
21
+ export const DEFAULT_LIMITS = Object.freeze({ maxFileBytes: 256 * 1024 * 1024, maxStreamBytes: 256 * 1024 * 1024, maxRecords: 1_000_000, maxDepth: 64, maxSlides: 10_000, maxShapes: 200_000, maxAssetBytes: 128 * 1024 * 1024, maxTextLength: 16 * 1024 * 1024 });
@@ -0,0 +1,15 @@
1
+ import type { Diagnostic, DrawingContext, ParseLimits, PptShape, RecordNode, Rect } from '../types.js';
2
+ interface Properties {
3
+ values: Map<number, number>;
4
+ complex: Map<number, Uint8Array>;
5
+ }
6
+ export declare function readProperties(record: RecordNode, bytes: Uint8Array, diagnostics: Diagnostic[]): Properties;
7
+ export declare function readDrawingDefaults(drawingGroup: RecordNode | undefined, bytes: Uint8Array, diagnostics: Diagnostic[], limits: ParseLimits, recordCount?: {
8
+ value: number;
9
+ }): Record<string, number>;
10
+ export declare function officeColor(value: number, colors: readonly number[], fallback?: string): string;
11
+ /** PPT client anchors differ from ODRAW child anchors: top comes before left. */
12
+ export declare function readAnchor(record: RecordNode, bytes: Uint8Array): Rect | undefined;
13
+ /** Shape tree order is paint order; patriarch groups only establish the drawing root. */
14
+ export declare function parseDrawing(record: RecordNode, ctx: DrawingContext): PptShape[];
15
+ export {};