orz-slides 0.3.0 → 0.4.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/dist/lib.d.ts CHANGED
@@ -15,6 +15,10 @@ export interface BuildSlidesOptions {
15
15
  title?: string;
16
16
  /** Theme id fallback; the deck's own `theme:` wins. Validated against THEME_DEFS. */
17
17
  theme?: string;
18
+ /** Renderer + theme + reveal CSS delivery: `inline` (default, offline) or
19
+ * `cdn` (small file — engine, themes, and reveal.css load from jsDelivr at
20
+ * view time; requires orz-slides-browser to be published at this version). */
21
+ delivery?: 'inline' | 'cdn';
18
22
  }
19
23
  /**
20
24
  * Shared inline-composition path. Both {@link buildSlidesHtml} and the CLI's
package/dist/lib.js CHANGED
@@ -114,19 +114,31 @@ export function buildSlidesHtmlWithDocId(opts, docId) {
114
114
  const defaultTheme = themes.some((t) => t.id === wanted) ? wanted : themes[0].id;
115
115
  const ratio = deck.config.ratio || '16:9';
116
116
  const title = deck.config.title || opts.title || 'Untitled';
117
- // Engine + theme delivery always fully inline.
118
- const renderer = { mode: 'inline', js: readEngineBundle() };
119
- const theme = {
120
- mode: 'inline',
121
- base: readFileSync(findAsset('themes/base.css'), 'utf8'),
122
- themes: THEME_DEFS.map((t) => ({ id: t.id, css: themeOnly(t.id) })),
123
- };
124
- const reveal = readRevealCss();
125
- const revealCss = {
126
- mode: 'inline',
127
- reset: reveal.reset,
128
- core: reveal.core,
129
- };
117
+ // Engine + theme + reveal CSS delivery: inline (default, offline) or CDN.
118
+ const cdn = opts.delivery === 'cdn';
119
+ const renderer = cdn
120
+ ? { mode: 'cdn', src: `https://cdn.jsdelivr.net/npm/orz-slides-browser@${ver}/orz-slides.browser.js` }
121
+ : { mode: 'inline', js: readEngineBundle() };
122
+ const theme = cdn
123
+ ? { mode: 'cdn' }
124
+ : {
125
+ mode: 'inline',
126
+ base: readFileSync(findAsset('themes/base.css'), 'utf8'),
127
+ themes: THEME_DEFS.map((t) => ({ id: t.id, css: themeOnly(t.id) })),
128
+ };
129
+ let revealCss;
130
+ if (cdn) {
131
+ const revealVer = pkgVersion('reveal.js', '5.0.4');
132
+ revealCss = {
133
+ mode: 'cdn',
134
+ resetUrl: `https://cdn.jsdelivr.net/npm/reveal.js@${revealVer}/dist/reset.css`,
135
+ coreUrl: `https://cdn.jsdelivr.net/npm/reveal.js@${revealVer}/dist/reveal.css`,
136
+ };
137
+ }
138
+ else {
139
+ const reveal = readRevealCss();
140
+ revealCss = { mode: 'inline', reset: reveal.reset, core: reveal.core };
141
+ }
130
142
  const appJs = readFileSync(findAsset('app.js'), 'utf8');
131
143
  const CM = 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.16';
132
144
  return buildHtml({