@hirokisakabe/pom 6.4.0 → 7.0.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 CHANGED
@@ -142,16 +142,16 @@ For detailed node documentation, see [Nodes](./docs/nodes.md).
142
142
 
143
143
  ```xml
144
144
  <Table defaultRowHeight="36" cellBorder='{"color":"CBD5E1","width":1}'>
145
- <TableColumn width="80" />
146
- <TableColumn width="200" />
147
- <TableRow>
148
- <TableCell bold="true" backgroundColor="0F172A" color="FFFFFF">ID</TableCell>
149
- <TableCell bold="true" backgroundColor="0F172A" color="FFFFFF">Name</TableCell>
150
- </TableRow>
151
- <TableRow>
152
- <TableCell>001</TableCell>
153
- <TableCell>Project Alpha</TableCell>
154
- </TableRow>
145
+ <Col width="80" />
146
+ <Col width="200" />
147
+ <Tr>
148
+ <Td bold="true" backgroundColor="0F172A" color="FFFFFF">ID</Td>
149
+ <Td bold="true" backgroundColor="0F172A" color="FFFFFF">Name</Td>
150
+ </Tr>
151
+ <Tr>
152
+ <Td>001</Td>
153
+ <Td>Project Alpha</Td>
154
+ </Tr>
155
155
  </Table>
156
156
  ```
157
157
 
@@ -442,10 +442,10 @@ export const CHILD_ELEMENT_COERCION_MAP = {
442
442
  label: "string",
443
443
  color: "string",
444
444
  },
445
- TableColumn: {
445
+ Col: {
446
446
  width: "number",
447
447
  },
448
- TableCell: {
448
+ Td: {
449
449
  text: "string",
450
450
  fontSize: "number",
451
451
  color: "string",
@@ -546,19 +546,19 @@ function convertTableChildren(childElements, result, errors) {
546
546
  for (const child of childElements) {
547
547
  const tag = getTagName(child);
548
548
  switch (tag) {
549
- case "TableColumn":
549
+ case "Col":
550
550
  columns.push(coerceChildAttrs("Table", tag, getAttributes(child), errors));
551
551
  break;
552
- case "TableRow": {
552
+ case "Tr": {
553
553
  const rowAttrs = getAttributes(child);
554
554
  const cells = [];
555
555
  for (const cellEl of getChildElements(child)) {
556
556
  const cellTag = getTagName(cellEl);
557
- if (cellTag !== "TableCell") {
558
- errors.push(`Unknown child element <${cellTag}> inside <TableRow>. Expected: <TableCell>`);
557
+ if (cellTag !== "Td") {
558
+ errors.push(`Unknown child element <${cellTag}> inside <Tr>. Expected: <Td>`);
559
559
  continue;
560
560
  }
561
- const cellAttrs = coerceChildAttrs("TableRow", cellTag, getAttributes(cellEl), errors);
561
+ const cellAttrs = coerceChildAttrs("Tr", cellTag, getAttributes(cellEl), errors);
562
562
  const runsResult = buildRunsAndText(cellEl);
563
563
  if (runsResult) {
564
564
  cellAttrs.runs = runsResult.runs;
@@ -576,7 +576,7 @@ function convertTableChildren(childElements, result, errors) {
576
576
  if (rowAttrs.height !== undefined) {
577
577
  const h = Number(rowAttrs.height);
578
578
  if (isNaN(h)) {
579
- errors.push(`Cannot convert "${rowAttrs.height}" to number in <TableRow> "height" attribute`);
579
+ errors.push(`Cannot convert "${rowAttrs.height}" to number in <Tr> "height" attribute`);
580
580
  }
581
581
  else {
582
582
  row.height = h;
@@ -586,14 +586,14 @@ function convertTableChildren(childElements, result, errors) {
586
586
  break;
587
587
  }
588
588
  default:
589
- errors.push(`Unknown child element <${tag}> inside <Table>. Expected: <TableColumn> or <TableRow>`);
589
+ errors.push(`Unknown child element <${tag}> inside <Table>. Expected: <Col> or <Tr>`);
590
590
  }
591
591
  }
592
592
  if (columns.length > 0) {
593
593
  result.columns = columns;
594
594
  }
595
595
  else if (rows.length > 0) {
596
- // TableColumn が未指定の場合、行のセル数(colspan 考慮)からデフォルトの columns を自動生成
596
+ // Col が未指定の場合、行のセル数(colspan 考慮)からデフォルトの columns を自動生成
597
597
  const maxCells = Math.max(...rows.map((row) => row.cells.reduce((sum, cell) => sum + (cell.colspan ?? 1), 0)));
598
598
  result.columns = Array.from({ length: maxCells }, () => ({}));
599
599
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hirokisakabe/pom",
3
- "version": "6.4.0",
3
+ "version": "7.0.0",
4
4
  "description": "AI-friendly PowerPoint generation with a Flexbox layout engine.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",