@codename/deck 0.1.0 → 0.1.1

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.
@@ -0,0 +1,25 @@
1
+ export type Where = {
2
+ base: string;
3
+ root: HTMLElement;
4
+ versions?: {
5
+ echarts?: string;
6
+ pele?: string;
7
+ };
8
+ };
9
+ /**
10
+ * A library's file: from a CDN's npm mirror, at its version (`https://…/npm/name@1.2.3/file`), or from a
11
+ * node_modules folder, which holds one version (`…/node_modules/name/file`).
12
+ * @param {string} base @param {string} name @param {string} version @param {string} file
13
+ */
14
+ export declare const libraryAt: (base: string, name: string, version: string, file: string) => string;
15
+ /** @param {Where} where */
16
+ export declare function defaultBlocks({ base, root, versions }: Where): {
17
+ /** @param {HTMLElement} box @param {string} source */
18
+ echarts(box: HTMLElement, source: string): Promise<void>;
19
+ /**
20
+ * A diagram written in Mermaid's language, drawn by Pele (Obsidian's, MIT): every kind Mermaid
21
+ * 12.1 has, no DOM needed, an SVG with no script or HTML in it. Shown as a picture, its colours
22
+ * the deck's, set as Pele's variables inside it. @param {HTMLElement} box @param {string} source
23
+ */
24
+ mermaid(box: HTMLElement, source: string): Promise<void>;
25
+ };
@@ -0,0 +1,42 @@
1
+ export type Deck = import('./parse.js').Deck;
2
+ export type Options = {
3
+ source: string;
4
+ lang?: string;
5
+ dir?: string;
6
+ kit?: Record<string, any>;
7
+ scheme?: 'light' | 'dark' | 'auto';
8
+ blocks?: Record<string, import('./render.js').Drawer>;
9
+ resolve?: (src: string) => string | null;
10
+ strings?: Record<string, string>;
11
+ headings?: 'real' | 'aria';
12
+ editable?: boolean;
13
+ lex?: (markdown: string) => any[];
14
+ onChange?: (source: string) => void;
15
+ onSave?: (source: string) => void;
16
+ onExport?: (deck: DeckView) => void;
17
+ };
18
+ export type DeckView = ReturnType<typeof createDeck>;
19
+ /** @typedef {ReturnType<typeof createDeck>} DeckView */
20
+ /** @param {HTMLElement} root @param {Options} options */
21
+ export declare function createDeck(root: HTMLElement, options: Options): {
22
+ root: HTMLElement;
23
+ stage: HTMLElement;
24
+ readonly source: string;
25
+ readonly deck: import("./parse.js").Deck;
26
+ readonly at: number;
27
+ readonly scheme: "dark" | "light";
28
+ readonly kit: import("./kit.js").Kit;
29
+ readonly kitProblems: string[];
30
+ lang: string;
31
+ dir: string;
32
+ slides: () => HTMLElement[];
33
+ setSource: (text: string) => void;
34
+ go: (to: number, toStep?: number) => void;
35
+ toggle: (mode: string) => void;
36
+ present: () => void;
37
+ fitAll: () => void;
38
+ setScheme: (/** @type {'light' | 'dark'} */ value: 'light' | 'dark') => void;
39
+ destroy: () => void;
40
+ };
41
+ /** The Markdown of words changed in place: bold, italics, code and links kept as Markdown writes them. @param {Node} node @returns {string} */
42
+ export declare function markdownOf(node: Node): string;
@@ -0,0 +1,38 @@
1
+ export declare const OPEN = "<script type=\"text/markdown\" id=\"deck\">";
2
+ /** @param {string} markdown */
3
+ export declare const escape: (markdown: string) => string;
4
+ /** @param {string} text */
5
+ export declare const unescape: (text: string) => string;
6
+ /**
7
+ * Code held whole in the file: `</script`, `<script` and `<!--`, which only a string or a regular
8
+ * expression of a bundle holds, written with `\x3C` for their `<`, which reads the same there.
9
+ * @param {string} code
10
+ */
11
+ export declare function inlineCode(code: string): string;
12
+ /**
13
+ * A deck's Markdown, from a file's text, or null when it holds none.
14
+ * @param {string} html @returns {string | null}
15
+ */
16
+ export declare function readDeckFile(html: string): string | null;
17
+ /** Where a linked file finds its renderer: this version of the package, on jsDelivr's npm mirror. @param {string} [version] */
18
+ export declare const rendererUrl: (version?: string) => string;
19
+ /**
20
+ * A deck file around its Markdown: its title, language and direction in the page's head for
21
+ * whatever reads it before the renderer does, then the Markdown, in the body (the head is never shown), readable as it is when no
22
+ * renderer comes, then the renderer: linked by default, to this version's address, or held whole;
23
+ * `base` tells it where to load the libraries a slide needs (a CDN's npm mirror, or a node_modules).
24
+ * @param {string} markdown
25
+ * @param {{ title?: string, lang?: string, dir?: string, renderer?: { src: string } | { code: string }, base?: string, generator?: string }} [options]
26
+ */
27
+ export declare function writeDeckFile(markdown: string, { title, lang, dir, renderer, base, generator }?: {
28
+ title?: string;
29
+ lang?: string;
30
+ dir?: string;
31
+ renderer?: {
32
+ src: string;
33
+ } | {
34
+ code: string;
35
+ };
36
+ base?: string;
37
+ generator?: string;
38
+ }): string;
@@ -0,0 +1,11 @@
1
+ export { createDeck, markdownOf } from './deck.js';
2
+ export { parseDeck } from './parse.js';
3
+ export { renderSlide } from './render.js';
4
+ export { STANDARD, mergeKits, layoutOf, inferLayout, labelOf, tokensFrom } from './kit.js';
5
+ export { tokensOf, schemeOf, LOOKS, readable, contrast } from './look.js';
6
+ export { readDeckFile, writeDeckFile, rendererUrl, escape, unescape } from './file.js';
7
+ export { toPptx } from './pptx.js';
8
+ export { defaultBlocks, libraryAt } from './blocks.js';
9
+ export { inlinePictures } from './pictures.js';
10
+ export { deckIn } from './repair.js';
11
+ export { VERSION } from './version.js';
@@ -0,0 +1,73 @@
1
+ export type Budget = {
2
+ required?: boolean;
3
+ max_words?: number;
4
+ max_chars?: number;
5
+ items?: [number, number];
6
+ item_max_words?: number;
7
+ heading_max_words?: number;
8
+ kind?: string;
9
+ };
10
+ export type Layout = {
11
+ label?: Record<string, string> | string;
12
+ intent?: string;
13
+ use_when?: string;
14
+ avoid_when?: string;
15
+ slots: string[];
16
+ budgets: Record<string, Budget>;
17
+ areas: string[][];
18
+ columns: string[];
19
+ rows: string[];
20
+ align: 'start' | 'center' | 'end';
21
+ justify: 'start' | 'center' | 'end';
22
+ paper: 'paper' | 'fill' | 'ink' | 'soft';
23
+ title: 'normal' | 'large' | 'huge';
24
+ pptx: string;
25
+ numbered: boolean;
26
+ };
27
+ export type Kit = {
28
+ name?: string;
29
+ tokens: Record<string, any>;
30
+ layouts: Record<string, Layout>;
31
+ };
32
+ /** The names brains give the usual layouts, for the ones deck has. */
33
+ export declare const ALIASES: Record<string, string>;
34
+ /** deck's own kit: the usual layouts, the ones Slidev names and the ones PowerPoint has, as data. */
35
+ export declare const STANDARD: Kit;
36
+ /**
37
+ * A layout as given, checked: its slots, areas and tracks in the grammar, its words' place, paper
38
+ * and size among their names. @param {any} given @returns {{ layout: Layout | null, problems: string[] }}
39
+ */
40
+ export declare function layoutOf(given: any): {
41
+ layout: Layout | null;
42
+ problems: string[];
43
+ };
44
+ /**
45
+ * Design tokens as the W3C's Design Tokens format (DTCG 2025.10) writes them, read into a kit's:
46
+ * `color.light` and `color.dark` groups (bg, surface, fg, muted, accent) or flat colours, `font.sans`
47
+ * and the like; each `$value` a hex string or a colour object with its `hex`. Tokens already flat
48
+ * pass through. @param {any} given @returns {Record<string, any>}
49
+ */
50
+ export declare function tokensFrom(given: any): Record<string, any>;
51
+ /**
52
+ * Kits merged, the later over the earlier: their tokens, and their layouts by name, each checked.
53
+ * @param {...any} kits @returns {{ kit: Kit, problems: string[] }}
54
+ */
55
+ export declare function mergeKits(...kits: any[]): {
56
+ kit: Kit;
57
+ problems: string[];
58
+ };
59
+ /** A layout's name in a language, else its own name. @param {Layout} layout @param {string} name @param {string} lang */
60
+ export declare function labelOf(layout: Layout, name: string, lang: string): string;
61
+ /**
62
+ * The layout a slide that names none is given, from what it holds, as Pandoc's PowerPoint writer
63
+ * chooses: the first slide is the cover; a heading alone, a section; slots beyond the first, the
64
+ * layout of two (or three) columns that has them; a number alone as its heading, a fact; a quote
65
+ * alone, a quote; else the default. @param {{ index: number, slots: { name: string, text: string }[] }} slide
66
+ */
67
+ export declare function inferLayout(slide: {
68
+ index: number;
69
+ slots: {
70
+ name: string;
71
+ text: string;
72
+ }[];
73
+ }): "cover" | "default" | "fact" | "quote" | "section" | "three-cols" | "two-cols" | "two-cols-header";
@@ -0,0 +1,55 @@
1
+ export type Tokens = {
2
+ paper: string;
3
+ ink: string;
4
+ primary: string;
5
+ voice: string;
6
+ radius: number;
7
+ muted?: string;
8
+ soft?: string;
9
+ dark?: Record<string, string>;
10
+ fonts?: {
11
+ heading: string[];
12
+ body: string[];
13
+ };
14
+ };
15
+ export type Scheme = {
16
+ paper: string;
17
+ ink: string;
18
+ muted: string;
19
+ line: string;
20
+ primary: string;
21
+ onPrimary: string;
22
+ soft: string;
23
+ series: string[];
24
+ };
25
+ /** @typedef {{ paper: string, ink: string, primary: string, voice: string, radius: number, muted?: string, soft?: string, dark?: Record<string, string>, fonts?: { heading: string[], body: string[] } }} Tokens */
26
+ /** @typedef {{ paper: string, ink: string, muted: string, line: string, primary: string, onPrimary: string, soft: string, series: string[] }} Scheme */
27
+ /** Looks a deck can name (`theme:`), each a handful of tokens. */
28
+ export declare const LOOKS: Record<string, Tokens>;
29
+ /** Type for each voice: the device's faces, so a deck needs nothing to download to look right. */
30
+ export declare const VOICES: Record<string, {
31
+ heading: string;
32
+ body: string;
33
+ }>;
34
+ /**
35
+ * The tokens a deck's settings give, over the project's look and a named one.
36
+ * @param {Record<string, any>} settings @param {Partial<Tokens>} [project]
37
+ * @returns {Tokens}
38
+ */
39
+ export declare function tokensOf(settings: Record<string, any>, project?: Partial<Tokens>): Tokens;
40
+ /**
41
+ * Light or dark, worked out from the tokens: dark swaps paper and ink and lifts the primary.
42
+ * @param {Tokens} tokens @param {'light' | 'dark'} scheme @returns {Scheme}
43
+ */
44
+ export declare function schemeOf(tokens: Tokens, scheme: 'light' | 'dark'): Scheme;
45
+ /** @param {string} value @returns {[number, number, number] | null} */
46
+ export declare function hex(value: string): [number, number, number] | null;
47
+ /** @param {number[]} rgb */
48
+ export declare const css: (rgb: number[]) => string;
49
+ /** WCAG's contrast ratio. @param {number[]} a @param {number[]} b */
50
+ export declare function contrast(a: number[], b: number[]): number;
51
+ /**
52
+ * The colour, its hue kept, deepened or lightened toward black or white until it reads at the
53
+ * ratio on the paper. @param {number[]} colour @param {number[]} paper @param {number} ratio
54
+ */
55
+ export declare function readable(colour: number[], paper: number[], ratio: number): [number, number, number];
@@ -0,0 +1,20 @@
1
+ export type Slot = {
2
+ name: string;
3
+ text: string;
4
+ start: number;
5
+ };
6
+ export type Slide = {
7
+ index: number;
8
+ start: number;
9
+ end: number;
10
+ settings: Record<string, any>;
11
+ slots: Slot[];
12
+ notes: string;
13
+ title: string;
14
+ };
15
+ export type Deck = {
16
+ settings: Record<string, any>;
17
+ slides: Slide[];
18
+ };
19
+ /** @param {string} source @returns {Deck} */
20
+ export declare function parseDeck(source: string): Deck;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The deck with its pictures inside it.
3
+ * @param {string} source
4
+ * @param {(place: string) => Promise<{ type: string, bytes: Uint8Array } | null>} read
5
+ * @param {{ web?: boolean, largest?: number }} [options] `web`: pictures on the web too; `largest`: bytes past which a picture stays a link
6
+ * @returns {Promise<{ source: string, inlined: string[], missing: string[], kept: string[] }>}
7
+ */
8
+ export declare function inlinePictures(source: string, read: (place: string) => Promise<{
9
+ type: string;
10
+ bytes: Uint8Array;
11
+ } | null>, { web: fromWeb, largest }?: {
12
+ web?: boolean;
13
+ largest?: number;
14
+ }): Promise<{
15
+ source: string;
16
+ inlined: string[];
17
+ missing: string[];
18
+ kept: string[];
19
+ }>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @param {import('./deck.js').DeckView} view
3
+ * @param {{ PptxGenJS: any, JSZip: any }} libraries
4
+ * @returns {Promise<{ blob: Blob, report: { slides: number, charts: number, pictures: number, tables: number, placeholders: number } }>}
5
+ */
6
+ export declare function toPptx(view: import('./deck.js').DeckView, { PptxGenJS, JSZip }: {
7
+ PptxGenJS: any;
8
+ JSZip: any;
9
+ }): Promise<{
10
+ blob: Blob;
11
+ report: {
12
+ slides: number;
13
+ charts: number;
14
+ pictures: number;
15
+ tables: number;
16
+ placeholders: number;
17
+ };
18
+ }>;
@@ -0,0 +1,34 @@
1
+ export type Slide = import('./parse.js').Slide;
2
+ export type Slot = import('./parse.js').Slot;
3
+ export type Drawer = (element: HTMLElement, source: string) => void | Promise<void>;
4
+ export type Context = {
5
+ blocks: Record<string, Drawer>;
6
+ resolve: (src: string) => string | null;
7
+ headings: 'real' | 'aria';
8
+ number: (n: number) => string;
9
+ total: number;
10
+ kit: import('./kit.js').Kit;
11
+ lex: (markdown: string) => any[];
12
+ slide: string;
13
+ };
14
+ /** @typedef {import('./parse.js').Slide} Slide */
15
+ /** @typedef {import('./parse.js').Slot} Slot */
16
+ /** @typedef {(element: HTMLElement, source: string) => void | Promise<void>} Drawer */
17
+ /** @typedef {{ blocks: Record<string, Drawer>, resolve: (src: string) => string | null, headings: 'real' | 'aria', number: (n: number) => string, total: number, kit: import('./kit.js').Kit, lex: (markdown: string) => any[], slide: string }} Context */
18
+ /**
19
+ * @param {string} tag @param {Record<string, string | number | boolean | undefined>} [attributes]
20
+ * @param {(Node | string | null | undefined | false)[]} [children]
21
+ */
22
+ export declare function h(tag: string, attributes?: Record<string, string | number | boolean | undefined>, children?: (Node | string | null | undefined | false)[]): HTMLElement;
23
+ /** An address a slide may show: the web's, a picture held in the file, or one beside it. @param {string} href */
24
+ export declare function safeUrl(href: string): string | null;
25
+ /**
26
+ * A slide, laid out by its layout, with its slots, steps and number.
27
+ * @param {Slide} slide @param {Context} context @returns {{ element: HTMLElement, steps: number }}
28
+ */
29
+ export declare function renderSlide(slide: Slide, context: Context): {
30
+ element: HTMLElement;
31
+ steps: number;
32
+ };
33
+ /** @param {any[]} tokens @param {Context} context @returns {Node[]} */
34
+ export declare function inline(tokens: any[] | undefined, context: Context): Node[];
@@ -0,0 +1,5 @@
1
+ /** The deck an answer holds, or null. @param {string} answer @returns {{ source: string, mended: string[] } | null} */
2
+ export declare function deckIn(answer: string): {
3
+ source: string;
4
+ mended: string[];
5
+ } | null;
@@ -0,0 +1,2 @@
1
+ /** @param {string} lang */
2
+ export declare const stringsFor: (lang: string) => Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const VERSION = "0.1.1";
@@ -0,0 +1,2 @@
1
+ /** @param {string} text @returns {Record<string, any>} */
2
+ export declare function parseYaml(text: string): Record<string, any>;
package/docs/host.md CHANGED
@@ -14,7 +14,8 @@ const view = createDeck(document.querySelector('#deck'), {
14
14
  scheme: 'auto', // 'light', 'dark' or 'auto', over the deck's colorSchema
15
15
  blocks: { echarts, mermaid }, // drawers for fenced blocks: (box, source) => void | Promise<void>
16
16
  resolve: (src) => url, // a picture's address as the page can load it, or null
17
- strings, // the bar's words, else deck's own (en, fr, ar, ja)
17
+ strings, // the bar's words, and `slide` and `carousel` for screen readers, else deck's own (en, fr, ar, ja)
18
+ lex: (markdown) => tokens, // how a slide's Markdown is read: the host's own marked, its extensions too; else marked's GFM
18
19
  headings: 'aria', // 'real' (h1–h6) or 'aria' (role=heading), for a deck inside a page
19
20
  editable: true,
20
21
  onChange: (source) => {}, // after each change, by the Markdown or on a slide
package/package.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@codename/deck",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Slide decks as one web page: Markdown in Slidev's form inside a .deck.html file any browser presents, a renderer that runs anywhere, kits of layouts and looks, and an editable PowerPoint out",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": {
8
- ".": "./dist/deck.mjs",
9
- "./bundle": "./dist/deck.bundle.mjs",
8
+ ".": {
9
+ "types": "./dist/types/index.d.ts",
10
+ "default": "./dist/deck.mjs"
11
+ },
12
+ "./bundle": {
13
+ "types": "./dist/types/index.d.ts",
14
+ "default": "./dist/deck.bundle.mjs"
15
+ },
10
16
  "./file": "./dist/deck.js",
11
17
  "./css": "./dist/deck.css",
12
18
  "./src/*": "./src/*"
@@ -27,8 +33,8 @@
27
33
  "pptx"
28
34
  ],
29
35
  "scripts": {
30
- "build": "node build.mjs",
31
- "examples": "node build.mjs && node examples/make.mjs",
36
+ "build": "node build.mjs && tsc -p tsconfig.types.json",
37
+ "examples": "npm run build && node examples/make.mjs",
32
38
  "test": "node --test test/*.test.js",
33
39
  "test:browsers": "npm run examples && node test/browser.mjs && node test/kit-browser.mjs",
34
40
  "typecheck": "tsc --noEmit",
@@ -39,7 +45,7 @@
39
45
  "prepublishOnly": "npm run build && npm test"
40
46
  },
41
47
  "peerDependencies": {
42
- "marked": "^18.1.1"
48
+ "marked": "^18.0.14"
43
49
  },
44
50
  "devDependencies": {
45
51
  "echarts": "6.1.0",
package/src/deck.js CHANGED
@@ -4,19 +4,21 @@
4
4
  // the presenter's view (this slide, the next, the notes, the time) and all slides at once; light
5
5
  // or dark; changed as Markdown beside the slides, or in place on a slide, live. Host-agnostic:
6
6
  // the host gives the drawers of ```echarts and ```mermaid, how a picture's address resolves, its
7
- // words, and what to do when the deck changes or is saved.
7
+ // words, how a slide's Markdown is read (its own marked, with its extensions), and what to do when
8
+ // the deck changes or is saved.
8
9
  import { parseDeck } from './parse.js'
9
10
  import { renderSlide, h } from './render.js'
10
11
  import { tokensOf, schemeOf, VOICES } from './look.js'
11
12
  import { mergeKits } from './kit.js'
12
13
  import { stringsFor } from './strings.js'
14
+ import { Lexer } from 'marked'
13
15
 
14
16
  /** @typedef {import('./parse.js').Deck} Deck */
15
17
  /**
16
18
  * @typedef {{
17
19
  * source: string, lang?: string, dir?: string, kit?: Record<string, any>, scheme?: 'light' | 'dark' | 'auto',
18
20
  * blocks?: Record<string, import('./render.js').Drawer>, resolve?: (src: string) => string | null,
19
- * strings?: Record<string, string>, headings?: 'real' | 'aria', editable?: boolean,
21
+ * strings?: Record<string, string>, headings?: 'real' | 'aria', editable?: boolean, lex?: (markdown: string) => any[],
20
22
  * onChange?: (source: string) => void, onSave?: (source: string) => void, onExport?: (deck: DeckView) => void,
21
23
  * }} Options
22
24
  */
@@ -60,7 +62,7 @@ export function createDeck(root, options) {
60
62
  root.classList.add('deck')
61
63
  root.lang = lang
62
64
  root.dir = dir
63
- const stage = h('div', { class: 'deck-stage', tabindex: 0, role: 'region', 'aria-roledescription': 'carousel', 'aria-label': words.deck })
65
+ const stage = h('div', { class: 'deck-stage', tabindex: 0, role: 'region', 'aria-roledescription': words.carousel, 'aria-label': words.deck })
64
66
  const where = h('span', { class: 'deck-where', 'aria-live': 'polite' })
65
67
  const button = (/** @type {string} */ name, /** @type {string} */ label, /** @type {() => void} */ act) => {
66
68
  const b = h('button', { type: 'button', 'aria-label': label, 'data-act': name }, [icon(name)])
@@ -115,6 +117,7 @@ export function createDeck(root, options) {
115
117
  /** @type {import('./render.js').Context} */
116
118
  const context = {
117
119
  blocks: options.blocks ?? {}, resolve: options.resolve ?? ((src) => src), headings: options.headings ?? 'real', number: (n) => number(n), total: 0, kit: mergeKits().kit,
120
+ lex: options.lex ?? ((markdown) => new Lexer({ gfm: true }).lex(markdown)), slide: words.slide,
118
121
  }
119
122
 
120
123
  function draw() {
package/src/render.js CHANGED
@@ -4,13 +4,12 @@
4
4
  // source (data-edit, offsets), so an edit made on the slide goes back into the Markdown. HTML a
5
5
  // deck holds is not drawn: Slidev's <v-click> and <v-clicks> become steps, <br> a line break, and
6
6
  // any other tag gives up its words alone. ```echarts and ```mermaid go to the host's drawers.
7
- import { Lexer } from 'marked'
8
7
  import { STANDARD, inferLayout, ALIASES } from './kit.js'
9
8
 
10
9
  /** @typedef {import('./parse.js').Slide} Slide */
11
10
  /** @typedef {import('./parse.js').Slot} Slot */
12
11
  /** @typedef {(element: HTMLElement, source: string) => void | Promise<void>} Drawer */
13
- /** @typedef {{ blocks: Record<string, Drawer>, resolve: (src: string) => string | null, headings: 'real' | 'aria', number: (n: number) => string, total: number, kit: import('./kit.js').Kit }} Context */
12
+ /** @typedef {{ blocks: Record<string, Drawer>, resolve: (src: string) => string | null, headings: 'real' | 'aria', number: (n: number) => string, total: number, kit: import('./kit.js').Kit, lex: (markdown: string) => any[], slide: string }} Context */
14
13
 
15
14
  /**
16
15
  * @param {string} tag @param {Record<string, string | number | boolean | undefined>} [attributes]
@@ -47,7 +46,7 @@ export function renderSlide(slide, context) {
47
46
  const section = h('section', {
48
47
  class: ['deck-slide', `deck-layout-${layout}`, ...classes.map((name) => `deck-class-${name}`)].join(' '),
49
48
  'data-index': slide.index, 'data-layout': layout, 'data-paper': definition.paper, 'data-align': definition.align, 'data-justify': definition.justify, 'data-title': definition.title,
50
- 'aria-roledescription': 'slide', role: 'group',
49
+ 'aria-roledescription': context.slide, role: 'group',
51
50
  })
52
51
  // Its grid, from the layout's definition, through the CSSOM: areas named s-<slot>, as `default` is no name CSS allows.
53
52
  const canvas = h('div', { class: 'deck-canvas' })
@@ -79,7 +78,7 @@ export function renderSlide(slide, context) {
79
78
 
80
79
  /** @param {Slot} slot @param {Context} context @param {{ step: number }} counter @returns {Node[]} */
81
80
  function blocks(slot, context, counter) {
82
- const tokens = new Lexer({ gfm: true }).lex(slot.text)
81
+ const tokens = context.lex(slot.text)
83
82
  /** @type {Node[]} */
84
83
  const out = []
85
84
  let at = slot.start, mode = /** @type {'' | 'click' | 'clicks'} */ ('')
package/src/strings.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // The deck's own words, for a deck opened on its own; a host gives its own instead (options.strings).
2
2
  const STRINGS = /** @type {Record<string, Record<string, string>>} */ ({
3
- en: { deck: 'Slides', previous: 'Previous', next: 'Next', present: 'Present full screen', presenter: 'Presenter view', overview: 'All slides', edit: 'Change', scheme: 'Light or dark', export: 'Save as PowerPoint', source: 'The deck as text', notes: 'Notes', noNotes: 'No notes for this slide.', upNext: 'Next', last: 'Last slide', where: 'Slide {n} of {count}', saved: 'Saved' },
4
- fr: { deck: 'Diapositives', previous: 'Précédente', next: 'Suivante', present: 'Présenter en plein écran', presenter: 'Vue présentateur', overview: 'Toutes les diapositives', edit: 'Modifier', scheme: 'Clair ou sombre', export: 'Enregistrer en PowerPoint', source: 'La présentation en texte', notes: 'Notes', noNotes: 'Pas de notes pour cette diapositive.', upNext: 'Ensuite', last: 'Dernière diapositive', where: 'Diapositive {n} sur {count}', saved: 'Enregistré' },
5
- ar: { deck: 'الشرائح', previous: 'السابقة', next: 'التالية', present: 'العرض بملء الشاشة', presenter: 'عرض المقدّم', overview: 'كل الشرائح', edit: 'تعديل', scheme: 'فاتح أو داكن', export: 'الحفظ بصيغة PowerPoint', source: 'العرض كنص', notes: 'الملاحظات', noNotes: 'لا ملاحظات لهذه الشريحة.', upNext: 'التالية', last: 'الشريحة الأخيرة', where: 'الشريحة {n} من {count}', saved: 'تم الحفظ' },
6
- ja: { deck: 'スライド', previous: '前へ', next: '次へ', present: '全画面で発表', presenter: '発表者ビュー', overview: 'すべてのスライド', edit: '編集', scheme: 'ライトまたはダーク', export: 'PowerPoint で保存', source: 'テキストとしてのスライド', notes: 'メモ', noNotes: 'このスライドにメモはありません。', upNext: '次', last: '最後のスライド', where: 'スライド {n} / {count}', saved: '保存しました' },
3
+ en: { deck: 'Slides', slide: 'slide', carousel: 'carousel', previous: 'Previous', next: 'Next', present: 'Present full screen', presenter: 'Presenter view', overview: 'All slides', edit: 'Change', scheme: 'Light or dark', export: 'Save as PowerPoint', source: 'The deck as text', notes: 'Notes', noNotes: 'No notes for this slide.', upNext: 'Next', last: 'Last slide', where: 'Slide {n} of {count}', saved: 'Saved' },
4
+ fr: { deck: 'Diapositives', slide: 'diapositive', carousel: 'carrousel', previous: 'Précédente', next: 'Suivante', present: 'Présenter en plein écran', presenter: 'Vue présentateur', overview: 'Toutes les diapositives', edit: 'Modifier', scheme: 'Clair ou sombre', export: 'Enregistrer en PowerPoint', source: 'La présentation en texte', notes: 'Notes', noNotes: 'Pas de notes pour cette diapositive.', upNext: 'Ensuite', last: 'Dernière diapositive', where: 'Diapositive {n} sur {count}', saved: 'Enregistré' },
5
+ ar: { deck: 'الشرائح', slide: 'شريحة', carousel: 'عرض شرائح', previous: 'السابقة', next: 'التالية', present: 'العرض بملء الشاشة', presenter: 'عرض المقدّم', overview: 'كل الشرائح', edit: 'تعديل', scheme: 'فاتح أو داكن', export: 'الحفظ بصيغة PowerPoint', source: 'العرض كنص', notes: 'الملاحظات', noNotes: 'لا ملاحظات لهذه الشريحة.', upNext: 'التالية', last: 'الشريحة الأخيرة', where: 'الشريحة {n} من {count}', saved: 'تم الحفظ' },
6
+ ja: { deck: 'スライド', slide: 'スライド', carousel: 'カルーセル', previous: '前へ', next: '次へ', present: '全画面で発表', presenter: '発表者ビュー', overview: 'すべてのスライド', edit: '編集', scheme: 'ライトまたはダーク', export: 'PowerPoint で保存', source: 'テキストとしてのスライド', notes: 'メモ', noNotes: 'このスライドにメモはありません。', upNext: '次', last: '最後のスライド', where: 'スライド {n} / {count}', saved: '保存しました' },
7
7
  })
8
8
 
9
9
  /** @param {string} lang */
package/src/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // deck's version, which a linked file names in its renderer's address. Kept equal to package.json's by a test.
2
- export const VERSION = '0.1.0'
2
+ export const VERSION = '0.1.1'