@officedk/pptxdk 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +48 -2
- package/dist/build.d.ts +94 -0
- package/dist/build.js +148 -0
- package/dist/capabilities/dist/all.js +32 -0
- package/dist/capabilities/dist/box/box-codegen.js +51 -0
- package/dist/capabilities/dist/box/box-declaration.js +31 -0
- package/dist/capabilities/dist/box/box-elements.js +17 -0
- package/dist/capabilities/dist/box/box.js +138 -0
- package/dist/capabilities/dist/chart/chart-codegen.js +77 -0
- package/dist/capabilities/dist/chart/chart-declaration.js +7 -0
- package/dist/capabilities/dist/chart/chart-elements.js +12 -0
- package/dist/capabilities/dist/chart/chart-import.js +2272 -0
- package/dist/capabilities/dist/chart/chart-labels.js +86 -0
- package/dist/capabilities/dist/chart/chart-model.js +9 -0
- package/dist/capabilities/dist/chart/chart-schemas.js +1078 -0
- package/dist/capabilities/dist/chart/chart-xml.js +788 -0
- package/dist/capabilities/dist/chart/chart.js +1124 -0
- package/dist/capabilities/dist/chart/preview/axes-and-grid.js +298 -0
- package/dist/capabilities/dist/chart/preview/bar-column.js +143 -0
- package/dist/capabilities/dist/chart/preview/data-labels.js +334 -0
- package/dist/capabilities/dist/chart/preview/error-bars.js +213 -0
- package/dist/capabilities/dist/chart/preview/index.js +190 -0
- package/dist/capabilities/dist/chart/preview/layout.js +519 -0
- package/dist/capabilities/dist/chart/preview/legend.js +273 -0
- package/dist/capabilities/dist/chart/preview/line-area.js +404 -0
- package/dist/capabilities/dist/chart/preview/markers.js +100 -0
- package/dist/capabilities/dist/chart/preview/number-format.js +247 -0
- package/dist/capabilities/dist/chart/preview/pie-doughnut.js +159 -0
- package/dist/capabilities/dist/chart/preview/scales.js +365 -0
- package/dist/capabilities/dist/chart/preview/scatter.js +131 -0
- package/dist/capabilities/dist/chart/preview/style.js +48 -0
- package/dist/capabilities/dist/chart/preview/text-render.js +116 -0
- package/dist/capabilities/dist/chart/preview/trendlines.js +537 -0
- package/dist/capabilities/dist/chart/preview/types.js +5 -0
- package/dist/capabilities/dist/document.js +148 -0
- package/dist/capabilities/dist/font/font-embedding.js +289 -0
- package/dist/capabilities/dist/font/font-family.js +10 -0
- package/dist/capabilities/dist/font/font-import.js +302 -0
- package/dist/capabilities/dist/font/font-subset.js +55 -0
- package/dist/capabilities/dist/font/font.js +25 -0
- package/dist/capabilities/dist/group/group-codegen.js +51 -0
- package/dist/capabilities/dist/group/group-declaration.js +42 -0
- package/dist/capabilities/dist/group/group-elements.js +12 -0
- package/dist/capabilities/dist/group/group-import.js +319 -0
- package/dist/capabilities/dist/group/group-xml.js +7 -0
- package/dist/capabilities/dist/group/group.js +211 -0
- package/dist/capabilities/dist/image/gif-decoder.js +244 -0
- package/dist/capabilities/dist/image/image-codegen.js +94 -0
- package/dist/capabilities/dist/image/image-declaration.js +8 -0
- package/dist/capabilities/dist/image/image-decode.js +221 -0
- package/dist/capabilities/dist/image/image-elements.js +12 -0
- package/dist/capabilities/dist/image/image-import.js +778 -0
- package/dist/capabilities/dist/image/image-schemas.js +149 -0
- package/dist/capabilities/dist/image/image-xml.js +12 -0
- package/dist/capabilities/dist/image/image.js +472 -0
- package/dist/capabilities/dist/masters/footer-placeholder.js +685 -0
- package/dist/capabilities/dist/masters/masters-codegen.js +21 -0
- package/dist/capabilities/dist/masters/masters.js +250 -0
- package/dist/capabilities/dist/motion/motion-api.js +527 -0
- package/dist/capabilities/dist/motion/motion-codegen.js +340 -0
- package/dist/capabilities/dist/motion/motion-elements.js +43 -0
- package/dist/capabilities/dist/motion/motion-import.js +1033 -0
- package/dist/capabilities/dist/motion/motion-plan.js +2189 -0
- package/dist/capabilities/dist/motion/motion-query.js +420 -0
- package/dist/capabilities/dist/motion/motion-schemas.js +216 -0
- package/dist/capabilities/dist/motion/motion.js +1372 -0
- package/dist/capabilities/dist/notes/notes-codegen.js +20 -0
- package/dist/capabilities/dist/notes/notes-declaration.js +8 -0
- package/dist/capabilities/dist/notes/notes-elements.js +12 -0
- package/dist/capabilities/dist/notes/notes-import.js +292 -0
- package/dist/capabilities/dist/notes/notes-schemas.js +35 -0
- package/dist/capabilities/dist/notes/notes-xml.js +38 -0
- package/dist/capabilities/dist/notes/notes.js +191 -0
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +23 -0
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +12 -0
- package/dist/capabilities/dist/placeholder/placeholder.js +292 -0
- package/dist/capabilities/dist/shape/shape-codegen.js +166 -0
- package/dist/capabilities/dist/shape/shape-declaration.js +57 -0
- package/dist/capabilities/dist/shape/shape-elements.js +12 -0
- package/dist/capabilities/dist/shape/shape-import.js +579 -0
- package/dist/capabilities/dist/shape/shape-xml.js +6 -0
- package/dist/capabilities/dist/shape/shape.js +337 -0
- package/dist/capabilities/dist/shared/geometry.js +1423 -0
- package/dist/capabilities/dist/shared/identity.js +205 -0
- package/dist/capabilities/dist/shared/morph-api.js +11 -0
- package/dist/capabilities/dist/shared/placeholder-import.js +113 -0
- package/dist/capabilities/dist/shared/preset-definitions.js +21390 -0
- package/dist/capabilities/dist/shared/style-inheritance.js +166 -0
- package/dist/capabilities/dist/shared/style-parse.js +11 -0
- package/dist/capabilities/dist/shared/text-schemas.js +216 -0
- package/dist/capabilities/dist/shared/text-service.js +1883 -0
- package/dist/capabilities/dist/shared/visual.js +918 -0
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +44 -0
- package/dist/capabilities/dist/slide-background/slide-background-import.js +161 -0
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +21 -0
- package/dist/capabilities/dist/slide-background/slide-background.js +221 -0
- package/dist/capabilities/dist/table/table-codegen.js +81 -0
- package/dist/capabilities/dist/table/table-declaration.js +15 -0
- package/dist/capabilities/dist/table/table-elements.js +27 -0
- package/dist/capabilities/dist/table/table-import.js +539 -0
- package/dist/capabilities/dist/table/table-schemas.js +279 -0
- package/dist/capabilities/dist/table/table-xml.js +37 -0
- package/dist/capabilities/dist/table/table.js +662 -0
- package/dist/capabilities/dist/text/text-codegen.js +129 -0
- package/dist/capabilities/dist/text/text-declaration.js +19 -0
- package/dist/capabilities/dist/text/text-elements.js +38 -0
- package/dist/capabilities/dist/text/text-import.js +1077 -0
- package/dist/capabilities/dist/text/text-xml.js +9 -0
- package/dist/capabilities/dist/text/text.js +335 -0
- package/dist/capabilities/dist/transition/transition-api.js +139 -0
- package/dist/capabilities/dist/transition/transition-codegen.js +45 -0
- package/dist/capabilities/dist/transition/transition-import.js +477 -0
- package/dist/capabilities/dist/transition/transition.js +260 -0
- package/dist/capability-D_xeNVIw.d.ts +29496 -0
- package/dist/cli.js +20 -0
- package/dist/codegen/dist/assets.js +78 -0
- package/dist/codegen/dist/codegen.js +611 -0
- package/dist/codegen/dist/identifiers.js +193 -0
- package/dist/codegen/dist/index.js +3 -0
- package/dist/codegen/dist/printer.js +143 -0
- package/dist/codegen/dist/types.js +49 -0
- package/dist/core/dist/author-ids.js +48 -0
- package/dist/core/dist/author-schemas.js +313 -0
- package/dist/core/dist/block-flex-layout.js +749 -0
- package/dist/core/dist/build.js +4 -0
- package/dist/core/dist/capability.js +13 -0
- package/dist/core/dist/declaration.js +15 -0
- package/dist/core/dist/diagnostics.js +21 -0
- package/dist/core/dist/document-internals.js +13 -0
- package/dist/core/dist/document.js +408 -0
- package/dist/core/dist/geometry-schemas.js +249 -0
- package/dist/core/dist/grid-layout.js +445 -0
- package/dist/core/dist/host.js +40 -0
- package/dist/core/dist/index.js +15 -0
- package/dist/core/dist/input-values.js +45 -0
- package/dist/core/dist/layout-protocol.js +66 -0
- package/dist/core/dist/layout-schemas.js +208 -0
- package/dist/core/dist/layout.js +299 -0
- package/dist/core/dist/masters.js +169 -0
- package/dist/core/dist/morph.js +30 -0
- package/dist/core/dist/placeholders.js +213 -0
- package/dist/core/dist/query.js +155 -0
- package/dist/core/dist/resolution.js +11 -0
- package/dist/core/dist/resolve.js +1827 -0
- package/dist/core/dist/stage-options.js +67 -0
- package/dist/core/dist/theme.js +931 -0
- package/dist/document-BHPUODPP.d.ts +27759 -0
- package/dist/emit/dist/emit.js +936 -0
- package/dist/emit/dist/index.js +5 -0
- package/dist/emit/dist/ooxml.js +606 -0
- package/dist/emit/dist/shape-tree.js +12 -0
- package/dist/import/dist/alternate-content.js +54 -0
- package/dist/import/dist/diagnostics.js +153 -0
- package/dist/import/dist/fonts.js +250 -0
- package/dist/import/dist/import.js +504 -0
- package/dist/import/dist/index.js +16 -0
- package/dist/import/dist/masters.js +1153 -0
- package/dist/import/dist/mechanism.js +10 -0
- package/dist/import/dist/namespaces.js +60 -0
- package/dist/import/dist/notes-masters.js +300 -0
- package/dist/import/dist/opc.js +233 -0
- package/dist/import/dist/resources.js +166 -0
- package/dist/import/dist/sections.js +139 -0
- package/dist/import/dist/themes.js +671 -0
- package/dist/import/dist/visual.js +761 -0
- package/dist/import/dist/xml-fragments.js +36 -0
- package/dist/import/dist/xml-reader.js +267 -0
- package/dist/index-B5m3hqjC.d.ts +7 -0
- package/dist/index-CCy-Yo8G.d.ts +1208 -0
- package/dist/index-DpxcZ4Gs.d.ts +725 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +70 -0
- package/dist/node.d.ts +53 -0
- package/dist/node.js +194 -0
- package/dist/pptxdk/src/cli-commands.js +913 -0
- package/dist/pptxdk/src/compose.js +44 -0
- package/dist/pptxdk/src/slide.js +9 -0
- package/dist/preview/dist/index.js +240 -0
- package/dist/preview/dist/options.js +53 -0
- package/dist/preview-Cfw0QdMM.d.ts +86 -0
- package/dist/preview.d.ts +3 -0
- package/dist/preview.js +27 -0
- package/dist/react/dist/append.js +66 -0
- package/dist/react/dist/document-adapter.js +65 -0
- package/dist/react/dist/elements.js +59 -0
- package/dist/react/dist/index.js +68 -0
- package/dist/react/dist/reconciler.js +290 -0
- package/dist/react.d.ts +145 -0
- package/dist/react.js +27 -0
- package/dist/transition-Cips9wma.d.ts +82 -0
- package/dist/vanilla.d.ts +4 -0
- package/dist/vanilla.js +14 -0
- package/package.json +78 -3
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { CapabilityError } from "../../../../core/dist/diagnostics.js";
|
|
2
|
+
import "../../../../core/dist/capability.js";
|
|
3
|
+
import { resolveChartLineStroke, strokeAttrs } from "./style.js";
|
|
4
|
+
import { measureChartText, mergeChartTextStyle, renderChartTextSvg, resolveChartFontSizePixels } from "./text-render.js";
|
|
5
|
+
import { assertNever } from "./types.js";
|
|
6
|
+
// ../capabilities/dist/chart/preview/trendlines.js
|
|
7
|
+
function solveGaussianPartialPivoting(matrix, rhs) {
|
|
8
|
+
const n = rhs.length;
|
|
9
|
+
const a = matrix.map((row) => [...row]);
|
|
10
|
+
const b = [...rhs];
|
|
11
|
+
for (let col = 0; col < n; col += 1) {
|
|
12
|
+
let pivotRow = col;
|
|
13
|
+
let pivotAbs = Math.abs(a[col][col]);
|
|
14
|
+
for (let row = col + 1; row < n; row += 1) {
|
|
15
|
+
const candidate = Math.abs(a[row][col]);
|
|
16
|
+
if (candidate > pivotAbs) {
|
|
17
|
+
pivotAbs = candidate;
|
|
18
|
+
pivotRow = row;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (!Number.isFinite(pivotAbs) || pivotAbs < 1e-12) return;
|
|
22
|
+
if (pivotRow !== col) {
|
|
23
|
+
const tmpRow = a[col];
|
|
24
|
+
a[col] = a[pivotRow];
|
|
25
|
+
a[pivotRow] = tmpRow;
|
|
26
|
+
const tmpB = b[col];
|
|
27
|
+
b[col] = b[pivotRow];
|
|
28
|
+
b[pivotRow] = tmpB;
|
|
29
|
+
}
|
|
30
|
+
const diag = a[col][col];
|
|
31
|
+
for (let row = col + 1; row < n; row += 1) {
|
|
32
|
+
const factor = a[row][col] / diag;
|
|
33
|
+
if (factor === 0) continue;
|
|
34
|
+
for (let k = col; k < n; k += 1) a[row][k] = a[row][k] - factor * a[col][k];
|
|
35
|
+
b[row] = b[row] - factor * b[col];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const sol = Array.from({ length: n }, () => 0);
|
|
39
|
+
for (let row = n - 1; row >= 0; row -= 1) {
|
|
40
|
+
let sum = b[row];
|
|
41
|
+
for (let col = row + 1; col < n; col += 1) sum -= a[row][col] * sol[col];
|
|
42
|
+
const val = sum / a[row][row];
|
|
43
|
+
if (!Number.isFinite(val)) return void 0;
|
|
44
|
+
sol[row] = val;
|
|
45
|
+
}
|
|
46
|
+
return sol;
|
|
47
|
+
}
|
|
48
|
+
function fitLinearOls(points, fixedIntercept) {
|
|
49
|
+
const n = points.length;
|
|
50
|
+
if (fixedIntercept !== void 0) {
|
|
51
|
+
if (n < 1) return void 0;
|
|
52
|
+
let sumXX = 0;
|
|
53
|
+
let sumXY = 0;
|
|
54
|
+
for (const pt of points) {
|
|
55
|
+
sumXX += pt.x * pt.x;
|
|
56
|
+
sumXY += pt.x * (pt.y - fixedIntercept);
|
|
57
|
+
}
|
|
58
|
+
if (sumXX <= 1e-15) return void 0;
|
|
59
|
+
return {
|
|
60
|
+
slope: sumXY / sumXX,
|
|
61
|
+
intercept: fixedIntercept
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (n < 2) return void 0;
|
|
65
|
+
let sumX = 0;
|
|
66
|
+
let sumY = 0;
|
|
67
|
+
for (const pt of points) {
|
|
68
|
+
sumX += pt.x;
|
|
69
|
+
sumY += pt.y;
|
|
70
|
+
}
|
|
71
|
+
const meanX = sumX / n;
|
|
72
|
+
const meanY = sumY / n;
|
|
73
|
+
let sxx = 0;
|
|
74
|
+
let sxy = 0;
|
|
75
|
+
for (const pt of points) {
|
|
76
|
+
const dx = pt.x - meanX;
|
|
77
|
+
sxx += dx * dx;
|
|
78
|
+
sxy += dx * (pt.y - meanY);
|
|
79
|
+
}
|
|
80
|
+
if (sxx <= 1e-15) return void 0;
|
|
81
|
+
const slope = sxy / sxx;
|
|
82
|
+
return {
|
|
83
|
+
slope,
|
|
84
|
+
intercept: meanY - slope * meanX
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function computeRSquared(points, evalY) {
|
|
88
|
+
const n = points.length;
|
|
89
|
+
if (n === 0) return 1;
|
|
90
|
+
let sumY = 0;
|
|
91
|
+
for (const pt of points) sumY += pt.y;
|
|
92
|
+
const meanY = sumY / n;
|
|
93
|
+
let ssTot = 0;
|
|
94
|
+
let ssRes = 0;
|
|
95
|
+
for (const pt of points) {
|
|
96
|
+
const dy = pt.y - meanY;
|
|
97
|
+
ssTot += dy * dy;
|
|
98
|
+
const err = pt.y - evalY(pt.x);
|
|
99
|
+
ssRes += err * err;
|
|
100
|
+
}
|
|
101
|
+
if (ssTot <= 1e-15) return 1;
|
|
102
|
+
return Math.max(0, 1 - ssRes / ssTot);
|
|
103
|
+
}
|
|
104
|
+
function formatNum(value) {
|
|
105
|
+
const clean = Math.abs(value) < 1e-10 ? 0 : Number(value.toPrecision(4));
|
|
106
|
+
return String(clean);
|
|
107
|
+
}
|
|
108
|
+
function formatLinearTerm(slope, variable) {
|
|
109
|
+
return `${formatNum(slope)}${variable}`;
|
|
110
|
+
}
|
|
111
|
+
function formatSignedOffset(value) {
|
|
112
|
+
const clean = Math.abs(value) < 1e-10 ? 0 : value;
|
|
113
|
+
if (clean === 0) return "";
|
|
114
|
+
return clean > 0 ? ` + ${formatNum(clean)}` : ` - ${formatNum(-clean)}`;
|
|
115
|
+
}
|
|
116
|
+
function formatPolynomialEquation(coeffsX) {
|
|
117
|
+
const terms = [];
|
|
118
|
+
for (let p = coeffsX.length - 1; p >= 0; p -= 1) {
|
|
119
|
+
const c = coeffsX[p];
|
|
120
|
+
if (Math.abs(c) < 1e-10 && p > 0) continue;
|
|
121
|
+
if (p === 0 && Math.abs(c) < 1e-10 && terms.length > 0) continue;
|
|
122
|
+
const absStr = formatNum(Math.abs(c));
|
|
123
|
+
const varPart = p === 0 ? "" : p === 1 ? "x" : `x^${p}`;
|
|
124
|
+
if (terms.length === 0) terms.push(`${c < 0 ? "-" : ""}${absStr}${varPart}`);
|
|
125
|
+
else terms.push(`${c < 0 ? " - " : " + "}${absStr}${varPart}`);
|
|
126
|
+
}
|
|
127
|
+
return `y = ${terms.length > 0 ? terms.join("") : "0"}`;
|
|
128
|
+
}
|
|
129
|
+
function collectCategoryFitPoints(values) {
|
|
130
|
+
const pts = [];
|
|
131
|
+
for (let i = 0; i < values.length; i += 1) {
|
|
132
|
+
const y = values[i];
|
|
133
|
+
if (y !== null && y !== void 0 && Number.isFinite(y)) pts.push({
|
|
134
|
+
x: i + 1,
|
|
135
|
+
y
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return pts;
|
|
139
|
+
}
|
|
140
|
+
function collectScatterFitPoints(xs, ys) {
|
|
141
|
+
const pts = [];
|
|
142
|
+
const len = Math.min(xs.length, ys.length);
|
|
143
|
+
for (let i = 0; i < len; i += 1) {
|
|
144
|
+
const x = xs[i];
|
|
145
|
+
const y = ys[i];
|
|
146
|
+
if (x !== null && x !== void 0 && Number.isFinite(x) && y !== null && y !== void 0 && Number.isFinite(y)) pts.push({
|
|
147
|
+
x,
|
|
148
|
+
y
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
pts.sort((a, b) => a.x - b.x);
|
|
152
|
+
return pts;
|
|
153
|
+
}
|
|
154
|
+
function fitTrendline(points, trendline) {
|
|
155
|
+
if (points.length === 0) return void 0;
|
|
156
|
+
if (trendline.type === "movingAverage") {
|
|
157
|
+
const p = trendline.period;
|
|
158
|
+
if (points.length < p || p < 2) return void 0;
|
|
159
|
+
const sorted = [...points].sort((a, b) => a.x - b.x);
|
|
160
|
+
const out = [];
|
|
161
|
+
let windowSum = 0;
|
|
162
|
+
for (let i = 0; i < sorted.length; i += 1) {
|
|
163
|
+
windowSum += sorted[i].y;
|
|
164
|
+
if (i >= p) windowSum -= sorted[i - p].y;
|
|
165
|
+
if (i >= p - 1) out.push({
|
|
166
|
+
x: sorted[i].x,
|
|
167
|
+
y: windowSum / p
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
kind: "movingAverage",
|
|
172
|
+
points: out
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
let rawMinX = points[0].x;
|
|
176
|
+
let rawMaxX = points[0].x;
|
|
177
|
+
for (const pt of points) {
|
|
178
|
+
if (pt.x < rawMinX) rawMinX = pt.x;
|
|
179
|
+
if (pt.x > rawMaxX) rawMaxX = pt.x;
|
|
180
|
+
}
|
|
181
|
+
let xMin = rawMinX - (trendline.backward ?? 0);
|
|
182
|
+
const xMax = rawMaxX + (trendline.forward ?? 0);
|
|
183
|
+
switch (trendline.type) {
|
|
184
|
+
case "linear": {
|
|
185
|
+
const fit = fitLinearOls(points, trendline.intercept);
|
|
186
|
+
if (fit === void 0) return void 0;
|
|
187
|
+
const evalY = (x) => fit.slope * x + fit.intercept;
|
|
188
|
+
return {
|
|
189
|
+
kind: "curve",
|
|
190
|
+
xMin,
|
|
191
|
+
xMax,
|
|
192
|
+
evalY,
|
|
193
|
+
rSquared: computeRSquared(points, evalY),
|
|
194
|
+
equationText: `y = ${formatLinearTerm(fit.slope, "x")}${formatSignedOffset(fit.intercept)}`
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
case "exponential": {
|
|
198
|
+
if (points.some((pt) => pt.y <= 0)) return void 0;
|
|
199
|
+
if (trendline.intercept !== void 0 && trendline.intercept <= 0) return;
|
|
200
|
+
const fit = fitLinearOls(points.map((pt) => ({
|
|
201
|
+
x: pt.x,
|
|
202
|
+
y: Math.log(pt.y)
|
|
203
|
+
})), trendline.intercept !== void 0 ? Math.log(trendline.intercept) : void 0);
|
|
204
|
+
if (fit === void 0) return void 0;
|
|
205
|
+
const a = Math.exp(fit.intercept);
|
|
206
|
+
const b = fit.slope;
|
|
207
|
+
if (!Number.isFinite(a) || !Number.isFinite(b)) return void 0;
|
|
208
|
+
const evalY = (x) => a * Math.exp(b * x);
|
|
209
|
+
return {
|
|
210
|
+
kind: "curve",
|
|
211
|
+
xMin,
|
|
212
|
+
xMax,
|
|
213
|
+
evalY,
|
|
214
|
+
rSquared: computeRSquared(points, evalY),
|
|
215
|
+
equationText: `y = ${formatNum(a)}e^(${formatNum(b)}x)`
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
case "logarithmic": {
|
|
219
|
+
if (points.some((pt) => pt.x <= 0)) return void 0;
|
|
220
|
+
const fit = fitLinearOls(points.map((pt) => ({
|
|
221
|
+
x: Math.log(pt.x),
|
|
222
|
+
y: pt.y
|
|
223
|
+
})));
|
|
224
|
+
if (fit === void 0) return void 0;
|
|
225
|
+
xMin = Math.max(1e-6, xMin);
|
|
226
|
+
if (xMax <= xMin) return void 0;
|
|
227
|
+
const evalY = (x) => fit.slope * Math.log(Math.max(1e-12, x)) + fit.intercept;
|
|
228
|
+
return {
|
|
229
|
+
kind: "curve",
|
|
230
|
+
xMin,
|
|
231
|
+
xMax,
|
|
232
|
+
evalY,
|
|
233
|
+
rSquared: computeRSquared(points, evalY),
|
|
234
|
+
equationText: `y = ${formatNum(fit.slope)}ln(x)${formatSignedOffset(fit.intercept)}`
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
case "power": {
|
|
238
|
+
if (points.some((pt) => pt.x <= 0 || pt.y <= 0)) return void 0;
|
|
239
|
+
const fit = fitLinearOls(points.map((pt) => ({
|
|
240
|
+
x: Math.log(pt.x),
|
|
241
|
+
y: Math.log(pt.y)
|
|
242
|
+
})));
|
|
243
|
+
if (fit === void 0) return void 0;
|
|
244
|
+
const a = Math.exp(fit.intercept);
|
|
245
|
+
const b = fit.slope;
|
|
246
|
+
if (!Number.isFinite(a) || !Number.isFinite(b)) return void 0;
|
|
247
|
+
xMin = Math.max(1e-6, xMin);
|
|
248
|
+
if (xMax <= xMin) return void 0;
|
|
249
|
+
const evalY = (x) => a * Math.max(1e-12, x) ** b;
|
|
250
|
+
return {
|
|
251
|
+
kind: "curve",
|
|
252
|
+
xMin,
|
|
253
|
+
xMax,
|
|
254
|
+
evalY,
|
|
255
|
+
rSquared: computeRSquared(points, evalY),
|
|
256
|
+
equationText: `y = ${formatNum(a)}x^${formatNum(b)}`
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
case "polynomial": {
|
|
260
|
+
const k = trendline.order;
|
|
261
|
+
if (trendline.intercept !== void 0) {
|
|
262
|
+
const c0 = trendline.intercept;
|
|
263
|
+
if (points.length < k) return void 0;
|
|
264
|
+
let maxAbsX = 1;
|
|
265
|
+
for (const pt of points) maxAbsX = Math.max(maxAbsX, Math.abs(pt.x));
|
|
266
|
+
const mat = Array.from({ length: k }, () => Array.from({ length: k }, () => 0));
|
|
267
|
+
const rhs = Array.from({ length: k }, () => 0);
|
|
268
|
+
for (const pt of points) {
|
|
269
|
+
const u = pt.x / maxAbsX;
|
|
270
|
+
const resY = pt.y - c0;
|
|
271
|
+
const uPows = Array.from({ length: 2 * k + 1 }, () => 1);
|
|
272
|
+
for (let p = 1; p <= 2 * k; p += 1) uPows[p] = uPows[p - 1] * u;
|
|
273
|
+
for (let r = 0; r < k; r += 1) {
|
|
274
|
+
rhs[r] = rhs[r] + resY * uPows[r + 1];
|
|
275
|
+
for (let c = 0; c < k; c += 1) mat[r][c] = mat[r][c] + uPows[r + c + 2];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const sol = solveGaussianPartialPivoting(mat, rhs);
|
|
279
|
+
if (sol === void 0) return void 0;
|
|
280
|
+
const coeffsX = [c0];
|
|
281
|
+
for (let p = 1; p <= k; p += 1) coeffsX.push(sol[p - 1] / maxAbsX ** p);
|
|
282
|
+
const evalY = (x) => {
|
|
283
|
+
const u = x / maxAbsX;
|
|
284
|
+
let sum = c0;
|
|
285
|
+
let uPow = u;
|
|
286
|
+
for (let p = 0; p < k; p += 1) {
|
|
287
|
+
sum += sol[p] * uPow;
|
|
288
|
+
uPow *= u;
|
|
289
|
+
}
|
|
290
|
+
return sum;
|
|
291
|
+
};
|
|
292
|
+
return {
|
|
293
|
+
kind: "curve",
|
|
294
|
+
xMin,
|
|
295
|
+
xMax,
|
|
296
|
+
evalY,
|
|
297
|
+
rSquared: computeRSquared(points, evalY),
|
|
298
|
+
equationText: formatPolynomialEquation(coeffsX)
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
if (points.length < k + 1) return void 0;
|
|
302
|
+
let sumX = 0;
|
|
303
|
+
for (const pt of points) sumX += pt.x;
|
|
304
|
+
const meanX = sumX / points.length;
|
|
305
|
+
let scaleX = 1;
|
|
306
|
+
for (const pt of points) scaleX = Math.max(scaleX, Math.abs(pt.x - meanX));
|
|
307
|
+
const dim = k + 1;
|
|
308
|
+
const mat = Array.from({ length: dim }, () => Array.from({ length: dim }, () => 0));
|
|
309
|
+
const rhs = Array.from({ length: dim }, () => 0);
|
|
310
|
+
for (const pt of points) {
|
|
311
|
+
const u = (pt.x - meanX) / scaleX;
|
|
312
|
+
const uPows = Array.from({ length: 2 * k + 1 }, () => 1);
|
|
313
|
+
for (let p = 1; p <= 2 * k; p += 1) uPows[p] = uPows[p - 1] * u;
|
|
314
|
+
for (let r = 0; r < dim; r += 1) {
|
|
315
|
+
rhs[r] = rhs[r] + pt.y * uPows[r];
|
|
316
|
+
for (let c = 0; c < dim; c += 1) mat[r][c] = mat[r][c] + uPows[r + c];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const sol = solveGaussianPartialPivoting(mat, rhs);
|
|
320
|
+
if (sol === void 0) return void 0;
|
|
321
|
+
const coeffsX = Array.from({ length: dim }, () => 0);
|
|
322
|
+
for (let p = 0; p <= k; p += 1) {
|
|
323
|
+
const factor = sol[p] / scaleX ** p;
|
|
324
|
+
let binom = 1;
|
|
325
|
+
for (let j = 0; j <= p; j += 1) {
|
|
326
|
+
coeffsX[j] = coeffsX[j] + factor * binom * (-meanX) ** (p - j);
|
|
327
|
+
binom = binom * (p - j) / (j + 1);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
const evalY = (x) => {
|
|
331
|
+
const u = (x - meanX) / scaleX;
|
|
332
|
+
let sum = 0;
|
|
333
|
+
let uPow = 1;
|
|
334
|
+
for (let p = 0; p <= k; p += 1) {
|
|
335
|
+
sum += sol[p] * uPow;
|
|
336
|
+
uPow *= u;
|
|
337
|
+
}
|
|
338
|
+
return sum;
|
|
339
|
+
};
|
|
340
|
+
return {
|
|
341
|
+
kind: "curve",
|
|
342
|
+
xMin,
|
|
343
|
+
xMax,
|
|
344
|
+
evalY,
|
|
345
|
+
rSquared: computeRSquared(points, evalY),
|
|
346
|
+
equationText: formatPolynomialEquation(coeffsX)
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
default: return assertNever(trendline);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function categoryFitPositionToNormalized(catScale, oneBasedPos) {
|
|
353
|
+
const index = oneBasedPos - 1;
|
|
354
|
+
const rawT = catScale.crossBetween === "midCat" && catScale.count > 1 ? index / (catScale.count - 1) : (index + .5) / catScale.count;
|
|
355
|
+
return catScale.reversed ? 1 - rawT : rawT;
|
|
356
|
+
}
|
|
357
|
+
function renderSafeTrendlineText(options) {
|
|
358
|
+
for (const text of options.candidates) {
|
|
359
|
+
if (text === "") continue;
|
|
360
|
+
try {
|
|
361
|
+
return renderChartTextSvg({
|
|
362
|
+
text,
|
|
363
|
+
box: options.box,
|
|
364
|
+
style: options.style,
|
|
365
|
+
theme: options.theme,
|
|
366
|
+
slideNumber: options.slideNumber,
|
|
367
|
+
labelPath: options.labelPath,
|
|
368
|
+
align: "right",
|
|
369
|
+
verticalAlign: "middle",
|
|
370
|
+
wrap: false,
|
|
371
|
+
clipBox: options.clipBox,
|
|
372
|
+
clipAllocator: options.clipAllocator
|
|
373
|
+
});
|
|
374
|
+
} catch (error) {
|
|
375
|
+
if (error instanceof CapabilityError && error.code === "preview-missing-glyph") continue;
|
|
376
|
+
throw error;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return "";
|
|
380
|
+
}
|
|
381
|
+
function safeMeasureCandidate(options) {
|
|
382
|
+
for (const text of options.candidates) {
|
|
383
|
+
if (text === "") continue;
|
|
384
|
+
try {
|
|
385
|
+
const m = measureChartText({
|
|
386
|
+
text,
|
|
387
|
+
style: options.style,
|
|
388
|
+
theme: options.theme,
|
|
389
|
+
slideNumber: options.slideNumber,
|
|
390
|
+
labelPath: options.labelPath
|
|
391
|
+
});
|
|
392
|
+
return {
|
|
393
|
+
text,
|
|
394
|
+
width: m.width,
|
|
395
|
+
height: m.height
|
|
396
|
+
};
|
|
397
|
+
} catch (error) {
|
|
398
|
+
if (error instanceof CapabilityError && error.code === "preview-missing-glyph") continue;
|
|
399
|
+
throw error;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function renderTrendlinesSvg(options) {
|
|
404
|
+
const { parsed, scales, plotRect, chartBox, baseChartTextStyle, theme, slideNumber, clipAllocator } = options;
|
|
405
|
+
const lineParts = [];
|
|
406
|
+
const labelParts = [];
|
|
407
|
+
for (let groupIndex = 0; groupIndex < parsed.groups.length; groupIndex += 1) {
|
|
408
|
+
const group = parsed.groups[groupIndex];
|
|
409
|
+
if (group.kind === "pie" || group.kind === "doughnut") continue;
|
|
410
|
+
const seriesTargets = [];
|
|
411
|
+
if (group.kind === "scatter") {
|
|
412
|
+
const xScale = scales.get(group.axes.x.name);
|
|
413
|
+
const yScale = scales.get(group.axes.y.name);
|
|
414
|
+
if (xScale?.kind !== "value" || yScale?.kind !== "value") continue;
|
|
415
|
+
for (const series of group.series) {
|
|
416
|
+
if (series.trendlines === void 0 || series.trendlines.length === 0) continue;
|
|
417
|
+
seriesTargets.push({
|
|
418
|
+
seriesIndex: series.seriesIndex,
|
|
419
|
+
seriesColor: series.color,
|
|
420
|
+
trendlines: series.trendlines,
|
|
421
|
+
fitPoints: collectScatterFitPoints(series.x, series.y),
|
|
422
|
+
isLinearCartesian: false,
|
|
423
|
+
mapDataToScreen: (xVal, yVal) => {
|
|
424
|
+
if (!Number.isFinite(xVal) || !Number.isFinite(yVal) || xScale.logBase !== void 0 && xVal <= 0 || yScale.logBase !== void 0 && yVal <= 0) return;
|
|
425
|
+
return {
|
|
426
|
+
x: xScale.valueToScreen(xVal, plotRect),
|
|
427
|
+
y: yScale.valueToScreen(yVal, plotRect)
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
} else {
|
|
433
|
+
const catScale = scales.get(group.axes.category.name);
|
|
434
|
+
const valScale = scales.get(group.axes.value.name);
|
|
435
|
+
if (catScale?.kind !== "category" || valScale?.kind !== "value") continue;
|
|
436
|
+
const isHorizontalBar = group.kind === "bar";
|
|
437
|
+
const isLinearCartesian = valScale.logBase === void 0;
|
|
438
|
+
for (const series of group.series) {
|
|
439
|
+
if (series.trendlines === void 0 || series.trendlines.length === 0) continue;
|
|
440
|
+
seriesTargets.push({
|
|
441
|
+
seriesIndex: series.seriesIndex,
|
|
442
|
+
seriesColor: series.color,
|
|
443
|
+
trendlines: series.trendlines,
|
|
444
|
+
fitPoints: collectCategoryFitPoints(series.values),
|
|
445
|
+
isLinearCartesian,
|
|
446
|
+
mapDataToScreen: (xVal, yVal) => {
|
|
447
|
+
if (!Number.isFinite(xVal) || !Number.isFinite(yVal) || valScale.logBase !== void 0 && yVal <= 0) return;
|
|
448
|
+
const catScreen = catScale.mapScreen(categoryFitPositionToNormalized(catScale, xVal), plotRect);
|
|
449
|
+
const valScreen = valScale.valueToScreen(yVal, plotRect);
|
|
450
|
+
return isHorizontalBar ? {
|
|
451
|
+
x: valScreen,
|
|
452
|
+
y: catScreen
|
|
453
|
+
} : {
|
|
454
|
+
x: catScreen,
|
|
455
|
+
y: valScreen
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
for (const target of seriesTargets) for (const trendline of target.trendlines) {
|
|
462
|
+
const model = fitTrendline(target.fitPoints, trendline);
|
|
463
|
+
if (model === void 0) continue;
|
|
464
|
+
const stroke = resolveChartLineStroke(trendline.line, theme, {
|
|
465
|
+
color: target.seriesColor ?? `accent${target.seriesIndex % 6 + 1}`,
|
|
466
|
+
width: 1.5
|
|
467
|
+
});
|
|
468
|
+
if (stroke === void 0) continue;
|
|
469
|
+
const screenPts = [];
|
|
470
|
+
if (model.kind === "movingAverage") for (const pt of model.points) {
|
|
471
|
+
const mapped = target.mapDataToScreen(pt.x, pt.y);
|
|
472
|
+
if (mapped !== void 0) screenPts.push(mapped);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
const sampleCount = trendline.type === "linear" && target.isLinearCartesian ? 1 : 64;
|
|
476
|
+
for (let k = 0; k <= sampleCount; k += 1) {
|
|
477
|
+
const xVal = model.xMin + (model.xMax - model.xMin) * k / sampleCount;
|
|
478
|
+
const yVal = model.evalY(xVal);
|
|
479
|
+
const mapped = target.mapDataToScreen(xVal, yVal);
|
|
480
|
+
if (mapped !== void 0) screenPts.push(mapped);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (screenPts.length >= 2) {
|
|
484
|
+
const d = `M${screenPts[0].x} ${screenPts[0].y}` + screenPts.slice(1).map((p) => `L${p.x} ${p.y}`).join("");
|
|
485
|
+
lineParts.push(`<path d="${d}" fill="none" ${strokeAttrs(stroke)} stroke-linecap="round" stroke-linejoin="round"/>`);
|
|
486
|
+
}
|
|
487
|
+
if (model.kind === "curve" && (trendline.displayEquation === true || trendline.displayRSquared === true)) {
|
|
488
|
+
const anchorPt = screenPts[screenPts.length - 1];
|
|
489
|
+
if (anchorPt === void 0) continue;
|
|
490
|
+
const labelStyle = mergeChartTextStyle(baseChartTextStyle, { fontSize: Math.max(9, resolveChartFontSizePixels(baseChartTextStyle?.fontSize) * .85) });
|
|
491
|
+
const labelPath = `Chart.groups[${groupIndex}].trendline`;
|
|
492
|
+
const r2Val = formatNum(model.rSquared);
|
|
493
|
+
const lines = [];
|
|
494
|
+
if (trendline.displayEquation === true) lines.push({ candidates: [model.equationText] });
|
|
495
|
+
if (trendline.displayRSquared === true) lines.push({ candidates: [`R\u00B2 = ${r2Val}`, `R^2 = ${r2Val}`] });
|
|
496
|
+
const lineSpacing = resolveChartFontSizePixels(labelStyle?.fontSize) * 1.25;
|
|
497
|
+
let cursorY = Math.max(plotRect.y + 2, Math.min(plotRect.y + plotRect.height - lines.length * lineSpacing - 2, anchorPt.y - lines.length * lineSpacing - 4));
|
|
498
|
+
for (const lineSpec of lines) {
|
|
499
|
+
const measured = safeMeasureCandidate({
|
|
500
|
+
candidates: lineSpec.candidates,
|
|
501
|
+
style: labelStyle,
|
|
502
|
+
theme,
|
|
503
|
+
slideNumber,
|
|
504
|
+
labelPath
|
|
505
|
+
});
|
|
506
|
+
if (measured === void 0) continue;
|
|
507
|
+
const boxW = Math.max(20, measured.width + 4);
|
|
508
|
+
const boxX = Math.max(plotRect.x + 2, Math.min(plotRect.x + plotRect.width - boxW - 2, anchorPt.x - boxW));
|
|
509
|
+
const rendered = renderSafeTrendlineText({
|
|
510
|
+
candidates: [measured.text],
|
|
511
|
+
box: {
|
|
512
|
+
x: boxX,
|
|
513
|
+
y: cursorY,
|
|
514
|
+
width: boxW,
|
|
515
|
+
height: Math.max(measured.height, lineSpacing)
|
|
516
|
+
},
|
|
517
|
+
style: labelStyle,
|
|
518
|
+
theme,
|
|
519
|
+
slideNumber,
|
|
520
|
+
labelPath,
|
|
521
|
+
clipBox: chartBox,
|
|
522
|
+
clipAllocator
|
|
523
|
+
});
|
|
524
|
+
if (rendered !== "") {
|
|
525
|
+
labelParts.push(rendered);
|
|
526
|
+
cursorY += lineSpacing;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return {
|
|
533
|
+
linesSvg: lineParts.join(""),
|
|
534
|
+
labelsSvg: labelParts.join("")
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
export { collectCategoryFitPoints, collectScatterFitPoints, fitTrendline, renderTrendlinesSvg };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { defineSlideLayout as defineSlideLayout$1 } from "../../core/dist/masters.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { CommonNode, createDeckNode, createSectionNode, createSlideLayoutNode, createSlideMasterNode, createSlideNode } from "../../core/dist/document.js";
|
|
4
|
+
import { createBoxNode } from "./box/box-declaration.js";
|
|
5
|
+
import { createChartNode } from "./chart/chart-declaration.js";
|
|
6
|
+
import { font } from "./font/font.js";
|
|
7
|
+
import { createGroupNode } from "./group/group-declaration.js";
|
|
8
|
+
import { createImageNode } from "./image/image-declaration.js";
|
|
9
|
+
import { after, breathe, createMotionScopeHandle, createMotionScopeNode, createMotionStepIdentity, createMotionStepNode, fade, fillColor, floatDown, floatUp, fly, repeat, spin, spinIn, stretch, wipe, zoom } from "./motion/motion-api.js";
|
|
10
|
+
import { createNotesNode } from "./notes/notes-declaration.js";
|
|
11
|
+
import { createPlaceholderNode } from "./placeholder/placeholder.js";
|
|
12
|
+
import { createShapeNode } from "./shape/shape-declaration.js";
|
|
13
|
+
import { observeMotion } from "./motion/motion-query.js";
|
|
14
|
+
import { createCellNode, createRowNode, createTableNode } from "./table/table-declaration.js";
|
|
15
|
+
import { createParagraphNode, createSlideNumberNode, createSpanNode, createTextNode } from "./text/text-declaration.js";
|
|
16
|
+
import { transitions } from "./transition/transition-api.js";
|
|
17
|
+
import { blockArc, path, preset } from "./shared/geometry.js";
|
|
18
|
+
import { linearGradient, radialGradient } from "./shared/visual.js";
|
|
19
|
+
// ../capabilities/dist/document.js
|
|
20
|
+
/** Narrowed `defineSlideLayout` wrapper enforcing capability-typed `transition` declarations. */
|
|
21
|
+
function defineSlideLayout(spec) {
|
|
22
|
+
return defineSlideLayout$1(spec);
|
|
23
|
+
}
|
|
24
|
+
function isPropsRecord(value) {
|
|
25
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
26
|
+
if (value instanceof CommonNode) return false;
|
|
27
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
28
|
+
}
|
|
29
|
+
function splitContent(args) {
|
|
30
|
+
const last = args.at(-1);
|
|
31
|
+
const hasProps = isPropsRecord(last);
|
|
32
|
+
return {
|
|
33
|
+
content: (hasProps ? args.slice(0, -1) : args).flatMap((value) => value === void 0 ? [] : Array.isArray(value) ? value : [value]),
|
|
34
|
+
props: hasProps ? last : void 0
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function deck(props = {}) {
|
|
38
|
+
return createDeckNode(props);
|
|
39
|
+
}
|
|
40
|
+
/** Creates an editable native SlideMaster container owning SlideLayouts. */
|
|
41
|
+
function slideMaster(props = {}) {
|
|
42
|
+
return createSlideMasterNode(props);
|
|
43
|
+
}
|
|
44
|
+
/** Creates an editable native SlideLayout node from inline props or a `defineSlideLayout` spec. */
|
|
45
|
+
function slideLayout(propsOrDefinition = {}) {
|
|
46
|
+
return createSlideLayoutNode(propsOrDefinition);
|
|
47
|
+
}
|
|
48
|
+
function slide(props) {
|
|
49
|
+
const { placeholders, ...rest } = props;
|
|
50
|
+
const entries = placeholders === void 0 ? [] : Object.entries(placeholders).filter(([, value]) => value !== void 0);
|
|
51
|
+
const keepEmptyPlaceholders = placeholders !== void 0 && props.layout === void 0 && entries.length === 0;
|
|
52
|
+
const node = createSlideNode(keepEmptyPlaceholders ? {
|
|
53
|
+
...rest,
|
|
54
|
+
placeholders
|
|
55
|
+
} : rest);
|
|
56
|
+
for (const [key, value] of entries) if (typeof value === "string" || Array.isArray(value)) node.append(text(value, { placeholder: key }));
|
|
57
|
+
else if (value instanceof CommonNode) {
|
|
58
|
+
if (value.type === "paragraph" || value.type === "span" || value.type === "slide-number") node.append(text(value, { placeholder: key }));
|
|
59
|
+
else {
|
|
60
|
+
value.set({ placeholder: key });
|
|
61
|
+
node.append(value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return node;
|
|
65
|
+
}
|
|
66
|
+
function section(props) {
|
|
67
|
+
return createSectionNode(props);
|
|
68
|
+
}
|
|
69
|
+
function box(props = {}) {
|
|
70
|
+
return createBoxNode(props);
|
|
71
|
+
}
|
|
72
|
+
/** Creates a native shape whose geometry, visuals, and rich text remain editable after attachment. */
|
|
73
|
+
function shape(props = {}) {
|
|
74
|
+
return createShapeNode(props);
|
|
75
|
+
}
|
|
76
|
+
/** Creates an unpopulated native content placeholder bound to a layout placeholder slot. */
|
|
77
|
+
function placeholder(props = {}) {
|
|
78
|
+
return createPlaceholderNode(props);
|
|
79
|
+
}
|
|
80
|
+
/** Creates a native image whose source bytes, crop, fit, and visuals remain editable after attachment. */
|
|
81
|
+
function image(props) {
|
|
82
|
+
return createImageNode(props);
|
|
83
|
+
}
|
|
84
|
+
/** Creates a native group preserving member identity, local theme, and layout children. */
|
|
85
|
+
function group(props = {}) {
|
|
86
|
+
return createGroupNode(props);
|
|
87
|
+
}
|
|
88
|
+
/** Creates a native table whose rows and cells remain editable after attachment. */
|
|
89
|
+
function table(props) {
|
|
90
|
+
return createTableNode(props);
|
|
91
|
+
}
|
|
92
|
+
/** Creates a native table row; attach it to a table and add cells through its content operations. */
|
|
93
|
+
function row(props = {}) {
|
|
94
|
+
return createRowNode(props);
|
|
95
|
+
}
|
|
96
|
+
function cell(...args) {
|
|
97
|
+
const { content, props } = splitContent(args);
|
|
98
|
+
const node = createCellNode(props ?? {});
|
|
99
|
+
node.content(...content);
|
|
100
|
+
return node;
|
|
101
|
+
}
|
|
102
|
+
/** Creates a native chart whose data, options, and styles remain editable after attachment. */
|
|
103
|
+
function chart(props) {
|
|
104
|
+
return createChartNode(props);
|
|
105
|
+
}
|
|
106
|
+
function text(...args) {
|
|
107
|
+
const { content, props } = splitContent(args);
|
|
108
|
+
const node = createTextNode(props ?? {});
|
|
109
|
+
node.content(...content);
|
|
110
|
+
return node;
|
|
111
|
+
}
|
|
112
|
+
function notes(...args) {
|
|
113
|
+
const { content, props } = splitContent(args);
|
|
114
|
+
const node = createNotesNode(props ?? {});
|
|
115
|
+
node.content(...content);
|
|
116
|
+
return node;
|
|
117
|
+
}
|
|
118
|
+
function paragraph(...args) {
|
|
119
|
+
const { content, props } = splitContent(args);
|
|
120
|
+
const node = createParagraphNode(props ?? {});
|
|
121
|
+
node.content(...content);
|
|
122
|
+
return node;
|
|
123
|
+
}
|
|
124
|
+
function span(...args) {
|
|
125
|
+
const { content, props } = splitContent(args);
|
|
126
|
+
const node = createSpanNode(props ?? {});
|
|
127
|
+
node.content(...content);
|
|
128
|
+
return node;
|
|
129
|
+
}
|
|
130
|
+
/** Emits the native slide number field, resolved by the presentation application. */
|
|
131
|
+
function slideNumber(props = {}) {
|
|
132
|
+
return createSlideNumberNode(props);
|
|
133
|
+
}
|
|
134
|
+
/** Creates an orchestration scope whose parent chain and click step are derived by each build. */
|
|
135
|
+
function motionScope(scope, props = {}) {
|
|
136
|
+
return createMotionScopeNode({
|
|
137
|
+
...props,
|
|
138
|
+
scope
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/** Creates a click-step container; omitted n gives this Step its own independent trigger. */
|
|
142
|
+
function step(props = {}) {
|
|
143
|
+
return createMotionStepNode({
|
|
144
|
+
...props,
|
|
145
|
+
stepIdentity: createMotionStepIdentity()
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
export { after, blockArc, box, breathe, cell, chart, createMotionScopeHandle, deck, defineSlideLayout, fade, fillColor, floatDown, floatUp, fly, font, group, image, linearGradient, motionScope, notes, observeMotion, paragraph, path, placeholder, preset, radialGradient, repeat, row, section, shape, slide, slideLayout, slideMaster, slideNumber, span, spin, spinIn, step, stretch, table, text, transitions, wipe, zoom };
|