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