docx-plus 0.0.6 → 0.0.8
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 +1674 -183
- package/dist/index.d.cts +493 -39
- package/dist/index.d.mts +493 -39
- package/dist/index.iife.js +1674 -183
- package/dist/index.mjs +1674 -183
- package/dist/index.umd.js +1674 -183
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3761,6 +3761,1257 @@ const createVerticalPosition = ({ relative, align, offset }) => new BuilderEleme
|
|
|
3761
3761
|
name: "wp:positionV"
|
|
3762
3762
|
});
|
|
3763
3763
|
//#endregion
|
|
3764
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/color-transform.ts
|
|
3765
|
+
/**
|
|
3766
|
+
* Color transform elements for DrawingML colors.
|
|
3767
|
+
*
|
|
3768
|
+
* This module provides color transformation elements defined in EG_ColorTransform,
|
|
3769
|
+
* which can be applied as child elements to any color type (srgbClr, schemeClr, etc.).
|
|
3770
|
+
*
|
|
3771
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, EG_ColorTransform
|
|
3772
|
+
*
|
|
3773
|
+
* @module
|
|
3774
|
+
*/
|
|
3775
|
+
/**
|
|
3776
|
+
* Creates color transform child elements.
|
|
3777
|
+
*
|
|
3778
|
+
* These elements modify the parent color according to OOXML color transform rules.
|
|
3779
|
+
* Multiple transforms can be applied in sequence.
|
|
3780
|
+
*
|
|
3781
|
+
* @example
|
|
3782
|
+
* ```typescript
|
|
3783
|
+
* // Lighten accent1 by 40%
|
|
3784
|
+
* createColorTransforms({ tint: 40000 });
|
|
3785
|
+
* // Semi-transparent red with 50% alpha
|
|
3786
|
+
* createColorTransforms({ alpha: 50000 });
|
|
3787
|
+
* ```
|
|
3788
|
+
*/
|
|
3789
|
+
const createColorTransforms = (options) => {
|
|
3790
|
+
const transforms = [];
|
|
3791
|
+
if (options.tint !== void 0) transforms.push(new BuilderElement({
|
|
3792
|
+
attributes: { val: {
|
|
3793
|
+
key: "val",
|
|
3794
|
+
value: options.tint
|
|
3795
|
+
} },
|
|
3796
|
+
name: "a:tint"
|
|
3797
|
+
}));
|
|
3798
|
+
if (options.shade !== void 0) transforms.push(new BuilderElement({
|
|
3799
|
+
attributes: { val: {
|
|
3800
|
+
key: "val",
|
|
3801
|
+
value: options.shade
|
|
3802
|
+
} },
|
|
3803
|
+
name: "a:shade"
|
|
3804
|
+
}));
|
|
3805
|
+
if (options.comp) transforms.push(new BuilderElement({ name: "a:comp" }));
|
|
3806
|
+
if (options.inv) transforms.push(new BuilderElement({ name: "a:inv" }));
|
|
3807
|
+
if (options.gray) transforms.push(new BuilderElement({ name: "a:gray" }));
|
|
3808
|
+
if (options.alpha !== void 0) transforms.push(new BuilderElement({
|
|
3809
|
+
attributes: { val: {
|
|
3810
|
+
key: "val",
|
|
3811
|
+
value: options.alpha
|
|
3812
|
+
} },
|
|
3813
|
+
name: "a:alpha"
|
|
3814
|
+
}));
|
|
3815
|
+
if (options.alphaOff !== void 0) transforms.push(new BuilderElement({
|
|
3816
|
+
attributes: { val: {
|
|
3817
|
+
key: "val",
|
|
3818
|
+
value: options.alphaOff
|
|
3819
|
+
} },
|
|
3820
|
+
name: "a:alphaOff"
|
|
3821
|
+
}));
|
|
3822
|
+
if (options.alphaMod !== void 0) transforms.push(new BuilderElement({
|
|
3823
|
+
attributes: { val: {
|
|
3824
|
+
key: "val",
|
|
3825
|
+
value: options.alphaMod
|
|
3826
|
+
} },
|
|
3827
|
+
name: "a:alphaMod"
|
|
3828
|
+
}));
|
|
3829
|
+
if (options.hue !== void 0) transforms.push(new BuilderElement({
|
|
3830
|
+
attributes: { val: {
|
|
3831
|
+
key: "val",
|
|
3832
|
+
value: options.hue
|
|
3833
|
+
} },
|
|
3834
|
+
name: "a:hue"
|
|
3835
|
+
}));
|
|
3836
|
+
if (options.hueOff !== void 0) transforms.push(new BuilderElement({
|
|
3837
|
+
attributes: { val: {
|
|
3838
|
+
key: "val",
|
|
3839
|
+
value: options.hueOff
|
|
3840
|
+
} },
|
|
3841
|
+
name: "a:hueOff"
|
|
3842
|
+
}));
|
|
3843
|
+
if (options.hueMod !== void 0) transforms.push(new BuilderElement({
|
|
3844
|
+
attributes: { val: {
|
|
3845
|
+
key: "val",
|
|
3846
|
+
value: options.hueMod
|
|
3847
|
+
} },
|
|
3848
|
+
name: "a:hueMod"
|
|
3849
|
+
}));
|
|
3850
|
+
if (options.sat !== void 0) transforms.push(new BuilderElement({
|
|
3851
|
+
attributes: { val: {
|
|
3852
|
+
key: "val",
|
|
3853
|
+
value: options.sat
|
|
3854
|
+
} },
|
|
3855
|
+
name: "a:sat"
|
|
3856
|
+
}));
|
|
3857
|
+
if (options.satOff !== void 0) transforms.push(new BuilderElement({
|
|
3858
|
+
attributes: { val: {
|
|
3859
|
+
key: "val",
|
|
3860
|
+
value: options.satOff
|
|
3861
|
+
} },
|
|
3862
|
+
name: "a:satOff"
|
|
3863
|
+
}));
|
|
3864
|
+
if (options.satMod !== void 0) transforms.push(new BuilderElement({
|
|
3865
|
+
attributes: { val: {
|
|
3866
|
+
key: "val",
|
|
3867
|
+
value: options.satMod
|
|
3868
|
+
} },
|
|
3869
|
+
name: "a:satMod"
|
|
3870
|
+
}));
|
|
3871
|
+
if (options.lum !== void 0) transforms.push(new BuilderElement({
|
|
3872
|
+
attributes: { val: {
|
|
3873
|
+
key: "val",
|
|
3874
|
+
value: options.lum
|
|
3875
|
+
} },
|
|
3876
|
+
name: "a:lum"
|
|
3877
|
+
}));
|
|
3878
|
+
if (options.lumOff !== void 0) transforms.push(new BuilderElement({
|
|
3879
|
+
attributes: { val: {
|
|
3880
|
+
key: "val",
|
|
3881
|
+
value: options.lumOff
|
|
3882
|
+
} },
|
|
3883
|
+
name: "a:lumOff"
|
|
3884
|
+
}));
|
|
3885
|
+
if (options.lumMod !== void 0) transforms.push(new BuilderElement({
|
|
3886
|
+
attributes: { val: {
|
|
3887
|
+
key: "val",
|
|
3888
|
+
value: options.lumMod
|
|
3889
|
+
} },
|
|
3890
|
+
name: "a:lumMod"
|
|
3891
|
+
}));
|
|
3892
|
+
if (options.red !== void 0) transforms.push(new BuilderElement({
|
|
3893
|
+
attributes: { val: {
|
|
3894
|
+
key: "val",
|
|
3895
|
+
value: options.red
|
|
3896
|
+
} },
|
|
3897
|
+
name: "a:red"
|
|
3898
|
+
}));
|
|
3899
|
+
if (options.redOff !== void 0) transforms.push(new BuilderElement({
|
|
3900
|
+
attributes: { val: {
|
|
3901
|
+
key: "val",
|
|
3902
|
+
value: options.redOff
|
|
3903
|
+
} },
|
|
3904
|
+
name: "a:redOff"
|
|
3905
|
+
}));
|
|
3906
|
+
if (options.redMod !== void 0) transforms.push(new BuilderElement({
|
|
3907
|
+
attributes: { val: {
|
|
3908
|
+
key: "val",
|
|
3909
|
+
value: options.redMod
|
|
3910
|
+
} },
|
|
3911
|
+
name: "a:redMod"
|
|
3912
|
+
}));
|
|
3913
|
+
if (options.green !== void 0) transforms.push(new BuilderElement({
|
|
3914
|
+
attributes: { val: {
|
|
3915
|
+
key: "val",
|
|
3916
|
+
value: options.green
|
|
3917
|
+
} },
|
|
3918
|
+
name: "a:green"
|
|
3919
|
+
}));
|
|
3920
|
+
if (options.greenOff !== void 0) transforms.push(new BuilderElement({
|
|
3921
|
+
attributes: { val: {
|
|
3922
|
+
key: "val",
|
|
3923
|
+
value: options.greenOff
|
|
3924
|
+
} },
|
|
3925
|
+
name: "a:greenOff"
|
|
3926
|
+
}));
|
|
3927
|
+
if (options.greenMod !== void 0) transforms.push(new BuilderElement({
|
|
3928
|
+
attributes: { val: {
|
|
3929
|
+
key: "val",
|
|
3930
|
+
value: options.greenMod
|
|
3931
|
+
} },
|
|
3932
|
+
name: "a:greenMod"
|
|
3933
|
+
}));
|
|
3934
|
+
if (options.blue !== void 0) transforms.push(new BuilderElement({
|
|
3935
|
+
attributes: { val: {
|
|
3936
|
+
key: "val",
|
|
3937
|
+
value: options.blue
|
|
3938
|
+
} },
|
|
3939
|
+
name: "a:blue"
|
|
3940
|
+
}));
|
|
3941
|
+
if (options.blueOff !== void 0) transforms.push(new BuilderElement({
|
|
3942
|
+
attributes: { val: {
|
|
3943
|
+
key: "val",
|
|
3944
|
+
value: options.blueOff
|
|
3945
|
+
} },
|
|
3946
|
+
name: "a:blueOff"
|
|
3947
|
+
}));
|
|
3948
|
+
if (options.blueMod !== void 0) transforms.push(new BuilderElement({
|
|
3949
|
+
attributes: { val: {
|
|
3950
|
+
key: "val",
|
|
3951
|
+
value: options.blueMod
|
|
3952
|
+
} },
|
|
3953
|
+
name: "a:blueMod"
|
|
3954
|
+
}));
|
|
3955
|
+
if (options.gamma) transforms.push(new BuilderElement({ name: "a:gamma" }));
|
|
3956
|
+
if (options.invGamma) transforms.push(new BuilderElement({ name: "a:invGamma" }));
|
|
3957
|
+
return transforms;
|
|
3958
|
+
};
|
|
3959
|
+
//#endregion
|
|
3960
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/hsl-color.ts
|
|
3961
|
+
/**
|
|
3962
|
+
* HSL color element for DrawingML.
|
|
3963
|
+
*
|
|
3964
|
+
* This module provides HSL (Hue, Saturation, Luminance) color support.
|
|
3965
|
+
*
|
|
3966
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_HslColor
|
|
3967
|
+
*
|
|
3968
|
+
* @module
|
|
3969
|
+
*/
|
|
3970
|
+
/**
|
|
3971
|
+
* Creates an HSL color element.
|
|
3972
|
+
*
|
|
3973
|
+
* Specifies a color using Hue, Saturation, and Luminance values.
|
|
3974
|
+
*
|
|
3975
|
+
* ## XSD Schema
|
|
3976
|
+
* ```xml
|
|
3977
|
+
* <xsd:complexType name="CT_HslColor">
|
|
3978
|
+
* <xsd:sequence>
|
|
3979
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
3980
|
+
* </xsd:sequence>
|
|
3981
|
+
* <xsd:attribute name="hue" type="ST_PositiveFixedAngle" use="required"/>
|
|
3982
|
+
* <xsd:attribute name="sat" type="ST_Percentage" use="required"/>
|
|
3983
|
+
* <xsd:attribute name="lum" type="ST_Percentage" use="required"/>
|
|
3984
|
+
* </xsd:complexType>
|
|
3985
|
+
* ```
|
|
3986
|
+
*/
|
|
3987
|
+
const createHslColor = (options) => {
|
|
3988
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
3989
|
+
return new BuilderElement({
|
|
3990
|
+
attributes: {
|
|
3991
|
+
hue: {
|
|
3992
|
+
key: "hue",
|
|
3993
|
+
value: options.hue
|
|
3994
|
+
},
|
|
3995
|
+
lum: {
|
|
3996
|
+
key: "lum",
|
|
3997
|
+
value: options.lum
|
|
3998
|
+
},
|
|
3999
|
+
sat: {
|
|
4000
|
+
key: "sat",
|
|
4001
|
+
value: options.sat
|
|
4002
|
+
}
|
|
4003
|
+
},
|
|
4004
|
+
children: [...transforms],
|
|
4005
|
+
name: "a:hslClr"
|
|
4006
|
+
});
|
|
4007
|
+
};
|
|
4008
|
+
//#endregion
|
|
4009
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/preset-color.ts
|
|
4010
|
+
/**
|
|
4011
|
+
* Preset color element for DrawingML.
|
|
4012
|
+
*
|
|
4013
|
+
* This module provides named preset colors (CSS named colors).
|
|
4014
|
+
*
|
|
4015
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetColor / ST_PresetColorVal
|
|
4016
|
+
*
|
|
4017
|
+
* @module
|
|
4018
|
+
*/
|
|
4019
|
+
/**
|
|
4020
|
+
* Preset color values (CSS named colors).
|
|
4021
|
+
*
|
|
4022
|
+
* ## XSD Schema
|
|
4023
|
+
* ```xml
|
|
4024
|
+
* <xsd:simpleType name="ST_PresetColorVal">
|
|
4025
|
+
* <xsd:restriction base="xsd:token">
|
|
4026
|
+
* <xsd:enumeration value="aliceBlue"/>
|
|
4027
|
+
* ...
|
|
4028
|
+
* <xsd:enumeration value="yellowGreen"/>
|
|
4029
|
+
* </xsd:restriction>
|
|
4030
|
+
* </xsd:simpleType>
|
|
4031
|
+
* ```
|
|
4032
|
+
*/
|
|
4033
|
+
const PresetColor = {
|
|
4034
|
+
ALICE_BLUE: "aliceBlue",
|
|
4035
|
+
ANTIQUE_WHITE: "antiqueWhite",
|
|
4036
|
+
AQUA: "aqua",
|
|
4037
|
+
AQUAMARINE: "aquamarine",
|
|
4038
|
+
AZURE: "azure",
|
|
4039
|
+
BEIGE: "beige",
|
|
4040
|
+
BISQUE: "bisque",
|
|
4041
|
+
BLACK: "black",
|
|
4042
|
+
BLANCHED_ALMOND: "blanchedAlmond",
|
|
4043
|
+
BLUE: "blue",
|
|
4044
|
+
BLUE_VIOLET: "blueViolet",
|
|
4045
|
+
BROWN: "brown",
|
|
4046
|
+
BURLY_WOOD: "burlyWood",
|
|
4047
|
+
CADET_BLUE: "cadetBlue",
|
|
4048
|
+
CHARTREUSE: "chartreuse",
|
|
4049
|
+
CHOCOLATE: "chocolate",
|
|
4050
|
+
CORAL: "coral",
|
|
4051
|
+
CORNFLOWER_BLUE: "cornflowerBlue",
|
|
4052
|
+
CORNSILK: "cornsilk",
|
|
4053
|
+
CRIMSON: "crimson",
|
|
4054
|
+
CYAN: "cyan",
|
|
4055
|
+
DARK_BLUE: "darkBlue",
|
|
4056
|
+
DARK_CYAN: "darkCyan",
|
|
4057
|
+
DARK_GOLDENROD: "darkGoldenrod",
|
|
4058
|
+
DARK_GRAY: "darkGray",
|
|
4059
|
+
DARK_GREY: "darkGrey",
|
|
4060
|
+
DARK_GREEN: "darkGreen",
|
|
4061
|
+
DARK_KHAKI: "darkKhaki",
|
|
4062
|
+
DARK_MAGENTA: "darkMagenta",
|
|
4063
|
+
DARK_OLIVE_GREEN: "darkOliveGreen",
|
|
4064
|
+
DARK_ORANGE: "darkOrange",
|
|
4065
|
+
DARK_ORCHID: "darkOrchid",
|
|
4066
|
+
DARK_RED: "darkRed",
|
|
4067
|
+
DARK_SALMON: "darkSalmon",
|
|
4068
|
+
DARK_SEA_GREEN: "darkSeaGreen",
|
|
4069
|
+
DARK_SLATE_BLUE: "darkSlateBlue",
|
|
4070
|
+
DARK_SLATE_GRAY: "darkSlateGray",
|
|
4071
|
+
DARK_SLATE_GREY: "darkSlateGrey",
|
|
4072
|
+
DARK_TURQUOISE: "darkTurquoise",
|
|
4073
|
+
DARK_VIOLET: "darkViolet",
|
|
4074
|
+
DEEP_PINK: "deepPink",
|
|
4075
|
+
DEEP_SKY_BLUE: "deepSkyBlue",
|
|
4076
|
+
DIM_GRAY: "dimGray",
|
|
4077
|
+
DIM_GREY: "dimGrey",
|
|
4078
|
+
DODGER_BLUE: "dodgerBlue",
|
|
4079
|
+
FIREBRICK: "firebrick",
|
|
4080
|
+
FLORAL_WHITE: "floralWhite",
|
|
4081
|
+
FOREST_GREEN: "forestGreen",
|
|
4082
|
+
FUCHSIA: "fuchsia",
|
|
4083
|
+
GAINSBORO: "gainsboro",
|
|
4084
|
+
GHOST_WHITE: "ghostWhite",
|
|
4085
|
+
GOLD: "gold",
|
|
4086
|
+
GOLDENROD: "goldenrod",
|
|
4087
|
+
GRAY: "gray",
|
|
4088
|
+
GREY: "grey",
|
|
4089
|
+
GREEN: "green",
|
|
4090
|
+
GREEN_YELLOW: "greenYellow",
|
|
4091
|
+
HONEYDEW: "honeydew",
|
|
4092
|
+
HOT_PINK: "hotPink",
|
|
4093
|
+
INDIAN_RED: "indianRed",
|
|
4094
|
+
INDIGO: "indigo",
|
|
4095
|
+
IVORY: "ivory",
|
|
4096
|
+
KHAKI: "khaki",
|
|
4097
|
+
LAVENDER: "lavender",
|
|
4098
|
+
LAVENDER_BLUSH: "lavenderBlush",
|
|
4099
|
+
LAWN_GREEN: "lawnGreen",
|
|
4100
|
+
LEMON_CHIFFON: "lemonChiffon",
|
|
4101
|
+
LIGHT_BLUE: "lightBlue",
|
|
4102
|
+
LIGHT_CORAL: "lightCoral",
|
|
4103
|
+
LIGHT_CYAN: "lightCyan",
|
|
4104
|
+
LIGHT_GOLDENROD_YELLOW: "lightGoldenrodYellow",
|
|
4105
|
+
LIGHT_GRAY: "lightGray",
|
|
4106
|
+
LIGHT_GREY: "lightGrey",
|
|
4107
|
+
LIGHT_GREEN: "lightGreen",
|
|
4108
|
+
LIGHT_PINK: "lightPink",
|
|
4109
|
+
LIGHT_SALMON: "lightSalmon",
|
|
4110
|
+
LIGHT_SEA_GREEN: "lightSeaGreen",
|
|
4111
|
+
LIGHT_SKY_BLUE: "lightSkyBlue",
|
|
4112
|
+
LIGHT_SLATE_GRAY: "lightSlateGray",
|
|
4113
|
+
LIGHT_SLATE_GREY: "lightSlateGrey",
|
|
4114
|
+
LIGHT_STEEL_BLUE: "lightSteelBlue",
|
|
4115
|
+
LIGHT_YELLOW: "lightYellow",
|
|
4116
|
+
LIME: "lime",
|
|
4117
|
+
LIME_GREEN: "limeGreen",
|
|
4118
|
+
LINEN: "linen",
|
|
4119
|
+
MAGENTA: "magenta",
|
|
4120
|
+
MAROON: "maroon",
|
|
4121
|
+
MEDIUM_AQUAMARINE: "mediumAquamarine",
|
|
4122
|
+
MEDIUM_BLUE: "mediumBlue",
|
|
4123
|
+
MEDIUM_ORCHID: "mediumOrchid",
|
|
4124
|
+
MEDIUM_PURPLE: "mediumPurple",
|
|
4125
|
+
MEDIUM_SEA_GREEN: "mediumSeaGreen",
|
|
4126
|
+
MEDIUM_SLATE_BLUE: "mediumSlateBlue",
|
|
4127
|
+
MEDIUM_SPRING_GREEN: "mediumSpringGreen",
|
|
4128
|
+
MEDIUM_TURQUOISE: "mediumTurquoise",
|
|
4129
|
+
MEDIUM_VIOLET_RED: "mediumVioletRed",
|
|
4130
|
+
MIDNIGHT_BLUE: "midnightBlue",
|
|
4131
|
+
MINT_CREAM: "mintCream",
|
|
4132
|
+
MISTY_ROSE: "mistyRose",
|
|
4133
|
+
MOCCASIN: "moccasin",
|
|
4134
|
+
NAVAJO_WHITE: "navajoWhite",
|
|
4135
|
+
NAVY: "navy",
|
|
4136
|
+
OLD_LACE: "oldLace",
|
|
4137
|
+
OLIVE: "olive",
|
|
4138
|
+
OLIVE_DRAB: "oliveDrab",
|
|
4139
|
+
ORANGE: "orange",
|
|
4140
|
+
ORANGE_RED: "orangeRed",
|
|
4141
|
+
ORCHID: "orchid",
|
|
4142
|
+
PALE_GOLDENROD: "paleGoldenrod",
|
|
4143
|
+
PALE_GREEN: "paleGreen",
|
|
4144
|
+
PALE_TURQUOISE: "paleTurquoise",
|
|
4145
|
+
PALE_VIOLET_RED: "paleVioletRed",
|
|
4146
|
+
PAPAYA_WHIP: "papayaWhip",
|
|
4147
|
+
PEACH_PUFF: "peachPuff",
|
|
4148
|
+
PERU: "peru",
|
|
4149
|
+
PINK: "pink",
|
|
4150
|
+
PLUM: "plum",
|
|
4151
|
+
POWDER_BLUE: "powderBlue",
|
|
4152
|
+
PURPLE: "purple",
|
|
4153
|
+
RED: "red",
|
|
4154
|
+
ROSY_BROWN: "rosyBrown",
|
|
4155
|
+
ROYAL_BLUE: "royalBlue",
|
|
4156
|
+
SADDLE_BROWN: "saddleBrown",
|
|
4157
|
+
SALMON: "salmon",
|
|
4158
|
+
SANDY_BROWN: "sandyBrown",
|
|
4159
|
+
SEA_GREEN: "seaGreen",
|
|
4160
|
+
SEA_SHELL: "seaShell",
|
|
4161
|
+
SIENNA: "sienna",
|
|
4162
|
+
SILVER: "silver",
|
|
4163
|
+
SKY_BLUE: "skyBlue",
|
|
4164
|
+
SLATE_BLUE: "slateBlue",
|
|
4165
|
+
SLATE_GRAY: "slateGray",
|
|
4166
|
+
SLATE_GREY: "slateGrey",
|
|
4167
|
+
SNOW: "snow",
|
|
4168
|
+
SPRING_GREEN: "springGreen",
|
|
4169
|
+
STEEL_BLUE: "steelBlue",
|
|
4170
|
+
TAN: "tan",
|
|
4171
|
+
TEAL: "teal",
|
|
4172
|
+
THISTLE: "thistle",
|
|
4173
|
+
TOMATO: "tomato",
|
|
4174
|
+
TURQUOISE: "turquoise",
|
|
4175
|
+
VIOLET: "violet",
|
|
4176
|
+
WHEAT: "wheat",
|
|
4177
|
+
WHITE: "white",
|
|
4178
|
+
WHITE_SMOKE: "whiteSmoke",
|
|
4179
|
+
YELLOW: "yellow",
|
|
4180
|
+
YELLOW_GREEN: "yellowGreen"
|
|
4181
|
+
};
|
|
4182
|
+
/**
|
|
4183
|
+
* Creates a preset color element.
|
|
4184
|
+
*
|
|
4185
|
+
* Specifies a color using a named preset (CSS named color).
|
|
4186
|
+
*
|
|
4187
|
+
* ## XSD Schema
|
|
4188
|
+
* ```xml
|
|
4189
|
+
* <xsd:complexType name="CT_PresetColor">
|
|
4190
|
+
* <xsd:sequence>
|
|
4191
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4192
|
+
* </xsd:sequence>
|
|
4193
|
+
* <xsd:attribute name="val" type="ST_PresetColorVal" use="required"/>
|
|
4194
|
+
* </xsd:complexType>
|
|
4195
|
+
* ```
|
|
4196
|
+
*/
|
|
4197
|
+
const createPresetColor = (options) => {
|
|
4198
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4199
|
+
return new BuilderElement({
|
|
4200
|
+
attributes: { value: {
|
|
4201
|
+
key: "val",
|
|
4202
|
+
value: options.value
|
|
4203
|
+
} },
|
|
4204
|
+
children: [...transforms],
|
|
4205
|
+
name: "a:prstClr"
|
|
4206
|
+
});
|
|
4207
|
+
};
|
|
4208
|
+
//#endregion
|
|
4209
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/rgb-color.ts
|
|
4210
|
+
/**
|
|
4211
|
+
* RGB color element for DrawingML shapes.
|
|
4212
|
+
*
|
|
4213
|
+
* This module provides RGB color support for solid fills.
|
|
4214
|
+
*
|
|
4215
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SRgbColor
|
|
4216
|
+
*
|
|
4217
|
+
* @module
|
|
4218
|
+
*/
|
|
4219
|
+
/**
|
|
4220
|
+
* Creates an sRGB color element.
|
|
4221
|
+
*
|
|
4222
|
+
* Specifies a color using RGB hex values.
|
|
4223
|
+
*
|
|
4224
|
+
* ## XSD Schema
|
|
4225
|
+
* ```xml
|
|
4226
|
+
* <xsd:complexType name="CT_SRgbColor">
|
|
4227
|
+
* <xsd:sequence>
|
|
4228
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4229
|
+
* </xsd:sequence>
|
|
4230
|
+
* <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
|
|
4231
|
+
* </xsd:complexType>
|
|
4232
|
+
* ```
|
|
4233
|
+
*
|
|
4234
|
+
* @example
|
|
4235
|
+
* ```typescript
|
|
4236
|
+
* const redColor = createRgbColor({ value: "FF0000" });
|
|
4237
|
+
* // With alpha transform
|
|
4238
|
+
* const semiRed = createRgbColor({ value: "FF0000", transforms: { alpha: 50000 } });
|
|
4239
|
+
* ```
|
|
4240
|
+
*/
|
|
4241
|
+
const createRgbColor = (options) => {
|
|
4242
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4243
|
+
return new BuilderElement({
|
|
4244
|
+
attributes: { value: {
|
|
4245
|
+
key: "val",
|
|
4246
|
+
value: options.value
|
|
4247
|
+
} },
|
|
4248
|
+
children: [...transforms],
|
|
4249
|
+
name: "a:srgbClr"
|
|
4250
|
+
});
|
|
4251
|
+
};
|
|
4252
|
+
//#endregion
|
|
4253
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/scheme-color.ts
|
|
4254
|
+
/**
|
|
4255
|
+
* Scheme color element for DrawingML shapes.
|
|
4256
|
+
*
|
|
4257
|
+
* This module provides scheme-based color support for solid fills,
|
|
4258
|
+
* allowing colors to be defined using theme color schemes.
|
|
4259
|
+
*
|
|
4260
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SchemeColor / ST_SchemeColorVal
|
|
4261
|
+
*
|
|
4262
|
+
* @module
|
|
4263
|
+
*/
|
|
4264
|
+
/**
|
|
4265
|
+
* Scheme color values for theme-based colors.
|
|
4266
|
+
*
|
|
4267
|
+
* These values reference colors defined in the document's color scheme/theme.
|
|
4268
|
+
*/
|
|
4269
|
+
const SchemeColor = {
|
|
4270
|
+
BG1: "bg1",
|
|
4271
|
+
TX1: "tx1",
|
|
4272
|
+
BG2: "bg2",
|
|
4273
|
+
TX2: "tx2",
|
|
4274
|
+
ACCENT1: "accent1",
|
|
4275
|
+
ACCENT2: "accent2",
|
|
4276
|
+
ACCENT3: "accent3",
|
|
4277
|
+
ACCENT4: "accent4",
|
|
4278
|
+
ACCENT5: "accent5",
|
|
4279
|
+
ACCENT6: "accent6",
|
|
4280
|
+
HLINK: "hlink",
|
|
4281
|
+
FOLHLINK: "folHlink",
|
|
4282
|
+
DK1: "dk1",
|
|
4283
|
+
LT1: "lt1",
|
|
4284
|
+
DK2: "dk2",
|
|
4285
|
+
LT2: "lt2",
|
|
4286
|
+
PHCLR: "phClr"
|
|
4287
|
+
};
|
|
4288
|
+
/**
|
|
4289
|
+
* Creates a scheme color element.
|
|
4290
|
+
*
|
|
4291
|
+
* Specifies a color using a theme color scheme reference.
|
|
4292
|
+
*
|
|
4293
|
+
* ## XSD Schema
|
|
4294
|
+
* ```xml
|
|
4295
|
+
* <xsd:complexType name="CT_SchemeColor">
|
|
4296
|
+
* <xsd:sequence>
|
|
4297
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4298
|
+
* </xsd:sequence>
|
|
4299
|
+
* <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
|
|
4300
|
+
* </xsd:complexType>
|
|
4301
|
+
* ```
|
|
4302
|
+
*
|
|
4303
|
+
* @example
|
|
4304
|
+
* ```typescript
|
|
4305
|
+
* const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });
|
|
4306
|
+
* // With tint transform
|
|
4307
|
+
* const lightAccent = createSchemeColor({
|
|
4308
|
+
* value: SchemeColor.ACCENT1,
|
|
4309
|
+
* transforms: { tint: 40000 },
|
|
4310
|
+
* });
|
|
4311
|
+
* ```
|
|
4312
|
+
*/
|
|
4313
|
+
const createSchemeColor = (options) => {
|
|
4314
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4315
|
+
return new BuilderElement({
|
|
4316
|
+
attributes: { value: {
|
|
4317
|
+
key: "val",
|
|
4318
|
+
value: options.value
|
|
4319
|
+
} },
|
|
4320
|
+
children: [...transforms],
|
|
4321
|
+
name: "a:schemeClr"
|
|
4322
|
+
});
|
|
4323
|
+
};
|
|
4324
|
+
//#endregion
|
|
4325
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/system-color.ts
|
|
4326
|
+
/**
|
|
4327
|
+
* System color element for DrawingML.
|
|
4328
|
+
*
|
|
4329
|
+
* This module provides system color support, referencing OS-level UI colors.
|
|
4330
|
+
*
|
|
4331
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SystemColor / ST_SystemColorVal
|
|
4332
|
+
*
|
|
4333
|
+
* @module
|
|
4334
|
+
*/
|
|
4335
|
+
/**
|
|
4336
|
+
* System color values referencing OS UI colors.
|
|
4337
|
+
*
|
|
4338
|
+
* ## XSD Schema
|
|
4339
|
+
* ```xml
|
|
4340
|
+
* <xsd:simpleType name="ST_SystemColorVal">
|
|
4341
|
+
* <xsd:restriction base="xsd:token">
|
|
4342
|
+
* <xsd:enumeration value="scrollBar"/>
|
|
4343
|
+
* <xsd:enumeration value="background"/>
|
|
4344
|
+
* ...
|
|
4345
|
+
* <xsd:enumeration value="menuBar"/>
|
|
4346
|
+
* </xsd:restriction>
|
|
4347
|
+
* </xsd:simpleType>
|
|
4348
|
+
* ```
|
|
4349
|
+
*/
|
|
4350
|
+
const SystemColor = {
|
|
4351
|
+
SCROLL_BAR: "scrollBar",
|
|
4352
|
+
BACKGROUND: "background",
|
|
4353
|
+
ACTIVE_CAPTION: "activeCaption",
|
|
4354
|
+
INACTIVE_CAPTION: "inactiveCaption",
|
|
4355
|
+
MENU: "menu",
|
|
4356
|
+
WINDOW: "window",
|
|
4357
|
+
WINDOW_FRAME: "windowFrame",
|
|
4358
|
+
MENU_TEXT: "menuText",
|
|
4359
|
+
WINDOW_TEXT: "windowText",
|
|
4360
|
+
CAPTION_TEXT: "captionText",
|
|
4361
|
+
ACTIVE_BORDER: "activeBorder",
|
|
4362
|
+
INACTIVE_BORDER: "inactiveBorder",
|
|
4363
|
+
APP_WORKSPACE: "appWorkspace",
|
|
4364
|
+
HIGHLIGHT: "highlight",
|
|
4365
|
+
HIGHLIGHT_TEXT: "highlightText",
|
|
4366
|
+
BTN_FACE: "btnFace",
|
|
4367
|
+
BTN_SHADOW: "btnShadow",
|
|
4368
|
+
GRAY_TEXT: "grayText",
|
|
4369
|
+
BTN_TEXT: "btnText",
|
|
4370
|
+
INACTIVE_CAPTION_TEXT: "inactiveCaptionText",
|
|
4371
|
+
BTN_HIGHLIGHT: "btnHighlight",
|
|
4372
|
+
THREE_D_DK_SHADOW: "3dDkShadow",
|
|
4373
|
+
THREE_D_LIGHT: "3dLight",
|
|
4374
|
+
INFO_TEXT: "infoText",
|
|
4375
|
+
INFO_BK: "infoBk",
|
|
4376
|
+
HOT_LIGHT: "hotLight",
|
|
4377
|
+
GRADIENT_ACTIVE_CAPTION: "gradientActiveCaption",
|
|
4378
|
+
GRADIENT_INACTIVE_CAPTION: "gradientInactiveCaption",
|
|
4379
|
+
MENU_HIGHLIGHT: "menuHighlight",
|
|
4380
|
+
MENU_BAR: "menuBar"
|
|
4381
|
+
};
|
|
4382
|
+
/**
|
|
4383
|
+
* Creates a system color element.
|
|
4384
|
+
*
|
|
4385
|
+
* References a system-defined UI color (e.g., window background, button face).
|
|
4386
|
+
*
|
|
4387
|
+
* ## XSD Schema
|
|
4388
|
+
* ```xml
|
|
4389
|
+
* <xsd:complexType name="CT_SystemColor">
|
|
4390
|
+
* <xsd:sequence>
|
|
4391
|
+
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4392
|
+
* </xsd:sequence>
|
|
4393
|
+
* <xsd:attribute name="val" type="ST_SystemColorVal" use="required"/>
|
|
4394
|
+
* <xsd:attribute name="lastClr" type="s:ST_HexColorRGB" use="optional"/>
|
|
4395
|
+
* </xsd:complexType>
|
|
4396
|
+
* ```
|
|
4397
|
+
*/
|
|
4398
|
+
const createSystemColor = (options) => {
|
|
4399
|
+
const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
|
|
4400
|
+
return new BuilderElement({
|
|
4401
|
+
attributes: {
|
|
4402
|
+
lastClr: {
|
|
4403
|
+
key: "lastClr",
|
|
4404
|
+
value: options.lastClr
|
|
4405
|
+
},
|
|
4406
|
+
value: {
|
|
4407
|
+
key: "val",
|
|
4408
|
+
value: options.value
|
|
4409
|
+
}
|
|
4410
|
+
},
|
|
4411
|
+
children: [...transforms],
|
|
4412
|
+
name: "a:sysClr"
|
|
4413
|
+
});
|
|
4414
|
+
};
|
|
4415
|
+
//#endregion
|
|
4416
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/solid-fill.ts
|
|
4417
|
+
/**
|
|
4418
|
+
* Solid fill element for DrawingML shapes.
|
|
4419
|
+
*
|
|
4420
|
+
* This module provides solid fill support for outlines and shapes,
|
|
4421
|
+
* supporting RGB, scheme, HSL, system, and preset colors.
|
|
4422
|
+
*
|
|
4423
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SolidColorFillProperties
|
|
4424
|
+
*
|
|
4425
|
+
* @module
|
|
4426
|
+
*/
|
|
4427
|
+
/**
|
|
4428
|
+
* Creates the color child element for a solid fill based on the color type.
|
|
4429
|
+
*/
|
|
4430
|
+
const SYSTEM_COLOR_VALUES = new Set(Object.values(SystemColor));
|
|
4431
|
+
const PRESET_COLOR_VALUES = new Set(Object.values(PresetColor));
|
|
4432
|
+
const SCHEME_COLOR_VALUES = new Set(Object.values(SchemeColor));
|
|
4433
|
+
const createColorElement = (color) => {
|
|
4434
|
+
if ("hue" in color && "sat" in color && "lum" in color) return createHslColor(color);
|
|
4435
|
+
const colorValue = color.value;
|
|
4436
|
+
if (SYSTEM_COLOR_VALUES.has(colorValue)) return createSystemColor(color);
|
|
4437
|
+
if (PRESET_COLOR_VALUES.has(colorValue)) return createPresetColor(color);
|
|
4438
|
+
if (SCHEME_COLOR_VALUES.has(colorValue)) return createSchemeColor(color);
|
|
4439
|
+
return createRgbColor(color);
|
|
4440
|
+
};
|
|
4441
|
+
/**
|
|
4442
|
+
* Creates a solid fill element.
|
|
4443
|
+
*
|
|
4444
|
+
* Specifies a solid color fill using any supported color type.
|
|
4445
|
+
*
|
|
4446
|
+
* ## XSD Schema
|
|
4447
|
+
* ```xml
|
|
4448
|
+
* <xsd:complexType name="CT_SolidColorFillProperties">
|
|
4449
|
+
* <xsd:sequence>
|
|
4450
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="0"/>
|
|
4451
|
+
* <xsd:group ref="EG_EffectProperties" minOccurs="0"/>
|
|
4452
|
+
* </xsd:sequence>
|
|
4453
|
+
* </xsd:complexType>
|
|
4454
|
+
* ```
|
|
4455
|
+
*
|
|
4456
|
+
* @example
|
|
4457
|
+
* ```typescript
|
|
4458
|
+
* // RGB solid fill
|
|
4459
|
+
* const fill = createSolidFill({ value: "FF0000" });
|
|
4460
|
+
* // Scheme solid fill with tint
|
|
4461
|
+
* const schemeFill = createSolidFill({
|
|
4462
|
+
* value: SchemeColor.ACCENT1, transforms: { tint: 40000 },
|
|
4463
|
+
* });
|
|
4464
|
+
* // HSL solid fill
|
|
4465
|
+
* const hslFill = createSolidFill({ hue: 120000, sat: 100000, lum: 50000 });
|
|
4466
|
+
* ```
|
|
4467
|
+
*/
|
|
4468
|
+
const createSolidFill = (options) => new BuilderElement({
|
|
4469
|
+
children: [createColorElement(options)],
|
|
4470
|
+
name: "a:solidFill"
|
|
4471
|
+
});
|
|
4472
|
+
//#endregion
|
|
4473
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/glow.ts
|
|
4474
|
+
/**
|
|
4475
|
+
* Glow effect for DrawingML shapes.
|
|
4476
|
+
*
|
|
4477
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GlowEffect
|
|
4478
|
+
*
|
|
4479
|
+
* @module
|
|
4480
|
+
*/
|
|
4481
|
+
/**
|
|
4482
|
+
* Creates a glow effect element.
|
|
4483
|
+
*
|
|
4484
|
+
* ## XSD Schema
|
|
4485
|
+
* ```xml
|
|
4486
|
+
* <xsd:complexType name="CT_GlowEffect">
|
|
4487
|
+
* <xsd:sequence>
|
|
4488
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4489
|
+
* </xsd:sequence>
|
|
4490
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="optional" default="0"/>
|
|
4491
|
+
* </xsd:complexType>
|
|
4492
|
+
* ```
|
|
4493
|
+
*/
|
|
4494
|
+
const createGlowEffect = (options) => {
|
|
4495
|
+
if (options.rad === void 0) return new BuilderElement({
|
|
4496
|
+
children: [createColorElement(options.color)],
|
|
4497
|
+
name: "a:glow"
|
|
4498
|
+
});
|
|
4499
|
+
return new BuilderElement({
|
|
4500
|
+
attributes: { rad: {
|
|
4501
|
+
key: "rad",
|
|
4502
|
+
value: options.rad
|
|
4503
|
+
} },
|
|
4504
|
+
children: [createColorElement(options.color)],
|
|
4505
|
+
name: "a:glow"
|
|
4506
|
+
});
|
|
4507
|
+
};
|
|
4508
|
+
//#endregion
|
|
4509
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/inner-shdw.ts
|
|
4510
|
+
/**
|
|
4511
|
+
* Inner shadow effect for DrawingML shapes.
|
|
4512
|
+
*
|
|
4513
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_InnerShadowEffect
|
|
4514
|
+
*
|
|
4515
|
+
* @module
|
|
4516
|
+
*/
|
|
4517
|
+
/**
|
|
4518
|
+
* Creates an inner shadow effect element.
|
|
4519
|
+
*
|
|
4520
|
+
* ## XSD Schema
|
|
4521
|
+
* ```xml
|
|
4522
|
+
* <xsd:complexType name="CT_InnerShadowEffect">
|
|
4523
|
+
* <xsd:sequence>
|
|
4524
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4525
|
+
* </xsd:sequence>
|
|
4526
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4527
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4528
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4529
|
+
* </xsd:complexType>
|
|
4530
|
+
* ```
|
|
4531
|
+
*/
|
|
4532
|
+
const createInnerShadowEffect = (options) => {
|
|
4533
|
+
if (!(options.blurRad !== void 0 || options.dist !== void 0 || options.dir !== void 0)) return new BuilderElement({
|
|
4534
|
+
children: [createColorElement(options.color)],
|
|
4535
|
+
name: "a:innerShdw"
|
|
4536
|
+
});
|
|
4537
|
+
return new BuilderElement({
|
|
4538
|
+
attributes: {
|
|
4539
|
+
...options.blurRad !== void 0 && { blurRad: {
|
|
4540
|
+
key: "blurRad",
|
|
4541
|
+
value: options.blurRad
|
|
4542
|
+
} },
|
|
4543
|
+
...options.dist !== void 0 && { dist: {
|
|
4544
|
+
key: "dist",
|
|
4545
|
+
value: options.dist
|
|
4546
|
+
} },
|
|
4547
|
+
...options.dir !== void 0 && { dir: {
|
|
4548
|
+
key: "dir",
|
|
4549
|
+
value: options.dir
|
|
4550
|
+
} }
|
|
4551
|
+
},
|
|
4552
|
+
children: [createColorElement(options.color)],
|
|
4553
|
+
name: "a:innerShdw"
|
|
4554
|
+
});
|
|
4555
|
+
};
|
|
4556
|
+
//#endregion
|
|
4557
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/outer-shdw.ts
|
|
4558
|
+
/**
|
|
4559
|
+
* Outer shadow effect for DrawingML shapes.
|
|
4560
|
+
*
|
|
4561
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_OuterShadowEffect
|
|
4562
|
+
*
|
|
4563
|
+
* @module
|
|
4564
|
+
*/
|
|
4565
|
+
/**
|
|
4566
|
+
* Rectangle alignment for shadow positioning.
|
|
4567
|
+
*/
|
|
4568
|
+
const RectAlignment = {
|
|
4569
|
+
TOP_LEFT: "tl",
|
|
4570
|
+
TOP: "t",
|
|
4571
|
+
TOP_RIGHT: "tr",
|
|
4572
|
+
LEFT: "l",
|
|
4573
|
+
CENTER: "ctr",
|
|
4574
|
+
RIGHT: "r",
|
|
4575
|
+
BOTTOM_LEFT: "bl",
|
|
4576
|
+
BOTTOM: "b",
|
|
4577
|
+
BOTTOM_RIGHT: "br"
|
|
4578
|
+
};
|
|
4579
|
+
/**
|
|
4580
|
+
* Creates an outer shadow effect element.
|
|
4581
|
+
*
|
|
4582
|
+
* ## XSD Schema
|
|
4583
|
+
* ```xml
|
|
4584
|
+
* <xsd:complexType name="CT_OuterShadowEffect">
|
|
4585
|
+
* <xsd:sequence>
|
|
4586
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4587
|
+
* </xsd:sequence>
|
|
4588
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4589
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4590
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4591
|
+
* <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
|
|
4592
|
+
* <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
|
|
4593
|
+
* <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
|
|
4594
|
+
* <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
|
|
4595
|
+
* <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
|
|
4596
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
|
|
4597
|
+
* </xsd:complexType>
|
|
4598
|
+
* ```
|
|
4599
|
+
*/
|
|
4600
|
+
const createOuterShadowEffect = (options) => {
|
|
4601
|
+
const attributes = {};
|
|
4602
|
+
if (options.blurRad !== void 0) attributes.blurRad = {
|
|
4603
|
+
key: "blurRad",
|
|
4604
|
+
value: options.blurRad
|
|
4605
|
+
};
|
|
4606
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4607
|
+
key: "dist",
|
|
4608
|
+
value: options.dist
|
|
4609
|
+
};
|
|
4610
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4611
|
+
key: "dir",
|
|
4612
|
+
value: options.dir
|
|
4613
|
+
};
|
|
4614
|
+
if (options.sx !== void 0) attributes.sx = {
|
|
4615
|
+
key: "sx",
|
|
4616
|
+
value: options.sx
|
|
4617
|
+
};
|
|
4618
|
+
if (options.sy !== void 0) attributes.sy = {
|
|
4619
|
+
key: "sy",
|
|
4620
|
+
value: options.sy
|
|
4621
|
+
};
|
|
4622
|
+
if (options.kx !== void 0) attributes.kx = {
|
|
4623
|
+
key: "kx",
|
|
4624
|
+
value: options.kx
|
|
4625
|
+
};
|
|
4626
|
+
if (options.ky !== void 0) attributes.ky = {
|
|
4627
|
+
key: "ky",
|
|
4628
|
+
value: options.ky
|
|
4629
|
+
};
|
|
4630
|
+
if (options.algn !== void 0) attributes.algn = {
|
|
4631
|
+
key: "algn",
|
|
4632
|
+
value: RectAlignment[options.algn]
|
|
4633
|
+
};
|
|
4634
|
+
if (options.rotWithShape === false) attributes.rotWithShape = {
|
|
4635
|
+
key: "rotWithShape",
|
|
4636
|
+
value: 0
|
|
4637
|
+
};
|
|
4638
|
+
return new BuilderElement({
|
|
4639
|
+
attributes,
|
|
4640
|
+
children: [createColorElement(options.color)],
|
|
4641
|
+
name: "a:outerShdw"
|
|
4642
|
+
});
|
|
4643
|
+
};
|
|
4644
|
+
//#endregion
|
|
4645
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/prst-shdw.ts
|
|
4646
|
+
/**
|
|
4647
|
+
* Preset shadow effect for DrawingML shapes.
|
|
4648
|
+
*
|
|
4649
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetShadowEffect
|
|
4650
|
+
*
|
|
4651
|
+
* @module
|
|
4652
|
+
*/
|
|
4653
|
+
/**
|
|
4654
|
+
* Preset shadow types (20 variations).
|
|
4655
|
+
*
|
|
4656
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetShadowVal
|
|
4657
|
+
*/
|
|
4658
|
+
const PresetShadowVal = {
|
|
4659
|
+
SHDW1: "shdw1",
|
|
4660
|
+
SHDW2: "shdw2",
|
|
4661
|
+
SHDW3: "shdw3",
|
|
4662
|
+
SHDW4: "shdw4",
|
|
4663
|
+
SHDW5: "shdw5",
|
|
4664
|
+
SHDW6: "shdw6",
|
|
4665
|
+
SHDW7: "shdw7",
|
|
4666
|
+
SHDW8: "shdw8",
|
|
4667
|
+
SHDW9: "shdw9",
|
|
4668
|
+
SHDW10: "shdw10",
|
|
4669
|
+
SHDW11: "shdw11",
|
|
4670
|
+
SHDW12: "shdw12",
|
|
4671
|
+
SHDW13: "shdw13",
|
|
4672
|
+
SHDW14: "shdw14",
|
|
4673
|
+
SHDW15: "shdw15",
|
|
4674
|
+
SHDW16: "shdw16",
|
|
4675
|
+
SHDW17: "shdw17",
|
|
4676
|
+
SHDW18: "shdw18",
|
|
4677
|
+
SHDW19: "shdw19",
|
|
4678
|
+
SHDW20: "shdw20"
|
|
4679
|
+
};
|
|
4680
|
+
/**
|
|
4681
|
+
* Creates a preset shadow effect element.
|
|
4682
|
+
*
|
|
4683
|
+
* ## XSD Schema
|
|
4684
|
+
* ```xml
|
|
4685
|
+
* <xsd:complexType name="CT_PresetShadowEffect">
|
|
4686
|
+
* <xsd:sequence>
|
|
4687
|
+
* <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
|
|
4688
|
+
* </xsd:sequence>
|
|
4689
|
+
* <xsd:attribute name="prst" type="ST_PresetShadowVal" use="required"/>
|
|
4690
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4691
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4692
|
+
* </xsd:complexType>
|
|
4693
|
+
* ```
|
|
4694
|
+
*/
|
|
4695
|
+
const createPresetShadowEffect = (options) => {
|
|
4696
|
+
const attributes = { prst: {
|
|
4697
|
+
key: "prst",
|
|
4698
|
+
value: PresetShadowVal[options.prst]
|
|
4699
|
+
} };
|
|
4700
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4701
|
+
key: "dist",
|
|
4702
|
+
value: options.dist
|
|
4703
|
+
};
|
|
4704
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4705
|
+
key: "dir",
|
|
4706
|
+
value: options.dir
|
|
4707
|
+
};
|
|
4708
|
+
return new BuilderElement({
|
|
4709
|
+
attributes,
|
|
4710
|
+
children: [createColorElement(options.color)],
|
|
4711
|
+
name: "a:prstShdw"
|
|
4712
|
+
});
|
|
4713
|
+
};
|
|
4714
|
+
//#endregion
|
|
4715
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/reflection.ts
|
|
4716
|
+
/**
|
|
4717
|
+
* Reflection effect for DrawingML shapes.
|
|
4718
|
+
*
|
|
4719
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ReflectionEffect
|
|
4720
|
+
*
|
|
4721
|
+
* @module
|
|
4722
|
+
*/
|
|
4723
|
+
/**
|
|
4724
|
+
* Creates a reflection effect element.
|
|
4725
|
+
*
|
|
4726
|
+
* ## XSD Schema
|
|
4727
|
+
* ```xml
|
|
4728
|
+
* <xsd:complexType name="CT_ReflectionEffect">
|
|
4729
|
+
* <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
|
|
4730
|
+
* <xsd:attribute name="stA" type="ST_PositiveFixedPercentage" default="100%"/>
|
|
4731
|
+
* <xsd:attribute name="stPos" type="ST_PositiveFixedPercentage" default="0%"/>
|
|
4732
|
+
* <xsd:attribute name="endA" type="ST_PositiveFixedPercentage" default="0%"/>
|
|
4733
|
+
* <xsd:attribute name="endPos" type="ST_PositiveFixedPercentage" default="100%"/>
|
|
4734
|
+
* <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
|
|
4735
|
+
* <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
|
|
4736
|
+
* <xsd:attribute name="fadeDir" type="ST_PositiveFixedAngle" default="5400000"/>
|
|
4737
|
+
* <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
|
|
4738
|
+
* <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
|
|
4739
|
+
* <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
|
|
4740
|
+
* <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
|
|
4741
|
+
* <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
|
|
4742
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
|
|
4743
|
+
* </xsd:complexType>
|
|
4744
|
+
* ```
|
|
4745
|
+
*/
|
|
4746
|
+
const createReflectionEffect = (options) => {
|
|
4747
|
+
if (!options) return new BuilderElement({ name: "a:reflection" });
|
|
4748
|
+
const attributes = {};
|
|
4749
|
+
if (options.blurRad !== void 0) attributes.blurRad = {
|
|
4750
|
+
key: "blurRad",
|
|
4751
|
+
value: options.blurRad
|
|
4752
|
+
};
|
|
4753
|
+
if (options.stA !== void 0) attributes.stA = {
|
|
4754
|
+
key: "stA",
|
|
4755
|
+
value: options.stA
|
|
4756
|
+
};
|
|
4757
|
+
if (options.stPos !== void 0) attributes.stPos = {
|
|
4758
|
+
key: "stPos",
|
|
4759
|
+
value: options.stPos
|
|
4760
|
+
};
|
|
4761
|
+
if (options.endA !== void 0) attributes.endA = {
|
|
4762
|
+
key: "endA",
|
|
4763
|
+
value: options.endA
|
|
4764
|
+
};
|
|
4765
|
+
if (options.endPos !== void 0) attributes.endPos = {
|
|
4766
|
+
key: "endPos",
|
|
4767
|
+
value: options.endPos
|
|
4768
|
+
};
|
|
4769
|
+
if (options.dist !== void 0) attributes.dist = {
|
|
4770
|
+
key: "dist",
|
|
4771
|
+
value: options.dist
|
|
4772
|
+
};
|
|
4773
|
+
if (options.dir !== void 0) attributes.dir = {
|
|
4774
|
+
key: "dir",
|
|
4775
|
+
value: options.dir
|
|
4776
|
+
};
|
|
4777
|
+
if (options.fadeDir !== void 0) attributes.fadeDir = {
|
|
4778
|
+
key: "fadeDir",
|
|
4779
|
+
value: options.fadeDir
|
|
4780
|
+
};
|
|
4781
|
+
if (options.sx !== void 0) attributes.sx = {
|
|
4782
|
+
key: "sx",
|
|
4783
|
+
value: options.sx
|
|
4784
|
+
};
|
|
4785
|
+
if (options.sy !== void 0) attributes.sy = {
|
|
4786
|
+
key: "sy",
|
|
4787
|
+
value: options.sy
|
|
4788
|
+
};
|
|
4789
|
+
if (options.kx !== void 0) attributes.kx = {
|
|
4790
|
+
key: "kx",
|
|
4791
|
+
value: options.kx
|
|
4792
|
+
};
|
|
4793
|
+
if (options.ky !== void 0) attributes.ky = {
|
|
4794
|
+
key: "ky",
|
|
4795
|
+
value: options.ky
|
|
4796
|
+
};
|
|
4797
|
+
if (options.algn !== void 0) attributes.algn = {
|
|
4798
|
+
key: "algn",
|
|
4799
|
+
value: options.algn
|
|
4800
|
+
};
|
|
4801
|
+
if (options.rotWithShape === false) attributes.rotWithShape = {
|
|
4802
|
+
key: "rotWithShape",
|
|
4803
|
+
value: 0
|
|
4804
|
+
};
|
|
4805
|
+
return new BuilderElement({
|
|
4806
|
+
attributes,
|
|
4807
|
+
name: "a:reflection"
|
|
4808
|
+
});
|
|
4809
|
+
};
|
|
4810
|
+
//#endregion
|
|
4811
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/soft-edge.ts
|
|
4812
|
+
/**
|
|
4813
|
+
* Soft edge effect for DrawingML shapes.
|
|
4814
|
+
*
|
|
4815
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SoftEdgesEffect
|
|
4816
|
+
*
|
|
4817
|
+
* @module
|
|
4818
|
+
*/
|
|
4819
|
+
/**
|
|
4820
|
+
* Creates a soft edge effect element.
|
|
4821
|
+
*
|
|
4822
|
+
* ## XSD Schema
|
|
4823
|
+
* ```xml
|
|
4824
|
+
* <xsd:complexType name="CT_SoftEdgesEffect">
|
|
4825
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="required"/>
|
|
4826
|
+
* </xsd:complexType>
|
|
4827
|
+
* ```
|
|
4828
|
+
*
|
|
4829
|
+
* @param rad - Soft edge radius in EMUs (required)
|
|
4830
|
+
*/
|
|
4831
|
+
const createSoftEdgeEffect = (rad) => new BuilderElement({
|
|
4832
|
+
attributes: { rad: {
|
|
4833
|
+
key: "rad",
|
|
4834
|
+
value: rad
|
|
4835
|
+
} },
|
|
4836
|
+
name: "a:softEdge"
|
|
4837
|
+
});
|
|
4838
|
+
//#endregion
|
|
4839
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/effect-list.ts
|
|
4840
|
+
/**
|
|
4841
|
+
* Effect list container for DrawingML shapes.
|
|
4842
|
+
*
|
|
4843
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectList, EG_EffectProperties
|
|
4844
|
+
*
|
|
4845
|
+
* @module
|
|
4846
|
+
*/
|
|
4847
|
+
/**
|
|
4848
|
+
* Creates a blur effect element.
|
|
4849
|
+
*
|
|
4850
|
+
* ## XSD Schema
|
|
4851
|
+
* ```xml
|
|
4852
|
+
* <xsd:complexType name="CT_BlurEffect">
|
|
4853
|
+
* <xsd:attribute name="rad" type="ST_PositiveCoordinate" default="0"/>
|
|
4854
|
+
* <xsd:attribute name="grow" type="xsd:boolean" default="true"/>
|
|
4855
|
+
* </xsd:complexType>
|
|
4856
|
+
* ```
|
|
4857
|
+
*/
|
|
4858
|
+
const createBlurEffect = (options) => {
|
|
4859
|
+
if (!(options.rad !== void 0 || options.grow === false)) return new BuilderElement({ name: "a:blur" });
|
|
4860
|
+
return new BuilderElement({
|
|
4861
|
+
attributes: {
|
|
4862
|
+
...options.rad !== void 0 && { rad: {
|
|
4863
|
+
key: "rad",
|
|
4864
|
+
value: options.rad
|
|
4865
|
+
} },
|
|
4866
|
+
...options.grow === false && { grow: {
|
|
4867
|
+
key: "grow",
|
|
4868
|
+
value: 0
|
|
4869
|
+
} }
|
|
4870
|
+
},
|
|
4871
|
+
name: "a:blur"
|
|
4872
|
+
});
|
|
4873
|
+
};
|
|
4874
|
+
/**
|
|
4875
|
+
* Creates an effect list element (a:effectLst).
|
|
4876
|
+
*
|
|
4877
|
+
* This is the EG_EffectProperties choice for a flat list of effects.
|
|
4878
|
+
* Effects are emitted in XSD order: blur, glow, innerShdw, outerShdw, prstShdw, reflection, softEdge.
|
|
4879
|
+
*
|
|
4880
|
+
* ## XSD Schema
|
|
4881
|
+
* ```xml
|
|
4882
|
+
* <xsd:complexType name="CT_EffectList">
|
|
4883
|
+
* <xsd:sequence>
|
|
4884
|
+
* <xsd:element name="blur" type="CT_BlurEffect" minOccurs="0"/>
|
|
4885
|
+
* <xsd:element name="fillOverlay" type="CT_FillOverlayEffect" minOccurs="0"/>
|
|
4886
|
+
* <xsd:element name="glow" type="CT_GlowEffect" minOccurs="0"/>
|
|
4887
|
+
* <xsd:element name="innerShdw" type="CT_InnerShadowEffect" minOccurs="0"/>
|
|
4888
|
+
* <xsd:element name="outerShdw" type="CT_OuterShadowEffect" minOccurs="0"/>
|
|
4889
|
+
* <xsd:element name="prstShdw" type="CT_PresetShadowEffect" minOccurs="0"/>
|
|
4890
|
+
* <xsd:element name="reflection" type="CT_ReflectionEffect" minOccurs="0"/>
|
|
4891
|
+
* <xsd:element name="softEdge" type="CT_SoftEdgesEffect" minOccurs="0"/>
|
|
4892
|
+
* </xsd:sequence>
|
|
4893
|
+
* </xsd:complexType>
|
|
4894
|
+
* ```
|
|
4895
|
+
*/
|
|
4896
|
+
const createEffectList = (options) => {
|
|
4897
|
+
const children = [];
|
|
4898
|
+
if (options.blur) children.push(createBlurEffect(options.blur));
|
|
4899
|
+
if (options.glow) children.push(createGlowEffect(options.glow));
|
|
4900
|
+
if (options.innerShdw) children.push(createInnerShadowEffect(options.innerShdw));
|
|
4901
|
+
if (options.outerShdw) children.push(createOuterShadowEffect(options.outerShdw));
|
|
4902
|
+
if (options.prstShdw) children.push(createPresetShadowEffect(options.prstShdw));
|
|
4903
|
+
if (options.reflection) children.push(createReflectionEffect(options.reflection === true ? void 0 : options.reflection));
|
|
4904
|
+
if (options.softEdge !== void 0) children.push(createSoftEdgeEffect(options.softEdge));
|
|
4905
|
+
return new BuilderElement({
|
|
4906
|
+
children,
|
|
4907
|
+
name: "a:effectLst"
|
|
4908
|
+
});
|
|
4909
|
+
};
|
|
4910
|
+
//#endregion
|
|
4911
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/fill/gradient-fill.ts
|
|
4912
|
+
/**
|
|
4913
|
+
* Gradient fill element for DrawingML shapes.
|
|
4914
|
+
*
|
|
4915
|
+
* This module provides gradient fill support with linear and path shading.
|
|
4916
|
+
*
|
|
4917
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GradientFillProperties
|
|
4918
|
+
*
|
|
4919
|
+
* @module
|
|
4920
|
+
*/
|
|
4921
|
+
/**
|
|
4922
|
+
* Path shade type for radial gradients.
|
|
4923
|
+
*/
|
|
4924
|
+
const PathShadeType = {
|
|
4925
|
+
SHAPE: "shape",
|
|
4926
|
+
CIRCLE: "circle",
|
|
4927
|
+
RECT: "rect"
|
|
4928
|
+
};
|
|
4929
|
+
/**
|
|
4930
|
+
* Creates a gradient stop element (a:gs).
|
|
4931
|
+
*
|
|
4932
|
+
* @example
|
|
4933
|
+
* ```typescript
|
|
4934
|
+
* createGradientStop({ position: 0, color: { value: "FF0000" } });
|
|
4935
|
+
* createGradientStop({ position: 100000, color: { value: "0000FF" } });
|
|
4936
|
+
* ```
|
|
4937
|
+
*/
|
|
4938
|
+
const createGradientStop = (stop) => new BuilderElement({
|
|
4939
|
+
attributes: { pos: {
|
|
4940
|
+
key: "pos",
|
|
4941
|
+
value: stop.position
|
|
4942
|
+
} },
|
|
4943
|
+
children: [createColorElement(stop.color)],
|
|
4944
|
+
name: "a:gs"
|
|
4945
|
+
});
|
|
4946
|
+
/**
|
|
4947
|
+
* Creates the shade element (a:lin or a:path).
|
|
4948
|
+
*/
|
|
4949
|
+
const createShadeElement = (shade) => {
|
|
4950
|
+
if ("angle" in shade) return new BuilderElement({
|
|
4951
|
+
attributes: {
|
|
4952
|
+
ang: {
|
|
4953
|
+
key: "ang",
|
|
4954
|
+
value: shade.angle
|
|
4955
|
+
},
|
|
4956
|
+
scaled: {
|
|
4957
|
+
key: "scaled",
|
|
4958
|
+
value: shade.scaled
|
|
4959
|
+
}
|
|
4960
|
+
},
|
|
4961
|
+
name: "a:lin"
|
|
4962
|
+
});
|
|
4963
|
+
const pathShade = shade;
|
|
4964
|
+
return new BuilderElement({
|
|
4965
|
+
attributes: { path: {
|
|
4966
|
+
key: "path",
|
|
4967
|
+
value: pathShade.path ? PathShadeType[pathShade.path] : void 0
|
|
4968
|
+
} },
|
|
4969
|
+
name: "a:path"
|
|
4970
|
+
});
|
|
4971
|
+
};
|
|
4972
|
+
/**
|
|
4973
|
+
* Creates a gradient fill element.
|
|
4974
|
+
*
|
|
4975
|
+
* ## XSD Schema
|
|
4976
|
+
* ```xml
|
|
4977
|
+
* <xsd:complexType name="CT_GradientFillProperties">
|
|
4978
|
+
* <xsd:sequence>
|
|
4979
|
+
* <xsd:element name="gsLst" type="CT_GradientStopList" minOccurs="0"/>
|
|
4980
|
+
* <xsd:group ref="EG_ShadeProperties" minOccurs="0"/>
|
|
4981
|
+
* </xsd:sequence>
|
|
4982
|
+
* <xsd:attribute name="rotWithShape" type="xsd:boolean" use="optional"/>
|
|
4983
|
+
* </xsd:complexType>
|
|
4984
|
+
* ```
|
|
4985
|
+
*
|
|
4986
|
+
* @example
|
|
4987
|
+
* ```typescript
|
|
4988
|
+
* // Linear gradient from red to blue
|
|
4989
|
+
* createGradientFill({
|
|
4990
|
+
* stops: [
|
|
4991
|
+
* { position: 0, color: { value: "FF0000" } },
|
|
4992
|
+
* { position: 100000, color: { value: "0000FF" } },
|
|
4993
|
+
* ],
|
|
4994
|
+
* shade: { angle: 5400000 },
|
|
4995
|
+
* });
|
|
4996
|
+
* ```
|
|
4997
|
+
*/
|
|
4998
|
+
const createGradientFill = (options) => {
|
|
4999
|
+
const children = [];
|
|
5000
|
+
children.push(new BuilderElement({
|
|
5001
|
+
children: options.stops.map(createGradientStop),
|
|
5002
|
+
name: "a:gsLst"
|
|
5003
|
+
}));
|
|
5004
|
+
if (options.shade) children.push(createShadeElement(options.shade));
|
|
5005
|
+
return new BuilderElement({
|
|
5006
|
+
attributes: { rotWithShape: {
|
|
5007
|
+
key: "rotWithShape",
|
|
5008
|
+
value: options.rotateWithShape
|
|
5009
|
+
} },
|
|
5010
|
+
children,
|
|
5011
|
+
name: "a:gradFill"
|
|
5012
|
+
});
|
|
5013
|
+
};
|
|
5014
|
+
//#endregion
|
|
3764
5015
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/form/extents/extents-attributes.ts
|
|
3765
5016
|
/**
|
|
3766
5017
|
* Extents attributes for DrawingML shapes.
|
|
@@ -3997,143 +5248,103 @@ var Form = class extends XmlComponent {
|
|
|
3997
5248
|
*/
|
|
3998
5249
|
const createNoFill = () => new BuilderElement({ name: "a:noFill" });
|
|
3999
5250
|
//#endregion
|
|
4000
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/
|
|
4001
|
-
/**
|
|
4002
|
-
* RGB color element for DrawingML shapes.
|
|
4003
|
-
*
|
|
4004
|
-
* This module provides RGB color support for solid fills.
|
|
4005
|
-
*
|
|
4006
|
-
* @module
|
|
4007
|
-
*/
|
|
5251
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/outline.ts
|
|
4008
5252
|
/**
|
|
4009
|
-
*
|
|
5253
|
+
* Outline (line) properties for DrawingML shapes.
|
|
4010
5254
|
*
|
|
4011
|
-
*
|
|
5255
|
+
* This module provides support for configuring outline properties including
|
|
5256
|
+
* width, cap style, compound line types, fill properties, dash, and join.
|
|
4012
5257
|
*
|
|
4013
|
-
*
|
|
4014
|
-
* ```xml
|
|
4015
|
-
* <xsd:complexType name="CT_SRgbColor">
|
|
4016
|
-
* <xsd:sequence>
|
|
4017
|
-
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4018
|
-
* </xsd:sequence>
|
|
4019
|
-
* <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
|
|
4020
|
-
* </xsd:complexType>
|
|
4021
|
-
* ```
|
|
5258
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineProperties
|
|
4022
5259
|
*
|
|
4023
|
-
* @
|
|
4024
|
-
* ```typescript
|
|
4025
|
-
* const redColor = createSolidRgbColor({ value: "FF0000" });
|
|
4026
|
-
* const blueColor = createSolidRgbColor({ value: "0000FF" });
|
|
4027
|
-
* ```
|
|
5260
|
+
* @module
|
|
4028
5261
|
*/
|
|
4029
|
-
const createSolidRgbColor = (options) => new BuilderElement({
|
|
4030
|
-
attributes: { value: {
|
|
4031
|
-
key: "val",
|
|
4032
|
-
value: options.value
|
|
4033
|
-
} },
|
|
4034
|
-
name: "a:srgbClr"
|
|
4035
|
-
});
|
|
4036
|
-
//#endregion
|
|
4037
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/scheme-color.ts
|
|
4038
5262
|
/**
|
|
4039
|
-
*
|
|
4040
|
-
*
|
|
4041
|
-
* This module provides scheme-based color support for solid fills,
|
|
4042
|
-
* allowing colors to be defined using theme color schemes.
|
|
5263
|
+
* Line cap styles for outline endpoints.
|
|
4043
5264
|
*
|
|
4044
|
-
*
|
|
5265
|
+
* Defines how the ends of a line are rendered.
|
|
4045
5266
|
*/
|
|
5267
|
+
const LineCap = {
|
|
5268
|
+
ROUND: "rnd",
|
|
5269
|
+
SQUARE: "sq",
|
|
5270
|
+
FLAT: "flat"
|
|
5271
|
+
};
|
|
4046
5272
|
/**
|
|
4047
|
-
*
|
|
4048
|
-
*
|
|
4049
|
-
* Specifies a color using a theme color scheme reference.
|
|
4050
|
-
*
|
|
4051
|
-
* ## XSD Schema
|
|
4052
|
-
* ```xml
|
|
4053
|
-
* <xsd:complexType name="CT_SchemeColor">
|
|
4054
|
-
* <xsd:sequence>
|
|
4055
|
-
* <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
|
|
4056
|
-
* </xsd:sequence>
|
|
4057
|
-
* <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
|
|
4058
|
-
* </xsd:complexType>
|
|
4059
|
-
* ```
|
|
5273
|
+
* Compound line types for outlines.
|
|
4060
5274
|
*
|
|
4061
|
-
*
|
|
4062
|
-
* ```typescript
|
|
4063
|
-
* const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });
|
|
4064
|
-
* const bgColor = createSchemeColor({ value: SchemeColor.BG1 });
|
|
4065
|
-
* ```
|
|
5275
|
+
* Defines the structure of compound lines (single, double, etc.).
|
|
4066
5276
|
*/
|
|
4067
|
-
const
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
}
|
|
4074
|
-
//#endregion
|
|
4075
|
-
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/solid-fill.ts
|
|
5277
|
+
const CompoundLine = {
|
|
5278
|
+
SINGLE: "sng",
|
|
5279
|
+
DOUBLE: "dbl",
|
|
5280
|
+
THICK_THIN: "thickThin",
|
|
5281
|
+
THIN_THICK: "thinThick",
|
|
5282
|
+
TRI: "tri"
|
|
5283
|
+
};
|
|
4076
5284
|
/**
|
|
4077
|
-
*
|
|
4078
|
-
*
|
|
4079
|
-
* This module provides solid fill support for outlines and shapes,
|
|
4080
|
-
* supporting both RGB and scheme-based colors.
|
|
5285
|
+
* Pen alignment options for outline positioning.
|
|
4081
5286
|
*
|
|
4082
|
-
*
|
|
5287
|
+
* Defines how the outline is aligned relative to the shape edge.
|
|
4083
5288
|
*/
|
|
5289
|
+
const PenAlignment = {
|
|
5290
|
+
CENTER: "ctr",
|
|
5291
|
+
INSET: "in"
|
|
5292
|
+
};
|
|
4084
5293
|
/**
|
|
4085
|
-
*
|
|
4086
|
-
*
|
|
4087
|
-
* Specifies a solid color fill using either RGB or scheme colors.
|
|
5294
|
+
* Preset dash styles for outlines.
|
|
4088
5295
|
*
|
|
4089
5296
|
* ## XSD Schema
|
|
4090
5297
|
* ```xml
|
|
4091
|
-
* <xsd:
|
|
4092
|
-
* <xsd:
|
|
4093
|
-
* <xsd:
|
|
4094
|
-
* <xsd:
|
|
4095
|
-
*
|
|
4096
|
-
*
|
|
4097
|
-
*
|
|
4098
|
-
*
|
|
4099
|
-
*
|
|
4100
|
-
*
|
|
4101
|
-
*
|
|
4102
|
-
*
|
|
4103
|
-
*
|
|
4104
|
-
*
|
|
4105
|
-
*
|
|
4106
|
-
*
|
|
4107
|
-
* // Scheme solid fill
|
|
4108
|
-
* const schemeFill = createSolidFill({
|
|
4109
|
-
* type: "scheme",
|
|
4110
|
-
* value: SchemeColor.ACCENT1
|
|
4111
|
-
* });
|
|
5298
|
+
* <xsd:simpleType name="ST_PresetLineDashVal">
|
|
5299
|
+
* <xsd:restriction base="xsd:token">
|
|
5300
|
+
* <xsd:enumeration value="solid"/>
|
|
5301
|
+
* <xsd:enumeration value="dot"/>
|
|
5302
|
+
* <xsd:enumeration value="dash"/>
|
|
5303
|
+
* <xsd:enumeration value="lgDash"/>
|
|
5304
|
+
* <xsd:enumeration value="dashDot"/>
|
|
5305
|
+
* <xsd:enumeration value="lgDashDot"/>
|
|
5306
|
+
* <xsd:enumeration value="lgDashDotDot"/>
|
|
5307
|
+
* <xsd:enumeration value="sysDash"/>
|
|
5308
|
+
* <xsd:enumeration value="sysDot"/>
|
|
5309
|
+
* <xsd:enumeration value="sysDashDot"/>
|
|
5310
|
+
* <xsd:enumeration value="sysDashDotDot"/>
|
|
5311
|
+
* </xsd:restriction>
|
|
5312
|
+
* </xsd:simpleType>
|
|
4112
5313
|
* ```
|
|
4113
5314
|
*/
|
|
4114
|
-
const
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
5315
|
+
const PresetDash = {
|
|
5316
|
+
SOLID: "solid",
|
|
5317
|
+
DOT: "dot",
|
|
5318
|
+
DASH: "dash",
|
|
5319
|
+
LG_DASH: "lgDash",
|
|
5320
|
+
DASH_DOT: "dashDot",
|
|
5321
|
+
LG_DASH_DOT: "lgDashDot",
|
|
5322
|
+
LG_DASH_DOT_DOT: "lgDashDotDot",
|
|
5323
|
+
SYS_DASH: "sysDash",
|
|
5324
|
+
SYS_DOT: "sysDot",
|
|
5325
|
+
SYS_DASH_DOT: "sysDashDot",
|
|
5326
|
+
SYS_DASH_DOT_DOT: "sysDashDotDot"
|
|
5327
|
+
};
|
|
4120
5328
|
/**
|
|
4121
|
-
*
|
|
4122
|
-
*
|
|
4123
|
-
* This module provides support for configuring outline properties including
|
|
4124
|
-
* width, cap style, compound line types, and fill properties.
|
|
4125
|
-
*
|
|
4126
|
-
* Reference: http://officeopenxml.com/drwSp-outline.php
|
|
4127
|
-
*
|
|
4128
|
-
* @module
|
|
5329
|
+
* Line join styles.
|
|
4129
5330
|
*/
|
|
5331
|
+
const LineJoin = {
|
|
5332
|
+
ROUND: "round",
|
|
5333
|
+
BEVEL: "bevel",
|
|
5334
|
+
MITER: "miter"
|
|
5335
|
+
};
|
|
5336
|
+
/**
|
|
5337
|
+
* Creates the fill child element for an outline.
|
|
5338
|
+
*/
|
|
5339
|
+
const createOutlineFill = (options) => {
|
|
5340
|
+
if (options.type === "noFill") return createNoFill();
|
|
5341
|
+
return createSolidFill(options.color);
|
|
5342
|
+
};
|
|
4130
5343
|
/**
|
|
4131
5344
|
* Creates an outline element for DrawingML shapes.
|
|
4132
5345
|
*
|
|
4133
5346
|
* The outline element specifies the line properties for the shape border,
|
|
4134
|
-
* including width, cap style, compound line type, alignment, and fill.
|
|
4135
|
-
*
|
|
4136
|
-
* Reference: http://officeopenxml.com/drwSp-outline.php
|
|
5347
|
+
* including width, cap style, compound line type, alignment, dash, join, and fill.
|
|
4137
5348
|
*
|
|
4138
5349
|
* ## XSD Schema
|
|
4139
5350
|
* ```xml
|
|
@@ -4152,44 +5363,56 @@ const createSolidFill = (options) => new BuilderElement({
|
|
|
4152
5363
|
*
|
|
4153
5364
|
* @example
|
|
4154
5365
|
* ```typescript
|
|
4155
|
-
* //
|
|
5366
|
+
* // Outline with RGB color and dash
|
|
4156
5367
|
* const outline = createOutline({
|
|
4157
5368
|
* width: 9525,
|
|
4158
|
-
* cap: "ROUND",
|
|
4159
5369
|
* type: "solidFill",
|
|
4160
|
-
*
|
|
4161
|
-
*
|
|
5370
|
+
* color: { value: "FF0000" },
|
|
5371
|
+
* dash: "DASH",
|
|
4162
5372
|
* });
|
|
4163
5373
|
* ```
|
|
4164
5374
|
*/
|
|
4165
|
-
const createOutline = (options) =>
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
5375
|
+
const createOutline = (options) => {
|
|
5376
|
+
const children = [];
|
|
5377
|
+
children.push(createOutlineFill(options));
|
|
5378
|
+
if (options.dash !== void 0) children.push(new BuilderElement({
|
|
5379
|
+
attributes: { val: {
|
|
5380
|
+
key: "val",
|
|
5381
|
+
value: PresetDash[options.dash]
|
|
5382
|
+
} },
|
|
5383
|
+
name: "a:prstDash"
|
|
5384
|
+
}));
|
|
5385
|
+
if (options.join !== void 0) if (options.join === "MITER" && options.miterLimit !== void 0) children.push(new BuilderElement({
|
|
5386
|
+
attributes: { lim: {
|
|
5387
|
+
key: "lim",
|
|
5388
|
+
value: options.miterLimit
|
|
5389
|
+
} },
|
|
5390
|
+
name: "a:miter"
|
|
5391
|
+
}));
|
|
5392
|
+
else children.push(new BuilderElement({ name: `a:${LineJoin[options.join]}` }));
|
|
5393
|
+
return new BuilderElement({
|
|
5394
|
+
attributes: {
|
|
5395
|
+
align: {
|
|
5396
|
+
key: "algn",
|
|
5397
|
+
value: options.align ? PenAlignment[options.align] : void 0
|
|
5398
|
+
},
|
|
5399
|
+
cap: {
|
|
5400
|
+
key: "cap",
|
|
5401
|
+
value: options.cap ? LineCap[options.cap] : void 0
|
|
5402
|
+
},
|
|
5403
|
+
compoundLine: {
|
|
5404
|
+
key: "cmpd",
|
|
5405
|
+
value: options.compoundLine ? CompoundLine[options.compoundLine] : void 0
|
|
5406
|
+
},
|
|
5407
|
+
width: {
|
|
5408
|
+
key: "w",
|
|
5409
|
+
value: options.width
|
|
5410
|
+
}
|
|
4178
5411
|
},
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
},
|
|
4184
|
-
children: [options.type === "noFill" ? createNoFill() : options.solidFillType === "rgb" ? createSolidFill({
|
|
4185
|
-
type: "rgb",
|
|
4186
|
-
value: options.value
|
|
4187
|
-
}) : createSolidFill({
|
|
4188
|
-
type: "scheme",
|
|
4189
|
-
value: options.value
|
|
4190
|
-
})],
|
|
4191
|
-
name: "a:ln"
|
|
4192
|
-
});
|
|
5412
|
+
children,
|
|
5413
|
+
name: "a:ln"
|
|
5414
|
+
});
|
|
5415
|
+
};
|
|
4193
5416
|
//#endregion
|
|
4194
5417
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/preset-geometry/adjustment-values/adjustment-values.ts
|
|
4195
5418
|
/**
|
|
@@ -4327,15 +5550,181 @@ var ShapePropertiesAttributes = class extends XmlAttributeComponent {
|
|
|
4327
5550
|
}
|
|
4328
5551
|
};
|
|
4329
5552
|
//#endregion
|
|
5553
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/three-d/bevel.ts
|
|
5554
|
+
/**
|
|
5555
|
+
* Bevel element for DrawingML 3D shapes.
|
|
5556
|
+
*
|
|
5557
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Bevel
|
|
5558
|
+
*
|
|
5559
|
+
* @module
|
|
5560
|
+
*/
|
|
5561
|
+
/**
|
|
5562
|
+
* Bevel preset types (12 variations).
|
|
5563
|
+
*
|
|
5564
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_BevelPresetType
|
|
5565
|
+
*/
|
|
5566
|
+
const BevelPresetType = {
|
|
5567
|
+
RELAXED_INSET: "relaxedInset",
|
|
5568
|
+
CIRCLE: "circle",
|
|
5569
|
+
SLOPE: "slope",
|
|
5570
|
+
CROSS: "cross",
|
|
5571
|
+
ANGLE: "angle",
|
|
5572
|
+
SOFT_ROUND: "softRound",
|
|
5573
|
+
CONVEX: "convex",
|
|
5574
|
+
COOL_SLANT: "coolSlant",
|
|
5575
|
+
DIVOT: "divot",
|
|
5576
|
+
RIBLET: "riblet",
|
|
5577
|
+
HARD_EDGE: "hardEdge",
|
|
5578
|
+
ART_DECO: "artDeco"
|
|
5579
|
+
};
|
|
5580
|
+
/**
|
|
5581
|
+
* Creates a bevel element.
|
|
5582
|
+
*
|
|
5583
|
+
* ## XSD Schema
|
|
5584
|
+
* ```xml
|
|
5585
|
+
* <xsd:complexType name="CT_Bevel">
|
|
5586
|
+
* <xsd:attribute name="w" type="ST_PositiveCoordinate" default="76200"/>
|
|
5587
|
+
* <xsd:attribute name="h" type="ST_PositiveCoordinate" default="76200"/>
|
|
5588
|
+
* <xsd:attribute name="prst" type="ST_BevelPresetType" default="circle"/>
|
|
5589
|
+
* </xsd:complexType>
|
|
5590
|
+
* ```
|
|
5591
|
+
*/
|
|
5592
|
+
const createBevel = (options) => {
|
|
5593
|
+
if (!options) return new BuilderElement({ name: "a:bevelT" });
|
|
5594
|
+
const attributes = {};
|
|
5595
|
+
if (options.w !== void 0) attributes.w = {
|
|
5596
|
+
key: "w",
|
|
5597
|
+
value: options.w
|
|
5598
|
+
};
|
|
5599
|
+
if (options.h !== void 0) attributes.h = {
|
|
5600
|
+
key: "h",
|
|
5601
|
+
value: options.h
|
|
5602
|
+
};
|
|
5603
|
+
if (options.prst !== void 0) attributes.prst = {
|
|
5604
|
+
key: "prst",
|
|
5605
|
+
value: BevelPresetType[options.prst]
|
|
5606
|
+
};
|
|
5607
|
+
return new BuilderElement({
|
|
5608
|
+
attributes,
|
|
5609
|
+
name: "a:bevelT"
|
|
5610
|
+
});
|
|
5611
|
+
};
|
|
5612
|
+
/**
|
|
5613
|
+
* Creates a bottom bevel element (a:bevelB).
|
|
5614
|
+
*/
|
|
5615
|
+
const createBottomBevel = (options) => {
|
|
5616
|
+
if (!options) return new BuilderElement({ name: "a:bevelB" });
|
|
5617
|
+
const attributes = {};
|
|
5618
|
+
if (options.w !== void 0) attributes.w = {
|
|
5619
|
+
key: "w",
|
|
5620
|
+
value: options.w
|
|
5621
|
+
};
|
|
5622
|
+
if (options.h !== void 0) attributes.h = {
|
|
5623
|
+
key: "h",
|
|
5624
|
+
value: options.h
|
|
5625
|
+
};
|
|
5626
|
+
if (options.prst !== void 0) attributes.prst = {
|
|
5627
|
+
key: "prst",
|
|
5628
|
+
value: BevelPresetType[options.prst]
|
|
5629
|
+
};
|
|
5630
|
+
return new BuilderElement({
|
|
5631
|
+
attributes,
|
|
5632
|
+
name: "a:bevelB"
|
|
5633
|
+
});
|
|
5634
|
+
};
|
|
5635
|
+
//#endregion
|
|
5636
|
+
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/three-d/shape-3d.ts
|
|
5637
|
+
/**
|
|
5638
|
+
* 3D shape properties for DrawingML.
|
|
5639
|
+
*
|
|
5640
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Shape3D
|
|
5641
|
+
*
|
|
5642
|
+
* @module
|
|
5643
|
+
*/
|
|
5644
|
+
/**
|
|
5645
|
+
* Preset material types for 3D shapes (15 variations).
|
|
5646
|
+
*
|
|
5647
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetMaterialType
|
|
5648
|
+
*/
|
|
5649
|
+
const PresetMaterialType = {
|
|
5650
|
+
LEGACY_MATTE: "legacyMatte",
|
|
5651
|
+
LEGACY_PLASTIC: "legacyPlastic",
|
|
5652
|
+
LEGACY_METAL: "legacyMetal",
|
|
5653
|
+
LEGACY_WIREFRAME: "legacyWireframe",
|
|
5654
|
+
MATTE: "matte",
|
|
5655
|
+
PLASTIC: "plastic",
|
|
5656
|
+
METAL: "metal",
|
|
5657
|
+
WARM_MATTE: "warmMatte",
|
|
5658
|
+
TRANSLUCENT_POWDER: "translucentPowder",
|
|
5659
|
+
POWDER: "powder",
|
|
5660
|
+
DK_EDGE: "dkEdge",
|
|
5661
|
+
SOFT_EDGE: "softEdge",
|
|
5662
|
+
CLEAR: "clear",
|
|
5663
|
+
FLAT: "flat",
|
|
5664
|
+
SOFT_METAL: "softmetal"
|
|
5665
|
+
};
|
|
5666
|
+
/**
|
|
5667
|
+
* Creates a 3D shape properties element (a:sp3d).
|
|
5668
|
+
*
|
|
5669
|
+
* ## XSD Schema
|
|
5670
|
+
* ```xml
|
|
5671
|
+
* <xsd:complexType name="CT_Shape3D">
|
|
5672
|
+
* <xsd:sequence>
|
|
5673
|
+
* <xsd:element name="bevelT" type="CT_Bevel" minOccurs="0"/>
|
|
5674
|
+
* <xsd:element name="bevelB" type="CT_Bevel" minOccurs="0"/>
|
|
5675
|
+
* <xsd:element name="extrusionClr" type="CT_Color" minOccurs="0"/>
|
|
5676
|
+
* <xsd:element name="contourClr" type="CT_Color" minOccurs="0"/>
|
|
5677
|
+
* </xsd:sequence>
|
|
5678
|
+
* <xsd:attribute name="z" type="ST_Coordinate" default="0"/>
|
|
5679
|
+
* <xsd:attribute name="extrusionH" type="ST_PositiveCoordinate" default="0"/>
|
|
5680
|
+
* <xsd:attribute name="contourW" type="ST_PositiveCoordinate" default="0"/>
|
|
5681
|
+
* <xsd:attribute name="prstMaterial" type="ST_PresetMaterialType" default="warmMatte"/>
|
|
5682
|
+
* </xsd:complexType>
|
|
5683
|
+
* ```
|
|
5684
|
+
*/
|
|
5685
|
+
const createShape3D = (options) => {
|
|
5686
|
+
const children = [];
|
|
5687
|
+
if (options.bevelT) children.push(createBevel(options.bevelT));
|
|
5688
|
+
if (options.bevelB) children.push(createBottomBevel(options.bevelB));
|
|
5689
|
+
if (options.extrusionClr) children.push(new BuilderElement({
|
|
5690
|
+
children: [createColorElement(options.extrusionClr)],
|
|
5691
|
+
name: "a:extrusionClr"
|
|
5692
|
+
}));
|
|
5693
|
+
if (options.contourClr) children.push(new BuilderElement({
|
|
5694
|
+
children: [createColorElement(options.contourClr)],
|
|
5695
|
+
name: "a:contourClr"
|
|
5696
|
+
}));
|
|
5697
|
+
return new BuilderElement({
|
|
5698
|
+
attributes: options.z !== void 0 || options.extrusionH !== void 0 || options.contourW !== void 0 || options.prstMaterial !== void 0 ? {
|
|
5699
|
+
...options.z !== void 0 && { z: {
|
|
5700
|
+
key: "z",
|
|
5701
|
+
value: options.z
|
|
5702
|
+
} },
|
|
5703
|
+
...options.extrusionH !== void 0 && { extrusionH: {
|
|
5704
|
+
key: "extrusionH",
|
|
5705
|
+
value: options.extrusionH
|
|
5706
|
+
} },
|
|
5707
|
+
...options.contourW !== void 0 && { contourW: {
|
|
5708
|
+
key: "contourW",
|
|
5709
|
+
value: options.contourW
|
|
5710
|
+
} },
|
|
5711
|
+
...options.prstMaterial !== void 0 && { prstMaterial: {
|
|
5712
|
+
key: "prstMaterial",
|
|
5713
|
+
value: PresetMaterialType[options.prstMaterial]
|
|
5714
|
+
} }
|
|
5715
|
+
} : void 0,
|
|
5716
|
+
children,
|
|
5717
|
+
name: "a:sp3d"
|
|
5718
|
+
});
|
|
5719
|
+
};
|
|
5720
|
+
//#endregion
|
|
4330
5721
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/shape-properties.ts
|
|
4331
5722
|
/**
|
|
4332
5723
|
* Represents shape properties for a DrawingML picture.
|
|
4333
5724
|
*
|
|
4334
5725
|
* This element defines the visual formatting of a picture, including
|
|
4335
5726
|
* its transform (size, position, rotation, flip), geometry preset,
|
|
4336
|
-
*
|
|
4337
|
-
*
|
|
4338
|
-
* Reference: http://officeopenxml.com/drwSp-SpPr.php
|
|
5727
|
+
* fill, outline, effects, and 3D properties.
|
|
4339
5728
|
*
|
|
4340
5729
|
* ## XSD Schema
|
|
4341
5730
|
* ```xml
|
|
@@ -4357,33 +5746,29 @@ var ShapePropertiesAttributes = class extends XmlAttributeComponent {
|
|
|
4357
5746
|
* @example
|
|
4358
5747
|
* ```typescript
|
|
4359
5748
|
* const shapeProps = new ShapeProperties({
|
|
4360
|
-
*
|
|
4361
|
-
*
|
|
4362
|
-
*
|
|
4363
|
-
*
|
|
5749
|
+
* element: "pic",
|
|
5750
|
+
* transform: { emus: { x: 914400, y: 914400 } },
|
|
5751
|
+
* effects: {
|
|
5752
|
+
* glow: { rad: 50800, color: { value: "FF0000" } },
|
|
4364
5753
|
* },
|
|
4365
|
-
* outline: {
|
|
4366
|
-
* width: 9525,
|
|
4367
|
-
* type: "solidFill",
|
|
4368
|
-
* solidFillType: "rgb",
|
|
4369
|
-
* value: "FF0000"
|
|
4370
|
-
* }
|
|
4371
5754
|
* });
|
|
4372
5755
|
* ```
|
|
4373
5756
|
*/
|
|
4374
5757
|
var ShapeProperties = class extends XmlComponent {
|
|
4375
|
-
constructor({ element, outline, solidFill, transform }) {
|
|
5758
|
+
constructor({ element, effects, gradientFill, noFill, outline, shape3d, solidFill, transform }) {
|
|
4376
5759
|
super(`${element}:spPr`);
|
|
4377
5760
|
_defineProperty(this, "form", void 0);
|
|
4378
5761
|
this.root.push(new ShapePropertiesAttributes({ bwMode: "auto" }));
|
|
4379
5762
|
this.form = new Form(transform);
|
|
4380
5763
|
this.root.push(this.form);
|
|
4381
5764
|
this.root.push(new PresetGeometry());
|
|
4382
|
-
if (
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
if (
|
|
5765
|
+
if (noFill) this.root.push(createNoFill());
|
|
5766
|
+
else if (solidFill) this.root.push(createSolidFill(solidFill));
|
|
5767
|
+
else if (gradientFill) this.root.push(createGradientFill(gradientFill));
|
|
5768
|
+
else if (outline) this.root.push(createNoFill());
|
|
5769
|
+
if (outline) this.root.push(createOutline(outline));
|
|
5770
|
+
if (effects) this.root.push(createEffectList(effects));
|
|
5771
|
+
if (shape3d) this.root.push(createShape3D(shape3d));
|
|
4387
5772
|
}
|
|
4388
5773
|
};
|
|
4389
5774
|
//#endregion
|
|
@@ -4454,7 +5839,11 @@ const createWpsShape = (options) => new BuilderElement({
|
|
|
4454
5839
|
createNonVisualShapeProperties(options.nonVisualProperties),
|
|
4455
5840
|
new ShapeProperties({
|
|
4456
5841
|
element: "wps",
|
|
5842
|
+
effects: options.effects,
|
|
5843
|
+
gradientFill: options.gradientFill,
|
|
5844
|
+
noFill: options.noFill,
|
|
4457
5845
|
outline: options.outline,
|
|
5846
|
+
shape3d: options.shape3d,
|
|
4458
5847
|
solidFill: options.solidFill,
|
|
4459
5848
|
transform: options.transformation
|
|
4460
5849
|
}),
|
|
@@ -4619,17 +6008,17 @@ const createBlip = (mediaData) => new BuilderElement({
|
|
|
4619
6008
|
*
|
|
4620
6009
|
* This module defines the portion of an image to use when filling a shape.
|
|
4621
6010
|
*
|
|
4622
|
-
* Reference:
|
|
6011
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
|
|
4623
6012
|
*
|
|
4624
6013
|
* @module
|
|
4625
6014
|
*/
|
|
4626
6015
|
/**
|
|
4627
|
-
*
|
|
6016
|
+
* Creates a source rectangle element for blip fill cropping.
|
|
4628
6017
|
*
|
|
4629
6018
|
* This element specifies a portion of the blip (image) to use as the fill.
|
|
4630
|
-
* When
|
|
6019
|
+
* When no options are provided, the entire blip is used.
|
|
4631
6020
|
*
|
|
4632
|
-
* Reference:
|
|
6021
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
|
|
4633
6022
|
*
|
|
4634
6023
|
* ## XSD Schema
|
|
4635
6024
|
* ```xml
|
|
@@ -4643,13 +6032,33 @@ const createBlip = (mediaData) => new BuilderElement({
|
|
|
4643
6032
|
*
|
|
4644
6033
|
* @example
|
|
4645
6034
|
* ```typescript
|
|
4646
|
-
*
|
|
6035
|
+
* // Crop 10% from left and right
|
|
6036
|
+
* createSourceRectangle({ l: 10000, r: 10000 });
|
|
4647
6037
|
* ```
|
|
4648
6038
|
*/
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
6039
|
+
const createSourceRectangle = (options) => {
|
|
6040
|
+
if (!options) return new BuilderElement({ name: "a:srcRect" });
|
|
6041
|
+
const attributes = {};
|
|
6042
|
+
if (options.l !== void 0) attributes.l = {
|
|
6043
|
+
key: "l",
|
|
6044
|
+
value: options.l
|
|
6045
|
+
};
|
|
6046
|
+
if (options.t !== void 0) attributes.t = {
|
|
6047
|
+
key: "t",
|
|
6048
|
+
value: options.t
|
|
6049
|
+
};
|
|
6050
|
+
if (options.r !== void 0) attributes.r = {
|
|
6051
|
+
key: "r",
|
|
6052
|
+
value: options.r
|
|
6053
|
+
};
|
|
6054
|
+
if (options.b !== void 0) attributes.b = {
|
|
6055
|
+
key: "b",
|
|
6056
|
+
value: options.b
|
|
6057
|
+
};
|
|
6058
|
+
return new BuilderElement({
|
|
6059
|
+
attributes,
|
|
6060
|
+
name: "a:srcRect"
|
|
6061
|
+
});
|
|
4653
6062
|
};
|
|
4654
6063
|
//#endregion
|
|
4655
6064
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/blip/stretch.ts
|
|
@@ -4720,9 +6129,9 @@ var Stretch = class extends XmlComponent {
|
|
|
4720
6129
|
* Represents a blip fill for pictures in DrawingML.
|
|
4721
6130
|
*
|
|
4722
6131
|
* This element specifies the type of fill used for a picture. It contains the blip (image)
|
|
4723
|
-
* reference, an optional source rectangle, and the fill mode (typically stretch).
|
|
6132
|
+
* reference, an optional source rectangle for cropping, and the fill mode (typically stretch).
|
|
4724
6133
|
*
|
|
4725
|
-
* Reference:
|
|
6134
|
+
* Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties
|
|
4726
6135
|
*
|
|
4727
6136
|
* ## XSD Schema
|
|
4728
6137
|
* ```xml
|
|
@@ -4740,13 +6149,14 @@ var Stretch = class extends XmlComponent {
|
|
|
4740
6149
|
* @example
|
|
4741
6150
|
* ```typescript
|
|
4742
6151
|
* const blipFill = new BlipFill(mediaData);
|
|
6152
|
+
* // If mediaData.srcRect is set, cropping is applied
|
|
4743
6153
|
* ```
|
|
4744
6154
|
*/
|
|
4745
6155
|
var BlipFill = class extends XmlComponent {
|
|
4746
6156
|
constructor(mediaData) {
|
|
4747
6157
|
super("pic:blipFill");
|
|
4748
6158
|
this.root.push(createBlip(mediaData));
|
|
4749
|
-
this.root.push(
|
|
6159
|
+
this.root.push(createSourceRectangle(mediaData.srcRect));
|
|
4750
6160
|
this.root.push(new Stretch());
|
|
4751
6161
|
}
|
|
4752
6162
|
};
|
|
@@ -5117,15 +6527,90 @@ var Pic = class extends XmlComponent {
|
|
|
5117
6527
|
};
|
|
5118
6528
|
//#endregion
|
|
5119
6529
|
//#region src/file/drawing/inline/graphic/graphic-data/wpg/wpg-group.ts
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
6530
|
+
/**
|
|
6531
|
+
* Creates a group transform element (a:xfrm) with optional chOff/chExt.
|
|
6532
|
+
*
|
|
6533
|
+
* This uses CT_GroupTransform2D which extends CT_Transform2D with
|
|
6534
|
+
* child offset and extent elements.
|
|
6535
|
+
*
|
|
6536
|
+
* ## XSD Schema
|
|
6537
|
+
* ```xml
|
|
6538
|
+
* <xsd:complexType name="CT_GroupTransform2D">
|
|
6539
|
+
* <xsd:sequence>
|
|
6540
|
+
* <xsd:element name="off" type="CT_Point2D" minOccurs="0"/>
|
|
6541
|
+
* <xsd:element name="ext" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
6542
|
+
* <xsd:element name="chOff" type="CT_Point2D" minOccurs="0"/>
|
|
6543
|
+
* <xsd:element name="chExt" type="CT_PositiveSize2D" minOccurs="0"/>
|
|
6544
|
+
* </xsd:sequence>
|
|
6545
|
+
* <xsd:attribute name="rot" type="ST_Angle" default="0"/>
|
|
6546
|
+
* <xsd:attribute name="flipH" type="xsd:boolean" default="false"/>
|
|
6547
|
+
* <xsd:attribute name="flipV" type="xsd:boolean" default="false"/>
|
|
6548
|
+
* </xsd:complexType>
|
|
6549
|
+
* ```
|
|
6550
|
+
*/
|
|
6551
|
+
const createGroupForm = (transform, chOff, chExt) => {
|
|
6552
|
+
var _transform$offset, _transform$offset2, _transform$flip, _transform$flip2, _transform$flip3, _transform$flip4;
|
|
6553
|
+
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)];
|
|
6554
|
+
if (chOff) children.push(new BuilderElement({
|
|
6555
|
+
attributes: {
|
|
6556
|
+
x: {
|
|
6557
|
+
key: "x",
|
|
6558
|
+
value: chOff.x
|
|
6559
|
+
},
|
|
6560
|
+
y: {
|
|
6561
|
+
key: "y",
|
|
6562
|
+
value: chOff.y
|
|
6563
|
+
}
|
|
6564
|
+
},
|
|
6565
|
+
name: "a:chOff"
|
|
6566
|
+
}));
|
|
6567
|
+
if (chExt) children.push(new BuilderElement({
|
|
6568
|
+
attributes: {
|
|
6569
|
+
cx: {
|
|
6570
|
+
key: "cx",
|
|
6571
|
+
value: chExt.cx
|
|
6572
|
+
},
|
|
6573
|
+
cy: {
|
|
6574
|
+
key: "cy",
|
|
6575
|
+
value: chExt.cy
|
|
6576
|
+
}
|
|
6577
|
+
},
|
|
6578
|
+
name: "a:chExt"
|
|
6579
|
+
}));
|
|
6580
|
+
return new BuilderElement({
|
|
6581
|
+
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 ? {
|
|
6582
|
+
...((_transform$flip3 = transform.flip) === null || _transform$flip3 === void 0 ? void 0 : _transform$flip3.horizontal) !== void 0 && { flipH: {
|
|
6583
|
+
key: "flipH",
|
|
6584
|
+
value: transform.flip.horizontal
|
|
6585
|
+
} },
|
|
6586
|
+
...((_transform$flip4 = transform.flip) === null || _transform$flip4 === void 0 ? void 0 : _transform$flip4.vertical) !== void 0 && { flipV: {
|
|
6587
|
+
key: "flipV",
|
|
6588
|
+
value: transform.flip.vertical
|
|
6589
|
+
} },
|
|
6590
|
+
...transform.rotation !== void 0 && { rot: {
|
|
6591
|
+
key: "rot",
|
|
6592
|
+
value: transform.rotation
|
|
6593
|
+
} }
|
|
6594
|
+
} : void 0,
|
|
6595
|
+
children,
|
|
6596
|
+
name: "a:xfrm"
|
|
6597
|
+
});
|
|
6598
|
+
};
|
|
6599
|
+
const createGroupProperties = (options) => {
|
|
6600
|
+
const children = [createGroupForm(options.transformation, options.chOff, options.chExt)];
|
|
6601
|
+
if (options.noFill) children.push(createNoFill());
|
|
6602
|
+
else if (options.solidFill) children.push(createSolidFill(options.solidFill));
|
|
6603
|
+
if (options.effects) children.push(createEffectList(options.effects));
|
|
6604
|
+
return new BuilderElement({
|
|
6605
|
+
children,
|
|
6606
|
+
name: "wpg:grpSpPr"
|
|
6607
|
+
});
|
|
6608
|
+
};
|
|
5124
6609
|
const createNonVisualGroupProperties = () => new BuilderElement({ name: "wpg:cNvGrpSpPr" });
|
|
5125
6610
|
const createWpgGroup = (options) => new BuilderElement({
|
|
5126
6611
|
children: [
|
|
5127
6612
|
createNonVisualGroupProperties(),
|
|
5128
|
-
createGroupProperties(options
|
|
6613
|
+
createGroupProperties(options),
|
|
5129
6614
|
...options.children
|
|
5130
6615
|
],
|
|
5131
6616
|
name: "wpg:wgp"
|
|
@@ -5174,8 +6659,9 @@ var GraphicData = class extends XmlComponent {
|
|
|
5174
6659
|
this.root.push(wps);
|
|
5175
6660
|
} else if (mediaData.type === "wpg") {
|
|
5176
6661
|
this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" }));
|
|
6662
|
+
const md = mediaData;
|
|
5177
6663
|
const wpg = createWpgGroup({
|
|
5178
|
-
children:
|
|
6664
|
+
children: md.children.map((child) => {
|
|
5179
6665
|
if (child.type === "wps") return createWpsShape({
|
|
5180
6666
|
...child.data,
|
|
5181
6667
|
outline: child.outline,
|
|
@@ -5188,7 +6674,11 @@ var GraphicData = class extends XmlComponent {
|
|
|
5188
6674
|
transform: child.transformation
|
|
5189
6675
|
});
|
|
5190
6676
|
}),
|
|
5191
|
-
transformation: transform
|
|
6677
|
+
transformation: transform,
|
|
6678
|
+
chOff: md.chOff,
|
|
6679
|
+
chExt: md.chExt,
|
|
6680
|
+
solidFill: md.solidFill,
|
|
6681
|
+
effects: md.effects
|
|
5192
6682
|
});
|
|
5193
6683
|
this.root.push(wpg);
|
|
5194
6684
|
} else {
|
|
@@ -5958,9 +7448,10 @@ var Drawing = class extends XmlComponent {
|
|
|
5958
7448
|
};
|
|
5959
7449
|
//#endregion
|
|
5960
7450
|
//#region src/file/paragraph/run/image-run.ts
|
|
5961
|
-
const createImageData = (data, transformation, key) => ({
|
|
7451
|
+
const createImageData = (data, transformation, key, srcRect) => ({
|
|
5962
7452
|
data,
|
|
5963
7453
|
fileName: key,
|
|
7454
|
+
srcRect,
|
|
5964
7455
|
transformation: {
|
|
5965
7456
|
emus: {
|
|
5966
7457
|
x: Math.round(transformation.width * 9525),
|
|
@@ -6006,7 +7497,7 @@ var ImageRun = class extends Run {
|
|
|
6006
7497
|
const fallbackData = (0, undio.toUint8Array)(options.fallback.data);
|
|
6007
7498
|
this.imageData = {
|
|
6008
7499
|
type: options.type,
|
|
6009
|
-
...createImageData(rawData, options.transformation, key),
|
|
7500
|
+
...createImageData(rawData, options.transformation, key, options.srcRect),
|
|
6010
7501
|
fallback: {
|
|
6011
7502
|
type: options.fallback.type,
|
|
6012
7503
|
...createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)
|
|
@@ -6014,7 +7505,7 @@ var ImageRun = class extends Run {
|
|
|
6014
7505
|
};
|
|
6015
7506
|
} else this.imageData = {
|
|
6016
7507
|
type: options.type,
|
|
6017
|
-
...createImageData(rawData, options.transformation, key)
|
|
7508
|
+
...createImageData(rawData, options.transformation, key, options.srcRect)
|
|
6018
7509
|
};
|
|
6019
7510
|
const drawing = new Drawing(this.imageData, {
|
|
6020
7511
|
docProperties: options.altText,
|