@office-open/docx 0.10.13 → 0.10.15

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.
@@ -2957,7 +2957,7 @@ function footnotePrXml(tag, opts) {
2957
2957
  if (opts.pos !== void 0) parts.push(`<w:pos w:val="${opts.pos}"/>`);
2958
2958
  if (opts.formatType !== void 0 || opts.format !== void 0) {
2959
2959
  const fmtAttrs = [];
2960
- if (opts.formatType !== void 0) fmtAttrs.push(`w:fmt="${opts.formatType}"`);
2960
+ if (opts.formatType !== void 0) fmtAttrs.push(`w:val="${opts.formatType}"`);
2961
2961
  if (opts.format !== void 0) fmtAttrs.push(`w:format="${opts.format}"`);
2962
2962
  parts.push(`<w:numFmt ${fmtAttrs.join(" ")}/>`);
2963
2963
  }
@@ -2996,7 +2996,7 @@ function stringifySectionPropertiesInner(opts) {
2996
2996
  appendHeaderFooterRefs(parts, "w:headerReference", opts.headerWrapperGroup);
2997
2997
  appendHeaderFooterRefs(parts, "w:footerReference", opts.footerWrapperGroup);
2998
2998
  const { size: { width = sectionPageSizeDefaults.WIDTH, height = sectionPageSizeDefaults.HEIGHT, orientation = sectionPageSizeDefaults.ORIENTATION, code } = {}, margin: { top = sectionMarginDefaults.TOP, right = sectionMarginDefaults.RIGHT, bottom = sectionMarginDefaults.BOTTOM, left = sectionMarginDefaults.LEFT, header = sectionMarginDefaults.HEADER, footer = sectionMarginDefaults.FOOTER, gutter = sectionMarginDefaults.GUTTER } = {}, pageNumbers = {}, borders, textDirection } = opts.page ?? {};
2999
- const { linePitch = 312, charSpace = 0, type: gridType = "lines" } = opts.grid ?? {};
2999
+ const { linePitch = 312, charSpace = 0, type: gridType = "lines" } = typeof opts.grid === "object" ? opts.grid : {};
3000
3000
  if (opts.footnotePr) parts.push(footnotePrXml("w:footnotePr", opts.footnotePr));
3001
3001
  if (opts.endnotePr) parts.push(footnotePrXml("w:endnotePr", opts.endnotePr));
3002
3002
  if (opts.type) parts.push(sectionTypeXml(opts.type));
@@ -3024,7 +3024,7 @@ function stringifySectionPropertiesInner(opts) {
3024
3024
  parts.push(`<w:paperSrc ${psAttr.join(" ")}/>`);
3025
3025
  }
3026
3026
  if (opts.printerSettingsId !== void 0) parts.push(`<w:printerSettings r:id="${opts.printerSettingsId}"/>`);
3027
- parts.push(docGridXml(linePitch, charSpace, gridType));
3027
+ if (opts.grid !== false) parts.push(docGridXml(linePitch, charSpace, gridType));
3028
3028
  if (opts.revision) parts.push(stringifySectionPropertiesChange(opts.revision));
3029
3029
  return parts.join("");
3030
3030
  }
@@ -3071,9 +3071,9 @@ function parseSectionPropertiesEl(el) {
3071
3071
  const val = attr(el, attrName);
3072
3072
  if (val) opts[optKey] = val;
3073
3073
  }
3074
+ const page = {};
3074
3075
  const pgSz = findChild(el, "w:pgSz");
3075
3076
  if (pgSz) {
3076
- const page = {};
3077
3077
  const size = {};
3078
3078
  const w = attrNum(pgSz, "w:w");
3079
3079
  const h = attrNum(pgSz, "w:h");
@@ -3089,38 +3089,38 @@ function parseSectionPropertiesEl(el) {
3089
3089
  const code = attrNum(pgSz, "w:code");
3090
3090
  if (code !== void 0) size.code = code;
3091
3091
  if (Object.keys(size).length > 0) page.size = size;
3092
- const pgMar = findChild(el, "w:pgMar");
3093
- if (pgMar) {
3094
- const margin = {};
3095
- for (const [a, o] of [
3096
- ["w:top", "top"],
3097
- ["w:right", "right"],
3098
- ["w:bottom", "bottom"],
3099
- ["w:left", "left"],
3100
- ["w:header", "header"],
3101
- ["w:footer", "footer"],
3102
- ["w:gutter", "gutter"]
3103
- ]) {
3104
- const val = attrNum(pgMar, a);
3105
- if (val !== void 0) margin[o] = val;
3106
- }
3107
- if (Object.keys(margin).length > 0) page.margin = margin;
3108
- }
3109
- const pgNumType = findChild(el, "w:pgNumType");
3110
- if (pgNumType) {
3111
- const pageNumbers = {};
3112
- const start = attrNum(pgNumType, "w:start");
3113
- if (start !== void 0) pageNumbers.start = start;
3114
- const fmt = attr(pgNumType, "w:fmt");
3115
- if (fmt && PAGE_NUMBER_FORMATS.includes(fmt)) pageNumbers.formatType = fmt;
3116
- const chapSep = attr(pgNumType, "w:chapSep");
3117
- if (chapSep && PAGE_NUMBER_SEPARATORS.includes(chapSep)) pageNumbers.separator = chapSep;
3118
- const chapStyle = attrNum(pgNumType, "w:chapStyle");
3119
- if (chapStyle !== void 0) pageNumbers.chapStyle = chapStyle;
3120
- if (Object.keys(pageNumbers).length > 0) page.pageNumbers = pageNumbers;
3121
- }
3122
- if (Object.keys(page).length > 0) opts.page = page;
3123
3092
  }
3093
+ const pgMar = findChild(el, "w:pgMar");
3094
+ if (pgMar) {
3095
+ const margin = {};
3096
+ for (const [a, o] of [
3097
+ ["w:top", "top"],
3098
+ ["w:right", "right"],
3099
+ ["w:bottom", "bottom"],
3100
+ ["w:left", "left"],
3101
+ ["w:header", "header"],
3102
+ ["w:footer", "footer"],
3103
+ ["w:gutter", "gutter"]
3104
+ ]) {
3105
+ const val = attrNum(pgMar, a);
3106
+ if (val !== void 0) margin[o] = val;
3107
+ }
3108
+ if (Object.keys(margin).length > 0) page.margin = margin;
3109
+ }
3110
+ const pgNumType = findChild(el, "w:pgNumType");
3111
+ if (pgNumType) {
3112
+ const pageNumbers = {};
3113
+ const start = attrNum(pgNumType, "w:start");
3114
+ if (start !== void 0) pageNumbers.start = start;
3115
+ const fmt = attr(pgNumType, "w:fmt");
3116
+ if (fmt && PAGE_NUMBER_FORMATS.includes(fmt)) pageNumbers.formatType = fmt;
3117
+ const chapSep = attr(pgNumType, "w:chapSep");
3118
+ if (chapSep && PAGE_NUMBER_SEPARATORS.includes(chapSep)) pageNumbers.separator = chapSep;
3119
+ const chapStyle = attrNum(pgNumType, "w:chapStyle");
3120
+ if (chapStyle !== void 0) pageNumbers.chapStyle = chapStyle;
3121
+ if (Object.keys(pageNumbers).length > 0) page.pageNumbers = pageNumbers;
3122
+ }
3123
+ if (Object.keys(page).length > 0) opts.page = page;
3124
3124
  const cols = findChild(el, "w:cols");
3125
3125
  if (cols) {
3126
3126
  const column = {};
@@ -3170,8 +3170,8 @@ function parseSectionPropertiesEl(el) {
3170
3170
  if (linePitch !== void 0) grid.linePitch = linePitch;
3171
3171
  const charSpace = attrNum(docGrid, "w:charSpace");
3172
3172
  if (charSpace !== void 0) grid.charSpace = charSpace;
3173
- if (Object.keys(grid).length > 0) opts.grid = grid;
3174
- }
3173
+ opts.grid = grid;
3174
+ } else opts.grid = false;
3175
3175
  const lnNumType = findChild(el, "w:lnNumType");
3176
3176
  if (lnNumType) {
3177
3177
  const lineNumbers = {};
@@ -3289,7 +3289,7 @@ function parseNotePropertiesEl(el) {
3289
3289
  }
3290
3290
  const numFmt = findChild(el, "w:numFmt");
3291
3291
  if (numFmt) {
3292
- const fmt = attr(numFmt, "w:fmt");
3292
+ const fmt = attr(numFmt, "w:val");
3293
3293
  if (fmt) opts.formatType = fmt;
3294
3294
  const format = attr(numFmt, "w:format");
3295
3295
  if (format) opts.format = format;
@@ -5414,6 +5414,18 @@ function parseImageRun(el, ctx) {
5414
5414
  if (ln) imageOpts.outline = outlineDesc.parse(ln, ctx);
5415
5415
  const effectLst = findChild(picSpPr, "a:effectLst");
5416
5416
  if (effectLst) imageOpts.effects = effectListDesc.parse(effectLst, ctx);
5417
+ const xfrm = findChild(picSpPr, "a:xfrm");
5418
+ if (xfrm) {
5419
+ const transform = imageOpts.transformation;
5420
+ const rot = attrNum(xfrm, "rot");
5421
+ if (rot !== void 0) transform.rotation = rot / 6e4;
5422
+ const flipH = attrBool(xfrm, "flipH");
5423
+ const flipV = attrBool(xfrm, "flipV");
5424
+ if (flipH !== void 0 || flipV !== void 0) transform.flip = {
5425
+ ...flipH !== void 0 ? { horizontal: flipH } : {},
5426
+ ...flipV !== void 0 ? { vertical: flipV } : {}
5427
+ };
5428
+ }
5417
5429
  }
5418
5430
  const blipResult = blipDesc.parse(blip, ctx);
5419
5431
  if (blipResult.blipEffects) imageOpts.blipEffects = blipResult.blipEffects;
@@ -6997,7 +7009,8 @@ function stringifyChildDispatch(child, ctx) {
6997
7009
  style: opts.style,
6998
7010
  title: opts.title,
6999
7011
  type: opts.type,
7000
- threeD: opts.threeD
7012
+ threeD: opts.threeD,
7013
+ view3D: opts.view3D
7001
7014
  }, ctx.file);
7002
7015
  ctx.file.charts.addChart(chartKey, {
7003
7016
  key: chartKey,
@@ -8493,4 +8506,4 @@ const commentsDesc = {
8493
8506
  //#endregion
8494
8507
  export { parseRunProperties as $, PageOrientation as A, TextWrappingType as B, FontWrapper as C, EMPTY_RUN_ELEMENTS as Ct, sectionMarginDefaults as D, LineRuleType as Dt, stringifySectionPropertiesXml as E, HeadingLevel as Et, HorizontalPositionAlign as F, sdtBlockDesc as G, checkboxSymbolRunInner as H, NumberFormat as I, stringifySdtPr as J, setBodyParseChild as K, SpaceType as L, createPageNumberType as M, HorizontalPositionRelativeFrom as N, sectionPageSizeDefaults as O, VerticalPositionRelativeFrom as P, stringifyRunProperties as Q, VerticalPositionAlign as R, parseSdtProperties as S, createTransformation as St, sectionPropertiesDesc as T, breakXml as Tt, customXmlBlockDesc as U, altChunkDesc as V, parseCustomXmlProperties as W, subDocDesc as X, stringifySdtShell as Y, stringifyParagraphProperties as Z, stringifyBodyChild as _, VerticalAnchor as _t, setTableParseChild as a, widthFiftiethsToPct as at, stringifyTableOfContents as b, createImageData$1 as bt, stringifyTableProperties as c, TextDirection as ct, stringifyParagraphInline as d, createFormFieldData as dt, stringifyElement as et, stringifyRunInline as f, parseFormFieldData as ft, parseParagraphProperties as g, TextVerticalType as gt, parseParagraph as h, TextVertOverflowType as ht, parseTableRowPropertiesEl as i, WidthType as it, PageNumberSeparator as j, PageTextDirectionType as k, stringifyTableRowProperties as l, VerticalMergeType as lt, resetDrawingIdGen as m, TextHorzOverflowType as mt, parseTableCellPropertiesEl as n, parseShading as nt, tableDesc as o, widthPctToFiftieths as ot, drawingDesc as p, TextBodyWrappingType as pt, stringifyCustomXmlShell as q, parseTablePropertiesEl as r, objectDesc as rt, stringifyTableCellProperties as s, BorderStyle as st, commentsDesc as t, ShadingType as tt, stringifyChildDispatch as u, FormFieldTextType as ut, stringifyDocumentXml as v, createBodyProperties as vt, parseSectionPropertiesEl as w, PageNumber as wt, parseSdtBlock as x, Media as xt, replaceRelsWithPlaceholders as y, parseBodyProperties as yt, TextWrappingSide as z };
8495
8508
 
8496
- //# sourceMappingURL=comments-BKbOd_pv.mjs.map
8509
+ //# sourceMappingURL=comments-D_flVfxw.mjs.map