@davidnugent2425/manim-web-questions 0.1.0-dev.1 → 0.1.0-dev.3
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 +55 -76
- package/dist/index.js +418 -380
- package/dist/types/arrow.d.ts +2 -6
- package/dist/types/basis-transform-scene.d.ts +11 -0
- package/dist/types/drag-target-scene.d.ts +10 -2
- package/dist/types/frame.d.ts +33 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plane-scene.d.ts +9 -19
- package/dist/types/plane.d.ts +4 -3
- package/dist/types/polygon-drag-scene.d.ts +7 -0
- package/dist/types/reference-vector.d.ts +1 -1
- package/dist/types/theme.d.ts +58 -38
- package/package.json +19 -17
package/README.md
CHANGED
|
@@ -1,45 +1,29 @@
|
|
|
1
1
|
# manim-web-questions
|
|
2
2
|
|
|
3
|
-
Graded interactive [manim-web](https://github.com/maloyan/manim-web) scenes
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- `basis-transform-scene.ts` — drag î and ĵ to perform a linear transformation, with
|
|
28
|
-
opt-in labels, span parallelogram, and carried vector;
|
|
29
|
-
- `polygon-drag-scene.ts` — drag polygon corners, freely or along an L-shaped rail,
|
|
30
|
-
with per-corner margin grading.
|
|
31
|
-
- **The interaction kit** — the shared building blocks scenes compose: coordinate math,
|
|
32
|
-
snapping, grab forgiveness, arrows, async MathTex, rails, targets, answer reveal,
|
|
33
|
-
guides, and probes.
|
|
34
|
-
- **Pure helpers and the theme** — margin grading, 2×2 matrix math, the scene state
|
|
35
|
-
machine, build epochs, and the faithful 3b1b/manim palette (`theme.ts`).
|
|
36
|
-
|
|
37
|
-
[CONTEXT.md](CONTEXT.md) holds the module-by-module inventory. The only runtime
|
|
38
|
-
dependency is `manim-web`.
|
|
39
|
-
|
|
40
|
-
## Example
|
|
41
|
-
|
|
42
|
-
A minimal host mounts a scene and renders its own UI from emitted state:
|
|
3
|
+
Graded interactive [manim-web](https://github.com/maloyan/manim-web) scenes for the browser.
|
|
4
|
+
A scene renders to a `<canvas>`, the reader manipulates it (drag, click) to answer, and the
|
|
5
|
+
host grades it through a small typed API. No UI framework is required on either side, and
|
|
6
|
+
the only runtime dependency is `manim-web`.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
> Not on the public registry yet. Once it lands the install line becomes
|
|
11
|
+
> `npm install <FINAL_NPM_PACKAGE_NAME>` and the package page will live at
|
|
12
|
+
> `https://www.npmjs.com/package/<FINAL_NPM_PACKAGE_NAME>`.
|
|
13
|
+
|
|
14
|
+
Development prereleases are published under the `dev` dist-tag (there is no `latest` yet):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @davidnugent2425/manim-web-questions@dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Node 22 or newer (Node 20 reached end of life in April 2026). The published artifact is
|
|
21
|
+
`dist/` (ESM plus type declarations), so any bundler that understands ESM works.
|
|
22
|
+
|
|
23
|
+
## Use it
|
|
24
|
+
|
|
25
|
+
Pick a scene family, hand it a spec, mount the returned function into an element, and drive
|
|
26
|
+
it through the returned `SceneApi`:
|
|
43
27
|
|
|
44
28
|
```ts
|
|
45
29
|
import { createDragTargetScene, type SceneState } from '@davidnugent2425/manim-web-questions';
|
|
@@ -54,61 +38,56 @@ const mount = createDragTargetScene({
|
|
|
54
38
|
createExtra: () => ({}),
|
|
55
39
|
});
|
|
56
40
|
|
|
57
|
-
const api = mount(document.getElementById('scene
|
|
41
|
+
const api = mount(document.getElementById('scene')!);
|
|
42
|
+
|
|
58
43
|
api.onState((state: SceneState) => {
|
|
59
|
-
if (state.kind === 'graded')
|
|
60
|
-
showVerdict(state.result.ok); // wording/UI is the host's job
|
|
61
|
-
}
|
|
44
|
+
if (state.kind === 'graded') showVerdict(state.result.ok); // wording is yours
|
|
62
45
|
});
|
|
63
46
|
|
|
64
47
|
checkButton.onclick = () => api.checkAnswer();
|
|
65
48
|
resetButton.onclick = () => api.reset();
|
|
66
49
|
```
|
|
67
50
|
|
|
68
|
-
|
|
51
|
+
That is the whole integration surface. A host supplies a container, controls that call
|
|
52
|
+
`checkAnswer()` / `reset()`, and verdict UI rendered from emitted state. The scene never
|
|
53
|
+
touches DOM outside its container and never decides wording, so grading results carry
|
|
54
|
+
correctness only.
|
|
69
55
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
56
|
+
Three scene families ship today: dragging one vector onto a target, dragging î and ĵ to
|
|
57
|
+
perform a linear transformation, and dragging polygon corners. Canvas geometry, snapping
|
|
58
|
+
and drag limits are per-scene options, and colors, fonts and arrow styling come from a
|
|
59
|
+
package-wide theme that defaults to the familiar 3b1b look.
|
|
74
60
|
|
|
75
|
-
|
|
61
|
+
[**Scene families, options and the interaction kit**](src/README.md) covers all of that in
|
|
62
|
+
detail, including a plain-HTML host and a Vue host you can copy.
|
|
63
|
+
[community-3b1b-quizzes](https://github.com/davidnugent2425/community-3b1b-quizzes) is a
|
|
64
|
+
full Vue host built on this package, with fourteen lessons of linear-algebra questions. Its
|
|
65
|
+
lesson list, and one of its questions running a scene from here:
|
|
76
66
|
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
| A host built on this package | One of its graded scenes |
|
|
68
|
+
| ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
69
|
+
|  |  |
|
|
79
70
|
|
|
80
|
-
|
|
81
|
-
pnpm add @davidnugent2425/manim-web-questions@dev
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Development
|
|
71
|
+
## Develop
|
|
85
72
|
|
|
86
73
|
```bash
|
|
87
74
|
pnpm install
|
|
88
75
|
pnpm typecheck && pnpm lint && pnpm format:check && pnpm test
|
|
89
|
-
pnpm build
|
|
90
|
-
pnpm
|
|
91
|
-
pnpm test:e2e # browser mechanics suite against the e2e/harness fixtures
|
|
92
|
-
npm pack --dry-run
|
|
76
|
+
pnpm build
|
|
77
|
+
pnpm dev # plain HTML page mounting the fixture scenes, http://localhost:8080
|
|
93
78
|
```
|
|
94
79
|
|
|
95
|
-
`pnpm
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
dev prereleases (`0.1.0-dev.N`) go out with `npm publish --tag dev` so nothing lands on
|
|
100
|
-
`latest`, and every publish goes to the user-scoped `@davidnugent2425/manim-web-questions`
|
|
101
|
-
(the unscoped name is deliberately unclaimed). `prepack` rebuilds `dist/`, and
|
|
102
|
-
`publishConfig.access: "public"` is set, so no extra flags are needed.
|
|
103
|
-
|
|
104
|
-
## Supply chain
|
|
80
|
+
`pnpm test:e2e` runs the browser suite in Chromium, see [e2e/README.md](e2e/README.md).
|
|
81
|
+
Dependency installs go through a 7-day release-age gate and a no-downgrade trust policy, and
|
|
82
|
+
skip auto-installing optional peers, all set in `pnpm-workspace.yaml`. CI runs everything above on every push. Publishing is maintainer-only, see
|
|
83
|
+
[RELEASING.md](RELEASING.md).
|
|
105
84
|
|
|
106
|
-
|
|
107
|
-
|
|
85
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) has the rules of the road for new scenes, and
|
|
86
|
+
[CONTEXT.md](CONTEXT.md) holds the shared vocabulary.
|
|
108
87
|
|
|
109
88
|
## Provenance
|
|
110
89
|
|
|
111
90
|
Extracted from
|
|
112
|
-
[community-3b1b-quizzes](https://github.com/davidnugent2425/community-3b1b-quizzes),
|
|
113
|
-
|
|
114
|
-
|
|
91
|
+
[community-3b1b-quizzes](https://github.com/davidnugent2425/community-3b1b-quizzes), where
|
|
92
|
+
the layer grew question by question. This repository keeps that full git history, so
|
|
93
|
+
`git log` and `git blame` reach back through the extraction.
|