@tolokoban/impress 0.1.0 → 0.13.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 +99 -30
- package/dist/impress.js +911 -407
- package/dist/styles.js +46 -71
- package/package.json +4 -4
package/dist/styles.js
CHANGED
|
@@ -64,13 +64,25 @@ export const defaultTheme = {
|
|
|
64
64
|
},
|
|
65
65
|
/** Geometry in cm (16:9 slide). */
|
|
66
66
|
slide: { width: 28, height: 15.75 },
|
|
67
|
-
content: { x: 1.2, y: 3.0, width: 25.6, height: 11.9, gap: 0.3 },
|
|
67
|
+
content: { x: 1.2, y: 3.0, width: 25.6, height: 11.9, gap: 0.3, align: "top" },
|
|
68
68
|
/** `@graph` diagrams. */
|
|
69
69
|
graph: {
|
|
70
|
-
/** Connector kind for edges: "curve", "line", "standard" (elbows) or "lines". */
|
|
71
|
-
connector: "curve",
|
|
72
70
|
/** Maximum enlargement of a diagram relative to its Graphviz size. */
|
|
73
71
|
maxScale: 1.5,
|
|
72
|
+
/** Resolution of the PNG rendered by Graphviz, in dots per inch. */
|
|
73
|
+
dpi: 300,
|
|
74
|
+
},
|
|
75
|
+
/** Every embedded image (graphs included) is stored as WebP. */
|
|
76
|
+
images: {
|
|
77
|
+
/** WebP quality, from 0 to 100. */
|
|
78
|
+
quality: 70,
|
|
79
|
+
/** Longest side in pixels: larger images are shrunk. */
|
|
80
|
+
maxSize: 3840,
|
|
81
|
+
},
|
|
82
|
+
/** Images of the master pages, styled by `Master-image` and `Section-image`. */
|
|
83
|
+
backgrounds: {
|
|
84
|
+
Master: { image: "", fit: "stretch" },
|
|
85
|
+
Section: { image: "", fit: "stretch" },
|
|
74
86
|
},
|
|
75
87
|
};
|
|
76
88
|
const sans = { "fo:font-family": "{fonts.sans}", "style:font-family-generic": "swiss" };
|
|
@@ -88,6 +100,15 @@ const bullets = {
|
|
|
88
100
|
indent: 0.9,
|
|
89
101
|
size: "80%",
|
|
90
102
|
};
|
|
103
|
+
const numbers = {
|
|
104
|
+
formats: ["1", "a", "i", "1", "a", "i", "1", "a", "i"],
|
|
105
|
+
suffix: ".",
|
|
106
|
+
color: "{colors.accent}",
|
|
107
|
+
size: "100%",
|
|
108
|
+
weight: "bold",
|
|
109
|
+
indent: 0.9,
|
|
110
|
+
width: 0.9,
|
|
111
|
+
};
|
|
91
112
|
function masterStyles(master) {
|
|
92
113
|
const isSection = master === "Section";
|
|
93
114
|
const styles = {
|
|
@@ -114,6 +135,7 @@ function masterStyles(master) {
|
|
|
114
135
|
paragraph: { "fo:margin-top": "0.1cm", "fo:margin-bottom": "0.15cm", "fo:line-height": "105%" },
|
|
115
136
|
text: { ...sans, "fo:font-size": "{sizes.list.0}pt", "fo:color": "{colors.ink}" },
|
|
116
137
|
bullets,
|
|
138
|
+
numbers,
|
|
117
139
|
},
|
|
118
140
|
};
|
|
119
141
|
for (let level = 2; level <= 9; level++) {
|
|
@@ -130,6 +152,18 @@ function masterStyles(master) {
|
|
|
130
152
|
paragraph: { "fo:margin-bottom": "0.2cm" },
|
|
131
153
|
text: { ...sans, "fo:font-size": "{sizes.notes}pt", "fo:color": "{colors.ink}" },
|
|
132
154
|
};
|
|
155
|
+
styles[`${master}-image`] = {
|
|
156
|
+
family: "graphic",
|
|
157
|
+
parent: "standard",
|
|
158
|
+
graphic: {
|
|
159
|
+
"draw:stroke": "none",
|
|
160
|
+
"draw:fill": "none",
|
|
161
|
+
"draw:image-opacity": "100%",
|
|
162
|
+
"draw:color-mode": "standard",
|
|
163
|
+
"draw:luminance": "0%",
|
|
164
|
+
"draw:contrast": "0%",
|
|
165
|
+
},
|
|
166
|
+
};
|
|
133
167
|
styles[`${master}-background`] = { family: "presentation", graphic: { "draw:stroke": "none", "draw:fill": "none" } };
|
|
134
168
|
styles[`${master}-backgroundobjects`] = { family: "presentation", graphic: { "draw:shadow": "hidden" } };
|
|
135
169
|
return styles;
|
|
@@ -215,6 +249,12 @@ const defaultStyles = {
|
|
|
215
249
|
"draw:stroke": "solid",
|
|
216
250
|
"svg:stroke-color": "{colors.primary}",
|
|
217
251
|
"svg:stroke-width": "0.03cm",
|
|
252
|
+
"draw:shadow": "visible",
|
|
253
|
+
"draw:shadow-offset-x": "0.1cm",
|
|
254
|
+
"draw:shadow-offset-y": "0.1cm",
|
|
255
|
+
"draw:shadow-color": "{colors.muted}",
|
|
256
|
+
"draw:shadow-opacity": "30%",
|
|
257
|
+
"loext:shadow-blur": "0.3cm",
|
|
218
258
|
"fo:padding-left": "0.6cm",
|
|
219
259
|
"fo:padding-right": "0.6cm",
|
|
220
260
|
"fo:padding-top": "0.4cm",
|
|
@@ -273,6 +313,7 @@ const defaultStyles = {
|
|
|
273
313
|
paragraph: { "fo:margin-bottom": "0.15cm" },
|
|
274
314
|
text: { "fo:font-size": "{sizes.columnText}pt" },
|
|
275
315
|
bullets,
|
|
316
|
+
numbers,
|
|
276
317
|
},
|
|
277
318
|
/** `@layout grid ...`: cell headings and cell bodies, colored by position. */
|
|
278
319
|
"Grille-titre": {
|
|
@@ -297,6 +338,7 @@ const defaultStyles = {
|
|
|
297
338
|
paragraph: { "fo:margin-bottom": "0.12cm" },
|
|
298
339
|
text: { "fo:font-size": "{sizes.gridText}pt" },
|
|
299
340
|
bullets,
|
|
341
|
+
numbers,
|
|
300
342
|
},
|
|
301
343
|
...gridStyles(),
|
|
302
344
|
/** Master page decorations. */
|
|
@@ -310,79 +352,12 @@ const defaultStyles = {
|
|
|
310
352
|
parent: "standard",
|
|
311
353
|
graphic: { "draw:fill": "solid", "draw:fill-color": "{colors.accent}", "draw:stroke": "none" },
|
|
312
354
|
},
|
|
313
|
-
/** `@graph` diagrams: nodes, clusters and edges. */
|
|
314
|
-
"Graphe-noeud": {
|
|
315
|
-
family: "graphic",
|
|
316
|
-
parent: "standard",
|
|
317
|
-
graphic: {
|
|
318
|
-
...shrink,
|
|
319
|
-
"draw:fill": "solid",
|
|
320
|
-
"draw:fill-color": "{colors.graphNode}",
|
|
321
|
-
"draw:stroke": "solid",
|
|
322
|
-
"svg:stroke-color": "{colors.primary}",
|
|
323
|
-
"svg:stroke-width": "0.03cm",
|
|
324
|
-
"draw:textarea-vertical-align": "middle",
|
|
325
|
-
"draw:textarea-horizontal-align": "center",
|
|
326
|
-
"fo:padding-left": "0.05cm",
|
|
327
|
-
"fo:padding-right": "0.05cm",
|
|
328
|
-
"fo:padding-top": "0.05cm",
|
|
329
|
-
"fo:padding-bottom": "0.05cm",
|
|
330
|
-
},
|
|
331
|
-
paragraph: { "fo:text-align": "center" },
|
|
332
|
-
text: { "fo:font-size": "{sizes.graphText}pt", "fo:color": "{colors.ink}" },
|
|
333
|
-
},
|
|
334
|
-
/** Nodes with `shape=plaintext` (or none). */
|
|
335
|
-
"Graphe-texte": {
|
|
336
|
-
family: "graphic",
|
|
337
|
-
parent: "Graphe-noeud",
|
|
338
|
-
graphic: { "draw:fill": "none", "draw:stroke": "none" },
|
|
339
|
-
},
|
|
340
|
-
/** Graph label (`graph [label=...]`). */
|
|
341
|
-
"Graphe-titre": {
|
|
342
|
-
family: "graphic",
|
|
343
|
-
parent: "Graphe-texte",
|
|
344
|
-
text: { "fo:font-weight": "bold", "fo:color": "{colors.primary}" },
|
|
345
|
-
},
|
|
346
|
-
"Graphe-groupe": {
|
|
347
|
-
family: "graphic",
|
|
348
|
-
parent: "standard",
|
|
349
|
-
graphic: {
|
|
350
|
-
"draw:fill": "solid",
|
|
351
|
-
"draw:fill-color": "{colors.graphCluster}",
|
|
352
|
-
"draw:stroke": "solid",
|
|
353
|
-
"svg:stroke-color": "{colors.muted}",
|
|
354
|
-
"svg:stroke-width": "0.02cm",
|
|
355
|
-
"draw:textarea-vertical-align": "top",
|
|
356
|
-
"draw:textarea-horizontal-align": "center",
|
|
357
|
-
"draw:auto-grow-height": "false",
|
|
358
|
-
},
|
|
359
|
-
paragraph: { "fo:text-align": "center" },
|
|
360
|
-
text: { "fo:font-size": "{sizes.graphEdgeText}pt", "fo:font-weight": "bold", "fo:color": "{colors.muted}" },
|
|
361
|
-
},
|
|
362
|
-
/** Edges without arrow (undirected graphs, `dir=none`). */
|
|
363
|
-
"Graphe-lien-simple": {
|
|
364
|
-
family: "graphic",
|
|
365
|
-
parent: "standard",
|
|
366
|
-
graphic: { "draw:stroke": "solid", "svg:stroke-color": "{colors.ink}", "svg:stroke-width": "0.03cm" },
|
|
367
|
-
text: { "fo:font-size": "{sizes.graphEdgeText}pt", "fo:color": "{colors.ink}" },
|
|
368
|
-
},
|
|
369
|
-
"Graphe-lien": {
|
|
370
|
-
family: "graphic",
|
|
371
|
-
parent: "Graphe-lien-simple",
|
|
372
|
-
graphic: { "draw:marker-end": "Fleche", "draw:marker-end-width": "0.3cm" },
|
|
373
|
-
},
|
|
374
|
-
/** Edges with `dir=both`. */
|
|
375
|
-
"Graphe-lien-double": {
|
|
376
|
-
family: "graphic",
|
|
377
|
-
parent: "Graphe-lien",
|
|
378
|
-
graphic: { "draw:marker-start": "Fleche", "draw:marker-start-width": "0.3cm" },
|
|
379
|
-
},
|
|
380
355
|
"Decor-ligne": {
|
|
381
356
|
family: "graphic",
|
|
382
357
|
parent: "standard",
|
|
383
358
|
graphic: { "draw:stroke": "solid", "svg:stroke-color": "{colors.primary}", "svg:stroke-width": "0.04cm" },
|
|
384
359
|
},
|
|
385
|
-
...masterStyles("
|
|
360
|
+
...masterStyles("Master"),
|
|
386
361
|
...masterStyles("Section"),
|
|
387
362
|
...tableStyles("Tableau", "{sizes.table}pt"),
|
|
388
363
|
...tableStyles("Tableau-petit", "{sizes.tableSmall}pt"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolokoban/impress",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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
|
}
|