docx-plus 0.0.5 → 0.0.7
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.
- package/README.md +21 -15
- package/dist/index.cjs +2022 -279
- package/dist/index.d.cts +555 -93
- package/dist/index.d.mts +555 -93
- package/dist/index.iife.js +2022 -279
- package/dist/index.mjs +2021 -280
- package/dist/index.umd.js +2022 -279
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2284,6 +2284,57 @@ var InsertionTrackChange = class extends XmlComponent {
|
|
|
2284
2284
|
}
|
|
2285
2285
|
};
|
|
2286
2286
|
//#endregion
|
|
2287
|
+
//#region src/file/paragraph/run/east-asian-layout.ts
|
|
2288
|
+
/**
|
|
2289
|
+
* East Asian layout module for WordprocessingML run properties.
|
|
2290
|
+
*
|
|
2291
|
+
* Specifies East Asian typography settings for a run, including
|
|
2292
|
+
* character combination, vertical text, and compression.
|
|
2293
|
+
*
|
|
2294
|
+
* Reference: ISO/IEC 29500-4, CT_EastAsianLayout
|
|
2295
|
+
*
|
|
2296
|
+
* @module
|
|
2297
|
+
*/
|
|
2298
|
+
/**
|
|
2299
|
+
* Creates an East Asian layout element (w:eastAsianLayout) for a run.
|
|
2300
|
+
*
|
|
2301
|
+
* ## XSD Schema
|
|
2302
|
+
* ```xml
|
|
2303
|
+
* <xsd:complexType name="CT_EastAsianLayout">
|
|
2304
|
+
* <xsd:attribute name="id" type="ST_DecimalNumber" use="optional"/>
|
|
2305
|
+
* <xsd:attribute name="combine" type="s:ST_OnOff" use="optional"/>
|
|
2306
|
+
* <xsd:attribute name="combineBrackets" type="ST_CombineBrackets" use="optional"/>
|
|
2307
|
+
* <xsd:attribute name="vert" type="s:ST_OnOff" use="optional"/>
|
|
2308
|
+
* <xsd:attribute name="vertCompress" type="s:ST_OnOff" use="optional"/>
|
|
2309
|
+
* </xsd:complexType>
|
|
2310
|
+
* ```
|
|
2311
|
+
*/
|
|
2312
|
+
const createEastAsianLayout = ({ id, combine, combineBrackets, vert, vertCompress }) => new BuilderElement({
|
|
2313
|
+
attributes: {
|
|
2314
|
+
combine: {
|
|
2315
|
+
key: "w:combine",
|
|
2316
|
+
value: combine
|
|
2317
|
+
},
|
|
2318
|
+
combineBrackets: {
|
|
2319
|
+
key: "w:combineBrackets",
|
|
2320
|
+
value: combineBrackets
|
|
2321
|
+
},
|
|
2322
|
+
id: {
|
|
2323
|
+
key: "w:id",
|
|
2324
|
+
value: id === void 0 ? void 0 : decimalNumber(id)
|
|
2325
|
+
},
|
|
2326
|
+
vert: {
|
|
2327
|
+
key: "w:vert",
|
|
2328
|
+
value: vert
|
|
2329
|
+
},
|
|
2330
|
+
vertCompress: {
|
|
2331
|
+
key: "w:vertCompress",
|
|
2332
|
+
value: vertCompress
|
|
2333
|
+
}
|
|
2334
|
+
},
|
|
2335
|
+
name: "w:eastAsianLayout"
|
|
2336
|
+
});
|
|
2337
|
+
//#endregion
|
|
2287
2338
|
//#region src/file/paragraph/run/emphasis-mark.ts
|
|
2288
2339
|
/**
|
|
2289
2340
|
* Emphasis mark module for WordprocessingML run properties.
|
|
@@ -3015,6 +3066,7 @@ var RunProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
3015
3066
|
if (options.math) this.push(new OnOffElement("w:oMath", options.math));
|
|
3016
3067
|
if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
|
|
3017
3068
|
if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
|
|
3069
|
+
if (options.eastAsianLayout) this.push(createEastAsianLayout(options.eastAsianLayout));
|
|
3018
3070
|
if (options.revision) this.push(new RunPropertiesChange(options.revision));
|
|
3019
3071
|
}
|
|
3020
3072
|
push(item) {
|
|
@@ -3709,379 +3761,1590 @@ const createVerticalPosition = ({ relative, align, offset }) => new BuilderEleme
|
|
|
3709
3761
|
name: "wp:positionV"
|
|
3710
3762
|
});
|
|
3711
3763
|
//#endregion
|
|
3712
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
3764
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/color-transform.ts
|
|
3713
3765
|
/**
|
|
3714
|
-
*
|
|
3766
|
+
* Color transform elements for DrawingML colors.
|
|
3715
3767
|
*
|
|
3716
|
-
* This module
|
|
3768
|
+
* This module provides color transformation elements defined in EG_ColorTransform,
|
|
3769
|
+
* which can be applied as child elements to any color type (srgbClr, schemeClr, etc.).
|
|
3770
|
+
*
|
|
3771
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, EG_ColorTransform
|
|
3717
3772
|
*
|
|
3718
3773
|
* @module
|
|
3719
3774
|
*/
|
|
3720
3775
|
/**
|
|
3721
|
-
*
|
|
3776
|
+
* Creates color transform child elements.
|
|
3777
|
+
*
|
|
3778
|
+
* These elements modify the parent color according to OOXML color transform rules.
|
|
3779
|
+
* Multiple transforms can be applied in sequence.
|
|
3780
|
+
*
|
|
3781
|
+
* @example
|
|
3782
|
+
* ```typescript
|
|
3783
|
+
* // Lighten accent1 by 40%
|
|
3784
|
+
* createColorTransforms({ tint: 40000 });
|
|
3785
|
+
* // Semi-transparent red with 50% alpha
|
|
3786
|
+
* createColorTransforms({ alpha: 50000 });
|
|
3787
|
+
* ```
|
|
3788
|
+
*/
|
|
3789
|
+
const createColorTransforms = (options) => {
|
|
3790
|
+
const transforms = [];
|
|
3791
|
+
if (options.tint !== void 0) transforms.push(new BuilderElement({
|
|
3792
|
+
attributes: { val: {
|
|
3793
|
+
key: "val",
|
|
3794
|
+
value: options.tint
|
|
3795
|
+
} },
|
|
3796
|
+
name: "a:tint"
|
|
3797
|
+
}));
|
|
3798
|
+
if (options.shade !== void 0) transforms.push(new BuilderElement({
|
|
3799
|
+
attributes: { val: {
|
|
3800
|
+
key: "val",
|
|
3801
|
+
value: options.shade
|
|
3802
|
+
} },
|
|
3803
|
+
name: "a:shade"
|
|
3804
|
+
}));
|
|
3805
|
+
if (options.comp) transforms.push(new BuilderElement({ name: "a:comp" }));
|
|
3806
|
+
if (options.inv) transforms.push(new BuilderElement({ name: "a:inv" }));
|
|
3807
|
+
if (options.gray) transforms.push(new BuilderElement({ name: "a:gray" }));
|
|
3808
|
+
if (options.alpha !== void 0) transforms.push(new BuilderElement({
|
|
3809
|
+
attributes: { val: {
|
|
3810
|
+
key: "val",
|
|
3811
|
+
value: options.alpha
|
|
3812
|
+
} },
|
|
3813
|
+
name: "a:alpha"
|
|
3814
|
+
}));
|
|
3815
|
+
if (options.alphaOff !== void 0) transforms.push(new BuilderElement({
|
|
3816
|
+
attributes: { val: {
|
|
3817
|
+
key: "val",
|
|
3818
|
+
value: options.alphaOff
|
|
3819
|
+
} },
|
|
3820
|
+
name: "a:alphaOff"
|
|
3821
|
+
}));
|
|
3822
|
+
if (options.alphaMod !== void 0) transforms.push(new BuilderElement({
|
|
3823
|
+
attributes: { val: {
|
|
3824
|
+
key: "val",
|
|
3825
|
+
value: options.alphaMod
|
|
3826
|
+
} },
|
|
3827
|
+
name: "a:alphaMod"
|
|
3828
|
+
}));
|
|
3829
|
+
if (options.hue !== void 0) transforms.push(new BuilderElement({
|
|
3830
|
+
attributes: { val: {
|
|
3831
|
+
key: "val",
|
|
3832
|
+
value: options.hue
|
|
3833
|
+
} },
|
|
3834
|
+
name: "a:hue"
|
|
3835
|
+
}));
|
|
3836
|
+
if (options.hueOff !== void 0) transforms.push(new BuilderElement({
|
|
3837
|
+
attributes: { val: {
|
|
3838
|
+
key: "val",
|
|
3839
|
+
value: options.hueOff
|
|
3840
|
+
} },
|
|
3841
|
+
name: "a:hueOff"
|
|
3842
|
+
}));
|
|
3843
|
+
if (options.hueMod !== void 0) transforms.push(new BuilderElement({
|
|
3844
|
+
attributes: { val: {
|
|
3845
|
+
key: "val",
|
|
3846
|
+
value: options.hueMod
|
|
3847
|
+
} },
|
|
3848
|
+
name: "a:hueMod"
|
|
3849
|
+
}));
|
|
3850
|
+
if (options.sat !== void 0) transforms.push(new BuilderElement({
|
|
3851
|
+
attributes: { val: {
|
|
3852
|
+
key: "val",
|
|
3853
|
+
value: options.sat
|
|
3854
|
+
} },
|
|
3855
|
+
name: "a:sat"
|
|
3856
|
+
}));
|
|
3857
|
+
if (options.satOff !== void 0) transforms.push(new BuilderElement({
|
|
3858
|
+
attributes: { val: {
|
|
3859
|
+
key: "val",
|
|
3860
|
+
value: options.satOff
|
|
3861
|
+
} },
|
|
3862
|
+
name: "a:satOff"
|
|
3863
|
+
}));
|
|
3864
|
+
if (options.satMod !== void 0) transforms.push(new BuilderElement({
|
|
3865
|
+
attributes: { val: {
|
|
3866
|
+
key: "val",
|
|
3867
|
+
value: options.satMod
|
|
3868
|
+
} },
|
|
3869
|
+
name: "a:satMod"
|
|
3870
|
+
}));
|
|
3871
|
+
if (options.lum !== void 0) transforms.push(new BuilderElement({
|
|
3872
|
+
attributes: { val: {
|
|
3873
|
+
key: "val",
|
|
3874
|
+
value: options.lum
|
|
3875
|
+
} },
|
|
3876
|
+
name: "a:lum"
|
|
3877
|
+
}));
|
|
3878
|
+
if (options.lumOff !== void 0) transforms.push(new BuilderElement({
|
|
3879
|
+
attributes: { val: {
|
|
3880
|
+
key: "val",
|
|
3881
|
+
value: options.lumOff
|
|
3882
|
+
} },
|
|
3883
|
+
name: "a:lumOff"
|
|
3884
|
+
}));
|
|
3885
|
+
if (options.lumMod !== void 0) transforms.push(new BuilderElement({
|
|
3886
|
+
attributes: { val: {
|
|
3887
|
+
key: "val",
|
|
3888
|
+
value: options.lumMod
|
|
3889
|
+
} },
|
|
3890
|
+
name: "a:lumMod"
|
|
3891
|
+
}));
|
|
3892
|
+
if (options.red !== void 0) transforms.push(new BuilderElement({
|
|
3893
|
+
attributes: { val: {
|
|
3894
|
+
key: "val",
|
|
3895
|
+
value: options.red
|
|
3896
|
+
} },
|
|
3897
|
+
name: "a:red"
|
|
3898
|
+
}));
|
|
3899
|
+
if (options.redOff !== void 0) transforms.push(new BuilderElement({
|
|
3900
|
+
attributes: { val: {
|
|
3901
|
+
key: "val",
|
|
3902
|
+
value: options.redOff
|
|
3903
|
+
} },
|
|
3904
|
+
name: "a:redOff"
|
|
3905
|
+
}));
|
|
3906
|
+
if (options.redMod !== void 0) transforms.push(new BuilderElement({
|
|
3907
|
+
attributes: { val: {
|
|
3908
|
+
key: "val",
|
|
3909
|
+
value: options.redMod
|
|
3910
|
+
} },
|
|
3911
|
+
name: "a:redMod"
|
|
3912
|
+
}));
|
|
3913
|
+
if (options.green !== void 0) transforms.push(new BuilderElement({
|
|
3914
|
+
attributes: { val: {
|
|
3915
|
+
key: "val",
|
|
3916
|
+
value: options.green
|
|
3917
|
+
} },
|
|
3918
|
+
name: "a:green"
|
|
3919
|
+
}));
|
|
3920
|
+
if (options.greenOff !== void 0) transforms.push(new BuilderElement({
|
|
3921
|
+
attributes: { val: {
|
|
3922
|
+
key: "val",
|
|
3923
|
+
value: options.greenOff
|
|
3924
|
+
} },
|
|
3925
|
+
name: "a:greenOff"
|
|
3926
|
+
}));
|
|
3927
|
+
if (options.greenMod !== void 0) transforms.push(new BuilderElement({
|
|
3928
|
+
attributes: { val: {
|
|
3929
|
+
key: "val",
|
|
3930
|
+
value: options.greenMod
|
|
3931
|
+
} },
|
|
3932
|
+
name: "a:greenMod"
|
|
3933
|
+
}));
|
|
3934
|
+
if (options.blue !== void 0) transforms.push(new BuilderElement({
|
|
3935
|
+
attributes: { val: {
|
|
3936
|
+
key: "val",
|
|
3937
|
+
value: options.blue
|
|
3938
|
+
} },
|
|
3939
|
+
name: "a:blue"
|
|
3940
|
+
}));
|
|
3941
|
+
if (options.blueOff !== void 0) transforms.push(new BuilderElement({
|
|
3942
|
+
attributes: { val: {
|
|
3943
|
+
key: "val",
|
|
3944
|
+
value: options.blueOff
|
|
3945
|
+
} },
|
|
3946
|
+
name: "a:blueOff"
|
|
3947
|
+
}));
|
|
3948
|
+
if (options.blueMod !== void 0) transforms.push(new BuilderElement({
|
|
3949
|
+
attributes: { val: {
|
|
3950
|
+
key: "val",
|
|
3951
|
+
value: options.blueMod
|
|
3952
|
+
} },
|
|
3953
|
+
name: "a:blueMod"
|
|
3954
|
+
}));
|
|
3955
|
+
if (options.gamma) transforms.push(new BuilderElement({ name: "a:gamma" }));
|
|
3956
|
+
if (options.invGamma) transforms.push(new BuilderElement({ name: "a:invGamma" }));
|
|
3957
|
+
return transforms;
|
|
3958
|
+
};
|
|
3959
|
+
//#endregion
|
|
3960
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/hsl-color.ts
|
|
3961
|
+
/**
|
|
3962
|
+
* HSL color element for DrawingML.
|
|
3963
|
+
*
|
|
3964
|
+
* This module provides HSL (Hue, Saturation, Luminance) color support.
|
|
3965
|
+
*
|
|
3966
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_HslColor
|
|
3722
3967
|
*
|
|
3723
|
-
*
|
|
3968
|
+
* @module
|
|
3969
|
+
*/
|
|
3970
|
+
/**
|
|
3971
|
+
* Creates an HSL color element.
|
|
3972
|
+
*
|
|
3973
|
+
* Specifies a color using Hue, Saturation, and Luminance values.
|
|
3724
3974
|
*
|
|
3725
3975
|
* ## XSD Schema
|
|
3726
3976
|
* ```xml
|
|
3727
|
-
* <xsd:
|
|
3728
|
-
*
|
|
3977
|
+
* <xsd:complexType name="CT_HslColor">
|
|
3978
|
+
* <xsd:sequence>
|
|
3979
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
3980
|
+
* </xsd:sequence>
|
|
3981
|
+
* <xsd:attribute name="hue" type="ST_PositiveFixedAngle" use="required"/>
|
|
3982
|
+
* <xsd:attribute name="sat" type="ST_Percentage" use="required"/>
|
|
3983
|
+
* <xsd:attribute name="lum" type="ST_Percentage" use="required"/>
|
|
3984
|
+
* </xsd:complexType>
|
|
3729
3985
|
* ```
|
|
3730
|
-
*
|
|
3731
|
-
* @internal
|
|
3732
3986
|
*/
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3987
|
+
const createHslColor = (options) => {
|
|
3988
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
3989
|
+
return new BuilderElement({
|
|
3990
|
+
attributes: {
|
|
3991
|
+
hue: {
|
|
3992
|
+
key: "hue",
|
|
3993
|
+
value: options.hue
|
|
3994
|
+
},
|
|
3995
|
+
lum: {
|
|
3996
|
+
key: "lum",
|
|
3997
|
+
value: options.lum
|
|
3998
|
+
},
|
|
3999
|
+
sat: {
|
|
4000
|
+
key: "sat",
|
|
4001
|
+
value: options.sat
|
|
4002
|
+
}
|
|
4003
|
+
},
|
|
4004
|
+
children: [...transforms],
|
|
4005
|
+
name: "a:hslClr"
|
|
4006
|
+
});
|
|
3741
4007
|
};
|
|
3742
4008
|
//#endregion
|
|
3743
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
4009
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/preset-color.ts
|
|
3744
4010
|
/**
|
|
3745
|
-
*
|
|
4011
|
+
* Preset color element for DrawingML.
|
|
3746
4012
|
*
|
|
3747
|
-
* This module
|
|
4013
|
+
* This module provides named preset colors (CSS named colors).
|
|
3748
4014
|
*
|
|
3749
|
-
* Reference:
|
|
4015
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetColor / ST_PresetColorVal
|
|
3750
4016
|
*
|
|
3751
4017
|
* @module
|
|
3752
4018
|
*/
|
|
3753
4019
|
/**
|
|
3754
|
-
*
|
|
3755
|
-
*
|
|
3756
|
-
* Defines the width and height of the shape in English Metric Units (EMUs).
|
|
3757
|
-
* One EMU equals 1/914,400 of an inch.
|
|
3758
|
-
*
|
|
3759
|
-
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
4020
|
+
* Preset color values (CSS named colors).
|
|
3760
4021
|
*
|
|
3761
4022
|
* ## XSD Schema
|
|
3762
4023
|
* ```xml
|
|
3763
|
-
* <xsd:
|
|
3764
|
-
* <xsd:
|
|
3765
|
-
*
|
|
3766
|
-
*
|
|
3767
|
-
*
|
|
3768
|
-
*
|
|
3769
|
-
*
|
|
3770
|
-
* ```typescript
|
|
3771
|
-
* // Create a 1-inch by 1-inch shape
|
|
3772
|
-
* const extents = new Extents(914400, 914400);
|
|
4024
|
+
* <xsd:simpleType name="ST_PresetColorVal">
|
|
4025
|
+
* <xsd:restriction base="xsd:token">
|
|
4026
|
+
* <xsd:enumeration value="aliceBlue"/>
|
|
4027
|
+
* ...
|
|
4028
|
+
* <xsd:enumeration value="yellowGreen"/>
|
|
4029
|
+
* </xsd:restriction>
|
|
4030
|
+
* </xsd:simpleType>
|
|
3773
4031
|
* ```
|
|
3774
4032
|
*/
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
4033
|
+
const PresetColor = {
|
|
4034
|
+
ALICE_BLUE: "aliceBlue",
|
|
4035
|
+
ANTIQUE_WHITE: "antiqueWhite",
|
|
4036
|
+
AQUA: "aqua",
|
|
4037
|
+
AQUAMARINE: "aquamarine",
|
|
4038
|
+
AZURE: "azure",
|
|
4039
|
+
BEIGE: "beige",
|
|
4040
|
+
BISQUE: "bisque",
|
|
4041
|
+
BLACK: "black",
|
|
4042
|
+
BLANCHED_ALMOND: "blanchedAlmond",
|
|
4043
|
+
BLUE: "blue",
|
|
4044
|
+
BLUE_VIOLET: "blueViolet",
|
|
4045
|
+
BROWN: "brown",
|
|
4046
|
+
BURLY_WOOD: "burlyWood",
|
|
4047
|
+
CADET_BLUE: "cadetBlue",
|
|
4048
|
+
CHARTREUSE: "chartreuse",
|
|
4049
|
+
CHOCOLATE: "chocolate",
|
|
4050
|
+
CORAL: "coral",
|
|
4051
|
+
CORNFLOWER_BLUE: "cornflowerBlue",
|
|
4052
|
+
CORNSILK: "cornsilk",
|
|
4053
|
+
CRIMSON: "crimson",
|
|
4054
|
+
CYAN: "cyan",
|
|
4055
|
+
DARK_BLUE: "darkBlue",
|
|
4056
|
+
DARK_CYAN: "darkCyan",
|
|
4057
|
+
DARK_GOLDENROD: "darkGoldenrod",
|
|
4058
|
+
DARK_GRAY: "darkGray",
|
|
4059
|
+
DARK_GREY: "darkGrey",
|
|
4060
|
+
DARK_GREEN: "darkGreen",
|
|
4061
|
+
DARK_KHAKI: "darkKhaki",
|
|
4062
|
+
DARK_MAGENTA: "darkMagenta",
|
|
4063
|
+
DARK_OLIVE_GREEN: "darkOliveGreen",
|
|
4064
|
+
DARK_ORANGE: "darkOrange",
|
|
4065
|
+
DARK_ORCHID: "darkOrchid",
|
|
4066
|
+
DARK_RED: "darkRed",
|
|
4067
|
+
DARK_SALMON: "darkSalmon",
|
|
4068
|
+
DARK_SEA_GREEN: "darkSeaGreen",
|
|
4069
|
+
DARK_SLATE_BLUE: "darkSlateBlue",
|
|
4070
|
+
DARK_SLATE_GRAY: "darkSlateGray",
|
|
4071
|
+
DARK_SLATE_GREY: "darkSlateGrey",
|
|
4072
|
+
DARK_TURQUOISE: "darkTurquoise",
|
|
4073
|
+
DARK_VIOLET: "darkViolet",
|
|
4074
|
+
DEEP_PINK: "deepPink",
|
|
4075
|
+
DEEP_SKY_BLUE: "deepSkyBlue",
|
|
4076
|
+
DIM_GRAY: "dimGray",
|
|
4077
|
+
DIM_GREY: "dimGrey",
|
|
4078
|
+
DODGER_BLUE: "dodgerBlue",
|
|
4079
|
+
FIREBRICK: "firebrick",
|
|
4080
|
+
FLORAL_WHITE: "floralWhite",
|
|
4081
|
+
FOREST_GREEN: "forestGreen",
|
|
4082
|
+
FUCHSIA: "fuchsia",
|
|
4083
|
+
GAINSBORO: "gainsboro",
|
|
4084
|
+
GHOST_WHITE: "ghostWhite",
|
|
4085
|
+
GOLD: "gold",
|
|
4086
|
+
GOLDENROD: "goldenrod",
|
|
4087
|
+
GRAY: "gray",
|
|
4088
|
+
GREY: "grey",
|
|
4089
|
+
GREEN: "green",
|
|
4090
|
+
GREEN_YELLOW: "greenYellow",
|
|
4091
|
+
HONEYDEW: "honeydew",
|
|
4092
|
+
HOT_PINK: "hotPink",
|
|
4093
|
+
INDIAN_RED: "indianRed",
|
|
4094
|
+
INDIGO: "indigo",
|
|
4095
|
+
IVORY: "ivory",
|
|
4096
|
+
KHAKI: "khaki",
|
|
4097
|
+
LAVENDER: "lavender",
|
|
4098
|
+
LAVENDER_BLUSH: "lavenderBlush",
|
|
4099
|
+
LAWN_GREEN: "lawnGreen",
|
|
4100
|
+
LEMON_CHIFFON: "lemonChiffon",
|
|
4101
|
+
LIGHT_BLUE: "lightBlue",
|
|
4102
|
+
LIGHT_CORAL: "lightCoral",
|
|
4103
|
+
LIGHT_CYAN: "lightCyan",
|
|
4104
|
+
LIGHT_GOLDENROD_YELLOW: "lightGoldenrodYellow",
|
|
4105
|
+
LIGHT_GRAY: "lightGray",
|
|
4106
|
+
LIGHT_GREY: "lightGrey",
|
|
4107
|
+
LIGHT_GREEN: "lightGreen",
|
|
4108
|
+
LIGHT_PINK: "lightPink",
|
|
4109
|
+
LIGHT_SALMON: "lightSalmon",
|
|
4110
|
+
LIGHT_SEA_GREEN: "lightSeaGreen",
|
|
4111
|
+
LIGHT_SKY_BLUE: "lightSkyBlue",
|
|
4112
|
+
LIGHT_SLATE_GRAY: "lightSlateGray",
|
|
4113
|
+
LIGHT_SLATE_GREY: "lightSlateGrey",
|
|
4114
|
+
LIGHT_STEEL_BLUE: "lightSteelBlue",
|
|
4115
|
+
LIGHT_YELLOW: "lightYellow",
|
|
4116
|
+
LIME: "lime",
|
|
4117
|
+
LIME_GREEN: "limeGreen",
|
|
4118
|
+
LINEN: "linen",
|
|
4119
|
+
MAGENTA: "magenta",
|
|
4120
|
+
MAROON: "maroon",
|
|
4121
|
+
MEDIUM_AQUAMARINE: "mediumAquamarine",
|
|
4122
|
+
MEDIUM_BLUE: "mediumBlue",
|
|
4123
|
+
MEDIUM_ORCHID: "mediumOrchid",
|
|
4124
|
+
MEDIUM_PURPLE: "mediumPurple",
|
|
4125
|
+
MEDIUM_SEA_GREEN: "mediumSeaGreen",
|
|
4126
|
+
MEDIUM_SLATE_BLUE: "mediumSlateBlue",
|
|
4127
|
+
MEDIUM_SPRING_GREEN: "mediumSpringGreen",
|
|
4128
|
+
MEDIUM_TURQUOISE: "mediumTurquoise",
|
|
4129
|
+
MEDIUM_VIOLET_RED: "mediumVioletRed",
|
|
4130
|
+
MIDNIGHT_BLUE: "midnightBlue",
|
|
4131
|
+
MINT_CREAM: "mintCream",
|
|
4132
|
+
MISTY_ROSE: "mistyRose",
|
|
4133
|
+
MOCCASIN: "moccasin",
|
|
4134
|
+
NAVAJO_WHITE: "navajoWhite",
|
|
4135
|
+
NAVY: "navy",
|
|
4136
|
+
OLD_LACE: "oldLace",
|
|
4137
|
+
OLIVE: "olive",
|
|
4138
|
+
OLIVE_DRAB: "oliveDrab",
|
|
4139
|
+
ORANGE: "orange",
|
|
4140
|
+
ORANGE_RED: "orangeRed",
|
|
4141
|
+
ORCHID: "orchid",
|
|
4142
|
+
PALE_GOLDENROD: "paleGoldenrod",
|
|
4143
|
+
PALE_GREEN: "paleGreen",
|
|
4144
|
+
PALE_TURQUOISE: "paleTurquoise",
|
|
4145
|
+
PALE_VIOLET_RED: "paleVioletRed",
|
|
4146
|
+
PAPAYA_WHIP: "papayaWhip",
|
|
4147
|
+
PEACH_PUFF: "peachPuff",
|
|
4148
|
+
PERU: "peru",
|
|
4149
|
+
PINK: "pink",
|
|
4150
|
+
PLUM: "plum",
|
|
4151
|
+
POWDER_BLUE: "powderBlue",
|
|
4152
|
+
PURPLE: "purple",
|
|
4153
|
+
RED: "red",
|
|
4154
|
+
ROSY_BROWN: "rosyBrown",
|
|
4155
|
+
ROYAL_BLUE: "royalBlue",
|
|
4156
|
+
SADDLE_BROWN: "saddleBrown",
|
|
4157
|
+
SALMON: "salmon",
|
|
4158
|
+
SANDY_BROWN: "sandyBrown",
|
|
4159
|
+
SEA_GREEN: "seaGreen",
|
|
4160
|
+
SEA_SHELL: "seaShell",
|
|
4161
|
+
SIENNA: "sienna",
|
|
4162
|
+
SILVER: "silver",
|
|
4163
|
+
SKY_BLUE: "skyBlue",
|
|
4164
|
+
SLATE_BLUE: "slateBlue",
|
|
4165
|
+
SLATE_GRAY: "slateGray",
|
|
4166
|
+
SLATE_GREY: "slateGrey",
|
|
4167
|
+
SNOW: "snow",
|
|
4168
|
+
SPRING_GREEN: "springGreen",
|
|
4169
|
+
STEEL_BLUE: "steelBlue",
|
|
4170
|
+
TAN: "tan",
|
|
4171
|
+
TEAL: "teal",
|
|
4172
|
+
THISTLE: "thistle",
|
|
4173
|
+
TOMATO: "tomato",
|
|
4174
|
+
TURQUOISE: "turquoise",
|
|
4175
|
+
VIOLET: "violet",
|
|
4176
|
+
WHEAT: "wheat",
|
|
4177
|
+
WHITE: "white",
|
|
4178
|
+
WHITE_SMOKE: "whiteSmoke",
|
|
4179
|
+
YELLOW: "yellow",
|
|
4180
|
+
YELLOW_GREEN: "yellowGreen"
|
|
3785
4181
|
};
|
|
3786
|
-
//#endregion
|
|
3787
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/offset/off-attributes.ts
|
|
3788
|
-
/**
|
|
3789
|
-
* Offset attributes for DrawingML shapes.
|
|
3790
|
-
*
|
|
3791
|
-
* This module defines the x and y coordinate attributes for shape offset.
|
|
3792
|
-
*
|
|
3793
|
-
* @module
|
|
3794
|
-
*/
|
|
3795
4182
|
/**
|
|
3796
|
-
*
|
|
4183
|
+
* Creates a preset color element.
|
|
3797
4184
|
*
|
|
3798
|
-
*
|
|
4185
|
+
* Specifies a color using a named preset (CSS named color).
|
|
3799
4186
|
*
|
|
3800
4187
|
* ## XSD Schema
|
|
3801
4188
|
* ```xml
|
|
3802
|
-
* <xsd:
|
|
3803
|
-
*
|
|
4189
|
+
* <xsd:complexType name="CT_PresetColor">
|
|
4190
|
+
* <xsd:sequence>
|
|
4191
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4192
|
+
* </xsd:sequence>
|
|
4193
|
+
* <xsd:attribute name="val" type="ST_PresetColorVal" use="required"/>
|
|
4194
|
+
* </xsd:complexType>
|
|
3804
4195
|
* ```
|
|
3805
|
-
*
|
|
3806
|
-
* @internal
|
|
3807
4196
|
*/
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
}
|
|
3815
|
-
|
|
4197
|
+
const createPresetColor = (options) => {
|
|
4198
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4199
|
+
return new BuilderElement({
|
|
4200
|
+
attributes: { value: {
|
|
4201
|
+
key: "val",
|
|
4202
|
+
value: options.value
|
|
4203
|
+
} },
|
|
4204
|
+
children: [...transforms],
|
|
4205
|
+
name: "a:prstClr"
|
|
4206
|
+
});
|
|
3816
4207
|
};
|
|
3817
4208
|
//#endregion
|
|
3818
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
4209
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/rgb-color.ts
|
|
3819
4210
|
/**
|
|
3820
|
-
*
|
|
4211
|
+
* RGB color element for DrawingML shapes.
|
|
3821
4212
|
*
|
|
3822
|
-
* This module
|
|
4213
|
+
* This module provides RGB color support for solid fills.
|
|
3823
4214
|
*
|
|
3824
|
-
* Reference:
|
|
4215
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SRgbColor
|
|
3825
4216
|
*
|
|
3826
4217
|
* @module
|
|
3827
4218
|
*/
|
|
3828
4219
|
/**
|
|
3829
|
-
*
|
|
3830
|
-
*
|
|
3831
|
-
* Defines the x and y coordinates of the shape's position in
|
|
3832
|
-
* English Metric Units (EMUs). One EMU equals 1/914,400 of an inch.
|
|
4220
|
+
* Creates an sRGB color element.
|
|
3833
4221
|
*
|
|
3834
|
-
*
|
|
4222
|
+
* Specifies a color using RGB hex values.
|
|
3835
4223
|
*
|
|
3836
4224
|
* ## XSD Schema
|
|
3837
4225
|
* ```xml
|
|
3838
|
-
* <xsd:complexType name="
|
|
3839
|
-
* <xsd:
|
|
3840
|
-
*
|
|
4226
|
+
* <xsd:complexType name="CT_SRgbColor">
|
|
4227
|
+
* <xsd:sequence>
|
|
4228
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4229
|
+
* </xsd:sequence>
|
|
4230
|
+
* <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
|
|
3841
4231
|
* </xsd:complexType>
|
|
3842
4232
|
* ```
|
|
3843
4233
|
*
|
|
3844
4234
|
* @example
|
|
3845
4235
|
* ```typescript
|
|
3846
|
-
* const
|
|
4236
|
+
* const redColor = createRgbColor({ value: "FF0000" });
|
|
4237
|
+
* // With alpha transform
|
|
4238
|
+
* const semiRed = createRgbColor({ value: "FF0000", transforms: { alpha: 50000 } });
|
|
3847
4239
|
* ```
|
|
3848
4240
|
*/
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
}
|
|
3856
|
-
|
|
4241
|
+
const createRgbColor = (options) => {
|
|
4242
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4243
|
+
return new BuilderElement({
|
|
4244
|
+
attributes: { value: {
|
|
4245
|
+
key: "val",
|
|
4246
|
+
value: options.value
|
|
4247
|
+
} },
|
|
4248
|
+
children: [...transforms],
|
|
4249
|
+
name: "a:srgbClr"
|
|
4250
|
+
});
|
|
3857
4251
|
};
|
|
3858
4252
|
//#endregion
|
|
3859
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
4253
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/scheme-color.ts
|
|
3860
4254
|
/**
|
|
3861
|
-
*
|
|
4255
|
+
* Scheme color element for DrawingML shapes.
|
|
3862
4256
|
*
|
|
3863
|
-
*
|
|
4257
|
+
* This module provides scheme-based color support for solid fills,
|
|
4258
|
+
* allowing colors to be defined using theme color schemes.
|
|
4259
|
+
*
|
|
4260
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SchemeColor / ST_SchemeColorVal
|
|
4261
|
+
*
|
|
4262
|
+
* @module
|
|
3864
4263
|
*/
|
|
3865
|
-
var FormAttributes = class extends XmlAttributeComponent {
|
|
3866
|
-
constructor(..._args) {
|
|
3867
|
-
super(..._args);
|
|
3868
|
-
_defineProperty(this, "xmlKeys", {
|
|
3869
|
-
flipHorizontal: "flipH",
|
|
3870
|
-
flipVertical: "flipV",
|
|
3871
|
-
rotation: "rot"
|
|
3872
|
-
});
|
|
3873
|
-
}
|
|
3874
|
-
};
|
|
3875
4264
|
/**
|
|
3876
|
-
*
|
|
4265
|
+
* Scheme color values for theme-based colors.
|
|
3877
4266
|
*
|
|
3878
|
-
*
|
|
3879
|
-
|
|
4267
|
+
* These values reference colors defined in the document's color scheme/theme.
|
|
4268
|
+
*/
|
|
4269
|
+
const SchemeColor = {
|
|
4270
|
+
BG1: "bg1",
|
|
4271
|
+
TX1: "tx1",
|
|
4272
|
+
BG2: "bg2",
|
|
4273
|
+
TX2: "tx2",
|
|
4274
|
+
ACCENT1: "accent1",
|
|
4275
|
+
ACCENT2: "accent2",
|
|
4276
|
+
ACCENT3: "accent3",
|
|
4277
|
+
ACCENT4: "accent4",
|
|
4278
|
+
ACCENT5: "accent5",
|
|
4279
|
+
ACCENT6: "accent6",
|
|
4280
|
+
HLINK: "hlink",
|
|
4281
|
+
FOLHLINK: "folHlink",
|
|
4282
|
+
DK1: "dk1",
|
|
4283
|
+
LT1: "lt1",
|
|
4284
|
+
DK2: "dk2",
|
|
4285
|
+
LT2: "lt2",
|
|
4286
|
+
PHCLR: "phClr"
|
|
4287
|
+
};
|
|
4288
|
+
/**
|
|
4289
|
+
* Creates a scheme color element.
|
|
3880
4290
|
*
|
|
3881
|
-
*
|
|
4291
|
+
* Specifies a color using a theme color scheme reference.
|
|
3882
4292
|
*
|
|
3883
4293
|
* ## XSD Schema
|
|
3884
4294
|
* ```xml
|
|
3885
|
-
* <xsd:complexType name="
|
|
4295
|
+
* <xsd:complexType name="CT_SchemeColor">
|
|
3886
4296
|
* <xsd:sequence>
|
|
3887
|
-
* <xsd:
|
|
3888
|
-
* <xsd:element name="ext" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
4297
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
3889
4298
|
* </xsd:sequence>
|
|
3890
|
-
* <xsd:attribute name="
|
|
3891
|
-
* <xsd:attribute name="flipH" type="xsd:boolean" use="optional"/>
|
|
3892
|
-
* <xsd:attribute name="flipV" type="xsd:boolean" use="optional"/>
|
|
4299
|
+
* <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
|
|
3893
4300
|
* </xsd:complexType>
|
|
3894
4301
|
* ```
|
|
3895
4302
|
*
|
|
3896
4303
|
* @example
|
|
3897
4304
|
* ```typescript
|
|
3898
|
-
* const
|
|
3899
|
-
*
|
|
3900
|
-
*
|
|
3901
|
-
*
|
|
4305
|
+
* const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });
|
|
4306
|
+
* // With tint transform
|
|
4307
|
+
* const lightAccent = createSchemeColor({
|
|
4308
|
+
* value: SchemeColor.ACCENT1,
|
|
4309
|
+
* transforms: { tint: 40000 },
|
|
3902
4310
|
* });
|
|
3903
4311
|
* ```
|
|
3904
4312
|
*/
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
}));
|
|
3916
|
-
this.offset = new Offset((_options$offset = options.offset) === null || _options$offset === void 0 || (_options$offset = _options$offset.emus) === null || _options$offset === void 0 ? void 0 : _options$offset.x, (_options$offset2 = options.offset) === null || _options$offset2 === void 0 || (_options$offset2 = _options$offset2.emus) === null || _options$offset2 === void 0 ? void 0 : _options$offset2.y);
|
|
3917
|
-
this.extents = new Extents(options.emus.x, options.emus.y);
|
|
3918
|
-
this.root.push(this.offset);
|
|
3919
|
-
this.root.push(this.extents);
|
|
3920
|
-
}
|
|
4313
|
+
const createSchemeColor = (options) => {
|
|
4314
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4315
|
+
return new BuilderElement({
|
|
4316
|
+
attributes: { value: {
|
|
4317
|
+
key: "val",
|
|
4318
|
+
value: options.value
|
|
4319
|
+
} },
|
|
4320
|
+
children: [...transforms],
|
|
4321
|
+
name: "a:schemeClr"
|
|
4322
|
+
});
|
|
3921
4323
|
};
|
|
3922
4324
|
//#endregion
|
|
3923
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/
|
|
4325
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/system-color.ts
|
|
3924
4326
|
/**
|
|
3925
|
-
*
|
|
4327
|
+
* System color element for DrawingML.
|
|
3926
4328
|
*
|
|
3927
|
-
* This module provides
|
|
4329
|
+
* This module provides system color support, referencing OS-level UI colors.
|
|
4330
|
+
*
|
|
4331
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SystemColor / ST_SystemColorVal
|
|
3928
4332
|
*
|
|
3929
4333
|
* @module
|
|
3930
4334
|
*/
|
|
3931
4335
|
/**
|
|
3932
|
-
*
|
|
3933
|
-
*
|
|
3934
|
-
* Specifies that the outline or shape should have no fill applied.
|
|
4336
|
+
* System color values referencing OS UI colors.
|
|
3935
4337
|
*
|
|
3936
4338
|
* ## XSD Schema
|
|
3937
4339
|
* ```xml
|
|
3938
|
-
* <xsd:
|
|
4340
|
+
* <xsd:simpleType name="ST_SystemColorVal">
|
|
4341
|
+
* <xsd:restriction base="xsd:token">
|
|
4342
|
+
* <xsd:enumeration value="scrollBar"/>
|
|
4343
|
+
* <xsd:enumeration value="background"/>
|
|
4344
|
+
* ...
|
|
4345
|
+
* <xsd:enumeration value="menuBar"/>
|
|
4346
|
+
* </xsd:restriction>
|
|
4347
|
+
* </xsd:simpleType>
|
|
3939
4348
|
* ```
|
|
4349
|
+
*/
|
|
4350
|
+
const SystemColor = {
|
|
4351
|
+
SCROLL_BAR: "scrollBar",
|
|
4352
|
+
BACKGROUND: "background",
|
|
4353
|
+
ACTIVE_CAPTION: "activeCaption",
|
|
4354
|
+
INACTIVE_CAPTION: "inactiveCaption",
|
|
4355
|
+
MENU: "menu",
|
|
4356
|
+
WINDOW: "window",
|
|
4357
|
+
WINDOW_FRAME: "windowFrame",
|
|
4358
|
+
MENU_TEXT: "menuText",
|
|
4359
|
+
WINDOW_TEXT: "windowText",
|
|
4360
|
+
CAPTION_TEXT: "captionText",
|
|
4361
|
+
ACTIVE_BORDER: "activeBorder",
|
|
4362
|
+
INACTIVE_BORDER: "inactiveBorder",
|
|
4363
|
+
APP_WORKSPACE: "appWorkspace",
|
|
4364
|
+
HIGHLIGHT: "highlight",
|
|
4365
|
+
HIGHLIGHT_TEXT: "highlightText",
|
|
4366
|
+
BTN_FACE: "btnFace",
|
|
4367
|
+
BTN_SHADOW: "btnShadow",
|
|
4368
|
+
GRAY_TEXT: "grayText",
|
|
4369
|
+
BTN_TEXT: "btnText",
|
|
4370
|
+
INACTIVE_CAPTION_TEXT: "inactiveCaptionText",
|
|
4371
|
+
BTN_HIGHLIGHT: "btnHighlight",
|
|
4372
|
+
THREE_D_DK_SHADOW: "3dDkShadow",
|
|
4373
|
+
THREE_D_LIGHT: "3dLight",
|
|
4374
|
+
INFO_TEXT: "infoText",
|
|
4375
|
+
INFO_BK: "infoBk",
|
|
4376
|
+
HOT_LIGHT: "hotLight",
|
|
4377
|
+
GRADIENT_ACTIVE_CAPTION: "gradientActiveCaption",
|
|
4378
|
+
GRADIENT_INACTIVE_CAPTION: "gradientInactiveCaption",
|
|
4379
|
+
MENU_HIGHLIGHT: "menuHighlight",
|
|
4380
|
+
MENU_BAR: "menuBar"
|
|
4381
|
+
};
|
|
4382
|
+
/**
|
|
4383
|
+
* Creates a system color element.
|
|
4384
|
+
*
|
|
4385
|
+
* References a system-defined UI color (e.g., window background, button face).
|
|
3940
4386
|
*
|
|
3941
|
-
*
|
|
3942
|
-
* ```
|
|
3943
|
-
*
|
|
4387
|
+
* ## XSD Schema
|
|
4388
|
+
* ```xml
|
|
4389
|
+
* <xsd:complexType name="CT_SystemColor">
|
|
4390
|
+
* <xsd:sequence>
|
|
4391
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4392
|
+
* </xsd:sequence>
|
|
4393
|
+
* <xsd:attribute name="val" type="ST_SystemColorVal" use="required"/>
|
|
4394
|
+
* <xsd:attribute name="lastClr" type="s:ST_HexColorRGB" use="optional"/>
|
|
4395
|
+
* </xsd:complexType>
|
|
3944
4396
|
* ```
|
|
3945
4397
|
*/
|
|
3946
|
-
const
|
|
4398
|
+
const createSystemColor = (options) => {
|
|
4399
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4400
|
+
return new BuilderElement({
|
|
4401
|
+
attributes: {
|
|
4402
|
+
lastClr: {
|
|
4403
|
+
key: "lastClr",
|
|
4404
|
+
value: options.lastClr
|
|
4405
|
+
},
|
|
4406
|
+
value: {
|
|
4407
|
+
key: "val",
|
|
4408
|
+
value: options.value
|
|
4409
|
+
}
|
|
4410
|
+
},
|
|
4411
|
+
children: [...transforms],
|
|
4412
|
+
name: "a:sysClr"
|
|
4413
|
+
});
|
|
4414
|
+
};
|
|
3947
4415
|
//#endregion
|
|
3948
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/
|
|
4416
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/solid-fill.ts
|
|
3949
4417
|
/**
|
|
3950
|
-
*
|
|
4418
|
+
* Solid fill element for DrawingML shapes.
|
|
3951
4419
|
*
|
|
3952
|
-
* This module provides
|
|
4420
|
+
* This module provides solid fill support for outlines and shapes,
|
|
4421
|
+
* supporting RGB, scheme, HSL, system, and preset colors.
|
|
4422
|
+
*
|
|
4423
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SolidColorFillProperties
|
|
3953
4424
|
*
|
|
3954
4425
|
* @module
|
|
3955
4426
|
*/
|
|
3956
4427
|
/**
|
|
3957
|
-
* Creates
|
|
4428
|
+
* Creates the color child element for a solid fill based on the color type.
|
|
4429
|
+
*/
|
|
4430
|
+
const SYSTEM_COLOR_VALUES = new Set(Object.values(SystemColor));
|
|
4431
|
+
const PRESET_COLOR_VALUES = new Set(Object.values(PresetColor));
|
|
4432
|
+
const SCHEME_COLOR_VALUES = new Set(Object.values(SchemeColor));
|
|
4433
|
+
const createColorElement = (color) => {
|
|
4434
|
+
if ("hue" in color && "sat" in color && "lum" in color) return createHslColor(color);
|
|
4435
|
+
const colorValue = color.value;
|
|
4436
|
+
if (SYSTEM_COLOR_VALUES.has(colorValue)) return createSystemColor(color);
|
|
4437
|
+
if (PRESET_COLOR_VALUES.has(colorValue)) return createPresetColor(color);
|
|
4438
|
+
if (SCHEME_COLOR_VALUES.has(colorValue)) return createSchemeColor(color);
|
|
4439
|
+
return createRgbColor(color);
|
|
4440
|
+
};
|
|
4441
|
+
/**
|
|
4442
|
+
* Creates a solid fill element.
|
|
3958
4443
|
*
|
|
3959
|
-
* Specifies a color using
|
|
4444
|
+
* Specifies a solid color fill using any supported color type.
|
|
3960
4445
|
*
|
|
3961
4446
|
* ## XSD Schema
|
|
3962
4447
|
* ```xml
|
|
3963
|
-
* <xsd:complexType name="
|
|
4448
|
+
* <xsd:complexType name="CT_SolidColorFillProperties">
|
|
3964
4449
|
* <xsd:sequence>
|
|
3965
|
-
* <xsd:group ref="
|
|
4450
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="0"/>
|
|
4451
|
+
* <xsd:group ref="EG_EffectProperties" minOccurs="0"/>
|
|
3966
4452
|
* </xsd:sequence>
|
|
3967
|
-
* <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
|
|
3968
4453
|
* </xsd:complexType>
|
|
3969
4454
|
* ```
|
|
3970
4455
|
*
|
|
3971
4456
|
* @example
|
|
3972
4457
|
* ```typescript
|
|
3973
|
-
*
|
|
3974
|
-
* const
|
|
4458
|
+
* // RGB solid fill
|
|
4459
|
+
* const fill = createSolidFill({ value: "FF0000" });
|
|
4460
|
+
* // Scheme solid fill with tint
|
|
4461
|
+
* const schemeFill = createSolidFill({
|
|
4462
|
+
* value: SchemeColor.ACCENT1, transforms: { tint: 40000 },
|
|
4463
|
+
* });
|
|
4464
|
+
* // HSL solid fill
|
|
4465
|
+
* const hslFill = createSolidFill({ hue: 120000, sat: 100000, lum: 50000 });
|
|
3975
4466
|
* ```
|
|
3976
4467
|
*/
|
|
3977
|
-
const
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
4468
|
+
const createSolidFill = (options) => new BuilderElement({
|
|
4469
|
+
children: [createColorElement(options)],
|
|
4470
|
+
name: "a:solidFill"
|
|
4471
|
+
});
|
|
4472
|
+
//#endregion
|
|
4473
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/glow.ts
|
|
4474
|
+
/**
|
|
4475
|
+
* Glow effect for DrawingML shapes.
|
|
4476
|
+
*
|
|
4477
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GlowEffect
|
|
4478
|
+
*
|
|
4479
|
+
* @module
|
|
4480
|
+
*/
|
|
4481
|
+
/**
|
|
4482
|
+
* Creates a glow effect element.
|
|
4483
|
+
*
|
|
4484
|
+
* ## XSD Schema
|
|
4485
|
+
* ```xml
|
|
4486
|
+
* <xsd:complexType name="CT_GlowEffect">
|
|
4487
|
+
* <xsd:sequence>
|
|
4488
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4489
|
+
* </xsd:sequence>
|
|
4490
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="optional" default="0"/>
|
|
4491
|
+
* </xsd:complexType>
|
|
4492
|
+
* ```
|
|
4493
|
+
*/
|
|
4494
|
+
const createGlowEffect = (options) => {
|
|
4495
|
+
if (options.rad === void 0) return new BuilderElement({
|
|
4496
|
+
children: [createColorElement(options.color)],
|
|
4497
|
+
name: "a:glow"
|
|
4498
|
+
});
|
|
4499
|
+
return new BuilderElement({
|
|
4500
|
+
attributes: { rad: {
|
|
4501
|
+
key: "rad",
|
|
4502
|
+
value: options.rad
|
|
4503
|
+
} },
|
|
4504
|
+
children: [createColorElement(options.color)],
|
|
4505
|
+
name: "a:glow"
|
|
4506
|
+
});
|
|
4507
|
+
};
|
|
4508
|
+
//#endregion
|
|
4509
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/inner-shdw.ts
|
|
4510
|
+
/**
|
|
4511
|
+
* Inner shadow effect for DrawingML shapes.
|
|
4512
|
+
*
|
|
4513
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_InnerShadowEffect
|
|
4514
|
+
*
|
|
4515
|
+
* @module
|
|
4516
|
+
*/
|
|
4517
|
+
/**
|
|
4518
|
+
* Creates an inner shadow effect element.
|
|
4519
|
+
*
|
|
4520
|
+
* ## XSD Schema
|
|
4521
|
+
* ```xml
|
|
4522
|
+
* <xsd:complexType name="CT_InnerShadowEffect">
|
|
4523
|
+
* <xsd:sequence>
|
|
4524
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4525
|
+
* </xsd:sequence>
|
|
4526
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4527
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4528
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4529
|
+
* </xsd:complexType>
|
|
4530
|
+
* ```
|
|
4531
|
+
*/
|
|
4532
|
+
const createInnerShadowEffect = (options) => {
|
|
4533
|
+
if (!(options.blurRad !== void 0 || options.dist !== void 0 || options.dir !== void 0)) return new BuilderElement({
|
|
4534
|
+
children: [createColorElement(options.color)],
|
|
4535
|
+
name: "a:innerShdw"
|
|
4536
|
+
});
|
|
4537
|
+
return new BuilderElement({
|
|
4538
|
+
attributes: {
|
|
4539
|
+
...options.blurRad !== void 0 && { blurRad: {
|
|
4540
|
+
key: "blurRad",
|
|
4541
|
+
value: options.blurRad
|
|
4542
|
+
} },
|
|
4543
|
+
...options.dist !== void 0 && { dist: {
|
|
4544
|
+
key: "dist",
|
|
4545
|
+
value: options.dist
|
|
4546
|
+
} },
|
|
4547
|
+
...options.dir !== void 0 && { dir: {
|
|
4548
|
+
key: "dir",
|
|
4549
|
+
value: options.dir
|
|
4550
|
+
} }
|
|
4551
|
+
},
|
|
4552
|
+
children: [createColorElement(options.color)],
|
|
4553
|
+
name: "a:innerShdw"
|
|
4554
|
+
});
|
|
4555
|
+
};
|
|
4556
|
+
//#endregion
|
|
4557
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/outer-shdw.ts
|
|
4558
|
+
/**
|
|
4559
|
+
* Outer shadow effect for DrawingML shapes.
|
|
4560
|
+
*
|
|
4561
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_OuterShadowEffect
|
|
4562
|
+
*
|
|
4563
|
+
* @module
|
|
4564
|
+
*/
|
|
4565
|
+
/**
|
|
4566
|
+
* Rectangle alignment for shadow positioning.
|
|
4567
|
+
*/
|
|
4568
|
+
const RectAlignment = {
|
|
4569
|
+
TOP_LEFT: "tl",
|
|
4570
|
+
TOP: "t",
|
|
4571
|
+
TOP_RIGHT: "tr",
|
|
4572
|
+
LEFT: "l",
|
|
4573
|
+
CENTER: "ctr",
|
|
4574
|
+
RIGHT: "r",
|
|
4575
|
+
BOTTOM_LEFT: "bl",
|
|
4576
|
+
BOTTOM: "b",
|
|
4577
|
+
BOTTOM_RIGHT: "br"
|
|
4578
|
+
};
|
|
4579
|
+
/**
|
|
4580
|
+
* Creates an outer shadow effect element.
|
|
4581
|
+
*
|
|
4582
|
+
* ## XSD Schema
|
|
4583
|
+
* ```xml
|
|
4584
|
+
* <xsd:complexType name="CT_OuterShadowEffect">
|
|
4585
|
+
* <xsd:sequence>
|
|
4586
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4587
|
+
* </xsd:sequence>
|
|
4588
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4589
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4590
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4591
|
+
* <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
|
|
4592
|
+
* <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
|
|
4593
|
+
* <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
|
|
4594
|
+
* <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
|
|
4595
|
+
* <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
|
|
4596
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
|
|
4597
|
+
* </xsd:complexType>
|
|
4598
|
+
* ```
|
|
4599
|
+
*/
|
|
4600
|
+
const createOuterShadowEffect = (options) => {
|
|
4601
|
+
const attributes = {};
|
|
4602
|
+
if (options.blurRad !== void 0) attributes.blurRad = {
|
|
4603
|
+
key: "blurRad",
|
|
4604
|
+
value: options.blurRad
|
|
4605
|
+
};
|
|
4606
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4607
|
+
key: "dist",
|
|
4608
|
+
value: options.dist
|
|
4609
|
+
};
|
|
4610
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4611
|
+
key: "dir",
|
|
4612
|
+
value: options.dir
|
|
4613
|
+
};
|
|
4614
|
+
if (options.sx !== void 0) attributes.sx = {
|
|
4615
|
+
key: "sx",
|
|
4616
|
+
value: options.sx
|
|
4617
|
+
};
|
|
4618
|
+
if (options.sy !== void 0) attributes.sy = {
|
|
4619
|
+
key: "sy",
|
|
4620
|
+
value: options.sy
|
|
4621
|
+
};
|
|
4622
|
+
if (options.kx !== void 0) attributes.kx = {
|
|
4623
|
+
key: "kx",
|
|
4624
|
+
value: options.kx
|
|
4625
|
+
};
|
|
4626
|
+
if (options.ky !== void 0) attributes.ky = {
|
|
4627
|
+
key: "ky",
|
|
4628
|
+
value: options.ky
|
|
4629
|
+
};
|
|
4630
|
+
if (options.algn !== void 0) attributes.algn = {
|
|
4631
|
+
key: "algn",
|
|
4632
|
+
value: RectAlignment[options.algn]
|
|
4633
|
+
};
|
|
4634
|
+
if (options.rotWithShape === false) attributes.rotWithShape = {
|
|
4635
|
+
key: "rotWithShape",
|
|
4636
|
+
value: 0
|
|
4637
|
+
};
|
|
4638
|
+
return new BuilderElement({
|
|
4639
|
+
attributes,
|
|
4640
|
+
children: [createColorElement(options.color)],
|
|
4641
|
+
name: "a:outerShdw"
|
|
4642
|
+
});
|
|
4643
|
+
};
|
|
4644
|
+
//#endregion
|
|
4645
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/prst-shdw.ts
|
|
4646
|
+
/**
|
|
4647
|
+
* Preset shadow effect for DrawingML shapes.
|
|
4648
|
+
*
|
|
4649
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetShadowEffect
|
|
4650
|
+
*
|
|
4651
|
+
* @module
|
|
4652
|
+
*/
|
|
4653
|
+
/**
|
|
4654
|
+
* Preset shadow types (20 variations).
|
|
4655
|
+
*
|
|
4656
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetShadowVal
|
|
4657
|
+
*/
|
|
4658
|
+
const PresetShadowVal = {
|
|
4659
|
+
SHDW1: "shdw1",
|
|
4660
|
+
SHDW2: "shdw2",
|
|
4661
|
+
SHDW3: "shdw3",
|
|
4662
|
+
SHDW4: "shdw4",
|
|
4663
|
+
SHDW5: "shdw5",
|
|
4664
|
+
SHDW6: "shdw6",
|
|
4665
|
+
SHDW7: "shdw7",
|
|
4666
|
+
SHDW8: "shdw8",
|
|
4667
|
+
SHDW9: "shdw9",
|
|
4668
|
+
SHDW10: "shdw10",
|
|
4669
|
+
SHDW11: "shdw11",
|
|
4670
|
+
SHDW12: "shdw12",
|
|
4671
|
+
SHDW13: "shdw13",
|
|
4672
|
+
SHDW14: "shdw14",
|
|
4673
|
+
SHDW15: "shdw15",
|
|
4674
|
+
SHDW16: "shdw16",
|
|
4675
|
+
SHDW17: "shdw17",
|
|
4676
|
+
SHDW18: "shdw18",
|
|
4677
|
+
SHDW19: "shdw19",
|
|
4678
|
+
SHDW20: "shdw20"
|
|
4679
|
+
};
|
|
4680
|
+
/**
|
|
4681
|
+
* Creates a preset shadow effect element.
|
|
4682
|
+
*
|
|
4683
|
+
* ## XSD Schema
|
|
4684
|
+
* ```xml
|
|
4685
|
+
* <xsd:complexType name="CT_PresetShadowEffect">
|
|
4686
|
+
* <xsd:sequence>
|
|
4687
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4688
|
+
* </xsd:sequence>
|
|
4689
|
+
* <xsd:attribute name="prst" type="ST_PresetShadowVal" use="required"/>
|
|
4690
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4691
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4692
|
+
* </xsd:complexType>
|
|
4693
|
+
* ```
|
|
4694
|
+
*/
|
|
4695
|
+
const createPresetShadowEffect = (options) => {
|
|
4696
|
+
const attributes = { prst: {
|
|
4697
|
+
key: "prst",
|
|
4698
|
+
value: PresetShadowVal[options.prst]
|
|
4699
|
+
} };
|
|
4700
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4701
|
+
key: "dist",
|
|
4702
|
+
value: options.dist
|
|
4703
|
+
};
|
|
4704
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4705
|
+
key: "dir",
|
|
4706
|
+
value: options.dir
|
|
4707
|
+
};
|
|
4708
|
+
return new BuilderElement({
|
|
4709
|
+
attributes,
|
|
4710
|
+
children: [createColorElement(options.color)],
|
|
4711
|
+
name: "a:prstShdw"
|
|
4712
|
+
});
|
|
4713
|
+
};
|
|
4714
|
+
//#endregion
|
|
4715
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/reflection.ts
|
|
4716
|
+
/**
|
|
4717
|
+
* Reflection effect for DrawingML shapes.
|
|
4718
|
+
*
|
|
4719
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ReflectionEffect
|
|
4720
|
+
*
|
|
4721
|
+
* @module
|
|
4722
|
+
*/
|
|
4723
|
+
/**
|
|
4724
|
+
* Creates a reflection effect element.
|
|
4725
|
+
*
|
|
4726
|
+
* ## XSD Schema
|
|
4727
|
+
* ```xml
|
|
4728
|
+
* <xsd:complexType name="CT_ReflectionEffect">
|
|
4729
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4730
|
+
* <xsd:attribute name="stA" type="ST_PositiveFixedPercentage" default="100%"/>
|
|
4731
|
+
* <xsd:attribute name="stPos" type="ST_PositiveFixedPercentage" default="0%"/>
|
|
4732
|
+
* <xsd:attribute name="endA" type="ST_PositiveFixedPercentage" default="0%"/>
|
|
4733
|
+
* <xsd:attribute name="endPos" type="ST_PositiveFixedPercentage" default="100%"/>
|
|
4734
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4735
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4736
|
+
* <xsd:attribute name="fadeDir" type="ST_PositiveFixedAngle" default="5400000"/>
|
|
4737
|
+
* <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
|
|
4738
|
+
* <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
|
|
4739
|
+
* <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
|
|
4740
|
+
* <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
|
|
4741
|
+
* <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
|
|
4742
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
|
|
4743
|
+
* </xsd:complexType>
|
|
4744
|
+
* ```
|
|
4745
|
+
*/
|
|
4746
|
+
const createReflectionEffect = (options) => {
|
|
4747
|
+
if (!options) return new BuilderElement({ name: "a:reflection" });
|
|
4748
|
+
const attributes = {};
|
|
4749
|
+
if (options.blurRad !== void 0) attributes.blurRad = {
|
|
4750
|
+
key: "blurRad",
|
|
4751
|
+
value: options.blurRad
|
|
4752
|
+
};
|
|
4753
|
+
if (options.stA !== void 0) attributes.stA = {
|
|
4754
|
+
key: "stA",
|
|
4755
|
+
value: options.stA
|
|
4756
|
+
};
|
|
4757
|
+
if (options.stPos !== void 0) attributes.stPos = {
|
|
4758
|
+
key: "stPos",
|
|
4759
|
+
value: options.stPos
|
|
4760
|
+
};
|
|
4761
|
+
if (options.endA !== void 0) attributes.endA = {
|
|
4762
|
+
key: "endA",
|
|
4763
|
+
value: options.endA
|
|
4764
|
+
};
|
|
4765
|
+
if (options.endPos !== void 0) attributes.endPos = {
|
|
4766
|
+
key: "endPos",
|
|
4767
|
+
value: options.endPos
|
|
4768
|
+
};
|
|
4769
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4770
|
+
key: "dist",
|
|
4771
|
+
value: options.dist
|
|
4772
|
+
};
|
|
4773
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4774
|
+
key: "dir",
|
|
4775
|
+
value: options.dir
|
|
4776
|
+
};
|
|
4777
|
+
if (options.fadeDir !== void 0) attributes.fadeDir = {
|
|
4778
|
+
key: "fadeDir",
|
|
4779
|
+
value: options.fadeDir
|
|
4780
|
+
};
|
|
4781
|
+
if (options.sx !== void 0) attributes.sx = {
|
|
4782
|
+
key: "sx",
|
|
4783
|
+
value: options.sx
|
|
4784
|
+
};
|
|
4785
|
+
if (options.sy !== void 0) attributes.sy = {
|
|
4786
|
+
key: "sy",
|
|
4787
|
+
value: options.sy
|
|
4788
|
+
};
|
|
4789
|
+
if (options.kx !== void 0) attributes.kx = {
|
|
4790
|
+
key: "kx",
|
|
4791
|
+
value: options.kx
|
|
4792
|
+
};
|
|
4793
|
+
if (options.ky !== void 0) attributes.ky = {
|
|
4794
|
+
key: "ky",
|
|
4795
|
+
value: options.ky
|
|
4796
|
+
};
|
|
4797
|
+
if (options.algn !== void 0) attributes.algn = {
|
|
4798
|
+
key: "algn",
|
|
4799
|
+
value: options.algn
|
|
4800
|
+
};
|
|
4801
|
+
if (options.rotWithShape === false) attributes.rotWithShape = {
|
|
4802
|
+
key: "rotWithShape",
|
|
4803
|
+
value: 0
|
|
4804
|
+
};
|
|
4805
|
+
return new BuilderElement({
|
|
4806
|
+
attributes,
|
|
4807
|
+
name: "a:reflection"
|
|
4808
|
+
});
|
|
4809
|
+
};
|
|
4810
|
+
//#endregion
|
|
4811
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/soft-edge.ts
|
|
4812
|
+
/**
|
|
4813
|
+
* Soft edge effect for DrawingML shapes.
|
|
4814
|
+
*
|
|
4815
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SoftEdgesEffect
|
|
4816
|
+
*
|
|
4817
|
+
* @module
|
|
4818
|
+
*/
|
|
4819
|
+
/**
|
|
4820
|
+
* Creates a soft edge effect element.
|
|
4821
|
+
*
|
|
4822
|
+
* ## XSD Schema
|
|
4823
|
+
* ```xml
|
|
4824
|
+
* <xsd:complexType name="CT_SoftEdgesEffect">
|
|
4825
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="required"/>
|
|
4826
|
+
* </xsd:complexType>
|
|
4827
|
+
* ```
|
|
4828
|
+
*
|
|
4829
|
+
* @param rad - Soft edge radius in EMUs (required)
|
|
4830
|
+
*/
|
|
4831
|
+
const createSoftEdgeEffect = (rad) => new BuilderElement({
|
|
4832
|
+
attributes: { rad: {
|
|
4833
|
+
key: "rad",
|
|
4834
|
+
value: rad
|
|
3981
4835
|
} },
|
|
3982
|
-
name: "a:
|
|
4836
|
+
name: "a:softEdge"
|
|
3983
4837
|
});
|
|
3984
4838
|
//#endregion
|
|
3985
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
4839
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/effect-list.ts
|
|
3986
4840
|
/**
|
|
3987
|
-
*
|
|
4841
|
+
* Effect list container for DrawingML shapes.
|
|
3988
4842
|
*
|
|
3989
|
-
*
|
|
3990
|
-
* allowing colors to be defined using theme color schemes.
|
|
4843
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectList, EG_EffectProperties
|
|
3991
4844
|
*
|
|
3992
4845
|
* @module
|
|
3993
4846
|
*/
|
|
3994
4847
|
/**
|
|
3995
|
-
* Creates a
|
|
4848
|
+
* Creates a blur effect element.
|
|
3996
4849
|
*
|
|
3997
|
-
*
|
|
4850
|
+
* ## XSD Schema
|
|
4851
|
+
* ```xml
|
|
4852
|
+
* <xsd:complexType name="CT_BlurEffect">
|
|
4853
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" default="0"/>
|
|
4854
|
+
* <xsd:attribute name="grow" type="xsd:boolean" default="true"/>
|
|
4855
|
+
* </xsd:complexType>
|
|
4856
|
+
* ```
|
|
4857
|
+
*/
|
|
4858
|
+
const createBlurEffect = (options) => {
|
|
4859
|
+
if (!(options.rad !== void 0 || options.grow === false)) return new BuilderElement({ name: "a:blur" });
|
|
4860
|
+
return new BuilderElement({
|
|
4861
|
+
attributes: {
|
|
4862
|
+
...options.rad !== void 0 && { rad: {
|
|
4863
|
+
key: "rad",
|
|
4864
|
+
value: options.rad
|
|
4865
|
+
} },
|
|
4866
|
+
...options.grow === false && { grow: {
|
|
4867
|
+
key: "grow",
|
|
4868
|
+
value: 0
|
|
4869
|
+
} }
|
|
4870
|
+
},
|
|
4871
|
+
name: "a:blur"
|
|
4872
|
+
});
|
|
4873
|
+
};
|
|
4874
|
+
/**
|
|
4875
|
+
* Creates an effect list element (a:effectLst).
|
|
4876
|
+
*
|
|
4877
|
+
* This is the EG_EffectProperties choice for a flat list of effects.
|
|
4878
|
+
* Effects are emitted in XSD order: blur, glow, innerShdw, outerShdw, prstShdw, reflection, softEdge.
|
|
3998
4879
|
*
|
|
3999
4880
|
* ## XSD Schema
|
|
4000
4881
|
* ```xml
|
|
4001
|
-
* <xsd:complexType name="
|
|
4882
|
+
* <xsd:complexType name="CT_EffectList">
|
|
4002
4883
|
* <xsd:sequence>
|
|
4003
|
-
* <xsd:
|
|
4884
|
+
* <xsd:element name="blur" type="CT_BlurEffect" minOccurs="0"/>
|
|
4885
|
+
* <xsd:element name="fillOverlay" type="CT_FillOverlayEffect" minOccurs="0"/>
|
|
4886
|
+
* <xsd:element name="glow" type="CT_GlowEffect" minOccurs="0"/>
|
|
4887
|
+
* <xsd:element name="innerShdw" type="CT_InnerShadowEffect" minOccurs="0"/>
|
|
4888
|
+
* <xsd:element name="outerShdw" type="CT_OuterShadowEffect" minOccurs="0"/>
|
|
4889
|
+
* <xsd:element name="prstShdw" type="CT_PresetShadowEffect" minOccurs="0"/>
|
|
4890
|
+
* <xsd:element name="reflection" type="CT_ReflectionEffect" minOccurs="0"/>
|
|
4891
|
+
* <xsd:element name="softEdge" type="CT_SoftEdgesEffect" minOccurs="0"/>
|
|
4004
4892
|
* </xsd:sequence>
|
|
4005
|
-
* <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
|
|
4006
4893
|
* </xsd:complexType>
|
|
4007
4894
|
* ```
|
|
4895
|
+
*/
|
|
4896
|
+
const createEffectList = (options) => {
|
|
4897
|
+
const children = [];
|
|
4898
|
+
if (options.blur) children.push(createBlurEffect(options.blur));
|
|
4899
|
+
if (options.glow) children.push(createGlowEffect(options.glow));
|
|
4900
|
+
if (options.innerShdw) children.push(createInnerShadowEffect(options.innerShdw));
|
|
4901
|
+
if (options.outerShdw) children.push(createOuterShadowEffect(options.outerShdw));
|
|
4902
|
+
if (options.prstShdw) children.push(createPresetShadowEffect(options.prstShdw));
|
|
4903
|
+
if (options.reflection) children.push(createReflectionEffect(options.reflection === true ? void 0 : options.reflection));
|
|
4904
|
+
if (options.softEdge !== void 0) children.push(createSoftEdgeEffect(options.softEdge));
|
|
4905
|
+
return new BuilderElement({
|
|
4906
|
+
children,
|
|
4907
|
+
name: "a:effectLst"
|
|
4908
|
+
});
|
|
4909
|
+
};
|
|
4910
|
+
//#endregion
|
|
4911
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/fill/gradient-fill.ts
|
|
4912
|
+
/**
|
|
4913
|
+
* Gradient fill element for DrawingML shapes.
|
|
4914
|
+
*
|
|
4915
|
+
* This module provides gradient fill support with linear and path shading.
|
|
4916
|
+
*
|
|
4917
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GradientFillProperties
|
|
4918
|
+
*
|
|
4919
|
+
* @module
|
|
4920
|
+
*/
|
|
4921
|
+
/**
|
|
4922
|
+
* Path shade type for radial gradients.
|
|
4923
|
+
*/
|
|
4924
|
+
const PathShadeType = {
|
|
4925
|
+
SHAPE: "shape",
|
|
4926
|
+
CIRCLE: "circle",
|
|
4927
|
+
RECT: "rect"
|
|
4928
|
+
};
|
|
4929
|
+
/**
|
|
4930
|
+
* Creates a gradient stop element (a:gs).
|
|
4008
4931
|
*
|
|
4009
4932
|
* @example
|
|
4010
4933
|
* ```typescript
|
|
4011
|
-
*
|
|
4012
|
-
*
|
|
4934
|
+
* createGradientStop({ position: 0, color: { value: "FF0000" } });
|
|
4935
|
+
* createGradientStop({ position: 100000, color: { value: "0000FF" } });
|
|
4013
4936
|
* ```
|
|
4014
4937
|
*/
|
|
4015
|
-
const
|
|
4016
|
-
attributes: {
|
|
4017
|
-
key: "
|
|
4018
|
-
value:
|
|
4938
|
+
const createGradientStop = (stop) => new BuilderElement({
|
|
4939
|
+
attributes: { pos: {
|
|
4940
|
+
key: "pos",
|
|
4941
|
+
value: stop.position
|
|
4019
4942
|
} },
|
|
4020
|
-
|
|
4943
|
+
children: [createColorElement(stop.color)],
|
|
4944
|
+
name: "a:gs"
|
|
4021
4945
|
});
|
|
4946
|
+
/**
|
|
4947
|
+
* Creates the shade element (a:lin or a:path).
|
|
4948
|
+
*/
|
|
4949
|
+
const createShadeElement = (shade) => {
|
|
4950
|
+
if ("angle" in shade) return new BuilderElement({
|
|
4951
|
+
attributes: {
|
|
4952
|
+
ang: {
|
|
4953
|
+
key: "ang",
|
|
4954
|
+
value: shade.angle
|
|
4955
|
+
},
|
|
4956
|
+
scaled: {
|
|
4957
|
+
key: "scaled",
|
|
4958
|
+
value: shade.scaled
|
|
4959
|
+
}
|
|
4960
|
+
},
|
|
4961
|
+
name: "a:lin"
|
|
4962
|
+
});
|
|
4963
|
+
const pathShade = shade;
|
|
4964
|
+
return new BuilderElement({
|
|
4965
|
+
attributes: { path: {
|
|
4966
|
+
key: "path",
|
|
4967
|
+
value: pathShade.path ? PathShadeType[pathShade.path] : void 0
|
|
4968
|
+
} },
|
|
4969
|
+
name: "a:path"
|
|
4970
|
+
});
|
|
4971
|
+
};
|
|
4972
|
+
/**
|
|
4973
|
+
* Creates a gradient fill element.
|
|
4974
|
+
*
|
|
4975
|
+
* ## XSD Schema
|
|
4976
|
+
* ```xml
|
|
4977
|
+
* <xsd:complexType name="CT_GradientFillProperties">
|
|
4978
|
+
* <xsd:sequence>
|
|
4979
|
+
* <xsd:element name="gsLst" type="CT_GradientStopList" minOccurs="0"/>
|
|
4980
|
+
* <xsd:group ref="EG_ShadeProperties" minOccurs="0"/>
|
|
4981
|
+
* </xsd:sequence>
|
|
4982
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" use="optional"/>
|
|
4983
|
+
* </xsd:complexType>
|
|
4984
|
+
* ```
|
|
4985
|
+
*
|
|
4986
|
+
* @example
|
|
4987
|
+
* ```typescript
|
|
4988
|
+
* // Linear gradient from red to blue
|
|
4989
|
+
* createGradientFill({
|
|
4990
|
+
* stops: [
|
|
4991
|
+
* { position: 0, color: { value: "FF0000" } },
|
|
4992
|
+
* { position: 100000, color: { value: "0000FF" } },
|
|
4993
|
+
* ],
|
|
4994
|
+
* shade: { angle: 5400000 },
|
|
4995
|
+
* });
|
|
4996
|
+
* ```
|
|
4997
|
+
*/
|
|
4998
|
+
const createGradientFill = (options) => {
|
|
4999
|
+
const children = [];
|
|
5000
|
+
children.push(new BuilderElement({
|
|
5001
|
+
children: options.stops.map(createGradientStop),
|
|
5002
|
+
name: "a:gsLst"
|
|
5003
|
+
}));
|
|
5004
|
+
if (options.shade) children.push(createShadeElement(options.shade));
|
|
5005
|
+
return new BuilderElement({
|
|
5006
|
+
attributes: { rotWithShape: {
|
|
5007
|
+
key: "rotWithShape",
|
|
5008
|
+
value: options.rotateWithShape
|
|
5009
|
+
} },
|
|
5010
|
+
children,
|
|
5011
|
+
name: "a:gradFill"
|
|
5012
|
+
});
|
|
5013
|
+
};
|
|
4022
5014
|
//#endregion
|
|
4023
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
5015
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/extents/extents-attributes.ts
|
|
4024
5016
|
/**
|
|
4025
|
-
*
|
|
5017
|
+
* Extents attributes for DrawingML shapes.
|
|
4026
5018
|
*
|
|
4027
|
-
* This module
|
|
4028
|
-
* supporting both RGB and scheme-based colors.
|
|
5019
|
+
* This module defines the width and height attributes for shape extents.
|
|
4029
5020
|
*
|
|
4030
5021
|
* @module
|
|
4031
5022
|
*/
|
|
4032
5023
|
/**
|
|
4033
|
-
*
|
|
5024
|
+
* Attributes for shape extents (size).
|
|
4034
5025
|
*
|
|
4035
|
-
*
|
|
5026
|
+
* Defines the width (cx) and height (cy) in EMUs.
|
|
4036
5027
|
*
|
|
4037
5028
|
* ## XSD Schema
|
|
4038
5029
|
* ```xml
|
|
4039
|
-
* <xsd:
|
|
5030
|
+
* <xsd:attribute name="cx" type="ST_PositiveCoordinate" use="required"/>
|
|
5031
|
+
* <xsd:attribute name="cy" type="ST_PositiveCoordinate" use="required"/>
|
|
5032
|
+
* ```
|
|
5033
|
+
*
|
|
5034
|
+
* @internal
|
|
5035
|
+
*/
|
|
5036
|
+
var ExtentsAttributes = class extends XmlAttributeComponent {
|
|
5037
|
+
constructor(..._args) {
|
|
5038
|
+
super(..._args);
|
|
5039
|
+
_defineProperty(this, "xmlKeys", {
|
|
5040
|
+
cx: "cx",
|
|
5041
|
+
cy: "cy"
|
|
5042
|
+
});
|
|
5043
|
+
}
|
|
5044
|
+
};
|
|
5045
|
+
//#endregion
|
|
5046
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/extents/extents.ts
|
|
5047
|
+
/**
|
|
5048
|
+
* Extents (size) element for DrawingML shapes.
|
|
5049
|
+
*
|
|
5050
|
+
* This module defines the size of a shape or picture in EMUs.
|
|
5051
|
+
*
|
|
5052
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5053
|
+
*
|
|
5054
|
+
* @module
|
|
5055
|
+
*/
|
|
5056
|
+
/**
|
|
5057
|
+
* Represents the extents (size) of a DrawingML shape.
|
|
5058
|
+
*
|
|
5059
|
+
* Defines the width and height of the shape in English Metric Units (EMUs).
|
|
5060
|
+
* One EMU equals 1/914,400 of an inch.
|
|
5061
|
+
*
|
|
5062
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5063
|
+
*
|
|
5064
|
+
* ## XSD Schema
|
|
5065
|
+
* ```xml
|
|
5066
|
+
* <xsd:complexType name="CT_PositiveSize2D">
|
|
5067
|
+
* <xsd:attribute name="cx" type="ST_PositiveCoordinate" use="required"/>
|
|
5068
|
+
* <xsd:attribute name="cy" type="ST_PositiveCoordinate" use="required"/>
|
|
5069
|
+
* </xsd:complexType>
|
|
5070
|
+
* ```
|
|
5071
|
+
*
|
|
5072
|
+
* @example
|
|
5073
|
+
* ```typescript
|
|
5074
|
+
* // Create a 1-inch by 1-inch shape
|
|
5075
|
+
* const extents = new Extents(914400, 914400);
|
|
5076
|
+
* ```
|
|
5077
|
+
*/
|
|
5078
|
+
var Extents = class extends XmlComponent {
|
|
5079
|
+
constructor(x, y) {
|
|
5080
|
+
super("a:ext");
|
|
5081
|
+
_defineProperty(this, "attributes", void 0);
|
|
5082
|
+
this.attributes = new ExtentsAttributes({
|
|
5083
|
+
cx: x,
|
|
5084
|
+
cy: y
|
|
5085
|
+
});
|
|
5086
|
+
this.root.push(this.attributes);
|
|
5087
|
+
}
|
|
5088
|
+
};
|
|
5089
|
+
//#endregion
|
|
5090
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/offset/off-attributes.ts
|
|
5091
|
+
/**
|
|
5092
|
+
* Offset attributes for DrawingML shapes.
|
|
5093
|
+
*
|
|
5094
|
+
* This module defines the x and y coordinate attributes for shape offset.
|
|
5095
|
+
*
|
|
5096
|
+
* @module
|
|
5097
|
+
*/
|
|
5098
|
+
/**
|
|
5099
|
+
* Attributes for shape offset (position).
|
|
5100
|
+
*
|
|
5101
|
+
* Defines the x and y coordinates in EMUs.
|
|
5102
|
+
*
|
|
5103
|
+
* ## XSD Schema
|
|
5104
|
+
* ```xml
|
|
5105
|
+
* <xsd:attribute name="x" type="ST_Coordinate" use="required"/>
|
|
5106
|
+
* <xsd:attribute name="y" type="ST_Coordinate" use="required"/>
|
|
5107
|
+
* ```
|
|
5108
|
+
*
|
|
5109
|
+
* @internal
|
|
5110
|
+
*/
|
|
5111
|
+
var OffsetAttributes = class extends XmlAttributeComponent {
|
|
5112
|
+
constructor(..._args) {
|
|
5113
|
+
super(..._args);
|
|
5114
|
+
_defineProperty(this, "xmlKeys", {
|
|
5115
|
+
x: "x",
|
|
5116
|
+
y: "y"
|
|
5117
|
+
});
|
|
5118
|
+
}
|
|
5119
|
+
};
|
|
5120
|
+
//#endregion
|
|
5121
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/offset/off.ts
|
|
5122
|
+
/**
|
|
5123
|
+
* Offset (position) element for DrawingML shapes.
|
|
5124
|
+
*
|
|
5125
|
+
* This module defines the position of a shape or picture in EMUs.
|
|
5126
|
+
*
|
|
5127
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5128
|
+
*
|
|
5129
|
+
* @module
|
|
5130
|
+
*/
|
|
5131
|
+
/**
|
|
5132
|
+
* Represents the offset (position) of a DrawingML shape.
|
|
5133
|
+
*
|
|
5134
|
+
* Defines the x and y coordinates of the shape's position in
|
|
5135
|
+
* English Metric Units (EMUs). One EMU equals 1/914,400 of an inch.
|
|
5136
|
+
*
|
|
5137
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5138
|
+
*
|
|
5139
|
+
* ## XSD Schema
|
|
5140
|
+
* ```xml
|
|
5141
|
+
* <xsd:complexType name="CT_Point2D">
|
|
5142
|
+
* <xsd:attribute name="x" type="ST_Coordinate" use="required"/>
|
|
5143
|
+
* <xsd:attribute name="y" type="ST_Coordinate" use="required"/>
|
|
5144
|
+
* </xsd:complexType>
|
|
5145
|
+
* ```
|
|
5146
|
+
*
|
|
5147
|
+
* @example
|
|
5148
|
+
* ```typescript
|
|
5149
|
+
* const offset = new Offset();
|
|
5150
|
+
* ```
|
|
5151
|
+
*/
|
|
5152
|
+
var Offset = class extends XmlComponent {
|
|
5153
|
+
constructor(x, y) {
|
|
5154
|
+
super("a:off");
|
|
5155
|
+
this.root.push(new OffsetAttributes({
|
|
5156
|
+
x: x !== null && x !== void 0 ? x : 0,
|
|
5157
|
+
y: y !== null && y !== void 0 ? y : 0
|
|
5158
|
+
}));
|
|
5159
|
+
}
|
|
5160
|
+
};
|
|
5161
|
+
//#endregion
|
|
5162
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/form.ts
|
|
5163
|
+
/**
|
|
5164
|
+
* Attributes for 2D transformation.
|
|
5165
|
+
*
|
|
5166
|
+
* Defines flip and rotation properties.
|
|
5167
|
+
*/
|
|
5168
|
+
var FormAttributes = class extends XmlAttributeComponent {
|
|
5169
|
+
constructor(..._args) {
|
|
5170
|
+
super(..._args);
|
|
5171
|
+
_defineProperty(this, "xmlKeys", {
|
|
5172
|
+
flipHorizontal: "flipH",
|
|
5173
|
+
flipVertical: "flipV",
|
|
5174
|
+
rotation: "rot"
|
|
5175
|
+
});
|
|
5176
|
+
}
|
|
5177
|
+
};
|
|
5178
|
+
/**
|
|
5179
|
+
* Represents a 2D transformation for DrawingML objects.
|
|
5180
|
+
*
|
|
5181
|
+
* This element defines how a shape or picture is positioned, sized,
|
|
5182
|
+
* rotated, and flipped within the document.
|
|
5183
|
+
*
|
|
5184
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5185
|
+
*
|
|
5186
|
+
* ## XSD Schema
|
|
5187
|
+
* ```xml
|
|
5188
|
+
* <xsd:complexType name="CT_Transform2D">
|
|
4040
5189
|
* <xsd:sequence>
|
|
4041
|
-
* <xsd:
|
|
4042
|
-
* <xsd:
|
|
5190
|
+
* <xsd:element name="off" type="CT_Point2D" minOccurs="0"/>
|
|
5191
|
+
* <xsd:element name="ext" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
4043
5192
|
* </xsd:sequence>
|
|
5193
|
+
* <xsd:attribute name="rot" type="ST_Angle" use="optional"/>
|
|
5194
|
+
* <xsd:attribute name="flipH" type="xsd:boolean" use="optional"/>
|
|
5195
|
+
* <xsd:attribute name="flipV" type="xsd:boolean" use="optional"/>
|
|
4044
5196
|
* </xsd:complexType>
|
|
4045
5197
|
* ```
|
|
4046
5198
|
*
|
|
4047
5199
|
* @example
|
|
4048
5200
|
* ```typescript
|
|
4049
|
-
*
|
|
4050
|
-
*
|
|
4051
|
-
*
|
|
4052
|
-
*
|
|
4053
|
-
* });
|
|
4054
|
-
*
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
5201
|
+
* const form = new Form({
|
|
5202
|
+
* emus: { x: 914400, y: 914400 },
|
|
5203
|
+
* flip: { horizontal: true, vertical: false },
|
|
5204
|
+
* rotation: 450000 // 7.5 degrees
|
|
5205
|
+
* });
|
|
5206
|
+
* ```
|
|
5207
|
+
*/
|
|
5208
|
+
var Form = class extends XmlComponent {
|
|
5209
|
+
constructor(options) {
|
|
5210
|
+
var _options$flip, _options$flip2, _options$offset, _options$offset2;
|
|
5211
|
+
super("a:xfrm");
|
|
5212
|
+
_defineProperty(this, "extents", void 0);
|
|
5213
|
+
_defineProperty(this, "offset", void 0);
|
|
5214
|
+
this.root.push(new FormAttributes({
|
|
5215
|
+
flipHorizontal: (_options$flip = options.flip) === null || _options$flip === void 0 ? void 0 : _options$flip.horizontal,
|
|
5216
|
+
flipVertical: (_options$flip2 = options.flip) === null || _options$flip2 === void 0 ? void 0 : _options$flip2.vertical,
|
|
5217
|
+
rotation: options.rotation
|
|
5218
|
+
}));
|
|
5219
|
+
this.offset = new Offset((_options$offset = options.offset) === null || _options$offset === void 0 || (_options$offset = _options$offset.emus) === null || _options$offset === void 0 ? void 0 : _options$offset.x, (_options$offset2 = options.offset) === null || _options$offset2 === void 0 || (_options$offset2 = _options$offset2.emus) === null || _options$offset2 === void 0 ? void 0 : _options$offset2.y);
|
|
5220
|
+
this.extents = new Extents(options.emus.x, options.emus.y);
|
|
5221
|
+
this.root.push(this.offset);
|
|
5222
|
+
this.root.push(this.extents);
|
|
5223
|
+
}
|
|
5224
|
+
};
|
|
5225
|
+
//#endregion
|
|
5226
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/no-fill.ts
|
|
5227
|
+
/**
|
|
5228
|
+
* No fill element for DrawingML shapes.
|
|
5229
|
+
*
|
|
5230
|
+
* This module provides the no-fill option for outline and shape fills.
|
|
5231
|
+
*
|
|
5232
|
+
* @module
|
|
5233
|
+
*/
|
|
5234
|
+
/**
|
|
5235
|
+
* Creates a no-fill element.
|
|
5236
|
+
*
|
|
5237
|
+
* Specifies that the outline or shape should have no fill applied.
|
|
5238
|
+
*
|
|
5239
|
+
* ## XSD Schema
|
|
5240
|
+
* ```xml
|
|
5241
|
+
* <xsd:element name="noFill" type="CT_Empty"/>
|
|
5242
|
+
* ```
|
|
5243
|
+
*
|
|
5244
|
+
* @example
|
|
5245
|
+
* ```typescript
|
|
5246
|
+
* const noFill = createNoFill();
|
|
4060
5247
|
* ```
|
|
4061
5248
|
*/
|
|
4062
|
-
const
|
|
4063
|
-
children: [options.type === "rgb" ? createSolidRgbColor(options) : createSchemeColor(options)],
|
|
4064
|
-
name: "a:solidFill"
|
|
4065
|
-
});
|
|
5249
|
+
const createNoFill = () => new BuilderElement({ name: "a:noFill" });
|
|
4066
5250
|
//#endregion
|
|
4067
5251
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/outline.ts
|
|
4068
5252
|
/**
|
|
4069
5253
|
* Outline (line) properties for DrawingML shapes.
|
|
4070
5254
|
*
|
|
4071
5255
|
* This module provides support for configuring outline properties including
|
|
4072
|
-
* width, cap style, compound line types,
|
|
5256
|
+
* width, cap style, compound line types, fill properties, dash, and join.
|
|
4073
5257
|
*
|
|
4074
|
-
* Reference:
|
|
5258
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineProperties
|
|
4075
5259
|
*
|
|
4076
5260
|
* @module
|
|
4077
5261
|
*/
|
|
4078
5262
|
/**
|
|
5263
|
+
* Line cap styles for outline endpoints.
|
|
5264
|
+
*
|
|
5265
|
+
* Defines how the ends of a line are rendered.
|
|
5266
|
+
*/
|
|
5267
|
+
const LineCap = {
|
|
5268
|
+
ROUND: "rnd",
|
|
5269
|
+
SQUARE: "sq",
|
|
5270
|
+
FLAT: "flat"
|
|
5271
|
+
};
|
|
5272
|
+
/**
|
|
5273
|
+
* Compound line types for outlines.
|
|
5274
|
+
*
|
|
5275
|
+
* Defines the structure of compound lines (single, double, etc.).
|
|
5276
|
+
*/
|
|
5277
|
+
const CompoundLine = {
|
|
5278
|
+
SINGLE: "sng",
|
|
5279
|
+
DOUBLE: "dbl",
|
|
5280
|
+
THICK_THIN: "thickThin",
|
|
5281
|
+
THIN_THICK: "thinThick",
|
|
5282
|
+
TRI: "tri"
|
|
5283
|
+
};
|
|
5284
|
+
/**
|
|
5285
|
+
* Pen alignment options for outline positioning.
|
|
5286
|
+
*
|
|
5287
|
+
* Defines how the outline is aligned relative to the shape edge.
|
|
5288
|
+
*/
|
|
5289
|
+
const PenAlignment = {
|
|
5290
|
+
CENTER: "ctr",
|
|
5291
|
+
INSET: "in"
|
|
5292
|
+
};
|
|
5293
|
+
/**
|
|
5294
|
+
* Preset dash styles for outlines.
|
|
5295
|
+
*
|
|
5296
|
+
* ## XSD Schema
|
|
5297
|
+
* ```xml
|
|
5298
|
+
* <xsd:simpleType name="ST_PresetLineDashVal">
|
|
5299
|
+
* <xsd:restriction base="xsd:token">
|
|
5300
|
+
* <xsd:enumeration value="solid"/>
|
|
5301
|
+
* <xsd:enumeration value="dot"/>
|
|
5302
|
+
* <xsd:enumeration value="dash"/>
|
|
5303
|
+
* <xsd:enumeration value="lgDash"/>
|
|
5304
|
+
* <xsd:enumeration value="dashDot"/>
|
|
5305
|
+
* <xsd:enumeration value="lgDashDot"/>
|
|
5306
|
+
* <xsd:enumeration value="lgDashDotDot"/>
|
|
5307
|
+
* <xsd:enumeration value="sysDash"/>
|
|
5308
|
+
* <xsd:enumeration value="sysDot"/>
|
|
5309
|
+
* <xsd:enumeration value="sysDashDot"/>
|
|
5310
|
+
* <xsd:enumeration value="sysDashDotDot"/>
|
|
5311
|
+
* </xsd:restriction>
|
|
5312
|
+
* </xsd:simpleType>
|
|
5313
|
+
* ```
|
|
5314
|
+
*/
|
|
5315
|
+
const PresetDash = {
|
|
5316
|
+
SOLID: "solid",
|
|
5317
|
+
DOT: "dot",
|
|
5318
|
+
DASH: "dash",
|
|
5319
|
+
LG_DASH: "lgDash",
|
|
5320
|
+
DASH_DOT: "dashDot",
|
|
5321
|
+
LG_DASH_DOT: "lgDashDot",
|
|
5322
|
+
LG_DASH_DOT_DOT: "lgDashDotDot",
|
|
5323
|
+
SYS_DASH: "sysDash",
|
|
5324
|
+
SYS_DOT: "sysDot",
|
|
5325
|
+
SYS_DASH_DOT: "sysDashDot",
|
|
5326
|
+
SYS_DASH_DOT_DOT: "sysDashDotDot"
|
|
5327
|
+
};
|
|
5328
|
+
/**
|
|
5329
|
+
* Line join styles.
|
|
5330
|
+
*/
|
|
5331
|
+
const LineJoin = {
|
|
5332
|
+
ROUND: "round",
|
|
5333
|
+
BEVEL: "bevel",
|
|
5334
|
+
MITER: "miter"
|
|
5335
|
+
};
|
|
5336
|
+
/**
|
|
5337
|
+
* Creates the fill child element for an outline.
|
|
5338
|
+
*/
|
|
5339
|
+
const createOutlineFill = (options) => {
|
|
5340
|
+
if (options.type === "noFill") return createNoFill();
|
|
5341
|
+
return createSolidFill(options.color);
|
|
5342
|
+
};
|
|
5343
|
+
/**
|
|
4079
5344
|
* Creates an outline element for DrawingML shapes.
|
|
4080
5345
|
*
|
|
4081
5346
|
* The outline element specifies the line properties for the shape border,
|
|
4082
|
-
* including width, cap style, compound line type, alignment, and fill.
|
|
4083
|
-
*
|
|
4084
|
-
* Reference: http://officeopenxml.com/drwSp-outline.php
|
|
5347
|
+
* including width, cap style, compound line type, alignment, dash, join, and fill.
|
|
4085
5348
|
*
|
|
4086
5349
|
* ## XSD Schema
|
|
4087
5350
|
* ```xml
|
|
@@ -4100,44 +5363,56 @@ const createSolidFill = (options) => new BuilderElement({
|
|
|
4100
5363
|
*
|
|
4101
5364
|
* @example
|
|
4102
5365
|
* ```typescript
|
|
4103
|
-
* //
|
|
5366
|
+
* // Outline with RGB color and dash
|
|
4104
5367
|
* const outline = createOutline({
|
|
4105
5368
|
* width: 9525,
|
|
4106
|
-
* cap: "ROUND",
|
|
4107
5369
|
* type: "solidFill",
|
|
4108
|
-
*
|
|
4109
|
-
*
|
|
5370
|
+
* color: { value: "FF0000" },
|
|
5371
|
+
* dash: "DASH",
|
|
4110
5372
|
* });
|
|
4111
5373
|
* ```
|
|
4112
5374
|
*/
|
|
4113
|
-
const createOutline = (options) =>
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
5375
|
+
const createOutline = (options) => {
|
|
5376
|
+
const children = [];
|
|
5377
|
+
children.push(createOutlineFill(options));
|
|
5378
|
+
if (options.dash !== void 0) children.push(new BuilderElement({
|
|
5379
|
+
attributes: { val: {
|
|
5380
|
+
key: "val",
|
|
5381
|
+
value: PresetDash[options.dash]
|
|
5382
|
+
} },
|
|
5383
|
+
name: "a:prstDash"
|
|
5384
|
+
}));
|
|
5385
|
+
if (options.join !== void 0) if (options.join === "MITER" && options.miterLimit !== void 0) children.push(new BuilderElement({
|
|
5386
|
+
attributes: { lim: {
|
|
5387
|
+
key: "lim",
|
|
5388
|
+
value: options.miterLimit
|
|
5389
|
+
} },
|
|
5390
|
+
name: "a:miter"
|
|
5391
|
+
}));
|
|
5392
|
+
else children.push(new BuilderElement({ name: `a:${LineJoin[options.join]}` }));
|
|
5393
|
+
return new BuilderElement({
|
|
5394
|
+
attributes: {
|
|
5395
|
+
align: {
|
|
5396
|
+
key: "algn",
|
|
5397
|
+
value: options.align ? PenAlignment[options.align] : void 0
|
|
5398
|
+
},
|
|
5399
|
+
cap: {
|
|
5400
|
+
key: "cap",
|
|
5401
|
+
value: options.cap ? LineCap[options.cap] : void 0
|
|
5402
|
+
},
|
|
5403
|
+
compoundLine: {
|
|
5404
|
+
key: "cmpd",
|
|
5405
|
+
value: options.compoundLine ? CompoundLine[options.compoundLine] : void 0
|
|
5406
|
+
},
|
|
5407
|
+
width: {
|
|
5408
|
+
key: "w",
|
|
5409
|
+
value: options.width
|
|
5410
|
+
}
|
|
4126
5411
|
},
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
},
|
|
4132
|
-
children: [options.type === "noFill" ? createNoFill() : options.solidFillType === "rgb" ? createSolidFill({
|
|
4133
|
-
type: "rgb",
|
|
4134
|
-
value: options.value
|
|
4135
|
-
}) : createSolidFill({
|
|
4136
|
-
type: "scheme",
|
|
4137
|
-
value: options.value
|
|
4138
|
-
})],
|
|
4139
|
-
name: "a:ln"
|
|
4140
|
-
});
|
|
5412
|
+
children,
|
|
5413
|
+
name: "a:ln"
|
|
5414
|
+
});
|
|
5415
|
+
};
|
|
4141
5416
|
//#endregion
|
|
4142
5417
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/preset-geometry/adjustment-values/adjustment-values.ts
|
|
4143
5418
|
/**
|
|
@@ -4275,15 +5550,181 @@ var ShapePropertiesAttributes = class extends XmlAttributeComponent {
|
|
|
4275
5550
|
}
|
|
4276
5551
|
};
|
|
4277
5552
|
//#endregion
|
|
5553
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/three-d/bevel.ts
|
|
5554
|
+
/**
|
|
5555
|
+
* Bevel element for DrawingML 3D shapes.
|
|
5556
|
+
*
|
|
5557
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Bevel
|
|
5558
|
+
*
|
|
5559
|
+
* @module
|
|
5560
|
+
*/
|
|
5561
|
+
/**
|
|
5562
|
+
* Bevel preset types (12 variations).
|
|
5563
|
+
*
|
|
5564
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_BevelPresetType
|
|
5565
|
+
*/
|
|
5566
|
+
const BevelPresetType = {
|
|
5567
|
+
RELAXED_INSET: "relaxedInset",
|
|
5568
|
+
CIRCLE: "circle",
|
|
5569
|
+
SLOPE: "slope",
|
|
5570
|
+
CROSS: "cross",
|
|
5571
|
+
ANGLE: "angle",
|
|
5572
|
+
SOFT_ROUND: "softRound",
|
|
5573
|
+
CONVEX: "convex",
|
|
5574
|
+
COOL_SLANT: "coolSlant",
|
|
5575
|
+
DIVOT: "divot",
|
|
5576
|
+
RIBLET: "riblet",
|
|
5577
|
+
HARD_EDGE: "hardEdge",
|
|
5578
|
+
ART_DECO: "artDeco"
|
|
5579
|
+
};
|
|
5580
|
+
/**
|
|
5581
|
+
* Creates a bevel element.
|
|
5582
|
+
*
|
|
5583
|
+
* ## XSD Schema
|
|
5584
|
+
* ```xml
|
|
5585
|
+
* <xsd:complexType name="CT_Bevel">
|
|
5586
|
+
* <xsd:attribute name="w" type="ST_PositiveCoordinate" default="76200"/>
|
|
5587
|
+
* <xsd:attribute name="h" type="ST_PositiveCoordinate" default="76200"/>
|
|
5588
|
+
* <xsd:attribute name="prst" type="ST_BevelPresetType" default="circle"/>
|
|
5589
|
+
* </xsd:complexType>
|
|
5590
|
+
* ```
|
|
5591
|
+
*/
|
|
5592
|
+
const createBevel = (options) => {
|
|
5593
|
+
if (!options) return new BuilderElement({ name: "a:bevelT" });
|
|
5594
|
+
const attributes = {};
|
|
5595
|
+
if (options.w !== void 0) attributes.w = {
|
|
5596
|
+
key: "w",
|
|
5597
|
+
value: options.w
|
|
5598
|
+
};
|
|
5599
|
+
if (options.h !== void 0) attributes.h = {
|
|
5600
|
+
key: "h",
|
|
5601
|
+
value: options.h
|
|
5602
|
+
};
|
|
5603
|
+
if (options.prst !== void 0) attributes.prst = {
|
|
5604
|
+
key: "prst",
|
|
5605
|
+
value: BevelPresetType[options.prst]
|
|
5606
|
+
};
|
|
5607
|
+
return new BuilderElement({
|
|
5608
|
+
attributes,
|
|
5609
|
+
name: "a:bevelT"
|
|
5610
|
+
});
|
|
5611
|
+
};
|
|
5612
|
+
/**
|
|
5613
|
+
* Creates a bottom bevel element (a:bevelB).
|
|
5614
|
+
*/
|
|
5615
|
+
const createBottomBevel = (options) => {
|
|
5616
|
+
if (!options) return new BuilderElement({ name: "a:bevelB" });
|
|
5617
|
+
const attributes = {};
|
|
5618
|
+
if (options.w !== void 0) attributes.w = {
|
|
5619
|
+
key: "w",
|
|
5620
|
+
value: options.w
|
|
5621
|
+
};
|
|
5622
|
+
if (options.h !== void 0) attributes.h = {
|
|
5623
|
+
key: "h",
|
|
5624
|
+
value: options.h
|
|
5625
|
+
};
|
|
5626
|
+
if (options.prst !== void 0) attributes.prst = {
|
|
5627
|
+
key: "prst",
|
|
5628
|
+
value: BevelPresetType[options.prst]
|
|
5629
|
+
};
|
|
5630
|
+
return new BuilderElement({
|
|
5631
|
+
attributes,
|
|
5632
|
+
name: "a:bevelB"
|
|
5633
|
+
});
|
|
5634
|
+
};
|
|
5635
|
+
//#endregion
|
|
5636
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/three-d/shape-3d.ts
|
|
5637
|
+
/**
|
|
5638
|
+
* 3D shape properties for DrawingML.
|
|
5639
|
+
*
|
|
5640
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Shape3D
|
|
5641
|
+
*
|
|
5642
|
+
* @module
|
|
5643
|
+
*/
|
|
5644
|
+
/**
|
|
5645
|
+
* Preset material types for 3D shapes (15 variations).
|
|
5646
|
+
*
|
|
5647
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetMaterialType
|
|
5648
|
+
*/
|
|
5649
|
+
const PresetMaterialType = {
|
|
5650
|
+
LEGACY_MATTE: "legacyMatte",
|
|
5651
|
+
LEGACY_PLASTIC: "legacyPlastic",
|
|
5652
|
+
LEGACY_METAL: "legacyMetal",
|
|
5653
|
+
LEGACY_WIREFRAME: "legacyWireframe",
|
|
5654
|
+
MATTE: "matte",
|
|
5655
|
+
PLASTIC: "plastic",
|
|
5656
|
+
METAL: "metal",
|
|
5657
|
+
WARM_MATTE: "warmMatte",
|
|
5658
|
+
TRANSLUCENT_POWDER: "translucentPowder",
|
|
5659
|
+
POWDER: "powder",
|
|
5660
|
+
DK_EDGE: "dkEdge",
|
|
5661
|
+
SOFT_EDGE: "softEdge",
|
|
5662
|
+
CLEAR: "clear",
|
|
5663
|
+
FLAT: "flat",
|
|
5664
|
+
SOFT_METAL: "softmetal"
|
|
5665
|
+
};
|
|
5666
|
+
/**
|
|
5667
|
+
* Creates a 3D shape properties element (a:sp3d).
|
|
5668
|
+
*
|
|
5669
|
+
* ## XSD Schema
|
|
5670
|
+
* ```xml
|
|
5671
|
+
* <xsd:complexType name="CT_Shape3D">
|
|
5672
|
+
* <xsd:sequence>
|
|
5673
|
+
* <xsd:element name="bevelT" type="CT_Bevel" minOccurs="0"/>
|
|
5674
|
+
* <xsd:element name="bevelB" type="CT_Bevel" minOccurs="0"/>
|
|
5675
|
+
* <xsd:element name="extrusionClr" type="CT_Color" minOccurs="0"/>
|
|
5676
|
+
* <xsd:element name="contourClr" type="CT_Color" minOccurs="0"/>
|
|
5677
|
+
* </xsd:sequence>
|
|
5678
|
+
* <xsd:attribute name="z" type="ST_Coordinate" default="0"/>
|
|
5679
|
+
* <xsd:attribute name="extrusionH" type="ST_PositiveCoordinate" default="0"/>
|
|
5680
|
+
* <xsd:attribute name="contourW" type="ST_PositiveCoordinate" default="0"/>
|
|
5681
|
+
* <xsd:attribute name="prstMaterial" type="ST_PresetMaterialType" default="warmMatte"/>
|
|
5682
|
+
* </xsd:complexType>
|
|
5683
|
+
* ```
|
|
5684
|
+
*/
|
|
5685
|
+
const createShape3D = (options) => {
|
|
5686
|
+
const children = [];
|
|
5687
|
+
if (options.bevelT) children.push(createBevel(options.bevelT));
|
|
5688
|
+
if (options.bevelB) children.push(createBottomBevel(options.bevelB));
|
|
5689
|
+
if (options.extrusionClr) children.push(new BuilderElement({
|
|
5690
|
+
children: [createColorElement(options.extrusionClr)],
|
|
5691
|
+
name: "a:extrusionClr"
|
|
5692
|
+
}));
|
|
5693
|
+
if (options.contourClr) children.push(new BuilderElement({
|
|
5694
|
+
children: [createColorElement(options.contourClr)],
|
|
5695
|
+
name: "a:contourClr"
|
|
5696
|
+
}));
|
|
5697
|
+
return new BuilderElement({
|
|
5698
|
+
attributes: options.z !== void 0 || options.extrusionH !== void 0 || options.contourW !== void 0 || options.prstMaterial !== void 0 ? {
|
|
5699
|
+
...options.z !== void 0 && { z: {
|
|
5700
|
+
key: "z",
|
|
5701
|
+
value: options.z
|
|
5702
|
+
} },
|
|
5703
|
+
...options.extrusionH !== void 0 && { extrusionH: {
|
|
5704
|
+
key: "extrusionH",
|
|
5705
|
+
value: options.extrusionH
|
|
5706
|
+
} },
|
|
5707
|
+
...options.contourW !== void 0 && { contourW: {
|
|
5708
|
+
key: "contourW",
|
|
5709
|
+
value: options.contourW
|
|
5710
|
+
} },
|
|
5711
|
+
...options.prstMaterial !== void 0 && { prstMaterial: {
|
|
5712
|
+
key: "prstMaterial",
|
|
5713
|
+
value: PresetMaterialType[options.prstMaterial]
|
|
5714
|
+
} }
|
|
5715
|
+
} : void 0,
|
|
5716
|
+
children,
|
|
5717
|
+
name: "a:sp3d"
|
|
5718
|
+
});
|
|
5719
|
+
};
|
|
5720
|
+
//#endregion
|
|
4278
5721
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/shape-properties.ts
|
|
4279
5722
|
/**
|
|
4280
5723
|
* Represents shape properties for a DrawingML picture.
|
|
4281
5724
|
*
|
|
4282
5725
|
* This element defines the visual formatting of a picture, including
|
|
4283
5726
|
* its transform (size, position, rotation, flip), geometry preset,
|
|
4284
|
-
*
|
|
4285
|
-
*
|
|
4286
|
-
* Reference: http://officeopenxml.com/drwSp-SpPr.php
|
|
5727
|
+
* fill, outline, effects, and 3D properties.
|
|
4287
5728
|
*
|
|
4288
5729
|
* ## XSD Schema
|
|
4289
5730
|
* ```xml
|
|
@@ -4305,33 +5746,29 @@ var ShapePropertiesAttributes = class extends XmlAttributeComponent {
|
|
|
4305
5746
|
* @example
|
|
4306
5747
|
* ```typescript
|
|
4307
5748
|
* const shapeProps = new ShapeProperties({
|
|
4308
|
-
*
|
|
4309
|
-
*
|
|
4310
|
-
*
|
|
4311
|
-
*
|
|
5749
|
+
* element: "pic",
|
|
5750
|
+
* transform: { emus: { x: 914400, y: 914400 } },
|
|
5751
|
+
* effects: {
|
|
5752
|
+
* glow: { rad: 50800, color: { value: "FF0000" } },
|
|
4312
5753
|
* },
|
|
4313
|
-
* outline: {
|
|
4314
|
-
* width: 9525,
|
|
4315
|
-
* type: "solidFill",
|
|
4316
|
-
* solidFillType: "rgb",
|
|
4317
|
-
* value: "FF0000"
|
|
4318
|
-
* }
|
|
4319
5754
|
* });
|
|
4320
5755
|
* ```
|
|
4321
5756
|
*/
|
|
4322
5757
|
var ShapeProperties = class extends XmlComponent {
|
|
4323
|
-
constructor({ element, outline, solidFill, transform }) {
|
|
5758
|
+
constructor({ element, effects, gradientFill, noFill, outline, shape3d, solidFill, transform }) {
|
|
4324
5759
|
super(`${element}:spPr`);
|
|
4325
5760
|
_defineProperty(this, "form", void 0);
|
|
4326
5761
|
this.root.push(new ShapePropertiesAttributes({ bwMode: "auto" }));
|
|
4327
5762
|
this.form = new Form(transform);
|
|
4328
5763
|
this.root.push(this.form);
|
|
4329
5764
|
this.root.push(new PresetGeometry());
|
|
4330
|
-
if (
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
if (
|
|
5765
|
+
if (noFill) this.root.push(createNoFill());
|
|
5766
|
+
else if (solidFill) this.root.push(createSolidFill(solidFill));
|
|
5767
|
+
else if (gradientFill) this.root.push(createGradientFill(gradientFill));
|
|
5768
|
+
else if (outline) this.root.push(createNoFill());
|
|
5769
|
+
if (outline) this.root.push(createOutline(outline));
|
|
5770
|
+
if (effects) this.root.push(createEffectList(effects));
|
|
5771
|
+
if (shape3d) this.root.push(createShape3D(shape3d));
|
|
4335
5772
|
}
|
|
4336
5773
|
};
|
|
4337
5774
|
//#endregion
|
|
@@ -4567,17 +6004,17 @@ const createBlip = (mediaData) => new BuilderElement({
|
|
|
4567
6004
|
*
|
|
4568
6005
|
* This module defines the portion of an image to use when filling a shape.
|
|
4569
6006
|
*
|
|
4570
|
-
* Reference:
|
|
6007
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
|
|
4571
6008
|
*
|
|
4572
6009
|
* @module
|
|
4573
6010
|
*/
|
|
4574
6011
|
/**
|
|
4575
|
-
*
|
|
6012
|
+
* Creates a source rectangle element for blip fill cropping.
|
|
4576
6013
|
*
|
|
4577
6014
|
* This element specifies a portion of the blip (image) to use as the fill.
|
|
4578
|
-
* When
|
|
6015
|
+
* When no options are provided, the entire blip is used.
|
|
4579
6016
|
*
|
|
4580
|
-
* Reference:
|
|
6017
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
|
|
4581
6018
|
*
|
|
4582
6019
|
* ## XSD Schema
|
|
4583
6020
|
* ```xml
|
|
@@ -4591,13 +6028,33 @@ const createBlip = (mediaData) => new BuilderElement({
|
|
|
4591
6028
|
*
|
|
4592
6029
|
* @example
|
|
4593
6030
|
* ```typescript
|
|
4594
|
-
*
|
|
6031
|
+
* // Crop 10% from left and right
|
|
6032
|
+
* createSourceRectangle({ l: 10000, r: 10000 });
|
|
4595
6033
|
* ```
|
|
4596
6034
|
*/
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
6035
|
+
const createSourceRectangle = (options) => {
|
|
6036
|
+
if (!options) return new BuilderElement({ name: "a:srcRect" });
|
|
6037
|
+
const attributes = {};
|
|
6038
|
+
if (options.l !== void 0) attributes.l = {
|
|
6039
|
+
key: "l",
|
|
6040
|
+
value: options.l
|
|
6041
|
+
};
|
|
6042
|
+
if (options.t !== void 0) attributes.t = {
|
|
6043
|
+
key: "t",
|
|
6044
|
+
value: options.t
|
|
6045
|
+
};
|
|
6046
|
+
if (options.r !== void 0) attributes.r = {
|
|
6047
|
+
key: "r",
|
|
6048
|
+
value: options.r
|
|
6049
|
+
};
|
|
6050
|
+
if (options.b !== void 0) attributes.b = {
|
|
6051
|
+
key: "b",
|
|
6052
|
+
value: options.b
|
|
6053
|
+
};
|
|
6054
|
+
return new BuilderElement({
|
|
6055
|
+
attributes,
|
|
6056
|
+
name: "a:srcRect"
|
|
6057
|
+
});
|
|
4601
6058
|
};
|
|
4602
6059
|
//#endregion
|
|
4603
6060
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/blip/stretch.ts
|
|
@@ -4668,9 +6125,9 @@ var Stretch = class extends XmlComponent {
|
|
|
4668
6125
|
* Represents a blip fill for pictures in DrawingML.
|
|
4669
6126
|
*
|
|
4670
6127
|
* This element specifies the type of fill used for a picture. It contains the blip (image)
|
|
4671
|
-
* reference, an optional source rectangle, and the fill mode (typically stretch).
|
|
6128
|
+
* reference, an optional source rectangle for cropping, and the fill mode (typically stretch).
|
|
4672
6129
|
*
|
|
4673
|
-
* Reference:
|
|
6130
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties
|
|
4674
6131
|
*
|
|
4675
6132
|
* ## XSD Schema
|
|
4676
6133
|
* ```xml
|
|
@@ -4688,13 +6145,14 @@ var Stretch = class extends XmlComponent {
|
|
|
4688
6145
|
* @example
|
|
4689
6146
|
* ```typescript
|
|
4690
6147
|
* const blipFill = new BlipFill(mediaData);
|
|
6148
|
+
* // If mediaData.srcRect is set, cropping is applied
|
|
4691
6149
|
* ```
|
|
4692
6150
|
*/
|
|
4693
6151
|
var BlipFill = class extends XmlComponent {
|
|
4694
6152
|
constructor(mediaData) {
|
|
4695
6153
|
super("pic:blipFill");
|
|
4696
6154
|
this.root.push(createBlip(mediaData));
|
|
4697
|
-
this.root.push(
|
|
6155
|
+
this.root.push(createSourceRectangle(mediaData.srcRect));
|
|
4698
6156
|
this.root.push(new Stretch());
|
|
4699
6157
|
}
|
|
4700
6158
|
};
|
|
@@ -5065,15 +6523,90 @@ var Pic = class extends XmlComponent {
|
|
|
5065
6523
|
};
|
|
5066
6524
|
//#endregion
|
|
5067
6525
|
//#region src/file/drawing/inline/graphic/graphic-data/wpg/wpg-group.ts
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
6526
|
+
/**
|
|
6527
|
+
* Creates a group transform element (a:xfrm) with optional chOff/chExt.
|
|
6528
|
+
*
|
|
6529
|
+
* This uses CT_GroupTransform2D which extends CT_Transform2D with
|
|
6530
|
+
* child offset and extent elements.
|
|
6531
|
+
*
|
|
6532
|
+
* ## XSD Schema
|
|
6533
|
+
* ```xml
|
|
6534
|
+
* <xsd:complexType name="CT_GroupTransform2D">
|
|
6535
|
+
* <xsd:sequence>
|
|
6536
|
+
* <xsd:element name="off" type="CT_Point2D" minOccurs="0"/>
|
|
6537
|
+
* <xsd:element name="ext" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
6538
|
+
* <xsd:element name="chOff" type="CT_Point2D" minOccurs="0"/>
|
|
6539
|
+
* <xsd:element name="chExt" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
6540
|
+
* </xsd:sequence>
|
|
6541
|
+
* <xsd:attribute name="rot" type="ST_Angle" default="0"/>
|
|
6542
|
+
* <xsd:attribute name="flipH" type="xsd:boolean" default="false"/>
|
|
6543
|
+
* <xsd:attribute name="flipV" type="xsd:boolean" default="false"/>
|
|
6544
|
+
* </xsd:complexType>
|
|
6545
|
+
* ```
|
|
6546
|
+
*/
|
|
6547
|
+
const createGroupForm = (transform, chOff, chExt) => {
|
|
6548
|
+
var _transform$offset, _transform$offset2, _transform$flip, _transform$flip2, _transform$flip3, _transform$flip4;
|
|
6549
|
+
const children = [new Offset((_transform$offset = transform.offset) === null || _transform$offset === void 0 || (_transform$offset = _transform$offset.emus) === null || _transform$offset === void 0 ? void 0 : _transform$offset.x, (_transform$offset2 = transform.offset) === null || _transform$offset2 === void 0 || (_transform$offset2 = _transform$offset2.emus) === null || _transform$offset2 === void 0 ? void 0 : _transform$offset2.y), new Extents(transform.emus.x, transform.emus.y)];
|
|
6550
|
+
if (chOff) children.push(new BuilderElement({
|
|
6551
|
+
attributes: {
|
|
6552
|
+
x: {
|
|
6553
|
+
key: "x",
|
|
6554
|
+
value: chOff.x
|
|
6555
|
+
},
|
|
6556
|
+
y: {
|
|
6557
|
+
key: "y",
|
|
6558
|
+
value: chOff.y
|
|
6559
|
+
}
|
|
6560
|
+
},
|
|
6561
|
+
name: "a:chOff"
|
|
6562
|
+
}));
|
|
6563
|
+
if (chExt) children.push(new BuilderElement({
|
|
6564
|
+
attributes: {
|
|
6565
|
+
cx: {
|
|
6566
|
+
key: "cx",
|
|
6567
|
+
value: chExt.cx
|
|
6568
|
+
},
|
|
6569
|
+
cy: {
|
|
6570
|
+
key: "cy",
|
|
6571
|
+
value: chExt.cy
|
|
6572
|
+
}
|
|
6573
|
+
},
|
|
6574
|
+
name: "a:chExt"
|
|
6575
|
+
}));
|
|
6576
|
+
return new BuilderElement({
|
|
6577
|
+
attributes: ((_transform$flip = transform.flip) === null || _transform$flip === void 0 ? void 0 : _transform$flip.horizontal) !== void 0 || ((_transform$flip2 = transform.flip) === null || _transform$flip2 === void 0 ? void 0 : _transform$flip2.vertical) !== void 0 || transform.rotation !== void 0 ? {
|
|
6578
|
+
...((_transform$flip3 = transform.flip) === null || _transform$flip3 === void 0 ? void 0 : _transform$flip3.horizontal) !== void 0 && { flipH: {
|
|
6579
|
+
key: "flipH",
|
|
6580
|
+
value: transform.flip.horizontal
|
|
6581
|
+
} },
|
|
6582
|
+
...((_transform$flip4 = transform.flip) === null || _transform$flip4 === void 0 ? void 0 : _transform$flip4.vertical) !== void 0 && { flipV: {
|
|
6583
|
+
key: "flipV",
|
|
6584
|
+
value: transform.flip.vertical
|
|
6585
|
+
} },
|
|
6586
|
+
...transform.rotation !== void 0 && { rot: {
|
|
6587
|
+
key: "rot",
|
|
6588
|
+
value: transform.rotation
|
|
6589
|
+
} }
|
|
6590
|
+
} : void 0,
|
|
6591
|
+
children,
|
|
6592
|
+
name: "a:xfrm"
|
|
6593
|
+
});
|
|
6594
|
+
};
|
|
6595
|
+
const createGroupProperties = (options) => {
|
|
6596
|
+
const children = [createGroupForm(options.transformation, options.chOff, options.chExt)];
|
|
6597
|
+
if (options.noFill) children.push(createNoFill());
|
|
6598
|
+
else if (options.solidFill) children.push(createSolidFill(options.solidFill));
|
|
6599
|
+
if (options.effects) children.push(createEffectList(options.effects));
|
|
6600
|
+
return new BuilderElement({
|
|
6601
|
+
children,
|
|
6602
|
+
name: "wpg:grpSpPr"
|
|
6603
|
+
});
|
|
6604
|
+
};
|
|
5072
6605
|
const createNonVisualGroupProperties = () => new BuilderElement({ name: "wpg:cNvGrpSpPr" });
|
|
5073
6606
|
const createWpgGroup = (options) => new BuilderElement({
|
|
5074
6607
|
children: [
|
|
5075
6608
|
createNonVisualGroupProperties(),
|
|
5076
|
-
createGroupProperties(options
|
|
6609
|
+
createGroupProperties(options),
|
|
5077
6610
|
...options.children
|
|
5078
6611
|
],
|
|
5079
6612
|
name: "wpg:wgp"
|
|
@@ -5122,8 +6655,9 @@ var GraphicData = class extends XmlComponent {
|
|
|
5122
6655
|
this.root.push(wps);
|
|
5123
6656
|
} else if (mediaData.type === "wpg") {
|
|
5124
6657
|
this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" }));
|
|
6658
|
+
const md = mediaData;
|
|
5125
6659
|
const wpg = createWpgGroup({
|
|
5126
|
-
children:
|
|
6660
|
+
children: md.children.map((child) => {
|
|
5127
6661
|
if (child.type === "wps") return createWpsShape({
|
|
5128
6662
|
...child.data,
|
|
5129
6663
|
outline: child.outline,
|
|
@@ -5136,7 +6670,11 @@ var GraphicData = class extends XmlComponent {
|
|
|
5136
6670
|
transform: child.transformation
|
|
5137
6671
|
});
|
|
5138
6672
|
}),
|
|
5139
|
-
transformation: transform
|
|
6673
|
+
transformation: transform,
|
|
6674
|
+
chOff: md.chOff,
|
|
6675
|
+
chExt: md.chExt,
|
|
6676
|
+
solidFill: md.solidFill,
|
|
6677
|
+
effects: md.effects
|
|
5140
6678
|
});
|
|
5141
6679
|
this.root.push(wpg);
|
|
5142
6680
|
} else {
|
|
@@ -5906,9 +7444,10 @@ var Drawing = class extends XmlComponent {
|
|
|
5906
7444
|
};
|
|
5907
7445
|
//#endregion
|
|
5908
7446
|
//#region src/file/paragraph/run/image-run.ts
|
|
5909
|
-
const createImageData = (data, transformation, key) => ({
|
|
7447
|
+
const createImageData = (data, transformation, key, srcRect) => ({
|
|
5910
7448
|
data,
|
|
5911
7449
|
fileName: key,
|
|
7450
|
+
srcRect,
|
|
5912
7451
|
transformation: {
|
|
5913
7452
|
emus: {
|
|
5914
7453
|
x: Math.round(transformation.width * 9525),
|
|
@@ -5954,7 +7493,7 @@ var ImageRun = class extends Run {
|
|
|
5954
7493
|
const fallbackData = (0, undio.toUint8Array)(options.fallback.data);
|
|
5955
7494
|
this.imageData = {
|
|
5956
7495
|
type: options.type,
|
|
5957
|
-
...createImageData(rawData, options.transformation, key),
|
|
7496
|
+
...createImageData(rawData, options.transformation, key, options.srcRect),
|
|
5958
7497
|
fallback: {
|
|
5959
7498
|
type: options.fallback.type,
|
|
5960
7499
|
...createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)
|
|
@@ -5962,7 +7501,7 @@ var ImageRun = class extends Run {
|
|
|
5962
7501
|
};
|
|
5963
7502
|
} else this.imageData = {
|
|
5964
7503
|
type: options.type,
|
|
5965
|
-
...createImageData(rawData, options.transformation, key)
|
|
7504
|
+
...createImageData(rawData, options.transformation, key, options.srcRect)
|
|
5966
7505
|
};
|
|
5967
7506
|
const drawing = new Drawing(this.imageData, {
|
|
5968
7507
|
docProperties: options.altText,
|
|
@@ -8521,6 +10060,34 @@ const createFrameProperties = (options) => {
|
|
|
8521
10060
|
* @module
|
|
8522
10061
|
*/
|
|
8523
10062
|
/**
|
|
10063
|
+
* Vertical text alignment types for paragraphs.
|
|
10064
|
+
*
|
|
10065
|
+
* Specifies the vertical alignment of text within the paragraph.
|
|
10066
|
+
*
|
|
10067
|
+
* @publicApi
|
|
10068
|
+
*/
|
|
10069
|
+
const TextAlignmentType = {
|
|
10070
|
+
TOP: "top",
|
|
10071
|
+
CENTER: "center",
|
|
10072
|
+
BASELINE: "baseline",
|
|
10073
|
+
BOTTOM: "bottom",
|
|
10074
|
+
AUTO: "auto"
|
|
10075
|
+
};
|
|
10076
|
+
/**
|
|
10077
|
+
* Textbox tight wrap types for paragraphs.
|
|
10078
|
+
*
|
|
10079
|
+
* Specifies how tightly text wraps around a textbox.
|
|
10080
|
+
*
|
|
10081
|
+
* @publicApi
|
|
10082
|
+
*/
|
|
10083
|
+
const TextboxTightWrapType = {
|
|
10084
|
+
NONE: "none",
|
|
10085
|
+
ALL_LINES: "allLines",
|
|
10086
|
+
FIRST_AND_LAST_LINE: "firstAndLastLine",
|
|
10087
|
+
FIRST_LINE_ONLY: "firstLineOnly",
|
|
10088
|
+
LAST_LINE_ONLY: "lastLineOnly"
|
|
10089
|
+
};
|
|
10090
|
+
/**
|
|
8524
10091
|
* Represents paragraph properties (pPr) in a WordprocessingML document.
|
|
8525
10092
|
*
|
|
8526
10093
|
* The paragraph properties element specifies all formatting applied to a paragraph,
|
|
@@ -8683,6 +10250,27 @@ var ParagraphProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
8683
10250
|
if (options.outlineLevel !== void 0) this.push(createOutlineLevel(options.outlineLevel));
|
|
8684
10251
|
if (options.suppressLineNumbers !== void 0) this.push(new OnOffElement("w:suppressLineNumbers", options.suppressLineNumbers));
|
|
8685
10252
|
if (options.autoSpaceEastAsianText !== void 0) this.push(new OnOffElement("w:autoSpaceDN", options.autoSpaceEastAsianText));
|
|
10253
|
+
if (options.suppressAutoHyphens !== void 0) this.push(new OnOffElement("w:suppressAutoHyphens", options.suppressAutoHyphens));
|
|
10254
|
+
if (options.adjustRightInd !== void 0) this.push(new OnOffElement("w:adjustRightInd", options.adjustRightInd));
|
|
10255
|
+
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
10256
|
+
if (options.mirrorIndents !== void 0) this.push(new OnOffElement("w:mirrorIndents", options.mirrorIndents));
|
|
10257
|
+
if (options.kinsoku !== void 0) this.push(new OnOffElement("w:kinsoku", options.kinsoku));
|
|
10258
|
+
if (options.topLinePunct !== void 0) this.push(new OnOffElement("w:topLinePunct", options.topLinePunct));
|
|
10259
|
+
if (options.autoSpaceDE !== void 0) this.push(new OnOffElement("w:autoSpaceDE", options.autoSpaceDE));
|
|
10260
|
+
if (options.textAlignment !== void 0) this.push(new BuilderElement({
|
|
10261
|
+
attributes: { val: {
|
|
10262
|
+
key: "w:val",
|
|
10263
|
+
value: options.textAlignment
|
|
10264
|
+
} },
|
|
10265
|
+
name: "w:textAlignment"
|
|
10266
|
+
}));
|
|
10267
|
+
if (options.textboxTightWrap !== void 0) this.push(new BuilderElement({
|
|
10268
|
+
attributes: { val: {
|
|
10269
|
+
key: "w:val",
|
|
10270
|
+
value: options.textboxTightWrap
|
|
10271
|
+
} },
|
|
10272
|
+
name: "w:textboxTightWrap"
|
|
10273
|
+
}));
|
|
8686
10274
|
if (options.run) this.push(new ParagraphRunProperties(options.run));
|
|
8687
10275
|
if (options.revision) this.push(new ParagraphPropertiesChange(options.revision));
|
|
8688
10276
|
}
|
|
@@ -13052,6 +14640,137 @@ const createDocumentGrid = ({ type, linePitch, charSpace }) => new BuilderElemen
|
|
|
13052
14640
|
name: "w:docGrid"
|
|
13053
14641
|
});
|
|
13054
14642
|
//#endregion
|
|
14643
|
+
//#region src/file/document/body/section-properties/properties/footnote-endnote-properties.ts
|
|
14644
|
+
/**
|
|
14645
|
+
* Footnote and endnote properties module for WordprocessingML section properties.
|
|
14646
|
+
*
|
|
14647
|
+
* Specifies footnote/endnote placement and numbering format within a section.
|
|
14648
|
+
*
|
|
14649
|
+
* Reference: ISO/IEC 29500-4, CT_FtnProps / CT_EdnProps
|
|
14650
|
+
*
|
|
14651
|
+
* @module
|
|
14652
|
+
*/
|
|
14653
|
+
/**
|
|
14654
|
+
* Creates footnote properties element (w:footnotePr) for a section.
|
|
14655
|
+
*
|
|
14656
|
+
* ## XSD Schema
|
|
14657
|
+
* ```xml
|
|
14658
|
+
* <xsd:complexType name="CT_FtnProps">
|
|
14659
|
+
* <xsd:sequence>
|
|
14660
|
+
* <xsd:element name="pos" type="CT_FtnPos" minOccurs="0"/>
|
|
14661
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
14662
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
14663
|
+
* </xsd:sequence>
|
|
14664
|
+
* </xsd:complexType>
|
|
14665
|
+
* ```
|
|
14666
|
+
*/
|
|
14667
|
+
const createFootnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
14668
|
+
const container = new FootnoteProperties();
|
|
14669
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
14670
|
+
attributes: { val: {
|
|
14671
|
+
key: "w:val",
|
|
14672
|
+
value: pos
|
|
14673
|
+
} },
|
|
14674
|
+
name: "w:pos"
|
|
14675
|
+
}));
|
|
14676
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
14677
|
+
attributes: {
|
|
14678
|
+
format: {
|
|
14679
|
+
key: "w:format",
|
|
14680
|
+
value: format
|
|
14681
|
+
},
|
|
14682
|
+
val: {
|
|
14683
|
+
key: "w:fmt",
|
|
14684
|
+
value: formatType
|
|
14685
|
+
}
|
|
14686
|
+
},
|
|
14687
|
+
name: "w:numFmt"
|
|
14688
|
+
}));
|
|
14689
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
14690
|
+
attributes: { val: {
|
|
14691
|
+
key: "w:val",
|
|
14692
|
+
value: decimalNumber(numStart)
|
|
14693
|
+
} },
|
|
14694
|
+
name: "w:numStart"
|
|
14695
|
+
}));
|
|
14696
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
14697
|
+
attributes: { val: {
|
|
14698
|
+
key: "w:val",
|
|
14699
|
+
value: numRestart
|
|
14700
|
+
} },
|
|
14701
|
+
name: "w:numRestart"
|
|
14702
|
+
}));
|
|
14703
|
+
return container;
|
|
14704
|
+
};
|
|
14705
|
+
/**
|
|
14706
|
+
* Footnote properties container element.
|
|
14707
|
+
*/
|
|
14708
|
+
var FootnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
14709
|
+
constructor() {
|
|
14710
|
+
super("w:footnotePr", true);
|
|
14711
|
+
}
|
|
14712
|
+
};
|
|
14713
|
+
/**
|
|
14714
|
+
* Creates endnote properties element (w:endnotePr) for a section.
|
|
14715
|
+
*
|
|
14716
|
+
* ## XSD Schema
|
|
14717
|
+
* ```xml
|
|
14718
|
+
* <xsd:complexType name="CT_EdnProps">
|
|
14719
|
+
* <xsd:sequence>
|
|
14720
|
+
* <xsd:element name="pos" type="CT_EdnPos" minOccurs="0"/>
|
|
14721
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
14722
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
14723
|
+
* </xsd:sequence>
|
|
14724
|
+
* </xsd:complexType>
|
|
14725
|
+
* ```
|
|
14726
|
+
*/
|
|
14727
|
+
const createEndnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
14728
|
+
const container = new EndnoteProperties();
|
|
14729
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
14730
|
+
attributes: { val: {
|
|
14731
|
+
key: "w:val",
|
|
14732
|
+
value: pos
|
|
14733
|
+
} },
|
|
14734
|
+
name: "w:pos"
|
|
14735
|
+
}));
|
|
14736
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
14737
|
+
attributes: {
|
|
14738
|
+
format: {
|
|
14739
|
+
key: "w:format",
|
|
14740
|
+
value: format
|
|
14741
|
+
},
|
|
14742
|
+
val: {
|
|
14743
|
+
key: "w:fmt",
|
|
14744
|
+
value: formatType
|
|
14745
|
+
}
|
|
14746
|
+
},
|
|
14747
|
+
name: "w:numFmt"
|
|
14748
|
+
}));
|
|
14749
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
14750
|
+
attributes: { val: {
|
|
14751
|
+
key: "w:val",
|
|
14752
|
+
value: decimalNumber(numStart)
|
|
14753
|
+
} },
|
|
14754
|
+
name: "w:numStart"
|
|
14755
|
+
}));
|
|
14756
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
14757
|
+
attributes: { val: {
|
|
14758
|
+
key: "w:val",
|
|
14759
|
+
value: numRestart
|
|
14760
|
+
} },
|
|
14761
|
+
name: "w:numRestart"
|
|
14762
|
+
}));
|
|
14763
|
+
return container;
|
|
14764
|
+
};
|
|
14765
|
+
/**
|
|
14766
|
+
* Endnote properties container element.
|
|
14767
|
+
*/
|
|
14768
|
+
var EndnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
14769
|
+
constructor() {
|
|
14770
|
+
super("w:endnotePr", true);
|
|
14771
|
+
}
|
|
14772
|
+
};
|
|
14773
|
+
//#endregion
|
|
13055
14774
|
//#region src/file/document/body/section-properties/properties/header-footer-reference.ts
|
|
13056
14775
|
/**
|
|
13057
14776
|
* This simple type specifies the possible types of headers and footers which may be specified for a given header or footer reference in a document. This value determines the page(s) on which the current header or footer shall be displayed.
|
|
@@ -13414,8 +15133,12 @@ const PageNumberSeparator = {
|
|
|
13414
15133
|
* });
|
|
13415
15134
|
* ```
|
|
13416
15135
|
*/
|
|
13417
|
-
const createPageNumberType = ({ start, formatType, separator }) => new BuilderElement({
|
|
15136
|
+
const createPageNumberType = ({ start, formatType, separator, chapStyle }) => new BuilderElement({
|
|
13418
15137
|
attributes: {
|
|
15138
|
+
chapStyle: {
|
|
15139
|
+
key: "w:chapStyle",
|
|
15140
|
+
value: chapStyle === void 0 ? void 0 : decimalNumber(chapStyle)
|
|
15141
|
+
},
|
|
13419
15142
|
formatType: {
|
|
13420
15143
|
key: "w:fmt",
|
|
13421
15144
|
value: formatType
|
|
@@ -13704,7 +15427,7 @@ const sectionPageSizeDefaults = {
|
|
|
13704
15427
|
* ```
|
|
13705
15428
|
*/
|
|
13706
15429
|
var SectionProperties = class extends XmlComponent {
|
|
13707
|
-
constructor({ page: { size: { width = sectionPageSizeDefaults.WIDTH, height = sectionPageSizeDefaults.HEIGHT, orientation = sectionPageSizeDefaults.ORIENTATION } = {}, margin: { top = sectionMarginDefaults.TOP, right = sectionMarginDefaults.RIGHT, bottom = sectionMarginDefaults.BOTTOM, left = sectionMarginDefaults.LEFT, header = sectionMarginDefaults.HEADER, footer = sectionMarginDefaults.FOOTER, gutter = sectionMarginDefaults.GUTTER } = {}, pageNumbers = {}, borders, textDirection } = {}, grid: { linePitch = 360, charSpace, type: gridType } = {}, headerWrapperGroup = {}, footerWrapperGroup = {}, lineNumbers, titlePage, verticalAlign, column, type, revision } = {}) {
|
|
15430
|
+
constructor({ page: { size: { width = sectionPageSizeDefaults.WIDTH, height = sectionPageSizeDefaults.HEIGHT, orientation = sectionPageSizeDefaults.ORIENTATION } = {}, margin: { top = sectionMarginDefaults.TOP, right = sectionMarginDefaults.RIGHT, bottom = sectionMarginDefaults.BOTTOM, left = sectionMarginDefaults.LEFT, header = sectionMarginDefaults.HEADER, footer = sectionMarginDefaults.FOOTER, gutter = sectionMarginDefaults.GUTTER } = {}, pageNumbers = {}, borders, textDirection } = {}, grid: { linePitch = 360, charSpace, type: gridType } = {}, headerWrapperGroup = {}, footerWrapperGroup = {}, lineNumbers, titlePage, verticalAlign, column, type, revision, noEndnote, bidi, rtlGutter, paperSrc, footnotePr, endnotePr } = {}) {
|
|
13708
15431
|
super("w:sectPr");
|
|
13709
15432
|
this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
|
|
13710
15433
|
this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
|
|
@@ -13723,6 +15446,24 @@ var SectionProperties = class extends XmlComponent {
|
|
|
13723
15446
|
if (titlePage !== void 0) this.root.push(new OnOffElement("w:titlePg", titlePage));
|
|
13724
15447
|
if (textDirection) this.root.push(new PageTextDirection(textDirection));
|
|
13725
15448
|
if (revision) this.root.push(new SectionPropertiesChange(revision));
|
|
15449
|
+
if (noEndnote !== void 0) this.root.push(new OnOffElement("w:noEndnote", noEndnote));
|
|
15450
|
+
if (bidi !== void 0) this.root.push(new OnOffElement("w:bidi", bidi));
|
|
15451
|
+
if (rtlGutter !== void 0) this.root.push(new OnOffElement("w:rtlGutter", rtlGutter));
|
|
15452
|
+
if (paperSrc) this.root.push(new BuilderElement({
|
|
15453
|
+
attributes: {
|
|
15454
|
+
first: {
|
|
15455
|
+
key: "w:first",
|
|
15456
|
+
value: paperSrc.first === void 0 ? void 0 : decimalNumber(paperSrc.first)
|
|
15457
|
+
},
|
|
15458
|
+
other: {
|
|
15459
|
+
key: "w:other",
|
|
15460
|
+
value: paperSrc.other === void 0 ? void 0 : decimalNumber(paperSrc.other)
|
|
15461
|
+
}
|
|
15462
|
+
},
|
|
15463
|
+
name: "w:paperSrc"
|
|
15464
|
+
}));
|
|
15465
|
+
if (footnotePr) this.root.push(createFootnoteProperties(footnotePr));
|
|
15466
|
+
if (endnotePr) this.root.push(createEndnoteProperties(endnotePr));
|
|
13726
15467
|
this.root.push(createDocumentGrid({
|
|
13727
15468
|
charSpace,
|
|
13728
15469
|
linePitch,
|
|
@@ -23400,12 +25141,14 @@ exports.TableProperties = TableProperties;
|
|
|
23400
25141
|
exports.TableRow = TableRow;
|
|
23401
25142
|
exports.TableRowProperties = TableRowProperties;
|
|
23402
25143
|
exports.TableRowPropertiesChange = TableRowPropertiesChange;
|
|
25144
|
+
exports.TextAlignmentType = TextAlignmentType;
|
|
23403
25145
|
exports.TextDirection = TextDirection;
|
|
23404
25146
|
exports.TextEffect = TextEffect;
|
|
23405
25147
|
exports.TextRun = TextRun;
|
|
23406
25148
|
exports.TextWrappingSide = TextWrappingSide;
|
|
23407
25149
|
exports.TextWrappingType = TextWrappingType;
|
|
23408
25150
|
exports.Textbox = Textbox;
|
|
25151
|
+
exports.TextboxTightWrapType = TextboxTightWrapType;
|
|
23409
25152
|
exports.ThematicBreak = ThematicBreak;
|
|
23410
25153
|
exports.ThemeColor = ThemeColor;
|
|
23411
25154
|
exports.ThemeFont = ThemeFont;
|