@hirokisakabe/pom 5.3.0 → 5.5.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.
Files changed (83) hide show
  1. package/README.md +7 -5
  2. package/dist/autoFit/autoFit.d.ts +2 -1
  3. package/dist/autoFit/autoFit.d.ts.map +1 -1
  4. package/dist/autoFit/autoFit.js +33 -17
  5. package/dist/buildContext.d.ts +2 -0
  6. package/dist/buildContext.d.ts.map +1 -1
  7. package/dist/buildContext.js +2 -0
  8. package/dist/buildPptx.d.ts +7 -1
  9. package/dist/buildPptx.d.ts.map +1 -1
  10. package/dist/buildPptx.js +14 -5
  11. package/dist/calcYogaLayout/calcYogaLayout.d.ts +4 -2
  12. package/dist/calcYogaLayout/calcYogaLayout.d.ts.map +1 -1
  13. package/dist/calcYogaLayout/calcYogaLayout.js +29 -15
  14. package/dist/calcYogaLayout/types.d.ts +16 -0
  15. package/dist/calcYogaLayout/types.d.ts.map +1 -0
  16. package/dist/calcYogaLayout/types.js +14 -0
  17. package/dist/diagnostics.d.ts +14 -0
  18. package/dist/diagnostics.d.ts.map +1 -0
  19. package/dist/diagnostics.js +17 -0
  20. package/dist/icons/iconData.d.ts.map +1 -1
  21. package/dist/icons/iconData.js +7708 -43
  22. package/dist/index.d.ts +3 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -0
  25. package/dist/parseXml/parseXml.d.ts +1 -1
  26. package/dist/parseXml/parseXml.d.ts.map +1 -1
  27. package/dist/parseXml/parseXml.js +16 -16
  28. package/dist/registry/definitions/icon.d.ts.map +1 -1
  29. package/dist/registry/definitions/icon.js +26 -14
  30. package/dist/registry/definitions/image.d.ts.map +1 -1
  31. package/dist/registry/definitions/image.js +2 -3
  32. package/dist/registry/definitions/layer.d.ts.map +1 -1
  33. package/dist/registry/definitions/layer.js +9 -6
  34. package/dist/registry/definitions/line.d.ts.map +1 -1
  35. package/dist/registry/definitions/line.js +1 -2
  36. package/dist/registry/types.d.ts +2 -1
  37. package/dist/registry/types.d.ts.map +1 -1
  38. package/dist/renderPptx/nodes/chart.d.ts.map +1 -1
  39. package/dist/renderPptx/nodes/chart.js +6 -4
  40. package/dist/renderPptx/nodes/flow.d.ts.map +1 -1
  41. package/dist/renderPptx/nodes/flow.js +14 -4
  42. package/dist/renderPptx/nodes/image.d.ts.map +1 -1
  43. package/dist/renderPptx/nodes/image.js +8 -6
  44. package/dist/renderPptx/nodes/list.d.ts.map +1 -1
  45. package/dist/renderPptx/nodes/list.js +19 -16
  46. package/dist/renderPptx/nodes/matrix.d.ts.map +1 -1
  47. package/dist/renderPptx/nodes/matrix.js +11 -9
  48. package/dist/renderPptx/nodes/processArrow.d.ts.map +1 -1
  49. package/dist/renderPptx/nodes/processArrow.js +14 -4
  50. package/dist/renderPptx/nodes/pyramid.d.ts.map +1 -1
  51. package/dist/renderPptx/nodes/pyramid.js +6 -4
  52. package/dist/renderPptx/nodes/shape.d.ts.map +1 -1
  53. package/dist/renderPptx/nodes/shape.js +6 -4
  54. package/dist/renderPptx/nodes/table.d.ts.map +1 -1
  55. package/dist/renderPptx/nodes/table.js +7 -5
  56. package/dist/renderPptx/nodes/timeline.d.ts.map +1 -1
  57. package/dist/renderPptx/nodes/timeline.js +14 -4
  58. package/dist/renderPptx/nodes/tree.d.ts.map +1 -1
  59. package/dist/renderPptx/nodes/tree.js +6 -4
  60. package/dist/renderPptx/textOptions.d.ts.map +1 -1
  61. package/dist/renderPptx/textOptions.js +6 -4
  62. package/dist/renderPptx/utils/contentArea.d.ts +26 -0
  63. package/dist/renderPptx/utils/contentArea.d.ts.map +1 -0
  64. package/dist/renderPptx/utils/contentArea.js +26 -0
  65. package/dist/renderPptx/utils/scaleToFit.d.ts +3 -2
  66. package/dist/renderPptx/utils/scaleToFit.d.ts.map +1 -1
  67. package/dist/renderPptx/utils/scaleToFit.js +3 -3
  68. package/dist/shared/freeYogaTree.d.ts +3 -3
  69. package/dist/shared/freeYogaTree.d.ts.map +1 -1
  70. package/dist/shared/freeYogaTree.js +16 -21
  71. package/dist/shared/measureImage.d.ts +3 -2
  72. package/dist/shared/measureImage.d.ts.map +1 -1
  73. package/dist/shared/measureImage.js +5 -5
  74. package/dist/toPositioned/toPositioned.d.ts +3 -6
  75. package/dist/toPositioned/toPositioned.d.ts.map +1 -1
  76. package/dist/toPositioned/toPositioned.js +11 -19
  77. package/dist/types.d.ts +31 -464
  78. package/dist/types.d.ts.map +1 -1
  79. package/dist/types.js +43 -50
  80. package/package.json +10 -4
  81. package/dist/parseXml/inputSchema.d.ts +0 -1622
  82. package/dist/parseXml/inputSchema.d.ts.map +0 -1
  83. package/dist/parseXml/inputSchema.js +0 -257
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { buildPptx } from "./buildPptx.ts";
2
- export type { TextMeasurementMode } from "./buildPptx.ts";
2
+ export type { BuildPptxResult, TextMeasurementMode } from "./buildPptx.ts";
3
+ export { DiagnosticsError } from "./diagnostics.ts";
4
+ export type { Diagnostic, DiagnosticCode } from "./diagnostics.ts";
3
5
  export { ParseXmlError } from "./parseXml/parseXml.ts";
4
6
  export type { SlideMasterOptions, SlideMasterBackground, SlideMasterMargin, MasterObject, MasterTextObject, MasterImageObject, MasterRectObject, MasterLineObject, SlideNumberOptions, } from "./types.ts";
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { buildPptx } from "./buildPptx.js";
2
+ export { DiagnosticsError } from "./diagnostics.js";
2
3
  export { ParseXmlError } from "./parseXml/parseXml.js";
@@ -1,4 +1,4 @@
1
- import type { POMNode } from "../types.ts";
1
+ import { type POMNode } from "../types.ts";
2
2
  export declare class ParseXmlError extends Error {
3
3
  readonly errors: string[];
4
4
  constructor(errors: string[]);
@@ -1 +1 @@
1
- {"version":3,"file":"parseXml.d.ts","sourceRoot":"","sources":["../../src/parseXml/parseXml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA6B3C,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAC;gBACrB,MAAM,EAAE,MAAM,EAAE;CAM7B;AAm6BD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAiCrD"}
1
+ {"version":3,"file":"parseXml.d.ts","sourceRoot":"","sources":["../../src/parseXml/parseXml.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,OAAO,EAgBb,MAAM,aAAa,CAAC;AAYrB,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAC;gBACrB,MAAM,EAAE,MAAM,EAAE;CAM7B;AAm6BD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAiCrD"}
@@ -1,5 +1,5 @@
1
1
  import { XMLParser } from "fast-xml-parser";
2
- import { inputTextNodeSchema, inputUlNodeSchema, inputOlNodeSchema, inputImageNodeSchema, inputTableNodeSchema, inputShapeNodeSchema, inputChartNodeSchema, inputTimelineNodeSchema, inputMatrixNodeSchema, inputTreeNodeSchema, inputFlowNodeSchema, inputProcessArrowNodeSchema, inputPyramidNodeSchema, inputLineNodeSchema, inputIconNodeSchema, } from "./inputSchema.js";
2
+ import { textNodeSchema, ulNodeSchema, olNodeSchema, imageNodeSchema, tableNodeSchema, shapeNodeSchema, chartNodeSchema, timelineNodeSchema, matrixNodeSchema, treeNodeSchema, flowNodeSchema, processArrowNodeSchema, pyramidNodeSchema, lineNodeSchema, iconNodeSchema, } from "../types.js";
3
3
  import { NODE_COERCION_MAP, CHILD_ELEMENT_COERCION_MAP, coerceWithRule, coerceFallback, getObjectShapeFromRule, isBooleanObjectUnionRule, } from "./coercionRules.js";
4
4
  // ===== ParseXmlError =====
5
5
  export class ParseXmlError extends Error {
@@ -85,21 +85,21 @@ function getKnownChildAttributes(tagName) {
85
85
  }
86
86
  // ===== Leaf node Zod validation schemas =====
87
87
  const leafNodeValidationSchemas = {
88
- text: inputTextNodeSchema,
89
- image: inputImageNodeSchema,
90
- table: inputTableNodeSchema,
91
- shape: inputShapeNodeSchema,
92
- chart: inputChartNodeSchema,
93
- timeline: inputTimelineNodeSchema,
94
- matrix: inputMatrixNodeSchema,
95
- tree: inputTreeNodeSchema,
96
- flow: inputFlowNodeSchema,
97
- processArrow: inputProcessArrowNodeSchema,
98
- pyramid: inputPyramidNodeSchema,
99
- line: inputLineNodeSchema,
100
- ul: inputUlNodeSchema,
101
- ol: inputOlNodeSchema,
102
- icon: inputIconNodeSchema,
88
+ text: textNodeSchema,
89
+ image: imageNodeSchema,
90
+ table: tableNodeSchema,
91
+ shape: shapeNodeSchema,
92
+ chart: chartNodeSchema,
93
+ timeline: timelineNodeSchema,
94
+ matrix: matrixNodeSchema,
95
+ tree: treeNodeSchema,
96
+ flow: flowNodeSchema,
97
+ processArrow: processArrowNodeSchema,
98
+ pyramid: pyramidNodeSchema,
99
+ line: lineNodeSchema,
100
+ ul: ulNodeSchema,
101
+ ol: olNodeSchema,
102
+ icon: iconNodeSchema,
103
103
  };
104
104
  function formatZodIssue(issue, tagName) {
105
105
  const path = issue.path;
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/icon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,eAAO,MAAM,WAAW,EAAE,cAwDzB,CAAC"}
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/icon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,eAAO,MAAM,WAAW,EAAE,cAqEzB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { rasterizeIcon } from "../../icons/index.js";
2
- import { omitYogaNode } from "../../toPositioned/toPositioned.js";
3
2
  import { renderIconNode } from "../../renderPptx/nodes/icon.js";
3
+ import { getContentArea } from "../../renderPptx/utils/contentArea.js";
4
4
  export const iconNodeDef = {
5
5
  type: "icon",
6
6
  category: "leaf",
@@ -14,11 +14,19 @@ export const iconNodeDef = {
14
14
  toPositioned(pom, absoluteX, absoluteY, layout, ctx) {
15
15
  const n = pom;
16
16
  const iconSize = n.size ?? 24;
17
- const rasterSize = Math.max(Math.ceil(n.variant ? iconSize : layout.width), Math.ceil(n.variant ? iconSize : layout.height), iconSize);
17
+ // padding を考慮したコンテンツ領域で bg/icon の座標を計算
18
+ const content = getContentArea({
19
+ x: absoluteX,
20
+ y: absoluteY,
21
+ w: layout.width,
22
+ h: layout.height,
23
+ padding: n.padding,
24
+ });
25
+ // 実描画サイズに合わせてラスタライズ(不要に大きい PNG を防ぐ)
26
+ const rasterSize = Math.max(Math.ceil(n.variant ? iconSize : Math.min(content.w, content.h)), iconSize);
18
27
  const iconImageData = rasterizeIcon(n.name, rasterSize, n.color ?? "#000000", ctx.iconRasterCache);
19
- // variant 指定時はアイコンを中央に配置
20
28
  const positioned = {
21
- ...omitYogaNode(n),
29
+ ...n,
22
30
  x: absoluteX,
23
31
  y: absoluteY,
24
32
  w: layout.width,
@@ -27,21 +35,25 @@ export const iconNodeDef = {
27
35
  };
28
36
  if (n.variant) {
29
37
  const totalSize = Math.ceil(iconSize * 1.75);
30
- // 背景図形は totalSize の正方形として、layout 領域の中央に配置
31
- const bgOffsetX = (layout.width - totalSize) / 2;
32
- const bgOffsetY = (layout.height - totalSize) / 2;
33
- positioned.bgX = absoluteX + bgOffsetX;
34
- positioned.bgY = absoluteY + bgOffsetY;
38
+ // 背景図形は totalSize の正方形として、コンテンツ領域の中央に配置
39
+ positioned.bgX = content.x + (content.w - totalSize) / 2;
40
+ positioned.bgY = content.y + (content.h - totalSize) / 2;
35
41
  positioned.bgW = totalSize;
36
42
  positioned.bgH = totalSize;
37
- // アイコンは背景図形の中央に配置
38
- const iconOffsetX = (layout.width - iconSize) / 2;
39
- const iconOffsetY = (layout.height - iconSize) / 2;
40
- positioned.iconX = absoluteX + iconOffsetX;
41
- positioned.iconY = absoluteY + iconOffsetY;
43
+ // アイコンはコンテンツ領域の中央に配置
44
+ positioned.iconX = content.x + (content.w - iconSize) / 2;
45
+ positioned.iconY = content.y + (content.h - iconSize) / 2;
42
46
  positioned.iconW = iconSize;
43
47
  positioned.iconH = iconSize;
44
48
  }
49
+ else {
50
+ // variant なしの場合もアスペクト比を維持し、コンテンツ領域の中央に配置
51
+ const iconSide = Math.min(content.w, content.h);
52
+ positioned.iconX = content.x + (content.w - iconSide) / 2;
53
+ positioned.iconY = content.y + (content.h - iconSide) / 2;
54
+ positioned.iconW = iconSide;
55
+ positioned.iconH = iconSide;
56
+ }
45
57
  return positioned;
46
58
  },
47
59
  render(node, ctx) {
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/image.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAQ,MAAM,aAAa,CAAC;AAOxD,eAAO,MAAM,YAAY,EAAE,cA+B1B,CAAC"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/image.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAQ,MAAM,aAAa,CAAC;AAMxD,eAAO,MAAM,YAAY,EAAE,cAmC1B,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { measureImage, getImageData } from "../../shared/measureImage.js";
2
2
  import { renderImageNode } from "../../renderPptx/nodes/image.js";
3
- import { omitYogaNode } from "../../toPositioned/toPositioned.js";
4
3
  export const imageNodeDef = {
5
4
  type: "image",
6
5
  category: "leaf",
@@ -8,7 +7,7 @@ export const imageNodeDef = {
8
7
  const n = node;
9
8
  const src = n.src;
10
9
  yn.setMeasureFunc(() => {
11
- const { widthPx, heightPx } = measureImage(src, ctx.imageSizeCache);
10
+ const { widthPx, heightPx } = measureImage(src, ctx.imageSizeCache, ctx.diagnostics);
12
11
  return { width: widthPx, height: heightPx };
13
12
  });
14
13
  },
@@ -16,7 +15,7 @@ export const imageNodeDef = {
16
15
  const n = pom;
17
16
  const imageData = getImageData(n.src, ctx.imageDataCache);
18
17
  return {
19
- ...omitYogaNode(n),
18
+ ...n,
20
19
  x: absoluteX,
21
20
  y: absoluteY,
22
21
  w: layout.width,
@@ -1 +1 @@
1
- {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/layer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,YAAY,EAAE,cAwD1B,CAAC"}
1
+ {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/layer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,YAAY,EAAE,cA4D1B,CAAC"}
@@ -1,14 +1,14 @@
1
- import { toPositioned, omitYogaNode } from "../../toPositioned/toPositioned.js";
1
+ import { toPositioned } from "../../toPositioned/toPositioned.js";
2
2
  export const layerNodeDef = {
3
3
  type: "layer",
4
4
  category: "absolute-child",
5
5
  // applyYogaStyle: layer は子を絶対配置するコンテナ。サイズは明示的に指定されることを期待
6
- toPositioned(pom, absoluteX, absoluteY, layout, ctx) {
6
+ toPositioned(pom, absoluteX, absoluteY, layout, ctx, map) {
7
7
  const n = pom;
8
8
  // layer の子要素は layer 内の相対座標(child.x, child.y)を持つ
9
9
  // layer の絶対座標に加算してスライド上の絶対座標に変換
10
10
  return {
11
- ...omitYogaNode(n),
11
+ ...n,
12
12
  x: absoluteX,
13
13
  y: absoluteY,
14
14
  w: layout.width,
@@ -26,7 +26,7 @@ export const layerNodeDef = {
26
26
  const adjustedX2 = child.x2 + lineAbsoluteX;
27
27
  const adjustedY2 = child.y2 + lineAbsoluteY;
28
28
  return {
29
- ...omitYogaNode(child),
29
+ ...child,
30
30
  x1: adjustedX1,
31
31
  y1: adjustedY1,
32
32
  x2: adjustedX2,
@@ -38,10 +38,13 @@ export const layerNodeDef = {
38
38
  };
39
39
  }
40
40
  // その他のノードは通常の処理
41
- const childLayout = child.yogaNode.getComputedLayout();
41
+ const childLayout = map.get(child);
42
+ if (!childLayout) {
43
+ throw new Error("Layout result not found in map for layer child");
44
+ }
42
45
  const adjustedParentX = absoluteX + childX - childLayout.left;
43
46
  const adjustedParentY = absoluteY + childY - childLayout.top;
44
- return toPositioned(child, ctx, adjustedParentX, adjustedParentY);
47
+ return toPositioned(child, ctx, map, adjustedParentX, adjustedParentY);
45
48
  }),
46
49
  };
47
50
  },
@@ -1 +1 @@
1
- {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/line.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,eAAO,MAAM,WAAW,EAAE,cAuBzB,CAAC"}
1
+ {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/line.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,WAAW,EAAE,cAuBzB,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { renderLineNode } from "../../renderPptx/nodes/line.js";
2
- import { omitYogaNode } from "../../toPositioned/toPositioned.js";
3
2
  export const lineNodeDef = {
4
3
  type: "line",
5
4
  category: "leaf",
@@ -13,7 +12,7 @@ export const lineNodeDef = {
13
12
  // line ノードは絶対座標(x1, y1, x2, y2)を持つため、
14
13
  // yogaNode の座標ではなく自身の座標からバウンディングボックスを計算
15
14
  return {
16
- ...omitYogaNode(n),
15
+ ...n,
17
16
  x: Math.min(n.x1, n.x2),
18
17
  y: Math.min(n.y1, n.y2),
19
18
  w: Math.abs(n.x2 - n.x1),
@@ -3,6 +3,7 @@ import type { Node as YogaNode } from "yoga-layout";
3
3
  import type { RenderContext } from "../renderPptx/types.ts";
4
4
  import type { loadYoga } from "yoga-layout/load";
5
5
  import type { BuildContext } from "../buildContext.ts";
6
+ import type { LayoutResultMap } from "../calcYogaLayout/types.ts";
6
7
  export type Yoga = Awaited<ReturnType<typeof loadYoga>>;
7
8
  /** ノードのカテゴリ。子要素の扱い方を決定する */
8
9
  export type NodeCategory = "leaf" | "single-child" | "multi-child" | "absolute-child";
@@ -17,7 +18,7 @@ export interface NodeDefinition {
17
18
  toPositioned?: (pom: POMNode, absoluteX: number, absoluteY: number, layout: {
18
19
  width: number;
19
20
  height: number;
20
- }, ctx: BuildContext) => PositionedNode;
21
+ }, ctx: BuildContext, map: LayoutResultMap) => PositionedNode;
21
22
  /** PositionedNode をスライドにレンダリングする(リーフノード用) */
22
23
  render?: (node: PositionedNode, ctx: RenderContext) => void;
23
24
  /** 画像ソース収集(prefetch 用) */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC;AAExD,4BAA4B;AAC5B,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,cAAc,GACd,aAAa,GACb,gBAAgB,CAAC;AAErB,MAAM,WAAW,cAAc;IAC7B,cAAc;IACd,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtB,cAAc;IACd,QAAQ,EAAE,YAAY,CAAC;IAEvB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,CACf,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,YAAY,KACd,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B,kEAAkE;IAClE,YAAY,CAAC,EAAE,CACb,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EACzC,GAAG,EAAE,YAAY,KACd,cAAc,CAAC;IAEpB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;IAE5D,0BAA0B;IAC1B,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,EAAE,CAAC;CACnD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC;AAExD,4BAA4B;AAC5B,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,cAAc,GACd,aAAa,GACb,gBAAgB,CAAC;AAErB,MAAM,WAAW,cAAc;IAC7B,cAAc;IACd,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtB,cAAc;IACd,QAAQ,EAAE,YAAY,CAAC;IAEvB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,CACf,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,YAAY,KACd,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B,kEAAkE;IAClE,YAAY,CAAC,EAAE,CACb,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EACzC,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,eAAe,KACjB,cAAc,CAAC;IAEpB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;IAE5D,0BAA0B;IAC1B,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,EAAE,CAAC;CACnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAwBN"}
1
+ {"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAyBN"}
@@ -1,15 +1,17 @@
1
1
  import { pxToIn } from "../units.js";
2
+ import { getContentArea } from "../utils/contentArea.js";
2
3
  export function renderChartNode(node, ctx) {
3
4
  const chartData = node.data.map((d) => ({
4
5
  name: d.name,
5
6
  labels: d.labels,
6
7
  values: d.values,
7
8
  }));
9
+ const content = getContentArea(node);
8
10
  const chartOptions = {
9
- x: pxToIn(node.x),
10
- y: pxToIn(node.y),
11
- w: pxToIn(node.w),
12
- h: pxToIn(node.h),
11
+ x: pxToIn(content.x),
12
+ y: pxToIn(content.y),
13
+ w: pxToIn(content.w),
14
+ h: pxToIn(content.h),
13
15
  showLegend: node.showLegend ?? false,
14
16
  showTitle: node.showTitle ?? false,
15
17
  title: node.title,
@@ -1 +1 @@
1
- {"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,KAAK,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAWpE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,aAAa,GACjB,IAAI,CA6HN"}
1
+ {"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,KAAK,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAWpE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,aAAa,GACjB,IAAI,CAwIN"}
@@ -1,6 +1,7 @@
1
1
  import { pxToIn, pxToPt } from "../units.js";
2
2
  import { measureFlow } from "../../calcYogaLayout/measureCompositeNodes.js";
3
3
  import { calcScaleFactor } from "../utils/scaleToFit.js";
4
+ import { getContentArea } from "../utils/contentArea.js";
4
5
  export function renderFlowNode(node, ctx) {
5
6
  const direction = node.direction ?? "horizontal";
6
7
  const nodeWidth = node.nodeWidth ?? 120;
@@ -8,20 +9,29 @@ export function renderFlowNode(node, ctx) {
8
9
  const nodeGap = node.nodeGap ?? 80;
9
10
  const connectorStyle = node.connectorStyle ?? {};
10
11
  const defaultColor = "1D4ED8";
11
- // スケール係数を計算
12
+ // スケール係数を計算(コンテンツ領域基準)
13
+ const content = getContentArea(node);
12
14
  const intrinsic = measureFlow(node);
13
- const scaleFactor = calcScaleFactor(node.w, node.h, intrinsic.width, intrinsic.height, "flow");
15
+ const scaleFactor = calcScaleFactor(content.w, content.h, intrinsic.width, intrinsic.height, "flow", ctx.buildContext.diagnostics);
14
16
  const scaledNodeWidth = nodeWidth * scaleFactor;
15
17
  const scaledNodeHeight = nodeHeight * scaleFactor;
16
18
  const scaledNodeGap = nodeGap * scaleFactor;
17
19
  const layouts = new Map();
18
20
  const nodeCount = node.nodes.length;
21
+ // コンテンツ領域を使用するための仮想ノードを作成
22
+ const contentNode = {
23
+ ...node,
24
+ x: content.x,
25
+ y: content.y,
26
+ w: content.w,
27
+ h: content.h,
28
+ };
19
29
  // ノードのレイアウトを計算
20
30
  if (direction === "horizontal") {
21
- calculateHorizontalLayout(node, layouts, nodeCount, scaledNodeWidth, scaledNodeHeight, scaledNodeGap, scaleFactor);
31
+ calculateHorizontalLayout(contentNode, layouts, nodeCount, scaledNodeWidth, scaledNodeHeight, scaledNodeGap, scaleFactor);
22
32
  }
23
33
  else {
24
- calculateVerticalLayout(node, layouts, nodeCount, scaledNodeWidth, scaledNodeHeight, scaledNodeGap, scaleFactor);
34
+ calculateVerticalLayout(contentNode, layouts, nodeCount, scaledNodeWidth, scaledNodeHeight, scaledNodeGap, scaleFactor);
25
35
  }
26
36
  // 接続線を描画(ノードより先に描画して背面に配置)
27
37
  for (const conn of node.connections) {
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAmCN"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAoCN"}
@@ -1,10 +1,12 @@
1
1
  import { pxToIn } from "../units.js";
2
+ import { getContentArea } from "../utils/contentArea.js";
2
3
  export function renderImageNode(node, ctx) {
4
+ const content = getContentArea(node);
3
5
  const imageOptions = {
4
- x: pxToIn(node.x),
5
- y: pxToIn(node.y),
6
- w: pxToIn(node.w),
7
- h: pxToIn(node.h),
6
+ x: pxToIn(content.x),
7
+ y: pxToIn(content.y),
8
+ w: pxToIn(content.w),
9
+ h: pxToIn(content.h),
8
10
  shadow: node.shadow
9
11
  ? {
10
12
  type: node.shadow.type,
@@ -19,8 +21,8 @@ export function renderImageNode(node, ctx) {
19
21
  if (node.sizing) {
20
22
  imageOptions.sizing = {
21
23
  type: node.sizing.type,
22
- w: pxToIn(node.sizing.w ?? node.w),
23
- h: pxToIn(node.sizing.h ?? node.h),
24
+ w: pxToIn(node.sizing.w ?? content.w),
25
+ h: pxToIn(node.sizing.h ?? content.h),
24
26
  ...(node.sizing.x !== undefined && { x: pxToIn(node.sizing.x) }),
25
27
  ...(node.sizing.y !== undefined && { y: pxToIn(node.sizing.y) }),
26
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,KAAK,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAChE,KAAK,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AA6BhE,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA2D7E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAiE7E"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,KAAK,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAChE,KAAK,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AA6BhE,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA4D7E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAkE7E"}
@@ -1,5 +1,6 @@
1
1
  import { pxToIn, pxToPt } from "../units.js";
2
2
  import { convertUnderline, convertStrike } from "../textOptions.js";
3
+ import { getContentArea } from "../utils/contentArea.js";
3
4
  function resolveStyle(li, parent) {
4
5
  return {
5
6
  fontSize: li.fontSize ?? parent.fontSize ?? 24,
@@ -26,6 +27,7 @@ export function renderUlNode(node, ctx) {
26
27
  const fontSizePx = node.fontSize ?? 24;
27
28
  const fontFamily = node.fontFamily ?? "Noto Sans JP";
28
29
  const lineHeight = node.lineHeight ?? 1.3;
30
+ const content = getContentArea(node);
29
31
  if (hasItemStyleOverride(node.items)) {
30
32
  // Li に個別スタイルがある場合は配列形式を使用
31
33
  const textItems = node.items.map((li, i) => {
@@ -46,10 +48,10 @@ export function renderUlNode(node, ctx) {
46
48
  };
47
49
  });
48
50
  ctx.slide.addText(textItems, {
49
- x: pxToIn(node.x),
50
- y: pxToIn(node.y),
51
- w: pxToIn(node.w),
52
- h: pxToIn(node.h),
51
+ x: pxToIn(content.x),
52
+ y: pxToIn(content.y),
53
+ w: pxToIn(content.w),
54
+ h: pxToIn(content.h),
53
55
  align: node.textAlign ?? "left",
54
56
  valign: "top",
55
57
  margin: 0,
@@ -60,10 +62,10 @@ export function renderUlNode(node, ctx) {
60
62
  // Li にスタイルオーバーライドがない場合は単一文字列形式を使用
61
63
  const text = node.items.map((li) => li.text).join("\n");
62
64
  ctx.slide.addText(text, {
63
- x: pxToIn(node.x),
64
- y: pxToIn(node.y),
65
- w: pxToIn(node.w),
66
- h: pxToIn(node.h),
65
+ x: pxToIn(content.x),
66
+ y: pxToIn(content.y),
67
+ w: pxToIn(content.w),
68
+ h: pxToIn(content.h),
67
69
  fontSize: pxToPt(fontSizePx),
68
70
  fontFace: fontFamily,
69
71
  align: node.textAlign ?? "left",
@@ -84,6 +86,7 @@ export function renderOlNode(node, ctx) {
84
86
  const fontSizePx = node.fontSize ?? 24;
85
87
  const fontFamily = node.fontFamily ?? "Noto Sans JP";
86
88
  const lineHeight = node.lineHeight ?? 1.3;
89
+ const content = getContentArea(node);
87
90
  const bulletOptions = { type: "number" };
88
91
  if (node.numberType !== undefined) {
89
92
  bulletOptions.numberType = node.numberType;
@@ -110,10 +113,10 @@ export function renderOlNode(node, ctx) {
110
113
  };
111
114
  });
112
115
  ctx.slide.addText(textItems, {
113
- x: pxToIn(node.x),
114
- y: pxToIn(node.y),
115
- w: pxToIn(node.w),
116
- h: pxToIn(node.h),
116
+ x: pxToIn(content.x),
117
+ y: pxToIn(content.y),
118
+ w: pxToIn(content.w),
119
+ h: pxToIn(content.h),
117
120
  align: node.textAlign ?? "left",
118
121
  valign: "top",
119
122
  margin: 0,
@@ -123,10 +126,10 @@ export function renderOlNode(node, ctx) {
123
126
  else {
124
127
  const text = node.items.map((li) => li.text).join("\n");
125
128
  ctx.slide.addText(text, {
126
- x: pxToIn(node.x),
127
- y: pxToIn(node.y),
128
- w: pxToIn(node.w),
129
- h: pxToIn(node.h),
129
+ x: pxToIn(content.x),
130
+ y: pxToIn(content.y),
131
+ w: pxToIn(content.w),
132
+ h: pxToIn(content.h),
130
133
  fontSize: pxToPt(fontSizePx),
131
134
  fontFace: fontFamily,
132
135
  align: node.textAlign ?? "left",
@@ -1 +1 @@
1
- {"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,KAAK,oBAAoB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAExE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,oBAAoB,EAC1B,GAAG,EAAE,aAAa,GACjB,IAAI,CAsIN"}
1
+ {"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,KAAK,oBAAoB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAExE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,oBAAoB,EAC1B,GAAG,EAAE,aAAa,GACjB,IAAI,CAwIN"}
@@ -1,6 +1,7 @@
1
1
  import { pxToIn, pxToPt } from "../units.js";
2
2
  import { measureMatrix } from "../../calcYogaLayout/measureCompositeNodes.js";
3
3
  import { calcScaleFactor } from "../utils/scaleToFit.js";
4
+ import { getContentArea } from "../utils/contentArea.js";
4
5
  export function renderMatrixNode(node, ctx) {
5
6
  const items = node.items;
6
7
  const axes = node.axes;
@@ -9,17 +10,18 @@ export function renderMatrixNode(node, ctx) {
9
10
  const baseItemSize = 24; // px
10
11
  const baseLineWidth = 2; // px
11
12
  const axisColor = "E2E8F0";
12
- // スケール係数を計算
13
+ // スケール係数を計算(コンテンツ領域基準)
14
+ const content = getContentArea(node);
13
15
  const intrinsic = measureMatrix(node);
14
- const scaleFactor = calcScaleFactor(node.w, node.h, intrinsic.width, intrinsic.height, "matrix");
16
+ const scaleFactor = calcScaleFactor(content.w, content.h, intrinsic.width, intrinsic.height, "matrix", ctx.buildContext.diagnostics);
15
17
  const itemSize = baseItemSize * scaleFactor;
16
18
  const lineWidth = baseLineWidth * scaleFactor;
17
- // マトリクスの描画領域(パディングを考慮)
18
- const padding = 60 * scaleFactor; // 軸ラベル用の余白
19
- const areaX = node.x + padding;
20
- const areaY = node.y + padding;
21
- const areaW = node.w - padding * 2;
22
- const areaH = node.h - padding * 2;
19
+ // マトリクスの描画領域(軸ラベル用の余白を考慮)
20
+ const axisMargin = 60 * scaleFactor; // 軸ラベル用の余白
21
+ const areaX = content.x + axisMargin;
22
+ const areaY = content.y + axisMargin;
23
+ const areaW = content.w - axisMargin * 2;
24
+ const areaH = content.h - axisMargin * 2;
23
25
  // 中心座標
24
26
  const centerX = areaX + areaW / 2;
25
27
  const centerY = areaY + areaH / 2;
@@ -57,7 +59,7 @@ export function renderMatrixNode(node, ctx) {
57
59
  });
58
60
  // Y軸ラベル(左部中央)
59
61
  ctx.slide.addText(axes.y, {
60
- x: pxToIn(node.x + 4 * scaleFactor),
62
+ x: pxToIn(content.x + 4 * scaleFactor),
61
63
  y: pxToIn(centerY - 12 * scaleFactor),
62
64
  w: pxToIn(48 * scaleFactor),
63
65
  h: pxToIn(axisLabelH),
@@ -1 +1 @@
1
- {"version":3,"file":"processArrow.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/processArrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAWjD,KAAK,0BAA0B,GAAG,OAAO,CACvC,cAAc,EACd;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CACzB,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,0BAA0B,EAChC,GAAG,EAAE,aAAa,GACjB,IAAI,CA0DN"}
1
+ {"version":3,"file":"processArrow.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/processArrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAYjD,KAAK,0BAA0B,GAAG,OAAO,CACvC,cAAc,EACd;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CACzB,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,0BAA0B,EAChC,GAAG,EAAE,aAAa,GACjB,IAAI,CAqEN"}
@@ -3,6 +3,7 @@ import { convertUnderline, convertStrike } from "../textOptions.js";
3
3
  import { measureProcessArrow } from "../../calcYogaLayout/measureCompositeNodes.js";
4
4
  import { calcScaleFactor } from "../utils/scaleToFit.js";
5
5
  import { ARROW_DEPTH_RATIO, DEFAULT_PROCESS_ARROW_ITEM_WIDTH, DEFAULT_PROCESS_ARROW_ITEM_HEIGHT, } from "../../shared/processArrowConstants.js";
6
+ import { getContentArea } from "../utils/contentArea.js";
6
7
  export function renderProcessArrowNode(node, ctx) {
7
8
  const direction = node.direction ?? "horizontal";
8
9
  const steps = node.steps;
@@ -15,18 +16,27 @@ export function renderProcessArrowNode(node, ctx) {
15
16
  const itemHeight = node.itemHeight ?? DEFAULT_PROCESS_ARROW_ITEM_HEIGHT;
16
17
  const arrowDepth = itemHeight * ARROW_DEPTH_RATIO;
17
18
  const gap = node.gap ?? -arrowDepth;
18
- // スケール係数を計算
19
+ // スケール係数を計算(コンテンツ領域基準)
20
+ const content = getContentArea(node);
19
21
  const intrinsic = measureProcessArrow(node);
20
- const scaleFactor = calcScaleFactor(node.w, node.h, intrinsic.width, intrinsic.height, "processArrow");
22
+ const scaleFactor = calcScaleFactor(content.w, content.h, intrinsic.width, intrinsic.height, "processArrow", ctx.buildContext.diagnostics);
21
23
  const scaledItemWidth = itemWidth * scaleFactor;
22
24
  const scaledItemHeight = itemHeight * scaleFactor;
23
25
  const scaledGap = gap * scaleFactor;
24
26
  const scaledArrowDepth = arrowDepth * scaleFactor;
27
+ // コンテンツ領域を使用するための仮想ノードを作成
28
+ const contentNode = {
29
+ ...node,
30
+ x: content.x,
31
+ y: content.y,
32
+ w: content.w,
33
+ h: content.h,
34
+ };
25
35
  if (direction === "horizontal") {
26
- renderHorizontalProcessArrow(node, ctx, steps, stepCount, scaledItemWidth, scaledItemHeight, scaledGap, scaledArrowDepth, defaultColor, defaultTextColor, scaleFactor);
36
+ renderHorizontalProcessArrow(contentNode, ctx, steps, stepCount, scaledItemWidth, scaledItemHeight, scaledGap, scaledArrowDepth, defaultColor, defaultTextColor, scaleFactor);
27
37
  }
28
38
  else {
29
- renderVerticalProcessArrow(node, ctx, steps, stepCount, scaledItemWidth, scaledItemHeight, scaledGap, scaledArrowDepth, defaultColor, defaultTextColor, scaleFactor);
39
+ renderVerticalProcessArrow(contentNode, ctx, steps, stepCount, scaledItemWidth, scaledItemHeight, scaledGap, scaledArrowDepth, defaultColor, defaultTextColor, scaleFactor);
30
40
  }
31
41
  }
32
42
  function renderHorizontalProcessArrow(node, ctx, steps, stepCount, itemWidth, itemHeight, gap, arrowDepth, defaultColor, defaultTextColor, scaleFactor) {
@@ -1 +1 @@
1
- {"version":3,"file":"pyramid.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/pyramid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,KAAK,qBAAqB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAE1E,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,qBAAqB,EAC3B,GAAG,EAAE,aAAa,GACjB,IAAI,CAgGN"}
1
+ {"version":3,"file":"pyramid.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/pyramid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD,KAAK,qBAAqB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAE1E,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,qBAAqB,EAC3B,GAAG,EAAE,aAAa,GACjB,IAAI,CAkGN"}
@@ -1,6 +1,7 @@
1
1
  import { pxToIn, pxToPt } from "../units.js";
2
2
  import { measurePyramid } from "../../calcYogaLayout/measureCompositeNodes.js";
3
3
  import { calcScaleFactor } from "../utils/scaleToFit.js";
4
+ import { getContentArea } from "../utils/contentArea.js";
4
5
  export function renderPyramidNode(node, ctx) {
5
6
  const direction = node.direction ?? "up";
6
7
  const levels = node.levels;
@@ -9,15 +10,16 @@ export function renderPyramidNode(node, ctx) {
9
10
  return;
10
11
  const defaultColor = "4472C4";
11
12
  const defaultTextColor = "FFFFFF";
12
- // スケール係数を計算
13
+ // スケール係数を計算(コンテンツ領域基準)
14
+ const content = getContentArea(node);
13
15
  const intrinsic = measurePyramid(node);
14
- const scaleFactor = calcScaleFactor(node.w, node.h, intrinsic.width, intrinsic.height, "pyramid");
16
+ const scaleFactor = calcScaleFactor(content.w, content.h, intrinsic.width, intrinsic.height, "pyramid", ctx.buildContext.diagnostics);
15
17
  const baseWidth = 400 * scaleFactor;
16
18
  const layerHeight = 50 * scaleFactor;
17
19
  const gap = 2 * scaleFactor;
18
20
  const totalHeight = levelCount * layerHeight + (levelCount - 1) * gap;
19
- const startX = node.x + (node.w - baseWidth) / 2;
20
- const startY = node.y + (node.h - totalHeight) / 2;
21
+ const startX = content.x + (content.w - baseWidth) / 2;
22
+ const startY = content.y + (content.h - totalHeight) / 2;
21
23
  for (let i = 0; i < levelCount; i++) {
22
24
  const level = levels[i];
23
25
  const fillColor = level.color?.replace("#", "") ?? defaultColor;
@@ -1 +1 @@
1
- {"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/shape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAqDN"}
1
+ {"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/shape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAsDN"}