@json-to-office/core-pptx 1.3.0 → 1.4.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +159 -173
- package/dist/index.js.map +1 -1
- package/dist/ir/compiler.d.ts.map +1 -1
- package/dist/renderers/office-open/index.d.ts.map +1 -1
- package/dist/renderers/pptxgenjs/index.d.ts.map +1 -1
- package/dist/renderers/registry.d.ts +18 -4
- package/dist/renderers/registry.d.ts.map +1 -1
- package/dist/themes/defaults.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/warn.d.ts +1 -0
- package/dist/utils/warn.d.ts.map +1 -1
- package/package.json +6 -14
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { generateBufferFromJson, generateBufferWithWarnings, generateAndSaveFrom
|
|
|
3
3
|
export type { GenerationOptions, GenerationResult, GenerationValidationOptions, } from './core/generator';
|
|
4
4
|
export type { PptxRendererId } from './renderers/types';
|
|
5
5
|
export { DEFAULT_PPTX_RENDERER_ID } from './renderers/types';
|
|
6
|
-
export { isPptxRendererId, pptxRendererIds } from './renderers/registry';
|
|
6
|
+
export { isPptxRendererId, pptxRendererIds, pptxRendererStatuses, } from './renderers/registry';
|
|
7
7
|
export { UncompiledComponentError } from './core/generateFromIr';
|
|
8
8
|
export { DEFAULT_GENERATED_AT } from './core/finalizePackage';
|
|
9
9
|
export type { PresentationPackagingOptions } from './core/finalizePackage';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAGD,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,iCAAiC,EACjC,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAGD,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,iCAAiC,EACjC,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAG3E,YAAY,EACV,kBAAkB,EAClB,+BAA+B,EAC/B,kCAAkC,EAClC,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGpE,OAAO,EAAE,CAAC,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGxE,OAAO,EACL,eAAe,EACf,aAAa,EACb,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,gCAAgC,EAChC,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,4BAA4B,EAC5B,qBAAqB,IAAI,2BAA2B,EACpD,4BAA4B,EAC5B,sBAAsB,IAAI,4BAA4B,EACtD,oBAAoB,IAAI,0BAA0B,EAClD,mBAAmB,IAAI,yBAAyB,EAChD,eAAe,IAAI,qBAAqB,EACxC,2BAA2B,IAAI,iCAAiC,EAChE,gBAAgB,IAAI,sBAAsB,EAC1C,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,IAAI,qBAAqB,GACzC,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ var init_warn = __esm({
|
|
|
39
39
|
UNKNOWN_COLOR: "UNKNOWN_COLOR",
|
|
40
40
|
GRID_POSITION_CLAMPED: "GRID_POSITION_CLAMPED",
|
|
41
41
|
TEXT_NO_CONTENT: "TEXT_NO_CONTENT",
|
|
42
|
+
TEXT_OVERLAP_UNPOSITIONED: "TEXT_OVERLAP_UNPOSITIONED",
|
|
42
43
|
UNKNOWN_PATTERN_PRESET: "UNKNOWN_PATTERN_PRESET",
|
|
43
44
|
ADVANCED_FILL_FALLBACK: "ADVANCED_FILL_FALLBACK",
|
|
44
45
|
IMAGE_ZERO_BOX: "IMAGE_ZERO_BOX",
|
|
@@ -122,147 +123,6 @@ var init_units = __esm({
|
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
125
|
|
|
125
|
-
// src/ir/features.ts
|
|
126
|
-
var PPTX_FEATURES, ALL_PPTX_FEATURES;
|
|
127
|
-
var init_features = __esm({
|
|
128
|
-
"src/ir/features.ts"() {
|
|
129
|
-
"use strict";
|
|
130
|
-
PPTX_FEATURES = [
|
|
131
|
-
/** Slide masters compiled from authored templates. */
|
|
132
|
-
"masters",
|
|
133
|
-
/** Named placeholder regions declared by a master. */
|
|
134
|
-
"placeholders",
|
|
135
|
-
/** Multiple independently-formatted runs inside one text body. */
|
|
136
|
-
"rich-text",
|
|
137
|
-
/**
|
|
138
|
-
* Bullet glyphs outside PptxGenJS's single-BMP-character API: astral
|
|
139
|
-
* characters and multi-code-point graphemes.
|
|
140
|
-
*/
|
|
141
|
-
"complex-bullet-glyphs",
|
|
142
|
-
/** Text bodies at all (a single run, uniform formatting). */
|
|
143
|
-
"text",
|
|
144
|
-
/** Preset-geometry shapes. */
|
|
145
|
-
"shapes",
|
|
146
|
-
/** Raster and vector images. */
|
|
147
|
-
"images",
|
|
148
|
-
/** SVG images specifically — many backends need a raster fallback. */
|
|
149
|
-
"svg",
|
|
150
|
-
/**
|
|
151
|
-
* Drawing only part of a picture: `cover`, `crop`, or a `contain` fit the
|
|
152
|
-
* compiler could not resolve into the frame.
|
|
153
|
-
*
|
|
154
|
-
* A backend without it draws the whole picture into the frame, which is a
|
|
155
|
-
* different image — the wrong region at the wrong scale — with nothing to
|
|
156
|
-
* show that anything was lost.
|
|
157
|
-
*/
|
|
158
|
-
"image-crop",
|
|
159
|
-
/** Masking a picture to rounded corners or a circle. */
|
|
160
|
-
"image-rounding",
|
|
161
|
-
"tables",
|
|
162
|
-
/** Merged table cells (colSpan / rowSpan). */
|
|
163
|
-
"table-merged-cells",
|
|
164
|
-
/**
|
|
165
|
-
* Cell insets on a table.
|
|
166
|
-
*
|
|
167
|
-
* Separate from the inset on a text body: a reader takes a cell's padding
|
|
168
|
-
* from `a:tcPr`, and a backend that can only write text-body insets puts the
|
|
169
|
-
* numbers somewhere nothing reads them.
|
|
170
|
-
*/
|
|
171
|
-
"table-insets",
|
|
172
|
-
/**
|
|
173
|
-
* Rounded table corners.
|
|
174
|
-
*
|
|
175
|
-
* A separate ability because OOXML has no such property: a backend realises
|
|
176
|
-
* it by drawing shapes behind the table, or it cannot realise it at all.
|
|
177
|
-
*/
|
|
178
|
-
"table-rounded-corners",
|
|
179
|
-
/**
|
|
180
|
-
* Flowing an over-long table onto further slides, header row included.
|
|
181
|
-
*
|
|
182
|
-
* Pagination is the backend's, not the IR's — the IR describes one table and
|
|
183
|
-
* says it may split, so a backend that cannot split has to refuse rather than
|
|
184
|
-
* emit a table running off the slide.
|
|
185
|
-
*/
|
|
186
|
-
"table-auto-page",
|
|
187
|
-
/** Native OOXML charts with an embedded workbook. */
|
|
188
|
-
"charts",
|
|
189
|
-
/*
|
|
190
|
-
* Chart styling, split finer than `charts` itself.
|
|
191
|
-
*
|
|
192
|
-
* `charts` says a backend can draw a chart from data. It says nothing about
|
|
193
|
-
* whether that backend honours the options the author styled it with, and one
|
|
194
|
-
* coarse feature let a renderer accept a chart, draw it, and quietly ignore
|
|
195
|
-
* half of what was asked for — an ignored axis maximum draws a different
|
|
196
|
-
* chart from the authored one and the file says nothing about it.
|
|
197
|
-
*
|
|
198
|
-
* Each name below is required by the compiler *only when the matching prop
|
|
199
|
-
* was authored*, at that prop's own path, so a default never demands a
|
|
200
|
-
* capability and a refusal always names the line that caused it.
|
|
201
|
-
*/
|
|
202
|
-
/** `barGapWidthPct`, `barOverlapPct`. */
|
|
203
|
-
"chart-bar-style",
|
|
204
|
-
/** `firstSliceAng`, `holeSize`. */
|
|
205
|
-
"chart-pie-style",
|
|
206
|
-
/** `lineSmooth`, `lineDataSymbol`, `lineSize`, `lineDataSymbolSize`. */
|
|
207
|
-
"chart-line-style",
|
|
208
|
-
/** `radarStyle` — anything but the `standard` a backend may hardcode. */
|
|
209
|
-
"chart-radar-style",
|
|
210
|
-
/** `showValue`, `showPercent`, `showLabel`, `showSerName`, `dataLabelPosition`. */
|
|
211
|
-
"chart-data-labels",
|
|
212
|
-
/** `dataBorder`: an outline on bars, slices and areas. */
|
|
213
|
-
"chart-data-border",
|
|
214
|
-
/** Value-axis bounds and number format: min, max, major unit, format code. */
|
|
215
|
-
"chart-axis-scale",
|
|
216
|
-
/** Hiding an axis or its line. */
|
|
217
|
-
"chart-axis-visibility",
|
|
218
|
-
/** Axis label rotation and grid lines. */
|
|
219
|
-
"chart-axis-style",
|
|
220
|
-
/** Font family, size, weight and colour on any chart text. */
|
|
221
|
-
"chart-text-style",
|
|
222
|
-
"solid-fills",
|
|
223
|
-
"gradient-fills",
|
|
224
|
-
"pattern-fills",
|
|
225
|
-
"image-fills",
|
|
226
|
-
"lines",
|
|
227
|
-
"shadows",
|
|
228
|
-
/** Slide backgrounds (solid or image). */
|
|
229
|
-
"backgrounds",
|
|
230
|
-
"speaker-notes",
|
|
231
|
-
"hidden-slides",
|
|
232
|
-
"transitions",
|
|
233
|
-
/** Hyperlinks to an external URL. */
|
|
234
|
-
"external-links",
|
|
235
|
-
/** Hyperlinks targeting another slide in the same deck. */
|
|
236
|
-
"internal-links",
|
|
237
|
-
/** A link covering a text body — realisable on the runs inside it. */
|
|
238
|
-
"text-hyperlinks",
|
|
239
|
-
/** A link on a shape or image as a whole, which runs cannot stand in for. */
|
|
240
|
-
"element-hyperlinks",
|
|
241
|
-
/** Rotation on a shape, text box or table. */
|
|
242
|
-
"rotation",
|
|
243
|
-
/**
|
|
244
|
-
* Any transform on a picture — rotation or flip.
|
|
245
|
-
*
|
|
246
|
-
* One feature rather than three: a backend that cannot rotate a picture
|
|
247
|
-
* generally cannot flip one either, because the option carrying both is
|
|
248
|
-
* simply absent from its picture type.
|
|
249
|
-
*/
|
|
250
|
-
"image-transform",
|
|
251
|
-
"flip-horizontal",
|
|
252
|
-
"flip-vertical",
|
|
253
|
-
/** Grouped elements sharing a transform. */
|
|
254
|
-
"groups",
|
|
255
|
-
/** Per-run proofing language. */
|
|
256
|
-
"proofing-language",
|
|
257
|
-
/** Right-to-left reading order. */
|
|
258
|
-
"rtl"
|
|
259
|
-
];
|
|
260
|
-
ALL_PPTX_FEATURES = new Set(
|
|
261
|
-
PPTX_FEATURES
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
|
|
266
126
|
// src/renderers/pptxgenjs/fills.ts
|
|
267
127
|
function colorXml(color2) {
|
|
268
128
|
const alpha = color2.transparency !== void 0 ? `<a:alpha val="${Math.round((100 - color2.transparency) * PCT_UNIT)}"/>` : "";
|
|
@@ -1363,16 +1223,55 @@ var PPTXGENJS_RENDERER_ID, PPTXGENJS_CAPABILITIES;
|
|
|
1363
1223
|
var init_pptxgenjs = __esm({
|
|
1364
1224
|
"src/renderers/pptxgenjs/index.ts"() {
|
|
1365
1225
|
"use strict";
|
|
1366
|
-
init_features();
|
|
1367
1226
|
init_units();
|
|
1368
1227
|
init_emit();
|
|
1369
1228
|
init_packaging();
|
|
1370
1229
|
PPTXGENJS_RENDERER_ID = "pptxgenjs";
|
|
1371
|
-
PPTXGENJS_CAPABILITIES = new Set(
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1230
|
+
PPTXGENJS_CAPABILITIES = /* @__PURE__ */ new Set([
|
|
1231
|
+
"masters",
|
|
1232
|
+
"placeholders",
|
|
1233
|
+
"rich-text",
|
|
1234
|
+
"text",
|
|
1235
|
+
"shapes",
|
|
1236
|
+
"images",
|
|
1237
|
+
"svg",
|
|
1238
|
+
"image-crop",
|
|
1239
|
+
"image-rounding",
|
|
1240
|
+
"tables",
|
|
1241
|
+
"table-merged-cells",
|
|
1242
|
+
"table-insets",
|
|
1243
|
+
"table-rounded-corners",
|
|
1244
|
+
"table-auto-page",
|
|
1245
|
+
"charts",
|
|
1246
|
+
"chart-bar-style",
|
|
1247
|
+
"chart-pie-style",
|
|
1248
|
+
"chart-line-style",
|
|
1249
|
+
"chart-radar-style",
|
|
1250
|
+
"chart-data-labels",
|
|
1251
|
+
"chart-data-border",
|
|
1252
|
+
"chart-axis-scale",
|
|
1253
|
+
"chart-axis-visibility",
|
|
1254
|
+
"chart-axis-style",
|
|
1255
|
+
"chart-text-style",
|
|
1256
|
+
"solid-fills",
|
|
1257
|
+
"gradient-fills",
|
|
1258
|
+
"pattern-fills",
|
|
1259
|
+
"lines",
|
|
1260
|
+
"shadows",
|
|
1261
|
+
"backgrounds",
|
|
1262
|
+
"speaker-notes",
|
|
1263
|
+
"hidden-slides",
|
|
1264
|
+
"external-links",
|
|
1265
|
+
"internal-links",
|
|
1266
|
+
"text-hyperlinks",
|
|
1267
|
+
"element-hyperlinks",
|
|
1268
|
+
"rotation",
|
|
1269
|
+
"image-transform",
|
|
1270
|
+
"flip-horizontal",
|
|
1271
|
+
"flip-vertical",
|
|
1272
|
+
"proofing-language",
|
|
1273
|
+
"rtl"
|
|
1274
|
+
]);
|
|
1376
1275
|
}
|
|
1377
1276
|
});
|
|
1378
1277
|
|
|
@@ -2150,33 +2049,52 @@ async function loadResourceBytes(resources) {
|
|
|
2150
2049
|
);
|
|
2151
2050
|
return new Map(entries);
|
|
2152
2051
|
}
|
|
2153
|
-
var OFFICE_OPEN_PPTX_RENDERER_ID, OFFICE_OPEN_PPTX,
|
|
2052
|
+
var OFFICE_OPEN_PPTX_RENDERER_ID, OFFICE_OPEN_PPTX, OFFICE_OPEN_CAPABILITIES, SCHEME_SLOTS;
|
|
2154
2053
|
var init_office_open = __esm({
|
|
2155
2054
|
"src/renderers/office-open/index.ts"() {
|
|
2156
2055
|
"use strict";
|
|
2157
2056
|
init_finalizePackage();
|
|
2158
2057
|
init_chartParts();
|
|
2159
|
-
init_features();
|
|
2160
2058
|
init_emit2();
|
|
2161
2059
|
OFFICE_OPEN_PPTX_RENDERER_ID = "office-open";
|
|
2162
2060
|
OFFICE_OPEN_PPTX = "@office-open/pptx";
|
|
2163
|
-
|
|
2164
|
-
"
|
|
2165
|
-
"
|
|
2166
|
-
"
|
|
2167
|
-
"
|
|
2168
|
-
"
|
|
2169
|
-
"
|
|
2170
|
-
"
|
|
2171
|
-
"
|
|
2172
|
-
"
|
|
2173
|
-
"
|
|
2174
|
-
"
|
|
2175
|
-
"
|
|
2061
|
+
OFFICE_OPEN_CAPABILITIES = /* @__PURE__ */ new Set([
|
|
2062
|
+
"rich-text",
|
|
2063
|
+
"complex-bullet-glyphs",
|
|
2064
|
+
"text",
|
|
2065
|
+
"shapes",
|
|
2066
|
+
"images",
|
|
2067
|
+
"tables",
|
|
2068
|
+
"charts",
|
|
2069
|
+
"chart-bar-style",
|
|
2070
|
+
"chart-pie-style",
|
|
2071
|
+
"chart-line-style",
|
|
2072
|
+
"chart-radar-style",
|
|
2073
|
+
"chart-data-labels",
|
|
2074
|
+
"chart-data-border",
|
|
2075
|
+
"chart-axis-scale",
|
|
2076
|
+
"chart-axis-visibility",
|
|
2077
|
+
"chart-axis-style",
|
|
2078
|
+
"chart-text-style",
|
|
2079
|
+
"solid-fills",
|
|
2080
|
+
"gradient-fills",
|
|
2081
|
+
"pattern-fills",
|
|
2082
|
+
"image-fills",
|
|
2083
|
+
"lines",
|
|
2084
|
+
"shadows",
|
|
2085
|
+
"backgrounds",
|
|
2086
|
+
"speaker-notes",
|
|
2087
|
+
"hidden-slides",
|
|
2088
|
+
"transitions",
|
|
2089
|
+
"external-links",
|
|
2090
|
+
"internal-links",
|
|
2091
|
+
"text-hyperlinks",
|
|
2092
|
+
"rotation",
|
|
2093
|
+
"flip-horizontal",
|
|
2094
|
+
"groups",
|
|
2095
|
+
"proofing-language",
|
|
2096
|
+
"rtl"
|
|
2176
2097
|
]);
|
|
2177
|
-
OFFICE_OPEN_CAPABILITIES = new Set(
|
|
2178
|
-
[...ALL_PPTX_FEATURES].filter((feature) => !UNSUPPORTED.has(feature))
|
|
2179
|
-
);
|
|
2180
2098
|
SCHEME_SLOTS = [
|
|
2181
2099
|
["dark1", "text"],
|
|
2182
2100
|
["light1", "background"],
|
|
@@ -2673,7 +2591,8 @@ function compilePresentation(processed, warnings = []) {
|
|
|
2673
2591
|
extent: {
|
|
2674
2592
|
widthEmu: inchesToEmu(processed.slideWidth),
|
|
2675
2593
|
heightEmu: inchesToEmu(processed.slideHeight)
|
|
2676
|
-
}
|
|
2594
|
+
},
|
|
2595
|
+
positionlessText: []
|
|
2677
2596
|
};
|
|
2678
2597
|
const masters = (processed.templates ?? []).map(
|
|
2679
2598
|
(template, index) => compileMaster(template, index, processed, ctx)
|
|
@@ -2782,6 +2701,7 @@ function compileSlide(slide, slideIndex, processed, ctx) {
|
|
|
2782
2701
|
if (element) elements.push(element);
|
|
2783
2702
|
nextIndex += 1;
|
|
2784
2703
|
};
|
|
2704
|
+
ctx.positionlessText = [];
|
|
2785
2705
|
const gradientSource = slide.background?.gradient ?? (slide.background ? void 0 : template?.background?.gradient);
|
|
2786
2706
|
let background2;
|
|
2787
2707
|
if (gradientSource) {
|
|
@@ -2855,6 +2775,7 @@ function compileSlide(slide, slideIndex, processed, ctx) {
|
|
|
2855
2775
|
})
|
|
2856
2776
|
);
|
|
2857
2777
|
}
|
|
2778
|
+
warnOverlappingText(slideIndex, ctx);
|
|
2858
2779
|
if (slide.notes) ctx.features.require("speaker-notes", `${path4}.notes`);
|
|
2859
2780
|
if (slide.hidden) ctx.features.require("hidden-slides", `${path4}.hidden`);
|
|
2860
2781
|
if (background2) ctx.features.require("backgrounds", `${path4}.background`);
|
|
@@ -2871,6 +2792,23 @@ function compileSlide(slide, slideIndex, processed, ctx) {
|
|
|
2871
2792
|
...transition ? { transition } : {}
|
|
2872
2793
|
};
|
|
2873
2794
|
}
|
|
2795
|
+
function warnOverlappingText(slideIndex, ctx) {
|
|
2796
|
+
const boxes = ctx.positionlessText;
|
|
2797
|
+
for (let i = 0; i < boxes.length; i += 1) {
|
|
2798
|
+
for (let j = i + 1; j < boxes.length; j += 1) {
|
|
2799
|
+
const a = boxes[i];
|
|
2800
|
+
const b = boxes[j];
|
|
2801
|
+
const overlaps = a.transform.xEmu < b.transform.xEmu + b.transform.widthEmu && b.transform.xEmu < a.transform.xEmu + a.transform.widthEmu && a.transform.yEmu < b.transform.yEmu + b.transform.heightEmu && b.transform.yEmu < a.transform.yEmu + a.transform.heightEmu;
|
|
2802
|
+
if (!overlaps) continue;
|
|
2803
|
+
warn(
|
|
2804
|
+
ctx.warnings,
|
|
2805
|
+
W.TEXT_OVERLAP_UNPOSITIONED,
|
|
2806
|
+
`Text at ${a.path} and ${b.path} give no x/y and overlap on this slide. Give at least one of them explicit coordinates, or a named style whose default band differs.`,
|
|
2807
|
+
{ slide: slideIndex, component: "text" }
|
|
2808
|
+
);
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2874
2812
|
function compileTransition(transition) {
|
|
2875
2813
|
const type = transition?.type;
|
|
2876
2814
|
if (!type || type === "none") return void 0;
|
|
@@ -3005,6 +2943,9 @@ function compileText(component, scope) {
|
|
|
3005
2943
|
const heightFontSize = props.fontSize ?? ctx.theme.defaults.fontSize ?? 18;
|
|
3006
2944
|
const transform = textTransform(props, heightFontSize, lineCount, ctx);
|
|
3007
2945
|
const autoFit = props.h === void 0;
|
|
2946
|
+
if (props.x === void 0 && props.y === void 0) {
|
|
2947
|
+
ctx.positionlessText.push({ path: path4, transform });
|
|
2948
|
+
}
|
|
3008
2949
|
const hyperlink2 = compileHyperlink(props.hyperlink, "text", ctx, path4);
|
|
3009
2950
|
const runs = runProps ? runProps.map(
|
|
3010
2951
|
(run) => compileRichRun(run, cascade, void 0, scope.slideCtx, ctx)
|
|
@@ -3210,12 +3151,26 @@ function requireBulletFeatures(bullet, path4, ctx) {
|
|
|
3210
3151
|
ctx.features.require("complex-bullet-glyphs", `${path4}.bullet.style`);
|
|
3211
3152
|
}
|
|
3212
3153
|
}
|
|
3154
|
+
var STYLE_BANDS = {
|
|
3155
|
+
// A title slide's title and its subtitle, as two bands in the middle third.
|
|
3156
|
+
title: { x: 0.08, y: 0.34, w: 0.84 },
|
|
3157
|
+
subtitle: { x: 0.08, y: 0.56, w: 0.84 },
|
|
3158
|
+
// Content-slide headings sit in the top margin, all three at the same place:
|
|
3159
|
+
// the level changes the type, not where the slide starts.
|
|
3160
|
+
heading1: { x: 0.06, y: 0.06, w: 0.88 },
|
|
3161
|
+
heading2: { x: 0.06, y: 0.06, w: 0.88 },
|
|
3162
|
+
heading3: { x: 0.06, y: 0.06, w: 0.88 },
|
|
3163
|
+
// Below a heading, in the content-safe area.
|
|
3164
|
+
body: { x: 0.06, y: 0.26, w: 0.88 },
|
|
3165
|
+
caption: { x: 0.06, y: 0.88, w: 0.88 }
|
|
3166
|
+
};
|
|
3213
3167
|
function textTransform(props, fontSize, lineCount, ctx) {
|
|
3214
3168
|
const heightEmu = props.h !== void 0 ? resolveDimensionEmu(props.h, "Y", ctx.extent) : inchesToEmu(Math.max(0.5, fontSize / 72 * 1.6 * lineCount));
|
|
3169
|
+
const band = typeof props.style === "string" ? STYLE_BANDS[props.style] : void 0;
|
|
3215
3170
|
return {
|
|
3216
|
-
xEmu: props.x !== void 0 ? resolveDimensionEmu(props.x, "X", ctx.extent) : 0,
|
|
3217
|
-
yEmu: props.y !== void 0 ? resolveDimensionEmu(props.y, "Y", ctx.extent) : 0,
|
|
3218
|
-
widthEmu: props.w !== void 0 ? resolveDimensionEmu(props.w, "X", ctx.extent) : defaultWidthEmu(ctx.extent),
|
|
3171
|
+
xEmu: props.x !== void 0 ? resolveDimensionEmu(props.x, "X", ctx.extent) : Math.round((band?.x ?? 0) * ctx.extent.widthEmu),
|
|
3172
|
+
yEmu: props.y !== void 0 ? resolveDimensionEmu(props.y, "Y", ctx.extent) : Math.round((band?.y ?? 0) * ctx.extent.heightEmu),
|
|
3173
|
+
widthEmu: props.w !== void 0 ? resolveDimensionEmu(props.w, "X", ctx.extent) : band ? Math.round(band.w * ctx.extent.widthEmu) : defaultWidthEmu(ctx.extent),
|
|
3219
3174
|
heightEmu,
|
|
3220
3175
|
...rotationProperty(props.rotate)
|
|
3221
3176
|
};
|
|
@@ -3437,6 +3392,11 @@ function compileTable(component, scope) {
|
|
|
3437
3392
|
const rows = authoredRows.map((row) => ({
|
|
3438
3393
|
cells: row.map((cell) => compileTableCell(cell, props, ctx))
|
|
3439
3394
|
}));
|
|
3395
|
+
if (props.headerRow && rows.length > 0) {
|
|
3396
|
+
rows[0] = {
|
|
3397
|
+
cells: rows[0].cells.map((cell) => headerCell(cell, props, ctx))
|
|
3398
|
+
};
|
|
3399
|
+
}
|
|
3440
3400
|
const border = compileTableBorder(props.border, ctx);
|
|
3441
3401
|
const cornerRadius = typeof props.borderRadius === "number" && props.borderRadius > 0 ? props.borderRadius : void 0;
|
|
3442
3402
|
ctx.features.require("tables", path4);
|
|
@@ -3501,6 +3461,19 @@ function toEmuList(value, axis, ctx) {
|
|
|
3501
3461
|
const values = Array.isArray(value) ? value : [value];
|
|
3502
3462
|
return values.map((v) => resolveDimensionEmu(v, axis, ctx.extent));
|
|
3503
3463
|
}
|
|
3464
|
+
function headerCell(cell, tableProps, ctx) {
|
|
3465
|
+
const formatting = {
|
|
3466
|
+
...tableProps.fontWeight == null ? { bold: true } : {},
|
|
3467
|
+
...tableProps.color ? {} : { color: irColor(resolveColor("text", ctx.theme, ctx.warnings)) },
|
|
3468
|
+
...cell.formatting
|
|
3469
|
+
};
|
|
3470
|
+
const fill2 = cell.fill ?? (tableProps.fill ? void 0 : irColor(resolveColor("background2", ctx.theme, ctx.warnings)));
|
|
3471
|
+
return {
|
|
3472
|
+
...cell,
|
|
3473
|
+
formatting,
|
|
3474
|
+
...fill2 ? { fill: fill2 } : {}
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3504
3477
|
function compileTableDefaults(props, ctx) {
|
|
3505
3478
|
const family = props.fontFace ?? ctx.theme.fonts.body;
|
|
3506
3479
|
let fontFamily = family;
|
|
@@ -4045,7 +4018,9 @@ function optionalTransform(x, y, w, h, ctx) {
|
|
|
4045
4018
|
}
|
|
4046
4019
|
|
|
4047
4020
|
// src/renderers/registry.ts
|
|
4048
|
-
import {
|
|
4021
|
+
import {
|
|
4022
|
+
RendererRegistry
|
|
4023
|
+
} from "@json-to-office/shared/rendering";
|
|
4049
4024
|
|
|
4050
4025
|
// src/renderers/types.ts
|
|
4051
4026
|
import {
|
|
@@ -4071,6 +4046,9 @@ function resolvePptxRenderer(id) {
|
|
|
4071
4046
|
function pptxRendererIds() {
|
|
4072
4047
|
return registry.ids();
|
|
4073
4048
|
}
|
|
4049
|
+
function pptxRendererStatuses() {
|
|
4050
|
+
return registry.statuses();
|
|
4051
|
+
}
|
|
4074
4052
|
function isPptxRendererId(value) {
|
|
4075
4053
|
return registry.has(value);
|
|
4076
4054
|
}
|
|
@@ -4150,6 +4128,10 @@ async function resolveDocumentFonts(document, theme, warnings, fonts) {
|
|
|
4150
4128
|
import { applyExportMode } from "@json-to-office/shared";
|
|
4151
4129
|
|
|
4152
4130
|
// src/themes/defaults.ts
|
|
4131
|
+
var DEFAULT_TABLE = {
|
|
4132
|
+
border: { type: "solid", pt: 1, color: "background2" },
|
|
4133
|
+
headerRow: true
|
|
4134
|
+
};
|
|
4153
4135
|
var DEFAULT_STYLES = {
|
|
4154
4136
|
title: { fontSize: 36, bold: true, fontColor: "text", align: "center" },
|
|
4155
4137
|
subtitle: { fontSize: 20, italic: true, fontColor: "text2", align: "center" },
|
|
@@ -4181,7 +4163,8 @@ var DEFAULT_PPTX_THEME = {
|
|
|
4181
4163
|
fontSize: 18,
|
|
4182
4164
|
fontColor: "#333333"
|
|
4183
4165
|
},
|
|
4184
|
-
styles: DEFAULT_STYLES
|
|
4166
|
+
styles: DEFAULT_STYLES,
|
|
4167
|
+
componentDefaults: { table: DEFAULT_TABLE }
|
|
4185
4168
|
};
|
|
4186
4169
|
var PPTX_THEMES = {
|
|
4187
4170
|
default: DEFAULT_PPTX_THEME,
|
|
@@ -4207,7 +4190,8 @@ var PPTX_THEMES = {
|
|
|
4207
4190
|
fontSize: 18,
|
|
4208
4191
|
fontColor: "#FFFFFF"
|
|
4209
4192
|
},
|
|
4210
|
-
styles: DEFAULT_STYLES
|
|
4193
|
+
styles: DEFAULT_STYLES,
|
|
4194
|
+
componentDefaults: { table: DEFAULT_TABLE }
|
|
4211
4195
|
},
|
|
4212
4196
|
minimal: {
|
|
4213
4197
|
name: "minimal",
|
|
@@ -4231,7 +4215,8 @@ var PPTX_THEMES = {
|
|
|
4231
4215
|
fontSize: 18,
|
|
4232
4216
|
fontColor: "#000000"
|
|
4233
4217
|
},
|
|
4234
|
-
styles: DEFAULT_STYLES
|
|
4218
|
+
styles: DEFAULT_STYLES,
|
|
4219
|
+
componentDefaults: { table: DEFAULT_TABLE }
|
|
4235
4220
|
}
|
|
4236
4221
|
};
|
|
4237
4222
|
function getPptxTheme(name) {
|
|
@@ -5396,6 +5381,7 @@ export {
|
|
|
5396
5381
|
isPresentationComponentDefinition,
|
|
5397
5382
|
isSlideComponent,
|
|
5398
5383
|
pptxRendererIds,
|
|
5384
|
+
pptxRendererStatuses,
|
|
5399
5385
|
pptxThemes,
|
|
5400
5386
|
resolveComponentVersion3 as resolveComponentVersion,
|
|
5401
5387
|
validateComponentProps,
|