@bendyline/squisq-react 2.12.19 → 2.12.20
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/diagram-pictures/index.d.ts +4 -4
- package/dist/diagram-pictures/index.js +15 -0
- package/dist/squisq-player.full.global.js +281 -281
- package/dist/squisq-player.global.js +76 -76
- package/dist/standalone-player-full.js +1 -1
- package/dist/standalone-source.js +1 -1
- package/package.json +2 -2
|
@@ -33,7 +33,7 @@ interface DiagramPictureOptions {
|
|
|
33
33
|
}
|
|
34
34
|
/** The diagram description `@bendyline/squisq-formats/diagrams` passes. */
|
|
35
35
|
interface DiagramToPicture {
|
|
36
|
-
kind: 'mermaid' | 'diagram' | 'timeline' | 'tree' | 'container' | 'svg';
|
|
36
|
+
kind: 'mermaid' | 'diagram' | 'timeline' | 'tree' | 'container' | 'svg' | 'chart';
|
|
37
37
|
markdown: string;
|
|
38
38
|
source: string;
|
|
39
39
|
}
|
|
@@ -52,14 +52,14 @@ declare function renderSvgIslandPicture(source: string, options?: DiagramPicture
|
|
|
52
52
|
/** A file-tree fence as monospace text lines, exactly as written. */
|
|
53
53
|
declare function renderTreePicture(source: string, options?: DiagramPictureOptions): Promise<DiagramPicturePng | null>;
|
|
54
54
|
/**
|
|
55
|
-
* A Squisq-rendered diagram — an ASCII diagram or timeline fence,
|
|
56
|
-
* drawing, layout, or diagram heading block — as a PNG cropped to its
|
|
55
|
+
* A Squisq-rendered diagram — an ASCII diagram or timeline fence, a
|
|
56
|
+
* drawing, layout, or diagram heading block, or a chart — as a PNG cropped to its
|
|
57
57
|
* content, or null when it has nothing to draw.
|
|
58
58
|
*/
|
|
59
59
|
declare function renderSquisqDiagramPicture(markdown: string, options?: DiagramPictureOptions): Promise<DiagramPicturePng | null>;
|
|
60
60
|
/**
|
|
61
61
|
* A renderer for `rasterizeDiagrams` from `@bendyline/squisq-formats/diagrams`:
|
|
62
|
-
* Mermaid, ASCII diagrams and timelines, file trees, and drawing, layout,
|
|
62
|
+
* Mermaid, ASCII diagrams and timelines, file trees, charts, and drawing, layout,
|
|
63
63
|
* and diagram blocks.
|
|
64
64
|
*/
|
|
65
65
|
declare function createDiagramPictureRenderer(options?: DiagramPictureOptions): (diagram: DiagramToPicture) => Promise<DiagramPicturePng | null>;
|
|
@@ -233,11 +233,26 @@ function createDiagramPictureRenderer(options = {}) {
|
|
|
233
233
|
return renderTreePicture(diagram.source, options);
|
|
234
234
|
case "svg":
|
|
235
235
|
return renderSvgIslandPicture(diagram.source, options);
|
|
236
|
+
case "chart":
|
|
237
|
+
return renderSquisqDiagramPicture(diagram.markdown, {
|
|
238
|
+
...options,
|
|
239
|
+
theme: withLargerLabels(settings(options).theme, CHART_LABEL_SCALE)
|
|
240
|
+
});
|
|
236
241
|
default:
|
|
237
242
|
return renderSquisqDiagramPicture(diagram.markdown, options);
|
|
238
243
|
}
|
|
239
244
|
};
|
|
240
245
|
}
|
|
246
|
+
var CHART_LABEL_SCALE = 1.5;
|
|
247
|
+
function withLargerLabels(theme, scale) {
|
|
248
|
+
return {
|
|
249
|
+
...theme,
|
|
250
|
+
typography: {
|
|
251
|
+
...theme.typography,
|
|
252
|
+
bodyScale: (theme.typography.bodyScale ?? 1) * scale
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
}
|
|
241
256
|
export {
|
|
242
257
|
EXPORT_FONT_STACK,
|
|
243
258
|
createDiagramPictureRenderer,
|