docx-plus 0.0.13 → 0.1.0
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 +4 -1
- package/dist/index.cjs +533 -117
- package/dist/index.d.cts +123 -15
- package/dist/index.d.mts +123 -15
- package/dist/index.iife.js +533 -117
- package/dist/index.mjs +533 -117
- package/dist/index.umd.js +533 -117
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -8918,8 +8918,8 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
8918
8918
|
} },
|
|
8919
8919
|
children: [(() => {
|
|
8920
8920
|
if (align) return createAlign(align);
|
|
8921
|
-
|
|
8922
|
-
|
|
8921
|
+
if (offset !== void 0) return createPositionOffset(offset);
|
|
8922
|
+
return createAlign(HorizontalPositionAlign.LEFT);
|
|
8923
8923
|
})()],
|
|
8924
8924
|
name: "wp:positionH"
|
|
8925
8925
|
});
|
|
@@ -8979,8 +8979,8 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
8979
8979
|
} },
|
|
8980
8980
|
children: [(() => {
|
|
8981
8981
|
if (align) return createAlign(align);
|
|
8982
|
-
|
|
8983
|
-
|
|
8982
|
+
if (offset !== void 0) return createPositionOffset(offset);
|
|
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-
|
|
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-
|
|
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/
|
|
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.
|
|
10125
|
-
if (options.
|
|
10126
|
-
if (options.
|
|
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({
|
|
@@ -10559,10 +10598,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
10559
10598
|
};
|
|
10560
10599
|
/**
|
|
10561
10600
|
* Creates the fill child element for an outline.
|
|
10601
|
+
*
|
|
10602
|
+
* Returns null when no fill type is specified (OOXML allows outline without fill).
|
|
10562
10603
|
*/
|
|
10563
10604
|
const createOutlineFill = (options) => {
|
|
10564
10605
|
if (options.type === "noFill") return createNoFill();
|
|
10565
|
-
return createSolidFill(options.color);
|
|
10606
|
+
if (options.type === "solidFill" && options.color) return createSolidFill(options.color);
|
|
10607
|
+
return null;
|
|
10566
10608
|
};
|
|
10567
10609
|
/**
|
|
10568
10610
|
* Creates an outline element for DrawingML shapes.
|
|
@@ -10598,7 +10640,8 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
10598
10640
|
*/
|
|
10599
10641
|
const createOutline = (options) => {
|
|
10600
10642
|
const children = [];
|
|
10601
|
-
|
|
10643
|
+
const fill = createOutlineFill(options);
|
|
10644
|
+
if (fill) children.push(fill);
|
|
10602
10645
|
if (options.dash !== void 0) children.push(new BuilderElement({
|
|
10603
10646
|
attributes: { val: {
|
|
10604
10647
|
key: "val",
|
|
@@ -10910,12 +10953,12 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
10910
10953
|
const children = [];
|
|
10911
10954
|
if (options.bevelT) children.push(createBevel(options.bevelT));
|
|
10912
10955
|
if (options.bevelB) children.push(createBottomBevel(options.bevelB));
|
|
10913
|
-
if (options.
|
|
10914
|
-
children: [createColorElement(options.
|
|
10956
|
+
if (options.extrusionColor) children.push(new BuilderElement({
|
|
10957
|
+
children: [createColorElement(options.extrusionColor)],
|
|
10915
10958
|
name: "a:extrusionClr"
|
|
10916
10959
|
}));
|
|
10917
|
-
if (options.
|
|
10918
|
-
children: [createColorElement(options.
|
|
10960
|
+
if (options.contourColor) children.push(new BuilderElement({
|
|
10961
|
+
children: [createColorElement(options.contourColor)],
|
|
10919
10962
|
name: "a:contourClr"
|
|
10920
10963
|
}));
|
|
10921
10964
|
return new BuilderElement({
|
|
@@ -10989,7 +11032,6 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
10989
11032
|
if (noFill) this.root.push(createNoFill());
|
|
10990
11033
|
else if (solidFill) this.root.push(createSolidFill(solidFill));
|
|
10991
11034
|
else if (gradientFill) this.root.push(createGradientFill(gradientFill));
|
|
10992
|
-
else if (outline) this.root.push(createNoFill());
|
|
10993
11035
|
if (outline) this.root.push(createOutline(outline));
|
|
10994
11036
|
if (effects) this.root.push(createEffectList(effects));
|
|
10995
11037
|
if (shape3d) this.root.push(createShape3D(shape3d));
|
|
@@ -11102,6 +11144,158 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11102
11144
|
}
|
|
11103
11145
|
};
|
|
11104
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
|
|
11105
11299
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/blip/blip-extentions.ts
|
|
11106
11300
|
/**
|
|
11107
11301
|
* Creates an SVG blip element for embedding SVG images.
|
|
@@ -11211,20 +11405,25 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11211
11405
|
* @param mediaData - The media data containing the image information
|
|
11212
11406
|
* @returns An XML component representing the blip element
|
|
11213
11407
|
*/
|
|
11214
|
-
const createBlip = (mediaData) =>
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
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
|
+
}
|
|
11219
11422
|
},
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
},
|
|
11225
|
-
children: mediaData.type === "svg" ? [createExtentionList(mediaData)] : [],
|
|
11226
|
-
name: "a:blip"
|
|
11227
|
-
});
|
|
11423
|
+
children,
|
|
11424
|
+
name: "a:blip"
|
|
11425
|
+
});
|
|
11426
|
+
};
|
|
11228
11427
|
//#endregion
|
|
11229
11428
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/blip/source-rectangle.ts
|
|
11230
11429
|
/**
|
|
@@ -11348,6 +11547,106 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11348
11547
|
}
|
|
11349
11548
|
};
|
|
11350
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
|
|
11351
11650
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/blip/blip-fill.ts
|
|
11352
11651
|
/**
|
|
11353
11652
|
* Represents a blip fill for pictures in DrawingML.
|
|
@@ -11376,12 +11675,48 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11376
11675
|
* // If mediaData.srcRect is set, cropping is applied
|
|
11377
11676
|
* ```
|
|
11378
11677
|
*/
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
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" });
|
|
11385
11720
|
}
|
|
11386
11721
|
};
|
|
11387
11722
|
//#endregion
|
|
@@ -11506,6 +11841,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11506
11841
|
var ChildNonVisualProperties = class extends XmlComponent {
|
|
11507
11842
|
constructor() {
|
|
11508
11843
|
super("pic:cNvPicPr");
|
|
11844
|
+
this.root.push(new ChildNonVisualPropertiesAttributes({ preferRelativeResize: true }));
|
|
11509
11845
|
this.root.push(new PicLocks());
|
|
11510
11846
|
}
|
|
11511
11847
|
};
|
|
@@ -11554,6 +11890,85 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11554
11890
|
},
|
|
11555
11891
|
name: "a:hlinkClick"
|
|
11556
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
|
+
});
|
|
11557
11972
|
//#endregion
|
|
11558
11973
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-properties/non-visual-properties-attributes.ts
|
|
11559
11974
|
/**
|
|
@@ -11583,16 +11998,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11583
11998
|
};
|
|
11584
11999
|
//#endregion
|
|
11585
12000
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-properties/non-visual-properties.ts
|
|
11586
|
-
|
|
11587
|
-
* Non-visual drawing properties module.
|
|
11588
|
-
*
|
|
11589
|
-
* This module provides basic metadata for drawing elements including
|
|
11590
|
-
* ID, name, description, and hyperlink support.
|
|
11591
|
-
*
|
|
11592
|
-
* Reference: http://officeopenxml.com/drwPic.php
|
|
11593
|
-
*
|
|
11594
|
-
* @module
|
|
11595
|
-
*/
|
|
12001
|
+
const HYPERLINK_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
|
11596
12002
|
/**
|
|
11597
12003
|
* Represents non-visual drawing properties for pictures.
|
|
11598
12004
|
*
|
|
@@ -11623,8 +12029,10 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11623
12029
|
* ```
|
|
11624
12030
|
*/
|
|
11625
12031
|
var NonVisualProperties = class extends XmlComponent {
|
|
11626
|
-
constructor() {
|
|
12032
|
+
constructor(hyperlink) {
|
|
11627
12033
|
super("pic:cNvPr");
|
|
12034
|
+
_defineProperty(this, "hyperlink", void 0);
|
|
12035
|
+
this.hyperlink = hyperlink;
|
|
11628
12036
|
this.root.push(new NonVisualPropertiesAttributes({
|
|
11629
12037
|
descr: "",
|
|
11630
12038
|
id: 0,
|
|
@@ -11632,28 +12040,32 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11632
12040
|
}));
|
|
11633
12041
|
}
|
|
11634
12042
|
prepForXml(context) {
|
|
12043
|
+
let hasStackClick = false;
|
|
11635
12044
|
for (let i = context.stack.length - 1; i >= 0; i--) {
|
|
11636
12045
|
const element = context.stack[i];
|
|
11637
12046
|
if (!(element instanceof ConcreteHyperlink)) continue;
|
|
11638
12047
|
this.root.push(createHyperlinkClick(element.linkId, false));
|
|
12048
|
+
hasStackClick = true;
|
|
11639
12049
|
break;
|
|
11640
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
|
+
}
|
|
11641
12063
|
return super.prepForXml(context);
|
|
11642
12064
|
}
|
|
11643
12065
|
};
|
|
11644
12066
|
//#endregion
|
|
11645
12067
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-pic-properties.ts
|
|
11646
12068
|
/**
|
|
11647
|
-
* Non-visual picture properties module.
|
|
11648
|
-
*
|
|
11649
|
-
* This module provides metadata and locking settings for pictures
|
|
11650
|
-
* that don't affect their visual appearance.
|
|
11651
|
-
*
|
|
11652
|
-
* Reference: http://officeopenxml.com/drwPic.php
|
|
11653
|
-
*
|
|
11654
|
-
* @module
|
|
11655
|
-
*/
|
|
11656
|
-
/**
|
|
11657
12069
|
* Represents non-visual picture properties.
|
|
11658
12070
|
*
|
|
11659
12071
|
* This element specifies non-visual properties for a picture. These properties
|
|
@@ -11678,9 +12090,9 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11678
12090
|
* ```
|
|
11679
12091
|
*/
|
|
11680
12092
|
var NonVisualPicProperties = class extends XmlComponent {
|
|
11681
|
-
constructor() {
|
|
12093
|
+
constructor(hyperlink) {
|
|
11682
12094
|
super("pic:nvPicPr");
|
|
11683
|
-
this.root.push(new NonVisualProperties());
|
|
12095
|
+
this.root.push(new NonVisualProperties(hyperlink));
|
|
11684
12096
|
this.root.push(new ChildNonVisualProperties());
|
|
11685
12097
|
}
|
|
11686
12098
|
};
|
|
@@ -11737,14 +12149,19 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11737
12149
|
* ```
|
|
11738
12150
|
*/
|
|
11739
12151
|
var Pic = class extends XmlComponent {
|
|
11740
|
-
constructor({ mediaData, transform, outline }) {
|
|
12152
|
+
constructor({ mediaData, transform, outline, solidFill, effects, blipEffects, tile, hyperlink }) {
|
|
11741
12153
|
super("pic:pic");
|
|
11742
12154
|
this.root.push(new PicAttributes({ xmlns: "http://schemas.openxmlformats.org/drawingml/2006/picture" }));
|
|
11743
|
-
this.root.push(new NonVisualPicProperties());
|
|
11744
|
-
this.root.push(
|
|
12155
|
+
this.root.push(new NonVisualPicProperties(hyperlink));
|
|
12156
|
+
this.root.push(createBlipFill(mediaData, {
|
|
12157
|
+
blipEffects,
|
|
12158
|
+
tile
|
|
12159
|
+
}));
|
|
11745
12160
|
this.root.push(new ShapeProperties({
|
|
11746
12161
|
element: "pic",
|
|
12162
|
+
effects,
|
|
11747
12163
|
outline,
|
|
12164
|
+
solidFill,
|
|
11748
12165
|
transform
|
|
11749
12166
|
}));
|
|
11750
12167
|
}
|
|
@@ -11870,7 +12287,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11870
12287
|
* ```
|
|
11871
12288
|
*/
|
|
11872
12289
|
var GraphicData = class extends XmlComponent {
|
|
11873
|
-
constructor({ mediaData, transform, outline, solidFill }) {
|
|
12290
|
+
constructor({ mediaData, transform, outline, solidFill, effects, blipEffects, tile, hyperlink }) {
|
|
11874
12291
|
super("a:graphicData");
|
|
11875
12292
|
if (mediaData.type === "wps") {
|
|
11876
12293
|
this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" }));
|
|
@@ -11908,8 +12325,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11908
12325
|
} else {
|
|
11909
12326
|
this.root.push(new GraphicDataAttributes({ uri: "http://schemas.openxmlformats.org/drawingml/2006/picture" }));
|
|
11910
12327
|
const pic = new Pic({
|
|
12328
|
+
blipEffects,
|
|
12329
|
+
effects,
|
|
12330
|
+
hyperlink,
|
|
11911
12331
|
mediaData,
|
|
11912
12332
|
outline,
|
|
12333
|
+
solidFill,
|
|
12334
|
+
tile,
|
|
11913
12335
|
transform
|
|
11914
12336
|
});
|
|
11915
12337
|
this.root.push(pic);
|
|
@@ -11955,14 +12377,18 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
11955
12377
|
* ```
|
|
11956
12378
|
*/
|
|
11957
12379
|
var Graphic = class extends XmlComponent {
|
|
11958
|
-
constructor({ mediaData, transform, outline, solidFill }) {
|
|
12380
|
+
constructor({ mediaData, transform, outline, solidFill, effects, blipEffects, tile, hyperlink }) {
|
|
11959
12381
|
super("a:graphic");
|
|
11960
12382
|
_defineProperty(this, "data", void 0);
|
|
11961
12383
|
this.root.push(new GraphicAttributes({ a: "http://schemas.openxmlformats.org/drawingml/2006/main" }));
|
|
11962
12384
|
this.data = new GraphicData({
|
|
12385
|
+
blipEffects,
|
|
12386
|
+
effects,
|
|
12387
|
+
hyperlink,
|
|
11963
12388
|
mediaData,
|
|
11964
12389
|
outline,
|
|
11965
12390
|
solidFill,
|
|
12391
|
+
tile,
|
|
11966
12392
|
transform
|
|
11967
12393
|
});
|
|
11968
12394
|
this.root.push(this.data);
|
|
@@ -12184,12 +12610,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
12184
12610
|
* Document Properties module for DrawingML elements.
|
|
12185
12611
|
*
|
|
12186
12612
|
* This module provides non-visual properties for drawing elements,
|
|
12187
|
-
* including name, description,
|
|
12613
|
+
* including name, description, accessibility information, and hyperlinks.
|
|
12188
12614
|
*
|
|
12189
12615
|
* Reference: https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_docPr_topic_ID0ES32OB.html
|
|
12190
12616
|
*
|
|
12191
12617
|
* @module
|
|
12192
12618
|
*/
|
|
12619
|
+
const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
|
12193
12620
|
/**
|
|
12194
12621
|
* Represents non-visual drawing properties in a WordprocessingML document.
|
|
12195
12622
|
*
|
|
@@ -12214,13 +12641,15 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
12214
12641
|
* ```
|
|
12215
12642
|
*/
|
|
12216
12643
|
var DocProperties = class extends XmlComponent {
|
|
12217
|
-
constructor({ name, description, title, id } = {
|
|
12644
|
+
constructor({ name, description, title, id, hyperlink } = {
|
|
12218
12645
|
description: "",
|
|
12219
12646
|
name: "",
|
|
12220
12647
|
title: ""
|
|
12221
12648
|
}) {
|
|
12222
12649
|
super("wp:docPr");
|
|
12223
12650
|
_defineProperty(this, "docPropertiesUniqueNumericId", docPropertiesUniqueNumericIdGen());
|
|
12651
|
+
_defineProperty(this, "hyperlink", void 0);
|
|
12652
|
+
this.hyperlink = hyperlink;
|
|
12224
12653
|
const attributes = {
|
|
12225
12654
|
id: {
|
|
12226
12655
|
key: "id",
|
|
@@ -12242,12 +12671,26 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
12242
12671
|
this.root.push(new NextAttributeComponent(attributes));
|
|
12243
12672
|
}
|
|
12244
12673
|
prepForXml(context) {
|
|
12674
|
+
let hasStackClick = false;
|
|
12245
12675
|
for (let i = context.stack.length - 1; i >= 0; i--) {
|
|
12246
12676
|
const element = context.stack[i];
|
|
12247
12677
|
if (!(element instanceof ConcreteHyperlink)) continue;
|
|
12248
12678
|
this.root.push(createHyperlinkClick(element.linkId, true));
|
|
12679
|
+
hasStackClick = true;
|
|
12249
12680
|
break;
|
|
12250
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
|
+
}
|
|
12251
12694
|
return super.prepForXml(context);
|
|
12252
12695
|
}
|
|
12253
12696
|
};
|
|
@@ -12523,6 +12966,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
12523
12966
|
*/
|
|
12524
12967
|
var Anchor = class extends XmlComponent {
|
|
12525
12968
|
constructor({ mediaData, transform, drawingOptions }) {
|
|
12969
|
+
var _drawingOptions$docPr;
|
|
12526
12970
|
super("wp:anchor");
|
|
12527
12971
|
const floating = {
|
|
12528
12972
|
allowOverlap: true,
|
|
@@ -12575,16 +13019,20 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
12575
13019
|
this.root.push(new DocProperties(drawingOptions.docProperties));
|
|
12576
13020
|
this.root.push(createGraphicFrameProperties());
|
|
12577
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,
|
|
12578
13025
|
mediaData,
|
|
12579
13026
|
outline: drawingOptions.outline,
|
|
12580
13027
|
solidFill: drawingOptions.solidFill,
|
|
13028
|
+
tile: drawingOptions.tile,
|
|
12581
13029
|
transform
|
|
12582
13030
|
}));
|
|
12583
13031
|
}
|
|
12584
13032
|
};
|
|
12585
13033
|
//#endregion
|
|
12586
13034
|
//#region src/file/drawing/inline/inline.ts
|
|
12587
|
-
const createInline = ({ mediaData, transform, docProperties, outline, solidFill }) => {
|
|
13035
|
+
const createInline = ({ mediaData, transform, docProperties, outline, solidFill, effects, blipEffects, tile }) => {
|
|
12588
13036
|
var _outline$width, _outline$width2, _outline$width3, _outline$width4;
|
|
12589
13037
|
return new BuilderElement({
|
|
12590
13038
|
attributes: {
|
|
@@ -12624,9 +13072,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
12624
13072
|
new DocProperties(docProperties),
|
|
12625
13073
|
createGraphicFrameProperties(),
|
|
12626
13074
|
new Graphic({
|
|
13075
|
+
blipEffects,
|
|
13076
|
+
effects,
|
|
13077
|
+
hyperlink: docProperties === null || docProperties === void 0 ? void 0 : docProperties.hyperlink,
|
|
12627
13078
|
mediaData,
|
|
12628
13079
|
outline,
|
|
12629
13080
|
solidFill,
|
|
13081
|
+
tile,
|
|
12630
13082
|
transform
|
|
12631
13083
|
})
|
|
12632
13084
|
],
|
|
@@ -12657,10 +13109,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
12657
13109
|
constructor(imageData, drawingOptions = {}) {
|
|
12658
13110
|
super("w:drawing");
|
|
12659
13111
|
if (!drawingOptions.floating) this.root.push(createInline({
|
|
13112
|
+
blipEffects: drawingOptions.blipEffects,
|
|
12660
13113
|
docProperties: drawingOptions.docProperties,
|
|
13114
|
+
effects: drawingOptions.effects,
|
|
12661
13115
|
mediaData: imageData,
|
|
12662
13116
|
outline: drawingOptions.outline,
|
|
12663
13117
|
solidFill: drawingOptions.solidFill,
|
|
13118
|
+
tile: drawingOptions.tile,
|
|
12664
13119
|
transform: imageData.transformation
|
|
12665
13120
|
}));
|
|
12666
13121
|
else this.root.push(new Anchor({
|
|
@@ -12806,9 +13261,13 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
12806
13261
|
...createImageData(rawData, options.transformation, key, options.srcRect)
|
|
12807
13262
|
};
|
|
12808
13263
|
const drawing = new Drawing(this.imageData, {
|
|
13264
|
+
blipEffects: options.blipEffects,
|
|
12809
13265
|
docProperties: options.altText,
|
|
12810
13266
|
floating: options.floating,
|
|
12811
|
-
outline: options.outline
|
|
13267
|
+
outline: options.outline,
|
|
13268
|
+
solidFill: options.solidFill,
|
|
13269
|
+
effects: options.effects,
|
|
13270
|
+
tile: options.tile
|
|
12812
13271
|
});
|
|
12813
13272
|
this.root.push(drawing);
|
|
12814
13273
|
}
|
|
@@ -13062,50 +13521,6 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
13062
13521
|
}
|
|
13063
13522
|
};
|
|
13064
13523
|
//#endregion
|
|
13065
|
-
//#region src/file/relationships/relationship/relationship.ts
|
|
13066
|
-
/**
|
|
13067
|
-
* Target mode types for relationships.
|
|
13068
|
-
*
|
|
13069
|
-
* Indicates whether a relationship target is external to the package.
|
|
13070
|
-
*/
|
|
13071
|
-
const TargetModeType = { EXTERNAL: "External" };
|
|
13072
|
-
/**
|
|
13073
|
-
* Creates a single relationship between parts in an OPC package.
|
|
13074
|
-
*
|
|
13075
|
-
* A relationship defines a typed connection from a source part to a target part,
|
|
13076
|
-
* identified by a unique ID within the relationships collection.
|
|
13077
|
-
*
|
|
13078
|
-
* @example
|
|
13079
|
-
* ```typescript
|
|
13080
|
-
* // Internal relationship to an image
|
|
13081
|
-
* createRelationship("rId1", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", "media/image1.png");
|
|
13082
|
-
*
|
|
13083
|
-
* // External relationship to a hyperlink
|
|
13084
|
-
* createRelationship("rId2", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", "https://example.com", TargetModeType.EXTERNAL);
|
|
13085
|
-
* ```
|
|
13086
|
-
*/
|
|
13087
|
-
const createRelationship = (id, type, target, targetMode) => new BuilderElement({
|
|
13088
|
-
attributes: {
|
|
13089
|
-
id: {
|
|
13090
|
-
key: "Id",
|
|
13091
|
-
value: id
|
|
13092
|
-
},
|
|
13093
|
-
target: {
|
|
13094
|
-
key: "Target",
|
|
13095
|
-
value: target
|
|
13096
|
-
},
|
|
13097
|
-
targetMode: {
|
|
13098
|
-
key: "TargetMode",
|
|
13099
|
-
value: targetMode
|
|
13100
|
-
},
|
|
13101
|
-
type: {
|
|
13102
|
-
key: "Type",
|
|
13103
|
-
value: type
|
|
13104
|
-
}
|
|
13105
|
-
},
|
|
13106
|
-
name: "Relationship"
|
|
13107
|
-
});
|
|
13108
|
-
//#endregion
|
|
13109
13524
|
//#region src/file/relationships/relationships.ts
|
|
13110
13525
|
/**
|
|
13111
13526
|
* Relationships module for Open Packaging Conventions.
|
|
@@ -14206,8 +14621,7 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
14206
14621
|
var IndentLevel = class extends XmlComponent {
|
|
14207
14622
|
constructor(level) {
|
|
14208
14623
|
super("w:ilvl");
|
|
14209
|
-
|
|
14210
|
-
this.root.push(new Attributes({ val: level }));
|
|
14624
|
+
this.root.push(new Attributes({ val: Math.min(level, 9) }));
|
|
14211
14625
|
}
|
|
14212
14626
|
};
|
|
14213
14627
|
/**
|
|
@@ -22376,9 +22790,8 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
22376
22790
|
this.runProperties = new RunProperties(style && style.run);
|
|
22377
22791
|
this.root.push(this.paragraphProperties);
|
|
22378
22792
|
this.root.push(this.runProperties);
|
|
22379
|
-
if (level > 9) throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");
|
|
22380
22793
|
this.root.push(new LevelAttributes({
|
|
22381
|
-
ilvl: decimalNumber(level),
|
|
22794
|
+
ilvl: decimalNumber(Math.min(level, 9)),
|
|
22382
22795
|
tentative: 1
|
|
22383
22796
|
}));
|
|
22384
22797
|
}
|
|
@@ -24133,7 +24546,10 @@ var docx = (function(exports, hash_js, nanoid_non_secure, undio, fflate) {
|
|
|
24133
24546
|
const xmlObj = (0, import_lib.xml2js)(xmlData, { compact: false });
|
|
24134
24547
|
let stylesXmlElement;
|
|
24135
24548
|
for (const xmlElm of xmlObj.elements || []) if (xmlElm.name === "w:styles") stylesXmlElement = xmlElm;
|
|
24136
|
-
if (stylesXmlElement === void 0)
|
|
24549
|
+
if (stylesXmlElement === void 0) return {
|
|
24550
|
+
importedStyles: [],
|
|
24551
|
+
initialStyles: new ImportedRootElementAttributes({})
|
|
24552
|
+
};
|
|
24137
24553
|
return {
|
|
24138
24554
|
importedStyles: (stylesXmlElement.elements || []).map((childElm) => convertToXmlComponent(childElm)),
|
|
24139
24555
|
initialStyles: new ImportedRootElementAttributes(stylesXmlElement.attributes)
|