@hirokisakabe/pom 8.2.1 → 8.3.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 +24 -24
- package/dist/autoFit/autoFit.js.map +1 -1
- package/dist/buildContext.js +3 -1
- package/dist/buildContext.js.map +1 -1
- package/dist/buildPptx.d.ts.map +1 -1
- package/dist/buildPptx.js +4 -0
- package/dist/buildPptx.js.map +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.js +2 -1
- package/dist/calcYogaLayout/calcYogaLayout.js.map +1 -1
- package/dist/calcYogaLayout/fontLoader.js.map +1 -1
- package/dist/calcYogaLayout/measureText.d.ts.map +1 -1
- package/dist/calcYogaLayout/measureText.js +9 -2
- package/dist/calcYogaLayout/measureText.js.map +1 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/icons/renderIcon.js.map +1 -1
- package/dist/parseMasterPptx.js.map +1 -1
- package/dist/parseXml/coercionRules.js +6 -2
- package/dist/parseXml/coercionRules.js.map +1 -1
- package/dist/parseXml/parseXml.d.ts.map +1 -1
- package/dist/parseXml/parseXml.js +11 -8
- package/dist/parseXml/parseXml.js.map +1 -1
- package/dist/parseXml/serializeXml.d.ts.map +1 -1
- package/dist/parseXml/serializeXml.js +1 -0
- package/dist/parseXml/serializeXml.js.map +1 -1
- package/dist/registry/definitions/list.js.map +1 -1
- package/dist/registry/definitions/shape.js.map +1 -1
- package/dist/registry/definitions/text.js +3 -1
- package/dist/registry/definitions/text.js.map +1 -1
- package/dist/renderPptx/gradientFills.js +139 -0
- package/dist/renderPptx/gradientFills.js.map +1 -0
- package/dist/renderPptx/nodes/icon.js.map +1 -1
- package/dist/renderPptx/nodes/list.js.map +1 -1
- package/dist/renderPptx/nodes/table.js.map +1 -1
- package/dist/renderPptx/nodes/text.js +18 -14
- package/dist/renderPptx/nodes/text.js.map +1 -1
- package/dist/renderPptx/nodes/tree.js.map +1 -1
- package/dist/renderPptx/renderPptx.js +6 -2
- package/dist/renderPptx/renderPptx.js.map +1 -1
- package/dist/renderPptx/textOptions.js +2 -1
- package/dist/renderPptx/textOptions.js.map +1 -1
- package/dist/renderPptx/utils/backgroundBorder.js +6 -4
- package/dist/renderPptx/utils/backgroundBorder.js.map +1 -1
- package/dist/shared/gradient.js +103 -0
- package/dist/shared/gradient.js.map +1 -0
- package/dist/shared/measureImage.js.map +1 -1
- package/dist/shared/tableUtils.js.map +1 -1
- package/dist/types.d.ts +41 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -2
- package/dist/types.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backgroundBorder.js","names":[],"sources":["../../../src/renderPptx/utils/backgroundBorder.ts"],"sourcesContent":["import type { PositionedNode, ShadowStyle } from \"../../types.ts\";\nimport { getImageData } from \"../../shared/measureImage.ts\";\nimport type { RenderContext } from \"../types.ts\";\nimport { pxToIn, pxToPt } from \"../units.ts\";\n\nfunction convertShadow(shadow: ShadowStyle) {\n return {\n type: shadow.type ?? (\"outer\" as const),\n opacity: shadow.opacity,\n blur: shadow.blur,\n angle: shadow.angle,\n offset: shadow.offset,\n color: shadow.color,\n };\n}\n\n/**\n * ノードの背景色・背景画像・ボーダー・影を描画する\n * 全ノードタイプで最初に呼び出される共通処理\n *\n * 描画順序: 背景色 → 背景画像 → ボーダー\n */\nexport function renderBackgroundAndBorder(\n node: PositionedNode,\n ctx: RenderContext,\n): void {\n const {
|
|
1
|
+
{"version":3,"file":"backgroundBorder.js","names":[],"sources":["../../../src/renderPptx/utils/backgroundBorder.ts"],"sourcesContent":["import type { PositionedNode, ShadowStyle } from \"../../types.ts\";\nimport { getImageData } from \"../../shared/measureImage.ts\";\nimport { registerBackgroundGradient } from \"../gradientFills.ts\";\nimport type { RenderContext } from \"../types.ts\";\nimport { pxToIn, pxToPt } from \"../units.ts\";\n\nfunction convertShadow(shadow: ShadowStyle) {\n return {\n type: shadow.type ?? (\"outer\" as const),\n opacity: shadow.opacity,\n blur: shadow.blur,\n angle: shadow.angle,\n offset: shadow.offset,\n color: shadow.color,\n };\n}\n\n/**\n * ノードの背景色・背景画像・ボーダー・影を描画する\n * 全ノードタイプで最初に呼び出される共通処理\n *\n * 描画順序: 背景色 → 背景画像 → ボーダー\n */\nexport function renderBackgroundAndBorder(\n node: PositionedNode,\n ctx: RenderContext,\n): void {\n const {\n backgroundColor,\n backgroundGradient,\n backgroundImage,\n border,\n borderRadius,\n shadow,\n } = node;\n\n // backgroundGradient はマーカー色の solidFill として描画し、\n // 出力時の後処理で gradFill に置換される (gradientFills.ts 参照)。\n // opacity はマーカー側ではなく gradFill のカラーストップの alpha で表現する\n const gradientMarker = backgroundGradient\n ? registerBackgroundGradient(\n backgroundGradient,\n node.opacity,\n ctx.buildContext.gradientFills,\n )\n : undefined;\n\n const hasBackground = Boolean(backgroundColor) || Boolean(gradientMarker);\n const hasBackgroundImage = Boolean(backgroundImage);\n const hasBorder = Boolean(\n border &&\n (border.color !== undefined ||\n border.width !== undefined ||\n border.dashType !== undefined),\n );\n const hasShadow = Boolean(shadow);\n\n if (!hasBackground && !hasBackgroundImage && !hasBorder && !hasShadow) {\n return;\n }\n\n // borderRadius がある場合は roundRect を使用し、rectRadius を計算\n const shapeType = borderRadius\n ? ctx.pptx.ShapeType.roundRect\n : ctx.pptx.ShapeType.rect;\n\n // px を 0-1 の正規化値に変換\n const rectRadius = borderRadius\n ? Math.min((borderRadius / Math.min(node.w, node.h)) * 2, 1)\n : undefined;\n\n // backgroundImage がない場合は従来通り1回の addShape で処理\n if (!hasBackgroundImage) {\n const fill = hasBackground\n ? gradientMarker\n ? { color: gradientMarker }\n : {\n color: backgroundColor,\n transparency:\n node.opacity !== undefined ? (1 - node.opacity) * 100 : undefined,\n }\n : { type: \"none\" as const };\n\n const line = hasBorder\n ? {\n color: border?.color ?? \"000000\",\n width: border?.width !== undefined ? pxToPt(border.width) : undefined,\n dashType: border?.dashType,\n }\n : { type: \"none\" as const };\n\n ctx.slide.addShape(shapeType, {\n x: pxToIn(node.x),\n y: pxToIn(node.y),\n w: pxToIn(node.w),\n h: pxToIn(node.h),\n fill,\n line,\n rectRadius,\n shadow: shadow ? convertShadow(shadow) : undefined,\n });\n return;\n }\n\n // backgroundImage がある場合は分割描画: 背景色 → 背景画像 → ボーダー\n\n // 1. 背景色\n if (hasBackground) {\n ctx.slide.addShape(shapeType, {\n x: pxToIn(node.x),\n y: pxToIn(node.y),\n w: pxToIn(node.w),\n h: pxToIn(node.h),\n fill: gradientMarker\n ? { color: gradientMarker }\n : {\n color: backgroundColor,\n transparency:\n node.opacity !== undefined ? (1 - node.opacity) * 100 : undefined,\n },\n line: { type: \"none\" as const },\n rectRadius,\n });\n }\n\n // 2. 背景画像\n if (backgroundImage) {\n const sizing = backgroundImage.sizing ?? \"cover\";\n const imageOptions: Record<string, unknown> = {\n x: pxToIn(node.x),\n y: pxToIn(node.y),\n w: pxToIn(node.w),\n h: pxToIn(node.h),\n sizing: {\n type: sizing,\n w: pxToIn(node.w),\n h: pxToIn(node.h),\n },\n };\n\n const cachedData = getImageData(\n backgroundImage.src,\n ctx.buildContext.imageDataCache,\n );\n if (cachedData) {\n ctx.slide.addImage({ ...imageOptions, data: cachedData });\n } else {\n ctx.slide.addImage({ ...imageOptions, path: backgroundImage.src });\n }\n }\n\n // 3. ボーダー\n if (hasBorder || hasShadow) {\n ctx.slide.addShape(shapeType, {\n x: pxToIn(node.x),\n y: pxToIn(node.y),\n w: pxToIn(node.w),\n h: pxToIn(node.h),\n fill: { type: \"none\" as const },\n line: hasBorder\n ? {\n color: border?.color ?? \"000000\",\n width:\n border?.width !== undefined ? pxToPt(border.width) : undefined,\n dashType: border?.dashType,\n }\n : { type: \"none\" as const },\n rectRadius,\n shadow: shadow ? convertShadow(shadow) : undefined,\n });\n }\n}\n"],"mappings":";;;;AAMA,SAAS,cAAc,QAAqB;CAC1C,OAAO;EACL,MAAM,OAAO,QAAS;EACtB,SAAS,OAAO;EAChB,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AgB;EAC5B;EACA,QAAQ,SAAS,cAAc,MAAM,IAAI,KAAA;CAC3C,CAAC;AAEL"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//#region src/shared/gradient.ts
|
|
2
|
+
/** `to <方向>` キーワード → CSS 角度 (deg)。コーナーは 45 度刻みの近似 */
|
|
3
|
+
const DIRECTION_KEYWORDS = {
|
|
4
|
+
"to top": 0,
|
|
5
|
+
"to right": 90,
|
|
6
|
+
"to bottom": 180,
|
|
7
|
+
"to left": 270,
|
|
8
|
+
"to top right": 45,
|
|
9
|
+
"to right top": 45,
|
|
10
|
+
"to bottom right": 135,
|
|
11
|
+
"to right bottom": 135,
|
|
12
|
+
"to bottom left": 225,
|
|
13
|
+
"to left bottom": 225,
|
|
14
|
+
"to top left": 315,
|
|
15
|
+
"to left top": 315
|
|
16
|
+
};
|
|
17
|
+
const COLOR_PATTERN = /^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/;
|
|
18
|
+
function normalizeColor(raw) {
|
|
19
|
+
const match = COLOR_PATTERN.exec(raw);
|
|
20
|
+
if (!match) return null;
|
|
21
|
+
const hex = match[1];
|
|
22
|
+
if (hex.length === 3) return hex.split("").map((c) => c + c).join("").toUpperCase();
|
|
23
|
+
return hex.toUpperCase();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 位置省略されたストップに CSS 互換のルールで位置を割り当てる。
|
|
27
|
+
* - 先頭が省略なら 0、末尾が省略なら 100
|
|
28
|
+
* - 中間の省略は前後の明示位置の間で均等配置
|
|
29
|
+
* - 位置が前のストップより小さい場合は前の値に切り上げ (非減少を保証)
|
|
30
|
+
*/
|
|
31
|
+
function resolveStopPositions(stops) {
|
|
32
|
+
const positions = stops.map((s) => s.position);
|
|
33
|
+
if (positions[0] === void 0) positions[0] = 0;
|
|
34
|
+
if (positions[positions.length - 1] === void 0) positions[positions.length - 1] = 100;
|
|
35
|
+
let prevIndex = 0;
|
|
36
|
+
for (let i = 1; i < positions.length; i++) {
|
|
37
|
+
if (positions[i] === void 0) continue;
|
|
38
|
+
const gap = i - prevIndex;
|
|
39
|
+
if (gap > 1) {
|
|
40
|
+
const start = positions[prevIndex];
|
|
41
|
+
const end = positions[i];
|
|
42
|
+
for (let j = 1; j < gap; j++) positions[prevIndex + j] = start + (end - start) * j / gap;
|
|
43
|
+
}
|
|
44
|
+
prevIndex = i;
|
|
45
|
+
}
|
|
46
|
+
let prev = 0;
|
|
47
|
+
return stops.map((stop, i) => {
|
|
48
|
+
const clamped = Math.min(Math.max(positions[i], 0), 100);
|
|
49
|
+
const position = Math.max(clamped, prev);
|
|
50
|
+
prev = position;
|
|
51
|
+
return {
|
|
52
|
+
color: stop.color,
|
|
53
|
+
position
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* linear-gradient() 構文をパースする。不正な構文の場合は null を返す。
|
|
59
|
+
*/
|
|
60
|
+
function parseLinearGradient(value) {
|
|
61
|
+
const match = /^\s*linear-gradient\s*\(\s*(.+?)\s*\)\s*$/.exec(value);
|
|
62
|
+
if (!match) return null;
|
|
63
|
+
const args = match[1].split(",").map((s) => s.trim());
|
|
64
|
+
if (args.length === 0) return null;
|
|
65
|
+
let angle = 180;
|
|
66
|
+
let stopArgs = args;
|
|
67
|
+
const first = args[0];
|
|
68
|
+
const angleMatch = /^(-?\d+(?:\.\d+)?)deg$/.exec(first);
|
|
69
|
+
const directionAngle = DIRECTION_KEYWORDS[first.toLowerCase().replace(/\s+/g, " ")];
|
|
70
|
+
if (angleMatch) {
|
|
71
|
+
angle = (Number(angleMatch[1]) % 360 + 360) % 360;
|
|
72
|
+
stopArgs = args.slice(1);
|
|
73
|
+
} else if (directionAngle !== void 0) {
|
|
74
|
+
angle = directionAngle;
|
|
75
|
+
stopArgs = args.slice(1);
|
|
76
|
+
}
|
|
77
|
+
if (stopArgs.length < 2) return null;
|
|
78
|
+
const stops = [];
|
|
79
|
+
for (const stopArg of stopArgs) {
|
|
80
|
+
const parts = stopArg.split(/\s+/);
|
|
81
|
+
if (parts.length === 0 || parts.length > 2) return null;
|
|
82
|
+
const color = normalizeColor(parts[0]);
|
|
83
|
+
if (color === null) return null;
|
|
84
|
+
let position;
|
|
85
|
+
if (parts.length === 2) {
|
|
86
|
+
const posMatch = /^(-?\d+(?:\.\d+)?)%$/.exec(parts[1]);
|
|
87
|
+
if (!posMatch) return null;
|
|
88
|
+
position = Number(posMatch[1]);
|
|
89
|
+
}
|
|
90
|
+
stops.push({
|
|
91
|
+
color,
|
|
92
|
+
position
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
angle,
|
|
97
|
+
stops: resolveStopPositions(stops)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { parseLinearGradient };
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=gradient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.js","names":[],"sources":["../../src/shared/gradient.ts"],"sourcesContent":["/**\n * リニアグラデーション文字列のパース\n *\n * CSS の linear-gradient() 風の構文を受け付ける:\n * linear-gradient(135deg, #FF0000 0%, #0000FF 100%)\n * linear-gradient(to right, #FF0000, #00FF00, #0000FF)\n * linear-gradient(#FF0000, #0000FF) ← 角度省略時は 180deg (上→下)\n *\n * - 角度: `<数値>deg` または `to <方向>` キーワード。省略時は 180deg。\n * - カラーストップ: 16進カラー (#RGB / #RRGGBB / RRGGBB) + 任意の位置 (%)。\n * 位置省略時は CSS と同様に補間する (先頭 0% / 末尾 100% / 中間は線形補間)。\n * - ストップは 2 つ以上必須。\n */\n\nexport interface GradientStop {\n /** 6桁大文字 HEX (# なし) */\n color: string;\n /** 0-100 (%) */\n position: number;\n}\n\nexport interface LinearGradient {\n /** CSS 基準の角度 (deg)。0 = 上向き、時計回り。0-360 に正規化済み */\n angle: number;\n stops: GradientStop[];\n}\n\n/** `to <方向>` キーワード → CSS 角度 (deg)。コーナーは 45 度刻みの近似 */\nconst DIRECTION_KEYWORDS: Record<string, number> = {\n \"to top\": 0,\n \"to right\": 90,\n \"to bottom\": 180,\n \"to left\": 270,\n \"to top right\": 45,\n \"to right top\": 45,\n \"to bottom right\": 135,\n \"to right bottom\": 135,\n \"to bottom left\": 225,\n \"to left bottom\": 225,\n \"to top left\": 315,\n \"to left top\": 315,\n};\n\nconst COLOR_PATTERN = /^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/;\n\nfunction normalizeColor(raw: string): string | null {\n const match = COLOR_PATTERN.exec(raw);\n if (!match) return null;\n const hex = match[1];\n if (hex.length === 3) {\n return hex\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n .toUpperCase();\n }\n return hex.toUpperCase();\n}\n\n/**\n * 位置省略されたストップに CSS 互換のルールで位置を割り当てる。\n * - 先頭が省略なら 0、末尾が省略なら 100\n * - 中間の省略は前後の明示位置の間で均等配置\n * - 位置が前のストップより小さい場合は前の値に切り上げ (非減少を保証)\n */\nfunction resolveStopPositions(\n stops: { color: string; position: number | undefined }[],\n): GradientStop[] {\n const positions: (number | undefined)[] = stops.map((s) => s.position);\n if (positions[0] === undefined) positions[0] = 0;\n if (positions[positions.length - 1] === undefined) {\n positions[positions.length - 1] = 100;\n }\n\n let prevIndex = 0;\n for (let i = 1; i < positions.length; i++) {\n if (positions[i] === undefined) continue;\n const gap = i - prevIndex;\n if (gap > 1) {\n const start = positions[prevIndex]!;\n const end = positions[i]!;\n for (let j = 1; j < gap; j++) {\n positions[prevIndex + j] = start + ((end - start) * j) / gap;\n }\n }\n prevIndex = i;\n }\n\n let prev = 0;\n return stops.map((stop, i) => {\n const clamped = Math.min(Math.max(positions[i]!, 0), 100);\n const position = Math.max(clamped, prev);\n prev = position;\n return { color: stop.color, position };\n });\n}\n\n/**\n * linear-gradient() 構文をパースする。不正な構文の場合は null を返す。\n */\nexport function parseLinearGradient(value: string): LinearGradient | null {\n const match = /^\\s*linear-gradient\\s*\\(\\s*(.+?)\\s*\\)\\s*$/.exec(value);\n if (!match) return null;\n\n const args = match[1].split(\",\").map((s) => s.trim());\n if (args.length === 0) return null;\n\n let angle = 180;\n let stopArgs = args;\n\n const first = args[0];\n const angleMatch = /^(-?\\d+(?:\\.\\d+)?)deg$/.exec(first);\n const directionAngle =\n DIRECTION_KEYWORDS[first.toLowerCase().replace(/\\s+/g, \" \")];\n if (angleMatch) {\n angle = ((Number(angleMatch[1]) % 360) + 360) % 360;\n stopArgs = args.slice(1);\n } else if (directionAngle !== undefined) {\n angle = directionAngle;\n stopArgs = args.slice(1);\n }\n\n if (stopArgs.length < 2) return null;\n\n const stops: { color: string; position: number | undefined }[] = [];\n for (const stopArg of stopArgs) {\n const parts = stopArg.split(/\\s+/);\n if (parts.length === 0 || parts.length > 2) return null;\n const color = normalizeColor(parts[0]);\n if (color === null) return null;\n\n let position: number | undefined;\n if (parts.length === 2) {\n const posMatch = /^(-?\\d+(?:\\.\\d+)?)%$/.exec(parts[1]);\n if (!posMatch) return null;\n position = Number(posMatch[1]);\n }\n stops.push({ color, position });\n }\n\n return { angle, stops: resolveStopPositions(stops) };\n}\n"],"mappings":";;AA4BA,MAAM,qBAA6C;CACjD,UAAU;CACV,YAAY;CACZ,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,gBAAgB;CAChB,mBAAmB;CACnB,mBAAmB;CACnB,kBAAkB;CAClB,kBAAkB;CAClB,eAAe;CACf,eAAe;AACjB;AAEA,MAAM,gBAAgB;AAEtB,SAAS,eAAe,KAA4B;CAClD,MAAM,QAAQ,cAAc,KAAK,GAAG;CACpC,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,MAAM,MAAM;CAClB,IAAI,IAAI,WAAW,GACjB,OAAO,IACJ,MAAM,EAAE,CAAC,CACT,KAAK,MAAM,IAAI,CAAC,CAAC,CACjB,KAAK,EAAE,CAAC,CACR,YAAY;CAEjB,OAAO,IAAI,YAAY;AACzB;;;;;;;AAQA,SAAS,qBACP,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AAC;CACzB,OAAO,IAAI,mBAAmB,KAAA,GAAW;EACvC,QAAQ;EACR,WAAW,KAAK,MAAM,CAAC;CACzB;CAEA,IAAI,SAAS,SAAS,GAAG,OAAO;CAEhC,MAAM,QAA2D,CAAC;CAClE,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,QAAQ,QAAQ,MAAM,KAAK;EACjC,IAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GAAG,OAAO;EACnD,MAAM,QAAQ,eAAe,MAAM,EAAE;EACrC,IAAI,UAAU,MAAM,OAAO;EAE3B,IAAI;EACJ,IAAI,MAAM,WAAW,GAAG;GACtB,MAAM,WAAW,uBAAuB,KAAK,MAAM,EAAE;GACrD,IAAI,CAAC,UAAU,OAAO;GACtB,WAAW,OAAO,SAAS,EAAE;EAC/B;EACA,MAAM,KAAK;GAAE;GAAO;EAAS,CAAC;CAChC;CAEA,OAAO;EAAE;EAAO,OAAO,qBAAqB,KAAK;CAAE;AACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measureImage.js","names":[],"sources":["../../src/shared/measureImage.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport { imageSize } from \"image-size\";\nimport type { DiagnosticCollector } from \"../diagnostics.ts\";\n\ntype ImageSizeCache = Map<string, { widthPx: number; heightPx: number }>;\ntype ImageDataCache = Map<string, string>;\n\n/**\n * キャッシュされた画像データ(Base64)を取得する\n * @param src 画像のパス\n * @param cache 画像データキャッシュ\n * @returns Base64形式の画像データ、またはキャッシュがない場合はundefined\n */\nexport function getImageData(\n src: string,\n cache: ImageDataCache,\n): string | undefined {\n return cache.get(src);\n}\n\n/**\n * 画像サイズを事前取得してキャッシュする(非同期)\n * HTTPS URLの画像を処理する際に使用\n * @param src 画像のパス(ローカルパス、base64データ、またはHTTPS URL)\n * @param sizeCache 画像サイズキャッシュ\n * @param dataCache 画像データキャッシュ\n * @returns 画像の幅と高さ(px)\n */\nexport async function prefetchImageSize(\n src: string,\n sizeCache: ImageSizeCache,\n dataCache: ImageDataCache,\n diagnostics: DiagnosticCollector,\n): Promise<{\n widthPx: number;\n heightPx: number;\n}> {\n // キャッシュにあればそれを返す\n const cached = sizeCache.get(src);\n if (cached) {\n return cached;\n }\n\n try {\n let buffer: Uint8Array;\n\n // base64データの場合\n if (src.startsWith(\"data:\")) {\n const base64Data = src.split(\",\")[1];\n buffer = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n }\n // HTTPS/HTTP URLの場合\n else if (src.startsWith(\"https://\") || src.startsWith(\"http://\")) {\n const response = await fetch(src);\n if (!response.ok) {\n throw new Error(`Failed to fetch image: ${response.status}`);\n }\n const arrayBuffer = await response.arrayBuffer();\n buffer = new Uint8Array(arrayBuffer);\n\n // 画像データをBase64形式でキャッシュ(pptxgenjs用)\n const contentType = response.headers.get(\"content-type\") || \"image/png\";\n const base64 = Buffer.from(arrayBuffer).toString(\"base64\");\n dataCache.set(src, `${contentType};base64,${base64}`);\n }\n // ローカルファイルパスの場合\n else {\n buffer = new Uint8Array(fs.readFileSync(src));\n }\n\n const dimensions = imageSize(buffer);\n\n const width = dimensions.width ?? 100; // デフォルト100px\n const height = dimensions.height ?? 100; // デフォルト100px\n\n const result = {\n widthPx: width,\n heightPx: height,\n };\n\n // キャッシュに保存\n sizeCache.set(src, result);\n\n return result;\n } catch (error) {\n // エラーが発生した場合はデフォルトサイズを返す\n diagnostics.add(\n \"IMAGE_MEASURE_FAILED\",\n `Failed to measure image size for ${src}: ${String(error)}`,\n );\n const result = {\n widthPx: 100,\n heightPx: 100,\n };\n sizeCache.set(src, result);\n return result;\n }\n}\n\n/**\n * 画像ファイルのサイズを取得する(同期)\n * 事前にprefetchImageSizeでキャッシュしておくこと\n * @param src 画像のパス(ローカルパス、base64データ、またはHTTPS URL)\n * @param sizeCache 画像サイズキャッシュ\n * @returns 画像の幅と高さ(px)\n */\nexport function measureImage(\n src: string,\n sizeCache: ImageSizeCache,\n diagnostics: DiagnosticCollector,\n): {\n widthPx: number;\n heightPx: number;\n} {\n // キャッシュにあればそれを返す\n const cached = sizeCache.get(src);\n if (cached) {\n return cached;\n }\n\n // キャッシュにない場合(ローカルファイルやbase64のみ同期処理可能)\n try {\n let buffer: Uint8Array;\n\n // base64データの場合\n if (src.startsWith(\"data:\")) {\n const base64Data = src.split(\",\")[1];\n buffer = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n }\n // HTTPS/HTTP URLの場合はキャッシュがないとデフォルト値を返す\n else if (src.startsWith(\"https://\") || src.startsWith(\"http://\")) {\n diagnostics.add(\n \"IMAGE_NOT_PREFETCHED\",\n `Image size for URL ${src} was not prefetched. Using default size.`,\n );\n return {\n widthPx: 100,\n heightPx: 100,\n };\n }\n // ローカルファイルパスの場合\n else {\n buffer = new Uint8Array(fs.readFileSync(src));\n }\n\n const dimensions = imageSize(buffer);\n\n const width = dimensions.width ?? 100; // デフォルト100px\n const height = dimensions.height ?? 100; // デフォルト100px\n\n const result = {\n widthPx: width,\n heightPx: height,\n };\n\n // キャッシュに保存\n sizeCache.set(src, result);\n\n return result;\n } catch (error) {\n // エラーが発生した場合はデフォルトサイズを返す\n diagnostics.add(\n \"IMAGE_MEASURE_FAILED\",\n `Failed to measure image size for ${src}: ${String(error)}`,\n );\n return {\n widthPx: 100,\n heightPx: 100,\n };\n }\n}\n"],"mappings":";;;;;;;;;AAaA,SAAgB,aACd,KACA,OACoB;CACpB,OAAO,MAAM,IAAI,GAAG;AACtB;;;;;;;;;AAUA,eAAsB,kBACpB,KACA,WACA,WACA,aAIC;CAED,MAAM,SAAS,UAAU,IAAI,GAAG;CAChC,IAAI,QACF,OAAO;CAGT,IAAI;EACF,IAAI;EAGJ,IAAI,IAAI,WAAW,OAAO,GAAG;GAC3B,MAAM,aAAa,IAAI,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"measureImage.js","names":[],"sources":["../../src/shared/measureImage.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport { imageSize } from \"image-size\";\nimport type { DiagnosticCollector } from \"../diagnostics.ts\";\n\ntype ImageSizeCache = Map<string, { widthPx: number; heightPx: number }>;\ntype ImageDataCache = Map<string, string>;\n\n/**\n * キャッシュされた画像データ(Base64)を取得する\n * @param src 画像のパス\n * @param cache 画像データキャッシュ\n * @returns Base64形式の画像データ、またはキャッシュがない場合はundefined\n */\nexport function getImageData(\n src: string,\n cache: ImageDataCache,\n): string | undefined {\n return cache.get(src);\n}\n\n/**\n * 画像サイズを事前取得してキャッシュする(非同期)\n * HTTPS URLの画像を処理する際に使用\n * @param src 画像のパス(ローカルパス、base64データ、またはHTTPS URL)\n * @param sizeCache 画像サイズキャッシュ\n * @param dataCache 画像データキャッシュ\n * @returns 画像の幅と高さ(px)\n */\nexport async function prefetchImageSize(\n src: string,\n sizeCache: ImageSizeCache,\n dataCache: ImageDataCache,\n diagnostics: DiagnosticCollector,\n): Promise<{\n widthPx: number;\n heightPx: number;\n}> {\n // キャッシュにあればそれを返す\n const cached = sizeCache.get(src);\n if (cached) {\n return cached;\n }\n\n try {\n let buffer: Uint8Array;\n\n // base64データの場合\n if (src.startsWith(\"data:\")) {\n const base64Data = src.split(\",\")[1];\n buffer = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n }\n // HTTPS/HTTP URLの場合\n else if (src.startsWith(\"https://\") || src.startsWith(\"http://\")) {\n const response = await fetch(src);\n if (!response.ok) {\n throw new Error(`Failed to fetch image: ${response.status}`);\n }\n const arrayBuffer = await response.arrayBuffer();\n buffer = new Uint8Array(arrayBuffer);\n\n // 画像データをBase64形式でキャッシュ(pptxgenjs用)\n const contentType = response.headers.get(\"content-type\") || \"image/png\";\n const base64 = Buffer.from(arrayBuffer).toString(\"base64\");\n dataCache.set(src, `${contentType};base64,${base64}`);\n }\n // ローカルファイルパスの場合\n else {\n buffer = new Uint8Array(fs.readFileSync(src));\n }\n\n const dimensions = imageSize(buffer);\n\n const width = dimensions.width ?? 100; // デフォルト100px\n const height = dimensions.height ?? 100; // デフォルト100px\n\n const result = {\n widthPx: width,\n heightPx: height,\n };\n\n // キャッシュに保存\n sizeCache.set(src, result);\n\n return result;\n } catch (error) {\n // エラーが発生した場合はデフォルトサイズを返す\n diagnostics.add(\n \"IMAGE_MEASURE_FAILED\",\n `Failed to measure image size for ${src}: ${String(error)}`,\n );\n const result = {\n widthPx: 100,\n heightPx: 100,\n };\n sizeCache.set(src, result);\n return result;\n }\n}\n\n/**\n * 画像ファイルのサイズを取得する(同期)\n * 事前にprefetchImageSizeでキャッシュしておくこと\n * @param src 画像のパス(ローカルパス、base64データ、またはHTTPS URL)\n * @param sizeCache 画像サイズキャッシュ\n * @returns 画像の幅と高さ(px)\n */\nexport function measureImage(\n src: string,\n sizeCache: ImageSizeCache,\n diagnostics: DiagnosticCollector,\n): {\n widthPx: number;\n heightPx: number;\n} {\n // キャッシュにあればそれを返す\n const cached = sizeCache.get(src);\n if (cached) {\n return cached;\n }\n\n // キャッシュにない場合(ローカルファイルやbase64のみ同期処理可能)\n try {\n let buffer: Uint8Array;\n\n // base64データの場合\n if (src.startsWith(\"data:\")) {\n const base64Data = src.split(\",\")[1];\n buffer = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n }\n // HTTPS/HTTP URLの場合はキャッシュがないとデフォルト値を返す\n else if (src.startsWith(\"https://\") || src.startsWith(\"http://\")) {\n diagnostics.add(\n \"IMAGE_NOT_PREFETCHED\",\n `Image size for URL ${src} was not prefetched. Using default size.`,\n );\n return {\n widthPx: 100,\n heightPx: 100,\n };\n }\n // ローカルファイルパスの場合\n else {\n buffer = new Uint8Array(fs.readFileSync(src));\n }\n\n const dimensions = imageSize(buffer);\n\n const width = dimensions.width ?? 100; // デフォルト100px\n const height = dimensions.height ?? 100; // デフォルト100px\n\n const result = {\n widthPx: width,\n heightPx: height,\n };\n\n // キャッシュに保存\n sizeCache.set(src, result);\n\n return result;\n } catch (error) {\n // エラーが発生した場合はデフォルトサイズを返す\n diagnostics.add(\n \"IMAGE_MEASURE_FAILED\",\n `Failed to measure image size for ${src}: ${String(error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AEA,MAAM,SAAS,UAAU,IAAI,GAAG;CAChC,IAAI,QACF,OAAO;CAIT,IAAI;EACF,IAAI;EAGJ,IAAI,IAAI,WAAW,OAAO,GAAG;GAC3B,MAAM,aAAa,IAAI,MAAM,GAAG,CAAC,CAAC;GAClC,SAAS,IAAI,WAAW,OAAO,KAAK,YAAY,QAAQ,CAAC;EAC3D,OAEK,IAAI,IAAI,WAAW,UAAU,KAAK,IAAI,WAAW,SAAS,GAAG;GAChE,YAAY,IACV,wBACA,sBAAsB,IAAI,yCAC5B;GACA,OAAO;IACL,SAAS;IACT,UAAU;GACZ;EACF,OAGE,SAAS,IAAI,WAAW,GAAG,aAAa,GAAG,CAAC;EAG9C,MAAM,aAAa,UAAU,MAAM;EAKnC,MAAM,SAAS;GACb,SAJY,WAAW,SAAS;GAKhC,UAJa,WAAW,UAAU;EAKpC;EAGA,UAAU,IAAI,KAAK,MAAM;EAEzB,OAAO;CACT,SAAS,OAAO;EAEd,YAAY,IACV,wBACA,oCAAoC,IAAI,IAAI,OAAO,KAAK,GAC1D;EACA,OAAO;GACL,SAAS;GACT,UAAU;EACZ;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableUtils.js","names":[],"sources":["../../src/shared/tableUtils.ts"],"sourcesContent":["import type { TableNode } from \"../types.ts\";\n\nconst DEFAULT_TABLE_ROW_HEIGHT = 32;\nconst DEFAULT_TABLE_COLUMN_WIDTH = 100;\n\nexport function calcTableIntrinsicSize(node: TableNode) {\n const width = node.columns.reduce(\n (sum, column) => sum + (column.width ?? DEFAULT_TABLE_COLUMN_WIDTH),\n 0,\n );\n const height = resolveRowHeights(node).reduce((sum, h) => sum + h, 0);\n\n return { width, height };\n}\n\nexport function resolveRowHeights(node: TableNode) {\n const fallbackRowHeight = node.defaultRowHeight ?? DEFAULT_TABLE_ROW_HEIGHT;\n return node.rows.map((row) => row.height ?? fallbackRowHeight);\n}\n\n/**\n * テーブルの各カラム幅を解決する\n * - 幅が指定されているカラムはその値を使用\n * - 幅が未指定のカラムは、残りの幅を均等分割\n *\n * @param node テーブルノード\n * @param tableWidth テーブル全体の幅(レイアウト計算後の確定値)\n */\nexport function resolveColumnWidths(\n node: TableNode,\n tableWidth: number,\n): number[] {\n const specifiedTotal = node.columns.reduce(\n (sum, col) => sum + (col.width ?? 0),\n 0,\n );\n const unspecifiedCount = node.columns.filter(\n (col) => col.width === undefined,\n ).length;\n\n // 未指定カラムがない場合、または未指定カラムに割り当てる幅を計算\n const remainingWidth = Math.max(0, tableWidth - specifiedTotal);\n const widthPerUnspecified =\n unspecifiedCount > 0 ? remainingWidth / unspecifiedCount : 0;\n\n return node.columns.map((col) => col.width ?? widthPerUnspecified);\n}\n"],"mappings":";AAEA,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AAEnC,SAAgB,uBAAuB,MAAiB;CAOtD,OAAO;EAAE,OANK,KAAK,QAAQ,QACxB,KAAK,WAAW,OAAO,OAAO,SAAS,6BACxC,CAIW;EAAG,QAFD,kBAAkB,IAAI,
|
|
1
|
+
{"version":3,"file":"tableUtils.js","names":[],"sources":["../../src/shared/tableUtils.ts"],"sourcesContent":["import type { TableNode } from \"../types.ts\";\n\nconst DEFAULT_TABLE_ROW_HEIGHT = 32;\nconst DEFAULT_TABLE_COLUMN_WIDTH = 100;\n\nexport function calcTableIntrinsicSize(node: TableNode) {\n const width = node.columns.reduce(\n (sum, column) => sum + (column.width ?? DEFAULT_TABLE_COLUMN_WIDTH),\n 0,\n );\n const height = resolveRowHeights(node).reduce((sum, h) => sum + h, 0);\n\n return { width, height };\n}\n\nexport function resolveRowHeights(node: TableNode) {\n const fallbackRowHeight = node.defaultRowHeight ?? DEFAULT_TABLE_ROW_HEIGHT;\n return node.rows.map((row) => row.height ?? fallbackRowHeight);\n}\n\n/**\n * テーブルの各カラム幅を解決する\n * - 幅が指定されているカラムはその値を使用\n * - 幅が未指定のカラムは、残りの幅を均等分割\n *\n * @param node テーブルノード\n * @param tableWidth テーブル全体の幅(レイアウト計算後の確定値)\n */\nexport function resolveColumnWidths(\n node: TableNode,\n tableWidth: number,\n): number[] {\n const specifiedTotal = node.columns.reduce(\n (sum, col) => sum + (col.width ?? 0),\n 0,\n );\n const unspecifiedCount = node.columns.filter(\n (col) => col.width === undefined,\n ).length;\n\n // 未指定カラムがない場合、または未指定カラムに割り当てる幅を計算\n const remainingWidth = Math.max(0, tableWidth - specifiedTotal);\n const widthPerUnspecified =\n unspecifiedCount > 0 ? remainingWidth / unspecifiedCount : 0;\n\n return node.columns.map((col) => col.width ?? widthPerUnspecified);\n}\n"],"mappings":";AAEA,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AAEnC,SAAgB,uBAAuB,MAAiB;CAOtD,OAAO;EAAE,OANK,KAAK,QAAQ,QACxB,KAAK,WAAW,OAAO,OAAO,SAAS,6BACxC,CAIW;EAAG,QAFD,kBAAkB,IAAI,CAAC,CAAC,QAAQ,KAAK,MAAM,MAAM,GAAG,CAE9C;CAAE;AACzB;AAEA,SAAgB,kBAAkB,MAAiB;CACjD,MAAM,oBAAoB,KAAK,oBAAoB;CACnD,OAAO,KAAK,KAAK,KAAK,QAAQ,IAAI,UAAU,iBAAiB;AAC/D;;;;;;;;;AAUA,SAAgB,oBACd,MACA,YACU;CACV,MAAM,iBAAiB,KAAK,QAAQ,QACjC,KAAK,QAAQ,OAAO,IAAI,SAAS,IAClC,CACF;CACA,MAAM,mBAAmB,KAAK,QAAQ,QACnC,QAAQ,IAAI,UAAU,KAAA,CACzB,CAAC,CAAC;CAGF,MAAM,iBAAiB,KAAK,IAAI,GAAG,aAAa,cAAc;CAC9D,MAAM,sBACJ,mBAAmB,IAAI,iBAAiB,mBAAmB;CAE7D,OAAO,KAAK,QAAQ,KAAK,QAAQ,IAAI,SAAS,mBAAmB;AACnE"}
|
package/dist/types.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ declare const basePOMNodeSchema: z.ZodObject<{
|
|
|
27
27
|
id: z.ZodOptional<z.ZodString>;
|
|
28
28
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
29
29
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
30
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
30
31
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
31
32
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
32
33
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -44,6 +45,7 @@ declare const basePOMNodeSchema: z.ZodObject<{
|
|
|
44
45
|
left: z.ZodOptional<z.ZodNumber>;
|
|
45
46
|
}, z.core.$strip>]>>;
|
|
46
47
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
48
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
47
49
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
48
50
|
src: z.ZodString;
|
|
49
51
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -100,6 +102,7 @@ declare const textNodeSchema: z.ZodObject<{
|
|
|
100
102
|
id: z.ZodOptional<z.ZodString>;
|
|
101
103
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
102
104
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
105
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
103
106
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
104
107
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
105
108
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -117,6 +120,7 @@ declare const textNodeSchema: z.ZodObject<{
|
|
|
117
120
|
left: z.ZodOptional<z.ZodNumber>;
|
|
118
121
|
}, z.core.$strip>]>>;
|
|
119
122
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
123
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
120
124
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
121
125
|
src: z.ZodString;
|
|
122
126
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -179,6 +183,7 @@ declare const textNodeSchema: z.ZodObject<{
|
|
|
179
183
|
color: z.ZodOptional<z.ZodString>;
|
|
180
184
|
href: z.ZodOptional<z.ZodString>;
|
|
181
185
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
186
|
+
letterSpacing: z.ZodOptional<z.ZodNumber>;
|
|
182
187
|
}, z.core.$strip>>>;
|
|
183
188
|
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
184
189
|
color: z.ZodOptional<z.ZodString>;
|
|
@@ -213,11 +218,13 @@ declare const textNodeSchema: z.ZodObject<{
|
|
|
213
218
|
highlight: z.ZodOptional<z.ZodString>;
|
|
214
219
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
215
220
|
lineHeight: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
letterSpacing: z.ZodOptional<z.ZodNumber>;
|
|
216
222
|
}, z.core.$strip>;
|
|
217
223
|
declare const ulNodeSchema: z.ZodObject<{
|
|
218
224
|
id: z.ZodOptional<z.ZodString>;
|
|
219
225
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
220
226
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
227
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
221
228
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
222
229
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
223
230
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -235,6 +242,7 @@ declare const ulNodeSchema: z.ZodObject<{
|
|
|
235
242
|
left: z.ZodOptional<z.ZodNumber>;
|
|
236
243
|
}, z.core.$strip>]>>;
|
|
237
244
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
245
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
238
246
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
239
247
|
src: z.ZodString;
|
|
240
248
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -298,6 +306,7 @@ declare const ulNodeSchema: z.ZodObject<{
|
|
|
298
306
|
color: z.ZodOptional<z.ZodString>;
|
|
299
307
|
href: z.ZodOptional<z.ZodString>;
|
|
300
308
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
309
|
+
letterSpacing: z.ZodOptional<z.ZodNumber>;
|
|
301
310
|
}, z.core.$strip>>>;
|
|
302
311
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
303
312
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -365,6 +374,7 @@ declare const olNodeSchema: z.ZodObject<{
|
|
|
365
374
|
id: z.ZodOptional<z.ZodString>;
|
|
366
375
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
367
376
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
377
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
368
378
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
369
379
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
370
380
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -382,6 +392,7 @@ declare const olNodeSchema: z.ZodObject<{
|
|
|
382
392
|
left: z.ZodOptional<z.ZodNumber>;
|
|
383
393
|
}, z.core.$strip>]>>;
|
|
384
394
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
395
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
385
396
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
386
397
|
src: z.ZodString;
|
|
387
398
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -445,6 +456,7 @@ declare const olNodeSchema: z.ZodObject<{
|
|
|
445
456
|
color: z.ZodOptional<z.ZodString>;
|
|
446
457
|
href: z.ZodOptional<z.ZodString>;
|
|
447
458
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
459
|
+
letterSpacing: z.ZodOptional<z.ZodNumber>;
|
|
448
460
|
}, z.core.$strip>>>;
|
|
449
461
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
450
462
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -531,6 +543,7 @@ declare const imageNodeSchema: z.ZodObject<{
|
|
|
531
543
|
id: z.ZodOptional<z.ZodString>;
|
|
532
544
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
533
545
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
546
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
534
547
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
535
548
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
536
549
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -548,6 +561,7 @@ declare const imageNodeSchema: z.ZodObject<{
|
|
|
548
561
|
left: z.ZodOptional<z.ZodNumber>;
|
|
549
562
|
}, z.core.$strip>]>>;
|
|
550
563
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
564
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
551
565
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
552
566
|
src: z.ZodString;
|
|
553
567
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -616,6 +630,7 @@ declare const iconNodeSchema: z.ZodObject<{
|
|
|
616
630
|
id: z.ZodOptional<z.ZodString>;
|
|
617
631
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
618
632
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
633
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
619
634
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
620
635
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
621
636
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -633,6 +648,7 @@ declare const iconNodeSchema: z.ZodObject<{
|
|
|
633
648
|
left: z.ZodOptional<z.ZodNumber>;
|
|
634
649
|
}, z.core.$strip>]>>;
|
|
635
650
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
651
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
636
652
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
637
653
|
src: z.ZodString;
|
|
638
654
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -700,6 +716,7 @@ declare const iconNodeSchema: z.ZodObject<{
|
|
|
700
716
|
type IconNode = z.infer<typeof iconNodeSchema>;
|
|
701
717
|
declare const svgNodeSchema: z.ZodObject<{
|
|
702
718
|
id: z.ZodOptional<z.ZodString>;
|
|
719
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
703
720
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
704
721
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
705
722
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -717,6 +734,7 @@ declare const svgNodeSchema: z.ZodObject<{
|
|
|
717
734
|
left: z.ZodOptional<z.ZodNumber>;
|
|
718
735
|
}, z.core.$strip>]>>;
|
|
719
736
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
737
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
720
738
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
721
739
|
src: z.ZodString;
|
|
722
740
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -778,6 +796,7 @@ declare const tableNodeSchema: z.ZodObject<{
|
|
|
778
796
|
id: z.ZodOptional<z.ZodString>;
|
|
779
797
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
780
798
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
799
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
781
800
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
782
801
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
783
802
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -795,6 +814,7 @@ declare const tableNodeSchema: z.ZodObject<{
|
|
|
795
814
|
left: z.ZodOptional<z.ZodNumber>;
|
|
796
815
|
}, z.core.$strip>]>>;
|
|
797
816
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
817
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
798
818
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
799
819
|
src: z.ZodString;
|
|
800
820
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -862,6 +882,7 @@ declare const tableNodeSchema: z.ZodObject<{
|
|
|
862
882
|
color: z.ZodOptional<z.ZodString>;
|
|
863
883
|
href: z.ZodOptional<z.ZodString>;
|
|
864
884
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
885
|
+
letterSpacing: z.ZodOptional<z.ZodNumber>;
|
|
865
886
|
}, z.core.$strip>>>;
|
|
866
887
|
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
867
888
|
color: z.ZodOptional<z.ZodString>;
|
|
@@ -921,6 +942,7 @@ declare const shapeNodeSchema: z.ZodObject<{
|
|
|
921
942
|
id: z.ZodOptional<z.ZodString>;
|
|
922
943
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
923
944
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
945
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
924
946
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
925
947
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
926
948
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -938,6 +960,7 @@ declare const shapeNodeSchema: z.ZodObject<{
|
|
|
938
960
|
left: z.ZodOptional<z.ZodNumber>;
|
|
939
961
|
}, z.core.$strip>]>>;
|
|
940
962
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
963
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
941
964
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
942
965
|
src: z.ZodString;
|
|
943
966
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1226,6 +1249,7 @@ declare const chartNodeSchema: z.ZodObject<{
|
|
|
1226
1249
|
id: z.ZodOptional<z.ZodString>;
|
|
1227
1250
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1228
1251
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1252
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
1229
1253
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
1230
1254
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1231
1255
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1243,6 +1267,7 @@ declare const chartNodeSchema: z.ZodObject<{
|
|
|
1243
1267
|
left: z.ZodOptional<z.ZodNumber>;
|
|
1244
1268
|
}, z.core.$strip>]>>;
|
|
1245
1269
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1270
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
1246
1271
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1247
1272
|
src: z.ZodString;
|
|
1248
1273
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1328,6 +1353,7 @@ declare const timelineNodeSchema: z.ZodObject<{
|
|
|
1328
1353
|
id: z.ZodOptional<z.ZodString>;
|
|
1329
1354
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1330
1355
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1356
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
1331
1357
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
1332
1358
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1333
1359
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1345,6 +1371,7 @@ declare const timelineNodeSchema: z.ZodObject<{
|
|
|
1345
1371
|
left: z.ZodOptional<z.ZodNumber>;
|
|
1346
1372
|
}, z.core.$strip>]>>;
|
|
1347
1373
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1374
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
1348
1375
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1349
1376
|
src: z.ZodString;
|
|
1350
1377
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1412,6 +1439,7 @@ declare const matrixNodeSchema: z.ZodObject<{
|
|
|
1412
1439
|
id: z.ZodOptional<z.ZodString>;
|
|
1413
1440
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1414
1441
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1442
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
1415
1443
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
1416
1444
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1417
1445
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1429,6 +1457,7 @@ declare const matrixNodeSchema: z.ZodObject<{
|
|
|
1429
1457
|
left: z.ZodOptional<z.ZodNumber>;
|
|
1430
1458
|
}, z.core.$strip>]>>;
|
|
1431
1459
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1460
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
1432
1461
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1433
1462
|
src: z.ZodString;
|
|
1434
1463
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1507,6 +1536,7 @@ declare const treeNodeSchema: z.ZodObject<{
|
|
|
1507
1536
|
id: z.ZodOptional<z.ZodString>;
|
|
1508
1537
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1509
1538
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1539
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
1510
1540
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
1511
1541
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1512
1542
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1524,6 +1554,7 @@ declare const treeNodeSchema: z.ZodObject<{
|
|
|
1524
1554
|
left: z.ZodOptional<z.ZodNumber>;
|
|
1525
1555
|
}, z.core.$strip>]>>;
|
|
1526
1556
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1557
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
1527
1558
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1528
1559
|
src: z.ZodString;
|
|
1529
1560
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1599,6 +1630,7 @@ declare const processArrowNodeSchema: z.ZodObject<{
|
|
|
1599
1630
|
id: z.ZodOptional<z.ZodString>;
|
|
1600
1631
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1601
1632
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1633
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
1602
1634
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
1603
1635
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1604
1636
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1616,6 +1648,7 @@ declare const processArrowNodeSchema: z.ZodObject<{
|
|
|
1616
1648
|
left: z.ZodOptional<z.ZodNumber>;
|
|
1617
1649
|
}, z.core.$strip>]>>;
|
|
1618
1650
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1651
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
1619
1652
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1620
1653
|
src: z.ZodString;
|
|
1621
1654
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1711,6 +1744,7 @@ declare const pyramidNodeSchema: z.ZodObject<{
|
|
|
1711
1744
|
id: z.ZodOptional<z.ZodString>;
|
|
1712
1745
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1713
1746
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1747
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
1714
1748
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
1715
1749
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1716
1750
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1728,6 +1762,7 @@ declare const pyramidNodeSchema: z.ZodObject<{
|
|
|
1728
1762
|
left: z.ZodOptional<z.ZodNumber>;
|
|
1729
1763
|
}, z.core.$strip>]>>;
|
|
1730
1764
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1765
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
1731
1766
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1732
1767
|
src: z.ZodString;
|
|
1733
1768
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1797,6 +1832,7 @@ declare const flowNodeSchema: z.ZodObject<{
|
|
|
1797
1832
|
id: z.ZodOptional<z.ZodString>;
|
|
1798
1833
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1799
1834
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1835
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
1800
1836
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
1801
1837
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1802
1838
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1814,6 +1850,7 @@ declare const flowNodeSchema: z.ZodObject<{
|
|
|
1814
1850
|
left: z.ZodOptional<z.ZodNumber>;
|
|
1815
1851
|
}, z.core.$strip>]>>;
|
|
1816
1852
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1853
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
1817
1854
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1818
1855
|
src: z.ZodString;
|
|
1819
1856
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1918,6 +1955,7 @@ declare const lineNodeSchema: z.ZodObject<{
|
|
|
1918
1955
|
id: z.ZodOptional<z.ZodString>;
|
|
1919
1956
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1920
1957
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
1958
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
1921
1959
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
1922
1960
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
1923
1961
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1935,6 +1973,7 @@ declare const lineNodeSchema: z.ZodObject<{
|
|
|
1935
1973
|
left: z.ZodOptional<z.ZodNumber>;
|
|
1936
1974
|
}, z.core.$strip>]>>;
|
|
1937
1975
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
1976
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
1938
1977
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
1939
1978
|
src: z.ZodString;
|
|
1940
1979
|
sizing: z.ZodOptional<z.ZodEnum<{
|
|
@@ -2028,6 +2067,7 @@ declare const arrowNodeSchema: z.ZodObject<{
|
|
|
2028
2067
|
id: z.ZodOptional<z.ZodString>;
|
|
2029
2068
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
2030
2069
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
2070
|
+
grow: z.ZodOptional<z.ZodNumber>;
|
|
2031
2071
|
minW: z.ZodOptional<z.ZodNumber>;
|
|
2032
2072
|
maxW: z.ZodOptional<z.ZodNumber>;
|
|
2033
2073
|
minH: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2045,6 +2085,7 @@ declare const arrowNodeSchema: z.ZodObject<{
|
|
|
2045
2085
|
left: z.ZodOptional<z.ZodNumber>;
|
|
2046
2086
|
}, z.core.$strip>]>>;
|
|
2047
2087
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
2088
|
+
backgroundGradient: z.ZodOptional<z.ZodString>;
|
|
2048
2089
|
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
2049
2090
|
src: z.ZodString;
|
|
2050
2091
|
sizing: z.ZodOptional<z.ZodEnum<{
|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SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAQzB,gBAAA,GAAmB,CAAA,CAAE,KAAK,QAAQ,sBAAA;AAAA,KAClC,iBAAA,GAAoB,CAAA,CAAE,KAAK,QAAQ,uBAAA;AAAA,KACnC,gBAAA,GAAmB,CAAA,CAAE,KAAK,QAAQ,sBAAA;AAAA,KAClC,gBAAA,GAAmB,CAAA,CAAE,KAAK,QAAQ,sBAAA;AAAA,KAClC,YAAA,GAAe,CAAA,CAAE,KAAK,QAAQ,kBAAA;AAAA,KAC9B,kBAAA,GAAqB,CAAA,CAAE,KAAK,QAAQ,wBAAA;AAAA,KACpC,qBAAA,GAAwB,CAAA,CAAE,KAAK,QAAQ,2BAAA;AAAA,KACvC,iBAAA,GAAoB,CAAA,CAAE,KAAK,QAAQ,uBAAA;AAAA,KACnC,kBAAA,GAAqB,CAAA,CAAE,KAAK,QAAQ,wBAAA"}
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ICON_DATA } from "./icons/iconData.js";
|
|
2
|
+
import { parseLinearGradient } from "./shared/gradient.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
//#region src/types.ts
|
|
4
5
|
const lengthSchema = z.union([
|
|
@@ -290,10 +291,12 @@ const backgroundImageSchema = z.object({
|
|
|
290
291
|
src: z.string(),
|
|
291
292
|
sizing: backgroundImageSizingSchema.optional()
|
|
292
293
|
});
|
|
294
|
+
const backgroundGradientSchema = z.string().refine((value) => parseLinearGradient(value) !== null, { message: "Invalid gradient syntax. Expected: linear-gradient(<angle>deg, <color> <position>%, ...) e.g. \"linear-gradient(135deg, #FF0000 0%, #0000FF 100%)\"" });
|
|
293
295
|
const basePOMNodeSchema = z.object({
|
|
294
296
|
id: z.string().optional(),
|
|
295
297
|
w: lengthSchema.optional(),
|
|
296
298
|
h: lengthSchema.optional(),
|
|
299
|
+
grow: z.number().positive().optional(),
|
|
297
300
|
minW: z.number().optional(),
|
|
298
301
|
maxW: z.number().optional(),
|
|
299
302
|
minH: z.number().optional(),
|
|
@@ -301,6 +304,7 @@ const basePOMNodeSchema = z.object({
|
|
|
301
304
|
padding: paddingSchema.optional(),
|
|
302
305
|
margin: paddingSchema.optional(),
|
|
303
306
|
backgroundColor: z.string().optional(),
|
|
307
|
+
backgroundGradient: backgroundGradientSchema.optional(),
|
|
304
308
|
backgroundImage: backgroundImageSchema.optional(),
|
|
305
309
|
border: borderStyleSchema.optional(),
|
|
306
310
|
borderRadius: z.number().optional(),
|
|
@@ -323,7 +327,8 @@ const textRunSchema = z.object({
|
|
|
323
327
|
highlight: z.string().optional(),
|
|
324
328
|
color: z.string().optional(),
|
|
325
329
|
href: z.string().optional(),
|
|
326
|
-
fontFamily: z.string().optional()
|
|
330
|
+
fontFamily: z.string().optional(),
|
|
331
|
+
letterSpacing: z.number().optional()
|
|
327
332
|
});
|
|
328
333
|
const textNodeSchema = basePOMNodeSchema.extend({
|
|
329
334
|
type: z.literal("text"),
|
|
@@ -342,7 +347,8 @@ const textNodeSchema = basePOMNodeSchema.extend({
|
|
|
342
347
|
strike: z.boolean().optional(),
|
|
343
348
|
highlight: z.string().optional(),
|
|
344
349
|
fontFamily: z.string().optional(),
|
|
345
|
-
lineHeight: z.number().optional()
|
|
350
|
+
lineHeight: z.number().optional(),
|
|
351
|
+
letterSpacing: z.number().optional()
|
|
346
352
|
});
|
|
347
353
|
const liNodeSchema = z.object({
|
|
348
354
|
text: z.string(),
|