chalk-talk 0.8.0 → 0.10.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 +15 -1
- package/assets/player.html +128 -101
- package/embed-mermaid.d.ts +3 -0
- package/embed-mermaid.js +182 -0
- package/embed.d.ts +26 -0
- package/embed.js +135 -0
- package/markdown.d.ts +7 -0
- package/markdown.js +42 -0
- package/mount.d.ts +5 -0
- package/mount.global.js +316 -0
- package/mount.js +3 -0
- package/package.json +65 -7
- package/player.js +135 -108
- package/scripts/contract.mjs +1 -1
- package/scripts/mermaid.mjs +145 -144
package/embed.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// chalk-talk/embed: one lesson mounted inside an element. The recipe format: https://github.com/ruinosus/chalk-talk
|
|
2
|
+
export type Theme = 'paper' | 'chalkboard'
|
|
3
|
+
/** A checked recipe (what readRecipe returns). */
|
|
4
|
+
export interface Scene { id: string; title: string; width: number; height: number; theme?: Theme; locale?: string; steps: unknown[]; [key: string]: unknown }
|
|
5
|
+
export interface Mounted { destroy(): void }
|
|
6
|
+
export interface LessonOptions {
|
|
7
|
+
/** Button language; the browser's by default. */
|
|
8
|
+
lang?: 'en' | 'pt'
|
|
9
|
+
/** The lesson inside a note: chapters, Values and Expand on top, the bar below; opens on chapter 1, drawn and still. */
|
|
10
|
+
compact?: boolean
|
|
11
|
+
/** The theme when the recipe has none. */
|
|
12
|
+
theme?: Theme
|
|
13
|
+
/** 'document': arrow keys and Space work anywhere on the page; otherwise only while the focus is in the lesson. */
|
|
14
|
+
keys?: 'document' | 'self'
|
|
15
|
+
/** Shows «Expand», which calls this. */
|
|
16
|
+
onExpand?: () => void
|
|
17
|
+
}
|
|
18
|
+
/** A mistake in the text syntax, with its line. */
|
|
19
|
+
export class ChalkTextError extends Error { line: number }
|
|
20
|
+
/** JSON when the text starts with "{", the text syntax otherwise; throws ChalkTextError or the contract's Error. */
|
|
21
|
+
export function readRecipe(source: string): Scene
|
|
22
|
+
export function mountLesson(root: HTMLElement, scene: Scene, options?: LessonOptions): Promise<Mounted>
|
|
23
|
+
/** The whole drawing at once, still (an exported PDF, a printed page). */
|
|
24
|
+
export function stillLesson(root: HTMLElement, scene: Scene, theme?: Theme): Promise<void>
|
|
25
|
+
export function ensureStyles(doc?: Document): void
|
|
26
|
+
export function removeStyles(doc?: Document): void
|