docx-plus 0.0.2 → 0.0.3
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/dist/index.cjs +26 -24
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.iife.js +27 -25
- package/dist/index.mjs +27 -24
- package/dist/index.umd.js +29 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25,9 +25,9 @@ let xml_js = require("xml-js");
|
|
|
25
25
|
let hash_js = require("hash.js");
|
|
26
26
|
hash_js = __toESM(hash_js);
|
|
27
27
|
let nanoid_non_secure = require("nanoid/non-secure");
|
|
28
|
+
let undio = require("undio");
|
|
28
29
|
let stream = require("stream");
|
|
29
30
|
let fflate = require("fflate");
|
|
30
|
-
let undio = require("undio");
|
|
31
31
|
let xml = require("xml");
|
|
32
32
|
xml = __toESM(xml);
|
|
33
33
|
//#region \0@oxc-project+runtime@0.123.0/helpers/typeof.js
|
|
@@ -5777,29 +5777,20 @@ var Drawing = class extends XmlComponent {
|
|
|
5777
5777
|
};
|
|
5778
5778
|
//#endregion
|
|
5779
5779
|
//#region src/file/paragraph/run/image-run.ts
|
|
5780
|
-
const
|
|
5781
|
-
|
|
5782
|
-
const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + 8;
|
|
5783
|
-
const binaryString = atob(dataURI.substring(base64IndexWithOffset));
|
|
5784
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
5785
|
-
for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
|
|
5786
|
-
return bytes;
|
|
5787
|
-
};
|
|
5788
|
-
const standardizeData = (data) => typeof data === "string" ? convertDataURIToBinary(data) : data;
|
|
5789
|
-
const createImageData = (options, key) => ({
|
|
5790
|
-
data: standardizeData(options.data),
|
|
5780
|
+
const createImageData = (data, transformation, key) => ({
|
|
5781
|
+
data,
|
|
5791
5782
|
fileName: key,
|
|
5792
5783
|
transformation: {
|
|
5793
5784
|
emus: {
|
|
5794
|
-
x: Math.round(
|
|
5795
|
-
y: Math.round(
|
|
5785
|
+
x: Math.round(transformation.width * 9525),
|
|
5786
|
+
y: Math.round(transformation.height * 9525)
|
|
5796
5787
|
},
|
|
5797
|
-
flip:
|
|
5788
|
+
flip: transformation.flip,
|
|
5798
5789
|
pixels: {
|
|
5799
|
-
x: Math.round(
|
|
5800
|
-
y: Math.round(
|
|
5790
|
+
x: Math.round(transformation.width),
|
|
5791
|
+
y: Math.round(transformation.height)
|
|
5801
5792
|
},
|
|
5802
|
-
rotation:
|
|
5793
|
+
rotation: transformation.rotation ? transformation.rotation * 6e4 : void 0
|
|
5803
5794
|
}
|
|
5804
5795
|
});
|
|
5805
5796
|
/**
|
|
@@ -5828,8 +5819,12 @@ var ImageRun = class extends Run {
|
|
|
5828
5819
|
constructor(options) {
|
|
5829
5820
|
super({});
|
|
5830
5821
|
_defineProperty(this, "imageData", void 0);
|
|
5831
|
-
const
|
|
5832
|
-
|
|
5822
|
+
const rawData = (0, undio.toUint8Array)(options.data);
|
|
5823
|
+
const key = `${hashedId(rawData)}.${options.type}`;
|
|
5824
|
+
if (options.type === "svg") {
|
|
5825
|
+
const fallbackData = (0, undio.toUint8Array)(options.fallback.data);
|
|
5826
|
+
this.imageData = _objectSpread2(_objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key)), {}, { fallback: _objectSpread2({ type: options.fallback.type }, createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)) });
|
|
5827
|
+
} else this.imageData = _objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key));
|
|
5833
5828
|
const drawing = new Drawing(this.imageData, {
|
|
5834
5829
|
docProperties: options.altText,
|
|
5835
5830
|
floating: options.floating,
|
|
@@ -18292,6 +18287,14 @@ var Textbox = class extends FileChild {
|
|
|
18292
18287
|
//#endregion
|
|
18293
18288
|
//#region src/util/output-type.ts
|
|
18294
18289
|
/**
|
|
18290
|
+
* Output type definitions for document generation.
|
|
18291
|
+
*
|
|
18292
|
+
* This module defines the various output formats supported when generating
|
|
18293
|
+
* .docx files. These types correspond to fflate's output formats.
|
|
18294
|
+
*
|
|
18295
|
+
* @module
|
|
18296
|
+
*/
|
|
18297
|
+
/**
|
|
18295
18298
|
* Converts a Uint8Array to the specified output type.
|
|
18296
18299
|
*
|
|
18297
18300
|
* This is used by both the Packer and patchDocument to convert fflate's
|
|
@@ -18303,10 +18306,10 @@ const convertOutput = (data, type) => {
|
|
|
18303
18306
|
case "blob": return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
|
|
18304
18307
|
case "arraybuffer": return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
18305
18308
|
case "uint8array": return data;
|
|
18306
|
-
case "base64": return
|
|
18309
|
+
case "base64": return btoa((0, fflate.strFromU8)(data, true));
|
|
18307
18310
|
case "string":
|
|
18308
|
-
case "text":
|
|
18309
|
-
case "binarystring": return
|
|
18311
|
+
case "text":
|
|
18312
|
+
case "binarystring": return (0, fflate.strFromU8)(data, true);
|
|
18310
18313
|
case "array": return [...data];
|
|
18311
18314
|
default: return data;
|
|
18312
18315
|
}
|
|
@@ -20179,7 +20182,6 @@ exports.sectionPageSizeDefaults = sectionPageSizeDefaults;
|
|
|
20179
20182
|
exports.shortHexNumber = shortHexNumber;
|
|
20180
20183
|
exports.signedHpsMeasureValue = signedHpsMeasureValue;
|
|
20181
20184
|
exports.signedTwipsMeasureValue = signedTwipsMeasureValue;
|
|
20182
|
-
exports.standardizeData = standardizeData;
|
|
20183
20185
|
exports.twipsMeasureValue = twipsMeasureValue;
|
|
20184
20186
|
exports.uCharHexNumber = uCharHexNumber;
|
|
20185
20187
|
exports.uniqueId = uniqueId;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataType } from "undio";
|
|
1
2
|
import { Element } from "xml-js";
|
|
2
3
|
import { Readable } from "stream";
|
|
3
4
|
//#region src/file/file-child.d.ts
|
|
@@ -700,7 +701,7 @@ interface IMediaDataTransformation {
|
|
|
700
701
|
interface CoreMediaData {
|
|
701
702
|
readonly fileName: string;
|
|
702
703
|
readonly transformation: IMediaDataTransformation;
|
|
703
|
-
readonly data:
|
|
704
|
+
readonly data: Uint8Array;
|
|
704
705
|
}
|
|
705
706
|
interface RegularMediaData {
|
|
706
707
|
readonly type: "jpg" | "png" | "gif" | "bmp";
|
|
@@ -776,15 +777,14 @@ interface CoreImageOptions {
|
|
|
776
777
|
}
|
|
777
778
|
interface RegularImageOptions {
|
|
778
779
|
readonly type: "jpg" | "png" | "gif" | "bmp";
|
|
779
|
-
readonly data:
|
|
780
|
+
readonly data: DataType;
|
|
780
781
|
}
|
|
781
782
|
interface SvgMediaOptions {
|
|
782
783
|
readonly type: "svg";
|
|
783
|
-
readonly data:
|
|
784
|
+
readonly data: DataType;
|
|
784
785
|
readonly fallback: RegularImageOptions;
|
|
785
786
|
}
|
|
786
787
|
type IImageOptions = (RegularImageOptions | SvgMediaOptions) & CoreImageOptions;
|
|
787
|
-
declare const standardizeData: (data: string | Buffer | Uint8Array | ArrayBuffer) => Buffer | Uint8Array | ArrayBuffer;
|
|
788
788
|
declare class ImageRun extends Run {
|
|
789
789
|
private readonly imageData;
|
|
790
790
|
constructor(options: IImageOptions);
|
|
@@ -3229,4 +3229,4 @@ declare const patchDetector: ({
|
|
|
3229
3229
|
data
|
|
3230
3230
|
}: PatchDetectorOptions) => Promise<readonly string[]>;
|
|
3231
3231
|
//#endregion
|
|
3232
|
-
export { AbstractNumbering, AlignmentType, AnnotationReference, AttributeData, AttributeMap, AttributePayload, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespace, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IAlignmentFrameOptions, IBaseCharacterStyleOptions, IBaseParagraphStyleOptions, IBodyPropertiesOptions, IBookmarkOptions, IBorderOptions, IBordersOptions, ICellMergeAttributes, ICharacterStyleOptions, ICheckboxSymbolOptions, ICheckboxSymbolProperties, IColumnAttributes, IColumnsAttributes, ICommentOptions, ICommentsOptions, IConcreteNumberingOptions, IContext, IDistance, IDocGridAttributesProperties, IDocumentAttributesProperties, IDocumentBackgroundOptions, IDocumentDefaultsOptions, IDocumentFooter, IDocumentHeader, IDocumentOptions, IDrawingOptions, IExtendedMediaData, IExternalHyperlinkOptions, IFloating, IFontAttributesProperties, IFrameOptions, IGroupChildMediaData, IHeaderFooterGroup, IHeaderFooterOptions, IHeaderOptions, IHorizontalPositionOptions, IImageOptions, IIndentAttributesProperties, IInternalHyperlinkOptions, ILevelParagraphStylePropertiesOptions, ILevelsOptions, ILineNumberAttributes, IMargins, IMathFractionOptions, IMathFunctionOptions, IMathIntegralOptions, IMathLimitLowerOptions, IMathLimitUpperOptions, IMathOptions, IMathPreSubSuperScriptOptions, IMathRadicalOptions, IMathSubScriptOptions, IMathSubSuperScriptOptions, IMathSumOptions, IMathSuperScriptOptions, IMediaData, IMediaDataTransformation, IMediaTransformation, INumberedItemReferenceOptions, INumberingOptions, IPageBorderAttributes, IPageBordersOptions, IPageMarginAttributes, IPageNumberTypeAttributes, IPageReferenceOptions, IPageSizeAttributes, IParagraphOptions, IParagraphPropertiesChangeOptions, IParagraphPropertiesOptions, IParagraphPropertiesOptionsBase, IParagraphRunOptions, IParagraphRunPropertiesOptions, IParagraphStyleOptions, IParagraphStylePropertiesOptions, IPatch, type IPropertiesOptions, IRunOptions, IRunPropertiesChangeOptions, IRunPropertiesOptions, IRunStylePropertiesOptions, ISectionOptions, ISectionPropertiesChangeOptions, ISectionPropertiesOptions, ISectionPropertiesOptionsBase, IShadingAttributesProperties, ISpacingProperties, IStylesOptions, ISymbolRunOptions, ITableBordersOptions, ITableCellBorders, ITableCellOptions, ITableFloatOptions, ITableLookOptions, ITableOfContentsOptions, ITableOptions, ITablePropertiesChangeOptions, ITablePropertiesOptions, ITablePropertiesOptionsBase, ITableRowOptions, ITableRowPropertiesChangeOptions, ITableRowPropertiesOptions, ITableRowPropertiesOptionsBase, ITableWidthProperties, ITextWrapping, IVerticalPositionOptions, IWpgGroupOptions, IWpsShapeOptions, IXYFrameOptions, IXmlAttribute, IXmlableObject, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InputDataType, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math, MathAngledBrackets, MathComponent, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OutputByType, OutputType, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphChild, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchDocumentOptions, PatchDocumentOutputType, PatchType, Percentage, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabOptions, PositionalTabRelativeTo, PositivePercentage, PositiveUniversalMeasure, PrettifyType, RelativeHorizontalPosition, RelativeMeasure, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, SectionVerticalAlign, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopDefinition, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TableVerticalAlign, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, UniqueNumericIdCreator, UniversalMeasure, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgCommonMediaData, WpgGroupRun, WpgMediaData, WpsMediaData, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue,
|
|
3232
|
+
export { AbstractNumbering, AlignmentType, AnnotationReference, AttributeData, AttributeMap, AttributePayload, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespace, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IAlignmentFrameOptions, IBaseCharacterStyleOptions, IBaseParagraphStyleOptions, IBodyPropertiesOptions, IBookmarkOptions, IBorderOptions, IBordersOptions, ICellMergeAttributes, ICharacterStyleOptions, ICheckboxSymbolOptions, ICheckboxSymbolProperties, IColumnAttributes, IColumnsAttributes, ICommentOptions, ICommentsOptions, IConcreteNumberingOptions, IContext, IDistance, IDocGridAttributesProperties, IDocumentAttributesProperties, IDocumentBackgroundOptions, IDocumentDefaultsOptions, IDocumentFooter, IDocumentHeader, IDocumentOptions, IDrawingOptions, IExtendedMediaData, IExternalHyperlinkOptions, IFloating, IFontAttributesProperties, IFrameOptions, IGroupChildMediaData, IHeaderFooterGroup, IHeaderFooterOptions, IHeaderOptions, IHorizontalPositionOptions, IImageOptions, IIndentAttributesProperties, IInternalHyperlinkOptions, ILevelParagraphStylePropertiesOptions, ILevelsOptions, ILineNumberAttributes, IMargins, IMathFractionOptions, IMathFunctionOptions, IMathIntegralOptions, IMathLimitLowerOptions, IMathLimitUpperOptions, IMathOptions, IMathPreSubSuperScriptOptions, IMathRadicalOptions, IMathSubScriptOptions, IMathSubSuperScriptOptions, IMathSumOptions, IMathSuperScriptOptions, IMediaData, IMediaDataTransformation, IMediaTransformation, INumberedItemReferenceOptions, INumberingOptions, IPageBorderAttributes, IPageBordersOptions, IPageMarginAttributes, IPageNumberTypeAttributes, IPageReferenceOptions, IPageSizeAttributes, IParagraphOptions, IParagraphPropertiesChangeOptions, IParagraphPropertiesOptions, IParagraphPropertiesOptionsBase, IParagraphRunOptions, IParagraphRunPropertiesOptions, IParagraphStyleOptions, IParagraphStylePropertiesOptions, IPatch, type IPropertiesOptions, IRunOptions, IRunPropertiesChangeOptions, IRunPropertiesOptions, IRunStylePropertiesOptions, ISectionOptions, ISectionPropertiesChangeOptions, ISectionPropertiesOptions, ISectionPropertiesOptionsBase, IShadingAttributesProperties, ISpacingProperties, IStylesOptions, ISymbolRunOptions, ITableBordersOptions, ITableCellBorders, ITableCellOptions, ITableFloatOptions, ITableLookOptions, ITableOfContentsOptions, ITableOptions, ITablePropertiesChangeOptions, ITablePropertiesOptions, ITablePropertiesOptionsBase, ITableRowOptions, ITableRowPropertiesChangeOptions, ITableRowPropertiesOptions, ITableRowPropertiesOptionsBase, ITableWidthProperties, ITextWrapping, IVerticalPositionOptions, IWpgGroupOptions, IWpsShapeOptions, IXYFrameOptions, IXmlAttribute, IXmlableObject, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InputDataType, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math, MathAngledBrackets, MathComponent, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OutputByType, OutputType, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphChild, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchDocumentOptions, PatchDocumentOutputType, PatchType, Percentage, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabOptions, PositionalTabRelativeTo, PositivePercentage, PositiveUniversalMeasure, PrettifyType, RelativeHorizontalPosition, RelativeMeasure, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, SectionVerticalAlign, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopDefinition, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TableVerticalAlign, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, UniqueNumericIdCreator, UniversalMeasure, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgCommonMediaData, WpgGroupRun, WpgMediaData, WpsMediaData, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Element } from "xml-js";
|
|
2
|
+
import { DataType } from "undio";
|
|
2
3
|
import { Readable } from "stream";
|
|
3
4
|
//#region src/file/file-child.d.ts
|
|
4
5
|
declare class FileChild extends XmlComponent {
|
|
@@ -700,7 +701,7 @@ interface IMediaDataTransformation {
|
|
|
700
701
|
interface CoreMediaData {
|
|
701
702
|
readonly fileName: string;
|
|
702
703
|
readonly transformation: IMediaDataTransformation;
|
|
703
|
-
readonly data:
|
|
704
|
+
readonly data: Uint8Array;
|
|
704
705
|
}
|
|
705
706
|
interface RegularMediaData {
|
|
706
707
|
readonly type: "jpg" | "png" | "gif" | "bmp";
|
|
@@ -776,15 +777,14 @@ interface CoreImageOptions {
|
|
|
776
777
|
}
|
|
777
778
|
interface RegularImageOptions {
|
|
778
779
|
readonly type: "jpg" | "png" | "gif" | "bmp";
|
|
779
|
-
readonly data:
|
|
780
|
+
readonly data: DataType;
|
|
780
781
|
}
|
|
781
782
|
interface SvgMediaOptions {
|
|
782
783
|
readonly type: "svg";
|
|
783
|
-
readonly data:
|
|
784
|
+
readonly data: DataType;
|
|
784
785
|
readonly fallback: RegularImageOptions;
|
|
785
786
|
}
|
|
786
787
|
type IImageOptions = (RegularImageOptions | SvgMediaOptions) & CoreImageOptions;
|
|
787
|
-
declare const standardizeData: (data: string | Buffer | Uint8Array | ArrayBuffer) => Buffer | Uint8Array | ArrayBuffer;
|
|
788
788
|
declare class ImageRun extends Run {
|
|
789
789
|
private readonly imageData;
|
|
790
790
|
constructor(options: IImageOptions);
|
|
@@ -3229,4 +3229,4 @@ declare const patchDetector: ({
|
|
|
3229
3229
|
data
|
|
3230
3230
|
}: PatchDetectorOptions) => Promise<readonly string[]>;
|
|
3231
3231
|
//#endregion
|
|
3232
|
-
export { AbstractNumbering, AlignmentType, AnnotationReference, AttributeData, AttributeMap, AttributePayload, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespace, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IAlignmentFrameOptions, IBaseCharacterStyleOptions, IBaseParagraphStyleOptions, IBodyPropertiesOptions, IBookmarkOptions, IBorderOptions, IBordersOptions, ICellMergeAttributes, ICharacterStyleOptions, ICheckboxSymbolOptions, ICheckboxSymbolProperties, IColumnAttributes, IColumnsAttributes, ICommentOptions, ICommentsOptions, IConcreteNumberingOptions, IContext, IDistance, IDocGridAttributesProperties, IDocumentAttributesProperties, IDocumentBackgroundOptions, IDocumentDefaultsOptions, IDocumentFooter, IDocumentHeader, IDocumentOptions, IDrawingOptions, IExtendedMediaData, IExternalHyperlinkOptions, IFloating, IFontAttributesProperties, IFrameOptions, IGroupChildMediaData, IHeaderFooterGroup, IHeaderFooterOptions, IHeaderOptions, IHorizontalPositionOptions, IImageOptions, IIndentAttributesProperties, IInternalHyperlinkOptions, ILevelParagraphStylePropertiesOptions, ILevelsOptions, ILineNumberAttributes, IMargins, IMathFractionOptions, IMathFunctionOptions, IMathIntegralOptions, IMathLimitLowerOptions, IMathLimitUpperOptions, IMathOptions, IMathPreSubSuperScriptOptions, IMathRadicalOptions, IMathSubScriptOptions, IMathSubSuperScriptOptions, IMathSumOptions, IMathSuperScriptOptions, IMediaData, IMediaDataTransformation, IMediaTransformation, INumberedItemReferenceOptions, INumberingOptions, IPageBorderAttributes, IPageBordersOptions, IPageMarginAttributes, IPageNumberTypeAttributes, IPageReferenceOptions, IPageSizeAttributes, IParagraphOptions, IParagraphPropertiesChangeOptions, IParagraphPropertiesOptions, IParagraphPropertiesOptionsBase, IParagraphRunOptions, IParagraphRunPropertiesOptions, IParagraphStyleOptions, IParagraphStylePropertiesOptions, IPatch, type IPropertiesOptions, IRunOptions, IRunPropertiesChangeOptions, IRunPropertiesOptions, IRunStylePropertiesOptions, ISectionOptions, ISectionPropertiesChangeOptions, ISectionPropertiesOptions, ISectionPropertiesOptionsBase, IShadingAttributesProperties, ISpacingProperties, IStylesOptions, ISymbolRunOptions, ITableBordersOptions, ITableCellBorders, ITableCellOptions, ITableFloatOptions, ITableLookOptions, ITableOfContentsOptions, ITableOptions, ITablePropertiesChangeOptions, ITablePropertiesOptions, ITablePropertiesOptionsBase, ITableRowOptions, ITableRowPropertiesChangeOptions, ITableRowPropertiesOptions, ITableRowPropertiesOptionsBase, ITableWidthProperties, ITextWrapping, IVerticalPositionOptions, IWpgGroupOptions, IWpsShapeOptions, IXYFrameOptions, IXmlAttribute, IXmlableObject, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InputDataType, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math, MathAngledBrackets, MathComponent, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OutputByType, OutputType, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphChild, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchDocumentOptions, PatchDocumentOutputType, PatchType, Percentage, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabOptions, PositionalTabRelativeTo, PositivePercentage, PositiveUniversalMeasure, PrettifyType, RelativeHorizontalPosition, RelativeMeasure, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, SectionVerticalAlign, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopDefinition, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TableVerticalAlign, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, UniqueNumericIdCreator, UniversalMeasure, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgCommonMediaData, WpgGroupRun, WpgMediaData, WpsMediaData, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue,
|
|
3232
|
+
export { AbstractNumbering, AlignmentType, AnnotationReference, AttributeData, AttributeMap, AttributePayload, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespace, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IAlignmentFrameOptions, IBaseCharacterStyleOptions, IBaseParagraphStyleOptions, IBodyPropertiesOptions, IBookmarkOptions, IBorderOptions, IBordersOptions, ICellMergeAttributes, ICharacterStyleOptions, ICheckboxSymbolOptions, ICheckboxSymbolProperties, IColumnAttributes, IColumnsAttributes, ICommentOptions, ICommentsOptions, IConcreteNumberingOptions, IContext, IDistance, IDocGridAttributesProperties, IDocumentAttributesProperties, IDocumentBackgroundOptions, IDocumentDefaultsOptions, IDocumentFooter, IDocumentHeader, IDocumentOptions, IDrawingOptions, IExtendedMediaData, IExternalHyperlinkOptions, IFloating, IFontAttributesProperties, IFrameOptions, IGroupChildMediaData, IHeaderFooterGroup, IHeaderFooterOptions, IHeaderOptions, IHorizontalPositionOptions, IImageOptions, IIndentAttributesProperties, IInternalHyperlinkOptions, ILevelParagraphStylePropertiesOptions, ILevelsOptions, ILineNumberAttributes, IMargins, IMathFractionOptions, IMathFunctionOptions, IMathIntegralOptions, IMathLimitLowerOptions, IMathLimitUpperOptions, IMathOptions, IMathPreSubSuperScriptOptions, IMathRadicalOptions, IMathSubScriptOptions, IMathSubSuperScriptOptions, IMathSumOptions, IMathSuperScriptOptions, IMediaData, IMediaDataTransformation, IMediaTransformation, INumberedItemReferenceOptions, INumberingOptions, IPageBorderAttributes, IPageBordersOptions, IPageMarginAttributes, IPageNumberTypeAttributes, IPageReferenceOptions, IPageSizeAttributes, IParagraphOptions, IParagraphPropertiesChangeOptions, IParagraphPropertiesOptions, IParagraphPropertiesOptionsBase, IParagraphRunOptions, IParagraphRunPropertiesOptions, IParagraphStyleOptions, IParagraphStylePropertiesOptions, IPatch, type IPropertiesOptions, IRunOptions, IRunPropertiesChangeOptions, IRunPropertiesOptions, IRunStylePropertiesOptions, ISectionOptions, ISectionPropertiesChangeOptions, ISectionPropertiesOptions, ISectionPropertiesOptionsBase, IShadingAttributesProperties, ISpacingProperties, IStylesOptions, ISymbolRunOptions, ITableBordersOptions, ITableCellBorders, ITableCellOptions, ITableFloatOptions, ITableLookOptions, ITableOfContentsOptions, ITableOptions, ITablePropertiesChangeOptions, ITablePropertiesOptions, ITablePropertiesOptionsBase, ITableRowOptions, ITableRowPropertiesChangeOptions, ITableRowPropertiesOptions, ITableRowPropertiesOptionsBase, ITableWidthProperties, ITextWrapping, IVerticalPositionOptions, IWpgGroupOptions, IWpsShapeOptions, IXYFrameOptions, IXmlAttribute, IXmlableObject, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InputDataType, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math, MathAngledBrackets, MathComponent, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OutputByType, OutputType, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphChild, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchDocumentOptions, PatchDocumentOutputType, PatchType, Percentage, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabOptions, PositionalTabRelativeTo, PositivePercentage, PositiveUniversalMeasure, PrettifyType, RelativeHorizontalPosition, RelativeMeasure, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, SectionVerticalAlign, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopDefinition, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TableVerticalAlign, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, UniqueNumericIdCreator, UniversalMeasure, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgCommonMediaData, WpgGroupRun, WpgMediaData, WpsMediaData, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };
|
package/dist/index.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, stream, fflate,
|
|
1
|
+
var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, stream, fflate, xml) {
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
4
|
var __create = Object.create;
|
|
@@ -5771,29 +5771,20 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, stream, ff
|
|
|
5771
5771
|
};
|
|
5772
5772
|
//#endregion
|
|
5773
5773
|
//#region src/file/paragraph/run/image-run.ts
|
|
5774
|
-
const
|
|
5775
|
-
|
|
5776
|
-
const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + 8;
|
|
5777
|
-
const binaryString = atob(dataURI.substring(base64IndexWithOffset));
|
|
5778
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
5779
|
-
for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
|
|
5780
|
-
return bytes;
|
|
5781
|
-
};
|
|
5782
|
-
const standardizeData = (data) => typeof data === "string" ? convertDataURIToBinary(data) : data;
|
|
5783
|
-
const createImageData = (options, key) => ({
|
|
5784
|
-
data: standardizeData(options.data),
|
|
5774
|
+
const createImageData = (data, transformation, key) => ({
|
|
5775
|
+
data,
|
|
5785
5776
|
fileName: key,
|
|
5786
5777
|
transformation: {
|
|
5787
5778
|
emus: {
|
|
5788
|
-
x: Math.round(
|
|
5789
|
-
y: Math.round(
|
|
5779
|
+
x: Math.round(transformation.width * 9525),
|
|
5780
|
+
y: Math.round(transformation.height * 9525)
|
|
5790
5781
|
},
|
|
5791
|
-
flip:
|
|
5782
|
+
flip: transformation.flip,
|
|
5792
5783
|
pixels: {
|
|
5793
|
-
x: Math.round(
|
|
5794
|
-
y: Math.round(
|
|
5784
|
+
x: Math.round(transformation.width),
|
|
5785
|
+
y: Math.round(transformation.height)
|
|
5795
5786
|
},
|
|
5796
|
-
rotation:
|
|
5787
|
+
rotation: transformation.rotation ? transformation.rotation * 6e4 : void 0
|
|
5797
5788
|
}
|
|
5798
5789
|
});
|
|
5799
5790
|
/**
|
|
@@ -5822,8 +5813,12 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, stream, ff
|
|
|
5822
5813
|
constructor(options) {
|
|
5823
5814
|
super({});
|
|
5824
5815
|
_defineProperty(this, "imageData", void 0);
|
|
5825
|
-
const
|
|
5826
|
-
|
|
5816
|
+
const rawData = (0, undio.toUint8Array)(options.data);
|
|
5817
|
+
const key = `${hashedId(rawData)}.${options.type}`;
|
|
5818
|
+
if (options.type === "svg") {
|
|
5819
|
+
const fallbackData = (0, undio.toUint8Array)(options.fallback.data);
|
|
5820
|
+
this.imageData = _objectSpread2(_objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key)), {}, { fallback: _objectSpread2({ type: options.fallback.type }, createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)) });
|
|
5821
|
+
} else this.imageData = _objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key));
|
|
5827
5822
|
const drawing = new Drawing(this.imageData, {
|
|
5828
5823
|
docProperties: options.altText,
|
|
5829
5824
|
floating: options.floating,
|
|
@@ -18286,6 +18281,14 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, stream, ff
|
|
|
18286
18281
|
//#endregion
|
|
18287
18282
|
//#region src/util/output-type.ts
|
|
18288
18283
|
/**
|
|
18284
|
+
* Output type definitions for document generation.
|
|
18285
|
+
*
|
|
18286
|
+
* This module defines the various output formats supported when generating
|
|
18287
|
+
* .docx files. These types correspond to fflate's output formats.
|
|
18288
|
+
*
|
|
18289
|
+
* @module
|
|
18290
|
+
*/
|
|
18291
|
+
/**
|
|
18289
18292
|
* Converts a Uint8Array to the specified output type.
|
|
18290
18293
|
*
|
|
18291
18294
|
* This is used by both the Packer and patchDocument to convert fflate's
|
|
@@ -18297,10 +18300,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, stream, ff
|
|
|
18297
18300
|
case "blob": return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
|
|
18298
18301
|
case "arraybuffer": return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
18299
18302
|
case "uint8array": return data;
|
|
18300
|
-
case "base64": return
|
|
18303
|
+
case "base64": return btoa((0, fflate.strFromU8)(data, true));
|
|
18301
18304
|
case "string":
|
|
18302
|
-
case "text":
|
|
18303
|
-
case "binarystring": return
|
|
18305
|
+
case "text":
|
|
18306
|
+
case "binarystring": return (0, fflate.strFromU8)(data, true);
|
|
18304
18307
|
case "array": return [...data];
|
|
18305
18308
|
default: return data;
|
|
18306
18309
|
}
|
|
@@ -20173,7 +20176,6 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, stream, ff
|
|
|
20173
20176
|
exports.shortHexNumber = shortHexNumber;
|
|
20174
20177
|
exports.signedHpsMeasureValue = signedHpsMeasureValue;
|
|
20175
20178
|
exports.signedTwipsMeasureValue = signedTwipsMeasureValue;
|
|
20176
|
-
exports.standardizeData = standardizeData;
|
|
20177
20179
|
exports.twipsMeasureValue = twipsMeasureValue;
|
|
20178
20180
|
exports.uCharHexNumber = uCharHexNumber;
|
|
20179
20181
|
exports.uniqueId = uniqueId;
|
|
@@ -20182,4 +20184,4 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, stream, ff
|
|
|
20182
20184
|
exports.universalMeasureValue = universalMeasureValue;
|
|
20183
20185
|
exports.unsignedDecimalNumber = unsignedDecimalNumber;
|
|
20184
20186
|
return exports;
|
|
20185
|
-
})({}, xml_js, hash_js, nanoid_non_secure, stream, fflate,
|
|
20187
|
+
})({}, xml_js, hash_js, nanoid_non_secure, undio, stream, fflate, xml);
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { js2xml, xml2js } from "xml-js";
|
|
2
2
|
import hash from "hash.js";
|
|
3
3
|
import { customAlphabet, nanoid } from "nanoid/non-secure";
|
|
4
|
+
import { textToUint8Array, toUint8Array } from "undio";
|
|
4
5
|
import { Readable } from "stream";
|
|
5
6
|
import { Zip, ZipDeflate, ZipPassThrough, strFromU8, unzipSync, zipSync } from "fflate";
|
|
6
|
-
import { textToUint8Array, toUint8Array } from "undio";
|
|
7
7
|
import xml from "xml";
|
|
8
8
|
//#region \0@oxc-project+runtime@0.123.0/helpers/typeof.js
|
|
9
9
|
function _typeof(o) {
|
|
@@ -5752,29 +5752,20 @@ var Drawing = class extends XmlComponent {
|
|
|
5752
5752
|
};
|
|
5753
5753
|
//#endregion
|
|
5754
5754
|
//#region src/file/paragraph/run/image-run.ts
|
|
5755
|
-
const
|
|
5756
|
-
|
|
5757
|
-
const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + 8;
|
|
5758
|
-
const binaryString = atob(dataURI.substring(base64IndexWithOffset));
|
|
5759
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
5760
|
-
for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
|
|
5761
|
-
return bytes;
|
|
5762
|
-
};
|
|
5763
|
-
const standardizeData = (data) => typeof data === "string" ? convertDataURIToBinary(data) : data;
|
|
5764
|
-
const createImageData = (options, key) => ({
|
|
5765
|
-
data: standardizeData(options.data),
|
|
5755
|
+
const createImageData = (data, transformation, key) => ({
|
|
5756
|
+
data,
|
|
5766
5757
|
fileName: key,
|
|
5767
5758
|
transformation: {
|
|
5768
5759
|
emus: {
|
|
5769
|
-
x: Math.round(
|
|
5770
|
-
y: Math.round(
|
|
5760
|
+
x: Math.round(transformation.width * 9525),
|
|
5761
|
+
y: Math.round(transformation.height * 9525)
|
|
5771
5762
|
},
|
|
5772
|
-
flip:
|
|
5763
|
+
flip: transformation.flip,
|
|
5773
5764
|
pixels: {
|
|
5774
|
-
x: Math.round(
|
|
5775
|
-
y: Math.round(
|
|
5765
|
+
x: Math.round(transformation.width),
|
|
5766
|
+
y: Math.round(transformation.height)
|
|
5776
5767
|
},
|
|
5777
|
-
rotation:
|
|
5768
|
+
rotation: transformation.rotation ? transformation.rotation * 6e4 : void 0
|
|
5778
5769
|
}
|
|
5779
5770
|
});
|
|
5780
5771
|
/**
|
|
@@ -5803,8 +5794,12 @@ var ImageRun = class extends Run {
|
|
|
5803
5794
|
constructor(options) {
|
|
5804
5795
|
super({});
|
|
5805
5796
|
_defineProperty(this, "imageData", void 0);
|
|
5806
|
-
const
|
|
5807
|
-
|
|
5797
|
+
const rawData = toUint8Array(options.data);
|
|
5798
|
+
const key = `${hashedId(rawData)}.${options.type}`;
|
|
5799
|
+
if (options.type === "svg") {
|
|
5800
|
+
const fallbackData = toUint8Array(options.fallback.data);
|
|
5801
|
+
this.imageData = _objectSpread2(_objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key)), {}, { fallback: _objectSpread2({ type: options.fallback.type }, createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)) });
|
|
5802
|
+
} else this.imageData = _objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key));
|
|
5808
5803
|
const drawing = new Drawing(this.imageData, {
|
|
5809
5804
|
docProperties: options.altText,
|
|
5810
5805
|
floating: options.floating,
|
|
@@ -18267,6 +18262,14 @@ var Textbox = class extends FileChild {
|
|
|
18267
18262
|
//#endregion
|
|
18268
18263
|
//#region src/util/output-type.ts
|
|
18269
18264
|
/**
|
|
18265
|
+
* Output type definitions for document generation.
|
|
18266
|
+
*
|
|
18267
|
+
* This module defines the various output formats supported when generating
|
|
18268
|
+
* .docx files. These types correspond to fflate's output formats.
|
|
18269
|
+
*
|
|
18270
|
+
* @module
|
|
18271
|
+
*/
|
|
18272
|
+
/**
|
|
18270
18273
|
* Converts a Uint8Array to the specified output type.
|
|
18271
18274
|
*
|
|
18272
18275
|
* This is used by both the Packer and patchDocument to convert fflate's
|
|
@@ -18278,10 +18281,10 @@ const convertOutput = (data, type) => {
|
|
|
18278
18281
|
case "blob": return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
|
|
18279
18282
|
case "arraybuffer": return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
18280
18283
|
case "uint8array": return data;
|
|
18281
|
-
case "base64": return
|
|
18284
|
+
case "base64": return btoa(strFromU8(data, true));
|
|
18282
18285
|
case "string":
|
|
18283
|
-
case "text":
|
|
18284
|
-
case "binarystring": return
|
|
18286
|
+
case "text":
|
|
18287
|
+
case "binarystring": return strFromU8(data, true);
|
|
18285
18288
|
case "array": return [...data];
|
|
18286
18289
|
default: return data;
|
|
18287
18290
|
}
|
|
@@ -19858,4 +19861,4 @@ const findPatchKeys = (text) => {
|
|
|
19858
19861
|
return (_text$match = text.match(pattern)) !== null && _text$match !== void 0 ? _text$match : [];
|
|
19859
19862
|
};
|
|
19860
19863
|
//#endregion
|
|
19861
|
-
export { AbstractNumbering, AlignmentType, AnnotationReference, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue,
|
|
19864
|
+
export { AbstractNumbering, AlignmentType, AnnotationReference, Attributes, BaseXmlComponent, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, File as Document, File, DocumentAttributeNamespaces, DocumentAttributes, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FileChild, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathCurlyBrackets, MathDegree, MathDenominator, MathFraction, MathFunction, MathFunctionName, MathFunctionProperties, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathNumerator, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TableRow, TableRowProperties, TableRowPropertiesChange, TextDirection, TextEffect, TextRun, TextWrappingSide, TextWrappingType, Textbox, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND3, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createColumns, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccentCharacter, createMathBase, createMathLimitLocation, createMathNAryProperties, createMathPreSubSuperScriptProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapTight, createWrapTopAndBottom, dateTimeValue, decimalNumber, docPropertiesUniqueNumericIdGen, eighthPointMeasureValue, encodeUtf8, hashedId, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, patchDetector, patchDocument, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, sectionMarginDefaults, sectionPageSizeDefaults, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber };
|
package/dist/index.umd.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("xml-js"), require("hash.js"), require("nanoid/non-secure"), require("
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("xml-js"), require("hash.js"), require("nanoid/non-secure"), require("undio"), require("stream"), require("fflate"), require("xml")) : typeof define === "function" && define.amd ? define([
|
|
3
3
|
"exports",
|
|
4
4
|
"xml-js",
|
|
5
5
|
"hash.js",
|
|
6
6
|
"nanoid/non-secure",
|
|
7
|
+
"undio",
|
|
7
8
|
"stream",
|
|
8
9
|
"fflate",
|
|
9
|
-
"undio",
|
|
10
10
|
"xml"
|
|
11
|
-
], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.docxPlus = {}, global.xml_js, global.hash_js, global.nanoid_non_secure, global.
|
|
12
|
-
})(this, function(exports, xml_js, hash_js, nanoid_non_secure, stream, fflate,
|
|
11
|
+
], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.docxPlus = {}, global.xml_js, global.hash_js, global.nanoid_non_secure, global.undio, global.stream, global.fflate, global.xml));
|
|
12
|
+
})(this, function(exports, xml_js, hash_js, nanoid_non_secure, undio, stream, fflate, xml) {
|
|
13
13
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
14
14
|
//#region \0rolldown/runtime.js
|
|
15
15
|
var __create = Object.create;
|
|
@@ -5782,29 +5782,20 @@
|
|
|
5782
5782
|
};
|
|
5783
5783
|
//#endregion
|
|
5784
5784
|
//#region src/file/paragraph/run/image-run.ts
|
|
5785
|
-
const
|
|
5786
|
-
|
|
5787
|
-
const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + 8;
|
|
5788
|
-
const binaryString = atob(dataURI.substring(base64IndexWithOffset));
|
|
5789
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
5790
|
-
for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
|
|
5791
|
-
return bytes;
|
|
5792
|
-
};
|
|
5793
|
-
const standardizeData = (data) => typeof data === "string" ? convertDataURIToBinary(data) : data;
|
|
5794
|
-
const createImageData = (options, key) => ({
|
|
5795
|
-
data: standardizeData(options.data),
|
|
5785
|
+
const createImageData = (data, transformation, key) => ({
|
|
5786
|
+
data,
|
|
5796
5787
|
fileName: key,
|
|
5797
5788
|
transformation: {
|
|
5798
5789
|
emus: {
|
|
5799
|
-
x: Math.round(
|
|
5800
|
-
y: Math.round(
|
|
5790
|
+
x: Math.round(transformation.width * 9525),
|
|
5791
|
+
y: Math.round(transformation.height * 9525)
|
|
5801
5792
|
},
|
|
5802
|
-
flip:
|
|
5793
|
+
flip: transformation.flip,
|
|
5803
5794
|
pixels: {
|
|
5804
|
-
x: Math.round(
|
|
5805
|
-
y: Math.round(
|
|
5795
|
+
x: Math.round(transformation.width),
|
|
5796
|
+
y: Math.round(transformation.height)
|
|
5806
5797
|
},
|
|
5807
|
-
rotation:
|
|
5798
|
+
rotation: transformation.rotation ? transformation.rotation * 6e4 : void 0
|
|
5808
5799
|
}
|
|
5809
5800
|
});
|
|
5810
5801
|
/**
|
|
@@ -5833,8 +5824,12 @@
|
|
|
5833
5824
|
constructor(options) {
|
|
5834
5825
|
super({});
|
|
5835
5826
|
_defineProperty(this, "imageData", void 0);
|
|
5836
|
-
const
|
|
5837
|
-
|
|
5827
|
+
const rawData = (0, undio.toUint8Array)(options.data);
|
|
5828
|
+
const key = `${hashedId(rawData)}.${options.type}`;
|
|
5829
|
+
if (options.type === "svg") {
|
|
5830
|
+
const fallbackData = (0, undio.toUint8Array)(options.fallback.data);
|
|
5831
|
+
this.imageData = _objectSpread2(_objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key)), {}, { fallback: _objectSpread2({ type: options.fallback.type }, createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)) });
|
|
5832
|
+
} else this.imageData = _objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key));
|
|
5838
5833
|
const drawing = new Drawing(this.imageData, {
|
|
5839
5834
|
docProperties: options.altText,
|
|
5840
5835
|
floating: options.floating,
|
|
@@ -18297,6 +18292,14 @@
|
|
|
18297
18292
|
//#endregion
|
|
18298
18293
|
//#region src/util/output-type.ts
|
|
18299
18294
|
/**
|
|
18295
|
+
* Output type definitions for document generation.
|
|
18296
|
+
*
|
|
18297
|
+
* This module defines the various output formats supported when generating
|
|
18298
|
+
* .docx files. These types correspond to fflate's output formats.
|
|
18299
|
+
*
|
|
18300
|
+
* @module
|
|
18301
|
+
*/
|
|
18302
|
+
/**
|
|
18300
18303
|
* Converts a Uint8Array to the specified output type.
|
|
18301
18304
|
*
|
|
18302
18305
|
* This is used by both the Packer and patchDocument to convert fflate's
|
|
@@ -18308,10 +18311,10 @@
|
|
|
18308
18311
|
case "blob": return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
|
|
18309
18312
|
case "arraybuffer": return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
18310
18313
|
case "uint8array": return data;
|
|
18311
|
-
case "base64": return
|
|
18314
|
+
case "base64": return btoa((0, fflate.strFromU8)(data, true));
|
|
18312
18315
|
case "string":
|
|
18313
|
-
case "text":
|
|
18314
|
-
case "binarystring": return
|
|
18316
|
+
case "text":
|
|
18317
|
+
case "binarystring": return (0, fflate.strFromU8)(data, true);
|
|
18315
18318
|
case "array": return [...data];
|
|
18316
18319
|
default: return data;
|
|
18317
18320
|
}
|
|
@@ -20184,7 +20187,6 @@
|
|
|
20184
20187
|
exports.shortHexNumber = shortHexNumber;
|
|
20185
20188
|
exports.signedHpsMeasureValue = signedHpsMeasureValue;
|
|
20186
20189
|
exports.signedTwipsMeasureValue = signedTwipsMeasureValue;
|
|
20187
|
-
exports.standardizeData = standardizeData;
|
|
20188
20190
|
exports.twipsMeasureValue = twipsMeasureValue;
|
|
20189
20191
|
exports.uCharHexNumber = uCharHexNumber;
|
|
20190
20192
|
exports.uniqueId = uniqueId;
|