@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,5 +1,5 @@
1
- import type { AnimationFile, LineDash, Numbering, TransitionFile, LineEnd, LineEndSize, ShapeGeometry, TextAlign } from "@allyhub/formats";
2
- import type { ChartDef, Color } from "@allyhub/chart";
1
+ import type { AnimationFile, Caps, Strike, TextOrientation, Underline, LineCap, LineCompound, LineDash, LineJoin, Numbering, GradientPath, PatternPreset, TileAlignment, TransitionFile, PlaybackFile, LineEnd, LineEndSize, ShapeGeometry, TextAlign } from "@allyhub/formats";
2
+ import type { ChartDef, Color, ColorMapDef } from "@allyhub/chart";
3
3
  import type { ComponentFrame, FramedComponent, PropType } from "@allyhub/piece";
4
4
  import type { Anchor, AutoSize, PlaceholderType } from "./enums.js";
5
5
  import type { ThemeInput } from "./theme.js";
@@ -18,12 +18,15 @@ export interface FontDef {
18
18
  size?: Length;
19
19
  bold?: boolean;
20
20
  italic?: boolean;
21
- underline?: boolean;
21
+ /** A line under it (`@u`): true a single one (`sng`), false none, or one of DrawingML's styles (python-pptx's MSO_UNDERLINE). */
22
+ underline?: boolean | Underline;
22
23
  color?: Color;
23
24
  /** Space added between letters (negative tightens), EMU (`a:rPr` spc). */
24
25
  spacing?: Length;
25
- /** A line through it (`@strike`). */
26
- strike?: boolean;
26
+ /** A line through it (`@strike`): true a single one, false none, `dblStrike` two. */
27
+ strike?: boolean | Strike;
28
+ /** Its letters drawn as capitals (`@cap`): all of them, small capitals, or none over a level that has them. */
29
+ caps?: Caps;
27
30
  /** Raised (above 0) or lowered, a share of its size: superscript 0.3, subscript -0.25 (`@baseline`). */
28
31
  baseline?: number;
29
32
  /** The colour behind it, `#RRGGBB` (`a:highlight`). */
@@ -46,18 +49,28 @@ export type LineSpacing = {
46
49
  } | {
47
50
  fixed: Length;
48
51
  };
52
+ /** Space before or after a paragraph (`a:spcBef`, `a:spcAft`): a length (`a:spcPts`), or a number of lines at the paragraph's size (`a:spcPct`), a line being single spacing's. */
53
+ export type ParagraphSpace = Length | {
54
+ lines: number;
55
+ };
49
56
  /** A paragraph's properties (`a:pPr`), and a list style's level (`a:lvlNpPr`). */
50
57
  export interface ParagraphFormatDef {
51
58
  alignment?: TextAlign;
52
59
  line_spacing?: LineSpacing;
53
- space_before?: Length;
54
- space_after?: Length;
60
+ space_before?: ParagraphSpace;
61
+ space_after?: ParagraphSpace;
55
62
  /** Its bullet character (`a:buChar`); null: none (`a:buNone`). */
56
63
  bullet?: string | null;
57
64
  /** The bullet's typeface (`a:buFont`). */
58
65
  bullet_font?: string;
59
66
  /** Counted in place of a bullet (`a:buAutoNum`). */
60
67
  numbered?: Numbering;
68
+ /** The number a list starts at (`a:buAutoNum@startAt`), 1 unless said. */
69
+ start_at?: number;
70
+ /** Its bullet's or number's colour (`a:buClr`); null: its text's (`a:buClrTx`) over a level's own. */
71
+ bullet_color?: Color | null;
72
+ /** Its bullet's or number's size, a share of its text's (`a:buSzPct`); null: its text's (`a:buSzTx`). */
73
+ bullet_size?: number | null;
61
74
  /** Where its lines start (`@marL`), and its first line from there (`@indent`, negative for a hanging bullet). */
62
75
  margin_left?: Length;
63
76
  indent?: Length;
@@ -83,8 +96,10 @@ export interface TextFrameDef {
83
96
  margin_top?: Length;
84
97
  margin_right?: Length;
85
98
  margin_bottom?: Length;
99
+ /** Which way its text runs (`a:bodyPr/@vert`): across, turned, East Asian vertical, stacked. */
100
+ orientation?: TextOrientation;
86
101
  }
87
- export type ShapeKind = "placeholder" | "textbox" | "picture" | "movie" | "autoshape" | "table" | "chart" | "component";
102
+ export type ShapeKind = "placeholder" | "textbox" | "picture" | "movie" | "audio" | "autoshape" | "table" | "chart" | "component";
88
103
  /** A table cell's edge (`a:lnL`, `a:lnR`, `a:lnT`, `a:lnB`). */
89
104
  export interface CellBorder {
90
105
  color: Color;
@@ -101,14 +116,16 @@ export interface TableCellDef {
101
116
  /** Another cell's, merged over it (`@hMerge`, `@vMerge`). */
102
117
  spanned?: boolean;
103
118
  }
104
- /** A table (`a:tbl`). What PowerPoint's style would paint is the deck's own: a table here has no style, so its look is its cells'. */
119
+ /** A table (`a:tbl`): its grid, its cells, its style and Table Design's options for it. */
105
120
  export interface TableDef {
106
121
  columns: Length[];
107
122
  rows: {
108
123
  height: Length;
109
124
  cells: TableCellDef[];
110
125
  }[];
111
- /** What its first row and so on are, for those who read it by them (`a:tblPr`); they paint nothing. */
126
+ /** One of PowerPoint's built-in table styles by its id (`a:tableStyleId`, table-style.ts), under its cells' own look; none, the cells' alone. */
127
+ style?: string;
128
+ /** Which of its style's parts it shows (`a:tblPr`): Header Row, First Column, Total Row, Last Column, Banded Rows and Banded Columns. */
112
129
  first_row?: boolean;
113
130
  first_col?: boolean;
114
131
  last_row?: boolean;
@@ -146,12 +163,42 @@ export interface FreeformPath {
146
163
  export interface GradientDef {
147
164
  /** Degrees clockwise from left to right. */
148
165
  angle: number;
166
+ /** Out from its focus in circles, rectangles or the shape's outline (`a:path`), not along a line; its first stop at the focus. */
167
+ path?: GradientPath;
168
+ /** Its focus (`a:fillToRect`): the share in from each side; the middle where it says nothing. */
169
+ focus?: {
170
+ left: number;
171
+ top: number;
172
+ right: number;
173
+ bottom: number;
174
+ };
149
175
  stops: {
150
176
  at: number;
151
177
  color: Color;
152
178
  transparency?: number;
153
179
  }[];
154
180
  }
181
+ /** A pattern filling a shape (`a:pattFill`): its preset in its foreground over its background. */
182
+ export interface PatternDef {
183
+ preset: PatternPreset;
184
+ fg: Color;
185
+ bg: Color;
186
+ }
187
+ /** A picture tiled in a shape (`a:tile`): a share of its own size each way, where the first tile stands, and how far it is moved from there. */
188
+ export interface TileDef {
189
+ scale_x: number;
190
+ scale_y: number;
191
+ offset_x: Length;
192
+ offset_y: Length;
193
+ align: TileAlignment;
194
+ }
195
+ /** A picture filling a shape (`a:blipFill`): a path and the folder of the module or file that named it (a project path), stretched over the shape or tiled, and how much of it shows through. */
196
+ export interface PictureFillDef {
197
+ path: string;
198
+ base: string;
199
+ tile?: TileDef;
200
+ transparency?: number;
201
+ }
155
202
  /** A shadow outside a shape (`a:outerShdw`). */
156
203
  export interface ShadowDef {
157
204
  color: Color;
@@ -161,6 +208,19 @@ export interface ShadowDef {
161
208
  angle: number;
162
209
  transparency: number;
163
210
  }
211
+ /** A glow round a shape (`a:glow`): its colour, its size, how much of it shows through. */
212
+ export interface GlowDef {
213
+ color: Color;
214
+ size: Length;
215
+ transparency: number;
216
+ }
217
+ /** A reflection under a shape (`a:reflection`): how much shows through where it starts (`stA`), the share of the shape it shows (`endPos`), how far below (`dist`) and how blurred (`blurRad`). */
218
+ export interface ReflectionDef {
219
+ transparency: number;
220
+ size: number;
221
+ distance: Length;
222
+ blur: Length;
223
+ }
164
224
  /**
165
225
  * A connector's end glued to a shape (`a:stCxn`, `a:endCxn`): the shape by
166
226
  * its name among its part's shapes, and the connection site of its
@@ -189,9 +249,11 @@ export interface ShapeDef {
189
249
  };
190
250
  /** Degrees clockwise about its centre, 0 up to 360 (`a:xfrm` rot). */
191
251
  rotation?: number;
252
+ /** A placeholder: its type, its idx, and whether it is a vertical one (`p:ph/@orient`, which PowerPoint matches layouts by). */
192
253
  placeholder?: {
193
254
  type: PlaceholderType;
194
255
  idx: number;
256
+ orient?: "vert";
195
257
  };
196
258
  text?: TextFrameDef;
197
259
  fill?: Color | null;
@@ -199,11 +261,27 @@ export interface ShapeDef {
199
261
  fill_transparency?: number;
200
262
  /** A gradient in place of its fill. */
201
263
  gradient?: GradientDef;
264
+ /** A pattern in place of its fill (PowerPoint's Pattern Fill). */
265
+ pattern?: PatternDef;
266
+ /** A picture in place of its fill (PowerPoint's Picture or Texture Fill); over a pattern, a gradient and a colour where it has more than one. */
267
+ picture_fill?: PictureFillDef;
202
268
  /** null: no effects of its own, an empty `a:effectLst` (python-pptx's `shadow.inherit = False`). */
203
269
  shadow?: ShadowDef | null;
270
+ /** A shadow inside it (`a:innerShdw`). */
271
+ inner_shadow?: ShadowDef;
272
+ /** A glow round it (`a:glow`). */
273
+ glow?: GlowDef;
274
+ /** Its edges faded over so far in (`a:softEdge`). */
275
+ soft_edges?: Length;
276
+ /** A reflection under it (`a:reflection`). */
277
+ reflection?: ReflectionDef;
204
278
  line?: Color | null;
205
279
  line_width?: Length;
206
280
  line_dash?: LineDash;
281
+ /** How its ends and dashes end (`@cap`, flat unless said), its corners meet (`a:round`…, a miter unless said), and whether it is two or three lines (`@cmpd`, one unless said). */
282
+ line_cap?: LineCap;
283
+ line_join?: LineJoin;
284
+ line_compound?: LineCompound;
207
285
  /** What the end of its line where it starts has (`a:headEnd`), and where it ends (`a:tailEnd`). */
208
286
  line_begin?: LineEnd;
209
287
  line_end?: LineEnd;
@@ -217,6 +295,8 @@ export interface ShapeDef {
217
295
  table?: TableDef;
218
296
  /** A chart (`p:graphicFrame`). */
219
297
  chart?: ChartDef;
298
+ /** Where a click on it goes in a show (`p:cNvPr/a:hlinkClick`): an address, `#<slide id>`, or a show jump. */
299
+ link?: string;
220
300
  /** The group it is in (`p:grpSp`), by a name the group's shapes share; a group is a file's, and drawn as its shapes. */
221
301
  group?: string;
222
302
  /** Its geometry's adjustments (`a:avLst`), as python-pptx's: a rounded rectangle's corner, a share of its shorter side. */
@@ -226,6 +306,8 @@ export interface ShapeDef {
226
306
  path: string;
227
307
  base: string;
228
308
  poster?: number;
309
+ /** How it plays (PowerPoint's Playback). */
310
+ playback?: PlaybackDef;
229
311
  };
230
312
  /** A component: its name, its props, and how long it moves (seconds; SLIDE_SECONDS when absent). */
231
313
  component?: {
@@ -234,10 +316,14 @@ export interface ShapeDef {
234
316
  dur?: number;
235
317
  };
236
318
  }
319
+ /** How a movie or a sound plays, PowerPoint's Playback: when it starts, its trim in seconds, whether it loops, its volume (a share; PowerPoint's 0.8 unless said), full screen, hidden while not playing. */
320
+ export type PlaybackDef = PlaybackFile;
237
321
  export interface LayoutDef {
238
322
  name: string;
239
323
  master: string;
240
324
  background?: Color | undefined;
325
+ /** Its own colour map over its master's (`p:clrMapOvr`): what text and background 1 and 2 are on its slides. */
326
+ color_map?: ColorMapDef;
241
327
  /** False: its master's shapes are not drawn on its slides (`@showMasterSp`, PowerPoint's Hide Background Graphics). */
242
328
  display_master_shapes?: boolean;
243
329
  /** Its placeholders and its own shapes, back to front. */
@@ -252,6 +338,8 @@ export interface TextStylesDef {
252
338
  export interface MasterDef {
253
339
  name: string;
254
340
  background: Color;
341
+ /** Its colour map (`p:clrMap`): what text and background 1 and 2 (`tx1`, `bg1`…) are of the theme's colours; Office's (dark text on light) where it says nothing. */
342
+ color_map?: ColorMapDef;
255
343
  text_styles: TextStylesDef;
256
344
  /** Its placeholders (the default frame and style of each type) and the shapes every slide shows, back to front. */
257
345
  shapes: ShapeDef[];
@@ -0,0 +1,6 @@
1
+ import type { Numbering } from "@allyhub/formats";
2
+ /** The schemes drawn as `arabicPeriod`'s 1., 2., 3.: Thai and Hindi letters, Arabic and Hebrew alphabetic counts. */
3
+ export declare const NUMBERINGS_DRAWN_AS_ARABIC: ReadonlySet<Numbering>;
4
+ /** What a list says at its `n`th item, from 1, by its scheme. */
5
+ export declare function numberText(numbering: Numbering, n: number): string;
6
+ //# sourceMappingURL=numbering.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ export const NUMBERINGS_DRAWN_AS_ARABIC=new Set(["arabic1Minus","arabic2Minus","hebrew2Minus","thaiAlphaPeriod","thaiAlphaParenR","thaiAlphaParenBoth","hindiAlphaPeriod","hindiAlpha1Period"]);const l=r=>String.fromCharCode(97+(r-1)%26).repeat(Math.floor((r-1)/26)+1),p=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function u(r){let e="",i=r;for(const[t,a]of p)for(;i>=t;)e+=a,i-=t;return e}const o=(r,e)=>String(r).replace(/\d/gu,i=>String.fromCodePoint(e+Number(i))),h="〇一二三四五六七八九";function f(r){if(r<1||r>99999)return String(r);const e=["","十","百","千","万"],i=Array.from(String(r),Number);let t="",a=!1;return i.forEach((n,c)=>{const s=i.length-1-c;if(n===0){a=!0;return}a&&(t+="零"),a=!1,n===1&&s===1&&c===0||(t+=h[n]??""),t+=e[s]??""}),t}const P=r=>String(r).replace(/\d/gu,e=>h[Number(e)]??e);function d(r,e){return r<1||r>20?String(r):e?String.fromCodePoint(r<=10?10102+r-1:9451+r-11):String.fromCodePoint(9312+r-1)}export function numberText(r,e){const i=(a,n)=>n==="ParenBoth"?`(${a})`:n==="ParenR"?`${a})`:n==="Plain"?a:`${a}.`,t=/^(alphaLc|alphaUc|romanLc|romanUc|arabic|thaiNum|hindiNum)(ParenBoth|ParenR|Period|Plain)$/u.exec(r);if(t&&!NUMBERINGS_DRAWN_AS_ARABIC.has(r)){const[,a="",n=""]=t,c=a==="alphaLc"?l(e):a==="alphaUc"?l(e).toUpperCase():a==="romanLc"?u(e):a==="romanUc"?u(e).toUpperCase():a==="thaiNum"?o(e,3664):a==="hindiNum"?o(e,2406):String(e);return i(c,n)}switch(r){case"circleNumDbPlain":case"circleNumWdWhitePlain":return d(e,!1);case"circleNumWdBlackPlain":return d(e,!0);case"arabicDbPeriod":return`${o(e,65296)}.`;case"arabicDbPlain":return o(e,65296);case"ea1ChsPeriod":case"ea1ChtPeriod":return`${f(e)}.`;case"ea1JpnChsDbPeriod":case"ea1JpnKorPeriod":return`${P(e)}.`;case"ea1ChsPlain":case"ea1ChtPlain":return f(e);case"ea1JpnKorPlain":return P(e);default:return`${String(e)}.`}}
@@ -3,6 +3,10 @@ import type { Color, FontDef, LevelsDef, ParagraphFormatDef, TextStylesDef } fro
3
3
  import { type Length } from "./units.js";
4
4
  /** A master's text styles, as Office's master has them (`p:txStyles`). */
5
5
  export declare const OFFICE_TEXT_STYLES: TextStylesDef;
6
+ /** A paragraph's line height at line spacing 1, a multiple of its font size: PowerPoint's single spacing. */
7
+ export declare const SINGLE_SPACING = 1.2;
8
+ /** Space before or after a paragraph as a length, at its size: a number of lines is that many single-spaced lines (`a:spcPct`). */
9
+ export declare const spaceLength: (s: ParagraphFormatDef["space_before"], size: Length) => Length;
6
10
  /** What text has when nothing above it says: PowerPoint's own, under any master. */
7
11
  export declare const TEXT_FALLBACK: Required<Pick<ParagraphFormatDef, "alignment" | "line_spacing" | "space_before" | "space_after" | "indent">> & {
8
12
  font: Required<Pick<FontDef, "name" | "size" | "color">>;
@@ -72,6 +76,13 @@ export declare const CONNECTOR_GEOMETRIES: readonly ["line", "straightConnector1
72
76
  /** Whether a geometry is a connector's (CONNECTOR_GEOMETRIES). */
73
77
  export declare const isConnectorGeometry: (geometry: string | undefined) => boolean;
74
78
  /** A shadow where it says nothing, as PowerPoint's Offset preset: lengths in EMU, the colour black. */
79
+ /** How a movie or a sound plays where its playback says nothing, PowerPoint's: as it comes on, at 80 % of its sound; a sound's icon half an inch square. */
80
+ export declare const PLAYBACK_DEFAULTS: {
81
+ readonly start: "auto";
82
+ readonly volume: 0.8;
83
+ /** A sound's icon, EMU (`add_audio`, Insert ▸ Audio). */
84
+ readonly icon: 457200;
85
+ };
75
86
  export declare const SHADOW_DEFAULTS: {
76
87
  readonly color: {
77
88
  readonly rgb: "#000000";
@@ -81,4 +92,46 @@ export declare const SHADOW_DEFAULTS: {
81
92
  readonly angle: 45;
82
93
  readonly transparency: 0.6;
83
94
  };
95
+ /** A line where it says nothing of its caps, its joins and how many lines it is: flat ends, mitred corners (the Office theme's lines'), one line. */
96
+ export declare const LINE_DEFAULTS: {
97
+ readonly cap: "flat";
98
+ readonly join: "miter";
99
+ readonly compound: "sng";
100
+ };
101
+ /** A pattern fill where it says nothing of its colours: the accent over the background, as PowerPoint's Pattern Fill starts. */
102
+ export declare const PATTERN_DEFAULTS: {
103
+ readonly fg: "accent1";
104
+ readonly bg: "bg1";
105
+ };
106
+ /** A tiled picture where it says nothing: its own size, its first tile at the top left, not moved. */
107
+ export declare const TILE_DEFAULTS: {
108
+ readonly scale_x: 1;
109
+ readonly scale_y: 1;
110
+ readonly offset_x: 0;
111
+ readonly offset_y: 0;
112
+ readonly align: "tl";
113
+ };
114
+ /** A shadow inside a shape where it says nothing, as PowerPoint's Inside: Top Left: lengths in EMU, the colour black. */
115
+ export declare const INNER_SHADOW_DEFAULTS: {
116
+ readonly color: {
117
+ readonly rgb: "#000000";
118
+ };
119
+ readonly blur: number;
120
+ readonly distance: number;
121
+ readonly angle: 45;
122
+ readonly transparency: 0.5;
123
+ };
124
+ /** A glow where it says nothing, as PowerPoint's Glow: 5 pt; Accent color 1. */
125
+ export declare const GLOW_DEFAULTS: {
126
+ readonly color: "accent1";
127
+ readonly size: number;
128
+ readonly transparency: 0.6;
129
+ };
130
+ /** A reflection where it says nothing, as PowerPoint's Tight Reflection: Touching. */
131
+ export declare const REFLECTION_DEFAULTS: {
132
+ readonly transparency: 0.5;
133
+ readonly size: 0.35;
134
+ readonly distance: 0;
135
+ readonly blur: number;
136
+ };
84
137
  //# sourceMappingURL=office.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{Emu as o,Inches as r,Pt as e}from"./units.js";const i=9,l=t=>Array.from({length:i},(n,c)=>t(c));export const OFFICE_TEXT_STYLES={title:l(()=>({alignment:"l",line_spacing:{lines:.9},space_before:0,bullet:null,font:{name:"+mj-lt",size:e(44),color:"dk1"}})),body:l(t=>({alignment:"l",line_spacing:{lines:.9},space_before:t===0?e(10):e(5),bullet:"•",bullet_font:"Arial",margin_left:o(228600+t*457200),indent:o(-228600),font:{name:"+mn-lt",size:e([28,24,20][t]??18),color:"dk1"}})),other:l(t=>({alignment:"l",margin_left:o(t*457200),font:{name:"+mn-lt",size:e(18),color:"dk1"}}))},TEXT_FALLBACK={alignment:"l",line_spacing:{lines:1},space_before:0,space_after:0,indent:0,font:{name:"+mn-lt",size:e(18),color:"dk1"}},TEXT_INSETS={left:r(.1),top:r(.05),right:r(.1),bottom:r(.05)},styleKindOf=t=>t===void 0||t==="dt"||t==="ftr"||t==="sldNum"?"other":t==="title"||t==="ctrTitle"?"title":"body";export function placeholderFrame(t){const n=t==="dt"||t==="ftr"||t==="sldNum";return{vertical_anchor:t==="title"||t==="ctrTitle"||n?"ctr":"t",auto_size:n?"none":"text",word_wrap:!0}}export const placeholderLevels=t=>l(t==="subTitle"?n=>({bullet:null,margin_left:r(.5*n),indent:0}):()=>({})),FOOTER_IDX={dt:10,ftr:11,sldNum:12},TEXTBOX_FRAME={word_wrap:!1,auto_size:"shape"},DRAWN_TEXTBOX_FRAME={word_wrap:!0,auto_size:"shape"},AUTOSHAPE_STYLE={fill:"accent1",line:"accent1",line_width:o(6350),font_color:"lt1",vertical_anchor:"ctr",alignment:"ctr"},CONNECTOR_STYLE={line:"accent1",line_width:o(12700)},CONNECTOR_GEOMETRIES=["line","straightConnector1","bentConnector2","bentConnector3","bentConnector4","bentConnector5","curvedConnector2","curvedConnector3","curvedConnector4","curvedConnector5"];const s=new Set(CONNECTOR_GEOMETRIES);export const isConnectorGeometry=t=>t!==void 0&&s.has(t),SHADOW_DEFAULTS={color:{rgb:"#000000"},blur:e(4),distance:e(3),angle:45,transparency:.6};
2
+ import{Emu as o,Inches as r,Pt as e}from"./units.js";const s=9,c=t=>Array.from({length:s},(n,l)=>t(l));export const OFFICE_TEXT_STYLES={title:c(()=>({alignment:"l",line_spacing:{lines:.9},space_before:0,bullet:null,font:{name:"+mj-lt",size:e(44),color:"tx1"}})),body:c(t=>({alignment:"l",line_spacing:{lines:.9},space_before:t===0?e(10):e(5),bullet:"•",bullet_font:"Arial",margin_left:o(228600+t*457200),indent:o(-228600),font:{name:"+mn-lt",size:e([28,24,20][t]??18),color:"tx1"}})),other:c(t=>({alignment:"l",margin_left:o(t*457200),font:{name:"+mn-lt",size:e(18),color:"tx1"}}))},SINGLE_SPACING=1.2,spaceLength=(t,n)=>t===void 0?0:typeof t=="number"?t:t.lines*n*SINGLE_SPACING,TEXT_FALLBACK={alignment:"l",line_spacing:{lines:1},space_before:0,space_after:0,indent:0,font:{name:"+mn-lt",size:e(18),color:"tx1"}},TEXT_INSETS={left:r(.1),top:r(.05),right:r(.1),bottom:r(.05)},styleKindOf=t=>t===void 0||t==="dt"||t==="ftr"||t==="sldNum"?"other":t==="title"||t==="ctrTitle"?"title":"body";export function placeholderFrame(t){const n=t==="dt"||t==="ftr"||t==="sldNum";return{vertical_anchor:t==="title"||t==="ctrTitle"||n?"ctr":"t",auto_size:n?"none":"text",word_wrap:!0}}export const placeholderLevels=t=>c(t==="subTitle"?n=>({bullet:null,margin_left:r(.5*n),indent:0}):()=>({})),FOOTER_IDX={dt:10,ftr:11,sldNum:12},TEXTBOX_FRAME={word_wrap:!1,auto_size:"shape"},DRAWN_TEXTBOX_FRAME={word_wrap:!0,auto_size:"shape"},AUTOSHAPE_STYLE={fill:"accent1",line:"accent1",line_width:o(6350),font_color:"lt1",vertical_anchor:"ctr",alignment:"ctr"},CONNECTOR_STYLE={line:"accent1",line_width:o(12700)},CONNECTOR_GEOMETRIES=["line","straightConnector1","bentConnector2","bentConnector3","bentConnector4","bentConnector5","curvedConnector2","curvedConnector3","curvedConnector4","curvedConnector5"];const a=new Set(CONNECTOR_GEOMETRIES);export const isConnectorGeometry=t=>t!==void 0&&a.has(t),PLAYBACK_DEFAULTS={start:"auto",volume:.8,icon:457200},SHADOW_DEFAULTS={color:{rgb:"#000000"},blur:e(4),distance:e(3),angle:45,transparency:.6},LINE_DEFAULTS={cap:"flat",join:"miter",compound:"sng"},PATTERN_DEFAULTS={fg:"accent1",bg:"bg1"},TILE_DEFAULTS={scale_x:1,scale_y:1,offset_x:0,offset_y:0,align:"tl"},INNER_SHADOW_DEFAULTS={color:{rgb:"#000000"},blur:e(5),distance:e(4),angle:45,transparency:.5},GLOW_DEFAULTS={color:"accent1",size:e(5),transparency:.6},REFLECTION_DEFAULTS={transparency:.5,size:.35,distance:0,blur:e(.5)};
@@ -0,0 +1,8 @@
1
+ import type { PatternPreset } from "@allyhub/formats";
2
+ /** A pattern's cells, a row of 8 on (true) or off for each of its 8 rows. */
3
+ export declare function patternCells(preset: PatternPreset): boolean[][];
4
+ /** A pattern's cells as SVG's path of 1 × 1 squares in an 8 × 8 box, the foreground's. */
5
+ export declare function patternPath(preset: PatternPreset): string;
6
+ /** A pattern's cell, EMU: 8 of them across a tile, a pixel of a screen at 96 to the inch each, as PowerPoint draws one at 100%. */
7
+ export declare const PATTERN_CELL = 9525;
8
+ //# sourceMappingURL=patterns.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ const d=[[0,32,8,40,2,34,10,42],[48,16,56,24,50,18,58,26],[12,44,4,36,14,46,6,38],[60,28,52,20,62,30,54,22],[3,35,11,43,1,33,9,41],[51,19,59,27,49,17,57,25],[15,47,7,39,13,45,5,37],[63,31,55,23,61,29,53,21]],a=(t,r)=>(t%r+r)%r,n=t=>(r,o)=>(d[o]?.[r]??64)<Math.round(t*64),c=(...t)=>(r,o)=>t.some(([e,s])=>e===r&&s===o),p={pct5:n(.05),pct10:n(.1),pct20:n(.2),pct25:n(.25),pct30:n(.3),pct40:n(.4),pct50:n(.5),pct60:n(.6),pct70:n(.7),pct75:n(.75),pct80:n(.8),pct90:n(.9),horz:(t,r)=>r===0,vert:t=>t===0,ltHorz:(t,r)=>r%4===0,ltVert:t=>t%4===0,dkHorz:(t,r)=>r%4<2,dkVert:t=>t%4<2,narHorz:(t,r)=>r%2===0,narVert:t=>t%2===0,dashHorz:(t,r)=>r===0&&t<4||r===4&&t>=4,dashVert:(t,r)=>t===0&&r<4||t===4&&r>=4,cross:(t,r)=>t===0||r===0,dnDiag:(t,r)=>a(t-r,8)===0,upDiag:(t,r)=>a(t+r,8)===7,ltDnDiag:(t,r)=>a(t-r,4)===0,ltUpDiag:(t,r)=>a(t+r,4)===3,dkDnDiag:(t,r)=>a(t-r,4)<2,dkUpDiag:(t,r)=>a(t+r,4)>=2,wdDnDiag:(t,r)=>a(t-r,8)<3,wdUpDiag:(t,r)=>a(t+r,8)>=5,dashDnDiag:(t,r)=>a(t-r,4)===0&&r%4<2,dashUpDiag:(t,r)=>a(t+r,4)===3&&r%4<2,diagCross:(t,r)=>a(t-r,8)===0||a(t+r,8)===7,smCheck:(t,r)=>(Math.floor(t/2)+Math.floor(r/2))%2===0,lgCheck:(t,r)=>(Math.floor(t/4)+Math.floor(r/4))%2===0,smGrid:(t,r)=>t%4===0||r%4===0,lgGrid:(t,r)=>t===0||r===0,dotGrid:(t,r)=>r===0&&t%2===0||t===0&&r%2===0,smConfetti:c([0,0],[4,1],[7,3],[2,4],[5,6],[1,7]),lgConfetti:c([0,0],[1,0],[0,1],[1,1],[4,2],[5,2],[4,3],[5,3],[2,5],[3,5],[7,6],[6,6]),horzBrick:(t,r)=>r===0||r===4||r<4&&t===0||r>4&&t===4,diagBrick:(t,r)=>a(t+r,8)===7||r===7-a(t,4)-4&&t<4,solidDmnd:(t,r)=>Math.abs(t-3.5)+Math.abs(r-3.5)<=3.5,openDmnd:(t,r)=>{const o=Math.abs(t-3.5)+Math.abs(r-3.5);return o>=3&&o<4},dotDmnd:c([0,0],[4,4],[2,6],[6,2]),plaid:(t,r)=>t<2&&r<2||(t<2||r<2)&&(t+r)%2===0,sphere:(t,r)=>{const o=(t-3.5)**2+(r-3.5)**2;return o<=12&&!(t<=2&&r<=2&&o>4)},weave:(t,r)=>r%8<4?a(t+r,4)===0:a(t-r,4)===0,divot:c([1,1],[2,2],[1,3],[5,5],[6,6],[5,7]),shingle:(t,r)=>a(t+r,8)===7||r===3&&t>=4,wave:(t,r)=>r%4===[0,1,1,2,2,1,1,0][t]||r%4===3&&(t===0||t===7),trellis:(t,r)=>r%2===0?t%4<2:a(t-2,4)<2,zigZag:(t,r)=>r%4===Math.abs(t%4-2)||r%4===0&&t%4===2};export function patternCells(t){const r=p[t];return Array.from({length:8},(o,e)=>Array.from({length:8},(s,i)=>r(i,e)))}export function patternPath(t){return patternCells(t).flatMap((r,o)=>r.flatMap((e,s)=>e?[`M${String(s)} ${String(o)}h1v1h-1z`]:[])).join("")}export const PATTERN_CELL=9525;
@@ -1,8 +1,8 @@
1
- import { type ShapeFile, type SlidesFile, type Numbering, type TextAlign } from "@allyhub/formats";
2
- import { type ChartDef } from "@allyhub/chart";
1
+ import { type TextOrientation, type ShapeFile, type SlidesFile, type Numbering, type TextAlign } from "@allyhub/formats";
2
+ import { type ChartDef, type ColorMapDef } from "@allyhub/chart";
3
3
  import type { DeckCode } from "./code.js";
4
4
  import type { Anchor, AutoSize, PlaceholderType } from "./enums.js";
5
- import type { Color, FontDef, Frame, LevelsDef, LineSpacing, MasterDef, ParagraphDef, GradientDef, ShadowDef, ShapeDef, Glue, ShapeKind, TableCellDef, TableDef, TextFrameDef } from "./model.js";
5
+ import type { PlaybackDef, Color, FontDef, Frame, LevelsDef, LineSpacing, MasterDef, ParagraphDef, ParagraphFormatDef, ParagraphSpace, GradientDef, PatternDef, PictureFillDef, GlowDef, ReflectionDef, ShadowDef, ShapeDef, Glue, ShapeKind, TableCellDef, TableDef, TextFrameDef } from "./model.js";
6
6
  import { type ResolvedAnimation, type ResolvedTransition } from "./animation.js";
7
7
  import { type Theme } from "./theme.js";
8
8
  import { type Length } from "./units.js";
@@ -17,20 +17,28 @@ export interface LevelStyle {
17
17
  font: Required<Pick<FontDef, "name" | "size">> & Omit<FontDef, "name" | "size">;
18
18
  alignment: TextAlign;
19
19
  line_spacing: LineSpacing;
20
- space_before: Length;
21
- space_after: Length;
20
+ space_before: ParagraphSpace;
21
+ space_after: ParagraphSpace;
22
22
  bullet?: {
23
23
  char: string;
24
24
  font?: string;
25
25
  };
26
26
  /** Counted in place of a bullet. */
27
27
  numbered?: Numbering;
28
+ /** The number a list starts at. */
29
+ start_at?: number;
30
+ /** Its bullet's or number's colour; its text's where unsaid. */
31
+ bullet_color?: Color;
32
+ /** Its bullet's or number's size, a share of its text's; its text's where unsaid. */
33
+ bullet_size?: number;
28
34
  margin_left: Length;
29
35
  indent: Length;
30
36
  }
31
37
  /** A text frame's style, every value inherited and resolved. */
32
38
  export interface TextStyle {
33
39
  vertical_anchor: Anchor;
40
+ /** Which way its text runs; across where nothing says. */
41
+ orientation: TextOrientation;
34
42
  auto_size: AutoSize;
35
43
  word_wrap: boolean;
36
44
  margins: {
@@ -73,15 +81,26 @@ export interface ResolvedShape {
73
81
  placeholder?: {
74
82
  type: PlaceholderType;
75
83
  idx: number;
84
+ orient?: "vert";
76
85
  };
77
86
  text?: ResolvedText;
78
87
  fill?: Color | null;
79
88
  fill_transparency?: number;
80
89
  gradient?: GradientDef;
90
+ pattern?: PatternDef;
91
+ /** A picture filling it: its project path, tiled or stretched. */
92
+ picture_fill?: Omit<PictureFillDef, "base">;
81
93
  shadow?: ShadowDef | null;
94
+ inner_shadow?: ShadowDef;
95
+ glow?: GlowDef;
96
+ soft_edges?: Length;
97
+ reflection?: ReflectionDef;
82
98
  line?: Color | null;
83
99
  line_width?: Length;
84
100
  line_dash?: NonNullable<ShapeDef["line_dash"]>;
101
+ line_cap?: NonNullable<ShapeDef["line_cap"]>;
102
+ line_join?: NonNullable<ShapeDef["line_join"]>;
103
+ line_compound?: NonNullable<ShapeDef["line_compound"]>;
85
104
  line_begin?: NonNullable<ShapeDef["line_begin"]>;
86
105
  line_end?: NonNullable<ShapeDef["line_end"]>;
87
106
  line_begin_size?: NonNullable<ShapeDef["line_begin_size"]>;
@@ -89,15 +108,18 @@ export interface ResolvedShape {
89
108
  path?: NonNullable<ShapeDef["path"]>;
90
109
  table?: ResolvedTable;
91
110
  chart?: ChartDef;
111
+ /** Where a click on it goes in a show: an address, `#<slide id>`, or a show jump. */
112
+ link?: string;
92
113
  group?: string;
93
114
  /** PowerPoint's Lock: not moved, sized or turned by hand. */
94
115
  locked?: boolean;
95
116
  geometry?: ShapeDef["geometry"];
96
117
  adjustments?: number[];
97
- /** A picture or a movie: its project path, its poster, its crop. */
118
+ /** A picture or a movie: its project path, its poster, its crop, how it plays. */
98
119
  media?: {
99
120
  path: string;
100
121
  poster?: number;
122
+ playback?: PlaybackDef;
101
123
  crop?: {
102
124
  left: number;
103
125
  top: number;
@@ -130,6 +152,8 @@ export interface ResolvedSlide {
130
152
  hidden: boolean;
131
153
  /** Its background's colour: its own, or its layout's or master's. */
132
154
  background: Color;
155
+ /** The colour map its colours are drawn through: its layout's over its master's, where they have one (Office's where not). */
156
+ color_map?: ColorMapDef;
133
157
  /** Its own background, a gradient or a picture (a project path), over the colour. */
134
158
  background_gradient?: GradientDef;
135
159
  background_picture?: string;
@@ -141,6 +165,8 @@ export interface ResolvedSlide {
141
165
  transition?: ResolvedTransition;
142
166
  /** Seconds after it comes on that a show goes on by itself (`advance_after`). */
143
167
  advance?: number;
168
+ /** The section that starts at it, by its name (`p14:section`). */
169
+ section?: string;
144
170
  notes?: string;
145
171
  /** Its place in the slides file's `slides`, and its block's generator for a generated slide. */
146
172
  file: {
@@ -197,8 +223,12 @@ export interface ResolveInput {
197
223
  export declare function joinPath(base: string, rel: string): string;
198
224
  /** Levels with list styles over them, the last one's values winning. */
199
225
  export declare function levelsOver(base: readonly LevelStyle[], ...over: (LevelsDef | undefined)[]): LevelStyle[];
226
+ /** A bullet's colour and size and a list's start over a level's: null takes the level's own away (its text's). */
227
+ export declare function bulletLookOver<L extends Pick<LevelStyle, "bullet_color" | "bullet_size" | "start_at">>(l: L, v: Pick<ParagraphFormatDef, "bullet_color" | "bullet_size" | "start_at">): L;
200
228
  /** What the text of a shape that is not a placeholder starts from under a master: PowerPoint's own, then the master's other style. */
201
229
  export declare const plainLevels: (master: MasterDef) => LevelStyle[];
230
+ /** Space before or after a paragraph as the slides file says it: points, or a number of lines. */
231
+ export declare const spaceOfFile: (s: NonNullable<NonNullable<ShapeFile["text"]>["space_before"]>) => ParagraphSpace;
202
232
  /** A colour the slides file names (its format has checked it): the theme's, lighter or darker, or `#RRGGBB`. */
203
233
  export declare const colorOfFile: (c: string) => Color;
204
234
  /** Paragraphs from the script's words: a line each; a list's items each a paragraph, a nested list a level deeper; `**bold**`, `*italic*`, `` `code` `` (in the font `code` names) and spans (WORDS_SPAN) as runs. */
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{colorOfFile as ee}from"@allyhub/formats";import{readMarks as _e,markRuns as be}from"@allyhub/piece";import{chartOfFile as ye}from"@allyhub/chart";import{AUTOSHAPE_STYLE as C,SHADOW_DEFAULTS as H,CONNECTOR_STYLE as ne,DRAWN_TEXTBOX_FRAME as te,TEXT_FALLBACK as ie,TEXT_INSETS as W,isConnectorGeometry as $e,placeholderFrame as xe,styleKindOf as we}from"./office.js";import{resolveAnimation as ke,resolveTransition as oe}from"./animation.js";import{glued as ve}from"./connect.js";import{pathSteps as Se}from"./path.js";import{masterPlaceholder as Ae}from"./placeholders.js";import{DECK_FONTS as Oe,OFFICE_THEME as ze,themeOver as Te}from"./theme.js";import{Pt as O}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const u=[];for(const r of[...i.split("/"),...t.split("/")])r===""||r==="."||(r===".."?u.pop():u.push(r));return u.join("/")}const re={left:0,top:0,width:0,height:0},U=()=>Array.from({length:9},()=>({...ie,font:{...ie.font},margin_left:0}));export function levelsOver(i,...t){return i.map((u,r)=>{let o={...u,font:{...u.font}};for(const $ of t){const l=$?.[r];l&&(o={...o,...l.alignment===void 0?{}:{alignment:l.alignment},...l.line_spacing===void 0?{}:{line_spacing:l.line_spacing},...l.space_before===void 0?{}:{space_before:l.space_before},...l.space_after===void 0?{}:{space_after:l.space_after},...l.margin_left===void 0?{}:{margin_left:l.margin_left},...l.indent===void 0?{}:{indent:l.indent},font:{...o.font,...l.font}},l.numbered!==void 0&&(o.numbered=l.numbered,delete o.bullet),l.bullet===null?(delete o.bullet,delete o.numbered):l.bullet!==void 0?(delete o.numbered,o.bullet={char:l.bullet,...l.bullet_font===void 0?{}:{font:l.bullet_font}}):l.bullet_font!==void 0&&o.bullet&&(o.bullet={...o.bullet,font:l.bullet_font}))}return o})}function I(i,...t){const u=t.filter(o=>o!==void 0),r=o=>{for(let $=u.length-1;$>=0;$--){const l=u[$]?.[o];if(l!==void 0)return l}};return{vertical_anchor:r("vertical_anchor")??i.vertical_anchor,auto_size:r("auto_size")??i.auto_size,word_wrap:r("word_wrap")??i.word_wrap,margins:{left:r("margin_left")??W.left,top:r("margin_top")??W.top,right:r("margin_right")??W.right,bottom:r("margin_bottom")??W.bottom}}}const ae={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(U(),i.text_styles.other);function V(i,t){return{...I(ae,t),levels:levelsOver(U(),i.text_styles.other,t.levels)}}function je(i,t,...u){return{...I(xe(t),...u),levels:levelsOver(U(),i.text_styles[we(t)],...u.map(r=>r?.levels))}}const Ee=Array.from({length:9},()=>({font:{color:C.font_color}})),de={vertical_anchor:C.vertical_anchor};function le(i,t){return{...I(ae,t),levels:levelsOver(U(),i.text_styles.other,Ee,t.levels)}}const X=i=>{const t={...i};return delete t.paragraphs,t},G=i=>({paragraphs:[],levels:[],...i}),N=i=>i==="none"?null:colorOfFile(i),Fe=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,Ne=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike)="([^"\n]*)"/gu,K=57344,Me=256,se="",Ce=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=i=>ee(i)??"dk1";function Z(i){const{shadow:t,gradient:u}=i;return{...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...u?{gradient:{angle:u.angle??0,stops:u.stops.map(r=>({at:r.at,color:colorOfFile(r.color),...r.transparency===void 0?{}:{transparency:r.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?H.color:colorOfFile(t.color),blur:t.blur===void 0?H.blur:O(t.blur),distance:t.distance===void 0?H.distance:O(t.distance),angle:t.angle??H.angle,transparency:t.transparency??H.transparency}}:{}}}function fe(i,t,u=[]){return{...i,rows:i.rows.map((r,o)=>({height:r.height,cells:r.cells.map($=>{const l=u[o];return{...$,text:{paragraphs:$.text.paragraphs,style:B({...V(t,$.text),auto_size:"shape"},l),own:X($.text),empty:!1},...l?{fileText:l}:{}}})}))}}function B(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},levels:i.levels.map(u=>{const r={...u.font,...t.size===void 0?{}:{size:O(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(r.color=colorOfFile(t.color));const o={...u,font:r,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:O(t.space_before)},...t.space_after===void 0?{}:{space_after:O(t.space_after)}};return t.numbered!==void 0?(o.numbered=t.numbered,delete o.bullet):t.bullet===!1?(delete o.bullet,delete o.numbered):t.bullet!==void 0&&(o.bullet={char:t.bullet},delete o.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&u.margin_left===0?{...o,margin_left:ue,indent:-ue}:o})}:i}function Pe(i,t){if(!t)return[...i];const u=t.numbered!==void 0||t.bullet!==void 0;return i.map(r=>{const o={...r};return t.align!==void 0&&delete o.alignment,t.line_spacing!==void 0&&delete o.line_spacing,t.space_before!==void 0&&delete o.space_before,t.space_after!==void 0&&delete o.space_after,u&&(delete o.bullet,delete o.bullet_font,delete o.numbered),o})}function Le(i){const t={};for(const[,u,r=""]of i.matchAll(Ne))if(u==="font")t.name=r.trim();else if(u==="link")t.link=r.trim();else if(u==="highlight")t.highlight=r.trim().toUpperCase();else if(u==="bold")t.bold=r.trim()!=="false";else if(u==="italic")t.italic=r.trim()!=="false";else if(u==="strike")t.strike=r.trim()!=="false";else if(u==="underline")t.underline=r.trim()!=="false";else if(u==="size"){const o=Number(r);Number.isFinite(o)&&o>0&&(t.size=O(o))}else if(u==="baseline"){const o=Number(r);Number.isFinite(o)&&(t.baseline=o)}else{const o=ee(r.trim());o!==void 0&&(t.color=o)}return t}const ue=342900;export function paragraphsOfWords(i,t=0,u=Oe.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(r=>{const o=[],$=r.replace(Fe,(j,F,P)=>(o.push(Le(F)),`${String.fromCharCode(K+o.length-1)}${P}${se}`)),l=_e($);let E;const M=be(l.text,l.marks).flatMap(j=>{const F=j.kinds.includes("code"),P={...j.kinds.includes("strong")?{bold:!0}:{},...j.kinds.includes("em")?{italic:!0}:{},...F?{name:u}:{}};return[...j.text.matchAll(Ce)].flatMap(Y=>{const L=Y[0],R=L.charCodeAt(0);if(L===se)return E=void 0,[];if(R>=K&&R<K+Me)return E=o[R-K],[];const D={...E,...P};return[{text:L,...Object.keys(D).length>0?{font:D}:{},...F?{code:!0}:{}}]})});return{runs:M.length>0?M:[{text:""}],level:t}}):i.flatMap(r=>paragraphsOfWords(r,Array.isArray(r)?Math.min(t+1,8):t,u))}const ce=i=>({left:O(i.x),top:O(i.y),width:O(i.w),height:O(i.h)}),Re=new Set(["dt","ftr","sldNum"]),pe=i=>({...i.locked?{locked:!0}:{},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function he(i,t,u){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const r=t.gradient&&Z({gradient:t.gradient}).gradient;r&&(i.background_gradient=r),t.picture!==void 0&&(i.background_picture=joinPath(u,t.picture))}const me=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:u,words:r,prefix:o,base:$}=i,l=[],E=Te(i.theme??ze,t.theme),M=new Map;for(const e of t.masters)for(const n of e.layouts)M.set(n.name,{layout:n,master:e});const j=[],F=(e,n,a)=>({name:e.name,kind:e.kind,frame:{...e.frame??re},...e.flip?{flip:{...e.flip}}:{},...e.connect?{connect:{...e.connect.begin?{begin:{...e.connect.begin}}:{},...e.connect.end?{end:{...e.connect.end}}:{}}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?le(a,e.text):V(a,e.text),own:X(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.shadow===void 0?{}:{shadow:e.shadow},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size},...e.path?{path:e.path}:{},...e.table?{table:fe(e.table,a)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const a=e.placeholder?.type??"body",m=Ae(n,a),_=e.frame??m?.frame??re;return{name:e.name,kind:"placeholder",frame:{..._},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:je(n,a,m?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!m?"layout":"master"},text:{from:"layout"}}}},Y=(e,n,a,m)=>{const _=t.components[e];if(!_){l.push({...a,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in the deck's module (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const b of Object.keys(n??{}))Object.hasOwn(_.props,b)||l.push({...a,message:`Component ${e} has no prop ${b} a person sets (it has ${Object.keys(_.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}},...m===void 0?{}:{dur:m}}},L=(e,n,a,m,_)=>{const b={slide:m,shape:e,path:a};if(!n.frame){l.push({...b,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const w=ce(n.frame),s={frame:{from:"slide",path:`${a}.frame`}},y={name:e,frame:w,level:"slide",...n.fill===void 0?{}:{fill:N(n.fill)},...Z(n),...n.line===void 0?{}:{line:N(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.line_begin_size===void 0?{}:{line_begin_size:n.line_begin_size},...n.line_end_size===void 0?{}:{line_end_size:n.line_end_size},...n.group===void 0?{}:{group:n.group},...pe(n)};if(n.textbox)return{...y,kind:"textbox",text:{paragraphs:paragraphsOfWords(r(`${o}.${m}.${e}`),0,E.fonts.code),style:B(V(_,G(te)),n.text),own:X(G(te)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...s,text:{from:"slide",path:`${a}.text`}}};if(n.picture!==void 0){const f=me(n.crop);return{...y,kind:"picture",media:{path:joinPath($,n.picture),...f?{crop:f}:{}},sources:{...s,media:{from:"slide",path:`${a}.picture`}}}}if(n.movie!==void 0)return{...y,kind:"movie",media:{path:joinPath($,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:{...s,media:{from:"slide",path:`${a}.movie`}}};if(n.chart){const f=r(`${o}.${m}.${e}`),S=ye(n.chart,{title:typeof f=="string"?f:void 0,base:$,rows:g=>i.data?.(g),problem:g=>{l.push({...b,message:`Chart ${e}: ${g}`})}});return S?{...y,kind:"chart",chart:S,sources:s}:void 0}if(n.table){const f=n.table,S=w.width/f.columns.reduce((d,c)=>d+c,0),g=w.height/f.rows.reduce((d,c)=>d+c.height,0),v=r(`${o}.${m}.${e}`),z=Array.isArray(v)?v:[];return z.length>f.rows.length&&l.push({...b,message:`Table ${e} has ${String(f.rows.length)} rows and its words ${String(z.length)}.`}),{...y,kind:"table",table:fe({columns:f.columns.map(d=>Math.round(d*S)),rows:f.rows.map((d,c)=>{const p=z[c],x=Array.isArray(p)?p:p===void 0?[]:[p];return{height:Math.round(d.height*g),cells:f.columns.map((k,A)=>({text:{levels:[],paragraphs:paragraphsOfWords(x[A],0,E.fonts.code)},...d.fill===void 0?{}:{fill:colorOfFile(d.fill)},...d.line===void 0?{}:{borders:{bottom:{color:colorOfFile(d.line),width:O(1)}}}}))}})},_,f.rows.map(d=>d.text)),sources:s}}const h=n.path&&Se(n.path.d);if(n.path&&!h){l.push({...b,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&h){const f=!n.path&&$e(n.geometry);return{...y,kind:"autoshape",...n.path&&h?{path:{w:n.path.w,h:n.path.h,steps:h}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...f?{line:n.line===void 0?ne.line:N(n.line),line_width:n.line_width===void 0?ne.line_width:O(n.line_width)}:{fill:n.fill===void 0?C.fill:N(n.fill),line:n.line===void 0?C.line:N(n.line),line_width:n.line_width===void 0?C.line_width:O(n.line_width)},...n.text&&!f?{fileText:{...n.text}}:{},...f?{}:{text:{paragraphs:paragraphsOfWords(r(`${o}.${m}.${e}`)).map(S=>n.text?.align===void 0?{alignment:C.alignment,...S}:S),style:B(le(_,G(de)),n.text),own:X(G(de)),empty:!1}},sources:{...s,fill:{from:"slide",path:`${a}.fill`}}}}if(n.component!==void 0){const f=Y(n.component,n.props,b,n.dur);return f?{...y,kind:"component",component:f,sources:s}:void 0}},R=(e,n,a)=>{if(n.frame&&(e.frame=ce(n.frame),e.sources.frame={from:"slide",path:`${a}.frame`}),Object.assign(e,pe(n)),n.dur!==void 0&&e.component&&(e.component={...e.component,dur:n.dur}),n.text&&e.text&&(e.text.style=B(e.text.style,n.text),e.text.paragraphs=Pe(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${a}.text`}),n.line!==void 0&&(e.line=N(n.line),e.sources.line={from:"slide",path:`${a}.line`}),n.line_width!==void 0&&(e.line_width=O(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.line_begin_size!==void 0&&(e.line_begin_size=n.line_begin_size),n.line_end_size!==void 0&&(e.line_end_size=n.line_end_size),n.fill!==void 0&&(e.fill=N(n.fill),e.sources.fill={from:"slide",path:`${a}.fill`}),Object.assign(e,Z(n)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const m=me(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath($,n.picture??n.movie??""),...m?{crop:m}:{},...n.poster===void 0?{}:{poster:n.poster}},e.sources.media={from:"slide",path:`${a}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}},D=(e,n,a,m,_)=>{const b=M.get(n);if(!b){l.push({slide:e,path:`slides.${String(a)}.layout`,message:`Slide ${e} is on the layout "${n}", which the deck's module does not have (it has ${[...M.keys()].join(", ")||"none"}).`});return}const{layout:w,master:s}=b,y=[...(w.display_master_shapes===!1?[]:s.shapes).filter(f=>f.kind!=="placeholder").map(f=>F(f,"master",s)),...w.shapes.filter(f=>f.kind!=="placeholder").map(f=>F(f,"layout",s))],h=w.shapes.filter(f=>f.kind==="placeholder").map((f,S)=>({shape:P(f,s),order:S}));return{slide:{id:e,layout:w.name,master:s.name,hidden:m,background:w.background??s.background,shapes:y,animations:[],file:{index:a,..._===void 0?{}:{generate:_}}},placed:h,master:s}},q=(e,n,a)=>{if(!n)return;const m=w=>{const s=n[w];if(s===void 0)return e.connect?.[w];const y=s==="none"?void 0:a(s.shape);return s==="none"||y===void 0?void 0:{shape:y,site:s.site}},_=m("begin"),b=m("end");_||b?e.connect={..._?{begin:_}:{},...b?{end:b}:{}}:delete e.connect},J=(e,n,a,m,_,b,w,s,y,h=()=>{})=>{const f=new Set(a.map(d=>d.shape.name));let S=a.length;for(const[d,c]of Object.entries(m??{})){const p=b(d);if(p===void 0)continue;const x=`${_}.shapes.${d}`,k=c.textbox!==void 0||c.geometry!==void 0||c.path!==void 0||c.table!==void 0||c.chart!==void 0||c.component!==void 0||(c.picture!==void 0||c.movie!==void 0)&&!f.has(p),A=a.find(ge=>ge.shape.name===p);if(A&&!k){R(A.shape,c,x),q(A.shape,c.connect,b),A.shown=!0,c.z!==void 0&&(A.z=c.z);continue}if(A){l.push({slide:e.id,shape:p,path:x,message:`Slide ${e.id} has a ${A.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!k){l.push({slide:e.id,shape:p,path:x,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...f].join(", ")||"none"}).`});continue}const T=L(p,c,x,e.id,n);T&&q(T,c.connect,b),T&&(a.push({shape:T,order:S++,...c.z===void 0?{}:{z:c.z}}),f.add(p))}const g=a.filter(d=>d.shown===!0||!Re.has(d.shape.placeholder?.type??"")||w(d.shape)!==void 0);a.splice(0,a.length,...g),a.sort((d,c)=>(d.z??0)-(c.z??0)||d.order-c.order);const v=new Map(a.flatMap((d,c)=>d.shape.group===void 0?[]:[[d.shape.group,c]])),z=a.flatMap((d,c)=>{const p=d.shape.group;return p===void 0?[d]:v.get(p)===c?a.filter(x=>x.shape.group===p):[]});a.splice(0,a.length,...z);for(const d of a){const c=h(d.shape);c!==void 0&&(d.shape.alt=c);const p=d.shape.text;if(d.shape.kind==="placeholder"&&p){const x=w(d.shape);p.paragraphs=paragraphsOfWords(x,0,E.fonts.code),p.empty=p.paragraphs.length===0||p.paragraphs.every(k=>k.runs.every(A=>A.text===""))}}e.shapes.push(...a.map(d=>d.shape));for(const d of e.shapes){const c=d.connect;if(!c)continue;const p=ve(d,x=>e.shapes.find(k=>k.name===x&&k.level===d.level&&k!==d));d.frame=p.frame,p.flip?d.flip=p.flip:delete d.flip;for(const x of p.lost){const k=c[x];k&&d.level==="slide"&&l.push({slide:e.id,shape:d.name,message:`Connector ${d.name}'s ${x} is glued to site ${String(k.site)} of ${k.shape}, which slide ${e.id} has not: it stays where it is.`})}}s!==void 0&&s.trim()!==""&&(e.notes=s);for(const[d,c]of(y??[]).entries()){const p=b(c.shape);if(p===void 0)continue;const x={slide:e.id,shape:p,path:`${_}.animations.${String(d)}`},k=e.shapes.find(T=>T.name===p&&T.level==="slide");if(!k){l.push({...x,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(T=>T.level==="slide").map(T=>T.name).join(", ")}).`});continue}if(c.paragraph!==void 0&&c.paragraph>=(k.text?.paragraphs.length??0)){l.push({...x,message:`Shape ${p} has no paragraph ${String(c.paragraph)} to animate (it has ${String(k.text?.paragraphs.length??0)}).`});continue}const A=ke({...c,shape:p});A?e.animations.push(A):l.push({...x,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},Q=new Set;return u.slides.forEach((e,n)=>{const a=`slides.${String(n)}`;if(e.layout!==void 0){const s=D(e.id,e.layout,n,e.hidden===!0);if(!s)return;const y=r(`${o}.${e.id}.notes`);e.transition&&(s.slide.transition=oe(e.transition)),e.advance_after!==void 0&&(s.slide.advance=e.advance_after),he(s.slide,e.background,$),J(s.slide,s.master,s.placed,e.shapes,a,h=>h,h=>r(`${o}.${e.id}.${h.name}`),typeof y=="string"?y:void 0,e.animations,h=>{const f=r(`${o}.${e.id}.alt.${h.name}`);return typeof f=="string"?f:void 0}),j.push(s.slide),Q.add(e.id);return}const m=e.generate??"",_=t.generators[m];if(_===void 0){l.push({slide:e.id,path:`${a}.generate`,message:`There is no generator ${m} in the deck's module (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(_)){l.push({slide:e.id,path:`${a}.generate`,message:`Generator ${m} threw: ${_.error}`,..._.stack===void 0?{}:{stack:_.stack}});return}const b=_,w=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const s of b){const y=`${e.id}/${s.id}`,h=D(y,s.layout,n,w.has(s.id),m);if(!h)continue;for(const g of s.shapes){const v=g.placeholder?h.placed.find(z=>z.shape.placeholder?.idx===g.placeholder?.idx):void 0;if(v)g.frame&&(v.shape.frame={...g.frame}),v.shape.sources.frame={from:"code"},v.shown=!0;else{const z=F(g,"layout",h.master);h.placed.push({shape:{...z,level:"slide",sources:{frame:{from:"code"}}},order:h.placed.length})}}const f=`${s.id}/`,S=s.transition??(s===b[0]?e.transition:void 0);he(h.slide,e.background,$),S&&(h.slide.transition=oe(S)),J(h.slide,h.master,h.placed,e.shapes,a,g=>g.startsWith(f)?g.slice(f.length):void 0,g=>{const v=g.placeholder===void 0?void 0:s.text[g.placeholder.idx];return v===void 0?void 0:v.map(z=>z.runs.map(d=>d.text).join(""))},s.notes,[...(s.animations??[]).map(g=>({...g,shape:`${f}${g.shape}`})),...e.animations??[]]);for(const g of h.slide.shapes){const v=g.placeholder===void 0?void 0:s.text[g.placeholder.idx];v&&g.text&&(g.text.paragraphs=v,g.text.empty=!1)}j.push(h.slide),Q.add(y)}for(const s of Object.keys(e.shapes??{})){const[y]=s.split("/");y!==void 0&&!b.some(h=>h.id===y)&&l.push({slide:e.id,path:`${a}.shapes.${s}`,message:`Generator ${m} makes no slide ${y}: ${s} changes nothing.`})}}),j.forEach((e,n)=>{for(const a of e.shapes)a.placeholder?.type==="sldNum"&&a.text&&(a.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],a.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:E,slides:j},problems:l}}
2
+ import{CAPS as ze,colorOfFile as de,groupLevels as Ae,SHOW_JUMPS as Te,showJumpOf as je,slideLinkOf as Ee,UNDERLINES as Fe}from"@allyhub/formats";import{readMarks as Ne,markRuns as Le}from"@allyhub/piece";import{chartOfFile as Me}from"@allyhub/chart";import{AUTOSHAPE_STYLE as R,SHADOW_DEFAULTS as I,PATTERN_DEFAULTS as se,TILE_DEFAULTS as W,INNER_SHADOW_DEFAULTS as H,GLOW_DEFAULTS as q,REFLECTION_DEFAULTS as X,CONNECTOR_STYLE as fe,DRAWN_TEXTBOX_FRAME as ce,TEXT_FALLBACK as ue,TEXT_INSETS as B,isConnectorGeometry as Ce,placeholderFrame as Pe,styleKindOf as Re}from"./office.js";import{resolveAnimation as De,resolveTransition as Ue,unitsAcross as Ie,EFFECT_OPTIONS as We,TRANSITION_OPTIONS as He}from"./animation.js";import{glued as Ge}from"./connect.js";import{pathSteps as Xe}from"./path.js";import{CHART_AXIS_WORDS as Be}from"./script.js";import{cellLook as Ke,tableStyleOf as Q}from"./table-style.js";import{masterPlaceholder as Je}from"./placeholders.js";import{DECK_FONTS as Ye,OFFICE_THEME as Ve,themeOver as Ze}from"./theme.js";import{Pt as S}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const l=[];for(const r of[...i.split("/"),...t.split("/")])r===""||r==="."||(r===".."?l.pop():l.push(r));return l.join("/")}const pe={left:0,top:0,width:0,height:0};function qe(i,t){const l={...i.color_map,...t.color_map};return Object.keys(l).length>0?{color_map:l}:{}}const K=()=>Array.from({length:9},()=>({...ue,font:{...ue.font},margin_left:0}));export function levelsOver(i,...t){return i.map((l,r)=>{let o={...l,font:{...l.font}};for(const y of t){const a=y?.[r];a&&(o={...o,...a.alignment===void 0?{}:{alignment:a.alignment},...a.line_spacing===void 0?{}:{line_spacing:a.line_spacing},...a.space_before===void 0?{}:{space_before:a.space_before},...a.space_after===void 0?{}:{space_after:a.space_after},...a.margin_left===void 0?{}:{margin_left:a.margin_left},...a.indent===void 0?{}:{indent:a.indent},font:{...o.font,...a.font}},a.numbered!==void 0&&(o.numbered=a.numbered,delete o.bullet),a.bullet===null?(delete o.bullet,delete o.numbered):a.bullet!==void 0?(delete o.numbered,o.bullet={char:a.bullet,...a.bullet_font===void 0?{}:{font:a.bullet_font}}):a.bullet_font!==void 0&&o.bullet&&(o.bullet={...o.bullet,font:a.bullet_font}),o=bulletLookOver(o,a))}return o})}export function bulletLookOver(i,t){const l={...i};return t.bullet_color===null?delete l.bullet_color:t.bullet_color!==void 0&&(l.bullet_color=t.bullet_color),t.bullet_size===null?delete l.bullet_size:t.bullet_size!==void 0&&(l.bullet_size=t.bullet_size),t.start_at!==void 0&&(l.start_at=t.start_at),l}function ee(i,...t){const l=t.filter(o=>o!==void 0),r=o=>{for(let y=l.length-1;y>=0;y--){const a=l[y]?.[o];if(a!==void 0)return a}};return{vertical_anchor:r("vertical_anchor")??i.vertical_anchor,orientation:r("orientation")??"horz",auto_size:r("auto_size")??i.auto_size,word_wrap:r("word_wrap")??i.word_wrap,margins:{left:r("margin_left")??B.left,top:r("margin_top")??B.top,right:r("margin_right")??B.right,bottom:r("margin_bottom")??B.bottom}}}const he={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(K(),i.text_styles.other);function ne(i,t){return{...ee(he,t),levels:levelsOver(K(),i.text_styles.other,t.levels)}}function Qe(i,t,...l){return{...ee(Pe(t),...l),levels:levelsOver(K(),i.text_styles[Re(t)],...l.map(r=>r?.levels))}}const en=Array.from({length:9},()=>({font:{color:R.font_color}})),me={vertical_anchor:R.vertical_anchor};function _e(i,t){return{...ee(he,t),levels:levelsOver(K(),i.text_styles.other,en,t.levels)}}const J=i=>{const t={...i};return delete t.paragraphs,t},Y=i=>({paragraphs:[],levels:[],...i}),C=i=>i==="none"?null:colorOfFile(i),nn=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike|spacing|caps)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,tn=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike|spacing|caps)="([^"\n]*)"/gu,V=57344,on=256,ge="",rn=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const spaceOfFile=i=>typeof i=="number"?S(i):{lines:i.lines},colorOfFile=i=>de(i)??"dk1";function te(i){const{shadow:t,gradient:l,inner_shadow:r,glow:o,reflection:y}=i;return{...r?{inner_shadow:{color:r.color===void 0?H.color:colorOfFile(r.color),blur:r.blur===void 0?H.blur:S(r.blur),distance:r.distance===void 0?H.distance:S(r.distance),angle:r.angle??H.angle,transparency:r.transparency??H.transparency}}:{},...o?{glow:{color:o.color===void 0?q.color:colorOfFile(o.color),size:o.size===void 0?q.size:S(o.size),transparency:o.transparency??q.transparency}}:{},...i.soft_edges===void 0?{}:{soft_edges:S(i.soft_edges)},...y?{reflection:{transparency:y.transparency??X.transparency,size:y.size??X.size,distance:y.distance===void 0?X.distance:S(y.distance),blur:y.blur===void 0?X.blur:S(y.blur)}}:{},...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...l?{gradient:{angle:l.angle??0,...l.path===void 0?{}:{path:l.path},...l.focus===void 0?{}:{focus:{left:l.focus.left??.5,top:l.focus.top??.5,right:l.focus.right??.5,bottom:l.focus.bottom??.5}},stops:l.stops.map(a=>({at:a.at,color:colorOfFile(a.color),...a.transparency===void 0?{}:{transparency:a.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?I.color:colorOfFile(t.color),blur:t.blur===void 0?I.blur:S(t.blur),distance:t.distance===void 0?I.distance:S(t.distance),angle:t.angle??I.angle,transparency:t.transparency??I.transparency}}:{}}}const an=i=>({...i.tile?{tile:{...i.tile}}:{},...i.transparency===void 0?{}:{transparency:i.transparency}});function be(i,t){const{pattern:l,picture_fill:r}=i;return{...l?{pattern:{preset:l.preset,fg:colorOfFile(l.fg??se.fg),bg:colorOfFile(l.bg??se.bg)}}:{},...r?{picture_fill:{path:joinPath(t,r.path),...r.tile?{tile:{scale_x:r.tile.scale_x??W.scale_x,scale_y:r.tile.scale_y??W.scale_y,offset_x:r.tile.x===void 0?W.offset_x:S(r.tile.x),offset_y:r.tile.y===void 0?W.offset_y:S(r.tile.y),align:r.tile.align??W.align}}:{},...r.transparency===void 0?{}:{transparency:r.transparency}}}:{}}}function ye(i,t,l=[]){const r=Q(i.style);return{...i,rows:i.rows.map((o,y)=>({height:o.height,cells:o.cells.map((a,E)=>{const N=l[y],v=r?Ke(r,i,y,E,i.rows.length,i.columns.length,y+(a.span_height??1)-1,E+(a.span_width??1)-1):void 0,F=ne(t,a.text),L=v&&(v.bold!==void 0||v.text!==void 0)?{...F,levels:F.levels.map(P=>({...P,font:{...P.font,...v.bold===void 0?{}:{bold:v.bold},...v.text===void 0?{}:{color:v.text}}}))}:F;return{...a,text:{paragraphs:a.text.paragraphs,style:Z({...L,auto_size:"shape"},N),own:J(a.text),empty:!1},...N?{fileText:N}:{}}})}))}}function Z(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},...t.orientation===void 0?{}:{orientation:t.orientation},levels:i.levels.map(l=>{const r={...l.font,...t.size===void 0?{}:{size:S(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.caps===void 0?{}:{caps:t.caps},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(r.color=colorOfFile(t.color));const o={...l,font:r,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:spaceOfFile(t.space_before)},...t.space_after===void 0?{}:{space_after:spaceOfFile(t.space_after)}};return t.bullet_color!==void 0&&(o.bullet_color=colorOfFile(t.bullet_color)),t.bullet_size!==void 0&&(o.bullet_size=t.bullet_size),t.start_at!==void 0&&(o.start_at=t.start_at),t.numbered!==void 0?(o.numbered=t.numbered,delete o.bullet):t.bullet===!1?(delete o.bullet,delete o.numbered):t.bullet!==void 0&&(o.bullet={char:t.bullet},delete o.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&l.margin_left===0?{...o,margin_left:$e,indent:-$e}:o})}:i}function ln(i,t){if(!t)return[...i];const l=t.numbered!==void 0||t.bullet!==void 0;return i.map(r=>{const o={...r};return t.align!==void 0&&delete o.alignment,t.line_spacing!==void 0&&delete o.line_spacing,t.space_before!==void 0&&delete o.space_before,t.space_after!==void 0&&delete o.space_after,t.bullet_color!==void 0&&delete o.bullet_color,t.bullet_size!==void 0&&delete o.bullet_size,t.start_at!==void 0&&delete o.start_at,l&&(delete o.bullet,delete o.bullet_font,delete o.numbered),o})}const dn=i=>Fe.includes(i),sn=i=>ze.includes(i);function fn(i){const t={};for(const[,l,r=""]of i.matchAll(tn))if(l==="font")t.name=r.trim();else if(l==="link")t.link=r.trim();else if(l==="highlight")t.highlight=r.trim().toUpperCase();else if(l==="bold")t.bold=r.trim()!=="false";else if(l==="italic")t.italic=r.trim()!=="false";else if(l==="strike"){const o=r.trim();t.strike=o==="dblStrike"?o:o!=="false"}else if(l==="underline"){const o=r.trim();t.underline=dn(o)&&o!=="sng"?o:o!=="false"}else if(l==="caps"){const o=r.trim();sn(o)&&(t.caps=o)}else if(l==="size"){const o=Number(r);Number.isFinite(o)&&o>0&&(t.size=S(o))}else if(l==="baseline"){const o=Number(r);Number.isFinite(o)&&(t.baseline=o)}else if(l==="spacing"){const o=Number(r);Number.isFinite(o)&&(t.spacing=S(o))}else{const o=de(r.trim());o!==void 0&&(t.color=o)}return t}const $e=342900;export function paragraphsOfWords(i,t=0,l=Ye.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(r=>{const o=[],y=r.replace(nn,(v,F,L)=>(o.push(fn(F)),`${String.fromCharCode(V+o.length-1)}${L}${ge}`)),a=Ne(y);let E;const N=Le(a.text,a.marks).flatMap(v=>{const F=v.kinds.includes("code"),L={...v.kinds.includes("strong")?{bold:!0}:{},...v.kinds.includes("em")?{italic:!0}:{},...F?{name:l}:{}};return[...v.text.matchAll(rn)].flatMap(P=>{const D=P[0],U=D.charCodeAt(0);if(D===ge)return E=void 0,[];if(U>=V&&U<V+on)return E=o[U-V],[];const G={...E,...L};return[{text:D,...Object.keys(G).length>0?{font:G}:{},...F?{code:!0}:{}}]})});return{runs:N.length>0?N:[{text:""}],level:t}}):i.flatMap(r=>paragraphsOfWords(r,Array.isArray(r)?Math.min(t+1,8):t,l))}const ke=i=>({left:S(i.x),top:S(i.y),width:S(i.w),height:S(i.h)}),cn=new Set(["dt","ftr","sldNum"]),we=i=>({...i.locked?{locked:!0}:{},...i.link===void 0?{}:{link:i.link},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function xe(i,t,l){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const r=t.gradient&&te({gradient:t.gradient}).gradient;r&&(i.background_gradient=r),t.picture!==void 0&&(i.background_picture=joinPath(l,t.picture))}const un=i=>{const t=Q(i.style);return{...t?{style:t.id}:{},...i.first_row===void 0?{}:{first_row:i.first_row},...i.last_row===void 0?{}:{last_row:i.last_row},...i.first_col===void 0?{}:{first_col:i.first_col},...i.last_col===void 0?{}:{last_col:i.last_col},...i.horz_banding===void 0?{}:{horz_banding:i.horz_banding},...i.vert_banding===void 0?{}:{vert_banding:i.vert_banding}}},Se=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:l,words:r,prefix:o,base:y}=i,a=[],E=Ze(i.theme??Ve,t.theme),N=new Map;for(const e of t.masters)for(const n of e.layouts)N.set(n.name,{layout:n,master:e});const v=[],F=(e,n,s)=>{const h=He[n.type];return n.direction!==void 0&&!h.directions.includes(n.direction)&&a.push({slide:e,path:`${s}.transition.direction`,message:h.directions.length===0?`A ${n.type} transition has no direction (${n.direction}).`:`A ${n.type} transition goes ${h.directions.join(", ")}, not ${n.direction}.`}),n.through_black===!0&&!h.throughBlack&&a.push({slide:e,path:`${s}.transition.through_black`,message:`A ${n.type} transition does not go through black: only a fade, a cut and a reveal do.`}),Ue(n)},L=(e,n,s)=>({name:e.name,kind:e.kind,frame:{...e.frame??pe},...e.flip?{flip:{...e.flip}}:{},...e.connect?{connect:{...e.connect.begin?{begin:{...e.connect.begin}}:{},...e.connect.end?{end:{...e.connect.end}}:{}}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?_e(s,e.text):ne(s,e.text),own:J(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.pattern?{pattern:e.pattern}:{},...e.picture_fill?{picture_fill:{...an(e.picture_fill),path:joinPath(e.picture_fill.base,e.picture_fill.path)}}:{},...e.shadow===void 0?{}:{shadow:e.shadow},...e.inner_shadow?{inner_shadow:e.inner_shadow}:{},...e.glow?{glow:e.glow}:{},...e.soft_edges===void 0?{}:{soft_edges:e.soft_edges},...e.reflection?{reflection:e.reflection}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_cap===void 0?{}:{line_cap:e.line_cap},...e.line_join===void 0?{}:{line_join:e.line_join},...e.line_compound===void 0?{}:{line_compound:e.line_compound},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.line_begin_size===void 0?{}:{line_begin_size:e.line_begin_size},...e.line_end_size===void 0?{}:{line_end_size:e.line_end_size},...e.path?{path:e.path}:{},...e.table?{table:ye(e.table,s)}:{},...e.chart?{chart:e.chart}:{},...e.link===void 0?{}:{link:e.link},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster},...e.media.playback?{playback:e.media.playback}:{}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const s=e.placeholder?.type??"body",h=Je(n,s),g=e.frame??h?.frame??pe;return{name:e.name,kind:"placeholder",frame:{...g},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:Qe(n,s,h?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!h?"layout":"master"},text:{from:"layout"}}}},D=(e,n,s,h)=>{const g=t.components[e];if(!g){a.push({...s,message:/\.[cm]?[jt]sx?(?:#|$)/u.test(e)?`${e} names no component: its module has no such export, or the export is not made with defineComponent.`:`There is no component ${e} in the deck's module (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const $ of Object.keys(n??{}))Object.hasOwn(g.props,$)||a.push({...s,message:`Component ${e} has no prop ${$} a person sets (it has ${Object.keys(g.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}},...h===void 0?{}:{dur:h}}},U=(e,n,s,h,g)=>{const $={slide:h,shape:e,path:s};if(!n.frame){a.push({...$,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const T=ke(n.frame),u={frame:{from:"slide",path:`${s}.frame`}},x={name:e,frame:T,level:"slide",...n.fill===void 0?{}:{fill:C(n.fill)},...te(n),...be(n,y),...n.line===void 0?{}:{line:C(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_cap===void 0?{}:{line_cap:n.line_cap},...n.line_join===void 0?{}:{line_join:n.line_join},...n.line_compound===void 0?{}:{line_compound:n.line_compound},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.line_begin_size===void 0?{}:{line_begin_size:n.line_begin_size},...n.line_end_size===void 0?{}:{line_end_size:n.line_end_size},...n.group===void 0?{}:{group:n.group},...we(n)};if(n.textbox)return{...x,kind:"textbox",text:{paragraphs:paragraphsOfWords(r(`${o}.${h}.${e}`),0,E.fonts.code),style:Z(ne(g,Y(ce)),n.text),own:J(Y(ce)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...u,text:{from:"slide",path:`${s}.text`}}};if(n.picture!==void 0){const p=Se(n.crop);return{...x,kind:"picture",media:{path:joinPath(y,n.picture),...p?{crop:p}:{}},sources:{...u,media:{from:"slide",path:`${s}.picture`}}}}if(n.movie!==void 0)return{...x,kind:"movie",media:{path:joinPath(y,n.movie),...n.poster===void 0?{}:{poster:n.poster},...n.playback?{playback:n.playback}:{}},sources:{...u,media:{from:"slide",path:`${s}.movie`}}};if(n.audio!==void 0)return{...x,kind:"audio",media:{path:joinPath(y,n.audio),...n.playback?{playback:n.playback}:{}},sources:{...u,media:{from:"slide",path:`${s}.audio`}}};if(n.chart){const p=`${o}.${h}.${e}`,j=c=>typeof c=="string"?c:void 0,w=Object.fromEntries(Be.flatMap(c=>{const d=j(r(`${p}.${c}`));return d===void 0?[]:[[c,d]]})),O=Me(n.chart,{title:j(r(p))??j(r(`${p}.title`)),axisTitles:w,base:y,rows:c=>i.data?.(c),problem:c=>{a.push({...$,message:`Chart ${e}: ${c}`})}});return O?{...x,kind:"chart",chart:O,sources:u}:void 0}if(n.table){const p=n.table;p.style!==void 0&&!Q(p.style)&&a.push({...$,message:`Table ${e}'s style ${p.style} is none of PowerPoint's built-in table styles: name one as its gallery does (Medium Style 2 - Accent 1, Light Style 1, No Style, Table Grid) or by its id.`});const j=T.width/p.columns.reduce((f,m)=>f+m,0),w=T.height/p.rows.reduce((f,m)=>f+m.height,0),O=r(`${o}.${h}.${e}`),c=Array.isArray(O)?O:[],d=new Map;for(const f of p.merged??[]){const m=f.rows??1,_=f.columns??1;for(let k=f.row;k<f.row+m;k++)for(let z=f.column;z<f.column+_;z++)d.set(`${String(k)},${String(z)}`,"under");d.set(`${String(f.row)},${String(f.column)}`,{w:_,h:m})}return c.length>p.rows.length&&a.push({...$,message:`Table ${e} has ${String(p.rows.length)} rows and its words ${String(c.length)}.`}),{...x,kind:"table",table:ye({...un(p),columns:p.columns.map(f=>Math.round(f*j)),rows:p.rows.map((f,m)=>{const _=c[m],k=Array.isArray(_)?_:_===void 0?[]:[_];return{height:Math.round(f.height*w),cells:p.columns.map((z,M)=>{const A=d.get(`${String(m)},${String(M)}`);return{text:{levels:[],paragraphs:A==="under"?[]:paragraphsOfWords(k[M],0,E.fonts.code)},...A==="under"?{spanned:!0}:{},...A!==void 0&&A!=="under"&&A.w>1?{span_width:A.w}:{},...A!==void 0&&A!=="under"&&A.h>1?{span_height:A.h}:{},...f.fill===void 0?{}:{fill:colorOfFile(f.fill)},...f.line===void 0?{}:{borders:{bottom:{color:colorOfFile(f.line),width:S(1)}}}}})}})},g,p.rows.map(f=>f.text)),sources:u}}const b=n.path&&Xe(n.path.d);if(n.path&&!b){a.push({...$,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&b){const p=!n.path&&Ce(n.geometry);return{...x,kind:"autoshape",...n.path&&b?{path:{w:n.path.w,h:n.path.h,steps:b}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...p?{line:n.line===void 0?fe.line:C(n.line),line_width:n.line_width===void 0?fe.line_width:S(n.line_width)}:{fill:n.fill===void 0?R.fill:C(n.fill),line:n.line===void 0?R.line:C(n.line),line_width:n.line_width===void 0?R.line_width:S(n.line_width)},...n.text&&!p?{fileText:{...n.text}}:{},...p?{}:{text:{paragraphs:paragraphsOfWords(r(`${o}.${h}.${e}`)).map(j=>n.text?.align===void 0?{alignment:R.alignment,...j}:j),style:Z(_e(g,Y(me)),n.text),own:J(Y(me)),empty:!1}},sources:{...u,fill:{from:"slide",path:`${s}.fill`}}}}if(n.component!==void 0){const p=D(n.component,n.props,$,n.dur);return p?{...x,kind:"component",component:p,sources:u}:void 0}},G=(e,n,s)=>{if(n.frame&&(e.frame=ke(n.frame),e.sources.frame={from:"slide",path:`${s}.frame`}),Object.assign(e,we(n)),n.dur!==void 0&&e.component&&(e.component={...e.component,dur:n.dur}),n.text&&e.text&&(e.text.style=Z(e.text.style,n.text),e.text.paragraphs=ln(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${s}.text`}),n.line!==void 0&&(e.line=C(n.line),e.sources.line={from:"slide",path:`${s}.line`}),n.line_width!==void 0&&(e.line_width=S(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_cap!==void 0&&(e.line_cap=n.line_cap),n.line_join!==void 0&&(e.line_join=n.line_join),n.line_compound!==void 0&&(e.line_compound=n.line_compound),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.line_begin_size!==void 0&&(e.line_begin_size=n.line_begin_size),n.line_end_size!==void 0&&(e.line_end_size=n.line_end_size),(n.fill!==void 0||n.gradient!==void 0||n.pattern!==void 0||n.picture_fill!==void 0)&&(delete e.gradient,delete e.pattern,delete e.picture_fill),n.fill!==void 0&&(e.fill=C(n.fill),e.sources.fill={from:"slide",path:`${s}.fill`}),Object.assign(e,te(n),be(n,y)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const h=Se(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath(y,n.picture??n.movie??""),...h?{crop:h}:{},...n.poster===void 0?{}:{poster:n.poster},...n.playback&&n.movie!==void 0?{playback:n.playback}:{}},e.sources.media={from:"slide",path:`${s}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}else n.playback&&e.media&&(e.kind==="movie"||e.kind==="audio")&&(e.media={...e.media,playback:{...e.media.playback,...n.playback}})},ie=(e,n,s,h,g)=>{const $=N.get(n);if(!$){a.push({slide:e,path:`slides.${String(s)}.layout`,message:`Slide ${e} is on the layout "${n}", which the deck's module does not have (it has ${[...N.keys()].join(", ")||"none"}).`});return}const{layout:T,master:u}=$,x=[...(T.display_master_shapes===!1?[]:u.shapes).filter(p=>p.kind!=="placeholder").map(p=>L(p,"master",u)),...T.shapes.filter(p=>p.kind!=="placeholder").map(p=>L(p,"layout",u))],b=T.shapes.filter(p=>p.kind==="placeholder").map((p,j)=>({shape:P(p,u),order:j}));return{slide:{id:e,layout:T.name,master:u.name,hidden:h,background:T.background??u.background,...qe(u,T),shapes:x,animations:[],file:{index:s,...g===void 0?{}:{generate:g}}},placed:b,master:u}},oe=(e,n,s)=>{if(!n)return;const h=T=>{const u=n[T];if(u===void 0)return e.connect?.[T];const x=u==="none"?void 0:s(u.shape);return u==="none"||x===void 0?void 0:{shape:x,site:u.site}},g=h("begin"),$=h("end");g||$?e.connect={...g?{begin:g}:{},...$?{end:$}:{}}:delete e.connect},re=(e,n,s,h,g,$,T,u,x,b=()=>{})=>{const p=new Set(s.map(c=>c.shape.name));let j=s.length;for(const[c,d]of Object.entries(h??{})){const f=$(c);if(f===void 0)continue;const m=`${g}.shapes.${c}`,_=d.textbox!==void 0||d.geometry!==void 0||d.path!==void 0||d.table!==void 0||d.chart!==void 0||d.component!==void 0||d.audio!==void 0||(d.picture!==void 0||d.movie!==void 0)&&!p.has(f),k=s.find(M=>M.shape.name===f);if(k&&!_){G(k.shape,d,m),oe(k.shape,d.connect,$),k.shown=!0,d.z!==void 0&&(k.z=d.z);continue}if(k){a.push({slide:e.id,shape:f,path:m,message:`Slide ${e.id} has a ${k.shape.kind} ${f} already: a shape of its own needs another name.`});continue}if(!_){a.push({slide:e.id,shape:f,path:m,message:`Slide ${e.id} has no shape ${f} to change (its layout's placeholders and its own shapes are ${[...p].join(", ")||"none"}).`});continue}const z=U(f,d,m,e.id,n);z&&oe(z,d.connect,$),z&&(s.push({shape:z,order:j++,...d.z===void 0?{}:{z:d.z}}),p.add(f))}const w=s.filter(c=>c.shown===!0||!cn.has(c.shape.placeholder?.type??"")||T(c.shape)!==void 0);s.splice(0,s.length,...w),s.sort((c,d)=>(c.z??0)-(d.z??0)||c.order-d.order);const O=(c,d)=>{const f=_=>{const k=_.shape.group;return k===void 0?void 0:Ae(k)[d]},m=new Map(c.flatMap((_,k)=>{const z=f(_);return z===void 0?[]:[[z,k]]}));return c.flatMap((_,k)=>{const z=f(_);return z===void 0?[_]:m.get(z)===k?O(c.filter(M=>f(M)===z),d+1):[]})};s.splice(0,s.length,...O(s,0));for(const c of s){const d=b(c.shape);d!==void 0&&(c.shape.alt=d);const f=c.shape.text;if(c.shape.kind==="placeholder"&&f){const m=T(c.shape);f.paragraphs=paragraphsOfWords(m,0,E.fonts.code),f.empty=f.paragraphs.length===0||f.paragraphs.every(_=>_.runs.every(k=>k.text===""))}}e.shapes.push(...s.map(c=>c.shape));for(const c of e.shapes){const d=c.connect;if(!d)continue;const f=Ge(c,m=>e.shapes.find(_=>_.name===m&&_.level===c.level&&_!==c));c.frame=f.frame,f.flip?c.flip=f.flip:delete c.flip;for(const m of f.lost){const _=d[m];_&&c.level==="slide"&&a.push({slide:e.id,shape:c.name,message:`Connector ${c.name}'s ${m} is glued to site ${String(_.site)} of ${_.shape}, which slide ${e.id} has not: it stays where it is.`})}}u!==void 0&&u.trim()!==""&&(e.notes=u);for(const[c,d]of(x??[]).entries()){const f=$(d.shape);if(f===void 0)continue;const m={slide:e.id,shape:f,path:`${g}.animations.${String(c)}`},_=e.shapes.find(A=>A.name===f&&A.level==="slide");if(!_){a.push({...m,message:`Slide ${e.id} has no shape ${f} to animate (it has ${e.shapes.filter(A=>A.level==="slide").map(A=>A.name).join(", ")}).`});continue}if(d.paragraph!==void 0&&d.paragraph>=(_.text?.paragraphs.length??0)){a.push({...m,message:`Shape ${f} has no paragraph ${String(d.paragraph)} to animate (it has ${String(_.text?.paragraphs.length??0)}).`});continue}const k=We[d.effect];d.direction!==void 0&&!k.directions.includes(d.direction)&&a.push({...m,path:`${m.path}.direction`,message:k.directions.length===0?`${f}'s ${d.effect} has no direction (${d.direction}).`:`${f}'s ${d.effect} goes ${k.directions.join(", ")}, not ${d.direction}.`}),d.amount!==void 0&&k.amount===void 0?a.push({...m,path:`${m.path}.amount`,message:`${f}'s ${d.effect} has no amount: only a Grow/Shrink, a spin and a Transparency do.`}):d.effect==="transparency"&&(d.amount??0)>1&&a.push({...m,path:`${m.path}.amount`,message:`${f}'s transparency is a share, at most 1 (it is ${String(d.amount)}).`}),d.animate_text!==void 0&&!_.text&&a.push({...m,path:`${m.path}.animate_text`,message:`${f} has no text to animate by ${d.animate_text}: it plays as one.`});const z=d.animate_text,M=De({...d,shape:f,..._.text?{}:{animate_text:void 0}},z===void 0?1:(d.paragraph===void 0?_.text?.paragraphs??[]:[_.text?.paragraphs[d.paragraph]]).reduce((A,ve)=>A+Ie(ve?.runs.map(Oe=>Oe.text)??[],z).length,0));M?e.animations.push(M):a.push({...m,message:`The animation of ${f} needs a path that starts with M and says only M, L and C, absolute.`})}},ae=new Set;l.slides.forEach((e,n)=>{const s=`slides.${String(n)}`;if(e.layout!==void 0){const u=ie(e.id,e.layout,n,e.hidden===!0);if(!u)return;const x=r(`${o}.${e.id}.notes`);e.transition&&(u.slide.transition=F(e.id,e.transition,s)),e.advance_after!==void 0&&(u.slide.advance=e.advance_after),e.section!==void 0&&(u.slide.section=e.section),xe(u.slide,e.background,y),re(u.slide,u.master,u.placed,e.shapes,s,b=>b,b=>r(`${o}.${e.id}.${b.name}`),typeof x=="string"?x:void 0,e.animations,b=>{const p=r(`${o}.${e.id}.alt.${b.name}`);return typeof p=="string"?p:void 0}),v.push(u.slide),ae.add(e.id);return}const h=e.generate??"",g=t.generators[h];if(g===void 0){a.push({slide:e.id,path:`${s}.generate`,message:`There is no generator ${h} in the deck's module (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(g)){a.push({slide:e.id,path:`${s}.generate`,message:`Generator ${h} threw: ${g.error}`,...g.stack===void 0?{}:{stack:g.stack}});return}const $=g,T=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const u of $){const x=`${e.id}/${u.id}`,b=ie(x,u.layout,n,T.has(u.id),h);if(!b)continue;for(const w of u.shapes){const O=w.placeholder?b.placed.find(c=>c.shape.placeholder?.idx===w.placeholder?.idx):void 0;if(O)w.frame&&(O.shape.frame={...w.frame}),O.shape.sources.frame={from:"code"},O.shown=!0;else{const c=L(w,"layout",b.master);b.placed.push({shape:{...c,level:"slide",sources:{frame:{from:"code"}}},order:b.placed.length})}}const p=`${u.id}/`,j=u.transition??(u===$[0]?e.transition:void 0);xe(b.slide,e.background,y),j&&(b.slide.transition=F(b.slide.id,j,s)),u===$[0]&&e.section!==void 0&&(b.slide.section=e.section),re(b.slide,b.master,b.placed,e.shapes,s,w=>w.startsWith(p)?w.slice(p.length):void 0,w=>{const O=w.placeholder===void 0?void 0:u.text[w.placeholder.idx];return O===void 0?void 0:O.map(c=>c.runs.map(d=>d.text).join(""))},u.notes,[...(u.animations??[]).map(w=>({...w,shape:`${p}${w.shape}`})),...e.animations??[]]);for(const w of b.slide.shapes){const O=w.placeholder===void 0?void 0:u.text[w.placeholder.idx];O&&w.text&&(w.text.paragraphs=O,w.text.empty=!1)}v.push(b.slide),ae.add(x)}for(const u of Object.keys(e.shapes??{})){const[x]=u.split("/");x!==void 0&&!$.some(b=>b.id===x)&&a.push({slide:e.id,path:`${s}.shapes.${u}`,message:`Generator ${h} makes no slide ${x}: ${u} changes nothing.`})}});const le=new Set(v.map(e=>e.id));for(const e of v)for(const n of e.shapes){if(n.level!=="slide")continue;const s=[...n.link===void 0?[]:[n.link],...(n.text?.paragraphs??[]).flatMap(h=>h.runs.flatMap(g=>g.font?.link===void 0?[]:[g.font.link]))];for(const h of new Set(s)){const g=Ee(h);(g!==void 0?!le.has(g):h.startsWith("ppaction://")&&je(h)===void 0)&&a.push({slide:e.id,shape:n.name,message:g!==void 0?`Shape ${n.name} links to slide ${g}, which the deck has not (it has ${[...le].join(", ")}).`:`Shape ${n.name} links to ${h}: a show jump is ppaction://hlinkshowjump?jump= and ${Te.join(", ")}.`})}}return v.forEach((e,n)=>{for(const s of e.shapes)s.placeholder?.type==="sldNum"&&s.text&&(s.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],s.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:E,slides:v},problems:a}}
@@ -33,6 +33,17 @@ export type DeckScriptEdit =
33
33
  * snapshot's recorder resolve a deck's slides with.
34
34
  */
35
35
  export declare function scriptWords(script: ScriptFile, prefix: string): (key: string) => Words;
36
+ /** A chart's axes that have a title: its words name them. */
37
+ export declare const CHART_AXIS_WORDS: readonly ["category_axis", "value_axis", "secondary_axis"];
38
+ export type ChartAxisWords = (typeof CHART_AXIS_WORDS)[number];
39
+ /** A chart's words: its title and its axes' titles (undefined or empty: none). */
40
+ export type ChartWords = {
41
+ title?: string | undefined;
42
+ } & Partial<Record<ChartAxisWords, string | undefined>>;
43
+ /** A chart's words in the script: its title, or `{ title, category_axis, value_axis, secondary_axis }`. */
44
+ export declare function chartWordsOf(words: ScriptText | undefined): ChartWords;
45
+ /** A chart's words as the script writes them: its title alone as a line, else by name; none undefined. */
46
+ export declare function chartScriptText(w: ChartWords): ScriptText | undefined;
36
47
  /** A script's text read; undefined when it is not a script. */
37
48
  export declare function readScript(text: string): ScriptFile | undefined;
38
49
  /** The script's text after an edit. */