@tolokoban/impress 0.3.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -25
- package/dist/impress.js +1292 -423
- package/dist/styles.js +49 -71
- package/package.json +4 -4
package/dist/styles.js
CHANGED
|
@@ -19,6 +19,7 @@ export const defaultTheme = {
|
|
|
19
19
|
ink: "#222222",
|
|
20
20
|
muted: "#7A8899",
|
|
21
21
|
subtitle: "#FFD8B0",
|
|
22
|
+
sectionHighlight: "#FF9F43",
|
|
22
23
|
white: "#FFFFFF",
|
|
23
24
|
quoteBackground: "#F1F4F8",
|
|
24
25
|
promptBackground: "#DCEBFF",
|
|
@@ -64,13 +65,20 @@ export const defaultTheme = {
|
|
|
64
65
|
},
|
|
65
66
|
/** Geometry in cm (16:9 slide). */
|
|
66
67
|
slide: { width: 28, height: 15.75 },
|
|
67
|
-
content: { x: 1.2, y: 3.0, width: 25.6, height: 11.9, gap: 0.3 },
|
|
68
|
+
content: { x: 1.2, y: 3.0, width: 25.6, height: 11.9, gap: 0.3, align: "top" },
|
|
68
69
|
/** `@graph` diagrams. */
|
|
69
70
|
graph: {
|
|
70
|
-
/** Connector kind for edges: "curve", "line", "standard" (elbows) or "lines". */
|
|
71
|
-
connector: "curve",
|
|
72
71
|
/** Maximum enlargement of a diagram relative to its Graphviz size. */
|
|
73
72
|
maxScale: 1.5,
|
|
73
|
+
/** Resolution of the PNG rendered by Graphviz, in dots per inch. */
|
|
74
|
+
dpi: 300,
|
|
75
|
+
},
|
|
76
|
+
/** Every embedded image (graphs included) is stored as WebP. */
|
|
77
|
+
images: {
|
|
78
|
+
/** WebP quality, from 0 to 100. */
|
|
79
|
+
quality: 70,
|
|
80
|
+
/** Longest side in pixels: larger images are shrunk. */
|
|
81
|
+
maxSize: 3840,
|
|
74
82
|
},
|
|
75
83
|
/** Images of the master pages, styled by `Master-image` and `Section-image`. */
|
|
76
84
|
backgrounds: {
|
|
@@ -93,6 +101,15 @@ const bullets = {
|
|
|
93
101
|
indent: 0.9,
|
|
94
102
|
size: "80%",
|
|
95
103
|
};
|
|
104
|
+
const numbers = {
|
|
105
|
+
formats: ["1", "a", "i", "1", "a", "i", "1", "a", "i"],
|
|
106
|
+
suffix: ".",
|
|
107
|
+
color: "{colors.accent}",
|
|
108
|
+
size: "100%",
|
|
109
|
+
weight: "bold",
|
|
110
|
+
indent: 0.9,
|
|
111
|
+
width: 0.9,
|
|
112
|
+
};
|
|
96
113
|
function masterStyles(master) {
|
|
97
114
|
const isSection = master === "Section";
|
|
98
115
|
const styles = {
|
|
@@ -109,7 +126,18 @@ function masterStyles(master) {
|
|
|
109
126
|
},
|
|
110
127
|
[`${master}-subtitle`]: {
|
|
111
128
|
family: "presentation",
|
|
112
|
-
graphic: {
|
|
129
|
+
graphic: {
|
|
130
|
+
"draw:stroke": "none",
|
|
131
|
+
"draw:fill": "solid",
|
|
132
|
+
"draw:fill-color": "#000000",
|
|
133
|
+
"draw:opacity": "55%",
|
|
134
|
+
"draw:textarea-vertical-align": "middle",
|
|
135
|
+
"fo:padding-left": "0.8cm",
|
|
136
|
+
"fo:padding-right": "0.8cm",
|
|
137
|
+
...shrink,
|
|
138
|
+
},
|
|
139
|
+
// Bullets of the hierarchy box of section slides.
|
|
140
|
+
bullets: { ...bullets, color: "{colors.sectionHighlight}", indent: 1.2 },
|
|
113
141
|
paragraph: { "fo:text-align": "center" },
|
|
114
142
|
text: { ...sans, "fo:font-size": "{sizes.subtitle}pt", "fo:color": "{colors.subtitle}" },
|
|
115
143
|
},
|
|
@@ -119,6 +147,7 @@ function masterStyles(master) {
|
|
|
119
147
|
paragraph: { "fo:margin-top": "0.1cm", "fo:margin-bottom": "0.15cm", "fo:line-height": "105%" },
|
|
120
148
|
text: { ...sans, "fo:font-size": "{sizes.list.0}pt", "fo:color": "{colors.ink}" },
|
|
121
149
|
bullets,
|
|
150
|
+
numbers,
|
|
122
151
|
},
|
|
123
152
|
};
|
|
124
153
|
for (let level = 2; level <= 9; level++) {
|
|
@@ -232,6 +261,12 @@ const defaultStyles = {
|
|
|
232
261
|
"draw:stroke": "solid",
|
|
233
262
|
"svg:stroke-color": "{colors.primary}",
|
|
234
263
|
"svg:stroke-width": "0.03cm",
|
|
264
|
+
"draw:shadow": "visible",
|
|
265
|
+
"draw:shadow-offset-x": "0.1cm",
|
|
266
|
+
"draw:shadow-offset-y": "0.1cm",
|
|
267
|
+
"draw:shadow-color": "{colors.muted}",
|
|
268
|
+
"draw:shadow-opacity": "30%",
|
|
269
|
+
"loext:shadow-blur": "0.3cm",
|
|
235
270
|
"fo:padding-left": "0.6cm",
|
|
236
271
|
"fo:padding-right": "0.6cm",
|
|
237
272
|
"fo:padding-top": "0.4cm",
|
|
@@ -274,6 +309,12 @@ const defaultStyles = {
|
|
|
274
309
|
text: { ...mono, "fo:font-size": "{sizes.code}pt", "fo:color": "{colors.ink}" },
|
|
275
310
|
},
|
|
276
311
|
Image: { family: "graphic", parent: "standard", graphic: { "draw:stroke": "none", "draw:fill": "none" } },
|
|
312
|
+
/** `----`: horizontal rule. */
|
|
313
|
+
Separateur: {
|
|
314
|
+
family: "graphic",
|
|
315
|
+
parent: "standard",
|
|
316
|
+
graphic: { "draw:stroke": "solid", "svg:stroke-color": "{colors.muted}", "svg:stroke-width": "0.03cm" },
|
|
317
|
+
},
|
|
277
318
|
"Tableau-cadre": { family: "graphic", parent: "standard", graphic: { "draw:stroke": "none", "draw:fill": "none" } },
|
|
278
319
|
/** `@layout columns ...`: column headings and column text. */
|
|
279
320
|
"Colonne-titre": {
|
|
@@ -290,6 +331,7 @@ const defaultStyles = {
|
|
|
290
331
|
paragraph: { "fo:margin-bottom": "0.15cm" },
|
|
291
332
|
text: { "fo:font-size": "{sizes.columnText}pt" },
|
|
292
333
|
bullets,
|
|
334
|
+
numbers,
|
|
293
335
|
},
|
|
294
336
|
/** `@layout grid ...`: cell headings and cell bodies, colored by position. */
|
|
295
337
|
"Grille-titre": {
|
|
@@ -314,6 +356,7 @@ const defaultStyles = {
|
|
|
314
356
|
paragraph: { "fo:margin-bottom": "0.12cm" },
|
|
315
357
|
text: { "fo:font-size": "{sizes.gridText}pt" },
|
|
316
358
|
bullets,
|
|
359
|
+
numbers,
|
|
317
360
|
},
|
|
318
361
|
...gridStyles(),
|
|
319
362
|
/** Master page decorations. */
|
|
@@ -327,73 +370,6 @@ const defaultStyles = {
|
|
|
327
370
|
parent: "standard",
|
|
328
371
|
graphic: { "draw:fill": "solid", "draw:fill-color": "{colors.accent}", "draw:stroke": "none" },
|
|
329
372
|
},
|
|
330
|
-
/** `@graph` diagrams: nodes, clusters and edges. */
|
|
331
|
-
"Graphe-noeud": {
|
|
332
|
-
family: "graphic",
|
|
333
|
-
parent: "standard",
|
|
334
|
-
graphic: {
|
|
335
|
-
...shrink,
|
|
336
|
-
"draw:fill": "solid",
|
|
337
|
-
"draw:fill-color": "{colors.graphNode}",
|
|
338
|
-
"draw:stroke": "solid",
|
|
339
|
-
"svg:stroke-color": "{colors.primary}",
|
|
340
|
-
"svg:stroke-width": "0.03cm",
|
|
341
|
-
"draw:textarea-vertical-align": "middle",
|
|
342
|
-
"draw:textarea-horizontal-align": "center",
|
|
343
|
-
"fo:padding-left": "0.05cm",
|
|
344
|
-
"fo:padding-right": "0.05cm",
|
|
345
|
-
"fo:padding-top": "0.05cm",
|
|
346
|
-
"fo:padding-bottom": "0.05cm",
|
|
347
|
-
},
|
|
348
|
-
paragraph: { "fo:text-align": "center" },
|
|
349
|
-
text: { "fo:font-size": "{sizes.graphText}pt", "fo:color": "{colors.ink}" },
|
|
350
|
-
},
|
|
351
|
-
/** Nodes with `shape=plaintext` (or none). */
|
|
352
|
-
"Graphe-texte": {
|
|
353
|
-
family: "graphic",
|
|
354
|
-
parent: "Graphe-noeud",
|
|
355
|
-
graphic: { "draw:fill": "none", "draw:stroke": "none" },
|
|
356
|
-
},
|
|
357
|
-
/** Graph label (`graph [label=...]`). */
|
|
358
|
-
"Graphe-titre": {
|
|
359
|
-
family: "graphic",
|
|
360
|
-
parent: "Graphe-texte",
|
|
361
|
-
text: { "fo:font-weight": "bold", "fo:color": "{colors.primary}" },
|
|
362
|
-
},
|
|
363
|
-
"Graphe-groupe": {
|
|
364
|
-
family: "graphic",
|
|
365
|
-
parent: "standard",
|
|
366
|
-
graphic: {
|
|
367
|
-
"draw:fill": "solid",
|
|
368
|
-
"draw:fill-color": "{colors.graphCluster}",
|
|
369
|
-
"draw:stroke": "solid",
|
|
370
|
-
"svg:stroke-color": "{colors.muted}",
|
|
371
|
-
"svg:stroke-width": "0.02cm",
|
|
372
|
-
"draw:textarea-vertical-align": "top",
|
|
373
|
-
"draw:textarea-horizontal-align": "center",
|
|
374
|
-
"draw:auto-grow-height": "false",
|
|
375
|
-
},
|
|
376
|
-
paragraph: { "fo:text-align": "center" },
|
|
377
|
-
text: { "fo:font-size": "{sizes.graphEdgeText}pt", "fo:font-weight": "bold", "fo:color": "{colors.muted}" },
|
|
378
|
-
},
|
|
379
|
-
/** Edges without arrow (undirected graphs, `dir=none`). */
|
|
380
|
-
"Graphe-lien-simple": {
|
|
381
|
-
family: "graphic",
|
|
382
|
-
parent: "standard",
|
|
383
|
-
graphic: { "draw:stroke": "solid", "svg:stroke-color": "{colors.ink}", "svg:stroke-width": "0.03cm" },
|
|
384
|
-
text: { "fo:font-size": "{sizes.graphEdgeText}pt", "fo:color": "{colors.ink}" },
|
|
385
|
-
},
|
|
386
|
-
"Graphe-lien": {
|
|
387
|
-
family: "graphic",
|
|
388
|
-
parent: "Graphe-lien-simple",
|
|
389
|
-
graphic: { "draw:marker-end": "Fleche", "draw:marker-end-width": "0.3cm" },
|
|
390
|
-
},
|
|
391
|
-
/** Edges with `dir=both`. */
|
|
392
|
-
"Graphe-lien-double": {
|
|
393
|
-
family: "graphic",
|
|
394
|
-
parent: "Graphe-lien",
|
|
395
|
-
graphic: { "draw:marker-start": "Fleche", "draw:marker-start-width": "0.3cm" },
|
|
396
|
-
},
|
|
397
373
|
"Decor-ligne": {
|
|
398
374
|
family: "graphic",
|
|
399
375
|
parent: "standard",
|
|
@@ -424,5 +400,7 @@ export const defaultStyle = {
|
|
|
424
400
|
T_i: { "fo:font-style": "italic" },
|
|
425
401
|
T_bi: { "fo:font-weight": "bold", "fo:font-style": "italic" },
|
|
426
402
|
T_code: mono,
|
|
403
|
+
/** Highlighted section in the hierarchy box of a section slide. */
|
|
404
|
+
T_section: { "fo:font-weight": "bold", "fo:color": "{colors.sectionHighlight}" },
|
|
427
405
|
},
|
|
428
406
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolokoban/impress",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Convert teaching markdown files into LibreOffice Impress presentations (.odp)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"@hpcc-js/wasm-graphviz": "1.30.0"
|
|
46
|
-
},
|
|
47
44
|
"devDependencies": {
|
|
48
45
|
"@types/node": "^24.19.2",
|
|
49
46
|
"typescript": "^7.0.2"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"sharp": "0.35.5"
|
|
50
50
|
}
|
|
51
51
|
}
|