js.documents 12.0.0 → 12.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.
@@ -138,6 +138,7 @@ function populatePptxTable(table, block, resolveHyperlinkRId) {
138
138
  function applyCellDecoration(target, cell) {
139
139
  if (cell.background !== void 0) target.background = (0, document_schema_js.resolveCellFillColor)(cell.background);
140
140
  target.borders = cell.borders;
141
+ target.verticalAlign = cell.verticalAlign;
141
142
  }
142
143
  //#endregion
143
144
  exports.buildPptxPackage = buildPptxPackage;
@@ -137,6 +137,7 @@ function populatePptxTable(table, block, resolveHyperlinkRId) {
137
137
  function applyCellDecoration(target, cell) {
138
138
  if (cell.background !== void 0) target.background = resolveCellFillColor(cell.background);
139
139
  target.borders = cell.borders;
140
+ target.verticalAlign = cell.verticalAlign;
140
141
  }
141
142
  //#endregion
142
143
  export { buildPptxPackage, embeddedPresentationSerialiser };
@@ -1,6 +1,6 @@
1
1
  import { t as ImageInit } from "../../image-C3L2cCLQ.cjs";
2
2
  import { r as PptxShape } from "../../shape-C2ef6uwC.cjs";
3
- import { r as PptxTableInit, t as PptxTable } from "../../table-CtbzOK8s.cjs";
3
+ import { r as PptxTableInit, t as PptxTable } from "../../table-ukpjK2hS.cjs";
4
4
  import { Box, ContentVector } from "document-schema.js";
5
5
  import { Package, XmlElement, XmlNode } from "ooxml.js";
6
6
  //#region src/edit/pptx/slide.d.ts
@@ -1,6 +1,6 @@
1
1
  import { t as ImageInit } from "../../image-CAeD6ZbR.js";
2
2
  import { r as PptxShape } from "../../shape-DwZouh8R.js";
3
- import { r as PptxTableInit, t as PptxTable } from "../../table-D2CgT0Gf.js";
3
+ import { r as PptxTableInit, t as PptxTable } from "../../table-BuNLtwgL.js";
4
4
  import { Package, XmlElement, XmlNode } from "ooxml.js";
5
5
  import { Box, ContentVector } from "document-schema.js";
6
6
  //#region src/edit/pptx/slide.d.ts
@@ -10,6 +10,16 @@ let document_schema_js = require("document-schema.js");
10
10
  const DEFAULT_TABLE_WIDTH_PT = 468;
11
11
  const DEFAULT_ROW_HEIGHT_PT = 20;
12
12
  const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
13
+ const PPTX_TABLE_CELL_VERTICAL_ALIGN_ANCHOR = {
14
+ top: "t",
15
+ center: "ctr",
16
+ bottom: "b"
17
+ };
18
+ const ANCHOR_TABLE_CELL_VERTICAL_ALIGN = /* @__PURE__ */ new Map([
19
+ ["t", "top"],
20
+ ["ctr", "center"],
21
+ ["b", "bottom"]
22
+ ]);
13
23
  var PptxTableCell = class {
14
24
  node;
15
25
  constructor(node) {
@@ -108,6 +118,21 @@ var PptxTableCell = class {
108
118
  tcPr.children.push(require_xml_fragment.el(tag, { w: String(require_model_units.ptToEmu(border.widthPt)) }, [require_xml_fragment.el("a:solidFill", {}, [require_xml_fragment.el("a:srgbClr", { val: require_edit_drawingml_vector.drawingMlColorHex(border.color) })])]));
109
119
  }
110
120
  }
121
+ get verticalAlign() {
122
+ const tcPr = this.tcPrElement(false);
123
+ if (tcPr === void 0) return;
124
+ const anchor = (0, ooxml_js.attr)(tcPr, "anchor");
125
+ return anchor === void 0 ? void 0 : ANCHOR_TABLE_CELL_VERTICAL_ALIGN.get(anchor);
126
+ }
127
+ set verticalAlign(value) {
128
+ if (value === void 0) {
129
+ const tcPr = this.tcPrElement(false);
130
+ if (tcPr !== void 0) require_xml_edit.removeAttr(tcPr, "anchor");
131
+ return;
132
+ }
133
+ const tcPr = this.tcPrElement(true);
134
+ require_xml_edit.setAttr(tcPr, "anchor", PPTX_TABLE_CELL_VERTICAL_ALIGN_ANCHOR[value]);
135
+ }
111
136
  readBorder(lnElement) {
112
137
  if (lnElement === void 0) return;
113
138
  const w = (0, ooxml_js.attr)(lnElement, "w");
@@ -1,2 +1,2 @@
1
- import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-CtbzOK8s.cjs";
1
+ import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-ukpjK2hS.cjs";
2
2
  export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
@@ -1,2 +1,2 @@
1
- import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-D2CgT0Gf.js";
1
+ import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-BuNLtwgL.js";
2
2
  export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
@@ -9,6 +9,16 @@ import { rgbHexToColor } from "document-schema.js";
9
9
  const DEFAULT_TABLE_WIDTH_PT = 468;
10
10
  const DEFAULT_ROW_HEIGHT_PT = 20;
11
11
  const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
12
+ const PPTX_TABLE_CELL_VERTICAL_ALIGN_ANCHOR = {
13
+ top: "t",
14
+ center: "ctr",
15
+ bottom: "b"
16
+ };
17
+ const ANCHOR_TABLE_CELL_VERTICAL_ALIGN = /* @__PURE__ */ new Map([
18
+ ["t", "top"],
19
+ ["ctr", "center"],
20
+ ["b", "bottom"]
21
+ ]);
12
22
  var PptxTableCell = class {
13
23
  node;
14
24
  constructor(node) {
@@ -107,6 +117,21 @@ var PptxTableCell = class {
107
117
  tcPr.children.push(el(tag, { w: String(ptToEmu(border.widthPt)) }, [el("a:solidFill", {}, [el("a:srgbClr", { val: drawingMlColorHex(border.color) })])]));
108
118
  }
109
119
  }
120
+ get verticalAlign() {
121
+ const tcPr = this.tcPrElement(false);
122
+ if (tcPr === void 0) return;
123
+ const anchor = attr(tcPr, "anchor");
124
+ return anchor === void 0 ? void 0 : ANCHOR_TABLE_CELL_VERTICAL_ALIGN.get(anchor);
125
+ }
126
+ set verticalAlign(value) {
127
+ if (value === void 0) {
128
+ const tcPr = this.tcPrElement(false);
129
+ if (tcPr !== void 0) removeAttr(tcPr, "anchor");
130
+ return;
131
+ }
132
+ const tcPr = this.tcPrElement(true);
133
+ setAttr(tcPr, "anchor", PPTX_TABLE_CELL_VERTICAL_ALIGN_ANCHOR[value]);
134
+ }
110
135
  readBorder(lnElement) {
111
136
  if (lnElement === void 0) return;
112
137
  const w = attr(lnElement, "w");
package/dist/index.d.cts CHANGED
@@ -66,7 +66,7 @@ import { PptShape, PptSlide } from "./edit/ppt/slide.cjs";
66
66
  import { CreatePptOptions, PptEditor, createPpt, openPpt } from "./edit/ppt/editor.cjs";
67
67
  import { BuildPptxPackageOptions, buildPptxPackage, embeddedPresentationSerialiser } from "./edit/pptx/content.cjs";
68
68
  import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-C2ef6uwC.cjs";
69
- import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-CtbzOK8s.cjs";
69
+ import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-ukpjK2hS.cjs";
70
70
  import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.cjs";
71
71
  import { CreatePptxOptions, PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.cjs";
72
72
  import { CreateEmptyPptxPackageOptions } from "./edit/pptx/scaffold.cjs";
package/dist/index.d.ts CHANGED
@@ -66,7 +66,7 @@ import { PptShape, PptSlide } from "./edit/ppt/slide.js";
66
66
  import { CreatePptOptions, PptEditor, createPpt, openPpt } from "./edit/ppt/editor.js";
67
67
  import { BuildPptxPackageOptions, buildPptxPackage, embeddedPresentationSerialiser } from "./edit/pptx/content.js";
68
68
  import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-DwZouh8R.js";
69
- import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-D2CgT0Gf.js";
69
+ import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-BuNLtwgL.js";
70
70
  import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.js";
71
71
  import { CreatePptxOptions, PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.js";
72
72
  import { CreateEmptyPptxPackageOptions } from "./edit/pptx/scaffold.js";
@@ -1,6 +1,6 @@
1
1
  import { t as DrawingParagraphInit } from "./shape-DwZouh8R.js";
2
2
  import { XmlElement } from "ooxml.js";
3
- import { Box, Color, ContentCellBorders } from "document-schema.js";
3
+ import { Box, Color, ContentCellBorders, ContentTableCell } from "document-schema.js";
4
4
  //#region src/edit/pptx/table.d.ts
5
5
  interface PptxTableInit {
6
6
  readonly rows: number;
@@ -22,6 +22,8 @@ declare class PptxTableCell {
22
22
  set background(value: Color | undefined);
23
23
  get borders(): ContentCellBorders | undefined;
24
24
  set borders(value: ContentCellBorders | undefined);
25
+ get verticalAlign(): ContentTableCell["verticalAlign"];
26
+ set verticalAlign(value: ContentTableCell["verticalAlign"]);
25
27
  private readBorder;
26
28
  setParagraphs(paragraphs: readonly DrawingParagraphInit[]): void;
27
29
  }
@@ -1,5 +1,5 @@
1
1
  import { t as DrawingParagraphInit } from "./shape-C2ef6uwC.cjs";
2
- import { Box, Color, ContentCellBorders } from "document-schema.js";
2
+ import { Box, Color, ContentCellBorders, ContentTableCell } from "document-schema.js";
3
3
  import { XmlElement } from "ooxml.js";
4
4
  //#region src/edit/pptx/table.d.ts
5
5
  interface PptxTableInit {
@@ -22,6 +22,8 @@ declare class PptxTableCell {
22
22
  set background(value: Color | undefined);
23
23
  get borders(): ContentCellBorders | undefined;
24
24
  set borders(value: ContentCellBorders | undefined);
25
+ get verticalAlign(): ContentTableCell["verticalAlign"];
26
+ set verticalAlign(value: ContentTableCell["verticalAlign"]);
25
27
  private readBorder;
26
28
  setParagraphs(paragraphs: readonly DrawingParagraphInit[]): void;
27
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js.documents",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -85,7 +85,7 @@
85
85
  "fflate": "0.8.3",
86
86
  "markdown-codec": "10.0.0",
87
87
  "odf.js": "10.0.0",
88
- "ooxml.js": "11.0.0",
88
+ "ooxml.js": "11.1.0",
89
89
  "pdf-codec": "5.2.3",
90
90
  "ppt-codec": "2.0.4",
91
91
  "rtf-codec": "7.0.0",