docx-plus 0.0.6 → 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 +3 -0
- package/dist/index.cjs +1670 -183
- package/dist/index.d.cts +413 -37
- package/dist/index.d.mts +413 -37
- package/dist/index.iife.js +1670 -183
- package/dist/index.mjs +1670 -183
- package/dist/index.umd.js +1670 -183
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -3756,6 +3756,1257 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
3756
3756
|
name: "wp:positionV"
|
|
3757
3757
|
});
|
|
3758
3758
|
//#endregion
|
|
3759
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/color-transform.ts
|
|
3760
|
+
/**
|
|
3761
|
+
* Color transform elements for DrawingML colors.
|
|
3762
|
+
*
|
|
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
|
|
3767
|
+
*
|
|
3768
|
+
* @module
|
|
3769
|
+
*/
|
|
3770
|
+
/**
|
|
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
|
|
3962
|
+
*
|
|
3963
|
+
* @module
|
|
3964
|
+
*/
|
|
3965
|
+
/**
|
|
3966
|
+
* Creates an HSL color element.
|
|
3967
|
+
*
|
|
3968
|
+
* Specifies a color using Hue, Saturation, and Luminance values.
|
|
3969
|
+
*
|
|
3970
|
+
* ## XSD Schema
|
|
3971
|
+
* ```xml
|
|
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>
|
|
3980
|
+
* ```
|
|
3981
|
+
*/
|
|
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
|
+
});
|
|
4002
|
+
};
|
|
4003
|
+
//#endregion
|
|
4004
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/preset-color.ts
|
|
4005
|
+
/**
|
|
4006
|
+
* Preset color element for DrawingML.
|
|
4007
|
+
*
|
|
4008
|
+
* This module provides named preset colors (CSS named colors).
|
|
4009
|
+
*
|
|
4010
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetColor / ST_PresetColorVal
|
|
4011
|
+
*
|
|
4012
|
+
* @module
|
|
4013
|
+
*/
|
|
4014
|
+
/**
|
|
4015
|
+
* Preset color values (CSS named colors).
|
|
4016
|
+
*
|
|
4017
|
+
* ## XSD Schema
|
|
4018
|
+
* ```xml
|
|
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>
|
|
4026
|
+
* ```
|
|
4027
|
+
*/
|
|
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"
|
|
4176
|
+
};
|
|
4177
|
+
/**
|
|
4178
|
+
* Creates a preset color element.
|
|
4179
|
+
*
|
|
4180
|
+
* Specifies a color using a named preset (CSS named color).
|
|
4181
|
+
*
|
|
4182
|
+
* ## XSD Schema
|
|
4183
|
+
* ```xml
|
|
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>
|
|
4190
|
+
* ```
|
|
4191
|
+
*/
|
|
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
|
+
});
|
|
4202
|
+
};
|
|
4203
|
+
//#endregion
|
|
4204
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/rgb-color.ts
|
|
4205
|
+
/**
|
|
4206
|
+
* RGB color element for DrawingML shapes.
|
|
4207
|
+
*
|
|
4208
|
+
* This module provides RGB color support for solid fills.
|
|
4209
|
+
*
|
|
4210
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SRgbColor
|
|
4211
|
+
*
|
|
4212
|
+
* @module
|
|
4213
|
+
*/
|
|
4214
|
+
/**
|
|
4215
|
+
* Creates an sRGB color element.
|
|
4216
|
+
*
|
|
4217
|
+
* Specifies a color using RGB hex values.
|
|
4218
|
+
*
|
|
4219
|
+
* ## XSD Schema
|
|
4220
|
+
* ```xml
|
|
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"/>
|
|
4226
|
+
* </xsd:complexType>
|
|
4227
|
+
* ```
|
|
4228
|
+
*
|
|
4229
|
+
* @example
|
|
4230
|
+
* ```typescript
|
|
4231
|
+
* const redColor = createRgbColor({ value: "FF0000" });
|
|
4232
|
+
* // With alpha transform
|
|
4233
|
+
* const semiRed = createRgbColor({ value: "FF0000", transforms: { alpha: 50000 } });
|
|
4234
|
+
* ```
|
|
4235
|
+
*/
|
|
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
|
+
});
|
|
4246
|
+
};
|
|
4247
|
+
//#endregion
|
|
4248
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/scheme-color.ts
|
|
4249
|
+
/**
|
|
4250
|
+
* Scheme color element for DrawingML shapes.
|
|
4251
|
+
*
|
|
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
|
|
4258
|
+
*/
|
|
4259
|
+
/**
|
|
4260
|
+
* Scheme color values for theme-based colors.
|
|
4261
|
+
*
|
|
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.
|
|
4285
|
+
*
|
|
4286
|
+
* Specifies a color using a theme color scheme reference.
|
|
4287
|
+
*
|
|
4288
|
+
* ## XSD Schema
|
|
4289
|
+
* ```xml
|
|
4290
|
+
* <xsd:complexType name="CT_SchemeColor">
|
|
4291
|
+
* <xsd:sequence>
|
|
4292
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4293
|
+
* </xsd:sequence>
|
|
4294
|
+
* <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
|
|
4295
|
+
* </xsd:complexType>
|
|
4296
|
+
* ```
|
|
4297
|
+
*
|
|
4298
|
+
* @example
|
|
4299
|
+
* ```typescript
|
|
4300
|
+
* const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });
|
|
4301
|
+
* // With tint transform
|
|
4302
|
+
* const lightAccent = createSchemeColor({
|
|
4303
|
+
* value: SchemeColor.ACCENT1,
|
|
4304
|
+
* transforms: { tint: 40000 },
|
|
4305
|
+
* });
|
|
4306
|
+
* ```
|
|
4307
|
+
*/
|
|
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
|
+
});
|
|
4318
|
+
};
|
|
4319
|
+
//#endregion
|
|
4320
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/system-color.ts
|
|
4321
|
+
/**
|
|
4322
|
+
* System color element for DrawingML.
|
|
4323
|
+
*
|
|
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
|
|
4327
|
+
*
|
|
4328
|
+
* @module
|
|
4329
|
+
*/
|
|
4330
|
+
/**
|
|
4331
|
+
* System color values referencing OS UI colors.
|
|
4332
|
+
*
|
|
4333
|
+
* ## XSD Schema
|
|
4334
|
+
* ```xml
|
|
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>
|
|
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).
|
|
4381
|
+
*
|
|
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>
|
|
4391
|
+
* ```
|
|
4392
|
+
*/
|
|
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
|
+
};
|
|
4410
|
+
//#endregion
|
|
4411
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/solid-fill.ts
|
|
4412
|
+
/**
|
|
4413
|
+
* Solid fill element for DrawingML shapes.
|
|
4414
|
+
*
|
|
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
|
|
4419
|
+
*
|
|
4420
|
+
* @module
|
|
4421
|
+
*/
|
|
4422
|
+
/**
|
|
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.
|
|
4438
|
+
*
|
|
4439
|
+
* Specifies a solid color fill using any supported color type.
|
|
4440
|
+
*
|
|
4441
|
+
* ## XSD Schema
|
|
4442
|
+
* ```xml
|
|
4443
|
+
* <xsd:complexType name="CT_SolidColorFillProperties">
|
|
4444
|
+
* <xsd:sequence>
|
|
4445
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="0"/>
|
|
4446
|
+
* <xsd:group ref="EG_EffectProperties" minOccurs="0"/>
|
|
4447
|
+
* </xsd:sequence>
|
|
4448
|
+
* </xsd:complexType>
|
|
4449
|
+
* ```
|
|
4450
|
+
*
|
|
4451
|
+
* @example
|
|
4452
|
+
* ```typescript
|
|
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 });
|
|
4461
|
+
* ```
|
|
4462
|
+
*/
|
|
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
|
|
4830
|
+
} },
|
|
4831
|
+
name: "a:softEdge"
|
|
4832
|
+
});
|
|
4833
|
+
//#endregion
|
|
4834
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/effect-list.ts
|
|
4835
|
+
/**
|
|
4836
|
+
* Effect list container for DrawingML shapes.
|
|
4837
|
+
*
|
|
4838
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectList, EG_EffectProperties
|
|
4839
|
+
*
|
|
4840
|
+
* @module
|
|
4841
|
+
*/
|
|
4842
|
+
/**
|
|
4843
|
+
* Creates a blur effect element.
|
|
4844
|
+
*
|
|
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.
|
|
4874
|
+
*
|
|
4875
|
+
* ## XSD Schema
|
|
4876
|
+
* ```xml
|
|
4877
|
+
* <xsd:complexType name="CT_EffectList">
|
|
4878
|
+
* <xsd:sequence>
|
|
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"/>
|
|
4887
|
+
* </xsd:sequence>
|
|
4888
|
+
* </xsd:complexType>
|
|
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).
|
|
4926
|
+
*
|
|
4927
|
+
* @example
|
|
4928
|
+
* ```typescript
|
|
4929
|
+
* createGradientStop({ position: 0, color: { value: "FF0000" } });
|
|
4930
|
+
* createGradientStop({ position: 100000, color: { value: "0000FF" } });
|
|
4931
|
+
* ```
|
|
4932
|
+
*/
|
|
4933
|
+
const createGradientStop = (stop) => new BuilderElement({
|
|
4934
|
+
attributes: { pos: {
|
|
4935
|
+
key: "pos",
|
|
4936
|
+
value: stop.position
|
|
4937
|
+
} },
|
|
4938
|
+
children: [createColorElement(stop.color)],
|
|
4939
|
+
name: "a:gs"
|
|
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
|
+
};
|
|
5009
|
+
//#endregion
|
|
3759
5010
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/extents/extents-attributes.ts
|
|
3760
5011
|
/**
|
|
3761
5012
|
* Extents attributes for DrawingML shapes.
|
|
@@ -3992,143 +5243,103 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
3992
5243
|
*/
|
|
3993
5244
|
const createNoFill = () => new BuilderElement({ name: "a:noFill" });
|
|
3994
5245
|
//#endregion
|
|
3995
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/
|
|
3996
|
-
/**
|
|
3997
|
-
* RGB color element for DrawingML shapes.
|
|
3998
|
-
*
|
|
3999
|
-
* This module provides RGB color support for solid fills.
|
|
4000
|
-
*
|
|
4001
|
-
* @module
|
|
4002
|
-
*/
|
|
5246
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/outline.ts
|
|
4003
5247
|
/**
|
|
4004
|
-
*
|
|
5248
|
+
* Outline (line) properties for DrawingML shapes.
|
|
4005
5249
|
*
|
|
4006
|
-
*
|
|
5250
|
+
* This module provides support for configuring outline properties including
|
|
5251
|
+
* width, cap style, compound line types, fill properties, dash, and join.
|
|
4007
5252
|
*
|
|
4008
|
-
*
|
|
4009
|
-
* ```xml
|
|
4010
|
-
* <xsd:complexType name="CT_SRgbColor">
|
|
4011
|
-
* <xsd:sequence>
|
|
4012
|
-
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4013
|
-
* </xsd:sequence>
|
|
4014
|
-
* <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
|
|
4015
|
-
* </xsd:complexType>
|
|
4016
|
-
* ```
|
|
5253
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineProperties
|
|
4017
5254
|
*
|
|
4018
|
-
* @
|
|
4019
|
-
* ```typescript
|
|
4020
|
-
* const redColor = createSolidRgbColor({ value: "FF0000" });
|
|
4021
|
-
* const blueColor = createSolidRgbColor({ value: "0000FF" });
|
|
4022
|
-
* ```
|
|
5255
|
+
* @module
|
|
4023
5256
|
*/
|
|
4024
|
-
const createSolidRgbColor = (options) => new BuilderElement({
|
|
4025
|
-
attributes: { value: {
|
|
4026
|
-
key: "val",
|
|
4027
|
-
value: options.value
|
|
4028
|
-
} },
|
|
4029
|
-
name: "a:srgbClr"
|
|
4030
|
-
});
|
|
4031
|
-
//#endregion
|
|
4032
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/scheme-color.ts
|
|
4033
5257
|
/**
|
|
4034
|
-
*
|
|
4035
|
-
*
|
|
4036
|
-
* This module provides scheme-based color support for solid fills,
|
|
4037
|
-
* allowing colors to be defined using theme color schemes.
|
|
5258
|
+
* Line cap styles for outline endpoints.
|
|
4038
5259
|
*
|
|
4039
|
-
*
|
|
5260
|
+
* Defines how the ends of a line are rendered.
|
|
4040
5261
|
*/
|
|
5262
|
+
const LineCap = {
|
|
5263
|
+
ROUND: "rnd",
|
|
5264
|
+
SQUARE: "sq",
|
|
5265
|
+
FLAT: "flat"
|
|
5266
|
+
};
|
|
4041
5267
|
/**
|
|
4042
|
-
*
|
|
4043
|
-
*
|
|
4044
|
-
* Specifies a color using a theme color scheme reference.
|
|
4045
|
-
*
|
|
4046
|
-
* ## XSD Schema
|
|
4047
|
-
* ```xml
|
|
4048
|
-
* <xsd:complexType name="CT_SchemeColor">
|
|
4049
|
-
* <xsd:sequence>
|
|
4050
|
-
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4051
|
-
* </xsd:sequence>
|
|
4052
|
-
* <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
|
|
4053
|
-
* </xsd:complexType>
|
|
4054
|
-
* ```
|
|
5268
|
+
* Compound line types for outlines.
|
|
4055
5269
|
*
|
|
4056
|
-
*
|
|
4057
|
-
* ```typescript
|
|
4058
|
-
* const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });
|
|
4059
|
-
* const bgColor = createSchemeColor({ value: SchemeColor.BG1 });
|
|
4060
|
-
* ```
|
|
5270
|
+
* Defines the structure of compound lines (single, double, etc.).
|
|
4061
5271
|
*/
|
|
4062
|
-
const
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
}
|
|
4069
|
-
//#endregion
|
|
4070
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/solid-fill.ts
|
|
5272
|
+
const CompoundLine = {
|
|
5273
|
+
SINGLE: "sng",
|
|
5274
|
+
DOUBLE: "dbl",
|
|
5275
|
+
THICK_THIN: "thickThin",
|
|
5276
|
+
THIN_THICK: "thinThick",
|
|
5277
|
+
TRI: "tri"
|
|
5278
|
+
};
|
|
4071
5279
|
/**
|
|
4072
|
-
*
|
|
4073
|
-
*
|
|
4074
|
-
* This module provides solid fill support for outlines and shapes,
|
|
4075
|
-
* supporting both RGB and scheme-based colors.
|
|
5280
|
+
* Pen alignment options for outline positioning.
|
|
4076
5281
|
*
|
|
4077
|
-
*
|
|
5282
|
+
* Defines how the outline is aligned relative to the shape edge.
|
|
4078
5283
|
*/
|
|
5284
|
+
const PenAlignment = {
|
|
5285
|
+
CENTER: "ctr",
|
|
5286
|
+
INSET: "in"
|
|
5287
|
+
};
|
|
4079
5288
|
/**
|
|
4080
|
-
*
|
|
4081
|
-
*
|
|
4082
|
-
* Specifies a solid color fill using either RGB or scheme colors.
|
|
5289
|
+
* Preset dash styles for outlines.
|
|
4083
5290
|
*
|
|
4084
5291
|
* ## XSD Schema
|
|
4085
5292
|
* ```xml
|
|
4086
|
-
* <xsd:
|
|
4087
|
-
* <xsd:
|
|
4088
|
-
* <xsd:
|
|
4089
|
-
* <xsd:
|
|
4090
|
-
*
|
|
4091
|
-
*
|
|
4092
|
-
*
|
|
4093
|
-
*
|
|
4094
|
-
*
|
|
4095
|
-
*
|
|
4096
|
-
*
|
|
4097
|
-
*
|
|
4098
|
-
*
|
|
4099
|
-
*
|
|
4100
|
-
*
|
|
4101
|
-
*
|
|
4102
|
-
* // Scheme solid fill
|
|
4103
|
-
* const schemeFill = createSolidFill({
|
|
4104
|
-
* type: "scheme",
|
|
4105
|
-
* value: SchemeColor.ACCENT1
|
|
4106
|
-
* });
|
|
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>
|
|
4107
5308
|
* ```
|
|
4108
5309
|
*/
|
|
4109
|
-
const
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
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
|
+
};
|
|
4115
5323
|
/**
|
|
4116
|
-
*
|
|
4117
|
-
*
|
|
4118
|
-
* This module provides support for configuring outline properties including
|
|
4119
|
-
* width, cap style, compound line types, and fill properties.
|
|
4120
|
-
*
|
|
4121
|
-
* Reference: http://officeopenxml.com/drwSp-outline.php
|
|
4122
|
-
*
|
|
4123
|
-
* @module
|
|
5324
|
+
* Line join styles.
|
|
4124
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
|
+
};
|
|
4125
5338
|
/**
|
|
4126
5339
|
* Creates an outline element for DrawingML shapes.
|
|
4127
5340
|
*
|
|
4128
5341
|
* The outline element specifies the line properties for the shape border,
|
|
4129
|
-
* including width, cap style, compound line type, alignment, and fill.
|
|
4130
|
-
*
|
|
4131
|
-
* Reference: http://officeopenxml.com/drwSp-outline.php
|
|
5342
|
+
* including width, cap style, compound line type, alignment, dash, join, and fill.
|
|
4132
5343
|
*
|
|
4133
5344
|
* ## XSD Schema
|
|
4134
5345
|
* ```xml
|
|
@@ -4147,44 +5358,56 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
4147
5358
|
*
|
|
4148
5359
|
* @example
|
|
4149
5360
|
* ```typescript
|
|
4150
|
-
* //
|
|
5361
|
+
* // Outline with RGB color and dash
|
|
4151
5362
|
* const outline = createOutline({
|
|
4152
5363
|
* width: 9525,
|
|
4153
|
-
* cap: "ROUND",
|
|
4154
5364
|
* type: "solidFill",
|
|
4155
|
-
*
|
|
4156
|
-
*
|
|
5365
|
+
* color: { value: "FF0000" },
|
|
5366
|
+
* dash: "DASH",
|
|
4157
5367
|
* });
|
|
4158
5368
|
* ```
|
|
4159
5369
|
*/
|
|
4160
|
-
const createOutline = (options) =>
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
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
|
+
}
|
|
4173
5406
|
},
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
},
|
|
4179
|
-
children: [options.type === "noFill" ? createNoFill() : options.solidFillType === "rgb" ? createSolidFill({
|
|
4180
|
-
type: "rgb",
|
|
4181
|
-
value: options.value
|
|
4182
|
-
}) : createSolidFill({
|
|
4183
|
-
type: "scheme",
|
|
4184
|
-
value: options.value
|
|
4185
|
-
})],
|
|
4186
|
-
name: "a:ln"
|
|
4187
|
-
});
|
|
5407
|
+
children,
|
|
5408
|
+
name: "a:ln"
|
|
5409
|
+
});
|
|
5410
|
+
};
|
|
4188
5411
|
//#endregion
|
|
4189
5412
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/preset-geometry/adjustment-values/adjustment-values.ts
|
|
4190
5413
|
/**
|
|
@@ -4322,15 +5545,181 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
4322
5545
|
}
|
|
4323
5546
|
};
|
|
4324
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
|
|
4325
5716
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/shape-properties.ts
|
|
4326
5717
|
/**
|
|
4327
5718
|
* Represents shape properties for a DrawingML picture.
|
|
4328
5719
|
*
|
|
4329
5720
|
* This element defines the visual formatting of a picture, including
|
|
4330
5721
|
* its transform (size, position, rotation, flip), geometry preset,
|
|
4331
|
-
*
|
|
4332
|
-
*
|
|
4333
|
-
* Reference: http://officeopenxml.com/drwSp-SpPr.php
|
|
5722
|
+
* fill, outline, effects, and 3D properties.
|
|
4334
5723
|
*
|
|
4335
5724
|
* ## XSD Schema
|
|
4336
5725
|
* ```xml
|
|
@@ -4352,33 +5741,29 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
4352
5741
|
* @example
|
|
4353
5742
|
* ```typescript
|
|
4354
5743
|
* const shapeProps = new ShapeProperties({
|
|
4355
|
-
*
|
|
4356
|
-
*
|
|
4357
|
-
*
|
|
4358
|
-
*
|
|
5744
|
+
* element: "pic",
|
|
5745
|
+
* transform: { emus: { x: 914400, y: 914400 } },
|
|
5746
|
+
* effects: {
|
|
5747
|
+
* glow: { rad: 50800, color: { value: "FF0000" } },
|
|
4359
5748
|
* },
|
|
4360
|
-
* outline: {
|
|
4361
|
-
* width: 9525,
|
|
4362
|
-
* type: "solidFill",
|
|
4363
|
-
* solidFillType: "rgb",
|
|
4364
|
-
* value: "FF0000"
|
|
4365
|
-
* }
|
|
4366
5749
|
* });
|
|
4367
5750
|
* ```
|
|
4368
5751
|
*/
|
|
4369
5752
|
var ShapeProperties = class extends XmlComponent {
|
|
4370
|
-
constructor({ element, outline, solidFill, transform }) {
|
|
5753
|
+
constructor({ element, effects, gradientFill, noFill, outline, shape3d, solidFill, transform }) {
|
|
4371
5754
|
super(`${element}:spPr`);
|
|
4372
5755
|
_defineProperty(this, "form", void 0);
|
|
4373
5756
|
this.root.push(new ShapePropertiesAttributes({ bwMode: "auto" }));
|
|
4374
5757
|
this.form = new Form(transform);
|
|
4375
5758
|
this.root.push(this.form);
|
|
4376
5759
|
this.root.push(new PresetGeometry());
|
|
4377
|
-
if (
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
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));
|
|
4382
5767
|
}
|
|
4383
5768
|
};
|
|
4384
5769
|
//#endregion
|
|
@@ -4614,17 +5999,17 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
4614
5999
|
*
|
|
4615
6000
|
* This module defines the portion of an image to use when filling a shape.
|
|
4616
6001
|
*
|
|
4617
|
-
* Reference:
|
|
6002
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
|
|
4618
6003
|
*
|
|
4619
6004
|
* @module
|
|
4620
6005
|
*/
|
|
4621
6006
|
/**
|
|
4622
|
-
*
|
|
6007
|
+
* Creates a source rectangle element for blip fill cropping.
|
|
4623
6008
|
*
|
|
4624
6009
|
* This element specifies a portion of the blip (image) to use as the fill.
|
|
4625
|
-
* When
|
|
6010
|
+
* When no options are provided, the entire blip is used.
|
|
4626
6011
|
*
|
|
4627
|
-
* Reference:
|
|
6012
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
|
|
4628
6013
|
*
|
|
4629
6014
|
* ## XSD Schema
|
|
4630
6015
|
* ```xml
|
|
@@ -4638,13 +6023,33 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
4638
6023
|
*
|
|
4639
6024
|
* @example
|
|
4640
6025
|
* ```typescript
|
|
4641
|
-
*
|
|
6026
|
+
* // Crop 10% from left and right
|
|
6027
|
+
* createSourceRectangle({ l: 10000, r: 10000 });
|
|
4642
6028
|
* ```
|
|
4643
6029
|
*/
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
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
|
+
});
|
|
4648
6053
|
};
|
|
4649
6054
|
//#endregion
|
|
4650
6055
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/blip/stretch.ts
|
|
@@ -4715,9 +6120,9 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
4715
6120
|
* Represents a blip fill for pictures in DrawingML.
|
|
4716
6121
|
*
|
|
4717
6122
|
* This element specifies the type of fill used for a picture. It contains the blip (image)
|
|
4718
|
-
* 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).
|
|
4719
6124
|
*
|
|
4720
|
-
* Reference:
|
|
6125
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties
|
|
4721
6126
|
*
|
|
4722
6127
|
* ## XSD Schema
|
|
4723
6128
|
* ```xml
|
|
@@ -4735,13 +6140,14 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
4735
6140
|
* @example
|
|
4736
6141
|
* ```typescript
|
|
4737
6142
|
* const blipFill = new BlipFill(mediaData);
|
|
6143
|
+
* // If mediaData.srcRect is set, cropping is applied
|
|
4738
6144
|
* ```
|
|
4739
6145
|
*/
|
|
4740
6146
|
var BlipFill = class extends XmlComponent {
|
|
4741
6147
|
constructor(mediaData) {
|
|
4742
6148
|
super("pic:blipFill");
|
|
4743
6149
|
this.root.push(createBlip(mediaData));
|
|
4744
|
-
this.root.push(
|
|
6150
|
+
this.root.push(createSourceRectangle(mediaData.srcRect));
|
|
4745
6151
|
this.root.push(new Stretch());
|
|
4746
6152
|
}
|
|
4747
6153
|
};
|
|
@@ -5112,15 +6518,90 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
5112
6518
|
};
|
|
5113
6519
|
//#endregion
|
|
5114
6520
|
//#region src/file/drawing/inline/graphic/graphic-data/wpg/wpg-group.ts
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
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
|
+
};
|
|
5119
6600
|
const createNonVisualGroupProperties = () => new BuilderElement({ name: "wpg:cNvGrpSpPr" });
|
|
5120
6601
|
const createWpgGroup = (options) => new BuilderElement({
|
|
5121
6602
|
children: [
|
|
5122
6603
|
createNonVisualGroupProperties(),
|
|
5123
|
-
createGroupProperties(options
|
|
6604
|
+
createGroupProperties(options),
|
|
5124
6605
|
...options.children
|
|
5125
6606
|
],
|
|
5126
6607
|
name: "wpg:wgp"
|
|
@@ -5169,8 +6650,9 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
5169
6650
|
this.root.push(wps);
|
|
5170
6651
|
} else if (mediaData.type === "wpg") {
|
|
5171
6652
|
this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" }));
|
|
6653
|
+
const md = mediaData;
|
|
5172
6654
|
const wpg = createWpgGroup({
|
|
5173
|
-
children:
|
|
6655
|
+
children: md.children.map((child) => {
|
|
5174
6656
|
if (child.type === "wps") return createWpsShape({
|
|
5175
6657
|
...child.data,
|
|
5176
6658
|
outline: child.outline,
|
|
@@ -5183,7 +6665,11 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
5183
6665
|
transform: child.transformation
|
|
5184
6666
|
});
|
|
5185
6667
|
}),
|
|
5186
|
-
transformation: transform
|
|
6668
|
+
transformation: transform,
|
|
6669
|
+
chOff: md.chOff,
|
|
6670
|
+
chExt: md.chExt,
|
|
6671
|
+
solidFill: md.solidFill,
|
|
6672
|
+
effects: md.effects
|
|
5187
6673
|
});
|
|
5188
6674
|
this.root.push(wpg);
|
|
5189
6675
|
} else {
|
|
@@ -5953,9 +7439,10 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
5953
7439
|
};
|
|
5954
7440
|
//#endregion
|
|
5955
7441
|
//#region src/file/paragraph/run/image-run.ts
|
|
5956
|
-
const createImageData = (data, transformation, key) => ({
|
|
7442
|
+
const createImageData = (data, transformation, key, srcRect) => ({
|
|
5957
7443
|
data,
|
|
5958
7444
|
fileName: key,
|
|
7445
|
+
srcRect,
|
|
5959
7446
|
transformation: {
|
|
5960
7447
|
emus: {
|
|
5961
7448
|
x: Math.round(transformation.width * 9525),
|
|
@@ -6001,7 +7488,7 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
6001
7488
|
const fallbackData = (0, undio.toUint8Array)(options.fallback.data);
|
|
6002
7489
|
this.imageData = {
|
|
6003
7490
|
type: options.type,
|
|
6004
|
-
...createImageData(rawData, options.transformation, key),
|
|
7491
|
+
...createImageData(rawData, options.transformation, key, options.srcRect),
|
|
6005
7492
|
fallback: {
|
|
6006
7493
|
type: options.fallback.type,
|
|
6007
7494
|
...createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)
|
|
@@ -6009,7 +7496,7 @@ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate,
|
|
|
6009
7496
|
};
|
|
6010
7497
|
} else this.imageData = {
|
|
6011
7498
|
type: options.type,
|
|
6012
|
-
...createImageData(rawData, options.transformation, key)
|
|
7499
|
+
...createImageData(rawData, options.transformation, key, options.srcRect)
|
|
6013
7500
|
};
|
|
6014
7501
|
const drawing = new Drawing(this.imageData, {
|
|
6015
7502
|
docProperties: options.altText,
|