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.mjs
CHANGED
|
@@ -2259,6 +2259,57 @@ var InsertionTrackChange = class extends XmlComponent {
|
|
|
2259
2259
|
}
|
|
2260
2260
|
};
|
|
2261
2261
|
//#endregion
|
|
2262
|
+
//#region src/file/paragraph/run/east-asian-layout.ts
|
|
2263
|
+
/**
|
|
2264
|
+
* East Asian layout module for WordprocessingML run properties.
|
|
2265
|
+
*
|
|
2266
|
+
* Specifies East Asian typography settings for a run, including
|
|
2267
|
+
* character combination, vertical text, and compression.
|
|
2268
|
+
*
|
|
2269
|
+
* Reference: ISO/IEC 29500-4, CT_EastAsianLayout
|
|
2270
|
+
*
|
|
2271
|
+
* @module
|
|
2272
|
+
*/
|
|
2273
|
+
/**
|
|
2274
|
+
* Creates an East Asian layout element (w:eastAsianLayout) for a run.
|
|
2275
|
+
*
|
|
2276
|
+
* ## XSD Schema
|
|
2277
|
+
* ```xml
|
|
2278
|
+
* <xsd:complexType name="CT_EastAsianLayout">
|
|
2279
|
+
* <xsd:attribute name="id" type="ST_DecimalNumber" use="optional"/>
|
|
2280
|
+
* <xsd:attribute name="combine" type="s:ST_OnOff" use="optional"/>
|
|
2281
|
+
* <xsd:attribute name="combineBrackets" type="ST_CombineBrackets" use="optional"/>
|
|
2282
|
+
* <xsd:attribute name="vert" type="s:ST_OnOff" use="optional"/>
|
|
2283
|
+
* <xsd:attribute name="vertCompress" type="s:ST_OnOff" use="optional"/>
|
|
2284
|
+
* </xsd:complexType>
|
|
2285
|
+
* ```
|
|
2286
|
+
*/
|
|
2287
|
+
const createEastAsianLayout = ({ id, combine, combineBrackets, vert, vertCompress }) => new BuilderElement({
|
|
2288
|
+
attributes: {
|
|
2289
|
+
combine: {
|
|
2290
|
+
key: "w:combine",
|
|
2291
|
+
value: combine
|
|
2292
|
+
},
|
|
2293
|
+
combineBrackets: {
|
|
2294
|
+
key: "w:combineBrackets",
|
|
2295
|
+
value: combineBrackets
|
|
2296
|
+
},
|
|
2297
|
+
id: {
|
|
2298
|
+
key: "w:id",
|
|
2299
|
+
value: id === void 0 ? void 0 : decimalNumber(id)
|
|
2300
|
+
},
|
|
2301
|
+
vert: {
|
|
2302
|
+
key: "w:vert",
|
|
2303
|
+
value: vert
|
|
2304
|
+
},
|
|
2305
|
+
vertCompress: {
|
|
2306
|
+
key: "w:vertCompress",
|
|
2307
|
+
value: vertCompress
|
|
2308
|
+
}
|
|
2309
|
+
},
|
|
2310
|
+
name: "w:eastAsianLayout"
|
|
2311
|
+
});
|
|
2312
|
+
//#endregion
|
|
2262
2313
|
//#region src/file/paragraph/run/emphasis-mark.ts
|
|
2263
2314
|
/**
|
|
2264
2315
|
* Emphasis mark module for WordprocessingML run properties.
|
|
@@ -2990,6 +3041,7 @@ var RunProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
2990
3041
|
if (options.math) this.push(new OnOffElement("w:oMath", options.math));
|
|
2991
3042
|
if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
|
|
2992
3043
|
if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
|
|
3044
|
+
if (options.eastAsianLayout) this.push(createEastAsianLayout(options.eastAsianLayout));
|
|
2993
3045
|
if (options.revision) this.push(new RunPropertiesChange(options.revision));
|
|
2994
3046
|
}
|
|
2995
3047
|
push(item) {
|
|
@@ -3684,379 +3736,1590 @@ const createVerticalPosition = ({ relative, align, offset }) => new BuilderEleme
|
|
|
3684
3736
|
name: "wp:positionV"
|
|
3685
3737
|
});
|
|
3686
3738
|
//#endregion
|
|
3687
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
3739
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/color-transform.ts
|
|
3688
3740
|
/**
|
|
3689
|
-
*
|
|
3741
|
+
* Color transform elements for DrawingML colors.
|
|
3690
3742
|
*
|
|
3691
|
-
* This module
|
|
3743
|
+
* This module provides color transformation elements defined in EG_ColorTransform,
|
|
3744
|
+
* which can be applied as child elements to any color type (srgbClr, schemeClr, etc.).
|
|
3745
|
+
*
|
|
3746
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, EG_ColorTransform
|
|
3692
3747
|
*
|
|
3693
3748
|
* @module
|
|
3694
3749
|
*/
|
|
3695
3750
|
/**
|
|
3696
|
-
*
|
|
3751
|
+
* Creates color transform child elements.
|
|
3752
|
+
*
|
|
3753
|
+
* These elements modify the parent color according to OOXML color transform rules.
|
|
3754
|
+
* Multiple transforms can be applied in sequence.
|
|
3755
|
+
*
|
|
3756
|
+
* @example
|
|
3757
|
+
* ```typescript
|
|
3758
|
+
* // Lighten accent1 by 40%
|
|
3759
|
+
* createColorTransforms({ tint: 40000 });
|
|
3760
|
+
* // Semi-transparent red with 50% alpha
|
|
3761
|
+
* createColorTransforms({ alpha: 50000 });
|
|
3762
|
+
* ```
|
|
3763
|
+
*/
|
|
3764
|
+
const createColorTransforms = (options) => {
|
|
3765
|
+
const transforms = [];
|
|
3766
|
+
if (options.tint !== void 0) transforms.push(new BuilderElement({
|
|
3767
|
+
attributes: { val: {
|
|
3768
|
+
key: "val",
|
|
3769
|
+
value: options.tint
|
|
3770
|
+
} },
|
|
3771
|
+
name: "a:tint"
|
|
3772
|
+
}));
|
|
3773
|
+
if (options.shade !== void 0) transforms.push(new BuilderElement({
|
|
3774
|
+
attributes: { val: {
|
|
3775
|
+
key: "val",
|
|
3776
|
+
value: options.shade
|
|
3777
|
+
} },
|
|
3778
|
+
name: "a:shade"
|
|
3779
|
+
}));
|
|
3780
|
+
if (options.comp) transforms.push(new BuilderElement({ name: "a:comp" }));
|
|
3781
|
+
if (options.inv) transforms.push(new BuilderElement({ name: "a:inv" }));
|
|
3782
|
+
if (options.gray) transforms.push(new BuilderElement({ name: "a:gray" }));
|
|
3783
|
+
if (options.alpha !== void 0) transforms.push(new BuilderElement({
|
|
3784
|
+
attributes: { val: {
|
|
3785
|
+
key: "val",
|
|
3786
|
+
value: options.alpha
|
|
3787
|
+
} },
|
|
3788
|
+
name: "a:alpha"
|
|
3789
|
+
}));
|
|
3790
|
+
if (options.alphaOff !== void 0) transforms.push(new BuilderElement({
|
|
3791
|
+
attributes: { val: {
|
|
3792
|
+
key: "val",
|
|
3793
|
+
value: options.alphaOff
|
|
3794
|
+
} },
|
|
3795
|
+
name: "a:alphaOff"
|
|
3796
|
+
}));
|
|
3797
|
+
if (options.alphaMod !== void 0) transforms.push(new BuilderElement({
|
|
3798
|
+
attributes: { val: {
|
|
3799
|
+
key: "val",
|
|
3800
|
+
value: options.alphaMod
|
|
3801
|
+
} },
|
|
3802
|
+
name: "a:alphaMod"
|
|
3803
|
+
}));
|
|
3804
|
+
if (options.hue !== void 0) transforms.push(new BuilderElement({
|
|
3805
|
+
attributes: { val: {
|
|
3806
|
+
key: "val",
|
|
3807
|
+
value: options.hue
|
|
3808
|
+
} },
|
|
3809
|
+
name: "a:hue"
|
|
3810
|
+
}));
|
|
3811
|
+
if (options.hueOff !== void 0) transforms.push(new BuilderElement({
|
|
3812
|
+
attributes: { val: {
|
|
3813
|
+
key: "val",
|
|
3814
|
+
value: options.hueOff
|
|
3815
|
+
} },
|
|
3816
|
+
name: "a:hueOff"
|
|
3817
|
+
}));
|
|
3818
|
+
if (options.hueMod !== void 0) transforms.push(new BuilderElement({
|
|
3819
|
+
attributes: { val: {
|
|
3820
|
+
key: "val",
|
|
3821
|
+
value: options.hueMod
|
|
3822
|
+
} },
|
|
3823
|
+
name: "a:hueMod"
|
|
3824
|
+
}));
|
|
3825
|
+
if (options.sat !== void 0) transforms.push(new BuilderElement({
|
|
3826
|
+
attributes: { val: {
|
|
3827
|
+
key: "val",
|
|
3828
|
+
value: options.sat
|
|
3829
|
+
} },
|
|
3830
|
+
name: "a:sat"
|
|
3831
|
+
}));
|
|
3832
|
+
if (options.satOff !== void 0) transforms.push(new BuilderElement({
|
|
3833
|
+
attributes: { val: {
|
|
3834
|
+
key: "val",
|
|
3835
|
+
value: options.satOff
|
|
3836
|
+
} },
|
|
3837
|
+
name: "a:satOff"
|
|
3838
|
+
}));
|
|
3839
|
+
if (options.satMod !== void 0) transforms.push(new BuilderElement({
|
|
3840
|
+
attributes: { val: {
|
|
3841
|
+
key: "val",
|
|
3842
|
+
value: options.satMod
|
|
3843
|
+
} },
|
|
3844
|
+
name: "a:satMod"
|
|
3845
|
+
}));
|
|
3846
|
+
if (options.lum !== void 0) transforms.push(new BuilderElement({
|
|
3847
|
+
attributes: { val: {
|
|
3848
|
+
key: "val",
|
|
3849
|
+
value: options.lum
|
|
3850
|
+
} },
|
|
3851
|
+
name: "a:lum"
|
|
3852
|
+
}));
|
|
3853
|
+
if (options.lumOff !== void 0) transforms.push(new BuilderElement({
|
|
3854
|
+
attributes: { val: {
|
|
3855
|
+
key: "val",
|
|
3856
|
+
value: options.lumOff
|
|
3857
|
+
} },
|
|
3858
|
+
name: "a:lumOff"
|
|
3859
|
+
}));
|
|
3860
|
+
if (options.lumMod !== void 0) transforms.push(new BuilderElement({
|
|
3861
|
+
attributes: { val: {
|
|
3862
|
+
key: "val",
|
|
3863
|
+
value: options.lumMod
|
|
3864
|
+
} },
|
|
3865
|
+
name: "a:lumMod"
|
|
3866
|
+
}));
|
|
3867
|
+
if (options.red !== void 0) transforms.push(new BuilderElement({
|
|
3868
|
+
attributes: { val: {
|
|
3869
|
+
key: "val",
|
|
3870
|
+
value: options.red
|
|
3871
|
+
} },
|
|
3872
|
+
name: "a:red"
|
|
3873
|
+
}));
|
|
3874
|
+
if (options.redOff !== void 0) transforms.push(new BuilderElement({
|
|
3875
|
+
attributes: { val: {
|
|
3876
|
+
key: "val",
|
|
3877
|
+
value: options.redOff
|
|
3878
|
+
} },
|
|
3879
|
+
name: "a:redOff"
|
|
3880
|
+
}));
|
|
3881
|
+
if (options.redMod !== void 0) transforms.push(new BuilderElement({
|
|
3882
|
+
attributes: { val: {
|
|
3883
|
+
key: "val",
|
|
3884
|
+
value: options.redMod
|
|
3885
|
+
} },
|
|
3886
|
+
name: "a:redMod"
|
|
3887
|
+
}));
|
|
3888
|
+
if (options.green !== void 0) transforms.push(new BuilderElement({
|
|
3889
|
+
attributes: { val: {
|
|
3890
|
+
key: "val",
|
|
3891
|
+
value: options.green
|
|
3892
|
+
} },
|
|
3893
|
+
name: "a:green"
|
|
3894
|
+
}));
|
|
3895
|
+
if (options.greenOff !== void 0) transforms.push(new BuilderElement({
|
|
3896
|
+
attributes: { val: {
|
|
3897
|
+
key: "val",
|
|
3898
|
+
value: options.greenOff
|
|
3899
|
+
} },
|
|
3900
|
+
name: "a:greenOff"
|
|
3901
|
+
}));
|
|
3902
|
+
if (options.greenMod !== void 0) transforms.push(new BuilderElement({
|
|
3903
|
+
attributes: { val: {
|
|
3904
|
+
key: "val",
|
|
3905
|
+
value: options.greenMod
|
|
3906
|
+
} },
|
|
3907
|
+
name: "a:greenMod"
|
|
3908
|
+
}));
|
|
3909
|
+
if (options.blue !== void 0) transforms.push(new BuilderElement({
|
|
3910
|
+
attributes: { val: {
|
|
3911
|
+
key: "val",
|
|
3912
|
+
value: options.blue
|
|
3913
|
+
} },
|
|
3914
|
+
name: "a:blue"
|
|
3915
|
+
}));
|
|
3916
|
+
if (options.blueOff !== void 0) transforms.push(new BuilderElement({
|
|
3917
|
+
attributes: { val: {
|
|
3918
|
+
key: "val",
|
|
3919
|
+
value: options.blueOff
|
|
3920
|
+
} },
|
|
3921
|
+
name: "a:blueOff"
|
|
3922
|
+
}));
|
|
3923
|
+
if (options.blueMod !== void 0) transforms.push(new BuilderElement({
|
|
3924
|
+
attributes: { val: {
|
|
3925
|
+
key: "val",
|
|
3926
|
+
value: options.blueMod
|
|
3927
|
+
} },
|
|
3928
|
+
name: "a:blueMod"
|
|
3929
|
+
}));
|
|
3930
|
+
if (options.gamma) transforms.push(new BuilderElement({ name: "a:gamma" }));
|
|
3931
|
+
if (options.invGamma) transforms.push(new BuilderElement({ name: "a:invGamma" }));
|
|
3932
|
+
return transforms;
|
|
3933
|
+
};
|
|
3934
|
+
//#endregion
|
|
3935
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/hsl-color.ts
|
|
3936
|
+
/**
|
|
3937
|
+
* HSL color element for DrawingML.
|
|
3938
|
+
*
|
|
3939
|
+
* This module provides HSL (Hue, Saturation, Luminance) color support.
|
|
3940
|
+
*
|
|
3941
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_HslColor
|
|
3697
3942
|
*
|
|
3698
|
-
*
|
|
3943
|
+
* @module
|
|
3944
|
+
*/
|
|
3945
|
+
/**
|
|
3946
|
+
* Creates an HSL color element.
|
|
3947
|
+
*
|
|
3948
|
+
* Specifies a color using Hue, Saturation, and Luminance values.
|
|
3699
3949
|
*
|
|
3700
3950
|
* ## XSD Schema
|
|
3701
3951
|
* ```xml
|
|
3702
|
-
* <xsd:
|
|
3703
|
-
*
|
|
3952
|
+
* <xsd:complexType name="CT_HslColor">
|
|
3953
|
+
* <xsd:sequence>
|
|
3954
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
3955
|
+
* </xsd:sequence>
|
|
3956
|
+
* <xsd:attribute name="hue" type="ST_PositiveFixedAngle" use="required"/>
|
|
3957
|
+
* <xsd:attribute name="sat" type="ST_Percentage" use="required"/>
|
|
3958
|
+
* <xsd:attribute name="lum" type="ST_Percentage" use="required"/>
|
|
3959
|
+
* </xsd:complexType>
|
|
3704
3960
|
* ```
|
|
3705
|
-
*
|
|
3706
|
-
* @internal
|
|
3707
3961
|
*/
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3962
|
+
const createHslColor = (options) => {
|
|
3963
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
3964
|
+
return new BuilderElement({
|
|
3965
|
+
attributes: {
|
|
3966
|
+
hue: {
|
|
3967
|
+
key: "hue",
|
|
3968
|
+
value: options.hue
|
|
3969
|
+
},
|
|
3970
|
+
lum: {
|
|
3971
|
+
key: "lum",
|
|
3972
|
+
value: options.lum
|
|
3973
|
+
},
|
|
3974
|
+
sat: {
|
|
3975
|
+
key: "sat",
|
|
3976
|
+
value: options.sat
|
|
3977
|
+
}
|
|
3978
|
+
},
|
|
3979
|
+
children: [...transforms],
|
|
3980
|
+
name: "a:hslClr"
|
|
3981
|
+
});
|
|
3716
3982
|
};
|
|
3717
3983
|
//#endregion
|
|
3718
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
3984
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/preset-color.ts
|
|
3719
3985
|
/**
|
|
3720
|
-
*
|
|
3986
|
+
* Preset color element for DrawingML.
|
|
3721
3987
|
*
|
|
3722
|
-
* This module
|
|
3988
|
+
* This module provides named preset colors (CSS named colors).
|
|
3723
3989
|
*
|
|
3724
|
-
* Reference:
|
|
3990
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetColor / ST_PresetColorVal
|
|
3725
3991
|
*
|
|
3726
3992
|
* @module
|
|
3727
3993
|
*/
|
|
3728
3994
|
/**
|
|
3729
|
-
*
|
|
3730
|
-
*
|
|
3731
|
-
* Defines the width and height of the shape in English Metric Units (EMUs).
|
|
3732
|
-
* One EMU equals 1/914,400 of an inch.
|
|
3733
|
-
*
|
|
3734
|
-
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
3995
|
+
* Preset color values (CSS named colors).
|
|
3735
3996
|
*
|
|
3736
3997
|
* ## XSD Schema
|
|
3737
3998
|
* ```xml
|
|
3738
|
-
* <xsd:
|
|
3739
|
-
* <xsd:
|
|
3740
|
-
*
|
|
3741
|
-
*
|
|
3742
|
-
*
|
|
3743
|
-
*
|
|
3744
|
-
*
|
|
3745
|
-
* ```typescript
|
|
3746
|
-
* // Create a 1-inch by 1-inch shape
|
|
3747
|
-
* const extents = new Extents(914400, 914400);
|
|
3999
|
+
* <xsd:simpleType name="ST_PresetColorVal">
|
|
4000
|
+
* <xsd:restriction base="xsd:token">
|
|
4001
|
+
* <xsd:enumeration value="aliceBlue"/>
|
|
4002
|
+
* ...
|
|
4003
|
+
* <xsd:enumeration value="yellowGreen"/>
|
|
4004
|
+
* </xsd:restriction>
|
|
4005
|
+
* </xsd:simpleType>
|
|
3748
4006
|
* ```
|
|
3749
4007
|
*/
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
4008
|
+
const PresetColor = {
|
|
4009
|
+
ALICE_BLUE: "aliceBlue",
|
|
4010
|
+
ANTIQUE_WHITE: "antiqueWhite",
|
|
4011
|
+
AQUA: "aqua",
|
|
4012
|
+
AQUAMARINE: "aquamarine",
|
|
4013
|
+
AZURE: "azure",
|
|
4014
|
+
BEIGE: "beige",
|
|
4015
|
+
BISQUE: "bisque",
|
|
4016
|
+
BLACK: "black",
|
|
4017
|
+
BLANCHED_ALMOND: "blanchedAlmond",
|
|
4018
|
+
BLUE: "blue",
|
|
4019
|
+
BLUE_VIOLET: "blueViolet",
|
|
4020
|
+
BROWN: "brown",
|
|
4021
|
+
BURLY_WOOD: "burlyWood",
|
|
4022
|
+
CADET_BLUE: "cadetBlue",
|
|
4023
|
+
CHARTREUSE: "chartreuse",
|
|
4024
|
+
CHOCOLATE: "chocolate",
|
|
4025
|
+
CORAL: "coral",
|
|
4026
|
+
CORNFLOWER_BLUE: "cornflowerBlue",
|
|
4027
|
+
CORNSILK: "cornsilk",
|
|
4028
|
+
CRIMSON: "crimson",
|
|
4029
|
+
CYAN: "cyan",
|
|
4030
|
+
DARK_BLUE: "darkBlue",
|
|
4031
|
+
DARK_CYAN: "darkCyan",
|
|
4032
|
+
DARK_GOLDENROD: "darkGoldenrod",
|
|
4033
|
+
DARK_GRAY: "darkGray",
|
|
4034
|
+
DARK_GREY: "darkGrey",
|
|
4035
|
+
DARK_GREEN: "darkGreen",
|
|
4036
|
+
DARK_KHAKI: "darkKhaki",
|
|
4037
|
+
DARK_MAGENTA: "darkMagenta",
|
|
4038
|
+
DARK_OLIVE_GREEN: "darkOliveGreen",
|
|
4039
|
+
DARK_ORANGE: "darkOrange",
|
|
4040
|
+
DARK_ORCHID: "darkOrchid",
|
|
4041
|
+
DARK_RED: "darkRed",
|
|
4042
|
+
DARK_SALMON: "darkSalmon",
|
|
4043
|
+
DARK_SEA_GREEN: "darkSeaGreen",
|
|
4044
|
+
DARK_SLATE_BLUE: "darkSlateBlue",
|
|
4045
|
+
DARK_SLATE_GRAY: "darkSlateGray",
|
|
4046
|
+
DARK_SLATE_GREY: "darkSlateGrey",
|
|
4047
|
+
DARK_TURQUOISE: "darkTurquoise",
|
|
4048
|
+
DARK_VIOLET: "darkViolet",
|
|
4049
|
+
DEEP_PINK: "deepPink",
|
|
4050
|
+
DEEP_SKY_BLUE: "deepSkyBlue",
|
|
4051
|
+
DIM_GRAY: "dimGray",
|
|
4052
|
+
DIM_GREY: "dimGrey",
|
|
4053
|
+
DODGER_BLUE: "dodgerBlue",
|
|
4054
|
+
FIREBRICK: "firebrick",
|
|
4055
|
+
FLORAL_WHITE: "floralWhite",
|
|
4056
|
+
FOREST_GREEN: "forestGreen",
|
|
4057
|
+
FUCHSIA: "fuchsia",
|
|
4058
|
+
GAINSBORO: "gainsboro",
|
|
4059
|
+
GHOST_WHITE: "ghostWhite",
|
|
4060
|
+
GOLD: "gold",
|
|
4061
|
+
GOLDENROD: "goldenrod",
|
|
4062
|
+
GRAY: "gray",
|
|
4063
|
+
GREY: "grey",
|
|
4064
|
+
GREEN: "green",
|
|
4065
|
+
GREEN_YELLOW: "greenYellow",
|
|
4066
|
+
HONEYDEW: "honeydew",
|
|
4067
|
+
HOT_PINK: "hotPink",
|
|
4068
|
+
INDIAN_RED: "indianRed",
|
|
4069
|
+
INDIGO: "indigo",
|
|
4070
|
+
IVORY: "ivory",
|
|
4071
|
+
KHAKI: "khaki",
|
|
4072
|
+
LAVENDER: "lavender",
|
|
4073
|
+
LAVENDER_BLUSH: "lavenderBlush",
|
|
4074
|
+
LAWN_GREEN: "lawnGreen",
|
|
4075
|
+
LEMON_CHIFFON: "lemonChiffon",
|
|
4076
|
+
LIGHT_BLUE: "lightBlue",
|
|
4077
|
+
LIGHT_CORAL: "lightCoral",
|
|
4078
|
+
LIGHT_CYAN: "lightCyan",
|
|
4079
|
+
LIGHT_GOLDENROD_YELLOW: "lightGoldenrodYellow",
|
|
4080
|
+
LIGHT_GRAY: "lightGray",
|
|
4081
|
+
LIGHT_GREY: "lightGrey",
|
|
4082
|
+
LIGHT_GREEN: "lightGreen",
|
|
4083
|
+
LIGHT_PINK: "lightPink",
|
|
4084
|
+
LIGHT_SALMON: "lightSalmon",
|
|
4085
|
+
LIGHT_SEA_GREEN: "lightSeaGreen",
|
|
4086
|
+
LIGHT_SKY_BLUE: "lightSkyBlue",
|
|
4087
|
+
LIGHT_SLATE_GRAY: "lightSlateGray",
|
|
4088
|
+
LIGHT_SLATE_GREY: "lightSlateGrey",
|
|
4089
|
+
LIGHT_STEEL_BLUE: "lightSteelBlue",
|
|
4090
|
+
LIGHT_YELLOW: "lightYellow",
|
|
4091
|
+
LIME: "lime",
|
|
4092
|
+
LIME_GREEN: "limeGreen",
|
|
4093
|
+
LINEN: "linen",
|
|
4094
|
+
MAGENTA: "magenta",
|
|
4095
|
+
MAROON: "maroon",
|
|
4096
|
+
MEDIUM_AQUAMARINE: "mediumAquamarine",
|
|
4097
|
+
MEDIUM_BLUE: "mediumBlue",
|
|
4098
|
+
MEDIUM_ORCHID: "mediumOrchid",
|
|
4099
|
+
MEDIUM_PURPLE: "mediumPurple",
|
|
4100
|
+
MEDIUM_SEA_GREEN: "mediumSeaGreen",
|
|
4101
|
+
MEDIUM_SLATE_BLUE: "mediumSlateBlue",
|
|
4102
|
+
MEDIUM_SPRING_GREEN: "mediumSpringGreen",
|
|
4103
|
+
MEDIUM_TURQUOISE: "mediumTurquoise",
|
|
4104
|
+
MEDIUM_VIOLET_RED: "mediumVioletRed",
|
|
4105
|
+
MIDNIGHT_BLUE: "midnightBlue",
|
|
4106
|
+
MINT_CREAM: "mintCream",
|
|
4107
|
+
MISTY_ROSE: "mistyRose",
|
|
4108
|
+
MOCCASIN: "moccasin",
|
|
4109
|
+
NAVAJO_WHITE: "navajoWhite",
|
|
4110
|
+
NAVY: "navy",
|
|
4111
|
+
OLD_LACE: "oldLace",
|
|
4112
|
+
OLIVE: "olive",
|
|
4113
|
+
OLIVE_DRAB: "oliveDrab",
|
|
4114
|
+
ORANGE: "orange",
|
|
4115
|
+
ORANGE_RED: "orangeRed",
|
|
4116
|
+
ORCHID: "orchid",
|
|
4117
|
+
PALE_GOLDENROD: "paleGoldenrod",
|
|
4118
|
+
PALE_GREEN: "paleGreen",
|
|
4119
|
+
PALE_TURQUOISE: "paleTurquoise",
|
|
4120
|
+
PALE_VIOLET_RED: "paleVioletRed",
|
|
4121
|
+
PAPAYA_WHIP: "papayaWhip",
|
|
4122
|
+
PEACH_PUFF: "peachPuff",
|
|
4123
|
+
PERU: "peru",
|
|
4124
|
+
PINK: "pink",
|
|
4125
|
+
PLUM: "plum",
|
|
4126
|
+
POWDER_BLUE: "powderBlue",
|
|
4127
|
+
PURPLE: "purple",
|
|
4128
|
+
RED: "red",
|
|
4129
|
+
ROSY_BROWN: "rosyBrown",
|
|
4130
|
+
ROYAL_BLUE: "royalBlue",
|
|
4131
|
+
SADDLE_BROWN: "saddleBrown",
|
|
4132
|
+
SALMON: "salmon",
|
|
4133
|
+
SANDY_BROWN: "sandyBrown",
|
|
4134
|
+
SEA_GREEN: "seaGreen",
|
|
4135
|
+
SEA_SHELL: "seaShell",
|
|
4136
|
+
SIENNA: "sienna",
|
|
4137
|
+
SILVER: "silver",
|
|
4138
|
+
SKY_BLUE: "skyBlue",
|
|
4139
|
+
SLATE_BLUE: "slateBlue",
|
|
4140
|
+
SLATE_GRAY: "slateGray",
|
|
4141
|
+
SLATE_GREY: "slateGrey",
|
|
4142
|
+
SNOW: "snow",
|
|
4143
|
+
SPRING_GREEN: "springGreen",
|
|
4144
|
+
STEEL_BLUE: "steelBlue",
|
|
4145
|
+
TAN: "tan",
|
|
4146
|
+
TEAL: "teal",
|
|
4147
|
+
THISTLE: "thistle",
|
|
4148
|
+
TOMATO: "tomato",
|
|
4149
|
+
TURQUOISE: "turquoise",
|
|
4150
|
+
VIOLET: "violet",
|
|
4151
|
+
WHEAT: "wheat",
|
|
4152
|
+
WHITE: "white",
|
|
4153
|
+
WHITE_SMOKE: "whiteSmoke",
|
|
4154
|
+
YELLOW: "yellow",
|
|
4155
|
+
YELLOW_GREEN: "yellowGreen"
|
|
3760
4156
|
};
|
|
3761
|
-
//#endregion
|
|
3762
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/offset/off-attributes.ts
|
|
3763
|
-
/**
|
|
3764
|
-
* Offset attributes for DrawingML shapes.
|
|
3765
|
-
*
|
|
3766
|
-
* This module defines the x and y coordinate attributes for shape offset.
|
|
3767
|
-
*
|
|
3768
|
-
* @module
|
|
3769
|
-
*/
|
|
3770
4157
|
/**
|
|
3771
|
-
*
|
|
4158
|
+
* Creates a preset color element.
|
|
3772
4159
|
*
|
|
3773
|
-
*
|
|
4160
|
+
* Specifies a color using a named preset (CSS named color).
|
|
3774
4161
|
*
|
|
3775
4162
|
* ## XSD Schema
|
|
3776
4163
|
* ```xml
|
|
3777
|
-
* <xsd:
|
|
3778
|
-
*
|
|
4164
|
+
* <xsd:complexType name="CT_PresetColor">
|
|
4165
|
+
* <xsd:sequence>
|
|
4166
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4167
|
+
* </xsd:sequence>
|
|
4168
|
+
* <xsd:attribute name="val" type="ST_PresetColorVal" use="required"/>
|
|
4169
|
+
* </xsd:complexType>
|
|
3779
4170
|
* ```
|
|
3780
|
-
*
|
|
3781
|
-
* @internal
|
|
3782
4171
|
*/
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
}
|
|
3790
|
-
|
|
4172
|
+
const createPresetColor = (options) => {
|
|
4173
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4174
|
+
return new BuilderElement({
|
|
4175
|
+
attributes: { value: {
|
|
4176
|
+
key: "val",
|
|
4177
|
+
value: options.value
|
|
4178
|
+
} },
|
|
4179
|
+
children: [...transforms],
|
|
4180
|
+
name: "a:prstClr"
|
|
4181
|
+
});
|
|
3791
4182
|
};
|
|
3792
4183
|
//#endregion
|
|
3793
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
4184
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/rgb-color.ts
|
|
3794
4185
|
/**
|
|
3795
|
-
*
|
|
4186
|
+
* RGB color element for DrawingML shapes.
|
|
3796
4187
|
*
|
|
3797
|
-
* This module
|
|
4188
|
+
* This module provides RGB color support for solid fills.
|
|
3798
4189
|
*
|
|
3799
|
-
* Reference:
|
|
4190
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SRgbColor
|
|
3800
4191
|
*
|
|
3801
4192
|
* @module
|
|
3802
4193
|
*/
|
|
3803
4194
|
/**
|
|
3804
|
-
*
|
|
3805
|
-
*
|
|
3806
|
-
* Defines the x and y coordinates of the shape's position in
|
|
3807
|
-
* English Metric Units (EMUs). One EMU equals 1/914,400 of an inch.
|
|
4195
|
+
* Creates an sRGB color element.
|
|
3808
4196
|
*
|
|
3809
|
-
*
|
|
4197
|
+
* Specifies a color using RGB hex values.
|
|
3810
4198
|
*
|
|
3811
4199
|
* ## XSD Schema
|
|
3812
4200
|
* ```xml
|
|
3813
|
-
* <xsd:complexType name="
|
|
3814
|
-
* <xsd:
|
|
3815
|
-
*
|
|
4201
|
+
* <xsd:complexType name="CT_SRgbColor">
|
|
4202
|
+
* <xsd:sequence>
|
|
4203
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4204
|
+
* </xsd:sequence>
|
|
4205
|
+
* <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
|
|
3816
4206
|
* </xsd:complexType>
|
|
3817
4207
|
* ```
|
|
3818
4208
|
*
|
|
3819
4209
|
* @example
|
|
3820
4210
|
* ```typescript
|
|
3821
|
-
* const
|
|
4211
|
+
* const redColor = createRgbColor({ value: "FF0000" });
|
|
4212
|
+
* // With alpha transform
|
|
4213
|
+
* const semiRed = createRgbColor({ value: "FF0000", transforms: { alpha: 50000 } });
|
|
3822
4214
|
* ```
|
|
3823
4215
|
*/
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
}
|
|
3831
|
-
|
|
4216
|
+
const createRgbColor = (options) => {
|
|
4217
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4218
|
+
return new BuilderElement({
|
|
4219
|
+
attributes: { value: {
|
|
4220
|
+
key: "val",
|
|
4221
|
+
value: options.value
|
|
4222
|
+
} },
|
|
4223
|
+
children: [...transforms],
|
|
4224
|
+
name: "a:srgbClr"
|
|
4225
|
+
});
|
|
3832
4226
|
};
|
|
3833
4227
|
//#endregion
|
|
3834
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
4228
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/scheme-color.ts
|
|
3835
4229
|
/**
|
|
3836
|
-
*
|
|
4230
|
+
* Scheme color element for DrawingML shapes.
|
|
3837
4231
|
*
|
|
3838
|
-
*
|
|
4232
|
+
* This module provides scheme-based color support for solid fills,
|
|
4233
|
+
* allowing colors to be defined using theme color schemes.
|
|
4234
|
+
*
|
|
4235
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SchemeColor / ST_SchemeColorVal
|
|
4236
|
+
*
|
|
4237
|
+
* @module
|
|
3839
4238
|
*/
|
|
3840
|
-
var FormAttributes = class extends XmlAttributeComponent {
|
|
3841
|
-
constructor(..._args) {
|
|
3842
|
-
super(..._args);
|
|
3843
|
-
_defineProperty(this, "xmlKeys", {
|
|
3844
|
-
flipHorizontal: "flipH",
|
|
3845
|
-
flipVertical: "flipV",
|
|
3846
|
-
rotation: "rot"
|
|
3847
|
-
});
|
|
3848
|
-
}
|
|
3849
|
-
};
|
|
3850
4239
|
/**
|
|
3851
|
-
*
|
|
4240
|
+
* Scheme color values for theme-based colors.
|
|
3852
4241
|
*
|
|
3853
|
-
*
|
|
3854
|
-
|
|
4242
|
+
* These values reference colors defined in the document's color scheme/theme.
|
|
4243
|
+
*/
|
|
4244
|
+
const SchemeColor = {
|
|
4245
|
+
BG1: "bg1",
|
|
4246
|
+
TX1: "tx1",
|
|
4247
|
+
BG2: "bg2",
|
|
4248
|
+
TX2: "tx2",
|
|
4249
|
+
ACCENT1: "accent1",
|
|
4250
|
+
ACCENT2: "accent2",
|
|
4251
|
+
ACCENT3: "accent3",
|
|
4252
|
+
ACCENT4: "accent4",
|
|
4253
|
+
ACCENT5: "accent5",
|
|
4254
|
+
ACCENT6: "accent6",
|
|
4255
|
+
HLINK: "hlink",
|
|
4256
|
+
FOLHLINK: "folHlink",
|
|
4257
|
+
DK1: "dk1",
|
|
4258
|
+
LT1: "lt1",
|
|
4259
|
+
DK2: "dk2",
|
|
4260
|
+
LT2: "lt2",
|
|
4261
|
+
PHCLR: "phClr"
|
|
4262
|
+
};
|
|
4263
|
+
/**
|
|
4264
|
+
* Creates a scheme color element.
|
|
3855
4265
|
*
|
|
3856
|
-
*
|
|
4266
|
+
* Specifies a color using a theme color scheme reference.
|
|
3857
4267
|
*
|
|
3858
4268
|
* ## XSD Schema
|
|
3859
4269
|
* ```xml
|
|
3860
|
-
* <xsd:complexType name="
|
|
4270
|
+
* <xsd:complexType name="CT_SchemeColor">
|
|
3861
4271
|
* <xsd:sequence>
|
|
3862
|
-
* <xsd:
|
|
3863
|
-
* <xsd:element name="ext" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
4272
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
3864
4273
|
* </xsd:sequence>
|
|
3865
|
-
* <xsd:attribute name="
|
|
3866
|
-
* <xsd:attribute name="flipH" type="xsd:boolean" use="optional"/>
|
|
3867
|
-
* <xsd:attribute name="flipV" type="xsd:boolean" use="optional"/>
|
|
4274
|
+
* <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
|
|
3868
4275
|
* </xsd:complexType>
|
|
3869
4276
|
* ```
|
|
3870
4277
|
*
|
|
3871
4278
|
* @example
|
|
3872
4279
|
* ```typescript
|
|
3873
|
-
* const
|
|
3874
|
-
*
|
|
3875
|
-
*
|
|
3876
|
-
*
|
|
4280
|
+
* const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });
|
|
4281
|
+
* // With tint transform
|
|
4282
|
+
* const lightAccent = createSchemeColor({
|
|
4283
|
+
* value: SchemeColor.ACCENT1,
|
|
4284
|
+
* transforms: { tint: 40000 },
|
|
3877
4285
|
* });
|
|
3878
4286
|
* ```
|
|
3879
4287
|
*/
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
}));
|
|
3891
|
-
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);
|
|
3892
|
-
this.extents = new Extents(options.emus.x, options.emus.y);
|
|
3893
|
-
this.root.push(this.offset);
|
|
3894
|
-
this.root.push(this.extents);
|
|
3895
|
-
}
|
|
4288
|
+
const createSchemeColor = (options) => {
|
|
4289
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4290
|
+
return new BuilderElement({
|
|
4291
|
+
attributes: { value: {
|
|
4292
|
+
key: "val",
|
|
4293
|
+
value: options.value
|
|
4294
|
+
} },
|
|
4295
|
+
children: [...transforms],
|
|
4296
|
+
name: "a:schemeClr"
|
|
4297
|
+
});
|
|
3896
4298
|
};
|
|
3897
4299
|
//#endregion
|
|
3898
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/
|
|
4300
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/system-color.ts
|
|
3899
4301
|
/**
|
|
3900
|
-
*
|
|
4302
|
+
* System color element for DrawingML.
|
|
3901
4303
|
*
|
|
3902
|
-
* This module provides
|
|
4304
|
+
* This module provides system color support, referencing OS-level UI colors.
|
|
4305
|
+
*
|
|
4306
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SystemColor / ST_SystemColorVal
|
|
3903
4307
|
*
|
|
3904
4308
|
* @module
|
|
3905
4309
|
*/
|
|
3906
4310
|
/**
|
|
3907
|
-
*
|
|
3908
|
-
*
|
|
3909
|
-
* Specifies that the outline or shape should have no fill applied.
|
|
4311
|
+
* System color values referencing OS UI colors.
|
|
3910
4312
|
*
|
|
3911
4313
|
* ## XSD Schema
|
|
3912
4314
|
* ```xml
|
|
3913
|
-
* <xsd:
|
|
4315
|
+
* <xsd:simpleType name="ST_SystemColorVal">
|
|
4316
|
+
* <xsd:restriction base="xsd:token">
|
|
4317
|
+
* <xsd:enumeration value="scrollBar"/>
|
|
4318
|
+
* <xsd:enumeration value="background"/>
|
|
4319
|
+
* ...
|
|
4320
|
+
* <xsd:enumeration value="menuBar"/>
|
|
4321
|
+
* </xsd:restriction>
|
|
4322
|
+
* </xsd:simpleType>
|
|
3914
4323
|
* ```
|
|
4324
|
+
*/
|
|
4325
|
+
const SystemColor = {
|
|
4326
|
+
SCROLL_BAR: "scrollBar",
|
|
4327
|
+
BACKGROUND: "background",
|
|
4328
|
+
ACTIVE_CAPTION: "activeCaption",
|
|
4329
|
+
INACTIVE_CAPTION: "inactiveCaption",
|
|
4330
|
+
MENU: "menu",
|
|
4331
|
+
WINDOW: "window",
|
|
4332
|
+
WINDOW_FRAME: "windowFrame",
|
|
4333
|
+
MENU_TEXT: "menuText",
|
|
4334
|
+
WINDOW_TEXT: "windowText",
|
|
4335
|
+
CAPTION_TEXT: "captionText",
|
|
4336
|
+
ACTIVE_BORDER: "activeBorder",
|
|
4337
|
+
INACTIVE_BORDER: "inactiveBorder",
|
|
4338
|
+
APP_WORKSPACE: "appWorkspace",
|
|
4339
|
+
HIGHLIGHT: "highlight",
|
|
4340
|
+
HIGHLIGHT_TEXT: "highlightText",
|
|
4341
|
+
BTN_FACE: "btnFace",
|
|
4342
|
+
BTN_SHADOW: "btnShadow",
|
|
4343
|
+
GRAY_TEXT: "grayText",
|
|
4344
|
+
BTN_TEXT: "btnText",
|
|
4345
|
+
INACTIVE_CAPTION_TEXT: "inactiveCaptionText",
|
|
4346
|
+
BTN_HIGHLIGHT: "btnHighlight",
|
|
4347
|
+
THREE_D_DK_SHADOW: "3dDkShadow",
|
|
4348
|
+
THREE_D_LIGHT: "3dLight",
|
|
4349
|
+
INFO_TEXT: "infoText",
|
|
4350
|
+
INFO_BK: "infoBk",
|
|
4351
|
+
HOT_LIGHT: "hotLight",
|
|
4352
|
+
GRADIENT_ACTIVE_CAPTION: "gradientActiveCaption",
|
|
4353
|
+
GRADIENT_INACTIVE_CAPTION: "gradientInactiveCaption",
|
|
4354
|
+
MENU_HIGHLIGHT: "menuHighlight",
|
|
4355
|
+
MENU_BAR: "menuBar"
|
|
4356
|
+
};
|
|
4357
|
+
/**
|
|
4358
|
+
* Creates a system color element.
|
|
4359
|
+
*
|
|
4360
|
+
* References a system-defined UI color (e.g., window background, button face).
|
|
3915
4361
|
*
|
|
3916
|
-
*
|
|
3917
|
-
* ```
|
|
3918
|
-
*
|
|
4362
|
+
* ## XSD Schema
|
|
4363
|
+
* ```xml
|
|
4364
|
+
* <xsd:complexType name="CT_SystemColor">
|
|
4365
|
+
* <xsd:sequence>
|
|
4366
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4367
|
+
* </xsd:sequence>
|
|
4368
|
+
* <xsd:attribute name="val" type="ST_SystemColorVal" use="required"/>
|
|
4369
|
+
* <xsd:attribute name="lastClr" type="s:ST_HexColorRGB" use="optional"/>
|
|
4370
|
+
* </xsd:complexType>
|
|
3919
4371
|
* ```
|
|
3920
4372
|
*/
|
|
3921
|
-
const
|
|
4373
|
+
const createSystemColor = (options) => {
|
|
4374
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4375
|
+
return new BuilderElement({
|
|
4376
|
+
attributes: {
|
|
4377
|
+
lastClr: {
|
|
4378
|
+
key: "lastClr",
|
|
4379
|
+
value: options.lastClr
|
|
4380
|
+
},
|
|
4381
|
+
value: {
|
|
4382
|
+
key: "val",
|
|
4383
|
+
value: options.value
|
|
4384
|
+
}
|
|
4385
|
+
},
|
|
4386
|
+
children: [...transforms],
|
|
4387
|
+
name: "a:sysClr"
|
|
4388
|
+
});
|
|
4389
|
+
};
|
|
3922
4390
|
//#endregion
|
|
3923
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/
|
|
4391
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/solid-fill.ts
|
|
3924
4392
|
/**
|
|
3925
|
-
*
|
|
4393
|
+
* Solid fill element for DrawingML shapes.
|
|
3926
4394
|
*
|
|
3927
|
-
* This module provides
|
|
4395
|
+
* This module provides solid fill support for outlines and shapes,
|
|
4396
|
+
* supporting RGB, scheme, HSL, system, and preset colors.
|
|
4397
|
+
*
|
|
4398
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SolidColorFillProperties
|
|
3928
4399
|
*
|
|
3929
4400
|
* @module
|
|
3930
4401
|
*/
|
|
3931
4402
|
/**
|
|
3932
|
-
* Creates
|
|
4403
|
+
* Creates the color child element for a solid fill based on the color type.
|
|
4404
|
+
*/
|
|
4405
|
+
const SYSTEM_COLOR_VALUES = new Set(Object.values(SystemColor));
|
|
4406
|
+
const PRESET_COLOR_VALUES = new Set(Object.values(PresetColor));
|
|
4407
|
+
const SCHEME_COLOR_VALUES = new Set(Object.values(SchemeColor));
|
|
4408
|
+
const createColorElement = (color) => {
|
|
4409
|
+
if ("hue" in color && "sat" in color && "lum" in color) return createHslColor(color);
|
|
4410
|
+
const colorValue = color.value;
|
|
4411
|
+
if (SYSTEM_COLOR_VALUES.has(colorValue)) return createSystemColor(color);
|
|
4412
|
+
if (PRESET_COLOR_VALUES.has(colorValue)) return createPresetColor(color);
|
|
4413
|
+
if (SCHEME_COLOR_VALUES.has(colorValue)) return createSchemeColor(color);
|
|
4414
|
+
return createRgbColor(color);
|
|
4415
|
+
};
|
|
4416
|
+
/**
|
|
4417
|
+
* Creates a solid fill element.
|
|
3933
4418
|
*
|
|
3934
|
-
* Specifies a color using
|
|
4419
|
+
* Specifies a solid color fill using any supported color type.
|
|
3935
4420
|
*
|
|
3936
4421
|
* ## XSD Schema
|
|
3937
4422
|
* ```xml
|
|
3938
|
-
* <xsd:complexType name="
|
|
4423
|
+
* <xsd:complexType name="CT_SolidColorFillProperties">
|
|
3939
4424
|
* <xsd:sequence>
|
|
3940
|
-
* <xsd:group ref="
|
|
4425
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="0"/>
|
|
4426
|
+
* <xsd:group ref="EG_EffectProperties" minOccurs="0"/>
|
|
3941
4427
|
* </xsd:sequence>
|
|
3942
|
-
* <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
|
|
3943
4428
|
* </xsd:complexType>
|
|
3944
4429
|
* ```
|
|
3945
4430
|
*
|
|
3946
4431
|
* @example
|
|
3947
4432
|
* ```typescript
|
|
3948
|
-
*
|
|
3949
|
-
* const
|
|
4433
|
+
* // RGB solid fill
|
|
4434
|
+
* const fill = createSolidFill({ value: "FF0000" });
|
|
4435
|
+
* // Scheme solid fill with tint
|
|
4436
|
+
* const schemeFill = createSolidFill({
|
|
4437
|
+
* value: SchemeColor.ACCENT1, transforms: { tint: 40000 },
|
|
4438
|
+
* });
|
|
4439
|
+
* // HSL solid fill
|
|
4440
|
+
* const hslFill = createSolidFill({ hue: 120000, sat: 100000, lum: 50000 });
|
|
3950
4441
|
* ```
|
|
3951
4442
|
*/
|
|
3952
|
-
const
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
4443
|
+
const createSolidFill = (options) => new BuilderElement({
|
|
4444
|
+
children: [createColorElement(options)],
|
|
4445
|
+
name: "a:solidFill"
|
|
4446
|
+
});
|
|
4447
|
+
//#endregion
|
|
4448
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/glow.ts
|
|
4449
|
+
/**
|
|
4450
|
+
* Glow effect for DrawingML shapes.
|
|
4451
|
+
*
|
|
4452
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GlowEffect
|
|
4453
|
+
*
|
|
4454
|
+
* @module
|
|
4455
|
+
*/
|
|
4456
|
+
/**
|
|
4457
|
+
* Creates a glow effect element.
|
|
4458
|
+
*
|
|
4459
|
+
* ## XSD Schema
|
|
4460
|
+
* ```xml
|
|
4461
|
+
* <xsd:complexType name="CT_GlowEffect">
|
|
4462
|
+
* <xsd:sequence>
|
|
4463
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4464
|
+
* </xsd:sequence>
|
|
4465
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="optional" default="0"/>
|
|
4466
|
+
* </xsd:complexType>
|
|
4467
|
+
* ```
|
|
4468
|
+
*/
|
|
4469
|
+
const createGlowEffect = (options) => {
|
|
4470
|
+
if (options.rad === void 0) return new BuilderElement({
|
|
4471
|
+
children: [createColorElement(options.color)],
|
|
4472
|
+
name: "a:glow"
|
|
4473
|
+
});
|
|
4474
|
+
return new BuilderElement({
|
|
4475
|
+
attributes: { rad: {
|
|
4476
|
+
key: "rad",
|
|
4477
|
+
value: options.rad
|
|
4478
|
+
} },
|
|
4479
|
+
children: [createColorElement(options.color)],
|
|
4480
|
+
name: "a:glow"
|
|
4481
|
+
});
|
|
4482
|
+
};
|
|
4483
|
+
//#endregion
|
|
4484
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/inner-shdw.ts
|
|
4485
|
+
/**
|
|
4486
|
+
* Inner shadow effect for DrawingML shapes.
|
|
4487
|
+
*
|
|
4488
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_InnerShadowEffect
|
|
4489
|
+
*
|
|
4490
|
+
* @module
|
|
4491
|
+
*/
|
|
4492
|
+
/**
|
|
4493
|
+
* Creates an inner shadow effect element.
|
|
4494
|
+
*
|
|
4495
|
+
* ## XSD Schema
|
|
4496
|
+
* ```xml
|
|
4497
|
+
* <xsd:complexType name="CT_InnerShadowEffect">
|
|
4498
|
+
* <xsd:sequence>
|
|
4499
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4500
|
+
* </xsd:sequence>
|
|
4501
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4502
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4503
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4504
|
+
* </xsd:complexType>
|
|
4505
|
+
* ```
|
|
4506
|
+
*/
|
|
4507
|
+
const createInnerShadowEffect = (options) => {
|
|
4508
|
+
if (!(options.blurRad !== void 0 || options.dist !== void 0 || options.dir !== void 0)) return new BuilderElement({
|
|
4509
|
+
children: [createColorElement(options.color)],
|
|
4510
|
+
name: "a:innerShdw"
|
|
4511
|
+
});
|
|
4512
|
+
return new BuilderElement({
|
|
4513
|
+
attributes: {
|
|
4514
|
+
...options.blurRad !== void 0 && { blurRad: {
|
|
4515
|
+
key: "blurRad",
|
|
4516
|
+
value: options.blurRad
|
|
4517
|
+
} },
|
|
4518
|
+
...options.dist !== void 0 && { dist: {
|
|
4519
|
+
key: "dist",
|
|
4520
|
+
value: options.dist
|
|
4521
|
+
} },
|
|
4522
|
+
...options.dir !== void 0 && { dir: {
|
|
4523
|
+
key: "dir",
|
|
4524
|
+
value: options.dir
|
|
4525
|
+
} }
|
|
4526
|
+
},
|
|
4527
|
+
children: [createColorElement(options.color)],
|
|
4528
|
+
name: "a:innerShdw"
|
|
4529
|
+
});
|
|
4530
|
+
};
|
|
4531
|
+
//#endregion
|
|
4532
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/outer-shdw.ts
|
|
4533
|
+
/**
|
|
4534
|
+
* Outer shadow effect for DrawingML shapes.
|
|
4535
|
+
*
|
|
4536
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_OuterShadowEffect
|
|
4537
|
+
*
|
|
4538
|
+
* @module
|
|
4539
|
+
*/
|
|
4540
|
+
/**
|
|
4541
|
+
* Rectangle alignment for shadow positioning.
|
|
4542
|
+
*/
|
|
4543
|
+
const RectAlignment = {
|
|
4544
|
+
TOP_LEFT: "tl",
|
|
4545
|
+
TOP: "t",
|
|
4546
|
+
TOP_RIGHT: "tr",
|
|
4547
|
+
LEFT: "l",
|
|
4548
|
+
CENTER: "ctr",
|
|
4549
|
+
RIGHT: "r",
|
|
4550
|
+
BOTTOM_LEFT: "bl",
|
|
4551
|
+
BOTTOM: "b",
|
|
4552
|
+
BOTTOM_RIGHT: "br"
|
|
4553
|
+
};
|
|
4554
|
+
/**
|
|
4555
|
+
* Creates an outer shadow effect element.
|
|
4556
|
+
*
|
|
4557
|
+
* ## XSD Schema
|
|
4558
|
+
* ```xml
|
|
4559
|
+
* <xsd:complexType name="CT_OuterShadowEffect">
|
|
4560
|
+
* <xsd:sequence>
|
|
4561
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4562
|
+
* </xsd:sequence>
|
|
4563
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4564
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4565
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4566
|
+
* <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
|
|
4567
|
+
* <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
|
|
4568
|
+
* <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
|
|
4569
|
+
* <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
|
|
4570
|
+
* <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
|
|
4571
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
|
|
4572
|
+
* </xsd:complexType>
|
|
4573
|
+
* ```
|
|
4574
|
+
*/
|
|
4575
|
+
const createOuterShadowEffect = (options) => {
|
|
4576
|
+
const attributes = {};
|
|
4577
|
+
if (options.blurRad !== void 0) attributes.blurRad = {
|
|
4578
|
+
key: "blurRad",
|
|
4579
|
+
value: options.blurRad
|
|
4580
|
+
};
|
|
4581
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4582
|
+
key: "dist",
|
|
4583
|
+
value: options.dist
|
|
4584
|
+
};
|
|
4585
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4586
|
+
key: "dir",
|
|
4587
|
+
value: options.dir
|
|
4588
|
+
};
|
|
4589
|
+
if (options.sx !== void 0) attributes.sx = {
|
|
4590
|
+
key: "sx",
|
|
4591
|
+
value: options.sx
|
|
4592
|
+
};
|
|
4593
|
+
if (options.sy !== void 0) attributes.sy = {
|
|
4594
|
+
key: "sy",
|
|
4595
|
+
value: options.sy
|
|
4596
|
+
};
|
|
4597
|
+
if (options.kx !== void 0) attributes.kx = {
|
|
4598
|
+
key: "kx",
|
|
4599
|
+
value: options.kx
|
|
4600
|
+
};
|
|
4601
|
+
if (options.ky !== void 0) attributes.ky = {
|
|
4602
|
+
key: "ky",
|
|
4603
|
+
value: options.ky
|
|
4604
|
+
};
|
|
4605
|
+
if (options.algn !== void 0) attributes.algn = {
|
|
4606
|
+
key: "algn",
|
|
4607
|
+
value: RectAlignment[options.algn]
|
|
4608
|
+
};
|
|
4609
|
+
if (options.rotWithShape === false) attributes.rotWithShape = {
|
|
4610
|
+
key: "rotWithShape",
|
|
4611
|
+
value: 0
|
|
4612
|
+
};
|
|
4613
|
+
return new BuilderElement({
|
|
4614
|
+
attributes,
|
|
4615
|
+
children: [createColorElement(options.color)],
|
|
4616
|
+
name: "a:outerShdw"
|
|
4617
|
+
});
|
|
4618
|
+
};
|
|
4619
|
+
//#endregion
|
|
4620
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/prst-shdw.ts
|
|
4621
|
+
/**
|
|
4622
|
+
* Preset shadow effect for DrawingML shapes.
|
|
4623
|
+
*
|
|
4624
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetShadowEffect
|
|
4625
|
+
*
|
|
4626
|
+
* @module
|
|
4627
|
+
*/
|
|
4628
|
+
/**
|
|
4629
|
+
* Preset shadow types (20 variations).
|
|
4630
|
+
*
|
|
4631
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetShadowVal
|
|
4632
|
+
*/
|
|
4633
|
+
const PresetShadowVal = {
|
|
4634
|
+
SHDW1: "shdw1",
|
|
4635
|
+
SHDW2: "shdw2",
|
|
4636
|
+
SHDW3: "shdw3",
|
|
4637
|
+
SHDW4: "shdw4",
|
|
4638
|
+
SHDW5: "shdw5",
|
|
4639
|
+
SHDW6: "shdw6",
|
|
4640
|
+
SHDW7: "shdw7",
|
|
4641
|
+
SHDW8: "shdw8",
|
|
4642
|
+
SHDW9: "shdw9",
|
|
4643
|
+
SHDW10: "shdw10",
|
|
4644
|
+
SHDW11: "shdw11",
|
|
4645
|
+
SHDW12: "shdw12",
|
|
4646
|
+
SHDW13: "shdw13",
|
|
4647
|
+
SHDW14: "shdw14",
|
|
4648
|
+
SHDW15: "shdw15",
|
|
4649
|
+
SHDW16: "shdw16",
|
|
4650
|
+
SHDW17: "shdw17",
|
|
4651
|
+
SHDW18: "shdw18",
|
|
4652
|
+
SHDW19: "shdw19",
|
|
4653
|
+
SHDW20: "shdw20"
|
|
4654
|
+
};
|
|
4655
|
+
/**
|
|
4656
|
+
* Creates a preset shadow effect element.
|
|
4657
|
+
*
|
|
4658
|
+
* ## XSD Schema
|
|
4659
|
+
* ```xml
|
|
4660
|
+
* <xsd:complexType name="CT_PresetShadowEffect">
|
|
4661
|
+
* <xsd:sequence>
|
|
4662
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4663
|
+
* </xsd:sequence>
|
|
4664
|
+
* <xsd:attribute name="prst" type="ST_PresetShadowVal" use="required"/>
|
|
4665
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4666
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4667
|
+
* </xsd:complexType>
|
|
4668
|
+
* ```
|
|
4669
|
+
*/
|
|
4670
|
+
const createPresetShadowEffect = (options) => {
|
|
4671
|
+
const attributes = { prst: {
|
|
4672
|
+
key: "prst",
|
|
4673
|
+
value: PresetShadowVal[options.prst]
|
|
4674
|
+
} };
|
|
4675
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4676
|
+
key: "dist",
|
|
4677
|
+
value: options.dist
|
|
4678
|
+
};
|
|
4679
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4680
|
+
key: "dir",
|
|
4681
|
+
value: options.dir
|
|
4682
|
+
};
|
|
4683
|
+
return new BuilderElement({
|
|
4684
|
+
attributes,
|
|
4685
|
+
children: [createColorElement(options.color)],
|
|
4686
|
+
name: "a:prstShdw"
|
|
4687
|
+
});
|
|
4688
|
+
};
|
|
4689
|
+
//#endregion
|
|
4690
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/reflection.ts
|
|
4691
|
+
/**
|
|
4692
|
+
* Reflection effect for DrawingML shapes.
|
|
4693
|
+
*
|
|
4694
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ReflectionEffect
|
|
4695
|
+
*
|
|
4696
|
+
* @module
|
|
4697
|
+
*/
|
|
4698
|
+
/**
|
|
4699
|
+
* Creates a reflection effect element.
|
|
4700
|
+
*
|
|
4701
|
+
* ## XSD Schema
|
|
4702
|
+
* ```xml
|
|
4703
|
+
* <xsd:complexType name="CT_ReflectionEffect">
|
|
4704
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4705
|
+
* <xsd:attribute name="stA" type="ST_PositiveFixedPercentage" default="100%"/>
|
|
4706
|
+
* <xsd:attribute name="stPos" type="ST_PositiveFixedPercentage" default="0%"/>
|
|
4707
|
+
* <xsd:attribute name="endA" type="ST_PositiveFixedPercentage" default="0%"/>
|
|
4708
|
+
* <xsd:attribute name="endPos" type="ST_PositiveFixedPercentage" default="100%"/>
|
|
4709
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4710
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4711
|
+
* <xsd:attribute name="fadeDir" type="ST_PositiveFixedAngle" default="5400000"/>
|
|
4712
|
+
* <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
|
|
4713
|
+
* <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
|
|
4714
|
+
* <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
|
|
4715
|
+
* <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
|
|
4716
|
+
* <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
|
|
4717
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
|
|
4718
|
+
* </xsd:complexType>
|
|
4719
|
+
* ```
|
|
4720
|
+
*/
|
|
4721
|
+
const createReflectionEffect = (options) => {
|
|
4722
|
+
if (!options) return new BuilderElement({ name: "a:reflection" });
|
|
4723
|
+
const attributes = {};
|
|
4724
|
+
if (options.blurRad !== void 0) attributes.blurRad = {
|
|
4725
|
+
key: "blurRad",
|
|
4726
|
+
value: options.blurRad
|
|
4727
|
+
};
|
|
4728
|
+
if (options.stA !== void 0) attributes.stA = {
|
|
4729
|
+
key: "stA",
|
|
4730
|
+
value: options.stA
|
|
4731
|
+
};
|
|
4732
|
+
if (options.stPos !== void 0) attributes.stPos = {
|
|
4733
|
+
key: "stPos",
|
|
4734
|
+
value: options.stPos
|
|
4735
|
+
};
|
|
4736
|
+
if (options.endA !== void 0) attributes.endA = {
|
|
4737
|
+
key: "endA",
|
|
4738
|
+
value: options.endA
|
|
4739
|
+
};
|
|
4740
|
+
if (options.endPos !== void 0) attributes.endPos = {
|
|
4741
|
+
key: "endPos",
|
|
4742
|
+
value: options.endPos
|
|
4743
|
+
};
|
|
4744
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4745
|
+
key: "dist",
|
|
4746
|
+
value: options.dist
|
|
4747
|
+
};
|
|
4748
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4749
|
+
key: "dir",
|
|
4750
|
+
value: options.dir
|
|
4751
|
+
};
|
|
4752
|
+
if (options.fadeDir !== void 0) attributes.fadeDir = {
|
|
4753
|
+
key: "fadeDir",
|
|
4754
|
+
value: options.fadeDir
|
|
4755
|
+
};
|
|
4756
|
+
if (options.sx !== void 0) attributes.sx = {
|
|
4757
|
+
key: "sx",
|
|
4758
|
+
value: options.sx
|
|
4759
|
+
};
|
|
4760
|
+
if (options.sy !== void 0) attributes.sy = {
|
|
4761
|
+
key: "sy",
|
|
4762
|
+
value: options.sy
|
|
4763
|
+
};
|
|
4764
|
+
if (options.kx !== void 0) attributes.kx = {
|
|
4765
|
+
key: "kx",
|
|
4766
|
+
value: options.kx
|
|
4767
|
+
};
|
|
4768
|
+
if (options.ky !== void 0) attributes.ky = {
|
|
4769
|
+
key: "ky",
|
|
4770
|
+
value: options.ky
|
|
4771
|
+
};
|
|
4772
|
+
if (options.algn !== void 0) attributes.algn = {
|
|
4773
|
+
key: "algn",
|
|
4774
|
+
value: options.algn
|
|
4775
|
+
};
|
|
4776
|
+
if (options.rotWithShape === false) attributes.rotWithShape = {
|
|
4777
|
+
key: "rotWithShape",
|
|
4778
|
+
value: 0
|
|
4779
|
+
};
|
|
4780
|
+
return new BuilderElement({
|
|
4781
|
+
attributes,
|
|
4782
|
+
name: "a:reflection"
|
|
4783
|
+
});
|
|
4784
|
+
};
|
|
4785
|
+
//#endregion
|
|
4786
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/soft-edge.ts
|
|
4787
|
+
/**
|
|
4788
|
+
* Soft edge effect for DrawingML shapes.
|
|
4789
|
+
*
|
|
4790
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SoftEdgesEffect
|
|
4791
|
+
*
|
|
4792
|
+
* @module
|
|
4793
|
+
*/
|
|
4794
|
+
/**
|
|
4795
|
+
* Creates a soft edge effect element.
|
|
4796
|
+
*
|
|
4797
|
+
* ## XSD Schema
|
|
4798
|
+
* ```xml
|
|
4799
|
+
* <xsd:complexType name="CT_SoftEdgesEffect">
|
|
4800
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="required"/>
|
|
4801
|
+
* </xsd:complexType>
|
|
4802
|
+
* ```
|
|
4803
|
+
*
|
|
4804
|
+
* @param rad - Soft edge radius in EMUs (required)
|
|
4805
|
+
*/
|
|
4806
|
+
const createSoftEdgeEffect = (rad) => new BuilderElement({
|
|
4807
|
+
attributes: { rad: {
|
|
4808
|
+
key: "rad",
|
|
4809
|
+
value: rad
|
|
3956
4810
|
} },
|
|
3957
|
-
name: "a:
|
|
4811
|
+
name: "a:softEdge"
|
|
3958
4812
|
});
|
|
3959
4813
|
//#endregion
|
|
3960
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
4814
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/effect-list.ts
|
|
3961
4815
|
/**
|
|
3962
|
-
*
|
|
4816
|
+
* Effect list container for DrawingML shapes.
|
|
3963
4817
|
*
|
|
3964
|
-
*
|
|
3965
|
-
* allowing colors to be defined using theme color schemes.
|
|
4818
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectList, EG_EffectProperties
|
|
3966
4819
|
*
|
|
3967
4820
|
* @module
|
|
3968
4821
|
*/
|
|
3969
4822
|
/**
|
|
3970
|
-
* Creates a
|
|
4823
|
+
* Creates a blur effect element.
|
|
3971
4824
|
*
|
|
3972
|
-
*
|
|
4825
|
+
* ## XSD Schema
|
|
4826
|
+
* ```xml
|
|
4827
|
+
* <xsd:complexType name="CT_BlurEffect">
|
|
4828
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" default="0"/>
|
|
4829
|
+
* <xsd:attribute name="grow" type="xsd:boolean" default="true"/>
|
|
4830
|
+
* </xsd:complexType>
|
|
4831
|
+
* ```
|
|
4832
|
+
*/
|
|
4833
|
+
const createBlurEffect = (options) => {
|
|
4834
|
+
if (!(options.rad !== void 0 || options.grow === false)) return new BuilderElement({ name: "a:blur" });
|
|
4835
|
+
return new BuilderElement({
|
|
4836
|
+
attributes: {
|
|
4837
|
+
...options.rad !== void 0 && { rad: {
|
|
4838
|
+
key: "rad",
|
|
4839
|
+
value: options.rad
|
|
4840
|
+
} },
|
|
4841
|
+
...options.grow === false && { grow: {
|
|
4842
|
+
key: "grow",
|
|
4843
|
+
value: 0
|
|
4844
|
+
} }
|
|
4845
|
+
},
|
|
4846
|
+
name: "a:blur"
|
|
4847
|
+
});
|
|
4848
|
+
};
|
|
4849
|
+
/**
|
|
4850
|
+
* Creates an effect list element (a:effectLst).
|
|
4851
|
+
*
|
|
4852
|
+
* This is the EG_EffectProperties choice for a flat list of effects.
|
|
4853
|
+
* Effects are emitted in XSD order: blur, glow, innerShdw, outerShdw, prstShdw, reflection, softEdge.
|
|
3973
4854
|
*
|
|
3974
4855
|
* ## XSD Schema
|
|
3975
4856
|
* ```xml
|
|
3976
|
-
* <xsd:complexType name="
|
|
4857
|
+
* <xsd:complexType name="CT_EffectList">
|
|
3977
4858
|
* <xsd:sequence>
|
|
3978
|
-
* <xsd:
|
|
4859
|
+
* <xsd:element name="blur" type="CT_BlurEffect" minOccurs="0"/>
|
|
4860
|
+
* <xsd:element name="fillOverlay" type="CT_FillOverlayEffect" minOccurs="0"/>
|
|
4861
|
+
* <xsd:element name="glow" type="CT_GlowEffect" minOccurs="0"/>
|
|
4862
|
+
* <xsd:element name="innerShdw" type="CT_InnerShadowEffect" minOccurs="0"/>
|
|
4863
|
+
* <xsd:element name="outerShdw" type="CT_OuterShadowEffect" minOccurs="0"/>
|
|
4864
|
+
* <xsd:element name="prstShdw" type="CT_PresetShadowEffect" minOccurs="0"/>
|
|
4865
|
+
* <xsd:element name="reflection" type="CT_ReflectionEffect" minOccurs="0"/>
|
|
4866
|
+
* <xsd:element name="softEdge" type="CT_SoftEdgesEffect" minOccurs="0"/>
|
|
3979
4867
|
* </xsd:sequence>
|
|
3980
|
-
* <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
|
|
3981
4868
|
* </xsd:complexType>
|
|
3982
4869
|
* ```
|
|
4870
|
+
*/
|
|
4871
|
+
const createEffectList = (options) => {
|
|
4872
|
+
const children = [];
|
|
4873
|
+
if (options.blur) children.push(createBlurEffect(options.blur));
|
|
4874
|
+
if (options.glow) children.push(createGlowEffect(options.glow));
|
|
4875
|
+
if (options.innerShdw) children.push(createInnerShadowEffect(options.innerShdw));
|
|
4876
|
+
if (options.outerShdw) children.push(createOuterShadowEffect(options.outerShdw));
|
|
4877
|
+
if (options.prstShdw) children.push(createPresetShadowEffect(options.prstShdw));
|
|
4878
|
+
if (options.reflection) children.push(createReflectionEffect(options.reflection === true ? void 0 : options.reflection));
|
|
4879
|
+
if (options.softEdge !== void 0) children.push(createSoftEdgeEffect(options.softEdge));
|
|
4880
|
+
return new BuilderElement({
|
|
4881
|
+
children,
|
|
4882
|
+
name: "a:effectLst"
|
|
4883
|
+
});
|
|
4884
|
+
};
|
|
4885
|
+
//#endregion
|
|
4886
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/fill/gradient-fill.ts
|
|
4887
|
+
/**
|
|
4888
|
+
* Gradient fill element for DrawingML shapes.
|
|
4889
|
+
*
|
|
4890
|
+
* This module provides gradient fill support with linear and path shading.
|
|
4891
|
+
*
|
|
4892
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GradientFillProperties
|
|
4893
|
+
*
|
|
4894
|
+
* @module
|
|
4895
|
+
*/
|
|
4896
|
+
/**
|
|
4897
|
+
* Path shade type for radial gradients.
|
|
4898
|
+
*/
|
|
4899
|
+
const PathShadeType = {
|
|
4900
|
+
SHAPE: "shape",
|
|
4901
|
+
CIRCLE: "circle",
|
|
4902
|
+
RECT: "rect"
|
|
4903
|
+
};
|
|
4904
|
+
/**
|
|
4905
|
+
* Creates a gradient stop element (a:gs).
|
|
3983
4906
|
*
|
|
3984
4907
|
* @example
|
|
3985
4908
|
* ```typescript
|
|
3986
|
-
*
|
|
3987
|
-
*
|
|
4909
|
+
* createGradientStop({ position: 0, color: { value: "FF0000" } });
|
|
4910
|
+
* createGradientStop({ position: 100000, color: { value: "0000FF" } });
|
|
3988
4911
|
* ```
|
|
3989
4912
|
*/
|
|
3990
|
-
const
|
|
3991
|
-
attributes: {
|
|
3992
|
-
key: "
|
|
3993
|
-
value:
|
|
4913
|
+
const createGradientStop = (stop) => new BuilderElement({
|
|
4914
|
+
attributes: { pos: {
|
|
4915
|
+
key: "pos",
|
|
4916
|
+
value: stop.position
|
|
3994
4917
|
} },
|
|
3995
|
-
|
|
4918
|
+
children: [createColorElement(stop.color)],
|
|
4919
|
+
name: "a:gs"
|
|
3996
4920
|
});
|
|
4921
|
+
/**
|
|
4922
|
+
* Creates the shade element (a:lin or a:path).
|
|
4923
|
+
*/
|
|
4924
|
+
const createShadeElement = (shade) => {
|
|
4925
|
+
if ("angle" in shade) return new BuilderElement({
|
|
4926
|
+
attributes: {
|
|
4927
|
+
ang: {
|
|
4928
|
+
key: "ang",
|
|
4929
|
+
value: shade.angle
|
|
4930
|
+
},
|
|
4931
|
+
scaled: {
|
|
4932
|
+
key: "scaled",
|
|
4933
|
+
value: shade.scaled
|
|
4934
|
+
}
|
|
4935
|
+
},
|
|
4936
|
+
name: "a:lin"
|
|
4937
|
+
});
|
|
4938
|
+
const pathShade = shade;
|
|
4939
|
+
return new BuilderElement({
|
|
4940
|
+
attributes: { path: {
|
|
4941
|
+
key: "path",
|
|
4942
|
+
value: pathShade.path ? PathShadeType[pathShade.path] : void 0
|
|
4943
|
+
} },
|
|
4944
|
+
name: "a:path"
|
|
4945
|
+
});
|
|
4946
|
+
};
|
|
4947
|
+
/**
|
|
4948
|
+
* Creates a gradient fill element.
|
|
4949
|
+
*
|
|
4950
|
+
* ## XSD Schema
|
|
4951
|
+
* ```xml
|
|
4952
|
+
* <xsd:complexType name="CT_GradientFillProperties">
|
|
4953
|
+
* <xsd:sequence>
|
|
4954
|
+
* <xsd:element name="gsLst" type="CT_GradientStopList" minOccurs="0"/>
|
|
4955
|
+
* <xsd:group ref="EG_ShadeProperties" minOccurs="0"/>
|
|
4956
|
+
* </xsd:sequence>
|
|
4957
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" use="optional"/>
|
|
4958
|
+
* </xsd:complexType>
|
|
4959
|
+
* ```
|
|
4960
|
+
*
|
|
4961
|
+
* @example
|
|
4962
|
+
* ```typescript
|
|
4963
|
+
* // Linear gradient from red to blue
|
|
4964
|
+
* createGradientFill({
|
|
4965
|
+
* stops: [
|
|
4966
|
+
* { position: 0, color: { value: "FF0000" } },
|
|
4967
|
+
* { position: 100000, color: { value: "0000FF" } },
|
|
4968
|
+
* ],
|
|
4969
|
+
* shade: { angle: 5400000 },
|
|
4970
|
+
* });
|
|
4971
|
+
* ```
|
|
4972
|
+
*/
|
|
4973
|
+
const createGradientFill = (options) => {
|
|
4974
|
+
const children = [];
|
|
4975
|
+
children.push(new BuilderElement({
|
|
4976
|
+
children: options.stops.map(createGradientStop),
|
|
4977
|
+
name: "a:gsLst"
|
|
4978
|
+
}));
|
|
4979
|
+
if (options.shade) children.push(createShadeElement(options.shade));
|
|
4980
|
+
return new BuilderElement({
|
|
4981
|
+
attributes: { rotWithShape: {
|
|
4982
|
+
key: "rotWithShape",
|
|
4983
|
+
value: options.rotateWithShape
|
|
4984
|
+
} },
|
|
4985
|
+
children,
|
|
4986
|
+
name: "a:gradFill"
|
|
4987
|
+
});
|
|
4988
|
+
};
|
|
3997
4989
|
//#endregion
|
|
3998
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/
|
|
4990
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/extents/extents-attributes.ts
|
|
3999
4991
|
/**
|
|
4000
|
-
*
|
|
4992
|
+
* Extents attributes for DrawingML shapes.
|
|
4001
4993
|
*
|
|
4002
|
-
* This module
|
|
4003
|
-
* supporting both RGB and scheme-based colors.
|
|
4994
|
+
* This module defines the width and height attributes for shape extents.
|
|
4004
4995
|
*
|
|
4005
4996
|
* @module
|
|
4006
4997
|
*/
|
|
4007
4998
|
/**
|
|
4008
|
-
*
|
|
4999
|
+
* Attributes for shape extents (size).
|
|
4009
5000
|
*
|
|
4010
|
-
*
|
|
5001
|
+
* Defines the width (cx) and height (cy) in EMUs.
|
|
4011
5002
|
*
|
|
4012
5003
|
* ## XSD Schema
|
|
4013
5004
|
* ```xml
|
|
4014
|
-
* <xsd:
|
|
5005
|
+
* <xsd:attribute name="cx" type="ST_PositiveCoordinate" use="required"/>
|
|
5006
|
+
* <xsd:attribute name="cy" type="ST_PositiveCoordinate" use="required"/>
|
|
5007
|
+
* ```
|
|
5008
|
+
*
|
|
5009
|
+
* @internal
|
|
5010
|
+
*/
|
|
5011
|
+
var ExtentsAttributes = class extends XmlAttributeComponent {
|
|
5012
|
+
constructor(..._args) {
|
|
5013
|
+
super(..._args);
|
|
5014
|
+
_defineProperty(this, "xmlKeys", {
|
|
5015
|
+
cx: "cx",
|
|
5016
|
+
cy: "cy"
|
|
5017
|
+
});
|
|
5018
|
+
}
|
|
5019
|
+
};
|
|
5020
|
+
//#endregion
|
|
5021
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/extents/extents.ts
|
|
5022
|
+
/**
|
|
5023
|
+
* Extents (size) element for DrawingML shapes.
|
|
5024
|
+
*
|
|
5025
|
+
* This module defines the size of a shape or picture in EMUs.
|
|
5026
|
+
*
|
|
5027
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5028
|
+
*
|
|
5029
|
+
* @module
|
|
5030
|
+
*/
|
|
5031
|
+
/**
|
|
5032
|
+
* Represents the extents (size) of a DrawingML shape.
|
|
5033
|
+
*
|
|
5034
|
+
* Defines the width and height of the shape in English Metric Units (EMUs).
|
|
5035
|
+
* One EMU equals 1/914,400 of an inch.
|
|
5036
|
+
*
|
|
5037
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5038
|
+
*
|
|
5039
|
+
* ## XSD Schema
|
|
5040
|
+
* ```xml
|
|
5041
|
+
* <xsd:complexType name="CT_PositiveSize2D">
|
|
5042
|
+
* <xsd:attribute name="cx" type="ST_PositiveCoordinate" use="required"/>
|
|
5043
|
+
* <xsd:attribute name="cy" type="ST_PositiveCoordinate" use="required"/>
|
|
5044
|
+
* </xsd:complexType>
|
|
5045
|
+
* ```
|
|
5046
|
+
*
|
|
5047
|
+
* @example
|
|
5048
|
+
* ```typescript
|
|
5049
|
+
* // Create a 1-inch by 1-inch shape
|
|
5050
|
+
* const extents = new Extents(914400, 914400);
|
|
5051
|
+
* ```
|
|
5052
|
+
*/
|
|
5053
|
+
var Extents = class extends XmlComponent {
|
|
5054
|
+
constructor(x, y) {
|
|
5055
|
+
super("a:ext");
|
|
5056
|
+
_defineProperty(this, "attributes", void 0);
|
|
5057
|
+
this.attributes = new ExtentsAttributes({
|
|
5058
|
+
cx: x,
|
|
5059
|
+
cy: y
|
|
5060
|
+
});
|
|
5061
|
+
this.root.push(this.attributes);
|
|
5062
|
+
}
|
|
5063
|
+
};
|
|
5064
|
+
//#endregion
|
|
5065
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/offset/off-attributes.ts
|
|
5066
|
+
/**
|
|
5067
|
+
* Offset attributes for DrawingML shapes.
|
|
5068
|
+
*
|
|
5069
|
+
* This module defines the x and y coordinate attributes for shape offset.
|
|
5070
|
+
*
|
|
5071
|
+
* @module
|
|
5072
|
+
*/
|
|
5073
|
+
/**
|
|
5074
|
+
* Attributes for shape offset (position).
|
|
5075
|
+
*
|
|
5076
|
+
* Defines the x and y coordinates in EMUs.
|
|
5077
|
+
*
|
|
5078
|
+
* ## XSD Schema
|
|
5079
|
+
* ```xml
|
|
5080
|
+
* <xsd:attribute name="x" type="ST_Coordinate" use="required"/>
|
|
5081
|
+
* <xsd:attribute name="y" type="ST_Coordinate" use="required"/>
|
|
5082
|
+
* ```
|
|
5083
|
+
*
|
|
5084
|
+
* @internal
|
|
5085
|
+
*/
|
|
5086
|
+
var OffsetAttributes = class extends XmlAttributeComponent {
|
|
5087
|
+
constructor(..._args) {
|
|
5088
|
+
super(..._args);
|
|
5089
|
+
_defineProperty(this, "xmlKeys", {
|
|
5090
|
+
x: "x",
|
|
5091
|
+
y: "y"
|
|
5092
|
+
});
|
|
5093
|
+
}
|
|
5094
|
+
};
|
|
5095
|
+
//#endregion
|
|
5096
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/offset/off.ts
|
|
5097
|
+
/**
|
|
5098
|
+
* Offset (position) element for DrawingML shapes.
|
|
5099
|
+
*
|
|
5100
|
+
* This module defines the position of a shape or picture in EMUs.
|
|
5101
|
+
*
|
|
5102
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5103
|
+
*
|
|
5104
|
+
* @module
|
|
5105
|
+
*/
|
|
5106
|
+
/**
|
|
5107
|
+
* Represents the offset (position) of a DrawingML shape.
|
|
5108
|
+
*
|
|
5109
|
+
* Defines the x and y coordinates of the shape's position in
|
|
5110
|
+
* English Metric Units (EMUs). One EMU equals 1/914,400 of an inch.
|
|
5111
|
+
*
|
|
5112
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5113
|
+
*
|
|
5114
|
+
* ## XSD Schema
|
|
5115
|
+
* ```xml
|
|
5116
|
+
* <xsd:complexType name="CT_Point2D">
|
|
5117
|
+
* <xsd:attribute name="x" type="ST_Coordinate" use="required"/>
|
|
5118
|
+
* <xsd:attribute name="y" type="ST_Coordinate" use="required"/>
|
|
5119
|
+
* </xsd:complexType>
|
|
5120
|
+
* ```
|
|
5121
|
+
*
|
|
5122
|
+
* @example
|
|
5123
|
+
* ```typescript
|
|
5124
|
+
* const offset = new Offset();
|
|
5125
|
+
* ```
|
|
5126
|
+
*/
|
|
5127
|
+
var Offset = class extends XmlComponent {
|
|
5128
|
+
constructor(x, y) {
|
|
5129
|
+
super("a:off");
|
|
5130
|
+
this.root.push(new OffsetAttributes({
|
|
5131
|
+
x: x !== null && x !== void 0 ? x : 0,
|
|
5132
|
+
y: y !== null && y !== void 0 ? y : 0
|
|
5133
|
+
}));
|
|
5134
|
+
}
|
|
5135
|
+
};
|
|
5136
|
+
//#endregion
|
|
5137
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/form.ts
|
|
5138
|
+
/**
|
|
5139
|
+
* Attributes for 2D transformation.
|
|
5140
|
+
*
|
|
5141
|
+
* Defines flip and rotation properties.
|
|
5142
|
+
*/
|
|
5143
|
+
var FormAttributes = class extends XmlAttributeComponent {
|
|
5144
|
+
constructor(..._args) {
|
|
5145
|
+
super(..._args);
|
|
5146
|
+
_defineProperty(this, "xmlKeys", {
|
|
5147
|
+
flipHorizontal: "flipH",
|
|
5148
|
+
flipVertical: "flipV",
|
|
5149
|
+
rotation: "rot"
|
|
5150
|
+
});
|
|
5151
|
+
}
|
|
5152
|
+
};
|
|
5153
|
+
/**
|
|
5154
|
+
* Represents a 2D transformation for DrawingML objects.
|
|
5155
|
+
*
|
|
5156
|
+
* This element defines how a shape or picture is positioned, sized,
|
|
5157
|
+
* rotated, and flipped within the document.
|
|
5158
|
+
*
|
|
5159
|
+
* Reference: http://officeopenxml.com/drwSp-size.php
|
|
5160
|
+
*
|
|
5161
|
+
* ## XSD Schema
|
|
5162
|
+
* ```xml
|
|
5163
|
+
* <xsd:complexType name="CT_Transform2D">
|
|
4015
5164
|
* <xsd:sequence>
|
|
4016
|
-
* <xsd:
|
|
4017
|
-
* <xsd:
|
|
5165
|
+
* <xsd:element name="off" type="CT_Point2D" minOccurs="0"/>
|
|
5166
|
+
* <xsd:element name="ext" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
4018
5167
|
* </xsd:sequence>
|
|
5168
|
+
* <xsd:attribute name="rot" type="ST_Angle" use="optional"/>
|
|
5169
|
+
* <xsd:attribute name="flipH" type="xsd:boolean" use="optional"/>
|
|
5170
|
+
* <xsd:attribute name="flipV" type="xsd:boolean" use="optional"/>
|
|
4019
5171
|
* </xsd:complexType>
|
|
4020
5172
|
* ```
|
|
4021
5173
|
*
|
|
4022
5174
|
* @example
|
|
4023
5175
|
* ```typescript
|
|
4024
|
-
*
|
|
4025
|
-
*
|
|
4026
|
-
*
|
|
4027
|
-
*
|
|
4028
|
-
* });
|
|
4029
|
-
*
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
5176
|
+
* const form = new Form({
|
|
5177
|
+
* emus: { x: 914400, y: 914400 },
|
|
5178
|
+
* flip: { horizontal: true, vertical: false },
|
|
5179
|
+
* rotation: 450000 // 7.5 degrees
|
|
5180
|
+
* });
|
|
5181
|
+
* ```
|
|
5182
|
+
*/
|
|
5183
|
+
var Form = class extends XmlComponent {
|
|
5184
|
+
constructor(options) {
|
|
5185
|
+
var _options$flip, _options$flip2, _options$offset, _options$offset2;
|
|
5186
|
+
super("a:xfrm");
|
|
5187
|
+
_defineProperty(this, "extents", void 0);
|
|
5188
|
+
_defineProperty(this, "offset", void 0);
|
|
5189
|
+
this.root.push(new FormAttributes({
|
|
5190
|
+
flipHorizontal: (_options$flip = options.flip) === null || _options$flip === void 0 ? void 0 : _options$flip.horizontal,
|
|
5191
|
+
flipVertical: (_options$flip2 = options.flip) === null || _options$flip2 === void 0 ? void 0 : _options$flip2.vertical,
|
|
5192
|
+
rotation: options.rotation
|
|
5193
|
+
}));
|
|
5194
|
+
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);
|
|
5195
|
+
this.extents = new Extents(options.emus.x, options.emus.y);
|
|
5196
|
+
this.root.push(this.offset);
|
|
5197
|
+
this.root.push(this.extents);
|
|
5198
|
+
}
|
|
5199
|
+
};
|
|
5200
|
+
//#endregion
|
|
5201
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/no-fill.ts
|
|
5202
|
+
/**
|
|
5203
|
+
* No fill element for DrawingML shapes.
|
|
5204
|
+
*
|
|
5205
|
+
* This module provides the no-fill option for outline and shape fills.
|
|
5206
|
+
*
|
|
5207
|
+
* @module
|
|
5208
|
+
*/
|
|
5209
|
+
/**
|
|
5210
|
+
* Creates a no-fill element.
|
|
5211
|
+
*
|
|
5212
|
+
* Specifies that the outline or shape should have no fill applied.
|
|
5213
|
+
*
|
|
5214
|
+
* ## XSD Schema
|
|
5215
|
+
* ```xml
|
|
5216
|
+
* <xsd:element name="noFill" type="CT_Empty"/>
|
|
5217
|
+
* ```
|
|
5218
|
+
*
|
|
5219
|
+
* @example
|
|
5220
|
+
* ```typescript
|
|
5221
|
+
* const noFill = createNoFill();
|
|
4035
5222
|
* ```
|
|
4036
5223
|
*/
|
|
4037
|
-
const
|
|
4038
|
-
children: [options.type === "rgb" ? createSolidRgbColor(options) : createSchemeColor(options)],
|
|
4039
|
-
name: "a:solidFill"
|
|
4040
|
-
});
|
|
5224
|
+
const createNoFill = () => new BuilderElement({ name: "a:noFill" });
|
|
4041
5225
|
//#endregion
|
|
4042
5226
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/outline.ts
|
|
4043
5227
|
/**
|
|
4044
5228
|
* Outline (line) properties for DrawingML shapes.
|
|
4045
5229
|
*
|
|
4046
5230
|
* This module provides support for configuring outline properties including
|
|
4047
|
-
* width, cap style, compound line types,
|
|
5231
|
+
* width, cap style, compound line types, fill properties, dash, and join.
|
|
4048
5232
|
*
|
|
4049
|
-
* Reference:
|
|
5233
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineProperties
|
|
4050
5234
|
*
|
|
4051
5235
|
* @module
|
|
4052
5236
|
*/
|
|
4053
5237
|
/**
|
|
5238
|
+
* Line cap styles for outline endpoints.
|
|
5239
|
+
*
|
|
5240
|
+
* Defines how the ends of a line are rendered.
|
|
5241
|
+
*/
|
|
5242
|
+
const LineCap = {
|
|
5243
|
+
ROUND: "rnd",
|
|
5244
|
+
SQUARE: "sq",
|
|
5245
|
+
FLAT: "flat"
|
|
5246
|
+
};
|
|
5247
|
+
/**
|
|
5248
|
+
* Compound line types for outlines.
|
|
5249
|
+
*
|
|
5250
|
+
* Defines the structure of compound lines (single, double, etc.).
|
|
5251
|
+
*/
|
|
5252
|
+
const CompoundLine = {
|
|
5253
|
+
SINGLE: "sng",
|
|
5254
|
+
DOUBLE: "dbl",
|
|
5255
|
+
THICK_THIN: "thickThin",
|
|
5256
|
+
THIN_THICK: "thinThick",
|
|
5257
|
+
TRI: "tri"
|
|
5258
|
+
};
|
|
5259
|
+
/**
|
|
5260
|
+
* Pen alignment options for outline positioning.
|
|
5261
|
+
*
|
|
5262
|
+
* Defines how the outline is aligned relative to the shape edge.
|
|
5263
|
+
*/
|
|
5264
|
+
const PenAlignment = {
|
|
5265
|
+
CENTER: "ctr",
|
|
5266
|
+
INSET: "in"
|
|
5267
|
+
};
|
|
5268
|
+
/**
|
|
5269
|
+
* Preset dash styles for outlines.
|
|
5270
|
+
*
|
|
5271
|
+
* ## XSD Schema
|
|
5272
|
+
* ```xml
|
|
5273
|
+
* <xsd:simpleType name="ST_PresetLineDashVal">
|
|
5274
|
+
* <xsd:restriction base="xsd:token">
|
|
5275
|
+
* <xsd:enumeration value="solid"/>
|
|
5276
|
+
* <xsd:enumeration value="dot"/>
|
|
5277
|
+
* <xsd:enumeration value="dash"/>
|
|
5278
|
+
* <xsd:enumeration value="lgDash"/>
|
|
5279
|
+
* <xsd:enumeration value="dashDot"/>
|
|
5280
|
+
* <xsd:enumeration value="lgDashDot"/>
|
|
5281
|
+
* <xsd:enumeration value="lgDashDotDot"/>
|
|
5282
|
+
* <xsd:enumeration value="sysDash"/>
|
|
5283
|
+
* <xsd:enumeration value="sysDot"/>
|
|
5284
|
+
* <xsd:enumeration value="sysDashDot"/>
|
|
5285
|
+
* <xsd:enumeration value="sysDashDotDot"/>
|
|
5286
|
+
* </xsd:restriction>
|
|
5287
|
+
* </xsd:simpleType>
|
|
5288
|
+
* ```
|
|
5289
|
+
*/
|
|
5290
|
+
const PresetDash = {
|
|
5291
|
+
SOLID: "solid",
|
|
5292
|
+
DOT: "dot",
|
|
5293
|
+
DASH: "dash",
|
|
5294
|
+
LG_DASH: "lgDash",
|
|
5295
|
+
DASH_DOT: "dashDot",
|
|
5296
|
+
LG_DASH_DOT: "lgDashDot",
|
|
5297
|
+
LG_DASH_DOT_DOT: "lgDashDotDot",
|
|
5298
|
+
SYS_DASH: "sysDash",
|
|
5299
|
+
SYS_DOT: "sysDot",
|
|
5300
|
+
SYS_DASH_DOT: "sysDashDot",
|
|
5301
|
+
SYS_DASH_DOT_DOT: "sysDashDotDot"
|
|
5302
|
+
};
|
|
5303
|
+
/**
|
|
5304
|
+
* Line join styles.
|
|
5305
|
+
*/
|
|
5306
|
+
const LineJoin = {
|
|
5307
|
+
ROUND: "round",
|
|
5308
|
+
BEVEL: "bevel",
|
|
5309
|
+
MITER: "miter"
|
|
5310
|
+
};
|
|
5311
|
+
/**
|
|
5312
|
+
* Creates the fill child element for an outline.
|
|
5313
|
+
*/
|
|
5314
|
+
const createOutlineFill = (options) => {
|
|
5315
|
+
if (options.type === "noFill") return createNoFill();
|
|
5316
|
+
return createSolidFill(options.color);
|
|
5317
|
+
};
|
|
5318
|
+
/**
|
|
4054
5319
|
* Creates an outline element for DrawingML shapes.
|
|
4055
5320
|
*
|
|
4056
5321
|
* The outline element specifies the line properties for the shape border,
|
|
4057
|
-
* including width, cap style, compound line type, alignment, and fill.
|
|
4058
|
-
*
|
|
4059
|
-
* Reference: http://officeopenxml.com/drwSp-outline.php
|
|
5322
|
+
* including width, cap style, compound line type, alignment, dash, join, and fill.
|
|
4060
5323
|
*
|
|
4061
5324
|
* ## XSD Schema
|
|
4062
5325
|
* ```xml
|
|
@@ -4075,44 +5338,56 @@ const createSolidFill = (options) => new BuilderElement({
|
|
|
4075
5338
|
*
|
|
4076
5339
|
* @example
|
|
4077
5340
|
* ```typescript
|
|
4078
|
-
* //
|
|
5341
|
+
* // Outline with RGB color and dash
|
|
4079
5342
|
* const outline = createOutline({
|
|
4080
5343
|
* width: 9525,
|
|
4081
|
-
* cap: "ROUND",
|
|
4082
5344
|
* type: "solidFill",
|
|
4083
|
-
*
|
|
4084
|
-
*
|
|
5345
|
+
* color: { value: "FF0000" },
|
|
5346
|
+
* dash: "DASH",
|
|
4085
5347
|
* });
|
|
4086
5348
|
* ```
|
|
4087
5349
|
*/
|
|
4088
|
-
const createOutline = (options) =>
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
5350
|
+
const createOutline = (options) => {
|
|
5351
|
+
const children = [];
|
|
5352
|
+
children.push(createOutlineFill(options));
|
|
5353
|
+
if (options.dash !== void 0) children.push(new BuilderElement({
|
|
5354
|
+
attributes: { val: {
|
|
5355
|
+
key: "val",
|
|
5356
|
+
value: PresetDash[options.dash]
|
|
5357
|
+
} },
|
|
5358
|
+
name: "a:prstDash"
|
|
5359
|
+
}));
|
|
5360
|
+
if (options.join !== void 0) if (options.join === "MITER" && options.miterLimit !== void 0) children.push(new BuilderElement({
|
|
5361
|
+
attributes: { lim: {
|
|
5362
|
+
key: "lim",
|
|
5363
|
+
value: options.miterLimit
|
|
5364
|
+
} },
|
|
5365
|
+
name: "a:miter"
|
|
5366
|
+
}));
|
|
5367
|
+
else children.push(new BuilderElement({ name: `a:${LineJoin[options.join]}` }));
|
|
5368
|
+
return new BuilderElement({
|
|
5369
|
+
attributes: {
|
|
5370
|
+
align: {
|
|
5371
|
+
key: "algn",
|
|
5372
|
+
value: options.align ? PenAlignment[options.align] : void 0
|
|
5373
|
+
},
|
|
5374
|
+
cap: {
|
|
5375
|
+
key: "cap",
|
|
5376
|
+
value: options.cap ? LineCap[options.cap] : void 0
|
|
5377
|
+
},
|
|
5378
|
+
compoundLine: {
|
|
5379
|
+
key: "cmpd",
|
|
5380
|
+
value: options.compoundLine ? CompoundLine[options.compoundLine] : void 0
|
|
5381
|
+
},
|
|
5382
|
+
width: {
|
|
5383
|
+
key: "w",
|
|
5384
|
+
value: options.width
|
|
5385
|
+
}
|
|
4101
5386
|
},
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
},
|
|
4107
|
-
children: [options.type === "noFill" ? createNoFill() : options.solidFillType === "rgb" ? createSolidFill({
|
|
4108
|
-
type: "rgb",
|
|
4109
|
-
value: options.value
|
|
4110
|
-
}) : createSolidFill({
|
|
4111
|
-
type: "scheme",
|
|
4112
|
-
value: options.value
|
|
4113
|
-
})],
|
|
4114
|
-
name: "a:ln"
|
|
4115
|
-
});
|
|
5387
|
+
children,
|
|
5388
|
+
name: "a:ln"
|
|
5389
|
+
});
|
|
5390
|
+
};
|
|
4116
5391
|
//#endregion
|
|
4117
5392
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/preset-geometry/adjustment-values/adjustment-values.ts
|
|
4118
5393
|
/**
|
|
@@ -4250,15 +5525,181 @@ var ShapePropertiesAttributes = class extends XmlAttributeComponent {
|
|
|
4250
5525
|
}
|
|
4251
5526
|
};
|
|
4252
5527
|
//#endregion
|
|
5528
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/three-d/bevel.ts
|
|
5529
|
+
/**
|
|
5530
|
+
* Bevel element for DrawingML 3D shapes.
|
|
5531
|
+
*
|
|
5532
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Bevel
|
|
5533
|
+
*
|
|
5534
|
+
* @module
|
|
5535
|
+
*/
|
|
5536
|
+
/**
|
|
5537
|
+
* Bevel preset types (12 variations).
|
|
5538
|
+
*
|
|
5539
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_BevelPresetType
|
|
5540
|
+
*/
|
|
5541
|
+
const BevelPresetType = {
|
|
5542
|
+
RELAXED_INSET: "relaxedInset",
|
|
5543
|
+
CIRCLE: "circle",
|
|
5544
|
+
SLOPE: "slope",
|
|
5545
|
+
CROSS: "cross",
|
|
5546
|
+
ANGLE: "angle",
|
|
5547
|
+
SOFT_ROUND: "softRound",
|
|
5548
|
+
CONVEX: "convex",
|
|
5549
|
+
COOL_SLANT: "coolSlant",
|
|
5550
|
+
DIVOT: "divot",
|
|
5551
|
+
RIBLET: "riblet",
|
|
5552
|
+
HARD_EDGE: "hardEdge",
|
|
5553
|
+
ART_DECO: "artDeco"
|
|
5554
|
+
};
|
|
5555
|
+
/**
|
|
5556
|
+
* Creates a bevel element.
|
|
5557
|
+
*
|
|
5558
|
+
* ## XSD Schema
|
|
5559
|
+
* ```xml
|
|
5560
|
+
* <xsd:complexType name="CT_Bevel">
|
|
5561
|
+
* <xsd:attribute name="w" type="ST_PositiveCoordinate" default="76200"/>
|
|
5562
|
+
* <xsd:attribute name="h" type="ST_PositiveCoordinate" default="76200"/>
|
|
5563
|
+
* <xsd:attribute name="prst" type="ST_BevelPresetType" default="circle"/>
|
|
5564
|
+
* </xsd:complexType>
|
|
5565
|
+
* ```
|
|
5566
|
+
*/
|
|
5567
|
+
const createBevel = (options) => {
|
|
5568
|
+
if (!options) return new BuilderElement({ name: "a:bevelT" });
|
|
5569
|
+
const attributes = {};
|
|
5570
|
+
if (options.w !== void 0) attributes.w = {
|
|
5571
|
+
key: "w",
|
|
5572
|
+
value: options.w
|
|
5573
|
+
};
|
|
5574
|
+
if (options.h !== void 0) attributes.h = {
|
|
5575
|
+
key: "h",
|
|
5576
|
+
value: options.h
|
|
5577
|
+
};
|
|
5578
|
+
if (options.prst !== void 0) attributes.prst = {
|
|
5579
|
+
key: "prst",
|
|
5580
|
+
value: BevelPresetType[options.prst]
|
|
5581
|
+
};
|
|
5582
|
+
return new BuilderElement({
|
|
5583
|
+
attributes,
|
|
5584
|
+
name: "a:bevelT"
|
|
5585
|
+
});
|
|
5586
|
+
};
|
|
5587
|
+
/**
|
|
5588
|
+
* Creates a bottom bevel element (a:bevelB).
|
|
5589
|
+
*/
|
|
5590
|
+
const createBottomBevel = (options) => {
|
|
5591
|
+
if (!options) return new BuilderElement({ name: "a:bevelB" });
|
|
5592
|
+
const attributes = {};
|
|
5593
|
+
if (options.w !== void 0) attributes.w = {
|
|
5594
|
+
key: "w",
|
|
5595
|
+
value: options.w
|
|
5596
|
+
};
|
|
5597
|
+
if (options.h !== void 0) attributes.h = {
|
|
5598
|
+
key: "h",
|
|
5599
|
+
value: options.h
|
|
5600
|
+
};
|
|
5601
|
+
if (options.prst !== void 0) attributes.prst = {
|
|
5602
|
+
key: "prst",
|
|
5603
|
+
value: BevelPresetType[options.prst]
|
|
5604
|
+
};
|
|
5605
|
+
return new BuilderElement({
|
|
5606
|
+
attributes,
|
|
5607
|
+
name: "a:bevelB"
|
|
5608
|
+
});
|
|
5609
|
+
};
|
|
5610
|
+
//#endregion
|
|
5611
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/three-d/shape-3d.ts
|
|
5612
|
+
/**
|
|
5613
|
+
* 3D shape properties for DrawingML.
|
|
5614
|
+
*
|
|
5615
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Shape3D
|
|
5616
|
+
*
|
|
5617
|
+
* @module
|
|
5618
|
+
*/
|
|
5619
|
+
/**
|
|
5620
|
+
* Preset material types for 3D shapes (15 variations).
|
|
5621
|
+
*
|
|
5622
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetMaterialType
|
|
5623
|
+
*/
|
|
5624
|
+
const PresetMaterialType = {
|
|
5625
|
+
LEGACY_MATTE: "legacyMatte",
|
|
5626
|
+
LEGACY_PLASTIC: "legacyPlastic",
|
|
5627
|
+
LEGACY_METAL: "legacyMetal",
|
|
5628
|
+
LEGACY_WIREFRAME: "legacyWireframe",
|
|
5629
|
+
MATTE: "matte",
|
|
5630
|
+
PLASTIC: "plastic",
|
|
5631
|
+
METAL: "metal",
|
|
5632
|
+
WARM_MATTE: "warmMatte",
|
|
5633
|
+
TRANSLUCENT_POWDER: "translucentPowder",
|
|
5634
|
+
POWDER: "powder",
|
|
5635
|
+
DK_EDGE: "dkEdge",
|
|
5636
|
+
SOFT_EDGE: "softEdge",
|
|
5637
|
+
CLEAR: "clear",
|
|
5638
|
+
FLAT: "flat",
|
|
5639
|
+
SOFT_METAL: "softmetal"
|
|
5640
|
+
};
|
|
5641
|
+
/**
|
|
5642
|
+
* Creates a 3D shape properties element (a:sp3d).
|
|
5643
|
+
*
|
|
5644
|
+
* ## XSD Schema
|
|
5645
|
+
* ```xml
|
|
5646
|
+
* <xsd:complexType name="CT_Shape3D">
|
|
5647
|
+
* <xsd:sequence>
|
|
5648
|
+
* <xsd:element name="bevelT" type="CT_Bevel" minOccurs="0"/>
|
|
5649
|
+
* <xsd:element name="bevelB" type="CT_Bevel" minOccurs="0"/>
|
|
5650
|
+
* <xsd:element name="extrusionClr" type="CT_Color" minOccurs="0"/>
|
|
5651
|
+
* <xsd:element name="contourClr" type="CT_Color" minOccurs="0"/>
|
|
5652
|
+
* </xsd:sequence>
|
|
5653
|
+
* <xsd:attribute name="z" type="ST_Coordinate" default="0"/>
|
|
5654
|
+
* <xsd:attribute name="extrusionH" type="ST_PositiveCoordinate" default="0"/>
|
|
5655
|
+
* <xsd:attribute name="contourW" type="ST_PositiveCoordinate" default="0"/>
|
|
5656
|
+
* <xsd:attribute name="prstMaterial" type="ST_PresetMaterialType" default="warmMatte"/>
|
|
5657
|
+
* </xsd:complexType>
|
|
5658
|
+
* ```
|
|
5659
|
+
*/
|
|
5660
|
+
const createShape3D = (options) => {
|
|
5661
|
+
const children = [];
|
|
5662
|
+
if (options.bevelT) children.push(createBevel(options.bevelT));
|
|
5663
|
+
if (options.bevelB) children.push(createBottomBevel(options.bevelB));
|
|
5664
|
+
if (options.extrusionClr) children.push(new BuilderElement({
|
|
5665
|
+
children: [createColorElement(options.extrusionClr)],
|
|
5666
|
+
name: "a:extrusionClr"
|
|
5667
|
+
}));
|
|
5668
|
+
if (options.contourClr) children.push(new BuilderElement({
|
|
5669
|
+
children: [createColorElement(options.contourClr)],
|
|
5670
|
+
name: "a:contourClr"
|
|
5671
|
+
}));
|
|
5672
|
+
return new BuilderElement({
|
|
5673
|
+
attributes: options.z !== void 0 || options.extrusionH !== void 0 || options.contourW !== void 0 || options.prstMaterial !== void 0 ? {
|
|
5674
|
+
...options.z !== void 0 && { z: {
|
|
5675
|
+
key: "z",
|
|
5676
|
+
value: options.z
|
|
5677
|
+
} },
|
|
5678
|
+
...options.extrusionH !== void 0 && { extrusionH: {
|
|
5679
|
+
key: "extrusionH",
|
|
5680
|
+
value: options.extrusionH
|
|
5681
|
+
} },
|
|
5682
|
+
...options.contourW !== void 0 && { contourW: {
|
|
5683
|
+
key: "contourW",
|
|
5684
|
+
value: options.contourW
|
|
5685
|
+
} },
|
|
5686
|
+
...options.prstMaterial !== void 0 && { prstMaterial: {
|
|
5687
|
+
key: "prstMaterial",
|
|
5688
|
+
value: PresetMaterialType[options.prstMaterial]
|
|
5689
|
+
} }
|
|
5690
|
+
} : void 0,
|
|
5691
|
+
children,
|
|
5692
|
+
name: "a:sp3d"
|
|
5693
|
+
});
|
|
5694
|
+
};
|
|
5695
|
+
//#endregion
|
|
4253
5696
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/shape-properties.ts
|
|
4254
5697
|
/**
|
|
4255
5698
|
* Represents shape properties for a DrawingML picture.
|
|
4256
5699
|
*
|
|
4257
5700
|
* This element defines the visual formatting of a picture, including
|
|
4258
5701
|
* its transform (size, position, rotation, flip), geometry preset,
|
|
4259
|
-
*
|
|
4260
|
-
*
|
|
4261
|
-
* Reference: http://officeopenxml.com/drwSp-SpPr.php
|
|
5702
|
+
* fill, outline, effects, and 3D properties.
|
|
4262
5703
|
*
|
|
4263
5704
|
* ## XSD Schema
|
|
4264
5705
|
* ```xml
|
|
@@ -4280,33 +5721,29 @@ var ShapePropertiesAttributes = class extends XmlAttributeComponent {
|
|
|
4280
5721
|
* @example
|
|
4281
5722
|
* ```typescript
|
|
4282
5723
|
* const shapeProps = new ShapeProperties({
|
|
4283
|
-
*
|
|
4284
|
-
*
|
|
4285
|
-
*
|
|
4286
|
-
*
|
|
5724
|
+
* element: "pic",
|
|
5725
|
+
* transform: { emus: { x: 914400, y: 914400 } },
|
|
5726
|
+
* effects: {
|
|
5727
|
+
* glow: { rad: 50800, color: { value: "FF0000" } },
|
|
4287
5728
|
* },
|
|
4288
|
-
* outline: {
|
|
4289
|
-
* width: 9525,
|
|
4290
|
-
* type: "solidFill",
|
|
4291
|
-
* solidFillType: "rgb",
|
|
4292
|
-
* value: "FF0000"
|
|
4293
|
-
* }
|
|
4294
5729
|
* });
|
|
4295
5730
|
* ```
|
|
4296
5731
|
*/
|
|
4297
5732
|
var ShapeProperties = class extends XmlComponent {
|
|
4298
|
-
constructor({ element, outline, solidFill, transform }) {
|
|
5733
|
+
constructor({ element, effects, gradientFill, noFill, outline, shape3d, solidFill, transform }) {
|
|
4299
5734
|
super(`${element}:spPr`);
|
|
4300
5735
|
_defineProperty(this, "form", void 0);
|
|
4301
5736
|
this.root.push(new ShapePropertiesAttributes({ bwMode: "auto" }));
|
|
4302
5737
|
this.form = new Form(transform);
|
|
4303
5738
|
this.root.push(this.form);
|
|
4304
5739
|
this.root.push(new PresetGeometry());
|
|
4305
|
-
if (
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
if (
|
|
5740
|
+
if (noFill) this.root.push(createNoFill());
|
|
5741
|
+
else if (solidFill) this.root.push(createSolidFill(solidFill));
|
|
5742
|
+
else if (gradientFill) this.root.push(createGradientFill(gradientFill));
|
|
5743
|
+
else if (outline) this.root.push(createNoFill());
|
|
5744
|
+
if (outline) this.root.push(createOutline(outline));
|
|
5745
|
+
if (effects) this.root.push(createEffectList(effects));
|
|
5746
|
+
if (shape3d) this.root.push(createShape3D(shape3d));
|
|
4310
5747
|
}
|
|
4311
5748
|
};
|
|
4312
5749
|
//#endregion
|
|
@@ -4542,17 +5979,17 @@ const createBlip = (mediaData) => new BuilderElement({
|
|
|
4542
5979
|
*
|
|
4543
5980
|
* This module defines the portion of an image to use when filling a shape.
|
|
4544
5981
|
*
|
|
4545
|
-
* Reference:
|
|
5982
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
|
|
4546
5983
|
*
|
|
4547
5984
|
* @module
|
|
4548
5985
|
*/
|
|
4549
5986
|
/**
|
|
4550
|
-
*
|
|
5987
|
+
* Creates a source rectangle element for blip fill cropping.
|
|
4551
5988
|
*
|
|
4552
5989
|
* This element specifies a portion of the blip (image) to use as the fill.
|
|
4553
|
-
* When
|
|
5990
|
+
* When no options are provided, the entire blip is used.
|
|
4554
5991
|
*
|
|
4555
|
-
* Reference:
|
|
5992
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
|
|
4556
5993
|
*
|
|
4557
5994
|
* ## XSD Schema
|
|
4558
5995
|
* ```xml
|
|
@@ -4566,13 +6003,33 @@ const createBlip = (mediaData) => new BuilderElement({
|
|
|
4566
6003
|
*
|
|
4567
6004
|
* @example
|
|
4568
6005
|
* ```typescript
|
|
4569
|
-
*
|
|
6006
|
+
* // Crop 10% from left and right
|
|
6007
|
+
* createSourceRectangle({ l: 10000, r: 10000 });
|
|
4570
6008
|
* ```
|
|
4571
6009
|
*/
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
6010
|
+
const createSourceRectangle = (options) => {
|
|
6011
|
+
if (!options) return new BuilderElement({ name: "a:srcRect" });
|
|
6012
|
+
const attributes = {};
|
|
6013
|
+
if (options.l !== void 0) attributes.l = {
|
|
6014
|
+
key: "l",
|
|
6015
|
+
value: options.l
|
|
6016
|
+
};
|
|
6017
|
+
if (options.t !== void 0) attributes.t = {
|
|
6018
|
+
key: "t",
|
|
6019
|
+
value: options.t
|
|
6020
|
+
};
|
|
6021
|
+
if (options.r !== void 0) attributes.r = {
|
|
6022
|
+
key: "r",
|
|
6023
|
+
value: options.r
|
|
6024
|
+
};
|
|
6025
|
+
if (options.b !== void 0) attributes.b = {
|
|
6026
|
+
key: "b",
|
|
6027
|
+
value: options.b
|
|
6028
|
+
};
|
|
6029
|
+
return new BuilderElement({
|
|
6030
|
+
attributes,
|
|
6031
|
+
name: "a:srcRect"
|
|
6032
|
+
});
|
|
4576
6033
|
};
|
|
4577
6034
|
//#endregion
|
|
4578
6035
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/blip/stretch.ts
|
|
@@ -4643,9 +6100,9 @@ var Stretch = class extends XmlComponent {
|
|
|
4643
6100
|
* Represents a blip fill for pictures in DrawingML.
|
|
4644
6101
|
*
|
|
4645
6102
|
* This element specifies the type of fill used for a picture. It contains the blip (image)
|
|
4646
|
-
* reference, an optional source rectangle, and the fill mode (typically stretch).
|
|
6103
|
+
* reference, an optional source rectangle for cropping, and the fill mode (typically stretch).
|
|
4647
6104
|
*
|
|
4648
|
-
* Reference:
|
|
6105
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties
|
|
4649
6106
|
*
|
|
4650
6107
|
* ## XSD Schema
|
|
4651
6108
|
* ```xml
|
|
@@ -4663,13 +6120,14 @@ var Stretch = class extends XmlComponent {
|
|
|
4663
6120
|
* @example
|
|
4664
6121
|
* ```typescript
|
|
4665
6122
|
* const blipFill = new BlipFill(mediaData);
|
|
6123
|
+
* // If mediaData.srcRect is set, cropping is applied
|
|
4666
6124
|
* ```
|
|
4667
6125
|
*/
|
|
4668
6126
|
var BlipFill = class extends XmlComponent {
|
|
4669
6127
|
constructor(mediaData) {
|
|
4670
6128
|
super("pic:blipFill");
|
|
4671
6129
|
this.root.push(createBlip(mediaData));
|
|
4672
|
-
this.root.push(
|
|
6130
|
+
this.root.push(createSourceRectangle(mediaData.srcRect));
|
|
4673
6131
|
this.root.push(new Stretch());
|
|
4674
6132
|
}
|
|
4675
6133
|
};
|
|
@@ -5040,15 +6498,90 @@ var Pic = class extends XmlComponent {
|
|
|
5040
6498
|
};
|
|
5041
6499
|
//#endregion
|
|
5042
6500
|
//#region src/file/drawing/inline/graphic/graphic-data/wpg/wpg-group.ts
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
6501
|
+
/**
|
|
6502
|
+
* Creates a group transform element (a:xfrm) with optional chOff/chExt.
|
|
6503
|
+
*
|
|
6504
|
+
* This uses CT_GroupTransform2D which extends CT_Transform2D with
|
|
6505
|
+
* child offset and extent elements.
|
|
6506
|
+
*
|
|
6507
|
+
* ## XSD Schema
|
|
6508
|
+
* ```xml
|
|
6509
|
+
* <xsd:complexType name="CT_GroupTransform2D">
|
|
6510
|
+
* <xsd:sequence>
|
|
6511
|
+
* <xsd:element name="off" type="CT_Point2D" minOccurs="0"/>
|
|
6512
|
+
* <xsd:element name="ext" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
6513
|
+
* <xsd:element name="chOff" type="CT_Point2D" minOccurs="0"/>
|
|
6514
|
+
* <xsd:element name="chExt" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
6515
|
+
* </xsd:sequence>
|
|
6516
|
+
* <xsd:attribute name="rot" type="ST_Angle" default="0"/>
|
|
6517
|
+
* <xsd:attribute name="flipH" type="xsd:boolean" default="false"/>
|
|
6518
|
+
* <xsd:attribute name="flipV" type="xsd:boolean" default="false"/>
|
|
6519
|
+
* </xsd:complexType>
|
|
6520
|
+
* ```
|
|
6521
|
+
*/
|
|
6522
|
+
const createGroupForm = (transform, chOff, chExt) => {
|
|
6523
|
+
var _transform$offset, _transform$offset2, _transform$flip, _transform$flip2, _transform$flip3, _transform$flip4;
|
|
6524
|
+
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)];
|
|
6525
|
+
if (chOff) children.push(new BuilderElement({
|
|
6526
|
+
attributes: {
|
|
6527
|
+
x: {
|
|
6528
|
+
key: "x",
|
|
6529
|
+
value: chOff.x
|
|
6530
|
+
},
|
|
6531
|
+
y: {
|
|
6532
|
+
key: "y",
|
|
6533
|
+
value: chOff.y
|
|
6534
|
+
}
|
|
6535
|
+
},
|
|
6536
|
+
name: "a:chOff"
|
|
6537
|
+
}));
|
|
6538
|
+
if (chExt) children.push(new BuilderElement({
|
|
6539
|
+
attributes: {
|
|
6540
|
+
cx: {
|
|
6541
|
+
key: "cx",
|
|
6542
|
+
value: chExt.cx
|
|
6543
|
+
},
|
|
6544
|
+
cy: {
|
|
6545
|
+
key: "cy",
|
|
6546
|
+
value: chExt.cy
|
|
6547
|
+
}
|
|
6548
|
+
},
|
|
6549
|
+
name: "a:chExt"
|
|
6550
|
+
}));
|
|
6551
|
+
return new BuilderElement({
|
|
6552
|
+
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 ? {
|
|
6553
|
+
...((_transform$flip3 = transform.flip) === null || _transform$flip3 === void 0 ? void 0 : _transform$flip3.horizontal) !== void 0 && { flipH: {
|
|
6554
|
+
key: "flipH",
|
|
6555
|
+
value: transform.flip.horizontal
|
|
6556
|
+
} },
|
|
6557
|
+
...((_transform$flip4 = transform.flip) === null || _transform$flip4 === void 0 ? void 0 : _transform$flip4.vertical) !== void 0 && { flipV: {
|
|
6558
|
+
key: "flipV",
|
|
6559
|
+
value: transform.flip.vertical
|
|
6560
|
+
} },
|
|
6561
|
+
...transform.rotation !== void 0 && { rot: {
|
|
6562
|
+
key: "rot",
|
|
6563
|
+
value: transform.rotation
|
|
6564
|
+
} }
|
|
6565
|
+
} : void 0,
|
|
6566
|
+
children,
|
|
6567
|
+
name: "a:xfrm"
|
|
6568
|
+
});
|
|
6569
|
+
};
|
|
6570
|
+
const createGroupProperties = (options) => {
|
|
6571
|
+
const children = [createGroupForm(options.transformation, options.chOff, options.chExt)];
|
|
6572
|
+
if (options.noFill) children.push(createNoFill());
|
|
6573
|
+
else if (options.solidFill) children.push(createSolidFill(options.solidFill));
|
|
6574
|
+
if (options.effects) children.push(createEffectList(options.effects));
|
|
6575
|
+
return new BuilderElement({
|
|
6576
|
+
children,
|
|
6577
|
+
name: "wpg:grpSpPr"
|
|
6578
|
+
});
|
|
6579
|
+
};
|
|
5047
6580
|
const createNonVisualGroupProperties = () => new BuilderElement({ name: "wpg:cNvGrpSpPr" });
|
|
5048
6581
|
const createWpgGroup = (options) => new BuilderElement({
|
|
5049
6582
|
children: [
|
|
5050
6583
|
createNonVisualGroupProperties(),
|
|
5051
|
-
createGroupProperties(options
|
|
6584
|
+
createGroupProperties(options),
|
|
5052
6585
|
...options.children
|
|
5053
6586
|
],
|
|
5054
6587
|
name: "wpg:wgp"
|
|
@@ -5097,8 +6630,9 @@ var GraphicData = class extends XmlComponent {
|
|
|
5097
6630
|
this.root.push(wps);
|
|
5098
6631
|
} else if (mediaData.type === "wpg") {
|
|
5099
6632
|
this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" }));
|
|
6633
|
+
const md = mediaData;
|
|
5100
6634
|
const wpg = createWpgGroup({
|
|
5101
|
-
children:
|
|
6635
|
+
children: md.children.map((child) => {
|
|
5102
6636
|
if (child.type === "wps") return createWpsShape({
|
|
5103
6637
|
...child.data,
|
|
5104
6638
|
outline: child.outline,
|
|
@@ -5111,7 +6645,11 @@ var GraphicData = class extends XmlComponent {
|
|
|
5111
6645
|
transform: child.transformation
|
|
5112
6646
|
});
|
|
5113
6647
|
}),
|
|
5114
|
-
transformation: transform
|
|
6648
|
+
transformation: transform,
|
|
6649
|
+
chOff: md.chOff,
|
|
6650
|
+
chExt: md.chExt,
|
|
6651
|
+
solidFill: md.solidFill,
|
|
6652
|
+
effects: md.effects
|
|
5115
6653
|
});
|
|
5116
6654
|
this.root.push(wpg);
|
|
5117
6655
|
} else {
|
|
@@ -5881,9 +7419,10 @@ var Drawing = class extends XmlComponent {
|
|
|
5881
7419
|
};
|
|
5882
7420
|
//#endregion
|
|
5883
7421
|
//#region src/file/paragraph/run/image-run.ts
|
|
5884
|
-
const createImageData = (data, transformation, key) => ({
|
|
7422
|
+
const createImageData = (data, transformation, key, srcRect) => ({
|
|
5885
7423
|
data,
|
|
5886
7424
|
fileName: key,
|
|
7425
|
+
srcRect,
|
|
5887
7426
|
transformation: {
|
|
5888
7427
|
emus: {
|
|
5889
7428
|
x: Math.round(transformation.width * 9525),
|
|
@@ -5929,7 +7468,7 @@ var ImageRun = class extends Run {
|
|
|
5929
7468
|
const fallbackData = toUint8Array(options.fallback.data);
|
|
5930
7469
|
this.imageData = {
|
|
5931
7470
|
type: options.type,
|
|
5932
|
-
...createImageData(rawData, options.transformation, key),
|
|
7471
|
+
...createImageData(rawData, options.transformation, key, options.srcRect),
|
|
5933
7472
|
fallback: {
|
|
5934
7473
|
type: options.fallback.type,
|
|
5935
7474
|
...createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)
|
|
@@ -5937,7 +7476,7 @@ var ImageRun = class extends Run {
|
|
|
5937
7476
|
};
|
|
5938
7477
|
} else this.imageData = {
|
|
5939
7478
|
type: options.type,
|
|
5940
|
-
...createImageData(rawData, options.transformation, key)
|
|
7479
|
+
...createImageData(rawData, options.transformation, key, options.srcRect)
|
|
5941
7480
|
};
|
|
5942
7481
|
const drawing = new Drawing(this.imageData, {
|
|
5943
7482
|
docProperties: options.altText,
|
|
@@ -8496,6 +10035,34 @@ const createFrameProperties = (options) => {
|
|
|
8496
10035
|
* @module
|
|
8497
10036
|
*/
|
|
8498
10037
|
/**
|
|
10038
|
+
* Vertical text alignment types for paragraphs.
|
|
10039
|
+
*
|
|
10040
|
+
* Specifies the vertical alignment of text within the paragraph.
|
|
10041
|
+
*
|
|
10042
|
+
* @publicApi
|
|
10043
|
+
*/
|
|
10044
|
+
const TextAlignmentType = {
|
|
10045
|
+
TOP: "top",
|
|
10046
|
+
CENTER: "center",
|
|
10047
|
+
BASELINE: "baseline",
|
|
10048
|
+
BOTTOM: "bottom",
|
|
10049
|
+
AUTO: "auto"
|
|
10050
|
+
};
|
|
10051
|
+
/**
|
|
10052
|
+
* Textbox tight wrap types for paragraphs.
|
|
10053
|
+
*
|
|
10054
|
+
* Specifies how tightly text wraps around a textbox.
|
|
10055
|
+
*
|
|
10056
|
+
* @publicApi
|
|
10057
|
+
*/
|
|
10058
|
+
const TextboxTightWrapType = {
|
|
10059
|
+
NONE: "none",
|
|
10060
|
+
ALL_LINES: "allLines",
|
|
10061
|
+
FIRST_AND_LAST_LINE: "firstAndLastLine",
|
|
10062
|
+
FIRST_LINE_ONLY: "firstLineOnly",
|
|
10063
|
+
LAST_LINE_ONLY: "lastLineOnly"
|
|
10064
|
+
};
|
|
10065
|
+
/**
|
|
8499
10066
|
* Represents paragraph properties (pPr) in a WordprocessingML document.
|
|
8500
10067
|
*
|
|
8501
10068
|
* The paragraph properties element specifies all formatting applied to a paragraph,
|
|
@@ -8658,6 +10225,27 @@ var ParagraphProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
|
8658
10225
|
if (options.outlineLevel !== void 0) this.push(createOutlineLevel(options.outlineLevel));
|
|
8659
10226
|
if (options.suppressLineNumbers !== void 0) this.push(new OnOffElement("w:suppressLineNumbers", options.suppressLineNumbers));
|
|
8660
10227
|
if (options.autoSpaceEastAsianText !== void 0) this.push(new OnOffElement("w:autoSpaceDN", options.autoSpaceEastAsianText));
|
|
10228
|
+
if (options.suppressAutoHyphens !== void 0) this.push(new OnOffElement("w:suppressAutoHyphens", options.suppressAutoHyphens));
|
|
10229
|
+
if (options.adjustRightInd !== void 0) this.push(new OnOffElement("w:adjustRightInd", options.adjustRightInd));
|
|
10230
|
+
if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
|
|
10231
|
+
if (options.mirrorIndents !== void 0) this.push(new OnOffElement("w:mirrorIndents", options.mirrorIndents));
|
|
10232
|
+
if (options.kinsoku !== void 0) this.push(new OnOffElement("w:kinsoku", options.kinsoku));
|
|
10233
|
+
if (options.topLinePunct !== void 0) this.push(new OnOffElement("w:topLinePunct", options.topLinePunct));
|
|
10234
|
+
if (options.autoSpaceDE !== void 0) this.push(new OnOffElement("w:autoSpaceDE", options.autoSpaceDE));
|
|
10235
|
+
if (options.textAlignment !== void 0) this.push(new BuilderElement({
|
|
10236
|
+
attributes: { val: {
|
|
10237
|
+
key: "w:val",
|
|
10238
|
+
value: options.textAlignment
|
|
10239
|
+
} },
|
|
10240
|
+
name: "w:textAlignment"
|
|
10241
|
+
}));
|
|
10242
|
+
if (options.textboxTightWrap !== void 0) this.push(new BuilderElement({
|
|
10243
|
+
attributes: { val: {
|
|
10244
|
+
key: "w:val",
|
|
10245
|
+
value: options.textboxTightWrap
|
|
10246
|
+
} },
|
|
10247
|
+
name: "w:textboxTightWrap"
|
|
10248
|
+
}));
|
|
8661
10249
|
if (options.run) this.push(new ParagraphRunProperties(options.run));
|
|
8662
10250
|
if (options.revision) this.push(new ParagraphPropertiesChange(options.revision));
|
|
8663
10251
|
}
|
|
@@ -13027,6 +14615,137 @@ const createDocumentGrid = ({ type, linePitch, charSpace }) => new BuilderElemen
|
|
|
13027
14615
|
name: "w:docGrid"
|
|
13028
14616
|
});
|
|
13029
14617
|
//#endregion
|
|
14618
|
+
//#region src/file/document/body/section-properties/properties/footnote-endnote-properties.ts
|
|
14619
|
+
/**
|
|
14620
|
+
* Footnote and endnote properties module for WordprocessingML section properties.
|
|
14621
|
+
*
|
|
14622
|
+
* Specifies footnote/endnote placement and numbering format within a section.
|
|
14623
|
+
*
|
|
14624
|
+
* Reference: ISO/IEC 29500-4, CT_FtnProps / CT_EdnProps
|
|
14625
|
+
*
|
|
14626
|
+
* @module
|
|
14627
|
+
*/
|
|
14628
|
+
/**
|
|
14629
|
+
* Creates footnote properties element (w:footnotePr) for a section.
|
|
14630
|
+
*
|
|
14631
|
+
* ## XSD Schema
|
|
14632
|
+
* ```xml
|
|
14633
|
+
* <xsd:complexType name="CT_FtnProps">
|
|
14634
|
+
* <xsd:sequence>
|
|
14635
|
+
* <xsd:element name="pos" type="CT_FtnPos" minOccurs="0"/>
|
|
14636
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
14637
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
14638
|
+
* </xsd:sequence>
|
|
14639
|
+
* </xsd:complexType>
|
|
14640
|
+
* ```
|
|
14641
|
+
*/
|
|
14642
|
+
const createFootnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
14643
|
+
const container = new FootnoteProperties();
|
|
14644
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
14645
|
+
attributes: { val: {
|
|
14646
|
+
key: "w:val",
|
|
14647
|
+
value: pos
|
|
14648
|
+
} },
|
|
14649
|
+
name: "w:pos"
|
|
14650
|
+
}));
|
|
14651
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
14652
|
+
attributes: {
|
|
14653
|
+
format: {
|
|
14654
|
+
key: "w:format",
|
|
14655
|
+
value: format
|
|
14656
|
+
},
|
|
14657
|
+
val: {
|
|
14658
|
+
key: "w:fmt",
|
|
14659
|
+
value: formatType
|
|
14660
|
+
}
|
|
14661
|
+
},
|
|
14662
|
+
name: "w:numFmt"
|
|
14663
|
+
}));
|
|
14664
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
14665
|
+
attributes: { val: {
|
|
14666
|
+
key: "w:val",
|
|
14667
|
+
value: decimalNumber(numStart)
|
|
14668
|
+
} },
|
|
14669
|
+
name: "w:numStart"
|
|
14670
|
+
}));
|
|
14671
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
14672
|
+
attributes: { val: {
|
|
14673
|
+
key: "w:val",
|
|
14674
|
+
value: numRestart
|
|
14675
|
+
} },
|
|
14676
|
+
name: "w:numRestart"
|
|
14677
|
+
}));
|
|
14678
|
+
return container;
|
|
14679
|
+
};
|
|
14680
|
+
/**
|
|
14681
|
+
* Footnote properties container element.
|
|
14682
|
+
*/
|
|
14683
|
+
var FootnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
14684
|
+
constructor() {
|
|
14685
|
+
super("w:footnotePr", true);
|
|
14686
|
+
}
|
|
14687
|
+
};
|
|
14688
|
+
/**
|
|
14689
|
+
* Creates endnote properties element (w:endnotePr) for a section.
|
|
14690
|
+
*
|
|
14691
|
+
* ## XSD Schema
|
|
14692
|
+
* ```xml
|
|
14693
|
+
* <xsd:complexType name="CT_EdnProps">
|
|
14694
|
+
* <xsd:sequence>
|
|
14695
|
+
* <xsd:element name="pos" type="CT_EdnPos" minOccurs="0"/>
|
|
14696
|
+
* <xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0"/>
|
|
14697
|
+
* <xsd:group ref="EG_FtnEdnNumProps" minOccurs="0"/>
|
|
14698
|
+
* </xsd:sequence>
|
|
14699
|
+
* </xsd:complexType>
|
|
14700
|
+
* ```
|
|
14701
|
+
*/
|
|
14702
|
+
const createEndnoteProperties = ({ pos, formatType, format, numStart, numRestart }) => {
|
|
14703
|
+
const container = new EndnoteProperties();
|
|
14704
|
+
if (pos !== void 0) container.addChildElement(new BuilderElement({
|
|
14705
|
+
attributes: { val: {
|
|
14706
|
+
key: "w:val",
|
|
14707
|
+
value: pos
|
|
14708
|
+
} },
|
|
14709
|
+
name: "w:pos"
|
|
14710
|
+
}));
|
|
14711
|
+
if (formatType !== void 0 || format !== void 0) container.addChildElement(new BuilderElement({
|
|
14712
|
+
attributes: {
|
|
14713
|
+
format: {
|
|
14714
|
+
key: "w:format",
|
|
14715
|
+
value: format
|
|
14716
|
+
},
|
|
14717
|
+
val: {
|
|
14718
|
+
key: "w:fmt",
|
|
14719
|
+
value: formatType
|
|
14720
|
+
}
|
|
14721
|
+
},
|
|
14722
|
+
name: "w:numFmt"
|
|
14723
|
+
}));
|
|
14724
|
+
if (numStart !== void 0) container.addChildElement(new BuilderElement({
|
|
14725
|
+
attributes: { val: {
|
|
14726
|
+
key: "w:val",
|
|
14727
|
+
value: decimalNumber(numStart)
|
|
14728
|
+
} },
|
|
14729
|
+
name: "w:numStart"
|
|
14730
|
+
}));
|
|
14731
|
+
if (numRestart !== void 0) container.addChildElement(new BuilderElement({
|
|
14732
|
+
attributes: { val: {
|
|
14733
|
+
key: "w:val",
|
|
14734
|
+
value: numRestart
|
|
14735
|
+
} },
|
|
14736
|
+
name: "w:numRestart"
|
|
14737
|
+
}));
|
|
14738
|
+
return container;
|
|
14739
|
+
};
|
|
14740
|
+
/**
|
|
14741
|
+
* Endnote properties container element.
|
|
14742
|
+
*/
|
|
14743
|
+
var EndnoteProperties = class extends IgnoreIfEmptyXmlComponent {
|
|
14744
|
+
constructor() {
|
|
14745
|
+
super("w:endnotePr", true);
|
|
14746
|
+
}
|
|
14747
|
+
};
|
|
14748
|
+
//#endregion
|
|
13030
14749
|
//#region src/file/document/body/section-properties/properties/header-footer-reference.ts
|
|
13031
14750
|
/**
|
|
13032
14751
|
* 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.
|
|
@@ -13389,8 +15108,12 @@ const PageNumberSeparator = {
|
|
|
13389
15108
|
* });
|
|
13390
15109
|
* ```
|
|
13391
15110
|
*/
|
|
13392
|
-
const createPageNumberType = ({ start, formatType, separator }) => new BuilderElement({
|
|
15111
|
+
const createPageNumberType = ({ start, formatType, separator, chapStyle }) => new BuilderElement({
|
|
13393
15112
|
attributes: {
|
|
15113
|
+
chapStyle: {
|
|
15114
|
+
key: "w:chapStyle",
|
|
15115
|
+
value: chapStyle === void 0 ? void 0 : decimalNumber(chapStyle)
|
|
15116
|
+
},
|
|
13394
15117
|
formatType: {
|
|
13395
15118
|
key: "w:fmt",
|
|
13396
15119
|
value: formatType
|
|
@@ -13679,7 +15402,7 @@ const sectionPageSizeDefaults = {
|
|
|
13679
15402
|
* ```
|
|
13680
15403
|
*/
|
|
13681
15404
|
var SectionProperties = class extends XmlComponent {
|
|
13682
|
-
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 } = {}) {
|
|
15405
|
+
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 } = {}) {
|
|
13683
15406
|
super("w:sectPr");
|
|
13684
15407
|
this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
|
|
13685
15408
|
this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
|
|
@@ -13698,6 +15421,24 @@ var SectionProperties = class extends XmlComponent {
|
|
|
13698
15421
|
if (titlePage !== void 0) this.root.push(new OnOffElement("w:titlePg", titlePage));
|
|
13699
15422
|
if (textDirection) this.root.push(new PageTextDirection(textDirection));
|
|
13700
15423
|
if (revision) this.root.push(new SectionPropertiesChange(revision));
|
|
15424
|
+
if (noEndnote !== void 0) this.root.push(new OnOffElement("w:noEndnote", noEndnote));
|
|
15425
|
+
if (bidi !== void 0) this.root.push(new OnOffElement("w:bidi", bidi));
|
|
15426
|
+
if (rtlGutter !== void 0) this.root.push(new OnOffElement("w:rtlGutter", rtlGutter));
|
|
15427
|
+
if (paperSrc) this.root.push(new BuilderElement({
|
|
15428
|
+
attributes: {
|
|
15429
|
+
first: {
|
|
15430
|
+
key: "w:first",
|
|
15431
|
+
value: paperSrc.first === void 0 ? void 0 : decimalNumber(paperSrc.first)
|
|
15432
|
+
},
|
|
15433
|
+
other: {
|
|
15434
|
+
key: "w:other",
|
|
15435
|
+
value: paperSrc.other === void 0 ? void 0 : decimalNumber(paperSrc.other)
|
|
15436
|
+
}
|
|
15437
|
+
},
|
|
15438
|
+
name: "w:paperSrc"
|
|
15439
|
+
}));
|
|
15440
|
+
if (footnotePr) this.root.push(createFootnoteProperties(footnotePr));
|
|
15441
|
+
if (endnotePr) this.root.push(createEndnoteProperties(endnotePr));
|
|
13701
15442
|
this.root.push(createDocumentGrid({
|
|
13702
15443
|
charSpace,
|
|
13703
15444
|
linePitch,
|
|
@@ -23180,4 +24921,4 @@ const findPatchKeys = (text) => {
|
|
|
23180
24921
|
return (_text$match = text.match(/(?<=\{\{).+?(?=\}\})/gs)) !== null && _text$match !== void 0 ? _text$match : [];
|
|
23181
24922
|
};
|
|
23182
24923
|
//#endregion
|
|
23183
|
-
export { AbstractNumbering, AlignmentType, AnnotationReference, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, ThemeColor, ThemeFont, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };
|
|
24924
|
+
export { AbstractNumbering, AlignmentType, AnnotationReference, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TextAlignmentType, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, TextboxTightWrapType, ThematicBreak, ThemeColor, ThemeFont, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };
|