@allyhub/sdk 0.12.0 → 0.13.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 (149) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/node_modules/@allyhub/audio/dist/plan.d.ts +3 -0
  3. package/dist/node_modules/@allyhub/audio/dist/render.js +1 -1
  4. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  5. package/dist/node_modules/@allyhub/chart/dist/chart-file.d.ts +2 -0
  6. package/dist/node_modules/@allyhub/chart/dist/chart-file.js +1 -1
  7. package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +3 -2
  8. package/dist/node_modules/@allyhub/chart/dist/chart.d.ts +5 -12
  9. package/dist/node_modules/@allyhub/chart/dist/chart.js +2 -1
  10. package/dist/node_modules/@allyhub/chart/dist/color.d.ts +37 -0
  11. package/dist/node_modules/@allyhub/chart/dist/color.js +2 -0
  12. package/dist/node_modules/@allyhub/chart/dist/index.d.ts +1 -0
  13. package/dist/node_modules/@allyhub/chart/dist/index.js +1 -1
  14. package/dist/node_modules/@allyhub/chart/dist/svg.js +1 -1
  15. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  16. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  17. package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +130 -0
  18. package/dist/node_modules/@allyhub/formats/dist/data/deck-code.js +1 -1
  19. package/dist/node_modules/@allyhub/formats/dist/data/gen.d.ts +3 -1
  20. package/dist/node_modules/@allyhub/formats/dist/data/gen.js +1 -1
  21. package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +512 -166
  22. package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
  23. package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +2523 -136
  24. package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
  25. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +931 -87
  26. package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
  27. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  28. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  29. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  30. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  31. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  32. package/dist/node_modules/@allyhub/ooxml/dist/color.d.ts +11 -0
  33. package/dist/node_modules/@allyhub/ooxml/dist/color.js +1 -1
  34. package/dist/node_modules/@allyhub/ooxml/dist/ext.d.ts +43 -0
  35. package/dist/node_modules/@allyhub/ooxml/dist/ext.js +1 -1
  36. package/dist/node_modules/@allyhub/ooxml/dist/index.d.ts +2 -1
  37. package/dist/node_modules/@allyhub/ooxml/dist/index.js +1 -1
  38. package/dist/node_modules/@allyhub/ooxml/dist/transform.d.ts +13 -0
  39. package/dist/node_modules/@allyhub/ooxml/dist/transform.js +2 -0
  40. package/dist/node_modules/@allyhub/ooxml/package.json +5 -1
  41. package/dist/node_modules/@allyhub/piece/dist/gen.d.ts +4 -4
  42. package/dist/node_modules/@allyhub/piece/dist/media.d.ts +2 -2
  43. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  44. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +35 -0
  45. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  46. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +19 -0
  47. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  48. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +35 -20
  49. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  50. package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +3 -3
  51. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +28 -2
  52. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  53. package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +6 -6
  54. package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +73 -10
  55. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  56. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +9 -9
  57. package/dist/node_modules/@allyhub/protocol/package.json +1 -1
  58. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  59. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  60. package/dist/node_modules/@allyhub/sheet/dist/annotations.d.ts +14 -0
  61. package/dist/node_modules/@allyhub/sheet/dist/annotations.js +2 -0
  62. package/dist/node_modules/@allyhub/sheet/dist/api/capabilities.js +1 -1
  63. package/dist/node_modules/@allyhub/sheet/dist/api/index.d.ts +1 -1
  64. package/dist/node_modules/@allyhub/sheet/dist/api/index.js +1 -1
  65. package/dist/node_modules/@allyhub/sheet/dist/api/rules.d.ts +24 -0
  66. package/dist/node_modules/@allyhub/sheet/dist/api/rules.js +1 -1
  67. package/dist/node_modules/@allyhub/sheet/dist/api/styles.d.ts +12 -0
  68. package/dist/node_modules/@allyhub/sheet/dist/api/styles.js +1 -1
  69. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.d.ts +3 -1
  70. package/dist/node_modules/@allyhub/sheet/dist/api/workbook.js +1 -1
  71. package/dist/node_modules/@allyhub/sheet/dist/arrange.d.ts +28 -1
  72. package/dist/node_modules/@allyhub/sheet/dist/arrange.js +1 -1
  73. package/dist/node_modules/@allyhub/sheet/dist/data-tools.d.ts +42 -0
  74. package/dist/node_modules/@allyhub/sheet/dist/data-tools.js +2 -0
  75. package/dist/node_modules/@allyhub/sheet/dist/edit.d.ts +43 -2
  76. package/dist/node_modules/@allyhub/sheet/dist/edit.js +1 -1
  77. package/dist/node_modules/@allyhub/sheet/dist/fill.d.ts +10 -0
  78. package/dist/node_modules/@allyhub/sheet/dist/fill.js +1 -1
  79. package/dist/node_modules/@allyhub/sheet/dist/filter.js +1 -1
  80. package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.d.ts +14 -0
  81. package/dist/node_modules/@allyhub/sheet/dist/formula/rewrite.js +1 -1
  82. package/dist/node_modules/@allyhub/sheet/dist/html.js +10 -10
  83. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +6 -1
  84. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  85. package/dist/node_modules/@allyhub/sheet/dist/outline.d.ts +30 -0
  86. package/dist/node_modules/@allyhub/sheet/dist/outline.js +2 -0
  87. package/dist/node_modules/@allyhub/sheet/dist/rich.d.ts +29 -0
  88. package/dist/node_modules/@allyhub/sheet/dist/rich.js +2 -0
  89. package/dist/node_modules/@allyhub/sheet/dist/rules.js +1 -1
  90. package/dist/node_modules/@allyhub/sheet/dist/table-style.d.ts +6 -0
  91. package/dist/node_modules/@allyhub/sheet/dist/table-style.js +1 -1
  92. package/dist/node_modules/@allyhub/sheet/dist/table-styles.js +1 -1
  93. package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +5 -1
  94. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
  95. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
  96. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
  97. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +17 -1
  98. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
  99. package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.d.ts +56 -0
  100. package/dist/node_modules/@allyhub/sheet/dist/xlsx/runs.js +2 -0
  101. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
  102. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
  103. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
  104. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  105. package/dist/node_modules/@allyhub/slides-core/dist/animation.d.ts +117 -21
  106. package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
  107. package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +181 -30
  108. package/dist/node_modules/@allyhub/slides-core/dist/api.js +3 -3
  109. package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
  110. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.d.ts +28 -2
  111. package/dist/node_modules/@allyhub/slides-core/dist/chart-api.js +1 -1
  112. package/dist/node_modules/@allyhub/slides-core/dist/check.js +1 -1
  113. package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +222 -4
  114. package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
  115. package/dist/node_modules/@allyhub/slides-core/dist/file.d.ts +6 -0
  116. package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
  117. package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.d.ts +3 -0
  118. package/dist/node_modules/@allyhub/slides-core/dist/generated/table-styles.js +2 -0
  119. package/dist/node_modules/@allyhub/slides-core/dist/index.d.ts +3 -0
  120. package/dist/node_modules/@allyhub/slides-core/dist/index.js +1 -1
  121. package/dist/node_modules/@allyhub/slides-core/dist/merge.js +1 -1
  122. package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +98 -10
  123. package/dist/node_modules/@allyhub/slides-core/dist/numbering.d.ts +6 -0
  124. package/dist/node_modules/@allyhub/slides-core/dist/numbering.js +2 -0
  125. package/dist/node_modules/@allyhub/slides-core/dist/office.d.ts +53 -0
  126. package/dist/node_modules/@allyhub/slides-core/dist/office.js +1 -1
  127. package/dist/node_modules/@allyhub/slides-core/dist/patterns.d.ts +8 -0
  128. package/dist/node_modules/@allyhub/slides-core/dist/patterns.js +2 -0
  129. package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +36 -6
  130. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
  131. package/dist/node_modules/@allyhub/slides-core/dist/script.d.ts +11 -0
  132. package/dist/node_modules/@allyhub/slides-core/dist/script.js +2 -2
  133. package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +1 -1
  134. package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
  135. package/dist/node_modules/@allyhub/slides-core/dist/table-style.d.ts +48 -0
  136. package/dist/node_modules/@allyhub/slides-core/dist/table-style.js +2 -0
  137. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  138. package/dist/node_modules/@allyhub/video-core/dist/mix-plan.js +1 -1
  139. package/dist/node_modules/@allyhub/video-core/dist/timeline.d.ts +4 -0
  140. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  141. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  142. package/docs/defaults.md +78 -4
  143. package/docs/image.md +1 -1
  144. package/docs/pictures.md +1 -1
  145. package/docs/project.md +1 -1
  146. package/docs/sheets.md +19 -9
  147. package/docs/slides.md +30 -16
  148. package/docs/speech.md +1 -1
  149. package/package.json +1 -1
@@ -1,38 +1,79 @@
1
- import type { AnimationDirection, AnimationEffect, AnimationFile, AnimationStart, SlideTransitionType, TransitionFile } from "@allyhub/formats";
1
+ import type { AnimateText, AnimationDirection, AnimationRepeat, AnimationEffect, AnimationFile, AnimationStart, SlideTransitionType, TransitionFile } from "@allyhub/formats";
2
2
  import type { Frame, PathStep } from "./model.js";
3
3
  /** PowerPoint's default length of each effect, seconds. */
4
4
  export declare const ANIMATION_DURATIONS: Readonly<Record<AnimationEffect, number>>;
5
5
  export declare const isExit: (e: AnimationEffect) => boolean;
6
6
  export declare const isEntrance: (e: AnimationEffect) => boolean;
7
- /** PowerPoint's default length of each transition, seconds. */
7
+ /** PowerPoint's default length of each transition, seconds (a cut has none). */
8
8
  export declare const TRANSITION_DURATIONS: Readonly<Record<SlideTransitionType, number>>;
9
+ /**
10
+ * Each transition's Effect Options, as PowerPoint offers them: its ways,
11
+ * the first its default, and whether it can go through black.
12
+ */
13
+ export declare const TRANSITION_OPTIONS: Readonly<Record<SlideTransitionType, {
14
+ directions: readonly AnimationDirection[];
15
+ throughBlack: boolean;
16
+ }>>;
17
+ /**
18
+ * Each effect's Effect Options, as PowerPoint offers them: its ways and
19
+ * its amounts, the first way its default, and its amount's default (a
20
+ * Grow/Shrink's size a share of its own, a spin's degrees, a
21
+ * Transparency's share that shows through).
22
+ */
23
+ export declare const EFFECT_OPTIONS: Readonly<Record<AnimationEffect, {
24
+ directions: readonly AnimationDirection[];
25
+ amounts?: readonly number[];
26
+ amount?: number;
27
+ }>>;
28
+ /** Whether an effect takes a way: one it offers. */
29
+ export declare const effectTakes: (effect: AnimationEffect, d: AnimationDirection) => boolean;
9
30
  /** A slide's transition with all it leaves to its defaults said. */
10
31
  export interface ResolvedTransition {
11
32
  type: SlideTransitionType;
33
+ /** One of its type's ways; a fade's, a cut's and a morph's is unused. */
12
34
  direction: AnimationDirection;
35
+ throughBlack: boolean;
13
36
  duration: number;
14
37
  }
38
+ /** Whether a transition takes a way: one its type offers. */
39
+ export declare const transitionTakes: (type: SlideTransitionType, d: AnimationDirection) => boolean;
15
40
  export declare const resolveTransition: (t: TransitionFile) => ResolvedTransition;
41
+ /** One of a transition's two slides, `p` of the way through it. */
42
+ export interface TransitionSlide {
43
+ opacity: number;
44
+ /** Moved by, in shares of the slide. */
45
+ x: number;
46
+ y: number;
47
+ /** Grown by, from its middle, and turned by, degrees clockwise. */
48
+ scale: number;
49
+ rotate: number;
50
+ /** What is cut from each side, a share of the slide. */
51
+ clip?: {
52
+ top: number;
53
+ right: number;
54
+ bottom: number;
55
+ left: number;
56
+ };
57
+ /** What shows of it, a polygon in shares of the slide (a split's two halves). */
58
+ polygon?: readonly (readonly [number, number])[];
59
+ }
16
60
  /** How the two slides of a transition are drawn, `p` of the way through it. */
17
61
  export interface TransitionState {
18
- /** The slide coming on: moved by, in shares of the slide, and what is cut from it. */
19
- incoming: {
20
- opacity: number;
21
- x: number;
22
- y: number;
23
- clip?: {
24
- top: number;
25
- right: number;
26
- bottom: number;
27
- left: number;
28
- };
29
- };
30
- /** The slide going: moved by, in shares of the slide. */
31
- outgoing: {
32
- x: number;
33
- y: number;
34
- };
62
+ /** The slide coming on. */
63
+ incoming: TransitionSlide;
64
+ /** The slide going. */
65
+ outgoing: TransitionSlide;
66
+ /** The slide going is drawn over the one coming (an uncover, a reveal, a zoom out). */
67
+ outgoingOver: boolean;
68
+ /** What is under both is black: they fade to it and from it (Through Black). */
69
+ black: boolean;
35
70
  }
71
+ /**
72
+ * What a split shows `shown` of the way open, in shares of what it splits:
73
+ * out from its middle line, or in from its two edges, along x for a
74
+ * vertical line, along y for a horizontal one.
75
+ */
76
+ export declare function barn(d: AnimationDirection, shown: number): Pick<TransitionSlide, "clip" | "polygon">;
36
77
  /** A transition's drawing `p` of the way through it. A morph's own is `morphFrame`'s. */
37
78
  export declare function transitionAt(t: ResolvedTransition, p: number): TransitionState;
38
79
  /** A shape's frame on its way from where it was to where it stands: the morph's ease in and out. */
@@ -47,15 +88,52 @@ export interface ResolvedAnimation {
47
88
  start: AnimationStart;
48
89
  duration: number;
49
90
  delay: number;
91
+ /** Its amount, where it has one: a Grow/Shrink's size, a spin's degrees, a Transparency's share. */
92
+ amount?: number;
50
93
  /** A motion path's steps, in EMU from where the shape stands. */
51
94
  path?: PathStep[];
95
+ /** By word or letter: how far apart each starts (a share of its duration), and how many its text has. */
96
+ iterate?: {
97
+ by: AnimateText;
98
+ delay: number;
99
+ units: number;
100
+ };
101
+ /** How many times it plays (once where absent), or until the next click or the slide's end. */
102
+ repeat?: number | AnimationRepeat;
103
+ /** Back as it was before it once it has played. */
104
+ rewind?: true;
52
105
  }
106
+ /** PowerPoint's delay between words or letters, a share of an effect's duration. */
107
+ export declare const TEXT_DELAY = 0.1;
108
+ /** A text's words (what stands between spaces) or its letters (each grapheme but spaces), as an effect by word or by letter takes them one at a time. */
109
+ export declare function textUnits(text: string, by: AnimateText): string[];
110
+ /** A part of a piece of text: the piece by its place in the list, from `start` to `end`. */
111
+ export interface TextPart {
112
+ piece: number;
113
+ start: number;
114
+ end: number;
115
+ }
116
+ /**
117
+ * The units an effect by word or by letter takes one at a time, across a
118
+ * paragraph's pieces of text (its runs, or the text the stage draws them
119
+ * in): a word is what stands between spaces, whichever pieces it is in
120
+ * ("Ally**Hub**" is one), each unit the parts of the pieces it takes; a
121
+ * letter is each grapheme but spaces. The timing counts them and the stage
122
+ * draws them, so both count alike.
123
+ */
124
+ export declare function unitsAcross(pieces: readonly string[], by: AnimateText): TextPart[][];
125
+ /** One round of an animation, seconds: by word or letter, from its first's start to its last's end. */
126
+ export declare const roundOf: (a: ResolvedAnimation) => number;
127
+ /** How long an animation plays on its slide's clock: its rounds, one where it repeats until something. */
128
+ export declare const spanOf: (a: ResolvedAnimation) => number;
53
129
  /** An animation on its slide's clock. */
54
130
  export interface TimedAnimation extends ResolvedAnimation {
55
131
  /** The step it plays in: 0 before the first click. */
56
132
  step: number;
57
133
  from: number;
58
134
  to: number;
135
+ /** Where it repeats until the next click or the slide's end: when it stops, its step's still or the slide's last. */
136
+ stop?: number;
59
137
  }
60
138
  export interface SlideClock {
61
139
  timed: TimedAnimation[];
@@ -63,7 +141,9 @@ export interface SlideClock {
63
141
  rests: number[];
64
142
  }
65
143
  /** An animation as the slides file has it, with its defaults; undefined for a path that does not read. */
66
- export declare function resolveAnimation(a: AnimationFile): ResolvedAnimation | undefined;
144
+ export declare function resolveAnimation(a: AnimationFile,
145
+ /** How many words or letters its text has, for one by word or letter. */
146
+ units?: number): ResolvedAnimation | undefined;
67
147
  /**
68
148
  * A slide's clock. `moving` is how long each shape that moves by its own
69
149
  * code (a component) takes, by name: a step that brings one on rests no
@@ -99,12 +179,19 @@ export declare function clockOf(slide: {
99
179
  component?: {
100
180
  dur?: number;
101
181
  };
182
+ media?: {
183
+ playback?: {
184
+ start?: "auto" | "on-click" | undefined;
185
+ } | undefined;
186
+ } | undefined;
102
187
  }[];
103
188
  transition?: ResolvedTransition;
104
189
  }, first: boolean): SlideClock & {
105
190
  lead: number;
106
191
  comesOn: (shape: string) => number;
107
192
  goesOff: (shape: string) => number | undefined;
193
+ /** When a movie or a sound starts playing: as it comes on, or a click of its own after the slide's animations (PowerPoint's In Click Sequence). */
194
+ playsAt: (shape: string) => number;
108
195
  };
109
196
  /** How a shape, or a paragraph of one, is drawn at a moment. */
110
197
  export interface DrawnState {
@@ -114,6 +201,11 @@ export interface DrawnState {
114
201
  x: number;
115
202
  y: number;
116
203
  scale: number;
204
+ /** Grown across and down besides, from its middle (a Grow/Shrink). */
205
+ sx: number;
206
+ sy: number;
207
+ /** Turned by, degrees clockwise (a spin). */
208
+ rotate: number;
117
209
  /** What is cut from each side, a share of its size. */
118
210
  clip?: {
119
211
  top: number;
@@ -121,6 +213,8 @@ export interface DrawnState {
121
213
  bottom: number;
122
214
  left: number;
123
215
  };
216
+ /** What shows of it, a polygon in shares of its size (a split in from both edges). */
217
+ polygon?: readonly (readonly [number, number])[];
124
218
  }
125
219
  /** Where a path has got to, a share `p` of its length along it. */
126
220
  export declare function pathPoint(steps: readonly PathStep[], p: number): {
@@ -135,7 +229,9 @@ export declare function pathPoint(steps: readonly PathStep[], p: number): {
135
229
  export declare function drawnAt(animations: readonly TimedAnimation[], t: number, f: Frame, slide: {
136
230
  width: number;
137
231
  height: number;
138
- }): DrawnState;
232
+ },
233
+ /** One word or letter of what these animate by word or letter, from 0: its own time. */
234
+ unit?: number): DrawnState;
139
235
  /** Each thing a slide animates: a shape, or a paragraph of one, with its animations in order. */
140
236
  export declare function animationTargets(timed: readonly TimedAnimation[]): {
141
237
  shape: string;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{pathSteps as w}from"./path.js";import{EMU_PER_PT as u}from"./units.js";export const ANIMATION_DURATIONS={appear:0,fade:.5,wipe:.5,"fly-in":.5,zoom:.5,disappear:0,"fade-out":.5,"wipe-out":.5,"fly-out":.5,"zoom-out":.5,pulse:.5,path:2};const T=new Set(["disappear","fade-out","wipe-out","fly-out","zoom-out"]),E=new Set(["appear","fade","wipe","fly-in","zoom"]);export const isExit=t=>T.has(t),isEntrance=t=>E.has(t),TRANSITION_DURATIONS={fade:.7,push:1,wipe:1,morph:2},resolveTransition=t=>({type:t.type,direction:t.direction??"from-right",duration:t.duration??TRANSITION_DURATIONS[t.type]});const N={"from-left":{x:-1,y:0},"from-right":{x:1,y:0},"from-top":{x:0,y:-1},"from-bottom":{x:0,y:1}};export function transitionAt(t,o){const e={opacity:1,x:0,y:0};if(t.type==="fade")return{incoming:{...e,opacity:o},outgoing:{x:0,y:0}};if(t.type==="push"){const r=N[t.direction];return{incoming:{...e,x:r.x*(1-o),y:r.y*(1-o)},outgoing:{x:-r.x*o,y:-r.y*o}}}return t.type==="wipe"?{incoming:{...e,clip:S(t.direction,1-o)},outgoing:{x:0,y:0}}:{incoming:e,outgoing:{x:0,y:0}}}export function morphFrame(t,o,e){const r=e*e*(3-2*e),i=(p,f)=>p+(f-p)*r;return{left:i(t.left,o.left),top:i(t.top,o.top),width:i(t.width,o.width),height:i(t.height,o.height)}}export function resolveAnimation(t){const o=t.path===void 0?void 0:w(t.path);if(!(t.path!==void 0&&!o)&&!(t.effect==="path"&&!o))return{shape:t.shape,...t.paragraph===void 0?{}:{paragraph:t.paragraph},effect:t.effect,direction:t.direction??"from-bottom",start:t.start??"on-click",duration:t.duration??ANIMATION_DURATIONS[t.effect],delay:t.delay??0,...o?{path:o.map(e=>e.op==="close"?e:e.op!=="curve"?{...e,x:e.x*u,y:e.y*u}:{op:"curve",x1:e.x1*u,y1:e.y1*u,x2:e.x2*u,y2:e.y2*u,x:e.x*u,y:e.y*u})}:{}}}export function slideClock(t,o,e,r=0,i=0){const p=new Set(t.filter(s=>isEntrance(s.effect)).map(s=>s.shape)),f=[...o].filter(([s])=>!p.has(s)).map(([,s])=>s);let n=i+Math.max(0,...f);if(t.length===0)return{timed:[],rests:[Math.max(e,i,...f)]};const c=[],a=[];let h=0,y=i;for(const s of t){s.start==="on-click"?(c.push(n),h++,n+=r,y=n):s.start==="after-previous"&&(y=n);const l=y+s.delay,d=l+s.duration;a.push({...s,step:h,from:l,to:d}),n=Math.max(n,d);const m=o.get(s.shape);m!==void 0&&isEntrance(s.effect)&&(n=Math.max(n,l+m))}return c.push(n),{timed:a,rests:c}}export const SLIDE_SECONDS=4,componentSeconds=t=>t.dur??SLIDE_SECONDS,DECK_FPS=30;const A=t=>Math.ceil(t*DECK_FPS-1e-6)/DECK_FPS;export const inTransition=(t,o)=>t<o-1e-6;export function clockOf(t,o){const e=o?0:t.transition?.duration??0,r=slideClock(t.animations,new Map(t.shapes.flatMap(i=>i.component?[[i.name,componentSeconds(i.component)-1/DECK_FPS]]:[])),SLIDE_SECONDS-1/DECK_FPS,1/DECK_FPS,e);return{timed:r.timed,rests:r.rests.map(A),lead:e,comesOn:i=>r.timed.find(p=>p.shape===i&&isEntrance(p.effect))?.from??e,goesOff:i=>r.timed.find(p=>p.shape===i&&isExit(p.effect))?.to}}const g=1e-6,x={hidden:!1,opacity:1,x:0,y:0,scale:1},I=t=>1-(1-t)*(1-t);function O(t){const o=[];let e={x:0,y:0};for(const r of t){if(r.op==="close")continue;if(r.op!=="curve"){e={x:r.x,y:r.y},o.push(e);continue}const i=e;for(let p=1;p<=24;p++){const f=p/24,n=1-f,c=(a,h,y,s)=>n*n*n*a+3*n*n*f*h+3*n*f*f*y+f*f*f*s;o.push({x:c(i.x,r.x1,r.x2,r.x),y:c(i.y,r.y1,r.y2,r.y)})}e={x:r.x,y:r.y}}return o}export function pathPoint(t,o){const e=O(t),[r]=e;if(!r)return{x:0,y:0};let i=0;for(let f=1;f<e.length;f++){const[n,c]=[e[f-1]??r,e[f]??r];i+=Math.hypot(c.x-n.x,c.y-n.y)}let p=i*o;for(let f=1;f<e.length;f++){const[n,c]=[e[f-1]??r,e[f]??r],a=Math.hypot(c.x-n.x,c.y-n.y);if(p<=a&&a>0){const h=p/a;return{x:n.x+(c.x-n.x)*h,y:n.y+(c.y-n.y)*h}}p-=a}return e.at(-1)??r}function b(t,o,e){return t==="from-left"?{x:-(o.left+o.width),y:0}:t==="from-right"?{x:e.width-o.left,y:0}:t==="from-top"?{x:0,y:-(o.top+o.height)}:{x:0,y:e.height-o.top}}function S(t,o){const e={top:0,right:0,bottom:0,left:0};return t==="from-left"?e.right=o:t==="from-right"?e.left=o:t==="from-top"?e.bottom=o:e.top=o,e}function M(t,o,e,r){if(t.effect==="fade"||t.effect==="fade-out")return{opacity:o};if(t.effect==="zoom"||t.effect==="zoom-out")return{scale:o,opacity:o};if(t.effect==="wipe"||t.effect==="wipe-out")return{clip:S(t.direction,1-o)};if(t.effect==="fly-in"||t.effect==="fly-out"){const i=b(t.direction,e,r);return{x:i.x*(1-o),y:i.y*(1-o)}}return{}}export function drawnAt(t,o,e,r){let i={...x};const[p]=t,f=n=>o<n-g;if(p&&isEntrance(p.effect)&&f(p.from))return{...x,hidden:!0};for(const n of t){if(f(n.from))break;const c=n.to>n.from&&o<n.to-g?Math.min(1,(o-n.from)/(n.to-n.from)):1;if(n.effect==="path"&&n.path){const a=pathPoint(n.path,c);i={...i,x:a.x,y:a.y}}else n.effect==="pulse"?i={...i,scale:1+.05*Math.sin(c*Math.PI)}:isExit(n.effect)?i=c>=1?{...x,hidden:!0}:{...i,...M(n,1-(n.effect==="fly-out"?c*c:c),e,r)}:i={...x,...c<1?M(n,n.effect==="fly-in"?I(c):c,e,r):{}}}return i}export function animationTargets(t){const o=new Map;for(const e of t){const r=JSON.stringify([e.shape,e.paragraph??null]),i=o.get(r);i?i.animations.push(e):o.set(r,{shape:e.shape,...e.paragraph===void 0?{}:{paragraph:e.paragraph},animations:[e]})}return[...o.values()]}
2
+ import{pathSteps as E}from"./path.js";import{EMU_PER_PT as h}from"./units.js";export const ANIMATION_DURATIONS={appear:0,fade:.5,"fly-in":.5,"float-in":1,split:.5,wipe:.5,zoom:.5,disappear:0,"fade-out":.5,"fly-out":.5,"float-out":1,"split-out":.5,"wipe-out":.5,"zoom-out":.5,pulse:.5,"grow-shrink":2,spin:2,transparency:.5,path:2};const I=new Set(["disappear","fade-out","fly-out","float-out","split-out","wipe-out","zoom-out"]),A=new Set(["appear","fade","fly-in","float-in","split","wipe","zoom"]);export const isExit=t=>I.has(t),isEntrance=t=>A.has(t),TRANSITION_DURATIONS={fade:.7,push:1,wipe:1,split:1.5,reveal:2,cut:0,cover:1,uncover:1,zoom:1,morph:2};const x=["from-right","from-top","from-left","from-bottom"],w=[...x,"from-top-right","from-bottom-right","from-top-left","from-bottom-left"];export const TRANSITION_OPTIONS={fade:{directions:[],throughBlack:!0},push:{directions:x,throughBlack:!1},wipe:{directions:x,throughBlack:!1},split:{directions:["vertical-out","vertical-in","horizontal-out","horizontal-in"],throughBlack:!1},reveal:{directions:["from-right","from-left"],throughBlack:!0},cut:{directions:[],throughBlack:!0},cover:{directions:w,throughBlack:!1},uncover:{directions:w,throughBlack:!1},zoom:{directions:["in","out","rotate"],throughBlack:!1},morph:{directions:[],throughBlack:!1}};const S=["vertical-out","vertical-in","horizontal-out","horizontal-in"];export const EFFECT_OPTIONS={appear:{directions:[]},fade:{directions:[]},"fly-in":{directions:["from-bottom","from-top","from-left","from-right"]},"float-in":{directions:["up","down"]},split:{directions:S},wipe:{directions:["from-bottom","from-top","from-left","from-right"]},zoom:{directions:[]},disappear:{directions:[]},"fade-out":{directions:[]},"fly-out":{directions:["from-bottom","from-top","from-left","from-right"]},"float-out":{directions:["up","down"]},"split-out":{directions:S},"wipe-out":{directions:["from-bottom","from-top","from-left","from-right"]},"zoom-out":{directions:[]},pulse:{directions:[]},"grow-shrink":{directions:["both","horizontal","vertical"],amounts:[1.1,.5,1.5,4],amount:1.5},spin:{directions:["clockwise","counterclockwise"],amounts:[90,180,360,720],amount:360},transparency:{directions:[],amounts:[.25,.5,.75,1],amount:.5},path:{directions:[]}},effectTakes=(t,e)=>EFFECT_OPTIONS[t].directions.includes(e),transitionTakes=(t,e)=>TRANSITION_OPTIONS[t].directions.includes(e),resolveTransition=t=>{const e=TRANSITION_OPTIONS[t.type];return{type:t.type,direction:t.direction!==void 0&&e.directions.includes(t.direction)?t.direction:e.directions[0]??"from-right",throughBlack:t.through_black===!0&&e.throughBlack,duration:t.duration??TRANSITION_DURATIONS[t.type]}};const B={"from-left":{x:-1,y:0},"from-right":{x:1,y:0},"from-top":{x:0,y:-1},"from-bottom":{x:0,y:1},"from-top-right":{x:1,y:-1},"from-bottom-right":{x:1,y:1},"from-top-left":{x:-1,y:-1},"from-bottom-left":{x:-1,y:1}},m=t=>B[t]??{x:0,y:1},l={opacity:1,x:0,y:0,scale:1,rotate:0};export function barn(t,e){const n=t==="vertical-out"||t==="vertical-in";if(t==="vertical-out"||t==="horizontal-out"){const s=(1-e)/2;return{clip:n?{top:0,right:s,bottom:0,left:s}:{top:s,right:0,bottom:s,left:0}}}const f=e/2,i=1-f,r=[[0,0],[f,0],[f,1],[i,1],[i,0],[1,0],[1,1],[0,1]];return{polygon:n?r:r.map(([s,c])=>[c,s])}}export function transitionAt(t,e){const o={incoming:{...l},outgoing:{...l},outgoingOver:!1,black:!1},f=e<.5;switch(t.type){case"fade":return t.throughBlack?{...o,black:!0,outgoing:{...l,opacity:f?1-2*e:0},incoming:{...l,opacity:f?0:2*e-1}}:{...o,incoming:{...l,opacity:e}};case"cut":return t.throughBlack?{...o,black:!0,outgoing:{...l,opacity:0},incoming:{...l,opacity:e>=1?1:0}}:o;case"push":{const i=m(t.direction);return{...o,incoming:{...l,x:i.x*(1-e),y:i.y*(1-e)},outgoing:{...l,x:-i.x*e,y:-i.y*e}}}case"cover":{const i=m(t.direction);return{...o,incoming:{...l,x:i.x*(1-e),y:i.y*(1-e)}}}case"uncover":{const i=m(t.direction);return{...o,outgoingOver:!0,outgoing:{...l,x:-i.x*e,y:-i.y*e}}}case"reveal":{const i=m(t.direction);return t.throughBlack?{...o,outgoingOver:!0,black:!0,outgoing:{...l,x:-i.x*Math.min(1,2*e),opacity:f?1-2*e:0},incoming:{...l,opacity:f?0:2*e-1}}:{...o,outgoingOver:!0,outgoing:{...l,x:-i.x*e,opacity:1-e}}}case"wipe":return{...o,incoming:{...l,clip:O(t.direction,1-e)}};case"split":return{...o,incoming:{...l,...barn(t.direction,e)}};case"zoom":return t.direction==="out"?{...o,outgoingOver:!0,outgoing:{...l,scale:1-e,opacity:1-e}}:{...o,incoming:{...l,scale:e,opacity:t.direction==="rotate"?1:e,rotate:t.direction==="rotate"?-720*(1-e):0}};case"morph":return o}}export function morphFrame(t,e,n){const o=n*n*(3-2*n),f=(i,r)=>i+(r-i)*o;return{left:f(t.left,e.left),top:f(t.top,e.top),width:f(t.width,e.width),height:f(t.height,e.height)}}export const TEXT_DELAY=.1;const T=new Intl.Segmenter(void 0,{granularity:"grapheme"});export function textUnits(t,e){return e==="word"?t.split(/\s+/u).filter(n=>n!==""):[...T.segment(t)].map(n=>n.segment).filter(n=>!/^\s+$/u.test(n))}export function unitsAcross(t,e){const n=[];let o=[];return t.forEach((f,i)=>{if(e==="letter"){for(const r of T.segment(f))/^\s+$/u.test(r.segment)||n.push([{piece:i,start:r.index,end:r.index+r.segment.length}]);return}for(const r of f.matchAll(/\s+|\S+/gu))/^\s/u.test(r[0])?(o.length>0&&n.push(o),o=[]):o.push({piece:i,start:r.index,end:r.index+r[0].length})}),o.length>0&&n.push(o),n}export const roundOf=t=>t.iterate?t.duration*(1+Math.max(0,t.iterate.units-1)*t.iterate.delay):t.duration,spanOf=t=>roundOf(t)*(typeof t.repeat=="number"?t.repeat:1);export function resolveAnimation(t,e=1){const n=t.path===void 0?void 0:E(t.path);if(t.path!==void 0&&!n||t.effect==="path"&&!n)return;const o=EFFECT_OPTIONS[t.effect],f=o.amount===void 0?void 0:t.amount??o.amount;return{shape:t.shape,...t.paragraph===void 0?{}:{paragraph:t.paragraph},effect:t.effect,direction:t.direction!==void 0&&o.directions.includes(t.direction)?t.direction:o.directions[0]??"from-bottom",...f===void 0?{}:{amount:t.effect==="transparency"?Math.min(1,f):f},start:t.start??"on-click",duration:t.duration??ANIMATION_DURATIONS[t.effect],delay:t.delay??0,...t.animate_text===void 0?{}:{iterate:{by:t.animate_text,delay:t.text_delay??TEXT_DELAY,units:Math.max(1,e)}},...t.repeat===void 0||t.repeat===1?{}:{repeat:t.repeat},...t.rewind?{rewind:!0}:{},...n?{path:n.map(i=>i.op==="close"?i:i.op!=="curve"?{...i,x:i.x*h,y:i.y*h}:{op:"curve",x1:i.x1*h,y1:i.y1*h,x2:i.x2*h,y2:i.y2*h,x:i.x*h,y:i.y*h})}:{}}}export function slideClock(t,e,n,o=0,f=0){const i=new Set(t.filter(a=>isEntrance(a.effect)).map(a=>a.shape)),r=[...e].filter(([a])=>!i.has(a)).map(([,a])=>a);let s=f+Math.max(0,...r);if(t.length===0)return{timed:[],rests:[Math.max(n,f,...r)]};const c=[],d=[];let u=0,p=f;for(const a of t){a.start==="on-click"?(c.push(s),u++,s+=o,p=s):a.start==="after-previous"&&(p=s);const g=p+a.delay,v=g+spanOf(a);d.push({...a,step:u,from:g,to:v}),s=Math.max(s,v);const b=e.get(a.shape);b!==void 0&&isEntrance(a.effect)&&(s=Math.max(s,g+b))}c.push(s);for(const a of d)a.repeat==="until-next-click"?a.stop=c[a.step]??s:a.repeat==="until-end-of-slide"&&(a.stop=s);return{timed:d,rests:c}}export const SLIDE_SECONDS=4,componentSeconds=t=>t.dur??SLIDE_SECONDS,DECK_FPS=30;const M=t=>Math.ceil(t*DECK_FPS-1e-6)/DECK_FPS;export const inTransition=(t,e)=>t<e-1e-6;export function clockOf(t,e){const n=e?0:t.transition?.duration??0,o=slideClock(t.animations,new Map(t.shapes.flatMap(s=>s.component?[[s.name,componentSeconds(s.component)-1/DECK_FPS]]:[])),SLIDE_SECONDS-1/DECK_FPS,1/DECK_FPS,n),f=o.rests.map(M),i=s=>o.timed.find(c=>c.shape===s&&isEntrance(c.effect))?.from??n,r=new Map;for(const s of t.shapes){if(s.media?.playback?.start!=="on-click")continue;const c=f.at(-1)??n;r.set(s.name,c),f.push(M(c+1/DECK_FPS))}return{timed:o.timed,rests:f,lead:n,comesOn:i,goesOff:s=>o.timed.find(c=>c.shape===s&&isExit(c.effect))?.to,playsAt:s=>r.get(s)??i(s)}}const k=1e-6,y={hidden:!1,opacity:1,x:0,y:0,scale:1,sx:1,sy:1,rotate:0},N=t=>1-(1-t)*(1-t);function _(t){const e=[];let n={x:0,y:0};for(const o of t){if(o.op==="close")continue;if(o.op!=="curve"){n={x:o.x,y:o.y},e.push(n);continue}const f=n;for(let i=1;i<=24;i++){const r=i/24,s=1-r,c=(d,u,p,a)=>s*s*s*d+3*s*s*r*u+3*s*r*r*p+r*r*r*a;e.push({x:c(f.x,o.x1,o.x2,o.x),y:c(f.y,o.y1,o.y2,o.y)})}n={x:o.x,y:o.y}}return e}export function pathPoint(t,e){const n=_(t),[o]=n;if(!o)return{x:0,y:0};let f=0;for(let r=1;r<n.length;r++){const[s,c]=[n[r-1]??o,n[r]??o];f+=Math.hypot(c.x-s.x,c.y-s.y)}let i=f*e;for(let r=1;r<n.length;r++){const[s,c]=[n[r-1]??o,n[r]??o],d=Math.hypot(c.x-s.x,c.y-s.y);if(i<=d&&d>0){const u=i/d;return{x:s.x+(c.x-s.x)*u,y:s.y+(c.y-s.y)*u}}i-=d}return n.at(-1)??o}function P(t,e,n){return t==="from-left"?{x:-(e.left+e.width),y:0}:t==="from-right"?{x:n.width-e.left,y:0}:t==="from-top"?{x:0,y:-(e.top+e.height)}:{x:0,y:n.height-e.top}}function O(t,e){const n={top:0,right:0,bottom:0,left:0};return t==="from-left"?n.right=e:t==="from-right"?n.left=e:t==="from-top"?n.bottom=e:n.top=e,n}const D={"vertical-out":"vertical-in","vertical-in":"vertical-out","horizontal-out":"horizontal-in","horizontal-in":"horizontal-out"};function z(t,e,n,o){if(t.effect==="fade"||t.effect==="fade-out")return{opacity:e};if(t.effect==="zoom"||t.effect==="zoom-out")return{scale:e,opacity:e};if(t.effect==="wipe"||t.effect==="wipe-out")return{clip:O(t.direction,1-e)};if(t.effect==="split")return barn(t.direction,e);if(t.effect==="split-out")return barn(D[t.direction]??"vertical-in",e);if(t.effect==="float-in"||t.effect==="float-out"){const f=.1*o.height*(1-e),i=t.effect==="float-in"==(t.direction==="down")?-1:1;return{opacity:e,y:i*f}}if(t.effect==="fly-in"||t.effect==="fly-out"){const f=P(t.direction,n,o);return{x:f.x*(1-e),y:f.y*(1-e)}}return{}}export function drawnAt(t,e,n,o,f){const[i]=t;let r=i&&isEntrance(i.effect)?{...y,hidden:!0}:{...y};const s=c=>e<c-k;for(const c of t){const d=f!==void 0&&c.iterate?f*c.iterate.delay*c.duration:0;if(s(c.from+d))break;const u=R(c,e,d);if(u!==void 0)if(c.effect==="path"&&c.path){const p=pathPoint(c.path,u);r={...r,x:p.x,y:p.y}}else if(c.effect==="pulse")r={...r,scale:1+.05*Math.sin(u*Math.PI)};else if(c.effect==="grow-shrink"){const p=1+((c.amount??1.5)-1)*u;r={...r,sx:r.sx*(c.direction==="vertical"?1:p),sy:r.sy*(c.direction==="horizontal"?1:p)}}else if(c.effect==="spin"){const p=(c.amount??360)*u;r={...r,rotate:r.rotate+(c.direction==="counterclockwise"?-p:p)}}else c.effect==="transparency"?r={...r,opacity:r.opacity*(1-(c.amount??.5)*u)}:isExit(c.effect)?r=u>=1?{...y,hidden:!0}:{...r,...z(c,1-(c.effect==="fly-out"?u*u:u),n,o)}:r={...y,...u<1?z(c,c.effect==="fly-in"?N(u):u,n,o):{}}}return r}function R(t,e,n){const o=roundOf(t),f=r=>t.duration>0?Math.min(1,Math.max(0,(r-n)/t.duration)):1,i=typeof t.repeat=="string"?t.stop??1/0:t.to;if(e>=i-k){if(t.rewind)return;const r=typeof t.repeat=="number"?t.repeat%1:0;return r>k?f(o*r):1}return o<=0?1:f((e-t.from)%o)}export function animationTargets(t){const e=new Map;for(const n of t){const o=JSON.stringify([n.shape,n.paragraph??null]),f=e.get(o);f?f.animations.push(n):e.set(o,{shape:n.shape,...n.paragraph===void 0?{}:{paragraph:n.paragraph},animations:[n]})}return[...e.values()]}
@@ -1,10 +1,14 @@
1
- import type { ArrowSize, Numbering, AnimationEffect, AnimationFile, LineDash, TransitionFile, LineEnd, ShapeGeometry, TextAlign, ThemeColor } from "@allyhub/formats";
1
+ import type { ArrowSize, Numbering, AnimationEffect, AnimationFile, LineCap, LineCompound, LineDash, LineJoin, GradientPath, PatternPreset, TransitionFile, LineEnd, ShapeGeometry, TextAlign, TextOrientation, ThemeColor, ColorName, ColorTransform } from "@allyhub/formats";
2
2
  import type { Anchor, AutoSize, FillType, PlaceholderType, ShapeType } from "./enums.js";
3
- import type { Color, ComponentContext, DeckDef, FontDef, Frame, GradientDef, FreeformPath, GeneratedSlideDef, GeneratorContext, LayoutDef, MasterDef, ParagraphDef, TableCellDef, TableDef, ParagraphFormatDef, PropSpec, RunDef, ShapeDef, TextFrameDef } from "./model.js";
4
- import type { SheetChartType } from "@allyhub/formats";
3
+ import type { Color, ComponentContext, DeckDef, FontDef, Frame, GradientDef, TileDef, FreeformPath, GeneratedSlideDef, GeneratorContext, LayoutDef, MasterDef, ParagraphDef, TableCellDef, TableDef, ParagraphFormatDef, PropSpec, RunDef, ShapeDef, PlaybackDef, TextFrameDef } from "./model.js";
4
+ import type { Caps, SheetChartType, Strike, Underline } from "@allyhub/formats";
5
5
  import { Chart, type CategoryChartData, type XyChartData } from "./chart-api.js";
6
6
  import type { ThemeInput } from "./theme.js";
7
7
  import { type Length, type LengthValue, type SlideSizeName } from "./units.js";
8
+ /** Throws what the API does not do, naming it. */
9
+ export declare const refuse: (what: string) => never;
10
+ /** Office's colour map: each name its own theme colour, text and background 1 and 2 dark and light 1 and 2. */
11
+ export declare const OFFICE_COLOR_MAP: Readonly<Record<ColorName, ThemeColor>>;
8
12
  /** python-pptx's `RGBColor`: called or made with `new`, a colour as `#RRGGBB`. */
9
13
  export interface RGBColorMaker {
10
14
  (r: number, g: number, b: number): string;
@@ -22,9 +26,17 @@ export declare class ColorFormat {
22
26
  private readonly read;
23
27
  private readonly write;
24
28
  constructor(read: () => Color | undefined, write: (c: Color | undefined) => void);
25
- get theme_color(): ThemeColor | undefined;
26
- /** As python-pptx's: a theme colour changed to another keeps its brightness. */
27
- set theme_color(c: ThemeColor | undefined);
29
+ /** A theme colour (MSO_THEME_COLOR): one of its twelve, or text and background 1 and 2 (`tx1`), which the master's colour map makes one of them. */
30
+ get theme_color(): ColorName | undefined;
31
+ /** As python-pptx's: a theme colour changed to another keeps its brightness (and its transforms). */
32
+ set theme_color(c: ColorName | undefined);
33
+ /**
34
+ * DrawingML's transforms of the colour, in order (`{ name: "lumMod",
35
+ * value: 0.75 }`, a share; degrees for hue and hueOff), which python-pptx
36
+ * has no name for; set, they take a brightness's place.
37
+ */
38
+ get transforms(): readonly ColorTransform[];
39
+ set transforms(v: readonly ColorTransform[]);
28
40
  /**
29
41
  * Lighter (up to 1, white) or darker (down to -1, black), 0 for neither:
30
42
  * PowerPoint's "Lighter 40%" is 0.4, "Darker 25%" -0.25 (`a:lumMod` and
@@ -41,9 +53,12 @@ export declare class Font {
41
53
  private readonly def;
42
54
  constructor(def: FontDef);
43
55
  private _set;
44
- /** A line through it (PowerPoint's Strikethrough). */
45
- get strike(): boolean | undefined;
46
- set strike(v: boolean | undefined);
56
+ /** A line through it, PowerPoint's Strikethrough: true, or MSO_TEXT_STRIKE.DOUBLE for Double Strikethrough. */
57
+ get strike(): boolean | Strike | undefined;
58
+ set strike(v: boolean | Strike | "noStrike" | undefined);
59
+ /** Its letters as capitals (MSO_TEXT_CAPS): PowerPoint's All Caps and Small Caps. */
60
+ get caps(): Caps | undefined;
61
+ set caps(v: Caps | undefined);
47
62
  /** Raised or lowered, a share of its size: superscript 0.3, subscript -0.25. */
48
63
  get baseline(): number | undefined;
49
64
  set baseline(v: number | undefined);
@@ -58,9 +73,9 @@ export declare class Font {
58
73
  set bold(v: boolean | undefined);
59
74
  get italic(): boolean | undefined;
60
75
  set italic(v: boolean | undefined);
61
- /** A single underline or none (python-pptx also takes MSO_UNDERLINE's kinds). */
62
- get underline(): boolean | undefined;
63
- set underline(v: boolean | undefined);
76
+ /** python-pptx's: true a single underline, false none, or an MSO_UNDERLINE style (DOUBLE_LINE, WAVY_LINE…). */
77
+ get underline(): boolean | Underline | undefined;
78
+ set underline(v: boolean | Underline | "none" | undefined);
64
79
  /** Space added between letters, a Length (negative tightens): PowerPoint's Character Spacing, which python-pptx has no name for. */
65
80
  get spacing(): LengthValue | undefined;
66
81
  set spacing(v: Length | undefined);
@@ -91,10 +106,11 @@ declare abstract class Format {
91
106
  /** A number of lines (1.5), or a Length (Pt(18)) for a fixed height. */
92
107
  get line_spacing(): number | LengthValue | undefined;
93
108
  set line_spacing(v: number | undefined);
94
- get space_before(): LengthValue | undefined;
95
- set space_before(v: Length | undefined);
96
- get space_after(): LengthValue | undefined;
97
- set space_after(v: Length | undefined);
109
+ /** A Length (Pt(6)), or a number of lines at the paragraph's size (0.5), PowerPoint's Before in lines. */
110
+ get space_before(): number | LengthValue | undefined;
111
+ set space_before(v: number | undefined);
112
+ get space_after(): number | LengthValue | undefined;
113
+ set space_after(v: number | undefined);
98
114
  /** Its runs' default character properties (`a:defRPr`). */
99
115
  get font(): Font;
100
116
  }
@@ -122,7 +138,7 @@ export declare class Paragraph extends Format {
122
138
  export declare class ListLevel extends Format {
123
139
  protected readonly fmt: ParagraphFormatDef;
124
140
  constructor(def: ParagraphFormatDef);
125
- /** Counted in place of a bullet (`a:buAutoNum`): "arabicPeriod", "alphaLcPeriod"… */
141
+ /** Counted in place of a bullet (`a:buAutoNum`): any of ECMA-376's 41 schemes, "arabicPeriod", "alphaLcParenR", "circleNumDbPlain", "ea1ChsPeriod"… */
126
142
  get numbered(): Numbering | undefined;
127
143
  set numbered(v: Numbering | undefined);
128
144
  /** Its bullet character, or null for none (`a:buChar`, `a:buNone`). */
@@ -130,6 +146,15 @@ export declare class ListLevel extends Format {
130
146
  set bullet(v: string | null | undefined);
131
147
  get bullet_font(): string | undefined;
132
148
  set bullet_font(v: string | undefined);
149
+ /** Its bullet's or number's colour (`a:buClr`): a colour as the slides file writes one (accent1, #RRGGBB) or a Color; null for its text's (`a:buClrTx`). */
150
+ get bullet_color(): Color | null | undefined;
151
+ set bullet_color(v: Exclude<Color, string> | string | null | undefined);
152
+ /** Its bullet's or number's size, a share of its text's, 0.25 to 4 (`a:buSzPct`); null for its text's. */
153
+ get bullet_size(): number | null | undefined;
154
+ set bullet_size(v: number | null | undefined);
155
+ /** The number its list starts at (`a:buAutoNum@startAt`), 1 to 32767. */
156
+ get start_at(): number | undefined;
157
+ set start_at(v: number | undefined);
133
158
  /** Where its lines start (`@marL`). */
134
159
  get margin_left(): LengthValue | undefined;
135
160
  set margin_left(v: Length | undefined);
@@ -149,6 +174,11 @@ export type ListStyle = readonly [
149
174
  ListLevel,
150
175
  ListLevel
151
176
  ];
177
+ /** What placeholders.add takes besides a frame: a name of its own; `orient: "vert"`, a vertical placeholder (`p:ph/@orient`, which PowerPoint matches layouts by; its text_frame.orientation turns its text). */
178
+ export interface PlaceholderOptions {
179
+ name?: string;
180
+ orient?: "vert";
181
+ }
152
182
  /** python-pptx's `TextFrame`. */
153
183
  export declare class TextFrame {
154
184
  private readonly def;
@@ -172,6 +202,9 @@ export declare class TextFrame {
172
202
  get list_style(): ListStyle;
173
203
  get vertical_anchor(): Anchor | undefined;
174
204
  set vertical_anchor(v: Anchor | undefined);
205
+ /** Which way its text runs (MSO_TEXT_ORIENTATION, `a:bodyPr/@vert`): PowerPoint's Text Direction, which python-pptx has no name for. */
206
+ get orientation(): TextOrientation | undefined;
207
+ set orientation(v: TextOrientation | undefined);
175
208
  get auto_size(): AutoSize | undefined;
176
209
  set auto_size(v: AutoSize | undefined);
177
210
  get word_wrap(): boolean | undefined;
@@ -190,16 +223,54 @@ export declare class FillFormat {
190
223
  private readonly read;
191
224
  private readonly write;
192
225
  private readonly start;
193
- /** The shape it fills: only a shape's has a gradient and a transparency. */
226
+ /** The shape it fills: only a shape's has a gradient, a pattern, a picture and a transparency. */
194
227
  private readonly shape;
195
- constructor(read: () => Color | null | undefined, write: (v: Color | null) => void, start?: Color, shape?: ShapeDef);
228
+ /** The folder of the module that writes the deck: a picture's path is from it. */
229
+ private readonly base;
230
+ constructor(read: () => Color | null | undefined, write: (v: Color | null) => void, start?: Color, shape?: ShapeDef, base?: string);
231
+ /** Its other kinds of fill taken away, as setting one kind does. */
232
+ private _only;
196
233
  /** A solid fill; its colour is fore_color. */
197
234
  solid(): void;
198
235
  /** No fill (python-pptx's `background()`: transparent). */
199
236
  background(): void;
237
+ /** A pattern fill (python-pptx's `patterned()`), PATTERN_DEFAULTS' colours until fore_color and back_color say otherwise. */
238
+ patterned(): void;
239
+ /** A pattern fill's preset (MSO_PATTERN_TYPE). */
240
+ get pattern(): PatternPreset;
241
+ set pattern(v: PatternPreset);
242
+ private _pattern;
243
+ /** A pattern fill's background colour (python-pptx's back_color). */
244
+ get back_color(): ColorFormat;
245
+ /**
246
+ * A picture filling the shape, PowerPoint's Picture or Texture Fill: a
247
+ * path from the deck's module's folder, stretched over the shape, or
248
+ * tiled (`{ tile: { scale_x, scale_y, offset_x, offset_y, align } }`, the
249
+ * offsets Lengths, the scales shares of its own size).
250
+ */
251
+ picture(image_file: string, options?: {
252
+ tile?: Partial<TileDef>;
253
+ transparency?: number;
254
+ }): void;
200
255
  private _shape;
201
256
  /** A gradient fill, of two of the theme's colours until gradient_stops says otherwise. */
202
257
  gradient(): void;
258
+ /** A gradient's kind: "linear" along its angle, or out from its focus, "circle", "rect" or "shape" (PowerPoint's Radial, Rectangular and Path); python-pptx has none. */
259
+ get gradient_path(): "linear" | GradientPath;
260
+ set gradient_path(v: "linear" | GradientPath);
261
+ /** A path gradient's focus, the share in from each side ({ left, top, right, bottom }; the middle, 0.5 each, unless set): PowerPoint's Direction. */
262
+ get gradient_focus(): {
263
+ left: number;
264
+ top: number;
265
+ right: number;
266
+ bottom: number;
267
+ };
268
+ set gradient_focus(v: {
269
+ left: number;
270
+ top: number;
271
+ right: number;
272
+ bottom: number;
273
+ });
203
274
  /** A gradient's degrees, clockwise from left to right. python-pptx's run the other way. */
204
275
  get gradient_angle(): number;
205
276
  set gradient_angle(v: number);
@@ -220,9 +291,9 @@ export declare class FillFormat {
220
291
  /** How much of the fill shows through, a share (PowerPoint's Transparency). */
221
292
  get transparency(): number;
222
293
  set transparency(v: number);
223
- /** MSO_FILL.SOLID, MSO_FILL.BACKGROUND, MSO_FILL.GRADIENT, or undefined while it is inherited. */
294
+ /** MSO_FILL.SOLID, BACKGROUND, GRADIENT, PATTERNED or PICTURE, or undefined while it is inherited. */
224
295
  get type(): FillType | undefined;
225
- /** A solid fill's colour; python-pptx refuses it for another fill: call solid() first. */
296
+ /** A solid fill's colour, or a pattern's foreground; python-pptx refuses it for another fill: call solid() first. */
226
297
  get fore_color(): ColorFormat;
227
298
  }
228
299
  /** python-pptx's `_GradientStop`: one of a gradient's stops. */
@@ -246,8 +317,13 @@ export declare class GradientStop {
246
317
  */
247
318
  export declare class ShadowFormat {
248
319
  private readonly def;
249
- constructor(def: ShapeDef);
320
+ /** A shadow inside the shape (`shape.inner_shadow`), not outside. */
321
+ private readonly inner;
322
+ constructor(def: ShapeDef, inner?: boolean);
250
323
  private _shadow;
324
+ /** Whether it is drawn (Office's ShadowFormat.Visible): set, it has the defaults' shadow until changed; cleared, none. */
325
+ get visible(): boolean;
326
+ set visible(v: boolean);
251
327
  /** Whether it takes its style's effects; false gives it none of its own (no shadow), as python-pptx's empty effect list does. */
252
328
  get inherit(): boolean;
253
329
  set inherit(v: boolean);
@@ -261,6 +337,48 @@ export declare class ShadowFormat {
261
337
  set transparency(v: number);
262
338
  get color(): ColorFormat;
263
339
  }
340
+ /** A shape's glow (`shape.glow`, Office's GlowFormat): its colour, its radius, how much of it shows through; python-pptx has none. */
341
+ export declare class GlowFormat {
342
+ private readonly def;
343
+ constructor(def: ShapeDef);
344
+ private _glow;
345
+ /** Whether it glows: set, GLOW_DEFAULTS' glow until changed. */
346
+ get visible(): boolean;
347
+ set visible(v: boolean);
348
+ /** How far it reaches, a Length (`a:glow@rad`); 0 takes it away. */
349
+ get radius(): LengthValue;
350
+ set radius(v: Length);
351
+ get transparency(): number;
352
+ set transparency(v: number);
353
+ get color(): ColorFormat;
354
+ }
355
+ /** A shape's soft edges (`shape.soft_edge`, Office's SoftEdgeFormat): how far in its edges fade; python-pptx has none. */
356
+ export declare class SoftEdgeFormat {
357
+ private readonly def;
358
+ constructor(def: ShapeDef);
359
+ /** A Length (`a:softEdge@rad`); 0 takes them away. */
360
+ get radius(): LengthValue;
361
+ set radius(v: Length);
362
+ }
363
+ /** A shape's reflection (`shape.reflection`, Office's ReflectionFormat): how much shows through where it starts, how much of the shape it shows, how far below and how blurred; python-pptx has none. */
364
+ export declare class ReflectionFormat {
365
+ private readonly def;
366
+ constructor(def: ShapeDef);
367
+ private _reflection;
368
+ /** Whether it has one: set, REFLECTION_DEFAULTS' until changed. */
369
+ get visible(): boolean;
370
+ set visible(v: boolean);
371
+ get transparency(): number;
372
+ set transparency(v: number);
373
+ /** The share of the shape it shows, 0 to 1. */
374
+ get size(): number;
375
+ set size(v: number);
376
+ /** How far below the shape, a Length (Office's Offset). */
377
+ get offset(): LengthValue;
378
+ set offset(v: Length);
379
+ get blur(): LengthValue;
380
+ set blur(v: Length);
381
+ }
264
382
  /** python-pptx's `LineFormat`: a shape's outline. */
265
383
  export declare class LineFormat {
266
384
  private readonly def;
@@ -273,6 +391,15 @@ export declare class LineFormat {
273
391
  /** Its dashes (MSO_LINE), or null for its theme's. */
274
392
  get dash_style(): LineDash | null;
275
393
  set dash_style(v: LineDash | null);
394
+ /** How its ends and dashes end (MSO_LINE_CAP): flat unless set. */
395
+ get cap_type(): LineCap;
396
+ set cap_type(v: LineCap);
397
+ /** How its corners meet (MSO_LINE_JOIN): a miter unless set. */
398
+ get join_type(): LineJoin;
399
+ set join_type(v: LineJoin);
400
+ /** One line, two or three (MSO_LINE_COMPOUND): one unless set. */
401
+ get compound_type(): LineCompound;
402
+ set compound_type(v: LineCompound);
276
403
  /** What the end of the line where it starts has (MSO_ARROWHEAD). */
277
404
  get begin_arrow(): LineEnd;
278
405
  set begin_arrow(v: LineEnd);
@@ -317,7 +444,9 @@ export declare class Shape {
317
444
  private readonly def;
318
445
  /** The frame it takes while it has none of its own: its master's or its layout's placeholder's. */
319
446
  private readonly inherit;
320
- constructor(def: ShapeDef, inherit?: () => Frame | undefined);
447
+ /** The folder of the module that writes the deck, a project path: a picture fill's path is from it. */
448
+ private readonly base;
449
+ constructor(def: ShapeDef, inherit?: () => Frame | undefined, base?: string);
321
450
  /** The model it writes (this package's). */
322
451
  get _def(): ShapeDef;
323
452
  private _frame;
@@ -362,6 +491,11 @@ export declare class Shape {
362
491
  get fill(): FillFormat;
363
492
  get line(): LineFormat;
364
493
  get shadow(): ShadowFormat;
494
+ /** A shadow inside it, PowerPoint's Inner shadows (`a:innerShdw`); python-pptx has none. */
495
+ get inner_shadow(): ShadowFormat;
496
+ get glow(): GlowFormat;
497
+ get soft_edge(): SoftEdgeFormat;
498
+ get reflection(): ReflectionFormat;
365
499
  /** Its geometry's adjustments: `adjustments[0] = 0.1` sets a rounded rectangle's corner. */
366
500
  get adjustments(): Adjustments;
367
501
  /** A connector's ends (python-pptx's Connector): refuses another shape. */
@@ -423,6 +557,7 @@ export declare class GroupShape {
423
557
  /** The shapes in it; what is added to them is in it. */
424
558
  get shapes(): ShapeCollection;
425
559
  get shape_type(): ShapeType;
560
+ /** Its own name; a group in a group is named within the outer one. */
426
561
  get name(): string;
427
562
  set name(v: string);
428
563
  get left(): LengthValue;
@@ -498,6 +633,9 @@ export declare class Table {
498
633
  iter_cells(): Iterable<Cell>;
499
634
  get columns(): Column[];
500
635
  get rows(): Row[];
636
+ /** Its style, one of PowerPoint's 74 built-in table styles, by its English name ("Medium Style 2 - Accent 1"); set by its name or its id, null for none. */
637
+ get style(): string | null;
638
+ set style(v: string | null);
501
639
  private flag;
502
640
  get first_row(): boolean;
503
641
  set first_row(v: boolean);
@@ -545,10 +683,15 @@ export declare class ShapeCollection implements Iterable<Shape> {
545
683
  /** A video file; its poster is a moment of it, in seconds. */
546
684
  add_movie(movie_file: string, left: Length, top: Length, width: Length, height: Length, options?: {
547
685
  poster_frame_time?: number;
686
+ playback?: PlaybackDef;
687
+ }): Shape;
688
+ /** A sound (PowerPoint's Insert Audio, which python-pptx has no API for): drawn as its icon in its frame, half an inch unless given. */
689
+ add_audio(audio_file: string, left: Length, top: Length, width?: Length, height?: Length, options?: {
690
+ playback?: PlaybackDef;
548
691
  }): Shape;
549
692
  /** An autoshape, as python-pptx makes one: filled and outlined in accent 1, its text light 1, centred. */
550
693
  add_shape(autoshape_type_id: ShapeGeometry, left: Length, top: Length, width: Length, height: Length): Shape;
551
- /** A table of equal columns and rows (python-pptx's add_table), in `.table`; unlike python-pptx's it has no style, so its look is its cells'. */
694
+ /** A table of equal columns and rows (python-pptx's add_table), in `.table`: python-pptx's and PowerPoint's, Medium Style 2 – Accent 1 with a header row and banded rows. */
552
695
  add_table(rows: number, cols: number, left: Length, top: Length, width: Length, height: Length): Shape;
553
696
  /** A chart (python-pptx's add_chart), in `.chart`; PowerPoint opens it as its own, with its numbers in a workbook. */
554
697
  add_chart(chart_type: SheetChartType, x: Length, y: Length, cx: Length, cy: Length, chart_data: CategoryChartData | XyChartData): Shape;
@@ -590,12 +733,8 @@ export declare class Placeholders implements Iterable<Shape> {
590
733
  * unless given; its idx is PowerPoint's (a title 0, a date, footer and
591
734
  * slide number 10, 11, 12, the rest from 1).
592
735
  */
593
- add(type: PlaceholderType, options?: {
594
- name?: string;
595
- }): Shape;
596
- add(type: PlaceholderType, left: Length, top: Length, width: Length, height: Length, options?: {
597
- name?: string;
598
- }): Shape;
736
+ add(type: PlaceholderType, options?: PlaceholderOptions): Shape;
737
+ add(type: PlaceholderType, left: Length, top: Length, width: Length, height: Length, options?: PlaceholderOptions): Shape;
599
738
  }
600
739
  /** What a master and its layouts share: the deck's folder, its components. */
601
740
  interface Context {
@@ -616,6 +755,9 @@ export declare class SlideLayout {
616
755
  /** Whether its master's shapes are drawn on its slides (PowerPoint's Hide Background Graphics, turned round). */
617
756
  get display_master_shapes(): boolean;
618
757
  set display_master_shapes(v: boolean);
758
+ /** Its own colour map over its master's (`p:clrMapOvr`): { bg1: "dk1", tx1: "lt1", … }, which python-pptx has no name for; none (undefined) is its master's. */
759
+ get color_map(): Readonly<Partial<Record<ColorName, ThemeColor>>> | undefined;
760
+ set color_map(v: Readonly<Partial<Record<ColorName, ThemeColor>>> | undefined);
619
761
  get background(): Background;
620
762
  get placeholders(): Placeholders;
621
763
  get shapes(): ShapeCollection;
@@ -651,6 +793,15 @@ export declare class SlideMaster {
651
793
  constructor(def: MasterDef, ctx: Context, allLayouts: SlideLayout[]);
652
794
  get _def(): MasterDef;
653
795
  get name(): string;
796
+ /**
797
+ * Its colour map (`p:clrMap`), which python-pptx has no name for: what
798
+ * text and background 1 and 2 (`tx1`, `bg1`, `tx2`, `bg2`) and the accents
799
+ * and links are of the theme's colours. Office's is dark text on light
800
+ * ({ bg1: "lt1", tx1: "dk1", bg2: "lt2", tx2: "dk2" }); a dark master's
801
+ * the other way round. Set, what it leaves out is Office's.
802
+ */
803
+ get color_map(): Readonly<Record<ColorName, ThemeColor>>;
804
+ set color_map(v: Readonly<Partial<Record<ColorName, ThemeColor>>>);
654
805
  get background(): Background;
655
806
  get placeholders(): Placeholders;
656
807
  get shapes(): ShapeCollection;