chalk-talk 0.8.0 → 0.9.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 +120 -101
- package/embed-mermaid.d.ts +3 -0
- package/embed-mermaid.js +181 -0
- package/embed.d.ts +26 -0
- package/embed.js +127 -0
- package/package.json +47 -7
- package/player.js +127 -108
- package/scripts/contract.mjs +1 -1
- package/scripts/mermaid.mjs +48 -48
package/README.md
CHANGED
|
@@ -10,13 +10,27 @@ Hand-drawn lessons that draw themselves, from a small JSON **recipe** — the pl
|
|
|
10
10
|
<meta charset="utf-8">
|
|
11
11
|
<title>My lesson</title>
|
|
12
12
|
<script type="application/json" id="chalk-recipe">{ "id": "my-lesson", "title": "…", "width": 900, "height": 560, "steps": [ … ] }</script>
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/chalk-talk@0.
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/chalk-talk@0.9.0/player.js"></script>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
The player builds the page around the recipe — chapters, Next / Back, values to move, the check, downloads — and needs
|
|
17
17
|
nothing else. A course is `{ "course": "Title", "lessons": [recipe, recipe, …] }`, each lesson opened with
|
|
18
18
|
`?lesson=n`.
|
|
19
19
|
|
|
20
|
+
## Inside an element (a note, a docs page, an app)
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { mountLesson, readRecipe } from 'chalk-talk/embed'
|
|
24
|
+
|
|
25
|
+
const lesson = await mountLesson(element, readRecipe(text), { compact: true })
|
|
26
|
+
// … later: lesson.destroy()
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`readRecipe` takes the text syntax or JSON (a mistake in the text says its line: `ChalkTextError`). `compact` is the
|
|
30
|
+
lesson for a note: chapters, Values and Expand on top, the bar below, opening on chapter 1 drawn and still. Several
|
|
31
|
+
lessons can share a page. A Mermaid flowchart: `readMermaid(text)` from `chalk-talk/embed-mermaid` (apart, as it carries
|
|
32
|
+
Mermaid).
|
|
33
|
+
|
|
20
34
|
## From the command line
|
|
21
35
|
|
|
22
36
|
```
|