@office-open/core 0.6.4 → 0.6.5

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,3878 +1,2 @@
1
- import { a as BuilderElement, b as XmlComponent } from "../xml-components-CADgke8j.mjs";
2
- import { a as xsdLineCap, c as xsdPathFillMode, d as xsdPresetShadow, f as xsdRectAlignment, i as xsdEffectContainer, k as convertPixelsToEmu, l as xsdPattern, n as xsdBlendMode, o as xsdLineEndSize, r as xsdCompoundLine, s as xsdMaterialType, u as xsdPenAlignment, y as hashedId } from "../xsd-mappings-BiTj9yJn.mjs";
3
- //#region src/drawingml/color/color-transform.ts
4
- /**
5
- * Color transform elements for DrawingML colors.
6
- *
7
- * This module provides color transformation elements defined in EG_ColorTransform,
8
- * which can be applied as child elements to any color type (srgbClr, schemeClr, etc.).
9
- *
10
- * Reference: ISO/IEC 29500-4, dml-main.xsd, EG_ColorTransform
11
- *
12
- * @module
13
- */
14
- /**
15
- * Creates color transform child elements.
16
- *
17
- * These elements modify the parent color according to OOXML color transform rules.
18
- * Multiple transforms can be applied in sequence.
19
- *
20
- * @example
21
- * ```typescript
22
- * // Lighten accent1 by 40%
23
- * createColorTransforms({ tint: 40000 });
24
- * // Semi-transparent red with 50% alpha
25
- * createColorTransforms({ alpha: 50000 });
26
- * ```
27
- */
28
- const createColorTransforms = (options) => {
29
- const transforms = [];
30
- if (options.tint !== void 0) transforms.push(new BuilderElement({
31
- attributes: { val: {
32
- key: "val",
33
- value: options.tint
34
- } },
35
- name: "a:tint"
36
- }));
37
- if (options.shade !== void 0) transforms.push(new BuilderElement({
38
- attributes: { val: {
39
- key: "val",
40
- value: options.shade
41
- } },
42
- name: "a:shade"
43
- }));
44
- if (options.comp) transforms.push(new BuilderElement({ name: "a:comp" }));
45
- if (options.inv) transforms.push(new BuilderElement({ name: "a:inv" }));
46
- if (options.gray) transforms.push(new BuilderElement({ name: "a:gray" }));
47
- if (options.alpha !== void 0) transforms.push(new BuilderElement({
48
- attributes: { val: {
49
- key: "val",
50
- value: options.alpha
51
- } },
52
- name: "a:alpha"
53
- }));
54
- if (options.alphaOff !== void 0) transforms.push(new BuilderElement({
55
- attributes: { val: {
56
- key: "val",
57
- value: options.alphaOff
58
- } },
59
- name: "a:alphaOff"
60
- }));
61
- if (options.alphaMod !== void 0) transforms.push(new BuilderElement({
62
- attributes: { val: {
63
- key: "val",
64
- value: options.alphaMod
65
- } },
66
- name: "a:alphaMod"
67
- }));
68
- if (options.hue !== void 0) transforms.push(new BuilderElement({
69
- attributes: { val: {
70
- key: "val",
71
- value: options.hue
72
- } },
73
- name: "a:hue"
74
- }));
75
- if (options.hueOff !== void 0) transforms.push(new BuilderElement({
76
- attributes: { val: {
77
- key: "val",
78
- value: options.hueOff
79
- } },
80
- name: "a:hueOff"
81
- }));
82
- if (options.hueMod !== void 0) transforms.push(new BuilderElement({
83
- attributes: { val: {
84
- key: "val",
85
- value: options.hueMod
86
- } },
87
- name: "a:hueMod"
88
- }));
89
- if (options.sat !== void 0) transforms.push(new BuilderElement({
90
- attributes: { val: {
91
- key: "val",
92
- value: options.sat
93
- } },
94
- name: "a:sat"
95
- }));
96
- if (options.satOff !== void 0) transforms.push(new BuilderElement({
97
- attributes: { val: {
98
- key: "val",
99
- value: options.satOff
100
- } },
101
- name: "a:satOff"
102
- }));
103
- if (options.satMod !== void 0) transforms.push(new BuilderElement({
104
- attributes: { val: {
105
- key: "val",
106
- value: options.satMod
107
- } },
108
- name: "a:satMod"
109
- }));
110
- if (options.lum !== void 0) transforms.push(new BuilderElement({
111
- attributes: { val: {
112
- key: "val",
113
- value: options.lum
114
- } },
115
- name: "a:lum"
116
- }));
117
- if (options.lumOff !== void 0) transforms.push(new BuilderElement({
118
- attributes: { val: {
119
- key: "val",
120
- value: options.lumOff
121
- } },
122
- name: "a:lumOff"
123
- }));
124
- if (options.lumMod !== void 0) transforms.push(new BuilderElement({
125
- attributes: { val: {
126
- key: "val",
127
- value: options.lumMod
128
- } },
129
- name: "a:lumMod"
130
- }));
131
- if (options.red !== void 0) transforms.push(new BuilderElement({
132
- attributes: { val: {
133
- key: "val",
134
- value: options.red
135
- } },
136
- name: "a:red"
137
- }));
138
- if (options.redOff !== void 0) transforms.push(new BuilderElement({
139
- attributes: { val: {
140
- key: "val",
141
- value: options.redOff
142
- } },
143
- name: "a:redOff"
144
- }));
145
- if (options.redMod !== void 0) transforms.push(new BuilderElement({
146
- attributes: { val: {
147
- key: "val",
148
- value: options.redMod
149
- } },
150
- name: "a:redMod"
151
- }));
152
- if (options.green !== void 0) transforms.push(new BuilderElement({
153
- attributes: { val: {
154
- key: "val",
155
- value: options.green
156
- } },
157
- name: "a:green"
158
- }));
159
- if (options.greenOff !== void 0) transforms.push(new BuilderElement({
160
- attributes: { val: {
161
- key: "val",
162
- value: options.greenOff
163
- } },
164
- name: "a:greenOff"
165
- }));
166
- if (options.greenMod !== void 0) transforms.push(new BuilderElement({
167
- attributes: { val: {
168
- key: "val",
169
- value: options.greenMod
170
- } },
171
- name: "a:greenMod"
172
- }));
173
- if (options.blue !== void 0) transforms.push(new BuilderElement({
174
- attributes: { val: {
175
- key: "val",
176
- value: options.blue
177
- } },
178
- name: "a:blue"
179
- }));
180
- if (options.blueOff !== void 0) transforms.push(new BuilderElement({
181
- attributes: { val: {
182
- key: "val",
183
- value: options.blueOff
184
- } },
185
- name: "a:blueOff"
186
- }));
187
- if (options.blueMod !== void 0) transforms.push(new BuilderElement({
188
- attributes: { val: {
189
- key: "val",
190
- value: options.blueMod
191
- } },
192
- name: "a:blueMod"
193
- }));
194
- if (options.gamma) transforms.push(new BuilderElement({ name: "a:gamma" }));
195
- if (options.invGamma) transforms.push(new BuilderElement({ name: "a:invGamma" }));
196
- return transforms;
197
- };
198
- //#endregion
199
- //#region src/drawingml/color/hsl-color.ts
200
- /**
201
- * HSL color element for DrawingML.
202
- *
203
- * This module provides HSL (Hue, Saturation, Luminance) color support.
204
- *
205
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_HslColor
206
- *
207
- * @module
208
- */
209
- /**
210
- * Creates an HSL color element.
211
- *
212
- * Specifies a color using Hue, Saturation, and Luminance values.
213
- *
214
- * ## XSD Schema
215
- * ```xml
216
- * <xsd:complexType name="CT_HslColor">
217
- * <xsd:sequence>
218
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
219
- * </xsd:sequence>
220
- * <xsd:attribute name="hue" type="ST_PositiveFixedAngle" use="required"/>
221
- * <xsd:attribute name="sat" type="ST_Percentage" use="required"/>
222
- * <xsd:attribute name="lum" type="ST_Percentage" use="required"/>
223
- * </xsd:complexType>
224
- * ```
225
- */
226
- const createHslColor = (options) => {
227
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
228
- return new BuilderElement({
229
- attributes: {
230
- hue: {
231
- key: "hue",
232
- value: options.hue
233
- },
234
- lum: {
235
- key: "lum",
236
- value: options.luminance
237
- },
238
- sat: {
239
- key: "sat",
240
- value: options.saturation
241
- }
242
- },
243
- children: [...transforms],
244
- name: "a:hslClr"
245
- });
246
- };
247
- //#endregion
248
- //#region src/drawingml/color/preset-color.ts
249
- /**
250
- * Preset color element for DrawingML.
251
- *
252
- * This module provides named preset colors (CSS named colors).
253
- *
254
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetColor / ST_PresetColorVal
255
- *
256
- * @module
257
- */
258
- /**
259
- * Preset color values (CSS named colors).
260
- *
261
- * ## XSD Schema
262
- * ```xml
263
- * <xsd:simpleType name="ST_PresetColorVal">
264
- * <xsd:restriction base="xsd:token">
265
- * <xsd:enumeration value="aliceBlue"/>
266
- * ...
267
- * <xsd:enumeration value="yellowGreen"/>
268
- * </xsd:restriction>
269
- * </xsd:simpleType>
270
- * ```
271
- */
272
- const PresetColor = {
273
- ALICE_BLUE: "aliceBlue",
274
- ANTIQUE_WHITE: "antiqueWhite",
275
- AQUA: "aqua",
276
- AQUAMARINE: "aquamarine",
277
- AZURE: "azure",
278
- BEIGE: "beige",
279
- BISQUE: "bisque",
280
- BLACK: "black",
281
- BLANCHED_ALMOND: "blanchedAlmond",
282
- BLUE: "blue",
283
- BLUE_VIOLET: "blueViolet",
284
- BROWN: "brown",
285
- BURLY_WOOD: "burlyWood",
286
- CADET_BLUE: "cadetBlue",
287
- CHARTREUSE: "chartreuse",
288
- CHOCOLATE: "chocolate",
289
- CORAL: "coral",
290
- CORNFLOWER_BLUE: "cornflowerBlue",
291
- CORNSILK: "cornsilk",
292
- CRIMSON: "crimson",
293
- CYAN: "cyan",
294
- DARK_BLUE: "darkBlue",
295
- DARK_CYAN: "darkCyan",
296
- DARK_GOLDENROD: "darkGoldenrod",
297
- DARK_GRAY: "darkGray",
298
- DARK_GREY: "darkGrey",
299
- DARK_GREEN: "darkGreen",
300
- DARK_KHAKI: "darkKhaki",
301
- DARK_MAGENTA: "darkMagenta",
302
- DARK_OLIVE_GREEN: "darkOliveGreen",
303
- DARK_ORANGE: "darkOrange",
304
- DARK_ORCHID: "darkOrchid",
305
- DARK_RED: "darkRed",
306
- DARK_SALMON: "darkSalmon",
307
- DARK_SEA_GREEN: "darkSeaGreen",
308
- DARK_SLATE_BLUE: "darkSlateBlue",
309
- DARK_SLATE_GRAY: "darkSlateGray",
310
- DARK_SLATE_GREY: "darkSlateGrey",
311
- DARK_TURQUOISE: "darkTurquoise",
312
- DARK_VIOLET: "darkViolet",
313
- DEEP_PINK: "deepPink",
314
- DEEP_SKY_BLUE: "deepSkyBlue",
315
- DIM_GRAY: "dimGray",
316
- DIM_GREY: "dimGrey",
317
- DODGER_BLUE: "dodgerBlue",
318
- FIREBRICK: "firebrick",
319
- FLORAL_WHITE: "floralWhite",
320
- FOREST_GREEN: "forestGreen",
321
- FUCHSIA: "fuchsia",
322
- GAINSBORO: "gainsboro",
323
- GHOST_WHITE: "ghostWhite",
324
- GOLD: "gold",
325
- GOLDENROD: "goldenrod",
326
- GRAY: "gray",
327
- GREY: "grey",
328
- GREEN: "green",
329
- GREEN_YELLOW: "greenYellow",
330
- HONEYDEW: "honeydew",
331
- HOT_PINK: "hotPink",
332
- INDIAN_RED: "indianRed",
333
- INDIGO: "indigo",
334
- IVORY: "ivory",
335
- KHAKI: "khaki",
336
- LAVENDER: "lavender",
337
- LAVENDER_BLUSH: "lavenderBlush",
338
- LAWN_GREEN: "lawnGreen",
339
- LEMON_CHIFFON: "lemonChiffon",
340
- LIGHT_BLUE: "lightBlue",
341
- LIGHT_CORAL: "lightCoral",
342
- LIGHT_CYAN: "lightCyan",
343
- LIGHT_GOLDENROD_YELLOW: "lightGoldenrodYellow",
344
- LIGHT_GRAY: "lightGray",
345
- LIGHT_GREY: "lightGrey",
346
- LIGHT_GREEN: "lightGreen",
347
- LIGHT_PINK: "lightPink",
348
- LIGHT_SALMON: "lightSalmon",
349
- LIGHT_SEA_GREEN: "lightSeaGreen",
350
- LIGHT_SKY_BLUE: "lightSkyBlue",
351
- LIGHT_SLATE_GRAY: "lightSlateGray",
352
- LIGHT_SLATE_GREY: "lightSlateGrey",
353
- LIGHT_STEEL_BLUE: "lightSteelBlue",
354
- LIGHT_YELLOW: "lightYellow",
355
- LIME: "lime",
356
- LIME_GREEN: "limeGreen",
357
- LINEN: "linen",
358
- MAGENTA: "magenta",
359
- MAROON: "maroon",
360
- MEDIUM_AQUAMARINE: "mediumAquamarine",
361
- MEDIUM_BLUE: "mediumBlue",
362
- MEDIUM_ORCHID: "mediumOrchid",
363
- MEDIUM_PURPLE: "mediumPurple",
364
- MEDIUM_SEA_GREEN: "mediumSeaGreen",
365
- MEDIUM_SLATE_BLUE: "mediumSlateBlue",
366
- MEDIUM_SPRING_GREEN: "mediumSpringGreen",
367
- MEDIUM_TURQUOISE: "mediumTurquoise",
368
- MEDIUM_VIOLET_RED: "mediumVioletRed",
369
- MIDNIGHT_BLUE: "midnightBlue",
370
- MINT_CREAM: "mintCream",
371
- MISTY_ROSE: "mistyRose",
372
- MOCCASIN: "moccasin",
373
- NAVAJO_WHITE: "navajoWhite",
374
- NAVY: "navy",
375
- OLD_LACE: "oldLace",
376
- OLIVE: "olive",
377
- OLIVE_DRAB: "oliveDrab",
378
- ORANGE: "orange",
379
- ORANGE_RED: "orangeRed",
380
- ORCHID: "orchid",
381
- PALE_GOLDENROD: "paleGoldenrod",
382
- PALE_GREEN: "paleGreen",
383
- PALE_TURQUOISE: "paleTurquoise",
384
- PALE_VIOLET_RED: "paleVioletRed",
385
- PAPAYA_WHIP: "papayaWhip",
386
- PEACH_PUFF: "peachPuff",
387
- PERU: "peru",
388
- PINK: "pink",
389
- PLUM: "plum",
390
- POWDER_BLUE: "powderBlue",
391
- PURPLE: "purple",
392
- RED: "red",
393
- ROSY_BROWN: "rosyBrown",
394
- ROYAL_BLUE: "royalBlue",
395
- SADDLE_BROWN: "saddleBrown",
396
- SALMON: "salmon",
397
- SANDY_BROWN: "sandyBrown",
398
- SEA_GREEN: "seaGreen",
399
- SEA_SHELL: "seaShell",
400
- SIENNA: "sienna",
401
- SILVER: "silver",
402
- SKY_BLUE: "skyBlue",
403
- SLATE_BLUE: "slateBlue",
404
- SLATE_GRAY: "slateGray",
405
- SLATE_GREY: "slateGrey",
406
- SNOW: "snow",
407
- SPRING_GREEN: "springGreen",
408
- STEEL_BLUE: "steelBlue",
409
- TAN: "tan",
410
- TEAL: "teal",
411
- THISTLE: "thistle",
412
- TOMATO: "tomato",
413
- TURQUOISE: "turquoise",
414
- VIOLET: "violet",
415
- WHEAT: "wheat",
416
- WHITE: "white",
417
- WHITE_SMOKE: "whiteSmoke",
418
- YELLOW: "yellow",
419
- YELLOW_GREEN: "yellowGreen"
420
- };
421
- /**
422
- * Creates a preset color element.
423
- *
424
- * Specifies a color using a named preset (CSS named color).
425
- *
426
- * ## XSD Schema
427
- * ```xml
428
- * <xsd:complexType name="CT_PresetColor">
429
- * <xsd:sequence>
430
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
431
- * </xsd:sequence>
432
- * <xsd:attribute name="val" type="ST_PresetColorVal" use="required"/>
433
- * </xsd:complexType>
434
- * ```
435
- */
436
- const createPresetColor = (options) => {
437
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
438
- return new BuilderElement({
439
- attributes: { value: {
440
- key: "val",
441
- value: options.value
442
- } },
443
- children: [...transforms],
444
- name: "a:prstClr"
445
- });
446
- };
447
- //#endregion
448
- //#region src/drawingml/color/rgb-color.ts
449
- /**
450
- * RGB color element for DrawingML shapes.
451
- *
452
- * This module provides RGB color support for solid fills.
453
- *
454
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SRgbColor
455
- *
456
- * @module
457
- */
458
- /**
459
- * Creates an sRGB color element.
460
- *
461
- * Specifies a color using RGB hex values.
462
- *
463
- * ## XSD Schema
464
- * ```xml
465
- * <xsd:complexType name="CT_SRgbColor">
466
- * <xsd:sequence>
467
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
468
- * </xsd:sequence>
469
- * <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
470
- * </xsd:complexType>
471
- * ```
472
- *
473
- * @example
474
- * ```typescript
475
- * const redColor = createRgbColor({ value: "FF0000" });
476
- * // With alpha transform
477
- * const semiRed = createRgbColor({ value: "FF0000", transforms: { alpha: 50000 } });
478
- * ```
479
- */
480
- const createRgbColor = (options) => {
481
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
482
- return new BuilderElement({
483
- attributes: { value: {
484
- key: "val",
485
- value: options.value
486
- } },
487
- children: [...transforms],
488
- name: "a:srgbClr"
489
- });
490
- };
491
- //#endregion
492
- //#region src/drawingml/color/sc-rgb-color.ts
493
- /**
494
- * ScRGB color element for DrawingML shapes.
495
- *
496
- * This module provides scRGB color support using percentage-based RGB values.
497
- *
498
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ScRgbColor
499
- *
500
- * @module
501
- */
502
- /**
503
- * Creates an scRGB color element.
504
- *
505
- * Specifies a color using percentage-based RGB values.
506
- *
507
- * ## XSD Schema
508
- * ```xml
509
- * <xsd:complexType name="CT_ScRgbColor">
510
- * <xsd:sequence>
511
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
512
- * </xsd:sequence>
513
- * <xsd:attribute name="r" type="ST_Percentage" use="required"/>
514
- * <xsd:attribute name="g" type="ST_Percentage" use="required"/>
515
- * <xsd:attribute name="b" type="ST_Percentage" use="required"/>
516
- * </xsd:complexType>
517
- * ```
518
- *
519
- * @example
520
- * ```typescript
521
- * const redColor = createScRgbColor({ r: "100%", g: "0%", b: "0%" });
522
- * // With alpha transform
523
- * const semiRed = createScRgbColor({ r: "100%", g: "0%", b: "0%", transforms: { alpha: 50000 } });
524
- * ```
525
- */
526
- const createScRgbColor = (options) => {
527
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
528
- return new BuilderElement({
529
- attributes: {
530
- r: {
531
- key: "r",
532
- value: options.r
533
- },
534
- g: {
535
- key: "g",
536
- value: options.g
537
- },
538
- b: {
539
- key: "b",
540
- value: options.b
541
- }
542
- },
543
- children: [...transforms],
544
- name: "a:scrgbClr"
545
- });
546
- };
547
- //#endregion
548
- //#region src/drawingml/color/scheme-color.ts
549
- /**
550
- * Scheme color element for DrawingML shapes.
551
- *
552
- * This module provides scheme-based color support for solid fills,
553
- * allowing colors to be defined using theme color schemes.
554
- *
555
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SchemeColor / ST_SchemeColorVal
556
- *
557
- * @module
558
- */
559
- /**
560
- * Scheme color values for theme-based colors.
561
- *
562
- * These values reference colors defined in the document's color scheme/theme.
563
- */
564
- const SchemeColor = {
565
- /** Background color 1 */
566
- BG1: "bg1",
567
- /** Text color 1 */
568
- TX1: "tx1",
569
- /** Background color 2 */
570
- BG2: "bg2",
571
- /** Text color 2 */
572
- TX2: "tx2",
573
- /** Accent color 1 */
574
- ACCENT1: "accent1",
575
- /** Accent color 2 */
576
- ACCENT2: "accent2",
577
- /** Accent color 3 */
578
- ACCENT3: "accent3",
579
- /** Accent color 4 */
580
- ACCENT4: "accent4",
581
- /** Accent color 5 */
582
- ACCENT5: "accent5",
583
- /** Accent color 6 */
584
- ACCENT6: "accent6",
585
- /** Hyperlink color */
586
- HLINK: "hlink",
587
- /** Followed hyperlink color */
588
- FOLHLINK: "folHlink",
589
- /** Dark color 1 */
590
- DK1: "dk1",
591
- /** Light color 1 */
592
- LT1: "lt1",
593
- /** Dark color 2 */
594
- DK2: "dk2",
595
- /** Light color 2 */
596
- LT2: "lt2",
597
- /** Placeholder color */
598
- PHCLR: "phClr"
599
- };
600
- /**
601
- * Creates a scheme color element.
602
- *
603
- * Specifies a color using a theme color scheme reference.
604
- *
605
- * ## XSD Schema
606
- * ```xml
607
- * <xsd:complexType name="CT_SchemeColor">
608
- * <xsd:sequence>
609
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
610
- * </xsd:sequence>
611
- * <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
612
- * </xsd:complexType>
613
- * ```
614
- *
615
- * @example
616
- * ```typescript
617
- * const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });
618
- * // With tint transform
619
- * const lightAccent = createSchemeColor({
620
- * value: SchemeColor.ACCENT1,
621
- * transforms: { tint: 40000 },
622
- * });
623
- * ```
624
- */
625
- const createSchemeColor = (options) => {
626
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
627
- return new BuilderElement({
628
- attributes: { value: {
629
- key: "val",
630
- value: options.value
631
- } },
632
- children: [...transforms],
633
- name: "a:schemeClr"
634
- });
635
- };
636
- //#endregion
637
- //#region src/drawingml/color/system-color.ts
638
- /**
639
- * System color element for DrawingML.
640
- *
641
- * This module provides system color support, referencing OS-level UI colors.
642
- *
643
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SystemColor / ST_SystemColorVal
644
- *
645
- * @module
646
- */
647
- /**
648
- * System color values referencing OS UI colors.
649
- *
650
- * ## XSD Schema
651
- * ```xml
652
- * <xsd:simpleType name="ST_SystemColorVal">
653
- * <xsd:restriction base="xsd:token">
654
- * <xsd:enumeration value="scrollBar"/>
655
- * <xsd:enumeration value="background"/>
656
- * ...
657
- * <xsd:enumeration value="menuBar"/>
658
- * </xsd:restriction>
659
- * </xsd:simpleType>
660
- * ```
661
- */
662
- const SystemColor = {
663
- SCROLL_BAR: "scrollBar",
664
- BACKGROUND: "background",
665
- ACTIVE_CAPTION: "activeCaption",
666
- INACTIVE_CAPTION: "inactiveCaption",
667
- MENU: "menu",
668
- WINDOW: "window",
669
- WINDOW_FRAME: "windowFrame",
670
- MENU_TEXT: "menuText",
671
- WINDOW_TEXT: "windowText",
672
- CAPTION_TEXT: "captionText",
673
- ACTIVE_BORDER: "activeBorder",
674
- INACTIVE_BORDER: "inactiveBorder",
675
- APP_WORKSPACE: "appWorkspace",
676
- HIGHLIGHT: "highlight",
677
- HIGHLIGHT_TEXT: "highlightText",
678
- BTN_FACE: "btnFace",
679
- BTN_SHADOW: "btnShadow",
680
- GRAY_TEXT: "grayText",
681
- BTN_TEXT: "btnText",
682
- INACTIVE_CAPTION_TEXT: "inactiveCaptionText",
683
- BTN_HIGHLIGHT: "btnHighlight",
684
- THREE_D_DK_SHADOW: "3dDkShadow",
685
- THREE_D_LIGHT: "3dLight",
686
- INFO_TEXT: "infoText",
687
- INFO_BK: "infoBk",
688
- HOT_LIGHT: "hotLight",
689
- GRADIENT_ACTIVE_CAPTION: "gradientActiveCaption",
690
- GRADIENT_INACTIVE_CAPTION: "gradientInactiveCaption",
691
- MENU_HIGHLIGHT: "menuHighlight",
692
- MENU_BAR: "menuBar"
693
- };
694
- /**
695
- * Creates a system color element.
696
- *
697
- * References a system-defined UI color (e.g., window background, button face).
698
- *
699
- * ## XSD Schema
700
- * ```xml
701
- * <xsd:complexType name="CT_SystemColor">
702
- * <xsd:sequence>
703
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
704
- * </xsd:sequence>
705
- * <xsd:attribute name="val" type="ST_SystemColorVal" use="required"/>
706
- * <xsd:attribute name="lastClr" type="s:ST_HexColorRGB" use="optional"/>
707
- * </xsd:complexType>
708
- * ```
709
- */
710
- const createSystemColor = (options) => {
711
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
712
- return new BuilderElement({
713
- attributes: {
714
- lastClr: {
715
- key: "lastClr",
716
- value: options.lastClr
717
- },
718
- value: {
719
- key: "val",
720
- value: options.value
721
- }
722
- },
723
- children: [...transforms],
724
- name: "a:sysClr"
725
- });
726
- };
727
- //#endregion
728
- //#region src/drawingml/color/solid-fill.ts
729
- /**
730
- * Solid fill element for DrawingML shapes.
731
- *
732
- * This module provides solid fill support for outlines and shapes,
733
- * supporting RGB, scheme, HSL, system, and preset colors.
734
- *
735
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SolidColorFillProperties
736
- *
737
- * @module
738
- */
739
- /**
740
- * Creates the color child element for a solid fill based on the color type.
741
- */
742
- const SYSTEM_COLOR_VALUES = new Set(Object.values(SystemColor));
743
- const PRESET_COLOR_VALUES = new Set(Object.values(PresetColor));
744
- const SCHEME_COLOR_VALUES = new Set(Object.values(SchemeColor));
745
- const createColorElement = (color) => {
746
- if ("hue" in color && "saturation" in color && "luminance" in color) return createHslColor(color);
747
- if ("r" in color && "g" in color && "b" in color) return createScRgbColor(color);
748
- const colorValue = color.value;
749
- if (SYSTEM_COLOR_VALUES.has(colorValue)) return createSystemColor(color);
750
- if (PRESET_COLOR_VALUES.has(colorValue)) return createPresetColor(color);
751
- if (SCHEME_COLOR_VALUES.has(colorValue)) return createSchemeColor(color);
752
- return createRgbColor(color);
753
- };
754
- /**
755
- * Creates a solid fill element.
756
- *
757
- * Specifies a solid color fill using any supported color type.
758
- *
759
- * ## XSD Schema
760
- * ```xml
761
- * <xsd:complexType name="CT_SolidColorFillProperties">
762
- * <xsd:sequence>
763
- * <xsd:group ref="EG_ColorChoice" minOccurs="0"/>
764
- * <xsd:group ref="EG_EffectProperties" minOccurs="0"/>
765
- * </xsd:sequence>
766
- * </xsd:complexType>
767
- * ```
768
- *
769
- * @example
770
- * ```typescript
771
- * // RGB solid fill
772
- * const fill = createSolidFill({ value: "FF0000" });
773
- * // Scheme solid fill with tint
774
- * const schemeFill = createSolidFill({
775
- * value: SchemeColor.ACCENT1, transforms: { tint: 40000 },
776
- * });
777
- * // HSL solid fill
778
- * const hslFill = createSolidFill({ hue: 120000, saturation: 100000, luminance: 50000 });
779
- * ```
780
- */
781
- const createSolidFill = (options) => new BuilderElement({
782
- children: [createColorElement(options)],
783
- name: "a:solidFill"
784
- });
785
- //#endregion
786
- //#region src/drawingml/blip/blip-effects.ts
787
- /**
788
- * Blip image adjustment effects for DrawingML.
789
- *
790
- * These effects are applied directly to the image data within the `<a:blip>` element,
791
- * corresponding to Word's "Picture Format > Adjust" features (brightness, contrast,
792
- * grayscale, tint, duotone, etc.).
793
- *
794
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Blip children
795
- *
796
- * @module
797
- */
798
- /**
799
- * Creates blip effect elements from BlipEffectsOptions.
800
- *
801
- * @returns Array of XML components representing blip effects
802
- */
803
- const createBlipEffects = (options) => {
804
- const children = [];
805
- if (options.grayscale) children.push(new BuilderElement({ name: "a:grayscl" }));
806
- if (options.luminance) {
807
- const attrs = {};
808
- if (options.luminance.bright !== void 0) attrs.bright = {
809
- key: "bright",
810
- value: `${options.luminance.bright}%`
811
- };
812
- if (options.luminance.contrast !== void 0) attrs.contrast = {
813
- key: "contrast",
814
- value: `${options.luminance.contrast}%`
815
- };
816
- children.push(new BuilderElement({
817
- attributes: attrs,
818
- name: "a:lum"
819
- }));
820
- }
821
- if (options.hsl) {
822
- const attrs = {};
823
- if (options.hsl.hue !== void 0) attrs.hue = {
824
- key: "hue",
825
- value: String(options.hsl.hue)
826
- };
827
- if (options.hsl.saturation !== void 0) attrs.sat = {
828
- key: "sat",
829
- value: `${options.hsl.saturation}%`
830
- };
831
- if (options.hsl.luminance !== void 0) attrs.lum = {
832
- key: "lum",
833
- value: `${options.hsl.luminance}%`
834
- };
835
- children.push(new BuilderElement({
836
- attributes: attrs,
837
- name: "a:hsl"
838
- }));
839
- }
840
- if (options.tint) {
841
- const attrs = {};
842
- if (options.tint.hue !== void 0) attrs.hue = {
843
- key: "hue",
844
- value: String(options.tint.hue)
845
- };
846
- if (options.tint.amount !== void 0) attrs.amt = {
847
- key: "amt",
848
- value: `${options.tint.amount}%`
849
- };
850
- children.push(new BuilderElement({
851
- attributes: attrs,
852
- name: "a:tint"
853
- }));
854
- }
855
- if (options.duotone) children.push(new BuilderElement({
856
- children: [createColorElement(options.duotone.color1), createColorElement(options.duotone.color2)],
857
- name: "a:duotone"
858
- }));
859
- if (options.biLevel) children.push(new BuilderElement({
860
- attributes: { thresh: {
861
- key: "thresh",
862
- value: `${options.biLevel.threshold}%`
863
- } },
864
- name: "a:biLevel"
865
- }));
866
- if (options.alphaCeiling) children.push(new BuilderElement({ name: "a:alphaCeiling" }));
867
- if (options.alphaFloor) children.push(new BuilderElement({ name: "a:alphaFloor" }));
868
- if (options.alphaInverse !== void 0) if (typeof options.alphaInverse === "boolean") children.push(new BuilderElement({ name: "a:alphaInv" }));
869
- else children.push(new BuilderElement({
870
- children: [createColorElement(options.alphaInverse)],
871
- name: "a:alphaInv"
872
- }));
873
- if (options.alphaModFix) {
874
- const amt = options.alphaModFix.amount ?? 100;
875
- children.push(new BuilderElement({
876
- attributes: { amt: {
877
- key: "amt",
878
- value: `${amt}%`
879
- } },
880
- name: "a:alphaModFix"
881
- }));
882
- }
883
- if (options.alphaRepl) children.push(new BuilderElement({
884
- attributes: { a: {
885
- key: "a",
886
- value: `${options.alphaRepl.amount}%`
887
- } },
888
- name: "a:alphaRepl"
889
- }));
890
- if (options.alphaBiLevel) children.push(new BuilderElement({
891
- attributes: { thresh: {
892
- key: "thresh",
893
- value: `${options.alphaBiLevel.threshold}%`
894
- } },
895
- name: "a:alphaBiLevel"
896
- }));
897
- if (options.colorChange) {
898
- const attrs = {};
899
- if (options.colorChange.useAlpha === false) attrs.useA = {
900
- key: "useA",
901
- value: "0"
902
- };
903
- children.push(new BuilderElement({
904
- attributes: attrs,
905
- children: [new BuilderElement({
906
- children: [createColorElement(options.colorChange.from)],
907
- name: "a:clrFrom"
908
- }), new BuilderElement({
909
- children: [createColorElement(options.colorChange.to)],
910
- name: "a:clrTo"
911
- })],
912
- name: "a:clrChange"
913
- }));
914
- }
915
- if (options.colorRepl) children.push(new BuilderElement({
916
- children: [createColorElement(options.colorRepl.color)],
917
- name: "a:clrRepl"
918
- }));
919
- if (options.blur) {
920
- const attrs = {};
921
- if (options.blur.radius !== void 0) attrs.rad = {
922
- key: "rad",
923
- value: options.blur.radius
924
- };
925
- if (options.blur.grow === false) attrs.grow = {
926
- key: "grow",
927
- value: 0
928
- };
929
- children.push(new BuilderElement({
930
- attributes: attrs,
931
- name: "a:blur"
932
- }));
933
- }
934
- return children;
935
- };
936
- //#endregion
937
- //#region src/drawingml/blip/source-rectangle.ts
938
- /**
939
- * Source rectangle module for blip fills.
940
- *
941
- * This module defines the portion of an image to use when filling a shape.
942
- *
943
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
944
- *
945
- * @module
946
- */
947
- /**
948
- * Creates a source rectangle element for blip fill cropping.
949
- *
950
- * This element specifies a portion of the blip (image) to use as the fill.
951
- * When no options are provided, the entire blip is used.
952
- *
953
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
954
- *
955
- * ## XSD Schema
956
- * ```xml
957
- * <xsd:complexType name="CT_RelativeRect">
958
- * <xsd:attribute name="l" type="ST_Percentage" use="optional" default="0"/>
959
- * <xsd:attribute name="t" type="ST_Percentage" use="optional" default="0"/>
960
- * <xsd:attribute name="r" type="ST_Percentage" use="optional" default="0"/>
961
- * <xsd:attribute name="b" type="ST_Percentage" use="optional" default="0"/>
962
- * </xsd:complexType>
963
- * ```
964
- *
965
- * @example
966
- * ```typescript
967
- * // Crop 10% from left and right
968
- * createSourceRectangle({ left: 10000, right: 10000 });
969
- * ```
970
- */
971
- const createSourceRectangle = (options) => {
972
- if (!options) return new BuilderElement({ name: "a:srcRect" });
973
- const attributes = {};
974
- if (options.left !== void 0) attributes.l = {
975
- key: "l",
976
- value: options.left
977
- };
978
- if (options.top !== void 0) attributes.t = {
979
- key: "t",
980
- value: options.top
981
- };
982
- if (options.right !== void 0) attributes.r = {
983
- key: "r",
984
- value: options.right
985
- };
986
- if (options.bottom !== void 0) attributes.b = {
987
- key: "b",
988
- value: options.bottom
989
- };
990
- return new BuilderElement({
991
- attributes,
992
- name: "a:srcRect"
993
- });
994
- };
995
- //#endregion
996
- //#region src/drawingml/blip/stretch.ts
997
- /**
998
- * Stretch fill module for blip fills.
999
- *
1000
- * This module defines how images are stretched to fill shapes.
1001
- *
1002
- * Reference: http://officeopenxml.com/drwPic.php
1003
- *
1004
- * @module
1005
- */
1006
- /**
1007
- * Represents a fill rectangle for stretch fill mode.
1008
- *
1009
- * This element specifies the rectangular area of the shape to which
1010
- * the blip fill should be stretched.
1011
- *
1012
- * Reference: http://officeopenxml.com/drwPic.php
1013
- *
1014
- * ## XSD Schema
1015
- * ```xml
1016
- * <xsd:complexType name="CT_RelativeRect">
1017
- * <xsd:attribute name="l" type="ST_Percentage" use="optional" default="0"/>
1018
- * <xsd:attribute name="t" type="ST_Percentage" use="optional" default="0"/>
1019
- * <xsd:attribute name="r" type="ST_Percentage" use="optional" default="0"/>
1020
- * <xsd:attribute name="b" type="ST_Percentage" use="optional" default="0"/>
1021
- * </xsd:complexType>
1022
- * ```
1023
- */
1024
- var FillRectangle = class extends XmlComponent {
1025
- constructor() {
1026
- super("a:fillRect");
1027
- }
1028
- };
1029
- /**
1030
- * Represents a stretch fill mode for blip fills.
1031
- *
1032
- * This element specifies that the blip (image) should be stretched to fill
1033
- * the entire shape. The stretch fill is one of the fill mode properties
1034
- * that determines how an image is applied to a shape.
1035
- *
1036
- * Reference: http://officeopenxml.com/drwPic.php
1037
- *
1038
- * ## XSD Schema
1039
- * ```xml
1040
- * <xsd:complexType name="CT_StretchInfoProperties">
1041
- * <xsd:sequence>
1042
- * <xsd:element name="fillRect" type="CT_RelativeRect" minOccurs="0" maxOccurs="1"/>
1043
- * </xsd:sequence>
1044
- * </xsd:complexType>
1045
- * ```
1046
- *
1047
- * @example
1048
- * ```typescript
1049
- * const stretch = new Stretch();
1050
- * ```
1051
- */
1052
- var Stretch = class extends XmlComponent {
1053
- constructor() {
1054
- super("a:stretch");
1055
- this.root.push(new FillRectangle());
1056
- }
1057
- };
1058
- //#endregion
1059
- //#region src/drawingml/blip/tile.ts
1060
- /**
1061
- * Tile fill module for blip fills.
1062
- *
1063
- * This module defines how images are tiled (repeated) to fill shapes.
1064
- *
1065
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TileInfoProperties
1066
- *
1067
- * @module
1068
- */
1069
- /**
1070
- * Tile alignment within the shape.
1071
- *
1072
- * Specifies the anchor position of the first tile relative to the shape.
1073
- */
1074
- const TileAlignment = {
1075
- /** Top-left corner */
1076
- TOP_LEFT: "topLeft",
1077
- /** Top center */
1078
- TOP: "top",
1079
- /** Top-right corner */
1080
- TOP_RIGHT: "topRight",
1081
- /** Middle-left */
1082
- LEFT: "left",
1083
- /** Center */
1084
- CENTER: "center",
1085
- /** Middle-right */
1086
- RIGHT: "right",
1087
- /** Bottom-left corner */
1088
- BOTTOM_LEFT: "bottomLeft",
1089
- /** Bottom center */
1090
- BOTTOM: "bottom",
1091
- /** Bottom-right corner */
1092
- BOTTOM_RIGHT: "bottomRight"
1093
- };
1094
- /**
1095
- * Creates a tile fill mode element for blip fills.
1096
- *
1097
- * When a blip fill uses tile mode, the image is repeated (tiled) to fill
1098
- * the shape instead of being stretched. This element controls the tiling
1099
- * parameters such as offset, scale, flip, and alignment.
1100
- *
1101
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TileInfoProperties
1102
- *
1103
- * ## XSD Schema
1104
- * ```xml
1105
- * <xsd:complexType name="CT_TileInfoProperties">
1106
- * <xsd:attribute name="tx" type="ST_Coordinate" use="optional"/>
1107
- * <xsd:attribute name="ty" type="ST_Coordinate" use="optional"/>
1108
- * <xsd:attribute name="sx" type="ST_Percentage" use="optional"/>
1109
- * <xsd:attribute name="sy" type="ST_Percentage" use="optional"/>
1110
- * <xsd:attribute name="flip" type="ST_TileFlipMode" default="none"/>
1111
- * <xsd:attribute name="algn" type="ST_RectAlignment" use="optional"/>
1112
- * </xsd:complexType>
1113
- * ```
1114
- *
1115
- * @example
1116
- * ```typescript
1117
- * // Tile with 50% scale
1118
- * createTileInfo({ sx: 50, sy: 50 });
1119
- * // Tile with flip and alignment
1120
- * createTileInfo({ flip: "XY", align: "CENTER" });
1121
- * ```
1122
- */
1123
- const createTileInfo = (options) => {
1124
- if (!options) return new BuilderElement({ name: "a:tile" });
1125
- const attributes = {};
1126
- if (options.tx !== void 0) attributes.tx = {
1127
- key: "tx",
1128
- value: options.tx
1129
- };
1130
- if (options.ty !== void 0) attributes.ty = {
1131
- key: "ty",
1132
- value: options.ty
1133
- };
1134
- if (options.sx !== void 0) attributes.sx = {
1135
- key: "sx",
1136
- value: options.sx
1137
- };
1138
- if (options.sy !== void 0) attributes.sy = {
1139
- key: "sy",
1140
- value: options.sy
1141
- };
1142
- if (options.flip !== void 0) attributes.flip = {
1143
- key: "flip",
1144
- value: options.flip
1145
- };
1146
- if (options.align !== void 0) attributes.algn = {
1147
- key: "algn",
1148
- value: xsdRectAlignment.to(options.align)
1149
- };
1150
- return new BuilderElement({
1151
- attributes: Object.keys(attributes).length > 0 ? attributes : void 0,
1152
- name: "a:tile"
1153
- });
1154
- };
1155
- //#endregion
1156
- //#region src/drawingml/fill/gradient-fill.ts
1157
- /**
1158
- * Gradient fill element for DrawingML shapes.
1159
- *
1160
- * This module provides gradient fill support with linear and path shading.
1161
- *
1162
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GradientFillProperties
1163
- *
1164
- * @module
1165
- */
1166
- /**
1167
- * Path shade type for radial gradients.
1168
- */
1169
- const PathShadeType = {
1170
- /** Follow shape path */
1171
- SHAPE: "shape",
1172
- /** Circular gradient */
1173
- CIRCLE: "circle",
1174
- /** Rectangular gradient */
1175
- RECT: "rect"
1176
- };
1177
- /**
1178
- * Tile flip mode for gradient fill.
1179
- *
1180
- * ## XSD Schema
1181
- * ```xml
1182
- * <xsd:simpleType name="ST_TileFlipMode">
1183
- * <xsd:restriction base="xsd:string">
1184
- * <xsd:enumeration value="none"/>
1185
- * <xsd:enumeration value="x"/>
1186
- * <xsd:enumeration value="y"/>
1187
- * <xsd:enumeration value="xy"/>
1188
- * </xsd:restriction>
1189
- * </xsd:simpleType>
1190
- * ```
1191
- */
1192
- const TileFlipMode = {
1193
- /** No flip */
1194
- NONE: "none",
1195
- /** Flip horizontally */
1196
- X: "x",
1197
- /** Flip vertically */
1198
- Y: "y",
1199
- /** Flip both horizontally and vertically */
1200
- XY: "xy"
1201
- };
1202
- /**
1203
- * Creates a gradient stop element (a:gs).
1204
- *
1205
- * @example
1206
- * ```typescript
1207
- * createGradientStop({ position: 0, color: { value: "FF0000" } });
1208
- * createGradientStop({ position: 100000, color: { value: "0000FF" } });
1209
- * ```
1210
- */
1211
- const createGradientStop = (stop) => new BuilderElement({
1212
- attributes: { pos: {
1213
- key: "pos",
1214
- value: stop.position
1215
- } },
1216
- children: [createColorElement(stop.color)],
1217
- name: "a:gs"
1218
- });
1219
- /**
1220
- * Creates a relative rect element.
1221
- */
1222
- const createRelativeRect = (name, rect) => new BuilderElement({
1223
- attributes: {
1224
- l: {
1225
- key: "l",
1226
- value: rect?.left
1227
- },
1228
- t: {
1229
- key: "t",
1230
- value: rect?.top
1231
- },
1232
- r: {
1233
- key: "r",
1234
- value: rect?.right
1235
- },
1236
- b: {
1237
- key: "b",
1238
- value: rect?.bottom
1239
- }
1240
- },
1241
- name
1242
- });
1243
- /**
1244
- * Creates the shade element (a:lin or a:path).
1245
- */
1246
- const createShadeElement = (shade) => {
1247
- if ("angle" in shade) return new BuilderElement({
1248
- attributes: {
1249
- ang: {
1250
- key: "ang",
1251
- value: shade.angle
1252
- },
1253
- scaled: {
1254
- key: "scaled",
1255
- value: shade.scaled
1256
- }
1257
- },
1258
- name: "a:lin"
1259
- });
1260
- const pathShade = shade;
1261
- const children = [];
1262
- if (pathShade.fillToRect) children.push(createRelativeRect("a:fillToRect", pathShade.fillToRect));
1263
- return new BuilderElement({
1264
- attributes: { path: {
1265
- key: "path",
1266
- value: pathShade.path
1267
- } },
1268
- children,
1269
- name: "a:path"
1270
- });
1271
- };
1272
- /**
1273
- * Creates a gradient fill element.
1274
- *
1275
- * ## XSD Schema
1276
- * ```xml
1277
- * <xsd:complexType name="CT_GradientFillProperties">
1278
- * <xsd:sequence>
1279
- * <xsd:element name="gsLst" type="CT_GradientStopList" minOccurs="0"/>
1280
- * <xsd:group ref="EG_ShadeProperties" minOccurs="0"/>
1281
- * </xsd:sequence>
1282
- * <xsd:attribute name="rotWithShape" type="xsd:boolean" use="optional"/>
1283
- * </xsd:complexType>
1284
- * ```
1285
- *
1286
- * @example
1287
- * ```typescript
1288
- * // Linear gradient from red to blue
1289
- * createGradientFill({
1290
- * stops: [
1291
- * { position: 0, color: { value: "FF0000" } },
1292
- * { position: 100000, color: { value: "0000FF" } },
1293
- * ],
1294
- * shade: { angle: 5400000 },
1295
- * });
1296
- * ```
1297
- */
1298
- const createGradientFill = (options) => {
1299
- const children = [];
1300
- children.push(new BuilderElement({
1301
- children: options.stops.map(createGradientStop),
1302
- name: "a:gsLst"
1303
- }));
1304
- if (options.shade) children.push(createShadeElement(options.shade));
1305
- if (options.tileRect) children.push(createRelativeRect("a:tileRect", options.tileRect));
1306
- return new BuilderElement({
1307
- attributes: {
1308
- flip: {
1309
- key: "flip",
1310
- value: options.flip
1311
- },
1312
- rotWithShape: {
1313
- key: "rotWithShape",
1314
- value: options.rotateWithShape
1315
- }
1316
- },
1317
- children,
1318
- name: "a:gradFill"
1319
- });
1320
- };
1321
- //#endregion
1322
- //#region src/drawingml/fill/pattern-fill.ts
1323
- /**
1324
- * Pattern fill element for DrawingML shapes.
1325
- *
1326
- * This module provides pattern fill support with preset patterns and
1327
- * optional foreground/background colors.
1328
- *
1329
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PatternFillProperties
1330
- *
1331
- * @module
1332
- */
1333
- /**
1334
- * Preset pattern values for pattern fill.
1335
- *
1336
- * ## XSD Schema
1337
- * ```xml
1338
- * <xsd:simpleType name="ST_PresetPatternVal">
1339
- * <xsd:restriction base="xsd:token">
1340
- * <xsd:enumeration value="pct5"/> ... <xsd:enumeration value="zigZag"/>
1341
- * </xsd:restriction>
1342
- * </xsd:simpleType>
1343
- * ```
1344
- *
1345
- * @publicApi
1346
- */
1347
- const PresetPattern = {
1348
- /** 5% pattern */
1349
- PCT5: "percent5",
1350
- /** 10% pattern */
1351
- PCT10: "percent10",
1352
- /** 20% pattern */
1353
- PCT20: "percent20",
1354
- /** 25% pattern */
1355
- PCT25: "percent25",
1356
- /** 30% pattern */
1357
- PCT30: "percent30",
1358
- /** 40% pattern */
1359
- PCT40: "percent40",
1360
- /** 50% pattern */
1361
- PCT50: "percent50",
1362
- /** 60% pattern */
1363
- PCT60: "percent60",
1364
- /** 70% pattern */
1365
- PCT70: "percent70",
1366
- /** 75% pattern */
1367
- PCT75: "percent75",
1368
- /** 80% pattern */
1369
- PCT80: "percent80",
1370
- /** 90% pattern */
1371
- PCT90: "percent90",
1372
- /** Horizontal lines */
1373
- HORZ: "horizontal",
1374
- /** Vertical lines */
1375
- VERT: "vertical",
1376
- /** Light horizontal lines */
1377
- LT_HORZ: "lightHorizontal",
1378
- /** Light vertical lines */
1379
- LT_VERT: "lightVertical",
1380
- /** Dark horizontal lines */
1381
- DK_HORZ: "darkHorizontal",
1382
- /** Dark vertical lines */
1383
- DK_VERT: "darkVertical",
1384
- /** Narrow horizontal lines */
1385
- NAR_HORZ: "narrowHorizontal",
1386
- /** Narrow vertical lines */
1387
- NAR_VERT: "narrowVertical",
1388
- /** Dashed horizontal lines */
1389
- DASH_HORZ: "dashedHorizontal",
1390
- /** Dashed vertical lines */
1391
- DASH_VERT: "dashedVertical",
1392
- /** Cross pattern (+) */
1393
- CROSS: "cross",
1394
- /** Downward diagonal lines (\) */
1395
- DN_DIAG: "downDiagonal",
1396
- /** Upward diagonal lines (/) */
1397
- UP_DIAG: "upDiagonal",
1398
- /** Light downward diagonal lines */
1399
- LT_DN_DIAG: "lightDownDiagonal",
1400
- /** Light upward diagonal lines */
1401
- LT_UP_DIAG: "lightUpDiagonal",
1402
- /** Dark downward diagonal lines */
1403
- DK_DN_DIAG: "darkDownDiagonal",
1404
- /** Dark upward diagonal lines */
1405
- DK_UP_DIAG: "darkUpDiagonal",
1406
- /** Wide downward diagonal lines */
1407
- WD_DN_DIAG: "wideDownDiagonal",
1408
- /** Wide upward diagonal lines */
1409
- WD_UP_DIAG: "wideUpDiagonal",
1410
- /** Dashed downward diagonal lines */
1411
- DASH_DN_DIAG: "dashedDownDiagonal",
1412
- /** Dashed upward diagonal lines */
1413
- DASH_UP_DIAG: "dashedUpDiagonal",
1414
- /** Diagonal cross pattern (X) */
1415
- DIAG_CROSS: "diagonalCross",
1416
- /** Small checkerboard */
1417
- SM_CHECK: "smallChecker",
1418
- /** Large checkerboard */
1419
- LG_CHECK: "largeChecker",
1420
- /** Small grid */
1421
- SM_GRID: "smallGrid",
1422
- /** Large grid */
1423
- LG_GRID: "largeGrid",
1424
- /** Dot grid */
1425
- DOT_GRID: "dotGrid",
1426
- /** Small confetti */
1427
- SM_CONFETTI: "smallConfetti",
1428
- /** Large confetti */
1429
- LG_CONFETTI: "largeConfetti",
1430
- /** Horizontal brick pattern */
1431
- HORZ_BRICK: "horizontalBrick",
1432
- /** Diagonal brick pattern */
1433
- DIAG_BRICK: "diagonalBrick",
1434
- /** Solid diamond */
1435
- SOLID_DMND: "solidDiamond",
1436
- /** Open diamond */
1437
- OPEN_DMND: "openDiamond",
1438
- /** Dotted diamond */
1439
- DOT_DMND: "dottedDiamond",
1440
- /** Plaid pattern */
1441
- PLAID: "plaid",
1442
- /** Sphere pattern */
1443
- SPHERE: "sphere",
1444
- /** Weave pattern */
1445
- WEAVE: "weave",
1446
- /** Divot pattern */
1447
- DIVOT: "divot",
1448
- /** Shingle pattern */
1449
- SHINGLE: "shingle",
1450
- /** Wave pattern */
1451
- WAVE: "wave",
1452
- /** Trellis pattern */
1453
- TRELLIS: "trellis",
1454
- /** Zigzag pattern */
1455
- ZIG_ZAG: "zigZag"
1456
- };
1457
- /**
1458
- * Creates a pattern fill element (a:pattFill).
1459
- *
1460
- * Specifies a pattern fill using preset patterns with optional
1461
- * foreground and background colors.
1462
- *
1463
- * ## XSD Schema
1464
- * ```xml
1465
- * <xsd:complexType name="CT_PatternFillProperties">
1466
- * <xsd:sequence>
1467
- * <xsd:element name="fgClr" type="CT_Color" minOccurs="0"/>
1468
- * <xsd:element name="bgClr" type="CT_Color" minOccurs="0"/>
1469
- * </xsd:sequence>
1470
- * <xsd:attribute name="prst" type="ST_PresetPatternVal" use="optional"/>
1471
- * </xsd:complexType>
1472
- * ```
1473
- *
1474
- * @example
1475
- * ```typescript
1476
- * // Simple crosshatch pattern
1477
- * createPatternFill({ pattern: PresetPattern.CROSS });
1478
- * // Pattern with foreground color
1479
- * createPatternFill({
1480
- * pattern: PresetPattern.DIAG_CROSS,
1481
- * foregroundColor: { value: "FF0000" },
1482
- * });
1483
- * // Pattern with foreground and background colors
1484
- * createPatternFill({
1485
- * pattern: PresetPattern.HORZ,
1486
- * foregroundColor: { value: "0000FF" },
1487
- * backgroundColor: { value: "FFFF00" },
1488
- * });
1489
- * ```
1490
- */
1491
- const createPatternFill = (options) => {
1492
- const children = [];
1493
- if (options.foregroundColor) children.push(new BuilderElement({
1494
- children: [createColorElement(options.foregroundColor)],
1495
- name: "a:fgClr"
1496
- }));
1497
- if (options.backgroundColor) children.push(new BuilderElement({
1498
- children: [createColorElement(options.backgroundColor)],
1499
- name: "a:bgClr"
1500
- }));
1501
- return new BuilderElement({
1502
- attributes: { prst: {
1503
- key: "prst",
1504
- value: xsdPattern.to(options.pattern)
1505
- } },
1506
- children,
1507
- name: "a:pattFill"
1508
- });
1509
- };
1510
- //#endregion
1511
- //#region src/drawingml/fill/fill-options.ts
1512
- function normalizeColor(color) {
1513
- return typeof color === "string" ? { value: color.replace("#", "") } : color;
1514
- }
1515
- function toUint8Array(data) {
1516
- return data instanceof Uint8Array ? data : new Uint8Array(data);
1517
- }
1518
- /**
1519
- * Extracts media data from a blip fill option, if present.
1520
- * Returns undefined for non-blip fills.
1521
- *
1522
- * The returned data should be registered with the document's media store
1523
- * during `prepForXml` so the packer can resolve the `{fileName}` placeholder.
1524
- */
1525
- const extractBlipFillMedia = (fill) => {
1526
- if (typeof fill === "string" || fill.type !== "blip") return void 0;
1527
- const raw = toUint8Array(fill.data);
1528
- return {
1529
- data: raw,
1530
- fileName: `${hashedId(raw)}.${fill.imageType}`,
1531
- type: fill.imageType
1532
- };
1533
- };
1534
- /**
1535
- * Builds a DrawingML fill XmlComponent from a FillOptions config.
1536
- */
1537
- const buildFill = (options) => {
1538
- if (typeof options === "string") return createSolidFill({ value: options.replace("#", "") });
1539
- switch (options.type) {
1540
- case "solid": return createSolidFill(normalizeColor(options.color));
1541
- case "none": return new BuilderElement({ name: "a:noFill" });
1542
- case "gradient":
1543
- if ("options" in options) return createGradientFill(options.options);
1544
- return createGradientFill({
1545
- stops: options.stops.map((stop) => ({
1546
- position: stop.position * 1e3,
1547
- color: normalizeColor(stop.color)
1548
- })),
1549
- ...!options.path && options.angle !== void 0 && { shade: {
1550
- angle: options.angle * 6e4,
1551
- scaled: options.scaled ?? true
1552
- } },
1553
- ...options.path && { shade: { path: options.path } }
1554
- });
1555
- case "blip": {
1556
- const fileName = `${hashedId(toUint8Array(options.data))}.${options.imageType}`;
1557
- const blipChildren = [];
1558
- if (options.blipEffects) blipChildren.push(...createBlipEffects(options.blipEffects));
1559
- const children = [new BuilderElement({
1560
- attributes: {
1561
- cstate: {
1562
- key: "cstate",
1563
- value: "none"
1564
- },
1565
- embed: {
1566
- key: "r:embed",
1567
- value: `{${fileName}}`
1568
- }
1569
- },
1570
- children: blipChildren,
1571
- name: "a:blip"
1572
- }), createSourceRectangle(options.srcRect)];
1573
- if (options.tile) children.push(createTileInfo(options.tile));
1574
- else children.push(new Stretch());
1575
- const attributes = {};
1576
- if (options.dpi !== void 0) attributes.dpi = {
1577
- key: "dpi",
1578
- value: options.dpi
1579
- };
1580
- if (options.rotWithShape !== void 0) attributes.rotWithShape = {
1581
- key: "rotWithShape",
1582
- value: options.rotWithShape ? 1 : 0
1583
- };
1584
- return new BuilderElement({
1585
- attributes: Object.keys(attributes).length > 0 ? attributes : void 0,
1586
- children,
1587
- name: "a:blipFill"
1588
- });
1589
- }
1590
- case "pattern": return createPatternFill({
1591
- pattern: options.pattern,
1592
- ...options.foregroundColor && { foregroundColor: normalizeColor(options.foregroundColor) },
1593
- ...options.backgroundColor && { backgroundColor: normalizeColor(options.backgroundColor) }
1594
- });
1595
- case "group": return new BuilderElement({ name: "a:grpFill" });
1596
- }
1597
- };
1598
- //#endregion
1599
- //#region src/drawingml/fill/no-fill.ts
1600
- /**
1601
- * No fill element for DrawingML shapes.
1602
- *
1603
- * This module provides the no-fill option for outline and shape fills.
1604
- *
1605
- * @module
1606
- */
1607
- /**
1608
- * Creates a no-fill element.
1609
- *
1610
- * Specifies that the outline or shape should have no fill applied.
1611
- *
1612
- * ## XSD Schema
1613
- * ```xml
1614
- * <xsd:element name="noFill" type="CT_Empty"/>
1615
- * ```
1616
- *
1617
- * @example
1618
- * ```typescript
1619
- * const noFill = createNoFill();
1620
- * ```
1621
- */
1622
- const createNoFill = () => new BuilderElement({ name: "a:noFill" });
1623
- //#endregion
1624
- //#region src/drawingml/fill/group-fill.ts
1625
- /**
1626
- * Group fill element for DrawingML shapes.
1627
- *
1628
- * This module provides group fill support which inherits the fill
1629
- * from the parent group shape.
1630
- *
1631
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GroupFillProperties
1632
- *
1633
- * @module
1634
- */
1635
- /**
1636
- * Creates a group fill element (a:grpFill).
1637
- *
1638
- * This element specifies that the shape should inherit its fill
1639
- * from the parent group shape. This is useful when shapes are
1640
- * grouped together and should share the same fill.
1641
- *
1642
- * ## XSD Schema
1643
- * ```xml
1644
- * <xsd:complexType name="CT_GroupFillProperties"/>
1645
- * ```
1646
- *
1647
- * @example
1648
- * ```typescript
1649
- * // Shape inherits fill from parent group
1650
- * createGroupFill();
1651
- * ```
1652
- */
1653
- const createGroupFill = () => new BuilderElement({ name: "a:grpFill" });
1654
- //#endregion
1655
- //#region src/drawingml/outline/custom-dash.ts
1656
- /**
1657
- * Custom dash pattern for DrawingML outlines.
1658
- *
1659
- * This module provides support for custom dash patterns defined by
1660
- * a list of dash stops, each specifying dash and space lengths as
1661
- * percentages relative to line width.
1662
- *
1663
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_DashStopList, CT_DashStop
1664
- *
1665
- * @module
1666
- */
1667
- /**
1668
- * Creates a custom dash element (a:custDash) for outlines.
1669
- *
1670
- * The custom dash element specifies a repeating pattern of dash and space
1671
- * segments. Each segment is defined by a `DashStop` with dash (`d`) and
1672
- * space (`sp`) lengths as positive percentages of the line width.
1673
- *
1674
- * ## XSD Schema
1675
- * ```xml
1676
- * <xsd:complexType name="CT_DashStopList">
1677
- * <xsd:sequence>
1678
- * <xsd:element name="ds" type="CT_DashStop" minOccurs="0" maxOccurs="unbounded"/>
1679
- * </xsd:sequence>
1680
- * </xsd:complexType>
1681
- * ```
1682
- *
1683
- * @example
1684
- * ```typescript
1685
- * // Simple dash pattern
1686
- * createCustomDash([
1687
- * { d: "500%", sp: "200%" },
1688
- * ]);
1689
- *
1690
- * // Complex alternating pattern
1691
- * createCustomDash([
1692
- * { d: "500%", sp: "200%" },
1693
- * { d: "100%", sp: "200%" },
1694
- * ]);
1695
- * ```
1696
- */
1697
- const createCustomDash = (stops) => {
1698
- const children = [];
1699
- for (const stop of stops) children.push(new BuilderElement({
1700
- attributes: {
1701
- d: {
1702
- key: "d",
1703
- value: stop.d
1704
- },
1705
- sp: {
1706
- key: "sp",
1707
- value: stop.sp
1708
- }
1709
- },
1710
- name: "a:ds"
1711
- }));
1712
- return new BuilderElement({
1713
- children,
1714
- name: "a:custDash"
1715
- });
1716
- };
1717
- //#endregion
1718
- //#region src/drawingml/outline/line-end.ts
1719
- /**
1720
- * Line end (arrow) properties for DrawingML outlines.
1721
- *
1722
- * This module provides support for line end markers (arrows) on shape outlines.
1723
- *
1724
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineEndProperties
1725
- *
1726
- * @module
1727
- */
1728
- /**
1729
- * Line end types (arrow head styles).
1730
- *
1731
- * ## XSD Schema
1732
- * ```xml
1733
- * <xsd:simpleType name="ST_LineEndType">
1734
- * <xsd:restriction base="xsd:token">
1735
- * <xsd:enumeration value="none"/>
1736
- * <xsd:enumeration value="triangle"/>
1737
- * <xsd:enumeration value="stealth"/>
1738
- * <xsd:enumeration value="diamond"/>
1739
- * <xsd:enumeration value="oval"/>
1740
- * <xsd:enumeration value="arrow"/>
1741
- * </xsd:restriction>
1742
- * </xsd:simpleType>
1743
- * ```
1744
- *
1745
- * @publicApi
1746
- */
1747
- const LineEndType = {
1748
- /** No line end */
1749
- NONE: "none",
1750
- /** Triangle arrow */
1751
- TRIANGLE: "triangle",
1752
- /** Stealth arrow (filled triangle) */
1753
- STEALTH: "stealth",
1754
- /** Diamond shape */
1755
- DIAMOND: "diamond",
1756
- /** Oval shape */
1757
- OVAL: "oval",
1758
- /** Simple arrow */
1759
- ARROW: "arrow"
1760
- };
1761
- /**
1762
- * Line end width options.
1763
- *
1764
- * ## XSD Schema
1765
- * ```xml
1766
- * <xsd:simpleType name="ST_LineEndWidth">
1767
- * <xsd:restriction base="xsd:token">
1768
- * <xsd:enumeration value="sm"/>
1769
- * <xsd:enumeration value="med"/>
1770
- * <xsd:enumeration value="lg"/>
1771
- * </xsd:restriction>
1772
- * </xsd:simpleType>
1773
- * ```
1774
- *
1775
- * @publicApi
1776
- */
1777
- const LineEndWidth = {
1778
- /** Small width */
1779
- SMALL: "small",
1780
- /** Medium width */
1781
- MEDIUM: "medium",
1782
- /** Large width */
1783
- LARGE: "large"
1784
- };
1785
- /**
1786
- * Line end length options.
1787
- *
1788
- * ## XSD Schema
1789
- * ```xml
1790
- * <xsd:simpleType name="ST_LineEndLength">
1791
- * <xsd:restriction base="xsd:token">
1792
- * <xsd:enumeration value="sm"/>
1793
- * <xsd:enumeration value="med"/>
1794
- * <xsd:enumeration value="lg"/>
1795
- * </xsd:restriction>
1796
- * </xsd:simpleType>
1797
- * ```
1798
- *
1799
- * @publicApi
1800
- */
1801
- const LineEndLength = {
1802
- /** Small length */
1803
- SMALL: "small",
1804
- /** Medium length */
1805
- MEDIUM: "medium",
1806
- /** Large length */
1807
- LARGE: "large"
1808
- };
1809
- /**
1810
- * Creates a line end element (a:headEnd or a:tailEnd).
1811
- *
1812
- * @example
1813
- * ```typescript
1814
- * // Stealth arrow at start, medium size
1815
- * createLineEnd("a:headEnd", { type: "STEALTH", width: "MEDIUM", length: "MEDIUM" });
1816
- * // Triangle arrow at end
1817
- * createLineEnd("a:tailEnd", { type: "TRIANGLE" });
1818
- * ```
1819
- */
1820
- const createLineEnd = (name, options) => new BuilderElement({
1821
- attributes: {
1822
- type: {
1823
- key: "type",
1824
- value: options.type
1825
- },
1826
- w: {
1827
- key: "w",
1828
- value: options.width ? xsdLineEndSize.to(options.width) : void 0
1829
- },
1830
- len: {
1831
- key: "len",
1832
- value: options.length ? xsdLineEndSize.to(options.length) : void 0
1833
- }
1834
- },
1835
- name
1836
- });
1837
- //#endregion
1838
- //#region src/drawingml/outline/outline.ts
1839
- /**
1840
- * Outline (line) properties for DrawingML shapes.
1841
- *
1842
- * This module provides support for configuring outline properties including
1843
- * width, cap style, compound line types, fill properties, dash, and join.
1844
- *
1845
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineProperties
1846
- *
1847
- * @module
1848
- */
1849
- /**
1850
- * Line cap styles for outline endpoints.
1851
- *
1852
- * Defines how the ends of a line are rendered.
1853
- */
1854
- const LineCap = {
1855
- /** Round cap style */
1856
- ROUND: "round",
1857
- /** Square cap style */
1858
- SQUARE: "square",
1859
- /** Flat cap style */
1860
- FLAT: "flat"
1861
- };
1862
- /**
1863
- * Compound line types for outlines.
1864
- *
1865
- * Defines the structure of compound lines (single, double, etc.).
1866
- */
1867
- const CompoundLine = {
1868
- /** Single line */
1869
- SINGLE: "single",
1870
- /** Double line */
1871
- DOUBLE: "double",
1872
- /** Thick-thin double line */
1873
- THICK_THIN: "thickThin",
1874
- /** Thin-thick double line */
1875
- THIN_THICK: "thinThick",
1876
- /** Triple line */
1877
- TRI: "triple"
1878
- };
1879
- /**
1880
- * Pen alignment options for outline positioning.
1881
- *
1882
- * Defines how the outline is aligned relative to the shape edge.
1883
- */
1884
- const PenAlignment = {
1885
- /** Center alignment */
1886
- CENTER: "center",
1887
- /** Inset alignment */
1888
- INSET: "inside"
1889
- };
1890
- /**
1891
- * Preset dash styles for outlines.
1892
- *
1893
- * ## XSD Schema
1894
- * ```xml
1895
- * <xsd:simpleType name="ST_PresetLineDashVal">
1896
- * <xsd:restriction base="xsd:token">
1897
- * <xsd:enumeration value="solid"/>
1898
- * <xsd:enumeration value="dot"/>
1899
- * <xsd:enumeration value="dash"/>
1900
- * <xsd:enumeration value="lgDash"/>
1901
- * <xsd:enumeration value="dashDot"/>
1902
- * <xsd:enumeration value="lgDashDot"/>
1903
- * <xsd:enumeration value="lgDashDotDot"/>
1904
- * <xsd:enumeration value="sysDash"/>
1905
- * <xsd:enumeration value="sysDot"/>
1906
- * <xsd:enumeration value="sysDashDot"/>
1907
- * <xsd:enumeration value="sysDashDotDot"/>
1908
- * </xsd:restriction>
1909
- * </xsd:simpleType>
1910
- * ```
1911
- */
1912
- const PresetDash = {
1913
- SOLID: "solid",
1914
- DOT: "dot",
1915
- DASH: "dash",
1916
- LG_DASH: "lgDash",
1917
- DASH_DOT: "dashDot",
1918
- LG_DASH_DOT: "lgDashDot",
1919
- LG_DASH_DOT_DOT: "lgDashDotDot",
1920
- SYS_DASH: "sysDash",
1921
- SYS_DOT: "sysDot",
1922
- SYS_DASH_DOT: "sysDashDot",
1923
- SYS_DASH_DOT_DOT: "sysDashDotDot"
1924
- };
1925
- /**
1926
- * Line join styles.
1927
- */
1928
- const LineJoin = {
1929
- ROUND: "round",
1930
- BEVEL: "bevel",
1931
- MITER: "miter"
1932
- };
1933
- /**
1934
- * Creates the fill child element for an outline.
1935
- *
1936
- * Returns null when no fill type is specified (OOXML allows outline without fill).
1937
- */
1938
- const createOutlineFill = (options) => {
1939
- if (options.type === "noFill") return createNoFill();
1940
- if (options.type === "solidFill" && options.color) return createSolidFill(options.color);
1941
- if (options.type === "gradFill" && options.gradientFill) return createGradientFill(options.gradientFill);
1942
- if (options.type === "pattFill" && options.patternFill) return createPatternFill(options.patternFill);
1943
- return null;
1944
- };
1945
- /**
1946
- * Creates an outline element for DrawingML shapes.
1947
- *
1948
- * The outline element specifies the line properties for the shape border,
1949
- * including width, cap style, compound line type, alignment, dash, join, and fill.
1950
- *
1951
- * ## XSD Schema
1952
- * ```xml
1953
- * <xsd:complexType name="CT_LineProperties">
1954
- * <xsd:sequence>
1955
- * <xsd:group ref="EG_FillProperties" minOccurs="0"/>
1956
- * <xsd:group ref="EG_LineDashProperties" minOccurs="0"/>
1957
- * <xsd:group ref="EG_LineJoinProperties" minOccurs="0"/>
1958
- * </xsd:sequence>
1959
- * <xsd:attribute name="w" use="optional" type="a:ST_LineWidth"/>
1960
- * <xsd:attribute name="cap" use="optional" type="ST_LineCap"/>
1961
- * <xsd:attribute name="cmpd" use="optional" type="ST_CompoundLine"/>
1962
- * <xsd:attribute name="algn" use="optional" type="ST_PenAlignment"/>
1963
- * </xsd:complexType>
1964
- * ```
1965
- *
1966
- * @example
1967
- * ```typescript
1968
- * // Outline with RGB color and dash
1969
- * const outline = createOutline({
1970
- * width: 9525,
1971
- * type: "solidFill",
1972
- * color: { value: "FF0000" },
1973
- * dash: "DASH",
1974
- * });
1975
- * ```
1976
- */
1977
- const createOutline = (options) => {
1978
- const children = [];
1979
- const fill = createOutlineFill(options);
1980
- if (fill) children.push(fill);
1981
- if (options.customDash !== void 0) children.push(createCustomDash(options.customDash));
1982
- else if (options.dash !== void 0) children.push(new BuilderElement({
1983
- attributes: { val: {
1984
- key: "val",
1985
- value: options.dash
1986
- } },
1987
- name: "a:prstDash"
1988
- }));
1989
- if (options.join !== void 0) if (options.join === "miter" && options.miterLimit !== void 0) children.push(new BuilderElement({
1990
- attributes: { lim: {
1991
- key: "lim",
1992
- value: options.miterLimit
1993
- } },
1994
- name: "a:miter"
1995
- }));
1996
- else children.push(new BuilderElement({ name: `a:${options.join}` }));
1997
- if (options.headEnd) children.push(createLineEnd("a:headEnd", options.headEnd));
1998
- if (options.tailEnd) children.push(createLineEnd("a:tailEnd", options.tailEnd));
1999
- return new BuilderElement({
2000
- attributes: {
2001
- align: {
2002
- key: "algn",
2003
- value: options.align ? xsdPenAlignment.to(options.align) : void 0
2004
- },
2005
- cap: {
2006
- key: "cap",
2007
- value: options.cap ? xsdLineCap.to(options.cap) : void 0
2008
- },
2009
- compoundLine: {
2010
- key: "cmpd",
2011
- value: options.compoundLine ? xsdCompoundLine.to(options.compoundLine) : void 0
2012
- },
2013
- width: {
2014
- key: "w",
2015
- value: options.width
2016
- }
2017
- },
2018
- children,
2019
- name: "a:ln"
2020
- });
2021
- };
2022
- //#endregion
2023
- //#region src/drawingml/effects/fill-overlay.ts
2024
- /**
2025
- * Fill overlay effect for DrawingML shapes.
2026
- *
2027
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_FillOverlayEffect
2028
- *
2029
- * @module
2030
- */
2031
- /**
2032
- * Blend modes for fill overlay effect.
2033
- *
2034
- * ## XSD Schema
2035
- * ```xml
2036
- * <xsd:simpleType name="ST_BlendMode">
2037
- * <xsd:restriction base="xsd:token">
2038
- * <xsd:enumeration value="over"/>
2039
- * <xsd:enumeration value="mult"/>
2040
- * <xsd:enumeration value="screen"/>
2041
- * <xsd:enumeration value="darken"/>
2042
- * <xsd:enumeration value="lighten"/>
2043
- * </xsd:restriction>
2044
- * </xsd:simpleType>
2045
- * ```
2046
- */
2047
- const BlendMode = {
2048
- /** Over blend mode */
2049
- OVER: "over",
2050
- /** Multiply blend mode */
2051
- MULTIPLY: "multiply",
2052
- /** Screen blend mode */
2053
- SCREEN: "screen",
2054
- /** Darken blend mode */
2055
- DARKEN: "darken",
2056
- /** Lighten blend mode */
2057
- LIGHTEN: "lighten"
2058
- };
2059
- /**
2060
- * Creates a fill overlay effect element.
2061
- *
2062
- * ## XSD Schema
2063
- * ```xml
2064
- * <xsd:complexType name="CT_FillOverlayEffect">
2065
- * <xsd:sequence>
2066
- * <xsd:group ref="EG_FillProperties" minOccurs="1" maxOccurs="1"/>
2067
- * </xsd:sequence>
2068
- * <xsd:attribute name="blend" type="ST_BlendMode" use="required"/>
2069
- * </xsd:complexType>
2070
- * ```
2071
- *
2072
- * @example
2073
- * ```typescript
2074
- * // Solid fill overlay
2075
- * const fillOverlay = createFillOverlayEffect({
2076
- * blend: BlendMode.MULTIPLY,
2077
- * solidFill: { value: "FF0000" },
2078
- * });
2079
- *
2080
- * // Gradient fill overlay
2081
- * const fillOverlay = createFillOverlayEffect({
2082
- * blend: BlendMode.SCREEN,
2083
- * gradientFill: { type: "linear", stops: [...] },
2084
- * });
2085
- * ```
2086
- */
2087
- const createFillOverlayEffect = (options) => {
2088
- let fillElement;
2089
- if (options.noFill) fillElement = createNoFill();
2090
- else if (options.solidFill) fillElement = createSolidFill(options.solidFill);
2091
- else if (options.gradientFill) fillElement = createGradientFill(options.gradientFill);
2092
- else if (options.patternFill) fillElement = createPatternFill(options.patternFill);
2093
- else if (options.groupFill) fillElement = createGroupFill();
2094
- else fillElement = createSolidFill({ value: "000000" });
2095
- return new BuilderElement({
2096
- attributes: { blend: {
2097
- key: "blend",
2098
- value: xsdBlendMode.to(options.blend)
2099
- } },
2100
- children: [fillElement],
2101
- name: "a:fillOverlay"
2102
- });
2103
- };
2104
- //#endregion
2105
- //#region src/drawingml/effects/glow.ts
2106
- /**
2107
- * Glow effect for DrawingML shapes.
2108
- *
2109
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GlowEffect
2110
- *
2111
- * @module
2112
- */
2113
- /**
2114
- * Creates a glow effect element.
2115
- *
2116
- * ## XSD Schema
2117
- * ```xml
2118
- * <xsd:complexType name="CT_GlowEffect">
2119
- * <xsd:sequence>
2120
- * <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
2121
- * </xsd:sequence>
2122
- * <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="optional" default="0"/>
2123
- * </xsd:complexType>
2124
- * ```
2125
- */
2126
- const createGlowEffect = (options) => {
2127
- if (options.radius === void 0) return new BuilderElement({
2128
- children: [createColorElement(options.color)],
2129
- name: "a:glow"
2130
- });
2131
- return new BuilderElement({
2132
- attributes: { rad: {
2133
- key: "rad",
2134
- value: options.radius
2135
- } },
2136
- children: [createColorElement(options.color)],
2137
- name: "a:glow"
2138
- });
2139
- };
2140
- //#endregion
2141
- //#region src/drawingml/effects/inner-shadow.ts
2142
- /**
2143
- * Inner shadow effect for DrawingML shapes.
2144
- *
2145
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_InnerShadowEffect
2146
- *
2147
- * @module
2148
- */
2149
- /**
2150
- * Creates an inner shadow effect element.
2151
- *
2152
- * ## XSD Schema
2153
- * ```xml
2154
- * <xsd:complexType name="CT_InnerShadowEffect">
2155
- * <xsd:sequence>
2156
- * <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
2157
- * </xsd:sequence>
2158
- * <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
2159
- * <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
2160
- * <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
2161
- * </xsd:complexType>
2162
- * ```
2163
- */
2164
- const createInnerShadowEffect = (options) => {
2165
- if (!(options.blurRadius !== void 0 || options.distance !== void 0 || options.direction !== void 0)) return new BuilderElement({
2166
- children: [createColorElement(options.color)],
2167
- name: "a:innerShdw"
2168
- });
2169
- return new BuilderElement({
2170
- attributes: {
2171
- ...options.blurRadius !== void 0 && { blurRad: {
2172
- key: "blurRad",
2173
- value: options.blurRadius
2174
- } },
2175
- ...options.distance !== void 0 && { dist: {
2176
- key: "dist",
2177
- value: options.distance
2178
- } },
2179
- ...options.direction !== void 0 && { dir: {
2180
- key: "dir",
2181
- value: options.direction
2182
- } }
2183
- },
2184
- children: [createColorElement(options.color)],
2185
- name: "a:innerShdw"
2186
- });
2187
- };
2188
- //#endregion
2189
- //#region src/drawingml/effects/outer-shadow.ts
2190
- /**
2191
- * Outer shadow effect for DrawingML shapes.
2192
- *
2193
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_OuterShadowEffect
2194
- *
2195
- * @module
2196
- */
2197
- /**
2198
- * Rectangle alignment for shadow positioning.
2199
- */
2200
- const RectAlignment = {
2201
- TOP_LEFT: "topLeft",
2202
- TOP: "top",
2203
- TOP_RIGHT: "topRight",
2204
- LEFT: "left",
2205
- CENTER: "center",
2206
- RIGHT: "right",
2207
- BOTTOM_LEFT: "bottomLeft",
2208
- BOTTOM: "bottom",
2209
- BOTTOM_RIGHT: "bottomRight"
2210
- };
2211
- /**
2212
- * Creates an outer shadow effect element.
2213
- *
2214
- * ## XSD Schema
2215
- * ```xml
2216
- * <xsd:complexType name="CT_OuterShadowEffect">
2217
- * <xsd:sequence>
2218
- * <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
2219
- * </xsd:sequence>
2220
- * <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
2221
- * <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
2222
- * <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
2223
- * <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
2224
- * <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
2225
- * <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
2226
- * <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
2227
- * <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
2228
- * <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
2229
- * </xsd:complexType>
2230
- * ```
2231
- */
2232
- const createOuterShadowEffect = (options) => {
2233
- const attributes = {};
2234
- if (options.blurRadius !== void 0) attributes.blurRad = {
2235
- key: "blurRad",
2236
- value: options.blurRadius
2237
- };
2238
- if (options.distance !== void 0) attributes.dist = {
2239
- key: "dist",
2240
- value: options.distance
2241
- };
2242
- if (options.direction !== void 0) attributes.dir = {
2243
- key: "dir",
2244
- value: options.direction
2245
- };
2246
- if (options.scaleX !== void 0) attributes.sx = {
2247
- key: "sx",
2248
- value: options.scaleX
2249
- };
2250
- if (options.scaleY !== void 0) attributes.sy = {
2251
- key: "sy",
2252
- value: options.scaleY
2253
- };
2254
- if (options.skewX !== void 0) attributes.kx = {
2255
- key: "kx",
2256
- value: options.skewX
2257
- };
2258
- if (options.skewY !== void 0) attributes.ky = {
2259
- key: "ky",
2260
- value: options.skewY
2261
- };
2262
- if (options.alignment !== void 0) attributes.algn = {
2263
- key: "algn",
2264
- value: xsdRectAlignment.to(options.alignment)
2265
- };
2266
- if (options.rotWithShape === false) attributes.rotWithShape = {
2267
- key: "rotWithShape",
2268
- value: 0
2269
- };
2270
- return new BuilderElement({
2271
- attributes,
2272
- children: [createColorElement(options.color)],
2273
- name: "a:outerShdw"
2274
- });
2275
- };
2276
- //#endregion
2277
- //#region src/drawingml/effects/preset-shadow.ts
2278
- /**
2279
- * Preset shadow effect for DrawingML shapes.
2280
- *
2281
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetShadowEffect
2282
- *
2283
- * @module
2284
- */
2285
- /**
2286
- * Preset shadow types (20 variations).
2287
- *
2288
- * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetShadowVal
2289
- */
2290
- const PresetShadowVal = {
2291
- SHDW1: "shadow1",
2292
- SHDW2: "shadow2",
2293
- SHDW3: "shadow3",
2294
- SHDW4: "shadow4",
2295
- SHDW5: "shadow5",
2296
- SHDW6: "shadow6",
2297
- SHDW7: "shadow7",
2298
- SHDW8: "shadow8",
2299
- SHDW9: "shadow9",
2300
- SHDW10: "shadow10",
2301
- SHDW11: "shadow11",
2302
- SHDW12: "shadow12",
2303
- SHDW13: "shadow13",
2304
- SHDW14: "shadow14",
2305
- SHDW15: "shadow15",
2306
- SHDW16: "shadow16",
2307
- SHDW17: "shadow17",
2308
- SHDW18: "shadow18",
2309
- SHDW19: "shadow19",
2310
- SHDW20: "shadow20"
2311
- };
2312
- /**
2313
- * Creates a preset shadow effect element.
2314
- *
2315
- * ## XSD Schema
2316
- * ```xml
2317
- * <xsd:complexType name="CT_PresetShadowEffect">
2318
- * <xsd:sequence>
2319
- * <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
2320
- * </xsd:sequence>
2321
- * <xsd:attribute name="prst" type="ST_PresetShadowVal" use="required"/>
2322
- * <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
2323
- * <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
2324
- * </xsd:complexType>
2325
- * ```
2326
- */
2327
- const createPresetShadowEffect = (options) => {
2328
- const attributes = { prst: {
2329
- key: "prst",
2330
- value: xsdPresetShadow.to(options.preset)
2331
- } };
2332
- if (options.distance !== void 0) attributes.dist = {
2333
- key: "dist",
2334
- value: options.distance
2335
- };
2336
- if (options.direction !== void 0) attributes.dir = {
2337
- key: "dir",
2338
- value: options.direction
2339
- };
2340
- return new BuilderElement({
2341
- attributes,
2342
- children: [createColorElement(options.color)],
2343
- name: "a:prstShdw"
2344
- });
2345
- };
2346
- //#endregion
2347
- //#region src/drawingml/effects/reflection.ts
2348
- /**
2349
- * Reflection effect for DrawingML shapes.
2350
- *
2351
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ReflectionEffect
2352
- *
2353
- * @module
2354
- */
2355
- /**
2356
- * Creates a reflection effect element.
2357
- *
2358
- * ## XSD Schema
2359
- * ```xml
2360
- * <xsd:complexType name="CT_ReflectionEffect">
2361
- * <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
2362
- * <xsd:attribute name="stA" type="ST_PositiveFixedPercentage" default="100%"/>
2363
- * <xsd:attribute name="stPos" type="ST_PositiveFixedPercentage" default="0%"/>
2364
- * <xsd:attribute name="endA" type="ST_PositiveFixedPercentage" default="0%"/>
2365
- * <xsd:attribute name="endPos" type="ST_PositiveFixedPercentage" default="100%"/>
2366
- * <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
2367
- * <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
2368
- * <xsd:attribute name="fadeDir" type="ST_PositiveFixedAngle" default="5400000"/>
2369
- * <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
2370
- * <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
2371
- * <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
2372
- * <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
2373
- * <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
2374
- * <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
2375
- * </xsd:complexType>
2376
- * ```
2377
- */
2378
- const createReflectionEffect = (options) => {
2379
- if (!options) return new BuilderElement({ name: "a:reflection" });
2380
- const attributes = {};
2381
- if (options.blurRadius !== void 0) attributes.blurRad = {
2382
- key: "blurRad",
2383
- value: options.blurRadius
2384
- };
2385
- if (options.startAlpha !== void 0) attributes.stA = {
2386
- key: "stA",
2387
- value: options.startAlpha
2388
- };
2389
- if (options.startPosition !== void 0) attributes.stPos = {
2390
- key: "stPos",
2391
- value: options.startPosition
2392
- };
2393
- if (options.endAlpha !== void 0) attributes.endA = {
2394
- key: "endA",
2395
- value: options.endAlpha
2396
- };
2397
- if (options.endPosition !== void 0) attributes.endPos = {
2398
- key: "endPos",
2399
- value: options.endPosition
2400
- };
2401
- if (options.distance !== void 0) attributes.dist = {
2402
- key: "dist",
2403
- value: options.distance
2404
- };
2405
- if (options.direction !== void 0) attributes.dir = {
2406
- key: "dir",
2407
- value: options.direction
2408
- };
2409
- if (options.fadeDirection !== void 0) attributes.fadeDir = {
2410
- key: "fadeDir",
2411
- value: options.fadeDirection
2412
- };
2413
- if (options.scaleX !== void 0) attributes.sx = {
2414
- key: "sx",
2415
- value: options.scaleX
2416
- };
2417
- if (options.scaleY !== void 0) attributes.sy = {
2418
- key: "sy",
2419
- value: options.scaleY
2420
- };
2421
- if (options.skewX !== void 0) attributes.kx = {
2422
- key: "kx",
2423
- value: options.skewX
2424
- };
2425
- if (options.skewY !== void 0) attributes.ky = {
2426
- key: "ky",
2427
- value: options.skewY
2428
- };
2429
- if (options.alignment !== void 0) attributes.algn = {
2430
- key: "algn",
2431
- value: xsdRectAlignment.to(options.alignment)
2432
- };
2433
- if (options.rotWithShape === false) attributes.rotWithShape = {
2434
- key: "rotWithShape",
2435
- value: 0
2436
- };
2437
- return new BuilderElement({
2438
- attributes,
2439
- name: "a:reflection"
2440
- });
2441
- };
2442
- //#endregion
2443
- //#region src/drawingml/effects/soft-edge.ts
2444
- /**
2445
- * Soft edge effect for DrawingML shapes.
2446
- *
2447
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SoftEdgesEffect
2448
- *
2449
- * @module
2450
- */
2451
- /**
2452
- * Creates a soft edge effect element.
2453
- *
2454
- * ## XSD Schema
2455
- * ```xml
2456
- * <xsd:complexType name="CT_SoftEdgesEffect">
2457
- * <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="required"/>
2458
- * </xsd:complexType>
2459
- * ```
2460
- *
2461
- * @param rad - Soft edge radius in EMUs (required)
2462
- */
2463
- const createSoftEdgeEffect = (rad) => new BuilderElement({
2464
- attributes: { rad: {
2465
- key: "rad",
2466
- value: rad
2467
- } },
2468
- name: "a:softEdge"
2469
- });
2470
- //#endregion
2471
- //#region src/drawingml/effects/effect-list.ts
2472
- /**
2473
- * Effect list container for DrawingML shapes.
2474
- *
2475
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectList, EG_EffectProperties
2476
- *
2477
- * @module
2478
- */
2479
- /**
2480
- * Creates a blur effect element.
2481
- *
2482
- * ## XSD Schema
2483
- * ```xml
2484
- * <xsd:complexType name="CT_BlurEffect">
2485
- * <xsd:attribute name="rad" type="ST_PositiveCoordinate" default="0"/>
2486
- * <xsd:attribute name="grow" type="xsd:boolean" default="true"/>
2487
- * </xsd:complexType>
2488
- * ```
2489
- */
2490
- const createBlurEffect$1 = (options) => {
2491
- if (!(options.radius !== void 0 || options.grow === false)) return new BuilderElement({ name: "a:blur" });
2492
- return new BuilderElement({
2493
- attributes: {
2494
- ...options.radius !== void 0 && { rad: {
2495
- key: "rad",
2496
- value: options.radius
2497
- } },
2498
- ...options.grow === false && { grow: {
2499
- key: "grow",
2500
- value: 0
2501
- } }
2502
- },
2503
- name: "a:blur"
2504
- });
2505
- };
2506
- /**
2507
- * Creates an effect list element (a:effectLst).
2508
- *
2509
- * This is the EG_EffectProperties choice for a flat list of effects.
2510
- * Effects are emitted in XSD order: blur, glow, innerShdw, outerShdw, prstShdw, reflection, softEdge.
2511
- *
2512
- * ## XSD Schema
2513
- * ```xml
2514
- * <xsd:complexType name="CT_EffectList">
2515
- * <xsd:sequence>
2516
- * <xsd:element name="blur" type="CT_BlurEffect" minOccurs="0"/>
2517
- * <xsd:element name="fillOverlay" type="CT_FillOverlayEffect" minOccurs="0"/>
2518
- * <xsd:element name="glow" type="CT_GlowEffect" minOccurs="0"/>
2519
- * <xsd:element name="innerShdw" type="CT_InnerShadowEffect" minOccurs="0"/>
2520
- * <xsd:element name="outerShdw" type="CT_OuterShadowEffect" minOccurs="0"/>
2521
- * <xsd:element name="prstShdw" type="CT_PresetShadowEffect" minOccurs="0"/>
2522
- * <xsd:element name="reflection" type="CT_ReflectionEffect" minOccurs="0"/>
2523
- * <xsd:element name="softEdge" type="CT_SoftEdgesEffect" minOccurs="0"/>
2524
- * </xsd:sequence>
2525
- * </xsd:complexType>
2526
- * ```
2527
- */
2528
- const createEffectList = (options) => {
2529
- const children = [];
2530
- if (options.blur) children.push(createBlurEffect$1(options.blur));
2531
- if (options.fillOverlay) children.push(createFillOverlayEffect(options.fillOverlay));
2532
- if (options.glow) children.push(createGlowEffect(options.glow));
2533
- if (options.innerShadow) children.push(createInnerShadowEffect(options.innerShadow));
2534
- if (options.outerShadow) children.push(createOuterShadowEffect(options.outerShadow));
2535
- if (options.presetShadow) children.push(createPresetShadowEffect(options.presetShadow));
2536
- if (options.reflection) children.push(createReflectionEffect(options.reflection === true ? void 0 : options.reflection));
2537
- if (options.softEdge !== void 0) children.push(createSoftEdgeEffect(options.softEdge));
2538
- return new BuilderElement({
2539
- children,
2540
- name: "a:effectLst"
2541
- });
2542
- };
2543
- //#endregion
2544
- //#region src/drawingml/effects/effect-dag.ts
2545
- /**
2546
- * Effect container (effectDag) for DrawingML shapes.
2547
- *
2548
- * Provides CT_EffectContainer — a directed acyclic graph (DAG) of effects
2549
- * supporting 28 effect types including alpha/color operations, nested containers,
2550
- * and all effects from CT_EffectList.
2551
- *
2552
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectContainer, EG_Effect
2553
- *
2554
- * @module
2555
- */
2556
- const buildOptionalAttributes = (options) => {
2557
- const attrs = {};
2558
- for (const [key, value] of Object.entries(options)) if (value !== void 0) attrs[key] = {
2559
- key,
2560
- value
2561
- };
2562
- return Object.keys(attrs).length > 0 ? attrs : void 0;
2563
- };
2564
- const createAlphaBiLevelEffect = (options) => new BuilderElement({
2565
- name: "a:alphaBiLevel",
2566
- attributes: { thresh: {
2567
- key: "thresh",
2568
- value: options.threshold
2569
- } }
2570
- });
2571
- const createAlphaCeilingEffect = () => new BuilderElement({ name: "a:alphaCeiling" });
2572
- const createAlphaFloorEffect = () => new BuilderElement({ name: "a:alphaFloor" });
2573
- const createAlphaInverseEffect = (options) => new BuilderElement({
2574
- name: "a:alphaInv",
2575
- children: options?.color ? [createColorElement(options.color)] : void 0
2576
- });
2577
- const createAlphaModulateFixedEffect = (options) => {
2578
- if (options?.amount === void 0) return new BuilderElement({ name: "a:alphaModFix" });
2579
- return new BuilderElement({
2580
- name: "a:alphaModFix",
2581
- attributes: { amt: {
2582
- key: "amt",
2583
- value: options.amount
2584
- } }
2585
- });
2586
- };
2587
- const createAlphaOutsetEffect = (options) => {
2588
- if (options?.radius === void 0) return new BuilderElement({ name: "a:alphaOutset" });
2589
- return new BuilderElement({
2590
- name: "a:alphaOutset",
2591
- attributes: { rad: {
2592
- key: "rad",
2593
- value: options.radius
2594
- } }
2595
- });
2596
- };
2597
- const createAlphaReplaceEffect = (options) => new BuilderElement({
2598
- name: "a:alphaRepl",
2599
- attributes: { a: {
2600
- key: "a",
2601
- value: options.alpha
2602
- } }
2603
- });
2604
- const createBiLevelEffect = (thresh) => new BuilderElement({
2605
- name: "a:biLevel",
2606
- attributes: { thresh: {
2607
- key: "thresh",
2608
- value: thresh
2609
- } }
2610
- });
2611
- const createBlendEffect = (options) => new BuilderElement({
2612
- name: "a:blend",
2613
- attributes: { blend: {
2614
- key: "blend",
2615
- value: xsdBlendMode.to(options.blend)
2616
- } },
2617
- children: [createEffectContainer(options.container)]
2618
- });
2619
- const createColorChangeEffect = (options) => {
2620
- const children = [new BuilderElement({
2621
- name: "a:clrFrom",
2622
- children: [createColorElement(options.from)]
2623
- }), new BuilderElement({
2624
- name: "a:clrTo",
2625
- children: [createColorElement(options.to)]
2626
- })];
2627
- if (options.useA === false) return new BuilderElement({
2628
- name: "a:clrChange",
2629
- attributes: { useA: {
2630
- key: "useA",
2631
- value: 0
2632
- } },
2633
- children
2634
- });
2635
- return new BuilderElement({
2636
- name: "a:clrChange",
2637
- children
2638
- });
2639
- };
2640
- const createColorReplaceEffect = (color) => new BuilderElement({
2641
- name: "a:clrRepl",
2642
- children: [createColorElement(color)]
2643
- });
2644
- const createDuotoneEffect = (options) => new BuilderElement({
2645
- name: "a:duotone",
2646
- children: [createColorElement(options.color1), createColorElement(options.color2)]
2647
- });
2648
- const createFillEffect = (options) => {
2649
- let fillElement;
2650
- if (options.noFill) fillElement = createNoFill();
2651
- else if (options.solidFill) fillElement = createSolidFill(options.solidFill);
2652
- else if (options.gradientFill) fillElement = createGradientFill(options.gradientFill);
2653
- else if (options.patternFill) fillElement = createPatternFill(options.patternFill);
2654
- else if (options.groupFill) fillElement = createGroupFill();
2655
- else fillElement = createNoFill();
2656
- return new BuilderElement({
2657
- name: "a:fill",
2658
- children: [fillElement]
2659
- });
2660
- };
2661
- const createGrayscaleEffect = () => new BuilderElement({ name: "a:grayscl" });
2662
- const createHSLEffect = (options) => {
2663
- return new BuilderElement({
2664
- name: "a:hsl",
2665
- attributes: buildOptionalAttributes({
2666
- hue: options?.hue,
2667
- sat: options?.saturation,
2668
- lum: options?.luminance
2669
- })
2670
- });
2671
- };
2672
- const createLuminanceEffect = (options) => {
2673
- return new BuilderElement({
2674
- name: "a:lum",
2675
- attributes: buildOptionalAttributes({
2676
- bright: options?.bright,
2677
- contrast: options?.contrast
2678
- })
2679
- });
2680
- };
2681
- const createTintEffect = (options) => {
2682
- return new BuilderElement({
2683
- name: "a:tint",
2684
- attributes: buildOptionalAttributes({
2685
- hue: options?.hue,
2686
- amt: options?.amount
2687
- })
2688
- });
2689
- };
2690
- const createRelativeOffsetEffect = (options) => {
2691
- return new BuilderElement({
2692
- name: "a:relOff",
2693
- attributes: buildOptionalAttributes({
2694
- tx: options?.translateX,
2695
- ty: options?.translateY
2696
- })
2697
- });
2698
- };
2699
- const createTransformEffect = (options) => {
2700
- return new BuilderElement({
2701
- name: "a:xfrm",
2702
- attributes: buildOptionalAttributes({
2703
- sx: options?.scaleX,
2704
- sy: options?.scaleY,
2705
- kx: options?.skewX,
2706
- ky: options?.skewY,
2707
- tx: options?.translateX,
2708
- ty: options?.translateY
2709
- })
2710
- });
2711
- };
2712
- const createEffectReference = (options) => new BuilderElement({
2713
- name: "a:effect",
2714
- attributes: { ref: {
2715
- key: "ref",
2716
- value: options.ref
2717
- } }
2718
- });
2719
- const createBlurEffect = (options) => {
2720
- if (!(options.radius !== void 0 || options.grow === false)) return new BuilderElement({ name: "a:blur" });
2721
- return new BuilderElement({
2722
- attributes: {
2723
- ...options.radius !== void 0 && { rad: {
2724
- key: "rad",
2725
- value: options.radius
2726
- } },
2727
- ...options.grow === false && { grow: {
2728
- key: "grow",
2729
- value: 0
2730
- } }
2731
- },
2732
- name: "a:blur"
2733
- });
2734
- };
2735
- /**
2736
- * Creates an effect container element (a:effectDag or a:cont).
2737
- *
2738
- * This is the CT_EffectContainer type — a recursive DAG of effects.
2739
- * All 28 EG_Effect types are supported.
2740
- *
2741
- * ## XSD Schema
2742
- * ```xml
2743
- * <xsd:complexType name="CT_EffectContainer">
2744
- * <xsd:group ref="EG_Effect" minOccurs="0" maxOccurs="unbounded"/>
2745
- * <xsd:attribute name="type" type="ST_EffectContainerType" default="sib"/>
2746
- * <xsd:attribute name="name" type="xsd:token" use="optional"/>
2747
- * </xsd:complexType>
2748
- * ```
2749
- *
2750
- * @param options - Container options with effects
2751
- * @param elementName - Element name, defaults to "a:effectDag" for top-level
2752
- */
2753
- const createEffectContainer = (options, elementName = "a:cont") => {
2754
- const attrs = buildOptionalAttributes({
2755
- type: options.type ? xsdEffectContainer.to(options.type) : void 0,
2756
- name: options.name
2757
- });
2758
- const children = [];
2759
- if (options.blur) children.push(createBlurEffect(options.blur));
2760
- if (options.fillOverlay) children.push(createFillOverlayEffect(options.fillOverlay));
2761
- if (options.glow) children.push(createGlowEffect(options.glow));
2762
- if (options.innerShadow) children.push(createInnerShadowEffect(options.innerShadow));
2763
- if (options.outerShadow) children.push(createOuterShadowEffect(options.outerShadow));
2764
- if (options.presetShadow) children.push(createPresetShadowEffect(options.presetShadow));
2765
- if (options.reflection) children.push(createReflectionEffect(options.reflection === true ? void 0 : options.reflection));
2766
- if (options.softEdge !== void 0) children.push(createSoftEdgeEffect(options.softEdge));
2767
- if (options.containers) for (const nested of options.containers) children.push(createEffectContainer(nested));
2768
- if (options.effectRefs) for (const ref of options.effectRefs) children.push(createEffectReference(ref));
2769
- if (options.alphaBiLevel) children.push(createAlphaBiLevelEffect(options.alphaBiLevel));
2770
- if (options.alphaCeiling) children.push(createAlphaCeilingEffect());
2771
- if (options.alphaFloor) children.push(createAlphaFloorEffect());
2772
- if (options.alphaInverse) children.push(createAlphaInverseEffect(options.alphaInverse));
2773
- if (options.alphaModulate) children.push(new BuilderElement({
2774
- name: "a:alphaMod",
2775
- children: [createEffectContainer(options.alphaModulate)]
2776
- }));
2777
- if (options.alphaModulateFixed) children.push(createAlphaModulateFixedEffect(options.alphaModulateFixed));
2778
- if (options.alphaOutset) children.push(createAlphaOutsetEffect(options.alphaOutset));
2779
- if (options.alphaReplace) children.push(createAlphaReplaceEffect(options.alphaReplace));
2780
- if (options.biLevel) children.push(createBiLevelEffect(options.biLevel.threshold));
2781
- if (options.blend) children.push(createBlendEffect(options.blend));
2782
- if (options.colorChange) children.push(createColorChangeEffect(options.colorChange));
2783
- if (options.colorReplace) children.push(createColorReplaceEffect(options.colorReplace));
2784
- if (options.duotone) children.push(createDuotoneEffect(options.duotone));
2785
- if (options.fill) children.push(createFillEffect(options.fill));
2786
- if (options.grayscale) children.push(createGrayscaleEffect());
2787
- if (options.hsl) children.push(createHSLEffect(options.hsl));
2788
- if (options.luminance) children.push(createLuminanceEffect(options.luminance));
2789
- if (options.tint) children.push(createTintEffect(options.tint));
2790
- if (options.relativeOffset) children.push(createRelativeOffsetEffect(options.relativeOffset));
2791
- if (options.transform) children.push(createTransformEffect(options.transform));
2792
- return new BuilderElement({
2793
- name: elementName,
2794
- attributes: attrs,
2795
- children: children.length > 0 ? children : void 0
2796
- });
2797
- };
2798
- /**
2799
- * Creates an effect DAG element (a:effectDag).
2800
- *
2801
- * This is the EG_EffectProperties choice alternative to effectLst,
2802
- * supporting all 28 effect types with recursive nesting.
2803
- *
2804
- * @example
2805
- * ```typescript
2806
- * // Simple effect DAG with glow and outer shadow
2807
- * createEffectDag({
2808
- * glow: { radius: 50800, color: { value: "FF0000" } },
2809
- * outerShadow: { color: { value: "000000" }, blurRadius: 76200 },
2810
- * });
2811
- *
2812
- * // DAG with alpha effects and nested container
2813
- * createEffectDag({
2814
- * type: "tree",
2815
- * alphaBiLevel: { threshold: 50000 },
2816
- * containers: [{
2817
- * glow: { color: { value: "FF0000" } },
2818
- * }],
2819
- * });
2820
- * ```
2821
- */
2822
- const createEffectDag = (options) => createEffectContainer(options, "a:effectDag");
2823
- //#endregion
2824
- //#region src/drawingml/three-d/scene-3d.ts
2825
- /**
2826
- * 3D scene module for DrawingML shapes.
2827
- *
2828
- * Provides CT_Scene3D — the 3D scene properties including camera, light rig,
2829
- * and optional backdrop that define how a 3D shape is rendered.
2830
- *
2831
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Scene3D
2832
- *
2833
- * @module
2834
- */
2835
- const createSphereCoords = (coords) => new BuilderElement({
2836
- name: "a:rot",
2837
- attributes: {
2838
- lat: {
2839
- key: "lat",
2840
- value: coords.lat
2841
- },
2842
- lon: {
2843
- key: "lon",
2844
- value: coords.lon
2845
- },
2846
- rev: {
2847
- key: "rev",
2848
- value: coords.rev
2849
- }
2850
- }
2851
- });
2852
- const createCamera = (options) => {
2853
- const children = [];
2854
- if (options.rotation) children.push(createSphereCoords(options.rotation));
2855
- const attrs = { prst: {
2856
- key: "prst",
2857
- value: options.preset
2858
- } };
2859
- if (options.fov !== void 0) attrs.fov = {
2860
- key: "fov",
2861
- value: options.fov
2862
- };
2863
- if (options.zoom !== void 0) attrs.zoom = {
2864
- key: "zoom",
2865
- value: options.zoom
2866
- };
2867
- return new BuilderElement({
2868
- name: "a:camera",
2869
- attributes: attrs,
2870
- children: children.length > 0 ? children : void 0
2871
- });
2872
- };
2873
- const createLightRig = (options) => {
2874
- const children = [];
2875
- if (options.rotation) children.push(createSphereCoords(options.rotation));
2876
- return new BuilderElement({
2877
- name: "a:lightRig",
2878
- attributes: {
2879
- rig: {
2880
- key: "rig",
2881
- value: options.rig
2882
- },
2883
- dir: {
2884
- key: "dir",
2885
- value: options.direction
2886
- }
2887
- },
2888
- children: children.length > 0 ? children : void 0
2889
- });
2890
- };
2891
- const createPoint3D = (name, point) => new BuilderElement({
2892
- name,
2893
- attributes: {
2894
- x: {
2895
- key: "x",
2896
- value: point.x
2897
- },
2898
- y: {
2899
- key: "y",
2900
- value: point.y
2901
- },
2902
- z: {
2903
- key: "z",
2904
- value: point.z
2905
- }
2906
- }
2907
- });
2908
- const createVector3D = (name, vector) => new BuilderElement({
2909
- name,
2910
- attributes: {
2911
- dx: {
2912
- key: "dx",
2913
- value: vector.dx
2914
- },
2915
- dy: {
2916
- key: "dy",
2917
- value: vector.dy
2918
- },
2919
- dz: {
2920
- key: "dz",
2921
- value: vector.dz
2922
- }
2923
- }
2924
- });
2925
- const createBackdrop = (options) => new BuilderElement({
2926
- name: "a:backdrop",
2927
- children: [
2928
- createPoint3D("a:anchor", options.anchor),
2929
- createVector3D("a:norm", options.normal),
2930
- createVector3D("a:up", options.up)
2931
- ]
2932
- });
2933
- /**
2934
- * Creates a 3D scene element (a:scene3d).
2935
- *
2936
- * @example
2937
- * ```typescript
2938
- * // Simple scene with default camera and lighting
2939
- * createScene3D({
2940
- * camera: { preset: "perspectiveFront" },
2941
- * lightRig: { rig: "threePt", direction: "t" },
2942
- * });
2943
- *
2944
- * // Scene with rotated camera and backdrop
2945
- * createScene3D({
2946
- * camera: {
2947
- * preset: "isometricTopUp",
2948
- * rotation: { lat: 0, lon: 0, rev: 5400000 },
2949
- * },
2950
- * lightRig: { rig: "balanced", direction: "tl" },
2951
- * backdrop: {
2952
- * anchor: { x: 0, y: 0, z: 0 },
2953
- * normal: { dx: 0, dy: 0, dz: 1 },
2954
- * up: { dx: 0, dy: 1, dz: 0 },
2955
- * },
2956
- * });
2957
- * ```
2958
- */
2959
- const createScene3D = (options) => {
2960
- const children = [createCamera(options.camera), createLightRig(options.lightRig)];
2961
- if (options.backdrop) children.push(createBackdrop(options.backdrop));
2962
- return new BuilderElement({
2963
- name: "a:scene3d",
2964
- children
2965
- });
2966
- };
2967
- //#endregion
2968
- //#region src/drawingml/three-d/bevel.ts
2969
- /**
2970
- * Bevel element for DrawingML 3D shapes.
2971
- *
2972
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Bevel
2973
- *
2974
- * @module
2975
- */
2976
- /**
2977
- * Bevel preset types (12 variations).
2978
- *
2979
- * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_BevelPresetType
2980
- */
2981
- const BevelPresetType = {
2982
- RELAXED_INSET: "relaxedInset",
2983
- CIRCLE: "circle",
2984
- SLOPE: "slope",
2985
- CROSS: "cross",
2986
- ANGLE: "angle",
2987
- SOFT_ROUND: "softRound",
2988
- CONVEX: "convex",
2989
- COOL_SLANT: "coolSlant",
2990
- DIVOT: "divot",
2991
- RIBLET: "riblet",
2992
- HARD_EDGE: "hardEdge",
2993
- ART_DECO: "artDeco"
2994
- };
2995
- /**
2996
- * Creates a bevel element.
2997
- *
2998
- * ## XSD Schema
2999
- * ```xml
3000
- * <xsd:complexType name="CT_Bevel">
3001
- * <xsd:attribute name="w" type="ST_PositiveCoordinate" default="76200"/>
3002
- * <xsd:attribute name="h" type="ST_PositiveCoordinate" default="76200"/>
3003
- * <xsd:attribute name="prst" type="ST_BevelPresetType" default="circle"/>
3004
- * </xsd:complexType>
3005
- * ```
3006
- */
3007
- const createBevel = (options) => {
3008
- if (!options) return new BuilderElement({ name: "a:bevelT" });
3009
- const attributes = {};
3010
- if (options.w !== void 0) attributes.w = {
3011
- key: "w",
3012
- value: options.w
3013
- };
3014
- if (options.h !== void 0) attributes.h = {
3015
- key: "h",
3016
- value: options.h
3017
- };
3018
- if (options.prst !== void 0) attributes.prst = {
3019
- key: "prst",
3020
- value: options.prst
3021
- };
3022
- return new BuilderElement({
3023
- attributes,
3024
- name: "a:bevelT"
3025
- });
3026
- };
3027
- /**
3028
- * Creates a bottom bevel element (a:bevelB).
3029
- */
3030
- const createBottomBevel = (options) => {
3031
- if (!options) return new BuilderElement({ name: "a:bevelB" });
3032
- const attributes = {};
3033
- if (options.w !== void 0) attributes.w = {
3034
- key: "w",
3035
- value: options.w
3036
- };
3037
- if (options.h !== void 0) attributes.h = {
3038
- key: "h",
3039
- value: options.h
3040
- };
3041
- if (options.prst !== void 0) attributes.prst = {
3042
- key: "prst",
3043
- value: options.prst
3044
- };
3045
- return new BuilderElement({
3046
- attributes,
3047
- name: "a:bevelB"
3048
- });
3049
- };
3050
- //#endregion
3051
- //#region src/drawingml/three-d/shape-3d.ts
3052
- /**
3053
- * 3D shape properties for DrawingML.
3054
- *
3055
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Shape3D
3056
- *
3057
- * @module
3058
- */
3059
- /**
3060
- * Preset material types for 3D shapes (15 variations).
3061
- *
3062
- * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetMaterialType
3063
- */
3064
- const PresetMaterialType = {
3065
- LEGACY_MATTE: "legacyMatte",
3066
- LEGACY_PLASTIC: "legacyPlastic",
3067
- LEGACY_METAL: "legacyMetal",
3068
- LEGACY_WIREFRAME: "legacyWireframe",
3069
- MATTE: "matte",
3070
- PLASTIC: "plastic",
3071
- METAL: "metal",
3072
- WARM_MATTE: "warmMatte",
3073
- TRANSLUCENT_POWDER: "translucentPowder",
3074
- POWDER: "powder",
3075
- DK_EDGE: "darkEdge",
3076
- SOFT_EDGE: "softEdge",
3077
- CLEAR: "clear",
3078
- FLAT: "flat",
3079
- SOFT_METAL: "softMetal"
3080
- };
3081
- /**
3082
- * Creates a 3D shape properties element (a:sp3d).
3083
- *
3084
- * ## XSD Schema
3085
- * ```xml
3086
- * <xsd:complexType name="CT_Shape3D">
3087
- * <xsd:sequence>
3088
- * <xsd:element name="bevelT" type="CT_Bevel" minOccurs="0"/>
3089
- * <xsd:element name="bevelB" type="CT_Bevel" minOccurs="0"/>
3090
- * <xsd:element name="extrusionClr" type="CT_Color" minOccurs="0"/>
3091
- * <xsd:element name="contourClr" type="CT_Color" minOccurs="0"/>
3092
- * </xsd:sequence>
3093
- * <xsd:attribute name="z" type="ST_Coordinate" default="0"/>
3094
- * <xsd:attribute name="extrusionH" type="ST_PositiveCoordinate" default="0"/>
3095
- * <xsd:attribute name="contourW" type="ST_PositiveCoordinate" default="0"/>
3096
- * <xsd:attribute name="prstMaterial" type="ST_PresetMaterialType" default="warmMatte"/>
3097
- * </xsd:complexType>
3098
- * ```
3099
- */
3100
- const createShape3D = (options) => {
3101
- const children = [];
3102
- if (options.bevelT) children.push(createBevel(options.bevelT));
3103
- if (options.bevelB) children.push(createBottomBevel(options.bevelB));
3104
- if (options.extrusionColor) children.push(new BuilderElement({
3105
- children: [createColorElement(options.extrusionColor)],
3106
- name: "a:extrusionClr"
3107
- }));
3108
- if (options.contourColor) children.push(new BuilderElement({
3109
- children: [createColorElement(options.contourColor)],
3110
- name: "a:contourClr"
3111
- }));
3112
- return new BuilderElement({
3113
- attributes: options.z !== void 0 || options.extrusionH !== void 0 || options.contourW !== void 0 || options.prstMaterial !== void 0 ? {
3114
- ...options.z !== void 0 && { z: {
3115
- key: "z",
3116
- value: options.z
3117
- } },
3118
- ...options.extrusionH !== void 0 && { extrusionH: {
3119
- key: "extrusionH",
3120
- value: options.extrusionH
3121
- } },
3122
- ...options.contourW !== void 0 && { contourW: {
3123
- key: "contourW",
3124
- value: options.contourW
3125
- } },
3126
- ...options.prstMaterial !== void 0 && { prstMaterial: {
3127
- key: "prstMaterial",
3128
- value: xsdMaterialType.to(options.prstMaterial)
3129
- } }
3130
- } : void 0,
3131
- children,
3132
- name: "a:sp3d"
3133
- });
3134
- };
3135
- //#endregion
3136
- //#region src/drawingml/geometry/adjustment-values.ts
3137
- /**
3138
- * Adjustment values module for preset geometries.
3139
- *
3140
- * This module provides adjustment value lists that can modify the appearance
3141
- * of preset shape geometries.
3142
- *
3143
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GeomGuideList, CT_GeomGuide
3144
- *
3145
- * @module
3146
- */
3147
- /**
3148
- * Creates an adjustment values list element (a:avLst).
3149
- *
3150
- * The adjustment values list contains geometry guides that modify
3151
- * the appearance of a preset geometric shape. When empty, default
3152
- * values are used.
3153
- *
3154
- * ## XSD Schema
3155
- * ```xml
3156
- * <xsd:complexType name="CT_GeomGuideList">
3157
- * <xsd:sequence>
3158
- * <xsd:element name="gd" type="CT_GeomGuide" minOccurs="0" maxOccurs="unbounded"/>
3159
- * </xsd:sequence>
3160
- * </xsd:complexType>
3161
- * ```
3162
- *
3163
- * @example
3164
- * ```typescript
3165
- * // Empty adjustment values (defaults)
3166
- * createAdjustmentValues();
3167
- *
3168
- * // With guides
3169
- * createAdjustmentValues([
3170
- * { name: "adj", formula: "val 16667" },
3171
- * ]);
3172
- * ```
3173
- */
3174
- const createAdjustmentValues = (guides) => {
3175
- const children = [];
3176
- if (guides) for (const guide of guides) children.push(new BuilderElement({
3177
- attributes: {
3178
- name: {
3179
- key: "name",
3180
- value: guide.name
3181
- },
3182
- fmla: {
3183
- key: "fmla",
3184
- value: guide.formula
3185
- }
3186
- },
3187
- name: "a:gd"
3188
- }));
3189
- return new BuilderElement({
3190
- children,
3191
- name: "a:avLst"
3192
- });
3193
- };
3194
- //#endregion
3195
- //#region src/drawingml/geometry/preset-geometry.ts
3196
- /**
3197
- * Preset geometry module for DrawingML shapes.
3198
- *
3199
- * This module provides predefined shape geometries that can be applied
3200
- * to pictures and shapes without requiring custom path definitions.
3201
- *
3202
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetGeometry2D
3203
- *
3204
- * @module
3205
- */
3206
- /**
3207
- * Represents a preset geometry for a DrawingML shape.
3208
- *
3209
- * This element specifies when a preset geometric shape should be used instead
3210
- * of a custom geometry. It includes a shape preset identifier and optional
3211
- * adjustment values that modify the base shape.
3212
- *
3213
- * ## XSD Schema
3214
- * ```xml
3215
- * <xsd:complexType name="CT_PresetGeometry2D">
3216
- * <xsd:sequence>
3217
- * <xsd:element name="avLst" type="CT_GeomGuideList" minOccurs="0" maxOccurs="1"/>
3218
- * </xsd:sequence>
3219
- * <xsd:attribute name="prst" type="ST_ShapeType" use="required"/>
3220
- * </xsd:complexType>
3221
- * ```
3222
- *
3223
- * @example
3224
- * ```typescript
3225
- * // Default rectangle
3226
- * const geometry = new PresetGeometry();
3227
- *
3228
- * // Rounded rectangle with adjustment
3229
- * const geometry = new PresetGeometry({
3230
- * preset: "roundRect",
3231
- * adjustmentValues: [{ name: "adj", formula: "val 16667" }],
3232
- * });
3233
- * ```
3234
- */
3235
- var PresetGeometry = class extends XmlComponent {
3236
- constructor(options) {
3237
- super("a:prstGeom");
3238
- this.root.push({ _attr: { prst: options?.preset ?? "rect" } });
3239
- this.root.push(createAdjustmentValues(options?.adjustmentValues));
3240
- }
3241
- };
3242
- //#endregion
3243
- //#region src/drawingml/geometry/custom-geometry.ts
3244
- /**
3245
- * Custom geometry module for DrawingML shapes.
3246
- *
3247
- * Provides CT_CustomGeometry2D — user-defined 2D geometry with paths,
3248
- * guides, adjust handles, connection sites, and a text insertion rectangle.
3249
- *
3250
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_CustomGeometry2D
3251
- *
3252
- * @module
3253
- */
3254
- /**
3255
- * Creates a geometry guide list element (a:avLst or a:gdLst).
3256
- *
3257
- * Both CT_GeomGuideList types share the same structure — a list of `a:gd` children.
3258
- * The only difference is the wrapper element name.
3259
- */
3260
- const createGuideList = (name, guides) => {
3261
- return new BuilderElement({
3262
- name,
3263
- children: guides.map((guide) => new BuilderElement({
3264
- attributes: {
3265
- name: {
3266
- key: "name",
3267
- value: guide.name
3268
- },
3269
- fmla: {
3270
- key: "fmla",
3271
- value: guide.formula
3272
- }
3273
- },
3274
- name: "a:gd"
3275
- }))
3276
- });
3277
- };
3278
- const createAdjPoint = (name, point) => new BuilderElement({
3279
- name,
3280
- children: [new BuilderElement({
3281
- name: "a:pt",
3282
- attributes: {
3283
- x: {
3284
- key: "x",
3285
- value: point.x
3286
- },
3287
- y: {
3288
- key: "y",
3289
- value: point.y
3290
- }
3291
- }
3292
- })]
3293
- });
3294
- const createPathCommand = (cmd) => {
3295
- switch (cmd.command) {
3296
- case "moveTo": return createAdjPoint("a:moveTo", cmd.point);
3297
- case "lineTo": return createAdjPoint("a:lnTo", cmd.point);
3298
- case "arcTo": return new BuilderElement({
3299
- name: "a:arcTo",
3300
- attributes: {
3301
- wR: {
3302
- key: "wR",
3303
- value: cmd.widthRadius
3304
- },
3305
- hR: {
3306
- key: "hR",
3307
- value: cmd.heightRadius
3308
- },
3309
- stAng: {
3310
- key: "stAng",
3311
- value: cmd.startAngle
3312
- },
3313
- swAng: {
3314
- key: "swAng",
3315
- value: cmd.sweepAngle
3316
- }
3317
- }
3318
- });
3319
- case "quadBezTo": return new BuilderElement({
3320
- name: "a:quadBezTo",
3321
- children: cmd.points.map((pt) => new BuilderElement({
3322
- name: "a:pt",
3323
- attributes: {
3324
- x: {
3325
- key: "x",
3326
- value: pt.x
3327
- },
3328
- y: {
3329
- key: "y",
3330
- value: pt.y
3331
- }
3332
- }
3333
- }))
3334
- });
3335
- case "cubicBezTo": return new BuilderElement({
3336
- name: "a:cubicBezTo",
3337
- children: cmd.points.map((pt) => new BuilderElement({
3338
- name: "a:pt",
3339
- attributes: {
3340
- x: {
3341
- key: "x",
3342
- value: pt.x
3343
- },
3344
- y: {
3345
- key: "y",
3346
- value: pt.y
3347
- }
3348
- }
3349
- }))
3350
- });
3351
- case "close": return new BuilderElement({ name: "a:close" });
3352
- }
3353
- };
3354
- const createPath = (options) => {
3355
- const attrs = {};
3356
- if (options.w !== void 0) attrs.w = {
3357
- key: "w",
3358
- value: options.w
3359
- };
3360
- if (options.h !== void 0) attrs.h = {
3361
- key: "h",
3362
- value: options.h
3363
- };
3364
- if (options.fill !== void 0) attrs.fill = {
3365
- key: "fill",
3366
- value: xsdPathFillMode.to(options.fill)
3367
- };
3368
- if (options.stroke !== void 0) attrs.stroke = {
3369
- key: "stroke",
3370
- value: options.stroke
3371
- };
3372
- if (options.extrusionOk !== void 0) attrs.extrusionOk = {
3373
- key: "extrusionOk",
3374
- value: options.extrusionOk
3375
- };
3376
- return new BuilderElement({
3377
- name: "a:path",
3378
- attributes: Object.keys(attrs).length > 0 ? attrs : void 0,
3379
- children: options.commands.map(createPathCommand)
3380
- });
3381
- };
3382
- const createAdjustHandlePos = (position) => new BuilderElement({
3383
- name: "a:pos",
3384
- attributes: {
3385
- x: {
3386
- key: "x",
3387
- value: position.x
3388
- },
3389
- y: {
3390
- key: "y",
3391
- value: position.y
3392
- }
3393
- }
3394
- });
3395
- const createXYAdjustHandle = (handle) => {
3396
- const attrs = {};
3397
- if (handle.guideRefX !== void 0) attrs.gdRefX = {
3398
- key: "gdRefX",
3399
- value: handle.guideRefX
3400
- };
3401
- if (handle.minX !== void 0) attrs.minX = {
3402
- key: "minX",
3403
- value: handle.minX
3404
- };
3405
- if (handle.maxX !== void 0) attrs.maxX = {
3406
- key: "maxX",
3407
- value: handle.maxX
3408
- };
3409
- if (handle.guideRefY !== void 0) attrs.gdRefY = {
3410
- key: "gdRefY",
3411
- value: handle.guideRefY
3412
- };
3413
- if (handle.minY !== void 0) attrs.minY = {
3414
- key: "minY",
3415
- value: handle.minY
3416
- };
3417
- if (handle.maxY !== void 0) attrs.maxY = {
3418
- key: "maxY",
3419
- value: handle.maxY
3420
- };
3421
- return new BuilderElement({
3422
- name: "a:ahXY",
3423
- attributes: Object.keys(attrs).length > 0 ? attrs : void 0,
3424
- children: [createAdjustHandlePos(handle.position)]
3425
- });
3426
- };
3427
- const createPolarAdjustHandle = (handle) => {
3428
- const attrs = {};
3429
- if (handle.guideRefRadius !== void 0) attrs.gdRefR = {
3430
- key: "gdRefR",
3431
- value: handle.guideRefRadius
3432
- };
3433
- if (handle.minRadius !== void 0) attrs.minR = {
3434
- key: "minR",
3435
- value: handle.minRadius
3436
- };
3437
- if (handle.maxRadius !== void 0) attrs.maxR = {
3438
- key: "maxR",
3439
- value: handle.maxRadius
3440
- };
3441
- if (handle.guideRefAngle !== void 0) attrs.gdRefAng = {
3442
- key: "gdRefAng",
3443
- value: handle.guideRefAngle
3444
- };
3445
- if (handle.minAngle !== void 0) attrs.minAng = {
3446
- key: "minAng",
3447
- value: handle.minAngle
3448
- };
3449
- if (handle.maxAngle !== void 0) attrs.maxAng = {
3450
- key: "maxAng",
3451
- value: handle.maxAngle
3452
- };
3453
- return new BuilderElement({
3454
- name: "a:ahPolar",
3455
- attributes: Object.keys(attrs).length > 0 ? attrs : void 0,
3456
- children: [createAdjustHandlePos(handle.position)]
3457
- });
3458
- };
3459
- const createConnectionSite = (site) => new BuilderElement({
3460
- name: "a:cxn",
3461
- attributes: { ang: {
3462
- key: "ang",
3463
- value: site.angle
3464
- } },
3465
- children: [createAdjustHandlePos(site.position)]
3466
- });
3467
- const createGeomRect = (rect) => new BuilderElement({
3468
- name: "a:rect",
3469
- attributes: {
3470
- l: {
3471
- key: "l",
3472
- value: rect.left
3473
- },
3474
- t: {
3475
- key: "t",
3476
- value: rect.top
3477
- },
3478
- r: {
3479
- key: "r",
3480
- value: rect.right
3481
- },
3482
- b: {
3483
- key: "b",
3484
- value: rect.bottom
3485
- }
3486
- }
3487
- });
3488
- /**
3489
- * Creates a custom 2D geometry element (a:custGeom).
3490
- *
3491
- * @example
3492
- * ```typescript
3493
- * // Diamond shape
3494
- * const geom = createCustomGeometry({
3495
- * pathList: [{
3496
- * commands: [
3497
- * { command: "moveTo", point: { x: "5000000", y: "0" } },
3498
- * { command: "lineTo", point: { x: "10000000", y: "5000000" } },
3499
- * { command: "lineTo", point: { x: "5000000", y: "10000000" } },
3500
- * { command: "lineTo", point: { x: "0", y: "5000000" } },
3501
- * { command: "close" },
3502
- * ],
3503
- * }],
3504
- * textRect: { left: "2000000", top: "2000000", right: "8000000", bottom: "8000000" },
3505
- * });
3506
- * ```
3507
- */
3508
- const createCustomGeometry = (options) => {
3509
- const children = [];
3510
- if (options.adjustmentValues) children.push(createGuideList("a:avLst", options.adjustmentValues));
3511
- if (options.guides) children.push(createGuideList("a:gdLst", options.guides));
3512
- if (options.adjustHandles && options.adjustHandles.length > 0) children.push(new BuilderElement({
3513
- name: "a:ahLst",
3514
- children: options.adjustHandles.map((h) => h.type === "xy" ? createXYAdjustHandle(h) : createPolarAdjustHandle(h))
3515
- }));
3516
- if (options.connectionSites && options.connectionSites.length > 0) children.push(new BuilderElement({
3517
- name: "a:cxnLst",
3518
- children: options.connectionSites.map(createConnectionSite)
3519
- }));
3520
- if (options.textRect) children.push(createGeomRect(options.textRect));
3521
- children.push(new BuilderElement({
3522
- name: "a:pathLst",
3523
- children: options.pathList.map(createPath)
3524
- }));
3525
- return new BuilderElement({
3526
- name: "a:custGeom",
3527
- children
3528
- });
3529
- };
3530
- //#endregion
3531
- //#region src/drawingml/blip/blip-extentions.ts
3532
- /**
3533
- * Blip extensions module for SVG support.
3534
- *
3535
- * This module provides extension elements that enable SVG image support
3536
- * within blip elements using Office-specific extensions.
3537
- *
3538
- * Reference: http://officeopenxml.com/drwPic.php
3539
- *
3540
- * @module
3541
- */
3542
- /**
3543
- * Creates an SVG blip element for embedding SVG images.
3544
- *
3545
- * This element is a Microsoft Office extension that allows SVG images
3546
- * to be referenced within a blip.
3547
- *
3548
- * @param svgReferenceId - The reference ID for the SVG image
3549
- * @returns An XML component representing the SVG blip element
3550
- * @internal
3551
- */
3552
- const createSvgBlip = (svgReferenceId) => new BuilderElement({
3553
- attributes: {
3554
- asvg: {
3555
- key: "xmlns:asvg",
3556
- value: "http://schemas.microsoft.com/office/drawing/2016/SVG/main"
3557
- },
3558
- embed: {
3559
- key: "r:embed",
3560
- value: `{${svgReferenceId}}`
3561
- }
3562
- },
3563
- name: "asvg:svgBlip"
3564
- });
3565
- /**
3566
- * Creates an extension element for SVG support.
3567
- *
3568
- * This element wraps the SVG blip extension with the appropriate URI
3569
- * to identify it as an SVG extension.
3570
- *
3571
- * @param svgReferenceId - The reference ID for the SVG image
3572
- * @returns An XML component representing the extension element
3573
- * @internal
3574
- */
3575
- const createExtention = (svgReferenceId) => new BuilderElement({
3576
- attributes: { uri: {
3577
- key: "uri",
3578
- value: "{96DAC541-7B7A-43D3-8B79-37D633B846F1}"
3579
- } },
3580
- children: [createSvgBlip(svgReferenceId)],
3581
- name: "a:ext"
3582
- });
3583
- /**
3584
- * Creates an extension list for SVG images.
3585
- *
3586
- * This element contains the extensions needed to embed SVG images
3587
- * within a blip. It wraps the SVG-specific extension elements.
3588
- *
3589
- * ## XSD Schema
3590
- * ```xml
3591
- * <xsd:complexType name="CT_OfficeArtExtensionList">
3592
- * <xsd:sequence>
3593
- * <xsd:element name="ext" type="CT_OfficeArtExtension" minOccurs="0" maxOccurs="unbounded"/>
3594
- * </xsd:sequence>
3595
- * </xsd:complexType>
3596
- * ```
3597
- *
3598
- * @param svgReferenceId - The reference ID for the SVG image
3599
- * @returns An XML component representing the extension list
3600
- */
3601
- const createExtentionList = (svgReferenceId) => new BuilderElement({
3602
- children: [createExtention(svgReferenceId)],
3603
- name: "a:extLst"
3604
- });
3605
- //#endregion
3606
- //#region src/drawingml/blip/blip.ts
3607
- /**
3608
- * Blip (Binary Large Image or Picture) module for DrawingML.
3609
- *
3610
- * This module provides the blip element that references the actual
3611
- * image data within a picture.
3612
- *
3613
- * Reference: http://officeopenxml.com/drwPic.php
3614
- *
3615
- * @module
3616
- */
3617
- /**
3618
- * Creates a blip element for an image.
3619
- *
3620
- * A blip references the actual image data stored in the document package
3621
- * through a relationship ID. For SVG images, it includes extensions that
3622
- * reference the SVG data.
3623
- *
3624
- * Reference: http://officeopenxml.com/drwPic.php
3625
- *
3626
- * ## XSD Schema
3627
- * ```xml
3628
- * <xsd:complexType name="CT_Blip">
3629
- * <xsd:sequence>
3630
- * <xsd:choice minOccurs="0" maxOccurs="unbounded">
3631
- * <xsd:element name="alphaBiLevel" type="CT_AlphaBiLevelEffect"/>
3632
- * <xsd:element name="alphaCeiling" type="CT_AlphaCeilingEffect"/>
3633
- * <xsd:element name="alphaFloor" type="CT_AlphaFloorEffect"/>
3634
- * <xsd:element name="alphaInv" type="CT_AlphaInverseEffect"/>
3635
- * <xsd:element name="alphaMod" type="CT_AlphaModulateEffect"/>
3636
- * <xsd:element name="alphaModFix" type="CT_AlphaModulateFixedEffect"/>
3637
- * <xsd:element name="alphaRepl" type="CT_AlphaReplaceEffect"/>
3638
- * <xsd:element name="biLevel" type="CT_BiLevelEffect"/>
3639
- * <xsd:element name="blur" type="CT_BlurEffect"/>
3640
- * <xsd:element name="clrChange" type="CT_ColorChangeEffect"/>
3641
- * <xsd:element name="clrRepl" type="CT_ColorReplaceEffect"/>
3642
- * <xsd:element name="duotone" type="CT_DuotoneEffect"/>
3643
- * <xsd:element name="fillOverlay" type="CT_FillOverlayEffect"/>
3644
- * <xsd:element name="grayscl" type="CT_GrayscaleEffect"/>
3645
- * <xsd:element name="hsl" type="CT_HSLEffect"/>
3646
- * <xsd:element name="lum" type="CT_LuminanceEffect"/>
3647
- * <xsd:element name="tint" type="CT_TintEffect"/>
3648
- * </xsd:choice>
3649
- * <xsd:element name="extLst" type="CT_OfficeArtExtensionList" minOccurs="0"/>
3650
- * </xsd:sequence>
3651
- * <xsd:attribute ref="r:embed"/>
3652
- * <xsd:attribute ref="r:link"/>
3653
- * <xsd:attribute name="cstate" type="ST_BlipCompression"/>
3654
- * </xsd:complexType>
3655
- * ```
3656
- *
3657
- * @param options - Blip options including referenceId and type
3658
- * @param blipEffects - Optional blip effects (brightness, contrast, etc.)
3659
- * @returns An XML component representing the blip element
3660
- */
3661
- const createBlip = (options, blipEffects) => {
3662
- const children = [];
3663
- if (blipEffects) children.push(...createBlipEffects(blipEffects));
3664
- if (options.type === "svg" && options.fallbackFileName) children.push(createExtentionList(options.referenceId));
3665
- return new BuilderElement({
3666
- attributes: {
3667
- cstate: {
3668
- key: "cstate",
3669
- value: "none"
3670
- },
3671
- embed: {
3672
- key: "r:embed",
3673
- value: `{${options.type === "svg" && options.fallbackFileName ? options.fallbackFileName : options.referenceId}}`
3674
- }
3675
- },
3676
- children,
3677
- name: "a:blip"
3678
- });
3679
- };
3680
- //#endregion
3681
- //#region src/drawingml/blip/blip-fill.ts
3682
- /**
3683
- * Blip fill module for DrawingML pictures.
3684
- *
3685
- * This module defines how an image (blip) fills a picture shape,
3686
- * including stretching and cropping options.
3687
- *
3688
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties
3689
- *
3690
- * @module
3691
- */
3692
- /**
3693
- * Creates a blip fill element.
3694
- *
3695
- * This element specifies the type of fill used for a picture. It contains the blip (image)
3696
- * reference, an optional source rectangle for cropping, and the fill mode (typically stretch).
3697
- *
3698
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties
3699
- *
3700
- * ## XSD Schema
3701
- * ```xml
3702
- * <xsd:complexType name="CT_BlipFillProperties">
3703
- * <xsd:sequence>
3704
- * <xsd:element name="blip" type="CT_Blip" minOccurs="0" maxOccurs="1"/>
3705
- * <xsd:element name="srcRect" type="CT_RelativeRect" minOccurs="0" maxOccurs="1"/>
3706
- * <xsd:group ref="EG_FillModeProperties" minOccurs="0" maxOccurs="1"/>
3707
- * </xsd:sequence>
3708
- * <xsd:attribute name="dpi" type="xsd:unsignedInt" use="optional"/>
3709
- * <xsd:attribute name="rotWithShape" type="xsd:boolean" use="optional"/>
3710
- * </xsd:complexType>
3711
- * ```
3712
- *
3713
- * @param blipOptions - Blip options including referenceId and type
3714
- * @param fillOptions - Optional blip fill options
3715
- */
3716
- const createBlipFill = (blipOptions, fillOptions) => {
3717
- const children = [];
3718
- children.push(createBlip(blipOptions, fillOptions?.blipEffects));
3719
- children.push(createSourceRectangle(fillOptions?.srcRect));
3720
- if (fillOptions?.tile) children.push(createTileInfo(fillOptions.tile));
3721
- else children.push(new Stretch());
3722
- const attributes = {};
3723
- if (fillOptions?.dpi !== void 0) attributes.dpi = {
3724
- key: "dpi",
3725
- value: fillOptions.dpi
3726
- };
3727
- if (fillOptions?.rotWithShape !== void 0) attributes.rotWithShape = {
3728
- key: "rotWithShape",
3729
- value: fillOptions.rotWithShape ? 1 : 0
3730
- };
3731
- return new BuilderElement({
3732
- attributes: Object.keys(attributes).length > 0 ? attributes : void 0,
3733
- children,
3734
- name: "pic:blipFill"
3735
- });
3736
- };
3737
- //#endregion
3738
- //#region src/drawingml/transform.ts
3739
- /**
3740
- * 2D transform for DrawingML shapes.
3741
- *
3742
- * This module provides factory functions for creating transform elements
3743
- * (a:xfrm) used in shape properties, picture properties, and group shapes.
3744
- *
3745
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Transform2D / CT_GroupTransform2D
3746
- *
3747
- * @module
3748
- */
3749
- function buildXfrmAttrs(options) {
3750
- const attrs = {};
3751
- if (options.flipHorizontal !== void 0) attrs.flipH = {
3752
- key: "flipH",
3753
- value: options.flipHorizontal
3754
- };
3755
- if (options.flipVertical !== void 0) attrs.flipV = {
3756
- key: "flipV",
3757
- value: options.flipVertical
3758
- };
3759
- if (options.rotation !== void 0) attrs.rot = {
3760
- key: "rot",
3761
- value: options.rotation
3762
- };
3763
- return Object.keys(attrs).length > 0 ? attrs : void 0;
3764
- }
3765
- /**
3766
- * Creates a 2D transform element (a:xfrm).
3767
- *
3768
- * @param options - Transform options including position, size, rotation, and flip.
3769
- * @param elementName - Element name, defaults to "a:xfrm".
3770
- */
3771
- const createTransform2D = (options, elementName = "a:xfrm") => {
3772
- const children = [];
3773
- if (options.x !== void 0 || options.y !== void 0) children.push(new BuilderElement({
3774
- name: "a:off",
3775
- attributes: {
3776
- x: {
3777
- key: "x",
3778
- value: options.x ?? 0
3779
- },
3780
- y: {
3781
- key: "y",
3782
- value: options.y ?? 0
3783
- }
3784
- }
3785
- }));
3786
- if (options.width !== void 0 || options.height !== void 0) children.push(new BuilderElement({
3787
- name: "a:ext",
3788
- attributes: {
3789
- cx: {
3790
- key: "cx",
3791
- value: options.width ?? 0
3792
- },
3793
- cy: {
3794
- key: "cy",
3795
- value: options.height ?? 0
3796
- }
3797
- }
3798
- }));
3799
- return new BuilderElement({
3800
- name: elementName,
3801
- attributes: buildXfrmAttrs(options),
3802
- children: children.length > 0 ? children : void 0
3803
- });
3804
- };
3805
- /**
3806
- * Creates a group transform element (a:xfrm with chOff/chExt children).
3807
- */
3808
- const createGroupTransform2D = (options, elementName = "a:xfrm") => {
3809
- const base = createTransform2D(options, elementName);
3810
- base["root"].push(new BuilderElement({
3811
- name: "a:chOff",
3812
- attributes: {
3813
- x: {
3814
- key: "x",
3815
- value: options.childOffsetX ?? 0
3816
- },
3817
- y: {
3818
- key: "y",
3819
- value: options.childOffsetY ?? 0
3820
- }
3821
- }
3822
- }));
3823
- base["root"].push(new BuilderElement({
3824
- name: "a:chExt",
3825
- attributes: {
3826
- cx: {
3827
- key: "cx",
3828
- value: options.childExtentWidth ?? 0
3829
- },
3830
- cy: {
3831
- key: "cy",
3832
- value: options.childExtentHeight ?? 0
3833
- }
3834
- }
3835
- }));
3836
- return base;
3837
- };
3838
- //#endregion
3839
- //#region src/drawingml/media/transformation.ts
3840
- /**
3841
- * Media transformation utilities for DrawingML.
3842
- *
3843
- * Converts user-facing transformation options (pixels) to internal
3844
- * transformation data (pixels + EMUs).
3845
- *
3846
- * @module
3847
- */
3848
- /**
3849
- * Converts user-facing transformation options (pixels) to internal
3850
- * transformation data (pixels + EMUs).
3851
- *
3852
- * @param options - User-facing transformation in pixels
3853
- * @returns Internal transformation data with both pixel and EMU values
3854
- */
3855
- const createTransformation = (options) => ({
3856
- emus: {
3857
- x: convertPixelsToEmu(options.width),
3858
- y: convertPixelsToEmu(options.height)
3859
- },
3860
- flip: options.flip,
3861
- offset: {
3862
- emus: {
3863
- x: convertPixelsToEmu(options.offset?.left ?? 0),
3864
- y: convertPixelsToEmu(options.offset?.top ?? 0)
3865
- },
3866
- pixels: {
3867
- x: Math.round(options.offset?.left ?? 0),
3868
- y: Math.round(options.offset?.top ?? 0)
3869
- }
3870
- },
3871
- pixels: {
3872
- x: Math.round(options.width),
3873
- y: Math.round(options.height)
3874
- },
3875
- rotation: options.rotation ? options.rotation * 6e4 : void 0
3876
- });
3877
- //#endregion
1
+ import { A as LineJoin, B as createNoFill, C as createOuterShadowEffect, Ct as createSchemeColor, D as createFillOverlayEffect, Dt as createPresetColor, E as BlendMode, Et as PresetColor, F as LineEndType, G as PathShadeType, H as extractBlipFillMedia, I as LineEndWidth, J as createGradientStop, K as TileFlipMode, L as createLineEnd, M as PresetDash, N as createOutline, O as CompoundLine, Ot as createHslColor, P as LineEndLength, R as createCustomDash, S as RectAlignment, St as SchemeColor, T as createGlowEffect, Tt as createRgbColor, U as PresetPattern, V as buildFill, W as createPatternFill, X as createTileInfo, Y as TileAlignment, _ as createEffectList, _t as createBlipEffects, a as createBlip, b as PresetShadowVal, bt as SystemColor, c as PresetGeometry, d as createShape3D, f as BevelPresetType, g as createEffectDag, gt as createSourceRectangle, h as createScene3D, ht as Stretch, i as createBlipFill, j as PenAlignment, k as LineCap, kt as createColorTransforms, l as createAdjustmentValues, m as createBottomBevel, n as createGroupTransform2D, o as createExtentionList, p as createBevel, q as createGradientFill, r as createTransform2D, s as createCustomGeometry, t as createTransformation, u as PresetMaterialType, v as createSoftEdgeEffect, vt as createColorElement, w as createInnerShadowEffect, wt as createScRgbColor, x as createPresetShadowEffect, xt as createSystemColor, y as createReflectionEffect, yt as createSolidFill, z as createGroupFill } from "../drawingml-YMdpQfWs.mjs";
3878
2
  export { BevelPresetType, BlendMode, CompoundLine, LineCap, LineEndLength, LineEndType, LineEndWidth, LineJoin, PathShadeType, PenAlignment, PresetColor, PresetDash, PresetGeometry, PresetMaterialType, PresetPattern, PresetShadowVal, RectAlignment, SchemeColor, Stretch, SystemColor, TileAlignment, TileFlipMode, buildFill, createAdjustmentValues, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createColorElement, createColorTransforms, createCustomDash, createCustomGeometry, createEffectDag, createEffectList, createExtentionList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGroupFill, createGroupTransform2D, createHslColor, createInnerShadowEffect, createLineEnd, createNoFill, createOuterShadowEffect, createOutline, createPatternFill, createPresetColor, createPresetShadowEffect, createReflectionEffect, createRgbColor, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSystemColor, createTileInfo, createTransform2D, createTransformation, extractBlipFillMedia };