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