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