@json-to-office/shared-pptx 0.20.0 → 0.22.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.
@@ -1,1102 +0,0 @@
1
- // src/schemas/component-defaults.ts
2
- import { Type as Type9 } from "@sinclair/typebox";
3
-
4
- // src/schemas/components/text.ts
5
- import { Type as Type3 } from "@sinclair/typebox";
6
- import { FontFamilyNameSchema as FontFamilyNameSchema2 } from "@json-to-office/shared";
7
-
8
- // src/schemas/components/common.ts
9
- import { Type as Type2 } from "@sinclair/typebox";
10
-
11
- // src/schemas/theme.ts
12
- import { Type } from "@sinclair/typebox";
13
- import { FontFamilyNameSchema } from "@json-to-office/shared";
14
- var GridMarginSchema = Type.Union(
15
- [
16
- Type.Number({ description: "Margin in inches (all sides)" }),
17
- Type.Object(
18
- {
19
- top: Type.Number({ description: "Top margin in inches" }),
20
- right: Type.Number({ description: "Right margin in inches" }),
21
- bottom: Type.Number({ description: "Bottom margin in inches" }),
22
- left: Type.Number({ description: "Left margin in inches" })
23
- },
24
- { additionalProperties: false }
25
- )
26
- ],
27
- { description: "Slide margins in inches" }
28
- );
29
- var GridGutterSchema = Type.Union(
30
- [
31
- Type.Number({ description: "Gutter in inches (both axes)" }),
32
- Type.Object(
33
- {
34
- column: Type.Number({ description: "Column gutter in inches" }),
35
- row: Type.Number({ description: "Row gutter in inches" })
36
- },
37
- { additionalProperties: false }
38
- )
39
- ],
40
- { description: "Gaps between grid tracks in inches" }
41
- );
42
- var GridConfigSchema = Type.Object(
43
- {
44
- columns: Type.Optional(Type.Number({ minimum: 1, description: "Number of columns (default: 12)" })),
45
- rows: Type.Optional(Type.Number({ minimum: 1, description: "Number of rows (default: 6)" })),
46
- margin: Type.Optional(GridMarginSchema),
47
- gutter: Type.Optional(GridGutterSchema)
48
- },
49
- { additionalProperties: false, description: "Grid layout configuration" }
50
- );
51
- var HexColorSchema = Type.String({ pattern: "^#?[0-9A-Fa-f]{6}$", description: "Hex color (e.g. #FF0000)" });
52
- var SEMANTIC_COLOR_NAMES = [
53
- "primary",
54
- "secondary",
55
- "accent",
56
- "background",
57
- "text",
58
- "text2",
59
- "background2",
60
- "accent4",
61
- "accent5",
62
- "accent6"
63
- ];
64
- var SEMANTIC_COLOR_ALIASES = [
65
- "accent1",
66
- "accent2",
67
- "accent3",
68
- "tx1",
69
- "tx2",
70
- "bg1",
71
- "bg2"
72
- ];
73
- var ColorValueSchema = Type.Union([
74
- HexColorSchema,
75
- ...SEMANTIC_COLOR_NAMES.map((n) => Type.Literal(n)),
76
- ...SEMANTIC_COLOR_ALIASES.map((n) => Type.Literal(n))
77
- ], { description: "Hex color or semantic theme color name" });
78
- var STYLE_NAMES = [
79
- "title",
80
- "subtitle",
81
- "heading1",
82
- "heading2",
83
- "heading3",
84
- "body",
85
- "caption"
86
- ];
87
- var StyleNameSchema = Type.Union(
88
- STYLE_NAMES.map((n) => Type.Literal(n)),
89
- { description: "Predefined style name" }
90
- );
91
- var TextStyleSchema = Type.Object({
92
- fontSize: Type.Optional(Type.Number()),
93
- fontFace: Type.Optional(FontFamilyNameSchema),
94
- fontColor: Type.Optional(ColorValueSchema),
95
- bold: Type.Optional(Type.Boolean()),
96
- fontWeight: Type.Optional(Type.Integer({ minimum: 100, maximum: 900 })),
97
- italic: Type.Optional(Type.Boolean()),
98
- align: Type.Optional(Type.Union([
99
- Type.Literal("left"),
100
- Type.Literal("center"),
101
- Type.Literal("right"),
102
- Type.Literal("justify")
103
- ])),
104
- lineSpacing: Type.Optional(Type.Number()),
105
- charSpacing: Type.Optional(Type.Number()),
106
- paraSpaceAfter: Type.Optional(Type.Number())
107
- }, { additionalProperties: false, description: "Text style preset" });
108
- var ThemeConfigSchema = Type.Object(
109
- {
110
- name: Type.String({ description: "Theme name" }),
111
- colors: Type.Object(
112
- {
113
- primary: HexColorSchema,
114
- secondary: HexColorSchema,
115
- accent: HexColorSchema,
116
- background: HexColorSchema,
117
- text: HexColorSchema,
118
- text2: Type.Optional(HexColorSchema),
119
- background2: Type.Optional(HexColorSchema),
120
- accent4: Type.Optional(HexColorSchema),
121
- accent5: Type.Optional(HexColorSchema),
122
- accent6: Type.Optional(HexColorSchema)
123
- },
124
- { additionalProperties: false, description: "Theme color palette (10-slot scheme)" }
125
- ),
126
- fonts: Type.Object(
127
- {
128
- heading: FontFamilyNameSchema,
129
- body: FontFamilyNameSchema
130
- },
131
- { additionalProperties: false, description: "Font families" }
132
- ),
133
- defaults: Type.Object(
134
- {
135
- fontSize: Type.Number({ description: "Default font size in points" }),
136
- fontColor: HexColorSchema
137
- },
138
- { additionalProperties: false, description: "Default text styling" }
139
- ),
140
- styles: Type.Optional(Type.Partial(
141
- Type.Object(Object.fromEntries(
142
- STYLE_NAMES.map((n) => [n, TextStyleSchema])
143
- )),
144
- { additionalProperties: false, description: "Named text style presets" }
145
- )),
146
- componentDefaults: Type.Optional(PptxComponentDefaultsSchema)
147
- },
148
- { additionalProperties: false, description: "Presentation theme configuration" }
149
- );
150
- function isValidThemeConfig(data) {
151
- return typeof data === "object" && data !== null;
152
- }
153
-
154
- // src/schemas/components/common.ts
155
- var PositionSchema = Type2.Object(
156
- {
157
- x: Type2.Optional(
158
- Type2.Union([
159
- Type2.Number({ description: "X position in inches" }),
160
- Type2.String({
161
- pattern: "^\\d+(\\.\\d+)?%$",
162
- description: 'X position as percentage (e.g., "10%")'
163
- })
164
- ])
165
- ),
166
- y: Type2.Optional(
167
- Type2.Union([
168
- Type2.Number({ description: "Y position in inches" }),
169
- Type2.String({
170
- pattern: "^\\d+(\\.\\d+)?%$",
171
- description: 'Y position as percentage (e.g., "10%")'
172
- })
173
- ])
174
- ),
175
- w: Type2.Optional(
176
- Type2.Union([
177
- Type2.Number({ description: "Width in inches" }),
178
- Type2.String({
179
- pattern: "^\\d+(\\.\\d+)?%$",
180
- description: 'Width as percentage (e.g., "80%")'
181
- })
182
- ])
183
- ),
184
- h: Type2.Optional(
185
- Type2.Union([
186
- Type2.Number({ description: "Height in inches" }),
187
- Type2.String({
188
- pattern: "^\\d+(\\.\\d+)?%$",
189
- description: 'Height as percentage (e.g., "20%")'
190
- })
191
- ])
192
- )
193
- },
194
- {
195
- description: "Position and size in inches or percentages",
196
- additionalProperties: false
197
- }
198
- );
199
- var SlideBackgroundSchema = Type2.Object(
200
- {
201
- color: Type2.Optional(ColorValueSchema),
202
- image: Type2.Optional(
203
- Type2.Object(
204
- {
205
- path: Type2.Optional(Type2.String({ description: "Image file path or URL" })),
206
- base64: Type2.Optional(
207
- Type2.String({ description: "Base64-encoded image data" })
208
- )
209
- },
210
- { description: "Background image", additionalProperties: false }
211
- )
212
- )
213
- },
214
- {
215
- description: "Slide background configuration",
216
- additionalProperties: false
217
- }
218
- );
219
- var TransitionSchema = Type2.Object(
220
- {
221
- type: Type2.Optional(
222
- Type2.Union(
223
- [
224
- Type2.Literal("fade"),
225
- Type2.Literal("push"),
226
- Type2.Literal("wipe"),
227
- Type2.Literal("zoom"),
228
- Type2.Literal("none")
229
- ],
230
- { description: "Transition effect type" }
231
- )
232
- ),
233
- speed: Type2.Optional(
234
- Type2.Union(
235
- [Type2.Literal("slow"), Type2.Literal("medium"), Type2.Literal("fast")],
236
- { description: "Transition speed" }
237
- )
238
- )
239
- },
240
- {
241
- description: "Slide transition configuration",
242
- additionalProperties: false
243
- }
244
- );
245
- var PptxAlignmentSchema = Type2.Union(
246
- [Type2.Literal("left"), Type2.Literal("center"), Type2.Literal("right")],
247
- { description: "Horizontal alignment options" }
248
- );
249
- var VerticalAlignmentSchema = Type2.Union(
250
- [Type2.Literal("top"), Type2.Literal("middle"), Type2.Literal("bottom")],
251
- { description: "Vertical alignment options" }
252
- );
253
- var ShadowSchema = Type2.Object(
254
- {
255
- type: Type2.Optional(
256
- Type2.Union([Type2.Literal("outer"), Type2.Literal("inner")], {
257
- description: "Shadow type"
258
- })
259
- ),
260
- color: Type2.Optional(ColorValueSchema),
261
- blur: Type2.Optional(Type2.Number({ description: "Shadow blur radius in points" })),
262
- offset: Type2.Optional(Type2.Number({ description: "Shadow offset in points" })),
263
- angle: Type2.Optional(Type2.Number({ description: "Shadow angle in degrees" })),
264
- opacity: Type2.Optional(
265
- Type2.Number({
266
- minimum: 0,
267
- maximum: 1,
268
- description: "Shadow opacity (0-1)"
269
- })
270
- )
271
- },
272
- {
273
- description: "Shadow configuration",
274
- additionalProperties: false
275
- }
276
- );
277
- var GridPositionSchema = Type2.Object(
278
- {
279
- column: Type2.Number({ minimum: 0, description: "Starting column (0-indexed)" }),
280
- row: Type2.Number({ minimum: 0, description: "Starting row (0-indexed)" }),
281
- columnSpan: Type2.Optional(Type2.Number({ minimum: 1, description: "Number of columns to span (default: 1)" })),
282
- rowSpan: Type2.Optional(Type2.Number({ minimum: 1, description: "Number of rows to span (default: 1)" }))
283
- },
284
- { additionalProperties: false, description: "Grid-based positioning" }
285
- );
286
-
287
- // src/schemas/components/text.ts
288
- var TextPropsSchema = Type3.Object(
289
- {
290
- text: Type3.String({ description: "Text content to display" }),
291
- x: Type3.Optional(
292
- Type3.Union([
293
- Type3.Number({ description: "X position in inches" }),
294
- Type3.String({
295
- pattern: "^\\d+(\\.\\d+)?%$",
296
- description: "X as percentage"
297
- })
298
- ])
299
- ),
300
- y: Type3.Optional(
301
- Type3.Union([
302
- Type3.Number({ description: "Y position in inches" }),
303
- Type3.String({
304
- pattern: "^\\d+(\\.\\d+)?%$",
305
- description: "Y as percentage"
306
- })
307
- ])
308
- ),
309
- w: Type3.Optional(
310
- Type3.Union([
311
- Type3.Number({ description: "Width in inches" }),
312
- Type3.String({
313
- pattern: "^\\d+(\\.\\d+)?%$",
314
- description: "Width as percentage"
315
- })
316
- ])
317
- ),
318
- h: Type3.Optional(
319
- Type3.Union([
320
- Type3.Number({ description: "Height in inches" }),
321
- Type3.String({
322
- pattern: "^\\d+(\\.\\d+)?%$",
323
- description: "Height as percentage"
324
- })
325
- ])
326
- ),
327
- fontSize: Type3.Optional(
328
- Type3.Number({ minimum: 1, description: "Font size in points" })
329
- ),
330
- fontFace: Type3.Optional(FontFamilyNameSchema2),
331
- color: Type3.Optional(
332
- Type3.String({ description: 'Text color (hex without #, e.g., "FF0000")' })
333
- ),
334
- bold: Type3.Optional(Type3.Boolean({ description: "Bold text" })),
335
- fontWeight: Type3.Optional(
336
- Type3.Integer({
337
- minimum: 100,
338
- maximum: 900,
339
- description: "Per-run weight (100\u2013900). Renderer picks the closest embedded variant via CSS font-matching and references it through a synthetic family alias. Overrides `bold` when set."
340
- })
341
- ),
342
- italic: Type3.Optional(Type3.Boolean({ description: "Italic text" })),
343
- underline: Type3.Optional(
344
- Type3.Union([
345
- Type3.Boolean({ description: "Simple underline toggle" }),
346
- Type3.Object(
347
- {
348
- style: Type3.Optional(
349
- Type3.Union([
350
- Type3.Literal("sng"),
351
- Type3.Literal("dbl"),
352
- Type3.Literal("dash"),
353
- Type3.Literal("dotted")
354
- ])
355
- ),
356
- color: Type3.Optional(
357
- Type3.String({ description: "Underline color (hex)" })
358
- )
359
- },
360
- { additionalProperties: false }
361
- )
362
- ])
363
- ),
364
- strike: Type3.Optional(Type3.Boolean({ description: "Strikethrough text" })),
365
- language: Type3.Optional(
366
- Type3.String({
367
- pattern: "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
368
- description: 'Language tag (BCP-47, e.g. "en-US", "fr-FR") for spell-checking this text. Overrides the presentation default.',
369
- examples: ["en-US", "fr-FR", "de-DE", "it-IT", "es-ES"]
370
- })
371
- ),
372
- align: Type3.Optional(PptxAlignmentSchema),
373
- valign: Type3.Optional(VerticalAlignmentSchema),
374
- breakLine: Type3.Optional(
375
- Type3.Boolean({ description: "Add line break after text" })
376
- ),
377
- bullet: Type3.Optional(
378
- Type3.Union([
379
- Type3.Boolean({ description: "Enable default bullet" }),
380
- Type3.Object(
381
- {
382
- type: Type3.Optional(
383
- Type3.Union([Type3.Literal("bullet"), Type3.Literal("number")])
384
- ),
385
- style: Type3.Optional(
386
- Type3.String({ description: "Bullet character or style" })
387
- ),
388
- startAt: Type3.Optional(
389
- Type3.Number({ description: "Starting number for numbered lists" })
390
- )
391
- },
392
- { additionalProperties: false }
393
- )
394
- ])
395
- ),
396
- margin: Type3.Optional(
397
- Type3.Union([
398
- Type3.Number({ description: "Margin in points (all sides)" }),
399
- Type3.Array(Type3.Number(), {
400
- description: "Margins as [top, right, bottom, left] in points",
401
- minItems: 4,
402
- maxItems: 4
403
- })
404
- ])
405
- ),
406
- rotate: Type3.Optional(
407
- Type3.Number({ description: "Rotation angle in degrees" })
408
- ),
409
- shadow: Type3.Optional(ShadowSchema),
410
- fill: Type3.Optional(
411
- Type3.Object(
412
- {
413
- color: Type3.String({ description: "Fill color (hex without #)" }),
414
- transparency: Type3.Optional(
415
- Type3.Number({
416
- minimum: 0,
417
- maximum: 100,
418
- description: "Fill transparency (0-100)"
419
- })
420
- )
421
- },
422
- { additionalProperties: false }
423
- )
424
- ),
425
- hyperlink: Type3.Optional(
426
- Type3.Object(
427
- {
428
- url: Type3.Optional(Type3.String({ description: "Hyperlink URL" })),
429
- slide: Type3.Optional(
430
- Type3.Number({ description: "Slide number to link to" })
431
- ),
432
- tooltip: Type3.Optional(
433
- Type3.String({ description: "Hyperlink tooltip" })
434
- )
435
- },
436
- { additionalProperties: false }
437
- )
438
- ),
439
- lineSpacing: Type3.Optional(
440
- Type3.Number({ description: "Line spacing in points" })
441
- ),
442
- charSpacing: Type3.Optional(
443
- Type3.Number({
444
- description: "Character spacing in points (positive = wider, negative = tighter)"
445
- })
446
- ),
447
- paraSpaceBefore: Type3.Optional(
448
- Type3.Number({ description: "Space before paragraph in points" })
449
- ),
450
- paraSpaceAfter: Type3.Optional(
451
- Type3.Number({ description: "Space after paragraph in points" })
452
- ),
453
- grid: Type3.Optional(GridPositionSchema),
454
- style: Type3.Optional(StyleNameSchema)
455
- },
456
- {
457
- description: "Text component props",
458
- additionalProperties: false
459
- }
460
- );
461
-
462
- // src/schemas/components/image.ts
463
- import { Type as Type4 } from "@sinclair/typebox";
464
- var PptxImagePropsSchema = Type4.Object(
465
- {
466
- path: Type4.Optional(
467
- Type4.String({
468
- description: "Image file path or URL (mutually exclusive with base64 and svg)"
469
- })
470
- ),
471
- base64: Type4.Optional(
472
- Type4.String({
473
- description: "Base64-encoded image data in data URI format (mutually exclusive with path and svg)"
474
- })
475
- ),
476
- svg: Type4.Optional(
477
- Type4.String({
478
- description: 'Raw inline SVG markup, e.g. "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\">...</svg>" (mutually exclusive with path and base64). Wrapped into an image/svg+xml data URI and embedded as a vector (PowerPoint 2016+); intrinsic size taken from the SVG viewBox/width/height when w/h omitted.'
479
- })
480
- ),
481
- x: Type4.Optional(
482
- Type4.Union([
483
- Type4.Number({ description: "X position in inches" }),
484
- Type4.String({
485
- pattern: "^\\d+(\\.\\d+)?%$",
486
- description: "X as percentage"
487
- })
488
- ])
489
- ),
490
- y: Type4.Optional(
491
- Type4.Union([
492
- Type4.Number({ description: "Y position in inches" }),
493
- Type4.String({
494
- pattern: "^\\d+(\\.\\d+)?%$",
495
- description: "Y as percentage"
496
- })
497
- ])
498
- ),
499
- w: Type4.Optional(
500
- Type4.Union([
501
- Type4.Number({ description: "Width in inches" }),
502
- Type4.String({
503
- pattern: "^\\d+(\\.\\d+)?%$",
504
- description: "Width as percentage"
505
- })
506
- ])
507
- ),
508
- h: Type4.Optional(
509
- Type4.Union([
510
- Type4.Number({ description: "Height in inches" }),
511
- Type4.String({
512
- pattern: "^\\d+(\\.\\d+)?%$",
513
- description: "Height as percentage"
514
- })
515
- ])
516
- ),
517
- sizing: Type4.Optional(
518
- Type4.Object(
519
- {
520
- type: Type4.Union(
521
- [
522
- Type4.Literal("contain"),
523
- Type4.Literal("cover"),
524
- Type4.Literal("crop")
525
- ],
526
- { description: "Image sizing strategy" }
527
- ),
528
- w: Type4.Optional(
529
- Type4.Number({ description: "Target width in inches" })
530
- ),
531
- h: Type4.Optional(
532
- Type4.Number({ description: "Target height in inches" })
533
- )
534
- },
535
- { description: "Image sizing options", additionalProperties: false }
536
- )
537
- ),
538
- rotate: Type4.Optional(
539
- Type4.Number({ description: "Rotation angle in degrees" })
540
- ),
541
- rounding: Type4.Optional(
542
- Type4.Boolean({ description: "Apply rounded corners to image" })
543
- ),
544
- shadow: Type4.Optional(ShadowSchema),
545
- hyperlink: Type4.Optional(
546
- Type4.Object(
547
- {
548
- url: Type4.Optional(Type4.String({ description: "Hyperlink URL" })),
549
- slide: Type4.Optional(
550
- Type4.Number({ description: "Slide number to link to" })
551
- ),
552
- tooltip: Type4.Optional(
553
- Type4.String({ description: "Hyperlink tooltip" })
554
- )
555
- },
556
- { additionalProperties: false }
557
- )
558
- ),
559
- alt: Type4.Optional(
560
- Type4.String({ description: "Alternative text for accessibility" })
561
- ),
562
- grid: Type4.Optional(GridPositionSchema)
563
- },
564
- {
565
- description: "PPTX image component props",
566
- additionalProperties: false
567
- }
568
- );
569
-
570
- // src/schemas/components/shape.ts
571
- import { Type as Type5 } from "@sinclair/typebox";
572
- var ShapeTypeSchema = Type5.Union(
573
- [
574
- Type5.Literal("rect"),
575
- Type5.Literal("roundRect"),
576
- Type5.Literal("ellipse"),
577
- Type5.Literal("triangle"),
578
- Type5.Literal("diamond"),
579
- Type5.Literal("pentagon"),
580
- Type5.Literal("hexagon"),
581
- Type5.Literal("star5"),
582
- Type5.Literal("star6"),
583
- Type5.Literal("line"),
584
- Type5.Literal("arrow"),
585
- Type5.Literal("chevron"),
586
- Type5.Literal("cloud"),
587
- Type5.Literal("heart"),
588
- Type5.Literal("lightning")
589
- ],
590
- { description: "Shape type" }
591
- );
592
- var TextSegmentSchema = Type5.Object(
593
- {
594
- text: Type5.String(),
595
- fontSize: Type5.Optional(Type5.Number({ minimum: 1 })),
596
- fontFace: Type5.Optional(Type5.String()),
597
- color: Type5.Optional(Type5.String({ description: "Segment color (hex without # or semantic name)" })),
598
- bold: Type5.Optional(Type5.Boolean()),
599
- fontWeight: Type5.Optional(Type5.Integer({ minimum: 100, maximum: 900 })),
600
- italic: Type5.Optional(Type5.Boolean()),
601
- breakLine: Type5.Optional(Type5.Boolean({ description: "Insert line break after this segment" })),
602
- spaceBefore: Type5.Optional(Type5.Number({ minimum: 0, description: "Space before paragraph in points" })),
603
- spaceAfter: Type5.Optional(Type5.Number({ minimum: 0, description: "Space after paragraph in points" })),
604
- charSpacing: Type5.Optional(Type5.Number({ description: "Character spacing in points" }))
605
- },
606
- { additionalProperties: false }
607
- );
608
- var ShapePropsSchema = Type5.Object(
609
- {
610
- type: ShapeTypeSchema,
611
- x: Type5.Optional(
612
- Type5.Union([
613
- Type5.Number({ description: "X position in inches" }),
614
- Type5.String({ pattern: "^\\d+(\\.\\d+)?%$", description: "X as percentage" })
615
- ])
616
- ),
617
- y: Type5.Optional(
618
- Type5.Union([
619
- Type5.Number({ description: "Y position in inches" }),
620
- Type5.String({ pattern: "^\\d+(\\.\\d+)?%$", description: "Y as percentage" })
621
- ])
622
- ),
623
- w: Type5.Optional(
624
- Type5.Union([
625
- Type5.Number({ description: "Width in inches" }),
626
- Type5.String({ pattern: "^\\d+(\\.\\d+)?%$", description: "Width as percentage" })
627
- ])
628
- ),
629
- h: Type5.Optional(
630
- Type5.Union([
631
- Type5.Number({ description: "Height in inches" }),
632
- Type5.String({ pattern: "^\\d+(\\.\\d+)?%$", description: "Height as percentage" })
633
- ])
634
- ),
635
- fill: Type5.Optional(
636
- Type5.Object(
637
- {
638
- color: Type5.String({ description: "Fill color (hex without #)" }),
639
- transparency: Type5.Optional(
640
- Type5.Number({ minimum: 0, maximum: 100, description: "Fill transparency (0-100)" })
641
- )
642
- },
643
- { additionalProperties: false }
644
- )
645
- ),
646
- line: Type5.Optional(
647
- Type5.Object(
648
- {
649
- color: Type5.Optional(Type5.String({ description: "Line color (hex without #)" })),
650
- width: Type5.Optional(Type5.Number({ minimum: 0, description: "Line width in points" })),
651
- dashType: Type5.Optional(
652
- Type5.Union([
653
- Type5.Literal("solid"),
654
- Type5.Literal("dash"),
655
- Type5.Literal("dot"),
656
- Type5.Literal("dashDot")
657
- ])
658
- )
659
- },
660
- { additionalProperties: false }
661
- )
662
- ),
663
- text: Type5.Optional(Type5.Union([
664
- Type5.String({ description: "Plain text" }),
665
- Type5.Array(TextSegmentSchema, { description: "Rich text segments with per-segment formatting" })
666
- ], { description: "Text content inside the shape" })),
667
- fontSize: Type5.Optional(Type5.Number({ minimum: 1, description: "Font size for shape text" })),
668
- fontFace: Type5.Optional(Type5.String({ description: "Font family for shape text" })),
669
- fontColor: Type5.Optional(Type5.String({ description: "Font color for shape text (hex without #)" })),
670
- charSpacing: Type5.Optional(Type5.Number({ description: "Character spacing in points for shape text" })),
671
- bold: Type5.Optional(Type5.Boolean({ description: "Bold shape text" })),
672
- fontWeight: Type5.Optional(
673
- Type5.Integer({
674
- minimum: 100,
675
- maximum: 900,
676
- description: "Per-shape weight (100\u2013900). Overrides `bold` when set."
677
- })
678
- ),
679
- italic: Type5.Optional(Type5.Boolean({ description: "Italic shape text" })),
680
- align: Type5.Optional(PptxAlignmentSchema),
681
- valign: Type5.Optional(VerticalAlignmentSchema),
682
- rotate: Type5.Optional(Type5.Number({ description: "Rotation angle in degrees" })),
683
- shadow: Type5.Optional(ShadowSchema),
684
- rectRadius: Type5.Optional(
685
- Type5.Number({
686
- minimum: 0,
687
- description: "Corner radius for roundRect shape in inches"
688
- })
689
- ),
690
- grid: Type5.Optional(GridPositionSchema),
691
- style: Type5.Optional(StyleNameSchema)
692
- },
693
- {
694
- description: "Shape component props",
695
- additionalProperties: false
696
- }
697
- );
698
-
699
- // src/schemas/components/table.ts
700
- import { Type as Type6 } from "@sinclair/typebox";
701
- var PptxTableCellSchema = Type6.Union([
702
- Type6.String({ description: "Simple text cell" }),
703
- Type6.Object(
704
- {
705
- text: Type6.String({ description: "Cell text content" }),
706
- color: Type6.Optional(Type6.String({ description: "Text color (hex without #)" })),
707
- fill: Type6.Optional(Type6.String({ description: "Cell background color (hex without #)" })),
708
- fontSize: Type6.Optional(Type6.Number({ description: "Font size in points" })),
709
- fontFace: Type6.Optional(Type6.String({ description: "Font family" })),
710
- bold: Type6.Optional(Type6.Boolean({ description: "Bold text" })),
711
- fontWeight: Type6.Optional(
712
- Type6.Integer({
713
- minimum: 100,
714
- maximum: 900,
715
- description: "Per-cell weight (100\u2013900). Overrides `bold` when set."
716
- })
717
- ),
718
- italic: Type6.Optional(Type6.Boolean({ description: "Italic text" })),
719
- align: Type6.Optional(PptxAlignmentSchema),
720
- valign: Type6.Optional(VerticalAlignmentSchema),
721
- colspan: Type6.Optional(Type6.Number({ minimum: 1, description: "Column span" })),
722
- rowspan: Type6.Optional(Type6.Number({ minimum: 1, description: "Row span" })),
723
- margin: Type6.Optional(
724
- Type6.Union([
725
- Type6.Number({ description: "Margin in points (all sides)" }),
726
- Type6.Array(Type6.Number(), { minItems: 4, maxItems: 4 })
727
- ])
728
- )
729
- },
730
- { additionalProperties: false }
731
- )
732
- ]);
733
- var PptxTablePropsSchema = Type6.Object(
734
- {
735
- rows: Type6.Array(
736
- Type6.Array(PptxTableCellSchema, { description: "Row of cells" }),
737
- { description: "Table rows (array of arrays)", minItems: 1 }
738
- ),
739
- x: Type6.Optional(
740
- Type6.Union([
741
- Type6.Number({ description: "X position in inches" }),
742
- Type6.String({ pattern: "^\\d+(\\.\\d+)?%$", description: "X as percentage" })
743
- ])
744
- ),
745
- y: Type6.Optional(
746
- Type6.Union([
747
- Type6.Number({ description: "Y position in inches" }),
748
- Type6.String({ pattern: "^\\d+(\\.\\d+)?%$", description: "Y as percentage" })
749
- ])
750
- ),
751
- w: Type6.Optional(
752
- Type6.Union([
753
- Type6.Number({ description: "Width in inches" }),
754
- Type6.String({ pattern: "^\\d+(\\.\\d+)?%$", description: "Width as percentage" })
755
- ])
756
- ),
757
- h: Type6.Optional(
758
- Type6.Union([
759
- Type6.Number({ description: "Height in inches" }),
760
- Type6.String({ pattern: "^\\d+(\\.\\d+)?%$", description: "Height as percentage" })
761
- ])
762
- ),
763
- colW: Type6.Optional(
764
- Type6.Union([
765
- Type6.Number({ description: "Uniform column width in inches" }),
766
- Type6.Array(Type6.Number(), { description: "Individual column widths in inches" })
767
- ])
768
- ),
769
- rowH: Type6.Optional(
770
- Type6.Union([
771
- Type6.Number({ description: "Uniform row height in inches" }),
772
- Type6.Array(Type6.Number(), { description: "Individual row heights in inches" })
773
- ])
774
- ),
775
- border: Type6.Optional(
776
- Type6.Object(
777
- {
778
- type: Type6.Optional(
779
- Type6.Union([
780
- Type6.Literal("solid"),
781
- Type6.Literal("dash"),
782
- Type6.Literal("dot"),
783
- Type6.Literal("none")
784
- ])
785
- ),
786
- pt: Type6.Optional(Type6.Number({ minimum: 0, description: "Border width in points" })),
787
- color: Type6.Optional(Type6.String({ description: "Border color (hex without #)" }))
788
- },
789
- { additionalProperties: false }
790
- )
791
- ),
792
- fill: Type6.Optional(Type6.String({ description: "Table background color (hex without #)" })),
793
- fontSize: Type6.Optional(Type6.Number({ minimum: 1, description: "Default font size for all cells" })),
794
- fontFace: Type6.Optional(Type6.String({ description: "Default font family for all cells" })),
795
- color: Type6.Optional(Type6.String({ description: "Default text color for all cells (hex without #)" })),
796
- align: Type6.Optional(PptxAlignmentSchema),
797
- valign: Type6.Optional(VerticalAlignmentSchema),
798
- autoPage: Type6.Optional(
799
- Type6.Boolean({ description: "Auto-paginate table across multiple slides when content overflows" })
800
- ),
801
- autoPageRepeatHeader: Type6.Optional(
802
- Type6.Boolean({ description: "Repeat first row as header on each auto-paged slide" })
803
- ),
804
- margin: Type6.Optional(
805
- Type6.Union([
806
- Type6.Number({ description: "Cell margin in points (all sides)" }),
807
- Type6.Array(Type6.Number(), { minItems: 4, maxItems: 4 })
808
- ])
809
- ),
810
- borderRadius: Type6.Optional(
811
- Type6.Number({ minimum: 0, description: "Rounded corner radius in inches. Renders a roundRect shape behind the table." })
812
- ),
813
- grid: Type6.Optional(GridPositionSchema)
814
- },
815
- {
816
- description: "PPTX table component props",
817
- additionalProperties: false
818
- }
819
- );
820
-
821
- // src/schemas/components/highcharts.ts
822
- import { Type as Type7 } from "@sinclair/typebox";
823
- var PptxHighchartsPropsSchema = Type7.Object(
824
- {
825
- options: Type7.Intersect([
826
- Type7.Record(Type7.String(), Type7.Unknown()),
827
- Type7.Object({
828
- chart: Type7.Object({
829
- width: Type7.Number(),
830
- height: Type7.Number()
831
- })
832
- })
833
- ]),
834
- scale: Type7.Optional(Type7.Number()),
835
- serverUrl: Type7.Optional(
836
- Type7.String({
837
- description: "Highcharts Export Server URL (default: http://localhost:7801)"
838
- })
839
- ),
840
- // Optional resources forwarded verbatim to the export server (CSS/JS/files).
841
- // Notably enables @font-face rules so charts render in custom fonts.
842
- resources: Type7.Optional(
843
- Type7.Object({
844
- css: Type7.Optional(Type7.String()),
845
- js: Type7.Optional(Type7.String()),
846
- files: Type7.Optional(Type7.Array(Type7.String()))
847
- })
848
- ),
849
- x: Type7.Optional(
850
- Type7.Union([
851
- Type7.Number({ description: "X position in inches" }),
852
- Type7.String({
853
- pattern: "^\\d+(\\.\\d+)?%$",
854
- description: "X as percentage"
855
- })
856
- ])
857
- ),
858
- y: Type7.Optional(
859
- Type7.Union([
860
- Type7.Number({ description: "Y position in inches" }),
861
- Type7.String({
862
- pattern: "^\\d+(\\.\\d+)?%$",
863
- description: "Y as percentage"
864
- })
865
- ])
866
- ),
867
- w: Type7.Optional(
868
- Type7.Union([
869
- Type7.Number({ description: "Width in inches" }),
870
- Type7.String({
871
- pattern: "^\\d+(\\.\\d+)?%$",
872
- description: "Width as percentage"
873
- })
874
- ])
875
- ),
876
- h: Type7.Optional(
877
- Type7.Union([
878
- Type7.Number({ description: "Height in inches" }),
879
- Type7.String({
880
- pattern: "^\\d+(\\.\\d+)?%$",
881
- description: "Height as percentage"
882
- })
883
- ])
884
- ),
885
- grid: Type7.Optional(GridPositionSchema)
886
- },
887
- {
888
- description: "PPTX Highcharts component props",
889
- additionalProperties: false
890
- }
891
- );
892
-
893
- // src/schemas/components/chart.ts
894
- import { Type as Type8 } from "@sinclair/typebox";
895
- var PositionValue = Type8.Union([
896
- Type8.Number(),
897
- Type8.String({ pattern: "^\\d+(\\.\\d+)?%$" })
898
- ]);
899
- var ChartTypeSchema = Type8.Union(
900
- [
901
- Type8.Literal("area"),
902
- Type8.Literal("bar"),
903
- Type8.Literal("bar3D"),
904
- Type8.Literal("bubble"),
905
- Type8.Literal("doughnut"),
906
- Type8.Literal("line"),
907
- Type8.Literal("pie"),
908
- Type8.Literal("radar"),
909
- Type8.Literal("scatter")
910
- ],
911
- { description: "Chart type" }
912
- );
913
- var ChartDataSeriesSchema = Type8.Object(
914
- {
915
- name: Type8.Optional(Type8.String({ description: "Series name" })),
916
- labels: Type8.Optional(Type8.Array(Type8.String(), { description: "Category labels" })),
917
- values: Type8.Optional(Type8.Array(Type8.Number(), { description: "Data values" })),
918
- sizes: Type8.Optional(Type8.Array(Type8.Number(), { description: "Bubble sizes (bubble charts only)" }))
919
- },
920
- { additionalProperties: false }
921
- );
922
- var PptxChartPropsSchema = Type8.Object(
923
- {
924
- type: ChartTypeSchema,
925
- data: Type8.Array(ChartDataSeriesSchema, {
926
- description: "Chart data series",
927
- minItems: 1
928
- }),
929
- // Display toggles
930
- showLegend: Type8.Optional(Type8.Boolean({ description: "Show chart legend" })),
931
- showTitle: Type8.Optional(Type8.Boolean({ description: "Show chart title" })),
932
- showValue: Type8.Optional(Type8.Boolean({ description: "Show data values" })),
933
- showPercent: Type8.Optional(Type8.Boolean({ description: "Show percentages (pie/doughnut)" })),
934
- showLabel: Type8.Optional(Type8.Boolean({ description: "Show category labels on data points" })),
935
- showSerName: Type8.Optional(Type8.Boolean({ description: "Show series name on data points" })),
936
- // Title
937
- title: Type8.Optional(Type8.String({ description: "Chart title text" })),
938
- titleFontSize: Type8.Optional(Type8.Number({ description: "Title font size (points)" })),
939
- titleColor: Type8.Optional(Type8.String({ description: "Title color (hex or semantic)" })),
940
- titleFontFace: Type8.Optional(Type8.String({ description: "Title font face" })),
941
- // Chart colors
942
- chartColors: Type8.Optional(
943
- Type8.Array(Type8.String(), {
944
- description: "Series colors (hex or semantic theme names). Defaults to theme palette."
945
- })
946
- ),
947
- // Legend
948
- legendPos: Type8.Optional(
949
- Type8.Union(
950
- [Type8.Literal("b"), Type8.Literal("l"), Type8.Literal("r"), Type8.Literal("t"), Type8.Literal("tr")],
951
- { description: "Legend position" }
952
- )
953
- ),
954
- legendFontSize: Type8.Optional(Type8.Number({ description: "Legend font size" })),
955
- legendFontFace: Type8.Optional(Type8.String({ description: "Legend font face" })),
956
- legendColor: Type8.Optional(Type8.String({ description: "Legend text color" })),
957
- // Category axis
958
- catAxisTitle: Type8.Optional(Type8.String({ description: "Category axis title" })),
959
- catAxisHidden: Type8.Optional(Type8.Boolean({ description: "Hide category axis" })),
960
- catAxisLabelRotate: Type8.Optional(Type8.Number({ description: "Category axis label rotation (degrees)" })),
961
- catAxisLabelFontSize: Type8.Optional(Type8.Number({ description: "Category axis label font size" })),
962
- catAxisLabelColor: Type8.Optional(Type8.String({ description: "Category axis label color (hex or semantic)" })),
963
- // Value axis
964
- valAxisTitle: Type8.Optional(Type8.String({ description: "Value axis title" })),
965
- valAxisHidden: Type8.Optional(Type8.Boolean({ description: "Hide value axis" })),
966
- valAxisMinVal: Type8.Optional(Type8.Number({ description: "Value axis minimum" })),
967
- valAxisMaxVal: Type8.Optional(Type8.Number({ description: "Value axis maximum" })),
968
- valAxisLabelFormatCode: Type8.Optional(Type8.String({ description: 'Value axis label format (e.g. "$0.00", "#%")' })),
969
- valAxisMajorUnit: Type8.Optional(Type8.Number({ description: "Value axis major unit / tick interval" })),
970
- valAxisLabelColor: Type8.Optional(Type8.String({ description: "Value axis label color (hex or semantic)" })),
971
- // Bar-specific
972
- barDir: Type8.Optional(
973
- Type8.Union([Type8.Literal("bar"), Type8.Literal("col")], {
974
- description: 'Bar direction: "bar" (horizontal) or "col" (vertical, default)'
975
- })
976
- ),
977
- barGrouping: Type8.Optional(
978
- Type8.Union(
979
- [Type8.Literal("clustered"), Type8.Literal("stacked"), Type8.Literal("percentStacked")],
980
- { description: "Bar grouping style" }
981
- )
982
- ),
983
- barGapWidthPct: Type8.Optional(
984
- Type8.Number({ minimum: 0, maximum: 500, description: "Bar gap width (0-500%)" })
985
- ),
986
- // Line-specific
987
- lineSmooth: Type8.Optional(Type8.Boolean({ description: "Smooth lines" })),
988
- lineDataSymbol: Type8.Optional(
989
- Type8.Union(
990
- [
991
- Type8.Literal("circle"),
992
- Type8.Literal("dash"),
993
- Type8.Literal("diamond"),
994
- Type8.Literal("dot"),
995
- Type8.Literal("none"),
996
- Type8.Literal("square"),
997
- Type8.Literal("triangle")
998
- ],
999
- { description: "Line data point marker symbol" }
1000
- )
1001
- ),
1002
- lineSize: Type8.Optional(Type8.Number({ description: "Line width (points)" })),
1003
- // Pie/doughnut-specific
1004
- firstSliceAng: Type8.Optional(Type8.Number({ minimum: 0, maximum: 359, description: "Angle of first slice (degrees)" })),
1005
- holeSize: Type8.Optional(Type8.Number({ minimum: 10, maximum: 90, description: "Doughnut hole size (%)" })),
1006
- // Radar-specific
1007
- radarStyle: Type8.Optional(
1008
- Type8.Union(
1009
- [Type8.Literal("standard"), Type8.Literal("marker"), Type8.Literal("filled")],
1010
- { description: "Radar chart style" }
1011
- )
1012
- ),
1013
- // Data labels
1014
- dataLabelColor: Type8.Optional(Type8.String({ description: "Data label text color" })),
1015
- dataLabelFontSize: Type8.Optional(Type8.Number({ description: "Data label font size" })),
1016
- dataLabelFontFace: Type8.Optional(Type8.String({ description: "Data label font face" })),
1017
- dataLabelFontBold: Type8.Optional(Type8.Boolean({ description: "Bold data labels" })),
1018
- dataLabelPosition: Type8.Optional(
1019
- Type8.Union(
1020
- [
1021
- Type8.Literal("b"),
1022
- Type8.Literal("bestFit"),
1023
- Type8.Literal("ctr"),
1024
- Type8.Literal("l"),
1025
- Type8.Literal("r"),
1026
- Type8.Literal("t"),
1027
- Type8.Literal("inEnd"),
1028
- Type8.Literal("outEnd")
1029
- ],
1030
- { description: "Data label position" }
1031
- )
1032
- ),
1033
- // Positioning
1034
- x: Type8.Optional(PositionValue),
1035
- y: Type8.Optional(PositionValue),
1036
- w: Type8.Optional(PositionValue),
1037
- h: Type8.Optional(PositionValue),
1038
- grid: Type8.Optional(GridPositionSchema)
1039
- },
1040
- {
1041
- description: "Native PowerPoint chart component props",
1042
- additionalProperties: false
1043
- }
1044
- );
1045
-
1046
- // src/schemas/component-defaults.ts
1047
- var TextComponentDefaultsSchema = Type9.Partial(TextPropsSchema);
1048
- var ImageComponentDefaultsSchema = Type9.Partial(PptxImagePropsSchema);
1049
- var ShapeComponentDefaultsSchema = Type9.Partial(ShapePropsSchema);
1050
- var TableComponentDefaultsSchema = Type9.Partial(PptxTablePropsSchema);
1051
- var HighchartsComponentDefaultsSchema = Type9.Partial(
1052
- PptxHighchartsPropsSchema
1053
- );
1054
- var ChartComponentDefaultsSchema = Type9.Partial(PptxChartPropsSchema);
1055
- var PptxComponentDefaultsSchema = Type9.Object(
1056
- {
1057
- text: Type9.Optional(TextComponentDefaultsSchema),
1058
- image: Type9.Optional(ImageComponentDefaultsSchema),
1059
- shape: Type9.Optional(ShapeComponentDefaultsSchema),
1060
- table: Type9.Optional(TableComponentDefaultsSchema),
1061
- highcharts: Type9.Optional(HighchartsComponentDefaultsSchema),
1062
- chart: Type9.Optional(ChartComponentDefaultsSchema)
1063
- },
1064
- { additionalProperties: true }
1065
- );
1066
-
1067
- export {
1068
- TextPropsSchema,
1069
- PptxImagePropsSchema,
1070
- ShapeTypeSchema,
1071
- TextSegmentSchema,
1072
- ShapePropsSchema,
1073
- PptxTablePropsSchema,
1074
- PptxHighchartsPropsSchema,
1075
- PptxChartPropsSchema,
1076
- TextComponentDefaultsSchema,
1077
- ImageComponentDefaultsSchema,
1078
- ShapeComponentDefaultsSchema,
1079
- TableComponentDefaultsSchema,
1080
- HighchartsComponentDefaultsSchema,
1081
- ChartComponentDefaultsSchema,
1082
- PptxComponentDefaultsSchema,
1083
- GridMarginSchema,
1084
- GridGutterSchema,
1085
- GridConfigSchema,
1086
- SEMANTIC_COLOR_NAMES,
1087
- SEMANTIC_COLOR_ALIASES,
1088
- ColorValueSchema,
1089
- STYLE_NAMES,
1090
- StyleNameSchema,
1091
- TextStyleSchema,
1092
- ThemeConfigSchema,
1093
- isValidThemeConfig,
1094
- PositionSchema,
1095
- SlideBackgroundSchema,
1096
- TransitionSchema,
1097
- PptxAlignmentSchema,
1098
- VerticalAlignmentSchema,
1099
- ShadowSchema,
1100
- GridPositionSchema
1101
- };
1102
- //# sourceMappingURL=chunk-STLETJGO.js.map