@motionscript/latex 0.1.0-alpha.0 → 0.1.0-alpha.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/CHANGELOG.md +16 -0
- package/README.md +27 -20
- package/dist/browser/index.js +18 -18
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/manifest.json +2 -2
- package/dist/geometry.d.ts +7 -1
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +19 -1
- package/dist/geometry.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/tween.js +1 -1
- package/dist/tween.js.map +1 -1
- package/package.json +4 -3
- package/src/geometry.ts +22 -2
- package/src/node.ts +2 -2
- package/src/tween.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @motionscript/latex
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f945a01: `\mathbb`, `\mathcal`, `\mathfrak`, `\mathscr`, `\mathsf` and `\mathtt` typeset.
|
|
8
|
+
|
|
9
|
+
Their glyphs live in font files MathJax loads asynchronously the first time a formula needs one, which the synchronous typesetter cannot wait for, so `buildLatexPath`, the `Latex` constructor and a morph to such a formula threw `MathJax retry`, in a browser and in Node. Those six files are now bundled and set up on the font before anything is typeset. The package depends on `@mathjax/mathjax-newcm-font` directly (it was already installed through `@mathjax/src`), and its browser build grows by about 525 KB minified, 219 KB gzipped. Characters in MathJax's other on-demand ranges, such as accented Latin in `\text{é}`, still throw.
|
|
10
|
+
|
|
11
|
+
## 0.1.0-alpha.2
|
|
12
|
+
|
|
13
|
+
## 0.1.0-alpha.1
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 59cecba: Build on `@motionscript/sdk` instead of `@motionscript/core`. The peer dependency is now `@motionscript/sdk`, every import goes through it (and `@motionscript/sdk/component` for the component machinery), and the browser build leaves `@motionscript/sdk` an import, so an import map names it once. A component copied with `ms add` imports the SDK too, and its registry item depends on `@motionscript/sdk` rather than `@motionscript/core`. `@motionscript/charts/kit` re-exports `@motionscript/sdk/component` where it re-exported `@motionscript/core/component`.
|
|
18
|
+
|
|
3
19
|
## 0.1.0-alpha.0
|
|
4
20
|
|
|
5
21
|
Initial release.
|
package/README.md
CHANGED
|
@@ -5,24 +5,30 @@ node renders a formula to glyph paths with [MathJax](https://www.mathjax.org)
|
|
|
5
5
|
and animates between formulas token by token, so equations morph into one another
|
|
6
6
|
instead of cutting.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Hand `Latex` to the engine through your project entry's `nodes`, and any
|
|
9
|
+
document that engine opens can name it as `latex`:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// src/project.ts
|
|
10
13
|
import { Latex } from '@motionscript/latex';
|
|
11
14
|
|
|
12
|
-
export
|
|
13
|
-
|
|
15
|
+
export const nodes = [Latex];
|
|
16
|
+
```
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
ref={eq}
|
|
18
|
-
fontSize={64}
|
|
19
|
-
fill="white"
|
|
20
|
-
latex="a^2 + b^2 = c^2"
|
|
21
|
-
/>,
|
|
22
|
-
);
|
|
18
|
+
```ts
|
|
19
|
+
import type { CompositionDocument } from '@motionscript/sdk';
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
export default {
|
|
22
|
+
kind: 'composition',
|
|
23
|
+
nodes: [
|
|
24
|
+
{ id: 'eq', type: 'latex', parentId: null, layerOrder: 0,
|
|
25
|
+
props: { latex: 'a^2 + b^2 = c^2', fontSize: 64, fill: 'white' } },
|
|
26
|
+
],
|
|
27
|
+
commands: [
|
|
28
|
+
{ id: 'solve', type: 'to', targetId: 'eq', at: 0, duration: 1.2,
|
|
29
|
+
args: { latex: 'c = \\sqrt{a^2 + b^2}' } },
|
|
30
|
+
],
|
|
31
|
+
} satisfies CompositionDocument;
|
|
26
32
|
```
|
|
27
33
|
|
|
28
34
|
## What's in here
|
|
@@ -30,7 +36,7 @@ export default createScene(function* (stage) {
|
|
|
30
36
|
- **`Latex`** node, a `ShapeNode` that draws a formula as fillable, strokable
|
|
31
37
|
glyph paths. Set `latex` to the TeX source and `fontSize` to scale it; `fill`,
|
|
32
38
|
`stroke`, `shadow`, and `padding` work like any other shape.
|
|
33
|
-
- **Formula morphing
|
|
39
|
+
- **Formula morphing**: a `to` command on `latex` (or `fontSize`) interpolates each
|
|
34
40
|
glyph between the current and target formula, matching tokens that persist,
|
|
35
41
|
fading out tokens that leave, and fading in tokens that arrive. A persisting
|
|
36
42
|
glyph is carried by its geometry, so one that changes size on the way — the
|
|
@@ -45,17 +51,18 @@ TeX is parsed through MathJax with the `base`, `ams`, `boldsymbol`,
|
|
|
45
51
|
`newcommand`, `cancel`, `color`, `mhchem`, `physics`, `bbox`, and `mathtools`
|
|
46
52
|
packages enabled. Rendering is synchronous and browser-only.
|
|
47
53
|
|
|
48
|
-
This package
|
|
49
|
-
|
|
50
|
-
[`@motionscript/browser`](../../browser).
|
|
54
|
+
This package is written against [`@motionscript/sdk`](../../sdk), which it
|
|
55
|
+
takes as a peer dependency, and renders through whatever backend draws the
|
|
56
|
+
scene, such as [`@motionscript/browser`](../../browser).
|
|
51
57
|
|
|
52
58
|
## Usage
|
|
53
59
|
|
|
54
60
|
```bash
|
|
55
|
-
npm install @motionscript/latex
|
|
61
|
+
npm install @motionscript/latex @motionscript/sdk
|
|
56
62
|
```
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
Or copy the node's source into your project with `ms add latex`
|
|
65
|
+
(see [`@motionscript/cli`](../../cli)). See the [docs](https://motionscript.dev/docs) for the full feature set and API
|
|
59
66
|
reference.
|
|
60
67
|
|
|
61
68
|
## Development
|