@bendyline/squisq 2.4.0 → 2.4.2
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/{Doc-DLpyOAXJ.d.ts → Doc-BKKcPjfe.d.ts} +137 -9
- package/dist/{ImageEditDoc-Cu30xb9b.d.ts → ImageEditDoc-CU1cXxRd.d.ts} +1 -1
- package/dist/{annotationCoercion-PtRQhk5V.d.ts → annotationCoercion-CPHEggo3.d.ts} +1 -1
- package/dist/{chunk-F2IEPSMA.js → chunk-2HY2ZA7U.js} +161 -80
- package/dist/{chunk-D4LPP3P5.js → chunk-7TJJA2RI.js} +3 -1
- package/dist/{chunk-KPBZZVGY.js → chunk-AQF5ZYDI.js} +50 -14
- package/dist/{chunk-2VCNTDNZ.js → chunk-D6YTLQCL.js} +71 -0
- package/dist/{chunk-32R2RZAO.js → chunk-DAMIRKTO.js} +1 -1
- package/dist/{chunk-ZHLNKB2I.js → chunk-EMXYZLRH.js} +1 -1
- package/dist/{chunk-2S74DPJH.js → chunk-GAZKTT4R.js} +24 -4
- package/dist/{chunk-REDUXXDJ.js → chunk-GODLNXO4.js} +45 -3
- package/dist/{chunk-ZYO3DBTA.js → chunk-JUAC2QWP.js} +1 -1
- package/dist/{chunk-C33GTPUZ.js → chunk-SBAX4ZPO.js} +438 -0
- package/dist/doc/index.d.ts +17 -7
- package/dist/doc/index.js +11 -10
- package/dist/generate/index.d.ts +2 -2
- package/dist/imageEdit/index.d.ts +4 -4
- package/dist/index.d.ts +7 -7
- package/dist/index.js +20 -14
- package/dist/jsonForm/index.d.ts +2 -2
- package/dist/jsonForm/index.js +4 -4
- package/dist/markdown/index.d.ts +3 -3
- package/dist/markdown/index.js +3 -3
- package/dist/{materializePageSection-CgNs5Qmw.d.ts → materializePageSection-WDJCTJEm.d.ts} +2 -2
- package/dist/narration/index.d.ts +2 -2
- package/dist/narration/index.js +4 -4
- package/dist/recommend/index.d.ts +1 -1
- package/dist/schemas/index.d.ts +33 -6
- package/dist/schemas/index.js +9 -3
- package/dist/storage/index.d.ts +2 -3
- package/dist/{themeLibrary-RWsNtlOu.d.ts → themeLibrary-BMXXLZBU.d.ts} +1 -1
- package/dist/timing/index.d.ts +1 -2
- package/dist/transform/index.d.ts +3 -3
- package/dist/{types-CUNc9biN.d.ts → types-CcrDFdWH.d.ts} +1 -1
- package/package.json +2 -2
|
@@ -6,6 +6,424 @@ import {
|
|
|
6
6
|
} from "./chunk-4VOD55SX.js";
|
|
7
7
|
|
|
8
8
|
// src/schemas/CustomTemplates.ts
|
|
9
|
+
var LAYER_TYPES = /* @__PURE__ */ new Set([
|
|
10
|
+
"image",
|
|
11
|
+
"text",
|
|
12
|
+
"shape",
|
|
13
|
+
"path",
|
|
14
|
+
"map",
|
|
15
|
+
"video",
|
|
16
|
+
"table",
|
|
17
|
+
"tree",
|
|
18
|
+
"mermaid"
|
|
19
|
+
]);
|
|
20
|
+
var ANIMATION_TYPES = /* @__PURE__ */ new Set([
|
|
21
|
+
"none",
|
|
22
|
+
"fadeIn",
|
|
23
|
+
"fadeOut",
|
|
24
|
+
"slowZoom",
|
|
25
|
+
"zoomIn",
|
|
26
|
+
"zoomOut",
|
|
27
|
+
"panLeft",
|
|
28
|
+
"panRight",
|
|
29
|
+
"typewriter"
|
|
30
|
+
]);
|
|
31
|
+
var TemplateValidator = class {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.errors = [];
|
|
34
|
+
}
|
|
35
|
+
error(path, message) {
|
|
36
|
+
this.errors.push({ path, message });
|
|
37
|
+
}
|
|
38
|
+
object(value, path) {
|
|
39
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
40
|
+
this.error(path, "expected object");
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
string(value, path, nonEmpty = false) {
|
|
46
|
+
if (typeof value !== "string" || nonEmpty && value.trim().length === 0) {
|
|
47
|
+
this.error(path, nonEmpty ? "expected non-empty string" : "expected string");
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
number(value, path) {
|
|
53
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
54
|
+
this.error(path, "expected finite number");
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
boolean(value, path) {
|
|
60
|
+
if (typeof value !== "boolean") {
|
|
61
|
+
this.error(path, "expected boolean");
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
enum(value, path, allowed) {
|
|
67
|
+
if (typeof value !== "string" || !allowed.has(value)) {
|
|
68
|
+
this.error(path, `expected one of: ${Array.from(allowed).join(", ")}`);
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
function optionalString(v, obj, key, path) {
|
|
75
|
+
if (obj[key] !== void 0) v.string(obj[key], `${path}.${key}`);
|
|
76
|
+
}
|
|
77
|
+
function optionalNumber(v, obj, key, path) {
|
|
78
|
+
if (obj[key] !== void 0) v.number(obj[key], `${path}.${key}`);
|
|
79
|
+
}
|
|
80
|
+
function optionalBoolean(v, obj, key, path) {
|
|
81
|
+
if (obj[key] !== void 0) v.boolean(obj[key], `${path}.${key}`);
|
|
82
|
+
}
|
|
83
|
+
function optionalEnum(v, obj, key, path, allowed) {
|
|
84
|
+
if (obj[key] !== void 0) v.enum(obj[key], `${path}.${key}`, new Set(allowed));
|
|
85
|
+
}
|
|
86
|
+
function validatePosition(v, value, path) {
|
|
87
|
+
if (!v.object(value, path)) return;
|
|
88
|
+
for (const key of ["x", "y"]) validateCoordinate(v, value[key], `${path}.${key}`);
|
|
89
|
+
for (const key of ["width", "height"]) {
|
|
90
|
+
if (value[key] !== void 0) validateCoordinate(v, value[key], `${path}.${key}`);
|
|
91
|
+
}
|
|
92
|
+
optionalEnum(v, value, "anchor", path, [
|
|
93
|
+
"center",
|
|
94
|
+
"top-left",
|
|
95
|
+
"top-right",
|
|
96
|
+
"bottom-left",
|
|
97
|
+
"bottom-right"
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
function validateCoordinate(v, value, path) {
|
|
101
|
+
if (typeof value === "number" && Number.isFinite(value)) return;
|
|
102
|
+
if (typeof value === "string" && Number.isFinite(Number.parseFloat(value))) return;
|
|
103
|
+
v.error(path, "expected finite number or numeric string");
|
|
104
|
+
}
|
|
105
|
+
function validateAnimation(v, value, path) {
|
|
106
|
+
if (!v.object(value, path)) return;
|
|
107
|
+
v.enum(value.type, `${path}.type`, ANIMATION_TYPES);
|
|
108
|
+
optionalNumber(v, value, "duration", path);
|
|
109
|
+
optionalNumber(v, value, "delay", path);
|
|
110
|
+
optionalString(v, value, "easing", path);
|
|
111
|
+
optionalEnum(v, value, "direction", path, ["in", "out"]);
|
|
112
|
+
optionalEnum(v, value, "panDirection", path, ["left", "right", "up", "down"]);
|
|
113
|
+
}
|
|
114
|
+
function validateRepeat(v, value, path) {
|
|
115
|
+
if (!v.object(value, path)) return;
|
|
116
|
+
v.enum(value.source, `${path}.source`, /* @__PURE__ */ new Set(["images", "children", "listItems"]));
|
|
117
|
+
optionalEnum(v, value, "direction", path, ["row", "column"]);
|
|
118
|
+
optionalNumber(v, value, "gap", path);
|
|
119
|
+
if (value.max !== void 0 && v.number(value.max, `${path}.max`)) {
|
|
120
|
+
if (!Number.isInteger(value.max) || value.max < 0) {
|
|
121
|
+
v.error(`${path}.max`, "expected non-negative integer");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function validateGradient(v, value, path) {
|
|
126
|
+
if (!v.object(value, path)) return;
|
|
127
|
+
v.string(value.from, `${path}.from`);
|
|
128
|
+
v.string(value.to, `${path}.to`);
|
|
129
|
+
optionalNumber(v, value, "angle", path);
|
|
130
|
+
}
|
|
131
|
+
function validateTextStyle(v, value, path) {
|
|
132
|
+
if (!v.object(value, path)) return;
|
|
133
|
+
v.number(value.fontSize, `${path}.fontSize`);
|
|
134
|
+
v.string(value.color, `${path}.color`);
|
|
135
|
+
optionalString(v, value, "fontFamily", path);
|
|
136
|
+
optionalEnum(v, value, "fontWeight", path, ["normal", "bold"]);
|
|
137
|
+
optionalEnum(v, value, "fontStyle", path, ["normal", "italic"]);
|
|
138
|
+
optionalEnum(v, value, "textAlign", path, ["left", "center", "right"]);
|
|
139
|
+
optionalEnum(v, value, "verticalAlign", path, ["top", "middle", "bottom"]);
|
|
140
|
+
optionalNumber(v, value, "lineHeight", path);
|
|
141
|
+
optionalBoolean(v, value, "shadow", path);
|
|
142
|
+
optionalString(v, value, "background", path);
|
|
143
|
+
optionalNumber(v, value, "backgroundOpacity", path);
|
|
144
|
+
if (value.backgroundGradient !== void 0) {
|
|
145
|
+
validateGradient(v, value.backgroundGradient, `${path}.backgroundGradient`);
|
|
146
|
+
}
|
|
147
|
+
optionalString(v, value, "borderColor", path);
|
|
148
|
+
optionalNumber(v, value, "borderWidth", path);
|
|
149
|
+
optionalEnum(v, value, "borderStyle", path, ["solid", "dashed", "dotted"]);
|
|
150
|
+
optionalNumber(v, value, "padding", path);
|
|
151
|
+
optionalNumber(v, value, "maxLines", path);
|
|
152
|
+
}
|
|
153
|
+
function validateImageContent(v, value, path) {
|
|
154
|
+
if (!v.object(value, path)) return;
|
|
155
|
+
v.string(value.src, `${path}.src`);
|
|
156
|
+
v.string(value.alt, `${path}.alt`);
|
|
157
|
+
optionalEnum(v, value, "fit", path, ["cover", "contain", "fill"]);
|
|
158
|
+
optionalString(v, value, "credit", path);
|
|
159
|
+
optionalString(v, value, "license", path);
|
|
160
|
+
optionalNumber(v, value, "blur", path);
|
|
161
|
+
if (value.treatment !== void 0) {
|
|
162
|
+
const treatmentPath = `${path}.treatment`;
|
|
163
|
+
if (v.object(value.treatment, treatmentPath)) {
|
|
164
|
+
v.enum(
|
|
165
|
+
value.treatment.type,
|
|
166
|
+
`${treatmentPath}.type`,
|
|
167
|
+
/* @__PURE__ */ new Set(["none", "mono", "duotone", "warm", "cool"])
|
|
168
|
+
);
|
|
169
|
+
optionalNumber(v, value.treatment, "strength", treatmentPath);
|
|
170
|
+
optionalString(v, value.treatment, "color", treatmentPath);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function validateShapeContent(v, value, path) {
|
|
175
|
+
if (!v.object(value, path)) return;
|
|
176
|
+
v.enum(value.shape, `${path}.shape`, /* @__PURE__ */ new Set(["rect", "circle", "line"]));
|
|
177
|
+
optionalString(v, value, "fill", path);
|
|
178
|
+
optionalNumber(v, value, "fillOpacity", path);
|
|
179
|
+
if (value.gradient !== void 0) validateGradient(v, value.gradient, `${path}.gradient`);
|
|
180
|
+
optionalString(v, value, "stroke", path);
|
|
181
|
+
optionalNumber(v, value, "strokeWidth", path);
|
|
182
|
+
optionalEnum(v, value, "borderStyle", path, ["solid", "dashed", "dotted"]);
|
|
183
|
+
optionalNumber(v, value, "borderRadius", path);
|
|
184
|
+
if (value.pattern !== void 0) {
|
|
185
|
+
const patternPath = `${path}.pattern`;
|
|
186
|
+
if (v.object(value.pattern, patternPath)) {
|
|
187
|
+
v.enum(value.pattern.kind, `${patternPath}.kind`, /* @__PURE__ */ new Set(["dots", "grid", "diagonal"]));
|
|
188
|
+
v.string(value.pattern.color, `${patternPath}.color`);
|
|
189
|
+
optionalNumber(v, value.pattern, "size", patternPath);
|
|
190
|
+
optionalNumber(v, value.pattern, "opacity", patternPath);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (value.filter !== void 0) {
|
|
194
|
+
const filterPath = `${path}.filter`;
|
|
195
|
+
if (v.object(value.filter, filterPath)) {
|
|
196
|
+
v.enum(value.filter.type, `${filterPath}.type`, /* @__PURE__ */ new Set(["noise"]));
|
|
197
|
+
optionalNumber(v, value.filter, "baseFrequency", filterPath);
|
|
198
|
+
optionalNumber(v, value.filter, "opacity", filterPath);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function validatePathContent(v, value, path) {
|
|
203
|
+
if (!v.object(value, path)) return;
|
|
204
|
+
v.string(value.d, `${path}.d`);
|
|
205
|
+
optionalString(v, value, "shapeKind", path);
|
|
206
|
+
optionalString(v, value, "stroke", path);
|
|
207
|
+
optionalNumber(v, value, "strokeWidth", path);
|
|
208
|
+
optionalString(v, value, "fill", path);
|
|
209
|
+
optionalNumber(v, value, "fillOpacity", path);
|
|
210
|
+
if (value.gradient !== void 0) validateGradient(v, value.gradient, `${path}.gradient`);
|
|
211
|
+
optionalEnum(v, value, "borderStyle", path, ["solid", "dashed", "dotted"]);
|
|
212
|
+
optionalString(v, value, "dasharray", path);
|
|
213
|
+
const markers = ["none", "arrow", "open", "diamond", "circle", "square"];
|
|
214
|
+
optionalEnum(v, value, "startMarker", path, markers);
|
|
215
|
+
optionalEnum(v, value, "endMarker", path, markers);
|
|
216
|
+
}
|
|
217
|
+
function validateMapContent(v, value, path) {
|
|
218
|
+
if (!v.object(value, path)) return;
|
|
219
|
+
if (v.object(value.center, `${path}.center`)) {
|
|
220
|
+
v.number(value.center.lat, `${path}.center.lat`);
|
|
221
|
+
v.number(value.center.lng, `${path}.center.lng`);
|
|
222
|
+
}
|
|
223
|
+
v.number(value.zoom, `${path}.zoom`);
|
|
224
|
+
v.enum(
|
|
225
|
+
value.style,
|
|
226
|
+
`${path}.style`,
|
|
227
|
+
/* @__PURE__ */ new Set(["terrain", "satellite", "road", "toner", "watercolor"])
|
|
228
|
+
);
|
|
229
|
+
optionalString(v, value, "staticSrc", path);
|
|
230
|
+
optionalBoolean(v, value, "showAttribution", path);
|
|
231
|
+
if (value.markers !== void 0) {
|
|
232
|
+
if (!Array.isArray(value.markers)) {
|
|
233
|
+
v.error(`${path}.markers`, "expected array");
|
|
234
|
+
} else {
|
|
235
|
+
value.markers.forEach((marker, index) => {
|
|
236
|
+
const markerPath = `${path}.markers[${index}]`;
|
|
237
|
+
if (!v.object(marker, markerPath)) return;
|
|
238
|
+
v.number(marker.lat, `${markerPath}.lat`);
|
|
239
|
+
v.number(marker.lng, `${markerPath}.lng`);
|
|
240
|
+
optionalString(v, marker, "label", markerPath);
|
|
241
|
+
optionalString(v, marker, "color", markerPath);
|
|
242
|
+
optionalEnum(v, marker, "icon", markerPath, ["pin", "circle", "star"]);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function validateVideoContent(v, value, path) {
|
|
248
|
+
if (!v.object(value, path)) return;
|
|
249
|
+
v.string(value.src, `${path}.src`);
|
|
250
|
+
v.string(value.alt, `${path}.alt`);
|
|
251
|
+
v.number(value.clipStart, `${path}.clipStart`);
|
|
252
|
+
v.number(value.clipEnd, `${path}.clipEnd`);
|
|
253
|
+
optionalString(v, value, "posterSrc", path);
|
|
254
|
+
optionalEnum(v, value, "fit", path, ["cover", "contain", "fill"]);
|
|
255
|
+
optionalNumber(v, value, "sourceDuration", path);
|
|
256
|
+
optionalNumber(v, value, "startAt", path);
|
|
257
|
+
optionalBoolean(v, value, "spillover", path);
|
|
258
|
+
optionalString(v, value, "credit", path);
|
|
259
|
+
optionalString(v, value, "license", path);
|
|
260
|
+
}
|
|
261
|
+
function validateTableContent(v, value, path) {
|
|
262
|
+
if (!v.object(value, path)) return;
|
|
263
|
+
validateStringArray(v, value.headers, `${path}.headers`);
|
|
264
|
+
if (!Array.isArray(value.rows)) {
|
|
265
|
+
v.error(`${path}.rows`, "expected array");
|
|
266
|
+
} else {
|
|
267
|
+
value.rows.forEach((row, index) => validateStringArray(v, row, `${path}.rows[${index}]`));
|
|
268
|
+
}
|
|
269
|
+
if (value.align !== void 0) {
|
|
270
|
+
if (!Array.isArray(value.align)) {
|
|
271
|
+
v.error(`${path}.align`, "expected array");
|
|
272
|
+
} else {
|
|
273
|
+
const alignments = /* @__PURE__ */ new Set(["left", "right", "center"]);
|
|
274
|
+
value.align.forEach((entry, index) => {
|
|
275
|
+
if (entry !== null) v.enum(entry, `${path}.align[${index}]`, alignments);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (v.object(value.style, `${path}.style`)) {
|
|
280
|
+
for (const key of [
|
|
281
|
+
"headerBackground",
|
|
282
|
+
"headerColor",
|
|
283
|
+
"cellBackground",
|
|
284
|
+
"cellColor",
|
|
285
|
+
"borderColor"
|
|
286
|
+
]) {
|
|
287
|
+
v.string(value.style[key], `${path}.style.${key}`);
|
|
288
|
+
}
|
|
289
|
+
v.number(value.style.fontSize, `${path}.style.fontSize`);
|
|
290
|
+
optionalString(v, value.style, "fontFamily", `${path}.style`);
|
|
291
|
+
optionalString(v, value.style, "headerFontFamily", `${path}.style`);
|
|
292
|
+
optionalNumber(v, value.style, "borderRadius", `${path}.style`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function validateStringArray(v, value, path) {
|
|
296
|
+
if (!Array.isArray(value)) {
|
|
297
|
+
v.error(path, "expected string array");
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
value.forEach((entry, index) => v.string(entry, `${path}[${index}]`));
|
|
301
|
+
}
|
|
302
|
+
function validateTreeContent(v, value, path) {
|
|
303
|
+
if (!v.object(value, path)) return;
|
|
304
|
+
if (!Array.isArray(value.items)) {
|
|
305
|
+
v.error(`${path}.items`, "expected array");
|
|
306
|
+
} else {
|
|
307
|
+
value.items.forEach((item, index) => validateTreeItem(v, item, `${path}.items[${index}]`, 0));
|
|
308
|
+
}
|
|
309
|
+
if (v.object(value.style, `${path}.style`)) {
|
|
310
|
+
for (const key of ["rowColor", "dirColor", "connectorColor", "iconColor", "commentColor"]) {
|
|
311
|
+
v.string(value.style[key], `${path}.style.${key}`);
|
|
312
|
+
}
|
|
313
|
+
v.number(value.style.fontSize, `${path}.style.fontSize`);
|
|
314
|
+
v.number(value.style.indentPx, `${path}.style.indentPx`);
|
|
315
|
+
optionalString(v, value.style, "fontFamily", `${path}.style`);
|
|
316
|
+
optionalString(v, value.style, "monoFontFamily", `${path}.style`);
|
|
317
|
+
optionalString(v, value.style, "folderIcon", `${path}.style`);
|
|
318
|
+
optionalString(v, value.style, "fileIcon", `${path}.style`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function validateTreeItem(v, value, path, depth) {
|
|
322
|
+
if (depth > 100) {
|
|
323
|
+
v.error(path, "tree nesting exceeds 100 levels");
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (!v.object(value, path)) return;
|
|
327
|
+
v.string(value.id, `${path}.id`);
|
|
328
|
+
v.string(value.label, `${path}.label`);
|
|
329
|
+
optionalBoolean(v, value, "isDir", path);
|
|
330
|
+
optionalString(v, value, "comment", path);
|
|
331
|
+
if (!Array.isArray(value.children)) {
|
|
332
|
+
v.error(`${path}.children`, "expected array");
|
|
333
|
+
} else {
|
|
334
|
+
value.children.forEach(
|
|
335
|
+
(child, index) => validateTreeItem(v, child, `${path}.children[${index}]`, depth + 1)
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function validateMermaidContent(v, value, path) {
|
|
340
|
+
if (!v.object(value, path)) return;
|
|
341
|
+
v.string(value.source, `${path}.source`);
|
|
342
|
+
optionalString(v, value, "background", path);
|
|
343
|
+
optionalString(v, value, "foreground", path);
|
|
344
|
+
optionalNumber(v, value, "padding", path);
|
|
345
|
+
}
|
|
346
|
+
function validateLayer(v, value, path) {
|
|
347
|
+
if (!v.object(value, path)) return;
|
|
348
|
+
v.string(value.id, `${path}.id`, true);
|
|
349
|
+
validatePosition(v, value.position, `${path}.position`);
|
|
350
|
+
if (value.animation !== void 0) validateAnimation(v, value.animation, `${path}.animation`);
|
|
351
|
+
if (value.repeat !== void 0) validateRepeat(v, value.repeat, `${path}.repeat`);
|
|
352
|
+
if (!v.enum(value.type, `${path}.type`, LAYER_TYPES)) return;
|
|
353
|
+
const contentPath = `${path}.content`;
|
|
354
|
+
switch (value.type) {
|
|
355
|
+
case "image":
|
|
356
|
+
validateImageContent(v, value.content, contentPath);
|
|
357
|
+
break;
|
|
358
|
+
case "text":
|
|
359
|
+
if (v.object(value.content, contentPath)) {
|
|
360
|
+
v.string(value.content.text, `${contentPath}.text`);
|
|
361
|
+
optionalString(v, value.content, "html", contentPath);
|
|
362
|
+
validateTextStyle(v, value.content.style, `${contentPath}.style`);
|
|
363
|
+
}
|
|
364
|
+
break;
|
|
365
|
+
case "shape":
|
|
366
|
+
validateShapeContent(v, value.content, contentPath);
|
|
367
|
+
break;
|
|
368
|
+
case "path":
|
|
369
|
+
validatePathContent(v, value.content, contentPath);
|
|
370
|
+
break;
|
|
371
|
+
case "map":
|
|
372
|
+
validateMapContent(v, value.content, contentPath);
|
|
373
|
+
break;
|
|
374
|
+
case "video":
|
|
375
|
+
validateVideoContent(v, value.content, contentPath);
|
|
376
|
+
break;
|
|
377
|
+
case "table":
|
|
378
|
+
validateTableContent(v, value.content, contentPath);
|
|
379
|
+
break;
|
|
380
|
+
case "tree":
|
|
381
|
+
validateTreeContent(v, value.content, contentPath);
|
|
382
|
+
break;
|
|
383
|
+
case "mermaid":
|
|
384
|
+
validateMermaidContent(v, value.content, contentPath);
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function validateCustomTemplateDefinition(input) {
|
|
389
|
+
const v = new TemplateValidator();
|
|
390
|
+
if (!v.object(input, "$")) return { valid: false, errors: v.errors };
|
|
391
|
+
v.string(input.name, "$.name", true);
|
|
392
|
+
v.string(input.label, "$.label", true);
|
|
393
|
+
if (input.description !== void 0) v.string(input.description, "$.description");
|
|
394
|
+
if (v.object(input.viewport, "$.viewport")) {
|
|
395
|
+
if (v.number(input.viewport.width, "$.viewport.width") && input.viewport.width <= 0) {
|
|
396
|
+
v.error("$.viewport.width", "expected number greater than zero");
|
|
397
|
+
}
|
|
398
|
+
if (v.number(input.viewport.height, "$.viewport.height") && input.viewport.height <= 0) {
|
|
399
|
+
v.error("$.viewport.height", "expected number greater than zero");
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (!Array.isArray(input.layers)) {
|
|
403
|
+
v.error("$.layers", "expected array");
|
|
404
|
+
} else {
|
|
405
|
+
const ids = /* @__PURE__ */ new Set();
|
|
406
|
+
input.layers.forEach((layer, index) => {
|
|
407
|
+
validateLayer(v, layer, `$.layers[${index}]`);
|
|
408
|
+
if (layer && typeof layer === "object" && !Array.isArray(layer)) {
|
|
409
|
+
const id = layer.id;
|
|
410
|
+
if (typeof id === "string") {
|
|
411
|
+
if (ids.has(id)) v.error(`$.layers[${index}].id`, `duplicate layer id "${id}"`);
|
|
412
|
+
ids.add(id);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
if (v.errors.length > 0) return { valid: false, errors: v.errors };
|
|
418
|
+
return {
|
|
419
|
+
valid: true,
|
|
420
|
+
errors: [],
|
|
421
|
+
template: input
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
function isCustomTemplateDefinition(input) {
|
|
425
|
+
return validateCustomTemplateDefinition(input).valid;
|
|
426
|
+
}
|
|
9
427
|
var FRONTMATTER_CUSTOM_TEMPLATES_KEY = "squisq-custom-templates";
|
|
10
428
|
|
|
11
429
|
// src/schemas/themeConstants.ts
|
|
@@ -383,6 +801,24 @@ var V = class {
|
|
|
383
801
|
if (v.imageTreatment !== void 0) {
|
|
384
802
|
this.imageTreatment(`${path}.imageTreatment`, v.imageTreatment);
|
|
385
803
|
}
|
|
804
|
+
if (v.pip !== void 0) {
|
|
805
|
+
this.pip(`${path}.pip`, v.pip);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
pip(path, v) {
|
|
809
|
+
if (!this.isObject(v)) {
|
|
810
|
+
this.err(path, "expected object");
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
if (v.cornerRadius !== void 0 && !this.isNumber(v.cornerRadius) && !this.isString(v.cornerRadius)) {
|
|
814
|
+
this.err(`${path}.cornerRadius`, "expected number or string");
|
|
815
|
+
}
|
|
816
|
+
if (v.border !== void 0 && v.border !== "none" && !this.isObject(v.border)) {
|
|
817
|
+
this.err(`${path}.border`, "expected 'none' or { width?, color? }");
|
|
818
|
+
}
|
|
819
|
+
if (v.shadow !== void 0 && !this.isBoolean(v.shadow) && !this.isString(v.shadow)) {
|
|
820
|
+
this.err(`${path}.shadow`, "expected boolean or string");
|
|
821
|
+
}
|
|
386
822
|
}
|
|
387
823
|
imageTreatment(path, v) {
|
|
388
824
|
if (!this.isObject(v)) {
|
|
@@ -2335,6 +2771,8 @@ function matchFontFamily(name) {
|
|
|
2335
2771
|
}
|
|
2336
2772
|
|
|
2337
2773
|
export {
|
|
2774
|
+
validateCustomTemplateDefinition,
|
|
2775
|
+
isCustomTemplateDefinition,
|
|
2338
2776
|
FRONTMATTER_CUSTOM_TEMPLATES_KEY,
|
|
2339
2777
|
THEME_SCHEMA_VERSION,
|
|
2340
2778
|
isHex,
|
package/dist/doc/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
import { C as CoercedBlockMeta } from '../annotationCoercion-
|
|
5
|
-
import { c as PageSection } from '../materializePageSection-
|
|
6
|
-
export { M as MaterializePageSectionOptions, a as MaterializePageSectionsOptions, P as PageMedia, b as PageRichText, d as PageSectionDiagnostic, e as PageSectionItem, f as PageSectionMaterialization, g as PageSectionSource, h as PageSpatialKind, i as PageTransformHints, m as materializePageSection, j as materializePageSections, r as resolvePageStyle } from '../materializePageSection-
|
|
1
|
+
import { ba as TemplateBlock, bb as TemplateContext, a2 as Layer, v as CustomTemplateDefinition, bd as TemplateRegistry, bg as Theme, bK as ViewportConfig, aK as PersistentLayerConfig, O as DocBlock, bL as ViewportOrientation, aJ as PersistentLayer, bt as TitleBlockInput, a$ as SectionHeaderInput, t as ContentBlockInput, b5 as StatHighlightInput, aV as QuoteBlockInput, U as FactCardInput, bA as TwoColumnInput, G as DateEventInput, a0 as ImageWithCaptionInput, a5 as LeftFeatureInput, aY as RightFeatureInput, a9 as MapBlockInput, b4 as StartBlockConfig, X as FullBleedQuoteInput, a8 as ListBlockInput, aO as PhotoGridInput, I as DefinitionCardInput, s as ComparisonBarInput, aU as PullQuoteInput, bJ as VideoWithCaptionInput, bI as VideoPullQuoteInput, F as DataTableInput, J as DiagramBlockInput, bv as TreeBlockInput, bp as TimelineBlockInput, j as Block, R as DrawingBlockInput, ad as MarkerStyle, A as AccentImage, $ as ImageTreatment, a as AccentPosition, c as Animation, d as AnimationType, bi as ThemeColorScheme, N as Doc, bk as ThemeRegistry, aC as PageEmphasis, bj as ThemePageStyle, P as DocDiagnostic, M as DiagramTemplateNode, L as DiagramTemplateEdge, bs as TimelineTemplateTrack, br as TimelineTemplateLink } from '../Doc-BKKcPjfe.js';
|
|
2
|
+
export { S as FRONTMATTER_CUSTOM_TEMPLATES_KEY, T as FRONTMATTER_CUSTOM_THEMES_KEY, a4 as LayoutHints, aX as RenderStyle, bh as ThemeColorPalette, bn as ThemeStyle, bo as ThemeTypography, bB as VIEWPORT_PRESETS, bM as ViewportPreset, bR as createTemplateContext, bY as getLayoutHints, b$ as getTwoColumnPositions, c0 as getViewport, c1 as getViewportOrientation, c4 as isTemplateBlock, c7 as scaledFontSize } from '../Doc-BKKcPjfe.js';
|
|
3
|
+
import { L as MarkdownNode, a3 as TransitionType, a2 as TransitionDirection, M as MarkdownBlockNode, r as MarkdownHeading, n as MarkdownDocument, T as MarkdownTable, i as MarkdownCodeBlock, G as MarkdownList } from '../types-CcrDFdWH.js';
|
|
4
|
+
import { C as CoercedBlockMeta } from '../annotationCoercion-CPHEggo3.js';
|
|
5
|
+
import { c as PageSection } from '../materializePageSection-WDJCTJEm.js';
|
|
6
|
+
export { M as MaterializePageSectionOptions, a as MaterializePageSectionsOptions, P as PageMedia, b as PageRichText, d as PageSectionDiagnostic, e as PageSectionItem, f as PageSectionMaterialization, g as PageSectionSource, h as PageSpatialKind, i as PageTransformHints, m as materializePageSection, j as materializePageSections, r as resolvePageStyle } from '../materializePageSection-WDJCTJEm.js';
|
|
7
7
|
import { C as ContentContainer } from '../ContentContainer-B2w9sUoL.js';
|
|
8
|
-
export { D as DEFAULT_THEME, g as getAvailableThemes, b as getThemeSummaries, r as resolveTheme } from '../themeLibrary-
|
|
8
|
+
export { D as DEFAULT_THEME, g as getAvailableThemes, b as getThemeSummaries, r as resolveTheme } from '../themeLibrary-BMXXLZBU.js';
|
|
9
9
|
|
|
10
10
|
/** Runtime registry composition for built-in and document-scoped templates. */
|
|
11
11
|
|
|
@@ -1492,6 +1492,16 @@ interface ExpandDocBlocksOptions {
|
|
|
1492
1492
|
* ensuring proper synchronization with audio playback.
|
|
1493
1493
|
*/
|
|
1494
1494
|
audioSegments?: AudioSegmentTiming[];
|
|
1495
|
+
/**
|
|
1496
|
+
* Split any block whose *scheduled* duration exceeds ~20s into repeated parts
|
|
1497
|
+
* so a single slide never lingers too long during timed playback (video).
|
|
1498
|
+
* Each part re-shows the same content — correct for a continuous medium, but
|
|
1499
|
+
* for discrete-slide consumers it produces duplicate slides. Emitters of
|
|
1500
|
+
* discrete slides (e.g. the PPTX exporter) pass `false` so one authored slide
|
|
1501
|
+
* stays one slide, matching the slideshow. Only affects the audio-timed path;
|
|
1502
|
+
* defaults to `true` to preserve video/narration pacing.
|
|
1503
|
+
*/
|
|
1504
|
+
splitLongBlocks?: boolean;
|
|
1495
1505
|
/**
|
|
1496
1506
|
* User-defined custom templates to merge onto the built-in registry
|
|
1497
1507
|
* before expanding blocks. Typically passed straight from
|
package/dist/doc/index.js
CHANGED
|
@@ -26,20 +26,18 @@ import {
|
|
|
26
26
|
sectionExtractors,
|
|
27
27
|
validateMarkdownDoc,
|
|
28
28
|
validateMarkdownSource
|
|
29
|
-
} from "../chunk-
|
|
29
|
+
} from "../chunk-AQF5ZYDI.js";
|
|
30
30
|
import {
|
|
31
31
|
ASCII_CHAR_H,
|
|
32
32
|
ASCII_CHAR_W,
|
|
33
33
|
BASE_INPUT_DESCRIPTORS,
|
|
34
34
|
BLOCK_MEDIA_LAYOUT_POLICIES,
|
|
35
|
-
CONTAINER_TEMPLATES,
|
|
36
35
|
DEFAULT_LAYOUT,
|
|
37
36
|
DIAGRAM_LABEL_HORIZONTAL_PADDING,
|
|
38
37
|
DIAGRAM_LABEL_LINE_HEIGHT,
|
|
39
38
|
DIAGRAM_LABEL_MIN_FONT_SIZE,
|
|
40
39
|
DIAGRAM_LABEL_VERTICAL_PADDING,
|
|
41
40
|
SHAPE_NAMES,
|
|
42
|
-
TABLE_FED_TEMPLATES,
|
|
43
41
|
TEMPLATE_AUTHORING_METADATA,
|
|
44
42
|
TEMPLATE_INPUT_DESCRIPTORS,
|
|
45
43
|
TEMPLATE_METADATA,
|
|
@@ -102,7 +100,6 @@ import {
|
|
|
102
100
|
getThemeFont,
|
|
103
101
|
hasTemplate,
|
|
104
102
|
imageWithCaption,
|
|
105
|
-
isContainerTemplate,
|
|
106
103
|
isDataFence,
|
|
107
104
|
isShapeName,
|
|
108
105
|
layoutBlock,
|
|
@@ -123,7 +120,6 @@ import {
|
|
|
123
120
|
replaceDataFence,
|
|
124
121
|
resolveColorScheme,
|
|
125
122
|
resolvePersistentLayers,
|
|
126
|
-
resolveTemplateName,
|
|
127
123
|
rightFeature,
|
|
128
124
|
scaleAnimationDuration,
|
|
129
125
|
sectionHeader,
|
|
@@ -148,7 +144,7 @@ import {
|
|
|
148
144
|
wrapWithPersistentLayers,
|
|
149
145
|
writeCustomTemplatesToFrontmatter,
|
|
150
146
|
writeCustomThemesToFrontmatter
|
|
151
|
-
} from "../chunk-
|
|
147
|
+
} from "../chunk-2HY2ZA7U.js";
|
|
152
148
|
import {
|
|
153
149
|
PATH_SHAPE_KINDS,
|
|
154
150
|
anchorPoint,
|
|
@@ -185,7 +181,7 @@ import {
|
|
|
185
181
|
parseTree,
|
|
186
182
|
parseWrappedFlowTimeline
|
|
187
183
|
} from "../chunk-CUYHFOFL.js";
|
|
188
|
-
import "../chunk-
|
|
184
|
+
import "../chunk-GAZKTT4R.js";
|
|
189
185
|
import {
|
|
190
186
|
DEFAULT_THEME,
|
|
191
187
|
FRONTMATTER_CUSTOM_TEMPLATES_KEY,
|
|
@@ -193,7 +189,7 @@ import {
|
|
|
193
189
|
getAvailableThemes,
|
|
194
190
|
getThemeSummaries,
|
|
195
191
|
resolveTheme
|
|
196
|
-
} from "../chunk-
|
|
192
|
+
} from "../chunk-SBAX4ZPO.js";
|
|
197
193
|
import {
|
|
198
194
|
VIEWPORT_PRESETS,
|
|
199
195
|
createTemplateContext,
|
|
@@ -204,8 +200,13 @@ import {
|
|
|
204
200
|
isTemplateBlock,
|
|
205
201
|
scaledFontSize2 as scaledFontSize
|
|
206
202
|
} from "../chunk-BAOV476U.js";
|
|
207
|
-
import "../chunk-
|
|
208
|
-
import
|
|
203
|
+
import "../chunk-7TJJA2RI.js";
|
|
204
|
+
import {
|
|
205
|
+
CONTAINER_TEMPLATES,
|
|
206
|
+
TABLE_FED_TEMPLATES,
|
|
207
|
+
isContainerTemplate,
|
|
208
|
+
resolveTemplateName
|
|
209
|
+
} from "../chunk-D6YTLQCL.js";
|
|
209
210
|
import "../chunk-7N4G32LG.js";
|
|
210
211
|
import "../chunk-O7JILDEF.js";
|
|
211
212
|
import "../chunk-4VOD55SX.js";
|
package/dist/generate/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { E as ExtractedElement } from '../contentExtractor-BNfVJV2U.js';
|
|
2
2
|
export { C as ComparisonData, D as DateData, a as DefinitionData, b as ExtractionOptions, c as ExtractionResult, d as ExtractionType, F as FactData, I as ImpactLineData, L as ListData, Q as QuoteData, S as StatData, e as extractContent, s as stripMarkdown } from '../contentExtractor-BNfVJV2U.js';
|
|
3
|
-
import { q as ColorScheme, A as AccentImage,
|
|
4
|
-
import '../types-
|
|
3
|
+
import { q as ColorScheme, A as AccentImage, ba as TemplateBlock } from '../Doc-BKKcPjfe.js';
|
|
4
|
+
import '../types-CcrDFdWH.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Template Mapper
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as ImageEditDoc, b as ImageEditLayer } from '../ImageEditDoc-
|
|
2
|
-
export { E as EditorLayerMeta, I as ImageEditCanvas, c as ImageEditLayerKind, d as ImageEditMeta } from '../ImageEditDoc-
|
|
1
|
+
import { a as ImageEditDoc, b as ImageEditLayer } from '../ImageEditDoc-CU1cXxRd.js';
|
|
2
|
+
export { E as EditorLayerMeta, I as ImageEditCanvas, c as ImageEditLayerKind, d as ImageEditMeta } from '../ImageEditDoc-CU1cXxRd.js';
|
|
3
3
|
import { C as ContentContainer } from '../ContentContainer-B2w9sUoL.js';
|
|
4
4
|
import { V as Version, C as CoalesceOptions, P as PrunePolicy } from '../types-8QjefM9J.js';
|
|
5
|
-
import '../Doc-
|
|
6
|
-
import '../types-
|
|
5
|
+
import '../Doc-BKKcPjfe.js';
|
|
6
|
+
import '../types-CcrDFdWH.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Pure helpers for constructing and mutating {@link ImageEditDoc} values.
|