@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.
- package/README.md +250 -2
- package/dist/Deck-C1ecJqVD.d.ts +110 -0
- package/dist/cli/index.js +768 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.js +566 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-runtime.d.ts +1 -0
- package/dist/jsx-runtime.js +9 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/profiles/engie/index.d.ts +163 -0
- package/dist/profiles/engie/index.js +393 -0
- package/dist/profiles/engie/index.js.map +1 -0
- package/package.json +91 -3
- package/src/cli/build.ts +79 -0
- package/src/cli/dev.ts +58 -0
- package/src/cli/index.ts +126 -0
- package/src/cli/paths.ts +81 -0
- package/src/cli/pdf.ts +70 -0
- package/src/cli/render.ts +40 -0
- package/src/cli/rules.ts +31 -0
- package/src/cli/serve.ts +112 -0
- package/src/client/entry.ts +170 -0
- package/src/client/graph.tsx +207 -0
- package/src/components/Deck.tsx +19 -0
- package/src/components/InfographDiscovery.tsx +51 -0
- package/src/components/layout.tsx +145 -0
- package/src/components/mechanics.tsx +74 -0
- package/src/components/util.ts +12 -0
- package/src/index.ts +37 -0
- package/src/infographDiscovery.ts +188 -0
- package/src/infographDiscoveryView.tsx +202 -0
- package/src/jsx-runtime.ts +4 -0
- package/src/profiles/engie/assets/engie-logo-dark.svg +1 -0
- package/src/profiles/engie/assets/engie-logo-white.svg +6 -0
- package/src/profiles/engie/assets.d.ts +4 -0
- package/src/profiles/engie/atoms.tsx +203 -0
- package/src/profiles/engie/engie.css +916 -0
- package/src/profiles/engie/index.ts +44 -0
- package/src/profiles/engie/profile.ts +132 -0
- package/src/profiles/engie/slides.tsx +230 -0
- package/src/profiles/index.ts +30 -0
- package/src/profiles/types.ts +49 -0
- package/src/render/renderDeck.tsx +74 -0
- package/src/render/template.ts +68 -0
- package/src/types.ts +53 -0
- package/tsconfig.authoring.json +8 -0
- package/vite-env.d.ts +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/rules.ts","../../src/render/template.ts","../../src/cli/paths.ts","../../src/cli/render.ts","../../src/cli/build.ts","../../src/profiles/engie/profile.ts","../../src/profiles/index.ts","../../src/cli/dev.ts","../../src/cli/serve.ts","../../src/cli/pdf.ts","../../src/cli/index.ts"],"sourcesContent":["import type { Profile, RuleSeverity } from '../profiles/types'\n\nconst SEVERITY_LABEL: Record<RuleSeverity, string> = {\n must: 'MUST',\n should: 'SHOULD',\n advisory: 'ADVISORY',\n}\n\nconst useColor = process.stdout.isTTY\nconst bold = (s: string) => (useColor ? `\\x1b[1m${s}\\x1b[0m` : s)\nconst dim = (s: string) => (useColor ? `\\x1b[2m${s}\\x1b[0m` : s)\nconst blue = (s: string) => (useColor ? `\\x1b[38;5;39m${s}\\x1b[0m` : s)\n\n/** Print a profile's natural-language rulebook. */\nexport function rules(profile: Profile): void {\n console.log()\n console.log(` ${bold(profile.label)} ${dim(`(${profile.name})`)} — presentation rules`)\n console.log(` ${dim(profile.description)}`)\n\n for (const group of profile.rules) {\n console.log()\n console.log(` ${blue(`▸ ${group.title}`)}`)\n for (const r of group.rules) {\n const tag = `[${SEVERITY_LABEL[r.severity]}]`.padEnd(11)\n console.log(` ${dim(tag)} ${r.statement}`)\n }\n }\n console.log()\n console.log(dim(` Guidelines are descriptive; linting is not implemented yet.`))\n console.log()\n}\n","import type { ResolvedDeckMeta } from '../types'\n\nexport interface ShellInput {\n meta: ResolvedDeckMeta\n slidesHtml: string\n /**\n * Injected before `</body>`\n *\n * Typically the bundled client entry script.\n */\n bodyScripts: string\n /**\n * Injected into `<head>`\n *\n * Extra CSS/link tags.\n */\n headTags: string\n}\n\nfunction escapeHtml(s: string): string {\n return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"')\n}\n\n/** Serialize deck config for the client, safe to embed in a `<script>`. */\nfunction configScript(meta: ResolvedDeckMeta): string {\n const config = {\n profile: meta.profile,\n transition: meta.transition ?? 'slide',\n reveal: meta.reveal ?? {},\n }\n // Escape `<` to avoid breaking out of the script element.\n const json = JSON.stringify(config).replace(/</g, '\\\\u003c')\n return `<script type=\"application/json\" id=\"lectern-config\">${json}</script>`\n}\n\nfunction footer(meta: ResolvedDeckMeta): string {\n if (!meta.footer && !meta.author) return ''\n const parts: string[] = []\n if (meta.author) parts.push(`<span class=\"lectern-footer-brand\">${escapeHtml(meta.author)}</span>`)\n if (meta.footer) parts.push(`<span>${escapeHtml(meta.footer)}</span>`)\n return `<div class=\"lectern-footer\">${parts.join(`<span class=\"lectern-sep\"> · </span>`)}</div>`\n}\n\n/**\n * Assemble the complete HTML document. The client entry (bundled by the CLI)\n * imports all CSS/JS, so the <head> here stays minimal.\n */\nexport function htmlShell({ meta, slidesHtml, bodyScripts, headTags }: ShellInput): string {\n return `<!doctype html>\n<html lang=\"fr\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\" />\n <title>${escapeHtml(meta.title)}</title>\n ${headTags}\n </head>\n <body>\n <div class=\"reveal profile-${meta.profile}\">\n <div class=\"slides\">\n${slidesHtml}\n </div>\n ${footer(meta)}\n </div>\n ${configScript(meta)}\n ${bodyScripts}\n </body>\n</html>`\n}\n","import { existsSync } from 'node:fs'\nimport { isAbsolute, join, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { Profile } from '../profiles/types'\n\n/** Convert any OS path to a POSIX-style path (safe in import specifiers / Vite ids). */\nexport function posix(p: string): string {\n return p.replace(/\\\\/g, '/')\n}\n\n/** Package root: two levels up from src/cli or dist/cli. */\nexport const PACKAGE_ROOT = resolve(import.meta.dirname, '..', '..')\n\n/**\n * Prefer running from source (`src/`), the client entry imports raw CSS which only Vite should process. Fall back to `dist/` for an installed package.\n */\nfunction pickBase(): string {\n const srcClient = join(PACKAGE_ROOT, 'src', 'client', 'entry.ts')\n if (existsSync(srcClient)) return join(PACKAGE_ROOT, 'src')\n return join(PACKAGE_ROOT, 'dist')\n}\n\nconst BASE = pickBase()\n\nfunction firstExisting(...candidates: string[]): string {\n for (const c of candidates) if (existsSync(c)) return c\n return candidates[0]\n}\n\n/** Absolute path to the browser client entry (Vite processes it). */\nexport const CLIENT_ENTRY = firstExisting(join(BASE, 'client', 'entry.ts'), join(BASE, 'client', 'entry.js'))\n\n/** Absolute path to the SSR renderDeck module. */\nexport const RENDER_MODULE = firstExisting(\n join(BASE, 'render', 'renderDeck.tsx'),\n join(BASE, 'render', 'renderDeck.ts'),\n join(BASE, 'render', 'renderDeck.js'),\n join(PACKAGE_ROOT, 'dist', 'index.js')\n)\n\n/** Public package entry, used for the `lectern` alias during in-repo runs. */\nconst INDEX_MODULE = firstExisting(join(BASE, 'index.ts'), join(PACKAGE_ROOT, 'dist', 'index.js'))\nconst JSX_MODULE = firstExisting(join(BASE, 'jsx-runtime.ts'), join(PACKAGE_ROOT, 'dist', 'jsx-runtime.js'))\nconst ENGIE_MODULE = firstExisting(\n join(BASE, 'profiles', 'engie', 'index.ts'),\n join(PACKAGE_ROOT, 'dist', 'profiles', 'engie', 'index.js')\n)\nconst ENGIE_STYLESHEET = join(PACKAGE_ROOT, 'src', 'profiles', 'engie', 'engie.css')\n\n/**\n * Source of the browser entry module: lectern's client runtime, then the\n * profile's stylesheet, so profile rules come last in the cascade.\n */\nexport function clientEntrySource(profile: Profile): string {\n const imports = [posix(CLIENT_ENTRY)]\n const { stylesheet } = profile\n if (stylesheet) {\n const spec = String(stylesheet)\n imports.push(spec.startsWith('file:') ? posix(fileURLToPath(spec)) : isAbsolute(spec) ? posix(spec) : spec)\n }\n return imports.map(i => `import ${JSON.stringify(i)};`).join('\\n')\n}\n\n/**\n * When running inside the `lectern` repo, decks import the bare `lectern` specifier, which node_modules can't resolve (this *is* that package).\n * Alias it to the local source. Harmless for installed usage (the real package resolves first, this alias only kicks in when it points at src).\n */\nexport function presentAlias(): Array<{ find: RegExp; replacement: string }> {\n return [\n { find: /^@5cover\\/lectern$/, replacement: INDEX_MODULE },\n { find: /^@5cover\\/lectern\\/jsx-runtime$/, replacement: JSX_MODULE },\n { find: /^@5cover\\/lectern\\/jsx-dev-runtime$/, replacement: JSX_MODULE },\n { find: /^@5cover\\/lectern\\/engie$/, replacement: ENGIE_MODULE },\n { find: /^@5cover\\/lectern\\/engie\\.css$/, replacement: ENGIE_STYLESHEET },\n { find: /^lectern\\/jsx-runtime$/, replacement: JSX_MODULE },\n { find: /^lectern\\/jsx-dev-runtime$/, replacement: JSX_MODULE },\n { find: /^lectern\\/engie$/, replacement: ENGIE_MODULE },\n { find: /^lectern\\/engie\\.css$/, replacement: ENGIE_STYLESHEET },\n { find: /^lectern$/, replacement: INDEX_MODULE },\n ]\n}\n","import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { dirname, join } from 'node:path'\nimport type { ViteDevServer } from 'vite'\nimport type { Profile } from '../profiles/types'\nimport type { ResolvedDeckMeta } from '../types'\nimport { CLIENT_ENTRY, PACKAGE_ROOT, RENDER_MODULE, posix } from './paths'\n\nexport interface RenderedDeck {\n meta: ResolvedDeckMeta\n profile: Profile\n slidesHtml: string\n}\n\n/**\n * Render the deck INSIDE the Vite SSR graph so the deck's VNodes and\n * `renderDeck` share one Preact instance (avoids dual-instance Fragment bugs).\n * We do this by loading a tiny generated harness module through ssrLoadModule.\n */\nexport async function renderDeckViaVite(server: ViteDevServer, deckPath: string): Promise<RenderedDeck> {\n const harnessDir = mkdtempSync(join(tmpdir(), 'lectern-harness-'))\n const harnessPath = join(harnessDir, 'harness.tsx')\n const source = [\n `import deckModule from ${JSON.stringify(posix(deckPath))};`,\n `import { renderDeck } from ${JSON.stringify(posix(RENDER_MODULE))};`,\n `export function run() { return renderDeck(deckModule); }`,\n ].join('\\n')\n writeFileSync(harnessPath, source, 'utf8')\n try {\n const mod = await server.ssrLoadModule(posix(harnessPath))\n return (mod.run as () => RenderedDeck)()\n } finally {\n rmSync(harnessDir, { recursive: true, force: true })\n }\n}\n\n/** Vite fs.allow list covering the package, deck and temp locations. */\nexport function fsAllow(deckPath: string): string[] {\n return [PACKAGE_ROOT, dirname(deckPath), dirname(CLIENT_ENTRY), tmpdir(), process.cwd()]\n}\n","import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'\nimport { join, resolve } from 'node:path'\nimport { createServer, build as viteBuild } from 'vite'\nimport { viteSingleFile } from 'vite-plugin-singlefile'\nimport { htmlShell } from '../render/template'\nimport { clientEntrySource, presentAlias } from './paths'\nimport { fsAllow, renderDeckViaVite, type RenderedDeck } from './render'\n\nexport interface BuildOptions {\n deckPath: string\n outDir: string\n /** Inline all assets into a single index.html (default true). */\n singleFile?: boolean\n}\n\n/** SSR-render the deck to { meta, slidesHtml } using a throwaway Vite server. */\nexport async function renderStatic(deckPath: string): Promise<RenderedDeck> {\n const server = await createServer({\n configFile: false,\n root: process.cwd(),\n logLevel: 'warn',\n appType: 'custom',\n esbuild: { jsx: 'automatic', jsxImportSource: '@5cover/lectern' },\n resolve: { alias: presentAlias() },\n server: { middlewareMode: true, fs: { allow: fsAllow(deckPath) } },\n })\n try {\n return await renderDeckViaVite(server, deckPath)\n } finally {\n await server.close()\n }\n}\n\n/**\n * Build a self-contained static deck. The slides are pre-rendered into\n * index.html; a single Vite pass bundles the client runtime (reveal + mermaid)\n * with the profile's stylesheet and, by default, inlines everything into one file.\n */\nexport async function build({ deckPath, outDir, singleFile = true }: BuildOptions): Promise<string> {\n const { meta, profile, slidesHtml } = await renderStatic(deckPath)\n\n // The build root must sit inside the project so its `node_modules`\n // (preact, reveal.js, mermaid, fluid…) resolves during bundling.\n const tmpBase = join(process.cwd(), 'node_modules', '.lectern-tmp')\n mkdirSync(tmpBase, { recursive: true })\n const workDir = mkdtempSync(join(tmpBase, 'build-'))\n // A local entry that re-exports the package client entry (keeps its own\n // relative CSS imports resolving from the real location) and the profile's stylesheet.\n writeFileSync(join(workDir, 'lectern-entry.ts'), `${clientEntrySource(profile)}\\n`, 'utf8')\n const clientTag = `<script type=\"module\" src=\"./lectern-entry.ts\"></script>`\n writeFileSync(\n join(workDir, 'index.html'),\n htmlShell({ meta, slidesHtml, bodyScripts: clientTag, headTags: '' }),\n 'utf8'\n )\n\n const outAbs = resolve(process.cwd(), outDir)\n try {\n await viteBuild({\n configFile: false,\n root: workDir,\n logLevel: 'warn',\n esbuild: { jsx: 'automatic', jsxImportSource: '@5cover/lectern' },\n resolve: { alias: presentAlias() },\n plugins: singleFile ? [viteSingleFile()] : [],\n build: {\n outDir: outAbs,\n emptyOutDir: true,\n assetsInlineLimit: singleFile ? Number.MAX_SAFE_INTEGER : 4096,\n chunkSizeWarningLimit: 4096,\n },\n server: { fs: { allow: fsAllow(deckPath) } },\n })\n } finally {\n rmSync(workDir, { recursive: true, force: true })\n }\n\n return join(outAbs, 'index.html')\n}\n","import type { Profile } from '../types'\n\n/**\n * ENGIE / Fluid profile — derived from the official \"ENGIE PowerPoint Template\".\n * Look lives in `engie.css` (Fluid + the template layer). This module holds\n * the Node-safe data: stylesheet, reveal defaults and the natural-language rulebook.\n */\nexport const engie: Profile = {\n name: 'engie',\n label: 'ENGIE / Fluid',\n description:\n 'ENGIE corporate house style (Fluid design system): navy #17255F & ENGIE blue #007bc5, Fluid typography, 16:9.',\n stylesheet: '@5cover/lectern/engie.css',\n reveal: {\n // 16:9 design canvas. Reveal scales this scene to the available viewport\n // while preserving its proportions.\n width: 1280,\n height: 720,\n slideNumber: 'c/t',\n // Corporate decks are top-anchored (title at top, logo pinned to the corner),\n // not vertically centred — so disable reveal's vertical centering.\n center: false,\n margin: 0,\n },\n rules: [\n {\n title: 'Structure & titles',\n rules: [\n {\n id: 'presentation-title-lines',\n statement: 'The cover title fits in two or three lines maximum.',\n severity: 'should',\n },\n {\n id: 'slide-title-lines',\n statement: 'A slide title is two or three lines maximum — ideally one. The subtitle is one line maximum.',\n severity: 'should',\n },\n {\n id: 'two-title-levels',\n statement: 'Use a second title level (title + subtitle) only when it genuinely adds structure.',\n severity: 'advisory',\n },\n {\n id: 'chapters-numbered',\n statement:\n 'Introduce each chapter with a numbered section divider (01, 02, …); a Summary slide lists the chapters.',\n severity: 'should',\n },\n {\n id: 'one-idea-per-slide',\n statement: 'Prefer one message per slide; keep body copy concise.',\n severity: 'advisory',\n },\n ],\n },\n {\n title: 'Confidentiality & rights',\n rules: [\n {\n id: 'confidentiality-level',\n statement:\n 'Every deck declares a confidentiality level: Non-confidential, Confidential, or Strictly confidential.',\n severity: 'must',\n },\n {\n id: 'visual-rights',\n statement:\n 'Iconography and visuals are for internal use only — verify the rights of every visual you include.',\n severity: 'must',\n },\n ],\n },\n {\n title: 'Footer',\n rules: [\n {\n id: 'footer-format',\n statement: 'Footer format: \"© ENGIE {year} - {presentation title} - {date} - {page}\".',\n severity: 'should',\n },\n ],\n },\n {\n title: 'Colours',\n rules: [\n {\n id: 'primary-colours',\n statement: 'Primary palette: navy #17255F, ENGIE blue #007bc5, teal #00817d, purple #6c4796.',\n severity: 'should',\n },\n {\n id: 'accent-colours',\n statement: 'Accent palette: coral #eb5d40, magenta #e94287, yellow #f4c867 — use for emphasis, sparingly.',\n severity: 'advisory',\n },\n {\n id: 'secondary-colours',\n statement:\n 'Secondary palette: #e18554, #4bb0b9, #67ae6e, #278cbc. Tints at 50% and 20% are available for backgrounds.',\n severity: 'advisory',\n },\n ],\n },\n {\n title: 'Typography',\n rules: [\n {\n id: 'fonts',\n statement:\n 'Typography follows the Fluid design system (Lato, with system fallbacks); titles are bold, body is regular.',\n severity: 'should',\n },\n ],\n },\n {\n title: 'Format & figures',\n rules: [\n {\n id: 'aspect-ratio',\n statement: 'Slides are 16:9.',\n severity: 'must',\n },\n {\n id: 'kpi-style',\n statement: 'Highlight key figures as a large number with a short label (e.g. \"9-10 Md€\").',\n severity: 'advisory',\n },\n ],\n },\n ],\n}\n","import type { Profile } from './types'\nimport { engie } from './engie/profile'\n\n/** All registered profiles, keyed by name. */\nexport const profiles: Record<string, Profile> = {\n engie,\n}\n\n/** The default profile applied when a deck doesn't name one. */\nexport const DEFAULT_PROFILE = 'engie'\n\n/** Look up a profile by name; returns undefined if unknown. */\nexport function getProfile(name: string | undefined): Profile | undefined {\n return profiles[name ?? DEFAULT_PROFILE]\n}\n\n/** Names of all registered profiles. */\nexport function profileNames(): string[] {\n return Object.keys(profiles)\n}\n\n/** Resolve a deck's `profile` (object or built-in name) to a profile; throws on an unknown name. */\nexport function resolveProfile(profile: string | Profile | undefined): Profile {\n if (typeof profile === 'object') return profile\n const found = getProfile(profile)\n if (!found) throw new Error(`Unknown profile: \"${profile}\". Available: ${profileNames().join(', ')}`)\n return found\n}\n\nexport type { Profile, Rule, RuleGroup, RuleSeverity } from './types'\n","import http from 'node:http'\nimport { createServer } from 'vite'\nimport { htmlShell } from '../render/template'\nimport { clientEntrySource, presentAlias } from './paths'\nimport { fsAllow, renderDeckViaVite } from './render'\n\nexport interface DevOptions {\n deckPath: string\n port: number\n}\n\nexport async function dev({ deckPath, port }: DevOptions): Promise<void> {\n const server = await createServer({\n configFile: false,\n root: process.cwd(),\n logLevel: 'warn',\n appType: 'custom',\n esbuild: { jsx: 'automatic', jsxImportSource: '@5cover/lectern' },\n resolve: { alias: presentAlias() },\n server: { middlewareMode: true, fs: { allow: fsAllow(deckPath) } },\n })\n\n async function renderPage(url: string): Promise<string> {\n const { meta, profile, slidesHtml } = await renderDeckViaVite(server, deckPath)\n const clientTag = `<script type=\"module\">${clientEntrySource(profile)}</script>`\n const html = htmlShell({ meta, slidesHtml, bodyScripts: clientTag, headTags: '' })\n return server.transformIndexHtml(url, html)\n }\n\n const httpServer = http.createServer((req, res) => {\n server.middlewares(req, res, async () => {\n try {\n const html = await renderPage(req.url ?? '/')\n res.statusCode = 200\n res.setHeader('content-type', 'text/html; charset=utf-8')\n res.end(html)\n } catch (err) {\n server.ssrFixStacktrace(err as Error)\n res.statusCode = 500\n res.setHeader('content-type', 'text/plain; charset=utf-8')\n res.end(`lectern dev error:\\n\\n${(err as Error).stack ?? String(err)}`)\n }\n })\n })\n\n // reveal owns the DOM, so any source change triggers a full page reload.\n server.watcher.on('change', () => {\n server.moduleGraph.invalidateAll()\n server.ws.send({ type: 'full-reload' })\n })\n\n await new Promise<void>(res => httpServer.listen(port, res))\n const url = `http://localhost:${port}/`\n // eslint-disable-next-line no-console\n console.log(\n `\\n lectern dev server running\\n ➜ ${url}\\n Editing ${deckPath} reloads automatically. Ctrl+C to stop.\\n`\n )\n}\n","import http, { type Server } from 'node:http'\nimport { mkdtempSync, readFileSync, rmSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\nimport { build } from './build'\n\nexport interface ServeOptions {\n deckPath: string\n port: number\n host: string\n}\n\nexport interface ServeHandle {\n url: string\n close(): Promise<void>\n}\n\n/**\n * Build a deck into a temporary, single-file production bundle and host it\n * locally. Unlike `dev`, this never starts Vite's development server or\n * watches source files.\n */\nexport async function serve({ deckPath, port, host }: ServeOptions): Promise<ServeHandle> {\n const outDir = mkdtempSync(join(tmpdir(), 'lectern-serve-'))\n let document: Buffer\n\n try {\n const indexHtml = await build({ deckPath, outDir, singleFile: true })\n document = readFileSync(indexHtml)\n } catch (err) {\n rmSync(outDir, { recursive: true, force: true })\n throw err\n }\n\n const server = http.createServer((req, res) => {\n const path = new URL(req.url ?? '/', `http://${req.headers.host ?? host}`).pathname\n if (req.method !== 'GET' && req.method !== 'HEAD') {\n res.statusCode = 405\n res.setHeader('allow', 'GET, HEAD')\n res.end()\n return\n }\n\n if (path !== '/' && path !== '/index.html') {\n res.statusCode = 404\n res.end('Not found')\n return\n }\n\n res.statusCode = 200\n res.setHeader('content-type', 'text/html; charset=utf-8')\n res.setHeader('content-length', document.length)\n if (req.method === 'HEAD') {\n res.end()\n return\n }\n res.end(document)\n })\n\n let closed = false\n const cleanup = () => rmSync(outDir, { recursive: true, force: true })\n const close = () =>\n new Promise<void>((resolve, reject) => {\n if (closed) {\n resolve()\n return\n }\n closed = true\n process.removeListener('SIGINT', shutdown)\n process.removeListener('SIGTERM', shutdown)\n server.close(err => (err ? reject(err) : resolve()))\n })\n const shutdown = () => {\n void close()\n }\n\n server.once('close', cleanup)\n process.once('SIGINT', shutdown)\n process.once('SIGTERM', shutdown)\n\n try {\n await listen(server, port, host)\n } catch (err) {\n process.removeListener('SIGINT', shutdown)\n process.removeListener('SIGTERM', shutdown)\n server.removeListener('close', cleanup)\n cleanup()\n throw err\n }\n\n const displayHost = host.includes(':') && !host.startsWith('[') ? `[${host}]` : host\n const address = server.address()\n const actualPort = typeof address === 'object' && address ? address.port : port\n return { url: `http://${displayHost}:${actualPort}/`, close }\n}\n\nfunction listen(server: Server, port: number, host: string): Promise<void> {\n return new Promise((resolve, reject) => {\n const onError = (err: Error) => {\n server.off('listening', onListening)\n reject(err)\n }\n const onListening = () => {\n server.off('error', onError)\n resolve()\n }\n\n server.once('error', onError)\n server.once('listening', onListening)\n server.listen(port, host)\n })\n}\n","import { mkdtempSync, rmSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join, resolve } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { build } from './build'\n\nexport interface PdfOptions {\n deckPath: string\n out: string\n}\n\n/**\n * Export the deck to PDF: build a static bundle, then drive reveal.js's\n * `?print-pdf` mode with headless Chromium (Playwright) and print to PDF.\n */\nexport async function pdf({ deckPath, out }: PdfOptions): Promise<string> {\n const workDir = mkdtempSync(join(tmpdir(), 'lectern-pdf-'))\n const indexHtml = await build({ deckPath, outDir: workDir, singleFile: true })\n\n let chromium: typeof import('playwright').chromium\n try {\n ;({ chromium } = await import('playwright'))\n } catch {\n rmSync(workDir, { recursive: true, force: true })\n throw new Error(\n 'PDF export needs Playwright. Install it with:\\n pnpm add -D playwright\\n npx playwright install chromium'\n )\n }\n\n let browser\n try {\n browser = await chromium.launch()\n } catch (err) {\n rmSync(workDir, { recursive: true, force: true })\n throw new Error(\n `Could not launch Chromium. Install the browser once with:\\n npx playwright install chromium\\n\\nOriginal error: ${(err as Error).message}`\n )\n }\n\n const outAbs = resolve(process.cwd(), out)\n try {\n const page = await browser.newPage()\n const url = `${pathToFileURL(indexHtml).href}?print-pdf`\n await page.goto(url, { waitUntil: 'load' })\n\n // Wait until reveal is ready, its per-slide print pages (.pdf-page) have\n // been laid out, and every mermaid diagram has finished rendering.\n await page.waitForFunction(\n () => {\n const w = window as unknown as { Reveal?: { isReady?: () => boolean } }\n const revealReady = !!w.Reveal?.isReady?.()\n const pages = document.querySelectorAll('.pdf-page').length\n const pendingMermaid = document.querySelectorAll('.mermaid:not([data-processed])').length\n return revealReady && pages > 0 && pendingMermaid === 0\n },\n { timeout: 45_000 }\n )\n\n await page.pdf({\n path: outAbs,\n printBackground: true,\n preferCSSPageSize: true,\n })\n } finally {\n await browser.close()\n rmSync(workDir, { recursive: true, force: true })\n }\n\n return outAbs\n}\n","#!/usr/bin/env node\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { parseArgs } from 'node:util'\n\nconst HELP = `lectern - reveal.js decks authored as TSX, styled with ENGIE Fluid.\n\nUsage:\n lectern dev [deck.tsx] [--port 4321]\n lectern build [deck.tsx] [--out dist] [--no-single-file]\n lectern serve [deck.tsx] [--port 4321] [--host 127.0.0.1]\n lectern pdf [deck.tsx] [--out deck.pdf]\n lectern rules [profile | deck.tsx] (default profile: engie)\n\nArguments:\n deck.tsx Path to the deck entry (default: ./deck.tsx)\n profile Built-in profile name to describe (default: engie);\n pass a deck path to describe the profile it uses\n\nOptions:\n --port, -p Dev or production server port (default 4321)\n --host Production server host (default 127.0.0.1)\n --out, -o Output dir (build) or file (pdf)\n --no-single-file Emit separate assets instead of one inlined index.html\n --help, -h Show this help\n`\n\nfunction resolveDeck(input: string | undefined): string {\n const candidate = resolve(process.cwd(), input ?? 'deck.tsx')\n if (!existsSync(candidate)) {\n console.error(`Deck not found: ${candidate}`)\n process.exit(1)\n }\n return candidate\n}\n\nasync function main() {\n const argv = process.argv.slice(2)\n const command = argv[0]\n\n if (!command || command === '--help' || command === '-h' || command === 'help') {\n console.log(HELP)\n return\n }\n\n const { values, positionals } = parseArgs({\n args: argv.slice(1),\n allowPositionals: true,\n options: {\n port: { type: 'string', short: 'p' },\n host: { type: 'string' },\n out: { type: 'string', short: 'o' },\n 'single-file': { type: 'boolean', default: true },\n help: { type: 'boolean', short: 'h' },\n },\n })\n\n if (values.help) {\n console.log(HELP)\n return\n }\n\n // `rules` takes a built-in profile name or a deck path; a deck is rendered to find its profile.\n if (command === 'rules') {\n const { rules } = await import('./rules')\n const target = positionals[0]\n if (target && existsSync(resolve(process.cwd(), target))) {\n const { renderStatic } = await import('./build')\n rules((await renderStatic(resolveDeck(target))).profile)\n } else {\n const { resolveProfile } = await import('../profiles')\n try {\n rules(resolveProfile(target))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n }\n return\n }\n\n const deckPath = resolveDeck(positionals[0])\n\n switch (command) {\n case 'dev': {\n const { dev } = await import('./dev')\n await dev({ deckPath, port: values.port ? Number(values.port) : 4321 })\n break\n }\n case 'build': {\n const { build } = await import('./build')\n const outDir = values.out ?? 'dist'\n const file = await build({ deckPath, outDir, singleFile: values['single-file'] })\n console.log(`✔ Built ${file}`)\n break\n }\n case 'serve': {\n const { serve } = await import('./serve')\n const { url } = await serve({\n deckPath,\n port: values.port ? Number(values.port) : 4321,\n host: values.host ?? '127.0.0.1',\n })\n console.log(\n `\\n lectern production server running\\n ➜ ${url}\\n Built from ${deckPath}. Source changes require a restart. Ctrl+C to stop.\\n`\n )\n break\n }\n case 'pdf': {\n const { pdf } = await import('./pdf')\n const out = values.out ?? 'deck.pdf'\n const file = await pdf({ deckPath, out })\n console.log(`✔ Exported ${file}`)\n break\n }\n default:\n console.error(`Unknown command: ${command}\\n`)\n console.log(HELP)\n process.exit(1)\n }\n}\n\nmain().catch(err => {\n console.error(err)\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join","mkdtempSync","rmSync","writeFileSync","join","resolve","createServer","url","http","mkdtempSync","rmSync","tmpdir","join","document","resolve","mkdtempSync","rmSync","tmpdir","join","resolve","existsSync","resolve","rules","renderStatic","resolveProfile","dev","build","serve","pdf"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { S as StyleEscapeHatch, b as DeckMeta, R as ResolvedDeckMeta, P as Profile } from './Deck-C1ecJqVD.js';
|
|
2
|
+
export { c as Deck, D as DeckProps, a as ProfileName, d as Rule, e as RuleGroup, f as RuleSeverity, g as SlideNode, T as Transition, i as isDeck } from './Deck-C1ecJqVD.js';
|
|
3
|
+
import * as preact from 'preact';
|
|
4
|
+
import { ComponentChildren, VNode } from 'preact';
|
|
5
|
+
import { BaseKeys, Infograph, InfographNodeKey } from 'infograph';
|
|
6
|
+
import 'reveal.js';
|
|
7
|
+
|
|
8
|
+
type Align = 'start' | 'center' | 'end' | 'stretch';
|
|
9
|
+
type Justify = 'start' | 'center' | 'end' | 'between' | 'around';
|
|
10
|
+
/**
|
|
11
|
+
* Horizontal layout. Each child becomes an equal column unless `ratio` is
|
|
12
|
+
* given (e.g. `[2, 1]` → first column twice as wide). Uses Fluid spacing.
|
|
13
|
+
*/
|
|
14
|
+
interface ColumnsProps extends StyleEscapeHatch {
|
|
15
|
+
children?: ComponentChildren;
|
|
16
|
+
/** Gap between columns (any CSS length). Defaults to a Fluid spacing token. */
|
|
17
|
+
gap?: string;
|
|
18
|
+
/** Cross-axis alignment. Defaults to "stretch". */
|
|
19
|
+
align?: Align;
|
|
20
|
+
/** Relative widths of the columns. */
|
|
21
|
+
ratio?: number[];
|
|
22
|
+
/** Explicit CSS Grid tracks, for content-sized rather than proportional columns. */
|
|
23
|
+
tracks?: string[];
|
|
24
|
+
/** Occupy the remaining height of a flex slide body. */
|
|
25
|
+
fill?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function Columns({ children, gap, align, ratio, tracks, fill, class: cls, style, }: ColumnsProps): preact.JSX.Element;
|
|
28
|
+
/** Vertical stack with consistent spacing between children. */
|
|
29
|
+
interface StackProps extends StyleEscapeHatch {
|
|
30
|
+
children?: ComponentChildren;
|
|
31
|
+
gap?: string;
|
|
32
|
+
align?: Align;
|
|
33
|
+
justify?: Justify;
|
|
34
|
+
/** Occupy the remaining height of a flex container. */
|
|
35
|
+
fill?: boolean;
|
|
36
|
+
}
|
|
37
|
+
declare function Stack({ children, gap, align, justify, fill, class: cls, style }: StackProps): preact.JSX.Element;
|
|
38
|
+
/** Simple responsive grid with a fixed number of columns. */
|
|
39
|
+
interface GridProps extends StyleEscapeHatch {
|
|
40
|
+
children?: ComponentChildren;
|
|
41
|
+
/** Number of columns. Defaults to 2. */
|
|
42
|
+
cols?: number;
|
|
43
|
+
gap?: string;
|
|
44
|
+
}
|
|
45
|
+
declare function Grid({ children, cols, gap, class: cls, style }: GridProps): preact.JSX.Element;
|
|
46
|
+
/** Vertical whitespace. */
|
|
47
|
+
declare function Spacer({ size }: {
|
|
48
|
+
size?: string;
|
|
49
|
+
}): preact.JSX.Element;
|
|
50
|
+
|
|
51
|
+
interface InfographDiscoveryProps<Keys extends BaseKeys = BaseKeys> extends StyleEscapeHatch {
|
|
52
|
+
/** Parsed infograph to browse. The component never modifies it. */
|
|
53
|
+
infograph: Infograph<Keys>;
|
|
54
|
+
/** Initial node key. Must identify a node in `infograph`. */
|
|
55
|
+
seed: InfographNodeKey<Keys>;
|
|
56
|
+
/** Number of relation rows initially visible in the BFS neighborhood. */
|
|
57
|
+
relationBudget?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Interactive, bounded exploration of an infograph for a presentation annex.
|
|
61
|
+
*
|
|
62
|
+
* The static HTML renders the seed state for PDF export. The browser client
|
|
63
|
+
* enhances it with search and click navigation between nodes and edges.
|
|
64
|
+
*/
|
|
65
|
+
declare function InfographDiscovery<Keys extends BaseKeys>({ infograph, seed, relationBudget, class: cls, style, }: InfographDiscoveryProps<Keys>): preact.JSX.Element;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A code block, syntax-highlighted client-side by reveal's highlight plugin.
|
|
69
|
+
* The code is passed as a string child; it is HTML-escaped safely by the
|
|
70
|
+
* renderer, so `<`, `>` and `&` display correctly.
|
|
71
|
+
*/
|
|
72
|
+
interface CodeProps extends StyleEscapeHatch {
|
|
73
|
+
children: string;
|
|
74
|
+
/** Language for highlighting, e.g. "js", "json", "bash". */
|
|
75
|
+
lang?: string;
|
|
76
|
+
/** Show line numbers, optionally with a highlight spec like "2-4|6". */
|
|
77
|
+
lineNumbers?: boolean | string;
|
|
78
|
+
}
|
|
79
|
+
declare function Code({ children, lang, lineNumbers, class: cls, style }: CodeProps): preact.JSX.Element;
|
|
80
|
+
/**
|
|
81
|
+
* A Mermaid diagram. The diagram source is passed as a string child and
|
|
82
|
+
* rendered in the browser by the bundled Mermaid runtime (themed by the profile).
|
|
83
|
+
*/
|
|
84
|
+
declare function Mermaid({ children, class: cls, style }: {
|
|
85
|
+
children: string;
|
|
86
|
+
} & StyleEscapeHatch): preact.JSX.Element;
|
|
87
|
+
/** Speaker notes: hidden on slides, shown in reveal's speaker view (press S). */
|
|
88
|
+
declare function Notes({ children }: {
|
|
89
|
+
children: ComponentChildren;
|
|
90
|
+
}): preact.JSX.Element;
|
|
91
|
+
/** Wrap content so it appears as a reveal.js fragment (on the next advance). */
|
|
92
|
+
interface FragmentProps {
|
|
93
|
+
children: ComponentChildren;
|
|
94
|
+
/** Fragment animation type, e.g. "fade-in", "highlight-red". */
|
|
95
|
+
type?: string;
|
|
96
|
+
/** Explicit ordering index. */
|
|
97
|
+
index?: number;
|
|
98
|
+
}
|
|
99
|
+
declare function Fragment({ children, type, index }: FragmentProps): preact.JSX.Element;
|
|
100
|
+
/**
|
|
101
|
+
* Escape hatch: inject raw HTML for one specific slide. You own its
|
|
102
|
+
* correctness and safety. Content is emitted verbatim (not escaped).
|
|
103
|
+
*/
|
|
104
|
+
declare function Raw({ html }: {
|
|
105
|
+
html: string;
|
|
106
|
+
}): preact.JSX.Element;
|
|
107
|
+
|
|
108
|
+
/** Join truthy class names. */
|
|
109
|
+
declare function cx(...parts: Array<string | false | null | undefined>): string;
|
|
110
|
+
|
|
111
|
+
interface RenderOptions {
|
|
112
|
+
/** Script tag(s) to inject before </body> (e.g. the bundled client entry). */
|
|
113
|
+
bodyScripts?: string;
|
|
114
|
+
/** Extra tags for <head> (e.g. hashed CSS from a bundler). */
|
|
115
|
+
headTags?: string;
|
|
116
|
+
/** Override/merge deck metadata. */
|
|
117
|
+
meta?: Partial<Omit<DeckMeta, 'profile'>>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Turn a deck VNode into its metadata, its resolved profile and the inner
|
|
121
|
+
* `.slides` HTML. Reads deck-level props from a top-level `<Deck>`; if the
|
|
122
|
+
* export is a raw fragment/array of slides, sensible defaults are used.
|
|
123
|
+
*/
|
|
124
|
+
declare function renderDeck(deck: VNode | VNode[]): {
|
|
125
|
+
meta: ResolvedDeckMeta;
|
|
126
|
+
profile: Profile;
|
|
127
|
+
slidesHtml: string;
|
|
128
|
+
};
|
|
129
|
+
/** Full standalone HTML document for a deck. */
|
|
130
|
+
declare function renderToHtml(deck: VNode | VNode[], options?: RenderOptions): string;
|
|
131
|
+
|
|
132
|
+
/** All registered profiles, keyed by name. */
|
|
133
|
+
declare const profiles: Record<string, Profile>;
|
|
134
|
+
/** The default profile applied when a deck doesn't name one. */
|
|
135
|
+
declare const DEFAULT_PROFILE = "engie";
|
|
136
|
+
/** Look up a profile by name; returns undefined if unknown. */
|
|
137
|
+
declare function getProfile(name: string | undefined): Profile | undefined;
|
|
138
|
+
/** Names of all registered profiles. */
|
|
139
|
+
declare function profileNames(): string[];
|
|
140
|
+
/** Resolve a deck's `profile` (object or built-in name) to a profile; throws on an unknown name. */
|
|
141
|
+
declare function resolveProfile(profile: string | Profile | undefined): Profile;
|
|
142
|
+
|
|
143
|
+
export { Code, Columns, DEFAULT_PROFILE, DeckMeta, Fragment, Grid, InfographDiscovery, Mermaid, Notes, Profile, Raw, ResolvedDeckMeta, Spacer, Stack, StyleEscapeHatch, cx, getProfile, profileNames, profiles, renderDeck, renderToHtml, resolveProfile };
|
|
144
|
+
export type { CodeProps, ColumnsProps, FragmentProps, GridProps, InfographDiscoveryProps, RenderOptions, StackProps };
|