docx-plus 0.0.14 → 0.1.1

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.
@@ -8919,7 +8919,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
8919
8919
  children: [(() => {
8920
8920
  if (align) return createAlign(align);
8921
8921
  if (offset !== void 0) return createPositionOffset(offset);
8922
- return createAlign("LEFT");
8922
+ return createAlign(HorizontalPositionAlign.LEFT);
8923
8923
  })()],
8924
8924
  name: "wp:positionH"
8925
8925
  });
@@ -8980,7 +8980,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
8980
8980
  children: [(() => {
8981
8981
  if (align) return createAlign(align);
8982
8982
  if (offset !== void 0) return createPositionOffset(offset);
8983
- return createAlign("TOP");
8983
+ return createAlign(VerticalPositionAlign.TOP);
8984
8984
  })()],
8985
8985
  name: "wp:positionV"
8986
8986
  });
@@ -9694,6 +9694,44 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
9694
9694
  name: "a:solidFill"
9695
9695
  });
9696
9696
  //#endregion
9697
+ //#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/fill-overlay.ts
9698
+ /**
9699
+ * Fill overlay effect for DrawingML shapes.
9700
+ *
9701
+ * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_FillOverlayEffect
9702
+ *
9703
+ * @module
9704
+ */
9705
+ /**
9706
+ * Creates a fill overlay effect element.
9707
+ *
9708
+ * ## XSD Schema
9709
+ * ```xml
9710
+ * <xsd:complexType name="CT_FillOverlayEffect">
9711
+ * <xsd:sequence>
9712
+ * <xsd:group ref="EG_FillProperties" minOccurs="1" maxOccurs="1"/>
9713
+ * </xsd:sequence>
9714
+ * <xsd:attribute name="blend" type="ST_BlendMode" use="required"/>
9715
+ * </xsd:complexType>
9716
+ * ```
9717
+ *
9718
+ * @example
9719
+ * ```typescript
9720
+ * const fillOverlay = createFillOverlayEffect({
9721
+ * blend: BlendMode.MULTIPLY,
9722
+ * color: { value: "FF0000" },
9723
+ * });
9724
+ * ```
9725
+ */
9726
+ const createFillOverlayEffect = (options) => new BuilderElement({
9727
+ attributes: { blend: {
9728
+ key: "blend",
9729
+ value: options.blend
9730
+ } },
9731
+ children: [createSolidFill(options.color)],
9732
+ name: "a:fillOverlay"
9733
+ });
9734
+ //#endregion
9697
9735
  //#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/glow.ts
9698
9736
  /**
9699
9737
  * Glow effect for DrawingML shapes.
@@ -9730,7 +9768,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
9730
9768
  });
9731
9769
  };
9732
9770
  //#endregion
9733
- //#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/inner-shdw.ts
9771
+ //#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/inner-shadow.ts
9734
9772
  /**
9735
9773
  * Inner shadow effect for DrawingML shapes.
9736
9774
  *
@@ -9778,7 +9816,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
9778
9816
  });
9779
9817
  };
9780
9818
  //#endregion
9781
- //#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/outer-shdw.ts
9819
+ //#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/outer-shadow.ts
9782
9820
  /**
9783
9821
  * Outer shadow effect for DrawingML shapes.
9784
9822
  *
@@ -9866,7 +9904,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
9866
9904
  });
9867
9905
  };
9868
9906
  //#endregion
9869
- //#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/prst-shdw.ts
9907
+ //#region src/file/drawing/inline/graphic/graphic-data/pic/shape-properties/effects/preset-shadow.ts
9870
9908
  /**
9871
9909
  * Preset shadow effect for DrawingML shapes.
9872
9910
  *
@@ -10120,10 +10158,11 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
10120
10158
  const createEffectList = (options) => {
10121
10159
  const children = [];
10122
10160
  if (options.blur) children.push(createBlurEffect(options.blur));
10161
+ if (options.fillOverlay) children.push(createFillOverlayEffect(options.fillOverlay));
10123
10162
  if (options.glow) children.push(createGlowEffect(options.glow));
10124
- if (options.innerShdw) children.push(createInnerShadowEffect(options.innerShdw));
10125
- if (options.outerShdw) children.push(createOuterShadowEffect(options.outerShdw));
10126
- if (options.prstShdw) children.push(createPresetShadowEffect(options.prstShdw));
10163
+ if (options.innerShadow) children.push(createInnerShadowEffect(options.innerShadow));
10164
+ if (options.outerShadow) children.push(createOuterShadowEffect(options.outerShadow));
10165
+ if (options.presetShadow) children.push(createPresetShadowEffect(options.presetShadow));
10127
10166
  if (options.reflection) children.push(createReflectionEffect(options.reflection === true ? void 0 : options.reflection));
10128
10167
  if (options.softEdge !== void 0) children.push(createSoftEdgeEffect(options.softEdge));
10129
10168
  return new BuilderElement({
@@ -10914,12 +10953,12 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
10914
10953
  const children = [];
10915
10954
  if (options.bevelT) children.push(createBevel(options.bevelT));
10916
10955
  if (options.bevelB) children.push(createBottomBevel(options.bevelB));
10917
- if (options.extrusionClr) children.push(new BuilderElement({
10918
- children: [createColorElement(options.extrusionClr)],
10956
+ if (options.extrusionColor) children.push(new BuilderElement({
10957
+ children: [createColorElement(options.extrusionColor)],
10919
10958
  name: "a:extrusionClr"
10920
10959
  }));
10921
- if (options.contourClr) children.push(new BuilderElement({
10922
- children: [createColorElement(options.contourClr)],
10960
+ if (options.contourColor) children.push(new BuilderElement({
10961
+ children: [createColorElement(options.contourColor)],
10923
10962
  name: "a:contourClr"
10924
10963
  }));
10925
10964
  return new BuilderElement({
@@ -11105,6 +11144,158 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11105
11144
  }
11106
11145
  };
11107
11146
  //#endregion
11147
+ //#region src/file/drawing/inline/graphic/graphic-data/pic/blip/blip-effects.ts
11148
+ /**
11149
+ * Blip image adjustment effects for DrawingML.
11150
+ *
11151
+ * These effects are applied directly to the image data within the `<a:blip>` element,
11152
+ * corresponding to Word's "Picture Format > Adjust" features (brightness, contrast,
11153
+ * grayscale, tint, duotone, etc.).
11154
+ *
11155
+ * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Blip children
11156
+ *
11157
+ * @module
11158
+ */
11159
+ /**
11160
+ * Creates blip effect elements from BlipEffectsOptions.
11161
+ *
11162
+ * @returns Array of XML components representing blip effects
11163
+ */
11164
+ const createBlipEffects = (options) => {
11165
+ const children = [];
11166
+ if (options.grayscale) children.push(new BuilderElement({ name: "a:grayscl" }));
11167
+ if (options.luminance) {
11168
+ const attrs = {};
11169
+ if (options.luminance.bright !== void 0) attrs.bright = {
11170
+ key: "bright",
11171
+ value: `${options.luminance.bright}%`
11172
+ };
11173
+ if (options.luminance.contrast !== void 0) attrs.contrast = {
11174
+ key: "contrast",
11175
+ value: `${options.luminance.contrast}%`
11176
+ };
11177
+ children.push(new BuilderElement({
11178
+ attributes: attrs,
11179
+ name: "a:lum"
11180
+ }));
11181
+ }
11182
+ if (options.hsl) {
11183
+ const attrs = {};
11184
+ if (options.hsl.hue !== void 0) attrs.hue = {
11185
+ key: "hue",
11186
+ value: String(options.hsl.hue)
11187
+ };
11188
+ if (options.hsl.sat !== void 0) attrs.sat = {
11189
+ key: "sat",
11190
+ value: `${options.hsl.sat}%`
11191
+ };
11192
+ if (options.hsl.lum !== void 0) attrs.lum = {
11193
+ key: "lum",
11194
+ value: `${options.hsl.lum}%`
11195
+ };
11196
+ children.push(new BuilderElement({
11197
+ attributes: attrs,
11198
+ name: "a:hsl"
11199
+ }));
11200
+ }
11201
+ if (options.tint) {
11202
+ const attrs = {};
11203
+ if (options.tint.hue !== void 0) attrs.hue = {
11204
+ key: "hue",
11205
+ value: String(options.tint.hue)
11206
+ };
11207
+ if (options.tint.amt !== void 0) attrs.amt = {
11208
+ key: "amt",
11209
+ value: `${options.tint.amt}%`
11210
+ };
11211
+ children.push(new BuilderElement({
11212
+ attributes: attrs,
11213
+ name: "a:tint"
11214
+ }));
11215
+ }
11216
+ if (options.duotone) children.push(new BuilderElement({
11217
+ children: [createColorElement(options.duotone.color1), createColorElement(options.duotone.color2)],
11218
+ name: "a:duotone"
11219
+ }));
11220
+ if (options.biLevel) children.push(new BuilderElement({
11221
+ attributes: { thresh: {
11222
+ key: "thresh",
11223
+ value: `${options.biLevel.thresh}%`
11224
+ } },
11225
+ name: "a:biLevel"
11226
+ }));
11227
+ if (options.alphaCeiling) children.push(new BuilderElement({ name: "a:alphaCeiling" }));
11228
+ if (options.alphaFloor) children.push(new BuilderElement({ name: "a:alphaFloor" }));
11229
+ if (options.alphaInverse !== void 0) if (typeof options.alphaInverse === "boolean") children.push(new BuilderElement({ name: "a:alphaInv" }));
11230
+ else children.push(new BuilderElement({
11231
+ children: [createColorElement(options.alphaInverse)],
11232
+ name: "a:alphaInv"
11233
+ }));
11234
+ if (options.alphaModFix) {
11235
+ var _options$alphaModFix$;
11236
+ const amt = (_options$alphaModFix$ = options.alphaModFix.amount) !== null && _options$alphaModFix$ !== void 0 ? _options$alphaModFix$ : 100;
11237
+ children.push(new BuilderElement({
11238
+ attributes: { amt: {
11239
+ key: "amt",
11240
+ value: `${amt}%`
11241
+ } },
11242
+ name: "a:alphaModFix"
11243
+ }));
11244
+ }
11245
+ if (options.alphaRepl) children.push(new BuilderElement({
11246
+ attributes: { a: {
11247
+ key: "a",
11248
+ value: `${options.alphaRepl.amount}%`
11249
+ } },
11250
+ name: "a:alphaRepl"
11251
+ }));
11252
+ if (options.alphaBiLevel) children.push(new BuilderElement({
11253
+ attributes: { thresh: {
11254
+ key: "thresh",
11255
+ value: `${options.alphaBiLevel.thresh}%`
11256
+ } },
11257
+ name: "a:alphaBiLevel"
11258
+ }));
11259
+ if (options.colorChange) {
11260
+ const attrs = {};
11261
+ if (options.colorChange.useAlpha === false) attrs.useA = {
11262
+ key: "useA",
11263
+ value: "0"
11264
+ };
11265
+ children.push(new BuilderElement({
11266
+ attributes: attrs,
11267
+ children: [new BuilderElement({
11268
+ children: [createColorElement(options.colorChange.from)],
11269
+ name: "a:clrFrom"
11270
+ }), new BuilderElement({
11271
+ children: [createColorElement(options.colorChange.to)],
11272
+ name: "a:clrTo"
11273
+ })],
11274
+ name: "a:clrChange"
11275
+ }));
11276
+ }
11277
+ if (options.colorRepl) children.push(new BuilderElement({
11278
+ children: [createColorElement(options.colorRepl.color)],
11279
+ name: "a:clrRepl"
11280
+ }));
11281
+ if (options.blur) {
11282
+ const attrs = {};
11283
+ if (options.blur.rad !== void 0) attrs.rad = {
11284
+ key: "rad",
11285
+ value: options.blur.rad
11286
+ };
11287
+ if (options.blur.grow === false) attrs.grow = {
11288
+ key: "grow",
11289
+ value: 0
11290
+ };
11291
+ children.push(new BuilderElement({
11292
+ attributes: attrs,
11293
+ name: "a:blur"
11294
+ }));
11295
+ }
11296
+ return children;
11297
+ };
11298
+ //#endregion
11108
11299
  //#region src/file/drawing/inline/graphic/graphic-data/pic/blip/blip-extentions.ts
11109
11300
  /**
11110
11301
  * Creates an SVG blip element for embedding SVG images.
@@ -11214,20 +11405,25 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11214
11405
  * @param mediaData - The media data containing the image information
11215
11406
  * @returns An XML component representing the blip element
11216
11407
  */
11217
- const createBlip = (mediaData) => new BuilderElement({
11218
- attributes: {
11219
- cstate: {
11220
- key: "cstate",
11221
- value: "none"
11408
+ const createBlip = (mediaData, blipEffects) => {
11409
+ const children = [];
11410
+ if (blipEffects) children.push(...createBlipEffects(blipEffects));
11411
+ if (mediaData.type === "svg") children.push(createExtentionList(mediaData));
11412
+ return new BuilderElement({
11413
+ attributes: {
11414
+ cstate: {
11415
+ key: "cstate",
11416
+ value: "none"
11417
+ },
11418
+ embed: {
11419
+ key: "r:embed",
11420
+ value: `rId{${mediaData.type === "svg" ? mediaData.fallback.fileName : mediaData.fileName}}`
11421
+ }
11222
11422
  },
11223
- embed: {
11224
- key: "r:embed",
11225
- value: `rId{${mediaData.type === "svg" ? mediaData.fallback.fileName : mediaData.fileName}}`
11226
- }
11227
- },
11228
- children: mediaData.type === "svg" ? [createExtentionList(mediaData)] : [],
11229
- name: "a:blip"
11230
- });
11423
+ children,
11424
+ name: "a:blip"
11425
+ });
11426
+ };
11231
11427
  //#endregion
11232
11428
  //#region src/file/drawing/inline/graphic/graphic-data/pic/blip/source-rectangle.ts
11233
11429
  /**
@@ -11351,6 +11547,106 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11351
11547
  }
11352
11548
  };
11353
11549
  //#endregion
11550
+ //#region src/file/drawing/inline/graphic/graphic-data/pic/blip/tile.ts
11551
+ /**
11552
+ * Tile fill module for blip fills.
11553
+ *
11554
+ * This module defines how images are tiled (repeated) to fill shapes.
11555
+ *
11556
+ * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TileInfoProperties
11557
+ *
11558
+ * @module
11559
+ */
11560
+ /**
11561
+ * Tile flip mode for tiling images.
11562
+ *
11563
+ * Specifies whether the image is flipped along the x-axis, y-axis,
11564
+ * both axes, or not at all when tiling.
11565
+ */
11566
+ const TileFlipMode = {
11567
+ NONE: "none",
11568
+ X: "x",
11569
+ Y: "y",
11570
+ XY: "xy"
11571
+ };
11572
+ /**
11573
+ * Tile alignment within the shape.
11574
+ *
11575
+ * Specifies the anchor position of the first tile relative to the shape.
11576
+ */
11577
+ const TileAlignment = {
11578
+ TOP_LEFT: "tl",
11579
+ TOP: "t",
11580
+ TOP_RIGHT: "tr",
11581
+ LEFT: "l",
11582
+ CENTER: "ctr",
11583
+ RIGHT: "r",
11584
+ BOTTOM_LEFT: "bl",
11585
+ BOTTOM: "b",
11586
+ BOTTOM_RIGHT: "br"
11587
+ };
11588
+ /**
11589
+ * Creates a tile fill mode element for blip fills.
11590
+ *
11591
+ * When a blip fill uses tile mode, the image is repeated (tiled) to fill
11592
+ * the shape instead of being stretched. This element controls the tiling
11593
+ * parameters such as offset, scale, flip, and alignment.
11594
+ *
11595
+ * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TileInfoProperties
11596
+ *
11597
+ * ## XSD Schema
11598
+ * ```xml
11599
+ * <xsd:complexType name="CT_TileInfoProperties">
11600
+ * <xsd:attribute name="tx" type="ST_Coordinate" use="optional"/>
11601
+ * <xsd:attribute name="ty" type="ST_Coordinate" use="optional"/>
11602
+ * <xsd:attribute name="sx" type="ST_Percentage" use="optional"/>
11603
+ * <xsd:attribute name="sy" type="ST_Percentage" use="optional"/>
11604
+ * <xsd:attribute name="flip" type="ST_TileFlipMode" default="none"/>
11605
+ * <xsd:attribute name="algn" type="ST_RectAlignment" use="optional"/>
11606
+ * </xsd:complexType>
11607
+ * ```
11608
+ *
11609
+ * @example
11610
+ * ```typescript
11611
+ * // Tile with 50% scale
11612
+ * createTileInfo({ sx: 50, sy: 50 });
11613
+ * // Tile with flip and alignment
11614
+ * createTileInfo({ flip: "XY", align: "CENTER" });
11615
+ * ```
11616
+ */
11617
+ const createTileInfo = (options) => {
11618
+ if (!options) return new BuilderElement({ name: "a:tile" });
11619
+ const attributes = {};
11620
+ if (options.tx !== void 0) attributes.tx = {
11621
+ key: "tx",
11622
+ value: options.tx
11623
+ };
11624
+ if (options.ty !== void 0) attributes.ty = {
11625
+ key: "ty",
11626
+ value: options.ty
11627
+ };
11628
+ if (options.sx !== void 0) attributes.sx = {
11629
+ key: "sx",
11630
+ value: options.sx
11631
+ };
11632
+ if (options.sy !== void 0) attributes.sy = {
11633
+ key: "sy",
11634
+ value: options.sy
11635
+ };
11636
+ if (options.flip !== void 0) attributes.flip = {
11637
+ key: "flip",
11638
+ value: TileFlipMode[options.flip]
11639
+ };
11640
+ if (options.align !== void 0) attributes.algn = {
11641
+ key: "algn",
11642
+ value: TileAlignment[options.align]
11643
+ };
11644
+ return new BuilderElement({
11645
+ attributes: Object.keys(attributes).length > 0 ? attributes : void 0,
11646
+ name: "a:tile"
11647
+ });
11648
+ };
11649
+ //#endregion
11354
11650
  //#region src/file/drawing/inline/graphic/graphic-data/pic/blip/blip-fill.ts
11355
11651
  /**
11356
11652
  * Represents a blip fill for pictures in DrawingML.
@@ -11379,12 +11675,48 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11379
11675
  * // If mediaData.srcRect is set, cropping is applied
11380
11676
  * ```
11381
11677
  */
11382
- var BlipFill = class extends XmlComponent {
11383
- constructor(mediaData) {
11384
- super("pic:blipFill");
11385
- this.root.push(createBlip(mediaData));
11386
- this.root.push(createSourceRectangle(mediaData.srcRect));
11387
- this.root.push(new Stretch());
11678
+ const createBlipFill = (mediaData, options) => {
11679
+ const children = [];
11680
+ children.push(createBlip(mediaData, options === null || options === void 0 ? void 0 : options.blipEffects));
11681
+ children.push(createSourceRectangle(mediaData.srcRect));
11682
+ if (options === null || options === void 0 ? void 0 : options.tile) children.push(createTileInfo(options.tile));
11683
+ else children.push(new Stretch());
11684
+ const attributes = {};
11685
+ if ((options === null || options === void 0 ? void 0 : options.dpi) !== void 0) attributes.dpi = {
11686
+ key: "dpi",
11687
+ value: options.dpi
11688
+ };
11689
+ if ((options === null || options === void 0 ? void 0 : options.rotWithShape) !== void 0) attributes.rotWithShape = {
11690
+ key: "rotWithShape",
11691
+ value: options.rotWithShape ? 1 : 0
11692
+ };
11693
+ return new BuilderElement({
11694
+ attributes: Object.keys(attributes).length > 0 ? attributes : void 0,
11695
+ children,
11696
+ name: "pic:blipFill"
11697
+ });
11698
+ };
11699
+ //#endregion
11700
+ //#region src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/child-non-visual-pic-properties/child-non-visual-pic-properties-attributes.ts
11701
+ /**
11702
+ * Attributes for non-visual picture properties.
11703
+ *
11704
+ * @module
11705
+ */
11706
+ /**
11707
+ * Attributes for CT_NonVisualPictureProperties.
11708
+ *
11709
+ * ## XSD Schema
11710
+ * ```xml
11711
+ * <xsd:attribute name="preferRelativeResize" type="xsd:boolean" use="optional" default="true"/>
11712
+ * ```
11713
+ *
11714
+ * @internal
11715
+ */
11716
+ var ChildNonVisualPropertiesAttributes = class extends XmlAttributeComponent {
11717
+ constructor(..._args) {
11718
+ super(..._args);
11719
+ _defineProperty(this, "xmlKeys", { preferRelativeResize: "preferRelativeResize" });
11388
11720
  }
11389
11721
  };
11390
11722
  //#endregion
@@ -11509,6 +11841,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11509
11841
  var ChildNonVisualProperties = class extends XmlComponent {
11510
11842
  constructor() {
11511
11843
  super("pic:cNvPicPr");
11844
+ this.root.push(new ChildNonVisualPropertiesAttributes({ preferRelativeResize: true }));
11512
11845
  this.root.push(new PicLocks());
11513
11846
  }
11514
11847
  };
@@ -11557,6 +11890,85 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11557
11890
  },
11558
11891
  name: "a:hlinkClick"
11559
11892
  });
11893
+ /**
11894
+ * Creates a hover hyperlink element for a drawing.
11895
+ *
11896
+ * This element defines what happens when a user hovers over a drawing element.
11897
+ *
11898
+ * ## XSD Schema
11899
+ * ```xml
11900
+ * <xsd:complexType name="CT_Hyperlink">
11901
+ * <xsd:group ref="EG_PContent" minOccurs="0" maxOccurs="unbounded"/>
11902
+ * <xsd:attribute name="tgtFrame" type="s:ST_String"/>
11903
+ * <xsd:attribute name="tooltip" type="s:ST_String"/>
11904
+ * <xsd:attribute name="docLocation" type="s:ST_String"/>
11905
+ * <xsd:attribute name="history" type="s:ST_OnOff"/>
11906
+ * <xsd:attribute name="anchor" type="s:ST_String"/>
11907
+ * <xsd:attribute ref="r:id"/>
11908
+ * </xsd:complexType>
11909
+ * ```
11910
+ *
11911
+ * @param linkId - The relationship ID for the hyperlink target
11912
+ * @param hasXmlNs - Whether to include the XML namespace declaration
11913
+ * @returns An XML component representing the hover hyperlink
11914
+ */
11915
+ const createHyperlinkHover = (linkId, hasXmlNs) => new BuilderElement({
11916
+ attributes: {
11917
+ ...hasXmlNs ? { xmlns: {
11918
+ key: "xmlns:a",
11919
+ value: "http://schemas.openxmlformats.org/drawingml/2006/main"
11920
+ } } : {},
11921
+ id: {
11922
+ key: "r:id",
11923
+ value: `rId${linkId}`
11924
+ }
11925
+ },
11926
+ name: "a:hlinkHover"
11927
+ });
11928
+ //#endregion
11929
+ //#region src/file/relationships/relationship/relationship.ts
11930
+ /**
11931
+ * Target mode types for relationships.
11932
+ *
11933
+ * Indicates whether a relationship target is external to the package.
11934
+ */
11935
+ const TargetModeType = { EXTERNAL: "External" };
11936
+ /**
11937
+ * Creates a single relationship between parts in an OPC package.
11938
+ *
11939
+ * A relationship defines a typed connection from a source part to a target part,
11940
+ * identified by a unique ID within the relationships collection.
11941
+ *
11942
+ * @example
11943
+ * ```typescript
11944
+ * // Internal relationship to an image
11945
+ * createRelationship("rId1", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", "media/image1.png");
11946
+ *
11947
+ * // External relationship to a hyperlink
11948
+ * createRelationship("rId2", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", "https://example.com", TargetModeType.EXTERNAL);
11949
+ * ```
11950
+ */
11951
+ const createRelationship = (id, type, target, targetMode) => new BuilderElement({
11952
+ attributes: {
11953
+ id: {
11954
+ key: "Id",
11955
+ value: id
11956
+ },
11957
+ target: {
11958
+ key: "Target",
11959
+ value: target
11960
+ },
11961
+ targetMode: {
11962
+ key: "TargetMode",
11963
+ value: targetMode
11964
+ },
11965
+ type: {
11966
+ key: "Type",
11967
+ value: type
11968
+ }
11969
+ },
11970
+ name: "Relationship"
11971
+ });
11560
11972
  //#endregion
11561
11973
  //#region src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-properties/non-visual-properties-attributes.ts
11562
11974
  /**
@@ -11586,16 +11998,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11586
11998
  };
11587
11999
  //#endregion
11588
12000
  //#region src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-properties/non-visual-properties.ts
11589
- /**
11590
- * Non-visual drawing properties module.
11591
- *
11592
- * This module provides basic metadata for drawing elements including
11593
- * ID, name, description, and hyperlink support.
11594
- *
11595
- * Reference: http://officeopenxml.com/drwPic.php
11596
- *
11597
- * @module
11598
- */
12001
+ const HYPERLINK_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
11599
12002
  /**
11600
12003
  * Represents non-visual drawing properties for pictures.
11601
12004
  *
@@ -11626,8 +12029,10 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11626
12029
  * ```
11627
12030
  */
11628
12031
  var NonVisualProperties = class extends XmlComponent {
11629
- constructor() {
12032
+ constructor(hyperlink) {
11630
12033
  super("pic:cNvPr");
12034
+ _defineProperty(this, "hyperlink", void 0);
12035
+ this.hyperlink = hyperlink;
11631
12036
  this.root.push(new NonVisualPropertiesAttributes({
11632
12037
  descr: "",
11633
12038
  id: 0,
@@ -11635,28 +12040,32 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11635
12040
  }));
11636
12041
  }
11637
12042
  prepForXml(context) {
12043
+ let hasStackClick = false;
11638
12044
  for (let i = context.stack.length - 1; i >= 0; i--) {
11639
12045
  const element = context.stack[i];
11640
12046
  if (!(element instanceof ConcreteHyperlink)) continue;
11641
12047
  this.root.push(createHyperlinkClick(element.linkId, false));
12048
+ hasStackClick = true;
11642
12049
  break;
11643
12050
  }
12051
+ if (this.hyperlink) {
12052
+ if (this.hyperlink.click && !hasStackClick) {
12053
+ const linkId = uniqueId();
12054
+ context.viewWrapper.Relationships.addRelationship(linkId, HYPERLINK_RELATIONSHIP_TYPE$1, this.hyperlink.click, TargetModeType.EXTERNAL);
12055
+ this.root.push(createHyperlinkClick(linkId, false));
12056
+ }
12057
+ if (this.hyperlink.hover) {
12058
+ const linkId = uniqueId();
12059
+ context.viewWrapper.Relationships.addRelationship(linkId, HYPERLINK_RELATIONSHIP_TYPE$1, this.hyperlink.hover, TargetModeType.EXTERNAL);
12060
+ this.root.push(createHyperlinkHover(linkId, false));
12061
+ }
12062
+ }
11644
12063
  return super.prepForXml(context);
11645
12064
  }
11646
12065
  };
11647
12066
  //#endregion
11648
12067
  //#region src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-pic-properties.ts
11649
12068
  /**
11650
- * Non-visual picture properties module.
11651
- *
11652
- * This module provides metadata and locking settings for pictures
11653
- * that don't affect their visual appearance.
11654
- *
11655
- * Reference: http://officeopenxml.com/drwPic.php
11656
- *
11657
- * @module
11658
- */
11659
- /**
11660
12069
  * Represents non-visual picture properties.
11661
12070
  *
11662
12071
  * This element specifies non-visual properties for a picture. These properties
@@ -11681,9 +12090,9 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11681
12090
  * ```
11682
12091
  */
11683
12092
  var NonVisualPicProperties = class extends XmlComponent {
11684
- constructor() {
12093
+ constructor(hyperlink) {
11685
12094
  super("pic:nvPicPr");
11686
- this.root.push(new NonVisualProperties());
12095
+ this.root.push(new NonVisualProperties(hyperlink));
11687
12096
  this.root.push(new ChildNonVisualProperties());
11688
12097
  }
11689
12098
  };
@@ -11740,14 +12149,19 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11740
12149
  * ```
11741
12150
  */
11742
12151
  var Pic = class extends XmlComponent {
11743
- constructor({ mediaData, transform, outline }) {
12152
+ constructor({ mediaData, transform, outline, solidFill, effects, blipEffects, tile, hyperlink }) {
11744
12153
  super("pic:pic");
11745
12154
  this.root.push(new PicAttributes({ xmlns: "http://schemas.openxmlformats.org/drawingml/2006/picture" }));
11746
- this.root.push(new NonVisualPicProperties());
11747
- this.root.push(new BlipFill(mediaData));
12155
+ this.root.push(new NonVisualPicProperties(hyperlink));
12156
+ this.root.push(createBlipFill(mediaData, {
12157
+ blipEffects,
12158
+ tile
12159
+ }));
11748
12160
  this.root.push(new ShapeProperties({
11749
12161
  element: "pic",
12162
+ effects,
11750
12163
  outline,
12164
+ solidFill,
11751
12165
  transform
11752
12166
  }));
11753
12167
  }
@@ -11873,7 +12287,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11873
12287
  * ```
11874
12288
  */
11875
12289
  var GraphicData = class extends XmlComponent {
11876
- constructor({ mediaData, transform, outline, solidFill }) {
12290
+ constructor({ mediaData, transform, outline, solidFill, effects, blipEffects, tile, hyperlink }) {
11877
12291
  super("a:graphicData");
11878
12292
  if (mediaData.type === "wps") {
11879
12293
  this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" }));
@@ -11911,8 +12325,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11911
12325
  } else {
11912
12326
  this.root.push(new GraphicDataAttributes({ uri: "http://schemas.openxmlformats.org/drawingml/2006/picture" }));
11913
12327
  const pic = new Pic({
12328
+ blipEffects,
12329
+ effects,
12330
+ hyperlink,
11914
12331
  mediaData,
11915
12332
  outline,
12333
+ solidFill,
12334
+ tile,
11916
12335
  transform
11917
12336
  });
11918
12337
  this.root.push(pic);
@@ -11958,14 +12377,18 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
11958
12377
  * ```
11959
12378
  */
11960
12379
  var Graphic = class extends XmlComponent {
11961
- constructor({ mediaData, transform, outline, solidFill }) {
12380
+ constructor({ mediaData, transform, outline, solidFill, effects, blipEffects, tile, hyperlink }) {
11962
12381
  super("a:graphic");
11963
12382
  _defineProperty(this, "data", void 0);
11964
12383
  this.root.push(new GraphicAttributes({ a: "http://schemas.openxmlformats.org/drawingml/2006/main" }));
11965
12384
  this.data = new GraphicData({
12385
+ blipEffects,
12386
+ effects,
12387
+ hyperlink,
11966
12388
  mediaData,
11967
12389
  outline,
11968
12390
  solidFill,
12391
+ tile,
11969
12392
  transform
11970
12393
  });
11971
12394
  this.root.push(this.data);
@@ -12187,12 +12610,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
12187
12610
  * Document Properties module for DrawingML elements.
12188
12611
  *
12189
12612
  * This module provides non-visual properties for drawing elements,
12190
- * including name, description, and accessibility information.
12613
+ * including name, description, accessibility information, and hyperlinks.
12191
12614
  *
12192
12615
  * Reference: https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_docPr_topic_ID0ES32OB.html
12193
12616
  *
12194
12617
  * @module
12195
12618
  */
12619
+ const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
12196
12620
  /**
12197
12621
  * Represents non-visual drawing properties in a WordprocessingML document.
12198
12622
  *
@@ -12217,13 +12641,15 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
12217
12641
  * ```
12218
12642
  */
12219
12643
  var DocProperties = class extends XmlComponent {
12220
- constructor({ name, description, title, id } = {
12644
+ constructor({ name, description, title, id, hyperlink } = {
12221
12645
  description: "",
12222
12646
  name: "",
12223
12647
  title: ""
12224
12648
  }) {
12225
12649
  super("wp:docPr");
12226
12650
  _defineProperty(this, "docPropertiesUniqueNumericId", docPropertiesUniqueNumericIdGen());
12651
+ _defineProperty(this, "hyperlink", void 0);
12652
+ this.hyperlink = hyperlink;
12227
12653
  const attributes = {
12228
12654
  id: {
12229
12655
  key: "id",
@@ -12245,12 +12671,26 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
12245
12671
  this.root.push(new NextAttributeComponent(attributes));
12246
12672
  }
12247
12673
  prepForXml(context) {
12674
+ let hasStackClick = false;
12248
12675
  for (let i = context.stack.length - 1; i >= 0; i--) {
12249
12676
  const element = context.stack[i];
12250
12677
  if (!(element instanceof ConcreteHyperlink)) continue;
12251
12678
  this.root.push(createHyperlinkClick(element.linkId, true));
12679
+ hasStackClick = true;
12252
12680
  break;
12253
12681
  }
12682
+ if (this.hyperlink) {
12683
+ if (this.hyperlink.click && !hasStackClick) {
12684
+ const linkId = uniqueId();
12685
+ context.viewWrapper.Relationships.addRelationship(linkId, HYPERLINK_RELATIONSHIP_TYPE, this.hyperlink.click, TargetModeType.EXTERNAL);
12686
+ this.root.push(createHyperlinkClick(linkId, true));
12687
+ }
12688
+ if (this.hyperlink.hover) {
12689
+ const linkId = uniqueId();
12690
+ context.viewWrapper.Relationships.addRelationship(linkId, HYPERLINK_RELATIONSHIP_TYPE, this.hyperlink.hover, TargetModeType.EXTERNAL);
12691
+ this.root.push(createHyperlinkHover(linkId, true));
12692
+ }
12693
+ }
12254
12694
  return super.prepForXml(context);
12255
12695
  }
12256
12696
  };
@@ -12526,6 +12966,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
12526
12966
  */
12527
12967
  var Anchor = class extends XmlComponent {
12528
12968
  constructor({ mediaData, transform, drawingOptions }) {
12969
+ var _drawingOptions$docPr;
12529
12970
  super("wp:anchor");
12530
12971
  const floating = {
12531
12972
  allowOverlap: true,
@@ -12578,16 +13019,20 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
12578
13019
  this.root.push(new DocProperties(drawingOptions.docProperties));
12579
13020
  this.root.push(createGraphicFrameProperties());
12580
13021
  this.root.push(new Graphic({
13022
+ blipEffects: drawingOptions.blipEffects,
13023
+ effects: drawingOptions.effects,
13024
+ hyperlink: (_drawingOptions$docPr = drawingOptions.docProperties) === null || _drawingOptions$docPr === void 0 ? void 0 : _drawingOptions$docPr.hyperlink,
12581
13025
  mediaData,
12582
13026
  outline: drawingOptions.outline,
12583
13027
  solidFill: drawingOptions.solidFill,
13028
+ tile: drawingOptions.tile,
12584
13029
  transform
12585
13030
  }));
12586
13031
  }
12587
13032
  };
12588
13033
  //#endregion
12589
13034
  //#region src/file/drawing/inline/inline.ts
12590
- const createInline = ({ mediaData, transform, docProperties, outline, solidFill }) => {
13035
+ const createInline = ({ mediaData, transform, docProperties, outline, solidFill, effects, blipEffects, tile }) => {
12591
13036
  var _outline$width, _outline$width2, _outline$width3, _outline$width4;
12592
13037
  return new BuilderElement({
12593
13038
  attributes: {
@@ -12627,9 +13072,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
12627
13072
  new DocProperties(docProperties),
12628
13073
  createGraphicFrameProperties(),
12629
13074
  new Graphic({
13075
+ blipEffects,
13076
+ effects,
13077
+ hyperlink: docProperties === null || docProperties === void 0 ? void 0 : docProperties.hyperlink,
12630
13078
  mediaData,
12631
13079
  outline,
12632
13080
  solidFill,
13081
+ tile,
12633
13082
  transform
12634
13083
  })
12635
13084
  ],
@@ -12660,10 +13109,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
12660
13109
  constructor(imageData, drawingOptions = {}) {
12661
13110
  super("w:drawing");
12662
13111
  if (!drawingOptions.floating) this.root.push(createInline({
13112
+ blipEffects: drawingOptions.blipEffects,
12663
13113
  docProperties: drawingOptions.docProperties,
13114
+ effects: drawingOptions.effects,
12664
13115
  mediaData: imageData,
12665
13116
  outline: drawingOptions.outline,
12666
13117
  solidFill: drawingOptions.solidFill,
13118
+ tile: drawingOptions.tile,
12667
13119
  transform: imageData.transformation
12668
13120
  }));
12669
13121
  else this.root.push(new Anchor({
@@ -12809,9 +13261,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
12809
13261
  ...createImageData(rawData, options.transformation, key, options.srcRect)
12810
13262
  };
12811
13263
  const drawing = new Drawing(this.imageData, {
13264
+ blipEffects: options.blipEffects,
12812
13265
  docProperties: options.altText,
12813
13266
  floating: options.floating,
12814
- outline: options.outline
13267
+ outline: options.outline,
13268
+ solidFill: options.solidFill,
13269
+ effects: options.effects,
13270
+ tile: options.tile
12815
13271
  });
12816
13272
  this.root.push(drawing);
12817
13273
  }
@@ -13065,50 +13521,6 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
13065
13521
  }
13066
13522
  };
13067
13523
  //#endregion
13068
- //#region src/file/relationships/relationship/relationship.ts
13069
- /**
13070
- * Target mode types for relationships.
13071
- *
13072
- * Indicates whether a relationship target is external to the package.
13073
- */
13074
- const TargetModeType = { EXTERNAL: "External" };
13075
- /**
13076
- * Creates a single relationship between parts in an OPC package.
13077
- *
13078
- * A relationship defines a typed connection from a source part to a target part,
13079
- * identified by a unique ID within the relationships collection.
13080
- *
13081
- * @example
13082
- * ```typescript
13083
- * // Internal relationship to an image
13084
- * createRelationship("rId1", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", "media/image1.png");
13085
- *
13086
- * // External relationship to a hyperlink
13087
- * createRelationship("rId2", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", "https://example.com", TargetModeType.EXTERNAL);
13088
- * ```
13089
- */
13090
- const createRelationship = (id, type, target, targetMode) => new BuilderElement({
13091
- attributes: {
13092
- id: {
13093
- key: "Id",
13094
- value: id
13095
- },
13096
- target: {
13097
- key: "Target",
13098
- value: target
13099
- },
13100
- targetMode: {
13101
- key: "TargetMode",
13102
- value: targetMode
13103
- },
13104
- type: {
13105
- key: "Type",
13106
- value: type
13107
- }
13108
- },
13109
- name: "Relationship"
13110
- });
13111
- //#endregion
13112
13524
  //#region src/file/relationships/relationships.ts
13113
13525
  /**
13114
13526
  * Relationships module for Open Packaging Conventions.
@@ -19412,6 +19824,11 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
19412
19824
  this.root.push(createDefault("image/jpeg", "jpg"));
19413
19825
  this.root.push(createDefault("image/bmp", "bmp"));
19414
19826
  this.root.push(createDefault("image/gif", "gif"));
19827
+ this.root.push(createDefault("image/tiff", "tif"));
19828
+ this.root.push(createDefault("image/tiff", "tiff"));
19829
+ this.root.push(createDefault("image/x-emf", "emf"));
19830
+ this.root.push(createDefault("image/x-wmf", "wmf"));
19831
+ this.root.push(createDefault("image/x-icon", "ico"));
19415
19832
  this.root.push(createDefault("image/svg+xml", "svg"));
19416
19833
  this.root.push(createDefault("application/vnd.openxmlformats-package.relationships+xml", "rels"));
19417
19834
  this.root.push(createDefault("application/xml", "xml"));