@5cover/lectern 0.0.0-stage → 0.1.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.
Files changed (48) hide show
  1. package/README.md +250 -2
  2. package/dist/Deck-C1ecJqVD.d.ts +110 -0
  3. package/dist/cli/index.js +768 -0
  4. package/dist/cli/index.js.map +1 -0
  5. package/dist/index.d.ts +144 -0
  6. package/dist/index.js +566 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/jsx-runtime.d.ts +1 -0
  9. package/dist/jsx-runtime.js +9 -0
  10. package/dist/jsx-runtime.js.map +1 -0
  11. package/dist/profiles/engie/index.d.ts +163 -0
  12. package/dist/profiles/engie/index.js +393 -0
  13. package/dist/profiles/engie/index.js.map +1 -0
  14. package/package.json +91 -3
  15. package/src/cli/build.ts +79 -0
  16. package/src/cli/dev.ts +58 -0
  17. package/src/cli/index.ts +126 -0
  18. package/src/cli/paths.ts +81 -0
  19. package/src/cli/pdf.ts +70 -0
  20. package/src/cli/render.ts +40 -0
  21. package/src/cli/rules.ts +31 -0
  22. package/src/cli/serve.ts +112 -0
  23. package/src/client/entry.ts +170 -0
  24. package/src/client/graph.tsx +207 -0
  25. package/src/components/Deck.tsx +19 -0
  26. package/src/components/InfographDiscovery.tsx +51 -0
  27. package/src/components/layout.tsx +145 -0
  28. package/src/components/mechanics.tsx +74 -0
  29. package/src/components/util.ts +12 -0
  30. package/src/index.ts +37 -0
  31. package/src/infographDiscovery.ts +188 -0
  32. package/src/infographDiscoveryView.tsx +202 -0
  33. package/src/jsx-runtime.ts +4 -0
  34. package/src/profiles/engie/assets/engie-logo-dark.svg +1 -0
  35. package/src/profiles/engie/assets/engie-logo-white.svg +6 -0
  36. package/src/profiles/engie/assets.d.ts +4 -0
  37. package/src/profiles/engie/atoms.tsx +203 -0
  38. package/src/profiles/engie/engie.css +916 -0
  39. package/src/profiles/engie/index.ts +44 -0
  40. package/src/profiles/engie/profile.ts +132 -0
  41. package/src/profiles/engie/slides.tsx +230 -0
  42. package/src/profiles/index.ts +30 -0
  43. package/src/profiles/types.ts +49 -0
  44. package/src/render/renderDeck.tsx +74 -0
  45. package/src/render/template.ts +68 -0
  46. package/src/types.ts +53 -0
  47. package/tsconfig.authoring.json +8 -0
  48. package/vite-env.d.ts +11 -0
package/dist/index.js ADDED
@@ -0,0 +1,566 @@
1
+ // src/jsx-runtime.ts
2
+ import { Fragment, jsx, jsx as jsx2, jsxs } from "preact/jsx-runtime";
3
+
4
+ // src/components/Deck.tsx
5
+ function Deck(props) {
6
+ return /* @__PURE__ */ jsx(Fragment, { children: props.children });
7
+ }
8
+ function isDeck(node) {
9
+ return typeof node === "object" && node !== null && "type" in node && node.type === Deck;
10
+ }
11
+
12
+ // src/components/util.ts
13
+ import { toChildArray } from "preact";
14
+ function cx(...parts) {
15
+ return parts.filter(Boolean).join(" ");
16
+ }
17
+ function children(nodes) {
18
+ return toChildArray(nodes);
19
+ }
20
+
21
+ // src/components/layout.tsx
22
+ var alignMap = {
23
+ start: "flex-start",
24
+ center: "center",
25
+ end: "flex-end",
26
+ stretch: "stretch"
27
+ };
28
+ var justifyMap = {
29
+ start: "flex-start",
30
+ center: "center",
31
+ end: "flex-end",
32
+ between: "space-between",
33
+ around: "space-around"
34
+ };
35
+ function mergeStyle(base, extra) {
36
+ if (extra == null) return base;
37
+ if (typeof extra === "string") {
38
+ const b = Object.entries(base).map(([k, v]) => `${k}:${v}`).join(";");
39
+ return `${b};${extra}`;
40
+ }
41
+ return { ...base, ...extra };
42
+ }
43
+ function Columns({
44
+ children: children2,
45
+ gap,
46
+ align = "stretch",
47
+ ratio,
48
+ tracks,
49
+ fill = false,
50
+ class: cls,
51
+ style
52
+ }) {
53
+ const cols = children(children2);
54
+ const usesGrid = tracks != null;
55
+ const base = {
56
+ display: usesGrid ? "grid" : "flex",
57
+ ...usesGrid ? { "grid-template-columns": tracks.join(" ") } : { "flex-direction": "row" },
58
+ gap: gap ?? "var(--lectern-gap, 1.5rem)",
59
+ "align-items": alignMap[align],
60
+ ...fill ? { flex: "1 1 0", "min-height": 0 } : {}
61
+ };
62
+ return /* @__PURE__ */ jsx("div", { class: cx("lectern-columns", fill && "is-fill", cls), style: mergeStyle(base, style), children: usesGrid ? cols : cols.map((child, i) => /* @__PURE__ */ jsx(
63
+ "div",
64
+ {
65
+ class: "lectern-col",
66
+ style: {
67
+ ...!usesGrid ? { flex: ratio?.[i] ?? 1 } : {},
68
+ "min-width": 0,
69
+ ...fill ? { display: "flex", "min-height": 0 } : {}
70
+ },
71
+ children: child
72
+ }
73
+ )) });
74
+ }
75
+ function Stack({ children: children2, gap, align, justify, fill = false, class: cls, style }) {
76
+ const base = {
77
+ display: "flex",
78
+ "flex-direction": "column",
79
+ gap: gap ?? "var(--lectern-gap, 1rem)"
80
+ };
81
+ if (fill) {
82
+ base.flex = "1 1 0";
83
+ base["min-height"] = "0";
84
+ }
85
+ if (align) base["align-items"] = alignMap[align];
86
+ if (justify) base["justify-content"] = justifyMap[justify];
87
+ return /* @__PURE__ */ jsx("div", { class: cx("lectern-stack", fill && "is-fill", cls), style: mergeStyle(base, style), children: children2 });
88
+ }
89
+ function Grid({ children: children2, cols = 2, gap, class: cls, style }) {
90
+ const base = {
91
+ display: "grid",
92
+ "grid-template-columns": `repeat(${cols}, minmax(0, 1fr))`,
93
+ gap: gap ?? "var(--lectern-gap, 1.5rem)"
94
+ };
95
+ return /* @__PURE__ */ jsx("div", { class: cx("lectern-grid", cls), style: mergeStyle(base, style), children: children2 });
96
+ }
97
+ function Spacer({ size = "1rem" }) {
98
+ return /* @__PURE__ */ jsx("div", { class: "lectern-spacer", style: { height: size }, "aria-hidden": "true" });
99
+ }
100
+
101
+ // src/infographDiscovery.ts
102
+ function toDiscoveryPayload(infograph) {
103
+ return {
104
+ nodes: [...infograph.nodes].map(([key, node]) => {
105
+ const [kind, id] = key.split(" ", 2);
106
+ return {
107
+ key,
108
+ kind,
109
+ id,
110
+ title: node.title,
111
+ ...node.summary ? { summary: node.summary } : {},
112
+ ...node.claim ? { claim: node.claim } : {},
113
+ ...node.date ? { date: { from: dateText(node.date.from), to: dateText(node.date.to) } } : {},
114
+ ...node.importance ? { importance: node.importance } : {},
115
+ complexity: node.complexity,
116
+ ...node.technicality ? { technicality: node.technicality } : {},
117
+ ...node.source ? { source: node.source } : {},
118
+ ...node.tag ? { tag: node.tag } : {}
119
+ };
120
+ }),
121
+ edges: infograph.edges.map((edge) => ({
122
+ key: `${edge.from} ${edge.verb} ${edge.to}`,
123
+ from: edge.from,
124
+ to: edge.to,
125
+ verb: edge.verb,
126
+ complexity: edge.info.complexity,
127
+ ...edge.info.technicality ? { technicality: edge.info.technicality } : {},
128
+ ...edge.info.claim ? { claim: edge.info.claim } : {}
129
+ }))
130
+ };
131
+ }
132
+ function validateDiscoverySeed(payload, seed) {
133
+ if (!payload.nodes.some((node) => node.key === seed)) throw new Error(`InfographDiscovery seed does not exist: ${seed}`);
134
+ }
135
+ function dateText(date) {
136
+ return date.toISOString().slice(0, 10);
137
+ }
138
+ function searchLabel(node) {
139
+ return `${node.title} \xB7 ${node.key}`;
140
+ }
141
+
142
+ // src/infographDiscoveryView.tsx
143
+ function InfographDiscoveryDetails({ payload, selection, searchId, onSearch }) {
144
+ const nodes = new Map(payload.nodes.map((node) => [node.key, node]));
145
+ const edges = new Map(payload.edges.map((edge) => [edge.key, edge]));
146
+ const selected = selection.type === "node" ? nodes.get(selection.key) : edges.get(selection.key);
147
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
148
+ /* @__PURE__ */ jsx(Search, { payload, id: searchId, onSearch }),
149
+ /* @__PURE__ */ jsx("div", { class: "lectern-infograph-details", children: selection.type === "node" ? /* @__PURE__ */ jsx(NodeDetails, { node: selected }) : /* @__PURE__ */ jsx(EdgeDetails, { edge: selected, nodes }) })
150
+ ] });
151
+ }
152
+ function Search({
153
+ payload,
154
+ id,
155
+ onSearch
156
+ }) {
157
+ const listId = `${id}-options`;
158
+ return /* @__PURE__ */ jsxs("div", { class: "lectern-infograph-search-slot", children: [
159
+ /* @__PURE__ */ jsx("label", { class: "lectern-infograph-discovery-search-label", for: id, children: "Acc\xE9der \xE0 un n\u0153ud" }),
160
+ /* @__PURE__ */ jsx(
161
+ "input",
162
+ {
163
+ class: "lectern-infograph-discovery-search",
164
+ id,
165
+ type: "search",
166
+ list: listId,
167
+ placeholder: "Rechercher un projet, un outil, un acteur\u2026",
168
+ onChange: (event) => onSearch?.(event.currentTarget.value)
169
+ }
170
+ ),
171
+ /* @__PURE__ */ jsx("datalist", { id: listId, children: payload.nodes.slice().sort((left, right) => left.title.localeCompare(right.title) || left.key.localeCompare(right.key)).map((node) => /* @__PURE__ */ jsx("option", { value: searchLabel(node) })) })
172
+ ] });
173
+ }
174
+ function NodeDetails({ node }) {
175
+ if (!node) return /* @__PURE__ */ jsx("p", { class: "lectern-infograph-empty", children: "N\u0153ud introuvable." });
176
+ return /* @__PURE__ */ jsxs("div", { class: "lectern-infograph-detail", children: [
177
+ /* @__PURE__ */ jsxs("div", { style: "gap:1em;display:flex;justify-content:space-between;align-items:center", children: [
178
+ /* @__PURE__ */ jsx("span", { class: "lectern-infograph-kind", children: node.kind }),
179
+ /* @__PURE__ */ jsx("span", { style: "text-align:center;", children: node.title }),
180
+ /* @__PURE__ */ jsx("span", { class: "lectern-infograph-key", style: "text-align:right", children: node.key })
181
+ ] }),
182
+ node.summary ? /* @__PURE__ */ jsx("p", { class: "lectern-infograph-summary", children: node.summary }) : null,
183
+ /* @__PURE__ */ jsx(Metadata, { value: node }),
184
+ /* @__PURE__ */ jsx(Claims, { claims: node.claim }),
185
+ /* @__PURE__ */ jsx(Sources, { sources: node.source })
186
+ ] });
187
+ }
188
+ function EdgeDetails({ edge, nodes }) {
189
+ if (!edge) return /* @__PURE__ */ jsx("p", { class: "lectern-infograph-empty", children: "Relation introuvable." });
190
+ return /* @__PURE__ */ jsxs("div", { class: "lectern-infograph-detail", children: [
191
+ /* @__PURE__ */ jsxs("div", { style: "gap:1em;display:flex;justify-content:space-between;align-items:center", children: [
192
+ /* @__PURE__ */ jsxs("span", { children: [
193
+ nodes.get(edge.from)?.title,
194
+ " ",
195
+ /* @__PURE__ */ jsx("span", { style: "font-weight:bold", children: edge.verb }),
196
+ " ",
197
+ nodes.get(edge.to)?.title
198
+ ] }),
199
+ /* @__PURE__ */ jsx("span", { class: "lectern-infograph-key", style: "text-align:right", children: edge.key })
200
+ ] }),
201
+ /* @__PURE__ */ jsx(Metadata, { value: edge }),
202
+ /* @__PURE__ */ jsx(Claims, { claims: edge.claim })
203
+ ] });
204
+ }
205
+ function Metadata({ value }) {
206
+ const period = value.date && (value.date.from === value.date.to ? value.date.from : /* @__PURE__ */ jsxs(Fragment, { children: [
207
+ value.date.from,
208
+ " \u2013 ",
209
+ value.date.to
210
+ ] }));
211
+ return /* @__PURE__ */ jsxs("dl", { class: "lectern-infograph-metadata", children: [
212
+ period ? /* @__PURE__ */ jsx(MetadataRow, { label: "P\xE9riode", children: period }) : null,
213
+ /* @__PURE__ */ jsx(Reason, { label: "Complexit\xE9", value: value.complexity }),
214
+ value.importance ? /* @__PURE__ */ jsx(Reason, { label: "Importance", value: value.importance }) : null,
215
+ value.technicality ? /* @__PURE__ */ jsx(Reason, { label: "Technicit\xE9", value: value.technicality }) : null,
216
+ value.tag?.length ? /* @__PURE__ */ jsx(MetadataRow, { label: "Tags", children: value.tag.join(" ") }) : null
217
+ ] });
218
+ }
219
+ function MetadataRow({ label, children: children2 }) {
220
+ return /* @__PURE__ */ jsxs("div", { children: [
221
+ /* @__PURE__ */ jsx("dt", { children: label }),
222
+ /* @__PURE__ */ jsx("dd", { children: children2 })
223
+ ] });
224
+ }
225
+ function Reason({ label, value }) {
226
+ return /* @__PURE__ */ jsxs(MetadataRow, { label, children: [
227
+ /* @__PURE__ */ jsx("strong", { children: value.is }),
228
+ /* @__PURE__ */ jsx(FlexList, { onePrefix: " : ", of: value.why })
229
+ ] });
230
+ }
231
+ function Claims({ claims }) {
232
+ if (!claims?.length) return null;
233
+ return /* @__PURE__ */ jsxs("div", { class: "lectern-infograph-section", "aria-label": "Claims", children: [
234
+ /* @__PURE__ */ jsx("h4", { children: "Claims" }),
235
+ /* @__PURE__ */ jsx(
236
+ FlexList,
237
+ {
238
+ of: claims.map((claim) => /* @__PURE__ */ jsxs(Fragment, { children: [
239
+ /* @__PURE__ */ jsx("strong", { children: claim.type }),
240
+ " : ",
241
+ claim.content
242
+ ] }))
243
+ }
244
+ )
245
+ ] });
246
+ }
247
+ function Sources({ sources }) {
248
+ if (!sources?.length) return null;
249
+ return /* @__PURE__ */ jsxs("div", { class: "lectern-infograph-section", "aria-label": "Sources", children: [
250
+ /* @__PURE__ */ jsx("h4", { children: "Sources" }),
251
+ /* @__PURE__ */ jsx(
252
+ FlexList,
253
+ {
254
+ of: sources.map((source) => /* @__PURE__ */ jsxs(Fragment, { children: [
255
+ /* @__PURE__ */ jsx("strong", { children: source.is }),
256
+ /* @__PURE__ */ jsx(FlexList, { onePrefix: " : ", of: source.why })
257
+ ] }))
258
+ }
259
+ )
260
+ ] });
261
+ }
262
+ function FlexList({ of, onePrefix = null }) {
263
+ return of.length > 1 ? /* @__PURE__ */ jsx("ul", { class: "lectern-infograph-reason", children: of.map((it) => /* @__PURE__ */ jsx("li", { children: it })) }) : of[0] ? /* @__PURE__ */ jsxs(Fragment, { children: [
264
+ onePrefix,
265
+ of[0]
266
+ ] }) : null;
267
+ }
268
+
269
+ // src/components/InfographDiscovery.tsx
270
+ function InfographDiscovery({
271
+ infograph,
272
+ seed,
273
+ relationBudget = 16,
274
+ class: cls,
275
+ style
276
+ }) {
277
+ if (!Number.isInteger(relationBudget) || relationBudget < 1)
278
+ throw new Error(`InfographDiscovery relationBudget must be a positive integer, got ${relationBudget}`);
279
+ const payload = toDiscoveryPayload(infograph);
280
+ validateDiscoverySeed(payload, seed);
281
+ const json = JSON.stringify(payload).replace(/</g, "\\u003c");
282
+ const searchId = `lectern-infograph-discovery-${encodeURIComponent(seed)}`;
283
+ return /* @__PURE__ */ jsxs(
284
+ "div",
285
+ {
286
+ class: cx("lectern-infograph-discovery", cls),
287
+ style,
288
+ "data-lectern-infograph-discovery": true,
289
+ "data-relation-budget": relationBudget,
290
+ "data-discovery-seed": seed,
291
+ children: [
292
+ /* @__PURE__ */ jsx("div", { class: "lectern-infograph-panel lectern-infograph-details-panel", children: /* @__PURE__ */ jsx(InfographDiscoveryDetails, { payload, selection: { type: "node", key: seed }, searchId }) }),
293
+ /* @__PURE__ */ jsx("div", { class: "lectern-infograph-panel lectern-infograph-neighborhood-panel", children: /* @__PURE__ */ jsx("div", { class: "lectern-infograph-graph", "aria-label": "Sous-graphe explor\xE9 autour de la s\xE9lection" }) }),
294
+ /* @__PURE__ */ jsx("script", { type: "application/json", class: "lectern-infograph-data", dangerouslySetInnerHTML: { __html: json } })
295
+ ]
296
+ }
297
+ );
298
+ }
299
+
300
+ // src/components/mechanics.tsx
301
+ function Code({ children: children2, lang, lineNumbers, class: cls, style }) {
302
+ const dataLineNumbers = typeof lineNumbers === "string" ? lineNumbers : lineNumbers ? "" : void 0;
303
+ return /* @__PURE__ */ jsx("pre", { class: cx("lectern-code", cls), style, children: /* @__PURE__ */ jsx("code", { class: lang ? `language-${lang}` : void 0, "data-trim": true, "data-line-numbers": dataLineNumbers, children: children2 }) });
304
+ }
305
+ function Mermaid({ children: children2, class: cls, style }) {
306
+ return /* @__PURE__ */ jsx("pre", { class: cx("mermaid", cls), style, children: children2 });
307
+ }
308
+ function Notes({ children: children2 }) {
309
+ return /* @__PURE__ */ jsx("aside", { class: "notes", children: children2 });
310
+ }
311
+ function Fragment2({ children: children2, type, index }) {
312
+ return /* @__PURE__ */ jsx("span", { class: cx("fragment", type), "data-fragment-index": index, children: children2 });
313
+ }
314
+ function Raw({ html }) {
315
+ return /* @__PURE__ */ jsx("div", { class: "lectern-raw", dangerouslySetInnerHTML: { __html: html } });
316
+ }
317
+
318
+ // src/render/renderDeck.tsx
319
+ import { Fragment as Fragment3, h } from "preact";
320
+ import { render } from "preact-render-to-string";
321
+
322
+ // src/profiles/engie/profile.ts
323
+ var engie = {
324
+ name: "engie",
325
+ label: "ENGIE / Fluid",
326
+ description: "ENGIE corporate house style (Fluid design system): navy #17255F & ENGIE blue #007bc5, Fluid typography, 16:9.",
327
+ stylesheet: "@5cover/lectern/engie.css",
328
+ reveal: {
329
+ // 16:9 design canvas. Reveal scales this scene to the available viewport
330
+ // while preserving its proportions.
331
+ width: 1280,
332
+ height: 720,
333
+ slideNumber: "c/t",
334
+ // Corporate decks are top-anchored (title at top, logo pinned to the corner),
335
+ // not vertically centred — so disable reveal's vertical centering.
336
+ center: false,
337
+ margin: 0
338
+ },
339
+ rules: [
340
+ {
341
+ title: "Structure & titles",
342
+ rules: [
343
+ {
344
+ id: "presentation-title-lines",
345
+ statement: "The cover title fits in two or three lines maximum.",
346
+ severity: "should"
347
+ },
348
+ {
349
+ id: "slide-title-lines",
350
+ statement: "A slide title is two or three lines maximum \u2014 ideally one. The subtitle is one line maximum.",
351
+ severity: "should"
352
+ },
353
+ {
354
+ id: "two-title-levels",
355
+ statement: "Use a second title level (title + subtitle) only when it genuinely adds structure.",
356
+ severity: "advisory"
357
+ },
358
+ {
359
+ id: "chapters-numbered",
360
+ statement: "Introduce each chapter with a numbered section divider (01, 02, \u2026); a Summary slide lists the chapters.",
361
+ severity: "should"
362
+ },
363
+ {
364
+ id: "one-idea-per-slide",
365
+ statement: "Prefer one message per slide; keep body copy concise.",
366
+ severity: "advisory"
367
+ }
368
+ ]
369
+ },
370
+ {
371
+ title: "Confidentiality & rights",
372
+ rules: [
373
+ {
374
+ id: "confidentiality-level",
375
+ statement: "Every deck declares a confidentiality level: Non-confidential, Confidential, or Strictly confidential.",
376
+ severity: "must"
377
+ },
378
+ {
379
+ id: "visual-rights",
380
+ statement: "Iconography and visuals are for internal use only \u2014 verify the rights of every visual you include.",
381
+ severity: "must"
382
+ }
383
+ ]
384
+ },
385
+ {
386
+ title: "Footer",
387
+ rules: [
388
+ {
389
+ id: "footer-format",
390
+ statement: 'Footer format: "\xA9 ENGIE {year} - {presentation title} - {date} - {page}".',
391
+ severity: "should"
392
+ }
393
+ ]
394
+ },
395
+ {
396
+ title: "Colours",
397
+ rules: [
398
+ {
399
+ id: "primary-colours",
400
+ statement: "Primary palette: navy #17255F, ENGIE blue #007bc5, teal #00817d, purple #6c4796.",
401
+ severity: "should"
402
+ },
403
+ {
404
+ id: "accent-colours",
405
+ statement: "Accent palette: coral #eb5d40, magenta #e94287, yellow #f4c867 \u2014 use for emphasis, sparingly.",
406
+ severity: "advisory"
407
+ },
408
+ {
409
+ id: "secondary-colours",
410
+ statement: "Secondary palette: #e18554, #4bb0b9, #67ae6e, #278cbc. Tints at 50% and 20% are available for backgrounds.",
411
+ severity: "advisory"
412
+ }
413
+ ]
414
+ },
415
+ {
416
+ title: "Typography",
417
+ rules: [
418
+ {
419
+ id: "fonts",
420
+ statement: "Typography follows the Fluid design system (Lato, with system fallbacks); titles are bold, body is regular.",
421
+ severity: "should"
422
+ }
423
+ ]
424
+ },
425
+ {
426
+ title: "Format & figures",
427
+ rules: [
428
+ {
429
+ id: "aspect-ratio",
430
+ statement: "Slides are 16:9.",
431
+ severity: "must"
432
+ },
433
+ {
434
+ id: "kpi-style",
435
+ statement: 'Highlight key figures as a large number with a short label (e.g. "9-10 Md\u20AC").',
436
+ severity: "advisory"
437
+ }
438
+ ]
439
+ }
440
+ ]
441
+ };
442
+
443
+ // src/profiles/index.ts
444
+ var profiles = {
445
+ engie
446
+ };
447
+ var DEFAULT_PROFILE = "engie";
448
+ function getProfile(name) {
449
+ return profiles[name ?? DEFAULT_PROFILE];
450
+ }
451
+ function profileNames() {
452
+ return Object.keys(profiles);
453
+ }
454
+ function resolveProfile(profile) {
455
+ if (typeof profile === "object") return profile;
456
+ const found = getProfile(profile);
457
+ if (!found) throw new Error(`Unknown profile: "${profile}". Available: ${profileNames().join(", ")}`);
458
+ return found;
459
+ }
460
+
461
+ // src/render/template.ts
462
+ function escapeHtml(s) {
463
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
464
+ }
465
+ function configScript(meta) {
466
+ const config = {
467
+ profile: meta.profile,
468
+ transition: meta.transition ?? "slide",
469
+ reveal: meta.reveal ?? {}
470
+ };
471
+ const json = JSON.stringify(config).replace(/</g, "\\u003c");
472
+ return `<script type="application/json" id="lectern-config">${json}</script>`;
473
+ }
474
+ function footer(meta) {
475
+ if (!meta.footer && !meta.author) return "";
476
+ const parts = [];
477
+ if (meta.author) parts.push(`<span class="lectern-footer-brand">${escapeHtml(meta.author)}</span>`);
478
+ if (meta.footer) parts.push(`<span>${escapeHtml(meta.footer)}</span>`);
479
+ return `<div class="lectern-footer">${parts.join(`<span class="lectern-sep"> \xB7 </span>`)}</div>`;
480
+ }
481
+ function htmlShell({ meta, slidesHtml, bodyScripts, headTags }) {
482
+ return `<!doctype html>
483
+ <html lang="fr">
484
+ <head>
485
+ <meta charset="utf-8" />
486
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
487
+ <title>${escapeHtml(meta.title)}</title>
488
+ ${headTags}
489
+ </head>
490
+ <body>
491
+ <div class="reveal profile-${meta.profile}">
492
+ <div class="slides">
493
+ ${slidesHtml}
494
+ </div>
495
+ ${footer(meta)}
496
+ </div>
497
+ ${configScript(meta)}
498
+ ${bodyScripts}
499
+ </body>
500
+ </html>`;
501
+ }
502
+
503
+ // src/render/renderDeck.tsx
504
+ var DEFAULT_META = {
505
+ title: "Untitled deck",
506
+ profile: DEFAULT_PROFILE,
507
+ transition: "slide"
508
+ };
509
+ function renderDeck(deck) {
510
+ let meta = { ...DEFAULT_META };
511
+ let slides = deck;
512
+ let root = deck;
513
+ if (!Array.isArray(deck) && !isDeck(deck) && typeof deck?.type === "function") {
514
+ try {
515
+ const inner = deck.type;
516
+ const unwrapped = inner(deck.props);
517
+ if (unwrapped && isDeck(unwrapped)) root = unwrapped;
518
+ } catch {
519
+ }
520
+ }
521
+ if (!Array.isArray(deck) && isDeck(root)) {
522
+ const { children: children2, ...rest } = root.props;
523
+ meta = { ...DEFAULT_META, ...rest };
524
+ slides = children2;
525
+ }
526
+ const profile = resolveProfile(meta.profile);
527
+ const resolved = {
528
+ ...meta,
529
+ profile: profile.name,
530
+ reveal: { ...profile.reveal, ...meta.reveal }
531
+ };
532
+ const slidesHtml = render(h(Fragment3, null, slides));
533
+ return { meta: resolved, profile, slidesHtml };
534
+ }
535
+ function renderToHtml(deck, options = {}) {
536
+ const { meta, slidesHtml } = renderDeck(deck);
537
+ return htmlShell({
538
+ meta: { ...meta, ...options.meta },
539
+ slidesHtml,
540
+ bodyScripts: options.bodyScripts ?? "",
541
+ headTags: options.headTags ?? ""
542
+ });
543
+ }
544
+ export {
545
+ Code,
546
+ Columns,
547
+ DEFAULT_PROFILE,
548
+ Deck,
549
+ Fragment2 as Fragment,
550
+ Grid,
551
+ InfographDiscovery,
552
+ Mermaid,
553
+ Notes,
554
+ Raw,
555
+ Spacer,
556
+ Stack,
557
+ cx,
558
+ getProfile,
559
+ isDeck,
560
+ profileNames,
561
+ profiles,
562
+ renderDeck,
563
+ renderToHtml,
564
+ resolveProfile
565
+ };
566
+ //# sourceMappingURL=index.js.map